mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-28 19:30:54 +00:00
Fix regression from stereo branch in wind tree
This commit is contained in:
parent
642d6b1373
commit
8e9c69a566
4 changed files with 18 additions and 4 deletions
|
@ -280,7 +280,8 @@ public:
|
|||
*/
|
||||
void changeLightSetup(CLightContribution *lightContribution, bool useLocalAttenuation);
|
||||
|
||||
|
||||
/// Must call before beginVPLightSetup
|
||||
void prepareVPLightSetup();
|
||||
/** setup the driver VP constants to get info from current LightSetup.
|
||||
* Only 0..3 Light + SunLights are supported. The VP do NOT support distance/Spot attenuation
|
||||
* Also it does not handle World Matrix with non uniform scale correctly since lighting is made in ObjectSpace
|
||||
|
@ -425,7 +426,7 @@ private:
|
|||
// Current num of VP lights enabled.
|
||||
uint _VPNumLights;
|
||||
// Current support of specular
|
||||
//bool _VPSupportSpecular;
|
||||
// bool _VPSupportSpecular;
|
||||
// Sum of all ambiant of all lights + ambiantGlobal.
|
||||
NLMISC::CRGBAF _VPFinalAmbient;
|
||||
// Diffuse/Spec comp of all light / 255.
|
||||
|
|
|
@ -515,6 +515,7 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv,
|
|||
//
|
||||
CRenderTrav *renderTrav= &scene->getRenderTrav();
|
||||
/// Setup for gouraud lighting
|
||||
renderTrav->prepareVPLightSetup();
|
||||
renderTrav->beginVPLightSetup(program, invertedModelMat);
|
||||
//
|
||||
sint strongestLightIndex = renderTrav->getStrongestLightIndex();
|
||||
|
|
|
@ -385,6 +385,8 @@ bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *m
|
|||
// Activate the good VertexProgram
|
||||
//===============
|
||||
|
||||
// Update nb vp lights
|
||||
renderTrav->prepareVPLightSetup();
|
||||
|
||||
// Get how many pointLights are setuped now.
|
||||
nlassert(scene != NULL);
|
||||
|
@ -510,6 +512,9 @@ void CMeshVPWindTree::beginMBRMesh(IDriver *driver, CScene *scene)
|
|||
// ***************************************************************************
|
||||
void CMeshVPWindTree::beginMBRInstance(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat)
|
||||
{
|
||||
// Update nb vp lights
|
||||
renderTrav->prepareVPLightSetup();
|
||||
|
||||
// Get how many pointLights are setuped now.
|
||||
nlassert(scene != NULL);
|
||||
CRenderTrav *renderTrav= &scene->getRenderTrav();
|
||||
|
|
|
@ -760,13 +760,20 @@ void CRenderTrav::changeLightSetup(CLightContribution *lightContribution, bool
|
|||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
||||
void CRenderTrav::prepareVPLightSetup()
|
||||
{
|
||||
nlassert(MaxVPLight==4);
|
||||
_VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight);
|
||||
// Must force real light setup at least the first time, in changeVPLightSetupMaterial()
|
||||
_VPMaterialCacheDirty= true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatrix &invObjectWM)
|
||||
{
|
||||
uint i;
|
||||
nlassert(MaxVPLight==4);
|
||||
_VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight);
|
||||
// nlassert(MaxVPLight==4);
|
||||
// _VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight);
|
||||
// _VPCurrentCtStart= ctStart;
|
||||
// _VPSupportSpecular= supportSpecular;
|
||||
_VPCurrent = program;
|
||||
|
|
Loading…
Reference in a new issue