This commit is contained in:
kaetemi 2013-09-14 00:36:06 +02:00
parent 23ad938cdb
commit 23dfe4b566
6 changed files with 36 additions and 28 deletions

View file

@ -52,6 +52,7 @@ FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
/opt/csw/lib /opt/csw/lib
/opt/lib /opt/lib
/usr/freeware/lib64 /usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
) )
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
@ -67,6 +68,7 @@ FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
/opt/csw/lib /opt/csw/lib
/opt/lib /opt/lib
/usr/freeware/lib64 /usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
) )
IF(FREETYPE_INCLUDE_DIRS) IF(FREETYPE_INCLUDE_DIRS)

View file

@ -1200,10 +1200,6 @@ public:
virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform) = 0; virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform) = 0;
virtual void setUniformFog(TProgram program, uint index) = 0; virtual void setUniformFog(TProgram program, uint index) = 0;
// Set feature parameters // Set feature parameters
virtual bool setUniformDriver(TProgram program) = 0; // set all driver-specific features params (based on program->features->DriverFlags) (called automatically when rendering with cmaterial and using a user program)
virtual bool setUniformMaterial(TProgram program, CMaterial &material) = 0; // set all material-specific feature params (based on program->features->MaterialFlags) (called automatically when rendering with cmaterial and using a user program)
virtual void setUniformParams(TProgram program, CGPUProgramParams &params) = 0; // set all user-provided params from the storage
// Return true if uniforms are kept as program state and switched together with programs, false if uniforms are driver state and stay accross program switches.
virtual bool isUniformProgramState() = 0; virtual bool isUniformProgramState() = 0;
// @} // @}

View file

