00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <config_util.h>
00020 #include "boundedObject.h"
00021 #include "config_gobj.h"
00022 #include "drawable.h"
00023 #include "geom.h"
00024 #include "geomprimitives.h"
00025 #include "imageBuffer.h"
00026 #include "material.h"
00027 #include "orthographicLens.h"
00028 #include "matrixLens.h"
00029 #include "perspectiveLens.h"
00030 #include "pixelBuffer.h"
00031 #include "lens.h"
00032 #include "texture.h"
00033
00034 #include "dconfig.h"
00035 #include "string_utils.h"
00036
00037 Configure(config_gobj);
00038 NotifyCategoryDef(gobj, "");
00039
00040
00041
00042
00043
00044
00045
00046 const int max_texture_dimension = config_gobj.GetInt("max-texture-dimension", -1);
00047
00048
00049
00050
00051
00052
00053
00054
00055 bool textures_up_power_2 = false;
00056 bool textures_down_power_2 = false;
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 bool textures_up_square = false;
00067 bool textures_down_square = false;
00068
00069
00070
00071
00072
00073
00074
00075
00076 bool keep_texture_ram = config_gobj.GetBool("keep-texture-ram", false);
00077
00078
00079
00080
00081 bool keep_geom_ram = config_gobj.GetBool("keep-geom-ram", true);
00082
00083
00084
00085
00086
00087
00088 bool retained_mode = config_gobj.GetBool("retained-mode", false);
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 BamTextureMode bam_texture_mode;
00101
00102
00103
00104
00105
00106 const string fake_texture_image = config_gobj.GetString("fake-texture-image", "");
00107
00108
00109 const bool debug_LOD_mode = config_gobj.GetBool("debug-LOD-mode", false);
00110
00111
00112 const int select_LOD_number = config_gobj.GetInt("select-LOD-number", -1);
00113
00114
00115
00116
00117
00118 const int minimum_LOD_number = config_gobj.GetInt("minimum-LOD-number", 0);
00119
00120 const float lod_stress_factor = config_gobj.GetFloat("lod-stress-factor", 1.0f);
00121
00122
00123 const float default_near = config_gobj.GetFloat("default-near", 1.0f);
00124 const float default_far = config_gobj.GetFloat("default-far", 1000.0f);
00125
00126 static BamTextureMode
00127 parse_texture_mode(const string &mode) {
00128 if (cmp_nocase(mode, "unchanged") == 0) {
00129 return BTM_unchanged;
00130 } else if (cmp_nocase(mode, "fullpath") == 0) {
00131 return BTM_fullpath;
00132 } else if (cmp_nocase(mode, "relative") == 0) {
00133 return BTM_relative;
00134 } else if (cmp_nocase(mode, "basename") == 0) {
00135 return BTM_basename;
00136 }
00137
00138 gobj_cat->error() << "Invalid bam-texture-mode: " << mode << "\n";
00139 return BTM_relative;
00140 }
00141
00142 ConfigureFn(config_gobj) {
00143 string texture_mode = config_util.GetString("bam-texture-mode", "relative");
00144 bam_texture_mode = parse_texture_mode(texture_mode);
00145
00146 string textures_power_2 = config_gobj.GetString("textures-power-2", "");
00147 if (cmp_nocase(textures_power_2, "up") == 0) {
00148 textures_up_power_2 = true;
00149 textures_down_power_2 = false;
00150
00151 } else if (cmp_nocase(textures_power_2, "down") == 0) {
00152 textures_up_power_2 = false;
00153 textures_down_power_2 = true;
00154
00155 } else {
00156 textures_up_power_2 = false;
00157 textures_down_power_2 = config_gobj.GetBool("textures-power-2", false);
00158 }
00159
00160 string textures_square = config_gobj.GetString("textures-square", "");
00161 if (cmp_nocase(textures_square, "up") == 0) {
00162 textures_up_square = true;
00163 textures_down_square = false;
00164
00165 } else if (cmp_nocase(textures_square, "down") == 0) {
00166 textures_up_square = false;
00167 textures_down_square = true;
00168
00169 } else {
00170 textures_up_square = false;
00171 textures_down_square = config_gobj.GetBool("textures-square", false);
00172 }
00173
00174 BoundedObject::init_type();
00175 Geom::init_type();
00176 GeomLine::init_type();
00177 GeomLinestrip::init_type();
00178 GeomPoint::init_type();
00179 GeomSprite::init_type();
00180 GeomPolygon::init_type();
00181 GeomQuad::init_type();
00182 GeomSphere::init_type();
00183 GeomTri::init_type();
00184 GeomTrifan::init_type();
00185 GeomTristrip::init_type();
00186 ImageBuffer::init_type();
00187 Material::init_type();
00188 OrthographicLens::init_type();
00189 MatrixLens::init_type();
00190 PerspectiveLens::init_type();
00191 PixelBuffer::init_type();
00192 Lens::init_type();
00193 Texture::init_type();
00194 dDrawable::init_type();
00195
00196
00197
00198 GeomPoint::register_with_read_factory();
00199 GeomLine::register_with_read_factory();
00200 GeomLinestrip::register_with_read_factory();
00201 GeomSprite::register_with_read_factory();
00202 GeomPolygon::register_with_read_factory();
00203 GeomQuad::register_with_read_factory();
00204 GeomTri::register_with_read_factory();
00205 GeomTristrip::register_with_read_factory();
00206 GeomTrifan::register_with_read_factory();
00207 GeomSphere::register_with_read_factory();
00208 Material::register_with_read_factory();
00209 Texture::register_with_read_factory();
00210 }