This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "DrawInfo"

From BZFlagWiki
Jump to: navigation, search
(mesh links)
(Code: added spaces)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
DrawInfo allows clients to render the [[Mesh|mesh]] object more efficiently through LODs (Levels of Detail).  Many associate drawinfo with the ability to create moving objects in a map.   
+
DrawInfo allows clients to render the [[mesh]] object more efficiently through LODs (Levels of Detail).  Many associate drawinfo with the ability to create moving objects in a map.   
 
==Code==
 
==Code==
 
The code must be added to the mesh object.
 
The code must be added to the mesh object.
Line 35: Line 35:
  
 
Valid parameters for drawinfo are:
 
Valid parameters for drawinfo are:
<properties>
+
{|{{Prettytable}}
dlist=(recommended) requests that the client use display lists to render the object
+
|-
decorative=disables drawInfo in older clients
+
| {{Hl3}} |'''Parameter'''
angvel=causes the mesh object to spin at the given rate in degrees per second
+
| {{Hl3}} |'''Description'''
extents=
+
|-
sphere=
+
| '''dlist''' || requests that the client use display lists to render the object (recommended for meshes that are not overly complicated).
vertex=if defined within the drawInfo section, the vertices, normals, and texcoords will be used instead of those defined in the mesh
+
|-
corner=(required)a point defined by a vertex, normal, and a texcoord
+
| '''decorative''' || disables drawInfo in older clients.
lod=(required)sections that determines which faces/points will be rendered from specific distances (lengthPerPixel)
+
|-
lengthPerPixel=(required)distance from which the points will be rendered, 0 is close, .3 is about as far away as is needed  
+
| '''angvel''' || causes the mesh object to spin at the given rate in degrees per second.
matref=(required)material to use for the faces that follow it.
+
|-
points=
+
| '''extents''' || the minimum and maximum x, y, and z point of the mesh to be drawn.  This helps with rendering efficiency, meshes whose extents are outside of the point of view will not be drawn.
lines=
+
|-
lineloop=
+
| '''sphere''' || an imaginary sphere that encompasses all x, y, and z coordinates.  Similar to extents, this helps increase rendering efficiency.
linestrip=
+
|-
tris=index numbers of corners that create triangles
+
| '''vertex''' || if defined within the drawInfo section, the vertices, normals, and texcoords will be used instead of those defined in the mesh.
tristrip=series of points that form a chain of triangles.
+
|-
trifan= a series of points that create triangles that fan out from a single point.  That point, usually in the center, is placed first in the series.  Trifans are used only in pyramid and cone-shaped meshes.
+
| '''corner''' || (required) a point defined by a vertex, normal, and a texcoord.
quads=points that create 4-sided mesh planes
+
|-
quadstrip=series of points that create a chain of 4-sided planes.  Similarly to tristrips, the series zig-zags between the points, starting in the counter-clockwise direction.
+
| '''lod''' || (required) sections that determines which faces/points will be rendered from specific distances (lengthPerPixel).
polygon=same as quads except for planes of more than 4 sides.
+
|-
</properties>
+
| '''lengthPerPixel''' || (required) distance from which the points will be rendered, 0 is close, .3 is about as far away as is needed.
 +
|-
 +
| '''matref''' || (required) material to use for the faces that follow it.
 +
|-
 +
| '''points''' || ''description''.
 +
|-
 +
| '''lines''' || ''description''.
 +
|-
 +
| '''lineloop''' || ''description''.
 +
|-
 +
| '''linestrip''' || ''description''.
 +
|-
 +
| '''tris''' || index numbers of corners that create triangles.
 +
|-
 +
| '''tristrip''' || series of points that form a chain of triangles.
 +
|-
 +
| '''trifan''' || a series of points that create triangles that fan out from a single point.  That point, usually in the center, is placed first in the series.  Trifans are used only in pyramid and cone-shaped meshes.
 +
|-
 +
| '''quads''' || points that create 4-sided mesh planes.
 +
|-
 +
| '''quadstrip''' || series of points that create a chain of 4-sided planes.  Similarly to tristrips, the series zig-zags between the points, starting in the counter-clockwise direction.
 +
|-
 +
| '''polygon''' || same as quads except for planes of more than 4 sides.
 +
|}
  
 
==Appearance==
 
==Appearance==
DrawInfo is only applied to existing [[Mesh|mesh]] objects. If you look closely in Louman's Mystic Valley, shrubbery and trees will change in appearance slightly when viewed from about 200 units away.
+
DrawInfo is only applied to existing [[mesh]] objects. These mesh objects will be altered by DrawInfo parameters.
 +
 
 +
A common example are spinning objects (angvel parameter in DrawInfo).
 +
 
 +
LODs can improve framerate as it features substitution of complex mesh objects at given lengthPerPixel steps with more simplistic objects. If the substitution is done decent then it'll be unobtrusive. LODs are used in Louman's Mystic Valley for instance: Shrubbery and trees will change in appearance slightly when viewed from about 200 units away.
  
 
==Editor Support==
 
==Editor Support==
There is currently no support for drawInfo except for hand-editing
+
DrawInfo support has been added to obj to bzw converters: Modeltool (available through [[BZFlag Git|Git]]) and [http://my.bzflag.org/bb/viewtopic.php?p=115772#115772 php-dIMachine].
  
 
==History==
 
==History==
DrawInfo was only recently added (by trepan) and is rarely used for anything other than experimental and proof-of-concept maps.   Notable exceptions to this are: Louman's Mystic Valley, and Louman's Churchyard.
+
DrawInfo was added (by trepan) in BZFlag version 2.0.4 and is rarely used for anything other than experimental and proof-of-concept maps. Notable exceptions to this are trees in Louman's "Mystic Valley" and "Churchyard" maps, and a more recent practical use of moving drawinfo in Planet MoFo's halloween [[passion]] map. Following the creation of tools to generate drawinfo from .obj files, it is getting more frequent use by more experienced map makers.
 +
 
 +
[[Category:Map Making]]
 +
[[Category:Map_Objects]]

Latest revision as of 02:14, 5 December 2016

DrawInfo allows clients to render the mesh object more efficiently through LODs (Levels of Detail). Many associate drawinfo with the ability to create moving objects in a map.

Code[edit]

The code must be added to the mesh object.

 drawInfo
   dlist		      # display list for all material sets
   decorative		      # older clients with not see this mesh
   angvel <degrees/sec>       # rotation about initial Z axis
   extents <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
   sphere <x> <y> <z> <radiusSquared>
   corner <v> <n> <t>	      (repeatable)
   vertex 0.0 0.0 0.0	      (repeatable)
   normal 0.0 0.0 0.0	      (repeatable)
   texcoord 0.0 0.0	      (repeatable)
   lod			      (repeatable)
     lengthPerPixel <value>
     matref <name>	      (repeatable)
       dlist		      # display list for this material set
       sphere <x> <y> <z> <radiusSquared>
       points	 0	      (repeatable)
       lines	 0 1	      (repeatable)
       lineloop  0 1	      (repeatable)
       linestrip 0 1	      (repeatable)
       tris	 0 1 2	      (repeatable)
       tristrip  0 1 2	      (repeatable)
       trifan	 0 1 2	      (repeatable)
       quads	 0 1 2 3      (repeatable)
       quadstrip 0 1 2 3      (repeatable)
       polygon	 0 1 2	      (repeatable)
     end  # matref
   end	  # lod
 end	  # drawInfo

Valid parameters for drawinfo are:

Parameter Description
dlist requests that the client use display lists to render the object (recommended for meshes that are not overly complicated).
decorative disables drawInfo in older clients.
angvel causes the mesh object to spin at the given rate in degrees per second.
extents the minimum and maximum x, y, and z point of the mesh to be drawn. This helps with rendering efficiency, meshes whose extents are outside of the point of view will not be drawn.
sphere an imaginary sphere that encompasses all x, y, and z coordinates. Similar to extents, this helps increase rendering efficiency.
vertex if defined within the drawInfo section, the vertices, normals, and texcoords will be used instead of those defined in the mesh.
corner (required) a point defined by a vertex, normal, and a texcoord.
lod (required) sections that determines which faces/points will be rendered from specific distances (lengthPerPixel).
lengthPerPixel (required) distance from which the points will be rendered, 0 is close, .3 is about as far away as is needed.
matref (required) material to use for the faces that follow it.
points description.
lines description.
lineloop description.
linestrip description.
tris index numbers of corners that create triangles.
tristrip series of points that form a chain of triangles.
trifan a series of points that create triangles that fan out from a single point. That point, usually in the center, is placed first in the series. Trifans are used only in pyramid and cone-shaped meshes.
quads points that create 4-sided mesh planes.
quadstrip series of points that create a chain of 4-sided planes. Similarly to tristrips, the series zig-zags between the points, starting in the counter-clockwise direction.
polygon same as quads except for planes of more than 4 sides.

Appearance[edit]

DrawInfo is only applied to existing mesh objects. These mesh objects will be altered by DrawInfo parameters.

A common example are spinning objects (angvel parameter in DrawInfo).

LODs can improve framerate as it features substitution of complex mesh objects at given lengthPerPixel steps with more simplistic objects. If the substitution is done decent then it'll be unobtrusive. LODs are used in Louman's Mystic Valley for instance: Shrubbery and trees will change in appearance slightly when viewed from about 200 units away.

Editor Support[edit]

DrawInfo support has been added to obj to bzw converters: Modeltool (available through Git) and php-dIMachine.

History[edit]

DrawInfo was added (by trepan) in BZFlag version 2.0.4 and is rarely used for anything other than experimental and proof-of-concept maps. Notable exceptions to this are trees in Louman's "Mystic Valley" and "Churchyard" maps, and a more recent practical use of moving drawinfo in Planet MoFo's halloween passion map. Following the creation of tools to generate drawinfo from .obj files, it is getting more frequent use by more experienced map makers.