AnalyticalGraphicsInc/cesium — pull request #911 by pjcozzi (2013-06-28 22:45:12+00:00)
Title: Geometry and Appearances

[Sandcastle example](http://localhost:8080/Apps/Sandcastle/index.html?src=Geometry%20and%20Appearances.html) screenshot:

![image](https://f.cloud.github.com/assets/782098/724913/28870688-e043-11e2-9c6b-511fd069c252.png)

For context, read the [draft tutorials](https://github.com/AnalyticalGraphicsInc/cesium/wiki/Geometry-and-Appearances). From the tutorials:

> A geometry defines the primitive's structure, i.e., the triangles, lines, or points composing the primitive. An appearance defines the primitive's shading, including its full GLSL vertex and fragment shaders, and render state.

Also see the [roadmap](https://github.com/AnalyticalGraphicsInc/cesium/issues/766) for an intro (slightly outdated) and future work.

From [CHANGES.md](https://github.com/AnalyticalGraphicsInc/cesium/blob/batching/CHANGES.md):

* Breaking changes:
* Replaced tessellators and meshes with geometry. In particular:
* Replaced `CubeMapEllipsoidTessellator` with `EllipsoidGeometry`.
* Replaced `BoxTessellator` with `BoxGeometry`.
* Replaced `ExtentTessletaor` with `ExtentGeometry`.
* Removed `PlaneTessellator`. It was incomplete and not used.
* Renamed `MeshFilters` to `GeometryPipeline`.
* Renamed `MeshFilters.toWireframeInPlace` to `GeometryPipeline.toWireframe`.
* Removed `MeshFilters.mapAttributeIndices`. It was not used.
* Renamed `Context.createVertexArrayFromMesh` to `Context.createVertexArrayFromGeometry`. Likewise, renamed `mesh` constructor property to `geometry`.
* Renamed `ComponentDatatype.*.toTypedArray` to `ComponentDatatype.*.createTypedArray`.
* Removed `Polygon.configureExtent`. Use `ExtentPrimitive` instead.
* Removed `Polygon.bufferUsage`. It is no longer needed.
* Removed `height` and `textureRotationAngle` arguments from `Polygon` `setPositions` and `configureFromPolygonHierarchy` functions. Use `Polygon` `height` and `textureRotationAngle` properties.
* Renamed `PolygonPipeline.cleanUp` to `PolygonPipeline.removeDuplicates`.
* Removed `PolygonPipeline.wrapLongitude`. Use `GeometryPipeline.wrapLongitude` instead.
* Added `height` parameter to `BoundingSphere.fromExtent3D`.
* Added `height` parameter to `Extent.subsample`.
* Added `ExtentPrimitive`.
* Added `Geometry` and `GeometryInstance`. Added the following geometry types:
* `PolygonGeometry`
* `ExtentGeometry`
* `EllipseGeometry`
* `CircleGeometry`
* `WallGeometry`
* `SimplePolylineGeometry`
* `BoxGeometry`
* `EllipsoidGeometry`
* Added appearances, which describe the visual characteristics for geometry instances. Added the following types:
* `Appearance`
* `PerInstanceColorAppearance`
* `EllipsoidSurfaceAppearance`
* Added `Primitive`, which is a generic primitive that combines geometry instances and appearances.
* Added `GeometryPipeline.combine` to combine meshes for better batching.
* Added `GeometryPipeline.computeNormal` to compute normals for a geometry.
* Added `GeometryPipeline.computeBinormalAndTangent` to compute binormals and tangent vectors for a geometry.
* Added `GeometryPipeline.wrapLongitude` to split geometry across the International Date Line.
* Added `GeometryPipeline.createLineSegmentsForVectors` and `createTangentSpaceDebugPrimitive` for debugging.
* Added `PolylinePipeline.removeDuplicates`.
* Added `barycentricCoordinates` to compute the barycentric coordinates of a point in a triangle.
* Added `BoundingSphere.fromEllipsoid`.
* Added `BoundingSphere.projectTo2D`.
* Added `Extent.fromDegrees`.
* Added `czm_tangentToEyeSpaceMatrix` built-in GLSL function.
* Improved the performance of drawing polygons created with `configureFromPolygonHierarchy`.

@bagnell - with some help from @hpinkos - will do the changes needed to merge this. I'm moving on to models. There are still a few outstanding changes that will be part of this:
* [ ] Finish tests and remove test code from Cesium Viewer.
* [ ] Fix texture coordinates on ellipses/circles, which look wrong in the Sandcastle example.
* [ ] Fix wall normals / `faceForward`, which look wrong in the Sandcastle example.

Other features - like extruded polygons and extents, and performance improvements (all in the near-term section of the [roadmap](https://github.com/AnalyticalGraphicsInc/cesium/issues/766)) - will be separate pull requests.

The draft tutorials will be finalized and published on the blog in August after b19.