Resurrection

This commit is contained in:
Vladislav Khorev 2024-06-06 16:25:38 +03:00
commit d132060e19
59 changed files with 2616 additions and 0 deletions

400
.gitignore vendored Normal file
View File

@ -0,0 +1,400 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
.svn/

28
Template.sln Normal file
View File

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Template", "Template\Template.vcxproj", "{0080A3E1-DFBF-4557-B198-E6D5D7724393}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|Win32.ActiveCfg = Debug|Win32
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|Win32.Build.0 = Debug|Win32
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x64.ActiveCfg = Debug|x64
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Debug|x64.Build.0 = Debug|x64
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|Win32.ActiveCfg = Release|Win32
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|Win32.Build.0 = Release|Win32
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x64.ActiveCfg = Release|x64
{0080A3E1-DFBF-4557-B198-E6D5D7724393}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

157
Template/Template.vcxproj Normal file
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>

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
Template/gameMap.cpp Normal file
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
Template/gameMap.h Normal file
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
Template/log.txt Normal file
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
Template/main.cpp Normal file
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
Template/main.h Normal file
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
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

BIN
resources/models/girl.an1 Normal file

Binary file not shown.

BIN
resources/models/girl.bn2 Normal file

Binary file not shown.

BIN
resources/models/girl.lm1 Normal file

Binary file not shown.

BIN
resources/normalmap.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -0,0 +1,23 @@
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
{
float xstep = 0.5f/800.0f;
float ystep = 0.5f/600.0f;
vec4 texColor =
vec4(texture2D(Texture,texCoord).rgb,1.0) * 0.2
+ vec4(texture2D(Texture, vec2(texCoord.x+xstep, texCoord.y+ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x-xstep, texCoord.y+ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x-xstep, texCoord.y-ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x+xstep, texCoord.y-ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x, texCoord.y+2.0*ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x, texCoord.y-2.0*ystep)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x-2.0*xstep, texCoord.y)).rgb,1.0) * 0.1
+ vec4(texture2D(Texture, vec2(texCoord.x+2.0*xstep, texCoord.y)).rgb,1.0) * 0.1;
gl_FragColor = texColor;
}

View File

@ -0,0 +1,7 @@
varying vec2 texCoord;
void main()
{
gl_Position = ftransform();
texCoord = gl_MultiTexCoord0.st;
}

View File

@ -0,0 +1,38 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
vec3 norm;
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec3 TexRGB = texture2D(Texture, texCoord.st).rgb;
vec3 cVec = normalize(camVec);
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = (texture2D(NormalMap, texCoord.st).rgb - 0.5) * 2.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
ambient = gl_LightSource[0].ambient;
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * max( dot(lightVec,norm),0.0);
specular = gl_LightSource[0].specular * shineFactor;
gl_FragColor = vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular);
}

View File

@ -0,0 +1,35 @@
/*
Bump mapping shader without parallax mapping for single directional light source
The fastest shader for bump mapping
*/
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
texCoord = gl_MultiTexCoord0.st;
vec3 lVec = normalize(gl_LightSource[0].position.xyz);
vec3 cVec = (CamPos - gl_Vertex.xyz);
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
}

View File

@ -0,0 +1,72 @@
/*
Bump mapping shader without parallax mapping but with shadows for single directional light source
*/
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
//For shadows
uniform sampler2D ShadowMap;
uniform float ShadowDepth;
varying vec4 vPos;
varying vec4 gPos;
float shadowCoef()
{
vec4 shadow_coord = gl_TextureMatrix[2]*vPos;
shadow_coord.w = shadow_coord.z;
// get the stored depth
float shadow_d = texture2D(ShadowMap, shadow_coord.xy).x;
// get the difference of the stored depth and the distance of this fragment to the light
float diff = min(shadow_d - shadow_coord.z,0.0);
float shadow_coef = clamp( 20*ShadowDepth*diff + 1.0, 0.0, 1.0); //[0..1]
return shadow_coef;
}
void main()
{
vec3 norm;
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec3 TexRGB = texture2D(Texture, texCoord.st).rgb;
vec3 cVec = normalize(camVec);
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = (texture2D(NormalMap, texCoord.st).rgb - 0.5) * 2.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
float shadow_coef = shadowCoef();
ambient = gl_LightSource[0].ambient;
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * min( max(dot(lightVec,norm),0.0),shadow_coef);
specular = gl_LightSource[0].specular * min(shineFactor,shadow_coef);
gl_FragColor = vec4(TexRGB,1.0)*max(ambient,diffuse)+specular;
}

