VisuGlExtBg

VisuGlExtBg — Handle the background colour and the fog.

Synopsis

#define             VISU_GL_EXT_BG_ID
#define             VISU_GL_EXT_FOG_MASK_END
#define             VISU_GL_EXT_FOG_MASK_START
struct              VisuGlExtBg;
struct              VisuGlExtBgClass;
void                visu_gl_ext_bg_draw                 (VisuGlExtBg *bg);
VisuGlExtBg *       visu_gl_ext_bg_getDefault           ();
void                visu_gl_ext_bg_getRGBA              (VisuGlExtBg *bg,
                                                         float rgba[4]);
VisuGlExtBg *       visu_gl_ext_bg_new                  (const gchar *name);
gboolean            visu_gl_ext_bg_setCamera            (VisuGlExtBg *bg,
                                                         float zoom,
                                                         float xs,
                                                         float ys);
gboolean            visu_gl_ext_bg_setFollowCamera      (VisuGlExtBg *bg,
                                                         gboolean follow,
                                                         float zoomInit,
                                                         float xs,
                                                         float ys);
gboolean            visu_gl_ext_bg_setGlView            (VisuGlExtBg *bg,
                                                         VisuGlView *view);
void                visu_gl_ext_bg_setImage             (VisuGlExtBg *bg,
                                                         const guchar *imageData,
                                                         guint width,
                                                         guint height,
                                                         gboolean alpha,
                                                         const gchar *title,
                                                         gboolean fit);
int                 visu_gl_ext_bg_setRGBA              (VisuGlExtBg *bg,
                                                         float rgba[3],
                                                         int mask);
void                visu_gl_ext_fog_create              (VisuGlView *view,
                                                         VisuBox *box);
void                visu_gl_ext_fog_create_color        ();
float               visu_gl_ext_fog_getEnd              ();
gboolean            visu_gl_ext_fog_getOn               ();
float               visu_gl_ext_fog_getStart            ();
gboolean            visu_gl_ext_fog_getUseSpecificColor ();
void                visu_gl_ext_fog_getValues           (float rgba[4]);
void                visu_gl_ext_fog_init                ();
gboolean            visu_gl_ext_fog_setOn               (gboolean value);
gboolean            visu_gl_ext_fog_setStartEndValues   (float startEnd[2],
                                                         int mask);
gboolean            visu_gl_ext_fog_setUseSpecificColor (gboolean value);
int                 visu_gl_ext_fog_setValues           (float rgba[4],
                                                         int mask);

Object Hierarchy

  GObject
   +----VisuGlExt
         +----VisuGlExtBg

Description

This module is used to support a background colour and to tune the fog. This last one can be turn on or off and its colour can be either a user defined one or the one of the background. The fog is a linear blending into the fog colour. It starts at a given z position (in the camera basis set) and ends at a lower z.

Details

VISU_GL_EXT_BG_ID

#define VISU_GL_EXT_BG_ID "Background"

The id used to identify this extension, see visu_gl_ext_rebuild() for instance.


VISU_GL_EXT_FOG_MASK_END

#define VISU_GL_EXT_FOG_MASK_END (1 << 1)

Value used by the second parameter of setFogStartEndValues() to specified the value that must be changed. This actually changes the fog_end value.


VISU_GL_EXT_FOG_MASK_START

#define VISU_GL_EXT_FOG_MASK_START (1 << 0)

Value used by the second parameter of setFogStartEndValues() to specified the value that must be changed. This actually changes the fog_start value.


struct VisuGlExtBg

struct VisuGlExtBg;

An opaque structure.

Since 3.7


struct VisuGlExtBgClass

struct VisuGlExtBgClass {
  VisuGlExtClass parent;
};

A short way to identify _VisuGlExtBgClass structure.

VisuGlExtClass parent;

the parent class;

Since 3.7


visu_gl_ext_bg_draw ()

void                visu_gl_ext_bg_draw                 (VisuGlExtBg *bg);

Creates the OpenGL lists used by bg (like the background image).

bg :

