Merge branch 'Graphics' of https://github.com/dean11/Danbias into Graphics

This commit is contained in:
Dander7BD 2013-11-22 10:24:08 +01:00
commit 480a624019
26 changed files with 66263 additions and 82 deletions

Binary file not shown.

Binary file not shown.

33004
Code/Debug/bth.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -143,7 +143,7 @@ namespace Oyster
ID3D11PixelShader* pixel; ID3D11PixelShader* pixel;
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"ps_5_0",0,0,&Shader,&Error))) if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"ps_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
{ {
std::string fel = (char*)Error->GetBufferPointer(); std::string fel = (char*)Error->GetBufferPointer();
Error->Release(); Error->Release();
@ -170,7 +170,7 @@ namespace Oyster
ID3D11GeometryShader* geometry; ID3D11GeometryShader* geometry;
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"gs_5_0",0,0,&Shader,&Error))) if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"gs_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
{ {
std::string fel = (char*)Error->GetBufferPointer(); std::string fel = (char*)Error->GetBufferPointer();
Error->Release(); Error->Release();
@ -197,7 +197,7 @@ namespace Oyster
ID3D11VertexShader* vertex; ID3D11VertexShader* vertex;
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"vs_5_0",0,0,&Shader,&Error))) if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"vs_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
{ {
std::string fel = (char*)Error->GetBufferPointer(); std::string fel = (char*)Error->GetBufferPointer();
Error->Release(); Error->Release();

View File

@ -13,6 +13,12 @@ namespace Oyster
Oyster::Math::Float2 uv; Oyster::Math::Float2 uv;
Oyster::Math::Float3 normal; Oyster::Math::Float3 normal;
}; };
struct VP
{
Oyster::Math::Matrix V;
Oyster::Math::Matrix P;
};
} }
} }
} }

View File

@ -1,4 +1,5 @@
#include "OBJReader.h" #include "OBJReader.h"
#include "..\Definitions\GraphicalDefinition.h"
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
@ -94,27 +95,27 @@ void OBJReader::readOBJFile( std::wstring fileName )
inStream.close(); inStream.close();
} }
Oyster::Graphics::Render::ModelInfo OBJReader::toModel() Oyster::Graphics::Render::ModelInfo* OBJReader::toModel()
{ {
Oyster::Graphics::Buffer b; Oyster::Graphics::Buffer* b = new Oyster::Graphics::Buffer();
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc; Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
Oyster::Graphics::Render::ModelInfo modelInfo; Oyster::Graphics::Render::ModelInfo* modelInfo = new Oyster::Graphics::Render::ModelInfo();
desc.ElementSize = sizeof(OBJReader::OBJFormat); desc.ElementSize = 32;
desc.InitData = &this->_myOBJ[0]; desc.InitData = &this->_myOBJ[0];
desc.NumElements = (UINT32)this->_myOBJ.size(); desc.NumElements = this->_myOBJ.size();
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS; desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE_IMMUTABLE; desc.Usage = Oyster::Graphics::Buffer::BUFFER_DEFAULT;
HRESULT hr = S_OK; HRESULT hr = S_OK;
hr = b.Init(desc); hr = b->Init(desc);
if(FAILED(hr)) if(FAILED(hr))
{ {
//Something isn't okay here //Something isn't okay here
} }
modelInfo.Indexed = false; modelInfo->Indexed = false;
modelInfo.VertexCount = (int)desc.NumElements; modelInfo->VertexCount = (int)desc.NumElements;
modelInfo.Vertices = b; modelInfo->Vertices = b;
return modelInfo; return modelInfo;

View File

@ -49,7 +49,7 @@ class OBJReader
~OBJReader(); ~OBJReader();
void readOBJFile( std::wstring fileName); void readOBJFile( std::wstring fileName);
Oyster::Graphics::Render::ModelInfo toModel(); Oyster::Graphics::Render::ModelInfo* toModel();
}; };
#endif #endif

View File

@ -22,7 +22,7 @@ namespace Oyster
struct Model struct Model
{ {
ModelInfo* info; ModelInfo* info;
Oyster::Math::Float4x4 *World; Oyster::Math::Float4x4 World;
bool Visible; bool Visible;
}; };
} }

