[comment] commented some temporary code in the main and commented a new method that gets the size of a model.

This commit is contained in:
Lars
2021-05-21 15:21:27 +02:00
parent e10aea5a15
commit e2464ec8fd
3 changed files with 13 additions and 0 deletions

View File

@@ -52,6 +52,9 @@ int main(void)
texture.reflectivity = 0; texture.reflectivity = 0;
models::TexturedModel model = { raw_model, texture }; models::TexturedModel model = { raw_model, texture };
/**
* load and add some models (in this case some level sections) to the entities list.
* */
std::vector<entities::Entity> entities; std::vector<entities::Entity> entities;
int z = 0; int z = 0;
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i)
@@ -82,6 +85,9 @@ int main(void)
shader.LoadLight(light); shader.LoadLight(light);
shader.LoadViewMatrix(camera); shader.LoadViewMatrix(camera);
/**
* renders eacht entitie in the entities list
**/
for (entities::Entity& entity : entities) for (entities::Entity& entity : entities)
{ {
render_engine::renderer::Render(entity, shader); render_engine::renderer::Render(entity, shader);

View File

@@ -10,6 +10,8 @@ namespace models
This structure represents a Bare bones Model (A mesh without a texture). This structure represents a Bare bones Model (A mesh without a texture).
The vao_id, points to an ID stored by openGL and the The vao_id, points to an ID stored by openGL and the
vertex_count is how many triangles in the mesh there are. vertex_count is how many triangles in the mesh there are.
model_size is a vec3 that contains the size of the loaded model.
*/ */
struct RawModel struct RawModel
{ {

View File

@@ -128,6 +128,11 @@ namespace render_engine
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int) * indices.size(), &indices[0], GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(int) * indices.size(), &indices[0], GL_STATIC_DRAW);
} }
/**
* @brief gets the width, height and depth of a model
* @param positions all the points of a model
* @returns vec3<float> the size values of a model (width, height and depth)
**/
static glm::vec3 GetSizeModel(std::vector<float>& positions) static glm::vec3 GetSizeModel(std::vector<float>& positions)
{ {
float minX = 100; float minX = 100;