FbxConv task
When building a 3D libgdx game with 3D models created in Blender, you need to convert these models to a format supported by libgdx. Libgdx provides a command line tool to do this: fbx-conv.
The com.eowise.blender.fbxconv.FbxConv
task wrap the fbx-conv command line. You specify the files you want to convert, where to write the converted files, and the format in witch you want to convert the files.
In the example below, the convertFbx
task take all the .fbx
files in the resources folder and convert them to the G3DB format in the assets/3d folder:
You can go further with the methods reference below or with several use cases.
Methods
You can use the above methods to configure a com.eowise.blender.fbxconv.FbxConv
task.
from(Object path)
required
Set the base path of the .fbx files to be converted. The given path is evaluated as per Gradle Project.file().
include(String... includes)
or
include(Closure closure)
Adds an include pattern as defined in Gradle PatternFilterable. This method may be called multiple times to append new patterns.
exclude(String... excludes)
or
exclude(Closure closure)
Adds an exclude pattern as defined in Gradle PatternFilterable. This method may be called multiple times to append new patterns.
into(Object path)
Set the base folder where the converted files will be created. Just like the from
method, the given path is evaluated as per Gradle Project.file().
g3dj()
or
g3db()
required
Use one of the above method to set the type of the output files, either G3DJ or G3DB.
flip()
,
pack()
and other optionals methods
It's possible to set other fbx-conv
flags with theses methods:
Method | Description |
---|---|
flip() |
Flip the V texture coordinates. fbx-conv command line flag
-f |
pack() |
Pack vertex colors to one float. fbx-conv command line flag
-p |
maxVertices(String size) |
The maximum amount of vertices or indices a mesh may contain. fbx-conv command line flag
-m <size> |
maxBones(String size) |
The maximum amount of bones a nodepart can contain. fbx-conv command line flag
-b <size> |
maxBoneWeights(String size) |
The maximum amount of bone weights per vertex. fbx-conv command line flag
-w <size> |