Small fixes

This commit is contained in:
lanariel 2014-02-19 15:57:52 +01:00
parent 273995e204
commit 4697b85e3b
11 changed files with 32 additions and 19 deletions

View File

@ -106,7 +106,7 @@ namespace DanBias
Graphics::API::Update( dt ); Graphics::API::Update( dt );
data.capFrame += dt; data.capFrame += dt;
if(data.capFrame > 0.03) if(data.capFrame > 0.03f)
{ {
switch( Update(data.capFrame) ) switch( Update(data.capFrame) )
{ {
@ -117,7 +117,7 @@ namespace DanBias
} }
if(Render() != S_OK) if(Render() != S_OK)
return DanBiasClientReturn_Error; return DanBiasClientReturn_Error;
data.capFrame -= 0.03; data.capFrame -= 0.03f;
} }
if(data.networkClient.IsConnected()) if(data.networkClient.IsConnected())

View File

@ -89,6 +89,8 @@ bool GameState::Init( SharedStateContent &shared )
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y;
this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f );
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
gfxOp.AmbientValue = 2.0f;
Graphics::API::SetOptions(gfxOp);
//tell server ready //tell server ready
this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) );
@ -105,6 +107,7 @@ bool GameState::Init( SharedStateContent &shared )
light->second->Render(); light->second->Render();
} }
return true; return true;
} }
@ -237,6 +240,7 @@ bool GameState::Render()
bool GameState::Release() bool GameState::Release()
{ {
Graphics::API::Option o = Graphics::API::GetOption();
if( privData ) if( privData )
{ {
auto staticObject = this->privData->staticObjects->begin(); auto staticObject = this->privData->staticObjects->begin();

View File

@ -77,7 +77,7 @@ Game::PlayerData* Game::CreatePlayer()
found = true; found = true;
freeID = i; freeID = i;
for(int j = 0; j < players.Size(); j++) for(int j = 0; j < (int)players.Size(); j++)
{ {
if(this->players[j] && this->players[j]->GetID() == freeID) if(this->players[j] && this->players[j]->GetID() == freeID)

View File

@ -220,7 +220,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0)); API::Instance().SetGravityPoint(Oyster::Math3D::Float3(0,0,0));
API::Instance().SetGravity(200); API::Instance().SetGravity(200);
int objCount = objects.size(); int objCount = (int)objects.size();
for (int i = 0; i < objCount; i++) for (int i = 0; i < objCount; i++)
{ {

View File

@ -40,15 +40,15 @@ namespace Oyster
} }
inline unsigned int GetResourceSize() const inline unsigned int GetResourceSize() const
{ {
return this->resourceSize; return (unsigned int)this->resourceSize;
} }
inline unsigned int GetResourceElementSize() const inline unsigned int GetResourceElementSize() const
{ {
return this->resourceElementSize; return (unsigned int)this->resourceElementSize;
} }
inline unsigned int GetResourceID() const inline unsigned int GetResourceID() const
{ {
return this->resourceID; return (unsigned int)this->resourceID;
} }
inline void SetResourceID(int id) inline void SetResourceID(int id)
{ {

View File

@ -58,7 +58,7 @@ void Broadcast()
addr.append(buff); addr.append(buff);
dest.sin_addr.s_addr = inet_addr( addr.c_str() ); dest.sin_addr.s_addr = inet_addr( addr.c_str() );
// send the pkt // send the pkt
int ret = sendto( s, pkt, pkt_length, 0, (sockaddr *)&dest, sizeof(dest) ); int ret = sendto( s, pkt, pkt_length, 0, (sockaddr *)&dest, (int)sizeof(dest) );
} }
} }

View File

@ -205,9 +205,9 @@ namespace Oyster
void API::StartRenderWireFrame() void API::StartRenderWireFrame()
{ {
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL); Core::deviceContext->OMSetRenderTargets((UINT)Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
Core::deviceContext->RSSetState(wire); Core::deviceContext->RSSetState(wire);
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL); Core::deviceContext->OMSetRenderTargets((UINT)Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
} }
void API::RenderDebugCube(Math::Matrix world) void API::RenderDebugCube(Math::Matrix world)

View File

@ -146,7 +146,7 @@ namespace Oyster
return NULL; return NULL;
} }
#endif #endif
Core::UsedMem += data.size; Core::UsedMem += (int)data.size;
return Core::PipelineManager::CreateShader(data, Core::PipelineManager::ShaderType(type)); return Core::PipelineManager::CreateShader(data, Core::PipelineManager::ShaderType(type));
} }
} }

View File

@ -103,7 +103,7 @@ namespace Oyster
Resources::Gui::Text::Vertex.Unmap(); Resources::Gui::Text::Vertex.Unmap();
Core::deviceContext->Draw(text.length(), 0); Core::deviceContext->Draw((UINT)text.length(), 0);
} }
} }
} }

View File

@ -349,9 +349,6 @@ namespace Oyster
Core::device->CreateDepthStencilView(depthstencil,NULL,&Gui::depth); Core::device->CreateDepthStencilView(depthstencil,NULL,&Gui::depth);
depthstencil->Release(); depthstencil->Release();
D3D11_DEPTH_STENCIL_DESC dDesc;
return Core::Init::Success; return Core::Init::Success;
} }

View File

@ -14,18 +14,30 @@ cbuffer Size : register(b0)
[numthreads(16, 16, 1)] [numthreads(16, 16, 1)]
void main( uint3 DTid : SV_DispatchThreadID ) void main( uint3 DTid : SV_DispatchThreadID )
{ {
float SSAO = 0;
for(int x = 0; x < 4; ++x)
{
for(int y = 0; y < 4; ++y)
{
SSAO += Ambient[DTid.xy/2 + uint2(-2+x,-2+y)].w;
}
}
SSAO = SSAO / 16;
float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]); float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]);
float3 Amb = Ambient[DTid.xy/2].xyz /* * Ambient[DTid.xy/2].w */; float3 Amb = Ambient[DTid.xy/2].xyz * SSAO;
float3 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)].xyz; float3 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)].xyz;
float4 GUI; float4 GUI;
uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0);
float3 PostLight = Amb.xyz * AmbFactor; float3 PostLight = Amb * AmbFactor;
PostLight = PostLight + Light.xyz + Glow; PostLight = PostLight + Light.xyz + Glow;
GUI = float4(Ambient[index]); GUI = float4(Ambient[index]);
PostLight = PostLight * (1 - GUI.w); PostLight = PostLight * (1 - GUI.w);
Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1);
//Output[DTid.xy] = float4(Ambient[DTid.xy/2 + uint2(Output.Length*0.5f)].xyz,1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2 + uint2(Output.Length*0.5f)].xyz,1);
//Output[DTid.xy] = Ambient[DTid.xy]; //Output[DTid.xy] = SSAO * float4(1,1,1,1);
} }