Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RoomData.cpp 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*!
  2. * \file src/RoomData.cpp
  3. * \brief World Room Mesh
  4. *
  5. * \author xythobuz
  6. */
  7. #include <glm/gtc/matrix_transform.hpp>
  8. #include "global.h"
  9. #include "SkeletalModel.h"
  10. #include "World.h"
  11. #include "RoomData.h"
  12. void StaticModel::display(glm::mat4 view, glm::mat4 projection) {
  13. if (cache < 0) {
  14. for (int i = 0; i < getWorld().sizeStaticMesh(); i++) {
  15. if (getWorld().getStaticMesh(i).getID() == id) {
  16. cache = i;
  17. }
  18. }
  19. assert(cache >= 0);
  20. }
  21. glm::mat4 model = glm::rotate(glm::translate(glm::mat4(1.0f), pos),
  22. angle, glm::vec3(0.0f, 1.0f, 0.0f));
  23. getWorld().getStaticMesh(cache).display(model, view, projection);
  24. }
  25. // ----------------------------------------------------------------------------
  26. void Light::getPos(float p[4]) {
  27. p[0] = pos[0];
  28. p[1] = pos[1];
  29. p[2] = pos[2];
  30. p[3] = pos[3];
  31. }
  32. void Light::getDir(float d[3]) {
  33. d[0] = dir[0];
  34. d[1] = dir[1];
  35. d[2] = dir[2];
  36. }
  37. float Light::getAtt() {
  38. return att;
  39. }
  40. void Light::getColor(float c[4]) {
  41. c[0] = color[0];
  42. c[1] = color[1];
  43. c[2] = color[2];
  44. c[3] = color[3];
  45. }
  46. float Light::getCutoff() {
  47. return cutoff;
  48. }
  49. Light::LightType Light::getType() {
  50. return type;
  51. }
  52. // ----------------------------------------------------------------------------
  53. float Sector::getFloor() {
  54. return floor;
  55. }
  56. float Sector::getCeiling() {
  57. return ceiling;
  58. }
  59. bool Sector::isWall() {
  60. return wall;
  61. }