use of org.cesiumjs.cs.scene.apperances.options.PerInstanceColorAppearanceOptions in project gwt-cs by iSergio.
the class PerInstanceColorAppearance method create.
@JsOverlay
public static PerInstanceColorAppearance create(boolean closed) {
PerInstanceColorAppearanceOptions options = new PerInstanceColorAppearanceOptions();
options.closed = closed;
return new PerInstanceColorAppearance(options);
}
use of org.cesiumjs.cs.scene.apperances.options.PerInstanceColorAppearanceOptions in project gwt-cs by iSergio.
the class CesiumInspector method buildPanel.
@Override
public void buildPanel() {
ViewerPanel csVPanel = new ViewerPanel();
Scene scene = csVPanel.getViewer().scene();
Globe globe = csVPanel.getViewer().scene().globe;
globe.depthTestAgainstTerrain = true;
CesiumTerrainProviderOptions cesiumTerrainProviderOptions = new CesiumTerrainProviderOptions();
cesiumTerrainProviderOptions.url = "https://assets.agi.com/stk-terrain/world";
cesiumTerrainProviderOptions.requestVertexNormals = true;
cesiumTerrainProviderOptions.requestWaterMask = true;
csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(cesiumTerrainProviderOptions);
// Add Cesium Inspector
csVPanel.getViewer().extend(viewerCesiumInspectorMixin.instance());
// Add Primitives
PrimitiveOptions primitiveOptions = new PrimitiveOptions();
primitiveOptions.asynchronous = false;
GeometryInstanceOptions geometryInstanceOptions = new GeometryInstanceOptions();
BoxGeometryOptions boxGeometryOptions = new BoxGeometryOptions();
boxGeometryOptions.vertexFormat = PerInstanceColorAppearance.VERTEX_FORMAT();
boxGeometryOptions.dimensions = new Cartesian3(400000.0, 300000.0, 500000.0);
geometryInstanceOptions.geometry = BoxGeometry.createGeometry(BoxGeometry.fromDimensions(boxGeometryOptions));
geometryInstanceOptions.modelMatrix = Matrix4.multiplyByTranslation(Transforms.eastNorthUpToFixedFrame(Cartesian3.fromDegrees(-105.0, 45.0)), new Cartesian3(0.0, 0.0, 250000), new Matrix4());
geometryInstanceOptions.attributes = JsObject.createObject().cast();
JsObject.$(geometryInstanceOptions.attributes, "color", ColorGeometryInstanceAttribute.fromColor(Color.RED().withAlpha(0.5f)));
primitiveOptions.geometryInstances = new GeometryInstance[] { new GeometryInstance(geometryInstanceOptions) };
PerInstanceColorAppearanceOptions perInstanceColorAppearanceOptions = new PerInstanceColorAppearanceOptions();
perInstanceColorAppearanceOptions.closed = true;
primitiveOptions.appearance = new PerInstanceColorAppearance(perInstanceColorAppearanceOptions);
scene.primitives().add(new Primitive(primitiveOptions));
primitiveOptions = new PrimitiveOptions();
primitiveOptions.asynchronous = false;
geometryInstanceOptions = new GeometryInstanceOptions();
RectangleGeometryOptions rectangleGeometryOptions = new RectangleGeometryOptions();
rectangleGeometryOptions.rectangle = Rectangle.fromDegrees(-100.0, 30.0, -93.0, 37.0);
rectangleGeometryOptions.height = 100000;
rectangleGeometryOptions.vertexFormat = PerInstanceColorAppearance.VERTEX_FORMAT();
geometryInstanceOptions.geometry = RectangleGeometry.createGeometry(new RectangleGeometry(rectangleGeometryOptions));
geometryInstanceOptions.attributes = JsObject.createObject().cast();
JsObject.$(geometryInstanceOptions.attributes, "color", ColorGeometryInstanceAttribute.fromColor(Color.BLUE()));
primitiveOptions.geometryInstances = new GeometryInstance[] { new GeometryInstance(geometryInstanceOptions) };
primitiveOptions.appearance = new PerInstanceColorAppearance();
scene.primitives().add(new Primitive(primitiveOptions));
BillboardCollection billboards = (BillboardCollection) scene.primitives().add(new BillboardCollection());
BillboardOptions billboardOptions = new BillboardOptions();
billboardOptions.position = Cartesian3.fromDegrees(-75.59777, 40.03883, 150000);
billboardOptions.image = GWT.getModuleBaseURL() + "images/Cesium_Logo_overlay.png";
billboards.add(billboardOptions);
contentPanel.add(new HTML("<p>Use the cesium inspector as a debugging tool for different primitives</p>"));
contentPanel.add(csVPanel);
initWidget(contentPanel);
}
Aggregations