.. | .. |
---|
110 | 110 | //private Mat4f spotlightTransform = new Mat4f(); |
---|
111 | 111 | //private Mat4f spotlightInverseTransform = new Mat4f(); |
---|
112 | 112 | static GLContext glcontext = null; |
---|
113 | | - /*static*/ com.sun.opengl.util.texture.Texture cubemap; |
---|
| 113 | + /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb |
---|
| 114 | + /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom; |
---|
| 115 | + /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb; |
---|
| 116 | + boolean transformMode; |
---|
| 117 | + |
---|
114 | 118 | boolean reverseUP = false; |
---|
115 | 119 | static boolean frozen = false; |
---|
116 | 120 | boolean enablebackspace = false; // patch for back buffer refresh |
---|
.. | .. |
---|
164 | 168 | |
---|
165 | 169 | |
---|
166 | 170 | // OPTIONS |
---|
167 | | - boolean Skinshader = true; |
---|
| 171 | + boolean Skinshader = false; // true; |
---|
168 | 172 | boolean cameraLight = false; |
---|
169 | 173 | boolean UVdebug = false; |
---|
170 | 174 | boolean Udebug = false; |
---|
.. | .. |
---|
173 | 177 | static boolean doublesided = false; // true; // reversed normals are awful for conformance |
---|
174 | 178 | boolean anisotropy = true; |
---|
175 | 179 | boolean softshadow = true; // slower but better false; |
---|
176 | | - boolean opacityhalo = false; |
---|
| 180 | + boolean opacityhalo = false; // reverse the halo effect (e.g. glass) |
---|
177 | 181 | |
---|
178 | 182 | boolean macromode = false; |
---|
179 | 183 | |
---|
.. | .. |
---|
188 | 192 | |
---|
189 | 193 | private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
190 | 194 | |
---|
191 | | - public void LoadSkybox(String name, String ext, boolean mipmap) throws GLException |
---|
| 195 | + public com.sun.opengl.util.texture.Texture LoadSkybox(String name, String ext, boolean mipmap) throws GLException |
---|
192 | 196 | { |
---|
193 | 197 | try |
---|
194 | 198 | { |
---|
195 | | - cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap); |
---|
| 199 | + return LoadCubemap(getClass().getClassLoader(), name, ext, mipmap); |
---|
196 | 200 | } catch (IOException e) |
---|
197 | 201 | { |
---|
198 | 202 | System.out.println("NAME = " + name); |
---|
199 | 203 | e.printStackTrace(); // throw new RuntimeException(e); |
---|
| 204 | + return null; |
---|
200 | 205 | } |
---|
201 | 206 | } |
---|
202 | 207 | |
---|
.. | .. |
---|
2047 | 2052 | switch(viewcode) |
---|
2048 | 2053 | { |
---|
2049 | 2054 | case 0: return "main"; |
---|
2050 | | - case 1: return "one"; |
---|
2051 | | - case 2: return "two"; |
---|
2052 | | - case 3: return "three"; |
---|
| 2055 | + case 1: return "Red"; |
---|
| 2056 | + case 2: return "Green"; |
---|
| 2057 | + case 3: return "Blue"; |
---|
2053 | 2058 | case 4: return "light"; |
---|
2054 | 2059 | } |
---|
2055 | 2060 | |
---|
.. | .. |
---|
2512 | 2517 | com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
2513 | 2518 | getClass().getClassLoader().getResourceAsStream(name), |
---|
2514 | 2519 | true, |
---|
2515 | | - com.sun.opengl.util.texture.TextureIO.PNG); |
---|
| 2520 | + GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2516 | 2521 | } catch (java.io.IOException e) |
---|
2517 | 2522 | { |
---|
2518 | 2523 | throw new javax.media.opengl.GLException(e); |
---|
.. | .. |
---|
8358 | 8363 | // else |
---|
8359 | 8364 | // if (!texname.startsWith("/")) |
---|
8360 | 8365 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8361 | | - if (!FileExists(texname)) |
---|
| 8366 | + if (!FileExists(texname) && !texname.startsWith("@")) |
---|
8362 | 8367 | { |
---|
8363 | 8368 | texname = fallbackTextureName; |
---|
8364 | 8369 | } |
---|
.. | .. |
---|
8441 | 8446 | new Exception().printStackTrace(); |
---|
8442 | 8447 | } else |
---|
8443 | 8448 | { |
---|
| 8449 | + if (texname.startsWith("@")) |
---|
| 8450 | + { |
---|
| 8451 | + // texturecache = textures.get(texname); // suspicious |
---|
| 8452 | + if (texturecache == null) |
---|
| 8453 | + texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution); |
---|
| 8454 | + else |
---|
| 8455 | + new Exception().printStackTrace(); |
---|
| 8456 | + } else |
---|
| 8457 | + { |
---|
8444 | 8458 | if (textureon) |
---|
8445 | 8459 | { |
---|
8446 | 8460 | String cachename = texname; |
---|
.. | .. |
---|
8500 | 8514 | texturecache = new CacheTexture(texturedata,resolution); |
---|
8501 | 8515 | //texture = GetTexture(tex, bump); |
---|
8502 | 8516 | } |
---|
| 8517 | + } |
---|
8503 | 8518 | } |
---|
8504 | 8519 | //} |
---|
8505 | 8520 | } |
---|
.. | .. |
---|
8768 | 8783 | |
---|
8769 | 8784 | gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0); |
---|
8770 | 8785 | MAXSTACK = temp[0]; |
---|
8771 | | - System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
| 8786 | + if (Globals.DEBUG) |
---|
| 8787 | + System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
8772 | 8788 | gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0); |
---|
8773 | 8789 | MAXSTACK = temp[0]; |
---|
8774 | | - System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
| 8790 | + if (Globals.DEBUG) |
---|
| 8791 | + System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
8775 | 8792 | |
---|
8776 | 8793 | // Use debug pipeline |
---|
8777 | 8794 | //drawable.setGL(new DebugGL(gl)); // |
---|
.. | .. |
---|
8779 | 8796 | gl = drawable.getGL(); // |
---|
8780 | 8797 | |
---|
8781 | 8798 | GL gl3 = getGL(); |
---|
8782 | | - System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
| 8799 | + if (Globals.DEBUG) |
---|
| 8800 | + System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
8783 | 8801 | |
---|
8784 | 8802 | |
---|
8785 | 8803 | //float pos[] = { 100, 100, 100, 0 }; |
---|
.. | .. |
---|
9220 | 9238 | |
---|
9221 | 9239 | void LoadEnvy(int which) |
---|
9222 | 9240 | { |
---|
| 9241 | + assert(false); |
---|
| 9242 | + |
---|
9223 | 9243 | String name; |
---|
9224 | 9244 | String ext; |
---|
9225 | 9245 | |
---|
.. | .. |
---|
10670 | 10690 | static boolean init = false; |
---|
10671 | 10691 | |
---|
10672 | 10692 | double[][] matrix = LA.newMatrix(); |
---|
| 10693 | + |
---|
| 10694 | + // This is to refresh the UI of the material panel. |
---|
| 10695 | + ObjEditor patchMaterial; |
---|
10673 | 10696 | |
---|
10674 | 10697 | public void display(GLAutoDrawable drawable) |
---|
10675 | 10698 | { |
---|
| 10699 | + if (patchMaterial.patchMaterial) |
---|
| 10700 | + { |
---|
| 10701 | + patchMaterial.patchMaterial = false; |
---|
| 10702 | + patchMaterial.objectPanel.setSelectedIndex(0); |
---|
| 10703 | + } |
---|
| 10704 | + |
---|
10676 | 10705 | if (Grafreed.savesound && Grafreed.hassound) |
---|
10677 | 10706 | { |
---|
10678 | 10707 | Grafreed.wav.save(); |
---|
.. | .. |
---|
10841 | 10870 | |
---|
10842 | 10871 | if (wait) |
---|
10843 | 10872 | { |
---|
10844 | | - Sleep(500); |
---|
| 10873 | + Sleep(200); // blocks everything |
---|
10845 | 10874 | |
---|
10846 | 10875 | wait = false; |
---|
10847 | 10876 | } |
---|
.. | .. |
---|
11064 | 11093 | // |
---|
11065 | 11094 | // newenvy = -1; |
---|
11066 | 11095 | |
---|
11067 | | - if (object.skyboxname != null) |
---|
| 11096 | + if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
11068 | 11097 | { |
---|
11069 | | - if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
| 11098 | + if (cubemaprgb == null) |
---|
11070 | 11099 | { |
---|
11071 | | - LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11072 | | - loadedskyboxname = object.skyboxname; |
---|
| 11100 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false); |
---|
11073 | 11101 | } |
---|
| 11102 | + |
---|
| 11103 | + cubemap = cubemaprgb; |
---|
11074 | 11104 | } |
---|
11075 | 11105 | else |
---|
11076 | 11106 | { |
---|
11077 | | - cubemap = null; |
---|
11078 | | - loadedskyboxname = null; |
---|
| 11107 | + if (object.skyboxname != null) |
---|
| 11108 | + { |
---|
| 11109 | + if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
| 11110 | + { |
---|
| 11111 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11112 | + cubemap.dispose(); |
---|
| 11113 | + cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11114 | + loadedskyboxname = object.skyboxname; |
---|
| 11115 | + } |
---|
| 11116 | + } |
---|
| 11117 | + else |
---|
| 11118 | + { |
---|
| 11119 | + cubemapcustom = null; |
---|
| 11120 | + loadedskyboxname = null; |
---|
| 11121 | + } |
---|
| 11122 | + |
---|
| 11123 | + cubemap = cubemapcustom; |
---|
11079 | 11124 | } |
---|
11080 | 11125 | |
---|
11081 | 11126 | ratio = ((double) getWidth()) / getHeight(); |
---|
.. | .. |
---|
13383 | 13428 | program = programmin; |
---|
13384 | 13429 | } |
---|
13385 | 13430 | |
---|
13386 | | - System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
13387 | | - System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13431 | + if (Globals.DEBUG) |
---|
| 13432 | + { |
---|
| 13433 | + System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
| 13434 | + System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
| 13435 | + } |
---|
| 13436 | + |
---|
13388 | 13437 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13389 | 13438 | |
---|
13390 | 13439 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
13431 | 13480 | "\n" + |
---|
13432 | 13481 | "END\n"; |
---|
13433 | 13482 | |
---|
13434 | | - System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
| 13483 | + if (Globals.DEBUG) |
---|
| 13484 | + System.out.println("Program shadow #" + 0 + "; length = " + program.length()); |
---|
13435 | 13485 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
13436 | 13486 | |
---|
13437 | 13487 | //gl.glNewList(displayListID, GL.GL_COMPILE); |
---|
.. | .. |
---|
14630 | 14680 | void GoDown(int mod) |
---|
14631 | 14681 | { |
---|
14632 | 14682 | MODIFIERS |= COMMAND; |
---|
| 14683 | + boolean isVR = (mouseMode&VR)!=0; |
---|
14633 | 14684 | /**/ |
---|
14634 | 14685 | if((mod&SHIFT) == SHIFT) |
---|
14635 | | - manipCamera.RotatePosition(0, -speed); |
---|
| 14686 | + { |
---|
| 14687 | + if (isVR) |
---|
| 14688 | + manipCamera.RotateInterest(0, -speed); |
---|
| 14689 | + else |
---|
| 14690 | + manipCamera.RotatePosition(0, -speed); |
---|
| 14691 | + } |
---|
14636 | 14692 | else |
---|
14637 | | - manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14693 | + manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth()); |
---|
14638 | 14694 | /**/ |
---|
14639 | 14695 | if ((mod & SHIFT) == SHIFT) |
---|
14640 | 14696 | { |
---|
.. | .. |
---|
14644 | 14700 | mouseMode |= BACKFORTH; |
---|
14645 | 14701 | } |
---|
14646 | 14702 | |
---|
| 14703 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14704 | + |
---|
14647 | 14705 | //prevX = X = anchorX; |
---|
14648 | 14706 | prevY = Y = anchorY - (int) (renderCamera.Distance()); |
---|
14649 | 14707 | } |
---|
.. | .. |
---|
14652 | 14710 | { |
---|
14653 | 14711 | MODIFIERS |= COMMAND; |
---|
14654 | 14712 | /**/ |
---|
| 14713 | + boolean isVR = (mouseMode&VR)!=0; |
---|
| 14714 | + |
---|
14655 | 14715 | if((mod&SHIFT) == SHIFT) |
---|
14656 | | - manipCamera.RotatePosition(0, speed); |
---|
| 14716 | + { |
---|
| 14717 | + if (isVR) |
---|
| 14718 | + manipCamera.RotateInterest(0, speed); |
---|
| 14719 | + else |
---|
| 14720 | + manipCamera.RotatePosition(0, speed); |
---|
| 14721 | + } |
---|
14657 | 14722 | else |
---|
14658 | | - manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14723 | + manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth()); |
---|
14659 | 14724 | /**/ |
---|
14660 | 14725 | if ((mod & SHIFT) == SHIFT) |
---|
14661 | 14726 | { |
---|
.. | .. |
---|
14665 | 14730 | mouseMode |= BACKFORTH; |
---|
14666 | 14731 | } |
---|
14667 | 14732 | |
---|
| 14733 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14734 | + |
---|
14668 | 14735 | //prevX = X = anchorX; |
---|
14669 | 14736 | prevY = Y = anchorY + (int) (renderCamera.Distance()); |
---|
14670 | 14737 | } |
---|
.. | .. |
---|
14674 | 14741 | MODIFIERS |= COMMAND; |
---|
14675 | 14742 | /**/ |
---|
14676 | 14743 | if((mod&SHIFT) == SHIFT) |
---|
14677 | | - manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
| 14744 | + manipCamera.Translate(speed*delta, 0, getWidth()); |
---|
14678 | 14745 | else |
---|
14679 | | - manipCamera.RotatePosition(speed, 0); |
---|
| 14746 | + { |
---|
| 14747 | + if ((mouseMode&VR)!=0) |
---|
| 14748 | + manipCamera.RotateInterest(-speed, 0); |
---|
| 14749 | + else |
---|
| 14750 | + manipCamera.RotatePosition(speed, 0); |
---|
| 14751 | + } |
---|
14680 | 14752 | /**/ |
---|
14681 | 14753 | if ((mod & SHIFT) == SHIFT) |
---|
14682 | 14754 | { |
---|
.. | .. |
---|
14686 | 14758 | mouseMode |= ROTATE; |
---|
14687 | 14759 | } // TRANSLATE; |
---|
14688 | 14760 | |
---|
| 14761 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14762 | + |
---|
14689 | 14763 | prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance()); |
---|
14690 | 14764 | prevY = Y = anchorY; |
---|
14691 | 14765 | } |
---|
.. | .. |
---|
14695 | 14769 | MODIFIERS |= COMMAND; |
---|
14696 | 14770 | /**/ |
---|
14697 | 14771 | if((mod&SHIFT) == SHIFT) |
---|
14698 | | - manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
| 14772 | + manipCamera.Translate(-speed*delta, 0, getWidth()); |
---|
14699 | 14773 | else |
---|
14700 | | - manipCamera.RotatePosition(-speed, 0); |
---|
| 14774 | + { |
---|
| 14775 | + if ((mouseMode&VR)!=0) |
---|
| 14776 | + manipCamera.RotateInterest(speed, 0); |
---|
| 14777 | + else |
---|
| 14778 | + manipCamera.RotatePosition(-speed, 0); |
---|
| 14779 | + } |
---|
| 14780 | + |
---|
14701 | 14781 | /**/ |
---|
14702 | 14782 | if ((mod & SHIFT) == SHIFT) |
---|
14703 | 14783 | { |
---|
.. | .. |
---|
14707 | 14787 | mouseMode |= ROTATE; |
---|
14708 | 14788 | } // TRANSLATE; |
---|
14709 | 14789 | |
---|
| 14790 | + targetLookAt.set(manipCamera.lookAt); |
---|
| 14791 | + |
---|
14710 | 14792 | prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance()); |
---|
14711 | 14793 | prevY = Y = anchorY; |
---|
14712 | 14794 | } |
---|
.. | .. |
---|
15209 | 15291 | case 'K': |
---|
15210 | 15292 | KOMPACTTEXTURE ^= true; |
---|
15211 | 15293 | //textures.clear(); |
---|
15212 | | - break; |
---|
15213 | | - case 'P': // Texture Projection macros |
---|
| 15294 | + // break; |
---|
| 15295 | + //case 'P': // Texture Projection macros |
---|
15214 | 15296 | // SAVETEXTURE ^= true; |
---|
15215 | 15297 | macromode = true; |
---|
15216 | 15298 | Udebug = Vdebug = NORMALdebug = false; programInitialized = false; |
---|
.. | .. |
---|
15331 | 15413 | targetLookAt.set(manipCamera.lookAt); |
---|
15332 | 15414 | repaint(); |
---|
15333 | 15415 | break; |
---|
15334 | | - case 'p': |
---|
| 15416 | + case 'P': // p': |
---|
15335 | 15417 | // c'est quoi ca au juste? spherical ^= true; |
---|
15336 | 15418 | Skinshader ^= true; programInitialized = false; |
---|
15337 | 15419 | repaint(); |
---|
.. | .. |
---|
16091 | 16173 | { |
---|
16092 | 16174 | switch (hitSomething) |
---|
16093 | 16175 | { |
---|
16094 | | - case Object3D.hitCenter: gr.setColor(Color.pink); |
---|
| 16176 | + case Object3D.hitCenter: gr.setColor(Color.white); |
---|
16095 | 16177 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16096 | 16178 | break; |
---|
16097 | 16179 | case Object3D.hitRotate: gr.setColor(Color.yellow); |
---|
.. | .. |
---|
16117 | 16199 | if (hasMarquee) |
---|
16118 | 16200 | { |
---|
16119 | 16201 | gr.setXORMode(Color.white); |
---|
16120 | | - gr.setColor(Color.red); |
---|
| 16202 | + gr.setColor(Color.white); |
---|
16121 | 16203 | if (!firstime) |
---|
16122 | 16204 | { |
---|
16123 | 16205 | gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH); |
---|
.. | .. |
---|
16657 | 16739 | private void DrawSkyBox(GL gl, float ratio) |
---|
16658 | 16740 | { |
---|
16659 | 16741 | if (//envyoff || |
---|
| 16742 | + WIREFRAME || |
---|
16660 | 16743 | cubemap == null) |
---|
16661 | 16744 | { |
---|
16662 | 16745 | gl.glClearColor(BGcolor, BGcolor, BGcolor, 1); |
---|
.. | .. |
---|
16755 | 16838 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16756 | 16839 | |
---|
16757 | 16840 | cubemap.disable(); |
---|
16758 | | - ////cubemap.unbind(); |
---|
| 16841 | + //cubemap.dispose(); |
---|
| 16842 | + |
---|
16759 | 16843 | if (CULLFACE) |
---|
16760 | 16844 | { |
---|
16761 | 16845 | gl.glEnable(gl.GL_CULL_FACE); |
---|
.. | .. |
---|
17291 | 17375 | |
---|
17292 | 17376 | public void init(GLAutoDrawable drawable) |
---|
17293 | 17377 | { |
---|
| 17378 | + if (Globals.DEBUG) |
---|
17294 | 17379 | System.out.println("shadow buffer init"); |
---|
17295 | 17380 | |
---|
17296 | 17381 | GL gl = drawable.getGL(); |
---|
.. | .. |
---|
17519 | 17604 | gl.glFlush(); |
---|
17520 | 17605 | |
---|
17521 | 17606 | /**/ |
---|
17522 | | - gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer); |
---|
| 17607 | + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer); |
---|
17523 | 17608 | |
---|
17524 | | - float[] pixels = occlusionsizebuffer.array(); |
---|
| 17609 | + float[] depths = occlusiondepthbuffer.array(); |
---|
17525 | 17610 | |
---|
| 17611 | + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer); |
---|
| 17612 | + |
---|
| 17613 | + int[] pixels = selectsizebuffer.array(); |
---|
| 17614 | + |
---|
17526 | 17615 | double r = 0, g = 0, b = 0; |
---|
17527 | 17616 | |
---|
17528 | 17617 | double count = 0; |
---|
.. | .. |
---|
17533 | 17622 | |
---|
17534 | 17623 | double FACTOR = 1; |
---|
17535 | 17624 | |
---|
17536 | | - for (int i = 0; i < pixels.length; i++) |
---|
| 17625 | + for (int i = 0; i < depths.length; i++) |
---|
17537 | 17626 | { |
---|
17538 | 17627 | int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2; |
---|
17539 | 17628 | int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2; |
---|
.. | .. |
---|
17616 | 17705 | |
---|
17617 | 17706 | double scale = ray.z; // 1; // cos |
---|
17618 | 17707 | |
---|
17619 | | - float depth = pixels[newindex]; |
---|
| 17708 | + float depth = depths[newindex]; |
---|
17620 | 17709 | |
---|
17621 | 17710 | /* |
---|
17622 | 17711 | int newindex2 = (x + 1) * OCCLUSION_SIZE + y; |
---|
.. | .. |
---|
17813 | 17902 | static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE); |
---|
17814 | 17903 | static IntBuffer bigAAbuffer; |
---|
17815 | 17904 | static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3); |
---|
17816 | | - static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); |
---|
| 17905 | + //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); |
---|
17817 | 17906 | static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
17818 | 17907 | static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE); |
---|
17819 | 17908 | //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
17820 | | - static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17909 | + static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17910 | + |
---|
| 17911 | + static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); |
---|
| 17912 | + |
---|
17821 | 17913 | static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB); |
---|
17822 | 17914 | static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); |
---|
17823 | 17915 | static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>(); |
---|