public Tree(Game game, Vector3 scale, Vector3 rotation, Vector3 position,Camera cam) { this.world = Matrix.CreateScale(scale) * Matrix.CreateFromYawPitchRoll(rotation.Y, rotation.X, rotation.Z) * Matrix.CreateTranslation(position); this.camera = cam; this.position = position; this.texture = ImageLibrary.getInstance().getImage("Tree"); Vector3[] verts = new Vector3[] { new Vector3(-1, 0, 0), new Vector3(-1, 2, 0), new Vector3(1, 2, 0), new Vector3(1, 2, 0), new Vector3(1, 0, 0), new Vector3(-1, 0, 0) }; int[] triangles = new int[] { 0,1,2, 3,4,5 }; Vector2[] uv = new Vector2[] { new Vector2(0, 1), new Vector2(0, 0), new Vector2(1, 0), new Vector2(1,0), new Vector2(1, 1), new Vector2(0, 1) }; int[] trianglesuv = new int[] { 0,1,2, 3,4,5 }; ConvertMesh myMesh = new ConvertMesh(); vertices = myMesh.returnTriangle(verts, triangles, uv, trianglesuv); vertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionTexture), vertices.Length, BufferUsage.None); vertexBuffer.SetData<VertexPositionTexture>(vertices); effect = new BasicEffect(game.GraphicsDevice); }
public Character(Game game, Vector3 scale, Vector3 rotation, Vector3 position, Texture2D texture, Camera camera, Node target) { this.scale = scale; this.target = target; this.camera = camera; this.world = Matrix.CreateScale(scale) * Matrix.CreateFromYawPitchRoll(rotation.Y, rotation.X, rotation.Z) * Matrix.CreateTranslation(position); this.position = position; this.rotation = rotation; this.texture = texture; Vector3[] _verts = new Vector3[] { new Vector3(-1, 0, -1), new Vector3(-1, 0, 1), new Vector3(1, 0, -1), new Vector3(1,0,1) }; int[] triangles = new int[] { 0,1,2, 2,1,3 }; Vector2[] uv = new Vector2[] { new Vector2(0, 0), new Vector2(0, 1), new Vector2(1, 0), new Vector2(1,0), new Vector2(0, 1), new Vector2(1, 1) }; int[] trianglesuv = new int[] { 0,1,2, 3,4,5 }; ConvertMesh myMesh = new ConvertMesh(); verts = myMesh.returnTriangle(_verts, triangles, uv, trianglesuv); vertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionTexture), verts.Length, BufferUsage.None); vertexBuffer.SetData<VertexPositionTexture>(verts); effect = new BasicEffect(game.GraphicsDevice); }