Sign in to follow this  
freddierichard

Moving A Mesh

Recommended Posts

Ok, I'm actually far along with a actually landscape project that is very much like a game. Overhead view or first person. When all objects are intially loaded I literally loop through the vertex buffer and position them, works great actually, for loading. The last time I worked with DirectX professionally, was either version 5 or 7. (Another non game project) so I'm really stuck on how to transform the mesh to move it. I'm using the D3D9 empty project and an effects file for all water animation. The app is more like a close up sim city but for landscappers. I have a few books back in Texas but I'm not in Texas for the next few months. Any help? Pointers? :) Thanks!

Share this post


Link to post
Share on other sites
In either case, it is the world matrix you need. If you are in fixed-function, call SetTransform with the WORLD flag and your object's transform matrix. Or, if you are in the programmable pipeline, send the matrix to the shader and apply it manually.

Share this post


Link to post
Share on other sites
I have been looking at the world matrix and attempting to use the SetTransform but since I'm using the Utility Camera and a effects file it doesn't seem to be having a effect. I mean nothing. I originally started this project with my own camera and no effect file and had no problem transforming the meshes how ever I wanted but I found the utility camera easy to work with once I got it set up and modified to my taste. I was hoping that somebody had used the effect files for their major rendering before but had managed to work with the World matrix seperatly also. I get the world matrix from the camera object. Also I do use vertex shading in the effects file to change the color of selected faces, but that's about it. Looping through the vertex buffer seems to be fast but I just figured that there was already a faster method from Microsoft that they had created around assembly(machine) code. Thanks!

Share this post


Link to post
Share on other sites
In the code:

effect_->SetMatrix( "g_mWorldViewProj", &matViewProj );

In the effect file:

float4x4 g_mWorldViewProj : worldviewprojection;
//...
OUT.HPosition = mul( IN.Position, g_mWorldViewProj );

Just a quick example.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this