2
0
Эх сурвалжийг харах

GLTFExporter: Regenerate ES module.

Don McCurdy 6 жил өмнө
parent
commit
8da957edf9

+ 31 - 41
examples/jsm/exporters/GLTFExporter.js

@@ -59,36 +59,26 @@ var PATH_PROPERTIES = {
 // GLTF Exporter
 //------------------------------------------------------------------------------
 import {
-	AnimationClip,
 	BufferAttribute,
 	BufferGeometry,
-	Camera,
 	ClampToEdgeWrapping,
 	DoubleSide,
-	Geometry,
 	InterpolateDiscrete,
 	LinearFilter,
 	LinearMipMapLinearFilter,
 	LinearMipMapNearestFilter,
-	Material,
-	Math,
-	Mesh,
+	Math as _Math,
 	MirroredRepeatWrapping,
 	NearestFilter,
 	NearestMipMapLinearFilter,
 	NearestMipMapNearestFilter,
-	Object3D,
 	PropertyBinding,
 	RGBAFormat,
-	RGBFormat,
 	RepeatWrapping,
 	Scene,
-	Scenes,
-	ShaderMaterial,
 	TriangleFanDrawMode,
 	TriangleStripDrawMode,
-	Vector3,
-	VertexColors
+	Vector3
 } from "../../../build/three.module.js";
 
 var GLTFExporter = function () {};
@@ -99,7 +89,7 @@ GLTFExporter.prototype = {
 
 	/**
 	 * Parse scenes and generate GLTF output
-	 * @param  {Scene or [Scenes]} input   Scene or Array of Scenes
+	 * @param  {Scene or [THREE.Scenes]} input   Scene or Array of THREE.Scenes
 	 * @param  {Function} onDone  Callback on completed
 	 * @param  {Object} options options
 	 */
@@ -244,7 +234,7 @@ GLTFExporter.prototype = {
 		 */
 		function isPowerOfTwo( image ) {
 
-			return Math.isPowerOfTwo( image.width ) && Math.isPowerOfTwo( image.height );
+			return _Math.isPowerOfTwo( image.width ) && _Math.isPowerOfTwo( image.height );
 
 		}
 
@@ -373,7 +363,7 @@ GLTFExporter.prototype = {
 		/**
 		 * Serializes a userData.
 		 *
-		 * @param {Object3D|Material} object
+		 * @param {THREE.Object3D|THREE.Material} object
 		 * @param {Object} gltfProperty
 		 */
 		function serializeUserData( object, gltfProperty ) {
@@ -415,7 +405,7 @@ GLTFExporter.prototype = {
 
 			} catch ( error ) {
 
-				console.warn( 'THREE.GLTFExporter: userData of \'' + object.name + '\' ' +
+				console.warn( 'GLTFExporter: userData of \'' + object.name + '\' ' +
 					'won\'t be serialized because of JSON.stringify error - ' + error.message );
 
 			}
@@ -666,7 +656,7 @@ GLTFExporter.prototype = {
 
 			} else {
 
-				throw new Error( 'THREE.GLTFExporter: Unsupported bufferAttribute component type.' );
+				throw new Error( 'GLTFExporter: Unsupported bufferAttribute component type.' );
 
 			}
 
@@ -736,7 +726,7 @@ GLTFExporter.prototype = {
 		/**
 		 * Process image
 		 * @param  {Image} image to process
-		 * @param  {Integer} format of the image (e.g. RGBFormat, RGBAFormat etc)
+		 * @param  {Integer} format of the image (e.g. THREE.RGBFormat, RGBAFormat etc)
 		 * @param  {Boolean} flipY before writing out the image
 		 * @return {Integer}     Index of the processed texture in the "images" array
 		 */
@@ -777,8 +767,8 @@ GLTFExporter.prototype = {
 
 					console.warn( 'GLTFExporter: Resized non-power-of-two image.', image );
 
-					canvas.width = Math.floorPowerOfTwo( canvas.width );
-					canvas.height = Math.floorPowerOfTwo( canvas.height );
+					canvas.width = _Math.floorPowerOfTwo( canvas.width );
+					canvas.height = _Math.floorPowerOfTwo( canvas.height );
 
 				}
 
@@ -897,7 +887,7 @@ GLTFExporter.prototype = {
 
 		/**
 		 * Process material
-		 * @param  {Material} material Material to process
+		 * @param  {THREE.Material} material Material to process
 		 * @return {Integer}      Index of the processed material in the "materials" array
 		 */
 		function processMaterial( material ) {
@@ -916,7 +906,7 @@ GLTFExporter.prototype = {
 
 			if ( material.isShaderMaterial ) {
 
-				console.warn( 'GLTFExporter: ShaderMaterial not supported.' );
+				console.warn( 'GLTFExporter: THREE.ShaderMaterial not supported.' );
 				return null;
 
 			}
@@ -977,7 +967,7 @@ GLTFExporter.prototype = {
 
 				} else {
 
-					console.warn( 'THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
+					console.warn( 'GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.' );
 
 				}
 
@@ -1027,7 +1017,7 @@ GLTFExporter.prototype = {
 
 					if ( material.normalScale.x !== material.normalScale.y ) {
 
-						console.warn( 'THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X.' );
+						console.warn( 'GLTFExporter: Normal scale components are different, ignoring Y and exporting X.' );
 
 					}
 
@@ -1101,7 +1091,7 @@ GLTFExporter.prototype = {
 
 		/**
 		 * Process mesh
-		 * @param  {Mesh} mesh Mesh to process
+		 * @param  {THREE.Mesh} mesh Mesh to process
 		 * @return {Integer}      Index of the processed mesh in the "meshes" array
 		 */
 		function processMesh( mesh ) {
@@ -1138,7 +1128,7 @@ GLTFExporter.prototype = {
 
 				if ( ! geometry.isBufferGeometry ) {
 
-					console.warn( 'GLTFExporter: Exporting Geometry will increase file size. Use BufferGeometry instead.' );
+					console.warn( 'GLTFExporter: Exporting THREE.Geometry will increase file size. Use BufferGeometry instead.' );
 
 					var geometryTemp = new BufferGeometry();
 					geometryTemp.fromGeometry( geometry );
@@ -1184,13 +1174,13 @@ GLTFExporter.prototype = {
 
 			if ( originalNormal !== undefined && ! isNormalizedNormalAttribute( originalNormal ) ) {
 
-				console.warn( 'THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
+				console.warn( 'GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
 
 				geometry.addAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
 
 			}
 
-			// @QUESTION Detect if .vertexColors = VertexColors?
+			// @QUESTION Detect if .vertexColors = THREE.VertexColors?
 			// For every attribute create an accessor
 			var modifiedAttribute = null;
 			for ( var attributeName in geometry.attributes ) {
@@ -1343,7 +1333,7 @@ GLTFExporter.prototype = {
 			if ( ! forceIndices && geometry.index === null && isMultiMaterial ) {
 
 				// temporal workaround.
-				console.warn( 'THREE.GLTFExporter: Creating index for non-indexed multi-material mesh.' );
+				console.warn( 'GLTFExporter: Creating index for non-indexed multi-material mesh.' );
 				forceIndices = true;
 
 			}
@@ -1432,7 +1422,7 @@ GLTFExporter.prototype = {
 
 		/**
 		 * Process camera
-		 * @param  {Camera} camera Camera to process
+		 * @param  {THREE.Camera} camera Camera to process
 		 * @return {Integer}      Index of the processed mesh in the "camera" array
 		 */
 		function processCamera( camera ) {
@@ -1467,7 +1457,7 @@ GLTFExporter.prototype = {
 				gltfCamera.perspective = {
 
 					aspectRatio: camera.aspect,
-					yfov: Math.degToRad( camera.fov ),
+					yfov: _Math.degToRad( camera.fov ),
 					zfar: camera.far <= 0 ? 0.001 : camera.far,
 					znear: camera.near < 0 ? 0 : camera.near
 
@@ -1493,8 +1483,8 @@ GLTFExporter.prototype = {
 		 * Status:
 		 * - Only properties listed in PATH_PROPERTIES may be animated.
 		 *
-		 * @param {AnimationClip} clip
-		 * @param {Object3D} root
+		 * @param {THREE.AnimationClip} clip
+		 * @param {THREE.Object3D} root
 		 * @return {number}
 		 */
 		function processAnimation( clip, root ) {
@@ -1534,7 +1524,7 @@ GLTFExporter.prototype = {
 
 				if ( ! trackNode || ! trackProperty ) {
 
-					console.warn( 'THREE.GLTFExporter: Could not export animation track "%s".', track.name );
+					console.warn( 'GLTFExporter: Could not export animation track "%s".', track.name );
 					return null;
 
 				}
@@ -1677,7 +1667,7 @@ GLTFExporter.prototype = {
 
 			if ( light.decay !== undefined && light.decay !== 2 ) {
 
-				console.warn( 'THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, '
+				console.warn( 'GLTFExporter: Light decay may be lost. glTF is physically-based, '
 					+ 'and expects light.decay=2.' );
 
 			}
@@ -1688,7 +1678,7 @@ GLTFExporter.prototype = {
 					 || light.target.position.y !== 0
 					 || light.target.position.z !== - 1 ) ) {
 
-				console.warn( 'THREE.GLTFExporter: Light direction may be lost. For best results, '
+				console.warn( 'GLTFExporter: Light direction may be lost. For best results, '
 					+ 'make light.target a child of the light with position 0,0,-1.' );
 
 			}
@@ -1701,7 +1691,7 @@ GLTFExporter.prototype = {
 
 		/**
 		 * Process Object3D node
-		 * @param  {Object3D} node Object3D to processNode
+		 * @param  {THREE.Object3D} node Object3D to processNode
 		 * @return {Integer}      Index of the node in the nodes list
 		 */
 		function processNode( object ) {
@@ -1787,7 +1777,7 @@ GLTFExporter.prototype = {
 
 			} else if ( object.isLight ) {
 
-				console.warn( 'THREE.GLTFExporter: Only directional, point, and spot lights are supported.' );
+				console.warn( 'GLTFExporter: Only directional, point, and spot lights are supported.' );
 				return null;
 
 			}
@@ -2173,11 +2163,11 @@ GLTFExporter.Utils = {
 
 					// This should never happen, because glTF morph target animations
 					// affect all targets already.
-					throw new Error( 'THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
+					throw new Error( 'GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' );
 
 				}
 
-				console.warn( 'THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
+				console.warn( 'GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' );
 
 				sourceTrack = sourceTrack.clone();
 				sourceTrack.setInterpolation( InterpolateLinear );
@@ -2189,7 +2179,7 @@ GLTFExporter.Utils = {
 
 			if ( targetIndex === undefined ) {
 
-				throw new Error( 'THREE.GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex );
+				throw new Error( 'GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex );
 
 			}
 

+ 1 - 1
utils/modularize.js

@@ -12,7 +12,7 @@ var files = [
 	{ path: 'controls/MapControls.js', ignoreList: [] },
 	{ path: 'controls/TrackballControls.js', ignoreList: [] },
 	// { path: 'controls/TransformControls.js', ignoreList: [] },
-	{ path: 'exporters/GLTFExporter.js', ignoreList: ['AnimationClip', 'Camera', 'Material', 'Mesh', 'Object3D', 'RGBFormat', 'Scenes', 'ShaderMaterial', 'VertexColors' ] },
+	{ path: 'exporters/GLTFExporter.js', ignoreList: ['AnimationClip', 'Camera', 'Geometry', 'Material', 'Mesh', 'Object3D', 'RGBFormat', 'Scenes', 'ShaderMaterial', 'VertexColors' ] },
 	{ path: 'exporters/MMDExporter.js', ignoreList: [] },
 	{ path: 'exporters/OBJExporter.js', ignoreList: [] },
 	{ path: 'exporters/PLYExporter.js', ignoreList: [] },