本文整理汇总了C++中Sprite::GetWorldBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::GetWorldBounds方法的具体用法?C++ Sprite::GetWorldBounds怎么用?C++ Sprite::GetWorldBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite::GetWorldBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateRenderables
void SceneManager::UpdateRenderables( tRendererType *renderer )
{
MathLib::Rectanglef rcViewport;
rcViewport.min_vert = m_rcViewport.min_vert / m_fScale;
rcViewport.max_vert = m_rcViewport.max_vert / m_fScale;
unsigned int priority = 0;
RenderDeviceCapability &cap = RenderDeviceCapability::GetInstance();
for( SceneLayerPtrVector::iterator it = m_vLayers.begin() ; it != m_vLayers.end() ; ++it )
{
SceneLayer *pLayer = *it;
assert( pLayer );
if( pLayer->isStatic && !pLayer->lstRenderables.empty() )
continue;
SpriteRenderGroupContainer &container = pLayer->lstRenderables;
SpritePtrListType &lstSprites = pLayer->lstSprites;
const MathLib::Vector2f& distance = pLayer->distance;
for( SpritePtrListType::iterator it0 = lstSprites.begin() ; it0 != lstSprites.end() ; ++it0 )
{
Sprite *obj = *it0;
assert( obj );
if( obj->GetCurTexture() == NULL )
continue;
MathLib::Vector2f offset( (1.0f - distance.x())*rcViewport.left() , (1.0f - distance.y())*rcViewport.top() );
MathLib::Rectanglef rc = obj->GetWorldBounds();
rc.move( offset.x() , offset.y() );
if( obj->IsVisible() && MathLib::intersect<float>( rc , rcViewport ) )
{
SpriteRenderGroup *group = NULL;
RenderGroupKeyType key = RenderGroupKeyType( obj->GetCurTexture() , obj->GetBlendMode() );
SpriteRenderGroupContainer::iterator itRenderable = container.find( key );
if( itRenderable == container.end() )
{
// init new renderable
group = new SpriteRenderGroup;
group->Create( obj->GetCurTexture() , obj->GetBlendMode() , cap.IsSupportVAO() );
renderer->SetupVAO( group );
group->SwapVAO();
renderer->SetupVAO( group );
group->SetPriority( priority );
container.insert( SpriteRenderGroupContainer::value_type( key , group ) );
}
else
group = itRenderable->second;
if( group )
group->PushSprite( obj , offset.x() , offset.y() );
else
assert(0);
}
// else
// I3DKIT2_LOG(@"obj invisible--");
}
for( SpriteRenderGroupContainer::iterator it0 = container.begin() ; it0 != container.end() ; ++it0 )
{
SpriteRenderGroup *obj = it0->second;
assert(obj);
// I3DKIT2_LOG(@"objects count in layer %d = %d",priority,obj->GetSpritesCount());
obj->ComplileRenderable();
}
++priority;
}
}