View File

@ -21,7 +21,7 @@ namespace Oyster
struct ModelInfo struct ModelInfo
{ {
std::vector<ID3D11ShaderResourceView*> Material; std::vector<ID3D11ShaderResourceView*> Material;
Buffer Vertices,Indecies; Buffer *Vertices,*Indecies;
bool Indexed; bool Indexed;
int VertexCount; int VertexCount;
}; };

View File

@ -145,6 +145,7 @@
<ClCompile Include="Core\Core.cpp" /> <ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" /> <ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" /> <ClCompile Include="Core\ShaderManager.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" /> <ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" /> <ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Render\Resources\Resources.cpp" /> <ClCompile Include="Render\Resources\Resources.cpp" />
@ -153,6 +154,7 @@
<ClInclude Include="Core\Buffer.h" /> <ClInclude Include="Core\Buffer.h" />
<ClInclude Include="Core\Core.h" /> <ClInclude Include="Core\Core.h" />
<ClInclude Include="Core\CoreIncludes.h" /> <ClInclude Include="Core\CoreIncludes.h" />
<ClInclude Include="FileLoader\ObjReader.h" />
<ClInclude Include="Model\Model.h" /> <ClInclude Include="Model\Model.h" />
<ClInclude Include="Model\ModelInfo.h" /> <ClInclude Include="Model\ModelInfo.h" />
<ClInclude Include="Render\Preparations\Preparations.h" /> <ClInclude Include="Render\Preparations\Preparations.h" />
@ -174,6 +176,11 @@
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</AssemblerOutput>
<AssemblerOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</AssemblerOutputFile>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
</FxCompile> </FxCompile>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl"> <FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>

View File

@ -36,6 +36,9 @@
<ClCompile Include="Render\Resources\Resources.cpp"> <ClCompile Include="Render\Resources\Resources.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FileLoader\ObjReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Core\Buffer.h"> <ClInclude Include="Core\Buffer.h">
@ -65,6 +68,9 @@
<ClInclude Include="Definitions\GraphicalDefinition.h"> <ClInclude Include="Definitions\GraphicalDefinition.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FileLoader\ObjReader.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" /> <FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />

View File

@ -0,0 +1,88 @@
<?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="Core\ShaderManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Core\Init.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<<<<<<< HEAD
<ClCompile Include="Render\Rendering\BasicRender.cpp">
=======
<ClCompile Include="Resources\Resources.cpp">
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Preparations\BasicPreparations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<<<<<<< HEAD
<ClCompile Include="Render\Resources\Resources.cpp">
=======
<ClCompile Include="Render\Rendering\BasicRender.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileLoader\ObjReader.cpp">
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
<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\Preparations\Preparations.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Render\Rendering\Render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Model\ModelInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Model\Model.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Render\Resources\Resources.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Definitions\GraphicalDefinition.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" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
</ItemGroup>
</Project>

View File

@ -69,9 +69,6 @@
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
@ -82,10 +79,6 @@
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir> <IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName> <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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir> <OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
@ -111,7 +104,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -152,14 +145,32 @@
<ClCompile Include="Core\Core.cpp" /> <ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" /> <ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" /> <ClCompile Include="Core\ShaderManager.cpp" />
<<<<<<< HEAD
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Render\Resources\Resources.cpp" />
=======
<ClCompile Include="FileLoader\ObjReader.cpp" /> <ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Resources\Resources.cpp" />
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Core\Buffer.h" /> <ClInclude Include="Core\Buffer.h" />
<ClInclude Include="Core\Core.h" /> <ClInclude Include="Core\Core.h" />
<ClInclude Include="Core\CoreIncludes.h" /> <ClInclude Include="Core\CoreIncludes.h" />
<<<<<<< HEAD
=======
<ClInclude Include="EngineIncludes.h" /> <ClInclude Include="EngineIncludes.h" />
<ClInclude Include="Render\Preparations.h" /> <ClInclude Include="FileLoader\ObjReader.h" />
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
<ClInclude Include="Model\Model.h" />
<ClInclude Include="Model\ModelInfo.h" />
<ClInclude Include="Render\Preparations\Preparations.h" />
<ClInclude Include="Render\Rendering\Render.h" />
<ClInclude Include="Definitions\GraphicalDefinition.h" />
<ClInclude Include="Render\Resources\Resources.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Misc\Misc.vcxproj"> <ProjectReference Include="..\Misc\Misc.vcxproj">
@ -170,6 +181,12 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.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>
</FxCompile>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl"> <FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType> <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>

