[EDIT] loadingscreen now has a background, and got rid of some memory leaks
This commit is contained in:
@@ -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;
|
||||
|
||||
// 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_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;
|
||||
@@ -76,7 +77,7 @@ namespace entities
|
||||
//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);
|
||||
|
||||
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);
|
||||
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 <memory>
|
||||
#include <map>
|
||||
|
||||
#include "collision_entity.h"
|
||||
#include "../models/Model.h"
|
||||
#include "../collision/collision.h"
|
||||
#include "../model_Storage.h"
|
||||
@@ -24,7 +26,7 @@ namespace entities
|
||||
*
|
||||
* @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)
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace gui
|
||||
virtual GuiType GetType() {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace scene
|
||||
}
|
||||
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);
|
||||
furniture_count = furniture.size();
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace scene
|
||||
shader_test = new shaders::EntityShader;
|
||||
shader_test->Init();
|
||||
render_engine::renderer::Init(*shader_test);
|
||||
|
||||
delete shader_test;
|
||||
|
||||
gui_shader = new shaders::GuiShader();
|
||||
gui_shader->Init();
|
||||
|
||||
@@ -35,6 +36,10 @@ namespace scene
|
||||
Scenes Loading_Scene::start(GLFWwindow* window)
|
||||
{
|
||||
render();
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
||||
load_default_variables();
|
||||
load_all_models();
|
||||
|
||||
@@ -45,22 +50,20 @@ namespace scene
|
||||
{
|
||||
render_engine::renderer::Prepare();
|
||||
//starts the shader and begins to render
|
||||
shader_test->Start();
|
||||
shader_test->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
||||
shader_test->LoadViewMatrix(*camera_test);
|
||||
|
||||
|
||||
|
||||
/*render_engine::renderer::Prepare();
|
||||
|
||||
//shader_test->Start();
|
||||
//shader_test->LoadSkyColor(render_engine::renderer::SKY_COLOR);
|
||||
//shader_test->LoadViewMatrix(*camera_test);
|
||||
|
||||
gui::GuiTexture loading_image = { render_engine::loader::LoadTexture("res/loading_screen.png"),
|
||||
glm::vec2(0,0),glm::vec2(1,1) };
|
||||
|
||||
std::vector<gui::GuiTexture*> image_list;
|
||||
image_list.push_back(&loading_image);
|
||||
|
||||
render_engine::renderer::Render(image_list, *gui_shader);*/
|
||||
shader_test->Stop();
|
||||
render_engine::renderer::Render(image_list, *gui_shader);
|
||||
//shader_test->Stop();
|
||||
|
||||
gui_shader->CleanUp();
|
||||
}
|
||||
|
||||
void Loading_Scene::update(GLFWwindow* window)
|
||||
|
||||
Reference in New Issue
Block a user