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
In order to modify the color of polygon outlines, you can use the approach in the sandcastle which uses PerInstanceColorAppearance and then use:
var geometryAtts = primitive.getGeometryInstanceAttributes(geometry.id);
geometryAtts.color = ColorGeometryInstanceAttribute.toValue(fillColor);
The problem is that this needs Primitive#update() to be called before use, which I cannot guarantee. Using Material works fine for PolygonGeometry and you modify the color by setting it on appearance.material.uniforms.color. The same does not work for PolygonOutlineGeometry and I'm not sure why. Here is my construction code:
var outlineGeometry = new GeometryInstance({
geometry: new PolygonOutlineGeometry({
polygonHierarchy: polygonHierarchy,
height: elevation,
extrudedHeight: elevation + height,
vertexFormat: VertexFormat.POSITION_AND_ST
})
});
var outlineAppearance = new EllipsoidSurfaceAppearance({
material: new Material({
fabric: {
type: 'Color',
uniforms: {
color: borderColor
}
},
translucent: false
})
});
var outlinePrimitive = new Primitive({
geometryInstances: outlineGeometry,
appearance: outlineAppearance
});
I get the following error:
DeveloperError: Appearance/Geometry mismatch. The appearance requires vertex shader attribute input 'st', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.
I am setting the correct VertexFormat, so I'm not sure why it's failing.
The text was updated successfully, but these errors were encountered:
Unfortunately, the only appearance supported by all outlined geometry is PerInstanceColorAppearance. I believe @bagnell looked into supporting other types at some point, but there were issues with making it look good (Polyline materials are incredibly complex, see the blog post about it here). He can keep me honest here and chime in with his thoughts
To work around the Primitve.update before use issue; you can wait for Primitive.ready to be true before executing your code. I thought we also added an event that gets fired; but that does not appear to be the case. I'll look into adding one for the next release.
Thanks for that clarification. I can probably use a wrapper method which waits on update with a while loop and maybe even uses a promise, and maybe a timeout of 5 seconds or so.
In order to modify the color of polygon outlines, you can use the approach in the sandcastle which uses
PerInstanceColorAppearance
and then use:The problem is that this needs
Primitive#update()
to be called before use, which I cannot guarantee. UsingMaterial
works fine forPolygonGeometry
and you modify the color by setting it onappearance.material.uniforms.color
. The same does not work forPolygonOutlineGeometry
and I'm not sure why. Here is my construction code:I get the following error:
I am setting the correct
VertexFormat
, so I'm not sure why it's failing.The text was updated successfully, but these errors were encountered: