mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-06 06:25:54 +00:00
little cleanup of vehicle rendering
This commit is contained in:
parent
9b2037419f
commit
55320a03f1
|
@ -669,7 +669,7 @@ extern bool gbRenderWorld2;
|
||||||
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
|
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
|
||||||
1, CustomPipes::VEHICLEPIPE_PS2, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames);
|
1, CustomPipes::VEHICLEPIPE_PS2, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames);
|
||||||
DebugMenuEntrySetWrap(e, true);
|
DebugMenuEntrySetWrap(e, true);
|
||||||
DebugMenuAddVarBool8("Render", "Chrome cheat", &CustomPipes::bChromeCheat, nil);
|
DebugMenuAddVarBool8("Render", "Glass Cars cheat", &CustomPipes::gGlassCarsCheat, nil);
|
||||||
extern bool gbRenderDebugEnvMap;
|
extern bool gbRenderDebugEnvMap;
|
||||||
DebugMenuAddVarBool8("Render", "Show Env map", &gbRenderDebugEnvMap, nil);
|
DebugMenuAddVarBool8("Render", "Show Env map", &gbRenderDebugEnvMap, nil);
|
||||||
// DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
|
// DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
|
||||||
|
|
|
@ -46,7 +46,7 @@ CustomMatCopy(void *dst, void *src, int32, int32)
|
||||||
|
|
||||||
rw::TexDictionary *neoTxd;
|
rw::TexDictionary *neoTxd;
|
||||||
|
|
||||||
bool bChromeCheat;
|
bool gGlassCarsCheat;
|
||||||
bool bRenderingEnvMap;
|
bool bRenderingEnvMap;
|
||||||
int32 EnvMapSize = 512;
|
int32 EnvMapSize = 512;
|
||||||
rw::Camera *EnvMapCam;
|
rw::Camera *EnvMapCam;
|
||||||
|
|
|
@ -75,7 +75,7 @@ void CustomPipeInit(void);
|
||||||
void CustomPipeShutdown(void);
|
void CustomPipeShutdown(void);
|
||||||
void SetTxdFindCallback(void);
|
void SetTxdFindCallback(void);
|
||||||
|
|
||||||
extern bool bChromeCheat;
|
extern bool gGlassCarsCheat;
|
||||||
extern bool bRenderingEnvMap;
|
extern bool bRenderingEnvMap;
|
||||||
extern int32 EnvMapSize;
|
extern int32 EnvMapSize;
|
||||||
extern rw::Camera *EnvMapCam;
|
extern rw::Camera *EnvMapCam;
|
||||||
|
|
|
@ -114,7 +114,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
uploadMatrices(atomic->getFrame()->getLTM());
|
uploadMatrices(atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
setVertexShader(leedsVehicle_VS);
|
setVertexShader(leedsVehicle_VS);
|
||||||
if(bChromeCheat)
|
if(gGlassCarsCheat)
|
||||||
setPixelShader(leedsVehicle_blend_PS);
|
setPixelShader(leedsVehicle_blend_PS);
|
||||||
else
|
else
|
||||||
setPixelShader(leedsVehicle_add_PS);
|
setPixelShader(leedsVehicle_add_PS);
|
||||||
|
@ -131,10 +131,11 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||||
|
|
||||||
float coef = 0.0f;
|
float coef = 0.0f;
|
||||||
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP)
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
if(bChromeCheat && coef > 0.0f)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
|
}
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps);
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
@ -205,7 +206,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *he
|
||||||
float coef = 0.0f;
|
float coef = 0.0f;
|
||||||
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
if(bChromeCheat)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
}
|
}
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
||||||
|
|
|
@ -122,7 +122,7 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
|
||||||
if(bChromeCheat)
|
if(gGlassCarsCheat)
|
||||||
leedsVehicleShader_blend->use();
|
leedsVehicleShader_blend->use();
|
||||||
else
|
else
|
||||||
leedsVehicleShader_add->use();
|
leedsVehicleShader_add->use();
|
||||||
|
@ -138,10 +138,11 @@ leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||||
|
|
||||||
float coef = 0.0f;
|
float coef = 0.0f;
|
||||||
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP)
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
if(bChromeCheat && coef > 0.0f)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
|
}
|
||||||
glUniform1f(U(u_fxparams), coef);
|
glUniform1f(U(u_fxparams), coef);
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps);
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
@ -216,7 +217,7 @@ leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *hea
|
||||||
float coef = 0.0f;
|
float coef = 0.0f;
|
||||||
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
if(bChromeCheat)
|
if(gGlassCarsCheat)
|
||||||
coef = 1.0f;
|
coef = 1.0f;
|
||||||
}
|
}
|
||||||
glUniform1f(U(u_fxparams), coef);
|
glUniform1f(U(u_fxparams), coef);
|
||||||
|
|
|
@ -26,11 +26,9 @@ main(void)
|
||||||
|
|
||||||
v_color = in_color;
|
v_color = in_color;
|
||||||
vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z);
|
vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z);
|
||||||
// v_color.rgb += u_ambLight.rgb*surfAmbient;
|
|
||||||
v_color.rgb += combinedAmbient.rgb*surfAmbient;
|
v_color.rgb += combinedAmbient.rgb*surfAmbient;
|
||||||
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
|
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
|
||||||
v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0);
|
v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0);
|
||||||
// v_color = clamp(v_color, 0.0, 1.0);
|
|
||||||
v_color *= u_matColor;
|
v_color *= u_matColor;
|
||||||
|
|
||||||
// for fresnel
|
// for fresnel
|
||||||
|
|
|
@ -45,7 +45,6 @@ float4 main(VS_out input) : COLOR
|
||||||
|
|
||||||
float opacity = lerp(minOpacity, maxOpacity, fresnel)*pass1.a;
|
float opacity = lerp(minOpacity, maxOpacity, fresnel)*pass1.a;
|
||||||
float4 color = pass1 + float4(reflectivity * envOut, 0.0);
|
float4 color = pass1 + float4(reflectivity * envOut, 0.0);
|
||||||
//float4 color = float4(reflectivity, reflectivity, reflectivity, reflectivity);
|
|
||||||
color.a = opacity;
|
color.a = opacity;
|
||||||
|
|
||||||
color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z);
|
color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z);
|
||||||
|
|
|
@ -38,15 +38,12 @@ VS_out main(in VS_in input)
|
||||||
|
|
||||||
output.Color = input.Prelight;
|
output.Color = input.Prelight;
|
||||||
float4 combinedAmbient = lerp(emissive, ambient, N.z);
|
float4 combinedAmbient = lerp(emissive, ambient, N.z);
|
||||||
// output.Color.rgb += ambientLight.rgb * surfAmbient;
|
|
||||||
output.Color.rgb += combinedAmbient.rgb * surfAmbient;
|
output.Color.rgb += combinedAmbient.rgb * surfAmbient;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < numDirLights; i++)
|
for(i = 0; i < numDirLights; i++)
|
||||||
output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse;
|
output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse;
|
||||||
lightingCont = max(0.5, (output.Color.r + output.Color.g + output.Color.b) / 3.0);
|
lightingCont = max(0.5, (output.Color.r + output.Color.g + output.Color.b) / 3.0);
|
||||||
// PS2 clamps before material color
|
|
||||||
// output.Color = clamp(output.Color, 0.0, 1.0);
|
|
||||||
output.Color *= matCol;
|
output.Color *= matCol;
|
||||||
|
|
||||||
// for fresnel
|
// for fresnel
|
||||||
|
|
|
@ -27,11 +27,9 @@ const char *leedsVehicle_mobile_vert_src =
|
||||||
|
|
||||||
" v_color = in_color;\n"
|
" v_color = in_color;\n"
|
||||||
" vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z);\n"
|
" vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z);\n"
|
||||||
"// v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
|
|
||||||
" v_color.rgb += combinedAmbient.rgb*surfAmbient;\n"
|
" v_color.rgb += combinedAmbient.rgb*surfAmbient;\n"
|
||||||
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
|
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
|
||||||
" v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0);\n"
|
" v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0);\n"
|
||||||
"// v_color = clamp(v_color, 0.0, 1.0);\n"
|
|
||||||
" v_color *= u_matColor;\n"
|
" v_color *= u_matColor;\n"
|
||||||
|
|
||||||
" // for fresnel\n"
|
" // for fresnel\n"
|
||||||
|
|
2
vendor/librw
vendored
2
vendor/librw
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 61b288a9fe72ae4073c0ac5fd2a5815ed510c8c8
|
Subproject commit 78d540fce0ca090b07377cee40d73eadfb7a699d
|
Loading…
Reference in a new issue