Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added new bullet physics.

  • Loading branch information...
commit 110ed6bc189bb269e78006d799707de1d93e3e48 1 parent fd88d8b
@jwoertink authored
Showing with 15 additions and 7,605 deletions.
  1. +15 −23 lib/sample4.rb
  2. +0 −24 vendor/Common/MatDefs/Blur/HGaussianBlur.frag
  3. +0 −21 vendor/Common/MatDefs/Blur/HGaussianBlur.j3md
  4. +0 −47 vendor/Common/MatDefs/Blur/RadialBlur.frag
  5. +0 −36 vendor/Common/MatDefs/Blur/RadialBlur.j3md
  6. +0 −50 vendor/Common/MatDefs/Blur/RadialBlur15.frag
  7. +0 −25 vendor/Common/MatDefs/Blur/VGaussianBlur.frag
  8. +0 −21 vendor/Common/MatDefs/Blur/VGaussianBlur.j3md
  9. +0 −16 vendor/Common/MatDefs/Gui/Gui.frag
  10. +0 −26 vendor/Common/MatDefs/Gui/Gui.j3md
  11. +0 −29 vendor/Common/MatDefs/Gui/Gui.vert
  12. +0 −65 vendor/Common/MatDefs/Hdr/LogLum.frag
  13. +0 −31 vendor/Common/MatDefs/Hdr/LogLum.j3md
  14. +0 −31 vendor/Common/MatDefs/Hdr/ToneMap.frag
  15. +0 −23 vendor/Common/MatDefs/Hdr/ToneMap.j3md
  16. +0 −146 vendor/Common/MatDefs/Light/Deferred.frag
  17. +0 −61 vendor/Common/MatDefs/Light/Deferred.j3md
  18. +0 −10 vendor/Common/MatDefs/Light/Deferred.vert
  19. +0 −86 vendor/Common/MatDefs/Light/GBuf.frag
  20. +0 −71 vendor/Common/MatDefs/Light/GBuf.vert
  21. +0 −32 vendor/Common/MatDefs/Light/Glow.frag
  22. +0 −269 vendor/Common/MatDefs/Light/Lighting.frag
  23. +0 −238 vendor/Common/MatDefs/Light/Lighting.j3md
  24. +0 −206 vendor/Common/MatDefs/Light/Lighting.vert
  25. +0 −9 vendor/Common/MatDefs/Misc/ColoredTextured.frag
  26. +0 −20 vendor/Common/MatDefs/Misc/ColoredTextured.j3md
  27. +0 −11 vendor/Common/MatDefs/Misc/ColoredTextured.vert
  28. +0 −22 vendor/Common/MatDefs/Misc/Particle.frag
  29. +0 −89 vendor/Common/MatDefs/Misc/Particle.j3md
  30. +0 −42 vendor/Common/MatDefs/Misc/Particle.vert
  31. +0 −5 vendor/Common/MatDefs/Misc/ShowNormals.frag
  32. +0 −10 vendor/Common/MatDefs/Misc/ShowNormals.j3md
  33. +0 −11 vendor/Common/MatDefs/Misc/ShowNormals.vert
  34. +0 −27 vendor/Common/MatDefs/Misc/SimpleTextured.frag
  35. +0 −32 vendor/Common/MatDefs/Misc/SimpleTextured.j3md
  36. +0 −11 vendor/Common/MatDefs/Misc/SimpleTextured.vert
  37. +0 −11 vendor/Common/MatDefs/Misc/Sky.frag
  38. +0 −27 vendor/Common/MatDefs/Misc/Sky.j3md
  39. +0 −25 vendor/Common/MatDefs/Misc/Sky.vert
  40. +0 −44 vendor/Common/MatDefs/Misc/SolidColor.j3md
  41. +0 −50 vendor/Common/MatDefs/Misc/Unshaded.frag
  42. +0 −70 vendor/Common/MatDefs/Misc/Unshaded.j3md
  43. +0 −37 vendor/Common/MatDefs/Misc/Unshaded.vert
  44. +0 −18 vendor/Common/MatDefs/Misc/VertexColor.j3md
  45. +0 −38 vendor/Common/MatDefs/Misc/WireColor.j3md
  46. +0 −13 vendor/Common/MatDefs/Nifty/Nifty.frag
  47. +0 −21 vendor/Common/MatDefs/Nifty/Nifty.j3md
  48. +0 −16 vendor/Common/MatDefs/Nifty/Nifty.vert
  49. +0 −43 vendor/Common/MatDefs/Post/BloomExtract.j3md
  50. +0 −36 vendor/Common/MatDefs/Post/BloomFinal.j3md
  51. +0 −55 vendor/Common/MatDefs/Post/CartoonEdge.frag
  52. +0 −48 vendor/Common/MatDefs/Post/CartoonEdge.j3md
  53. +0 −57 vendor/Common/MatDefs/Post/CartoonEdge15.frag
  54. +0 −51 vendor/Common/MatDefs/Post/CrossHatch.frag
  55. +0 −41 vendor/Common/MatDefs/Post/CrossHatch.j3md
  56. +0 −53 vendor/Common/MatDefs/Post/CrossHatch15.frag
  57. +0 −89 vendor/Common/MatDefs/Post/DepthOfField.frag
  58. +0 −25 vendor/Common/MatDefs/Post/DepthOfField.j3md
  59. +0 −73 vendor/Common/MatDefs/Post/FXAA.frag
  60. +0 −20 vendor/Common/MatDefs/Post/FXAA.j3md
  61. +0 −15 vendor/Common/MatDefs/Post/FXAA.vert
  62. +0 −11 vendor/Common/MatDefs/Post/Fade.frag
  63. +0 −34 vendor/Common/MatDefs/Post/Fade.j3md
  64. +0 −11 vendor/Common/MatDefs/Post/Fade15.frag
  65. +0 −21 vendor/Common/MatDefs/Post/Fog.frag
  66. +0 −39 vendor/Common/MatDefs/Post/Fog.j3md
  67. +0 −24 vendor/Common/MatDefs/Post/Fog15.frag
  68. +0 −36 vendor/Common/MatDefs/Post/LightScattering.frag
  69. +0 −41 vendor/Common/MatDefs/Post/LightScattering.j3md
  70. +0 −14 vendor/Common/MatDefs/Post/LightScattering.vert
  71. +0 −39 vendor/Common/MatDefs/Post/LightScattering15.frag
  72. +0 −14 vendor/Common/MatDefs/Post/LightScattering15.vert
  73. +0 −9 vendor/Common/MatDefs/Post/Overlay.frag
  74. +0 −36 vendor/Common/MatDefs/Post/Overlay.j3md
  75. +0 −11 vendor/Common/MatDefs/Post/Overlay15.frag
  76. +0 −10 vendor/Common/MatDefs/Post/Post.vert
  77. +0 −12 vendor/Common/MatDefs/Post/Post15.vert
  78. +0 −18 vendor/Common/MatDefs/Post/Posterization.frag
  79. +0 −32 vendor/Common/MatDefs/Post/Posterization.j3md
  80. +0 −20 vendor/Common/MatDefs/Post/Posterization15.frag
  81. +0 −29 vendor/Common/MatDefs/Post/bloomExtract.frag
  82. +0 −33 vendor/Common/MatDefs/Post/bloomExtract15.frag
  83. +0 −12 vendor/Common/MatDefs/Post/bloomFinal.frag
  84. +0 −15 vendor/Common/MatDefs/Post/bloomFinal15.frag
  85. BIN  vendor/Common/MatDefs/SSAO/Textures/random.png
  86. +0 −21 vendor/Common/MatDefs/SSAO/normal.frag
  87. +0 −16 vendor/Common/MatDefs/SSAO/normal.vert
  88. +0 −104 vendor/Common/MatDefs/SSAO/ssao.frag
  89. +0 −51 vendor/Common/MatDefs/SSAO/ssao.j3md
  90. +0 −96 vendor/Common/MatDefs/SSAO/ssao15.frag
  91. +0 −159 vendor/Common/MatDefs/SSAO/ssaoBlur.frag
  92. +0 −57 vendor/Common/MatDefs/SSAO/ssaoBlur.j3md
  93. +0 −160 vendor/Common/MatDefs/SSAO/ssaoBlur15.frag
  94. +0 −12 vendor/Common/MatDefs/Shadow/PostShadow.frag
  95. +0 −26 vendor/Common/MatDefs/Shadow/PostShadow.j3md
  96. +0 −31 vendor/Common/MatDefs/Shadow/PostShadow.vert
  97. +0 −119 vendor/Common/MatDefs/Shadow/PostShadowPSSM.frag
  98. +0 −63 vendor/Common/MatDefs/Shadow/PostShadowPSSM.j3md
  99. +0 −37 vendor/Common/MatDefs/Shadow/PostShadowPSSM.vert
  100. +0 −139 vendor/Common/MatDefs/Shadow/PostShadowPSSM15.frag
  101. +0 −15 vendor/Common/MatDefs/Shadow/PreShadow.frag
  102. +0 −19 vendor/Common/MatDefs/Shadow/PreShadow.j3md
  103. +0 −12 vendor/Common/MatDefs/Shadow/PreShadow.vert
  104. +0 −76 vendor/Common/MatDefs/Terrain/HeightBasedTerrain.frag
  105. +0 −41 vendor/Common/MatDefs/Terrain/HeightBasedTerrain.j3md
  106. +0 −22 vendor/Common/MatDefs/Terrain/HeightBasedTerrain.vert
  107. +0 −63 vendor/Common/MatDefs/Terrain/Terrain.frag
  108. +0 −33 vendor/Common/MatDefs/Terrain/Terrain.j3md
  109. +0 −23 vendor/Common/MatDefs/Terrain/Terrain.vert
  110. +0 −700 vendor/Common/MatDefs/Terrain/TerrainLighting.frag
  111. +0 −253 vendor/Common/MatDefs/Terrain/TerrainLighting.j3md
  112. +0 −107 vendor/Common/MatDefs/Terrain/TerrainLighting.vert
  113. +0 −34 vendor/Common/MatDefs/Water/SimpleWater.j3md
  114. BIN  vendor/Common/MatDefs/Water/Textures/caustics.jpg
  115. BIN  vendor/Common/MatDefs/Water/Textures/dudv_map.jpg
  116. BIN  vendor/Common/MatDefs/Water/Textures/foam.jpg
  117. BIN  vendor/Common/MatDefs/Water/Textures/foam2.jpg
  118. BIN  vendor/Common/MatDefs/Water/Textures/foam3.jpg
  119. BIN  vendor/Common/MatDefs/Water/Textures/heightmap.jpg
  120. BIN  vendor/Common/MatDefs/Water/Textures/water_normalmap.dds
  121. +0 −402 vendor/Common/MatDefs/Water/Water.frag
  122. +0 −90 vendor/Common/MatDefs/Water/Water.j3md
  123. +0 −419 vendor/Common/MatDefs/Water/Water15.frag
  124. +0 −125 vendor/Common/MatDefs/Water/simple_water.frag
  125. +0 −87 vendor/Common/MatDefs/Water/simple_water.vert
  126. +0 −5 vendor/Common/Materials/RedColor.j3m
  127. +0 −5 vendor/Common/Materials/VertexColor.j3m
  128. +0 −5 vendor/Common/Materials/WhiteColor.j3m
  129. +0 −44 vendor/Common/ShaderLib/Bump.glsllib
  130. +0 −13 vendor/Common/ShaderLib/Common.glsllib
  131. +0 −41 vendor/Common/ShaderLib/Fog.glsllib
  132. +0 −65 vendor/Common/ShaderLib/Hdr.glsllib
  133. +0 −48 vendor/Common/ShaderLib/Lighting.glsllib
  134. +0 −4 vendor/Common/ShaderLib/Math.glsllib
  135. +0 −62 vendor/Common/ShaderLib/MultiSample.glsllib
  136. +0 −32 vendor/Common/ShaderLib/Optics.glsllib
  137. +0 −78 vendor/Common/ShaderLib/Parallax.glsllib
  138. +0 −105 vendor/Common/ShaderLib/Shadow.glsllib
  139. +0 −36 vendor/Common/ShaderLib/Skinning.glsllib
  140. +0 −10 vendor/Common/ShaderLib/Splatting.glsllib
  141. +0 −11 vendor/Common/ShaderLib/Tangent.glsllib
  142. +0 −41 vendor/Common/ShaderLib/Texture.glsllib
  143. +0 −15 vendor/Common/ShaderLib/Ubo.glsllib
  144. BIN  vendor/lib/jME3-bullet-natives.jar
  145. BIN  vendor/lib/jME3-bullet.jar
  146. BIN  vendor/lib/jME3-jbullet.jar
