From 564f4d12d93813b5d680fc24d4f118c3886d96ed Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 20 Aug 2019 19:56:41 -0400 Subject: [PATCH] Parallax mapping! --- CameraPane.java | 71 +++++++++++++++++++++++++++-------- 1 files changed, 55 insertions(+), 16 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index 8acf68e..e8611a1 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -168,7 +168,7 @@ // OPTIONS - boolean Skinshader = true; + boolean Skinshader = false; // true; boolean cameraLight = false; boolean UVdebug = false; boolean Udebug = false; @@ -1819,7 +1819,7 @@ display.modelParams7[0] = 0; display.modelParams7[1] = 1000; - display.modelParams7[2] = 0; + display.modelParams7[2] = material.parallax; display.modelParams7[3] = 0; //display.modelParams6[0] = 100; // criss de bug de bump @@ -2052,9 +2052,9 @@ switch(viewcode) { case 0: return "main"; - case 1: return "one"; - case 2: return "two"; - case 3: return "three"; + case 1: return "Red"; + case 2: return "Green"; + case 3: return "Blue"; case 4: return "light"; } @@ -10690,9 +10690,18 @@ static boolean init = false; double[][] matrix = LA.newMatrix(); + + // This is to refresh the UI of the material panel. + ObjEditor patchMaterial; public void display(GLAutoDrawable drawable) { + if (patchMaterial.patchMaterial) + { + patchMaterial.patchMaterial = false; + patchMaterial.objectPanel.setSelectedIndex(1); + } + if (Grafreed.savesound && Grafreed.hassound) { Grafreed.wav.save(); @@ -12584,7 +12593,7 @@ "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough - "PARAM params7 = program.env[7];" + // noise power, opacity power + "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax "PARAM options0 = program.env[63];" + // fog density, intensity, elevation "PARAM options1 = program.env[62];" + // fog rgb color "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen @@ -12829,7 +12838,7 @@ "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut // mar 2013 ??? "KIL alpha.a;" + "MOV alpha, texSamp.aaaa;" + // y;" + - "KIL alpha.a;" + + "KIL alpha.a;" + // not sure with parallax mapping /* "MUL temp.xy, temp, two;" + "TXB bump, temp, texture[0], 2D;" + @@ -12915,11 +12924,6 @@ "SUB bump0, bump0, half;" + "ADD bump, bump, bump0;" + - "MOV temp.x, texSamp.a;" + - "LRP texSamp, params5.x, texSamp, one;" + // texture proportion - //"LRP texSamp0, params5.x, texSamp0, one;" + - "MOV texSamp.a, temp.x;" + - // double-sided /**/ (doublesided?"DP3 temp.z, normal, eye;" + @@ -12949,6 +12953,41 @@ Normalize("U") + // parallax mapping + + "DP3 temp2.x, V, eye;" + + "DP3 temp2.y, U, eye;" + + "DP3 temp2.z, normal, eye;" + + "RCP temp2.z, temp2.z;" + + + "DP3 temp2.w, texSamp, texSamp;" + // Height + "RSQ temp2.w, temp2.w;" + + "RCP temp2.w, temp2.w;" + + + "SUB temp2.w, temp2.w, half;" + +// "SGE temp.x, temp2.w, eps.x;" + +// "MUL temp2.w, temp2.w, temp.x;" + + + //"MOV texSamp, U;" + + + "MUL temp2.z, temp2.z, temp2.w;" + + "MUL temp2.z, temp2.z, params7.z;" + // parallax + + "MUL temp2, temp2, temp2.z;" + + + "MOV temp, fragment.texcoord[0];" + + + "SUB temp, temp, temp2;" + + + "TEX texSamp, temp, texture[0], 2D;" + + "POW texSamp.a, texSamp.a, params6.w;" + // punch through + "MOV alpha, texSamp.aaaa;" + + +// parallax mapping + + "MOV temp.x, texSamp.a;" + + "LRP texSamp, params5.x, texSamp, one;" + // texture proportion + //"LRP texSamp0, params5.x, texSamp0, one;" + + "MOV texSamp.a, temp.x;" + //"MOV temp, fragment.texcoord[0];" + // @@ -13730,7 +13769,7 @@ /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough - /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power + /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax //Object3D.cVector2[] vector2buffer; @@ -15282,8 +15321,8 @@ case 'K': KOMPACTTEXTURE ^= true; //textures.clear(); - break; - case 'P': // Texture Projection macros + // break; + //case 'P': // Texture Projection macros // SAVETEXTURE ^= true; macromode = true; Udebug = Vdebug = NORMALdebug = false; programInitialized = false; @@ -15404,7 +15443,7 @@ targetLookAt.set(manipCamera.lookAt); repaint(); break; - case 'p': + case 'P': // p': // c'est quoi ca au juste? spherical ^= true; Skinshader ^= true; programInitialized = false; repaint(); -- Gitblit v1.6.2