Sign in to follow this  

Object Entity and Orientation accesses

Recommended Posts

I've finished most of my Orientation class (maintains position, scale, rotation, center, and gives me the resulting transformation matrix of it) and I'm starting to code the objects my engine will support, and I'm looking for some advice on this, on how I can get the interface I want and still work good with the SceneGraph.


For now, I have an Image class to draw 2D images.


//My SceneGraph is pretty simple for now, it's a linked list with child nodes of SceneObjects
class SceneObject
            layerLevel = 0;
        int layerLevel; //During the Draw call, I'll divide objects in layers to draw them in the correct order if required
        Orientation _orientation;
class Image : public SceneObject
        void Load(string textureName);
        void Load(string textureName, string materialName);
        //other Load overloads
       //I want new variables here
        Canvas* _canvas;
        Texture2D* _texture;
        Material* _material;


So I want to be able to do this (or similar) when I'm coding the game:


//Inside an initialization function
Image* someImage = new Image("Picture");
//Inside an update function
someImage.scale.y += 0.1;


But these variables are inside my Orientation class, and I don't want to expose them because some of them require updating the matrix, so I created function such as _orientation.SetPosition(Vector3 position); etc (though Position doesn't flag the matrix for update, but that's the idea)


And also, since Image will always be 2D, I'm dealing with a Vector2 variable that I want to map in a Vector3 from the Orientation class (I use this class for 2D and 3D).


I can't find a good solution to be able to provide an easy to handle object so I can program the game easier later, how do you guys deal with this and/or do you know any resources that could help me deal with this?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this