Drawing a 3D line
Now heres a interesting topic i found on the GMC 3D Techniques and i was baffled to find a answer till i actually put in some effort to thinking about it. It was how to draw a 3D line. Now we all know that you use a primitive (and for those who didn't this is for you, don't worry no need to put up your hand(s)).
A extermely simple way and the way most people would know is
[CODE]
d3d_primitive_begin(pr_linelist);
d3d_vertex(x1,y1,z1);
d3d_vertex(x2,y2,z2);
d3d_primitive_end();
[/CODE]
simple huh? But Slayer 64 (whom i may not consider myself to be on very good terms but that is between me and a certain incident), he is a genius at 3D aspects of GM and bought up a very good point of making the line look much nicer. And i wanted to distrubute it with his name branded on it.
[CODE]
d3d_transform_set_identity()
d3d_transform_add_rotation_y(point_direction(0,z1-z2,point_distance(x2,y2,x1,y1),0)
d3d_transform_add_rotation_z(point_direction(x1,y1,x2,y2))
d3d_transform_add_translation(x1,y1,z1)
d3d_draw_floor(0,-.5,0,point_distance(x1,y1,x2,y2),.5,0,background_get_texture(background0))
[/CODE]
But millzy, what is the point of all this? Well Slayer explained it better than anyone ever could by using a example
" it's highly neceessary if you want lines to look good. like the rails in quake 3. pr_linewhatever doesn't look good in 3d because it's width doesn't change "
And included this image to show you exactly the evidence of how we would wnat it to look rather than a simple pr_linestrip which frankly would be something you'd only poke your eye out with.
Anyway i hope this has has lined some people up with some good ideas for their games (see what i did there :P )
A extermely simple way and the way most people would know is
[CODE]
d3d_primitive_begin(pr_linelist);
d3d_vertex(x1,y1,z1);
d3d_vertex(x2,y2,z2);
d3d_primitive_end();
[/CODE]
simple huh? But Slayer 64 (whom i may not consider myself to be on very good terms but that is between me and a certain incident), he is a genius at 3D aspects of GM and bought up a very good point of making the line look much nicer. And i wanted to distrubute it with his name branded on it.
[CODE]
d3d_transform_set_identity()
d3d_transform_add_rotation_y(point_direction(0,z1-z2,point_distance(x2,y2,x1,y1),0)
d3d_transform_add_rotation_z(point_direction(x1,y1,x2,y2))
d3d_transform_add_translation(x1,y1,z1)
d3d_draw_floor(0,-.5,0,point_distance(x1,y1,x2,y2),.5,0,background_get_texture(background0))
[/CODE]
But millzy, what is the point of all this? Well Slayer explained it better than anyone ever could by using a example
" it's highly neceessary if you want lines to look good. like the rails in quake 3. pr_linewhatever doesn't look good in 3d because it's width doesn't change "
And included this image to show you exactly the evidence of how we would wnat it to look rather than a simple pr_linestrip which frankly would be something you'd only poke your eye out with.
Anyway i hope this has has lined some people up with some good ideas for their games (see what i did there :P )
Labels: 3D - Advanced

