DxDotNet
Neophyte
Germany
3 Posts |
Posted - Sep 02 2005 : 07:08:25 AM
|
--------English/Englisch-------------
Hi All, 
has anyone used Sprite.Draw of Managed DX9 to build a billboarding-function or used it in any other way in 3D?
I want to solve the following two problems:
1.) I do not know how to configure the view matrix correctly. I use a identity matrix as world matrix and I implemented a fully functionally 1st Person 3D world with camera rotation by mouse, meshes etc. Everything works great that far, except billboarding. I like to use Sprite.Draw, because of its abillity to select regions from the bitmap-source (texture), its fast, and it should do it. But if I rotate my view, the Billboard-Sprite changes its position and comes nearer. What's my fault? Any Idea
2.) There are two parameters in Sprite.Draw (Center and Position). What do they do? I tried different values, but it was impossible for me to position the Billboard Sprite at the correct place. 
If anyone has any experiences, oder knows a website where to look further (Microsoft MSDN is not very helpful in this case) or is able to post a code sample. That were great!
Thank You all.
So long,
Holger
A Codesample is attached at the end of the Text.
--------Deutsch/German-------------
Hallo Leuz, 
hat jeder von Euch schon mal mit dem Sprite.Draw von Managed DX9 die Billbord-Funktion benutzt?
Ich habe folgende zwei Probleme:
1.) Ich schaffe es nicht die View-Matrix richtig anzugeben. Ich verwende als WorldMatrix einfach die Einheitsmatrix und übergebe schlicht die ViewMatrix (1stPerson-Kamerapos., berechnet über Maus die Drehung etc, läuft problemlos als 3D-Welt mit Meshes). Das Sprite sehe ich zwar auch, aber es verhält sich nicht richtig wie ein Billboard, sondern ändert die Position bei Kameradrehung (kommt auf die Kamera zu).
2.) Die beiden Vektoren-Parameter der Sprite.Draw (Center und Position). Welche Funktion erfüllen Sie? Ich habe damit experimentiert und kommen zu keiner sinnvollen Positionierung des Sprites.
Wenn jemand einen Tip hat, wo es hierzu paar sinnvolle Infos, oder Codebeispiele gibt, wäre das klasse . Bei Microsoft (MSDN) gibts nämlich nix.
Gruß,
Holger
Codebeispiel (Codesample), zur Frage:
Dim s As New Direct3D.Sprite(Device) Try s.SetWorldViewLH(Device.Transform.World, Device.Transform.View)
s.Begin(Direct3D.SpriteFlags.AlphaBlend Or Direct3D.SpriteFlags.Billboard) s.Draw(AniTexture, New Rectangle(0, 0, 256, 256), New Vector3(x, y, z), New Vector3(x2, y2, z2), Color.White) s.End() Finally s.Dispose() End Try |
|