Просмотр исходного кода

New Docs: Added redirects for old docs URL (#31986)

* New Docs: Added redirects for old docs URL.

* Removed docs_new from gitignore.

* Clean up.
mrdoob 4 месяцев назад
Родитель
Сommit
2cbc7af334

+ 1 - 2
.gitignore

@@ -17,5 +17,4 @@ test/treeshake/index.webgpu.nodes.bundle.min.js
 test/e2e/chromium
 test/e2e/output-screenshots
 
-**/node_modules
-**/docs_new
+**/node_modules

+ 6 - 0
src/extras/Earcut.js

@@ -1,5 +1,11 @@
 import earcut from './lib/earcut.js';
 
+/**
+ * An implementation of the earcut polygon triangulation algorithm.
+ * The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut).
+ *
+ * @see https://github.com/mapbox/earcut
+ */
 class Earcut {
 
 	/**

+ 7 - 1
src/extras/core/Interpolations.js

@@ -1,4 +1,10 @@
-// Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve
+/**
+ * Interpolations contains spline and Bézier functions internally used by concrete curve classes.
+ *
+ * Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve
+ *
+ * @module Interpolations
+ */
 
 /**
  * Computes a point on a Catmull-Rom spline.

+ 22 - 2
src/renderers/shaders/UniformsUtils.js

@@ -1,8 +1,20 @@
 import { ColorManagement } from '../../math/ColorManagement.js';
 import { warn } from '../../utils.js';
 
-// Uniform Utilities
-
+/**
+ * Provides utility functions for managing uniforms.
+ *
+ * @module UniformsUtils
+ */
+
+/**
+ * Clones the given uniform definitions by performing a deep-copy. That means
+ * if the value of a uniform refers to an object like a Vector3 or Texture,
+ * the cloned uniform will refer to a new object reference.
+ *
+ * @param {Object} src - An object representing uniform definitions.
+ * @return {Object} The cloned uniforms.
+ */
 export function cloneUniforms( src ) {
 
 	const dst = {};
@@ -49,6 +61,14 @@ export function cloneUniforms( src ) {
 
 }
 
+/**
+ * Merges the given uniform definitions into a single object. Since the
+ * method internally uses cloneUniforms(), it performs a deep-copy when
+ * producing the merged uniform definitions.
+ *
+ * @param {Array} uniforms - An array of objects containing uniform definitions.
+ * @return {Object} The merged uniforms.
+ */
 export function mergeUniforms( uniforms ) {
 
 	const merged = {};

+ 42 - 0
utils/docs/template/static/scripts/page.js

@@ -1,3 +1,45 @@
+( function handleLegacyURLs() {
+
+	const hash = window.location.hash;
+
+	if ( hash.startsWith( '#api/' ) || hash.startsWith( '#examples/' ) ) {
+
+		const mappings = {
+
+			'3DMLoader': 'Rhino3dmLoader',
+
+			'BufferGeometryUtils': 'module-BufferGeometryUtils',
+			'CameraUtils': 'module-CameraUtils',
+			'SceneUtils': 'module-SceneUtils',
+			'SkeletonUtils': 'module-SkeletonUtils',
+			'UniformsUtils': 'module-UniformsUtils',
+
+			'DefaultLoadingManager': 'LoadingManager',
+			'Interpolations': 'module-Interpolations',
+
+			'Animation': 'global',
+			'BufferAttributeUsage': 'global',
+			'Core': 'global',
+			'CustomBlendingEquations': 'global',
+			'Materials': 'global',
+			'Textures': 'global'
+		};
+
+		const parts = hash.split( '/' );
+		let className = parts[ parts.length - 1 ];
+
+		if ( className ) {
+
+			if ( className in mappings ) className = mappings[ className ];
+
+			window.location.href = `${className}.html`;
+
+		}
+
+	}
+
+} )();
+
 const panel = document.getElementById( 'panel' );
 const panelScrim = document.getElementById( 'panelScrim' );
 const expandButton = document.getElementById( 'expandButton' );

粤ICP备19079148号