Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
118e1c47
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,发现更多精彩内容 >>
提交
118e1c47
编写于
2月 22, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up.
上级
c31b30a1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
79 addition
and
76 deletion
+79
-76
src/core/Object3D.js
src/core/Object3D.js
+3
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+13
-10
src/renderers/webgl/WebGLAttributes.js
src/renderers/webgl/WebGLAttributes.js
+15
-14
src/renderers/webgl/WebGLGeometries.js
src/renderers/webgl/WebGLGeometries.js
+42
-42
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+6
-7
未找到文件。
src/core/Object3D.js
浏览文件 @
118e1c47
...
...
@@ -545,13 +545,13 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
if
(
this
.
matrixWorldNeedsUpdate
||
force
)
{
if
(
this
.
parent
)
{
if
(
this
.
parent
===
null
)
{
this
.
matrixWorld
.
multiplyMatrices
(
this
.
parent
.
matrixWorld
,
this
.
matrix
);
this
.
matrixWorld
.
copy
(
this
.
matrix
);
}
else
{
this
.
matrixWorld
.
copy
(
this
.
matrix
);
this
.
matrixWorld
.
multiplyMatrices
(
this
.
parent
.
matrixWorld
,
this
.
matrix
);
}
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
118e1c47
...
...
@@ -191,6 +191,11 @@ function WebGLRenderer( parameters ) {
// info
_infoMemory
=
{
geometries
:
0
,
textures
:
0
},
_infoRender
=
{
frame
:
0
,
...
...
@@ -204,12 +209,7 @@ function WebGLRenderer( parameters ) {
this
.
info
=
{
render
:
_infoRender
,
memory
:
{
geometries
:
0
,
textures
:
0
},
memory
:
_infoMemory
,
programs
:
null
};
...
...
@@ -287,9 +287,9 @@ function WebGLRenderer( parameters ) {
var
state
=
new
WebGLState
(
_gl
,
extensions
,
paramThreeToGL
);
var
properties
=
new
WebGLProperties
();
var
textures
=
new
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
paramThreeToGL
,
this
.
info
);
var
textures
=
new
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
paramThreeToGL
,
_infoMemory
);
var
attributes
=
new
WebGLAttributes
(
_gl
);
var
geometries
=
new
WebGLGeometries
(
_gl
,
attributes
,
this
.
info
);
var
geometries
=
new
WebGLGeometries
(
_gl
,
attributes
,
_infoMemory
);
var
objects
=
new
WebGLObjects
(
_gl
,
geometries
,
_infoRender
);
var
programCache
=
new
WebGLPrograms
(
this
,
capabilities
);
var
lightCache
=
new
WebGLLights
();
...
...
@@ -1150,6 +1150,7 @@ function WebGLRenderer( parameters ) {
//
_infoRender
.
frame
++
;
_infoRender
.
calls
=
0
;
_infoRender
.
vertices
=
0
;
_infoRender
.
faces
=
0
;
...
...
@@ -1416,7 +1417,8 @@ function WebGLRenderer( parameters ) {
if
(
sortObjects
)
{
_vector3
.
setFromMatrixPosition
(
object
.
matrixWorld
).
applyMatrix4
(
_projScreenMatrix
);
_vector3
.
setFromMatrixPosition
(
object
.
matrixWorld
)
.
applyMatrix4
(
_projScreenMatrix
);
}
...
...
@@ -1434,7 +1436,8 @@ function WebGLRenderer( parameters ) {
if
(
sortObjects
)
{
_vector3
.
setFromMatrixPosition
(
object
.
matrixWorld
).
applyMatrix4
(
_projScreenMatrix
);
_vector3
.
setFromMatrixPosition
(
object
.
matrixWorld
)
.
applyMatrix4
(
_projScreenMatrix
);
}
...
...
src/renderers/webgl/WebGLAttributes.js
浏览文件 @
118e1c47
...
...
@@ -8,13 +8,12 @@ function WebGLAttributes( gl ) {
function
createBuffer
(
attribute
,
bufferType
)
{
var
buffer
=
gl
.
createBuffer
();
gl
.
bindBuffer
(
bufferType
,
buffer
);
var
array
=
attribute
.
array
;
var
usage
=
attribute
.
dynamic
?
gl
.
DYNAMIC_DRAW
:
gl
.
STATIC_DRAW
;
var
buffer
=
gl
.
createBuffer
();
gl
.
bindBuffer
(
bufferType
,
buffer
);
gl
.
bufferData
(
bufferType
,
array
,
usage
);
attribute
.
onUploadCallback
();
...
...
@@ -66,33 +65,34 @@ function WebGLAttributes( gl ) {
function
updateBuffer
(
buffer
,
attribute
,
bufferType
)
{
var
array
=
attribute
.
array
;
var
updateRange
=
attribute
.
updateRange
;
gl
.
bindBuffer
(
bufferType
,
buffer
);
if
(
attribute
.
dynamic
===
false
)
{
gl
.
bufferData
(
bufferType
,
a
ttribute
.
a
rray
,
gl
.
STATIC_DRAW
);
gl
.
bufferData
(
bufferType
,
array
,
gl
.
STATIC_DRAW
);
}
else
if
(
attribute
.
updateRange
.
count
===
-
1
)
{
}
else
if
(
updateRange
.
count
===
-
1
)
{
// Not using update ranges
gl
.
bufferSubData
(
bufferType
,
0
,
a
ttribute
.
a
rray
);
gl
.
bufferSubData
(
bufferType
,
0
,
array
);
}
else
if
(
attribute
.
updateRange
.
count
===
0
)
{
}
else
if
(
updateRange
.
count
===
0
)
{
console
.
error
(
'
THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.
'
);
}
else
{
gl
.
bufferSubData
(
bufferType
,
attribute
.
updateRange
.
offset
*
attribute
.
array
.
BYTES_PER_ELEMENT
,
attribute
.
array
.
subarray
(
attribute
.
updateRange
.
offset
,
attribute
.
updateRange
.
offset
+
attribute
.
updateRange
.
count
)
);
gl
.
bufferSubData
(
bufferType
,
updateRange
.
offset
*
array
.
BYTES_PER_ELEMENT
,
array
.
subarray
(
updateRange
.
offset
,
updateRange
.
offset
+
updateRange
.
count
)
);
attribute
.
updateRange
.
count
=
0
;
// reset range
updateRange
.
count
=
0
;
// reset range
}
}
//
...
...
@@ -129,9 +129,10 @@ function WebGLAttributes( gl ) {
buffers
[
attribute
.
id
]
=
createBuffer
(
attribute
,
bufferType
);
}
else
if
(
data
.
version
!==
attribute
.
version
)
{
}
else
if
(
data
.
version
<
attribute
.
version
)
{
updateBuffer
(
data
.
buffer
,
attribute
,
bufferType
);
data
.
version
=
attribute
.
version
;
}
...
...
src/renderers/webgl/WebGLGeometries.js
浏览文件 @
118e1c47
...
...
@@ -6,7 +6,7 @@ import { Uint16BufferAttribute, Uint32BufferAttribute } from '../../core/BufferA
import
{
BufferGeometry
}
from
'
../../core/BufferGeometry
'
;
import
{
arrayMax
}
from
'
../../utils
'
;
function
WebGLGeometries
(
gl
,
attributes
,
info
)
{
function
WebGLGeometries
(
gl
,
attributes
,
info
Memory
)
{
var
geometries
=
{};
var
wireframeAttributes
=
{};
...
...
@@ -54,13 +54,12 @@ function WebGLGeometries( gl, attributes, info ) {
//
info
.
m
emory
.
geometries
--
;
info
M
emory
.
geometries
--
;
}
function
get
(
object
)
{
function
get
(
object
,
geometry
)
{
var
geometry
=
object
.
geometry
;
var
buffergeometry
=
geometries
[
geometry
.
id
];
if
(
buffergeometry
)
return
buffergeometry
;
...
...
@@ -85,12 +84,47 @@ function WebGLGeometries( gl, attributes, info ) {
geometries
[
geometry
.
id
]
=
buffergeometry
;
info
.
m
emory
.
geometries
++
;
info
M
emory
.
geometries
++
;
return
buffergeometry
;
}
function
update
(
geometry
)
{
var
index
=
geometry
.
index
;
var
geometryAttributes
=
geometry
.
attributes
;
if
(
index
!==
null
)
{
attributes
.
update
(
index
,
gl
.
ELEMENT_ARRAY_BUFFER
);
}
for
(
var
name
in
geometryAttributes
)
{
attributes
.
update
(
geometryAttributes
[
name
],
gl
.
ARRAY_BUFFER
);
}
// morph targets
var
morphAttributes
=
geometry
.
morphAttributes
;
for
(
var
name
in
morphAttributes
)
{
var
array
=
morphAttributes
[
name
];
for
(
var
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
++
)
{
attributes
.
update
(
array
[
i
],
gl
.
ARRAY_BUFFER
);
}
}
}
function
getWireframeAttribute
(
geometry
)
{
var
attribute
=
wireframeAttributes
[
geometry
.
id
];
...
...
@@ -146,46 +180,12 @@ function WebGLGeometries( gl, attributes, info ) {
}
function
update
(
geometry
)
{
var
index
=
geometry
.
index
;
var
geometryAttributes
=
geometry
.
attributes
;
if
(
index
!==
null
)
{
attributes
.
update
(
index
,
gl
.
ELEMENT_ARRAY_BUFFER
);
}
for
(
var
name
in
geometryAttributes
)
{
attributes
.
update
(
geometryAttributes
[
name
],
gl
.
ARRAY_BUFFER
);
}
// morph targets
var
morphAttributes
=
geometry
.
morphAttributes
;
for
(
var
name
in
morphAttributes
)
{
var
array
=
morphAttributes
[
name
];
for
(
var
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
++
)
{
attributes
.
update
(
array
[
i
],
gl
.
ARRAY_BUFFER
);
}
}
}
return
{
get
:
get
,
getWireframeAttribute
:
getWireframeAttribute
,
update
:
update
update
:
update
,
getWireframeAttribute
:
getWireframeAttribute
};
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
118e1c47
...
...
@@ -5,9 +5,8 @@
import
{
LinearFilter
,
NearestFilter
,
RGBFormat
,
RGBAFormat
,
DepthFormat
,
DepthStencilFormat
,
UnsignedShortType
,
UnsignedIntType
,
UnsignedInt248Type
,
FloatType
,
HalfFloatType
,
ClampToEdgeWrapping
,
NearestMipMapLinearFilter
,
NearestMipMapNearestFilter
}
from
'
../../constants
'
;
import
{
_Math
}
from
'
../../math/Math
'
;
function
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
paramThreeToGL
,
info
)
{
function
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
paramThreeToGL
,
info
Memory
)
{
var
_infoMemory
=
info
.
memory
;
var
_isWebGL2
=
(
typeof
WebGL2RenderingContext
!==
'
undefined
'
&&
_gl
instanceof
WebGL2RenderingContext
);
//
...
...
@@ -96,7 +95,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
deallocateTexture
(
texture
);
_
infoMemory
.
textures
--
;
infoMemory
.
textures
--
;
}
...
...
@@ -109,7 +108,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
deallocateRenderTarget
(
renderTarget
);
_
infoMemory
.
textures
--
;
infoMemory
.
textures
--
;
}
...
...
@@ -228,7 +227,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
textureProperties
.
__image__webglTextureCube
=
_gl
.
createTexture
();
_
infoMemory
.
textures
++
;
infoMemory
.
textures
++
;
}
...
...
@@ -399,7 +398,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
textureProperties
.
__webglTexture
=
_gl
.
createTexture
();
_
infoMemory
.
textures
++
;
infoMemory
.
textures
++
;
}
...
...
@@ -700,7 +699,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
textureProperties
.
__webglTexture
=
_gl
.
createTexture
();
_
infoMemory
.
textures
++
;
infoMemory
.
textures
++
;
var
isCube
=
(
renderTarget
.
isWebGLRenderTargetCube
===
true
);
var
isTargetPowerOfTwo
=
isPowerOfTwo
(
renderTarget
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录