Difference between revisions of "HowTo:Edit XMESH files"

From VsWiki
Jump to: navigation, search
(vsnav)
m (fix SVN link)
Line 5: Line 5:
 
}}
 
}}
 
----
 
----
You can find a list of all tags supported in xmesh in [http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/vegastrike/vegastrike/src/gfx/mesh_xml.cpp this] file. (though it's very cryptic for non-programmers)
+
You can find a list of all tags supported in xmesh in [http://vegastrike.svn.sourceforge.net/viewvc/vegastrike/trunk/vegastrike/src/gfx/mesh_xml.cpp?content-type=text%2Fplain this file]. (though it's very cryptic for non-programmers)
  
 
==Syntax of a xmesh file (examples are plucked from here and there, for full description see below):==
 
==Syntax of a xmesh file (examples are plucked from here and there, for full description see below):==

Revision as of 10:42, 30 July 2010

arrow_left.png Editing BFXM files (format spec) arrow_up.png HowTos Add Levels Of Detail arrow_right.png

You can find a list of all tags supported in xmesh in this file. (though it's very cryptic for non-programmers)

Syntax of a xmesh file (examples are plucked from here and there, for full description see below):

<Mesh texture="texturename.png" sharevertex="1" scale="1.0">
<Points>
  <Point>
    <Location x="-0.000000" y="0.330000" z="1.500000"/>
    <Normal i="-2302.996338" j="-5663.045410" k="-1926.291382"/>
  </Point>
  <Point>
    <Location x="-0.000000" y="-0.330000" z="1.500000"/>
    <Normal i="-2302.996338" j="5663.045410" k="-1926.291382"/>
  </Point>
  .......
</Points>

<Polygons>
  <Tri>
    <Vertex point="2" s="0.500000" t="0.500000"/>
    <Vertex point="1" s="0.000000" t="0.500000"/>
    <Vertex point="0" s="0.500000" t="0.000000"/>
  </Tri>
  <Quad>
    <Vertex point="35" s="0.564706" t="0.282353"/>
    <Vertex point="37" s="0.627451" t="0.501961"/>
    <Vertex point="39" s="0.462745" t="0.498039"/>
    <Vertex point="41" s="0.231373" t="0.278431"/>
  </Quad>
  <Trifan>
    <Vertex point="35" s="0.564706" t="0.282353"/>
    <Vertex point="37" s="0.627451" t="0.501961"/>
    <Vertex point="39" s="0.462745" t="0.498039"/>
    <Vertex point="41" s="0.231373" t="0.278431"/>
    <Vertex point="39" s="0.462745" t="0.498039"/>
    <Vertex point="41" s="0.231373" t="0.278431"/>
  </Trifan>
  ......
</Polygons>

<Logo type="5" rotate="0.000000" size="0.500000" offset="0.010000">
  <Ref point="3" weight="1.000000" />
  <Ref point="2" weight="1.000000" />
  <Ref point="9" weight="1.000000" />
</Logo>
.......

<LOD meshfile="asteroid.lod2.xmesh" size="300"/>
<LOD meshfile="noroids.xmesh" size="25"/>
.....

<Material reflect="0.5" LightningOn="0.5" >
  <Diffuse red="1.00000" green="1.00000" blue="1.00000" alpha="1.00000" />
  <Ambient red="1.00000" green="1.00000" blue="1.00000" alpha="1.00000" />
  <Specular red="1.00000" green="1.00000" blue="1.00000" alpha="1.00000" />
</Material>

</Mesh>

Description of the XMesh file syntax

<Mesh ...> </Mesh> - Marks the begin and the end of the mesh(file)

  • Scale - Sets the scaling of the mesh in the game. Values > 1 make the object bigger.
  • texture0 - filename of the texture map for the mesh
  • texture1 - (optional) like 'texture0', except that it is a reflectivity map. It should look fairly similar to the actual texture, just with different colors. See also VsHowtoAddPerPixelLighting.
  • texture2 - (optional) like 'texture0', but this it the damagemap
  • texture3 - (optional) like 'texture0', but this is the glowmap
  • alphamap - (optional) This is the map to be used to set the transparency with blendmode="SRCALPHA INVSRCALPHA". It should be in the same format as the alp files (256 colour greyscale) and is used in the same way, with white solid, and black transparent
  • alphamap2 - (optional) same as 'alphamap' except for reflectivity.
  • alphamap3 - (optional) same as 'alphamap' except for glowmap.
  • sharevertex - (optional) ???????????????
  • blend - (optional) This is the transparency of the mesh.
    • "ONE ZERO" - The mesh will be solid.
    • "ONE ONE" - The mesh will be 50% transparent
    • "SRCALPHA INVSRCALPHA" - The mesh will use the alphamap file to set the transparency.
  • animation - (optional) Allows texture animations. (eg animation="test.ani") See VsHowtoMakeAnimatedTextures. If used it replaces the texture tag and connected tags.
  • animation2 - (optional) Same as animation except for reflectivity. See VsHowtoMakeAnimatedTextures.
  • animation3 - (optional) Same as animation except for glowmap.
  • <Points> </Points> - Marks the begin and the end of the point entries.
    • <Location .../> - Location of the point.
      • x,y,z - Three coordinates of the point in space.
    • <Normal .../> - Normal values
      • i,j,k - the belonging Normal - Values of the points.
  • <Polygons> </Polygons> - Marks the begin and the end of the polygon entries. Polygon points must be specified in counter clockwise order.
    • <Tri> </Tri> - (optional)(repeatable)
      • <Vertex .../> - 3 of this to form a Triangle
        • point - Point number (from Points section)
        • s - texture coordinate (horiz.) at this vertex
        • t - texture coordinate (vert.) at this vertex
    • <Quad> </Quad> - (optional)(repeatable)
      • <Vertex .../> - 4 of this to form a Quad
        • point - Point number (from Points section)
        • s - texture coordinate (horiz.) at this vertex
        • t - texture coordinate (vert.) at this vertex
    • <Trifan> </Trifan> - (optional)(repeatable)
      • <Vertex .../> - 4 or more of this to form a "fan" of triangles with one common vertex (1) in the following way: Tri 1,2,3; Tri 1,3,4; Tri 1,4,5 etc..
        • point - Point number (from Points section)
        • s - texture coordinate (horiz.) at this vertex
        • t - texture coordinate (vert.) at this vertex
    • <Line> </Line> - (optional)(repeatable) - Will draw the face as simple lines (wireframe) without a texture map.
      • <Vertex .../> - an even number of this form seperate lines
        • point - Point number (from Points section)
        • s - N/A
        • t - N/A
  • <LOD .../> - (optional)(repeatable) Level Of Detail entry.
    • meshfile - alternate mesh file to be used for this level of detail.
    • size - number of pixels used by the ship at which this LOD cuts in.
  • <Material ...> </Material> - (optional) ?
    • reflect - reflection of environment ('0'=no, '1'=yes). results in a glassy look.
    • ~LightingOn - ?
    • ~UseNormals - (optional) Define if Vegastrike should use the normals defined in the <Points> section (can be '1' or '0')
    • <Diffuse ... /> - (optional) base color
      • red,green,blue - 0.0 to 1.0
      • alpha - 0.0 = transparent to 1.0 = opaque
    • <Ambient ... /> - (optional) base color in shadow
      • red,green,blue - 0.0 to 1.0
      • alpha - ?
    • <Specular ... /> - (optional) color of reflection (requires reflect='1')
      • red,green,blue - 0.0 to 1.0, high values result in high reflectivity
      • alpha - ?
  • <Logo ... > </Logo> - (optional)(repeatable)
    • type - Logotype
      • 0 - faction logo
      • 1 - squad logo
      • 2 - (2 or higher) internal use
    • rotate - How many degrees the logo is rotated.
    • size - Size of the logo.
    • offset - Offset of polygon of logo.
    • <Ref ... /> - (optional)(repeatable) The order of the points is supposed to be clockwise. Reversing the order should flip it.
      • point - Insert the point numbers here(the reference points that the logo is weighted against).
      • weight - The weight of the points in weighted average of reference points.

arrow_left.png Editing BFXM files (format spec) arrow_up.png HowTos Add Levels Of Detail arrow_right.png