Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1f2533c4
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,体验更适合开发者的 AI 搜索 >>
提交
1f2533c4
编写于
11月 23, 2020
作者:
L
linbingquan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
src: Implemented es6 default parameters.
上级
ceb1e4ad
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
92 addition
and
102 deletion
+92
-102
src/animation/AnimationAction.js
src/animation/AnimationAction.js
+3
-3
src/animation/AnimationUtils.js
src/animation/AnimationUtils.js
+1
-3
src/audio/AudioAnalyser.js
src/audio/AudioAnalyser.js
+2
-2
src/cameras/ArrayCamera.js
src/cameras/ArrayCamera.js
+2
-2
src/cameras/PerspectiveCamera.js
src/cameras/PerspectiveCamera.js
+5
-5
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+2
-2
src/core/Face3.js
src/core/Face3.js
+2
-2
src/extras/core/CurvePath.js
src/extras/core/CurvePath.js
+1
-3
src/extras/curves/CatmullRomCurve3.js
src/extras/curves/CatmullRomCurve3.js
+7
-7
src/extras/curves/CubicBezierCurve.js
src/extras/curves/CubicBezierCurve.js
+7
-7
src/extras/curves/CubicBezierCurve3.js
src/extras/curves/CubicBezierCurve3.js
+7
-7
src/extras/curves/LineCurve.js
src/extras/curves/LineCurve.js
+5
-5
src/extras/curves/LineCurve3.js
src/extras/curves/LineCurve3.js
+5
-5
src/extras/curves/QuadraticBezierCurve.js
src/extras/curves/QuadraticBezierCurve.js
+6
-6
src/extras/curves/QuadraticBezierCurve3.js
src/extras/curves/QuadraticBezierCurve3.js
+6
-6
src/extras/curves/SplineCurve.js
src/extras/curves/SplineCurve.js
+4
-4
src/helpers/GridHelper.js
src/helpers/GridHelper.js
+3
-5
src/helpers/PolarGridHelper.js
src/helpers/PolarGridHelper.js
+4
-8
src/lights/Light.js
src/lights/Light.js
+2
-2
src/renderers/webgl/WebGLBackground.js
src/renderers/webgl/WebGLBackground.js
+2
-2
src/textures/DataTexture2DArray.js
src/textures/DataTexture2DArray.js
+2
-2
src/textures/DataTexture3D.js
src/textures/DataTexture3D.js
+2
-2
src/textures/DepthTexture.js
src/textures/DepthTexture.js
+1
-1
src/textures/Texture.js
src/textures/Texture.js
+11
-11
未找到文件。
src/animation/AnimationAction.js
浏览文件 @
1f2533c4
...
...
@@ -3,12 +3,12 @@ import { WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, LoopPingPong, L
class
AnimationAction
{
constructor
(
mixer
,
clip
,
localRoot
,
blendMode
)
{
constructor
(
mixer
,
clip
,
localRoot
=
null
,
blendMode
=
clip
.
blendMode
)
{
this
.
_mixer
=
mixer
;
this
.
_clip
=
clip
;
this
.
_localRoot
=
localRoot
||
null
;
this
.
blendMode
=
blendMode
||
clip
.
blendMode
;
this
.
_localRoot
=
localRoot
;
this
.
blendMode
=
blendMode
;
const
tracks
=
clip
.
tracks
,
nTracks
=
tracks
.
length
,
...
...
src/animation/AnimationUtils.js
浏览文件 @
1f2533c4
...
...
@@ -157,9 +157,7 @@ const AnimationUtils = {
},
subclip
:
function
(
sourceClip
,
name
,
startFrame
,
endFrame
,
fps
)
{
fps
=
fps
||
30
;
subclip
:
function
(
sourceClip
,
name
,
startFrame
,
endFrame
,
fps
=
30
)
{
const
clip
=
sourceClip
.
clone
();
...
...
src/audio/AudioAnalyser.js
浏览文件 @
1f2533c4
class
AudioAnalyser
{
constructor
(
audio
,
fftSize
)
{
constructor
(
audio
,
fftSize
=
2048
)
{
this
.
analyser
=
audio
.
context
.
createAnalyser
();
this
.
analyser
.
fftSize
=
fftSize
!==
undefined
?
fftSize
:
2048
;
this
.
analyser
.
fftSize
=
fftSize
;
this
.
data
=
new
Uint8Array
(
this
.
analyser
.
frequencyBinCount
);
...
...
src/cameras/ArrayCamera.js
浏览文件 @
1f2533c4
import
{
PerspectiveCamera
}
from
'
./PerspectiveCamera.js
'
;
function
ArrayCamera
(
array
)
{
function
ArrayCamera
(
array
=
[]
)
{
PerspectiveCamera
.
call
(
this
);
this
.
cameras
=
array
||
[]
;
this
.
cameras
=
array
;
}
...
...
src/cameras/PerspectiveCamera.js
浏览文件 @
1f2533c4
...
...
@@ -2,20 +2,20 @@ import { Camera } from './Camera.js';
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
MathUtils
}
from
'
../math/MathUtils.js
'
;
function
PerspectiveCamera
(
fov
,
aspect
,
near
,
far
)
{
function
PerspectiveCamera
(
fov
=
50
,
aspect
=
1
,
near
=
0.1
,
far
=
2000
)
{
Camera
.
call
(
this
);
this
.
type
=
'
PerspectiveCamera
'
;
this
.
fov
=
fov
!==
undefined
?
fov
:
50
;
this
.
fov
=
fov
;
this
.
zoom
=
1
;
this
.
near
=
near
!==
undefined
?
near
:
0.1
;
this
.
far
=
far
!==
undefined
?
far
:
2000
;
this
.
near
=
near
;
this
.
far
=
far
;
this
.
focus
=
10
;
this
.
aspect
=
aspect
!==
undefined
?
aspect
:
1
;
this
.
aspect
=
aspect
;
this
.
view
=
null
;
this
.
filmGauge
=
35
;
// width of the film (default in millimeters)
...
...
src/core/BufferGeometry.js
浏览文件 @
1f2533c4
...
...
@@ -101,13 +101,13 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
},
addGroup
:
function
(
start
,
count
,
materialIndex
)
{
addGroup
:
function
(
start
,
count
,
materialIndex
=
0
)
{
this
.
groups
.
push
(
{
start
:
start
,
count
:
count
,
materialIndex
:
materialIndex
!==
undefined
?
materialIndex
:
0
materialIndex
:
materialIndex
}
);
...
...
src/core/Face3.js
浏览文件 @
1f2533c4
...
...
@@ -3,7 +3,7 @@ import { Vector3 } from '../math/Vector3.js';
class
Face3
{
constructor
(
a
,
b
,
c
,
normal
,
color
,
materialIndex
)
{
constructor
(
a
,
b
,
c
,
normal
,
color
,
materialIndex
=
0
)
{
this
.
a
=
a
;
this
.
b
=
b
;
...
...
@@ -15,7 +15,7 @@ class Face3 {
this
.
color
=
(
color
&&
color
.
isColor
)
?
color
:
new
Color
();
this
.
vertexColors
=
Array
.
isArray
(
color
)
?
color
:
[];
this
.
materialIndex
=
materialIndex
!==
undefined
?
materialIndex
:
0
;
this
.
materialIndex
=
materialIndex
;
}
...
...
src/extras/core/CurvePath.js
浏览文件 @
1f2533c4
...
...
@@ -154,9 +154,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), {
},
getPoints
:
function
(
divisions
)
{
divisions
=
divisions
||
12
;
getPoints
:
function
(
divisions
=
12
)
{
const
points
=
[];
let
last
;
...
...
src/extras/curves/CatmullRomCurve3.js
浏览文件 @
1f2533c4
...
...
@@ -81,16 +81,16 @@ function CubicPoly() {
const
tmp
=
new
Vector3
();
const
px
=
new
CubicPoly
(),
py
=
new
CubicPoly
(),
pz
=
new
CubicPoly
();
function
CatmullRomCurve3
(
points
,
closed
,
curveType
,
tension
)
{
function
CatmullRomCurve3
(
points
=
[],
closed
=
false
,
curveType
=
'
centripetal
'
,
tension
=
0.5
)
{
Curve
.
call
(
this
);
this
.
type
=
'
CatmullRomCurve3
'
;
this
.
points
=
points
||
[]
;
this
.
closed
=
closed
||
false
;
this
.
curveType
=
curveType
||
'
centripetal
'
;
this
.
tension
=
(
tension
!==
undefined
)
?
tension
:
0.5
;
this
.
points
=
points
;
this
.
closed
=
closed
;
this
.
curveType
=
curveType
;
this
.
tension
=
tension
;
}
...
...
@@ -99,9 +99,9 @@ CatmullRomCurve3.prototype.constructor = CatmullRomCurve3;
CatmullRomCurve3
.
prototype
.
isCatmullRomCurve3
=
true
;
CatmullRomCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
CatmullRomCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector3
()
)
{
const
point
=
optionalTarget
||
new
Vector3
()
;
const
point
=
optionalTarget
;
const
points
=
this
.
points
;
const
l
=
points
.
length
;
...
...
src/extras/curves/CubicBezierCurve.js
浏览文件 @
1f2533c4
...
...
@@ -2,16 +2,16 @@ import { Curve } from '../core/Curve.js';
import
{
CubicBezier
}
from
'
../core/Interpolations.js
'
;
import
{
Vector2
}
from
'
../../math/Vector2.js
'
;
function
CubicBezierCurve
(
v0
,
v1
,
v2
,
v3
)
{
function
CubicBezierCurve
(
v0
=
new
Vector2
(),
v1
=
new
Vector2
(),
v2
=
new
Vector2
(),
v3
=
new
Vector2
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
CubicBezierCurve
'
;
this
.
v0
=
v0
||
new
Vector2
()
;
this
.
v1
=
v1
||
new
Vector2
()
;
this
.
v2
=
v2
||
new
Vector2
()
;
this
.
v3
=
v3
||
new
Vector2
()
;
this
.
v0
=
v0
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
this
.
v3
=
v3
;
}
...
...
@@ -20,9 +20,9 @@ CubicBezierCurve.prototype.constructor = CubicBezierCurve;
CubicBezierCurve
.
prototype
.
isCubicBezierCurve
=
true
;
CubicBezierCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
CubicBezierCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector2
()
)
{
const
point
=
optionalTarget
||
new
Vector2
()
;
const
point
=
optionalTarget
;
const
v0
=
this
.
v0
,
v1
=
this
.
v1
,
v2
=
this
.
v2
,
v3
=
this
.
v3
;
...
...
src/extras/curves/CubicBezierCurve3.js
浏览文件 @
1f2533c4
...
...
@@ -2,16 +2,16 @@ import { Curve } from '../core/Curve.js';
import
{
CubicBezier
}
from
'
../core/Interpolations.js
'
;
import
{
Vector3
}
from
'
../../math/Vector3.js
'
;
function
CubicBezierCurve3
(
v0
,
v1
,
v2
,
v3
)
{
function
CubicBezierCurve3
(
v0
=
new
Vector3
(),
v1
=
new
Vector3
(),
v2
=
new
Vector3
(),
v3
=
new
Vector3
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
CubicBezierCurve3
'
;
this
.
v0
=
v0
||
new
Vector3
()
;
this
.
v1
=
v1
||
new
Vector3
()
;
this
.
v2
=
v2
||
new
Vector3
()
;
this
.
v3
=
v3
||
new
Vector3
()
;
this
.
v0
=
v0
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
this
.
v3
=
v3
;
}
...
...
@@ -20,9 +20,9 @@ CubicBezierCurve3.prototype.constructor = CubicBezierCurve3;
CubicBezierCurve3
.
prototype
.
isCubicBezierCurve3
=
true
;
CubicBezierCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
CubicBezierCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector3
()
)
{
const
point
=
optionalTarget
||
new
Vector3
()
;
const
point
=
optionalTarget
;
const
v0
=
this
.
v0
,
v1
=
this
.
v1
,
v2
=
this
.
v2
,
v3
=
this
.
v3
;
...
...
src/extras/curves/LineCurve.js
浏览文件 @
1f2533c4
import
{
Vector2
}
from
'
../../math/Vector2.js
'
;
import
{
Curve
}
from
'
../core/Curve.js
'
;
function
LineCurve
(
v1
,
v2
)
{
function
LineCurve
(
v1
=
new
Vector2
(),
v2
=
new
Vector2
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
LineCurve
'
;
this
.
v1
=
v1
||
new
Vector2
()
;
this
.
v2
=
v2
||
new
Vector2
()
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
}
...
...
@@ -17,9 +17,9 @@ LineCurve.prototype.constructor = LineCurve;
LineCurve
.
prototype
.
isLineCurve
=
true
;
LineCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
LineCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector2
()
)
{
const
point
=
optionalTarget
||
new
Vector2
()
;
const
point
=
optionalTarget
;
if
(
t
===
1
)
{
...
...
src/extras/curves/LineCurve3.js
浏览文件 @
1f2533c4
import
{
Vector3
}
from
'
../../math/Vector3.js
'
;
import
{
Curve
}
from
'
../core/Curve.js
'
;
function
LineCurve3
(
v1
,
v2
)
{
function
LineCurve3
(
v1
=
new
Vector3
(),
v2
=
new
Vector3
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
LineCurve3
'
;
this
.
v1
=
v1
||
new
Vector3
()
;
this
.
v2
=
v2
||
new
Vector3
()
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
}
...
...
@@ -17,9 +17,9 @@ LineCurve3.prototype.constructor = LineCurve3;
LineCurve3
.
prototype
.
isLineCurve3
=
true
;
LineCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
LineCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector3
()
)
{
const
point
=
optionalTarget
||
new
Vector3
()
;
const
point
=
optionalTarget
;
if
(
t
===
1
)
{
...
...
src/extras/curves/QuadraticBezierCurve.js
浏览文件 @
1f2533c4
...
...
@@ -2,15 +2,15 @@ import { Curve } from '../core/Curve.js';
import
{
QuadraticBezier
}
from
'
../core/Interpolations.js
'
;
import
{
Vector2
}
from
'
../../math/Vector2.js
'
;
function
QuadraticBezierCurve
(
v0
,
v1
,
v2
)
{
function
QuadraticBezierCurve
(
v0
=
new
Vector2
(),
v1
=
new
Vector2
(),
v2
=
new
Vector2
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
QuadraticBezierCurve
'
;
this
.
v0
=
v0
||
new
Vector2
()
;
this
.
v1
=
v1
||
new
Vector2
()
;
this
.
v2
=
v2
||
new
Vector2
()
;
this
.
v0
=
v0
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
}
...
...
@@ -19,9 +19,9 @@ QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
QuadraticBezierCurve
.
prototype
.
isQuadraticBezierCurve
=
true
;
QuadraticBezierCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
QuadraticBezierCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector2
()
)
{
const
point
=
optionalTarget
||
new
Vector2
()
;
const
point
=
optionalTarget
;
const
v0
=
this
.
v0
,
v1
=
this
.
v1
,
v2
=
this
.
v2
;
...
...
src/extras/curves/QuadraticBezierCurve3.js
浏览文件 @
1f2533c4
...
...
@@ -2,15 +2,15 @@ import { Curve } from '../core/Curve.js';
import
{
QuadraticBezier
}
from
'
../core/Interpolations.js
'
;
import
{
Vector3
}
from
'
../../math/Vector3.js
'
;
function
QuadraticBezierCurve3
(
v0
,
v1
,
v2
)
{
function
QuadraticBezierCurve3
(
v0
=
new
Vector3
(),
v1
=
new
Vector3
(),
v2
=
new
Vector3
()
)
{
Curve
.
call
(
this
);
this
.
type
=
'
QuadraticBezierCurve3
'
;
this
.
v0
=
v0
||
new
Vector3
()
;
this
.
v1
=
v1
||
new
Vector3
()
;
this
.
v2
=
v2
||
new
Vector3
()
;
this
.
v0
=
v0
;
this
.
v1
=
v1
;
this
.
v2
=
v2
;
}
...
...
@@ -19,9 +19,9 @@ QuadraticBezierCurve3.prototype.constructor = QuadraticBezierCurve3;
QuadraticBezierCurve3
.
prototype
.
isQuadraticBezierCurve3
=
true
;
QuadraticBezierCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
QuadraticBezierCurve3
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector3
()
)
{
const
point
=
optionalTarget
||
new
Vector3
()
;
const
point
=
optionalTarget
;
const
v0
=
this
.
v0
,
v1
=
this
.
v1
,
v2
=
this
.
v2
;
...
...
src/extras/curves/SplineCurve.js
浏览文件 @
1f2533c4
...
...
@@ -2,13 +2,13 @@ import { Curve } from '../core/Curve.js';
import
{
CatmullRom
}
from
'
../core/Interpolations.js
'
;
import
{
Vector2
}
from
'
../../math/Vector2.js
'
;
function
SplineCurve
(
points
)
{
function
SplineCurve
(
points
=
[]
)
{
Curve
.
call
(
this
);
this
.
type
=
'
SplineCurve
'
;
this
.
points
=
points
||
[]
;
this
.
points
=
points
;
}
...
...
@@ -17,9 +17,9 @@ SplineCurve.prototype.constructor = SplineCurve;
SplineCurve
.
prototype
.
isSplineCurve
=
true
;
SplineCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
)
{
SplineCurve
.
prototype
.
getPoint
=
function
(
t
,
optionalTarget
=
new
Vector2
()
)
{
const
point
=
optionalTarget
||
new
Vector2
()
;
const
point
=
optionalTarget
;
const
points
=
this
.
points
;
const
p
=
(
points
.
length
-
1
)
*
t
;
...
...
src/helpers/GridHelper.js
浏览文件 @
1f2533c4
...
...
@@ -6,12 +6,10 @@ import { Color } from '../math/Color.js';
class
GridHelper
extends
LineSegments
{
constructor
(
size
,
divisions
,
color1
,
color2
)
{
constructor
(
size
=
10
,
divisions
=
10
,
color1
=
0x444444
,
color2
=
0x888888
)
{
size
=
size
||
10
;
divisions
=
divisions
||
10
;
color1
=
new
Color
(
color1
!==
undefined
?
color1
:
0x444444
);
color2
=
new
Color
(
color2
!==
undefined
?
color2
:
0x888888
);
color1
=
new
Color
(
color1
);
color2
=
new
Color
(
color2
);
const
center
=
divisions
/
2
;
const
step
=
size
/
divisions
;
...
...
src/helpers/PolarGridHelper.js
浏览文件 @
1f2533c4
...
...
@@ -6,14 +6,10 @@ import { Color } from '../math/Color.js';
class
PolarGridHelper
extends
LineSegments
{
constructor
(
radius
,
radials
,
circles
,
divisions
,
color1
,
color2
)
{
radius
=
radius
||
10
;
radials
=
radials
||
16
;
circles
=
circles
||
8
;
divisions
=
divisions
||
64
;
color1
=
new
Color
(
color1
!==
undefined
?
color1
:
0x444444
);
color2
=
new
Color
(
color2
!==
undefined
?
color2
:
0x888888
);
constructor
(
radius
=
10
,
radials
=
16
,
circles
=
8
,
divisions
=
64
,
color1
=
0x444444
,
color2
=
0x888888
)
{
color1
=
new
Color
(
color1
);
color2
=
new
Color
(
color2
);
const
vertices
=
[];
const
colors
=
[];
...
...
src/lights/Light.js
浏览文件 @
1f2533c4
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
function
Light
(
color
,
intensity
)
{
function
Light
(
color
,
intensity
=
1
)
{
Object3D
.
call
(
this
);
this
.
type
=
'
Light
'
;
this
.
color
=
new
Color
(
color
);
this
.
intensity
=
intensity
!==
undefined
?
intensity
:
1
;
this
.
intensity
=
intensity
;
}
...
...
src/renderers/webgl/WebGLBackground.js
浏览文件 @
1f2533c4
...
...
@@ -204,10 +204,10 @@ function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha
return
clearColor
;
},
setClearColor
:
function
(
color
,
alpha
)
{
setClearColor
:
function
(
color
,
alpha
=
1
)
{
clearColor
.
set
(
color
);
clearAlpha
=
alpha
!==
undefined
?
alpha
:
1
;
clearAlpha
=
alpha
;
setClear
(
clearColor
,
clearAlpha
);
},
...
...
src/textures/DataTexture2DArray.js
浏览文件 @
1f2533c4
import
{
Texture
}
from
'
./Texture.js
'
;
import
{
ClampToEdgeWrapping
,
NearestFilter
}
from
'
../constants.js
'
;
function
DataTexture2DArray
(
data
,
width
,
height
,
depth
)
{
function
DataTexture2DArray
(
data
=
null
,
width
=
1
,
height
=
1
,
depth
=
1
)
{
Texture
.
call
(
this
,
null
);
this
.
image
=
{
data
:
data
||
null
,
width
:
width
||
1
,
height
:
height
||
1
,
depth
:
depth
||
1
};
this
.
image
=
{
data
,
width
,
height
,
depth
};
this
.
magFilter
=
NearestFilter
;
this
.
minFilter
=
NearestFilter
;
...
...
src/textures/DataTexture3D.js
浏览文件 @
1f2533c4
import
{
Texture
}
from
'
./Texture.js
'
;
import
{
ClampToEdgeWrapping
,
NearestFilter
}
from
'
../constants.js
'
;
function
DataTexture3D
(
data
,
width
,
height
,
depth
)
{
function
DataTexture3D
(
data
=
null
,
width
=
1
,
height
=
1
,
depth
=
1
)
{
// We're going to add .setXXX() methods for setting properties later.
// Users can still set in DataTexture3D directly.
...
...
@@ -13,7 +13,7 @@ function DataTexture3D( data, width, height, depth ) {
Texture
.
call
(
this
,
null
);
this
.
image
=
{
data
:
data
||
null
,
width
:
width
||
1
,
height
:
height
||
1
,
depth
:
depth
||
1
};
this
.
image
=
{
data
,
width
,
height
,
depth
};
this
.
magFilter
=
NearestFilter
;
this
.
minFilter
=
NearestFilter
;
...
...
src/textures/DepthTexture.js
浏览文件 @
1f2533c4
...
...
@@ -22,7 +22,7 @@ function DepthTexture( width, height, type, mapping, wrapS, wrapT, magFilter, mi
this
.
minFilter
=
minFilter
!==
undefined
?
minFilter
:
NearestFilter
;
this
.
flipY
=
false
;
this
.
generateMipmaps
=
false
;
this
.
generateMipmaps
=
false
;
}
...
...
src/textures/Texture.js
浏览文件 @
1f2533c4
...
...
@@ -17,7 +17,7 @@ import { ImageUtils } from '../extras/ImageUtils.js';
let
textureId
=
0
;
function
Texture
(
image
,
mapping
,
wrapS
,
wrapT
,
magFilter
,
minFilter
,
format
,
type
,
anisotropy
,
e
ncoding
)
{
function
Texture
(
image
=
Texture
.
DEFAULT_IMAGE
,
mapping
=
Texture
.
DEFAULT_MAPPING
,
wrapS
=
ClampToEdgeWrapping
,
wrapT
=
ClampToEdgeWrapping
,
magFilter
=
LinearFilter
,
minFilter
=
LinearMipmapLinearFilter
,
format
=
RGBAFormat
,
type
=
UnsignedByteType
,
anisotropy
=
1
,
encoding
=
LinearE
ncoding
)
{
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
textureId
++
}
);
...
...
@@ -25,22 +25,22 @@ function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, ty
this
.
name
=
''
;
this
.
image
=
image
!==
undefined
?
image
:
Texture
.
DEFAULT_IMAGE
;
this
.
image
=
image
;
this
.
mipmaps
=
[];
this
.
mapping
=
mapping
!==
undefined
?
mapping
:
Texture
.
DEFAULT_MAPPING
;
this
.
mapping
=
mapping
;
this
.
wrapS
=
wrapS
!==
undefined
?
wrapS
:
ClampToEdgeWrapping
;
this
.
wrapT
=
wrapT
!==
undefined
?
wrapT
:
ClampToEdgeWrapping
;
this
.
wrapS
=
wrapS
;
this
.
wrapT
=
wrapT
;
this
.
magFilter
=
magFilter
!==
undefined
?
magFilter
:
LinearFilter
;
this
.
minFilter
=
minFilter
!==
undefined
?
minFilter
:
LinearMipmapLinearFilter
;
this
.
magFilter
=
magFilter
;
this
.
minFilter
=
minFilter
;
this
.
anisotropy
=
anisotropy
!==
undefined
?
anisotropy
:
1
;
this
.
anisotropy
=
anisotropy
;
this
.
format
=
format
!==
undefined
?
format
:
RGBAFormat
;
this
.
format
=
format
;
this
.
internalFormat
=
null
;
this
.
type
=
type
!==
undefined
?
type
:
UnsignedByteType
;
this
.
type
=
type
;
this
.
offset
=
new
Vector2
(
0
,
0
);
this
.
repeat
=
new
Vector2
(
1
,
1
);
...
...
@@ -59,7 +59,7 @@ function Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, ty
//
// Also changing the encoding after already used by a Material will not automatically make the Material
// update. You need to explicitly call Material.needsUpdate to trigger it to recompile.
this
.
encoding
=
encoding
!==
undefined
?
encoding
:
LinearEncoding
;
this
.
encoding
=
encoding
;
this
.
version
=
0
;
this
.
onUpdate
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录