Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d218d158f1 | ||
|
737b30e8ec | ||
|
79cfbeada3 | ||
|
84ee2dc70c | ||
|
ef92c70ae8 |
@ -23,17 +23,20 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_nosound|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
4
Halibut Engine/Halibut Engine.vcxproj.user
Normal file
4
Halibut Engine/Halibut Engine.vcxproj.user
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
@ -94,17 +94,20 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_nosound|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
@ -135,8 +138,8 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_52_0;$(LibsPath)\openal\OpenAL11_windows_sdk;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;$(LibsPath)\DirectXsdk\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NOSOUND;TARGET_SALMON;TARGET_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501;DEBUG</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..;C:\Boost\include\boost-1_84;..\..\lpng1510</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
12146
gl/glext.h
Normal file
12146
gl/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
{
|
||||
|
@ -30,6 +30,14 @@ protected:
|
||||
|
||||
float GlobalShadowAreaHalfSize;
|
||||
|
||||
cardinal BkgTexID;
|
||||
std::string BkgShaderName;
|
||||
|
||||
float FogBeginDistance;
|
||||
float FogEndDistance;
|
||||
vec4 FogColor;
|
||||
|
||||
|
||||
void CalcCamPosVec();
|
||||
|
||||
virtual void DrawQuad(const T2DQuad& quad) = 0;
|
||||
@ -49,14 +57,15 @@ 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();
|
||||
void SetGlNegXView();
|
||||
void SetGlPosYView();
|
||||
void SetGlNegYView();
|
||||
void SetGlPosZView();
|
||||
void SetGlNegZView();
|
||||
void SetGlPosXView(bool translate = true, bool renderToFrame = false);
|
||||
void SetGlNegXView(bool translate = true, bool renderToFrame = false);
|
||||
void SetGlPosYView(bool translate = true, bool renderToFrame = false);
|
||||
void SetGlNegYView(bool translate = true, bool renderToFrame = false);
|
||||
void SetGlPosZView(bool translate = true, bool renderToFrame = false);
|
||||
void SetGlNegZView(bool translate = true, bool renderToFrame = false);
|
||||
|
||||
|
||||
void MoveAlpha(float dAlpha);
|
||||
@ -79,6 +88,19 @@ public:
|
||||
void BeginDrawToDepthBufferLocal(std::string& localBufferName);
|
||||
void EndDrawToDepthBuffer();
|
||||
|
||||
void SetBackgroundCubemap(cardinal bkgTex) { BkgTexID = bkgTex; }
|
||||
void SetBackgroundShader(const std::string& shaderName) { BkgShaderName = shaderName; }
|
||||
|
||||
void DrawBackground();
|
||||
|
||||
float GetFogBeginDistance();
|
||||
float GetFogEndDistance();
|
||||
vec4 GetFogColor();
|
||||
|
||||
|
||||
void SetFogBeginDistance(float distance);
|
||||
void SetFogEndDistance(float distance);
|
||||
|
||||
};
|
||||
|
||||
} //namespace SE
|
||||
|
@ -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;
|
||||
@ -45,9 +40,6 @@ public:
|
||||
float GetShadowClampValue();
|
||||
void SetShadowClampValue(float shadowClampValue);
|
||||
|
||||
float GetFogBeginDistance();
|
||||
float GetFogEndDistance();
|
||||
vec4 GetFogColor();
|
||||
|
||||
void DrawTriangleList(const TTriangleList& triangleList);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SCRIPT_MANAGER_H_INCLUDED
|
||||
#define SCRIPT_MANAGER_H_INCLUDED
|
||||
|
||||
#include "sqplus.h"
|
||||
//#include "sqplus.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@ -44,22 +44,23 @@ public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TScriptManager : public TSerializeInterface
|
||||
{
|
||||
protected:
|
||||
HSQUIRRELVM virtualMachine;
|
||||
//HSQUIRRELVM virtualMachine;
|
||||
std::map<std::string, TScriptInfo> FuncInfoMap;
|
||||
|
||||
template<typename T1,typename T2>
|
||||
void RegisterFunc(T1& object, T2 method, const std::string& funcName)
|
||||
{
|
||||
SqPlus::RegisterGlobal(virtualMachine, object, method, _SC(funcName.c_str()));
|
||||
//SqPlus::RegisterGlobal(virtualMachine, object, method, _SC(funcName.c_str()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void RegisterFunc(T globalFunc, const std::string& funcName)
|
||||
{
|
||||
SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str()));
|
||||
//SqPlus::RegisterGlobal(virtualMachine, globalFunc, _SC(funcName.c_str()));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -103,9 +104,9 @@ public:
|
||||
|
||||
|
||||
|
||||
void SQ_Print(const SQChar *inString);
|
||||
void SQ_PrintWidgetList();
|
||||
void SQ_MoveWidget(const SQChar *widgetName, float x, float y);
|
||||
//void SQ_Print(const SQChar *inString);
|
||||
//void SQ_PrintWidgetList();
|
||||
//void SQ_MoveWidget(const SQChar *widgetName, float x, float y);
|
||||
//void SQ_PrintTextureList();
|
||||
//void SQ_PrintAnimationList();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename TYPENAME>
|
||||
boost::signal<void(const TYPENAME&)>& GetSignal(const std::string& dictName, const std::string& valueName)
|
||||
boost::signals2::signal<void(const TYPENAME&)>& GetSignal(const std::string& dictName, const std::string& valueName)
|
||||
{
|
||||
return boost::get<std::shared_ptr<TBindableVar<TYPENAME>>>(GetSmartValue(dictName, valueName))->OnVarChanged;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef BINDABLE_VAR_H_INCLUDED
|
||||
#define BINDABLE_VAR_H_INCLUDED
|
||||
|
||||
#include "boost/signal.hpp"
|
||||
#include "boost/signals2.hpp"
|
||||
#include "boost/variant.hpp"
|
||||
|
||||
namespace SE
|
||||
@ -17,7 +17,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
boost::signal<void(const TYPENAME&)> OnVarChanged;
|
||||
boost::signals2::signal<void(const TYPENAME&)> OnVarChanged;
|
||||
|
||||
TBindableVar()
|
||||
{
|
||||
|
@ -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>
|
||||
|
@ -14,7 +14,7 @@ This code combines additional routines (such as console/log, exceptions, math ut
|
||||
|
||||
#include "boost/asio.hpp"
|
||||
#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
#include "boost/signal.hpp"
|
||||
#include "boost/signals2.hpp"
|
||||
|
||||
|
||||
#include "include/Utils/Console/Console.h"
|
||||
|
@ -554,7 +554,7 @@ void TAnimModel::RecalcVertexPos()
|
||||
}
|
||||
|
||||
//LiteModel.VertexArr[i] = px;
|
||||
LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] = px;
|
||||
//LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] = px;
|
||||
|
||||
/*
|
||||
//Normal
|
||||
@ -578,14 +578,14 @@ void TAnimModel::RecalcVertexPos()
|
||||
void TAnimModel::SaveVertexInfoToBuf()
|
||||
{
|
||||
|
||||
CopyVertexArr = LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB];
|
||||
//CopyVertexArr = LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB];
|
||||
|
||||
AnimList->SaveBoneSystemToBuf();
|
||||
}
|
||||
void TAnimModel::LoadVertexInfoFromBuf()
|
||||
{
|
||||
|
||||
LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB] = CopyVertexArr;
|
||||
//LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB] = CopyVertexArr;
|
||||
|
||||
AnimList->LoadBoneSystemFromBuf();
|
||||
}
|
||||
@ -597,8 +597,8 @@ bool TAnimModel::LoadModel(const std::string& modelName)
|
||||
return false;
|
||||
|
||||
|
||||
CopyVertexArr.resize(LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size());
|
||||
CopyVertexArr = LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB];
|
||||
//CopyVertexArr.resize(LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].size());
|
||||
//CopyVertexArr = LiteModel.TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB];
|
||||
|
||||
AnimList = ResourceManager->ModelAnimManager[modelName];
|
||||
|
||||
|
@ -32,8 +32,10 @@ bool TLiteModelResource::LoadModel(boost::shared_array<byte> filePointer, cardin
|
||||
int normtexnamelen = *reinterpret_cast<word*>(&filePointer[78]+texnamelen);
|
||||
|
||||
Normtexname = std::string(reinterpret_cast<char*>(&filePointer[80]+texnamelen), reinterpret_cast<char*>(&filePointer[80]+texnamelen) + normtexnamelen);
|
||||
|
||||
if (Texname != "")
|
||||
{
|
||||
ResourceManager->TexList.AddTextureDirectly((PathToResource + std::string(Texname)));
|
||||
}
|
||||
if (Normtexname != "")
|
||||
{
|
||||
ResourceManager->TexList.AddTextureDirectly((PathToResource + std::string(Normtexname)));
|
||||
@ -115,13 +117,17 @@ bool TLiteModel::LoadModel(const std::string& s)
|
||||
else
|
||||
NormTexID = 0;
|
||||
|
||||
vertexDataStruct.PositionData = res.VertexArr;
|
||||
vertexDataStruct.TexCoordData = res.TexCoordArr;
|
||||
|
||||
vertexDataStruct.RefreshVBO();
|
||||
/*
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB] = res.VertexArr;
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB] = res.NormalArr;
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB] = res.TangentArr;
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_BINORMAL_ATTRIB] = res.BinormalArr;
|
||||
TriangleList.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB] = res.TexCoordArr;
|
||||
|
||||
*/
|
||||
Loaded = true;
|
||||
|
||||
return true;
|
||||
@ -131,10 +137,10 @@ void TLiteModel::FreeModel()
|
||||
{
|
||||
Loaded = false;
|
||||
|
||||
TriangleList.Data.Vec3CoordArr.clear();
|
||||
TriangleList.Data.Vec2CoordArr.clear();
|
||||
//TriangleList.Data.Vec3CoordArr.clear();
|
||||
//TriangleList.Data.Vec2CoordArr.clear();
|
||||
#ifdef TARGET_WIN32
|
||||
TriangleList.VertBufferArr.clear();
|
||||
//TriangleList.VertBufferArr.clear();
|
||||
#endif
|
||||
TriangleCount = 0;
|
||||
TexID = 0;
|
||||
@ -149,7 +155,8 @@ void TLiteModel::UpdateVBO()
|
||||
|
||||
CheckGlError();
|
||||
|
||||
TriangleList.RefreshBuffer();
|
||||
//TriangleList.RefreshBuffer();
|
||||
vertexDataStruct.RefreshVBO();
|
||||
|
||||
CheckGlError();
|
||||
|
||||
@ -157,7 +164,7 @@ void TLiteModel::UpdateVBO()
|
||||
|
||||
void TLiteModel::DrawImmediate()
|
||||
{
|
||||
|
||||
/*
|
||||
#ifdef TARGET_WIN32
|
||||
|
||||
if (Loaded)
|
||||
@ -209,7 +216,7 @@ void TLiteModel::DrawImmediate()
|
||||
RenderUniform1i(CONST_STRING_NORMALMAPEXISTS_UNIFORM, 1);
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif*/
|
||||
}
|
||||
|
||||
void TLiteModel::DrawVBO()
|
||||
@ -228,7 +235,14 @@ void TLiteModel::DrawVBO()
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D,TexID);
|
||||
|
||||
Renderer->DrawTriangleList(TriangleList);
|
||||
EnableVertexAttribArray("vPosition");
|
||||
EnableVertexAttribArray("vTexCoord");
|
||||
|
||||
//Renderer->DrawTriangleList(TriangleList);
|
||||
DrawVertexDataStruct(vertexDataStruct);
|
||||
|
||||
DisableVertexAttribArray("vPosition");
|
||||
DisableVertexAttribArray("vTexCoord");
|
||||
|
||||
RenderUniform1i(CONST_STRING_NORMALMAPEXISTS_UNIFORM, 1);
|
||||
|
||||
@ -242,7 +256,8 @@ void TLiteModel::MoveModel(const vec3& v)
|
||||
{
|
||||
for (cardinal i = 0; i < TriangleCount * 3; i++)
|
||||
{
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] += v;
|
||||
vertexDataStruct.PositionData[i] += v;
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] += v;
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,10 +266,11 @@ void TLiteModel::RotateModel(const mat3& r)
|
||||
|
||||
for (cardinal i = 0; i < TriangleCount * 3; i++)
|
||||
{
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i];
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i];
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i];
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_BINORMAL_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_BINORMAL_ATTRIB][i];
|
||||
vertexDataStruct.PositionData[i] = r * vertexDataStruct.PositionData[i];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_BINORMAL_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_BINORMAL_ATTRIB][i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +279,8 @@ void TLiteModel::ScaleModel(float s)
|
||||
|
||||
for (cardinal i = 0; i < TriangleCount * 3; i++)
|
||||
{
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] *= s;
|
||||
vertexDataStruct.PositionData[i] *= s;
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] *= s;
|
||||
}
|
||||
|
||||
}
|
||||
@ -274,9 +291,12 @@ void TLiteModel::ScaleModel(const vec3& s)
|
||||
|
||||
for (cardinal i = 0; i < TriangleCount * 3; i++)
|
||||
{
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[0] *= s.v[0];
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[1] *= s.v[1];
|
||||
TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[2] *= s.v[2];
|
||||
vertexDataStruct.PositionData[i].v[0] *= s.v[0];
|
||||
vertexDataStruct.PositionData[i].v[1] *= s.v[1];
|
||||
vertexDataStruct.PositionData[i].v[2] *= s.v[2];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[0] *= s.v[0];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[1] *= s.v[1];
|
||||
//TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[2] *= s.v[2];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,10 @@ PFNGLBUFFERSUBDATAPROC glBufferSubData = NULL;
|
||||
PFNGLMAPBUFFERPROC glMapBuffer = NULL;
|
||||
PFNGLUNMAPBUFFERPROC glUnmapBuffer = NULL;
|
||||
|
||||
PFNGLGENVERTEXARRAYSPROC glGenVertexArrays = NULL;
|
||||
PFNGLBINDVERTEXARRAYPROC glBindVertexArray = NULL;
|
||||
PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArray = NULL;
|
||||
|
||||
//=========================================
|
||||
//============ Frame buffer ===============
|
||||
//=========================================
|
||||
|
@ -2,6 +2,88 @@
|
||||
|
||||
namespace SE
|
||||
{
|
||||
VBOHolder::VBOHolder()
|
||||
{
|
||||
glGenBuffers(1, &Buffer);
|
||||
}
|
||||
|
||||
VBOHolder::~VBOHolder()
|
||||
{
|
||||
glDeleteBuffers(1, &Buffer);
|
||||
}
|
||||
|
||||
GLuint VBOHolder::getBuffer()
|
||||
{
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
VAOHolder::VAOHolder()
|
||||
{
|
||||
#ifndef EMSCRIPTEN
|
||||
glGenVertexArrays(1, &vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
VAOHolder::~VAOHolder()
|
||||
{
|
||||
#ifndef EMSCRIPTEN
|
||||
glDeleteVertexArray(1, &vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
GLuint VAOHolder::getBuffer()
|
||||
{
|
||||
return vao;
|
||||
}
|
||||
|
||||
void VertexDataStruct::RefreshVBO()
|
||||
{
|
||||
//Check if main thread, check if data is not empty...
|
||||
|
||||
#ifndef EMSCRIPTEN
|
||||
if (!vao)
|
||||
{
|
||||
vao = std::make_shared<VAOHolder>();
|
||||
}
|
||||
|
||||
glBindVertexArray(vao->getBuffer());
|
||||
#endif
|
||||
if (!positionVBO)
|
||||
{
|
||||
positionVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, positionVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, PositionData.size() * 12, &PositionData[0], GL_STATIC_DRAW);
|
||||
|
||||
if (!texCoordVBO)
|
||||
{
|
||||
texCoordVBO = std::make_shared<VBOHolder>();
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, texCoordVBO->getBuffer());
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, TexCoordData.size() * 8, &TexCoordData[0], GL_STATIC_DRAW);
|
||||
|
||||
}
|
||||
|
||||
void DrawVertexDataStruct(const VertexDataStruct& vertexDataStruct)
|
||||
{
|
||||
static const std::string vTexCoord("vTexCoord");
|
||||
static const std::string vPosition("vPosition");
|
||||
|
||||
//Check if main thread, check if data is not empty...
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexDataStruct.texCoordVBO->getBuffer());
|
||||
VertexAttribPointer2fv(vTexCoord, 0, NULL);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertexDataStruct.positionVBO->getBuffer());
|
||||
VertexAttribPointer3fv(vPosition, 0, NULL);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(vertexDataStruct.PositionData.size()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef TARGET_WIN32
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
namespace SE
|
||||
{
|
||||
const float speed_coef = 0.1;
|
||||
|
||||
|
||||
TSalmonRendererInterface::TSalmonRendererInterface()
|
||||
@ -13,6 +14,9 @@ TSalmonRendererInterface::TSalmonRendererInterface()
|
||||
, CamDist(0.0f)
|
||||
, CamShift(ZeroVec3)
|
||||
, GlobalShadowAreaHalfSize(CONST_DEFAULT_GLOBAL_SHADOW_AREA_HALFSIZE)
|
||||
, FogBeginDistance(CONST_DEFAULT_FOG_BEGIN_DISTANCE)
|
||||
, FogEndDistance(CONST_DEFAULT_FOG_END_DISTANCE)
|
||||
, FogColor(CONST_DEFAULT_FOG_COLOR)
|
||||
{
|
||||
ProjectionMatrixStack.push(IdentityMatrix4);
|
||||
|
||||
@ -54,8 +58,8 @@ void TSalmonRendererInterface::SetUniforms()
|
||||
//RenderUniform1f(CONST_STRING_SHADOWCLAMPVALUE_UNIFORM, GetShadowClampValue());
|
||||
//RenderUniform1i(CONST_STRING_ACTIVELIGHTCOUNT_UNIFORM, ResourceManager->LightManager.GetActiveLightCount());
|
||||
|
||||
//RenderUniform1f(CONST_STRING_FOG_BEGIN_DISTANCE_UNIFORM, GetFogBeginDistance());
|
||||
//RenderUniform1f(CONST_STRING_FOG_END_DISTANCE_UNIFORM, GetFogEndDistance());
|
||||
RenderUniform1f(CONST_STRING_FOG_BEGIN_DISTANCE_UNIFORM, GetFogBeginDistance());
|
||||
RenderUniform1f(CONST_STRING_FOG_END_DISTANCE_UNIFORM, GetFogEndDistance());
|
||||
//RenderUniform4fv(CONST_STRING_FOG_COLOR_UNIFORM, GetFogColor().v);
|
||||
|
||||
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM, GetCamPos().v);
|
||||
@ -171,7 +175,36 @@ void TSalmonRendererInterface::PushPerspectiveProjectionMatrix(float angle, floa
|
||||
|
||||
|
||||
|
||||
void TSalmonRendererInterface::SetGLCamAngleView()
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -CamDist);
|
||||
glRotatef(CamPhi*180.0f/pi, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(CamAlpha*180.0f/pi, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
//TODO
|
||||
glTranslatef(-CamShift.v[0], -CamShift.v[1], -CamShift.v[2]);
|
||||
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX,CamModelViewMatrix.m);
|
||||
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
|
||||
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM,CamPos.v);*/
|
||||
|
||||
LoadIdentity();
|
||||
TranslateMatrix(vec3(0.0f, 0.0f, -CamDist));
|
||||
RotateMatrix(vec4(1.f * sin(CamPhi / 2.f), 0.f, 0.f, 1.f * cos(CamPhi / 2.f)));
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(CamAlpha / 2.f), 0.f, 1.f * cos(CamAlpha / 2.f)));
|
||||
TranslateMatrix(-CamVec);
|
||||
|
||||
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
|
||||
SetUniforms();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGLCamView()
|
||||
{
|
||||
@ -189,7 +222,6 @@ void TSalmonRendererInterface::SetGLCamView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
|
||||
RenderUniform3fv(CONST_STRING_CAMPOS_UNIFORM,CamPos.v);*/
|
||||
|
||||
LoadIdentity();
|
||||
TranslateMatrix(vec3(0.0f, 0.0f, -CamDist));
|
||||
RotateMatrix(vec4(1.f * sin(CamPhi/2.f), 0.f, 0.f, 1.f * cos(CamPhi/2.f)));
|
||||
@ -221,7 +253,7 @@ void TSalmonRendererInterface::SetGlIdentityView()
|
||||
SetUniforms();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlPosXView()
|
||||
void TSalmonRendererInterface::SetGlPosXView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -234,11 +266,19 @@ void TSalmonRendererInterface::SetGlPosXView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
||||
|
||||
LoadIdentity();
|
||||
|
||||
if (renderToFrame)
|
||||
{
|
||||
RotateMatrix(vec4(0.f, -1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||
RotateMatrix(vec4(0.f, 0.f, 1.f * sin(pi / 2.f), 1.f * cos(pi / 2.f)));
|
||||
}
|
||||
else
|
||||
{
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||
RotateMatrix(vec4(1.f * sin(pi / 2.f), 0.f, 0.f, 1.f * cos(pi / 2.f)));
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
}
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -247,7 +287,7 @@ void TSalmonRendererInterface::SetGlPosXView()
|
||||
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlNegXView()
|
||||
void TSalmonRendererInterface::SetGlNegXView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -260,11 +300,19 @@ void TSalmonRendererInterface::SetGlNegXView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
||||
|
||||
LoadIdentity();
|
||||
|
||||
RotateMatrix(vec4(0.f, -1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||
RotateMatrix(vec4(1.f * sin(pi / 2.f), 0.f, 0.f, 1.f * cos(pi / 2.f)));
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
if (renderToFrame)
|
||||
{
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||
RotateMatrix(vec4(0.f, 0.f, 1.f * sin(pi / 2.f), 1.f * cos(pi / 2.f)));
|
||||
}
|
||||
else
|
||||
{
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 4.f), 0.f, 1.f * cos(pi / 4.f)));
|
||||
}
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -272,7 +320,7 @@ void TSalmonRendererInterface::SetGlNegXView()
|
||||
SetUniforms();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlPosYView()
|
||||
void TSalmonRendererInterface::SetGlPosYView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -283,10 +331,13 @@ void TSalmonRendererInterface::SetGlPosYView()
|
||||
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
||||
|
||||
LoadIdentity();
|
||||
RotateMatrix(vec4(-1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
LoadIdentity();
|
||||
RotateMatrix(vec4(-1.f * sin(pi / 4.f), 0.0f, 0.f, 1.f * cos(pi / 4.f)));
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -295,7 +346,7 @@ void TSalmonRendererInterface::SetGlPosYView()
|
||||
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlNegYView()
|
||||
void TSalmonRendererInterface::SetGlNegYView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -307,9 +358,11 @@ void TSalmonRendererInterface::SetGlNegYView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
||||
|
||||
LoadIdentity();
|
||||
RotateMatrix(vec4(1.f * sin(pi / 4.f), 0.f, 0.f, 1.f * cos(pi / 4.f)));
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
RotateMatrix(vec4(1.f * sin(pi / 4.f), 0.0f, 0.f, 1.f * cos(pi / 4.f)));
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -317,7 +370,7 @@ void TSalmonRendererInterface::SetGlNegYView()
|
||||
SetUniforms();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlPosZView()
|
||||
void TSalmonRendererInterface::SetGlPosZView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -330,12 +383,24 @@ void TSalmonRendererInterface::SetGlPosZView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
*/
|
||||
|
||||
|
||||
LoadIdentity();
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 2.f), 0.f, 1.f * cos(pi / 2.f)));
|
||||
if (renderToFrame)
|
||||
{
|
||||
RotateMatrix(vec4(0.f, 0.f, 1.f * sin(pi / 2.f), 1.f * cos(pi / 2.f)));
|
||||
}
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
/*LoadIdentity();
|
||||
|
||||
RotateMatrix(vec4(0.f, 1.f * sin(pi / 2.f), 0.f, 1.f * cos(pi / 2.f)));
|
||||
RotateMatrix(vec4(0.f, 0.f, 1.f * sin(pi / 2.f), 1.f * cos(pi / 2.f)));
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
TranslateMatrix(-CamShift);*/
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -343,7 +408,7 @@ void TSalmonRendererInterface::SetGlPosZView()
|
||||
SetUniforms();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetGlNegZView()
|
||||
void TSalmonRendererInterface::SetGlNegZView(bool translate, bool renderToFrame)
|
||||
{
|
||||
/*
|
||||
glLoadIdentity();
|
||||
@ -355,10 +420,16 @@ void TSalmonRendererInterface::SetGlNegZView()
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);*/
|
||||
|
||||
LoadIdentity();
|
||||
|
||||
//RotateMatrix(vec4(0.f, 1.f * sin(pi / 2.f), 0.f, 1.f * cos(pi / 2.f)));
|
||||
if (renderToFrame)
|
||||
{
|
||||
RotateMatrix(vec4(0.f, 0.f, 1.f * sin(pi / 2.f), 1.f * cos(pi / 2.f)));
|
||||
}
|
||||
|
||||
TranslateMatrix(-CamShift);
|
||||
if (translate)
|
||||
{
|
||||
TranslateMatrix(-CamPos);
|
||||
}
|
||||
|
||||
CamModelViewMatrix = ModelviewMatrixStack.top();
|
||||
CamInversedModelViewMatrix = InverseModelViewMatrix(CamModelViewMatrix);
|
||||
@ -554,9 +625,9 @@ void TSalmonRendererInterface::MoveForward()
|
||||
float sina = sinf(CamAlpha);
|
||||
float cosa = cosf(CamAlpha);
|
||||
|
||||
mov.v[0] = sina;
|
||||
mov.v[0] = speed_coef * sina;
|
||||
mov.v[1] = 0;
|
||||
mov.v[2] = - cosa;
|
||||
mov.v[2] = -speed_coef * cosa;
|
||||
|
||||
CamShift = CamShift + mov;
|
||||
|
||||
@ -601,9 +672,9 @@ void TSalmonRendererInterface::MoveBackward()
|
||||
float sina = sinf(CamAlpha);
|
||||
float cosa = cosf(CamAlpha);
|
||||
|
||||
mov.v[0] = - sina;
|
||||
mov.v[0] = -speed_coef*sina;
|
||||
mov.v[1] = 0;
|
||||
mov.v[2] = cosa;
|
||||
mov.v[2] = speed_coef * cosa;
|
||||
|
||||
CamShift = CamShift + mov;
|
||||
//Possibly refactor???
|
||||
@ -647,9 +718,9 @@ void TSalmonRendererInterface::MoveLeft()
|
||||
float sina = sinf(CamAlpha);
|
||||
float cosa = cosf(CamAlpha);
|
||||
|
||||
mov.v[0] = - cosa;
|
||||
mov.v[0] = -speed_coef * cosa;
|
||||
mov.v[1] = 0;
|
||||
mov.v[2] = - sina;
|
||||
mov.v[2] = -speed_coef * sina;
|
||||
|
||||
CamShift = CamShift + mov;
|
||||
|
||||
@ -691,8 +762,8 @@ void TSalmonRendererInterface::MoveRight()
|
||||
{
|
||||
vec3 mov;
|
||||
|
||||
float sina = sinf(CamAlpha);
|
||||
float cosa = cosf(CamAlpha);
|
||||
float sina = speed_coef * sinf(CamAlpha);
|
||||
float cosa = speed_coef * cosf(CamAlpha);
|
||||
|
||||
mov.v[0] = cosa;
|
||||
mov.v[1] = 0;
|
||||
@ -770,6 +841,9 @@ void TSalmonRendererInterface::SwitchToCubemapBuffer(const std::string& frameNam
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, Frame.FrameBuffer);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + cubeSide, Frame.TexID, 0);
|
||||
//PopProjectionMatrix();
|
||||
//PushPerspectiveProjectionMatrix(pi / 2, 1.0, 1, 1000);
|
||||
//glViewport(0, 0, Frame.Width, Frame.Height);
|
||||
/*
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@ -777,7 +851,7 @@ void TSalmonRendererInterface::SwitchToCubemapBuffer(const std::string& frameNam
|
||||
glViewport(0, 0, Frame.Width, Frame.Height);
|
||||
glMatrixMode(GL_MODELVIEW);*/
|
||||
|
||||
SetPerspectiveProjectionMatrix(90, 1, 1, 100);
|
||||
SetPerspectiveProjectionMatrix(pi / 2, 1, 1, 100);
|
||||
|
||||
SetFrameViewport(frameName);
|
||||
|
||||
@ -805,6 +879,103 @@ void TSalmonRendererInterface::EndDrawToDepthBuffer()
|
||||
SetPerspectiveFullScreenViewport();
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::DrawBackground()
|
||||
{
|
||||
if (BkgTexID != 0)
|
||||
{
|
||||
//ResourceManager->ShaderManager.PushShader(BkgShaderName);
|
||||
this->PushShader(BkgShaderName);
|
||||
|
||||
//if (BkgShaderName != "")
|
||||
// ResourceManager->ShaderManager.SetCurrentShader(BkgShaderName);
|
||||
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glRotatef(CamPhi * 180.0f / pi, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(CamAlpha * 180.0f / pi, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, BkgTexID);
|
||||
|
||||
//x
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(-10.0f, -10.0f, -10.0f);
|
||||
glVertex3f(-10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(-10.0f, 10.0f, 10.0f);
|
||||
glVertex3f(-10.0f, -10.0f, 10.0f);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(10.0f, -10.0f, -10.0f);
|
||||
glVertex3f(10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(10.0f, 10.0f, 10.0f);
|
||||
glVertex3f(10.0f, -10.0f, 10.0f);
|
||||
glEnd();
|
||||
|
||||
//y
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(-10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(10.0f, 10.0f, 10.0f);
|
||||
glVertex3f(-10.0f, 10.0f, 10.0f);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(-10.0f, -10.0f, -10.0f);
|
||||
glVertex3f(10.0f, -10.0f, -10.0f);
|
||||
glVertex3f(10.0f, -10.0f, 10.0f);
|
||||
glVertex3f(-10.0f, -10.0f, 10.0f);
|
||||
glEnd();
|
||||
|
||||
//z
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(10.0f, -10.0f, 10.0f);
|
||||
glVertex3f(10.0f, 10.0f, 10.0f);
|
||||
glVertex3f(-10.0f, 10.0f, 10.0f);
|
||||
glVertex3f(-10.0f, -10.0f, 10.0f);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(10.0f, -10.0f, -10.0f);
|
||||
glVertex3f(10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(-10.0f, 10.0f, -10.0f);
|
||||
glVertex3f(-10.0f, -10.0f, -10.0f);
|
||||
glEnd();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
PopShader();
|
||||
}
|
||||
}
|
||||
vec4 TSalmonRendererInterface::GetFogColor()
|
||||
{
|
||||
return FogColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float TSalmonRendererInterface::GetFogBeginDistance()
|
||||
{
|
||||
return FogBeginDistance;
|
||||
}
|
||||
|
||||
float TSalmonRendererInterface::GetFogEndDistance()
|
||||
{
|
||||
return FogEndDistance;
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetFogBeginDistance(float distance)
|
||||
{
|
||||
FogBeginDistance = distance;
|
||||
}
|
||||
|
||||
void TSalmonRendererInterface::SetFogEndDistance(float distance)
|
||||
{
|
||||
FogEndDistance = distance;
|
||||
}
|
||||
|
||||
|
||||
} //namespace SE
|
||||
|
||||
|
@ -13,9 +13,6 @@ namespace SE
|
||||
|
||||
TSalmonRenderer::TSalmonRenderer() :
|
||||
ShadowClampValue(0.0f),
|
||||
FogBeginDistance(CONST_DEFAULT_FOG_BEGIN_DISTANCE),
|
||||
FogEndDistance(CONST_DEFAULT_FOG_END_DISTANCE),
|
||||
FogColor(CONST_DEFAULT_FOG_COLOR),
|
||||
LandToCalcCollision(NULL),
|
||||
IsCameraTransparentToLand(true)
|
||||
{
|
||||
@ -51,6 +48,10 @@ bool TSalmonRenderer::BindOpenGLFunctions()
|
||||
glMapBuffer = (PFNGLMAPBUFFERPROC) wglGetProcAddress("glMapBuffer");
|
||||
glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) wglGetProcAddress("glUnmapBuffer");
|
||||
|
||||
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)wglGetProcAddress("glGenVertexArrays");
|
||||
glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)wglGetProcAddress("glBindVertexArray");
|
||||
glDeleteVertexArray = (PFNGLDELETEVERTEXARRAYSPROC)wglGetProcAddress("glDeleteVertexArray");
|
||||
|
||||
glCreateProgram = (PFNGLCREATEPROGRAMPROC) wglGetProcAddress("glCreateProgram");
|
||||
glDeleteProgram = (PFNGLDELETEPROGRAMPROC) wglGetProcAddress("glDeleteProgram");
|
||||
glLinkProgram = (PFNGLLINKPROGRAMPROC) wglGetProcAddress("glLinkProgram");
|
||||
@ -293,22 +294,6 @@ void TSalmonRenderer::SetShadowClampValue(float shadowClampValue)
|
||||
}
|
||||
|
||||
|
||||
float TSalmonRenderer::GetFogBeginDistance()
|
||||
{
|
||||
return FogBeginDistance;
|
||||
}
|
||||
|
||||
float TSalmonRenderer::GetFogEndDistance()
|
||||
{
|
||||
return FogEndDistance;
|
||||
}
|
||||
|
||||
vec4 TSalmonRenderer::GetFogColor()
|
||||
{
|
||||
return FogColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TSalmonRenderer::DrawTriangleList(const TTriangleList& triangleList)
|
||||
|
@ -34,8 +34,8 @@ void TApplicationAncestor::OuterDeinit()
|
||||
|
||||
void TApplicationAncestor::OuterDraw()
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
//glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
RenderUniform1i("Texture", 0);
|
||||
@ -43,16 +43,16 @@ void TApplicationAncestor::OuterDraw()
|
||||
|
||||
InnerDraw();
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
Renderer->PushShader("DefaultShader");
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
/*Renderer->PushShader("DefaultShader");
|
||||
|
||||
if (IsConsoleOut)
|
||||
{
|
||||
Console->Draw();
|
||||
}
|
||||
|
||||
Renderer->PopShader();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
Renderer->PopShader();*/
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void TApplicationAncestor::OuterUpdate(cardinal timer)
|
||||
|
@ -10,9 +10,9 @@ std::vector<TFunctionBinderInterface*> TFunctionBinderInterface::BinderList;
|
||||
|
||||
TScriptManager::TScriptManager()
|
||||
{
|
||||
SquirrelVM::Init();
|
||||
//SquirrelVM::Init();
|
||||
|
||||
virtualMachine = SquirrelVM::GetVMPtr();
|
||||
//virtualMachine = SquirrelVM::GetVMPtr();
|
||||
|
||||
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("Print"));
|
||||
//SqPlus::RegisterGlobal(virtualMachine, SQ_Print, _SC("p"));
|
||||
@ -58,12 +58,12 @@ TScriptManager::TScriptManager()
|
||||
TScriptManager::~TScriptManager()
|
||||
{
|
||||
*Console<<"Script manager shutdown";
|
||||
SquirrelVM::Shutdown();
|
||||
//SquirrelVM::Shutdown();
|
||||
}
|
||||
|
||||
void TScriptManager::RunScript(const std::string& scriptCode)
|
||||
{
|
||||
try
|
||||
/*try
|
||||
{
|
||||
SquirrelObject m = SquirrelVM::CompileBuffer(_T(scriptCode.c_str()));
|
||||
|
||||
@ -72,7 +72,7 @@ void TScriptManager::RunScript(const std::string& scriptCode)
|
||||
catch (SquirrelError)
|
||||
{
|
||||
*Console<<"Script failed to run";
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void TScriptManager::RunScript(const std::string& scriptCode)
|
||||
void TScriptManager::BindBasicFunctions()
|
||||
{
|
||||
//Hack =D
|
||||
static bool alreadyBind = false;
|
||||
/*static bool alreadyBind = false;
|
||||
|
||||
if (!alreadyBind)
|
||||
{
|
||||
@ -102,7 +102,7 @@ void TScriptManager::BindBasicFunctions()
|
||||
|
||||
alreadyBind = true;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -171,10 +171,11 @@ void TScriptManager::Serialize(boost::property_tree::ptree& propertyTree)
|
||||
//============= Typical commands ==============
|
||||
//=============================================
|
||||
|
||||
/*
|
||||
void SQ_Print(const SQChar *inString)
|
||||
{
|
||||
Console->PrintImmediate(std::string(inString));
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
void SQ_PrintWidgetList()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "include/Engine.h"
|
||||
#define TARGET_WIN32
|
||||
|
||||
namespace SE
|
||||
{
|
||||
@ -67,15 +68,103 @@ TSimpleLandClass::~TSimpleLandClass()
|
||||
|
||||
void TSimpleLandClass::CreateVBO()
|
||||
{
|
||||
IndexArr.resize(6*(Width-1)*(Height-1));
|
||||
|
||||
int i, j, k, k_up, k_right, k_right_up;
|
||||
|
||||
vertexDataStruct.PositionData.clear();
|
||||
vertexDataStruct.TexCoordData.clear();
|
||||
|
||||
for (i = 0; i < Height - 1; i++)
|
||||
{
|
||||
for (j = 0; j < Width - 1; j++)
|
||||
{
|
||||
k = j + i * Width;
|
||||
k_right = (j + 1) + i * Width;
|
||||
k_up = j + (i + 1) * Width;
|
||||
k_right_up = (j + 1) + (i + 1) * Width;
|
||||
|
||||
float tx0 = float(j) / (Width - 1);
|
||||
float ty0 = float(i) / (Height - 1);
|
||||
|
||||
float tx1 = float(j + 1) / (Width - 1);
|
||||
float ty1 = float(i + 1) / (Height - 1);
|
||||
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k].pos);
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k_right].pos);
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k_up].pos);
|
||||
|
||||
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k_right_up].pos);
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k_up].pos);
|
||||
vertexDataStruct.PositionData.push_back(VertexMatrix[k_right].pos);
|
||||
|
||||
vertexDataStruct.TexCoordData.push_back({ tx0, ty0 });
|
||||
vertexDataStruct.TexCoordData.push_back({ tx1, ty0 });
|
||||
vertexDataStruct.TexCoordData.push_back({ tx0, ty1 });
|
||||
|
||||
|
||||
vertexDataStruct.TexCoordData.push_back({ tx1, ty1 });
|
||||
vertexDataStruct.TexCoordData.push_back({ tx0, ty1 });
|
||||
vertexDataStruct.TexCoordData.push_back({ tx1, ty0 });
|
||||
|
||||
/*
|
||||
glBegin(GL_TRIANGLES);
|
||||
glNormal3fv(VertexMatrix[k].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_right].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_up].pos.v);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glNormal3fv(VertexMatrix[k_right_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right_up].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right_up].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_up].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_right].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right].pos.v);
|
||||
glEnd();*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
vertexDataStruct.RefreshVBO();
|
||||
|
||||
|
||||
/*IndexArr.resize(6 * (Width - 1) * (Height - 1));
|
||||
|
||||
//VBOLandVertexArr.resize(Width*Height);
|
||||
VBOLandVertexArr.pos.resize(Width * Height);
|
||||
VBOLandVertexArr.norm.resize(Width * Height);
|
||||
VBOLandVertexArr.tangent.resize(Width * Height);
|
||||
VBOLandVertexArr.binorm.resize(Width * Height);
|
||||
VBOLandVertexArr.texCoord.resize(Width * Height);
|
||||
VBOLandVertexArr.texCoord.resize(Width * Height);*/
|
||||
|
||||
|
||||
/*
|
||||
for (int i = 0; i < Height-1; i++)
|
||||
for (int j = 0; j < Width-1; j++)
|
||||
{
|
||||
@ -126,12 +215,17 @@ void TSimpleLandClass::CreateVBO()
|
||||
glBindBuffer(GL_ARRAY_BUFFER, TexcoordBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, Width * Height * sizeof(vec2), &(VBOLandVertexArr.texCoord[0]), GL_STATIC_DRAW);
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TSimpleLandClass::FreeVBO()
|
||||
{
|
||||
|
||||
/*
|
||||
#ifdef TARGET_WIN32
|
||||
|
||||
glDeleteBuffers(1, &VertexBuffer);
|
||||
glDeleteBuffers(1, &NormBuffer);
|
||||
glDeleteBuffers(1, &TangentBuffer);
|
||||
@ -145,13 +239,16 @@ void TSimpleLandClass::FreeVBO()
|
||||
VBOLandVertexArr.tangent.clear();
|
||||
VBOLandVertexArr.binorm.clear();
|
||||
VBOLandVertexArr.texCoord.clear();
|
||||
IndexArr.clear();
|
||||
IndexArr.clear();*/
|
||||
}
|
||||
|
||||
void TSimpleLandClass::UpdateVBO()
|
||||
{
|
||||
//Index array remains the same - only vertex array is to be changed
|
||||
CreateVBO();
|
||||
vertexDataStruct.RefreshVBO();
|
||||
|
||||
//Index array remains the same - only vertex array is to be changed
|
||||
/*
|
||||
for (int i = 0; i < Height; i++)
|
||||
{
|
||||
for (int j = 0; j < Width; j++)
|
||||
@ -182,6 +279,7 @@ void TSimpleLandClass::UpdateVBO()
|
||||
glBindBuffer(GL_ARRAY_BUFFER, TexcoordBuffer);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, Width * Height * sizeof(vec2), &(VBOLandVertexArr.texCoord[0]));
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
vec3 TSimpleLandClass::CalcCrossingForPoint(const vec3& pos, int i, int j)
|
||||
@ -381,23 +479,27 @@ void TSimpleLandClass::DrawImmediate()
|
||||
float tx1 = float(j+1)/(Width-1);
|
||||
float ty1 = float(i+1)/(Height-1);
|
||||
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glNormal3fv(VertexMatrix[k].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k].binorm.v);
|
||||
glTexCoord2f(tx0,ty0);
|
||||
//glTexCoord2f(tx0,ty0);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_right].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
|
||||
glTexCoord2f(tx1,ty0);
|
||||
//glTexCoord2f(tx1,ty0);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
|
||||
glTexCoord2f(tx0,ty1);
|
||||
//glTexCoord2f(tx0,ty1);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_up].pos.v);
|
||||
glEnd();
|
||||
|
||||
@ -405,19 +507,22 @@ void TSimpleLandClass::DrawImmediate()
|
||||
glNormal3fv(VertexMatrix[k_right_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right_up].binorm.v);
|
||||
glTexCoord2f(tx1,ty1);
|
||||
//glTexCoord2f(tx1,ty1);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right_up].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_up].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_up].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_up].binorm.v);
|
||||
glTexCoord2f(tx0,ty1);
|
||||
//glTexCoord2f(tx0,ty1);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx0, ty1 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_up].pos.v);
|
||||
|
||||
glNormal3fv(VertexMatrix[k_right].norm.v);
|
||||
VertexAttrib3fv(CONST_STRING_TANGENT_ATTRIB, VertexMatrix[k_right].tangent.v);
|
||||
VertexAttrib3fv(CONST_STRING_BINORMAL_ATTRIB, VertexMatrix[k_right].binorm.v);
|
||||
glTexCoord2f(tx1,ty0);
|
||||
//glTexCoord2f(tx1,ty0);
|
||||
VertexAttrib3fv(CONST_STRING_TEXCOORD_ATTRIB, &std::array<float, 2>{ tx1, ty0 }[0]);
|
||||
glVertex3fv(VertexMatrix[k_right].pos.v);
|
||||
glEnd();
|
||||
|
||||
@ -432,21 +537,34 @@ void TSimpleLandClass::DrawVBO()
|
||||
{
|
||||
|
||||
|
||||
//RenderUniform1i(CONST_STRING_NORMALMAPEXISTS_UNIFORM, min<cardinal>(NormTexID, 1));
|
||||
|
||||
//RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m);
|
||||
//RenderUniform3fv(CONST_STRING_MODELTRANSLATEVECTOR_UNIFORM, (float*)ZeroVec3.v);
|
||||
|
||||
if (NormTexID != 0)
|
||||
if (NormTexID == 0)
|
||||
{
|
||||
RenderUniform1i(CONST_STRING_NORMALMAPEXISTS_UNIFORM, 0);
|
||||
}
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, WhiteColor);
|
||||
|
||||
RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m);
|
||||
RenderUniform3fv(CONST_STRING_MODELTRANSLATEVECTOR_UNIFORM, (float*)ZeroVec3.v);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, NormTexID);
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, TexID);
|
||||
|
||||
EnableVertexAttribArray("vPosition");
|
||||
EnableVertexAttribArray("vTexCoord");
|
||||
|
||||
//Renderer->DrawTriangleList(TriangleList);
|
||||
DrawVertexDataStruct(vertexDataStruct);
|
||||
|
||||
DisableVertexAttribArray("vPosition");
|
||||
DisableVertexAttribArray("vTexCoord");
|
||||
|
||||
|
||||
/*
|
||||
#ifdef TARGET_WIN32
|
||||
|
||||
|
||||
@ -486,7 +604,7 @@ void TSimpleLandClass::DrawVBO()
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 6*(Width-1)*(Height-1), GL_UNSIGNED_SHORT, &IndexArr[0]);
|
||||
|
||||
#endif
|
||||
#endif*/
|
||||
|
||||
RenderUniform1i(CONST_STRING_NORMALMAPEXISTS_UNIFORM,1);
|
||||
|
||||
|
@ -86,7 +86,6 @@ ov_callbacks OggCallbacks = {
|
||||
};
|
||||
|
||||
|
||||
#endif //NOSOUND
|
||||
|
||||
|
||||
} //namespace SE
|
||||
#endif //NOSOUND
|
||||
|
@ -1016,7 +1016,7 @@ cardinal TOggMusicStream::GetSamplesPerSec()
|
||||
}
|
||||
|
||||
|
||||
#endif //NOSOUND
|
||||
|
||||
|
||||
} //namespace SE
|
||||
|
||||
#endif //NOSOUND
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "include/Utils/Utils.h"
|
||||
#include "include/Engine.h"
|
||||
|
||||
#include "boost/gil/gil_all.hpp"
|
||||
#include "boost/bind.hpp"
|
||||
#include "boost/gil/extension/numeric/sampler.hpp"
|
||||
#include "boost/gil/extension/numeric/resample.hpp"
|
||||
|
||||
@ -18,6 +18,7 @@ TTextureListClass::TTextureListClass()
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
CreateFunctionMap[".bmp"] = boost::bind(&TTextureListClass::CreateTexDataFromBmp24, this, _1, _2);
|
||||
CreateFunctionMap[".bmp32"] = boost::bind(&TTextureListClass::CreateTexDataFromBmp32, this, _1, _2);
|
||||
CreateFunctionMap[".png"] = boost::bind(&TTextureListClass::CreateTexDataFromPng, this, _1, _2);
|
||||
@ -569,7 +570,7 @@ cardinal TTextureListClass::AddTextureFromUserdata(const std::string& fileName,
|
||||
}
|
||||
|
||||
|
||||
cardinal TTextureListClass::AddCubemapTexture(std::string filename[6])
|
||||
cardinal TTextureListClass::AddCubemapTexture(std::array<std::string, 6> filename)
|
||||
{
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user