Пример #1
0
        public void CreateAllBuffer(Device device, Vector3 center, float radius)
        {
            if (first)
            {
                CreateAxieLinesBuffer(device, center, radius);

                arrows[0].CreateAllBuffer(device, AxisArrow.Point_To_X_Axis(center, radius, SCALE));
                arrows[1].CreateAllBuffer(device, AxisArrow.Point_To_Y_Axis(center, radius, SCALE));
                arrows[2].CreateAllBuffer(device, AxisArrow.Point_To_Z_Axis(center, radius, SCALE));

                //只有第一次创建时才更新center,radius
                this.center = center;
                this.radius = radius;
                this.first  = false;
            }
            else
            {
                //非首次创建,则始终使用参考模型的center、radius
                CreateAxieLinesBuffer(device, this.center, this.radius);

                arrows[0].CreateAllBuffer(device, AxisArrow.Point_To_X_Axis(this.center, this.radius, SCALE));
                arrows[1].CreateAllBuffer(device, AxisArrow.Point_To_Y_Axis(this.center, this.radius, SCALE));
                arrows[2].CreateAllBuffer(device, AxisArrow.Point_To_Z_Axis(this.center, this.radius, SCALE));
            }
        }
Пример #2
0
        static float SCALE = 1f;                                //坐标轴长度的scale

        public CoordAxies()
        {
            first = true;

            arrows    = new AxisArrow[3];
            arrows[0] = new AxisArrow(Color.Red);
            arrows[1] = new AxisArrow(Color.Green);
            arrows[2] = new AxisArrow(Color.Blue);
        }