Merge branch 'Graphics' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
lindaandersson 2014-02-14 13:55:03 +01:00
commit 68dfd2e324
6 changed files with 13 additions and 16 deletions

View File

@ -27,8 +27,6 @@ namespace Oyster
Oyster::Math::Float3 pos; Oyster::Math::Float3 pos;
Oyster::Math::Float2 uv; Oyster::Math::Float2 uv;
Oyster::Math::Float3 normal; Oyster::Math::Float3 normal;
Oyster::Math::Float3 tangent;
Oyster::Math::Float3 biTangent;
Oyster::Math::Float4 boneIndex; Oyster::Math::Float4 boneIndex;
Oyster::Math::Float4 boneWeights; Oyster::Math::Float4 boneWeights;
}; };

View File

@ -5,12 +5,11 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#define DANFILEVERSIONMAJOR 1 #define DANFILEVERSIONMAJOR 2
#define DANFILEVERSIONMINOR 1 #define DANFILEVERSIONMINOR 1
#define FILEHEADERSIZE 8 #define FILEHEADERSIZE 8
#define VERTEXHEADERSIZE 4 #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.) delete[] buffer; // ( note: may crash here.)
// Fetch all vertices // Fetch all vertices
unsigned int bufferSize = VERTEXSIZE * vertexHeader.numVertices; unsigned int bufferSize = sizeof(Vertex) * vertexHeader.numVertices;
buffer = new char[bufferSize]; buffer = new char[bufferSize];
danFile.read(buffer, bufferSize); danFile.read(buffer, bufferSize);

View File

@ -91,7 +91,7 @@ namespace Oyster
{ {
tmpInst.coff=(1.0f/TEXT_NR_LETTERS); tmpInst.coff=(1.0f/TEXT_NR_LETTERS);
tmpInst.offset=text[i]-32; 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) if(tmpInst.pos > size.x)
{ {
text = text.substr(0,i-1); text = text.substr(0,i-1);

View File

@ -340,13 +340,11 @@ namespace Oyster
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, { "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 }, { "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 }, { "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 }, { "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 } { "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.IAStage.Topology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData); Gather::Pass.CBuffers.Vertex.push_back(Gather::AnimationData);
Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData); Gather::Pass.CBuffers.Vertex.push_back(Gather::ModelData);

View File

@ -3,8 +3,6 @@ struct VertexIn
float3 pos : POSITION; float3 pos : POSITION;
float2 UV : TEXCOORD; float2 UV : TEXCOORD;
float3 normal : NORMAL; float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 biTangent : BITANGENT;
float4 boneIndex : BONEINDEX; float4 boneIndex : BONEINDEX;
float4 boneWeight : BONEWEIGHT; float4 boneWeight : BONEWEIGHT;
}; };

View File

@ -170,10 +170,10 @@ HRESULT InitDirect3D()
return E_FAIL; return E_FAIL;
} }
m = Oyster::Graphics::API::CreateModel(L"crate_colonists.dan"); m = Oyster::Graphics::API::CreateModel(L"building_corporation.dan");
//m->WorldMatrix.m[0][0] = 50; m->WorldMatrix.m[0][0] = 0.0002f;
//m->WorldMatrix.m[1][1] = 50; m->WorldMatrix.m[1][1] = 0.0002f;
//m->WorldMatrix.m[2][2] = 0.00000005f; m->WorldMatrix.m[2][2] = 0.0002f;
m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan"); m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
m2->Tint = Oyster::Math::Float3(0.1f,0.1f,1); m2->Tint = Oyster::Math::Float3(0.1f,0.1f,1);
m3 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan"); 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); 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); 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); 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); Oyster::Graphics::API::Update(deltaTime);
//m2->Animation.data.AnimationTime += deltaTime;// * 0.5f; //m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
return S_OK; return S_OK;