GLSL Hacker
FEATURES DOWNLOAD GALLERY BLOG LEARN



Back to Reference Guide Index

gh_ps Library

Description

gh_ps is the module that manages particle systems.

Number of functions: 11



gh_ps.create

Description

Creates a particle system.

Languages

Lua - Python

Parameters

  • num_particles [INTEGER]: max number of particles.
  • lifetime [REAL]: max life time of particles.

    Return Values

  • ps_id [INTEGER]: particle system identifier

    Code sample


    ps = gh_ps.create(1000, 2.0)



    gh_ps.create_emitter_point

    Description

    Creates a point emitter.

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.

    Return Values

  • emitter_id [INTEGER]: emitter identifier

    Code sample


    emitter = gh_ps.create_emitter_point(ps_id)



    gh_ps.create_action_gravity

    Description

    Creates a gravity action.

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.

    Return Values

  • action_id [INTEGER]: action identifier

    Code sample


    action = gh_ps.create_action_gravity(ps_id)



    gh_ps.process_particles

    Description

    Processes all particles (run simulation).

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.
  • dt [REAL]: time step in seconds.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.process_particles(ps_id, 0.016)



    gh_ps.process_particle_emitters

    Description

    Processes all particles emitters.

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.
  • dt [REAL]: time step in seconds.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.process_particle_emitters(ps_id, 0.016)



    gh_ps.process_particle_actions

    Description

    Processes all particles actions.

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.
  • dt [REAL]: time step in seconds.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.process_particle_actions(ps_id, 0.016)



    gh_ps.update_particles_lifetime

    Description

    Updates the particles life time.

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.
  • dt [REAL]: time step in seconds.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.update_particles_lifetime(ps_id, 0.016)



    gh_ps.get_num_alive_particles

    Description

    Returns the number of alive particles (with lifetime > 0).

    Languages

    Lua - Python

    Parameters

  • ps_id [INTEGER]: particle system identifier.

    Return Values

  • n [INTEGER]: number of alive particles

    Code sample


    n = gh_ps.get_num_alive_particles(ps_id)



    gh_ps.emitter_set_particle_rate_and_speed

    Description

    Sets the particle rate and the particle speed for a particular emitter.

    Languages

    Lua - Python

    Parameters

  • emitter_id [INTEGER]: emitter identifier.
  • rate, speed [REAL]: rate and particle speed.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.emitter_set_particle_rate_and_speed(emitter_id, 100, 4.0)



    gh_ps.emitter_set_spawn_directions

    Description

    Sets the particle spawn directions for a particular emitter.

    Languages

    Lua - Python

    Parameters

  • emitter_id [INTEGER]: emitter identifier.
  • x1, y1, z1 [REAL]: first direction.
  • x2, y2, z2 [REAL]: second direction.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.emitter_set_spawn_directions(emitter_point, -0.1, 0.5, -0.1, 0.1, 1.0, 0.1)



    gh_ps.action_set_gravity

    Description

    Sets the gravity vector of an gravity action.

    Languages

    Lua - Python

    Parameters

  • action_id [INTEGER]: action identifier.
  • x, y, z [REAL]: gravity vector.

    Return Values

    This function has no return value(s).

    Code sample


    gh_ps.action_set_gravity(action_gravity, 0, -9.81, 0)





    2013-2015 Geeks3D. All Rights Reserved.

    .:- G3D Network -:.