本文整理汇总了C++中TransformComponent::GetLocalTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::GetLocalTransform方法的具体用法?C++ TransformComponent::GetLocalTransform怎么用?C++ TransformComponent::GetLocalTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::GetLocalTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MergeSwitch
bool SwitchToRenerObjectConverter::MergeSwitch(Entity * entity)
{
Vector<Entity*> entitiesToRemove;
SwitchComponent * sw = GetSwitchComponent(entity);
if(sw)
{
RenderComponent * rc = GetRenderComponent(entity);
RenderObject * ro = 0;
if(!rc)
{
ro = new Mesh();
rc = new RenderComponent(ro);
ro->Release();
ro->SetAABBox(AABBox3(Vector3(0, 0, 0), Vector3(0, 0, 0)));
entity->AddComponent(rc);
}
else
{
ro = rc->GetRenderObject();
}
DVASSERT(ro);
int32 size = entity->GetChildrenCount();
for(int32 i = 0; i < size; ++i)
{
Entity * sourceEntity = entity->GetChild(i);
RenderObject * sourceRenderObject = GetRenderObject(sourceEntity);
//workaround for custom properties for crashed model
if(1 == i) // crash model
{
KeyedArchive *childProps = GetCustomPropertiesArchieve(sourceEntity);
if(childProps && childProps->IsKeyExists("CollisionType"))
{
KeyedArchive *entityProps = GetOrCreateCustomProperties(entity)->GetArchive();
entityProps->SetInt32("CollisionTypeCrashed", childProps->GetInt32("CollisionType", 0));
}
}
//end of custom properties
Vector<std::pair<Entity*, RenderObject*> > renderPairs;
if(sourceRenderObject)
{
renderPairs.push_back(std::make_pair(sourceEntity, sourceRenderObject));
}
else
{
FindRenderObjectsRecursive(sourceEntity, renderPairs);
DVASSERT(renderPairs.size() == 1);
sourceRenderObject = renderPairs[0].second;
}
if(sourceRenderObject)
{
TransformComponent * sourceTransform = GetTransformComponent(sourceEntity);
if (sourceTransform->GetLocalTransform() != Matrix4::IDENTITY)
{
PolygonGroup * pg = sourceRenderObject->GetRenderBatchCount() > 0 ? sourceRenderObject->GetRenderBatch(0)->GetPolygonGroup() : 0;
if(pg && bakedPolygonGroups.end() == bakedPolygonGroups.find(pg))
{
sourceRenderObject->BakeGeometry(sourceTransform->GetLocalTransform());
bakedPolygonGroups.insert(pg);
}
}
uint32 sourceSize = sourceRenderObject->GetRenderBatchCount();
while(sourceSize)
{
int32 lodIndex, switchIndex;
RenderBatch * sourceRenderBatch = sourceRenderObject->GetRenderBatch(0, lodIndex, switchIndex);
sourceRenderBatch->Retain();
sourceRenderObject->RemoveRenderBatch(sourceRenderBatch);
ro->AddRenderBatch(sourceRenderBatch, lodIndex, i);
sourceRenderBatch->Release();
sourceSize--;
}
}
renderPairs[0].first->RemoveComponent(Component::RENDER_COMPONENT);
LodComponent * lc = GetLodComponent(sourceEntity);
if((0 != lc) && (0 == GetLodComponent(entity)))
{
LodComponent * newLod = (LodComponent*)lc->Clone(entity);
entity->AddComponent(newLod);
}
renderPairs[0].first->RemoveComponent(Component::LOD_COMPONENT);
if(sourceEntity->GetChildrenCount() == 0)
{
entitiesToRemove.push_back(sourceEntity);
}
}
}
uint32 entitiesToRemoveCount = entitiesToRemove.size();
//.........这里部分代码省略.........