Jelajahi Sumber

translate zh:intro/How to update things,Matrix transformations,Animation system

wangyang65 6 tahun lalu
induk
melakukan
1171905df8

+ 48 - 68
docs/manual/zh/introduction/Animation-system.html

@@ -10,100 +10,80 @@
 	<body>
 		<h1>[name]</h1>
 
-		<h2>Overview</h2>
+		<h2>Overview(概述)</h2>
 
 		<p class="desc">
-			Within the three.js animation system you can animate various properties of your models:
-			the bones of a [page:SkinnedMesh skinned and rigged model],
-			[page:Geometry.morphTargets morph targets], different material properties (colors,
-			opacity, booleans), visibility and transforms. The animated properties can be faded in,
-			faded out, crossfaded and warped. The weight and time scales of different simultaneous
-			animations on the same object as well as on different objects can be changed
-			independently. Various animations on the same and on different objects can be
-			synchronized.<br /><br />
-
-			To achieve all this in one homogeneous system, the three.js animation system
-			[link:https://github.com/mrdoob/three.js/issues/6881 has completely changed in 2015]
-			(be aware of outdated information!), and it has now an architecture similar to
-			Unity/Unreal Engine 4. This page gives a short overview of the main components of the
-			system and how they work together.
-
+			在three.js动画系统中,您可以为模型的各种属性设置动画:
+			[page:SkinnedMesh 蒙皮和装配模型]的骨头,[page:Geometry.morphTargets 变形目标],不同的材料属性(颜色,
+			不透明度,布尔运算),可见性和变换。 动画属性可以淡入,淡出,交叉淡化和扭曲。 不同时间的重量和时间尺度
+			可以更改同一对象以及不同对象上的动画独立。 可以在相同和不同对象上进行各种动画同步。
+			<br /><br />
+			在一个同构系统中实现所有这一切,即three.js动画系统
+			[link:https://github.com/mrdoob/three.js/issues/6881在2015年彻底改变]
+			(注意过时的信息!),它现在有一个与Unity /虚幻引擎4类似的架构.此页面简要概述了主要组件系统以及它们如何协同工作。
 		</p>
 
-		<h3>Animation Clips</h3>
+		<h3>Animation Clips(动画片段)</h3>
 
 		<p class="desc">
-
-			If you have successfully imported an animated 3D object (it doesn't matter if it has
-			bones or morph targets or both) — for example exporting it from Blender with the
-			[link:https://github.com/KhronosGroup/glTF-Blender-Exporter glTF Blender exporter] and
-			loading it into a three.js scene using [page:GLTFLoader] — one of the response fields
-			should be an array named "animations", containing the [page:AnimationClip AnimationClips]
-			for this model (see a list of possible loaders below).<br /><br />
-
-			Each *AnimationClip* usually holds the data for a certain activity of the object. If the
-			mesh is a character, for example, there may be one AnimationClip for a walkcycle, a second
-			for a jump, a third for sidestepping and so on.
-
+			如果您已成功导入动画3D对象(如果有,则无关紧要)
+			骨骼或变形目标或两者) - 例如使用[link:https://github.com/KhronosGroup/glTF-Blender-Exporter glTF Blender导出器]从Blender导出它
+			使用[page:GLTFLoader]将其加载到three.js场景中 - 其中一个响应字段应该是一个名为“animations”的数组,其中包含此模型的[page:AnimationClip AnimationClips](请参阅下面的可能加载器列表)。
+			<br /><br />
+			每个* AnimationClip *通常保存对象的某个活动的数据。 如果
+			mesh是一个字符,例如,可以有一个用于walkcycle的动画片段,第二个
+			跳跃,三分之一的回避等等。		
 		</p>
 
-		<h3>Keyframe Tracks</h3>
+		<h3>Keyframe Tracks(关键帧轨道)</h3>
 
 		<p class="desc">
-
-			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],
-			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.<br /><br />
-
-			Assumed 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.
-
+			在这样的* AnimationClip *里面,每个动画属性的数据都存储在一个
+			单独[page:KeyframeTrack]。 假设一个角色对象有一个[page:Skeleton skeleton],
+			一个关键帧轨道可以存储下臂骨骼位置变化的数据
+			随着时间的推移,不同的轨道数据为同一骨骼的旋转变化,三分之一
+			轨道位置,旋转或缩放另一个骨骼,等等。 应该很清楚,
+			AnimationClip可以由许多这样的轨道组成。
+			.<br /><br />
+			假设模型具有[page:Geometry.morphTargets 变形目标](例如一个变形
+			目标显示一个友好的面孔,另一个显示愤怒的脸),每个轨道持有
+			关于某个变形的[page:Mesh.morphTargetInfluences 影响]的信息
+			目标在剪辑执行期间发生变化。
 		</p>
 
-		<h3>Animation Mixer</h3>
+		<h3>Animation Mixer(动画混音器)</h3>
 
 		<p class="desc">
-
-			The stored data form 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.
-
+			存储的数据仅构成动画的基础 - 实际播放由控制
+			[page:AnimationMixer]。 你可以想象这不仅仅是动画的播放器,而是
+			作为硬件的模拟,如真正的调音台控制台,可以控制几个动画
+			同时,混合和合并它们。
 		</p>
 
 		<h3>Animation Actions</h3>
 
 		<p class="desc">
-
-			The *AnimationMixer* itself has only very few (general) properties and methods, because it
-			can be controlled by the [page:AnimationAction AnimationActions]. By configuring an
-			*AnimationAction* you can determine when a certain *AnimationClip* shall be played, paused
-			or stopped on one of the mixers, if and how often the clip has to be repeated, whether it
-			shall be performed with a fade or a time scaling, and some additional things, such crossfading
-			or synchronizing.
-
+			* AnimationMixer *本身只有很少(通用)属性和方法,因为它
+			可以通过[page:AnimationAction AnimationActions]来控制。 通过配置
+			* AnimationAction *您可以确定何时播放某个* AnimationClip *,暂停
+			或者停在其中一个混音器上,是否以及频率必须重复,无论是否
+			应使用淡入淡出或时间缩放以及一些其他内容(例如交叉渐变)来执行
+			或同步。
 		</p>
 
-		<h3>Animation Object Groups</h3>
+		<h3>Animation Object Groups(动画对象组)</h3>
 
 		<p class="desc">
-
-			If you want a group of objects to receive a shared animation state, you can use an
-			[page:AnimationObjectGroup].
+				如果您希望一组对象接收共享动画状态,则可以使用[page:AnimationObjectGroup].
 
 		</p>
 
-		<h3>Supported Formats and Loaders</h3>
+		<h3>Supported Formats and Loaders(支持的格式和加载器)</h3>
 
 		<p class="desc">
-			Note that not all model formats include animation (OBJ notably does not), and that only some
-			three.js loaders support [page:AnimationClip AnimationClip] sequences. Several that <i>do</i>
-			support this animation type:
+			请注意,并非所有模型格式都包含动画(尤其是OBJ,没有),而且只有一些
+			three.js加载器支持[page:AnimationClip AnimationClip]序列。 以下几个<i>确实</ i>
+			支持此动画类型:		
 		</p>
 
 			<ul>
@@ -118,8 +98,8 @@
 			</ul>
 
 		<p class="desc">
-			Note that 3ds max and Maya currently can't export multiple animations (meaning animations which are not
-			on the same timeline) directly to a single file.
+			请注意,3ds max和Maya当前无法导出多个动画(这意味着动画不是
+			在同一时间线上)直接到一个文件。
 		</p>
 
 		<h2>Example</h2>

+ 43 - 49
docs/manual/zh/introduction/How-to-update-things.html

@@ -10,12 +10,12 @@
 	<body>
 		<h1>[name]</h1>
 		<div>
-			<p>All objects by default automatically update their matrices if they have been added to the scene with</p>
+			<p>默认情况下,所有对象都会自动更新它们的矩阵(如果它们已添加到场景中)</p>
 			<code>
 var object = new THREE.Object3D();
 scene.add( object );
 			</code>
-			or if they are the child of another object that has been added to the scene:
+			或者它们是已添加到场景中的另一个对象的子节点:
 			<code>
 var object1 = new THREE.Object3D();
 var object2 = new THREE.Object3D();
@@ -25,38 +25,34 @@ scene.add( object1 ); //object1 and object2 will automatically update their matr
 			</code>
 		</div>
 
-		<p>However, if you know object will be static, you can disable this and update the transform matrix manually just when needed.</p>
+		<p>但是,如果你知道对象将是静态的,则可以禁用此选项并在需要时手动更新转换矩阵。</p>
 
 		<code>
 object.matrixAutoUpdate  = false;
 object.updateMatrix();
 		</code>
 
-		<h2>Geometries</h2>
+		<h2>Geometries(几何形状)</h2>
 		<div>
 			<h3>[page:BufferGeometry]</h3>
 			<div>
 				<p>
-					BufferGeometries store information (such as vertex positions, face indices, normals, colors,
-					UVs, and any custom attributes) in [page:BufferAttribute buffers] - that is,
+					BufferGeometries 将信息(例如顶点位置,面索引,法线,颜色,uv和任何自定义属性) 存储在 [page:BufferAttribute buffers] - 也就是,
 					[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays typed arrays].
-					This makes them generally faster than standard Geometries, at the cost of being somewhat harder to
-					work with.
+					这使得它们通常比标准Geometries更快,缺点是更难用。
 				</p>
 				<p>
-					With regards to updating BufferGeometries, the most important thing to understand is that
-					you cannot resize buffers (this is very costly,	basically the equivalent to creating a new geometry).
-					You can however update the content of buffers.
+					关于更新BufferGeometries, 最重要的是理解你不能调整 buffers 大小(这种操作开销很大,	相当于创建了个新的geometry).
+					但你可以更新 buffers的内容.
 				</p>
 				<p>
-					This means that if you know an attribute of your BufferGeometry will grow, say the number of vertices,
-					you must pre-allocate a buffer large enough to hold any new vertices that may be created. Of
-					course, this also means that there will be a maximum size for your BufferGeometry - there is
-					no way to create a BufferGeometry that can efficiently be extended indefinitely.
+					这意味着如果你知道BufferGeometry的一个属性会增长,比如顶点的数量,
+					你必须预先分配足够大的buffer来容纳可能创建的任何新顶点。
+					当然,这也意味着BufferGeometry将有一个最大大小 - 无法创建一个可以高效地无限扩展的BufferGeometry。
 				</p>
 				<p>
-					We'll use the example of a line that gets extended at render time. We'll allocate space
-					in the buffer for 500 vertices but draw only two at first, using [page:BufferGeometry.drawRange].
+					我们以在渲染时扩展的line来示例。我们将分配可容纳500个顶点的空间但起初仅绘制2个,使用
+					在500个顶点的缓冲区中,但首先只使用 [page:BufferGeometry.drawRange].
 				</p>
 				<code>
 var MAX_POINTS = 500;
@@ -80,7 +76,7 @@ var line = new THREE.Line( geometry,  material );
 scene.add( line );
 				</code>
 			 	<p>
-					Next we'll randomly add points to the line using a pattern like:
+					然后我们随机增加顶点到line中,以这样的一种方式:
 				</p>
 				<code>
 var positions = line.geometry.attributes.position.array;
@@ -101,21 +97,20 @@ for ( var i = 0, l = MAX_POINTS; i < l; i ++ ) {
 }
 				</code>
 				<p>
-					If you want to change the <em>number of points</em> rendered after the first render, do this:
+					如果要更改第一次渲染后渲染的<em>点数</em>,执行以下操作:
 				</p>
 				<code>
 line.geometry.setDrawRange( 0, newValue );
 				</code>
 				<p>
-					If you want to change the position data values after the first render, you need to
-					set the needsUpdate flag like so:
+					如果要在第一次渲染后更改position数值,则需要像这样设置needsUpdate标志:
 				</p>
 				<code>
 line.geometry.attributes.position.needsUpdate = true; // required after the first render
 				</code>
 
 				<p>
-					[link:http://jsfiddle.net/w67tzfhx/ Here is a fiddle] showing an animated line which you can adapt to your use case.
+					[link:http://jsfiddle.net/w67tzfhx/ 这个fiddle] 展示了一个你可以参考的运动的line.
 				</p>
 
 				<h3>Examples:</h3>
@@ -128,11 +123,10 @@ line.geometry.attributes.position.needsUpdate = true; // required after the firs
 			<h3>[page:Geometry]</h3>
 			<div>
 				<p>
-					The following flags control updating of various geometry attributes. Set flags only
-					for attributes that you need to update, updates are costly. Once buffers
-					change, these flags reset automatically back to false. You need to keep setting them to
-					true if you want to keep updating buffers. Note that this applies only to [page:Geometry]
-					and not to [page:BufferGeometry].
+					以下标志控制各种geometry属性的更新. 仅对于需要更新的属性设置标志
+					,因为更新成本很高. 一旦buffers
+					改变, 这些标志位会自动重置为false. 你需要保持这些设置为true,如果你想要持续更新buffers. 请注意这仅适用于[page:Geometry]
+					而不是 [page:BufferGeometry].
 				</p>
 				<code>
 var geometry = new THREE.Geometry();
@@ -146,8 +140,8 @@ geometry.tangentsNeedUpdate = true;
 				</code>
 
 				<p>
-					In versions prior to [link:https://github.com/mrdoob/three.js/releases/tag/r66 r66] meshes
-					additionally need the <em>dynamic</em> flag enabled (to keep internal typed arrays):
+					在早于 [link:https://github.com/mrdoob/three.js/releases/tag/r66 r66]版本中, meshes
+					需要额外设定 <em>dynamic</em> 标志true (为了维持内部的 typed arrays):
 				</p>
 
 				<code>
@@ -164,19 +158,19 @@ geometry.tangentsNeedUpdate = true;
 
 
 
-		<h2>Materials</h2>
+		<h2>Materials(材质)</h2>
 		<div>
-			<p>All uniforms values can be changed freely (e.g. colors, textures, opacity, etc), values are sent to the shader every frame.</p>
+			<p>所有uniforms值都可以自由改变 (e.g. colors, textures, opacity, etc), 这些数值在每帧都发给shader .</p>
 
-			<p>Also GLstate related parameters can change any time (depthTest, blending, polygonOffset, etc).</p>
+			<p>GL状态相关参数也可以随时改变 (depthTest, blending, polygonOffset, etc).</p>
 
-			<p>Flat / smooth shading is baked into normals. You need to reset normals buffer (see above).</p>
+			<p>平滑/平滑阴影被作到法线. 你需要重置法线 buffer (见上).</p>
 
-			<p>The following properties can't be easily changed at runtime (once the material is rendered at least once):</p>
+			<p>在运行时无法轻松更改以下属性 (一旦material被渲染了一次):</p>
 			<ul>
-				<li>numbers and types of uniforms</li>
-				<li>numbers and types of lights</li>
-				<li>presence or not of
+				<li>uniforms的数量和类型</li>
+				<li>lights的数量和类型</li>
+				<li>存在与否
 					<ul>
 						<li>texture</li>
 						<li>fog</li>
@@ -189,19 +183,19 @@ geometry.tangentsNeedUpdate = true;
 				</li>
 			</ul>
 
-			<p>Changes in these require building of new shader program. You'll need to set</p>
+			<p>这些变化需要建立新的shader程序. 你需要设置</p>
 			<code>material.needsUpdate = true</code>
 
-			<p>Bear in mind this might be quite slow and induce jerkiness in framerate (especially on Windows, as shader compilation is slower in DirectX than OpenGL).</p>
+			<p>请记住,这可能会非常缓慢并导致帧率的波动。 (特别是在Windows上,因为shader编译在directx中比opengl慢).</p>
 
-			<p>For smoother experience you can emulate changes in these features to some degree by having "dummy" values like zero intensity lights, white textures, or zero density fog.</p>
+			<p>为了获得更流畅的体验,您可以通过“虚拟”值(如零强度光,白色纹理或零密度雾)在一定程度上模拟这些功能的变化.</p>
 
-			<p>You can freely change the material used for geometry chunks, however you cannot change how an object is divided into chunks (according to face materials). </p>
+			<p>您可以自由更改用于几何块的材质,但是无法更改对象如何划分为块(根据面材料). </p>
 
-			<h3>If you need to have different configurations of materials during runtime:</h3>
-			<p>If the number of materials / chunks is small, you could pre-divide the object beforehand (e.g. hair / face / body / upper clothes / trousers for a human, front / sides / top / glass / tire / interior for a car). </p>
+			<h3>如果你需要在运行时使用不同的材料配置:</h3>
+			<p>如果材料/块的数量很少,您可以事先预先划分物体(例如,人的头发/脸部/身体/上衣/裤子,汽车的前部/侧面/顶部/玻璃/轮胎/内部). </p>
 
-			<p>If the number is large (e.g. each face could be potentially different), consider a different solution, such as using attributes / textures to drive different per-face look.</p>
+			<p>如果数量很大(例如,每个面可能有所不同),请考虑不同的解决方案,例如使用属性/纹理来驱动不同的每个面部外观。</p>
 
 			<h3>Examples:</h3>
 			[example:webgl_materials_cars WebGL / materials / cars]<br />
@@ -209,9 +203,9 @@ geometry.tangentsNeedUpdate = true;
 		</div>
 
 
-		<h2>Textures</h2>
+		<h2>Textures(纹理)</h2>
 		<div>
-			<p>Image, canvas, video and data textures need to have the following flag set if they are changed:</p>
+			<p>如果更改了图像,画布,视频和数据纹理,则需要设置以下标志:</p>
 			<code>
 				texture.needsUpdate = true;
 			</code>
@@ -224,9 +218,9 @@ geometry.tangentsNeedUpdate = true;
 		</div>
 
 
-		<h2>Cameras</h2>
+		<h2>Cameras(相机)</h2>
 		<div>
-			<p>A camera's position and target is updated automatically. If you need to change</p>
+			<p>相机的位置和目标会自动更新。 如果你需要改变</p>
 			<ul>
 				<li>
 					fov
@@ -242,7 +236,7 @@ geometry.tangentsNeedUpdate = true;
 				</li>
 			</ul>
 			<p>
-				then you'll need to recompute the projection matrix:
+				那么你需要重新计算投影矩阵:
 			</p>
 			<code>
 camera.aspect = window.innerWidth / window.innerHeight;

+ 17 - 16
docs/manual/zh/introduction/Matrix-transformations.html

@@ -11,55 +11,56 @@
 		<h1>[name]</h1>
 
 		<p>
-		Three.js uses *matrices* to encode 3D transformations---translations (position), rotations, and scaling. Every instance of [page:Object3D] has a [page:Object3D.matrix matrix] which stores that object's position, rotation, and scale. This page describes how to update an object's transformation.
+				Three.js使用*matrix*编码3D变换 - 平移(位置),旋转和缩放。 [page:Object3D]的每个实例都有一个[page:Object3D.matrix matrix],用于存储该对象的位置,旋转和比例。 本页介绍如何更新对象的转换。
 		</p>
 
-		<h2>Convenience properties and *matrixAutoUpdate*</h2>
+		<h2>Convenience properties and *matrixAutoUpdate*(便利属性和 *matrixAutoUpdate*)</h2>
 
-		There are two ways to update an object's transformation:
+		有两种方法可以更新对象的转换:
 		<ol>
 			<li>
-				Modify the object's *position*, *quaternion*, and *scale* properties, and let three.js recompute
-				the object's matrix from these properties:
+				修改对象的* position *,* quaternion *和* scale *属性,让three.js重新计算
+				来自这些属性的对象矩阵:
 				<code>
 				object.position.copy(start_position);
 				object.quaternion.copy(quaternion);
 				</code>
-				By default, the *matrixAutoUpdate* property is set true, and the matrix will be automatically recalculated.
-				If the object is static, or you wish to manually control when recalculation occurs, better performance can be obtained by setting the property false:
+				默认情况下,* matrixAutoUpdate *属性设置为true,并且将自动重新计算矩阵。
+如果对象是静态的,或者您希望在重新计算时手动控制,则可以通过将属性设置为false来获得更好的性能:
 				<code>
 				object.matrixAutoUpdate = false;
 				</code>
-				And after changing any properties, manually update the matrix:
+				更改任何属性后,手动更新矩阵:
 				<code>
 				object.updateMatrix();
 				</code>
 			</li>
 			<li>
-				Modify the object's matrix directly. The [page:Matrix4] class has various methods for modifying the matrix:
+				直接修改对象的矩阵。 [page:Matrix4]类有各种修改矩阵的方法:
 				<code>
 				object.matrix.setRotationFromQuaternion(quaternion);
 				object.matrix.setPosition(start_position);
 				object.matrixAutoUpdate = false;
 				</code>
-				Note that *matrixAutoUpdate* <em>must</em> be set to *false* in this case, and you should make sure <em>not</em> to call *updateMatrix*. Calling *updateMatrix* will clobber the manual changes made to the matrix, recalculating the matrix from *position*, *scale*, and so on.
+				请注意,在这种情况下,* matrixAutoUpdate * <em>必须</em>设置为* false *,并且您应该确保<em>不</em>调用* updateMatrix *。 调用* updateMatrix *将破坏对矩阵所做的手动更改,从* position *,* scale *重新计算矩阵,依此类推。
 			</li>
 		</ol>
 
-		<h2>Object and world matrices</h2>
+		<h2>Object and world matrices(对象和世界矩阵)</h2>
 		<p>
-		An object's [page:Object3D.matrix matrix] stores the object's transformation <em>relative</em> to the object's [page:Object3D.parent parent]; to get the object's transformation in <em>world</em> coordinates, you must access the object's [page:Object3D.matrixWorld].
+		对象的[page:Object3D.matrix matrix]将对象的转换<em> 相对于 </em>对象的[page:Object3D.parent parent]; 要在<em> 世界 </em>坐标中获取对象的转换,您必须访问该对象的[page:Object3D.matrixWorld]。
+		An object's [page:Object3D.matrix matrix] stores the object's transformation 
 		</p>
 		<p>
-		When either the parent or the child object's transformation changes, you can request that the child object's [page:Object3D.matrixWorld matrixWorld] be updated by calling [page:Object3D.updateMatrixWorld updateMatrixWorld]().
+		当父对象或子对象的转换发生更改时,可以通过调用[page:Object3D.updateMatrixWorld updateMatrixWorld]()来请求更新子对象的[page:Object3D.matrixWorld matrixWorld]。
 		</p>
 
-		<h2>Rotation and Quaternion</h2>
+		<h2>Rotation and Quaternion(旋转和四元数)</h2>
 		<p>
-		Three.js provides two ways of representing 3D rotations: [page:Euler Euler angles] and [page:Quaternion Quaternions], as well as methods for converting between the two. Euler angles are subject to a problem called "gimbal lock," where certain configurations can lose a degree of freedom (preventing the object from being rotated about one axis). For this reason, object rotations are <em>always</em> stored in the object's [page:Object3D.quaternion quaternion].
+		Three.js提供了两种表示3D旋转的方式:[page:Euler Euler angles]和[page:Quaternion Quaternions],以及两者之间的转换方法。 欧拉角受到称为“万向节锁定”的问题,其中某些配置可能失去一定程度的自由度(防止物体绕一个轴旋转)。 因此,对象旋转<em>始终</em>存储在对象的[page:Object3D.quaternion quaternion]中。
 		</p>
 		<p>
-		Previous versions of the library included a *useQuaternion* property which, when set to false, would cause the object's [page:Object3D.matrix matrix] to be calculated from an Euler angle. This practice is deprecated---instead, you should use the [page:Object3D.setRotationFromEuler setRotationFromEuler] method, which will update the quaternion.
+		该库的早期版本包含* useQuaternion *属性,当设置为false时,将导致对象的[page:Object3D.matrix矩阵]从欧拉角计算。 这种做法已被弃用 - 相反,您应该使用[page:Object3D.setRotationFromEuler setRotationFromEuler]方法,该方法将更新四元数。	
 		</p>
 
 	</body>