Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
4fa8fba2
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,发现更多精彩内容 >>
提交
4fa8fba2
编写于
9月 21, 2015
作者:
D
Daniel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Script.js adjusted for Materials
上级
abd5aad2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
22 deletion
+48
-22
editor/js/CmdSetMaterialValue.js
editor/js/CmdSetMaterialValue.js
+11
-4
editor/js/History.js
editor/js/History.js
+2
-0
editor/js/Script.js
editor/js/Script.js
+32
-15
editor/js/Sidebar.Material.js
editor/js/Sidebar.Material.js
+3
-3
未找到文件。
editor/js/CmdSetMaterialValue.js
浏览文件 @
4fa8fba2
...
...
@@ -7,6 +7,7 @@ CmdSetMaterialValue = function ( object, attributeName, newValue ) {
Cmd
.
call
(
this
);
this
.
type
=
'
CmdSetMaterialValue
'
;
this
.
updatable
=
true
;
this
.
object
=
object
;
this
.
attributeName
=
attributeName
;
...
...
@@ -21,16 +22,22 @@ CmdSetMaterialValue.prototype = {
execute
:
function
()
{
this
.
object
.
material
[
this
.
attributeName
]
=
this
.
newValue
;
this
.
editor
.
signals
.
objectChanged
.
dispatch
(
this
.
object
)
;
this
.
editor
.
signals
.
sceneGraphChanged
.
dispatch
(
);
this
.
object
.
material
.
needsUpdate
=
true
;
this
.
editor
.
signals
.
materialChanged
.
dispatch
(
this
.
object
.
material
);
},
undo
:
function
()
{
this
.
object
.
material
[
this
.
attributeName
]
=
this
.
oldValue
;
this
.
editor
.
signals
.
objectChanged
.
dispatch
(
this
.
object
);
this
.
editor
.
signals
.
sceneGraphChanged
.
dispatch
();
this
.
object
.
material
.
needsUpdate
=
true
;
this
.
editor
.
signals
.
materialChanged
.
dispatch
(
this
.
object
.
material
);
},
update
:
function
(
cmd
)
{
this
.
newValue
=
cmd
.
newValue
;
},
...
...
editor/js/History.js
浏览文件 @
4fa8fba2
...
...
@@ -22,6 +22,7 @@ History.prototype = {
var
isScriptCmd
=
lastCmd
&&
lastCmd
.
updatable
&&
cmd
.
updatable
&&
lastCmd
.
script
!==
undefined
&&
lastCmd
.
object
===
cmd
.
object
&&
lastCmd
.
type
===
cmd
.
type
&&
...
...
@@ -30,6 +31,7 @@ History.prototype = {
var
isUpdatableCmd
=
lastCmd
&&
lastCmd
.
updatable
&&
cmd
.
updatable
&&
lastCmd
.
object
===
cmd
.
object
&&
lastCmd
.
type
===
cmd
.
type
&&
timeDifference
<
500
;
...
...
editor/js/Script.js
浏览文件 @
4fa8fba2
...
...
@@ -91,12 +91,28 @@ var Script = function ( editor ) {
if
(
currentScript
!==
'
programInfo
'
)
return
;
var
json
=
JSON
.
parse
(
value
);
currentObject
.
defines
=
json
.
defines
;
currentObject
.
uniforms
=
json
.
uniforms
;
currentObject
.
attributes
=
json
.
attributes
;
currentObject
.
needsUpdate
=
true
;
signals
.
materialChanged
.
dispatch
(
currentObject
);
if
(
JSON
.
stringify
(
currentObject
.
material
.
defines
)
!==
JSON
.
stringify
(
json
.
defines
)
)
{
var
cmd
=
new
CmdSetMaterialValue
(
currentObject
,
'
defines
'
,
json
.
defines
);
cmd
.
updatable
=
false
;
editor
.
execute
(
cmd
);
}
if
(
JSON
.
stringify
(
currentObject
.
material
.
uniforms
)
!==
JSON
.
stringify
(
json
.
uniforms
)
)
{
var
cmd
=
new
CmdSetMaterialValue
(
currentObject
,
'
uniforms
'
,
json
.
uniforms
);
cmd
.
updatable
=
false
;
editor
.
execute
(
cmd
);
}
if
(
JSON
.
stringify
(
currentObject
.
material
.
attributes
)
!==
JSON
.
stringify
(
json
.
attributes
)
)
{
var
cmd
=
new
CmdSetMaterialValue
(
currentObject
,
'
attributes
'
,
json
.
attributes
);
cmd
.
updatable
=
false
;
editor
.
execute
(
cmd
);
}
},
300
);
...
...
@@ -225,9 +241,9 @@ var Script = function ( editor ) {
if
(
errors
.
length
!==
0
)
break
;
if
(
renderer
instanceof
THREE
.
WebGLRenderer
===
false
)
break
;
currentObject
[
currentScript
]
=
string
;
currentObject
.
needsUpdate
=
true
;
signals
.
materialChanged
.
dispatch
(
currentObject
);
currentObject
.
material
[
currentScript
]
=
string
;
currentObject
.
material
.
needsUpdate
=
true
;
signals
.
materialChanged
.
dispatch
(
currentObject
.
material
);
var
programs
=
renderer
.
info
.
programs
;
...
...
@@ -239,7 +255,7 @@ var Script = function ( editor ) {
var
diagnostics
=
programs
[
i
].
diagnostics
;
if
(
diagnostics
===
undefined
||
diagnostics
.
material
!==
currentObject
)
continue
;
diagnostics
.
material
!==
currentObject
.
material
)
continue
;
if
(
!
diagnostics
.
runnable
)
valid
=
false
;
...
...
@@ -345,6 +361,7 @@ var Script = function ( editor ) {
mode
=
'
javascript
'
;
name
=
script
.
name
;
source
=
script
.
source
;
title
.
setValue
(
object
.
name
+
'
/
'
+
name
);
}
else
{
...
...
@@ -354,7 +371,7 @@ var Script = function ( editor ) {
mode
=
'
glsl
'
;
name
=
'
Vertex Shader
'
;
source
=
object
.
vertexShader
||
""
;
source
=
object
.
material
.
vertexShader
||
""
;
break
;
...
...
@@ -362,7 +379,7 @@ var Script = function ( editor ) {
mode
=
'
glsl
'
;
name
=
'
Fragment Shader
'
;
source
=
object
.
fragmentShader
||
""
;
source
=
object
.
material
.
fragmentShader
||
""
;
break
;
...
...
@@ -371,13 +388,14 @@ var Script = function ( editor ) {
mode
=
'
json
'
;
name
=
'
Program Properties
'
;
var
json
=
{
defines
:
object
.
defines
,
uniforms
:
object
.
uniforms
,
attributes
:
object
.
attributes
defines
:
object
.
material
.
defines
,
uniforms
:
object
.
material
.
uniforms
,
attributes
:
object
.
material
.
attributes
};
source
=
JSON
.
stringify
(
json
,
null
,
'
\t
'
);
}
title
.
setValue
(
object
.
material
.
name
+
'
/
'
+
name
);
}
...
...
@@ -385,7 +403,6 @@ var Script = function ( editor ) {
currentScript
=
script
;
currentObject
=
object
;
title
.
setValue
(
object
.
name
+
'
/
'
+
name
);
container
.
setDisplay
(
''
);
codemirror
.
setValue
(
source
);
if
(
mode
===
'
json
'
)
mode
=
{
name
:
'
javascript
'
,
json
:
true
};
...
...
editor/js/Sidebar.Material.js
浏览文件 @
4fa8fba2
...
...
@@ -82,7 +82,7 @@ Sidebar.Material = function ( editor ) {
materialProgramInfo
.
setMarginLeft
(
'
4px
'
);
materialProgramInfo
.
onClick
(
function
()
{
signals
.
editScript
.
dispatch
(
currentObject
.
material
,
'
programInfo
'
);
signals
.
editScript
.
dispatch
(
currentObject
,
'
programInfo
'
);
}
);
materialProgramRow
.
add
(
materialProgramInfo
);
...
...
@@ -91,7 +91,7 @@ Sidebar.Material = function ( editor ) {
materialProgramVertex
.
setMarginLeft
(
'
4px
'
);
materialProgramVertex
.
onClick
(
function
()
{
signals
.
editScript
.
dispatch
(
currentObject
.
material
,
'
vertexShader
'
);
signals
.
editScript
.
dispatch
(
currentObject
,
'
vertexShader
'
);
}
);
materialProgramRow
.
add
(
materialProgramVertex
);
...
...
@@ -100,7 +100,7 @@ Sidebar.Material = function ( editor ) {
materialProgramFragment
.
setMarginLeft
(
'
4px
'
);
materialProgramFragment
.
onClick
(
function
()
{
signals
.
editScript
.
dispatch
(
currentObject
.
material
,
'
fragmentShader
'
);
signals
.
editScript
.
dispatch
(
currentObject
,
'
fragmentShader
'
);
}
);
materialProgramRow
.
add
(
materialProgramFragment
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录