@ -1392,6 +1392,8 @@ private:
/// \name Program parameters /// \name Program parameters
// @{ // @{
// Set parameters // Set parameters
inline void setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3);
inline void setUniform4fvInl(TProgram program, uint index, size_t num, const float *src);
virtual void setUniform1f(TProgram program, uint index, float f0); virtual void setUniform1f(TProgram program, uint index, float f0);
virtual void setUniform2f(TProgram program, uint index, float f0, float f1); virtual void setUniform2f(TProgram program, uint index, float f0, float f1);
virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2); virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2);
@ -1415,10 +1417,6 @@ private:
virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform); virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform);
virtual void setUniformFog(TProgram program, uint index); virtual void setUniformFog(TProgram program, uint index);
// Set feature parameters // Set feature parameters
virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags)
virtual bool setUniformMaterial(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
bool setUniformMaterialInternal(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
virtual void setUniformParams(TProgram program, CGPUProgramParams &params); // set all user-provided params from the storage
virtual bool isUniformProgramState() { return false; } virtual bool isUniformProgramState() { return false; }
// @} // @}

View file

@ -362,17 +362,17 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// 2b. User supplied pixel shader overrides material // 2b. User supplied pixel shader overrides material
//================================== //==================================
if (_VertexProgramEnabled) /*if (_VertexProgramEnabled)
{ {
if (!setUniformDriver(VertexProgram)) return false; if (!setUniformDriver(VertexProgram)) return false;
if (!setUniformMaterialInternal(VertexProgram, mat)) return false; if (!setUniformMaterialInternal(VertexProgram, mat)) return false;
} }*/
if (_PixelProgramEnabled) if (_PixelProgramEnabled)
{ {
matShader = CMaterial::Program; matShader = CMaterial::Program;
if (!setUniformDriver(PixelProgram)) return false; // if (!setUniformDriver(PixelProgram)) return false;
if (!setUniformMaterialInternal(PixelProgram, mat)) return false; // if (!setUniformMaterialInternal(PixelProgram, mat)) return false;
if (!_LastSetuppedPP) return false; if (!_LastSetuppedPP) return false;
} }
else else

View file

@ -31,7 +31,7 @@ namespace NLDRIVERGL {
#endif #endif
#endif #endif
inline void CDriverGL::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3) inline void CDriverGL::setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3)
{ {
H_AUTO_OGL(CDriverGL_setUniform4f); H_AUTO_OGL(CDriverGL_setUniform4f);
@ -64,7 +64,7 @@ inline void CDriverGL::setUniform4f(TProgram program, uint index, float f0, floa
#endif #endif
} }
inline void CDriverGL::setUniform4fv(TProgram program, uint index, size_t num, const float *src) inline void CDriverGL::setUniform4fvInl(TProgram program, uint index, size_t num, const float *src)
{ {
H_AUTO_OGL(CDriverGL_setUniform4fv); H_AUTO_OGL(CDriverGL_setUniform4fv);
@ -106,17 +106,22 @@ inline void CDriverGL::setUniform4fv(TProgram program, uint index, size_t num, c
void CDriverGL::setUniform1f(TProgram program, uint index, float f0) void CDriverGL::setUniform1f(TProgram program, uint index, float f0)
{ {
CDriverGL::setUniform4f(program, index, f0, 0.f, 0.f, 0.f); CDriverGL::setUniform4fInl(program, index, f0, 0.f, 0.f, 0.f);
} }
void CDriverGL::setUniform2f(TProgram program, uint index, float f0, float f1) void CDriverGL::setUniform2f(TProgram program, uint index, float f0, float f1)
{ {
CDriverGL::setUniform4f(program, index, f0, f1, 0.f, 0.f); CDriverGL::setUniform4fInl(program, index, f0, f1, 0.f, 0.f);
} }
void CDriverGL::setUniform3f(TProgram program, uint index, float f0, float f1, float f2) void CDriverGL::setUniform3f(TProgram program, uint index, float f0, float f1, float f2)
{ {
CDriverGL::setUniform4f(program, index, f0, f1, f2, 0.0f); CDriverGL::setUniform4fInl(program, index, f0, f1, f2, 0.0f);
}
void CDriverGL::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3)
{
CDriverGL::setUniform4fInl(program, index, f0, f1, f2, f3);
} }
void CDriverGL::setUniform1i(TProgram program, uint index, sint32 i0) void CDriverGL::setUniform1i(TProgram program, uint index, sint32 i0)
@ -161,17 +166,17 @@ void CDriverGL::setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 u
void CDriverGL::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v) void CDriverGL::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v)
{ {
CDriverGL::setUniform4f(program, index, v.x, v.y, v.z, 0.f); CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, 0.f);
} }
void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3) void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3)
{ {
CDriverGL::setUniform4f(program, index, v.x, v.y, v.z, f3); CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, f3);
} }
void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba) void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba)
{ {
CDriverGL::setUniform4fv(program, index, 1, &rgba.R); CDriverGL::setUniform4fvInl(program, index, 1, &rgba.R);
} }
void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m) void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m)
@ -183,7 +188,12 @@ void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatr
mat.transpose(); mat.transpose();
const float *md = mat.get(); const float *md = mat.get();
CDriverGL::setUniform4fv(program, index, 4, md); CDriverGL::setUniform4fvInl(program, index, 4, md);
}
void CDriverGL::setUniform4fv(TProgram program, uint index, size_t num, const float *src)
{
CDriverGL::setUniform4fvInl(program, index, num, src);
} }
void CDriverGL::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) void CDriverGL::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src)
@ -283,7 +293,7 @@ void CDriverGL::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL
mat.transpose(); mat.transpose();
const float *md = mat.get(); const float *md = mat.get();
CDriverGL::setUniform4fv(program, index, 4, md); CDriverGL::setUniform4fvInl(program, index, 4, md);
} }
#endif #endif
} }
@ -293,9 +303,11 @@ void CDriverGL::setUniformFog(NL3D::IDriver::TProgram program, uint index)
H_AUTO_OGL(CDriverGL_setUniformFog) H_AUTO_OGL(CDriverGL_setUniformFog)
const float *values = _ModelViewMatrix.get(); const float *values = _ModelViewMatrix.get();
CDriverGL::setUniform4f(program, index, -values[2], -values[6], -values[10], -values[14]); CDriverGL::setUniform4fInl(program, index, -values[2], -values[6], -values[10], -values[14]);
} }
/*
bool CDriverGL::setUniformDriver(TProgram program) bool CDriverGL::setUniformDriver(TProgram program)
{ {
IGPUProgram *prog = NULL; IGPUProgram *prog = NULL;
@ -476,9 +488,9 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
if (index == ~0) if (index == ~0)
{ {
const std::string &name = params.getNameByOffset(offset); const std::string &name = params.getNameByOffset(offset);
nlassert(!name.empty() /* missing both parameter name and index, code error */); nlassert(!name.empty() /* missing both parameter name and index, code error /);
uint index = prog->getUniformIndex(name.c_str()); uint index = prog->getUniformIndex(name.c_str());
nlassert(index != ~0 /* invalid parameter name */); nlassert(index != ~0 /* invalid parameter name /);
params.map(index, name); params.map(index, name);
} }
@ -488,6 +500,8 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
} }
} }
*/
#ifdef NL_STATIC #ifdef NL_STATIC
} // NLDRIVERGL/ES } // NLDRIVERGL/ES
#endif #endif

View file

@ -126,9 +126,7 @@ CVegetableManager::~CVegetableManager()
// delete All VP // delete All VP
for(sint i=0; i <NL3D_VEGETABLE_NRDRPASS; i++) for(sint i=0; i <NL3D_VEGETABLE_NRDRPASS; i++)
{ {
delete _VertexProgram[i][0]; _VertexProgram[i][0] = NULL; // smart ptr
delete _VertexProgram[i][1];
_VertexProgram[i][0] = NULL;
_VertexProgram[i][1] = NULL; _VertexProgram[i][1] = NULL;
} }