Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
db1c841e
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,发现更多精彩内容 >>
提交
db1c841e
编写于
12月 17, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
90ad637b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
95 addition
and
1 deletion
+95
-1
build/three.js
build/three.js
+91
-0
build/three.min.js
build/three.min.js
+4
-1
未找到文件。
build/three.js
浏览文件 @
db1c841e
...
...
@@ -17160,6 +17160,97 @@ THREE.PerspectiveCamera.prototype.toJSON = function ( meta ) {
};
// File:src/cameras/StereoCamera.js
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.StereoCamera = function ( fov, aspect, near, far ) {
THREE.PerspectiveCamera.call( this, fov, aspect, near, far );
this.type = 'StereoCamera';
this.focalLength = 125;
this.cameraL = new THREE.PerspectiveCamera();
this.cameraL.matrixAutoUpdate = false;
this.cameraR = new THREE.PerspectiveCamera();
this.cameraR.matrixAutoUpdate = false;
};
THREE.StereoCamera.prototype = Object.create( THREE.PerspectiveCamera.prototype );
THREE.StereoCamera.prototype.constructor = THREE.StereoCamera;
THREE.StereoCamera.prototype.updateMatrixWorld = ( function () {
var focalLength, fov, aspect, near, far;
var eyeRight = new THREE.Matrix4();
var eyeLeft = new THREE.Matrix4();
return function updateMatrixWorld ( force ) {
THREE.Object3D.prototype.updateMatrixWorld.call( this, force );
var needsUpdate = focalLength !== this.focalLength || fov !== this.fov ||
aspect !== this.aspect || near !== this.near ||
far !== this.far;
if ( needsUpdate ) {
focalLength = this.focalLength;
fov = this.fov;
aspect = this.aspect;
near = this.near;
far = this.far;
// Off-axis stereoscopic effect based on
// http://paulbourke.net/stereographics/stereorender/
var projectionMatrix = this.projectionMatrix.clone();
var eyeSep = focalLength / 30 * 0.5;
var eyeSepOnProjection = eyeSep * near / focalLength;
var ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) );
var xmin, xmax;
// translate xOffset
eyeLeft.elements[ 12 ] = - eyeSep;
eyeRight.elements[ 12 ] = eyeSep;
// for left eye
xmin = - ymax * aspect + eyeSepOnProjection;
xmax = ymax * aspect + eyeSepOnProjection;
projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin );
projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
this.cameraL.projectionMatrix.copy( projectionMatrix );
// for right eye
xmin = - ymax * aspect - eyeSepOnProjection;
xmax = ymax * aspect - eyeSepOnProjection;
projectionMatrix.elements[ 0 ] = 2 * near / ( xmax - xmin );
projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
this.cameraR.projectionMatrix.copy( projectionMatrix );
}
this.cameraL.matrixWorld.copy( this.matrixWorld ).multiply( eyeLeft );
this.cameraR.matrixWorld.copy( this.matrixWorld ).multiply( eyeRight );
};
} )();
// File:src/lights/Light.js
/**
...
...
build/three.min.js
浏览文件 @
db1c841e
...
...
@@ -355,7 +355,10 @@ THREE.OrthographicCamera.prototype.toJSON=function(a){a=THREE.Object3D.prototype
THREE
.
PerspectiveCamera
.
prototype
=
Object
.
create
(
THREE
.
Camera
.
prototype
);
THREE
.
PerspectiveCamera
.
prototype
.
constructor
=
THREE
.
PerspectiveCamera
;
THREE
.
PerspectiveCamera
.
prototype
.
setLens
=
function
(
a
,
b
){
void
0
===
b
&&
(
b
=
24
);
this
.
fov
=
2
*
THREE
.
Math
.
radToDeg
(
Math
.
atan
(
b
/
(
2
*
a
)));
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
setViewOffset
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
fullWidth
=
a
;
this
.
fullHeight
=
b
;
this
.
x
=
c
;
this
.
y
=
d
;
this
.
width
=
e
;
this
.
height
=
f
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
updateProjectionMatrix
=
function
(){
var
a
=
THREE
.
Math
.
radToDeg
(
2
*
Math
.
atan
(
Math
.
tan
(.
5
*
THREE
.
Math
.
degToRad
(
this
.
fov
))
/
this
.
zoom
));
if
(
this
.
fullWidth
){
var
b
=
this
.
fullWidth
/
this
.
fullHeight
,
a
=
Math
.
tan
(
THREE
.
Math
.
degToRad
(.
5
*
a
))
*
this
.
near
,
c
=-
a
,
d
=
b
*
c
,
b
=
Math
.
abs
(
b
*
a
-
d
),
c
=
Math
.
abs
(
a
-
c
);
this
.
projectionMatrix
.
makeFrustum
(
d
+
this
.
x
*
b
/
this
.
fullWidth
,
d
+
(
this
.
x
+
this
.
width
)
*
b
/
this
.
fullWidth
,
a
-
(
this
.
y
+
this
.
height
)
*
c
/
this
.
fullHeight
,
a
-
this
.
y
*
c
/
this
.
fullHeight
,
this
.
near
,
this
.
far
)}
else
this
.
projectionMatrix
.
makePerspective
(
a
,
this
.
aspect
,
this
.
near
,
this
.
far
)};
THREE
.
PerspectiveCamera
.
prototype
.
copy
=
function
(
a
){
THREE
.
Camera
.
prototype
.
copy
.
call
(
this
,
a
);
this
.
fov
=
a
.
fov
;
this
.
aspect
=
a
.
aspect
;
this
.
near
=
a
.
near
;
this
.
far
=
a
.
far
;
this
.
zoom
=
a
.
zoom
;
return
this
};
THREE
.
PerspectiveCamera
.
prototype
.
toJSON
=
function
(
a
){
a
=
THREE
.
Object3D
.
prototype
.
toJSON
.
call
(
this
,
a
);
a
.
object
.
zoom
=
this
.
zoom
;
a
.
object
.
fov
=
this
.
fov
;
a
.
object
.
aspect
=
this
.
aspect
;
a
.
object
.
near
=
this
.
near
;
a
.
object
.
far
=
this
.
far
;
return
a
};
THREE
.
Light
=
function
(
a
,
b
){
THREE
.
Object3D
.
call
(
this
);
this
.
type
=
"
Light
"
;
this
.
color
=
new
THREE
.
Color
(
a
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
receiveShadow
=
void
0
};
THREE
.
Light
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
copy
=
function
(
a
){
THREE
.
Object3D
.
prototype
.
copy
.
call
(
this
,
a
);
this
.
color
.
copy
(
a
.
color
);
this
.
intensity
=
a
.
intensity
;
return
this
};
THREE
.
StereoCamera
=
function
(
a
,
b
,
c
,
d
){
THREE
.
PerspectiveCamera
.
call
(
this
,
a
,
b
,
c
,
d
);
this
.
type
=
"
StereoCamera
"
;
this
.
focalLength
=
125
;
this
.
cameraL
=
new
THREE
.
PerspectiveCamera
;
this
.
cameraL
.
matrixAutoUpdate
=!
1
;
this
.
cameraR
=
new
THREE
.
PerspectiveCamera
;
this
.
cameraR
.
matrixAutoUpdate
=!
1
};
THREE
.
StereoCamera
.
prototype
=
Object
.
create
(
THREE
.
PerspectiveCamera
.
prototype
);
THREE
.
StereoCamera
.
prototype
.
constructor
=
THREE
.
StereoCamera
;
THREE
.
StereoCamera
.
prototype
.
updateMatrixWorld
=
function
(){
var
a
,
b
,
c
,
d
,
e
,
f
=
new
THREE
.
Matrix4
,
g
=
new
THREE
.
Matrix4
;
return
function
(
h
){
THREE
.
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
h
);
if
(
a
!==
this
.
focalLength
||
b
!==
this
.
fov
||
c
!==
this
.
aspect
||
d
!==
this
.
near
||
e
!==
this
.
far
){
a
=
this
.
focalLength
;
b
=
this
.
fov
;
c
=
this
.
aspect
;
d
=
this
.
near
;
e
=
this
.
far
;
h
=
this
.
projectionMatrix
.
clone
();
var
k
=
a
/
30
*
.
5
,
l
=
k
*
d
/
a
,
m
=
d
*
Math
.
tan
(
THREE
.
Math
.
degToRad
(.
5
*
b
)),
p
;
g
.
elements
[
12
]
=-
k
;
f
.
elements
[
12
]
=
k
;
k
=-
m
*
c
+
l
;
p
=
m
*
c
+
l
;
h
.
elements
[
0
]
=
2
*
d
/
(
p
-
k
);
h
.
elements
[
8
]
=
(
p
+
k
)
/
(
p
-
k
);
this
.
cameraL
.
projectionMatrix
.
copy
(
h
);
k
=-
m
*
c
-
l
;
p
=
m
*
c
-
l
;
h
.
elements
[
0
]
=
2
*
d
/
(
p
-
k
);
h
.
elements
[
8
]
=
(
p
+
k
)
/
(
p
-
k
);
this
.
cameraR
.
projectionMatrix
.
copy
(
h
)}
this
.
cameraL
.
matrixWorld
.
copy
(
this
.
matrixWorld
).
multiply
(
g
);
this
.
cameraR
.
matrixWorld
.
copy
(
this
.
matrixWorld
).
multiply
(
f
)}}();
THREE
.
Light
=
function
(
a
,
b
){
THREE
.
Object3D
.
call
(
this
);
this
.
type
=
"
Light
"
;
this
.
color
=
new
THREE
.
Color
(
a
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
receiveShadow
=
void
0
};
THREE
.
Light
.
prototype
=
Object
.
create
(
THREE
.
Object3D
.
prototype
);
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
copy
=
function
(
a
){
THREE
.
Object3D
.
prototype
.
copy
.
call
(
this
,
a
);
this
.
color
.
copy
(
a
.
color
);
this
.
intensity
=
a
.
intensity
;
return
this
};
THREE
.
Light
.
prototype
.
toJSON
=
function
(
a
){
a
=
THREE
.
Object3D
.
prototype
.
toJSON
.
call
(
this
,
a
);
a
.
object
.
color
=
this
.
color
.
getHex
();
a
.
object
.
intensity
=
this
.
intensity
;
void
0
!==
this
.
groundColor
&&
(
a
.
object
.
groundColor
=
this
.
groundColor
.
getHex
());
void
0
!==
this
.
distance
&&
(
a
.
object
.
distance
=
this
.
distance
);
void
0
!==
this
.
angle
&&
(
a
.
object
.
angle
=
this
.
angle
);
void
0
!==
this
.
decay
&&
(
a
.
object
.
decay
=
this
.
decay
);
void
0
!==
this
.
exponent
&&
(
a
.
object
.
exponent
=
this
.
exponent
);
return
a
};
THREE
.
LightShadow
=
function
(
a
){
this
.
camera
=
a
;
this
.
bias
=
0
;
this
.
darkness
=
1
;
this
.
mapSize
=
new
THREE
.
Vector2
(
512
,
512
);
this
.
matrix
=
this
.
map
=
null
};
THREE
.
LightShadow
.
prototype
=
{
constructor
:
THREE
.
LightShadow
,
copy
:
function
(
a
){
this
.
camera
=
a
.
camera
.
clone
();
this
.
bias
=
a
.
bias
;
this
.
darkness
=
a
.
darkness
;
this
.
mapSize
.
copy
(
a
.
mapSize
);
return
this
},
clone
:
function
(){
return
(
new
this
.
constructor
).
copy
(
this
)}};
THREE
.
AmbientLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
,
b
);
this
.
type
=
"
AmbientLight
"
;
this
.
castShadow
=
void
0
};
THREE
.
AmbientLight
.
prototype
=
Object
.
create
(
THREE
.
Light
.
prototype
);
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
,
b
);
this
.
type
=
"
DirectionalLight
"
;
this
.
position
.
set
(
0
,
1
,
0
);
this
.
updateMatrix
();
this
.
target
=
new
THREE
.
Object3D
;
this
.
shadow
=
new
THREE
.
LightShadow
(
new
THREE
.
OrthographicCamera
(
-
5
,
5
,
5
,
-
5
,.
5
,
500
))};
THREE
.
DirectionalLight
.
prototype
=
Object
.
create
(
THREE
.
Light
.
prototype
);
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录