Finally cubemap is working
This commit is contained in:
1 parent
ef92c70ae8
commit
84ee2dc70c
16 files changed
+399
-99
No files matched your search
@@ -59,7 +59,8 @@ protected:
|
||||
cardinal TexID;
|
||||
cardinal NormTexID;
|
||||
|
||||
TTriangleList TriangleList;
|
||||
//TTriangleList TriangleList;
|
||||
VertexDataStruct vertexDataStruct;
|
||||
|
||||
mat3 ShaderRotateMatrix;
|
||||
vec3 ShaderTranslateVector;
|
||||
|
||||
@@ -75,6 +75,10 @@ extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
|
||||
extern PFNGLMAPBUFFERPROC glMapBuffer;
|
||||
extern PFNGLUNMAPBUFFERPROC glUnmapBuffer;
|
||||
|
||||
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
|
||||
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
|
||||
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArray;
|
||||
|
||||
//=========================================
|
||||
//============ Frame buffer ===============
|
||||
//=========================================
|
||||
|
||||
@@ -20,6 +20,48 @@
|
||||
namespace SE
|
||||
{
|
||||
|
||||
class VBOHolder {
|
||||
GLuint Buffer;
|
||||
|
||||
public:
|
||||
VBOHolder();
|
||||
|
||||
VBOHolder(const VBOHolder& v) = delete;
|
||||
|
||||
VBOHolder& operator=(const VBOHolder& v) = delete;
|
||||
|
||||
~VBOHolder();
|
||||
|
||||
GLuint getBuffer();
|
||||
};
|
||||
|
||||
class VAOHolder {
|
||||
GLuint vao;
|
||||
|
||||
public:
|
||||
VAOHolder();
|
||||
|
||||
VAOHolder(const VAOHolder& v) = delete;
|
||||
|
||||
VAOHolder& operator=(const VAOHolder& v) = delete;
|
||||
|
||||
~VAOHolder();
|
||||
|
||||
GLuint getBuffer();
|
||||
};
|
||||
|
||||
struct VertexDataStruct
|
||||
{
|
||||
std::vector<vec3> PositionData;
|
||||
std::vector<vec2> TexCoordData;
|
||||
|
||||
std::shared_ptr<VAOHolder> vao;
|
||||
std::shared_ptr<VBOHolder> positionVBO;
|
||||
std::shared_ptr<VBOHolder> texCoordVBO;
|
||||
|
||||
void RefreshVBO();
|
||||
};
|
||||
|
||||
struct T2DQuad
|
||||
{
|
||||
vec3 VertexCoord[4];
|
||||
@@ -58,6 +100,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef TARGET_WIN32
|
||||
|
||||
class VBOObject //Must stay in shared ptr only!
|
||||
@@ -75,6 +118,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void DrawVertexDataStruct(const VertexDataStruct& vertexDataStruct);
|
||||
|
||||
class TTriangleList : public TTriangleListAncestor //Implementation differs for Windows and Android
|
||||
{
|
||||
|
||||
@@ -33,6 +33,11 @@ protected:
|
||||
cardinal BkgTexID;
|
||||
std::string BkgShaderName;
|
||||
|
||||
float FogBeginDistance;
|
||||
float FogEndDistance;
|
||||
vec4 FogColor;
|
||||
|
||||
|
||||
void CalcCamPosVec();
|
||||
|
||||
virtual void DrawQuad(const T2DQuad& quad) = 0;
|
||||
@@ -52,6 +57,7 @@ public:
|
||||
void SetPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
|
||||
void PushPerspectiveProjectionMatrix(float angle, float aspect, float zNear, float zFar);
|
||||
|
||||
void SetGLCamAngleView();
|
||||
void SetGLCamView();
|
||||
void SetGlIdentityView();
|
||||
void SetGlPosXView();
|
||||
@@ -86,6 +92,14 @@ public:
|
||||
void SetBackgroundShader(const std::string& shaderName) { BkgShaderName = shaderName; }
|
||||
|
||||
void DrawBackground();
|
||||
|
||||
float GetFogBeginDistance();
|
||||
float GetFogEndDistance();
|
||||
vec4 GetFogColor();
|
||||
|
||||
|
||||
void SetFogBeginDistance(float distance);
|
||||
void SetFogEndDistance(float distance);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@ protected:
|
||||
bool IsCameraTransparentToLand; //To make it work you must setup LandToCalcCollision
|
||||
TSimpleLandClass* LandToCalcCollision;
|
||||
|
||||
float FogBeginDistance;
|
||||
float FogEndDistance;
|
||||
vec4 FogColor;
|
||||
|
||||
|
||||
//Other data:
|
||||
|
||||
float ShadowClampValue;
|
||||
@@ -44,10 +39,7 @@ public:
|
||||
|
||||
float GetShadowClampValue();
|
||||
void SetShadowClampValue(float shadowClampValue);
|
||||
|
||||
float GetFogBeginDistance();
|
||||
float GetFogEndDistance();
|
||||
vec4 GetFogColor();
|
||||
|
||||
|
||||
void DrawTriangleList(const TTriangleList& triangleList);
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ private:
|
||||
cardinal NormTexID;
|
||||
|
||||
//For VBO:
|
||||
/*
|
||||
std::vector<word> IndexArr;
|
||||
TVBOLandVertex VBOLandVertexArr;
|
||||
|
||||
@@ -64,7 +65,8 @@ private:
|
||||
cardinal NormBuffer;
|
||||
cardinal TangentBuffer;
|
||||
cardinal BinormBuffer;
|
||||
cardinal TexcoordBuffer;
|
||||
cardinal TexcoordBuffer;*/
|
||||
VertexDataStruct vertexDataStruct;
|
||||
|
||||
void CreateVBO();
|
||||
void FreeVBO();
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
cardinal AddTexture(const std::string& fileName, std::string texName = ""); //Adds path to resources to the filename then call previous one
|
||||
cardinal AddTextureFromUserdata(const std::string& fileName, std::string texName = ""); //Same as above but checks if file is created in user data
|
||||
|
||||
cardinal AddCubemapTexture(std::string filename[6]); // "posx.bmp","negx.bmp","posy.bmp","negy.bmp","posz.bmp","negz.bmp"
|
||||
cardinal AddCubemapTexture(std::array<std::string, 6> filename); // "posx.bmp","negx.bmp","posy.bmp","negy.bmp","posz.bmp","negz.bmp"
|
||||
|
||||
|
||||
cardinal AddEmptyTexture(const std::string& texName, cardinal width, cardinal height);
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
tvec3<TYPENAME1>& operator-=(const tvec3<TYPENAME1>& vc);
|
||||
tvec3<TYPENAME1> operator+(const tvec3<TYPENAME1>& a) const;
|
||||
tvec3<TYPENAME1> operator-(const tvec3<TYPENAME1>& a) const;
|
||||
tvec3<TYPENAME1>& operator-();
|
||||
tvec3<TYPENAME1> operator-();
|
||||
tvec3<TYPENAME1>& operator*=(TYPENAME1 c);
|
||||
tvec3<TYPENAME1> operator*(const tmat3<TYPENAME1>& mt) const; //MultRowMatrix()
|
||||
};
|
||||
@@ -440,13 +440,14 @@ inline tvec3<TYPENAME1> tvec3<TYPENAME1>::operator-(const tvec3<TYPENAME1>& a) c
|
||||
}
|
||||
|
||||
template<typename TYPENAME1>
|
||||
inline tvec3<TYPENAME1>& tvec3<TYPENAME1>::operator-()
|
||||
tvec3<TYPENAME1> tvec3<TYPENAME1>::operator-()
|
||||
{
|
||||
v[0] = -v[0];
|
||||
v[1] = -v[1];
|
||||
v[2] = -v[2];
|
||||
tvec3<TYPENAME1> result;
|
||||
result.v[0] = -v[0];
|
||||
result.v[1] = -v[1];
|
||||
result.v[2] = -v[2];
|
||||
|
||||
return *this;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename TYPENAME1>
|
||||
|
||||
Reference in new issue
Block a user