void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
{
int c, fullbright, layernum, firstpass;
- float tint[3], fog, ifog, colorscale, ambientcolor4f[4];
+ float tint[3], fog, ifog, colorscale, ambientcolor4f[4], diffusecolor[3], diffusenormal[3];
vec3_t diff;
qbyte *bcolor;
rmeshstate_t m;
const entity_render_t *ent = calldata1;
- aliasmesh_t *mesh = ent->model->aliasdata_meshes + calldata2;
+ aliasmesh_t *mesh = ent->model->alias.aliasdata_meshes + calldata2;
aliaslayer_t *layer;
aliasskin_t *skin;
GL_DepthTest(true);
firstpass = false;
expandaliasvert(mesh->num_vertices);
- colorscale = r_colorscale;
+ colorscale = 1.0f;
memset(&m, 0, sizeof(m));
if (layer->texture != NULL)
GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha);
else
{
- if (R_LightModel(ambientcolor4f, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false))
+ if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false))
{
GL_ColorPointer(varray_color4f);
R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, varray_normal3f);
- R_LightModel_CalcVertexColors(ambientcolor4f, mesh->num_vertices, varray_vertex3f, varray_normal3f, varray_color4f);
+ R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, mesh->num_vertices, varray_vertex3f, varray_normal3f, varray_color4f);
}
else
GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
c_models++;
- for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++)
+ for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++)
{
if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_FetchAliasSkin(ent, mesh)->flags & ALIASSKIN_TRANSPARENT)
R_MeshQueue_AddTransparent(ent->origin, R_DrawAliasModelCallback, ent, meshnum);
}
}
-void R_Model_Alias_DrawFakeShadow (entity_render_t *ent)
-{
- int i, meshnum;
- aliasmesh_t *mesh;
- aliasskin_t *skin;
- rmeshstate_t m;
- float *v, plane[4], dist, projection[3], floororigin[3], surfnormal[3], lightdirection[3], v2[3];
-
- if ((ent->effects & EF_ADDITIVE) || ent->alpha < 1)
- return;
-
- lightdirection[0] = 0.5;
- lightdirection[1] = 0.2;
- lightdirection[2] = -1;
- VectorNormalizeFast(lightdirection);
-
- VectorMA(ent->origin, 65536.0f, lightdirection, v2);
- if (CL_TraceLine(ent->origin, v2, floororigin, surfnormal, 0, false, NULL) == 1)
- return;
-
- R_Mesh_Matrix(&ent->matrix);
-
- memset(&m, 0, sizeof(m));
- R_Mesh_State_Texture(&m);
-
- GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- GL_DepthMask(false);
- GL_DepthTest(true);
- GL_VertexPointer(varray_vertex3f);
- GL_Color(0, 0, 0, 0.5);
-
- // put a light direction in the entity's coordinate space
- Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, projection);
- VectorNormalizeFast(projection);
-
- // put the plane's normal in the entity's coordinate space
- Matrix4x4_Transform3x3(&ent->inversematrix, surfnormal, plane);
- VectorNormalizeFast(plane);
-
- // put the plane's distance in the entity's coordinate space
- VectorSubtract(floororigin, ent->origin, floororigin);
- plane[3] = DotProduct(floororigin, surfnormal) + 2;
-
- dist = -1.0f / DotProduct(projection, plane);
- VectorScale(projection, dist, projection);
- for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++)
- {
- skin = R_FetchAliasSkin(ent, mesh);
- if (skin->flags & ALIASSKIN_TRANSPARENT)
- continue;
- R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f);
- for (i = 0, v = varray_vertex3f;i < mesh->num_vertices;i++, v += 3)
- {
- dist = DotProduct(v, plane) - plane[3];
- if (dist > 0)
- VectorMA(v, dist, projection, v);
- }
- c_alias_polys += mesh->num_triangles;
- R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
- }
-}
-
void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius)
{
int meshnum;
if (projectdistance > 0.1)
{
R_Mesh_Matrix(&ent->matrix);
- for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++)
+ for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++)
{
skin = R_FetchAliasSkin(ent, mesh);
if (skin->flags & ALIASSKIN_TRANSPARENT)
}
ifog = 1 - fog;
- for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++)
+ for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++)
{
skin = R_FetchAliasSkin(ent, mesh);
if (skin->flags & ALIASSKIN_TRANSPARENT)
void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
{
- float fog, ifog, colorscale, ambientcolor4f[4];
+ float fog, ifog, colorscale, ambientcolor4f[4], diffusecolor[3], diffusenormal[3];
vec3_t diff;
int i, *renderlist, *elements;
rtexture_t *texture;
R_Mesh_Matrix(&ent->matrix);
// find the vertex index list and texture
- renderlist = ent->model->zymdata_renderlist;
+ renderlist = ent->model->alias.zymdata_renderlist;
for (i = 0;i < shadernum;i++)
renderlist += renderlist[0] * 3 + 1;
- texture = ent->model->zymdata_textures[shadernum];
+ texture = ent->model->alias.zymdata_textures[shadernum];
- numverts = ent->model->zymnum_verts;
+ numverts = ent->model->alias.zymnum_verts;
numtriangles = *renderlist++;
elements = renderlist;
GL_VertexPointer(varray_vertex3f);
memset(&mstate, 0, sizeof(mstate));
- colorscale = r_colorscale;
+ colorscale = 1.0f;
if (gl_combine.integer)
{
mstate.texrgbscale[0] = 4;
colorscale *= 0.25f;
}
mstate.tex[0] = R_GetTexture(texture);
- mstate.pointer_texcoord[0] = ent->model->zymdata_texcoords;
+ mstate.pointer_texcoord[0] = ent->model->alias.zymdata_texcoords;
R_Mesh_State_Texture(&mstate);
- ZymoticLerpBones(ent->model->zymnum_bones, (zymbonematrix *) ent->model->zymdata_poses, ent->frameblend, ent->model->zymdata_bones);
+ ZymoticLerpBones(ent->model->alias.zymnum_bones, (zymbonematrix *) ent->model->alias.zymdata_poses, ent->frameblend, ent->model->alias.zymdata_bones);
- ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->zymdata_vertbonecounts, ent->model->zymdata_verts);
- ZymoticCalcNormal3f(numverts, varray_vertex3f, aliasvert_normal3f, ent->model->zymnum_shaders, ent->model->zymdata_renderlist);
- if (R_LightModel(ambientcolor4f, ent, ifog * colorscale, ifog * colorscale, ifog * colorscale, ent->alpha, false))
+ ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
+ ZymoticCalcNormal3f(numverts, varray_vertex3f, aliasvert_normal3f, ent->model->alias.zymnum_shaders, ent->model->alias.zymdata_renderlist);
+ if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, ifog * colorscale, ifog * colorscale, ifog * colorscale, ent->alpha, false))
{
GL_ColorPointer(varray_color4f);
- R_LightModel_CalcVertexColors(ambientcolor4f, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f);
+ R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f);
}
else
GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
memset(&mstate, 0, sizeof(mstate));
// FIXME: need alpha mask for fogging...
//mstate.tex[0] = R_GetTexture(texture);
- //mstate.pointer_texcoord = ent->model->zymdata_texcoords;
+ //mstate.pointer_texcoord = ent->model->alias.zymdata_texcoords;
R_Mesh_State_Texture(&mstate);
- GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog);
- ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->zymdata_vertbonecounts, ent->model->zymdata_verts);
+ GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog);
+ ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
R_Mesh_Draw(numverts, numtriangles, elements);
c_alias_polys += numtriangles;
}
c_models++;
- for (i = 0;i < ent->model->zymnum_shaders;i++)
+ for (i = 0;i < ent->model->alias.zymnum_shaders;i++)
{
- if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_TextureHasAlpha(ent->model->zymdata_textures[i]))
+ if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_TextureHasAlpha(ent->model->alias.zymdata_textures[i]))
R_MeshQueue_AddTransparent(ent->origin, R_DrawZymoticModelMeshCallback, ent, i);
else
R_DrawZymoticModelMeshCallback(ent, i);
}
}
-void R_Model_Zymotic_DrawFakeShadow(entity_render_t *ent)
-{
- // FIXME
-}
-
void R_Model_Zymotic_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, float lightradius2, float lightdistbias, float lightsubtract, float *lightcolor)
{
// FIXME