本文整理汇总了C++中CCopyEntity::GetWorldPose方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopyEntity::GetWorldPose方法的具体用法?C++ CCopyEntity::GetWorldPose怎么用?C++ CCopyEntity::GetWorldPose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopyEntity
的用法示例。
在下文中一共展示了CCopyEntity::GetWorldPose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateListener
void CStage::UpdateListener()
{
Matrix34 cam_pose;
Camera *pCamera;
// get the pose of the current camera
pCamera = this->GetCurrentCamera();
if( pCamera )
{
pCamera->GetPose( cam_pose );
}
else
{
CCopyEntity* pEntity = this->GetEntitySet()->GetCameraEntity();
if( pEntity )
cam_pose = pEntity->GetWorldPose();
else
cam_pose.Identity();
}
// update listener for sound manager
GetSoundManager().SetListenerPose( cam_pose );
CCopyEntity *pCameraEntity = this->GetEntitySet()->GetCameraEntity();
if( pCameraEntity )
GetSoundManager().SetListenerVelocity( pCameraEntity->Velocity() );
GetSoundManager().CommitDeferredSettings();
}
示例2: UpdateEntityForRendering
/// Update shader params loaders for the entity.
/// Shader params loaders are shared by entities, and need to be updated every time an entity is rendered.
void UpdateEntityForRendering( CCopyEntity& entity )
{
BaseEntity& base_entity = *(entity.pBaseEntity);
// light params writer
if( entity.GetEntityFlags() & BETYPE_LIGHTING )
{
UpdateLightInfo( entity );
if( base_entity.MeshProperty().m_pShaderLightParamsLoader )
{
// Set the entity to the light params loader, because a single light params loader
// is shared by all the entities of this base entity.
base_entity.MeshProperty().m_pShaderLightParamsLoader->SetEntity( entity.Self().lock() );
}
}
const float offset_world_transform_threshold = 150000.0f;
if( square(offset_world_transform_threshold) < Vec3LengthSq(entity.GetWorldPose().vPosition) )
{
Camera* pCam = entity.GetStage()->GetCurrentCamera();
if( pCam )
{
sg_pWorldTransLoader->SetActive( true );
sg_pWorldTransLoader->SetCameraPosition( pCam->GetPosition() );
}
else
sg_pWorldTransLoader->SetActive( false );
}
else
sg_pWorldTransLoader->SetActive( false );
}
示例3: Update
void AlphaEntity::Update( float dt )
{
CCopyEntity *pParent = m_pParent;
if( !pParent )
return;
SetWorldPose( pParent->GetWorldPose() );
}
示例4: RenderEntity
void BaseEntity::RenderEntity( CCopyEntity& entity )
{
UpdateEntityForRendering( entity );
// default render states for fixed function pipeline
// default alpha-blending settings (premultiplied alpha)
GraphicsDevice().Enable( RenderStateType::ALPHA_BLEND );
GraphicsDevice().SetSourceBlendMode( AlphaBlend::One );
GraphicsDevice().SetDestBlendMode( AlphaBlend::InvSrcAlpha );
if( entity.m_pMeshRenderMethod )
{
entity.m_pMeshRenderMethod->RenderMesh( entity.m_MeshHandle, entity.GetWorldPose() );
}
else if( m_MeshProperty.m_pMeshRenderMethod )
{
m_MeshProperty.m_pMeshRenderMethod->RenderMesh( entity.m_MeshHandle, entity.GetWorldPose() );
}
// entity.m_pMeshRenderMethod->RenderMeshContainerNode( *(entity.m_pMeshNode.get()), m_vecpShaderParamsWriterBuffer );
}
示例5: InitEntity
void EntityManager::InitEntity( boost::shared_ptr<CCopyEntity> pNewCopyEntPtr,
CCopyEntity *pParent,
BaseEntity *pBaseEntity,
CActorDesc* pPhysActorDesc )
{
CCopyEntity* pNewCopyEnt = pNewCopyEntPtr.get();
// Mark the entity as in use
pNewCopyEnt->inuse = true;
pNewCopyEnt->m_pSelf = pNewCopyEntPtr;
pNewCopyEnt->pBaseEntity = pBaseEntity;
BaseEntity& rBaseEntity = (*pBaseEntity);
pNewCopyEnt->m_pStage = m_pStage;
// set id and increment the counter
pNewCopyEnt->m_ID = m_EntityIDConter++;
// z-sort is disabled by default initialization
// Entities that have translucent polygons have to turn on their copy entities'
// 'BETYPE_USE_ZSORT' in InitCopyEntity()
if( pNewCopyEnt->m_TypeID == CCopyEntityTypeID::ALPHA_ENTITY )
{
// For alpha entity, always use the z-sorting
pNewCopyEnt->RaiseEntityFlags( BETYPE_USE_ZSORT );
}
else
{
// Otherwise, disable z-sorting by default
pNewCopyEnt->ClearEntityFlags( BETYPE_USE_ZSORT );
}
// set the glare type
if( rBaseEntity.m_EntityFlag & BETYPE_GLARESOURCE )
{
pNewCopyEnt->RaiseEntityFlags( BETYPE_GLARESOURCE );
}
else if( rBaseEntity.m_EntityFlag & BETYPE_GLAREHINDER )
{
pNewCopyEnt->RaiseEntityFlags( BETYPE_GLAREHINDER );
}
// update world aabb
pNewCopyEnt->world_aabb.TransformCoord( pNewCopyEnt->local_aabb, pNewCopyEnt->GetWorldPosition() );
// link the new copy-entity to the top of 'm_pEntityInUse'
if( m_pEntityInUse )
pNewCopyEnt->SetNext( m_pEntityInUse );
else
pNewCopyEnt->SetNextToNull(); // first entity in the link list
m_pEntityInUse = pNewCopyEntPtr;
// set the created time of the entity
pNewCopyEnt->m_CreatedTime = m_pStage->GetElapsedTime();
// set parent entity
pNewCopyEnt->m_pParent = pParent;
if( pNewCopyEnt->m_pParent )
{
// 'pNewCopyEnt' is being created as a child of another copy entity
pNewCopyEnt->m_pParent->AddChild( pNewCopyEnt->m_pSelf ); // establish link from the parent to this entity
}
// LOG_PRINT( "linking a copy entity of " + rBaseEntity.GetNameString() + " to the tree" );
// link the new copy-entity to the entity-tree
Link( pNewCopyEnt );
// update light information
if( pNewCopyEnt->Lighting() )
{
pNewCopyEnt->ClearLights();
// UpdateLightInfo( pNewCopyEnt );
pNewCopyEnt->sState |= CESTATE_LIGHT_INFORMATION_INVALID;
}
// create object for physics simulation
if( pNewCopyEnt->GetEntityFlags() & BETYPE_RIGIDBODY )
{
CActor *pPhysActor = NULL;
if( pPhysActorDesc )
{
pPhysActorDesc->WorldPose = pNewCopyEnt->GetWorldPose();// * pNewCopyEnt->GetActorLocalPose();
pPhysActorDesc->BodyDesc.LinearVelocity = pNewCopyEnt->Velocity();
// each entity has its own actor desc
pPhysActor = m_pStage->GetPhysicsScene()->CreateActor( *pPhysActorDesc );
}
else if( pBaseEntity->GetPhysicsActorDesc().IsValid() )
{
// actor desc is defined by entity attributes
CActorDesc actor_desc = pBaseEntity->GetPhysicsActorDesc();
actor_desc.WorldPose = pNewCopyEnt->GetWorldPose();
actor_desc.BodyDesc.LinearVelocity = pNewCopyEnt->Velocity();
//.........这里部分代码省略.........