From 8e783088208b93a4a47384fa26b2b301f1adf6d7 Mon Sep 17 00:00:00 2001 From: lanariel Date: Fri, 14 Feb 2014 10:08:39 +0100 Subject: [PATCH] New Vertex format NOT STABLE UNTIL NEW MODELS --- .../Definitions/GraphicalDefinition.h | 2 -- Code/OysterGraphics/FileLoader/DanLoader.cpp | 5 ++--- Code/OysterGraphics/Render/GuiRenderer.cpp | 2 +- Code/OysterGraphics/Render/Resources.cpp | 4 +--- .../Shader/Passes/Gather/Header.hlsli | 2 -- Code/Tester/MainTest.cpp | 14 +++++++++----- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index 958904a8..ffd2869a 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -27,8 +27,6 @@ namespace Oyster Oyster::Math::Float3 pos; Oyster::Math::Float2 uv; Oyster::Math::Float3 normal; - Oyster::Math::Float3 tangent; - Oyster::Math::Float3 biTangent; Oyster::Math::Float4 boneIndex; Oyster::Math::Float4 boneWeights; }; diff --git a/Code/OysterGraphics/FileLoader/DanLoader.cpp b/Code/OysterGraphics/FileLoader/DanLoader.cpp index 99302266..69af2158 100644 --- a/Code/OysterGraphics/FileLoader/DanLoader.cpp +++ b/Code/OysterGraphics/FileLoader/DanLoader.cpp @@ -5,12 +5,11 @@ #include #include -#define DANFILEVERSIONMAJOR 1 +#define DANFILEVERSIONMAJOR 2 #define DANFILEVERSIONMINOR 1 #define FILEHEADERSIZE 8 #define VERTEXHEADERSIZE 4 -#define VERTEXSIZE 88 @@ -220,7 +219,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[]) delete[] buffer; // ( note: may crash here.) // Fetch all vertices - unsigned int bufferSize = VERTEXSIZE * vertexHeader.numVertices; + unsigned int bufferSize = sizeof(Vertex) * vertexHeader.numVertices; buffer = new char[bufferSize]; danFile.read(buffer, bufferSize); diff --git a/Code/OysterGraphics/Render/GuiRenderer.cpp b/Code/OysterGraphics/Render/GuiRenderer.cpp index 78b2f771..86f6fe0e 100644 --- a/Code/OysterGraphics/Render/GuiRenderer.cpp +++ b/Code/OysterGraphics/Render/GuiRenderer.cpp @@ -91,7 +91,7 @@ namespace Oyster { tmpInst.coff=(1.0f/TEXT_NR_LETTERS); tmpInst.offset=text[i]-32; - tmpInst.pos=i*(FontSize * 0.8f * TEXT_SPACING); + tmpInst.pos=i*(FontSize * 0.7f * TEXT_SPACING); if(tmpInst.pos > size.x) { text = text.substr(0,i-1); diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index 450a075b..696ee6f1 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -340,13 +340,11 @@ namespace Oyster { "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 }, { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "BITANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 44, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "BONEINDEX", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 56, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 72, D3D11_INPUT_PER_VERTEX_DATA, 0 } }; - Shader::CreateInputLayout(indesc,7,GetShader::Vertex(L"Gather"),Gather::Pass.IAStage.Layout); + Shader::CreateInputLayout(indesc,5,GetShader::Vertex(L"Gather"),Gather::Pass.IAStage.Layout); Gather::Pass.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData); Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData); diff --git a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli index ea144417..8747e46d 100644 --- a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli @@ -3,8 +3,6 @@ struct VertexIn float3 pos : POSITION; float2 UV : TEXCOORD; float3 normal : NORMAL; - float3 tangent : TANGENT; - float3 biTangent : BITANGENT; float4 boneIndex : BONEINDEX; float4 boneWeight : BONEWEIGHT; }; diff --git a/Code/Tester/MainTest.cpp b/Code/Tester/MainTest.cpp index ad71dabb..c6956971 100644 --- a/Code/Tester/MainTest.cpp +++ b/Code/Tester/MainTest.cpp @@ -170,10 +170,10 @@ HRESULT InitDirect3D() return E_FAIL; } - m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); - //m->WorldMatrix.m[0][0] = 50; - //m->WorldMatrix.m[1][1] = 50; - //m->WorldMatrix.m[2][2] = 0.00000005f; + m = Oyster::Graphics::API::CreateModel(L"building_corporation.dan"); + m->WorldMatrix.m[0][0] = 0.0002f; + m->WorldMatrix.m[1][1] = 0.0002f; + m->WorldMatrix.m[2][2] = 0.0002f; m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan"); m2->Tint = Oyster::Math::Float3(0.1f,0.1f,1); m3 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan"); @@ -223,7 +223,11 @@ HRESULT Update(float deltaTime) m->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(1,0,0) * angle,Oyster::Math::Float3(0,0,0),Oyster::Math::Float3::null); m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0) * angle,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null); m3->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3(0,1,0) * -angle,Oyster::Math::Float3(-4,0,0),Oyster::Math::Float3::null); - //Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; + Oyster::Math::Matrix ma = Oyster::Math::Matrix::identity; + ma.m[0][0] = 0.2f; + ma.m[1][1] = 0.2f; + ma.m[2][2] = 0.2f; + m->WorldMatrix = m->WorldMatrix * ma; Oyster::Graphics::API::Update(deltaTime); //m2->Animation.data.AnimationTime += deltaTime;// * 0.5f; return S_OK;