mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Model animation interpolation.
git-svn-id: https://svn.eduke32.com/eduke32@775 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c29194cce9
commit
2eab017106
6 changed files with 102 additions and 11 deletions
|
@ -140,6 +140,7 @@ extern void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range);
|
||||||
extern void (APIENTRY * bglEnableClientState)(GLenum cap);
|
extern void (APIENTRY * bglEnableClientState)(GLenum cap);
|
||||||
extern void (APIENTRY * bglDisableClientState)(GLenum cap);
|
extern void (APIENTRY * bglDisableClientState)(GLenum cap);
|
||||||
extern void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
extern void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
|
extern void (APIENTRY * bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
extern void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
extern void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
extern void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
extern void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
||||||
extern void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
extern void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||||
|
|
|
@ -38,6 +38,7 @@ extern int pr_billboardingmode;
|
||||||
extern int pr_verbosity;
|
extern int pr_verbosity;
|
||||||
extern int pr_wireframe;
|
extern int pr_wireframe;
|
||||||
extern int pr_vbos;
|
extern int pr_vbos;
|
||||||
|
extern int pr_gpusmoothing;
|
||||||
|
|
||||||
extern int glerror;
|
extern int glerror;
|
||||||
|
|
||||||
|
@ -125,13 +126,6 @@ void polymer_drawsprite(int snum);
|
||||||
|
|
||||||
# ifdef POLYMER_C
|
# ifdef POLYMER_C
|
||||||
|
|
||||||
extern int globalposx, globalposy, globalposz, globalhoriz;
|
|
||||||
extern short globalang, globalcursectnum;
|
|
||||||
extern int globalpal, cosglobalang, singlobalang;
|
|
||||||
extern int cosviewingrangeglobalang, sinviewingrangeglobalang;
|
|
||||||
extern float shadescale;
|
|
||||||
extern int globalnoeffect;
|
|
||||||
|
|
||||||
// CORE
|
// CORE
|
||||||
static void polymer_displayrooms(short sectnum);
|
static void polymer_displayrooms(short sectnum);
|
||||||
static void polymer_drawplane(short sectnum, short wallnum, _prplane* plane, int indicecount);
|
static void polymer_drawplane(short sectnum, short wallnum, _prplane* plane, int indicecount);
|
||||||
|
|
|
@ -38,6 +38,12 @@ pthtyp * gltexcache (int dapicnum, int dapalnum, int dameth);
|
||||||
|
|
||||||
extern palette_t hictinting[MAXPALOOKUPS];
|
extern palette_t hictinting[MAXPALOOKUPS];
|
||||||
extern float gtang;
|
extern float gtang;
|
||||||
|
extern int globalposx, globalposy, globalposz, globalhoriz;
|
||||||
|
extern short globalang, globalcursectnum;
|
||||||
|
extern int globalpal, cosglobalang, singlobalang;
|
||||||
|
extern int cosviewingrangeglobalang, sinviewingrangeglobalang;
|
||||||
|
extern float shadescale;
|
||||||
|
extern int globalnoeffect;
|
||||||
|
|
||||||
#define HICEFFECTMASK (1|2|4)
|
#define HICEFFECTMASK (1|2|4)
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range);
|
||||||
void (APIENTRY * bglEnableClientState)(GLenum cap);
|
void (APIENTRY * bglEnableClientState)(GLenum cap);
|
||||||
void (APIENTRY * bglDisableClientState)(GLenum cap);
|
void (APIENTRY * bglDisableClientState)(GLenum cap);
|
||||||
void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
|
void (APIENTRY * bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
||||||
void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||||
|
@ -353,6 +354,7 @@ int loadgldriver(const char *driver)
|
||||||
bglEnableClientState = GETPROC("glEnableClientState");
|
bglEnableClientState = GETPROC("glEnableClientState");
|
||||||
bglDisableClientState = GETPROC("glDisableClientState");
|
bglDisableClientState = GETPROC("glDisableClientState");
|
||||||
bglVertexPointer = GETPROC("glVertexPointer");
|
bglVertexPointer = GETPROC("glVertexPointer");
|
||||||
|
bglNormalPointer = GETPROC("glNormalPointer");
|
||||||
bglTexCoordPointer = GETPROC("glTexCoordPointer");
|
bglTexCoordPointer = GETPROC("glTexCoordPointer");
|
||||||
bglDrawArrays = GETPROC("glDrawArrays");
|
bglDrawArrays = GETPROC("glDrawArrays");
|
||||||
bglDrawElements = GETPROC("glDrawElements");
|
bglDrawElements = GETPROC("glDrawElements");
|
||||||
|
@ -530,6 +532,7 @@ int unloadgldriver(void)
|
||||||
bglEnableClientState = NULL;
|
bglEnableClientState = NULL;
|
||||||
bglDisableClientState = NULL;
|
bglDisableClientState = NULL;
|
||||||
bglVertexPointer = NULL;
|
bglVertexPointer = NULL;
|
||||||
|
bglNormalPointer = NULL;
|
||||||
bglTexCoordPointer = NULL;
|
bglTexCoordPointer = NULL;
|
||||||
bglDrawElements = NULL;
|
bglDrawElements = NULL;
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,15 @@ int pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2
|
||||||
int pr_wireframe = 0;
|
int pr_wireframe = 0;
|
||||||
int pr_vbos = 2;
|
int pr_vbos = 2;
|
||||||
int pr_mirrordepth = 1;
|
int pr_mirrordepth = 1;
|
||||||
|
int pr_gpusmoothing = 1;
|
||||||
|
|
||||||
int glerror;
|
int glerror;
|
||||||
|
|
||||||
GLenum mapvbousage = GL_STREAM_DRAW_ARB;
|
GLenum mapvbousage = GL_STREAM_DRAW_ARB;
|
||||||
GLenum modelvbousage = GL_STATIC_DRAW_ARB;
|
GLenum modelvbousage = GL_STATIC_DRAW_ARB;
|
||||||
|
|
||||||
|
GLuint modelvp;
|
||||||
|
|
||||||
// DATA
|
// DATA
|
||||||
_prsector *prsectors[MAXSECTORS];
|
_prsector *prsectors[MAXSECTORS];
|
||||||
_prwall *prwalls[MAXWALLS];
|
_prwall *prwalls[MAXWALLS];
|
||||||
|
@ -75,6 +78,32 @@ _pranimatespritesinfo asi;
|
||||||
int polymer_init(void)
|
int polymer_init(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
char modelvpstring[] =
|
||||||
|
"!!ARBvp1.0\n"
|
||||||
|
"ATTRIB in_pos = vertex.position;\n"
|
||||||
|
"ATTRIB in_pos2 = vertex.texcoord[1];\n"
|
||||||
|
"ATTRIB in_col = vertex.color;\n"
|
||||||
|
"ATTRIB in_tex = vertex.texcoord;\n"
|
||||||
|
"OUTPUT out_pos = result.position;\n"
|
||||||
|
"OUTPUT out_col = result.color;\n"
|
||||||
|
"OUTPUT out_tex = result.texcoord;\n"
|
||||||
|
"OUTPUT out_fog = result.fogcoord;\n"
|
||||||
|
"PARAM mvp[4] = { state.matrix.mvp };\n"
|
||||||
|
"PARAM bld[2] = { state.matrix.texture[0].row[0..1] };\n"
|
||||||
|
"TEMP a;\n"
|
||||||
|
"TEMP b;\n"
|
||||||
|
"MUL a, in_pos2, bld[0].x;\n"
|
||||||
|
"MUL b, in_pos, bld[1].y;\n"
|
||||||
|
"ADD a, a, b;\n"
|
||||||
|
"DP4 b.x, mvp[0], a;\n"
|
||||||
|
"DP4 b.y, mvp[1], a;\n"
|
||||||
|
"DP4 b.z, mvp[2], a;\n"
|
||||||
|
"DP4 b.w, mvp[3], a;\n"
|
||||||
|
"MOV out_pos, b;\n"
|
||||||
|
"MOV out_col, in_col;\n"
|
||||||
|
"MOV out_tex, in_tex;\n"
|
||||||
|
"MOV out_fog, b.z;\n"
|
||||||
|
"END\n";
|
||||||
|
|
||||||
if (pr_verbosity >= 1) OSD_Printf("Initalizing Polymer subsystem...\n");
|
if (pr_verbosity >= 1) OSD_Printf("Initalizing Polymer subsystem...\n");
|
||||||
|
|
||||||
|
@ -119,6 +148,13 @@ int polymer_init(void)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglGenProgramsARB(1, &modelvp);
|
||||||
|
bglBindProgramARB(GL_VERTEX_PROGRAM_ARB, modelvp);
|
||||||
|
bglProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(modelvpstring), modelvpstring);
|
||||||
|
}
|
||||||
|
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete.\n");
|
if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete.\n");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -2160,7 +2196,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
float scale;
|
float scale;
|
||||||
GLfloat color[4];
|
GLfloat color[4];
|
||||||
int surfi;
|
int surfi;
|
||||||
md3xyzn_t *v0;
|
md3xyzn_t *v0, *v1;
|
||||||
md3surf_t *s;
|
md3surf_t *s;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
@ -2240,10 +2276,21 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
|
|
||||||
bglColor4f(color[0], color[1], color[2], color[3]);
|
bglColor4f(color[0], color[1], color[2], color[3]);
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglEnable(GL_VERTEX_PROGRAM_ARB);
|
||||||
|
|
||||||
|
bglMatrixMode(GL_TEXTURE);
|
||||||
|
bglLoadIdentity();
|
||||||
|
bglScalef(m->interpol, 1 - m->interpol, 1.0);
|
||||||
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
}
|
||||||
|
|
||||||
for (surfi=0;surfi<m->head.numsurfs;surfi++)
|
for (surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||||
{
|
{
|
||||||
s = &m->head.surfs[surfi];
|
s = &m->head.surfs[surfi];
|
||||||
v0 = &s->xyzn[m->cframe*s->numverts];
|
v0 = &s->xyzn[m->cframe*s->numverts];
|
||||||
|
v1 = &s->xyzn[m->nframe*s->numverts];
|
||||||
|
|
||||||
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,tspr->pal,surfi);
|
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,tspr->pal,surfi);
|
||||||
if (!i)
|
if (!i)
|
||||||
|
@ -2253,26 +2300,65 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
||||||
|
|
||||||
if (pr_vbos > 1)
|
if (pr_vbos > 1)
|
||||||
{
|
{
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->geometry[surfi]);
|
|
||||||
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), (GLfloat*)(m->cframe * s->numverts * sizeof(md3xyzn_t)));
|
|
||||||
|
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->texcoords[surfi]);
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->texcoords[surfi]);
|
||||||
bglTexCoordPointer(2, GL_FLOAT, 0, 0);
|
bglTexCoordPointer(2, GL_FLOAT, 0, 0);
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
|
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->geometry[surfi]);
|
||||||
|
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), (GLfloat*)(m->cframe * s->numverts * sizeof(md3xyzn_t)));
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
bglTexCoordPointer(3, GL_SHORT, sizeof(md3xyzn_t), (GLfloat*)(m->nframe * s->numverts * sizeof(md3xyzn_t)));
|
||||||
|
|
||||||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]);
|
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m->indices[surfi]);
|
||||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
|
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
|
||||||
|
|
||||||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
bglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0);
|
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0);
|
||||||
bglTexCoordPointer(2, GL_FLOAT, 0, s->uv);
|
bglTexCoordPointer(2, GL_FLOAT, 0, s->uv);
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
|
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
bglTexCoordPointer(3, GL_SHORT, sizeof(md3xyzn_t), v1);
|
||||||
|
}
|
||||||
|
|
||||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
bglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bglPopMatrix();
|
bglPopMatrix();
|
||||||
|
|
||||||
|
if (pr_gpusmoothing)
|
||||||
|
{
|
||||||
|
bglDisable(GL_VERTEX_PROGRAM_ARB);
|
||||||
|
|
||||||
|
bglMatrixMode(GL_TEXTURE);
|
||||||
|
bglLoadIdentity();
|
||||||
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
|
}
|
||||||
|
|
||||||
globalnoeffect=0;
|
globalnoeffect=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,6 +702,7 @@ cvar[] =
|
||||||
{ "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 },
|
{ "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 },
|
||||||
{ "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT, 0, 0, 1 },
|
{ "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT, 0, 0, 1 },
|
||||||
{ "pr_vbos", "pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void*)&pr_vbos, CVAR_INT, 0, 0, 2 },
|
{ "pr_vbos", "pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void*)&pr_vbos, CVAR_INT, 0, 0, 2 },
|
||||||
|
{ "pr_gpusmoothing", "pr_gpusmoothing: toggles model animation interpolation", (void*)&pr_gpusmoothing, CVAR_INT, 0, 0, 1 },
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 },
|
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 },
|
||||||
|
|
Loading…
Reference in a new issue