コード例 #1
0
        public SquareGrid(OpenGL gl, int directionLineCount, float stepSize)
        {
            _directionLineCount = directionLineCount;
            _stepSize = stepSize;

            RecalculateShape();

            _gridLines = new LinesBase(gl, _lines);

            Material = new Material();
            Material.Ambient = new ColorF(255, 146, 134, 188); // Purple.
            Material.Shininess = 1f;
        }
コード例 #2
0
        //public void Render(OpenGL gl, ShaderManagerS1 shader)
        //{
        //    ValidateBeforeRender();
        //    shader.Material = MaterialX;
        //    shader.ApplyChangedProperties(gl);
        //    _lineX.Render(gl, shader);
        //    shader.Material = MaterialY;
        //    shader.ApplyChangedProperties(gl);
        //    _lineY.Render(gl, shader);
        //    shader.Material = MaterialZ;
        //    shader.ApplyChangedProperties(gl);
        //    _lineZ.Render(gl, shader);
        //}
        /// <summary>
        /// Calculates the lines using the current axis properties.
        /// </summary>
        public virtual void RecalculateShape(OpenGL gl)
        {
            var riseAxisValue = 0f;// .0001f; /

            var lineX = new List<Tuple<vec3, vec3>>();
            var lineY = new List<Tuple<vec3, vec3>>();
            var lineZ = new List<Tuple<vec3, vec3>>();

            lineX.Add(
                new Tuple<vec3, vec3>(
                    new vec3(0, riseAxisValue, 0),
                    new vec3(_axisLength, riseAxisValue, 0))
                );

            lineY.Add(
                new Tuple<vec3, vec3>(
                    new vec3(0, riseAxisValue, 0),
                    new vec3(0, _axisLength, 0))
                );

            lineZ.Add(
                new Tuple<vec3, vec3>(
                    new vec3(0, riseAxisValue, 0),
                    new vec3(0, riseAxisValue, _axisLength))
                );

            LineX = new LinesBase(gl, lineX, null);
            LineY = new LinesBase(gl, lineY, null);
            LineZ = new LinesBase(gl, lineZ, null);
        }