![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#define PI180 VisuOpenGLView; VisuOpenGLCamera; enum ViewAxis; #define VISU_CAMERA_THETA #define VISU_CAMERA_PHI #define VISU_CAMERA_OMEGA gboolean openGLCameraSet_thetaPhiOmega (VisuOpenGLCamera *camera
,float valueTheta
,float valuePhi
,float valueOmega
,int mask
); #define MASK_XS #define MASK_YS gboolean openGLCameraSet_XsYs (VisuOpenGLCamera *camera
,float valueX
,float valueY
,int mask
); gboolean openGLCameraSet_gross (VisuOpenGLCamera *camera
,float value
); gboolean openGLCameraSet_persp (VisuOpenGLCamera *camera
,float value
); gboolean openGLCameraSet_refLength (VisuOpenGLCamera *camera
,float value
,ToolUnits unit
); float openGLCameraGet_refLength (VisuOpenGLCamera *camera
,ToolUnits *unit
); OpenGLWindow; gboolean openGLWindowSet_viewport (OpenGLWindow *window
,guint width
,guint height
); float VisuOpenGLViewGet_fileUnitPerPixel (VisuOpenGLView *view
); void VisuOpenGLViewGet_screenAxes (VisuOpenGLView *view
,float xAxis[3]
,float yAxis[3]
); float openGLViewGet_zCoordinate (VisuOpenGLView *view
,float xyz[3]
); void openGLViewGet_realCoordinates (VisuOpenGLView *view
,float xyz[3]
,float winx
,float winy
,float winz
); void openGLViewSet_upAxis (VisuOpenGLView *view
,ViewAxis upAxis
); VisuOpenGLView* VisuOpenGLViewNew (void
); void VisuOpenGLViewFree (VisuOpenGLView *view
); VisuOpenGLView* VisuOpenGLViewCopy (VisuOpenGLView *view
); gint VisuOpenGLCameraGet_numberOfFacettes (VisuOpenGLCamera *camera
,guint winSize
,float dimension
); void openGLProject (OpenGLWindow *window
,const VisuOpenGLCamera *camera
,float extens
); void openGLModelize (VisuOpenGLCamera *camera
); int VisuOpenGLViewSet_precision (float value
); float VisuOpenGLViewGet_precision (void
); void openGLViewRotate_box (VisuOpenGLView *view
,float dTheta
,float dPhi
,float angles[2]
); void openGLViewRotate_camera (VisuOpenGLView *view
,float dTheta
,float dPhi
,float angles[3]
); void VisuOpenGLViewInit (void
);
The VisuOpenGLView stores three basic informations: one for the position and orientation of the camera (VisuOpenGLCamera), 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 (OpenGLWindow, 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 VisuOpenGLViewSet_precision()
and all V_Sim part
drawing something should use VisuOpenGLCameraGet_numberOfFacettes()
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 VisuOpenGLCamera structure. They
must be changed with the following methods :
openGLViewSet_thetaPhiOmega()
, openGLViewSet_gross()
,
openGLViewSet_persp()
and openGLViewSet_XsYs()
.
typedef struct { VisuOpenGLCamera *camera; OpenGLWindow *window; } VisuOpenGLView;
A container structure to deal with OpenGL observer position, size of rendering viewport...
VisuOpenGLCamera * |
a VisuOpenGLCamera structure; |
OpenGLWindow * |
a OpenGLWindow structure; |
typedef struct { /* 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. */ ViewAxis upAxis; /* Eye target and eye position. */ double centre[3], eye[3]; } VisuOpenGLCamera;
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. | |
ViewAxis |
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. |
#define VISU_CAMERA_THETA (1 << 1)
Value used in the openGLCameraSet_thetaPhiOmega()
method to store the tetha angle.
#define VISU_CAMERA_PHI (1 << 2)
Value used in the openGLCameraSet_thetaPhiOmega()
method to store the phi angle.
#define VISU_CAMERA_OMEGA (1 << 3)
Value used in the openGLCameraSet_thetaPhiOmega()
method to store the omega angle.
gboolean openGLCameraSet_thetaPhiOmega (VisuOpenGLCamera *camera
,float valueTheta
,float valuePhi
,float valueOmega
,int mask
);
Change the orientation of the camera to the specified angles.
|
a valid VisuOpenGLCamera 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. |
#define MASK_XS (1 << 1)
Value used in the openGLCameraSet_XsYs()
method to store the horizontal offset.
#define MASK_YS (1 << 2)
Value used in the openGLCameraSet_XsYs()
method to store the vertical offset.
gboolean openGLCameraSet_XsYs (VisuOpenGLCamera *camera
,float valueX
,float valueY
,int mask
);
Change the point where the camera is pointed to.
|
a valid VisuOpenGLCamera 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. |
gboolean openGLCameraSet_gross (VisuOpenGLCamera *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 VisuOpenGLCamera object ; |
|
a positive floating point value. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
gboolean openGLCameraSet_persp (VisuOpenGLCamera *camera
,float value
);
Change the value of the camera perspective value and put it in bounds if needed.
|
a valid VisuOpenGLCamera object ; |
|
a floating point value greater than 1.1. |
Returns : |
TRUE if the signal OpenGLAskForReDraw should be emitted. |
gboolean openGLCameraSet_refLength (VisuOpenGLCamera *camera
,float value
,ToolUnits unit
);
Change the reference value that is used for the zoom.
|
a VisuOpenGLCamera object. |
|
a new length. |
|
its measurement unit. |
Returns : |
TRUE if the value is indeed changed. |
Since 3.6
float openGLCameraGet_refLength (VisuOpenGLCamera *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 VisuOpenGLCamera object. |
|
a location for unit value (can be NULL). |
Returns : |
the current reference length. |
Since 3.6
typedef struct { guint width, height; double near, far; double left, right, bottom, top; } OpenGLWindow;
Values to describe the window where the render is done.
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 ; |
gboolean openGLWindowSet_viewport (OpenGLWindow *window
,guint width
,guint height
);
It changes the size of the OpenGl area and reccompute the OpenGL viewport.
|
a valid OpenGLWindow object ; |
|
the new horizontal size ; |
|
the new vertical size. |
Returns : |
TRUE the size of window is actually changed.
|
float VisuOpenGLViewGet_fileUnitPerPixel (VisuOpenGLView *view
);
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 VisuOpenGLView object. |
Returns : |
how much of a unit of file is in a pixel. |
void VisuOpenGLViewGet_screenAxes (VisuOpenGLView *view
,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 VisuOpenGLView. |
|
three float values representing x axis ;. in. array fixed-size=3. |
|
three float values representing y axis.. in. array fixed-size=3. |
float openGLViewGet_zCoordinate (VisuOpenGLView *view
,float xyz[3]
);
Use this routine to know the Z value of a real point defined by
xyz
in caretsian coordinates.
|
a VisuOpenGLView object. |
|
a cartesian point. |
void openGLViewGet_realCoordinates (VisuOpenGLView *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 VisuOpenGLView object. |
|
a location to store the result. |
|
position on X axis of screen. |
|
position on Y axis of screen. |
|
height before projection on screen. |
void openGLViewSet_upAxis (VisuOpenGLView *view
,ViewAxis upAxis
);
In constraint observation mode, the "north" direction is a singular one. Define this direction with this routine.
|
a VisuOpenGLView object. |
|
a direction. |
Since 3.6
VisuOpenGLView* VisuOpenGLViewNew (void
);
Create a new VisuOpenGLView object with default values.
Returns : |
the newly created object (to be free with VisuOpenGLViewFree() ).. transfer none. |
void VisuOpenGLViewFree (VisuOpenGLView *view
);
Free the given view
.
|
a valid VisuOpenGLView object. |
VisuOpenGLView* VisuOpenGLViewCopy (VisuOpenGLView *view
);
Copy operator (newly VisuOpenGLView created with g_malloc()
to be freed be g_free()
).
|
a valid VisuOpenGLView object. |
Returns : |
a newly allocated VisuOpenGLView with same values than view .. transfer none. |
gint VisuOpenGLCameraGet_numberOfFacettes (VisuOpenGLCamera *camera
,guint winSize
,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 VisuOpenGLCamera object ; |
|
the size of the rendering area. |
|
the size of the object which asks for its number of facettes. |
Returns : |
the number of facettes the object should used. |
void openGLProject (OpenGLWindow *window
,const VisuOpenGLCamera *camera
,float extens
);
This method is used to set the projection and the OpenGL viewport.
|
definition of the screen. |
|
position of the camera. |
|
expansion of the object. |
void openGLModelize (VisuOpenGLCamera *camera
);
Set-up the orientation matrix, depending on the camera definition.
|
a VisuOpenGLCamera object. |
int VisuOpenGLViewSet_precision (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 (100 is normal precision). |
Returns : |
TRUE if the signals OpenGLFacetteChanged and OpenGLAskForReDraw should be emitted. |
float VisuOpenGLViewGet_precision (void
);
This function retrieve the value of the parameter precisionOfRendering.
Returns : |
the actual precision. |
void openGLViewRotate_box (VisuOpenGLView *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 VisuOpenGLView object ; |
|
a float value ; |
|
a float value ; |
|
a storing area two floats.. in. array fixed-size=2. |
void openGLViewRotate_camera (VisuOpenGLView *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 VisuOpenGLView object ; |
|
a float value ; |
|
a float value ; |
|
a storing area three floats.. in. array fixed-size=3. |