![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Signals |
#define TOOL_PI180 #define VISU_GL_CAMERA_OMEGA #define VISU_GL_CAMERA_PHI #define VISU_GL_CAMERA_THETA #define VISU_GL_CAMERA_XS #define VISU_GL_CAMERA_YS struct VisuGlCamera; enum VisuGlCameraAxis; struct VisuGlView; struct VisuGlViewClass; VisuGlViewClassPrivate; struct VisuGlWindow; void visu_gl_camera_copy (VisuGlCamera *to
,const VisuGlCamera *from
); float visu_gl_camera_getRefLength (VisuGlCamera *camera
,ToolUnits *unit
); void visu_gl_camera_getScreenAxes (VisuGlCamera *camera
,float xAxis[3]
,float yAxis[3]
); void visu_gl_camera_modelize (VisuGlCamera *camera
); gboolean visu_gl_camera_setGross (VisuGlCamera *camera
,float value
); gboolean visu_gl_camera_setPersp (VisuGlCamera *camera
,float value
); gboolean visu_gl_camera_setRefLength (VisuGlCamera *camera
,float value
,ToolUnits unit
); gboolean visu_gl_camera_setThetaPhiOmega (VisuGlCamera *camera
,float valueTheta
,float valuePhi
,float valueOmega
,int mask
); void visu_gl_camera_setUpAxis (VisuGlCamera *camera
,VisuGlCameraAxis upAxis
); gboolean visu_gl_camera_setXsYs (VisuGlCamera *camera
,float valueX
,float valueY
,int mask
); float visu_gl_view_class_getPrecision (void
); gboolean visu_gl_view_class_setPrecision (float value
); gint visu_gl_view_getDetailLevel (VisuGlView *view
,float dimension
); void visu_gl_view_getRealCoordinates (VisuGlView *view
,float xyz[3]
,float winx
,float winy
,float winz
); float visu_gl_view_getZCoordinate (VisuGlView *view
,float xyz[3]
); VisuGlView * visu_gl_view_new (void
); VisuGlView * visu_gl_view_new_withSize (guint w
,guint h
); void visu_gl_view_rotateBox (VisuGlView *view
,float dTheta
,float dPhi
,float angles[2]
); void visu_gl_view_rotateCamera (VisuGlView *view
,float dTheta
,float dPhi
,float angles[3]
); gboolean visu_gl_view_setGross (VisuGlView *view
,float value
); gboolean visu_gl_view_setObjectRadius (VisuGlView *view
,float lg
,ToolUnits units
); gboolean visu_gl_view_setPersp (VisuGlView *view
,float value
); gboolean visu_gl_view_setRefLength (VisuGlView *view
,float lg
,ToolUnits units
); gboolean visu_gl_view_setThetaPhiOmega (VisuGlView *view
,float valueTheta
,float valuePhi
,float valueOmega
,int mask
); gboolean visu_gl_view_setViewport (VisuGlView *view
,guint width
,guint height
); gboolean visu_gl_view_setXsYs (VisuGlView *view
,float valueX
,float valueY
,int mask
); float visu_gl_window_getAddLength (VisuGlWindow *window
,ToolUnits *unit
); float visu_gl_window_getFileUnitPerPixel (VisuGlWindow *window
); void visu_gl_window_project (VisuGlWindow *window
,const VisuGlCamera *camera
); gboolean visu_gl_window_setAddLength (VisuGlWindow *window
,float value
,ToolUnits unit
); gboolean visu_gl_window_setViewport (VisuGlWindow *window
,guint width
,guint height
);
"DetailLevelChanged" :No Hooks
"GrossChanged" :No Hooks
"NearFarChanged" :No Hooks
"PerspChanged" :No Hooks
"RefLengthChanged" :No Hooks
"ThetaPhiOmegaChanged" :No Hooks
"WidthHeightChanged" :No Hooks
"XsYsChanged" :No Hooks
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()
.
#define VISU_GL_CAMERA_OMEGA (1 << 3)
Value used in the visu_gl_camera_setThetaPhiOmega()
method to store the omega angle.
#define VISU_GL_CAMERA_PHI (1 << 2)
Value used in the visu_gl_camera_setThetaPhiOmega()
method to store the phi angle.
#define VISU_GL_CAMERA_THETA (1 << 1)
Value used in the visu_gl_camera_setThetaPhiOmega()
method to store the tetha angle.
#define VISU_GL_CAMERA_XS (1 << 1)
Value used in the visu_gl_camera_setXsYs()
method to store the horizontal offset.
#define VISU_GL_CAMERA_YS (1 << 2)
Value used in the visu_gl_camera_setXsYs()
method to store the vertical offset.
struct VisuGlCamera { /* Perspective. */ double d_red; /* Orientation. */ double theta, phi, omega; /* Position. */ double xs, ys; /* Zoom. */ double gross; /* A length reference and its unit. */ double length0; ToolUnits unit; /* Up vector. */ double up[3]; /* Up axis. */ VisuGlCameraAxis upAxis; /* Eye target and eye position. */ double centre[3], eye[3]; };
Values to define the position of the observer.
a factor for perspective from 1. to inifnity. With one, the nose of the observer is completly set on the rendered object, and the size of the observer is neglectible compared to the size of the object. | |
the theta angle in spherical coordinates of the position of the observer ; | |
the phi angle in spherical coordinates of the position of the observer ; | |
rotation of the observer on itself ; | |
a value for translation of the viewport on x axis ; | |
a value for translation of the viewport on y axis ; | |
a value of zoom ; | |
a length reference to adimension all values, by default, this is the longest diagonal of the current box (without duplication) ; | |
ToolUnits |
the unit of length0 . |
the current up vector. [in][array fixed-size=3] | |
VisuGlCameraAxis |
which axis define the north pole. |
position of the eye look at ;. [in][array fixed-size=3] | |
position of the eye. [in][array fixed-size=3] |
struct VisuGlView;
A container structure to deal with OpenGL observer position, size of rendering viewport...
struct VisuGlViewClass { GObjectClass parent; VisuGlViewClassPrivate *priv; };
An opaque structure.
GObjectClass |
the parent class. |
VisuGlViewClassPrivate * |
private members. |
typedef struct _VisuGlViewClassPrivate VisuGlViewClassPrivate;
An opaque structure.
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.
additional length to add to length0 to obtain the global viewable area. | |
ToolUnits |
the ToolUnits of extens . |
guint |
the width of the window ; |
guint |
the height of the window ; |
the beginning of the viewport on z axis (z for observer) ; | |
the end of the viewport on z axis (z for observer) ; | |
the left of the viewport on x axis ; | |
the right of the viewport on x axis ; | |
the bottom of the viewport on y axis ; | |
the top of the viewport on y axis ; |
void visu_gl_camera_copy (VisuGlCamera *to
,const VisuGlCamera *from
);
Do a deep copy of from
to to
.
|
a location to copy values to |
|
a VisuGlCamera to copy values from |
Since 3.7
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.
|
a VisuGlCamera object. |
|
a location for unit value (can be NULL). |
Returns : |
the current reference length. |
Since 3.6
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.
|
a valid VisuGlCamera. |
|
three float values representing x axis ;. [in][array fixed-size=3] |
|
three float values representing y axis. [in][array fixed-size=3] |
void visu_gl_camera_modelize (VisuGlCamera *camera
);
Set-up the orientation matrix, depending on the camera definition.
|
a VisuGlCamera object. |
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.
|
a valid VisuGlCamera object ; |
|
a positive floating point value. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
gboolean visu_gl_camera_setPersp (VisuGlCamera *camera
,float value
);
Change the value of the camera perspective value and put it in bounds if needed.
|
a valid VisuGlCamera object ; |
|
a floating point value greater than 1.1. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
gboolean visu_gl_camera_setRefLength (VisuGlCamera *camera
,float value
,ToolUnits unit
);
Change the reference value that is used for the zoom.
|
a VisuGlCamera object. |
|
a new length. |
|
its measurement unit. |
Returns : |
TRUE if the value is indeed changed. |
Since 3.6
gboolean visu_gl_camera_setThetaPhiOmega (VisuGlCamera *camera
,float valueTheta
,float valuePhi
,float valueOmega
,int mask
);
Change the orientation of the camera to the specified angles.
|
a valid VisuGlCamera object ; |
|
a floatinf point value in degrees ; |
|
a floating point value in degrees ; |
|
a floating point value in degrees ; |
|
to specified what values will be changed. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
void visu_gl_camera_setUpAxis (VisuGlCamera *camera
,VisuGlCameraAxis upAxis
);
In constraint observation mode, the "north" direction is a singular one. Define this direction with this routine.
|
a VisuGlCamera object. |
|
a direction. |
Since 3.6
gboolean visu_gl_camera_setXsYs (VisuGlCamera *camera
,float valueX
,float valueY
,int mask
);
Change the point where the camera is pointed to.
|
a valid VisuGlCamera object ; |
|
a floatinf point value in the bounding box scale (1 is the size of the bounding box) ; |
|
a floating point value in bounding box scale ; |
|
to specified what values will be changed. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
float visu_gl_view_class_getPrecision (void
);
This function retrieve the value of the parameter precisionOfRendering.
Returns : |
the actual precision. |
gboolean visu_gl_view_class_setPrecision (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.
|
a positive value (1. is normal precision). |
Returns : |
TRUE if the signals OpenGLFacetteChanged and OpenGLAskForReDraw should be emitted. |
gint visu_gl_view_getDetailLevel (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.
|
a valid VisuGlView object ; |
|
the size of the object which asks for its number of facettes. |
Returns : |
the number of facettes the object should used. |
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.
|
a VisuGlView object. |
|
a location to store the result. |
|
position on X axis of screen. |
|
position on Y axis of screen. |
|
height before projection on screen. |
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.
|
a VisuGlView object. |
|
a cartesian point. |
VisuGlView * visu_gl_view_new (void
);
Create a new VisuGlView object with default values.
Returns : |
the newly created object. [transfer full] |
VisuGlView * visu_gl_view_new_withSize (guint w
,guint h
);
Create a new VisuGlView object with default values and the given window size.
|
the width ; |
|
the height. |
Returns : |
the newly created object. [transfer full] |
Since 3.7
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.
|
a valid VisuGlView object ; |
|
a float value ; |
|
a float value ; |
|
a storing area two floats. [out][array fixed-size=2] |
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.
|
a valid VisuGlView object ; |
|
a float value ; |
|
a float value ; |
|
a storing area three floats. [out][array fixed-size=3] |
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.
|
a VisuGlView object ; |
|
a positive floating point value. |
Returns : |
1 if the 'OpenGLAskForReDraw' signal should be emitted. |
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.
|
a VisuGlView object ; |
|
the new value. |
|
the unit to read lg with. |
Returns : |
TRUE if the 'OpenGLAskForReDraw' signal should be emitted. |
Since 3.7
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.
|
a VisuGlView object ; |
|
a positive floating point value (> 1.1). |
Returns : |
1 if the 'OpenGLAskForReDraw' signal should be emitted. |
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.
|
a VisuGlView object ; |
|
the new value. |
|
the unit to read lg with. |
Returns : |
TRUE if the 'OpenGLAskForReDraw' signal should be emitted. |
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.
|
a VisuGlView object ; |
|
a floatinf point value in degrees ; |
|
a floating point value in degrees ; |
|
a floating point value in degrees ; |
|
to specified what values will be changed. |
Returns : |
1 if the 'OpenGLAskForReDraw' signal should be emitted. |
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.
|
a VisuGlView object ; |
|
the new horizontal size ; |
|
the new vertical size. |
Returns : |
TRUE if the 'AskForReDrawChanged' signal should be emitted. |
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.
|
a VisuGlView object ; |
|
a floatinf point value in the bounding box scale (1 is the size of the bounding box) ; |
|
a floating point value in bounding box scale ; |
|
to specified what values will be changed. |
Returns : |
1 if the 'OpenGLAskForReDraw' signal should be emitted. |
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()
.
|
a VisuGlWindow object. |
|
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
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.
|
a valid VisuGlWindow object. |
Returns : |
how much of a unit of file is in a pixel. |
void visu_gl_window_project (VisuGlWindow *window
,const VisuGlCamera *camera
);
This method is used to set the projection and the OpenGL viewport.
|
definition of the screen. |
|
position of the camera. |
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.
|
a VisuGlWindow object. |
|
a float value (positive). |
|
the unit of value . |
Returns : |
TRUE if the value is indeed changed and
visu_gl_window_project() should be called. |
Since 3.7
gboolean visu_gl_window_setViewport (VisuGlWindow *window
,guint width
,guint height
);
It changes the size of the OpenGl area and reccompute the OpenGL viewport.
|
a valid VisuGlWindow object ; |
|
the new horizontal size ; |
|
the new vertical size. |
Returns : |
TRUE the size of window is actually changed. |
"DetailLevelChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when precision of the drawn object has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"GrossChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the camera zoom factor has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"NearFarChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the viewing field has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"PerspChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the camera perspective factor has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"RefLengthChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the reference length of the camera has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.7
"ThetaPhiOmegaChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the camera angles have been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"WidthHeightChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the viewing frame has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2
"XsYsChanged"
signalvoid user_function (VisuGlView *view,
gpointer user_data) : No Hooks
Gets emitted when the camera position has been changed.
|
the object which received the signal ; |
|
user data set when the signal handler was connected. |
Since 3.2