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

panda/src/dxgsg7/config_dxgsg7.cxx

Go to the documentation of this file.
00001 // Filename: config_dxgsg.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_dxgsg7.h"
00020 #include "dxGraphicsStateGuardian7.h"
00021 #include "dxSavedFrameBuffer7.h"
00022 #include "dxTextureContext7.h"
00023 #include "wdxGraphicsPipe7.h"
00024 #include "wdxGraphicsWindow7.h"
00025 #include "graphicsPipeSelection.h"
00026 
00027 #include "dconfig.h"
00028 
00029 Configure(config_dxgsg7);
00030 NotifyCategoryDef(dxgsg7, ":display:gsg");
00031 NotifyCategoryDef(wdxdisplay7, "windisplay");
00032 
00033 // Configure this variable true to cause the DXGSG to show each
00034 // transform space it renders by drawing a little unit axis.  This
00035 // cannot be enabled when the player is compiled in NDEBUG mode.
00036 bool dx_show_transforms = config_dxgsg7.GetBool("dx-show-transforms", false);
00037 
00038 //  Configure this to TRUE if you want DirectX to control the entire screen,
00039 //  If false, it will just blit into a window.
00040 bool dx_full_screen = config_dxgsg7.GetBool("dx-full-screen", false);
00041 
00042 //  Configure this true to force the rendering to sync to the video
00043 //  refresh, or false to let your frame rate go as high as it can,
00044 //  irrespective of the video refresh.
00045 bool dx_sync_video = config_dxgsg7.GetBool("sync-video", true);
00046 
00047 // enable this to turn on full-screen anti-aliasing, if the HW supports it
00048 // this var is also used in wdxGraphicsWindows.cxx
00049 bool dx_full_screen_antialiasing = config_dxgsg7.GetBool("dx-antialias", false);
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_dxgsg7.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_dxgsg7.GetBool("dx-no-vertex-fog", false);
00058 
00059 // Configure this true to cause all lighting normals to automatically
00060 // be normalized by the CPU before rendering.  This is
00061 // necessary if you intend to render things under scale transforms and
00062 // expect lighting to work correctly.  Maybe one day there will be
00063 // another way to set this at runtime, instead of only as a configure
00064 // variable
00065 bool dx_auto_normalize_lighting = config_dxgsg7.GetBool("auto-normalize-lighting", false);
00066 
00067 bool dx_allow_software_renderer = config_dxgsg7.GetBool("dx-allow-software-renderer", false);
00068 bool dx_force_software_renderer = config_dxgsg7.GetBool("dx-force-software-renderer", false);
00069 
00070 #ifndef NDEBUG
00071 // debugging flag
00072 // values are same as D3DCULL enumtype, 0 - no force, 1 - force none, 2 - force CW, 3 - force CCW
00073 int dx_force_backface_culling = config_dxgsg7.GetInt("dx-force-backface-culling", 0);
00074 #endif
00075 
00076 bool dx_mipmap_everything = config_dxgsg7.GetBool("dx-mipmap-everything", false);
00077 bool dx_ignore_mipmaps = config_dxgsg7.GetBool("dx-ignore-mipmaps", false);
00078 
00079 // if this is set, more accurate but more expensive fog computations are performed
00080 bool dx_use_rangebased_fog = config_dxgsg7.GetBool("dx-use-rangebased-fog", false);
00081 bool dx_force_16bpptextures = config_dxgsg7.GetBool("dx-force-16bpptextures", false);
00082 bool dx_no_dithering = config_dxgsg7.GetBool("dx-no-dithering", false);
00083 bool dx_force_16bpp_zbuffer = config_dxgsg7.GetBool("dx-force-16bpp-zbuffer", false);
00084 bool dx_do_vidmemsize_check = config_dxgsg7.GetBool("do-vidmemsize-check", true);
00085 bool dx_preserve_fpu_state = config_dxgsg7.GetBool("dx-preserve-fpu-state", false);
00086 
00087 // Configure this true to try to implement decals using a
00088 // DepthOffsetAttrib, false to do them with the more reliable 3-pass
00089 // rendering method instead.
00090 bool dx_depth_offset_decals = config_dxgsg7.GetBool("depth-offset-decals", false);
00091 
00092 #ifdef _DEBUG
00093 float dx_global_miplevel_bias = config_dxgsg7.GetFloat("dx-global-miplevel-bias", 0.0);
00094 bool dx_debug_view_mipmaps = config_dxgsg7.GetBool("dx-debug-view-mipmaps", false);
00095 bool dx_force_anisotropic_filtering = config_dxgsg7.GetBool("dx-force-anisotropic-filtering", false);
00096 //int dx_print_texstats = config_dxgsg7.GetBool("dx-print-texstats", 0);
00097 #endif
00098 
00099 // set 'retained-mode #t' and this to have prepare_geom concatenate all tristrips within a geom 
00100 // together using degenerate tris
00101 const bool link_tristrips = config_dxgsg7.GetBool("link-tristrips", false);
00102 
00103 // note:  offset currently disabled since it wasnt working properly
00104 DXDecalType dx_decal_type = GDT_blend;
00105 
00106 static DXDecalType
00107 parse_decal_type(const string &type) {
00108   if (type == "mask") {
00109     return GDT_mask;
00110   } else if (type == "blend") {
00111     return GDT_blend;
00112   } else if (type == "offset") {
00113     return GDT_offset;
00114   }
00115   dxgsg7_cat.error() << "Invalid dx-decal-type: " << type << "\n";
00116   return GDT_blend;
00117 }
00118 
00119 ConfigureFn(config_dxgsg7) {
00120   init_libdxgsg7();
00121 }
00122 
00123 ////////////////////////////////////////////////////////////////////
00124 //     Function: init_libdxgsg7
00125 //  Description: Initializes the library.  This must be called at
00126 //               least once before any of the functions or classes in
00127 //               this library can be used.  Normally it will be
00128 //               called by the static initializers and need not be
00129 //               called explicitly, but special cases exist.
00130 ////////////////////////////////////////////////////////////////////
00131 void
00132 init_libdxgsg7() {
00133   static bool initialized = false;
00134   if (initialized) {
00135     return;
00136   }
00137   initialized = true;
00138 
00139   string decal_type = config_dxgsg7.GetString("dx-decal-type", "");
00140   if (!decal_type.empty()) {
00141     dx_decal_type = parse_decal_type(decal_type);
00142   }
00143 
00144   DXGraphicsStateGuardian7::init_type();
00145   DXSavedFrameBuffer7::init_type();
00146   DXTextureContext7::init_type();
00147   DXGeomNodeContext7::init_type();
00148 
00149   wdxGraphicsPipe7::init_type();
00150   wdxGraphicsWindow7::init_type();
00151 
00152   GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
00153   selection->add_pipe_type(wdxGraphicsPipe7::get_class_type(),
00154                            wdxGraphicsPipe7::pipe_constructor);
00155 }

Generated on Fri May 2 00:36:54 2003 for Panda by doxygen1.3