Pre merge Commit

This commit is contained in:
lanariel 2013-11-26 13:44:58 +01:00
parent c2484a363d
commit 2de2ef9cd0
20 changed files with 204 additions and 109 deletions

View File

@ -4,7 +4,7 @@
#define Core_h
#include "CoreIncludes.h"
#include "Dx11Includes.h"
#include <sstream>
#include "OysterMath.h"

View File

@ -1,4 +1,4 @@
#include "..\OysterGraphics\Core\CoreIncludes.h"
#include "..\OysterGraphics\Core\Dx11Includes.h"
#include "OysterMath.h"
namespace Oyster

View File

@ -0,0 +1,34 @@
#include "GFXAPI.h"
#include "../Core/Core.h"
#include "../Render/Resources/Resources.h"
#include "../Render/Rendering/Render.h"
namespace Oyster
{
namespace Graphics
{
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen)
{
if(Core::Init::FullInit(Window, MSAA_Quality, Fullscreen) == Core::Init::Fail)
{
return API::Fail;
}
if(Render::Resources::Init() == Core::Init::Fail)
{
return API::Fail;
}
return API::Sucsess;
}
void API::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection)
{
Render::Rendering::Basic::NewFrame(View, Projection);
}
void API::RenderScene(Model::Model* models, int count)
{
Render::Rendering::Basic::RenderScene(models,count);
}
}
}

View File

@ -0,0 +1,36 @@
#pragma once
#include <string>
#include "..\Model\Model.h"
#include "OysterMath.h"
#include <Windows.h>
namespace Oyster
{
namespace Graphics
{
class API
{
public:
enum State
{
Sucsess,
Fail
};
struct Option
{
};
State Init(HWND Window, bool MSAA_Quality, bool Fullscreen);
//! @brief from Oyster::Math Float4x4, expects corect methods
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
static void RenderScene(Oyster::Graphics::Model::Model* models, int count);
static void EndFrame();
static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);
static void DeleteModel(Oyster::Graphics::Model::Model* model);
static State SetOptions(Option);
};
}
}

View File

@ -1,29 +0,0 @@
#pragma once
#include <string>
#include "..\Model\Model.h"
#include "OysterMath.h"
class SimpleInterface
{
public:
enum State
{
Sucsess,
Fail
};
struct Option
{
};
State Init(HWND Window, bool MSAA_Quality, bool Fullscreen);
//! @brief from Oyster::Math Float4x4, expects corect methods
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
static void RenderScene(Oyster::Graphics::Model::Model* models, int count);
static void EndFrame();
static Oyster::Graphics::Model::Model* CreateModel(std::wstring filename);
static void DeleteModel(Oyster::Graphics::Model::Model* model);
static State SetOptions(Option);
};

View File

@ -2,6 +2,7 @@
#include "..\Definitions\GraphicalDefinition.h"
#include <sstream>
#include <fstream>
#include "TextureLoader.h"
using namespace std;
OBJReader::OBJReader()
@ -117,6 +118,8 @@ Oyster::Graphics::Model::ModelInfo* OBJReader::toModel()
modelInfo->VertexCount = (int)desc.NumElements;
modelInfo->Vertices = b;
//Oyster::Resource::OysterResource::LoadResource(L"Normal.png",(Oyster::Resource::CustomLoadFunction)Oyster::Graphics::Loading::LoadTexture);
return modelInfo;
}

View File

