Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
54b5ef63
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 搜索 >>
提交
54b5ef63
编写于
6月 03, 2020
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BufferGeometry: Retain interleaved data when using .clone().
上级
52479c1f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
109 addition
and
23 deletion
+109
-23
docs/api/en/core/InterleavedBuffer.html
docs/api/en/core/InterleavedBuffer.html
+12
-3
docs/api/zh/core/InterleavedBuffer.html
docs/api/zh/core/InterleavedBuffer.html
+13
-4
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+7
-3
src/core/InstancedInterleavedBuffer.js
src/core/InstancedInterleavedBuffer.js
+21
-0
src/core/InterleavedBuffer.d.ts
src/core/InterleavedBuffer.d.ts
+1
-1
src/core/InterleavedBuffer.js
src/core/InterleavedBuffer.js
+25
-2
src/core/InterleavedBufferAttribute.d.ts
src/core/InterleavedBufferAttribute.d.ts
+1
-1
src/core/InterleavedBufferAttribute.js
src/core/InterleavedBufferAttribute.js
+29
-9
未找到文件。
docs/api/en/core/InterleavedBuffer.html
浏览文件 @
54b5ef63
...
...
@@ -98,13 +98,22 @@
Stores multiple values in the buffer, reading input values from a specified array.
</p>
<h3>
[method:InterleavedBuffer clone]()
</h3>
<h3>
[method:InterleavedBuffer clone](
[param:Object data]
)
</h3>
<p>
data - This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
<br/><br
/>
Creates a clone of this [name].
</p>
<h3>
[method:BufferAttribute setUsage] ( [param:Usage value] )
</h3>
<p>
Set [page:BufferAttribute.usage usage] to value.
</p>
<h3>
[method:InterleavedBuffer setUsage] ( [param:Usage value] )
</h3>
<p>
Set [page:InterleavedBuffer.usage usage] to value.
</p>
<h3>
[method:InterleavedBuffer toJSON]( [param:Object data] )
</h3>
<p>
data - This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
<br/><br
/>
Serializes this [name].
</p>
<h2>
Source
</h2>
...
...
docs/api/zh/core/InterleavedBuffer.html
浏览文件 @
54b5ef63
...
...
@@ -103,13 +103,22 @@
将源队列数据拷贝到目标队列缓存中。
</p>
<h3>
[method:InterleavedBuffer clone]()
</h3>
<h3>
[method:InterleavedBuffer clone](
[param:Object data]
)
</h3>
<p>
克隆当前 [name]。
data - This object holds shared array buffers required for properly cloning geometries with interleaved attributes.
<br/><br
/>
Creates a clone of this [name].
</p>
<h3>
[method:BufferAttribute setUsage] ( [param:Usage value] )
</h3>
<p>
Set [page:BufferAttribute.usage usage] to value.
</p>
<h3>
[method:InterleavedBuffer setUsage] ( [param:Usage value] )
</h3>
<p>
Set [page:InterleavedBuffer.usage usage] to value.
</p>
<h3>
[method:InterleavedBuffer toJSON]( [param:Object data] )
</h3>
<p>
data - This object holds shared array buffers required for properly serializing geometries with interleaved attributes.
<br/><br
/>
Serializes this [name].
</p>
<h2>
源代码
</h2>
...
...
src/core/BufferGeometry.js
浏览文件 @
54b5ef63
...
...
@@ -1136,6 +1136,10 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
this
.
boundingBox
=
null
;
this
.
boundingSphere
=
null
;
// used for storing cloned, shared data
const
data
=
{};
// name
this
.
name
=
source
.
name
;
...
...
@@ -1146,7 +1150,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
if
(
index
!==
null
)
{
this
.
setIndex
(
index
.
clone
()
);
this
.
setIndex
(
index
.
clone
(
data
)
);
}
...
...
@@ -1157,7 +1161,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
for
(
const
name
in
attributes
)
{
const
attribute
=
attributes
[
name
];
this
.
setAttribute
(
name
,
attribute
.
clone
()
);
this
.
setAttribute
(
name
,
attribute
.
clone
(
data
)
);
}
...
...
@@ -1172,7 +1176,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
for
(
let
i
=
0
,
l
=
morphAttribute
.
length
;
i
<
l
;
i
++
)
{
array
.
push
(
morphAttribute
[
i
].
clone
()
);
array
.
push
(
morphAttribute
[
i
].
clone
(
data
)
);
}
...
...
src/core/InstancedInterleavedBuffer.js
浏览文件 @
54b5ef63
...
...
@@ -26,6 +26,27 @@ InstancedInterleavedBuffer.prototype = Object.assign( Object.create( Interleaved
return
this
;
},
clone
:
function
(
data
)
{
const
ib
=
InterleavedBuffer
.
prototype
.
clone
.
call
(
this
,
data
);
ib
.
meshPerAttribute
=
this
.
meshPerAttribute
;
return
ib
;
},
toJSON
:
function
(
data
)
{
const
json
=
InterleavedBuffer
.
prototype
.
toJSON
.
call
(
this
,
data
);
json
.
isInstancedInterleavedBuffer
=
true
;
json
.
meshPerAttribute
=
this
.
meshPerAttribute
;
return
json
;
}
}
);
...
...
src/core/InterleavedBuffer.d.ts
浏览文件 @
54b5ef63
...
...
@@ -19,7 +19,7 @@ export class InterleavedBuffer {
uuid
:
string
;
setUsage
(
usage
:
Usage
):
InterleavedBuffer
;
clone
():
this
;
clone
(
data
:
object
):
this
;
copy
(
source
:
InterleavedBuffer
):
this
;
copyAt
(
index1
:
number
,
...
...
src/core/InterleavedBuffer.js
浏览文件 @
54b5ef63
...
...
@@ -80,9 +80,32 @@ Object.assign( InterleavedBuffer.prototype, {
},
clone
:
function
()
{
clone
:
function
(
data
)
{
return
new
this
.
constructor
().
copy
(
this
);
if
(
data
.
arrayBuffers
===
undefined
)
{
data
.
arrayBuffers
=
{};
}
if
(
this
.
array
.
buffer
.
_uuid
===
undefined
)
{
this
.
array
.
buffer
.
_uuid
=
MathUtils
.
generateUUID
();
}
if
(
data
.
arrayBuffers
[
this
.
array
.
buffer
.
_uuid
]
===
undefined
)
{
data
.
arrayBuffers
[
this
.
array
.
buffer
.
_uuid
]
=
this
.
array
.
slice
(
0
).
buffer
;
}
const
array
=
new
this
.
array
.
constructor
(
data
.
arrayBuffers
[
this
.
array
.
buffer
.
_uuid
]
);
const
ib
=
new
InterleavedBuffer
(
array
,
this
.
stride
);
ib
.
setUsage
(
this
.
usage
);
return
ib
;
},
...
...
src/core/InterleavedBufferAttribute.d.ts
浏览文件 @
54b5ef63
...
...
@@ -25,7 +25,7 @@ export class InterleavedBufferAttribute {
readonly
isInterleavedBufferAttribute
:
true
;
applyMatrix4
(
m
:
Matrix4
):
this
;
clone
():
BufferAttribute
;
clone
(
data
?:
object
):
BufferAttribute
;
getX
(
index
:
number
):
number
;
setX
(
index
:
number
,
x
:
number
):
InterleavedBufferAttribute
;
getY
(
index
:
number
):
number
;
...
...
src/core/InterleavedBufferAttribute.js
浏览文件 @
54b5ef63
...
...
@@ -157,25 +157,45 @@ Object.assign( InterleavedBufferAttribute.prototype, {
},
clone
:
function
()
{
clone
:
function
(
data
)
{
console
.
log
(
'
THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.
'
);
if
(
data
===
undefined
)
{
const
array
=
[]
;
console
.
log
(
'
THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.
'
)
;
for
(
let
i
=
0
;
i
<
this
.
count
;
i
++
)
{
const
array
=
[];
const
index
=
i
*
this
.
data
.
stride
+
this
.
offset
;
for
(
let
i
=
0
;
i
<
this
.
count
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
itemSize
;
j
++
)
{
const
index
=
i
*
this
.
data
.
stride
+
this
.
offset
;
array
.
push
(
this
.
data
.
array
[
index
+
j
]
);
for
(
let
j
=
0
;
j
<
this
.
itemSize
;
j
++
)
{
array
.
push
(
this
.
data
.
array
[
index
+
j
]
);
}
}
}
return
new
BufferAttribute
(
new
this
.
array
.
constructor
(
array
),
this
.
itemSize
,
this
.
normalized
);
return
new
BufferAttribute
(
new
this
.
array
.
constructor
(
array
),
this
.
itemSize
,
this
.
normalized
);
}
else
{
if
(
data
.
interleavedBuffers
===
undefined
)
{
data
.
interleavedBuffers
=
{};
}
if
(
data
.
interleavedBuffers
[
this
.
data
.
uuid
]
===
undefined
)
{
data
.
interleavedBuffers
[
this
.
data
.
uuid
]
=
this
.
data
.
clone
(
data
);
}
return
new
InterleavedBufferAttribute
(
data
.
interleavedBuffers
[
this
.
data
.
uuid
],
this
.
itemSize
,
this
.
offset
,
this
.
normalized
);
}
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录