From f9f4d551237ff8deedc35dd75993dd94245e7f64 Mon Sep 17 00:00:00 2001 From: lanariel Date: Tue, 18 Feb 2014 12:02:48 +0100 Subject: [PATCH 1/3] Graphics fix --- .../GameClient/GameClientState/GameState.cpp | 16 ++++++++++++++++ Code/OysterGraphics/Render/Resources.cpp | 2 +- .../Shader/Passes/Blur/BlurHor.hlsl | 2 +- .../Shader/Passes/Blur/BlurVert.hlsl | 6 +++--- .../Shader/Passes/Post/PostPass.hlsl | 6 ++---- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index f590f366..ba9bf034 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -36,6 +36,8 @@ struct GameState::MyData bool key_Shoot; bool key_Jump; + bool key_Reload_Shaders; + C_Player player; Camera_FPS camera; @@ -236,6 +238,20 @@ void GameState::ReadKeyInput() else this->privData->key_strafeRight = false; + if( this->privData->input->IsKeyPressed(DIK_R) ) + { + if( !this->privData->key_Reload_Shaders ) + { + //this->privData->nwClient->Send( Protocol_PlayerMovementRight() ); +#ifdef _DEBUG + Graphics::API::ReloadShaders(); +#endif + this->privData->key_Reload_Shaders = true; + } + } + else + this->privData->key_Reload_Shaders = false; + //send delta mouse movement { diff --git a/Code/OysterGraphics/Render/Resources.cpp b/Code/OysterGraphics/Render/Resources.cpp index 82ace315..514960cf 100644 --- a/Code/OysterGraphics/Render/Resources.cpp +++ b/Code/OysterGraphics/Render/Resources.cpp @@ -160,7 +160,7 @@ namespace Oyster D3D11_RASTERIZER_DESC rdesc; rdesc.CullMode = D3D11_CULL_BACK; rdesc.FillMode = D3D11_FILL_SOLID; - rdesc.FrontCounterClockwise = false; + rdesc.FrontCounterClockwise = true; rdesc.DepthBias = 0; rdesc.DepthBiasClamp = 0; rdesc.DepthClipEnable = true; diff --git a/Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl b/Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl index aeb89bda..a6843985 100644 --- a/Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Blur/BlurHor.hlsl @@ -27,7 +27,7 @@ void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID blurCol +=Weights[i + blurRadius] * gCache[k]; } - outTex[ThreadID.xy + Start] = blurCol * BlurMask + inTex[ThreadID.xy + Start] * ( float4(1,1,1,1) - BlurMask); + outTex[min(ThreadID.xy + Start, Stop-1)] = blurCol * BlurMask + inTex[min(ThreadID.xy + Start, Stop-1)] * ( float4(1,1,1,1) - BlurMask); //outTex[ThreadID.xy + Start] = inTex[ThreadID.xy + Start]; } diff --git a/Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl b/Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl index 24f873db..2933283e 100644 --- a/Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Blur/BlurVert.hlsl @@ -11,10 +11,10 @@ void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID } if(gThreadID.y >= N-blurRadius) { - int y = min(ThreadID.y+blurRadius, Stop.y-1); + int y = min(ThreadID.y +blurRadius, Stop.y-1); gCache[gThreadID.y+2*blurRadius] = inTex[int2(ThreadID.x,y) + Start]; } - gCache[gThreadID.y+blurRadius] = inTex[min(ThreadID.xy + Start, Stop.xy-1)]; + gCache[gThreadID.y+blurRadius] = inTex[min(ThreadID.xy + Start, Stop-1)]; GroupMemoryBarrierWithGroupSync(); @@ -27,6 +27,6 @@ void main(int3 ThreadID : SV_DispatchThreadID, int3 gThreadID : SV_GroupThreadID blurCol +=Weights[i + blurRadius] * gCache[k]; } - outTex[ThreadID.xy + Start] = blurCol + inTex[ThreadID.xy + Start] * ( float4(1,1,1,1) - BlurMask);; + outTex[min(ThreadID.xy + Start, Stop-1)] = blurCol * BlurMask + inTex[min(ThreadID.xy + Start, Stop-1)] * ( float4(1,1,1,1) - BlurMask);; //outTex[ThreadID.xy + Start] = inTex[ThreadID.xy+ Start]; } \ No newline at end of file diff --git a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl index 346913d8..decf5526 100644 --- a/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/Passes/Post/PostPass.hlsl @@ -18,7 +18,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; + Glow = Glow; return Glow; } @@ -28,10 +28,7 @@ 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 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)]; float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)]; - - Glow = SuperSample(Glow,DTid); float4 GUI; uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); @@ -42,4 +39,5 @@ void main( uint3 DTid : SV_DispatchThreadID ) Output[DTid.xy] = float4((GUI.xyz * GUI.w) + PostLight, 1); //Output[DTid.xy] = float4(Ambient[DTid.xy/2 + uint2(0,Output.Length.y*0.5f)].xyz,1); + //Output[DTid.xy] = Ambient[DTid.xy]; } \ No newline at end of file From 2e75d168a105b5676c6ce3f7deaebb8258fd5e55 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 12:03:54 +0100 Subject: [PATCH 2/3] New Cameras V2 is quaternion based --- Code/Game/GameClient/GameClient.vcxproj | 4 + .../GameClientState/Camera_BasicV2.cpp | 117 +++++++++++ .../GameClientState/Camera_BasicV2.h | 42 ++++ .../GameClientState/Camera_FPSV2.cpp | 182 ++++++++++++++++++ .../GameClient/GameClientState/Camera_FPSV2.h | 62 ++++++ Code/Misc/OysterMath/Quaternion.h | 7 + 6 files changed, 414 insertions(+) create mode 100644 Code/Game/GameClient/GameClientState/Camera_BasicV2.cpp create mode 100644 Code/Game/GameClient/GameClientState/Camera_BasicV2.h create mode 100644 Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp create mode 100644 Code/Game/GameClient/GameClientState/Camera_FPSV2.h diff --git a/Code/Game/GameClient/GameClient.vcxproj b/Code/Game/GameClient/GameClient.vcxproj index 3daafff3..349a88ec 100644 --- a/Code/Game/GameClient/GameClient.vcxproj +++ b/Code/Game/GameClient/GameClient.vcxproj @@ -201,7 +201,9 @@ + + @@ -226,7 +228,9 @@ + + diff --git a/Code/Game/GameClient/GameClientState/Camera_BasicV2.cpp b/Code/Game/GameClient/GameClientState/Camera_BasicV2.cpp new file mode 100644 index 00000000..8454b3bd --- /dev/null +++ b/Code/Game/GameClient/GameClientState/Camera_BasicV2.cpp @@ -0,0 +1,117 @@ +#include "Camera_BasicV2.h" + +using namespace ::Oyster::Math3D; + +Camera_BasicV2::Camera_BasicV2() +{ + this->translation = Float3::null; + this->rotation = Quaternion::identity; + this->projection = Float4x4::identity; +} + +Camera_BasicV2::Camera_BasicV2( const Float3 &position, const Quaternion &rotation, const Float4x4 &projection ) +{ + this->translation = position; + this->rotation = rotation; + this->projection = projection; +} + +Camera_BasicV2::~Camera_BasicV2() {} + +Camera_BasicV2 & Camera_BasicV2::operator = ( const Camera_BasicV2 &camera ) +{ + this->translation = camera.translation; + this->rotation = camera.rotation; + this->projection = camera.projection; + return *this; +} + +void Camera_BasicV2::SetPosition( const Float3 &translation ) +{ + this->translation = translation; +} + +void Camera_BasicV2::SetRotation( const Quaternion &rotation ) +{ + this->rotation = rotation; +} + +void Camera_BasicV2::SetAngular( const Float3 &axis ) +{ + this->rotation = Rotation( axis ); +} + +void Camera_BasicV2::SetProjection( const Float4x4 &matrix ) +{ + this->projection = matrix; +} + +void Camera_BasicV2::SetOrthographicProjection( Float width, Float height, Float nearClip, Float farClip ) +{ + ProjectionMatrix_Orthographic( width, height, nearClip, farClip, this->projection ); +} + +void Camera_BasicV2::SetPerspectiveProjection( Float verticalFoV, Float aspectRatio, Float nearClip, Float farClip ) +{ + ProjectionMatrix_Perspective( verticalFoV, aspectRatio, nearClip, farClip, this->projection ); +} + +void Camera_BasicV2::Move( const Float3 &deltaPosition ) +{ + this->translation += deltaPosition; +} + +void Camera_BasicV2::Rotate( const Quaternion &deltaRotation ) +{ + this->rotation *= deltaRotation; +} + +void Camera_BasicV2::Rotate( const Float3 &deltaAngularAxis ) +{ + this->rotation *= Rotation( deltaAngularAxis ); +} + +const Float3 & Camera_BasicV2::GetPosition() const +{ + return this->translation; +} + +Float3 & Camera_BasicV2::GetAngularAxis( Float3 &targetMem ) const +{ + return targetMem = AngularAxis( this->rotation ); +} + +Float3 Camera_BasicV2::GetNormalOf( const Float3 &axis ) const +{ + return WorldAxisOf( this->rotation, axis ); +} + +const Quaternion & Camera_BasicV2::GetRotation() const +{ + return this->rotation; +} + +Float3x3 & Camera_BasicV2::GetRotationMatrix( Float3x3 &targetMem ) const +{ + return RotationMatrix( this->rotation, targetMem ); +} + +Float4x4 & Camera_BasicV2::GetRotationMatrix( Float4x4 &targetMem ) const +{ + return RotationMatrix( this->rotation, targetMem ); +} + +Float4x4 & Camera_BasicV2::GetViewMatrix( Float4x4 &targetMem ) const +{ + return ViewMatrix( this->rotation, this->translation, targetMem ); +} + +const Float4x4 & Camera_BasicV2::GetProjectionMatrix() const +{ + return this->projection; +} + +Float4x4 & Camera_BasicV2::GetViewsProjMatrix( Float4x4 &targetMem ) const +{ + return TransformMatrix( this->projection, this->GetViewMatrix(), targetMem ); +} \ No newline at end of file diff --git a/Code/Game/GameClient/GameClientState/Camera_BasicV2.h b/Code/Game/GameClient/GameClientState/Camera_BasicV2.h new file mode 100644 index 00000000..aaa9d491 --- /dev/null +++ b/Code/Game/GameClient/GameClientState/Camera_BasicV2.h @@ -0,0 +1,42 @@ +#ifndef CAMERA_BASIC_V2_H +#define CAMERA_BASIC_V2_H + +#include "OysterMath.h" + +class Camera_BasicV2 +{ +public: + Camera_BasicV2(); + Camera_BasicV2( const ::Oyster::Math::Float3 &position, const ::Oyster::Math::Quaternion &rotation, const ::Oyster::Math::Float4x4 &projection ); + virtual ~Camera_BasicV2(); + + Camera_BasicV2 & operator = ( const Camera_BasicV2 &camera ); + + void SetPosition( const ::Oyster::Math::Float3 &translation ); + void SetRotation( const ::Oyster::Math::Quaternion &rotation ); + void SetAngular( const ::Oyster::Math::Float3 &axis ); + void SetProjection( const ::Oyster::Math::Float4x4 &matrix ); + void SetOrthographicProjection( ::Oyster::Math::Float width, ::Oyster::Math::Float height, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip ); + void SetPerspectiveProjection( ::Oyster::Math::Float verticalFoV, ::Oyster::Math::Float aspectRatio, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip ); + + void Move( const ::Oyster::Math::Float3 &deltaPosition ); + void Rotate( const ::Oyster::Math::Quaternion &deltaRotation ); + void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis ); + + const ::Oyster::Math::Float3 & GetPosition() const; + ::Oyster::Math::Float3 & GetAngularAxis( ::Oyster::Math::Float3 &targetMem = ::Oyster::Math::Float3() ) const; + ::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const; + const ::Oyster::Math::Quaternion & GetRotation() const; + ::Oyster::Math::Float3x3 & GetRotationMatrix( ::Oyster::Math::Float3x3 &targetMem ) const; + ::Oyster::Math::Float4x4 & GetRotationMatrix( ::Oyster::Math::Float4x4 &targetMem ) const; + ::Oyster::Math::Float4x4 & GetViewMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const; + const ::Oyster::Math::Float4x4 & GetProjectionMatrix() const; + ::Oyster::Math::Float4x4 & GetViewsProjMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const; + + private: + ::Oyster::Math::Float3 translation; + mutable ::Oyster::Math::Quaternion rotation; + ::Oyster::Math::Float4x4 projection; +}; + +#endif \ No newline at end of file diff --git a/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp b/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp new file mode 100644 index 00000000..b1863242 --- /dev/null +++ b/Code/Game/GameClient/GameClientState/Camera_FPSV2.cpp @@ -0,0 +1,182 @@ +#include "Camera_FPSV2.h" +#include "Utilities.h" + +using namespace ::Oyster::Math3D; +using namespace ::Utility::Value; + +Camera_FPSV2::Camera_FPSV2() +{ // this->head is default set to identity uniformprojection at origo + this->pitchUp = 0.0f; + this->headOffset = + this->body.translation = Float3::null; + this->body.rotation = Quaternion::identity; +} + +Camera_FPSV2::~Camera_FPSV2() {} + +Camera_FPSV2 & Camera_FPSV2::operator = ( const Camera_FPSV2 &camera ) +{ + this->head = camera.head; + this->pitchUp = camera.pitchUp; + this->headOffset = camera.headOffset; + this->body.translation = camera.body.translation; + this->body.rotation = camera.body.rotation; + return *this; +} + +void Camera_FPSV2::SetHeadOffset( const Float3 &translation ) +{ + this->head.Move( translation - this->headOffset ); + this->headOffset = translation; +} + +void Camera_FPSV2::SetPosition( const Float3 &translation ) +{ + this->head.Move( translation - this->body.translation ); + this->body.translation = translation; +} + +void Camera_FPSV2::SetAngular( const Float3 &axis ) +{ + this->body.rotation = Rotation( axis ); + this->head.SetRotation( this->body.rotation ); + this->pitchUp = 0.0f; +} + +void Camera_FPSV2::SetProjection( const Float4x4 &matrix ) +{ + this->head.SetProjection( matrix ); +} + +void Camera_FPSV2::SetOrthographicProjection( Float width, Float height, Float nearClip, Float farClip ) +{ + this->head.SetOrthographicProjection( width, height, nearClip, farClip ); +} + +void Camera_FPSV2::SetPerspectiveProjection( Float verticalFoV, Float aspectRatio, Float nearClip, Float farClip ) +{ + this->head.SetPerspectiveProjection( verticalFoV, aspectRatio, nearClip, farClip ); +} + +void Camera_FPSV2::UpdateOrientation() +{ + Float4x4 orientation; + OrientationMatrix( this->body.rotation, this->body.translation, orientation ); + + this->head.SetPosition( (orientation * Float4(this->headOffset, 1.0f)).xyz ); +} + +void Camera_FPSV2::SnapUpToNormal( const Float3 &normal ) +{ + this->body.rotation = Rotation( SnapAngularAxis(AngularAxis(this->body.rotation), WorldAxisOf(this->body.rotation, Float3::standard_unit_y), normal) ); + this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp * Float3::standard_unit_x) ); +} + +void Camera_FPSV2::Move( const Float3 &deltaPosition ) +{ + this->head.Move( deltaPosition ); + this->body.translation += deltaPosition; +} + +void Camera_FPSV2::Rotate( const Quaternion &deltaRotation ) +{ + this->head.Rotate( deltaRotation ); + this->body.rotation *= deltaRotation; +} + +void Camera_FPSV2::Rotate( const Float3 &deltaAngularAxis ) +{ + this->Rotate( Rotation(deltaAngularAxis) ); +} + +void Camera_FPSV2::MoveForward( Float distance ) +{ + this->MoveBackward( -distance ); +} + +void Camera_FPSV2::MoveBackward( Float distance ) +{ + this->Move( distance * WorldAxisOf(this->body.rotation, Float3::standard_unit_z) ); +} + +void Camera_FPSV2::StrafeRight( Float distance ) +{ + this->Move( distance * WorldAxisOf(this->body.rotation, Float3::standard_unit_x) ); +} + +void Camera_FPSV2::StrafeLeft( Float distance ) +{ + this->StrafeRight( -distance ); +} + +void Camera_FPSV2::PitchUp( Float radian ) +{ + this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi ); + this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp, Float3::standard_unit_x) ); +} + +void Camera_FPSV2::PitchDown( Float radian ) +{ + this->PitchUp( -radian ); +} + +void Camera_FPSV2::YawRight( Float radian ) +{ + this->YawLeft( -radian ); +} + +void Camera_FPSV2::YawLeft( Float radian ) +{ + Quaternion deltaRotation = Rotation( radian, WorldAxisOf(this->body.rotation, Float3::standard_unit_y) ); + this->Rotate( deltaRotation ); +} + +const Float3 & Camera_FPSV2::GetHeadOffset() const +{ + return this->headOffset; +} + +const Float3 & Camera_FPSV2::GetPosition() const +{ + return this->body.translation; +} + +Float4x4 & Camera_FPSV2::GetViewMatrix( Float4x4 &targetMem ) const +{ + return this->head.GetViewMatrix( targetMem ); +} + +const Float4x4 & Camera_FPSV2::GetProjectionMatrix() const +{ + return this->head.GetProjectionMatrix(); +} + +Float4x4 & Camera_FPSV2::GetViewsProjMatrix( Float4x4 &targetMem ) const +{ + return this->head.GetViewsProjMatrix( targetMem ); +} + +Float3 Camera_FPSV2::GetNormalOf( const Float3 &axis ) const +{ + return this->head.GetNormalOf( axis ); +} + +Float3 Camera_FPSV2::GetRight() const +{ + return WorldAxisOf( this->body.rotation, Float3::standard_unit_x ); +} + +Float3 Camera_FPSV2::GetUp() const +{ + return WorldAxisOf( this->body.rotation, Float3::standard_unit_y ); +} + +Float3 Camera_FPSV2::GetLook() const +{ + return this->head.GetNormalOf( -Float3::standard_unit_z ); +} + +Float3 Camera_FPSV2::GetForward() const +{ + return WorldAxisOf( this->body.rotation, -Float3::standard_unit_z ); +} \ No newline at end of file diff --git a/Code/Game/GameClient/GameClientState/Camera_FPSV2.h b/Code/Game/GameClient/GameClientState/Camera_FPSV2.h new file mode 100644 index 00000000..968053c7 --- /dev/null +++ b/Code/Game/GameClient/GameClientState/Camera_FPSV2.h @@ -0,0 +1,62 @@ +#ifndef CAMERA_FPSV2_H +#define CAMERA_FPSV2_H + +#include "OysterMath.h" +#include "Camera_BasicV2.h" + +class Camera_FPSV2 +{ +public: + Camera_FPSV2(); + virtual ~Camera_FPSV2(); + + Camera_FPSV2 & operator = ( const Camera_FPSV2 &camera ); + + void SetHeadOffset( const ::Oyster::Math::Float3 &translation ); + void SetPosition( const ::Oyster::Math::Float3 &translation ); + void SetAngular( const ::Oyster::Math::Float3 &axis ); + void SetProjection( const ::Oyster::Math::Float4x4 &matrix ); + void SetOrthographicProjection( ::Oyster::Math::Float width, ::Oyster::Math::Float height, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip ); + void SetPerspectiveProjection( ::Oyster::Math::Float verticalFoV, ::Oyster::Math::Float aspectRatio, ::Oyster::Math::Float nearClip, ::Oyster::Math::Float farClip ); + + void UpdateOrientation(); + + void SnapUpToNormal( const ::Oyster::Math::Float3 &normal ); + + void Move( const ::Oyster::Math::Float3 &deltaPosition ); + void Rotate( const ::Oyster::Math::Quaternion &deltaRotation ); + void Rotate( const ::Oyster::Math::Float3 &deltaAngularAxis ); + + void MoveForward( ::Oyster::Math::Float distance ); + void MoveBackward( ::Oyster::Math::Float distance ); + void StrafeRight( ::Oyster::Math::Float distance ); + void StrafeLeft( ::Oyster::Math::Float distance ); + + void PitchUp( ::Oyster::Math::Float radian ); + void PitchDown( ::Oyster::Math::Float radian ); + void YawRight( ::Oyster::Math::Float radian ); + void YawLeft( ::Oyster::Math::Float radian ); + + const ::Oyster::Math::Float3 & GetHeadOffset() const; + const ::Oyster::Math::Float3 & GetPosition() const; + ::Oyster::Math::Float4x4 & GetViewMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const; + const ::Oyster::Math::Float4x4 & GetProjectionMatrix() const; + ::Oyster::Math::Float4x4 & GetViewsProjMatrix( Oyster::Math::Float4x4 &targetMem = ::Oyster::Math::Float4x4() ) const; + ::Oyster::Math::Float3 GetNormalOf( const ::Oyster::Math::Float3 &axis ) const; + ::Oyster::Math::Float3 GetRight() const; + ::Oyster::Math::Float3 GetUp() const; + ::Oyster::Math::Float3 GetLook() const; + ::Oyster::Math::Float3 GetForward() const; + +private: + Camera_BasicV2 head; + ::Oyster::Math::Float pitchUp; + ::Oyster::Math::Float3 headOffset; + struct + { + ::Oyster::Math::Float3 translation; + ::Oyster::Math::Quaternion rotation; + } body; +}; + +#endif \ No newline at end of file diff --git a/Code/Misc/OysterMath/Quaternion.h b/Code/Misc/OysterMath/Quaternion.h index da790f75..f5ea5951 100644 --- a/Code/Misc/OysterMath/Quaternion.h +++ b/Code/Misc/OysterMath/Quaternion.h @@ -36,6 +36,7 @@ namespace LinearAlgebra const ScalarType & operator [] ( int i ) const; Quaternion & operator = ( const Quaternion &quaternion ); + Quaternion & operator *= ( const Quaternion &quaternion ); Quaternion & operator *= ( const ScalarType &scalar ); Quaternion & operator /= ( const ScalarType &scalar ); Quaternion & operator += ( const Quaternion &quaternion ); @@ -112,6 +113,12 @@ namespace LinearAlgebra return *this; } + template + Quaternion & Quaternion::operator *= ( const Quaternion &quaternion ) + { + return *this = *this * quaternion; + } + template Quaternion & Quaternion::operator *= ( const ScalarType &scalar ) { From 500ac117a7429e64e17a7335c250daa3d7f936f2 Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 18 Feb 2014 12:59:51 +0100 Subject: [PATCH 3/3] removed debug lines --- Code/Game/GameClient/GameClientState/GameState.cpp | 8 ++------ Code/Game/GameClient/GameClientState/NetLoadState.cpp | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 910afeb9..7118191e 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -85,11 +85,7 @@ bool GameState::Init( SharedStateContent &shared ) Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); //tell server ready - //this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); - - // Debugg hack - this->InitiatePlayer( 0, "crate_generic.dan",Float3( 0,132, 10), Quaternion::identity, Float3(1), true ); - // end debug hack + this->privData->nwClient->Send( Protocol_General_Status(Protocol_General_Status::States_ready) ); return true; } @@ -111,7 +107,7 @@ 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.5f; // debug hack +0.5f + offset.y = this->privData->player.getScale().y * 0.9f; this->privData->camera.SetHeadOffset( offset ); this->privData->camera.UpdateOrientation(); } diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index 7443344e..f50db40c 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -54,11 +54,8 @@ bool NetLoadState::Init( SharedStateContent &shared ) // we may assume that nwClient is properly connected to the server // signals querry to server for loading instructions - //this->privData->nwClient->Send( Protocol_QuerryGameType() ); + this->privData->nwClient->Send( Protocol_QuerryGameType() ); - // debugg - this->LoadGame( "..//Content//Worlds//2ofAll_updated.bias"); - this->ChangeState( ClientState_Game ); return true; }