diff --git a/lib/irrlicht/CMakeLists.txt b/lib/irrlicht/CMakeLists.txt index fd2a42360..ac6c5fbf7 100644 --- a/lib/irrlicht/CMakeLists.txt +++ b/lib/irrlicht/CMakeLists.txt @@ -61,7 +61,6 @@ source/Irrlicht/CGUIFileOpenDialog.cpp source/Irrlicht/CGUISpriteBank.cpp source/Irrlicht/CParticleFadeOutAffector.cpp source/Irrlicht/CGUIMenu.cpp -source/Irrlicht/CCgMaterialRenderer.cpp source/Irrlicht/CImageWriterPSD.cpp source/Irrlicht/CSphereSceneNode.cpp source/Irrlicht/CImageWriterTGA.cpp @@ -290,7 +289,6 @@ source/Irrlicht/SoftwareDriver2_compile_config.h source/Irrlicht/CSceneNodeAnimatorTexture.h source/Irrlicht/CXMLReader.h source/Irrlicht/CEmptySceneNode.h -source/Irrlicht/CCgMaterialRenderer.h source/Irrlicht/CParticleSystemSceneNode.h source/Irrlicht/CImageWriterPNG.h source/Irrlicht/CParticleScaleAffector.h diff --git a/lib/irrlicht/include/IrrCompileConfig.h b/lib/irrlicht/include/IrrCompileConfig.h index bc7735ef6..0e08e4a00 100644 --- a/lib/irrlicht/include/IrrCompileConfig.h +++ b/lib/irrlicht/include/IrrCompileConfig.h @@ -244,15 +244,6 @@ the engine will no longer read .png images. */ #undef _IRR_USE_NON_SYSTEM_LIB_PNG_ #endif -//! Define _IRR_COMPILE_WITH_CG_ to enable Cg Shading Language support -//#define _IRR_COMPILE_WITH_CG_ -#ifdef NO_IRR_COMPILE_WITH_CG_ -#undef _IRR_COMPILE_WITH_CG_ -#endif -#if !defined(_IRR_COMPILE_WITH_OPENGL_) && !defined(_IRR_COMPILE_WITH_DIRECT3D_9_) -#undef _IRR_COMPILE_WITH_CG_ -#endif - //! Define _IRR_USE_NVIDIA_PERFHUD_ to opt-in to using the nVidia PerHUD tool /** Enable, by opting-in, to use the nVidia PerfHUD performance analysis driver tool . */ diff --git a/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.cpp b/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.cpp deleted file mode 100644 index a5e4937c3..000000000 --- a/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.cpp +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (C) 2012 Patryk Nadrowski -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_CG_ - -#include "CCgMaterialRenderer.h" - -namespace irr -{ -namespace video -{ - -CCgUniform::CCgUniform(const CGparameter& parameter, bool global) : Parameter(parameter), Type(CG_UNKNOWN_TYPE) -{ - Name = cgGetParameterName(Parameter); - - if(global) - Space = CG_GLOBAL; - else - Space = CG_PROGRAM; -} - -const core::stringc& CCgUniform::getName() const -{ - return Name; -} - -const CGparameter& CCgUniform::getParameter() const -{ - return Parameter; -} - -CGenum CCgUniform::getSpace() const -{ - return Space; -} - -CGtype CCgUniform::getType() const -{ - return Type; -} - -CCgUniform1f::CCgUniform1f(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_FLOAT; -} - -void CCgUniform1f::update(const void* data, const SMaterial& material) const -{ - f32* Data = (f32*)data; - cgSetParameter1f(Parameter, *Data); -} - -CCgUniform2f::CCgUniform2f(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_FLOAT2; -} - -void CCgUniform2f::update(const void* data, const SMaterial& material) const -{ - f32* Data = (f32*)data; - cgSetParameter2f(Parameter, *Data, *(Data+1)); -} - -CCgUniform3f::CCgUniform3f(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_FLOAT3; -} - -void CCgUniform3f::update(const void* data, const SMaterial& material) const -{ - f32* Data = (f32*)data; - cgSetParameter3f(Parameter, *Data, *(Data+1), *(Data+2)); -} - -CCgUniform4f::CCgUniform4f(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_FLOAT4; -} - -void CCgUniform4f::update(const void* data, const SMaterial& material) const -{ - f32* Data = (f32*)data; - cgSetParameter4f(Parameter, *Data, *(Data+1), *(Data+2), *(Data+3)); -} - -CCgUniform1i::CCgUniform1i(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_INT; -} - -void CCgUniform1i::update(const void* data, const SMaterial& material) const -{ - s32* Data = (s32*)data; - cgSetParameter1i(Parameter, *Data); -} - -CCgUniform2i::CCgUniform2i(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_INT2; -} - -void CCgUniform2i::update(const void* data, const SMaterial& material) const -{ - s32* Data = (s32*)data; - cgSetParameter2i(Parameter, *Data, *(Data+1)); -} - -CCgUniform3i::CCgUniform3i(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_INT3; -} - -void CCgUniform3i::update(const void* data, const SMaterial& material) const -{ - s32* Data = (s32*)data; - cgSetParameter3i(Parameter, *Data, *(Data+1), *(Data+2)); -} - -CCgUniform4i::CCgUniform4i(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_INT4; -} - -void CCgUniform4i::update(const void* data, const SMaterial& material) const -{ - s32* Data = (s32*)data; - cgSetParameter4i(Parameter, *Data, *(Data+1), *(Data+2), *(Data+3)); -} - -CCgUniform4x4f::CCgUniform4x4f(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_FLOAT4x4; -} - -void CCgUniform4x4f::update(const void* data, const SMaterial& material) const -{ - f32* Data = (f32*)data; - cgSetMatrixParameterfr(Parameter, Data); -} - -CCgUniformSampler2D::CCgUniformSampler2D(const CGparameter& parameter, bool global) : CCgUniform(parameter, global) -{ - Type = CG_SAMPLER2D; -} - -void CCgUniformSampler2D::update(const void* data, const SMaterial& material) const -{ -} - -CCgMaterialRenderer::CCgMaterialRenderer(IShaderConstantSetCallBack* callback, IMaterialRenderer* baseMaterial, s32 userData) : - CallBack(callback), BaseMaterial(baseMaterial), UserData(userData), - VertexProgram(0), FragmentProgram(0), GeometryProgram(0), VertexProfile(CG_PROFILE_UNKNOWN), FragmentProfile(CG_PROFILE_UNKNOWN), GeometryProfile(CG_PROFILE_UNKNOWN), - Material(IdentityMaterial), Error(CG_NO_ERROR) -{ - #ifdef _DEBUG - setDebugName("CCgMaterialRenderer"); - #endif - - if(BaseMaterial) - BaseMaterial->grab(); - - if(CallBack) - CallBack->grab(); -} - -CCgMaterialRenderer::~CCgMaterialRenderer() -{ - if(CallBack) - CallBack->drop(); - - if(BaseMaterial) - BaseMaterial->drop(); - - for(unsigned int i = 0; i < UniformInfo.size(); ++i) - delete UniformInfo[i]; - - UniformInfo.clear(); -} - -bool CCgMaterialRenderer::isTransparent() const -{ - return BaseMaterial ? BaseMaterial->isTransparent() : false; -} - -void CCgMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) -{ - os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING); -} - -bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const f32* floats, int count) -{ - return setPixelShaderConstant(name, floats, count); -} - -bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const bool* bools, int count) -{ - return setPixelShaderConstant(name, bools, count); -} - -bool CCgMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count) -{ - return setPixelShaderConstant(name, ints, count); -} - -void CCgMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) -{ - os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING); -} - -bool CCgMaterialRenderer::setPixelShaderConstant(const c8* name, const f32* floats, int count) -{ - bool Status = false; - - for(unsigned int i = 0; i < UniformInfo.size(); ++i) - { - if(UniformInfo[i]->getName() == name) - { - UniformInfo[i]->update(floats, Material); - - Status = true; - } - } - - return Status; -} - -bool CCgMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints, int count) -{ - bool Status = false; - - for(unsigned int i = 0; i < UniformInfo.size(); ++i) - { - if(UniformInfo[i]->getName() == name) - { - UniformInfo[i]->update(ints, Material); - - Status = true; - } - } - - return Status; -} - -bool CCgMaterialRenderer::setPixelShaderConstant(const c8* name, const bool* bools, int count) -{ - bool Status = false; - - for(unsigned int i = 0; i < UniformInfo.size(); ++i) - { - if(UniformInfo[i]->getName() == name) - { - UniformInfo[i]->update(bools, Material); - - Status = true; - } - } - - return Status; -} - -void CCgMaterialRenderer::getUniformList() -{ - for(unsigned int i = 0; i < UniformInfo.size(); ++i) - delete UniformInfo[i]; - - UniformInfo.clear(); - - for(unsigned int i = 0; i < 2; ++i) - { - CGenum Space = CG_GLOBAL; - bool IsGlobal = 1; - - if(i == 1) - { - Space = CG_PROGRAM; - IsGlobal = 0; - } - - for(unsigned int j = 0; j < 3; ++j) - { - CGprogram* Program = 0; - - switch(j) - { - case 0: - Program = &VertexProgram; - break; - case 1: - Program = &FragmentProgram; - break; - case 2: - Program = &GeometryProgram; - break; - } - - if(*Program) - { - CGparameter Parameter = cgGetFirstParameter(*Program, Space); - - while(Parameter) - { - if(cgGetParameterVariability(Parameter) == CG_UNIFORM && cgGetParameterDirection(Parameter) == CG_IN) - { - CCgUniform* Uniform = 0; - - CGtype Type = cgGetParameterType(Parameter); - - switch(Type) - { - case CG_FLOAT: - case CG_FLOAT1: - Uniform = new CCgUniform1f(Parameter, IsGlobal); - break; - case CG_FLOAT2: - Uniform = new CCgUniform2f(Parameter, IsGlobal); - break; - case CG_FLOAT3: - Uniform = new CCgUniform3f(Parameter, IsGlobal); - break; - case CG_FLOAT4: - Uniform = new CCgUniform4f(Parameter, IsGlobal); - break; - case CG_INT: - case CG_INT1: - Uniform = new CCgUniform1i(Parameter, IsGlobal); - break; - case CG_INT2: - Uniform = new CCgUniform2i(Parameter, IsGlobal); - break; - case CG_INT3: - Uniform = new CCgUniform3i(Parameter, IsGlobal); - break; - case CG_INT4: - Uniform = new CCgUniform4i(Parameter, IsGlobal); - break; - case CG_FLOAT4x4: - Uniform = new CCgUniform4x4f(Parameter, IsGlobal); - break; - case CG_SAMPLER2D: - Uniform = new CCgUniformSampler2D(Parameter, IsGlobal); - break; - } - - if(Uniform) - UniformInfo.push_back(Uniform); - } - - Parameter = cgGetNextParameter(Parameter); - } - } - } - } -} - -} -} - -#endif diff --git a/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.h b/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.h deleted file mode 100644 index 8213f78bd..000000000 --- a/lib/irrlicht/source/Irrlicht/CCgMaterialRenderer.h +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (C) 2012 Patryk Nadrowski -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __C_CG_MATERIAL_RENDERER_H_INCLUDED__ -#define __C_CG_MATERIAL_RENDERER_H_INCLUDED__ - -#include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_CG_ - -#include "IMaterialRenderer.h" -#include "IMaterialRendererServices.h" -#include "IShaderConstantSetCallBack.h" -#include "IGPUProgrammingServices.h" -#include "irrArray.h" -#include "irrString.h" -#include "IVideoDriver.h" -#include "os.h" -#include "Cg/cg.h" - -#ifdef _MSC_VER - #pragma comment(lib, "cg.lib") -#endif - -namespace irr -{ -namespace video -{ - -class CCgUniform -{ -public: - CCgUniform(const CGparameter& parameter, bool global); - - const core::stringc& getName() const; - const CGparameter& getParameter() const; - CGenum getSpace() const; - CGtype getType() const; - - virtual void update(const void* data, const SMaterial& material) const = 0; - -protected: - core::stringc Name; - CGparameter Parameter; - CGenum Space; - CGtype Type; -}; - -class CCgUniform1f : public CCgUniform -{ -public: - CCgUniform1f(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform2f : public CCgUniform -{ -public: - CCgUniform2f(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform3f : public CCgUniform -{ -public: - CCgUniform3f(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform4f : public CCgUniform -{ -public: - CCgUniform4f(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform1i : public CCgUniform -{ -public: - CCgUniform1i(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform2i : public CCgUniform -{ -public: - CCgUniform2i(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform3i : public CCgUniform -{ -public: - CCgUniform3i(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform4i : public CCgUniform -{ -public: - CCgUniform4i(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniform4x4f : public CCgUniform -{ -public: - CCgUniform4x4f(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgUniformSampler2D : public CCgUniform -{ -public: - CCgUniformSampler2D(const CGparameter& parameter, bool global); - - void update(const void* data, const SMaterial& material) const; -}; - -class CCgMaterialRenderer : public IMaterialRenderer, public IMaterialRendererServices -{ -public: - CCgMaterialRenderer(IShaderConstantSetCallBack* callback = 0, IMaterialRenderer* baseMaterial = 0, s32 userData = 0); - virtual ~CCgMaterialRenderer(); - - virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) = 0; - virtual bool OnRender(IMaterialRendererServices* service, E_VERTEX_TYPE vtxtype) = 0; - virtual void OnUnsetMaterial() = 0; - - virtual bool isTransparent() const; - - virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates) = 0; - virtual bool setVertexShaderConstant(const c8* name, const f32* floats, int count); - virtual bool setVertexShaderConstant(const c8* name, const bool* bools, int count); - virtual bool setVertexShaderConstant(const c8* name, const s32* ints, int count); - virtual void setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); - virtual bool setPixelShaderConstant(const c8* name, const f32* floats, int count); - virtual bool setPixelShaderConstant(const c8* name, const bool* bools, int count); - virtual bool setPixelShaderConstant(const c8* name, const s32* ints, int count); - virtual void setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount=1); - virtual IVideoDriver* getVideoDriver() = 0; - -protected: - void getUniformList(); - - IShaderConstantSetCallBack* CallBack; - IMaterialRenderer* BaseMaterial; - s32 UserData; - - core::array UniformInfo; - - CGprogram VertexProgram; - CGprogram FragmentProgram; - CGprogram GeometryProgram; - CGprofile VertexProfile; - CGprofile FragmentProfile; - CGprofile GeometryProfile; - - SMaterial Material; - CGerror Error; -}; - -} -} - -#endif -#endif diff --git a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp index 0306be831..e99b5fb44 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp @@ -50,10 +50,6 @@ COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params, #ifdef _DEBUG setDebugName("COpenGLDriver"); #endif - - #ifdef _IRR_COMPILE_WITH_CG_ - CgContext = 0; - #endif } @@ -585,10 +581,6 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, setDebugName("COpenGLDriver"); #endif - #ifdef _IRR_COMPILE_WITH_CG_ - CgContext = 0; - #endif - genericDriverInit(); } @@ -611,10 +603,6 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, #ifdef _DEBUG setDebugName("COpenGLDriver"); #endif - - #ifdef _IRR_COMPILE_WITH_CG_ - CgContext = 0; - #endif } @@ -705,10 +693,6 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, setDebugName("COpenGLDriver"); #endif - #ifdef _IRR_COMPILE_WITH_CG_ - CgContext = 0; - #endif - genericDriverInit(); } @@ -718,11 +702,6 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, //! destructor COpenGLDriver::~COpenGLDriver() { - #ifdef _IRR_COMPILE_WITH_CG_ - if (CgContext) - cgDestroyContext(CgContext); - #endif - RequestedLights.clear(); deleteMaterialRenders(); @@ -868,10 +847,6 @@ bool COpenGLDriver::genericDriverInit() // This fixes problems with intermediate changes to the material during texture load. ResetRenderStates = true; - #ifdef _IRR_COMPILE_WITH_CG_ - CgContext = cgCreateContext(); - #endif - return true; } @@ -4091,21 +4066,6 @@ s32 COpenGLDriver::addHighLevelShaderMaterial( { s32 nr = -1; - #ifdef _IRR_COMPILE_WITH_CG_ - if (shadingLang == EGSL_CG) - { - COpenGLCgMaterialRenderer* r = new COpenGLCgMaterialRenderer( - this, nr, - vertexShaderProgram, vertexShaderEntryPointName, vsCompileTarget, - pixelShaderProgram, pixelShaderEntryPointName, psCompileTarget, - geometryShaderProgram, geometryShaderEntryPointName, gsCompileTarget, - inType, outType, verticesOut, - callback,getMaterialRenderer(baseMaterial), userData); - - r->drop(); - } - else - #endif { COpenGLSLMaterialRenderer* r = new COpenGLSLMaterialRenderer( this, nr, @@ -4878,13 +4838,6 @@ GLenum COpenGLDriver::getZBufferBits() const return bits; } -#ifdef _IRR_COMPILE_WITH_CG_ -const CGcontext& COpenGLDriver::getCgContext() -{ - return CgContext; -} -#endif - } // end namespace } // end namespace diff --git a/lib/irrlicht/source/Irrlicht/COpenGLDriver.h b/lib/irrlicht/source/Irrlicht/COpenGLDriver.h index c556bd913..1f3c2c152 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLDriver.h +++ b/lib/irrlicht/source/Irrlicht/COpenGLDriver.h @@ -25,10 +25,6 @@ namespace irr #include "COpenGLExtensionHandler.h" #include "COpenGLTexture.h" -#ifdef _IRR_COMPILE_WITH_CG_ -#include "Cg/cg.h" -#endif - namespace irr { @@ -411,11 +407,6 @@ namespace video //! sets the needed renderstates void setRenderStates3DMode(); - //! Get Cg context - #ifdef _IRR_COMPILE_WITH_CG_ - const CGcontext& getCgContext(); - #endif - private: //! clears the zbuffer and color buffer @@ -600,9 +591,6 @@ namespace video #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_ CIrrDeviceSDL *SDLDevice; #endif - #ifdef _IRR_COMPILE_WITH_CG_ - CGcontext CgContext; - #endif E_DEVICE_TYPE DeviceType; }; diff --git a/lib/irrlicht/source/Irrlicht/COpenGLExtensionHandler.cpp b/lib/irrlicht/source/Irrlicht/COpenGLExtensionHandler.cpp index 0fb0ef71c..095083ef6 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLExtensionHandler.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLExtensionHandler.cpp @@ -791,10 +791,6 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const return (Version>=120) || FeatureAvailable[IRR_EXT_blend_minmax] || FeatureAvailable[IRR_EXT_blend_subtract] || FeatureAvailable[IRR_EXT_blend_logic_op]; case EVDF_TEXTURE_MATRIX: -#ifdef _IRR_COMPILE_WITH_CG_ - // available iff. define is present - case EVDF_CG: -#endif return true; default: return false;