1 line
5.8 KiB
Plaintext
1 line
5.8 KiB
Plaintext
{"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-instance attributes like {@link ColorGeometryInstanceAttribute} or {@link ShowGeometryInstanceAttribute}.\n * {@link Geometry} attributes varying per vertex; these attributes are constant for the entire instance.\n *\n * @type Object\n *\n * @default undefined\n */\n this.attributes = defaultValue(options.attributes, {});\n\n /**\n * @private\n */\n this.westHemisphereGeometry = undefined;\n /**\n * @private\n */\n this.eastHemisphereGeometry = undefined;\n}\nexport default GeometryInstance;\n"],"names":["defaultValue","defined","DeveloperError","Matrix4"],"mappings":";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