public static IndexedLineSet CreateFromVertexSet(List <Vertex> verticies) { IndexedLineSet ils; Coordinate coord; Vector3[] points; int[] indicies; int i; ils = new IndexedLineSet(); coord = new Coordinate(); points = verticies.Select(v => v.Position).ToArray(); i = -1; indicies = verticies.Select(v => ++ i).ToArray(); coord.point = X3DTypeConverters.ToString(points); ils.coordIndex = X3DTypeConverters.ToString(indicies); ils.Children.Add(coord); ils.PrimativeType = PrimitiveType.Lines; return(ils); }
private void RenderLines(RenderingContext rc) { if (_handle.NumVerticies3 > 0) { PrimitiveType prim; GL.UseProgram(CurrentShader.ShaderHandle); CurrentShader.SetFieldValue("lightingEnabled", 0); CurrentShader.SetFieldValue("headlightEnabled", 0); CurrentShader.SetFieldValue("size", size); CurrentShader.SetFieldValue("scale", scale); GL.LineWidth(8.0f); // todo: LineProperties prim = PrimitiveType.Lines; if (typeof(IndexedLineSet).IsInstanceOfType(geometry)) { IndexedLineSet ils = (IndexedLineSet)geometry; prim = ils.PrimativeType; } if (typeof(LineSet).IsInstanceOfType(geometry)) { LineSet ls = (LineSet)geometry; prim = ls.PrimativeType; } GL.BindBuffer(BufferTarget.ArrayBuffer, _handle.vbo3); Buffering.ApplyBufferPointers(CurrentShader); GL.DrawArrays(prim, 0, _handle.NumVerticies3); GL.UseProgram(0); GL.LineWidth(1.0f); } }