/// <summary>
        /// Provides the 3d layer with information about the lot
        /// </summary>
        /// <param name="model"></param>
        public void LoadHouse(HouseModel model)
        {
            /** Add terrain **/
            Components.Add(new TerrainComponent(RenderState));

            var cube1 = new CubeComponent(Color.Red, new Vector3(3.0f, 3.0f, 3.0f));

            cube1.Position = new Vector3(32.0f * 3, 0.0f, 32.0f * 3);
            Components.Add(cube1);
        }
示例#2
0
 private void setupPaddle(Vector2 position, Vector2 size)
 {
     gfx = new CubeComponent()
     {
         Name = "gfx",
         RelativeTranslation = new Vector3(position.X, position.Y, 0),
         RelativeScale       = new Vector3(size.X, size.Y, 1),
         Material            = new Material()
         {
             Color = new Vector4(1, 1, 1, 1)
         }
     };
     AddComponent(gfx);
 }
示例#3
0
    protected override void SetupScene()
    {
        SceneContext.AddActor(new Actor(new PointLightComponent()
        {
            Name = "StaticLight",
            RelativeTranslation = new Vector3(-2f, -1.5f, 3.25f),
        }));

        SceneContext.AddActor(new Actor(Box = new CubeComponent()
        {
            Name                = "Box1",
            RelativeRotation    = new Vector3(0, 0, 0.5f).ToQuaternion(),
            RelativeScale       = new Vector3(1),
            RelativeTranslation = new Vector3(0, 0, 0.5f),
            Material            = new Material
            {
                Color      = new Vector4(1, 0, 1, 1),
                CastShadow = true,
            },
        }));

        #region defineTween
        Tween.For(Box)
        .ScaleFunc(ScaleFuncs.Power10EaseInOut)
        .Duration(2).Translate(2, 0)
        .Then().Duration(1.5f).Scale(0.1f).Translate(1, -2)
        .Then().Duration(3.5f).Scale(1f).Translate(0, 0)
        .Repeat().Start();
        #endregion

        SceneContext.AddActor(new Actor(new QuadComponent()
        {
            Name          = "Ground",
            RelativeScale = new Vector3(50),
            Material      = new Material
            {
                Color      = new Vector4(1, 1, 0, 1),
                CastShadow = true,
            },
        }));
    }
示例#4
0
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     return(new UvPlane(block.getTexturePos(faceDirection, meta), 3, 3, 28, 28));
 }
        public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
        {
            int shift = meta == 0 ? 0 : 16;

            if (cubeComponent.index == 0)   // Stem.
            {
                return(new UvPlane(block.getTexturePos(faceDirection, meta), 3, 3, 8, 6));
            }
            else if (cubeComponent.index == 1)   // Body.
            {
                return(new UvPlane(block.getTexturePos(faceDirection, meta), 3 + shift, 11, 12, faceDirection.axis == EnumAxis.Y ? 12 : 6));
            }
            else   // Top.
            {
                if (faceDirection.axis == EnumAxis.Y)
                {
                    return(new UvPlane(block.getTexturePos(faceDirection, meta), 5 + shift, 13, 8, 8));
                }
                else
                {
                    return(new UvPlane(block.getTexturePos(faceDirection, meta), 5 + shift, 25, 8, 2));
                }
            }
        }
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     if (cubeComponent.index == 0)
     {
         // Main block.
         return(base.getUvPlane(block, meta, faceDirection, cubeComponent));
     }
     else
     {
         // Grass fluff.
         return(new UvPlane(new TexturePos(3, 1), 1, 1, 32, 8));
     }
 }
示例#7
0
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     return(new UvPlane(block.texturePos, 3, 23, 8, 8));
 }
示例#8
0
        public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
        {
            if (cubeComponent.index == 0)
            {
                if (faceDirection == Direction.UP)
                {
                    return(new UvPlane(new TexturePos(3, 6), 1, 1, 32, 64));
                }
                else if (faceDirection == Direction.DOWN)
                {
                    return(new UvPlane(new TexturePos(2, 6), 1, 1, 32, 64));
                }
                else
                {
                    return(new UvPlane(new TexturePos(6, 7), 1, 1, 64, 16));
                }
            }
            else if (cubeComponent.index == 1)    // Front.
            {
                return(new UvPlane(new TexturePos(5, 7), 1, 1, 32, 28));
            }
            else if (cubeComponent.index == 2)    // Back.
            {
                return(new UvPlane(new TexturePos(4, 7), 1, 1, 32, 20));
            }

            return(base.getUvPlane(block, meta, faceDirection, cubeComponent));
        }
        public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
        {
            bool isOut = block != Block.torch;

            if (faceDirection == Direction.UP)
            {
                return(new UvPlane(block.texturePos, 3, isOut ? 13 : 3, 8, 8));
            }
            else if (faceDirection == Direction.DOWN)
            {
                return(new UvPlane(block.texturePos, 3, 23, 8, 8));
            }
            else
            {
                return(new UvPlane(block.texturePos, isOut ? 23 : 13, 3, 8, 28));
            }
        }
