Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
7eef51a2
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,发现更多精彩内容 >>
提交
7eef51a2
编写于
1月 09, 2017
作者:
B
bdysvik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updating the snowflake example so that it is compatible with latest glTF specification
上级
e4a46ae5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
123 addition
and
35 deletion
+123
-35
examples/js/loaders/GLTFLoader.js
examples/js/loaders/GLTFLoader.js
+6
-2
examples/models/gltf/snowflake/line_frag.glsl
examples/models/gltf/snowflake/line_frag.glsl
+2
-2
examples/models/gltf/snowflake/line_vert.glsl
examples/models/gltf/snowflake/line_vert.glsl
+3
-5
examples/models/gltf/snowflake/snowFlake.gltf
examples/models/gltf/snowflake/snowFlake.gltf
+47
-6
examples/models/gltf/snowflakes/line_frag.glsl
examples/models/gltf/snowflakes/line_frag.glsl
+2
-2
examples/models/gltf/snowflakes/line_vert.glsl
examples/models/gltf/snowflakes/line_vert.glsl
+3
-5
examples/models/gltf/snowflakes/snowFlakes.gltf
examples/models/gltf/snowflakes/snowFlakes.gltf
+60
-13
未找到文件。
examples/js/loaders/GLTFLoader.js
浏览文件 @
7eef51a2
...
...
@@ -1241,7 +1241,9 @@ THREE.GLTFLoader = ( function () {
var
attributes
=
primitive
.
attributes
;
_each
(
attributes
,
function
(
attributeEntry
,
attributeId
)
{
for
(
var
attributeId
in
attributes
)
{
var
attributeEntry
=
attributes
[
attributeId
];
if
(
!
attributeEntry
)
{
...
...
@@ -1257,13 +1259,15 @@ THREE.GLTFLoader = ( function () {
geometry
.
addAttribute
(
'
position
'
,
bufferAttribute
);
break
;
case
'
COLOR_0
'
:
case
'
COLOR0
'
:
case
'
COLOR
'
:
geometry
.
addAttribute
(
'
color
'
,
bufferAttribute
);
break
;
}
}
)
;
};
if
(
primitive
.
indices
)
{
...
...
examples/models/gltf/snowflake/line_frag.glsl
浏览文件 @
7eef51a2
precision
highp
float
;
varying
vec3
v
ertexC
olor
;
varying
vec3
v
_c
olor
;
void
main
(
void
)
{
gl_FragColor
=
vec4
(
v
ertexColor
.
r
,
vertexColor
.
g
,
vertexC
olor
.
b
,
1
.
0
);;
gl_FragColor
=
vec4
(
v
_color
.
r
,
v_color
.
g
,
v_c
olor
.
b
,
1
.
0
);;
}
examples/models/gltf/snowflake/line_vert.glsl
浏览文件 @
7eef51a2
...
...
@@ -3,15 +3,13 @@ precision highp float;
attribute
vec3
position
;
attribute
vec3
color
;
varying
vec3
v_color
;
uniform
mat4
modelViewMatrix
;
uniform
mat4
projectionMatrix
;
varying
vec3
vertexColor
;
void
main
(
void
)
{
vec4
pos
=
modelViewMatrix
*
vec4
(
position
,
1
.
0
);
v
ertexColor
=
vec3
(
color
.
x
,
color
.
y
,
color
.
y
)
;
v
_color
=
color
;
gl_Position
=
projectionMatrix
*
pos
;
}
\ No newline at end of file
examples/models/gltf/snowflake/snowFlake.gltf
浏览文件 @
7eef51a2
...
...
@@ -7,6 +7,16 @@
"componentType": 5126,
"count": 257,
"type": "VEC3",
"max": [
250.0,
250.0,
0.0
],
"min": [
-250.0,
-250.0,
0.0
],
"name": "VertexAccessor"
},
"ColorAccessor": {
...
...
@@ -16,9 +26,22 @@
"componentType": 5126,
"count": 257,
"type": "VEC3",
"max": [
0.999963164,
0.99640733,
1.0
],
"min": [
0.500137746,
0.5041365,
1.0
],
"name": "ColorAccessor"
}
},
"asset": {
"version": "1.1"
},
"buffers": {
"Buffer": {
"uri": "snowFlake.bin",
...
...
@@ -58,7 +81,7 @@
{
"attributes": {
"POSITION": "VertexAccessor",
"COLOR": "ColorAccessor"
"COLOR
_0
": "ColorAccessor"
},
"material": "meshMaterial",
"mode": 1
...
...
@@ -79,8 +102,8 @@
"programs": {
"meshProgram": {
"attributes": [
"
VertexAccessor
",
"
ColorAccess
or"
"
a_position
",
"
a_col
or"
],
"fragmentShader": "fragmentShader",
"vertexShader": "vertexShader",
...
...
@@ -112,14 +135,32 @@
"techniques": {
"meshTechnique": {
"parameters": {
"modelViewMatrixParameter": {
"type": 35676,
"semantic": "MODELVIEW"
},
"projectionMatrixParameter": {
"type": 35676,
"semantic": "PROJECTION"
},
"position": {
"type": 35665,
"semantic": "POSITION"
},
"color": {
"type": 35665,
"semantic": "
color
"
"semantic": "
COLOR_0
"
}
},
"attributes": {},
"attributes": {
"a_position": "position",
"a_color": "color"
},
"program": "meshProgram",
"uniforms": {},
"uniforms": {
"modelViewMatrix": "modelViewMatrixParameter",
"projectionMatrix": "projectionMatrixParameter"
},
"states": {
"enable": [
3042,
...
...
examples/models/gltf/snowflakes/line_frag.glsl
浏览文件 @
7eef51a2
precision
highp
float
;
varying
vec3
v
ertexC
olor
;
varying
vec3
v
_c
olor
;
void
main
(
void
)
{
gl_FragColor
=
vec4
(
v
ertexColor
.
r
,
vertexColor
.
g
,
vertexC
olor
.
b
,
1
.
0
);;
gl_FragColor
=
vec4
(
v
_color
.
r
,
v_color
.
g
,
v_c
olor
.
b
,
1
.
0
);;
}
examples/models/gltf/snowflakes/line_vert.glsl
浏览文件 @
7eef51a2
...
...
@@ -3,15 +3,13 @@ precision highp float;
attribute
vec3
position
;
attribute
vec3
color
;
varying
vec3
v_color
;
uniform
mat4
modelViewMatrix
;
uniform
mat4
projectionMatrix
;
varying
vec3
vertexColor
;
void
main
(
void
)
{
vec4
pos
=
modelViewMatrix
*
vec4
(
position
,
1
.
0
);
v
ertexColor
=
vec3
(
color
.
x
,
color
.
y
,
color
.
y
)
;
v
_color
=
color
;
gl_Position
=
projectionMatrix
*
pos
;
}
\ No newline at end of file
examples/models/gltf/snowflakes/snowFlakes.gltf
浏览文件 @
7eef51a2
...
...
@@ -7,16 +7,32 @@
"componentType": 5126,
"count": 1376,
"type": "VEC3",
"max": [
2300.0,
2450.0,
0.0
],
"min": [
0.0,
0.0,
0.0
],
"name": "VertexAccessor"
},
"
Triangl
eAccessor": {
"bufferView": "Line
s
",
"
Lin
eAccessor": {
"bufferView": "Line
View
",
"byteOffset": 0,
"byteStride": 2,
"componentType": 5123,
"count": 2720,
"type": "SCALAR",
"name": "TriangleAccessor"
"max": [
1374.0
],
"min": [
0.0
],
"name": "LineAccessor"
},
"ColorAccessor": {
"bufferView": "ColorView",
...
...
@@ -25,9 +41,22 @@
"componentType": 5126,
"count": 1376,
"type": "VEC3",
"max": [
0.999963164,
0.999615431,
1.0
],
"min": [
0.500137746,
0.5002869,
1.0
],
"name": "ColorAccessor"
}
},
"asset": {
"version": "1.1"
},
"buffers": {
"Buffer": {
"uri": "snowFlakes.bin",
...
...
@@ -45,12 +74,12 @@
"target": 34962,
"name": "VertexBuffer"
},
"Line
s
": {
"Line
View
": {
"buffer": "Buffer",
"byteOffset": 16512,
"byteLength": 5440,
"target": 3496
2
,
"name": "Line
s
"
"target": 3496
3
,
"name": "Line
View
"
},
"ColorView": {
"buffer": "Buffer",
...
...
@@ -74,9 +103,9 @@
{
"attributes": {
"POSITION": "VertexAccessor",
"COLOR": "ColorAccessor"
"COLOR
_0
": "ColorAccessor"
},
"indices": "
Triangl
eAccessor",
"indices": "
Lin
eAccessor",
"material": "meshMaterial",
"mode": 1
}
...
...
@@ -96,8 +125,8 @@
"programs": {
"meshProgram": {
"attributes": [
"
VertexAccessor
",
"
ColorAccess
or"
"
a_position
",
"
a_col
or"
],
"fragmentShader": "fragmentShader",
"vertexShader": "vertexShader",
...
...
@@ -129,14 +158,32 @@
"techniques": {
"meshTechnique": {
"parameters": {
"modelViewMatrixParameter": {
"type": 35676,
"semantic": "MODELVIEW"
},
"projectionMatrixParameter": {
"type": 35676,
"semantic": "PROJECTION"
},
"position": {
"type": 35665,
"semantic": "POSITION"
},
"color": {
"type": 35665,
"semantic": "
color
"
"semantic": "
COLOR_0
"
}
},
"attributes": {},
"attributes": {
"a_position": "position",
"a_color": "color"
},
"program": "meshProgram",
"uniforms": {},
"uniforms": {
"modelViewMatrix": "modelViewMatrixParameter",
"projectionMatrix": "projectionMatrixParameter"
},
"states": {
"enable": [
3042,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录