View File

@ -0,0 +1,44 @@
/*
Bump mapping shader without parallax mapping but with shadows for single directional light source
*/
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
//for fragment shader
varying vec4 vPos;
varying vec4 gPos;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * realVertexPos;
texCoord = gl_MultiTexCoord0.st;
vec3 lVec = normalize(gl_LightSource[0].position.xyz);
vec3 cVec = (CamPos - gl_Vertex.xyz);
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
//For shadows
vPos = realVertexPos;
gPos = gl_ProjectionMatrix * gl_Position;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

View File

@ -0,0 +1,78 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
//For shadows
uniform sampler2D ShadowMap;
uniform float ShadowDepth;
varying vec4 vPos;
varying vec4 gPos;
float shadowCoef()
{
vec4 shadow_coord = gl_TextureMatrix[2]*vPos;
shadow_coord.w = shadow_coord.z;
// get the stored depth
float shadow_d = texture2D(ShadowMap, shadow_coord.xy).x;
// get the difference of the stored depth and the distance of this fragment to the light
float diff = min(shadow_d - shadow_coord.z,0.0);
float shadow_coef = clamp( 20*ShadowDepth*diff + 1.0, 0.0, 1.0); //[0..1]
return shadow_coef;
}
void main()
{
vec3 lVec = lightVec;
vec3 cVec = normalize(camVec);
vec4 ambient;
vec4 diffuse;
vec4 specular;
float parallax = 0.035;
//double refinement
float height = texture2D(NormalMap, texCoord.xy).a;
float offset = parallax * (2.0 * height - 1.0);
vec2 parallaxTexCoord = texCoord.xy + offset * cVec.xy;
height += texture2D(NormalMap, parallaxTexCoord).a;
offset = parallax * (height - 1.0);
parallaxTexCoord = texCoord.xy + offset * cVec.xy;
//go-go-go
vec3 TexRGB = texture2D(Texture, parallaxTexCoord).xyz;
vec3 norm;
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = texture2D(NormalMap, parallaxTexCoord).xyz * 2.0 - 1.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
float shadow_coef = shadowCoef();
ambient = gl_LightSource[0].ambient;
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * min( max(dot(lightVec,norm),0.0),shadow_coef);
specular = gl_LightSource[0].specular * min(shineFactor,shadow_coef);
gl_FragColor = vec4(TexRGB,1.0)*max(ambient,diffuse)+specular;
}

View File

@ -0,0 +1,46 @@
/*
Bump/parallax mapping shader for single directional light source
The fastest shader for bump/bump mapping
*/
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
//for fragment shader
varying vec4 vPos;
varying vec4 gPos;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * realVertexPos;
texCoord = gl_MultiTexCoord0.st;
vec3 lVec = normalize(gl_LightSource[0].position.xyz);
vec3 cVec = (CamPos - gl_Vertex.xyz);
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
//For shadows
vPos = realVertexPos;
gPos = gl_ProjectionMatrix * gl_Position;
gl_TexCoord[0] = gl_MultiTexCoord0;
}

View File

@ -0,0 +1,4 @@
void main()
{
gl_FragColor = vec4(1.0,1.0,1.0,1.0);
}

View File

@ -0,0 +1,12 @@
/* Shader to draw nothing. This shader is used when render scene to depth buffer only
For example, to make depth texture from light source position
*/
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * realVertexPos;
}

View File

@ -0,0 +1,43 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying int activeLightCount;
varying vec3 camVec;
varying vec3 lightVec[8];
void main()
{
vec3 norm;
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec3 cVec = normalize(camVec);
vec3 lVec;
vec3 TexRGB = texture2D(Texture, texCoord.st).rgb;
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = (texture2D(NormalMap, texCoord.st).rgb - 0.5) * 2.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
for (int i=0; i<activeLightCount; i++)
{
lVec = normalize(lightVec[i]);
ambient = gl_LightSource[i].ambient;
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[i].diffuse * max( dot(lVec,norm),0.0);
specular = gl_LightSource[i].specular * shineFactor;
gl_FragColor += vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular);
}
}

View File

