Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b69e19e8
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,发现更多精彩内容 >>
提交
b69e19e8
编写于
8月 15, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Promoted BufferGeometry from src/extras/core to scr/core. Added basic example.
上级
6bdaf52a
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
34491 addition
and
34309 deletion
+34491
-34309
build/three.js
build/three.js
+34212
-34208
build/three.min.js
build/three.min.js
+88
-88
examples/webgl_buffergeometry.html
examples/webgl_buffergeometry.html
+173
-0
examples/webgl_geometry_colors.html
examples/webgl_geometry_colors.html
+1
-1
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+15
-11
utils/files.json
utils/files.json
+2
-1
未找到文件。
build/three.js
浏览文件 @
b69e19e8
此差异已折叠。
点击以展开。
build/three.min.js
浏览文件 @
b69e19e8
此差异已折叠。
点击以展开。
examples/webgl_buffergeometry.html
0 → 100644
浏览文件 @
b69e19e8
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - buffergeometry
</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
{
color
:
#808080
;
font-family
:
Monospace
;
font-size
:
13px
;
text-align
:
center
;
background-color
:
#fff
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
padding
:
5px
;
}
a
{
color
:
#0080ff
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
><a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
webgl - buffergeometry
</div>
<script
src=
"../build/three.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/Stats.js"
></script>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
var
mesh
;
init
();
animate
();
function
init
()
{
container
=
document
.
getElementById
(
'
container
'
);
camera
=
new
THREE
.
PerspectiveCamera
(
20
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
10000
);
camera
.
position
.
z
=
1800
;
scene
=
new
THREE
.
Scene
();
var
triangles
=
500
;
var
geometry
=
new
THREE
.
BufferGeometry
();
geometry
.
attributes
=
{
index
:
{
itemSize
:
1
,
array
:
new
Int16Array
(
triangles
*
3
),
numItems
:
triangles
*
3
},
position
:
{
itemSize
:
3
,
array
:
new
Float32Array
(
triangles
*
3
*
3
),
numItems
:
triangles
*
3
*
3
}
}
var
indices
=
geometry
.
attributes
.
index
.
array
;
for
(
var
i
=
0
;
i
<
indices
.
length
;
i
++
)
{
indices
[
i
]
=
i
;
}
var
positions
=
geometry
.
attributes
.
position
.
array
;
for
(
var
i
=
0
;
i
<
positions
.
length
;
i
+=
9
)
{
var
x
=
Math
.
random
()
*
400
-
200
;
var
y
=
Math
.
random
()
*
400
-
200
;
var
z
=
Math
.
random
()
*
400
-
200
;
positions
[
i
]
=
x
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
1
]
=
y
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
2
]
=
z
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
3
]
=
x
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
4
]
=
y
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
5
]
=
z
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
6
]
=
x
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
7
]
=
y
+
Math
.
random
()
*
40
-
20
;
positions
[
i
+
8
]
=
z
+
Math
.
random
()
*
40
-
20
;
}
geometry
.
offsets
=
[{
start
:
0
,
count
:
triangles
*
3
,
index
:
0
}]
geometry
.
computeBoundingSphere
()
geometry
.
computeVertexNormals
()
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshLambertMaterial
(
{
color
:
0x000000
,
side
:
THREE
.
DoubleSide
}
)
);
scene
.
add
(
mesh
);
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
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
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
function
render
()
{
mesh
.
rotation
.
x
+=
0.01
;
mesh
.
rotation
.
y
+=
0.02
;
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
examples/webgl_geometry_colors.html
浏览文件 @
b69e19e8
...
...
@@ -32,7 +32,7 @@
<body>
<div
id=
"container"
></div>
<div
id=
"info"
><a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
- vertex colors - webgl
</div>
<div
id=
"info"
><a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
webgl - vertex colors
</div>
<script
src=
"../build/three.min.js"
></script>
...
...
src/
extras/
core/BufferGeometry.js
→
src/core/BufferGeometry.js
浏览文件 @
b69e19e8
...
...
@@ -234,15 +234,15 @@ THREE.BufferGeometry.prototype = {
ab
.
sub
(
pA
,
pB
);
cb
.
crossSelf
(
ab
);
normals
[
vA
*
3
]
+=
cb
.
x
;
normals
[
vA
*
3
]
+=
cb
.
x
;
normals
[
vA
*
3
+
1
]
+=
cb
.
y
;
normals
[
vA
*
3
+
2
]
+=
cb
.
z
;
normals
[
vB
*
3
]
+=
cb
.
x
;
normals
[
vB
*
3
]
+=
cb
.
x
;
normals
[
vB
*
3
+
1
]
+=
cb
.
y
;
normals
[
vB
*
3
+
2
]
+=
cb
.
z
;
normals
[
vC
*
3
]
+=
cb
.
x
;
normals
[
vC
*
3
]
+=
cb
.
x
;
normals
[
vC
*
3
+
1
]
+=
cb
.
y
;
normals
[
vC
*
3
+
2
]
+=
cb
.
z
;
...
...
@@ -260,7 +260,7 @@ THREE.BufferGeometry.prototype = {
var
n
=
1.0
/
Math
.
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
normals
[
i
]
*=
n
;
normals
[
i
]
*=
n
;
normals
[
i
+
1
]
*=
n
;
normals
[
i
+
2
]
*=
n
;
...
...
@@ -372,13 +372,17 @@ THREE.BufferGeometry.prototype = {
r
=
1.0
/
(
s1
*
t2
-
s2
*
t1
);
sdir
.
set
(
(
t2
*
x1
-
t1
*
x2
)
*
r
,
(
t2
*
y1
-
t1
*
y2
)
*
r
,
(
t2
*
z1
-
t1
*
z2
)
*
r
);
tdir
.
set
(
(
s1
*
x2
-
s2
*
x1
)
*
r
,
(
s1
*
y2
-
s2
*
y1
)
*
r
,
(
s1
*
z2
-
s2
*
z1
)
*
r
);
sdir
.
set
(
(
t2
*
x1
-
t1
*
x2
)
*
r
,
(
t2
*
y1
-
t1
*
y2
)
*
r
,
(
t2
*
z1
-
t1
*
z2
)
*
r
);
tdir
.
set
(
(
s1
*
x2
-
s2
*
x1
)
*
r
,
(
s1
*
y2
-
s2
*
y1
)
*
r
,
(
s1
*
z2
-
s2
*
z1
)
*
r
);
tan1
[
a
].
addSelf
(
sdir
);
tan1
[
b
].
addSelf
(
sdir
);
...
...
utils/files.json
浏览文件 @
b69e19e8
...
...
@@ -21,6 +21,7 @@
"../src/core/Face4.js"
,
"../src/core/UV.js"
,
"../src/core/Geometry.js"
,
"../src/core/BufferGeometry.js"
,
"../src/core/Spline.js"
,
"../src/cameras/Camera.js"
,
"../src/cameras/OrthographicCamera.js"
,
...
...
@@ -84,7 +85,6 @@
"../src/extras/SceneUtils.js"
,
"../src/extras/ShaderUtils.js"
,
"../src/extras/FontUtils.js"
,
"../src/extras/core/BufferGeometry.js"
,
"../src/extras/core/Curve.js"
,
"../src/extras/core/CurvePath.js"
,
"../src/extras/core/Gyroscope.js"
,
...
...
@@ -216,6 +216,7 @@
"../src/core/Face4.js"
,
"../src/core/UV.js"
,
"../src/core/Geometry.js"
,
"../src/core/BufferGeometry.js"
,
"../src/core/Spline.js"
,
"../src/cameras/Camera.js"
,
"../src/cameras/OrthographicCamera.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录