Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ce4cae51
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,发现更多精彩内容 >>
提交
ce4cae51
编写于
6月 15, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Another batch of examples resizing handling.
上级
42d67983
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
639 addition
and
70 deletion
+639
-70
examples/canvas_ascii_effect.html
examples/canvas_ascii_effect.html
+22
-3
examples/canvas_camera_orthographic.html
examples/canvas_camera_orthographic.html
+18
-1
examples/canvas_geometry_birds.html
examples/canvas_geometry_birds.html
+13
-0
examples/canvas_geometry_cube.html
examples/canvas_geometry_cube.html
+25
-2
examples/canvas_geometry_earth.html
examples/canvas_geometry_earth.html
+19
-3
examples/canvas_geometry_hierarchy.html
examples/canvas_geometry_hierarchy.html
+16
-0
examples/canvas_geometry_panorama.html
examples/canvas_geometry_panorama.html
+16
-0
examples/canvas_geometry_panorama_fisheye.html
examples/canvas_geometry_panorama_fisheye.html
+15
-0
examples/canvas_geometry_terrain.html
examples/canvas_geometry_terrain.html
+16
-0
examples/canvas_geometry_text.html
examples/canvas_geometry_text.html
+16
-0
examples/canvas_interactive_cubes.html
examples/canvas_interactive_cubes.html
+13
-0
examples/canvas_interactive_cubes_tween.html
examples/canvas_interactive_cubes_tween.html
+13
-0
examples/canvas_interactive_particles.html
examples/canvas_interactive_particles.html
+13
-0
examples/canvas_interactive_voxelpainter.html
examples/canvas_interactive_voxelpainter.html
+13
-0
examples/canvas_lights_pointlights.html
examples/canvas_lights_pointlights.html
+13
-0
examples/canvas_lights_pointlights_smooth.html
examples/canvas_lights_pointlights_smooth.html
+13
-0
examples/canvas_lines.html
examples/canvas_lines.html
+18
-0
examples/canvas_lines_sphere.html
examples/canvas_lines_sphere.html
+17
-0
examples/canvas_materials.html
examples/canvas_materials.html
+13
-0
examples/canvas_materials_depth.html
examples/canvas_materials_depth.html
+14
-3
examples/canvas_materials_normal.html
examples/canvas_materials_normal.html
+13
-0
examples/canvas_materials_reflection.html
examples/canvas_materials_reflection.html
+13
-0
examples/canvas_materials_video.html
examples/canvas_materials_video.html
+18
-1
examples/canvas_particles_floor.html
examples/canvas_particles_floor.html
+19
-1
examples/canvas_particles_random.html
examples/canvas_particles_random.html
+23
-2
examples/canvas_particles_shapes.html
examples/canvas_particles_shapes.html
+26
-1
examples/canvas_particles_sprites.html
examples/canvas_particles_sprites.html
+16
-0
examples/canvas_particles_waves.html
examples/canvas_particles_waves.html
+20
-2
examples/canvas_performance.html
examples/canvas_performance.html
+13
-9
examples/canvas_sandbox.html
examples/canvas_sandbox.html
+17
-0
examples/js/effects/AsciiEffect.js
examples/js/effects/AsciiEffect.js
+60
-36
examples/misc_lights_test.html
examples/misc_lights_test.html
+2
-2
examples/webgl_loader_json_objconverter.html
examples/webgl_loader_json_objconverter.html
+2
-2
examples/webgl_loader_obj.html
examples/webgl_loader_obj.html
+18
-2
examples/webgl_loader_scene.html
examples/webgl_loader_scene.html
+16
-0
examples/webgl_loader_scene_blender.html
examples/webgl_loader_scene_blender.html
+16
-0
examples/webgl_loader_utf8.html
examples/webgl_loader_utf8.html
+16
-0
examples/webgl_loader_vtk.html
examples/webgl_loader_vtk.html
+15
-0
未找到文件。
examples/canvas_ascii_effect.html
浏览文件 @
ce4cae51
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
font-family
:
Monospace
;
font-family
:
Monospace
;
background-color
:
#f0f0f0
;
background-color
:
#f0f0f0
;
margin
:
0px
;
margin
:
0px
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
</style>
</style>
</head>
</head>
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<script
src=
"../build/Three.js"
></script>
<script
src=
"../build/Three.js"
></script>
<script
src=
"js/effects/AsciiEffect.js"
></script>
<script
src=
"js/effects/AsciiEffect.js"
></script>
<script
src=
"js/Stats.js"
></script>
<script
src=
"js/Stats.js"
></script>
<script>
<script>
var
container
,
stats
;
var
container
,
stats
;
...
@@ -34,6 +35,9 @@
...
@@ -34,6 +35,9 @@
function
init
()
{
function
init
()
{
var
width
=
window
.
innerWidth
||
2
;
var
height
=
window
.
innerHeight
||
2
;
container
=
document
.
createElement
(
'
div
'
);
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
document
.
body
.
appendChild
(
container
);
...
@@ -47,7 +51,7 @@
...
@@ -47,7 +51,7 @@
scene
=
new
THREE
.
Scene
();
scene
=
new
THREE
.
Scene
();
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
wi
ndow
.
innerWidth
/
window
.
innerH
eight
,
1
,
1000
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
wi
dth
/
h
eight
,
1
,
1000
);
camera
.
position
.
y
=
150
;
camera
.
position
.
y
=
150
;
camera
.
position
.
z
=
500
;
camera
.
position
.
z
=
500
;
scene
.
add
(
camera
);
scene
.
add
(
camera
);
...
@@ -72,10 +76,11 @@
...
@@ -72,10 +76,11 @@
scene
.
add
(
plane
);
scene
.
add
(
plane
);
renderer
=
new
THREE
.
CanvasRenderer
();
renderer
=
new
THREE
.
CanvasRenderer
();
renderer
.
setSize
(
width
,
height
);
// container.appendChild( renderer.domElement );
// container.appendChild( renderer.domElement );
effect
=
new
THREE
.
AsciiEffect
(
renderer
);
effect
=
new
THREE
.
AsciiEffect
(
renderer
);
effect
.
setSize
(
wi
ndow
.
innerWidth
,
window
.
innerH
eight
);
effect
.
setSize
(
wi
dth
,
h
eight
);
container
.
appendChild
(
effect
.
domElement
);
container
.
appendChild
(
effect
.
domElement
);
stats
=
new
Stats
();
stats
=
new
Stats
();
...
@@ -83,6 +88,20 @@
...
@@ -83,6 +88,20 @@
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
effect
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_camera_orthographic.html
浏览文件 @
ce4cae51
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
cube
.
position
.
y
=
(
cube
.
scale
.
y
*
50
)
/
2
;
cube
.
position
.
y
=
(
cube
.
scale
.
y
*
50
)
/
2
;
cube
.
position
.
z
=
Math
.
floor
(
(
Math
.
random
()
*
1000
-
500
)
/
50
)
*
50
+
25
;
cube
.
position
.
z
=
Math
.
floor
(
(
Math
.
random
()
*
1000
-
500
)
/
50
)
*
50
+
25
;
scene
.
add
(
cube
);
scene
.
add
(
cube
);
}
}
...
@@ -117,6 +117,23 @@
...
@@ -117,6 +117,23 @@
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
left
=
window
.
innerWidth
/
-
2
;
camera
.
right
=
window
.
innerWidth
/
2
;
camera
.
top
=
window
.
innerHeight
/
2
;
camera
.
bottom
=
window
.
innerHeight
/
-
2
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_geometry_birds.html
浏览文件 @
ce4cae51
...
@@ -383,6 +383,19 @@
...
@@ -383,6 +383,19 @@
document
.
getElementById
(
'
container
'
).
appendChild
(
stats
.
domElement
);
document
.
getElementById
(
'
container
'
).
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/canvas_geometry_cube.html
浏览文件 @
ce4cae51
...
@@ -91,6 +91,23 @@
...
@@ -91,6 +91,23 @@
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
@@ -105,6 +122,7 @@
...
@@ -105,6 +122,7 @@
mouseXOnMouseDown
=
event
.
clientX
-
windowHalfX
;
mouseXOnMouseDown
=
event
.
clientX
-
windowHalfX
;
targetRotationOnMouseDown
=
targetRotation
;
targetRotationOnMouseDown
=
targetRotation
;
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
@@ -112,6 +130,7 @@
...
@@ -112,6 +130,7 @@
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseX
=
event
.
clientX
-
windowHalfX
;
targetRotation
=
targetRotationOnMouseDown
+
(
mouseX
-
mouseXOnMouseDown
)
*
0.02
;
targetRotation
=
targetRotationOnMouseDown
+
(
mouseX
-
mouseXOnMouseDown
)
*
0.02
;
}
}
function
onDocumentMouseUp
(
event
)
{
function
onDocumentMouseUp
(
event
)
{
...
@@ -119,6 +138,7 @@
...
@@ -119,6 +138,7 @@
document
.
removeEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
removeEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
removeEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
removeEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
removeEventListener
(
'
mouseout
'
,
onDocumentMouseOut
,
false
);
document
.
removeEventListener
(
'
mouseout
'
,
onDocumentMouseOut
,
false
);
}
}
function
onDocumentMouseOut
(
event
)
{
function
onDocumentMouseOut
(
event
)
{
...
@@ -126,11 +146,12 @@
...
@@ -126,11 +146,12 @@
document
.
removeEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
removeEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
removeEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
removeEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
removeEventListener
(
'
mouseout
'
,
onDocumentMouseOut
,
false
);
document
.
removeEventListener
(
'
mouseout
'
,
onDocumentMouseOut
,
false
);
}
}
function
onDocumentTouchStart
(
event
)
{
function
onDocumentTouchStart
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -138,11 +159,12 @@
...
@@ -138,11 +159,12 @@
targetRotationOnMouseDown
=
targetRotation
;
targetRotationOnMouseDown
=
targetRotation
;
}
}
}
}
function
onDocumentTouchMove
(
event
)
{
function
onDocumentTouchMove
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -150,6 +172,7 @@
...
@@ -150,6 +172,7 @@
targetRotation
=
targetRotationOnMouseDown
+
(
mouseX
-
mouseXOnMouseDown
)
*
0.05
;
targetRotation
=
targetRotationOnMouseDown
+
(
mouseX
-
mouseXOnMouseDown
)
*
0.05
;
}
}
}
}
//
//
...
...
examples/canvas_geometry_earth.html
浏览文件 @
ce4cae51
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
scene
.
add
(
group
);
scene
.
add
(
group
);
// earth
// earth
var
earthTexture
=
new
THREE
.
Texture
();
var
earthTexture
=
new
THREE
.
Texture
();
var
loader
=
new
THREE
.
ImageLoader
();
var
loader
=
new
THREE
.
ImageLoader
();
...
@@ -84,12 +84,12 @@
...
@@ -84,12 +84,12 @@
group
.
add
(
mesh
);
group
.
add
(
mesh
);
// shadow
// shadow
var
shadowTexture
=
new
THREE
.
Texture
();
var
shadowTexture
=
new
THREE
.
Texture
();
var
loader
=
new
THREE
.
ImageLoader
();
var
loader
=
new
THREE
.
ImageLoader
();
loader
.
addEventListener
(
'
load
'
,
function
(
event
)
{
loader
.
addEventListener
(
'
load
'
,
function
(
event
)
{
shadowTexture
.
image
=
event
.
content
;
shadowTexture
.
image
=
event
.
content
;
shadowTexture
.
needsUpdate
=
true
;
shadowTexture
.
needsUpdate
=
true
;
...
@@ -116,6 +116,22 @@
...
@@ -116,6 +116,22 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/canvas_geometry_hierarchy.html
浏览文件 @
ce4cae51
...
@@ -82,6 +82,22 @@
...
@@ -82,6 +82,22 @@
stats
.
domElement
.
style
.
zIndex
=
100
;
stats
.
domElement
.
style
.
zIndex
=
100
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/canvas_geometry_panorama.html
浏览文件 @
ce4cae51
...
@@ -96,6 +96,21 @@
...
@@ -96,6 +96,21 @@
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
render
();
}
}
function
loadTexture
(
path
)
{
function
loadTexture
(
path
)
{
...
@@ -141,6 +156,7 @@
...
@@ -141,6 +156,7 @@
render
();
render
();
}
}
}
}
function
onDocumentMouseUp
(
event
)
{
function
onDocumentMouseUp
(
event
)
{
...
...
examples/canvas_geometry_panorama_fisheye.html
浏览文件 @
ce4cae51
...
@@ -106,6 +106,21 @@
...
@@ -106,6 +106,21 @@
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
render
();
}
}
function
loadTexture
(
path
)
{
function
loadTexture
(
path
)
{
...
...
examples/canvas_geometry_terrain.html
浏览文件 @
ce4cae51
...
@@ -98,6 +98,22 @@
...
@@ -98,6 +98,22 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
generateHeight
(
width
,
height
)
{
function
generateHeight
(
width
,
height
)
{
...
...
examples/canvas_geometry_text.html
浏览文件 @
ce4cae51
...
@@ -120,6 +120,22 @@
...
@@ -120,6 +120,22 @@
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_interactive_cubes.html
浏览文件 @
ce4cae51
...
@@ -102,6 +102,19 @@
...
@@ -102,6 +102,19 @@
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseDown
(
event
)
{
function
onDocumentMouseDown
(
event
)
{
...
...
examples/canvas_interactive_cubes_tween.html
浏览文件 @
ce4cae51
...
@@ -81,6 +81,19 @@
...
@@ -81,6 +81,19 @@
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseDown
(
event
)
{
function
onDocumentMouseDown
(
event
)
{
...
...
examples/canvas_interactive_particles.html
浏览文件 @
ce4cae51
...
@@ -95,6 +95,19 @@
...
@@ -95,6 +95,19 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/canvas_interactive_voxelpainter.html
浏览文件 @
ce4cae51
...
@@ -115,6 +115,19 @@
...
@@ -115,6 +115,19 @@
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keyup
'
,
onDocumentKeyUp
,
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
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/canvas_lights_pointlights.html
浏览文件 @
ce4cae51
...
@@ -106,6 +106,19 @@
...
@@ -106,6 +106,19 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
container
.
appendChild
(
renderer
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_lights_pointlights_smooth.html
浏览文件 @
ce4cae51
...
@@ -108,6 +108,19 @@
...
@@ -108,6 +108,19 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
container
.
appendChild
(
renderer
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_lines.html
浏览文件 @
ce4cae51
...
@@ -97,6 +97,23 @@
...
@@ -97,6 +97,23 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
@@ -105,6 +122,7 @@
...
@@ -105,6 +122,7 @@
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseY
=
event
.
clientY
-
windowHalfY
;
mouseY
=
event
.
clientY
-
windowHalfY
;
}
}
function
onDocumentTouchStart
(
event
)
{
function
onDocumentTouchStart
(
event
)
{
...
...
examples/canvas_lines_sphere.html
浏览文件 @
ce4cae51
...
@@ -111,6 +111,23 @@
...
@@ -111,6 +111,23 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_materials.html
浏览文件 @
ce4cae51
...
@@ -162,6 +162,19 @@
...
@@ -162,6 +162,19 @@
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
loadImage
(
path
)
{
function
loadImage
(
path
)
{
...
...
examples/canvas_materials_depth.html
浏览文件 @
ce4cae51
...
@@ -33,9 +33,6 @@
...
@@ -33,9 +33,6 @@
var
mouseX
=
0
;
var
mouseX
=
0
;
var
mouseXOnMouseDown
=
0
;
var
mouseXOnMouseDown
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
moveForward
=
false
;
var
moveForward
=
false
;
var
moveBackwards
=
false
;
var
moveBackwards
=
false
;
var
moveLeft
=
false
;
var
moveLeft
=
false
;
...
@@ -121,6 +118,20 @@
...
@@ -121,6 +118,20 @@
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keyup
'
,
onDocumentKeyUp
,
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
)
{
function
onDocumentKeyDown
(
event
)
{
...
...
examples/canvas_materials_normal.html
浏览文件 @
ce4cae51
...
@@ -72,6 +72,19 @@
...
@@ -72,6 +72,19 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
container
.
appendChild
(
renderer
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_materials_reflection.html
浏览文件 @
ce4cae51
...
@@ -75,6 +75,19 @@
...
@@ -75,6 +75,19 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
container
.
appendChild
(
renderer
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_materials_video.html
浏览文件 @
ce4cae51
...
@@ -151,6 +151,7 @@
...
@@ -151,6 +151,7 @@
scene
.
add
(
particle
);
scene
.
add
(
particle
);
}
}
}
}
renderer
=
new
THREE
.
CanvasRenderer
();
renderer
=
new
THREE
.
CanvasRenderer
();
...
@@ -165,9 +166,25 @@
...
@@ -165,9 +166,25 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
mouseX
=
(
event
.
clientX
-
windowHalfX
);
mouseX
=
(
event
.
clientX
-
windowHalfX
);
mouseY
=
(
event
.
clientY
-
windowHalfY
)
*
0.2
;
mouseY
=
(
event
.
clientY
-
windowHalfY
)
*
0.2
;
...
...
examples/canvas_particles_floor.html
浏览文件 @
ce4cae51
...
@@ -88,11 +88,28 @@
...
@@ -88,11 +88,28 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseX
=
event
.
clientX
-
windowHalfX
;
mouseY
=
event
.
clientY
-
windowHalfY
;
mouseY
=
event
.
clientY
-
windowHalfY
;
...
@@ -118,6 +135,7 @@
...
@@ -118,6 +135,7 @@
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
}
}
}
}
//
//
...
...
examples/canvas_particles_random.html
浏览文件 @
ce4cae51
...
@@ -81,6 +81,23 @@
...
@@ -81,6 +81,23 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
@@ -93,24 +110,28 @@
...
@@ -93,24 +110,28 @@
function
onDocumentTouchStart
(
event
)
{
function
onDocumentTouchStart
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
}
}
}
}
function
onDocumentTouchMove
(
event
)
{
function
onDocumentTouchMove
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseX
=
event
.
touches
[
0
].
pageX
-
windowHalfX
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
mouseY
=
event
.
touches
[
0
].
pageY
-
windowHalfY
;
}
}
}
}
//
//
...
...
examples/canvas_particles_shapes.html
浏览文件 @
ce4cae51
...
@@ -138,6 +138,7 @@
...
@@ -138,6 +138,7 @@
heartShape
.
bezierCurveTo
(
x
+
35
,
y
,
x
+
25
,
y
+
25
,
x
+
25
,
y
+
25
);
heartShape
.
bezierCurveTo
(
x
+
35
,
y
,
x
+
25
,
y
+
25
,
x
+
25
,
y
+
25
);
var
circleLines
=
function
(
context
)
{
var
circleLines
=
function
(
context
)
{
context
.
lineWidth
=
0.05
;
context
.
lineWidth
=
0.05
;
context
.
beginPath
();
context
.
beginPath
();
context
.
arc
(
0
,
0
,
1
,
0
,
Math
.
PI
*
2
,
true
);
context
.
arc
(
0
,
0
,
1
,
0
,
Math
.
PI
*
2
,
true
);
...
@@ -146,11 +147,13 @@
...
@@ -146,11 +147,13 @@
context
.
globalAlpha
=
0.2
;
context
.
globalAlpha
=
0.2
;
context
.
fill
();
context
.
fill
();
}
}
var
hue
=
0
;
var
hue
=
0
;
var
hearts
=
function
(
context
)
{
var
hearts
=
function
(
context
)
{
context
.
globalAlpha
=
0.5
;
context
.
globalAlpha
=
0.5
;
var
x
=
0
,
y
=
0
;
var
x
=
0
,
y
=
0
;
context
.
scale
(
0.1
,
-
0.1
);
// Scale so canvas render can redraw within bounds
context
.
scale
(
0.1
,
-
0.1
);
// Scale so canvas render can redraw within bounds
...
@@ -166,6 +169,7 @@
...
@@ -166,6 +169,7 @@
context
.
fill
();
context
.
fill
();
context
.
lineWidth
=
0.5
;
//0.05
context
.
lineWidth
=
0.5
;
//0.05
context
.
stroke
();
context
.
stroke
();
}
}
var
setTargetParticle
=
function
()
{
var
setTargetParticle
=
function
()
{
...
@@ -183,6 +187,7 @@
...
@@ -183,6 +187,7 @@
particleCloud
.
add
(
particle
);
particleCloud
.
add
(
particle
);
return
particle
;
return
particle
;
};
};
var
onParticleCreated
=
function
(
p
)
{
var
onParticleCreated
=
function
(
p
)
{
...
@@ -233,6 +238,22 @@
...
@@ -233,6 +238,22 @@
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
@@ -246,10 +267,14 @@
...
@@ -246,10 +267,14 @@
mouseXOnMouseDown
=
event
.
clientX
-
windowHalfX
;
mouseXOnMouseDown
=
event
.
clientX
-
windowHalfX
;
targetRotationOnMouseDown
=
targetRotation
;
targetRotationOnMouseDown
=
targetRotation
;
if
(
sparksEmitter
.
isRunning
())
{
if
(
sparksEmitter
.
isRunning
()
)
{
sparksEmitter
.
stop
();
sparksEmitter
.
stop
();
}
else
{
}
else
{
sparksEmitter
.
start
();
sparksEmitter
.
start
();
}
}
}
}
...
...
examples/canvas_particles_sprites.html
浏览文件 @
ce4cae51
...
@@ -72,8 +72,24 @@
...
@@ -72,8 +72,24 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
generateSprite
()
{
function
generateSprite
()
{
...
...
examples/canvas_particles_waves.html
浏览文件 @
ce4cae51
...
@@ -93,6 +93,23 @@
...
@@ -93,6 +93,23 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
@@ -106,7 +123,7 @@
...
@@ -106,7 +123,7 @@
function
onDocumentTouchStart
(
event
)
{
function
onDocumentTouchStart
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -119,7 +136,7 @@
...
@@ -119,7 +136,7 @@
function
onDocumentTouchMove
(
event
)
{
function
onDocumentTouchMove
(
event
)
{
if
(
event
.
touches
.
length
==
1
)
{
if
(
event
.
touches
.
length
==
=
1
)
{
event
.
preventDefault
();
event
.
preventDefault
();
...
@@ -158,6 +175,7 @@
...
@@ -158,6 +175,7 @@
particle
.
scale
.
x
=
particle
.
scale
.
y
=
(
Math
.
sin
(
(
ix
+
count
)
*
0.3
)
+
1
)
*
2
+
(
Math
.
sin
(
(
iy
+
count
)
*
0.5
)
+
1
)
*
2
;
particle
.
scale
.
x
=
particle
.
scale
.
y
=
(
Math
.
sin
(
(
ix
+
count
)
*
0.3
)
+
1
)
*
2
+
(
Math
.
sin
(
(
iy
+
count
)
*
0.5
)
+
1
)
*
2
;
}
}
}
}
renderer
.
render
(
scene
,
camera
);
renderer
.
render
(
scene
,
camera
);
...
...
examples/canvas_performance.html
浏览文件 @
ce4cae51
...
@@ -27,15 +27,6 @@
...
@@ -27,15 +27,6 @@
var
sphere
,
plane
;
var
sphere
,
plane
;
var
targetRotation
=
0
;
var
targetRotationOnMouseDown
=
0
;
var
mouseX
=
0
;
var
mouseXOnMouseDown
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
init
();
init
();
animate
();
animate
();
...
@@ -112,6 +103,19 @@
...
@@ -112,6 +103,19 @@
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
//
//
...
...
examples/canvas_sandbox.html
浏览文件 @
ce4cae51
...
@@ -155,6 +155,23 @@
...
@@ -155,6 +155,23 @@
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keydown
'
,
onDocumentKeyDown
,
false
);
document
.
addEventListener
(
'
keyup
'
,
onDocumentKeyUp
,
false
);
document
.
addEventListener
(
'
keyup
'
,
onDocumentKeyUp
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentKeyDown
(
event
)
{
function
onDocumentKeyDown
(
event
)
{
...
...
examples/js/effects/AsciiEffect.js
浏览文件 @
ce4cae51
/*
/*
* @author zz85 / https://github.com/zz85
* @author zz85 / https://github.com/zz85
*
*
* Ascii generation is based on http://www.nihilogic.dk/labs/jsascii/
* Ascii generation is based on http://www.nihilogic.dk/labs/jsascii/
* Maybe more about this later with a blog post at http://lab4games.net/zz85/blog
* Maybe more about this later with a blog post at http://lab4games.net/zz85/blog
*
*
* 16 April 2012 - @blurspline
* 16 April 2012 - @blurspline
*/
*/
THREE
.
AsciiEffect
=
function
(
renderer
,
charSet
,
options
)
{
THREE
.
AsciiEffect
=
function
(
renderer
,
charSet
,
options
)
{
// its fun to create one your own!
// its fun to create one your own!
charSet
=
(
charSet
===
undefined
)
?
'
.:-=+*#%@
'
:
charSet
;
charSet
=
(
charSet
===
undefined
)
?
'
.:-=+*#%@
'
:
charSet
;
// ' .,:;=|iI+hHOE#`$';
// ' .,:;=|iI+hHOE#`$';
// darker bolder character set from https://github.com/saw/Canvas-ASCII-Art/
// darker bolder character set from https://github.com/saw/Canvas-ASCII-Art/
// ' .\'`^",:;Il!i~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'.split('');
// ' .\'`^",:;Il!i~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'.split('');
if
(
!
options
)
options
=
{};
if
(
!
options
)
options
=
{};
// Some ASCII settings
// Some ASCII settings
var
bResolution
=
!
options
[
'
resolution
'
]
?
0.15
:
options
[
'
resolution
'
];
// Higher for more details
var
bResolution
=
!
options
[
'
resolution
'
]
?
0.15
:
options
[
'
resolution
'
];
// Higher for more details
var
iScale
=
!
options
[
'
scale
'
]
?
1
:
options
[
'
scale
'
];
var
iScale
=
!
options
[
'
scale
'
]
?
1
:
options
[
'
scale
'
];
var
bColor
=
!
options
[
'
color
'
]
?
false
:
options
[
'
color
'
];
// nice but slows down rendering!
var
bColor
=
!
options
[
'
color
'
]
?
false
:
options
[
'
color
'
];
// nice but slows down rendering!
var
bAlpha
=
!
options
[
'
alpha
'
]
?
false
:
options
[
'
alpha
'
];
// Transparency
var
bAlpha
=
!
options
[
'
alpha
'
]
?
false
:
options
[
'
alpha
'
];
// Transparency
var
bBlock
=
!
options
[
'
block
'
]
?
false
:
options
[
'
block
'
];
// blocked characters. like good O dos
var
bBlock
=
!
options
[
'
block
'
]
?
false
:
options
[
'
block
'
];
// blocked characters. like good O dos
var
bInvert
=
!
options
[
'
invert
'
]
?
false
:
options
[
'
invert
'
];
// black is white, white is black
var
bInvert
=
!
options
[
'
invert
'
]
?
false
:
options
[
'
invert
'
];
// black is white, white is black
var
strResolution
=
'
low
'
;
var
strResolution
=
'
low
'
;
var
width
,
height
;
var
width
,
height
;
...
@@ -33,7 +36,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -33,7 +36,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
domElement
.
style
.
cursor
=
'
default
'
;
domElement
.
style
.
cursor
=
'
default
'
;
var
oAscii
=
document
.
createElement
(
"
table
"
);
var
oAscii
=
document
.
createElement
(
"
table
"
);
domElement
.
appendChild
(
oAscii
);
domElement
.
appendChild
(
oAscii
);
var
iWidth
,
iHeight
;
var
iWidth
,
iHeight
;
var
oImg
;
var
oImg
;
...
@@ -61,6 +64,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -61,6 +64,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
// Throw in ascii library from http://www.nihilogic.dk/labs/jsascii/jsascii.js
// Throw in ascii library from http://www.nihilogic.dk/labs/jsascii/jsascii.js
/*
/*
* jsAscii 0.1
* jsAscii 0.1
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
...
@@ -68,8 +72,9 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -68,8 +72,9 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
*/
*/
function
initAsciiSize
()
{
function
initAsciiSize
()
{
iWidth
=
Math
.
round
(
width
*
fResolution
);
iHeight
=
Math
.
round
(
height
*
fResolution
);
iWidth
=
Math
.
round
(
width
*
fResolution
);
iHeight
=
Math
.
round
(
height
*
fResolution
);
oCanvas
.
width
=
iWidth
;
oCanvas
.
width
=
iWidth
;
oCanvas
.
height
=
iHeight
;
oCanvas
.
height
=
iHeight
;
...
@@ -78,9 +83,12 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -78,9 +83,12 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
// oCanvas.style.height = iHeight;
// oCanvas.style.height = iHeight;
oImg
=
renderer
.
domElement
;
oImg
=
renderer
.
domElement
;
if
(
oImg
.
style
.
backgroundColor
)
{
if
(
oImg
.
style
.
backgroundColor
)
{
oAscii
.
rows
[
0
].
cells
[
0
].
style
.
backgroundColor
=
oImg
.
style
.
backgroundColor
;
oAscii
.
rows
[
0
].
cells
[
0
].
style
.
backgroundColor
=
oImg
.
style
.
backgroundColor
;
oAscii
.
rows
[
0
].
cells
[
0
].
style
.
color
=
oImg
.
style
.
color
;
oAscii
.
rows
[
0
].
cells
[
0
].
style
.
color
=
oImg
.
style
.
color
;
}
}
oAscii
.
cellSpacing
=
0
;
oAscii
.
cellSpacing
=
0
;
...
@@ -112,6 +120,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -112,6 +120,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
if
(
!
oCanvas
.
getContext
)
{
if
(
!
oCanvas
.
getContext
)
{
return
;
return
;
}
}
var
oCtx
=
oCanvas
.
getContext
(
"
2d
"
);
var
oCtx
=
oCanvas
.
getContext
(
"
2d
"
);
if
(
!
oCtx
.
getImageData
)
{
if
(
!
oCtx
.
getImageData
)
{
return
;
return
;
...
@@ -119,49 +128,63 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -119,49 +128,63 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
var
aCharList
=
(
bColor
?
aDefaultColorCharList
:
aDefaultCharList
);
var
aCharList
=
(
bColor
?
aDefaultColorCharList
:
aDefaultCharList
);
if
(
charSet
)
aCharList
=
charSet
;
if
(
charSet
)
aCharList
=
charSet
;
var
fResolution
=
0.5
;
var
fResolution
=
0.5
;
switch
(
strResolution
)
{
switch
(
strResolution
)
{
case
"
low
"
:
fResolution
=
0.25
;
break
;
case
"
low
"
:
fResolution
=
0.25
;
break
;
case
"
medium
"
:
fResolution
=
0.5
;
break
;
case
"
medium
"
:
fResolution
=
0.5
;
break
;
case
"
high
"
:
fResolution
=
1
;
break
;
case
"
high
"
:
fResolution
=
1
;
break
;
}
}
if
(
bResolution
)
fResolution
=
bResolution
;
if
(
bResolution
)
fResolution
=
bResolution
;
// Setup dom
// Setup dom
var
fFontSize
=
(
2
/
fResolution
)
*
iScale
;
var
fFontSize
=
(
2
/
fResolution
)
*
iScale
;
var
fLineHeight
=
(
2
/
fResolution
)
*
iScale
;
var
fLineHeight
=
(
2
/
fResolution
)
*
iScale
;
// adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width.
// adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width.
var
fLetterSpacing
=
0
;
var
fLetterSpacing
=
0
;
if
(
strResolution
==
"
low
"
)
{
if
(
strResolution
==
"
low
"
)
{
switch
(
iScale
)
{
switch
(
iScale
)
{
case
1
:
fLetterSpacing
=
-
1
;
break
;
case
1
:
fLetterSpacing
=
-
1
;
break
;
case
2
:
case
2
:
case
3
:
fLetterSpacing
=
-
2.1
;
break
;
case
3
:
fLetterSpacing
=
-
2.1
;
break
;
case
4
:
fLetterSpacing
=
-
3.1
;
break
;
case
4
:
fLetterSpacing
=
-
3.1
;
break
;
case
5
:
fLetterSpacing
=
-
4.15
;
break
;
case
5
:
fLetterSpacing
=
-
4.15
;
break
;
}
}
}
}
if
(
strResolution
==
"
medium
"
)
{
if
(
strResolution
==
"
medium
"
)
{
switch
(
iScale
)
{
switch
(
iScale
)
{
case
1
:
fLetterSpacing
=
0
;
break
;
case
1
:
fLetterSpacing
=
0
;
break
;
case
2
:
fLetterSpacing
=
-
1
;
break
;
case
2
:
fLetterSpacing
=
-
1
;
break
;
case
3
:
fLetterSpacing
=
-
1.04
;
break
;
case
3
:
fLetterSpacing
=
-
1.04
;
break
;
case
4
:
case
4
:
case
5
:
fLetterSpacing
=
-
2.1
;
break
;
case
5
:
fLetterSpacing
=
-
2.1
;
break
;
}
}
}
}
if
(
strResolution
==
"
high
"
)
{
if
(
strResolution
==
"
high
"
)
{
switch
(
iScale
)
{
switch
(
iScale
)
{
case
1
:
case
1
:
case
2
:
fLetterSpacing
=
0
;
break
;
case
2
:
fLetterSpacing
=
0
;
break
;
case
3
:
case
3
:
case
4
:
case
4
:
case
5
:
fLetterSpacing
=
-
1
;
break
;
case
5
:
fLetterSpacing
=
-
1
;
break
;
}
}
}
}
...
@@ -169,10 +192,11 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -169,10 +192,11 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
// convert img element to ascii
// convert img element to ascii
function
asciifyImage
(
canvasRenderer
,
oAscii
)
{
oCtx
.
clearRect
(
0
,
0
,
iWidth
,
iHeight
);
function
asciifyImage
(
canvasRenderer
,
oAscii
)
{
oCtx
.
drawImage
(
oCanvasImg
,
0
,
0
,
iWidth
,
iHeight
);
oCtx
.
clearRect
(
0
,
0
,
iWidth
,
iHeight
);
oCtx
.
drawImage
(
oCanvasImg
,
0
,
0
,
iWidth
,
iHeight
);
var
oImgData
=
oCtx
.
getImageData
(
0
,
0
,
iWidth
,
iHeight
).
data
;
var
oImgData
=
oCtx
.
getImageData
(
0
,
0
,
iWidth
,
iHeight
).
data
;
// Coloring loop starts now
// Coloring loop starts now
...
@@ -183,7 +207,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -183,7 +207,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
for
(
var
y
=
0
;
y
<
iHeight
;
y
+=
2
)
{
for
(
var
y
=
0
;
y
<
iHeight
;
y
+=
2
)
{
for
(
var
x
=
0
;
x
<
iWidth
;
x
++
)
{
for
(
var
x
=
0
;
x
<
iWidth
;
x
++
)
{
var
iOffset
=
(
y
*
iWidth
+
x
)
*
4
;
var
iOffset
=
(
y
*
iWidth
+
x
)
*
4
;
var
iRed
=
oImgData
[
iOffset
];
var
iRed
=
oImgData
[
iOffset
];
var
iGreen
=
oImgData
[
iOffset
+
1
];
var
iGreen
=
oImgData
[
iOffset
+
1
];
var
iBlue
=
oImgData
[
iOffset
+
2
];
var
iBlue
=
oImgData
[
iOffset
+
2
];
...
@@ -194,14 +218,14 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -194,14 +218,14 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
fBrightness
=
(
0.3
*
iRed
+
0.59
*
iGreen
+
0.11
*
iBlue
)
/
255
;
fBrightness
=
(
0.3
*
iRed
+
0.59
*
iGreen
+
0.11
*
iBlue
)
/
255
;
// fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255;
// fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255;
if
(
iAlpha
==
0
)
{
if
(
iAlpha
==
0
)
{
// should calculate alpha instead, but quick hack :)
// should calculate alpha instead, but quick hack :)
//fBrightness *= (iAlpha / 255);
//fBrightness *= (iAlpha / 255);
fBrightness
=
1
;
fBrightness
=
1
;
}
}
iCharIdx
=
Math
.
floor
((
1
-
fBrightness
)
*
(
aCharList
.
length
-
1
));
iCharIdx
=
Math
.
floor
((
1
-
fBrightness
)
*
(
aCharList
.
length
-
1
));
if
(
bInvert
)
{
if
(
bInvert
)
{
...
@@ -212,7 +236,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -212,7 +236,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
//fBrightness = Math.floor(fBrightness * 10);
//fBrightness = Math.floor(fBrightness * 10);
//strThisChar = fBrightness;
//strThisChar = fBrightness;
var
strThisChar
=
aCharList
[
iCharIdx
];
var
strThisChar
=
aCharList
[
iCharIdx
];
if
(
strThisChar
===
undefined
||
strThisChar
==
"
"
)
if
(
strThisChar
===
undefined
||
strThisChar
==
"
"
)
strThisChar
=
"
"
;
strThisChar
=
"
"
;
...
@@ -229,14 +253,14 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
...
@@ -229,14 +253,14 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
}
}
strChars
+=
"
<br/>
"
;
strChars
+=
"
<br/>
"
;
}
}
oAscii
.
innerHTML
=
"
<tr><td>
"
+
strChars
+
"
</td></tr>
"
;
oAscii
.
innerHTML
=
"
<tr><td>
"
+
strChars
+
"
</td></tr>
"
;
// console.timeEnd('rendering');
// console.timeEnd('rendering');
// return oAscii;
// return oAscii;
}
}
// end modified asciifyImage block
// end modified asciifyImage block
};
};
examples/misc_lights_test.html
浏览文件 @
ce4cae51
...
@@ -178,8 +178,8 @@
...
@@ -178,8 +178,8 @@
camera
.
aspect
=
SCREEN_WIDTH
/
SCREEN_HEIGHT
;
camera
.
aspect
=
SCREEN_WIDTH
/
SCREEN_HEIGHT
;
camera
.
updateProjectionMatrix
();
camera
.
updateProjectionMatrix
();
if
(
render_canvas
)
canvasRenderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
if
(
canvasRenderer
)
canvasRenderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
if
(
render_gl
&&
has_gl
)
webglRenderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
if
(
webglRenderer
)
webglRenderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
}
}
...
...
examples/webgl_loader_json_objconverter.html
浏览文件 @
ce4cae51
...
@@ -205,8 +205,8 @@
...
@@ -205,8 +205,8 @@
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
camera
.
updateProjectionMatrix
();
if
(
render_gl
&&
has_gl
)
webglRenderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
if
(
webglRenderer
)
webglRenderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
if
(
render_canvas
)
canvasRenderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
if
(
canvasRenderer
)
canvasRenderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
...
...
examples/webgl_loader_obj.html
浏览文件 @
ce4cae51
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
init
();
init
();
animate
();
animate
();
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
});
});
loader
.
load
(
'
obj/male02/male02.obj
'
);
loader
.
load
(
'
obj/male02/male02.obj
'
);
//
//
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
...
@@ -112,6 +112,22 @@
...
@@ -112,6 +112,22 @@
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
onDocumentMouseMove
(
event
)
{
function
onDocumentMouseMove
(
event
)
{
...
...
examples/webgl_loader_scene.html
浏览文件 @
ce4cae51
...
@@ -311,6 +311,22 @@
...
@@ -311,6 +311,22 @@
$
(
"
plus_exp
"
).
addEventListener
(
'
click
'
,
createToggle
(
"
exp
"
),
false
);
$
(
"
plus_exp
"
).
addEventListener
(
'
click
'
,
createToggle
(
"
exp
"
),
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
setButtonActive
(
id
)
{
function
setButtonActive
(
id
)
{
...
...
examples/webgl_loader_scene_blender.html
浏览文件 @
ce4cae51
...
@@ -278,6 +278,22 @@
...
@@ -278,6 +278,22 @@
$
(
"
plus_exp
"
).
addEventListener
(
'
click
'
,
createToggle
(
"
exp
"
),
false
);
$
(
"
plus_exp
"
).
addEventListener
(
'
click
'
,
createToggle
(
"
exp
"
),
false
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
setButtonActive
(
id
)
{
function
setButtonActive
(
id
)
{
...
...
examples/webgl_loader_utf8.html
浏览文件 @
ce4cae51
...
@@ -125,6 +125,22 @@
...
@@ -125,6 +125,22 @@
},
{
scale
:
0.707192
,
offsetX
:
-
0.109362
,
offsetY
:
-
0.006435
,
offsetZ
:
-
0.268751
}
);
},
{
scale
:
0.707192
,
offsetX
:
-
0.109362
,
offsetY
:
-
0.006435
,
offsetZ
:
-
0.268751
}
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
,
windowHalfY
=
window
.
innerHeight
/
2
,
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
}
function
callbackModel
(
geometry
,
s
,
color
,
x
,
y
,
z
)
{
function
callbackModel
(
geometry
,
s
,
color
,
x
,
y
,
z
)
{
...
...
examples/webgl_loader_vtk.html
浏览文件 @
ce4cae51
...
@@ -110,6 +110,21 @@
...
@@ -110,6 +110,21 @@
stats
.
domElement
.
style
.
top
=
'
0px
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
controls
.
handleResize
();
}
}
function
animate
()
{
function
animate
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录