/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 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 ----------------------------------------------------------------------------- */ fun deleteOb(inst)= SO3SceneSetShadowPreset (V3DgetSession c3dXsession) SO3_SHADOWS_PRESET_NONE; let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in ( SO3ViewportSetDeferredEnabled viewportstr.V3D_viewport 0; SO3ViewportSetDeferredAntiAliasingMode viewportstr.V3D_viewport 0; ); 0;; fun getDebugModeByName(mode)= if !strcmp (strtrim mode) "Standard" then 0 else if !strcmp (strtrim mode) "Colour" then 1 else if !strcmp (strtrim mode) "Normal" then 2 else if !strcmp (strtrim mode) "Depth" then 3 else if !strcmp (strtrim mode) "Specular" then 4 else if !strcmp (strtrim mode) "Emissive" then 5 else if !strcmp (strtrim mode) "Velocity" then 6 else if !strcmp (strtrim mode) "MaterialID" then 7 else nil;; fun cbSetDebugMode(inst, from, action, param, rep) = if param == nil then nil else let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in SO3ViewportSetDeferredDebugMode viewportstr.V3D_viewport getDebugModeByName(param); 0;; fun cbEnable(inst, from, action, param, rep) = let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in SO3ViewportSetDeferredEnabled viewportstr.V3D_viewport 1; 0;; fun cbDisable(inst, from, action, param, rep) = let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in SO3ViewportSetDeferredEnabled viewportstr.V3D_viewport 0; 0;; fun newOb(inst)= setPluginInstanceCbDel inst @deleteOb; let (V3DgetDefaultViewport (V3DgetSessionView c3dXsession)) -> viewportstr in let atoi (getPluginInstanceParam inst "renderingMode") -> renderingMode in let atoi (getPluginInstanceParam inst "antiAliasingMode") -> antiAliasing in ( SO3ViewportSetDeferredEnabled viewportstr.V3D_viewport 1; SO3ViewportSetDeferredDebugMode viewportstr.V3D_viewport renderingMode; SO3ViewportSetDeferredAntiAliasingMode viewportstr.V3D_viewport antiAliasing; SO3SceneSetShadowFarDistance (V3DgetSession c3dXsession) 100.0; SO3SceneSetShadowDirectionalLightExtrusionDistance (V3DgetSession c3dXsession) 75.0; SO3SceneSetShadowLightingTechnique (V3DgetSession c3dXsession) SO3_ADDITIVE_SHADOWS_PRESET_TECHNIQUE; SO3SceneSetShadowTextureSize (V3DgetSession c3dXsession) 2048; SO3SceneSetShadowPreset (V3DgetSession c3dXsession) SO3_SHADOWS_PRESET_DEFERRED; PluginRegisterAction inst "Enable" @cbEnable; PluginRegisterAction inst "Disable"@cbDisable; PluginRegisterAction inst "Set debug mode" @cbSetDebugMode; ); 0;; fun IniPlug(file)= PlugRegister @newOb nil; setPluginEditor @dynamicedit; 0;;