/** * Adds/Removes Nodes based on LOD Setting **/ private void CalculateActiveNodes() { if (FileManager.MasteryFile == null) { //clear all nodes RenderNodeLayers.Clear(); ChunkLODStates.Clear(); } else if (ChunkLODStates.Count > 0) { int LayerCount = Settings.LOD.Length; if (LayerCount > RenderNodeLayers.Count) { //add nodes for (int i = 0; i < LayerCount; i++) { bool HasLayer = false; for (int j = 0; j < RenderNodeLayers.Count; j++) { int LayerLOD = Int32.Parse(RenderNodeLayers[j].Name.Replace("Layer:", "")); if (i == LayerLOD) { HasLayer = true; break; } } if (!HasLayer) { Node3D NewNode = new Node3D("Layer:" + i); RenderNode.Attach(NewNode); RenderNodeLayers.Add(NewNode); } } } else if (LayerCount < RenderNodeLayers.Count) { //remove nodes for (int i = 0; i < RenderNodeLayers.Count; i++) { int LayerLOD = Int32.Parse(RenderNodeLayers[i].Name.Replace("Layer:", "")); if (LayerLOD > LayerCount) { RenderNodeLayers.RemoveAt(i); } } } } }
public MasterFileRenderManager(WorldFileManager WorldFileManager, RenderManager RenderManager, CameraManager CameraManager) { Render = RenderManager; FileManager = WorldFileManager; RenderNode = Render.RootNode; Camera = CameraManager; ReflectionNode = new Node3D("WorldReflection"); RefractionNode = new Node3D("WorldRefraction"); PropNode = new Node3D("PropNode"); SkyBox = new SkyBoxModel(Render, 1000, "SkyBox"); RenderNode.Attach(SkyBox.Geom); ReflectionNode.Attach(SkyBox.Geom); }