In my opinion, the Resource manager should create everything and store it in the Mesh/Material classes.
So the resources can simply be a structure of pointers to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
With this design you can either load meshes or create them procedurally by filling in a MeshDesc and calling createMesh()
Show differencesHistory of post edits
#4TiagoCosta
Posted 07 August 2012 - 05:08 AM
In my opinion, the Resource manager should create everything and store it in the Mesh/Material classes.
So the resources can simply be a structure of pointers to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
With this design you can either load meshes or create them procedurally by filling in a MeshDesc and calling createMesh()
So the resources can simply be a structure of pointers to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
With this design you can either load meshes or create them procedurally by filling in a MeshDesc and calling createMesh()
#3TiagoCosta
Posted 07 August 2012 - 04:57 AM
In my opinion, the Resource manager should create everything and store it in the Mesh/Material classes.
So the resources can simply be a structure of pointers to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
So the resources can simply be a structure of pointers to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
#2TiagoCosta
Posted 07 August 2012 - 04:57 AM
In my opinion, the Resource manager should create everything and store it in the Mesh/Material classes.
So the resources can simply be a structure to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
So the resources can simply be a structure to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following design (only regarding meshes):
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
#1TiagoCosta
Posted 07 August 2012 - 04:56 AM
In my opinion, the Resource manager should create everything and store it in the Mesh/Material classes.
So the resources can simply be a structure to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following methods/classes/structs (only regarding meshes)
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().
So the resources can simply be a structure to buffers/textures, etc.
I think its preferable for the ResourceManager to have a pointer to the D3D Device than the Resource classes.
In my engine I have the following methods/classes/structs (only regarding meshes)
- MeshDesc struct - contains pointers to the vertex/index data and other data needed to create the mesh.
- Mesh* ResourceManager::createMesh(uint nameHash, const MeshDesc& desc) - creates the buffers (etc) puts them in a new Mesh object and returns it.
- Mesh* ResourceManager::loadMesh(uint filenameHash) - check if already has been loaded, if not load the data into a MeshDesc objects and call createMesh().