Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
The library : 3d view API

Functions

 b3d_renderEnable (strView, state)
 Enable (Disable) the rendering.
 b3d_viewConvertSizePixel2Relative (strView, pxWidth, pxHeight)
 Convert a pixel dimension to a relative dimension (from the size of 3d view).
 b3d_viewDestroy (strView)
 Destroy the 3D view. All associated buffer, sessions and viewport will be destroyed too.
 b3d_viewEnable (strView, state)
 Enable (Disable) a 3d view. if enabled, the 3d window is shown else it is hidden.
 b3d_viewGetOldSize (strView)
 Get the last known size of the 3d window (before the current size)
 b3d_viewGetPos (strView)
 Get the current position of the 3d window (inside its mother)
 b3d_viewGetSessionFirst (strView)
 Get the first session structure object.
 b3d_viewGetSize (strView)
 Get the current size of the 3d window.
 b3d_viewGetSizeFixed (strView, state)
 Returns if the 3d view is resizable or not.
 b3d_viewGetSizeMinMax (strView)
 Returns if the limits of the 3d view size, in pixels.
 b3d_viewGetViewportAll (strView)
 Return all viewports for this 3d view.
 b3d_viewGetViewportDefault (strView)
 Return the first viewport (default) for this 3d view.
 b3d_viewSetCbChangeCamera (strView, cbfun)
 Set the callback when the default camera changes.
 b3d_viewSetCbClick (strView, cbfun)
 Set the callback when the mouse is clicked (pressed) on the 3d view.
 b3d_viewSetCbDbClick (strView, cbfun)
 Set the callback when the mouse is double clicked on the 3d view.
 b3d_viewSetCbDestroy (strView, cbfun)
 Set the callback when the 3D view destroying is asked.
 b3d_viewSetCbDropFile (strView, cbfun)
 Set the callback when a drop file event occurs on the 3d view.
 b3d_viewSetCbEnd (strView, cbfun)
 Set the callback when the 3D view destroying is done.
 b3d_viewSetCbHasFocus (strView, cbfun)
 Set the callback when the 3d view has the focus.
 b3d_viewSetCbKeyDown (strView, cbfun)
 Set the callback when the a key is pressed from the keyboard.
 b3d_viewSetCbKeyUp (strView, cbfun)
 Set the callback when the a key is released from the keyboard.
 b3d_viewSetCbLoseFocus (strView, cbfun)
 Set the callback when the 3d view loses the focus.
 b3d_viewSetCbMouseMove (strView, cbfun)
 Set the callback when the mouse moves on the 3d view.
 b3d_viewSetCbMove (strView, cbfun)
 Set the callback when the 3d view moves.
 b3d_viewSetCbPostRender (strView, cbfun)
 Set the callback to the post rendering.
 b3d_viewSetCbPreRender (strView, cbfun)
 Set the callback to the pre rendering.
 b3d_viewSetCbPreRenderFX (strView, cbfun)
 Set the callback to the pre rendering effects.
 b3d_viewSetCbResize (strView, cbfun)
 Set the callback when the 3d view is resized.
 b3d_viewSetCbUnClick (strView, cbfun)
 Set the callback when the mouse is released (unclicked) on the 3d view.
 b3d_viewSetCbWheel (strView, cbfun)
 Set the callback.
 b3d_viewSetFocus (strView, state)
 Activate or desactivate the focus to the 3d window.
 b3d_viewSetPos (strView, newx, newy)
 Set the position of the 3d window (inside its mother)
 b3d_viewSetSize (strView, neww, newh)
 Resize the 3d view.
 b3d_viewSetSizeFixed (strView, state)
 Define if the 3d view is resizable or not.
 b3d_viewSetSizeMinMax (strView, tSizeMin, tSizeMax)
 Define the minimal and the maximal size of the 3d view.
 b3d_viewSetViewportDefault (strView, strViewport)
 Set the first viewport (default) for this 3d view.
 b3d_viewSetViewportSizeFromFullViewSize (strView, strViewport)
 Resize a Viewport and the 2d buffer object from the current size of the 3d view (no fullscreen).
 b3d_viewSetWindowMode (strView, state)
 Set the window mode to the 3d window. The size is unchanged.

Detailed Description

Function Documentation

b3d_viewSetWindowMode ( strView  ,
state   
)

Set the window mode to the 3d window. The size is unchanged.

Prototype : fun [LIB3D_View I] I

Parameters
LIB3D_View: a 3d view object
I: a state : iLIB3D_WINDOWED or iLIB3D_FULLSCREEN
Returns
I : 0 if success or a positive value if error
  • 1 : the given 3d view object is nil
  • 2 : the internal buffer is nil
  • 3 : the set failed
b3d_viewDestroy ( strView  )

Destroy the 3D view. All associated buffer, sessions and viewport will be destroyed too.

Prototype : fun [LIB3D_View ] I

Parameters
LIB3D_View: a 3d view object
Returns
I : 0 if success or a positive value if error
  • 1 : the given 3d view object is nil
  • 2 : the internal ObjWin is nil
  • 4 : a viewport object is nil or already destroyed
  • 5 : unable to destroy an internal viewport object
  • 11, 12, 13 : the 3d session is nil or already destroyed
  • 29, 30, 31, 32 : unable to destroy the 2d buffer (nil or already destroyed)
Examples:
3d_test/test_3d.pkg_.
b3d_viewGetViewportDefault ( strView  )

Return the first viewport (default) for this 3d view.

Prototype : fun [LIB3D_View] LIB3D_Viewport

Parameters
LIB3D_View: a 3d view object
Returns
LIB3D_Viewport : this viewport object if success or nil if error
Examples:
3d_test/test_3d.pkg_.
b3d_viewGetViewportAll ( strView  )

Return all viewports for this 3d view.

Prototype : fun [LIB3D_View] [LIB3D_Viewport r1]

Parameters
LIB3D_View: a 3d view object
Returns
[LIB3D_Viewport r1] : a list of viewport objects if success or nil if error
b3d_viewSetViewportDefault ( strView  ,
strViewport   
)

Set the first viewport (default) for this 3d view.

Prototype : fun [LIB3D_View LIB3D_Viewport] I

Parameters
LIB3D_View: a 3d view object
LIB3D_Viewport: the viewport object defined as default
Returns
I : 0 if success, a positive value if error :
  • 1 : 3D view object is nil
  • 2 : 3D viewport object is nil
b3d_viewSetCbDestroy ( strView  ,
cbfun   
)

Set the callback when the 3D view destroying is asked.

This function is called before the destruction.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbEnd ( strView  ,
cbfun   
)

Set the callback when the 3D view destroying is done.

This function is called after the destruction.

Prototype : fun [LIB3D_View fun [I] I] I

Parameters
LIB3D_View: a 3d view object
fun[I] I : the callback. The argument is the result of the destruction :
  • 0 : done successfully
  • 1 : the 3D view is nil
  • 2 : no window (ObjWin) in the 3d view
  • 3 and + : other errors (3d viewport, buffer, ...have some errors in their destruction)
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbPreRenderFX ( strView  ,
cbfun   
)

Set the callback to the pre rendering effects.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbPreRender ( strView  ,
cbfun   
)

Set the callback to the pre rendering.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback.
Returns
I : 0 if success, 1 if error.
Examples:
3d_test/test_3d.pkg_.
b3d_viewSetCbPostRender ( strView  ,
cbfun   
)

Set the callback to the post rendering.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbClick ( strView  ,
cbfun   
)

Set the callback when the mouse is clicked (pressed) on the 3d view.

