You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will actually be nontrivial to do because the gizmo triangles are not oriented. The easiest way to do this is to specify tangent vectors for twist gizmo vertices, since the compute shader is already using them on the GPU to decide which verts to cull. (We've just ignoring the result for gizmo vertices because they don't currently have tangent vectors.)
In hyperpuzzle/src/puzzle/mesh.rs, in Mesh::add_gizmo_vertex(), add tangent vectors to the mesh (similar to add_puzzle_vertex() above). You'll have to add a parameter uv_tangents: [impl VectorRef; 2].
In hyperpuzzle/src/builder/twist_system.rs, in TwistSystemBuilder::build_gizmo(), on the let vertex_map line, compute the two tangent vectors for the polygon of the twist gizmo. The error handling will be easier if you convert the functional-style flat_map() and map() into traditional for loops. Use space.get(polygon).as_face()?.tangent_vectors()? to get the tangent vectors for the polygon.
Make sure the tangent vectors are facing the right way relative to some point inside the polyhedron, which you can get by averaging all vertices of the polyhedron (probably something like space.get(polyhedron).vertex_set()). See hyperpuzzle/src/builder/shape.rsbuild_shape_polygons() for an example. It's a good idea to make the triangles face the right way in 3D too, since that'll help with Clicking on back of twist gizmo should click in reverse #58. Feel free to factor out parts into hyperpuzzle/src/util.rs if you can find a nice way to do it.
That should just work?
The text was updated successfully, but these errors were encountered:
HactarCE
changed the title
3D twist gizmo ignroes "show frontfaces" and "show backfaces" settings
3D twist gizmo ignores "show frontfaces" and "show backfaces" settings
Nov 25, 2024
Guide
This will actually be nontrivial to do because the gizmo triangles are not oriented. The easiest way to do this is to specify tangent vectors for twist gizmo vertices, since the compute shader is already using them on the GPU to decide which verts to cull. (We've just ignoring the result for gizmo vertices because they don't currently have tangent vectors.)
hyperpuzzle/src/puzzle/mesh.rs
, inMesh::add_gizmo_vertex()
, add tangent vectors to the mesh (similar toadd_puzzle_vertex()
above). You'll have to add a parameteruv_tangents: [impl VectorRef; 2]
.hyperpuzzle/src/builder/twist_system.rs
, inTwistSystemBuilder::build_gizmo()
, on thelet vertex_map
line, compute the two tangent vectors for the polygon of the twist gizmo. The error handling will be easier if you convert the functional-styleflat_map()
andmap()
into traditionalfor
loops. Usespace.get(polygon).as_face()?.tangent_vectors()?
to get the tangent vectors for the polygon.space.get(polyhedron).vertex_set()
). Seehyperpuzzle/src/builder/shape.rs
build_shape_polygons()
for an example. It's a good idea to make the triangles face the right way in 3D too, since that'll help with Clicking on back of twist gizmo should click in reverse #58. Feel free to factor out parts intohyperpuzzle/src/util.rs
if you can find a nice way to do it.The text was updated successfully, but these errors were encountered: