mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-06 01:53:27 +00:00
Create directional light for bump mapped water rendering
This commit is contained in:
parent
39fd2be286
commit
ea2fdc939b
@ -31,26 +31,32 @@ class CLight
|
|||||||
friend class CGameLight;
|
friend class CGameLight;
|
||||||
|
|
||||||
zeus::CVector3f x0_pos;
|
zeus::CVector3f x0_pos;
|
||||||
zeus::CVector3f xc_dir;
|
zeus::CVector3f xc_dir = zeus::CVector3f::skDown;
|
||||||
zeus::CColor x18_color;
|
zeus::CColor x18_color = zeus::CColor::skClear;
|
||||||
ELightType x1c_type;
|
ELightType x1c_type = ELightType::Custom;
|
||||||
float x20_spotCutoff;
|
float x20_spotCutoff = 0.f;
|
||||||
float x24_distC;
|
float x24_distC = 1.f;
|
||||||
float x28_distL;
|
float x28_distL = 0.f;
|
||||||
float x2c_distQ;
|
float x2c_distQ = 0.f;
|
||||||
float x30_angleC;
|
float x30_angleC = 1.f;
|
||||||
float x34_angleL;
|
float x34_angleL = 0.f;
|
||||||
float x38_angleQ;
|
float x38_angleQ = 0.f;
|
||||||
u32 x3c_priority = 0;
|
u32 x3c_priority = 0;
|
||||||
u32 x40_lightId = 0; // Serves as unique key
|
u32 x40_lightId = 0; // Serves as unique key
|
||||||
float x44_cachedRadius;
|
float x44_cachedRadius = 0.f;
|
||||||
float x48_cachedIntensity;
|
float x48_cachedIntensity = 0.f;
|
||||||
bool x4c_24_intensityDirty : 1;
|
bool x4c_24_intensityDirty : 1;
|
||||||
bool x4c_25_radiusDirty : 1;
|
bool x4c_25_radiusDirty : 1;
|
||||||
|
|
||||||
float CalculateLightRadius() const;
|
float CalculateLightRadius() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
CLight()
|
||||||
|
{
|
||||||
|
x4c_24_intensityDirty = true;
|
||||||
|
x4c_25_radiusDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
CLight(const zeus::CVector3f& pos,
|
CLight(const zeus::CVector3f& pos,
|
||||||
const zeus::CVector3f& dir,
|
const zeus::CVector3f& dir,
|
||||||
const zeus::CColor& color,
|
const zeus::CColor& color,
|
||||||
|
@ -132,38 +132,14 @@ CFluidPlaneCPU::RenderSetup(const CStateManager& mgr, float alpha, const zeus::C
|
|||||||
// Build 50% grey directional light with xf0_bumpLightDir and load into LIGHT_3
|
// Build 50% grey directional light with xf0_bumpLightDir and load into LIGHT_3
|
||||||
// Light 3 in channel 1
|
// Light 3 in channel 1
|
||||||
// Vertex colors in channel 0
|
// Vertex colors in channel 0
|
||||||
|
out.lights.resize(4);
|
||||||
|
out.lights[3] = CLight::BuildDirectional(xf0_bumpLightDir, zeus::CColor::skGrey);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Normal light mask in channel 1
|
// Normal light mask in channel 1
|
||||||
// Vertex colors in channel 0
|
// Vertex colors in channel 0
|
||||||
}
|
out.lights = water->GetActorLights()->BuildLightVector();
|
||||||
|
|
||||||
if (x10_texPattern1)
|
|
||||||
{
|
|
||||||
// Load into 0
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Load black tex into 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x20_texPattern2)
|
|
||||||
{
|
|
||||||
// Load into 1
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Load black tex into 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x30_texColor)
|
|
||||||
{
|
|
||||||
// Load into 2
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Load black tex into 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int curTex = 3;
|
int curTex = 3;
|
||||||
@ -298,7 +274,6 @@ CFluidPlaneCPU::RenderSetup(const CStateManager& mgr, float alpha, const zeus::C
|
|||||||
m_shader.emplace(x44_fluidType,
|
m_shader.emplace(x44_fluidType,
|
||||||
x10_texPattern1, x20_texPattern2, x30_texColor, xb0_bumpMap, xc0_envMap, xd0_envBumpMap,
|
x10_texPattern1, x20_texPattern2, x30_texColor, xb0_bumpMap, xc0_envMap, xd0_envBumpMap,
|
||||||
xe0_lightmap, doubleLightmapBlend, mgr.GetParticleFlags() == 0);
|
xe0_lightmap, doubleLightmapBlend, mgr.GetParticleFlags() == 0);
|
||||||
out.lights = water->GetActorLights()->BuildLightVector();
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user