Merge with default

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-09-14 19:02:50 +02:00
commit 032176055d
17 changed files with 111 additions and 73 deletions

View file

@ -1103,7 +1103,7 @@ public:
/** Return true if the driver supports the specified vertex program profile. /** Return true if the driver supports the specified vertex program profile.
*/ */
virtual bool supportVertexProgram(CVertexProgram::TProfile profile = CVertexProgram::nelvp) const = 0; virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const = 0;
/** Compile the given vertex program, return if successful. /** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation, * If a vertex program was set active before compilation,
@ -1197,28 +1197,8 @@ public:
virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) = 0; virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) = 0;
virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src) = 0; virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src) = 0;
// Set builtin parameters // Set builtin parameters
virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform) = 0;
virtual void setUniformFog(TProgram program, uint index) = 0;
// Set feature parameters
virtual bool isUniformProgramState() = 0;
// @}
/// \name Legacy vertex program parameter setters
// @{
/** /**
* Setup constant values. * Setup uniforms with a current matrix.
*/
inline void setConstant(uint index, float f0, float f1, float f2, float f3) { setUniform4f(VertexProgram, index, f0, f1, f2, f3); }
inline void setConstant(uint index, double d0, double d1, double d2, double d3) { setUniform4f(VertexProgram, index, (float)d0, (float)d1, (float)d2, (float)d3); }
inline void setConstant(uint index, const NLMISC::CVector &value) { setUniform4f(VertexProgram, index, value, 0.f); }
inline void setConstant(uint index, const NLMISC::CVectorD &value) { setUniform4f(VertexProgram, index, (float)value.x, (float)value.y, (float)value.z, 0.f); }
/// setup several 4 float csts taken from the given tab
inline void setConstant(uint index, uint num, const float *src) { setUniform4fv(VertexProgram, index, num, src); }
/**
* Setup constants with a current matrix.
* *
* This call must be done after setFrustum(), setupViewMatrix() or setupModelMatrix() to get correct * This call must be done after setFrustum(), setupViewMatrix() or setupModelMatrix() to get correct
* results. * results.
@ -1228,10 +1208,9 @@ public:
* \param transform is the transformation to apply to the matrix before store it in the constants. * \param transform is the transformation to apply to the matrix before store it in the constants.
* *
*/ */
inline void setConstantMatrix(uint index, TMatrix matrix, TTransform transform) { setUniformMatrix(VertexProgram, index, matrix, transform); }; virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform) = 0;
/** /**
* Setup the constant with the fog vector. This vector must be used to get the final fog value in a vertex shader. * Setup the uniform with the fog vector. This vector must be used to get the final fog value in a vertex shader.
* You must use it like this: * You must use it like this:
* DP4 o[FOGC].x, c[4], R4; * DP4 o[FOGC].x, c[4], R4;
* With c[4] the constant used for the fog vector and R4 the vertex local position. * With c[4] the constant used for the fog vector and R4 the vertex local position.
@ -1242,7 +1221,9 @@ public:
* \param index is the index where to store the vector. * \param index is the index where to store the vector.
* *
*/ */
inline void setConstantFog(uint index) { setUniformFog(VertexProgram, index); }; virtual void setUniformFog(TProgram program, uint index) = 0;
// Set feature parameters
virtual bool isUniformProgramState() = 0;
// @} // @}

View file

@ -106,6 +106,7 @@ public:
// @} // @}
private: private:
static void initVertexPrograms();
void setupLighting(CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat); void setupLighting(CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat);
private: private:

View file

