Resurrection

This commit is contained in:
Vladislav Khorev committed 2024-06-06 16:25:38 +03:00
commit d132060e19
59 files changed
+2616

No files matched your search

+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{0080A3E1-DFBF-4557-B198-E6D5D7724393}</ProjectGuid>
<RootNamespace>Template</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(SalmonEnginePath)include</IncludePath>
<LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;$(SalmonEnginePath)$(Configuration)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\Work\OldProjects\engine;C:\Work\OldProjects\engine\include;C:\Boost\include\boost-1_84;..\..\lpng1510;..\..\jpeg-9;..\..\jpeg-9\vc10</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TARGET_WIN32;NOSOUND;TARGET_WIN32;SALMON_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opengl32.lib;glu32.lib;shell32.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(CoreLibraryDependencies);Salmon Engine.lib;zlib.lib;libpng15.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Work\OldProjects\engine\Salmon Engine\Debug;C:\Boost\lib;C:\Work\OldProjects\lpng1510\projects\vstudio\Debug Library</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\Work\OldProjects\engine;C:\Work\OldProjects\engine\include;C:\Boost\include\boost-1_84;..\..\lpng1510;..\..\jpeg-9;..\..\jpeg-9\vc10</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOSOUND;TARGET_WIN32;SALMON_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opengl32.lib;glu32.lib;shell32.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;$(CoreLibraryDependencies);Salmon Engine.lib;zlib.lib;libpng15.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\Work\OldProjects\engine\Salmon Engine\Debug;C:\Boost\lib;C:\Work\OldProjects\lpng1510\projects\vstudio\Debug Library</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_47_0;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TARGET_WIN32;SALMON_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;opengl32.lib;glu32.lib;Salmon Engine.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;zlib.lib;libpng15.lib;sqplus.lib;squirrel.lib;sqdbglib.lib;sqstdlib.lib;dsound.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(LibsPath)\boost_1_47_0\boost_windows\libs_engine\$(Configuration);$(LibsPath)\libogg-1.3.0\win32\VS2010\Win32\$(Configuration);$(LibsPath)\libvorbis-1.3.2\win32\VS2010\Win32\$(Configuration);$(LibsPath)\sqplus\lib;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Lib\x86;$(LibsPath)\lpng1510\projects\vstudio\Release Library</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SalmonEnginePath);$(LibsPath)\boost_1_47_0;$(LibsPath)\libogg-1.3.0\include;$(LibsPath)\libvorbis-1.3.2\include;$(LibsPath)\sqplus\sqplus;$(LibsPath)\sqplus\include;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include;$(LibsPath)\lpng1510</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TARGET_WIN32;SALMON_WIN32;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;opengl32.lib;glu32.lib;Salmon Engine.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;zlib.lib;libpng15.lib;sqplus.lib;squirrel.lib;sqdbglib.lib;sqstdlib.lib;dsound.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(LibsPath)\boost_1_47_0\boost_windows\libs_engine\$(Configuration);$(LibsPath)\libogg-1.3.0\win32\VS2010\Win32\$(Configuration);$(LibsPath)\libvorbis-1.3.2\win32\VS2010\Win32\$(Configuration);$(LibsPath)\sqplus\lib;C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Lib\x86;$(LibsPath)\lpng1510\projects\vstudio\Release Library</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="gameMap.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="gameMap.h" />
<ClInclude Include="main.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Файлы исходного кода">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Заголовочные файлы">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="gameMap.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="gameMap.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
</ItemGroup>
</Project>
+247
View File
@@ -0,0 +1,247 @@
#include "gameMap.h"
using namespace SE;
TMapCharacter::TMapCharacter() :
Pos(ZeroVec3),
RotationMatrix(IdentityMatrix),
Direction(vec3(0.0f, 0.0f, 1.0f)),
Destination(ZeroVec3),
VectorToDestination(ZeroVec3),
Velocity(0.0f)
{
}
void TMapCharacter::SetPos(vec3& pos)
{
Pos = pos;
}
void TMapCharacter::GoToDestination(vec3& dest)
{
Destination = vec3(dest.v[0], 0.0f, dest.v[2]);
Velocity = 0.002f;
}
void TMapCharacter::Update(cardinal timer)
{
const float CONST_DISTANCE_SLOW_DOWN = 1.0f;
const float CONST_DISTANCE_STOP = 0.1f;
const float CONST_ROTATION_ANGLE_STEP = pi/200;
VectorToDestination = (Destination - Pos);
VectorToDestination.v[1] = 0.0f;
VectorToDestination = Normalize(VectorToDestination);
if (!IsFloatEqual(Velocity, 0.0f))
{
float cosa = DotProduct(VectorToDestination, Direction);
float alpha = acosf(cosa);
if (alpha <= CONST_ROTATION_ANGLE_STEP * timer)
{
Direction = VectorToDestination;
}
else
{
vec3 n = Normalize(CrossProduct(Direction, VectorToDestination));
float sinb = sinf(CONST_ROTATION_ANGLE_STEP * timer / 2.0f);
float cosb = cosf(CONST_ROTATION_ANGLE_STEP * timer / 2.0f);
vec4 q;
q.v[0] = n.v[0] * sinb;
q.v[1] = n.v[1] * sinb;
q.v[2] = n.v[2] * sinb;
q.v[3] = cosb;
mat3 rmat = mat3(q);
RotationMatrix *= rmat;
Direction = rmat * Direction;
}
}
if (!(Pos == Destination))
{
float dist = sqrtf((Pos.v[0] - Destination.v[0])*(Pos.v[0] - Destination.v[0]) +
(Pos.v[1] - Destination.v[1])*(Pos.v[1] - Destination.v[1]) +
(Pos.v[2] - Destination.v[2])*(Pos.v[2] - Destination.v[2]));
if (dist > CONST_DISTANCE_SLOW_DOWN)
{
Pos = Pos + timer*Velocity*Direction;
}
else if (dist > CONST_DISTANCE_STOP && dist <= CONST_DISTANCE_SLOW_DOWN)
{
Pos = Pos + 0.5f*timer*Velocity*Direction;
}
else
{
Pos = Destination;
Velocity = 0.0f;
VectorToDestination = ZeroVec3;
}
}
}
vec3 TMapCharacter::GetPos()
{
return Pos;
}
mat3 TMapCharacter::GetRotationMatrix()
{
return RotationMatrix;
}
void TGameMap::LoadMap()
{
Land = new TSimpleLandClass;
Land->LoadFromFile(std::string("landscapes/out.ls1"));
Land->SetTexture(std::string("landscapes/out.bmp"));
Land->Scale(0.005f);
StaticModelArr.reserve(1);
StaticModelArr.resize(1);
StaticModelArr[0].LoadModel("bt_box_yellow.lm1");
//StaticModelArr[0].SetShaderTranslateVector(vec3(-1.0f, 0.23f, 6.3f));
PlayerChar = new TLiteModel;
PlayerChar->LoadModel("bt_cone.lm1");
AnimModel = new TAnimModel;
AnimModel->LoadModel("bonemodel.lm1");
animSeq = 0;
//AnimModel->ApplySequence("bonemodel.an1", animSeq);
GirlText = new TAnimModel;
GirlText->LoadModel("girl.lm1");
//GirlText->ScaleModel(0.1f);
//GirlText->MoveModel(vec3(0,4,0));
//GirlText->UpdateVBO();
//GirlText->ApplySequence("girl.an1", 0);
MapChar.SetPos(vec3(0.0f, 0.0f, 10.0f));
}
void TGameMap::FreeMap()
{
if (Land)
{
delete Land;
Land = NULL;
}
if (PlayerChar)
{
delete PlayerChar;
PlayerChar = NULL;
}
if (AnimModel)
{
delete AnimModel;
AnimModel = NULL;
}
if (GirlText)
{
delete GirlText;
GirlText = NULL;
}
StaticModelArr.clear();
}
TSimpleLandClass* TGameMap::GetLand()
{
return Land;
}
void TGameMap::DrawVBO()
{
Renderer->PushShader("Simple3D");
Land->DrawVBO();
Renderer->PopShader();
//Land->DrawImmediate();
for (TLiteModelArr::iterator i = StaticModelArr.begin(); i != StaticModelArr.end(); ++i)
{
//i->DrawImmediate();
i->DrawVBO();
}
//PlayerChar->DrawVBO();
//AnimModel->DrawVBO();
//GirlText->DrawVBO();
}
cardinal timeForSeq = 0;
void TGameMap::Update(cardinal timer)
{
MapChar.Update(timer);
vec3 vecFrom, vecTo;
vec3 pos = Land->CalcVerticalCrossing(MapChar.GetPos());
PlayerChar->SetShaderTranslateVector(pos);
PlayerChar->SetShaderRotateMatrix(MapChar.GetRotationMatrix());
timeForSeq += timer;
if (timeForSeq >= 2000)
{
timeForSeq = 0;
if (animSeq != 12)
{
animSeq = 12;
//animSeq+= 1;
if (animSeq >= 100)
{
animSeq = 0;
}
//GirlText->ApplySequence("girl.an1", animSeq);
//GirlText->UpdateVBO();
}
}
//AnimModel->ApplySequence("bonemodel.an1", animSeq);
//AnimModel->UpdateVBO();
}
void TGameMap::PlayerClicked(int x, int y)
{
/*
vec3 vecFrom, vecTo;
SalmonRender->GetVectorOutOfCursor(x, y, vecFrom, vecTo);
vec3 r = Land->CalcCrossing(vecFrom, vecTo);
MapChar.GoToDestination(r);
*/
}
+66
View File
@@ -0,0 +1,66 @@
#pragma once
#include "SalmonEngineWindows.h"
#include <vector>
using namespace SE;
typedef std::vector<TLiteModel> TLiteModelArr;
class TMapCharacter
{
protected:
//Do not change them directly:
vec3 Pos; // y=0 here
mat3 RotationMatrix;
vec3 Direction; // y=0 here
vec3 Destination; // y=0 here
vec3 VectorToDestination;
float Velocity;
public:
TMapCharacter();
~TMapCharacter() { }
void SetPos(vec3& pos);
void GoToDestination(vec3& dest);
void Update(cardinal timer);
vec3 GetPos();
mat3 GetRotationMatrix();
};
class TGameMap
{
protected:
TSimpleLandClass* Land;
TLiteModelArr StaticModelArr;
TLiteModel* PlayerChar;
TMapCharacter MapChar;
public:
TGameMap() : Land(NULL), PlayerChar(NULL), AnimModel(NULL), GirlText(NULL) {};
~TGameMap() { FreeMap(); };
void LoadMap();
void FreeMap();
TSimpleLandClass* GetLand();
void DrawVBO();
void Update(cardinal timer);
void PlayerClicked(int x, int y);
TAnimModel* AnimModel;
TAnimModel* GirlText;
int animSeq;
};
+102
View File
@@ -0,0 +1,102 @@
2024-Jun-06 15:57:24: Log started
2024-Jun-06 15:57:25: OpenGL Window created
2024-Jun-06 15:57:25: Script manager ready
2024-Jun-06 15:57:25: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887
2024-Jun-06 15:57:25: Render::OpenGL glVersion above 2.0 ok
2024-Jun-06 15:57:25: Render::OpenGL GL_ARB_framebuffer_object supported ok
2024-Jun-06 15:57:25: Render::OpenGL GL_ARB_uniform_buffer_object supported ok
2024-Jun-06 15:57:25: Prepare to add shader GUI
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 3
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: GUI
2024-Jun-06 15:57:25: Prepare to add shader Parallax
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
WARNING: 0:27: 'assign' : implicit type conversion allowed from GLSL 1.20
WARNING: 0:27: 'assign' : implicit type conversion allowed from GLSL 1.20
WARNING: 0:27: 'assign' : implicit type conversion allowed
2024-Jun-06 15:57:25: Shader program is - 6
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Parallax
2024-Jun-06 15:57:25: Prepare to add shader Directlight
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 9
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Directlight
2024-Jun-06 15:57:25: Prepare to add shader Env
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 12
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Env
2024-Jun-06 15:57:25: Prepare to add shader Water
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
WARNING: 0:20: 'assign' : implicit type conversion allowed from GLSL 1.20
2024-Jun-06 15:57:25: Shader program is - 15
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Water
2024-Jun-06 15:57:25: Prepare to add shader Frame
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 18
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Frame
2024-Jun-06 15:57:25: Prepare to add shader Lightview
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 21
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Lightview
2024-Jun-06 15:57:25: Prepare to add shader Simple3D
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-06 15:57:25: Shader program is - 24
2024-Jun-06 15:57:25: ResourceManager::ShaderManager::Shader
2024-Jun-06 15:57:25: ResourceManager::ShaderManager shader loaded: Simple3D
2024-Jun-06 15:57:25: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1
2024-Jun-06 15:57:25: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2
2024-Jun-06 15:57:25: Lite model added successfully: models/bt_box_yellow.lm1
2024-Jun-06 15:57:25: ResourceManager::TexList Texture added: bt_cone.bmp with id = 3
2024-Jun-06 15:57:25: Lite model added successfully: models/bt_cone.lm1
2024-Jun-06 15:57:25: Lite model added successfully: models/girl.lm1
2024-Jun-06 15:57:25: Lite model added successfully: models/bonemodel.lm1
2024-Jun-06 15:57:26: ResourceManager::TexList Texture added: out.bmp with id = 4
2024-Jun-06 15:57:26: FrameManager:: frame buffer added: Skybox
2024-Jun-06 15:57:26: ResourceManager::TexList Texture added: normalmap.bmp with id = 6
2024-Jun-06 15:57:26: FrameManager:: frame buffer added: ScreenBlur
2024-Jun-06 15:57:26: FrameManager:: frame buffer added: ShadowBufferGlobal
2024-Jun-06 15:57:26: FrameManager:: frame buffer added: ShadowBufferLocal
+302
View File
@@ -0,0 +1,302 @@
#include "main.h"
float CONST_CAM_ALPHA_MOUSE_SENSITIVETY = 0.005f;
float CONST_CAM_PHI_MOUSE_SENSITIVETY = 0.005f;
float CONST_CAM_ZOOM_SENSITIVITY = 1.0f/120.0f;
cardinal CONST_CUBEMAP_UPDATE_INTERVAL = 5000;
void TMyApplication::DrawToCubemap()
{
Renderer->PushShader("Directlight");
Renderer->SwitchToCubemapBuffer("Skybox",0);
Renderer->SetGlPosXView();
DrawSceneWithoutWater();
Renderer->SwitchToCubemapBuffer("Skybox",1);
Renderer->SetGlNegXView();
DrawSceneWithoutWater();
Renderer->SwitchToCubemapBuffer("Skybox",2);
Renderer->SetGlPosYView();
DrawSceneWithoutWater();
Renderer->SwitchToCubemapBuffer("Skybox",3);
Renderer->SetGlNegYView();
DrawSceneWithoutWater();
Renderer->SwitchToCubemapBuffer("Skybox",4);
Renderer->SetGlPosZView();
DrawSceneWithoutWater();
Renderer->SwitchToCubemapBuffer("Skybox",5);
Renderer->SetGlNegZView();
DrawSceneWithoutWater();
Renderer->SwitchToScreen();
Renderer->PopShader();
}
void TMyApplication::DrawToShadowMap()
{
Renderer->PushShader("Lightview");
Renderer->BeginDrawToDepthBufferGlobal(std::string("ShadowBufferGlobal"));
DrawSceneWithoutWater();
Renderer->BeginDrawToDepthBufferLocal(std::string("ShadowBufferLocal"));
DrawSceneWithoutWater();
Renderer->EndDrawToDepthBuffer();
Renderer->PopShader();
}
void TMyApplication::DrawSceneWithoutWater()
{
GameMap.DrawVBO();
}
void TMyApplication::DrawWaterSurface()
{
Renderer->PushShader("Water");
RenderUniform1f("WaterTimer", WaterTimer);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["normalmap.bmp"]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, ResourceManager->FrameManager.GetFrameTexture("Skybox"));
glBegin(GL_POLYGON);
glTexCoord2f(2, 2);
glVertex3f(20, 0, 20);
glTexCoord2f(2, 0);
glVertex3f(20, 0, -20);
glTexCoord2f(0, 0);
glVertex3f(-20, 0, -20);
glTexCoord2f(0, 2);
glVertex3f(-20, 0, 20);
glEnd();
Renderer->PopShader();
}
//What to do on init
void TMyApplication::InnerInit()
{
ResourceManager->PathToResources = "C:\\Work\\OldProjects\\ho3\\resources\\";
ResourceManager->ShaderManager.AddShader("GUI", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment");
ResourceManager->ShaderManager.AddShader("Parallax", "shaders/directlight_parallax_shadow.vertex", "shaders/directlight_parallax_shadow.fragment");
ResourceManager->ShaderManager.AddShader("Directlight", "shaders/directlight.vertex", "shaders/directlight.fragment");
ResourceManager->ShaderManager.AddShader("Env", "shaders/env.vertex", "shaders/env.fragment");
ResourceManager->ShaderManager.AddShader("Water", "shaders/water.vertex", "shaders/water.fragment");
ResourceManager->ShaderManager.AddShader("Frame", "shaders/frame.vertex", "shaders/frame.fragment");
ResourceManager->ShaderManager.AddShader("Lightview", "shaders/lightview.vertex", "shaders/lightview.fragment");
ResourceManager->ShaderManager.AddShader("Simple3D", "shaders/simple3d.vertex", "shaders/simple3d.fragment");
Renderer->SetBackgroundShader("Env");
Renderer->PushShader("Parallax");
//Renderer->PushShader("GUI");
ResourceManager->ModelManager.AddLiteModel("models/bt_box_yellow.lm1");
ResourceManager->ModelManager.AddLiteModel("models/bt_cone.lm1");
ResourceManager->ModelManager.AddLiteModel("models/girl.lm1");
ResourceManager->ModelAnimManager.AddAnimationToModel("girl.lm1","models/girl.bn2");
ResourceManager->ModelAnimManager["girl.lm1"]->LoadAnimSequenceFromFileAn1("models/girl.an1");
ResourceManager->ModelManager.AddLiteModel("models/bonemodel.lm1");
ResourceManager->ModelAnimManager.AddAnimationToModel("bonemodel.lm1","models/bonemodel.bn2");
ResourceManager->ModelAnimManager["bonemodel.lm1"]->LoadAnimSequenceFromFileAn1("models/bonemodel.an1");
GameMap.LoadMap();
Renderer->SetLandToCalcCollision(GameMap.GetLand());
Renderer->MoveDist(15.0f);
Renderer->MovePhi(pi/6);
float len = 50.0f;
//ResourceManager->LightManager.SetLightPos(0, vec4(-len * cos(pi/4), len * sin(pi/4), 0.0f, 0.0f));
ResourceManager->FrameManager.AddCubemapBuffer("Skybox",256,256);
Renderer->SetBackgroundCubemap(ResourceManager->FrameManager.GetFrameTexture("Skybox"));
ResourceManager->TexList.AddTexture("../resources/normalmap.bmp");
ResourceManager->FrameManager.AddFrameRenderBuffer("ScreenBlur", 512, 512);
ResourceManager->FrameManager.AddDepthBuffer("ShadowBufferGlobal", 512, 512);
ResourceManager->FrameManager.AddDepthBuffer("ShadowBufferLocal", 1024, 1024);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, ResourceManager->FrameManager.GetFrameTexture("ShadowBufferGlobal"));
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, ResourceManager->FrameManager.GetFrameTexture("ShadowBufferLocal"));
glActiveTexture(GL_TEXTURE0);
glClearColor(0.2f, 0.5f, 1.0f, 1.0f);
//Renderer->SetShadowClampValue(0.3f);
Renderer->SetShadowClampValue(0.0f);
}
//What to do on deinit
void TMyApplication::InnerDeinit()
{
GameMap.FreeMap();
ResourceManager->FrameManager.DeleteFrameRenderBuffer("Skybox");
}
//What to do on draw
void TMyApplication::InnerDraw()
{
Renderer->SwitchToScreen();
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
Renderer->PushShader("GUI");
DrawSceneWithoutWater();
Renderer->PopShader();
/*
DrawToCubemap();
DrawToShadowMap();
Renderer->SwitchToFrameBuffer(std::string("ScreenBlur"));
DrawSceneWithoutWater();
DrawWaterSurface();
Renderer->SwitchToScreen();
Renderer->PushShader("Frame");
Renderer->DrawFrameFullScreen(std::string("ScreenBlur"));
Renderer->PopShader();*/
/*
Renderer->SwitchToFrameBuffer(std::string("ScreenBlur"));
Renderer->PushShader("GUI");
DrawSceneWithoutWater();
Renderer->PopShader();
Renderer->SwitchToScreen();
Renderer->PushShader("Frame");
Renderer->DrawFrameFullScreen(std::string("ScreenBlur"));
Renderer->PopShader();*/
}
//What to do on update. timer means how many ms passed since last update
void TMyApplication::InnerUpdate(cardinal timer)
{
WaterTimer += 0.001f * timer;
GameMap.Update(timer);
}
void TMyApplication::UpdateQuick()
{
if (GetKeyState(VK_UP) >> 15)
{
Renderer->MoveForward();
}
if (GetKeyState(VK_DOWN) >> 15)
{
Renderer->MoveBackward();
}
if (GetKeyState(VK_LEFT) >> 15)
{
Renderer->MoveLeft();
}
if (GetKeyState(VK_RIGHT) >> 15)
{
Renderer->MoveRight();
}
}
void TMyApplication::OnMouseMove(TMouseState& mouseState)
{
if (MouseRightButtonPressed)
{
int dx = mouseState.X - MouseX0;
int dy = mouseState.Y - MouseY0;
MouseX0 = mouseState.X;
MouseY0 = mouseState.Y;
Renderer->MoveAlpha(dx * CONST_CAM_ALPHA_MOUSE_SENSITIVETY);
Renderer->MovePhi(dy * CONST_CAM_PHI_MOUSE_SENSITIVETY);
}
}
void TMyApplication::OnMouseDown(TMouseState& mouseState)
{
if (mouseState.RightButtonPressed)
{
MouseRightButtonPressed = true;
MouseX0 = mouseState.X;
MouseY0 = mouseState.Y;
}
if (mouseState.LeftButtonPressed)
{
MouseLeftButtonPressed = true;
}
}
void TMyApplication::OnMouseUp(TMouseState& mouseState)
{
MouseRightButtonPressed = false;
if (MouseLeftButtonPressed)
{
MouseLeftButtonPressed = false;
GameMap.PlayerClicked(mouseState.X, mouseState.Y);
}
}
void TMyApplication::OnMouseWheel(short int delta)
{
Renderer->MoveDist(-CONST_CAM_ZOOM_SENSITIVITY * delta);
}
int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
LPSTR lpszCmdLine, int nCmdShow)
{
//Create application
TMyApplication Application;
//Start application
return MainLoop(Application);
}
+70
View File
@@ -0,0 +1,70 @@
#pragma once
/* Path to the engine */
#include "SalmonEngineWindows.h"
#include "gameMap.h"
using namespace SE;
//Application class
class TMyApplication : public SE::TApplication
{
/*
TLiteModel* lm;
TSimpleLandClass* TestLand;
glmat3 LiteModelRotateMatrix;
glmat3 LiteModelDeltaRotateMatrix;
cardinal LiteModelUpdateTimer;
*/
TGameMap GameMap;
bool MouseRightButtonPressed;
//Rotate camera on mouse right button pressed
bool MouseLeftButtonPressed;
int MouseX0, MouseY0;
//Mouse pos caught on right button click
float WaterTimer;
void DrawSceneWithoutWater();
void DrawToCubemap();
void DrawToShadowMap();
void DrawWaterSurface();
public:
//Constructor
TMyApplication() : MouseRightButtonPressed(false), MouseLeftButtonPressed(false), WaterTimer(0) { }
virtual void InnerInit();
//What to do on init
virtual void InnerDeinit();
//What to do on deinit
virtual void InnerDraw();
//What to do on draw
virtual void InnerUpdate(cardinal timer);
//What to do on update. timer means how many ms passed since last update
virtual void UpdateQuick();
//To process input - this method is called more frequently than Update()
virtual void OnMouseMove(TMouseState& mouseState);
//To do on mouse move (with or without pressed buttons)
virtual void OnMouseDown(TMouseState& mouseState);
//To do on mouse move (with or without pressed buttons)
virtual void OnMouseUp(TMouseState& mouseState);
//To do on mouse move (with or without pressed buttons)
virtual void OnMouseWheel(short int delta);
//To do on mouse wheel move
};