-
Notifications
You must be signed in to change notification settings - Fork 3.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
Models 2D/CV support #3764
Models 2D/CV support #3764
Conversation
…pport Model.minimumPixelSize.
/** | ||
* @private | ||
*/ | ||
Transforms.basisTo2D = function(projection, matrix, result) { |
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 know this is private
, but is it worth writing a unit tests for?
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 was moved from Camera
that has a bunch of tests to make sure camera reference frames work in all scene modes. I'll add a couple of explicit tests though.
Add a unit test for rendering in 2D and in CV. |
Update CHANGES.md. |
@@ -28,7 +28,6 @@ | |||
'use strict'; | |||
//Sandcastle_Begin | |||
var viewer = new Cesium.Viewer('cesiumContainer', { | |||
scene3DOnly: true, |
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 you check all the Sandcastle examples with scene3DOnly: true
. Perhaps the development on and CZML examples?
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.
They are all OK.
OK with me, but update it's doc to state that. |
Part of #927. |
Also add info to the |
@@ -3088,12 +3098,13 @@ define([ | |||
* @exception {RuntimeError} Failed to load external reference. | |||
*/ | |||
Model.prototype.update = function(frameState) { | |||
if (frameState.mode !== SceneMode.SCENE3D) { | |||
if (frameState.mode === SceneMode.MORPHING) { |
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 imagine implement this will be non-trivial? It doesn't need to be part of this PR, but we could also fade it out/in.
|
Cool! Let me know when this is ready for another review. @mramato let us know if you convert the demo CZML. |
As discussed offline, let's detect when the model crosses the IDL and draw in both viewports. |
@bagnell let's aim to ship this for Cesium 1.22. Is there anything else needed besides #3764 (comment)? |
@pjcozzi The z-fighting mentioned in #3764 (comment) is still an issue. We discussed a couple ways to fix it offline that I haven't tried yet. |
Fix model 2D z-fighting
Fix models in 2D near the IDL.
Yes, this should be good to go. The only change in this branch that wasn't reviewed or in the z-fighting or IDL PRs was some test fixes. |
Make the minimum pixel size 800 and infinite 2D goes away. Is this because the model's bounding sphere is so big? var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false
});
function createModel(url, height) {
viewer.entities.removeAll();
var position = Cesium.Cartesian3.fromDegrees(-179.0744619, 44.0503706, height);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);
var entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 800,
//maximumScale : 20000
}
});
viewer.trackedEntity = entity;
}
var options = [{
text : 'Aircraft',
onselect : function() {
createModel('../../SampleData/models/CesiumAir/Cesium_Air.glb', 5000.0);
}
}, {
text : 'Ground vehicle',
onselect : function() {
createModel('../../SampleData/models/CesiumGround/Cesium_Ground.glb', 0);
}
}, {
text : 'Milk truck',
onselect : function() {
createModel('../../SampleData/models/CesiumMilkTruck/CesiumMilkTruck-kmc.glb', 0);
}
}, {
text : 'Skinned character',
onselect : function() {
createModel('../../SampleData/models/CesiumMan/Cesium_Man.glb', 0);
}
}];
Sandcastle.addToolbarMenu(options); |
The tests pass and all the code looks good. Just that comment. |
Turns out I was in CV. |
Adds support for rendering models in 2D and Columbus view.
Model.minimumPixelSize
is not supported.The only thing is changed is the computed model matrix. If the model is supposed to be deformed in 2D like other geometry, then the vertices need to be projected to 2D and this can be closed.