12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367 |
- import AlphaMode from "./AlphaMode.js";
- import Cartesian3 from "../Core/Cartesian3.js";
- import Cartesian4 from "../Core/Cartesian4.js";
- import Matrix3 from "../Core/Matrix3.js";
- import Matrix4 from "../Core/Matrix4.js";
- /**
- * Components for building models.
- *
- * @namespace ModelComponents
- *
- * @private
- */
- const ModelComponents = {};
- /**
- * Information about the quantized attribute.
- *
- * @alias ModelComponents.Quantization
- * @constructor
- *
- * @private
- */
- function Quantization() {
- /**
- * Whether the quantized attribute is oct-encoded.
- *
- * @type {Boolean}
- * @private
- */
- this.octEncoded = false;
- /**
- * Whether the oct-encoded values are stored as ZXY instead of XYZ. This is true when decoding from Draco.
- *
- * @type {Boolean}
- */
- this.octEncodedZXY = false;
- /**
- * The range used to convert buffer values to normalized values [0.0, 1.0]
- * This is typically computed as (1 << quantizationBits) - 1.
- * For oct-encoded values this value is a single Number.
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.normalizationRange = undefined;
- /**
- * The bottom-left corner of the quantization volume. Not applicable for oct encoded attributes.
- * The type should match the attribute type - e.g. if the attribute type
- * is AttributeType.VEC4 the offset should be a Cartesian4.
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.quantizedVolumeOffset = undefined;
- /**
- * The dimensions of the quantization volume. Not applicable for oct encoded attributes.
- * The type should match the attribute type - e.g. if the attribute type
- * is AttributeType.VEC4 the dimensions should be a Cartesian4.
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.quantizedVolumeDimensions = undefined;
- /**
- * The step size of the quantization volume, equal to
- * quantizedVolumeDimensions / normalizationRange (component-wise).
- * Not applicable for oct encoded attributes.
- * The type should match the attribute type - e.g. if the attribute type
- * is AttributeType.VEC4 the dimensions should be a Cartesian4.
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.quantizedVolumeStepSize = undefined;
- /**
- * The component data type of the quantized attribute, e.g. ComponentDatatype.UNSIGNED_SHORT.
- *
- * <p>
- * The following component datatypes are not supported:
- * <ul>
- * <li>ComponentDatatype.INT</li>
- * <li>ComponentDatatype.UNSIGNED_INT</li>
- * <li>ComponentDatatype.DOUBLE</li>
- * </ul>
- * </p>
- *
- * @type {ComponentDatatype}
- * @private
- */
- this.componentDatatype = undefined;
- /**
- * The type of the quantized attribute, e.g. AttributeType.VEC2 for oct-encoded normals.
- *
- * @type {AttributeType}
- * @private
- */
- this.type = undefined;
- }
- /**
- * A per-vertex or per-instance attribute.
- *
- * @alias ModelComponents.Attribute
- * @constructor
- *
- * @private
- */
- function Attribute() {
- /**
- * The attribute name. Must be unique within the attributes array.
- *
- * @type {String}
- * @private
- */
- this.name = undefined;
- /**
- * The attribute semantic. The combination of semantic and setIndex must be
- * unique within the attributes array.
- *
- * @type {VertexAttributeSemantic|InstanceAttributeSemantic}
- * @private
- */
- this.semantic = undefined;
- /**
- * The set index of the attribute. Only applicable when the attribute has one
- * of the following semantics:
- *
- * <ul>
- * <li>{@link VertexAttributeSemantic.TEXCOORD}</li>
- * <li>{@link VertexAttributeSemantic.COLOR}</li>
- * <li>{@link VertexAttributeSemantic.JOINTS}</li>
- * <li>{@link VertexAttributeSemantic.WEIGHTS}</li>
- * <li>{@link VertexAttributeSemantic.FEATURE_ID}</li>
- * <li>{@link InstanceAttributeSemantic.FEATURE_ID}</li>
- * </ul>
- */
- this.setIndex = undefined;
- /**
- * The component data type of the attribute.
- * <p>
- * When the data is quantized the componentDatatype should match the
- * dequantized data, which is typically ComponentDatatype.FLOAT.
- * </p>
- * <p>
- * The following component datatypes are not supported:
- * <ul>
- * <li>ComponentDatatype.INT</li>
- * <li>ComponentDatatype.UNSIGNED_INT</li>
- * <li>ComponentDatatype.DOUBLE</li>
- * </ul>
- * </p>
- *
- * @type {ComponentDatatype}
- * @private
- */
- this.componentDatatype = undefined;
- /**
- * The type of the attribute.
- * <p>
- * When the data is oct-encoded the type should match the decoded data, which
- * is typically AttributeType.VEC3.
- * </p>
- *
- * @type {AttributeType}
- * @private
- */
- this.type = undefined;
- /**
- * Whether the attribute is normalized.
- *
- * @type {Boolean}
- * @default false
- * @private
- */
- this.normalized = false;
- /**
- * The number of elements.
- *
- * @type {Number}
- * @private
- */
- this.count = undefined;
- /**
- * Minimum value of each component in the attribute.
- * <p>
- * When the data is quantized the min should match the dequantized data.
- * The normalized property has no effect on these values.
- * </p>
- * <p>
- * Must be defined for POSITION attributes.
- * </p>
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.min = undefined;
- /**
- * Maximum value of each component in the attribute.
- * <p>
- * When the data is quantized the max should match the dequantized data.
- * The normalized property has no effect on these values.
- * </p>
- * <p>
- * Must be defined for POSITION attributes.
- * </p>
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.max = undefined;
- /**
- * A constant value used for all elements when typed array and buffer are undefined.
- *
- * @type {Number|Cartesian2|Cartesian3|Cartesian4|Matrix2|Matrix3|Matrix4}
- * @private
- */
- this.constant = undefined;
- /**
- * Information about the quantized attribute.
- *
- * @type {ModelComponents.Quantization}
- * @private
- */
- this.quantization = undefined;
- /**
- * A typed array containing tightly-packed attribute values.
- *
- * @type {Uint8Array|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array}
- * @private
- */
- this.packedTypedArray = undefined;
- /**
- * A vertex buffer. Attribute values are accessed using byteOffset and byteStride.
- *
- * @type {Buffer}
- * @private
- */
- this.buffer = undefined;
- /**
- * A typed array containing vertex buffer data. Attribute values are accessed using byteOffset and byteStride.
- *
- * @type {Uint8Array}
- * @private
- */
- this.typedArray = undefined;
- /**
- * The byte offset of elements in the buffer.
- *
- * @type {Number}
- * @default 0
- * @private
- */
- this.byteOffset = 0;
- /**
- * The byte stride of elements in the buffer. When undefined the elements are tightly packed.
- *
- * @type {Number}
- * @private
- */
- this.byteStride = undefined;
- }
- /**
- * Indices used to select vertices for rendering.
- *
- * @alias ModelComponents.Indices
- * @constructor
- *
- * @private
- */
- function Indices() {
- /**
- * The index data type of the attribute, e.g. IndexDatatype.UNSIGNED_SHORT.
- *
- * @type {IndexDatatype}
- * @private
- */
- this.indexDatatype = undefined;
- /**
- * The number of indices.
- *
- * @type {Number}
- * @private
- */
- this.count = undefined;
- /**
- * An index buffer containing indices.
- *
- * @type {Buffer}
- * @private
- */
- this.buffer = undefined;
- /**
- * A typed array containing indices.
- *
- * @type {Uint8Array|Uint16Array|Uint32Array}
- * @private
- */
- this.typedArray = undefined;
- }
- /**
- * Maps per-vertex or per-instance feature IDs to a property table. Feature
- * IDs are stored in an accessor.
- *
- * @alias ModelComponents.FeatureIdAttribute
- * @constructor
- *
- * @private
- */
- function FeatureIdAttribute() {
- /**
- * How many unique features are defined in this set of feature IDs
- *
- * @type {Number}
- * @private
- */
- this.featureCount = undefined;
- /**
- * This value indicates that no feature is indicated with this vertex
- *
- * @type {Number}
- * @private
- */
- this.nullFeatureId = undefined;
- /**
- * The ID of the property table that feature IDs index into. If undefined,
- * feature IDs are used for classification, but no metadata is associated.
- *
- *
- * @type {Number}
- * @private
- */
- this.propertyTableId = undefined;
- /**
- * The set index of feature ID attribute containing feature IDs.
- *
- * @type {Number}
- * @private
- */
- this.setIndex = undefined;
- /**
- * The label to identify this set of feature IDs. This is used in picking,
- * styling and shaders.
- *
- * @type {String}
- * @private
- */
- this.label = undefined;
- /**
- * Label to identify this set of feature IDs by its position in the array.
- * This will always be either "featureId_N" for primitives or
- * "instanceFeatureId_N" for instances.
- *
- * @type {String}
- * @private
- */
- this.positionalLabel = undefined;
- }
- /**
- * Defines a range of implicitly-defined feature IDs, one for each vertex or
- * instance. Such feature IDs may optionally be associated with a property table
- * storing metadata
- *
- * @alias ModelComponents.FeatureIdImplicitRange
- * @constructor
- *
- * @private
- */
- function FeatureIdImplicitRange() {
- /**
- * How many unique features are defined in this set of feature IDs
- *
- * @type {Number}
- * @private
- */
- this.featureCount = undefined;
- /**
- * This value indicates that no feature is indicated with this vertex
- *
- * @type {Number}
- * @private
- */
- this.nullFeatureId = undefined;
- /**
- * The ID of the property table that feature IDs index into. If undefined,
- * feature IDs are used for classification, but no metadata is associated.
- *
- * @type {Number}
- * @private
- */
- this.propertyTableId = undefined;
- /**
- * The first feature ID to use when setIndex is undefined
- *
- * @type {Number}
- * @default 0
- * @private
- */
- this.offset = 0;
- /**
- * Number of times each feature ID is repeated before being incremented.
- *
- * @type {Number}
- * @private
- */
- this.repeat = undefined;
- /**
- * The label to identify this set of feature IDs. This is used in picking,
- * styling and shaders.
- *
- * @type {String}
- * @private
- */
- this.label = undefined;
- /**
- * Label to identify this set of feature IDs by its position in the array.
- * This will always be either "featureId_N" for primitives or
- * "instanceFeatureId_N" for instances.
- *
- * @type {String}
- * @private
- */
- this.positionalLabel = undefined;
- }
- /**
- * A texture that contains per-texel feature IDs that index into a property table.
- *
- * @alias ModelComponents.FeatureIdTexture
- * @constructor
- *
- * @private
- */
- function FeatureIdTexture() {
- /**
- * How many unique features are defined in this set of feature IDs
- *
- * @type {Number}
- * @private
- */
- this.featureCount = undefined;
- /**
- * This value indicates that no feature is indicated with this texel
- *
- * @type {Number}
- * @private
- */
- this.nullFeatureId = undefined;
- /**
- * The ID of the property table that feature IDs index into. If undefined,
- * feature IDs are used for classification, but no metadata is associated.
- *
- * @type {String}
- * @private
- */
- this.propertyTableId = undefined;
- /**
- * The texture reader containing feature IDs.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.textureReader = undefined;
- /**
- * The label to identify this set of feature IDs. This is used in picking,
- * styling and shaders.
- *
- * @type {String}
- * @private
- */
- this.label = undefined;
- /**
- * Label to identify this set of feature IDs by its position in the array.
- * This will always be either "featureId_N" for primitives or
- * "instanceFeatureId_N" for instances.
- *
- * @type {String}
- * @private
- */
- this.positionalLabel = undefined;
- }
- /**
- * A morph target where each attribute contains attribute displacement data.
- *
- * @alias ModelComponents.MorphTarget
- * @constructor
- *
- * @private
- */
- function MorphTarget() {
- /**
- * Attributes that are part of the morph target, e.g. positions, normals, and tangents.
- *
- * @type {ModelComponents.Attribute[]}
- * @private
- */
- this.attributes = [];
- }
- /**
- * Geometry to be rendered with a material.
- *
- * @alias ModelComponents.Primitive
- * @constructor
- *
- * @private
- */
- function Primitive() {
- /**
- * The vertex attributes, e.g. positions, normals, etc.
- *
- * @type {ModelComponents.Attribute[]}
- * @private
- */
- this.attributes = [];
- /**
- * The morph targets.
- *
- * @type {ModelComponents.MorphTarget[]}
- * @private
- */
- this.morphTargets = [];
- /**
- * The indices.
- *
- * @type {ModelComponents.Indices}
- * @private
- */
- this.indices = undefined;
- /**
- * The material.
- *
- * @type {ModelComponents.Material}
- * @private
- */
- this.material = undefined;
- /**
- * The primitive type, e.g. PrimitiveType.TRIANGLES.
- *
- * @type {PrimitiveType}
- * @private
- */
- this.primitiveType = undefined;
- /**
- * The feature IDs associated with this primitive. Feature ID types may
- * be interleaved
- *
- * @type {Array.<ModelComponents.FeatureIdAttribute|ModelComponents.FeatureIdImplicitRange|ModelComponents.FeatureIdTexture>}
- * @private
- */
- this.featureIds = [];
- /**
- * The property texture IDs. These indices correspond to the array of
- * property textures.
- *
- * @type {Number[]}
- * @private
- */
- this.propertyTextureIds = [];
- /**
- * The property attribute IDs. These indices correspond to the array of
- * property attributes in the EXT_structural_metadata extension.
- *
- * @type {Number[]}
- * @private
- */
- this.propertyAttributeIds = [];
- }
- /**
- * Position and metadata information for instances of a node.
- *
- * @alias ModelComponents.Primitive
- * @constructor
- *
- * @private
- */
- function Instances() {
- /**
- * The instance attributes, e.g. translation, rotation, scale, feature id, etc.
- *
- * @type {ModelComponents.Attribute[]}
- * @private
- */
- this.attributes = [];
- /**
- * The feature ID attributes associated with this set of instances.
- * Feature ID attribute types may be interleaved.
- *
- * @type {Array.<ModelComponents.FeatureIdAttribute|ModelComponents.FeatureIdImplicitRange>}
- * @private
- */
- this.featureIds = [];
- /**
- * Whether the instancing transforms are applied in world space. For glTF models that
- * use EXT_mesh_gpu_instancing, the transform is applied in object space. For i3dm files,
- * the instance transform is in world space.
- *
- * @type {Boolean}
- * @private
- */
- this.transformInWorldSpace = false;
- }
- /**
- * Joints and matrices defining a skin.
- *
- * @alias ModelComponents.Skin
- * @constructor
- *
- * @private
- */
- function Skin() {
- /**
- * The index of the skin in the glTF. This is useful for finding the skin
- * that applies to a node after the skin is instantiated at runtime.
- *
- * @type {Number}
- * @private
- */
- this.index = undefined;
- /**
- * The joints.
- *
- * @type {ModelComponents.Node[]}
- * @private
- */
- this.joints = [];
- /**
- * The inverse bind matrices of the joints.
- *
- * @type {Matrix4[]}
- * @private
- */
- this.inverseBindMatrices = [];
- }
- /**
- * A node in the node hierarchy.
- *
- * @alias ModelComponents.Node
- * @constructor
- *
- * @private
- */
- function Node() {
- /**
- * The name of the node.
- *
- * @type {String}
- * @private
- */
- this.name = undefined;
- /**
- * The index of the node in the glTF. This is useful for finding the nodes
- * that belong to a skin after they have been instantiated at runtime.
- *
- * @type {Number}
- * @private
- */
- this.index = undefined;
- /**
- * The children nodes.
- *
- * @type {ModelComponents.Node[]}
- * @private
- */
- this.children = [];
- /**
- * The mesh primitives.
- *
- * @type {ModelComponents.Primitive[]}
- * @private
- */
- this.primitives = [];
- /**
- * Instances of this node.
- *
- * @type {ModelComponents.Instances}
- * @private
- */
- this.instances = undefined;
- /**
- * The skin.
- *
- * @type {ModelComponents.Skin}
- * @private
- */
- this.skin = undefined;
- /**
- * The local transformation matrix. When matrix is defined translation,
- * rotation, and scale must be undefined. When matrix is undefined
- * translation, rotation, and scale must all be defined.
- *
- * @type {Matrix4}
- * @private
- */
- this.matrix = undefined;
- /**
- * The local translation.
- *
- * @type {Cartesian3}
- * @private
- */
- this.translation = undefined;
- /**
- * The local rotation.
- *
- * @type {Quaternion}
- * @private
- */
- this.rotation = undefined;
- /**
- * The local scale.
- *
- * @type {Cartesian3}
- * @private
- */
- this.scale = undefined;
- /**
- * An array of weights to be applied to the primitives' morph targets.
- * These are supplied by either the node or its mesh.
- *
- * @type {Number[]}
- * @private
- */
- this.morphWeights = [];
- }
- /**
- * A scene containing nodes.
- *
- * @alias ModelComponents.Scene
- * @constructor
- *
- * @private
- */
- function Scene() {
- /**
- * The nodes belonging to the scene.
- *
- * @type {ModelComponents.Node[]}
- * @private
- */
- this.nodes = [];
- }
- /**
- * The property of the node that is targeted by an animation. The values of
- * this enum are used to look up the appropriate property on the runtime node.
- *
- * @alias {ModelComponents.AnimatedPropertyType}
- * @enum {String}
- *
- * @private
- */
- const AnimatedPropertyType = {
- TRANSLATION: "translation",
- ROTATION: "rotation",
- SCALE: "scale",
- WEIGHTS: "weights",
- };
- /**
- * An animation sampler that describes the sources of animated keyframe data
- * and their interpolation.
- *
- * @alias {ModelComponents.AnimationSampler}
- * @constructor
- *
- * @private
- */
- function AnimationSampler() {
- /**
- * The timesteps of the animation.
- *
- * @type {Number[]}
- * @private
- */
- this.input = [];
- /**
- * The method used to interpolate between the animation's keyframe data.
- *
- * @type {InterpolationType}
- * @private
- */
- this.interpolation = undefined;
- /**
- * The keyframe data of the animation.
- *
- * @type {Number[]|Cartesian3[]|Quaternion[]}
- * @private
- */
- this.output = [];
- }
- /**
- * An animation target, which specifies the node and property to animate.
- *
- * @alias {ModelComponents.AnimationTarget}
- * @constructor
- *
- * @private
- */
- function AnimationTarget() {
- /**
- * The node that will be affected by the animation.
- *
- * @type {ModelComponents.Node}
- * @private
- */
- this.node = undefined;
- /**
- * The property of the node to be animated.
- *
- * @type {ModelComponents.AnimatedPropertyType}
- * @private
- */
- this.path = undefined;
- }
- /**
- * An animation channel linking an animation sampler and the target it animates.
- *
- * @alias {ModelComponents.AnimationChannel}
- * @constructor
- *
- * @private
- */
- function AnimationChannel() {
- /**
- * The sampler used as the source of the animation data.
- *
- * @type {ModelComponents.AnimationSampler}
- * @private
- */
- this.sampler = undefined;
- /**
- * The target of the animation.
- *
- * @type {ModelComponents.AnimationTarget}
- * @private
- */
- this.target = undefined;
- }
- /**
- * An animation in the model.
- *
- * @alias {ModelComponents.Animation}
- * @constructor
- *
- * @private
- */
- function Animation() {
- /**
- * The name of the animation.
- *
- * @type {String}
- * @private
- */
- this.name = undefined;
- /**
- * The samplers used in this animation.
- *
- * @type {ModelComponents.AnimationSampler[]}
- * @private
- */
- this.samplers = [];
- /**
- * The channels used in this animation.
- *
- * @type {ModelComponents.AnimationChannel[]}
- * @private
- */
- this.channels = [];
- }
- /**
- * The asset of the model.
- *
- * @alias {ModelComponents.Asset}
- * @constructor
- *
- * @private
- */
- function Asset() {
- /**
- * The credits of the model.
- *
- * @type {Credit[]}
- * @private
- */
- this.credits = [];
- }
- /**
- * The components that make up a model.
- *
- * @alias ModelComponents.Components
- * @constructor
- *
- * @private
- */
- function Components() {
- /**
- * The asset of the model.
- *
- * @type {ModelComponents.Asset}
- * @private
- */
- this.asset = new Asset();
- /**
- * The default scene.
- *
- * @type {ModelComponents.Scene}
- * @private
- */
- this.scene = undefined;
- /**
- * All nodes in the model.
- *
- * @type {ModelComponents.Node[]}
- */
- this.nodes = [];
- /**
- * All skins in the model.
- *
- * @type {ModelComponents.Skin[]}
- */
- this.skins = [];
- /**
- * All animations in the model.
- *
- * @type {ModelComponents.Animation[]}
- */
- this.animations = [];
- /**
- * Structural metadata containing the schema, property tables, property
- * textures and property mappings
- *
- * @type {StructuralMetadata}
- * @private
- */
- this.structuralMetadata = undefined;
- /**
- * The model's up axis.
- *
- * @type {Axis}
- * @private
- */
- this.upAxis = undefined;
- /**
- * The model's forward axis.
- *
- * @type {Axis}
- * @private
- */
- this.forwardAxis = undefined;
- /**
- * A world-space transform to apply to the primitives.
- *
- * @type {Matrix4}
- * @private
- */
- this.transform = Matrix4.clone(Matrix4.IDENTITY);
- }
- /**
- * Information about a GPU texture, including the texture itself
- *
- * @alias ModelComponents.TextureReader
- * @constructor
- *
- * @private
- */
- function TextureReader() {
- /**
- * The underlying GPU texture. The {@link Texture} contains the sampler.
- *
- * @type {Texture}
- * @private
- */
- this.texture = undefined;
- /**
- * The index of the texture in the glTF. This is useful for determining
- * when textures are shared to avoid attaching a texture in multiple uniform
- * slots in the shader.
- *
- * @type {Number}
- * @private
- */
- this.index = undefined;
- /**
- * The texture coordinate set.
- *
- * @type {Number}
- * @default 0
- * @private
- */
- this.texCoord = 0;
- /**
- * Transformation matrix to apply to texture coordinates.
- *
- * @type {Matrix3}
- * @default Matrix3.IDENTITY
- */
- this.transform = Matrix3.clone(Matrix3.IDENTITY);
- /**
- * The texture channels to read from. When undefined all channels are read.
- *
- * @type {String}
- */
- this.channels = undefined;
- }
- /**
- * Material properties for the PBR metallic roughness shading model.
- *
- * @alias ModelComponents.MetallicRoughness
- * @constructor
- *
- * @private
- */
- function MetallicRoughness() {
- /**
- * The base color texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.baseColorTexture = undefined;
- /**
- * The metallic roughness texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.metallicRoughnessTexture = undefined;
- /**
- * The base color factor.
- *
- * @type {Cartesian4}
- * @default new Cartesian4(1.0, 1.0, 1.0, 1.0)
- * @private
- */
- this.baseColorFactor = Cartesian4.clone(
- MetallicRoughness.DEFAULT_BASE_COLOR_FACTOR
- );
- /**
- * The metallic factor.
- *
- * @type {Number}
- * @default 1.0
- * @private
- */
- this.metallicFactor = MetallicRoughness.DEFAULT_METALLIC_FACTOR;
- /**
- * The roughness factor.
- *
- * @type {Number}
- * @default 1.0
- * @private
- */
- this.roughnessFactor = MetallicRoughness.DEFAULT_ROUGHNESS_FACTOR;
- }
- /**
- * @private
- */
- MetallicRoughness.DEFAULT_BASE_COLOR_FACTOR = Cartesian4.ONE;
- /**
- * @private
- */
- MetallicRoughness.DEFAULT_METALLIC_FACTOR = 1.0;
- /**
- * @private
- */
- MetallicRoughness.DEFAULT_ROUGHNESS_FACTOR = 1.0;
- /**
- * Material properties for the PBR specular glossiness shading model.
- *
- * @alias ModelComponents.function SpecularGlossiness
- * @constructor
- *
- * @private
- */
- function SpecularGlossiness() {
- /**
- * The diffuse texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.diffuseTexture = undefined;
- /**
- * The specular glossiness texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.specularGlossinessTexture = undefined;
- /**
- * The diffuse factor.
- *
- * @type {Cartesian4}
- * @default new Cartesian4(1.0, 1.0, 1.0, 1.0)
- * @private
- */
- this.diffuseFactor = Cartesian4.clone(
- SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR
- );
- /**
- * The specular factor.
- *
- * @type {Cartesian3}
- * @default new Cartesian3(1.0, 1.0, 1.0)
- * @private
- */
- this.specularFactor = Cartesian3.clone(
- SpecularGlossiness.DEFAULT_SPECULAR_FACTOR
- );
- /**
- * The glossiness factor.
- *
- * @type {Number}
- * @default 1.0
- * @private
- */
- this.glossinessFactor = SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR;
- }
- /**
- * @private
- */
- SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR = Cartesian4.ONE;
- /**
- * @private
- */
- SpecularGlossiness.DEFAULT_SPECULAR_FACTOR = Cartesian3.ONE;
- /**
- * @private
- */
- SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR = 1.0;
- /**
- * The material appearance of a primitive.
- *
- * @alias ModelComponent.Material
- * @constructor
- *
- * @private
- */
- function Material() {
- /**
- * Material properties for the PBR metallic roughness shading model.
- *
- * @type {ModelComponents.MetallicRoughness}
- * @private
- */
- this.metallicRoughness = new MetallicRoughness();
- /**
- * Material properties for the PBR specular glossiness shading model.
- *
- * @type {ModelComponents.SpecularGlossiness}
- * @private
- */
- this.specularGlossiness = undefined;
- /**
- * The emissive texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.emissiveTexture = undefined;
- /**
- * The normal texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.normalTexture = undefined;
- /**
- * The occlusion texture reader.
- *
- * @type {ModelComponents.TextureReader}
- * @private
- */
- this.occlusionTexture = undefined;
- /**
- * The emissive factor.
- *
- * @type {Cartesian3}
- * @default Cartesian3.ZERO
- * @private
- */
- this.emissiveFactor = Cartesian3.clone(Material.DEFAULT_EMISSIVE_FACTOR);
- /**
- * The alpha mode.
- *
- * @type {AlphaMode}
- * @default AlphaMode.OPAQUE
- * @private
- */
- this.alphaMode = AlphaMode.OPAQUE;
- /**
- * The alpha cutoff value of the material for the MASK alpha mode.
- *
- * @type {Number}
- * @default 0.5
- * @private
- */
- this.alphaCutoff = 0.5;
- /**
- * Specifies whether the material is double sided.
- *
- * @type {Boolean}
- * @default false
- * @private
- */
- this.doubleSided = false;
- /**
- * Specifies whether the material is unlit.
- *
- * @type {Boolean}
- * @default false
- * @private
- */
- this.unlit = false;
- }
- /**
- * @private
- */
- Material.DEFAULT_EMISSIVE_FACTOR = Cartesian3.ZERO;
- ModelComponents.Quantization = Quantization;
- ModelComponents.Attribute = Attribute;
- ModelComponents.Indices = Indices;
- ModelComponents.FeatureIdAttribute = FeatureIdAttribute;
- ModelComponents.FeatureIdTexture = FeatureIdTexture;
- ModelComponents.FeatureIdImplicitRange = FeatureIdImplicitRange;
- ModelComponents.MorphTarget = MorphTarget;
- ModelComponents.Primitive = Primitive;
- ModelComponents.Instances = Instances;
- ModelComponents.Skin = Skin;
- ModelComponents.Node = Node;
- ModelComponents.Scene = Scene;
- ModelComponents.AnimatedPropertyType = Object.freeze(AnimatedPropertyType);
- ModelComponents.AnimationSampler = AnimationSampler;
- ModelComponents.AnimationTarget = AnimationTarget;
- ModelComponents.AnimationChannel = AnimationChannel;
- ModelComponents.Animation = Animation;
- ModelComponents.Asset = Asset;
- ModelComponents.Components = Components;
- ModelComponents.TextureReader = TextureReader;
- ModelComponents.MetallicRoughness = MetallicRoughness;
- ModelComponents.SpecularGlossiness = SpecularGlossiness;
- ModelComponents.Material = Material;
- export default ModelComponents;
|