VisuGlView

VisuGlView — Defines all necessary informations for the rendering of a view.

Functions

Properties

gdouble omega Read / Write
gdouble perspective Read / Write
gdouble phi Read / Write
gfloat precision Read / Write
gdouble theta Read / Write
gdouble trans-x Read / Write
gdouble trans-y Read / Write
gdouble zoom Read / Write

Signals

Types and Values

Object Hierarchy

    GBoxed
    ╰── VisuGlCamera
    GObject
    ╰── ToolDbgObj
        ╰── VisuGlView

Implemented Interfaces

VisuGlView implements VisuBoxed and VisuAnimatable.

Description

The VisuGlView stores three basic informations: one for the position and orientation of the camera (VisuGlCamera), one for the description of the bounding box in the OpenGL coordinates (OpenGLBox, should be moved elsewhere later) and one last for the definition of the viewing window (VisuGlWindow, including volumic informations).

One resource is used by this part, defining the precision desired by the user when drawing OpenGL objects. This precision can be changed using visu_gl_view_class_setPrecision() and all V_Sim part drawing something should use visu_gl_view_getDetailLevel() to know the size of the vertices to be drawn depending on this precision and the level of zoom.

The rendering is done in an OpenGl viewport whose size is given by the bounding box (plus 10%). The camera can be positionned with three angles (theta, phi and omega) and has a zoom factor (gross) and a perspective value (d_red). The angle theta is around the z axis (box coordinates), phi is around the new x axis (after the theta rotation) and omega is a rotation around the axis which goes from the observer to the center of the bounding box. By default the camera looks at the center of the bounding box but this can be changed with the Xs and Ys parameters. These values are stored and are readable through the VisuGlCamera structure. They must be changed with the following methods : openGLViewSet_thetaPhiOmega(), openGLViewSet_gross(), openGLViewSet_persp() and openGLViewSet_XsYs().

Functions

visu_gl_camera_copy ()

void
visu_gl_camera_copy (VisuGlCamera *to,
                     const VisuGlCamera *from);

Do a deep copy of from to to .

Parameters

to

a location to copy values to

 

from

a VisuGlCamera to copy values from

 

Since: 3.7


visu_gl_camera_setThetaPhiOmega ()

int
visu_gl_camera_setThetaPhiOmega (VisuGlCamera *camera,
                                 float valueTheta,
                                 float valuePhi,
                                 float valueOmega,
                                 int mask);

Change the orientation of the camera to the specified angles.

Parameters

camera

a valid VisuGlCamera object ;

 

valueTheta

a floatinf point value in degrees ;

 

valuePhi

a floating point value in degrees ;

 

valueOmega

a floating point value in degrees ;

 

mask

to specified what values will be changed.

 

Returns

a mask of changed values.


visu_gl_camera_setXsYs ()

int
visu_gl_camera_setXsYs (VisuGlCamera *camera,
                        float valueX,
                        float valueY,
                        int mask);

Change the point where the camera is pointed to.

Parameters

camera

a valid VisuGlCamera object ;

 

valueX

a floatinf point value in the bounding box scale (1 is the size of the bounding box) ;

 

valueY

a floating point value in bounding box scale ;

 

mask

to specified what values will be changed.

 

Returns

a mask of changed values.


visu_gl_camera_setGross ()

gboolean
visu_gl_camera_setGross (VisuGlCamera *camera,
                         float value);

Change the value of the camera zoom value. If the value is higher than 10 it is set to 10 and if the value is negative it is set to 0.001.

Parameters

camera

a valid VisuGlCamera object ;

 

value

a positive floating point value.

 

Returns

TRUE if value is actually changed.


visu_gl_camera_setPersp ()

gboolean
visu_gl_camera_setPersp (VisuGlCamera *camera,
                         float value);

Change the value of the camera perspective value and put it in bounds if needed.

Parameters

camera

a valid VisuGlCamera object ;

 

value

a floating point value greater than 1.1.

 

Returns

TRUE if value is actually changed.


visu_gl_camera_setRefLength ()

gboolean
visu_gl_camera_setRefLength (VisuGlCamera *camera,
                             float value,
                             ToolUnits unit);

Change the reference value that is used for the zoom.

Parameters

camera

a VisuGlCamera object.

 

value

a new length.

 

unit

its measurement unit.

 

Returns

TRUE if the value is indeed changed.

Since: 3.6


visu_gl_camera_getRefLength ()

float
visu_gl_camera_getRefLength (VisuGlCamera *camera,
                             ToolUnits *unit);

The zoom is define from a reference length in given unit. If unit is provided, the corresponding unit will be set.

Parameters

camera

a VisuGlCamera object.

 

unit

a location for unit value (can be NULL).

 

Returns

the current reference length.

Since: 3.6


