-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support for model outlining #4314
Merged
+638
−23
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
9f58e9c
Working on drawing highlighted models
jasonbeverage de364e9
Changed demo to be able to modify the highlight size
jasonbeverage cea7291
Better outlining algorithm
jasonbeverage c72757b
Documentation and slight tweaks
jasonbeverage b8a2c44
Changed Cartesian4 to Color
jasonbeverage 6a532d1
Making vertex shader for highlighting more generic, works with animat…
jasonbeverage 2362111
Terrible code for looking up the projection matrix uniform name
jasonbeverage aa759ac
Merge branch 'master' into modelhighlight
jasonbeverage 590bafc
Spelling and added a highlightCommand2D
jasonbeverage 73d9fb2
Comment
jasonbeverage 116bdfc
Moved outline example to it's own sandcastle example and reverted the…
jasonbeverage fa23733
Fix jshint issues
jasonbeverage 751fbda
Added new getUniformNameForSemantic function
jasonbeverage f41bb6e
Changed the highlightSize parameter to be in pixels instead of clip s…
jasonbeverage 36f046d
Simplified highlight shader just using cesium builtins
jasonbeverage d247a65
Merge branch 'master' into modelhighlight
jasonbeverage 32d74a1
Merge branch 'master' into modelhighlight
jasonbeverage af86c9a
Defaulting highlight to true in 3D Models Outline example. Changed h…
jasonbeverage 817da19
Changed highlightColor default to default constructed color and highl…
jasonbeverage a492379
Changed hilightSize default to 2.0 in Model.js and highlightColor to …
jasonbeverage 20a7149
Removed extra whitespace
jasonbeverage d98e0ea
Not setting face in highlightRS, just enabled: false
jasonbeverage aa62d4d
Whitespace
jasonbeverage c2a8ed1
Whitespace
jasonbeverage df36205
Enabling ALPHA_BLEND blending on highlight state
jasonbeverage fa3c2e9
Added opacity slider to 3D Models Outline demo.
jasonbeverage 1bcce58
Explicitly requesting a stencil buffer in the 3D Models Outline demo …
jasonbeverage fee0674
Only rendering highlight commands if stencilBits is greater than 0, o…
jasonbeverage 508b14d
ModelGraphicSpec tests for model highlighting
jasonbeverage 1c33371
Model testing
jasonbeverage bd77f27
Merge branch 'master' into modelhighlight
lilleyse 5f93bf1
Reorganized silhouetting
lilleyse 93d4e68
Prevent divide-by-zero during unpremultiply
lilleyse d7ae242
Issue clear command
lilleyse 5e1e9cf
More accurate translucencly check
lilleyse 246dc83
Fix spec
lilleyse 60caefa
Change order of stencilReference
lilleyse 11fc0da
Doc and stencil clear after ground pass
lilleyse cb35414
No longer hardcoding v_normal
lilleyse 95d024e
Updated CHANGES.md
lilleyse 077e225
Added tests
lilleyse 7a399f2
Merge branch 'master' into modelhighlight
lilleyse 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
Fix jshint issues
- workspaces
- pre-template-literals
- pre-prettier-v3
- pre-prettier
- pre-let-const
- post-workspaces
- post-template-literals
- post-prettier-v3
- post-prettier
- post-let-const
- cesium-workspaces
- 1.127
- 1.126
- 1.125
- 1.124
- 1.123.1
- 1.123
- 1.122
- 1.121.1
- 1.121
- 1.120
- 1.119
- 1.118.2
- 1.118.1
- 1.118
- 1.117
- 1.116
- 1.115
- 1.114
- 1.113
- 1.112
- 1.111
- 1.111-release
- 1.110.1
- 1.110
- 1.109
- 1.108
- 1.107.2
- 1.107.1
- 1.107
- 1.106.1
- 1.106
- 1.105.2
- 1.105.1
- 1.105
- 1.104
- 1.103
- 1.102
- 1.101
- 1.100
- 1.99
- 1.98.1
- 1.98
- 1.97
- 1.96
- 1.95
- 1.94.3
- 1.94.2
- 1.94.1
- 1.94
- 1.93
- 1.92
- 1.91
- 1.90
- 1.89
- 1.88
- 1.87.1
- 1.87
- 1.86.1
- 1.86
- 1.85
- 1.84
- 1.83
- 1.82
- 1.81
- 1.80
- 1.79.1
- 1.79
- 1.78
- 1.77
- 1.76
- 1.75
- 1.74
- 1.73
- 1.72
- 1.71
- 1.70.1
- 1.70
- 1.69
- 1.68
- 1.67
- 1.66
- 1.65
- 1.64
- 1.63.1
- 1.63
- 1.62
- 1.61
- 1.60
- 1.59
- 1.58.1
- 1.58
- 1.57
- 1.56.1
- 1.56
- 1.55
- 1.54
- 1.53
- 1.52
- 1.51
- 1.50
- 1.49
- 1.48
- 1.47
- 1.46
- 1.45
- 1.44
- 1.43
- 1.42.1
- 1.42
- 1.41
- 1.40
- 1.39
- 1.38
- 1.37
- 1.36
- 1.35.2
- 1.35
- 1.34
- 1.33
- 1.32
- 1.31
- 1.30
- 1.29
commit fa237332a9544292d83d772d5c524fb4a6ffa6a6
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 |
---|---|---|
|
@@ -1853,26 +1853,32 @@ define([ | |
// Get the projection matrix name. There is probably a better way to do this. | ||
var projectionMatrixUniformName = null; | ||
for (var techniqueName in model.gltf.techniques) { | ||
var projectionMatrixParameterName = ""; | ||
var technique = model.gltf.techniques[techniqueName]; | ||
for (var parameterName in technique.parameters) { | ||
var parameter = technique.parameters[parameterName]; | ||
if (parameter.semantic === "PROJECTION") { | ||
projectionMatrixParameterName = parameterName; | ||
break; | ||
if (model.gltf.techniques.hasOwnProperty(techniqueName)) { | ||
var technique = model.gltf.techniques[techniqueName]; | ||
var projectionMatrixParameterName = ""; | ||
for (var parameterName in technique.parameters) { | ||
if (technique.parameters.hasOwnProperty(parameterName)) { | ||
var parameter = technique.parameters[parameterName]; | ||
if (parameter.semantic === "PROJECTION") { | ||
projectionMatrixParameterName = parameterName; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
for (var uniformName in technique.uniforms) { | ||
var paramName = technique.uniforms[uniformName]; | ||
if (paramName == projectionMatrixParameterName) { | ||
projectionMatrixUniformName = uniformName; | ||
break; | ||
for (var uniformName in technique.uniforms) { | ||
if (technique.uniforms.hasOwnProperty(uniformName)) { | ||
var paramName = technique.uniforms[uniformName]; | ||
if (paramName === projectionMatrixParameterName) { | ||
projectionMatrixUniformName = uniformName; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (projectionMatrixUniformName) { | ||
break; | ||
if (projectionMatrixUniformName) { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -2955,6 +2961,18 @@ define([ | |
}; | ||
} | ||
|
||
function createHighlightColorFunction(model) { | ||
return function() { | ||
return model.highlightColor; | ||
}; | ||
} | ||
|
||
function createHighlightSizeFunction(model) { | ||
return function() { | ||
return model.highlightSize; | ||
}; | ||
} | ||
|
||
function createCommand(model, gltfNode, runtimeNode, context, scene3DOnly) { | ||
var nodeCommands = model._nodeCommands; | ||
var pickIds = model._pickIds; | ||
|
@@ -3115,14 +3133,9 @@ define([ | |
|
||
highlightRS = RenderState.fromCache(highlightRS); | ||
|
||
// Setup the highlight color uniform. | ||
uniformMap.u_highlightColor = function(){ | ||
return model.highlightColor; | ||
}; | ||
|
||
uniformMap.u_highlightSize = function() { | ||
return model.highlightSize; | ||
}; | ||
// Setup the highlight color and size uniforms. | ||
uniformMap.u_highlightColor = createHighlightColorFunction(model); | ||
uniformMap.u_highlightSize = createHighlightSizeFunction(model); | ||
|
||
var highlightCommand = new DrawCommand({ | ||
boundingVolume : new BoundingSphere(), // updated in update() | ||
|
@@ -3991,10 +4004,9 @@ define([ | |
for (i = 0; i < length; ++i) { | ||
nc = nodeCommands[i]; | ||
if (nc.show) { | ||
var command = nc.command; | ||
commandList.push(command); | ||
commandList.push(nc.command); | ||
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. Here and just below, I don't think this change is needed. |
||
|
||
boundingVolume = command.boundingVolume; | ||
boundingVolume = nc.command.boundingVolume; | ||
if (frameState.mode === SceneMode.SCENE2D && | ||
(boundingVolume.center.y + boundingVolume.radius > idl2D || boundingVolume.center.y - boundingVolume.radius < idl2D)) { | ||
commandList.push(nc.command2D); | ||
|
@@ -4008,8 +4020,7 @@ define([ | |
nc = nodeCommands[i]; | ||
if (nc.show) { | ||
commandList.push(nc.highlightCommand); | ||
|
||
boundingVolume = command.boundingVolume; | ||
boundingVolume = nc.command.boundingVolume; | ||
if (frameState.mode === SceneMode.SCENE2D && | ||
(boundingVolume.center.y + boundingVolume.radius > idl2D || boundingVolume.center.y - boundingVolume.radius < idl2D)) { | ||
commandList.push(nc.highlightCommand2D); | ||
|
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.
Can we create these commands and related resources on-demand the first time
highlight
istrue
?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 tried to mimic what was done with the pickCommands, so kept the highlight command and resource creation close to where the pick commands are generated. If you don't mind I'll defer this to you to move around so I don't break anything :)
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.
@lilleyse let me know if you have any questions on this one; I prefer creating these on-demand since they may not be used in many apps, and users should only pay for what they use when it's reasonable for us to implement.