-
Notifications
You must be signed in to change notification settings - Fork 7
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
add clip plane changes #230
base: main
Are you sure you want to change the base?
Conversation
…l-animated/agave into feature/add-clip-plane # Conflicts: # renderlib/io/CMakeLists.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some non-blocking comments and questions!
float denom = dot(R.m_D, g_clipPlane.xyz); | ||
if (abs(denom) > 0.0001f) // your favorite epsilon | ||
{ | ||
float tClip = dot(g_clipPlane.xyz*(-g_clipPlane.w) - R.m_O, g_clipPlane.xyz) / denom; | ||
if (denom < 0.0f) { | ||
pNearT = max(pNearT, tClip); | ||
} | ||
else { | ||
pFarT = min(pFarT, tClip); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might ask you this in-person, but can you walk me through what this calculation is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started to type out a text explanation but it was getting long so in person will be more efficient. If you know how ray-plane intersection works that's most of what you are seeing here, and then some logic to combine the ray-plane intersection with the ray-boundingbox intersection.
ClipPlaneTool(Plane plane, glm::vec3& pos) | ||
: ManipulationTool(0) | ||
, m_plane(plane) | ||
, m_pos(pos) | ||
{ | ||
// assumes pos is in plane! if not, there will be trouble. | ||
// assert(glm::dot(m_plane.normal, m_pos) == m_plane.d); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to like, project m_pos
onto the provided plane?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the pos data stored by the clip plane tool doesn't have to precisely match the m_plane anymore. At init, I forget why I commented this out (and it may just be because I needed an epsilon). I'll have to put the code back and see why.
Resolves #228
Add user clipping plane functionality.
Also adds some basic UI for enabling, showing/hiding, and manipulating the clip plane but the UI will be more or less completely redone. See #233
Note: gh-actions build is broken on windows but due to dependencies and not this code change.