View File

@ -1,5 +1,6 @@
#include "Render.h" #include "Render.h"
#include "../Resources/Resources.h" #include "../Resources/Resources.h"
#include "../../Definitions/GraphicalDefinition.h"
namespace Oyster namespace Oyster
{ {
@ -10,12 +11,23 @@ namespace Oyster
namespace Rendering namespace Rendering
{ {
void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4 Projection) void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection)
{ {
Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,0,1)); Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,0,1));
Core::ShaderManager::SetShaderEffect(Graphics::Render::Resources::obj); Core::ShaderManager::SetShaderEffect(Graphics::Render::Resources::obj);
Preparations::Basic::BindBackBufferRTV(); Preparations::Basic::BindBackBufferRTV(nullptr);
Definitions::VP vp;
vp.V = View;
vp.P = Projection;
void* data = Resources::VPData.Map();
memcpy(data, &vp, sizeof(Definitions::VP));
Resources::VPData.Unmap();
Resources::VPData.Apply();
} }
void Basic::RenderScene(Model* models, int count) void Basic::RenderScene(Model* models, int count)
{ {
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
@ -28,10 +40,10 @@ namespace Oyster
//Set Materials :: NONE //Set Materials :: NONE
models[i].info->Vertices.Apply(); models[i].info->Vertices->Apply();
if(models[i].info->Indexed) if(models[i].info->Indexed)
{ {
models[i].info->Indecies.Apply(); models[i].info->Indecies->Apply();
Oyster::Graphics::Core::deviceContext->DrawIndexed(models[i].info->VertexCount,0,0); Oyster::Graphics::Core::deviceContext->DrawIndexed(models[i].info->VertexCount,0,0);
} }
else else

View File

@ -16,7 +16,7 @@ namespace Oyster
{ {
public: public:
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4 Projection); static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
static void RenderScene(Model* models, int count); static void RenderScene(Model* models, int count);
static void EndFrame(); static void EndFrame();
}; };

View File

@ -1,7 +1,7 @@
#include "Resources.h" #include "Resources.h"
#include "..\OysterGraphics\Definitions\GraphicalDefinition.h" #include "..\OysterGraphics\Definitions\GraphicalDefinition.h"
const std::wstring PathFromExeToHlsl = L""; const std::wstring PathFromExeToHlsl = L"..\\OysterGraphics\\Shader\\HLSL\\";
const std::wstring VertexTransformDebug = L"TransformDebugVertex"; const std::wstring VertexTransformDebug = L"TransformDebugVertex";
const std::wstring VertexDebug = L"DebugVertex"; const std::wstring VertexDebug = L"DebugVertex";
const std::wstring PixelRed = L"DebugPixel"; const std::wstring PixelRed = L"DebugPixel";
@ -16,6 +16,10 @@ namespace Oyster
{ {
namespace Render namespace Render
{ {
Shader::ShaderEffect Resources::obj;
Buffer Resources::ModelData = Buffer();
Buffer Resources::VPData = Buffer();
Core::Init::State Resources::Init() Core::Init::State Resources::Init()
{ {
@ -24,11 +28,11 @@ namespace Oyster
#ifdef _DEBUG #ifdef _DEBUG
/** Load Vertex Shader for d3dcompile*/ /** Load Vertex Shader for d3dcompile*/
Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" +L"DebugCameraVertex",ShaderType::Vertex, VertexTransformDebug, false); Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" +L"DebugCameraVertex.hlsl",ShaderType::Vertex, VertexTransformDebug, false);
Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" +L"DebugVertex",ShaderType::Vertex, VertexDebug, false); Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" +L"DebugVertex.hlsl",ShaderType::Vertex, VertexDebug, false);
/** Load Pixel Shader for d3dcompile */ /** Load Pixel Shader for d3dcompile */
Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" + L"DebugPixel", ShaderType::Pixel, PixelRed, false); Core::ShaderManager::Init(PathFromExeToHlsl + L"SimpleDebug\\" + L"DebugPixel.hlsl", ShaderType::Pixel, PixelRed, false);
#else #else
/** Load Vertex Shader with Precompiled */ /** Load Vertex Shader with Precompiled */
@ -53,6 +57,21 @@ namespace Oyster
#pragma region Setup Render States #pragma region Setup Render States
/** @todo Create DX States */ /** @todo Create DX States */
D3D11_RASTERIZER_DESC rdesc;
rdesc.CullMode = D3D11_CULL_NONE;
rdesc.FillMode = D3D11_FILL_SOLID;
rdesc.FrontCounterClockwise = false;
rdesc.DepthBias = 0;
rdesc.DepthBiasClamp = 0;
rdesc.DepthClipEnable = true;
rdesc.SlopeScaledDepthBias = 0;
rdesc.ScissorEnable = false;
rdesc.MultisampleEnable = false;
rdesc.AntialiasedLineEnable = false;
ID3D11RasterizerState* rs = NULL;
Oyster::Graphics::Core::device->CreateRasterizerState(&rdesc,&rs);
#pragma endregion #pragma endregion
#pragma region Setup Views #pragma region Setup Views
@ -68,13 +87,14 @@ namespace Oyster
{ {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }
}; };
Shader::CreateInputLayout(indesc,3,GetShader::Vertex(VertexTransformDebug),obj.IAStage.Layout); Shader::CreateInputLayout(indesc,3,GetShader::Vertex(VertexTransformDebug),obj.IAStage.Layout);
obj.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; obj.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
obj.CBuffers.Vertex.push_back(&VPData); obj.CBuffers.Vertex.push_back(&VPData);
obj.RenderStates.Rasterizer = rs;
#pragma endregion #pragma endregion

View File

@ -18,7 +18,11 @@ struct VertexIn
float4 main( VertexIn input ) : SV_POSITION float4 main( VertexIn input ) : SV_POSITION
{ {
matrix VP = mul(View, Projection); float4 postTransform = float4(input.pos*0.1f,1);
matrix WVP = mul(World, VP); postTransform.y += 1.5f;
return mul(WVP, float4(input.pos,1)); //return postTransform;
return mul(float4(input.pos*0.1f,1), View);
//matrix VP = mul(Projection,View);
//matrix WVP = mul(World, VP);
//return mul(VP, float4(input.pos*0.01f,1));
} }

View File

@ -1,4 +1,4 @@
float4 main() : SV_TARGET float4 main() : SV_TARGET0
{ {
return float4(1.0f, 0.0f, 0.0f, 1.0f); return float4(1.0f, 0.0f, 0.0f, 1.0f);
} }

Binary file not shown.

View File

@ -1,2 +0,0 @@
#v4.0:v110:false
Debug|Win32|C:\Users\Tobias\Documents\GitHub\Danbias\|

View File

@ -1,17 +0,0 @@
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.30

Binary file not shown.

Binary file not shown.

View File

@ -9,13 +9,19 @@
#include <Windows.h> #include <Windows.h>
#include "Core/Core.h" #include "Core/Core.h"
#include "Render\Preparations\Preparations.h" #include "Render\Preparations\Preparations.h"
#include "Render\Resources\Resources.h"
#include "Render\Rendering\Render.h"
#include "FileLoader\ObjReader.h"
#include "Definitions\GraphicalDefinition.h"
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Global Variables // Global Variables
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
HINSTANCE g_hInst = NULL; HINSTANCE g_hInst = NULL;
HWND g_hWnd = NULL; HWND g_hWnd = NULL;
Oyster::Graphics::Render::Model* m = new Oyster::Graphics::Render::Model();
Oyster::Math::Float4x4 V;
Oyster::Math::Float4x4 P;
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@ -139,7 +145,7 @@ HRESULT InitDirect3D()
std::wstring ShaderPath = L"..\\OysterGraphics\\Shader\\HLSL\\"; /*std::wstring ShaderPath = L"..\\OysterGraphics\\Shader\\HLSL\\";
std::wstring EffectPath = L"SimpleDebug\\"; std::wstring EffectPath = L"SimpleDebug\\";
Oyster::Graphics::Core::ShaderManager::Init(ShaderPath + EffectPath + L"DebugPixel.hlsl",Oyster::Graphics::Core::ShaderManager::ShaderType::Pixel,L"Debug",false); Oyster::Graphics::Core::ShaderManager::Init(ShaderPath + EffectPath + L"DebugPixel.hlsl",Oyster::Graphics::Core::ShaderManager::ShaderType::Pixel,L"Debug",false);
@ -160,32 +166,50 @@ HRESULT InitDirect3D()
Oyster::Graphics::Core::deviceContext->IASetInputLayout(layout); Oyster::Graphics::Core::deviceContext->IASetInputLayout(layout);
Oyster::Graphics::Core::deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); Oyster::Graphics::Core::deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV(); Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV();*/
Oyster::Graphics::Render::Resources::Init();
Oyster::Graphics::Render::Preparations::Basic::SetViewPort(); Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
struct float4 /*struct float4
{ {
float x,y,z,w; float x,y,z,w;
}; };*/
float4 mesh[] = //Oyster::Graphics::Definitions::ObjVertex mesh[] =
{ //{
{-1.0f,1.0f,0.0f,1.0f}, // {Oyster::Math::Vector3(-1,1,0),Oyster::Math::Vector2(0,0),Oyster::Math::Vector3(1,1,0)},
{1.0f,1.0f,0.0f,1.0f}, // {Oyster::Math::Vector3(1,-1,0),Oyster::Math::Vector2(0,0),Oyster::Math::Vector3(1,1,0)},
{1.0f,-1.0f,0.0f,1.0f}, // {Oyster::Math::Vector3(1,1,0),Oyster::Math::Vector2(0,0),Oyster::Math::Vector3(1,1,0)},
}; //};
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc; //Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
desc.ElementSize= sizeof(float4); //desc.ElementSize= sizeof(Oyster::Graphics::Definitions::ObjVertex);
desc.NumElements = 3; //desc.NumElements = 3;
desc.InitData=mesh; //desc.InitData=mesh;
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER; //desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE; //desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE;
Oyster::Graphics::Buffer b; //Oyster::Graphics::Buffer *b = new Oyster::Graphics::Buffer();;
b.Init(desc); //b->Init(desc);
b.Apply(0);
////b.Apply(0);
//Oyster::Graphics::Render::ModelInfo* mi = new Oyster::Graphics::Render::ModelInfo();
//mi->Indexed = false;
//mi->VertexCount = 3;
//mi->Vertices = b;
OBJReader or;
or.readOBJFile(L"bth.obj");
m->info = or.toModel();
//m->info = mi;
m->World = Oyster::Math::Matrix::identity;
P = Oyster::Math3D::ProjectionMatrix_Perspective(PI/4,16.0f/9.0f,1,100);
V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,-1.5f,0.0f)).GetInverse();
return S_OK; return S_OK;
} }
@ -197,11 +221,18 @@ HRESULT Update(float deltaTime)
HRESULT Render(float deltaTime) HRESULT Render(float deltaTime)
{ {
Oyster::Graphics::Render::Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,1,1)); Oyster::Graphics::Render::Rendering::Basic::NewFrame(V,P);
//Oyster::Graphics::Render::Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,1,1));
Oyster::Graphics::Core::deviceContext->Draw(3,0); //m->info->Vertices->Apply(0);
Oyster::Graphics::Core::swapChain->Present(0,0); //Oyster::Graphics::Core::deviceContext->Draw(3,0);
//Oyster::Graphics::Core::swapChain->Present(0,0);
Oyster::Graphics::Render::Rendering::Basic::RenderScene(m,1);
Oyster::Graphics::Render::Rendering::Basic::EndFrame();
return S_OK; return S_OK;
} }

33004
Tester/bth.obj Normal file

File diff suppressed because it is too large Load Diff