Skip to content

Camera target control - #733

Merged
elalish merged 18 commits into
masterfrom
target
Sep 10, 2019
Merged

elalish merged 18 commits into
masterfrom
target

Conversation

@elalish

@elalish elalish commented Aug 29, 2019 •

Copy link
Copy Markdown
Contributor

Fixes #453
Fixes #603
Fixes #679

In the process of removing align-model I was able to simplify our logic considerably, including cleaning up how the static shadow is placed, since I was having trouble following its logic as I was debugging. The target is interpolated along with the other camera parameters, so this should allow us to do a smooth transition that includes zooming, position and rotation, and once combined with #729, without going through the model.

I only removed a function from staging.ts, but it seems it wasn't formatted before? Because everything got reflowed. I'm assuming it's correct now...

#679 turned out to be mostly not a bug, but we noticed that it did show an incorrect shadow for large models. The refactor of StaticShadow here should fix this.

@elalish
elalish requested a review from cdata August 29, 2019 22:16
@elalish elalish self-assigned this Aug 29, 2019
@cdata cdata added this to the v0.7.0 milestone Sep 6, 2019

@cdata cdata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good so far, but let's have some discussion about the API changes!

Comment thread src/features/controls.ts
}

getCameraTarget(): Vector3 {
return this[$controls].getTarget();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/features/controls.ts Outdated
[$updateCameraTarget]() {
let target = deserializeVector3(this.cameraTarget);

if (target == null) { // this happens in the default 'auto' case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's deserialize to 'auto' in this case. The code will be more self-explanatory, and it will line up with what we do for deserializing sphericals.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relatedly, it seems likely that I would want to be able to set 'auto' per-axis of the vector. For example, maybe I want the target to be automatically selected for me along the y axis, while panning the camera along the x axis.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was on the fence about that already. Sounds good.

Comment thread src/model-viewer-base.ts Outdated
return this[$loaded];
}

get loadedTime() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to make this public, is there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, will fix.

Comment thread src/three-components/SmoothControls.ts Outdated
// Controls when interaction is allowed (always, or only when focused)
interactionPolicy?: InteractionPolicy;
// The approximate size of the model (m)
modelSize?: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you offer more context for this new configuration parameter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, that's not needed. I can just reuse maximumRadius.

@elalish
elalish requested a review from cdata September 6, 2019 22:54
interactWith(canvas);

await timePasses(DEFAULT_INTERACTION_PROMPT_THRESHOLD + 100);
await timePasses(element.interactionPromptThreshold + 100);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@cdata cdata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this 🙌 LGTM

@elalish
elalish merged commit ed84f55 into master Sep 10, 2019
@elalish
elalish deleted the target branch September 10, 2019 15:36
cdata pushed a commit that referenced this pull request Sep 26, 2019
* Add slot documentation, fix typo

* Change "theautoplay" to "the autoplay" typo in animation.html
* Add beginning of documentation for slots with overriding-slots.html
* Add new slot documentation to index.html

* Bump mixin-deep from 1.3.1 to 1.3.2 (#726)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Camera target control (#733)

* partly there

* camera-target working

* fixed shadow

* cleanup

* made target interpolate

* fixed tests

* added target test

* updating CI test rules

* fixed comparison

* added loadedTime

* re-enabled skipped test

* removed extra wait

* addressing feedback

* adding auto

* looks like 584 is still flakey afterall

* another deflake attempt

* added camera-target doc

* updated three to r108 (#744)

* updated three to r108

* reverting model change

* Update fidelity test goldens

* Optimize images & rename to "Customizing UI"

Crush & convert example images to JPG's

Rename "Overriding Slots" to "Customizing UI"
elalish added a commit to elalish/model-viewer that referenced this pull request Feb 4, 2020
 
Camera target control (google#733)

* partly there

* camera-target working

* fixed shadow

* cleanup

* made target interpolate

* fixed tests

* added target test

* updating CI test rules

* fixed comparison

* added loadedTime

* re-enabled skipped test

* removed extra wait

* addressing feedback

* adding auto

* looks like 584 is still flakey afterall

* another deflake attempt

* added camera-target doc
elalish pushed a commit to elalish/model-viewer that referenced this pull request Feb 4, 2020
* Add slot documentation, fix typo

* Change "theautoplay" to "the autoplay" typo in animation.html
* Add beginning of documentation for slots with overriding-slots.html
* Add new slot documentation to index.html

* Bump mixin-deep from 1.3.1 to 1.3.2 (google#726)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <[email protected]>

* Camera target control (google#733)

* partly there

* camera-target working

* fixed shadow

* cleanup

* made target interpolate

* fixed tests

* added target test

* updating CI test rules

* fixed comparison

* added loadedTime

* re-enabled skipped test

* removed extra wait

* addressing feedback

* adding auto

* looks like 584 is still flakey afterall

* another deflake attempt

* added camera-target doc

* updated three to r108 (google#744)

* updated three to r108

* reverting model change

* Update fidelity test goldens

* Optimize images & rename to "Customizing UI"

Crush & convert example images to JPG's

Rename "Overriding Slots" to "Customizing UI"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object is black on some Android devices Deprecate / remove align-model attribute Configuration to control camera target

2 participants