2015-07-26 21:39:49 +00:00
|
|
|
#ifndef CRENDERER_H
|
|
|
|
#define CRENDERER_H
|
|
|
|
|
|
|
|
#include <gl/glew.h>
|
|
|
|
|
|
|
|
#include "CCamera.h"
|
|
|
|
#include "CGraphics.h"
|
|
|
|
#include "CRenderBucket.h"
|
|
|
|
#include "ERenderOptions.h"
|
|
|
|
#include "ERenderCommand.h"
|
2015-08-15 04:04:56 +00:00
|
|
|
#include "SRenderablePtr.h"
|
2015-11-25 21:37:34 +00:00
|
|
|
#include "SViewInfo.h"
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <Common/CAABox.h>
|
|
|
|
#include <Common/CColor.h>
|
|
|
|
#include <Common/CMatrix4f.h>
|
|
|
|
#include <Common/types.h>
|
|
|
|
#include <OpenGL/CFramebuffer.h>
|
|
|
|
#include <Resource/CFont.h>
|
|
|
|
#include <Resource/CLight.h>
|
|
|
|
#include <Resource/CTexture.h>
|
|
|
|
#include <Scene/CSceneNode.h>
|
|
|
|
|
|
|
|
class CRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum EBloomMode {
|
2015-07-28 16:22:08 +00:00
|
|
|
eNoBloom, eBloom, eBloomMaps, eFakeBloom
|
2015-07-26 21:39:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
ERenderOptions mOptions;
|
|
|
|
EBloomMode mBloomMode;
|
|
|
|
bool mDrawGrid;
|
|
|
|
CColor mClearColor;
|
|
|
|
u32 mContextIndex;
|
|
|
|
CRenderBucket mOpaqueBucket;
|
|
|
|
CRenderBucket mTransparentBucket;
|
|
|
|
bool mInitialized;
|
|
|
|
u32 mViewportWidth, mViewportHeight;
|
|
|
|
u32 mBloomWidth, mBloomHeight;
|
|
|
|
float mBloomHScale, mBloomVScale;
|
|
|
|
|
|
|
|
CFramebuffer mSceneFramebuffer;
|
|
|
|
CFramebuffer mBloomFramebuffers[3];
|
|
|
|
GLint mDefaultFramebuffer;
|
|
|
|
|
|
|
|
// Static Members
|
|
|
|
static u32 sNumRenderers;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Initialization
|
|
|
|
CRenderer();
|
|
|
|
~CRenderer();
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// Getters/Setters
|
2015-11-25 21:37:34 +00:00
|
|
|
ERenderOptions RenderOptions() const;
|
2015-09-26 22:55:14 +00:00
|
|
|
void ToggleWorld(bool b);
|
|
|
|
void ToggleWorldCollision(bool b);
|
|
|
|
void ToggleObjects(bool b);
|
|
|
|
void ToggleObjectCollision(bool b);
|
|
|
|
void ToggleLights(bool b);
|
|
|
|
void ToggleSky(bool b);
|
2015-07-26 21:39:49 +00:00
|
|
|
void ToggleBackfaceCull(bool b);
|
|
|
|
void ToggleUVAnimation(bool b);
|
|
|
|
void ToggleGrid(bool b);
|
|
|
|
void ToggleOccluders(bool b);
|
|
|
|
void ToggleAlphaDisabled(bool b);
|
|
|
|
void SetBloom(EBloomMode BloomMode);
|
|
|
|
void SetFont(CFont *pFont);
|
|
|
|
void SetClearColor(CColor Clear);
|
|
|
|
void SetViewportSize(u32 Width, u32 Height);
|
|
|
|
|
|
|
|
// Render
|
2015-11-25 21:37:34 +00:00
|
|
|
void RenderBuckets(const SViewInfo& ViewInfo);
|
2015-07-26 21:39:49 +00:00
|
|
|
void RenderBloom();
|
2015-11-25 21:37:34 +00:00
|
|
|
void RenderSky(CModel *pSkyboxModel, const SViewInfo& ViewInfo);
|
2015-11-27 23:28:35 +00:00
|
|
|
void AddOpaqueMesh(IRenderable *pRenderable, int AssetID, CAABox& AABox, ERenderCommand Command);
|
|
|
|
void AddTransparentMesh(IRenderable *pRenderable, int AssetID, CAABox& AABox, ERenderCommand Command);
|
2015-07-26 21:39:49 +00:00
|
|
|
void BeginFrame();
|
|
|
|
void EndFrame();
|
2015-08-20 01:01:58 +00:00
|
|
|
void ClearDepthBuffer();
|
2015-07-26 21:39:49 +00:00
|
|
|
|
|
|
|
// Private
|
|
|
|
private:
|
|
|
|
void InitFramebuffer();
|
|
|
|
};
|
|
|
|
|
|
|
|
extern u32 gDrawCount;
|
|
|
|
|
|
|
|
#endif // RENDERMANAGER_H
|