Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public static LineSet CreateFromVertexSet(List<Vertex> verticies, int vertexStride)
        {
            LineSet ils;
            Coordinate coord;
            Vector3[] points;
            int[] indicies;
            int i;

            ils = new LineSet();
            coord = new Coordinate();

            points = verticies.Select(v => v.Position).ToArray();

            i = -1;
            indicies = verticies.Select(v => ++i).ToArray();

            coord.point = X3DTypeConverters.ToString(points);

            ils.vertexCount = vertexStride;
            ils.Children.Add(coord);
            ils.PrimativeType = PrimitiveType.LineLoop;

            return ils;
        }