Top | ![]() |
![]() |
![]() |
![]() |
void | DetailLevelChanged | No Hooks |
void | RefLengthChanged | No Hooks |
void | WidthHeightChanged | No Hooks |
void | changed | No Hooks |
#define | VISU_GL_CAMERA_THETA |
#define | VISU_GL_CAMERA_PHI |
#define | VISU_GL_CAMERA_OMEGA |
#define | VISU_GL_CAMERA_XS |
#define | VISU_GL_CAMERA_YS |
struct | VisuGlWindow |
struct | VisuGlView |
struct | VisuGlViewClass |
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()
.
void visu_gl_camera_copy (VisuGlCamera *to
,const VisuGlCamera *from
);
Do a deep copy of from
to to
.
Since: 3.7
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.
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. |
int visu_gl_camera_setXsYs (VisuGlCamera *camera
,float valueX
,float valueY
,int mask
);
Change the point where the camera is pointed to.
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. |
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.
gboolean visu_gl_camera_setPersp (VisuGlCamera *camera
,float value
);
Change the value of the camera perspective value and put it in bounds if needed.
gboolean visu_gl_camera_setRefLength (VisuGlCamera *camera
,float value
,ToolUnits unit
);
Change the reference value that is used for the zoom.
Since: 3.6
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.
Since: 3.6
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.
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.
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] |
gboolean visu_gl_window_setViewport (VisuGlWindow *window
,guint width
,guint height
);
It changes the size of the OpenGl area and reccompute the OpenGL viewport.
window |
a valid VisuGlWindow object ; |
|
width |
the new horizontal size ; |
|
height |
the new vertical size. |
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.
Since: 3.7
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()
.
window |
a VisuGlWindow object. |
|
unit |
a location for the unit of the returned value. |
[allow-none] |
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.
VisuGlView *
visu_gl_view_new (void
);
Create a new VisuGlView object with default values.
VisuGlView * visu_gl_view_new_withSize (guint w
,guint h
);
Create a new VisuGlView object with default values and the given window size.
Since: 3.7
void
visu_gl_view_initContext (VisuGlView *view
);
Modelize and project the view. Should be called when used in a new OpenGL context.
Since: 3.8
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.
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. |
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.
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. |
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.
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.
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.
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.
Since: 3.7
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.
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.
view |
a valid VisuGlView object ; |
|
dimension |
the size of the object which asks for its number of facettes. |
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.
view |
a valid VisuGlView object ; |
|
dTheta |
a float value ; |
|
dPhi |
a float value ; |
|
angles |
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.
view |
a valid VisuGlView object ; |
|
dTheta |
a float value ; |
|
dPhi |
a float value ; |
|
angles |
a storing area three floats. |
[out][array fixed-size=3] |
void visu_gl_view_alignToAxis (VisuGlView *view
,ToolXyzDir axis
);
Rotate the view to align it with the given box axis.
Since: 3.8
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.
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.
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. |
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.
float
visu_gl_view_getPrecision (const VisuGlView *view
);
This function retrieve the value of the parameter precisionOfRendering.
#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_PHI (1 << 2)
Value used in the visu_gl_camera_setThetaPhiOmega()
method to store the phi angle.
#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_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 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 |
|
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 ; |
struct VisuGlView;
A container structure to deal with OpenGL observer position, size of rendering viewport...
“omega”
property“omega” gdouble
omega angle.
Flags: Read / Write
Allowed values: [-360,360]
Default value: 0
“perspective”
property“perspective” gdouble
perspective level.
Flags: Read / Write
Allowed values: [1.1,100]
Default value: 5
“phi”
property“phi” gdouble
phi angle.
Flags: Read / Write
Allowed values: [-360,360]
Default value: 0
“precision”
property“precision” gfloat
precision level.
Flags: Read / Write
Allowed values: [0,10]
Default value: 1
“theta”
property“theta” gdouble
theta angle.
Flags: Read / Write
Allowed values: [-360,360]
Default value: 90
“trans-x”
property“trans-x” gdouble
translation along x.
Flags: Read / Write
Allowed values: [-3,3]
Default value: 0.5
“trans-y”
property“trans-y” gdouble
translation along y.
Flags: Read / Write
Allowed values: [-3,3]
Default value: 0.5
“zoom”
property“zoom” gdouble
zoom level.
Flags: Read / Write
Allowed values: [0.02,999]
Default value: 1
“DetailLevelChanged”
signalvoid user_function (VisuGlView *view, gpointer user_data)
Gets emitted when precision of the drawn object has been changed.
view |
the object which received the signal ; |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
Since: 3.2
“RefLengthChanged”
signalvoid user_function (VisuGlView *view, gpointer user_data)
Gets emitted when the reference length of the camera has been changed.
view |
the object which received the signal ; |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
Since: 3.7
“WidthHeightChanged”
signalvoid user_function (VisuGlView *view, gpointer user_data)
Gets emitted when the viewing frame has been changed.
view |
the object which received the signal ; |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
Since: 3.2
“changed”
signalvoid user_function (VisuGlView *view, gpointer user_data)
Gets emitted when the view is changed.
view |
the object which emits the signal ; |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
Since: 3.8