Entity.cpp 415 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "Entity.h"
  2. #include <GL/freeglut.h>
  3. #include "Model.h"
  4. Entity::Entity()
  5. {
  6. model = NULL;
  7. }
  8. Entity::~Entity()
  9. {
  10. }
  11. void Entity::draw()
  12. {
  13. if (model)
  14. {
  15. glPushMatrix();
  16. glTranslatef(position.x, position.y, position.z);
  17. glRotatef(rotation.x, 1, 0, 0);
  18. glRotatef(rotation.y, 0, 1, 0);
  19. glRotatef(rotation.z, 0, 0, 1);
  20. glScalef(scale, scale, scale);
  21. model->draw();
  22. glPopMatrix();
  23. }
  24. }