Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
2ac1bb47
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,发现更多精彩内容 >>
提交
2ac1bb47
编写于
2月 18, 2013
作者:
Z
zz85
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding custom BufferGeometry attributes support to WebGLRenderer2.
上级
8c723f74
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
128 deletion
+54
-128
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+9
-15
src/renderers/WebGLRenderer2.js
src/renderers/WebGLRenderer2.js
+45
-113
未找到文件。
src/renderers/WebGLRenderer.js
浏览文件 @
2ac1bb47
...
...
@@ -268,19 +268,19 @@ THREE.WebGLRenderer = function ( parameters ) {
return
_glExtensionTextureFloat
;
};
this
.
supportsStandardDerivatives
=
function
()
{
return
_glExtensionStandardDerivatives
;
};
this
.
supportsCompressedTextureS3TC
=
function
()
{
return
_glExtensionCompressedTextureS3TC
;
};
this
.
getMaxAnisotropy
=
function
()
{
return
_maxAnisotropy
;
...
...
@@ -3487,8 +3487,6 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
updateBuffers
)
{
var
attributeItem
,
attributeName
,
attributePointer
;
for
(
attributeName
in
geometryAttributes
)
{
if
(
attributeName
===
'
index
'
)
continue
;
...
...
@@ -3529,8 +3527,6 @@ THREE.WebGLRenderer = function ( parameters ) {
for
(
attributeName
in
geometryAttributes
)
{
if
(
attributeName
===
'
index
'
)
continue
;
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
...
...
@@ -3562,8 +3558,6 @@ THREE.WebGLRenderer = function ( parameters ) {
for
(
attributeName
in
geometryAttributes
)
{
if
(
attributeName
===
'
index
'
)
continue
;
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
...
...
@@ -3591,7 +3585,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
}
}
};
...
...
@@ -7380,17 +7374,17 @@ THREE.WebGLRenderer = function ( parameters ) {
console
.
log
(
'
THREE.WebGLRenderer: S3TC compressed textures not supported.
'
);
}
if
(
_gl
.
getShaderPrecisionFormat
===
undefined
)
{
_gl
.
getShaderPrecisionFormat
=
function
()
{
_gl
.
getShaderPrecisionFormat
=
function
()
{
return
{
"
rangeMin
"
:
1
,
"
rangeMax
"
:
1
,
"
precision
"
:
1
};
}
}
...
...
src/renderers/WebGLRenderer2.js
浏览文件 @
2ac1bb47
...
...
@@ -105,7 +105,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_usedTextureUnits
=
0
,
// GL state
// GL state
_viewportX
=
0
,
_viewportY
=
0
,
...
...
@@ -601,7 +601,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
}
renderer
.
setDynamicArrayBuffer
(
object
.
__webglNormalBuffer
,
object
.
normalArray
);
renderer
.
setFloatAttribute
(
program
.
attributes
.
normal
,
object
.
__webglNormalBuffer
,
3
,
0
);
...
...
@@ -630,11 +630,13 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
material
.
visible
===
false
)
return
;
var
program
,
attributes
,
linewidth
,
primitives
,
a
,
attribute
;
var
program
,
programAttributes
,
linewidth
,
primitives
,
a
,
attribute
,
geometryAttributes
;
var
attributeItem
,
attributeName
,
attributePointer
;
program
=
setProgram
(
camera
,
lights
,
fog
,
material
,
object
);
attributes
=
program
.
attributes
;
programAttributes
=
program
.
attributes
;
geometryAttributes
=
geometry
.
attributes
;
var
updateBuffers
=
false
,
wireframeBit
=
material
.
wireframe
?
1
:
0
,
...
...
@@ -657,7 +659,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
object
instanceof
THREE
.
Mesh
)
{
var
index
=
geometry
.
a
ttributes
[
"
index
"
];
var
index
=
geometry
A
ttributes
[
"
index
"
];
// indexed triangles
...
...
@@ -677,60 +679,25 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
updateBuffers
)
{
// vertices
var
position
=
geometry
.
attributes
[
"
position
"
];
var
positionSize
=
position
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
position
,
position
.
buffer
,
positionSize
,
startIndex
*
positionSize
*
4
);
// normals
var
normal
=
geometry
.
attributes
[
"
normal
"
];
if
(
attributes
.
normal
>=
0
&&
normal
)
{
var
normalSize
=
normal
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
normal
,
normal
.
buffer
,
normalSize
,
startIndex
*
normalSize
*
4
);
for
(
attributeName
in
geometryAttributes
)
{
}
// uvs
var
uv
=
geometry
.
attributes
[
"
uv
"
];
if
(
attributes
.
uv
>=
0
&&
uv
)
{
var
uvSize
=
uv
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
uv
,
uv
.
buffer
,
uvSize
,
startIndex
*
uvSize
*
4
);
}
if
(
attributeName
===
'
index
'
)
continue
;
// colors
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
var
color
=
geometry
.
attributes
[
"
color
"
];
if
(
attributePointer
>=
0
)
{
if
(
attributes
.
color
>=
0
&&
color
)
{
renderer
.
setFloatAttribute
(
attributePointer
,
attributeItem
.
buffer
,
attributeSize
,
startIndex
*
attributeSize
*
4
);
var
colorSize
=
color
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
color
,
color
.
buffer
,
colorSize
,
startIndex
*
colorSize
*
4
);
}
}
// tangents
var
tangent
=
geometry
.
attributes
[
"
tangent
"
];
if
(
attributes
.
tangent
>=
0
&&
tangent
)
{
var
tangentSize
=
tangent
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
tangent
,
tangent
.
buffer
,
tangentSize
,
startIndex
*
tangentSize
*
4
);
}
}
// render indexed triangles
renderer
.
drawTriangleElements
(
index
.
buffer
,
offsets
[
i
].
count
,
offsets
[
i
].
start
*
2
);
_this
.
info
.
render
.
calls
++
;
...
...
@@ -745,59 +712,26 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
updateBuffers
)
{
// vertices
var
position
=
geometry
.
attributes
[
"
position
"
];
var
positionSize
=
position
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
position
,
position
.
buffer
,
positionSize
,
0
);
// normals
var
normal
=
geometry
.
attributes
[
"
normal
"
];
if
(
attributes
.
normal
>=
0
&&
normal
)
{
var
normalSize
=
normal
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
normal
,
normal
.
buffer
,
normalSize
,
0
);
for
(
attributeName
in
geometryAttributes
)
{
}
// uvs
var
uv
=
geometry
.
attributes
[
"
uv
"
];
if
(
attributes
.
uv
>=
0
&&
uv
)
{
var
uvSize
=
uv
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
uv
,
uv
.
buffer
,
uvSize
,
0
);
}
// colors
var
color
=
geometry
.
attributes
[
"
color
"
];
if
(
attributes
.
color
>=
0
&&
color
)
{
var
colorSize
=
color
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
color
,
color
.
buffer
,
colorSize
,
0
);
}
// tangents
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
var
tangent
=
geometry
.
attributes
[
"
tangent
"
];
if
(
attributePointer
>=
0
)
{
if
(
attributes
.
tangent
>=
0
&&
tangent
)
{
renderer
.
setFloatAttribute
(
attributePointer
,
attributeItem
.
buffer
,
attributeSize
,
0
);
var
tangentSize
=
tangent
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
tangent
,
tangent
.
buffer
,
tangentSize
,
0
);
}
}
}
var
position
=
geometry
.
attributes
[
"
position
"
];
// render non-indexed triangles
renderer
.
drawTriangles
(
position
.
numItems
/
3
)
_this
.
info
.
render
.
calls
++
;
...
...
@@ -812,23 +746,22 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
updateBuffers
)
{
// vertices
for
(
attributeName
in
geometryAttributes
)
{
var
position
=
geometry
.
attributes
[
"
position
"
];
var
positionSize
=
position
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
position
,
position
.
buffer
,
positionSize
,
0
);
// colors
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
var
color
=
geometry
.
attributes
[
"
color
"
];
if
(
attributePointer
>=
0
)
{
if
(
attributes
.
color
>=
0
&&
color
)
{
renderer
.
setFloatAttribute
(
attributePointer
,
attributeItem
.
buffer
,
attributeSize
,
0
);
var
colorSize
=
color
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
color
,
color
.
buffer
,
colorSize
,
0
);
}
}
var
position
=
geometryAttributes
[
"
position
"
];
// render particles
renderer
.
drawPoints
(
position
.
numItems
/
3
);
...
...
@@ -841,23 +774,22 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
updateBuffers
)
{
// vertices
var
position
=
geometry
.
attributes
[
"
position
"
];
var
positionSize
=
position
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
position
,
position
.
buffer
,
positionSize
,
0
);
for
(
attributeName
in
geometryAttributes
)
{
// colors
attributePointer
=
programAttributes
[
attributeName
];
attributeItem
=
geometryAttributes
[
attributeName
];
attributeSize
=
attributeItem
.
itemSize
;
var
color
=
geometry
.
attributes
[
"
color
"
];
if
(
attributePointer
>=
0
)
{
if
(
attributes
.
color
>=
0
&&
color
)
{
renderer
.
setFloatAttribute
(
attributePointer
,
attributeItem
.
buffer
,
attributeSize
,
0
);
var
colorSize
=
color
.
itemSize
;
renderer
.
setFloatAttribute
(
attributes
.
color
,
color
.
buffer
,
colorSize
,
0
);
}
}
var
position
=
geometryAttributes
[
"
position
"
];
// render lines
renderer
.
setLineWidth
(
material
.
linewidth
);
renderer
.
drawLineStrip
(
position
.
numItems
/
3
);
...
...
@@ -3109,7 +3041,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
!
light
.
visible
)
continue
;
_direction
.
getPositionFromMatrix
(
light
.
matrixWorld
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_vector3
.
getPositionFromMatrix
(
light
.
target
.
matrixWorld
);
_direction
.
sub
(
_vector3
);
_direction
.
normalize
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录