visu_gl_camera_setUpAxis ()

void
visu_gl_camera_setUpAxis (VisuGlCamera *camera,
                          ToolXyzDir upAxis);

In constraint observation mode, the "north" direction is a singular one. Define this direction with this routine.

Parameters

camera

a VisuGlCamera object.

 

upAxis

a direction.

 

Since: 3.6


visu_gl_camera_getScreenAxes ()

void
visu_gl_camera_getScreenAxes (VisuGlCamera *camera,
                              float xAxis[3],
                              float yAxis[3]);

This method is used to get the coordinates in box frame of x axis and y axis of the current camera view.

Parameters

camera

a valid VisuGlCamera.

 

xAxis

three float values representing x axis ;.

[in][array fixed-size=3]

yAxis

three float values representing y axis.

[in][array fixed-size=3]

visu_gl_window_setViewport ()

gboolean
visu_gl_window_setViewport (VisuGlWindow *window,
                            guint width,
                            guint height);

It changes the size of the OpenGl area and reccompute the OpenGL viewport.

Parameters

window

a valid VisuGlWindow object ;

 

width

the new horizontal size ;

 

height

the new vertical size.

 

Returns

TRUE the size of window is actually changed.


visu_gl_window_setAddLength ()

gboolean
visu_gl_window_setAddLength (VisuGlWindow *window,
                             float value,
                             ToolUnits unit);

The viewable area is defined by the VisuGlCamera size, as set by visu_gl_camera_setRefLength() and by additional space setup by this routine.

Parameters

window

a VisuGlWindow object.

 

value

a float value (positive).

 

unit

the unit of value .

 

Returns

TRUE if the value is indeed changed and visu_gl_window_project() should be called.

Since: 3.7


visu_gl_window_getAddLength ()

float
visu_gl_window_getAddLength (VisuGlWindow *window,
                             ToolUnits *unit);

The viewable area is defined by the VisuGlCamera size, as set by visu_gl_camera_setRefLength() and by additional space setup by visu_gl_window_setAddLength().

Parameters

window

a VisuGlWindow object.

 

unit

a location for the unit of the returned value.

[allow-none]

Returns

the additional length to be added to the camera object size to obtain the full viewable area.

Since: 3.7


visu_gl_window_getFileUnitPerPixel ()

float
visu_gl_window_getFileUnitPerPixel (VisuGlWindow *window);

This method is used to know the ratio of a pixel with the unit of the file. WARNING : this method is valid only when the camera is position at infinity.

Parameters

window

a valid VisuGlWindow object.

 

Returns

how much of a unit of file is in a pixel.


visu_gl_view_new ()

VisuGlView *
visu_gl_view_new (void);

Create a new VisuGlView object with default values.

Returns

the newly created object.

[transfer full]


visu_gl_view_new_withSize ()

VisuGlView *
visu_gl_view_new_withSize (guint w,
                           guint h);

Create a new VisuGlView object with default values and the given window size.

Parameters

w

the width ;

 

h

the height.

 

Returns

the newly created object.

[transfer full]

Since: 3.7


visu_gl_view_initContext ()

void
visu_gl_view_initContext (VisuGlView *view);

Modelize and project the view. Should be called when used in a new OpenGL context.

Parameters

view

a VisuGlView object.

 

Since: 3.8


visu_gl_view_setThetaPhiOmega ()

gboolean
visu_gl_view_setThetaPhiOmega (VisuGlView *view,
                               float valueTheta,
                               float valuePhi,
                               float valueOmega,
                               int mask);

This method is used to change the camera orientation for the given view . If necessary, this method will emit the 'ThetaPhiOmegaChanged' signal.

Parameters

view

a VisuGlView object ;

 

valueTheta

a floatinf point value in degrees ;

 

valuePhi

a floating point value in degrees ;

 

valueOmega

a floating point value in degrees ;

 

mask

to specified what values will be changed.

 

Returns

TRUE if value is actually changed.


visu_gl_view_setXsYs ()

gboolean
visu_gl_view_setXsYs (VisuGlView *view,
                      float valueX,
                      float valueY,
                      int mask);

This method is used to change the camera position for the given view . If necessary, this method will emit the 'XsYsChanged' signal.

Parameters

view

a VisuGlView object ;

 

valueX

a floatinf point value in the bounding box scale (1 is the size of the bounding box) ;

 

valueY

a floating point value in bounding box scale ;

 

mask

to specified what values will be changed.

 

Returns

TRUE if value is actually changed.


visu_gl_view_setGross ()

gboolean
visu_gl_view_setGross (VisuGlView *view,
                       float value);

This method is used to change the camera zoom for the given view . If necessary, this method will emit the 'GrossChanged' signal and the 'FacetteChangedChanged' signal.

Parameters

view

a VisuGlView object ;

 

value

a positive floating point value.

 

Returns

TRUE if value is actually changed.


visu_gl_view_setPersp ()

gboolean
visu_gl_view_setPersp (VisuGlView *view,
                       float value);

This method is used to change the camera perspective for the given view . If necessary, this method will emit the 'PerspChanged' signal and the 'FacetteChangedChanged' signal.

Parameters

view

a VisuGlView object ;

 

value

a positive floating point value (> 1.1).

 

Returns

TRUE if value is actually changed.


visu_gl_view_setRefLength ()

gboolean
visu_gl_view_setRefLength (VisuGlView *view,
                           float lg,
                           ToolUnits units);

This method is used to change the camera reference length for the given view . If necessary, this method will modelize and emit the 'RefLengthChanged' signal.

Parameters

view

a VisuGlView object ;

 

lg

the new value.

 

units

the unit to read lg with.

 

Returns

TRUE if value is actually changed.


visu_gl_view_setObjectRadius ()

gboolean
visu_gl_view_setObjectRadius (VisuGlView *view,
                              float lg,
                              ToolUnits units);

This method is used to change the window frustum for the given view . If necessary, this method will project and emit the 'NearFarChanged' signal.

Parameters

view

a VisuGlView object ;

 

lg

the new value.

 

units

the unit to read lg with.

 

Returns

TRUE if value is actually changed.

Since: 3.7


visu_gl_view_setViewport ()

gboolean
visu_gl_view_setViewport (VisuGlView *view,
                          guint width,
                          guint height);

It changes the size of the OpenGl area and reccompute the OpenGL viewport. Warning : it doesn't change the size of the window.

Parameters

view

a VisuGlView object ;

 

width

the new horizontal size ;

 

height

the new vertical size.

 

Returns

TRUE if value is actually changed.


visu_gl_view_getDetailLevel ()

gint
visu_gl_view_getDetailLevel (const VisuGlView *view,
                             float dimension);

This is a function to get the number of "facettes" advised by the server (according to its policy on rendering) to draw an object according to a given dimension.

Parameters

view

a valid VisuGlView object ;

 

dimension

the size of the object which asks for its number of facettes.

 

Returns

the number of facettes the object should used.


visu_gl_view_rotateBox ()

void
visu_gl_view_rotateBox (VisuGlView *view,
                        float dTheta,
                        float dPhi,
                        float angles[2]);

This methods rotates the camera of the given view of (dTheta , dPhi ) and put new theta and phi angles in angles , first being theta and second phi.

Parameters

view

a valid VisuGlView object ;

 

dTheta

a float value ;

 

dPhi

a float value ;

 

angles

a storing area two floats.

[out][array fixed-size=2]

visu_gl_view_rotateCamera ()

void
visu_gl_view_rotateCamera (VisuGlView *view,
                           float dTheta,
                           float dPhi,
                           float angles[3]);

This methods rotates the camera of the given view of (dTheta , dPhi ). dTheta is taken as displacement along camera x axis and dPhi along camera y axis. Then, computations are done to obtain new theta, phi and omega values. They are put in angles , first being theta, second phi and third omega.

Parameters

view

a valid VisuGlView object ;

 

dTheta

a float value ;

 

dPhi

a float value ;

 

angles

a storing area three floats.

[out][array fixed-size=3]

visu_gl_view_alignToAxis ()

void
visu_gl_view_alignToAxis (VisuGlView *view,
                          ToolXyzDir axis);

Rotate the view to align it with the given box axis.

Parameters

view

a VisuGlView object.

 

axis

an axis.

 

Returns

TRUE if the view is actually changed.

Since: 3.8


visu_gl_view_getZCoordinate ()

float
visu_gl_view_getZCoordinate (VisuGlView *view,
                             float xyz[3]);

Use this routine to know the Z value of a real point defined by xyz in caretsian coordinates.

Parameters

view

a VisuGlView object.

 

xyz

a cartesian point.

 

visu_gl_view_getRealCoordinates ()

void
visu_gl_view_getRealCoordinates (VisuGlView *view,
                                 float xyz[3],
                                 float winx,
                                 float winy,
                                 float winz);

Use this routine to get the cartesian coordinates in real space of a point located at winx and winy on screen.

Parameters

view

a VisuGlView object.

 

xyz

a location to store the result.

 

winx

position on X axis of screen.

 

winy

position on Y axis of screen.

 

winz

height before projection on screen.

 

visu_gl_view_setPrecision ()

gboolean
visu_gl_view_setPrecision (VisuGlView *view,
                           float value);

This function change the value of the parameter precisionOfRendering. It changes the number of facettes advised for every objects. It allows to increase or decrease the number of polygons drawn and thus acts on the speed of rendering.

Parameters

