Quick Links
> Homepage
|-- Overview
|-- Download
|-- Screenshots
|-- Community

> Code Sample Pack

> Reference Guide

> Changelog

> Overview of GLSL Hacker
> Live Coding
> Hack your first GLSL Code
> Moon3D


GLSL Hacker Articles

> Compute shaders on Radeon
> Distance functions in GLSL
> GLSL Interpolation Qualifiers
> Tessellation Spacing Modes
> Normal Visualizer with GS
> 3D Surface Plots
> Normal Mapping
> Circle and Disc in GLSL
> PhysX 3 Flag Demo
> GLSL Hacker on Raspberry Pi
GLSL Hacker

Reference Guide
Host-API Lua / Python



Back to Homepage
Back to Developer's 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.

    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.

    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.

    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.

    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.

    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.

    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.

    Code sample :

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





  • (C)2012-2013 Geeks3D