Jump to content
  • Advertisement
Sign in to follow this  
Shamino

Help, with um, my class composition?

This topic is 4685 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
Advertisement
What the heck is the syntax for returning a pointer?

like this?


MS3DModel *GetRenderInformation()
{
return Model1;
}


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!