/* Class111 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import jaggl.OpenGL;

public class Class111
{
    static final String aString1437
	= "uniform float rcpRelief;\nuniform vec2 sampleSize;\nuniform sampler3D heightMap;\nvoid main() {\nfloat dx = texture3D(heightMap, vec3(-sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r;\nfloat dy = texture3D(heightMap, vec3(0.0, -sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(0.0, sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r;\ngl_FragColor = vec4(0.5+normalize(vec3(dx, dy, rcpRelief))*0.5, texture3D(heightMap, gl_TexCoord[0].xyz).r);\n}\n";
    Class151_Sub3 aClass151_Sub3_1438;
    Class90 aClass90_1439;
    
    boolean method1474(Class100_Sub4 class100_sub4,
		       Class100_Sub4 class100_sub4_0_, float f) {
	if (!method1475())
	    return false;
	Class144_Sub2_Sub1 class144_sub2_sub1
	    = (((Class151_Sub3) ((Class111) this).aClass151_Sub3_1438)
	       .aClass144_Sub2_Sub1_9389);
	Class487_Sub35_Sub3 class487_sub35_sub3
	    = new Class487_Sub35_Sub3(((Class111) this).aClass151_Sub3_1438,
				      Class116.aClass116_1448,
				      Class155.aClass155_1894,
				      (((Class100_Sub4) class100_sub4)
				       .anInt8603),
				      (((Class100_Sub4) class100_sub4)
				       .anInt8602));
	boolean bool = false;
	((Class111) this).aClass151_Sub3_1438.method2014(class144_sub2_sub1,
							 (byte) -80);
	class144_sub2_sub1.method8672(0, class487_sub35_sub3);
	if (class144_sub2_sub1.method8673()) {
	    OpenGL.glPushMatrix();
	    OpenGL.glLoadIdentity();
	    OpenGL.glMatrixMode(5889);
	    OpenGL.glPushMatrix();
	    OpenGL.glLoadIdentity();
	    OpenGL.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
	    OpenGL.glPushAttrib(2048);
	    OpenGL.glViewport(0, 0, ((Class100_Sub4) class100_sub4).anInt8603,
			      ((Class100_Sub4) class100_sub4).anInt8602);
	    OpenGL.glUseProgram(((Class90) ((Class111) this).aClass90_1439)
				.anInt1234);
	    OpenGL.glUniform1i(OpenGL.glGetUniformLocation((((Class90)
							     (((Class111) this)
							      .aClass90_1439))
							    .anInt1234),
							   "heightMap"),
			       0);
	    OpenGL.glUniform1f(OpenGL.glGetUniformLocation((((Class90)
							     (((Class111) this)
							      .aClass90_1439))
							    .anInt1234),
							   "rcpRelief"),
			       1.0F / f);
	    OpenGL.glUniform2f
		(OpenGL.glGetUniformLocation((((Class90)
					       ((Class111) this).aClass90_1439)
					      .anInt1234),
					     "sampleSize"),
		 1.0F / (float) ((Class100_Sub4) class100_sub4_0_).anInt8603,
		 1.0F / (float) ((Class100_Sub4) class100_sub4_0_).anInt8602);
	    for (int i = 0; i < ((Class100_Sub4) class100_sub4).anInt8604;
		 i++) {
		float f_1_
		    = ((float) i
		       / (float) ((Class100_Sub4) class100_sub4).anInt8604);
		((Class111) this).aClass151_Sub3_1438
		    .method8591(class100_sub4_0_);
		OpenGL.glBegin(7);
		OpenGL.glTexCoord3f(0.0F, 0.0F, f_1_);
		OpenGL.glVertex2f(0.0F, 0.0F);
		OpenGL.glTexCoord3f(1.0F, 0.0F, f_1_);
		OpenGL.glVertex2f(1.0F, 0.0F);
		OpenGL.glTexCoord3f(1.0F, 1.0F, f_1_);
		OpenGL.glVertex2f(1.0F, 1.0F);
		OpenGL.glTexCoord3f(0.0F, 1.0F, f_1_);
		OpenGL.glVertex2f(0.0F, 1.0F);
		OpenGL.glEnd();
		class100_sub4.method8104
		    (0, 0, i, ((Class100_Sub4) class100_sub4).anInt8603,
		     ((Class100_Sub4) class100_sub4).anInt8602, 0, 0);
	    }
	    OpenGL.glUseProgram(0);
	    OpenGL.glPopAttrib();
	    OpenGL.glPopMatrix();
	    OpenGL.glMatrixMode(5888);
	    OpenGL.glPopMatrix();
	    bool = true;
	}
	class144_sub2_sub1.method8672(0, null);
	((Class111) this).aClass151_Sub3_1438.method2015(class144_sub2_sub1,
							 -1539373076);
	return bool;
    }
    
    Class111(Class151_Sub3 class151_sub3) {
	((Class111) this).aClass151_Sub3_1438 = class151_sub3;
    }
    
    boolean method1475() {
	if (((Class151_Sub3) ((Class111) this).aClass151_Sub3_1438).aBool9364
	    && (((Class151_Sub3) ((Class111) this).aClass151_Sub3_1438)
		.aBool9381)
	    && ((Class111) this).aClass90_1439 == null) {
	    Class102 class102
		= (Class102.method1407
		   (((Class111) this).aClass151_Sub3_1438, 35632,
		    "uniform float rcpRelief;\nuniform vec2 sampleSize;\nuniform sampler3D heightMap;\nvoid main() {\nfloat dx = texture3D(heightMap, vec3(-sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r;\nfloat dy = texture3D(heightMap, vec3(0.0, -sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(0.0, sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r;\ngl_FragColor = vec4(0.5+normalize(vec3(dx, dy, rcpRelief))*0.5, texture3D(heightMap, gl_TexCoord[0].xyz).r);\n}\n"));
	    if (class102 != null)
		((Class111) this).aClass90_1439
		    = Class90.method1246(((Class111) this).aClass151_Sub3_1438,
					 new Class102[] { class102 });
	}
	return ((Class111) this).aClass90_1439 != null;
    }
    
    boolean method1476() {
	if (((Class151_Sub3) ((Class111) this).aClass151_Sub3_1438).aBool9364
	    && (((Class151_Sub3) ((Class111) this).aClass151_Sub3_1438)
		.aBool9381)
	    && ((Class111) this).aClass90_1439 == null) {
	    Class102 class102
		= (Class102.method1407
		   (((Class111) this).aClass151_Sub3_1438, 35632,
		    "uniform float rcpRelief;\nuniform vec2 sampleSize;\nuniform sampler3D heightMap;\nvoid main() {\nfloat dx = texture3D(heightMap, vec3(-sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(sampleSize.x, 0.0, 0.0)+gl_TexCoord[0].xyz).r;\nfloat dy = texture3D(heightMap, vec3(0.0, -sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r - texture3D(heightMap, vec3(0.0, sampleSize.y, 0.0)+gl_TexCoord[0].xyz).r;\ngl_FragColor = vec4(0.5+normalize(vec3(dx, dy, rcpRelief))*0.5, texture3D(heightMap, gl_TexCoord[0].xyz).r);\n}\n"));
	    if (class102 != null)
		((Class111) this).aClass90_1439
		    = Class90.method1246(((Class111) this).aClass151_Sub3_1438,
					 new Class102[] { class102 });
	}
	return ((Class111) this).aClass90_1439 != null;
    }
}
