Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
base3d.pkg File Reference

Scol 3D Library - 3D basic API. More...

Functions

 b3d_bufferDestroy (strView)
 Destroy the buffer.
 b3d_bufferGetObj (strView)
 Get the SO3_BUFFER object from the 3d view object.
 b3d_cameraAdd (strSession, name, flag)
 Add a camera in a given session.
 b3d_cameraDestroy (strSession, cam)
 Destroy a camera.
 b3d_cameraGetFromId (strSession, id)
 Get the camera object from a camera id.
 b3d_cameraGetFromInit (strSession)
 Get the the camera which it created during the 3d session initialization.
 b3d_cameragetfromname (cameras, name)
 b3d_cameraGetFromName (strSession, name)
 Get the the camera from its name.
 b3d_cameragetidfromcamera (cameras, cam)
 b3d_cameraGetIdFromCamera (strSession, cam)
 Get the name from a camera id.
 b3d_cameraGetNameFromId (strSession, id)
 Get the name from a camera id.
 b3d_cameraGetOrthographicWindow (camera)
 Get the orthographic window settings, for use with orthographic rendering only.
 b3d_cameraGetParams (camera)
 Return the camera parameters.
 b3d_cameraGetProjection (camera)
 Get the current mode of projection to use with this camera.
 b3d_cameraRestoreLast (strSession)
 Restore the last used camera before the current camera.
 b3d_cameraSetDefault (strSession, cam)
 Set a camera as the default camera.
 b3d_cameraSetOrthographicWindow (camera, width, height)
 Sets the orthographic window settings, for use with orthographic rendering only.
 b3d_cameraSetOrthographicWindowFromScale (camera, scale)
 Sets the orthographic window settings, for use with orthographic rendering only.
 b3d_cameraSetParams (camera, focalLength, fovy, near, far)
 Set the camera parameters.
 b3d_cameraSetParamsFromId (strSession, id, focalLength, fovy, near, far)
 Set the camera parameters.
 b3d_cameraSetProjection (camera, mode)
 Set the mode of projection to use with this camera.
 b3d_cameraSetProjectionFromId (strSession, id, mode)
 Set the mode of projection to use with this camera.
 b3d_cbbufferpostrender (buffer, strView)
 b3d_cbbufferprerender (buffer, strView)
 b3d_gridShow (strSession, state)
 Show / Hide a grid.
 b3d_infoFullscreenModes ()
 Get fullscreen video modes supported by the host.Prototype: fun [] [S r1].
 b3d_infoLib ()
 Version's informations about this libraryPrototype: fun [] [S S S].
 b3d_infoMultiSamplingModes (flag)
 Get multi sampling modes supported by the host.Prototype: fun [] [S r1].
 b3d_infoSys ()
 This is a conivence function. It returns several infos about the system. These infos are the same than provided by 'SO3GetGeneralInfo' function but they are formatted.Prototype: fun [] S.
 b3d_init ()
 b3d_initbuffer (buffer, strView)
 b3d_initError (logfilename, mask, hardlog)
 Initialiaze the internal error 3d library.
 b3d_initPhysics (strSession)
 Initialiaze the 3D PhysicsPrototype: fun [LIB3D_Session] LIB3D_Physics.
 b3d_initSession (strView, name, cbInit)
 Initialiaze the 3D Session. A default camera "camera_init", a default group "_defaultResources" and an ambiant light are defined too.
 b3d_initView (ch, winFather, cbInit, cbEnd)
 Initialiaze the 3D View.
 b3d_initwindow (win, strView)
 b3d_lightAdd (strSession, name, type, father)
 Create (add) a new light.
 b3d_lightAmbiantGet (strSession)
 Get the 3d ambiant light.
 b3d_lightAmbiantSet (strSession, color)
 Set the 3d ambiant light.
 b3d_lightchecktype (type)
 b3d_lightGetAttenuation (light)
 Get the attenuation coefficients of a light.
 b3d_lightGetColors (light)
 Get the diffuse and specular colors of a light.
 b3d_lightGetType (light)
 Get the type of a light.
 b3d_lightGetVisible (light)
 Get the visibility of a light.
 b3d_lightSetAttenuation (light, tuple)
 Set the attenuation coefficients of a light.
 b3d_lightSetColorDiffuse (light, color)
 Set the diffuse color of a light.
 b3d_lightSetColors (light, tuple)
 Set the specular color of a light.
 b3d_lightSetColorSpecular (light, color)
 Set the specular color of a light.
 b3d_lightSetType (light, type)
 Set the type of a light.
 b3d_lightSetVisible (light, state)
 Set the visibility of a light.
 b3d_misc_listCamerasRemove (l, cam)
 b3d_misc_listIU0_removeElt (l, u0)
 b3d_misc_listIU0GetEltFromU0 (l, u0)
 b3d_objDestroy (obj)
 Destroy any 3d object.
 b3d_objGetFromName (strSession, name)
 Get an 3d object from its name in a given session object.
 b3d_objGetGlobalOrientation (obj)
 Get the current global orientation of an 3d object.
 b3d_objGetOrientation (obj)
 Get the current orientation of an 3d object.
 b3d_objGetPosition (obj)
 Set the 3d object position.
 b3d_objLink (obj, father)
 Link an 3d object to another 3d object.
 b3d_objSetGlobalOrientation (obj, angDeg)
 Set the global orientation of an 3d object.
 b3d_objSetOrientation (obj, angDeg)
 Set the orientation of an 3d object.
 b3d_objSetPosition (obj, posF)
 Set the 3d object position.
 b3d_objSetRotate (obj, rot, tuple, flag)
 Rotate an 3d object.
 b3d_objSetRotatePitch (obj, pitch, flag)
 Set the pitch of an 3d object.
 b3d_physicsDebug (strSession, state)
 Show / Hide the debug physics lines.
 b3d_physicsEnable (strSession, state)
 Enable / Disable the physics world.
 b3d_physicsGetArchi (strSession)
 Get the platform architecture.
 b3d_physicsGetFps (strSession)
 Get the fps model.
 b3d_physicsGetFriction (strSession)
 Get the friction model.
 b3d_physicsGetGravity (strSession)
 Get the world gravity.
 b3d_physicsGetSize (strSession)
 Get the world size.
 b3d_physicsGetSolver (strSession)
 Get the solver model.
 b3d_physicsInitBodies (strSession)
 Set the current PRS as initial PRS to all bodies.
 b3d_physicsIsDebug (strSession, state)
 Return if the debug physics lines is shown / hidden.
 b3d_physicsIsEnabled (strSession)
 Return if the physics world is enabled / disabled.
 b3d_physicsReset (strSession)
 Reset the physics world and all bodies states.
 b3d_physicsSetArchi (strSession, mode)
 Set the platform architecture.
 b3d_physicsSetDefault (strSession)
 Set the physics with the default values.
 b3d_physicsSetFps (strSession, value)
 Set the fps model.
 b3d_physicsSetFriction (strSession, mode)
 Set the friction model.
 b3d_physicsSetGravity (strSession, vector)
 Set the world gravity.
 b3d_physicsSetGravityEarth (strSession)
 Set the world gravity as on Earth (x = 0, y = 9.81, z = 0).
 b3d_physicsSetSize (strSession, vector)
 Set the world size.
 b3d_physicsSetSolver (strSession, mode)
 Set the solver model.
 b3d_renderEnable (strView, state)
 Enable (Disable) the rendering.
 b3d_resourcesGetGroupNameDefault (strSession)
 Return the group name by default. It was created by this library when the 3d session is initialized.
 b3d_resourcesloadp (pRsc, session, nErr)
 b3d_resourcesLoadP (strSession, pRsc)
 Load a list of resources in a session.
 b3d_sessionCbAxisClick (strSession, cbfun)
 Set the callback when an axis is clicked.
 b3d_sessionCbAxisMove (strSession, cbfun)
 Set the callback when an axis is moved.
 b3d_sessionCbAxisUnClick (strSession, cbfun)
 Set the callback when an axis is unclicked.
 b3d_sessionCbPostRender (strSession, cbfun)
 Set the callback to post-rendering.
 b3d_sessionCBpostrender (scn, strSession, elapsedTime)
 b3d_sessionCbPreRender (strSession, cbfun)
 Set the callback to the pre redering.
 b3d_sessionCBprerender (scn, strSession, elapsedTime)
 b3d_sessionCBprerender2 (scn, strSession, elapsedTime)
 b3d_sessionCbPreRenderEnd (strSession, cbfun)
 Set the callback to the end of the pre-rendering.
 b3d_sessionCBprerenderphysic (scn, strSession, elapsedTime)
 b3d_sessionCbPreRenderPhysics (strSession, cbfun)
 Set the callback to the physics pre-rendering.
 b3d_sessionDestroy (strSession)
 Destroys session object.
 b3d_sessionGet (strSession)
 Return the Scol session object from the library session object.
 b3d_sessionGetView (strSession)
 Return the 3D view object used by the 3D Session object.
 b3d_sessiongridcreate (strSession)
 b3d_sessiongriddestroy (strSession)
 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_viewportDestroy (strView, strViewport)
 Destroy a 3d viewport.
 b3d_viewportGet (strViewport)
 Get the SO3_VIEWPORT obj from the 3d viewport.
 b3d_viewportGetBgcolor (strViewport)
 Return the background color to a given viewport object.
 b3d_viewportGetCamera (strViewport)
 Return the current camera to a given 3d viewport.
 b3d_viewportGetClearBufferColorDepth (strViewport)
 Get if the given viewport clear the color and the depth buffer or not.
 b3d_viewportGetPolygonMode (strViewport, mode)
 Get the polygon rendering mode for a given viewport.
 b3d_viewportGetPosSize (strViewport)
 Get the position and the size of a viewport object.
 b3d_viewportGetShadow (strViewport)
 Get if the shadow is enabled or disabled on a given viewport.
 b3d_viewportGetSky (strViewport)
 Get the skies visibility state on a given viewport.
 b3d_viewportNew (strView, camera)
 Create a new viewport with the default parameters.
 b3d_viewportSetBgcolor (strViewport, color)
 Set the background color to a given viewport object.
 b3d_viewportSetCamera (strViewport, camera)
 Set the camera to a given 3d viewport.
 b3d_viewportSetClearBufferColorDepth (strViewport, stateColor, stateDepth)
 Set if the given viewport clear the color and the depth buffer or not.
 b3d_viewportSetPolygonMode (strViewport, mode)
 Set the polygon rendering mode for a given viewport.
 b3d_viewportSetPosSize (strViewport, x, y, width, height)
 Move and resize a viewport object. Values are from the father object.
 b3d_viewportSetShadow (strViewport, state)
 Enable / Disable the shadows on a given viewport.
 b3d_viewportSetSky (strViewport, state)
 Set the skies visibility state on a given viewport.
 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.
 b3d_winCBdestroy (win, strView)
 b3d_winCBfocus (win, strView)
 b3d_winCBfocuskilled (win, strView)
 b3d_winCBmove (win, strView, newX, newY)
 b3d_winCBsize (win, strView, newW, newH)
 b3d_winGetMotherObj (strView)
 Get the mother window from the 3d view.
 b3d_winGetObj (strView)
 Get the window from the 3d view.
 b3d_winmotherCBsize (win, strView, newW, newH)

