Ok Kylotan, but how do I render each object? Since I''d have all in libraries, I''d have to request material from the main library of materials. Where do I declare such libraries in? (what files)
As static, global or anything else?
Thanks.
" Do we need us? "
Libraries/Factories...
Well.. Your milage may wary, but in general I store all large binary objects in a resource manager, and then store pointers to the resource in the object:
Resource Manager
BMP Resource
Mesh Resource
then for each object:
Object
*BMP
*Mesh
This way, one object can mix-n-match, while only storing the large binary mesh/texture once. Resources are mapped by hashing the file-name CRCed into a DWORD. Every time an object is created it will call ResMan->GetResource(BMPName) to get the BMP*
If the HASH index comes up NULL, we load the resource, otherwise we return the current texture.
Resource Manager
BMP Resource
Mesh Resource
then for each object:
Object
*BMP
*Mesh
This way, one object can mix-n-match, while only storing the large binary mesh/texture once. Resources are mapped by hashing the file-name CRCed into a DWORD. Every time an object is created it will call ResMan->GetResource(BMPName) to get the BMP*
If the HASH index comes up NULL, we load the resource, otherwise we return the current texture.
It makes no difference where you store the materials or whatever when you render stuff. A pointer to a material is the same whether that material is stored inside the object or inside some ''library'' somewhere.
If you''re just asking how to arrange the files so that functions in one file can call functions in another, that''s basic C++ stuff that doesn''t really have any relevance to shared object libraries in specifc.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
If you''re just asking how to arrange the files so that functions in one file can call functions in another, that''s basic C++ stuff that doesn''t really have any relevance to shared object libraries in specifc.
[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
My library is usually a global singleton.
Unless you want multiple libraries. Even then, you''ll only load one at a time. But I did use two at a time. In an Editor, you might want to have a temp copy so that any changes on it can be cancelled when the user presses the cancel button. If he presses ok, you just assign the temp to the main library.
Unless you want multiple libraries. Even then, you''ll only load one at a time. But I did use two at a time. In an Editor, you might want to have a temp copy so that any changes on it can be cancelled when the user presses the cancel button. If he presses ok, you just assign the temp to the main library.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement