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

panda/src/dxgsg8/config_dxgsg8.cxx

Go to the documentation of this file.
00001 // Filename: config_dxgsg8.cxx
00002 // Created by:  drose (06Oct99)
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_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 //NotifyCategoryDef(dxgsg8, ":display:gsg");  dont want to merge this with the regular parent class dbg output
00031 NotifyCategoryDef(dxgsg8, "dxgsg");
00032 NotifyCategoryDef(wdxdisplay8, "windisplay");
00033 
00034 // Configure this variable true to cause the DXGSG to show each
00035 // transform space it renders by drawing a little unit axis.  This
00036 // cannot be enabled when the player is compiled in NDEBUG mode.
00037 bool dx_show_transforms = config_dxgsg8.GetBool("dx-show-transforms", false);
00038 
00039 //  Configure this to TRUE if you want DirectX to control the entire screen,
00040 //  If false, it will just blit into a window.
00041 bool dx_full_screen = config_dxgsg8.GetBool("dx-full-screen", false);
00042 
00043 //  Configure this true to force the rendering to sync to the video
00044 //  refresh, or false to let your frame rate go as high as it can,
00045 //  irrespective of the video refresh.
00046 bool dx_sync_video = config_dxgsg8.GetBool("sync-video", true);
00047 
00048 // Set Level of MultiSampling to be used, if HW supports it.  Valid values are 2-16.
00049 DWORD dx_multisample_antialiasing_level = (DWORD) config_dxgsg8.GetInt("dx-multisample-antialiasing-level", 0);
00050 
00051 // Configure this true to perform a cull traversal over the geometry
00052 // by default, false otherwise.  The cull traversal provides support
00053 // for state-sorting, z-sorting, and binning.
00054 bool dx_cull_traversal = config_dxgsg8.GetBool("dx-cull-traversal", true);
00055 
00056 // if true, if card only supports per-vertex fog, it will be treated as no-HW fog capability
00057 bool dx_no_vertex_fog = config_dxgsg8.GetBool("dx-no-vertex-fog", false);
00058 
00059 // if true, overwrite cursor bitmap tip with "D3D" to distinguish it from GDI cursor 
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 // if true, triangle filter will be used to generate mipmap levels instead of default box filter
00069 bool dx_use_triangle_mipgen_filter = config_dxgsg8.GetBool("dx-use-triangle-mipgen-filter", false);
00070 
00071 // Configure this true to cause all lighting normals to automatically
00072 // be normalized by the CPU before rendering.  This is
00073 // necessary if you intend to render things under scale transforms and
00074 // expect lighting to work correctly.  Maybe one day there will be
00075 // another way to set this at runtime, instead of only as a configure
00076 // variable
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 // debugging flag
00084 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
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 // if this is set, more accurate but more expensive fog computations are performed
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 // if true, override win-width/height and use driver vidmem info to
00100 // pick what will be a fullscreen window size close to the best perf
00101 // capability of card, based on a heuristic
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 //int dx_print_texstats = config_dxgsg8.GetBool("dx-print-texstats", 0);
00110 #endif
00111 
00112 // use dx8 or GDI mouse cursor in fullscreen mode?
00113 // Nvidia dx8 cursor is invisible as of 28.32 drivers, so using GDI in fullscrn by default for now
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 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 
00119 // together using degenerate tris
00120 const bool link_tristrips = config_dxgsg8.GetBool("link-tristrips", false);
00121 
00122 // note:  offset currently disabled since it wasnt working properly
00123 DXDecalType dx_decal_type = GDT_mask;
00124 
00125 // Note: must be a ptr not a regular string because the init-string constructor for
00126 // a global/static string variable will run AFTER the dll static init fn
00127 // init_libdxgsg8(), which means the string will be reset to "" after we read it in
00128 string *pdx_vertexshader_filename=NULL;
00129 string *pdx_pixelshader_filename=NULL;
00130 
00131 // texture file to be set globally, usually for special FX
00132 string *pdx_globaltexture_filename=NULL;
00133 // tex stagenum to set the global tex to
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   // pFname is reference to string ptr
00155 
00156   // dont try to take the & of a soon-to-be-gone stack var string, this must be on the heap!
00157   pFname = new string(config_dxgsg8.GetString(ConfigrcVarname, ""));
00158   if(pFname->empty()) {
00159       delete pFname;
00160       pFname=NULL;
00161   }
00162 }
00163 
00164 ////////////////////////////////////////////////////////////////////
00165 //     Function: init_libdxgsg
00166 //  Description: Initializes the library.  This must be called at
00167 //               least once before any of the functions or classes in
00168 //               this library can be used.  Normally it will be
00169 //               called by the static initializers and need not be
00170 //               called explicitly, but special cases exist.
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 }

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