Detailed Description

Scol 3D Library - 3D basic API.

Author
Scol team
Version
0.1

Function Documentation

b3d_resourcesLoadP ( strSession  ,
pRsc   
)

Load a list of resources in a session.

Prototype : fun [LIB3D_Session [[S S I] r1]] I

Parameters
LIB3D_Session: a session object
[[SS I] r1]] : a list, for each item :
  • a filename,
  • a group name (il nil, this name will be "General")
  • and a flag : SO3_RESOURCE_MESH, SO3_RESOURCE_MATERIAL, SO3_RESOURCE_TEXTURE, SO3_RESOURCE_SKELETON, SO3_RESOURCE_GPUPROGRAM, SO3_RESOURCE_HIGHLEVELGPUPROGRAM, SO3_RESOURCE_COMPOSITOR or SO3_RESOURCE_PARTICLE_SYSTEM.
Returns
I : 0 if success or another value if error (or not found)
  • (-1) : given 3d session is nil
  • (-2) : given resources are nil
  • a positive value (> 0) : the number of not loaded resources
b3d_resourcesGetGroupNameDefault ( strSession  )

Return the group name by default. It was created by this library when the 3d session is initialized.

Prototype : fun [LIB3D_Session] S

Parameters
LIB3D_Session: a 3d session
Returns
S : this group name or nil if error
Examples:
3d_test/test_3d.pkg_.