Panda3D
|
00001 // Filename: config_collada.cxx 00002 // Created by: Xidram (21Dec10) 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_collada.h" 00016 00017 #include "dconfig.h" 00018 #include "loaderFileTypeDae.h" 00019 #include "loaderFileTypeRegistry.h" 00020 00021 ConfigureDef(config_collada); 00022 NotifyCategoryDef(collada, ""); 00023 00024 ConfigVariableBool collada_flatten 00025 ("collada-flatten", false, 00026 PRC_DESC("This is normally true to flatten out useless nodes after loading " 00027 "a collada file. Set it false if you want to see the complete " 00028 "and true hierarchy as specified in the file (although the " 00029 "extra nodes may have a small impact on render performance).")); 00030 00031 ConfigVariableDouble collada_flatten_radius 00032 ("collada-flatten-radius", 0.0, 00033 PRC_DESC("This specifies the minimum cull radius in the egg file. Nodes " 00034 "whose bounding volume is smaller than this radius will be " 00035 "flattened tighter than nodes larger than this radius, to " 00036 "reduce the node count even further. The idea is that small " 00037 "objects will not need to have their individual components " 00038 "culled separately, but large environments should. This allows " 00039 "the user to specify what should be considered \"small\". Set " 00040 "it to 0.0 to disable this feature.")); 00041 00042 ConfigVariableBool collada_unify 00043 ("collada-unify", true, 00044 PRC_DESC("When this is true, then in addition to flattening the scene graph " 00045 "nodes, the collada loader will also combine as many Geoms as " 00046 "possible within " 00047 "a given node into a single Geom. This has theoretical performance " 00048 "benefits, especially on higher-end graphics cards, but it also " 00049 "slightly slows down collada loading.")); 00050 00051 ConfigVariableBool collada_combine_geoms 00052 ("collada-combine-geoms", false, 00053 PRC_DESC("Set this true to combine sibling GeomNodes into a single GeomNode, " 00054 "when possible.")); 00055 00056 ConfigVariableBool collada_accept_errors 00057 ("collada-accept-errors", true, 00058 PRC_DESC("When this is true, certain kinds of recoverable errors (not syntax " 00059 "errors) in a collada file will be allowed and ignored when a " 00060 "collada file is loaded. When it is false, only perfectly pristine " 00061 "collada files may be loaded.")); 00062 00063 ConfigureFn(config_collada) { 00064 init_libcollada(); 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: init_libcollada 00069 // Description: Initializes the library. This must be called at 00070 // least once before any of the functions or classes in 00071 // this library can be used. Normally it will be 00072 // called by the static initializers and need not be 00073 // called explicitly, but special cases exist. 00074 //////////////////////////////////////////////////////////////////// 00075 void 00076 init_libcollada() { 00077 static bool initialized = false; 00078 if (initialized) { 00079 return; 00080 } 00081 initialized = true; 00082 00083 LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); 00084 00085 reg->register_type(new LoaderFileTypeDae); 00086 } 00087