Back to shaders
Shader test bench
3d Rotate.fs
runnable fragment
Complete GLSL fragment shader. Stronghold runs it directly when the browser can compile it.
Code
uniform sampler2D inputImage;
uniform float xrot;
uniform float yrot;
uniform float zrot;
uniform float zoom;
precision mediump float;
/*{
"DESCRIPTION": "performs a 3d rotation",
"CREDIT": "by zoidberg",
"ISFVSN": "2",
"CATEGORIES": [
"Geometry Adjustment", "Utility"
],
"INPUTS": [
{
"NAME": "inputImage",
"TYPE": "image"
},
{
"NAME": "xrot",
"LABEL": "X rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "yrot",
"LABEL": "Y rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "zrot",
"LABEL": "Z rotate",
"TYPE": "float",
"MIN": 0.0,
"MAX": 2.0,
"DEFAULT": 1.0
},
{
"NAME": "zoom",
"LABEL": "Zoom Level",
"TYPE": "float",
"MIN": 0.0,
"MAX": 1.0,
"DEFAULT": 1.0
}
]
}*/
void main()
{
gl_FragColor = IMG_THIS_PIXEL(inputImage);
}