Exemplo n.º 1
0
        /*public Ecliptic()
         *  : this(new Color3f(1, 1, 1), 10000, 100)
         * {
         * }*/
        public Ecliptic(Color3f color, float size, int num)
        {
            if (Root.Instance.UserInterface == null)
            {
                return;
            }

            VertexP3C3[] data = new VertexP3C3[(num + 1) * 4];
            int          i    = 0;

            material            = Material.CreateSimpleMaterial(null);
            material.DepthTest  = true;
            material.DepthWrite = true;
            material.Additive   = true;


            for (int x = 0; x <= num; ++x)
            {
                float c = (float)x / (float)num;
                float a = c * size - size / 2;
                float b = size / 2;
                c /= 6;

                data[i].Color      = new Color3f(c, 0, 0.5f);
                data[i++].Position = new Vector3(a, 0, b);
                data[i].Color      = new Color3f(c, 0, 0.5f);
                data[i++].Position = new Vector3(a, 0, -b);

                data[i].Color      = new Color3f(0, c, 0.5f);
                data[i++].Position = new Vector3(b, 0, a);
                data[i].Color      = new Color3f(0, c, 0.5f);
                data[i++].Position = new Vector3(-b, 0, a);
            }
            vertices        = Root.Instance.UserInterface.Renderer.CreateStaticVertexBuffer(data, (num + 1) * 4 * 2 * 3 * 4);
            vertices.Format = VertexFormat.VF_P3C3;

            shader = Root.Instance.ResourceManager.LoadShader("simple3d.shader");
        }
Exemplo n.º 2
0
        /*public Ecliptic()
            : this(new Color3f(1, 1, 1), 10000, 100)
        {
        }*/
        public Ecliptic(Color3f color, float size, int num)
        {
            if (Root.Instance.UserInterface == null)
                return;

            VertexP3C3[] data = new VertexP3C3[(num + 1) * 4];
            int i = 0;
            material = Material.CreateSimpleMaterial(null);
            material.DepthTest = true;
            material.DepthWrite = true;
            material.Additive = true;

            for (int x = 0; x <= num; ++x)
            {
                float c = (float)x / (float)num;
                float a = c * size - size / 2;
                float b = size / 2;
                c /= 6;

                data[i].Color = new Color3f(c, 0, 0.5f);
                data[i++].Position = new Vector3(a, 0, b);
                data[i].Color = new Color3f(c, 0, 0.5f);
                data[i++].Position = new Vector3(a, 0, -b);

                data[i].Color = new Color3f(0, c, 0.5f);
                data[i++].Position = new Vector3(b, 0, a);
                data[i].Color = new Color3f(0, c, 0.5f);
                data[i++].Position = new Vector3(-b, 0, a);
            }
            vertices = Root.Instance.UserInterface.Renderer.CreateStaticVertexBuffer(data, (num + 1) * 4 * 2 * 3 * 4);
            vertices.Format = VertexFormat.VF_P3C3;

            shader = Root.Instance.ResourceManager.LoadShader("simple3d.shader");
        }