-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Small improvement and color fix for CameraHelper.js #30042
Open
dbt-padberg
wants to merge
1
commit into
mrdoob:master
Choose a base branch
from
dbt-padberg:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,14 +28,14 @@ class CameraHelper extends LineSegments { | |
|
||
const pointMap = {}; | ||
|
||
// near | ||
// far | ||
|
||
addLine( 'n1', 'n2' ); | ||
addLine( 'n2', 'n4' ); | ||
addLine( 'n4', 'n3' ); | ||
addLine( 'n3', 'n1' ); | ||
|
||
// far | ||
// near | ||
|
||
addLine( 'f1', 'f2' ); | ||
addLine( 'f2', 'f4' ); | ||
|
@@ -132,14 +132,14 @@ class CameraHelper extends LineSegments { | |
|
||
const colorAttribute = geometry.getAttribute( 'color' ); | ||
|
||
// near | ||
// far | ||
|
||
colorAttribute.setXYZ( 0, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 1, frustum.r, frustum.g, frustum.b ); // n1, n2 | ||
colorAttribute.setXYZ( 2, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 3, frustum.r, frustum.g, frustum.b ); // n2, n4 | ||
colorAttribute.setXYZ( 4, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 5, frustum.r, frustum.g, frustum.b ); // n4, n3 | ||
colorAttribute.setXYZ( 6, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 7, frustum.r, frustum.g, frustum.b ); // n3, n1 | ||
|
||
// far | ||
// near | ||
|
||
colorAttribute.setXYZ( 8, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 9, frustum.r, frustum.g, frustum.b ); // f1, f2 | ||
colorAttribute.setXYZ( 10, frustum.r, frustum.g, frustum.b ); colorAttribute.setXYZ( 11, frustum.r, frustum.g, frustum.b ); // f2, f4 | ||
|
@@ -169,7 +169,7 @@ class CameraHelper extends LineSegments { | |
// target | ||
|
||
colorAttribute.setXYZ( 38, target.r, target.g, target.b ); colorAttribute.setXYZ( 39, target.r, target.g, target.b ); // c, t | ||
colorAttribute.setXYZ( 40, cross.r, cross.g, cross.b ); colorAttribute.setXYZ( 41, cross.r, cross.g, cross.b ); // p, c | ||
colorAttribute.setXYZ( 40, target.r, target.g, target.b ); colorAttribute.setXYZ( 41, target.r, target.g, target.b ); // p, c | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, the line from the light position to the center of the far plane is a different color outside the frustum than it is inside the frustum. I am not sure there is a compelling reason to change it. |
||
|
||
// cross | ||
|
||
|
@@ -200,14 +200,14 @@ class CameraHelper extends LineSegments { | |
setPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 ); | ||
setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 ); | ||
|
||
// near | ||
// far | ||
|
||
setPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 ); | ||
setPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 ); | ||
setPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 ); | ||
setPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 ); | ||
|
||
// far | ||
// near | ||
|
||
setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 ); | ||
setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 ); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This change does not look correct to me. If you comment out the four lines below, you will see that the near lines won't receive a color.