OpenGL2: Store normals/tangents as int16_t[4].
This commit is contained in:
parent
762f50757d
commit
dfbaf50324
13 changed files with 288 additions and 1042 deletions
|
@ -895,11 +895,11 @@ typedef struct
|
|||
vec3_t xyz;
|
||||
vec2_t st;
|
||||
vec2_t lightmap;
|
||||
vec3_t normal;
|
||||
int16_t normal[4];
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
vec4_t tangent;
|
||||
int16_t tangent[4];
|
||||
#endif
|
||||
vec3_t lightdir;
|
||||
int16_t lightdir[4];
|
||||
vec4_t vertexColors;
|
||||
|
||||
#if DEBUG_OPTIMIZEVERTICES
|
||||
|
@ -908,9 +908,9 @@ typedef struct
|
|||
} srfVert_t;
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0}, {0, 0, 0, 0}}
|
||||
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
|
||||
#else
|
||||
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0, 0}}
|
||||
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
|
||||
#endif
|
||||
|
||||
// srfBspSurface_t covers SF_GRID, SF_TRIANGLES, SF_POLY, and SF_VAO_MESH
|
||||
|
@ -1201,10 +1201,9 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
vec3_t xyz;
|
||||
vec3_t normal;
|
||||
int16_t normal[4];
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
vec3_t tangent;
|
||||
vec3_t bitangent;
|
||||
int16_t tangent[4];
|
||||
#endif
|
||||
} mdvVertex_t;
|
||||
|
||||
|
@ -1411,7 +1410,6 @@ typedef struct {
|
|||
qboolean depthClamp;
|
||||
qboolean seamlessCubeMap;
|
||||
|
||||
GLenum packedNormalDataType;
|
||||
GLenum packedTexcoordDataType;
|
||||
GLenum packedColorDataType;
|
||||
int packedTexcoordDataSize;
|
||||
|
@ -1718,7 +1716,6 @@ extern cvar_t *r_arb_half_float_pixel;
|
|||
extern cvar_t *r_arb_half_float_vertex;
|
||||
extern cvar_t *r_ext_framebuffer_multisample;
|
||||
extern cvar_t *r_arb_seamless_cube_map;
|
||||
extern cvar_t *r_arb_vertex_type_2_10_10_10_rev;
|
||||
extern cvar_t *r_arb_vertex_array_object;
|
||||
extern cvar_t *r_ext_direct_state_access;
|
||||
|
||||
|
@ -1861,7 +1858,7 @@ void R_AddDrawSurf( surfaceType_t *surface, shader_t *shader,
|
|||
|
||||
void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2,
|
||||
const vec3_t v3, const vec2_t w1, const vec2_t w2, const vec2_t w3);
|
||||
void R_CalcTbnFromNormalAndTexDirs(vec3_t tangent, vec3_t bitangent, vec3_t normal, vec3_t sdir, vec3_t tdir);
|
||||
vec_t R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, const vec3_t normal, const vec3_t sdir, const vec3_t tdir);
|
||||
qboolean R_CalcTangentVectors(srfVert_t * dv[3]);
|
||||
|
||||
#define CULL_IN 0 // completely unclipped
|
||||
|
@ -2008,13 +2005,13 @@ typedef struct shaderCommands_s
|
|||
{
|
||||
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
|
||||
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
uint32_t normal[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
int16_t normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
uint32_t tangent[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
int16_t tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
#endif
|
||||
vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
|
||||
vec4_t vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
uint32_t lightdir[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
int16_t lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
//int vertexDlightBits[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
|
||||
void *attribPointers[ATTR_INDEX_COUNT];
|
||||
|
@ -2178,12 +2175,12 @@ VERTEX BUFFER OBJECTS
|
|||
============================================================
|
||||
*/
|
||||
|
||||
int R_VaoPackTangent(byte *out, vec4_t v);
|
||||
int R_VaoPackNormal(byte *out, vec3_t v);
|
||||
void R_VaoPackTangent(int16_t *out, vec4_t v);
|
||||
void R_VaoPackNormal(int16_t *out, vec3_t v);
|
||||
int R_VaoPackTexCoord(byte *out, vec2_t st);
|
||||
int R_VaoPackColors(byte *out, vec4_t color);
|
||||
void R_VaoUnpackTangent(vec4_t v, uint32_t b);
|
||||
void R_VaoUnpackNormal(vec3_t v, uint32_t b);
|
||||
void R_VaoUnpackTangent(vec4_t v, int16_t *pack);
|
||||
void R_VaoUnpackNormal(vec3_t v, int16_t *pack);
|
||||
|
||||
vao_t *R_CreateVao(const char *name, byte *vertexes, int vertexesSize, byte *indexes, int indexesSize, vaoUsage_t usage);
|
||||
vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int numIndexes, glIndex_t *inIndexes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue