[MDX] Rotation in transformed coordinates
Good day, commanders!
I have created a speedmeter for the car in CustomVertex.TransformedTextured.Format (XYZRHW).
I wаnt to rotate an arrow of speedmeter without change its VB (separate VB for arrow).
As it to make through transformation (rotation) of the transformed coordinates?
Yours faithfully, Max.
Quote:Original post by Maxim Skachkov
Good day, commanders!
[smile] Good day to you too!
Quote:Original post by Maxim SkachkovJust the usage of TransformedTextured is enough to make your task impossible. By providing transformed vertices you are explicitly telling the Direct3D pipeline that you dont want any matrix transformations or vertex shaders applied to it - and that it should pass it straight through to the rasterizer.
I have created a speedmeter for the car in CustomVertex.TransformedTextured.Format (XYZRHW).
Three options:
1. Modify your vertex buffer. You say you dont want to do this, but it is the simplest method (from a coding point of view)
2. Switch to proper 3D geometry and use an orthogonal projection matrix. It's slightly more involved and harder to get pixel-level accuracy, but it enables the transformation units in the pipeline.
3. Use vertex shaders and pass in a simple float2 (x,y) coordinate and let the VS handle the custom transformation for you.
hth
Jack
Hello again Maxim,
There's also option 4, using Sprite objects to render the speedometer. In the source for my 4e4 game you'll find an example of how this can be implemented. It's a bit messy, but you can find the implementation in Common\Compas.cs.
Hope this helps :)
There's also option 4, using Sprite objects to render the speedometer. In the source for my 4e4 game you'll find an example of how this can be implemented. It's a bit messy, but you can find the implementation in Common\Compas.cs.
Hope this helps :)
Jack and remigius!
Thanks for fast replies!
I have decided to not use the modification of vertex buffer - it is not recommended because of the decrease of the productivity (Lock... UnLock everyone render).
I have decided to use sprites. It is simple enough too.
Remigius, I download you sample game and at once have found there
Though I could not compile it, but now enough examples of a code to me as programmer.
My project is on a finish lane. The DirectX forum helps to do it more quickly and more qualitatively!
Good Luck to you!
Thanks for fast replies!
I have decided to not use the modification of vertex buffer - it is not recommended because of the decrease of the productivity (Lock... UnLock everyone render).
I have decided to use sprites. It is simple enough too.
Remigius, I download you sample game and at once have found there
sprite.Transform = Matrix.RotationZ(angle);
Though I could not compile it, but now enough examples of a code to me as programmer.
My project is on a finish lane. The DirectX forum helps to do it more quickly and more qualitatively!
Good Luck to you!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement