diff options
Diffstat (limited to 'tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl')
-rw-r--r-- | tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl new file mode 100644 index 0000000..7910a54 --- /dev/null +++ b/tests/RenderScriptTests/SceneGraph/res/raw/shader2v.glsl @@ -0,0 +1,22 @@ +/* + rs_matrix4x4 model; + rs_matrix4x4 viewProj; +*/ + +varying vec3 varWorldPos; +varying vec3 varWorldNormal; +varying vec2 varTex0; + +// This is where actual shader code begins +void main() { + vec4 objPos = ATTRIB_position; + vec4 worldPos = UNI_model * objPos; + gl_Position = UNI_viewProj * worldPos; + + mat3 model3 = mat3(UNI_model[0].xyz, UNI_model[1].xyz, UNI_model[2].xyz); + vec3 worldNorm = model3 * ATTRIB_normal; + + varWorldPos = worldPos.xyz; + varWorldNormal = worldNorm; + varTex0 = ATTRIB_texture0; +} |