Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/egg2pg/config_egg2pg.cxx

Go to the documentation of this file.
00001 // Filename: config_egg2pg.cxx
00002 // Created by:  drose (26Feb02)
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 #include "config_egg2pg.h"
00020 
00021 #include "dconfig.h"
00022 #include "get_config_path.h"
00023 #include "loaderFileTypeEgg.h"
00024 #include "loaderFileTypeRegistry.h"
00025 
00026 ConfigureDef(config_egg2pg);
00027 NotifyCategoryDef(egg2pg, "");
00028 
00029 bool egg_mesh = config_egg2pg.GetBool("egg-mesh", true);
00030 bool egg_retesselate_coplanar = config_egg2pg.GetBool("egg-retesselate-coplanar", true);
00031 bool egg_unroll_fans = config_egg2pg.GetBool("egg-unroll-fans", true);
00032 bool egg_show_tstrips = config_egg2pg.GetBool("egg-show-tstrips", false);
00033 bool egg_show_qsheets = config_egg2pg.GetBool("egg-show-qsheets", false);
00034 bool egg_show_quads = config_egg2pg.GetBool("egg-show-quads", false);
00035 bool egg_false_color = (egg_show_tstrips | egg_show_qsheets | egg_show_quads);
00036 bool egg_show_normals = config_egg2pg.GetBool("egg-show-normals", false);
00037 double egg_normal_scale = config_egg2pg.GetDouble("egg-normal-scale", 1.0);
00038 bool egg_subdivide_polys = config_egg2pg.GetBool("egg-subdivide-polys", true);
00039 bool egg_consider_fans = config_egg2pg.GetBool("egg-consider-fans", true);
00040 double egg_max_tfan_angle = config_egg2pg.GetDouble("egg-max-tfan-angle", 40.0);
00041 int egg_min_tfan_tris = config_egg2pg.GetInt("egg-min-tfan-tris", 4);
00042 double egg_coplanar_threshold = config_egg2pg.GetDouble("egg-coplanar-threshold", 0.01);
00043 bool egg_ignore_mipmaps = config_egg2pg.GetBool("egg-ignore-mipmaps", false);
00044 bool egg_ignore_filters = config_egg2pg.GetBool("egg-ignore-filters", false);
00045 bool egg_ignore_clamp = config_egg2pg.GetBool("egg-ignore-clamp", false);
00046 bool egg_always_decal_textures = config_egg2pg.GetBool("egg-always-decal-textures", false);
00047 bool egg_ignore_decals = config_egg2pg.GetBool("egg-ignore-decals", false);
00048 bool egg_flatten = config_egg2pg.GetBool("egg-flatten", true);
00049 
00050 // It is almost always a bad idea to set this true.
00051 bool egg_flatten_siblings = config_egg2pg.GetBool("egg-flatten-siblings", false);
00052 
00053 bool egg_show_collision_solids = config_egg2pg.GetBool("egg-show-collision-solids", false);
00054 
00055 // When this is true, a <NurbsCurve> entry appearing in an egg file
00056 // will load a ClassicNurbsCurve object instead of the default, a
00057 // NurbsCurve object.  This only makes a difference when the NURBS++
00058 // library is available, in which case the default, NurbsCurve, is
00059 // actually a NurbsPPCurve object.
00060 bool egg_load_classic_nurbs_curves = config_egg2pg.GetBool("egg-load-classic-nurbs-curves", false);
00061 
00062 // When this is true, certain kinds of recoverable errors (not syntax
00063 // errors) in an egg file will be allowed and ignored when an egg file
00064 // is loaded.  When it is false, only perfectly pristine egg files may
00065 // be loaded.
00066 bool egg_accept_errors = config_egg2pg.GetBool("egg-accept-errors", true);
00067 
00068 CoordinateSystem egg_coordinate_system = CS_invalid;
00069 EggRenderMode::AlphaMode egg_alpha_mode = EggRenderMode::AM_unspecified;
00070 
00071 ConfigureFn(config_egg2pg) {
00072   init_libegg2pg();
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: init_libegg2pg
00077 //  Description: Initializes the library.  This must be called at
00078 //               least once before any of the functions or classes in
00079 //               this library can be used.  Normally it will be
00080 //               called by the static initializers and need not be
00081 //               called explicitly, but special cases exist.
00082 ////////////////////////////////////////////////////////////////////
00083 void
00084 init_libegg2pg() {
00085   static bool initialized = false;
00086   if (initialized) {
00087     return;
00088   }
00089   initialized = true;
00090 
00091   // Get egg-coordinate-system
00092   string csstr = config_egg2pg.GetString("egg-coordinate-system", "default");
00093   CoordinateSystem cs = parse_coordinate_system_string(csstr);
00094 
00095   if (cs == CS_invalid) {
00096     egg2pg_cat.error()
00097       << "Unexpected egg-coordinate-system string: " << csstr << "\n";
00098     cs = CS_default;
00099   }
00100   egg_coordinate_system = (cs == CS_default) ?
00101     default_coordinate_system : cs;
00102 
00103   // Get egg-alpha-mode
00104   string amstr = config_egg2pg.GetString("egg-alpha-mode", "blend");
00105   EggRenderMode::AlphaMode am = EggRenderMode::string_alpha_mode(amstr);
00106 
00107   if (am == EggRenderMode::AM_unspecified) {
00108     egg2pg_cat.error()
00109       << "Unexpected egg-alpha-mode string: " << amstr << "\n";
00110     egg_alpha_mode = EggRenderMode::AM_on;
00111   } else {
00112     egg_alpha_mode = am;
00113   }
00114 
00115   LoaderFileTypeEgg::init_type();
00116 
00117   LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr();
00118 
00119   reg->register_type(new LoaderFileTypeEgg);
00120 }

Generated on Fri May 2 00:38:09 2003 for Panda by doxygen1.3