Adjustin'
This commit is contained in:
parent
9162b9327e
commit
d10606dca5
4 changed files with 16 additions and 13 deletions
|
@ -18,7 +18,7 @@ public:
|
|||
|
||||
float pitch = 0., yaw = -90., roll = 0.;
|
||||
|
||||
float movementSpeed = 5.0f;
|
||||
float movementSpeed = 10.0f;
|
||||
float mouseSensitivity = 0.2f;
|
||||
|
||||
Camera(glm::vec3 initialPosition);
|
||||
|
|
|
@ -45,9 +45,9 @@ int main() {
|
|||
parts.push_back(Part {
|
||||
.position = glm::vec3(0, -5, 0),
|
||||
.rotation = glm::vec3(0),
|
||||
.scale = glm::vec3(5, 1, 5),
|
||||
.scale = glm::vec3(512, 1.2, 512),
|
||||
.material = Material {
|
||||
.diffuse = glm::vec3(1.0f, 0.5f, 0.31f),
|
||||
.diffuse = glm::vec3(0.388235, 0.372549, 0.384314),
|
||||
.specular = glm::vec3(0.5f, 0.5f, 0.5f),
|
||||
.shininess = 32.0f,
|
||||
},
|
||||
|
@ -58,9 +58,9 @@ int main() {
|
|||
parts.push_back(Part {
|
||||
.position = glm::vec3(0),
|
||||
.rotation = glm::vec3(0),
|
||||
.scale = glm::vec3(1, 1, 1),
|
||||
.scale = glm::vec3(4, 1.2, 2),
|
||||
.material = Material {
|
||||
.diffuse = glm::vec3(1.0f, 0.5f, 0.31f),
|
||||
.diffuse = glm::vec3(0.639216f, 0.635294f, 0.647059f),
|
||||
.specular = glm::vec3(0.5f, 0.5f, 0.5f),
|
||||
.shininess = 32.0f,
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ void simulationInit() {
|
|||
rp::Quaternion orientation = rp::Quaternion::identity();
|
||||
rp::Transform transform(position, orientation);
|
||||
rp::RigidBody* body = world->createRigidBody(transform);
|
||||
world->setGravity(rp::Vector3(0, -196.2, 0));
|
||||
}
|
||||
|
||||
void syncPartPhysics(Part& part) {
|
||||
|
@ -48,6 +49,7 @@ void syncPartPhysics(Part& part) {
|
|||
part.rigidBody->removeCollider(part.rigidBody->getCollider(0));
|
||||
}
|
||||
|
||||
if (part.rigidBody->getNbColliders() == 0)
|
||||
part.rigidBody->addCollider(shape, rp::Transform());
|
||||
part.rigidBody->setType(part.anchored ? rp::BodyType::STATIC : rp::BodyType::DYNAMIC);
|
||||
}
|
||||
|
|
|
@ -51,20 +51,20 @@ void renderParts() {
|
|||
|
||||
// Use shader
|
||||
shader->use();
|
||||
shader->set("objectColor", glm::vec3(1.0f, 0.5f, 0.31f));
|
||||
shader->set("lightColor", glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
// shader->set("objectColor", glm::vec3(1.0f, 0.5f, 0.31f));
|
||||
// shader->set("lightColor", glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
|
||||
// view/projection transformations
|
||||
glm::mat4 projection = glm::perspective(glm::radians(45.f), (float)1200 / (float)900, 0.1f, 100.0f);
|
||||
glm::mat4 view = camera.getLookAt();
|
||||
shader->set("projection", projection);
|
||||
shader->set("view", view);
|
||||
shader->set("material", Material {
|
||||
// .ambient = glm::vec3(1.0f, 0.5f, 0.31f),
|
||||
.diffuse = glm::vec3(1.0f, 0.5f, 0.31f),
|
||||
.specular = glm::vec3(0.5f, 0.5f, 0.5f),
|
||||
.shininess = 32.0f,
|
||||
});
|
||||
// shader->set("material", Material {
|
||||
// // .ambient = glm::vec3(1.0f, 0.5f, 0.31f),
|
||||
// .diffuse = glm::vec3(0.639216f, 0.635294f, 0.647059f),
|
||||
// .specular = glm::vec3(0.5f, 0.5f, 0.5f),
|
||||
// .shininess = 16.0f,
|
||||
// });
|
||||
shader->set("sunLight", DirLight {
|
||||
.direction = glm::vec3(-0.2f, -1.0f, -0.3f),
|
||||
.ambient = glm::vec3(0.2f, 0.2f, 0.2f),
|
||||
|
@ -93,6 +93,7 @@ void renderParts() {
|
|||
model = model * glm::mat4_cast(part.rotation);
|
||||
model = glm::scale(model, part.scale);
|
||||
shader->set("model", model);
|
||||
shader->set("material", part.material);
|
||||
glm::mat3 normalMatrix = glm::mat3(glm::transpose(glm::inverse(model)));
|
||||
shader->set("normalMatrix", normalMatrix);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue