Пример #1
0
    void DiCullNode::ProcessBatchGroup( DiCamera* camera,DiRenderPipeline* pipeline, 
        bool onlyShadowCaster, DiVisibleObjectsBoundsInfo* visbleBounds)
    {
        auto mit = mObjectsByName.begin();
        while ( mit != mObjectsByName.end() )
        {
            DiTransUnitPtr mo = mit->second;

            if (mo->GetVisible())
            {
                DiRenderBatchGroup* gp = pipeline->GetBatchGroup(mo->GetBatchGroup());
                bool receiveShadows = gp->GetShadowEnable();

                if (!onlyShadowCaster || mo->GetShadowCastEnable())
                {
                    mo->NotifyCurrentCamera(camera);
                    mo->CullingUpdate(gp,camera);
                    if (visbleBounds)
                    {
                        visbleBounds->Merge(mo->GetWorldBoundingBox(true), 
                            mo->GetWorldBoundingSphere(this, true), camera, 
                            receiveShadows);
                    }
                }
                else if (onlyShadowCaster && !mo->GetShadowCastEnable() && 
                    receiveShadows)
                {
                    visbleBounds->MergeNonRenderedButInFrustum(mo->GetWorldBoundingBox(true), 
                        mo->GetWorldBoundingSphere(true), camera);
                }
            }
            ++mit;
        }
    }
Пример #2
0
 void DiCullNode::ProcessVisibleObjects(std::function<void(DiTransUnitPtr)> func)
 {
     auto mit = mObjectsByName.begin();
     while (mit != mObjectsByName.end())
     {
         DiTransUnitPtr mo = mit->second;
         if (mo->GetVisible())
             func(mo);
         ++mit;
     }
 }