Commit Graph

29 Commits

Author SHA1 Message Date
Brecht Van Lommel
4786fbe774 Refactor: Remove extern "C" from most headers
The only remaining code in source/blender that must be compiled as C
is now datatoc generated code and the DNA defaults that use designated
initializers.

Pull Request: https://projects.blender.org/blender/blender/pulls/134469
2025-02-13 18:58:08 +01:00
Iliya Katueshenock
c646feac47 Cleanup: BLI: Delete incorrect dimension up-cast via pointer constructor
Since one user-defined conversion operator is allowed during implicit conversion,
 and after this conversion here is a constructor which can accept result
of conversion, there was a backdoor for a vector types to up-cast their
dimensions via cast to pointer type of a component of a vector. Since it was
implicit and non-intentional it led to buffer overflows.

Pull Request: https://projects.blender.org/blender/blender/pulls/132927
2025-01-27 18:38:14 +01:00
Hans Goudey
09ef6c1a12 Fix: Stack buffer overflow in BoneStickData constructor
`float4(float3 &)` is currently problematic because of implicit conversions
to and from `float *`. Writing the constructor explicitly fixes the problem.
Also add const to the arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/131828
2024-12-13 10:29:20 +01:00
Miguel Pozo
b295df7345 Refactor: Overlay: Port "next" shaders declarations to static CreateInfos
Use static CreateInfos for Overlay-Next shaders using a similar approach to Workbench shader variations.

Remove unused infos and shader sources.
Remove the `gpu_shader_create_info_get_unfinalized_copy` workaround.

Pull Request: https://projects.blender.org/blender/blender/pulls/131514
2024-12-12 23:05:00 +01:00
Laurynas Duburas
fc5f89a520 Curves: Support View3DOverlay.display_handle property
Support for View3DOverlay.display_handle property accessible in "Curves Edit Mode Overlays" panel.

Rel #105037

Pull Request: https://projects.blender.org/blender/blender/pulls/128142
2024-10-08 21:17:16 +02:00
Clément Foucault
8165d52f90 Fix: Overlay: Broken shader compilation 2024-10-04 23:32:24 +02:00
Clément Foucault
e4c802e53e GPU: Use macros for create infos
Mass rename create info function to use the new macros.
This allows to define resources in C++ inside IDEs'
precompilation system for linting purpose.

This applies the following script and format afterwards:
https://projects.blender.org/blender/blender/pulls/128602#issuecomment-1310597

Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128602
2024-10-04 19:04:40 +02:00
Laurynas Duburas
84dedfaf4b Curves: smooth handles
Adds antialiasing to curve's handles and thickness to active ones.
Also handles now react to
 `Preferences > Interface > Display > Resolution Scale` and
`Preferences > Themes > 3D Viewport > Edge Width` as they do in
legacy curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/122910
2024-09-25 15:21:31 +02:00
Clément Foucault
508b39661d Overlay-Next: Armature
Functional Changes:
- Custom shapes using empties now supports line width.
- Line width is supported on MacOS.
- Fixed Stick bone drawing on MacOS.

Some shaders are duplicated and ported to the new
primitive expansion API.

The legacy code inside `overlay_armature.cc` have been
guarded behind `NO_LEGACY_OVERLAY` which can
be enabled to make sure no legacy code is used unnoticed.
This allows for spotting more easily code that needs to be
ported. Moreover, it is easier to remove this legacy code
when the time comes.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/126474
2024-09-04 12:56:37 +02:00
Clément Foucault
e49bc9633b Overlay-Next: Particles
Straightforward port.

Duplicated some shaders for simplicity.

Includes wireframe for hair particle systems.

Functional change: Particle display now honnor line width.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/126456
2024-08-19 15:38:55 +02:00
Laurynas Duburas
4505b854f7 Overlay-Next: Relation
Overlay-Next version of relations.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/125894
2024-08-09 16:25:38 +02:00
Laurynas Duburas
d4ce2dfe60 Overlay-Next Camera
Overlay-Next version of Camera.

Rel #102179

#109059 was used as a reference.

Pull Request: https://projects.blender.org/blender/blender/pulls/124122
2024-07-30 20:00:30 +02:00
Laurynas Duburas
94ea25ba09 Overlay-Next: Light
Overlay-Next version of light.

Rel #102179

#109059 was used as a reference.

Pull Request: https://projects.blender.org/blender/blender/pulls/123848
2024-07-30 17:37:42 +02:00
Christoph Lendenfeld
f9ea64b0ba Anim: Per bone wire width for custom shapes
The setting adds the "Custom Shape Wire Width"
option to the "Viewport Display/Custom Shape" section of a pose bone.
As the setting says, this controls how thick the wire is drawn in the viewport.

This is done by adding a geometry shader that makes two triangles out of a line.

