コード例 #1
0
 public void CreateBlock(Vector3 position, Vector3 boxSize, String textureFilename)
 {
     var block = new MotionEntity
     {
         MainGraphic = new MetaModel
         {
             XMesh = new MeshConcretize
             {
                 MeshDescription = new Graphics.Software.Meshes.BoxMesh
                 {
                     Min = new Vector3(-boxSize.X / 2f, -boxSize.Y / 2f, 0),
                     Max = new Vector3(boxSize.X / 2f, boxSize.Y / 2f, boxSize.Z),
                 },
                 Layout = Graphics.Software.Vertex.PositionNormalTexcoord.Instance
             },
             Texture = new TextureFromFile(textureFilename),
         },
         Translation = position
     };
     block.MotionObject = new Common.Motion.Static()
     {
         Position = position,
         LocalBounding = new BoundingMetaMesh
         {
             Mesh = ((MetaModel)block.MainGraphic).XMesh
         }
     };
     scene.Add(block);
 }
コード例 #2
0
        public void CreateBlock(Vector3 position, Vector3 boxSize, String textureFilename)
        {
            var block = new MotionEntity
            {
                MainGraphic = new MetaModel
                {
                    XMesh = new MeshConcretize
                    {
                        MeshDescription = new Graphics.Software.Meshes.BoxMesh
                        {
                            Min = new Vector3(-boxSize.X / 2f, -boxSize.Y / 2f, 0),
                            Max = new Vector3(boxSize.X / 2f, boxSize.Y / 2f, boxSize.Z),
                        },
                        Layout = Graphics.Software.Vertex.PositionNormalTexcoord.Instance
                    },
                    Texture = new TextureFromFile(textureFilename),
                },
                Translation = position
            };

            block.MotionObject = new Common.Motion.Static()
            {
                Position      = position,
                LocalBounding = new BoundingMetaMesh
                {
                    Mesh = ((MetaModel)block.MainGraphic).XMesh
                }
            };
            scene.Add(block);
        }