merge Feature/loading all models into develop #8
@@ -49,12 +49,13 @@ namespace entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HouseGenerator::GenerateHouse(std::deque<std::shared_ptr<Entity>>* furniture_list , const glm::vec3& position, float y_rotation)
|
void HouseGenerator::GenerateHouse(std::deque<std::shared_ptr<CollisionEntity>>* furniture_list , const glm::vec3& position, float y_rotation)
|
||||||
{
|
{
|
||||||
std::deque<std::shared_ptr<Entity>> furniture;
|
std::deque<std::shared_ptr<Entity>> furniture;
|
||||||
|
|
||||||
// Add house
|
// Add house
|
||||||
furniture_list->push_front(std::make_shared<Entity>(singleton::Model_Storage::get_instance()->get_house_model(), position, glm::vec3(0, y_rotation, 0), HOUSE_SIZE));
|
collision::Box bounding_box = { glm::vec3(0, 0, 0), glm::vec3(0, 0, 0) };
|
||||||
|
furniture_list->push_front(std::make_shared<CollisionEntity>(singleton::Model_Storage::get_instance()->get_house_model(), position, glm::vec3(0, y_rotation, 0), HOUSE_SIZE, bounding_box));
|
||||||
int house_size_x = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
int house_size_x = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
||||||
int house_size_y = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
int house_size_y = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
||||||
int house_size_z = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
int house_size_z = singleton::Model_Storage::get_instance()->get_house_model().raw_model.model_size.x * HOUSE_SIZE;
|
||||||
@@ -76,7 +77,7 @@ namespace entities
|
|||||||
//if (!(furniture_piece->size > 1 && x > 1)) {
|
//if (!(furniture_piece->size > 1 && x > 1)) {
|
||||||
glm::vec3 model_pos = glm::vec3(position.x + (x * multiplier_x) - (multiplier_x / 2) - offset_x, position.y, position.z + (z * multiplier_z) - (multiplier_z / 2) + offset_z);
|
glm::vec3 model_pos = glm::vec3(position.x + (x * multiplier_x) - (multiplier_x / 2) - offset_x, position.y, position.z + (z * multiplier_z) - (multiplier_z / 2) + offset_z);
|
||||||
|
|
||||||
collision::Box model_box = { model_pos, model.raw_model.model_size };
|
collision::Box model_box = { model_pos, model.raw_model.model_size * HOUSE_SIZE };
|
||||||
model_box.SetRotation(-90);
|
model_box.SetRotation(-90);
|
||||||
furniture_list->push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
|
furniture_list->push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include <deque>
|
#include <deque>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "collision_entity.h"
|
||||||
#include "../models/Model.h"
|
#include "../models/Model.h"
|
||||||
#include "../collision/collision.h"
|
#include "../collision/collision.h"
|
||||||
#include "../model_Storage.h"
|
#include "../model_Storage.h"
|
||||||
@@ -24,7 +26,7 @@ namespace entities
|
|||||||
*
|
*
|
||||||
* @return: A list with all the entities of the generated house (the furniture)
|
* @return: A list with all the entities of the generated house (the furniture)
|
||||||
*/
|
*/
|
||||||
void GenerateHouse(std::deque<std::shared_ptr<Entity>>* furniture_list, const glm::vec3& position, float y_rotation);
|
void GenerateHouse(std::deque<std::shared_ptr<CollisionEntity>>* furniture_list, const glm::vec3& position, float y_rotation);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief: Returns the depth of the house (chunk)
|
* @brief: Returns the depth of the house (chunk)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace gui
|
|||||||
virtual GuiType GetType() {
|
virtual GuiType GetType() {
|
||||||
return GuiType::LABEL;
|
return GuiType::LABEL;
|
||||||
}
|
}
|
||||||
GuiTexture(int texture, glm::vec2 position, glm::vec2 scale): texture(texture), position(position), scale(scale)
|
GuiTexture(GLuint texture, glm::vec2 position, glm::vec2 scale): texture(texture), position(position), scale(scale)
|
||||||
{
|
{
|
||||||
scale.x /= (WINDOW_WIDTH / WINDOW_HEIGHT);
|
scale.x /= (WINDOW_WIDTH / WINDOW_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace scene
|
|||||||
}
|
}
|
||||||
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
|
||||||
|
|
||||||
std::deque<std::shared_ptr<entities::Entity>> furniture;
|
std::deque<std::shared_ptr<entities::CollisionEntity>> furniture;
|
||||||
house_generator->GenerateHouse(&furniture, glm::vec3(0, -75, -50 - z_offset), 90);
|
house_generator->GenerateHouse(&furniture, glm::vec3(0, -75, -50 - z_offset), 90);
|
||||||
furniture_count = furniture.size();
|
furniture_count = furniture.size();
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace scene
|
|||||||
shader_test = new shaders::EntityShader;
|
shader_test = new shaders::EntityShader;
|
||||||
shader_test->Init();
|
shader_test->Init();
|
||||||
render_engine::renderer::Init(*shader_test);
|
render_engine::renderer::Init(*shader_test);
|
||||||
|
delete shader_test;
|
||||||
|
|
||||||
gui_shader = new shaders::GuiShader();
|
gui_shader = new shaders::GuiShader();
|
||||||
gui_shader->Init();
|
gui_shader->Init();
|
||||||
@@ -35,6 +36,10 @@ namespace scene
|
|||||||
Scenes Loading_Scene::start(GLFWwindow* window)
|
Scenes Loading_Scene::start(GLFWwindow* window)
|
||||||
{
|
{
|
||||||
render();
|
render();
|
||||||
|
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
glfwPollEvents();
|
||||||
|
|
||||||
load_default_variables();
|
load_default_variables();
|
||||||
load_all_models();
|
load_all_models();
|
||||||
|
|
||||||
@@ -45,13 +50,9 @@ namespace scene
|
|||||||
{
|
{
|
||||||
render_engine::renderer::Prepare();
|
render_engine::renderer::Prepare();
|
||||||
//starts the shader and begins to render
|
//starts the shader and begins to render
|
||||||
shader_test->Start();
|
//shader_test->Start();
|
||||||
shader_test->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
//shader_test->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
||||||
shader_test->LoadViewMatrix(*camera_test);
|
//shader_test->LoadViewMatrix(*camera_test);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*render_engine::renderer::Prepare();
|
|
||||||
|
|
||||||
gui::GuiTexture loading_image = { render_engine::loader::LoadTexture("res/loading_screen.png"),
|
gui::GuiTexture loading_image = { render_engine::loader::LoadTexture("res/loading_screen.png"),
|
||||||
glm::vec2(0,0),glm::vec2(1,1) };
|
glm::vec2(0,0),glm::vec2(1,1) };
|
||||||
@@ -59,8 +60,10 @@ namespace scene
|
|||||||
std::vector<gui::GuiTexture*> image_list;
|
std::vector<gui::GuiTexture*> image_list;
|
||||||
image_list.push_back(&loading_image);
|
image_list.push_back(&loading_image);
|
||||||
|
|
||||||
render_engine::renderer::Render(image_list, *gui_shader);*/
|
render_engine::renderer::Render(image_list, *gui_shader);
|
||||||
shader_test->Stop();
|
//shader_test->Stop();
|
||||||
|
|
||||||
|
gui_shader->CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loading_Scene::update(GLFWwindow* window)
|
void Loading_Scene::update(GLFWwindow* window)
|
||||||
|
|||||||
Reference in New Issue
Block a user