Skip to content
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

feat(PanoViewer): improve cubemap support #131

Merged
merged 17 commits into from
Jan 30, 2018
Merged

Conversation

happyhj
Copy link
Contributor

@happyhj happyhj commented Jan 22, 2018

Issue

#123

Details

feat

  • update examples for new image api
  • remove projectionType "vertical_cubestrip"
  • add projectionType "cubemap"
  • added tile config options to support various cube map layouts

fix

  • set preserveDrawingBuffer false only where the tremor occurs

test

  • increate mocha test timeout

chore

  • change script version to "latest" on demo site

I removed code for support old mobile browsers with "vertical_cubestrip" projection, which is removed from this PR. But we should still support for those browsers.
We will continue to work on the issues below.
#132

* increate mocha test timeout
* change script version to "latest" on demo site
* update examples for new image api
* remove projectionType "vertical_cubestrip"
* add projectionType "cubemap"
* set preserveDrawingBuffer false only where the tremor occurs
* added tile config options to support various cube map layouts

ref #123
mocha.opts Outdated
@@ -1 +1 @@
--timeout 10000

Choose a reason for hiding this comment

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

@happyhj Why change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I found we don't need to expand the timeout. I will revert that.

@@ -455,7 +480,7 @@ export default class PanoImageRenderer extends Component {
gl.uniformMatrix4fv(this.shaderProgram.mvMatrixUniform, false, this.mvMatrix);

if (this._isVideo) {
this._renderer.texImage2D(this.context, this._image);
this._bindTexture();

Choose a reason for hiding this comment

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

@happyhj Should it be bound again?

Copy link
Contributor Author

@happyhj happyhj Jan 25, 2018

Choose a reason for hiding this comment

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

I got it. I'll change the flow to prevent duplicated binding texture.

@@ -112,14 +114,34 @@ export default class PanoImageRenderer extends Component {
.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.
}

static extractImageSource(imgParam) {

Choose a reason for hiding this comment

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

@happyhj Isn't this job already done in contentLoader?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I will remove those methods.


try {
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);

Choose a reason for hiding this comment

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

Foll

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The renderer doesn't need to flip the texture anymore. Now we use texture coordinate like the sphere renderer.

gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);

this.texImage2D(gl, image);
if (image instanceof Array) {

Choose a reason for hiding this comment

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

It would be better to separate following codes as a texImage2D. Because it is not needed to call bindTexture on every frame.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

container,
{
projectionType: "cubemap",
video: {

Choose a reason for hiding this comment

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

@happyhj I didn't catch before... I feel it makes confusion... because video param tend to have too many types. How about to separate a cubemapConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for feedback. I will add cubemapConfig option as you said.

@naver naver deleted a comment from coveralls Jan 25, 2018
@@ -50,7 +50,7 @@ export default class SphereRenderer extends Renderer {
}`;
}

static bindTexture(gl, texture, image) {
static updateTexture(gl, texture, image) {
if (!image) {

Choose a reason for hiding this comment

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

updateTexture in SphereRenderer only need to call this.texImage2D and size check logic need to be moved to bindTexture

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, I'll apply that.

this._image,
this._imageConfig,
);
this._shouldForceDraw = true;

Choose a reason for hiding this comment

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

shouldForceDraw=true is not valid. because when user pause the video, it should not draw a frame.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll remove it.

@@ -245,6 +245,24 @@ describe("PanoViewer", function() {
});
});

describe("#setter/getter", function() {

Choose a reason for hiding this comment

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

I did't understand this test describe block. because it doesn't have it block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I'll remove that.

@@ -43,8 +43,7 @@ describe("WebglUtils", function() {

[
{os: {name: "android", version: "4.3"}, browser: {name: "chrome"}},
{os: {name: "android", version: "4.4"}, browser: {name: "samsung internet"}},
{os: {name: "ios", version: "7"}, browser: {name: "safari"}}

Choose a reason for hiding this comment

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

Why remove {os: {name: "ios", version: "7"}, browser: {name: "safari"}}?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iOS 7 safari don't support webgl. So I removed conditional logic in isStableWebGL method. and added checking webgl support using isWebGLAvailable method before conditional logic in isStableWebGL.

In real iOS7 device, isStableWebGL will return false because it is not support webgl.
It's not valid test anymore before mocking no-webgl environment.

if (!image) {
return;
}
static updateTexture(gl, texture, image, imageConfig) {

Choose a reason for hiding this comment

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

texture param is not used.

@@ -50,6 +50,11 @@ export default class SphereRenderer extends Renderer {
}`;
}

static updateTexture(gl, texture, image) {
// Draw first frame
this.texImage2D(gl, image);

Choose a reason for hiding this comment

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

I think it's better to remove texImage2D method and replace this function with following

static updateTexture(gl, image) {
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
}

@@ -155,8 +155,11 @@ <h2>Visible Activation</h2>
key = (new Date()).getTime() + idx;

instance = new eg.view360.PanoViewer(viewerEl,{
image: viewerEl.getAttribute("data-source"),
projectionType: "vertical_cubestrip"
image: {

Choose a reason for hiding this comment

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

@happyhj image should not have cubemap config

_updateTexture() {
this._renderer.updateTexture(
this.context,
this.texture,

Choose a reason for hiding this comment

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

@happyhj texture param is no more need

Copy link

@jongmoon jongmoon left a comment

Choose a reason for hiding this comment

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

LGTM

@happyhj happyhj merged commit 29a81bd into 3.0.0-rc Jan 30, 2018
@jongmoon jongmoon mentioned this pull request Mar 19, 2018
@jongmoon jongmoon deleted the CubeRenderer#123 branch March 29, 2018 09:46
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.

2 participants