00001 // Filename: config_char.cxx 00002 // Created by: drose (28Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 #include "config_char.h" 00021 #include "character.h" 00022 #include "characterJoint.h" 00023 #include "characterJointBundle.h" 00024 #include "characterSlider.h" 00025 #include "computedVertices.h" 00026 #include "dynamicVertices.h" 00027 #include <dconfig.h> 00028 #include <lmatrix4.h> 00029 00030 Configure(config_char); 00031 NotifyCategoryDef(char, ""); 00032 00033 ConfigureFn(config_char) { 00034 init_libchar(); 00035 } 00036 00037 // The animation system, by default, only recomputes the characters' 00038 // vertices on frames for which there is some change in the animation 00039 // cycle. Since this doesn't happen every frame, and since the 00040 // recomputing of vertices can take significant time, this might 00041 // result in irregular patterns of slow frames and fast frames, 00042 // resulting in an unsteady frame rate. Sometimes it is preferable to 00043 // achieve a more even frame rate, even if the average frame rate is 00044 // slower overall. 00045 00046 // Set even-animation to true to achieve this. When this is true, 00047 // characters' vertices will be recomputed every frame, whether they 00048 // need it or not. This will tend to balance out the frame rate so 00049 // that it is more uniformly slow. 00050 const bool even_animation = config_char.GetBool("even-animation", false); 00051 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: init_libchar 00055 // Description: Initializes the library. This must be called at 00056 // least once before any of the functions or classes in 00057 // this library can be used. Normally it will be 00058 // called by the static initializers and need not be 00059 // called explicitly, but special cases exist. 00060 //////////////////////////////////////////////////////////////////// 00061 void 00062 init_libchar() { 00063 static bool initialized = false; 00064 if (initialized) { 00065 return; 00066 } 00067 initialized = true; 00068 00069 Character::init_type(); 00070 CharacterJoint::init_type(); 00071 CharacterJointBundle::init_type(); 00072 CharacterSlider::init_type(); 00073 ComputedVertices::init_type(); 00074 DynamicVertices::init_type(); 00075 00076 // This isn't defined in this package, but it *is* essential that it 00077 // be initialized. We have to do it explicitly here since template 00078 // statics don't necessarily resolve very well across dynamic 00079 // libraries. 00080 LMatrix4f::init_type(); 00081 00082 //Registration of writeable object's creation 00083 //functions with BamReader's factory 00084 Character::register_with_read_factory(); 00085 CharacterJoint::register_with_read_factory(); 00086 CharacterJointBundle::register_with_read_factory(); 00087 CharacterSlider::register_with_read_factory(); 00088 ComputedVertices::register_with_read_factory(); 00089 } 00090