Using Geometry when creating Primitives

712 views
Skip to first unread message

Brendan Studds

unread,
Feb 12, 2015, 12:04:25 AM2/12/15
to cesiu...@googlegroups.com
Hi all,

We've been using the Geometry object directly (see snippet below) to make custom 3D primitives. Recently we've upgraded from cesium version 1.0 to 1.6 and this causes Primitive.update to throw an error that "_workerName is not defined" on rendering.

Looking into this, I think there meant to be a worker defined to convert the specific type of geometry (eg. createBoxGeometry for BoxGeometry ) to the Geometry object type. As we are not using one of the specific Geometry types, there is no worker to convert it.

I can fix this by not using the workers and rendering the primitives synchronously, which would not be a good option. Alternatively, I've modified Geometry to have a _workerName and created a corresponding worker in Cesium, but this seems a temporary solution. Does anyone have any suggestions for a more permanent solution?

Thanks,
Brendan Studds


Current code;
var attributes = new GeometryAttributes({
  position
: new GeometryAttribute({
    componentDatatype
: ComponentDatatype.DOUBLE,
    componentsPerAttribute
: 3,
    values
: this._positions
 
})
});
var geometry = new Geometry({
  attributes
: attributes,
  indices
: this._indices,
  primitiveType
: PrimitiveType.TRIANGLES,
  boundingSphere
: BoundingSphere.fromVertices(this._positions)
});
var instance = new GeometryInstance({
  id
: id,
  geometry
: geometry,
  attributes
: {
    color
: color
 
}
});
var primitive = new Primitive({
  geometryInstances
: instance,
  appearance
: new PerInstanceColorAppearance({
    flat
: false,
    translucent
: false
 
})
});


Matthew Amato

unread,
Feb 12, 2015, 9:35:49 AM2/12/15
to cesiu...@googlegroups.com
Can you try adding `asynchronous : false` to the Primitive constructor.  Since your geometry is already created, it shouldn't affect behavior but will avoid the issue.  This is a bug either way because we should recognize already created geometry.  I created this issue so we fix it either way: https://github.com/AnalyticalGraphicsInc/cesium/issues/2488

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Amato

unread,
Feb 12, 2015, 9:37:43 AM2/12/15
to cesiu...@googlegroups.com
Just to clarify, Primitives are always rendered synchronously, setting asynchronous to false controls geometry creation, not rendering.  Since you have a Primitive with a single geometry that is already created, it won't change performance at all.

Brendan Studds

unread,
Feb 15, 2015, 8:41:31 PM2/15/15
to cesiu...@googlegroups.com
I see, clearly had a flawed understanding of that. Adding 'asynchronous: false' does solve the problem. Thanks for clarifying that.
Reply all
Reply to author
Forward
0 new messages