本文整理汇总了C++中MeshEntity::ResetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshEntity::ResetTransform方法的具体用法?C++ MeshEntity::ResetTransform怎么用?C++ MeshEntity::ResetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshEntity
的用法示例。
在下文中一共展示了MeshEntity::ResetTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateEntityPositionData
void OutdoorLevel::UpdateEntityPositionData(Entity *ent, const Matrix &transform)
{
BOOL isLight = ent->IsOf(GetClass(Light));
BOOL isMeshEnt = ent->IsOf(GetClass(MeshEntity));
OutdoorEntityData *entData = GetOutdoorEntityData(ent);
int i;
//-------------------------------------------------------------------------------
if(isMeshEnt)
{
MeshEntity *meshEnt = (MeshEntity*)ent;
meshEnt->ResetTransform();
}
Bounds entBounds = ent->GetBounds();
for(i=0; i<TerrainBlocks.Num(); i++)
{
TerrainBlock &block = TerrainBlocks[i];
if(block.bounds.Intersects(entBounds))
{
if(isLight)
{
Light *light = static_cast<Light*>(ent);
block.lights << light;
}
else
{
if(!isMeshEnt && ent->bRenderable)
{
block.visEntities << ent;
entData->VisBlocks << █
}
block.entities << ent;
}
entData->Blocks << █
}
if(isMeshEnt && ent->bRenderable)
{
MeshEntity *meshEnt = (MeshEntity*)ent;
meshEnt->ResetTransform();
if(block.bounds.IntersectsOBB(meshEnt->bounds, meshEnt->transform))
{
block.visMeshEntities << meshEnt;
entData->VisBlocks << █
}
}
}
//recalculate light visibility data
if(isLight)
{
Light *light = (Light*)ent;
if(!light->IsOff() && !(light->color&0xFFFFFF))
{
for(i=0; i<TerrainBlocks.Num(); i++)
{
TerrainBlock &block = TerrainBlocks[i];
if(light->IsOf(GetClass(SpotLight)))
{
SpotLight *spot = static_cast<SpotLight*>(light);
ViewClip clip;
Matrix rotMatrix = spot->GetEntityInvTransform();
clip.planes.Clear();
clip.SetPerspective(spot->cutoff+1.0f, 1.0f, 1.0, 4096.0f);
clip.Transform(rotMatrix.GetTranspose());
if(clip.BoundsVisible(block.bounds) && block.bounds.SphereIntersects(spot->GetWorldPos(), spot->lightRange))
{
entData->VisBlocks << █
block.visLights << light;
}
}
else if(light->IsOf(GetClass(DirectionalLight)))
{
entData->VisBlocks << █
block.visLights << light;
}
else
{
PointLight *point = static_cast<PointLight*>(light);
if(block.bounds.SphereIntersects(point->GetWorldPos(), point->lightRange))
{
entData->VisBlocks << █
block.visLights << light;
}
}
}
}
}
}