Exemple #1
0
        private void InitScene(Vector3 containerPos)
        {
            var g = Program.Inst.GraphicsDevice;

            var roomSize = 7.0f;

            var floorColor     = new Color(0.1f, 0.2f, 0.9f);
            var floorTransform = Matrix.CreateRotationX(MathHelper.ToRadians(-90.0f))
                                 * Matrix.CreateScale(roomSize * Vector3.One);
            var floorMesh = MeshGen.Quad().Transform(floorTransform).Color(floorColor);

            AddEntity(new EcsEntity(new CMesh {
                Mesh = floorMesh.Gpu(g)
            }));

            var roomColor     = new Color(1.0f, 1.0f, 1.0f);
            var roomTransform = Matrix.CreateScale(roomSize * Vector3.One);
            var roomMesh      = MeshGen.Box().FlipTris().Transform(roomTransform).Color(roomColor);

            AddEntity(new EcsEntity(new CMesh {
                Mesh = roomMesh.Gpu(g)
            }));

            AddEntity(
                new EcsEntity(
                    new CMesh {
                Mesh = MeshGen.Quad(roomSize, 1.2f)
                       .Color(new Color(0.3f, 0.3f, 0.3f))
                       .Transform(
                    Matrix.CreateRotationY(MathHelper.ToRadians(90.0f))
                    * Matrix.CreateTranslation(new Vector3(-0.5f * roomSize + 0.01f, 1.8f, 0.0f)))
                       .Gpu(g)
            }
                    )
                );

            AddEntity(
                new EcsEntity(
                    new CMesh {
                Mesh = MeshGen.Quad(roomSize, 1.2f)
                       .Color(new Color(0.3f, 0.3f, 0.3f))
                       .Transform(
                    Matrix.CreateRotationY(MathHelper.ToRadians(-90.0f))
                    * Matrix.CreateTranslation(new Vector3(0.5f * roomSize - 0.01f, 1.8f, 0.0f)))
                       .Gpu(g)
            }
                    )
                );

            AddEntity(
                new EcsEntity(
                    new CMesh {
                Mesh = MeshGen.Quad(roomSize, 1.2f)
                       .Color(new Color(0.3f, 0.3f, 0.3f))
                       .Transform(Matrix.CreateTranslation(new Vector3(0.0f, 1.8f, -0.5f * roomSize + 0.01f)))
                       .Gpu(g)
            }
                    )
                );

            AddEntity(
                new EcsEntity(
                    new CMesh {
                Mesh = MeshGen.Quad(roomSize, 1.2f)
                       .Color(new Color(0.3f, 0.3f, 0.3f))
                       .Transform(Matrix.CreateTranslation(new Vector3(0.0f, 1.8f, 0.5f * roomSize - 0.01f)))
                       .Gpu(g)
            }
                    )
                );


            CreateContainer(new Vector3(-0.6f, 0.0f, 1.0f), new Color(0.2f, 0.6f, 1.0f));
            CreateContainer(new Vector3(0.6f, 0.0f, 1.0f), Color.OrangeRed);
            CreateConveyor();
        }