Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RexToWavefront ¶ added in v0.4.1
RexToWavefront is a high-level function which generates OBJ/MTL/texture files based on the REXfile content. dir ... directory for the output, needs to exist name ... the name of the files being generation (e.g. name="sphere" would output sphere.obj and sphere.mtl)
Example ¶
package main import ( "bufio" "fmt" "os" "github.com/roboticeyes/gorexfile/encoding/rexfile" ) const ( item = "e39718-b33b-4d2f-b30e-493264d55de3" ) var ( rexFile = "./" + item + ".rex" outDir = "./" + item ) func main() { file, err := os.Open(rexFile) if err != nil { fmt.Println("Cannot open input file", rexFile) } defer file.Close() r := bufio.NewReader(file) d := rexfile.NewDecoder(r) rexHeader, rexContent, err := d.Decode() if err != nil && err.Error() != "unexpected EOF" { fmt.Println(err) } err = RexToWavefront(rexHeader, rexContent, outDir, item) if err != nil { fmt.Println(err) } }
Output:
Types ¶
type ObjToRex ¶
type ObjToRex struct {
// contains filtered or unexported fields
}
ObjToRex container
func NewObjToRexTranslator ¶
NewObjToRexTranslator returns a new translator for converting OBJ files to REX files. It tries to open up the files and creates the according reader
type Translator ¶
Translator interface is a generic interface which converts anything to a rex file
Click to show internal directories.
Click to hide internal directories.