Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d675c3f0
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,发现更多精彩内容 >>
提交
d675c3f0
编写于
12月 30, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7876 from sunag/dev
add sqrt and fix getType Math1Node
上级
761911df
25eac0d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
22 deletion
+27
-22
examples/js/nodes/math/Math1Node.js
examples/js/nodes/math/Math1Node.js
+3
-2
examples/js/nodes/utils/SwitchNode.js
examples/js/nodes/utils/SwitchNode.js
+24
-20
未找到文件。
examples/js/nodes/math/Math1Node.js
浏览文件 @
d675c3f0
...
...
@@ -18,7 +18,8 @@ THREE.Math1Node.EXP = 'exp';
THREE
.
Math1Node
.
EXP2
=
'
exp2
'
;
THREE
.
Math1Node
.
LOG
=
'
log
'
;
THREE
.
Math1Node
.
LOG2
=
'
log2
'
;
THREE
.
Math1Node
.
INVERSE_SQRT
=
'
inversesqrt
'
;
THREE
.
Math1Node
.
SQRT
=
'
sqrt
'
;
THREE
.
Math1Node
.
INV_SQRT
=
'
inversesqrt
'
;
THREE
.
Math1Node
.
FLOOR
=
'
floor
'
;
THREE
.
Math1Node
.
CEIL
=
'
ceil
'
;
THREE
.
Math1Node
.
NORMALIZE
=
'
normalize
'
;
...
...
@@ -42,7 +43,7 @@ THREE.Math1Node.prototype.constructor = THREE.Math1Node;
THREE
.
Math1Node
.
prototype
.
getType
=
function
(
builder
)
{
switch
(
this
.
method
)
{
case
THREE
.
Math1Node
.
DISTANCE
:
case
THREE
.
Math1Node
.
LENGTH
:
return
'
fv1
'
;
}
...
...
examples/js/nodes/utils/SwitchNode.js
浏览文件 @
d675c3f0
...
...
@@ -4,7 +4,7 @@
THREE
.
SwitchNode
=
function
(
node
,
components
)
{
THREE
.
GLNode
.
call
(
this
,
'
fv1
'
);
THREE
.
GLNode
.
call
(
this
);
this
.
node
=
node
;
this
.
components
=
components
||
'
x
'
;
...
...
@@ -24,45 +24,49 @@ THREE.SwitchNode.prototype.generate = function( builder, output ) {
var
type
=
this
.
node
.
getType
(
builder
);
var
inputLength
=
builder
.
getFormatLength
(
type
)
-
1
;
var
components
=
builder
.
colorToVector
(
this
.
components
);
var
node
=
this
.
node
.
build
(
builder
,
type
);
var
outputLength
=
0
;
if
(
inputLength
>
0
)
{
var
i
,
len
=
components
.
length
;
// get max length
// get max length
var
outputLength
=
0
;
var
components
=
builder
.
colorToVector
(
this
.
components
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
var
i
,
len
=
components
.
length
;
outputLength
=
Math
.
max
(
outputLength
,
builder
.
getIndexByElement
(
components
.
charAt
(
i
)
)
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
}
outputLength
=
Math
.
max
(
outputLength
,
builder
.
getIndexByElement
(
components
.
charAt
(
i
)
)
);
if
(
outputLength
>
inputLength
)
outputLength
=
inputLength
;
}
// build switch
if
(
outputLength
>
inputLength
)
outputLength
=
inputLength
;
node
+=
'
.
'
;
// split
for
(
i
=
0
;
i
<
len
;
i
++
)
{
node
+=
'
.
'
;
var
elm
=
components
.
charAt
(
i
);
var
idx
=
builder
.
getIndexByElement
(
components
.
charAt
(
i
)
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
idx
>
outputLength
)
idx
=
outputLength
;
var
elm
=
components
.
charAt
(
i
);
var
idx
=
builder
.
getIndexByElement
(
components
.
charAt
(
i
)
);
if
(
builder
.
getElementByIndex
(
idx
)
==
undefined
)
{
if
(
idx
>
outputLength
)
idx
=
outputLength
;
console
.
log
(
builder
.
getElementByIndex
(
idx
)
);
node
+=
builder
.
getElementByIndex
(
idx
);
}
node
+=
builder
.
getElementByIndex
(
idx
);
return
builder
.
format
(
node
,
this
.
getType
(
builder
),
output
);
}
}
else
{
return
builder
.
format
(
node
,
this
.
getType
(
builder
),
output
);
// join
return
builder
.
format
(
node
,
type
,
output
)
}
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录