Exemple #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);
        }