Jump to content
  • Advertisement
Sign in to follow this  

Object Entity and Orientation accesses

This topic is 2154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!