Merge branch 'GameClientGraphics' of https://github.com/dean11/Danbias into GameClientGraphics
This commit is contained in:
commit
a068ce7ddb
|
@ -9,6 +9,10 @@ C_Object::C_Object()
|
|||
|
||||
id = 0;
|
||||
model = NULL;
|
||||
|
||||
// RB DEBUG
|
||||
type = RB_Type_None;
|
||||
// !RB DEBUG
|
||||
}
|
||||
C_Object::~C_Object()
|
||||
{
|
||||
|
@ -104,6 +108,7 @@ bool C_Object::InitRB(RBInitData RBInit)
|
|||
RBposition = RBInit.position;
|
||||
RBrotation = RBInit.rotation;
|
||||
RBscale = RBInit.scale;
|
||||
type = RBInit.type;
|
||||
return true;
|
||||
}
|
||||
Oyster::Math::Float4x4 C_Object::getRBWorld() const
|
||||
|
@ -143,3 +148,4 @@ RB_Type C_Object::getBRtype()const
|
|||
{
|
||||
return this->type;
|
||||
}
|
||||
// !RB DEBUG
|
|
@ -5,11 +5,22 @@ namespace DanBias
|
|||
{
|
||||
namespace Client
|
||||
{
|
||||
// RB DEBUG
|
||||
enum RB_Type
|
||||
{
|
||||
RB_Type_Cube,
|
||||
RB_Type_Sphere
|
||||
RB_Type_Sphere,
|
||||
RB_Type_None,
|
||||
};
|
||||
struct RBInitData
|
||||
{
|
||||
Oyster::Math::Float3 position;
|
||||
Oyster::Math::Quaternion rotation;
|
||||
Oyster::Math::Float3 scale;
|
||||
RB_Type type;
|
||||
};
|
||||
// !RB DEBUG
|
||||
|
||||
struct ModelInitData
|
||||
{
|
||||
int id;
|
||||
|
@ -19,13 +30,6 @@ namespace DanBias
|
|||
Oyster::Math::Float3 scale;
|
||||
bool visible;
|
||||
};
|
||||
struct RBInitData
|
||||
{
|
||||
Oyster::Math::Float3 position;
|
||||
Oyster::Math::Quaternion rotation;
|
||||
Oyster::Math::Float3 scale;
|
||||
RB_Type type;
|
||||
};
|
||||
|
||||
class C_Object
|
||||
{
|
||||
|
@ -40,6 +44,7 @@ namespace DanBias
|
|||
Oyster::Math::Quaternion RBrotation;
|
||||
Oyster::Math::Float3 RBscale;
|
||||
RB_Type type;
|
||||
// !RB DEBUG
|
||||
|
||||
int id;
|
||||
|
||||
|
@ -71,6 +76,8 @@ namespace DanBias
|
|||
void setRBScale(Oyster::Math::Float3 newScale);
|
||||
Oyster::Math::Float3 getRBScale() const;
|
||||
RB_Type getBRtype()const;
|
||||
// !RB DEBUG
|
||||
|
||||
virtual void Render();
|
||||
virtual void Release();
|
||||
virtual int GetId() const;
|
||||
|
|
|
@ -81,7 +81,7 @@ bool GameState::Init( SharedStateContent &shared )
|
|||
|
||||
Graphics::API::Option gfxOp = Graphics::API::GetOption();
|
||||
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y;
|
||||
this->privData->camera.SetPerspectiveProjection( Math::pi/8, aspectRatio, 0.1f, 1000.0f );
|
||||
this->privData->camera.SetPerspectiveProjection( Math::pi/2, aspectRatio, 0.1f, 1000.0f );
|
||||
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
|
||||
|
||||
//tell server ready
|
||||
|
@ -109,6 +109,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
|
|||
RBData.position = position;
|
||||
RBData.rotation = ArrayToQuaternion( rotation );
|
||||
RBData.scale = Float3( 1 );
|
||||
// !RB DEBUG
|
||||
|
||||
if( isMyPlayer )
|
||||
{
|
||||
|
@ -116,6 +117,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
|
|||
{
|
||||
// RB DEBUG
|
||||
this->privData->player.InitRB( RBData );
|
||||
// !RB DEBUG
|
||||
|
||||
this->privData->myId = id;
|
||||
this->privData->camera.SetPosition( this->privData->player.getPos() );
|
||||
|
@ -132,6 +134,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
|
|||
{
|
||||
// RB DEBUG
|
||||
this->privData->player.InitRB( RBData );
|
||||
// !RB DEBUG
|
||||
|
||||
(*this->privData->dynamicObjects)[id] = p;
|
||||
}
|
||||
|
@ -168,14 +171,13 @@ bool GameState::Render()
|
|||
// RB DEBUG render wire frame
|
||||
Oyster::Graphics::API::StartRenderWireFrame();
|
||||
|
||||
|
||||
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(Float3( 0,132, 20));
|
||||
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(Float3( 0.5f, 0.5f, 0.5f));
|
||||
Oyster::Math3D::Float4x4 world = translation * scale;
|
||||
Oyster::Graphics::API::RenderDebugCube( world );
|
||||
Oyster::Graphics::API::RenderDebugCube(this->privData->player.getRBWorld());
|
||||
|
||||
|
||||
staticObject = this->privData->staticObjects->begin();
|
||||
for( ; staticObject != this->privData->staticObjects->end(); ++staticObject )
|
||||
{
|
||||
if( staticObject->second->getBRtype() == RB_Type_Cube)
|
||||
|
@ -188,7 +190,7 @@ bool GameState::Render()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
dynamicObject = this->privData->dynamicObjects->begin();
|
||||
for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
|
||||
{
|
||||
if( dynamicObject->second->getBRtype() == RB_Type_Cube)
|
||||
|
@ -200,6 +202,8 @@ bool GameState::Render()
|
|||
Oyster::Graphics::API::RenderDebugSphere( dynamicObject->second->getRBWorld());
|
||||
}
|
||||
}
|
||||
// !RB DEBUG
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size;
|
||||
RBData.type = RB_Type_Cube;
|
||||
staticObject->InitRB( RBData );
|
||||
}
|
||||
|
||||
|
@ -154,8 +155,10 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius;
|
||||
RBData.type = RB_Type_Sphere;
|
||||
staticObject->InitRB( RBData );
|
||||
}
|
||||
// !RB DEBUG
|
||||
|
||||
(*this->privData->staticObjects)[objectID] = staticObject;
|
||||
}
|
||||
|
@ -187,6 +190,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.box.position;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size;
|
||||
RBData.type = RB_Type_Cube;
|
||||
dynamicObject->InitRB( RBData );
|
||||
}
|
||||
|
||||
|
@ -195,8 +199,10 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
|
|||
RBData.position = (Float3)oh->position + (Float3)oh->boundingVolume.sphere.position;
|
||||
RBData.rotation = ArrayToQuaternion( oh->rotation ); // Only model rotation
|
||||
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius;
|
||||
RBData.type = RB_Type_Sphere;
|
||||
dynamicObject->InitRB( RBData );
|
||||
}
|
||||
// !RB DEBUG
|
||||
|
||||
(*this->privData->dynamicObjects)[objectID] = dynamicObject;
|
||||
}
|
||||
|
|
|
@ -206,6 +206,7 @@ namespace Oyster
|
|||
{
|
||||
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
|
||||
Core::deviceContext->RSSetState(wire);
|
||||
Core::deviceContext->OMSetRenderTargets(Render::Resources::Gather::Pass.RTV.size(),&Render::Resources::Gather::Pass.RTV[0],NULL);
|
||||
}
|
||||
|
||||
void API::RenderDebugCube(Math::Matrix world)
|
||||
|
|
Loading…
Reference in New Issue