mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-07 07:49:02 +00:00
Add info structure for multipass camera rendering effects #43
This commit is contained in:
parent
5fa4beab46
commit
abdeee4b81
7 changed files with 227 additions and 0 deletions
|
@ -66,6 +66,9 @@ class CScissor;
|
||||||
class CViewport;
|
class CViewport;
|
||||||
struct CMonitorColorProperties;
|
struct CMonitorColorProperties;
|
||||||
struct IOcclusionQuery;
|
struct IOcclusionQuery;
|
||||||
|
class CMultipassCameraEffectInfo;
|
||||||
|
class IMultipassCameraEffectInfoPriv;
|
||||||
|
class IMultipassCameraEffect;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -807,6 +810,16 @@ public:
|
||||||
// return true if driver support non-power of two textures
|
// return true if driver support non-power of two textures
|
||||||
virtual bool supportNonPowerOfTwoTextures() const =0;
|
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).
|
/** get a part of the ZBuffer (back buffer).
|
||||||
* NB: 0,0 is the bottom left corner of the screen.
|
* NB: 0,0 is the bottom left corner of the screen.
|
||||||
*
|
*
|
||||||
|
|
89
code/nel/include/nel/3d/multipass_camera_effect_info.h
Normal file
89
code/nel/include/nel/3d/multipass_camera_effect_info.h
Normal file
|
@ -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
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NL3D_MULTIPASS_CAMERA_EFFECT_INFO_H
|
||||||
|
#define NL3D_MULTIPASS_CAMERA_EFFECT_INFO_H
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
|
||||||
|
// 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 */
|
|
@ -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)
|
bool CDriverD3D::fillBuffer (NLMISC::CBitmap &bitmap)
|
||||||
{
|
{
|
||||||
H_AUTO_D3D(CDriverD3D_fillBuffer);
|
H_AUTO_D3D(CDriverD3D_fillBuffer);
|
||||||
|
|
|
@ -832,6 +832,10 @@ public:
|
||||||
// return true if driver support non-power of two textures
|
// return true if driver support non-power of two textures
|
||||||
virtual bool supportNonPowerOfTwoTextures() const;
|
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
|
// 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 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;}
|
virtual bool isTextureRectangle(ITexture * /* tex */) const {return false;}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "nel/3d/vertex_buffer.h"
|
#include "nel/3d/vertex_buffer.h"
|
||||||
#include "nel/3d/light.h"
|
#include "nel/3d/light.h"
|
||||||
#include "nel/3d/index_buffer.h"
|
#include "nel/3d/index_buffer.h"
|
||||||
|
#include "nel/3d/multipass_camera_effect_info.h"
|
||||||
#include "nel/misc/rect.h"
|
#include "nel/misc/rect.h"
|
||||||
#include "nel/misc/di_event_emitter.h"
|
#include "nel/misc/di_event_emitter.h"
|
||||||
#include "nel/misc/mouse_device.h"
|
#include "nel/misc/mouse_device.h"
|
||||||
|
@ -699,6 +700,34 @@ bool CDriverGL::supportNonPowerOfTwoTextures() const
|
||||||
return _Extensions.ARBTextureNonPowerOfTwo;
|
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<const NL3D::CMultipassCameraEffectInfo *>(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
|
bool CDriverGL::isTextureRectangle(ITexture * tex) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -556,6 +556,10 @@ public:
|
||||||
// return true if driver support non-power of two textures
|
// return true if driver support non-power of two textures
|
||||||
virtual bool supportNonPowerOfTwoTextures() const;
|
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 bool activeFrameBufferObject(ITexture * tex);
|
||||||
|
|
||||||
virtual void getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rect);
|
virtual void getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rect);
|
||||||
|
@ -1491,6 +1495,9 @@ private:
|
||||||
*/
|
*/
|
||||||
inline void setupTextureBasicParameters(ITexture &tex);
|
inline void setupTextureBasicParameters(ITexture &tex);
|
||||||
|
|
||||||
|
/// Multipass Camera Effects
|
||||||
|
void initMultipassCameraEffectInfos();
|
||||||
|
std::vector<const IMultipassCameraEffectInfoPriv *> m_MultipassCameraEffectInfos;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
65
code/nel/src/3d/multipass_camera_effect_info.cpp
Normal file
65
code/nel/src/3d/multipass_camera_effect_info.cpp
Normal file
|
@ -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
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <nel/misc/types_nl.h>
|
||||||
|
#include <nel/3d/multipass_camera_effect_info.h>
|
||||||
|
|
||||||
|
// STL includes
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
// #include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
// using namespace NLMISC;
|
||||||
|
|
||||||
|
namespace NL3D {
|
||||||
|
|
||||||
|
CMultipassCameraEffectInfo::CMultipassCameraEffectInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMultipassCameraEffectInfo::~CMultipassCameraEffectInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMultipassCameraEffectInfoPriv::IMultipassCameraEffectInfoPriv()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMultipassCameraEffectInfoPriv::~IMultipassCameraEffectInfoPriv()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace NL3D */
|
||||||
|
|
||||||
|
/* end of file */
|
Loading…
Reference in a new issue