a VisuGlExtBg object.

Since 3.7


visu_gl_ext_bg_getDefault ()

VisuGlExtBg *       visu_gl_ext_bg_getDefault           ();

V_Sim is using a default bg object.

Returns :

a VisuGlExtBg object used by default. [transfer none]

Since 3.7


visu_gl_ext_bg_getRGBA ()

void                visu_gl_ext_bg_getRGBA              (VisuGlExtBg *bg,
                                                         float rgba[4]);

Read the RGBA value of the specific background colour (in [0;1]).

bg :

a VisuGlExtBg object.

rgba :

a storage for four values. [array fixed-size=4][out]

visu_gl_ext_bg_new ()

VisuGlExtBg *       visu_gl_ext_bg_new                  (const gchar *name);

Creates a new VisuGlExt to draw bg.

name :

the name to give to the extension (default is VISU_GL_EXT_BG_ID). [allow-none]

Returns :

a pointer to the VisuGlExt it created or NULL otherwise.

Since 3.7


visu_gl_ext_bg_setCamera ()

gboolean            visu_gl_ext_bg_setCamera            (VisuGlExtBg *bg,
                                                         float zoom,
                                                         float xs,
                                                         float ys);

If the background image is in follow mode, see visu_gl_ext_bg_setFollowCamera(), this routine is used to update the current camera settings of the background image.

bg :

a VisuGlExtBg object.

zoom :

a floating point value.

xs :

a floating point value.

ys :

a floating point value.

Returns :

TRUE if the settings are indeed changed.

Since 3.7


visu_gl_ext_bg_setFollowCamera ()

gboolean            visu_gl_ext_bg_setFollowCamera      (VisuGlExtBg *bg,
                                                         gboolean follow,
                                                         float zoomInit,
                                                         float xs,
                                                         float ys);

When follow is TRUE, the size and the position of the background image is adjusted with every camera change.

bg :

a VisuGlExtBg object.

follow :

a boolean.

zoomInit :

a floating point value.

xs :

a floating point value.

ys :

a floating point value.

Returns :

TRUE if the following status has been changed.

Since 3.7


visu_gl_ext_bg_setGlView ()

gboolean            visu_gl_ext_bg_setGlView            (VisuGlExtBg *bg,
                                                         VisuGlView *view);

Set the view bg is drawn to. It is necessary if bg has a background image or is using transparency background colour.

bg :

a VisuGlExtBg object.

view :

a VisuGlView object. [transfer full][allow-none]

Returns :

TRUE is view is new.

Since 3.7


visu_gl_ext_bg_setImage ()

void                visu_gl_ext_bg_setImage             (VisuGlExtBg *bg,
                                                         const guchar *imageData,
                                                         guint width,
                                                         guint height,
                                                         gboolean alpha,
                                                         const gchar *title,
                                                         gboolean fit);

Draw the imageData on the background. The image is scaled to the viewport dimensions, keeping the width/height ratio, if fit is set to TRUE. If title is not NULL, the title is also printed on the background. The image data are copied and can be free after this call.

bg :

a VisuGlExtBg object.

imageData :

raw image data in RGB or RGBA format ;. [allow-none]

width :

the width ;

height :

the height ;

alpha :

TRUE if the image is RGBA ;

title :

an optional title (can be NULL). [allow-none]

fit :

a boolean (default is TRUE).

visu_gl_ext_bg_setRGBA ()

int                 visu_gl_ext_bg_setRGBA              (VisuGlExtBg *bg,
                                                         float rgba[3],
                                                         int mask);

Method used to change the value of the parameter background_color.

bg :

a VisuGlExtBg object.

rgba :

a three floats array with values (0 <= values <= 1) for the red, the green and the blue color. Only values specified by the mask are really relevant.

mask :

use TOOL_COLOR_MASK_R, TOOL_COLOR_MASK_G, TOOL_COLOR_MASK_B, TOOL_COLOR_MASK_RGBA or a combinaison to indicate what values in the rgb array must be taken into account.

Returns :

TRUE if visu_gl_ext_bg_draw() should be aclled.

