Fix ICC WMO colours and x64 shadow-query overflow
- Buffer.cpp: PNC2T2 Color0/Color1 are D3DCOLOR (type 0), not FLOAT3; unified-path WMOs (MOHD flag 0x2, e.g. Icecrown Citadel) were drawn blue/green/black (12340 init at 0x9CD010) - CShadowQuery::AllocBuffers: size the group/matrix pointer arrays with sizeof; 0x2000 bytes only fits 0x800 entries with 4-byte pointers - ShaderEffect: upload sun constants with explicit w (the values 12340 reads from the neighbouring statics), independent of x64 layout Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -100,8 +100,8 @@ static CGxVertexAttrib s_vertexAttribsPBNT2[] = {
|
||||
static CGxVertexAttrib s_vertexAttribsPNC2T2[] = {
|
||||
{ GxVA_Position, 4, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Position), 48 },
|
||||
{ GxVA_Normal, 4, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Normal), 48 },
|
||||
{ GxVA_Color0, 4, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Color0), 48 },
|
||||
{ GxVA_Color1, 4, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Color1), 48 },
|
||||
{ GxVA_Color0, 0, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Color0), 48 },
|
||||
{ GxVA_Color1, 0, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_Color1), 48 },
|
||||
{ GxVA_TexCoord0, 3, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_TexCoord0), 48 },
|
||||
{ GxVA_TexCoord1, 3, GxVertexAttribOffset(GxVBF_PNC2T2, GxVA_TexCoord1), 48 }
|
||||
};
|
||||
|
||||
@@ -234,7 +234,13 @@ void CShaderEffect::SetGlobalLighting(CM2Light* light) {
|
||||
sunSpec.z = CShaderEffect::s_sunSpec.z;
|
||||
sunSpec.w = 14.0f;
|
||||
|
||||
GxShaderConstantsSet(GxSh_Vertex, 12, &CShaderEffect::s_sunDir.x, 1);
|
||||
C4Vector sunDirConst;
|
||||
sunDirConst.x = CShaderEffect::s_sunDir.x;
|
||||
sunDirConst.y = CShaderEffect::s_sunDir.y;
|
||||
sunDirConst.z = CShaderEffect::s_sunDir.z;
|
||||
sunDirConst.w = CShaderEffect::s_sunSpec.x;
|
||||
|
||||
GxShaderConstantsSet(GxSh_Vertex, 12, &sunDirConst.x, 1);
|
||||
GxShaderConstantsSet(GxSh_Vertex, 13, &sunSpec.x, 1);
|
||||
}
|
||||
}
|
||||
@@ -561,9 +567,27 @@ void CShaderEffect::SetLocalLighting(CM2Lighting* lighting, int32_t enabled, con
|
||||
CShaderEffect::s_sunDiffuse.y = g >= 1.0f ? 1.0f : g;
|
||||
CShaderEffect::s_sunDiffuse.z = b < 1.0f ? b : 1.0f;
|
||||
|
||||
GxShaderConstantsSet(GxSh_Vertex, 10, &CShaderEffect::s_sunDiffuse.x, 1);
|
||||
GxShaderConstantsSet(GxSh_Vertex, 11, &CShaderEffect::s_sunAmbient.x, 1);
|
||||
GxShaderConstantsSet(GxSh_Vertex, 12, &CShaderEffect::s_sunDir.x, 1);
|
||||
C4Vector sunDiffuse;
|
||||
sunDiffuse.x = CShaderEffect::s_sunDiffuse.x;
|
||||
sunDiffuse.y = CShaderEffect::s_sunDiffuse.y;
|
||||
sunDiffuse.z = CShaderEffect::s_sunDiffuse.z;
|
||||
sunDiffuse.w = CShaderEffect::s_sunAmbient.x;
|
||||
|
||||
C4Vector sunAmbient;
|
||||
sunAmbient.x = CShaderEffect::s_sunAmbient.x;
|
||||
sunAmbient.y = CShaderEffect::s_sunAmbient.y;
|
||||
sunAmbient.z = CShaderEffect::s_sunAmbient.z;
|
||||
sunAmbient.w = CShaderEffect::s_sunDir.x;
|
||||
|
||||
C4Vector sunDir;
|
||||
sunDir.x = CShaderEffect::s_sunDir.x;
|
||||
sunDir.y = CShaderEffect::s_sunDir.y;
|
||||
sunDir.z = CShaderEffect::s_sunDir.z;
|
||||
sunDir.w = CShaderEffect::s_sunSpec.x;
|
||||
|
||||
GxShaderConstantsSet(GxSh_Vertex, 10, &sunDiffuse.x, 1);
|
||||
GxShaderConstantsSet(GxSh_Vertex, 11, &sunAmbient.x, 1);
|
||||
GxShaderConstantsSet(GxSh_Vertex, 12, &sunDir.x, 1);
|
||||
|
||||
if (CShaderEffect::s_localLightCount) {
|
||||
CShaderEffect::ComputeLocalLights(&CShaderEffect::s_localLights, CShaderEffect::s_localLightCount, lighting->m_lights, origin);
|
||||
|
||||
@@ -250,11 +250,11 @@ void CShadowQuery::AllocBuffers() {
|
||||
buffers.m_textured.m_maxCount = 0x2000;
|
||||
|
||||
if (!buffers.m_groups) {
|
||||
buffers.m_groups = SMemAlloc(0x2000, __FILE__, __LINE__, 0);
|
||||
buffers.m_groups = SMemAlloc(0x800 * sizeof(CMapObjGroup*), __FILE__, __LINE__, 0);
|
||||
}
|
||||
|
||||
if (!buffers.m_groupData) {
|
||||
buffers.m_groupData = SMemAlloc(0x2000, __FILE__, __LINE__, 0);
|
||||
buffers.m_groupData = SMemAlloc(0x800 * sizeof(C44Matrix*), __FILE__, __LINE__, 0);
|
||||
}
|
||||
|
||||
if (!buffers.m_untextured.m_batches) {
|
||||
|
||||
Reference in New Issue
Block a user