@ -0,0 +1,51 @@
/*
Bump mapping shader without parallax mapping for not more than 8 light sources
The slowest bump mapping shader
*/
uniform vec3 CamPos;
uniform int ActiveLightCount;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying int activeLightCount;
varying vec3 camVec;
varying vec3 lightVec[8];
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
texCoord = gl_MultiTexCoord0.st;
activeLightCount = ActiveLightCount;
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
vec3 lVec;
vec3 cVec = CamPos - gl_Vertex.xyz;
camVec = cVec * rot;
for (int i=0; i<ActiveLightCount; i++)
{
if (gl_LightSource[i].position.w == 0.0)
lVec = gl_LightSource[i].position.xyz;
else
lVec = gl_LightSource[i].position.xyz - gl_Vertex.xyz;
lightVec[i] = lVec * rot;
}
}

View File

@ -0,0 +1,54 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying int activeLightCount;
varying vec3 camVec;
varying vec3 lightVec[8];
void main()
{
vec3 lVec;
vec3 cVec = normalize(camVec);
float parallax = 0.035;
//double refinement
float height = texture2D(NormalMap, texCoord.xy).a;
float offset = parallax * (2.0 * height - 1.0);
vec2 parallaxTexCoord = texCoord.xy + offset * cVec.xy;
height += texture2D(NormalMap, parallaxTexCoord).a;
offset = parallax * (height - 1.0);
parallaxTexCoord = texCoord.xy + offset * cVec.xy;
//go-go-go
vec3 TexRGB = texture2D(Texture, parallaxTexCoord).xyz;
vec3 norm;
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = texture2D(NormalMap, parallaxTexCoord).xyz * 2.0 - 1.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
for (int i=0;i<activeLightCount;i++)
{
vec3 lVec = normalize(lightVec[i]);
vec4 ambient = gl_LightSource[i].ambient;
vec4 diffuse = gl_FrontMaterial.diffuse * gl_LightSource[i].diffuse * max( dot(lVec,norm),0.0);
vec4 specular = gl_LightSource[i].specular * shineFactor;
gl_FragColor += vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular);
}
}

View File

@ -0,0 +1,49 @@
/*
Bump/parallax mapping shader for not more than 8 light sources
The slowest bump/parallax mapping shader
*/
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
uniform int ActiveLightCount;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying int activeLightCount;
varying vec3 camVec;
varying vec3 lightVec[8];
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
texCoord = gl_MultiTexCoord0.st;
activeLightCount = ActiveLightCount;
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
vec3 lVec;
vec3 cVec = (CamPos - gl_Vertex.xyz);
camVec = cVec * rot;
for (int i=0;i<ActiveLightCount;i++)
{
if (gl_LightSource[i].position.w == 0.0)
lVec = gl_LightSource[i].position.xyz;
else
lVec = gl_LightSource[i].position.xyz - gl_Vertex.xyz;
lightVec[i] = lVec * rot;
}
}

View File

@ -0,0 +1,39 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
vec3 norm;
vec4 diffuse;
vec4 specular;
vec3 cVec = normalize(camVec);
vec3 lVec = normalize(lightVec);
vec3 TexRGB = texture2D(Texture, texCoord.st).rgb;
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = (texture2D(NormalMap, texCoord.st).rgb - 0.5)* 2.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * max( dot(lVec,norm),0.0);
specular = gl_LightSource[0].specular * shineFactor;
gl_FragColor = vec4(TexRGB,1.0)*gl_LightSource[0].ambient+(vec4(TexRGB,1.0)*diffuse+specular);
}

View File

@ -0,0 +1,38 @@
// Bump mapping shader without parallax mapping for single light source
// Slower than directlight_bump but faster than multilight_bump
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
texCoord = gl_MultiTexCoord0.st;
vec3 lVec;
if (gl_LightSource[0].position.w == 0.0)
lVec = gl_LightSource[0].position.xyz;
else
lVec = gl_LightSource[0].position.xyz - gl_Vertex.xyz;
vec3 cVec = CamPos - gl_Vertex.xyz;
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
}

View File

