From 08f37643b7093642aab1b369c23db0ce8728067a Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 14 Sep 2013 00:36:06 +0200 Subject: [PATCH] Cleanup --- code/CMakeModules/FindFreeType.cmake | 2 + code/nel/include/nel/3d/driver.h | 4 -- code/nel/src/3d/driver/opengl/driver_opengl.h | 6 +-- .../driver/opengl/driver_opengl_material.cpp | 8 ++-- .../driver/opengl/driver_opengl_uniform.cpp | 40 +++++++++++++------ code/nel/src/3d/vegetable_manager.cpp | 4 +- 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index e15f55793..68a3ccdbd 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -52,6 +52,7 @@ FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE /opt/csw/lib /opt/lib /usr/freeware/lib64 + /usr/lib/x86_64-linux-gnu ) FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG @@ -67,6 +68,7 @@ FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG /opt/csw/lib /opt/lib /usr/freeware/lib64 + /usr/lib/x86_64-linux-gnu ) IF(FREETYPE_INCLUDE_DIRS) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 38c0f6c32..c9c55f864 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -1200,10 +1200,6 @@ public: 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 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 ¶ms) = 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; // @} diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index afab8209c..154506250 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -1392,6 +1392,8 @@ private: /// \name Program 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 setUniform2f(TProgram program, uint index, float f0, float f1); 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 setUniformFog(TProgram program, uint index); // 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 ¶ms); // set all user-provided params from the storage virtual bool isUniformProgramState() { return false; } // @} diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 67afe7868..61a685428 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -362,17 +362,17 @@ bool CDriverGL::setupMaterial(CMaterial& mat) // 2b. User supplied pixel shader overrides material //================================== - if (_VertexProgramEnabled) + /*if (_VertexProgramEnabled) { if (!setUniformDriver(VertexProgram)) return false; if (!setUniformMaterialInternal(VertexProgram, mat)) return false; - } + }*/ if (_PixelProgramEnabled) { matShader = CMaterial::Program; - if (!setUniformDriver(PixelProgram)) return false; - if (!setUniformMaterialInternal(PixelProgram, mat)) return false; + // if (!setUniformDriver(PixelProgram)) return false; + // if (!setUniformMaterialInternal(PixelProgram, mat)) return false; if (!_LastSetuppedPP) return false; } else diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp index deee62379..b3ba1ba54 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp @@ -31,7 +31,7 @@ namespace NLDRIVERGL { #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); @@ -64,7 +64,7 @@ inline void CDriverGL::setUniform4f(TProgram program, uint index, float f0, floa #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); @@ -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) { - 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) { - 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) { - 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) @@ -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) { - 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) { - 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) { - 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) @@ -183,7 +188,12 @@ void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatr mat.transpose(); 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) @@ -283,7 +293,7 @@ void CDriverGL::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL mat.transpose(); const float *md = mat.get(); - CDriverGL::setUniform4fv(program, index, 4, md); + CDriverGL::setUniform4fvInl(program, index, 4, md); } #endif } @@ -293,9 +303,11 @@ void CDriverGL::setUniformFog(NL3D::IDriver::TProgram program, uint index) H_AUTO_OGL(CDriverGL_setUniformFog) 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) { IGPUProgram *prog = NULL; @@ -476,9 +488,9 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams ¶ms) if (index == ~0) { 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()); - nlassert(index != ~0 /* invalid parameter name */); + nlassert(index != ~0 /* invalid parameter name /); params.map(index, name); } @@ -488,6 +500,8 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams ¶ms) } } +*/ + #ifdef NL_STATIC } // NLDRIVERGL/ES #endif diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index ba5f721bb..d548413a8 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -126,9 +126,7 @@ CVegetableManager::~CVegetableManager() // delete All VP for(sint i=0; i