Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
685ca28c
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,发现更多精彩内容 >>
提交
685ca28c
编写于
2月 05, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'bhouston/deprecate-m4-getPosition' into dev
上级
31bd01a2
c589751d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
45 deletion
+60
-45
examples/js/renderers/WebGLDeferredRenderer.js
examples/js/renderers/WebGLDeferredRenderer.js
+12
-9
src/core/Raycaster.js
src/core/Raycaster.js
+5
-2
src/extras/renderers/plugins/ShadowMapPlugin.js
src/extras/renderers/plugins/ShadowMapPlugin.js
+5
-2
src/math/Matrix4.js
src/math/Matrix4.js
+2
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+18
-16
src/renderers/WebGLRenderer2.js
src/renderers/WebGLRenderer2.js
+18
-16
未找到文件。
examples/js/renderers/WebGLDeferredRenderer.js
浏览文件 @
685ca28c
...
...
@@ -40,6 +40,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
var
positionVS
=
new
THREE
.
Vector3
();
var
directionVS
=
new
THREE
.
Vector3
();
var
tempVS
=
new
THREE
.
Vector3
();
var
rightVS
=
new
THREE
.
Vector3
();
var
normalVS
=
new
THREE
.
Vector3
();
...
...
@@ -330,12 +331,12 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
lightProxy
.
scale
.
set
(
1
,
1
,
1
).
multiplyScalar
(
distance
);
uniforms
[
"
lightRadius
"
].
value
=
distance
;
positionVS
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
positionVS
.
getPositionFromMatrix
(
light
.
matrixWorld
);
positionVS
.
applyMatrix4
(
camera
.
matrixWorldInverse
);
uniforms
[
"
lightPositionVS
"
].
value
.
copy
(
positionVS
);
lightProxy
.
position
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
lightProxy
.
position
.
getPositionFromMatrix
(
light
.
matrixWorld
);
}
else
{
...
...
@@ -422,11 +423,12 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
var
viewMatrix
=
camera
.
matrixWorldInverse
;
var
modelMatrix
=
light
.
matrixWorld
;
positionVS
.
copy
(
modelMatrix
.
getPosition
()
);
positionVS
.
getPositionFromMatrix
(
modelMatrix
);
positionVS
.
applyMatrix4
(
viewMatrix
);
directionVS
.
copy
(
modelMatrix
.
getPosition
()
);
directionVS
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
directionVS
.
getPositionFromMatrix
(
modelMatrix
);
tempVS
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
directionVS
.
sub
(
tempVS
);
directionVS
.
normalize
();
viewMatrix
.
rotateAxis
(
directionVS
);
...
...
@@ -495,8 +497,9 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
var
light
=
lightProxy
.
properties
.
originalLight
;
var
uniforms
=
lightProxy
.
material
.
uniforms
;
directionVS
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
directionVS
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
directionVS
.
getPositionFromMatrix
(
light
.
matrixWorld
);
tempVS
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
directionVS
.
sub
(
tempVS
);
directionVS
.
normalize
();
camera
.
matrixWorldInverse
.
rotateAxis
(
directionVS
);
...
...
@@ -561,7 +564,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
var
light
=
lightProxy
.
properties
.
originalLight
;
var
uniforms
=
lightProxy
.
material
.
uniforms
;
directionVS
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
directionVS
.
getPositionFromMatrix
(
light
.
matrixWorld
);
directionVS
.
normalize
();
camera
.
matrixWorldInverse
.
rotateAxis
(
directionVS
);
...
...
@@ -630,7 +633,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
var
modelMatrix
=
light
.
matrixWorld
;
var
viewMatrix
=
camera
.
matrixWorldInverse
;
positionVS
.
copy
(
modelMatrix
.
getPosition
()
);
positionVS
.
getPositionFromMatrix
(
modelMatrix
);
positionVS
.
applyMatrix4
(
viewMatrix
);
uniforms
[
"
lightPositionVS
"
].
value
.
copy
(
positionVS
);
...
...
src/core/Raycaster.js
浏览文件 @
685ca28c
...
...
@@ -25,6 +25,7 @@
var
localRay
=
new
THREE
.
Ray
();
var
facePlane
=
new
THREE
.
Plane
();
var
intersectPoint
=
new
THREE
.
Vector3
();
var
matrixPosition
=
new
THREE
.
Vector3
();
var
inverseMatrix
=
new
THREE
.
Matrix4
();
...
...
@@ -38,7 +39,8 @@
if
(
object
instanceof
THREE
.
Particle
)
{
var
distance
=
raycaster
.
ray
.
distanceToPoint
(
object
.
matrixWorld
.
getPosition
()
);
matrixPosition
.
getPositionFromMatrix
(
object
.
matrixWorld
);
var
distance
=
raycaster
.
ray
.
distanceToPoint
(
matrixPosition
);
if
(
distance
>
object
.
scale
.
x
)
{
...
...
@@ -58,8 +60,9 @@
}
else
if
(
object
instanceof
THREE
.
Mesh
)
{
// Checking boundingSphere distance to ray
matrixPosition
.
getPositionFromMatrix
(
object
.
matrixWorld
);
sphere
.
set
(
object
.
matrixWorld
.
getPosition
()
,
matrixPosition
,
object
.
geometry
.
boundingSphere
.
radius
*
object
.
matrixWorld
.
getMaxScaleOnAxis
()
);
if
(
!
raycaster
.
ray
.
isIntersectionSphere
(
sphere
)
)
{
...
...
src/extras/renderers/plugins/ShadowMapPlugin.js
浏览文件 @
685ca28c
...
...
@@ -12,7 +12,9 @@ THREE.ShadowMapPlugin = function () {
_projScreenMatrix
=
new
THREE
.
Matrix4
(),
_min
=
new
THREE
.
Vector3
(),
_max
=
new
THREE
.
Vector3
();
_max
=
new
THREE
.
Vector3
(),
_matrixPosition
=
new
THREE
.
Vector3
();
this
.
init
=
function
(
renderer
)
{
...
...
@@ -197,7 +199,8 @@ THREE.ShadowMapPlugin = function () {
shadowCamera
=
light
.
shadowCamera
;
shadowCamera
.
position
.
getPositionFromMatrix
(
light
.
matrixWorld
);
shadowCamera
.
lookAt
(
light
.
target
.
matrixWorld
.
getPosition
()
);
_matrixPosition
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
shadowCamera
.
lookAt
(
_matrixPosition
);
shadowCamera
.
updateMatrixWorld
();
shadowCamera
.
matrixWorldInverse
.
getInverse
(
shadowCamera
.
matrixWorld
);
...
...
src/math/Matrix4.js
浏览文件 @
685ca28c
...
...
@@ -512,6 +512,8 @@ THREE.extend( THREE.Matrix4.prototype, {
return
function
()
{
console
.
warn
(
'
DEPRECATED: Matrix4
\'
s .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.
'
);
var
te
=
this
.
elements
;
return
v1
.
set
(
te
[
12
],
te
[
13
],
te
[
14
]
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
685ca28c
...
...
@@ -4177,7 +4177,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
else
{
_vector3
.
copy
(
object
.
matrixWorld
.
getPosition
()
);
_vector3
.
getPositionFromMatrix
(
object
.
matrixWorld
);
_vector3
.
applyProjection
(
_projScreenMatrix
);
webglObject
.
z
=
_vector3
.
z
;
...
...
@@ -5387,8 +5387,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
p_uniforms
.
cameraPosition
!==
null
)
{
var
position
=
camera
.
matrixWorld
.
getPosition
(
);
_gl
.
uniform3f
(
p_uniforms
.
cameraPosition
,
position
.
x
,
position
.
y
,
position
.
z
);
_vector3
.
getPositionFromMatrix
(
camera
.
matrixWorld
);
_gl
.
uniform3f
(
p_uniforms
.
cameraPosition
,
_vector3
.
x
,
_vector3
.
y
,
_vector3
.
z
);
}
...
...
@@ -5989,8 +5989,9 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
!
light
.
visible
)
continue
;
_direction
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
_direction
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
_direction
.
getPositionFromMatrix
(
light
.
matrixWorld
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_direction
.
sub
(
_vector3
);
_direction
.
normalize
();
// skip lights with undefined direction
...
...
@@ -6034,11 +6035,11 @@ THREE.WebGLRenderer = function ( parameters ) {
}
position
=
light
.
matrixWorld
.
getPosition
(
);
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
pointPositions
[
pointOffset
]
=
position
.
x
;
pointPositions
[
pointOffset
+
1
]
=
position
.
y
;
pointPositions
[
pointOffset
+
2
]
=
position
.
z
;
pointPositions
[
pointOffset
]
=
_vector3
.
x
;
pointPositions
[
pointOffset
+
1
]
=
_vector3
.
y
;
pointPositions
[
pointOffset
+
2
]
=
_vector3
.
z
;
pointDistances
[
pointLength
]
=
distance
;
...
...
@@ -6062,16 +6063,17 @@ THREE.WebGLRenderer = function ( parameters ) {
}
position
=
light
.
matrixWorld
.
getPosition
(
);
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
spotPositions
[
spotOffset
]
=
position
.
x
;
spotPositions
[
spotOffset
+
1
]
=
position
.
y
;
spotPositions
[
spotOffset
+
2
]
=
position
.
z
;
spotPositions
[
spotOffset
]
=
_vector3
.
x
;
spotPositions
[
spotOffset
+
1
]
=
_vector3
.
y
;
spotPositions
[
spotOffset
+
2
]
=
_vector3
.
z
;
spotDistances
[
spotLength
]
=
distance
;
_direction
.
copy
(
position
);
_direction
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
_direction
.
copy
(
_vector3
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_direction
.
sub
(
_vector3
);
_direction
.
normalize
();
spotDirections
[
spotOffset
]
=
_direction
.
x
;
...
...
@@ -6089,7 +6091,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
!
light
.
visible
)
continue
;
_direction
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
_direction
.
getPositionFromMatrix
(
light
.
matrixWorld
);
_direction
.
normalize
();
// skip lights with undefined direction
...
...
src/renderers/WebGLRenderer2.js
浏览文件 @
685ca28c
...
...
@@ -1304,7 +1304,7 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
}
else
{
_vector3
.
copy
(
object
.
matrixWorld
.
getPosition
()
);
_vector3
.
getPositionFromMatrix
(
object
.
matrixWorld
);
_vector3
.
applyProjection
(
_projScreenMatrix
);
webglObject
.
z
=
_vector3
.
z
;
...
...
@@ -2507,8 +2507,8 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
if
(
p_uniforms
.
cameraPosition
!==
null
)
{
var
position
=
camera
.
matrixWorld
.
getPosition
(
);
renderer
.
uniform3f
(
p_uniforms
.
cameraPosition
,
position
.
x
,
position
.
y
,
position
.
z
);
_vector3
.
getPositionFromMatrix
(
camera
.
matrixWorld
);
renderer
.
uniform3f
(
p_uniforms
.
cameraPosition
,
_vector3
.
x
,
_vector3
.
y
,
_vector3
.
z
);
}
...
...
@@ -3109,8 +3109,9 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
if
(
!
light
.
visible
)
continue
;
_direction
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
_direction
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
_direction
.
getPositionFromMatrix
(
light
.
matrixWorld
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_direction
.
sub
(
_vector3
);
_direction
.
normalize
();
// skip lights with undefined direction
...
...
@@ -3154,11 +3155,11 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
}
position
=
light
.
matrixWorld
.
getPosition
(
);
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
pointPositions
[
pointOffset
]
=
position
.
x
;
pointPositions
[
pointOffset
+
1
]
=
position
.
y
;
pointPositions
[
pointOffset
+
2
]
=
position
.
z
;
pointPositions
[
pointOffset
]
=
_vector3
.
x
;
pointPositions
[
pointOffset
+
1
]
=
_vector3
.
y
;
pointPositions
[
pointOffset
+
2
]
=
_vector3
.
z
;
pointDistances
[
pointLength
]
=
distance
;
...
...
@@ -3182,16 +3183,17 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
}
position
=
light
.
matrixWorld
.
getPosition
(
);
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
spotPositions
[
spotOffset
]
=
position
.
x
;
spotPositions
[
spotOffset
+
1
]
=
position
.
y
;
spotPositions
[
spotOffset
+
2
]
=
position
.
z
;
spotPositions
[
spotOffset
]
=
_vector3
.
x
;
spotPositions
[
spotOffset
+
1
]
=
_vector3
.
y
;
spotPositions
[
spotOffset
+
2
]
=
_vector3
.
z
;
spotDistances
[
spotLength
]
=
distance
;
_direction
.
copy
(
position
);
_direction
.
sub
(
light
.
target
.
matrixWorld
.
getPosition
()
);
_direction
.
copy
(
_vector3
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_direction
.
sub
(
_vector3
);
_direction
.
normalize
();
spotDirections
[
spotOffset
]
=
_direction
.
x
;
...
...
@@ -3209,7 +3211,7 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
if
(
!
light
.
visible
)
continue
;
_direction
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
_direction
.
getPositionFromMatrix
(
light
.
matrixWorld
);
_direction
.
normalize
();
// skip lights with undefined direction
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录