Prototype : fun [LIB3D_View fun [LIB3D_View I I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I I] I : the callback. The supplemental arguments are : the x, y coordinates and the button number.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbDbClick ( strView  ,
cbfun   
)

Set the callback when the mouse is double clicked on the 3d view.

Prototype : fun [LIB3D_View fun [LIB3D_View I I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I I] I : the callback. The supplemental arguments are : the x, y coordinates and the button number.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbUnClick ( strView  ,
cbfun   
)

Set the callback when the mouse is released (unclicked) on the 3d view.

Prototype : fun [LIB3D_View fun [LIB3D_View I I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I I] I : the callback. The supplemental arguments are : the x, y coordinates and the button number.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbWheel ( strView  ,
cbfun   
)

Set the callback.

Prototype : fun [LIB3D_View fun [LIB3D_View I I I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I I I] I : the callback. The supplemental arguments are : the x, y coordinates, the direction and the mask (from the keyboard for example).
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbMouseMove ( strView  ,
cbfun   
)

Set the callback when the mouse moves on the 3d view.

Prototype : fun [LIB3D_View fun [LIB3D_View I I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I I] I : the callback. The supplemental arguments are : the x, y coordinates and the mask (from the keyboard for example).
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbKeyDown ( strView  ,
cbfun   
)

Set the callback when the a key is pressed from the keyboard.

Prototype : fun [LIB3D_View fun [LIB3D_View I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I] I : the callback. The supplemental arguments are : the a scancode which can be specific at the keyboard, and the ascii value.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbKeyUp ( strView  ,
cbfun   
)

Set the callback when the a key is released from the keyboard.

Prototype : fun [LIB3D_View fun [LIB3D_View I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I] I : the callback. The supplemental argument is : the a scancode which can be specific at the keyboard.
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbDropFile ( strView  ,
cbfun   
)

Set the callback when a drop file event occurs on the 3d view.

Prototype : fun [LIB3D_View fun [LIB3D_View I I [P r1]] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I [P r1]] I : the callback. The supplemental arguments are : the x, y coordinates and the list of read-reference files
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbChangeCamera ( strView  ,
cbfun   
)

Set the callback when the default camera changes.

Prototype : fun [LIB3D_View fun [LIB3D_View LIB3D_Session SO3_OBJECT] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View LIB3D_Session SO3_OBJECT] I : the callback. The supplemental arguments are : the current 3d view, the current session and the new camera object
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbResize ( strView  ,
cbfun   
)

Set the callback when the 3d view is resized.

Prototype : fun [LIB3D_View fun [LIB3D_View I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I] I : the callback. The supplemental arguments are : the new width and height
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbMove ( strView  ,
cbfun   
)

Set the callback when the 3d view moves.

Prototype : fun [LIB3D_View fun [LIB3D_View I I] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View I I] I : the callback. The supplemental arguments are : the new x and y coordinates
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbHasFocus ( strView  ,
cbfun   
)

Set the callback when the 3d view has the focus.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback
Returns
I : 0 if success, 1 if error.
b3d_viewSetCbLoseFocus ( strView  ,
cbfun   
)

Set the callback when the 3d view loses the focus.

Prototype : fun [LIB3D_View fun [LIB3D_View] I] I

Parameters
LIB3D_View: a 3d view object
fun[LIB3D_View] I : the callback
Returns
I : 0 if success, 1 if error.
b3d_viewGetSessionFirst ( strView  )

Get the first session structure object.

Prototype : fun [LIB3D_View] LIB3D_Session

Parameters
LIB3D_View: a 3d view object
Returns
LIB3D_Session : this object if success, nil if error (or no 3d session opened).
b3d_renderEnable ( strView  ,
state   
)

Enable (Disable) the rendering.

Prototype : fun [LIB3D_View I] I

Parameters
LIB3D_View: a 3d view object
I: 1 to enable, 0 to disable
Returns
I : 0 if success, 1 if error.
See Also
b3d_viewEnable
b3d_viewEnable ( strView  ,
state   
)

Enable (Disable) a 3d view. if enabled, the 3d window is shown else it is hidden.

Prototype : fun [LIB3D_View I] I

Parameters
LIB3D_View: a 3d view object
I: 1 to enable, 0 to disable
Returns
I : 0 if success, a positive value if error :
  • 1 : the render state has been not changed
  • 2 : the 3d view is nil
See Also
b3d_renderEnable
Examples:
3d_test/test_3d.pkg_.
b3d_viewConvertSizePixel2Relative ( strView  ,
pxWidth  ,
pxHeight   
)

Convert a pixel dimension to a relative dimension (from the size of 3d view).

Prototype : fun [LIB3D_View I I] [F F]

Parameters
LIB3D_View: a 3d view object
I: a width to convert (can be nil, in this case, it is ignored)
I: a height to convert (can be nil, in this case, it is ignored)
Returns
[F F] : a relative width and height if success, nil if error.
b3d_viewSetViewportSizeFromFullViewSize ( strView  ,
strViewport   
)

Resize a Viewport and the 2d buffer object from the current size of the 3d view (no fullscreen).

Prototype : fun [LIB3D_View LIB3D_Viewport] I

Parameters
LIB3D_View: a 3d view object
LIB3D_Viewport: a Viewport object
Returns
I : 0 if success, a positive value if error :
  • 1 : unable to resize the 2d buffer
  • 2 : the Viewport object is nil
  • 3 : the 3d View object is nil
  • 4 : unable to resize the Viewport
  • 5 : current mode is fullscreen, not compatible
Examples:
3d_test/test_3d.pkg_.
b3d_viewSetSizeFixed ( strView  ,
state   
)

Define if the 3d view is resizable or not.

Prototype : fun [LIB3D_View I] I

Parameters
LIB3D_View: a 3d view object
I: 0 if resizable, 1 if fixed
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d View object is nil
b3d_viewGetSizeFixed ( strView  ,
state   
)

Returns if the 3d view is resizable or not.

Prototype : fun [LIB3D_View] I

Parameters
LIB3D_View: a 3d view object
Returns
I : 0 if resizable, 1 if fixe, nil if error.
b3d_viewSetSizeMinMax ( strView  ,
tSizeMin  ,
tSizeMax   
)

Define the minimal and the maximal size of the 3d view.

Prototype : fun [LIB3D_View [I I] [I I]] I

Parameters
LIB3D_View: a 3d view object
[II] : the minimal size, in pixels. Can be nil, in this case, this limit will be ignored. One of these two value can be nil. Example [640 nil], only the width is set.
[II] : the maximal size, in pixels. Can be nil, in this case, this limit will be ignored. see remark in the minimal limits, above.
Returns
I : 0 if success, a positive value if error :
  • 1 : the 3d View object is nil
b3d_viewGetSizeMinMax ( strView  )

Returns if the limits of the 3d view size, in pixels.

Prototype : fun [LIB3D_View] [[I I] [I I]]

Parameters
LIB3D_View: a 3d view object
Returns
[I I] [I I] : the minimal and the maximal size limits, if success, nil if error.
Remarks
If an error occurs, the return is nil. If one limit is nil, one tuple is nil. Example [nil [640 480]] If the two limits are nil, the return is [nil nil]
b3d_viewGetSize ( strView  )

Get the current size of the 3d window.

Prototype : fun [LIB3D_View] [I I]

Parameters
LIB3D_View: a 3d view object
Returns
[I I] : the (width, height) if success or nil if error
Examples:
3d_test/test_3d.pkg_.
b3d_viewGetOldSize ( strView  )

Get the last known size of the 3d window (before the current size)

Prototype : fun [LIB3D_View] [I I]

Parameters
LIB3D_View: a 3d view object
Returns
[I I] : the (width, height) if success or nil if error
b3d_viewSetSize ( strView  ,
neww  ,
newh   
)

Resize the 3d view.

Prototype : fun [LIB3D_View I I] I

Parameters
LIB3D_View: a 3d view object
I: the new width, in pixels. Nil if unchanged.
I: the new height, in pixels. Nil if unchanged.
Returns
I : 0 if success or a positive value if error :
  • 1 : the 3d view is nil
  • 2 (warning only) : the given new size is the same than the old size.
b3d_viewSetFocus ( strView  ,
state   
)

Activate or desactivate the focus to the 3d window.

Prototype : fun [LIB3D_View I] I

Parameters
LIB3D_View: a 3d view object
I: 1 to activate, 0 to desactivate (and activate the mother window)
Returns
I : 0 if success or 1 if error
b3d_viewGetPos ( strView  )

Get the current position of the 3d window (inside its mother)

Prototype : fun [LIB3D_View] [I I]

Parameters
LIB3D_View: a 3d view object
Returns
[I I] : the (x, y coordinates) if success or nil if error
b3d_viewSetPos ( strView  ,
newx  ,
newy   
)

Set the position of the 3d window (inside its mother)

Prototype : fun [LIB3D_View I I] I

Parameters
LIB3D_View: a 3d view object
I: the new width. Can be nil if unchanged.
I: the new height. Can be nil if unchanged.
Returns
I : 0 if success or 1 if error (3d view is nil), 2 if no change applied (same position than the previous)
Remarks
This function only moves the 3d view, not the window mother.