» Back to Reference Guide Index
gh_model Library
Descriptiongh_model is the module that manages models.
A model node allows to define a 3d model. A model is a hierarchy of objects mainly made out of meshes.
Some objects like gizmos (a very simple object node) may belong to this hierarchy to act as a pivot point on which more
complex structures can be built. To keep it simple let's say a model is a kind of interface for easily modifying the properties
of a number of meshes (children). GLSL Hacker can load directly many 3D models formats such as *.3ds, *.obj, *.x, etc.
Number of functions: 5
gh_model.create_from_file
Description
Loads a 3d object filename and creates a model.
LanguagesLua - Python
Parameters
model_filename [STRING]: 3d object filename.
model_directory [STRING]: directory of the model filename.
resource_directory [STRING]: directory of the resources used by the model (usually textures).
Return Values
model [INTEGER]: model identifier
Code sample
model_filename = "wheel.3ds"
model_directory = "data/"
resource_directory = "data/"
model = gh_model.create_from_file(model_filename, model_directory, resource_directory)
gh_model.create_from_file_loader_3ds
Description
Loads a *.3ds object filename and creates a model.
LanguagesLua - Python
Parameters
model_filename [STRING]: 3d object filename.
model_directory [STRING]: directory of the model filename.
resource_directory [STRING]: directory of the resources used by the model (usually textures).
Return Values
model [INTEGER]: model identifier
Code sample
model_filename = "wheel.3ds"
model_directory = "data/"
resource_directory = "data/"
model = gh_model.create_from_file_loader_3ds(model_filename, model_directory, resource_directory)
gh_model.create_from_file_loader_obj
Description
Loads a *.obj object filename and creates a model.
LanguagesLua - Python
Parameters
model_filename [STRING]: 3d object filename.
model_directory [STRING]: directory of the model filename.
resource_directory [STRING]: directory of the resources used by the model (usually textures).
Return Values
model [INTEGER]: model identifier
Code sample
model_filename = "wheel.obj"
model_directory = "data/"
resource_directory = "data/"
model = gh_model.create_from_file_loader_obj(model_filename, model_directory, resource_directory)
gh_model.create_from_file_loader_fbx
Description
Loads a *.fbx, *.3ds or *.obj object filename and creates a model.
LanguagesLua - Python
Parameters
model_filename [STRING]: 3d object filename.
model_directory [STRING]: directory of the model filename.
resource_directory [STRING]: directory of the resources used by the model (usually textures).
Return Values
model [INTEGER]: model identifier
Code sample
model_filename = "wheel.fbx"
model_directory = "data/"
resource_directory = "data/"
model = gh_model.create_from_file_loader_fbx(model_filename, model_directory, resource_directory)
gh_model.load_textures
Description
Loads all textures associated with the model. Once the model is loaded, you can load all textures using this function.
LanguagesLua - Python
Parameters
model [INTEGER]: model identifier.
texture_directory [STRING]: Specifies the textures directory.
Return Values
This function has no return value(s).
Code sample
gh_model.load_textures(model "data/")
2013-2015 Geeks3D. All Rights Reserved.
.:- G3D Network -:.
|