-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from CedricGuillemet/dev-0.3.0
Imogen 0.3 - codename Cygnus Hyoga
- Loading branch information
Showing
25 changed files
with
1,088 additions
and
251 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
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,13 @@ | ||
#include "Imogen.h" | ||
|
||
typedef struct Paint2D_t | ||
{ | ||
int size; | ||
} Paint2D; | ||
|
||
int main(Paint2D *param, Evaluation *evaluation) | ||
{ | ||
SetEvaluationSize(evaluation->targetIndex, 256<<param->size, 256<<param->size); | ||
SetBlendingMode(evaluation->targetIndex, ONE, ONE_MINUS_SRC_ALPHA); | ||
return EVAL_OK; | ||
} |
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,23 @@ | ||
layout (std140) uniform CropBlock | ||
{ | ||
vec4 quad; | ||
} CropParam; | ||
|
||
vec4 Crop() | ||
{ | ||
if (EvaluationParam.uiPass == 1) | ||
{ | ||
vec4 q = vec4(min(CropParam.quad.x, CropParam.quad.z), | ||
min(CropParam.quad.y, CropParam.quad.w), | ||
max(CropParam.quad.x, CropParam.quad.z), | ||
max(CropParam.quad.y, CropParam.quad.w)); | ||
float barx = min(step(q.x, vUV.x), step(vUV.x, q.z)); | ||
float bary = min(step(q.y, vUV.y), step(vUV.y, q.w)); | ||
float colFactor = min(barx, bary); | ||
return texture(Sampler0, vUV) * max(colFactor, 0.5); | ||
} | ||
|
||
vec4 q = CropParam.quad; | ||
vec2 uv = vec2(mix(min(q.x, q.z), max(q.x, q.z), vUV.x), mix(min(q.y, q.w), max(q.y, q.w), vUV.y)); | ||
return texture(Sampler0, uv); | ||
} |
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
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
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,33 @@ | ||
layout (std140) uniform Paint2DBlock | ||
{ | ||
int size; // 1<<(size+8) | ||
} Paint2DParam; | ||
|
||
vec4 brushSample(vec2 uv, float radius) | ||
{ | ||
vec2 nuv = (uv) / radius + vec2(0.5); | ||
float alphaMul = min(min(step(0.0, nuv.x), step(nuv.x, 1.0)), min(step(0.0, nuv.y), step(nuv.y, 1.0))); | ||
return texture(Sampler0, nuv) * alphaMul; | ||
} | ||
vec4 Paint2D() | ||
{ | ||
vec4 res = vec4(0.0); | ||
float brushRadius = 0.25; | ||
vec4 brush = brushSample(vUV-EvaluationParam.mouse.xy, brushRadius); | ||
if (EvaluationParam.uiPass == 1) | ||
{ | ||
res = brush; | ||
} | ||
// paint pass | ||
if (EvaluationParam.mouse.z > 0.0) | ||
{ | ||
res = brush; | ||
} | ||
if (EvaluationParam.mouse.w > 0.0) | ||
{ | ||
res = brush; | ||
res.xyz = vec3(0.0); | ||
} | ||
|
||
return vec4(res.xyz*res.w, res.w); | ||
} |
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
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
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
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,15 @@ | ||
layout (std140) uniform SwirlBlock | ||
{ | ||
vec2 angles; | ||
} SwirlParam; | ||
|
||
vec4 Swirl() | ||
{ | ||
vec2 uv = vUV - vec2(0.5); | ||
float len = length(uv) / (SQRT2 * 0.5); | ||
float angle = mix(SwirlParam.angles.x, SwirlParam.angles.y, len); | ||
vec2 nuv = Rotate2D(uv, angle) + vec2(0.5); | ||
vec4 tex = texture(Sampler0, nuv); | ||
|
||
return tex; | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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
Oops, something went wrong.