Jump to content
  • Advertisement
Sign in to follow this  

What should this look like?

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

Hi there, Ive successfully written a loader for the AC3D file format, from file into VBO's. This file format is designed to load a large file of 3d geometry from disk, then store it in memory such that the geometry is divided into chunks of an arbitrary size. Then, the sysem can load the data in real time, ensureing that no more world is loaded than the circle of the same radius as the draw distance. My first prototype does both the job of loading the file from the intermediete file format, and storing it in memory as seperate chunks. However, I need to break it into several classes because it would be absolutely massive if given all the functionality. Classes that I will likely need in order to obey single responsibility principle: LOADERS: class AC3DLoader - loads from the intermediate file format .ac class NativeLoader - loads from the native file format of the system. WRITERS: class NativeWriter - writes data to the native file format, .polyforest or .plf STORAGE IN MEMORY: class Streamer - controls all the other classes and transparently loads the file into memory. Can only stream from the native file format. class SceneGraph - uses the streamer and a database to load and store the entire world transparently, including entities, and provides an interface to manage the addition of new entities, and the removal of old ones. The names of the last two classes are uncertain, since Im not planning to have any streaming functionality in the first prototype. Does anybody have any recommendations for what this should look like? IM thinking that the above classes should go into a namespace, and a single header includes all the other class headers.

Share this post

Link to post
Share on other sites
Might I suggest a template-based resource manager to finish? Configure the classes that load files to have the same Load(std::string Filename) function and write a resource manager that could do something like:

CResManager<CModel> ModelsManager;
CResManager<CTexture> TextureManager;


CModel *Dino = ModelsManager.Load("dinosaur.3ds");
CModel *Dino2 = ModelsManager.Load("dinosaur.3ds");
CModel *Plane = ModelsManager.Load("plane.3ds");

CTexture *MouseCursor = TextureManager.Load("mouse.png");


This is how I propose mine will behave once its finished.

The responsibility of the resource manager is to make sure no two copies of the same file are in memory, and to ensure resources are not released until every instance has been finished with. In the above example, the data for dinosaur.3ds would NOT be released until ModelsManager.Release(Dino2) had also been called.

I think its tidy, and I'm enjoying making it.

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!