summaryrefslogtreecommitdiff
path: root/scene/3d/voxel_light_baker.cpp
AgeCommit message (Collapse)Author
2019-07-03Merge pull request #29988 from NathanWarden/lightmap_hint_sizeRémi Verschelde
Added a fallback size to the lightmap baker in case mesh lightmap hint sizes are 0,0
2019-07-02Updated lightmap baker to dynamically calculate lightmap sizes based on ↵Nathan Warden
surface area.
2019-06-26Some code changed with Clang-Tidyqarmin
2019-04-25Use approximate equallity methods in many placesAaron Franke
2019-02-27Fix -Wsign-compare warnings.marxin
I decided to modify code in a defensive way. Ideally functions like size() or length() should return an unsigned type.
2019-02-22Change MAX for MIN, fixes #26170Juan Linietsky
2019-02-21Fix all -Wtype-limits warnings.marxin
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-01-17Avoid crashing GIProbe bake with broken UV data, closes #25028Juan Linietsky
2019-01-16Appease some CppCheck warns for files in the "scene" directoryMichael Alexsander Silva Dias
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-10-25Repaired mistyped of 'its' on several files.M. Huri
2018-10-19Fixing warnings generated by MSVCDualtagh Murray
Fixes #22684.
2018-10-04Fix more "may be used initialized" warnings from GCC 7Rémi Verschelde
Fixes the following GCC 7 warnings: ``` core/cowdata.h:269:47: warning: 'alloc_size' may be used uninitialized in this function [-Wmaybe-uninitialized] core/error_macros.h:163:26: warning: 'nearest_point' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:1579:5: warning: 'colormap_size' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:1582:12: warning: 'size_height' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:1590:23: warning: 'size_width' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:1599:29: warning: 'pixel_size' may be used uninitialized in this function [-Wmaybe-uninitialized] core/math/face3.cpp:207:15: warning: 'tri_max' may be used uninitialized in this function [-Wmaybe-uninitialized] core/math/face3.cpp:209:15: warning: 'tri_min' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/rasterizer_scene_gles3.cpp:665:22: warning: 'best_used_frame' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/rasterizer_storage_gles3.cpp:865:27: warning: 'blit_target' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/rasterizer_storage_gles3.cpp:980:29: warning: 'blit_target' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::frag_id' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::id' may be used uninitialized in this function [-Wmaybe-uninitialized] drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::vert_id' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/plugins/script_editor_plugin.cpp:1980:31: warning: 'se' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/scene_tree_dock.cpp:840:30: warning: 'new_node' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4259:9: warning: 'a1' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4259:9: warning: 'lll' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4259:9: warning: 'lul' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4260:9: warning: 'a2' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4261:9: warning: 'a3' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4265:3: warning: 'enable_lin' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4294:3: warning: 'enable_ang' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4311:34: warning: 'll' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/spatial_editor_gizmos.cpp:4311:34: warning: 'ul' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1655:47: warning: 'cone_dirs' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1656:73: warning: 'cone_weights' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/gui/texture_progress.cpp:181:6: warning: 'cp' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/gui/texture_progress.cpp:181:6: warning: 'cq' may be used uninitialized in this function [-Wmaybe-uninitialized] servers/physics/shape_sw.cpp:1056:19: warning: 'support_max' may be used uninitialized in this function [-Wmaybe-uninitialized] ```
2018-10-04Fix GCC 8 warnings about potentially unitialized variablesRémi Verschelde
Fixes the following GCC 8 warnings: ``` core/image.cpp:730:44: warning: 'mip1_weight' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:293:20: warning: 'mip2' may be used uninitialized in this function [-Wmaybe-uninitialized] core/image.cpp:293:20: warning: 'mip1' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/audio_stream_preview.cpp:58:19: warning: 'vmax' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/audio_stream_preview.cpp:85:19: warning: 'vmin' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/editor_themes.cpp:306:53: warning: 'preset_contrast' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/plugins/animation_blend_space_2d_editor.cpp:459:27: warning: 'prev_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] editor/plugins/animation_blend_space_2d_editor.cpp:443:27: warning: 'prev_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] main/tests/test_oa_hash_map.cpp:57:29: warning: 'value' may be used uninitialized in this function [-Wmaybe-uninitialized] modules/csg/csg.cpp:764:40: warning: 'max_angle' may be used uninitialized in this function [-Wmaybe-uninitialized] modules/csg/csg_shape.cpp:1945:3: warning: 'face_count' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1593:8: warning: 'cone_aperture' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/3d/voxel_light_baker.cpp:1592:6: warning: 'cone_dir_count' may be used uninitialized in this function [-Wmaybe-uninitialized] scene/animation/animation_blend_space_2d.cpp:471:8: warning: 'mind' may be used uninitialized in this function [-Wmaybe-uninitialized] core/os/memory.cpp:94: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] core/os/memory.cpp:95: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] core/os/memory.cpp:98: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] ```
2018-10-02Many more fixes for GLES2 mobile export. Also added ability to turn on ↵Juan Linietsky
OpenGL debugging on Android export.
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
2018-07-18Style: Format code with clang-format 6.0.1Rémi Verschelde
2018-05-14Fixed some warnings found with Cppcheck.Michael Alexsander Silva Dias
2018-04-21Fixes logically dead code (Coverity)Crazy-P
Fixes reported logically dead codes by Coverity * image.cpp: Doesn't really need any modification. But to remove the bug report then we have to move the MAX call away from the for loop statement. * rasterizer_gles3.cpp: Removes unnecessary elif condition since it is checked earlier in the function * collada.cpp: If stamement never reached due to macro ERR_CONTINUE does the same. * navigation_mesh.cpp: Variables should always be null - however, also checked for the very same condition in their function call. Leaving this for review (whether the function call is necessary or not) * path_editor_plugin.cpp: If cancel is true, then it should restore the edited value to the original provided. http://docs.godotengine.org/en/3.0/classes/class_editorspatialgizmo.html#class-editorspatialgizmo-commit-handle * spatial_editor_gizmos.cpp: the very condition of i >= 3 is predetermined in the if case right before it. Thus case 1 is always '1' and case 2 is always '-1' * grid_map_editor.cpp: Same as above in spatial_editor_gizmos.cpp * voxel_light_baker.cpp: Same as above in spatial_editor_gizmos.cpp * visual_server.cpp: Same as above in spatial_editor_gizmos.cpp * visual_script_expression.cpp: char '-' is already true in the switch case mechanism. Thus it can never reach to default case. * particles.cpp: Case 'PARAM_MAX' is unreachable due to index checking right before the switch execution. * shader_language.cpp: Invalid index is handled in switch default case. `type < TYPE_FLOAT && type > TYPE_VEC4` -> `(type < TYPE_FLOAT || type > TYPE_VEC4`) Fixes the "always false problem" in TODO comment.
2018-01-18Fix typos in code and docs with codespellRémi Verschelde
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-11Restored multiplication by textureJuan Linietsky
2018-01-11Removed extra multiplication in bakerJuan Linietsky
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-12-26Change the rotate function of Spatial to be local, makes more sense. Closes ↵Juan Linietsky
#14569
2017-12-24-Removed OpenMP support, replaced by a custom class.Juan Linietsky
-Disabled Opus, implementation is wrong.
2017-12-20Prevent false sharing in lightbaker RNG stateHein-Pieter van Braam
The previous commit corrected the RNG behavior for the lightbaker but also made it significantly slower on high core count systems. Due to the vector of states being physically close together in RAM we force a cache synchronization across all cores whenever we call for the next random number to be generated. This will create a temporary local copy of the RNG state before entering the loop and then saving it back to the global state when done. This will preserve the per-thread RNG state (and random number quality) while significantly improving performance. On my 16 thread box it saves 3 minutes baking the Sponza scene, bringing performance back in line to before the various RNG fixes were introduced, being slightly faster than the first implementation.
2017-12-20Fix lightmapper rngHein-Pieter van Braam
In our previous attempts to fix the lightmapper we may have inadvertently introduced the same issue we were trying to fix. It appears that rand() will on some platforms introduce a mutex making it slower and on others may have a per-thread state that would need to be initialized with srand() on each thread. This slows down the lightbaking further. This sets up a separate rng state for each OpenMP thread by calling rand() only in the single-threaded part of the code. We then keep a vector of states. I believe this solves our problems.
2017-12-20Correct license headers in main.cpp and voxel_light_baker.cppHein-Pieter van Braam
Sorry for the churn
2017-12-20Fix lightbaker clang-format issue and add license headersHein-Pieter van Braam
2017-12-20Lightbaker: include stdlib.h to fix CI buildsHein-Pieter van Braam
2017-12-19Fix randomness in voxel light baker, closes #14841Juan Linietsky
2017-12-19Fix raytrace lightmap bake biasJuan Linietsky
2017-12-19properly plot normal when bakingJuan Linietsky
2017-12-19Fixed bug where all file dialogs requested thumbnails even if hidden.Juan Linietsky
2017-12-18Added baked light support for gridmaps.Juan Linietsky
2017-12-17Cleanup some #if 0'd codeRémi Verschelde
2017-12-17Merge pull request #14760 from hpvb/add-several-unlikely-macrosRémi Verschelde
Add several unlikely() macros
2017-12-17Merge pull request #14758 from hpvb/optimize-lightbaker-rngRémi Verschelde
Use a more naive RNG for the lightmapper
2017-12-17Add several unlikely() macrosHein-Pieter van Braam
Based off of perf-based prediction misses these seem to be the lowest-hanging fruit for quick (albeit small) improvements. These are based on: * baking a complex lightmap * running platformer 3d * running goltorus
2017-12-17Tweak OpenMP parameters for lightbakerHein-Pieter van Braam
On higher threadcount systems this allows for better utilization. On my 16 thread box CPU use goes from 10 - 11 threads to a steady 15 threads on the Sponza scene. Baking time goes from ~10:00 to ~07:30 for me. On lower threadcount systems I expect some improvement also but likely a little less.
2017-12-17Use a more naive RNG for the lightmapperHein-Pieter van Braam
This speeds up the lightmapper by about 10% with no visible impact. A comparison is up here: https://tmm.cx/nextcloud/s/Log1eAXen1dJzBz AMD Ryzen 7 1700 Eight-Core Processor Sponza scene pcg32 256/256/high 00:10:13 256/256/medium 00:02:50 256/256/low 00:01:11 xorshift 256/256/high 00:09:32 256/256/medium 00:02:34 256/256/low 00:01:05
2017-12-14fix for compiling the new lightmapperMichele Valente
also changed two calls that were ambiguous
2017-12-14-Add lightmapperJuan Linietsky
-Fixes to unwrapper (remove degenerates), makes Thekla not crash -Added optional cancel button in EditorProgress -Added function to force processing of events (needed for cancel button)