I've been trying to use the Geometry system and have run into some issues with outlines. I'm not sure if they are bugs, design decisions or simply things I'm doing wrong.
1. It looks like OutlineGeometry requires "flat:true" to be passed to PerInstanceColorAppearance and does not work without it (complains about lack of normals, even if I create the geometry with VertexFormat.ALL.) Is this a bug? Why don't outline geometries just work with the Polyline appearance types since they are always polylines (I get an error about missing nextPosition3DLow).
2. Can I use MaterialAppearance with OutlineGeometry, or is it limited to just color? I tried but had the same problem as above.
3. Why can't I specify an outline width like I can for polylines? It seems odd to have to specify a lineWidth property as part of a renderstate option to the appearance, and it doesn't work at all under ANGLE.
Like I said, maybe I'm doing something wrong, Here's the modified Polygon Outline Sandcastle example.
require(['Cesium'], function(Cesium) {
"use strict";
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var primitives = scene.getPrimitives();
var ellipsoid = viewer.centralBody.getEllipsoid();
// Green extruded polygon outline
var polygonHierarchy = {
positions : ellipsoid.cartographicArrayToCartesianArray([
Cesium.Cartographic.fromDegrees(-108.0, 30.0),
Cesium.Cartographic.fromDegrees(-98.0, 30.0),
Cesium.Cartographic.fromDegrees(-98.0, 40.0),
Cesium.Cartographic.fromDegrees(-108.0, 40.0)
]),
holes : [{
positions : ellipsoid.cartographicArrayToCartesianArray([
Cesium.Cartographic.fromDegrees(-106.0, 31.0),
Cesium.Cartographic.fromDegrees(-106.0, 39.0),
Cesium.Cartographic.fromDegrees(-100.0, 39.0),
Cesium.Cartographic.fromDegrees(-100.0, 31.0)
])
}]
};
var extrudedHeight = 500000.0;
var greenPolygonOutlineInstance = new Cesium.GeometryInstance({
geometry : new Cesium.PolygonOutlineGeometry({
polygonHierarchy : polygonHierarchy,
extrudedHeight : extrudedHeight,
vertexFormat : Cesium.VertexFormat.ALL
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)
}
});
// Add polygon outline instances to primitives
primitives.add(new Cesium.Primitive({
geometryInstances : [greenPolygonOutlineInstance],
appearance : new Cesium.PerInstanceColorAppearance()
}));
Sandcastle.finishedLoading();
});