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
Merged
+591
−458
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
43b74b1
bugfix(view): Fix view ray casting behavior for mouse picks, drawable…
xezon fbed14e
Fix MaskTextureShader::set
xezon 28e43f5
Fix wbview3d
xezon 6f1bc72
Move IntersectionResType into PlaneClass
xezon eafe094
Move pauseWaves=TRUE
xezon 57962cb
Clarify Region3D::setXY
xezon a915eed
Move rayStart.Set back
xezon f0cb91a
Fix message creation
xezon 60f100b
Use early return
xezon d976bd2
Merge condition
xezon 52638b0
Add screenToTerrain conditioning in InGameUI
xezon e974c0d
Move commandStatus = COMMAND_COMPLETE;
xezon f518c98
Fix style
xezon f824bb7
Replicate in Generals
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.