Ejemplo n.º 1
0
        public Skybox(GraphicsDevice device)
        {
            float x = 0.525731f;
            float z = 0.850651f;

            var vertices = new SkyboxVertex[12]
            {
                new SkyboxVertex(-x, 0f, z), new SkyboxVertex(x, 0f, z),
                new SkyboxVertex(-x, 0f, -z), new SkyboxVertex(x, 0f, -z),
                new SkyboxVertex(0f, z, x), new SkyboxVertex(0f, z, -x),
                new SkyboxVertex(0f, -z, x), new SkyboxVertex(0f, -z, -x),
                new SkyboxVertex(z, x, 0f), new SkyboxVertex(-z, x, 0f),
                new SkyboxVertex(z, -x, 0f), new SkyboxVertex(-z, -x, 0f),
            };

            var indices = new int[60]
            {
                1,4,0,  4,9,0,  4,5,9,  8,5,4,  1,8,4,
                1,10,8, 10,3,8, 8,3,5,  3,2,5,  3,7,2,
                3,10,7, 10,6,7, 6,11,7, 6,0,11, 6,1,0,
                10,1,6, 11,0,9, 2,11,9, 5,2,9,  11,2,7
            };

            vertexBuffer = Buffer<SkyboxVertex>.New(device, vertices, BufferFlags.VertexBuffer);
            indexBuffer = Buffer<int>.New(device, indices, BufferFlags.IndexBuffer);
            skyboxEffect = EffectLoader.Load(@"Graphics/Shaders/Skybox.fx");
            skyboxTex = Texture2D.Load(device, @"G:\Users\Athrun\Documents\Stratum\trunk\src\Stratum\WorldEngine\Earth\milkyWay.tif");
        }
Ejemplo n.º 2
0
        public Skybox(GraphicsDevice device)
        {
            float x = 0.525731f;
            float z = 0.850651f;

            var vertices = new SkyboxVertex[12]
            {
                new SkyboxVertex(-x, 0f, z), new SkyboxVertex(x, 0f, z),
                new SkyboxVertex(-x, 0f, -z), new SkyboxVertex(x, 0f, -z),
                new SkyboxVertex(0f, z, x), new SkyboxVertex(0f, z, -x),
                new SkyboxVertex(0f, -z, x), new SkyboxVertex(0f, -z, -x),
                new SkyboxVertex(z, x, 0f), new SkyboxVertex(-z, x, 0f),
                new SkyboxVertex(z, -x, 0f), new SkyboxVertex(-z, -x, 0f),
            };

            var indices = new int[60]
            {
                1, 4, 0, 4, 9, 0, 4, 5, 9, 8, 5, 4, 1, 8, 4,
                1, 10, 8, 10, 3, 8, 8, 3, 5, 3, 2, 5, 3, 7, 2,
                3, 10, 7, 10, 6, 7, 6, 11, 7, 6, 0, 11, 6, 1, 0,
                10, 1, 6, 11, 0, 9, 2, 11, 9, 5, 2, 9, 11, 2, 7
            };

            vertexBuffer = Buffer <SkyboxVertex> .New(device, vertices, BufferFlags.VertexBuffer);

            indexBuffer = Buffer <int> .New(device, indices, BufferFlags.IndexBuffer);

            skyboxEffect = EffectLoader.Load(@"Graphics/Shaders/Skybox.fx");
            skyboxTex    = Texture2D.Load(device, @"G:\Users\Athrun\Documents\Stratum\trunk\src\Stratum\WorldEngine\Earth\milkyWay.tif");
        }