Panda3D

config_grutil.cxx

00001 // Filename: config_grutil.cxx
00002 // Created by:  drose (24May00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_grutil.h"
00016 #include "frameRateMeter.h"
00017 #include "sceneGraphAnalyzerMeter.h"
00018 #include "meshDrawer.h"
00019 #include "meshDrawer2D.h"
00020 #include "geoMipTerrain.h"
00021 #include "ffmpegTexture.h"
00022 #include "movieTexture.h"
00023 #include "pandaSystem.h"
00024 #include "texturePool.h"
00025 #include "nodeVertexTransform.h"
00026 #include "rigidBodyCombiner.h"
00027 #include "pipeOcclusionCullTraverser.h"
00028 
00029 #include "dconfig.h"
00030 
00031 Configure(config_grutil);
00032 NotifyCategoryDef(grutil, "");
00033 
00034 ConfigureFn(config_grutil) {
00035   init_libgrutil();
00036 }
00037 
00038 ConfigVariableDouble frame_rate_meter_update_interval
00039 ("frame-rate-meter-update-interval", 1.5);
00040 
00041 ConfigVariableString frame_rate_meter_text_pattern
00042 ("frame-rate-meter-text-pattern", "%0.1f fps");
00043 
00044 ConfigVariableInt frame_rate_meter_layer_sort
00045 ("frame-rate-meter-layer-sort", 1000);
00046 
00047 ConfigVariableDouble frame_rate_meter_scale
00048 ("frame-rate-meter-scale", 0.05);
00049 
00050 ConfigVariableDouble frame_rate_meter_side_margins
00051 ("frame-rate-meter-side-margins", 0.5);
00052 
00053 ConfigVariableDouble scene_graph_analyzer_meter_update_interval
00054 ("scene-graph-analyzer-meter-update-interval", 2.0);
00055 
00056 ConfigVariableInt scene_graph_analyzer_meter_layer_sort
00057 ("scene-graph-analyzer-meter-layer-sort", 1000);
00058 
00059 ConfigVariableDouble scene_graph_analyzer_meter_scale
00060 ("scene-graph-analyzer-meter-scale", 0.05);
00061 
00062 ConfigVariableDouble scene_graph_analyzer_meter_side_margins
00063 ("scene-graph-analyzer-meter-side-margins", 0.5);
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: init_libgrutil
00067 //  Description: Initializes the library.  This must be called at
00068 //               least once before any of the functions or classes in
00069 //               this library can be used.  Normally it will be
00070 //               called by the static initializers and need not be
00071 //               called explicitly, but special cases exist.
00072 ////////////////////////////////////////////////////////////////////
00073 void
00074 init_libgrutil() {
00075   ConfigVariableBool use_movietexture
00076     ("use-movietexture", false,
00077      PRC_DESC("Panda contains a new animated texture class, MovieTexture. "
00078               "Because it is not yet fully tested, the texture loader "
00079               "will not use it unless this variable is set.  Eventually, "
00080               "this config variable will go away and the new code will "
00081               "be enabled all the time."));
00082 
00083   static bool initialized = false;
00084   if (initialized) {
00085     return;
00086   }
00087   initialized = true;
00088 
00089   FrameRateMeter::init_type();
00090   MeshDrawer::init_type();
00091   MeshDrawer2D::init_type();
00092   GeoMipTerrain::init_type();
00093   NodeVertexTransform::init_type();
00094   RigidBodyCombiner::init_type();
00095   PipeOcclusionCullTraverser::init_type();
00096   SceneGraphAnalyzerMeter::init_type();
00097 
00098 #ifdef HAVE_AUDIO
00099   MovieTexture::init_type();
00100   MovieTexture::register_with_read_factory();
00101 #endif  // HAVE_AUDIO
00102 
00103 #ifdef HAVE_FFMPEG
00104   av_register_all();
00105   FFMpegTexture::init_type();
00106   FFMpegTexture::register_with_read_factory();
00107 #endif
00108 
00109 #if defined(HAVE_FFMPEG)
00110   TexturePool *ts = TexturePool::get_global_ptr();
00111   if (use_movietexture) {
00112     ts->register_texture_type(MovieTexture::make_texture, "avi mov mpg mpeg mp4 wmv asf flv nut ogm mkv");
00113   } else {
00114     ts->register_texture_type(FFMpegTexture::make_texture, "avi mov mpg mpeg mp4 wmv asf flv nut ogm mkv");
00115   }
00116 #endif
00117 }
00118 
 All Classes Functions Variables Enumerations