00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "config_dxgsg8.h"
00020 #include "dxGraphicsStateGuardian8.h"
00021 #include "dxSavedFrameBuffer8.h"
00022 #include "dxTextureContext8.h"
00023 #include "graphicsPipeSelection.h"
00024 #include "wdxGraphicsWindow8.h"
00025 #include "wdxGraphicsPipe8.h"
00026
00027 #include <dconfig.h>
00028
00029 Configure(config_dxgsg8);
00030
00031 NotifyCategoryDef(dxgsg8, "dxgsg");
00032 NotifyCategoryDef(wdxdisplay8, "windisplay");
00033
00034
00035
00036
00037 bool dx_show_transforms = config_dxgsg8.GetBool("dx-show-transforms", false);
00038
00039
00040
00041 bool dx_full_screen = config_dxgsg8.GetBool("dx-full-screen", false);
00042
00043
00044
00045
00046 bool dx_sync_video = config_dxgsg8.GetBool("sync-video", true);
00047
00048
00049 DWORD dx_multisample_antialiasing_level = (DWORD) config_dxgsg8.GetInt("dx-multisample-antialiasing-level", 0);
00050
00051
00052
00053
00054 bool dx_cull_traversal = config_dxgsg8.GetBool("dx-cull-traversal", true);
00055
00056
00057 bool dx_no_vertex_fog = config_dxgsg8.GetBool("dx-no-vertex-fog", false);
00058
00059
00060 bool dx_show_cursor_watermark = config_dxgsg8.GetBool("dx-show-cursor-watermark",
00061 #ifdef _DEBUG
00062 true
00063 #else
00064 false
00065 #endif
00066 );
00067
00068
00069 bool dx_use_triangle_mipgen_filter = config_dxgsg8.GetBool("dx-use-triangle-mipgen-filter", false);
00070
00071
00072
00073
00074
00075
00076
00077 bool dx_auto_normalize_lighting = config_dxgsg8.GetBool("auto-normalize-lighting", false);
00078
00079 bool dx_show_fps_meter = config_dxgsg8.GetBool("show-fps-meter", false);
00080 float dx_fps_meter_update_interval = max(0.5,config_dxgsg8.GetFloat("fps-meter-update-interval", 1.7));
00081
00082 #ifndef NDEBUG
00083
00084
00085 int dx_force_backface_culling = config_dxgsg8.GetInt("dx-force-backface-culling", 0);
00086 #endif
00087
00088 bool dx_mipmap_everything = config_dxgsg8.GetBool("dx-mipmap-everything", false);
00089 bool dx_ignore_mipmaps = config_dxgsg8.GetBool("dx-ignore-mipmaps", false);
00090
00091
00092 bool dx_use_rangebased_fog = config_dxgsg8.GetBool("dx-use-rangebased-fog", false);
00093 bool dx_force_16bpptextures = config_dxgsg8.GetBool("dx-force-16bpptextures", false);
00094 bool dx_no_dithering = config_dxgsg8.GetBool("dx-no-dithering", false);
00095 bool dx_force_16bpp_zbuffer = config_dxgsg8.GetBool("dx-force-16bpp-zbuffer", false);
00096 bool dx_do_vidmemsize_check = config_dxgsg8.GetBool("do-vidmemsize-check", true);
00097 bool dx_preserve_fpu_state = config_dxgsg8.GetBool("dx-preserve-fpu-state", false);
00098
00099
00100
00101
00102 bool dx_pick_best_screenres = config_dxgsg8.GetBool("pick-best-screenres", false);
00103
00104 int dx_preferred_device_id = config_dxgsg8.GetInt("dx-preferred-device-id", -1);
00105
00106 #ifdef _DEBUG
00107 float dx_global_miplevel_bias = config_dxgsg8.GetFloat("dx-global-miplevel-bias", 0.0);
00108 bool dx_debug_view_mipmaps = config_dxgsg8.GetBool("dx-debug-view-mipmaps", false);
00109
00110 #endif
00111
00112
00113
00114 bool dx_use_dx_cursor = config_dxgsg8.GetBool("dx-use-dx-cursor", false);
00115
00116 bool dx_force_anisotropic_filtering = config_dxgsg8.GetBool("dx-force-anisotropic-filtering", false);
00117
00118
00119
00120 const bool link_tristrips = config_dxgsg8.GetBool("link-tristrips", false);
00121
00122
00123 DXDecalType dx_decal_type = GDT_mask;
00124
00125
00126
00127
00128 string *pdx_vertexshader_filename=NULL;
00129 string *pdx_pixelshader_filename=NULL;
00130
00131
00132 string *pdx_globaltexture_filename=NULL;
00133
00134 UINT dx_globaltexture_stagenum = (UINT) config_dxgsg8.GetInt("dx-globaltexture-stagenum", 0);
00135
00136 static DXDecalType
00137 parse_decal_type(const string &type) {
00138 if (type == "mask") {
00139 return GDT_mask;
00140 } else if (type == "blend") {
00141 return GDT_blend;
00142 } else if (type == "offset") {
00143 return GDT_offset;
00144 }
00145 dxgsg8_cat.error() << "Invalid dx-decal-type: " << type << "\n";
00146 return GDT_mask;
00147 }
00148
00149 ConfigureFn(config_dxgsg8) {
00150 init_libdxgsg8();
00151 }
00152
00153 void init_config_string(string *&pFname,const char *ConfigrcVarname) {
00154
00155
00156
00157 pFname = new string(config_dxgsg8.GetString(ConfigrcVarname, ""));
00158 if(pFname->empty()) {
00159 delete pFname;
00160 pFname=NULL;
00161 }
00162 }
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 void
00173 init_libdxgsg8() {
00174 static bool initialized = false;
00175 if (initialized) {
00176 return;
00177 }
00178 initialized = true;
00179
00180 string decal_type = config_dxgsg8.GetString("dx-decal-type", "");
00181 if (!decal_type.empty()) {
00182 dx_decal_type = parse_decal_type(decal_type);
00183 }
00184
00185 init_config_string(pdx_vertexshader_filename,"dx-vertexshader-filename");
00186 init_config_string(pdx_pixelshader_filename,"dx-pixelshader-filename");
00187 init_config_string(pdx_globaltexture_filename,"dx-globaltexture-filename");
00188
00189 DXGraphicsStateGuardian8::init_type();
00190 DXSavedFrameBuffer8::init_type();
00191 DXTextureContext8::init_type();
00192 DXGeomNodeContext8::init_type();
00193
00194 wdxGraphicsPipe8::init_type();
00195 wdxGraphicsWindow8::init_type();
00196
00197 GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
00198 selection->add_pipe_type(wdxGraphicsPipe8::get_class_type(),
00199 wdxGraphicsPipe8::pipe_constructor);
00200
00201 }