mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2024-11-25 21:31:49 +00:00
Fix r_showtris crashing when rendering aliasmodels
This commit is contained in:
parent
5b1925bdac
commit
e3202ef9a5
1 changed files with 66 additions and 66 deletions
|
@ -958,79 +958,79 @@ int lastposenum;
|
||||||
float old_i_model_transform;
|
float old_i_model_transform;
|
||||||
//
|
//
|
||||||
|
|
||||||
void GL_DrawAliasBlendedWireFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
// void GL_DrawAliasBlendedWireFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
||||||
{
|
// {
|
||||||
trivertx_t* verts1;
|
// trivertx_t* verts1;
|
||||||
trivertx_t* verts2;
|
// trivertx_t* verts2;
|
||||||
int* order;
|
// int* order;
|
||||||
int count;
|
// int count;
|
||||||
vec3_t d;
|
// vec3_t d;
|
||||||
vec3_t point;
|
// vec3_t point;
|
||||||
|
|
||||||
lastposenum0 = pose1;
|
// lastposenum0 = pose1;
|
||||||
lastposenum = pose2;
|
// lastposenum = pose2;
|
||||||
|
|
||||||
verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
// verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
||||||
verts2 = verts1;
|
// verts2 = verts1;
|
||||||
|
|
||||||
verts1 += pose1 * paliashdr->poseverts;
|
// verts1 += pose1 * paliashdr->poseverts;
|
||||||
verts2 += pose2 * paliashdr->poseverts;
|
// verts2 += pose2 * paliashdr->poseverts;
|
||||||
|
|
||||||
order = (int *)((byte *)paliashdr + paliashdr->commands);
|
// order = (int *)((byte *)paliashdr + paliashdr->commands);
|
||||||
|
|
||||||
int numcommands = order[0];
|
// int numcommands = order[0];
|
||||||
order++;
|
// order++;
|
||||||
|
|
||||||
struct vertex
|
// struct vertex
|
||||||
{
|
// {
|
||||||
int uvs;
|
// int uvs;
|
||||||
char x, y, z;
|
// char x, y, z;
|
||||||
char _padding;
|
// char _padding;
|
||||||
};
|
// };
|
||||||
|
|
||||||
sceGuColor(GU_COLOR(lightcolor[0], lightcolor[1], lightcolor[2], 1.0f));
|
// sceGuColor(GU_COLOR(lightcolor[0], lightcolor[1], lightcolor[2], 1.0f));
|
||||||
|
|
||||||
// Allocate the vertices.
|
// // Allocate the vertices.
|
||||||
vertex* const out = static_cast<vertex*>(sceGuGetMemory(sizeof(vertex) * numcommands));
|
// vertex* const out = static_cast<vertex*>(sceGuGetMemory(sizeof(vertex) * numcommands));
|
||||||
int vertex_index = 0;
|
// int vertex_index = 0;
|
||||||
|
|
||||||
//for blubs's alternate BuildTris: 1) Disable while(1) loop 2) Disable the break; 3) replace GU_TRIANGLE_STRIP with GU_TRIANGLES
|
// //for blubs's alternate BuildTris: 1) Disable while(1) loop 2) Disable the break; 3) replace GU_TRIANGLE_STRIP with GU_TRIANGLES
|
||||||
while (1)
|
// while (1)
|
||||||
{
|
// {
|
||||||
// get the vertex count and primitive type
|
// // get the vertex count and primitive type
|
||||||
count = *order++;
|
// count = *order++;
|
||||||
|
|
||||||
if (!count) break;
|
// if (!count) break;
|
||||||
if (count < 0)
|
// if (count < 0)
|
||||||
count = -count;
|
// count = -count;
|
||||||
|
|
||||||
for (int start = vertex_index; vertex_index < (start + count); ++vertex_index)
|
// for (int start = vertex_index; vertex_index < (start + count); ++vertex_index)
|
||||||
{
|
// {
|
||||||
|
|
||||||
// texture coordinates come from the draw list
|
// // texture coordinates come from the draw list
|
||||||
out[vertex_index].uvs = order[0];
|
// out[vertex_index].uvs = order[0];
|
||||||
order += 1;
|
// order += 1;
|
||||||
|
|
||||||
VectorSubtract(verts2->v, verts1->v, d);
|
// VectorSubtract(verts2->v, verts1->v, d);
|
||||||
|
|
||||||
// blend the vertex positions from each frame together
|
// // blend the vertex positions from each frame together
|
||||||
point[0] = verts1->v[0] + (blend * d[0]);
|
// point[0] = verts1->v[0] + (blend * d[0]);
|
||||||
point[1] = verts1->v[1] + (blend * d[1]);
|
// point[1] = verts1->v[1] + (blend * d[1]);
|
||||||
point[2] = verts1->v[2] + (blend * d[2]);
|
// point[2] = verts1->v[2] + (blend * d[2]);
|
||||||
|
|
||||||
out[vertex_index].x = point[0];
|
// out[vertex_index].x = point[0];
|
||||||
out[vertex_index].y = point[1];
|
// out[vertex_index].y = point[1];
|
||||||
out[vertex_index].z = point[2];
|
// out[vertex_index].z = point[2];
|
||||||
|
|
||||||
++verts1;
|
// ++verts1;
|
||||||
++verts2;
|
// ++verts2;
|
||||||
}
|
// }
|
||||||
sceGuDrawArray(GU_LINE_STRIP, GU_TEXTURE_16BIT | GU_VERTEX_8BIT, count, 0, &out[vertex_index - count]);
|
// sceGuDrawArray(GU_LINE_STRIP, GU_TEXTURE_16BIT | GU_VERTEX_8BIT, count, 0, &out[vertex_index - count]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
sceGuEnable(GU_TEXTURE_2D);
|
// sceGuEnable(GU_TEXTURE_2D);
|
||||||
sceGuColor(0xffffffff);
|
// sceGuColor(0xffffffff);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1040,11 +1040,11 @@ GL_DrawAliasFrame
|
||||||
*/
|
*/
|
||||||
void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
||||||
{
|
{
|
||||||
if (r_showtris.value)
|
// if (r_showtris.value)
|
||||||
{
|
// {
|
||||||
GL_DrawAliasBlendedWireFrame(paliashdr, posenum, posenum, 0);
|
// GL_DrawAliasBlendedWireFrame(paliashdr, posenum, posenum, 0);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
trivertx_t *verts;
|
trivertx_t *verts;
|
||||||
int *order;
|
int *order;
|
||||||
int count;
|
int count;
|
||||||
|
@ -1138,11 +1138,11 @@ fenix@io.com: model animation interpolation
|
||||||
*/
|
*/
|
||||||
void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
||||||
{
|
{
|
||||||
if (r_showtris.value)
|
// if (r_showtris.value)
|
||||||
{
|
// {
|
||||||
GL_DrawAliasBlendedWireFrame(paliashdr, pose1, pose2, blend);
|
// GL_DrawAliasBlendedWireFrame(paliashdr, pose1, pose2, blend);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
trivertx_t* verts1;
|
trivertx_t* verts1;
|
||||||
trivertx_t* verts2;
|
trivertx_t* verts2;
|
||||||
int* order;
|
int* order;
|
||||||
|
|
Loading…
Reference in a new issue