00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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
00056
00057
00058
00059
00060 bool egg_load_classic_nurbs_curves = config_egg2pg.GetBool("egg-load-classic-nurbs-curves", false);
00061
00062
00063
00064
00065
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
00077
00078
00079
00080
00081
00082
00083 void
00084 init_libegg2pg() {
00085 static bool initialized = false;
00086 if (initialized) {
00087 return;
00088 }
00089 initialized = true;
00090
00091
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
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 }