BambooIsland: C:/Users/easterbunny/Desktop/Echtzeitgraphik-LU/trunk/src/Modelsmanager.h Source File

BambooIsland Abgabe 2

- Main Page
- Related Pages
- Classes
- Files

- File List

# C:/Users/easterbunny/Desktop/Echtzeitgraphik-LU/trunk/src/Modelsmanager.h

    00001 #pragma once
    00002
    00003 #ifndef __modelmanager_header
    00004 #define __modelmanager_header
    00005
    00006 #include <glm/gtc/matrix_projection.hpp>
    00007 #include <glm/gtc/matrix_transform.hpp>
    00008 #include <glm/gtx/transform.hpp>
    00009 #include <glm/gtx/transform2.hpp>
    00010 #include <glm/gtc/type_ptr.hpp>
    00011 #include <glm/glm.hpp>
    00012 #include <string>
    00013 #include <vector>
    00014 #include <map>
    00015 #include "tinyxml.h"
    00016
    00017 using namespace std;
    00018
    00019 class Modelsmanager;
    00020 class Model;
    00021 class Submesh;
    00022
    00023 class Modelsmanager
    00024 {
    00025 private:
    00026         map<string, Model*> models;
    00027 public:
    00028         Modelsmanager(void);
    00029         virtual ~Modelsmanager(void);
    00030         bool loadModel(const string identifier, const string meshpath, const string texpath="");
    00031         void deleteModel(const string identifier);
    00032         Model* getModel(const string identifier);
    00033 };
    00034
    00035 class Model
    00036 {
    00037         friend class Modelsmanager;
    00038 public:
    00039         Model(void);
    00040         virtual ~Model(void);
    00041
    00042         glm::vec3& ModelCenter() { return modelCenter; }
    00043
    00044         Model* clone();
    00045         vector<Submesh*> Submeshes() { return submeshes; }
    00046
    00047 private:
    00048         glm::vec3 modelCenter;
    00049         vector<Submesh*> submeshes;
    00050 };
    00051
    00052 class Submesh
    00053 {
    00054         friend class Modelsmanager;
    00055         friend class Model;
    00056
    00057 private:
    00058         int nVertexCount;
    00059         GLfloat *m_pVertices;
    00060         GLfloat *m_pNormals;
    00061         GLfloat *m_pTexcoords;
    00062         GLfloat *m_pTangents;
    00063
    00064         int nFaceCount;
    00065         GLuint *m_pFaceIndizes;
    00066
    00067 public:
    00068         Submesh(void);
    00069         virtual ~Submesh(void);
    00070
    00071         Submesh* clone();
    00072
    00073         // TODO: const correctness
    00074         GLfloat* Vertices();
    00075         int VertexCount() { return nVertexCount; }
    00077         int VertexArrayLength() {return 3*nVertexCount; }
    00078         GLfloat* Normals();
    00079         int VertexNormalsCount() { return nVertexCount; }
    00081         int VertexNormalsArrayLength() {return 3*nVertexCount; }
    00082         GLuint* FaceIndizes();
    00083         int FaceIndizesCount() { return nFaceCount; }
    00084         int FaceIndizesArrayLength() { return 3*nFaceCount; }
    00085         GLfloat* TexCoords();
    00086         GLfloat* Tangents();
    00087         int TexCoordsCount() { return nVertexCount; }
    00088         int TexCoordsArrayLength() { return 2*nVertexCount; }
    00089         void translateModelsCenterToCoordinateOrigin();
    00090 };
    00091
    00092 #endif

All Classes Functions Variables Enumerations Enumerator