Updated structs Mesh and Shader
This commit is contained in:
parent
6acfda599e
commit
4d78d27bd9
1 changed files with 23 additions and 26 deletions
49
src/rlgl.h
49
src/rlgl.h
|
@ -137,37 +137,41 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
|
||||||
Vector3 max;
|
Vector3 max;
|
||||||
} BoundingBox;
|
} BoundingBox;
|
||||||
|
|
||||||
// Mesh with vertex data type
|
// Vertex data definning a mesh
|
||||||
// NOTE: If using OpenGL 1.1, data loaded in CPU; if OpenGL 3.3+ data loaded in GPU (vaoId)
|
|
||||||
typedef struct Mesh {
|
typedef struct Mesh {
|
||||||
int vertexCount; // num vertices
|
int vertexCount; // number of vertices stored in arrays
|
||||||
float *vertices; // vertex position (XYZ - 3 components per vertex)
|
float *vertices; // vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
||||||
float *texcoords; // vertex texture coordinates (UV - 2 components per vertex)
|
float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
||||||
float *texcoords2; // vertex second texture coordinates (useful for lightmaps)
|
float *texcoords2; // vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
|
||||||
float *normals; // vertex normals (XYZ - 3 components per vertex)
|
float *normals; // vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
||||||
float *tangents; // vertex tangents (XYZ - 3 components per vertex)
|
float *tangents; // vertex tangents (XYZ - 3 components per vertex) (shader-location = 4)
|
||||||
unsigned char *colors; // vertex colors (RGBA - 4 components per vertex)
|
unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
||||||
|
unsigned short *indices; // vertex indices (in case vertex data comes indexed)
|
||||||
|
int triangleCount; // number of triangles to draw
|
||||||
|
|
||||||
BoundingBox bounds; // mesh limits defined by min and max points
|
BoundingBox bounds; // mesh limits defined by min and max points
|
||||||
|
|
||||||
unsigned int vaoId; // OpenGL Vertex Array Object id
|
unsigned int vaoId; // OpenGL Vertex Array Object id
|
||||||
unsigned int vboId[6]; // OpenGL Vertex Buffer Objects id (6 types of vertex data)
|
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
|
||||||
} Mesh;
|
} Mesh;
|
||||||
|
|
||||||
// Shader type
|
// Shader type (generic shader)
|
||||||
typedef struct Shader {
|
typedef struct Shader {
|
||||||
unsigned int id; // Shader program id
|
unsigned int id; // Shader program id
|
||||||
|
|
||||||
|
// Vertex attributes locations (default locations)
|
||||||
|
int vertexLoc; // Vertex attribute location point (default-location = 0)
|
||||||
|
int texcoordLoc; // Texcoord attribute location point (default-location = 1)
|
||||||
|
int normalLoc; // Normal attribute location point (default-location = 2)
|
||||||
|
int colorLoc; // Color attibute location point (default-location = 3)
|
||||||
|
int tangentLoc; // Tangent attribute location point (default-location = 4)
|
||||||
|
int texcoord2Loc; // Texcoord2 attribute location point (default-location = 5)
|
||||||
|
|
||||||
// Variable attributes
|
// Uniform locations
|
||||||
int vertexLoc; // Vertex attribute location point (vertex shader)
|
|
||||||
int texcoordLoc; // Texcoord attribute location point (vertex shader)
|
|
||||||
int normalLoc; // Normal attribute location point (vertex shader)
|
|
||||||
int colorLoc; // Color attibute location point (vertex shader)
|
|
||||||
|
|
||||||
// Uniforms
|
|
||||||
int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
|
int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
|
||||||
int tintColorLoc; // Color uniform location point (fragment shader)
|
int tintColorLoc; // Color uniform location point (fragment shader)
|
||||||
|
|
||||||
|
// Texture map locations
|
||||||
int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)
|
int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)
|
||||||
int mapNormalLoc; // Normal map texture uniform location point (fragment shader)
|
int mapNormalLoc; // Normal map texture uniform location point (fragment shader)
|
||||||
int mapSpecularLoc; // Specular map texture uniform location point (fragment shader)
|
int mapSpecularLoc; // Specular map texture uniform location point (fragment shader)
|
||||||
|
@ -205,13 +209,6 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
|
||||||
float glossiness;
|
float glossiness;
|
||||||
float normalDepth;
|
float normalDepth;
|
||||||
} Material;
|
} Material;
|
||||||
|
|
||||||
// 3d Model type
|
|
||||||
typedef struct Model {
|
|
||||||
Mesh mesh;
|
|
||||||
Matrix transform;
|
|
||||||
Material material;
|
|
||||||
} Model;
|
|
||||||
|
|
||||||
// Color blending modes (pre-defined)
|
// Color blending modes (pre-defined)
|
||||||
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
|
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue