better glsl usage and added default config options

This commit is contained in:
MachineMuse 2013-05-16 23:15:06 -06:00
parent 016925f507
commit 505a0427e0
7 changed files with 15 additions and 11 deletions

View file

@ -1,8 +1,8 @@
#version 150 #version 150
uniform sampler2D depth; uniform sampler2D depth;
varying vec2 texcoord;
void main() { void main() {
vec2 coords = vec2(gl_TexCoord[0].x, gl_TexCoord[0].y); gl_FragDepth = texture(depth, texcoord).r;
gl_FragDepth = texture(depth, coords).r;
gl_FragColor = vec4(0.0); gl_FragColor = vec4(0.0);
} }

View file

@ -2,15 +2,15 @@
uniform sampler2D depth; uniform sampler2D depth;
uniform sampler2D occlusion; uniform sampler2D occlusion;
uniform sampler2D texture; uniform sampler2D texture;
varying vec2 texcoord;
void main() { void main() {
vec2 coords = vec2(gl_TexCoord[0].x, gl_TexCoord[0].y); float depth = texture(depth, texcoord).r - 0.001;
float depth = texture(depth, coords).r - 0.001; float occlusion = texture(occlusion, texcoord).r;
float occlusion = texture(occlusion, coords).r;
vec4 color = vec4(0.0); vec4 color = vec4(0.0);
float writedepth = occlusion; float writedepth = occlusion;
if(depth <= occlusion) { if(depth <= occlusion) {
color = texture(texture, coords); color = texture(texture, texcoord);
// color = vec4(1.0); // color = vec4(1.0);
writedepth = depth; writedepth = depth;
} }

View file

@ -1,6 +1,6 @@
varying vec2 texcoord;
void main(){ void main(){
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0; texcoord = vec2(gl_MultiTexCoord0.x, gl_MultiTexCoord0.y);
} }

View file

@ -1,6 +1,7 @@
#version 150 #version 150
uniform vec2 u_Scale; uniform vec2 u_Scale;
uniform sampler2D u_Texture0; uniform sampler2D u_Texture0;
varying vec2 texcoord;
const float gaussFilter[50] = float[50]( const float gaussFilter[50] = float[50](
-12.0, 1.0/16777216.0, -12.0, 1.0/16777216.0,
@ -37,7 +38,7 @@ void main() {
for( int i = 0; i < 25; i++ ) for( int i = 0; i < 25; i++ )
{ {
vec4 pix = texture( u_Texture0, vec4 pix = texture( u_Texture0,
vec2(gl_TexCoord[0].x+gaussFilter[i*2]*u_Scale.x, gl_TexCoord[0].y+gaussFilter[i*2]*u_Scale.y ) vec2(texcoord.x+gaussFilter[i*2]*u_Scale.x, texcoord.y+gaussFilter[i*2]*u_Scale.y )
); );
wt = gaussFilter[i*2+1] * pix.w * 1.5; wt = gaussFilter[i*2+1] * pix.w * 1.5;
color += wt * pix; color += wt * pix;

View file

@ -1,6 +1,7 @@
#version 150 #version 150
varying vec2 texcoord;
void main(){ void main(){
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0; texcoord = vec2(gl_MultiTexCoord0.x, gl_MultiTexCoord0.y);
} }

View file

@ -298,7 +298,7 @@ public class Config {
} }
public static int glowMultiplier() { public static int glowMultiplier() {
return config.get("Graphics", "Bloom Multiplier", 1).getInt(1); return config.get("Graphics", "Bloom Multiplier", 3).getInt(3);
} }
public static boolean useShaders() { public static boolean useShaders() {

View file

@ -141,6 +141,8 @@ public class ModularPowersuits {
Config.fontAntiAliasing(); Config.fontAntiAliasing();
Config.useCustomFonts(); Config.useCustomFonts();
Config.useSounds(); Config.useSounds();
Config.glowMultiplier();
Config.useShaders();
EntityRegistry.registerModEntity(EntityPlasmaBolt.class, "entityPlasmaBolt", 2477, this, 64, 20, true); EntityRegistry.registerModEntity(EntityPlasmaBolt.class, "entityPlasmaBolt", 2477, this, 64, 20, true);
EntityRegistry.registerModEntity(EntitySpinningBlade.class, "entitySpinningBlade", 2478, this, 64, 20, true); EntityRegistry.registerModEntity(EntitySpinningBlade.class, "entitySpinningBlade", 2478, this, 64, 20, true);