forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 206
bugfix(view): Fix view ray cast behavior for mouse picks and drawable occlusion #2818
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
Open
xezon
wants to merge
13
commits into
TheSuperHackers:main
Choose a base branch
from
xezon:xezon/fix-view-ray-casts
base: main
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
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e2eff57
bugfix(view): Fix view ray casting behavior for mouse picks, drawable…
xezon 51dc4b6
Fix MaskTextureShader::set
xezon a2d22f5
Fix wbview3d
xezon 0c2c466
Move IntersectionResType into PlaneClass
xezon aa89196
Move pauseWaves=TRUE
xezon 8efdbdb
Clarify Region3D::setXY
xezon 0db89be
Move rayStart.Set back
xezon 982fe50
Fix message creation
xezon 3ece73b
Use early return
xezon ba8957b
Merge condition
xezon f02a665
Add screenToTerrain conditioning in InGameUI
xezon d125e1d
Move commandStatus = COMMAND_COMPLETE;
xezon 2d92831
Fix style
xezon 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -243,13 +243,12 @@ Bool View::isUserControlLocked() const | |
| /** project the 4 corners of this view into the world and return each point as a parameter, | ||
| the world points are at the requested Z */ | ||
| //------------------------------------------------------------------------------------------------- | ||
| void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, | ||
| PlaneClass::IntersectionResType View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, | ||
| Coord3D *bottomRight, Coord3D *bottomLeft, | ||
| Real z ) | ||
| Real z, ViewportClass viewPort ) | ||
| { | ||
| // sanity | ||
| if( topLeft == nullptr || topRight == nullptr || bottomRight == nullptr || bottomLeft == nullptr) | ||
| return; | ||
| return PlaneClass::NO_INTERSECTION; | ||
|
|
||
| ICoord2D screenTopLeft; | ||
| ICoord2D screenTopRight; | ||
|
|
@@ -262,20 +261,36 @@ void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight, | |
| // setup the screen coords for the 4 corners of the viewable display | ||
| getOrigin( &origin.x, &origin.y ); | ||
|
|
||
| screenTopLeft.x = origin.x; | ||
| screenTopLeft.y = origin.y; | ||
| screenTopRight.x = origin.x + viewWidth; | ||
| screenTopRight.y = origin.y; | ||
| screenBottomRight.x = origin.x + viewWidth; | ||
| screenBottomRight.y = origin.y + viewHeight; | ||
| screenBottomLeft.x = origin.x; | ||
| screenBottomLeft.y = origin.y + viewHeight; | ||
|
|
||
| // project | ||
| screenToWorldAtZ( &screenTopLeft, topLeft, z ); | ||
| screenToWorldAtZ( &screenTopRight, topRight, z ); | ||
| screenToWorldAtZ( &screenBottomRight, bottomRight, z ); | ||
| screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); | ||
| screenTopLeft.x = origin.x + viewWidth * viewPort.Min.X; | ||
| screenTopLeft.y = origin.y + viewHeight * viewPort.Min.Y; | ||
| screenTopRight.x = origin.x + viewWidth * viewPort.Max.X; | ||
| screenTopRight.y = origin.y + viewHeight * viewPort.Min.Y; | ||
| screenBottomRight.x = origin.x + viewWidth * viewPort.Max.X; | ||
| screenBottomRight.y = origin.y + viewHeight * viewPort.Max.Y; | ||
| screenBottomLeft.x = origin.x + viewWidth * viewPort.Min.X; | ||
| screenBottomLeft.y = origin.y + viewHeight * viewPort.Max.Y; | ||
|
|
||
| PlaneClass::IntersectionResType combinedResult = PlaneClass::INSIDE_SEGMENT; | ||
| PlaneClass::IntersectionResType individualResults[4]; | ||
| individualResults[0] = screenToWorldAtZ( &screenTopLeft, topLeft, z ); | ||
| individualResults[1] = screenToWorldAtZ( &screenTopRight, topRight, z ); | ||
| individualResults[2] = screenToWorldAtZ( &screenBottomRight, bottomRight, z ); | ||
| individualResults[3] = screenToWorldAtZ( &screenBottomLeft, bottomLeft, z ); | ||
|
|
||
| for( Int i = 0; i < 4; ++i ) | ||
| { | ||
| if( individualResults[i] == PlaneClass::NO_INTERSECTION ) | ||
| { | ||
| combinedResult = PlaneClass::NO_INTERSECTION; | ||
| break; | ||
| } | ||
| if( individualResults[i] == PlaneClass::OUTSIDE_LINE ) | ||
| { | ||
| combinedResult = PlaneClass::OUTSIDE_LINE; | ||
|
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. should break here?
Author
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. No because NO_INTERSECTION will take precedence over OUTSIDE_LINE |
||
| } | ||
| } | ||
|
|
||
| return combinedResult; | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.