Overlay-Next: Grid 2D #127285

Merged
Clément Foucault merged 9 commits from laurynas/blender:overlay-next-grid2d into main 2024-09-11 18:10:19 +02:00
Contributor

Overlay-Next version of Grid 2D

Rel #102179

Overlay-Next version of Grid 2D Rel #102179
Laurynas Duburas added 1 commit 2024-09-07 16:45:51 +02:00
Laurynas Duburas requested review from Clément Foucault 2024-09-07 16:46:07 +02:00
Laurynas Duburas changed title from WIP: Overlay-Next: Grid 2D to Overlay-Next: Grid 2D 2024-09-07 16:46:11 +02:00
Laurynas Duburas changed title from Overlay-Next: Grid 2D to WIP: Overlay-Next: Grid 2D 2024-09-07 17:17:52 +02:00
Laurynas Duburas added 1 commit 2024-09-07 17:35:28 +02:00
Laurynas Duburas changed title from WIP: Overlay-Next: Grid 2D to Overlay-Next: Grid 2D 2024-09-07 17:38:09 +02:00
Clément Foucault requested changes 2024-09-07 21:03:54 +02:00
Dismissed
Clément Foucault left a comment
Member

It is a bit hard to see the actual change interleived with just .

Do you think it would be wise to split the 2D grid into its own class? I believe it would reduce the spaghettiness.

Eventually we would have the Grid as a Virtual class. But for now I would just have both Grid3D and Grid2D side by side, each enabled only for the correct area type.

It is a bit hard to see the actual change interleived with just . Do you think it would be wise to split the 2D grid into its own class? I believe it would reduce the spaghettiness. Eventually we would have the Grid as a Virtual class. But for now I would just have both `Grid3D` and `Grid2D` side by side, each enabled only for the correct area type.
@ -53,0 +55,4 @@
sub.bind_texture("depthBuffer", &res.depth_tx);
float4x4 mat;
unit_m4(mat.ptr());
mat[0][0] = data_.size[0];

Use from_scale<float4x4>

Use `from_scale<float4x4>`
laurynas marked this conversation as resolved
Author
Contributor

Do you think it would be wise to split the 2D grid into its own class? I believe it would reduce the spaghettiness.

I had same thoughts while looking at overlay_engine.c. 2D is always used with == SPACE_IMAGE there. Inside of Grid also == SPACE_IMAGE.

Eventually we would have the Grid as a Virtual class.
You want to create some particular implementation Grid inInstance::init() and to use it without extra ifs in other Instance methods?

Yet I'm not sure about two classes. Most of the code is common so it would still be twisted. I'll try to reorganize things in single class first.

> Do you think it would be wise to split the 2D grid into its own class? I believe it would reduce the spaghettiness. > I had same thoughts while looking at `overlay_engine.c`. 2D is always used with ` == SPACE_IMAGE` there. Inside of `Grid` also `== SPACE_IMAGE`. > Eventually we would have the Grid as a Virtual class. You want to create some particular implementation `Grid` in`Instance::init()` and to use it without extra `if`s in other `Instance` methods? Yet I'm not sure about two classes. Most of the code is common so it would still be twisted. I'll try to reorganize things in single class first.
Laurynas Duburas changed title from Overlay-Next: Grid 2D to WIP: Overlay-Next: Grid 2D 2024-09-07 22:55:39 +02:00
Laurynas Duburas added 1 commit 2024-09-07 22:58:02 +02:00
Laurynas Duburas added 1 commit 2024-09-09 21:36:39 +02:00
Author
Contributor

I've reorganized code, now I think single class for both is better.

I had to move to MainPass because of:

         ResourceHandle handle = manager.resource_handle(mat);
         sub.draw(shapes.quad_wire.get(), handle);

Maybe it is possible to collect matrices in one StorageVectorBuffer<float4x4>, override with it model matrix and draw with a single call like sub.draw(shapes.quad_wire.get(), size)?

I've reorganized code, now I think single class for both is better. I had to move to `MainPass` because of: ```c ResourceHandle handle = manager.resource_handle(mat); sub.draw(shapes.quad_wire.get(), handle); ``` Maybe it is possible to collect matrices in one `StorageVectorBuffer<float4x4>`, override with it model matrix and draw with a single call like `sub.draw(shapes.quad_wire.get(), size)`?
Laurynas Duburas changed title from WIP: Overlay-Next: Grid 2D to Overlay-Next: Grid 2D 2024-09-09 21:51:14 +02:00

Maybe it is possible to collect matrices in one StorageVectorBuffer<float4x4>, override with it model matrix and draw with a single call like sub.draw(shapes.quad_wire.get(), size)?

Yes. You can modify the shader create info from the patch lambda function for that purpose.

> Maybe it is possible to collect matrices in one `StorageVectorBuffer<float4x4>`, override with it model matrix and draw with a single call like sub.draw(shapes.quad_wire.get(), size)? Yes. You can modify the shader create info from the patch lambda function for that purpose.
Laurynas Duburas added 1 commit 2024-09-10 10:39:22 +02:00
Clément Foucault requested changes 2024-09-10 11:04:57 +02:00
Dismissed
@ -82,4 +129,1 @@
return;
}
float grid_steps[SI_GRID_STEPS_LEN] = {

Move that to init_2d and init_3d and add x or y suffix when applicable. This would clearer.

Also should be std::array since size is known at compile time.

Move that to `init_2d` and `init_3d` and add `x` or `y` suffix when applicable. This would clearer. Also should be `std::array` since size is known at compile time.
fclem marked this conversation as resolved
@ -92,0 +136,4 @@
init_3d(state, view, grid_steps);
}
void copy_steps_to_data(float grid_steps_x[], float grid_steps_y[])

Use MutableSpan<float>. This avoid unsized array as argument and is safer (will assert on out of bound).

Use `MutableSpan<float>`. This avoid unsized array as argument and is safer (will assert on out of bound).
Laurynas Duburas added 1 commit 2024-09-10 11:14:42 +02:00
Clément Foucault approved these changes 2024-09-10 11:18:51 +02:00
Laurynas Duburas added 1 commit 2024-09-10 15:55:40 +02:00
Clément Foucault added 2 commits 2024-09-11 17:26:33 +02:00
Avoid relation appearing in 2D view
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
ce35863fa2

@blender-bot build

@blender-bot build
Clément Foucault merged commit bae268c57f into main 2024-09-11 18:10:19 +02:00
Laurynas Duburas deleted branch overlay-next-grid2d 2024-09-11 18:10:58 +02:00
Falk David referenced this issue from a commit 2024-09-12 11:33:56 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#127285
No description provided.