예제 #1
0
 public CubeModel(Game1 game, float width, float height, float depth, TexturePosInfo texturePosInfo, float imageSizeFactor)
 {
     this.game   = game;
     this.width  = width;
     this.height = height;
     this.depth  = depth;
     GoGenerateVertices(texturePosInfo, imageSizeFactor);
 }
 public CubeModelInvertedForSkybox(Game1 game, int width, int height, int depth, TexturePosInfo texturePosInfo)
 {
     this.game = game;
     this.width = width;
     this.height = height;
     this.depth = depth;
     GoGenerateVertices(texturePosInfo);
 }
 public CubeModelForPlayer(Game1 game, float width, float height, float depth, TexturePosInfo texturePosInfo)
 {
     this.game = game;
     this.width = width;
     this.height = height;
     this.depth = depth;
     GoGenerateVertices(texturePosInfo);
 }
예제 #4
0
 public CubeModel(Game1 game, float width, float height, float depth, TexturePosInfo texturePosInfo, float imageSizeFactor)
 {
     this.game = game;
     this.width = width;
     this.height = height;
     this.depth = depth;
     GoGenerateVertices(texturePosInfo, imageSizeFactor);
 }
예제 #5
0
        public void GoGenerateVertices(TexturePosInfo texturePosInfo)
        {
            //Front
            vertices[0] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.First());
            vertices[1] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.Second());
            vertices[2] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Third());
            vertices[3] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Fourth());

            //Right
            vertices[4] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(1, 0, 0), texturePosInfo.right.First());
            vertices[5] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(1, 0, 0), texturePosInfo.right.Second());
            vertices[6] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(1, 0, 0), texturePosInfo.right.Third());
            vertices[7] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(1, 0, 0), texturePosInfo.right.Fourth());

            //Rear
            vertices[8]  = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.First());
            vertices[9]  = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Second());
            vertices[10] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Third());
            vertices[11] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Fourth());

            //Left
            vertices[12] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(-1, 0, 0), texturePosInfo.left.First());
            vertices[13] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Second());
            vertices[14] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(-1, 0, 0), texturePosInfo.left.Third());
            vertices[15] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Fourth());

            //Top
            vertices[16] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.First());
            vertices[17] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.Second());
            vertices[18] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Third());
            vertices[19] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Fourth());

            //Bottom
            vertices[20] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.First());
            vertices[21] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.Second());
            vertices[22] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Third());
            vertices[23] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Fourth());


            int cur = 0;

            for (int i = 0; i < 24; i += 4)
            {
                indices[cur + 0] = 0 + i;
                indices[cur + 1] = 1 + i;
                indices[cur + 2] = 2 + i;
                indices[cur + 3] = 1 + i;
                indices[cur + 4] = 3 + i;
                indices[cur + 5] = 2 + i;
                cur += 6;
            }
        }
        public void GoGenerateVertices(float posx, float posy, VertexPositionNormalTexture[] vertices, int[] indices, ref int curVertice, ref int curIndice)
        {
            TexturePosInfo texturePosInfo = TexturePosInfoGenerator.FullImage;

            float height = 0.0f;

            int howmuchvertices = 4;

            float amount = 0.4f;

            //Front
            vertices[curVertice + 0] = new VertexPositionNormalTexture(new Vector3(posx - amount, height, posy - amount), new Vector3(0, 0, 1), texturePosInfo.front.First());
            vertices[curVertice + 1] = new VertexPositionNormalTexture(new Vector3(posx + amount, height, posy - amount), new Vector3(0, 0, 1), texturePosInfo.front.Second());
            vertices[curVertice + 2] = new VertexPositionNormalTexture(new Vector3(posx - amount, height, posy + amount), new Vector3(0, 0, 1), texturePosInfo.front.Third());
            vertices[curVertice + 3] = new VertexPositionNormalTexture(new Vector3(posx + amount, height, posy + amount), new Vector3(0, 0, 1), texturePosInfo.front.Fourth());

            //Rear
            //vertices[curVertice + 4] = new VertexPositionNormalTexture(new Vector3(mazeWall.xstart, height, mazeWall.ystart), new Vector3(0, 0, -1), texturePosInfo.rear.Second());
            //vertices[curVertice + 5] = new VertexPositionNormalTexture(new Vector3(mazeWall.xstart, 0, mazeWall.ystart), new Vector3(0, 0, -1), texturePosInfo.rear.Fourth());
            //vertices[curVertice + 6] = new VertexPositionNormalTexture(new Vector3(mazeWall.xend, height, mazeWall.yend), new Vector3(0, 0, -1), texturePosInfo.rear.First());
            //vertices[curVertice + 7] = new VertexPositionNormalTexture(new Vector3(mazeWall.xend, 0, mazeWall.yend), new Vector3(0, 0, -1), texturePosInfo.rear.Third());



            for (int i = 0; i < howmuchvertices; i += 4)
            {
                indices[curIndice + 0] = curVertice + 0 + i;
                indices[curIndice + 1] = curVertice + 1 + i;
                indices[curIndice + 2] = curVertice + 2 + i;
                indices[curIndice + 3] = curVertice + 1 + i;
                indices[curIndice + 4] = curVertice + 3 + i;
                indices[curIndice + 5] = curVertice + 2 + i;
                curIndice += 6;
            }



            //float hhh = height;
            //float www = mazeWall.yend - mazeWall.ystart + mazeWall.xend - mazeWall.xstart;

            //////This stuff is for repeating the texture
            //for (int i = curVertice; i < curVertice + howmuchvertices; i++)
            //{
            //    var vert = vertices[i];
            //    vert.TextureCoordinate.X *= (www / 1.0f);
            //    vert.TextureCoordinate.Y *= (hhh / 1.0f);
            //    vertices[i] = vert;
            //}

            curVertice += howmuchvertices;
        }
        public void GoGenerateVertices(TexturePosInfo texturePosInfo)
        {
            //Front
            vertices[0] = new VertexPositionTexture(new Vector3(0, height, depth), texturePosInfo.front.First());
            vertices[1] = new VertexPositionTexture(new Vector3(width, height, depth), texturePosInfo.front.Second());
            vertices[2] = new VertexPositionTexture(new Vector3(0, 0, depth), texturePosInfo.front.Third());
            vertices[3] = new VertexPositionTexture(new Vector3(width, 0, depth), texturePosInfo.front.Fourth());

            //Right
            vertices[4] = new VertexPositionTexture(new Vector3(width, height, depth), texturePosInfo.right.First());
            vertices[5] = new VertexPositionTexture(new Vector3(width, height, 0), texturePosInfo.right.Second());
            vertices[6] = new VertexPositionTexture(new Vector3(width, 0, depth), texturePosInfo.right.Third());
            vertices[7] = new VertexPositionTexture(new Vector3(width, 0, 0), texturePosInfo.right.Fourth());

            //Rear
            vertices[8] = new VertexPositionTexture(new Vector3(width, height, 0), texturePosInfo.rear.First());
            vertices[9] = new VertexPositionTexture(new Vector3(0, height, 0), texturePosInfo.rear.Second());
            vertices[10] = new VertexPositionTexture(new Vector3(width, 0, 0), texturePosInfo.rear.Third());
            vertices[11] = new VertexPositionTexture(new Vector3(0, 0, 0), texturePosInfo.rear.Fourth());

            //Left
            vertices[12] = new VertexPositionTexture(new Vector3(0, height, 0), texturePosInfo.left.First());
            vertices[13] = new VertexPositionTexture(new Vector3(0, height, depth), texturePosInfo.left.Second());
            vertices[14] = new VertexPositionTexture(new Vector3(0, 0, 0), texturePosInfo.left.Third());
            vertices[15] = new VertexPositionTexture(new Vector3(0, 0, depth), texturePosInfo.left.Fourth());

            //Top
            vertices[16] = new VertexPositionTexture(new Vector3(0, height, 0), texturePosInfo.top.First());
            vertices[17] = new VertexPositionTexture(new Vector3(width, height, 0), texturePosInfo.top.Second());
            vertices[18] = new VertexPositionTexture(new Vector3(0, height, depth), texturePosInfo.top.Third());
            vertices[19] = new VertexPositionTexture(new Vector3(width, height, depth), texturePosInfo.top.Fourth());

            //Bottom
            vertices[20] = new VertexPositionTexture(new Vector3(0, 0, depth), texturePosInfo.bottom.First());
            vertices[21] = new VertexPositionTexture(new Vector3(width, 0, depth), texturePosInfo.bottom.Second());
            vertices[22] = new VertexPositionTexture(new Vector3(0, 0, 0), texturePosInfo.bottom.Third());
            vertices[23] = new VertexPositionTexture(new Vector3(width, 0, 0), texturePosInfo.bottom.Fourth());

            int cur = 0;
            for (int i = 0; i < 24; i += 4)
            {
                indices[cur + 0] = 2 + i;
                indices[cur + 1] = 1 + i;
                indices[cur + 2] = 0 + i;
                indices[cur + 3] = 2 + i;
                indices[cur + 4] = 3 + i;
                indices[cur + 5] = 1 + i;
                cur += 6;
            }
        }
