Fixed useless copying of vectors during model.draw(), now references.
Fixed copy constructor of Vec3 (Copy-pasting is bad) Now exits on escape
This commit is contained in:
parent
8cdcc9750b
commit
18bad8389a
3 changed files with 8 additions and 3 deletions
|
@ -53,7 +53,7 @@ void Model3D::draw_model()
|
||||||
|
|
||||||
for (uint32_t i = 0;i<face_count;i++)
|
for (uint32_t i = 0;i<face_count;i++)
|
||||||
{
|
{
|
||||||
Vec3i face = faces[i];
|
Vec3i& face = faces[i];
|
||||||
|
|
||||||
Vec3i* face_texture;
|
Vec3i* face_texture;
|
||||||
if (is_textured)
|
if (is_textured)
|
||||||
|
@ -68,7 +68,7 @@ void Model3D::draw_model()
|
||||||
|
|
||||||
if (is_textured)
|
if (is_textured)
|
||||||
{
|
{
|
||||||
Vec2f vertex_texture = texture_coordinates[face_texture->coordinates[j]];
|
Vec2f& vertex_texture = texture_coordinates[face_texture->coordinates[j]];
|
||||||
glTexCoord2f(vertex_texture.x,vertex_texture.y);
|
glTexCoord2f(vertex_texture.x,vertex_texture.y);
|
||||||
}
|
}
|
||||||
glVertex3f(vertex.x,vertex.y,vertex.z);
|
glVertex3f(vertex.x,vertex.y,vertex.z);
|
||||||
|
|
|
@ -150,7 +150,7 @@ struct Vec3 : CoordinatesVector<T,3>
|
||||||
{
|
{
|
||||||
if (this != &original)
|
if (this != &original)
|
||||||
{
|
{
|
||||||
std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector<T,2>::coordinates));
|
std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector<T,3>::coordinates));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@ void manage_inputs()
|
||||||
{
|
{
|
||||||
glClearColor(0.5,0,0,1);
|
glClearColor(0.5,0,0,1);
|
||||||
}
|
}
|
||||||
|
else if (KeyStateManager::is_key_pressed(0x1B))
|
||||||
|
{
|
||||||
|
glutDestroyWindow(glutGetWindow());
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glClearColor(0,0,0,1);
|
glClearColor(0,0,0,1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue