ogltk-lightsource

Name

ogltk-lightsource -- A base class for creating lightsources within a scene.

Synopsis


#include <ogltk/lightsource.h>


struct      ogltk_lightsource;
enum        OgltkLightSource;
enum        OgltkLightFlick;
gboolean    ogltk_lightsource_set_ambient_color
                                            (ogltk_lightsource *light,
                                             gfloat red,
                                             gfloat green,
                                             gfloat blue,
                                             gfloat alpha);
gboolean    ogltk_lightsource_set_diffuse_color
                                            (ogltk_lightsource *light,
                                             gfloat red,
                                             gfloat green,
                                             gfloat blue,
                                             gfloat alpha);
gboolean    ogltk_lightsource_set_location  (ogltk_lightsource *light,
                                             gfloat x,
                                             gfloat y,
                                             gfloat z);
gboolean    ogltk_lightsource_switch        (ogltk_lightsource *light,
                                             OgltkLightFlick flick);
OgltkLightFlick ogltk_lightsource_switch_position
                                            (ogltk_lightsource *light);
gboolean    ogltk_lightsource_illuminate    (ogltk_lightsource *light);
gboolean    ogltk_lightsource_destroy       (ogltk_lightsource *light);

Description

Details

struct ogltk_lightsource

struct ogltk_lightsource {

    GObject             parent_instance;
    
    OgltkLightSource    source;
    gltColor            ambient_color;
    gltColor            diffuse_color;
    gltTranslate        location;
    OgltkLightFlick     enabled;
    
    gfloat              actual_location;
};


enum OgltkLightSource

typedef enum
{
    /* Reserved for Scene */
    OGLTK_LTSRC_NONE  = 0,
    
    OGLTK_LTSRC_ONE   = GL_LIGHT0,
    OGLTK_LTSRC_TWO   = GL_LIGHT1,
    OGLTK_LTSRC_THREE = GL_LIGHT2,
    OGLTK_LTSRC_FOUR  = GL_LIGHT3,
    
    OGLTK_LTSRC_LAST
}OgltkLightSource;


enum OgltkLightFlick

typedef enum
{
    OGLTK_FLICK_OFF,
    OGLTK_FLICK_ON,

}OgltkLightFlick;


ogltk_lightsource_set_ambient_color ()

gboolean    ogltk_lightsource_set_ambient_color
                                            (ogltk_lightsource *light,
                                             gfloat red,
                                             gfloat green,
                                             gfloat blue,
                                             gfloat alpha);

Set the lightsource's ambient lighting color.

light :

An ogltk lightsource object

red :

Red value for this color.

green :

Green value for this color.

blue :

Blue value for this color.

alpha :

Alpha (intensity) value for this color.

Returns :

TRUE if color has been set.


ogltk_lightsource_set_diffuse_color ()

gboolean    ogltk_lightsource_set_diffuse_color
                                            (ogltk_lightsource *light,
                                             gfloat red,
                                             gfloat green,
                                             gfloat blue,
                                             gfloat alpha);

Set the lightsource's diffused lighting color.

light :

An ogltk lightsource object

red :

Red value for this color.

green :

Green value for this color.

blue :

Blue value for this color.

alpha :

Alpha (intensity) value for this color.

Returns :

TRUE if color has been set.


ogltk_lightsource_set_location ()

gboolean    ogltk_lightsource_set_location  (ogltk_lightsource *light,
                                             gfloat x,
                                             gfloat y,
                                             gfloat z);

Set the location of the lightsource in the scene.

light :

An ogltk lightsource object

x :

X axis location in scene

y :

Y axis location in scene

z :

Z axis location in scene

Returns :

TRUE if location has been set.


ogltk_lightsource_switch ()

gboolean    ogltk_lightsource_switch        (ogltk_lightsource *light,
                                             OgltkLightFlick flick);

Set the lightsources state. Either on or off.

light :

An ogltk lightsource object

flick :

Light switch state (ON or OFF).

Returns :

TRUE if the state has been changed.


ogltk_lightsource_switch_position ()

OgltkLightFlick ogltk_lightsource_switch_position
                                            (ogltk_lightsource *light);

Get the lightsources state. Either On or Off.

light :

An ogltk lightsource object

Returns :

enumeration type OgltkLightFlick of the lightsources state.


ogltk_lightsource_illuminate ()

gboolean    ogltk_lightsource_illuminate    (ogltk_lightsource *light);

This is called by the scene to render the lightsource in the scene.

light :

An ogltk lightsource object

Returns :

TRUE if signal was called successfully.


ogltk_lightsource_destroy ()

gboolean    ogltk_lightsource_destroy       (ogltk_lightsource *light);

Destroy an instance of a lightsource.

light :

An ogltk lightsource object

Returns :

TRUE if lightsource instance was destroyed.