Skip to content

glTF models

zeganstyl edited this page Sep 18, 2020 · 1 revision

What is glTF, you can see here

Thelema engine is build to primarly support glTF 2.0.

Some things from glTF, such as cubic interpolation and morphing, are not yet implemented.

Thelema have glTF loader class GLTF, which can load models from files.

How to load:

val gltf = GLTF(FS.internal("path/to/file.gltf"))
gltf.load {
	// do somthing with assets

	// get arrays of assets
	gltf.objects
	gltf.meshes
	gltf.materials
	gltf.animations
	// etc...

	// get main scene:
	gltf.scenes[gltf.mainSceneIndex].scene
}

Content is loaded asynchronously, so you may need to access assets only when the load {} lambda is called. So wrap your code in curly braces.

GLTF have conf property with type GLTFConf. It may used to specify the loading process. For example you can set gltf.conf.separateThread = true to load content on a separate thread.

GLSL nodes is generating when loading materials. Also, may be generated GLSL nodes for additonal shaders, such as velocity rendering or depth rendering. You can specify shaders generating parameters in gltf.conf.

GLTF implements interface IGLTF, and you can implement your own loader. For example, Thelema have own model format THTF.

Clone this wiki locally