Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c1cd65e6
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,发现更多精彩内容 >>
提交
c1cd65e6
编写于
12月 21, 2015
作者:
S
SUNAG
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cache improvement (multilayer) and TextureNode support for PBR`M environment
上级
0f239f31
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
68 addition
and
26 deletion
+68
-26
examples/js/nodes/BuilderNode.js
examples/js/nodes/BuilderNode.js
+43
-10
examples/js/nodes/GLNode.js
examples/js/nodes/GLNode.js
+10
-9
examples/js/nodes/inputs/CubeTextureNode.js
examples/js/nodes/inputs/CubeTextureNode.js
+3
-3
examples/js/nodes/inputs/TextureNode.js
examples/js/nodes/inputs/TextureNode.js
+6
-0
examples/js/nodes/materials/StandardNode.js
examples/js/nodes/materials/StandardNode.js
+6
-4
未找到文件。
examples/js/nodes/BuilderNode.js
浏览文件 @
c1cd65e6
...
@@ -6,19 +6,60 @@ THREE.BuilderNode = function( material ) {
...
@@ -6,19 +6,60 @@ THREE.BuilderNode = function( material ) {
this
.
material
=
material
;
this
.
material
=
material
;
this
.
require
=
{}
;
this
.
caches
=
[]
;
this
.
isVerify
=
false
;
this
.
isVerify
=
false
;
this
.
cache
=
''
;
this
.
addCache
();
};
};
THREE
.
BuilderNode
.
prototype
=
{
THREE
.
BuilderNode
.
prototype
=
{
constructor
:
THREE
.
BuilderNode
,
constructor
:
THREE
.
BuilderNode
,
addCache
:
function
(
name
,
requires
)
{
this
.
caches
.
push
(
{
name
:
name
||
''
,
requires
:
requires
||
{}
}
);
return
this
.
updateCache
();
},
removeCache
:
function
()
{
this
.
caches
.
pop
();
return
this
.
updateCache
();
},
updateCache
:
function
()
{
var
cache
=
this
.
caches
[
this
.
caches
.
length
-
1
];
this
.
cache
=
cache
.
name
;
this
.
requires
=
cache
.
requires
;
return
this
;
},
require
:
function
(
name
,
node
)
{
this
.
requires
[
name
]
=
node
;
return
this
;
},
include
:
function
(
func
)
{
include
:
function
(
func
)
{
this
.
material
.
include
(
this
.
shader
,
func
);
this
.
material
.
include
(
this
.
shader
,
func
);
return
this
;
},
},
getFormatConstructor
:
function
(
len
)
{
getFormatConstructor
:
function
(
len
)
{
...
@@ -89,14 +130,6 @@ THREE.BuilderNode.prototype = {
...
@@ -89,14 +130,6 @@ THREE.BuilderNode.prototype = {
},
},
setCache
:
function
(
name
)
{
this
.
cache
=
name
||
''
;
return
this
;
},
getElementByIndex
:
function
(
index
)
{
getElementByIndex
:
function
(
index
)
{
return
THREE
.
BuilderNode
.
elements
[
index
];
return
THREE
.
BuilderNode
.
elements
[
index
];
...
...
examples/js/nodes/GLNode.js
浏览文件 @
c1cd65e6
...
@@ -13,40 +13,41 @@ THREE.GLNode = function( type ) {
...
@@ -13,40 +13,41 @@ THREE.GLNode = function( type ) {
};
};
THREE
.
GLNode
.
prototype
.
verify
=
function
(
builder
)
{
THREE
.
GLNode
.
prototype
.
verify
=
function
(
builder
,
cache
,
requires
)
{
builder
.
isVerify
=
true
;
builder
.
isVerify
=
true
;
var
material
=
builder
.
material
;
var
material
=
builder
.
material
;
this
.
build
(
builder
,
'
v4
'
);
this
.
build
(
builder
.
addCache
(
cache
,
requires
)
,
'
v4
'
);
material
.
clearVertexNode
();
material
.
clearVertexNode
();
material
.
clearFragmentNode
();
material
.
clearFragmentNode
();
builder
.
setCache
();
// reset cache
builder
.
removeCache
();
builder
.
isVerify
=
false
;
builder
.
isVerify
=
false
;
};
};
THREE
.
GLNode
.
prototype
.
verifyAndBuildCode
=
function
(
builder
,
output
,
cache
)
{
THREE
.
GLNode
.
prototype
.
verifyAndBuildCode
=
function
(
builder
,
output
,
cache
,
requires
)
{
this
.
verify
(
builder
.
setCache
(
cache
)
);
this
.
verify
(
builder
,
cache
,
requires
);
return
this
.
buildCode
(
builder
.
setCache
(
cache
),
output
);
return
this
.
buildCode
(
builder
,
output
,
cache
,
requires
);
};
};
THREE
.
GLNode
.
prototype
.
buildCode
=
function
(
builder
,
output
,
uuid
)
{
THREE
.
GLNode
.
prototype
.
buildCode
=
function
(
builder
,
output
,
cache
,
requires
)
{
var
material
=
builder
.
material
;
var
material
=
builder
.
material
;
var
data
=
{
result
:
this
.
build
(
builder
,
output
,
uuid
)
};
var
data
=
{
result
:
this
.
build
(
builder
.
addCache
(
cache
,
requires
),
output
)
};
if
(
builder
.
isShader
(
'
vertex
'
)
)
data
.
code
=
material
.
clearVertexNode
();
if
(
builder
.
isShader
(
'
vertex
'
)
)
data
.
code
=
material
.
clearVertexNode
();
else
data
.
code
=
material
.
clearFragmentNode
();
else
data
.
code
=
material
.
clearFragmentNode
();
builder
.
setCache
();
// reset cache
builder
.
removeCache
();
return
data
;
return
data
;
...
...
examples/js/nodes/inputs/CubeTextureNode.js
浏览文件 @
c1cd65e6
...
@@ -25,11 +25,11 @@ THREE.CubeTextureNode.prototype.generate = function( builder, output ) {
...
@@ -25,11 +25,11 @@ THREE.CubeTextureNode.prototype.generate = function( builder, output ) {
var
cubetex
=
this
.
getTexture
(
builder
,
output
);
var
cubetex
=
this
.
getTexture
(
builder
,
output
);
var
coord
=
this
.
coord
.
build
(
builder
,
'
v3
'
);
var
coord
=
this
.
coord
.
build
(
builder
,
'
v3
'
);
var
bias
=
this
.
bias
?
this
.
bias
.
build
(
builder
,
'
fv1
'
)
:
undefined
;
;
var
bias
=
this
.
bias
?
this
.
bias
.
build
(
builder
,
'
fv1
'
)
:
undefined
;
if
(
bias
==
undefined
&&
builder
.
require
.
cubeTextureB
ias
)
{
if
(
bias
==
undefined
&&
builder
.
require
s
.
b
ias
)
{
bias
=
builder
.
require
.
cubeTextureB
ias
.
build
(
builder
,
'
fv1
'
);
bias
=
builder
.
require
s
.
b
ias
.
build
(
builder
,
'
fv1
'
);
}
}
...
...
examples/js/nodes/inputs/TextureNode.js
浏览文件 @
c1cd65e6
...
@@ -27,6 +27,12 @@ THREE.TextureNode.prototype.generate = function( builder, output ) {
...
@@ -27,6 +27,12 @@ THREE.TextureNode.prototype.generate = function( builder, output ) {
var
coord
=
this
.
coord
.
build
(
builder
,
'
v2
'
);
var
coord
=
this
.
coord
.
build
(
builder
,
'
v2
'
);
var
bias
=
this
.
bias
?
this
.
bias
.
build
(
builder
,
'
fv1
'
)
:
undefined
;
var
bias
=
this
.
bias
?
this
.
bias
.
build
(
builder
,
'
fv1
'
)
:
undefined
;
if
(
bias
==
undefined
&&
builder
.
requires
.
bias
)
{
bias
=
builder
.
requires
.
bias
.
build
(
builder
,
'
fv1
'
);
}
var
code
;
var
code
;
if
(
bias
)
code
=
'
texture2D(
'
+
tex
+
'
,
'
+
coord
+
'
,
'
+
bias
+
'
)
'
;
if
(
bias
)
code
=
'
texture2D(
'
+
tex
+
'
,
'
+
coord
+
'
,
'
+
bias
+
'
)
'
;
...
...
examples/js/nodes/materials/StandardNode.js
浏览文件 @
c1cd65e6
...
@@ -96,9 +96,11 @@ THREE.StandardNode.prototype.build = function( builder ) {
...
@@ -96,9 +96,11 @@ THREE.StandardNode.prototype.build = function( builder ) {
}
}
else
{
else
{
//
CubeMap blur effect (PBR)
//
autoblur textures for PBR Material effect
builder
.
require
.
cubeTextureBias
=
builder
.
require
.
cubeTextureBias
||
new
THREE
.
RoughnessToBlinnExponentNode
();
var
requires
=
{
bias
:
new
THREE
.
RoughnessToBlinnExponentNode
()
};
// verify all nodes to reuse generate codes
// verify all nodes to reuse generate codes
...
@@ -116,7 +118,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
...
@@ -116,7 +118,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
if
(
this
.
normal
)
this
.
normal
.
verify
(
builder
);
if
(
this
.
normal
)
this
.
normal
.
verify
(
builder
);
if
(
this
.
normalScale
&&
this
.
normal
)
this
.
normalScale
.
verify
(
builder
);
if
(
this
.
normalScale
&&
this
.
normal
)
this
.
normalScale
.
verify
(
builder
);
if
(
this
.
environment
)
this
.
environment
.
verify
(
builder
.
setCache
(
'
env
'
)
);
// isolate environment from others inputs ( see TextureNode, CubeTextureNode )
if
(
this
.
environment
)
this
.
environment
.
verify
(
builder
,
'
env
'
,
requires
);
// isolate environment from others inputs ( see TextureNode, CubeTextureNode )
if
(
this
.
reflectivity
&&
this
.
environment
)
this
.
reflectivity
.
verify
(
builder
);
if
(
this
.
reflectivity
&&
this
.
environment
)
this
.
reflectivity
.
verify
(
builder
);
// build code
// build code
...
@@ -135,7 +137,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
...
@@ -135,7 +137,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
var
normal
=
this
.
normal
?
this
.
normal
.
buildCode
(
builder
,
'
v3
'
)
:
undefined
;
var
normal
=
this
.
normal
?
this
.
normal
.
buildCode
(
builder
,
'
v3
'
)
:
undefined
;
var
normalScale
=
this
.
normalScale
&&
this
.
normal
?
this
.
normalScale
.
buildCode
(
builder
,
'
fv1
'
)
:
undefined
;
var
normalScale
=
this
.
normalScale
&&
this
.
normal
?
this
.
normalScale
.
buildCode
(
builder
,
'
fv1
'
)
:
undefined
;
var
environment
=
this
.
environment
?
this
.
environment
.
buildCode
(
builder
.
setCache
(
'
env
'
),
'
c
'
)
:
undefined
;
var
environment
=
this
.
environment
?
this
.
environment
.
buildCode
(
builder
,
'
c
'
,
'
env
'
,
requires
)
:
undefined
;
var
reflectivity
=
this
.
reflectivity
&&
this
.
environment
?
this
.
reflectivity
.
buildCode
(
builder
,
'
fv1
'
)
:
undefined
;
var
reflectivity
=
this
.
reflectivity
&&
this
.
environment
?
this
.
reflectivity
.
buildCode
(
builder
,
'
fv1
'
)
:
undefined
;
material
.
requestAttrib
.
transparent
=
alpha
!=
undefined
;
material
.
requestAttrib
.
transparent
=
alpha
!=
undefined
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录