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

Vec3 functions for ExprTK and new example "Ray Casting" #2042

Merged
merged 2 commits into from
Dec 10, 2022
Merged

Conversation

texodus
Copy link
Member

@texodus texodus commented Dec 9, 2022

  • Adds 4 new vec3 functions to ExprTK/Perspective: dot_product3, cross_product3, norm3 and diff3.
  • Adds a new demo of a simple ray-casting engine written as a Perspective example similar to the existing Fractal example, as presented at OSSF NYC 2022.

Screen Shot 2022-12-09 at 9 26 48 PM

@texodus texodus added the enhancement Feature requests or improvements label Dec 9, 2022
Copy link
Contributor

@brochington brochington left a comment

Choose a reason for hiding this comment

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

All in all very cool stuff!

const y_offset = Math.random() * 2000 - 1000;
const z_offset = Math.random() * 2000;
for (const v in vertices) {
const vertex = JSON.parse(JSON.stringify(vertices[v]));
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like JSON.parse(JSON.stringify(...)) used to deep copy things can be confusing if you've never come across it before. Have you checked out the structuredClone API? Or maybe using [...vertices[v]] would work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good find thanks, never seen structuredClone() before

@texodus texodus merged commit 7bd34b7 into master Dec 10, 2022
@texodus texodus deleted the ray-caster branch December 10, 2022 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants