Go to the documentation of this file.00001
00002
00003
00004
00005 #pragma once
00006
00007 #define NOMINMAX
00008 #include "windows.h"
00009 #include "glew.h"
00010 #include <vector>
00011 #include "constants.h"
00012 #include "GGraphicsObject.h"
00013 #include "types.h"
00014 #include "GMatrix16.h"
00015 #include "NxVec3.h"
00016 #include "GModel.h"
00017 #include <algorithm>
00018
00019 using namespace std;
00020
00021 class GMesh: public GGraphicsObject
00022 {
00023 public:
00024
00025 int materialId;
00026 int colorTexId;
00027 int normalTexId;
00028 GModel *model;
00029 vector<vertexmapper_t> vertexmapper;
00030 GVec4f WorldCoordinates;
00031 vector<GVec4f> vertices;
00032 vector<GVec4f> normals;
00033 vector<GVec4f> tangents;
00034 vector<GVec4f> binormals;
00035 vector<texcoord2_t> texcoords;
00036 GMatrix16 Transformations;
00037 unsigned int *IndexArray;
00038 float *VertexArray;
00039 float *NormalArray;
00040 float *TexCoordArray;
00041 float *TangentArray;
00042 float *BinormalArray;
00043
00044 unsigned int vboId[10];
00045
00046 int iFaces;
00047 int iVerts;
00048 int iNumVertices;
00049 int iVBufferSize;
00050 vector<face_t> faces;
00051 vector<material_t> materials;
00052
00053 int ComputeTangentsAndBinormals();
00054 virtual int Draw(double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS);
00055 virtual int DrawSprites(double time, double dtime, GMatrix16 *viewmatrix, GMatrix16 *worldmatrix, int FLAGS);
00056 virtual int OutLineMappedVertices(int FLAGS);
00057 virtual int Skin(int FLAGS);
00058 virtual int CreateDefaultVertexMapper(int FLAGS);
00059 virtual int SetVertexMapper(vector<vertexmapper_t> vm);
00060 virtual int SetupVBO();
00061 GMesh(void);
00062 GMesh(GModel *_model);
00063 void SetModel(GModel *_model);
00064 GModel *GetModel(void);
00065 GSkeleton *GetSkeleton(void);
00066 int GetVertexBufferSize(void);
00067 int GetVertexCount(void);
00068 unsigned int *GetIndexArray(void);
00069 float *GetTangentArray(void);
00070 float *GetBinormalArray(void);
00071 float *GetNormalArray(void);
00072 float *GetVertexArray(void);
00073 float *GetTexCoordArray(void);
00074 int BeginWithZero(int FLAGS);
00075 GVec4f *GetVertex(int i);
00076 GVec4f *GetNormal(int i);
00077 void Scale(float scale);
00078 void Rotate(GVec4f *Rotations);
00079 };