示例#1
0
        public void Draw(PrimManager PrimManager, Vector3 BottomLeft, float Size)
        {
            Vector3 MasterBottomLeftFront = BottomLeft;
            Vector3 MasterTopRightBack = MasterBottomLeftFront + new Vector3(Size, Size, Size);

            Vector3 topLeftFront = new Vector3(MasterBottomLeftFront.X, MasterBottomLeftFront.Y, MasterTopRightBack.Z);
            Vector3 bottomLeftFront = MasterBottomLeftFront;
            Vector3 topRightFront = new Vector3(MasterTopRightBack.X, MasterBottomLeftFront.Y, MasterTopRightBack.Z);
            Vector3 bottomRightFront = new Vector3(MasterTopRightBack.X, MasterBottomLeftFront.Y, MasterBottomLeftFront.Z);
            Vector3 topLeftBack = new Vector3(MasterBottomLeftFront.X, MasterTopRightBack.Y, MasterTopRightBack.Z);
            Vector3 bottomLeftBack = new Vector3(MasterBottomLeftFront.X, MasterTopRightBack.Y, MasterBottomLeftFront.Z);
            Vector3 topRightBack = MasterTopRightBack;
            Vector3 bottomRightBack = new Vector3(MasterTopRightBack.X, MasterTopRightBack.Y, MasterBottomLeftFront.Z);

            Vector3 frontNormal = new Vector3(0.0f, -1.0f, 0.0f);
            Vector3 backNormal = new Vector3(0.0f, 1.0f, 0.0f);
            Vector3 topNormal = new Vector3(0.0f, 0.0f, 1.0f);
            Vector3 bottomNormal = new Vector3(0.0f, 0.0f, -1.0f);
            Vector3 leftNormal = new Vector3(-1.0f, 0.0f, 0.0f);
            Vector3 rightNormal = new Vector3(1.0f, 0.0f, 0.0f);

            VertexIndexData _returnData = new VertexIndexData();

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomLeftFront, topRightFront, frontNormal, TilesetMain.Tiles[Tex[0]]));

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomRightBack, topLeftBack, backNormal, TilesetMain.Tiles[Tex[2]]));
            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomLeftBack, topLeftFront, leftNormal, TilesetMain.Tiles[Tex[3]]));

            _returnData.AddData(PrimHelper.GenerateWallVertices(bottomRightFront, topRightBack, rightNormal, TilesetMain.Tiles[Tex[1]]));

            _returnData.AddData(PrimHelper.GenerateFloorVertices(bottomLeftBack, bottomRightFront, bottomNormal, TilesetMain.Tiles[Tex[4]]));
            _returnData.AddData(PrimHelper.GenerateFloorVertices(topLeftFront, topRightBack, topNormal, TilesetMain.Tiles[Tex[5]]));

            PrimManager.DrawVertices(_returnData, TilesetMain.TextureMain);
        }
示例#2
0
        public static void DrawCube(PrimManager PrimManager, Vector3 BottomLeftFront, Vector3 TopRightBack, TextureData Tex)
        {
            VertexIndexData _cube = PrimHelper.GenerateCubeVertices(BottomLeftFront, TopRightBack, Tex);

            PrimManager.DrawVertices(_cube, Tex.TextureMain);
        }
示例#3
0
        /// <summary>
        /// Loads content and and game logic.
        /// </summary>
        protected override void LoadContent()
        {
            // The primitive manager and spritebatch is loaded.
            primManager = new PrimManager(this, Content.Load<Effect>("Texts/WorldEffect"));
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Loads textures and fonts.
            textureManager.LoadTexturesFromFile("textureinfo", Content);
            FontMain = Content.Load<SpriteFont>("Fonts/FontMain");
            FontTiny = Content.Load<SpriteFont>("Fonts/FontTiny");

            // ---- GAME SPECIFIC INITALIZATIONS ----
            room = new Room(this, "blockset1", "plateau1");
            screenManager.AddScreen(new LevelEditor(this));
            cubeManager.AddCube(new Player(new Vector3(3, 3, 5), new PlayerAI(), textureManager.AniDic["player"]));
            cubeManager.AddCube(new PushCube(new Vector3(4,3,5), textureManager.TilesetList[0].Tiles[1]));

            // Places the light.
            primManager.myEffect.PlaceLightUsingDirection(this, 16);
            primManager.myEffect.UpdateShadowMap(this);
        }
示例#4
0
 public static void DrawCube(PrimManager PrimManager, Vector3 BottomLeftFront, Vector3 TopRightBack, TextureData Tex)
 {
     VertexIndexData _cube = PrimHelper.GenerateCubeVertices(BottomLeftFront, TopRightBack, Tex);
     PrimManager.DrawVertices(_cube, Tex.TextureMain);
 }