PDA

View Full Version : Rotation ???



TheLion
15-08-2003, 08:51 PM
I'm trying out rotation with Direct3D using the d3dx9 unit (and dll), however my object (a quad made out of 2 triangles) refuses to move an inch... I tried all sorts of combinations and positions, but it just refuses to work...

I am using this FVF:

const D3DFVF_CUSTOMVERTEX = ( D3DFVF_XYZRHW or D3DFVF_TEX1);
and my guess is that the D3DFVF_XYZRHW isn't supported in rotation...

Clootie
16-08-2003, 12:35 AM
You are right you can't transform already transformed coordinates - D3DFVF_XYZRHW.

TheLion
16-08-2003, 07:56 AM
It would be nice if Microsoft would provide that information in their help file! ;)

Thanks for your reply Clootie!

Clootie
16-08-2003, 11:05 AM
From Doc:

Mapping FVF to DirectX 9.0 Decl
D3DFVF_XYZRHW -> D3DDECLTYPE_FLOAT4 /D3DDECLUSAGE_POSITIONT / 0

D3DDECLUSAGE_POSITIONT
Vertex data contains transformed position data. (D3DDECLUSAGE_POSITIONT with UsageIndex = 0) specifies transformed position. When a declaration containing this is set, the pipeline does not perform vertex processing.

TheLion
17-08-2003, 08:43 AM
Would it be possible to convert (with some sort of formula) a pixel coordinate to the normal Direct3D coordinates?

If so I could provide my Direct3D Wrapper with X,Y in pixel coords and let my Draw procedure convert them back to normal Direct3D (so without the RHW setting).

At the moment I calculate the rotation coordinates myself, but doing it with Direct3D will probably be a bit faster and may look a bit better I guess! ;)


P.S. I'm using Direct3D for 2D drawing, so you might understand my need for Pixel/Screen coordinates :)

Clootie
17-08-2003, 05:02 PM
Basically you are looking for something like ID3DXSprite that was designed to render 2D billboards/sprites in 3D.
The same thing can be reached by
1) D3DXMatrixOrthoLH(matrix, width, height, 1, 1000);
2) SetMatrix(xxx_projection, matrix);
3) Sending 3D (not 4D) coordinates like you do it now
4) SetMatrix(xxx_world, rotation_matrix)

PS. Current generation CPU, for example P4-2000Mhz can transform (with help of SSE) more than 5 millions vertices per second.