Note that there are some explanatory texts on larger screens.

plurals
  1. POTranslating many meshes - HLSL
    text
    copied!<p>Okay forgive me if this is at all vague, but I've been up all night trying to catch up with some coding.</p> <p>I have a reasonably large and defined terrain with minimal optimisations in place and I have just started to introduce predefined meshes (.X objects) which come with materials and textures. Previously I was working in a fixed-function-pipeline approach as I have only recently started working with DirectX9. It has become apparent that FFP is old school and deprecated in DirectX10, so I have been moving relevant code to using a HLSL approach.</p> <p>In my initial approach I had loaded my models into a std::vector container of models and created another std::vector of objects which contain a reference to which model to display. In my render loop, I would iterate this container and check to see if the objects were within the Field-of-view of my camera. If so I would first translate the meshes to their positions, using a SetTransform() call, then DrawSubset().</p> <p>However it has become clear that SetTransform() is not applicable to the HLSL approach; therefore I'm a little stumped to how I can pre-translate these meshes to their relevant positions, or whether I should be translating them within the vertex shader. The meshes are stored within an ID3DXMESH type and it seems that I can access the Index and Vertex Buffer of these meshes; Am I supposed to take the contents of these buffers, translate the contents then draw them? Or am I really going the wrong way about doing this? </p> <p>I am familiar with the Vertex Buffer approach, but not sure what the vertex format is within the mesh itself.</p> <p>Any help would be appreciated as I'm about to tear my eyeballs out.</p> <p><strong>Edit</strong></p> <p>I'll accept Sergio's answer as it pushed me in the right direction although the solution came when I realised in my debug output a line about committing changes.</p> <p><strong>Solution</strong></p> <p>After transforming my mesh I needed to call g_pEffect->CommitChanges();</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload