generated from ThanosFisherman/libgdx-bootstrapper
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 33803d9
Showing
16 changed files
with
6,327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
version="3.0"></web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
i:libgdx.png:2458:image/png | ||
i:com/badlogic/gdx/utils/lsans-15.png:14652:image/png | ||
t:com/badlogic/gdx/graphics/g3d/shaders/default.vertex.glsl:9096:application/unknown | ||
t:com/badlogic/gdx/graphics/g3d/particles/particles.fragment.glsl:820:application/unknown | ||
t:com/badlogic/gdx/graphics/g3d/particles/particles.vertex.glsl:2886:application/unknown | ||
t:com/badlogic/gdx/graphics/g3d/shaders/default.fragment.glsl:5874:application/unknown | ||
t:com/badlogic/gdx/graphics/g3d/shaders/depth.vertex.glsl:2931:application/unknown | ||
t:com/badlogic/gdx/utils/lsans-15.fnt:17711:application/unknown | ||
t:com/badlogic/gdx/graphics/g3d/shaders/depth.fragment.glsl:869:application/unknown | ||
i:startup-logo.png:12214:image/png |
39 changes: 39 additions & 0 deletions
39
assets/com/badlogic/gdx/graphics/g3d/particles/particles.fragment.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifdef GL_ES | ||
#define LOWP lowp | ||
#define MED mediump | ||
#define HIGH highp | ||
precision mediump float; | ||
#else | ||
#define MED | ||
#define LOWP | ||
#define HIGH | ||
#endif | ||
|
||
|
||
#ifdef billboard | ||
//Billboard particles | ||
varying vec4 v_color; | ||
varying MED vec2 v_texCoords0; | ||
uniform sampler2D u_diffuseTexture; | ||
|
||
void main() { | ||
gl_FragColor = texture2D(u_diffuseTexture, v_texCoords0) * v_color; | ||
} | ||
#else | ||
|
||
//Point particles | ||
varying vec4 v_color; | ||
varying vec4 v_rotation; | ||
varying MED vec4 v_region; | ||
varying vec2 v_uvRegionCenter; | ||
|
||
uniform sampler2D u_diffuseTexture; | ||
uniform vec2 u_regionSize; | ||
|
||
void main() { | ||
vec2 uv = v_region.xy + gl_PointCoord*v_region.zw - v_uvRegionCenter; | ||
vec2 texCoord = mat2(v_rotation.x, v_rotation.y, v_rotation.z, v_rotation.w) * uv +v_uvRegionCenter; | ||
gl_FragColor = texture2D(u_diffuseTexture, texCoord)* v_color; | ||
} | ||
|
||
#endif |
110 changes: 110 additions & 0 deletions
110
assets/com/badlogic/gdx/graphics/g3d/particles/particles.vertex.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#ifdef GL_ES | ||
#define LOWP lowp | ||
#define MED mediump | ||
#define HIGH highp | ||
precision mediump float; | ||
#else | ||
#define MED | ||
#define LOWP | ||
#define HIGH | ||
#endif | ||
|
||
#ifdef billboard | ||
//Billboard particles | ||
//In | ||
attribute vec3 a_position; | ||
attribute vec2 a_texCoord0; | ||
attribute vec4 a_sizeAndRotation; | ||
attribute vec4 a_color; | ||
|
||
//out | ||
varying MED vec2 v_texCoords0; | ||
varying vec4 v_color; | ||
|
||
//Camera | ||
uniform mat4 u_projViewTrans; | ||
|
||
//Billboard to screen | ||
#ifdef screenFacing | ||
uniform vec3 u_cameraInvDirection; | ||
uniform vec3 u_cameraRight; | ||
uniform vec3 u_cameraUp; | ||
#endif | ||
#ifdef viewPointFacing | ||
uniform vec3 u_cameraPosition; | ||
uniform vec3 u_cameraUp; | ||
#endif | ||
#ifdef paticleDirectionFacing | ||
uniform vec3 u_cameraPosition; | ||
attribute vec3 a_direction; | ||
#endif | ||
|
||
void main() { | ||
|
||
#ifdef screenFacing | ||
vec3 right = u_cameraRight; | ||
vec3 up = u_cameraUp; | ||
vec3 look = u_cameraInvDirection; | ||
#endif | ||
#ifdef viewPointFacing | ||
vec3 look = normalize(u_cameraPosition - a_position); | ||
vec3 right = normalize(cross(u_cameraUp, look)); | ||
vec3 up = normalize(cross(look, right)); | ||
#endif | ||
#ifdef paticleDirectionFacing | ||
vec3 up = a_direction; | ||
vec3 look = normalize(u_cameraPosition - a_position); | ||
vec3 right = normalize(cross(up, look)); | ||
look = normalize(cross(right, up)); | ||
#endif | ||
|
||
//Rotate around look | ||
vec3 axis = look; | ||
float c = a_sizeAndRotation.z; | ||
float s = a_sizeAndRotation.w; | ||
float oc = 1.0 - c; | ||
|
||
mat3 rot = mat3(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, | ||
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, | ||
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c); | ||
vec3 offset = rot*(right*a_sizeAndRotation.x + up*a_sizeAndRotation.y ); | ||
|
||
gl_Position = u_projViewTrans * vec4(a_position + offset, 1.0); | ||
v_texCoords0 = a_texCoord0; | ||
v_color = a_color; | ||
} | ||
#else | ||
//Point particles | ||
attribute vec3 a_position; | ||
attribute vec3 a_sizeAndRotation; | ||
attribute vec4 a_color; | ||
attribute vec4 a_region; | ||
|
||
//out | ||
varying vec4 v_color; | ||
varying vec4 v_rotation; | ||
varying MED vec4 v_region; | ||
varying vec2 v_uvRegionCenter; | ||
|
||
//Camera | ||
uniform mat4 u_projTrans; | ||
//should be modelView but particles are already in world coordinates | ||
uniform mat4 u_viewTrans; | ||
uniform float u_screenWidth; | ||
uniform vec2 u_regionSize; | ||
|
||
void main(){ | ||
|
||
float halfSize = 0.5*a_sizeAndRotation.x; | ||
vec4 eyePos = u_viewTrans * vec4(a_position, 1); | ||
vec4 projCorner = u_projTrans * vec4(halfSize, halfSize, eyePos.z, eyePos.w); | ||
gl_PointSize = u_screenWidth * projCorner.x / projCorner.w; | ||
gl_Position = u_projTrans * eyePos; | ||
v_rotation = vec4(a_sizeAndRotation.y, a_sizeAndRotation.z, -a_sizeAndRotation.z, a_sizeAndRotation.y); | ||
v_color = a_color; | ||
v_region.xy = a_region.xy; | ||
v_region.zw = a_region.zw -a_region.xy; | ||
v_uvRegionCenter = a_region.xy +v_region.zw*0.5; | ||
} | ||
|
||
#endif |
210 changes: 210 additions & 0 deletions
210
assets/com/badlogic/gdx/graphics/g3d/shaders/default.fragment.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
#ifdef GL_ES | ||
#define LOWP lowp | ||
#define MED mediump | ||
#define HIGH highp | ||
precision mediump float; | ||
#else | ||
#define MED | ||
#define LOWP | ||
#define HIGH | ||
#endif | ||
|
||
#if defined(specularTextureFlag) || defined(specularColorFlag) | ||
#define specularFlag | ||
#endif | ||
|
||
#ifdef normalFlag | ||
varying vec3 v_normal; | ||
#endif //normalFlag | ||
|
||
#if defined(colorFlag) | ||
varying vec4 v_color; | ||
#endif | ||
|
||
#ifdef blendedFlag | ||
varying float v_opacity; | ||
#ifdef alphaTestFlag | ||
varying float v_alphaTest; | ||
#endif //alphaTestFlag | ||
#endif //blendedFlag | ||
|
||
#if defined(diffuseTextureFlag) || defined(specularTextureFlag) || defined(emissiveTextureFlag) | ||
#define textureFlag | ||
#endif | ||
|
||
#ifdef diffuseTextureFlag | ||
varying MED vec2 v_diffuseUV; | ||
#endif | ||
|
||
#ifdef specularTextureFlag | ||
varying MED vec2 v_specularUV; | ||
#endif | ||
|
||
#ifdef emissiveTextureFlag | ||
varying MED vec2 v_emissiveUV; | ||
#endif | ||
|
||
#ifdef diffuseColorFlag | ||
uniform vec4 u_diffuseColor; | ||
#endif | ||
|
||
#ifdef diffuseTextureFlag | ||
uniform sampler2D u_diffuseTexture; | ||
#endif | ||
|
||
#ifdef specularColorFlag | ||
uniform vec4 u_specularColor; | ||
#endif | ||
|
||
#ifdef specularTextureFlag | ||
uniform sampler2D u_specularTexture; | ||
#endif | ||
|
||
#ifdef normalTextureFlag | ||
uniform sampler2D u_normalTexture; | ||
#endif | ||
|
||
#ifdef emissiveColorFlag | ||
uniform vec4 u_emissiveColor; | ||
#endif | ||
|
||
#ifdef emissiveTextureFlag | ||
uniform sampler2D u_emissiveTexture; | ||
#endif | ||
|
||
#ifdef lightingFlag | ||
varying vec3 v_lightDiffuse; | ||
|
||
#if defined(ambientLightFlag) || defined(ambientCubemapFlag) || defined(sphericalHarmonicsFlag) | ||
#define ambientFlag | ||
#endif //ambientFlag | ||
|
||
#ifdef specularFlag | ||
varying vec3 v_lightSpecular; | ||
#endif //specularFlag | ||
|
||
#ifdef shadowMapFlag | ||
uniform sampler2D u_shadowTexture; | ||
uniform float u_shadowPCFOffset; | ||
varying vec3 v_shadowMapUv; | ||
#define separateAmbientFlag | ||
|
||
float getShadowness(vec2 offset) | ||
{ | ||
const vec4 bitShifts = vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0); | ||
return step(v_shadowMapUv.z, dot(texture2D(u_shadowTexture, v_shadowMapUv.xy + offset), bitShifts));//+(1.0/255.0)); | ||
} | ||
|
||
float getShadow() | ||
{ | ||
return (//getShadowness(vec2(0,0)) + | ||
getShadowness(vec2(u_shadowPCFOffset, u_shadowPCFOffset)) + | ||
getShadowness(vec2(-u_shadowPCFOffset, u_shadowPCFOffset)) + | ||
getShadowness(vec2(u_shadowPCFOffset, -u_shadowPCFOffset)) + | ||
getShadowness(vec2(-u_shadowPCFOffset, -u_shadowPCFOffset))) * 0.25; | ||
} | ||
#endif //shadowMapFlag | ||
|
||
#if defined(ambientFlag) && defined(separateAmbientFlag) | ||
varying vec3 v_ambientLight; | ||
#endif //separateAmbientFlag | ||
|
||
#endif //lightingFlag | ||
|
||
#ifdef fogFlag | ||
uniform vec4 u_fogColor; | ||
varying float v_fog; | ||
#endif // fogFlag | ||
|
||
void main() { | ||
#if defined(normalFlag) | ||
vec3 normal = v_normal; | ||
#endif // normalFlag | ||
|
||
#if defined(diffuseTextureFlag) && defined(diffuseColorFlag) && defined(colorFlag) | ||
vec4 diffuse = texture2D(u_diffuseTexture, v_diffuseUV) * u_diffuseColor * v_color; | ||
#elif defined(diffuseTextureFlag) && defined(diffuseColorFlag) | ||
vec4 diffuse = texture2D(u_diffuseTexture, v_diffuseUV) * u_diffuseColor; | ||
#elif defined(diffuseTextureFlag) && defined(colorFlag) | ||
vec4 diffuse = texture2D(u_diffuseTexture, v_diffuseUV) * v_color; | ||
#elif defined(diffuseTextureFlag) | ||
vec4 diffuse = texture2D(u_diffuseTexture, v_diffuseUV); | ||
#elif defined(diffuseColorFlag) && defined(colorFlag) | ||
vec4 diffuse = u_diffuseColor * v_color; | ||
#elif defined(diffuseColorFlag) | ||
vec4 diffuse = u_diffuseColor; | ||
#elif defined(colorFlag) | ||
vec4 diffuse = v_color; | ||
#else | ||
vec4 diffuse = vec4(1.0); | ||
#endif | ||
|
||
#if defined(emissiveTextureFlag) && defined(emissiveColorFlag) | ||
vec4 emissive = texture2D(u_emissiveTexture, v_emissiveUV) * u_emissiveColor; | ||
#elif defined(emissiveTextureFlag) | ||
vec4 emissive = texture2D(u_emissiveTexture, v_emissiveUV); | ||
#elif defined(emissiveColorFlag) | ||
vec4 emissive = u_emissiveColor; | ||
#else | ||
vec4 emissive = vec4(0.0); | ||
#endif | ||
|
||
#if (!defined(lightingFlag)) | ||
gl_FragColor.rgb = diffuse.rgb + emissive.rgb; | ||
#elif (!defined(specularFlag)) | ||
#if defined(ambientFlag) && defined(separateAmbientFlag) | ||
#ifdef shadowMapFlag | ||
gl_FragColor.rgb = (diffuse.rgb * (v_ambientLight + getShadow() * v_lightDiffuse)) + emissive.rgb; | ||
//gl_FragColor.rgb = texture2D(u_shadowTexture, v_shadowMapUv.xy); | ||
#else | ||
gl_FragColor.rgb = (diffuse.rgb * (v_ambientLight + v_lightDiffuse)) + emissive.rgb; | ||
#endif //shadowMapFlag | ||
#else | ||
#ifdef shadowMapFlag | ||
gl_FragColor.rgb = getShadow() * (diffuse.rgb * v_lightDiffuse) + emissive.rgb; | ||
#else | ||
gl_FragColor.rgb = (diffuse.rgb * v_lightDiffuse) + emissive.rgb; | ||
#endif //shadowMapFlag | ||
#endif | ||
#else | ||
#if defined(specularTextureFlag) && defined(specularColorFlag) | ||
vec3 specular = texture2D(u_specularTexture, v_specularUV).rgb * u_specularColor.rgb * v_lightSpecular; | ||
#elif defined(specularTextureFlag) | ||
vec3 specular = texture2D(u_specularTexture, v_specularUV).rgb * v_lightSpecular; | ||
#elif defined(specularColorFlag) | ||
vec3 specular = u_specularColor.rgb * v_lightSpecular; | ||
#else | ||
vec3 specular = v_lightSpecular; | ||
#endif | ||
|
||
#if defined(ambientFlag) && defined(separateAmbientFlag) | ||
#ifdef shadowMapFlag | ||
gl_FragColor.rgb = (diffuse.rgb * (getShadow() * v_lightDiffuse + v_ambientLight)) + specular + emissive.rgb; | ||
//gl_FragColor.rgb = texture2D(u_shadowTexture, v_shadowMapUv.xy); | ||
#else | ||
gl_FragColor.rgb = (diffuse.rgb * (v_lightDiffuse + v_ambientLight)) + specular + emissive.rgb; | ||
#endif //shadowMapFlag | ||
#else | ||
#ifdef shadowMapFlag | ||
gl_FragColor.rgb = getShadow() * ((diffuse.rgb * v_lightDiffuse) + specular) + emissive.rgb; | ||
#else | ||
gl_FragColor.rgb = (diffuse.rgb * v_lightDiffuse) + specular + emissive.rgb; | ||
#endif //shadowMapFlag | ||
#endif | ||
#endif //lightingFlag | ||
|
||
#ifdef fogFlag | ||
gl_FragColor.rgb = mix(gl_FragColor.rgb, u_fogColor.rgb, v_fog); | ||
#endif // end fogFlag | ||
|
||
#ifdef blendedFlag | ||
gl_FragColor.a = diffuse.a * v_opacity; | ||
#ifdef alphaTestFlag | ||
if (gl_FragColor.a <= v_alphaTest) | ||
discard; | ||
#endif | ||
#else | ||
gl_FragColor.a = 1.0; | ||
#endif | ||
|
||
} |
Oops, something went wrong.