kornerr wrote:
Thanks.
When I unloadResource of a scene graph, does it also unload its geometry, material, shader and other resources?
You're probably looking for
removeResource (instead of
unloadResource).
When you use
addResource to create a scene graph res, the new resource is given a reference count of 1. Any other resources that are required (geo, material, etc..) have their own reference counters incremented as well.
Then when you call
removeResource on your scene graph res, it will decrement the scene-graph-res's reference count. If the count is now 0, then the resource will be deleted. If the scene-graph-res is deleted then it will decrement the reference-counters of it's "sub-resources" (the geo, material, etc...) - again, if their reference counters are now 0, then they will be deleted as well.