Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-26Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
Use function style casts in C++ headers & source.
2022-09-26Cleanup: use ELEM/STR_ELEM/STREQ macrosCampbell Barton
2022-09-26Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8.
2022-09-25BLI: simplify removing elements from containers with predicateJacques Lucke
Previously removing elements based on a predicate was a bit cumbersome, especially for hash tables. Now there is a new `remove_if` method in some data structures which is similar to `std::erase_if`. We could consider adding `blender::erase_if` in the future to more closely mimic the standard library, but for now this is using the api design of the surrounding code is used.
2022-09-25Cleanup: follow C++ type cast style guide in some filesJacques Lucke
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
2022-09-25Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
2022-09-25Cleanup: replace static_casts with functional casts for numeric typesCampbell Barton
2022-09-25Cleanup: use 'u' prefixed integer types for brevity & cast styleCampbell Barton
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
2022-09-25Cleanup: remove redundant double parenthesisCampbell Barton
2022-09-23Cleanup: use lowercase function calls & macros in for CMakeCampbell Barton
This is already the case for most CMake usage. Although some find modules are an exception to this, as they were originally maintained externally they use some different conventions. Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-20Cleanup: quite compiler warningJacques Lucke
Warning: P3204.
2022-09-18Build: fix gtest build flags affecting actual libraryBrecht Van Lommel
Switch to target_ functions to avoid this.
2022-09-17IndexRange: Add new `intersect` methodClément Foucault
Returns a new range, that contains the intersection of the current one with the given range. This is helpful to select a portion of a range without having to deal with all the asserts of other functions. The resulting range being always a valid subrange, it can be used to iterate or copy a part of a vector.
2022-09-12Tests: add tests for leading (relative) slashes for BLI_path_joinCampbell Barton
Also note that leading slashes are kept in the doc-string.
2022-09-09Realtime Compositor: Implement pixelate nodeOmar Emara
This patch implements the pixelate node for the realtime compositor. Differential Revision: https://developer.blender.org/D15662 Reviewed By: Clement Foucault
2022-09-09License headers: use SPDX identifiersCampbell Barton
2022-09-07BLI: new C++ BitVector data structureJacques Lucke
This adds a new `blender::BitVector` data structure that was requested a couple of times. It also replaces usages of `BLI_bitmap` in C++ code. See the comment in `BLI_bit_vector.hh` for more details about the advantages and disadvantages of using a bit-vector and how the new data structure compares to `std::vector<bool>` and `BLI_bitmap`. Differential Revision: https://developer.blender.org/D14006
2022-09-06BLI: Add new `blender::Pool` containerClément Foucault
A `blender::Pool` can construct and destruct elements without reordering. Freed items memory will be reused by next allocations. Elements are allocated in chunks to reduce memory fragmentation and avoid reallocation. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D15894
2022-08-28Cleanup: replace NULL with nullptr for C++ filesCampbell Barton
2022-07-30Fix failing blenlib test from previous commitHarley Acheson
Commit 310be2e37cfb did not update UI_MENU_ARROW_SEP used in tests.
2022-07-29Fix set iterator test failure on macOSJulian Eisel
This is a quite interesting case, where two arguments to a function are evaluated in different order on Apple Clang than on GCC and I guess MSVC. Left a comment on that.
2022-07-28Fix wrong post-increment operators & test for BLI containersJulian Eisel
2022-07-28BLI_math: improve symmetrical values from sin_cos_from_fractionCampbell Barton
When plotting equally distant points around a circle support an extra axis of symmetry so twice as many exact values are repeated than originally added in [0], see code-comments for a detailed explanation. Tests to ensure accuracy and exact symmetry have been added too. Follow up on fix for T87779. [0]: 087f27a52f7857887e90754d87a7a73715ebc3fb
2022-07-21Fix build error in tests binary after previous commitHans Goudey
Also remove an unused include and add a comment, const, use the math namespace.
2022-07-21Cleanup: Remove debug print in testHans Goudey
2022-07-20Curves: Port fillet node to the new data-blockHans Goudey
This commit ports the fillet curves node to the new curves data-block, and moves the fillet node implementation to the geometry module to help separate the implementation from the node. The changes are similar to the subdivide node or resample node. I've resused common utilities where it makes sense, though some things like the iteration over attributes can be generalized further. The node is now multi-threaded per-curve and inside each curve, and some buffers are reused per curve to avoid many allocations. The code is more explicit now, and though there is more boilerplate to pass around many spans, the more complex logic should be more readable. Differential Revision: https://developer.blender.org/D15346
2022-07-15BLI_bitmap: ability to declare by-value, and function to find lowest unset bitAras Pranckevicius
In preparation for a larger change (D14162), some BLI_bitmap functionality that could be submitted separately: - Ability to declare a fixed size bitmap by-value, without extra memory allocation: BLI_BITMAP_DECLARE - Function to find the index of lowest unset bit: BLI_bitmap_find_first_unset - Test coverage of the above. Reviewed By: Campbell Barton, Bastien Montagne Differential Revision: https://developer.blender.org/D15454
2022-07-07BLI: make some spans default constructibleJacques Lucke
`GSpan` and spans based on virtual arrays were not default constructible before, which made them hard to use sometimes. It's generally fine for spans to be empty. The main thing the keep in mind is that the type pointer in `GSpan` may be null now. Generally, code receiving spans as input can assume that the type is not-null, but sometimes that may be valid. The old #type() method that returned a reference to the type still exists. It asserts when the type is null.
2022-07-02BLI: refactor length parameterizationJacques Lucke
This refactor had two main goals: * Simplify the sampling code by using an algorithm with fewer special cases. * Generalize the sampling to support non-sorted samples. The `SampleSegmentHint` optimization was inspired by `ValueAccessor` from OpenVDB and improves performance 2x in my test cases. Differential Revision: https://developer.blender.org/D15348
2022-07-02BLI: improve span access to virtual arraysJacques Lucke
* Make the class names more consistent. * Implement missing move-constructors and assignment-operators.
2022-06-29BLI: add Vector.append_and_get_index with rvalue parameterJacques Lucke
This makes it possible to use this method with `std::unique_ptr`.
2022-06-23Cleanup: Clang tidyHans Goudey
Mainly duplicate includes and else after return.
2022-06-21Fix T99033: KDTree deduplication can erase valuesChris Blackbourn
Differential Revision: https://developer.blender.org/D15220
2022-06-15math: improve accuracy of Linear->sRGB conversion SIMD pathAras Pranckevicius
srgb_to_linearrgb_v3_v3 is using an approximation of powf that is SIMD. However, while the accuracy of it is ok, a larger issue is that it produces different results on Intel compared to ARM architectures. On ARM (e.g. AppleSilicon), the result of the SIMD code path is much closer to the reference implementation. This seems to be because of _mm_rsqrt_ps usage in _bli_math_fastpow512. The ARM/NEON code path emulates inverse square root with a combination of vrsqrteq_f32 followed by two Newton-Raphson iterations, because blender uses the SSE2NEON_PRECISE_SQRT define. This commit adds similar NR iterations to the "actual SSE" code path as well. Max error of srgb->linear->srgb conversion roundtrip goes from 0.000211 down to about 0.000062. Reviewed By: Sergey Sharybin Differential Revision: https://developer.blender.org/D15193
2022-06-08Fix: Incorrect curves and pointcloud bounding boxesHans Goudey
The generic bounds utility used an incorrect initial value. The value cannot be zero-initialized, because that breaks the case where all values are greater than zero.
2022-06-07BLI: Math: Add description and test to `ceil_to_multiple` and `divide_ceil`Clément Foucault
I took the decision to assert on unexpected value as the behavior of these functions are not consistent across the whole integer domain.
2022-05-17Cleanup: Use `switch` and `BLI_assert_unreachable()` more.Bastien Montagne
Replace some `if/else if` chains by proper `switch` statement. Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-11Cleanup: rename BLI_str_format_attribute_domain_sizeCampbell Barton
This is useful without any functionality specific to attribute domains, rename to `BLI_str_format_decimal_unit` to follow naming of a similar function `BLI_str_format_byte_unit`.
2022-05-11Cleanup: spelling in comments/stringsCampbell Barton
D14918 from @linux_dr with some other changes included.
2022-05-11Cleanup: use 'num' / 'size' suffix instead of 'sz'Campbell Barton
GPU code used `sz` as an abbreviation for size, as well as a few other places. Use size where this represents a size in bytes, see: T85728.
2022-05-06BLI: Add float3x3Omar Emara
This patch adds a float3x3 class that represents a 3x3 matrix. The class can be used to represent a 2D affine transformation stored in a 3x3 matrix in column major order. The class provides various constructors and processing methods, which utilizes the existing mat3 utilities in BLI. Corresponding tests were also added. This is needed by the upcoming viewport compositor to represent domain transformations. Reviewed By: fclem Differential Revision: https://developer.blender.org/D14687
2022-04-25BLI: optimize constructing new virtual arrayJacques Lucke
Differential Revision: https://developer.blender.org/D14745
2022-04-15Fix: Apply tilt in curves data-block normals calculationHans Goudey
The ported normal calculation from ceed37fc5cbb466a0 neglected to use the tilt attribute to rotate the normals around the tangents. This commit adds that behavior back, adding a new math header file to avoid duplicating the rotation function for normalized axes. Differential Revision: https://developer.blender.org/D14655
2022-04-08Add a utility for sampling segment indices and factors from arbitraryHans Goudey
lengths along a set of points. This can be used for the sample curves node, or finding new points along a curve when extending or shrinking it. This commit uses it in the snake hook brush as an example. The logic is similar to the uniform length sampling, but the next sample length is retrieved from the input instead of multiplication. For the sample node in the future, though this sort of sampling can be potentially done more efficiently for specific curve types besides poly curves, it's simpler, at least as a start, to work on a set of evaluated points that can be treated like a poly curve. Differential Revision: https://developer.blender.org/D14571
2022-04-07BLI: add missing materialize methods for virtual arraysJacques Lucke
This does two things: * Introduce new `materialize_compressed` methods. Those are used when the dst array should not have any gaps. * Add materialize methods in various classes where they were missing (and therefore caused overhead, because slower fallbacks had to be used).
2022-04-07BLI: add CPPType utility to copy elements to a shorter arrayJacques Lucke
2022-03-30Cleanup: use "num" as a suffix in: source/blender/blenlibCampbell Barton
Also replace "num" with: - "number" when it's not used to denote the number of items. - "digits" when digits in a string are being manipulated.
2022-03-30Curves: Add length cache, length paramerterize utilityHans Goudey
This commit adds calculation of lengths along the curve for each evaluated point. This is used for sampling, resampling, the "curve parameter" node, and potentially more places in the future. This commit also includes a utility for calculation of uniform samples in blenlib. It can find evenlyspaced samples along a sequence of points and use linear interpolation to move data from those points to the samples. Making the utility more general aligns better with the more functional approach of the new curves code and makes the behavior available elsewhere. A "color math" header is added to allow very basic interpolation between two colors in the `blender::math` namespace. Differential Revision: https://developer.blender.org/D14382
2022-03-29BLI: support value initialization in CPPTypeJacques Lucke
Value initialization differs from default-construction in that it also zero-initializes trivial types.
2022-03-25BLI: Adjust interpolation to support integers, other tweaksHans Goudey
In order to allow interpolation of integers with a float, add a separate template parameter for the factor and multiplication types. Also move some helper constexpr variables to the "base" header (reversing the dependency to "base" -> "vector"). This also adds a distance function for scalar types, which is helpful to allow sharing code between vectors and basic types. Differential Revision: https://developer.blender.org/D14446