qd-changjing/public/static/Build/CesiumUnminified/Workers/GeometryInstance-d57564f8.j...

1 line
5.8 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"GeometryInstance-d57564f8.js","sources":["../../../../Source/Core/GeometryInstance.js"],"sourcesContent":["import defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Matrix4 from \"./Matrix4.js\";\n\n/**\n * Geometry instancing allows one {@link Geometry} object to be positions in several\n * different locations and colored uniquely. For example, one {@link BoxGeometry} can\n * be instanced several times, each with a different <code>modelMatrix</code> to change\n * its position, rotation, and scale.\n *\n * @alias GeometryInstance\n * @constructor\n *\n * @param {Object} options Object with the following properties:\n * @param {Geometry|GeometryFactory} options.geometry The geometry to instance.\n * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates.\n * @param {Object} [options.id] A user-defined object to return when the instance is picked with {@link Scene#pick} or get/set per-instance attributes with {@link Primitive#getGeometryInstanceAttributes}.\n * @param {Object} [options.attributes] Per-instance attributes like a show or color attribute shown in the example below.\n *\n *\n * @example\n * // Create geometry for a box, and two instances that refer to it.\n * // One instance positions the box on the bottom and colored aqua.\n * // The other instance positions the box on the top and color white.\n * const geometry = Cesium.BoxGeometry.fromDimensions({\n * vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL,\n * dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0)\n * });\n * const instanceBottom = new Cesium.GeometryInstance({\n * geometry : geometry,\n * modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(\n * Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),\n * attributes : {\n * color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)\n * },\n * id : 'bottom'\n * });\n * const instanceTop = new Cesium.GeometryInstance({\n * geometry : geometry,\n * modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(\n * Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 3000000.0), new Cesium.Matrix4()),\n * attributes : {\n * color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)\n * },\n * id : 'top'\n * });\n *\n * @see Geometry\n */\nfunction GeometryInstance(options) {\n options = defaultValue(options, defaultValue.EMPTY_OBJECT);\n\n //>>includeStart('debug', pragmas.debug);\n if (!defined(options.geometry)) {\n throw new DeveloperError(\"options.geometry is required.\");\n }\n //>>includeEnd('debug');\n\n /**\n * The geometry being instanced.\n *\n * @type Geometry\n *\n * @default undefined\n */\n this.geometry = options.geometry;\n\n /**\n * The 4x4 transformation matrix that transforms the geometry from model to world coordinates.\n * When this is the identity matrix, the geometry is drawn in world coordinates, i.e., Earth's WGS84 coordinates.\n * Local reference frames can be used by providing a different transformation matrix, like that returned\n * by {@link Transforms.eastNorthUpToFixedFrame}.\n *\n * @type Matrix4\n *\n * @default Matrix4.IDENTITY\n */\n this.modelMatrix = Matrix4.clone(\n defaultValue(options.modelMatrix, Matrix4.IDENTITY)\n );\n\n /**\n * User-defined object returned when the instance is picked or used to get/set per-instance attributes.\n *\n * @type Object\n *\n * @default undefined\n *\n * @see Scene#pick\n * @see Primitive#getGeometryInstanceAttributes\n */\n this.id = options.id;\n\n /**\n * Used for picking primitives that wrap geometry instances.\n *\n * @private\n */\n this.pickPrimitive = options.pickPrimitive;\n\n /**\n * Per-