You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
I want to update the ViewRenderable of a Node.
For that usecase I build a Map with all my ViewRenderables I want to attach to a Node. Actually the ViewRenderables are not stored directly into the Map but as a CompletableFuture Object.
In my application I can place Nodes on the Scene. I also store them into a List to keep track of the amount of Nodes I have already placed. Based on the position of the Node in the List I want to change the ViewRenderbale.
The check is done on every onUpdate(Frame frame) call. Sure I only want to replace the Renderable once, for that I have a check if a Renderable was already replaced.
The function to replace the ViewRenderable on a Node looks like this
I'm not sure about the getNode().setRenderable(null); part.
and the decission is made by this simple loop
for (int i = 0; i < mVolumeBoundingPointList.size(); i++) {
// Come back the next frame
if (mVolumeBoundingPointList.get(i).getImageRenderable() == null && mVolumeBoundingPointList.get(i).getImageRenderable().getNode() == null)
return;
LoggerHelper.showLog(Log.DEBUG, TAG, "Check VolumeBoundingPoint: " + i);
ImageRenderable imageRenderable = mVolumeBoundingPointList.get(i).getImageRenderable();
// Update the first VolumeBoundingPoint
if (i == 0 && mVolumeBoundingPointList.size() == 1) {
if (imageRenderable.getRenderableState() != RenderableTypeEnums.VOLUME_BOUNDING_ENABLED_START) {
LoggerHelper.showLog(Log.DEBUG, TAG, "Update Renderable of first VolumeBoundingPoint");
imageRenderable.updateRenderable(RenderableTypeEnums.VOLUME_BOUNDING_ENABLED_START);
}
}
// Update the last VolumeBoundingPoint
if (i == mVolumeBoundingPointList.size() - 1 && mVolumeBoundingPointList.size() > 1) {
if (imageRenderable.getRenderableState() != RenderableTypeEnums.VOLUME_BOUNDING_ENABLED_END) {
LoggerHelper.showLog(Log.DEBUG, TAG, "Update Renderable of last VolumeBoundingPoint");
imageRenderable.updateRenderable(RenderableTypeEnums.VOLUME_BOUNDING_ENABLED_END);
}
}
// Update the all VolumeBoundingPoint between the first and last VolumeBoundingPoint
if (i > 0 && i < mVolumeBoundingPointList.size() - 1) {
if (imageRenderable.getRenderableState() != RenderableTypeEnums.VOLUME_BOUNDING_ENABLED) {
LoggerHelper.showLog(Log.DEBUG, TAG, "Update Renderable between first and last VolumeBoundingPoint");
imageRenderable.updateRenderable(RenderableTypeEnums.VOLUME_BOUNDING_ENABLED);
}
}
}
The result ist very Inconsistent. The first and the last point is rendered as expected, but the points in between have the complete variety of ViewRenderables attached to them. They flicker. The following is shown:
nothing
the camera view
the ViewRenderable for the start, the end or in between.
And flickering happens if I move the smartphone.
Maybe someone could explain to me the propper way to replace a Renderable, because I'm lost.
Sceneform-Version: 1.15.0
The text was updated successfully, but these errors were encountered:
The ViewRenderable for the type RenderableTypeEnums.VOLUME_BOUNDING_ENABLED is my default ViewRenderable. All my Nodes get this after the creation.
if I change
if (i > 0 && i < mVolumeBoundingPointList.size() - 1) {
if (imageRenderable.getRenderableState() != RenderableTypeEnums.TRACKING_VIEW_ENABLED) {
LoggerHelper.showLog(Log.DEBUG, TAG, "Update Renderable between first and last VolumeBoundingPoint");
imageRenderable.updateRenderable(RenderableTypeEnums.TRACKING_VIEW_ENABLED);
imageRenderable.setRenderableState(RenderableTypeEnums.TRACKING_VIEW_ENABLED);
}
}
to
if (i > 0 && i < mVolumeBoundingPointList.size() - 1) {
if (imageRenderable.getRenderableState() != RenderableTypeEnums.TRACKING_VIEW_ENABLED_START) {
LoggerHelper.showLog(Log.DEBUG, TAG, "Update Renderable between first and last VolumeBoundingPoint");
imageRenderable.updateRenderable(RenderableTypeEnums.TRACKING_VIEW_ENABLED_START);
imageRenderable.setRenderableState(RenderableTypeEnums.TRACKING_VIEW_ENABLED_START);
}
}
Or introduce a fourth ViewRenerable, the points in between behave normal, getting the new ViewRenderable and don't flicker.
So whatever ViewRenderable is attached the first time, can't be reattached.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to update the ViewRenderable of a Node.
For that usecase I build a Map with all my ViewRenderables I want to attach to a Node. Actually the ViewRenderables are not stored directly into the Map but as a CompletableFuture Object.
In my application I can place Nodes on the Scene. I also store them into a List to keep track of the amount of Nodes I have already placed. Based on the position of the Node in the List I want to change the ViewRenderbale.
The check is done on every onUpdate(Frame frame) call. Sure I only want to replace the Renderable once, for that I have a check if a Renderable was already replaced.
The function to replace the ViewRenderable on a Node looks like this
I'm not sure about the getNode().setRenderable(null); part.
and the decission is made by this simple loop
The result ist very Inconsistent. The first and the last point is rendered as expected, but the points in between have the complete variety of ViewRenderables attached to them. They flicker. The following is shown:
And flickering happens if I move the smartphone.
Maybe someone could explain to me the propper way to replace a Renderable, because I'm lost.
Sceneform-Version: 1.15.0
The text was updated successfully, but these errors were encountered: