diff --git a/README.md b/README.md
index 526c8f04ee9920..f0811490c65ba6 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ If everything went well you should see [this](https://jsfiddle.net/f2Lommf5/).
### Change log ###
-[releases](https://github.com/mrdoob/three.js/releases)
+[Releases](https://github.com/mrdoob/three.js/releases)
[npm-badge]: https://img.shields.io/npm/v/three.svg
diff --git a/build/three.js b/build/three.js
index 380dc37ad98d24..f4f94e7208209e 100644
--- a/build/three.js
+++ b/build/three.js
@@ -185,7 +185,7 @@
} );
- var REVISION = '97';
+ var REVISION = '98dev';
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
var CullFaceNone = 0;
var CullFaceBack = 1;
@@ -3666,7 +3666,11 @@
var canvas;
- if ( image instanceof HTMLCanvasElement ) {
+ if ( typeof HTMLCanvasElement == 'undefined' ) {
+
+ return image.src;
+
+ } else if ( image instanceof HTMLCanvasElement ) {
canvas = image;
@@ -21260,7 +21264,66 @@
constructor: ArrayCamera,
- isArrayCamera: true
+ isArrayCamera: true,
+
+ /**
+ * Assumes 2 cameras that are perpendicular and share an X-axis, and that
+ * the cameras' projection and world matrices have already been set.
+ * And that near and far planes are identical for both cameras.
+ */
+ setProjectionFromUnion: function () {
+ var cameraLPos = new Vector3();
+ var cameraRPos = new Vector3();
+
+ return function () {
+ cameraLPos.setFromMatrixPosition( this.cameras[ 0 ].matrixWorld );
+ cameraRPos.setFromMatrixPosition( this.cameras[ 1 ].matrixWorld );
+
+ var ipd = cameraLPos.distanceTo( cameraRPos );
+
+ var projL = this.cameras[ 0 ].projectionMatrix;
+ var projR = this.cameras[ 1 ].projectionMatrix;
+
+ // VR systems will have identical far and near planes, and
+ // most likely identical top and bottom frustum extents.
+ // via: https://computergraphics.stackexchange.com/a/4765
+ var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
+ var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
+
+ var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
+ var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
+ var leftL = leftFovL * near;
+ var rightR = rightFovR * near;
+ var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
+ var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
+ var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
+ var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
+
+ // Calculate the new camera's position offset from the
+ // left camera.
+ var zOffset = ipd / (leftFovL + rightFovR);
+ var xOffset = zOffset * leftFovL;
+
+ // TODO: Better way to apply this offset?
+ this.cameras[ 0 ].matrixWorld.decompose( this.position, this.quaternion, this.scale );
+ this.translateX(xOffset);
+ this.translateZ(-zOffset);
+ this.matrixWorld.compose( this.position, this.quaternion, this.scale );
+ this.matrixWorldInverse.getInverse(this.matrixWorld);
+
+ // Find the union of the frustum values of the cameras and scale
+ // the values so that the near plane's position does not change in world space,
+ // although must now be relative to the new union camera.
+ var near2 = near + zOffset;
+ var far2 = far + zOffset;
+ var left = leftL - xOffset;
+ var right = rightR + (ipd - xOffset);
+ var top = Math.max( topL, topR );
+ var bottom = Math.min( bottomL, bottomR );
+
+ this.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
+ }
+ }(),
} );
@@ -21547,9 +21610,6 @@
cameraL.far = camera.far;
cameraR.far = camera.far;
- cameraVR.matrixWorld.copy( camera.matrixWorld );
- cameraVR.matrixWorldInverse.copy( camera.matrixWorldInverse );
-
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
@@ -21583,10 +21643,7 @@
cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
- // HACK (mrdoob)
- // https://github.com/w3c/webvr/issues/203
-
- cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
+ cameraVR.setProjectionFromUnion();
//
@@ -21809,8 +21866,6 @@
var parent = camera.parent;
var cameras = cameraVR.cameras;
- // apply camera.parent to cameraVR
-
updateCamera( cameraVR, parent );
for ( var i = 0; i < cameras.length; i ++ ) {
@@ -21831,6 +21886,8 @@
}
+ cameraVR.setProjectionFromUnion();
+
return cameraVR;
}
@@ -21869,11 +21926,6 @@
cameraVR.matrix.copy( camera.matrix );
- // HACK (mrdoob)
- // https://github.com/w3c/webvr/issues/203
-
- cameraVR.projectionMatrix.copy( camera.projectionMatrix );
-
}
}
@@ -32088,9 +32140,9 @@
var isBase64 = !! dataUriRegexResult[ 2 ];
var data = dataUriRegexResult[ 3 ];
- data = window.decodeURIComponent( data );
+ data = decodeURIComponent( data );
- if ( isBase64 ) data = window.atob( data );
+ if ( isBase64 ) data = atob( data );
try {
@@ -32144,7 +32196,7 @@
}
// Wait for next browser tick like standard XMLHttpRequest event dispatching does
- window.setTimeout( function () {
+ setTimeout( function () {
if ( onLoad ) onLoad( response );
@@ -32155,7 +32207,7 @@
} catch ( error ) {
// Wait for next browser tick like standard XMLHttpRequest event dispatching does
- window.setTimeout( function () {
+ setTimeout( function () {
if ( onError ) onError( error );
@@ -32492,7 +32544,7 @@
var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' );
-
+ loader.setPath( this.path );
loader.load( url, function ( buffer ) {
var texData = scope._parser( buffer );
@@ -32551,6 +32603,13 @@
return texture;
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
}
} );
@@ -37128,6 +37187,7 @@
var scope = this;
var loader = new FileLoader( scope.manager );
+ loader.setPath( scope.path );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
@@ -37136,12 +37196,6 @@
},
- setTextures: function ( value ) {
-
- this.textures = value;
-
- },
-
parse: function ( json ) {
var textures = this.textures;
@@ -37322,10 +37376,67 @@
return material;
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
+ },
+
+ setTextures: function ( value ) {
+
+ this.textures = value;
+ return this;
+
}
} );
+ /**
+ * @author Don McCurdy / https://www.donmccurdy.com
+ */
+
+ var LoaderUtils = {
+
+ decodeText: function ( array ) {
+
+ if ( typeof TextDecoder !== 'undefined' ) {
+
+ return new TextDecoder().decode( array );
+
+ }
+
+ // Avoid the String.fromCharCode.apply(null, array) shortcut, which
+ // throws a "maximum call stack size exceeded" error for large arrays.
+
+ var s = '';
+
+ for ( var i = 0, il = array.length; i < il; i ++ ) {
+
+ // Implicitly assumes little-endian.
+ s += String.fromCharCode( array[ i ] );
+
+ }
+
+ // Merges multi-byte utf-8 characters.
+ return decodeURIComponent( escape( s ) );
+
+ },
+
+ extractUrlBase: function ( url ) {
+
+ var index = url.lastIndexOf( '/' );
+
+ if ( index === - 1 ) return './';
+
+ return url.substr( 0, index + 1 );
+
+ }
+
+ };
+
/**
* @author mrdoob / http://mrdoob.com/
*/
@@ -37343,6 +37454,7 @@
var scope = this;
var loader = new FileLoader( scope.manager );
+ loader.setPath( scope.path );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
@@ -37407,6 +37519,13 @@
return geometry;
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
}
} );
@@ -37743,49 +37862,6 @@
} );
- /**
- * @author Don McCurdy / https://www.donmccurdy.com
- */
-
- var LoaderUtils = {
-
- decodeText: function ( array ) {
-
- if ( typeof TextDecoder !== 'undefined' ) {
-
- return new TextDecoder().decode( array );
-
- }
-
- // Avoid the String.fromCharCode.apply(null, array) shortcut, which
- // throws a "maximum call stack size exceeded" error for large arrays.
-
- var s = '';
-
- for ( var i = 0, il = array.length; i < il; i ++ ) {
-
- // Implicitly assumes little-endian.
- s += String.fromCharCode( array[ i ] );
-
- }
-
- // Merges multi-byte utf-8 characters.
- return decodeURIComponent( escape( s ) );
-
- },
-
- extractUrlBase: function ( url ) {
-
- var index = url.lastIndexOf( '/' );
-
- if ( index === - 1 ) return './';
-
- return url.substr( 0, index + 1 );
-
- }
-
- };
-
/**
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
@@ -38366,7 +38442,7 @@
function ObjectLoader( manager ) {
this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
- this.texturePath = '';
+ this.resourcePath = '';
}
@@ -38376,15 +38452,13 @@
load: function ( url, onLoad, onProgress, onError ) {
- if ( this.texturePath === '' ) {
-
- this.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 );
-
- }
-
var scope = this;
+ var path = ( this.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : this.path;
+ this.resourcePath = this.resourcePath || path;
+
var loader = new FileLoader( scope.manager );
+ loader.setPath( this.path );
loader.load( url, function ( text ) {
var json = null;
@@ -38418,9 +38492,16 @@
},
- setTexturePath: function ( value ) {
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
+ },
- this.texturePath = value;
+ setResourcePath: function ( value ) {
+
+ this.resourcePath = value;
return this;
},
@@ -38723,7 +38804,7 @@
case 'Geometry':
- geometry = geometryLoader.parse( data, this.texturePath ).geometry;
+ geometry = geometryLoader.parse( data, this.resourcePath ).geometry;
break;
@@ -38855,7 +38936,7 @@
var currentUrl = url[ j ];
- var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( currentUrl ) ? currentUrl : scope.texturePath + currentUrl;
+ var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( currentUrl ) ? currentUrl : scope.resourcePath + currentUrl;
images[ image.uuid ].push( loadImage( path ) );
@@ -38865,7 +38946,7 @@
// load single image
- var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
+ var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.resourcePath + image.url;
images[ image.uuid ] = loadImage( path );
@@ -39900,6 +39981,7 @@
var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' );
+ loader.setPath( this.path );
loader.load( url, function ( buffer ) {
// Create a copy of the buffer. The `decodeAudioData` method
@@ -39915,6 +39997,13 @@
}, onProgress, onError );
+ },
+
+ setPath: function ( value ) {
+
+ this.path = value;
+ return this;
+
}
} );
@@ -46168,6 +46257,17 @@
} );
+ Object.assign( ObjectLoader.prototype, {
+
+ setTexturePath: function ( value ) {
+
+ console.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' );
+ return this.setResourcePath( value );
+
+ }
+
+ } );
+
//
Object.assign( Box2.prototype, {
diff --git a/build/three.min.js b/build/three.min.js
index ca9b61105a791f..831a7218e9908a 100644
--- a/build/three.min.js
+++ b/build/three.min.js
@@ -1,347 +1,347 @@
// threejs.org/license
-(function(l,ia){"object"===typeof exports&&"undefined"!==typeof module?ia(exports):"function"===typeof define&&define.amd?define(["exports"],ia):ia(l.THREE={})})(this,function(l){function ia(){}function A(a,b){this.x=a||0;this.y=b||0}function P(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0 Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);C.prototype.updateMatrixWorld.call(this,a)};var Td,Ae;Hb.prototype=
-Object.create(C.prototype);Hb.prototype.constructor=Hb;Hb.prototype.setDirection=function(){var a=new p,b;return function(c){.99999 Math.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);C.prototype.updateMatrixWorld.call(this,a)};var Td,Ce;Hb.prototype=Object.create(C.prototype);Hb.prototype.constructor=Hb;Hb.prototype.setDirection=function(){var a=new p,b;return function(c){.99999
+ [page:String path] — Base path of the file to load.
+ [page:String path] — Base path of the file to load.=-p?e<=p?(h=1/q,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-p?(d=Math.max(0,-(-k*h+m)),e=0
f;f++)z=h[v++],C=D[2*z],z=D[2*z+1],C=new A(C,z),c.faceVertexUvs[e][u].push(C);y&&(y=3*h[v++],t.normal.set(m[y++],m[y++],m[y]));if(x)for(e=
-0;3>e;e++)y=3*h[v++],x=new p(m[y++],m[y++],m[y]),t.vertexNormals.push(x);n&&(n=h[v++],t.color.setHex(l[n]));if(k)for(e=0;3>e;e++)n=h[v++],t.vertexColors.push(new G(l[n]));c.faces.push(t)}}d=a;v=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(g=0,h=d.skinWeights.length;g
[method:AnimationLoader setPath]( [param:String path] )
+
+
+ Sets the base path or URL from which to load files. This can be useful if
+ you are loading many animations from the same directory.
+ Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/en/loaders/AudioLoader.html b/docs/api/en/loaders/AudioLoader.html
index be2dad7b3f8b86..39cfe23c9319d8 100644
--- a/docs/api/en/loaders/AudioLoader.html
+++ b/docs/api/en/loaders/AudioLoader.html
@@ -92,6 +92,14 @@ [method:null load]( [param:String url], [param:Function onLoad], [param:Func
Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
[method:AudioLoader setPath]( [param:String path] )
+
+
+ Sets the base path or URL from which to load files. This can be useful if
+ you are loading many audios from the same directory.
+ Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/en/loaders/BufferGeometryLoader.html b/docs/api/en/loaders/BufferGeometryLoader.html
index 848b06bf4a7d11..6ff54cb87cb046 100644
--- a/docs/api/en/loaders/BufferGeometryLoader.html
+++ b/docs/api/en/loaders/BufferGeometryLoader.html
@@ -85,6 +85,14 @@ [method:BufferGeometry parse]( [param:Object json] )
Parse a JSON structure and return a [page:BufferGeometry].
+ [page:String path] — Base path of the file to load.
+
+ Sets the base path or URL from which to load files. This can be useful if
+ you are loading many geometries from the same directory.
+
+ [page:String path] — Base path of the file to load.
+
+ Sets the base path or URL from which to load files. This can be useful if
+ you are loading many data textures from the same directory.
+
- [page:Object textures] — object containing any textures used by the material. -
+ [page:String path] — Base path of the file to load.+ [page:Object textures] — object containing any textures used by the material. +
- The base path or URL from which textures will be loaded. See [page:.setTexturePath]. + The base path or URL from which additional resources like textuures will be loaded. See [page:.setResourcePath]. Default is the empty string.
@@ -217,11 +217,14 @@
- [page:String value] — The base path or URL from which textures will be loaded.
-
+ Set the base path for the original file.
+
+ Set the base path for dependent resources like textures.
Creates a three-dimensional texture. This type of texture can only be used with a WebGL 2 rendering context.
+ +
+ [page:Object data] -- data of the texture.
+
+ [page:Number width] -- width of the texture.
+
+ [page:Number height] -- height of the texture.
+
+ [page:Number depth] -- depth of the texture.
+
+ See the base [page:Texture Texture] class for common properties. +
+ ++ See the base [page:Texture Texture] class for common methods. +
+ +Three.js includes polyfills for the following functions and constants.
+Three.js 包含以下方法和常量的差异化支持.
- The difference between one and the smallest value greater than one that can be represented as a Number. + 表示1和大于1的最小差值,可表示为 Number. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON MDN reference].
- If the argument is a positive number, negative number, positive zero or negative zero, - the function will return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned. + 如果参数为 正数,负数,正零 或 负零, + 该方法将分别返回 1, -1, 0 或 -0 . 否则, 返回 NaN. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign MDN reference].
- Returns the name of a function, or (before ES6 implementations) an empty string for anonymous functions. + 返回方法的名字, 或 (在 ES6 实现之前) 为匿名方法返回一个空字符串. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name MDN reference].
- The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. - It will return the target object. + Object.assign() 方法用于从一个或多个源对象拷贝所有可枚举自身属性到目标对象. + 该方法将返回目标对象. [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN reference].
-
+
[name] 可以被用来更加高效地用一组已经预定义好的摄像机来渲染一个场景。 这对于VR场景的渲染来说,是非常重要的一个性能体现。
一个 [name] 的实例中总是包含着一组子摄像机,应当为每一个子摄像机定义*bound*(边界)这个属性,该属性决定了由该子摄像机所渲染的视口区域的大小。
请参阅其基类 [page:PerspectiveCamera] 来查看共有属性。
+请参阅基类[page:PerspectiveCamera]的公共属性。
- 一个包含多个摄像机的数组。 + 摄像机组。
请参阅其基类 [page:PerspectiveCamera] 来查看共有方法。
+请参阅基类[page:PerspectiveCamera]的公共方法。
-- 摄像机的抽象基类,你创建一个摄像机总会继承这个类。 + 摄像机的抽象基类。在构建新摄像机时,应始终继承此类。
-+ 创建一个新的[name](摄像机)。注意:这个类并不是被直接调用的;你所想要的或许是一个 [page:PerspectiveCamera](透视摄像机)或者 [page:OrthographicCamera](正交摄像机)。 +
请参阅其基类[page:Object3D]来查看共有属性。
+
摄像机是一个[page:Layers layers]的成员. 这是一个从[page:Object3D]继承而来的属性。
当摄像机的视点被渲染的时候,物体必须和当前被看到的摄像机共享至少一个层。
+
+ 这是matrixWorld矩阵的逆矩阵。 MatrixWorld包含了相机的世界变换矩阵。
@@ -61,15 +69,19 @@返回一个具有和当前相机的属性一样的新的相机。 +
+ 将源摄像机的属性复制到新摄像机中。 +
+
[page:Vector3 target] — 调用该函数的结果将复制给该Vector3对象。
返回一个能够表示当前摄像机所正视的世界空间方向的[page:Vector3]对象。
diff --git a/docs/api/zh/cameras/CubeCamera.html b/docs/api/zh/cameras/CubeCamera.html
index 096f764465b13b..2557603a2f645e 100644
--- a/docs/api/zh/cameras/CubeCamera.html
+++ b/docs/api/zh/cameras/CubeCamera.html
@@ -12,6 +12,7 @@
创建6个摄像机,并将它们所拍摄的场景渲染到[page:WebGLRenderTargetCube]上。
+
near -- 远剪切面的距离
far -- 近剪切面的距离
cubeResolution -- 设置立方体边缘的长度
构造一个包含6个[page:PerspectiveCamera PerspectiveCameras](透视摄像机)的立方摄像机,并将其拍摄的场景渲染到一个[page:WebGLRenderTargetCube]上。 +
@@ -67,6 +72,7 @@请参阅其基类[page:Object3D]来查看其共有方法。
+
renderer -- 当前的WebGL渲染器
@@ -80,6 +86,7 @@
这个方法用来来清除[page:CubeCamera.renderTarget renderTarget]的颜色、深度和/或模板缓冲区。 颜色缓冲区设置为渲染器当前的“清除”色。参数默认值均为*true*。 +
+
left — 摄像机视锥体左侧面。
right — 摄像机视锥体右侧面。
top — 摄像机视锥体上侧面。
@@ -54,6 +57,7 @@
摄像机视锥体远端面,其默认值为*2000*。
其值的有效范围介于[page:.near near](摄像机视锥体近端面)和无穷大之间。
+
更新摄像机投影矩阵。在任何参数被改变以后必须被调用。 +
+ 使用JSON格式来返回摄像机数据。
diff --git a/docs/api/zh/cameras/StereoCamera.html b/docs/api/zh/cameras/StereoCamera.html index 1d0177042b5658..c71dbc9d4dfb13 100644 --- a/docs/api/zh/cameras/StereoCamera.html +++ b/docs/api/zh/cameras/StereoCamera.html @@ -49,7 +49,6 @@右摄像机,它被加入到了[page:Layers layer 2]中 —— 需要被右摄像机渲染的物体也应当要加入到这一层中。
-
- This class stores data for an attribute (such as vertex positions, face indices, normals,
- colors, UVs, and any custom attributes ) associated with a [page:BufferGeometry], which allows
- for more efficient passing of data to the GPU. See that page for details and a usage example.
+ 这个类用于存储与[page:BufferGeometry]相关联的 attribute(例如顶点位置向量,面片索引,法向量,颜色值,UV坐标以及任何自定义 attribute )。
+ 利用 BufferAttribute,可以更高效的向GPU传递数据。详情和例子见该页。
- Data is stored as vectors of any length (defined by [page:BufferAttribute.itemSize itemSize]),
- and in general in the methods outlined below if passing in an index, this is automatically
- multiplied by the vector length.
+ 在 BufferAttribute 中,数据被存储为任意长度的矢量(通过[page:BufferAttribute.itemSize itemSize]进行定义),下列函数如无特别说明,
+ 函数参数中的index会自动乘以矢量长度进行计算。
- [page:TypedArray array] -- Must be a [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray].
- Used to instantiate the buffer.
- This array should have
+ [page:TypedArray array] -- 必须是 [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray].
+ 类型,用于实例化缓存。
+ 该队列应该包含:
itemSize * numVertices
- elements, where numVertices is the number of vertices in the associated [page:BufferGeometry BufferGeometry].
+ 个元素,numVertices 是 [page:BufferGeometry BufferGeometry]中的顶点数目
- [page:Integer itemSize] -- the number of values of the array that should be associated with
- a particular vertex. For instance, if this
- attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
+ [page:Integer itemSize] --
+ 队列中与顶点相关的数据值的大小。举例,如果 attribute 存储的是三元组(例如顶点空间坐标、法向量或颜色值)则itemSize的值应该是3。
- [page:Boolean normalized] -- (optional) Indicates how the underlying data in the buffer maps
- to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance of
- UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array
- data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map
- from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values
- will be converted to floats which contain the exact value, i.e. 32767 becomes 32767.0f.
+ [page:Boolean normalized] -- (可选) 指明缓存中的数据如何与GLSL代码中的数据对应。例如,如果[page:TypedArray array]是
+ UInt16Array类型,且[page:Boolean normalized]的值是 true,则队列中的值将会从 0 - +65535 映射为 GLSL 中的 0.0f - +1.0f。
+ 如果[page:TypedArray array]是 Int16Array (有符号),则值将会从 -32767 - +32767 映射为 -1.0f - +1.0f。若 [page:Boolean normalized]
+ 的值为 false,则数据映射不会归一化,而会直接映射为 float 值,例如,32767 将会映射为 32767.0f.
- The [page:TypedArray array] holding data stored in the buffer. + 在 [page:TypedArray array] 中保存着缓存中的数据。
- Stores the [page:BufferAttribute.array array]'s length divided by the [page:BufferAttribute.itemSize itemSize].
+ 保存 [page:BufferAttribute.array array] 除以 [page:BufferAttribute.itemSize itemSize] 之后的大小。
- If the buffer is storing a 3-component vector (such as a position, normal, or color),
- then this will count the number of such vectors stored.
+ 若缓存存储三元组(例如顶点位置、法向量、颜色值),则该值应等于队列中三元组的个数。
- Whether the buffer is dynamic or not. Default is *false*.
+ 不论缓存是否是动态的,默认值都将是 *false*
- If false, the GPU is informed that contents of the buffer are likely to be used often and not change often.
- This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.STATIC_DRAW] flag.
- if true, the GPU is informed that contents of the buffer are likely to be used often and change often.
- This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.DYNAMIC_DRAW] flag.
+ 如果该值为 false,即告知 GPU 缓存中的数据会经常使用但不经常变化。
+ 该值与 [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.STATIC_DRAW] 标志位相一致。
+ 如果该值为 true,即告知 GPU 缓存中的数据会经常使用且经常变化。
+ 该值与 [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.DYNAMIC_DRAW] 标志位相一致。
- Used to check whether this or derived classes are BufferAttributes. Default is *true*.
+ 指示当前类或派生类是 BufferAttributes. 默认值为 *true*.
- You should not change this, as it used internally for optimisation.
+ 开发者不应当改变该值,该值用于内部实现优化。
The length of vectors that are being stored in the [page:BufferAttribute.array array].
+保存在 [page:BufferAttribute.array array] 中矢量的长度。
- Optional name for this attribute instance. Default is an empty string. + 该 attribute 实例的别名,默认值为空字符串。
- Flag to indicate that this attribute has changed and should be re-sent to the GPU.
- Set this to true when you modify the value of the array.
-
- Setting this to true also increments the [page:BufferAttribute.version version].
+ 该标志位指明当前 attribute 已经被修改过,且需要再次送入 GPU 处理。当开发者改变了该队列的值,则标志位需要设置为 true。
+ 将标志位设为 true 同样会增加 [page:BufferAttribute.version version] 的值。
- Indicates how the underlying data in the buffer maps to the values in the GLSL shader code. - See the constructor above for details. + 指明缓存中数据在转化为GLSL着色器代码中数据时是否需要被归一化。详见构造函数中的说明。
- A callback function that is executed after the Renderer has transfered the attribute array data to the GPU. + attribute 数据传输到GPU后的回调函数。
Object containing:
- [page:Integer offset]: Default is *0*. Position at whcih to start update.
- [page:Integer count]: Default is *-1*, which means don't use update ranges.
+
对象包含如下成员:
+ [page:Integer offset]: 默认值为 *0*。 指明更新的起始位置。
+ [page:Integer count]: 默认值为 *-1*,表示不指定更新范围。
- This can be used to only update some components of stored vectors (for example, just the component
- related to color).
+ 该值只可以被用于更新某些矢量数据(例如,颜色相关数据)。
A version number, incremented every time the [page:BufferAttribute.needsUpdate needsUpdate] property is set to true.
+版本号,当 [page:BufferAttribute.needsUpdate needsUpdate] 被设置为 true 时,该值会自增。
-Return a copy of this bufferAttribute.
+返回该 BufferAttribute 的拷贝。
Copy the array given here (which can be a normal array or TypedArray) into
- [page:BufferAttribute.array array].
-
- See [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]
- for notes on requirements if copying a TypedArray.
+
将参数中所给定的普通队列或 TypedArray 拷贝到 [page:BufferAttribute.array array] 中。
+ 拷贝 TypedArray 相关注意事项详见 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]。
Copy a vector from bufferAttribute[index2] to [page:BufferAttribute.array array][index1].
+将一个矢量从 bufferAttribute[index2] 拷贝到 [page:BufferAttribute.array array][index1] 中。
Copy an array representing RGB color values into [page:BufferAttribute.array array].
+将一个存储 RGB 颜色值的队列拷贝到 [page:BufferAttribute.array array] 中。
Copy an array representing [page:Vector2]s into [page:BufferAttribute.array array].
+将一个存储 [page:Vector2] 的队列拷贝到 [page:BufferAttribute.array array] 中。
Copy an array representing [page:Vector3]s into [page:BufferAttribute.array array].
+将一个存储 [page:Vector3] 的队列拷贝到 [page:BufferAttribute.array array] 中。
Copy an array representing [page:Vector4]s into [page:BufferAttribute.array array].
+将一个存储 [page:Vector4] 的队列拷贝到 [page:BufferAttribute.array array] 中。
Returns the x component of the vector at the given index.
+获取给定索引的矢量的第一维元素 (即 X 值)。
Returns the y component of the vector at the given index.
+获取给定索引的矢量的第二维元素 (即 Y 值)。
Returns the z component of the vector at the given index.
+获取给定索引的矢量的第三维元素 (即 Z 值)。
Returns the w component of the vector at the given index.
+获取给定索引的矢量的第四维元素 (即 W 值)。
- Sets the value of the onUploadCallback property.
-
- In the [example:webgl_buffergeometry WebGL / Buffergeometry] this is used to free memory
- after the buffer has been transfered to the GPU.
+
见 onUploadCallback 属性。
+ 在 [example:webgl_buffergeometry WebGL / Buffergeometry] 中,该方在缓存数据传递给 GPU 后,用于释放内存。
- value -- an [page:Array] or [page:TypedArray] from which to copy values.
- offset -- (optional) index of the [page:BufferAttribute.array array] at which to start copying.
+ value -- 被拷贝的 [page:Array] 或 [page:TypedArray] 类型的数据。
+ offset -- (可选) [page:BufferAttribute.array array] 中开始拷贝的位置索引。
- Calls [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]( [page:Array value], [page:Integer offset] )
- on the [page:BufferAttribute.array array].
+ 对 [page:BufferAttribute.array array],调用 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]( [page:Array value], [page:Integer offset] )
+ 方法。
- In particular, see that page for requirements on [page:Array value]
- being a [page:TypedArray].
+ 特别的, 对将 [page:Array value] 转为 [page:TypedArray] 的要求详见上述链接。
- [page:BufferAttribute.array array] to the TypedArray passed in here.
+ [page:BufferAttribute.array array] 被赋值的 TypedArray 队列。
- After setting the array, [page:BufferAttribute.needsUpdate needsUpdate] should be set to true.
+ 队列被复制后,[page:BufferAttribute.needsUpdate needsUpdate] 应当被设置为 true。
Set [page:BufferAttribute.dynamic dynamic] to value.
+将 [page:BufferAttribute.dynamic dynamic] 设置为 value.
Sets the x component of the vector at the given index.
+设置给定索引的矢量的第一维数据(设置 X 值)。
Sets the y component of the vector at the given index.
+设置给定索引的矢量的第二维数据(设置 Y 值)。
Sets the z component of the vector at the given index.
+设置给定索引的矢量的第三维数据(设置 Z 值)。
Sets the w component of the vector at the given index.
+设置给定索引的矢量的第四维数据(设置 W 值)。
Sets the x and y components of the vector at the given index.
+设置给定索引的矢量的第一、二维数据(设置 X 和 Y 值)。
Sets the x, y and z components of the vector at the given index.
+设置给定索引的矢量的第一、二、三维数据(设置 X、Y 和 Z 值)。
Sets the x, y, z and w components of the vector at the given index.
+设置给定索引的矢量的第一、二、三、四维数据(设置 X、Y、Z 和 W 值)。
-- An efficient representation of mesh, line, or point geometry. Includes vertex positions, face - indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of - passing all this data to the GPU. + 是面片、线或点几何体的有效表述。包括顶点位置,面片索引、法相量、颜色值、UV 坐标和自定义缓存属性值。使用 BufferGeometry + 可以有效减少向 GPU 传输上述数据所需的开销。
- To read and edit data in BufferGeometry attributes, see [page:BufferAttribute] documentation. + 读取或编辑 BufferGeometry 中的数据,见 [page:BufferAttribute] 文档。
- For a less efficient but easier-to-use representation of geometry, see [page:Geometry]. + 几何体的更多使用示例,详见 [page:Geometry]。
-
var geometry = new THREE.BufferGeometry();
- // create a simple square shape. We duplicate the top left and bottom right
- // vertices because each vertex needs to appear once per triangle.
+ // 创建一个简单的矩形. 在这里我们左上和右下顶点被复制了两次。
+ // 因为在两个三角面片里,这两个顶点都需要被用到。
var vertices = new Float32Array( [
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
@@ -37,7 +36,7 @@ Example
-1.0, -1.0, 1.0
] );
- // itemSize = 3 because there are 3 values (components) per vertex
+ // itemSize = 3 因为每个顶点都是一个三元组。
geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
var mesh = new THREE.Mesh( geometry, material );
@@ -52,76 +51,69 @@ Example
- Accessing Attributes
+ 访问属性值
- WebGL stores data associated with individual vertices of a geometry in attributes.
- Examples include the position of the vertex, the normal vector for the vertex, the vertex color,
- and so on. When using [page:Geometry], the [page:WebGLRenderer renderer] takes care of wrapping
- up this information into typed array buffers and sending this data to the shader. With
- BufferGeometry, all of this data is stored in buffers associated with individual attributes.
- This means that to get the position data associated with a vertex (for instance), you must call
- [page:.getAttribute] to access the 'position' [page:BufferAttribute attribute], then access the individual
- x, y, and z coordinates of the position.
+ WebGL 将与每个顶点相关的数据保存为 attributes. 这些属性例如,顶点位置、顶点法向量、顶点颜色等等。
+ 当使用 [page:Geometry] 时,[page:WebGLRenderer renderer] 将数据包装为有类型的队列的缓存,并将数据送往着色器。有了
+ BufferGeometry 这些数据都被存储到相应类型的属性的缓存中。这就意味着,如果想要获得顶点的位置信息,你必须调用
+ [page:.getAttribute] 访问位置信息的 page:BufferAttribute attribute],之后再访问位置矢量中每一维坐标值(x,y,z 值)。
- The following attributes are set by various members of this class:
+ 通过该类提供的下属方法设置以下属性值:
[page:BufferAttribute position] (itemSize: 3)
- Stores the x, y, and z coordinates of each vertex in this geometry. Set by [page:.fromGeometry]().
+ 存储当前几何体中每个顶点的坐标,包含 x,y,z 三维数据。通过 [page:.fromGeometry]() 设置。
[page:BufferAttribute normal] (itemSize: 3)
- Stores the x, y, and z components of the vertex normal vector of each vertex in this geometry.
- Set by [page:.fromGeometry]().
+ 存储当前几何体中每个顶点的法向量,包含 x,y,z 三维数据。通过 [page:.fromGeometry]() 设置。
[page:BufferAttribute color] (itemSize: 3)
- Stores the red, green, and blue channels of vertex color of each vertex in this geometry.
- Set by [page:.fromGeometry]().
+ 存储当前几何体中每个顶点的颜色值,包含 R,G,B 三通道颜色值。通过 [page:.fromGeometry]() 设置。
- In addition to the the built-in attributes, you can set your own custom attributes using the addAttribute method. With [page:Geometry], these attributes are set and stored on the [page:Material]. In BufferGeometry, the attributes are stored with the geometry itself. Note that you still need to set the attributes information on the material as well, but the value of each attribute is stored in the BufferGeometry.
+ 除了上述已有的属性,你可以通过 addAttribute 方法自定义属性。通过 [page:Geometry],这些自定义属性被存储到
+ [page:Material] 中。在 BufferGeometry 中,属性则被存储到几何体本身。注意,你依然需要在材质中设置属性信息,
+ 但是属性的值则被存储到 BufferGeometry。
- Constructor
+ 构造函数
[name]()
- This creates a new [name]. It also sets several properties to a default value.
+ 创建一个新的 [name]. 同时将预置属性设置为默认值.
- Properties
+ 属性
[property:Object attributes]
- This hashmap has as id the name of the attribute to be set and as value the [page:BufferAttribute buffer] to set it to.
- Rather than accessing this property directly, use [page:.addAttribute] and [page:.getAttribute] to access attributes of this geometry.
+ 通过 hashmap 存储该几何体相关的属性,hashmap 的 id 是当前 attribute 的名称,值是相应的 [page:BufferAttribute buffer]。
+ 你可以通过 [page:.addAttribute] 和 [page:.getAttribute] 添加和访问与当前几何体有关的 attribute。
[property:Box3 boundingBox]
- Bounding box for the bufferGeometry, which can be calculated with
- [page:.computeBoundingBox](). Default is *null*.
+ 当前 bufferGeometry 的外边界矩形。可以通过 [page:.computeBoundingBox]() 计算。默认值是 *null*。
[property:Sphere boundingSphere]
- Bounding sphere for the bufferGeometry, which can be calculated with
- [page:.computeBoundingSphere](). Default is *null*.
+ 当前 bufferGeometry 的外边界球形。可以通过 [page:.computeBoundingSphere]() 计算。默认值是 *null*。
[property:Object drawRange]
- Used to determine what part of the geometry should be rendered. This should not
- be set directly, instead use [page:.setDrawRange].
- Default is
+ 用于判断几何体的哪个部分需要被渲染。该值不应该直接被设置,而需要通过 [page:.setDrawRange] 进行设置。
+ 默认值为
{ start: 0, count: Infinity }
@@ -129,16 +121,16 @@
[property:Object drawRange]
[property:Array groups]
- Split the geometry into groups, each of which will be rendered in a separate WebGL draw call.
- This allows an array of materials to be used with the bufferGeometry.
+ 将当前几何体分割成组进行渲染,每个部分都会在单独的 WebGL 的 draw call 中进行绘制。该方法可以让当前的 bufferGeometry
+ 可以使用一个材质队列进行描述。
- Each group is an object of the form:
+ 分割后的每个部分都是一个如下的表单:
{ start: Integer, count: Integer, materialIndex: Integer }
- where start specifies the first element in this draw call – the first vertex for non-indexed geometry,
- otherwise the first triangle index. Count specifies how many vertices (or indices) are included, and
- materialIndex specifies the material array index to use.
+ start 表明当前 draw call 中的没有索引的几何体的几何体的第一个顶点;或者第一个三角面片的索引。
+ count 指明当前分割包含多少顶点(或 indices)。
+ materialIndex 指出当前用到的材质队列的索引。
- Use [page:.addGroup] to add groups, rather than modifying this array directly.
+ 通过 [page:.addGroup] 来增加组,而不是直接更改当前队列。
@@ -154,206 +146,177 @@ [property:Array drawcalls]
[property:Integer id]
- Unique number for this bufferGeometry instance.
+ 当前 bufferGeometry 的唯一编号。
[property:BufferAttribute index]
- Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles" and
- works much the same as it does in [page:Geometry]: each triangle is associated with the indices of three vertices.
- This attribute therefore stores the index of each vertex for each triangular face.
+ 允许顶点在多个三角面片间可以重用。这样的顶点被称为"已索引的三角面片(indexed triangles)"并且使用时和[page:Geometry]中一致:
+ 每个三角面片都和三个顶点的索引相关。该 attribute 因此所存储的是每个三角面片的三个顶点的索引。
- If this attribute is not set, the [page:WebGLRenderer renderer] assumes that each three contiguous
- positions represent a single triangle.
+ 如果该 attribute 没有设置过,则 [page:WebGLRenderer renderer] 假设每三个连续的位置代表一个三角面片。
- Default is *null*.
+ 默认值是 *null*。
[property:Boolean isBufferGeometry]
- Used to check whether this or derived classes are BufferGeometries. Default is *true*.
+ 用于检查当前类或派生类的类型是 BufferGeometries。默认值是 *true*。
- You should not change this, as it used internally for optimisation.
+ 该值用于内部优化,你不应该手动修改该值。
[property:Object morphAttributes]
- Hashmap of [page:BufferAttribute]s holding details of the geometry's [page:Geometry.morphTargets morphTargets].
+ 存储 [page:BufferAttribute] 的 Hashmap,存储了几何体 [page:Geometry.morphTargets morphTargets] 的细节信息。
[property:String name]
- Optional name for this bufferGeometry instance. Default is an empty string.
+ 当前 bufferGeometry 实例的可选别名。默认值是空字符串。
[property:Object userData]
- An object that can be used to store custom data about the BufferGeometry. It should not hold
- references to functions as these will not be cloned.
+ 存储 BufferGeometry 的自定义数据的对象。为保持对象在克隆时完整,该对象不应该包括任何函数的引用。
[property:String uuid]
- [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
- This gets automatically assigned and shouldn't be edited.
+ 当前对象实例的 [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID],该值会自动被分配,且不应被修改。
- Methods
+ 方法
- [page:EventDispatcher EventDispatcher] methods are available on this class.
+ [page:EventDispatcher EventDispatcher] 在该类上可用的所有方法。
[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )
- Adds an attribute to this geometry. Use this rather than the attributes property,
- because an internal hashmap of [page:.attributes] is maintained to speed up iterating over
- attributes.
+ 为当前几何体增加一个 attribute。 的属性,在类的内部,有一个存储 [page:.attributes] 的 hashmap,
+ 通过该 hashmap,遍历 attributes 的速度会更快。而使用该方法,可以向 hashmap 内部增加 attribute。
+ 所以,你需要使用该方法来添加 attributes。
[method:null addGroup]( [param:Integer start], [param:Integer count], [param:Integer materialIndex] )
- Adds a group to this geometry; see the [page:BufferGeometry.groups groups]
- property for details.
+ 为当前几何体增加一个 group,详见 [page:BufferGeometry.groups groups] 属性。
[method:null applyMatrix]( [param:Matrix4 matrix] )
- Bakes matrix transform directly into vertex coordinates.
+ 用给定矩阵转换几何体的顶点坐标。
[method:BufferGeometry center] ()
- Center the geometry based on the bounding box.
+ 根据边界矩形将几何体居中。
[method:BufferGeometry clone]()
- Creates a clone of this BufferGeometry.
+ 克隆当前的 BufferGeometry。
[method:BufferGeometry copy]( [param:BufferGeometry bufferGeometry] )
- Copies another BufferGeometry to this BufferGeometry.
+ 将参数指定的 BufferGeometry 的值拷贝到当前 BufferGeometry 中。
[method:null clearGroups]( )
- Clears all groups.
+ 清空所有的 groups。
[method:null computeBoundingBox]()
- Computes bounding box of the geometry, updating [param:.boundingBox] attribute.
- Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*.
+ 计算当前几何体的的边界矩形,该操作会更新已有 [param:.boundingBox]。
+ 边界矩形不会默认计算,需要调用该接口指定计算边界矩形,否则保持默认值 *null*。
[method:null computeBoundingSphere]()
- Computes bounding sphere of the geometry, updating [page:.boundingSphere] attribute.
- Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are *null*.
+ 计算当前几何体的的边界球形,该操作会更新已有 [param:.boundingSphere]。
+ 边界球形不会默认计算,需要调用该接口指定计算边界球形,否则保持默认值 *null*。
[method:null computeVertexNormals]()
- Computes vertex normals by averaging face normals.
+ 通过面片法向量的平均值计算每个顶点的法向量。
[method:null dispose]()
- Disposes the object from memory.
- You need to call this when you want the BufferGeometry removed while the application is running.
+ 从内存中销毁对象。
+ 如果在运行是需要从内存中删除 BufferGeometry,则需要调用该函数。
[method:BufferGeometry fromDirectGeometry]( [param:Geometry] )
- Populates this BufferGeometry with data from a [page:DirectGeometry] object containing faces. Not implemented for a line geometry.
+ 通过 [page:DirectGeometry] 所包含的面数据生成一个 BufferGeometry 对象。对于线型几何体未实现该方法。
- Note: [page:DirectGeometry] is mainly used as an intermediary object for converting between [page:Geometry]
- and BufferGeometry.
+ 注意: [page:DirectGeometry] 主要用于内部 [page:Geometry] 和 BufferGeometry 的类型转换。
[method:BufferGeometry fromGeometry]( [param:Geometry] )
- Populates this BufferGeometry with data from a [page:Geometry] object containing faces. Not implemented for a line geometry.
+ 通过 [page:Geometry] 所包含的面信息生成一个 BufferGeometry 对象。对于线型几何体未实现该方法。
[method:BufferAttribute getAttribute]( [param:String name] )
- Returns the [page:BufferAttribute attribute] with the specified name.
+ 返回指定名称的 [page:BufferAttribute attribute]。
[method:BufferAttribute getIndex] ()
- Return the [page:.index] buffer.
+ 返回缓存相关的 [page:.index]。
[method:BufferGeometry lookAt] ( [param:Vector3 vector] )
- vector - A world vector to look at.
+ vector - 几何体所朝向的世界坐标。
- Rotates the geometry to face a point in space. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.lookAt] for typical real-time mesh usage.
+ 旋转几何体朝向控件中的一点。该过程通常在一次处理中完成,不会循环处理。典型的用法是过通过调用 [page:Object3D.lookAt] 实时改变 mesh 朝向。
[method:null merge]( [param:BufferGeometry bufferGeometry], [param:Integer offset] )
- Merge in another BufferGeometry with an optional offset of where to start merging in.
+ 同参数指定的 BufferGeometry 进行合并。可以通过可选参数指定,从哪个偏移位置开始进行 merge。
[method:null normalizeNormals]()
- Every normal vector in a geometry will have a magnitude of 1.
- This will correct lighting on the geometry surfaces.
+ 几何体中的每个法向量长度将会为 1。这样操作会更正光线在表面的效果。
[method:BufferAttribute removeAttribute]( [param:String name] )
- Removes the [page:BufferAttribute attribute] with the specified name.
+ 删除具有指定名称的 [page:BufferAttribute attribute]。
[method:BufferGeometry rotateX] ( [param:Float radians] )
- Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 在 X 轴上旋转几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
[method:BufferGeometry rotateY] ( [param:Float radians] )
- Rotate the geometry about the Y axis. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 在 Y 轴上旋转几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
[method:BufferGeometry rotateZ] ( [param:Float radians] )
- Rotate the geometry about the Z axis. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 在 Z 轴上旋转几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
[method:BufferGeometry scale] ( [param:Float x], [param:Float y], [param:Float z] )
- Scale the geometry data. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.scale] for typical real-time mesh scaling.
+ 缩放几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.scale] 实时旋转几何体。
[method:null setIndex] ( [param:BufferAttribute index] )
- Set the [page:.index] buffer.
+ 设置缓存的 [page:.index]。
[method:null setDrawRange] ( [param:Integer start], [param:Integer count] )
- Set the [page:.drawRange] buffer. See that property for details.
+ 设置缓存的 [page:.drawRange]。详见相关属性说明。
[method:BufferGeometry setFromObject] ( [param:Object3D object] )
- Sets the attributes for this BufferGeometry from an [page:Object3D].
+ 通过 [page:Object3D] 设置该 BufferGeometry 的 attribute。
[method:BufferGeometry setFromPoints] ( [param:Array points] )
- Sets the attributes for this BufferGeometry from an array of points.
+ 通过点队列设置该 BufferGeometry 的 attribute。
[method:Object toJSON]()
- Returns a JSON object representation of the BufferGeometry.
+ 返回代表该 BufferGeometry 的 JSON 对象。
[method:BufferGeometry toNonIndexed]()
- Return a non-index version of an indexed BufferGeometry.
+ 返回已索引的 BufferGeometry 的非索引版本。
[method:BufferGeometry translate] ( [param:Float x], [param:Float y], [param:Float z] )
- Translate the geometry. This is typically done as a one time operation, and not during a loop.
- Use [page:Object3D.position] for typical real-time mesh translation.
+ 移动几何体。该操作一般在一次处理中完成,不会循环处理。典型的用法是通过调用 [page:Object3D.rotation] 实时旋转几何体。
[method:BufferGeometry updateFromObject] ( [param:Object3D object] )
- Updates the attributes for this BufferGeometry from an [page:Object3D].
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ 通过 [page:Object3D] 更新 BufferGeometry 的 attribute。
Source
diff --git a/docs/api/zh/core/Clock.html b/docs/api/zh/core/Clock.html
index 9d1b6a7d0a956f..25dce5b1f881db 100644
--- a/docs/api/zh/core/Clock.html
+++ b/docs/api/zh/core/Clock.html
@@ -9,78 +9,76 @@
[name]
-
- Object for keeping track of time. This uses performance.now()
- if it is available, otherwise it reverts to the less accurate Date.now().
+ 该对象用于跟踪时间。如果performance.now()可用,则
+ Clock 对象通过该方法实现,否则通过歉精准的Date.now()实现。
- Constructor
+ 构造函数
[name]( [param:Boolean autoStart] )
- autoStart — (optional) whether to automatically start the clock. Default is true.
+ autoStart — (可选) 是否要自动开启时钟。默认值是 true。
- Properties
+ 属性
[property:Boolean autoStart]
- If set, starts the clock automatically when the first update is called. Default is true.
+ 如果设置为 true,则在第一次 update 时开启时钟。默认值是 true。
[property:Float startTime]
- Holds the time at which the clock's [page:Clock.start start] method was last called.
+ 存储时钟最后一次调用 [page:Clock.start start] 方法的时间。
[property:Float oldTime]
- Holds the time at which the clock's [page:Clock.start start], [page:Clock.getElapsedTime getElapsedTime] or [page:Clock.getDelta getDelta]
- methods were last called.
+ 存储时钟最后一次调用 [page:Clock.start start], [page:Clock.getElapsedTime getElapsedTime] 或 [page:Clock.getDelta getDelta] 方法的时间。
[property:Float elapsedTime]
- Keeps track of the total time that the clock has been running.
+ 保存时钟运行的总时长。
[property:Boolean running]
- Whether the clock is running or not.
+ 判断时钟是否在运行。
- Methods
+ 方法
[method:null start]()
- Starts clock. Also sets the [page:Clock.startTime startTime] and [page:Clock.oldTime oldTime]
- to the current time, sets [page:Clock.elapsedTime elapsedTime] to *0* and [page:Clock.running running] to *true*.
+ 启动时钟。同时将 [page:Clock.startTime startTime] 和 [page:Clock.oldTime oldTime] 设置为当前时间。
+ 设置 [page:Clock.elapsedTime elapsedTime] 为 *0*,并且设置 [page:Clock.running running] 为 *true*.
[method:null stop]()
- Stops clock and sets [page:Clock.oldTime oldTime] to the current time.
+ 停止时钟。同时将 [page:Clock.oldTime oldTime] 设置为当前时间。
[method:Float getElapsedTime]()
- Get the seconds passed since the clock started and sets [page:Clock.oldTime oldTime] to the current time.
- If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
+ 获取自时钟启动后的秒数,摒弃将 [page:Clock.oldTime oldTime] 设置为当前时间。
+ 如果 [page:Clock.autoStart autoStart] 设置为 *true* 且时钟并未运行,则该方法同时启动时钟。
[method:Float getDelta]()
- Get the seconds passed since the time [page:Clock.oldTime oldTime] was set and sets [page:Clock.oldTime oldTime] to the current time.
- If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
+ 获取自 [page:Clock.oldTime oldTime] 设置后到当前的秒数。 同时将 [page:Clock.oldTime oldTime] 设置为当前时间。
+ 如果 [page:Clock.autoStart autoStart] 设置为 *true* 且时钟并未运行,则该方法同时启动时钟。
- Source
+ 资源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/core/DirectGeometry.html b/docs/api/zh/core/DirectGeometry.html
index c94f455079ed4c..4f964453bb1761 100644
--- a/docs/api/zh/core/DirectGeometry.html
+++ b/docs/api/zh/core/DirectGeometry.html
@@ -11,97 +11,92 @@
[name]
- This class is used internally to convert from [page:Geometry] to [page:BufferGeometry].
+ 该类在内部被用于 [page:Geometry] 到 [page:BufferGeometry] 的转换。
-
-
- Constructor
+ 构造函数
[name]()
- This creates a new [name].
+ 创建一个新的 [name] 对象。
- Properties
+ 属性
[property:Integer id]
- Unique number for this [name] instance.
+ 当前 [name] 实例的唯一数字标识。
[property:String name]
- Optional name. Default is the empty string.
+ 可选名称. 默认值是空字符串。
[property:Array type]
- String 'DirectGeometry'.
+ 返回 'DirectGeometry' 字符串。
[property:Array vertices]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array normals]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array colors]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array uvs]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array uvs2]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array groups]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array morphTargets]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array skinWeights]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Array skinIndices]
- Initialiased as an empty array, this is populated by [page:.fromGeometry]().
+ 被初始化为一个空队列, 该属性由 [page:.fromGeometry]() 赋值。
[property:Box3 boundingBox]
- Bounding box for the bufferGeometry, which can be calculated with
- [page:.computeBoundingBox](). Default is *null*.
+ 对应 bufferGeometry 的外边界矩形,该值可通过 [page:.computeBoundingBox]() 计算。默认值是 *null*。
[property:Sphere boundingSphere]
- Bounding sphere for the bufferGeometry, which can be calculated with
- [page:.computeBoundingSphere](). Default is *null*.
+ 对应 bufferGeometry 的外边界球,该值可通过 [page:.computeBoundingSphere]() 计算。默认值是 *null*。
[property:Boolean verticesNeedUpdate]
- Default is false.
+ 默认值为 false。
[property:Boolean normalsNeedUpdate]
- Default is false.
+ 默认值为 false。
[property:Boolean colorsNeedUpdate]
- Default is false.
+ 默认值为 false。
[property:Boolean uvsNeedUpdate]
- Default is false.
+ 默认值为 false。
[property:Boolean groupsNeedUpdate]
- Default is false.
+ 默认值为 false。
- Methods
+ 方法
[property:null computeGroups]( [param:Geometry geometry] )
- Compute the parts of the geometry that have different materialIndex.
- See [page:BufferGeometry.groups].
+ 计算几何体中有不同 materialIndex 的部分,详见 [page:BufferGeometry.groups]。
[property:null fromGeometry]( [param:Geometry geometry] )
- Pass in a [page:Geometry] instance for conversion.
+ 传入一个需要转换的 [page:Geometry] 实例。
- Source
+ 资源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
Uniforms are global [link:https://www.opengl.org/documentation/glsl/ GLSL] variables. They are passed to shader programs. +
Uniforms 是 [link:https://www.opengl.org/documentation/glsl/ GLSL] 着色器中的全局变量。
-+ 在声明一个 [page:ShaderMaterial] 的 Uniform 变量时,该变量被值或对象声明。 When declaring a uniform of a [page:ShaderMaterial], it is declared by value or by object.
@@ -24,24 +25,21 @@ Example
}
- - Each uniform must have a *value* property. The type of the value must correspond to the - type of the uniform variable in the GLSL code as specified for the primitive GLSL types - in the table below. Uniform structures and arrays are also supported. GLSL arrays of primitive - type must either be specified as an array of the corresponding THREE objects or as a flat - array containing the data of all the objects. In other words; GLSL primitives in arrays - must not be represented by arrays. This rule does not apply transitively. - An array of *vec2* arrays, each with a length of five vectors, must be an array of arrays, - of either five [page:Vector2] objects or ten *number*s. + 每个 Uniform 必须包括一个 *value* 属性。value 的类型必须和下表中 GLSL 的基本类型相对应。同样,Uniform 的结构体和队列 + 也是支持的。 GLSL基本类型队列必须要么被显示声明为一个 THREE 对象的队列,要么被声明为一个包含所有对象数据的队列。这就是说, + 队列中的 GLSL 基础类型不能再是一个队列。举例,一个有 5 个 *vec2* 元素的队列,必须是一个包含 5 个 [page:Vector2] 的队列数组, + 或包含 10 个 *number* 的队列。 +
GLSL type | -JavaScript type | +GLSL 类型 | +JavaScript 类型 |
---|
- (*) Same for an (innermost) array (dimension) of the same GLSL type, containing the components of all vectors or matrices in the array. + + (*) 与最内层队列中 GSLS 的类型保持一致。包含队列中所有矢量的元素或矩阵中的元素。
-- value -- An object containing the value to set up the uniform. It's type must be one of the Uniform Types described above. + value -- 包含需要设置 Uniform 数据的对象。 数据类型必须是上述类型中的一种。
-- Current value of the uniform. + 当前 uniform 的值。
-
- Returns a clone of this uniform.
- If the uniform's value property is an [page:Object] with a clone() method, this is used, otherwise the value is copied by assigment.
- Array values are shared between cloned [page:Uniform]s.
- See [example:webgldeferred_animation WebGL deferred animation] for an example of this method in use.
+ 返回该 Uniform 的克隆。
+ 如果 Uniform 的 value 属性是一个带 clone() 方法的 [page:Object],则克隆该对象时,value 的 clone() 方法也会被调用,否则克隆时只会使用赋值语句。
+ 队列中的值会在该 Uniform 和 被克隆对象间共享。
+
+ 该方法的使用示例详见 [example:webgldeferred_animation WebGL deferred animation]。
diff --git a/docs/api/zh/core/EventDispatcher.html b/docs/api/zh/core/EventDispatcher.html index f276946c431a02..60ae8bb0f291dc 100644 --- a/docs/api/zh/core/EventDispatcher.html +++ b/docs/api/zh/core/EventDispatcher.html @@ -11,14 +11,14 @@
- JavaScript events for custom objects.
+ 自定义对象的 JavaScript 事件。
[link:https://github.com/mrdoob/eventdispatcher.js Eventdispatcher on GitHub]
-
+
-// Adding events to a custom object
+// 为自定义对象添加事件
var Car = function () {
@@ -30,11 +30,11 @@ Example
};
-// Mixing the EventDispatcher.prototype with the custom object prototype
+// 将 EventDispatcher.prototype 与自定义对象 prototype 进行混合
Object.assign( Car.prototype, EventDispatcher.prototype );
-// Using events with the custom object
+// 使用自定义对象的事件
var car = new Car();
@@ -47,53 +47,53 @@ Example
car.start();
-
+
- Creates EventDispatcher object. + 创建 EventDispatcher 对象。
-
+
- type - The type of event to listen to.
- listener - The function that gets called when the event is fired.
+ type - 需要添加监听的事件类型。
+ listener - 事件发生时被调用到的函数。
- Adds a listener to an event type. + 为指定事件增加监听函数。
- type - The type of event to listen to.
- listener - The function that gets called when the event is fired.
+ type - 需要被监听的事件类型。
+ listener - 事件发生时被调用到的函数。
- Checks if listener is added to an event type. + 检查监听函数是否已经添加到指定事件。
- type - The type of the listener that gets removed.
- listener - The listener function that gets removed.
+ type - 需要移除监听的事件类型。
+ listener - 需要被移除的监听函数。
- Removes a listener from an event type. + 从指定事件类型中移除监听函数。
- event - The event that gets fired. + event - 将被触发的事件。
- Fire an event type. + 触发一个事件。
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/Face3.html b/docs/api/zh/core/Face3.html index 887dc6a6aaf038..9751640b84fec6 100644 --- a/docs/api/zh/core/Face3.html +++ b/docs/api/zh/core/Face3.html @@ -11,13 +11,12 @@
- Triangular face used in [page:Geometry]. These are created automatically for all - standard geometry types, however if you are building a custom geometry you will have to - create them manually. + 在 [page:Geometry] 中被使用到的三角面片。这些三角面片会为所有标准几何体自动创建。 + 然而,如果你正在构建一个自定义几何体,你需要手动创建这些三角面片。
-
+
[example:misc_ubiquity_test ubiquity / test ]
[example:svg_sandbox svg / sandbox ]
@@ -28,22 +27,22 @@
var material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } );
-//create a triangular geometry
+//创建仅有一个三角面片的几何体
var geometry = new THREE.Geometry();
geometry.vertices.push( new THREE.Vector3( -50, -50, 0 ) );
geometry.vertices.push( new THREE.Vector3( 50, -50, 0 ) );
geometry.vertices.push( new THREE.Vector3( 50, 50, 0 ) );
-//create a new face using vertices 0, 1, 2
+//利用顶点 0, 1, 2 创建一个面
var normal = new THREE.Vector3( 0, 1, 0 ); //optional
var color = new THREE.Color( 0xffaa00 ); //optional
var materialIndex = 0; //optional
var face = new THREE.Face3( 0, 1, 2, normal, color, materialIndex );
-//add the face to the geometry's faces array
+//将创建的面添加到几何体的面的队列
geometry.faces.push( face );
-//the face normals and vertex normals can be calculated automatically if not supplied above
+//如果没有特别指明,面和顶点的法向量可以通过如下代码自动计算
geometry.computeFaceNormals();
geometry.computeVertexNormals();
@@ -51,83 +50,80 @@ Examples
-
+
- a — Vertex A index.
- b — Vertex B index.
- c — Vertex C index.
+ a — 顶点 A 的索引。
+ b — 顶点 B 的索引。
+ c — 顶点 C 的索引。
- normal — (optional) Face normal ([page:Vector3 Vector3]) or array of vertex normals.
- If a single vector is passed in, this sets [page:.normal], otherwise if an array of three
- vectors is passed in this sets [page:.vertexNormals]
+ normal — (可选) 面的法向量 ([page:Vector3 Vector3]) 或顶点法向量队列。
+ 如果参数传入单一矢量,则用该量设置面的法向量 [page:.normal],如果传入的是包含三个矢量的队列,
+ 则用该量设置 [page:.vertexNormals]
- color — (optional) Face [page:Color color] or array of vertex [page:Color colors].
- If a single vector is passed in, this sets [page:.color], otherwise if an array of three
- vectors is passed in this sets [page:.vertexColors]
+ color — (可选) 面的颜色值 [page:Color color] 或顶点颜色值的队列。
+ 如果参数传入单一矢量,则用该量设置 [page:.color],如果传入的是包含三个矢量的队列,
+ 则用该量设置 [page:.vertexColors]
- materialIndex — (optional) which index of an array of materials to associate
- with the face.
+ materialIndex — (可选) 材质队列中与该面对应的材质的索引。
-
+
- Vertex A index. + 顶点 A 的索引。
- Vertex B index. + 顶点 B 的索引。
- Vertex C index. + 顶点 C 的索引。
- Face normal - vector showing the direction of the Face3. If calculated automatically - (using [page:Geometry.computeFaceNormals]), this is the normalized cross product of two edges of the - triangle. Default is *(0, 0, 0)*. + 面的法向量 - 矢量展示 Face3 的方向。如果该量是通过调用 [page:Geometry.computeFaceNormals] 自动计算的, + 该值等于归一化的两条边的差积。默认值是 *(0, 0, 0)*。
- Face color - for this to be used a material's [page:Material.vertexColors vertexColors] property - must be set to [page:Materials THREE.FaceColors]. + 面的颜色值 - 在被用于指定材质的 [page:Material.vertexColors vertexColors] 属性时,该值必须被设置为 + [page:Materials THREE.FaceColors]。
- Array of 3 [page:Vector3 vertex normals]. + 包含三个 [page:Vector3 vertex normals] 的队列。
- Array of 3 vertex colors - for these to be used a material's [page:Material.vertexColors vertexColors] property - must be set to [page:Materials THREE.VertexColors]. + 包含 3 个顶点颜色值的队列 - 在被用于指定材质的 [page:Material.vertexColors vertexColors] 属性时,该值必须被设置为 + [page:Materials THREE.VertexColors]。
-
- Material index (points to an index in the associated array of materials). Default is *0*. + 材质队列中与该面相关的材质的索引。默认值为 *0*。
-
+
-
Creates a new clone of the Face3 object.
+
克隆该 Face3 对象。
-
Copy the paramaters of another Face3 into this.
+
将参数指定的 Face3 对象的数据拷贝到当前对象。
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/Geometry.html b/docs/api/zh/core/Geometry.html index 697a24c0455b89..8f49f17f0caac3 100644 --- a/docs/api/zh/core/Geometry.html +++ b/docs/api/zh/core/Geometry.html @@ -12,17 +12,16 @@
- Geometry is a user-friendly alternative to [page:BufferGeometry]. Geometries store attributes - (vertex positions, faces, colors, etc.) using objects like [page:Vector3] or [page:Color] that - are easier to read and edit, but less efficient than typed arrays. + Geometry 是对 [page:BufferGeometry] 的用户有好替代。Geometry 利用 [page:Vector3] + 或 [page:Color] 存储了几何体的相关 attributes(如顶点位置,面信息,颜色等)比起 BufferGeometry + 更容易读写,但是运行效率不如有类型的队列。
- Prefer [page:BufferGeometry] for large or serious projects. + 对于大型工程或正式工程,推荐采用 [page:BufferGeometry]。
- -
+
@@ -48,125 +47,118 @@
geometry.computeBoundingSphere(); -
+
- The constructor takes no arguments. + 构造函数没有任何参数。
-
+
- Bounding box for the Geometry, which can be calculated with - [page:.computeBoundingBox](). Default is *null*. + Geometry 的外边界矩形,可以通过 [page:.computeBoundingBox]() 进行计算,默认值是 *null*。
- Bounding sphere for the Geometry, which can be calculated with - [page:.computeBoundingSphere](). Default is *null*. + Geometry 的外边界球形,可以通过 [page:.computeBoundingSphere]() 进行计算,默认值是 *null*。
- Array of vertex [page:Color colors], matching number and order of vertices.
+ 顶点 [page:Color colors] 队列,与顶点数量和顺序保持一致。
- This is used by [page:Points] and [page:Line] and any classes derived from those such as [page:LineSegments] and various helpers.
- [page:Mesh Meshes] use [page:Face3.vertexColors] instead of this.
+ 该属性用于 [page:Points] 、 [page:Line] 或派生自 [page:LineSegments] 的类。
+ 对于 [page:Mesh Meshes],请使用 [page:Face3.vertexColors] 函数。
- To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.
+ 如果要标记队列中的数据已经更新,[page:Geometry Geometry.colorsNeedUpdate] 值需要被设置为 true。
- Array of [page:Face3 faces].
- The array of faces describe how each vertex in the model is connected to form faces.
- Additionally it holds information about face and vertex normals and colors.
- To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.
+ [page:Face3 faces] 队列。
+
+ 描述每个顶点之间如何组成模型面的面队列。同时该队列保存面和顶点的法向量和颜色信息。
+ 如果要标记队列中的数据已经更新,[page:Geometry Geometry.elementsNeedUpdate] 值需要被设置为 true。
- Array of face [link:https://en.wikipedia.org/wiki/UV_mapping UV] layers, used for mapping textures onto the geometry.
- Each UV layer is an array of [page:UV]s matching the order and number of vertices in faces.
- To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
+ 面的 [link:https://en.wikipedia.org/wiki/UV_mapping UV] 层的队列,该队列用于将纹理和几何信息进行映射。
+ 每个 UV 层都是一个 [page:UV] 的队列,顺序和数量同面中的顶点相对用。
+ 如果要标记队列中的数据已经更新,[page:Geometry Geometry.uvsNeedUpdate] 值需要被设置为 true。
-
Unique number for this geometry instance.
+
当前 geometry 实例的唯一标识符的数。
- Used to check whether this or derived classes are Geometries. Default is *true*.
+ 用于判断当前类或派生类属于 Geometries。默认值是 *true*。
- You should not change this, as it used internally for optimisation.
+ 你不应该改变该值,该值用于内部优化。
- An array containing distances between vertices for Line geometries. - This is required for [page:LineDashedMaterial] to render correctly. + 用于保存线型几何体中每个顶点间距离的。在正确渲染 [page:LineDashedMaterial] 时,需要用到该数据。
- Array of [link:https://en.wikipedia.org/wiki/Morph_target_animation morph targets]. Each morph target is a Javascript object:
+ [link:https://en.wikipedia.org/wiki/Morph_target_animation morph targets] 的队列。每个
+ morph target 都是一个如下的 javascript 对象:
{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }
- Morph vertices match number and order of primary vertices.
+ Morph 顶点和几何体原始顶点在数量和顺序上需要一一对应。
- Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
+ 一个 morph 法向量的数组。Morph 法向量和 morph target 有类似的结构,每个法向量都是一个如下的 Javascript 对象:
morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }
- See the [example:webgl_morphnormals WebGL / morphNormals] example.
+ 示例详见 [example:webgl_morphnormals WebGL / morphNormals]。
-
Optional name for this geometry. Default is an empty string.
+
当前几何的可选别名。默认值是一个空字符串。
- When working with a [page:SkinnedMesh], each vertex can have up to 4 [page:Bone bones] affecting it. - The skinWeights property is an array of weight values that correspond to the order of the vertices in - the geometry. So for instance, the first skinWeight would correspond to the first vertex in the geometry. - Since each vertex can be modified by 4 bones, a [page:Vector4] is used to represent the skin weights - for that vertex. + 当在处理一个 [page:SkinnedMesh] 时,每个顶点最多可以有 4 个相关的 [page:Bone bones] 来影响它。 + skinWeights 属性是一个权重队列,顺序同几何体中的顶点保持一致。因而,队列中的第一个 skinWeight + 就对应几何体中的第一个顶点。由于每个顶点可以被 4 个 [page:Bone bones] 营销,因而每个顶点的 skinWeights + 就采用一个 [page:Vector4] 表示。
- The values of the vector should typically be between 0 and 1. For instance when set to 0 the bone - transformation will have no affect. When set to 0.5 it will have 50% affect. When set to 100%, it will - have 100% affect. If there is only 1 bone associated with the vertex then you only need to worry about - the first component of the vector, the rest can be ignored and set to 0. + skinWeight 矢量中每个元素的取值范围应该在 0 到 1 之间。例如,当设置为 0,骨骼对该顶点的位置没有影响。当设置为 0.5, + 则对顶点的影响为 50%。 当设置为 100% 则对顶点的影响是 100%。如果矢量中只有一个骨骼与顶点相关联,则你只需要关注矢量中的第一个元素, + 剩余的元素可以忽略,他们的值可以都设置为 0。
- Just like the skinWeights property, the skinIndices' values correspond to the geometry's vertices. - Each vertex can have up to 4 bones associated with it. So if you look at the first vertex, and the - first skinIndex, this will tell you the bones associated with that vertex. For example the first vertex - could have a value of ( 10.05, 30.10, 12.12 ). Then the first skin index could have the - value of ( 10, 2, 0, 0 ). The first skin weight could have the value of - ( 0.8, 0.2, 0, 0 ). In affect this would take the first vertex, and then the bone - mesh.bones[10] and apply it 80% of the way. Then it would take the bone skeleton.bones[2] - and apply it 20% of the way. The next two values have a weight of 0, so they would have no affect. + 就如同 skinWeights 属性一样。skinWeights 的值也是与几何体的顶点相对应。每个顶点可以最多有 4 个骨骼与之相关联。 + 因而第一个 skinIndex 就与几何体的第一个顶点相关联,skinIndex 的值就指明了影响该顶点的骨骼是哪个。例如,第一个顶点的值是 + ( 10.05, 30.10, 12.12 ),第一个 skinIndex 的值是( 10, 2, 0, 0 ),第一个 skinWeight + 的值是 ( 0.8, 0.2, 0, 0 )。上述值表明第一个顶点受到mesh.bones[10]骨骼的影响有 80%, + 受到 skeleton.bones[2] 的影响是 20%,由于另外两个 skinWeight 的值是 0,因而他们对顶点没有任何影响。
- In code another example could look like this:
+ 下面以代码的形式展示示例:
- [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
- This gets automatically assigned and shouldn't be edited.
+ 当前对象实例的 [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID]。
+ 该值会被自动分配,请不要修改它。
- Array of [page:Vector3 vertices]. Set to *true* if the vertices array has been updated. 如果顶点队列中的数据被修改,该值需要被设置为 *true*。 Set to *true* if the faces array has been updated. 如果面队列中的数据被修改,该值需要被设置为 *true*。 Set to *true* if the uvs array has been updated. 如果 UV 队列中的数据被修改,该值需要被设置为 *true*。 Set to *true* if the normals array has been updated. 如果法向量队列中的数据被修改,该值需要被设置为 *true*。 Set to *true* if the colors array or a face3 color has been updated. 如果颜色队列或 face3 的颜色数据被修改,该值需要被设置为 *true*。 Set to *true* if a face3 materialIndex has been updated. 如果 face3 的 materialIndex 被修改,该值需要被设置为 *true*。 Set to *true* if the linedistances array has been updated. 如果 linedistances 队列中的数据被修改,该值需要被设置为 *true*。 Bakes matrix transform directly into vertex coordinates. 将矩阵信息直接应用于几何体顶点坐标。 Center the geometry based on the bounding box. 基于外边界矩形将几何体居中。
- Creates a new clone of the Geometry. 克隆当前几何体。 Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute. 计算当前几何体的外边界矩形。该方法会更新 [page:Geometry Geometry.boundingBox] 属性值。 Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute. 计算当前几何体的外边界球。该方法会更新 [page:Geometry Geometry.boundingSphere] 属性值。
- Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed,
- otherwise they are *null*.
+ 计算外边界矩形或外边界球并不是默认会自动调用的方法,这两个函数需要被显示的调用才能天得到相应属性值,否则对应属性值保持默认值 *null*。
Computes [page:Face3.normal face normals]. 计算 [page:Face3.normal face normals] 值。 Computes flat [page:Face3.vertexNormals vertex normals]. Sets the vertex normal of each vertex of each face to be the same as the face's normal. 计算 flat [page:Face3.vertexNormals vertex normals] 值。
+ 该方法会将顶点法向量的值赋值为相应面的法向量值。 Computes [page:.morphNormals]. 计算 [page:.morphNormals] 值。
- areaWeighted - If true the contribution of each face normal to the vertex normal is
- weighted by the area of the face. Default is true.
- Copies vertices, faces and uvs into this geometry. It does not copy any other properties of the geometry.
+ 将参数代表的几何体的顶点、面和 UV 复制到当前几何体。该方法不会复制除此以外的别的属性值。
- Removes The object from memory. Convert a [page:BufferGeometry] to a Geometry. 将一个 [page:BufferGeometry] 对象,转换成一个 Geometry 对象。
- vector - A world vector to look at. Merge two geometries or geometry and geometry from object (using object's transform) 将两个几何体,或一个几何体和一个从对象中通过变换获得的几何体进行合并。 Merge the mesh's geometry with this, also applying the mesh's transform. 将参数指定的面片信息与当前几何体进行合并。同样会使用到参数 mesh 的变换。
- Checks for duplicate vertices using hashmap.
- Normalize the geometry.
- Rotate the geometry about the X axis. This is typically done as a one time operation but not during the render loop.
- Rotate the geometry about the Y axis. This is typically done as a one time operation but not during the render loop.
- Rotate the geometry about the Z axis. This is typically done as a one time operation but not during the render loop. Sets the vertices for this Geometry from an array of points. 通过点队列设置一个 Geometry 中的顶点。
- Sorts the faces array according to material index. For complex geometries with several materials,
- this can result in reduced draw calls and improved performance.
+ 通过材质索引对面队列进行排序。对于复杂且有多个材质的几何体,该操作可以有效减少 draw call 从而提升性能。
- Scale the geometry data. This is typically done as a one time operation but not during the render loop. Convert the geometry to JSON format. 将 Geometry 对象数据转为 JSON 格式。
- Translate the geometry. This is typically done as a one time operation but not during the render loop.
- An instanced version of [page:BufferAttribute].
+ [page:BufferAttribute] 的实例化版本。
- Default is *1*.
+ 默认值为 *1*。
- Default is *true*.
+ 默认值为 *true*.
See [page:BufferAttribute] for inherited methods. 继承方法详见 [page:BufferAttribute]。
- An instanced version of [page:BufferGeometry].
+ [page:BufferGeometry] 的实例化版本。
+ 默认构造函数没有参数。
- Default is *undefined*.
+ 默认值是 *undefined*。
- Default is *true*.
+ 默认值是 *true*。
See [page:BufferAttribute] for inherited methods. 继承方法详见 [page:BufferAttribute]。
@@ -43,7 +43,7 @@
- // e.g.
+ // 例如
geometry.skinIndices[15] = new THREE.Vector4( 0, 5, 9, 10 );
geometry.skinWeights[15] = new THREE.Vector4( 0.2, 0.5, 0.3, 0 );
- // corresponds with the following vertex
+ // 与该顶点相关
geometry.vertices[15];
- // these bones will be used like so:
+ // 相应骨骼可以这样被调用:
skeleton.bones[0]; // weight of 0.2
skeleton.bones[5]; // weight of 0.5
skeleton.bones[9]; // weight of 0.3
@@ -176,169 +168,166 @@
[property:Array skinIndices]
[property:String uuid]
[property:Array vertices]
- The array of vertices holds the position of every vertex in the model.
- To signal an update in this array, [page:.verticesNeedUpdate] needs to be set to true.
+ [page:Vector3 vertices] 的队列。
+ 顶点的队列,保存了模型中每个顶点的位置信息。
+ 如果要标记队列中的数据已经更新,[page:.verticesNeedUpdate] 值需要被设置为 true。
[property:Boolean verticesNeedUpdate]
- [property:Boolean elementsNeedUpdate]
- [property:Boolean uvsNeedUpdate]
- [property:Boolean normalsNeedUpdate]
- [property:Boolean colorsNeedUpdate]
- [property:Boolean groupsNeedUpdate]
- [property:Boolean lineDistancesNeedUpdate]
- Methods
+ 方法
- [page:EventDispatcher EventDispatcher] methods are available on this class.
+ [page:EventDispatcher EventDispatcher] 该类中可用的函数。
[method:null applyMatrix]( [param:Matrix4 matrix] )
- [method:Geometry center] ()
- [method:Geometry clone]()
-
-
- This method copies only vertices, faces and uvs. It does not copy any other properties of the geometry.
+
+ 该方法除几何体的顶点、面信息和 UV 外不会复制其他属性。
[method:null computeBoundingBox]()
- [method:null computeBoundingSphere]()
- [method:null computeFaceNormals]()
- [method:null computeFlatVertexNormals]()
- [method:null computeMorphNormals]()
- [method:null computeVertexNormals]( [param:Boolean areaWeighted] )
+ areaWeighted - 如果该值设置为 true,则每个面的法向量对顶点法向量的影响按照面的面积大小来计算。默认值为 true.
- Computes vertex normals by averaging face normals.
+ 通过周围面的法向量计算顶点的法向量。
[method:Geometry copy]( [param:Geometry geometry] )
[method:null dispose]()
- Don't forget to call this method when you remove a geometry because it can cause memory leaks.
+ 将对象从内存中删除。
+
+ 在你删除一个几何体时,不要忘记调用该方法,否则会造成内存泄漏。
[method:Geometry fromBufferGeometry]( [param:BufferGeometry geometry] )
- [method:Geometry lookAt] ( [param:Vector3 vector] )
+ vector - 当前几何体朝向的世界坐标。
- Rotates the geometry to face point in space. This is typically done as a one time operation but not during the render loop.
- Use [page:Object3D.lookAt] for typical real-time mesh usage.
+ 该方法将几何体进行旋转,是的几何体朝向参数指定的世界坐标。该方法一般在一次处理中完成,但不在渲染过程中执行。
+ 一般使用 [page:Object3D.lookAt] 方法进行实时更改。
[method:null merge]( [param:Geometry geometry], [param:Matrix4 matrix], [param:Integer materialIndexOffset] )
- [method:null mergeMesh]( [param:Mesh mesh] )
- [method:null mergeVertices]()
- Duplicated vertices are removed and faces' vertices are updated.
+ 通过 hashmap 检查重复的顶点。
+ 重复的顶点将会被移除,面的顶点信息会被更新。
[method:null normalize]()
- Make the geometry centered and have a bounding sphere of radius *1.0*.
+ 将当前几何体归一化。
+ 将当前几何体居中,并且使得该几何体的外边界球半径为 *1.0*。
[method:Geometry rotateX] ( [param:Float radians] )
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 将几何体绕 X 轴旋转参数指定度数。该操作通常在一次处理中完成,但不会在渲染过程中处理。
+ 使用 [page:Object3D.rotation] 对模型面片进行实时旋转处理。
[method:Geometry rotateY] ( [param:Float radians] )
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 将几何体绕 Y 轴旋转参数指定度数。该操作通常在一次处理中完成,但不会在渲染过程中处理。
+ 使用 [page:Object3D.rotation] 对模型面片进行实时旋转处理。
[method:Geometry rotateZ] ( [param:Float radians] )
- Use [page:Object3D.rotation] for typical real-time mesh rotation.
+ 将几何体绕 Z 轴旋转参数指定度数。该操作通常在一次处理中完成,但不会在渲染过程中处理。
+ 使用 [page:Object3D.rotation] 对模型面片进行实时旋转处理。
[method:Geometry setFromPoints] ( [param:Array points] )
- [method:null sortFacesByMaterialIndex] ( )
[method:Geometry scale] ( [param:Float x], [param:Float y], [param:Float z] )
- Use [page:Object3D.scale] for typical real-time mesh scaling.
+ 缩放几何体大小。该操作通常在一次处理中完成,但不会在渲染过程中处理。
+ 使用 [page:Object3D.scale] 对模型面片进行实时缩放处理。
[method:JSON toJSON] ( )
- [method:Geometry translate] ( [param:Float x], [param:Float y], [param:Float z] )
- Use [page:Object3D.position] for typical real-time mesh translation.
+ 移动当前几何体。该操作通常在一次处理中完成,但不会在渲染过程中处理。
+ 使用 [page:Object3D.position] 对模型面片进行实时移动处理。
Source
+ 资源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/core/InstancedBufferAttribute.html b/docs/api/zh/core/InstancedBufferAttribute.html
index 2dafbce0b43667..07b757b9fe5c75 100644
--- a/docs/api/zh/core/InstancedBufferAttribute.html
+++ b/docs/api/zh/core/InstancedBufferAttribute.html
@@ -13,31 +13,31 @@
[name]
Constructor
+ 构造函数
[name]( [param:TypedArray array], [param:Integer itemSize], [param:Number meshPerAttribute] )
Properties
- See [page:BufferAttribute] for inherited properties.
+ 属性
+ 继承属性详见 [page:BufferAttribute]。
[property:Number meshPerAttribute]
[property:Boolean isInstancedBufferAttribute]
Methods
- 方法
+ Source
+ 资源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/core/InstancedBufferGeometry.html b/docs/api/zh/core/InstancedBufferGeometry.html
index f0d901c344f5ab..584d11d74acb12 100644
--- a/docs/api/zh/core/InstancedBufferGeometry.html
+++ b/docs/api/zh/core/InstancedBufferGeometry.html
@@ -13,29 +13,29 @@
[name]
Constructor
+ 构造函数
[name]( )
- Properties
- See [page:BufferGeometry] for inherited properties.
+ 属性
+ 继承属性详见 [page:BufferGeometry]。
[property:Number maxInstancedCount]
[property:Boolean isInstancedBufferGeometry]
Methods
- 方法
+ [property:Number addGroup]( start, count, materialIndex )
[property:Number addGroup]( start, count, materialIndex )
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/InstancedInterleavedBuffer.html b/docs/api/zh/core/InstancedInterleavedBuffer.html index f375a9e6bab14a..813f096ae80af1 100644 --- a/docs/api/zh/core/InstancedInterleavedBuffer.html +++ b/docs/api/zh/core/InstancedInterleavedBuffer.html @@ -13,35 +13,35 @@
- An instanced version of [page:InterleavedBuffer]. + [page:InterleavedBuffer] 的实例化版本。
-
+
-
+
- See [page:InterleavedBuffer] for inherited properties. + 继承属性详见 [page:InterleavedBuffer]。
- Default is *1*. + 默认值是 *1*。
- Default is *true*. + 默认值是 *true*。
-
+
- See [page:InterleavedBuffer] for inherited methods. + 继承方法详见 [page:InterleavedBuffer]。
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/InterleavedBuffer.html b/docs/api/zh/core/InterleavedBuffer.html index dcdabed6da95ac..1ff76aceca1f03 100644 --- a/docs/api/zh/core/InterleavedBuffer.html +++ b/docs/api/zh/core/InterleavedBuffer.html @@ -11,108 +11,108 @@
- "Interleaved" means that multiple attributes, possibly of different types, (e.g., position, normal, uv, color) are packed into a single array buffer.
+ "交叉存储" 表明多个类型的 attributes (例如,顶点位置、法向量、UV 和颜色值)被存储到一个队列中。
- An introduction into interleaved arrays can be found here: [link:https://blog.tojicode.com/2011/05/interleaved-array-basics.html Interleaved array basics]
+ 如下链接有对交叉存储更详细的介绍: [link:https://blog.tojicode.com/2011/05/interleaved-array-basics.html Interleaved array basics]
-
+
[example:webgl_buffergeometry_points_interleaved webgl / buffergeometry / points / interleaved]
-
+
- [page:TypedArray array] -- A typed array with a shared buffer. Stores the geometry data.
- [page:Integer stride] -- The number of typed-array elements per vertex.
+ [page:TypedArray array] -- 一个基于共享缓存的类型化队列。该队列存储几何体相关数据。
+ [page:Integer stride] -- 每个顶点占用类型化队列的多少个元素。
-
+
- A typed array with a shared buffer. Stores the geometry data. + 一个基于共享缓存的类型化队列。该队列存储几何体相关数据。
- The number of typed-array elements per vertex. + 每个顶点占用类型化队列的多少个元素。
- Gives the total number of elements in the array. + 类型化队列中,所有元素的数目。
- Default is *false*. + 默认值为 *false*。
- Object containing offset and count. + 对象存储着需要更新的数据的偏移量和数量。
- Default is *0*. + 默认值为 *0*。
- Default is *-1*. + 默认值为 *-1*。
- A version number, incremented every time the needsUpdate property is set to true. + 版本号,每次 needsUpdate 属性设置为 true 时,版本号增加。
- Default is *true*. + 默认值为 *true*。
- Default is *false*. Setting this to true increments [page:InterleavedBuffer.version version]. + 默认值为 *false*。该值被设置为 true 时,会导致 [page:InterleavedBuffer.version version] 增加。
-
+
- array - must be a Typed Array. + array - 必须是一个类型化的队列。
- Set [page:InterleavedBuffer.dynamic dynamic] to value. + 根据输入参数设置 [page:InterleavedBuffer.dynamic dynamic] 的值。
- Copies another [name] to this [name]. + 将参数指定的 [name] 拷贝到当前 [name]。
-
Copies data from attribute[index2] to [page:InterleavedBuffer.array array][index1].
+
将数据从 attribute[index2] 拷贝到 [page:InterleavedBuffer.array array][index1]。
- value - The source (typed) array.
- offset - The offset into the target array at which to begin writing values from the source array. Default is *0*.
+ value - 被拷贝的源(类型化)队列。
+ offset - 源队列中,数据开始拷贝的偏移量。默认值是 *0*.
- Stores multiple values in the buffer, reading input values from a specified array.
+ 将源队列数据拷贝到目标队列缓存中。
- Creates a clone of this [name]. + 克隆当前 [name]。
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/InterleavedBufferAttribute.html b/docs/api/zh/core/InterleavedBufferAttribute.html index b390c9fbc928f6..1fe4bcce86478f 100644 --- a/docs/api/zh/core/InterleavedBufferAttribute.html +++ b/docs/api/zh/core/InterleavedBufferAttribute.html @@ -15,89 +15,86 @@
-
+
-
+
- The [page:InterleavedBuffer InterleavedBuffer] instance passed in the constructor. + 传入构造函数的 [page:InterleavedBuffer InterleavedBuffer] 实例。
- The value of [page:InterleavedBufferAttribute.data data].array. + [page:InterleavedBufferAttribute.data data].array 的值。
- The value of [page:InterleavedBufferAttribute.data data].count. + [page:InterleavedBufferAttribute.data data].count 的值。 - If the buffer is storing a 3-component item (such as a position, normal, or color), - then this will count the number of such items stored. + 所缓存的矢量的个数。如果缓存的矢量是一个三元组(例如,位置、法向量或颜色),则该值计算上述三元组的个数。
- How many values make up each item. + 队列中每个矢量有多少个元素构成。
- The offset in the underlying array buffer where an item starts. + 缓存队列中每个元素的起始位置的偏移量。
- Default is *true*. + 默认值为 *true*。
- Default is *true*. + 默认值为 *true*。
-
+
-
Returns the x component of the item at the given index.
+
返回给定索引矢量的第一个元素 (X 值)。
-
Returns the y component of the item at the given index.
+
返回给定索引矢量的第二个元素 (Y 值)。
-
Returns the z component of the item at the given index.
+
返回给定索引矢量的第三个元素 (Z 值)。
-
Returns the w component of the item at the given index.
+
返回给定索引矢量的第四个元素 (W 值)。
-
Sets the x component of the item at the given index.
+
通过给定参数,设置指定索引矢量的第一个元素 (X 值)。
-
Sets the y component of the item at the given index.
+
通过给定参数,设置指定索引矢量的第二个元素 (Y 值)。
-
Sets the z component of the item at the given index.
+
通过给定参数,设置指定索引矢量的第三个元素 (Z 值)。
-
Sets the w component of the item at the given index.
+
通过给定参数,设置指定索引矢量的第四个元素 (W 值)。
-
Sets the x and y components of the item at the given index.
+
通过给定参数,设置指定索引矢量的第一、二个元素 (X 和 Y 值)。
-
Sets the x, y and z components of the item at the given index.
+
通过给定参数,设置指定索引矢量的第一、二、三个元素 (X Y 和 Z 值)。
-
Sets the x, y, z and w components of the item at the given index.
+
通过给定参数,设置指定索引矢量的第一、二、三、四个元素 (X Y Z 和 W 值)。
- - -
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/Layers.html b/docs/api/zh/core/Layers.html index 39d1e7690a3004..bfb2f7d549a914 100644 --- a/docs/api/zh/core/Layers.html +++ b/docs/api/zh/core/Layers.html @@ -11,71 +11,71 @@
- A [page:Layers] object assigns an [page:Object3D] to 1 or more of 32 layers numbered 0 to 31
- - internally the layers are stored as a [link:https://en.wikipedia.org/wiki/Mask_(computing) bit mask], and by default all
- Object3Ds are a member of layer 0.
+ [page:Layers] 对象为 [page:Object3D] 分配 1个到 32 个图层。32个图层从 0 到 31 编号标记。
+ 在内部实现上,每个图层对象被存储为一个 [link:https://en.wikipedia.org/wiki/Mask_(computing) bit mask],
+ 默认的,所有 [page:Object3D] 对象都存储在第 0 个图层上。
- This can be used to control visibility - an object must share a layer with a [page:Camera camera] to be visible when that camera's
- view is renderered.
+ 图层对象可以用于控制对象的显示。当 [page:Camera camera] 的内容被渲染时与其共享图层相同的物体会被显示。每个对象都需要与一个
+ [page:Camera camera] 共享图层。
- All classes that inherit from [page:Object3D] have an [page:Object3D.layers] property which is an instance of this class.
+ 每个继承自 [page:Object3D] 的对象都有一个 [page:Object3D.layers] 对象。
-
+
- Create a new Layers object, with membership initially set to layer 0. + 创建一个新的图层对象,该对象默认与第 0 图层关联。
-
+
- A bit mask storing which of the 32 layers this layers object is currently a member of. + 用 bit mask 表示当前图层对象与 0 - 31 中的哪些图层相对应。所属层所对应的比特位为 1,其他位位 0。
-
+
- layer - an integer from 0 to 31.
+ layer - 一个 0 - 31 的整数。
- Remove membership of this *layer*.
+ 删除图层对象与参数指定图层的对应关系。
- layer - an integer from 0 to 31.
+ layer - 一个 0 - 31 的整数。
- Add membership of this *layer*.
+ 增加图层对象与参数指定图层的对应关系。
- layer - an integer from 0 to 31.
+ layer - 一个 0 - 31 的整数。
- Set membership to *layer*, and remove membership all other layers.
+ 删除图层对象已有的所有对应关系,增加与参数指定的图层的对应关系。
- layers - a Layers object
+ layers - 一个图层对象。
- Returns true if this and the passed *layers* object are members of the same set of layers.
+ 如果传入图层对象与当前对象属于相同的一组图层,则返回 true,否则返回 false。
- layer - an integer from 0 to 31.
+ layer - 一个 0 - 31 的整数。
- Toggle membership of *layer*.
+ 根据参数切换对象所属图层。
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/core/Object3D.html b/docs/api/zh/core/Object3D.html index dcaef651e047fb..d806bc2c0937e2 100644 --- a/docs/api/zh/core/Object3D.html +++ b/docs/api/zh/core/Object3D.html @@ -403,7 +403,6 @@
vector - 一个世界向量.
-
将世界空间中的向量转换为局部空间向量。
diff --git a/docs/api/zh/core/Raycaster.html b/docs/api/zh/core/Raycaster.html index 065e9ef5782e62..05814dc7cba353 100644 --- a/docs/api/zh/core/Raycaster.html +++ b/docs/api/zh/core/Raycaster.html @@ -22,8 +22,7 @@
function onMouseMove( event ) { - // calculate mouse position in normalized device coordinates - // (-1 to +1) for both components + // 将鼠标位置归一化为设备坐标。x 和 y 方向的取值范围是 (-1 to +1) mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1; @@ -32,10 +31,10 @@
function render() { - // update the picking ray with the camera and mouse position + // 通过摄像机和鼠标位置更新射线 raycaster.setFromCamera( mouse, camera ); - // calculate objects intersecting the picking ray + // 计算物体和射线的焦点 var intersects = raycaster.intersectObjects( scene.children ); for ( var i = 0; i < intersects.length; i++ ) { @@ -80,6 +79,7 @@
这将创建一个新的raycaster对象。
+
@@ -93,7 +93,9 @@
+ raycaster与[page:Line](线)物体相交时的精度因数。 +
diff --git a/docs/api/zh/core/Uniform.html b/docs/api/zh/core/Uniform.html index 00c0afbc8e448e..b117573acc21ff 100644 --- a/docs/api/zh/core/Uniform.html +++ b/docs/api/zh/core/Uniform.html @@ -10,11 +10,12 @@
diff --git a/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html b/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html index 9843484a968c86..499c87421cac2d 100644 --- a/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html +++ b/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html @@ -13,7 +13,7 @@
- There are nine types of [page:BufferAttribute] available in three.js. These correspond to the JavaScript + 在 three.js 中一共有 9 种 [page:BufferAttribute]。每种和 JavaScript 中的类型相对应。 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Syntax Typed Arrays].
@@ -29,7 +29,7 @@
THREE.Int8BufferAttribute -
+
All of the above are called in the same way.
@@ -41,15 +41,15 @@
An 3D arrow object for visualizing directions.
+
用于模拟方向的3维箭头对象.
-
+
@@ -37,61 +37,61 @@
-
+
- [page:Vector3 dir] -- direction from origin. Must be a unit vector.
- [page:Vector3 origin] -- Point at which the arrow starts.
- [page:Number length] -- length of the arrow. Default is *1*.
- [page:Number hex] -- hexadecimal value to define color. Default is 0xffff00.
- [page:Number headLength] -- The length of the head of the arrow. Default is 0.2 * length.
- [page:Number headWidth] -- The length of the width of the arrow. Default is 0.2 * headLength.
+ [page:Vector3 dir] -- 基于箭头原点的方向. 必须为单位向量.
+ [page:Vector3 origin] -- 箭头的原点.
+ [page:Number length] -- 箭头的长度. 默认为 *1*.
+ [page:Number hex] -- 定义的16进制颜色值. 默认为 0xffff00.
+ [page:Number headLength] -- 箭头头部(锥体)的长度. 默认为箭头长度的0.2倍(0.2 * length).
+ [page:Number headWidth] -- 箭头的宽度. 默认为箭头头部(锥体)长度的0.2倍(0.2 * headLength).
-
-
See the base [page:Object3D] class for common properties.
+
+
请到基类 [page:Object3D] 页面查看公共属性.
-
Contains the line part of the arrowHelper.
+
包含箭头辅助对象的线段部分.
-
Contains the cone part of the arrowHelper.
+
包含箭头辅助对象的锥体部分.
-
-
See the base [page:Object3D] class for common methods.
+
+
请到基类 [page:Object3D] 页面查看公共方法.
- hex -- The hexadecimal value of the color.
+ hex -- 16进制颜色值.
- Sets the color of the arrowHelper.
+ 设置箭头辅助对象的颜色.
- length -- The desired length.
- headLength -- The length of the head of the arrow.
- headWidth -- The length of the width of the arrow.
+ length -- 要设置的长度.
+ headLength -- 要设置的箭头头部(锥体)的长度.
+ headWidth -- 要设置的箭头的宽度.
- Sets the length of the arrowhelper.
+ 设置箭头辅助对象的长度.
- dir -- The desired direction. Must be a unit vector.
+ dir -- 要设置的方向. 必须为单位向量.
- Sets the direction of the arrowhelper.
+ 设置箭头辅助对象的方向.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/AxesHelper.html b/docs/api/zh/helpers/AxesHelper.html index 5cf6611205f0b2..8a17a6c65bbc82 100644 --- a/docs/api/zh/helpers/AxesHelper.html +++ b/docs/api/zh/helpers/AxesHelper.html @@ -1,5 +1,5 @@ - +
@@ -12,11 +12,11 @@
-
An axis object to visualize the 3 axes in a simple way.
- The X axis is red. The Y axis is green. The Z axis is blue.
+
用于简单模拟3个坐标轴的对象.
+ 红色代表 X 轴. 绿色代表 Y 轴. 蓝色代表 Z 轴.
-
+
@@ -30,21 +30,21 @@
scene.add( axesHelper ); -
+
- [page:Number size] -- (optional) size of the lines representing the axes. Default is *1*. + [page:Number size] -- (可选的) 表示代表轴的线段长度. 默认为 *1*.
-
-
See the base [page:LineSegments] class for common properties.
+
+
请到基类 [page:LineSegments] 页面查看公共属性.
-
-
See the base [page:LineSegments] class for common methods.
+
+
请到基类 [page:LineSegments] 页面查看公共方法.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/Box3Helper.html b/docs/api/zh/helpers/Box3Helper.html index ccb95f0cfe20d0..71c30247676a16 100644 --- a/docs/api/zh/helpers/Box3Helper.html +++ b/docs/api/zh/helpers/Box3Helper.html @@ -1,5 +1,5 @@ - +
@@ -13,11 +13,11 @@
- Helper object to visualize a [page:Box3]. + 模拟3维包围盒 [page:Box3] 的辅助对象.
-
+
var box = new THREE.Box3();
@@ -28,36 +28,36 @@ Example
-
+
- [page:Box3 box] -- the Box3 to show.
- [page:Color color] -- (optional) the box's color. Default is 0xffff00.
+ [page:Box3 box] -- 被模拟的3维包围盒.
+ [page:Color color] -- (可选的) 线框盒子的颜色. 默认为 0xffff00.
- Creates a new wireframe box that represents the passed Box3.
+ 创建一个新的线框盒子用以表示指定的3维包围盒.
-
-
See the base [page:LineSegments] class for common properties.
+
+
请到基类 [page:LineSegments] 页面查看公共属性.
-
The Box3 being visualized.
+
被模拟的3维包围盒.
-
-
See the base [page:LineSegments] class for common methods.
+
+
请到基类 [page:LineSegments] 页面查看公共方法.
- This overrides the method in the base [page:Object3D] class so that it - also updates the wireframe box to the extent of the [page:Box3Helper.box .box] - property. + 重写基类 [page:Object3D] 的该方法以便于 + 同时更新线框辅助对象与 [page:Box3Helper.box .box] + 属性保持一致.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/BoxHelper.html b/docs/api/zh/helpers/BoxHelper.html index e139654f4bac4c..1b6ec896e6a0cd 100644 --- a/docs/api/zh/helpers/BoxHelper.html +++ b/docs/api/zh/helpers/BoxHelper.html @@ -1,5 +1,5 @@ - +
@@ -13,14 +13,14 @@
- Helper object to show the world-axis-aligned bounding box around an object. + 用于展示对象世界轴心对齐的包围盒的辅助对象. - Note that the object must have a [page:Geometry] or [page:BufferGeometry] for this to work, - so it won't work with [page:Sprite Sprites]. + 注意:要想能正常运行,目标对象必须包含 [page:Geometry] 或 [page:BufferGeometry] , + 所以当目标对象是精灵 [page:Sprite Sprites] 时将不能正常运行.
-
+
@@ -35,39 +35,39 @@
-
+
- [page:Object3D object] -- (optional) the object3D to show the world-axis-aligned boundingbox.
- [page:Color color] -- (optional) hexadecimal value that defines the box's color. Default is 0xffff00.
+ [page:Object3D object] -- (可选的) 被展示世界轴心对齐的包围盒的对象.
+ [page:Color color] -- (可选的) 线框盒子的16进制颜色值. 默认为 0xffff00.
- Creates a new wireframe box that bounds the passed object. Internally this uses [page:Box3.setFromObject]
- to calculate the dimensions. Note that this includes any children.
+ 创建一个新的线框盒子包围指定的对象. 内部使用 [page:Box3.setFromObject]
+ 方法来计算尺寸. 注意:此线框盒子将包围对象的所有子对象.
-
-
See the base [page:LineSegments] class for common properties.
+
+
请到基类 [page:LineSegments] 页面查看公共属性.
-
-
See the base [page:LineSegments] class for common methods.
+
+
请到基类 [page:LineSegments] 页面查看公共方法.
- Updates the helper's geometry to match the dimensions - of the object, including any children. See [page:Box3.setFromObject]. + 更新辅助对象的几何体,与目标对象尺寸 + 保持一致, 包围目标对象所有子对象. 请查看 [page:Box3.setFromObject].
- [page:Object3D object] - [page:Object3D] to create the helper of.
+ [page:Object3D object] - 用于创建辅助对象的目标 [page:Object3D] 对象.
- Updates the wireframe box for the passed object.
+ 更新指定对象的线框盒子.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/CameraHelper.html b/docs/api/zh/helpers/CameraHelper.html index c277c5e77a195c..dfec46964ae822 100644 --- a/docs/api/zh/helpers/CameraHelper.html +++ b/docs/api/zh/helpers/CameraHelper.html @@ -1,5 +1,5 @@ - +
@@ -13,11 +13,11 @@
- This helps with visualizing what a camera contains in its frustum.
- It visualizes the frustum of a camera using a [page:LineSegments].
+ 用于模拟相机视锥体的辅助对象.
+ 它使用 [page:LineSegments] 来模拟相机视锥体.
-
+
@@ -29,50 +29,50 @@
-
+
- [page:Camera camera] -- The camera to visualize.
+ [page:Camera camera] -- 被模拟的相机.
- This create a new [Name] for the specified camera.
+ 为指定相机创建一个新的相机辅助对象 [Name] .
-
-
See the base [page:LineSegments] class for common properties.
+
+
请到基类 [page:LineSegments] 页面查看公共属性.
-
The camera being visualized.
+
被模拟的相机.
-
This contains the points used to visualize the camera.
+
包含用于模拟相机的点.
-
Reference to the [page:Object3D.matrixWorld camera.matrixWorld].
+
请参考相机的世界矩阵 [page:Object3D.matrixWorld camera.matrixWorld].
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the - camera's [page:Object3D.matrixWorld matrixWorld]. + 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象 + 使用相机的 [page:Object3D.matrixWorld matrixWorld].
-
-
See the base [page:LineSegments] class for common methods.
+
+
请到基类 [page:LineSegments] 页面查看公共方法.
-
Updates the helper based on the projectionMatrix of the camera.
+
基于相机的投影矩阵更新辅助对象.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/DirectionalLightHelper.html b/docs/api/zh/helpers/DirectionalLightHelper.html index b46dd06dd92be1..cf996e46117820 100644 --- a/docs/api/zh/helpers/DirectionalLightHelper.html +++ b/docs/api/zh/helpers/DirectionalLightHelper.html @@ -1,5 +1,5 @@ - +
@@ -13,12 +13,12 @@
- Helper object to assist with visualizing a [page:DirectionalLight]'s effect on the scene. + 用于模拟场景中平行光 [page:DirectionalLight] 的辅助对象. - This consists of plane and a line representing the light's position and direction. + 其中包含了表示光位置的平面和表示光方向的线段.
-
+
var light = new THREE.DirectionalLight( 0xFFFFFF );
@@ -29,56 +29,56 @@ Example
-
+
- [page:DirectionalLight light]-- The light to be visualized.
+ [page:DirectionalLight light]-- 被模拟的光源.
- [page:Number size] -- (optional) dimensions of the plane. Default is *1*.
+ [page:Number size] -- (可选的) 平面的尺寸. 默认为 *1*.
- [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light.
+ [page:Hex color] -- (可选的) 如果没有设置颜色将使用光源的颜色.
-
-
See the base [page:Object3D] class for common properties.
+
+
请到基类 [page:Object3D] 页面查看公共属性.
-
Contains the line mesh showing the location of the directional light.
+
包含表示平行光方向的线网格.
-
Reference to the [page:DirectionalLight directionalLight] being visualized.
+
被模拟的光源. 请参考 [page:DirectionalLight directionalLight] .
-
Reference to the light's [page:Object3D.matrixWorld matrixWorld].
+
请参考光源的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the - light's [page:Object3D.matrixWorld matrixWorld]. + 请查看 [page:Object3D.matrixAutoUpdate] 页面. 这里设置为 *false* 表示辅助对象 + 使用光源的 [page:Object3D.matrixWorld matrixWorld].
- The color parameter passed in the constructor. Default is *undefined*. If this is changed, - the helper's color will update the next time [page:.update update] is called. + 构造函数中传入的颜色值. 默认为 *undefined*. 如果改变该值, + 辅助对象的颜色将在下一次 [page:.update update] 被调用时更新.
-
-
See the base [page:Object3D] class for common properties.
+
+
请到基类 [page:Object3D] 页面查看公共方法.
-
Dispose of the directionalLightHelper.
+
销毁该平行光辅助对象.
-
Updates the helper to match the position and direction of the [page:.light directionalLight] being visualized.
+
更新辅助对象,与模拟的 [page:.light directionalLight] 光源的位置和方向保持一致.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/FaceNormalsHelper.html b/docs/api/zh/helpers/FaceNormalsHelper.html index 3f52ac004ab0e4..3ca3416c40df97 100644 --- a/docs/api/zh/helpers/FaceNormalsHelper.html +++ b/docs/api/zh/helpers/FaceNormalsHelper.html @@ -1,5 +1,5 @@ - +
@@ -13,16 +13,16 @@
- Renders [page:ArrowHelper arrows] to visualize an object's [page:Face3 face] normals.
- Requires that face normals have been specified on all [page:Face3 faces] or calculated
- with [page:Geometry.computeFaceNormals computeFaceNormals].
+ 渲染箭头辅助对象 [page:ArrowHelper arrows] 来模拟面 [page:Face3 face] 的法线.
+ 需要所有面 [page:Face3 faces] 都指定了法线 或
+ 通过 [page:Geometry.computeFaceNormals computeFaceNormals] 方法计算面的法线.
- Note that this only works with the objects whose geometry is an instance of [page:Geometry].
- For [page:BufferGeometry] use a [page:VertexNormalsHelper] instead.
+ 注意:仅几何体为 [page:Geometry] 类型的对象能正常运行.
+ 对于 [page:BufferGeometry] 类型几何体的对象请使用 [page:VertexNormalsHelper] 代替.
-
+
@@ -37,44 +37,44 @@
scene.add( helper ); -
+
- [page:Object3D object] -- object for which to render face normals.
- [page:Number size] -- (optional) length of the arrows. Default is *1*.
- [page:Hex color] -- (optional) hex color of the arrows. Default is *0xffff00*.
- [page:Number linewidth] -- (optional) width of the arrow lines. Default is *1*.
+ [page:Object3D object] -- 要渲染面法线辅助的对象.
+ [page:Number size] -- (可选的) 箭头的长度. 默认为 *1*.
+ [page:Hex color] -- (可选的) 箭头的颜色. 默认为 *0xffff00*.
+ [page:Number linewidth] -- (可选的) 箭头线段的宽度. 默认为 *1*.
-
-
See the base [page:LineSegments] class for common properties.
+
+
请到基类 [page:LineSegments] 页面查看公共属性.
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the - objects's [page:Object3D.matrixWorld matrixWorld]. + 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象 + 使用对象的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
-
The object for which the face normals are being visualized.
+
被渲染面法线辅助的对象.
-
Length of the arrows. Default is *1*.
+
箭头的长度. 默认为 *1*.
-
-
See the base [page:LineSegments] class for common methods.
+
+
请到基类 [page:LineSegments] 页面查看公共方法.
-
Updates the face normal preview based on movement of the object.
+
基于对象的运动更新面法线辅助对象.
-
+
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] diff --git a/docs/api/zh/helpers/GridHelper.html b/docs/api/zh/helpers/GridHelper.html index a394e910b48c09..b246b2b5cc68ff 100644 --- a/docs/api/zh/helpers/GridHelper.html +++ b/docs/api/zh/helpers/GridHelper.html @@ -1,5 +1,5 @@ - +
@@ -12,10 +12,10 @@
-
The GridHelper is an object to define grids. Grids are two-dimensional arrays of lines.
+
坐标格辅助对象. 坐标格实际上是2维线数组.
-
+
var size = 10;
var divisions = 10;
@@ -26,20 +26,20 @@ Example
[example:webgl_helpers Example using various helpers]
- Constructor
+ 构造函数
[name]( [param:number size], [param:Number divisions], [param:Color colorCenterLine], [param:Color colorGrid] )
- size -- The size of the grid. Default is 10.
- divisions -- The number of divisions across the grid. Default is 10.
- colorCenterLine -- The color of the centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
- colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
+ size -- 坐标格尺寸. 默认为 10.
+ divisions -- 坐标格细分次数. 默认为 10.
+ colorCenterLine -- 中线颜色. 值可以为 [page:Color] 类型, 16进制 和 CSS 颜色名. 默认为 0x444444
+ colorGrid -- 坐标格网格线颜色. 值可以为 [page:Color] 类型, 16进制 和 CSS 颜色名. 默认为 0x888888
- Creates a new [name] of size 'size' and divided into 'divisions' segments per side. Colors are optional.
+ 创建一个尺寸为 'size' 和 每个维度细分 'divisions' 次的坐标格. 颜色可选.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/HemisphereLightHelper.html b/docs/api/zh/helpers/HemisphereLightHelper.html
index b0e2460935a7f7..659c83edd41853 100644
--- a/docs/api/zh/helpers/HemisphereLightHelper.html
+++ b/docs/api/zh/helpers/HemisphereLightHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,10 +13,11 @@
[name]
- Creates a visual aid consisting of a spherical [page:Mesh] for a [page:HemisphereLight HemisphereLight].
+ 创建一个虚拟的球形网格 [page:Mesh] 的辅助对象来模拟
+ 半球形光源 [page:HemisphereLight HemisphereLight].
- Example
+ 例子
var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
@@ -27,51 +28,51 @@ Example
- Constructor
+ 构造函数
[name]( [param:HemisphereLight light], [param:Number sphereSize], [param:Hex color] )
- [page:HemisphereLight light] -- The light being visualized.
+ [page:HemisphereLight light] -- 被模拟的光源.
- [page:Number size] -- The size of the mesh used to visualize the light.
+ [page:Number size] -- 用于模拟光源的网格尺寸.
- [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light.
+ [page:Hex color] -- (可选的) 如果没有赋值辅助对象将使用光源的颜色.
- Properties
- See the base [page:Object3D] class for common properties.
+ 属性
+ 请到基类 [page:Object3D] 页面查看公共属性.
[property:HemisphereLight light]
- Reference to the HemisphereLight being visualized.
+ 被模拟的半球形光源.
[property:object matrix]
- Reference to the hemisphereLight's [page:Object3D.matrixWorld matrixWorld].
+ 请参考半球形光源的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
[property:object matrixAutoUpdate]
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the
- hemisphereLight's [page:Object3D.matrixWorld matrixWorld].
+ 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象
+ 使用半球形光源的 [page:Object3D.matrixWorld matrixWorld].
[property:hex color]
- The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update
- the next time [page:.update update] is called.
+ 构造函数中传入的颜色值. 默认为 *undefined*. 如果改变该值,
+ 辅助对象的颜色将在下一次 [page:.update update] 被调用时更新.
- Methods
- See the base [page:Object3D] class for common methods.
+ 方法
+ 请到基类 [page:Object3D] 页面查看公共方法.
[method:null dispose]()
- Dispose of the hemisphereLightHelper.
+ 销毁该半球形光源辅助对象.
[method:null update]()
- Updates the helper to match the position and direction of the [page:.light].
+ 更新辅助对象,与 [page:.light] 属性的位置和方向保持一致.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/PlaneHelper.html b/docs/api/zh/helpers/PlaneHelper.html
index ef4325e84881f0..5a0833d1f05d13 100644
--- a/docs/api/zh/helpers/PlaneHelper.html
+++ b/docs/api/zh/helpers/PlaneHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,11 +13,11 @@
[name]
- Helper object to visualize a [page:Plane].
+ 用于模拟平面 [page:Plane] 的辅助对象.
- Example
+ 例子
var plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 );
@@ -26,39 +26,39 @@ Example
- Constructor
+ 构造函数
[name]( [param:Plane plane], [param:Float size], [param:Color hex] )
- [page:Plane plane] -- the plane to visualize.
- [page:Float size] -- (optional) side length of plane helper. Default is 1.
- [page:Color color] -- (optional) the color of the helper. Default is 0xffff00.
+ [page:Plane plane] -- 被模拟的平面.
+ [page:Float size] -- (可选的) 辅助对象的单边长度. 默认为 1.
+ [page:Color color] -- (可选的) 辅助对象的颜色. 默认为 0xffff00.
- Creates a new wireframe representation of the passed plane.
+ 创建一个线框辅助对象来表示指定平面.
- Properties
- See the base [page:LineSegments] class for common properties.
+ 属性
+ 请到基类 [page:LineSegments] 页面查看公共属性.
[property:Plane plane]
- The [page:Plane plane] being visualized.
+ 被模拟的平面 [page:Plane plane] .
[property:Float size]
- The side lengths of plane helper.
+ 辅助对象的单边长度.
- Methods
- See the base [page:LineSegments] class for common methods.
+ 方法
+ 请到基类 [page:LineSegments] 页面查看公共方法.
[method:void updateMatrixWorld]( [param:Boolean force] )
- This overrides the method in the base [page:Object3D] class so that it also
- updates the helper object according to the [page:PlaneHelper.plane .plane] and
- [page:PlaneHelper.size .size] properties.
+ 重写基类 [page:Object3D] 的该方法以便于
+ 同时更新线框辅助对象与 [page:PlaneHelper.plane .plane] 和
+ [page:PlaneHelper.size .size] 属性保持一致.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/PointLightHelper.html b/docs/api/zh/helpers/PointLightHelper.html
index 13c122f3506128..28b3f00c15b9f1 100644
--- a/docs/api/zh/helpers/PointLightHelper.html
+++ b/docs/api/zh/helpers/PointLightHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,12 +13,12 @@
[name]
- This displays a helper object consisting of a spherical [page:Mesh] for visualizing
- a [page:PointLight].
+ 创建一个虚拟的球形网格 [page:Mesh] 的辅助对象来模拟
+ 点光源 [page:PointLight].
- Example
+ 例子
[example:webgl_helpers WebGL / helpers]
@@ -35,49 +35,49 @@ Example
- Constructor
+ 构造函数
[name]( [param:PointLight light], [param:Float sphereSize], [param:Hex color] )
- [page:PointLight light] -- The light to be visualized.
+ [page:PointLight light] -- 要模拟的光源.
- [page:Float sphereSize] -- (optional) The size of the sphere helper. Default is *1*.
+ [page:Float sphereSize] -- (可选的) 球形辅助对象的尺寸. 默认为 *1*.
- [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light.
+ [page:Hex color] -- (可选的) 如果没有赋值辅助对象将使用光源的颜色.
- Properties
- See the base [page:Mesh] class for common properties.
+ 属性
+ 请到基类 [page:Mesh] 页面查看公共属性.
[property:PointLight light]
- The [page:PointLight] that is being visualized.
+ 被模拟的点光源 [page:PointLight] .
[property:object matrix]
- Reference to the pointLight's [page:Object3D.matrixWorld matrixWorld].
+ 请参考点光源的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
[property:object matrixAutoUpdate]
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the
- pointLight's [page:Object3D.matrixWorld matrixWorld].
+ 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象
+ 使用点光源的 [page:Object3D.matrixWorld matrixWorld].
[property:hex color]
- The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update
- the next time [page:.update update] is called.
+ 构造函数中传入的颜色值. 默认为 *undefined*. 如果改变该值,
+ 辅助对象的颜色将在下一次 [page:.update update] 被调用时更新.
- Methods
- See the base [page:Mesh] class for common methods.
+ 方法
+ 请到基类 [page:Mesh] 页面查看公共方法.
[method:null dispose]()
- Dispose of the pointLightHelper.
+ 销毁该点光源辅助对象.
[method:null update]()
- Updates the helper to match the position of the [page:.light].
+ 更新辅助对象,与 [page:.light] 属性的位置保持一致.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/PolarGridHelper.html b/docs/api/zh/helpers/PolarGridHelper.html
index cac1727117a7fa..b9e216180cbe8c 100644
--- a/docs/api/zh/helpers/PolarGridHelper.html
+++ b/docs/api/zh/helpers/PolarGridHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -12,10 +12,10 @@
[name]
- The PolarGridHelper is an object to define polar grids. Grids are two-dimensional arrays of lines.
+ 极坐标格辅助对象. 坐标格实际上是2维线数组.
- Example
+ 例子
var radius = 10;
var radials = 16;
@@ -28,22 +28,22 @@ Example
[example:webgl_helpers Example using various helpers]
- Constructor
+ 构造函数
[name]( [param:Number radius], [param:Number radials], [param:Number circles], [param:Number divisions], [param:Color color1], [param:Color color2] )
- radius -- The radius of the polar grid. This can be any positive number. Default is 10.
- radials -- The number of radial lines. This can be any positive integer. Default is 16.
- circles -- The number of circles. This can be any positive integer. Default is 8.
- divisions -- The number of line segments used for each circle. This can be any positive integer that is 3 or greater. Default is 64.
- color1 -- The first color used for grid elements. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
- color2 -- The second color used for grid elements. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
+ radius -- 极坐标格半径. 可以为任何正数. 默认为 10.
+ radials -- 径向辐射线数量. 可以为任何正整数. 默认为 16.
+ circles -- 圆圈的数量. 可以为任何正整数. 默认为 8.
+ divisions -- 圆圈细分段数. 可以为任何大于或等于3的正整数. 默认为 64.
+ color1 -- 极坐标格使用的第一个颜色. 值可以为 [page:Color] 类型, 16进制 和 CSS 颜色名. 默认为 0x444444
+ color2 -- 极坐标格使用的第二个颜色. 值可以为 [page:Color] 类型, 16进制 和 CSS 颜色名. 默认为 0x888888
- Creates a new [name] of radius 'radius' with 'radials' number of radials and 'circles' number of circles, where each circle is smoothed into 'divisions' number of line segments. Colors are optional.
+ 创建一个半径为'radius' 包含 'radials' 条径向辐射线 和 'circles' 个细分成 'divisions' 段的圆圈的极坐标格辅助对象. 颜色可选.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/RectAreaLightHelper.html b/docs/api/zh/helpers/RectAreaLightHelper.html
index 87aad7ab9542c5..523c391a8ab9c9 100644
--- a/docs/api/zh/helpers/RectAreaLightHelper.html
+++ b/docs/api/zh/helpers/RectAreaLightHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,10 +13,10 @@
[name]
- Creates a visual aid for a [page:RectAreaLight].
+ 创建一个表示 [page:RectAreaLight] 的辅助对象.
- Example
+ 例子
var light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 );
@@ -27,40 +27,40 @@ Example
- Constructor
+ 构造函数
[name]( [param:RectAreaLight light], [param:Hex color] )
- [page:RectAreaLight light] -- The light being visualized.
+ [page:RectAreaLight light] -- 被模拟的光源.
- [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light.
+ [page:Hex color] -- (可选) 如果没有赋值辅助对象将使用光源的颜色.
- Properties
- See the base [page:Object3D] class for common properties.
+ 属性
+ 请到基类 [page:Object3D] 页面查看公共属性.
[property:RectAreaLight light]
- Reference to the RectAreaLight being visualized.
+ 被模拟的区域光源.
[property:hex color]
- The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update
- the next time [page:.update update] is called.
+ 构造函数中传入的颜色值. 默认为 *undefined*. 如果改变该值,
+ 辅助对象的颜色将在下一次 [page:.update update] 被调用时更新.
- Methods
- See the base [page:Object3D] class for common methods.
+ 方法
+ 请到基类 [page:Object3D] 页面查看公共方法.
[method:null dispose]()
- Dispose of the rectAreaLightHelper.
+ 销毁该区域光源辅助对象.
[method:null update]()
- Updates the helper to match the position and direction of the [page:.light].
+ 更新辅助对象,与 [page:.light] 属性的位置和方向保持一致.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/SkeletonHelper.html b/docs/api/zh/helpers/SkeletonHelper.html
index bab2b55680622f..f34d9d0595c655 100644
--- a/docs/api/zh/helpers/SkeletonHelper.html
+++ b/docs/api/zh/helpers/SkeletonHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,12 +13,12 @@
[name]
- A helper object to assist with visualizing a [page:Skeleton Skeleton].
- The helper is renderered using a [page:LineBasicMaterial LineBasicMaterial].
+ 用来模拟骨骼 [page:Skeleton Skeleton] 的辅助对象.
+ 该辅助对象使用 [page:LineBasicMaterial LineBasicMaterial] 材质.
- Example
+ 例子
[example:webgl_animation_skinning_blending animation / skinning / blending]
[example:webgl_animation_skinning_morph animation / skinning / morph]
@@ -32,30 +32,30 @@ Example
- Constructor
+ 构造函数
[name]( object )
- object -- can be any object that has an array of [page:Bone Bone]s as a sub object.
- For example, a [page:Skeleton Skeleton] or a [page:SkinnedMesh SkinnedMesh].
+ object -- 可以是任何拥有一组骨 [page:Bone Bone] 作为子对象的对象.
+ 比如, 一个骨骼 [page:Skeleton Skeleton] 或 一个蒙皮网格 [page:SkinnedMesh SkinnedMesh].
- Properties
+ 属性
[property:Array bones]
- The list of bones that the helper renders as [page:Line Lines].
+ 辅助对象使用 [page:Line Lines] 渲染的骨数组.
[property:Object root]
- The object passed in the constructor.
+ 构造函数传入的对象.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/SpotLightHelper.html b/docs/api/zh/helpers/SpotLightHelper.html
index f385c80f3885ed..81e7428b5304a6 100644
--- a/docs/api/zh/helpers/SpotLightHelper.html
+++ b/docs/api/zh/helpers/SpotLightHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -12,16 +12,16 @@
[name]
- This displays a cone shaped helper object for a [page:SpotLight].
+ 用于模拟聚光灯 [page:SpotLight] 的锥形辅助对象.
- Example
+ 例子
View in Examples
- Other Examples
+ 其他例子
[example:webgl_lights_spotlights lights / spotlights ]
- Code Example
+ 代码示例
var spotLight = new THREE.SpotLight( 0xffffff );
spotLight.position.set( 10, 10, 10 );
@@ -32,51 +32,51 @@ Code Example
- Constructor
+ 构造函数
[name]( [param:SpotLight light], [param:Hex color] )
- [page:SpotLight light] -- The [page:SpotLight] to be visualized.
+ [page:SpotLight light] -- 被模拟的聚光灯 [page:SpotLight] .
- [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light.
+ [page:Hex color] -- (可选的) 如果没有赋值辅助对象将使用光源的颜色.
- Properties
- See the base [page:Object3D] class for common properties.
+ 属性
+ 请到基类 [page:Object3D] 页面查看公共属性.
[property:LineSegments cone]
- [page:LineSegments] used to visualize the light.
+ 用于模拟光源的 [page:LineSegments] 类型对象.
[property:SpotLight light]
- Reference to the [page:SpotLight] being visualized.
+ 被模拟的聚光灯 [page:SpotLight] .
[property:object matrix]
- Reference to the spotLight's [page:Object3D.matrixWorld matrixWorld].
+ 请参考聚光灯的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
[property:object matrixAutoUpdate]
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the
- spotLight's [page:Object3D.matrixWorld matrixWorld].
+ 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象
+ 使用聚光灯的 [page:Object3D.matrixWorld matrixWorld].
[property:hex color]
- The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update
- the next time [page:.update update] is called.
+ 构造函数中传入的颜色值. 默认为 *undefined*. 如果改变该值,
+ 辅助对象的颜色将在下一次 [page:.update update] 被调用时更新.
- Methods
- See the base [page:Object3D] class for common methods.
+ 方法
+ 请到基类 [page:Object3D] 页面查看公共属性.
[method:null dispose]()
- Disposes of the light helper.
+ 销毁该聚光灯辅助对象.
[method:null update]()
- Updates the light helper.
+ 更新聚光灯辅助对象.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/helpers/VertexNormalsHelper.html b/docs/api/zh/helpers/VertexNormalsHelper.html
index 583ef31f074a8d..754f1d2de6d87f 100644
--- a/docs/api/zh/helpers/VertexNormalsHelper.html
+++ b/docs/api/zh/helpers/VertexNormalsHelper.html
@@ -1,5 +1,5 @@
-
+
@@ -13,14 +13,14 @@
[name]
- Renders [page:ArrowHelper arrows] to visualize an object's vertex normal vectors.
- Requires that normals have been specified in a [page:BufferAttribute custom attribute] or
- have been calculated using [page:Geometry.computeVertexNormals computeVertexNormals].
+ 渲染箭头辅助对象 [page:ArrowHelper arrows] 来模拟顶点的法线.
+ 需要定义了法线缓存属性 [page:BufferAttribute custom attribute] 或
+ 使用了 [page:Geometry.computeVertexNormals computeVertexNormals] 方法计算了顶点法线.
- Unlike [page:FaceNormalsHelper], this works with [page:BufferGeometry].
+ 不像面法线辅助对象 [page:FaceNormalsHelper], 该辅助对象在 [page:BufferGeometry] 上也能正常运行.
- Example
+ 例子
[example:webgl_helpers WebGL / helpers]
@@ -36,43 +36,43 @@ Example
- Constructor
+ 构造函数
[name]( [param:Object3D object], [param:Number size], [param:Hex color], [param:Number linewidth] )
- [page:Object3D object] -- object for which to render vertex normals.
- [page:Number size] -- (optional) length of the arrows. Default is 1.
- [page:Hex color] -- hex color of the arrows. Default is 0xff0000.
- [page:Number linewidth] -- (optional) width of the arrow lines. Default is 1.
+ [page:Object3D object] -- 要渲染顶点法线辅助的对象.
+ [page:Number size] -- (可选的) 箭头的长度. 默认为 1.
+ [page:Hex color] -- 16进制颜色值. 默认为 0xff0000.
+ [page:Number linewidth] -- (可选的) 箭头线段的宽度. 默认为 1.
- Properties
- See the base [page:LineSegments] class for common properties.
+ 属性
+ 请到基类 [page:LineSegments] 页面查看公共属性.
[property:object matrixAutoUpdate]
- See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the
- objects's [page:Object3D.matrixWorld matrixWorld].
+ 请查看 [page:Object3D.matrixAutoUpdate]. 这里设置为 *false* 表示辅助对象
+ 使用对象的世界矩阵 [page:Object3D.matrixWorld matrixWorld].
[property:Object3D object]
- The object for which the vertex normals are being visualized.
+ 被渲染顶点法线辅助的对象.
[property:Number size]
- Length of the arrows. Default is *1*.
+ 箭头的长度. 默认为 *1*.
- Methods
- See the base [page:LineSegments] class for common methods.
+ 方法
+ 请到基类 [page:LineSegments] 页面查看公共方法.
[method:null update]()
- Updates the vertex normal preview based on movement of the object.
+ 基于对象的运动更新顶点法线辅助对象.
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/AmbientLight.html b/docs/api/zh/lights/AmbientLight.html
index c10f92983cf06d..aec1c47d9b94f2 100644
--- a/docs/api/zh/lights/AmbientLight.html
+++ b/docs/api/zh/lights/AmbientLight.html
@@ -1,5 +1,5 @@
-
+
@@ -13,13 +13,13 @@
[name]
- This light globally illuminates all objects in the scene equally.
+ 环境光会均匀的照亮场景中的所有物体。
- This light cannot be used to cast shadows as it does not have a direction.
+ 环境光不能用来投射阴影,因为它没有方向。
- Example
+ 示例
[example:canvas_camera_orthographic camera / orthographic ]
[example:canvas_interactive_voxelpainter interactive / voxelpainter ]
@@ -32,41 +32,41 @@
Example
var light = new THREE.AmbientLight( 0x404040 ); // soft white light
scene.add( light );
- Constructor
+ 构造函数
[name]( [param:Integer color], [param:Float intensity] )
- [page:Integer color] - (optional) Numeric value of the RGB component of the color. Default is 0xffffff.
- [page:Float intensity] - (optional) Numeric value of the light's strength/intensity. Default is 1.
+ [page:Integer color] - (参数可选)颜色的rgb数值。缺省值为 0xffffff。
+ [page:Float intensity] - (参数可选)光照的强度。缺省值为 1。
- Creates a new [name].
+ 创建一个环境光对象。
- Properties
+ 属性
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类 [page:Light Light]。
[property:Boolean castShadow]
- This is set to *undefined* in the constructor as ambient lights cannot cast shadows.
+ 这个参数在对象构造的时候就被设置成了 *undefined* 。因为环境光不能投射阴影。
[property:Boolean isAmbientLight]
- Used to check whether this or derived classes are ambient lights. Default is *true*.
+ 用来校验这个类或者派生类是不是环境光.默认是 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
- Methods
+ 方法
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类[page:Light Light]。
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/DirectionalLight.html b/docs/api/zh/lights/DirectionalLight.html
index 5c5a4cfa3c2f62..c7ab95e38c4d7e 100644
--- a/docs/api/zh/lights/DirectionalLight.html
+++ b/docs/api/zh/lights/DirectionalLight.html
@@ -1,5 +1,5 @@
-
+
@@ -10,35 +10,31 @@
[page:Object3D] → [page:Light] →
- [name]
+ 平行光([name])
- A light that gets emitted in a specific direction. This light will behave as though it is
- infinitely far away and the rays produced from it are all parallel. The common use case
- for this is to simulate daylight; the sun is far enough away that its position can be
- considered to be infinite, and all light rays coming from it are parallel.
+ 平行光是沿着特定方向发射的光。这种光的表现像是无限远,从它发出的光线都是平行的。常常用平行光来模拟太阳光
+ 的效果; 太阳足够远,因此我们可以认为太阳的位置是无限远,所以我们认为从太阳发出的光线也都是平行的。
- This light can cast shadows - see the [page:DirectionalLightShadow] page for details.
+ 平行光可以投射阴影 - 跳转至 [page:DirectionalLightShadow] 查看更多细节。
- A Note about Position, Target and rotation
+ 关于位置、目标和旋转说明
- A common point of confusion for directional lights is that setting the rotation has no effect.
- This is because three.js's DirectionalLight is the equivalent to what is often called a 'Target
- Direct Light' in other applications.
+ Three.js 的平行光常见的困惑是设置旋转没有效果。这是因为 three.js 的平行光类似与其他引擎的"目标平行光"。
+
- This means that its direction is calculated as pointing
- from the light's [page:Object3D.position position] to the [page:.target target]'s position
- (as opposed to a 'Free Direct Light' that just has a rotation component).
+ 这意味着它的方向是从一个平行光的位置 [page:Object3D.position position] 到 [page:.target target]的位置。
+ (而不是一个只有旋转分量的'自由平行光')。
- The reason for this is to allow the light to cast shadows - the [page:.shadow shadow]
- camera needs a position to calculate shadows from.
+ 这样做的原因是为了让光线投射阴影。 - the [page:.shadow shadow]
+ 摄像机需要一个位置来计算阴影。
- See the [page:.target target] property below for details on updating the target.
+ 有关更新目标的详细信息,请参阅 [page:.target target] 下面的目标属性。
- Example
+ 示例
[example:canvas_morphtargets_horse morphtargets / horse ]
[example:misc_controls_fly controls / fly ]
@@ -58,62 +54,58 @@
Example
- Constructor
+ 构造器
[name]( [param:Integer color], [param:Float intensity] )
- [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
- [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.
+ [page:Integer color] - (可选参数) 16进制表示光的颜色。 缺省值为 0xffffff (白色)。
+ [page:Float intensity] - (可选参数) 光照的强度。缺省值为1。
- Creates a new [name].
+ 创建一个新的 [name]。
- Properties
+ 属性
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类 [page:Light Light]。
[property:Boolean castShadow]
- If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and
- requires tweaking to get shadows looking right. See the [page:DirectionalLightShadow] for details.
- The default is *false*.
+ 如果设置为 *true* 该平行光会产生动态阴影。 警告: 这样做的代价比较高而且需要一直调整到阴影看起来正确.
+ 查看 [page:DirectionalLightShadow] 了解详细信息。该属性默认为 *false*。
[property:Boolean isDirectionalLight]
- Used to check whether this or derived classes are directional lights. Default is *true*.
+ 用来校验这个类或者派生类是不是平行光.默认是 *true*。
- You should not change this, as it is used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
[property:Vector3 position]
- This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+ 假如这个值设置等于 [page:Object3D.DefaultUp] (0, 1, 0),那么光线将会从上往下照射。
[property:DirectionalLightShadow shadow]
- A [page:DirectionalLightShadow] used to calculate shadows for this light.
+ 这个 [page:DirectionalLightShadow] 对象用来计算该平行光产生的阴影。
[property:Object3D target]
- The DirectionalLight points from its [page:.position position] to target.position. The default
- position of the target is *(0, 0, 0)*.
+ 平行光的方向是从它的位置到目标位置。默认的目标位置为原点 *(0,0,0)*。
- *Note*: For the target's position to be changed to anything other than the default,
- it must be added to the [page:Scene scene] using
+ 注意: 对于目标的位置,要将其更改为除缺省值之外的任何位置,它必须被添加到 [page:Scene scene]
+ 场景中去。
scene.add( light.target );
- This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
- updated each frame.
-
- It is also possible to set the target to be another object in the scene (anything with a
- [page:Object3D.position position] property), like so:
+ 这使得属性target中的 [page:Object3D.matrixWorld matrixWorld] 会每帧自动更新。
+
+ 它也可以设置target为场景中的其他对象(任意拥有 [page:Object3D.position position] 属性的对象), 示例如下:
var targetObject = new THREE.Object3D();
@@ -122,21 +114,20 @@ [property:Object3D target]
light.target = targetObject;
- The directionalLight will now track the target object.
+ 完成上述操作后,平行光现在就可以追踪到目标对像了。
- Methods
+ 方法
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类 [page:Light Light]。
[method:DirectionalLight copy]( [param:DirectionalLight source] )
- Copies value of all the properties from the [page:DirectionalLight source] to this
- DirectionalLight.
+ 复制 source 的值到这个平行光源对象。
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/HemisphereLight.html b/docs/api/zh/lights/HemisphereLight.html
index 2cd77b8037ba4f..60d0b26c67963b 100644
--- a/docs/api/zh/lights/HemisphereLight.html
+++ b/docs/api/zh/lights/HemisphereLight.html
@@ -10,16 +10,16 @@
[page:Object3D] → [page:Light] →
- [name]
+ 半球光([name])
- A light source positioned directly above the scene, with color fading from the
- sky color to the ground color.
+ 光源直接放置于场景之上,光照颜色从天空光线颜色颜色渐变到地面光线颜色。
+
- This light cannot be used to cast shadows.
+ 半球光不能投射阴影。
- Example
+ 示例
[example:webgl_lights_hemisphere lights / hemisphere ]
@@ -35,64 +35,64 @@ Example
scene.add( light );
- Constructor
+ 构造器(Constructor)
[name]( [param:Integer skyColor], [param:Integer groundColor], [param:Float intensity] )
- [page:Integer skyColor] - (optional) hexadecimal color of the sky. Default is 0xffffff.
- [page:Integer groundColor] - (optional) hexadecimal color of the ground. Default is 0xffffff.
- [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.
+ [page:Integer skyColor] - (可选参数) 天空中发出光线的颜色。 缺省值 0xffffff。
+ [page:Integer groundColor] - (可选参数) 地面发出光线的颜色。 缺省值 0xffffff。
+ [page:Float intensity] - (可选参数) 光照强度。 缺省值 1。
- Creates a new [name].
+ 创建一个半球光。
- Properties
+ 属性(Properties)
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类[page:Light Light]。
[property:Boolean castShadow]
- This is set to *undefined* in the constructor as hemisphere lights cannot cast shadows.
+ 该参数在构造时被设置为 *undefined* 因为半球光不能投射阴影。
[property:Float color]
- The light's sky color, as passed in the constructor.
- Default is a new [page:Color] set to white (0xffffff).
+ 在构造时传递的天空发出光线的颜色。
+ 默认会创建 [page:Color] 并设置为白色(0xffffff)。
[property:Float groundColor]
- The light's ground color, as passed in the constructor.
- Default is a new [page:Color] set to white (0xffffff).
+ 在构造时传递的地面发出光线的颜色。
+ 默认会创建 [page:Color] 并设置为白色(0xffffff)。
[property:Boolean isHemisphereLight]
- Used to check whether this or derived classes are hemisphere lights. Default is *true*.
+ 用来校验这个类或者派生类是不是半球光。缺省值为 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
[property:Vector3 position]
- This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+ 假如这个值设置等于 [page:Object3D.DefaultUp] (0, 1, 0),那么光线将会从上往下照射。
- Methods
+ 方法(Methods)
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类 [page:Light Light]。
[method:HemisphereLight copy]( [param:HemisphereLight source] )
- Copies the value of [page:.color color], [page:.intensity intensity] and
- [page:.groundColor groundColor] from the [page:Light source] light into this one.
+ 从[page:Light source]复制 [page:.color color], [page:.intensity intensity] 和
+ [page:.groundColor groundColor] 的值到当前半球光对象中。
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/Light.html b/docs/api/zh/lights/Light.html
index 70e673e4b2415d..ff8570b473ca4f 100644
--- a/docs/api/zh/lights/Light.html
+++ b/docs/api/zh/lights/Light.html
@@ -13,66 +13,66 @@
[name]
- Abstract base class for lights - all other light types inherit the properties and methods
- described here.
+ 光源的基类 - 所有其他的光类型都继承了该类描述的属性和方法。
- Constructor
+ 构造器(Constructor)
[name]( [param:Integer color], [param:float intensity] )
- [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
- [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.
+ [page:Integer color] - (可选参数) 16进制表示光的颜色。 缺省值 0xffffff (白色)。
+ [page:Float intensity] - (可选参数) 光照强度。 缺省值 1。
- Creates a new [name]. Note that this is not intended to be called directly (use one of derived classes instead).
+ 创造一个新的光源。注意,这并不是直接调用的(而是使用派生类之一)。
- Properties
+ 属性(Properties)
- See the base [page:Object3D Object3D] class for common properties.
+ 公共属性请查看基类[page:Object3D Object3D]。
[property:Color color]
- Color of the light. Defaults to a new [page:Color] set to white, if not passed in the constructor.
+ 光源的颜色。如果构造的时候没有传递,默认会创建一个新的 [page:Color] 并设置为白色。
[property:Float intensity]
- The light's intensity, or strength.
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the product of
- [page:.color color] * intensity is interpreted as luminous intensity measured in candela.
- Default - *1.0*.
+ 光照的强度,或者说能量。
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式下, [page:.color color] 和强度
+ 的乘积被解析为以坎德拉(candela)为单位的发光强度。
+ 默认值 - *1.0*
+
[property:Boolean isLight]
- Used to check whether this or derived classes are lights. Default is *true*.
+ 用来校验这个类或者派生类是不是平行光。默认是 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
Methods
- See the base [page:Object3D Object3D] class for common methods.
+ 公共方法请查看基类 [page:Object3D Object3D]。
[method:Light copy]( [param:Light source] )
- Copies the value of [page:.color color] and [page:.intensity intensity] from the
- [page:Light source] light into this one.
+ 从[page:Light source]复制 [page:.color color], [page:.intensity intensity]
+ 的值到当前光源对象中。
[method:JSON toJSON]( [param:String meta] )
- Return Light data in JSON format.
+ 以JSON格式返回光数据。
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/PointLight.html b/docs/api/zh/lights/PointLight.html
index db0ca22d0bb4e5..24ad2113e3603b 100644
--- a/docs/api/zh/lights/PointLight.html
+++ b/docs/api/zh/lights/PointLight.html
@@ -10,17 +10,16 @@
[page:Object3D] → [page:Light] →
- [name]
+ 点光源([name])
- A light that gets emitted from a single point in all directions. A common use case for this
- is to replicate the light emitted from a bare lightbulb.
-
- This light can cast shadows - see [page:LightShadow] page for details.
+ 从一个点向各个方向发射的光源。一个常见的例子是模拟一个灯泡发出的光。
+
+ 该光源可以投射阴影 - 跳转至 [page:LightShadow] 查看更多细节。
- Example
+ 示例
[example:canvas_lights_pointlights lights / pointlights ]
@@ -39,77 +38,76 @@
Example
- Constructor
+ 构造器(Constructor)
[name]( [param:Integer color], [param:Float intensity], [param:Number distance], [param:Float decay] )
- [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
- [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.
- [page:Number distance] - The distance from the light where the intensity is 0.
- When set to 0, then the light never stops. Default is 0.
- [page:Float decay] - The amount the light dims along the distance of the light. Default is 1.
- For [page:WebGLRenderer.physicallyCorrectLights physically correct] lighting, set this to 2.
-
- Creates a new [name].
+ [page:Integer color] - (可选参数)) 十六进制光照颜色。 缺省值 0xffffff (白色)。
+ [page:Float intensity] - (可选参数) 光照强度。 缺省值 1。
+ [page:Number distance] - 这个距离表示从光源到光照强度为0的位置。
+ 当设置为0时,光永远不会消失(距离无穷大)。缺省值 0.
+ [page:Float decay] - 沿着光照距离的衰退量。缺省值 1。
+
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式中,decay = 2。
+
+ 创建一个新的点光源(PointLight)。
- Properties
+ 属性(Properties)
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类[page:Light Light]。
[property:Float decay]
- The amount the light dims along the distance of the light
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to physically realistic light falloff.
- Default is *1*.
+ 沿着光照距离的衰减量
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式下,decay 设置为等于2将实现现实世界的光衰减。
+ 缺省值为 *1*。
[property:Float distance]
- If non-zero, light will attenuate linearly from maximum intensity at the light's
- position down to zero at this distance from the light. Default is *0.0*.
+ 如果非零,那么光强度将会从最大值当前灯光位置处按照距离线性衰减到0。
+ 缺省值为 *0.0*。
[property:Boolean isPointLight]
- Used to check whether this or derived classes are point lights. Default is *true*.
+ 用来校验这个类或者派生类是不是点光源。默认是 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
[property:Float power]
- The light's power.
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the luminous
- power of the light measured in lumens. Default is *4Math.PI*.
-
- This is directly related to the [page:.intensity intensity] in the ratio
-
+ 光功率
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式中,
+ 表示以"流明(光通量单位)"为单位的光功率。 缺省值 - *4Math.PI*。
+
+ 该值与 [page:.intensity intensity] 直接关联
+
power = intensity * 4π
- and changing this will also change the intensity.
+ 修改该值也会导致光强度的改变。
[property:LightShadow shadow]
- A [page:LightShadow] used to calculate shadows for this light.
-
- The lightShadow's [page:LightShadow.camera camera]
- is set to a [page:PerspectiveCamera] with [page:PerspectiveCamera.fov fov] of 90,
- [page:PerspectiveCamera.aspect aspect] of 1, [page:PerspectiveCamera.near near]
- clipping plane at 0.5 and [page:PerspectiveCamera.far far] clipping plane at 500.
+ [page:LightShadow]用与计算此光照的阴影。
+
+ 此对象的摄像机被设置为 [page:PerspectiveCamera.fov fov] 为90度,[page:PerspectiveCamera.aspect aspect]为1
+ ,近裁剪面 [page:PerspectiveCamera.near near] 为0,远裁剪面[page:PerspectiveCamera.far far]
+ 为500的透视摄像机 [page:PerspectiveCamera]。
- Methods
+ 方法(Methods)
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类 [page:Light Light]。
[method:PointLight copy]( [param:PointLight source] )
- Copies value of all the properties from the [page:PointLight source] to this
- PointLight.
+ 将所有属性的值从源 [page:PointLight source] 复制到此点光源对象。
Source
diff --git a/docs/api/zh/lights/RectAreaLight.html b/docs/api/zh/lights/RectAreaLight.html
index 4f188f540cc04c..bf0bb6f8d3c95f 100644
--- a/docs/api/zh/lights/RectAreaLight.html
+++ b/docs/api/zh/lights/RectAreaLight.html
@@ -10,23 +10,22 @@
[page:Object3D] → [page:Light] →
- [name]
+ 平面光光源([name])
- RectAreaLight emits light uniformly across the face a rectangular plane. This light type can be
- used to simulate light sources such as bright windows or strip lighting.
+ 平面光光源从一个矩形平面上均匀地发射光线。这种光源可以用来模拟像明亮的窗户或者条状灯光光源。
- Important Notes:
+ 注意事项:
- - There is no shadow support.
- - Only [page:MeshStandardMaterial MeshStandardMaterial] and [page:MeshPhysicalMaterial MeshPhysicalMaterial] are supported.
- - You have to include [link:https://threejs.org/examples/js/lights/RectAreaLightUniformsLib.js RectAreaLightUniformsLib] into your scene.
+ - 不支持阴影。
+ - 只支持 [page:MeshStandardMaterial MeshStandardMaterial] 和 [page:MeshPhysicalMaterial MeshPhysicalMaterial] 两种材质。
+ - 你必须在你的场景中加入 [link:https://threejs.org/examples/js/lights/RectAreaLightUniformsLib.js RectAreaLightUniformsLib] 。
- Examples
+ 示例
[example:webgl_lights_rectarealight WebGL / rectarealight ]
@@ -47,41 +46,40 @@
Examples
- Constructor
+ 构造器(Constructor)
[name]( [param:Integer color], [param:Float intensity], [param:Float width], [param:Float height] )
- [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
- [page:Float intensity] - (optional) the light's intensity, or brightness. Default is 1.
- [page:Float width] - (optional) width of the light. Default is 10.
- [page:Float height] - (optional) height of the light. Default is 10.
+ [page:Integer color] - (可选参数) 十六进制数字表示的光照颜色。缺省值为 0xffffff (白色)
+ [page:Float intensity] - (可选参数) 光源强度/亮度 。缺省值为 1。
+ [page:Float width] - (可选参数) 光源宽度。缺省值为 10。
+ [page:Float height] - (可选参数) 光源高度。缺省值为 10。
- Creates a new [name].
+ 创建一个新的平行光。
- Properties
+ 属性(Properties)
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类[page:Light Light]。
[property:Boolean isRectAreaLight]
- Used to check whether this or derived classes are RectAreaLights. Default is *true*.
+ 用来校验这个类或者它的派生类是不是平面光光源。缺省值是 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
- Methods
+ 方法(Methods)
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类 [page:Light Light]。
[method:RectAreaLight copy]( [param:RectAreaLight source] )
- Copies value of all the properties from the [page:RectAreaLight source] to this
- RectAreaLight.
+ 将所有属性的值从源 [page:RectAreaLight source] 复制到此平面光光源对象。
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/lights/SpotLight.html b/docs/api/zh/lights/SpotLight.html
index f21fed3d5dd2c9..d257e03cb77c90 100644
--- a/docs/api/zh/lights/SpotLight.html
+++ b/docs/api/zh/lights/SpotLight.html
@@ -10,26 +10,25 @@
[page:Object3D] → [page:Light] →
- [name]
+ 聚光灯([name])
- This light gets emitted from a single point in one direction, along a cone that increases in size
- the further from the light it gets.
+ 聚光灯是从一个方向上的一个点发出,沿着一个圆锥体,它离光越远,它的尺寸就越大。
- This light can cast shadows - see the [page:SpotLightShadow] page for details.
+ 该光源可以投射阴影 - 跳转至 [page:SpotLightShadow] 查看更多细节。
- Example
+ 示例
[example:webgl_lights_spotlight View in Examples ]
- Other Examples
+ 其他例子
[example:webgl_interactive_cubes_gpu interactive / cubes / gpu ]
@@ -45,7 +44,7 @@
Other Examples
[example:webgl_shadowmap_viewer shadowmap / viewer]
- Code Example
+ 代码示例
// white spotlight shining from the side, casting a shadow
@@ -64,126 +63,117 @@ Code Example
scene.add( spotLight );
- Constructor
+ 构造器(Constructor)
[name]( [param:Integer color], [param:Float intensity], [param:Float distance], [param:Radians angle], [param:Float penumbra], [param:Float decay] )
- [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
- [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.
- [page:Float distance] - Maximum distance from origin where light will shine whose intensity
- is attenuated linearly based on distance from origin.
- [page:Radians angle] - Maximum angle of light dispersion from its direction whose upper
- bound is Math.PI/2.
- [page:Float penumbra] - Percent of the spotlight cone that is attenuated due to penumbra.
- Takes values between zero and 1. Default is zero.
- [page:Float decay] - The amount the light dims along the distance of the light.
-
- Creates a new [name].
+ [page:Integer color] - (可选参数) 十六进制光照颜色。 缺省值 0xffffff (白色)。
+ [page:Float intensity] - (可选参数) 光照强度。 缺省值 1。
+ [page:Float distance] - 从光源发出光的最大距离,其强度根据光源的距离线性衰减。
+ [page:Radians angle] - 光线散射角度,最大为Math.PI/2。
+ [page:Float penumbra] - 聚光锥的半影衰减百分比。在0和1之间的值。默认为0。
+ [page:Float decay] - 沿着光照距离的衰减量。
+
+ 创建一个新的聚光灯。
- Properties
+ 属性(Properties)
- See the base [page:Light Light] class for common properties.
+ 公共属性请查看基类[page:Light Light]。
[property:Float angle]
- Maximum extent of the spotlight, in radians, from its direction. Should be no more than
- *Math.PI/2*. The default is *Math.PI/3*.
+ 从聚光灯的位置以弧度表示聚光灯的最大范围。应该不超过 *Math.PI/2*。默认值为 *Math.PI/3*。
[property:Boolean castShadow]
- If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and
- requires tweaking to get shadows looking right. See the [page:SpotLightShadow] for details.
- The default is *false*.
+ 此属性设置为 *true* 聚光灯将投射阴影。警告: 这样做的代价比较高而且需要一直调整到阴影看起来正确。
+ 查看 [page:SpotLightShadow] 了解详细信息。
+ 默认值为 *false*
[property:Float decay]
- The amount the light dims along the distance of the light.
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to
- physically realistic light falloff. The default is *1*.
+ 沿着光照距离的衰减量
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式下,decay 设置为等于2将实现现实世界的光衰减。
+ 缺省值为 *1*。
[property:Float distance]
- If non-zero, light will attenuate linearly from maximum intensity at the light's
- position down to zero at this distance from the light. Default is *0.0*.
+ 如果非零,那么光强度将会从最大值当前灯光位置处按照距离线性衰减到0。
+ 缺省值为 *0.0*。
[property:Boolean isSpotLight]
- Used to check whether this or derived classes are spot lights. Default is *true*.
+ 用来校验这个类或者它的派生类是不是聚光灯光源。缺省值是 *true*。
- You should not change this, as it used internally for optimisation.
+ 不应该去改变这个变量,因为内部使用这个变量做了些优化的工作。
[property:Float penumbra]
- Percent of the spotlight cone that is attenuated due to penumbra. Takes values between
- zero and 1. The default is *0.0*.
+ 聚光锥的半影衰减百分比。在0和1之间的值。
+ 默认值 — 0.0。
[property:Vector3 position]
- This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down.
+ 假如这个值设置等于 [page:Object3D.DefaultUp] (0, 1, 0),那么光线将会从上往下照射。
[property:Float power]
- The light's power.
- In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the luminous
- power of the light measured in lumens. Default is *4Math.PI*.
-
- This is directly related to the [page:.intensity intensity] in the ratio
-
- power = intensity * π
+ 光功率
+ 在 [page:WebGLRenderer.physicallyCorrectLights physically correct] 模式中,
+ 表示以"流明(光通量单位)"为单位的光功率。 缺省值 - *4Math.PI*。
+
+ 该值与 [page:.intensity intensity] 直接关联
+
+ power = intensity * 4π
- and changing this will also change the intensity.
+ 修改该值也会导致光强度的改变。
[property:SpotLightShadow shadow]
- A [page:SpotLightShadow] used to calculate shadows for this light.
+ [page:SpotLightShadow]用与计算此光照的阴影。
[property:Object3D target]
- The Spotlight points from its [page:.position position] to target.position. The default
- position of the target is *(0, 0, 0)*.
-
- *Note*: For the target's position to be changed to anything other than the default,
- it must be added to the [page:Scene scene] using
+ 平行光的方向是从它的位置到目标位置.默认的目标位置为原点 *(0,0,0)*。
+ 注意: 对于目标的位置,要将其更改为除缺省值之外的任何位置,它必须被添加到 [page:Scene scene]
+ 场景中去。
scene.add( light.target );
- This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically
- updated each frame.
+ 这使得属性target中的 [page:Object3D.matrixWorld matrixWorld] 会每帧自动更新。
- It is also possible to set the target to be another object in the scene (anything with a
- [page:Object3D.position position] property), like so:
+ 它也可以设置target为场景中的其他对象(任意拥有 [page:Object3D.position position] 属性的对象), 示例如下:
var targetObject = new THREE.Object3D();
scene.add(targetObject);
light.target = targetObject;
- The spotlight will now track the target object.
+ 完成上述操作后,聚光灯现在就可以追踪到目标对像了。
- Methods
+ 方法(Methods)
- See the base [page:Light Light] class for common methods.
+ 公共方法请查看基类 [page:Light Light]。
[method:SpotLight copy]( [param:SpotLight source] )
- Copies value of all the properties from the [page:SpotLight source] to this
- SpotLight.
+ 将所有属性的值从源 [page:SpotLight source] 复制到此聚光灯光源对象。
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/AnimationLoader.html b/docs/api/zh/loaders/AnimationLoader.html
index 7fea709445d99c..ba6b320707f868 100644
--- a/docs/api/zh/loaders/AnimationLoader.html
+++ b/docs/api/zh/loaders/AnimationLoader.html
@@ -11,77 +11,77 @@
[name]
- Class for loading [page:AnimationClip AnimationClips] in JSON format.
- This uses the [page:FileLoader] internally for loading files.
+ 以JSON格式来加载 [page:AnimationClip AnimationClips] 的一个类。
+ 内部使用 [page:FileLoader] 来加载文件。
- Example
+ 例子
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.AnimationLoader();
- // load a resource
+ // 加载资源
loader.load(
- // resource URL
+ // 资源URL
'animations/animation.js',
- // onLoad callback
+ // onLoad回调
function ( animations ) {
- // animations is an array of AnimationClips
+ // animations时一个AnimationClips组数
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。 默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Animation animation].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called if load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Animation animation].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the loaded animation to onLoad.
+ 从URL中进行加载并将动画传递给onLoad。
[method:null parse]( [param:JSON json], [param:Function onLoad] )
- [page:JSON json] — required
- [page:Function onLoad] — Will be called when parsing completes.
+ [page:JSON json] — 请求
+ [page:Function onLoad] — 当解析完成时,将被调用
- Parse the JSON object and pass the result to onLoad. Individual clips in the object will
- be parsed with [page:AnimationClip.parse].
+ 解析JSON对象并将结果传递给onLoad。对象中的单个片段将
+ 用[page [page:AnimationClip.parse]进行解析。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/AudioLoader.html b/docs/api/zh/loaders/AudioLoader.html
index be2dad7b3f8b86..c488b6bf6e20d9 100644
--- a/docs/api/zh/loaders/AudioLoader.html
+++ b/docs/api/zh/loaders/AudioLoader.html
@@ -11,88 +11,88 @@
[name]
- Class for loading an
- [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer].
- This uses the [page:FileLoader] internally for loading files.
+ 用来加载
+ [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer]的一个类。
+ 内部默认使用[page:FileLoader]来加载文件。
- Example
+ 例子
- // instantiate a listener
+ // 初始化一个监听
var audioListener = new THREE.AudioListener();
- // add the listener to the camera
+ // 把监听添加到camera
camera.add( audioListener );
- // instantiate audio object
+ // 初始化音频对象
var oceanAmbientSound = new THREE.Audio( audioListener );
- // add the audio object to the scene
+ // 添加一个音频对象到场景中
scene.add( oceanAmbientSound );
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.AudioLoader();
- // load a resource
+ // 加载资源
loader.load(
- // resource URL
+ // 资源URL
'audio/ambient_ocean.ogg',
- // onLoad callback
+ // onLoad回调
function ( audioBuffer ) {
- // set the audio object buffer to the loaded object
+ // 给一个加载器对象设置音频对象的缓存
oceanAmbientSound.setBuffer( audioBuffer );
- // play the audio
+ // 播放音频
oceanAmbientSound.play();
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
- Constructor
+ 构造函数
[name]( [param:String context], [param:LoadingManager manager] )
- [page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:String context] — 加载器使用的[page:String AudioContext]。 默认为[page:String window.AudioContext].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的响应文本。
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节.
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
+ 从URL中进行加载并将已经加载的[page:String AudioBuffer]传递给onLoad。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/BufferGeometryLoader.html b/docs/api/zh/loaders/BufferGeometryLoader.html
index 848b06bf4a7d11..be792642c543ef 100644
--- a/docs/api/zh/loaders/BufferGeometryLoader.html
+++ b/docs/api/zh/loaders/BufferGeometryLoader.html
@@ -11,81 +11,81 @@
[name]
- A loader for loading a [page:BufferGeometry].
- This uses the [page:FileLoader] internally for loading files.
+ 用来加载[page:BufferGeometry]的加载器。
+ 内部使用[page:FileLoader]来加载文件。
- Example
+ 例子
[example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable]
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.BufferGeometryLoader();
- // load a resource
+ // 加载资源
loader.load(
- // resource URL
+ // 资源URL
'models/json/pressure.json',
- // onLoad callback
+ // onLoad回调
function ( geometry ) {
var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:BufferGeometry].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] —在加载错误时被调用。
- Begin loading from url and call onLoad with the parsed response content.
+ 从URL中进行加载,并将已经以解析的响应内容传递给onLoad。
[method:BufferGeometry parse]( [param:Object json] )
- [page:Object json] — The JSON structure to parse.
- Parse a JSON structure and return a [page:BufferGeometry].
+ [page:Object json] — 所需要解析的JSON结构。
+ 解析一个JSON结构,并返回[page:BufferGeometry].
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/Cache.html b/docs/api/zh/loaders/Cache.html
index f0f9d81ff19a6d..15fd0b926610b6 100644
--- a/docs/api/zh/loaders/Cache.html
+++ b/docs/api/zh/loaders/Cache.html
@@ -11,10 +11,10 @@
[name]
- A simple caching system, used internally by [page:FileLoader].
+ 一个简单的缓存系统,内部使用[page:FileLoader]。
- Examples
+ 例子
[example:webgl_geometry_text WebGL / geometry / text ]
@@ -24,51 +24,51 @@
Examples
Usage
- To enable caching across all loaders that use [page:FileLoader], set
+
+ 要在所有使用[page:FileLoader]的加载器上启用缓存, 需设置
THREE.Cache.enabled = true.
- Properties
+ 属性
[property:Boolean enabled]
- Whether caching is enabled. Default is *false*.
+ 是否启用缓存,默认为*false*.
[property:Object files]
- An [page:Object object] that holds cached files.
+ 一个[page:Object object]所持有的缓存文件。
- Methods
+ 方法
[method:null add]( [param:String key], file )
- [page:String key] — the [page:String key] to reference the cached file by.
- [page:Object file] — The file to be cached.
+ [page:String key] — 通过引用缓存文件的[page:String key]。
+ [page:Object file] — 所被缓存的文件
- Adds a cache entry with a key to reference the file. If this key already holds a file,
- it is overwritten.
+ 使用key为引用文件增加一个缓存入口。如果该key已持有一个文件,则会被覆盖。
[method:null get]( [param:String key] )
- [page:String key] — A string key
+ [page:String key] — 一个字符串key
- Get the value of [page:String key]. If the key does not exist *undefined* is returned.
+ 获得该[page:String key]的值。 如果该key不存在,则以*undefined*被返回。
[method:null remove]( [param:String key] )
- [page:String key] — A string key that references a cached file.
+ [page:String key] — 引用缓存文件的一个字符串key
- Remove the cached file associated with the key.
+ 使用key来删除相应的缓存文件。
[method:null clear]()
- Remove all values from the cache.
+ 清除所有缓存中的值。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/CompressedTextureLoader.html b/docs/api/zh/loaders/CompressedTextureLoader.html
index ab1b1f51706d4b..57f06e8a7da6f1 100644
--- a/docs/api/zh/loaders/CompressedTextureLoader.html
+++ b/docs/api/zh/loaders/CompressedTextureLoader.html
@@ -11,62 +11,61 @@
[name]
- Abstract base class for block based textures loader (dds, pvr, ...).
- This uses the [page:FileLoader] internally for loading files.
+ 基于块的纹理加载器 (dds, pvr, ...)的抽象类。
+ 内部使用[page:FileLoader]来加载文件。
- Examples
+ 例子
- See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
- and [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
- for examples of derived classes.
+ 请参考[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
+ 和[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
+ 子类的例子
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
- Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。
+ 默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager]。
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 加载的基本路径。请参考[page:.setPath]。默认为*undefined*.
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的纹理。
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the loaded texture to onLoad.
+ 从URL中进行加载,并将被加载的纹理传递给onLoad。
[method:FileLoader setPath]( [param:String path] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many textures from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/CubeTextureLoader.html b/docs/api/zh/loaders/CubeTextureLoader.html
index 532382d5a34199..faa2163d0d8bd3 100644
--- a/docs/api/zh/loaders/CubeTextureLoader.html
+++ b/docs/api/zh/loaders/CubeTextureLoader.html
@@ -11,11 +11,11 @@
[name]
- Class for loading a [page:CubeTexture CubeTexture].
- This uses the [page:ImageLoader] internally for loading files.
+ 加载[page:CubeTexture CubeTexture]的一个类。
+ 内部使用[page:ImageLoader]来加载文件。
- Example
+ 例子
[example:webgl_materials_cubemap materials / cubemap]
@@ -40,63 +40,62 @@
Example
] );
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager]。默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:String crossOrigin]
- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
- attribute of the image to the value of *crossOrigin*,
- prior to starting the load. Default is *"anonymous"*.
+ 如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+ 属性,其值为 *crossOrigin*, 默认为"anonymous"。
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager]。
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 加载加载的文件的基本路径。 请参考[page:.setPath]。默认为*undefined*.
- Methods
+ 方法
[method:null load]( [param:String urls], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String urls] — array of 6 urls to images, one for each side of the CubeTexture.
- The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z.
- They can also be [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].
- Note that, by convention, cube maps are specified in a coordinate system in which positive-x is to the right
- when looking up the positive-z axis -- in other words, using a left-handed coordinate system.
- Since three.js uses a right-handed coordinate system, environment maps used in three.js will have pos-x and neg-x swapped.
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:String urls] — 数组长度为6的图像数组,数组内容为URL,每一个URL用于CubeTexture的每一侧。
+ 这些URL将被指定顺序: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z.
+ 数组内容也可以为 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].
+ 请注意,一般来说,在立方体贴图坐标系中,当查找positive-z轴时,positive-x表示右侧
+ - 换句话说,此坐标系使用左手坐标系。
+ 由于three.js使用右手坐标系, 环境贴图将在three.js进行pos-x和neg-x进行交互.
+ [page:Function onLoad] — 加载完成时将调用。回调参数是已被加载的[page:Texture texture].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,
+ 其中包含 [page:Integer total] 和 [page:Integer loaded] 字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
+ 从URL中进行加载,并将被加载的[page:Texture texture]传递给onLoad。
[method:null setCrossOrigin]( [param:String value] )
- Set the [page:.crossOrigin] attribute.
+ 设置[page:.crossOrigin]的属性。
[method:FileLoader setPath]( [param:String path] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many textures from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/DataTextureLoader.html b/docs/api/zh/loaders/DataTextureLoader.html
index af83b27fec5d82..96929b2cee168d 100644
--- a/docs/api/zh/loaders/DataTextureLoader.html
+++ b/docs/api/zh/loaders/DataTextureLoader.html
@@ -11,52 +11,52 @@
[name]
- Abstract base class to load generic binary textures formats (rgbe, hdr, ...).
- This uses the [page:FileLoader] internally for loading files, and creates a new
+ 用于加载二进制文件格式的(rgbe, hdr, ...)的抽象类。
+ 内部使用[page:FileLoader]来加载文件, 和创建一个新的
[page:DataTexture].
- Examples
+ 例子
- See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
- for an example of a derived class.
+ 请参考[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader]
+ 这个子类的例子。
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
- Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。
+ 默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认为[page:DefaultLoadingManager].
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的纹理。
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] —在加载错误时被调用。
- Begin loading from url and pass the loaded texture to onLoad.
+ 从URL中进行加载,并将被加载的纹理传递给onLoad。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/FileLoader.html b/docs/api/zh/loaders/FileLoader.html
index abe92be14ac57a..b25abbba88d667 100644
--- a/docs/api/zh/loaders/FileLoader.html
+++ b/docs/api/zh/loaders/FileLoader.html
@@ -12,11 +12,11 @@
[name]
- A low level class for loading resources with XMLHttpRequest, used internaly by most loaders.
- It can also be used directly to load any file type that does not have a loader.
+ 使用XMLHttpRequest来加载资源的低级类,并由大多数加载器内部使用。
+ 它也可以直接用于加载任何没有对应加载器的文件类型。
- Example
+ 例子
[example:webgl_loader_msgpack WebGL / loader / msgpack]
[example:webgl_morphtargets_human WebGL / morphtargets / human]
@@ -24,23 +24,23 @@
Example
var loader = new THREE.FileLoader();
- //load a text file and output the result to the console
+ //加载一个文本文件,并把结果输出到控制台上
loader.load(
// resource URL
'example.txt',
- // onLoad callback
+ // onLoad回调
function ( data ) {
// output the text to the console
console.log( data )
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.error( 'An error happened' );
}
@@ -48,103 +48,102 @@ Example
- Note: The cache must be enabled using
+ 注意:
+ 必须启用缓存
THREE.Cache.enabled = true;
- This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally.
- [page:Cache Cache] is a cache module that holds the response from each request made through this loader, so each file is requested once.
+ 这是一个全局属性,只需要设置一次,供内部使用FileLoader的所有加载器使用。
+ [page:Cache Cache] 是一个缓存模块,用于保存通过此加载器发出的每个请求的响应,因此每个文件都会被请求一次。
- Constructor
+ 构造函数
[name] ( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
- Default is [page:DefaultLoadingManager].
+ [page:LoadingManager manager] — [page:LoadingManager loadingManager] 是加载器所使用的加载管理器。
+ 默认为 [page:DefaultLoadingManager].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ [page:LoadingManager loadingManager] 是加载器所使用的加载管理器,默认为 [page:DefaultLoadingManager].
[property:String mimeType]
- The expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType].
- See [page:.setMimeType]. Default is *undefined*.
+ 详情 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType].
+ 请参考 [page:.setMimeType]。默认为 *undefined*。
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 将要加载的文件的基本路径。请参考 [page:.setPath]。 默认为 *undefined*.
[property:object requestHeader]
- The [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. See [page:.setRequestHeader]. Default is *undefined*.
+ [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] 在HTTP 请求中使用。 请参考 [page:.setRequestHeader]。 默认为 *undefined*.
[property:String responseType]
- The expected response type. See [page:.setResponseType]. Default is *undefined*.
+ 请求的响应类型。 请参考 [page:.setResponseType]. 默认为 *undefined*.
[property:String withCredentials]
- Whether the XMLHttpRequest uses credentials. See [page:.setWithCredentials].
- Default is *undefined*.
+ XMLHttpRequest是否使用证书。 请参考 [page:.setWithCredentials].
+ 默认为 *undefined*.
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] (optional) — Will be called when loading completes. The argument will be the loaded response.
- [page:Function onProgress] (optional) — Will be called while load progresses. The argument will be the XMLHttpRequest instance,
- which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] (optional) — Will be called if an error occurs.
+ [page:Function onLoad] (可选) — 加载完成时将调用。回调参数将是加载的响应。
+ [page:Function onProgress] (可选) — 将在加载过程中进行调用。参数将是XMLHttpRequest实例,
+ 其中包含 [page:Integer total] 和 [page:Integer loaded] 字节
+ [page:Function onError] (可选) — 在加载错误时被调用。
- Load the URL and pass the response to the onLoad function.
+ 加载URL并将响应传递给onLoad函数。
[method:FileLoader setMimeType]( [param:String mimeType] )
- Set the expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
- of the file being loaded. Note that in many cases this will be determined automatically, so by default it is *undefined*.
+ 设置正在加载的文件预期类型 [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
+ 。请注意,在许多情况下,这将自动确定,因此默认情况下它是 *undefined* 。
[method:FileLoader setPath]( [param:String path] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many models from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
[method:FileLoader setRequestHeader]( [param:object requestHeader] )
- [page:object requestHeader] - key: The name of the header whose value is to be set. value: The value to set as the body of the header.
+ [page:object requestHeader] - key: 要设置header的名称。 value:要设置header的值。
- Set the [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request.
+ 请参考在HTTP 请求中的 [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header]。
[method:FileLoader setResponseType]( [param:String responseType] )
- Change the response type. Valid values are:
- [page:String text] or empty string (default) - returns the data as [page:String string].
- [page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.
- [page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].
- [page:String document] - parses the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].
- [page:String json] - parses the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].
+ 改变响应的类型,其类型有效值如下:
+ [page:String text] 或者空 string (默认) - 返回的数据类型为 [page:String string].
+ [page:String arraybuffer] - 加载的数据类型到一个数组buffer中 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] 并进行返回。
+ [page:String blob] - 返回的数据为 [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob]。
+ [page:String document] - 使用 [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser] 解析文件。
+ [page:String json] - 将文件解析为 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].
[method:FileLoader setWithCredentials]( [param:Boolean value] )
- Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
- TLS client certificates. See [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].
- Note that this has no effect if you are loading files locally or from the same domain.
+ XMLHttpRequest是否使用cookie、授权头或TLS客户端证书等凭据。 请参考 [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].
+ 请注意,当您在本地或从同一域加载文件,则该方法无效。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/FontLoader.html b/docs/api/zh/loaders/FontLoader.html
index 4dcc23843c8c41..e8541ac5627b80 100644
--- a/docs/api/zh/loaders/FontLoader.html
+++ b/docs/api/zh/loaders/FontLoader.html
@@ -11,14 +11,13 @@
[name]
- Class for loading a font in JSON format. Returns a [page:Font Font], which is an
- array of [page:Shape Shape]s representing the font.
- This uses the [page:FileLoader] internally for loading files.
+ 使用JSON格式中加载字体的一个类。返回[page:Font Font], 返回值是表示字体的[page:Shape Shape]类型的数组。
+ 其内部使用[page:FileLoader]来加载文件。
- You can convert fonts online using [link:https://gero3.github.io/facetype.js/ facetype.js]
+ 你可以使用[link:https://gero3.github.io/facetype.js/ facetype.js]在线转换字体。
- Examples
+ 例子
[example:webgl_geometry_text_shapes geometry / text / shapes ]
@@ -28,71 +27,70 @@
Examples
var loader = new THREE.FontLoader();
var font = loader.load(
- // resource URL
+ // 资源URL
'fonts/helvetiker_bold.typeface.json',
- // onLoad callback
+ // onLoad回调
function ( font ) {
// do something with the font
scene.add( font );
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
);
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ [page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager]。默认值为[page:LoadingManager THREE.DefaultLoadingManager].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager]。默认值为[page:DefaultLoadingManager].
[property:String path]
- The base path from which fonts will be loaded. See [page:.setPath]. Default is *undefined*.
+ 所要加载字体的基本路径。 具体参考[page:.setPath]。 默认为*undefined*.
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数是将要被加载的[page:Texture texture].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
+ 从URL中进行加载,并将被加载的[page:Texture texture]传递给onLoad。
[method:Font parse]( [param:Object json] )
[page:Object json] — The JSON structure to parse.
- Parse a JSON structure and return a [page:Font].
+ 以JSON格式进行解析,并返回一个[page:Font].
[method:FontLoader setPath]( [param:String path] )
- Set the base path or URL from which to load fonts. This can be useful if
- you are loading many fonts from the same directory.
+ 设置加载字体的基本路径或URL。当加载同一目录中下的许多字体时,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/ImageBitmapLoader.html b/docs/api/zh/loaders/ImageBitmapLoader.html
index d54fc9f84660f0..135c8abc29db05 100644
--- a/docs/api/zh/loaders/ImageBitmapLoader.html
+++ b/docs/api/zh/loaders/ImageBitmapLoader.html
@@ -11,36 +11,36 @@
[name]
- A loader for loading an [page:Image] as an [link:https://developer.mozilla.org/de/docs/Web/API/ImageBitmap ImageBitmap].
- An ImageBitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in WebGL.
- Unlike [page:FileLoader], [name] does not avoid multiple concurrent requests to the same URL.
+ 一个把[page:Image]加载为[link:https://developer.mozilla.org/de/docs/Web/API/ImageBitmap ImageBitmap]的加载器。
+ ImageBitmap提供了一种异步且有效的资源的途径,用于在WebGL中渲染的纹理。
+ 不像[page:FileLoader], [name]无需避免对同一的URL进行多次请求。
- Example
+ 例子
[example:webgl_loader_imagebitmap WebGL / loader / ImageBitmap]
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.ImageBitmapLoader();
- // load a image resource
+ // 加载一个图片资源
loader.load(
- // resource URL
+ // 资源的URL
'textures/skyboxsun25degtest.png',
- // onLoad callback
+ // onLoad回调
function ( imageBitmap ) {
var texture = new THREE.CanvasTexture( imageBitmap );
var material = new THREE.MeshBasicMaterial( { map: texture } );
},
- // onProgress callback currently not supported
+ // 目前暂不支持onProgress的回调
undefined,
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
@@ -48,58 +48,58 @@ Example
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager] ,默认为[page:DefaultLoadingManager].
[property:String options]
- An optional object that sets options for the internally used [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap] factory method. Default is *undefined*.
+ 一个可选对象,用来设置内部使用的[link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap]工厂方法,
+ 默认为*undefined*.
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 所要加载文件的基本路径。 请参考[page:.setPath],默认为*undefined*。
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].
- [page:Function onProgress] — This callback function is currently not supported.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Image image].
+ [page:Function onProgress] — 此回调函数暂时不支持
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and return the [page:ImageBitmap image] object that will contain the data.
+ 从URL中进行加载,并返回将包含数据的[page:ImageBitmap image]对象。
[method:ImageBitmapLoader setCrossOrigin]()
- This method exists for compatibility reasons and implements no logic. It ensures that [name] has a similar interface like [page:ImageLoader].
+ 此方法出于兼容性原因而存在,并且不实现逻辑。它确保[name]具有[page:ImageLoader]的类似接口。
[method:ImageBitmapLoader setOptions]( [param:Object options] )
- Sets the options object for [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap].
+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap]的选项对象。
[method:ImageBitmapLoader setPath]( [param:String path] )
- Sets the base path or URL from which to load files. This can be useful if
- you are loading many images from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中下的许多图片时,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/ImageLoader.html b/docs/api/zh/loaders/ImageLoader.html
index eecf34bb76e46d..4cc529eb72eb1a 100644
--- a/docs/api/zh/loaders/ImageLoader.html
+++ b/docs/api/zh/loaders/ImageLoader.html
@@ -11,12 +11,12 @@
[name]
- A loader for loading an [page:Image].
- This uses the [page:FileLoader] internally for loading files, and is used internally by the
- [page:CubeTextureLoader], [page:ObjectLoader] and [page:TextureLoader].
+ 用来加载一个[page:Image]的加载器。
+ 内部使用[page:FileLoader]来加载文件,并被
+ [page:CubeTextureLoader]、[page:ObjectLoader]、[page:TextureLoader]所使用。
- Example
+ 例子
[example:webgl_loader_obj WebGL / loader / obj]
@@ -24,15 +24,15 @@
Example
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.ImageLoader();
- // load a image resource
+ // 加载一个图片资源
loader.load(
- // resource URL
+ // 资源URL
'textures/skyboxsun25degtest.png',
- // onLoad callback
+ // onLoad回调
function ( image ) {
// use the image, e.g. draw part of it on a canvas
var canvas = document.createElement( 'canvas' );
@@ -40,10 +40,10 @@ Example
context.drawImage( image, 100, 100 );
},
- // onProgress callback currently not supported
+ // 目前暂不支持onProgress的回调
undefined,
- // onError callback
+ // onError回调
function () {
console.error( 'An error happened.' );
}
@@ -51,59 +51,58 @@ Example
- Please note three.js r84 dropped support for ImageLoader progress events. For an ImageLoader
- that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639 this thread].
+ 请注意three.js r84遗弃了ImageLoader进度事件. 对于支持进度事件的ImageLoader
+ 请参考[link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639 this thread].
- Constructor
+ 构造方法
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:String crossOrigin]
- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
- attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
+ 如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+ 属性,其值为 *crossOrigin*, 默认为"anonymous"。
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager].
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 所要加载文件的基本路径。 请参考[page:.setPath],默认为*undefined*。
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].
- [page:Function onProgress] — This callback function is currently not supported.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] —加载完成时将调用。回调参数为将要加载的[page:Image image]。
+ [page:Function onProgress] — 此回调函数暂时不支持。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and return the [page:Image image] object that will contain the data.
+ 从URL中进行加载,并返回将包含数据的[page:Image image]对象。
[method:null setCrossOrigin]( [param:String value] )
- Set the [page:.crossOrigin] attribute.
+ 设置[page:.crossOrigin]的属性。
[method:FileLoader setPath]( [param:String path] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many images from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中下的许多图片时,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/JSONLoader.html b/docs/api/zh/loaders/JSONLoader.html
index c6a0d3c780cfa4..d665aecdd883b1 100644
--- a/docs/api/zh/loaders/JSONLoader.html
+++ b/docs/api/zh/loaders/JSONLoader.html
@@ -11,11 +11,11 @@
[name]
- A loader for loading objects in JSON format.
- This uses the [page:FileLoader] internally for loading files.
+ 以JSON格式来加载对象的加载器。
+ 此加载器内部用 [page:FileLoader] 来加载文件。
- Example
+ 例子
[example:webgl_loader_json WebGL / loader / json]
@@ -23,96 +23,96 @@
Example
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.JSONLoader();
- // load a resource
+ // 加载一个资源
loader.load(
- // resource URL
+ // 资源URL
'models/animated/monster/monster.js',
- // onLoad callback
+ // onLoad的回调
function ( geometry, materials ) {
var material = materials[ 0 ];
var object = new THREE.Mesh( geometry, material );
scene.add( object );
},
- // onProgress callback
+ // onProgress的回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError的回调
function( err ) {
console.log( 'An error happened' );
}
);
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器所使用的 [page:LoadingManager loadingManager]。 默认为 [page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的 [name].
- Properties
+ 属性
[property:String crossOrigin]
- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
- attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
+ 如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+ 属性,其值为 *crossOrigin*,默认为"anonymous"。
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的 [page:LoadingManager loadingManager] 。 默认为 [page:DefaultLoadingManager].
[property:String withCredentials]
- Whether the XMLHttpRequest uses credentials.
- Default is *false*.
+ XMLHttpRequest请求是否使用了证书。
+ 默认为 *false*.
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI]..
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数将是加载的响应。
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,
+ 其中包含 [page:Integer total] 和 [page:Integer loaded] 字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and pass the JSON to onLoad.
+ 从URL中进行加载并将 JSON 传递给 onLoad。
[method:JSONLoader setCrossOrigin]( [param:String value] )
- Set the [page:.crossOrigin] attribute.
+ 设置 [page:.crossOrigin] 的属性。
[method:JSONLoader setTexturePath]( [param:String texturePath] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many files from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
[method:Object3D parse]( [param:Object json], [param:String texturePath] )
- [page:String json] — JSON object to parse.
- [page:String texturePath] — Base path for textures.
+ [page:String json] — 需要解析的JSON对象。
+ [page:String texturePath] — 纹理的基本路径。
- Parse a JSON structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
+ 解析要给 JSON 结构并返回 [page:object] 包含 [page:Geometry geometry] 和 [page:Array materials] 的对象.
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/Loader.html b/docs/api/zh/loaders/Loader.html
index 21c8482ffb2982..f5d1a115e02b23 100644
--- a/docs/api/zh/loaders/Loader.html
+++ b/docs/api/zh/loaders/Loader.html
@@ -10,56 +10,55 @@
[name]
- Base class for implementing loaders.
+ 所有加载器的基类
- Constructor
+ 构造方法
[name]()
- Creates a new [name]. This should be called as base class.
+ 当创建一个新的 [name], 将调用此基类。
- Properties
+ 属性
[property:Function onLoadStart]
- Will be called when load starts.
- The default is a function with empty body.
+ 当加载开始时,将被调用。
+ 默认实现是一个空函数体。
[property:Function onLoadProgress]
- Will be called while load progresses.
- The default is a function with empty body.
+ 当进入加载流程中,将被调用。
+ 默认实现是一个空函数体。
[property:Function onLoadComplete]
- Will be called when load completes.
- The default is a function with empty body.
+ 当加载完成时,将被调用。
+ 默认实现是一个空函数体。
[property:string crossOrigin]
- The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
- Default is *"anonymous"*.
+ 跨域字符串,用于实现跨域,以便从允许CORS从其他域加载url。默认为"anonymous"。
Methods
[method:Material createMaterial]( [param:object m], [param:string texturePath] )
- [page:Object m] — The parameters to create the material.
- [page:String texturePath] — The base path of the textures.
+ [page:Object m] — 所要创建的材质的参数。
+ [page:String texturePath] — 纹理加载路径。
- Creates the Material based on the parameters m.
+ 基于参数m来创建材质。
[method:Array initMaterials]( [param:Array materials], [param:string texturePath] )
- [page:Array materials] — an array of parameters to create materials.
- [page:String texturePath] — The base path of the textures.
+ [page:Array materials] — 用于创建材质的参数数组。
+ [page:String texturePath] — 纹理加载路径。
- Creates an array of [page:Material] based on the array of parameters m. The index of the parameters decide the correct index of the materials.
+ 基于参数数组m,来创建 [page:Material] 数组. 参数索引与材质的索引一致。
diff --git a/docs/api/zh/loaders/LoaderUtils.html b/docs/api/zh/loaders/LoaderUtils.html
index 05df4cf0888d82..52da894155bddd 100644
--- a/docs/api/zh/loaders/LoaderUtils.html
+++ b/docs/api/zh/loaders/LoaderUtils.html
@@ -10,28 +10,28 @@
[name]
- An object with several loader utility functions.
+ 具有多个实用的加载器函数功能的对象
- Functions
+ 函数
[method:String decodeText]( [param:TypedArray array] )
- [page:TypedArray array] — A stream of bytes as a typed array.
+ [page:TypedArray array] — 作为类型化数组的字节流
- The function takes a stream of bytes as input and returns a string representation.
+ 该函数将字节流作为输入并返回字符串作为表示。
[method:String extractUrlBase]( [param:string url] )
- [page:String url] — The url to extract the base url from.
+ [page:String url] — 从基本URL中,进行提取的URL。
- Extract the base from the URL.
+ 从URL中提取基本信息。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/MaterialLoader.html b/docs/api/zh/loaders/MaterialLoader.html
index b931c50591b351..f73ee5ee2b438b 100644
--- a/docs/api/zh/loaders/MaterialLoader.html
+++ b/docs/api/zh/loaders/MaterialLoader.html
@@ -11,33 +11,33 @@
[name]
- A loader for loading a [page:Material] in JSON format.
- This uses the [page:FileLoader] internally for loading files.
+ 以JSON格式来加载[page:Material]的加载器。
+ 默认使用[page:FileLoader]进行加载文件。
- Example
+ 例子
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.MaterialLoader();
- // load a resource
+ // 加载资源
loader.load(
- // resource URL
+ // 资源URL
'path/to/material.json',
- // onLoad callback
+ // onLoad回调
function ( material ) {
object.material = material;
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.log( 'An error happened' );
}
@@ -45,53 +45,53 @@ Example
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认为[page:LoadingManager THREE.DefaultLoadingManager].
+ 创建要给新的[name].
- Properties
+ 属性
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager],默认为[page:DefaultLoadingManager].
[property:Object textures]
- Object holding any textures used by the material. See [page:.setTextures].
+ 持有材质的任何纹理的对象,请参考 [page:.setTextures].
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Material].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Material]。
+ [page:Function onProgress] — 将在加载过程中进行调用,参数为进度事件。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and return the [page:Material] object that will contain the data.
+ 从URL中进行加载,并返回将包含数据的[page:Material]对象。
[method:Material parse]( [param:Object json] )
- [page:Object json] — The json object containing the parameters of the Material.
+ [page:Object json] — JSON对象包含材质参数。
- Parse a JSON structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
+ 解析JSON结构,以json对象的参数中的[page:String json.type]类型,创建一个新的[page:Material]。
[method:null setTextures]( [param:Object textures] )
- [page:Object textures] — object containing any textures used by the material.
+ [page:Object textures] — 对象包含任何被材质所使用的纹理。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/ObjectLoader.html b/docs/api/zh/loaders/ObjectLoader.html
index 95a7c0f2e40262..67682371f68408 100644
--- a/docs/api/zh/loaders/ObjectLoader.html
+++ b/docs/api/zh/loaders/ObjectLoader.html
@@ -11,15 +11,15 @@
[name]
- A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the
- .type attributes of objects to map them to their original classes.
+ 一个用来加载JSON资源的加载器。 不像[page:JSONLoader],这个加载器使用
+ .type对象属性,来映射它自己到源类。
- Note that this loader can't load [page:Geometries]. Use [page:JSONLoader] instead for that.
+ 请注意这个加载器不能用来加载[page:Geometries],而是用[page:JSONLoader]进行加载。
- This uses the [page:FileLoader] internally for loading files.
+ 此加载器内部使用[page:FileLoader]进行加载文件。
- Example
+ 例子
@@ -32,29 +32,29 @@
Example
var loader = new THREE.ObjectLoader();
loader.load(
- // resource URL
+ // 资源的URL
"models/json/example.json",
- // onLoad callback
+ // onLoad回调
// Here the loaded data is assumed to be an object
function ( obj ) {
// Add the loaded object to the scene
scene.add( obj );
},
- // onProgress callback
+ // onProgress回调
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
- // onError callback
+ // onError回调
function ( err ) {
console.error( 'An error happened' );
}
);
- // Alternatively, to parse a previously loaded JSON structure
+ // 或者,解析先前加载的JSON结构
var object = loader.parse( a_json_object );
scene.add( object );
@@ -62,102 +62,100 @@ Example
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器所使用的[page:LoadingManager loadingManager],默认值为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:String crossOrigin]
- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
- attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
+ 如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+ 属性,其值为 *crossOrigin*, 默认为"anonymous"。
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager]。
[property:String texturePath]
- The base path or URL from which textures will be loaded. See [page:.setTexturePath].
- Default is the empty string.
+ 将要被加载的纹理的路径或者URL,详情请参考[page:.setTexturePath]。
+ 默认值为空字符串。
- Methods
+ 方法
[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Object3D object].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from url and call onLoad with the parsed response content.
+ 从URL中进行加载,并将被解析的响应内容传递给onLoad。
[method:Object3D parse]( [param:Object json], [param:Function onLoad] )
- [page:Object json] — required. The JSON source to parse.
- [page:Function onLoad] — Will be called when parsed completes. The argument will be the parsed [page:Object3D object].
+ [page:Object json] — 必选参数,需要被解析的JSON源。
+ [page:Function onLoad] — 当解析完成时被调用,其中参数被解析为[page:Object3D object].
- Parse a JSON structure and return a threejs object.
- This is used internally by [page:.load], but can also be used directly to parse
- a previously loaded JSON structure.
+ 解析一个JSON结构,并返回一个threejs对象.
+ 内部使用[page:.load]进行加载, 但也可以直接用于解析先前加载的JSON结构。
[method:Object3D parseGeometries]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
- This is used [page:.parse] to parse any [page:Geometry geometries] or [page:BufferGeometry buffer geometries] in the JSON structure.
- Internally it uses [page:JSONLoader] for geometries and [page:BufferGeometryLoader] for buffer geometries.
+ 此函数以JSON结构,用[page:.parse]去解析[page:Geometry geometries]或[page:BufferGeometry buffer geometries]。
+ 在内部,它使用JSONLoader作为几何加载器,使用BufferGeometryLoader作为几何缓冲区加载器。
[method:Object3D parseMaterials]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
- This is used [page:.parse] to parse any materials in the JSON structure using [page:MaterialLoader].
+ 此函数通过[page:.parse]来使用[page:MaterialLoader],以解析JSON结构中任意材质。
[method:Object3D parseAnimations]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
- This is used [page:.parse] to parse any animations in the JSON structure, using [page:AnimationClip.parse].
-
+ 此函数通过[page:.parse]来使用[page:AnimationClip.parse], 以解析JSON结构中任意动画。
+
[method:Object3D parseImages]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
- This is used [page:.parse] to parse any images in the JSON structure, using [page:ImageLoader].
+ 此函数通过[page:.parse]来使用[page:ImageLoader], 以解析JSON结构中任意图片。
[method:Object3D parseTextures]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
-
- This is used [page:.parse] to parse any textures in the JSON structure.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
+ 此函数通过[page:.parse]来解析JSON结构中任意纹理。
[method:Object3D parseObject]( [param:Object json] )
- [page:Object json] — required. The JSON source to parse.
+ [page:Object json] — 必选参数,需要被解析的JSON源。
- This is used [page:.parse] to parse any objects in the JSON structure.
- Objects can be of the following types:
+ 此函数通过[page:.parse]来解析JSON结构中任意对象。
+ 对象可以为如下类型:
-
@@ -214,17 +212,17 @@
[method:Object3D parseObject]( [param:Object json] )
[method:ObjectLoader setCrossOrigin]( [param:String value] )
- [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
+ [page:String value] — 在允许CROS时,跨域字段通过实现CORS来加载不同域下的URL。
[method:ObjectLoader setTexturePath]( [param:String value] )
- [page:String value] — The base path or URL from which textures will be loaded.
+ [page:String value] — 设置将要加载为纹理的路径或者URL
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/TextureLoader.html b/docs/api/zh/loaders/TextureLoader.html
index 867ef79a351491..05858f35d6a03c 100644
--- a/docs/api/zh/loaders/TextureLoader.html
+++ b/docs/api/zh/loaders/TextureLoader.html
@@ -11,16 +11,16 @@
[name]
- Class for loading a [page:Texture texture].
- This uses the [page:ImageLoader] internally for loading files.
+ 加载[page:Texture texture]的一个类。
+ 内部使用[page:ImageLoader]来加载文件。
- Example
+ 例子
var texture = new THREE.TextureLoader().load( 'textures/land_ocean_ice_cloud_2048.jpg' );
- // immediately use the texture for material creation
+ // 立即使用纹理进行材质创建
var material = new THREE.MeshBasicMaterial( { map: texture } );
@@ -29,15 +29,15 @@ Example
Example with Callbacks
- // instantiate a loader
+ // 初始化一个加载器
var loader = new THREE.TextureLoader();
- // load a resource
+ // 加载一个资源
loader.load(
- // resource URL
+ // 资源URL
'textures/land_ocean_ice_cloud_2048.jpg',
- // onLoad callback
+ // onLoad回调
function ( texture ) {
// in this example we create the material when the texture is loaded
var material = new THREE.MeshBasicMaterial( {
@@ -45,71 +45,70 @@ Example with Callbacks
} );
},
- // onProgress callback currently not supported
+ // 目前暂不支持onProgress的回调
undefined,
- // onError callback
+ // onError回调
function ( err ) {
console.error( 'An error happened.' );
}
);
+ 请注意three.js r84遗弃了TextureLoader进度事件。对于支持进度事件的TextureLoader ,
+ 请参考[link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145 this thread]。
- Please note three.js r84 dropped support for TextureLoader progress events. For a TextureLoader that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145 this thread].
-
- Constructor
+ 构造函数
[name]( [param:LoadingManager manager] )
- [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+ [page:LoadingManager manager] — 加载器使用的[page:LoadingManager loadingManager],默认值为[page:LoadingManager THREE.DefaultLoadingManager].
- Creates a new [name].
+ 创建一个新的[name].
- Properties
+ 属性
[property:String crossOrigin]
- If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
- attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
+ 如果设置了,在开始加载前, 将为图片分配 [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+ 属性,其值为 *crossOrigin*, 默认为"anonymous"。
[property:LoadingManager manager]
- The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+ 加载器正在使用的[page:LoadingManager loadingManager],默认值为[page:DefaultLoadingManager].
[property:String path]
- The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.
+ 被加载文件的基本路径,请参考[page:.setPath]。默认值为*undefined*.
- Methods
+ 方法
[method:Texture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:String url] — the path or URL to the file. This can also be a
+ [page:String url] — 文件的URL或者路径,也可以为
[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
- [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
- [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
- [page:Function onError] — Will be called when load errors.
+ [page:Function onLoad] — 加载完成时将调用。回调参数为将要加载的[page:Texture texture].
+ [page:Function onProgress] — 将在加载过程中进行调用。参数为XMLHttpRequest实例,实例包含[page:Integer total]和[page:Integer loaded]字节。
+ [page:Function onError] — 在加载错误时被调用。
- Begin loading from the given URL and pass the fully loaded [page:Texture texture] to onLoad. The method also returns a new texture object which can directly be used for material creation.
- If you do it this way, the texture may pop up in your scene once the respective loading process is finished.
+ 从给定的URL开始加载并将完全加载的[page:Texture texture]传递给onLoad。该方法还返回一个新的纹理对象,该纹理对象可以直接用于材质创建。
+ 如果采用此方法,一旦相应的加载过程完成,纹理可能会在场景中出现。
[method:null setCrossOrigin]( [param:String value] )
- Set the [page:.crossOrigin] attribute.
+ 设置[page:.crossOrigin]的属性。
[method:FileLoader setPath]( [param:String path] )
- Set the base path or URL from which to load files. This can be useful if
- you are loading many models from the same directory.
+ 设置加载文件的基本路径或URL。当加载同一目录中的许多模型,此方法将很有用。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/loaders/managers/DefaultLoadingManager.html b/docs/api/zh/loaders/managers/DefaultLoadingManager.html
index f608c7e1ec04b2..89d7f258ac5869 100644
--- a/docs/api/zh/loaders/managers/DefaultLoadingManager.html
+++ b/docs/api/zh/loaders/managers/DefaultLoadingManager.html
@@ -10,23 +10,20 @@
[name]
- A global instance of the [page:LoadingManager LoadingManager], used by most loaders
- when no custom manager has been specified.
+
[page:LoadingManager LoadingManager]是一个全局实例, 当其他加载器没有指定加载管理器时,它将被其他大多数的加载器设为默认的加载管理器。
- This will be sufficient for most purposes, however there may be times when you desire seperate loading managers
- for say, textures and models.
+
+ LoadingManager对于大多数加载器来说已经足够了,但有时您可能需要单独设置加载管理器,例如纹理、模型加载器。
- Example
+ 例子
- You can optionally set the [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad],
- [page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] functions for the manager.
- These will then apply to any loaders using the DefaultLoadingManager.
+ 你可以选择性的为你的管理器设置 [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad],
+ [page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] 这些方法。
+ 当你的加载器使用默认加载管理器时,这些方法都将被应用到加载器上。
- Note that these shouldn't be confused with the similarly named functions of individual loaders,
- as they are intended for displaying information about the overall status of loading,
- rather than dealing with the data that has been loaded.
+ 请注意,个人的加载器的不应具有类似上面类似的命名函数,以避免混淆。因为这些函数时用于显示有关加载总体状态的信息,而不是处理已加载的数据。
THREE.DefaultLoadingManager.onStart = function ( url, itemsLoaded, itemsTotal ) {
@@ -56,15 +53,15 @@ Example
- Properties
+ 属性
- See the [page:LoadingManager LoadingManager] page for details of properties.
+ 有关LoadingManager属性的详细信息,请查看[page:LoadingManager LoadingManager] 页面。
- Methods
+ 方法
- See the [page:LoadingManager LoadingManager] page for details of methods.
+ 有关LoadingManager方法的详细信息,请查看[page:LoadingManager LoadingManager] 页面。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js]
diff --git a/docs/api/zh/loaders/managers/LoadingManager.html b/docs/api/zh/loaders/managers/LoadingManager.html
index 034baa13a21c34..eaee4ce746a409 100644
--- a/docs/api/zh/loaders/managers/LoadingManager.html
+++ b/docs/api/zh/loaders/managers/LoadingManager.html
@@ -11,16 +11,16 @@
[name]
- Handles and keeps track of loaded and pending data. A default global instance of this class
- is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].
- In general that should be sufficient, however there are times when it can be useful to have seperate loaders -
- for example if you want to show seperate loading bars for objects and textures.
+ 其功能时处理并跟踪已加载和待处理的数据。如果未手动设置加强管理器,则会为加载器创建和使用默认全局实例加载器管理器
+ - 请参阅 [page:DefaultLoadingManager].
+
+ 一般来说,默认的加载管理器已足够使用了,但有时候也需要设置单独的加载器 - 例如,如果你想为对象和纹理显示单独的加载条。
- Example
+ 例子
[example:webgl_loader_babylon WebGL / loader / babylon]
@@ -32,8 +32,7 @@
Example
- This example shows how to use LoadingManager to track the progress of
- [page:OBJLoader].
+ 下面的例子将介绍,如何使用加载管理器来跟踪 [page:OBJLoader] 的加载进度流程。
@@ -72,19 +71,18 @@ Example
- In addition to observing progress, a LoadingManager can be used to
- override resource URLs during loading. This may be helpful for assets
- coming from drag-and-drop events, WebSockets, WebRTC, or other APIs. An
- example showing how to load an in-memory model using Blob URLs is below.
+
+ 除了观察进度流程之外,还可以使用LoadingManager在加载期间覆写资源URL。当某资源来自拖拽事件、
+ WebSockets、WebRTC或其他API时,此方法可以有所帮助。下面显示了如何使用Blob URL加载内存模型的示例。
- // Blob or File objects created when dragging files into the webpage.
+ // 将文件拖入网页时创建的Blob或File对象。
var blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3};
var manager = new THREE.LoadingManager();
- // Initialize loading manager with URL callback.
+ // 使用URL回调初始化加载管理器。
var objectURLs = [];
manager.setURLModifier( ( url ) => {
@@ -96,7 +94,7 @@ Example
} );
- // Load as usual, then revoke the blob URLs.
+ // 像通常一样加载,然后撤消blob URL
var loader = new THREE.GLTFLoader( manager );
loader.load( 'fish.gltf', (gltf) => {
@@ -107,75 +105,73 @@ Example
});
- Constructor
+ 构造方法
[name]( [param:Function onLoad], [param:Function onProgress], [param:Function onError] )
- [page:Function onLoad] — (optional) this function will be called when all loaders are done.
- [page:Function onProgress] — (optional) this function will be called when an item is complete.
- [page:Function onError] — (optional) this function will be called a loader encounters errors.
+ [page:Function onLoad] — (可选) 所有加载器加载完成后,将调用此函数。
+ [page:Function onProgress] — (可选) 当每个项目完成后,将调用此函数。
+ [page:Function onError] — (可选) 当一个加载器遇到错误时,将调用此函数。
- Creates a new [name].
+ 创建一个新的 [name].
- Properties
+ 属性
[property:Function onStart]
- This function will be called when loading starts.
- The arguments are:
- [page:String url] — The url of the item just loaded.
- [page:Integer itemsLoaded] — the number of items already loaded so far.
- [page:Iteger itemsTotal] — the total amount of items to be loaded.
+ 此换上咋加载开始时,被调用.
+ 有如下参数:
+ [page:String url] — 被加载的项的url。
+ [page:Integer itemsLoaded] — 目前已加载项的个数。
+ [page:Iteger itemsTotal] — 总共所需要加载项的个数。
- By default this is undefined.
+ 此方法默认时未定义。
[property:Function onLoad]
- This function will be called when all loading is completed. By default this is undefined,
- unless passed in the constructor.
+ 所有的项加载完成后将调用此函数。默认情况下,此方法时未定义的,除非在构造函数中进行传递。
[property:Function onProgress]
- This function will be called when an item is complete.
- The arguments are:
- [page:String url] — The url of the item just loaded.
- [page:Integer itemsLoaded] — the number of items already loaded so far.
- [page:Iteger itemsTotal] — the total amount of items to be loaded.
+ 此方法加载每一个项,加载完成时进行调用。
+ 有如下参数:
+ [page:String url] — 被加载的项的url。
+ [page:Integer itemsLoaded] — 目前已加载项的个数。
+ [page:Iteger itemsTotal] — 总共所需要加载项的个数。
- By default this is undefined, unless passed in the constructor.
+ 默认情况下,此方法时未定义的,除非在构造函数中进行传递。
[property:Function onError]
- This function will be called when any item errors, with the argument:
- [page:String url] — The url of the item that errored.
+ 此方法将在任意项加载错误时,进行调用。
+ 有如下参数:
+ [page:String url] — 所加载出错误的项的url
- By default this is undefined, unless passed in the constructor.
+ 默认情况下,此方法时未定义的,除非在构造函数中进行传递。
- Methods
+ 方法
[method:null setURLModifier]( [param:Function callback] )
- [page:Function callback] — URL modifier callback. Called with [page:String url] argument, and
- must return [page:String resolvedURL].
+ [page:Function callback] —
+ 设置URL修饰符成功时回调。使用url参数进行回调,并且必须返回 [page:String resolvedURL] 。
- If provided, the callback will be passed each resource URL before a request is sent. The
- callback may return the original URL, or a new URL to override loading behavior. This
- behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
+ 如果设置了回调,则在发送请求之前将向每个资源URL传递回调。回调可以返回最初的URL,也可以返回新URL以覆盖加载行为。
+ 此行为可用于从.ZIP、拖拽API和数据URI中加载资源文件。
[method:String resolveURL]( [param:String url] )
- [page:String url] — the url to load
+ [page:String url] — 所要加载的url
- Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no
- URL modifier is set, returns the original URL.
+ 给定URL,使用URL修饰符回调(如果有)并返回已解析的URL。如果未设置URL修饰符,则返回原始URL。
@@ -186,27 +182,27 @@ [method:String resolveURL]( [param:String url] )
[method:null itemStart]( [param:String url] )
- [page:String url] — the url to load
+ [page:String url] — 所要加载的url
- This should be called by any loader using the manager when the loader starts loading an url.
+ 任何使用管理器的加载器都会调用此方法, 当加载器需要开始加载URL时。
[method:null itemEnd]( [param:String url] )
- [page:String url] — the loaded url
+ [page:String url] — 所要加载的url
- This should be called by any loader using the manager when the loader ended loading an url.
+ 任何使用管理器的加载器都会调用此方法, 当加载器需要加载URL结束时。
[method:null itemError]( [param:String url] )
- [page:String url] — the loaded url
+ [page:String url] — 所要加载的url
- This should be called by any loader using the manager when the loader errors loading an url.
+ 任何使用管理器的加载器都会调用此方法, 当加载器出现加载错误时。
- Source
+ 源
[link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js]
diff --git a/docs/api/zh/renderers/WebGLRenderer.html b/docs/api/zh/renderers/WebGLRenderer.html
index 2c9c58ca36066d..ddf6a9cb74b080 100644
--- a/docs/api/zh/renderers/WebGLRenderer.html
+++ b/docs/api/zh/renderers/WebGLRenderer.html
@@ -122,7 +122,7 @@ [property:WebGLRenderingContext context]
[property:DOMElement domElement]
一个[link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas],渲染器在其上绘制输出。
- 渲染器的构造函数会自动创建(如果没有传入canvas参数);你需要做的仅仅是像下面这样将它加页面里去
+ 渲染器的构造函数会自动创建(如果没有传入canvas参数);你需要做的仅仅是像下面这样将它加页面里去:
document.body.appendChild( renderer.domElement );
diff --git a/docs/api/zh/renderers/shaders/ShaderChunk.html b/docs/api/zh/renderers/shaders/ShaderChunk.html
index a9c917b94ba3c3..6bf5cec6daf51c 100644
--- a/docs/api/zh/renderers/shaders/ShaderChunk.html
+++ b/docs/api/zh/renderers/shaders/ShaderChunk.html
@@ -10,19 +10,19 @@
[name]
- Shader chunks for WebGL Shader library
+ WebGL着色器库的着色器片段
- Properties
+ 属性
- Methods
+ 方法
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/shaders/ShaderLib.html b/docs/api/zh/renderers/shaders/ShaderLib.html
index d363e2e5da52a8..8144f0fb201847 100644
--- a/docs/api/zh/renderers/shaders/ShaderLib.html
+++ b/docs/api/zh/renderers/shaders/ShaderLib.html
@@ -10,18 +10,18 @@
[name]
- Webgl Shader Library for three.js
+ three.js的WebGL着色器库
- Properties
+ 属性
- Methods
+ 方法
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/shaders/UniformsLib.html b/docs/api/zh/renderers/shaders/UniformsLib.html
index f8228941c52b56..491b4bd9c30af1 100644
--- a/docs/api/zh/renderers/shaders/UniformsLib.html
+++ b/docs/api/zh/renderers/shaders/UniformsLib.html
@@ -10,19 +10,19 @@
[name]
- Uniforms library for shared webgl shaders
+ 为webgl着色器提供的Uniforms库
- Properties
+ 属性
- Methods
+ 方法
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/shaders/UniformsUtils.html b/docs/api/zh/renderers/shaders/UniformsUtils.html
index bf978cbbb89229..4bfc3890a5674b 100644
--- a/docs/api/zh/renderers/shaders/UniformsUtils.html
+++ b/docs/api/zh/renderers/shaders/UniformsUtils.html
@@ -10,17 +10,17 @@
[name]
- Uniform Utilities. Support merging and cloning of uniform variables
+ Uniform工具. 支持uniform变量的合并和克隆
- Properties
+ 属性
- Methods
+ 方法
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/webgl/WebGLProgram.html b/docs/api/zh/renderers/webgl/WebGLProgram.html
index 14abf7cec03bde..1d74cecc5cd6e1 100644
--- a/docs/api/zh/renderers/webgl/WebGLProgram.html
+++ b/docs/api/zh/renderers/webgl/WebGLProgram.html
@@ -10,11 +10,11 @@
[name]
- Constructor for the GLSL program sent to vertex and fragment shaders, including default uniforms and attributes.
+ 发送到顶点着色器和片元着色器的GLSL程序的构造函数, 包含默认的变量(uniforms)和属性
- Built-in uniforms and attributes
+ 内置的变量(uniforms)和属性
- Vertex shader (unconditional):
+ 顶点着色器(无条件的):
// = object.matrixWorld
@@ -42,18 +42,18 @@ Vertex shader (unconditional):
attribute vec2 uv;
- Note that you can therefore calculate the position of a vertex in the vertex shader by:
+ 注意,可以通过以下方式计算顶点着色器中顶点的位置:
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
- or alternatively
+ 或者也可以这样:
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 );
- Vertex shader (conditional):
+ 顶点着色器(有条件的):
#ifdef USE_COLOR
@@ -94,7 +94,7 @@ Vertex shader (conditional):
- Fragment shader:
+ 片元着色器:
uniform mat4 viewMatrix;
@@ -103,12 +103,12 @@ Fragment shader:
- Constructor
+ 构造器
[name]( [param:WebGLRenderer renderer], [param:Object code], [param:Material material], [param:Object parameters] )
- For parameters see [page:WebGLRenderer WebGLRenderer]
+ 参数详见[page:WebGLRenderer WebGLRenderer]
- Properties
+ 属性
[property:String id]
@@ -128,19 +128,19 @@ [property:WebGLShader vertexShader]
[property:WebGLShader fragmentShader]
- Methods
+ 方法
[method:Object getUniforms]()
- Returns a name-value mapping of all active uniform locations.
+ 返回所有活动态的变量(uniform)位置的name-value映射
[method:Object getAttributes]()
- Returns a name-value mapping of all active vertex attribute locations.
+ 返回所有活动态的顶点属性位置的name-value映射
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/webgl/WebGLShader.html b/docs/api/zh/renderers/webgl/WebGLShader.html
index 92f4079e5745f8..b77070287a8087 100644
--- a/docs/api/zh/renderers/webgl/WebGLShader.html
+++ b/docs/api/zh/renderers/webgl/WebGLShader.html
@@ -10,9 +10,9 @@
[name]
- A lower level function to compile either a vertex or fragment shader.
+ 编译顶点或片元着色器的更底层的函数
- Example
+ 示例
var gl = renderer.context;
@@ -28,21 +28,22 @@ Example
gl.linkProgram( program );
- Function
+ 函数
[page:WebGLShader objects]([page:WebGLContext gl], [page:WebGLEnum type], [page:String source])
- gl -- The current WebGL context
- type -- The WebGL type, either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER
- source -- The source code for the shader
+ gl -- 当前的WebGL环境
+ type -- WebGL类型,值是gl.VERTEX_SHADER 或者 gl.FRAGMENT_SHADER
+ source -- 着色器源码
- This will compile an individual shader, but won't link it to be a complete [page:WebGLProgram]. Note: this
- is a function so the new operator should not be used.
+ 此函数将编译一个独立的着色器,不会将它和一个完整的[page:WebGLProgram]链接起来。
+ 说明: 这是一个函数,因此不应该使用新的操作符。
+
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/renderers/webgl/WebGLState.html b/docs/api/zh/renderers/webgl/WebGLState.html
index 2d8a34ada4093e..b6e2ef1acebd1f 100644
--- a/docs/api/zh/renderers/webgl/WebGLState.html
+++ b/docs/api/zh/renderers/webgl/WebGLState.html
@@ -13,47 +13,47 @@ [name]
- Methods
+ 方法
[method:null enable]( [param:integer id], [param:boolean boolean] )
- TODO
+ 未完成
[method:null disable]( [param:integer id], [param:boolean boolean] )
- TODO
+ 未完成
[method:null setDepthTest]( [param:boolean depthTest] )
- depthTest -- The boolean to decide if depth of a fragment needs to be tested against the depth buffer .
+ depthTest -- 决定是否需要基于深度缓存对片元进行深度测试的布尔值
- This sets, based on depthTest, whether or not the depth data needs to be tested against the depth buffer.
+ 该方法设置了depthTest的值,故可决定是否需要基于深度缓存测试深度数据
[method:null setDepthWrite]( [param:boolean depthWrite] )
- depthWrite -- The boolean to decide if depth of a fragment needs to be kept.
+ depthWrite -- 决定是否需要保持片元深度的布尔值
- This sets, based on depthWrite, whether or not the depth data needs to be written in the depth buffer.
+ 该方法设置depthWrite的值,故可决定是否要将深度数据写入深度缓存中
[method:null setBlending]( [param:number blending], [param:number blendEquation], [param:number blendSrc], [param:number blendDst] )
- blending -- A number indicating the blending mode. Possible value are THREE.NoBlending, THREE.NormalBlending, THREE.AdditiveBlending, THREE.SubtractiveBlending, THREE.MultiplyBlending or THREE.CustomBlending
- blendEquation -- When blending is THREE.CustomBlending, then you can set the blendEquation. Possible values are THREE.AddEquation, THREE.SubtractEquation or THREE.ReverseSubtractEquation.
- blendSrc -- When blending is THREE.CustomBlending, then you can set the blendSrc. Possible values are THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor or THREE.SrcAlphaSaturateFactor
- blendDst -- When blending is THREE.CustomBlending, then you can set the blendDst. Possible values are THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor or THREE.SrcAlphaSaturateFactor
+ blending -- 一个表示混合模式的数字。可能的值有THREE.NoBlending, THREE.NormalBlending, THREE.AdditiveBlending, THREE.SubtractiveBlending, THREE.MultiplyBlending 和 THREE.CustomBlending
+ blendEquation -- 如果blending的值是THREE.CustomBlending,那么你可以设置blendEquation. 可能的值有THREE.AddEquation, THREE.SubtractEquation 和 THREE.ReverseSubtractEquation.
+ blendSrc -- 如果blending的值是THREE.CustomBlending, 那么你可以设置blendSrc.可能的值有THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor 和 THREE.SrcAlphaSaturateFactor
+ blendDst -- 如果blending的值是THREE.CustomBlending, 那么你可以设置blendDst. 可能的值有THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor or THREE.SrcAlphaSaturateFactor
- This method sets the correct blending.
+ 该方法设置正确的混合
- Source
+ 源码
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
diff --git a/docs/api/zh/scenes/Fog.html b/docs/api/zh/scenes/Fog.html
index 59c2e47658ef8a..d9a52a36ea2692 100644
--- a/docs/api/zh/scenes/Fog.html
+++ b/docs/api/zh/scenes/Fog.html
@@ -19,6 +19,7 @@ 构造器
[name]( [param:Integer color], [param:Float near], [param:Float far] )
颜色参数传入[page:Color]构造函数中,来设置颜色属性。颜色可以是一个十六进制的整型数,或者是CSS风格的字符串。
+
属性
[property:String name]
diff --git a/docs/api/zh/textures/DataTexture3D.html b/docs/api/zh/textures/DataTexture3D.html
new file mode 100644
index 00000000000000..9282d671931d10
--- /dev/null
+++ b/docs/api/zh/textures/DataTexture3D.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+ [page:Texture] →
+
+ [name]
+
+ Creates a three-dimensional texture. This type of texture can only be used with a WebGL 2 rendering context.
+
+ Constructor
+
+ [name]( [param:TypedArray data], [param:Number width], [param:Number height], [param:Number depth] )
+
+ [page:Object data] -- data of the texture.
+
+ [page:Number width] -- width of the texture.
+
+ [page:Number height] -- height of the texture.
+
+ [page:Number depth] -- depth of the texture.
+
+
+ Example
+
+ [example:webgl2_materials_texture3d WebGL2 / materials / texture3d]
+ [example:webgl2_materials_texture3d_volume WebGL2 / materials / texture3d / volume]
+
+ Properties
+
+
+ See the base [page:Texture Texture] class for common properties.
+
+
+ Methods
+
+
+ See the base [page:Texture Texture] class for common methods.
+
+
+ Source
+
+ [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+
+
diff --git a/docs/list.js b/docs/list.js
index 0327f2b077f12f..c0ce3fc38b25cd 100644
--- a/docs/list.js
+++ b/docs/list.js
@@ -332,6 +332,7 @@ var list = {
"CompressedTexture": "api/en/textures/CompressedTexture",
"CubeTexture": "api/en/textures/CubeTexture",
"DataTexture": "api/en/textures/DataTexture",
+ "DataTexture3D": "api/en/textures/DataTexture3D",
"DepthTexture": "api/en/textures/DepthTexture",
"Texture": "api/en/textures/Texture",
"VideoTexture": "api/en/textures/VideoTexture"
@@ -756,6 +757,7 @@ var list = {
"CompressedTexture": "api/zh/textures/CompressedTexture",
"CubeTexture": "api/zh/textures/CubeTexture",
"DataTexture": "api/zh/textures/DataTexture",
+ "DataTexture3D": "api/en/textures/DataTexture3D",
"DepthTexture": "api/zh/textures/DepthTexture",
"Texture": "api/zh/textures/Texture",
"VideoTexture": "api/zh/textures/VideoTexture"
diff --git a/docs/manual/en/introduction/Animation-system.html b/docs/manual/en/introduction/Animation-system.html
index 61a74474b292ae..da5941b63f167e 100644
--- a/docs/manual/en/introduction/Animation-system.html
+++ b/docs/manual/en/introduction/Animation-system.html
@@ -52,13 +52,13 @@ Keyframe Tracks
Inside of such an *AnimationClip* the data for each animated property are stored in a
- separate [page:KeyframeTrack]. Assumed a character object has a [page:Skeleton skeleton],
+ separate [page:KeyframeTrack]. Assuming a character object has a [page:Skeleton skeleton],
one keyframe track could store the data for the position changes of the lower arm bone
over time, a different track the data for the rotation changes of the same bone, a third
the track position, rotation or scaling of another bone, and so on. It should be clear,
that an AnimationClip can be composed of lots of such tracks.
- Assumed the model has [page:Geometry.morphTargets morph targets] (for example one morph
+ Assuming the model has [page:Geometry.morphTargets morph targets] (for example one morph
target showing a friendly face and another showing an angry face), each track holds the
information as to how the [page:Mesh.morphTargetInfluences influence] of a certain morph
target changes during the performance of the clip.
@@ -69,7 +69,7 @@
Animation Mixer
- The stored data form only the basis for the animations - actual playback is controlled by
+ The stored data forms only the basis for the animations - actual playback is controlled by
the [page:AnimationMixer]. You can imagine this not only as a player for animations, but
as a simulation of a hardware like a real mixer console, which can control several animations
simultaneously, blending and merging them.
diff --git a/docs/manual/zh/introduction/WebGL-compatibility-check.html b/docs/manual/zh/introduction/WebGL-compatibility-check.html
index 2ab8572312fb06..b203cb0e988e3d 100644
--- a/docs/manual/zh/introduction/WebGL-compatibility-check.html
+++ b/docs/manual/zh/introduction/WebGL-compatibility-check.html
@@ -14,15 +14,15 @@
WebGL兼容性检查([name])
- 请将[link:https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js]引入到你的文件,并在尝试开始渲染之前先运行该文件。
+ 请将[link:https://github.com/mrdoob/three.js/blob/master/examples/js/WebGL.js]引入到你的文件,并在尝试开始渲染之前先运行该文件。
-if (Detector.webgl) {
+if (WEBGL.isWebGLAvailable()) {
// Initiate function or other initializations here
animate();
} else {
- var warning = Detector.getWebGLErrorMessage();
+ var warning = WEBGL.getWebGLErrorMessage();
document.getElementById('container').appendChild(warning);
}
diff --git a/editor/js/Loader.js b/editor/js/Loader.js
index 1357e067ff13aa..30b7c4841e848f 100644
--- a/editor/js/Loader.js
+++ b/editor/js/Loader.js
@@ -626,7 +626,7 @@ var Loader = function ( editor ) {
case 'object':
var loader = new THREE.ObjectLoader();
- loader.setTexturePath( scope.texturePath );
+ loader.setResourcePath( scope.texturePath );
var result = loader.parse( data );
diff --git a/examples/files.js b/examples/files.js
index 640ca3900fb8ad..9dadbd2a2c34a6 100644
--- a/examples/files.js
+++ b/examples/files.js
@@ -42,10 +42,6 @@ var files = {
"webgl_geometry_terrain_raycast",
"webgl_geometry_text",
"webgl_geometry_text_shapes",
- "webgl_gpgpu_birds",
- "webgl_gpgpu_water",
- "webgl_gpgpu_protoplanet",
- "webgl_gpu_particle_system",
"webgl_hdr",
"webgl_helpers",
"webgl_interactive_buffergeometry",
@@ -300,6 +296,10 @@ var files = {
"webgl_custom_attributes_points",
"webgl_custom_attributes_points2",
"webgl_custom_attributes_points3",
+ "webgl_gpgpu_birds",
+ "webgl_gpgpu_water",
+ "webgl_gpgpu_protoplanet",
+ "webgl_gpu_particle_system",
"webgl_materials_modified",
"webgl_raymarching_reflect",
"webgl_shadowmap_pcss",
@@ -325,6 +325,7 @@ var files = {
"webvr_ballshooter",
"webvr_cubes",
"webvr_dragging",
+ "webvr_frustum",
"webvr_lorenzattractor",
"webvr_panorama",
"webvr_paint",
diff --git a/examples/js/loaders/DRACOLoader.js b/examples/js/loaders/DRACOLoader.js
index c4c795f14bc22b..091615bf02d7dc 100644
--- a/examples/js/loaders/DRACOLoader.js
+++ b/examples/js/loaders/DRACOLoader.js
@@ -236,7 +236,7 @@ THREE.DRACOLoader.prototype = {
}
var dracoGeometry;
var decodingStatus;
- const start_time = performance.now();
+ var start_time = performance.now();
if (geometryType === dracoDecoder.TRIANGULAR_MESH) {
dracoGeometry = new dracoDecoder.Mesh();
decodingStatus = decoder.DecodeBufferToMesh(buffer, dracoGeometry);
diff --git a/examples/js/loaders/EXRLoader.js b/examples/js/loaders/EXRLoader.js
index 528c651c0a1420..c7bb432e5a058c 100644
--- a/examples/js/loaders/EXRLoader.js
+++ b/examples/js/loaders/EXRLoader.js
@@ -929,7 +929,12 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
'RLE_COMPRESSION',
'ZIPS_COMPRESSION',
'ZIP_COMPRESSION',
- 'PIZ_COMPRESSION'
+ 'PIZ_COMPRESSION',
+ 'PXR24_COMPRESSION',
+ 'B44_COMPRESSION',
+ 'B44A_COMPRESSION',
+ 'DWAA_COMPRESSION',
+ 'DWAB_COMPRESSION'
];
var compression = parseUint8( dataView, offset );
@@ -1109,7 +1114,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
} else {
- throw 'Only supported pixel format is HALF';
+ throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.';
}
@@ -1151,7 +1156,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
} else {
- throw 'Only supported pixel format is HALF';
+ throw 'EXRLoader._parser: unsupported pixelType ' + EXRHeader.channels[ channelID ].pixelType + '. Only pixelType is 1 (HALF) is supported.';
}
@@ -1163,7 +1168,7 @@ THREE.EXRLoader.prototype._parser = function ( buffer ) {
} else {
- throw 'Cannot decompress unsupported compression';
+ throw 'EXRLoader._parser: ' + EXRHeader.compression + ' is unsupported';
}
diff --git a/examples/js/loaders/FBXLoader.js b/examples/js/loaders/FBXLoader.js
index 6a45c314bc8a17..aad891744d77cd 100644
--- a/examples/js/loaders/FBXLoader.js
+++ b/examples/js/loaders/FBXLoader.js
@@ -777,13 +777,11 @@ THREE.FBXLoader = ( function () {
if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return;
- var targetRelationships = connections.get( parseInt( child.ID ) );
+ rawMorphTarget.geoID = connections.get( parseInt( child.ID ) ).children.filter( function ( child ) {
- targetRelationships.children.forEach( function ( child ) {
+ return child.relationship === undefined;
- if ( child.relationship === undefined ) rawMorphTarget.geoID = child.ID;
-
- } );
+ } )[ 0 ].ID;
rawMorphTargets.push( rawMorphTarget );
@@ -2488,62 +2486,62 @@ THREE.FBXLoader = ( function () {
if ( layerCurveNodes[ i ] === undefined ) {
- var modelID;
+ var modelID = connections.get( child.ID ).parents.filter( function ( parent ) {
- connections.get( child.ID ).parents.forEach( function ( parent ) {
+ return parent.relationship !== undefined;
- if ( parent.relationship !== undefined ) modelID = parent.ID;
+ } )[ 0 ].ID;
- } );
+ if ( modelID !== undefined ) {
- var rawModel = fbxTree.Objects.Model[ modelID.toString() ];
+ var rawModel = fbxTree.Objects.Model[ modelID.toString() ];
- var node = {
+ var node = {
- modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
- ID: rawModel.id,
- initialPosition: [ 0, 0, 0 ],
- initialRotation: [ 0, 0, 0 ],
- initialScale: [ 1, 1, 1 ],
+ modelName: THREE.PropertyBinding.sanitizeNodeName( rawModel.attrName ),
+ ID: rawModel.id,
+ initialPosition: [ 0, 0, 0 ],
+ initialRotation: [ 0, 0, 0 ],
+ initialScale: [ 1, 1, 1 ],
- };
+ };
- sceneGraph.traverse( function ( child ) {
+ sceneGraph.traverse( function ( child ) {
- if ( child.ID = rawModel.id ) {
+ if ( child.ID = rawModel.id ) {
- node.transform = child.matrix;
+ node.transform = child.matrix;
- if ( child.userData.transformData ) node.eulerOrder = child.userData.transformData.eulerOrder;
+ if ( child.userData.transformData ) node.eulerOrder = child.userData.transformData.eulerOrder;
- }
+ }
- } );
+ } );
- if ( ! node.transform ) node.transform = new THREE.Matrix4();
+ if ( ! node.transform ) node.transform = new THREE.Matrix4();
- // if the animated model is pre rotated, we'll have to apply the pre rotations to every
- // animation value as well
- if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value;
- if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value;
+ // if the animated model is pre rotated, we'll have to apply the pre rotations to every
+ // animation value as well
+ if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value;
+ if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value;
- layerCurveNodes[ i ] = node;
+ layerCurveNodes[ i ] = node;
+
+ }
}
- layerCurveNodes[ i ][ curveNode.attr ] = curveNode;
+ if ( layerCurveNodes[ i ] ) layerCurveNodes[ i ][ curveNode.attr ] = curveNode;
} else if ( curveNode.curves.morph !== undefined ) {
if ( layerCurveNodes[ i ] === undefined ) {
- var deformerID;
+ var deformerID = connections.get( child.ID ).parents.filter( function ( parent ) {
- connections.get( child.ID ).parents.forEach( function ( parent ) {
+ return parent.relationship !== undefined;
- if ( parent.relationship !== undefined ) deformerID = parent.ID;
-
- } );
+ } )[ 0 ].ID;
var morpherID = connections.get( deformerID ).parents[ 0 ].ID;
var geoID = connections.get( morpherID ).parents[ 0 ].ID;
@@ -4003,7 +4001,7 @@ THREE.FBXLoader = ( function () {
lParentGRSM = lParentTM.getInverse( lParentTM ).multiply( lParentGX );
lParentGSM = lParentGRM.getInverse( lParentGRM ).multiply( lParentGRSM );
lLSM = lScalingM;
-
+
var lGlobalRS;
if ( inheritType === 0 ) {
diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js
index 860c7471893295..e6ee5c78d2ddf2 100644
--- a/examples/js/loaders/GLTFLoader.js
+++ b/examples/js/loaders/GLTFLoader.js
@@ -314,63 +314,61 @@ THREE.GLTFLoader = ( function () {
this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;
- this.lights = [];
-
var extension = ( json.extensions && json.extensions[ EXTENSIONS.KHR_LIGHTS_PUNCTUAL ] ) || {};
- var lightDefs = extension.lights || [];
+ this.lightDefs = extension.lights || [];
- for ( var i = 0; i < lightDefs.length; i ++ ) {
+ }
- var lightDef = lightDefs[ i ];
- var lightNode;
+ GLTFLightsExtension.prototype.loadLight = function ( lightIndex ) {
- var color = new THREE.Color( 0xffffff );
- if ( lightDef.color !== undefined ) color.fromArray( lightDef.color );
+ var lightDef = this.lightDefs[ lightIndex ];
+ var lightNode;
- var range = lightDef.range !== undefined ? lightDef.range : 0;
+ var color = new THREE.Color( 0xffffff );
+ if ( lightDef.color !== undefined ) color.fromArray( lightDef.color );
- switch ( lightDef.type ) {
+ var range = lightDef.range !== undefined ? lightDef.range : 0;
- case 'directional':
- lightNode = new THREE.DirectionalLight( color );
- lightNode.target.position.set( 0, 0, -1 );
- lightNode.add( lightNode.target );
- break;
+ switch ( lightDef.type ) {
- case 'point':
- lightNode = new THREE.PointLight( color );
- lightNode.distance = range;
- break;
+ case 'directional':
+ lightNode = new THREE.DirectionalLight( color );
+ lightNode.target.position.set( 0, 0, -1 );
+ lightNode.add( lightNode.target );
+ break;
- case 'spot':
- lightNode = new THREE.SpotLight( color );
- lightNode.distance = range;
- // Handle spotlight properties.
- lightDef.spot = lightDef.spot || {};
- lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
- lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
- lightNode.angle = lightDef.spot.outerConeAngle;
- lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
- lightNode.target.position.set( 0, 0, -1 );
- lightNode.add( lightNode.target );
- break;
+ case 'point':
+ lightNode = new THREE.PointLight( color );
+ lightNode.distance = range;
+ break;
- default:
- throw new Error( 'THREE.GLTFLoader: Unexpected light type, "' + lightDef.type + '".' );
+ case 'spot':
+ lightNode = new THREE.SpotLight( color );
+ lightNode.distance = range;
+ // Handle spotlight properties.
+ lightDef.spot = lightDef.spot || {};
+ lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
+ lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
+ lightNode.angle = lightDef.spot.outerConeAngle;
+ lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
+ lightNode.target.position.set( 0, 0, -1 );
+ lightNode.add( lightNode.target );
+ break;
- }
+ default:
+ throw new Error( 'THREE.GLTFLoader: Unexpected light type, "' + lightDef.type + '".' );
- lightNode.decay = 2;
+ }
- if ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;
+ lightNode.decay = 2;
- lightNode.name = lightDef.name || ( 'light_' + i );
+ if ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;
- this.lights.push( lightNode );
+ lightNode.name = lightDef.name || ( 'light_' + lightIndex );
- }
+ return Promise.resolve( lightNode );
- }
+ };
/**
* Unlit Materials Extension (pending)
@@ -1243,7 +1241,7 @@ THREE.GLTFLoader = ( function () {
/**
* @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry} object
- * @param {GLTF.definition} def
+ * @param {GLTF.definition} gltfDef
*/
function assignExtrasToUserData( object, gltfDef ) {
@@ -1268,9 +1266,10 @@ THREE.GLTFLoader = ( function () {
*
* @param {THREE.BufferGeometry} geometry
* @param {Array} targets
- * @param {Array} accessors
+ * @param {GLTFParser} parser
+ * @return {Promise}
*/
- function addMorphTargets( geometry, targets, accessors ) {
+ function addMorphTargets( geometry, targets, parser ) {
var hasMorphPosition = false;
var hasMorphNormal = false;
@@ -1286,97 +1285,127 @@ THREE.GLTFLoader = ( function () {
}
- if ( ! hasMorphPosition && ! hasMorphNormal ) return;
+ if ( ! hasMorphPosition && ! hasMorphNormal ) return Promise.resolve( geometry );
- var morphPositions = [];
- var morphNormals = [];
+ var pendingPositionAccessors = [];
+ var pendingNormalAccessors = [];
for ( var i = 0, il = targets.length; i < il; i ++ ) {
var target = targets[ i ];
- var attributeName = 'morphTarget' + i;
if ( hasMorphPosition ) {
- // Three.js morph position is absolute value. The formula is
- // basePosition
- // + weight0 * ( morphPosition0 - basePosition )
- // + weight1 * ( morphPosition1 - basePosition )
- // ...
- // while the glTF one is relative
- // basePosition
- // + weight0 * glTFmorphPosition0
- // + weight1 * glTFmorphPosition1
- // ...
- // then we need to convert from relative to absolute here.
+ var accessor = target.POSITION !== undefined
+ ? parser.getDependency( 'accessor', target.POSITION )
+ .then( function ( accessor ) {
+ // Cloning not to pollute original accessor below
+ return cloneBufferAttribute( accessor );
+ } )
+ : geometry.attributes.position;
- if ( target.POSITION !== undefined ) {
+ pendingPositionAccessors.push( accessor );
- // Cloning not to pollute original accessor
- var positionAttribute = cloneBufferAttribute( accessors[ target.POSITION ] );
- positionAttribute.name = attributeName;
+ }
- var position = geometry.attributes.position;
+ if ( hasMorphNormal ) {
- for ( var j = 0, jl = positionAttribute.count; j < jl; j ++ ) {
+ var accessor = target.NORMAL !== undefined
+ ? parser.getDependency( 'accessor', target.NORMAL )
+ .then( function ( accessor ) {
+ return cloneBufferAttribute( accessor );
+ } )
+ : geometry.attributes.normal;
- positionAttribute.setXYZ(
- j,
- positionAttribute.getX( j ) + position.getX( j ),
- positionAttribute.getY( j ) + position.getY( j ),
- positionAttribute.getZ( j ) + position.getZ( j )
- );
+ pendingNormalAccessors.push( accessor );
- }
+ }
- } else {
+ }
- positionAttribute = geometry.attributes.position;
+ return Promise.all( [
+ Promise.all( pendingPositionAccessors ),
+ Promise.all( pendingNormalAccessors )
+ ] ).then( function ( accessors ) {
- }
+ var morphPositions = accessors[ 0 ];
+ var morphNormals = accessors[ 1 ];
- morphPositions.push( positionAttribute );
+ for ( var i = 0, il = targets.length; i < il; i ++ ) {
- }
+ var target = targets[ i ];
+ var attributeName = 'morphTarget' + i;
- if ( hasMorphNormal ) {
+ if ( hasMorphPosition ) {
- // see target.POSITION's comment
+ // Three.js morph position is absolute value. The formula is
+ // basePosition
+ // + weight0 * ( morphPosition0 - basePosition )
+ // + weight1 * ( morphPosition1 - basePosition )
+ // ...
+ // while the glTF one is relative
+ // basePosition
+ // + weight0 * glTFmorphPosition0
+ // + weight1 * glTFmorphPosition1
+ // ...
+ // then we need to convert from relative to absolute here.
- var normalAttribute;
+ if ( target.POSITION !== undefined ) {
- if ( target.NORMAL !== undefined ) {
+ var positionAttribute = morphPositions[ i ];
+ positionAttribute.name = attributeName;
- var normalAttribute = cloneBufferAttribute( accessors[ target.NORMAL ] );
- normalAttribute.name = attributeName;
+ var position = geometry.attributes.position;
- var normal = geometry.attributes.normal;
+ for ( var j = 0, jl = positionAttribute.count; j < jl; j ++ ) {
- for ( var j = 0, jl = normalAttribute.count; j < jl; j ++ ) {
+ positionAttribute.setXYZ(
+ j,
+ positionAttribute.getX( j ) + position.getX( j ),
+ positionAttribute.getY( j ) + position.getY( j ),
+ positionAttribute.getZ( j ) + position.getZ( j )
+ );
- normalAttribute.setXYZ(
- j,
- normalAttribute.getX( j ) + normal.getX( j ),
- normalAttribute.getY( j ) + normal.getY( j ),
- normalAttribute.getZ( j ) + normal.getZ( j )
- );
+ }
}
- } else {
+ }
- normalAttribute = geometry.attributes.normal;
+ if ( hasMorphNormal ) {
- }
+ // see target.POSITION's comment
+
+ if ( target.NORMAL !== undefined ) {
+
+ var normalAttribute = morphNormals[ i ];
+ normalAttribute.name = attributeName;
- morphNormals.push( normalAttribute );
+ var normal = geometry.attributes.normal;
+
+ for ( var j = 0, jl = normalAttribute.count; j < jl; j ++ ) {
+
+ normalAttribute.setXYZ(
+ j,
+ normalAttribute.getX( j ) + normal.getX( j ),
+ normalAttribute.getY( j ) + normal.getY( j ),
+ normalAttribute.getZ( j ) + normal.getZ( j )
+ );
+
+ }
+
+ }
+
+ }
}
- }
+ if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
+ if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
- if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
- if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
+ return geometry;
+
+ } );
}
@@ -1692,7 +1721,7 @@ THREE.GLTFLoader = ( function () {
* Requests the specified dependency asynchronously, with caching.
* @param {string} type
* @param {number} index
- * @return {Promise