private void InitializeFloorAsphalt()
        {
            float l = spaceSize;
            float h = 0f;

            VertexData[] vertices = new VertexData[]
            {
                new VertexData {
                    Position = new Vector3(-l, h, -l), Normal = Vector3.Up, Texture = new Vector2(0.0f, 0.0f)
                },
                new VertexData {
                    Position = new Vector3(-l, h, +l), Normal = Vector3.Up, Texture = new Vector2(0.0f, 1.0f)
                },
                new VertexData {
                    Position = new Vector3(+l, h, -l), Normal = Vector3.Up, Texture = new Vector2(1.0f, 0.0f)
                },
                new VertexData {
                    Position = new Vector3(+l, h, +l), Normal = Vector3.Up, Texture = new Vector2(1.0f, 1.0f)
                },
            };

            uint[] indices = new uint[]
            {
                0, 1, 2,
                1, 3, 2,
            };

            MaterialContent mat = MaterialContent.Default;

            mat.DiffuseTexture   = "SceneLights/floors/asphalt/d_road_asphalt_stripes_diffuse.dds";
            mat.NormalMapTexture = "SceneLights/floors/asphalt/d_road_asphalt_stripes_normal.dds";
            mat.SpecularTexture  = "SceneLights/floors/asphalt/d_road_asphalt_stripes_specular.dds";

            var content = ModelContent.GenerateTriangleList(vertices, indices, mat);

            var desc = new ModelDescription()
            {
                Name                    = "Floor",
                Static                  = true,
                CastShadow              = true,
                DeferredEnabled         = true,
                DepthEnabled            = true,
                AlphaEnabled            = false,
                UseAnisotropicFiltering = true,
                Content                 = new ContentDescription()
                {
                    ModelContent = content
                }
            };

            this.AddComponent <Model>(desc);
        }
Exemplo n.º 2
0
        private void InitializeFloor()
        {
            float l = 10f;
            float h = 0f;

            VertexData[] vertices = new VertexData[]
            {
                new VertexData {
                    Position = new Vector3(-l, -h, -l), Normal = Vector3.Up, Texture = new Vector2(0.0f, 0.0f)
                },
                new VertexData {
                    Position = new Vector3(-l, -h, +l), Normal = Vector3.Up, Texture = new Vector2(0.0f, l)
                },
                new VertexData {
                    Position = new Vector3(+l, -h, -l), Normal = Vector3.Up, Texture = new Vector2(l, 0.0f)
                },
                new VertexData {
                    Position = new Vector3(+l, -h, +l), Normal = Vector3.Up, Texture = new Vector2(l, l)
                },
            };

            uint[] indices = new uint[]
            {
                0, 1, 2,
                1, 3, 2,
            };

            var material = MaterialContent.Default;

            material.AmbientColor   = Color.White * 0.4f;
            material.DiffuseTexture = "resources/floor.png";

            var content = ModelContent.GenerateTriangleList(vertices, indices, material);

            var desc = new ModelDescription()
            {
                UseAnisotropicFiltering = true,
                Content = new ContentDescription()
                {
                    ModelContent = content,
                }
            };

            this.AddComponent <Model>(desc, SceneObjectUsages.Ground);
        }