@ -0,0 +1,47 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
vec3 lVec = normalize(lightVec);
vec3 cVec = normalize(camVec);
float parallax = 0.035;
//double refinement
float height = texture2D(NormalMap, texCoord.xy).a;
float offset = parallax * (2.0 * height - 1.0);
vec2 parallaxTexCoord = texCoord.xy + offset * cVec.xy;
height += texture2D(NormalMap, parallaxTexCoord).a;
offset = parallax * (height - 1.0);
parallaxTexCoord = texCoord.xy + offset * cVec.xy;
//go-go-go
vec3 TexRGB = texture2D(Texture, parallaxTexCoord).xyz;
vec3 norm;
if (NormalMapExists == 0)
{
norm = vec3(0.0,0.0,1.0);
}
else
{
norm = texture2D(NormalMap, parallaxTexCoord).xyz * 2.0 - 1.0;
}
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
vec4 ambient = gl_LightSource[0].ambient;
vec4 diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * max( dot(lVec,norm),0.0);
vec4 specular = gl_LightSource[0].specular * shineFactor;
gl_FragColor = vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular);
}

View File

@ -0,0 +1,41 @@
/*
Bump/parallax mapping shader for single light source
Slower than directlight_parallax but faster than multilight_parallax
*/
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
texCoord = gl_MultiTexCoord0.st;
vec3 lVec;
vec3 cVec = (CamPos - gl_Vertex.xyz);
if (gl_LightSource[0].position.w == 0.0)
lVec = gl_LightSource[0].position.xyz;
else
lVec = gl_LightSource[0].position.xyz - gl_Vertex.xyz;
mat3 rot;
rot[0] = Tangent;
rot[1] = Binormal;
rot[2] = gl_Normal.xyz;
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
}

View File

@ -0,0 +1,36 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
uniform float FogBeginDistance;
uniform float FogEndDistance;
uniform vec4 FogColor;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
varying vec3 vertexPos;
void main()
{
vec3 lVec = lightVec;
vec3 cVec = normalize(camVec);
//go-go-go
vec3 TexRGB = texture2D(Texture, texCoord.xy).xyz;
vec3 norm = vec3(0.0,0.0,1.0);
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
float light_coef = 1.0;
vec4 ambient = gl_LightSource[0].ambient;
vec4 diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * min( max(dot(lVec,norm),0.0), light_coef);
vec4 specular = gl_LightSource[0].specular * min(shineFactor, light_coef);
float fogFactor = min(max(max(abs(vertexPos.x)-FogBeginDistance, abs(vertexPos.z)-FogBeginDistance),0.0)/(FogEndDistance - FogBeginDistance),1.0);
gl_FragColor = mix(vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular), FogColor, fogFactor);
}

View File

@ -0,0 +1,35 @@
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
varying vec3 vertexPos;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * gl_Vertex.xyz + ModelTranslateVector, 1.0);
gl_Position = gl_ModelViewProjectionMatrix * realVertexPos;
texCoord = gl_MultiTexCoord0.st;
vec3 lVec = normalize(gl_LightSource[0].position.xyz);
vec3 cVec = (CamPos - gl_Vertex.xyz);
vertexPos = gl_Vertex.xyz;
mat3 rot;
rot[0] = normalize(Tangent);
rot[1] = normalize(Binormal);
rot[2] = normalize(gl_Normal.xyz);
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
}

View File

@ -0,0 +1,209 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform int NormalMapExists;
uniform float FogBeginDistance;
uniform float FogEndDistance;
uniform vec4 FogColor;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
varying vec3 vertexPos;
//For shadows
uniform sampler2D ShadowMapGlobal;
uniform sampler2D ShadowMapLocal;
uniform float ShadowClampValue;
varying vec4 vPos;
varying vec4 gPos;
float CalcPCFGlobal(vec4 shadowCoord);
float CalcPCFLocal(vec4 shadowCoord);
vec2 myrand2(vec2 co)
{
return vec2(fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453),
fract(sin(dot(vec2(1-co.y,1-co.x) ,vec2(12.9898,78.233))) * 43758.5453));
}
float shadowCoef()
{
vec4 shadow_coord = gl_TextureMatrix[3]*vPos;
float shadow_d;
float pcf;
if (shadow_coord.x < 0.0 || shadow_coord.x > 1.0
|| shadow_coord.y < 0.0 || shadow_coord.y > 1.0)
{
shadow_coord = gl_TextureMatrix[2]*vPos;
shadow_coord.w = shadow_coord.z;
pcf = CalcPCFGlobal(shadow_coord);
}
else
{
shadow_coord.w = shadow_coord.z;
pcf = CalcPCFLocal(shadow_coord);
}
return clamp(1.0 - pcf, ShadowClampValue, 1.0);
}
float CalcPCFGlobal(vec4 shadowCoord)
{
float diff;
float shadow_d;
vec3 shadow_coord = shadowCoord.xyz;
shadow_d = texture2D(ShadowMapGlobal, shadow_coord.xy).x;
diff = clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.x += 0.001;
shadow_d = texture2D(ShadowMapGlobal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x -= 0.001;
shadow_d = texture2D(ShadowMapGlobal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.y += 0.001;
shadow_d = texture2D(ShadowMapGlobal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.y -= 0.001;
shadow_d = texture2D(ShadowMapGlobal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
return diff*0.2;
}
float CalcPCFLocal(vec4 shadowCoord)
{
float diff;
float shadow_d;
vec3 shadow_coord;
shadow_coord = shadowCoord.xyz;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff = clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x += 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x -= 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.y += 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.y -= 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x += 0.001;
shadow_coord.y += 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x -= 0.001;
shadow_coord.y += 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x += 0.001;
shadow_coord.y -= 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
shadow_coord.xy = shadowCoord.xy;
shadow_coord.x -= 0.001;
shadow_coord.y -= 0.001;
shadow_coord.xy = shadow_coord.xy + myrand2(shadow_coord.xy)*0.004;
shadow_d = texture2D(ShadowMapLocal, shadow_coord.xy).x;
diff += clamp(60000*(shadow_d - shadow_coord.z+0.004), 0.0, 1.0);
return diff*0.11;
}
void main()
{
vec3 lVec = lightVec;
vec3 cVec = normalize(camVec);
float parallax = 0.035;
//double refinement
float height;
float offset;
vec2 parallaxTexCoord;
if (NormalMapExists != 0)
{
height = texture2D(NormalMap, texCoord.xy).a;
offset = parallax * (2.0 * height - 1.0);
parallaxTexCoord = texCoord.xy + offset * cVec.xy;
height += texture2D(NormalMap, parallaxTexCoord).a;
offset = parallax * (height - 1.0);
parallaxTexCoord = texCoord.xy + offset * cVec.xy;
}
else
{
parallaxTexCoord = texCoord.xy;
}
//go-go-go
vec3 TexRGB = texture2D(Texture, parallaxTexCoord).xyz;
vec3 norm;
norm = (1-NormalMapExists) * vec3(0.0,0.0,1.0) + NormalMapExists*(texture2D(NormalMap, parallaxTexCoord).xyz * 2.0 - 1.0);
float shineFactor = 15.0 * pow(max(dot(cVec, norm),0.0),gl_FrontMaterial.shininess) / (129.0 - gl_FrontMaterial.shininess);
float light_coef;
if (lightVec.z <= 0.2)
{
light_coef = 1.0;
}
else
{
light_coef = 1.0 - shadowCoef();
}
vec4 ambient = gl_LightSource[0].ambient;
vec4 diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * min( max(dot(lVec,norm),0.0), light_coef);
vec4 specular = gl_LightSource[0].specular * min(shineFactor, light_coef);
float fogFactor = min(max(max(abs(vertexPos.x)-FogBeginDistance, abs(vertexPos.z)-FogBeginDistance),0.0)/(FogEndDistance - FogBeginDistance),1.0);
gl_FragColor = mix(vec4(TexRGB,1.0)*ambient+(vec4(TexRGB,1.0)*diffuse+specular), FogColor, fogFactor);
}

View File

@ -0,0 +1,48 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
uniform vec3 CamPos;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
uniform mat4 ProjectionMatrix;
uniform mat4 ProjectionMatrix1;
attribute vec3 Tangent;
attribute vec3 Binormal;
varying vec2 texCoord;
varying vec3 camVec;
varying vec3 lightVec;
varying vec3 vertexPos;
//For shadows
varying vec4 vPos;
varying vec4 gPos;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
gl_Position = ProjectionMatrix * realVertexPos;
texCoord = gl_MultiTexCoord0.st;
vec3 lVec = normalize(gl_LightSource[0].position.xyz);
vec3 cVec = (CamPos - vPosition.xyz);
vertexPos = vPosition.xyz;
mat3 rot;
rot[0] = normalize(Tangent);
rot[1] = normalize(Binormal);
rot[2] = normalize(gl_Normal.xyz);
rot = ModelRotateMatrix * rot;
lightVec = lVec * rot;
camVec = cVec * rot;
//For shadows
vPos = realVertexPos;
gPos = ProjectionMatrix1 * vec4(vPosition.xyz, 1.0);
}

View File

@ -0,0 +1,8 @@
uniform samplerCube Env;
varying vec3 dir;
void main(){
gl_FragColor = textureCube(Env, dir);
}

View File

@ -0,0 +1,7 @@
varying vec3 dir;
void main(){
gl_Position = ftransform();
dir = gl_Vertex.xyz;
}

View File

@ -0,0 +1,10 @@
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
{
vec4 texColor = texture2D(Texture,texCoord).rgba;
gl_FragColor = vec4(texColor.rgb,gl_FrontMaterial.diffuse.a * texColor.a);
}

View File

@ -0,0 +1,11 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 texCoord;
uniform mat4 ProjectionMatrix;
void main()
{
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord.st;
}

View File

@ -0,0 +1,4 @@
void main()
{
gl_FragColor = vec4(1.0,1.0,1.0,1.0);
}

View File

@ -0,0 +1,17 @@
/* Shader to draw nothing. This shader is used when render scene to depth buffer only
For example, to make depth texture from light source position
*/
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
attribute vec3 vPosition;
uniform mat4 ProjectionMatrix;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
gl_Position = ProjectionMatrix * realVertexPos;
}

View File

@ -0,0 +1,10 @@
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
{
vec4 texColor = texture2D(Texture,texCoord).rgba;
gl_FragColor = vec4(texColor.rgb, 1.0);
}

View File

@ -0,0 +1,16 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 texCoord;
uniform mat4 ProjectionMatrix;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
gl_Position = ProjectionMatrix * realVertexPos;
texCoord = vTexCoord.st;
}

View File

@ -0,0 +1,10 @@
uniform sampler2D Texture;
varying vec2 texCoord;
void main()
{
vec4 texColor = texture2D(Texture,texCoord).rgba;
gl_FragColor = vec4(texColor.rgb,gl_FrontMaterial.diffuse.a * texColor.a);
}

View File

@ -0,0 +1,11 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 texCoord;
uniform mat4 ProjectionMatrix;
void main()
{
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord.st;
}

View File

@ -0,0 +1,45 @@
uniform samplerCube Env;
uniform sampler2D NormalMap;
uniform vec3 CamPos;
uniform float WaterTimer;
varying vec3 camVec;
void main()
{
vec2 texCoord = gl_TexCoord[0].st;
mat3 rot;
rot[0] = vec3(0.0,0.0,1.0);
rot[1] = vec3(1.0,0.0,0.0);
rot[2] = vec3(0.0,1.0,0.0);
float sinx = 0.025*sin(WaterTimer+texCoord.x*5);
vec3 NVec1 = texture2D(NormalMap, vec2(-WaterTimer*0.04 + texCoord.x + sinx, -WaterTimer*0.04 + texCoord.y - sinx)).rgb;
vec3 NVec2 = texture2D(NormalMap, vec2( WaterTimer*0.04 + texCoord.y - sinx, -WaterTimer*0.04 + (1.0-texCoord.x) + sinx)).rgb;
NVec1 = (NVec1 -0.5) * 2.0;
NVec2 = (NVec2 -0.5) * 2.0;
vec3 NVec = NVec1 + NVec2;
vec3 NVecReflect = normalize(rot * (NVec1 + NVec2) + vec3(0,8,0));
vec3 NVecRefract = normalize(rot * (NVec1 + NVec2));
vec3 dir1 = reflect((camVec),NVecReflect);
//vec3 dir2 = refract((camVec),NVecRefract,0.9);
vec3 dir2 = reflect((camVec),NVecReflect);
dir2.y = - dir2.y;
vec4 reflectColor = textureCube(Env, dir1);
vec4 refractColor = textureCube(Env, dir2);
vec4 texColor = reflectColor*0.2 + refractColor*0.8;
gl_FragColor = vec4(texColor.xyz, 1.0f);
}

View File

@ -0,0 +1,13 @@
uniform vec3 CamPos;
varying vec3 camVec;
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
camVec = (gl_Vertex.xyz - CamPos);
}