drunken hyena is good, i am also a fan :P there's a great book "introduction to 3d game programming with directx 9.0" written by Frank D Luna too: http://www.amazon.com/Introduction-Programming-DirectX-Wordware-Graphics/dp/1556229135/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1216164488&sr=8-2 good luck! On 7/15/08, Edilson Vasconcelos de Melo Junior <dirso@xxxxxxxxxxxxxxxxxx> wrote: > > Thank you so much!!! It looks an amazing idea. I have not used DirectX in > the past and I think my Ogre3D experience is not helping me much. The best > tutorial I found for this is > http://www.drunkenhyena.com/pages/projects/d3d8/d3d_lesson5.php Do you > know anything better (and still quick)? I'll try to port this code to my C# > appl, how hard can it be J? > > > > Thanks again for your help, > > Dirso > > > > *De:* gameprogrammer-bounce@xxxxxxxxxxxxx [mailto: > gameprogrammer-bounce@xxxxxxxxxxxxx] *Em nome de *Alan Wolfe > *Enviada em:* terça-feira, 15 de julho de 2008 14:10 > *Para:* gameprogrammer@xxxxxxxxxxxxx > *Assunto:* [gameprogrammer] Re: RES: RES: Re: RES: Re: DirectX Line and > Triangle > > > > Well in your case i think going w/ a pyramid might be easier because if you > use a flat triangle you might want to make it billboarded (or partially > billboarded) where it is always perpendicular to how the person is looking > at it which involves a lot more math! > > > > Since you are in 3d and not 2d what you might have better luck with is > making a pyramid "model" that has a center of 0,0 and is pointing to the > right (like you would see on a regular horizontal line). > > > > Then what you do is when you want to render one of these pyramids on a > line, you calculate how much you should rotate the pyramid on the Y and Z > axis to point along the line (by finding the angles of the line), then > render the pyramid rotated that amount at the midpoint of the line. > > > > you could store this pyramid in a vertex buffer if you wanted to and it > should render really quickly. > > > > You could also make these pyramids rotate on the X axis over time so that > they were slowly spinning when the player was looking at them which might be > a cool effect for your purposes (: > > > > to calculate how much to rotate the pyramid you are going to have to use > something like arc tangent (make sure and use atan2 instead of atan, check > the docs on those to find out why). > > > > On 7/14/08, *Edilson Vasconcelos de Melo Junior* <dirso@xxxxxxxxxxxxxxxxxx> > wrote: > > BTW: The flat triangle was just an idea. It could be a cone or a pyramid or > anything else that could indicate the driving way. Anything easy and of > course that DirectX could draw 5,000 on screen without drastically reducing > de frame rate. > > > > Thanks, > > Dirso > > > > *De:* gameprogrammer-bounce@xxxxxxxxxxxxx [mailto: > gameprogrammer-bounce@xxxxxxxxxxxxx] *Em nome de *Edilson Vasconcelos de > Melo Junior > *Enviada em:* segunda-feira, 14 de julho de 2008 20:41 > *Para:* gameprogrammer@xxxxxxxxxxxxx > *Assunto:* [gameprogrammer] RES: Re: RES: Re: DirectX Line and Triangle > > > > The triangle is really a flat triangle, it's just something to indicate a > path. And the line segments do have x,y and z values. I work on this project > like google earth 3d client and my task is to draw lines representing > streets and make triangles over them pointing the allowed driving way. > > > > Thanks, > > Dirso > > > > *De:* gameprogrammer-bounce@xxxxxxxxxxxxx [mailto: > gameprogrammer-bounce@xxxxxxxxxxxxx] *Em nome de *Alan Wolfe > *Enviada em:* segunda-feira, 14 de julho de 2008 19:22 > *Para:* gameprogrammer@xxxxxxxxxxxxx > *Assunto:* [gameprogrammer] Re: RES: Re: DirectX Line and Triangle > > > > the triangle you want to put on the lines, do you want it to be 3 > dimensional (ie a pyramid, not a triangle?) or do you want it to just really > be a triangle. > > > > also, when you say you are in 3d do you mean that your line segments all > have different X,Y and Z values? or are they all on the same Z value? > > > > On 7/14/08, *Edilson Vasconcelos de Melo Junior* <dirso@xxxxxxxxxxxxxxxxxx> > wrote: > > Hi, > > > > I'm in 3d… can you help me a little more? > > > > Thank you very much for your help, > > Dirso > > > > *De:* gameprogrammer-bounce@xxxxxxxxxxxxx [mailto: > gameprogrammer-bounce@xxxxxxxxxxxxx] *Em nome de *Alan Wolfe > *Enviada em:* segunda-feira, 14 de julho de 2008 17:38 > *Para:* gameprogrammer@xxxxxxxxxxxxx > *Assunto:* [gameprogrammer] Re: DirectX Line and Triangle > > > > Hey Dirso, > > > > Here's a plan of attack (assuming you are in 2d) > > > > Calculate the normal of the line segment to get a normalized vector > perpendicular to the line, this will be useful to figure out the vertices > for the flat back side of the triangle. Call this NX and NY. > > > > Calculate the normalized vector of the line, call this LX and LY. > > > > Find the midpoint of the line call this MX and MY. > > > > Figure out how wide and how tall you want the triangle to be, call this > TWidth and THeight. > > > > If you do the above, here's how to find each of the 3 vertices for the > triangle for each line: > > > > Vertex 1: > > *start at the midpoint > > *subtract LX,LY multiplied by TWidth/2 > > *add NX,NY * THeight/2 > > > > Vertex 2: > > *start at the midpoint > > *add LX,LY * TWidth/2 > > > > Vertex 3: > > *start at the midpoint > > *subtract LX,LY multiplied by TWidth/2 > > *subtract NX,NY * THeight/2 > > > > That will give you the vertices in a clockwise order, so watch out for back > face culling if you have clockwise culled (: > > > > > On 7/14/08, *Edilson Vasconcelos de Melo Junior* <dirso@xxxxxxxxxxxxxxxxxx> > wrote: > > Hi, > > > > I have a CustomVertex.PositionColored[] object that represents a line and > I use the DrawUserPrimitives(PrimitiveType.LineStrip, this.linePoints.Length > - 1, this.linePoints); to draw it on screen > > Now I need to draw a small triangle aligned to each line segment and one of > each vertex must "pointy" to the finish point of the segment. How can I do > that? > > Something like the attached picture, but not that ugly. > > > > Thanks, > > Dirso. > > > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.4.10/1551 - Release Date: 14/7/2008 > 06:49 > > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.4.10/1551 - Release Date: 14/7/2008 > 06:49 > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.4.10/1551 - Release Date: 14/7/2008 > 06:49 > > > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.4.11/1553 - Release Date: 15/7/2008 > 05:48 > >