Skip to content

Commit

Permalink
Re-enabled first-person weapon model
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Simon committed May 1, 2021
1 parent 4d5b417 commit 160ff8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Game::Game()
75.0f, 0.1f, 3000.0f, 5.0f);
renderer = std::make_shared<Renderer>(window, input, camera);

// weaponModel = renderer->loadModel("Models/Machinegun/", "Machinegun.fbx");
// weaponModel->scale = glm::vec3(0.1f);
weaponModel = renderer->loadModel("Models/Machinegun/", "Machinegun.fbx");
weaponModel->scale = glm::vec3(0.1f);

renderer->loadModel("Models/Sponza/", "Sponza.fbx");
// auto sanMiguelModel = renderer->loadModel("Models/SanMiguel/", "san-miguel-low-poly.obj");
Expand Down Expand Up @@ -162,21 +162,20 @@ bool Game::update(float delta)
oldManModel->setYaw(oldManModel->getYaw() + delta * 0.1f);
oldManModel->recalculateAxesFromAngles();

/*
glm::vec3 weaponTargetPosition = camera->position + camera->getForward() * 16.0f - camera->getUp() * 9.0f -
camera->getRight() * 3.5f; if (input->rightMouseButtonPressed)
glm::vec3 weaponTargetPosition =
camera->position + camera->getForward() * 16.0f - camera->getUp() * 9.0f - camera->getRight() * 3.5f;
if (input->rightMouseButtonPressed)
{
weaponTargetPosition = camera->position + camera->getForward() * 12.0f - camera->getUp() * 8.3f;
}
//weaponModel->position = glm::mix(weaponModel->position, weaponTargetPosition, delta *
(input->rightMouseButtonPressed ? 0.025f : 0.09f)); weaponModel->position = weaponTargetPosition;
// weaponModel->position = glm::mix(weaponModel->position, weaponTargetPosition, delta *
// (input->rightMouseButtonPressed ? 0.025f : 0.09f));*/
weaponModel->position = weaponTargetPosition;

weaponModel->setYaw(camera->getYaw());
weaponModel->setPitch(camera->getPitch() - 90.0f);
weaponModel->setRoll(camera->getRoll());
weaponModel->recalculateAxesFromAngles();
*/

renderer->updateBuffers();

Expand Down
2 changes: 1 addition & 1 deletion src/Game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Game
std::shared_ptr<Input> input;
std::shared_ptr<Camera> camera;
std::shared_ptr<Renderer> renderer;
std::shared_ptr<Model> oldManModel; //, weaponModel;
std::shared_ptr<Model> oldManModel, weaponModel;

public:
Game();
Expand Down

0 comments on commit 160ff8c

Please sign in to comment.