Random Updates

This commit is contained in:
lanariel 2014-02-14 14:27:38 +01:00
parent 8e78308820
commit adcac0ec12
9 changed files with 36 additions and 25 deletions

View File

@ -362,6 +362,7 @@ namespace Oyster
}
Core::deviceContext->RSSetState(se.RenderStates.Rasterizer);
Core::deviceContext->PSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
Core::deviceContext->CSSetSamplers(0,se.RenderStates.SampleCount,se.RenderStates.SampleState);
Core::deviceContext->OMSetDepthStencilState(se.RenderStates.DepthStencil,0);
float test[4] = {0};
Core::deviceContext->OMSetBlendState(se.RenderStates.BlendState,test,-1);

View File

@ -94,6 +94,8 @@ namespace Oyster
if(!mi || mi->Vertices->GetBufferPointer() == NULL)
{
delete m;
Core::loader.ReleaseResource(mi);
delete mi;
return NULL;
}
@ -176,6 +178,8 @@ namespace Oyster
float API::PlayAnimation(Model::Model* m, std::wstring name,bool looping)
{
if(m==NULL)
return 0;
m->Animation.AnimationPlaying = &(*m->info->Animations.find(name)).second;
m->Animation.AnimationTime=0;
m->Animation.LoopAnimation = looping;

View File

@ -175,7 +175,6 @@ static void ReadData(void* Destination, std::ifstream& file, int size)
///
void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[])
{
//
Oyster::Graphics::Model::ModelInfo* modelInfo = new Oyster::Graphics::Model::ModelInfo();
modelInfo->Indexed = false;
modelInfo->Animated = false;
@ -184,7 +183,10 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[])
std::ifstream danFile;
danFile.open(filename, std::ios::binary);
if (!danFile.is_open())
{
delete modelInfo;
return NULL;
}
// Read file header
char* buffer = new char[sizeof(FileHeader)];
@ -195,6 +197,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[])
// If problem with compatability then close file and return from method
if (fileHeader.versionMajor != DANFILEVERSIONMAJOR)
{
delete modelInfo;
danFile.close();
return NULL;
}
@ -290,7 +293,7 @@ void* Oyster::Graphics::Loading::LoadDAN(const wchar_t filename[])
//read normal map name length
ReadData(&materialHeader.normalMapPathLength,danFile,4);
//read difuse map name
//read normal map name
materialHeader.normalMapPath = new char[materialHeader.normalMapPathLength + 1];
ReadData(materialHeader.normalMapPath,danFile,materialHeader.normalMapPathLength);
materialHeader.normalMapPath[materialHeader.normalMapPathLength] = 0;

View File

@ -645,6 +645,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
if ( SUCCEEDED(hr) && ( fmtSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN ) )
{
autogen = true;
autogen = false;
}
}

View File

@ -4,19 +4,19 @@
void main(point Vertex2DIn input[1],inout TriangleStream<Pixel2DIn> Quads)
{
Pixel2DIn output;
output.Pos = mul(float4(-1,-1,0,1) ,Translation);
output.Pos = mul(float4(-1,-1,1,1) ,Translation);
output.Uv = float2(0,1);
Quads.Append(output);
output.Pos = mul(float4(-1,1,0,1), Translation);
output.Pos = mul(float4(-1,1,1,1), Translation);
output.Uv = float2(0,0);
Quads.Append(output);
output.Pos = mul(float4(1,-1,0,1), Translation);
output.Pos = mul(float4(1,-1,1,1), Translation);
output.Uv = float2(1,1);
Quads.Append(output);
output.Pos = mul(float4(1,1,0,1), Translation);
output.Pos = mul(float4(1,1,1,1), Translation);
output.Uv = float2(1,0);
Quads.Append(output);
}

View File

@ -7,22 +7,22 @@ void main(point Text2DIn input[1],inout TriangleStream<Pixel2DIn> Quads)
float endoff=startoff+input[0].coff;
Pixel2DIn output;
output.Pos = mul(float4(-1,-1,0,1), Translation);
output.Pos = mul(float4(-1,-1,1,1), Translation);
output.Pos.x += input[0].Pos;
output.Uv = float2(startoff,1);
Quads.Append(output);
output.Pos = mul(float4(-1,1,0,1), Translation);
output.Pos = mul(float4(-1,1,1,1), Translation);
output.Pos.x += input[0].Pos;
output.Uv = float2(startoff,0);
Quads.Append(output);
output.Pos = mul(float4(1,-1,0,1), Translation);
output.Pos = mul(float4(1,-1,1,1), Translation);
output.Pos.x += input[0].Pos;
output.Uv = float2(endoff,1);
Quads.Append(output);
output.Pos = mul(float4(1,1,0,1), Translation);
output.Pos = mul(float4(1,1,1,1), Translation);
output.Pos.x += input[0].Pos;
output.Uv = float2(endoff,0);
Quads.Append(output);

