Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
9bf2b8e0
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,发现更多精彩内容 >>
提交
9bf2b8e0
编写于
4月 25, 2018
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Examples: Clean up
上级
c5de9812
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
43 deletion
+26
-43
examples/webgl_raycast_texture.html
examples/webgl_raycast_texture.html
+5
-10
examples/webgl_shaders_tonemapping.html
examples/webgl_shaders_tonemapping.html
+1
-15
examples/webgl_shadowmap.html
examples/webgl_shadowmap.html
+2
-2
examples/webgl_shadowmap_performance.html
examples/webgl_shadowmap_performance.html
+2
-2
examples/webvr_vive.html
examples/webvr_vive.html
+3
-3
examples/webvr_vive_paint.html
examples/webvr_vive_paint.html
+9
-7
examples/webvr_vive_sculpt.html
examples/webvr_vive_sculpt.html
+4
-4
未找到文件。
examples/webgl_raycast_texture.html
浏览文件 @
9bf2b8e0
...
@@ -225,20 +225,15 @@
...
@@ -225,20 +225,15 @@
cubeTexture
=
new
THREE
.
Texture
(
undefined
,
THREE
.
UVMapping
,
THREE
.
RepeatWrapping
,
THREE
.
RepeatWrapping
);
cubeTexture
=
new
THREE
.
Texture
(
undefined
,
THREE
.
UVMapping
,
THREE
.
RepeatWrapping
,
THREE
.
RepeatWrapping
);
canvas
=
new
CanvasTexture
(
cubeTexture
);
canvas
=
new
CanvasTexture
(
cubeTexture
);
var
cubeMaterial
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
cubeTexture
}
);
var
cubeMaterial
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
cubeTexture
}
);
var
cubeGeometry
=
new
THREE
.
BoxGeometry
(
20
,
20
,
20
);
var
cubeGeometry
=
new
THREE
.
BoxBufferGeometry
(
20
,
20
,
20
);
var
uvs
=
cubeGeometry
.
attributes
.
uv
.
array
;
// Set a specific texture mapping.
// Set a specific texture mapping.
var
uvs
;
for
(
var
i
=
0
;
i
<
uvs
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
cubeGeometry
.
faceVertexUvs
[
0
].
length
;
i
++
)
{
uvs
=
cubeGeometry
.
faceVertexUvs
[
0
][
i
];
for
(
var
j
=
0
;
j
<
3
;
j
++
)
{
if
(
uvs
[
j
].
x
<
0.1
)
uvs
[
j
].
x
=
-
1
;
if
(
uvs
[
j
].
y
<
0.1
)
uvs
[
j
].
y
=
-
1
;
}
uvs
[
i
]
*=
2
;
}
}
var
cube
=
new
THREE
.
Mesh
(
cubeGeometry
,
cubeMaterial
);
var
cube
=
new
THREE
.
Mesh
(
cubeGeometry
,
cubeMaterial
);
cube
.
position
.
x
=
4
;
cube
.
position
.
x
=
4
;
cube
.
position
.
y
=
-
5
;
cube
.
position
.
y
=
-
5
;
...
...
examples/webgl_shaders_tonemapping.html
浏览文件 @
9bf2b8e0
...
@@ -323,22 +323,8 @@
...
@@ -323,22 +323,8 @@
var
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
var
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
textureCube
.
format
=
THREE
.
RGBFormat
;
textureCube
.
format
=
THREE
.
RGBFormat
;
var
skyboxShader
=
THREE
.
ShaderLib
[
"
cube
"
];
skyboxShader
.
uniforms
[
"
tCube
"
].
value
=
textureCube
;
var
skyboxMaterial
=
new
THREE
.
ShaderMaterial
(
{
fragmentShader
:
skyboxShader
.
fragmentShader
,
vertexShader
:
skyboxShader
.
vertexShader
,
uniforms
:
skyboxShader
.
uniforms
,
depthWrite
:
false
,
side
:
THREE
.
BackSide
}
),
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
100
,
100
,
100
),
skyboxMaterial
);
sceneCube
.
add
(
mesh
);
sceneCube
.
background
=
textureCube
;
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
...
...
examples/webgl_shadowmap.html
浏览文件 @
9bf2b8e0
...
@@ -241,7 +241,7 @@
...
@@ -241,7 +241,7 @@
// CUBES
// CUBES
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
1500
,
220
,
150
),
planeMaterial
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
Box
Buffer
Geometry
(
1500
,
220
,
150
),
planeMaterial
);
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
z
=
20
;
mesh
.
position
.
z
=
20
;
...
@@ -251,7 +251,7 @@
...
@@ -251,7 +251,7 @@
scene
.
add
(
mesh
);
scene
.
add
(
mesh
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
1600
,
170
,
250
),
planeMaterial
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
Box
Buffer
Geometry
(
1600
,
170
,
250
),
planeMaterial
);
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
z
=
20
;
mesh
.
position
.
z
=
20
;
...
...
examples/webgl_shadowmap_performance.html
浏览文件 @
9bf2b8e0
...
@@ -212,7 +212,7 @@
...
@@ -212,7 +212,7 @@
// CUBES
// CUBES
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
1500
,
220
,
150
),
planeMaterial
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
Box
Buffer
Geometry
(
1500
,
220
,
150
),
planeMaterial
);
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
z
=
20
;
mesh
.
position
.
z
=
20
;
...
@@ -222,7 +222,7 @@
...
@@ -222,7 +222,7 @@
scene
.
add
(
mesh
);
scene
.
add
(
mesh
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
1600
,
170
,
250
),
planeMaterial
);
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
Box
Buffer
Geometry
(
1600
,
170
,
250
),
planeMaterial
);
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
y
=
FLOOR
-
50
;
mesh
.
position
.
z
=
20
;
mesh
.
position
.
z
=
20
;
...
...
examples/webvr_vive.html
浏览文件 @
9bf2b8e0
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
10
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.1
,
10
);
room
=
new
THREE
.
Mesh
(
room
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
6
,
6
,
6
,
8
,
8
,
8
),
new
THREE
.
Box
Buffer
Geometry
(
6
,
6
,
6
,
8
,
8
,
8
),
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x404040
,
wireframe
:
true
}
)
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x404040
,
wireframe
:
true
}
)
);
);
room
.
position
.
y
=
3
;
room
.
position
.
y
=
3
;
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
light
.
position
.
set
(
1
,
1
,
1
).
normalize
();
light
.
position
.
set
(
1
,
1
,
1
).
normalize
();
scene
.
add
(
light
);
scene
.
add
(
light
);
var
geometry
=
new
THREE
.
BoxGeometry
(
0.2
,
0.2
,
0.2
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
0.2
,
0.2
,
0.2
);
for
(
var
i
=
0
;
i
<
200
;
i
++
)
{
for
(
var
i
=
0
;
i
<
200
;
i
++
)
{
...
@@ -217,7 +217,7 @@
...
@@ -217,7 +217,7 @@
var
cube
=
room
.
children
[
i
];
var
cube
=
room
.
children
[
i
];
if
(
cube
.
geometry
instanceof
THREE
.
BoxGeometry
===
false
)
continue
;
if
(
cube
.
geometry
instanceof
THREE
.
Box
Buffer
Geometry
===
false
)
continue
;
// cube.position.add( cube.userData.velocity );
// cube.position.add( cube.userData.velocity );
...
...
examples/webvr_vive_paint.html
浏览文件 @
9bf2b8e0
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
var
geometry
=
new
THREE
.
BoxGeometry
(
0.5
,
0.8
,
0.5
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
0.5
,
0.8
,
0.5
);
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x444444
,
color
:
0x444444
,
roughness
:
1.0
,
roughness
:
1.0
,
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
scene.add( table );
scene.add( table );
*/
*/
var
geometry
=
new
THREE
.
PlaneGeometry
(
4
,
4
);
var
geometry
=
new
THREE
.
Plane
Buffer
Geometry
(
4
,
4
);
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x222222
,
color
:
0x222222
,
roughness
:
1.0
,
roughness
:
1.0
,
...
@@ -162,8 +162,8 @@
...
@@ -162,8 +162,8 @@
controller
.
receiveShadow
=
true
;
controller
.
receiveShadow
=
true
;
// var pivot = new THREE.Group();
// var pivot = new THREE.Group();
// var pivot = new THREE.Mesh( new THREE.BoxGeometry( 0.01, 0.01, 0.01 ) );
// var pivot = new THREE.Mesh( new THREE.Box
Buffer
Geometry( 0.01, 0.01, 0.01 ) );
var
pivot
=
new
THREE
.
Mesh
(
new
THREE
.
IcosahedronGeometry
(
0.01
,
2
)
);
var
pivot
=
new
THREE
.
Mesh
(
new
THREE
.
Icosahedron
Buffer
Geometry
(
0.01
,
2
)
);
pivot
.
name
=
'
pivot
'
;
pivot
.
name
=
'
pivot
'
;
pivot
.
position
.
y
=
-
0.016
;
pivot
.
position
.
y
=
-
0.016
;
pivot
.
position
.
z
=
-
0.043
;
pivot
.
position
.
z
=
-
0.043
;
...
@@ -230,20 +230,22 @@
...
@@ -230,20 +230,22 @@
scene
.
add
(
line
);
scene
.
add
(
line
);
// Shapes
// Shapes
shapes
[
'
tube
'
]
=
getTubeShapes
(
1.0
);
shapes
[
'
tube
'
]
=
getTubeShapes
(
1.0
);
}
}
function
getTubeShapes
(
size
)
{
function
getTubeShapes
(
size
)
{
var
PI2
=
Math
.
PI
*
2
;
var
PI2
=
Math
.
PI
*
2
;
var
sides
=
10
;
var
sides
=
10
;
var
array
=
[];
var
array
=
[];
var
radius
=
0.01
*
size
;
var
radius
=
0.01
*
size
;
for
(
var
i
=
0
;
i
<
sides
;
i
++
){
for
(
var
i
=
0
;
i
<
sides
;
i
++
)
{
var
angle
=
(
i
/
sides
)
*
PI2
;
var
angle
=
(
i
/
sides
)
*
PI2
;
array
.
push
(
new
THREE
.
Vector3
(
Math
.
sin
(
angle
)
*
radius
,
Math
.
cos
(
angle
)
*
radius
,
0
)
);
array
.
push
(
new
THREE
.
Vector3
(
Math
.
sin
(
angle
)
*
radius
,
Math
.
cos
(
angle
)
*
radius
,
0
)
);
}
}
return
array
;
return
array
;
...
...
examples/webvr_vive_sculpt.html
浏览文件 @
9bf2b8e0
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
camera
=
new
THREE
.
PerspectiveCamera
(
70
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
var
geometry
=
new
THREE
.
BoxGeometry
(
0.5
,
0.8
,
0.5
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
0.5
,
0.8
,
0.5
);
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x444444
,
color
:
0x444444
,
roughness
:
1.0
,
roughness
:
1.0
,
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
table
.
receiveShadow
=
true
;
table
.
receiveShadow
=
true
;
scene
.
add
(
table
);
scene
.
add
(
table
);
var
geometry
=
new
THREE
.
PlaneGeometry
(
4
,
4
);
var
geometry
=
new
THREE
.
Plane
Buffer
Geometry
(
4
,
4
);
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
var
material
=
new
THREE
.
MeshStandardMaterial
(
{
color
:
0x222222
,
color
:
0x222222
,
roughness
:
1.0
,
roughness
:
1.0
,
...
@@ -139,8 +139,8 @@
...
@@ -139,8 +139,8 @@
controller
.
castShadow
=
true
;
controller
.
castShadow
=
true
;
controller
.
receiveShadow
=
true
;
controller
.
receiveShadow
=
true
;
// var pivot = new THREE.Mesh( new THREE.BoxGeometry( 0.01, 0.01, 0.01 ) );
// var pivot = new THREE.Mesh( new THREE.Box
Buffer
Geometry( 0.01, 0.01, 0.01 ) );
var
pivot
=
new
THREE
.
Mesh
(
new
THREE
.
IcosahedronGeometry
(
0.002
,
2
),
blob
.
material
);
var
pivot
=
new
THREE
.
Mesh
(
new
THREE
.
Icosahedron
Buffer
Geometry
(
0.002
,
2
),
blob
.
material
);
pivot
.
name
=
'
pivot
'
;
pivot
.
name
=
'
pivot
'
;
pivot
.
position
.
y
=
-
0.016
;
pivot
.
position
.
y
=
-
0.016
;
pivot
.
position
.
z
=
-
0.043
;
pivot
.
position
.
z
=
-
0.043
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录