@ -280,7 +280,8 @@ public:
*/ */
void changeLightSetup(CLightContribution *lightContribution, bool useLocalAttenuation); void changeLightSetup(CLightContribution *lightContribution, bool useLocalAttenuation);
/// Must call before beginVPLightSetup
void prepareVPLightSetup();
/** setup the driver VP constants to get info from current LightSetup. /** 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 * 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 * 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. // Current num of VP lights enabled.
uint _VPNumLights; uint _VPNumLights;
// Current support of specular // Current support of specular
//bool _VPSupportSpecular; // bool _VPSupportSpecular;
// Sum of all ambiant of all lights + ambiantGlobal. // Sum of all ambiant of all lights + ambiantGlobal.
NLMISC::CRGBAF _VPFinalAmbient; NLMISC::CRGBAF _VPFinalAmbient;
// Diffuse/Spec comp of all light / 255. // Diffuse/Spec comp of all light / 255.

View file

@ -61,7 +61,7 @@ public:
// Get envmap 2D texture (after projection of cube map) // Get envmap 2D texture (after projection of cube map)
ITexture *getEnvMap2D() const { return _Env2D; } ITexture *getEnvMap2D() const { return _Env2D; }
// tmp for debug : render test mesh with current model / view matrixs // tmp for debug : render test mesh with current model / view matrixs
void renderTestMesh(IDriver &driver); // void renderTestMesh(IDriver &driver);
// set constant alpha of envmap // set constant alpha of envmap
void setAlpha(uint8 alpha) { _Alpha = alpha; } void setAlpha(uint8 alpha) { _Alpha = alpha; }
uint8 getAlpha() const { return _Alpha; } uint8 getAlpha() const { return _Alpha; }

View file

@ -270,14 +270,14 @@ private:
static bool _GridSizeTouched; static bool _GridSizeTouched;
// //
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1; /*static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2; static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2;
// //
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1Diffuse; static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1Diffuse;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2Diffuse; static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2Diffuse;
// //
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBump; static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBump;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBumpDiffuse; static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBumpDiffuse;*/
// //
static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWave; static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWave;
static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWaveDiffuse; static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWaveDiffuse;

View file

