diff --git a/Code/Game/GameClient/GameClientState/C_Object.cpp b/Code/Game/GameClient/GameClientState/C_Object.cpp index 22820850..b4f18d34 100644 --- a/Code/Game/GameClient/GameClientState/C_Object.cpp +++ b/Code/Game/GameClient/GameClientState/C_Object.cpp @@ -103,6 +103,26 @@ void C_Object::Release() } } +Oyster::Math::Float3 C_Object::GetTint() +{ + return model->Tint; +} + +Oyster::Math::Float3 C_Object::GetGlowTint() +{ + return model->GlowTint; +} + +void C_Object::SetTint(Oyster::Math::Float3 tint) +{ + model->Tint = tint; +} + +void C_Object::SetGlowTint(Oyster::Math::Float3 tint) +{ + model->GlowTint = tint; +} + //////////////////////////////////////////////// diff --git a/Code/Game/GameClient/GameClientState/C_Object.h b/Code/Game/GameClient/GameClientState/C_Object.h index c0784436..fd118068 100644 --- a/Code/Game/GameClient/GameClientState/C_Object.h +++ b/Code/Game/GameClient/GameClientState/C_Object.h @@ -67,6 +67,13 @@ namespace DanBias void addScale(Oyster::Math::Float3 deltaScale); Oyster::Math::Float3 getScale() const; + Oyster::Math::Float3 GetTint(); + Oyster::Math::Float3 GetGlowTint(); + + void SetTint(Oyster::Math::Float3); + void SetGlowTint(Oyster::Math::Float3); + + // RB DEBUG void updateRBWorld(); bool InitRB(RBInitData modelInit); diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 69a37597..532bd29d 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -126,6 +126,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa RBData.position = position; RBData.rotation = ArrayToQuaternion( rotation ); RBData.scale = scale; + RBData.type = RB_Type_Cube; // !RB DEBUG if( isMyPlayer ) { @@ -138,7 +139,10 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa this->privData->myId = id; this->privData->camera.SetPosition( this->privData->player.getPos() ); Float3 offset = Float3( 0.0f ); - offset.y = this->privData->player.getScale().y * 0.9f; + // DEBUG position of camera so we can see the player model + offset.y = this->privData->player.getScale().y * 5.0f; + offset.z = this->privData->player.getScale().z * -5.0f; + // !DEBUG this->privData->camera.SetHeadOffset( offset ); this->privData->camera.UpdateOrientation(); } @@ -182,7 +186,9 @@ bool GameState::Render() for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject ) { if( dynamicObject->second ) + { dynamicObject->second->Render(); + } } @@ -500,6 +506,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState this->privData->camera.SetRotation( rotation ); this->privData->player.setPos( position ); this->privData->player.setRot( rotation ); + this->privData->player.updateWorld(); + // RB DEBUG + this->privData->player.setRBPos ( position ); + this->privData->player.setRBRot ( rotation ); + this->privData->player.updateRBWorld(); + // !RB DEBUG } C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID]; diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index de4f57d5..9ef0dac9 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -157,6 +157,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2; RBData.type = RB_Type_Cube; staticObject->InitRB( RBData ); + staticObject->updateRBWorld(); } if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere) @@ -166,6 +167,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2; RBData.type = RB_Type_Sphere; staticObject->InitRB( RBData ); + staticObject->updateRBWorld(); } // !RB DEBUG diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index ed964724..045da742 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -5,7 +5,7 @@ using namespace GameLogic; Game::PlayerData::PlayerData() { - Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0); Oyster::Math::Float height = 2.0f; Oyster::Math::Float radius = 0.5f; Oyster::Math::Float mass = 40; @@ -24,7 +24,7 @@ Game::PlayerData::PlayerData() Game::PlayerData::PlayerData(int playerID,int teamID) { - Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0); Oyster::Math::Float height = 2.0f; Oyster::Math::Float radius = 0.5f; Oyster::Math::Float mass = 40; diff --git a/Code/OysterGraphics/Definitions/GraphicalDefinition.h b/Code/OysterGraphics/Definitions/GraphicalDefinition.h index fcfd865c..c9b42c00 100644 --- a/Code/OysterGraphics/Definitions/GraphicalDefinition.h +++ b/Code/OysterGraphics/Definitions/GraphicalDefinition.h @@ -79,6 +79,14 @@ namespace Oyster unsigned int StopY; Math::Float4 BlurMask; }; + + struct TintData + { + Math::Float3 Tint; + Math::Float PAD; + Math::Float3 GlowTint; + Math::Float PAD2; + }; } } } \ No newline at end of file diff --git a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp index 23827e1d..41063265 100644 --- a/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp +++ b/Code/OysterGraphics/DllInterfaces/GFXAPI.cpp @@ -139,6 +139,7 @@ namespace Oyster m->Visible = true; m->Animation.AnimationPlaying = NULL; m->Tint = Math::Float3(1); + m->GlowTint = Math::Float3(1); m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN); Model::ModelInfo* mi = (Model::ModelInfo*)m->info; diff --git a/Code/OysterGraphics/Model/Model.h b/Code/OysterGraphics/Model/Model.h index b264cf50..5985dbcd 100644 --- a/Code/OysterGraphics/Model/Model.h +++ b/Code/OysterGraphics/Model/Model.h @@ -24,6 +24,7 @@ namespace Oyster ModelInfo* info; Oyster::Math::Float4x4 WorldMatrix; Oyster::Math::Float3 Tint; + Oyster::Math::Float3 GlowTint; bool Visible; AnimationData Animation; }; diff --git a/Code/OysterGraphics/Render/DefaultRenderer.cpp b/Code/OysterGraphics/Render/DefaultRenderer.cpp index 689c3abe..7d0d987b 100644 --- a/Code/OysterGraphics/Render/DefaultRenderer.cpp +++ b/Code/OysterGraphics/Render/DefaultRenderer.cpp @@ -136,8 +136,15 @@ namespace Oyster memcpy(data,&(pm),sizeof(pm)); Resources::Gather::ModelData.Unmap(); + Definitions::TintData td; + td.GlowTint = models[i].GlowTint; + td.Tint = models[i].Tint; + td.PAD = 0; + td.PAD2 = 0; + int s = sizeof(Definitions::TintData); + data = Render::Resources::Color.Map(); - memcpy(data,&models[i].Tint,sizeof(Math::Float3)); + memcpy(data,&td,sizeof(Definitions::TintData)); Render::Resources::Color.Unmap(); if(info->Material.size()) diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index 1de7d4ce..2e693472 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -123,7 +123,7 @@ namespace Oyster Gather::AnimationData.Init(desc); desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS; - desc.ElementSize = sizeof(Math::Float3); + desc.ElementSize = sizeof(Definitions::TintData); Color.Init(desc); desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; @@ -176,7 +176,7 @@ namespace Oyster sdesc.Filter = D3D11_FILTER_ANISOTROPIC; sdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; - sdesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + sdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.MipLODBias = 0; sdesc.MaxAnisotropy =4; sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; diff --git a/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl b/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl index d9545573..af095acf 100644 --- a/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Gather/GatherPixel.hlsl @@ -40,7 +40,10 @@ float3 perturb_normal( float3 N, float3 V, float2 texcoord ) PixelOut main(VertexOut input) { PixelOut output; - output.DiffuseGlow = Diffuse.Sample(S1, input.UV) * float4(Color, 1); + float4 DiffGlow = Diffuse.Sample(S1, input.UV); + float3 tint = Color*(1-DiffGlow) + GlowColor * DiffGlow; + tint = tint / 2; + output.DiffuseGlow = DiffGlow * float4(tint,1); //NORMALIZE float3x3 CoTangentFrame = cotangent_frame(input.normal, normalize(input.ViewPos), input.UV); diff --git a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli index 7584fcd3..75a297bb 100644 --- a/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli +++ b/Code/OysterGraphics/Shader/Passes/Gather/Header.hlsli @@ -42,4 +42,7 @@ cbuffer PerModel : register(b1) cbuffer Tint : register(b0) { float3 Color; + float PAD; + float3 GlowColor; + float PAD2; } \ No newline at end of file