visu_gl_ext_fog_create ()

void                visu_gl_ext_fog_create              (VisuGlView *view,
                                                         VisuBox *box);

Call the OpenGL routine to enable and initialise the fog. The fog is created in the not duplicated cell of box.

view :

the VisuGlView object the fog apply to.

box :

the VisuBox object to delimit the area start and end.

visu_gl_ext_fog_create_color ()

void                visu_gl_ext_fog_create_color        ();

Call the OpenGL routines that change the colour of the fog.


visu_gl_ext_fog_getEnd ()

float               visu_gl_ext_fog_getEnd              ();

Read the ending value of the fog (in [0;1]).

Returns :

the position where the fog ends.

visu_gl_ext_fog_getOn ()

gboolean            visu_gl_ext_fog_getOn               ();

Read if fog is used or not.

Returns :

TRUE if the fog is rendered, FALSE otherwise.

visu_gl_ext_fog_getStart ()

float               visu_gl_ext_fog_getStart            ();

Read the starting value of the fog (in [0;1]).

Returns :

the position where the fog starts.

visu_gl_ext_fog_getUseSpecificColor ()

gboolean            visu_gl_ext_fog_getUseSpecificColor ();

Read if fog uses a specific colour or not.

Returns :

TRUE if the fog uses its own color or FALSE if it uses the color of the background.

visu_gl_ext_fog_getValues ()

void                visu_gl_ext_fog_getValues           (float rgba[4]);

Read the RGBA value of the specific fog colour (in [0;1]).

rgba :

a storage for four values.

visu_gl_ext_fog_init ()

void                visu_gl_ext_fog_init                ();

It initialises all variables of the OpenGL extension. It creates all resources and parameters introduced by this extension.

Returns :

a pointer to the VisuGlExt it created or NULL otherwise.

visu_gl_ext_fog_setOn ()

gboolean            visu_gl_ext_fog_setOn               (gboolean value);

Method used to change the value of the parameter fog_is_on.

value :

TRUE if fog must be rendered, FALSE otherwise.

Returns :

FALSE if redrawing is not necessary. TRUE if the rendering window must be redrawn.

visu_gl_ext_fog_setStartEndValues ()

gboolean            visu_gl_ext_fog_setStartEndValues   (float startEnd[2],
                                                         int mask);

Method used to change the value of the parameters fog_start and fog_end.

startEnd :

a two floats array with values (0 <= values <= 1) for the beging and the ending of the fog position. Only values specified by the mask are really relevant.

mask :

use VISU_GL_EXT_FOG_MASK_START, VISU_GL_EXT_FOG_MASK_END to indicate what values in the startEnd array must be taken into account.

Returns :

TRUE if visu_gl_ext_fog_create() should be called and then 'OpenGLAskForReDraw' signal be emitted.

visu_gl_ext_fog_setUseSpecificColor ()

gboolean            visu_gl_ext_fog_setUseSpecificColor (gboolean value);

Method used to change the value of the parameter fog_color_is_specific.

value :

TRUE if fog is rendered with its own color specified by setFogRGBValues() or FALSE if the fog uses the background color.

Returns :

TRUE if visu_gl_ext_fog_create() should be called. In all cases, 'OpenGLAskForReDraw' signal should then be emitted.

visu_gl_ext_fog_setValues ()

int                 visu_gl_ext_fog_setValues           (float rgba[4],
                                                         int mask);

Method used to change the value of the parameter fog_specific_color. This color is actually used only if fog_color_is_specific is set to 1, use setFogColorSpecific() to do that.

rgba :

a three floats array with values (0 <= values <= 1) for the red, the green and the blue color. Only values specified by the mask are really relevant.

mask :

use TOOL_COLOR_MASK_R, TOOL_COLOR_MASK_G, TOOL_COLOR_MASK_B, TOOL_COLOR_MASK_RGBA or a combinaison to indicate what values in the rgb array must be taken into account.

Returns :

0 if redrawing is not necessary. 1 if the rendering window must be redrawn.