Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30698/src/org/jrman/render Modified Files: Bucket.java DummyBucket.java ImageStore.java MemoryBucket.java Micropolygon.java RenderCanvas.java Renderer.java RendererBoundingBox.java RendererHidden.java RendererNull.java Sample.java SamplePoint.java Sampler.java ShaderVariables.java SimpleMicropolygon.java SmoothMicropolygon.java ZStore.java Log Message: Check for Catmull Clark scheme before trying to instance a Subdivision Mesh. Started reformatting source code to fit in 80 columns, remove tabs and ugly formatting done by Eclipse. Index: ZStore.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ZStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ZStore.java 17 Aug 2003 22:05:39 -0000 1.1 --- ZStore.java 26 Feb 2007 19:35:52 -0000 1.2 *************** *** 1,19 **** /* ! ZStore.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! ZStore.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 35,39 **** } ! public void setDepths(float[] bucketDepths, int x, int y, int w, int h, int rowLength) { for (int row = 0; row < h; row++) { if (y + row < 0 || y + row >= vSize) --- 35,40 ---- } ! public void setDepths(float[] bucketDepths, int x, int y, ! int w, int h, int rowLength) { for (int row = 0; row < h; row++) { if (y + row < 0 || y + row >= vSize) Index: Bucket.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Bucket.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Bucket.java 1 Feb 2007 20:30:14 -0000 1.12 --- Bucket.java 26 Feb 2007 19:35:52 -0000 1.13 *************** *** 1,19 **** /* ! Bucket.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Bucket.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ShaderVariables.java 6 Jul 2005 22:53:24 -0000 1.14 --- ShaderVariables.java 26 Feb 2007 19:35:52 -0000 1.15 *************** *** 1,19 **** /* ! ShaderVariables.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! ShaderVariables.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 116,148 **** Color3f[] c = (Color3f[]) Ci.data; Color3f[] o = (Color3f[]) Oi.data; ! if (attributes.getShadingInterpolation() == ShadingInterpolation.CONSTANT) { for (int col = 0; col < columns - 1; col++) for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; SimpleMicropolygon mp = new SimpleMicropolygon(); ! if (mp ! .init( ! p[offset], ! p[offset + 1], ! p[offset + columns], ! c[offset].x, ! c[offset].y, ! c[offset].z, ! o[offset].x, ! o[offset].y, ! o[offset].z)) rh.addToBuckets(mp); mp = new SimpleMicropolygon(); ! if (mp ! .init( ! p[offset + columns + 1], ! p[offset + 1], ! p[offset + columns], ! c[offset + columns + 1].x, ! c[offset + columns + 1].y, ! c[offset + columns + 1].z, ! o[offset + columns + 1].x, ! o[offset + columns + 1].y, ! o[offset + columns + 1].z)) rh.addToBuckets(mp); } --- 116,145 ---- Color3f[] c = (Color3f[]) Ci.data; Color3f[] o = (Color3f[]) Oi.data; ! if (attributes.getShadingInterpolation() == ! ShadingInterpolation.CONSTANT) { for (int col = 0; col < columns - 1; col++) for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; SimpleMicropolygon mp = new SimpleMicropolygon(); ! if (mp.init(p[offset], ! p[offset + 1], ! p[offset + columns], ! c[offset].x, ! c[offset].y, ! c[offset].z, ! o[offset].x, ! o[offset].y, ! o[offset].z)) rh.addToBuckets(mp); mp = new SimpleMicropolygon(); ! if (mp.init(p[offset + columns + 1], ! p[offset + 1], ! p[offset + columns], ! c[offset + columns + 1].x, ! c[offset + columns + 1].y, ! c[offset + columns + 1].z, ! o[offset + columns + 1].x, ! o[offset + columns + 1].y, ! o[offset + columns + 1].z)) rh.addToBuckets(mp); } *************** *** 152,203 **** int offset = row * columns + col; SmoothMicropolygon mp = new SmoothMicropolygon(); ! if (mp ! .init( ! p[offset], ! p[offset + 1], ! p[offset + columns], ! c[offset].x, ! c[offset].y, ! c[offset].z, ! c[offset + 1].x, ! c[offset + 1].y, ! c[offset + 1].z, ! c[offset + columns].x, ! c[offset + columns].y, ! c[offset + columns].z, ! o[offset].x, ! o[offset].y, ! o[offset].z, ! o[offset + 1].x, ! o[offset + 1].y, ! o[offset + 1].z, ! o[offset + columns].x, ! o[offset + columns].y, ! o[offset + columns].z)) rh.addToBuckets(mp); mp = new SmoothMicropolygon(); ! if (mp ! .init( ! p[offset + columns + 1], ! p[offset + 1], ! p[offset + columns], ! c[offset + columns + 1].x, ! c[offset + columns + 1].y, ! c[offset + columns + 1].z, ! c[offset + 1].x, ! c[offset + 1].y, ! c[offset + 1].z, ! c[offset + columns].x, ! c[offset + columns].y, ! c[offset + columns].z, ! o[offset + columns + 1].x, ! o[offset + columns + 1].y, ! o[offset + columns + 1].z, ! o[offset + 1].x, ! o[offset + 1].y, ! o[offset + 1].z, ! o[offset + columns].x, ! o[offset + columns].y, ! o[offset + columns].z)) rh.addToBuckets(mp); } --- 149,196 ---- int offset = row * columns + col; SmoothMicropolygon mp = new SmoothMicropolygon(); ! if (mp.init(p[offset], ! p[offset + 1], ! p[offset + columns], ! c[offset].x, ! c[offset].y, ! c[offset].z, ! c[offset + 1].x, ! c[offset + 1].y, ! c[offset + 1].z, ! c[offset + columns].x, ! c[offset + columns].y, ! c[offset + columns].z, ! o[offset].x, ! o[offset].y, ! o[offset].z, ! o[offset + 1].x, ! o[offset + 1].y, ! o[offset + 1].z, ! o[offset + columns].x, ! o[offset + columns].y, ! o[offset + columns].z)) rh.addToBuckets(mp); mp = new SmoothMicropolygon(); ! if (mp.init(p[offset + columns + 1], ! p[offset + 1], ! p[offset + columns], ! c[offset + columns + 1].x, ! c[offset + columns + 1].y, ! c[offset + columns + 1].z, ! c[offset + 1].x, ! c[offset + 1].y, ! c[offset + 1].z, ! c[offset + columns].x, ! c[offset + columns].y, ! c[offset + columns].z, ! o[offset + columns + 1].x, ! o[offset + columns + 1].y, ! o[offset + columns + 1].z, ! o[offset + 1].x, ! o[offset + 1].y, ! o[offset + 1].z, ! o[offset + columns].x, ! o[offset + columns].y, ! o[offset + columns].z)) rh.addToBuckets(mp); } Index: Micropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Micropolygon.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Micropolygon.java 13 Jul 2005 04:13:40 -0000 1.22 --- Micropolygon.java 26 Feb 2007 19:35:52 -0000 1.23 *************** *** 1,19 **** /* ! Micropolygon.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! Micropolygon.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Sampler.java 24 Dec 2006 05:25:57 -0000 1.28 --- Sampler.java 26 Feb 2007 19:35:52 -0000 1.29 *************** *** 72,76 **** public static class MaskElement { - float z; --- 72,75 ---- *************** *** 84,88 **** count = 0; } - } --- 83,86 ---- *************** *** 104,109 **** for (int row = 0; row < height; row++) for (int column = 0; column < width; column++) ! samplePoints[row * width + column] = new SamplePoint(this, ! column / pixelWidth + (row / pixelHeight) * bucketWidth); pixelsVisibility = new MaskElement[bucketWidth * bucketHeight]; for (int i = 0; i < pixelsVisibility.length; i++) --- 102,109 ---- for (int row = 0; row < height; row++) for (int column = 0; column < width; column++) ! samplePoints[row * width + column] = ! new SamplePoint(this, ! column / pixelWidth + ! (row / pixelHeight) * bucketWidth); pixelsVisibility = new MaskElement[bucketWidth * bucketHeight]; for (int i = 0; i < pixelsVisibility.length; i++) *************** *** 141,145 **** public void getColors(float[] dst, int dstOffset, int rowLength, int bands, ! int bandOffset) { int destOffset = dstOffset + bandOffset; rowLength *= bands; --- 141,145 ---- public void getColors(float[] dst, int dstOffset, int rowLength, int bands, ! int bandOffset) { int destOffset = dstOffset + bandOffset; rowLength *= bands; Index: ImageStore.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ImageStore.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageStore.java 20 Dec 2003 15:35:05 -0000 1.7 --- ImageStore.java 26 Feb 2007 19:35:52 -0000 1.8 *************** *** 1,19 **** /* ! ImageStore.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! ImageStore.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 41,51 **** this.vSize = vSize; if (display.getMode() == Display.Mode.RGB) ! image = new BufferedImage(hSize, vSize, BufferedImage.TYPE_INT_RGB); else ! image = new BufferedImage(hSize, vSize, BufferedImage.TYPE_INT_ARGB); raster = image.getRaster(); } ! public void setPixels(int[] pixels, int x, int y, int w, int h, int rowLength) { for (int row = 0; row < h; row++) { if (y + row < 0 || y + row >= vSize) --- 41,54 ---- this.vSize = vSize; if (display.getMode() == Display.Mode.RGB) ! image = new BufferedImage(hSize, vSize, ! BufferedImage.TYPE_INT_RGB); else ! image = new BufferedImage(hSize, vSize, ! BufferedImage.TYPE_INT_ARGB); raster = image.getRaster(); } ! public void setPixels(int[] pixels, int x, int y, int w, int h, ! int rowLength) { for (int row = 0; row < h; row++) { if (y + row < 0 || y + row >= vSize) Index: MemoryBucket.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/MemoryBucket.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MemoryBucket.java 20 Feb 2007 03:33:36 -0000 1.12 --- MemoryBucket.java 26 Feb 2007 19:35:52 -0000 1.13 *************** *** 1,19 **** /* ! MemoryBucket.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! MemoryBucket.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 85,89 **** tmp = new Micropolygon[1024]; else ! tmp = new Micropolygon[micropolygonCount * 2]; System.arraycopy(micropolygons, 0, tmp, 0, micropolygonCount); micropolygons = tmp; --- 85,89 ---- tmp = new Micropolygon[1024]; else ! tmp = new Micropolygon[micropolygonCount * 2]; System.arraycopy(micropolygons, 0, tmp, 0, micropolygonCount); micropolygons = tmp; Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** RendererHidden.java 26 Feb 2007 15:25:15 -0000 1.79 --- RendererHidden.java 26 Feb 2007 19:35:52 -0000 1.80 *************** *** 124,131 **** Transform screenToRaster = Global.getTransform("raster"); if (cameraToScreen instanceof PerspectiveTransform) ! cameraToRaster = ((PerspectiveTransform) cameraToScreen).preConcat(screenToRaster); else cameraToRaster = screenToRaster.concat(cameraToScreen); ! eyePlane = Plane.createWithPointAndNormal(new Point3f(), new Vector3f(0f, 0f, -1f)); createClippingVolume(); createBuckets(); --- 124,133 ---- Transform screenToRaster = Global.getTransform("raster"); if (cameraToScreen instanceof PerspectiveTransform) ! cameraToRaster = ! ((PerspectiveTransform) cameraToScreen).preConcat(screenToRaster); else cameraToRaster = screenToRaster.concat(cameraToScreen); ! eyePlane = Plane.createWithPointAndNormal(new Point3f(), ! new Vector3f(0f, 0f, -1f)); createClippingVolume(); createBuckets(); *************** *** 139,147 **** } ! private void internalAddPrimitive( ! Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { Transform objectToCamera = primitive.getObjectToCamera(); if (objectToCamera == null) { --- 141,148 ---- } ! private void internalAddPrimitive(Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { Transform objectToCamera = primitive.getObjectToCamera(); if (objectToCamera == null) { *************** *** 156,170 **** primitive.setObjectToCamera(objectToCamera); } ! if (!addPrimitive(primitive, 0, objectToCamera, curColumn, curRow, check)) ! System.err.println("Can't split primitive at eye plane: " + primitive); } ! private boolean addPrimitive( ! Primitive primitive, ! int recursionLevel, ! Transform objectToCamera, ! int curColumn, ! int curRow, ! boolean check) { BoundingVolume bv = primitive.getBoundingVolume(); float db = primitive.getAttributes().getDisplacementBound(); --- 157,172 ---- primitive.setObjectToCamera(objectToCamera); } ! if (!addPrimitive(primitive, 0, objectToCamera, curColumn, curRow, ! check)) ! System.err.println("Can't split primitive at eye plane: " + ! primitive); } ! private boolean addPrimitive(Primitive primitive, ! int recursionLevel, ! Transform objectToCamera, ! int curColumn, ! int curRow, ! boolean check) { BoundingVolume bv = primitive.getBoundingVolume(); float db = primitive.getAttributes().getDisplacementBound(); *************** *** 194,213 **** for (int i = 0; i < sub.length; i++) if (!addPrimitive(sub[i], ! recursionLevel + 1, ! objectToCamera, ! curColumn, ! curRow, ! check)) result = false; return result; } ! private void placeInBucket( ! Primitive primitive, ! BoundingVolume bve, ! BoundingVolume bv, ! int column, ! int row, ! boolean check) { primitive.setDistance(bve.getMinZ()); bve = bve.transform(cameraToRaster); --- 196,214 ---- for (int i = 0; i < sub.length; i++) if (!addPrimitive(sub[i], ! recursionLevel + 1, ! objectToCamera, ! curColumn, ! curRow, ! check)) result = false; return result; } ! private void placeInBucket(Primitive primitive, ! BoundingVolume bve, ! BoundingVolume bv, ! int column, ! int row, ! boolean check) { primitive.setDistance(bve.getMinZ()); bve = bve.transform(cameraToRaster); *************** *** 226,234 **** } ! private void doPlaceInBucket( ! Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { Bounds2f bounds = primitive.getRasterBounds(); if (!bounds.intersects(rasterWindow)) --- 227,234 ---- } ! private void doPlaceInBucket(Primitive primitive, ! int curColumn, ! int curRow, ! boolean check) { Bounds2f bounds = primitive.getRasterBounds(); if (!bounds.intersects(rasterWindow)) *************** *** 236,250 **** float minX = bounds.getMinX() - rasterWindow.getMinX(); float minY = bounds.getMinY() - rasterWindow.getMinY(); ! int column = Calc.clamp((int) (minX / bucketWidth), 0, bucketColumns - 1); int row = Calc.clamp((int) (minY / bucketHeight), 0, bucketRows - 1); if (check && row <= curRow) { float maxY = bounds.getMaxY() - rasterWindow.getMinY(); ! int maxRow = Calc.clamp((int) Math.ceil(maxY / bucketHeight), 0, bucketRows - 1); if (maxRow < curRow) return; row = curRow; float maxX = bounds.getMaxX() - rasterWindow.getMinX(); ! int maxColumn = ! Calc.clamp((int) Math.ceil(maxX / bucketWidth), 0, bucketColumns - 1); if (column <= curColumn && curColumn <= maxColumn) { getBucket(curColumn, curRow).addPrimitive(primitive); --- 236,252 ---- float minX = bounds.getMinX() - rasterWindow.getMinX(); float minY = bounds.getMinY() - rasterWindow.getMinY(); ! int column = Calc.clamp((int) (minX / bucketWidth), 0, ! bucketColumns - 1); int row = Calc.clamp((int) (minY / bucketHeight), 0, bucketRows - 1); if (check && row <= curRow) { float maxY = bounds.getMaxY() - rasterWindow.getMinY(); ! int maxRow = Calc.clamp((int) Math.ceil(maxY / bucketHeight), 0, ! bucketRows - 1); if (maxRow < curRow) return; row = curRow; float maxX = bounds.getMaxX() - rasterWindow.getMinX(); ! int maxColumn = Calc.clamp((int) Math.ceil(maxX / bucketWidth), 0, ! bucketColumns - 1); if (column <= curColumn && curColumn <= maxColumn) { getBucket(curColumn, curRow).addPrimitive(primitive); *************** *** 263,267 **** public void addToBuckets(Micropolygon mp) { ! if (mp.getMaxX() < rasterWindowMin.x || mp.getMaxY() < rasterWindowMin.y) return; float mpMinX = mp.getMinX() - rasterWindowMin.x; --- 265,270 ---- public void addToBuckets(Micropolygon mp) { ! if (mp.getMaxX() < rasterWindowMin.x || ! mp.getMaxY() < rasterWindowMin.y) return; float mpMinX = mp.getMinX() - rasterWindowMin.x; *************** *** 275,279 **** for (int col = minColumn; col <= maxColumn; col++) for (int row = minRow; row <= maxRow; row++) ! if (col >= 0 && col < bucketColumns && row >= 0 && row < bucketRows) getBucket(col, row).addMicropolygon(mp); } --- 278,283 ---- for (int col = minColumn; col <= maxColumn; col++) for (int row = minRow; row <= maxRow; row++) ! if (col >= 0 && col < bucketColumns && row >= 0 && ! row < bucketRows) getBucket(col, row).addMicropolygon(mp); } *************** *** 296,335 **** Display.Type displayType = frame.getDisplay().getType(); ImageStore imageStore = ! new ImageStore( ! frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! frame.getDisplay()); ZStore zStore = null; if (displayMode == Display.Mode.Z) { ! zStore = ! new ZStore(frame.getHorizontalResolution(), frame.getVerticalResolution()); ShadowMap.flushShadowMap(frame.getDisplay().getName()); } Framebuffer fb = null; ! if (displayType == Display.Type.FRAMEBUFFER || frame.isFramebufferAlways()) { ! fb = new Framebuffer(frame.getDisplay().getName(), imageStore.getImage()); fb.setVisible(true); } int gridSize = frame.getGridSize(); ! ShaderVariables shaderVariables = new ShaderVariables(worldToCamera.getInverse()); int gridCount = 0; ! Sampler sampler = ! new Sampler( ! bucketWidth, ! bucketHeight, ! frame.getHorizontalSamplingRate(), ! frame.getVerticalSamplingRate()); Filter filter = frame.getFilter(); ! samplesFilter.init( ! (int) Math.ceil(filter.getHorizontalWidth() * sampler.getPixelWidth()), ! (int) Math.ceil(filter.getVerticalWidth() * sampler.getPixelHeight()), filter.getHorizontalWidth(), filter.getVerticalWidth()); ! float[] samples = ! new float[sampler.getWidth() ! * bucketColumns ! * (sampler.getHeight() + vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * 4]; float[] filteredSamples = new float[bucketWidth * bucketHeight * 4]; int[] pixels = new int[bucketWidth * bucketHeight]; --- 300,339 ---- Display.Type displayType = frame.getDisplay().getType(); ImageStore imageStore = ! new ImageStore(frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! frame.getDisplay()); ZStore zStore = null; if (displayMode == Display.Mode.Z) { ! zStore = new ZStore(frame.getHorizontalResolution(), ! frame.getVerticalResolution()); ShadowMap.flushShadowMap(frame.getDisplay().getName()); } Framebuffer fb = null; ! if (displayType == Display.Type.FRAMEBUFFER || ! frame.isFramebufferAlways()) { ! fb = new Framebuffer(frame.getDisplay().getName(), ! imageStore.getImage()); fb.setVisible(true); } int gridSize = frame.getGridSize(); ! ShaderVariables shaderVariables = ! new ShaderVariables(worldToCamera.getInverse()); int gridCount = 0; ! Sampler sampler = new Sampler(bucketWidth, ! bucketHeight, ! frame.getHorizontalSamplingRate(), ! frame.getVerticalSamplingRate()); Filter filter = frame.getFilter(); ! samplesFilter.init((int) Math.ceil(filter.getHorizontalWidth() * ! sampler.getPixelWidth()), ! (int) Math.ceil(filter.getVerticalWidth() * ! sampler.getPixelHeight()), filter.getHorizontalWidth(), filter.getVerticalWidth()); ! float[] samples = new float[sampler.getWidth() * bucketColumns ! * (sampler.getHeight() + vFilterExtra + ! vPixelLess * sampler.getPixelHeight()) ! * 4]; float[] filteredSamples = new float[bucketWidth * bucketHeight * 4]; int[] pixels = new int[bucketWidth * bucketHeight]; *************** *** 370,384 **** if (surface == null) surface = ! SurfaceShader.createShader( ! "fakedlight", ! new ParameterList(), ! attr); surface.shade(shaderVariables); VolumeShader vs = attr.getAtmosphere(); if (vs != null) ! vs.shade( ! shaderVariables, ! frame.getNearClipping(), ! frame.getFarClipping()); shaderVariables.transform(cameraToRaster); shaderVariables.getMicropolygons(this); --- 374,386 ---- if (surface == null) surface = ! SurfaceShader.createShader("fakedlight", ! new ParameterList(), ! attr); surface.shade(shaderVariables); VolumeShader vs = attr.getAtmosphere(); if (vs != null) ! vs.shade(shaderVariables, ! frame.getNearClipping(), ! frame.getFarClipping()); shaderVariables.transform(cameraToRaster); shaderVariables.getMicropolygons(this); *************** *** 402,492 **** sampler.sampleBucket(bucket); discardBucket(column, row); ! if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! sampler.getColors( ! samples, ! (column * sampler.getWidth() ! + (row == 0 ? 0 : 1) ! * (vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * bucketColumns ! * sampler.getWidth()) ! * 4, ! bucketColumns * sampler.getWidth(), ! 4, ! 0); ! samplesFilter.doFilter( ! samples, ! (column * sampler.getWidth() ! - (column == 0 ! ? 0 ! : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 4, ! bucketColumns * sampler.getWidth(), ! filteredSamples, ! 0, ! bucketWidth, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! sampler.getPixelWidth(), ! sampler.getPixelHeight(), ! 4); colorsToPixels(filteredSamples, pixels); ! imageStore.setPixels( ! pixels, ! column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int) rmin.x, ! row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth ! - (column == 0 ? hPixelLess : 0) ! - (column == bucketColumns - 1 ? wExtra : 0), ! bucketHeight ! - (row == 0 ? vPixelLess : 0) ! - (row == bucketRows - 1 ? hExtra : 0), ! bucketWidth); if (fb != null) ! fb.refresh( ! column * bucketWidth ! - (column == 0 ? 0 : hPixelLess) ! + (int) rmin.x, ! row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0)); } else if (displayMode == Display.Mode.Z) { sampler.getDepths(depths); ! zStore.setDepths( ! depths, ! column * bucketWidth + (int) rmin.x, ! row * bucketHeight + (int) rmin.y, ! bucketWidth, ! bucketHeight, ! bucketWidth); } if (frame.isShowProgressEnabled()) { ! int percent = (row * bucketColumns + column + 1) * 100 / buckets.length; if (percent > percentComplete) { percentComplete = percent; ! System.out.print( ! "\r" ! + frame.getDisplay().getName() ! + " (frame " ! + frame.getFrameNumber() ! + "): " ! + percentComplete ! + "% complete"); } } } ! System.arraycopy( ! samples, ! (bucketHeight * sampler.getPixelHeight() ! - (row == 0 ? (vFilterExtra + vPixelLess * sampler.getPixelHeight()) : 0)) ! * bucketColumns ! * sampler.getWidth() ! * 4, ! samples, ! 0, ! (vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * bucketColumns ! * sampler.getWidth() ! * 4); } if (frame.isShowProgressEnabled()) --- 404,495 ---- sampler.sampleBucket(bucket); discardBucket(column, row); ! if (displayMode == Display.Mode.RGB || ! displayMode == Display.Mode.RGBA) { ! sampler.getColors(samples, ! (column * sampler.getWidth() ! + (row == 0 ? 0 : 1) ! * (vFilterExtra + vPixelLess * ! sampler.getPixelHeight()) ! * bucketColumns * sampler.getWidth()) *4, ! bucketColumns * sampler.getWidth(), ! 4, ! 0); ! samplesFilter.doFilter(samples, ! (column * sampler.getWidth() ! - (column == 0 ? 0 ! : (hFilterExtra + hPixelLess * ! sampler.getPixelWidth()))) ! * 4, ! bucketColumns * sampler.getWidth(), ! filteredSamples, ! 0, ! bucketWidth, ! bucketWidth - (column == 0 ? ! hPixelLess : 0), ! bucketHeight - (row == 0 ? ! vPixelLess : 0), ! sampler.getPixelWidth(), ! sampler.getPixelHeight(), ! 4); colorsToPixels(filteredSamples, pixels); ! imageStore.setPixels(pixels, ! column * bucketWidth - ! (column == 0 ? 0 : hPixelLess) + ! (int) rmin.x, ! row * bucketHeight - ! (row == 0 ? 0 : vPixelLess) + ! (int) rmin.y, ! bucketWidth - ! (column == 0 ? hPixelLess : 0) - ! (column == bucketColumns - 1 ? ! wExtra : 0), ! bucketHeight - ! (row == 0 ? vPixelLess : 0) - ! (row == bucketRows - 1 ? hExtra : 0), ! bucketWidth); if (fb != null) ! fb.refresh(column * bucketWidth - ! (column == 0 ? 0 : hPixelLess) + ! (int) rmin.x, ! row * bucketHeight - ! (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0)); } else if (displayMode == Display.Mode.Z) { sampler.getDepths(depths); ! zStore.setDepths(depths, ! column * bucketWidth + (int) rmin.x, ! row * bucketHeight + (int) rmin.y, ! bucketWidth, ! bucketHeight, ! bucketWidth); } if (frame.isShowProgressEnabled()) { ! int percent = (row * bucketColumns + column + 1) * ! 100 / buckets.length; if (percent > percentComplete) { percentComplete = percent; ! System.out.print("\r" ! + frame.getDisplay().getName() ! + " (frame " ! + frame.getFrameNumber() ! + "): " ! + percentComplete ! + "% complete"); } } } ! System.arraycopy(samples, ! (bucketHeight * sampler.getPixelHeight() - ! (row == 0 ? ! (vFilterExtra + vPixelLess * ! sampler.getPixelHeight()) : 0)) ! * bucketColumns * sampler.getWidth() * 4, ! samples, ! 0, ! (vFilterExtra + vPixelLess * ! sampler.getPixelHeight()) * ! bucketColumns * sampler.getWidth() * 4); } if (frame.isShowProgressEnabled()) *************** *** 496,500 **** if (displayType == Display.Type.FILE) try { ! if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { String name = frame.getDisplay().getName(); String currentDirectory = parser.getCurrentDirectory(); --- 499,504 ---- if (displayType == Display.Type.FILE) try { ! if (displayMode == Display.Mode.RGB || ! displayMode == Display.Mode.RGBA) { String name = frame.getDisplay().getName(); String currentDirectory = parser.getCurrentDirectory(); *************** *** 505,515 **** ImageIO.write(imageStore.getImage(), ext, file); } else if (displayMode == Display.Mode.Z) ! ShadowMap.writeShadowMap( ! frame.getDisplay().getName(), ! worldToCamera, ! cameraToRaster, ! frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! zStore.getDepths()); } catch (Exception e) { System.err.println("Error writing image file: " + e); --- 509,518 ---- ImageIO.write(imageStore.getImage(), ext, file); } else if (displayMode == Display.Mode.Z) ! ShadowMap.writeShadowMap(frame.getDisplay().getName(), ! worldToCamera, ! cameraToRaster, ! frame.getHorizontalResolution(), ! frame.getVerticalResolution(), ! zStore.getDepths()); } catch (Exception e) { System.err.println("Error writing image file: " + e); *************** *** 524,529 **** if (frame.endOfFrameStatisticsEnabled()) { System.out.println("*** Frame Statistics ***"); ! System.out.println( ! "World parse time: " + Format.time(worldParseEnd - worldParseStart)); display("spheres", parser.getSphereCount()); display("cylinders", parser.getCylinderCount()); --- 527,532 ---- if (frame.endOfFrameStatisticsEnabled()) { System.out.println("*** Frame Statistics ***"); ! System.out.println("World parse time: " + ! Format.time(worldParseEnd - worldParseStart)); display("spheres", parser.getSphereCount()); display("cylinders", parser.getCylinderCount()); *************** *** 544,563 **** System.out.println("Patches/second: " + primitivePatchCount / time); System.out.println("Invisible patches: " + invisiblePatchCount); ! System.out.println( ! "Patches culled: " + invisiblePatchCount * 100f / primitivePatchCount + "%"); System.out.println("Root count: " + sampler.getRootCount()); System.out.println("Pixel count: " + sampler.getPixelCount()); System.out.println("MP Root count: " + sampler.getMPRootCount()); ! System.out.println( ! "gridCount = " ! + gridCount ! + " in " ! + time ! + " seconds\n" ! + gridCount / time ! + "grids/second"); System.out.println("Total micropolygons: " + Micropolygon.count); ! System.out.println("Micropolygons/second: " + Micropolygon.count / time); ! System.out.println("---------------------------------------------------"); clippedPrimitivesCount = 0; primitivePatchCount = 0; --- 547,567 ---- System.out.println("Patches/second: " + primitivePatchCount / time); System.out.println("Invisible patches: " + invisiblePatchCount); ! System.out.println("Patches culled: " + ! invisiblePatchCount * 100f / primitivePatchCount ! + "%"); System.out.println("Root count: " + sampler.getRootCount()); System.out.println("Pixel count: " + sampler.getPixelCount()); System.out.println("MP Root count: " + sampler.getMPRootCount()); ! System.out.println("gridCount = " ! + gridCount ! + " in " ! + time ! + " seconds\n" ! + gridCount / time ! + "grids/second"); System.out.println("Total micropolygons: " + Micropolygon.count); ! System.out.println("Micropolygons/second: " + ! Micropolygon.count / time); ! System.out.println("---------------------------------------------"); clippedPrimitivesCount = 0; primitivePatchCount = 0; *************** *** 601,605 **** int alpha = qt.quantize(alphaFloat); offset = row * bucketWidth + col; ! result[offset] = ((alpha << 24) | (red << 16) | (green << 8) | blue); } } --- 605,610 ---- int alpha = qt.quantize(alphaFloat); offset = row * bucketWidth + col; ! result[offset] = ! ((alpha << 24) | (red << 16) | (green << 8) | blue); } } *************** *** 620,630 **** Point3f lowerLeft = new Point3f(min.x, min.y, focalLength); Point3f lowerRight = new Point3f(max.x, min.y, focalLength); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, upperLeft, upperRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, upperRight, lowerRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(origin, lowerRight, lowerLeft)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, lowerLeft, upperLeft)); } else { Point3f upperLeft = new Point3f(min.x, max.y, 1f); --- 625,640 ---- Point3f lowerLeft = new Point3f(min.x, min.y, focalLength); Point3f lowerRight = new Point3f(max.x, min.y, focalLength); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, ! upperLeft, ! upperRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, ! upperRight, ! lowerRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, ! lowerRight, ! lowerLeft)); ! clippingVolume.addPlane(Plane.createWithThreePoints(origin, ! lowerLeft, ! upperLeft)); } else { Point3f upperLeft = new Point3f(min.x, max.y, 1f); *************** *** 636,658 **** Point3f originLowerLeft = new Point3f(min.x, min.y, 0f); Point3f originLowerRight = new Point3f(max.x, min.y, 0f); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(originUpperLeft, upperLeft, upperRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(originUpperRight, upperRight, lowerRight)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(originLowerRight, lowerRight, lowerLeft)); ! clippingVolume.addPlane( ! Plane.createWithThreePoints(originLowerLeft, lowerLeft, upperLeft)); } float near = frame.getNearClipping(); clippingVolume.addPlane( ! Plane.createWithPointAndNormal( ! new Point3f(0f, 0f, near), ! new Vector3f(0f, 0f, -1f))); float far = frame.getFarClipping(); clippingVolume.addPlane( ! Plane.createWithPointAndNormal( ! new Point3f(0f, 0f, far), ! new Vector3f(0f, 0f, 1f))); } --- 646,672 ---- Point3f originLowerLeft = new Point3f(min.x, min.y, 0f); Point3f originLowerRight = new Point3f(max.x, min.y, 0f); ! clippingVolume.addPlane(Plane.createWithThreePoints(originUpperLeft, ! upperLeft, ! upperRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints( ! originUpperRight, ! upperRight, ! lowerRight)); ! clippingVolume.addPlane(Plane.createWithThreePoints( ! originLowerRight, ! lowerRight, ! lowerLeft)); ! clippingVolume.addPlane(Plane.createWithThreePoints(originLowerLeft, ! lowerLeft, ! upperLeft)); } float near = frame.getNearClipping(); clippingVolume.addPlane( ! Plane.createWithPointAndNormal(new Point3f(0f, 0f, near), ! new Vector3f(0f, 0f, -1f))); float far = frame.getFarClipping(); clippingVolume.addPlane( ! Plane.createWithPointAndNormal(new Point3f(0f, 0f, far), ! new Vector3f(0f, 0f, 1f))); } *************** *** 663,679 **** int xResolution = frame.getHorizontalResolution(); int yResolution = frame.getVerticalResolution(); ! ... [truncated message content] |