-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add back ModelInstance class #12588
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
lukemckinstry
wants to merge
69
commits into
main
Choose a base branch
from
model-instance-v2
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.
+3,515
−380
Open
Add back ModelInstance class #12588
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
59a543e
Instancing draw command fixes, refactoring model node transforms
ggetz 7c5d96c
Cleanup
ggetz e8a3812
Cleanup
ggetz 50b337d
merge model instancing v2 updates
lukemckinstry 1314e73
cleanup
lukemckinstry c7a1c92
docs updates
lukemckinstry 75ccbeb
ModelInstance specs
lukemckinstry 2f8d5a5
add PipelineStage tests
lukemckinstry d7752f4
add update stage tests to pipeline stage test for model instancing
lukemckinstry f318f07
wip doc notes
lukemckinstry 298ed96
shader fixes for normals and instance transforms
lukemckinstry 95d3754
fixes to model scale
lukemckinstry 17d85b6
add scaling for runtime instanced models - centered at earth origin
lukemckinstry 8590281
fix scaling
lukemckinstry ede4fe1
docs cleanup runtime model instancing pipeline stage
lukemckinstry 30403aa
fix runtime model instancing pipeline stage spec
lukemckinstry 7f5cc0b
api design for model instance collection
lukemckinstry e957cf0
model collection updates
lukemckinstry 00b4710
sandcastle cleanup
lukemckinstry ede0483
document instance collection in model class
lukemckinstry 2601d09
Refine and add examples to inline doc
ggetz cbedce9
add wind turbines on terrain sandcastle
lukemckinstry 3ae1ac3
use async await syntax in tests
lukemckinstry 6a4a286
pipeline stage test updates
lukemckinstry e5b8c84
test fixes
lukemckinstry b925bdf
test that instances array updates for scale as well as translate tran…
lukemckinstry 8191135
remove spy and tohavebeencalled checks from modelinstance tests
lukemckinstry a1e5031
documentation updates from model scene graph refactor
lukemckinstry c2b5144
Fix ModelInstanceCollection.js remove
rudacs 9fb8bb1
Update ModelInstanceCollection.js remove
rudacs a7386b3
Fix PickingPipelineStage.js pick instances
rudacs e82f194
Update CONTRIBUTORS.md
rudacs 7868bd6
Exposing the ModelInstance transform property
rudacs 17a6e97
Adjustment in PickingPipelineStage to pass the pickId to the ModelIns…
rudacs 74616b0
Update ModelInstanceCollection.js returns type
31ff654
Update PickingPipelineStage.js to work in glTF and i3dm
rudacs 084f098
Update PickingPipelineStage.js checking if the index exists
rudacs b039472
fix instance collection tests
lukemckinstry 3ed0305
update docs for command model matrix and bounding sphere
lukemckinstry 736c752
update inline docs for model scene graph refactor
lukemckinstry c954e9f
more cleanup from scene graph refactor
lukemckinstry 58d9416
add back update draw command bounding sphere when model matrix changes
lukemckinstry 4b9736e
change name of run node transform dirty param in spec
lukemckinstry 4765fd1
modify spec helpers
lukemckinstry 7e8ffdd
fix picking spec sample data
lukemckinstry e224c2b
prettier
lukemckinstry d509f6b
ts doc fix
lukemckinstry ae14daa
include js extension for ECMAscript module imports
lukemckinstry 5e1a164
use js ext on module import
lukemckinstry 87a8c81
scale by instance
lukemckinstry 9feb546
cleanup code
lukemckinstry a7322f2
update model instance tests for dynamic scaling
lukemckinstry 7dde3f0
sandcastle fixes
lukemckinstry f1a23e2
scale down and simplify windturbine gltf
lukemckinstry b152f3e
move nodesByName to scene graph
lukemckinstry 69c03a4
make scene graph traversal a private member function
lukemckinstry da38138
simplify transforms in sandcastle
lukemckinstry 30b465e
remove earth centered todo
lukemckinstry 1f08d9f
runtime error for runtime instancing on instanced model
lukemckinstry 0ec82bc
set up runtime instances when transforms passed to model options
lukemckinstry 4040db5
document scene graph attributes
lukemckinstry 4381c3a
runtime error when trying to add instance to model with ext mesh gpu …
lukemckinstry 4debff8
move ext mesh gpu instancing check
lukemckinstry 29f6f5d
spec fixes
lukemckinstry 75f606f
update changelog
lukemckinstry a5aa6e5
bug fix turn off dirty flag in update stage
lukemckinstry 063dbd0
skip update stage if min pixel size not set
lukemckinstry 2af7371
update test
lukemckinstry e611a7b
prettier
lukemckinstry 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
Binary file not shown.
634 changes: 634 additions & 0 deletions
634
Apps/Sandcastle/gallery/3D Model Instancing Terrain.html
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" | ||
/> | ||
<meta name="description" content="Create 3D models using glTF." /> | ||
<meta name="cesium-sandcastle-labels" content="Tutorials,Showcases" /> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script | ||
type="text/javascript" | ||
src="../../../Build/CesiumUnminified/Cesium.js" | ||
nomodule | ||
></script> | ||
<script type="module" src="../load-cesium-es6.js"></script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"></div> | ||
<script id="cesium_sandcastle_script"> | ||
window.startup = async function (Cesium) { | ||
"use strict"; | ||
//Sandcastle_Begin | ||
const viewer = new Cesium.Viewer("cesiumContainer"); | ||
|
||
let model; | ||
try { | ||
model = await Cesium.Model.fromGltfAsync({ | ||
url: "../../SampleData/models/GroundVehicle/GroundVehicle.glb", | ||
minimumPixelSize: 64, | ||
}); | ||
viewer.scene.primitives.add(model); | ||
} catch (error) { | ||
console.log(`Failed to load model. ${error}`); | ||
} | ||
|
||
const lng = -75.1652; | ||
const lat = 39.9526; | ||
|
||
let position; | ||
|
||
let instanceTransform; | ||
for (let i = 0; i < 10; i++) { | ||
position = Cesium.Cartesian3.fromDegrees( | ||
lng + i * Math.random() * 0.0001, | ||
lat + i * 0.0001, | ||
); | ||
instanceTransform = new Cesium.Transforms.eastNorthUpToFixedFrame(position); | ||
model.instances.add(instanceTransform); | ||
} | ||
|
||
viewer.scene.camera.setView({ | ||
destination: new Cesium.Cartesian3( | ||
1253512.5232461668, | ||
-4732922.214567729, | ||
4074115.474546098, | ||
), | ||
orientation: new Cesium.HeadingPitchRoll( | ||
2.205737333179613, | ||
-0.7255022564055849, | ||
6.283181225638178, | ||
), | ||
}); | ||
|
||
let instance; | ||
let rotation = new Cesium.Matrix3(); | ||
let newTransform; | ||
// modify the instance transform by supplying a new rotations after a delay | ||
setTimeout(() => { | ||
for (let i = 0; i < model.instances.length; i++) { | ||
instance = model.instances.get(i); | ||
rotation = Cesium.Matrix4.getRotation(instance.transform, rotation); | ||
newTransform = Cesium.clone(instance.transform); | ||
|
||
const angleDegrees = Math.random() * 180; | ||
const angleRadians = Cesium.Math.toRadians(angleDegrees); | ||
const rotationZ = Cesium.Matrix3.fromRotationZ(angleRadians); | ||
const newRotation = Cesium.Matrix3.multiply( | ||
rotationZ, | ||
rotation, | ||
new Cesium.Matrix3(), | ||
); | ||
newTransform = Cesium.clone(instance.transform); | ||
Cesium.Matrix4.setRotation(newTransform, newRotation, newTransform); | ||
instance.transform = newTransform; | ||
} | ||
}, "6000"); | ||
//Sandcastle_End | ||
}; | ||
if (typeof Cesium !== "undefined") { | ||
window.startupCalled = true; | ||
window.startup(Cesium).catch((error) => { | ||
"use strict"; | ||
console.error(error); | ||
}); | ||
Sandcastle.finishedLoading(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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
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.
@lukemckinstry Once the public API is where you'd like it, a reminder to clean up the Sandcastle example.
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.
Apps/Sandcastle/gallery/3D Model Instancing Terrain.html
is the sandcastle I think is best to release. This has a new wind turbine glb added to the SampleData folder. I believe the CC license makes using it ok #12588 (comment)