summaryrefslogtreecommitdiff
path: root/scene/resources/texture.cpp
AgeCommit message (Collapse)Author
2022-01-15Fix AtlasTexture nestingkleonc
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-09Replace String comparisons with "", String() to is_empty()Nathan Franke
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
2021-11-08Merge pull request #54715 from goostengine/gradient-texture-1d-renameYuri Roubinsky
2021-11-07Remove redundant texture flag setters/getters for `CameraTexture`Aaron Record
2021-11-07Rename `GradientTexture` to `GradientTexture1D`Andrii Doroshenko (Xrayez)
1. Explicit and unambiguous when comparing to `GradientTexture2D` 2. Consistent with other class names where 1D is used in the engine.
2021-11-01Fix memory leak when using CurveTexture.set_texture_modeHaoyu Qiu
2021-10-12Add GradientTexture2DHendrik Brucker
Co-authored-by: Mariano Javier Suligoy <marianognu.easyrpg@gmail.com> Co-authored-by: Andrii Doroshenko <xrayez@gmail.com>
2021-09-30Fix AtlasTexture get_data() crashboruok
2021-09-28Merge pull request #53180 from boruok/4.0-fix-atlas-texture-return-nullRémi Verschelde
2021-09-284.0 fix atlas texture return nullboruok
2021-09-14Remove unused ImageTexture functionsHaoyu Qiu
* `_resource_path_changed()` does nothing * `_reload_hook()` has been unused since the beginning of GLES3 renderer
2021-08-13Add an `use_hdr` property to GradientTexture to allow storing HDR colorsHugo Locurcio
This is disabled by default to save some memory and preserve the existing behavior of clamping colors.
2021-08-13Add placeholder textures to ensure CameraTexture / CameraFeed always have ↵bruvzg
valid RIDs.
2021-07-29Fix a crash when trying to load a WebP StreamTexture2DYuri Sizov
2021-07-18Optimize StringName usagereduz
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
2021-07-14Rename Curve3Texture to CurveXYZTextureRémi Verschelde
Neither name is a perfect match but `Curve3Texture` looked too similar to `CurveTexture` and `Curve3D`, which made things confusing when picking a texture type or browsing the API reference.
2021-07-07Tweak the GradientTexture property hint to follow CurveTextureHugo Locurcio
This prevents setting too large values and crashing the editor. Very low values are also no longer allowed since they are generally not detailed enough to represent complex gradients, leading to confusion.
2021-07-03Merge pull request #50054 from reduz/curve-texture-3dRémi Verschelde
Implement Curve3Texture
2021-07-03Implement Curve3Texturereduz
* This was required by users in some scenarios, such as animating individual axes over time with a single texture. * Examples: Shaders, Particles, etc. * CurveTexture now defaults to RGB, can be changed to Red if needed, this allows to freely exchange them.
2021-07-01Use PROPERTY_USAGE_NONE instead of 0 for no property usageAaron Franke
Also use const more often.
2021-07-01Clean up RenderingServer and its bindingsreduz
* Rewrote bindings for RenderingServer. * They are now all up to date. * Several unused methods and deprecated features were cleaned up.
2021-06-24Merge pull request #49583 from timothyqiu/texture-crashRémi Verschelde
Fix crash when freeing GradientTexture and NoiseTexture
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-17Add PROPERTY_USAGE_NONE and use itAaron Franke
2021-06-14Fix crash when freeing GradientTexture and NoiseTextureHaoyu Qiu
2021-06-11Implement lossless WebP encodingMorris Tabor
2021-05-25Fix some warnings raised by GCC-11.1jfons
2021-05-17Make all file access 64-bit (uint64_t)Pedro J. Estébanez
This changes the types of a big number of variables. General rules: - Using `uint64_t` in general. We also considered `int64_t` but eventually settled on keeping it unsigned, which is also closer to what one would expect with `size_t`/`off_t`. - We only keep `int64_t` for `seek_end` (takes a negative offset from the end) and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means we only need to guard against passing negative values in `core_bind.cpp`. - Using `uint32_t` integers for concepts not needing such a huge range, like pages, blocks, etc. In addition: - Improve usage of integer types in some related places; namely, `DirAccess`, core binds. Note: - On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for big files on 32-bit Windows builds made with that toolchain. We might add a workaround. Fixes #44363. Fixes godotengine/godot-proposals#400. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-04-28Remove obsolete LargeTexture, it's no longer useful since 3.xRémi Verschelde
It existed in early Godot releases to allow working around hardware limitations on max texture sizes (e.g. hardware limits of 1024x1024 pixels). Nowadays the max texture size supported natively by Godot is 16384x16384, and even low end mobile hardware should support at least 4096x4096. The LargeTexture implementation is basically just an array with offsets, sizes and textures and should be easy to replicate with a custom Texture resource if needed - solving most of its bugs on the way as the implementation removed here has various unimplemented or incomplete methods.
2021-04-27Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde
We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
2021-03-28Rename Texture.get_data() to get_image()Marcel Admiraal
2021-03-03Fix crash trying to destroy an ImageTexture object containing a null texturePedro Rodrigues
The problem happened when `ImageTexture::create_from_image` was called with an empty image. In this situation an RID was allocated despite the texture being null. The destructor would then crash trying to acess this null texture. Fixes #46274
2021-02-11Improve resource load cachereduz
-Added a new method in Resource: reset_state , used for reloading the same resource from disk -Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type) -Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-10Removed _change_notifyreduz
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap. -For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed() -Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-09Initialize class variables with default values in scene/ [2/2]Rafał Mikrut
2021-01-19Modernize RWLockPedro J. Estébanez
- Based on C++14's `shared_time_mutex` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed - Simpler for `NO_THREADS`
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-19Rename Rect2 and Rect2i clip() to intersection()Marcel Admiraal
2020-11-17Describe `ImageTexture`, `Image` creation and usageAndrii Doroshenko (Xrayez)
2020-11-12Improve error messages related to failing to open filesNick Swoboda
2020-10-26Merge pull request #43075 from Xrayez/color-ramp-to-gradientRémi Verschelde
Fixup `ColorRamp` to `Gradient` renames
2020-10-25Fixup `ColorRamp` to `Gradient` renamesAndrii Doroshenko (Xrayez)
2020-10-24Refactored 2D shader and lighting systemreduz
-Removed normal/specular properties from nodes -Create CanvasTexture, which can contain normal/specular channels -Refactored, optimized and simplified 2D shaders -Use atlas for light textures. -Use a shadow atlas for shadow textures. -Use both items aboves to make light rendering stateless (faster). -Reorganized uniform sets for more efficiency.
2020-10-18Refactor MethodBind to use variadic templatesreduz
Removed make_binders and the old style generated binders.
2020-09-09Implement 3D textures as import and resource format.reduz
2020-07-21Fix spelling & grammar in comments, docs, and messagesAndy Maloney
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.