View
38 lib/sample4.rb
@@ -14,6 +14,7 @@
class Sample4 < SimpleApplication
def initialize
+ @root_node = root_node
@is_running = true
end
@@ -37,37 +38,28 @@ def initKeys
input_manager.add_listener(analog_listener, ["Left", "Right", "Rotate"].to_java(:string))
end
- # def action_listener
- # Class.new {
- # include ActionListener
- # def on_action(name, key_pressed, time_per_frame)
- # if name.eql?("Pause") && !key_pressed
- # @is_running = !@is_running
- # end
- # end
- # }.new
- # end
- #
- # def action_listener
- # ActionListener.new {
- # def on_action(name, key_pressed, time_per_frame)
- # @is_running = !@is_running if name.eql?("Pause") && !key_pressed
- # end
- # }
- # end
-
- def action_listener
- ActionListener.impl {
+ def action_listener
+ Class.new {
+ include ActionListener
def on_action(name, key_pressed, time_per_frame)
- @is_running = !@is_running if name.eql?("Pause") && !key_pressed
+ if name.eql?("Pause") && !key_pressed
+ @is_running = !@is_running
+ end
end
- }
+ }.new
end
def analog_listener
Class.new {
include AnalogListener
+
+ def initialize
+ @player = @root_node.get_child("Player")
+ end
+
def on_analog(name, value, time_per_frame)
+ puts "running analog #{name}"
+ puts "player: #{@player.inspect}"
if @is_running
case name
when "Rotate"
View
24 vendor/Common/MatDefs/Blur/HGaussianBlur.frag
@@ -1,24 +0,0 @@
-uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
-uniform float m_Size;
-uniform float m_Scale;
-
-varying vec2 texCoord;
-
-void main(){
- float blurSize = m_Scale/m_Size;
- vec4 sum = vec4(0.0);
-
- // blur in x (vertical)
- // take nine samples, with the distance blurSize between them
- sum += texture2D(m_Texture, vec2(texCoord.x- 4.0*blurSize, texCoord.y )) * 0.05;
- sum += texture2D(m_Texture, vec2(texCoord.x- 3.0*blurSize, texCoord.y )) * 0.09;
- sum += texture2D(m_Texture, vec2(texCoord.x - 2.0*blurSize, texCoord.y)) * 0.12;
- sum += texture2D(m_Texture, vec2(texCoord.x- blurSize, texCoord.y )) * 0.15;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y)) * 0.16;
- sum += texture2D(m_Texture, vec2(texCoord.x+ blurSize, texCoord.y )) * 0.15;
- sum += texture2D(m_Texture, vec2(texCoord.x+ 2.0*blurSize, texCoord.y )) * 0.12;
- sum += texture2D(m_Texture, vec2(texCoord.x+ 3.0*blurSize, texCoord.y )) * 0.09;
- sum += texture2D(m_Texture, vec2(texCoord.x+ 4.0*blurSize, texCoord.y )) * 0.05;
-
- gl_FragColor = sum;
-}
View
21 vendor/Common/MatDefs/Blur/HGaussianBlur.j3md
@@ -1,21 +0,0 @@
-MaterialDef Bloom {
-
- MaterialParameters {
- Int NumSamples
- Texture2D Texture
- Float Size
- Float Scale
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Post/Post.vert
- FragmentShader GLSL100: Common/MatDefs/Blur/HGaussianBlur.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-
- Technique FixedFunc {
- }
-}
View
47 vendor/Common/MatDefs/Blur/RadialBlur.frag
@@ -1,47 +0,0 @@
-uniform sampler2D m_Texture;
-uniform float m_SampleDist;
-uniform float m_SampleStrength;
-uniform float m_Samples[10];
-varying vec2 texCoord;
-
-void main(void)
-{
- // some sample positions
- //float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);
-
- // 0.5,0.5 is the center of the screen
- // so substracting texCoord from it will result in
- // a vector pointing to the middle of the screen
- vec2 dir = 0.5 - texCoord;
-
- // calculate the distance to the center of the screen
- float dist = sqrt(dir.x*dir.x + dir.y*dir.y);
-
- // normalize the direction (reuse the distance)
- dir = dir/dist;
-
- // this is the original colour of this fragment
- // using only this would result in a nonblurred version
- vec4 colorRes = texture2D(m_Texture,texCoord);
-
- vec4 sum = colorRes;
-
- // take 10 additional blur samples in the direction towards
- // the center of the screen
- for (int i = 0; i < 10; i++)
- {
- sum += texture2D( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
- }
-
- // we have taken eleven samples
- sum *= 1.0/11.0;
-
- // weighten the blur effect with the distance to the
- // center of the screen ( further out is blurred more)
- float t = dist * m_SampleStrength;
- t = clamp( t ,0.0,1.0); //0 &lt;= t &lt;= 1
-
- //Blend the original color with the averaged pixels
- gl_FragColor =mix( colorRes, sum, t );
-
-}
View
36 vendor/Common/MatDefs/Blur/RadialBlur.j3md
@@ -1,36 +0,0 @@
-MaterialDef Radial Blur {
-
- MaterialParameters {
- Int NumSamples
- Texture2D Texture
- Color Color
- Float SampleDist
- Float SampleStrength
- FloatArray Samples
- }
-
- Technique {
- VertexShader GLSL150: Common/MatDefs/Post/Post15.vert
- FragmentShader GLSL150: Common/MatDefs/Blur/RadialBlur15.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- RESOLVE_MS : NumSamples
- }
- }
-
- Technique {
- VertexShader GLSL120: Common/MatDefs/Post/Post.vert
- FragmentShader GLSL120: Common/MatDefs/Blur/RadialBlur.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-
- Technique FixedFunc {
- }
-}
View
50 vendor/Common/MatDefs/Blur/RadialBlur15.frag
@@ -1,50 +0,0 @@
-#import "Common/ShaderLib/MultiSample.glsllib"
-
-uniform COLORTEXTURE m_Texture;
-uniform float m_SampleDist;
-uniform float m_SampleStrength;
-uniform float m_Samples[10];
-
-in vec2 texCoord;
-out vec4 outFragColor;
-
-void main(void)
-{
- // some sample positions
- //float samples[10] = float[](-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08);
-
- // 0.5,0.5 is the center of the screen
- // so substracting texCoord from it will result in
- // a vector pointing to the middle of the screen
- vec2 dir = 0.5 - texCoord;
-
- // calculate the distance to the center of the screen
- float dist = sqrt(dir.x*dir.x + dir.y*dir.y);
-
- // normalize the direction (reuse the distance)
- dir = dir/dist;
-
- // this is the original colour of this fragment
- // using only this would result in a nonblurred version
- vec4 colorRes = getColor(m_Texture,texCoord);
-
- vec4 sum = colorRes;
-
- // take 10 additional blur samples in the direction towards
- // the center of the screen
- for (int i = 0; i < 10; i++){
- sum += getColor( m_Texture, texCoord + dir * m_Samples[i] * m_SampleDist );
- }
-
- // we have taken eleven samples
- sum *= 1.0/11.0;
-
- // weighten the blur effect with the distance to the
- // center of the screen ( further out is blurred more)
- float t = dist * m_SampleStrength;
- t = clamp( t ,0.0,1.0); //0 &lt;= t &lt;= 1
-
- //Blend the original color with the averaged pixels
- outFragColor =mix( colorRes, sum, t );
-
-}
View
25 vendor/Common/MatDefs/Blur/VGaussianBlur.frag
@@ -1,25 +0,0 @@
-uniform sampler2D m_Texture; // this should hold the texture rendered by the horizontal blur pass
-uniform float m_Size;
-uniform float m_Scale;
-varying vec2 texCoord;
-
-
-
-void main(void)
-{ float blurSize = m_Scale/m_Size;
- vec4 sum = vec4(0.0);
-
- // blur in y (vertical)
- // take nine samples, with the distance blurSize between them
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 4.0*blurSize)) * 0.05;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 3.0*blurSize)) * 0.09;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - 2.0*blurSize)) * 0.12;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y - blurSize)) * 0.15;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y)) * 0.16;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + blurSize)) * 0.15;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 2.0*blurSize)) * 0.12;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 3.0*blurSize)) * 0.09;
- sum += texture2D(m_Texture, vec2(texCoord.x, texCoord.y + 4.0*blurSize)) * 0.05;
-
- gl_FragColor = sum;
-}
View
21 vendor/Common/MatDefs/Blur/VGaussianBlur.j3md
@@ -1,21 +0,0 @@
-MaterialDef Bloom {
-
- MaterialParameters {
- Int NumSamples
- Texture2D Texture
- Float Size
- Float Scale
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Post/Post.vert
- FragmentShader GLSL100: Common/MatDefs/Blur/VGaussianBlur.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-
- Technique FixedFunc {
- }
-}
View
16 vendor/Common/MatDefs/Gui/Gui.frag
@@ -1,16 +0,0 @@
-#ifdef TEXTURE
-uniform sampler2D m_Texture;
-varying vec2 texCoord;
-#endif
-
-varying vec4 color;
-
-void main() {
- #ifdef TEXTURE
- vec4 texVal = texture2D(m_Texture, texCoord);
- gl_FragColor = texVal * color;
- #else
- gl_FragColor = color;
- #endif
-}
-
View
26 vendor/Common/MatDefs/Gui/Gui.j3md
@@ -1,26 +0,0 @@
-MaterialDef Default GUI {
-
- MaterialParameters {
- Texture2D Texture
- Color Color ( Color )
- Boolean VertexColor
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Gui/Gui.vert
- FragmentShader GLSL100: Common/MatDefs/Gui/Gui.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- TEXTURE : Texture
- VERTEX_COLOR : VertexColor
- }
- }
-
- Technique FixedFunc {
- }
-
-}
View
29 vendor/Common/MatDefs/Gui/Gui.vert
@@ -1,29 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-uniform vec4 m_Color;
-
-attribute vec3 inPosition;
-
-#ifdef VERTEX_COLOR
-attribute vec4 inColor;
-#endif
-
-#ifdef TEXTURE
-attribute vec2 inTexCoord;
-varying vec2 texCoord;
-#endif
-
-varying vec4 color;
-
-void main() {
- //vec2 pos = (g_WorldViewProjectionMatrix * inPosition).xy;
- //gl_Position = vec4(pos, 0.0, 1.0);
- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
- #ifdef TEXTURE
- texCoord = inTexCoord;
- #endif
- #ifdef VERTEX_COLOR
- color = m_Color * inColor;
- #else
- color = m_Color;
- #endif
-}
View
65 vendor/Common/MatDefs/Hdr/LogLum.frag
@@ -1,65 +0,0 @@
-#import "Common/ShaderLib/Hdr.glsllib"
-
-uniform sampler2D m_Texture;
-varying vec2 texCoord;
-
-#ifdef BLOCKS
- uniform vec2 m_PixelSize;
- uniform vec2 m_BlockSize;
- uniform float m_NumPixels;
-#endif
-
-vec4 blocks(vec2 halfBlockSize, vec2 pixelSize, float numPixels){
- vec2 startUV = texCoord - halfBlockSize;
- vec2 endUV = texCoord + halfBlockSize;
-
- vec4 sum = vec4(0.0);
- float numPix = 0.0;
- //float maxLum = 0.0;
-
- for (float x = startUV.x; x < endUV.x; x += pixelSize.x){
- for (float y = startUV.y; y < endUV.y; y += pixelSize.y){
- numPix += 1.0;
- vec4 color = texture2D(m_Texture, vec2(x,y));
-
- #ifdef ENCODE_LUM
- color = HDR_EncodeLum(HDR_GetLum(color.rgb));
- #endif
- //#ifdef COMPUTE_MAX
- //maxLum = max(color.r, maxLum);
- //#endif
- sum += color;
- }
- }
- sum /= numPix;
-
- #ifdef DECODE_LUM
- sum = vec4(HDR_DecodeLum(sum));
- //#ifdef COMPUTE_MAX
- //maxLum = HDR_GetExpLum(maxLum);
- //#endif
- #endif
-
- return sum;
-}
-
-vec4 fetch(){
- vec4 color = texture2D(m_Texture, texCoord);
- #ifdef ENCODE_LUM
- return HDR_EncodeLum(HDR_GetLum(color.rgb));
- #elif defined DECODE_LUM
- return vec4(HDR_DecodeLum(color));
- #else
- return color;
- #endif
-}
-
-void main() {
- #ifdef BLOCKS
- gl_FragColor = blocks(m_BlockSize * vec2(0.5), m_PixelSize, m_NumPixels);
- #else
- gl_FragColor = vec4(fetch());
- #endif
-}
-
-
View
31 vendor/Common/MatDefs/Hdr/LogLum.j3md
@@ -1,31 +0,0 @@
-MaterialDef Log Lum 2D {
-
- MaterialParameters {
- Texture2D Texture
- Vector2 BlockSize
- Vector2 PixelSize
- Float NumPixels
- Boolean DecodeLum
- Boolean EncodeLum
- Boolean Blocks
- Boolean ComputeMax
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Gui/Gui.vert
- FragmentShader GLSL100: Common/MatDefs/Hdr/LogLum.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- TEXTURE
- ENCODE_LUM : EncodeLum
- DECODE_LUM : DecodeLum
- BLOCKS : Blocks
- COMPUTE_MAX : ComputeMax
- }
- }
-
-}
View
31 vendor/Common/MatDefs/Hdr/ToneMap.frag
@@ -1,31 +0,0 @@
-#import "Common/ShaderLib/Hdr.glsllib"
-
-varying vec2 texCoord;
-
-uniform sampler2D m_Texture;
-uniform sampler2D m_Lum;
-uniform sampler2D m_Lum2;
-
-uniform float m_A;
-uniform float m_White;
-uniform float m_BlendFactor;
-uniform float m_Gamma;
-
-void main() {
- float avgLumA = HDR_DecodeLum( texture2D(m_Lum, vec2(0.0)) );
- float avgLumB = HDR_DecodeLum( texture2D(m_Lum2, vec2(0.0)) );
- float lerpedLum = mix(avgLumA, avgLumB, m_BlendFactor);
-
- vec4 color = texture2D(m_Texture, texCoord);
- vec3 c1 = HDR_ToneMap(color.rgb, lerpedLum, m_A, m_White);
- //vec3 c2 = HDR_ToneMap2(color.rgb, lerpedLum, m_A * vec2(0.25), m_White);
-
- //float l1 = HDR_GetLuminance(c1);
- //float l2 = HDR_GetLuminance(c2);
-
- //vec3 final = mix(c2, c1, clamp(l1, 0.0, 1.0));
-
- //tonedColor = pow(tonedColor, vec3(m_Gamma));
- gl_FragColor = vec4(c1, color.a);
-}
-
View
23 vendor/Common/MatDefs/Hdr/ToneMap.j3md
@@ -1,23 +0,0 @@
-MaterialDef Tone Mapper {
- MaterialParameters {
- Texture2D Texture
- Texture2D Lum
- Texture2D Lum2
- Float BlendFactor
- Float White
- Float A
- Float Gamma
- }
- Technique {
- VertexShader GLSL100: Common/MatDefs/Gui/Gui.vert
- FragmentShader GLSL100: Common/MatDefs/Hdr/ToneMap.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- TEXTURE
- }
- }
-}
View
146 vendor/Common/MatDefs/Light/Deferred.frag
@@ -1,146 +0,0 @@
-#define ATTENUATION
-//#define HQ_ATTENUATION
-
-varying vec2 texCoord;
-
-uniform sampler2D m_DiffuseData;
-uniform sampler2D m_SpecularData;
-uniform sampler2D m_NormalData;
-uniform sampler2D m_DepthData;
-
-uniform vec3 m_FrustumCorner;
-uniform vec2 m_FrustumNearFar;
-
-uniform vec4 g_LightColor;
-uniform vec4 g_LightPosition;
-uniform vec3 g_CameraPosition;
-
-uniform mat4 m_ViewProjectionMatrixInverse;
-
-#ifdef COLORRAMP
- uniform sampler2D m_ColorRamp;
-#endif
-
-float lightComputeDiffuse(in vec3 norm, in vec3 lightdir, in vec3 viewdir){
- #ifdef MINNAERT
- float NdotL = max(0.0, dot(norm, lightdir));
- float NdotV = max(0.0, dot(norm, viewdir));
- return NdotL * pow(max(NdotL * NdotV, 0.1), -1.0) * 0.5;
- #else
- return max(0.0, dot(norm, lightdir));
- #endif
-}
-
-float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
-//#ifdef LOW_QUALITY
- // Blinn-Phong
- // Note: preferably, H should be computed in the vertex shader
- vec3 H = (viewdir + lightdir) * vec3(0.5);
- return pow(max(dot(H, norm), 0.0), shiny);
-/*
- #elif defined(WARDISO)
- // Isotropic Ward
- vec3 halfVec = normalize(viewdir + lightdir);
- float NdotH = max(0.001, tangDot(norm, halfVec));
- float NdotV = max(0.001, tangDot(norm, viewdir));
- float NdotL = max(0.001, tangDot(norm, lightdir));
- float a = tan(acos(NdotH));
- float p = max(shiny/128.0, 0.001);
- return NdotL * (1.0 / (4.0*3.14159265*p*p)) * (exp(-(a*a)/(p*p)) / (sqrt(NdotV * NdotL)));
- #else
- // Standard Phong
- vec3 R = reflect(-lightdir, norm);
- return pow(max(tangDot(R, viewdir), 0.0), shiny);
- #endif
-*/
-}
-
-vec2 computeLighting(in vec3 wvPos, in vec3 wvNorm, in vec3 wvViewDir, in vec4 wvLightDir, in float shiny){
- float diffuseFactor = lightComputeDiffuse(wvNorm, wvLightDir.xyz, wvViewDir);
- float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, wvLightDir.xyz, shiny);
- return vec2(diffuseFactor, specularFactor) * vec2(wvLightDir.w);
-}
-
-vec3 decodeNormal(in vec4 enc){
- vec4 nn = enc * vec4(2.0,2.0,0.0,0.0) + vec4(-1.0,-1.0,1.0,-1.0);
- float l = dot(nn.xyz, -nn.xyw);
- nn.z = l;
- nn.xy *= sqrt(l);
- return nn.xyz * vec3(2.0) + vec3(0.0,0.0,-1.0);
-}
-
-vec3 getPosition(in vec2 newTexCoord){
- //Reconstruction from depth
- float depth = texture2D(m_DepthData, newTexCoord).r;
- //if (depth == 1.0)
- // return vec3(0.0, 0.0, 2.0);
- //depth = (2.0 * m_FrustumNearFar.x)
- /// (m_FrustumNearFar.y + m_FrustumNearFar.x - depth * (m_FrustumNearFar.y-m_FrustumNearFar.x));
-
- //one frustum corner method
- //float x = mix(-m_FrustumCorner.x, m_FrustumCorner.x, newTexCoord.x);
- //float y = mix(-m_FrustumCorner.y, m_FrustumCorner.y, newTexCoord.y);
-
- //return depth * vec3(x, y, m_FrustumCorner.z);
- vec4 pos;
- pos.xy = (newTexCoord * vec2(2.0)) - vec2(1.0);
- pos.z = depth;
- pos.w = 1.0;
- pos = m_ViewProjectionMatrixInverse * pos;
- //pos /= pos.w;
- return pos.xyz;
-}
-
-// JME3 lights in world space
-void lightComputeDir(in vec3 worldPos, in vec4 color, in vec4 position, out vec4 lightDir){
- #ifdef DIR_LIGHT
- lightDir.xyz = -position.xyz;
- #else
- lightDir.xyz = position.xyz - worldPos.xyz;
- float dist = length(lightDir.xyz);
- lightDir.w = clamp(1.0 - position.w * dist, 0.0, 1.0);
- lightDir.xyz /= dist;
- #endif
-
-/*
- float posLight = step(0.5, color.w);
- vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight);
- #ifdef ATTENUATION
- float dist = length(tempVec);
- lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0);
- lightDir.xyz = tempVec / vec3(dist);
- #ifdef HQ_ATTENUATION
- lightVec = tempVec;
- #endif
- #else
- lightDir = vec4(normalize(tempVec), 1.0);
- #endif
-*/
-}
-
-void main(){
- vec2 newTexCoord = texCoord;
- vec4 diffuseColor = texture2D(m_DiffuseData, newTexCoord);
- if (diffuseColor.a == 0.0)
- discard;
-
- vec4 specularColor = texture2D(m_SpecularData, newTexCoord);
- vec3 worldPosition = getPosition(newTexCoord);
- vec3 viewDir = normalize(g_CameraPosition - worldPosition);
-
- vec4 normalInfo = vec4(texture2D(m_NormalData, newTexCoord).rg, 0.0, 0.0);
- vec3 normal = decodeNormal(normalInfo);
-
- vec4 lightDir;
- lightComputeDir(worldPosition, g_LightColor, g_LightPosition, lightDir);
-
- vec2 light = computeLighting(worldPosition, normal, viewDir, lightDir, specularColor.w*128.0);
-
- #ifdef COLORRAMP
- diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
- specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
- #endif
-
- gl_FragColor = vec4(light.x * diffuseColor.xyz + light.y * specularColor.xyz, 1.0);
- gl_FragColor.xyz *= g_LightColor.xyz;
-}
View
61 vendor/Common/MatDefs/Light/Deferred.j3md
@@ -1,61 +0,0 @@
-MaterialDef Phong Lighting Deferred {
-
- MaterialParameters {
-
- // Use more efficent algorithms to improve performance
- Boolean LowQuality
-
- // Improve quality at the cost of performance
- Boolean HighQuality
-
- // Activate shading along the tangent, instead of the normal
- // Requires tangent data to be available on the model.
- Boolean VTangent
-
- // Use minnaert diffuse instead of lambert
- Boolean Minnaert
-
- // Use ward specular instead of phong
- Boolean WardIso
-
- Texture2D DiffuseData
- Texture2D SpecularData
- Texture2D NormalData
- Texture2D DepthData
-
- Vector3 FrustumCorner
- Vector2 FrustumNearFar
- Matrix4 ViewProjectionMatrixInverse
-
- // Color ramp, will map diffuse and specular values through it.
- Texture2D ColorRamp
- }
-
- Technique {
- LightMode MultiPass
-
- VertexShader GLSL100: Common/MatDefs/Light/Deferred.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Deferred.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- ViewMatrix
- CameraPosition
- }
-
- Defines {
- ATTENUATION : Attenuation
- V_TANGENT : VTangent
- MINNAERT : Minnaert
- WARDISO : WardIso
- LOW_QUALITY : LowQuality
- HQ_ATTENUATION : HighQuality
- COLORRAMP : ColorRamp
- }
- }
-
- Technique FixedFunc {
- }
-
-}
View
10 vendor/Common/MatDefs/Light/Deferred.vert
@@ -1,10 +0,0 @@
-varying vec2 texCoord;
-
-attribute vec3 inPosition;
-attribute vec2 inTexCoord;
-
-void main(){
- texCoord = inTexCoord;
- vec4 pos = vec4(inPosition, 1.0);
- gl_Position = vec4(sign(pos.xy-vec2(0.5)), 0.0, 1.0);
-}
View
86 vendor/Common/MatDefs/Light/GBuf.frag
@@ -1,86 +0,0 @@
-#import "Common/ShaderLib/Optics.glsllib"
-
-uniform float m_Shininess;
-
-varying vec2 texCoord;
-varying vec4 AmbientSum;
-varying vec4 DiffuseSum;
-varying vec4 SpecularSum;
-
-varying float vDepth;
-varying vec3 vNormal;
-
-#ifdef DIFFUSEMAP
- uniform sampler2D m_DiffuseMap;
-#endif
-
-#ifdef SPECULARMAP
- uniform sampler2D m_SpecularMap;
-#endif
-
-#ifdef PARALLAXMAP
- uniform sampler2D m_ParallaxMap;
-#endif
-
-#ifdef NORMALMAP
- uniform sampler2D m_NormalMap;
- varying mat3 tbnMat;
-#endif
-
-vec2 encodeNormal(in vec3 n){
- vec2 enc = normalize(n.xy) * (sqrt(-n.z*0.5+0.5));
- enc = enc*vec2(0.5)+vec2(0.5);
- return enc;
-}
-
-void main(){
- vec2 newTexCoord = texCoord;
- float height = 0.0;
- #if defined(PARALLAXMAP) || defined(NORMALMAP_PARALLAX)
- #ifdef PARALLAXMAP
- height = texture2D(m_ParallaxMap, texCoord).r;
- #else
- height = texture2D(m_NormalMap, texCoord).a;
- #endif
- float heightScale = 0.05;
- float heightBias = heightScale * -0.5;
- height = (height * heightScale + heightBias);
- #endif
-
-
- // ***********************
- // Read from textures
- // ***********************
- #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING)
- vec4 normalHeight = texture2D(m_NormalMap, newTexCoord);
- vec3 normal = (normalHeight.xyz * vec3(2.0) - vec3(1.0));
- normal.y = -normal.y;
-
- normal = tbnMat * normal;
- #else
- vec3 normal = vNormal;
- #if !defined(LOW_QUALITY) && !defined(V_TANGENT)
- normal = normalize(normal);
- #endif
- #endif
-
- #ifdef DIFFUSEMAP
- vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord);
- #else
- vec4 diffuseColor = vec4(1.0);
- #endif
-
- #ifdef SPECULARMAP
- vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
- #else
- vec4 specularColor = vec4(1.0);
- #endif
-
- diffuseColor.rgb *= DiffuseSum.rgb;
- specularColor.rgb *= SpecularSum.rgb;
-
- gl_FragData[0] = vec4(diffuseColor.rgb, 1.0);
- gl_FragData[1] = vec4(encodeNormal(normal), 0.0, 0.0);
- /*encodeNormal(vNormal));*/
- gl_FragData[2] = vec4(specularColor.rgb, m_Shininess / 128.0);
-}
View
71 vendor/Common/MatDefs/Light/GBuf.vert
@@ -1,71 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-uniform mat4 g_WorldMatrix;
-
-uniform vec4 m_Ambient;
-uniform vec4 m_Diffuse;
-uniform vec4 m_Specular;
-uniform float m_Shininess;
-
-varying vec2 texCoord;
-
-varying vec4 AmbientSum;
-varying vec4 DiffuseSum;
-varying vec4 SpecularSum;
-
-attribute vec3 inPosition;
-attribute vec2 inTexCoord;
-attribute vec3 inNormal;
-
-#ifdef NORMALMAP
-attribute vec3 inTangent;
-varying mat3 tbnMat;
-#endif
-
-#ifdef VERTEX_COLOR
- attribute vec4 inColor;
-#endif
-
-varying vec3 vNormal;
-varying float vDepth;
-
-void main(){
- vec4 pos = vec4(inPosition, 1.0);
- gl_Position = g_WorldViewProjectionMatrix * pos;
- texCoord = inTexCoord;
-
- #if defined(NORMALMAP)
- vec4 wvNormal, wvTangent, wvBinormal;
-
- wvNormal = vec4(inNormal, 0.0);
- wvTangent = vec4(inTangent, 0.0);
-
- wvNormal.xyz = normalize( (g_WorldMatrix * wvNormal).xyz );
- wvTangent.xyz = normalize( (g_WorldMatrix * wvTangent).xyz );
- wvBinormal.xyz = cross(wvNormal.xyz, wvTangent.xyz);
- tbnMat = mat3(wvTangent.xyz, wvBinormal.xyz, wvNormal.xyz);
-
- vNormal = wvNormal.xyz;
- #else
- vec4 wvNormal;
- #ifdef V_TANGENT
- wvNormal = vec4(inTangent, 0.0);
- #else
- wvNormal = vec4(inNormal, 0.0);
- #endif
- vNormal = normalize( (g_WorldMatrix * wvNormal).xyz );
- #endif
-
- #ifdef MATERIAL_COLORS
- AmbientSum = m_Ambient;
- DiffuseSum = m_Diffuse;
- SpecularSum = m_Specular;
- #else
- AmbientSum = vec4(0.0);
- DiffuseSum = vec4(1.0);
- SpecularSum = vec4(1.0);
- #endif
-
- #ifdef VERTEX_COLOR
- DiffuseSum *= inColor;
- #endif
-}
View
32 vendor/Common/MatDefs/Light/Glow.frag
@@ -1,32 +0,0 @@
-
-#if defined(NEED_TEXCOORD1)
- varying vec2 texCoord1;
-#else
- varying vec2 texCoord;
-#endif
-
-
-#ifdef HAS_GLOWMAP
- uniform sampler2D m_GlowMap;
-#endif
-
-#ifdef HAS_GLOWCOLOR
- uniform vec4 m_GlowColor;
-#endif
-
-
-void main(){
- #ifdef HAS_GLOWMAP
- #if defined(NEED_TEXCOORD1)
- gl_FragColor = texture2D(m_GlowMap, texCoord1);
- #else
- gl_FragColor = texture2D(m_GlowMap, texCoord);
- #endif
- #else
- #ifdef HAS_GLOWCOLOR
- gl_FragColor = m_GlowColor;
- #else
- gl_FragColor = vec4(0.0);
- #endif
- #endif
-}
View
269 vendor/Common/MatDefs/Light/Lighting.frag
@@ -1,269 +0,0 @@
-#import "Common/ShaderLib/Parallax.glsllib"
-#import "Common/ShaderLib/Optics.glsllib"
-#define ATTENUATION
-//#define HQ_ATTENUATION
-
-varying vec2 texCoord;
-#ifdef SEPARATE_TEXCOORD
- varying vec2 texCoord2;
-#endif
-
-varying vec3 AmbientSum;
-varying vec4 DiffuseSum;
-varying vec3 SpecularSum;
-
-#ifndef VERTEX_LIGHTING
- uniform vec4 g_LightDirection;
- varying vec3 vPosition;
- varying vec3 vViewDir;
- varying vec4 vLightDir;
- varying vec3 lightVec;
-#else
- varying vec2 vertexLightValues;
-#endif
-
-#ifdef DIFFUSEMAP
- uniform sampler2D m_DiffuseMap;
-#endif
-
-#ifdef SPECULARMAP
- uniform sampler2D m_SpecularMap;
-#endif
-
-#ifdef PARALLAXMAP
- uniform sampler2D m_ParallaxMap;
-#endif
-#if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
- uniform float m_ParallaxHeight;
-#endif
-
-#ifdef LIGHTMAP
- uniform sampler2D m_LightMap;
-#endif
-
-#ifdef NORMALMAP
- uniform sampler2D m_NormalMap;
-#else
- varying vec3 vNormal;
-#endif
-
-#ifdef ALPHAMAP
- uniform sampler2D m_AlphaMap;
-#endif
-
-#ifdef COLORRAMP
- uniform sampler2D m_ColorRamp;
-#endif
-
-uniform float m_AlphaDiscardThreshold;
-
-#ifndef VERTEX_LIGHTING
-uniform float m_Shininess;
-
-#ifdef HQ_ATTENUATION
-uniform vec4 g_LightPosition;
-#endif
-
-#ifdef USE_REFLECTION
- uniform float m_ReflectionPower;
- uniform float m_ReflectionIntensity;
- varying vec4 refVec;
-
- uniform ENVMAP m_EnvMap;
-#endif
-
-float tangDot(in vec3 v1, in vec3 v2){
- float d = dot(v1,v2);
- #ifdef V_TANGENT
- d = 1.0 - d*d;
- return step(0.0, d) * sqrt(d);
- #else
- return d;
- #endif
-}
-
-float lightComputeDiffuse(in vec3 norm, in vec3 lightdir, in vec3 viewdir){
- #ifdef MINNAERT
- float NdotL = max(0.0, dot(norm, lightdir));
- float NdotV = max(0.0, dot(norm, viewdir));
- return NdotL * pow(max(NdotL * NdotV, 0.1), -1.0) * 0.5;
- #else
- return max(0.0, dot(norm, lightdir));
- #endif
-}
-
-float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
- if (shiny <= 1.0){
- return 0.0;
- }
- #ifdef LOW_QUALITY
- // Blinn-Phong
- // Note: preferably, H should be computed in the vertex shader
- vec3 H = (viewdir + lightdir) * vec3(0.5);
- return pow(max(tangDot(H, norm), 0.0), shiny);
- #elif defined(WARDISO)
- // Isotropic Ward
- vec3 halfVec = normalize(viewdir + lightdir);
- float NdotH = max(0.001, tangDot(norm, halfVec));
- float NdotV = max(0.001, tangDot(norm, viewdir));
- float NdotL = max(0.001, tangDot(norm, lightdir));
- float a = tan(acos(NdotH));
- float p = max(shiny/128.0, 0.001);
- return NdotL * (1.0 / (4.0*3.14159265*p*p)) * (exp(-(a*a)/(p*p)) / (sqrt(NdotV * NdotL)));
- #else
- // Standard Phong
- vec3 R = reflect(-lightdir, norm);
- return pow(max(tangDot(R, viewdir), 0.0), shiny);
- #endif
-}
-
-vec2 computeLighting(in vec3 wvPos, in vec3 wvNorm, in vec3 wvViewDir, in vec3 wvLightDir){
- float diffuseFactor = lightComputeDiffuse(wvNorm, wvLightDir, wvViewDir);
- float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, wvLightDir, m_Shininess);
-
- #ifdef HQ_ATTENUATION
- float att = clamp(1.0 - g_LightPosition.w * length(lightVec), 0.0, 1.0);
- #else
- float att = vLightDir.w;
- #endif
-
- specularFactor *= diffuseFactor;
-
- return vec2(diffuseFactor, specularFactor) * vec2(att);
-}
-#endif
-
-void main(){
- vec2 newTexCoord;
-
- #if (defined(PARALLAXMAP) || (defined(NORMALMAP_PARALLAX) && defined(NORMALMAP))) && !defined(VERTEX_LIGHTING)
-
- #ifdef STEEP_PARALLAX
- #ifdef NORMALMAP_PARALLAX
- //parallax map is stored in the alpha channel of the normal map
- newTexCoord = steepParallaxOffset(m_NormalMap, vViewDir, texCoord, m_ParallaxHeight);
- #else
- //parallax map is a texture
- newTexCoord = steepParallaxOffset(m_ParallaxMap, vViewDir, texCoord, m_ParallaxHeight);
- #endif
- #else
- #ifdef NORMALMAP_PARALLAX
- //parallax map is stored in the alpha channel of the normal map
- newTexCoord = classicParallaxOffset(m_NormalMap, vViewDir, texCoord, m_ParallaxHeight);
- #else
- //parallax map is a texture
- newTexCoord = classicParallaxOffset(m_ParallaxMap, vViewDir, texCoord, m_ParallaxHeight);
- #endif
- #endif
- #else
- newTexCoord = texCoord;
- #endif
-
- #ifdef DIFFUSEMAP
- vec4 diffuseColor = texture2D(m_DiffuseMap, newTexCoord);
- #else
- vec4 diffuseColor = vec4(1.0);
- #endif
-
- float alpha = DiffuseSum.a * diffuseColor.a;
- #ifdef ALPHAMAP
- alpha = alpha * texture2D(m_AlphaMap, newTexCoord).r;
- #endif
- if(alpha < m_AlphaDiscardThreshold){
- discard;
- }
-
- #ifndef VERTEX_LIGHTING
- float spotFallOff = 1.0;
- if(g_LightDirection.w != 0.0){
- vec3 L = normalize(lightVec.xyz);
- vec3 spotdir = normalize(g_LightDirection.xyz);
- float curAngleCos = dot(-L, spotdir);
- float innerAngleCos = floor(g_LightDirection.w) * 0.001;
- float outerAngleCos = fract(g_LightDirection.w);
- float innerMinusOuter = innerAngleCos - outerAngleCos;
-
- spotFallOff = (curAngleCos - outerAngleCos) / innerMinusOuter;
-
- if(spotFallOff <= 0.0){
- gl_FragColor.rgb = AmbientSum * diffuseColor.rgb;
- gl_FragColor.a = alpha;
- return;
- }else{
- spotFallOff = clamp(spotFallOff, 0.0, 1.0);
- }
- }
- #endif
-
- // ***********************
- // Read from textures
- // ***********************
- #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING)
- vec4 normalHeight = texture2D(m_NormalMap, newTexCoord);
- vec3 normal = (normalHeight.xyz * vec3(2.0) - vec3(1.0));
- #ifdef LATC
- normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y));
- #endif
- //normal.y = -normal.y;
- #elif !defined(VERTEX_LIGHTING)
- vec3 normal = vNormal;
- #if !defined(LOW_QUALITY) && !defined(V_TANGENT)
- normal = normalize(normal);
- #endif
- #endif
-
- #ifdef SPECULARMAP
- vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
- #else
- vec4 specularColor = vec4(1.0);
- #endif
-
- #ifdef LIGHTMAP
- vec3 lightMapColor;
- #ifdef SEPARATE_TEXCOORD
- lightMapColor = texture2D(m_LightMap, texCoord2).rgb;
- #else
- lightMapColor = texture2D(m_LightMap, texCoord).rgb;
- #endif
- specularColor.rgb *= lightMapColor;
- diffuseColor.rgb *= lightMapColor;
- #endif
-
- #ifdef VERTEX_LIGHTING
- #ifdef COLORRAMP
- light.x = texture2D(m_ColorRamp, vec2(vertexLightValues.x, 0.0)).r;
- light.y = texture2D(m_ColorRamp, vec2(vertexLightValues.y, 0.0)).r;
- #endif
-
- gl_FragColor.rgb = AmbientSum * diffuseColor.rgb +
- DiffuseSum.rgb * diffuseColor.rgb * vec3(vertexLightValues.x) +
- SpecularSum * specularColor.rgb * vec3(vertexLightValues.y);
- #else
- vec4 lightDir = vLightDir;
- lightDir.xyz = normalize(lightDir.xyz);
-
- vec2 light = computeLighting(vPosition, normal, vViewDir.xyz, lightDir.xyz) * spotFallOff;
- #ifdef COLORRAMP
- diffuseColor.rgb *= texture2D(m_ColorRamp, vec2(light.x, 0.0)).rgb;
- specularColor.rgb *= texture2D(m_ColorRamp, vec2(light.y, 0.0)).rgb;
- #endif
-
- // Workaround, since it is not possible to modify varying variables
- vec4 SpecularSum2 = vec4(SpecularSum, 1.0);
- #ifdef USE_REFLECTION
- vec4 refColor = Optics_GetEnvColor(m_EnvMap, refVec.xyz);
-
- // Interpolate light specularity toward reflection color
- // Multiply result by specular map
- specularColor = mix(SpecularSum2 * light.y, refColor, refVec.w) * specularColor;
-
- SpecularSum2 = vec4(1.0);
- light.y = 1.0;
- #endif
-
- gl_FragColor.rgb = AmbientSum * diffuseColor.rgb +
- DiffuseSum.rgb * diffuseColor.rgb * vec3(light.x) +
- SpecularSum2.rgb * specularColor.rgb * vec3(light.y);
- #endif
- gl_FragColor.a = alpha;
-}
View
238 vendor/Common/MatDefs/Light/Lighting.j3md
@@ -1,238 +0,0 @@
-MaterialDef Phong Lighting {
-
- MaterialParameters {
-
- // Compute vertex lighting in the shader
- // For better performance
- Boolean VertexLighting
-
- // Use more efficent algorithms to improve performance
- Boolean LowQuality
-
- // Improve quality at the cost of performance
- Boolean HighQuality
-
- // Output alpha from the diffuse map
- Boolean UseAlpha
-
- // Apha threshold for fragment discarding
- Float AlphaDiscardThreshold
-
- // Normal map is in BC5/ATI2n/LATC/3Dc compression format
- Boolean LATC
-
- // Use the provided ambient, diffuse, and specular colors
- Boolean UseMaterialColors
-
- // Activate shading along the tangent, instead of the normal
- // Requires tangent data to be available on the model.
- Boolean VTangent
-
- // Use minnaert diffuse instead of lambert
- Boolean Minnaert
-
- // Use ward specular instead of phong
- Boolean WardIso
-
- // Use vertex color as an additional diffuse color.
- Boolean UseVertexColor
-
- // Ambient color
- Color Ambient (MaterialAmbient)
-
- // Diffuse color
- Color Diffuse (MaterialDiffuse)
-
- // Specular color
- Color Specular (MaterialSpecular)
-
- // Specular power/shininess
- Float Shininess (MaterialShininess) : 1
-
- // Diffuse map
- Texture2D DiffuseMap
-
- // Normal map
- Texture2D NormalMap
-
- // Specular/gloss map
- Texture2D SpecularMap
-
- // Parallax/height map
- Texture2D ParallaxMap
-
- //Set to true is parallax map is stored in the alpha channel of the normal map
- Boolean PackedNormalParallax
-
- //Sets the relief height for parallax mapping
- Float ParallaxHeight : 0.05
-
- //Set to true to activate Steep Parallax mapping
- Boolean SteepParallax
-
- // Texture that specifies alpha values
- Texture2D AlphaMap
-
- // Color ramp, will map diffuse and specular values through it.
- Texture2D ColorRamp
-
- // Texture of the glowing parts of the material
- Texture2D GlowMap
-
- // Set to Use Lightmap
- Texture2D LightMap
-
- // Set to use TexCoord2 for the lightmap sampling
- Boolean SeparateTexCoord
-
- // The glow color of the object
- Color GlowColor
-
- // Parameters for fresnel
- // X = bias
- // Y = scale
- // Z = power
- Vector3 FresnelParams
-
- // Env Map for reflection
- TextureCubeMap EnvMap
-
- // the env map is a spheremap and not a cube map
- Boolean EnvMapAsSphereMap
- }
-
- Technique {
-
- LightMode MultiPass
-
- VertexShader GLSL100: Common/MatDefs/Light/Lighting.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- NormalMatrix
- WorldViewMatrix
- ViewMatrix
- CameraPosition
- WorldMatrix
- }
-
- Defines {
- LATC : LATC
- VERTEX_COLOR : UseVertexColor
- VERTEX_LIGHTING : VertexLighting
- ATTENUATION : Attenuation
- MATERIAL_COLORS : UseMaterialColors
- V_TANGENT : VTangent
- MINNAERT : Minnaert
- WARDISO : WardIso
- LOW_QUALITY : LowQuality
- HQ_ATTENUATION : HighQuality
-
- DIFFUSEMAP : DiffuseMap
- NORMALMAP : NormalMap
- SPECULARMAP : SpecularMap
- PARALLAXMAP : ParallaxMap
- NORMALMAP_PARALLAX : PackedNormalParallax
- STEEP_PARALLAX : SteepParallax
- ALPHAMAP : AlphaMap
- COLORRAMP : ColorRamp
- LIGHTMAP : LightMap
- SEPARATE_TEXCOORD : SeparateTexCoord
-
- USE_REFLECTION : EnvMap
- SPHERE_MAP : SphereMap
- }
- }
-
- Technique PreShadow {
-
- VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
- FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- }
-
- Defines {
- DIFFUSEMAP_ALPHA : DiffuseMap
- }
-
- RenderState {
- FaceCull Off
- DepthTest On
- DepthWrite On
- PolyOffset 5 0
- ColorWrite Off
- }
-
- }
-
- Technique PreNormalPass {
-
- VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
- FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- NormalMatrix
- }
-
- Defines {
- DIFFUSEMAP_ALPHA : DiffuseMap
- }
-
- RenderState {
-
- }
-
- }
-
- Technique GBuf {
-
- VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
- FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- NormalMatrix
- WorldViewMatrix
- WorldMatrix
- }
-
- Defines {
- VERTEX_COLOR : UseVertexColor
- MATERIAL_COLORS : UseMaterialColors
- V_TANGENT : VTangent
- MINNAERT : Minnaert
- WARDISO : WardIso
-
- DIFFUSEMAP : DiffuseMap
- NORMALMAP : NormalMap
- SPECULARMAP : SpecularMap
- PARALLAXMAP : ParallaxMap
- }
- }
-
- Technique FixedFunc {
- LightMode FixedPipeline
- }
-
- Technique Glow {
-
- VertexShader GLSL100: Common/MatDefs/Misc/SimpleTextured.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- HAS_GLOWMAP : GlowMap
- HAS_GLOWCOLOR : GlowColor
- }
- }
-
-}
View
206 vendor/Common/MatDefs/Light/Lighting.vert
@@ -1,206 +0,0 @@
-#define ATTENUATION
-//#define HQ_ATTENUATION
-
-uniform mat4 g_WorldViewProjectionMatrix;
-uniform mat4 g_WorldViewMatrix;
-uniform mat3 g_NormalMatrix;
-uniform mat4 g_ViewMatrix;
-
-uniform vec4 m_Ambient;
-uniform vec4 m_Diffuse;
-uniform vec4 m_Specular;
-uniform float m_Shininess;
-
-uniform vec4 g_LightColor;
-uniform vec4 g_LightPosition;
-uniform vec4 g_AmbientLightColor;
-
-varying vec2 texCoord;
-#ifdef SEPARATE_TEXCOORD
- varying vec2 texCoord2;
- attribute vec2 inTexCoord2;
-#endif
-
-varying vec3 AmbientSum;
-varying vec4 DiffuseSum;
-varying vec3 SpecularSum;
-
-attribute vec3 inPosition;
-attribute vec2 inTexCoord;
-attribute vec3 inNormal;
-
-varying vec3 lightVec;
-//varying vec4 spotVec;
-
-#ifdef VERTEX_COLOR
- attribute vec4 inColor;
-#endif
-
-#ifndef VERTEX_LIGHTING
- attribute vec4 inTangent;
-
- #ifndef NORMALMAP
- varying vec3 vNormal;
- #endif
- varying vec3 vPosition;
- varying vec3 vViewDir;
- varying vec4 vLightDir;
-#else
- varying vec2 vertexLightValues;
- uniform vec4 g_LightDirection;
-#endif
-
-#ifdef USE_REFLECTION
- uniform vec3 g_CameraPosition;
- uniform mat4 g_WorldMatrix;
-
- uniform vec3 m_FresnelParams;
- varying vec4 refVec;
-
-
- /**
- * Input:
- * attribute inPosition
- * attribute inNormal
- * uniform g_WorldMatrix
- * uniform g_CameraPosition
- *
- * Output:
- * varying refVec
- */
- void computeRef(){
- vec3 worldPos = (g_WorldMatrix * vec4(inPosition,1.0)).xyz;
-
- vec3 I = normalize( g_CameraPosition - worldPos ).xyz;
- vec3 N = normalize( (g_WorldMatrix * vec4(inNormal, 0.0)).xyz );
-
- refVec.xyz = reflect(I, N);
- refVec.w = m_FresnelParams.x + m_FresnelParams.y * pow(1.0 + dot(I, N), m_FresnelParams.z);
- }
-#endif
-
-// JME3 lights in world space
-void lightComputeDir(in vec3 worldPos, in vec4 color, in vec4 position, out vec4 lightDir){
- float posLight = step(0.5, color.w);
- vec3 tempVec = position.xyz * sign(posLight - 0.5) - (worldPos * posLight);
- lightVec = tempVec;
- #ifdef ATTENUATION
- float dist = length(tempVec);
- lightDir.w = clamp(1.0 - position.w * dist * posLight, 0.0, 1.0);
- lightDir.xyz = tempVec / vec3(dist);
- #else
- lightDir = vec4(normalize(tempVec), 1.0);
- #endif
-}
-
-#ifdef VERTEX_LIGHTING
- float lightComputeDiffuse(in vec3 norm, in vec3 lightdir){
- return max(0.0, dot(norm, lightdir));
- }
-
- float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
- if (shiny <= 1.0){
- return 0.0;
- }
- #ifndef LOW_QUALITY
- vec3 H = (viewdir + lightdir) * vec3(0.5);
- return pow(max(dot(H, norm), 0.0), shiny);
- #else
- return 0.0;
- #endif
- }
-
-vec2 computeLighting(in vec3 wvPos, in vec3 wvNorm, in vec3 wvViewDir, in vec4 wvLightPos){
- vec4 lightDir;
- lightComputeDir(wvPos, g_LightColor, wvLightPos, lightDir);
- float spotFallOff = 1.0;
- if(g_LightDirection.w != 0.0){
- vec3 L=normalize(lightVec.xyz);
- vec3 spotdir = normalize(g_LightDirection.xyz);
- float curAngleCos = dot(-L, spotdir);
- float innerAngleCos = floor(g_LightDirection.w) * 0.001;
- float outerAngleCos = fract(g_LightDirection.w);
- float innerMinusOuter = innerAngleCos - outerAngleCos;
- spotFallOff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0);
- }
- float diffuseFactor = lightComputeDiffuse(wvNorm, lightDir.xyz);
- float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, lightDir.xyz, m_Shininess);
- //specularFactor *= step(0.01, diffuseFactor);
- return vec2(diffuseFactor, specularFactor) * vec2(lightDir.w)*spotFallOff;
- }
-#endif
-
-void main(){
- vec4 pos = vec4(inPosition, 1.0);
- gl_Position = g_WorldViewProjectionMatrix * pos;
- texCoord = inTexCoord;
- #ifdef SEPARATE_TEXCOORD
- texCoord2 = inTexCoord2;
- #endif
-
- vec3 wvPosition = (g_WorldViewMatrix * pos).xyz;
- vec3 wvNormal = normalize(g_NormalMatrix * inNormal);
- vec3 viewDir = normalize(-wvPosition);
-
- //vec4 lightColor = g_LightColor[gl_InstanceID];
- //vec4 lightPos = g_LightPosition[gl_InstanceID];
- //vec4 wvLightPos = (g_ViewMatrix * vec4(lightPos.xyz, lightColor.w));
- //wvLightPos.w = lightPos.w;
-
- vec4 wvLightPos = (g_ViewMatrix * vec4(g_LightPosition.xyz,clamp(g_LightColor.w,0.0,1.0)));
- wvLightPos.w = g_LightPosition.w;
- vec4 lightColor = g_LightColor;
-
- #if defined(NORMALMAP) && !defined(VERTEX_LIGHTING)
- vec3 wvTangent = normalize(g_NormalMatrix * inTangent.xyz);
- vec3 wvBinormal = cross(wvNormal, wvTangent);
-
- mat3 tbnMat = mat3(wvTangent, wvBinormal * -inTangent.w,wvNormal);
-
- vPosition = wvPosition * tbnMat;
- vViewDir = viewDir * tbnMat;
- lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir);
- vLightDir.xyz = (vLightDir.xyz * tbnMat).xyz;
- #elif !defined(VERTEX_LIGHTING)
- vNormal = wvNormal;
-
- vPosition = wvPosition;
- vViewDir = viewDir;
-
- lightComputeDir(wvPosition, lightColor, wvLightPos, vLightDir);
-
- #ifdef V_TANGENT
- vNormal = normalize(g_NormalMatrix * inTangent.xyz);
- vNormal = -cross(cross(vLightDir.xyz, vNormal), vNormal);
- #endif
- #endif
-
- //computing spot direction in view space and unpacking spotlight cos
-// spotVec = (g_ViewMatrix * vec4(g_LightDirection.xyz, 0.0) );
-// spotVec.w = floor(g_LightDirection.w) * 0.001;
-// lightVec.w = fract(g_LightDirection.w);
-
- lightColor.w = 1.0;
- #ifdef MATERIAL_COLORS
- AmbientSum = (m_Ambient * g_AmbientLightColor).rgb;
- DiffuseSum = m_Diffuse * lightColor;
- SpecularSum = (m_Specular * lightColor).rgb;
- #else
- AmbientSum = vec3(0.2, 0.2, 0.2) * g_AmbientLightColor.rgb; // Default: ambient color is dark gray
- DiffuseSum = lightColor;
- SpecularSum = lightColor.rgb;
- #endif
-
- #ifdef VERTEX_COLOR
- AmbientSum *= inColor.rgb;
- DiffuseSum *= inColor;
- #endif
-
- #ifdef VERTEX_LIGHTING
- vertexLightValues = computeLighting(wvPosition, wvNormal, viewDir, wvLightPos);
- #endif
-
- #ifdef USE_REFLECTION
- computeRef();
- #endif
-}
View
9 vendor/Common/MatDefs/Misc/ColoredTextured.frag
@@ -1,9 +0,0 @@
-varying vec2 texCoord;
-
-uniform sampler2D m_ColorMap;
-uniform vec4 m_Color;
-
-void main(){
- vec4 texColor = texture2D(m_ColorMap, texCoord);
- gl_FragColor = vec4(mix(m_Color.rgb, texColor.rgb, texColor.a), 1.0);
-}
View
20 vendor/Common/MatDefs/Misc/ColoredTextured.j3md
@@ -1,20 +0,0 @@
-MaterialDef Colored Textured {
-
- MaterialParameters {
- Texture2D ColorMap
- Color Color
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/ColoredTextured.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/ColoredTextured.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-
- Technique FixedFunc {
- }
-
-}
View
11 vendor/Common/MatDefs/Misc/ColoredTextured.vert
@@ -1,11 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-
-attribute vec3 inPosition;
-attribute vec2 inTexCoord;
-
-varying vec2 texCoord;
-
-void main(){
- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
- texCoord = inTexCoord;
-}
View
22 vendor/Common/MatDefs/Misc/Particle.frag
@@ -1,22 +0,0 @@
-#ifdef USE_TEXTURE
-uniform sampler2D m_Texture;
-varying vec4 texCoord;
-#endif
-
-varying vec4 color;
-
-void main(){
- if (color.a <= 0.01)
- discard;
-
- #ifdef USE_TEXTURE
- #ifdef POINT_SPRITE
- vec2 uv = mix(texCoord.xy, texCoord.zw, gl_PointCoord.xy);
- #else
- vec2 uv = texCoord.xy;
- #endif
- gl_FragColor = texture2D(m_Texture, uv) * color;
- #else
- gl_FragColor = color;
- #endif
-}
View
89 vendor/Common/MatDefs/Misc/Particle.j3md
@@ -1,89 +0,0 @@
-MaterialDef Point Sprite {
-
- MaterialParameters {
- Texture2D Texture
- Float Quadratic
- Boolean PointSprite
-
- // Texture of the glowing parts of the material
- Texture2D GlowMap
- // The glow color of the object
- Color GlowColor
- }
-
- Technique {
-
- VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
- FragmentShader GLSL120 : Common/MatDefs/Misc/Particle.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- WorldMatrix
- CameraPosition
- }
-
- RenderState {
- Blend AlphaAdditive
- DepthWrite Off
- PointSprite On
- // AlphaTestFalloff 0.01
- }
-
- Defines {
- USE_TEXTURE : Texture
- POINT_SPRITE : PointSprite
- }
- }
-
- Technique {
-
- VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
- FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- WorldMatrix
- CameraPosition
- }
-
- RenderState {
- Blend AlphaAdditive
- DepthWrite Off
- }
-
- Defines {
- USE_TEXTURE : Texture
- }
- }
-
- Technique FixedFunc {
- RenderState {
- Blend AlphaAdditive
- // DepthWrite Off
- // AlphaTestFalloff 0.01
- }
- }
-
- Technique Glow {
-
- VertexShader GLSL100: Common/MatDefs/Misc/SimpleTextured.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- HAS_GLOWMAP : GlowMap
- HAS_GLOWCOLOR : GlowColor
- }
-
- RenderState {
- PointSprite On
- Blend AlphaAdditive
- DepthWrite Off
- }
- }
-}
View
42 vendor/Common/MatDefs/Misc/Particle.vert
@@ -1,42 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-
-attribute vec3 inPosition;
-attribute vec4 inColor;
-attribute vec4 inTexCoord;
-
-varying vec4 color;
-
-#ifdef USE_TEXTURE
-varying vec4 texCoord;
-#endif
-
-#ifdef POINT_SPRITE
-uniform mat4 g_WorldViewMatrix;
-uniform mat4 g_WorldMatrix;
-uniform vec3 g_CameraPosition;
-uniform float m_Quadratic;
-const float SIZE_MULTIPLIER = 4.0;
-attribute float inSize;
-#endif
-
-void main(){
- vec4 pos = vec4(inPosition, 1.0);
-
- gl_Position = g_WorldViewProjectionMatrix * pos;
- color = inColor;
-
- #ifdef USE_TEXTURE
- texCoord = inTexCoord;
- #endif
-
- #ifdef POINT_SPRITE
- vec4 worldPos = g_WorldMatrix * pos;
- float d = distance(g_CameraPosition.xyz, worldPos.xyz);
- gl_PointSize = max(1.0, (inSize * SIZE_MULTIPLIER * m_Quadratic) / d);
-
- //vec4 worldViewPos = g_WorldViewMatrix * pos;
- //gl_PointSize = (inSize * SIZE_MULTIPLIER * m_Quadratic)*100.0 / worldViewPos.z;
-
- color.a *= min(gl_PointSize, 1.0);
- #endif
-}
View
5 vendor/Common/MatDefs/Misc/ShowNormals.frag
@@ -1,5 +0,0 @@
-varying vec3 normal;
-
-void main(){
- gl_FragColor = vec4((normal * vec3(0.5)) + vec3(0.5), 1.0);
-}
View
10 vendor/Common/MatDefs/Misc/ShowNormals.j3md
@@ -1,10 +0,0 @@
-MaterialDef Debug Normals {
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/ShowNormals.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/ShowNormals.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-}
View
11 vendor/Common/MatDefs/Misc/ShowNormals.vert
@@ -1,11 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-
-attribute vec3 inPosition;
-attribute vec3 inNormal;
-
-varying vec3 normal;
-
-void main(){
- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition,1.0);
- normal = inNormal;
-}
View
27 vendor/Common/MatDefs/Misc/SimpleTextured.frag
@@ -1,27 +0,0 @@
-#import "Common/ShaderLib/Texture.glsllib"
-
-varying vec2 texCoord;
-
-uniform sampler2D m_ColorMap;
-
-void main(){
- //Texture_GetColor(m_ColorMap, texCoord)
- //vec4 color = texture2D(m_ColorMap, texCoord);
- //color.rgb *= color.a;
- //gl_FragColor = vec4(color.a);
-
- #ifdef NORMAL_LATC
- vec3 newNorm = vec3(texture2D(m_ColorMap, texCoord).ag, 0.0);
- newNorm = Common_UnpackNormal(newNorm);
- newNorm.b = sqrt(1.0 - (newNorm.x * newNorm.x) - (newNorm.y * newNorm.y));
- newNorm = Common_PackNormal(newNorm);
- gl_FragColor = vec4(newNorm, 1.0);
- #elif defined(SHOW_ALPHA)
- gl_FragColor = vec4(texture2D(m_ColorMap, texCoord).a);
- #else
- gl_FragColor = Texture_GetColor(m_ColorMap, texCoord);
- #endif
- #ifdef NORMALIZE
- gl_FragColor = vec4(normalize(gl_FragColor.xyz), gl_FragColor.a);
- #endif
-}
View
32 vendor/Common/MatDefs/Misc/SimpleTextured.j3md
@@ -1,32 +0,0 @@
-Exception SimpleTextured.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
-
-MaterialDef Plain Texture {
-
- MaterialParameters {
- Texture2D ColorMap
- Boolean YCoCg
- Boolean LATC
- Boolean Normalize
- Boolean ShowAlpha
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/SimpleTextured.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/SimpleTextured.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- DXT_YCOCG : YCoCg
- NORMAL_LATC : LATC
- NORMALIZE : Normalize
- SHOW_ALPHA : ShowAlpha
- }
- }
-
- Technique FixedFunc {
- }
-
-}
View
11 vendor/Common/MatDefs/Misc/SimpleTextured.vert
@@ -1,11 +0,0 @@
-uniform mat4 g_WorldViewProjectionMatrix;
-
-attribute vec3 inPosition;
-attribute vec2 inTexCoord;
-
-varying vec2 texCoord;
-
-void main(){
- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
- texCoord = inTexCoord;
-}
View
11 vendor/Common/MatDefs/Misc/Sky.frag
@@ -1,11 +0,0 @@
-#import "Common/ShaderLib/Optics.glsllib"
-
-uniform ENVMAP m_Texture;
-
-varying vec3 direction;
-
-void main() {
- vec3 dir = normalize(direction);
- gl_FragColor = Optics_GetEnvColor(m_Texture, direction);
-}
-
View
27 vendor/Common/MatDefs/Misc/Sky.j3md
@@ -1,27 +0,0 @@
-MaterialDef Sky Plane {
- MaterialParameters {
- TextureCubeMap Texture
- Boolean SphereMap
- Vector3 NormalScale
- }
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/Sky.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/Sky.frag
-
- RenderState {
- FaceCull Off
- }
-
- WorldParameters {
- ViewMatrix
- ProjectionMatrix
- WorldMatrix
- }
-
- Defines {
- SPHERE_MAP : SphereMap
- }
- }
- Technique FixedFunc {
- }
-}
View
25 vendor/Common/MatDefs/Misc/Sky.vert
@@ -1,25 +0,0 @@
-uniform mat4 g_ViewMatrix;
-uniform mat4 g_ProjectionMatrix;
-uniform mat4 g_WorldMatrix;
-
-uniform vec3 m_NormalScale;
-
-attribute vec3 inPosition;
-attribute vec3 inNormal;
-
-varying vec3 direction;
-
-void main(){
- // set w coordinate to 0
- vec4 pos = vec4(inPosition, 0.0);
-
- // compute rotation only for view matrix
- pos = g_ViewMatrix * pos;
-
- // now find projection
- pos.w = 1.0;
- gl_Position = g_ProjectionMatrix * pos;
-
- vec4 normal = vec4(inNormal * m_NormalScale, 0.0);
- direction = normalize( (g_WorldMatrix * normal).xyz );
-}
View
44 vendor/Common/MatDefs/Misc/SolidColor.j3md
@@ -1,44 +0,0 @@
-Exception SolidColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
-
-MaterialDef Solid Color {
-
- MaterialParameters {
- Vector4 Color
-
- // Texture of the glowing parts of the material
- Texture2D GlowMap
- // The glow color of the object
- Color GlowColor
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/Unshaded.frag
-
- Defines {
- HAS_COLOR : Color
- }
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
- }
-
- Technique FixedFunc {
- }
-
- Technique Glow {
-
- VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- HAS_GLOWMAP : GlowMap
- HAS_GLOWCOLOR : GlowColor
- }
- }
-}
View
50 vendor/Common/MatDefs/Misc/Unshaded.frag
@@ -1,50 +0,0 @@
-uniform vec4 m_Color;
-
-#if defined(HAS_GLOWMAP) || defined(HAS_COLORMAP) || (defined(HAS_LIGHTMAP) && !defined(SEPARATE_TEXCOORD))
- #define NEED_TEXCOORD1
-#endif
-
-#ifdef HAS_COLORMAP
- uniform sampler2D m_ColorMap;
-#endif
-
-#ifdef NEED_TEXCOORD1
- varying vec2 texCoord1;
-#endif
-
-#ifdef HAS_LIGHTMAP
- uniform sampler2D m_LightMap;
- #ifdef SEPARATE_TEXCOORD
- varying vec2 texCoord2;
- #endif
-#endif
-
-#ifdef HAS_VERTEXCOLOR
- varying vec4 vertColor;
-#endif
-
-void main(){
- vec4 color = vec4(1.0);
-
- #ifdef HAS_COLORMAP
- color *= texture2D(m_ColorMap, texCoord1);
- #endif
-
- #ifdef HAS_VERTEXCOLOR
- color *= vertColor;
- #endif
-
- #ifdef HAS_COLOR
- color *= m_Color;
- #endif
-
- #ifdef HAS_LIGHTMAP
- #ifdef SEPARATE_TEXCOORD
- color.rgb *= texture2D(m_LightMap, texCoord2).rgb;
- #else
- color.rgb *= texture2D(m_LightMap, texCoord1).rgb;
- #endif
- #endif
-
- gl_FragColor = color;
-}
View
70 vendor/Common/MatDefs/Misc/Unshaded.j3md
@@ -1,70 +0,0 @@
-MaterialDef Unshaded {
-
- MaterialParameters {
- Texture2D ColorMap
- Texture2D LightMap
- Color Color ( Color )
- Boolean VertexColor
- Boolean SeparateTexCoord
-
- // Texture of the glowing parts of the material
- Texture2D GlowMap
- // The glow color of the object
- Color GlowColor
- }
-
- Technique {
- VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
- FragmentShader GLSL100: Common/MatDefs/Misc/Unshaded.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- SEPARATE_TEXCOORD : SeparateTexCoord
- HAS_COLORMAP : ColorMap
- HAS_LIGHTMAP : LightMap
- HAS_VERTEXCOLOR : VertexColor
- HAS_COLOR : Color
- }
- }
-
- Technique PreNormalPass {
-
- VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
- FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- WorldViewMatrix
- NormalMatrix
- }
-
- RenderState {
-
- }
-
- }
-
-
- Technique Glow {
-
- VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
- FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
-
- WorldParameters {
- WorldViewProjectionMatrix
- }
-
- Defines {
- HAS_GLOWMAP : GlowMap
- HAS_GLOWCOLOR : GlowColor
- HAS_COLORMAP // Must be passed so that Unshaded.vert exports texCoord.
- }
- }
-
- Technique FixedFunc {
- }
-
-}
View
37