@ -0,0 +1,7 @@
#include "TextureLoader.h"
#include "..\Core\Dx11Includes.h"
Oyster::Resource::CustomData* Oyster::Graphics::Loading::LoadTexture()
{
return NULL;
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "..\..\Misc\Resource\OysterResource.h"
namespace Oyster
{
namespace Graphics
{
namespace Loading
{
void UnloadTexture();
Oyster::Resource::CustomData* LoadTexture();
}
}
}

View File

@ -145,17 +145,19 @@
<ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" />
<ClCompile Include="DllInterfaces\GFXAPI.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="FileLoader\TextureLoader.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="DllInterfaces\SimpleInterface.h" />
<ClInclude Include="Core\Dx11Includes.h" />
<ClInclude Include="DllInterfaces\GFXAPI.h" />
<ClInclude Include="FileLoader\ObjReader.h" />
<ClInclude Include="FileLoader\TextureLoader.h" />
<ClInclude Include="Model\Model.h" />
<ClInclude Include="Model\ModelInfo.h" />
<ClInclude Include="Render\Preparations\Preparations.h" />
@ -172,6 +174,20 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\PixelGatherData.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>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
</FxCompile>
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\VertexGatherData.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>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
</FxCompile>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@ -204,6 +220,9 @@
</AssemblerOutput>
</FxCompile>
</ItemGroup>
<ItemGroup>
<None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -39,17 +39,17 @@
<ClCompile Include="FileLoader\ObjReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileLoader\TextureLoader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DllInterfaces\GFXAPI.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\Preparations\Preparations.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -71,7 +71,13 @@
<ClInclude Include="FileLoader\ObjReader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DllInterfaces\SimpleInterface.h">
<ClInclude Include="FileLoader\TextureLoader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Core\Dx11Includes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DllInterfaces\GFXAPI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
@ -79,5 +85,10 @@
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\PixelGatherData.hlsl" />
<FxCompile Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\VertexGatherData.hlsl" />
</ItemGroup>
<ItemGroup>
<None Include="Shader\HLSL\Deffered Shaders\GatherGBuffer\GBufferHeader.hlsli" />
</ItemGroup>
</Project>

View File

@ -36,7 +36,7 @@ namespace Oyster
if(models[i].Visible)
{
void* data = Resources::ModelData.Map();
memcpy(data,&(models[i].WorldMatrix),64);
memcpy(data,&(models[i].WorldMatrix),sizeof(Math::Float4x4));
Resources::ModelData.Unmap();
//Set Materials :: NONE

View File

@ -99,6 +99,7 @@ namespace Oyster
obj.CBuffers.Vertex.push_back(&VPData);
obj.RenderStates.Rasterizer = rs;
ModelData.Apply(1);
#pragma endregion
return Core::Init::Sucsess;
}

View File

@ -1,25 +0,0 @@
struct VertexOut
{
float4 pos : SV_POSITION;
float4 ViewPos: POSITION;
float2 UV : TEXCOORD;
float4 normal : NORMAL;
};
struct PixelOut
{
float4 Diffuse3Glow1 : SV_TARGET0;
float4 Normal3Specular1 : SV_TARGET1;
float4 VPos : SV_TARGET2;
};
Texture2D Diffuse;
Texture2D Specular;
PixelOut main(VertexOut input)
{
PixelOut output;
output.Diffuse3Glow1 = float4(1.0f, 0.0f, 0.0f, 1.0f);
output.Normal3Specular1 = float4(input.normal, 1.0f);
return output;
}

View File

@ -1,37 +0,0 @@
cbuffer PerFrame : register(b0)
{
matrix View;
float4x4 Projection;
matrix VP;
}
cbuffer PerModel : register(b1)
{
matrix World;
}
struct VertexIn
{
float3 pos : POSITION;
float2 UV : TEXCOORD;
float3 normal : NORMAL;
};
struct VertexOut
{
float4 pos : SV_POSITION;
float4 ViewPos: POSITION;
float2 UV : TEXCOORD;
float4 normal : NORMAL;
};
VertexOut main( VertexIn input )
{
VertexOut output;
matrix WV = mul(View, World);
output.ViewPos = mul(WV, float4(input.pos,1));
output.pos = mul(Projection, output.ViewPos);
output.UV = input.UV;
output.normal = float4(input.normal, 0);
return output;
}

View File

@ -0,0 +1,41 @@
struct VertexIn
{
float3 pos : POSITION;
float2 UV : TEXCOORD;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 biTangent : BITANGENT;
float4 boneIndex : BONEINDEX;
float4 boneWeight : BONEWEIGHT;
};
struct VertexOut
{
float4 pos : SV_POSITION;
float4 ViewPos : POSITION;
float2 UV : TEXCOORD;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 biTangent : BITANGENT;
};
struct PixelOut
{
float4 DiffuseGlow : SV_TARGET0;
float4 NormalSpec : SV_TARGET1;
};
Texture2D Diffuse : register(t0);
Texture2D Specular : register(t1);
cbuffer PerFrame : register(b0)
{
matrix View;
float4x4 Projection;
matrix VP;
}
cbuffer PerModel : register(b1)
{
matrix World;
}

View File

@ -0,0 +1,9 @@
#include "GBufferHeader.hlsli"
PixelOut main(VertexOut input)
{
PixelOut output;
output.DiffuseGlow = float4(1.0f, 0.0f, 0.0f, 1.0f);
output.NormalSpec = float4(input.normal, 1.0f);
return output;
}

View File

@ -0,0 +1,12 @@
#include "GBufferHeader.hlsli"
VertexOut main( VertexIn input )
{
VertexOut output;
matrix WV = mul(View, World);
output.ViewPos = mul(WV, float4(input.pos,1));
output.pos = mul(Projection, output.ViewPos);
output.UV = input.UV;
output.normal = float4(input.normal, 0);
return output;
}

View File

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

View File

@ -177,12 +177,12 @@ HRESULT InitDirect3D()
#pragma region Obj
OBJReader or;
or.readOBJFile(L"bth.obj");
or.readOBJFile(L"crate.obj");
m->info = (void*)or.toModel();
m->Visible=true;
#pragma endregion
//*((Oyster::Math::Matrix)m->data) = Oyster::Math::Matrix::identity;
m->WorldMatrix = Oyster::Math::Matrix::identity;
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,16.0f/9.0f,.1f,100);