From c8c0bb9bc4c9a7976732286dfd75dbbe25539e2f Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 11:06:11 +0100 Subject: [PATCH 1/2] Clamp fixed --- Code/Misc/Utilities/Utilities.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Code/Misc/Utilities/Utilities.h b/Code/Misc/Utilities/Utilities.h index c259a845..b97d62d7 100644 --- a/Code/Misc/Utilities/Utilities.h +++ b/Code/Misc/Utilities/Utilities.h @@ -337,7 +337,11 @@ namespace Utility template inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max ) - { return value < min ? Max( value, max ) : min; } + { + if( value < min ) return min; + if( value > max ) return max; + return value; + } template inline ValueType Average( const ValueType &valueA, const ValueType &valueB ) From 0bd5d68da44d3b68ae3493b9dd1b129d46f3f6a8 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 11:12:47 +0100 Subject: [PATCH 2/2] Removed some debug lines --- Code/Game/GameClient/GameClientState/Camera_FPS.cpp | 3 +-- Code/Game/GameClient/GameClientState/GameState.cpp | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp index 56a026e3..8c87970b 100644 --- a/Code/Game/GameClient/GameClientState/Camera_FPS.cpp +++ b/Code/Game/GameClient/GameClientState/Camera_FPS.cpp @@ -112,8 +112,7 @@ void Camera_FPS::StrafeLeft( Float distance ) void Camera_FPS::PitchUp( Float radian ) { - //this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); - this->pitchUp = this->pitchUp + radian; // debug hack + this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); this->head.SetAngular( this->body.angularAxis + this->pitchUp * this->body.direction.v[0] ); } diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index f590f366..4a364ec7 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -87,12 +87,6 @@ bool GameState::Init( SharedStateContent &shared ) // Debugg hack this->InitiatePlayer( 0, "crate_generic.dan",Float3( 0,132, 10), Quaternion::identity, Float3(1), true ); - Graphics::Definitions::Pointlight light; - light.Pos = Float3( 0,132,0); - light.Color = Float3( 1.0f ); - light.Bright = 1.0f; - light.Radius = 1000.0f; - Graphics::API::AddLight( light ); // end debug hack return true;