More
This commit is contained in:
parent
7b31377be8
commit
9a0206bf35
Binary file not shown.
Binary file not shown.
|
@ -145,20 +145,20 @@
|
|||
<ClCompile Include="Core\Core.cpp" />
|
||||
<ClCompile Include="Core\Init.cpp" />
|
||||
<ClCompile Include="Core\ShaderManager.cpp" />
|
||||
<ClCompile Include="Render\Preparations\Basic.cpp" />
|
||||
<ClCompile Include="Render\Rendering\Basic.cpp" />
|
||||
<ClCompile Include="Resources\Resources.cpp" />
|
||||
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
|
||||
<ClCompile Include="Render\Resources\Resources.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Core\Buffer.h" />
|
||||
<ClInclude Include="Core\Core.h" />
|
||||
<ClInclude Include="Core\CoreIncludes.h" />
|
||||
<ClInclude Include="EngineIncludes.h" />
|
||||
<ClInclude Include="Model\Model.h" />
|
||||
<ClInclude Include="Model\ModelInfo.h" />
|
||||
<ClInclude Include="Render\Preparations\Preparations.h" />
|
||||
<ClInclude Include="Render\Rendering\Render.h" />
|
||||
<ClInclude Include="Resources\Resources.h" />
|
||||
<ClInclude Include="Definitions\GraphicalDefinition.h" />
|
||||
<ClInclude Include="Render\Resources\Resources.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Misc\Misc.vcxproj">
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
<ClCompile Include="Core\Init.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\Preparations\Basic.cpp">
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\Rendering\Basic.cpp">
|
||||
<ClCompile Include="Render\Preparations\BasicPreparations.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resources\Resources.cpp">
|
||||
<ClCompile Include="Render\Resources\Resources.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -47,9 +47,6 @@
|
|||
<ClInclude Include="Core\CoreIncludes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EngineIncludes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Preparations\Preparations.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -62,7 +59,10 @@
|
|||
<ClInclude Include="Model\Model.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resources\Resources.h">
|
||||
<ClInclude Include="Render\Resources\Resources.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Definitions\GraphicalDefinition.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
<?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>{0EC83E64-230E-48EF-B08C-6AC9651B4F82}</ProjectGuid>
|
||||
<RootNamespace>OysterGraphics</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</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'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(VCInstallDir)atlmfc\include;$(VCInstallDir)include</IncludePath>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib</LibraryPath>
|
||||
<ExecutablePath>$(VCInstallDir)bin;$(WindowsSDK_ExecutablePath_x86);$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(VCInstallDir)atlmfc\include;$(VCInstallDir)include</IncludePath>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib</LibraryPath>
|
||||
<ExecutablePath>$(VCInstallDir)bin;$(WindowsSDK_ExecutablePath_x86);$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(MSBuildToolsPath32);$(VSInstallDir);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
|
||||
<ReferencePath>$(VCInstallDir)atlmfc\lib;$(VCInstallDir)lib</ReferencePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Core\Buffer.cpp" />
|
||||
<ClCompile Include="Core\Core.cpp" />
|
||||
<ClCompile Include="Core\Init.cpp" />
|
||||
<ClCompile Include="Core\ShaderManager.cpp" />
|
||||
<ClCompile Include="FileLoader\ObjReader.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Core\Buffer.h" />
|
||||
<ClInclude Include="Core\Core.h" />
|
||||
<ClInclude Include="Core\CoreIncludes.h" />
|
||||
<ClInclude Include="EngineIncludes.h" />
|
||||
<ClInclude Include="Render\Preparations.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
|
||||
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">main</EntryPointName>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">main</EntryPointName>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</AssemblerOutput>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
Binary file not shown.
|
@ -1,2 +1,2 @@
|
|||
#v4.0:v110:false
|
||||
Debug|Win32|C:\DanBias\Danbias\|
|
||||
Debug|Win32|C:\Users\Tobias\Documents\GitHub\Danbias\|
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
Build started 11/15/2013 11:04:26 AM.
|
||||
1>Project "C:\DanBias\Danbias\Tester\Tester.vcxproj" on node 3 (Build target(s)).
|
||||
1>Link:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\DanBias\Danbias\Debug\Tester.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\DanBias\Danbias\Debug\Tester.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\DanBias\Danbias\Debug\Tester.lib" /MACHINE:X86 Debug\MainTest.obj
|
||||
C:\DanBias\External\Lib\Misc\Misc_x86D.lib
|
||||
C:\DanBias\External\Lib\OysterMath\OysterMath_x86D.lib
|
||||
C:\DanBias\External\Lib\OysterGraphics\OysterGraphics_x86D.lib
|
||||
Tester.vcxproj -> C:\DanBias\Danbias\Debug\Tester.exe
|
||||
1>Done Building Project "C:\DanBias\Danbias\Tester\Tester.vcxproj" (Build target(s)).
|
||||
Build started 2013-11-19 09:36:20.
|
||||
1>Project "C:\Users\Tobias\Documents\GitHub\Danbias\Tester\Tester.vcxproj" on node 2 (Build target(s)).
|
||||
1>InitializeBuildStatus:
|
||||
Creating "Debug\Tester.unsuccessfulbuild" because "AlwaysCreate" was specified.
|
||||
ClCompile:
|
||||
All outputs are up-to-date.
|
||||
Link:
|
||||
All outputs are up-to-date.
|
||||
Tester.vcxproj -> C:\Users\Tobias\Documents\GitHub\Danbias\Debug\Tester.exe
|
||||
FinalizeBuildStatus:
|
||||
Deleting file "Debug\Tester.unsuccessfulbuild".
|
||||
Touching "Debug\Tester.lastbuildstate".
|
||||
1>Done Building Project "C:\Users\Tobias\Documents\GitHub\Danbias\Tester\Tester.vcxproj" (Build target(s)).
|
||||
|
||||
Build succeeded.
|
||||
|
||||
Time Elapsed 00:00:00.98
|
||||
Time Elapsed 00:00:00.30
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,351 +0,0 @@
|
|||
#include "Core.h"
|
||||
#include <fstream>
|
||||
|
||||
const char* ShaderFunction = "main";
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
bool LoadPrecompiled(std::wstring filename, Core::ShaderManager::ShaderType type, std::wstring name);
|
||||
bool LoadCompile(std::wstring filename, Core::ShaderManager::ShaderType type, std::wstring name);
|
||||
namespace
|
||||
{
|
||||
struct ShaderData
|
||||
{
|
||||
size_t size;
|
||||
char* data;
|
||||
};
|
||||
std::vector<ID3D11PixelShader*> PS;
|
||||
std::map<std::wstring,int> PSMap;
|
||||
|
||||
std::vector<ID3D11GeometryShader*> GS;
|
||||
std::map<std::wstring,int> GSMap;
|
||||
|
||||
std::vector<ID3D11ComputeShader*> CS;
|
||||
std::map<std::wstring,int> CSMap;
|
||||
|
||||
std::vector<ID3D11VertexShader*> VS;
|
||||
std::vector<ShaderData> VData;
|
||||
std::map<std::wstring,int> VSMap;
|
||||
}
|
||||
|
||||
#pragma region Init
|
||||
bool Core::ShaderManager::Init(std::wstring filename, ShaderType type, std::wstring name, bool Precompiled)
|
||||
{
|
||||
if(Precompiled)
|
||||
{
|
||||
return LoadPrecompiled(filename, type, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
return LoadCompile(filename, type, name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadPrecompiled(std::wstring filename, Core::ShaderManager::ShaderType type, std::wstring name)
|
||||
{
|
||||
|
||||
std::ifstream stream;
|
||||
ShaderData sd;
|
||||
|
||||
|
||||
//Create Vertex shader and Layout
|
||||
stream.open(filename, std::ifstream::in | std::ifstream::binary);
|
||||
if(stream.good())
|
||||
{
|
||||
stream.seekg(0, std::ios::end);
|
||||
sd.size = size_t(stream.tellg());
|
||||
sd.data = new char[sd.size];
|
||||
stream.seekg(0, std::ios::beg);
|
||||
stream.read(&sd.data[0], sd.size);
|
||||
stream.close();
|
||||
|
||||
|
||||
ID3D11VertexShader* vertex;
|
||||
ID3D11GeometryShader* geometry;
|
||||
ID3D11PixelShader* pixel;
|
||||
ID3D11ComputeShader* compute;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case Core::ShaderManager::ShaderType::Vertex:
|
||||
|
||||
if(VSMap.count(name))
|
||||
return false;
|
||||
|
||||
if(FAILED(Core::Device->CreateVertexShader(sd.data, sd.size, 0, &vertex)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VSMap[name] = VS.size();
|
||||
VS.push_back(vertex);
|
||||
VData.push_back(sd);
|
||||
break;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Hull:
|
||||
case Core::ShaderManager::ShaderType::Domain:
|
||||
|
||||
return false;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Geometry:
|
||||
|
||||
if(GSMap.count(name))
|
||||
return false;
|
||||
if(FAILED(Core::Device->CreateGeometryShader(sd.data, sd.size, 0, &geometry)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
GSMap[name] = GS.size();
|
||||
GS.push_back(geometry);
|
||||
break;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Pixel:
|
||||
|
||||
if(PSMap.count(name))
|
||||
return false;
|
||||
if(FAILED(Core::Device->CreatePixelShader(sd.data, sd.size, 0, &pixel)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PSMap[name] = PS.size();
|
||||
PS.push_back(pixel);
|
||||
break;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Compute:
|
||||
|
||||
if(CSMap.count(name))
|
||||
return false;
|
||||
if(FAILED(Core::Device->CreateComputeShader(sd.data, sd.size, 0, &compute)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CSMap[name] = CS.size();
|
||||
CS.push_back(compute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadCompile(std::wstring filename, Core::ShaderManager::ShaderType type, std::wstring name)
|
||||
{
|
||||
/// \todo error reporting
|
||||
ID3D10Blob *Shader,*Error;
|
||||
switch(type)
|
||||
{
|
||||
case Core::ShaderManager::ShaderType::Pixel:
|
||||
|
||||
ID3D11PixelShader* pixel;
|
||||
|
||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"ps_5_0",0,0,&Shader,&Error)))
|
||||
{
|
||||
std::string fel = (char*)Error->GetBufferPointer();
|
||||
Error->Release();
|
||||
return false;
|
||||
}
|
||||
if(FAILED(Oyster::Core::Device->CreatePixelShader(Shader->GetBufferPointer(),Shader->GetBufferSize(),NULL,&pixel)))
|
||||
{
|
||||
Error->Release();
|
||||
Shader->Release();
|
||||
return false;
|
||||
}
|
||||
Shader->Release();
|
||||
if(!PSMap.count(name))
|
||||
{
|
||||
PSMap[name] = PS.size();
|
||||
PS.push_back(pixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
PS[PSMap[name]] = pixel;
|
||||
}
|
||||
break;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Geometry:
|
||||
|
||||
ID3D11GeometryShader* geometry;
|
||||
|
||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"gs_5_0",0,0,&Shader,&Error)))
|
||||
{
|
||||
std::string fel = (char*)Error->GetBufferPointer();
|
||||
Error->Release();
|
||||
return false;
|
||||
}
|
||||
if(FAILED(Oyster::Core::Device->CreateGeometryShader(Shader->GetBufferPointer(),Shader->GetBufferSize(),NULL,&geometry)))
|
||||
{
|
||||
Error->Release();
|
||||
Shader->Release();
|
||||
return false;
|
||||
}
|
||||
Shader->Release();
|
||||
if(!GSMap.count(name))
|
||||
{
|
||||
GSMap[name] = GS.size();
|
||||
GS.push_back(geometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
GS[GSMap[name]] = geometry;
|
||||
}
|
||||
break;
|
||||
|
||||
case Core::ShaderManager::ShaderType::Vertex:
|
||||
|
||||
ID3D11VertexShader* vertex;
|
||||
|
||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"vs_5_0",0,0,&Shader,&Error)))
|
||||
{
|
||||
std::string fel = (char*)Error->GetBufferPointer();
|
||||
Error->Release();
|
||||
return false;
|
||||
}
|
||||
if(FAILED(Oyster::Core::Device->CreateVertexShader(Shader->GetBufferPointer(),Shader->GetBufferSize(),NULL,&vertex)))
|
||||
{
|
||||
Error->Release();
|
||||
Shader->Release();
|
||||
return false;
|
||||
}
|
||||
if(!VSMap.count(name))
|
||||
{
|
||||
VSMap[name] = VS.size();
|
||||
VS.push_back(vertex);
|
||||
ShaderData sd;
|
||||
sd.size = Shader->GetBufferSize();
|
||||
sd.data = new char[sd.size];
|
||||
memcpy(sd.data,Shader->GetBufferPointer(),sd.size);
|
||||
VData.push_back(sd);
|
||||
}
|
||||
else
|
||||
{
|
||||
VS[VSMap[name]] = vertex;
|
||||
delete[] VData[VSMap[name]].data;
|
||||
VData[VSMap[name]].size = Shader->GetBufferSize();
|
||||
VData[VSMap[name]].data = new char[VData[VSMap[name]].size];
|
||||
memcpy(VData[VSMap[name]].data,Shader->GetBufferPointer(),VData[VSMap[name]].size);
|
||||
}
|
||||
|
||||
Shader->Release();
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
void Core::ShaderManager::CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC *desc, int ElementCount,int VertexIndex,ID3D11InputLayout *&Layout)
|
||||
{
|
||||
if(VertexIndex==-1)
|
||||
{
|
||||
Layout=0;
|
||||
return;
|
||||
}
|
||||
Device->CreateInputLayout(desc,ElementCount,VData[VertexIndex].data,VData[VertexIndex].size,&Layout);
|
||||
}
|
||||
|
||||
#pragma region Get
|
||||
int Core::ShaderManager::Get::Pixel(std::wstring Name)
|
||||
{
|
||||
if(PSMap.count(Name))
|
||||
return PSMap[Name];
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Core::ShaderManager::Get::Vertex(std::wstring Name)
|
||||
{
|
||||
if(VSMap.count(Name))
|
||||
return VSMap[Name];
|
||||
return -1;
|
||||
}
|
||||
int Core::ShaderManager::Get::Geometry(std::wstring Name)
|
||||
{
|
||||
if(GSMap.count(Name))
|
||||
return GSMap[Name];
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Core::ShaderManager::Get::Compute(std::wstring Name)
|
||||
{
|
||||
if(CSMap.count(Name))
|
||||
return CSMap[Name];
|
||||
return -1;
|
||||
}
|
||||
int Core::ShaderManager::Get::Hull(std::wstring Name)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int Core::ShaderManager::Get::Domain(std::wstring Name)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Set
|
||||
/// \todo smart set
|
||||
void Core::ShaderManager::Set::Pixel(int Index)
|
||||
{
|
||||
if(Index==-1)
|
||||
DeviceContext->PSSetShader( NULL,NULL,0);
|
||||
else
|
||||
DeviceContext->PSSetShader( PS[Index],NULL,0);
|
||||
}
|
||||
void Core::ShaderManager::Set::Vertex(int Index)
|
||||
{
|
||||
if(Index==-1)
|
||||
DeviceContext->VSSetShader( NULL,NULL,0);
|
||||
else
|
||||
DeviceContext->VSSetShader( VS[Index],NULL,0);
|
||||
}
|
||||
void Core::ShaderManager::Set::Geometry(int Index)
|
||||
{
|
||||
if(Index==-1)
|
||||
DeviceContext->GSSetShader( NULL,NULL,0);
|
||||
else
|
||||
DeviceContext->GSSetShader( GS[Index],NULL,0);
|
||||
}
|
||||
void Core::ShaderManager::Set::Compute(int Index)
|
||||
{
|
||||
if(Index==-1)
|
||||
DeviceContext->CSSetShader( NULL,NULL,0);
|
||||
else
|
||||
DeviceContext->CSSetShader( CS[Index],NULL,0);
|
||||
}
|
||||
/// \todo set Hull
|
||||
void Core::ShaderManager::Set::Hull(int Index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
/// \todo set Domain
|
||||
void Core::ShaderManager::Set::Domain(int Index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
/// \todo smart Set ie. not resetting the shader
|
||||
/// \todo research states
|
||||
/// \todo smart buffer set
|
||||
void Core::ShaderManager::SetShaderEffect(ShaderEffect se)
|
||||
{
|
||||
Set::Pixel(se.Shaders.Pixel);
|
||||
Set::Vertex(se.Shaders.Vertex);
|
||||
Set::Geometry(se.Shaders.Geometry);
|
||||
Set::Compute(se.Shaders.Compute);
|
||||
Oyster::Core::DeviceContext->IASetInputLayout(se.IAStage.Layout);
|
||||
Oyster::Core::DeviceContext->IASetPrimitiveTopology(se.IAStage.Topology);
|
||||
for(unsigned int i=0;i<se.CBuffers.Vertex.size();++i)
|
||||
se.CBuffers.Vertex[i]->Apply(i);
|
||||
for(unsigned int i=0;i<se.CBuffers.Geometry.size();++i)
|
||||
se.CBuffers.Geometry[i]->Apply(i);
|
||||
for(unsigned int i=0;i<se.CBuffers.Pixel.size();++i)
|
||||
se.CBuffers.Pixel[i]->Apply(i);
|
||||
Oyster::Core::DeviceContext->RSSetState(se.RenderStates.Rasterizer);
|
||||
Oyster::Core::DeviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
||||
float test[4] = {0};
|
||||
Oyster::Core::DeviceContext->OMSetBlendState(se.RenderStates.BlendState,test,-1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<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="Core\Buffer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\Core.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\Model.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\TextBox.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resourses\Buffers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resourses\Manager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resourses\PipelineResources.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resourses\ShaderEffects.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Engine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\ShaderManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Core\Buffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Core\Core.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Core\CoreIncludes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Lights.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Model.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\ModelInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\TextBox.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resourses\Buffers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resourses\GraphicsDefinitions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resourses\Manager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resourses\PipelineResources.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resourses\ShaderEffects.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Engine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EngineIncludes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileLoader\ObjReader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue