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

Editing Mesh

Jump to: navigation, search

Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.

The administrator who locked it offered this explanation: Archived wiki

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
A mesh is a [[BZW]] map object that defines an arbitrary three dimensional shape. A mesh is defined as a series of faces containing 3 or more points(vertices) in three dimensional space.
+
A mesh is a [[BZW]] map object that defines an arbitrary three dimensional shape. A mesh is defined as a series of faces containing 3 or more points in three dimensional space ( or a vertex ).
  
 
==Code==
 
==Code==
Line 7: Line 7:
 
  mesh
 
  mesh
 
   name example_mesh
 
   name example_mesh
    #
+
  # Material properties applied to a mesh apply to all faces
    # Material properties and physics applied to a mesh apply to all faces
+
  # that follow the setting. Mesh faces will alter their own
    # that follow the setting. Mesh faces will alter their own
+
  # properties without affecting the state of the mesh properties.
    # properties without affecting the state of the mesh properties.
+
  # The same pattern is used to apply physics drivers.
    #
+
 
   inside 5.5 4.5 1.2 # add an inside point (repeatable)  
 
   inside 5.5 4.5 1.2 # add an inside point (repeatable)  
 
   outside 0 0 1000 # add an outside point (repeatable)  
 
   outside 0 0 1000 # add an outside point (repeatable)  
Line 36: Line 35:
 
     shootthrough  
 
     shootthrough  
 
     passable  
 
     passable  
     matref
+
     material
 
   endface # end the face  
 
   endface # end the face  
  #
+
  #
  The drawInfo element can be added to increase the rendering speed
+
  This next element can be added to increase the rendering speed
  #  of the mesh object. If the client is capable of using this data,
+
  #  of the mesh object. If the client is capable of using this data,
  #  then it is used to draw the mesh instead of the face  information.
+
  #  then it is used to draw the mesh instead of the face  information.
  #
+
  #
 +
  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
 
  end   # mesh
 
  end   # mesh
 
|}
 
|}
  
Valid parameters for a mesh are:
+
Valid parameters for a mesh are
{|{{Prettytable}}
+
<properties>
|-
+
name=The name of the mesh
| {{Hl3}} |'''Parameters'''
+
vertex=Add a vertex to the mesh (repeatable); this is a 'corner' of your mesh - a point where faces connect.
| {{Hl3}} |'''Description'''
+
normal=Add a normal to the mesh  (repeatable)
|-
+
texcoord=Add a texture coordinate (repeatable); this is used for mapping textures onto complicated meshes.
| '''name''' || The name of the mesh.
+
phydrv=Assign a physics driver to the entire mesh.
|-
+
smoothbounce=Ricochets use normals.
| '''vertex''' || this is a 'corner' of your mesh - a point where faces connect. (at least 3 are required).
+
noclusters=Render each face individually.
|-
+
shift=repeatable
| '''normal''' || a unit vector describing the direction light will reflect off the object.
+
scale=repeatable
|-
+
shear=repeatable
| '''texcoord''' || this is used for mapping textures onto the mesh.  This will link a point of the 2-Dimensional texture to a vertex on the 3-Dimensional object.  (0,0) refers to the lower left corner of the texture, (1,1) refers to the top right.  Textures are defined in the [[material]] object.
+
spin=repeatable
|-
+
matref=Assgn a material to all below faces.
| '''inside''' || an arbitrary vertex placed on the inside of the mesh object.  This keeps tanks from driving or spawning inside the object.
+
face=Start a face (repeatable), see below:
|-
+
</properties>
| '''phydrv''' || Assign a physics driver as defined in the [[physics]] object.
+
|-
+
| '''smoothbounce''' || shot will ricochet from the face in the same direction as the defined normal.
+
|-
+
| '''noclusters''' || Render each face individually.
+
|-
+
| '''shift''' || places the mesh using <x y z> coordinates.
+
|-
+
| '''scale''' || resizes the mesh along the x, y, or z axis.
+
|-
+
| '''shear''' || repeatable.
+
|-
+
| '''spin''' || spins the mesh <angle> number of degrees, <n> number of rotations along one or more of the x, y, or z axis.
+
|-
+
| '''drivethrough''' || Tanks can drive through this mesh.
+
|-
+
| '''shootthrough''' || Tanks can shoot through this mesh.
+
|-
+
| '''passable''' || Tanks can both shoot and drive through this mesh.
+
|-
+
| '''matref''' || Assign a [[material]] to all below faces.
+
|-
+
| '''face''' || Start a face (required), see below.
+
|}
+
 
Valid parameters within the face sub-object:
 
Valid parameters within the face sub-object:
{|{{Prettytable}}
+
<properties>
|-
+
verticies=Numbered list of verticies for this face, requires at least three.
| {{Hl3}} |'''Sub-object'''
+
normals=Numbered list of normals for this face.
| {{Hl3}} |'''Description'''
+
texcoords=Numbered list of texture coordinates for this face.
|-
+
phydrv=Assign a physics driver to this face only.
| '''vertices''' || Numbered list of vertices for this face. (requires at least three).
+
smoothbounce'''
|-
+
noclusters'''
| '''normals''' || Numbered list of normals for this face.
+
drivethrough=Tanks can drive through this face.
|-
+
shootthrough=Tanks can shoot through this face.
| '''texcoords''' || Numbered list of texture coordinates for this face.
+
passable=Tanks can both shoot and drive through this face
|-
+
matref=Assign a material to this face.
| '''phydrv''' || Assign a [[Physics|physics driver]] to this face only.
+
endface''' End this face.
|-
+
</properties>
| '''smoothbounce''' || use normals to determine shot ricochets for this face.
+
{{ToDo|Document drawinfo code.}}
|-
+
Meshes have full support for [[Material]], [[Texture Matrix]], and [[Physics Drivers]].
| '''noclusters''' || ?.
+
|-
+
| '''drivethrough''' || Tanks can drive through this face.
+
|-
+
| '''shootthrough''' || Tanks can shoot through this face.
+
|-
+
| '''passable''' || Tanks can both shoot and drive through this face.
+
|-
+
| '''matref''' || Assign a [[material]] to this face.
+
|}
+
Meshes have full support for [[Material]] (wherein custom textures can be defined) and [[Physics Drivers]].
+
 
+
==DrawInfo==
+
[[DrawInfo]] can be added to the mesh object to increase rendering efficiency, allowing the designer to specify which details will be seen from certain distances.  It can also be used to rotate a mesh object, though tanks can not interact with the moving object.
+
  
 
==Appearance==
 
==Appearance==
The shape of a mesh will vary greatly as by its very nature it can be defined to look like anything.  Unless a material is defined and applied, the default "mesh.png" texture will be applied to all faces of the mesh.
+
The appearance of a mesh will vary greatly as by it's very nature it can be defined to look like anything.
 
+
==Simplified Examples==
+
{|
+
|Simple Cube
+
mesh
+
    vertex -10 -10  0
+
    vertex  10 -10  0
+
    vertex  10  10  0
+
    vertex -10  10  0
+
    vertex -10 -10 10
+
    vertex  10 -10 10
+
    vertex  10  10 10
+
    vertex -10  10 10
+
    face #south
+
        vertices 0 1 5 4
+
    endface
+
    face #east
+
        vertices 1 2 6 5
+
    endface
+
    face #north
+
        vertices 2 3 7 6
+
    endface
+
    face #west
+
        vertices 3 0 4 7
+
    endface
+
    face #bottom
+
        vertices 0 1 2 3
+
    endface
+
    face #top
+
        vertices 4 5 6 7
+
    endface
+
end #mesh
+
|Simple billboard with texcoords
+
mesh
+
    vertex -10 0  0
+
    vertex  10 0  0
+
    vertex  10 0 10
+
    vertex -10 0 10
+
    texcoord 0 0
+
    texcoord 1 0
+
    texcoord 1 1
+
    texcoord 0 1
+
    matref myBillboard
+
    face
+
        vertices 0 1 2 3
+
        texcoords 0 1 2 3
+
    endface
+
    face #backside
+
        vertices 1 0 3 2
+
        texcoords 1 0 3 2
+
    endface
+
end #mesh
+
|Simple Jump-through floor
+
mesh
+
    vertex  0  0  9
+
    vertex 10  0  9
+
    vertex 10 10  9
+
    vertex  0 10  9
+
    vertex  0  0 10
+
    vertex 10  0 10
+
    vertex 10 10 10
+
    vertex  0 10 10
+
    face #south
+
        vertices 0 1 5 4
+
        drivethrough
+
    endface
+
    face #east
+
        vertices 1 2 6 5
+
        drivethrough
+
    endface
+
    face #north
+
        vertices 2 3 7 6
+
        drivethrough
+
    endface
+
    face #west
+
        vertices 3 0 4 7
+
        drivethrough
+
    endface
+
    face #bottom
+
        vertices 0 1 2 3
+
        drivethrough
+
    endface
+
    face #top
+
        vertices 4 5 6 7
+
    endface
+
end #mesh
+
|}
+
 
+
==Inside Points==
+
An inside point allows the mapper to make a mesh solid. This means that regardless of what the player tries to do, they will not be able to go through the object, or end up spawning inside a mesh unintentionally. When you drive through a box, especially with the Oscillation Overthruster flag, you will be inside of a building and sealed to it. Without inside points, especially to larger meshes, you will just end up on the inside of it and be able to shoot and drive normally. This is sometimes intentional, but usually not wanted. Inside points remedy this.
+
 
+
In order to have successful inside point coverage, you need to make sure all faces of your mesh are in "line of sight" to the point you specify. This means that all faces have direct vision to that point, just as if that point was a point of light and all the faces were eyes. Only what can be seen through a straight line will be considered the inside for that face.
+
  
 
==Editor Support==
 
==Editor Support==
The mesh object is supported by the [[BZWTools]] blender plugin, the Wings3D Exporter and hand coding.
+
The mesh object is supported by the [[BZWTools]] blender plugin, the Wings3D Exporter or hand coding.
  
 
==History==
 
==History==

Please note that all contributions to BZFlagWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BZFlagWiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Templates used on this page:

Retrieved from "https://wiki.bzflag.org/Mesh"