HowTo:Edit BFXM files

From VsWiki
Jump to: navigation, search
arrow_left.png Using animated textures on a model arrow_up.png HowTos Editing XMESH files arrow_right.png

NOTE: It is generally recommended that you use mesher to convert from BFXM to XMESH and back again for the purposes of editing. However, here is the specification for BFXM files.

Format for version 0.2

All data stored in little endian order except for strings.

Visual layout:

<SuperHeader

<Record header
<Mesh header,attributes,geometry>
<Mesh header, attributes,geometry>
...
<Mesh header, attributes,geometry>
>
<Record header
<Mesh header,attributes,geometry>
<Mesh header, attributes,geometry>
...
<Mesh header, attributes,geometry>
>
...
<Record header
<Mesh header,attributes,geometry>
<Mesh header, attributes,geometry>
...
<Mesh header, attributes,geometry>
>

>

Per record visual layout:

<Record header

<Top Mesh header,attributes,geometry>
<First LOD Mesh header, attributes,geometry>
...
<Last LOD Mesh header, attributes,geometry>
<First Anim Mesh header, attributes,geometry>
...
<Last Anim Mesh header, attributes,geometry>

>


SuperHeader

Type String:'BFXM'

Version number*100:Integer

File length in bytes: Integer

Superheader Length in bytes: Integer

Number of fields per vertex:integer (8)

Number of fields per polygon structure: integer (1)

Number of fields per referenced vertex: integer (3)

Number of fields per referenced animation: integer (1)

Number of records: integer

Number of fields per animation definition: integer (1)

End SuperHeader

Record Header

for each record:

Size of record header in bytes: integer
Size of record in bytes: integer
number of meshes:integer

End Record Header

For each mesh:

Header

Size of Header in bytes: integer

Size of mesh in bytes: integer

Scale: float

Reverse: integer

Forcetexture: integer

Sharevert: integer

Polygonoffset:float

Blendmode:<bsrc:integer,bdest:integer>

Material<Power:float,Ambient.RGBA:4 floats,Diffuse.RGBA:4 floats,Emissive.RGBA:4 floats,Specular.RGBA:4

floats,Cullface:integer,lighting:integer,reflect:integer,usenormals:integer>

End Header

Arbitrary length attributes

Size of Arbitrary length attributes in bytes: integer

Detail Texture:

Name Length: integer
Name: char string
Word alignment padding: string of bytes (all 0)

Number of Detail Planes: integer

for each plane:
<x:float,y:float,z:float>

Number of Textures: integer

for each texture:
type: integer
index: integer
namelength: integer
Name: char string
Word alignment padding: string of bytes (all 0)

Number of Logos: Integer

for each logo:
size:float
offset: float
rotation: float
type: integer
numrefs:integer
for each ref:
refnum: integer
weight: float

Number of LODs: integer (Must be 0 for LOD or animation meshes)

for each LOD:
Size: float
Mesh offset number: integer

Number of animations: integer (Must be 0 for animation mesh)

for each animation:

length of name: integer
name: string
Word alignment padding: string of bytes (all 0)
FPS: float
number of frames:integer
for each frame:
Mesh offset number: integer

End Arbitrary length attributes

Geometry

Number of vertices: integer

for each vertex:
<x:float,y:float,z:float,i:float,j:float,k:float,s:float,t:float>

Number of Lines: integer

for each line:
<flatshade:integer,2 <index:integer,s:float,t:float>>

Number of Triangles: integer

for each triangle:
<flatshade:integer,3 <index:integer,s:float,t:float>>

Number of Quads: integer

for each Quad:
<flatshade:integer,4 <index:integer,s:float,t:float>>

Number of Linestrips:

for each Linestrip:
Number of elements in current Linestrip: Integer
Flatshade: integer (always 0 actually... could optimize out)
for each element:
<index:integer,s:float,t:float>

Number of Tristrips:

for each Tristrip:
Number of elements in current Tristrip: Integer
Flatshade: integer (always 0 actually... could optimize out)
for each element:
<index:integer,s:float,t:float>

Number of Trifans:

for each Trifan:
Number of elements in current Trifan: Integer
Flatshade: integer (always 0 actually... could optimize out)
for each element:
<index:integer,s:float,t:float>

Number of Quadstrips:

for each:
Number of elements in current Quadstrip: Integer
Flatshade: integer (always 0 actually... could optimize out)
for each element:
<index:integer,s:float,t:float>

End Geometry


See also



arrow_left.png Using animated textures on a model arrow_up.png HowTos Editing XMESH files arrow_right.png