The Anti-Aliasing is controlled by the setting
Viewport->Quality->Smooth Wires->Overlay in the user preferences.

## Artifacts
When increasing the line width, the lines start to separate at their vertices.
This comes from extruding each edge along the normal of its direction.
This could be solved by adding round caps in a later PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/120176
2024-05-30 15:51:30 +02:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
laurynas
15dbfe54e4 Curves: draw evaluated curves and handles in edit mode
This makes the edit mode drawing for the new curves data more similar
to the old edit mode. Specifically, it draws the evaluated curves now instead
of just a poly curve. Furthermore, it now draws bezier handles as well as
a separate control curve for nurbs curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/119053
2024-03-19 10:39:05 +01:00
Gilberto Rodrigues
dfd1b63cc7 UI: improve mesh edge highlighting
Changes to edit mode mesh overlays, use hue shift instead of color
fading/darkening for selection mode visual differentiation, and some
theme changes to improve the display of mesh edges and faces with good
selection visibility.

- Removed "edge" toggle from edit mode overlays panel.
- No longer halves the edge and face alpha depending on selection mode.
  Half the face alpha in wire-frame mode. For better visibility on most
  themes.

Ref !111431
2023-11-02 22:09:17 +11:00
Sybren A. Stüvel
caf46c9fbb Refactor: anim, rename flag PCHAN_HAS_TARGET to PCHAN_HAS_NO_TARGET
Rename the `bPoseChannel::flag` `PCHAN_HAS_TARGET` to `PCHAN_HAS_NO_TARGET`
as that is actually the meaning of the flag (in the majority of the code).

Since the flag was so confusingly named, there were some mixups in the
armature overlay drawing code as well, which have been fixed now too.
2023-09-25 14:33:51 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Sergey Sharybin
c1bc70b711 Cleanup: Add a copyright notice to files and use SPDX format
A lot of files were missing copyright field in the header and
the Blender Foundation contributed to them in a sense of bug
fixing and general maintenance.

This change makes it explicit that those files are at least
partially copyrighted by the Blender Foundation.

Note that this does not make it so the Blender Foundation is
the only holder of the copyright in those files, and developers
who do not have a signed contract with the foundation still
hold the copyright as well.

Another aspect of this change is using SPDX format for the
header. We already used it for the license specification,
and now we state it for the copyright as well, following the
FAQ:

    https://reuse.software/faq/
2023-05-31 16:19:06 +02:00
Miguel Pozo
9ae2dd577a Overlay-Next: Initial implementation
This contains the basis of the new overlay engine.
Only a few overlays are ported for proof of concept of the new design.

This new design unifies the selection drawing with the overlay-next engine.
It now becomes responsible of selection in object mode.
For this we create a dedicated shader module that patches the shaders
for selection.

Note that the gizmo selection still uses the occlusion queries and edit-mode
the current selection engine (select_engine.c).

Related task #102179
Related task #102177

Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/107734
2023-05-23 15:00:38 +02:00
Jason Fielder
d90a2b0ab7 Metal: GLSL compatibility.
Additional mat3 constructors added, global variable namespace collisions
for uniform and object color avoided via re-name.

Metal vertex format compatibility added for shaders wherein vertex data
goes through a double-conversion and cannot be implicitly converted during
Metal vertex assembly e.g. bitmasks passed directly as unsigned type in
shader interface for certain shader interfaces.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D16433
2022-12-08 21:30:13 +01:00
Jacques Lucke
2fffd7d7a8 Move overlay engine to C++
This just makes the minimum changes to make the files compile.
2022-09-19 14:29:58 +02:00
Johannes J
f4d31fbf6c DRW: Fix signed/unsigned mismatches in shader code
Fix the following error messages on Blender startup
since commit 308a12ac64.

This commit fixes T98194.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15007
2022-05-23 16:30:18 +02:00
Clément Foucault
0dfb6eddc0 Overlay: Port motion path shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 15:37:37 +02:00
Clément Foucault
86b37748a7 Overlay: Port background shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:54:52 +02:00
Clément Foucault
69a43069e8 Overlay: Port edit gpencil shaders to use shaderCreateInfo
This should have (mostly) no functional changes.

Support for clipping was added to the shaders but it is not enabled for now
as we wait for the Gpencil engine to support clipping.
2022-04-30 21:11:55 +02:00
Clément Foucault
a8e6ee17cc Overlay: Port edit curves shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 19:20:37 +02:00
Clément Foucault
308a12ac64 Overlay: Port Grid shader to shaderCreateInfo and other code cleanup
Along with the port to createInfo this also:
- Packs constant uniforms in a UBO.
- Share enum declaration and unify names
- Makes codeflow easier to undestand.
- Split grid data to its own struct.

# Conflicts:
#	source/blender/draw/engines/overlay/overlay_grid.c
2022-04-28 21:13:04 +02:00