Example #1
0
        public static GameMesh CreateTriangle()
        {
            List <uint> idxs = new List <uint>()
            {
                0, 1, 2
            };
            List <GameVertex> verts = new List <GameVertex>()
            {
                new GameVertex()
                {
                    Position = new Vector3(-0.5f, -0.5f, 0.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(0.5f, -0.5f, 0.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(0.0f, 0.5f, 0.0f)
                }
            };

            GameMesh ret = new GameMesh(verts, idxs, new List <GameTexture>());

            ret.Log($"Creating Triangle Mesh", DebugChannel.Log, 8);

            return(ret);
        }
Example #2
0
        public static GameMesh CreateCube()
        {
            List <GameVertex> ret = new List <GameVertex>()
            {
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, -1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(-1.0f, 1.0f, 1.0f)
                },
                new GameVertex()
                {
                    Position = new Vector3(1.0f, -1.0f, 1.0f)
                }
            };

            List <uint> ind = new List <uint>();

            for (int i = 0; i < ret.Count; i++)
            {
                GameVertex v = ret[i];
                v.Position += Vector3.UnitZ * -1;
                ret[i]      = v;
                ind.Add((uint)i);
            }
            GameMesh gm = new GameMesh(ret, ind, new List <GameTexture>());

            ret.Log($"Creating Cube Mesh", DebugChannel.Log, 8);

            return(gm);
        }