From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- assets/images/BasePlatformA01_AO.png | Bin 0 -> 65754 bytes assets/images/BasePlatformA01_DM.png | Bin 0 -> 70207 bytes assets/images/BoxA01_AO.png | Bin 0 -> 62516 bytes assets/images/BoxA01_DM.png | Bin 0 -> 54892 bytes assets/images/BoxB2_AO.png | Bin 0 -> 86244 bytes assets/images/BoxB2_DM.png | Bin 0 -> 86470 bytes assets/images/Grunge.png | Bin 0 -> 2174259 bytes assets/images/LabelFrame.tga | Bin 0 -> 12306 bytes assets/images/MArmBaseN_DM.png | Bin 0 -> 136280 bytes assets/images/MArmBaseN_NM.png | Bin 0 -> 109974 bytes assets/images/MArmTopN_DM.png | Bin 0 -> 136902 bytes assets/images/MArmTopN_NM.png | Bin 0 -> 97275 bytes assets/images/MArm_AO.png | Bin 0 -> 157336 bytes assets/images/MBaseWallA01_AO.png | Bin 0 -> 134056 bytes assets/images/MBaseWallA01_DM.png | Bin 0 -> 136022 bytes assets/images/MBaseWallA01_GM.png | Bin 0 -> 26051 bytes assets/images/MBase_AO.png | Bin 0 -> 165449 bytes assets/images/MCoreBase_DM.png | Bin 0 -> 130589 bytes assets/images/MCoreBase_GM.png | Bin 0 -> 9853 bytes assets/images/MEjectorBaseN_DM.png | Bin 0 -> 119768 bytes assets/images/MEjectorBaseN_NM.png | Bin 0 -> 57808 bytes assets/images/MRingBaseN_DM.png | Bin 0 -> 107671 bytes assets/images/MRingBaseN_NM.png | Bin 0 -> 94852 bytes assets/images/MSquareBaseN_DM.png | Bin 0 -> 76400 bytes assets/images/MWall_AO.png | Bin 0 -> 108536 bytes assets/images/MWall_DM.png | Bin 0 -> 133125 bytes assets/images/MWall_GM.png | Bin 0 -> 9294 bytes assets/images/MWall_NM.png | Bin 0 -> 89287 bytes assets/images/Ref.png | Bin 0 -> 13632 bytes assets/images/Spec.png | Bin 0 -> 2321526 bytes assets/images/Thumbs.db | Bin 0 -> 7168 bytes assets/images/black.png | Bin 0 -> 2791 bytes assets/images/black.tga | Bin 0 -> 210 bytes assets/images/blue.png | Bin 0 -> 2796 bytes assets/images/cube.png | Bin 0 -> 34506 bytes assets/images/cubelight.png | Bin 0 -> 33154 bytes assets/images/cubelight_Glow.png | Bin 0 -> 3635 bytes assets/images/cubelight_spec.png | Bin 0 -> 33249 bytes assets/images/default_white.png | Bin 0 -> 90 bytes assets/images/droid.png | Bin 0 -> 885 bytes assets/images/env.png | Bin 0 -> 85724 bytes assets/images/femaleRobot.png | Bin 0 -> 2857 bytes assets/images/femaleRobot_Glow.png | Bin 0 -> 2855 bytes assets/images/grey.png | Bin 0 -> 935 bytes assets/images/irredecentENV.png | Bin 0 -> 103121 bytes assets/images/lightRack.png | Bin 0 -> 2857 bytes assets/images/lightRack_Glow.png | Bin 0 -> 2857 bytes assets/images/material_paint.png | Bin 0 -> 8450 bytes assets/images/metal.png | Bin 0 -> 2366049 bytes assets/images/normalMap.png | Bin 0 -> 105161 bytes assets/images/particle-star.png | Bin 0 -> 3665 bytes assets/images/quilt01.png | Bin 0 -> 572888 bytes assets/images/quilt01_E.png | Bin 0 -> 3273 bytes assets/images/quilt01_N.png | Bin 0 -> 116034 bytes assets/images/quilt02.png | Bin 0 -> 391471 bytes assets/images/quilt02_E.png | Bin 0 -> 3273 bytes assets/images/quilt02_N.png | Bin 0 -> 34939 bytes assets/images/random_normal.png | Bin 0 -> 9356 bytes assets/images/rocky-diffuse.jpg | Bin 0 -> 262144 bytes assets/images/rocky-normal.jpg | Bin 0 -> 262144 bytes assets/images/rocky-spec.jpg | Bin 0 -> 316095 bytes assets/images/scales_normal.png | Bin 0 -> 113789 bytes assets/images/silver.png | Bin 0 -> 46756 bytes assets/images/stitchStroke.png | Bin 0 -> 8054 bytes assets/images/stitchStroke_N.png | Bin 0 -> 2868 bytes assets/images/white.png | Bin 0 -> 2794 bytes assets/images/white.tga | Bin 0 -> 236 bytes assets/shaders/Basic.vert.glsl | 26 ++++ assets/shaders/linearGradient.frag.glsl | 52 +++++++ assets/shaders/linearGradient.vert.glsl | 48 ++++++ assets/shaders/test_fshader.glsl | 159 +++++++++++++++++++ assets/shaders/test_fshader_full.glsl | 82 ++++++++++ assets/shaders/test_vshader.glsl | 82 ++++++++++ assets/shaders/ub_fshader.glsl | 263 ++++++++++++++++++++++++++++++++ assets/shaders/ub_vshader.glsl | 162 ++++++++++++++++++++ 75 files changed, 874 insertions(+) create mode 100644 assets/images/BasePlatformA01_AO.png create mode 100644 assets/images/BasePlatformA01_DM.png create mode 100644 assets/images/BoxA01_AO.png create mode 100644 assets/images/BoxA01_DM.png create mode 100644 assets/images/BoxB2_AO.png create mode 100644 assets/images/BoxB2_DM.png create mode 100644 assets/images/Grunge.png create mode 100644 assets/images/LabelFrame.tga create mode 100644 assets/images/MArmBaseN_DM.png create mode 100644 assets/images/MArmBaseN_NM.png create mode 100644 assets/images/MArmTopN_DM.png create mode 100644 assets/images/MArmTopN_NM.png create mode 100644 assets/images/MArm_AO.png create mode 100644 assets/images/MBaseWallA01_AO.png create mode 100644 assets/images/MBaseWallA01_DM.png create mode 100644 assets/images/MBaseWallA01_GM.png create mode 100644 assets/images/MBase_AO.png create mode 100644 assets/images/MCoreBase_DM.png create mode 100644 assets/images/MCoreBase_GM.png create mode 100644 assets/images/MEjectorBaseN_DM.png create mode 100644 assets/images/MEjectorBaseN_NM.png create mode 100644 assets/images/MRingBaseN_DM.png create mode 100644 assets/images/MRingBaseN_NM.png create mode 100644 assets/images/MSquareBaseN_DM.png create mode 100644 assets/images/MWall_AO.png create mode 100644 assets/images/MWall_DM.png create mode 100644 assets/images/MWall_GM.png create mode 100644 assets/images/MWall_NM.png create mode 100644 assets/images/Ref.png create mode 100644 assets/images/Spec.png create mode 100644 assets/images/Thumbs.db create mode 100644 assets/images/black.png create mode 100644 assets/images/black.tga create mode 100644 assets/images/blue.png create mode 100644 assets/images/cube.png create mode 100644 assets/images/cubelight.png create mode 100644 assets/images/cubelight_Glow.png create mode 100644 assets/images/cubelight_spec.png create mode 100644 assets/images/default_white.png create mode 100644 assets/images/droid.png create mode 100644 assets/images/env.png create mode 100644 assets/images/femaleRobot.png create mode 100644 assets/images/femaleRobot_Glow.png create mode 100644 assets/images/grey.png create mode 100644 assets/images/irredecentENV.png create mode 100644 assets/images/lightRack.png create mode 100644 assets/images/lightRack_Glow.png create mode 100644 assets/images/material_paint.png create mode 100644 assets/images/metal.png create mode 100644 assets/images/normalMap.png create mode 100644 assets/images/particle-star.png create mode 100644 assets/images/quilt01.png create mode 100644 assets/images/quilt01_E.png create mode 100644 assets/images/quilt01_N.png create mode 100644 assets/images/quilt02.png create mode 100644 assets/images/quilt02_E.png create mode 100644 assets/images/quilt02_N.png create mode 100644 assets/images/random_normal.png create mode 100644 assets/images/rocky-diffuse.jpg create mode 100644 assets/images/rocky-normal.jpg create mode 100644 assets/images/rocky-spec.jpg create mode 100644 assets/images/scales_normal.png create mode 100644 assets/images/silver.png create mode 100644 assets/images/stitchStroke.png create mode 100644 assets/images/stitchStroke_N.png create mode 100644 assets/images/white.png create mode 100644 assets/images/white.tga create mode 100644 assets/shaders/Basic.vert.glsl create mode 100644 assets/shaders/linearGradient.frag.glsl create mode 100644 assets/shaders/linearGradient.vert.glsl create mode 100644 assets/shaders/test_fshader.glsl create mode 100644 assets/shaders/test_fshader_full.glsl create mode 100644 assets/shaders/test_vshader.glsl create mode 100644 assets/shaders/ub_fshader.glsl create mode 100644 assets/shaders/ub_vshader.glsl (limited to 'assets') diff --git a/assets/images/BasePlatformA01_AO.png b/assets/images/BasePlatformA01_AO.png new file mode 100644 index 00000000..11f74245 Binary files /dev/null and b/assets/images/BasePlatformA01_AO.png differ diff --git a/assets/images/BasePlatformA01_DM.png b/assets/images/BasePlatformA01_DM.png new file mode 100644 index 00000000..f367ccb7 Binary files /dev/null and b/assets/images/BasePlatformA01_DM.png differ diff --git a/assets/images/BoxA01_AO.png b/assets/images/BoxA01_AO.png new file mode 100644 index 00000000..60a88883 Binary files /dev/null and b/assets/images/BoxA01_AO.png differ diff --git a/assets/images/BoxA01_DM.png b/assets/images/BoxA01_DM.png new file mode 100644 index 00000000..cc6f6165 Binary files /dev/null and b/assets/images/BoxA01_DM.png differ diff --git a/assets/images/BoxB2_AO.png b/assets/images/BoxB2_AO.png new file mode 100644 index 00000000..b2ca502e Binary files /dev/null and b/assets/images/BoxB2_AO.png differ diff --git a/assets/images/BoxB2_DM.png b/assets/images/BoxB2_DM.png new file mode 100644 index 00000000..a493ec54 Binary files /dev/null and b/assets/images/BoxB2_DM.png differ diff --git a/assets/images/Grunge.png b/assets/images/Grunge.png new file mode 100644 index 00000000..49ff48e9 Binary files /dev/null and b/assets/images/Grunge.png differ diff --git a/assets/images/LabelFrame.tga b/assets/images/LabelFrame.tga new file mode 100644 index 00000000..7e3326bd Binary files /dev/null and b/assets/images/LabelFrame.tga differ diff --git a/assets/images/MArmBaseN_DM.png b/assets/images/MArmBaseN_DM.png new file mode 100644 index 00000000..6845b555 Binary files /dev/null and b/assets/images/MArmBaseN_DM.png differ diff --git a/assets/images/MArmBaseN_NM.png b/assets/images/MArmBaseN_NM.png new file mode 100644 index 00000000..5009b0ec Binary files /dev/null and b/assets/images/MArmBaseN_NM.png differ diff --git a/assets/images/MArmTopN_DM.png b/assets/images/MArmTopN_DM.png new file mode 100644 index 00000000..ef3511b3 Binary files /dev/null and b/assets/images/MArmTopN_DM.png differ diff --git a/assets/images/MArmTopN_NM.png b/assets/images/MArmTopN_NM.png new file mode 100644 index 00000000..489c92db Binary files /dev/null and b/assets/images/MArmTopN_NM.png differ diff --git a/assets/images/MArm_AO.png b/assets/images/MArm_AO.png new file mode 100644 index 00000000..be27c8cb Binary files /dev/null and b/assets/images/MArm_AO.png differ diff --git a/assets/images/MBaseWallA01_AO.png b/assets/images/MBaseWallA01_AO.png new file mode 100644 index 00000000..d68e4209 Binary files /dev/null and b/assets/images/MBaseWallA01_AO.png differ diff --git a/assets/images/MBaseWallA01_DM.png b/assets/images/MBaseWallA01_DM.png new file mode 100644 index 00000000..02a31e16 Binary files /dev/null and b/assets/images/MBaseWallA01_DM.png differ diff --git a/assets/images/MBaseWallA01_GM.png b/assets/images/MBaseWallA01_GM.png new file mode 100644 index 00000000..726453ae Binary files /dev/null and b/assets/images/MBaseWallA01_GM.png differ diff --git a/assets/images/MBase_AO.png b/assets/images/MBase_AO.png new file mode 100644 index 00000000..12d763da Binary files /dev/null and b/assets/images/MBase_AO.png differ diff --git a/assets/images/MCoreBase_DM.png b/assets/images/MCoreBase_DM.png new file mode 100644 index 00000000..4d0ec6dd Binary files /dev/null and b/assets/images/MCoreBase_DM.png differ diff --git a/assets/images/MCoreBase_GM.png b/assets/images/MCoreBase_GM.png new file mode 100644 index 00000000..81d464ec Binary files /dev/null and b/assets/images/MCoreBase_GM.png differ diff --git a/assets/images/MEjectorBaseN_DM.png b/assets/images/MEjectorBaseN_DM.png new file mode 100644 index 00000000..1832c522 Binary files /dev/null and b/assets/images/MEjectorBaseN_DM.png differ diff --git a/assets/images/MEjectorBaseN_NM.png b/assets/images/MEjectorBaseN_NM.png new file mode 100644 index 00000000..4f7560d3 Binary files /dev/null and b/assets/images/MEjectorBaseN_NM.png differ diff --git a/assets/images/MRingBaseN_DM.png b/assets/images/MRingBaseN_DM.png new file mode 100644 index 00000000..f8a4aebe Binary files /dev/null and b/assets/images/MRingBaseN_DM.png differ diff --git a/assets/images/MRingBaseN_NM.png b/assets/images/MRingBaseN_NM.png new file mode 100644 index 00000000..c9242acb Binary files /dev/null and b/assets/images/MRingBaseN_NM.png differ diff --git a/assets/images/MSquareBaseN_DM.png b/assets/images/MSquareBaseN_DM.png new file mode 100644 index 00000000..5576eff0 Binary files /dev/null and b/assets/images/MSquareBaseN_DM.png differ diff --git a/assets/images/MWall_AO.png b/assets/images/MWall_AO.png new file mode 100644 index 00000000..e5d5a684 Binary files /dev/null and b/assets/images/MWall_AO.png differ diff --git a/assets/images/MWall_DM.png b/assets/images/MWall_DM.png new file mode 100644 index 00000000..b735de01 Binary files /dev/null and b/assets/images/MWall_DM.png differ diff --git a/assets/images/MWall_GM.png b/assets/images/MWall_GM.png new file mode 100644 index 00000000..2cd56c3d Binary files /dev/null and b/assets/images/MWall_GM.png differ diff --git a/assets/images/MWall_NM.png b/assets/images/MWall_NM.png new file mode 100644 index 00000000..2650bc07 Binary files /dev/null and b/assets/images/MWall_NM.png differ diff --git a/assets/images/Ref.png b/assets/images/Ref.png new file mode 100644 index 00000000..226e4200 Binary files /dev/null and b/assets/images/Ref.png differ diff --git a/assets/images/Spec.png b/assets/images/Spec.png new file mode 100644 index 00000000..76658540 Binary files /dev/null and b/assets/images/Spec.png differ diff --git a/assets/images/Thumbs.db b/assets/images/Thumbs.db new file mode 100644 index 00000000..fa66bbc8 Binary files /dev/null and b/assets/images/Thumbs.db differ diff --git a/assets/images/black.png b/assets/images/black.png new file mode 100644 index 00000000..10318dc4 Binary files /dev/null and b/assets/images/black.png differ diff --git a/assets/images/black.tga b/assets/images/black.tga new file mode 100644 index 00000000..69124ff0 Binary files /dev/null and b/assets/images/black.tga differ diff --git a/assets/images/blue.png b/assets/images/blue.png new file mode 100644 index 00000000..ee029b55 Binary files /dev/null and b/assets/images/blue.png differ diff --git a/assets/images/cube.png b/assets/images/cube.png new file mode 100644 index 00000000..6cb3ef82 Binary files /dev/null and b/assets/images/cube.png differ diff --git a/assets/images/cubelight.png b/assets/images/cubelight.png new file mode 100644 index 00000000..53ff1bf3 Binary files /dev/null and b/assets/images/cubelight.png differ diff --git a/assets/images/cubelight_Glow.png b/assets/images/cubelight_Glow.png new file mode 100644 index 00000000..4f8c922f Binary files /dev/null and b/assets/images/cubelight_Glow.png differ diff --git a/assets/images/cubelight_spec.png b/assets/images/cubelight_spec.png new file mode 100644 index 00000000..5cfe820b Binary files /dev/null and b/assets/images/cubelight_spec.png differ diff --git a/assets/images/default_white.png b/assets/images/default_white.png new file mode 100644 index 00000000..cca49ba7 Binary files /dev/null and b/assets/images/default_white.png differ diff --git a/assets/images/droid.png b/assets/images/droid.png new file mode 100644 index 00000000..9cba133e Binary files /dev/null and b/assets/images/droid.png differ diff --git a/assets/images/env.png b/assets/images/env.png new file mode 100644 index 00000000..72bba813 Binary files /dev/null and b/assets/images/env.png differ diff --git a/assets/images/femaleRobot.png b/assets/images/femaleRobot.png new file mode 100644 index 00000000..30b153b4 Binary files /dev/null and b/assets/images/femaleRobot.png differ diff --git a/assets/images/femaleRobot_Glow.png b/assets/images/femaleRobot_Glow.png new file mode 100644 index 00000000..1141f521 Binary files /dev/null and b/assets/images/femaleRobot_Glow.png differ diff --git a/assets/images/grey.png b/assets/images/grey.png new file mode 100644 index 00000000..b1ebe069 Binary files /dev/null and b/assets/images/grey.png differ diff --git a/assets/images/irredecentENV.png b/assets/images/irredecentENV.png new file mode 100644 index 00000000..21c1c9ce Binary files /dev/null and b/assets/images/irredecentENV.png differ diff --git a/assets/images/lightRack.png b/assets/images/lightRack.png new file mode 100644 index 00000000..30b153b4 Binary files /dev/null and b/assets/images/lightRack.png differ diff --git a/assets/images/lightRack_Glow.png b/assets/images/lightRack_Glow.png new file mode 100644 index 00000000..30b153b4 Binary files /dev/null and b/assets/images/lightRack_Glow.png differ diff --git a/assets/images/material_paint.png b/assets/images/material_paint.png new file mode 100644 index 00000000..38c695f5 Binary files /dev/null and b/assets/images/material_paint.png differ diff --git a/assets/images/metal.png b/assets/images/metal.png new file mode 100644 index 00000000..d753bec4 Binary files /dev/null and b/assets/images/metal.png differ diff --git a/assets/images/normalMap.png b/assets/images/normalMap.png new file mode 100644 index 00000000..04ae6008 Binary files /dev/null and b/assets/images/normalMap.png differ diff --git a/assets/images/particle-star.png b/assets/images/particle-star.png new file mode 100644 index 00000000..7da25295 Binary files /dev/null and b/assets/images/particle-star.png differ diff --git a/assets/images/quilt01.png b/assets/images/quilt01.png new file mode 100644 index 00000000..9c14865f Binary files /dev/null and b/assets/images/quilt01.png differ diff --git a/assets/images/quilt01_E.png b/assets/images/quilt01_E.png new file mode 100644 index 00000000..2dbafd27 Binary files /dev/null and b/assets/images/quilt01_E.png differ diff --git a/assets/images/quilt01_N.png b/assets/images/quilt01_N.png new file mode 100644 index 00000000..801cd09d Binary files /dev/null and b/assets/images/quilt01_N.png differ diff --git a/assets/images/quilt02.png b/assets/images/quilt02.png new file mode 100644 index 00000000..4b1bf2ed Binary files /dev/null and b/assets/images/quilt02.png differ diff --git a/assets/images/quilt02_E.png b/assets/images/quilt02_E.png new file mode 100644 index 00000000..2dbafd27 Binary files /dev/null and b/assets/images/quilt02_E.png differ diff --git a/assets/images/quilt02_N.png b/assets/images/quilt02_N.png new file mode 100644 index 00000000..136d1008 Binary files /dev/null and b/assets/images/quilt02_N.png differ diff --git a/assets/images/random_normal.png b/assets/images/random_normal.png new file mode 100644 index 00000000..62ca9d4d Binary files /dev/null and b/assets/images/random_normal.png differ diff --git a/assets/images/rocky-diffuse.jpg b/assets/images/rocky-diffuse.jpg new file mode 100644 index 00000000..485b9665 Binary files /dev/null and b/assets/images/rocky-diffuse.jpg differ diff --git a/assets/images/rocky-normal.jpg b/assets/images/rocky-normal.jpg new file mode 100644 index 00000000..386a2e4c Binary files /dev/null and b/assets/images/rocky-normal.jpg differ diff --git a/assets/images/rocky-spec.jpg b/assets/images/rocky-spec.jpg new file mode 100644 index 00000000..906919c3 Binary files /dev/null and b/assets/images/rocky-spec.jpg differ diff --git a/assets/images/scales_normal.png b/assets/images/scales_normal.png new file mode 100644 index 00000000..87cc77dc Binary files /dev/null and b/assets/images/scales_normal.png differ diff --git a/assets/images/silver.png b/assets/images/silver.png new file mode 100644 index 00000000..ed7f029e Binary files /dev/null and b/assets/images/silver.png differ diff --git a/assets/images/stitchStroke.png b/assets/images/stitchStroke.png new file mode 100644 index 00000000..7808e81f Binary files /dev/null and b/assets/images/stitchStroke.png differ diff --git a/assets/images/stitchStroke_N.png b/assets/images/stitchStroke_N.png new file mode 100644 index 00000000..34fa97d4 Binary files /dev/null and b/assets/images/stitchStroke_N.png differ diff --git a/assets/images/white.png b/assets/images/white.png new file mode 100644 index 00000000..58148a5d Binary files /dev/null and b/assets/images/white.png differ diff --git a/assets/images/white.tga b/assets/images/white.tga new file mode 100644 index 00000000..a40a0a2b Binary files /dev/null and b/assets/images/white.tga differ diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl new file mode 100644 index 00000000..028786d1 --- /dev/null +++ b/assets/shaders/Basic.vert.glsl @@ -0,0 +1,26 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + + +// attributes +attribute vec3 a_pos; + + + +// matrix uniforms +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_worldMatrix; + +void main(void) +{ + gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; +} \ No newline at end of file diff --git a/assets/shaders/linearGradient.frag.glsl b/assets/shaders/linearGradient.frag.glsl new file mode 100644 index 00000000..64cf56ff --- /dev/null +++ b/assets/shaders/linearGradient.frag.glsl @@ -0,0 +1,52 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +#ifdef GL_ES +precision highp float; +#endif + + +uniform vec4 u_color1; +uniform vec4 u_color2; +uniform vec4 u_color3; +uniform vec4 u_color4; +uniform float u_colorStop1; +uniform float u_colorStop2; +uniform float u_colorStop3; +uniform float u_colorStop4; +uniform vec2 u_cos_sin_angle; +//uniform int u_colorCount; // currently using 4 + +varying vec2 v_uv; + + +void main(void) +{ + float t = dot(v_uv, u_cos_sin_angle); + + vec4 color; + if (t < u_colorStop1) + color = u_color1; + else if (t < u_colorStop2) + { + float tLocal = (t - u_colorStop1)/(u_colorStop2 - u_colorStop1); + color = mix(u_color1,u_color2,tLocal); + } + else if (t < u_colorStop3) + { + float tLocal = (t - u_colorStop2)/(u_colorStop3 - u_colorStop2); + color = mix(u_color2,u_color3,tLocal); + } + else if (t < u_colorStop4) + { + float tLocal = (t - u_colorStop3)/(u_colorStop4 - u_colorStop3); + color = mix(u_color3,u_color4,tLocal); + } + else + color = u_color4; + + gl_FragColor =color; +} \ No newline at end of file diff --git a/assets/shaders/linearGradient.vert.glsl b/assets/shaders/linearGradient.vert.glsl new file mode 100644 index 00000000..aac9cbee --- /dev/null +++ b/assets/shaders/linearGradient.vert.glsl @@ -0,0 +1,48 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + + +// attributes +attribute vec3 vert; +attribute vec3 normal; +attribute vec2 texcoord; + +//uniform mat4 u_shadowLightWorld; +//uniform mat4 u_shadowBiasMatrix; +//uniform mat4 u_vShadowLight; +//uniform vec3 u_lightPos; + +// matrix uniforms +uniform mat4 u_mvMatrix; +uniform vec3 u_eye; +uniform mat4 u_normalMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_worldMatrix; + +uniform vec4 u_color1; +uniform vec4 u_color2; +uniform vec4 u_color3; +uniform vec4 u_color4; +uniform float u_colorStop1; +uniform float u_colorStop2; +uniform float u_colorStop3; +uniform float u_colorStop4; +uniform vec2 u_cos_sin_angle; +//uniform int u_colorCount; // currently using 4 + +varying vec2 v_uv; + + +void main(void) +{ + gl_Position = u_projMatrix * u_mvMatrix * vec4(vert,1.0) ; + v_uv = texcoord; +} diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl new file mode 100644 index 00000000..3a0af39f --- /dev/null +++ b/assets/shaders/test_fshader.glsl @@ -0,0 +1,159 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +// lighting uniforms +uniform vec3 u_light0Pos; +uniform vec4 u_light0Diff; +uniform vec4 u_light0Amb; + +// diffuse map +uniform sampler2D colMap; + +// environment map +uniform sampler2D envMap; + +// normal map +uniform sampler2D normalMap; + +// glow map +uniform sampler2D glowMap; + +// glow map +uniform sampler2D depthMap; + +//material uniforms +uniform vec4 u_matAmbient; +uniform vec4 u_matDiffuse; +uniform vec4 u_matSpecular; +uniform float u_matShininess; +uniform vec4 u_matEmission; +uniform float u_renderGlow; + +// varyings +varying vec4 vNormal; // w = texcoord.x +varying vec4 vECPos; // w = texcoord.y +varying vec3 vEyePos; +varying vec4 vShadowCoord; +varying vec2 vEnvTexCoord; +varying float vDiffuseIntensity; + +#ifdef PC + +void main() +{ + vec4 rgba_depth = texture2D(depthMap, vShadowCoord.xy/vShadowCoord.w, -32.0); + const vec4 bit_shift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0); + float dist = vShadowCoord.w/200.0; + float d = dot(rgba_depth, bit_shift); + float shadowCoef = (dist > d + 0.00779) ? (0.6) : (1.0); + + vec4 colMapTexel = vec4(0); + if (u_renderGlow <= 0.5) { + colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); + } else { + colMapTexel = vec4(texture2D(glowMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); + } + + // normal mapping + vec3 normal = normalize(vNormal.xyz); + vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; + mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); + + // create envmap coordinates + vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); + float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z ); + + // calculate environment map texel + vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); + + // lighting + vec3 lightDirection = u_light0Pos - vECPos.xyz; + float lightDist = length(lightDirection); + lightDirection /= lightDist; + + float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0); + + vec3 halfVec = normalize(lightDirection + vEyePos); + + float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection)); + float specularModifier = max(0.0, dot(mapNormal, halfVec)); + + float pf; + if(diffuseIntensity == 0.0) + pf = 0.0; + else + pf = pow(specularModifier, 76.0); + + vec4 ambient = u_matAmbient * u_light0Amb; + + vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel)*shadowCoef; + + if (u_renderGlow <= 0.5) { + diffuse *= u_light0Diff; + } + + vec4 specular = 2.0 * pf * envMapTexel; + + //gl_FragColor = vec4(dist, dist, dist, 1.0); + gl_FragColor = ((colMapTexel*(ambient + diffuse)) + specular); +} + +#endif + +#ifdef DEVICE + +void main() +{ + vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); + +// // normal mapping + vec3 normal = normalize(vNormal.xyz); +// vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; +// mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); +// +// // create envmap coordinates +// vec3 r = reflect( (vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); +// float m = 2.0 * length(r); + + // calculate environment map texel + //vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); + vec4 envMapTexel = vec4(texture2D(envMap, vEnvTexCoord).rgb, 0.0); + + // lighting + //vec3 lightDirection = normalize(u_light0Pos - vECPos.xyz); +// float lightDist = length(lightDirection); +// lightDirection /= lightDist; + + + //vec3 halfVec = normalize(lightDirection + vEyePos); + + //float diffuseIntensity = max(0.0, dot(normal, lightDirection)); + // float specularModifier = max(0.0, dot(mapNormal, halfVec)); + + // float pf; + //if(diffuseIntensity == 0.0) + //pf = 0.0; + //else + //pf = pow(specularModifier, 76.0); + + // vec4 ambient = u_matAmbient * u_light0Amb; + + vec4 diffuse = u_matDiffuse*(colMapTexel + envMapTexel)*(vDiffuseIntensity + u_matAmbient); + + //diffuse *= u_light0Diff * diffuseIntensity; + + //vec4 specular = envMapTexel; + + //gl_FragColor = vec4(dist, dist, dist, 1.0); + gl_FragColor = diffuse;//(colMapTexel*(ambient + diffuse)) + specular; +} + +#endif \ No newline at end of file diff --git a/assets/shaders/test_fshader_full.glsl b/assets/shaders/test_fshader_full.glsl new file mode 100644 index 00000000..ef721b39 --- /dev/null +++ b/assets/shaders/test_fshader_full.glsl @@ -0,0 +1,82 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +// lighting uniforms +uniform vec3 u_lightPos; +uniform vec4 u_lightDiff; +uniform vec4 u_lightAmb; + +// diffuse map +uniform sampler2D colMap; + +// environment map +uniform sampler2D envMap; + +// normal map +uniform sampler2D normalMap; + +//material uniforms +uniform vec4 u_matAmbient; +uniform vec4 u_matDiffuse; +uniform vec4 u_matSpecular; +uniform float u_matShininess; +uniform vec4 u_matEmission; +uniform float u_renderGlow; + +// varyings +varying vec4 vNormal; // w = texcoord.x +varying vec4 vECPos; // w = texcoord.y +varying vec3 vEyePos; + +void main() +{ + vec4 colMapTexel = vec4(texture2D(colMap, vec2(vNormal.w, vECPos.w)).rgb, 1.0); + + // normal mapping + vec3 normal = normalize(vNormal.xyz); + vec3 mapNormal = texture2D(normalMap, vec2(vNormal.w, vECPos.w)).xyz * 2.0 - 1.0; + mapNormal = normalize(mapNormal.x*vec3(normal.z, 0.0, -normal.x) + vec3(0.0, mapNormal.y, 0.0) + mapNormal.z*normal); + + // create envmap coordinates + vec3 r = reflect( normalize(vec3(vECPos.xyz - vEyePos.xyz)), mapNormal); + float m = 2.0 * sqrt( r.x*r.x + r.y*r.y + r.z*r.z ); + + // calculate environment map texel + vec4 envMapTexel = vec4(texture2D(envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)).rgb, 0.0); + + // lighting + vec3 lightDirection = u_lightPos - vECPos.xyz; + float lightDist = length(lightDirection); + lightDirection /= lightDist; + + float attenuation = clamp(1.0 - lightDist * 0.01, 0.0, 1.0); + + vec3 halfVec = normalize(lightDirection + vEyePos); + + float diffuseIntensity = max(0.0, dot(mapNormal, lightDirection)); + float specularModifier = max(0.0, dot(mapNormal, halfVec)); + + float pf; + if(diffuseIntensity == 0.0) + pf = 0.0; + else + pf = pow(specularModifier, 76.0); + + vec4 ambient = u_matAmbient * u_lightAmb; + vec4 diffuse = u_matDiffuse * (colMapTexel + envMapTexel); + + if (u_renderGlow <= 0.5) + diffuse *= u_lightDiff * diffuseIntensity * attenuation; + + vec4 specular = 2.0 * pf * envMapTexel; + + gl_FragColor = (colMapTexel*(ambient + diffuse)) + specular + vec4(0.0,0.0,0.0,1.0); +} diff --git a/assets/shaders/test_vshader.glsl b/assets/shaders/test_vshader.glsl new file mode 100644 index 00000000..a02d9720 --- /dev/null +++ b/assets/shaders/test_vshader.glsl @@ -0,0 +1,82 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +attribute vec3 vert; +attribute vec3 normal; +attribute vec2 texcoord; + +// matrix uniforms +uniform mat4 u_mvMatrix; +uniform vec3 u_eye; +uniform mat4 u_normalMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_worldMatrix; + +uniform mat4 u_shadowLightWorld; +uniform mat4 u_shadowBiasMatrix; +uniform mat4 u_vShadowLight; +uniform vec3 u_lightPos; + +// varyings +varying vec4 vNormal; // w = texcoord.x +varying vec4 vECPos; // w = texcoord.y +varying vec3 vEyePos; +varying vec4 vShadowCoord; +varying vec2 vEnvTexCoord; +varying float vDiffuseIntensity; + +#ifdef PC +void main() +{ + vNormal.w = texcoord.x; + vECPos.w = texcoord.y; + vEyePos = u_eye; + +// position normals and vert + vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz; + vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz; + +// pass along the geo + gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0); + + mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix; + vShadowCoord = shadowMat * vec4(vert, 1.0); +} +#endif + +#ifdef DEVICE + +void main() +{ + vNormal.w = texcoord.x; + vECPos.w = texcoord.y; + vEyePos = u_eye; + +// position normals and vert + vECPos.xyz = (u_mvMatrix*vec4(vert, 1.0)).xyz; + vNormal.xyz = (u_normalMatrix*vec4(normal, 0.0)).xyz; + +// pass along the geo + gl_Position = u_projMatrix * vec4(vECPos.xyz, 1.0); + + //mat4 shadowMat = u_shadowBiasMatrix*u_projMatrix*u_vShadowLight*u_worldMatrix; + //vShadowCoord = shadowMat * vec4(vert, 1.0); + + // normal mapping + vec3 normal = normalize(vNormal.xyz); + + // create envmap coordinates + vec3 r = reflect( vec3(vECPos.xyz - u_eye.xyz), normal); + float m = 2.0 * length(r); + vEnvTexCoord = vec2(r.x/m + 0.5, r.y/m + 0.5); + + vec3 lightDirection = normalize(u_lightPos - vECPos.xyz); + vDiffuseIntensity = max(0.0, dot(normal, lightDirection)); + +} + +#endif diff --git a/assets/shaders/ub_fshader.glsl b/assets/shaders/ub_fshader.glsl new file mode 100644 index 00000000..19a35b7d --- /dev/null +++ b/assets/shaders/ub_fshader.glsl @@ -0,0 +1,263 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +// defines +#if defined( GL_ES ) + precision highp float; +#endif + +uniform mat4 u_viewMatrix; + +#if defined( MATERIAL ) + uniform vec4 u_ambientColor; + uniform vec4 u_diffuseColor; + uniform vec4 u_specularColor; + uniform float u_specularPower; +#endif + +#if defined( LIGHTING ) + varying vec3 v_normal; + #if defined( LIGHT_0 ) +// uniform int u_light0Type; + uniform vec3 u_light0Pos; + uniform vec3 u_light0Dir; + uniform vec3 u_light0Atten; + uniform vec2 u_light0Spot; + uniform vec4 u_light0Color; + uniform vec4 u_light0Specular; + varying vec3 v_light0Dir; + varying vec3 v_light0SpotDir; + #endif + + #if defined( LIGHT_1 ) +// uniform int u_light1Type; + uniform vec3 u_light1Pos; + uniform vec3 u_light1Dir; + uniform vec3 u_light1Atten; + uniform vec2 u_light1Spot; + uniform vec4 u_light1Color; + uniform vec4 u_light1Specular; + varying vec3 v_light1Dir; + varying vec3 v_light1SpotDir; + #endif + + #if defined( LIGHT_2 ) +// uniform int u_light2Type; + uniform vec3 u_light2Pos; + uniform vec3 u_light2Dir; + uniform vec3 u_light2Atten; + uniform vec2 u_light2Spot; + uniform vec4 u_light2Color; + uniform vec4 u_light2Specular; + varying vec3 v_light2Dir; + varying vec3 v_light2SpotDir; + #endif + + #if defined( LIGHT_3 ) +// uniform int u_light3Type; + uniform vec3 u_light3Pos; + uniform vec3 u_light3Dir; + uniform vec3 u_light3Atten; + uniform vec2 u_light3Spot; + uniform vec4 u_light3Color; + uniform vec4 u_light3Specular; + varying vec3 v_light3Dir; + varying vec3 v_light3SpotDir; + #endif +#endif + +#if defined( ENVIRONMENT_MAP ) + uniform float u_envReflection; +#endif + +uniform vec3 u_eye; + +uniform sampler2D s_diffuseMap; +uniform sampler2D s_normalMap; +uniform sampler2D s_envMap; +uniform sampler2D s_specMap; + +varying vec3 v_mvPos; +varying vec3 v_eyeDir; +varying vec2 v_texcoord; + +void main() { + // these are the four principle color elements making up the final fragment equation. + vec4 a = vec4(0.0,0.0,0.0,0.0); // ambient contribution + vec4 d = vec4(0.0,0.0,0.0,0.0); // diffuse contribution + vec4 s = vec4(0.0,0.0,0.0,0.0); // specular contribution + vec4 l = vec4(0.0,0.0,0.0,0.0); // lighting contribution + +#if defined( MATERIAL ) + a += u_ambientColor; + d += u_diffuseColor; +#endif + +#if defined( DIFFUSE_MAP ) + d *= texture2D(s_diffuseMap, v_texcoord); +#endif + +#if ( defined( LIGHTING ) || defined( ENVIRONMENT_MAPPING ) ) + vec3 normal = normalize( v_normal ); +#endif + +#if defined( LIGHTING ) + #if defined( NORMAL_MAP ) + vec4 normalMap = texture2D(s_normalMap, v_texcoord); + normalMap = vec4( (normalMap.xyz * 2.0 - 1.0), 0.0 ); + normal = normalize(normalMap.x*vec3(normal.z, 0.0, normal.x) + vec3(0.0, normalMap.y, 0.0) + normalMap.z*normal); + #endif // NORMAL_MAP + + #if defined( LIGHT_0 ) + { + // diffuse lighting + float ldist = length( v_light0Dir.xyz ); + vec3 ldir = v_light0Dir.xyz / ldist; + + float atten = 1.0; + + #if ( LIGHT_0 > 0 ) + atten = 1.0 / ( u_light0Atten.x + u_light0Atten.y * ldist + u_light0Atten.z * ( ldist * ldist ) ); + #if (LIGHT_0 == 2) + float spotAngle = dot( ldir, normalize( v_light0SpotDir ) ); + float spotAtten = 0.0; + if ( spotAngle > u_light0Spot.y ) { + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light0Spot.y ) / ( u_light0Spot.x - u_light0Spot.y ) ) ); + } + atten *= spotAtten; + #endif + #endif + + float ndotl = max( 0.0, dot( normal, ldir ) ); + l += ndotl * atten * u_light0Color; + + #if defined( LIGHT_0_SPECULAR ) + // specular contribution + vec3 halfAngleVec = normalize( normalize( v_light0Dir.xyz ) + vec3(0.0,0.0,1.0) ); + float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); + s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light0Specular); + #endif + } + #endif // LIGHT_0 + + #if defined( LIGHT_1 ) + { + // diffuse lighting + float ldist = length( v_light1Dir.xyz ); + vec3 ldir = v_light1Dir.xyz / ldist; + + float atten = 1.0; + + #if ( LIGHT_1 > 0 ) + atten = 1.0 / ( u_light1Atten.x + u_light1Atten.y * ldist + u_light1Atten.z * ( ldist * ldist ) ); + #if (LIGHT_1 == 2) + float spotAngle = dot( ldir, normalize( v_light1SpotDir ) ); + float spotAtten = 0.0; + if ( spotAngle > u_light1Spot.y ) { + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light1Spot.y ) / ( u_light1Spot.x - u_light1Spot.y ) ) ); + } + atten *= spotAtten; + #endif + #endif + + float ndotl = max( 0.0, dot( normal, ldir ) ); + l += ndotl * atten * u_light1Color; + + #if defined( LIGHT_1_SPECULAR ) + // specular contribution + vec3 halfAngleVec = normalize( normalize( v_light1Dir.xyz ) + vec3(0.0,0.0,1.0) ); + float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); + s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light1Specular); + #endif + } + #endif // LIGHT_1 + + #if defined( LIGHT_2 ) + { + // diffuse lighting + float ldist = length( v_light2Dir.xyz ); + vec3 ldir = v_light2Dir.xyz / ldist; + + float atten = 1.0; + + #if ( LIGHT_2 > 0 ) + atten = 1.0 / ( u_light2Atten.x + u_light2Atten.y * ldist + u_light2Atten.z * ( ldist * ldist ) ); + #if (LIGHT_2 == 2) + float spotAngle = dot( ldir, normalize( v_light2SpotDir ) ); + float spotAtten = 0.0; + if ( spotAngle > u_light2Spot.y ) { + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light2Spot.y ) / ( u_light2Spot.x - u_light2Spot.y ) ) ); + } + atten *= spotAtten; + #endif + #endif + + float ndotl = max( 0.0, dot( normal, ldir ) ); + l += ndotl * atten * u_light2Color; + + #if defined( LIGHT_2_SPECULAR ) + // specular contribution + vec3 halfAngleVec = normalize( normalize( v_light2Dir.xyz ) + vec3(0.0,0.0,1.0) ); + float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); + s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light2Specular); + #endif + } + #endif // LIGHT_2 + + #if defined( LIGHT_3 ) + { + // diffuse lighting + float ldist = length( v_light3Dir.xyz ); + vec3 ldir = v_light3Dir.xyz / ldist; + + float atten = 1.0; + + #if ( LIGHT_3 > 0 ) + atten = 1.0 / ( u_light3Atten.x + u_light3Atten.y * ldist + u_light3Atten.z * ( ldist * ldist ) ); + #if (LIGHT_3 == 2) + float spotAngle = dot( ldir, normalize( v_light3SpotDir ) ); + float spotAtten = 0.0; + if ( spotAngle > u_light3Spot.y ) { + spotAtten = min(1.0, max( 0.0, ( spotAngle - u_light3Spot.y ) / ( u_light3Spot.x - u_light3Spot.y ) ) ); + } + atten *= spotAtten; + #endif + #endif + + float ndotl = max( 0.0, dot( normal, ldir ) ); + l += ndotl * atten * u_light3Color; + + #if defined( LIGHT_3_SPECULAR ) + // specular contribution + vec3 halfAngleVec = normalize( normalize( v_light3Dir.xyz ) + vec3(0.0,0.0,1.0) ); + float ndoth = max( 0.0, dot( normal, halfAngleVec ) ); + s += atten * pow( ndoth, u_specularPower ) * (u_specularColor * u_light3Specular); + #endif + } + #endif // LIGHT_3 +#endif // LIGHTING + +#if defined( SPECULAR ) && defined( SPECULAR_MAP ) + vec4 specMapColor = texture2D(s_specMap, v_texcoord); + s *= specMapColor; +#endif + +#if defined( ENVIRONMENT_MAP ) + vec3 r = reflect( normalize( vec3(0.0,0.0,1.0) ), normal ); + float m = 2.0 * length(r); + vec4 envMapColor = texture2D(s_envMap, vec2(r.x/m + 0.5, r.y/m + 0.5)) * u_envReflection; + + #if defined( GLOSS_MAP ) + // this is an option to modulate the alpha channel of the specular map with the environment + // map (i.e. - gloss mapping). + envMapColor *= specMapColor.a; + #endif + + s += envMapColor; +#endif + + gl_FragColor = ( a + l ) * d + s; +} \ No newline at end of file diff --git a/assets/shaders/ub_vshader.glsl b/assets/shaders/ub_vshader.glsl new file mode 100644 index 00000000..ff0c09b4 --- /dev/null +++ b/assets/shaders/ub_vshader.glsl @@ -0,0 +1,162 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +// attributes +attribute vec3 a_pos; +attribute vec3 a_normal; +attribute vec2 a_texcoord; + +// uniforms +uniform mat4 u_worldMatrix; +uniform mat4 u_viewMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +uniform mat4 u_normalMatrix; +uniform mat4 u_uvMatrix; +uniform vec3 u_eye; + +// attributes +#if defined( MATERIAL ) + uniform vec4 u_ambientColor; + uniform vec4 u_diffuseColor; + uniform vec4 u_specularColor; + uniform float u_specularPower; +#endif + +#if defined( LIGHTING ) + varying vec3 v_normal; + #if defined( LIGHT_0 ) + uniform int u_light0Type; + uniform vec3 u_light0Pos; + uniform vec3 u_light0Dir; + uniform vec3 u_light0Atten; + uniform vec2 u_light0Spot; + uniform vec4 u_light0Color; + uniform vec4 u_light0Specular; + varying vec3 v_light0Dir; + varying vec3 v_light0SpotDir; + #endif + + #if defined( LIGHT_1 ) + uniform int u_light1Type; + uniform vec3 u_light1Pos; + uniform vec3 u_light1Dir; + uniform vec3 u_light1Atten; + uniform vec2 u_light1Spot; + uniform vec3 u_light1Color; + uniform vec4 u_light1Specular; + varying vec3 v_light1Dir; + varying vec3 v_light1SpotDir; + #endif + + #if defined( LIGHT_2 ) + uniform int u_light2Type; // 0 - dir, 1 - point, 2 - spot + uniform vec3 u_light2Pos; + uniform vec3 u_light2Dir; + uniform vec3 u_light2Atten; + uniform vec2 u_light2Spot; // 0 - spot light cutoff angle, 1 - spot light exponent + uniform vec3 u_light2Color; + uniform vec4 u_light2Specular; + varying vec3 v_light2Dir; + varying vec3 v_light2SpotDir; + #endif + + #if defined( LIGHT_3 ) + uniform int u_light3Type; + uniform vec3 u_light3Pos; + uniform vec3 u_light3Dir; + uniform vec3 u_light3Atten; + uniform vec2 u_light3Spot; + uniform vec3 u_light3Color; + uniform vec4 u_light3Specular; + varying vec3 v_light3Dir; + varying vec3 v_light3SpotDir; + #endif +#endif + +#if defined( ENVIRONMENT_MAP ) + uniform float u_envReflection; +#endif + +varying vec3 v_mvPos; +varying vec3 v_eyeDir; +varying vec2 v_texcoord; + +#if defined( PC ) +void main() { + // position normals and vert + v_mvPos = ( u_mvMatrix * vec4( a_pos, 1.0 ) ).xyz; + + v_texcoord = (u_uvMatrix * vec4(a_texcoord, 0, 1.0)).xy; +#if ( defined( LIGHTING ) || defined( ENVIRONMENT_MAP ) ) + v_normal = ( u_normalMatrix * vec4( a_normal, 0.0 ) ).xyz; +#endif + +#if defined( LIGHTING ) + v_eyeDir = vec3(-u_viewMatrix[3][0], -u_viewMatrix[3][1], -u_viewMatrix[3][2]); + #if defined( LIGHT_0 ) + { + vec3 lpos = ( u_viewMatrix * vec4( u_light0Pos, 1.0 ) ).xyz; + + #if ( LIGHT_0 == 0 ) + v_light0Dir = ( u_viewMatrix * vec4( -u_light0Dir, 0.0 ) ).xyz; + #else + v_light0Dir = lpos - v_mvPos; + #if ( LIGHT_0 == 2 ) + v_light0SpotDir = (u_viewMatrix * vec4( -u_light0Dir, 0.0 )).xyz; + #endif // ( LIGHT_0 == 2 ) + #endif // ( LIGHT_0 == 0 ) + } + #endif // defined( LIGHT_0 ) + #if defined( LIGHT_1 ) + { + vec3 lpos = ( u_viewMatrix * vec4( u_light1Pos, 1.0 ) ).xyz; + + #if ( LIGHT_1 == 0 ) + v_light1Dir = ( u_viewMatrix * vec4( -u_light1Dir, 0.0 ) ).xyz; + #else + v_light1Dir = lpos - v_mvPos; + #if ( LIGHT_1 == 2 ) + v_light1SpotDir = (u_viewMatrix * vec4( -u_light1Dir, 0.0 )).xyz; + #endif // ( LIGHT_1 == 2 ) + #endif // ( LIGHT_1 == 0 ) + } + #endif // defined( LIGHT_1 ) + #if defined( LIGHT_2 ) + { + vec3 lpos = ( u_viewMatrix * vec4( u_light2Pos, 1.0 ) ).xyz; + + #if ( LIGHT_2 == 0 ) + v_light2Dir = ( u_viewMatrix * vec4( -u_light2Dir, 0.0 ) ).xyz; + #else + v_light2Dir = lpos - v_mvPos; + #if ( LIGHT_2 == 2 ) + v_light2SpotDir = (u_viewMatrix * vec4( -u_light2Dir, 0.0 )).xyz; + #endif // ( LIGHT_2 == 2 ) + #endif // ( LIGHT_2 == 0 ) + } + #endif // defined( LIGHT_2 ) + #if defined( LIGHT_3 ) + { + vec3 lpos = ( u_viewMatrix * vec4( u_light3Pos, 1.0 ) ).xyz; + + #if ( LIGHT_3 == 0 ) + v_light3Dir = ( u_viewMatrix * vec4( -u_light3Dir, 0.0 ) ).xyz; + #else + v_light3Dir = lpos - v_mvPos; + #if ( LIGHT_3 == 2 ) + v_light3SpotDir = (u_viewMatrix * vec4( -u_light3Dir, 0.0 )).xyz; + #endif // ( LIGHT_3 == 2 ) + #endif // ( LIGHT_3 == 0 ) + } + #endif // defined( LIGHT_3 ) +#endif // defined( LIGHTING ) + + // pass along the geo + gl_Position = u_projMatrix * vec4(v_mvPos, 1.0); +} +#endif + -- cgit v1.2.3