Panda3D
config_gobj.cxx
1 // Filename: config_gobj.cxx
2 // Created by: drose (01Oct99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "animateVerticesRequest.h"
16 #include "bufferContext.h"
17 #include "config_util.h"
18 #include "config_gobj.h"
19 #include "geom.h"
20 #include "geomCacheEntry.h"
21 #include "geomMunger.h"
22 #include "geomPrimitive.h"
23 #include "geomTriangles.h"
24 #include "geomTristrips.h"
25 #include "geomTrifans.h"
26 #include "geomPatches.h"
27 #include "geomLines.h"
28 #include "geomLinestrips.h"
29 #include "geomPoints.h"
30 #include "geomVertexArrayData.h"
31 #include "geomVertexArrayFormat.h"
32 #include "geomVertexData.h"
33 #include "geomVertexFormat.h"
34 #include "lens.h"
35 #include "material.h"
36 #include "occlusionQueryContext.h"
37 #include "orthographicLens.h"
38 #include "matrixLens.h"
39 #include "paramTexture.h"
40 #include "perspectiveLens.h"
41 #include "queryContext.h"
42 #include "sliderTable.h"
43 #include "texture.h"
44 #include "texturePoolFilter.h"
45 #include "textureReloadRequest.h"
46 #include "textureStage.h"
47 #include "textureContext.h"
48 #include "timerQueryContext.h"
49 #include "samplerContext.h"
50 #include "samplerState.h"
51 #include "shader.h"
52 #include "shaderContext.h"
53 #include "transformBlend.h"
54 #include "transformBlendTable.h"
55 #include "transformTable.h"
56 #include "userVertexSlider.h"
57 #include "userVertexTransform.h"
58 #include "vertexDataBuffer.h"
59 #include "vertexTransform.h"
60 #include "vertexSlider.h"
61 #include "videoTexture.h"
62 #include "geomContext.h"
63 #include "vertexBufferContext.h"
64 #include "indexBufferContext.h"
65 #include "internalName.h"
66 
67 #include "dconfig.h"
68 #include "string_utils.h"
69 
70 Configure(config_gobj);
71 NotifyCategoryDef(gobj, "");
72 NotifyCategoryDef(shader, "");
73 
74 ConfigVariableInt max_texture_dimension
75 ("max-texture-dimension", -1,
76  PRC_DESC("Set this to the maximum size a texture is allowed to be in either "
77  "dimension. This is generally intended as a simple way to restrict "
78  "texture sizes for limited graphics cards. When this is greater "
79  "than zero, each texture image loaded from a file (but only those "
80  "loaded from a file) will be automatically scaled down, if "
81  "necessary, so that neither dimension is larger than this value. "
82  "If this is less than zero, the size limit is taken from the "
83  "primary GSG. If this is exactly zero, there is no limit."));
84 
85 ConfigVariableDouble texture_scale
86 ("texture-scale", 1.0,
87  PRC_DESC("This is a global scale factor that is applied to each texture "
88  "as it is loaded from disk. For instance, a value of 0.5 will "
89  "reduce each texture to one-half its size in each dimension. This "
90  "scale factor is applied before textures-power-2 or "
91  "max-texture-dimension."));
92 
93 ConfigVariableInt texture_scale_limit
94 ("texture-scale-limit", 4,
95  PRC_DESC("This specifies the limit below which texture-scale will not "
96  "reduce a texture image. This is a single dimension which applies "
97  "to both X and Y."));
98 
99 ConfigVariableList exclude_texture_scale
100 ("exclude-texture-scale",
101  PRC_DESC("This is a list of glob patterns for texture filenames "
102  "(excluding the directory part of the filename, but including "
103  "the extension); for instance, 'digits_*.png'. Any texture "
104  "filenames that match one of these patterns will not be affected "
105  "by max-texture-dimension or texture-scale."));
106 
107 ConfigVariableBool keep_texture_ram
108 ("keep-texture-ram", false,
109  PRC_DESC("Set this to true to retain the ram image for each texture after it "
110  "has been prepared with the GSG. This will allow the texture to be "
111  "prepared with multiple GSG's, or to be re-prepared later after it is "
112  "explicitly released from the GSG, without having to reread the "
113  "texture image from disk; but it will consume memory somewhat "
114  "wastefully."));
115 
116 ConfigVariableBool compressed_textures
117 ("compressed-textures", false,
118  PRC_DESC("Set this to true to compress textures as they are loaded into "
119  "texture memory, if the driver supports this. Specifically, this "
120  "changes the meaning of set_compression(Texture::CM_default) to "
121  "Texture::CM_on."));
122 
123 ConfigVariableBool driver_compress_textures
124 ("driver-compress-textures", false,
125  PRC_DESC("Set this true to ask the graphics driver to compress textures, "
126  "rather than compressing them in-memory first. Depending on "
127  "your graphics driver, you may or may not get better performance "
128  "or results by setting this true. Setting it true may also "
129  "allow you to take advantage of some exotic compression algorithm "
130  "other than DXT1/3/5 that your graphics driver supports, but "
131  "which is unknown to Panda. If the libsquish library is not "
132  "compiled into Panda, textures cannot be compressed in-memory, "
133  "and will always be handed to the graphics driver, regardless "
134  "of this setting."));
135 
136 ConfigVariableBool driver_generate_mipmaps
137 ("driver-generate-mipmaps", true,
138  PRC_DESC("Set this true to use the hardware to generate mipmaps "
139  "automatically in all cases, if supported. Set it false "
140  "to generate mipmaps in software when possible."));
141 
142 ConfigVariableBool vertex_buffers
143 ("vertex-buffers", true,
144  PRC_DESC("Set this true to allow the use of vertex buffers (or buffer "
145  "objects, as OpenGL dubs them) for rendering vertex data. This "
146  "can greatly improve rendering performance on "
147  "higher-end graphics cards, at the cost of some additional "
148  "graphics memory (which might otherwise be used for textures "
149  "or offscreen buffers). On lower-end graphics cards this will "
150  "make little or no difference."));
151 
152 ConfigVariableBool vertex_arrays
153 ("vertex-arrays", true,
154  PRC_DESC("Set this true to allow the use of vertex arrays for rendering "
155  "OpenGL vertex data. This, or vertex buffers, is the normal "
156  "way of issuing vertices ever since OpenGL 1.1, and you "
157  "almost always want to have this set to true. However, some very "
158  "buggy graphics drivers may have problems handling vertex arrays "
159  "correctly, so if you are experiencing problems you might try "
160  "setting this to false. If this is false, Panda will fall back "
161  "to using immediate-mode commands like glVertex3f(), etc., to "
162  "issue the vertices, which is potentially much slower than "
163  "vertex arrays. Setting this false also disables vertex buffers, "
164  "effectively ignoring the setting of the vertex-buffers variable "
165  "(since vertex buffers are a special case of vertex arrays in "
166  "OpenGL). This variable is normally not enabled in a production "
167  "build. This has no effect on DirectX rendering."));
168 
169 ConfigVariableBool display_lists
170 ("display-lists", false,
171  PRC_DESC("Set this true to allow the use of OpenGL display lists for "
172  "rendering static geometry. On some systems, this can result "
173  "in a performance improvement over vertex buffers alone; on "
174  "other systems (particularly low-end systems) it makes little to "
175  "no difference. On some systems, using display lists can actually "
176  "reduce performance. This has no effect on DirectX rendering or "
177  "on dynamic geometry (e.g. soft-skinned animation)."));
178 
179 ConfigVariableBool hardware_animated_vertices
180 ("hardware-animated-vertices", false,
181  PRC_DESC("Set this true to allow the transforming of soft-skinned "
182  "animated vertices via hardware, if supported, or false always "
183  "to perform the vertex animation via software within Panda. "
184  "If you have a card that supports this, and your scene does "
185  "not contain too many vertices already, this can provide a "
186  "performance boost by offloading some work from your CPU onto "
187  "your graphics card. It may also help by reducing the bandwidth "
188  "necessary on your computer's bus. However, in some cases it "
189  "may actually reduce performance."));
190 
191 ConfigVariableBool hardware_point_sprites
192 ("hardware-point-sprites", true,
193  PRC_DESC("Set this true to allow the use of hardware extensions when "
194  "rendering perspective-scaled points and point sprites. When "
195  "false, these large points are always simulated via quads "
196  "computed in software, even if the hardware claims it can "
197  "support them directly."));
198 
199 ConfigVariableBool hardware_points
200 ("hardware-points", true,
201  PRC_DESC("Set this true to allow the use of hardware extensions when "
202  "rendering large points. When false, large points (even if "
203  "untextured) will be simulated via quads computed in software."));
204 
205 ConfigVariableBool singular_points
206 ("singular-points", true,
207  PRC_DESC("Set this true to insist that when RenderModeAttrib::M_points is "
208  "used, each point appears only once in the result, even if "
209  "the vertex is referenced multiple times. This is particularly "
210  "important when rendering points from a triangle mesh and you "
211  "don't want the points to appear repeatedly."));
212 
213 ConfigVariableBool matrix_palette
214 ("matrix-palette", false,
215  PRC_DESC("Set this true to allow the use of the matrix palette when "
216  "animating vertices in hardware. The matrix palette is "
217  "not supported by all devices, but if it is, using "
218  "it can allow animation of more sophisticated meshes "
219  "in hardware, and it can also improve the "
220  "performance of animating some simpler meshes. Without "
221  "this option, certain meshes will have to be animated in "
222  "software. However, this option is not enabled by default, "
223  "because its support seems to be buggy in certain drivers "
224  "(ATI FireGL T2 8.103 in particular.)"));
225 
226 ConfigVariableBool display_list_animation
227 ("display-list-animation", false,
228  PRC_DESC("Set this true to allow the use of OpenGL display lists for "
229  "rendering animated geometry (when the geometry is animated "
230  "by the hardware). This is not on by default because there "
231  "appear to be some driver issues with this on my FireGL T2, "
232  "but it should be perfectly doable in principle, and might get "
233  "you a small performance boost."));
234 
235 ConfigVariableBool connect_triangle_strips
236 ("connect-triangle-strips", true,
237  PRC_DESC("Set this true to send a batch of triangle strips to the graphics "
238  "card as one long triangle strip, connected by degenerate "
239  "triangles, or false to send them as separate triangle strips "
240  "with no degenerate triangles. On PC hardware, using one long "
241  "triangle strip may help performance by reducing the number "
242  "of separate graphics calls that have to be made."));
243 
244 ConfigVariableBool preserve_triangle_strips
245 ("preserve-triangle-strips", false,
246  PRC_DESC("Set this true to indicate a preference for keeping triangle strips "
247  "when possible, instead of decomposing them into triangles. When "
248  "this is true, flatten_strong and unify operations may be less "
249  "effective at combining multiple Geoms together, but they will "
250  "not implicitly decompose triangle strips."));
251 
252 ConfigVariableBool dump_generated_shaders
253 ("dump-generated-shaders", false,
254  PRC_DESC("Set this true to cause all generated shaders to be written "
255  "to disk. This is useful for debugging broken shader "
256  "generators."));
257 
258 ConfigVariableBool cache_generated_shaders
259 ("cache-generated-shaders", true,
260  PRC_DESC("Set this true to cause all generated shaders to be cached in "
261  "memory. This is useful to prevent unnecessary recompilation."));
262 
263 ConfigVariableBool enforce_attrib_lock
264 ("enforce-attrib-lock", true,
265  PRC_DESC("When a MaterialAttrib, TextureAttrib, or LightAttrib is "
266  "constructed, the corresponding Material, Texture, or Light "
267  "is 'attrib locked.' The attrib lock prevents qualitative "
268  "changes to the object. This makes it possible to hardwire "
269  "information about material, light, and texture properties "
270  "into generated shaders. This config variable can disable "
271  "the attrib lock. Disabling the lock will break the shader "
272  "generator, but doing so may be necessary for backward "
273  "compatibility with old code."));
274 
275 ConfigVariableBool vertices_float64
276 ("vertices-float64", false,
277  PRC_DESC("When this is true, the default float format for vertices "
278  "will be a 64-bit double-precision float, instead "
279  "of the normal 32-bit single-precision float. This must be set "
280  "at static init time to have the broadest effect. You almost never "
281  "want to set this true, since current hardware does not support "
282  "double-precision vertices, and setting this will just require the "
283  "driver to downsample the vertices at load time, making everything "
284  "slower."));
285 
286 ConfigVariableInt vertex_column_alignment
287 ("vertex-column-alignment", 4,
288  PRC_DESC("This specifies the default byte alignment for each column of "
289  "data within a GeomVertexData when it is assembled using the default "
290  "interfaces. Normally, you should not change this config variable "
291  "(which would change this value globally), but instead specify any "
292  "alignment requirements on a per-column basis as you construct a "
293  "GeomVertexFormat. Setting this value globally could result in "
294  "much needless wasted space in all vertex data objects, but it "
295  "could be useful for simple experiments. Also see "
296  "vertex-animation-align-16 for a variable that controls "
297  "this alignment for the vertex animation columns only."));
298 
299 ConfigVariableBool vertex_animation_align_16
300 ("vertex-animation-align-16",
301 #ifdef LINMATH_ALIGN
302  true,
303 #else
304  false,
305 #endif
306  PRC_DESC("If this is true, then animated vertices will be created with 4-component "
307  "floats and aligned to 16-byte boundaries, to allow efficient vectorization "
308  "(e.g. SSE2) operations when computing animations. If this is false, "
309  "animated vertices will be packed as tightly as possible, in the normal way, "
310  "which will optimize the amount of memory that must be sent to the graphics "
311  "card, but prevent the use of SSE2 to calculate animation. This does not "
312  "affect unanimated vertices, which are always packed tightly. This also "
313  "impacts only vertex formats created within Panda subsystems; custom "
314  "vertex formats are not affected."));
315 
317 ("textures-power-2", ATS_down,
318  PRC_DESC("Specify whether textures should automatically be constrained to "
319  "dimensions which are a power of 2 when they are loaded from "
320  "disk. Set this to 'none' to disable this feature, or to "
321  "'down' or 'up' to scale down or up to the nearest power of 2, "
322  "respectively. This only has effect on textures which are not "
323  "already a power of 2."));
324 
326 ("textures-square", ATS_none,
327  PRC_DESC("Specify whether textures should automatically be constrained to "
328  "a square aspect ratio when they are loaded from disk. Set this "
329  "to 'none', 'down', or 'up'. See textures-power-2."));
330 
331 ConfigVariableBool textures_auto_power_2
332 ("textures-auto-power-2", false,
333  PRC_DESC("If this is true, then panda will wait until you open a window, "
334  "and then ask the window if it supports non-power-of-two textures. "
335  "If so, then the config variable textures_power_2 will "
336  "automatically be adjusted. The pitfall of doing this is that if "
337  "you then open a second window that doesn't support the same "
338  "capabilities, it will have no choice but to print an error message."));
339 
340 ConfigVariableBool textures_header_only
341 ("textures-header-only", false,
342  PRC_DESC("If this is true, texture images will not actually be loaded from "
343  "disk, but the image header information will be consulted to verify "
344  "number of channels and so forth. The texture images themselves "
345  "will be generated in a default blue color."));
346 
347 ConfigVariableInt simple_image_size
348 ("simple-image-size", "16 16",
349  PRC_DESC("This is an x y pair that specifies the maximum size of an "
350  "automatically-generated "
351  "texture simple image. The simple image can displayed before "
352  "the texture has been loaded from disk."));
353 
354 ConfigVariableDouble simple_image_threshold
355 ("simple-image-threshold", 0.1,
356  PRC_DESC("This is a value that indicates how closely a texture's "
357  "generated simple "
358  "image should approximate the original image. The smaller the "
359  "number, the closer the match; small numbers will result in "
360  "simple images close to the maximum size specified by "
361  "simple-image-size. Larger numbers will result in smaller "
362  "simple images. Generally the value should be considerably "
363  "less than 1."));
364 
365 ConfigVariableEnum<ShaderUtilization> shader_utilization
366 ("shader-utilization", SUT_none,
367  PRC_DESC("At times, panda may generate shaders. This variable controls what "
368  "kinds of shaders can be generated. If you set it to SUT_none, "
369  "shader generation will be be disabled. If you set it to SUT_basic, "
370  "then DX9 shaders may be generated, if you set it to SUT_advanced, "
371  "then DX10 shaders may be generated."));
372 
373 ConfigVariableBool shader_auto_utilization
374 ("shader-auto-utilization", false,
375  PRC_DESC("If this is true, then panda will wait until you open a window, "
376  "and then ask the window if it supports basic or advanced shaders. "
377  "If so, then the config variable shader-utilization will "
378  "automatically be adusted. The pitfall of doing this is that if "
379  "you then open a second window that doesn't support the same "
380  "capabilities, it will have no choice but to print an error message."));
381 
382 ConfigVariableInt geom_cache_size
383 ("geom-cache-size", 5000,
384  PRC_DESC("Specifies the maximum number of entries in the cache "
385  "for storing pre-processed data for rendering "
386  "vertices. This limit is flexible, and may be "
387  "temporarily exceeded if many different Geoms are "
388  "pre-processed during the space of a single frame."));
389 
390 ConfigVariableInt geom_cache_min_frames
391 ("geom-cache-min-frames", 1,
392  PRC_DESC("Specifies the minimum number of frames any one particular "
393  "object will remain in the geom cache, even if geom-cache-size "
394  "is exceeded."));
395 
396 ConfigVariableInt released_vbuffer_cache_size
397 ("released-vbuffer-cache-size", 1048576,
398  PRC_DESC("Specifies the size in bytes of the cache of vertex "
399  "buffers that have recently been released. If a new vertex "
400  "buffer is prepared while a recently-released one of the same "
401  "size is still in the cache, that same buffer is recycled. This "
402  "cuts down on the overhead of creating and destroying vertex "
403  "buffers on the graphics card."));
404 
405 ConfigVariableInt released_ibuffer_cache_size
406 ("released-ibuffer-cache-size", 102400,
407  PRC_DESC("Specifies the size in bytes of the cache of index "
408  "buffers that have recently been released. If a new index "
409  "buffer is prepared while a recently-released one of the same "
410  "size is still in the cache, that same buffer is recycled. This "
411  "cuts down on the overhead of creating and destroying index "
412  "buffers on the graphics card."));
413 
414 ConfigVariableDouble default_near
415 ("default-near", 1.0,
416  PRC_DESC("The default near clipping distance for all cameras."));
417 
418 ConfigVariableDouble default_far
419 ("default-far", 100000.0,
420  PRC_DESC("The default far clipping distance for all cameras."));
421 
422 ConfigVariableDouble lens_far_limit
423 ("lens-far-limit", 0.0000001,
424  PRC_DESC("This number is used to reduce the effect of numeric inaccuracies "
425  "in Lens::extrude(). It should be a very small, positive number, "
426  "almost zero; set it larger if Lens::extrude() returns values "
427  "that appear meaningless, and set it smaller if you appear to be "
428  "unable to move the far plane out far enough."));
429 
430 ConfigVariableDouble default_fov
431 ("default-fov", 30.0,
432  PRC_DESC("The default field of view in degrees for all cameras. This is "
433  "defined as a min_fov; that is, it is the field-of-view for the "
434  "smallest of the X and Y sizes of the window, which is usually "
435  "the vertical field of view (windows are usually wider than they "
436  "are tall). For a 4x3 window, 30 degrees vertical is roughly "
437  "40 degrees horizontal."));
438 
439 ConfigVariableDouble default_iod
440 ("default-iod", 0.2,
441  PRC_DESC("The default interocular distance for stereo cameras."));
442 
443 ConfigVariableDouble default_converge
444 ("default-converge", 25.0,
445  PRC_DESC("The default convergence distance for stereo cameras."));
446 
447 ConfigVariableDouble default_keystone
448 ("default-keystone", 0.0f,
449  PRC_DESC("The default keystone correction, as an x y pair, for all cameras."));
450 
451 ConfigVariableFilename vertex_save_file_directory
452 ("vertex-save-file-directory", "",
453  PRC_DESC("The directory in which the saved vertex data file is created "
454  "for saving vertex buffers that have been evicted from RAM. If "
455  "this is the empty string, or an invalid directory, a system "
456  "default directory will be chosen."));
457 
458 ConfigVariableString vertex_save_file_prefix
459 ("vertex-save-file-prefix", "p3d_vdata_",
460  PRC_DESC("A prefix used to generate the filename for the saved vertex "
461  "data file which is created for saving vertex buffers that have "
462  "been evicted from RAM. A uniquifying sequence number and "
463  "filename extension will be appended to this string."));
464 
465 ConfigVariableInt vertex_data_small_size
466 ("vertex-data-small-size", 64,
467  PRC_DESC("When a GeomVertexArrayData is this number of bytes or smaller, it "
468  "is deemed too small to pay the overhead of paging it in and out, "
469  "and it is permanently retained resident."));
470 
471 ConfigVariableInt vertex_data_page_threads
472 ("vertex-data-page-threads", 1,
473  PRC_DESC("When this is nonzero (and Panda has been compiled with thread "
474  "support) then this number of sub-threads will be spawned to "
475  "evict vertex pages to disk and read them back again. When this "
476  "is 0, this work will be done in the main thread, which may "
477  "introduce occasional random chugs in rendering."));
478 
479 ConfigVariableInt graphics_memory_limit
480 ("graphics-memory-limit", -1,
481  PRC_DESC("This is a default limit that is imposed on each GSG at "
482  "GSG creation time. It limits the total amount of graphics "
483  "memory, including texture memory and vertex buffer memory, "
484  "that will be consumed by the GSG, regardless of whether the "
485  "hardware claims to provide more graphics memory than this. "
486  "It is useful to put a ceiling on graphics memory consumed, since "
487  "some drivers seem to allow the application to consume more "
488  "memory than the hardware can realistically support. "
489  "Set this to -1 to have no limit other than the normal "
490  "hardware-imposed limit."));
491 
492 ConfigVariableInt sampler_object_limit
493 ("sampler-object-limit", 2048,
494  PRC_DESC("This is a default limit that is imposed on each GSG at "
495  "GSG creation time. It limits the total amount of sampler "
496  "objects that will be k.ept by the GSG, regardless of whether "
497  "the hardware claims to provide more sampler objects than this. "
498  "Direct3D 10-capable hardware supports at least 4096 distinct "
499  "sampler objects, but we provide a slightly more conservative "
500  "limit by default."));
501 
502 ConfigVariableDouble adaptive_lru_weight
503 ("adaptive-lru-weight", 0.2,
504  PRC_DESC("Specifies the weight factor used to compute the AdaptiveLru's "
505  "exponential moving average."));
506 
507 ConfigVariableInt adaptive_lru_max_updates_per_frame
508 ("adaptive-lru-max-updates-per-frame", 40,
509  PRC_DESC("The number of pages the AdaptiveLru class will update per "
510  "frame. Do not set this too high or it will degrade "
511  "performance."));
512 
513 ConfigVariableDouble async_load_delay
514 ("async-load-delay", 0.0,
515 PRC_DESC("If this is nonzero, it represents an artificial delay, "
516  "in seconds, that is imposed on every asynchronous load attempt "
517  "(within the thread). Its purpose is to help debug errors that "
518  "may occur when an asynchronous load is delayed. The "
519  "delay is per-model, and all aync loads will be queued "
520  "up behind the delay--it is as if the time it takes to read a "
521  "file is increased by this amount per read."));
522 
523 ConfigVariableInt lens_geom_segments
524 ("lens-geom-segments", 50,
525  PRC_DESC("This is the number of times to subdivide the visualization "
526  "wireframe created when Lens::make_geometry() (or "
527  "LensNode::show_frustum()) is called, for representing accurate "
528  "curves. Note that this is only "
529  "used for a nonlinear lens such as a cylindrical or fisheye "
530  "lens; for a normal perspective or orthographic lens, the "
531  "wireframe is not subdivided."));
532 
533 ConfigVariableBool stereo_lens_old_convergence
534 ("stereo-lens-old-convergence", false,
535  PRC_DESC("In Panda3D 1.8 and below, when using a stereo lens, Panda "
536  "generate an incorrect frustum skew for a given convergence "
537  "distance, meaning that the left-right images wouldn't "
538  "overlap at the configured distance. This calculation has "
539  "since been corrected, but if your application relies on the "
540  "old, incorrect behavior, this may be set to 'true' to switch "
541  "back to the old calculation."));
542 
543 ConfigVariableString cg_glsl_version
544 ("cg-glsl-version", "",
545  PRC_DESC("If this is set, it forces the Cg compiler to generate GLSL "
546  "code conforming to the given GLSL version when using the "
547  "glslv, glslf or glslg profiles. Use this when you are having "
548  "problems with these profiles. Example values are 120 or 150."));
549 
550 ConfigVariableBool glsl_preprocess
551 ("glsl-preprocess", true,
552  PRC_DESC("If this is enabled, Panda looks for lines starting with "
553  "#pragma include when loading a GLSL shader and processes "
554  "it appropriately. This can be useful if you have code that "
555  "is shared between multiple shaders. Set this to false if "
556  "you have no need for this feature or if you do your own "
557  "preprocessing of GLSL shaders."));
558 
559 ConfigVariableInt glsl_include_recursion_limit
560 ("glsl-include-recursion-limit", 10,
561  PRC_DESC("This sets a limit on how many nested #pragma include "
562  "directives that Panda will follow when glsl-preprocess is "
563  "enabled. This is used to prevent infinite recursion when "
564  "two shader files include each other."));
565 
566 ConfigureFn(config_gobj) {
567  AnimateVerticesRequest::init_type();
568  BufferContext::init_type();
569  Geom::init_type();
570  GeomCacheEntry::init_type();
571  GeomPipelineReader::init_type();
572  GeomContext::init_type();
573  GeomLines::init_type();
574  GeomLinestrips::init_type();
575  GeomMunger::init_type();
576  GeomPoints::init_type();
577  GeomPrimitive::init_type();
578  GeomPrimitivePipelineReader::init_type();
579  GeomTriangles::init_type();
580  GeomTrifans::init_type();
581  GeomTristrips::init_type();
582  GeomPatches::init_type();
583  GeomVertexArrayData::init_type();
584  GeomVertexArrayDataHandle::init_type();
585  GeomVertexArrayFormat::init_type();
586  GeomVertexData::init_type();
587  GeomVertexDataPipelineReader::init_type();
588  GeomVertexDataPipelineWriter::init_type();
589  GeomVertexFormat::init_type();
590  IndexBufferContext::init_type();
591  InternalName::init_type();
592  Lens::init_type();
593  Material::init_type();
594  MatrixLens::init_type();
595  OcclusionQueryContext::init_type();
596  OrthographicLens::init_type();
597  ParamTextureImage::init_type();
598  ParamTextureSampler::init_type();
599  PerspectiveLens::init_type();
600  QueryContext::init_type();
601  SamplerContext::init_type();
602  SamplerState::init_type();
603  ShaderContext::init_type();
604  Shader::init_type();
605  SliderTable::init_type();
606  Texture::init_type();
607  TextureContext::init_type();
608  TexturePoolFilter::init_type();
609  TextureReloadRequest::init_type();
610  TextureStage::init_type();
611  TimerQueryContext::init_type();
612  TransformBlend::init_type();
613  TransformBlendTable::init_type();
614  TransformTable::init_type();
615  UserVertexSlider::init_type();
616  UserVertexTransform::init_type();
617  VertexBufferContext::init_type();
618  VertexSlider::init_type();
619  VertexDataBuffer::init_type();
620  VertexDataPage::init_type();
621  VertexTransform::init_type();
622  VideoTexture::init_type();
623 
624  //Registration of writeable object's creation
625  //functions with BamReader's factory
627  GeomLines::register_with_read_factory();
629  GeomPoints::register_with_read_factory();
630  GeomTriangles::register_with_read_factory();
631  GeomTrifans::register_with_read_factory();
633  GeomPatches::register_with_read_factory();
635  GeomVertexArrayFormat::register_with_read_factory();
637  GeomVertexFormat::register_with_read_factory();
638  InternalName::register_with_read_factory();
653 }
654 
655 ostream &
656 operator << (ostream &out, ShaderUtilization sgc) {
657  switch (sgc) {
658  case SUT_none:
659  return out << "none";
660 
661  case SUT_basic:
662  return out << "basic";
663 
664  case SUT_advanced:
665  return out << "advanced";
666 
667  case SUT_unspecified:
668  return out << "unspecified";
669  }
670 
671  return out << "**invalid ShaderUtilization (" << (int)sgc << ")**";
672 }
673 
674 istream &
675 operator >> (istream &in, ShaderUtilization &sgc) {
676  string word;
677  in >> word;
678 
679  if (cmp_nocase(word, "none") == 0 ||
680  cmp_nocase(word, "0") == 0 ||
681  cmp_nocase(word, "#f") == 0 ||
682  (!word.empty() && tolower(word[0]) == 'f')) {
683  sgc = SUT_none;
684 
685  } else if (cmp_nocase(word, "basic") == 0 ||
686  cmp_nocase(word, "1") == 0 ||
687  cmp_nocase(word, "#t") == 0 ||
688  (!word.empty() && tolower(word[0]) == 't')) {
689  sgc = SUT_basic;
690 
691  } else if (cmp_nocase(word, "advanced") == 0) {
692  sgc = SUT_advanced;
693 
694  } else {
695  gobj_cat->error() << "Invalid ShaderUtilization value: " << word << "\n";
696  sgc = SUT_none;
697  }
698 
699  return in;
700 }
static void register_with_read_factory()
Tells the BamReader how to create objects of type Shader.
Definition: shader.cxx:3121
static void register_with_read_factory()
Tells the BamReader how to create objects of type Lens.
This is a convenience class to specialize ConfigVariable as a Filename type.
This is a convenience class to specialize ConfigVariable as a boolean type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ParamValue.
static void register_with_read_factory()
Factory method to generate a Texture object.
Definition: texture.cxx:7863
static void register_with_read_factory()
Tells the BamReader how to create objects of type UserVertexSlider.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Lens.
Definition: matrixLens.cxx:89
This class is similar to ConfigVariable, but it reports its value as a list of strings.
static void register_with_read_factory()
Tells the BamReader how to create objects of type TransformTable.
This is a convenience class to specialize ConfigVariable as a floating-point type.
static void register_with_read_factory()
Factory method to generate a TextureStage object.
This is a convenience class to specialize ConfigVariable as a string type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type TransformBlendTable.
This class specializes ConfigVariable as an enumerated type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type ParamValue.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Lens.
static void register_with_read_factory()
Tells the BamReader how to create objects of type SliderTable.
This is a convenience class to specialize ConfigVariable as an integer type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
static void register_with_read_factory()
Tells the BamReader how to create objects of type GeomVertexArrayData.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.
Definition: geom.cxx:1671
static void register_with_read_factory()
Factory method to generate a Material object.
Definition: material.cxx:230
static void register_with_read_factory()
Tells the BamReader how to create objects of type UserVertexTransform.
static void register_with_read_factory()
Tells the BamReader how to create objects of type GeomVertexData.