1 line
37 KiB
Plaintext
1 line
37 KiB
Plaintext
|
{"version":3,"file":"AttributeCompression-442278a0.js","sources":["../../../../Source/Scene/AttributeType.js","../../../../Source/Core/AttributeCompression.js"],"sourcesContent":["import Cartesian2 from \"../Core/Cartesian2.js\";\nimport Cartesian3 from \"../Core/Cartesian3.js\";\nimport Cartesian4 from \"../Core/Cartesian4.js\";\nimport Check from \"../Core/Check.js\";\nimport DeveloperError from \"../Core/DeveloperError.js\";\nimport Matrix2 from \"../Core/Matrix2.js\";\nimport Matrix3 from \"../Core/Matrix3.js\";\nimport Matrix4 from \"../Core/Matrix4.js\";\n\n/**\n * An enum describing the attribute type for glTF and 3D Tiles.\n *\n * @enum {String}\n *\n * @private\n */\nconst AttributeType = {\n /**\n * The attribute is a single component.\n *\n * @type {String}\n * @constant\n */\n SCALAR: \"SCALAR\",\n\n /**\n * The attribute is a two-component vector.\n *\n * @type {String}\n * @constant\n */\n VEC2: \"VEC2\",\n\n /**\n * The attribute is a three-component vector.\n *\n * @type {String}\n * @constant\n */\n VEC3: \"VEC3\",\n\n /**\n * The attribute is a four-component vector.\n *\n * @type {String}\n * @constant\n */\n VEC4: \"VEC4\",\n\n /**\n * The attribute is a 2x2 matrix.\n *\n * @type {String}\n * @constant\n */\n MAT2: \"MAT2\",\n\n /**\n * The attribute is a 3x3 matrix.\n *\n * @type {String}\n * @constant\n */\n MAT3: \"MAT3\",\n\n /**\n * The attribute is a 4x4 matrix.\n *\n * @type {String}\n * @constant\n */\n MAT4: \"MAT4\",\n};\n\n/**\n * Gets the scalar, vector, or matrix type for the attribute type.\n *\n * @param {AttributeType} attributeType The attribute type.\n * @returns {*} The math type.\n *\n * @private\n */\nAttributeType.getMathType = function (attributeType) {\n switch (attributeType) {\n case AttributeType.SCALAR:\n return Number;\n case AttributeType.VEC2:\n return Cartesian2;\n case AttributeType.VEC3:\n return Cartesian3;\n case AttributeType.VEC4:\n return Cartesian4;\n case AttributeType.MAT2:\n return Matrix2;\n case AttributeType.MAT3:\n return Matrix3;\n case AttributeType.MAT4:\n return Matrix4;\n //>>includeStart('debug', pragmas.debug);\n default:\n throw new DeveloperError(\"attributeType is not a valid value.\");\n //>>includeEnd('debug');\n }\n};\n\n/**\n * Gets the number of components per attribute.\n *\n * @param {AttributeType} attributeType The attribute type.\n * @returns {Number} The number of components.\n *\n * @private\n */\nAttributeType.getNumberOfComponents = function (attributeType) {\n switch (attributeType) {\n case AttributeType.SCALAR:\n return 1;\n case AttributeType.VEC2:\n return 2;\n case AttributeType.VEC3:\n return 3;\n case AttributeType.VEC4:\n case AttributeType.MAT2:\n return 4;\n case AttributeType.MAT3:\n return 9;\n case AttributeType.MAT4:\n return 16;\n //>>includeStart('debug', pragmas.debug);\n default:\n throw new DeveloperError(\"attributeType is not a valid value.\");\n //>>includeEnd('debug');\n }\n};\n\n/**\n * Gets the GLSL type for the attribute type.\n *\n * @param {AttributeType} attributeType The attribute type.\n * @returns {String} The GLSL type for the attribute type.\n *\n * @private\n */\nAttributeType.getGlslType = function (attributeType) {\n //>>includeStart('debug', pragmas.debug);\n Check.typeOf.string(\"attributeType\", attributeType);\n //>>includeEnd('debug');\n\n switch (attributeType) {\n case AttributeType.SCALAR:\n return \"float\";\n case AttributeType.VEC2:\n return \"vec2\";\n case AttributeType.VEC3:\n return \"vec3\";\n case AttributeType.VEC4:\n return \"vec4\";\n case AttributeType.MAT2:\n return \"mat2\";\n case AttributeType.MAT3:\n return \"mat3\";\n case AttributeType.MAT4:\n return \"mat4\";\n //>>includeStart('debug', pragmas.debug);\n default:\n throw new DeveloperError(\"attributeType is not a valid value.
|