Merge remote-tracking branch 'origin/Graphics' into Camera-Merge-buffer
Conflicts: Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl
This commit is contained in:
commit
8bf13dab39
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -645,6 +645,7 @@ static HRESULT CreateTextureFromWIC( _In_ ID3D11Device* d3dDevice,
|
|||
if ( SUCCEEDED(hr) && ( fmtSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN ) )
|
||||
{
|
||||
autogen = true;
|
||||
autogen = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace Oyster
|
|||
tmpInst.coff=(1.0f/TEXT_NR_LETTERS);
|
||||
tmpInst.offset=text[i]-32;
|
||||
tmpInst.pos=i*(FontSize * 0.7f * TEXT_SPACING);
|
||||
if(tmpInst.pos > size.x)
|
||||
if(tmpInst.pos > size.x*2)
|
||||
{
|
||||
text = text.substr(0,i-1);
|
||||
break;
|
||||
|
|
|
@ -340,8 +340,8 @@ 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 },
|
||||
{ "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 }
|
||||
{ "BONEINDEX", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "BONEWEIGHT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 48, D3D11_INPUT_PER_VERTEX_DATA, 0 }
|
||||
};
|
||||
|
||||
Shader::CreateInputLayout(indesc,5,GetShader::Vertex(L"Gather"),Gather::Pass.IAStage.Layout);
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -13,8 +13,6 @@ struct VertexOut
|
|||
float4 ViewPos : POSITION;
|
||||
float2 UV : TEXCOORD;
|
||||
float3 normal : NORMAL;
|
||||
//float3 tangent : TANGENT;
|
||||
//float3 biTangent : BITANGENT;
|
||||
};
|
||||
|
||||
struct PixelOut
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ cbuffer Size : register(b0)
|
|||
int2 Pixels;
|
||||
}
|
||||
|
||||
#define AmbFactor 0.8f;
|
||||
#define AmbFactor 0.1f;
|
||||
|
||||
float4 SuperSample(float4 Glow, uint3 DTid)
|
||||
{
|
||||
|
@ -20,12 +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);
|
||||
//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
|
||||
//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)];
|
||||
|
||||
//Glow = Glow/9;
|
||||
Glow = Glow * Glow.w*10;
|
||||
|
||||
return Glow;
|
||||
}
|
||||
|
@ -34,7 +29,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)];
|
||||
|
||||
|
@ -43,10 +38,10 @@ void main( uint3 DTid : SV_DispatchThreadID )
|
|||
float4 GUI;
|
||||
uint2 index = DTid.xy/2 + uint2((uint)Pixels.x/(uint)2,0);
|
||||
float3 PostLight = Amb.xyz * AmbFactor;
|
||||
PostLight = PostLight + Light.xyz; // + Glow;
|
||||
PostLight = PostLight + Light.xyz + Glow;
|
||||
GUI = float4(Ambient[index]);
|
||||
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];
|
||||
}
|
|
@ -170,19 +170,15 @@ 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");
|
||||
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);
|
||||
Oyster::Graphics::API::PlayAnimation(m2, L"movement", true);
|
||||
m3 = Oyster::Graphics::API::CreateModel(L"char_orca.dan");
|
||||
//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);
|
||||
|
@ -217,19 +213,13 @@ HRESULT InitDirect3D()
|
|||
return S_OK;
|
||||
}
|
||||
float angle = 0;
|
||||
float z=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,z),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;
|
||||
Oyster::Graphics::API::Update(deltaTime);
|
||||
//m2->Animation.data.AnimationTime += deltaTime;// * 0.5f;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -242,7 +232,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 +240,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;
|
||||
|
@ -290,16 +280,26 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
|
|||
break;
|
||||
//Z -
|
||||
case 0x5A:
|
||||
//m2->AnimationTime -= 0.1f;
|
||||
//if(m2->AnimationTime < 0)
|
||||
//m2->AnimationTime = 0;
|
||||
angle += Oyster::Math::pi / 16;
|
||||
break;
|
||||
//X +
|
||||
case 0x58:
|
||||
//m2->AnimationTime += 0.1f;
|
||||
angle -= Oyster::Math::pi / 16;
|
||||
break;
|
||||
//A
|
||||
case 0x41:
|
||||
break;
|
||||
//D
|
||||
case 0x44:
|
||||
break;
|
||||
//W
|
||||
case 0x57:
|
||||
z-=0.5f;
|
||||
break;
|
||||
//S
|
||||
case 0x53:
|
||||
z+=0.5f;
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue