Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
6407b60f
Unverified
Commit
6407b60f
authored
Mar 19, 2020
by
Yuri Roubinsky
Committed by
GitHub
Mar 19, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #37166 from Chaosus/shader_time
Makes shader 'TIME' available in custom functions by default
parents
50008658
dbffa2e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
shader_language.cpp
servers/visual/shader_language.cpp
+6
-0
shader_types.cpp
servers/visual/shader_types.cpp
+5
-0
No files found.
servers/visual/shader_language.cpp
View file @
6407b60f
...
...
@@ -6284,6 +6284,12 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
builtin_types
=
p_functions
[
name
].
built_ins
;
}
if
(
p_functions
.
has
(
"global"
))
{
// Adds global variables: 'TIME'
for
(
Map
<
StringName
,
BuiltInInfo
>::
Element
*
E
=
p_functions
[
"global"
].
built_ins
.
front
();
E
;
E
=
E
->
next
())
{
builtin_types
.
insert
(
E
->
key
(),
E
->
value
());
}
}
ShaderNode
::
Function
function
;
function
.
callable
=
!
p_functions
.
has
(
name
);
...
...
servers/visual/shader_types.cpp
View file @
6407b60f
...
...
@@ -56,6 +56,8 @@ ShaderTypes::ShaderTypes() {
/*************** SPATIAL ***********************/
shader_modes
[
VS
::
SHADER_SPATIAL
].
functions
[
"global"
].
built_ins
[
"TIME"
]
=
constt
(
ShaderLanguage
::
TYPE_FLOAT
);
shader_modes
[
VS
::
SHADER_SPATIAL
].
functions
[
"vertex"
].
built_ins
[
"VERTEX"
]
=
ShaderLanguage
::
TYPE_VEC3
;
shader_modes
[
VS
::
SHADER_SPATIAL
].
functions
[
"vertex"
].
built_ins
[
"NORMAL"
]
=
ShaderLanguage
::
TYPE_VEC3
;
shader_modes
[
VS
::
SHADER_SPATIAL
].
functions
[
"vertex"
].
built_ins
[
"TANGENT"
]
=
ShaderLanguage
::
TYPE_VEC3
;
...
...
@@ -200,6 +202,8 @@ ShaderTypes::ShaderTypes() {
/************ CANVAS ITEM **************************/
shader_modes
[
VS
::
SHADER_CANVAS_ITEM
].
functions
[
"global"
].
built_ins
[
"TIME"
]
=
constt
(
ShaderLanguage
::
TYPE_FLOAT
);
shader_modes
[
VS
::
SHADER_CANVAS_ITEM
].
functions
[
"vertex"
].
built_ins
[
"VERTEX"
]
=
ShaderLanguage
::
TYPE_VEC2
;
shader_modes
[
VS
::
SHADER_CANVAS_ITEM
].
functions
[
"vertex"
].
built_ins
[
"UV"
]
=
ShaderLanguage
::
TYPE_VEC2
;
shader_modes
[
VS
::
SHADER_CANVAS_ITEM
].
functions
[
"vertex"
].
built_ins
[
"COLOR"
]
=
ShaderLanguage
::
TYPE_VEC4
;
...
...
@@ -267,6 +271,7 @@ ShaderTypes::ShaderTypes() {
/************ PARTICLES **************************/
shader_modes
[
VS
::
SHADER_PARTICLES
].
functions
[
"global"
].
built_ins
[
"TIME"
]
=
constt
(
ShaderLanguage
::
TYPE_FLOAT
);
shader_modes
[
VS
::
SHADER_PARTICLES
].
functions
[
"vertex"
].
built_ins
[
"COLOR"
]
=
ShaderLanguage
::
TYPE_VEC4
;
shader_modes
[
VS
::
SHADER_PARTICLES
].
functions
[
"vertex"
].
built_ins
[
"VELOCITY"
]
=
ShaderLanguage
::
TYPE_VEC3
;
shader_modes
[
VS
::
SHADER_PARTICLES
].
functions
[
"vertex"
].
built_ins
[
"MASS"
]
=
ShaderLanguage
::
TYPE_FLOAT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment