Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
e2a72e13
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
e2a72e13
编写于
10月 09, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CanvasRenderer/SVGRenderer: Removed broken MeshDepthMaterial support. See #7311.
上级
155d4c72
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
0 addition
and
256 deletion
+0
-256
examples/canvas_materials.html
examples/canvas_materials.html
+0
-1
examples/canvas_materials_depth.html
examples/canvas_materials_depth.html
+0
-238
examples/index.html
examples/index.html
+0
-1
examples/js/renderers/CanvasRenderer.js
examples/js/renderers/CanvasRenderer.js
+0
-10
examples/js/renderers/SVGRenderer.js
examples/js/renderers/SVGRenderer.js
+0
-6
未找到文件。
examples/canvas_materials.html
浏览文件 @
e2a72e13
...
...
@@ -73,7 +73,6 @@
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xff0000
,
blending
:
THREE
.
AdditiveBlending
}
),
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
FlatShading
,
overdraw
:
0.5
}
),
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
shading
:
THREE
.
SmoothShading
,
overdraw
:
0.5
}
),
new
THREE
.
MeshDepthMaterial
(
{
overdraw
:
0.5
}
),
new
THREE
.
MeshNormalMaterial
(
{
overdraw
:
0.5
}
),
new
THREE
.
MeshBasicMaterial
(
{
map
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/land_ocean_ice_cloud_2048.jpg
'
)
}
),
new
THREE
.
MeshBasicMaterial
(
{
envMap
:
THREE
.
ImageUtils
.
loadTexture
(
'
textures/envmap.png
'
,
THREE
.
SphericalReflectionMapping
),
overdraw
:
0.5
}
)
...
...
examples/canvas_materials_depth.html
已删除
100644 → 0
浏览文件 @
155d4c72
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js canvas - depth material
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
font-family
:
Monospace
;
background-color
:
#000000
;
margin
:
0px
;
overflow
:
hidden
;
}
</style>
</head>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/renderers/Projector.js"
></script>
<script
src=
"js/renderers/CanvasRenderer.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script>
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
var
cube
,
plane
,
objects
=
[];
var
targetRotation
=
0
;
var
targetRotationOnMouseDown
=
0
;
var
mouseX
=
0
;
var
mouseXOnMouseDown
=
0
;
var
moveForward
=
false
;
var
moveBackwards
=
false
;
var
moveLeft
=
false
;
var
moveRight
=
false
;
var
moveUp
=
false
;
var
moveDown
=
false
;
var
targetMoveLeft
=
false
;
var
targetMoveRight
=
false
;
var
debugContext
;
init
();
animate
();
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
45
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
2000
);
camera
.
position
.
set
(
1000
,
1000
,
1000
);
camera
.
target
=
new
THREE
.
Vector3
(
0
,
150
,
0
);
scene
=
new
THREE
.
Scene
();
// Plane
var
material
=
new
THREE
.
MeshDepthMaterial
(
{
side
:
THREE
.
DoubleSide
,
overdraw
:
0.5
}
);
plane
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
1000
,
1000
,
10
,
10
),
material
);
plane
.
position
.
y
=
-
100
;
plane
.
rotation
.
x
=
-
Math
.
PI
/
2
;
scene
.
add
(
plane
);
// Cubes
geometry
=
new
THREE
.
BoxGeometry
(
100
,
100
,
100
);
material
=
new
THREE
.
MeshDepthMaterial
(
{
overdraw
:
0.5
}
);
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
cube
.
position
.
x
=
(
i
%
5
)
*
200
-
400
;
cube
.
position
.
z
=
Math
.
floor
(
i
/
5
)
*
200
-
350
;
cube
.
rotation
.
x
=
Math
.
random
()
*
200
-
100
;
cube
.
rotation
.
y
=
Math
.
random
()
*
200
-
100
;
cube
.
rotation
.
z
=
Math
.
random
()
*
200
-
100
;
scene
.
add
(
cube
);
objects
.
push
(
cube
);
}
renderer
=
new
THREE
.
CanvasRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
var
debugCanvas
=
document
.
createElement
(
'
canvas
'
);
debugCanvas
.
width
=
512
;
debugCanvas
.
height
=
512
;
debugCanvas
.
style
.
position
=
'
absolute
'
;
debugCanvas
.
style
.
top
=
'
0px
'
;
debugCanvas
.
style
.
left
=
'
0px
'
;
container
.
appendChild
(
debugCanvas
);
debugContext
=
debugCanvas
.
getContext
(
'
2d
'
);
debugContext
.
setTransform
(
1
,
0
,
0
,
1
,
256
,
256
);
debugContext
.
strokeStyle
=
'
#808080
'
;
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keyup
'
,
onDocumentKeyUp
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
onDocumentKeyDown
(
event
)
{
switch
(
event
.
keyCode
)
{
case
38
:
moveForward
=
true
;
break
;
// up
case
40
:
moveBackwards
=
true
;
break
;
// down
case
37
:
moveLeft
=
true
;
break
;
// left
case
39
:
moveRight
=
true
;
break
;
// right
case
87
:
moveUp
=
true
;
break
;
// w
case
83
:
moveDown
=
true
;
break
;
// s
case
65
:
targetMoveLeft
=
true
;
break
;
// a
case
68
:
targetMoveRight
=
true
;
break
;
// d
}
}
function
onDocumentKeyUp
(
event
)
{
switch
(
event
.
keyCode
)
{
case
38
:
moveForward
=
false
;
break
;
// up
case
40
:
moveBackwards
=
false
;
break
;
// down
case
37
:
moveLeft
=
false
;
break
;
// left
case
39
:
moveRight
=
false
;
break
;
// right
case
87
:
moveUp
=
false
;
break
;
// w
case
83
:
moveDown
=
false
;
break
;
// s
case
65
:
targetMoveLeft
=
false
;
break
;
// a
case
68
:
targetMoveRight
=
false
;
break
;
// d
}
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
function
render
()
{
if
(
moveForward
)
camera
.
position
.
z
-=
10
;
if
(
moveBackwards
)
camera
.
position
.
z
+=
10
;
if
(
moveLeft
)
camera
.
position
.
x
-=
10
;
if
(
moveRight
)
camera
.
position
.
x
+=
10
;
if
(
moveUp
)
camera
.
position
.
y
+=
10
;
if
(
moveDown
)
camera
.
position
.
y
-=
10
;
if
(
targetMoveLeft
)
camera
.
target
.
x
-=
10
;
if
(
targetMoveRight
)
camera
.
target
.
x
+=
10
;
camera
.
lookAt
(
camera
.
target
);
debugContext
.
clearRect
(
-
256
,
-
256
,
512
,
512
);
debugContext
.
beginPath
();
// center
debugContext
.
moveTo
(
-
10
,
0
);
debugContext
.
lineTo
(
10
,
0
);
debugContext
.
moveTo
(
0
,
-
10
);
debugContext
.
lineTo
(
0
,
10
);
// camera
debugContext
.
moveTo
(
camera
.
position
.
x
*
0.1
,
camera
.
position
.
z
*
0.1
);
debugContext
.
lineTo
(
camera
.
target
.
x
*
0.1
,
camera
.
target
.
z
*
0.1
);
debugContext
.
rect
(
camera
.
position
.
x
*
0.1
-
5
,
camera
.
position
.
z
*
0.1
-
5
,
10
,
10
);
debugContext
.
rect
(
camera
.
target
.
x
*
0.1
-
5
,
camera
.
target
.
z
*
0.1
-
5
,
10
,
10
);
debugContext
.
rect
(
-
50
,
-
50
,
100
,
100
);
for
(
var
i
=
0
;
i
<
objects
.
length
;
i
++
)
{
var
object
=
objects
[
i
];
object
.
rotation
.
x
+=
0.01
;
object
.
rotation
.
y
+=
0.005
;
object
.
position
.
y
=
Math
.
sin
(
object
.
rotation
.
x
)
*
200
+
200
;
debugContext
.
rect
(
object
.
position
.
x
*
0.1
-
5
,
object
.
position
.
z
*
0.1
-
5
,
10
,
10
);
}
debugContext
.
closePath
();
debugContext
.
stroke
();
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
examples/index.html
浏览文件 @
e2a72e13
...
...
@@ -450,7 +450,6 @@
"
canvas_lines_dashed
"
,
"
canvas_lines_sphere
"
,
"
canvas_materials
"
,
"
canvas_materials_depth
"
,
"
canvas_materials_normal
"
,
"
canvas_materials_reflection
"
,
"
canvas_materials_video
"
,
...
...
examples/js/renderers/CanvasRenderer.js
浏览文件 @
e2a72e13
...
...
@@ -36,8 +36,6 @@ THREE.CanvasRenderer = function ( parameters ) {
console
.
log
(
'
THREE.CanvasRenderer
'
,
THREE
.
REVISION
);
var
smoothstep
=
THREE
.
Math
.
smoothstep
;
parameters
=
parameters
||
{};
var
_this
=
this
,
...
...
@@ -760,14 +758,6 @@ THREE.CanvasRenderer = function ( parameters ) {
}
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
_color
.
r
=
_color
.
g
=
_color
.
b
=
1
-
smoothstep
(
v1
.
positionScreen
.
z
*
v1
.
positionScreen
.
w
,
_camera
.
near
,
_camera
.
far
);
material
.
wireframe
===
true
?
strokePath
(
_color
,
material
.
wireframeLinewidth
,
material
.
wireframeLinecap
,
material
.
wireframeLinejoin
)
:
fillPath
(
_color
);
}
else
if
(
material
instanceof
THREE
.
MeshNormalMaterial
)
{
_normal
.
copy
(
element
.
normalModel
).
applyMatrix3
(
_normalViewMatrix
);
...
...
examples/js/renderers/SVGRenderer.js
浏览文件 @
e2a72e13
...
...
@@ -36,7 +36,6 @@ THREE.SVGRenderer = function () {
_clearColor
=
new
THREE
.
Color
(),
_clearAlpha
=
1
,
_w
,
// z-buffer to w-buffer
_vector3
=
new
THREE
.
Vector3
(),
// Needed for PointLight
_centroid
=
new
THREE
.
Vector3
(),
_normal
=
new
THREE
.
Vector3
(),
...
...
@@ -383,11 +382,6 @@ THREE.SVGRenderer = function () {
_color
.
multiply
(
_diffuseColor
).
add
(
material
.
emissive
);
}
else
if
(
material
instanceof
THREE
.
MeshDepthMaterial
)
{
_w
=
1
-
(
material
.
__2near
/
(
material
.
__farPlusNear
-
element
.
z
*
material
.
__farMinusNear
)
);
_color
.
setRGB
(
_w
,
_w
,
_w
);
}
else
if
(
material
instanceof
THREE
.
MeshNormalMaterial
)
{
_normal
.
copy
(
element
.
normalModel
).
applyMatrix3
(
_normalViewMatrix
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录