⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modelcontext.h

📁 机器人运动学动力学及控制的一个小程序,供有兴趣的人参考
💻 H
字号:
#ifndef MODEL_CONTEXT_HEADER
#define MODEL_CONTEXT_HEADER

#define VERTEX_MAX 66000
#define LINE_MAX 29000
#define LINE_STRIP_MAX 18000
#define EDGE_MAX 15000
#define OBJ_VERTEX_MAX 85000
#define COLOR_MAX 100

#define SCALE_SPEED 0.003
#define MINIMUM_SCALE 0.5

#define PIXELS_PER_INCH 100.0
#define EYE_BACK 36.0

typedef struct Vertex Vertex;
struct Vertex{
       int draw;
       GLfloat x;
       GLfloat y;
       GLfloat z;
       GLfloat nx;
       GLfloat ny;
       GLfloat nz;

       int colorIndex;
       int vertexIndex;

       int facets[90];
       int facetsNum;

       int edges[60];
       int edgesNum;
};

typedef struct ColorStruct ColorStruct;
struct ColorStruct{
       int index;
       GLfloat ra,ga,ba;
       GLfloat rd,gd,bd,ad;
       GLfloat rs,gs,bs;
       GLfloat spec;
};
//材质定义
typedef struct MaterialColor MaterialColor;
struct MaterialColor{
       char name[100];
       GLfloat ra,ga,ba;           //Ambient
       GLfloat rd,gd,bd,ad;        //Diffuse
       GLfloat rs,gs,bs;           //Specular
       GLfloat spec;               //Specular power(shininess)
};

typedef struct ModelContext ModelContext;
struct ModelContext{
       int facetCount;                           //面的数量

       int triangleFlag;

       Vertex vertexList[VERTEX_MAX];           //模型中的顶点列表
       int vertexCount;

       Vertex lineList[LINE_MAX];               //模型中的顶点数组
       int lineCount;                           //顶点数量

       Vertex lineStripList[LINE_STRIP_MAX];
       int lineStripCount;

       int eadgeList[EDGE_MAX][2];
       int edgeCount;

       Vertex objVertexList[OBJ_VERTEX_MAX];    //OBJ文件中的顶点
       int ovCount;
       int onCount;

       ColorStruct colorList[COLOR_MAX];       //模型中的颜色列表
       int colorCount;

       GLfloat boundBoxLeft,boundBoxBottom,boundBoxNear;
       GLfloat boundBoxRight,boundBoxTop,boundBoxFar;

       GLdouble rotX,rotY;
       GLdouble scaleObj;
       GLdouble rotMat[16];
       GLdouble windowWidth,windowHeight;
       GLdouble minimumScale;

       int haveNormals;
       int needtoUpdateViewMat;
       int pointerMotion;
};

#endif/*MODEL_CONTEXT_HEADER*/






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -