Fixed Projection
This commit is contained in:
parent
5abaef6e86
commit
59dcbc9729
Binary file not shown.
Binary file not shown.
|
@ -21,8 +21,8 @@ float4 main( VertexIn input ) : SV_POSITION
|
||||||
float4 postTransform = float4(input.pos*0.1f,1);
|
float4 postTransform = float4(input.pos*0.1f,1);
|
||||||
postTransform.y += 1.5f;
|
postTransform.y += 1.5f;
|
||||||
//return postTransform;
|
//return postTransform;
|
||||||
return mul(float4(input.pos*0.1f,1), View);
|
//return mul(View, float4(input.pos,1));
|
||||||
//matrix VP = mul(Projection,View);
|
matrix VP = mul(Projection, View);
|
||||||
//matrix WVP = mul(World, VP);
|
//matrix WVP = mul(World, VP);
|
||||||
//return mul(VP, float4(input.pos*0.01f,1));
|
return mul(VP, float4(input.pos*0.1f,1) );
|
||||||
}
|
}
|
|
@ -392,7 +392,7 @@ namespace LinearAlgebra3D
|
||||||
::LinearAlgebra::Vector3<ScalarType> right = normalizedDirection.Cross( normalizedUpVector ).GetNormalized();
|
::LinearAlgebra::Vector3<ScalarType> right = normalizedDirection.Cross( normalizedUpVector ).GetNormalized();
|
||||||
return ::LinearAlgebra::Matrix4x4<ScalarType>( ::LinearAlgebra::Vector4<ScalarType>( right, 0.0f ),
|
return ::LinearAlgebra::Matrix4x4<ScalarType>( ::LinearAlgebra::Vector4<ScalarType>( right, 0.0f ),
|
||||||
::LinearAlgebra::Vector4<ScalarType>( right.Cross( normalizedDirection ), 0.0f ),
|
::LinearAlgebra::Vector4<ScalarType>( right.Cross( normalizedDirection ), 0.0f ),
|
||||||
::LinearAlgebra::Vector4<ScalarType>( -normalizedDirection, 0.0f ),
|
::LinearAlgebra::Vector4<ScalarType>( normalizedDirection, 0.0f ),
|
||||||
::LinearAlgebra::Vector4<ScalarType>( worldPos, 1.0f ) );
|
::LinearAlgebra::Vector4<ScalarType>( worldPos, 1.0f ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,40 +143,12 @@ HRESULT InitDirect3D()
|
||||||
if(Oyster::Graphics::Core::Init::FullInit(g_hWnd,false,false)==Oyster::Graphics::Core::Init::Fail)
|
if(Oyster::Graphics::Core::Init::FullInit(g_hWnd,false,false)==Oyster::Graphics::Core::Init::Fail)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
//Init shaders
|
||||||
|
|
||||||
/*std::wstring ShaderPath = L"..\\OysterGraphics\\Shader\\HLSL\\";
|
|
||||||
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"DebugVertex.hlsl",Oyster::Graphics::Core::ShaderManager::ShaderType::Vertex,L"PassThroughFloat4",false);
|
|
||||||
|
|
||||||
Oyster::Graphics::Core::ShaderManager::Set::Vertex(Oyster::Graphics::Core::ShaderManager::Get::Vertex(L"PassThroughFloat4"));
|
|
||||||
Oyster::Graphics::Core::ShaderManager::Set::Pixel(Oyster::Graphics::Core::ShaderManager::Get::Pixel(L"Debug"));
|
|
||||||
|
|
||||||
D3D11_INPUT_ELEMENT_DESC inputDesc[] =
|
|
||||||
{
|
|
||||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
ID3D11InputLayout* layout;
|
|
||||||
|
|
||||||
Oyster::Graphics::Core::ShaderManager::CreateInputLayout( inputDesc, 1, Oyster::Graphics::Core::ShaderManager::Get::Vertex(L"PassThroughFloat4"), layout);
|
|
||||||
|
|
||||||
Oyster::Graphics::Core::deviceContext->IASetInputLayout(layout);
|
|
||||||
Oyster::Graphics::Core::deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
|
||||||
|
|
||||||
Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV();*/
|
|
||||||
|
|
||||||
Oyster::Graphics::Render::Resources::Init();
|
Oyster::Graphics::Render::Resources::Init();
|
||||||
|
|
||||||
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
|
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
|
||||||
|
|
||||||
/*struct float4
|
|
||||||
{
|
|
||||||
float x,y,z,w;
|
|
||||||
};*/
|
|
||||||
|
|
||||||
|
#pragma region Triangle
|
||||||
//Oyster::Graphics::Definitions::ObjVertex mesh[] =
|
//Oyster::Graphics::Definitions::ObjVertex mesh[] =
|
||||||
//{
|
//{
|
||||||
// {Oyster::Math::Vector3(-1,1,0),Oyster::Math::Vector2(0,0),Oyster::Math::Vector3(1,1,0)},
|
// {Oyster::Math::Vector3(-1,1,0),Oyster::Math::Vector2(0,0),Oyster::Math::Vector3(1,1,0)},
|
||||||
|
@ -199,17 +171,23 @@ HRESULT InitDirect3D()
|
||||||
//mi->Indexed = false;
|
//mi->Indexed = false;
|
||||||
//mi->VertexCount = 3;
|
//mi->VertexCount = 3;
|
||||||
//mi->Vertices = b;
|
//mi->Vertices = b;
|
||||||
|
|
||||||
|
//m->info = mi;
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
#pragma region Obj
|
||||||
OBJReader or;
|
OBJReader or;
|
||||||
or.readOBJFile(L"bth.obj");
|
or.readOBJFile(L"bth.obj");
|
||||||
m->info = or.toModel();
|
m->info = or.toModel();
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
|
|
||||||
//m->info = mi;
|
|
||||||
m->World = Oyster::Math::Matrix::identity;
|
m->World = Oyster::Math::Matrix::identity;
|
||||||
|
|
||||||
P = Oyster::Math3D::ProjectionMatrix_Perspective(PI/4,16.0f/9.0f,1,100);
|
P = Oyster::Math3D::ProjectionMatrix_Perspective(PI/2,16.0f/9.0f,.1f,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();
|
|
||||||
|
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::InverseOrientationMatrix(V);
|
||||||
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue