Beispiel #1
0
        public AxisRenderer(float ConeScale = 1.0f)
        {
            List <Vector3> lines = new List <Vector3>();

            Vector3[] xCone = BuildConeX(new Vector3(4.0f, 0.0f, 0.0f), ConeScale, ConeScale / 3.0f, num_segments);
            Vector3[] yCone = BuildConeY(new Vector3(0.0f, 4.0f, 0.0f), ConeScale, ConeScale / 3.0f, num_segments);
            Vector3[] zCone = BuildConeZ(new Vector3(0.0f, 0.0f, 4.0f), ConeScale, ConeScale / 3.0f, num_segments);

            /*
             * xAxisBox = xCone.Item2;
             * Console.WriteLine(xCone.Item2);
             *
             * yAxisBox = yCone.Item2;
             * zAxisBox = zCone.Item2;
             */

            // x
            lines.AddRange(xCone);
            lines.Add(new Vector3(0.0f, 0.0f, 0.0f));

            // y
            lines.AddRange(yCone);
            lines.Add(new Vector3(0.0f, 0.0f, 0.0f));

            // z
            lines.AddRange(zCone);
            lines.Add(new Vector3(0.0f, 0.0f, 0.0f));

            DefaultShader = new Shader(Resources.axis_vert_shader, Resources.axis_frag_shader, true);
            VAO           = new LineVertexArrayBuffer(lines.ToArray());
        }
Beispiel #2
0
        public LineShapeRenderer()
        {
            List <Vector3> Lines = new List <Vector3>();

            float x = -1.0f, y = -1.0f, z = -1.0f;

            // left face
            Lines.Add(new Vector3(x, y, z));
            Lines.Add(new Vector3(x + 1.0f, y, z));

            Lines.Add(new Vector3(x + 1.0f, y, z));
            Lines.Add(new Vector3(x + 1.0f, y + 1.0f, z));

            Lines.Add(new Vector3(x + 1.0f, y + 1.0f, z));
            Lines.Add(new Vector3(x, y + 1.0f, z));

            Lines.Add(new Vector3(x, y + 1.0f, z));
            Lines.Add(new Vector3(x, y, z));

            // front face
            Lines.Add(new Vector3(x, y, z));
            Lines.Add(new Vector3(x, y, z + 1.0f));

            Lines.Add(new Vector3(x, y, z + 1.0f));
            Lines.Add(new Vector3(x, y + 1.0f, z + 1.0f));

            Lines.Add(new Vector3(x, y + 1.0f, z + 1.0f));
            Lines.Add(new Vector3(x, y + 1.0f, z));

            // right face
            Lines.Add(new Vector3(x, y + 1.0f, z + 1.0f));

            Lines.Add(new Vector3(x, y, z + 1.0f));
            Lines.Add(new Vector3(x + 1.0f, y, z + 1.0f));

            Lines.Add(new Vector3(x + 1.0f, y, z + 1.0f));
            Lines.Add(new Vector3(x + 1.0f, y + 1.0f, z + 1.0f));

            Lines.Add(new Vector3(x, y + 1.0f, z + 1.0f));


            /*
             * Lines.Add(new Vector3(x + 1.0f, 0.0f, y));
             * Lines.Add(new Vector3(x + 1.0f, 0.0f, y + 1.0f));
             *
             * Lines.Add(new Vector3(x + 1.0f, 0.0f, y + 1.0f));
             * Lines.Add(new Vector3(x, 0.0f, y + 1.0f));
             */
            DefaultShader = new Shader(Resources.line_shape_vert_shader, Resources.line_shape_frag_shader, true);
            VAO           = new LineVertexArrayBuffer(Lines.ToArray());
        }
Beispiel #3
0
        public LineGridRenderer(int size = 64)
        {
            List <Vector3> Lines = new List <Vector3>();

            for (int x = -(size / 2); x < size / 2; x++)
            {
                for (int y = -(size / 2); y < size / 2; y++)
                {
                    Lines.Add(new Vector3(x, 0.0f, y));
                    Lines.Add(new Vector3(x + 1.0f, 0.0f, y));

                    Lines.Add(new Vector3(x + 1.0f, 0.0f, y));
                    Lines.Add(new Vector3(x + 1.0f, 0.0f, y + 1.0f));

                    Lines.Add(new Vector3(x + 1.0f, 0.0f, y + 1.0f));
                    Lines.Add(new Vector3(x, 0.0f, y + 1.0f));
                }
            }

            DefaultShader = new Shader(Resources.grid_vert_shader, Resources.grid_frag_shader, true);
            VAO           = new LineVertexArrayBuffer(Lines.ToArray());
        }