public bool Check(OctreeSceneNode node) { return true; }
public bool Check(OctreeSceneNode node) { return(true); }
public override void PrepareVisibleObjects(ICamera camera, PassData batchHelper) { batchHelper.visibleObjects.FastClear(); Frustum frus = camera.Frustum; Vector3 camPos = camera.Position; // do a BFS pass here queue.Enqueue(octRootNode); while (queue.Count > 0) { OctreeSceneNode node = queue.Dequeue(); Vector3 dir; Vector3 center2; if (frus.IntersectsSphere(ref node.BoundingSphere.Center, node.BoundingSphere.Radius)) { for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { if (node[i, j, k] != null) { queue.Enqueue(node[i, j, k]); } } } } FastList <SceneObject> objs = node.AttchedObjects; for (int i = 0; i < objs.Count; i++) { SceneObject obj = objs.Elements[i]; dir = obj.BoundingSphere.Center; dir.Normalize(); Vector3.Multiply(ref dir, obj.BoundingSphere.Radius, out dir); Vector3.Subtract(ref obj.BoundingSphere.Center, ref dir, out center2); Vector3.Subtract(ref center2, ref camPos, out dir); if (Vector3.Dot(ref dir, ref center2) <= 0) { int level = GetLevel(ref obj.BoundingSphere, ref camPos); if (obj.HasSubObjects) { obj.PrepareVisibleObjects(camera, level); } AddVisibleObject(obj, level, batchHelper); } } } } for (int i = 0; i < farObjects.Count; i++) { int level = GetLevel(ref farObjects[i].BoundingSphere, ref camPos); AddVisibleObject(farObjects[i], level, batchHelper); } }