naomi2: gmp diffuse/specular flags select vertex or model colors only
These flags shouldn't be used to disable diffuse/specular shading Fixes road surface glitches in initdv3e (Usui map)
This commit is contained in:
parent
902fc2cbe8
commit
3b81bbcae5
|
@ -1256,11 +1256,7 @@ static void setStateParams(PolyParam& pp, const ICHList *list)
|
|||
pp.glossCoef[0] = curGmp->gloss.getCoef0();
|
||||
pp.glossCoef[1] = curGmp->gloss.getCoef1();
|
||||
pp.constantColor[0] = curGmp->paramSelect.b0;
|
||||
pp.diffuseColor[0] = curGmp->paramSelect.d0;
|
||||
pp.specularColor[0] = curGmp->paramSelect.s0;
|
||||
pp.constantColor[1] = curGmp->paramSelect.b1;
|
||||
pp.diffuseColor[1] = curGmp->paramSelect.d1;
|
||||
pp.specularColor[1] = curGmp->paramSelect.s1;
|
||||
|
||||
// Environment mapping
|
||||
if (curGmp->paramSelect.e0)
|
||||
|
@ -1297,8 +1293,6 @@ static void setStateParams(PolyParam& pp, const ICHList *list)
|
|||
pp.tcw1.full = -1;
|
||||
pp.glossCoef[1] = 0;
|
||||
pp.constantColor[1] = false;
|
||||
pp.diffuseColor[1] = false;
|
||||
pp.specularColor[1] = false;
|
||||
}
|
||||
// else if (pp.pcw.Volume == 1)
|
||||
// printf("2-Volume poly listType %d vtxtype %x gmp params %x diff tcw %08x tsp %08x\n", ta_get_list_type(), list->flags, curGmp->paramSelect.full,
|
||||
|
|
|
@ -56,8 +56,6 @@ struct PolyParam
|
|||
const N2LightModel *lightModel;
|
||||
bool envMapping[2];
|
||||
bool constantColor[2];
|
||||
bool diffuseColor[2];
|
||||
bool specularColor[2];
|
||||
|
||||
void init()
|
||||
{
|
||||
|
@ -84,10 +82,6 @@ struct PolyParam
|
|||
envMapping[1] = false;
|
||||
constantColor[0] = false;
|
||||
constantColor[1] = false;
|
||||
diffuseColor[0] = false;
|
||||
diffuseColor[1] = false;
|
||||
specularColor[0] = false;
|
||||
specularColor[1] = false;
|
||||
}
|
||||
|
||||
bool equivalentIgnoreCullingDirection(const PolyParam& other) const
|
||||
|
@ -107,12 +101,8 @@ struct PolyParam
|
|||
&& lightModel == other.lightModel
|
||||
&& envMapping[0] == other.envMapping[0]
|
||||
&& constantColor[0] == other.constantColor[0]
|
||||
&& diffuseColor[0] == other.diffuseColor[0]
|
||||
&& specularColor[0] == other.specularColor[0]
|
||||
&& envMapping[1] == other.envMapping[1]
|
||||
&& constantColor[1] == other.constantColor[1]
|
||||
&& diffuseColor[1] == other.diffuseColor[1]
|
||||
&& specularColor[1] == other.specularColor[1];
|
||||
&& constantColor[1] == other.constantColor[1];
|
||||
}
|
||||
|
||||
bool isNaomi2() const { return projMatrix != nullptr; }
|
||||
|
|
|
@ -79,7 +79,6 @@ cbuffer polyConstants : register(b1)
|
|||
|
||||
float4 glossCoef;
|
||||
int4 constantColor;
|
||||
int4 model_diff_spec; // diffuse0, diffuse1, specular0, specular1
|
||||
};
|
||||
|
||||
void computeColors(inout float4 baseCol, inout float4 offsetCol, in int volIdx, in float3 position, in float3 normal);
|
||||
|
@ -306,10 +305,8 @@ void computeColors(inout float4 baseCol, inout float4 offsetCol, in int volIdx,
|
|||
else
|
||||
specular += ambientOffset[volIdx].rgb;
|
||||
|
||||
if (model_diff_spec[volIdx] == 1)
|
||||
baseCol.rgb = diffuse;
|
||||
if (model_diff_spec[volIdx + 2] == 1)
|
||||
offsetCol.rgb = specular;
|
||||
baseCol.rgb = diffuse;
|
||||
offsetCol.rgb = specular;
|
||||
|
||||
baseCol.a += diffuseAlpha;
|
||||
offsetCol.a += specularAlpha;
|
||||
|
@ -393,12 +390,9 @@ struct N2PolyConstants
|
|||
|
||||
float glossCoef[4]; // 208
|
||||
int constantColor[4]; // 224
|
||||
// int4 model_diff_spec
|
||||
int modelDiffuse[2]; // 240
|
||||
int modelSpecular[2]; // 248
|
||||
// 256
|
||||
// 240
|
||||
};
|
||||
static_assert(sizeof(N2PolyConstants) == 256, "sizeof(N2PolyConstants) should be 256");
|
||||
static_assert(sizeof(N2PolyConstants) == 240, "sizeof(N2PolyConstants) should be 240");
|
||||
|
||||
void Naomi2Helper::init(ComPtr<ID3D11Device>& device, ComPtr<ID3D11DeviceContext> deviceContext)
|
||||
{
|
||||
|
@ -433,8 +427,6 @@ void Naomi2Helper::setConstants(const PolyParam& pp, u32 polyNumber)
|
|||
{
|
||||
polyConstants.glossCoef[i] = pp.glossCoef[i];
|
||||
polyConstants.constantColor[i] = pp.constantColor[i];
|
||||
polyConstants.modelDiffuse[i] = pp.diffuseColor[i];
|
||||
polyConstants.modelSpecular[i] = pp.specularColor[i];
|
||||
}
|
||||
setConstBuffer(polyConstantsBuffer, polyConstants);
|
||||
deviceContext->VSSetConstantBuffers(1, 1, &polyConstantsBuffer.get());
|
||||
|
|
|
@ -54,8 +54,6 @@ struct gl4PipelineShader
|
|||
GLint envMapping[2];
|
||||
GLint bumpMapping;
|
||||
GLint constantColor[2];
|
||||
GLint modelDiffuse[2];
|
||||
GLint modelSpecular[2];
|
||||
|
||||
GLint lightCount;
|
||||
GLint ambientBase[2];
|
||||
|
|
|
@ -64,8 +64,6 @@ struct PipelineShader
|
|||
GLint envMapping[2];
|
||||
GLint bumpMapping;
|
||||
GLint constantColor[2];
|
||||
GLint modelDiffuse[2];
|
||||
GLint modelSpecular[2];
|
||||
|
||||
GLint lightCount;
|
||||
GLint ambientBase[2];
|
||||
|
|
|
@ -183,8 +183,6 @@ uniform int bumpId1;
|
|||
// model attributes
|
||||
uniform float glossCoef[2];
|
||||
uniform int constantColor[2];
|
||||
uniform int modelDiffuse[2];
|
||||
uniform int modelSpecular[2];
|
||||
|
||||
void computeColors(inout vec4 baseCol, inout vec4 offsetCol, int volIdx, vec3 position, vec3 normal)
|
||||
{
|
||||
|
@ -269,10 +267,8 @@ void computeColors(inout vec4 baseCol, inout vec4 offsetCol, int volIdx, vec3 po
|
|||
else
|
||||
specular += ambientOffset[volIdx].rgb;
|
||||
|
||||
if (modelDiffuse[volIdx] == 1)
|
||||
baseCol.rgb = diffuse;
|
||||
if (modelSpecular[volIdx] == 1)
|
||||
offsetCol.rgb = specular;
|
||||
baseCol.rgb = diffuse;
|
||||
offsetCol.rgb = specular;
|
||||
|
||||
baseCol.a += diffuseAlpha;
|
||||
offsetCol.a += specularAlpha;
|
||||
|
|
|
@ -46,10 +46,6 @@ void initN2Uniforms(ShaderType *shader)
|
|||
shader->bumpMapping = glGetUniformLocation(shader->program, "bumpMapping");
|
||||
shader->constantColor[0] = glGetUniformLocation(shader->program, "constantColor[0]");
|
||||
shader->constantColor[1] = glGetUniformLocation(shader->program, "constantColor[1]");
|
||||
shader->modelDiffuse[0] = glGetUniformLocation(shader->program, "modelDiffuse[0]");
|
||||
shader->modelDiffuse[1] = glGetUniformLocation(shader->program, "modelDiffuse[1]");
|
||||
shader->modelSpecular[0] = glGetUniformLocation(shader->program, "modelSpecular[0]");
|
||||
shader->modelSpecular[1] = glGetUniformLocation(shader->program, "modelSpecular[1]");
|
||||
|
||||
// Lights
|
||||
shader->lightCount = glGetUniformLocation(shader->program, "lightCount");
|
||||
|
@ -126,8 +122,6 @@ void setN2Uniforms(const PolyParam *pp, ShaderType *shader)
|
|||
glUniform1f(shader->glossCoef[i], pp->glossCoef[i]);
|
||||
glUniform1i(shader->envMapping[i], (int)pp->envMapping[i]);
|
||||
glUniform1i(shader->constantColor[i], (int)pp->constantColor[i]);
|
||||
glUniform1i(shader->modelDiffuse[i], (int)pp->diffuseColor[i]);
|
||||
glUniform1i(shader->modelSpecular[i], (int)pp->specularColor[i]);
|
||||
}
|
||||
|
||||
const N2LightModel *const lightModel = pp->lightModel;
|
||||
|
|
|
@ -95,8 +95,6 @@ protected:
|
|||
uni.envMapping[i] = pp.envMapping[i];
|
||||
uni.glossCoef[i] = pp.glossCoef[i];
|
||||
uni.constantColor[i] = pp.constantColor[i];
|
||||
uni.modelDiffuse[i] = pp.diffuseColor[i];
|
||||
uni.modelSpecular[i] = pp.specularColor[i];
|
||||
}
|
||||
}
|
||||
bufIdx += n2UniformSize;
|
||||
|
|
|
@ -338,8 +338,6 @@ layout (std140, set = 1, binding = 2) uniform N2VertexShaderUniforms
|
|||
|
||||
vec2 glossCoef;
|
||||
ivec2 constantColor;
|
||||
ivec2 modelDiffuse;
|
||||
ivec2 modelSpecular;
|
||||
} n2Uniform;
|
||||
|
||||
#define PI 3.1415926
|
||||
|
@ -478,10 +476,8 @@ void computeColors(inout vec4 baseCol, inout vec4 offsetCol, in int volIdx, in v
|
|||
specular += n2Lights.ambientOffset[volIdx].rgb * offsetCol.rgb;
|
||||
else
|
||||
specular += n2Lights.ambientOffset[volIdx].rgb;
|
||||
if (n2Uniform.modelDiffuse[volIdx] == 1)
|
||||
baseCol.rgb = diffuse;
|
||||
if (n2Uniform.modelSpecular[volIdx] == 1)
|
||||
offsetCol.rgb = specular;
|
||||
baseCol.rgb = diffuse;
|
||||
offsetCol.rgb = specular;
|
||||
|
||||
baseCol.a += diffuseAlpha;
|
||||
offsetCol.a += specularAlpha;
|
||||
|
@ -634,8 +630,6 @@ layout (std140, set = 1, binding = 2) uniform N2VertexShaderUniforms
|
|||
|
||||
vec2 glossCoef;
|
||||
ivec2 constantColor;
|
||||
ivec2 modelDiffuse;
|
||||
ivec2 modelSpecular;
|
||||
} n2Uniform;
|
||||
|
||||
layout (location = 0) in vec4 in_pos;
|
||||
|
|
|
@ -89,8 +89,6 @@ struct N2VertexShaderUniforms
|
|||
|
||||
float glossCoef[2];
|
||||
int constantColor[2];
|
||||
int modelDiffuse[2];
|
||||
int modelSpecular[2];
|
||||
};
|
||||
|
||||
class ShaderManager
|
||||
|
|
Loading…
Reference in New Issue