private List <RenderVertex> CreateVBOBack2Front() { List <RenderVertex> renderVertices = new List <RenderVertex>(); List <int> sortedPoints = BspTreeTools.GetBackToFront(rootNode, points, eye); foreach (int index in sortedPoints) { renderVertices.Add(new RenderVertex(points[index], new Vector3(0, 1, 0), Color4.Yellow)); } renderVertices.Add(new RenderVertex(eye, new Vector3(0, 1, 0), Color4.Yellow)); return(renderVertices); }
public BspScene() : base(100, Shader.ShaderMode.NO_LIGHTING, RenderMode.REGULAR) { Random random = new Random(); int numberOfPoints = 10; List <Vector3> points = new List <Vector3>(); List <int> pointIndices = new List <int>(); for (int i = 0; i < numberOfPoints; i++) { points.Add(new Vector3((float)(2 * random.NextDouble() - 1), (float)(2 * random.NextDouble() - 1), 0)); pointIndices.Add(i); } BspTreeNode rootNode = BspTreeTools.CreateBspTree(null, points, pointIndices); node = new BspNode(rootNode, points); GetRoot().AddChild(node); GetRoot().LightPosition = new Vector3(0, 0, 1); }