Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
581 lines
21 KiB
C++
581 lines
21 KiB
C++
//#if !defined(MLR_GOSVERTEXMANIPULATION_HPP)
|
|
|
|
#define FCR_TRICK 0
|
|
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
#define VERTEX_STRUCT_SIZE 0x30 // (sizeof(GOSVertex3UV))
|
|
#define VERTEX_STRUCT_SIZEx2 0x60 // (sizeof(GOSVertex3UV))
|
|
#else // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#define VERTEX_STRUCT_SIZE 0x28 // (sizeof(GOSVertex2UV))
|
|
#define VERTEX_STRUCT_SIZEx2 0x50 // (sizeof(GOSVertex2UV))
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else
|
|
#define VERTEX_STRUCT_SIZE 0x20 // (sizeof(GOSVertex))
|
|
#define VERTEX_STRUCT_SIZEx2 0x40 //(sizeof(GOSVertex))
|
|
#endif
|
|
|
|
// copies vertex data into rasterizer format
|
|
inline bool
|
|
GOSCopyData
|
|
(
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
GOSVertex3UV *gos_vertices,
|
|
#else // I_SAY_YES_TO_BUMP_TEXTURE
|
|
GOSVertex2UV *gos_vertices,
|
|
#endif
|
|
#else
|
|
GOSVertex *gos_vertices,
|
|
#endif
|
|
const Stuff::Vector4D *coords,
|
|
#ifdef I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_DWORD_COLOR
|
|
const DWORD *colors,
|
|
#else // I_SAY_YES_TO_DWORD_COLOR
|
|
const Stuff::RGBAColor *colors,
|
|
#endif // I_SAY_YES_TO_DWORD_COLOR
|
|
#endif // I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
const Vector2DScalar *texCoords1,
|
|
const Vector2DScalar *texCoords2,
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
const Vector2DScalar *texCoords3,
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else
|
|
const Vector2DScalar *texCoords,
|
|
#endif
|
|
#endif
|
|
int _offset
|
|
#if FOG_HACK
|
|
, int foggy = 1
|
|
#endif // FOG_HACK
|
|
)
|
|
{
|
|
Verify(gos_vertices != NULL);
|
|
Verify(coords != NULL);
|
|
|
|
Verify(coords[_offset].w > Stuff::SMALL);
|
|
|
|
Verify(coords[_offset].x >= 0.0f);
|
|
Verify(coords[_offset].y >= 0.0f);
|
|
Verify(coords[_offset].z >= 0.0f);
|
|
|
|
Verify(coords[_offset].x <= coords[_offset].w);
|
|
Verify(coords[_offset].y <= coords[_offset].w);
|
|
|
|
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
Verify(texCoords1 != NULL);
|
|
Verify(texCoords2 != NULL);
|
|
|
|
#ifdef UV_CHECK
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[_offset][0]<MLRState::GetMaxUV() && texCoords1[_offset][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[_offset][1]<MLRState::GetMaxUV() && texCoords1[_offset][1]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[_offset][0]<MLRState::GetMaxUV() && texCoords2[_offset][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[_offset][1]<MLRState::GetMaxUV() && texCoords2[_offset][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#endif // UV_CHECK
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
Verify(texCoords3 != NULL);
|
|
|
|
#ifdef UV_CHECK
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[_offset][0]<MLRState::GetMaxUV() && texCoords3[_offset][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[_offset][1]<MLRState::GetMaxUV() && texCoords3[_offset][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#endif // UV_CHECK
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
Verify(texCoords != NULL);
|
|
|
|
#ifdef UV_CHECK
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[_offset][0]<MLRState::GetMaxUV() && texCoords[_offset][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[_offset][1]<MLRState::GetMaxUV() && texCoords[_offset][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#endif // UV_CHECK
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#endif // I_SAY_YES_TO_TEXTURE
|
|
|
|
#if FCR_TRICK
|
|
Verify(coords[_offset].z*GOSVertex::farClipReciprocal < 1.0f);
|
|
float fcr = GOSVertex::farClipReciprocal;
|
|
#else // FCR_TRICK
|
|
Verify(coords[_offset].z < coords[_offset].w);
|
|
#endif // FCR_TRICK
|
|
|
|
|
|
#if USE_ASSEMBLER_CODE
|
|
_asm {
|
|
; gos_vertices[0].w = 1.0f/coords[offset].w;
|
|
|
|
mov ecx,dword ptr [coords]
|
|
fld1
|
|
|
|
mov edi, _offset
|
|
mov eax,edi
|
|
shl eax,4
|
|
fdiv dword ptr [eax+ecx+0Ch]
|
|
add eax,ecx
|
|
mov edx,dword ptr [gos_vertices]
|
|
fst dword ptr [edx+0Ch]
|
|
|
|
; gos_vertices[0].x = coords[offset].x * gos_vertices[0].w;
|
|
fld st(0)
|
|
fmul dword ptr [eax]
|
|
fstp dword ptr [edx]
|
|
; gos_vertices[0].y = coords[offset].y * gos_vertices[0].w;
|
|
fld dword ptr [eax+4]
|
|
fmul st,st(1)
|
|
fstp dword ptr [edx+4]
|
|
; gos_vertices[0].z = coords[offset].z * gos_vertices[0].w;
|
|
|
|
#if FCR_TRICK
|
|
fld dword ptr [eax+8]
|
|
fmul fcr
|
|
|
|
fstp dword ptr [edx+8]
|
|
fstp st(0)
|
|
#else // FCR_TRICK
|
|
; fld dword ptr [eax+8]
|
|
|
|
fmul dword ptr [eax+8]
|
|
|
|
fstp dword ptr [edx+8]
|
|
; fstp st(0)
|
|
#endif // FCR_TRICK
|
|
}
|
|
|
|
#else // USE_ASSEMBLER_CODE
|
|
gos_vertices[0].rhw = 1.0f/coords[_offset].w;
|
|
|
|
gos_vertices[0].x = coords[_offset].x * gos_vertices[0].w;
|
|
gos_vertices[0].y = coords[_offset].y * gos_vertices[0].w;
|
|
#if FCR_TRICK
|
|
gos_vertices[0].z = coords[_offset].z * fcr;
|
|
#else // FCR_TRICK
|
|
gos_vertices[0].z = coords[_offset].z * gos_vertices[0].rhw;
|
|
#endif // FCR_TRICK
|
|
#endif // USE_ASSEMBLER_CODE
|
|
|
|
gos_vertices[0].x = gos_vertices[0].x*ViewportScalars::MulX + ViewportScalars::AddX;
|
|
gos_vertices[0].y = gos_vertices[0].y*ViewportScalars::MulY + ViewportScalars::AddY;
|
|
|
|
#ifdef I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_DWORD_COLOR
|
|
gos_vertices[0].argb = colors!=NULL ? colors[_offset] : paintMeColorDW;
|
|
#else // I_SAY_YES_TO_DWORD_COLOR
|
|
gos_vertices[0].argb = GOSCopyColor(colors!=NULL ? (&colors[_offset]) : (&paintMeColorF) );
|
|
#endif // I_SAY_YES_TO_DWORD_COLOR
|
|
#else // I_SAY_YES_TO_COLOR
|
|
gos_vertices[0].argb = paintMeColorDW;
|
|
#endif // I_SAY_YES_TO_COLOR
|
|
|
|
#if FOG_HACK
|
|
if(foggy>0)
|
|
{
|
|
*((BYTE *)&gos_vertices[0].frgb + 3) = GOSVertex::fogTable[foggy-1][Stuff::Truncate_Float_To_Word(coords[_offset].w)];
|
|
}
|
|
else
|
|
{
|
|
*((BYTE *)&gos_vertices[0].frgb + 3) = 0xff;
|
|
}
|
|
#endif // FOG_HACK
|
|
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u1 = texCoords1[_offset][0];
|
|
gos_vertices[0].v1 = texCoords1[_offset][1];
|
|
gos_vertices[0].u2 = texCoords2[_offset][0];
|
|
gos_vertices[0].v2 = texCoords2[_offset][1];
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
gos_vertices[0].u3 = texCoords3[_offset][0];
|
|
gos_vertices[0].v3 = texCoords3[_offset][1];
|
|
#endif
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u = texCoords[_offset][0];
|
|
gos_vertices[0].v = texCoords[_offset][1];
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#else // I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u1 = 0.0f;
|
|
gos_vertices[0].v1 = 0.0f;
|
|
gos_vertices[0].u2 = 0.0f;
|
|
gos_vertices[0].v2 = 0.0f;
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u = 0.0f;
|
|
gos_vertices[0].v = 0.0f;
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#endif // I_SAY_YES_TO_TEXTURE
|
|
|
|
#if FCR_TRICK
|
|
fcr = fcr;
|
|
#endif // FCR_TRICK
|
|
|
|
return true;
|
|
}
|
|
|
|
// copies 3 vertex data into rasterizer format
|
|
inline bool
|
|
GOSCopyTriangleData
|
|
(
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
GOSVertex3UV *gos_vertices,
|
|
#else // I_SAY_YES_TO_BUMP_TEXTURE
|
|
GOSVertex2UV *gos_vertices,
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
GOSVertex *gos_vertices,
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
const Stuff::Vector4D *coords,
|
|
#ifdef I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_DWORD_COLOR
|
|
const DWORD *colors,
|
|
#else // I_SAY_YES_TO_DWORD_COLOR
|
|
const Stuff::RGBAColor *colors,
|
|
#endif // I_SAY_YES_TO_DWORD_COLOR
|
|
#endif // I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
const Vector2DScalar *texCoords1,
|
|
const Vector2DScalar *texCoords2,
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
const Vector2DScalar *texCoords3,
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
const Vector2DScalar *texCoords,
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#endif // I_SAY_YES_TO_TEXTURE
|
|
int offset0, int offset1, int offset2
|
|
#if FOG_HACK
|
|
, int foggy = 1
|
|
#endif // FOG_HACK
|
|
)
|
|
{
|
|
Verify(gos_vertices != NULL);
|
|
Verify(coords != NULL);
|
|
#ifdef I_SAY_YES_TO_COLOR
|
|
Verify(colors != NULL);
|
|
#endif // I_SAY_YES_TO_COLOR
|
|
|
|
Verify(coords[offset0].x >= 0.0f);
|
|
Verify(coords[offset0].y >= 0.0f);
|
|
Verify(coords[offset0].z >= 0.0f);
|
|
|
|
Verify(coords[offset0].x <= coords[offset0].w);
|
|
Verify(coords[offset0].y <= coords[offset0].w);
|
|
|
|
Verify(coords[offset1].x >= 0.0f);
|
|
Verify(coords[offset1].y >= 0.0f);
|
|
Verify(coords[offset1].z >= 0.0f);
|
|
|
|
Verify(coords[offset1].x <= coords[offset1].w);
|
|
Verify(coords[offset1].y <= coords[offset1].w);
|
|
|
|
Verify(coords[offset2].x >= 0.0f);
|
|
Verify(coords[offset2].y >= 0.0f);
|
|
Verify(coords[offset2].z >= 0.0f);
|
|
|
|
Verify(coords[offset2].x <= coords[offset2].w);
|
|
Verify(coords[offset2].y <= coords[offset2].w);
|
|
#if FCR_TRICK
|
|
Verify(coords[offset0].z*GOSVertex::farClipReciprocal < 1.0f);
|
|
Verify(coords[offset1].z*GOSVertex::farClipReciprocal < 1.0f);
|
|
Verify(coords[offset2].z*GOSVertex::farClipReciprocal < 1.0f);
|
|
float fcr = GOSVertex::farClipReciprocal;
|
|
#else // FCR_TRICK
|
|
Verify(coords[offset0].z < coords[offset0].w);
|
|
Verify(coords[offset1].z < coords[offset1].w);
|
|
Verify(coords[offset2].z < coords[offset2].w);
|
|
#endif // FCR_TRICK
|
|
|
|
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
Verify(texCoords1 != NULL);
|
|
Verify(texCoords2 != NULL);
|
|
|
|
#ifdef UV_CHECK
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset0][0]<MLRState::GetMaxUV() && texCoords1[offset0][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset0][1]<MLRState::GetMaxUV() && texCoords1[offset0][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset1][0]<MLRState::GetMaxUV() && texCoords1[offset1][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset1][1]<MLRState::GetMaxUV() && texCoords1[offset1][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset2][0]<MLRState::GetMaxUV() && texCoords1[offset2][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords1[offset2][1]<MLRState::GetMaxUV() && texCoords1[offset2][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset0][0]<MLRState::GetMaxUV() && texCoords2[offset0][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset0][1]<MLRState::GetMaxUV() && texCoords2[offset0][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset1][0]<MLRState::GetMaxUV() && texCoords2[offset1][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset1][1]<MLRState::GetMaxUV() && texCoords2[offset1][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset2][0]<MLRState::GetMaxUV() && texCoords2[offset2][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords2[offset2][1]<MLRState::GetMaxUV() && texCoords2[offset2][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset0][0]<MLRState::GetMaxUV() && texCoords3[offset0][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset0][1]<MLRState::GetMaxUV() && texCoords3[offset0][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset1][0]<MLRState::GetMaxUV() && texCoords3[offset1][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset1][1]<MLRState::GetMaxUV() && texCoords3[offset1][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset2][0]<MLRState::GetMaxUV() && texCoords3[offset2][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords3[offset2][1]<MLRState::GetMaxUV() && texCoords3[offset2][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#endif // UV_CHECK
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
Verify(texCoords != NULL);
|
|
|
|
#ifdef UV_CHECK
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset0][0]<MLRState::GetMaxUV() && texCoords[offset0][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset0][1]<MLRState::GetMaxUV() && texCoords[offset0][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset1][0]<MLRState::GetMaxUV() && texCoords[offset1][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset1][1]<MLRState::GetMaxUV() && texCoords[offset1][1]>-MLRState::GetMaxUV()) : 1 );
|
|
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset2][0]<MLRState::GetMaxUV() && texCoords[offset2][0]>-MLRState::GetMaxUV()) : 1 );
|
|
Verify( MLRState::GetHasMaxUVs() ? (texCoords[offset2][1]<MLRState::GetMaxUV() && texCoords[offset2][1]>-MLRState::GetMaxUV()) : 1 );
|
|
#endif // UV_CHECK
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#endif // I_SAY_YES_TO_TEXTURE
|
|
|
|
#if USE_ASSEMBLER_CODE
|
|
|
|
_asm {
|
|
; gos_vertices[0].w = 1.0f/coords[offset0].w;
|
|
|
|
mov ecx,dword ptr [coords]
|
|
fld1
|
|
|
|
mov edi,dword ptr [offset0]
|
|
mov eax,edi
|
|
shl eax,4
|
|
fdiv dword ptr [eax+ecx+0Ch]
|
|
add eax,ecx
|
|
mov edx,dword ptr [gos_vertices]
|
|
fst dword ptr [edx+0Ch]
|
|
|
|
; gos_vertices[0].x = coords[offset0].x * gos_vertices[0].w;
|
|
fld st(0)
|
|
fmul dword ptr [eax]
|
|
fstp dword ptr [edx]
|
|
; gos_vertices[0].y = coords[offset0].y * gos_vertices[0].w;
|
|
fld dword ptr [eax+4]
|
|
fmul st,st(1)
|
|
fstp dword ptr [edx+4]
|
|
|
|
; gos_vertices[0].z = coords[offset0].z * gos_vertices[0].w;
|
|
fld dword ptr [eax+8]
|
|
|
|
; gos_vertices[1].w = 1.0f/coords[offset1].w;
|
|
mov eax,dword ptr [offset1]
|
|
#if FCR_TRICK
|
|
fmul fcr
|
|
shl eax,4
|
|
#else // FCR_TRICK
|
|
fmul st,st(1)
|
|
shl eax,4
|
|
#endif // FCR_TRICK
|
|
add eax,ecx
|
|
fstp dword ptr [edx+8]
|
|
fstp st(0)
|
|
|
|
fld1
|
|
fdiv dword ptr [eax+0Ch]
|
|
fst dword ptr [edx + VERTEX_STRUCT_SIZE + 0Ch]
|
|
|
|
|
|
; gos_vertices[1].x = coords[offset1].x * gos_vertices[1].w;
|
|
fld st(0)
|
|
fmul dword ptr [eax]
|
|
fstp dword ptr [edx+VERTEX_STRUCT_SIZE]
|
|
; gos_vertices[1].y = coords[offset1].y * gos_vertices[1].w;
|
|
fld dword ptr [eax+4]
|
|
fmul st,st(1)
|
|
fstp dword ptr [edx+VERTEX_STRUCT_SIZE+4h]
|
|
; gos_vertices[1].z = coords[offset1].z * gos_vertices[1].w;
|
|
fld dword ptr [eax+8]
|
|
|
|
; gos_vertices[2].w = 1.0f/coords[offset2].w;
|
|
mov eax,dword ptr [offset2]
|
|
|
|
#if FCR_TRICK
|
|
fmul fcr
|
|
shl eax,4
|
|
#else // FCR_TRICK
|
|
fmul st,st(1)
|
|
shl eax,4
|
|
#endif // FCR_TRICK
|
|
|
|
add eax,ecx
|
|
fstp dword ptr [edx+VERTEX_STRUCT_SIZE+8h]
|
|
fstp st(0)
|
|
fld1
|
|
fdiv dword ptr [eax+0Ch]
|
|
fst dword ptr [edx + VERTEX_STRUCT_SIZEx2 + 0Ch]
|
|
|
|
; gos_vertices[2].x = coords[offset2].x * gos_vertices[2].w;
|
|
fld st(0)
|
|
fmul dword ptr [eax]
|
|
fstp dword ptr [edx + VERTEX_STRUCT_SIZEx2]
|
|
; gos_vertices[2].y = coords[offset2].y * gos_vertices[2].w;
|
|
fld dword ptr [eax+4]
|
|
fmul st,st(1)
|
|
fstp dword ptr [edx + VERTEX_STRUCT_SIZEx2 + 4h]
|
|
; gos_vertices[2].z = coords[offset2].z * gos_vertices[2].w;
|
|
fld dword ptr [eax+8]
|
|
#if FCR_TRICK
|
|
fmul fcr
|
|
#else // FCR_TRICK
|
|
fmul st,st(1)
|
|
#endif // FCR_TRICK
|
|
fstp dword ptr [edx + VERTEX_STRUCT_SIZEx2 + 8h]
|
|
fstp st(0)
|
|
}
|
|
|
|
#else // USE_ASSEMBLER_CODE
|
|
gos_vertices[0].w = 1.0f/coords[offset0].w;
|
|
|
|
gos_vertices[0].x = coords[offset0].x * gos_vertices[0].w;
|
|
gos_vertices[0].y = coords[offset0].y * gos_vertices[0].w;
|
|
#if FCR_TRICK
|
|
gos_vertices[0].z = coords[_offset].z * fcr;
|
|
#else // FCR_TRICK
|
|
gos_vertices[0].z = coords[_offset].z * gos_vertices[0].w;
|
|
#endif // FCR_TRICK
|
|
|
|
gos_vertices[1].w = 1.0f/coords[offset1].w;
|
|
|
|
|
|
gos_vertices[1].x = coords[offset1].x * gos_vertices[1].w;
|
|
gos_vertices[1].y = coords[offset1].y * gos_vertices[1].w;
|
|
#if FCR_TRICK
|
|
gos_vertices[1].z = coords[_offset].z * fcr;
|
|
#else // FCR_TRICK
|
|
gos_vertices[1].z = coords[_offset].z * gos_vertices[1].w;
|
|
#endif // FCR_TRICK
|
|
|
|
gos_vertices[2].w = 1.0f/coords[offset2].w;
|
|
|
|
gos_vertices[2].x = coords[offset2].x * gos_vertices[2].w;
|
|
gos_vertices[2].y = coords[offset2].y * gos_vertices[2].w;
|
|
#if FCR_TRICK
|
|
gos_vertices[2].z = coords[_offset].z * fcr;
|
|
#else // FCR_TRICK
|
|
gos_vertices[2].z = coords[_offset].z * gos_vertices[2].w;
|
|
#endif // FCR_TRICK
|
|
#endif // USE_ASSEMBLER_CODE
|
|
|
|
gos_vertices[0].x = gos_vertices[0].x*ViewportScalars::MulX + ViewportScalars::AddX;
|
|
gos_vertices[0].y = gos_vertices[0].y*ViewportScalars::MulY + ViewportScalars::AddY;
|
|
|
|
gos_vertices[1].x = gos_vertices[1].x*ViewportScalars::MulX + ViewportScalars::AddX;
|
|
gos_vertices[1].y = gos_vertices[1].y*ViewportScalars::MulY + ViewportScalars::AddY;
|
|
|
|
gos_vertices[2].x = gos_vertices[2].x*ViewportScalars::MulX + ViewportScalars::AddX;
|
|
gos_vertices[2].y = gos_vertices[2].y*ViewportScalars::MulY + ViewportScalars::AddY;
|
|
|
|
// gos_vertices[0] = colors[offset0];
|
|
// gos_vertices[1] = colors[offset1];
|
|
// gos_vertices[2] = colors[offset2];
|
|
|
|
#ifdef I_SAY_YES_TO_COLOR
|
|
#ifdef I_SAY_YES_TO_DWORD_COLOR
|
|
gos_vertices[0].argb = colors[offset0];
|
|
gos_vertices[1].argb = colors[offset1];
|
|
gos_vertices[2].argb = colors[offset2];
|
|
#else // I_SAY_YES_TO_DWORD_COLOR
|
|
gos_vertices[0].argb = GOSCopyColor(&colors[offset0]);
|
|
gos_vertices[1].argb = GOSCopyColor(&colors[offset1]);
|
|
gos_vertices[2].argb = GOSCopyColor(&colors[offset2]);
|
|
#endif // I_SAY_YES_TO_DWORD_COLOR
|
|
#else
|
|
gos_vertices[0].argb = paintMeColorDW;
|
|
gos_vertices[1].argb = paintMeColorDW;
|
|
gos_vertices[2].argb = paintMeColorDW;
|
|
#endif // I_SAY_YES_TO_COLOR
|
|
|
|
#if FOG_HACK
|
|
if(foggy > 0)
|
|
{
|
|
foggy--;
|
|
*((BYTE *)&gos_vertices[0].frgb + 3) = GOSVertex::fogTable[foggy][Stuff::Truncate_Float_To_Word(coords[offset0].w)];
|
|
*((BYTE *)&gos_vertices[1].frgb + 3) = GOSVertex::fogTable[foggy][Stuff::Truncate_Float_To_Word(coords[offset1].w)];
|
|
*((BYTE *)&gos_vertices[2].frgb + 3) = GOSVertex::fogTable[foggy][Stuff::Truncate_Float_To_Word(coords[offset2].w)];
|
|
}
|
|
else
|
|
{
|
|
*((BYTE *)&gos_vertices[0].frgb + 3) = 0xff;
|
|
*((BYTE *)&gos_vertices[1].frgb + 3) = 0xff;
|
|
*((BYTE *)&gos_vertices[2].frgb + 3) = 0xff;
|
|
}
|
|
#endif // FOG_HACK
|
|
|
|
#ifdef I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u1 = texCoords1[offset0][0];
|
|
gos_vertices[0].v1 = texCoords1[offset0][1];
|
|
gos_vertices[1].u1 = texCoords1[offset1][0];
|
|
gos_vertices[1].v1 = texCoords1[offset1][1];
|
|
gos_vertices[2].u1 = texCoords1[offset2][0];
|
|
gos_vertices[2].v1 = texCoords1[offset2][1];
|
|
|
|
gos_vertices[0].u2 = texCoords2[offset0][0];
|
|
gos_vertices[0].v2 = texCoords2[offset0][1];
|
|
gos_vertices[1].u2 = texCoords2[offset1][0];
|
|
gos_vertices[1].v2 = texCoords2[offset1][1];
|
|
gos_vertices[2].u2 = texCoords2[offset2][0];
|
|
gos_vertices[2].v2 = texCoords2[offset2][1];
|
|
|
|
#ifdef I_SAY_YES_TO_BUMP_TEXTURE
|
|
gos_vertices[0].u3 = texCoords3[offset0][0];
|
|
gos_vertices[0].v3 = texCoords3[offset0][1];
|
|
gos_vertices[1].u3 = texCoords3[offset1][0];
|
|
gos_vertices[1].v3 = texCoords3[offset1][1];
|
|
gos_vertices[2].u3 = texCoords3[offset2][0];
|
|
gos_vertices[2].v3 = texCoords3[offset2][1];
|
|
#endif // I_SAY_YES_TO_BUMP_TEXTURE
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u = texCoords[offset0][0];
|
|
gos_vertices[0].v = texCoords[offset0][1];
|
|
gos_vertices[1].u = texCoords[offset1][0];
|
|
gos_vertices[1].v = texCoords[offset1][1];
|
|
gos_vertices[2].u = texCoords[offset2][0];
|
|
gos_vertices[2].v = texCoords[offset2][1];
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#else // I_SAY_YES_TO_TEXTURE
|
|
#ifdef I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices1[0].u = 0.0f;
|
|
gos_vertices1[0].v = 0.0f;
|
|
gos_vertices1[1].u = 0.0f;
|
|
gos_vertices1[1].v = 0.0f;
|
|
gos_vertices1[2].u = 0.0f;
|
|
gos_vertices1[2].v = 0.0f;
|
|
|
|
gos_vertices2[0].u = 0.0f;
|
|
gos_vertices2[0].v = 0.0f;
|
|
gos_vertices2[1].u = 0.0f;
|
|
gos_vertices2[1].v = 0.0f;
|
|
gos_vertices2[2].u = 0.0f;
|
|
gos_vertices2[2].v = 0.0f;
|
|
#else // I_SAY_YES_TO_MULTI_TEXTURE
|
|
gos_vertices[0].u = 0.0f;
|
|
gos_vertices[0].v = 0.0f;
|
|
gos_vertices[1].u = 0.0f;
|
|
gos_vertices[1].v = 0.0f;
|
|
gos_vertices[2].u = 0.0f;
|
|
gos_vertices[2].v = 0.0f;
|
|
#endif // I_SAY_YES_TO_MULTI_TEXTURE
|
|
#endif // I_SAY_YES_TO_TEXTURE
|
|
|
|
#if FCR_TRICK
|
|
fcr = fcr;
|
|
#endif
|
|
|
|
return true;
|
|
}
|
|
|
|
#undef VERTEX_STRUCT_SIZE
|
|
#undef VERTEX_STRUCT_SIZEx2
|
|
//#endif
|