示例#1
0
        //world grid management
        static private void addLightToGrid(lightInstance light)
        {
            LocalLight   l  = light.mSimEditorObject;
            BBoundingBox bb = new BBoundingBox();

            bb.addPoint(l.mAABB.min);
            bb.addPoint(l.mAABB.max);
            bb.min += l.getPosition();
            bb.max += l.getPosition();

            //walk every world chunk, update our bounds, do intersections
            BBoundingBox worldAABB = new BBoundingBox();

            for (int x = 0; x < mWorldChunks.GetLength(0); x++)
            {
                for (int y = 0; y < mWorldChunks.GetLength(1); y++)
                {
                    worldAABB.max   = mWorldChunks[x, y].mQNPointer.getDesc().m_maxPostDeform;
                    worldAABB.min   = mWorldChunks[x, y].mQNPointer.getDesc().m_minPostDeform;
                    worldAABB.max.Y = 300;
                    worldAABB.min.Y = -300;

                    if (bb.intersect(worldAABB))
                    {
                        mWorldChunks[x, y].mLightsAffectingMe.Add(light);
                        light.mWorldChunksImAffecting.Add(mWorldChunks[x, y]);
                    }
                }
            }
        }
示例#2
0
        static private void removeLightFromGrid(lightInstance light)
        {
            for (int i = 0; i < light.mWorldChunksImAffecting.Count; i++)
            {
                light.mWorldChunksImAffecting[i].mLightsAffectingMe.Remove(light);
            }

            light.mWorldChunksImAffecting.Clear();
        }