本文整理汇总了C++中Light::IsOf方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::IsOf方法的具体用法?C++ Light::IsOf怎么用?C++ Light::IsOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::IsOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
}
}
}
示例2: CalcRenderOrderRecurse
void OctLevel::CalcRenderOrderRecurse(const Vect &eye, const ViewClip &clip, MeshOrderInfo &meshOrder, OctNode *curNode, BOOL bFullyVisible)
{
OctNode *node = (curNode != NULL) ? curNode : objectTree->GetRoot();
DWORD i;
BOOL bCheckBounds = (node->numChildren > 1) || (node->Leaves.Num() > 0);
if(!bFullyVisible && bCheckBounds)
{
int testVal = clip.BoundsTest(node->bounds);
if(testVal == BOUNDS_INSIDE)
bFullyVisible = TRUE;
else if(testVal == BOUNDS_OUTSIDE)
return;
}
if(node->numChildren)
{
for(i=0; i<8; i++)
{
if(!node->children[i])
continue;
OctNode *child = node->children[i];
CalcRenderOrderRecurse(eye, clip, meshOrder, child, bFullyVisible);
}
}
for(i=0; i<node->Leaves.Num(); i++)
{
LevelObject *leaf = node->Leaves[i];
if(!bFullyVisible && !clip.BoundsVisible(leaf->bounds))
continue;
if(leaf->type == ObjectType_Entity)
{
if(leaf->ent->IsOf(GetClass(MeshEntity)))
{
MeshEntity *meshEnt = (MeshEntity*)leaf->ent;
if(meshEnt->bRenderable)
{
EntityVisible(meshEnt) = TRUE;
meshOrder.AddEntity(meshEnt);
}
}
else if(leaf->ent->IsOf(GetClass(Projector)))
{
Projector *projector = (Projector*)leaf->ent;
if(projector->bRenderable)
{
if(projector->IsOf(GetClass(LitDecal)))
renderLitDecals << (LitDecal*)projector;
else
renderProjectors << projector;
EntityVisible(projector) = TRUE;
}
}
else if(leaf->ent->IsOf(GetClass(Light)))
{
Light *light = (Light*)leaf->ent;
if(light->IsOf(GetClass(SpotLight)))
{
SpotLight *spotLight = (SpotLight*)light;
if(spotLight->IsLightmapped() && !spotLight->NumLitEntities())
continue;
renderSpotLights << spotLight;
}
else if(light->IsOf(GetClass(PointLight)))
{
PointLight *pointLight = (PointLight*)light;
if(pointLight->IsLightmapped() && !pointLight->NumLitEntities())
continue;
renderPointLights << pointLight;
}
}
else
{
Entity *ent = leaf->ent;
if(ent->bRenderable)
{
EntityVisible(ent) = TRUE;
renderEntities << ent;
}
}
}
else if(leaf->type == ObjectType_Brush)
{
Brush *brush = leaf->brush;
brush->bVisible = TRUE;
renderBrushes << brush;
}
}
}