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

public class Class153
{
    Class87_Sub1 aClass87_Sub1_1745;
    Class145 aClass145_1746;
    static final String aString1747
	= "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";
    
    boolean method3665() {
	if (((Class87_Sub1) ((Class153) this).aClass87_Sub1_1745).aBool8979
	    && ((Class87_Sub1) ((Class153) this).aClass87_Sub1_1745).aBool8994
	    && ((Class153) this).aClass145_1746 == null) {
	    Class155 class155
		= (Class155.method3687
		   (((Class153) this).aClass87_Sub1_1745, 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 (class155 != null)
		((Class153) this).aClass145_1746
		    = Class145.method3524(((Class153) this).aClass87_Sub1_1745,
					  new Class155[] { class155 });
	}
	return ((Class153) this).aClass145_1746 != null;
    }
    
    boolean method3666(Class141_Sub2 class141_sub2,
		       Class141_Sub2 class141_sub2_0_, float f) {
	if (!method3665())
	    return false;
	Class169_Sub2_Sub2 class169_sub2_sub2
	    = (((Class87_Sub1) ((Class153) this).aClass87_Sub1_1745)
	       .aClass169_Sub2_Sub2_9001);
	Class243_Sub11_Sub18 class243_sub11_sub18
	    = new Class243_Sub11_Sub18(((Class153) this).aClass87_Sub1_1745,
				       Class173.aClass173_2131,
				       Class90.aClass90_1040,
				       (((Class141_Sub2) class141_sub2)
					.anInt10403),
				       (((Class141_Sub2) class141_sub2)
					.anInt10402));
	boolean bool = false;
	((Class153) this).aClass87_Sub1_1745.method2272(class169_sub2_sub2,
							(byte) 73);
	class169_sub2_sub2.method15850(0, class243_sub11_sub18);
	if (class169_sub2_sub2.method15851()) {
	    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, ((Class141_Sub2) class141_sub2).anInt10403,
			      ((Class141_Sub2) class141_sub2).anInt10402);
	    OpenGL.glUseProgram(((Class145) ((Class153) this).aClass145_1746)
				.anInt1718);
	    OpenGL.glUniform1i(OpenGL.glGetUniformLocation((((Class145)
							     (((Class153) this)
							      .aClass145_1746))
							    .anInt1718),
							   "heightMap"),
			       0);
	    OpenGL.glUniform1f(OpenGL.glGetUniformLocation((((Class145)
							     (((Class153) this)
							      .aClass145_1746))
							    .anInt1718),
							   "rcpRelief"),
			       1.0F / f);
	    OpenGL.glUniform2f
		(OpenGL.glGetUniformLocation((((Class145) (((Class153) this)
							   .aClass145_1746))
					      .anInt1718),
					     "sampleSize"),
		 1.0F / (float) ((Class141_Sub2) class141_sub2_0_).anInt10403,
		 1.0F / (float) ((Class141_Sub2) class141_sub2_0_).anInt10402);
	    for (int i = 0; i < ((Class141_Sub2) class141_sub2).anInt10401;
		 i++) {
		float f_1_
		    = ((float) i
		       / (float) ((Class141_Sub2) class141_sub2).anInt10401);
		((Class153) this).aClass87_Sub1_1745
		    .method15019(class141_sub2_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();
		class141_sub2.method16782
		    (0, 0, i, ((Class141_Sub2) class141_sub2).anInt10403,
		     ((Class141_Sub2) class141_sub2).anInt10402, 0, 0);
	    }
	    OpenGL.glUseProgram(0);
	    OpenGL.glPopAttrib();
	    OpenGL.glPopMatrix();
	    OpenGL.glMatrixMode(5888);
	    OpenGL.glPopMatrix();
	    bool = true;
	}
	class169_sub2_sub2.method15850(0, null);
	((Class153) this).aClass87_Sub1_1745.method2101(class169_sub2_sub2,
							1355063896);
	return bool;
    }
    
    Class153(Class87_Sub1 class87_sub1) {
	((Class153) this).aClass87_Sub1_1745 = class87_sub1;
    }
    
    boolean method3667() {
	if (((Class87_Sub1) ((Class153) this).aClass87_Sub1_1745).aBool8979
	    && ((Class87_Sub1) ((Class153) this).aClass87_Sub1_1745).aBool8994
	    && ((Class153) this).aClass145_1746 == null) {
	    Class155 class155
		= (Class155.method3687
		   (((Class153) this).aClass87_Sub1_1745, 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 (class155 != null)
		((Class153) this).aClass145_1746
		    = Class145.method3524(((Class153) this).aClass87_Sub1_1745,
					  new Class155[] { class155 });
	}
	return ((Class153) this).aClass145_1746 != null;
    }
}
