Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
ba37015a
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
ba37015a
编写于
9月 10, 2017
作者:
M
Mr.doob
提交者:
GitHub
9月 10, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12163 from Mugen87/dev3
Remove all remaining linter warnings
上级
6a8a18ee
24fa9ed0
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
263 addition
and
262 deletion
+263
-262
src/Three.Legacy.js
src/Three.Legacy.js
+9
-9
src/animation/AnimationMixer.js
src/animation/AnimationMixer.js
+1
-1
src/animation/AnimationObjectGroup.js
src/animation/AnimationObjectGroup.js
+4
-4
src/animation/KeyframeTrack.js
src/animation/KeyframeTrack.js
+17
-17
src/animation/KeyframeTrackConstructor.js
src/animation/KeyframeTrackConstructor.js
+2
-2
src/cameras/OrthographicCamera.js
src/cameras/OrthographicCamera.js
+1
-1
src/cameras/PerspectiveCamera.js
src/cameras/PerspectiveCamera.js
+1
-1
src/extras/curves/LineCurve.js
src/extras/curves/LineCurve.js
+1
-1
src/extras/objects/ImmediateRenderObject.js
src/extras/objects/ImmediateRenderObject.js
+1
-1
src/geometries/BoxGeometry.js
src/geometries/BoxGeometry.js
+6
-6
src/geometries/DodecahedronGeometry.js
src/geometries/DodecahedronGeometry.js
+22
-22
src/geometries/ExtrudeGeometry.js
src/geometries/ExtrudeGeometry.js
+2
-2
src/geometries/IcosahedronGeometry.js
src/geometries/IcosahedronGeometry.js
+7
-7
src/geometries/OctahedronGeometry.js
src/geometries/OctahedronGeometry.js
+5
-2
src/geometries/TetrahedronGeometry.js
src/geometries/TetrahedronGeometry.js
+2
-2
src/helpers/AxisHelper.js
src/helpers/AxisHelper.js
+6
-6
src/helpers/BoxHelper.js
src/helpers/BoxHelper.js
+4
-4
src/helpers/CameraHelper.js
src/helpers/CameraHelper.js
+46
-46
src/helpers/DirectionalLightHelper.js
src/helpers/DirectionalLightHelper.js
+4
-4
src/helpers/RectAreaLightHelper.js
src/helpers/RectAreaLightHelper.js
+5
-5
src/helpers/SpotLightHelper.js
src/helpers/SpotLightHelper.js
+5
-5
src/math/Interpolant.js
src/math/Interpolant.js
+2
-2
src/math/Matrix3.js
src/math/Matrix3.js
+2
-2
src/math/Matrix4.js
src/math/Matrix4.js
+7
-7
src/math/Vector3.js
src/math/Vector3.js
+4
-4
src/math/interpolants/DiscreteInterpolant.js
src/math/interpolants/DiscreteInterpolant.js
+1
-1
src/renderers/WebGL2Renderer.js
src/renderers/WebGL2Renderer.js
+1
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+1
-1
src/renderers/webgl/WebGLFlareRenderer.js
src/renderers/webgl/WebGLFlareRenderer.js
+67
-67
src/renderers/webgl/WebGLSpriteRenderer.js
src/renderers/webgl/WebGLSpriteRenderer.js
+24
-24
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+1
-1
src/scenes/Fog.js
src/scenes/Fog.js
+1
-1
src/scenes/FogExp2.js
src/scenes/FogExp2.js
+1
-1
未找到文件。
src/Three.Legacy.js
浏览文件 @
ba37015a
...
...
@@ -281,17 +281,17 @@ Spline.prototype = Object.create( CatmullRomCurve3.prototype );
Object
.
assign
(
Spline
.
prototype
,
{
initFromArray
:
function
(
a
)
{
initFromArray
:
function
(
/* a */
)
{
console
.
error
(
'
THREE.Spline: .initFromArray() has been removed.
'
);
},
getControlPointsArray
:
function
(
optionalTarget
)
{
getControlPointsArray
:
function
(
/* optionalTarget */
)
{
console
.
error
(
'
THREE.Spline: .getControlPointsArray() has been removed.
'
);
},
reparametrizeByArcLength
:
function
(
samplingCoef
)
{
reparametrizeByArcLength
:
function
(
/* samplingCoef */
)
{
console
.
error
(
'
THREE.Spline: .reparametrizeByArcLength() has been removed.
'
);
...
...
@@ -441,18 +441,18 @@ Object.assign( Matrix3.prototype, {
return
vector
.
applyMatrix3
(
this
);
},
multiplyVector3Array
:
function
(
a
)
{
multiplyVector3Array
:
function
(
/* a */
)
{
console
.
error
(
'
THREE.Matrix3: .multiplyVector3Array() has been removed.
'
);
},
applyToBuffer
:
function
(
buffer
,
offset
,
length
)
{
applyToBuffer
:
function
(
buffer
/*, offset, length */
)
{
console
.
warn
(
'
THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.
'
);
return
this
.
applyToBufferAttribute
(
buffer
);
},
applyToVector3Array
:
function
(
array
,
offset
,
length
)
{
applyToVector3Array
:
function
(
/* array, offset, length */
)
{
console
.
error
(
'
THREE.Matrix3: .applyToVector3Array() has been removed.
'
);
...
...
@@ -510,7 +510,7 @@ Object.assign( Matrix4.prototype, {
return
vector
.
applyMatrix4
(
this
);
},
multiplyVector3Array
:
function
(
a
)
{
multiplyVector3Array
:
function
(
/* a */
)
{
console
.
error
(
'
THREE.Matrix4: .multiplyVector3Array() has been removed.
'
);
...
...
@@ -552,13 +552,13 @@ Object.assign( Matrix4.prototype, {
console
.
error
(
'
THREE.Matrix4: .rotateByAxis() has been removed.
'
);
},
applyToBuffer
:
function
(
buffer
,
offset
,
length
)
{
applyToBuffer
:
function
(
buffer
/*, offset, length */
)
{
console
.
warn
(
'
THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.
'
);
return
this
.
applyToBufferAttribute
(
buffer
);
},
applyToVector3Array
:
function
(
array
,
offset
,
length
)
{
applyToVector3Array
:
function
(
/* array, offset, length */
)
{
console
.
error
(
'
THREE.Matrix4: .applyToVector3Array() has been removed.
'
);
...
...
src/animation/AnimationMixer.js
浏览文件 @
ba37015a
...
...
@@ -428,7 +428,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
remove_empty_map
:
{
for
(
var
_
in
bindingByName
)
break
remove_empty_map
;
for
(
var
_
in
bindingByName
)
break
remove_empty_map
;
// eslint-disable-line no-unused-vars
delete
bindingsByRoot
[
rootUuid
];
...
...
src/animation/AnimationObjectGroup.js
浏览文件 @
ba37015a
...
...
@@ -32,7 +32,7 @@ import { _Math } from '../math/Math.js';
* @author tschw
*/
function
AnimationObjectGroup
(
var_args
)
{
function
AnimationObjectGroup
()
{
this
.
uuid
=
_Math
.
generateUUID
();
...
...
@@ -86,7 +86,7 @@ Object.assign( AnimationObjectGroup.prototype, {
isAnimationObjectGroup
:
true
,
add
:
function
(
var_args
)
{
add
:
function
()
{
var
objects
=
this
.
_objects
,
nObjects
=
objects
.
length
,
...
...
@@ -172,7 +172,7 @@ Object.assign( AnimationObjectGroup.prototype, {
},
remove
:
function
(
var_args
)
{
remove
:
function
()
{
var
objects
=
this
.
_objects
,
nCachedObjects
=
this
.
nCachedObjects_
,
...
...
@@ -221,7 +221,7 @@ Object.assign( AnimationObjectGroup.prototype, {
},
// remove & forget
uncache
:
function
(
var_args
)
{
uncache
:
function
()
{
var
objects
=
this
.
_objects
,
nObjects
=
objects
.
length
,
...
...
src/animation/KeyframeTrack.js
浏览文件 @
ba37015a
...
...
@@ -20,7 +20,7 @@ import { KeyframeTrackConstructor } from './KeyframeTrackConstructor.js';
function
KeyframeTrack
(
name
,
times
,
values
,
interpolation
)
{
KeyframeTrackConstructor
.
apply
(
this
,
arguments
);
KeyframeTrackConstructor
.
apply
(
this
,
name
,
times
,
values
,
interpolation
);
}
...
...
@@ -38,7 +38,7 @@ Object.assign( KeyframeTrack, {
if
(
json
.
type
===
undefined
)
{
throw
new
Error
(
"
track type undefined, can not parse
"
);
throw
new
Error
(
'
track type undefined, can not parse
'
);
}
...
...
@@ -111,41 +111,41 @@ Object.assign( KeyframeTrack, {
switch
(
typeName
.
toLowerCase
()
)
{
case
"
scalar
"
:
case
"
double
"
:
case
"
float
"
:
case
"
number
"
:
case
"
integer
"
:
case
'
scalar
'
:
case
'
double
'
:
case
'
float
'
:
case
'
number
'
:
case
'
integer
'
:
return
NumberKeyframeTrack
;
case
"
vector
"
:
case
"
vector2
"
:
case
"
vector3
"
:
case
"
vector4
"
:
case
'
vector
'
:
case
'
vector2
'
:
case
'
vector3
'
:
case
'
vector4
'
:
return
VectorKeyframeTrack
;
case
"
color
"
:
case
'
color
'
:
return
ColorKeyframeTrack
;
case
"
quaternion
"
:
case
'
quaternion
'
:
return
QuaternionKeyframeTrack
;
case
"
bool
"
:
case
"
boolean
"
:
case
'
bool
'
:
case
'
boolean
'
:
return
BooleanKeyframeTrack
;
case
"
string
"
:
case
'
string
'
:
return
StringKeyframeTrack
;
}
throw
new
Error
(
"
Unsupported typeName:
"
+
typeName
);
throw
new
Error
(
'
Unsupported typeName:
'
+
typeName
);
}
...
...
src/animation/KeyframeTrackConstructor.js
浏览文件 @
ba37015a
...
...
@@ -2,11 +2,11 @@ import { AnimationUtils } from './AnimationUtils.js';
function
KeyframeTrackConstructor
(
name
,
times
,
values
,
interpolation
)
{
if
(
name
===
undefined
)
throw
new
Error
(
"
track name is undefined
"
);
if
(
name
===
undefined
)
throw
new
Error
(
'
track name is undefined
'
);
if
(
times
===
undefined
||
times
.
length
===
0
)
{
throw
new
Error
(
"
no keyframes in track named
"
+
name
);
throw
new
Error
(
'
no keyframes in track named
'
+
name
);
}
...
...
src/cameras/OrthographicCamera.js
浏览文件 @
ba37015a
...
...
@@ -64,7 +64,7 @@ OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ),
height
:
1
};
}
;
}
this
.
view
.
fullWidth
=
fullWidth
;
this
.
view
.
fullHeight
=
fullHeight
;
...
...
src/cameras/PerspectiveCamera.js
浏览文件 @
ba37015a
...
...
@@ -159,7 +159,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
height
:
1
};
}
;
}
this
.
view
.
fullWidth
=
fullWidth
;
this
.
view
.
fullHeight
=
fullHeight
;
...
...
src/extras/curves/LineCurve.js
浏览文件 @
ba37015a
...
...
@@ -38,7 +38,7 @@ LineCurve.prototype.getPointAt = function ( u ) {
};
LineCurve
.
prototype
.
getTangent
=
function
(
t
)
{
LineCurve
.
prototype
.
getTangent
=
function
(
/* t */
)
{
var
tangent
=
this
.
v2
.
clone
().
sub
(
this
.
v1
);
...
...
src/extras/objects/ImmediateRenderObject.js
浏览文件 @
ba37015a
...
...
@@ -9,7 +9,7 @@ function ImmediateRenderObject( material ) {
Object3D
.
call
(
this
);
this
.
material
=
material
;
this
.
render
=
function
(
renderCallback
)
{};
this
.
render
=
function
(
/* renderCallback */
)
{};
}
...
...
src/geometries/BoxGeometry.js
浏览文件 @
ba37015a
...
...
@@ -72,12 +72,12 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
// build each side of the box geometry
buildPlane
(
'
z
'
,
'
y
'
,
'
x
'
,
-
1
,
-
1
,
depth
,
height
,
width
,
depthSegments
,
heightSegments
,
0
);
// px
buildPlane
(
'
z
'
,
'
y
'
,
'
x
'
,
1
,
-
1
,
depth
,
height
,
-
width
,
depthSegments
,
heightSegments
,
1
);
// nx
buildPlane
(
'
x
'
,
'
z
'
,
'
y
'
,
1
,
1
,
width
,
depth
,
height
,
widthSegments
,
depthSegments
,
2
);
// py
buildPlane
(
'
x
'
,
'
z
'
,
'
y
'
,
1
,
-
1
,
width
,
depth
,
-
height
,
widthSegments
,
depthSegments
,
3
);
// ny
buildPlane
(
'
x
'
,
'
y
'
,
'
z
'
,
1
,
-
1
,
width
,
height
,
depth
,
widthSegments
,
heightSegments
,
4
);
// pz
buildPlane
(
'
x
'
,
'
y
'
,
'
z
'
,
-
1
,
-
1
,
width
,
height
,
-
depth
,
widthSegments
,
heightSegments
,
5
);
// nz
buildPlane
(
'
z
'
,
'
y
'
,
'
x
'
,
-
1
,
-
1
,
depth
,
height
,
width
,
depthSegments
,
heightSegments
,
0
);
// px
buildPlane
(
'
z
'
,
'
y
'
,
'
x
'
,
1
,
-
1
,
depth
,
height
,
-
width
,
depthSegments
,
heightSegments
,
1
);
// nx
buildPlane
(
'
x
'
,
'
z
'
,
'
y
'
,
1
,
1
,
width
,
depth
,
height
,
widthSegments
,
depthSegments
,
2
);
// py
buildPlane
(
'
x
'
,
'
z
'
,
'
y
'
,
1
,
-
1
,
width
,
depth
,
-
height
,
widthSegments
,
depthSegments
,
3
);
// ny
buildPlane
(
'
x
'
,
'
y
'
,
'
z
'
,
1
,
-
1
,
width
,
height
,
depth
,
widthSegments
,
heightSegments
,
4
);
// pz
buildPlane
(
'
x
'
,
'
y
'
,
'
z
'
,
-
1
,
-
1
,
width
,
height
,
-
depth
,
widthSegments
,
heightSegments
,
5
);
// nz
// build geometry
...
...
src/geometries/DodecahedronGeometry.js
浏览文件 @
ba37015a
...
...
@@ -37,37 +37,37 @@ function DodecahedronBufferGeometry( radius, detail ) {
var
vertices
=
[
// (±1, ±1, ±1)
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
1
,
// (0, ±1/φ, ±φ)
0
,
-
r
,
-
t
,
0
,
-
r
,
t
,
0
,
r
,
-
t
,
0
,
r
,
t
,
0
,
-
r
,
-
t
,
0
,
-
r
,
t
,
0
,
r
,
-
t
,
0
,
r
,
t
,
// (±1/φ, ±φ, 0)
-
r
,
-
t
,
0
,
-
r
,
t
,
0
,
r
,
-
t
,
0
,
r
,
t
,
0
,
-
r
,
-
t
,
0
,
-
r
,
t
,
0
,
r
,
-
t
,
0
,
r
,
t
,
0
,
// (±φ, 0, ±1/φ)
-
t
,
0
,
-
r
,
t
,
0
,
-
r
,
-
t
,
0
,
r
,
t
,
0
,
r
-
t
,
0
,
-
r
,
t
,
0
,
-
r
,
-
t
,
0
,
r
,
t
,
0
,
r
];
var
indices
=
[
3
,
11
,
7
,
3
,
7
,
15
,
3
,
15
,
13
,
7
,
19
,
17
,
7
,
17
,
6
,
7
,
6
,
15
,
17
,
4
,
8
,
17
,
8
,
10
,
17
,
10
,
6
,
8
,
0
,
16
,
8
,
16
,
2
,
8
,
2
,
10
,
0
,
12
,
1
,
0
,
1
,
18
,
0
,
18
,
16
,
6
,
10
,
2
,
6
,
2
,
13
,
6
,
13
,
15
,
2
,
16
,
18
,
2
,
18
,
3
,
2
,
3
,
13
,
18
,
1
,
9
,
18
,
9
,
11
,
18
,
11
,
3
,
4
,
14
,
12
,
4
,
12
,
0
,
4
,
0
,
8
,
11
,
9
,
5
,
11
,
5
,
19
,
11
,
19
,
7
,
19
,
5
,
14
,
19
,
14
,
4
,
19
,
4
,
17
,
1
,
12
,
14
,
1
,
14
,
5
,
1
,
5
,
9
3
,
11
,
7
,
3
,
7
,
15
,
3
,
15
,
13
,
7
,
19
,
17
,
7
,
17
,
6
,
7
,
6
,
15
,
17
,
4
,
8
,
17
,
8
,
10
,
17
,
10
,
6
,
8
,
0
,
16
,
8
,
16
,
2
,
8
,
2
,
10
,
0
,
12
,
1
,
0
,
1
,
18
,
0
,
18
,
16
,
6
,
10
,
2
,
6
,
2
,
13
,
6
,
13
,
15
,
2
,
16
,
18
,
2
,
18
,
3
,
2
,
3
,
13
,
18
,
1
,
9
,
18
,
9
,
11
,
18
,
11
,
3
,
4
,
14
,
12
,
4
,
12
,
0
,
4
,
0
,
8
,
11
,
9
,
5
,
11
,
5
,
19
,
11
,
19
,
7
,
19
,
5
,
14
,
19
,
14
,
4
,
19
,
4
,
17
,
1
,
12
,
14
,
1
,
14
,
5
,
1
,
5
,
9
];
PolyhedronBufferGeometry
.
call
(
this
,
vertices
,
indices
,
radius
,
detail
);
...
...
src/geometries/ExtrudeGeometry.js
浏览文件 @
ba37015a
...
...
@@ -670,7 +670,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
c
=
layeroffset
+
k
+
slen2
,
d
=
layeroffset
+
j
+
slen2
;
f4
(
a
,
b
,
c
,
d
,
contour
,
s
,
sl
,
j
,
k
);
f4
(
a
,
b
,
c
,
d
);
}
...
...
@@ -702,7 +702,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
function
f4
(
a
,
b
,
c
,
d
,
wallContour
,
stepIndex
,
stepsLength
,
contourIndex1
,
contourIndex2
)
{
function
f4
(
a
,
b
,
c
,
d
)
{
addVertex
(
a
);
addVertex
(
b
);
...
...
src/geometries/IcosahedronGeometry.js
浏览文件 @
ba37015a
...
...
@@ -34,16 +34,16 @@ function IcosahedronBufferGeometry( radius, detail ) {
var
t
=
(
1
+
Math
.
sqrt
(
5
)
)
/
2
;
var
vertices
=
[
-
1
,
t
,
0
,
1
,
t
,
0
,
-
1
,
-
t
,
0
,
1
,
-
t
,
0
,
0
,
-
1
,
t
,
0
,
1
,
t
,
0
,
-
1
,
-
t
,
0
,
1
,
-
t
,
t
,
0
,
-
1
,
t
,
0
,
1
,
-
t
,
0
,
-
1
,
-
t
,
0
,
1
-
1
,
t
,
0
,
1
,
t
,
0
,
-
1
,
-
t
,
0
,
1
,
-
t
,
0
,
0
,
-
1
,
t
,
0
,
1
,
t
,
0
,
-
1
,
-
t
,
0
,
1
,
-
t
,
t
,
0
,
-
1
,
t
,
0
,
1
,
-
t
,
0
,
-
1
,
-
t
,
0
,
1
];
var
indices
=
[
0
,
11
,
5
,
0
,
5
,
1
,
0
,
1
,
7
,
0
,
7
,
10
,
0
,
10
,
11
,
1
,
5
,
9
,
5
,
11
,
4
,
11
,
10
,
2
,
10
,
7
,
6
,
7
,
1
,
8
,
3
,
9
,
4
,
3
,
4
,
2
,
3
,
2
,
6
,
3
,
6
,
8
,
3
,
8
,
9
,
4
,
9
,
5
,
2
,
4
,
11
,
6
,
2
,
10
,
8
,
6
,
7
,
9
,
8
,
1
0
,
11
,
5
,
0
,
5
,
1
,
0
,
1
,
7
,
0
,
7
,
10
,
0
,
10
,
11
,
1
,
5
,
9
,
5
,
11
,
4
,
11
,
10
,
2
,
10
,
7
,
6
,
7
,
1
,
8
,
3
,
9
,
4
,
3
,
4
,
2
,
3
,
2
,
6
,
3
,
6
,
8
,
3
,
8
,
9
,
4
,
9
,
5
,
2
,
4
,
11
,
6
,
2
,
10
,
8
,
6
,
7
,
9
,
8
,
1
];
PolyhedronBufferGeometry
.
call
(
this
,
vertices
,
indices
,
radius
,
detail
);
...
...
src/geometries/OctahedronGeometry.js
浏览文件 @
ba37015a
...
...
@@ -32,11 +32,14 @@ OctahedronGeometry.prototype.constructor = OctahedronGeometry;
function
OctahedronBufferGeometry
(
radius
,
detail
)
{
var
vertices
=
[
1
,
0
,
0
,
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
-
1
1
,
0
,
0
,
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
-
1
,
0
,
0
,
0
,
1
,
0
,
0
,
-
1
];
var
indices
=
[
0
,
2
,
4
,
0
,
4
,
3
,
0
,
3
,
5
,
0
,
5
,
2
,
1
,
2
,
5
,
1
,
5
,
3
,
1
,
3
,
4
,
1
,
4
,
2
0
,
2
,
4
,
0
,
4
,
3
,
0
,
3
,
5
,
0
,
5
,
2
,
1
,
2
,
5
,
1
,
5
,
3
,
1
,
3
,
4
,
1
,
4
,
2
];
PolyhedronBufferGeometry
.
call
(
this
,
vertices
,
indices
,
radius
,
detail
);
...
...
src/geometries/TetrahedronGeometry.js
浏览文件 @
ba37015a
...
...
@@ -32,11 +32,11 @@ TetrahedronGeometry.prototype.constructor = TetrahedronGeometry;
function
TetrahedronBufferGeometry
(
radius
,
detail
)
{
var
vertices
=
[
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
1
,
1
,
1
,
-
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
-
1
];
var
indices
=
[
2
,
1
,
0
,
0
,
3
,
2
,
1
,
3
,
0
,
2
,
3
,
1
2
,
1
,
0
,
0
,
3
,
2
,
1
,
3
,
0
,
2
,
3
,
1
];
PolyhedronBufferGeometry
.
call
(
this
,
vertices
,
indices
,
radius
,
detail
);
...
...
src/helpers/AxisHelper.js
浏览文件 @
ba37015a
...
...
@@ -14,15 +14,15 @@ function AxisHelper( size ) {
size
=
size
||
1
;
var
vertices
=
[
0
,
0
,
0
,
size
,
0
,
0
,
0
,
0
,
0
,
0
,
size
,
0
,
0
,
0
,
0
,
0
,
0
,
size
0
,
0
,
0
,
size
,
0
,
0
,
0
,
0
,
0
,
0
,
size
,
0
,
0
,
0
,
0
,
0
,
0
,
size
];
var
colors
=
[
1
,
0
,
0
,
1
,
0.6
,
0
,
0
,
1
,
0
,
0.6
,
1
,
0
,
0
,
0
,
1
,
0
,
0.6
,
1
1
,
0
,
0
,
1
,
0.6
,
0
,
0
,
1
,
0
,
0.6
,
1
,
0
,
0
,
0
,
1
,
0
,
0.6
,
1
];
var
geometry
=
new
BufferGeometry
();
...
...
src/helpers/BoxHelper.js
浏览文件 @
ba37015a
...
...
@@ -75,10 +75,10 @@ BoxHelper.prototype.update = ( function () {
var
position
=
this
.
geometry
.
attributes
.
position
;
var
array
=
position
.
array
;
array
[
0
]
=
max
.
x
;
array
[
1
]
=
max
.
y
;
array
[
2
]
=
max
.
z
;
array
[
3
]
=
min
.
x
;
array
[
4
]
=
max
.
y
;
array
[
5
]
=
max
.
z
;
array
[
6
]
=
min
.
x
;
array
[
7
]
=
min
.
y
;
array
[
8
]
=
max
.
z
;
array
[
9
]
=
max
.
x
;
array
[
10
]
=
min
.
y
;
array
[
11
]
=
max
.
z
;
array
[
0
]
=
max
.
x
;
array
[
1
]
=
max
.
y
;
array
[
2
]
=
max
.
z
;
array
[
3
]
=
min
.
x
;
array
[
4
]
=
max
.
y
;
array
[
5
]
=
max
.
z
;
array
[
6
]
=
min
.
x
;
array
[
7
]
=
min
.
y
;
array
[
8
]
=
max
.
z
;
array
[
9
]
=
max
.
x
;
array
[
10
]
=
min
.
y
;
array
[
11
]
=
max
.
z
;
array
[
12
]
=
max
.
x
;
array
[
13
]
=
max
.
y
;
array
[
14
]
=
min
.
z
;
array
[
15
]
=
min
.
x
;
array
[
16
]
=
max
.
y
;
array
[
17
]
=
min
.
z
;
array
[
18
]
=
min
.
x
;
array
[
19
]
=
min
.
y
;
array
[
20
]
=
min
.
z
;
...
...
src/helpers/CameraHelper.js
浏览文件 @
ba37015a
...
...
@@ -37,50 +37,50 @@ function CameraHelper( camera ) {
// near
addLine
(
"
n1
"
,
"
n2
"
,
colorFrustum
);
addLine
(
"
n2
"
,
"
n4
"
,
colorFrustum
);
addLine
(
"
n4
"
,
"
n3
"
,
colorFrustum
);
addLine
(
"
n3
"
,
"
n1
"
,
colorFrustum
);
addLine
(
'
n1
'
,
'
n2
'
,
colorFrustum
);
addLine
(
'
n2
'
,
'
n4
'
,
colorFrustum
);
addLine
(
'
n4
'
,
'
n3
'
,
colorFrustum
);
addLine
(
'
n3
'
,
'
n1
'
,
colorFrustum
);
// far
addLine
(
"
f1
"
,
"
f2
"
,
colorFrustum
);
addLine
(
"
f2
"
,
"
f4
"
,
colorFrustum
);
addLine
(
"
f4
"
,
"
f3
"
,
colorFrustum
);
addLine
(
"
f3
"
,
"
f1
"
,
colorFrustum
);
addLine
(
'
f1
'
,
'
f2
'
,
colorFrustum
);
addLine
(
'
f2
'
,
'
f4
'
,
colorFrustum
);
addLine
(
'
f4
'
,
'
f3
'
,
colorFrustum
);
addLine
(
'
f3
'
,
'
f1
'
,
colorFrustum
);
// sides
addLine
(
"
n1
"
,
"
f1
"
,
colorFrustum
);
addLine
(
"
n2
"
,
"
f2
"
,
colorFrustum
);
addLine
(
"
n3
"
,
"
f3
"
,
colorFrustum
);
addLine
(
"
n4
"
,
"
f4
"
,
colorFrustum
);
addLine
(
'
n1
'
,
'
f1
'
,
colorFrustum
);
addLine
(
'
n2
'
,
'
f2
'
,
colorFrustum
);
addLine
(
'
n3
'
,
'
f3
'
,
colorFrustum
);
addLine
(
'
n4
'
,
'
f4
'
,
colorFrustum
);
// cone
addLine
(
"
p
"
,
"
n1
"
,
colorCone
);
addLine
(
"
p
"
,
"
n2
"
,
colorCone
);
addLine
(
"
p
"
,
"
n3
"
,
colorCone
);
addLine
(
"
p
"
,
"
n4
"
,
colorCone
);
addLine
(
'
p
'
,
'
n1
'
,
colorCone
);
addLine
(
'
p
'
,
'
n2
'
,
colorCone
);
addLine
(
'
p
'
,
'
n3
'
,
colorCone
);
addLine
(
'
p
'
,
'
n4
'
,
colorCone
);
// up
addLine
(
"
u1
"
,
"
u2
"
,
colorUp
);
addLine
(
"
u2
"
,
"
u3
"
,
colorUp
);
addLine
(
"
u3
"
,
"
u1
"
,
colorUp
);
addLine
(
'
u1
'
,
'
u2
'
,
colorUp
);
addLine
(
'
u2
'
,
'
u3
'
,
colorUp
);
addLine
(
'
u3
'
,
'
u1
'
,
colorUp
);
// target
addLine
(
"
c
"
,
"
t
"
,
colorTarget
);
addLine
(
"
p
"
,
"
c
"
,
colorCross
);
addLine
(
'
c
'
,
'
t
'
,
colorTarget
);
addLine
(
'
p
'
,
'
c
'
,
colorCross
);
// cross
addLine
(
"
cn1
"
,
"
cn2
"
,
colorCross
);
addLine
(
"
cn3
"
,
"
cn4
"
,
colorCross
);
addLine
(
'
cn1
'
,
'
cn2
'
,
colorCross
);
addLine
(
'
cn3
'
,
'
cn4
'
,
colorCross
);
addLine
(
"
cf1
"
,
"
cf2
"
,
colorCross
);
addLine
(
"
cf3
"
,
"
cf4
"
,
colorCross
);
addLine
(
'
cf1
'
,
'
cf2
'
,
colorCross
);
addLine
(
'
cf3
'
,
'
cf4
'
,
colorCross
);
function
addLine
(
a
,
b
,
color
)
{
...
...
@@ -165,40 +165,40 @@ CameraHelper.prototype.update = function () {
// center / target
setPoint
(
"
c
"
,
0
,
0
,
-
1
);
setPoint
(
"
t
"
,
0
,
0
,
1
);
setPoint
(
'
c
'
,
0
,
0
,
-
1
);
setPoint
(
'
t
'
,
0
,
0
,
1
);
// near
setPoint
(
"
n1
"
,
-
w
,
-
h
,
-
1
);
setPoint
(
"
n2
"
,
w
,
-
h
,
-
1
);
setPoint
(
"
n3
"
,
-
w
,
h
,
-
1
);
setPoint
(
"
n4
"
,
w
,
h
,
-
1
);
setPoint
(
'
n1
'
,
-
w
,
-
h
,
-
1
);
setPoint
(
'
n2
'
,
w
,
-
h
,
-
1
);
setPoint
(
'
n3
'
,
-
w
,
h
,
-
1
);
setPoint
(
'
n4
'
,
w
,
h
,
-
1
);
// far
setPoint
(
"
f1
"
,
-
w
,
-
h
,
1
);
setPoint
(
"
f2
"
,
w
,
-
h
,
1
);
setPoint
(
"
f3
"
,
-
w
,
h
,
1
);
setPoint
(
"
f4
"
,
w
,
h
,
1
);
setPoint
(
'
f1
'
,
-
w
,
-
h
,
1
);
setPoint
(
'
f2
'
,
w
,
-
h
,
1
);
setPoint
(
'
f3
'
,
-
w
,
h
,
1
);
setPoint
(
'
f4
'
,
w
,
h
,
1
);
// up
setPoint
(
"
u1
"
,
w
*
0.7
,
h
*
1.1
,
-
1
);
setPoint
(
"
u2
"
,
-
w
*
0.7
,
h
*
1.1
,
-
1
);
setPoint
(
"
u3
"
,
0
,
h
*
2
,
-
1
);
setPoint
(
'
u1
'
,
w
*
0.7
,
h
*
1.1
,
-
1
);
setPoint
(
'
u2
'
,
-
w
*
0.7
,
h
*
1.1
,
-
1
);
setPoint
(
'
u3
'
,
0
,
h
*
2
,
-
1
);
// cross
setPoint
(
"
cf1
"
,
-
w
,
0
,
1
);
setPoint
(
"
cf2
"
,
w
,
0
,
1
);
setPoint
(
"
cf3
"
,
0
,
-
h
,
1
);
setPoint
(
"
cf4
"
,
0
,
h
,
1
);
setPoint
(
'
cf1
'
,
-
w
,
0
,
1
);
setPoint
(
'
cf2
'
,
w
,
0
,
1
);
setPoint
(
'
cf3
'
,
0
,
-
h
,
1
);
setPoint
(
'
cf4
'
,
0
,
h
,
1
);
setPoint
(
"
cn1
"
,
-
w
,
0
,
-
1
);
setPoint
(
"
cn2
"
,
w
,
0
,
-
1
);
setPoint
(
"
cn3
"
,
0
,
-
h
,
-
1
);
setPoint
(
"
cn4
"
,
0
,
h
,
-
1
);
setPoint
(
'
cn1
'
,
-
w
,
0
,
-
1
);
setPoint
(
'
cn2
'
,
w
,
0
,
-
1
);
setPoint
(
'
cn3
'
,
0
,
-
h
,
-
1
);
setPoint
(
'
cn4
'
,
0
,
h
,
-
1
);
geometry
.
getAttribute
(
'
position
'
).
needsUpdate
=
true
;
...
...
src/helpers/DirectionalLightHelper.js
浏览文件 @
ba37015a
...
...
@@ -27,11 +27,11 @@ function DirectionalLightHelper( light, size, color ) {
var
geometry
=
new
BufferGeometry
();
geometry
.
addAttribute
(
'
position
'
,
new
Float32BufferAttribute
(
[
-
size
,
size
,
0
,
size
,
size
,
0
,
size
,
-
size
,
0
,
-
size
,
size
,
0
,
size
,
size
,
0
,
size
,
-
size
,
0
,
-
size
,
-
size
,
0
,
-
size
,
size
,
0
-
size
,
size
,
0
],
3
)
);
var
material
=
new
LineBasicMaterial
(
{
fog
:
false
}
);
...
...
src/helpers/RectAreaLightHelper.js
浏览文件 @
ba37015a
...
...
@@ -58,11 +58,11 @@ RectAreaLightHelper.prototype.update = function () {
// update vertices
array
[
0
]
=
hx
;
array
[
1
]
=
-
hy
;
array
[
2
]
=
0
;
array
[
3
]
=
hx
;
array
[
4
]
=
hy
;
array
[
5
]
=
0
;
array
[
6
]
=
-
hx
;
array
[
7
]
=
hy
;
array
[
8
]
=
0
;
array
[
9
]
=
-
hx
;
array
[
10
]
=
-
hy
;
array
[
11
]
=
0
;
array
[
12
]
=
hx
;
array
[
13
]
=
-
hy
;
array
[
14
]
=
0
;
array
[
0
]
=
hx
;
array
[
1
]
=
-
hy
;
array
[
2
]
=
0
;
array
[
3
]
=
hx
;
array
[
4
]
=
hy
;
array
[
5
]
=
0
;
array
[
6
]
=
-
hx
;
array
[
7
]
=
hy
;
array
[
8
]
=
0
;
array
[
9
]
=
-
hx
;
array
[
10
]
=
-
hy
;
array
[
11
]
=
0
;
array
[
12
]
=
hx
;
array
[
13
]
=
-
hy
;
array
[
14
]
=
0
;
position
.
needsUpdate
=
true
;
...
...
src/helpers/SpotLightHelper.js
浏览文件 @
ba37015a
...
...
@@ -26,11 +26,11 @@ function SpotLightHelper( light, color ) {
var
geometry
=
new
BufferGeometry
();
var
positions
=
[
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
0
,
-
1
,
1
0
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
1
,
0
,
0
,
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
1
,
0
,
0
,
0
,
0
,
-
1
,
1
];
for
(
var
i
=
0
,
j
=
1
,
l
=
32
;
i
<
l
;
i
++
,
j
++
)
{
...
...
src/math/Interpolant.js
浏览文件 @
ba37015a
...
...
@@ -229,14 +229,14 @@ Object.assign( Interpolant.prototype, {
// Template methods for derived classes:
interpolate_
:
function
(
i1
,
t0
,
t
,
t1
)
{
interpolate_
:
function
(
/* i1, t0, t, t1 */
)
{
throw
new
Error
(
'
call to abstract method
'
);
// implementations shall return this.resultBuffer
},
intervalChanged_
:
function
(
i1
,
t0
,
t1
)
{
intervalChanged_
:
function
(
/* i1, t0, t1 */
)
{
// empty
...
...
src/math/Matrix3.js
浏览文件 @
ba37015a
...
...
@@ -80,8 +80,8 @@ Object.assign( Matrix3.prototype, {
this
.
set
(
me
[
0
],
me
[
4
],
me
[
8
],
me
[
1
],
me
[
5
],
me
[
9
],
me
[
0
],
me
[
4
],
me
[
8
],
me
[
1
],
me
[
5
],
me
[
9
],
me
[
2
],
me
[
6
],
me
[
10
]
);
...
...
src/math/Matrix4.js
浏览文件 @
ba37015a
...
...
@@ -112,7 +112,7 @@ Object.assign( Matrix4.prototype, {
xAxis
.
x
,
yAxis
.
x
,
zAxis
.
x
,
0
,
xAxis
.
y
,
yAxis
.
y
,
zAxis
.
y
,
0
,
xAxis
.
z
,
yAxis
.
z
,
zAxis
.
z
,
0
,
0
,
0
,
0
,
1
0
,
0
,
0
,
1
);
return
this
;
...
...
@@ -654,10 +654,10 @@ Object.assign( Matrix4.prototype, {
this
.
set
(
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
c
,
-
s
,
0
,
0
,
s
,
c
,
0
,
0
,
0
,
0
,
1
0
,
s
,
c
,
0
,
0
,
0
,
0
,
1
);
...
...
@@ -689,9 +689,9 @@ Object.assign( Matrix4.prototype, {
this
.
set
(
c
,
-
s
,
0
,
0
,
s
,
c
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
s
,
c
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
...
...
src/math/Vector3.js
浏览文件 @
ba37015a
...
...
@@ -282,8 +282,8 @@ Object.assign( Vector3.prototype, {
var
w
=
1
/
(
e
[
3
]
*
x
+
e
[
7
]
*
y
+
e
[
11
]
*
z
+
e
[
15
]
);
this
.
x
=
(
e
[
0
]
*
x
+
e
[
4
]
*
y
+
e
[
8
]
*
z
+
e
[
12
]
)
*
w
;
this
.
y
=
(
e
[
1
]
*
x
+
e
[
5
]
*
y
+
e
[
9
]
*
z
+
e
[
13
]
)
*
w
;
this
.
x
=
(
e
[
0
]
*
x
+
e
[
4
]
*
y
+
e
[
8
]
*
z
+
e
[
12
]
)
*
w
;
this
.
y
=
(
e
[
1
]
*
x
+
e
[
5
]
*
y
+
e
[
9
]
*
z
+
e
[
13
]
)
*
w
;
this
.
z
=
(
e
[
2
]
*
x
+
e
[
6
]
*
y
+
e
[
10
]
*
z
+
e
[
14
]
)
*
w
;
return
this
;
...
...
@@ -346,8 +346,8 @@ Object.assign( Vector3.prototype, {
var
x
=
this
.
x
,
y
=
this
.
y
,
z
=
this
.
z
;
var
e
=
m
.
elements
;
this
.
x
=
e
[
0
]
*
x
+
e
[
4
]
*
y
+
e
[
8
]
*
z
;
this
.
y
=
e
[
1
]
*
x
+
e
[
5
]
*
y
+
e
[
9
]
*
z
;
this
.
x
=
e
[
0
]
*
x
+
e
[
4
]
*
y
+
e
[
8
]
*
z
;
this
.
y
=
e
[
1
]
*
x
+
e
[
5
]
*
y
+
e
[
9
]
*
z
;
this
.
z
=
e
[
2
]
*
x
+
e
[
6
]
*
y
+
e
[
10
]
*
z
;
return
this
.
normalize
();
...
...
src/math/interpolants/DiscreteInterpolant.js
浏览文件 @
ba37015a
...
...
@@ -18,7 +18,7 @@ DiscreteInterpolant.prototype = Object.assign( Object.create( Interpolant.protot
constructor
:
DiscreteInterpolant
,
interpolate_
:
function
(
i1
,
t0
,
t
,
t1
)
{
interpolate_
:
function
(
i1
/*, t0, t, t1 */
)
{
return
this
.
copySampleValue_
(
i1
-
1
);
...
...
src/renderers/WebGL2Renderer.js
浏览文件 @
ba37015a
...
...
@@ -65,9 +65,7 @@ function WebGL2Renderer( parameters ) {
//
var
_this
=
this
,
_autoClear
=
true
,
var
_autoClear
=
true
,
_autoClearColor
=
true
,
_autoClearDepth
=
true
,
_autoClearStencil
=
true
,
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
ba37015a
...
...
@@ -510,7 +510,7 @@ function WebGLRenderer( parameters ) {
}
function
onContextRestore
(
event
)
{
function
onContextRestore
(
/* event */
)
{
console
.
log
(
'
THREE.WebGLRenderer: Context Restored.
'
);
...
...
src/renderers/webgl/WebGLFlareRenderer.js
浏览文件 @
ba37015a
...
...
@@ -19,8 +19,8 @@ function WebGLFlareRenderer( renderer, gl, state, textures, capabilities ) {
var
vertices
=
new
Float32Array
(
[
-
1
,
-
1
,
0
,
0
,
1
,
-
1
,
1
,
0
,
1
,
1
,
1
,
1
,
-
1
,
1
,
0
,
1
1
,
1
,
1
,
1
,
-
1
,
1
,
0
,
1
]
);
var
faces
=
new
Uint16Array
(
[
...
...
@@ -62,112 +62,112 @@ function WebGLFlareRenderer( renderer, gl, state, textures, capabilities ) {
vertexShader
:
[
"
uniform lowp int renderType;
"
,
'
uniform lowp int renderType;
'
,
"
uniform vec3 screenPosition;
"
,
"
uniform vec2 scale;
"
,
"
uniform float rotation;
"
,
'
uniform vec3 screenPosition;
'
,
'
uniform vec2 scale;
'
,
'
uniform float rotation;
'
,
"
uniform sampler2D occlusionMap;
"
,
'
uniform sampler2D occlusionMap;
'
,
"
attribute vec2 position;
"
,
"
attribute vec2 uv;
"
,
'
attribute vec2 position;
'
,
'
attribute vec2 uv;
'
,
"
varying vec2 vUV;
"
,
"
varying float vVisibility;
"
,
'
varying vec2 vUV;
'
,
'
varying float vVisibility;
'
,
"
void main() {
"
,
'
void main() {
'
,
"
vUV = uv;
"
,
'
vUV = uv;
'
,
"
vec2 pos = position;
"
,
'
vec2 pos = position;
'
,
"
if ( renderType == 2 ) {
"
,
'
if ( renderType == 2 ) {
'
,
"
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
"
,
"
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
"
,
'
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
'
,
'
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
'
,
"
vVisibility = visibility.r / 9.0;
"
,
"
vVisibility *= 1.0 - visibility.g / 9.0;
"
,
"
vVisibility *= visibility.b / 9.0;
"
,
"
vVisibility *= 1.0 - visibility.a / 9.0;
"
,
'
vVisibility = visibility.r / 9.0;
'
,
'
vVisibility *= 1.0 - visibility.g / 9.0;
'
,
'
vVisibility *= visibility.b / 9.0;
'
,
'
vVisibility *= 1.0 - visibility.a / 9.0;
'
,
"
pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;
"
,
"
pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;
"
,
'
pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;
'
,
'
pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;
'
,
"
}
"
,
'
}
'
,
"
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
"
,
'
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
'
,
"
}
"
'
}
'
].
join
(
"
\n
"
),
].
join
(
'
\n
'
),
fragmentShader
:
[
"
uniform lowp int renderType;
"
,
'
uniform lowp int renderType;
'
,
"
uniform sampler2D map;
"
,
"
uniform float opacity;
"
,
"
uniform vec3 color;
"
,
'
uniform sampler2D map;
'
,
'
uniform float opacity;
'
,
'
uniform vec3 color;
'
,
"
varying vec2 vUV;
"
,
"
varying float vVisibility;
"
,
'
varying vec2 vUV;
'
,
'
varying float vVisibility;
'
,
"
void main() {
"
,
'
void main() {
'
,
// pink square
// pink square
"
if ( renderType == 0 ) {
"
,
'
if ( renderType == 0 ) {
'
,
"
gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );
"
,
'
gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );
'
,
// restore
// restore
"
} else if ( renderType == 1 ) {
"
,
'
} else if ( renderType == 1 ) {
'
,
"
gl_FragColor = texture2D( map, vUV );
"
,
'
gl_FragColor = texture2D( map, vUV );
'
,
// flare
// flare
"
} else {
"
,
'
} else {
'
,
"
vec4 texture = texture2D( map, vUV );
"
,
"
texture.a *= opacity * vVisibility;
"
,
"
gl_FragColor = texture;
"
,
"
gl_FragColor.rgb *= color;
"
,
'
vec4 texture = texture2D( map, vUV );
'
,
'
texture.a *= opacity * vVisibility;
'
,
'
gl_FragColor = texture;
'
,
'
gl_FragColor.rgb *= color;
'
,
"
}
"
,
'
}
'
,
"
}
"
'
}
'
].
join
(
"
\n
"
)
].
join
(
'
\n
'
)
};
program
=
createProgram
(
shader
);
attributes
=
{
vertex
:
gl
.
getAttribLocation
(
program
,
"
position
"
),
uv
:
gl
.
getAttribLocation
(
program
,
"
uv
"
)
vertex
:
gl
.
getAttribLocation
(
program
,
'
position
'
),
uv
:
gl
.
getAttribLocation
(
program
,
'
uv
'
)
};
uniforms
=
{
renderType
:
gl
.
getUniformLocation
(
program
,
"
renderType
"
),
map
:
gl
.
getUniformLocation
(
program
,
"
map
"
),
occlusionMap
:
gl
.
getUniformLocation
(
program
,
"
occlusionMap
"
),
opacity
:
gl
.
getUniformLocation
(
program
,
"
opacity
"
),
color
:
gl
.
getUniformLocation
(
program
,
"
color
"
),
scale
:
gl
.
getUniformLocation
(
program
,
"
scale
"
),
rotation
:
gl
.
getUniformLocation
(
program
,
"
rotation
"
),
screenPosition
:
gl
.
getUniformLocation
(
program
,
"
screenPosition
"
)
renderType
:
gl
.
getUniformLocation
(
program
,
'
renderType
'
),
map
:
gl
.
getUniformLocation
(
program
,
'
map
'
),
occlusionMap
:
gl
.
getUniformLocation
(
program
,
'
occlusionMap
'
),
opacity
:
gl
.
getUniformLocation
(
program
,
'
opacity
'
),
color
:
gl
.
getUniformLocation
(
program
,
'
color
'
),
scale
:
gl
.
getUniformLocation
(
program
,
'
scale
'
),
rotation
:
gl
.
getUniformLocation
(
program
,
'
rotation
'
),
screenPosition
:
gl
.
getUniformLocation
(
program
,
'
screenPosition
'
)
};
}
...
...
@@ -364,7 +364,7 @@ function WebGLFlareRenderer( renderer, gl, state, textures, capabilities ) {
var
fragmentShader
=
gl
.
createShader
(
gl
.
FRAGMENT_SHADER
);
var
vertexShader
=
gl
.
createShader
(
gl
.
VERTEX_SHADER
);
var
prefix
=
"
precision
"
+
capabilities
.
precision
+
"
float;
\n
"
;
var
prefix
=
'
precision
'
+
capabilities
.
precision
+
'
float;
\n
'
;
gl
.
shaderSource
(
fragmentShader
,
prefix
+
shader
.
fragmentShader
);
gl
.
shaderSource
(
vertexShader
,
prefix
+
shader
.
vertexShader
);
...
...
src/renderers/webgl/WebGLSpriteRenderer.js
浏览文件 @
ba37015a
...
...
@@ -270,22 +270,22 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
'
void main() {
'
,
'
vUV = uvOffset + uv * uvScale;
'
,
'
vUV = uvOffset + uv * uvScale;
'
,
'
vec2 alignedPosition = position * scale;
'
,
'
vec2 alignedPosition = position * scale;
'
,
'
vec2 rotatedPosition;
'
,
'
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
'
,
'
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
'
,
'
vec2 rotatedPosition;
'
,
'
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
'
,
'
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
'
,
'
vec4 mvPosition;
'
,
'
vec4 mvPosition;
'
,
'
mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
'
,
'
mvPosition.xy += rotatedPosition;
'
,
'
mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
'
,
'
mvPosition.xy += rotatedPosition;
'
,
'
gl_Position = projectionMatrix * mvPosition;
'
,
'
gl_Position = projectionMatrix * mvPosition;
'
,
'
fogDepth = - mvPosition.z;
'
,
'
fogDepth = - mvPosition.z;
'
,
'
}
'
...
...
@@ -313,31 +313,31 @@ function WebGLSpriteRenderer( renderer, gl, state, textures, capabilities ) {
'
void main() {
'
,
'
vec4 texture = texture2D( map, vUV );
'
,
'
vec4 texture = texture2D( map, vUV );
'
,
'
gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );
'
,
'
gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );
'
,
'
if ( gl_FragColor.a < alphaTest ) discard;
'
,
'
if ( gl_FragColor.a < alphaTest ) discard;
'
,
'
if ( fogType > 0 ) {
'
,
'
if ( fogType > 0 ) {
'
,
'
float fogFactor = 0.0;
'
,
'
float fogFactor = 0.0;
'
,
'
if ( fogType == 1 ) {
'
,
'
if ( fogType == 1 ) {
'
,
'
fogFactor = smoothstep( fogNear, fogFar, fogDepth );
'
,
'
fogFactor = smoothstep( fogNear, fogFar, fogDepth );
'
,
'
} else {
'
,
'
} else {
'
,
'
const float LOG2 = 1.442695;
'
,
'
fogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );
'
,
'
fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );
'
,
'
const float LOG2 = 1.442695;
'
,
'
fogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );
'
,
'
fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );
'
,
'
}
'
,
'
}
'
,
'
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
'
,
'
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
'
,
'
}
'
,
'
}
'
,
'
}
'
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
ba37015a
...
...
@@ -7,7 +7,7 @@ import { _Math } from '../../math/Math.js';
function
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
utils
,
infoMemory
)
{
var
_isWebGL2
=
(
typeof
WebGL2RenderingContext
!==
'
undefined
'
&&
_gl
instanceof
WebGL2RenderingContext
);
var
_isWebGL2
=
(
typeof
WebGL2RenderingContext
!==
'
undefined
'
&&
_gl
instanceof
window
.
WebGL2RenderingContext
);
//
...
...
src/scenes/Fog.js
浏览文件 @
ba37015a
...
...
@@ -24,7 +24,7 @@ Fog.prototype.clone = function () {
};
Fog
.
prototype
.
toJSON
=
function
(
meta
)
{
Fog
.
prototype
.
toJSON
=
function
(
/* meta */
)
{
return
{
type
:
'
Fog
'
,
...
...
src/scenes/FogExp2.js
浏览文件 @
ba37015a
...
...
@@ -22,7 +22,7 @@ FogExp2.prototype.clone = function () {
};
FogExp2
.
prototype
.
toJSON
=
function
(
meta
)
{
FogExp2
.
prototype
.
toJSON
=
function
(
/* meta */
)
{
return
{
type
:
'
FogExp2
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录