예제 #8
0
 public CubeModelForPlayer(Game1 game, float width, float height, float depth, TexturePosInfo texturePosInfo)
 {
     this.game   = game;
     this.width  = width;
     this.height = height;
     this.depth  = depth;
     GoGenerateVertices(texturePosInfo);
 }
 public CubeModelInvertedForSkybox(Game1 game, int width, int height, int depth, TexturePosInfo texturePosInfo)
 {
     this.game   = game;
     this.width  = width;
     this.height = height;
     this.depth  = depth;
     GoGenerateVertices(texturePosInfo);
 }
예제 #10
0
        public void GoGenerateVertices(TexturePosInfo texturePosInfo, float imageSizeFactor)
        {
            //Front
            vertices[0] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.First());
            vertices[1] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.Second());
            vertices[2] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Third());
            vertices[3] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Fourth());

            //Right
            vertices[4] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(1, 0, 0), texturePosInfo.right.First());
            vertices[5] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(1, 0, 0), texturePosInfo.right.Second());
            vertices[6] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(1, 0, 0), texturePosInfo.right.Third());
            vertices[7] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(1, 0, 0), texturePosInfo.right.Fourth());

            //Rear
            vertices[8]  = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.First());
            vertices[9]  = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Second());
            vertices[10] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Third());
            vertices[11] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Fourth());

            //Left
            vertices[12] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(-1, 0, 0), texturePosInfo.left.First());
            vertices[13] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Second());
            vertices[14] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(-1, 0, 0), texturePosInfo.left.Third());
            vertices[15] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Fourth());

            //Top
            vertices[16] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.First());
            vertices[17] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.Second());
            vertices[18] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Third());
            vertices[19] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Fourth());

            //Bottom
            vertices[20] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.First());
            vertices[21] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.Second());
            vertices[22] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Third());
            vertices[23] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Fourth());


            int cur = 0;

            for (int i = 0; i < 24; i += 4)
            {
                indices[cur + 0] = 0 + i;
                indices[cur + 1] = 1 + i;
                indices[cur + 2] = 2 + i;
                indices[cur + 3] = 1 + i;
                indices[cur + 4] = 3 + i;
                indices[cur + 5] = 2 + i;
                cur += 6;
            }

            //This stuff is for repeating the texture
            for (int i = 0; i < vertices.Length; i++)
            {
                var vert = vertices[i];
                vert.TextureCoordinate.X *= (width / imageSizeFactor);
                vert.TextureCoordinate.Y *= (depth / imageSizeFactor);
                //vert.TextureCoordinate.X /= 10.0f;
                //vert.TextureCoordinate.Y /= 10.0f;
                vertices[i] = vert;
            }
        }
예제 #11
0
        public void GoGenerateVertices(TexturePosInfo texturePosInfo, float imageSizeFactor)
        {
            //Front
            vertices[0] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.First());
            vertices[1] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 0, 1), texturePosInfo.front.Second());
            vertices[2] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Third());
            vertices[3] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, 0, 1), texturePosInfo.front.Fourth());

            //Right
            vertices[4] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(1, 0, 0), texturePosInfo.right.First());
            vertices[5] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(1, 0, 0), texturePosInfo.right.Second());
            vertices[6] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(1, 0, 0), texturePosInfo.right.Third());
            vertices[7] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(1, 0, 0), texturePosInfo.right.Fourth());

            //Rear
            vertices[8] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.First());
            vertices[9] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Second());
            vertices[10] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Third());
            vertices[11] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, 0, -1), texturePosInfo.rear.Fourth());

            //Left
            vertices[12] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(-1, 0, 0), texturePosInfo.left.First());
            vertices[13] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Second());
            vertices[14] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(-1, 0, 0), texturePosInfo.left.Third());
            vertices[15] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(-1, 0, 0), texturePosInfo.left.Fourth());

            //Top
            vertices[16] = new VertexPositionNormalTexture(new Vector3(0, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.First());
            vertices[17] = new VertexPositionNormalTexture(new Vector3(width, height, 0), new Vector3(0, 1, 0), texturePosInfo.top.Second());
            vertices[18] = new VertexPositionNormalTexture(new Vector3(0, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Third());
            vertices[19] = new VertexPositionNormalTexture(new Vector3(width, height, depth), new Vector3(0, 1, 0), texturePosInfo.top.Fourth());

            //Bottom
            vertices[20] = new VertexPositionNormalTexture(new Vector3(0, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.First());
            vertices[21] = new VertexPositionNormalTexture(new Vector3(width, 0, depth), new Vector3(0, -1, 0), texturePosInfo.bottom.Second());
            vertices[22] = new VertexPositionNormalTexture(new Vector3(0, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Third());
            vertices[23] = new VertexPositionNormalTexture(new Vector3(width, 0, 0), new Vector3(0, -1, 0), texturePosInfo.bottom.Fourth());

            int cur = 0;
            for (int i = 0; i < 24; i += 4)
            {
                indices[cur + 0] = 0 + i;
                indices[cur + 1] = 1 + i;
                indices[cur + 2] = 2 + i;
                indices[cur + 3] = 1 + i;
                indices[cur + 4] = 3 + i;
                indices[cur + 5] = 2 + i;
                cur += 6;
            }

            //This stuff is for repeating the texture
            for (int i = 0; i < vertices.Length; i++)
            {
                var vert = vertices[i];
                vert.TextureCoordinate.X *= (width / imageSizeFactor);
                vert.TextureCoordinate.Y *= (depth / imageSizeFactor);
                //vert.TextureCoordinate.X /= 10.0f;
                //vert.TextureCoordinate.Y /= 10.0f;
                vertices[i] = vert;
            }
        }