@ -3003,7 +3003,7 @@ bool CDriverD3D::stretchRect(ITexture * srcText, NLMISC::CRect &srcRect, ITextur
bool CDriverD3D::supportBloomEffect() const bool CDriverD3D::supportBloomEffect() const
{ {
return supportVertexProgram(); return supportVertexProgram(CVertexProgram::nelvp);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -1112,7 +1112,7 @@ public:
/** Return true if the driver supports the specified vertex program profile. /** Return true if the driver supports the specified vertex program profile.
*/ */
virtual bool supportVertexProgram(CVertexProgram::TProfile profile = CVertexProgram::nelvp) const; virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const;
/** Compile the given vertex program, return if successful. /** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation, * If a vertex program was set active before compilation,

View file

@ -689,7 +689,7 @@ bool CDriverGL::stretchRect(ITexture * /* srcText */, NLMISC::CRect &/* srcRect
// *************************************************************************** // ***************************************************************************
bool CDriverGL::supportBloomEffect() const bool CDriverGL::supportBloomEffect() const
{ {
return (supportVertexProgram() && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle()); return (supportVertexProgram(CVertexProgram::nelvp) && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle());
} }
// *************************************************************************** // ***************************************************************************

View file

@ -1318,7 +1318,7 @@ private:
/** Return true if the driver supports the specified vertex program profile. /** Return true if the driver supports the specified vertex program profile.
*/ */
virtual bool supportVertexProgram(CVertexProgram::TProfile profile = CVertexProgram::nelvp) const; virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const;
/** Compile the given vertex program, return if successful. /** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation, * If a vertex program was set active before compilation,

View file

@ -568,18 +568,21 @@ void CLandscape::clear()
void CLandscape::setDriver(IDriver *drv) void CLandscape::setDriver(IDriver *drv)
{ {
nlassert(drv); nlassert(drv);
if(_Driver != drv) if (_Driver != drv)
{ {
_Driver= drv; _Driver= drv;
// Does the driver support VertexShader??? // Does the driver support VertexShader???
// only if VP supported by GPU. // only if VP supported by GPU.
_VertexShaderOk= (_Driver->supportVertexProgram() && !_Driver->isVertexProgramEmulated()); _VertexShaderOk = (!_Driver->isVertexProgramEmulated() && (
_Driver->supportVertexProgram(CVertexProgram::nelvp)
// || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL
));
// Does the driver has sufficient requirements for Vegetable??? // Does the driver has sufficient requirements for Vegetable???
// only if VP supported by GPU, and Only if max vertices allowed. // only if VP supported by GPU, and Only if max vertices allowed.
_DriverOkForVegetable= _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX); _DriverOkForVegetable = _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX);
} }
} }

View file

@ -82,7 +82,10 @@ void CLandscapeVBAllocator::updateDriver(IDriver *driver)
deleteVertexProgram(); deleteVertexProgram();
// Then rebuild VB format, and VertexProgram, if needed. // Then rebuild VB format, and VertexProgram, if needed.
// Do it only if VP supported by GPU. // Do it only if VP supported by GPU.
setupVBFormatAndVertexProgram(_Driver->supportVertexProgram() && !_Driver->isVertexProgramEmulated()); setupVBFormatAndVertexProgram(!_Driver->isVertexProgramEmulated() && (
_Driver->supportVertexProgram(CVertexProgram::nelvp)
// || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL
));
// must reallocate the VertexBuffer. // must reallocate the VertexBuffer.
if( _NumVerticesAllocated>0 ) if( _NumVerticesAllocated>0 )
@ -568,7 +571,8 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr
_VB.initEx(); _VB.initEx();
// Init the Vertex Program. // Init the Vertex Program.
_VertexProgram[0]= new CVertexProgramLandscape(Far0); _VertexProgram[0] = new CVertexProgramLandscape(Far0);
nlverify(_Driver->compileVertexProgram(_VertexProgram[0]));
} }
else if(_Type==Far1) else if(_Type==Far1)
{ {
@ -584,6 +588,7 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr
// Init the Vertex Program. // Init the Vertex Program.
_VertexProgram[0] = new CVertexProgramLandscape(Far1); _VertexProgram[0] = new CVertexProgramLandscape(Far1);
nlverify(_Driver->compileVertexProgram(_VertexProgram[0]));
} }
else else
{ {
@ -599,9 +604,11 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr
// Init the Vertex Program. // Init the Vertex Program.
_VertexProgram[0] = new CVertexProgramLandscape(Tile, false); _VertexProgram[0] = new CVertexProgramLandscape(Tile, false);
nlverify(_Driver->compileVertexProgram(_VertexProgram[0]));
// Init the Vertex Program for lightmap pass // Init the Vertex Program for lightmap pass
_VertexProgram[1] = new CVertexProgramLandscape(Tile, true); _VertexProgram[1] = new CVertexProgramLandscape(Tile, true);
nlverify(_Driver->compileVertexProgram(_VertexProgram[1]));
} }
} }

View file

@ -499,22 +499,23 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv,
const NLMISC::CVector &viewerPos) const NLMISC::CVector &viewerPos)
{ {
// test if supported by driver // test if supported by driver
if (! if (drv->isVertexProgramEmulated()
(drv->supportVertexProgram() || !drv->supportPerPixelLighting(SpecularLighting))
&& !drv->isVertexProgramEmulated()
&& drv->supportPerPixelLighting(SpecularLighting)
)
)
{ {
return false; return false;
} }
// //
enable(true, drv); // must enable the vertex program before the vb is activated enable(true, drv); // must enable the vertex program before the vb is activated
CVertexProgramPerPixelLight *program = _ActiveVertexProgram; CVertexProgramPerPixelLight *program = _ActiveVertexProgram;
nlassert(program); if (!program)
{
// failed to compile vertex program
return false;
}
// //
CRenderTrav *renderTrav= &scene->getRenderTrav(); CRenderTrav *renderTrav= &scene->getRenderTrav();
/// Setup for gouraud lighting /// Setup for gouraud lighting
renderTrav->prepareVPLightSetup();
renderTrav->beginVPLightSetup(program, invertedModelMat); renderTrav->beginVPLightSetup(program, invertedModelMat);
// //
sint strongestLightIndex = renderTrav->getStrongestLightIndex(); sint strongestLightIndex = renderTrav->getStrongestLightIndex();
@ -593,8 +594,14 @@ void CMeshVPPerPixelLight::enable(bool enabled, IDriver *drv)
| (SpecularLighting ? 2 : 0) | (SpecularLighting ? 2 : 0)
| (_IsPointLight ? 1 : 0); | (_IsPointLight ? 1 : 0);
// //
drv->activeVertexProgram((CVertexProgramPerPixelLight *)_VertexProgram[idVP]); if (drv->activeVertexProgram((CVertexProgramPerPixelLight *)_VertexProgram[idVP]))
_ActiveVertexProgram = _VertexProgram[idVP]; {
_ActiveVertexProgram = _VertexProgram[idVP];
}
else
{
_ActiveVertexProgram = NULL;
}
} }
else else
{ {

View file

@ -207,12 +207,11 @@ void CMeshVPWindTree::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
f.serial(SpecularLighting); f.serial(SpecularLighting);
} }
void CMeshVPWindTree::initVertexPrograms()
// ***************************************************************************
void CMeshVPWindTree::initInstance(CMeshBaseInstance *mbi)
{ {
// init the vertexProgram code. // init the vertexProgram code.
static bool vpCreated= false; static bool vpCreated= false;
if(!vpCreated) if(!vpCreated)
{ {
vpCreated= true; vpCreated= true;
@ -231,6 +230,12 @@ void CMeshVPWindTree::initInstance(CMeshBaseInstance *mbi)
_VertexProgram[i] = new CVertexProgramWindTree(numPls, normalize, specular); _VertexProgram[i] = new CVertexProgramWindTree(numPls, normalize, specular);
} }
} }
}
// ***************************************************************************
void CMeshVPWindTree::initInstance(CMeshBaseInstance *mbi)
{
initVertexPrograms();
// init a random phase. // init a random phase.
mbi->_VPWindTreePhase= frand(1); mbi->_VPWindTreePhase= frand(1);
@ -374,12 +379,14 @@ inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene
// *************************************************************************** // ***************************************************************************
bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat, const NLMISC::CVector & /*viewerPos*/) bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat, const NLMISC::CVector & /*viewerPos*/)
{ {
if (!(driver->supportVertexProgram() && !driver->isVertexProgramEmulated())) return false; if (driver->isVertexProgramEmulated()) return false;
// Activate the good VertexProgram // Activate the good VertexProgram
//=============== //===============
// Update nb vp lights
renderTrav->prepareVPLightSetup();
// Get how many pointLights are setuped now. // Get how many pointLights are setuped now.
nlassert(scene != NULL); nlassert(scene != NULL);
@ -393,8 +400,16 @@ bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *m
// correct VP id for correct unmber of pls. // correct VP id for correct unmber of pls.
idVP= numPls*4 + idVP; idVP= numPls*4 + idVP;
// activate VP. // activate VP.
driver->activeVertexProgram(_VertexProgram[idVP]); if (driver->activeVertexProgram(_VertexProgram[idVP]))
_ActiveVertexProgram = _VertexProgram[idVP]; {
_ActiveVertexProgram = _VertexProgram[idVP];
}
else
{
// vertex program not supported
_ActiveVertexProgram = NULL;
return false;
}
// precompute mesh // precompute mesh
@ -461,7 +476,20 @@ bool CMeshVPWindTree::supportMeshBlockRendering() const
// *************************************************************************** // ***************************************************************************
bool CMeshVPWindTree::isMBRVpOk(IDriver *driver) const bool CMeshVPWindTree::isMBRVpOk(IDriver *driver) const
{ {
return driver->supportVertexProgram() && !driver->isVertexProgramEmulated(); initVertexPrograms();
if (driver->isVertexProgramEmulated())
{
return false;
}
for (uint i = 0; i < NumVp; ++i)
{
if (!driver->compileVertexProgram(_VertexProgram[i]))
{
return false;
}
}
return true;
} }
// *************************************************************************** // ***************************************************************************
@ -484,6 +512,9 @@ void CMeshVPWindTree::beginMBRMesh(IDriver *driver, CScene *scene)
// *************************************************************************** // ***************************************************************************
void CMeshVPWindTree::beginMBRInstance(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat) 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. // Get how many pointLights are setuped now.
nlassert(scene != NULL); nlassert(scene != NULL);
CRenderTrav *renderTrav= &scene->getRenderTrav(); CRenderTrav *renderTrav= &scene->getRenderTrav();

View file

@ -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) void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatrix &invObjectWM)
{ {
uint i; uint i;
nlassert(MaxVPLight==4); // nlassert(MaxVPLight==4);
_VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight); // _VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight);
// _VPCurrentCtStart= ctStart; // _VPCurrentCtStart= ctStart;
// _VPSupportSpecular= supportSpecular; // _VPSupportSpecular= supportSpecular;
_VPCurrent = program; _VPCurrent = program;
@ -1063,9 +1070,9 @@ static const char* LightingVPFragmentSpecular_Begin=
\n\ \n\
# Compute vertex-to-eye vector normed. \n\ # Compute vertex-to-eye vector normed. \n\
ADD R4, c[CTS+11], -R5; \n\ ADD R4, c[CTS+11], -R5; \n\
DP3 R4.w, R4, R4; \n\ DP3 R1.w, R4, R4; \n\
RSQ R4.w, R4.w; \n\ RSQ R1.w, R1.w; \n\
MUL R4, R4, R4.w; \n\ MUL R4, R4, R1.w; \n\
\n\ \n\
# Diffuse-Specular Sun \n\ # Diffuse-Specular Sun \n\
# Compute R1= halfAngleVector= (lightDir+R4).normed(). \n\ # Compute R1= halfAngleVector= (lightDir+R4).normed(). \n\

View file

@ -98,7 +98,9 @@ void CVegetableVBAllocator::updateDriver(IDriver *driver)
_VBHardOk= false; _VBHardOk= false;
// Driver must support VP. // Driver must support VP.
nlassert(_Driver->supportVertexProgram()); nlassert(_Driver->supportVertexProgram(CVertexProgram::nelvp)
// || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL
);
// must reallocate the VertexBuffer. // must reallocate the VertexBuffer.
if( _NumVerticesAllocated>0 ) if( _NumVerticesAllocated>0 )

View file

@ -226,7 +226,7 @@ void CWaterEnvMap::doInit()
_MaterialPassThru.setZFunc(CMaterial::always); _MaterialPassThru.setZFunc(CMaterial::always);
} }
} }
/*
static const char *testMeshVPstr = static const char *testMeshVPstr =
"!!VP1.0\n\ "!!VP1.0\n\
DP4 o[HPOS].x, c[0], v[0]; \n\ DP4 o[HPOS].x, c[0], v[0]; \n\
@ -257,7 +257,6 @@ public:
source->ParamIndices["programConstant0"] = 4; source->ParamIndices["programConstant0"] = 4;
addSource(source); addSource(source);
} }
// TODO_VP_GLSL
} }
virtual ~CVertexProgramTestMeshVP() virtual ~CVertexProgramTestMeshVP()
{ {
@ -309,7 +308,7 @@ void CWaterEnvMap::renderTestMesh(IDriver &driver)
driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS); driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS);
driver.activeVertexProgram(NULL); driver.activeVertexProgram(NULL);
} }
*/
// ******************************************************************************* // *******************************************************************************
void CWaterEnvMap::initFlattenVB() void CWaterEnvMap::initFlattenVB()
{ {

View file

@ -250,19 +250,19 @@ uint32 CWaterShape::_XGridBorder = 4;
uint32 CWaterShape::_YGridBorder = 4; uint32 CWaterShape::_YGridBorder = 4;
uint32 CWaterShape::_MaxGridSize; uint32 CWaterShape::_MaxGridSize;
bool CWaterShape::_GridSizeTouched = true; bool CWaterShape::_GridSizeTouched = true;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump1; /*NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump1;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump2; NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump2;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump1Diffuse; NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump1Diffuse;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump2Diffuse; NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramBump2Diffuse;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramNoBump; NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramNoBump;
NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramNoBumpDiffuse; NLMISC::CSmartPtr<CVertexProgram> CWaterShape::_VertexProgramNoBumpDiffuse;*/
// water with no waves // water with no waves
NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> CWaterShape::_VertexProgramNoWave; NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> CWaterShape::_VertexProgramNoWave;
NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> CWaterShape::_VertexProgramNoWaveDiffuse; NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> CWaterShape::_VertexProgramNoWaveDiffuse;
/** Build a vertex program for water depending on requirements /** Build a vertex program for water depending on requirements
*/ *//*
static CVertexProgram *BuildWaterVP(bool diffuseMap, bool bumpMap, bool use2BumpMap) static CVertexProgram *BuildWaterVP(bool diffuseMap, bool bumpMap, bool use2BumpMap)
{ {
std::string vp = WaterVPStartCode; std::string vp = WaterVPStartCode;
@ -285,9 +285,8 @@ static CVertexProgram *BuildWaterVP(bool diffuseMap, bool bumpMap, bool use2Bump
vp += "\nEND"; vp += "\nEND";
return new CVertexProgram(vp.c_str()); return new CVertexProgram(vp.c_str());
// TODO_VP_GLSL
} }
*/
//============================================ //============================================
@ -384,17 +383,17 @@ void CWaterShape::initVertexProgram()
if (!created) if (!created)
{ {
// waves // waves
_VertexProgramBump1 = BuildWaterVP(false, true, false); /*_VertexProgramBump1 = BuildWaterVP(false, true, false);
_VertexProgramBump2 = BuildWaterVP(false, true, true); _VertexProgramBump2 = BuildWaterVP(false, true, true);
_VertexProgramBump1Diffuse = BuildWaterVP(true, true, false); _VertexProgramBump1Diffuse = BuildWaterVP(true, true, false);
_VertexProgramBump2Diffuse = BuildWaterVP(true, true, true); _VertexProgramBump2Diffuse = BuildWaterVP(true, true, true);
_VertexProgramNoBump = BuildWaterVP(false, false, false); _VertexProgramNoBump = BuildWaterVP(false, false, false);
_VertexProgramNoBumpDiffuse = BuildWaterVP(true, false, false); _VertexProgramNoBumpDiffuse = BuildWaterVP(true, false, false);*/
// no waves // no waves
_VertexProgramNoWave = new CVertexProgramWaterVPNoWave(false); _VertexProgramNoWave = new CVertexProgramWaterVPNoWave(false);
_VertexProgramNoWaveDiffuse = new CVertexProgramWaterVPNoWave(true); // TODO_VP_GLSL _VertexProgramNoWaveDiffuse = new CVertexProgramWaterVPNoWave(true);
created = true; created = true;
} }
} }