1 /***************************************************************************** 2 * $LastChangedDate: 2009-12-14 13:08:18 -0500 (Mon, 14 Dec 2009) $ 3 * @file 4 * @author Jim E. Brooks http://www.palomino3d.org 5 * @brief Module. 6 *//* 7 * LEGAL: COPYRIGHT (C) 2009 JIM E. BROOKS 8 * THIS SOURCE CODE IS RELEASED UNDER THE TERMS 9 * OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2). 10 *****************************************************************************/ 11 12 #define SHADER_MODULE_CC 1 13 #include "base/module.hh" 14 #include "base/module_macros.hh" 15 using namespace base; 16 #include "graph/module.hh" 17 #include "graph/scene_graph.hh" 18 using namespace graph; 19 #include "shader/module.hh" 20 #include "shader/conf.hh" 21 #include "shader/shader_funcs.hh" 22 #include "shader/shader_name.hh" 23 #include "shader/light.hh" 24 25 namespace shader { 26 27 /***************************************************************************** 28 * Initialize module. 29 *****************************************************************************/ 30 void Init(const base::InitArgs & initArgs)31Init( const base::InitArgs& initArgs ) 32 { 33 MODULE_INIT_LOAD_CONF_TXT( shader ) 34 } 35 36 /***************************************************************************** 37 * Start module. 38 *****************************************************************************/ 39 void Start(void)40Start( void ) 41 { 42 RefPtr<GroupNode> rootNode = GET_SCENE_GRAPH().GetRootNode(); 43 Light& light = GET_LIGHT(); 44 45 // Shader uniform defaults. 46 ResetShaderUniformsForRootNode( *rootNode ); 47 48 // Lighting. 49 light.SetLightPosition( 0, SHADER_CONF.mLight0Position ); 50 light.SetLightBrightness( SHADER_CONF.mBrightness ); 51 52 // Fog. 53 light.SetFogColor( SHADER_CONF.mFogColor ); 54 light.SetFogDensity( SHADER_CONF.mFogDensity ); 55 light.SetFogMin( SHADER_CONF.mFogMin ); 56 } 57 58 } // namespace shader 59