< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_object library

Description

gh_object is the module that manages all renderable nodes, in other terms the objects. A mesh or a camera is an object while a texture is not an object (it's a resource).


Number of functions: 52

  1. gh_object.add_material (Lua - Python)
  2. gh_object.average_vertices_normal (Lua)
  3. gh_object.compute_faces_normal (Lua - Python)
  4. gh_object.compute_vertices_normal (Lua)
  5. gh_object.copy_transform (Lua - Python)
  6. gh_object.create (Lua - Python)
  7. gh_object.flip_faces (Lua - Python)
  8. gh_object.flip_vertex_normals (Lua - Python)
  9. gh_object.get_absolute_orientation (Lua - Python)
  10. gh_object.get_absolute_orientation_euler_angles (Lua - Python)
  11. gh_object.get_absolute_orientation_vectors (Lua - Python)
  12. gh_object.get_absolute_orientation_vector_z (Lua - Python)
  13. gh_object.get_absolute_position (Lua - Python)
  14. gh_object.get_distance (Lua - Python)
  15. gh_object.get_material (Lua - Python)
  16. gh_object.get_num_faces (Lua - Python)
  17. gh_object.get_num_faces_v2 (Lua - Python)
  18. gh_object.get_num_materials (Lua - Python)
  19. gh_object.get_num_vertices (Lua - Python)
  20. gh_object.get_num_vertices_v2 (Lua - Python)
  21. gh_object.get_orientation (Lua - Python)
  22. gh_object.get_orientation_euler_angles (Lua - Python)
  23. gh_object.get_orientation_vectors (Lua - Python)
  24. gh_object.get_orientation_vector_z (Lua - Python)
  25. gh_object.get_plane_equation (Lua - Python)
  26. gh_object.get_position (Lua - Python)
  27. gh_object.get_transform (Lua - Python)
  28. gh_object.set_transform (Lua - Python)
  29. gh_object.remove_material (Lua - Python)
  30. gh_object.remove_all_materials (Lua - Python)
  31. gh_object.render (Lua - Python)
  32. gh_object.render_geometry (Lua - Python)
  33. gh_object.render_geometry_draw (Lua - Python)
  34. gh_object.render_geometry_finish (Lua - Python)
  35. gh_object.render_geometry_prepare (Lua - Python)
  36. gh_object.rotate_vertices_position (Lua - Python)
  37. gh_object.rotate_vertices_position_euler_xyz (Lua - Python)
  38. gh_object.scale_vertices_position (Lua - Python)
  39. gh_object.set_automatic_uniform_state (Lua - Python)
  40. gh_object.set_euler_angles (Lua - Python)
  41. gh_object.set_materials_texture_unit_offset (Lua - Python)
  42. gh_object.set_orientation (Lua - Python)
  43. gh_object.set_position (Lua - Python)
  44. gh_object.set_scale (Lua - Python)
  45. gh_object.set_tessellation_state (Lua - Python)
  46. gh_object.set_absolute_transform_update_mode (Lua - Python)
  47. gh_object.set_transform_order (Lua - Python)
  48. gh_object.set_vertices_color (Lua - Python)
  49. gh_object.smooth_vertices_normal (Lua)
  50. gh_object.transform_update_scale (Lua - Python)
  51. gh_object.translate_vertices_position (Lua - Python)
  52. gh_object.update_automatic_uniforms (Lua - Python)



add_material

Description

Adds a material to an object.


Syntax

gh_object.add_material(
 object_id,
 material_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.add_material(mesh, material_id)
            


average_vertices_normal

Description

Average the normal vector of all vertices. Alias: smooth_vertices_normal


Syntax

gh_object.average_vertices_normal(
 object_id
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.average_vertices_normal(mesh)
            


compute_faces_normal

Description

Computes the normal vector of all faces.


Syntax

gh_object.compute_faces_normal(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.compute_faces_normal(mesh)
            


compute_vertices_normal

Description

Computes the normal vector of all vertices.


Syntax

gh_object.compute_vertices_normal(
 object_id
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.compute_vertices_normal(mesh)
            


copy_transform

Description

Copies the local transformation from one object to another one.


Syntax

gh_object.copy_transform(
 dst_object,
 src_object
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.copy_transform(dst, src)
            


create

Description

Create a minimal object that can be rendered with a tripod (its local space).


Syntax

object_id = gh_object.create()

Languages

Lua - Python


Parameters

This function has no input parameter(s).


Return Values


Code sample

    
gizmo = gh_object.create()
            


flip_faces

Description

Flip the faces of a triangular object (a mesh).


Syntax

gh_object.flip_faces(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.flip_faces(object_id)
            


flip_vertex_normals

Description

Flip the normals of all vertices.


Syntax

gh_object.flip_vertex_normals(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.flip_vertex_normals(object_id)
            


get_absolute_orientation

Description

Gets the quaternion that represents the absolute orientation of an object.


Syntax

x, y, z, w = gh_object.get_absolute_orientation(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_object.get_absolute_orientation(object_id)
            


get_absolute_orientation_euler_angles

Description

Gets the absolute orientation of an object using the Euler's angles.


Syntax

pitch, yaw, roll = gh_object.get_absolute_orientation_euler_angles(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
pitch, yaw, roll = gh_object.get_absolute_orientation_euler_angles(object_id)
            


get_absolute_orientation_vectors

Description

Gets the 3 axis that describe the absolute orientation of an object.


Syntax

x0,y0,z0, x1,y1,z1, x2,y2,z2 = gh_object.get_absolute_orientation_vectors(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x0,y0,z0,  x1,y1,z1,  x2,y2,z2 = gh_object.get_absolute_orientation_vectors(object_id)
            


get_absolute_orientation_vector_z

Description

Gets the Z axis of the absolute orientation of an object.


Syntax

x,y,z = gh_object.get_absolute_orientation_vector_z(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x,y,z = gh_object.get_absolute_orientation_vector_z(object_id)
            


get_absolute_position

Description

Gets the absolute position of an object.


Syntax

x, y, z = gh_object.get_absolute_position(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z = gh_object.get_absolute_position(object_id)
            


get_distance

Description

Returns the distance between two objects.


Syntax

dist = gh_object.get_distance(
 object1_id,
 object2_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
dist = gh_object.get_distance(object1_id, object2_id)
            


get_material

Description

Gets a material from its index (0 ; get_num_materials()-1).


Syntax

material_id = gh_object.get_material(
 object_id,
 material_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
material_id = gh_object.get_material(mesh, 0)
            


get_num_faces

Description

Gets the number of triangular faces of an object.


Syntax

num_faces = gh_object.get_num_faces(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_faces = gh_object.get_num_faces(mesh)
            


get_num_faces_v2

Description

Gets the number of triangular faces of an object and its whole hierarchy.


Syntax

num_faces = gh_object.get_num_faces_v2(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_faces = gh_object.get_num_faces_v2(mesh)
            


get_num_materials

Description

Gets the number of materials of an object.


Syntax

num_materials = gh_object.get_num_materials(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_materials = gh_object.get_num_materials(mesh)
            


get_num_vertices

Description

Gets the number of vertices of an object.


Syntax

num_vertices = gh_object.get_num_vertices(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_vertices = gh_object.get_num_vertices(mesh)
            


get_num_vertices_v2

Description

Gets the number of vertices of an object and its whole hierarchy.


Syntax

num_vertices = gh_object.get_num_vertices_v2(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
num_vertices = gh_object.get_num_vertices_v2(mesh)
            


get_orientation

Description

Gets the relative orientation quaternion of an object.


Syntax

x, y, z, w = gh_object.get_orientation(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z, w = gh_object.get_orientation(object_id)
            


get_orientation_euler_angles

Description

Gets the relative orientation of an object using the Euler's angles.


Syntax

pitch, yaw, roll = gh_object.get_orientation_euler_angles(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
pitch, yaw, roll = gh_object.get_orientation_euler_angles(object_id)
            


get_orientation_vectors

Description

Gets the 3 axis that describe the relative orientation of an object.


Syntax

x0,y0,z0, x1,y1,z1, x2,y2,z2 = gh_object.get_orientation_vectors(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x0,y0,z0,  x1,y1,z1,  x2,y2,z2 = gh_object.get_orientation_vectors(object_id)
            


get_orientation_vector_z

Description

Gets the Z axis of the relative orientation of an object.


Syntax

x,y,z = gh_object.get_orientation_vector_z(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x,y,z = gh_object.get_orientation_vector_z(object_id)
            


get_plane_equation

Description

Gets the plane equation related to the object orientation.


Syntax

a, b, c, d = gh_object.get_plane_equation(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
a, b, c, d = gh_object.get_plane_equation(object_id)
            


get_position

Description

Gets the relative position of an object.


Syntax

x, y, z = gh_object.get_position(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
x, y, z = gh_object.get_position(object_id)
            


get_transform

Description

Gets the relative transformation matrix of an object.


Syntax

m0, m1, ..., m15 = gh_object.get_transform(
 object_id
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = gh_object.get_transform(object_id)
            


set_transform

Description

Sets the relative transformation matrix of an object.


Syntax

gh_object.set_transform(
 object_id,
 m0, m1, ..., m15
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_transform(object_id, m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15)
            


remove_material

Description

Removes a material from an object.


Syntax

gh_object.remove_material(
 object_id,
 material_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.remove_material(mesh, material_id)
            


remove_all_materials

Description

Removes all materials from an object.


Syntax

gh_object.remove_all_materials(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.remove_all_materials(mesh)
            


render

Description

Renders an object.


Syntax

gh_object.render(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_camera.bind(camera)
gh_gpu_program.bind(prog)
gh_object.render(mesh)
            


render_geometry

Description

Renders only the object geometry. Automatic uniforms are not updated and you have to call gh_object.update_automatic_uniforms() before calling render_geometry().


Syntax

gh_object.render_geometry(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_program)
gh_texture.bind(texture, 0)
gh_object.update_automatic_uniforms(mesh_plane)
gh_object.render_geometry(mesh_plane)
            


render_geometry_draw

Description

Draws the geometry.


Syntax

gh_object.render_geometry_draw(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_program)
gh_texture.bind(texture, 0)
gh_object.update_automatic_uniforms(mesh_plane)
gh_object.render_geometry_prepare(mesh_plane)
gh_object.render_geometry_draw(mesh_plane)
gh_object.render_geometry_finish(mesh_plane)
            


render_geometry_finish

Description

Finishes the geometry drawing.


Syntax

gh_object.render_geometry_finish(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_program)
gh_texture.bind(texture, 0)
gh_object.update_automatic_uniforms(mesh_plane)
gh_object.render_geometry_prepare(mesh_plane)
gh_object.render_geometry_draw(mesh_plane)
gh_object.render_geometry_finish(mesh_plane)
            


render_geometry_prepare

Description

Prepares the geometry drawing.


Syntax

gh_object.render_geometry_prepare(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_program)
gh_texture.bind(texture, 0)
gh_object.update_automatic_uniforms(mesh_plane)
gh_object.render_geometry_prepare(mesh_plane)
gh_object.render_geometry_draw(mesh_plane)
gh_object.render_geometry_finish(mesh_plane)
            


rotate_vertices_position

Description

Rotates the position of all vertices by a rotation quaternion.


Syntax

gh_object.rotate_vertices_position(
 object_id,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.rotate_vertices_position(mesh, x, y, z, w)
            


rotate_vertices_position_euler_xyz

Description

Rotates the position of all vertices using Euler's angles.


Syntax

gh_object.rotate_vertices_position_euler_xyz(
 object_id,
 pitch, yaw, roll
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.rotate_vertices_position_euler_xyz(mesh, pitch, yaw, roll)
            


scale_vertices_position

Description

Scales the position of all vertices by a scaling vector.


Syntax

gh_object.scale_vertices_position(
 object_id,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.scale_vertices_position(mesh, x, y, z)
            


set_automatic_uniform_state

Description

Set the state (enabled or disabled) of automatic uniforms. If state is 0, the automatic uniforms specified by the mask are no longer send to the current GPU program.


Syntax

gh_object.set_automatic_uniform_state(
 object_id,
 uniform_type
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_automatic_uniform_state(object_id, state, "camera")
            


set_euler_angles

Description

Sets the relative orientation of an object using the Euler's angles.


Syntax

gh_object.set_euler_angles(
 object_id,
 pitch, yaw, roll
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_euler_angles(object_id, pitch, yaw, roll)
            


set_materials_texture_unit_offset

Description

Specifies an offset to apply to material texture units. Useful with shadow mapping for example.


Syntax

gh_object.set_materials_texture_unit_offset(
 object_id,
 offset
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
offset = 1                
gh_object.set_materials_texture_unit_offset(object_id, offset)
            


set_orientation

Description

Sets the relative orientation of an object using a quaternion.


Syntax

gh_object.set_orientation(
 object_id,
 x, y, z, w
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


q = {x=0, y=0, z=, w=1}
gh_object.set_orientation(object_id, q.x, q.y, q.z, q.w)
            


set_position

Description

Sets the relative position of an object.


Syntax

gh_object.set_position(
 object_id,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_position(mesh, x, y, z)
            


set_scale

Description

Sets the relative scale of an object.


Syntax

gh_object.set_scale(
 object_id,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_scale(object_id, x, y, z)
            


set_tessellation_state

Description

Enables the rendering with hardware tessellation (OpenGL 4+). A tessellation GPU program is also required. This function works with meshes and models.


Syntax

gh_object.set_tessellation_state(
 object_id,
 state
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_tessellation_state(mesh, 1)
            


set_absolute_transform_update_mode

Description

Sets the tranformation mode (or order) to build the absolute tranformation matrix: 0 (parent * object) or 1 (object * parent).


Syntax

gh_object.set_absolute_transform_update_mode(
 object_id,
 mode
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
mode = 0 -- 0, 1, 2 or 3            
gh_object.set_absolute_transform_update_mode(object_id, mode)
            


set_transform_order

Description

Sets the tranformation order to build the internal tranformation matrix.


Syntax

gh_object.set_transform_order(
 object_id,
 transform_order
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_transform_order(object_id, 1)
            


set_vertices_color

Description

Sets the color of all vertices.


Syntax

gh_object.set_vertices_color(
 object_id,
 r, g, b, a
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.set_vertices_color(mesh, r, g, b, a)
            


smooth_vertices_normal

Description

Average the normal vector of all vertices. Alias: average_vertices_normal


Syntax

gh_object.smooth_vertices_normal(
 object_id
)

Languages

Lua


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.smooth_vertices_normal(mesh)
            


transform_update_scale

Description

Handy function to update the scale of the relative transformation matrix. Position is also updated.


Syntax

gh_object.transform_update_scale(
 object_id,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.transform_update_scale(object_id, x, y, z)
            


translate_vertices_position

Description

Translates the position of all vertices by a translation vector.


Syntax

gh_object.translate_vertices_position(
 object_id,
 x, y, z
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_object.translate_vertices_position(mesh, x, y, z)
            


update_automatic_uniforms

Description

Updates automatic uniforms that are sent to any GLSL program. These uniforms include: gxl3d_ProjectionMatrix, gxl3d_ViewMatrix, gxl3d_ViewProjectionMatrix, gxl3d_ModelProjectionMatrix and gxl3d_Viewport. This function can be used with render_geometry() and render_geometry_xxx() functions.


Syntax

gh_object.update_automatic_uniforms(
 object_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_gpu_program.bind(gpu_program)
gh_texture.bind(texture, 0)
gh_object.update_automatic_uniforms(mesh)
gh_object.render_geometry(mesh)
            






GeeXLab Rootard Guide | Downloads | Contact | Newsletter