Commit Graph

82 Commits

Author SHA1 Message Date
glassmancody.info 1e52ca2b64 properly initialize light settings 2021-08-01 23:46:45 -07:00
jvoisin 7f4f2c042e Use sizeof(GLfloat) instead of sizeof(GL_FLOAT)
GL_FLOAT is an enum, with the value 0x1406, while GLFloat is the actual type.
Source: https://www.khronos.org/opengl/wiki/OpenGL_Type
2021-06-04 23:21:26 +02:00
elsid d4f28ac979
Avoid resetting buffer object when configuring light buffer layout
Otherwise this casues RaceSelectionPreview to have no light until first change.
2021-05-28 10:46:42 +02:00
Andrei Kortunov 11c57978b6 Fix crashes on exit in the LightManager (bug #6044) 2021-05-17 13:01:15 +04:00
Andrei Kortunov c54ef55ebb Revert "Replace raw pointer by observer_ptr to avoid dangling pointer dereferencing"
This reverts commit 5373cf1cd5.
2021-05-17 12:40:55 +04:00
elsid d520b440aa
Copy LightBuffer data into a new object when changing layout
Before this change LightBuffer copy constructor copied only mData pointer into
a new object. Then memcpy was applied to an overlapping source and destination
that is UB.

Replace configureLayout function by a special constructor. That copies all
mData values and a pointer to a buffer object into a newly allocated object.
2021-05-16 22:37:31 +02:00
elsid 5373cf1cd5
Replace raw pointer by observer_ptr to avoid dangling pointer dereferencing
When game exit is requests when initial loading screen is active LightManager
can be destructed in the main thread before LightManagerStateAttribute::apply
is completed by different thread. Given that it uses raw pointer at some point
it becomes dangling because object is destructed this leads to UB and eventual
SIGSEGV.
2021-05-15 15:23:28 +02:00
glassmancody.info 9f314d1d6f Fix ToggleBorders 2021-04-29 12:11:49 -07:00
Bret Curtis 50d6cd2a34
Merge pull request #3070 from akortunov/coverity
Fix an another portion of Coverity warnings
2021-04-20 07:33:03 +02:00
Andrei Kortunov 7d5c5f8a24 Do not assign negative values to unsigned variables 2021-04-19 16:08:19 +04:00
Andrei Kortunov 987b231fdd Fix an another portion of Coverity warnings 2021-04-18 07:09:44 +04:00
psi29a d0883f9a0d Merge branch 'light_settings_tweak' into 'master'
Lighting patch

Closes #5957 and #5959

See merge request OpenMW/openmw!752
2021-04-16 19:47:26 +00:00
glassmancody.info 16856d45c5 Lighting Patch
Fixes build errors with older OSG builds and some issues with 'shared' layout.
Bring back ambient in inventory through lightmodel instead of sun ambient, mirrors scene ambient/sunlight relationship.
Forces shaders when certain lighting methods are enabled and finalize settings.
Correctly override sun for localmap.
2021-04-16 11:55:40 -07:00
Andrei Kortunov 0c7ddd3938 Remove redundant qualifiers 2021-04-14 09:02:20 +04:00
Andrei Kortunov bce6effe95 Fix uninitialized variables in the LightManager 2021-04-14 08:20:23 +04:00
glassmancody.info 531a6e1979 Code review fixes, remove implicit GLSL casts 2021-04-13 11:09:54 -07:00
glassmancody.info 92033bca64 Fixed error in calculating viewspace sun dir, minor cleanup 2021-04-13 11:09:49 -07:00
glassmancody.info 9e80091aff clear up force shaders and make it less convoluted 2021-04-13 11:09:49 -07:00
glassmancody.info 8ce65232ff fix race condition with sun uniform 2021-04-13 11:09:49 -07:00
glassmancody.info d4e7d25d14 Make life not suck for whoever wants to edit lighting shaders 2021-04-13 11:09:49 -07:00
glassmancody.info eecb9886a9 Shader cleanup, fix indicies 2021-04-13 11:09:49 -07:00
glassmancody.info 4ba473b684 Finalize settings, torch fix 2021-04-13 11:09:49 -07:00
glassmancody.info 71c30a31df in-game settings, some require restart 2021-04-13 11:09:49 -07:00
glassmancody.info 3d713e8602 Fix incorrect minimum ambient 2021-04-13 11:09:49 -07:00
glassmancody.info d195602a9d Switch to shared layout, some rewording 2021-04-13 11:09:35 -07:00
glassmancody.info 690995988b More formatting, OpenCS cells are unbroken 2021-04-13 11:09:35 -07:00
glassmancody.info 328ec85757 Code review cleanup, add setting documentation 2021-04-13 11:09:35 -07:00
glassmancody.info 05a5cee132 Brighter point lights and light fade 2021-04-13 11:09:35 -07:00
glassmancody.info 43ac32921c Rewrite, support different lighting methods 2021-04-13 11:09:19 -07:00
glassmancody.info 9d9074c244 Add shared UBO 2021-04-13 11:07:48 -07:00
glassmancody.info dda735c54a initial commit 2021-04-13 11:06:16 -07:00
Andrei Kortunov 8084a336b5 Replace zeroes and nulls by nullptrs 2020-11-29 11:14:07 +04:00
Alexei Dobrohotov 53f91a3aa5
Merge pull request #3018 from akortunov/emplace
Use emplace_back instead of push_back
2020-11-01 01:58:56 +03:00
Andrei Kortunov 065ed5138e Use emplace_back instead of push_back 2020-10-18 10:27:35 +04:00
Andrei Kortunov 8ca3c3b123 Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
bzzt 1a65adacdd Do not allocate dummy LightStateAttribute's for every stateset 2019-03-30 21:36:08 +04:00
Andrei Kortunov b466bfee40 Enable light sources directly to avoid virtual calls 2019-03-21 10:27:50 +04:00
bzzt 8c649f05e6 Don't reallocate light list vector unnecessarily 2019-02-27 00:12:14 +03:00
AnyOldName3 4438ab4493 Use CullVisitor traversal mask for light manager. 2019-01-24 22:42:23 +00:00
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 2018-10-09 10:21:12 +04:00
Bret Curtis f0b21cca22 use own inline hash_combine function 2017-06-12 00:32:28 +02:00
Bret Curtis 154d7cffa2 replace and purge boost::function 2017-06-09 19:08:53 +02:00
scrawl 34130fc5cc Fix handling in LightListCallback when the node is not a Group 2017-03-14 19:27:55 +01:00
scrawl b78a9f89af Refactor LightListCallback to allow for integration in custom Drawables. 2017-03-14 19:27:55 +01:00
scrawl 4aa40d16bc Increase the importance of light radius when sorting lights (Bug #2759) 2017-02-21 04:32:59 +01:00
scrawl 67e4a7e37b Change some osg::clone's to direct copy constructor to avoid dynamic_cast overhead 2017-02-09 04:51:20 +01:00
scrawl 839928e210 Fix light data being reset for the wrong light 2017-02-09 02:46:30 +01:00
scrawl c00532d82d Add LightStateCache to avoid redundantly setting the same gl_Light
Normally, osg::State would do this for us (via lastAppliedAttribute), but since we're using a custom StateAttribute to apply all lights at once, we have to track ourselves.

Further reduction of GL calls in a typical scene by ~2%
2017-02-07 23:37:57 +01:00
scrawl 4d4dc1b9c1 Add specialized DisableLight state attribute for more efficient undoing of light state
Seems to reduce # of GL calls by 10-15% in a typical scene.
2017-02-07 23:01:36 +01:00
scrawl 34deb6e7b1 Add 'showSceneGraph' command to export the scene or a particular object to .osgt for debugging purposes 2017-02-01 06:00:14 +01:00