Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
59304d8a
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,发现更多精彩内容 >>
提交
59304d8a
编写于
12月 02, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Matrix4.transformVector3 ⟶ Matrix4.multiplyVector3
Matrix4.transformVector4 ⟶ Matrix4.multiplyVector4
上级
2929d5a3
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
79 addition
and
67 deletion
+79
-67
build/Three.js
build/Three.js
+14
-14
build/ThreeDebug.js
build/ThreeDebug.js
+14
-14
build/ThreeExtras.js
build/ThreeExtras.js
+15
-15
examples/interactive_voxelpainter.html
examples/interactive_voxelpainter.html
+1
-1
src/core/Geometry.js
src/core/Geometry.js
+14
-2
src/core/Matrix4.js
src/core/Matrix4.js
+2
-2
src/core/Ray.js
src/core/Ray.js
+5
-5
src/extras/GeometryUtils.js
src/extras/GeometryUtils.js
+1
-1
src/renderers/Projector.js
src/renderers/Projector.js
+13
-13
未找到文件。
build/Three.js
浏览文件 @
59304d8a
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
59304d8a
此差异已折叠。
点击以展开。
build/ThreeExtras.js
浏览文件 @
59304d8a
此差异已折叠。
点击以展开。
examples/interactive_voxelpainter.html
浏览文件 @
59304d8a
...
...
@@ -145,7 +145,7 @@
}
else
{
var
position
=
new
THREE
.
Vector3
().
add
(
intersects
[
0
].
point
,
intersects
[
0
].
object
.
rotationMatrix
.
transform
Vector3
(
intersects
[
0
].
face
.
normal
.
clone
()
)
);
var
position
=
new
THREE
.
Vector3
().
add
(
intersects
[
0
].
point
,
intersects
[
0
].
object
.
rotationMatrix
.
multiply
Vector3
(
intersects
[
0
].
face
.
normal
.
clone
()
)
);
var
voxel
=
new
THREE
.
Mesh
(
new
Cube
(
50
,
50
,
50
),
[
new
THREE
.
MeshLambertMaterial
(
{
color
:
0x00ff80
,
opacity
:
1
,
shading
:
THREE
.
FlatShading
}
),
new
THREE
.
MeshFaceMaterial
()
]
);
voxel
.
position
.
x
=
Math
.
floor
(
position
.
x
/
50
)
*
50
+
25
;
...
...
src/core/Geometry.js
浏览文件 @
59304d8a
...
...
@@ -101,7 +101,19 @@ THREE.Geometry.prototype = {
},
computeBoundingBox
:
function
(
)
{
computeVertexNormals
:
function
()
{
var
f
,
fl
;
for
(
f
=
0
,
fl
=
this
.
faces
.
length
;
f
<
fl
;
f
++
)
{
}
},
computeBoundingBox
:
function
()
{
if
(
this
.
vertices
.
length
>
0
)
{
...
...
@@ -151,7 +163,7 @@ THREE.Geometry.prototype = {
toString
:
function
()
{
return
'
THREE.Geometry ( vertices:
'
+
this
.
vertices
+
'
, faces:
'
+
this
.
faces
+
'
)
'
;
return
'
THREE.Geometry ( vertices:
'
+
this
.
vertices
+
'
, faces:
'
+
this
.
faces
+
'
, uvs:
'
+
this
.
uvs
+
'
)
'
;
}
...
...
src/core/Matrix4.js
浏览文件 @
59304d8a
...
...
@@ -50,7 +50,7 @@ THREE.Matrix4.prototype = {
},
transform
Vector3
:
function
(
v
)
{
multiply
Vector3
:
function
(
v
)
{
var
vx
=
v
.
x
,
vy
=
v
.
y
,
vz
=
v
.
z
,
d
=
1
/
(
this
.
n41
*
vx
+
this
.
n42
*
vy
+
this
.
n43
*
vz
+
this
.
n44
);
...
...
@@ -63,7 +63,7 @@ THREE.Matrix4.prototype = {
},
transform
Vector4
:
function
(
v
)
{
multiply
Vector4
:
function
(
v
)
{
var
vx
=
v
.
x
,
vy
=
v
.
y
,
vz
=
v
.
z
,
vw
=
v
.
w
;
...
...
src/core/Ray.js
浏览文件 @
59304d8a
...
...
@@ -52,12 +52,12 @@ THREE.Ray.prototype = {
origin
=
this
.
origin
.
clone
();
direction
=
this
.
direction
.
clone
();
a
=
object
.
matrix
.
transform
Vector3
(
vertices
[
face
.
a
].
position
.
clone
()
);
b
=
object
.
matrix
.
transform
Vector3
(
vertices
[
face
.
b
].
position
.
clone
()
);
c
=
object
.
matrix
.
transform
Vector3
(
vertices
[
face
.
c
].
position
.
clone
()
);
d
=
face
instanceof
THREE
.
Face4
?
object
.
matrix
.
transform
Vector3
(
vertices
[
face
.
d
].
position
.
clone
()
)
:
null
;
a
=
object
.
matrix
.
multiply
Vector3
(
vertices
[
face
.
a
].
position
.
clone
()
);
b
=
object
.
matrix
.
multiply
Vector3
(
vertices
[
face
.
b
].
position
.
clone
()
);
c
=
object
.
matrix
.
multiply
Vector3
(
vertices
[
face
.
c
].
position
.
clone
()
);
d
=
face
instanceof
THREE
.
Face4
?
object
.
matrix
.
multiply
Vector3
(
vertices
[
face
.
d
].
position
.
clone
()
)
:
null
;
normal
=
object
.
rotationMatrix
.
transform
Vector3
(
face
.
normal
.
clone
()
);
normal
=
object
.
rotationMatrix
.
multiply
Vector3
(
face
.
normal
.
clone
()
);
dot
=
direction
.
dot
(
normal
);
if
(
dot
<
0
)
{
// Math.abs( dot ) > 0.0001
...
...
src/extras/GeometryUtils.js
浏览文件 @
59304d8a
...
...
@@ -22,7 +22,7 @@ var GeometryUtils = {
var
vertexCopy
=
new
THREE
.
Vertex
(
vertex
.
position
.
clone
()
);
isMesh
&&
object2
.
matrix
.
transform
Vector3
(
vertexCopy
.
position
);
isMesh
&&
object2
.
matrix
.
multiply
Vector3
(
vertexCopy
.
position
);
vertices1
.
push
(
vertexCopy
);
...
...
src/renderers/Projector.js
浏览文件 @
59304d8a
...
...
@@ -57,11 +57,11 @@ THREE.Projector = function() {
vertex
=
vertices
[
v
];
vertex
.
positionWorld
.
copy
(
vertex
.
position
);
objectMatrix
.
transform
Vector3
(
vertex
.
positionWorld
);
objectMatrix
.
multiply
Vector3
(
vertex
.
positionWorld
);
vertexPositionScreen
=
vertex
.
positionScreen
;
vertexPositionScreen
.
copy
(
vertex
.
positionWorld
);
_projScreenMatrix
.
transform
Vector4
(
vertexPositionScreen
);
_projScreenMatrix
.
multiply
Vector4
(
vertexPositionScreen
);
// Perform the perspective divide. TODO: This should be be performend
// post clipping (imagine if the vertex lies at the same location as
...
...
@@ -101,13 +101,13 @@ THREE.Projector = function() {
_face3
.
v3
.
positionScreen
.
copy
(
v3
.
positionScreen
);
_face3
.
normalWorld
.
copy
(
face
.
normal
);
objectRotationMatrix
.
transform
Vector3
(
_face3
.
normalWorld
);
objectRotationMatrix
.
multiply
Vector3
(
_face3
.
normalWorld
);
_face3
.
centroidWorld
.
copy
(
face
.
centroid
);
objectMatrix
.
transform
Vector3
(
_face3
.
centroidWorld
);
objectMatrix
.
multiply
Vector3
(
_face3
.
centroidWorld
);
_face3
.
centroidScreen
.
copy
(
_face3
.
centroidWorld
);
_projScreenMatrix
.
transform
Vector3
(
_face3
.
centroidScreen
);
_projScreenMatrix
.
multiply
Vector3
(
_face3
.
centroidScreen
);
faceVertexNormals
=
face
.
vertexNormals
;
_face3VertexNormals
=
_face3
.
vertexNormalsWorld
;
...
...
@@ -116,7 +116,7 @@ THREE.Projector = function() {
normal
=
_face3VertexNormals
[
n
]
=
_face3VertexNormals
[
n
]
||
new
THREE
.
Vector3
();
normal
.
copy
(
faceVertexNormals
[
n
]
);
objectRotationMatrix
.
transform
Vector3
(
normal
);
objectRotationMatrix
.
multiply
Vector3
(
normal
);
}
...
...
@@ -165,13 +165,13 @@ THREE.Projector = function() {
_face3
.
v3
.
positionScreen
.
copy
(
v4
.
positionScreen
);
_face3
.
normalWorld
.
copy
(
face
.
normal
);
objectRotationMatrix
.
transform
Vector3
(
_face3
.
normalWorld
);
objectRotationMatrix
.
multiply
Vector3
(
_face3
.
normalWorld
);
_face3
.
centroidWorld
.
copy
(
face
.
centroid
);
objectMatrix
.
transform
Vector3
(
_face3
.
centroidWorld
);
objectMatrix
.
multiply
Vector3
(
_face3
.
centroidWorld
);
_face3
.
centroidScreen
.
copy
(
_face3
.
centroidWorld
);
_projScreenMatrix
.
transform
Vector3
(
_face3
.
centroidScreen
);
_projScreenMatrix
.
multiply
Vector3
(
_face3
.
centroidScreen
);
// TODO: Handle vertex normals
...
...
@@ -245,14 +245,14 @@ THREE.Projector = function() {
vertex
=
vertices
[
0
];
vertex
.
positionScreen
.
copy
(
vertex
.
position
);
_projScreenObjectMatrix
.
transform
Vector4
(
vertex
.
positionScreen
);
_projScreenObjectMatrix
.
multiply
Vector4
(
vertex
.
positionScreen
);
for
(
v
=
1
,
vl
=
vertices
.
length
;
v
<
vl
;
v
++
)
{
v1
=
vertices
[
v
];
v1
.
positionScreen
.
copy
(
v1
.
position
);
_projScreenObjectMatrix
.
transform
Vector4
(
v1
.
positionScreen
);
_projScreenObjectMatrix
.
multiply
Vector4
(
v1
.
positionScreen
);
v2
=
vertices
[
v
-
1
];
...
...
@@ -283,7 +283,7 @@ THREE.Projector = function() {
_vector4
.
set
(
object
.
position
.
x
,
object
.
position
.
y
,
object
.
position
.
z
,
1
);
_projScreenMatrix
.
transform
Vector4
(
_vector4
);
_projScreenMatrix
.
multiply
Vector4
(
_vector4
);
_vector4
.
z
/=
_vector4
.
w
;
...
...
@@ -322,7 +322,7 @@ THREE.Projector = function() {
var
matrix
=
new
THREE
.
Matrix4
();
matrix
.
multiply
(
THREE
.
Matrix4
.
makeInvert
(
camera
.
matrix
),
THREE
.
Matrix4
.
makeInvert
(
camera
.
projectionMatrix
)
);
matrix
.
transform
Vector3
(
vector
);
matrix
.
multiply
Vector3
(
vector
);
return
vector
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录