Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
51528e26
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,体验更适合开发者的 AI 搜索 >>
提交
51528e26
编写于
2月 09, 2017
作者:
J
jonobr1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added vertex color picking from fbxloader2
上级
28d0cd70
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
3 deletion
+66
-3
examples/js/loaders/FBXLoader2.js
examples/js/loaders/FBXLoader2.js
+66
-3
未找到文件。
examples/js/loaders/FBXLoader2.js
浏览文件 @
51528e26
...
...
@@ -599,6 +599,12 @@
}
if
(
'
LayerElementColor
'
in
geometryNode
.
subNodes
)
{
var
colorInfo
=
getColors
(
geometryNode
);
}
if
(
'
LayerElementMaterial
'
in
geometryNode
.
subNodes
)
{
var
materialInfo
=
getMaterials
(
geometryNode
);
...
...
@@ -698,6 +704,12 @@
}
if
(
colorInfo
)
{
vertex
.
color
.
fromArray
(
getData
(
polygonVertexIndex
,
polygonIndex
,
vertexIndex
,
colorInfo
)
);
}
faceVertexBuffer
.
push
(
vertex
);
if
(
endOfFace
)
{
...
...
@@ -733,6 +745,11 @@
geo
.
addAttribute
(
'
uv
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
bufferInfo
.
uvBuffer
),
2
)
);
}
if
(
bufferInfo
.
colorsBuffer
.
length
>
0
)
{
geo
.
addAttribute
(
'
color
'
,
new
THREE
.
BufferAttribute
(
new
Float32Array
(
bufferInfo
.
colorsBuffer
),
4
)
);
}
if
(
deformer
)
{
...
...
@@ -828,6 +845,35 @@
}
/**
* Parses Vertex Color information for geometry.
* @param {FBXGeometryNode} geometryNode
* @returns {{dataSize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}}
*/
function
getColors
(
geometryNode
)
{
var
ColorNode
=
geometryNode
.
subNodes
.
LayerElementColor
[
0
];
var
mappingType
=
ColorNode
.
properties
.
MappingInformationType
;
var
referenceType
=
ColorNode
.
properties
.
ReferenceInformationType
;
var
buffer
=
parseFloatArray
(
ColorNode
.
subNodes
.
Colors
.
properties
.
a
);
var
indexBuffer
=
[];
if
(
referenceType
===
'
IndexToDirect
'
)
{
indexBuffer
=
parseFloatArray
(
ColorNode
.
subNodes
.
ColorIndex
.
properties
.
a
);
}
return
{
dataSize
:
4
,
buffer
:
buffer
,
indices
:
indexBuffer
,
mappingType
:
mappingType
,
referenceType
:
referenceType
};
}
/**
* Parses material application information for geometry.
* @param {FBXGeometryNode}
...
...
@@ -1399,7 +1445,7 @@
/**
* @type {{
curves: Map<number, {
curves: Map<number, {
T: {
id: number;
attr: string;
...
...
@@ -1519,7 +1565,7 @@
}
}>,
layers: Map<number, {
T: {
T: {
id: number;
attr: string;
internalID: number;
...
...
@@ -1943,7 +1989,7 @@
/**
* @type {{
T: {
T: {
id: number;
attr: string;
internalID: number;
...
...
@@ -3084,6 +3130,12 @@
*/
this
.
uv
=
new
THREE
.
Vector2
(
);
/**
* Color of the vertex
* @type {THREE.Vector4}
*/
this
.
color
=
new
THREE
.
Vector4
();
/**
* Indices of the bones vertex is influenced by.
* @type {THREE.Vector4}
...
...
@@ -3119,6 +3171,7 @@
var
vertexBuffer
=
this
.
position
.
toArray
();
var
normalBuffer
=
this
.
normal
.
toArray
();
var
uvBuffer
=
this
.
uv
.
toArray
();
var
colorBuffer
=
this
.
color
.
toArray
();
var
skinIndexBuffer
=
this
.
skinIndices
.
toArray
();
var
skinWeightBuffer
=
this
.
skinWeights
.
toArray
();
...
...
@@ -3126,6 +3179,7 @@
vertexBuffer
:
vertexBuffer
,
normalBuffer
:
normalBuffer
,
uvBuffer
:
uvBuffer
,
colorBuffer
:
colorBuffer
,
skinIndexBuffer
:
skinIndexBuffer
,
skinWeightBuffer
:
skinWeightBuffer
,
};
...
...
@@ -3167,6 +3221,7 @@
var
vertexBuffer
=
[];
var
normalBuffer
=
[];
var
uvBuffer
=
[];
var
colorsBuffer
=
[];
var
skinIndexBuffer
=
[];
var
skinWeightBuffer
=
[];
...
...
@@ -3178,6 +3233,7 @@
vertexBuffer
=
vertexBuffer
.
concat
(
flatVertex
.
vertexBuffer
);
normalBuffer
=
normalBuffer
.
concat
(
flatVertex
.
normalBuffer
);
uvBuffer
=
uvBuffer
.
concat
(
flatVertex
.
uvBuffer
);
colorsBuffer
=
colorsBuffer
.
concat
(
flatVertex
.
colorBuffer
);
skinIndexBuffer
=
skinIndexBuffer
.
concat
(
flatVertex
.
skinIndexBuffer
);
skinWeightBuffer
=
skinWeightBuffer
.
concat
(
flatVertex
.
skinWeightBuffer
);
...
...
@@ -3187,6 +3243,7 @@
vertexBuffer
:
vertexBuffer
,
normalBuffer
:
normalBuffer
,
uvBuffer
:
uvBuffer
,
colorsBuffer
:
colorsBuffer
,
skinIndexBuffer
:
skinIndexBuffer
,
skinWeightBuffer
:
skinWeightBuffer
,
};
...
...
@@ -3245,6 +3302,7 @@
var
vertexBuffer
=
[];
var
normalBuffer
=
[];
var
uvBuffer
=
[];
var
colorsBuffer
=
[];
var
skinIndexBuffer
=
[];
var
skinWeightBuffer
=
[];
...
...
@@ -3259,6 +3317,7 @@
vertexBuffer
=
vertexBuffer
.
concat
(
flatTriangle
.
vertexBuffer
);
normalBuffer
=
normalBuffer
.
concat
(
flatTriangle
.
normalBuffer
);
uvBuffer
=
uvBuffer
.
concat
(
flatTriangle
.
uvBuffer
);
colorsBuffer
=
colorsBuffer
.
concat
(
flatTriangle
.
colorsBuffer
);
skinIndexBuffer
=
skinIndexBuffer
.
concat
(
flatTriangle
.
skinIndexBuffer
);
skinWeightBuffer
=
skinWeightBuffer
.
concat
(
flatTriangle
.
skinWeightBuffer
);
materialIndexBuffer
=
materialIndexBuffer
.
concat
(
[
materialIndex
,
materialIndex
,
materialIndex
]
);
...
...
@@ -3269,6 +3328,7 @@
vertexBuffer
:
vertexBuffer
,
normalBuffer
:
normalBuffer
,
uvBuffer
:
uvBuffer
,
colorsBuffer
:
colorsBuffer
,
skinIndexBuffer
:
skinIndexBuffer
,
skinWeightBuffer
:
skinWeightBuffer
,
materialIndexBuffer
:
materialIndexBuffer
...
...
@@ -3305,6 +3365,7 @@
var
vertexBuffer
=
[];
var
normalBuffer
=
[];
var
uvBuffer
=
[];
var
colorsBuffer
=
[];
var
skinIndexBuffer
=
[];
var
skinWeightBuffer
=
[];
...
...
@@ -3317,6 +3378,7 @@
vertexBuffer
=
vertexBuffer
.
concat
(
flatFace
.
vertexBuffer
);
normalBuffer
=
normalBuffer
.
concat
(
flatFace
.
normalBuffer
);
uvBuffer
=
uvBuffer
.
concat
(
flatFace
.
uvBuffer
);
colorsBuffer
=
colorsBuffer
.
concat
(
flatFace
.
colorsBuffer
);
skinIndexBuffer
=
skinIndexBuffer
.
concat
(
flatFace
.
skinIndexBuffer
);
skinWeightBuffer
=
skinWeightBuffer
.
concat
(
flatFace
.
skinWeightBuffer
);
materialIndexBuffer
=
materialIndexBuffer
.
concat
(
flatFace
.
materialIndexBuffer
);
...
...
@@ -3327,6 +3389,7 @@
vertexBuffer
:
vertexBuffer
,
normalBuffer
:
normalBuffer
,
uvBuffer
:
uvBuffer
,
colorsBuffer
:
colorsBuffer
,
skinIndexBuffer
:
skinIndexBuffer
,
skinWeightBuffer
:
skinWeightBuffer
,
materialIndexBuffer
:
materialIndexBuffer
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录