not need this
This commit is contained in:
1 parent
1ba2538baf
commit
bfdaef5643
7 files changed
+404
-437
No files matched your search
@@ -1,81 +0,0 @@
|
||||
#ifndef RENDER_INTERFACE_H_INCLUDED
|
||||
#define RENDER_INTERFACE_H_INCLUDED
|
||||
|
||||
|
||||
#include "include/Utils/Utils.h"
|
||||
#include "include/Render/RenderMisc.h"
|
||||
#include "include/Render/RenderParams.h"
|
||||
|
||||
namespace SE
|
||||
{
|
||||
|
||||
class TRendererInterface
|
||||
{
|
||||
protected:
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
|
||||
float MatrixWidth;
|
||||
float MatrixHeight;
|
||||
|
||||
mat4 ProjectionModelviewMatrix;
|
||||
|
||||
std::stack<mat4> ProjectionMatrixStack;
|
||||
std::stack<mat4> ModelviewMatrixStack;
|
||||
|
||||
virtual void TryEnableVertexAttribArrays();
|
||||
virtual void TryDisableVertexAttribArrays();
|
||||
virtual void DrawQuad(const T2DQuad& quad) = 0;
|
||||
public:
|
||||
TRendererInterface();
|
||||
virtual ~TRendererInterface() { }
|
||||
|
||||
virtual void InitOpenGL(int screenWidth, int screenHeight, float matrixWidth, float matrixHeight) = 0;
|
||||
|
||||
virtual int GetScreenWidth();
|
||||
virtual int GetScreenHeight();
|
||||
|
||||
virtual float GetMatrixWidth();
|
||||
virtual float GetMatrixHeight();
|
||||
|
||||
virtual void SetMatrixWidth(float matrixWidth);
|
||||
virtual void SetMatrixHeight(float matrixHeight);
|
||||
|
||||
virtual void SetScreenWidthHeight(int screenWidth, int screenHeight);
|
||||
|
||||
virtual void SetUniforms() = 0;
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
|
||||
virtual void SwitchToScreen() = 0;
|
||||
virtual void SwitchToFrameBuffer(const std::string& frameName) = 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
|
||||
|
||||
};
|
||||
|
||||
} //namespace SE
|
||||
|
||||
#endif
|
||||
@@ -115,29 +115,46 @@ class TTriangleList : public TTriangleListAncestor
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void FillVertexCoordVec(std::vector<vec3>& coordVec, int pos, vec2 posFrom, vec2 posTo);
|
||||
|
||||
void FillTexCoordVec(std::vector<vec2>& coordVec, int pos, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
|
||||
|
||||
void FillVertexCoordVec(std::vector<vec3>& coordVec, int pos, vec2 posFrom, vec2 posTo);
|
||||
//Adds rect points (6 vertices) into coordVec
|
||||
|
||||
void FillTexCoordVec(std::vector<vec2>& coordVec, int pos, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
//Adds rect points (6 tex coords) into coordVec
|
||||
|
||||
std::vector<vec3> MakeVertexCoordVec(vec2 posFrom, vec2 posTo);
|
||||
//Creates array of rect (6 vertices)
|
||||
|
||||
std::vector<vec2> MakeTexCoordVec(vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
|
||||
//Creates array of rect (6 tex coords)
|
||||
|
||||
TDataTriangleList MakeDataTriangleList(vec2 posFrom, vec2 posTo, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
//Creates a DataTriangleList just containing rect
|
||||
|
||||
void MoveDataTriangleList(TDataTriangleList& triangleList, vec3 shift);
|
||||
//Translates all points in DataTriangleList with shift vector
|
||||
|
||||
void RotateDataTriangleList(TDataTriangleList& triangleList, const mat3& m);
|
||||
//Rotates all points in triangleList with rotation matrix
|
||||
|
||||
void ScaleDataTriangleList(TDataTriangleList& triangleList, float scale);
|
||||
//Scales all points in triangleList by scale value
|
||||
|
||||
void ScaleDataTriangleList(TDataTriangleList& triangleList, vec3 scaleVec);
|
||||
//Scales all points in triangleList by scaleVec vector
|
||||
|
||||
TDataTriangleList& ClearDataTriangleList(TDataTriangleList& triangleList);
|
||||
//Clears triangle list, returning itself
|
||||
|
||||
TDataTriangleList& InsertIntoDataTriangleList(TDataTriangleList& triangleList, const std::vector<vec3>& vertexArr, const std::vector<vec2>& texCoordArr);
|
||||
//Inserts additional points and their tex coords into triangle list
|
||||
|
||||
void Replace6PointsInTriangleList(TDataTriangleList& triangleList, int pos, vec2 posFrom, vec2 posTo, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
|
||||
//Replaces one rect in triangleList at position pos by new rect. pos is position in array for first vertex of a rectangle
|
||||
|
||||
TTriangleList MakeTriangleList(vec2 posFrom, vec2 posTo, vec2 texCoordFrom = vec2(0,0), vec2 texCoordTo = vec2(1,1));
|
||||
//Creates triangle list containing rect
|
||||
|
||||
void CheckGlError(const std::string& msg = "");
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "include/Render/SalmonRender/BackgroundCubemap.h"
|
||||
|
||||
#include "include/Render/RenderInterface.h"
|
||||
|
||||
#include "include/Render/SalmonRender/Cameras.h"
|
||||
|
||||
namespace SE
|
||||
@@ -18,9 +16,20 @@ namespace SE
|
||||
|
||||
|
||||
|
||||
class TSalmonRendererInterface : public TRendererInterface
|
||||
class TSalmonRendererInterface
|
||||
{
|
||||
protected:
|
||||
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
|
||||
float MatrixWidth;
|
||||
float MatrixHeight;
|
||||
|
||||
mat4 ProjectionModelviewMatrix;
|
||||
|
||||
std::stack<mat4> ProjectionMatrixStack;
|
||||
std::stack<mat4> ModelviewMatrixStack;
|
||||
|
||||
mat4 CamModelViewMatrix;
|
||||
mat4 CamInversedModelViewMatrix;
|
||||
@@ -29,7 +38,11 @@ protected:
|
||||
|
||||
vec3 CamPos; //Do not change - call CalcCamPos instead
|
||||
|
||||
|
||||
virtual void TryEnableVertexAttribArrays();
|
||||
virtual void TryDisableVertexAttribArrays();
|
||||
virtual void DrawQuad(const T2DQuad& quad) = 0;
|
||||
|
||||
public:
|
||||
|
||||
TCamera Camera;
|
||||
@@ -48,6 +61,31 @@ public:
|
||||
|
||||
virtual void SetUniforms();
|
||||
|
||||
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();
|
||||
|
||||
void SetPerspectiveFullScreenViewport();
|
||||
void SetOrthoFullScreenViewport();
|
||||
|
||||
@@ -76,6 +114,16 @@ public:
|
||||
void BeginDrawToDepthBufferGlobal(std::string& globalBufferName);
|
||||
void BeginDrawToDepthBufferLocal(std::string& localBufferName);
|
||||
void EndDrawToDepthBuffer();
|
||||
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user