123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /*!
- * \file src/RoomData.cpp
- * \brief World Room Mesh
- *
- * \author xythobuz
- */
-
- #include <glm/gtc/matrix_transform.hpp>
-
- #include "global.h"
- #include "SkeletalModel.h"
- #include "World.h"
- #include "RoomData.h"
-
- void StaticModel::display(glm::mat4 view, glm::mat4 projection) {
- if (cache < 0) {
- for (int i = 0; i < getWorld().sizeStaticMesh(); i++) {
- if (getWorld().getStaticMesh(i).getID() == id) {
- cache = i;
- }
- }
- assert(cache >= 0);
- }
-
- glm::mat4 model = glm::rotate(glm::translate(glm::mat4(1.0f), pos),
- angle, glm::vec3(0.0f, 1.0f, 0.0f));
- getWorld().getStaticMesh(cache).display(model, view, projection);
- }
-
- // ----------------------------------------------------------------------------
-
- void Light::getPos(float p[4]) {
- p[0] = pos[0];
- p[1] = pos[1];
- p[2] = pos[2];
- p[3] = pos[3];
- }
-
- void Light::getDir(float d[3]) {
- d[0] = dir[0];
- d[1] = dir[1];
- d[2] = dir[2];
- }
-
- float Light::getAtt() {
- return att;
- }
-
- void Light::getColor(float c[4]) {
- c[0] = color[0];
- c[1] = color[1];
- c[2] = color[2];
- c[3] = color[3];
- }
-
- float Light::getCutoff() {
- return cutoff;
- }
-
- Light::LightType Light::getType() {
- return type;
- }
-
- // ----------------------------------------------------------------------------
-
- Portal::Portal(glm::vec3 vert[4], float norm[3], int adj) {
- for (unsigned int i = 0; i < 4; i++) {
- for (unsigned int j = 0; j < 3; j++) {
- vertices[i][j] = vert[i][j];
- }
-
- if (i < 3) {
- normal[i] = norm[i];
- }
- }
-
- adjoiningRoom = adj;
- }
-
- void Portal::getVertices(float vert[4][3]) {
- for (unsigned int i = 0; i < 4; i++) {
- for (unsigned int j = 0; j < 3; j++) {
- vert[i][j] = vertices[i][j];
- }
- }
- }
-
- int Portal::getAdjoiningRoom() {
- return adjoiningRoom;
- }
-
- // ----------------------------------------------------------------------------
-
- float Sector::getFloor() {
- return floor;
- }
-
- float Sector::getCeiling() {
- return ceiling;
- }
-
- bool Sector::isWall() {
- return wall;
- }
|