view

a VisuGlView object.

 

value

a positive value (1. is normal precision).

 

Returns

TRUE if value is actually changed.


visu_gl_view_getPrecision ()

float
visu_gl_view_getPrecision (const VisuGlView *view);

This function retrieve the value of the parameter precisionOfRendering.

Parameters

view

a VisuGlView object.

 

Returns

the actual precision.

Types and Values

VISU_GL_CAMERA_THETA

#define VISU_GL_CAMERA_THETA (1 << 1)

Value used in the visu_gl_camera_setThetaPhiOmega() method to store the tetha angle.


VISU_GL_CAMERA_PHI

#define VISU_GL_CAMERA_PHI   (1 << 2)

Value used in the visu_gl_camera_setThetaPhiOmega() method to store the phi angle.


VISU_GL_CAMERA_OMEGA

#define VISU_GL_CAMERA_OMEGA   (1 << 3)

Value used in the visu_gl_camera_setThetaPhiOmega() method to store the omega angle.


VISU_GL_CAMERA_XS

#define VISU_GL_CAMERA_XS (1 << 1)

Value used in the visu_gl_camera_setXsYs() method to store the horizontal offset.


VISU_GL_CAMERA_YS

#define VISU_GL_CAMERA_YS   (1 << 2)

Value used in the visu_gl_camera_setXsYs() method to store the vertical offset.


struct VisuGlWindow

struct VisuGlWindow {
  float extens;
  ToolUnits unit;

  guint width, height;
  double near, far;
  double left, right, bottom, top;
};

Values to describe the window where the render is done.

Members

float extens;

additional length to add to length0 to obtain the global viewable area.

 

ToolUnits unit;

the ToolUnits of extens .

 

guint width;

the width of the window ;

 

guint height;

the height of the window ;

 

double near;

the beginning of the viewport on z axis (z for observer) ;

 

double far;

the end of the viewport on z axis (z for observer) ;

 

double left;

the left of the viewport on x axis ;

 

double right;

the right of the viewport on x axis ;

 

double bottom;

the bottom of the viewport on y axis ;

 

double top;

the top of the viewport on y axis ;

 

struct VisuGlView

struct VisuGlView;

A container structure to deal with OpenGL observer position, size of rendering viewport...


struct VisuGlViewClass

struct VisuGlViewClass {
  VisuObjectClass parent;
};

An opaque structure.

Members

VisuObjectClass parent;

the parent class.

 

Property Details

The “omega” property

  “omega”                    gdouble

omega angle.

Flags: Read / Write

Allowed values: [-360,360]

Default value: 0


The “perspective” property

  “perspective”              gdouble

perspective level.

Flags: Read / Write

Allowed values: [1.1,100]

Default value: 5


The “phi” property

  “phi”                      gdouble

phi angle.

Flags: Read / Write

Allowed values: [-360,360]

Default value: 0


The “precision” property

  “precision”                gfloat

precision level.

Flags: Read / Write

Allowed values: [0,10]

Default value: 1


The “theta” property

  “theta”                    gdouble

theta angle.

Flags: Read / Write

Allowed values: [-360,360]

Default value: 90


The “trans-x” property

  “trans-x”                  gdouble

translation along x.

Flags: Read / Write

Allowed values: [-3,3]

Default value: 0.5


The “trans-y” property

  “trans-y”                  gdouble

translation along y.

Flags: Read / Write

Allowed values: [-3,3]

Default value: 0.5


The “zoom” property

  “zoom”                     gdouble

zoom level.

Flags: Read / Write

Allowed values: [0.02,999]

Default value: 1

Signal Details

The “DetailLevelChanged” signal

void
user_function (VisuGlView *view,
               gpointer    user_data)

Gets emitted when precision of the drawn object has been changed.

Parameters

view

the object which received the signal ;

 

user_data

user data set when the signal handler was connected.

 

Flags: No Hooks

Since: 3.2


The “RefLengthChanged” signal

void
user_function (VisuGlView *view,
               gpointer    user_data)

Gets emitted when the reference length of the camera has been changed.

Parameters

view

the object which received the signal ;

 

user_data

user data set when the signal handler was connected.

 

Flags: No Hooks

Since: 3.7


The “WidthHeightChanged” signal

void
user_function (VisuGlView *view,
               gpointer    user_data)

Gets emitted when the viewing frame has been changed.

Parameters

view

the object which received the signal ;

 

user_data

user data set when the signal handler was connected.

 

Flags: No Hooks

Since: 3.2


The “changed” signal

void
user_function (VisuGlView *view,
               gpointer    user_data)

Gets emitted when the view is changed.

Parameters

view

the object which emits the signal ;

 

user_data

user data set when the signal handler was connected.

 

Flags: No Hooks

Since: 3.8