mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2024-11-22 03:41:35 +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;
|
||||
//
|
||||
|
||||
void GL_DrawAliasBlendedWireFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
||||
{
|
||||
trivertx_t* verts1;
|
||||
trivertx_t* verts2;
|
||||
int* order;
|
||||
int count;
|
||||
vec3_t d;
|
||||
vec3_t point;
|
||||
// void GL_DrawAliasBlendedWireFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
||||
// {
|
||||
// trivertx_t* verts1;
|
||||
// trivertx_t* verts2;
|
||||
// int* order;
|
||||
// int count;
|
||||
// vec3_t d;
|
||||
// vec3_t point;
|
||||
|
||||
lastposenum0 = pose1;
|
||||
lastposenum = pose2;
|
||||
// lastposenum0 = pose1;
|
||||
// lastposenum = pose2;
|
||||
|
||||
verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
||||
verts2 = verts1;
|
||||
// verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
|
||||
// verts2 = verts1;
|
||||
|
||||
verts1 += pose1 * paliashdr->poseverts;
|
||||
verts2 += pose2 * paliashdr->poseverts;
|
||||
// verts1 += pose1 * paliashdr->poseverts;
|
||||
// verts2 += pose2 * paliashdr->poseverts;
|
||||
|
||||
order = (int *)((byte *)paliashdr + paliashdr->commands);
|
||||
// order = (int *)((byte *)paliashdr + paliashdr->commands);
|
||||
|
||||
int numcommands = order[0];
|
||||
order++;
|
||||
// int numcommands = order[0];
|
||||
// order++;
|
||||
|
||||
struct vertex
|
||||
{
|
||||
int uvs;
|
||||
char x, y, z;
|
||||
char _padding;
|
||||
};
|
||||
// struct vertex
|
||||
// {
|
||||
// int uvs;
|
||||
// char x, y, z;
|
||||
// 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.
|
||||
vertex* const out = static_cast<vertex*>(sceGuGetMemory(sizeof(vertex) * numcommands));
|
||||
int vertex_index = 0;
|
||||
// // Allocate the vertices.
|
||||
// vertex* const out = static_cast<vertex*>(sceGuGetMemory(sizeof(vertex) * numcommands));
|
||||
// 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
|
||||
while (1)
|
||||
{
|
||||
// get the vertex count and primitive type
|
||||
count = *order++;
|
||||
// //for blubs's alternate BuildTris: 1) Disable while(1) loop 2) Disable the break; 3) replace GU_TRIANGLE_STRIP with GU_TRIANGLES
|
||||
// while (1)
|
||||
// {
|
||||
// // get the vertex count and primitive type
|
||||
// count = *order++;
|
||||
|
||||
if (!count) break;
|
||||
if (count < 0)
|
||||
count = -count;
|
||||
// if (!count) break;
|
||||
// if (count < 0)
|
||||
// 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
|
||||
out[vertex_index].uvs = order[0];
|
||||
order += 1;
|
||||
// // texture coordinates come from the draw list
|
||||
// out[vertex_index].uvs = order[0];
|
||||
// order += 1;
|
||||
|
||||
VectorSubtract(verts2->v, verts1->v, d);
|
||||
// VectorSubtract(verts2->v, verts1->v, d);
|
||||
|
||||
// blend the vertex positions from each frame together
|
||||
point[0] = verts1->v[0] + (blend * d[0]);
|
||||
point[1] = verts1->v[1] + (blend * d[1]);
|
||||
point[2] = verts1->v[2] + (blend * d[2]);
|
||||
// // blend the vertex positions from each frame together
|
||||
// point[0] = verts1->v[0] + (blend * d[0]);
|
||||
// point[1] = verts1->v[1] + (blend * d[1]);
|
||||
// point[2] = verts1->v[2] + (blend * d[2]);
|
||||
|
||||
out[vertex_index].x = point[0];
|
||||
out[vertex_index].y = point[1];
|
||||
out[vertex_index].z = point[2];
|
||||
// out[vertex_index].x = point[0];
|
||||
// out[vertex_index].y = point[1];
|
||||
// out[vertex_index].z = point[2];
|
||||
|
||||
++verts1;
|
||||
++verts2;
|
||||
}
|
||||
sceGuDrawArray(GU_LINE_STRIP, GU_TEXTURE_16BIT | GU_VERTEX_8BIT, count, 0, &out[vertex_index - count]);
|
||||
}
|
||||
// ++verts1;
|
||||
// ++verts2;
|
||||
// }
|
||||
// sceGuDrawArray(GU_LINE_STRIP, GU_TEXTURE_16BIT | GU_VERTEX_8BIT, count, 0, &out[vertex_index - count]);
|
||||
// }
|
||||
|
||||
sceGuEnable(GU_TEXTURE_2D);
|
||||
sceGuColor(0xffffffff);
|
||||
}
|
||||
// sceGuEnable(GU_TEXTURE_2D);
|
||||
// sceGuColor(0xffffffff);
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1040,11 +1040,11 @@ GL_DrawAliasFrame
|
|||
*/
|
||||
void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
||||
{
|
||||
if (r_showtris.value)
|
||||
{
|
||||
GL_DrawAliasBlendedWireFrame(paliashdr, posenum, posenum, 0);
|
||||
return;
|
||||
}
|
||||
// if (r_showtris.value)
|
||||
// {
|
||||
// GL_DrawAliasBlendedWireFrame(paliashdr, posenum, posenum, 0);
|
||||
// return;
|
||||
// }
|
||||
trivertx_t *verts;
|
||||
int *order;
|
||||
int count;
|
||||
|
@ -1138,11 +1138,11 @@ fenix@io.com: model animation interpolation
|
|||
*/
|
||||
void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
|
||||
{
|
||||
if (r_showtris.value)
|
||||
{
|
||||
GL_DrawAliasBlendedWireFrame(paliashdr, pose1, pose2, blend);
|
||||
return;
|
||||
}
|
||||
// if (r_showtris.value)
|
||||
// {
|
||||
// GL_DrawAliasBlendedWireFrame(paliashdr, pose1, pose2, blend);
|
||||
// return;
|
||||
// }
|
||||
trivertx_t* verts1;
|
||||
trivertx_t* verts2;
|
||||
int* order;
|
||||
|
|
Loading…
Reference in a new issue