Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
03604599
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,发现更多精彩内容 >>
提交
03604599
编写于
8月 04, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Projector now looks on the material for flipSided and doubleSided. Updated rest of examples.
上级
5d4b4c2a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
30 deletion
+30
-30
examples/canvas_geometry_birds.html
examples/canvas_geometry_birds.html
+1
-3
examples/canvas_geometry_text.html
examples/canvas_geometry_text.html
+0
-2
examples/canvas_materials.html
examples/canvas_materials.html
+8
-9
examples/canvas_materials_depth.html
examples/canvas_materials_depth.html
+1
-2
examples/canvas_materials_video.html
examples/canvas_materials_video.html
+1
-2
examples/canvas_particles_shapes.html
examples/canvas_particles_shapes.html
+0
-2
src/core/Projector.js
src/core/Projector.js
+14
-9
src/materials/MeshFaceMaterial.js
src/materials/MeshFaceMaterial.js
+5
-1
未找到文件。
examples/canvas_geometry_birds.html
浏览文件 @
03604599
...
...
@@ -357,11 +357,9 @@
boid
.
setAvoidWalls
(
true
);
boid
.
setWorldSize
(
500
,
500
,
400
);
bird
=
birds
[
i
]
=
new
THREE
.
Mesh
(
new
Bird
(),
new
THREE
.
MeshBasicMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
}
)
);
bird
=
birds
[
i
]
=
new
THREE
.
Mesh
(
new
Bird
(),
new
THREE
.
MeshBasicMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
,
doubleSided
:
true
}
)
);
bird
.
phase
=
Math
.
floor
(
Math
.
random
()
*
62.83
);
bird
.
position
=
boids
[
i
].
position
;
bird
.
doubleSided
=
true
;
// bird.scale.x = bird.scale.y = bird.scale.z = 10;
scene
.
add
(
bird
);
...
...
examples/canvas_geometry_text.html
浏览文件 @
03604599
...
...
@@ -90,8 +90,6 @@
var
textMaterial
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
Math
.
random
()
*
0xffffff
,
overdraw
:
true
}
);
text
=
new
THREE
.
Mesh
(
text3d
,
textMaterial
);
text
.
doubleSided
=
false
;
text
.
position
.
x
=
centerOffset
;
text
.
position
.
y
=
100
;
text
.
position
.
z
=
0
;
...
...
examples/canvas_materials.html
浏览文件 @
03604599
...
...
@@ -68,14 +68,14 @@
var
materials
=
[
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x00ffff
,
wireframe
:
true
}
),
doubleSided
:
true
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xff0000
,
blending
:
THREE
.
AdditiveBlending
}
),
doubleSided
:
true
},
{
material
:
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
,
overdraw
:
true
}
),
doubleSided
:
false
},
{
material
:
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
SmoothShading
,
overdraw
:
true
}
),
doubleSided
:
false
},
{
material
:
new
THREE
.
MeshDepthMaterial
(
{
overdraw
:
true
}
),
doubleSided
:
false
},
{
material
:
new
THREE
.
MeshNormalMaterial
(
{
overdraw
:
true
}
),
doubleSided
:
false
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
map
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/land_ocean_ice_cloud_2048.jpg
'
)
}
),
doubleSided
:
false
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
envMap
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/envmap.png
'
,
new
THREE
.
SphericalReflectionMapping
()
)
}
),
doubleSided
:
false
}
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x00ffff
,
wireframe
:
true
,
oubleSided
:
true
}
)
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xff0000
,
blending
:
THREE
.
AdditiveBlending
,
doubleSided
:
true
}
)
},
{
material
:
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
,
doubleSided
:
false
,
overdraw
:
true
}
)
},
{
material
:
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
SmoothShading
,
doubleSided
:
false
,
overdraw
:
true
}
)
},
{
material
:
new
THREE
.
MeshDepthMaterial
(
{
doubleSided
:
false
,
overdraw
:
true
}
)
},
{
material
:
new
THREE
.
MeshNormalMaterial
(
{
doubleSided
:
false
,
overdraw
:
true
}
)
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
map
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/land_ocean_ice_cloud_2048.jpg
'
)
,
doubleSided
:
false
}
)
},
{
material
:
new
THREE
.
MeshBasicMaterial
(
{
envMap
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/envmap.png
'
,
new
THREE
.
SphericalReflectionMapping
()
)
,
doubleSided
:
false
}
)
}
];
...
...
@@ -93,7 +93,6 @@
for
(
var
i
=
0
,
l
=
materials
.
length
;
i
<
l
;
i
++
)
{
var
sphere
=
new
THREE
.
Mesh
(
geometry
,
materials
[
i
].
material
);
sphere
.
doubleSided
=
materials
[
i
].
doubleSided
;
sphere
.
position
.
x
=
(
i
%
5
)
*
200
-
400
;
sphere
.
position
.
z
=
Math
.
floor
(
i
/
5
)
*
200
-
200
;
...
...
examples/canvas_materials_depth.html
浏览文件 @
03604599
...
...
@@ -61,12 +61,11 @@
// Plane
var
material
=
new
THREE
.
MeshDepthMaterial
(
{
overdraw
:
true
}
);
var
material
=
new
THREE
.
MeshDepthMaterial
(
{
doubleSided
:
true
,
overdraw
:
true
}
);
plane
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneGeometry
(
1000
,
1000
,
10
,
10
),
material
);
plane
.
position
.
y
=
-
100
;
plane
.
rotation
.
x
=
-
Math
.
PI
/
2
;
plane
.
doubleSided
=
true
;
scene
.
add
(
plane
);
// Cubes
...
...
examples/canvas_materials_video.html
浏览文件 @
03604599
...
...
@@ -99,7 +99,7 @@
textureReflection
.
minFilter
=
THREE
.
LinearFilter
;
textureReflection
.
magFilter
=
THREE
.
LinearFilter
;
var
materialReflection
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
textureReflection
,
overdraw
:
true
}
);
var
materialReflection
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
textureReflection
,
flipSided
:
true
,
overdraw
:
true
}
);
//
...
...
@@ -113,7 +113,6 @@
mesh
.
position
.
y
=
-
306
;
mesh
.
rotation
.
x
=
-
Math
.
PI
;
mesh
.
scale
.
x
=
mesh
.
scale
.
y
=
mesh
.
scale
.
z
=
1.5
;
mesh
.
doubleSided
=
true
;
scene
.
add
(
mesh
);
//
...
...
examples/canvas_particles_shapes.html
浏览文件 @
03604599
...
...
@@ -99,8 +99,6 @@
// Potentially, we can extract the vertices or faces of the text to generate particles too.
// Geo > Vertices > Position
text
.
doubleSided
=
false
;
text
.
position
.
x
=
centerOffset
;
text
.
position
.
y
=
100
;
text
.
position
.
z
=
0
;
...
...
src/core/Projector.js
浏览文件 @
03604599
...
...
@@ -128,10 +128,10 @@ THREE.Projector = function() {
var
near
=
camera
.
near
,
far
=
camera
.
far
,
visible
=
false
,
o
,
ol
,
v
,
vl
,
f
,
fl
,
n
,
nl
,
c
,
cl
,
u
,
ul
,
object
,
modelMatrix
,
normal
Matrix
,
modelMatrix
,
rotation
Matrix
,
geometry
,
geometryMaterials
,
vertices
,
vertex
,
vertexPositionScreen
,
faces
,
face
,
faceVertexNormals
,
normal
,
faceVertexUvs
,
uvs
,
v1
,
v2
,
v3
,
v4
;
v1
,
v2
,
v3
,
v4
,
flipSided
,
doubleSided
;
_face3Count
=
0
;
_face4Count
=
0
;
...
...
@@ -168,7 +168,10 @@ THREE.Projector = function() {
faces
=
geometry
.
faces
;
faceVertexUvs
=
geometry
.
faceVertexUvs
;
normalMatrix
=
object
.
matrixRotationWorld
.
extractRotation
(
modelMatrix
);
rotationMatrix
=
object
.
matrixRotationWorld
.
extractRotation
(
modelMatrix
);
flipSided
=
object
.
material
.
flipSided
;
doubleSided
=
object
.
material
.
doubleSided
;
for
(
v
=
0
,
vl
=
vertices
.
length
;
v
<
vl
;
v
++
)
{
...
...
@@ -187,6 +190,7 @@ THREE.Projector = function() {
}
for
(
f
=
0
,
fl
=
faces
.
length
;
f
<
fl
;
f
++
)
{
face
=
faces
[
f
];
...
...
@@ -202,7 +206,7 @@ THREE.Projector = function() {
visible
=
(
(
v3
.
positionScreen
.
x
-
v1
.
positionScreen
.
x
)
*
(
v2
.
positionScreen
.
y
-
v1
.
positionScreen
.
y
)
-
(
v3
.
positionScreen
.
y
-
v1
.
positionScreen
.
y
)
*
(
v2
.
positionScreen
.
x
-
v1
.
positionScreen
.
x
)
)
<
0
;
if
(
object
.
doubleSided
===
true
||
visible
!==
object
.
flipSided
)
{
if
(
doubleSided
===
true
||
visible
!==
flipSided
)
{
_face
=
getNextFace3InPool
();
...
...
@@ -237,7 +241,7 @@ THREE.Projector = function() {
(
v2
.
positionScreen
.
y
-
v3
.
positionScreen
.
y
)
*
(
v4
.
positionScreen
.
x
-
v3
.
positionScreen
.
x
)
<
0
;
if
(
object
.
doubleSided
===
true
||
visible
!==
object
.
flipSided
)
{
if
(
doubleSided
===
true
||
visible
!==
flipSided
)
{
_face
=
getNextFace4InPool
();
...
...
@@ -261,8 +265,9 @@ THREE.Projector = function() {
}
_face
.
normalWorld
.
copy
(
face
.
normal
);
if
(
visible
===
false
&&
(
object
.
flipSided
===
true
||
object
.
doubleSided
===
true
)
)
_face
.
normalWorld
.
negate
();
normalMatrix
.
multiplyVector3
(
_face
.
normalWorld
);
if
(
visible
===
false
&&
(
flipSided
===
true
||
doubleSided
===
true
)
)
_face
.
normalWorld
.
negate
();
rotationMatrix
.
multiplyVector3
(
_face
.
normalWorld
);
_face
.
centroidWorld
.
copy
(
face
.
centroid
);
modelMatrix
.
multiplyVector3
(
_face
.
centroidWorld
);
...
...
@@ -277,9 +282,9 @@ THREE.Projector = function() {
normal
=
_face
.
vertexNormalsWorld
[
n
];
normal
.
copy
(
faceVertexNormals
[
n
]
);
if
(
visible
===
false
&&
(
object
.
flipSided
===
true
||
object
.
doubleSided
===
true
)
)
normal
.
negate
();
if
(
visible
===
false
&&
(
flipSided
===
true
||
doubleSided
===
true
)
)
normal
.
negate
();
normal
Matrix
.
multiplyVector3
(
normal
);
rotation
Matrix
.
multiplyVector3
(
normal
);
}
...
...
src/materials/MeshFaceMaterial.js
浏览文件 @
03604599
...
...
@@ -2,4 +2,8 @@
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
MeshFaceMaterial
=
function
()
{};
THREE
.
MeshFaceMaterial
=
function
(
parameters
)
{
THREE
.
Material
.
call
(
this
,
parameters
);
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录