Merge remote-tracking branch 'origin/Graphics' into Physics

This commit is contained in:
Dander7BD 2013-12-04 09:58:11 +01:00
commit 87e9d137ea
21 changed files with 285 additions and 27 deletions

6
.gitignore vendored
View File

@ -21,11 +21,13 @@
*.lib
*.exe
*.tlog
*.vcxproj
*.filters
*.ilk
*.exp
*.dll
Bin/Content/
Bin/Content/Sound/
Bin/Executable/
Obj/
External/

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.

233
Bin/Content/crate.obj Normal file
View File

@ -0,0 +1,233 @@
# This file uses centimeters as units for non-parametric coordinates.
mtllib crate.mtl
g default
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v 0.500000 0.500000 -0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 -0.500000
v -0.479379 0.522314 0.479379
v 0.479379 0.522314 0.479379
v 0.479379 0.522314 -0.479379
v -0.479379 0.522314 -0.479379
v -0.470939 -0.528599 -0.470939
v 0.470939 -0.528599 -0.470939
v 0.470939 -0.528599 0.470939
v -0.470939 -0.528599 0.470939
v 0.520103 -0.460610 -0.460610
v 0.520103 -0.460610 0.460610
v 0.520103 0.460610 -0.460610
v 0.520103 0.460610 0.460610
v -0.522559 -0.464751 -0.464751
v -0.522559 -0.464751 0.464751
v -0.522559 0.464751 0.464751
v -0.522559 0.464751 -0.464751
v -0.460954 -0.460954 0.522335
v 0.460954 -0.460954 0.522335
v 0.460954 0.460954 0.522335
v -0.460954 0.460954 0.522335
v -0.466507 0.466507 -0.525017
v 0.466507 0.466507 -0.525017
v 0.466507 -0.466507 -0.525017
v -0.466507 -0.466507 -0.525017
vt 0.995838 0.004695
vt 0.999640 -0.003712
vt 0.003809 -0.000160
vt -0.000796 1.000526
vt 0.003809 0.003892
vt 0.999640 0.995671
vt 0.003809 0.007944
vt 0.999640 0.999723
vt 0.003809 1.003774
vt 0.999640 1.003774
vt 0.995035 0.004695
vt 0.995035 1.000526
vt 0.000007 0.004695
vt 0.000007 1.000526
vt 0.999640 0.007944
vt -0.000796 0.004695
vt 0.003809 0.999723
vt 0.003809 -0.003712
vt 0.999640 0.003892
vt 0.003809 0.995671
vt 0.999640 0.992119
vt 0.999640 -0.000160
vt 0.003809 0.992119
vt 0.995838 1.000526
vt 0.003809 -0.003712
vt 0.999640 -0.003712
vt 0.999640 0.992119
vt 0.003809 0.992119
vt 0.003809 -0.000160
vt 0.999640 -0.000160
vt 0.999640 0.995671
vt 0.003809 0.995671
vt 0.003809 0.003892
vt 0.999640 0.003892
vt 0.999640 0.999723
vt 0.003809 0.999723
vt 0.003809 0.007944
vt 0.999640 0.007944
vt 0.999640 1.003774
vt 0.003809 1.003774
vt -0.000796 0.004695
vt 0.995035 0.004695
vt 0.995035 1.000526
vt -0.000796 1.000526
vt 0.000007 0.004695
vt 0.995838 0.004695
vt 0.995838 1.000526
vt 0.000007 1.000526
vt 0.003809 -0.000160
vt 0.999640 -0.000160
vt 0.999640 0.995671
vt 0.003809 0.995671
vt 0.003809 0.007944
vt 0.999640 0.007944
vt 0.999640 1.003774
vt 0.003809 1.003774
vt -0.000796 0.004695
vt 0.995035 0.004695
vt 0.995035 1.000526
vt -0.000796 1.000526
vt 0.000007 0.004695
vt 0.995838 0.004695
vt 0.995838 1.000526
vt 0.000007 1.000526
vt 0.003809 -0.003712
vt 0.999640 -0.003712
vt 0.999640 0.992119
vt 0.003809 0.992119
vt 0.003809 0.003892
vt 0.999640 0.003892
vt 0.999640 0.999723
vt 0.003809 0.999723
vn -0.031209 -0.033799 0.998941
vn 0.033799 -0.031209 0.998941
vn -0.033799 0.031209 0.998941
vn 0.031209 0.033799 0.998941
vn -0.030245 0.999045 0.031527
vn 0.031527 0.999045 0.030245
vn -0.031527 0.999045 -0.030245
vn 0.030245 0.999045 -0.031527
vn -0.034614 0.037052 -0.998714
vn 0.037051 0.034614 -0.998714
vn -0.037051 -0.034614 -0.998714
vn 0.034614 -0.037052 -0.998714
vn -0.038824 -0.998397 -0.041174
vn 0.041174 -0.998397 -0.038824
vn -0.041174 -0.998397 0.038824
vn 0.038824 -0.998397 0.041174
vn 0.999134 -0.030589 0.028224
vn 0.999134 -0.028224 -0.030589
vn 0.999134 0.028224 0.030589
vn 0.999134 0.030589 -0.028224
vn -0.998933 -0.033811 -0.031470
vn -0.998933 -0.031470 0.033811
vn -0.998933 0.031470 -0.033811
vn -0.998933 0.033811 0.031470
vn 0.577350 0.577350 -0.577350
vn 0.577350 -0.577350 -0.577350
vn -0.577350 0.577350 -0.577350
vn -0.577350 -0.577350 -0.577350
vn 0.577350 -0.577350 0.577350
vn -0.577350 -0.577350 0.577350
vn 0.577350 0.577350 0.577350
vn -0.577350 0.577350 0.577350
vn -0.608285 0.469952 0.639637
vn 0.633500 0.454555 0.626145
vn 0.657522 0.474071 -0.585595
vn -0.626276 0.491669 -0.605013
vn -0.608373 -0.534484 -0.586694
vn 0.635292 -0.520408 -0.570596
vn 0.616200 -0.500955 0.607735
vn -0.589957 -0.516183 0.620891
s 1
g meshCrate
usemtl matCrateSG
f 33/65/1 34/66/2 36/68/3
f 36/68/3 34/66/2 35/67/4
f 17/49/5 18/50/6 20/52/7
f 20/52/7 18/50/6 19/51/8
f 37/69/9 38/70/10 40/72/11
f 40/72/11 38/70/10 39/71/12
f 21/53/13 22/54/14 24/56/15
f 24/56/15 22/54/14 23/55/16
f 26/57/17 25/58/18 28/60/19
f 28/60/19 25/58/18 27/59/20
f 29/61/21 30/62/22 32/64/23
f 32/64/23 30/62/22 31/63/24
s 7
f 1/25/25 3/28/26 2/26/27
f 2/26/27 3/28/26 4/27/28
f 3/29/26 5/32/29 4/30/28
f 4/30/28 5/32/29 6/31/30
f 5/33/29 7/36/31 6/34/30
f 6/34/30 7/36/31 8/35/32
f 7/37/31 1/40/25 8/38/32
f 8/38/32 1/40/25 2/39/27
f 2/41/27 4/44/28 8/42/32
f 8/42/32 4/44/28 6/43/30
f 7/45/31 5/48/29 1/46/25
f 1/46/25 5/48/29 3/47/26
s 1
f 12/3/33 11/22/34 17/49/5
f 17/49/5 11/22/34 18/50/6
f 11/22/34 13/6/35 18/50/6
f 18/50/6 13/6/35 19/51/8
f 13/6/35 14/20/36 19/51/8
f 19/51/8 14/20/36 20/52/7
f 14/20/36 12/3/33 20/52/7
f 20/52/7 12/3/33 17/49/5
f 16/7/37 15/15/38 21/53/13
f 21/53/13 15/15/38 22/54/14
f 15/15/38 10/10/39 22/54/14
f 22/54/14 10/10/39 23/55/16
f 10/10/39 9/9/40 23/55/16
f 23/55/16 9/9/40 24/56/15
f 9/9/40 16/7/37 24/56/15
f 24/56/15 16/7/37 21/53/13
f 10/16/39 15/11/38 26/57/17
f 26/57/17 15/11/38 25/58/18
f 15/11/38 13/12/35 25/58/18
f 25/58/18 13/12/35 27/59/20
f 13/12/35 11/4/34 27/59/20
f 27/59/20 11/4/34 28/60/19
f 11/4/34 10/16/39 28/60/19
f 28/60/19 10/16/39 26/57/17
f 16/13/37 9/1/40 29/61/21
f 29/61/21 9/1/40 30/62/22
f 9/1/40 12/24/33 30/62/22
f 30/62/22 12/24/33 31/63/24
f 12/24/33 14/14/36 31/63/24
f 31/63/24 14/14/36 32/64/23
f 14/14/36 16/13/37 32/64/23
f 32/64/23 16/13/37 29/61/21
f 9/18/40 10/2/39 33/65/1
f 33/65/1 10/2/39 34/66/2
f 10/2/39 11/21/34 34/66/2
f 34/66/2 11/21/34 35/67/4
f 11/21/34 12/23/33 35/67/4
f 35/67/4 12/23/33 36/68/3
f 12/23/33 9/18/40 36/68/3
f 36/68/3 9/18/40 33/65/1
f 14/5/36 13/19/35 37/69/9
f 37/69/9 13/19/35 38/70/10
f 13/19/35 15/8/38 38/70/10
f 38/70/10 15/8/38 39/71/12
f 15/8/38 16/17/37 39/71/12
f 39/71/12 16/17/37 40/72/11
f 16/17/37 14/5/36 40/72/11
f 40/72/11 14/5/36 37/69/9

BIN
Bin/Content/tex_crate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -17,7 +17,7 @@ std::wstring GetErrorMessage(int errorCode)
LPWSTR lpMessage;
std::wstring retVal(L"Succesful");
DWORD bufLen = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS ,
DWORD bufLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS ,
NULL,
errorCode ,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) ,

View File

@ -33,6 +33,7 @@ namespace Oyster
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
D3D_FEATURE_LEVEL featureLevelsToTry[] =
{

View File

@ -63,7 +63,12 @@ namespace Oyster
{
Model::ModelInfo* info = (Model::ModelInfo*)model->info;
delete model;
info->Vertices->~Buffer();
SAFE_DELETE(info->Vertices);
if(info->Indexed)
{
SAFE_DELETE(info->Indecies);
}
delete info;
}
void API::Clean()

View File

@ -4,13 +4,12 @@
#include "OysterMath.h"
#include <Windows.h>
#if defined GFX_DLL_EXPORT
#ifdef GFX_DLL_EXPORT
#define GFX_DLL_USAGE __declspec(dllexport)
#else
#define GFX_DLL_USAGE __declspec(dllimport)
#define GFX_DLL_USAGE
#endif
namespace Oyster
{
namespace Graphics

View File

@ -95,7 +95,7 @@ void OBJReader::readOBJFile( std::wstring fileName )
inStream.close();
Mat = Oyster::Resource::OysterResource::LoadResource((fileName + L".jpg").c_str(),Oyster::Graphics::Loading::LoadTexture);
Mat = Oyster::Resource::OysterResource::LoadResource((fileName + L".png").c_str(),Oyster::Graphics::Loading::LoadTexture);
}
Oyster::Graphics::Model::ModelInfo* OBJReader::toModel()

View File

@ -165,14 +165,16 @@ namespace Oyster
data.data = new char[data.size];
memcpy(data.data,Shader->GetBufferPointer(),data.size);
#else
std::ifstream stream;
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];
data.size = size_t(stream.tellg());
data.data = new char[data.size];
stream.seekg(0, std::ios::beg);
stream.read(&sd.data[0], sd.size);
stream.read(&data.data[0], data.size);
stream.close();
}
else
@ -180,7 +182,6 @@ namespace Oyster
memset(&out,0,sizeof(out));
return;
}
#endif
out.loadedData = Core::ShaderManager::CreateShader(data, Core::ShaderManager::ShaderType(type));
}

View File

@ -109,6 +109,7 @@
</ProjectReference>
<FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<ShaderModel>5.0</ShaderModel>
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -124,12 +125,13 @@
</Link>
<FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<ShaderModel>5.0</ShaderModel>
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
@ -143,12 +145,14 @@
</Link>
<FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<EnableDebuggingInformation>true</EnableDebuggingInformation>
<ShaderModel>5.0</ShaderModel>
</FxCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
@ -162,6 +166,8 @@
</Link>
<FxCompile>
<ObjectFileOutput>$(SolutionDir)..\Bin\Content\Shaders\%(Filename).cso</ObjectFileOutput>
<EnableDebuggingInformation>true</EnableDebuggingInformation>
<ShaderModel>5.0</ShaderModel>
</FxCompile>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -60,7 +60,8 @@ namespace Oyster
}
void Basic::EndFrame()
{
Core::swapChain->Present(0,0);
IDXGISwapChain* chain = Core::swapChain;
chain->Present(0,0);
}
}
}

View File

@ -3,7 +3,8 @@
// /Bin/Executable/Tester ->
// /Code/OysterGraphics/Shader/HLSL
const std::wstring PathFromExeToHlsl = L"..\\..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\";
const std::wstring PathFromExeToCso = L"..\\Content\\Shaders\\";
const std::wstring PathFromExeToHlsl = L"..\\..\\Code\\OysterGraphics\\Shader\\HLSL\\";
const std::wstring VertexTransformDebug = L"TransformDebugVertex";
const std::wstring VertexDebug = L"DebugVertex";
const std::wstring PixelRed = L"DebugPixel";
@ -42,6 +43,12 @@ namespace Oyster
#else
/** Load Vertex Shader with Precompiled */
Core::ShaderManager::Init(PathFromExeToCso + L"DebugCameraVertex.cso",ShaderType::Vertex, VertexTransformDebug);
Core::ShaderManager::Init(PathFromExeToCso + L"DebugVertex.cso",ShaderType::Vertex, VertexDebug);
/** Load Pixel Shader with Precompiled */
Core::ShaderManager::Init(PathFromExeToCso + L"DebugPixel.cso",ShaderType::Pixel, PixelRed);
Core::ShaderManager::Init(PathFromExeToCso + L"TextureDebug.cso",ShaderType::Pixel, PixelTexture);
#endif
#pragma endregion

View File

@ -18,6 +18,7 @@
HINSTANCE g_hInst = NULL;
HWND g_hWnd = NULL;
Oyster::Graphics::Model::Model* m = NULL;
Oyster::Graphics::Model::Model* m2 = NULL;
Oyster::Math::Float4x4 V;
Oyster::Math::Float4x4 P;
@ -41,7 +42,7 @@ HRESULT InitDirect3D();
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
BOOL b = SetDllDirectoryW(L"..\\..\\DLL");
BOOL b = SetDllDirectoryW(L"..\\DLL");
typedef struct tagLOADPARMS32
{
LPSTR lpEnvAddress; // address of environment strings
@ -186,7 +187,9 @@ HRESULT InitDirect3D()
#pragma endregion
#pragma region Obj
m = Oyster::Graphics::API::CreateModel(L"orca");
m = Oyster::Graphics::API::CreateModel(L"crate");
m2 = Oyster::Graphics::API::CreateModel(L"crate");
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(0,5,0),Oyster::Math::Float3::null);
#pragma endregion
@ -203,6 +206,7 @@ HRESULT Update(float deltaTime)
{
angle += Oyster::Math::pi/30000;
m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle);
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,0,1)*-angle,Oyster::Math::Float3(0,4,0),Oyster::Math::Float3::null);
return S_OK;
}
@ -211,6 +215,7 @@ HRESULT Render(float deltaTime)
Oyster::Graphics::API::NewFrame(V,P);
Oyster::Graphics::API::RenderScene(m,1);
Oyster::Graphics::API::RenderScene(m2,1);
Oyster::Graphics::API::EndFrame();

View File

@ -85,7 +85,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)..\Bin\Executable\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
<IncludePath>C:\Program Files (x86)\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
@ -113,7 +113,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_x86D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ProjectReference>
<LinkLibraryDependencies>
@ -136,7 +136,6 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -144,9 +143,9 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterGraphics;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -159,7 +158,7 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>OysterGraphics_x86.dll;</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -167,7 +166,7 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -182,7 +181,6 @@
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
<DelayLoadDLLs>OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
</ItemDefinitionGroup>
<ItemGroup>