Stable Graphics, hard coded texture read in ObjReader.ToModel
This commit is contained in:
parent
8f6ca79e6b
commit
9bf84cdc65
|
@ -12,16 +12,16 @@ using namespace Oyster::Resource;
|
||||||
|
|
||||||
OResource* OResource::CustomLoader(const wchar_t filename[], CustomLoadFunction fnc)
|
OResource* OResource::CustomLoader(const wchar_t filename[], CustomLoadFunction fnc)
|
||||||
{
|
{
|
||||||
const CustomData &data = fnc(filename);
|
CustomData &data = fnc(filename);
|
||||||
|
|
||||||
if(!data.loadedData) return 0;
|
if(!data.loadedData) return 0;
|
||||||
if(!data.resourceUnloadFnc) return 0;
|
if(!data.resourceUnloadFnc) return 0;
|
||||||
|
OHRESOURCE n = (OHRESOURCE)data.loadedData;
|
||||||
OResource *resource = new OResource((OHRESOURCE)data.loadedData, ResourceType_UNKNOWN, 0, 0, filename);
|
OResource *resource = new OResource(n, ResourceType_UNKNOWN, 0, 0, filename);
|
||||||
|
|
||||||
resource->customData = new CustomResourceData();
|
resource->customData = new CustomResourceData();
|
||||||
resource->customData->unloadingFunction = data.resourceUnloadFnc;
|
resource->customData->unloadingFunction = data.resourceUnloadFnc;
|
||||||
resource->resourceData = (OHRESOURCE)data.loadedData;
|
//resource->resourceData = (OHRESOURCE)data.loadedData;
|
||||||
resource->customData->loadingFunction = fnc;
|
resource->customData->loadingFunction = fnc;
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Oyster
|
||||||
/** Typedef on a fuction required for custom unloading */
|
/** Typedef on a fuction required for custom unloading */
|
||||||
typedef void(*CustomUnloadFunction)(void* loadedData);
|
typedef void(*CustomUnloadFunction)(void* loadedData);
|
||||||
/** Typedef on a fuction required for custom loading */
|
/** Typedef on a fuction required for custom loading */
|
||||||
typedef const CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
|
typedef CustomData&(*CustomLoadFunction)(const wchar_t filename[]);
|
||||||
|
|
||||||
/** An enum class representing all avalible resources that is supported. */
|
/** An enum class representing all avalible resources that is supported. */
|
||||||
enum ResourceType
|
enum ResourceType
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace Oyster
|
||||||
D3D11_TEXTURE2D_DESC desc;
|
D3D11_TEXTURE2D_DESC desc;
|
||||||
desc.MipLevels=1;
|
desc.MipLevels=1;
|
||||||
desc.ArraySize=1;
|
desc.ArraySize=1;
|
||||||
desc.Format = DXGI_FORMAT_D32_FLOAT;
|
desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||||
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||||
desc.CPUAccessFlags=0;
|
desc.CPUAccessFlags=0;
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace Oyster
|
||||||
|
|
||||||
ID3D11PixelShader* pixel;
|
ID3D11PixelShader* pixel;
|
||||||
|
|
||||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"ps_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
|
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,D3D_COMPILE_STANDARD_FILE_INCLUDE,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();
|
||||||
|
@ -171,7 +171,7 @@ namespace Oyster
|
||||||
|
|
||||||
ID3D11GeometryShader* geometry;
|
ID3D11GeometryShader* geometry;
|
||||||
|
|
||||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"gs_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
|
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,D3D_COMPILE_STANDARD_FILE_INCLUDE,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();
|
||||||
|
@ -198,7 +198,7 @@ namespace Oyster
|
||||||
|
|
||||||
ID3D11VertexShader* vertex;
|
ID3D11VertexShader* vertex;
|
||||||
|
|
||||||
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,NULL,ShaderFunction,"vs_5_0",D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION,0,&Shader,&Error)))
|
if(FAILED(D3DCompileFromFile(filename.c_str(),NULL,D3D_COMPILE_STANDARD_FILE_INCLUDE,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();
|
||||||
|
@ -344,6 +344,7 @@ namespace Oyster
|
||||||
se.CBuffers.Pixel[i]->Apply(i);
|
se.CBuffers.Pixel[i]->Apply(i);
|
||||||
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
|
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
|
||||||
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
|
||||||
|
Core::deviceContext->OMSetDepthStencilState(se.RenderStates.DepthStencil,0);
|
||||||
float test[4] = {0};
|
float test[4] = {0};
|
||||||
Core::deviceContext->OMSetBlendState(se.RenderStates.BlendState,test,-1);
|
Core::deviceContext->OMSetBlendState(se.RenderStates.BlendState,test,-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include "..\..\Misc\Resource\OysterResource.h"
|
||||||
|
namespace Oyster
|
||||||
|
{
|
||||||
|
namespace Graphics
|
||||||
|
{
|
||||||
|
namespace Loading
|
||||||
|
{
|
||||||
|
void UnloadTexture(void* loadedData);
|
||||||
|
Oyster::Resource::CustomData& LoadTexture(const wchar_t filename[]);
|
||||||
|
|
||||||
|
void UnloadShader(void* loadedData);
|
||||||
|
Oyster::Resource::CustomData& LoadShader(const wchar_t filename[]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -119,9 +119,10 @@ Oyster::Graphics::Model::ModelInfo* OBJReader::toModel()
|
||||||
modelInfo->Vertices = b;
|
modelInfo->Vertices = b;
|
||||||
|
|
||||||
|
|
||||||
Oyster::Resource::OHRESOURCE diffuse = Oyster::Resource::OysterResource::LoadResource(L"bth.png",Oyster::Graphics::Loading::LoadTexture);
|
Oyster::Resource::OHRESOURCE diffuse = Oyster::Resource::OysterResource::LoadResource(L"orca_tex.jpg",Oyster::Graphics::Loading::LoadTexture);
|
||||||
//Oyster::Resource::OysterResource::LoadResource(L"Normal.png",(Oyster::Resource::CustomLoadFunction)Oyster::Graphics::Loading::LoadTexture);
|
//Oyster::Resource::OysterResource::LoadResource(L"Normal.png",(Oyster::Resource::CustomLoadFunction)Oyster::Graphics::Loading::LoadTexture);
|
||||||
modelInfo->Material.push_back((ID3D11ShaderResourceView*)diffuse);
|
void* v = (void*)diffuse;
|
||||||
|
modelInfo->Material.push_back((ID3D11ShaderResourceView*)v);
|
||||||
|
|
||||||
return modelInfo;
|
return modelInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ HRESULT CreateWICTextureFromFileEx( ID3D11Device* d3dDevice,
|
||||||
ID3D11Resource** texture,
|
ID3D11Resource** texture,
|
||||||
ID3D11ShaderResourceView** textureView );
|
ID3D11ShaderResourceView** textureView );
|
||||||
|
|
||||||
const Oyster::Resource::CustomData& Oyster::Graphics::Loading::LoadTexture(const wchar_t filename[])
|
Oyster::Resource::CustomData& Oyster::Graphics::Loading::LoadTexture(const wchar_t filename[])
|
||||||
{
|
{
|
||||||
ID3D11ShaderResourceView* srv;
|
ID3D11ShaderResourceView* srv = NULL;
|
||||||
Oyster::Resource::CustomData Ret;
|
Oyster::Resource::CustomData Ret;
|
||||||
HRESULT hr = CreateWICTextureFromFileEx(Core::device,Core::deviceContext,filename,0,D3D11_USAGE_DEFAULT,D3D11_BIND_SHADER_RESOURCE,0,0,false,NULL,&srv);
|
HRESULT hr = CreateWICTextureFromFileEx(Core::device,Core::deviceContext,filename,0,D3D11_USAGE_DEFAULT,D3D11_BIND_SHADER_RESOURCE,0,0,false,NULL,&srv);
|
||||||
if(hr!=S_OK)
|
if(hr!=S_OK)
|
||||||
|
@ -25,7 +25,7 @@ const Oyster::Resource::CustomData& Oyster::Graphics::Loading::LoadTexture(const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ret.loadedData = srv;
|
Ret.loadedData = (void*)srv;
|
||||||
Ret.resourceUnloadFnc = Loading::UnloadTexture;
|
Ret.resourceUnloadFnc = Loading::UnloadTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include "..\..\Misc\Resource\OysterResource.h"
|
|
||||||
namespace Oyster
|
|
||||||
{
|
|
||||||
namespace Graphics
|
|
||||||
{
|
|
||||||
namespace Loading
|
|
||||||
{
|
|
||||||
void UnloadTexture(void* loadedData);
|
|
||||||
const Oyster::Resource::CustomData& LoadTexture(const wchar_t filename[]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,9 +14,9 @@ namespace Oyster
|
||||||
|
|
||||||
void Basic::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 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(1,0,0,1));
|
||||||
Core::ShaderManager::SetShaderEffect(Graphics::Render::Resources::obj);
|
Core::ShaderManager::SetShaderEffect(Graphics::Render::Resources::obj);
|
||||||
Preparations::Basic::BindBackBufferRTV(nullptr);
|
Preparations::Basic::BindBackBufferRTV();
|
||||||
|
|
||||||
Definitions::VP vp;
|
Definitions::VP vp;
|
||||||
vp.V = View;
|
vp.V = View;
|
||||||
|
@ -39,10 +39,11 @@ namespace Oyster
|
||||||
memcpy(data,&(models[i].WorldMatrix),sizeof(Math::Float4x4));
|
memcpy(data,&(models[i].WorldMatrix),sizeof(Math::Float4x4));
|
||||||
Resources::ModelData.Unmap();
|
Resources::ModelData.Unmap();
|
||||||
|
|
||||||
//Set Materials :: NONE
|
|
||||||
|
|
||||||
Model
|
Model::ModelInfo* info = (Model::ModelInfo*)models[i].info;
|
||||||
::ModelInfo* info = (Model::ModelInfo*)models[i].info;
|
|
||||||
|
Core::deviceContext->PSSetShaderResources(0,info->Material.size(),&(info->Material[0]));
|
||||||
|
|
||||||
|
|
||||||
info->Vertices->Apply();
|
info->Vertices->Apply();
|
||||||
if(info->Indexed)
|
if(info->Indexed)
|
||||||
|
|
|
@ -65,9 +65,9 @@ namespace Oyster
|
||||||
/** @todo Create DX States */
|
/** @todo Create DX States */
|
||||||
|
|
||||||
D3D11_RASTERIZER_DESC rdesc;
|
D3D11_RASTERIZER_DESC rdesc;
|
||||||
rdesc.CullMode = D3D11_CULL_NONE;
|
rdesc.CullMode = D3D11_CULL_BACK;
|
||||||
rdesc.FillMode = D3D11_FILL_SOLID;
|
rdesc.FillMode = D3D11_FILL_SOLID;
|
||||||
rdesc.FrontCounterClockwise = false;
|
rdesc.FrontCounterClockwise = true;
|
||||||
rdesc.DepthBias = 0;
|
rdesc.DepthBias = 0;
|
||||||
rdesc.DepthBiasClamp = 0;
|
rdesc.DepthBiasClamp = 0;
|
||||||
rdesc.DepthClipEnable = true;
|
rdesc.DepthClipEnable = true;
|
||||||
|
@ -82,19 +82,41 @@ namespace Oyster
|
||||||
D3D11_SAMPLER_DESC sdesc;
|
D3D11_SAMPLER_DESC sdesc;
|
||||||
sdesc.Filter = D3D11_FILTER_ANISOTROPIC;
|
sdesc.Filter = D3D11_FILTER_ANISOTROPIC;
|
||||||
/// @todo parata med fredrik om wraping
|
/// @todo parata med fredrik om wraping
|
||||||
sdesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR_ONCE;
|
sdesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
sdesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
sdesc.AddressW = D3D11_TEXTURE_ADDRESS_BORDER;
|
sdesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
sdesc.MipLODBias = 0;
|
sdesc.MipLODBias = 0;
|
||||||
sdesc.MaxAnisotropy =4;
|
sdesc.MaxAnisotropy =4;
|
||||||
sdesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
|
sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
|
||||||
*sdesc.BorderColor = *Oyster::Math::Float4(0,0,0,1).element;
|
*sdesc.BorderColor = *Oyster::Math::Float4(1,1,1,1).element;
|
||||||
sdesc.MinLOD = 0;
|
sdesc.MinLOD = 0;
|
||||||
sdesc.MaxLOD = D3D11_FLOAT32_MAX;
|
sdesc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||||
|
|
||||||
ID3D11SamplerState** ss = new ID3D11SamplerState*[1];
|
ID3D11SamplerState** ss = new ID3D11SamplerState*[1];
|
||||||
Oyster::Graphics::Core::device->CreateSamplerState(&sdesc,ss);
|
Oyster::Graphics::Core::device->CreateSamplerState(&sdesc,ss);
|
||||||
|
|
||||||
|
D3D11_DEPTH_STENCIL_DESC ddesc;
|
||||||
|
ddesc.DepthEnable = true;
|
||||||
|
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||||
|
ddesc.DepthFunc = D3D11_COMPARISON_LESS;
|
||||||
|
|
||||||
|
ddesc.StencilEnable = true;
|
||||||
|
ddesc.StencilReadMask = 0xFF;
|
||||||
|
ddesc.StencilWriteMask = 0xFF;
|
||||||
|
|
||||||
|
ddesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
||||||
|
ddesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
|
||||||
|
ddesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
||||||
|
ddesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||||
|
|
||||||
|
ddesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
||||||
|
ddesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
|
||||||
|
ddesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
||||||
|
ddesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||||
|
|
||||||
|
ID3D11DepthStencilState* dsState;
|
||||||
|
Core::device->CreateDepthStencilState(&ddesc,&dsState);
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region Setup Views
|
#pragma region Setup Views
|
||||||
|
@ -103,8 +125,8 @@ namespace Oyster
|
||||||
|
|
||||||
#pragma region Create Shader Effects
|
#pragma region Create Shader Effects
|
||||||
/** @todo Create ShaderEffects */
|
/** @todo Create ShaderEffects */
|
||||||
obj.Shaders.Pixel = GetShader::Pixel(PixelRed);
|
obj.Shaders.Pixel = GetShader::Pixel(PixelTexture);
|
||||||
obj.Shaders.Vertex = GetShader::Vertex(VertexDebug);
|
obj.Shaders.Vertex = GetShader::Vertex(VertexTransformDebug);
|
||||||
|
|
||||||
D3D11_INPUT_ELEMENT_DESC indesc[] =
|
D3D11_INPUT_ELEMENT_DESC indesc[] =
|
||||||
{
|
{
|
||||||
|
@ -120,6 +142,7 @@ namespace Oyster
|
||||||
obj.RenderStates.Rasterizer = rs;
|
obj.RenderStates.Rasterizer = rs;
|
||||||
obj.RenderStates.SampleCount = 1;
|
obj.RenderStates.SampleCount = 1;
|
||||||
obj.RenderStates.SampleState = ss;
|
obj.RenderStates.SampleState = ss;
|
||||||
|
obj.RenderStates.DepthStencil = dsState;
|
||||||
|
|
||||||
ModelData.Apply(1);
|
ModelData.Apply(1);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
struct PointLight
|
||||||
|
{
|
||||||
|
float3 Pos;
|
||||||
|
float Radius;
|
||||||
|
|
||||||
|
float3 Color;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
//todo
|
||||||
|
//LightCulling
|
||||||
|
//Calc Diff + Spec
|
||||||
|
//Calc Ambience
|
||||||
|
//Write Glow
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main( uint3 DTid : SV_DispatchThreadID )
|
||||||
|
{
|
||||||
|
}
|
|
@ -9,13 +9,6 @@ cbuffer PerModel : register(b1)
|
||||||
matrix World;
|
matrix World;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct VertexIn
|
|
||||||
{
|
|
||||||
float3 pos : POSITION;
|
|
||||||
float2 UV : TEXCOORD;
|
|
||||||
float3 normal : NORMAL;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertexOut
|
struct VertexOut
|
||||||
{
|
{
|
||||||
float4 Pos : SV_POSITION;
|
float4 Pos : SV_POSITION;
|
||||||
|
@ -23,3 +16,10 @@ struct VertexOut
|
||||||
float3 Normal : NORMAL;
|
float3 Normal : NORMAL;
|
||||||
float4 Wpos : POSITION;
|
float4 Wpos : POSITION;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct VertexIn
|
||||||
|
{
|
||||||
|
float3 pos : POSITION;
|
||||||
|
float2 UV : TEXCOORD;
|
||||||
|
float3 normal : NORMAL;
|
||||||
|
};
|
|
@ -1,5 +1,4 @@
|
||||||
#include "Debug.hlsli"
|
#include "Debug.hlsl"
|
||||||
|
|
||||||
|
|
||||||
VertexOut main( VertexIn input )
|
VertexOut main( VertexIn input )
|
||||||
{
|
{
|
||||||
|
@ -9,5 +8,6 @@ VertexOut main( VertexIn input )
|
||||||
outp.Pos = mul(VP, outp.Wpos );
|
outp.Pos = mul(VP, outp.Wpos );
|
||||||
outp.UV = input.UV;
|
outp.UV = input.UV;
|
||||||
outp.Normal = input.normal;
|
outp.Normal = input.normal;
|
||||||
|
|
||||||
return outp;
|
return outp;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
#include "Debug.hlsli"
|
//#include "Debug.hlsli"
|
||||||
|
|
||||||
float4 main() : SV_TARGET
|
float4 main() : SV_TARGET
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "Debug.hlsli"
|
#include "Debug.hlsl"
|
||||||
|
|
||||||
Texture2D tex : register(t0);
|
Texture2D tex : register(t0);
|
||||||
SamplerState S1 : register(s0);
|
SamplerState S1 : register(s0);
|
||||||
|
|
|
@ -53,7 +53,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
|
||||||
params.lpCmdLine="";
|
params.lpCmdLine="";
|
||||||
params.lpCmdShow="";
|
params.lpCmdShow="";
|
||||||
params.lpEnvAddress="";
|
params.lpEnvAddress="";
|
||||||
LoadModule("OysterGraphics_x86D.dll",¶ms);
|
|
||||||
|
|
||||||
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -184,24 +183,23 @@ HRESULT InitDirect3D()
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region Obj
|
#pragma region Obj
|
||||||
m = Oyster::Graphics::API::CreateModel(L"bth.obj");
|
m = Oyster::Graphics::API::CreateModel(L"orca_dummy.obj");
|
||||||
m->WorldMatrix *= 0.1f;
|
|
||||||
m->WorldMatrix.m44 = 1;
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,100);
|
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000);
|
||||||
|
|
||||||
V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,-1.5f,10.4f));
|
V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,0,5.4f));
|
||||||
V = Oyster::Math3D::InverseOrientationMatrix(V);
|
V = Oyster::Math3D::InverseOrientationMatrix(V);
|
||||||
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
float angle = 0;
|
||||||
HRESULT Update(float deltaTime)
|
HRESULT Update(float deltaTime)
|
||||||
{
|
{
|
||||||
m->WorldMatrix.m14 += 0.0001f;
|
angle += Oyster::Math::pi/30000;
|
||||||
|
m->WorldMatrix = Oyster::Math3D::RotationMatrix_AxisY(angle);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue