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

Missing notification of changed 3d Tile Style #5378

Closed
SunBlack opened this issue May 30, 2017 · 5 comments
Closed

Missing notification of changed 3d Tile Style #5378

SunBlack opened this issue May 30, 2017 · 5 comments

Comments

@SunBlack
Copy link

Example:

var tileset = new Cesium3DTileset({url : 'data'});
tileset.style = new Cesium3DTileStyle({
	color: 'vec4(1.0, 0.0, 0.0, 1.0)'
});
setTimeout(function() {
	tileset.style.color = new Expression('vec4(0.0, 1.0, 0.0, 1.0)');
}, 10000);

Expected: Color of displayed changes from red to green.
Got: Only new loaded data are displayed green.

Current workaround:

setTimeout(function() {
	tileset.style = new Cesium3DTileStyle({
		color: 'vec4(0.0, 1.0, 0.0, 1.0)'
	});
}, 10000);

How this can be fixed: In case a value is changed there should be triggered an event to make style dirty. On this way all shader will be recompiled. In some cases, e.g. pointSize it is not necessary to recompile shader, because the size of points are stored in a uniform (I have no idea when the uniform currently will be ever adjusted).

@lilleyse lilleyse mentioned this issue May 30, 2017
23 tasks
@lilleyse
Copy link
Contributor

Another workaround is to call tileset.makeStyleDirty().

@pjcozzi
Copy link
Contributor

pjcozzi commented May 31, 2017

Calling tileset.makeStyleDirty() is not a workaround; it is the right way to do this.

Otherwise, styling would be too slow since each feature would have to evaluate the style each frame.

@pjcozzi pjcozzi closed this as completed May 31, 2017
@pjcozzi
Copy link
Contributor

pjcozzi commented May 31, 2017

@lilleyse consider adding this to a Sandcastle example in #5308. I had it at one point but looks like it was removed.

@SunBlack
Copy link
Author

I was thinking about a signal which Cesium3DTileStyle send to all Cesium3DTileset which are using this style. On this way Cesium3DTileset don't need to check if a style has been changed.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 31, 2017

@SunBlack feel free to explore and open a PR for discussion. It's been awhile since I designed this but I might have also ruled that out for complexity or performance, but it could be worth reevaluating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants