-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
682 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<Panda> | ||
<Data name="render size" y="600" x="800"/> | ||
<Data name="background color" b="1" g="1" r="1" a="1"/> | ||
<Data name="timestep" real="0.01"/> | ||
<Data name="use timer" int="0"/> | ||
<Data name="use multithread" int="0"/> | ||
<Object index="1" y="253" type="panda::ModifierShader_SetUniform" x="530"> | ||
<CreatedData type="real"/> | ||
<Data name="name #1">time</Data> | ||
</Object> | ||
<Object index="2" y="287" type="panda::GeneratorNumber_AnimationTime" x="362"/> | ||
<Object index="3" y="227" type="panda::GeneratorUser<panda::types::Shader>" x="362"> | ||
<Data name="input" widgetData="Vertex;Fragment"> | ||
<Source type="1">#version 330 | ||
|
||
in vec2 vertex; | ||
in vec2 texCoord; | ||
|
||
uniform mat4 MVP; | ||
|
||
out vec2 f_texCoord; | ||
|
||
void main(void) | ||
{ | ||
f_texCoord = texCoord; | ||
gl_Position = MVP * vec4(vertex, 0, 1); | ||
}</Source> | ||
<Source type="2">#version 330 | ||
|
||
in vec2 f_texCoord; | ||
|
||
uniform float time; | ||
|
||
out vec4 fragColor; | ||
|
||
const float pi = 3.1415926535897932384626433832795; | ||
|
||
void main() | ||
{ | ||
vec2 p = f_texCoord.st * 6.0; | ||
vec3 col = vec3( 0.0, 0.0, 0.0 ); | ||
float ca = 0.0; | ||
for( int j = 1; j < 2; j++ ) | ||
{ | ||
float jj = float( j ); | ||
|
||
for( int i = 1; i < 6; i++ ) | ||
{ | ||
vec2 newp = p * 0.9; | ||
float ii = float( i ); | ||
newp.x += 1.2 / ( ii + jj) * cos( ii * p.y + time + 5 * ( jj / ii ) ) - 1; | ||
newp.y += 1.2 / ( ii + jj ) * sin( ii * p.x + time + 5 * ( jj / ii ) ) + 1; | ||
p=newp; | ||
} | ||
|
||
p *= 0.95; | ||
col += vec3( 0.5 * sin( pi * p.x) + 0.5, 0.5 * sin( pi * p.y ) + 0.5, 0.5 * sin( pi * p.x ) * cos( pi * p.y ) + 0.5 ); | ||
ca += 0.8; | ||
} | ||
col /= ca; | ||
fragColor = vec4( col * col, 1.0 ); | ||
}</Source> | ||
</Data> | ||
</Object> | ||
<Object index="4" y="184.5" type="panda::GeneratorRect_RenderArea" x="530"/> | ||
<Object index="5" y="223" type="panda::RenderFilledRect" x="676.5"/> | ||
<Object dy="100" index="6" y="227.75" type="panda::Annotation" x="252.25" dx="200"> | ||
<Data name="text">Modified the fragment shader to render nice colors.</Data> | ||
</Object> | ||
<Object dy="100" index="7" y="367.75" type="panda::Annotation" x="332.25" dx="200"> | ||
<Data name="text">Use the time to animate the shader</Data> | ||
</Object> | ||
<Object dy="100" index="8" y="216.25" type="panda::Annotation" x="665.75" dx="200"> | ||
<Data name="text">Render the whole area with the custom shader</Data> | ||
</Object> | ||
<Link data1="input" object1="1" object2="3" data2="value"/> | ||
<Link data1="value #1" object1="1" object2="2" data2="time"/> | ||
<Link data1="rectangle" object1="5" object2="4" data2="area"/> | ||
<Link data1="shader" object1="5" object2="1" data2="output"/> | ||
</Panda> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.