-
Notifications
You must be signed in to change notification settings - Fork 292
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
Added 3D brush outline shearing and fixed triangle selection #2529
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for blockbench-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@JannisX11 there's some code duplication in mesh.js where I compute the brush matrix from the bary coords. Should it be moved to some particular location or is it fine? |
Yeah, you can use a closure inside the TexelToLocalMatrix function to handle that duplicated code. Also make sure to not modify the passed I noticed two issues when testing this feature initially:
|
950b167
to
9bad301
Compare
• Renamed TexelToLocalMatrix function to texelToLocalMatrix. • Renamed truncateOffset parameter to truncate_offset.
9bad301
to
5bc4462
Compare
• Added texelToLocalMatrix function on cubes.
• Added a new line above Position comment for consistency. • Fixed capitalization of Z-fighting and Size comments.
Thank you Jannis for taking the time to test this and giving me some pointers and advice regarding my code! I've gone over and fixed the issues you discovered, and realized that there were some other small code cleanups I could do. At this point I believe it's ready to be reviewed and merged so I'll turn it into a regular PR instead of a draft. GitHub Desktop seems to only have let me create a new branch from |
• Removed truncation step inside of texelToLocalMatrix. • Made texelToLocalMatrix take UVs and truncated UVs to have more control over truncation outside of the function.
I realized I never accounted for the soft brush not doing any form of snapping, so I've fixed that too. I also made the code behave more similarly to the previous implementation where the truncation was done before the UVToLocal function |
• Rewrote how the brush outline is transformed by computing a custom matrix to allow for shearing.
• Added a function to mesh.js and cube.js to compute a texel to local matrix for the brush outline.
• Fixed issue where the brush uv position would get truncated before being transformed to a world position for the outline, causing it to select the wrong triangle.