/// <summary> /// Renders a set of solid objects for the shadow receiver pass. /// Will only render /// </summary> /// <param name="list">List of solid objects.</param> protected virtual void RenderShadowReceiverObjects(SortedList list, bool doLightIteration, List <Light> manualLightList) { // compute sphere of area around camera that can receive shadows. Sphere shadowSphere = new Sphere(autoParamDataSource.CameraPosition, ShadowConfig.ShadowFarDistance); List <IRenderable> shadowList = new List <IRenderable>(); // ----- SOLIDS LOOP ----- // renderSolidObjectsMeter.Enter(); for (int i = 0; i < list.Count; i++) { RenderableList renderables = (RenderableList)list.GetByIndex(i); // bypass if this group is empty if (renderables.Count == 0) { continue; } Pass pass = (Pass)list.GetKey(i); // Give SM a chance to eliminate this pass if (!ValidatePassForRendering(pass)) { continue; } shadowList.Clear(); // special case for a single renderable using the material, so that we can // avoid calling SetPass() when there is only one renderable and it doesn't // need to be drawn. for (int r = 0; r < renderables.Count; r++) { bool drawObject = true; IRenderable renderable = (IRenderable)renderables[r]; MovableObject movableObject = renderable as MovableObject; if (movableObject != null) { // it is a movableObject, so we can if (!movableObject.GetWorldBoundingBox().Intersects(shadowSphere)) { // objects bounding box doesn't intercect the shadow sphere, so we don't // need to render it in this pass. drawObject = false; } } if (drawObject) { shadowList.Add(renderable); } } // if nobody is within shadow range, then we don't need to render, and skip the SetPass() if (shadowList.Count == 0) { continue; } // For solids, we try to do each pass in turn Pass usedPass = SetPass(pass); // render each object associated with this rendering pass foreach (IRenderable renderable in shadowList) { // Give SM a chance to eliminate if (!ValidateRenderableForRendering(usedPass, renderable)) { continue; } // Render a single object, this will set up auto params if required if (MeterManager.Collecting) { MeterManager.AddInfoEvent("RenderSingle shadow receiver material {0}, doLight {1}, lightCnt {2}", renderable.Material.Name, doLightIteration, (manualLightList != null ? manualLightList.Count : 0)); } try { RenderSingleObject(renderable, usedPass, doLightIteration, manualLightList); } catch (Exception e) { LogManager.Instance.WriteException("Invalid call to Axiom.Core.SceneManager.RenderSingleObject: {0}\n{1}", e.Message, e.StackTrace); if (renderable.Material != null) { LogManager.Instance.Write("Failed renderable material: {0}", renderable.Material.Name); } } } } // renderSolidObjectsMeter.Exit(); }