Skip to content

A simple wireframe object that takes a CpuMesh, for use in debugging.#552

Merged
asny merged 16 commits intoasny:masterfrom
nowakf:master
Apr 10, 2026
Merged

A simple wireframe object that takes a CpuMesh, for use in debugging.#552
asny merged 16 commits intoasny:masterfrom
nowakf:master

Conversation

@nowakf
Copy link
Copy Markdown
Contributor

@nowakf nowakf commented May 3, 2025

This uses that barycentric coordinates trick: unfortunately, this approach has some limitations: meshes with shared vertices will not be displayed correctly.

I just did this for personal use -- so feel free to disregard for any combination of reasons (technical/aesthetic/etc) -- and there's also a couple of points in the code (specifically GeometryIds) where I didn't know what to do.

Anyway, if you're interested in the feature, I could extend the code to handle meshes with indexes (by duplicating verts). It's also probably possible to handle effects, although I'm not sure that's necessarily desirable.

I would obviously also add some documentation.

Unfortunately, this approach has some limitations: meshes with shared vertices will not be displayed correctly.
@JohnPiwinski
Copy link
Copy Markdown

This would be extremely helpful for debugging my math visualizations. Thank you!

Copy link
Copy Markdown

@Not-A-Normal-Robot Not-A-Normal-Robot left a comment

Choose a reason for hiding this comment

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

I found a couple of improvements you can make

Comment thread src/renderer/object/wireframe.rs Outdated
}

fn id(&self) -> EffectMaterialId {
//TODO!
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unresolved TODO

Comment thread src/renderer/object/wireframe.rs Outdated
use crate::core::*;
use crate::renderer::*;

pub struct Wireframe{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing space, you should use cargo fmt

@asny asny merged commit d778d51 into asny:master Apr 10, 2026
@asny
Copy link
Copy Markdown
Owner

asny commented Apr 10, 2026

Required a bit of extra work, but thank you for starting this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants