Commit Graph

163 Commits

Author SHA1 Message Date
rdb 1f9b4690e6 pgraph: fix writing to SequenceNode frame_rate property 2019-02-19 21:29:21 +01:00
rdb 0ba1235d35 ShaderGenerator: print out generated shader in spam output mode 2019-01-31 00:05:23 +01:00
rdb 0e447b7429 ShaderGenerator: do shadow map calcs in fshader if out of varyings
If too many shadow-casting lights are active, too many TEXCOORD varyings will be used and a shader compilation error will be displayed.  Instead, Panda will now just do the calculation in the fragment shader if not enough varyings are available.  It's slower, but better than crashing.
2019-01-30 23:54:22 +01:00
rdb dc8f01df8a ShaderGenerator: pack eye-space normal to save one varying
Only when normal mapping is enabled.
2019-01-30 23:51:50 +01:00
rdb 9d12a4c437 general: improvements to doxygen API reference:
* In C++ reference, only pick up classes defined in .h file
* Add a few excludes to C++ reference that aren't public API
* On class index pages, reduce number of columns
* Add @since for some methods/classes that are new in 1.10.0
* Fix/improve a few docstrings here and there
2019-01-23 22:24:02 +01:00
rdb 4699dfcd5b ShaderGenerator: fix toggling shadows while shader gen is on 2018-12-31 14:07:14 +01:00
rdb 97d4e32a06 general: use nassert_raise instead of nassertv(false) et al
Even a brief error message in the assertion is infinitely more useful to a user who is not at home in the source code, especially for assertions that may reasonably be triggered by honest user mistakes.
2018-11-28 17:35:20 +01:00
rdb 6051e6f305 ShaderGenerator: normalize tangent/binormal/normal after interpolation
Also changes l_eye_normal interpolant from float4 to float3.
2018-11-08 15:53:34 +01:00
rdb a099c85245 ShaderGenerator: fix broken handling of CO_undefined alpha operand
Fixes #394
2018-09-25 21:19:30 +02:00
rdb 47496068d3 Show materials with only base color applied properly 2018-09-09 20:56:37 +02:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb 60468b0bec ShaderGenerator: additional case where vtx_color isn't needed
See sample code in a comment in #370
2018-08-05 12:49:03 +02:00
rdb 929808b867 ShaderGenerator: fix regression with flat colors 2018-08-03 22:58:29 +02:00
rdb 8806dedb51 ShaderGenerator: avoid writing vtx_color input if unneeded 2018-08-03 22:24:48 +02:00
rdb 9ba2d7242e gobj: get rid of enforce-attrib-lock, just DTRT instead
This setting causes asserts when modifying certain material flags after they are assigned to a node, in case a shader has been generated that uses the materials, which cannot efficiently detect whether the material has changed.  However, we already sort of have a (inefficient, but effective) solution for this in TextureStage (see #178) that we could just apply here as well: changing the material attributes after such a shader has been generated could call GraphicsStateGuardianBase::mark_rehash_generated_shaders().

In the future, we should replace the material model with one that does not require shader regeneration for such seemingly trivial property changes.

Fixes #370
2018-08-03 21:55:06 +02:00
rdb 0cb763a10a ShaderGenerator: always use generic attr on Linux
48808fe269 disabled this on Linux, but I believe this was an accidental change.
2018-07-26 22:58:15 +02:00
rdb 886e1c2f16 general: fix many compilation warnings in GCC 8 2018-06-19 00:37:28 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
Sam Edwards 7e61891c09 general: Fix more DLL linkage and EXPCL_PANDA_ macros 2018-06-12 16:14:33 -06:00
rdb b88bd99704 Various compiler warning fixes 2018-06-12 12:38:07 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
rdb c08339e8ce ShaderGenerator: fix error with normal map and only ambient light
Closes #331
2018-06-03 22:30:40 +02:00
rdb 21d8c29645 More warning fixes 2018-06-03 06:45:35 -04:00
rdb 9fad3dba60 general: remove macros for compatibility with non-C++11 compilers
Now that we require MSVC 2015, we no longer need all this nonsense, so we can write cleaner code.
2018-05-23 23:33:05 +02:00
deflected 30cf1dbbb1 pgraphnodes: Fixed the type of texture bytes in sceneGraphAnalyzer
- Corrected the type of texture bytes variable as it is possible
        to wrap it around

Signed-off-by: deflected <deflected@users.noreply.github.com>
2018-03-30 14:38:39 +03:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
rdb 319b331553 ShaderGenerator: fix M_modulate_gloss regression
It was mapping the alpha channel of M_modulate_gloss to the glow channel.
2018-03-11 16:40:21 +01:00
rdb 04352e152d ShaderGenerator: fix TextureStage mixup when stages are disabled
This fixes a regression that caused the wrong textures/stage settings to be applied when a texture stage was being optimized out (eg. when a normal map is present while lighting is disabled).
2018-01-26 15:39:30 +01:00
rdb 1cada85e6b ShaderGenerator: fixes for combine alpha blending 2018-01-15 12:20:27 +01:00
rdb 7ee9467f8d shadows: fix shadow buffer creation deadlock in multithreaded pipeline
Fixes #162
2017-12-30 17:47:15 +01:00
rdb 69b3468b2c interrogate: more improvements to seq/map wrappers
Gets rid of properties defined as both MAKE_SEQ_PROPERTY/MAKE_MAP_PROPERTY, which are just a bad idea. Instead, adds a way for map properties to define a separate "keys" interface.

Fixes: #203
2017-11-27 17:29:50 +01:00
rdb 001804113a ShaderGenerator: make colorscale/texture blending match FFP better
A notable change is that the color scale is now applied *before* texture blending, matching the FFP.  If this breaks anything, we might want to add a configuration option for this.
This also implements the remaining combine modes, CM_dot3_rgb and CM_dot3_rgba, and fixes the broken CM_subtract mode (which currently worked the same way as CM_add).

Fixes: #189
2017-11-16 15:58:13 +01:00
rdb dd2806c8bd Mark constructors 'explicit' for which coercion makes no sense 2017-11-06 19:47:38 +01:00
rdb 745b51f10f ShaderGenerator: fix M_blend to match fixed-function pipeline
See panda3d/panda3d#178
2017-11-01 20:20:38 +01:00
rdb 8a35f360bd Fix build error 2017-10-18 12:29:44 +02:00
rdb 410049fd4b Improvements for ShaderGenerator-based programs:
* Disable state munger, which isn't needed
 * Reflect updates to TextureStage properties (Fixes #178)
 * Also respect combine mode and rgb scale changes
 * Allow rehashing and clearing generated shader cache

State munger is now disabled whenever any shader is applied.  Panda assumes that any custom shader will apply color scale by itself.
2017-10-18 11:16:29 +02:00
rdb 0db3d27247 ShaderGenerator: fix updating color of combine stages with CS_constant
This also changes the function of TextureStage::uses_color(), which no longer incorporate TextureStage::involves_color_scale()

Fixes: #177
2017-10-15 17:06:59 +02:00
rdb 65ae1e16bc ShaderGenerator: support multiple normal maps
Uses Reoriented Normal Mapping to blend additional normal maps.

Fixes #156
2017-07-15 20:17:29 +02:00
rdb f79fbf25c3 ShaderGenerator: big overhaul, don't generate more shaders than needed 2017-07-10 21:55:27 +02:00
rdb 9a40febdb9 shadows: fix light buffer not being destructed after light removal
Fixes LP 1672089
2017-07-09 20:36:13 +02:00
rdb 511b0c10e5 ShaderGenerator: don't generate a shader per Material 2017-06-22 13:35:46 +02:00
rdb af57c829d2 ShaderGenerator: reduce combinatoric explosion of shaders
This is done by:
* Not considering the texture pointer when looking up a generated shader, only type
* Not requiring different shaders based on RescaleNormalAttrib
* Not looking at AlphaTestAttrib unless it is going to be relevant

This should dramatically reduce the number of shaders that are being generated for many scenes, especially since the only thing that differs from object to object is often just the texture.

These changes are also necessary to make b781995ef1 more usable, since prepare_scene may see a slightly different state than is encountered at render time due to code in CullResult adding in an AlphaTestAttrib or RescaleNormalAttrib.
2017-06-20 18:45:49 +02:00
rdb b781995ef1 ShaderGenerator: prepare_scene now invokes shader generator.
This also necessarily removes ShaderGenerator's dependency on a host window.
2017-06-20 16:16:30 +02:00
rdb 6f8b379bda Big patch full of performance improvements
This particularly benefits applications with a lot of nodes.
2017-04-03 01:41:23 +02:00
rdb 9d05044a9f shadows: force interocular distance to 0 for shadow cameras 2017-03-23 12:22:34 +01:00
rdb b113d9db55 Fix incorrect type hierarchy of HermiteCurve, PandaNode, ShaderGenerator 2017-02-20 00:32:05 +01:00
rdb da79c28a6c Add RectangleLight class 2016-12-19 23:29:42 +01:00
Sam Edwards 2933b8ed39 general: Fix missing includes. 2016-06-25 19:10:38 -07:00
rdb ce29ae490d Interrogate improvements, more properties, MAKE_SEQ_PROPERTY 2016-05-11 00:16:53 +02:00