示例#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::UpdateBounds()
    {
        mWorldAABB.SetNull();
        mLocalAABB.SetNull();

        ObjectMap::iterator itr;
        DiTransUnitPtr ret;
        for ( itr = mObjectsByName.begin(); itr != mObjectsByName.end(); ++itr )
        {
            ret = itr->second;
            mWorldAABB.Merge(ret->GetWorldBoundingBox(true));
            mLocalAABB.Merge( ret->GetBoundingBox() );
        }

        if (!mWorldAABB.IsNull())
            mCreator->UpdateOctreeNode( this );
    }