engine/include/Render/SalmonRender/SalmonRenderInterface.h

132 lines
3.5 KiB
C
Raw Permalink Normal View History

2013-01-19 20:02:34 +00:00
#ifndef SALMON_RENDER_INTERFACE_H_INCLUDED
#define SALMON_RENDER_INTERFACE_H_INCLUDED
#include "include/Utils/Utils.h"
#include "include/SimpleLand/SimpleLand.h"
#include "include/Render/RenderMisc.h"
#include "include/Render/SalmonRender/BackgroundCubemap.h"
2013-01-27 21:31:32 +00:00
#include "include/Render/SalmonRender/Cameras.h"
2013-01-23 20:58:15 +00:00
2013-01-27 21:31:32 +00:00
namespace SE
2013-01-23 20:58:15 +00:00
{
2013-02-10 19:08:19 +00:00
class TSalmonRendererInterface
2013-01-19 20:02:34 +00:00
{
protected:
2013-02-10 19:08:19 +00:00
int ScreenWidth;
int ScreenHeight;
float MatrixWidth;
float MatrixHeight;
mat4 ProjectionModelviewMatrix;
std::stack<mat4> ProjectionMatrixStack;
std::stack<mat4> ModelviewMatrixStack;
2013-01-19 20:02:34 +00:00
mat4 CamModelViewMatrix;
mat4 CamInversedModelViewMatrix;
float GlobalShadowAreaHalfSize;
2013-01-28 10:40:28 +00:00
vec3 CamPos; //Do not change - call CalcCamPos instead
2013-02-10 19:08:19 +00:00
virtual void TryEnableVertexAttribArrays();
virtual void TryDisableVertexAttribArrays();
2013-01-19 20:02:34 +00:00
virtual void DrawQuad(const T2DQuad& quad) = 0;
2013-02-10 19:08:19 +00:00
2013-01-19 20:02:34 +00:00
public:
2013-01-28 10:40:28 +00:00
TCamera Camera;
2013-01-23 20:58:15 +00:00
2013-01-19 20:02:34 +00:00
TSalmonRendererInterface();
virtual void InitOpenGL(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight);
2013-01-28 10:40:28 +00:00
vec3 GetCamShift();
vec3 GetCamVec();
vec3 GetCamPos();
void CalcCamPos();
2013-01-23 20:58:15 +00:00
2013-01-19 20:02:34 +00:00
virtual void SetUniforms();
2013-02-10 19:08:19 +00:00
virtual int GetScreenWidth();
virtual int GetScreenHeight();
virtual float GetMatrixWidth();
virtual float GetMatrixHeight();
virtual void SetMatrixWidth(float matrixWidth);
virtual void SetMatrixHeight(float matrixHeight);
virtual void PushMatrix();
virtual void LoadIdentity();
virtual void TranslateMatrix(const vec3& p);
virtual void ScaleMatrix(float scale);
virtual void ScaleMatrix(const vec3& scale);
virtual void RotateMatrix(const vec4& q);
virtual void PushSpecialMatrix(const mat4& m);
virtual void PopMatrix();
virtual void SetProjectionMatrix(float width, float height);
virtual void PushProjectionMatrix(float width, float height);
virtual void PopProjectionMatrix();
virtual void SetFrameViewport(const std::string& frameName);
virtual void SetFullScreenViewport();
2013-01-19 20:02:34 +00:00
void SetPerspectiveFullScreenViewport();
void SetOrthoFullScreenViewport();
2013-01-27 21:31:32 +00:00
void SetPerspectiveProjection(float angle = pi/6.f, float zNear = 1.f, float zFar = 100.f);
void SetOrthoProjection();
2013-01-19 20:02:34 +00:00
mat4 GetModelviewMatrix();
void SetPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
void PushPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
void SetGLCamView();
void SetGlIdentityView();
void SetGlPosXView();
void SetGlNegXView();
void SetGlPosYView();
void SetGlNegYView();
void SetGlPosZView();
void SetGlNegZView();
virtual void SwitchToScreen();
virtual void SwitchToFrameBuffer(const std::string& frameName);
void SwitchToCubemapBuffer(const std::string& frameName,cardinal cubeSide);
void BeginDrawToDepthBufferGlobal(std::string& globalBufferName);
void BeginDrawToDepthBufferLocal(std::string& localBufferName);
void EndDrawToDepthBuffer();
2013-02-10 19:08:19 +00:00
virtual void PushShader(const std::string& shaderName);
virtual void PopShader();
virtual void DrawRect(const vec2& p1, const vec2& p2);
virtual void DrawRect(const vec2& p1, const vec2& p2, const vec2& t1, const vec2& t2);
virtual void DrawTriangleList(const TTriangleList& triangleList) = 0;
void DrawFrameFullScreen(const std::string& frameName);
void DrawFramePartScreen(const std::string& frameName, vec2 posFrom, vec2 posTo); //To draw water. posFrom and posTo goes from 0 to 1
2013-01-19 20:02:34 +00:00
};
} //namespace SE
#endif