App:libobj
Original author(s) | spinout |
---|---|
Written in | C |
Operating system | Cross platform |
Available in | English |
Type | Library |
License | Open Source |
Website | libobj on bitbucket. |
libobj is a library written by spinout for manipulating wavefront obj data. It can read and write obj files and their material (mtl) files, as well as write output in N64 F3DEX2, and Zelda 64 collision. There is also an experimental viewer bundled with libobj.
objn64tool
Originally intended as an example of how to use libobj for obj -> F3DEX2, objn64tool has since grown to a complex converter capable of converting obj not only to F3DEX2 but also to Zelda 64 collision, using functions provided by libobj. It also can produce display lists which are "ready" to have animated materials, outputting a C header and source file defining many aspects of the output.
Latest Win32 binary
Using objn64tool
Make sure you know how to use a command line. I even took the time to do long options.
Usage: objn64tool.exe [options]
Option | Long option | Description |
-h | --help | This help |
-v | --verbose | Be verbose |
-N | --normalize-all | Normalize all materials (EXPERIMENTAL) |
-n MAT | --normalize=MAT | Normalize a specific material (EXPERIMENTAL) |
-C FILE | --consts=FILE | Write constants to file FILE (- for stdout) |
-H FILE | --header=FILE | Write declarations of symbols to FILE |
-i OBJ | --input=OBJ | Convert obj file OBJ |
-o FILE | --output=FILE | Write to file FILE |
-b ADDR | --base=ADDR | Set base address to ADDR (ex: 0x06000000) |
-s SCALE | --scale=SCALE | Multiply verts by SCALE (default 1.0) |
-a MAT | --scroll=MAT | Set up material MAT to be scrolled (See note) |
-c | --collision | Generate collision |
-M OPT | --organize=OPT | See note below |
-E NAME | --collision-exclude=NAME | See note below |
Example:
objn64tool.exe -v -C conf.c -b 0x06000000 -s 2.0 -i test.obj -o test.bin
Converts object test.obj to F3DEX2 binary test.bin, scaling it by 2.0, using base address 0x06000000, writing a configuration to conf.c.
It should be noted that the -a/--scroll option does not make a scrolling texture, but instead, it sets a texture offset to a bank greater than 8 and gives texture information to the file specified by the -C/--consts option. It is intended to use this option in combination with code which sets up banks which play with texture offests - for example, a texture can be made to scroll left-to-right by increasing it's offset by one pixel at a given interval, since the -a option also copies the first row of pixels to an (unused) row of pixels. Again, check out the information the consts file produces when this option is used.
About -M (--organize) and -E (--collision-exclude) options
The -M option specifies what collision types are sorted by. Valid values are:
material
group
smoothinggroup
object
The -E option excludes every one of the object's components that can be categorized by the -M option and the -E argument's option. Take the following options in an example set of options:
-M group -E water_group_00
The -M group tells that collision is to be generated and sorted by groups, and the -E water_group_00 tells the converter not to generate collision for the group named water_group_00. If the -E option is used without the -M option, the sorting is assumed to be done by material.
A similar function for excluding and sorting graphics mesh is planned