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

Functions

 b3d_viewportDestroy (strView, strViewport)
 Destroy a 3d viewport. More...
 
 b3d_viewportGet (strViewport)
 Get the SO3_VIEWPORT obj from the 3d viewport. More...
 
 b3d_viewportGetBgcolor (strViewport)
 Return the background color to a given viewport object. More...
 
 b3d_viewportGetCamera (strViewport)
 Return the current camera to a given 3d viewport. More...
 
 b3d_viewportGetClearBufferColorDepth (strViewport)
 Get if the given viewport clear the color and the depth buffer or not. More...
 
 b3d_viewportGetPolygonMode (strViewport, mode)
 Get the polygon rendering mode for a given viewport. More...
 
 b3d_viewportGetPosSize (strViewport)
 Get the position and the size of a viewport object. More...
 
 b3d_viewportGetShadow (strViewport)
 Get if the shadow is enabled or disabled on a given viewport. More...
 
 b3d_viewportGetSky (strViewport)
 Get the skies visibility state on a given viewport. More...
 
 b3d_viewportNew (strView, camera)
 Create a new viewport with the default parameters. More...
 
 b3d_viewportSetBgcolor (strViewport, color)
 Set the background color to a given viewport object. More...
 
 b3d_viewportSetCamera (strViewport, camera)
 Set the camera to a given 3d viewport. More...
 
 b3d_viewportSetClearBufferColorDepth (strViewport, stateColor, stateDepth)
 Set if the given viewport clear the color and the depth buffer or not. More...
 
 b3d_viewportSetPolygonMode (strViewport, mode)
 Set the polygon rendering mode for a given viewport. More...
 
 b3d_viewportSetPosSize (strViewport, x, y, width, height)
 Move and resize a viewport object. Values are from the father object. More...
 
 b3d_viewportSetShadow (strViewport, state)
 Enable / Disable the shadows on a given viewport. More...
 
 b3d_viewportSetSky (strViewport, state)
 Set the skies visibility state on a given viewport. More...
 

Detailed Description

Function Documentation

b3d_viewportNew ( strView  ,
camera   
)

Create a new viewport with the default parameters.

The defaults are :

  • The position at 0,0;
  • the size of the current 3d view;
  • a background grey
  • the polygon render mode set to SO3_POLY_SOLID

Prototype : fun [LIB3D_View SO3_OBJECT] LIB3D_Viewport

Parameters
LIB3D_View: a 3d view object
SO3_OBJECT: a camera object
Returns
LIB3D_Viewport : a new viewport object if success or nil if error
See also
b3d_cameraGetCameraFromId
Examples:
3d_test/test_3d.pkg_.
b3d_viewportSetPosSize ( strViewport  ,
,
,
width  ,
height   
)

Move and resize a viewport object. Values are from the father object.

Prototype : fun [LIB3D_Viewport F F F F] I

Parameters
LIB3D_Viewport: a 3d viewport object
F: the new x coordinate (0 and 1)
F: the new y coordinate (0 and 1)
F: the new width (0 and 1)
F: the new height (0 and 1)
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : the resizing failed
b3d_viewportGetPosSize ( strViewport  )

Get the position and the size of a viewport object.

Prototype : fun [LIB3D_Viewport] [F F F F]

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
[F F F F] : x y w h if success or nil if error
b3d_viewportSetBgcolor ( strViewport  ,
color   
)

Set the background color to a given viewport object.

Prototype : fun [LIB3D_Viewport I] I

Parameters
LIB3D_Viewport: a 3d viewport object
I: a rgba color
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : the given operation failed
Examples:
3d_test/test_3d.pkg_.
b3d_viewportGetBgcolor ( strViewport  )

Return the background color to a given viewport object.

Prototype : fun [LIB3D_Viewport] I

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
I : this background color if success or nil if error
b3d_viewportSetClearBufferColorDepth ( strViewport  ,
stateColor  ,
stateDepth   
)

Set if the given viewport clear the color and the depth buffer or not.

Prototype : fun [LIB3D_Viewport I I] I

Parameters
LIB3D_Viewport: a 3d viewport object
I: 1 to clear the color, else 0
I: 1 to clear the depth, else 0
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : the 'clear color' operation failed
  • 3 : the 'clear depth' operation failed
  • 5 : the two 'clear' operation failed
b3d_viewportGetClearBufferColorDepth ( strViewport  )

Get if the given viewport clear the color and the depth buffer or not.

Prototype : fun [LIB3D_Viewport] [I I]

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
[I I] : 1 if clear else 0 or nil if error
b3d_viewportSetShadow ( strViewport  ,
state   
)

Enable / Disable the shadows on a given viewport.

Prototype : fun [LIB3D_Viewport I] I

Parameters
LIB3D_Viewport: a 3d viewport object
I: 1 to enable, 0 to disable
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : this operation failed
b3d_viewportGetShadow ( strViewport  )

Get if the shadow is enabled or disabled on a given viewport.

Prototype : fun [LIB3D_Viewport] I

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
I : 1 if enabled, 0 if disabled or nil if error
b3d_viewportSetSky ( strViewport  ,
state   
)

Set the skies visibility state on a given viewport.

Prototype : fun [LIB3D_Viewport I] I

Parameters
LIB3D_Viewport: a 3d viewport object
I: 1 to enable, 0 to disable
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : this operation failed
b3d_viewportGetSky ( strViewport  )

Get the skies visibility state on a given viewport.

Prototype : fun [LIB3D_Viewport] I

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
I : 1 if enabled, 0 if disabled or nil if error
b3d_viewportGet ( strViewport  )

Get the SO3_VIEWPORT obj from the 3d viewport.

Prototype : fun [LIB3D_Viewport] SO3_VIEWPORT

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
SO3_VIEWPORT : this object or nil if error
Examples:
3d_test/test_3d.pkg_.
b3d_viewportDestroy ( strView  ,
strViewport   
)

Destroy a 3d viewport.

Prototype : fun [LIB3D_Viewport] I

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
I : 0 if success or 1 if the given object is nil, 2 if unable to destroy the internal SO3_VIEWPORT object.
b3d_viewportSetCamera ( strViewport  ,
camera   
)

Set the camera to a given 3d viewport.

Prototype : fun [LIB3D_Viewport SO3_OBJECT] I

Parameters
LIB3D_Viewport: a 3d viewport object
SO3_OBJECT: the camera object
Returns
I : 0 if success or a positive value if error :
  • 1 : the 3d viewport is nil
  • 2 : the camera is nil
  • 3 : for an internal reason, the camera can not set to the given 3d viewport.
b3d_viewportGetCamera ( strViewport  )

Return the current camera to a given 3d viewport.

Prototype : fun [LIB3D_Viewport] SO3_OBJECT

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
SO3_OBJECT : the camera object if success or nil if error
b3d_viewportSetPolygonMode ( strViewport  ,
mode   
)

Set the polygon rendering mode for a given viewport.

Prototype : fun [LIB3D_Viewport I] I

Parameters
LIB3D_Viewport: a 3d viewport object
I: the choosen mode, one of these following values :
  • SO3_POLY_POINTS
  • SO3_POLY_SOLID
  • SO3_POLY_WIREFRAME
Returns
I : 0 if success or a positive value if error
  • 1 : given viewport object is nil
  • 2 : the given mode value is incorrect
  • 3 : this operation failed for an internal reason
b3d_viewportGetPolygonMode ( strViewport  ,
mode   
)

Get the polygon rendering mode for a given viewport.

Prototype : fun [LIB3D_Viewport] I

Parameters
LIB3D_Viewport: a 3d viewport object
Returns
I : the current mode or nil if error
  • SO3_POLY_POINTS
  • SO3_POLY_SOLID
  • SO3_POLY_WIREFRAME