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



add_material

Description

Adds a material to a mesh.


Syntax

gh_object.add_material(
 mesh_id,
 mat_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.add_material(mesh_id, mat_id)
			


average_vertices_normal

Description

Average the normal vector of all vertices.


Syntax

gh_object.average_vertices_normal(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.average_vertices_normal(mesh_id)
			


compute_faces_normal

Description

Computes the normal vector of all faces.


Syntax

gh_object.compute_faces_normal(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.compute_faces_normal(mesh_id)
			


compute_vertices_normal

Description

Computes the normal vector of all vertices.


Syntax

gh_object.compute_vertices_normal(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.compute_vertices_normal(mesh_id)
			


copy_transform

Description

Copies the local transformation from one object to another one.


Syntax

gh_object.copy_transform(
 dst_obj_id,
 src_obj_id
)

Languages


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


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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.flip_faces(mesh_id)
			


flip_vertex_normals

Description

Flip the normals of all vertices.


Syntax

gh_object.flip_vertex_normals(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.flip_vertex_normals(mesh_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


x, y, z, w = gh_object.get_absolute_orientation(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


pitch, yaw, roll = gh_object.get_absolute_orientation_euler_angles(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


x,y,z = gh_object.get_absolute_orientation_vector_z(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


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


get_absolute_position

Description

Gets the absolute position of an object.


Syntax

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

Languages


Parameters


Return Values


Code sample


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


get_distance

Description

Returns the distance between two objects.


Syntax

dist = gh_object.get_distance(
 obj1_id,
 obj2_id
)

Languages


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

mat_id = gh_object.get_material(
 mesh_id,
 material_index
)

Languages


Parameters


Return Values


Code sample


mat_id = gh_object.get_material(mesh_id, 0)
			


get_num_faces

Description

Gets the number of triangular faces of an object.


Syntax

num_faces = gh_object.get_num_faces(
 mesh_id
)

Languages


Parameters


Return Values


Code sample


num_faces = gh_object.get_num_faces(mesh_id)
			


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(
 mesh_id
)

Languages


Parameters


Return Values


Code sample


num_faces = gh_object.get_num_faces_v2(mesh_id)
			


get_num_materials

Description

Gets the number of materials of an object.


Syntax

num_materials = gh_object.get_num_materials(
 mesh_id
)

Languages


Parameters


Return Values


Code sample


num_materials = gh_object.get_num_materials(mesh_id)
			


get_num_vertices

Description

Gets the number of vertices of an object.


Syntax

num_vertices = gh_object.get_num_vertices(
 mesh_id
)

Languages


Parameters


Return Values


Code sample


num_vertices = gh_object.get_num_vertices(mesh_id)
			


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(
 mesh_id
)

Languages


Parameters


Return Values


Code sample


num_vertices = gh_object.get_num_vertices_v2(mesh_id)
			


get_orientation

Description

Gets the relative orientation quaternion of an object.


Syntax

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

Languages


Parameters


Return Values


Code sample


x, y, z, w = gh_object.get_orientation(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


pitch, yaw, roll = gh_object.get_orientation_euler_angles(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


x,y,z = gh_object.get_orientation_vector_z(obj_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(
 obj_id
)

Languages


Parameters


Return Values


Code sample


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


get_plane_equation

Description

Gets the plane equation related to the object orientation.


Syntax

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

Languages


Parameters


Return Values


Code sample


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


get_position

Description

Gets the relative position of an object.


Syntax

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

Languages


Parameters


Return Values


Code sample


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


get_transform

Description

Gets the relative transformation matrix of an object.


Syntax

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

Languages


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(obj_id)
			


remove_all_materials

Description

Removes all materials from an object.


Syntax

gh_object.remove_all_materials(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.remove_all_materials(mesh_id)
			


remove_material

Description

Removes a material from an object.


Syntax

gh_object.remove_material(
 mesh_id,
 mat_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.remove_material(mesh_id, mat_id)
			


render

Description

Renders an object.


Syntax

gh_object.render(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_camera.bind(cam_id)
gh_gpu_program.bind(gpuprog_id)

gh_object.render(mesh_id)
			


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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_program.bind(gpuprog_id)
gh_texture.bind(tex_id, 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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_program.bind(gpuprog_id)
gh_texture.bind(tex_id, 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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_program.bind(gpuprog_id)
gh_texture.bind(tex_id, 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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_program.bind(gpuprog_id)
gh_texture.bind(tex_id, 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(
 mesh_id,
 x, y, z, w
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.rotate_vertices_position(mesh_id, 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(
 mesh_id,
 pitch, yaw, roll
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


scale_vertices_position

Description

Scales the position of all vertices by a scaling vector.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_absolute_transform_update_mode

Description

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


Syntax

gh_object.set_absolute_transform_update_mode(
 obj_id,
 transform_mode
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


-- transform_mode
parent_object = 0 -- default: parent * object
object_parent = 1 -- object * parent

mode = object_parent

gh_object.set_absolute_transform_update_mode(obj_id, mode)
			


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(
 obj_id,
 state,
 uniform_type
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.set_automatic_uniform_state(obj_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(
 obj_id,
 pitch, yaw, roll
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.set_euler_angles(obj_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(
 mesh_id,
 offset
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


offset = 1
gh_object.set_materials_texture_unit_offset(mesh_id, offset)
			


set_orientation

Description

Sets the relative orientation of an object using a quaternion.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


q = {x=0, y=0, z=0, w=1}

gh_object.set_orientation(obj_id, q.x, q.y, q.z, q.w)
			


set_position

Description

Sets the relative position of an object.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_scale

Description

Sets the relative scale of an object.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.set_scale(obj_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(
 mesh_id,
 tessellation
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.set_tessellation_state(mesh_id, 1)
			


set_transform

Description

Sets the relative transformation matrix of an object.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


set_transform_order

Description

Sets the transformation order to build the internal transformation matrix.


Syntax

gh_object.set_transform_order(
 obj_id,
 transform_order
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.set_transform_order(obj_id, 1)
			


set_vertices_color

Description

Sets the color of all vertices.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


smooth_vertices_normal

Description

Average the normal vector of all vertices.


Syntax

gh_object.smooth_vertices_normal(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.smooth_vertices_normal(mesh_id)
			


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(
 obj_id,
 x, y, z
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


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


translate_vertices_position

Description

Translates the position of all vertices by a translation vector.


Syntax

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

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_object.translate_vertices_position(mesh_id, 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(
 mesh_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_gpu_program.bind(gpuprog_id)
gh_texture.bind(tex_id, 0)

gh_object.update_automatic_uniforms(mesh_id)

gh_object.render_geometry(mesh_id)
			






GeeXLab Rootard Guide | Downloads | Contact