One d3d renderer.
Wonder how much this breaks. Place your bets now. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2501 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b8b56f03cc
commit
1f9484f93d
68 changed files with 14908 additions and 4365 deletions
|
@ -1185,7 +1185,7 @@ char *MSG_ReadString (void)
|
|||
do
|
||||
{
|
||||
c = MSG_ReadChar ();
|
||||
if (c == -1 || c == 0)
|
||||
if (msg_badread || c == 0)
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
|
@ -1205,7 +1205,7 @@ char *MSG_ReadStringLine (void)
|
|||
do
|
||||
{
|
||||
c = MSG_ReadChar ();
|
||||
if (c == -1 || c == 0 || c == '\n')
|
||||
if (msg_badread || c == 0 || c == '\n')
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#include "glquake.h"
|
||||
#include "shader.h"
|
||||
#endif
|
||||
#ifdef D3DQUAKE
|
||||
#include "d3dquake.h"
|
||||
#endif
|
||||
|
||||
#define MAX_Q3MAP_INDICES 0x80000
|
||||
#define MAX_Q3MAP_VERTEXES 0x80000
|
||||
|
@ -1067,7 +1070,7 @@ void *Mod_LoadWall(char *name)
|
|||
if (in) //this is a pcx.
|
||||
{
|
||||
#ifdef RGLQUAKE
|
||||
if (qrenderer == QR_OPENGL)
|
||||
if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
|
||||
{
|
||||
tex = Hunk_AllocName(sizeof(texture_t), ln);
|
||||
|
||||
|
@ -1075,11 +1078,9 @@ void *Mod_LoadWall(char *name)
|
|||
tex->width = width;
|
||||
tex->height = height;
|
||||
|
||||
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
|
||||
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(name, loadname, true, false, true)))
|
||||
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(name, "bmodels", true, false, true)))
|
||||
tex->gl_texturenum = GL_LoadTexture32 (name, width, height, (unsigned int *)in, true, false);
|
||||
texture_mode = GL_LINEAR;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -1148,8 +1149,8 @@ void *Mod_LoadWall(char *name)
|
|||
return tex;
|
||||
}
|
||||
|
||||
#if defined(RGLQUAKE)
|
||||
if (qrenderer == QR_OPENGL)
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
|
||||
{
|
||||
int j;
|
||||
tex = Hunk_AllocName(sizeof(texture_t), ln);
|
||||
|
@ -1158,17 +1159,15 @@ void *Mod_LoadWall(char *name)
|
|||
tex->width = wal->width;
|
||||
tex->height = wal->height;
|
||||
|
||||
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
|
||||
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(wal->name, loadname, true, false, true)))
|
||||
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(wal->name, "bmodels", true, false, true)))
|
||||
tex->gl_texturenum = GL_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, true, false);
|
||||
tex->gl_texturenum = R_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, true, false);
|
||||
|
||||
in = Hunk_TempAllocMore(wal->width*wal->height);
|
||||
oin = (qbyte *)wal+wal->offsets[0];
|
||||
for (j = 0; j < wal->width*wal->height; j++)
|
||||
in[j] = (d_q28to24table[oin[j]*3+0] + d_q28to24table[oin[j]*3+1] + d_q28to24table[oin[j]*3+2])/3;
|
||||
tex->gl_texturenumbumpmap = GL_LoadTexture8Bump (va("%s_bump", wal->name), tex->width, tex->height, in, true, r_shadow_bumpscale_basetexture.value);
|
||||
texture_mode = GL_LINEAR;
|
||||
tex->gl_texturenumbumpmap = R_LoadTexture8Bump (va("%s_bump", wal->name), tex->width, tex->height, in, true, r_shadow_bumpscale_basetexture.value);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -1259,7 +1258,7 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
|
|||
loadmodel->texinfo = out;
|
||||
loadmodel->numtexinfo = count;
|
||||
|
||||
#if !defined(SERVERONLY) && defined(RGLQUAKE)
|
||||
#if !defined(SERVERONLY) && (defined(RGLQUAKE) || defined(D3DQUAKE))
|
||||
skytexturenum = -1;
|
||||
#endif
|
||||
|
||||
|
@ -1462,7 +1461,7 @@ qboolean CMod_LoadFaces (lump_t *l)
|
|||
if (i == -1)
|
||||
out->samples = NULL;
|
||||
#ifdef RGLQUAKE
|
||||
else if (qrenderer == QR_OPENGL)
|
||||
else if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
|
||||
out->samples = loadmodel->lightdata + i;
|
||||
#endif
|
||||
#ifdef SWQUAKE
|
||||
|
@ -2099,7 +2098,7 @@ qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
|
|||
numtexinfo = count;
|
||||
out = map_surfaces = Hunk_Alloc(count*sizeof(*out));
|
||||
|
||||
#if !defined(SERVERONLY) && defined(RGLQUAKE)
|
||||
#if !defined(SERVERONLY) && (defined(RGLQUAKE) || defined(D3DQUAKE))
|
||||
skytexturenum = -1;
|
||||
#endif
|
||||
|
||||
|
@ -2111,8 +2110,8 @@ qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
|
|||
{
|
||||
loadmodel->texinfo[i].texture = Hunk_Alloc(sizeof(texture_t));
|
||||
Q_strncpyz(loadmodel->texinfo[i].texture->name, in->shadername, sizeof(loadmodel->texinfo[i].texture->name));
|
||||
#ifdef RGLQUAKE
|
||||
if (qrenderer == QR_OPENGL && !useshaders)
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
if ((qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D) && !useshaders)
|
||||
{
|
||||
loadmodel->texinfo[i].texture->gl_texturenum = Mod_LoadHiResTexture(in->shadername, loadname, true, false, true);
|
||||
if (!loadmodel->texinfo[i].texture->gl_texturenum)
|
||||
|
@ -2252,7 +2251,8 @@ qboolean CModRBSP_LoadVertexes (lump_t *l)
|
|||
qboolean CModQ3_LoadIndexes (lump_t *l)
|
||||
{
|
||||
int i, count;
|
||||
int *in, *out;
|
||||
int *in;
|
||||
index_t *out;
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
|
@ -3475,7 +3475,7 @@ int CM_GetQ2Palette (void)
|
|||
BZ_Free(f);
|
||||
|
||||
|
||||
#ifdef RGLQUAKE
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
{
|
||||
extern float vid_gamma;
|
||||
float f, inf;
|
||||
|
@ -3855,7 +3855,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
|||
#ifdef Q3SHADERS
|
||||
{
|
||||
extern cvar_t gl_shadeq3;
|
||||
useshaders = gl_shadeq3.value;
|
||||
useshaders = qrenderer == QR_OPENGL && gl_shadeq3.value;
|
||||
}
|
||||
#else
|
||||
useshaders = false;
|
||||
|
@ -3901,6 +3901,9 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
|||
{
|
||||
#if defined(RGLQUAKE)
|
||||
case QR_OPENGL:
|
||||
#endif
|
||||
#if defined(D3DQUAKE)
|
||||
case QR_DIRECT3D:
|
||||
#endif
|
||||
case QR_NONE: //dedicated only
|
||||
mapisq3 = true;
|
||||
|
@ -3922,8 +3925,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
|||
noerrors = noerrors && CModRBSP_LoadFaces (&header.lumps[Q3LUMP_SURFACES]);
|
||||
else
|
||||
noerrors = noerrors && CModQ3_LoadFaces (&header.lumps[Q3LUMP_SURFACES]);
|
||||
#if defined(RGLQUAKE)
|
||||
if (qrenderer == QR_OPENGL)
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
if (qrenderer != QR_NONE)
|
||||
{
|
||||
if (noerrors)
|
||||
GLMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
|
||||
|
@ -3972,7 +3975,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
|||
loadmodel->funcs.LeafPVS = CM_LeafnumPVS;
|
||||
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
|
||||
|
||||
#if defined(RGLQUAKE)
|
||||
#if defined(RGLQUAKE) || defined(D3DQUAKE)
|
||||
loadmodel->funcs.LightPointValues = GLQ3_LightGrid;
|
||||
loadmodel->funcs.StainNode = GLR_Q2BSP_StainNode;
|
||||
loadmodel->funcs.MarkLights = Q2BSP_MarkLights;
|
||||
|
@ -4180,6 +4183,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
Hunk_FreeToLowMark(start);
|
||||
return NULL;
|
||||
Sys_Error("Bad internal renderer on q2 map load\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ void Matrix4_Transform3(float *matrix, float *vector, float *product)
|
|||
product[2] = matrix[2]*vector[0] + matrix[6]*vector[1] + matrix[10]*vector[2] + matrix[14];
|
||||
}
|
||||
|
||||
void ML_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg)
|
||||
void Matrix4_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg)
|
||||
{
|
||||
float tempmat[16];
|
||||
//load identity.
|
||||
|
@ -861,7 +861,7 @@ void ML_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg)
|
|||
|
||||
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
|
||||
}
|
||||
void ML_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
|
||||
void Matrix4_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
|
||||
{
|
||||
float tempmat[16];
|
||||
|
||||
|
@ -886,64 +886,108 @@ void ML_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_
|
|||
}
|
||||
|
||||
|
||||
void ML_ProjectionMatrix(float *proj, float wdivh, float fovy)
|
||||
void Matrix4_ModelMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
|
||||
{
|
||||
float tempmat[16];
|
||||
|
||||
tempmat[ 0] = pn[0];
|
||||
tempmat[ 1] = pn[1];
|
||||
tempmat[ 2] = pn[2];
|
||||
tempmat[ 3] = 0;
|
||||
tempmat[ 4] = right[0];
|
||||
tempmat[ 5] = right[1];
|
||||
tempmat[ 6] = right[2];
|
||||
tempmat[ 7] = 0;
|
||||
tempmat[ 8] = up[0];
|
||||
tempmat[ 9] = up[1];
|
||||
tempmat[10] = up[2];
|
||||
tempmat[11] = 0;
|
||||
tempmat[12] = 0;
|
||||
tempmat[13] = 0;
|
||||
tempmat[14] = 0;
|
||||
tempmat[15] = 1;
|
||||
|
||||
Matrix4_Multiply(Matrix4_NewTranslation(vieworg[0], vieworg[1], vieworg[2]), tempmat, modelview); // put Z going up
|
||||
}
|
||||
|
||||
void Matrix4_Identity(float *outm)
|
||||
{
|
||||
outm[ 0] = 1;
|
||||
outm[ 1] = 0;
|
||||
outm[ 2] = 0;
|
||||
outm[ 3] = 0;
|
||||
outm[ 4] = 0;
|
||||
outm[ 5] = 1;
|
||||
outm[ 6] = 0;
|
||||
outm[ 7] = 0;
|
||||
outm[ 8] = 0;
|
||||
outm[ 9] = 0;
|
||||
outm[10] = 1;
|
||||
outm[11] = 0;
|
||||
outm[12] = 0;
|
||||
outm[13] = 0;
|
||||
outm[14] = 0;
|
||||
outm[15] = 1;
|
||||
}
|
||||
|
||||
void Matrix4_Projection(float *proj, float wdivh, float fovy, float neard)
|
||||
{
|
||||
float xmin, xmax, ymin, ymax;
|
||||
float nudge = 1;
|
||||
|
||||
//proj
|
||||
ymax = 4 * tan( fovy * M_PI / 360.0 );
|
||||
ymax = neard * tan( fovy * M_PI / 360.0 );
|
||||
ymin = -ymax;
|
||||
|
||||
xmin = ymin * wdivh;
|
||||
xmax = ymax * wdivh;
|
||||
|
||||
proj[0] = (2*4) / (xmax - xmin);
|
||||
proj[0] = (2*neard) / (xmax - xmin);
|
||||
proj[4] = 0;
|
||||
proj[8] = (xmax + xmin) / (xmax - xmin);
|
||||
proj[12] = 0;
|
||||
|
||||
proj[1] = 0;
|
||||
proj[5] = (2*4) / (ymax - ymin);
|
||||
proj[5] = (2*neard) / (ymax - ymin);
|
||||
proj[9] = (ymax + ymin) / (ymax - ymin);
|
||||
proj[13] = 0;
|
||||
|
||||
proj[2] = 0;
|
||||
proj[6] = 0;
|
||||
proj[10] = -1 * nudge;
|
||||
proj[14] = -2*4 * nudge;
|
||||
proj[14] = -2*neard * nudge;
|
||||
|
||||
proj[3] = 0;
|
||||
proj[7] = 0;
|
||||
proj[11] = -1;
|
||||
proj[15] = 0;
|
||||
}
|
||||
void ML_ProjectionMatrix2(float *proj, float fovx, float fovy)
|
||||
void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard)
|
||||
{
|
||||
float xmin, xmax, ymin, ymax;
|
||||
float nudge = 1;
|
||||
|
||||
//proj
|
||||
ymax = 4 * tan( fovy * M_PI / 360.0 );
|
||||
ymax = neard * tan( fovy * M_PI / 360.0 );
|
||||
ymin = -ymax;
|
||||
|
||||
xmax = 4 * tan( fovx * M_PI / 360.0 );
|
||||
xmax = neard * tan( fovx * M_PI / 360.0 );
|
||||
xmin = -xmax;
|
||||
|
||||
proj[0] = (2*4) / (xmax - xmin);
|
||||
proj[0] = (2*neard) / (xmax - xmin);
|
||||
proj[4] = 0;
|
||||
proj[8] = (xmax + xmin) / (xmax - xmin);
|
||||
proj[12] = 0;
|
||||
|
||||
proj[1] = 0;
|
||||
proj[5] = (2*4) / (ymax - ymin);
|
||||
proj[5] = (2*neard) / (ymax - ymin);
|
||||
proj[9] = (ymax + ymin) / (ymax - ymin);
|
||||
proj[13] = 0;
|
||||
|
||||
proj[2] = 0;
|
||||
proj[6] = 0;
|
||||
proj[10] = -1 * nudge;
|
||||
proj[14] = -2*4 * nudge;
|
||||
proj[14] = -2*neard * nudge;
|
||||
|
||||
proj[3] = 0;
|
||||
proj[7] = 0;
|
||||
|
@ -951,7 +995,31 @@ void ML_ProjectionMatrix2(float *proj, float fovx, float fovy)
|
|||
proj[15] = 0;
|
||||
}
|
||||
|
||||
void Matrix4x4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1)
|
||||
void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymax, float ymin,
|
||||
float znear, float zfar)
|
||||
{
|
||||
proj[0] = 2/(xmax-xmin);
|
||||
proj[4] = 0;
|
||||
proj[8] = 0;
|
||||
proj[12] = (xmax+xmin)/(xmax-xmin);
|
||||
|
||||
proj[1] = 0;
|
||||
proj[5] = 2/(ymax-ymin);
|
||||
proj[9] = 0;
|
||||
proj[13] = (ymax+ymin)/(ymax-ymin);
|
||||
|
||||
proj[2] = 0;
|
||||
proj[6] = 0;
|
||||
proj[10] = -2/(zfar-znear);
|
||||
proj[14] = (zfar+znear)/(zfar-znear);
|
||||
|
||||
proj[3] = 0;
|
||||
proj[7] = 0;
|
||||
proj[11] = 0;
|
||||
proj[15] = 1;
|
||||
}
|
||||
|
||||
void Matrix4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1)
|
||||
{
|
||||
// we only support uniform scaling, so assume the first row is enough
|
||||
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
||||
|
@ -993,17 +1061,17 @@ void Matrix4x4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1)
|
|||
|
||||
//screen->3d
|
||||
|
||||
void ML_UnProject(vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy)
|
||||
void Matrix4_UnProject(vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy)
|
||||
{
|
||||
float modelview[16];
|
||||
float proj[16];
|
||||
float tempm[16];
|
||||
|
||||
ML_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||
ML_ProjectionMatrix(proj, wdivh, fovy);
|
||||
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||
Matrix4_Projection(proj, wdivh, fovy, 4);
|
||||
Matrix4_Multiply(proj, modelview, tempm);
|
||||
|
||||
Matrix4x4_Invert_Simple((void*)proj, (void*)tempm);
|
||||
Matrix4_Invert_Simple((void*)proj, (void*)tempm);
|
||||
|
||||
{
|
||||
float v[4], tempv[4];
|
||||
|
@ -1023,13 +1091,13 @@ void ML_UnProject(vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, floa
|
|||
//returns fractions of screen.
|
||||
//uses GL style rotations and translations and stuff.
|
||||
//3d -> screen (fixme: offscreen return values needed)
|
||||
void ML_Project (vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy)
|
||||
void Matrix4_Project (vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy)
|
||||
{
|
||||
float modelview[16];
|
||||
float proj[16];
|
||||
|
||||
ML_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||
ML_ProjectionMatrix(proj, wdivh, fovy);
|
||||
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||
Matrix4_Projection(proj, wdivh, fovy, 4);
|
||||
|
||||
{
|
||||
float v[4], tempv[4];
|
||||
|
@ -1120,3 +1188,4 @@ void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up)
|
|||
VectorNormalize (right);
|
||||
CrossProduct (right, forward, up);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,14 +114,19 @@ typedef struct {
|
|||
} matrix4x4_t;
|
||||
|
||||
//used for crosshair stuff.
|
||||
void ML_Project (vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy);
|
||||
void Matrix4_Project (vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy);
|
||||
void Matrix4_UnProject(vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float wdivh, float fovy);
|
||||
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
|
||||
void Matrix4_Multiply(float *a, float *b, float *out);
|
||||
void Matrix4_Transform3(float *matrix, float *vector, float *product);
|
||||
void Matrix4_Transform4(float *matrix, float *vector, float *product);
|
||||
void Matrix4x4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1);
|
||||
void ML_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg);
|
||||
void ML_ProjectionMatrix2(float *proj, float fovx, float fovy);
|
||||
void ML_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
|
||||
void Matrix4_Invert_Simple (matrix4x4_t *out, const matrix4x4_t *in1);
|
||||
void Matrix4_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg);
|
||||
void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard);
|
||||
void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
|
||||
void Matrix4_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
|
||||
|
||||
|
||||
void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs);
|
||||
qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2);
|
||||
void ClearBounds (vec3_t mins, vec3_t maxs);
|
||||
|
|
|
@ -533,7 +533,7 @@ dblbreak:
|
|||
|
||||
if (strlen(s) >= sizeof(copy)-1)
|
||||
return false;
|
||||
|
||||
|
||||
strcpy (copy, s);
|
||||
// strip off a trailing :port if present
|
||||
for (colon = copy ; *colon ; colon++)
|
||||
|
|
|
@ -126,6 +126,128 @@ typedef struct beamseg_s
|
|||
float texture_s;
|
||||
} beamseg_t;
|
||||
|
||||
|
||||
|
||||
typedef struct skytris_s {
|
||||
struct skytris_s *next;
|
||||
vec3_t org;
|
||||
vec3_t x;
|
||||
vec3_t y;
|
||||
float area;
|
||||
float nexttime;
|
||||
struct msurface_s *face;
|
||||
} skytris_t;
|
||||
|
||||
//these could be deltas or absolutes depending on ramping mode.
|
||||
typedef struct {
|
||||
vec3_t rgb;
|
||||
float alpha;
|
||||
float scale;
|
||||
float rotation;
|
||||
} ramp_t;
|
||||
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
|
||||
// TODO: merge in alpha with rgb to gain benefit of vector opts
|
||||
typedef struct part_type_s {
|
||||
char name[MAX_QPATH];
|
||||
char texname[MAX_QPATH];
|
||||
vec3_t rgb;
|
||||
vec3_t rgbchange;
|
||||
vec3_t rgbrand;
|
||||
int colorindex;
|
||||
int colorrand;
|
||||
float rgbchangetime;
|
||||
vec3_t rgbrandsync;
|
||||
float scale, alpha;
|
||||
float alphachange;
|
||||
float die, randdie;
|
||||
float randomvel, veladd;
|
||||
float orgadd;
|
||||
float offsetspread;
|
||||
float offsetspreadvert;
|
||||
float randomvelvert;
|
||||
float randscale;
|
||||
|
||||
float spawntime;
|
||||
float spawnchance;
|
||||
|
||||
enum {PT_NORMAL, PT_SPARK, PT_SPARKFAN, PT_TEXTUREDSPARK, PT_BEAM, PT_DECAL} type;
|
||||
blendmode_t blendmode;
|
||||
|
||||
float rotationstartmin, rotationstartrand;
|
||||
float rotationmin, rotationrand;
|
||||
|
||||
float scaledelta;
|
||||
float count;
|
||||
float countrand;
|
||||
int texturenum;
|
||||
#ifdef D3DQUAKE
|
||||
void *d3dtexture;
|
||||
#endif
|
||||
int assoc;
|
||||
int cliptype;
|
||||
int inwater;
|
||||
float clipcount;
|
||||
int emit;
|
||||
float emittime;
|
||||
float emitrand;
|
||||
float emitstart;
|
||||
|
||||
float areaspread;
|
||||
float areaspreadvert;
|
||||
float scalefactor;
|
||||
float invscalefactor;
|
||||
|
||||
float spawnparam1;
|
||||
float spawnparam2;
|
||||
/* float spawnparam3; */
|
||||
|
||||
float offsetup; // make this into a vec3_t later with dir, possibly for mdls
|
||||
|
||||
enum {
|
||||
SM_BOX, //box = even spread within the area
|
||||
SM_CIRCLE, //circle = around edge of a circle
|
||||
SM_BALL, //ball = filled sphere
|
||||
SM_SPIRAL, //spiral = spiral trail
|
||||
SM_TRACER, //tracer = tracer trail
|
||||
SM_TELEBOX, //telebox = q1-style telebox
|
||||
SM_LAVASPLASH, //lavasplash = q1-style lavasplash
|
||||
SM_UNICIRCLE, //unicircle = uniform circle
|
||||
SM_FIELD, //field = synced field (brightfield, etc)
|
||||
SM_DISTBALL // uneven distributed ball
|
||||
} spawnmode;
|
||||
|
||||
float gravity;
|
||||
vec3_t friction;
|
||||
float clipbounce;
|
||||
int stains;
|
||||
|
||||
enum {RAMP_NONE, RAMP_DELTA, RAMP_ABSOLUTE} rampmode;
|
||||
int rampindexes;
|
||||
ramp_t *ramp;
|
||||
|
||||
int loaded;
|
||||
particle_t *particles;
|
||||
clippeddecal_t *clippeddecals;
|
||||
beamseg_t *beams;
|
||||
skytris_t *skytris;
|
||||
struct part_type_s *nexttorun;
|
||||
|
||||
unsigned int flags;
|
||||
#define PT_VELOCITY 0x001
|
||||
#define PT_FRICTION 0x002
|
||||
#define PT_CHANGESCOLOUR 0x004
|
||||
#define PT_CITRACER 0x008 // Q1-style tracer behavior for colorindex
|
||||
#define PT_INVFRAMETIME 0x010 // apply inverse frametime to count (causes emits to be per frame)
|
||||
#define PT_AVERAGETRAIL 0x020 // average trail points from start to end, useful with t_lightning, etc
|
||||
#define PT_NOSTATE 0x040 // don't use trailstate for this emitter (careful with assoc...)
|
||||
#define PT_NOSPREADFIRST 0x080 // don't randomize org/vel for first generated particle
|
||||
#define PT_NOSPREADLAST 0x100 // don't randomize org/vel for last generated particle
|
||||
unsigned int state;
|
||||
#define PS_INRUNLIST 0x1 // particle type is currently in execution list
|
||||
} part_type_t;
|
||||
|
||||
|
||||
|
||||
#define PARTICLE_Z_CLIP 8.0
|
||||
|
||||
#define frandom() (rand()*(1.0f/RAND_MAX))
|
||||
|
@ -179,8 +301,6 @@ void P_EmitSkyEffectTris(struct model_s *mod, struct msurface_s *fa);
|
|||
// trailstate functions
|
||||
void P_DelinkTrailstate(trailstate_t **tsk);
|
||||
|
||||
typedef enum { BM_BLEND, BM_BLENDCOLOUR, BM_ADD, BM_SUBTRACT } blendmode_t;
|
||||
|
||||
// used for callback
|
||||
extern cvar_t r_particlesdesc;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue