Example #1
0
        public LocalUnits(GraphicsDevice gd, Texture2D tex)
        {
            be = new BasicEffect(gd);
            be.TextureEnabled = true;
            be.Texture = tex;

            verts[0] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(0, 0), 1);
            verts[1] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(1, 0), 1);
            verts[2] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(0, 1), 1);

            verts[3] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(0, 1), 1);
            verts[4] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(1, 0), 1);
            verts[5] = new VertexPositionNormalTextureShade(new Vector3(), Vector3.One, new Vector2(1, 1), 1);
        }
Example #2
0
        private void UpFace(float light, float smovy, float tsperh, float tsper, int j, int i, float smovx, int k)
        {
            //Forward face
            VertexArray[index] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Up, new Vector2(smovx, smovy),
                                                     light*0.8f);
            VertexArray[index + 1] =
                new VertexPositionNormalTextureShade(new Vector3(i + 1 + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Up,
                                                     new Vector2(smovx + tsper, smovy), light*0.8f);
            VertexArray[index + 2] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + 1 + sx*dimS, j + sy*dimS, -k - 1),
                    Vector3.Up,
                    new Vector2(smovx + tsper, smovy + tsperh), light*0.8f);
            VertexArray[index + 3] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + 1 + sx*dimS, j + sy*dimS, -k - 1),
                    Vector3.Up,
                    new Vector2(smovx + tsper, smovy + tsperh), light*0.8f);
            VertexArray[index + 4] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + sy*dimS, -k - 1),
                                                     Vector3.Up,
                                                     new Vector2(smovx, smovy + tsperh), light*0.8f);
            VertexArray[index + 5] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Up, new Vector2(smovx, smovy),
                                                     light*0.8f);

            index += 6;
        }
Example #3
0
        private void UpFaceTree(float light, float tsper, float tsperh, int i, int j, int k, float smovx, float smovy)
        {
            //Forward face
            VertexArrayTransparent[indextransparent] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + sx*dimS, j + 0.5f + sy*dimS, -k + 1),
                    Vector3.Up, new Vector2(smovx, smovy),
                    light);
            VertexArrayTransparent[indextransparent + 1] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + 1 + sx*dimS, j + 0.5f + sy*dimS, -k + 1),
                    Vector3.Up, new Vector2(smovx + tsper, smovy),
                    light);
            VertexArrayTransparent[indextransparent + 2] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + 1 + sx*dimS, j + 0.5f + sy*dimS, -k - 1),
                    Vector3.Up, new Vector2(smovx + tsper, smovy + tsperh),
                    light);
            VertexArrayTransparent[indextransparent + 3] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + 1 + sx*dimS, j + 0.5f + sy*dimS, -k - 1),
                    Vector3.Up, new Vector2(smovx + tsper, smovy + tsperh),
                    light);
            VertexArrayTransparent[indextransparent + 4] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + sx*dimS, j + 0.5f + sy*dimS, -k - 1),
                    Vector3.Up, new Vector2(smovx, smovy + tsperh),
                    light);
            VertexArrayTransparent[indextransparent + 5] =
                new VertexPositionNormalTextureShade(
                    new Vector3(i + sx*dimS, j + 0.5f + sy*dimS, -k + 1),
                    Vector3.Up, new Vector2(smovx, smovy),
                    light);

            indextransparent += 6;
        }
Example #4
0
        private void ForwardFaceBlack(float umovy, float tsperh, float tsper, float umovx, int i, int j, int k)
        {
            VertexArray[index] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx, umovy), 0);
            VertexArray[index + 1] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + 1 + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx, umovy + tsperh), 0);
            VertexArray[index + 2] =
                new VertexPositionNormalTextureShade(new Vector3(i + 1 + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx + tsper, umovy), 0);
            VertexArray[index + 3] =
                new VertexPositionNormalTextureShade(new Vector3(i + 1 + sx*dimS, j + 1 + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx + tsper, umovy + tsperh), 0);
            VertexArray[index + 4] =
                new VertexPositionNormalTextureShade(new Vector3(i + 1 + sx*dimS, j + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx + tsper, umovy), 0);
            VertexArray[index + 5] =
                new VertexPositionNormalTextureShade(new Vector3(i + sx*dimS, j + 1 + sy*dimS, -k),
                                                     Vector3.Backward,
                                                     new Vector2(umovx, umovy + tsperh), 0);

            index += 6;
        }