Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gui] Add wareframe mode for mesh & mesh_instance, add slider_int for Window.GUI. #5576

Merged
merged 29 commits into from
Aug 4, 2022

Conversation

Morcki
Copy link
Member

@Morcki Morcki commented Jul 29, 2022

Note:
New features:

  1. Support three display modes: Fill Mode (fill faces), Line Mode (Wareframe), Point Mode (rendering as points).
  2. Add a new widget slider_int in window.GUI, which supports slide int type value from minimum to maximum.
  3. Add an arg named instance_count to control the count of mesh instances.

Usage:

window = ti.ui.Window("Display Mesh", (1024, 1024), vsync=True)
canvas = window.get_canvas()
scene = ti.ui.Scene()
camera = ti.ui.make_camera()

# slider_int usage
some_int_type_value = 0
def show_options():
    global some_int_type_value

    window.GUI.begin("Display Panel", 0.05, 0.1, 0.2, 0.15)
    display_mode = window.GUI.slider_int("Value Range", some_int_type_value, 0, 5)
    window.GUI.end()

while window.running:
    
    ...
    # if to show wareframe 
    scene.mesh_instance(vertices, indices, instance_count = 100 , show_wareframe = True)
    
    canvas.scene(scene)
    show_options()
    window.show()

@netlify
Copy link

netlify bot commented Jul 29, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit 266984f
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/62ea10d3a1af4f0008e0ae0b
😎 Deploy Preview https://deploy-preview-5576--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@taichi-gardener taichi-gardener added this to In progress in GGUI Jul 29, 2022
@Morcki Morcki changed the title [gui] Add display mode for mesh & mesh_instance, add default background color. [gui] Add display mode for mesh & mesh_instance, add slider_int for Window.GUI. Jul 31, 2022
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Had a small suggestion w.r.t using enums instead of raw ints

python/taichi/ui/scene.py Outdated Show resolved Hide resolved
python/taichi/ui/scene.py Outdated Show resolved Hide resolved
taichi/python/export_ggui.cpp Outdated Show resolved Hide resolved
@Morcki Morcki requested a review from ailzhang August 1, 2022 07:36
taichi/ui/common/app_config.h Outdated Show resolved Hide resolved
taichi/ui/backends/vulkan/renderable.cpp Outdated Show resolved Hide resolved
taichi/ui/backends/vulkan/renderer.h Outdated Show resolved Hide resolved
taichi/python/export_ggui.cpp Outdated Show resolved Hide resolved
taichi/python/export_ggui.cpp Outdated Show resolved Hide resolved
@Morcki Morcki requested a review from YuCrazing August 2, 2022 03:59
python/taichi/ui/scene.py Outdated Show resolved Hide resolved
@Morcki Morcki requested a review from YuCrazing August 2, 2022 06:53
Copy link
Member

@YuCrazing YuCrazing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks a lot better! I had a few more nits inline and then this PR is good to go

taichi/ui/backends/vulkan/renderable.h Outdated Show resolved Hide resolved
taichi/python/export_ggui.cpp Show resolved Hide resolved
python/taichi/ui/scene.py Outdated Show resolved Hide resolved
python/taichi/ui/scene.py Outdated Show resolved Hide resolved
Copy link
Member

@PENGUINLIONG PENGUINLIONG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, i still suggest you only to differentiate filled and wireframe draws, it would be a simple boolean instead of all the struggles with DisplayMode. I cannot come up with a case that you wanna debug meshes without the connectivity information between vertices and you still don't think scene.particles is a first choice. the structure of input field or ndarray ought to be the same either way.

python/taichi/ui/scene.py Outdated Show resolved Hide resolved
@Morcki
Copy link
Member Author

Morcki commented Aug 3, 2022

again, i still suggest you only to differentiate filled and wireframe draws, it would be a simple boolean instead of all the struggles with DisplayMode. I cannot come up with a case that you wanna debug meshes without the connectivity information between vertices and you still don't think scene.particles is a first choice. the structure of input field or ndarray ought to be the same either way.

I agree with that, I will pass a bool value to enable users to decide to show WareFrame mode or not to.

@Morcki Morcki changed the title [gui] Add display mode for mesh & mesh_instance, add slider_int for Window.GUI. [gui] Add wareframe mode for mesh & mesh_instance, add slider_int for Window.GUI. Aug 3, 2022
@ailzhang ailzhang added this to the Taichi v1.1.0 milestone Aug 4, 2022
Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@ailzhang ailzhang merged commit 93fdf49 into taichi-dev:master Aug 4, 2022
GGUI automation moved this from In progress to Done Aug 4, 2022
@Morcki Morcki deleted the taichi-ggui_feature_dev branch August 7, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
GGUI
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants