XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

drawing method dx10

Last post 29/06/2009 9:50 by giugio. 1 replies.
  • 27/06/2009 18:17

    drawing method dx10

    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
  • 29/06/2009 9:50 In reply to

    Re: drawing method dx10

    my problem is that now i created a mesh class inherited from a baseMesh class for each type of shader that i have with all the initialize of the shader and bind resources.
    The problem is that for each new shader i must create a new mesh class.
    Another problem is that if i have a hierarchy of mesh generic draw classes i can't implement another type of hierarchy for ex. baseHumanoidMeshClass ,genericHumanoidMeshClass,enemyHumanoidMeshClass ecc... for the humanoids in my game and i must incapsulate the geometry meshes in these classes.
    I'm search to separate the geometry to the drawing and resources.

    There are any other methods that should advice to me?


    Thanks.
Page 1 of 1 (2 items) Previous Next