Use vertex morphs for interpolated alias mdl

This commit is contained in:
Shpuld Shpuldson 2023-09-10 09:46:25 +03:00
parent ad36351717
commit ecc81105f8

View file

@ -1169,14 +1169,13 @@ void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, floa
struct vertex struct vertex
{ {
int uvs; int uvs;
char x, y, z; int xyz;
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 * 2));
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
@ -1197,19 +1196,17 @@ void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, floa
//prim = GU_TRIANGLES; //used for blubs' alternate BuildTris with one continual triangle list //prim = GU_TRIANGLES; //used for blubs' alternate BuildTris with one continual triangle list
} }
for (int start = vertex_index; vertex_index < (start + count); ++vertex_index, ++order, ++verts1, ++verts2) for (int start = vertex_index; vertex_index < (start + count * 2); ++vertex_index, ++order, ++verts1, ++verts2)
{ {
// texture coordinates come from the draw list
out[vertex_index].uvs = order[0]; out[vertex_index].uvs = order[0];
out[vertex_index].xyz = ((int*)verts1->v)[0];
VectorSubtract(verts2->v, verts1->v, d); ++vertex_index;
out[vertex_index].uvs = order[0];
// blend the vertex positions from each frame together out[vertex_index].xyz = ((int*)verts2->v)[0];
out[vertex_index].x = verts1->v[0] + (blend * d[0]);
out[vertex_index].y = verts1->v[1] + (blend * d[1]);
out[vertex_index].z = verts1->v[2] + (blend * d[2]);
} }
sceGuDrawArray(prim, GU_TEXTURE_16BIT | GU_VERTEX_8BIT, count, 0, &out[vertex_index - count]); sceGuMorphWeight(0, 1 - blend);
sceGuMorphWeight(1, blend);
sceGuDrawArray(prim, GU_TEXTURE_16BIT | GU_VERTEX_8BIT | GU_VERTICES(2), count, 0, &out[vertex_index - count * 2]);
} }
sceGuColor(0xffffffff); sceGuColor(0xffffffff);
} }