hy.
i'm think on a solution for draw meshes and classes in dx10 and c++.
My idea is to use a MVP(model view presenter pattern) and a class material.
All is focused on a class that define "the material" , the material it'isnt like at dx9 , but is a class
that define the method of drawing and the resources.
this for separate geometrics data from the "logic" of draw data.
It carry itself the resources(the data of textures , material ,color ecc..) of the mesh and the shader type.
the class that link the model and the view(that is the mesh and both contains geometric data and material data)
is the presenter , that contains a pointer to the model
and take the data from the view.
At first the mesh call a method of the presenter , like initialize() and the presenter get the data from
the material class (texture ecc...), then call on a Model(the model class have a collection of all the shaders)
the function initialize, that create or get(if there is arleady) the shader from the type in a factory
, and set the resources always in the model , now I have a shader with all the resources and i can draw.
finally the mesh call the draw() method of the presenter ,the presenter take the geometric data and the
ready shader and draw.
Then if i change a shader or the resources i don't must change all the mesh classes that work in that mode,
i change the method on the model that get or initialize the shader and all the meshes work like before.
also i must have a more controls on the resources and the shaders that can be all in the model and not sparse
in the classes.
Can be a good method?
by