View File

@ -36,7 +36,8 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID )
float AmbValue = GetSSAO(ViewPos, UV, DTid.xy, GTid.xy/2);
Ambient[DTid.xy/2] = float4(DiffuseGlow[DTid.xy].xyz, AmbValue);
Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy];
Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffuseGlow[DTid.xy].xyz * DiffuseGlow[DTid.xy].w*10,1);
Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffuseGlow[DTid.xy].xyz * DiffuseGlow[DTid.xy].w,1);
Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz,1);
}
}

View File

@ -20,6 +20,7 @@ float4 SuperSample(float4 Glow, uint3 DTid)
index += float2(0,Output.Length.y/2);
index = index / Output.Length;
Glow = Ambient.SampleLevel(S1, index,1);
Glow = Glow * Glow.w*10;
//Line Y+1
//Glow += Ambient[DTid.xy/2 + uint2(1,(Output.Length.y/2)+1)] + Ambient[DTid.xy/2 + uint2(0,(Output.Length.y/2)+1)] + Ambient[DTid.xy/2 + uint2(-1,(Output.Length.y/2)+1)];
//Line Y-1
@ -34,7 +35,7 @@ float4 SuperSample(float4 Glow, uint3 DTid)
void main( uint3 DTid : SV_DispatchThreadID )
{
float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]);
float4 Amb = float4(Ambient[DTid.xy/2].xyz * Ambient[DTid.xy/2].w, 0);
float4 Amb = float4(Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w*/, 0);
//float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)];
float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)];
@ -48,5 +49,5 @@ void main( uint3 DTid : SV_DispatchThreadID )
PostLight = PostLight * (1 - GUI.w);
Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1);
//Output[DTid.xy] = Glow;
//Output[DTid.xy] = Ambient[DTid.xy];
}

View File

@ -170,19 +170,19 @@ HRESULT InitDirect3D()
return E_FAIL;
}
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");
m = Oyster::Graphics::API::CreateModel(L"crate_colonists.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_orca.dan");
m2->Tint = Oyster::Math::Float3(0.1f,0.1f,1);
m3 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
m3 = Oyster::Graphics::API::CreateModel(L"char_orca.dan");
//m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
Oyster::Graphics::API::PlayAnimation(m2, L"movement", true);
Oyster::Graphics::API::PlayAnimation(m3, L"movement", true);
t = Oyster::Graphics::API::CreateTexture(L"structure_corp_mdg.png");
t2 = Oyster::Graphics::API::CreateTexture(L"whiteGui.png");
t2 = Oyster::Graphics::API::CreateTexture(L"color_white.png");
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1280.0f/720.0f,.1f,10000);
Oyster::Graphics::API::SetProjection(P);
@ -220,14 +220,14 @@ float angle = 0;
HRESULT Update(float deltaTime)
{
//angle += Oyster::Math::pi/16 * 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(0,1,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;
ma.m[0][0] = 0.2f;
ma.m[1][1] = 0.2f;
ma.m[2][2] = 0.2f;
m->WorldMatrix = m->WorldMatrix * ma;
//m->WorldMatrix = m->WorldMatrix * ma;
Oyster::Graphics::API::Update(deltaTime);
//m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
return S_OK;
@ -242,7 +242,7 @@ HRESULT Render(float deltaTime)
Oyster::Graphics::API::RenderModel(m2);
Oyster::Graphics::API::RenderModel(m3);
Oyster::Graphics::API::StartGuiRender();
//Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1), Oyster::Math::Float3(0,0,1));
Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float3(0.5f,0.7f,0.1f),Oyster::Math::Float2(0.2f,0.2f), Oyster::Math::Float3(1,1,1));
//Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1),Oyster::Math::Float3(1,0,0));
Oyster::Graphics::API::StartTextRender();
std::wstring fps;
@ -250,7 +250,7 @@ HRESULT Render(float deltaTime)
fps = std::to_wstring(f);
//Oyster::Graphics::API::RenderText(L"Lanariel",Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
//Oyster::Graphics::API::RenderText(L"Lanariel WAS HERE",Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
Oyster::Graphics::API::RenderText(fps,Oyster::Math::Float3(0.5f,0.1f,1.0f),Oyster::Math::Float2(0.5f,0.1f), 0.08f, Oyster::Math::Float3(0,1,0));
Oyster::Graphics::API::RenderText(fps,Oyster::Math::Float3(0.5f,0.1f,0.1f),Oyster::Math::Float2(0.5f,0.1f), 0.08f, Oyster::Math::Float3(0,1,0));
Oyster::Graphics::API::EndFrame();
return S_OK;