mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 15:12:19 +00:00
autosprite and other deforms now work in webgl, supposedly.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4975 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5e11342ee2
commit
636def2dff
2 changed files with 32 additions and 6 deletions
|
@ -1300,6 +1300,9 @@ static float r_squaretable[FTABLE_SIZE];
|
||||||
static float r_sawtoothtable[FTABLE_SIZE];
|
static float r_sawtoothtable[FTABLE_SIZE];
|
||||||
static float r_inversesawtoothtable[FTABLE_SIZE];
|
static float r_inversesawtoothtable[FTABLE_SIZE];
|
||||||
|
|
||||||
|
//#define R_FastSin(x) sin((x)*(2*M_PI))
|
||||||
|
#define R_FastSin(x) r_sintable[FTABLE_CLAMP(x)]
|
||||||
|
|
||||||
static float *FTableForFunc ( unsigned int func )
|
static float *FTableForFunc ( unsigned int func )
|
||||||
{
|
{
|
||||||
switch (func)
|
switch (func)
|
||||||
|
@ -1521,11 +1524,11 @@ void GLBE_Init(void)
|
||||||
|
|
||||||
//end tables
|
//end tables
|
||||||
|
|
||||||
#ifndef GLSLONLY
|
|
||||||
#define MAX_ARRAY_VERTS 65535
|
#define MAX_ARRAY_VERTS 65535
|
||||||
|
static vecV_t vertexarray[MAX_ARRAY_VERTS];
|
||||||
|
#ifndef GLSLONLY
|
||||||
static avec4_t coloursarray[MAX_ARRAY_VERTS];
|
static avec4_t coloursarray[MAX_ARRAY_VERTS];
|
||||||
static float texcoordarray[SHADER_PASS_MAX][MAX_ARRAY_VERTS*2];
|
static float texcoordarray[SHADER_PASS_MAX][MAX_ARRAY_VERTS*2];
|
||||||
static vecV_t vertexarray[MAX_ARRAY_VERTS];
|
|
||||||
|
|
||||||
/*========================================== texture coord generation =====================================*/
|
/*========================================== texture coord generation =====================================*/
|
||||||
|
|
||||||
|
@ -1651,7 +1654,6 @@ static void tcmod(const tcmod_t *tcmod, int cnt, const float *src, float *dst, c
|
||||||
float t1, t2;
|
float t1, t2;
|
||||||
float cost, sint;
|
float cost, sint;
|
||||||
int j;
|
int j;
|
||||||
#define R_FastSin(x) sin((x)*(2*M_PI))
|
|
||||||
switch (tcmod->type)
|
switch (tcmod->type)
|
||||||
{
|
{
|
||||||
case SHADER_TCMOD_ROTATE:
|
case SHADER_TCMOD_ROTATE:
|
||||||
|
@ -2011,6 +2013,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, vec4_t *src, vec4_t *ds
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void deformgen(const deformv_t *deformv, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh)
|
static void deformgen(const deformv_t *deformv, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh)
|
||||||
{
|
{
|
||||||
|
@ -2299,6 +2302,8 @@ static void GenerateVertexDeforms(const shader_t *shader)
|
||||||
shaderstate.pendingvertexvbo = 0;
|
shaderstate.pendingvertexvbo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GLSLONLY
|
||||||
|
|
||||||
/*======================================alpha ===============================*/
|
/*======================================alpha ===============================*/
|
||||||
|
|
||||||
static void alphagen(const shaderpass_t *pass, int cnt, avec4_t *const src, avec4_t *dst, const mesh_t *mesh)
|
static void alphagen(const shaderpass_t *pass, int cnt, avec4_t *const src, avec4_t *dst, const mesh_t *mesh)
|
||||||
|
@ -3944,13 +3949,11 @@ static void DrawMeshes(void)
|
||||||
flags = shaderstate.curshader->flags;
|
flags = shaderstate.curshader->flags;
|
||||||
GL_CullFace(flags & (SHADER_CULL_FRONT|SHADER_CULL_BACK));
|
GL_CullFace(flags & (SHADER_CULL_FRONT|SHADER_CULL_BACK));
|
||||||
|
|
||||||
#ifndef GLSLONLY
|
|
||||||
if (shaderstate.sourcevbo->coord2.gl.addr && (shaderstate.curshader->numdeforms || !shaderstate.curshader->prog))
|
if (shaderstate.sourcevbo->coord2.gl.addr && (shaderstate.curshader->numdeforms || !shaderstate.curshader->prog))
|
||||||
GenerateVertexBlends(shaderstate.curshader);
|
GenerateVertexBlends(shaderstate.curshader);
|
||||||
else if (shaderstate.curshader->numdeforms)
|
else if (shaderstate.curshader->numdeforms)
|
||||||
GenerateVertexDeforms(shaderstate.curshader);
|
GenerateVertexDeforms(shaderstate.curshader);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
shaderstate.pendingvertexpointer = shaderstate.sourcevbo->coord.gl.addr;
|
shaderstate.pendingvertexpointer = shaderstate.sourcevbo->coord.gl.addr;
|
||||||
shaderstate.pendingvertexvbo = shaderstate.sourcevbo->coord.gl.vbo;
|
shaderstate.pendingvertexvbo = shaderstate.sourcevbo->coord.gl.vbo;
|
||||||
|
@ -3966,7 +3969,22 @@ static void DrawMeshes(void)
|
||||||
|
|
||||||
#ifdef FTE_TARGET_WEB
|
#ifdef FTE_TARGET_WEB
|
||||||
if (!shaderstate.pendingvertexvbo)
|
if (!shaderstate.pendingvertexvbo)
|
||||||
return;
|
{
|
||||||
|
int len = 0, m;
|
||||||
|
mesh_t *meshlist;
|
||||||
|
for (m = 0; m < shaderstate.meshcount; m++)
|
||||||
|
{
|
||||||
|
meshlist = shaderstate.meshes[m];
|
||||||
|
if (len < meshlist->vbofirstvert + meshlist->numvertexes)
|
||||||
|
len = meshlist->vbofirstvert + meshlist->numvertexes;
|
||||||
|
}
|
||||||
|
len *= sizeof(vecV_t);
|
||||||
|
|
||||||
|
shaderstate.streamid = (shaderstate.streamid + 1) & (sizeof(shaderstate.streamvbo)/sizeof(shaderstate.streamvbo[0]) - 1);
|
||||||
|
GL_SelectVBO(shaderstate.pendingvertexvbo = shaderstate.streamvbo[shaderstate.streamid]);
|
||||||
|
qglBufferDataARB(GL_ARRAY_BUFFER_ARB, len, shaderstate.pendingvertexpointer, GL_STREAM_DRAW_ARB);
|
||||||
|
shaderstate.pendingvertexpointer = NULL;
|
||||||
|
}
|
||||||
if (!shaderstate.sourcevbo->indicies.gl.vbo)
|
if (!shaderstate.sourcevbo->indicies.gl.vbo)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -634,10 +634,12 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
|
||||||
if (chunk < nl)
|
if (chunk < nl)
|
||||||
con->chunking = true;
|
con->chunking = true;
|
||||||
}
|
}
|
||||||
|
#ifdef COOKIECOOKIECOOKIE
|
||||||
else if (!strnicmp(msg, "Set-Cookie: ", 12))
|
else if (!strnicmp(msg, "Set-Cookie: ", 12))
|
||||||
{
|
{
|
||||||
Cookie_Parse(con->server, con->secure, msg+12, nl);
|
Cookie_Parse(con->server, con->secure, msg+12, nl);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
msg = nl;
|
msg = nl;
|
||||||
}
|
}
|
||||||
if (!hcomplete)
|
if (!hcomplete)
|
||||||
|
@ -907,7 +909,11 @@ void HTTPDL_Establish(struct dl_download *dl)
|
||||||
struct http_dl_ctx_s *con;
|
struct http_dl_ctx_s *con;
|
||||||
qboolean https = false;
|
qboolean https = false;
|
||||||
|
|
||||||
|
#ifdef COOKIECOOKIECOOKIE
|
||||||
char cookies[8192];
|
char cookies[8192];
|
||||||
|
#else
|
||||||
|
char *cookies = "";
|
||||||
|
#endif
|
||||||
char uri[MAX_OSPATH];
|
char uri[MAX_OSPATH];
|
||||||
char *slash;
|
char *slash;
|
||||||
const char *url = dl->redir;
|
const char *url = dl->redir;
|
||||||
|
@ -1013,7 +1019,9 @@ void HTTPDL_Establish(struct dl_download *dl)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef COOKIECOOKIECOOKIE
|
||||||
Cookie_Regurgitate(con->server, con->secure, cookies, sizeof(cookies));
|
Cookie_Regurgitate(con->server, con->secure, cookies, sizeof(cookies));
|
||||||
|
#endif
|
||||||
if (dl->postdata)
|
if (dl->postdata)
|
||||||
{
|
{
|
||||||
ExpandBuffer(con, 1024 + strlen(uri) + strlen(con->server) + strlen(cookies) + strlen(dl->postmimetype) + dl->postlen);
|
ExpandBuffer(con, 1024 + strlen(uri) + strlen(con->server) + strlen(cookies) + strlen(dl->postmimetype) + dl->postlen);
|
||||||
|
|
Loading…
Reference in a new issue