diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index d090d77da..6630be4ca 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -66,6 +66,9 @@ class CScissor; class CViewport; struct CMonitorColorProperties; struct IOcclusionQuery; +class CMultipassCameraEffectInfo; +class IMultipassCameraEffectInfoPriv; +class IMultipassCameraEffect; @@ -807,6 +810,16 @@ public: // return true if driver support non-power of two textures virtual bool supportNonPowerOfTwoTextures() const =0; + /// \name Multipass Camera Effects. Prefer to use CMultipassCameraEffectManager instead of calling these directly. + // @{ + /// Return the number of installed multipass camera effects. + virtual int getMultipassCameraEffectNb() =0; + /// Return information about a specified multipass camera effect. + virtual const CMultipassCameraEffectInfo *getMultipassCameraEffectInfo(int idx) const =0; + /// Create a multipass camera effect with specified id. + virtual IMultipassCameraEffect *createMultipassCameraEffect(int idx) const =0; + // @} + /** get a part of the ZBuffer (back buffer). * NB: 0,0 is the bottom left corner of the screen. * diff --git a/code/nel/include/nel/3d/multipass_camera_effect_info.h b/code/nel/include/nel/3d/multipass_camera_effect_info.h new file mode 100644 index 000000000..bdc8a2bc7 --- /dev/null +++ b/code/nel/include/nel/3d/multipass_camera_effect_info.h @@ -0,0 +1,89 @@ +/** + * \file multipass_camera_effect_info.h + * \brief CMultipassCameraEffectInfo + * \date 2013-06-16 17:27GMT + * \author Jan Boon (Kaetemi) + * CMultipassCameraEffectInfo + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NEVRAX NEL. If not, see + * . + */ + +#ifndef NL3D_MULTIPASS_CAMERA_EFFECT_INFO_H +#define NL3D_MULTIPASS_CAMERA_EFFECT_INFO_H +#include + +// STL includes + +// NeL includes + +// Project includes + +namespace NL3D { + class IMultipassCameraEffect; + +enum TMultipassCameraType +{ + MULTIPASS_CAMERA_UNKNOWN, + /// A multi pass effect used to support stereo displays. + MULTIPASS_CAMERA_STEREO, + /// A multi pass effect which renders at different animation deltas to create a motion blur (experimental). + MULTIPASS_CAMERA_MOTION_BLUR, + /// A multi pass effect which renders with modified camera settings to create depth of field (experimental). + MULTIPASS_CAMERA_DEPTH_OF_FIELD, + // etc. +}; + +/** + * \brief CMultipassCameraEffectInfo + * \date 2013-06-16 17:27GMT + * \author Jan Boon (Kaetemi) + * Information on a multi pass camera effect. + */ +struct CMultipassCameraEffectInfo +{ +public: + CMultipassCameraEffectInfo(); + virtual ~CMultipassCameraEffectInfo(); + + /// Name used in configs etc. Use i18n for storing display name and descriptions. + std::string Name; + + /// Type of multipass. Useful for filtering which ones the user can pick. + TMultipassCameraType Type; + +}; /* class CMultipassCameraEffectInfo */ + +/// Inherit from this class with a class which fills the public +/// information fields and that overrides the create() method. +/// Driver has list of installed IMultipassCameraEffectInfoPriv. +struct IMultipassCameraEffectInfoPriv : public CMultipassCameraEffectInfo +{ +public: + IMultipassCameraEffectInfoPriv(); + virtual ~IMultipassCameraEffectInfoPriv(); + + virtual IMultipassCameraEffect *create() const = 0; +}; + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_MULTIPASS_CAMERA_EFFECT_INFO_H */ + +/* end of file */ diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 412cb52da..d92cd1ffd 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -2999,6 +2999,26 @@ bool CDriverD3D::supportNonPowerOfTwoTextures() const // *************************************************************************** +int CDriverD3D::getMultipassCameraEffectNb() +{ + // Screw D3D. + return 0; +} + +const NL3D::CMultipassCameraEffectInfo *CDriverD3D::getMultipassCameraEffectInfo(int idx) const +{ + // Screw D3D. + return NULL; +} + +NL3D::IMultipassCameraEffect *CDriverD3D::createMultipassCameraEffect(int idx) const +{ + // Screw D3D. + return NULL; +} + +// *************************************************************************** + bool CDriverD3D::fillBuffer (NLMISC::CBitmap &bitmap) { H_AUTO_D3D(CDriverD3D_fillBuffer); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index cff7cb804..992a0efdd 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -832,6 +832,10 @@ public: // return true if driver support non-power of two textures virtual bool supportNonPowerOfTwoTextures() const; + virtual int getMultipassCameraEffectNb(); + virtual const CMultipassCameraEffectInfo *getMultipassCameraEffectInfo(int idx) const; + virtual IMultipassCameraEffect *createMultipassCameraEffect(int idx) const; + // copy the first texture in a second one of different dimensions virtual bool stretchRect (ITexture * srcText, NLMISC::CRect &srcRect, ITexture * destText, NLMISC::CRect &destRect); // Only 32 bits back buffer supported virtual bool isTextureRectangle(ITexture * /* tex */) const {return false;} diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 29e14a1a0..a8a59aae0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -27,6 +27,7 @@ #include "nel/3d/vertex_buffer.h" #include "nel/3d/light.h" #include "nel/3d/index_buffer.h" +#include "nel/3d/multipass_camera_effect_info.h" #include "nel/misc/rect.h" #include "nel/misc/di_event_emitter.h" #include "nel/misc/mouse_device.h" @@ -699,6 +700,34 @@ bool CDriverGL::supportNonPowerOfTwoTextures() const return _Extensions.ARBTextureNonPowerOfTwo; } +// *************************************************************************** + +void CDriverGL::initMultipassCameraEffectInfos() +{ + if (m_MultipassCameraEffectInfos.size() == 0) + { + // Add pointers to static class instances to the list. + } +} + +int CDriverGL::getMultipassCameraEffectNb() +{ + initMultipassCameraEffectInfos(); + return m_MultipassCameraEffectInfos.size(); +} + +const NL3D::CMultipassCameraEffectInfo *CDriverGL::getMultipassCameraEffectInfo(int idx) const +{ + nlassert(idx < m_MultipassCameraEffectInfos.size()); + return static_cast(m_MultipassCameraEffectInfos[idx]); +} + +NL3D::IMultipassCameraEffect *CDriverGL::createMultipassCameraEffect(int idx) const +{ + nlassert(idx < m_MultipassCameraEffectInfos.size()); + return m_MultipassCameraEffectInfos[idx]->create(); +} + // *************************************************************************** bool CDriverGL::isTextureRectangle(ITexture * tex) const { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index bfe73492d..24c9b6688 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -556,6 +556,10 @@ public: // return true if driver support non-power of two textures virtual bool supportNonPowerOfTwoTextures() const; + virtual int getMultipassCameraEffectNb(); + virtual const CMultipassCameraEffectInfo *getMultipassCameraEffectInfo(int idx) const; + virtual IMultipassCameraEffect *createMultipassCameraEffect(int idx) const; + virtual bool activeFrameBufferObject(ITexture * tex); virtual void getZBufferPart (std::vector &zbuffer, NLMISC::CRect &rect); @@ -1491,6 +1495,9 @@ private: */ inline void setupTextureBasicParameters(ITexture &tex); + /// Multipass Camera Effects + void initMultipassCameraEffectInfos(); + std::vector m_MultipassCameraEffectInfos; }; // *************************************************************************** diff --git a/code/nel/src/3d/multipass_camera_effect_info.cpp b/code/nel/src/3d/multipass_camera_effect_info.cpp new file mode 100644 index 000000000..971dca52b --- /dev/null +++ b/code/nel/src/3d/multipass_camera_effect_info.cpp @@ -0,0 +1,65 @@ +/** + * \file multipass_camera_effect_info.cpp + * \brief CMultipassCameraEffectInfo + * \date 2013-06-16 17:27GMT + * \author Jan Boon (Kaetemi) + * CMultipassCameraEffectInfo + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NEVRAX NEL. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +CMultipassCameraEffectInfo::CMultipassCameraEffectInfo() +{ + +} + +CMultipassCameraEffectInfo::~CMultipassCameraEffectInfo() +{ + +} + +IMultipassCameraEffectInfoPriv::IMultipassCameraEffectInfoPriv() +{ + +} + +IMultipassCameraEffectInfoPriv::~IMultipassCameraEffectInfoPriv() +{ + +} + +} /* namespace NL3D */ + +/* end of file */