Sign in to follow this  

Help, with um, my class composition?

This topic is 4381 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

class Object
{
public:


	bool MarkedForDeletion;
        float locx, locy, locz;
	virtual void GetRenderInformation(){}
	virtual void GetPhysicsInformation(){}
	virtual void GetSoundInformation(){}
	virtual void Update(){}


};

class Ship : public Object
{
public:
	
	Ship(float x, float y, float z)
	{
		x = locx;
                y = locy;
                z = locz;
	}

	void GetRenderInformation()
	{

	}

	void GetPhysicsInformation()
	{
	
	}

	void GetSoundInformation()
	{
	
	}

	void Update()
	{
	
	}
protected:

	// Cross specific functions go here

};


Okay, so ultimately, I want my render function to read what model is in Ship by doing a Ship.getrenderinfo, then taking what is in the constructor of ship and draw the ship at the x,y,z specified... My question isn't about the Draw function, it is about what exactly do I return with the GetRenderData function, simply a pointer to a model?

Share this post


Link to post
Share on other sites
The same way you'd return anything else.

MyModelClass* Model = new MyModelClass("awesome.3ds", REALLY_COOL);
return Model;

would return a pointer to MyModelClass.
EDIT: That is, a pointer to that instance of MyModelClass, 'course.

Share this post


Link to post
Share on other sites
Okay, so lets talk about resource management now...

Where in the world do I declare the pointer for Model....

Do I have a resource management class that simply creates pointers for each model that I load and throws them into a vector...

And then have the getrenderdata function look in that container of pointers for model?

Share this post


Link to post
Share on other sites

This topic is 4381 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.

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