Panda3D

config_gobj.cxx

00001 // Filename: config_gobj.cxx
00002 // Created by:  drose (01Oct99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "animateVerticesRequest.h"
00016 #include "bufferContext.h"
00017 #include "config_util.h"
00018 #include "config_gobj.h"
00019 #include "geom.h"
00020 #include "geomMunger.h"
00021 #include "geomPrimitive.h"
00022 #include "geomTriangles.h"
00023 #include "geomTristrips.h"
00024 #include "geomTrifans.h"
00025 #include "geomLines.h"
00026 #include "geomLinestrips.h"
00027 #include "geomPoints.h"
00028 #include "geomVertexArrayData.h"
00029 #include "geomVertexArrayFormat.h"
00030 #include "geomVertexData.h"
00031 #include "geomVertexFormat.h"
00032 #include "material.h"
00033 #include "occlusionQueryContext.h"
00034 #include "orthographicLens.h"
00035 #include "matrixLens.h"
00036 #include "perspectiveLens.h"
00037 #include "lens.h"
00038 #include "queryContext.h"
00039 #include "sliderTable.h"
00040 #include "texture.h"
00041 #include "texturePoolFilter.h"
00042 #include "textureReloadRequest.h"
00043 #include "textureStage.h"
00044 #include "textureContext.h"
00045 #include "shader.h"
00046 #include "shaderContext.h"
00047 #include "transformBlend.h"
00048 #include "transformBlendTable.h"
00049 #include "transformTable.h"
00050 #include "userVertexSlider.h"
00051 #include "userVertexTransform.h"
00052 #include "vertexDataBuffer.h"
00053 #include "vertexTransform.h"
00054 #include "vertexSlider.h"
00055 #include "videoTexture.h"
00056 #include "geomContext.h"
00057 #include "vertexBufferContext.h"
00058 #include "indexBufferContext.h"
00059 #include "internalName.h"
00060 
00061 #include "dconfig.h"
00062 #include "string_utils.h"
00063 
00064 Configure(config_gobj);
00065 NotifyCategoryDef(gobj, "");
00066 
00067 ConfigVariableInt max_texture_dimension
00068 ("max-texture-dimension", -1,
00069  PRC_DESC("Set this to the maximum size a texture is allowed to be in either "
00070           "dimension.  This is generally intended as a simple way to restrict "
00071           "texture sizes for limited graphics cards.  When this is greater "
00072           "than zero, each texture image loaded from a file (but only those "
00073           "loaded from a file) will be automatically scaled down, if "
00074           "necessary, so that neither dimension is larger than this value.  "
00075           "If this is less than zero, the size limit is taken from the "
00076           "primary GSG.  If this is exactly zero, there is no limit."));
00077 
00078 ConfigVariableDouble texture_scale
00079 ("texture-scale", 1.0,
00080  PRC_DESC("This is a global scale factor that is applied to each texture "
00081           "as it is loaded from disk.  For instance, a value of 0.5 will "
00082           "reduce each texture to one-half its size in each dimension.  This "
00083           "scale factor is applied before textures-power-2 or "
00084           "max-texture-dimension."));
00085 
00086 ConfigVariableInt texture_scale_limit
00087 ("texture-scale-limit", 4,
00088  PRC_DESC("This specifies the limit below which texture-scale will not "
00089           "reduce a texture image.  This is a single dimension which applies "
00090           "to both X and Y."));
00091 
00092 ConfigVariableList exclude_texture_scale
00093 ("exclude-texture-scale", 
00094  PRC_DESC("This is a list of glob patterns for texture filenames "
00095           "(excluding the directory part of the filename, but including "
00096           "the extension); for instance, 'digits_*.png'.  Any texture "
00097           "filenames that match one of these patterns will not be affected "
00098           "by max-texture-dimension or texture-scale."));
00099 
00100 ConfigVariableBool keep_texture_ram
00101 ("keep-texture-ram", false,
00102  PRC_DESC("Set this to true to retain the ram image for each texture after it "
00103           "has been prepared with the GSG.  This will allow the texture to be "
00104           "prepared with multiple GSG's, or to be re-prepared later after it is "
00105           "explicitly released from the GSG, without having to reread the "
00106           "texture image from disk; but it will consume memory somewhat "
00107           "wastefully."));
00108 
00109 ConfigVariableBool compressed_textures
00110 ("compressed-textures", false,
00111  PRC_DESC("Set this to true to compress textures as they are loaded into "
00112           "texture memory, if the driver supports this.  Specifically, this "
00113           "changes the meaning of set_compression(Texture::CM_default) to "
00114           "Texture::CM_on."));
00115 
00116 ConfigVariableBool driver_compress_textures
00117 ("driver-compress-textures", false,
00118  PRC_DESC("Set this true to ask the graphics driver to compress textures, "
00119           "rather than compressing them in-memory first.  Depending on "
00120           "your graphics driver, you may or may not get better performance "
00121           "or results by setting this true.  Setting it true may also "
00122           "allow you to take advantage of some exotic compression algorithm "
00123           "other than DXT1/3/5 that your graphics driver supports, but "
00124           "which is unknown to Panda.  If the libsquish library is not "
00125           "compiled into Panda, textures cannot be compressed in-memory, "
00126           "and will always be handed to the graphics driver, regardless "
00127           "of this setting."));
00128 
00129 ConfigVariableBool driver_generate_mipmaps
00130 ("driver-generate-mipmaps", false,
00131  PRC_DESC("Set this true to use the hardware to generate mipmaps "
00132           "automatically in all cases, if supported.  Set it false "
00133           "to generate mipmaps in software when possible.  This is "
00134           "false by default because some drivers (Intel) seem to do a "
00135           "poor job of generating mipmaps when needed; also, generating "
00136           "mipmaps in software may allow smoother texture loads."));
00137 
00138 ConfigVariableBool vertex_buffers
00139 ("vertex-buffers", true,
00140  PRC_DESC("Set this true to allow the use of vertex buffers (or buffer "
00141           "objects, as OpenGL dubs them) for rendering vertex data.  This "
00142           "can greatly improve rendering performance on "
00143           "higher-end graphics cards, at the cost of some additional "
00144           "graphics memory (which might otherwise be used for textures "
00145           "or offscreen buffers).  On lower-end graphics cards this will "
00146           "make little or no difference."));
00147 
00148 ConfigVariableBool vertex_arrays
00149 ("vertex-arrays", true,
00150  PRC_DESC("Set this true to allow the use of vertex arrays for rendering "
00151           "OpenGL vertex data.  This, or vertex buffers, is the normal "
00152           "way of issuing vertices ever since OpenGL 1.1, and you "
00153           "almost always want to have this set to true.  However, some very "
00154           "buggy graphics drivers may have problems handling vertex arrays "
00155           "correctly, so if you are experiencing problems you might try "
00156           "setting this to false.  If this is false, Panda will fall back "
00157           "to using immediate-mode commands like glVertex3f(), etc., to "
00158           "issue the vertices, which is potentially much slower than "
00159           "vertex arrays.  Setting this false also disables vertex buffers, "
00160           "effectively ignoring the setting of the vertex-buffers variable "
00161           "(since vertex buffers are a special case of vertex arrays in "
00162           "OpenGL).  This variable is normally not enabled in a production "
00163           "build.  This has no effect on DirectX rendering."));
00164 
00165 ConfigVariableBool display_lists
00166 ("display-lists", false,
00167  PRC_DESC("Set this true to allow the use of OpenGL display lists for "
00168           "rendering static geometry.  On some systems, this can result "
00169           "in a performance improvement over vertex buffers alone; on "
00170           "other systems (particularly low-end systems) it makes little to "
00171           "no difference.  On some systems, using display lists can actually "
00172           "reduce performance.  This has no effect on DirectX rendering or "
00173           "on dynamic geometry (e.g. soft-skinned animation)."));
00174 
00175 ConfigVariableBool hardware_animated_vertices
00176 ("hardware-animated-vertices", false,
00177  PRC_DESC("Set this true to allow the transforming of soft-skinned "
00178           "animated vertices via hardware, if supported, or false always "
00179           "to perform the vertex animation via software within Panda.  "
00180           "If you have a card that supports this, and your scene does "
00181           "not contain too many vertices already, this can provide a "
00182           "performance boost by offloading some work from your CPU onto "
00183           "your graphics card.  It may also help by reducing the bandwidth "
00184           "necessary on your computer's bus.  However, in some cases it "
00185           "may actually reduce performance."));
00186 
00187 ConfigVariableBool hardware_point_sprites
00188 ("hardware-point-sprites", true,
00189  PRC_DESC("Set this true to allow the use of hardware extensions when "
00190           "rendering perspective-scaled points and point sprites.  When "
00191           "false, these large points are always simulated via quads "
00192           "computed in software, even if the hardware claims it can "
00193           "support them directly."));
00194 
00195 ConfigVariableBool hardware_points
00196 ("hardware-points", true,
00197  PRC_DESC("Set this true to allow the use of hardware extensions when "
00198           "rendering large points.  When false, large points (even if "
00199           "untextured) will be simulated via quads computed in software."));
00200 
00201 ConfigVariableBool singular_points
00202 ("singular-points", true,
00203  PRC_DESC("Set this true to insist that when RenderModeAttrib::M_points is "
00204           "used, each point appears only once in the result, even if "
00205           "the vertex is referenced multiple times.  This is particularly "
00206           "important when rendering points from a triangle mesh and you "
00207           "don't want the points to appear repeatedly."));
00208 
00209 ConfigVariableBool matrix_palette
00210 ("matrix-palette", false,
00211  PRC_DESC("Set this true to allow the use of the matrix palette when "
00212           "animating vertices in hardware.  The matrix palette is "
00213           "not supported by all devices, but if it is, using "
00214           "it can allow animation of more sophisticated meshes "
00215           "in hardware, and it can also improve the "
00216           "performance of animating some simpler meshes.  Without "
00217           "this option, certain meshes will have to be animated in "
00218           "software.  However, this option is not enabled by default, "
00219           "because its support seems to be buggy in certain drivers "
00220           "(ATI FireGL T2 8.103 in particular.)"));
00221 
00222 ConfigVariableBool display_list_animation
00223 ("display-list-animation", false,
00224  PRC_DESC("Set this true to allow the use of OpenGL display lists for "
00225           "rendering animated geometry (when the geometry is animated "
00226           "by the hardware).  This is not on by default because there "
00227           "appear to be some driver issues with this on my FireGL T2, "
00228           "but it should be perfectly doable in principle, and might get "
00229           "you a small performance boost."));
00230 
00231 ConfigVariableBool connect_triangle_strips
00232 ("connect-triangle-strips", true,
00233  PRC_DESC("Set this true to send a batch of triangle strips to the graphics "
00234           "card as one long triangle strip, connected by degenerate "
00235           "triangles, or false to send them as separate triangle strips "
00236           "with no degenerate triangles.  On PC hardware, using one long "
00237           "triangle strip may help performance by reducing the number "
00238           "of separate graphics calls that have to be made."));
00239 
00240 ConfigVariableBool preserve_triangle_strips
00241 ("preserve-triangle-strips", false,
00242  PRC_DESC("Set this true to indicate a preference for keeping triangle strips "
00243           "when possible, instead of decomposing them into triangles.  When "
00244           "this is true, flatten_strong and unify operations may be less "
00245           "effective at combining multiple Geoms together, but they will "
00246           "not implicitly decompose triangle strips."));
00247 
00248 ConfigVariableBool dump_generated_shaders
00249 ("dump-generated-shaders", false,
00250  PRC_DESC("Set this true to cause all generated shaders to be written "
00251           "to disk.  This is useful for debugging broken shader "
00252           "generators."));
00253 
00254 ConfigVariableBool enforce_attrib_lock
00255 ("enforce-attrib-lock", true,
00256  PRC_DESC("When a MaterialAttrib, TextureAttrib, or LightAttrib is "
00257           "constructed, the corresponding Material, Texture, or Light "
00258           "is 'attrib locked.'  The attrib lock prevents qualitative "
00259           "changes to the object.  This makes it possible to hardwire "
00260           "information about material, light, and texture properties "
00261           "into generated shaders.  This config variable can disable "
00262           "the attrib lock.  Disabling the lock will break the shader "
00263           "generator, but doing so may be necessary for backward "
00264           "compatibility with old code."));
00265 
00266 ConfigVariableEnum<AutoTextureScale> textures_power_2
00267 ("textures-power-2", ATS_down,
00268  PRC_DESC("Specify whether textures should automatically be constrained to "
00269           "dimensions which are a power of 2 when they are loaded from "
00270           "disk.  Set this to 'none' to disable this feature, or to "
00271           "'down' or 'up' to scale down or up to the nearest power of 2, "
00272           "respectively.  This only has effect on textures which are not "
00273           "already a power of 2."));
00274 
00275 ConfigVariableEnum<AutoTextureScale> textures_square
00276 ("textures-square", ATS_none,
00277  PRC_DESC("Specify whether textures should automatically be constrained to "
00278           "a square aspect ratio when they are loaded from disk.  Set this "
00279           "to 'none', 'down', or 'up'.  See textures-power-2."));
00280 
00281 ConfigVariableBool textures_auto_power_2
00282 ("textures-auto-power-2", false,
00283  PRC_DESC("If this is true, then panda will wait until you open a window, "
00284           "and then ask the window if it supports non-power-of-two textures. "
00285           "If so, then the config variable textures_power_2 will "
00286           "automatically be adjusted.  The pitfall of doing this is that if "
00287           "you then open a second window that doesn't support the same "
00288           "capabilities, it will have no choice but to print an error message."));
00289 
00290 ConfigVariableBool textures_header_only
00291 ("textures-header-only", false,
00292  PRC_DESC("If this is true, texture images will not actually be loaded from "
00293           "disk, but the image header information will be consulted to verify "
00294           "number of channels and so forth.  The texture images themselves "
00295           "will be generated in a default blue color."));
00296 
00297 ConfigVariableInt simple_image_size
00298 ("simple-image-size", "16 16",
00299  PRC_DESC("This is an x y pair that specifies the maximum size of an "
00300           "automatically-generated "
00301           "texture simple image.  The simple image can displayed before "
00302           "the texture has been loaded from disk."));
00303 
00304 ConfigVariableDouble simple_image_threshold
00305 ("simple-image-threshold", 0.1,
00306  PRC_DESC("This is a value that indicates how closely a texture's " 
00307           "generated simple "
00308           "image should approximate the original image.  The smaller the "
00309           "number, the closer the match; small numbers will result in "
00310           "simple images close to the maximum size specified by "
00311           "simple-image-size.  Larger numbers will result in smaller "
00312           "simple images.  Generally the value should be considerably "
00313           "less than 1."));
00314 
00315 ConfigVariableEnum<ShaderUtilization> shader_utilization
00316 ("shader-utilization", SUT_none,
00317  PRC_DESC("At times, panda may generate shaders.  This variable controls what "
00318           "kinds of shaders can be generated.  If you set it to SUT_none, "
00319           "shader generation will be be disabled.  If you set it to SUT_basic, "
00320           "then DX9 shaders may be generated, if you set it to SUT_advanced, "
00321           "then DX10 shaders may be generated."));
00322 
00323 ConfigVariableBool shader_auto_utilization
00324 ("shader-auto-utilization", false,
00325  PRC_DESC("If this is true, then panda will wait until you open a window, "
00326           "and then ask the window if it supports basic or advanced shaders. "
00327           "If so, then the config variable shader-utilization will "
00328           "automatically be adusted.  The pitfall of doing this is that if "
00329           "you then open a second window that doesn't support the same "
00330           "capabilities, it will have no choice but to print an error message."));
00331 
00332 ConfigVariableInt geom_cache_size
00333 ("geom-cache-size", 5000,
00334  PRC_DESC("Specifies the maximum number of entries in the cache "
00335           "for storing pre-processed data for rendering "
00336           "vertices.  This limit is flexible, and may be "
00337           "temporarily exceeded if many different Geoms are "
00338           "pre-processed during the space of a single frame."));
00339 
00340 ConfigVariableInt geom_cache_min_frames
00341 ("geom-cache-min-frames", 1,
00342  PRC_DESC("Specifies the minimum number of frames any one particular "
00343           "object will remain in the geom cache, even if geom-cache-size "
00344           "is exceeded."));
00345 
00346 ConfigVariableInt released_vbuffer_cache_size
00347 ("released-vbuffer-cache-size", 1048576,
00348  PRC_DESC("Specifies the size in bytes of the cache of vertex "
00349           "buffers that have recently been released.  If a new vertex "
00350           "buffer is prepared while a recently-released one of the same "
00351           "size is still in the cache, that same buffer is recycled.  This "
00352           "cuts down on the overhead of creating and destroying vertex "
00353           "buffers on the graphics card."));
00354 
00355 ConfigVariableInt released_ibuffer_cache_size
00356 ("released-ibuffer-cache-size", 102400,
00357  PRC_DESC("Specifies the size in bytes of the cache of index "
00358           "buffers that have recently been released.  If a new index "
00359           "buffer is prepared while a recently-released one of the same "
00360           "size is still in the cache, that same buffer is recycled.  This "
00361           "cuts down on the overhead of creating and destroying index "
00362           "buffers on the graphics card."));
00363 
00364 ConfigVariableDouble default_near
00365 ("default-near", 1.0,
00366  PRC_DESC("The default near clipping distance for all cameras."));
00367 
00368 ConfigVariableDouble default_far
00369 ("default-far", 100000.0,
00370  PRC_DESC("The default far clipping distance for all cameras."));
00371 
00372 ConfigVariableDouble lens_far_limit
00373 ("lens-far-limit", 0.0000001,
00374   PRC_DESC("This number is used to reduce the effect of numeric inaccuracies "
00375            "in Lens::extrude().  It should be a very small, positive number, "
00376            "almost zero; set it larger if Lens::extrude() returns values "
00377            "that appear meaningless, and set it smaller if you appear to be "
00378            "unable to move the far plane out far enough."));
00379 
00380 ConfigVariableDouble default_fov
00381 ("default-fov", 30.0,
00382  PRC_DESC("The default field of view in degrees for all cameras.  This is "
00383           "defined as a min_fov; that is, it is the field-of-view for the "
00384           "smallest of the X and Y sizes of the window, which is usually "
00385           "the vertical field of view (windows are usually wider than they "
00386           "are tall).  For a 4x3 window, 30 degrees vertical is roughly "
00387           "40 degrees horizontal."));
00388 
00389 ConfigVariableDouble default_iod
00390 ("default-iod", 0.2,
00391  PRC_DESC("The default interocular distance for stereo cameras."));
00392 
00393 ConfigVariableDouble default_converge
00394 ("default-converge", 25.0,
00395  PRC_DESC("The default convergence distance for stereo cameras."));
00396 
00397 ConfigVariableDouble default_keystone
00398 ("default-keystone", 0.0f,
00399  PRC_DESC("The default keystone correction, as an x y pair, for all cameras."));
00400 
00401 ConfigVariableFilename vertex_save_file_directory
00402 ("vertex-save-file-directory", "",
00403  PRC_DESC("The directory in which the saved vertex data file is created "
00404           "for saving vertex buffers that have been evicted from RAM.  If "
00405           "this is the empty string, or an invalid directory, a system "
00406           "default directory will be chosen."));
00407 
00408 ConfigVariableString vertex_save_file_prefix
00409 ("vertex-save-file-prefix", "p3d_vdata_",
00410  PRC_DESC("A prefix used to generate the filename for the saved vertex "
00411           "data file which is created for saving vertex buffers that have "
00412           "been evicted from RAM.  A uniquifying sequence number and "
00413           "filename extension will be appended to this string."));
00414 
00415 ConfigVariableInt vertex_data_small_size
00416 ("vertex-data-small-size", 64,
00417  PRC_DESC("When a GeomVertexArrayData is this number of bytes or smaller, it "
00418           "is deemed too small to pay the overhead of paging it in and out, "
00419           "and it is permanently retained resident."));
00420 
00421 ConfigVariableInt vertex_data_page_threads
00422 ("vertex-data-page-threads", 1,
00423  PRC_DESC("When this is nonzero (and Panda has been compiled with thread "
00424           "support) then this number of sub-threads will be spawned to "
00425           "evict vertex pages to disk and read them back again.  When this "
00426           "is 0, this work will be done in the main thread, which may "
00427           "introduce occasional random chugs in rendering."));
00428 
00429 ConfigVariableInt graphics_memory_limit
00430 ("graphics-memory-limit", -1,
00431  PRC_DESC("This is a default limit that is imposed on each GSG at "
00432           "GSG creation time.  It limits the total amount of graphics "
00433           "memory, including texture memory and vertex buffer memory, "
00434           "that will be consumed by the GSG, regardless of whether the "
00435           "hardware claims to provide more graphics memory than this.  "
00436           "It is useful to put a ceiling on graphics memory consumed, since "
00437           "some drivers seem to allow the application to consume more "
00438           "memory than the hardware can realistically support.  "
00439           "Set this to -1 to have no limit other than the normal "
00440           "hardware-imposed limit."));
00441 
00442 ConfigVariableDouble adaptive_lru_weight
00443 ("adaptive-lru-weight", 0.2,
00444  PRC_DESC("Specifies the weight factor used to compute the AdaptiveLru's "
00445           "exponential moving average."));
00446 
00447 ConfigVariableInt adaptive_lru_max_updates_per_frame
00448 ("adaptive-lru-max-updates-per-frame", 40,
00449  PRC_DESC("The number of pages the AdaptiveLru class will update per "
00450           "frame.  Do not set this too high or it will degrade "
00451           "performance."));
00452 
00453 ConfigVariableDouble async_load_delay
00454 ("async-load-delay", 0.0,
00455 PRC_DESC("If this is nonzero, it represents an artificial delay, "
00456          "in seconds, that is imposed on every asynchronous load attempt "
00457          "(within the thread).  Its purpose is to help debug errors that "
00458          "may occur when an asynchronous load is delayed.  The "
00459          "delay is per-model, and all aync loads will be queued "
00460          "up behind the delay--it is as if the time it takes to read a "
00461          "file is increased by this amount per read."));
00462  
00463 
00464 ConfigureFn(config_gobj) {
00465   AnimateVerticesRequest::init_type();
00466   BufferContext::init_type();
00467   Geom::init_type();
00468   GeomPipelineReader::init_type();
00469   GeomContext::init_type();
00470   GeomLines::init_type();
00471   GeomLinestrips::init_type();
00472   GeomMunger::init_type();
00473   GeomPoints::init_type();
00474   GeomPrimitive::init_type();
00475   GeomPrimitivePipelineReader::init_type();
00476   GeomTriangles::init_type();
00477   GeomTrifans::init_type();
00478   GeomTristrips::init_type();
00479   GeomVertexArrayData::init_type();
00480   GeomVertexArrayDataHandle::init_type();
00481   GeomVertexArrayFormat::init_type();
00482   GeomVertexData::init_type();
00483   GeomVertexDataPipelineReader::init_type();
00484   GeomVertexDataPipelineWriter::init_type();
00485   GeomVertexFormat::init_type();
00486   IndexBufferContext::init_type();
00487   InternalName::init_type();
00488   Lens::init_type();
00489   Material::init_type();
00490   MatrixLens::init_type();
00491   OcclusionQueryContext::init_type();
00492   OrthographicLens::init_type();
00493   PerspectiveLens::init_type();
00494   QueryContext::init_type();
00495   ShaderContext::init_type();
00496   Shader::init_type();
00497   SliderTable::init_type();
00498   Texture::init_type();
00499   TextureContext::init_type();
00500   TexturePoolFilter::init_type();
00501   TextureReloadRequest::init_type();
00502   TextureStage::init_type();
00503   TransformBlend::init_type();
00504   TransformBlendTable::init_type();
00505   TransformTable::init_type();
00506   UserVertexSlider::init_type();
00507   UserVertexTransform::init_type();
00508   VertexBufferContext::init_type();
00509   VertexSlider::init_type();
00510   VertexDataBuffer::init_type();
00511   VertexDataPage::init_type();
00512   VertexTransform::init_type();
00513   VideoTexture::init_type();
00514 
00515   //Registration of writeable object's creation
00516   //functions with BamReader's factory
00517   Geom::register_with_read_factory();
00518   GeomLines::register_with_read_factory();
00519   GeomLinestrips::register_with_read_factory();
00520   GeomPoints::register_with_read_factory();
00521   GeomTriangles::register_with_read_factory();
00522   GeomTrifans::register_with_read_factory();
00523   GeomTristrips::register_with_read_factory();
00524   GeomVertexArrayData::register_with_read_factory();
00525   GeomVertexArrayFormat::register_with_read_factory();
00526   GeomVertexData::register_with_read_factory();
00527   GeomVertexFormat::register_with_read_factory();
00528   InternalName::register_with_read_factory();
00529   Material::register_with_read_factory();
00530   MatrixLens::register_with_read_factory();
00531   OrthographicLens::register_with_read_factory();
00532   PerspectiveLens::register_with_read_factory();
00533   Shader::register_with_read_factory();
00534   SliderTable::register_with_read_factory();
00535   Texture::register_with_read_factory();
00536   TextureStage::register_with_read_factory();
00537   TransformBlendTable::register_with_read_factory();
00538   TransformTable::register_with_read_factory();
00539   UserVertexSlider::register_with_read_factory();
00540   UserVertexTransform::register_with_read_factory();
00541 }
00542 
00543 ostream &
00544 operator << (ostream &out, AutoTextureScale ats) {
00545   switch (ats) {
00546   case ATS_none:
00547     return out << "none";
00548    
00549   case ATS_down:
00550     return out << "down";
00551     
00552   case ATS_up:
00553     return out << "up";
00554 
00555   case ATS_UNSPECIFIED:
00556     return out << "UNSPECIFIED";
00557   }
00558 
00559   return out << "**invalid AutoTextureScale (" << (int)ats << ")**";
00560 }
00561 
00562 istream &
00563 operator >> (istream &in, AutoTextureScale &ats) {
00564   string word;
00565   in >> word;
00566 
00567   if (cmp_nocase(word, "none") == 0 ||
00568       cmp_nocase(word, "0") == 0 ||
00569       cmp_nocase(word, "#f") == 0 ||
00570       tolower(word[0] == 'f')) {
00571     ats = ATS_none;
00572 
00573   } else if (cmp_nocase(word, "down") == 0 ||
00574           cmp_nocase(word, "1") == 0 ||
00575           cmp_nocase(word, "#t") == 0 ||
00576           tolower(word[0] == 't')) {
00577     ats = ATS_down;
00578 
00579   } else if (cmp_nocase(word, "up") == 0) {
00580     ats = ATS_up;
00581 
00582   } else {
00583     gobj_cat->error() << "Invalid AutoTextureScale value: " << word << "\n";
00584     ats = ATS_none;
00585   }
00586 
00587   return in;
00588 }
00589 
00590 ostream &
00591 operator << (ostream &out, ShaderUtilization sgc) {
00592   switch (sgc) {
00593   case SUT_none:
00594     return out << "none";
00595    
00596   case SUT_basic:
00597     return out << "basic";
00598     
00599   case SUT_advanced:
00600     return out << "advanced";
00601 
00602   case SUT_UNSPECIFIED:
00603     return out << "UNSPECIFIED";
00604   }
00605 
00606   return out << "**invalid ShaderUtilization (" << (int)sgc << ")**";
00607 }
00608 
00609 istream &
00610 operator >> (istream &in, ShaderUtilization &sgc) {
00611   string word;
00612   in >> word;
00613 
00614   if (cmp_nocase(word, "none") == 0 ||
00615       cmp_nocase(word, "0") == 0 ||
00616       cmp_nocase(word, "#f") == 0 ||
00617       tolower(word[0] == 'f')) {
00618     sgc = SUT_none;
00619 
00620   } else if (cmp_nocase(word, "basic") == 0 ||
00621           cmp_nocase(word, "1") == 0 ||
00622           cmp_nocase(word, "#t") == 0 ||
00623           tolower(word[0] == 't')) {
00624     sgc = SUT_basic;
00625 
00626   } else if (cmp_nocase(word, "advanced") == 0) {
00627     sgc = SUT_advanced;
00628 
00629   } else {
00630     gobj_cat->error() << "Invalid ShaderUtilization value: " << word << "\n";
00631     sgc = SUT_none;
00632   }
00633 
00634   return in;
00635 }
 All Classes Functions Variables Enumerations