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-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:float2) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the blender::math namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: float3::reflect()). Upsides: - Still support .x, .y, .z, .w for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call len_squared_v3v3 in math::length_squared() and call it a day. - Type cast does not work with the template version of the math:: vector functions. Meaning you need to manually cast float * and (float *)[3] to float3 for the function calls. i.e: math::distance_squared(float3(nearest.co), positions[i]); - Some parts might loose in readability: float3::dot(v1.normalized(), v2.normalized()) becoming math::dot(math::normalize(v1), math::normalize(v2)) But I propose, when appropriate, to use using namespace blender::math; on function local or file scope to increase readability. dot(normalize(v1), normalize(v2)) Consideration: - Include back .length() method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches delaunay_2d.cc and the intersection code. I would like to know @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-12Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2021-12-16Cleanup: spellingCampbell Barton
2021-12-15Cleanup: Use pixel in stead of texels in naming.Jeroen Bakker
2021-12-15Images: 1,2,3 channel support for transform function.Jeroen Bakker
Added support for 1, 2, 3 float channel source images. Destination images must still be 4 channels.
2021-12-14Cleanup: resolve parameter mis-matches in doc-stringsCampbell Barton
Renamed or removed parameters which no longer exist.
2021-12-10Fix Crash: Loading Huge Images.Jeroen Bakker
When loading huge images (30k) blender crashed with a buffer overflow. The reason is that determine the length of a buffer was done in 32bit precision and afterwards stored in 64 bit precision. This patch adds a new function to do the correct calculation in 64bit. It should be added to other sections in blender as well. But that should be tested on a per case situation.
2021-12-09Cleanup: spelling in commentsCampbell Barton
2021-12-09Cleanup: move public doc-strings into headers for 'imbuf'Campbell Barton
Ref T92709
2021-12-08Cleanup: moved IMB_transform to transform.cc.Jeroen Bakker
Part of a refactoring to make IMB_transform more generic to reduce unneeded branching.
2021-12-03ImBuf: Made Wrapping and Cropping optional in IMB_transform.Jeroen Bakker
`IMB_transform` is used in VSE. It had a required crop parameter for cropping the source buffer. This is not always needed. In the image engine we want to use the use the `IMB_transform` with wrap repeat. Both options are mutual exclusive and due to performance reasons the wrap repeat is only available when performing a nearest interpolation.
2021-10-16Remove math for 2D affine transformRichard Antalik
Commit e1665c3d3190 added math to do 2D affine transformations with 3x3 matrices, but these matrices are also used for 3D transformations. Remove added functions and use 4x4 matrices for 2D transformation. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D12510
2021-09-06ImBuf: add IMB_allocFromBufferOwn that takes ownership of the bufferCampbell Barton
Avoids duplicating the image buffer when saving thumbnails.
2021-08-16VSE: Fix audaspace not reading ffmpeg files with start offset correctlySebastian Parborg
The duration and start time for audio strips were not correctly read in audaspace. Some video files have a "lead in" section of audio that plays before the video starts playing back. Before this patch, we would play this lead in audio at the same time as the video started and thus the audio would not be in sync anymore. Now the lead in audio is cut off and the duration should be correctly calculated with this in mind. If the audio starts after the video, the audio strip is shifted to account for this, but it will also lead to cut off audio which might not be wanted. However we don't have a simple way to solve this at this point. Differential Revision: http://developer.blender.org/D11917
2021-07-16Cleanup: sort struct declarationsCampbell Barton
2021-06-24Cleanup: comment blocks, trailing space in commentsCampbell Barton
2021-06-11Performance: Use parallel range for ImBuf scanline processor.Jeroen Bakker
Scanline processor did its own heurestic what didn't scale well when having a multiple cores. In stead of using our own code this patch will leave it to TBB to determine how to split the scanlines over the available threads. Performance of the IMB_transform before this change was 0.002123s, with this change 0.001601s. This change increases performance in other areas as well including color management conversions. Reviewed By: zeddb Differential Revision: https://developer.blender.org/D11578
2021-06-11Sequencer: Transform ImBuf Processor.Jeroen Bakker
Inside the sequencer the cropping and transform of images/buffers were implemented locally. This reduced the optimizations that a compiler could do and added confusing code styles. This patch adds `IMB_transform` to reduce the confusion and increases compiler optimizations as more code can be inlined and we can keep track of indices inside the inner loop. This increases end-user performance by 30% when playing back aa video in VSE. Reviewed By: ISS, zeddb Differential Revision: https://developer.blender.org/D11549
2021-06-05FFmpeg: Fix seeking not returning the correct frame when not using TC indexSebastian Parborg
Fixed the logic for seeking in ffmpeg video files. The main fix is that we now apply a small offset in ffmpeg_get_seek_pos to make sure we don't get the frame in front of the seek position when seeking backward. The rest of the changes is general cleanup and untangling code. Reviewed By: Richard Antalik Differential Revision: http://developer.blender.org/D11492
2021-02-11Cleanup: clang-format, spellingCampbell Barton
2021-02-09Fix T81206: Do not limit gl texture size in image editorJeroen Bakker
This patch will show textures in the image editor with the maximum available resolution determined by the GPU Hardware/Driver. Currently the size is limited by the user preference texture size limit. An image user can set the `IMA_SHOW_MAX_RESOLUTION` flag to request gpu textures in the max supported resolution. When this flag isn't set the gpu texture is limited by the user preference setting. When the gl resolution limit is disabled the GPU texture is always created for the max supported resolution. Reviewed By: Clément Foucault Maniphest Tasks: T81206 Differential Revision: https://developer.blender.org/D9160
2020-12-16VSE: Improve motion-picture workflowRichard Antalik
This commit resolves problem introduced in e1665c3d3190 - it was difficult to import media at their original resolution. This is done by using original resolution as reference for scale. All crop and strip transform values and their animation is converted form old files. To make both workflows easy to use, sequencer tool settings have been created with preset for preffered scaling method. This setting is in sequencer timeline header and add image or movie strip operator properties. Two new operators have been added: `sequencer.strip_transform_fit` operator with 3 options: Scale To Fit, Scale to Fill and Stretch To Fill. Operator can fail if strip image or video is not loaded currently, this case should be either sanitized or data loaded on demand. `sequencer.strip_transform_clear` operator with 4 options: Clear position, scale, rotation and all (previous 3 options combined). Reviewed By: sergey, fsiddi Differential Revision: https://developer.blender.org/D9582
2020-11-12Cleanup: clang-tidy, remove invalid commentsCampbell Barton
2020-11-11Cleanup: use 'filepath' instead of 'name' for ImBuf utilitiesCampbell Barton
2020-11-11Cleanup: use bool for imbuf save callbacksCampbell Barton
2020-11-10ImBuf: support detecting the file format from in-memory imagesCampbell Barton
Add `IMB_ispic_type_from_memory` so we can detect the file format of in-memory images. This removes `is_a_filepath` callback and uses a magic check for photo-shop files that's compatible with OIIO. Even though OIIO doesn't support packed images, we can still use the file magic for detecting the format. This change allows D9500 (a fix for unpacking images), to be implemented without a significant performance penalty, although the actual performance cost would depend heavily on the blend file. Reviewed By: dfelinto, sergey Ref D9517
2020-11-03VSE: Media transform redesignRichard Antalik
This patch changes behavior of strip transform and crop feature. Purpose of this change is to allow display arbitrary portion of input image, simplify user interface and workflow. Offset and Crop values in old files are converted in versioning. Offset animation is also converted. Crop animation and animation of crop or offset enable properties is not taken into account Changes in behavior and interface: - If image is added to timeline it is scaled to fit inside preview area while maintaining aspect ratio. Image is centered. This is considered as a baseline for further transformation. - Scale and rotation was added, so it is possible to transform image at it's original resolution. - Crop will not affect image transformation (does not move image). - Values of Crop and Transform Position are in pixels, these values are corrected if preview is fraction of project resolution. - Transform and Mirror panel has been removed and new Transform panel and Crop panel is moved to Adjust panel. Mirror is now part of new Transform panel. Technical changes: - Preprocessing stage must work on duplicated image, because original is cached. Previously Crop and Offset could run at once and required only one duplication of image. This is not the case with new algorithms, so duplication on demand is implemented. Transformation can read original image and will output new image that is safe to modify. It should be possible to add crop step to transform algorithm, so that Crop won't require previous duplication though. - Use Crop and Use Translation checkboxes were removed. Individual values are compared to default values to check if image needs to be processed. In case of transform this will be done also if resolution of source. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8393
2020-11-02Revert "VSE: Media transform redesign"Richard Antalik
This reverts commit 0277579b2850f0ba097741ca22eb8ae9ccd9bcea. This commit caused build errors on Linux.
2020-11-02VSE: Media transform redesignRichard Antalik
This patch changes behavior of strip transform and crop feature. Purpose of this change is to allow display arbitrary portion of input image, simplify user interface and workflow. Offset and Crop values in old files are converted in versioning. Offset animation is also converted. Crop animation and animation of crop or offset enable properties is not taken into account Changes in behavior and interface: - If image is added to timeline it is scaled to fit inside preview area while maintaining aspect ratio. Image is centered. This is considered as a baseline for further transformation. - Scale and rotation was added, so it is possible to transform image at it's original resolution. - Crop will not affect image transformation (does not move image). - Values of Crop and Transform Position are in pixels, these values are corrected if preview is fraction of project resolution. - Transform and Mirror panel has been removed and new Transform panel and Crop panel is moved to Adjust panel. Mirror is now part of new Transform panel. Technical changes: - Preprocessing stage must work on duplicated image, because original is cached. Previously Crop and Offset could run at once and required only one duplication of image. This is not the case with new algorithms, so duplication on demand is implemented. Transformation can read original image and will output new image that is safe to modify. It should be possible to add crop step to transform algorithm, so that Crop won't require previous duplication though. - Use Crop and Use Translation checkboxes were removed. Individual values are compared to default values to check if image needs to be processed. In case of transform this will be done also if resolution of source. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8393
2020-09-05GPUTexture: Change texture creation APIClément Foucault
This is to modernize the API: - Add meaningful name to all textures (except DRW textures). - Remove unused err_out argument: only used for offscreen python. - Add mipmap count to creation functions for future changes. - Clarify the data usage in creation functions. This is a cleanup commit, there is no functional change. # Conflicts: # source/blender/gpu/GPU_texture.h
2020-09-04Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fixSebastian Parborg
No functional changes
2020-08-07Merge branch 'blender-v2.90-release' into masterJacques Lucke
2020-08-07Code Style: use "#pragma once" in source directoryJacques Lucke
This replaces header include guards with `#pragma once`. A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`), because they are used in other places. This patch has been generated by P1561 followed by `make format`. Differential Revision: https://developer.blender.org/D8466
2020-07-30IMB: Refactor util_gpu.c to not expose enum gettersClément Foucault
This was causing compiler error on MSVC and is not a good idea in general.
2020-07-30Cleanup: Split gpu_texture_image.c into BKE and IMB modulesClément Foucault
This is in order to disolve GPU_draw.h into more meaningful code blocks. All the Image related function are in `image_gpu.c`. All the MovieClip related function are in `movieclip.c`. The IMB module now has a connection with GPU. This is not strickly necessary and the code could be move to `image_gpu.c` if needed. The Image garbage collection is also ported to `image_gpu.c`.
2020-07-19Cleanup: spellingCampbell Barton
2020-07-13VSE: Python API, allow creation of VSE Movie strips with missing fileSybren A. Stüvel
It was already possible to create Sound and Image strips that reference non-existing files. Now it's also possible to create Movie strips referencing missing files via the Python API call `Sequences.new_movie()`. In this case, the duration of the strip will be set to 1 frame. Note that this commit does not change anything in the user interface. The Python API of the `MovieStrip` class is extended with a function `reload_if_needed()`. This function only performs disk I/O if the movie strip cannot produce frames, that is either when its filepath points to a non-existing file, or when the video sequence editor has not been shown yet (for example because it is in an inactive workspace). This allows for the following: ``` import bpy scene = bpy.context.scene vse = scene.sequence_editor_create() filepath = bpy.path.abspath('//demo.mkv') strip = vse.sequences.new_movie("movie", filepath, channel=2, frame_start=47, file_must_exist=False) strip.frame_final_end = 327 ``` This will create a new movie strip, even when `demo.mkv` does not exist. Once `demo.mkv` has appeared at the expected location, either `strip.reload_if_needed()` or `strip.filepath = strip.filepath` will load it. Differential Revision: https://developer.blender.org/D8257 Reviewed By: Sergey, ISS
2020-07-13Clang Tidy: enable readability-non-const-parameter warningJacques Lucke
Clang Tidy reported a couple of false positives. I disabled those `NOLINTNEXTLINE`. Differential Revision: https://developer.blender.org/D8199
2020-03-09GPencil: Refactor of Draw Engine, Vertex Paint and all internal functionsAntonio Vazquez
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes. Also, a huge code cleanup has been done at all levels. Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development. Differential Revision: https://developer.blender.org/D6293
2020-03-02Cleanup: make remaining imbuf headers work in C++Jacques Lucke
2019-10-15Fix image undo restoring float/byte tiles into the wrong buffer typeCampbell Barton
This also resolves the (unlikely) issue of undo having uninitialized zbuf data, now it's cleared instead.
2019-10-01Image: support storing full image buffers for each undo stepCampbell Barton
Update image undo to store buffers for each step: - Undo buffers share tiles to avoid using too much memory. - Undo support for different sized buffers allowing operations such as crop or resize. - Paint tiles have been split into separate API/storage. - Painting speed wont be impacted significantly since storing the extra tiles is done after the stroke & only for the first undo step. Resolves T61263, see D5939 for details.
2019-09-25Cleanup: use const for image blending functionsCampbell Barton
2019-08-27Workbench: Specular Highlighting for MatCapsJeroen Bakker
With Blender 2.80 we introduced a more flexible matcap system. One change we did was to multiply the matcap with the base color that was shaded. As matcaps contains diffuse and specular lighting in a single texture this lead to rendering artifacts. Artists were complaining that everything looked to metalic. We now support a separate `diffuse` and `specular` pass for matcaps. `shaded_color = diffuse_light * base_color + specular_light` For matcaps to support this feature they need to be multilayer openexr files with 2 renderpasses (named `diffuse` and `specular`). In the future we can change this to first pass/second pass in stead of this naming convention. Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D5335
2019-08-16Cleanup: spellingCampbell Barton
2019-08-01Cleanup: misc spelling fixes in variable names & definesCampbell Barton
T68045 by @luzpaz