示例#10
0
        public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
        {
            TexturePos pos = block.getTexturePos(faceDirection, meta);

            if (faceDirection.axis == EnumAxis.X || faceDirection.axis == EnumAxis.Z)
            {
                return(new UvPlane(pos, 15, 1, 4, 32));
            }
            else
            {
                // This must be the top face.
                return(new UvPlane(
                           pos,
                           new Vector2(
                               BitHelper.getBit(meta, 6) ? 0 : 14,
                               BitHelper.getBit(meta, 4) ? 0 : 14),
                           new Vector2(
                               BitHelper.getBit(meta, 2) ? 31 : 17,
                               BitHelper.getBit(meta, 0) ? 31 : 17)));
            }
        }
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     if (cubeComponent.index == 0)  // Post
     {
         if (faceDirection.axis == EnumAxis.Y)
         {
             return(new UvPlane(block.texturePos, 1, 1, 8, 8));
         }
         else
         {
             return(new UvPlane(block.texturePos, 13, 1, 8, 32));
         }
     }
     else     // Beam
     {
         if (faceDirection.axis == EnumAxis.Y)
         {
             return(new UvPlane(block.texturePos, 23, 1, 4, 12));
         }
         else
         {
             return(new UvPlane(block.texturePos, 1, 19, 12, 8));
         }
     }
 }
示例#12
0
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     if (faceDirection.axis == EnumAxis.Y)
     {
         return(new UvPlane(block.getTexturePos(faceDirection, meta), 3, 3, 28, 28));
     }
     else
     {
         return(new UvPlane(block.getTexturePos(faceDirection, meta), 3, 1, 28, 32));
     }
 }
示例#13
0
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     if (cubeComponent.index == 0)
     {
         return(base.getUvPlane(block, meta, faceDirection, cubeComponent));
     }
     else
     {
         return(new UvPlane(new TexturePos(9, 1), 27, 27, 4, 4));
     }
 }
示例#14
0
        public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
        {
            return(new UvPlane(block.getTexturePos(faceDirection, meta), cubeComponent, faceDirection));

            /* UNUSED
             * Direction slabDir = BlockSlab.getDirectionFromMeta(meta);
             * if (faceDirection.axis == slabDir.axis) { // Full face
             *  return base.getUvPlane(block, meta, faceDirection, cubeComponent);
             * } else {
             *  if(slabDir.axis == EnumAxis.X) {
             *      return new UvPlane(block.getTexturePos(faceDirection, meta), slabDir == Direction.EAST ? 1 : 17, 0, 16, 32);
             *  } else if (slabDir.axis == EnumAxis.Y) {
             *      return new UvPlane(block.getTexturePos(faceDirection, meta), 0, slabDir == Direction.DOWN ? 1 : 17, 32, 16); // GOOD!
             *  } else { // Z
             *      return new UvPlane(block.getTexturePos(faceDirection, meta), slabDir == Direction.SOUTH ? 1 : 17, 0, 16, 32);
             *  }
             * }
             */
        }
示例#15
0
 public override UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     if (faceDirection.axis == EnumAxis.X || faceDirection.axis == EnumAxis.Z)
     {
         return(new UvPlane(new TexturePos(9, 1), 1, 1, 32, 4));
     }
     else if (faceDirection == Direction.DOWN)
     {
         return(new UvPlane(new TexturePos(9, 0), 1, 1, 32, 32)); // Bottom
     }
     else
     {
         return(new UvPlane(((BlockLogicBase)block).getTopTexture(meta * 90), 1, 1, 32, 32)); // Top
     }
 }
 public virtual UvPlane getUvPlane(Block block, int meta, Direction faceDirection, CubeComponent cubeComponent)
 {
     return(new UvPlane(block.getTexturePos(faceDirection, meta), 1, 1, 32, 32));
 }