Develop into master #9
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace collision
|
namespace collision
|
||||||
{
|
{
|
||||||
void CheckCollisions(std::vector<std::shared_ptr<entities::CollisionEntity>>& entities)
|
void CheckCollisions(std::deque<std::shared_ptr<entities::CollisionEntity>>& entities)
|
||||||
{
|
{
|
||||||
if (entities.size() < 2) { return; }
|
if (entities.size() < 2) { return; }
|
||||||
if (entities.size() == 2)
|
if (entities.size() == 2)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../entities/collision_entity.h"
|
#include "../entities/collision_entity.h"
|
||||||
#include "collision.h"
|
#include "collision.h"
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
namespace collision
|
namespace collision
|
||||||
{
|
{
|
||||||
@@ -13,5 +14,5 @@ namespace collision
|
|||||||
*
|
*
|
||||||
* @param entities: A list with all the collision entities.
|
* @param entities: A list with all the collision entities.
|
||||||
*/
|
*/
|
||||||
void CheckCollisions(std::vector<std::shared_ptr<entities::CollisionEntity>>& entities);
|
void CheckCollisions(std::deque<std::shared_ptr<entities::CollisionEntity>>& entities);
|
||||||
}
|
}
|
||||||
@@ -40,8 +40,8 @@ namespace entities
|
|||||||
|
|
||||||
const glm::vec3 size = bounding_box.size;
|
const glm::vec3 size = bounding_box.size;
|
||||||
|
|
||||||
min_xyz = { bounding_box.center_pos.x - (0.5 * size.x), bounding_box.center_pos.y, bounding_box.center_pos.z - (0.5 * size.z) };
|
min_xyz = { bounding_box.center_pos.x - (0.5 * size.x), bounding_box.center_pos.y, bounding_box.center_pos.z + (0.5 * size.z) };
|
||||||
max_xyz = { bounding_box.center_pos.x + (0.5 * size.x), bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + (0.5 * size.z) };
|
max_xyz = { bounding_box.center_pos.x + (0.5 * size.x), bounding_box.center_pos.y + size.y, bounding_box.center_pos.z - (0.5 * size.z) };
|
||||||
|
|
||||||
// min_xyz = bounding_box.center_pos;
|
// min_xyz = bounding_box.center_pos;
|
||||||
// max_xyz = { bounding_box.center_pos.x + size.x, bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + size.z };
|
// max_xyz = { bounding_box.center_pos.x + size.x, bounding_box.center_pos.y + size.y, bounding_box.center_pos.z + size.z };
|
||||||
|
|||||||
@@ -214,5 +214,4 @@ namespace scene
|
|||||||
render_engine::renderer::Render(score_textures_gameOver[digits[i]], *gui_shader_gameOver);
|
render_engine::renderer::Render(score_textures_gameOver[digits[i]], *gui_shader_gameOver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
std::shared_ptr<entities::MainCharacter>main_character;
|
std::shared_ptr<entities::MainCharacter>main_character;
|
||||||
std::vector<std::shared_ptr<entities::CollisionEntity>> collision_entities;
|
std::deque<std::shared_ptr<entities::CollisionEntity>> collision_entities;
|
||||||
|
|
||||||
//std::deque<std::shared_ptr<entities::CollisionEntity>> furniture_collision;
|
//std::deque<std::shared_ptr<entities::CollisionEntity>> furniture_collision;
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ namespace scene
|
|||||||
for (int i = 0; i < furniture_count; i++)
|
for (int i = 0; i < furniture_count; i++)
|
||||||
{
|
{
|
||||||
house_models.pop_front();
|
house_models.pop_front();
|
||||||
collision_entities.pop_back();
|
collision_entities.erase(collision_entities.begin() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int z_offset = model_pos * (house_generator->GetHouseDepth()); // how much "in the distance" we should load the model
|
int z_offset = model_pos * (house_generator->GetHouseDepth()); // how much "in the distance" we should load the model
|
||||||
@@ -158,8 +158,10 @@ namespace scene
|
|||||||
models::TexturedModel model_char = { raw_model_char, texture };
|
models::TexturedModel model_char = { raw_model_char, texture };
|
||||||
collision::Box char_box = create_bounding_box(raw_model_char.model_size, glm::vec3(0, 0, 0), 1);
|
collision::Box char_box = create_bounding_box(raw_model_char.model_size, glm::vec3(0, 0, 0), 1);
|
||||||
main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, 50, -100), glm::vec3(0, 90, 0), 5, char_box);
|
main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, 50, -100), glm::vec3(0, 90, 0), 5, char_box);
|
||||||
collision_entities.push_back(main_character);
|
|
||||||
|
//collision_entities.push_back(main_character);
|
||||||
house_generator = new entities::HouseGenerator();
|
house_generator = new entities::HouseGenerator();
|
||||||
|
|
||||||
// load the first few house models
|
// load the first few house models
|
||||||
for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++)
|
for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++)
|
||||||
{
|
{
|
||||||
@@ -297,8 +299,10 @@ namespace scene
|
|||||||
}
|
}
|
||||||
// remember the position at which the new model was added
|
// remember the position at which the new model was added
|
||||||
last_model_pos = model_pos;
|
last_model_pos = model_pos;
|
||||||
|
collision_entities.push_front(main_character);
|
||||||
|
|
||||||
collision::CheckCollisions(collision_entities);
|
collision::CheckCollisions(collision_entities);
|
||||||
|
collision_entities.pop_front();
|
||||||
|
|
||||||
update_hand_detection();
|
update_hand_detection();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user