/* ********************************************************************* This source file is a part of the standard library of Scol For the latest info, see http://www.scolring.org Copyright (c) 2014 Stephane Bisaro aka Iri, based on a work of Bastien BOURINEAU (I-Maginer). This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ********************************************************************* */ /* * 3D errors for basic 3d manipulations * See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage * for more informations */ /*! \file base3struct.pkg * \author Scol team * \version 0.1 * \copyright GNU Lesser General Public License 2.0 or later * \brief Scol 3D Library - 3D basic definitions. This package is a part of basic3d.pkg * **/ var szLIB3D_RSCPATH = "lib/3d/rsc/";; var iLIB3D_NULL = 0;; var iLIB3S_ISDEFAULT = 1;; var iLIB3D_VIEWS = -1;; var iLIB3D_SESSIONS = -1;; // - Mouse - var iLIB3D_CLICK_NO = 0;; var iLIB3D_CLICK_LEFT = 1;; var iLIB3D_CLICK_RIGHT = 2;; var iLIB3D_CLICK_SHIFT = 4;; var iLIB3D_CLICK_CTRL = 8;; var iLIB3D_CLICK_MIDDLE = 16;; var iLIB3D_AXIS_X = 32;; var iLIB3D_AXIS_Y = 64;; var iLIB3D_AXIS_Z = 128;; var iLIB3D_WINDOWED = 0;; var iLIB3D_FULLSCREEN = 1;; // Meter var iLIB3D_GlobalUnit = 1;; var iLIB3D_Index = -1;; var iLIB3D_WHITE = 0xFFFFFF;; var iLIB3D_BLACK = 0;; var iLIB3D_GREY = 0x777777;; var iLIB3D_VERSION = "20140220";; var szCAMERAINIT = "camera_init";; var szGROUPINIT = "_defaultResources";; var szSESSION = "session_";; /*! \struct LIB3D_Session * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_SessionCB = [ lib3d_cbAxisClick : fun [LIB3D_Session SO3_OBJECT I I I I] I, /*!< callback to click on an axis */ lib3d_cbAxisUnClick : fun [LIB3D_Session SO3_OBJECT I I I I] I, /*!< callback to unclick on an axis */ lib3d_cbAxisMove : fun [LIB3D_Session SO3_OBJECT I I I I F] I,/*!< callback to move (rollover) on an axis */ lib3d_cbScenePreRender : fun [LIB3D_Session I] I, /*!< callback to the prerendering */ lib3d_cbScenePreRender2 : fun [LIB3D_Session I] I, /*!< callback to the prerendering (2) */ lib3d_cbScenePreRenderPhysic : fun [LIB3D_Session I] I, /*!< callback to the physic prerendering */ lib3d_cbScenePostRender : fun [LIB3D_Session I] I, /*!< callback to the postrendering */ lib3d_cbSceneInit : fun [LIB3D_Session I] I, /*!< callback when the 3d session initialization is ended */ lib3d_cbSceneDestroyed : fun [] I, /*!< callback when the session is destroyed */ lib3d_cbSceneDestroy : fun [LIB3D_Session] I /*!< callback when the destruction has been asked */ ] mkLIB3D_SessionCB;; /*! \struct LIB3D_Session * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Session = [ lib3d_sessionView : LIB3D_View, /*!< 3d View structure */ lib3d_session : SO3_SCENE, /*!< SO3 scene */ lib3d_defaultLight : SO3_OBJECT, /*!< default scene light */ lib3d_lCamera : [[I [S SO3_OBJECT]] r1], /*!< list of scene cameras */ lib3d_defaultCamera : SO3_OBJECT, /*!< current default camera */ lib3d_nCamera : I, /*!< last given camera id, -1 if no camera added */ lib3d_lPrevDefaultCamera : [SO3_OBJECT r1], /*!< previous default camera */ lib3d_shellNavigate : SO3_OBJECT, /*!< default navigation shell (camera) */ lib3d_sessionId : I, /*!< session id */ lib3d_sessionName : S, /*!< session name */ lib3d_physics : LIB3D_Physics, /*!< physic structure */ lib3d_lAxis : [[SO3_OBJECT LIB3D_Axis] r1], /*!< list of scene axis */ lib3d_lHelper : [[SO3_OBJECT LIB3D_Helper] r1], /*!< list of scene helpers */ lib3d_helperGrid : [SO3_OBJECT [SO3_OBJECT r1]], /*!< helper grid */ lib3d_bHelpersState : I, /*!< helpers visibility state */ lib3d_selectedAxis : [LIB3D_Axis I], /*!< current selected axis */ lib3d_bNavigate : I, /*!< default navigation state */ lib3d_lAnimations : [[S LIB3D_Anim] r1], /*!< list of scene animations */ lib3d_sessionCB : LIB3D_SessionCB /*!< callbacks */ ] mkLIB3D_Session;; /*! \struct LIB3D_ViewCB * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_ViewCB = [ lib3dview_cbInit : fun [LIB3D_View I] I, lib3dview_cbDestroy : fun [LIB3D_View] I, lib3dview_cbDestroy2 : fun [I] I, lib3dview_cbPreRenderEffects : fun [LIB3D_View] I, lib3dview_cbPreRender : fun [LIB3D_View] I, lib3dview_cbPostRender : fun [LIB3D_View] I, lib3dview_cbClick : fun [LIB3D_View I I I] I, lib3dview_cbDbClick : fun [LIB3D_View I I I] I, lib3dview_cbUnClick : fun [LIB3D_View I I I] I, lib3dview_cbWheel : fun [LIB3D_View I I I I] I, lib3dview_cbCursorMove : fun [LIB3D_View I I I] I, lib3dview_cbKeyDown : fun [LIB3D_View I I] I, lib3dview_cbKeyUp : fun [LIB3D_View I] I, lib3dview_cbDropFile : fun [LIB3D_View I I [P r1]] I, lib3dview_cbCameraChange : fun [LIB3D_View LIB3D_Session SO3_OBJECT] I, lib3dview_cbResizeView : fun [LIB3D_View I I] I, lib3dview_cbFocusView : fun [LIB3D_View] I, lib3dview_cbKillFocusView : fun [LIB3D_View] I, lib3dview_cbMoveView : fun [LIB3D_View I I] I ] mkLIB3D_ViewCB;; /*! \struct LIB3D_View * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_View = [ lib3d_win : ObjWin, //!< buffer scol window lib3d_motherwin : ObjWin, //!< mother scol window lib3d_buffer : SO3_BUFFER, //!< SO3 3D buffer lib3d_channel : Chn, //!< view scol channel lib3d_iSize : [I I], //!< view size lib3d_iPosition : [I I], //!< view position lib3d_iOldSize : [I I], //!< previous view size lib3d_iSizeMin : [I I], //!< minimal view size lib3d_iSizeMax : [I I], //!< maximal view size lib3d_iViewId : I, /*!< view id */ lib3d_iSizeFixed : I, /*!< 1 -> fixed */ lib3d_lSessions : [LIB3D_Session r1], //!< list of scenes associated with this view lib3d_bPaused : I, //!< pause state // ressources lib3d_iRenderTick : I, //!< render last tick // mouse / keyboard lib3d_iClickStatus : I, //!< last mouse click state lib3d_iClickPos : [I I], //!< last mouse click position (x, y) lib3d_iMovePos : [I I], //!< last mouse position (x, y) lib3d_lastMouseData : [LIB3D_Session SO3_VIEWPORT SO3_OBJECT SO3_MATERIAL I [I [[F F F] [F F F] [F F F]] [[F F] [F F] [F F]]] [F F F] [F F] F], //!< last complete mouse data // Cursor direction lib3d_iCursorDir : [I I], //!< last mouse cursor direction (X,Y) lib3d_iRenderMoveMouse : [I I], //!< last mouse move position in render view lib3d_iMoveClickStatus : I, //!< last mouse move click state lib3d_bMouseEnabled : I, //!< mouse enable state lib3d_bKeyboardEnabled : I, //!< keyboard enable state lib3d_lViewport : [[I LIB3D_Viewport] r1], lib3d_bFullScreen : I, //!< current fullscreen state lib3d_bState : I, //!< current view state (enabled/disabled) lib3d_bShowCursor : I, //!< current show cursor state // Callbacks lib3d_viewCB : LIB3D_ViewCB /*!< Callbacks */ ] mkLIB3D_View;; /*! \struct LIB3D_Viewport * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Viewport = [ lib3d_iViewportIndex : I, //!< viewport index lib3d_viewport : SO3_VIEWPORT, //!< SO3 viewport object lib3d_iViewportPos : [F F], //!< float position lib3d_iViewportSize : [F F], //!< float size lib3d_lWidgetControl : [SO3_WIDGET r1], //!< list of widgets lib3d_iBgColor : I, //!< background color lib3d_iPolygonMode : I, //!< render polygon mode lib3d_lCompositor : [[S S] r1] //!< list of viewport compositors ] mkLIB3D_Viewport;; /*! \struct LIB3D_Axis * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Axis = [ lib3d_axisFather : SO3_OBJECT, //!< parent node lib3d_axisShell : SO3_OBJECT, //!< shell axis lib3d_xAxisObject : SO3_OBJECT, //!< X axis object lib3d_yAxisObject : SO3_OBJECT, //!< Y axis object lib3d_zAxisObject : SO3_OBJECT, //!< Z axis object lib3d_xAxisTextObject : SO3_OBJECT, //!< X axis letter object lib3d_yAxisTextObject : SO3_OBJECT, //!< Y axis letter object lib3d_zAxisTextObject : SO3_OBJECT, //!< Z axis letter object lib3d_iAxisMode : I //!< axis mode, 1 translation, 2 rotation, 3 scale ] mkLIB3D_Axis;; /*! \struct LIB3D_Helper * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Helper = [ lib3d_helperFather : SO3_OBJECT, //!< parent node lib3d_helperIcon : SO3_OBJECT, //!< helper icon object lib3d_iHelperMode : I //!< helper type, 1 node, 4 light, 8 camera ] mkLIB3D_Helper;; /*! \struct LIB3D_Anim * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Anim = [ lib3d_animSession : LIB3D_Session, lib3d_anim : SO3_ANIM, lib3d_iAnimId : I, lib3d_sBaseName : S, lib3d_meshAnim : SO3_OBJECT, // Animated object / node lib3d_nodePRS : [[F F F] [F F F F] [F F F]], lib3d_sAnimName : S, lib3d_bAnimState : I, lib3d_bAnimSkipFrame : I, lib3d_fAnimWeight : F, // Current animation weight lib3d_iAnimLenght : F, // anim lenght lib3d_iAnimType : I, // define if this animation is an mesh, skeletal, node or animation sequence lib3d_cbAnimPlay : fun [LIB3D_Anim] I, lib3d_cbAnimPause : fun [LIB3D_Anim] I, lib3d_cbAnimStop : fun [LIB3D_Anim] I, lib3d_bAnimReset : I ] mkLIB3D_Anim;; /*! \struct LIB3D_Physics * * \brief Opaque internal structure. You should never call it directly, use * API instead ! * **/ struct LIB3D_Physics = [ lib3d_vWorld : [F F F], lib3d_iGravityVec : [F F F], lib3d_bEnable : I, lib3d_bDebugPhy : I ] mkLIB3D_Physics;; /* PROTOTYPES */ proto b3d_winSetFocus = fun [LIB3D_View I] I;; proto b3d_viewportDestroy = fun [LIB3D_View LIB3D_Viewport] I;; proto b3d_physicsEnable = fun [LIB3D_Session I] I;; proto b3d_bufferDestroy = fun [LIB3D_View] I;; proto b3d_resourcesGetGroupNameDefault = fun [LIB3D_Session] S;; proto b3d_viewportSetPosSize = fun [LIB3D_Viewport F F F F] I;;