Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
0ad977c2
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0ad977c2
编写于
11月 23, 2016
作者:
K
Kyle Larson
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'refs/remotes/mrdoob/dev' into dev
上级
e2cd7801
bc2fd940
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
721 addition
and
616 deletion
+721
-616
build/three.js
build/three.js
+34
-19
build/three.min.js
build/three.min.js
+524
-524
build/three.modules.js
build/three.modules.js
+34
-19
docs/api/constants/DrawModes.html
docs/api/constants/DrawModes.html
+63
-4
docs/api/extras/helpers/HemisphereLightHelper.html
docs/api/extras/helpers/HemisphereLightHelper.html
+1
-4
examples/js/Mirror.js
examples/js/Mirror.js
+6
-6
examples/js/loaders/VRMLLoader.js
examples/js/loaders/VRMLLoader.js
+2
-2
examples/js/postprocessing/FilmPass.js
examples/js/postprocessing/FilmPass.js
+7
-4
examples/js/postprocessing/ManualMSAARenderPass.js
examples/js/postprocessing/ManualMSAARenderPass.js
+2
-2
examples/js/postprocessing/OutlinePass.js
examples/js/postprocessing/OutlinePass.js
+8
-8
examples/webgl_postprocessing_advanced.html
examples/webgl_postprocessing_advanced.html
+2
-2
src/extras/helpers/HemisphereLightHelper.js
src/extras/helpers/HemisphereLightHelper.js
+35
-21
src/extras/helpers/SkeletonHelper.js
src/extras/helpers/SkeletonHelper.js
+3
-1
未找到文件。
build/three.js
浏览文件 @
0ad977c2
...
...
@@ -40077,7 +40077,7 @@
matrixWorldInv.getInverse( this.root.matrixWorld );
for ( var i = 0, j = 0; i < this.bones.length; i ++
, j += 2
) {
for ( var i = 0, j = 0; i < this.bones.length; i ++ ) {
var bone = this.bones[ i ];
...
...
@@ -40091,6 +40091,8 @@
vector.setFromMatrixPosition( boneMatrix );
position.setXYZ( j + 1, vector.x, vector.y, vector.z );
j += 2;
}
}
...
...
@@ -40276,9 +40278,10 @@
/**
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author Mugen87 / https://github.com/Mugen87
*/
function HemisphereLightHelper( light, s
phereS
ize ) {
function HemisphereLightHelper( light, size ) {
Object3D.call( this );
...
...
@@ -40288,21 +40291,17 @@
this.matrix = light.matrixWorld;
this.matrixAutoUpdate = false;
this.colors = [ new Color(), new Color() ];
var geometry = new OctahedronBufferGeometry( size );
geometry.rotateY( Math.PI * 0.5 );
var geometry = new SphereGeometry( sphereSize, 4, 2 );
geometry.rotateX( - Math.PI / 2 );
var material = new MeshBasicMaterial( { vertexColors: VertexColors, wireframe: true } );
for ( var i = 0, il = 8; i < il; i ++ ) {
var position = geometry.getAttribute( 'position' );
var colors = new Float32Array( position.count * 3 );
geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ];
}
geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) );
var material = new MeshBasicMaterial( { vertexColors: FaceColors, wireframe: true } );
this.lightSphere = new Mesh( geometry, material );
this.add( this.lightSphere );
this.add( new Mesh( geometry, material ) );
this.update();
...
...
@@ -40313,8 +40312,8 @@
HemisphereLightHelper.prototype.dispose = function () {
this.
lightSphere
.geometry.dispose();
this.
lightSphere
.material.dispose();
this.
children[ 0 ]
.geometry.dispose();
this.
children[ 0 ]
.material.dispose();
};
...
...
@@ -40322,13 +40321,29 @@
var vector = new Vector3();
var color1 = new Color();
var color2 = new Color();
return function update() {
this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity );
this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity );
var mesh = this.children[ 0 ];
var colors = mesh.geometry.getAttribute( 'color' );
color1.copy( this.light.color ).multiplyScalar( this.light.intensity );
color2.copy( this.light.groundColor ).multiplyScalar( this.light.intensity );
for ( var i = 0, l = colors.count; i < l; i ++ ) {
var color = ( i < ( l / 2 ) ) ? color1 : color2;
colors.setXYZ( i, color.r, color.g, color.b );
}
mesh.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );
this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );
this.lightSphere.geometry.colorsNeedUpdate = true;
colors.needsUpdate = true;
};
...
...
build/three.min.js
浏览文件 @
0ad977c2
此差异已折叠。
点击以展开。
build/three.modules.js
浏览文件 @
0ad977c2
...
...
@@ -40071,7 +40071,7 @@ SkeletonHelper.prototype.update = function () {
matrixWorldInv.getInverse( this.root.matrixWorld );
for ( var i = 0, j = 0; i < this.bones.length; i ++
, j += 2
) {
for ( var i = 0, j = 0; i < this.bones.length; i ++ ) {
var bone = this.bones[ i ];
...
...
@@ -40085,6 +40085,8 @@ SkeletonHelper.prototype.update = function () {
vector.setFromMatrixPosition( boneMatrix );
position.setXYZ( j + 1, vector.x, vector.y, vector.z );
j += 2;
}
}
...
...
@@ -40270,9 +40272,10 @@ RectAreaLightHelper.prototype.update = function () {
/**
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author Mugen87 / https://github.com/Mugen87
*/
function HemisphereLightHelper( light, s
phereS
ize ) {
function HemisphereLightHelper( light, size ) {
Object3D.call( this );
...
...
@@ -40282,21 +40285,17 @@ function HemisphereLightHelper( light, sphereSize ) {
this.matrix = light.matrixWorld;
this.matrixAutoUpdate = false;
this.colors = [ new Color(), new Color() ];
var geometry = new OctahedronBufferGeometry( size );
geometry.rotateY( Math.PI * 0.5 );
var geometry = new SphereGeometry( sphereSize, 4, 2 );
geometry.rotateX( - Math.PI / 2 );
var material = new MeshBasicMaterial( { vertexColors: VertexColors, wireframe: true } );
for ( var i = 0, il = 8; i < il; i ++ ) {
var position = geometry.getAttribute( 'position' );
var colors = new Float32Array( position.count * 3 );
geometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ];
}
geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) );
var material = new MeshBasicMaterial( { vertexColors: FaceColors, wireframe: true } );
this.lightSphere = new Mesh( geometry, material );
this.add( this.lightSphere );
this.add( new Mesh( geometry, material ) );
this.update();
...
...
@@ -40307,8 +40306,8 @@ HemisphereLightHelper.prototype.constructor = HemisphereLightHelper;
HemisphereLightHelper.prototype.dispose = function () {
this.
lightSphere
.geometry.dispose();
this.
lightSphere
.material.dispose();
this.
children[ 0 ]
.geometry.dispose();
this.
children[ 0 ]
.material.dispose();
};
...
...
@@ -40316,13 +40315,29 @@ HemisphereLightHelper.prototype.update = function () {
var vector = new Vector3();
var color1 = new Color();
var color2 = new Color();
return function update() {
this.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity );
this.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity );
var mesh = this.children[ 0 ];
var colors = mesh.geometry.getAttribute( 'color' );
color1.copy( this.light.color ).multiplyScalar( this.light.intensity );
color2.copy( this.light.groundColor ).multiplyScalar( this.light.intensity );
for ( var i = 0, l = colors.count; i < l; i ++ ) {
var color = ( i < ( l / 2 ) ) ? color1 : color2;
colors.setXYZ( i, color.r, color.g, color.b );
}
mesh.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );
this.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );
this.lightSphere.geometry.colorsNeedUpdate = true;
colors.needsUpdate = true;
};
...
...
docs/api/constants/DrawModes.html
浏览文件 @
0ad977c2
...
...
@@ -10,13 +10,72 @@
<body>
<h1>
Draw Mode Constants
</h1>
<h2>
Draw Mode
</h2>
<div
class=
"desc"
>
These are valid values for [page:Mesh.drawMode], and control how the list of vertices is interpeted once sent to the GPU.
<br
/><br
/>
Note that these only work when [page:Mesh.geometry] is a [page:BufferGeometry]. Changing this
when [page:Mesh.geometry] is a [page:Geometry] will have no effect.
<br
/><br
/>
</div>
<h2>
Draw Modes
</h2>
<code>
THREE.TrianglesDrawMode
</code>
<div>
This is the default, and results in every three consecutive vertices (v0, v1, v2), (v2, v3, v5), ...
being interpreted as a separate triangle.
<br
/>
If the number of vertices is not a multiple of 3, excess vertices are ignored.
</div>
<code>
THREE.TriangleStripDrawMode
</code>
<div>
THREE.TrianglesDrawMode
<br
/>
THREE.TriangleStripDrawMode
<br
/>
THREE.TriangleFanDrawMode
This will result in a series of triangles connected in a strip, given by (v0, v1, v2), (v2, v1, v3), (v2, v3, v4), ...
so that every subsequent triangle shares two vertices with the previous triangle.
</div>
<code>
THREE.TriangleFanDrawMode
</code>
<div>
This will result in a series of triangles each sharing the first vertex (like a fan),
given by (v0, v1, v2), (v0, v2, v3), (v0, v3, v4), ...
<br
/><br
/>
<em>
Note:
</em>
As of [link:https://en.wikipedia.org/wiki/DirectX#DirectX_10 DirectX10], this mode is not supported. As Chrome and Firefox
render WebGL using [link:https://en.wikipedia.org/wiki/ANGLE_(software) ANGLE] on Windows,
internally this mode will be converted to a supported mode, which will likely lead to lowered
performance on those browsers.
</div>
<h2>
Usage
</h2>
<code>
var geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3( -10, 10, 0 ),
new THREE.Vector3( -10, -10, 0 ),
new THREE.Vector3( 10, -10, 0 ),
...
);
geometry.faces.push( new THREE.Face3( 0, 1, 2 ), ... );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
var mesh = new THREE.Mesh( geometry, material );
mesh.drawMode = THREE.TrianglesDrawMode; //default
scene.add( mesh );
</code>
<h2>
Source
</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
...
...
docs/api/extras/helpers/HemisphereLightHelper.html
浏览文件 @
0ad977c2
...
...
@@ -32,7 +32,7 @@ scene.add( helper );
<h3>
[name]([page:HemisphereLight light], [page:Number sphereSize])
</h3>
<div>
[page:HemisphereLight light] -- The light being visualized.
<br
/>
[page:Number s
phereSize] -- The size of the sphere used to visualize t
e light.
[page:Number s
ize] -- The size of the mesh used to visualize th
e light.
</div>
...
...
@@ -42,9 +42,6 @@ scene.add( helper );
<h3>
[property:HemisphereLight light]
</h3>
<div>
Reference to the HemisphereLight being visualized.
</div>
<h3>
[property:Mesh lightSphere]
</h3>
<div>
The sphere mesh that shows the location of the hemispherelight.
</div>
<h3>
[property:object matrix]
</h3>
<div>
Reference to the hemisphereLight's [page:Object3D.matrixWorld matrixWorld].
</div>
...
...
examples/js/Mirror.js
浏览文件 @
0ad977c2
...
...
@@ -5,9 +5,9 @@
THREE
.
ShaderLib
[
'
mirror
'
]
=
{
uniforms
:
{
"
mirrorColor
"
:
{
value
:
new
THREE
.
Color
(
0x7F7F7F
)
}
,
"
mirrorSampler
"
:
{
value
:
null
}
,
"
textureMatrix
"
:
{
value
:
new
THREE
.
Matrix4
()
}
"
mirrorColor
"
:
new
THREE
.
Uniform
(
new
THREE
.
Color
(
0x7F7F7F
)
)
,
"
mirrorSampler
"
:
new
THREE
.
Uniform
(
null
)
,
"
textureMatrix
"
:
new
THREE
.
Uniform
(
new
THREE
.
Matrix4
()
)
},
vertexShader
:
[
...
...
@@ -129,9 +129,9 @@ THREE.Mirror = function ( renderer, camera, options ) {
}
);
this
.
material
.
uniforms
.
mirrorSampler
.
value
=
this
.
renderTarget
.
texture
;
this
.
material
.
uniforms
.
mirrorColor
.
value
=
mirrorColor
;
this
.
material
.
uniforms
.
textureMatrix
.
value
=
this
.
textureMatrix
;
this
.
material
.
uniforms
.
mirrorSampler
=
new
THREE
.
Uniform
(
this
.
renderTarget
.
texture
)
;
this
.
material
.
uniforms
.
mirrorColor
=
new
THREE
.
Uniform
(
mirrorColor
)
;
this
.
material
.
uniforms
.
textureMatrix
=
new
THREE
.
Uniform
(
this
.
textureMatrix
)
;
if
(
!
THREE
.
Math
.
isPowerOfTwo
(
width
)
||
!
THREE
.
Math
.
isPowerOfTwo
(
height
)
)
{
...
...
examples/js/loaders/VRMLLoader.js
浏览文件 @
0ad977c2
...
...
@@ -416,8 +416,8 @@ THREE.VRMLLoader.prototype = {
break
;
+
case
'
location
'
:
+
case
'
direction
'
:
case
'
location
'
:
case
'
direction
'
:
case
'
translation
'
:
case
'
scale
'
:
case
'
size
'
:
...
...
examples/js/postprocessing/FilmPass.js
浏览文件 @
0ad977c2
...
...
@@ -21,10 +21,13 @@ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount,
}
);
if
(
grayscale
!==
undefined
)
this
.
uniforms
.
grayscale
.
value
=
grayscale
;
if
(
noiseIntensity
!==
undefined
)
this
.
uniforms
.
nIntensity
.
value
=
noiseIntensity
;
if
(
scanlinesIntensity
!==
undefined
)
this
.
uniforms
.
sIntensity
.
value
=
scanlinesIntensity
;
if
(
scanlinesCount
!==
undefined
)
this
.
uniforms
.
sCount
.
value
=
scanlinesCount
;
this
.
uniforms
[
"
tDiffuse
"
]
=
new
THREE
.
Uniform
();
this
.
uniforms
[
"
time
"
]
=
new
THREE
.
Uniform
(
0
);
if
(
grayscale
!==
undefined
)
this
.
uniforms
.
grayscale
=
new
THREE
.
Uniform
(
grayscale
);
if
(
noiseIntensity
!==
undefined
)
this
.
uniforms
.
nIntensity
=
new
THREE
.
Uniform
(
noiseIntensity
);
if
(
scanlinesIntensity
!==
undefined
)
this
.
uniforms
.
sIntensity
=
new
THREE
.
Uniform
(
scanlinesIntensity
);
if
(
scanlinesCount
!==
undefined
)
this
.
uniforms
.
sCount
=
new
THREE
.
Uniform
(
scanlinesCount
);
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
...
...
examples/js/postprocessing/ManualMSAARenderPass.js
浏览文件 @
0ad977c2
...
...
@@ -87,7 +87,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
var
baseSampleWeight
=
1.0
/
jitterOffsets
.
length
;
var
roundingRange
=
1
/
32
;
this
.
copyUniforms
[
"
tDiffuse
"
]
.
value
=
this
.
sampleRenderTarget
.
texture
;
this
.
copyUniforms
[
"
tDiffuse
"
]
=
new
THREE
.
Uniform
(
this
.
sampleRenderTarget
.
texture
)
;
var
width
=
readBuffer
.
width
,
height
=
readBuffer
.
height
;
...
...
@@ -110,7 +110,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
sampleWeight
+=
roundingRange
*
uniformCenteredDistribution
;
}
this
.
copyUniforms
[
"
opacity
"
]
.
value
=
sampleWeight
;
this
.
copyUniforms
[
"
opacity
"
]
=
new
THREE
.
Uniform
(
sampleWeight
)
;
renderer
.
setClearColor
(
this
.
clearColor
,
this
.
clearAlpha
);
renderer
.
render
(
this
.
scene
,
this
.
camera
,
this
.
sampleRenderTarget
,
true
);
if
(
i
===
0
)
{
...
...
examples/js/postprocessing/OutlinePass.js
浏览文件 @
0ad977c2
...
...
@@ -59,11 +59,11 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
var
MAX_EDGE_GLOW
=
4
;
this
.
separableBlurMaterial1
=
this
.
getSeperableBlurMaterial
(
MAX_EDGE_THICKNESS
);
this
.
separableBlurMaterial1
.
uniforms
[
"
texSize
"
]
.
value
=
new
THREE
.
Vector2
(
resx
,
resy
);
this
.
separableBlurMaterial1
.
uniforms
[
"
kernelRadius
"
]
.
value
=
1
;
this
.
separableBlurMaterial1
.
uniforms
[
"
texSize
"
]
=
new
THREE
.
Uniform
(
new
THREE
.
Vector2
(
resx
,
resy
)
);
this
.
separableBlurMaterial1
.
uniforms
[
"
kernelRadius
"
]
=
new
THREE
.
Uniform
(
1
)
;
this
.
separableBlurMaterial2
=
this
.
getSeperableBlurMaterial
(
MAX_EDGE_GLOW
);
this
.
separableBlurMaterial2
.
uniforms
[
"
texSize
"
]
.
value
=
new
THREE
.
Vector2
(
Math
.
round
(
resx
/
2
),
Math
.
round
(
resy
/
2
)
);
this
.
separableBlurMaterial2
.
uniforms
[
"
kernelRadius
"
]
.
value
=
MAX_EDGE_GLOW
;
this
.
separableBlurMaterial2
.
uniforms
[
"
texSize
"
]
=
new
THREE
.
Uniform
(
new
THREE
.
Vector2
(
Math
.
round
(
resx
/
2
),
Math
.
round
(
resy
/
2
)
)
);
this
.
separableBlurMaterial2
.
uniforms
[
"
kernelRadius
"
]
=
new
THREE
.
Uniform
(
MAX_EDGE_GLOW
)
;
// Overlay material
this
.
overlayMaterial
=
this
.
getOverlayMaterial
();
...
...
@@ -127,15 +127,15 @@ THREE.OutlinePass.prototype = Object.assign( Object.create( THREE.Pass.prototype
this
.
renderTargetMaskDownSampleBuffer
.
setSize
(
resx
,
resy
);
this
.
renderTargetBlurBuffer1
.
setSize
(
resx
,
resy
);
this
.
renderTargetEdgeBuffer1
.
setSize
(
resx
,
resy
);
this
.
separableBlurMaterial1
.
uniforms
[
"
texSize
"
]
.
value
=
new
THREE
.
Vector2
(
resx
,
resy
);
this
.
separableBlurMaterial1
.
uniforms
[
"
texSize
"
]
=
new
THREE
.
Uniform
(
new
THREE
.
Vector2
(
resx
,
resy
)
);
resx
=
Math
.
round
(
resx
/
2
);
resy
=
Math
.
round
(
resy
/
2
);
resx
=
Math
.
round
(
resx
/
2
);
resy
=
Math
.
round
(
resy
/
2
);
this
.
renderTargetBlurBuffer2
.
setSize
(
resx
,
resy
);
this
.
renderTargetEdgeBuffer2
.
setSize
(
resx
,
resy
);
this
.
separableBlurMaterial2
.
uniforms
[
"
texSize
"
]
.
value
=
new
THREE
.
Vector2
(
resx
,
resy
);
this
.
separableBlurMaterial2
.
uniforms
[
"
texSize
"
]
=
new
THREE
.
Uniform
(
new
THREE
.
Vector2
(
resx
,
resy
)
);
},
changeVisibilityOfSelectedObjects
:
function
(
bVisible
)
{
...
...
examples/webgl_postprocessing_advanced.html
浏览文件 @
0ad977c2
...
...
@@ -188,8 +188,8 @@
var
effectColorify1
=
new
THREE
.
ShaderPass
(
THREE
.
ColorifyShader
);
var
effectColorify2
=
new
THREE
.
ShaderPass
(
THREE
.
ColorifyShader
);
effectColorify1
.
uniforms
[
'
color
'
]
.
value
.
setRGB
(
1
,
0.8
,
0.8
);
effectColorify2
.
uniforms
[
'
color
'
]
.
value
.
setRGB
(
1
,
0.75
,
0.5
);
effectColorify1
.
uniforms
[
'
color
'
]
=
new
THREE
.
Uniform
(
new
THREE
.
Color
(
1
,
0.8
,
0.8
)
);
effectColorify2
.
uniforms
[
'
color
'
]
=
new
THREE
.
Uniform
(
new
THREE
.
Color
(
1
,
0.75
,
0.5
)
);
var
clearMask
=
new
THREE
.
ClearMaskPass
();
var
renderMask
=
new
THREE
.
MaskPass
(
sceneModel
,
cameraPerspective
);
...
...
src/extras/helpers/HemisphereLightHelper.js
浏览文件 @
0ad977c2
import
{
Vector3
}
from
'
../../math/Vector3
'
;
import
{
Color
}
from
'
../../math/Color
'
;
import
{
Object3D
}
from
'
../../core/Object3D
'
;
import
{
Mesh
}
from
'
../../objects/Mesh
'
;
import
{
Face
Colors
}
from
'
../../constants
'
;
import
{
Vertex
Colors
}
from
'
../../constants
'
;
import
{
MeshBasicMaterial
}
from
'
../../materials/MeshBasicMaterial
'
;
import
{
SphereGeometry
}
from
'
../../geometries/Sphere
Geometry
'
;
import
{
Color
}
from
'
../../math/Color
'
;
import
{
OctahedronBufferGeometry
}
from
'
../../geometries/OctahedronBuffer
Geometry
'
;
import
{
BufferAttribute
}
from
'
../../core/BufferAttribute
'
;
/**
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
* @author Mugen87 / https://github.com/Mugen87
*/
function
HemisphereLightHelper
(
light
,
s
phereS
ize
)
{
function
HemisphereLightHelper
(
light
,
size
)
{
Object3D
.
call
(
this
);
...
...
@@ -21,21 +23,17 @@ function HemisphereLightHelper( light, sphereSize ) {
this
.
matrix
=
light
.
matrixWorld
;
this
.
matrixAutoUpdate
=
false
;
this
.
colors
=
[
new
Color
(),
new
Color
()
];
var
geometry
=
new
SphereGeometry
(
sphereSize
,
4
,
2
);
geometry
.
rotateX
(
-
Math
.
PI
/
2
);
var
geometry
=
new
OctahedronBufferGeometry
(
size
);
geometry
.
rotateY
(
Math
.
PI
*
0.5
);
for
(
var
i
=
0
,
il
=
8
;
i
<
il
;
i
++
)
{
var
material
=
new
MeshBasicMaterial
(
{
vertexColors
:
VertexColors
,
wireframe
:
true
}
);
geometry
.
faces
[
i
].
color
=
this
.
colors
[
i
<
4
?
0
:
1
];
var
position
=
geometry
.
getAttribute
(
'
position
'
);
var
colors
=
new
Float32Array
(
position
.
count
*
3
);
}
geometry
.
addAttribute
(
'
color
'
,
new
BufferAttribute
(
colors
,
3
)
);
var
material
=
new
MeshBasicMaterial
(
{
vertexColors
:
FaceColors
,
wireframe
:
true
}
);
this
.
lightSphere
=
new
Mesh
(
geometry
,
material
);
this
.
add
(
this
.
lightSphere
);
this
.
add
(
new
Mesh
(
geometry
,
material
)
);
this
.
update
();
...
...
@@ -46,8 +44,8 @@ HemisphereLightHelper.prototype.constructor = HemisphereLightHelper;
HemisphereLightHelper
.
prototype
.
dispose
=
function
()
{
this
.
lightSphere
.
geometry
.
dispose
();
this
.
lightSphere
.
material
.
dispose
();
this
.
children
[
0
]
.
geometry
.
dispose
();
this
.
children
[
0
]
.
material
.
dispose
();
};
...
...
@@ -55,13 +53,29 @@ HemisphereLightHelper.prototype.update = function () {
var
vector
=
new
Vector3
();
var
color1
=
new
Color
();
var
color2
=
new
Color
();
return
function
update
()
{
this
.
colors
[
0
].
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
this
.
colors
[
1
].
copy
(
this
.
light
.
groundColor
).
multiplyScalar
(
this
.
light
.
intensity
);
var
mesh
=
this
.
children
[
0
];
var
colors
=
mesh
.
geometry
.
getAttribute
(
'
color
'
);
color1
.
copy
(
this
.
light
.
color
).
multiplyScalar
(
this
.
light
.
intensity
);
color2
.
copy
(
this
.
light
.
groundColor
).
multiplyScalar
(
this
.
light
.
intensity
);
for
(
var
i
=
0
,
l
=
colors
.
count
;
i
<
l
;
i
++
)
{
var
color
=
(
i
<
(
l
/
2
)
)
?
color1
:
color2
;
colors
.
setXYZ
(
i
,
color
.
r
,
color
.
g
,
color
.
b
);
}
mesh
.
lookAt
(
vector
.
setFromMatrixPosition
(
this
.
light
.
matrixWorld
).
negate
()
);
this
.
lightSphere
.
lookAt
(
vector
.
setFromMatrixPosition
(
this
.
light
.
matrixWorld
).
negate
()
);
this
.
lightSphere
.
geometry
.
colorsNeedUpdate
=
true
;
colors
.
needsUpdate
=
true
;
};
...
...
src/extras/helpers/SkeletonHelper.js
浏览文件 @
0ad977c2
...
...
@@ -96,7 +96,7 @@ SkeletonHelper.prototype.update = function () {
matrixWorldInv
.
getInverse
(
this
.
root
.
matrixWorld
);
for
(
var
i
=
0
,
j
=
0
;
i
<
this
.
bones
.
length
;
i
++
,
j
+=
2
)
{
for
(
var
i
=
0
,
j
=
0
;
i
<
this
.
bones
.
length
;
i
++
)
{
var
bone
=
this
.
bones
[
i
];
...
...
@@ -110,6 +110,8 @@ SkeletonHelper.prototype.update = function () {
vector
.
setFromMatrixPosition
(
boneMatrix
);
position
.
setXYZ
(
j
+
1
,
vector
.
x
,
vector
.
y
,
vector
.
z
);
j
+=
2
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录