FusionWolf
21-01-2005, 01:23 PM
Hi,
I have TSprite class which has texture and some other variables to control sprite itself.
In DirectX 8 there was rotation argument in ID3DXSprite.Draw() function but now in DX 9 it's gone.
So, if I have TD3DMatrix variable in my TSprite class and some private functions which translates and rotates sprite by using D3DXMatrixTranslation, D3DMatrixMultiply and etc. functions. How I can draw sprite with translated, rotated and etc. coordinates?
I mean that Draw() function takes @TD3DXVector3 structure in position for example, but how I obtain that position in vector because I'm using matrices for translation? Littlebit confusing.
For example....
type
TSprite = Class
private
Texture: IDirect3DTexture9;
Position: TD3DXVector;
Origo: TD3DXVector;
TransFrm: TD3DMatrix;
procedure Rotate(Degrees: integer) ;
public
procedure Draw;
constructor Create;
destructor Destroy;
end;
procedure TSprite.Rotate();
begin
// calculates rotation here and stores it to TransFrm matrix.
end.
procedure TSprite.Draw;
begin
D3DXSprite.SetTransform(TransFrm);
// How this sould be called so that matrice effects?
D3DXSprite.Draw(Texture, @rect, @Origo, @Position, $FFFFFFFF);
end;
I have TSprite class which has texture and some other variables to control sprite itself.
In DirectX 8 there was rotation argument in ID3DXSprite.Draw() function but now in DX 9 it's gone.
So, if I have TD3DMatrix variable in my TSprite class and some private functions which translates and rotates sprite by using D3DXMatrixTranslation, D3DMatrixMultiply and etc. functions. How I can draw sprite with translated, rotated and etc. coordinates?
I mean that Draw() function takes @TD3DXVector3 structure in position for example, but how I obtain that position in vector because I'm using matrices for translation? Littlebit confusing.
For example....
type
TSprite = Class
private
Texture: IDirect3DTexture9;
Position: TD3DXVector;
Origo: TD3DXVector;
TransFrm: TD3DMatrix;
procedure Rotate(Degrees: integer) ;
public
procedure Draw;
constructor Create;
destructor Destroy;
end;
procedure TSprite.Rotate();
begin
// calculates rotation here and stores it to TransFrm matrix.
end.
procedure TSprite.Draw;
begin
D3DXSprite.SetTransform(TransFrm);
// How this sould be called so that matrice effects?
D3DXSprite.Draw(Texture, @rect, @Origo, @Position, $FFFFFFFF);
end;