You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(116) |
May
(220) |
Jun
(52) |
Jul
(30) |
Aug
(35) |
Sep
(24) |
Oct
(49) |
Nov
(44) |
Dec
(70) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(21) |
Feb
(30) |
Mar
(9) |
Apr
(44) |
May
(2) |
Jun
|
Jul
(10) |
Aug
(20) |
Sep
(25) |
Oct
(12) |
Nov
(16) |
Dec
(4) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(25) |
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(10) |
2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(33) |
2007 |
Jan
(4) |
Feb
(57) |
Mar
(17) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-08-21 22:53:58
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv8189/src/org/jrman/shaders Modified Files: LightShadowdistantlight.java Log Message: Improved shadows implementation Index: LightShadowdistantlight.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightShadowdistantlight.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LightShadowdistantlight.java 20 Aug 2003 20:41:21 -0000 1.1 --- LightShadowdistantlight.java 21 Aug 2003 22:53:47 -0000 1.2 *************** *** 84,87 **** --- 84,97 ---- new Parameter(new Declaration("shadowmap", "string"), shadowmap); defaultParameters.put("shadowmap", param); + float[][] samples = new float[1][]; + samples[0] = new float[1]; + samples[0][0] = 16f; + param = new Parameter(new Declaration("samples", "uniform float"), samples); + defaultParameters.put("samples", param); + float[][] blur = new float[1][]; + blur[0] = new float[1]; + blur[0][0] = 0f; + param = new Parameter(new Declaration("blur", "uniform float"), blur); + defaultParameters.put("blur", param); } *************** *** 113,116 **** --- 123,132 ---- String[][] s = (String[][]) param.getData(); final String shadowmap = s[0][0]; + param = (Parameter) getParameter(sv, "samples"); + f = (float[][]) param.getData(); + final float samples = f[0][0]; + param = (Parameter) getParameter(sv, "blur"); + f = (float[][]) param.getData(); + final float blur = f[0][0]; vtmp.sub(to, from); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { *************** *** 123,127 **** if (!shadowmap.equals("")) { pg.transform(sv.P, sv.cameraToWorld); ! fg.shadow(shadowmap, pg, bias); fg.sub(1f, fg); cg.set(fg); --- 139,143 ---- if (!shadowmap.equals("")) { pg.transform(sv.P, sv.cameraToWorld); ! fg.shadow(shadowmap, pg, bias, samples, blur); fg.sub(1f, fg); cg.set(fg); |
From: <ma...@us...> - 2003-08-21 22:53:57
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv8189/src/org/jrman/render Modified Files: RendererHidden.java Log Message: Improved shadows implementation Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** RendererHidden.java 20 Aug 2003 20:41:21 -0000 1.42 --- RendererHidden.java 21 Aug 2003 22:53:47 -0000 1.43 *************** *** 334,343 **** new HashMap(), attr); - if (displayMode == Display.Mode.Z) - surface = - SurfaceShader.createShader( - "constant", - new HashMap(), - attr); surface.shade(shaderVariables); VolumeShader vs = attr.getAtmosphere(); --- 334,337 ---- |
From: <ma...@us...> - 2003-08-21 22:53:57
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv8189/sampleData Modified Files: shadowTest.rib Log Message: Improved shadows implementation Index: shadowTest.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/shadowTest.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** shadowTest.rib 20 Aug 2003 20:41:22 -0000 1.1 --- shadowTest.rib 21 Aug 2003 22:53:47 -0000 1.2 *************** *** 3,7 **** PixelSamples 1 1 Projection "orthographic" ! ScreenWindow -1.2 4.5 -4.5 1.2 Clipping 7 13 Translate 0 0 10 --- 3,7 ---- PixelSamples 1 1 Projection "orthographic" ! ScreenWindow -1.35 4.5 -4.5 1.35 Clipping 7 13 Translate 0 0 10 *************** *** 27,30 **** --- 27,32 ---- Declare "shadowmap" "string" Declare "bias" "uniform float" + Declare "samples" "uniform float" + Declare "blur" "uniform float" Format 800 600 1 Display "shadowTest" "framebuffer" "rgba" *************** *** 37,44 **** --- 39,48 ---- "from" [1 1 0] "to" [0 0 0] "shadowmap" "shadowTest.shdw" "bias" .1 + "samples" 64 "blur" 5 LightSource "ambientlight" 2 "intensity" .1 Rotate -10 1 0 0 Translate 0 0 10 WorldBegin + ShadingRate .25 Surface "plastic" AttributeBegin |
From: <ma...@us...> - 2003-08-21 22:53:56
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv8189/src/org/jrman/grid Modified Files: FloatGrid.java Log Message: Improved shadows implementation Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** FloatGrid.java 20 Aug 2003 20:41:21 -0000 1.14 --- FloatGrid.java 21 Aug 2003 22:53:47 -0000 1.15 *************** *** 28,31 **** --- 28,35 ---- public class FloatGrid extends Grid { + + private static Point3f p1 = new Point3f(); + + private static Point3f p2 = new Point3f(); private static float[] mmData = new float[4]; *************** *** 1213,1221 **** */ ! public void shadow(String shadowName, Point3fGrid p, float bias) { ShadowMap shadowMap = ShadowMap.getShadowMap(shadowName); ! Point3f[] pdata = (Point3f[]) p.data; ! for (int i = 0; i < size; i++) ! data[i] = shadowMap.get(pdata[i], bias); } --- 1217,1235 ---- */ ! public void shadow(String shadowName, Point3fGrid p, float bias, float samples, float blur) { ! int isamples = (int) samples; ShadowMap shadowMap = ShadowMap.getShadowMap(shadowName); ! for (int v = 0; v < vSize; v++) ! for (int u = 0; u < uSize; u++) { ! int u1 = u + 1; ! if (u1 == uSize) ! u1 = u -1; ! int v1 = v + 1; ! if (v1 == vSize) ! v1 = v - 1; ! p.get(u, v, p1); ! p.get(u1, v1, p2); ! set(u, v, shadowMap.get(p1, p2, bias, isamples, blur)); ! } } |
From: <ma...@us...> - 2003-08-21 22:53:53
|
Update of /cvsroot/jrman/drafts/src/org/jrman/maps In directory sc8-pr-cvs1:/tmp/cvs-serv8189/src/org/jrman/maps Modified Files: ShadowMap.java Log Message: Improved shadows implementation Index: ShadowMap.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/maps/ShadowMap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ShadowMap.java 20 Aug 2003 20:41:21 -0000 1.2 --- ShadowMap.java 21 Aug 2003 22:53:46 -0000 1.3 *************** *** 37,53 **** import org.jrman.geom.PerspectiveTransform; import org.jrman.geom.Transform; public class ShadowMap { ! ! private static Point3f ptmp = new Point3f(); ! private static Map map = new HashMap(); ! private FloatBuffer data; ! private int width; ! private int height; ! private Transform worldToRaster; --- 37,56 ---- import org.jrman.geom.PerspectiveTransform; import org.jrman.geom.Transform; + import org.jrman.util.Calc; public class ShadowMap { ! ! private static Point3f ptmp1 = new Point3f(); ! ! private static Point3f ptmp2 = new Point3f(); ! private static Map map = new HashMap(); ! private FloatBuffer data; ! private int width; ! private int height; ! private Transform worldToRaster; *************** *** 109,149 **** int width, int height, ! float[] depths) throws IOException { ! Transform worldToRaster = cameraToRaster.concat(worldToCamera); ! FileOutputStream fos = new FileOutputStream(filename); ! BufferedOutputStream bos = new BufferedOutputStream(fos); ! DataOutputStream dos = new DataOutputStream(bos); ! if (worldToRaster.isPerspective()) ! dos.writeByte(Projection.getNamed("perspective").getCode()); ! else ! dos.writeByte(Projection.getNamed("orthographic").getCode()); ! worldToRaster.writeToFile(dos); ! dos.writeInt(width); ! dos.writeInt(height); ! for (int i = 0; i < depths.length; i++) ! dos.writeFloat(depths[i]); ! dos.flush(); ! dos.close(); ! fos.close(); ! } ! ! public static ShadowMap getShadowMap(String filename) { ! ShadowMap result = (ShadowMap) map.get(filename); ! if (result == null) ! try { ! result = new ShadowMap(filename); ! map.put(filename, result); ! } catch (Exception e) { ! System.err.println("Can't load shadow map: " + filename); ! } ! return result; ! } ! ! public static void flushShadowMap(String filename) { ! map.remove(filename); ! } ! ! private ShadowMap(String filename) throws IOException { try { FileInputStream fis = new FileInputStream(filename); DataInputStream dis = new DataInputStream(fis); --- 112,153 ---- int width, int height, ! float[] depths) ! throws IOException { ! Transform worldToRaster = cameraToRaster.concat(worldToCamera); ! FileOutputStream fos = new FileOutputStream(filename); ! BufferedOutputStream bos = new BufferedOutputStream(fos); ! DataOutputStream dos = new DataOutputStream(bos); ! if (worldToRaster.isPerspective()) ! dos.writeByte(Projection.getNamed("perspective").getCode()); ! else ! dos.writeByte(Projection.getNamed("orthographic").getCode()); ! worldToRaster.writeToFile(dos); ! dos.writeInt(width); ! dos.writeInt(height); ! for (int i = 0; i < depths.length; i++) ! dos.writeFloat(depths[i]); ! dos.flush(); ! dos.close(); ! fos.close(); ! } ! ! public static ShadowMap getShadowMap(String filename) { ! ShadowMap result = (ShadowMap) map.get(filename); ! if (result == null) try { + result = new ShadowMap(filename); + map.put(filename, result); + } catch (Exception e) { + System.err.println("Can't load shadow map: " + filename); + } + return result; + } + + public static void flushShadowMap(String filename) { + map.remove(filename); + } + + private ShadowMap(String filename) throws IOException { + try { FileInputStream fis = new FileInputStream(filename); DataInputStream dis = new DataInputStream(fis); *************** *** 162,182 **** ByteBuffer bf = fc.map(FileChannel.MapMode.READ_ONLY, offset, size); data = bf.asFloatBuffer(); ! } catch (IOException e) { ! e.printStackTrace(); ! throw e; ! } ! } ! ! private float get(int x, int y, float dist) { ! if (x < 0 || x >= width || y < 0 || y >= height) ! return 0f; ! float z = data.get(y * width + x); ! return (z < dist) ? 1f : 0f; } ! ! public float get(Point3f p, float bias) { ! worldToRaster.transformPoint(p, ptmp); ! return get((int) ptmp.x, (int) ptmp.y, ptmp.z - bias); } ! } --- 166,199 ---- ByteBuffer bf = fc.map(FileChannel.MapMode.READ_ONLY, offset, size); data = bf.asFloatBuffer(); ! } catch (IOException e) { ! e.printStackTrace(); ! throw e; } ! } ! ! private float get(int x, int y, float dist) { ! if (x < 0 || x >= width || y < 0 || y >= height) ! return 0f; ! float z = data.get(y * width + x); ! return (z < dist) ? 1f : 0f; ! } ! ! public float get(Point3f p1, Point3f p2, float bias, int samples, float blur) { ! worldToRaster.transformPoint(p1, ptmp1); ! worldToRaster.transformPoint(p2, ptmp2); ! float total = 0f; ! for (int i = 0; i < samples; i++) { ! int x = ! Math.round( ! Calc.interpolate(ptmp1.x, ptmp2.x, (float) Math.random()) ! + ((float) Math.random() - .5f) * blur); ! int y = ! Math.round( ! Calc.interpolate(ptmp1.y, ptmp2.y, (float) Math.random()) ! + ((float) Math.random() - .5f) * blur); ! total += get(x, y, ptmp1.z - bias); } ! return total / samples; } + + } |
From: <ma...@us...> - 2003-08-21 01:37:47
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv14612/src/org/jrman/render Modified Files: SamplePoint.java RendererHidden.java ShaderVariables.java Sampler.java Log Message: First shadows implementation. Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SamplePoint.java 18 Jul 2003 08:40:24 -0000 1.12 --- SamplePoint.java 20 Aug 2003 20:41:21 -0000 1.13 *************** *** 130,133 **** --- 130,144 ---- } } + + public float getDepth() { + int i = 0; + int size = samples.size(); + while (i < size) { + Sample sample = (Sample) samples.get(i++); + if (sample.isOpaque()) + return sample.getZ(); + } + return Constants.INFINITY; + } public Point2f getPoint() { Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** RendererHidden.java 17 Aug 2003 22:05:39 -0000 1.41 --- RendererHidden.java 20 Aug 2003 20:41:21 -0000 1.42 *************** *** 281,285 **** } int gridSize = frame.getGridSize(); ! ShaderVariables shaderVariables = new ShaderVariables(); int gridCount = 0; Sampler sampler = --- 281,285 ---- } int gridSize = frame.getGridSize(); ! ShaderVariables shaderVariables = new ShaderVariables(worldToCamera.getInverse()); int gridCount = 0; Sampler sampler = *************** *** 332,335 **** --- 332,341 ---- SurfaceShader.createShader( "fakedlight", + new HashMap(), + attr); + if (displayMode == Display.Mode.Z) + surface = + SurfaceShader.createShader( + "constant", new HashMap(), attr); Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ShaderVariables.java 19 May 2003 08:15:28 -0000 1.8 --- ShaderVariables.java 20 Aug 2003 20:41:21 -0000 1.9 *************** *** 35,38 **** --- 35,40 ---- public class ShaderVariables { + + public Transform cameraToWorld; public Point3fGrid P = new Point3fGrid(); *************** *** 82,85 **** --- 84,91 ---- private Map map = new HashMap(); + public ShaderVariables(Transform worldToCamera) { + this.cameraToWorld = worldToCamera; + } + public void set(String name, Grid grid) { map.put(name, grid); *************** *** 90,99 **** } ! public void transform(Transform objectToCamera) { ! P.transform(P, objectToCamera); ! N.ntransform(N, objectToCamera); ! Ng.ntransform(Ng, objectToCamera); ! dPdu.vtransform(dPdu, objectToCamera); ! dPdv.vtransform(dPdv, objectToCamera); } --- 96,105 ---- } ! public void transform(Transform transform) { ! P.transform(P, transform); ! N.ntransform(N, transform); ! Ng.ntransform(Ng, transform); ! dPdu.vtransform(dPdu, transform); ! dPdv.vtransform(dPdv, transform); } Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Sampler.java 17 Aug 2003 22:05:39 -0000 1.8 --- Sampler.java 20 Aug 2003 20:41:21 -0000 1.9 *************** *** 146,150 **** for (int col = 0; col < width; col++) { int offset = row * width + col; ! depths[offset] = samplePoints[offset].getZ(); } } --- 146,150 ---- for (int col = 0; col < width; col++) { int offset = row * width + col; ! depths[offset] = samplePoints[offset].getDepth(); } } |
From: <ma...@us...> - 2003-08-21 01:22:08
|
Update of /cvsroot/jrman/drafts/src/org/jrman/maps In directory sc8-pr-cvs1:/tmp/cvs-serv14612/src/org/jrman/maps Modified Files: ShadowMap.java Log Message: First shadows implementation. Index: ShadowMap.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/maps/ShadowMap.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShadowMap.java 17 Aug 2003 22:05:39 -0000 1.1 --- ShadowMap.java 20 Aug 2003 20:41:21 -0000 1.2 *************** *** 21,33 **** --- 21,54 ---- import java.io.BufferedOutputStream; + import java.io.DataInputStream; import java.io.DataOutputStream; + import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; + import java.nio.ByteBuffer; + import java.nio.FloatBuffer; + import java.nio.channels.FileChannel; import java.util.HashMap; import java.util.Map; + import javax.vecmath.Point3f; + + import org.jrman.geom.AffineTransform; + import org.jrman.geom.PerspectiveTransform; import org.jrman.geom.Transform; public class ShadowMap { + + private static Point3f ptmp = new Point3f(); + + private static Map map = new HashMap(); + + private FloatBuffer data; + + private int width; + + private int height; + + private Transform worldToRaster; public static class Projection { *************** *** 89,105 **** int height, float[] depths) throws IOException { FileOutputStream fos = new FileOutputStream(filename); BufferedOutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos); ! if (worldToCamera.isPerspective()) ! dos.writeByte(Projection.getNamed("perspective").getCode()); ! else ! dos.writeByte(Projection.getNamed("orthographic").getCode()); ! worldToCamera.writeToFile(dos); ! if (cameraToRaster.isPerspective()) dos.writeByte(Projection.getNamed("perspective").getCode()); else dos.writeByte(Projection.getNamed("orthographic").getCode()); ! cameraToRaster.writeToFile(dos); dos.writeInt(width); dos.writeInt(height); --- 110,122 ---- int height, float[] depths) throws IOException { + Transform worldToRaster = cameraToRaster.concat(worldToCamera); FileOutputStream fos = new FileOutputStream(filename); BufferedOutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos); ! if (worldToRaster.isPerspective()) dos.writeByte(Projection.getNamed("perspective").getCode()); else dos.writeByte(Projection.getNamed("orthographic").getCode()); ! worldToRaster.writeToFile(dos); dos.writeInt(width); dos.writeInt(height); *************** *** 108,112 **** --- 125,182 ---- dos.flush(); dos.close(); + fos.close(); + } + + public static ShadowMap getShadowMap(String filename) { + ShadowMap result = (ShadowMap) map.get(filename); + if (result == null) + try { + result = new ShadowMap(filename); + map.put(filename, result); + } catch (Exception e) { + System.err.println("Can't load shadow map: " + filename); + } + return result; + } + + public static void flushShadowMap(String filename) { + map.remove(filename); + } + + private ShadowMap(String filename) throws IOException { + try { + FileInputStream fis = new FileInputStream(filename); + DataInputStream dis = new DataInputStream(fis); + Projection projection = Projection.getProjection(dis.readByte()); + if (projection == Projection.PERSPECTIVE) + worldToRaster = PerspectiveTransform.readFromFile(dis); + else + worldToRaster = AffineTransform.readFromFile(dis); + width = dis.readInt(); + height = dis.readInt(); + int offset = 1 + 16 * 4 + 4 + 4; + if (projection == Projection.PERSPECTIVE) + offset += 4 + 4; + int size = width * height * 4; + FileChannel fc = fis.getChannel(); + ByteBuffer bf = fc.map(FileChannel.MapMode.READ_ONLY, offset, size); + data = bf.asFloatBuffer(); + } catch (IOException e) { + e.printStackTrace(); + throw e; + } } + private float get(int x, int y, float dist) { + if (x < 0 || x >= width || y < 0 || y >= height) + return 0f; + float z = data.get(y * width + x); + return (z < dist) ? 1f : 0f; + } + + public float get(Point3f p, float bias) { + worldToRaster.transformPoint(p, ptmp); + return get((int) ptmp.x, (int) ptmp.y, ptmp.z - bias); + } + } |
From: <ma...@us...> - 2003-08-21 01:21:17
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv14612/src/org/jrman/grid Modified Files: FloatGrid.java Log Message: First shadows implementation. Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FloatGrid.java 17 Jul 2003 16:35:50 -0000 1.13 --- FloatGrid.java 20 Aug 2003 20:41:21 -0000 1.14 *************** *** 24,27 **** --- 24,28 ---- import org.jrman.maps.MipMap; + import org.jrman.maps.ShadowMap; import org.jrman.util.Calc; *************** *** 1206,1209 **** --- 1207,1221 ---- set(u, v, getFloat(texture, s.get(u, v), t.get(u, v), area)); } + } + + /* + * shadow + */ + + public void shadow(String shadowName, Point3fGrid p, float bias) { + ShadowMap shadowMap = ShadowMap.getShadowMap(shadowName); + Point3f[] pdata = (Point3f[]) p.data; + for (int i = 0; i < size; i++) + data[i] = shadowMap.get(pdata[i], bias); } |
From: <ma...@us...> - 2003-08-21 01:21:17
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv14612/src/org/jrman/shaders Modified Files: SurfacePaintedplastic.java Added Files: LightShadowdistantlight.java Log Message: First shadows implementation. --- NEW FILE: LightShadowdistantlight.java --- /* LightDistantlight.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. */ package org.jrman.shaders; import javax.vecmath.Color3f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; import org.jrman.attributes.Space; import org.jrman.geom.Transform; import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.parser.Declaration; import org.jrman.parser.Global; import org.jrman.parser.Parameter; import org.jrman.render.ShaderVariables; public class LightShadowdistantlight extends LightShader { private static Vector3f vtmp = new Vector3f(); private static Point3f from = new Point3f(); private static Point3f to = new Point3f(); static Color3f c1 = new Color3f(); static Point3fGrid pg = new Point3fGrid(); static FloatGrid fg = new FloatGrid(); static Color3fGrid cg = new Color3fGrid(); protected void initDefaults() { float[][] intensity = new float[1][]; intensity[0] = new float[1]; intensity[0][0] = 1f; Parameter param = new Parameter(new Declaration("intensity", "uniform float"), intensity); defaultParameters.put("intensity", param); Color3f[][] lightcolor = new Color3f[1][]; lightcolor[0] = new Color3f[1]; lightcolor[0][0] = new Color3f(1f, 1f, 1f); param = new Parameter(new Declaration("lightcolor", "uniform color"), lightcolor); defaultParameters.put("lightcolor", param); Point3f[][] from = new Point3f[1][]; from[0] = new Point3f[1]; from[0][0] = new Point3f(0f, 0f, 0f); param = new Parameter(new Declaration("from", "uniform point"), from); defaultParameters.put("from", param); Point3f[][] to = new Point3f[1][]; to[0] = new Point3f[1]; to[0][0] = new Point3f(0f, 0f, 1f); param = new Parameter(new Declaration("to", "uniform point"), to); defaultParameters.put("to", param); float[][] bias = new float[1][]; bias[0] = new float[1]; bias[0][0] = .1f; param = new Parameter(new Declaration("bias", "uniform float"), bias); defaultParameters.put("bias", param); String[][] shadowmap = new String[1][]; shadowmap[0] = new String[1]; shadowmap[0][0] = ""; param = new Parameter(new Declaration("shadowmap", "string"), shadowmap); defaultParameters.put("shadowmap", param); } public boolean shade( final ShaderVariables sv, Point3fGrid P, Vector3fGrid N, float angle) { super.shade(sv, P, N, angle); Parameter param = (Parameter) getParameter(sv, "intensity"); float[][] f = (float[][]) param.getData(); final float intensity = f[0][0]; param = (Parameter) getParameter(sv, "lightcolor"); Color3f[][] c = (Color3f[][]) param.getData(); final Color3f lightColor = c[0][0]; Transform shaderTransform = attributes.getTransform(); if (attributes.getSpace() == Space.WORLD) shaderTransform = Global.getTransform("camera").concat(shaderTransform); param = (Parameter) getParameter(sv, "from"); Point3f[][] p = (Point3f[][]) param.getData(); shaderTransform.transformPoint(p[0][0], from); param = (Parameter) getParameter(sv, "to"); p = (Point3f[][]) param.getData(); shaderTransform.transformPoint(p[0][0], to); param = (Parameter) getParameter(sv, "bias"); f = (float[][]) param.getData(); final float bias = f[0][0]; param = (Parameter) getParameter(sv, "shadowmap"); String[][] s = (String[][]) param.getData(); final String shadowmap = s[0][0]; vtmp.sub(to, from); return solar(sv, P, N, angle, vtmp, 0f, new Statement() { public void execute(ShaderVariables sv) { c1.set(lightColor); c1.x *= intensity; c1.y *= intensity; c1.z *= intensity; sv.Cl.set(c1, tmpCond1); if (!shadowmap.equals("")) { pg.transform(sv.P, sv.cameraToWorld); fg.shadow(shadowmap, pg, bias); fg.sub(1f, fg); cg.set(fg); sv.Cl.mul(sv.Cl, cg); } } }); } } Index: SurfacePaintedplastic.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfacePaintedplastic.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfacePaintedplastic.java 1 Jun 2003 08:34:09 -0000 1.1 --- SurfacePaintedplastic.java 20 Aug 2003 20:41:21 -0000 1.2 *************** *** 1,4 **** /* ! SurfaceMetal.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! SurfacePaintedPlasticl.java Copyright (C) 2003 Gerardo Horvilleur Martinez |
From: <ega...@us...> - 2003-08-20 04:28:49
|
Update of /cvsroot/jrman/drafts/javacc In directory sc8-pr-cvs1:/tmp/cvs-serv12950 Modified Files: SLParser.jj Log Message: Fixed grammar B.1 Declarations with LOOKAHEAD Index: SLParser.jj =================================================================== RCS file: /cvsroot/jrman/drafts/javacc/SLParser.jj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SLParser.jj 24 Jun 2003 22:34:39 -0000 1.1 --- SLParser.jj 20 Aug 2003 03:38:53 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- LOOKAHEAD = 1; JAVA_UNICODE_ESCAPE = true; + // SANITY_CHECK = false; } *************** *** 222,226 **** | < SEMICOLON: ";" > | < COMMA: "," > - | < DOT: "." > } --- 223,226 ---- *************** *** 242,245 **** --- 242,246 ---- | < SLASHASSIGN: "/=" > | < COLON: ":" > + | < DOT: "." > } *************** *** 261,265 **** {} { ! shaderType() identifier() "("formals()")" "{"statements()"}" } --- 262,266 ---- {} { ! shaderType() identifier() "("[formals()]")" "{" statements() "}" } *************** *** 267,271 **** {} { ! [type()] identifier() "("formals()")" "{"statements()"}" } --- 268,272 ---- {} { ! [type()] identifier() "("[formals()]")" "{" statements() "}" } *************** *** 321,325 **** {} { ! [ defExpression() ("," defExpression() )* ] } --- 322,326 ---- {} { ! defExpression() ("," defExpression() )* } *************** *** 340,344 **** { primary() ! /* | expression() binop() expression() | --- 341,345 ---- { primary() ! /*| expression() binop() expression() | *************** *** 352,371 **** void primary(): {} ! { number() | stringconstant() - /*| - texture()*/ - /*| - identifier() [arrayindex()] | ! procedurecall()*/ | assignexpression() - /*| - triple() | ! sixteentuple()*/ } --- 353,374 ---- void primary(): {} ! { number() | stringconstant() | ! texture() ! | ! LOOKAHEAD(2) identifier() ! | ! LOOKAHEAD(2) identifier() [LOOKAHEAD(2) arrayindex()] ! | ! LOOKAHEAD(2) procedurecall() | assignexpression() | ! LOOKAHEAD(3) triple() ! | ! sixteentuple() } *************** *** 384,391 **** } void texture(): {} { ! textureType() textureFilename() [chanel()] [textureArguments()] } --- 387,395 ---- } + void texture(): {} { ! textureType() "(" textureFilename() [channel()] [textureArguments()] ")" } *************** *** 402,406 **** } ! void chanel(): {} { --- 406,410 ---- } ! void channel(): {} { *************** *** 411,417 **** {} { ! expression() ("," expression() )* } void arrayindex(): {} --- 415,422 ---- {} { ! "," expression() ("," expression() )* } + void arrayindex(): {} *************** *** 420,433 **** } void procedurecall(): {} { ! identifier() "(" procArguments() ")" } void procArguments(): {} { ! [ expression() ("," expression() )* ] } --- 425,440 ---- } + void procedurecall(): {} { ! identifier() "(" [procArguments()] ")" } + void procArguments(): {} { ! expression() ("," expression() )* } *************** *** 441,445 **** {} { ! "=" | "*=" | "/=" | "+=" | "-=" } --- 448,452 ---- {} { ! <ASSIGN> | <PLUSASSIGN> | <MINUSASSIGN> | <STARASSIGN> | <SLASHASSIGN> } *************** *** 459,468 **** } void statements(): {} { ! (statement())+ } void statement(): {} --- 466,484 ---- } + void binop(): + {} + { + <PLUS> | <MINUS> | <STAR> | <SLASH> | <EXP> | <DOT> + } + void statements(): {} { ! identifier() ! /*(statement())+*/ } + /* + void statement(): {} *************** *** 471,481 **** | assignexpression() ";" ! /*| ! procedurecall() ";"*/ | <RETURN> expression() ";" } - void variableDefinitions(): {} --- 487,496 ---- | assignexpression() ";" ! | ! procedurecall() ";" | <RETURN> expression() ";" } void variableDefinitions(): {} *************** *** 484,487 **** --- 499,503 ---- } + void externspec(): {} *************** *** 489,490 **** --- 505,507 ---- <EXTERN> } + */ |
From: <ma...@us...> - 2003-08-17 22:22:03
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1:/tmp/cvs-serv26878/src/org/jrman/geom Modified Files: AffineTransform.java Transform.java PerspectiveTransform.java Log Message: Writes shadow maps Index: AffineTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/AffineTransform.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AffineTransform.java 26 May 2003 01:48:00 -0000 1.10 --- AffineTransform.java 17 Aug 2003 22:05:38 -0000 1.11 *************** *** 20,23 **** --- 20,27 ---- package org.jrman.geom; + import java.io.DataInputStream; + import java.io.DataOutputStream; + import java.io.IOException; + import javax.vecmath.Matrix4f; import javax.vecmath.Point2f; *************** *** 134,137 **** --- 138,162 ---- return new AffineTransform(m); } + + public static Transform readFromFile(DataInputStream dis) throws IOException { + float a = dis.readFloat(); + float b = dis.readFloat(); + float c = dis.readFloat(); + float d = dis.readFloat(); + float e = dis.readFloat(); + float f = dis.readFloat(); + float g = dis.readFloat(); + float h = dis.readFloat(); + float i = dis.readFloat(); + float j = dis.readFloat(); + float k = dis.readFloat(); + float l = dis.readFloat(); + float m = dis.readFloat(); + float n = dis.readFloat(); + float o = dis.readFloat(); + float p = dis.readFloat(); + Matrix4f mat = new Matrix4f(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o ,p); + return new AffineTransform(mat); + } protected AffineTransform(Matrix4f matrix) { *************** *** 291,294 **** --- 316,338 ---- public boolean isPerspective() { return false; + } + + public void writeToFile(DataOutputStream dos) throws IOException { + dos.writeFloat(matrix.m00); + dos.writeFloat(matrix.m01); + dos.writeFloat(matrix.m02); + dos.writeFloat(matrix.m03); + dos.writeFloat(matrix.m10); + dos.writeFloat(matrix.m11); + dos.writeFloat(matrix.m12); + dos.writeFloat(matrix.m13); + dos.writeFloat(matrix.m20); + dos.writeFloat(matrix.m21); + dos.writeFloat(matrix.m22); + dos.writeFloat(matrix.m23); + dos.writeFloat(matrix.m30); + dos.writeFloat(matrix.m31); + dos.writeFloat(matrix.m32); + dos.writeFloat(matrix.m33); } Index: Transform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/Transform.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Transform.java 26 May 2003 01:48:00 -0000 1.5 --- Transform.java 17 Aug 2003 22:05:39 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- package org.jrman.geom; + import java.io.DataOutputStream; + import java.io.IOException; + import javax.vecmath.Matrix4f; import javax.vecmath.Point2f; *************** *** 79,82 **** --- 82,87 ---- boolean isPerspective(); + + void writeToFile(DataOutputStream dos) throws IOException; } Index: PerspectiveTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/PerspectiveTransform.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PerspectiveTransform.java 26 May 2003 01:48:00 -0000 1.8 --- PerspectiveTransform.java 17 Aug 2003 22:05:39 -0000 1.9 *************** *** 20,23 **** --- 20,27 ---- package org.jrman.geom; + import java.io.DataInputStream; + import java.io.DataOutputStream; + import java.io.IOException; + import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; *************** *** 42,45 **** --- 46,72 ---- } + public static Transform readFromFile(DataInputStream dis) throws IOException { + float a = dis.readFloat(); + float b = dis.readFloat(); + float c = dis.readFloat(); + float d = dis.readFloat(); + float e = dis.readFloat(); + float f = dis.readFloat(); + float g = dis.readFloat(); + float h = dis.readFloat(); + float i = dis.readFloat(); + float j = dis.readFloat(); + float k = dis.readFloat(); + float l = dis.readFloat(); + float m = dis.readFloat(); + float n = dis.readFloat(); + float o = dis.readFloat(); + float p = dis.readFloat(); + Matrix4f mat = new Matrix4f(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o ,p); + float near = dis.readFloat(); + float far = dis.readFloat(); + return new PerspectiveTransform(mat, near, far); + } + private PerspectiveTransform(Matrix4f matrix, float near, float far) { super(matrix); *************** *** 103,106 **** --- 130,139 ---- public boolean isPerspective() { return true; + } + + public void writeToFile(DataOutputStream dos) throws IOException { + super.writeToFile(dos); + dos.writeFloat(near); + dos.writeFloat(far); } |
From: <ma...@us...> - 2003-08-17 22:20:45
|
Update of /cvsroot/jrman/drafts/src/org/jrman/maps In directory sc8-pr-cvs1:/tmp/cvs-serv26878/src/org/jrman/maps Added Files: ShadowMap.java Log Message: Writes shadow maps --- NEW FILE: ShadowMap.java --- /* ShadowMap.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. */ package org.jrman.maps; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.jrman.geom.Transform; public class ShadowMap { public static class Projection { public final static Projection PERSPECTIVE = new Projection(1, "perspective"); public final static Projection ORTHOGRAPHIC = new Projection(2, "orthographic"); private int code; private String name; private static Map map = new HashMap(); static { map.put("perspective", PERSPECTIVE); map.put("orthographic", ORTHOGRAPHIC); } public static Projection getNamed(String name) { Projection result = (Projection) map.get(name); if (result == null) throw new IllegalArgumentException("No such ShadowMap projection: " + name); return result; } public static Projection getProjection(int code) { if (code == 1) return PERSPECTIVE; if (code == 2) return ORTHOGRAPHIC; throw new IllegalArgumentException("No such ShadowMap projection code: " + code); } public Projection(int code, String name) { this.code = code; this.name = name; } public int getCode() { return code; } public String getName() { return name; } public String toString() { return name; } } public static void writeShadowMap( String filename, Transform worldToCamera, Transform cameraToRaster, int width, int height, float[] depths) throws IOException { FileOutputStream fos = new FileOutputStream(filename); BufferedOutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos); if (worldToCamera.isPerspective()) dos.writeByte(Projection.getNamed("perspective").getCode()); else dos.writeByte(Projection.getNamed("orthographic").getCode()); worldToCamera.writeToFile(dos); if (cameraToRaster.isPerspective()) dos.writeByte(Projection.getNamed("perspective").getCode()); else dos.writeByte(Projection.getNamed("orthographic").getCode()); cameraToRaster.writeToFile(dos); dos.writeInt(width); dos.writeInt(height); for (int i = 0; i < depths.length; i++) dos.writeFloat(depths[i]); dos.flush(); dos.close(); } } |
From: <ma...@us...> - 2003-08-17 22:20:44
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv26878/src/org/jrman/render Modified Files: RendererHidden.java Sampler.java ImageStore.java Added Files: ZStore.java Log Message: Writes shadow maps --- NEW FILE: ZStore.java --- /* 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. */ package org.jrman.render; public class ZStore { private int hSize; private int vSize; private float[] depths; public ZStore(int hSize, int vSize) { this.hSize = hSize; this.vSize = vSize; depths = new float[hSize * vSize]; } 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) continue; for (int col = 0; col < w; col++) { if (x + col < 0 || x + col >= hSize) continue; float depth = bucketDepths[row * rowLength + col]; depths[(y+ row) * hSize + x + col] = depth; } } } public float[] getDepths() { return depths; } public int getHSize() { return hSize; } public int getVSize() { return vSize; } } Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** RendererHidden.java 17 Jul 2003 16:35:48 -0000 1.40 --- RendererHidden.java 17 Aug 2003 22:05:39 -0000 1.41 *************** *** 41,44 **** --- 41,45 ---- import org.jrman.geom.Plane; import org.jrman.geom.Transform; + import org.jrman.maps.ShadowMap; import org.jrman.options.CameraProjection; import org.jrman.options.Display; *************** *** 249,252 **** --- 250,255 ---- public void render() { worldParseEnd = System.currentTimeMillis(); + Display.Mode displayMode = frame.getDisplay().getMode(); + Display.Type displayType = frame.getDisplay().getType(); ImageStore imageStore = new ImageStore( *************** *** 254,261 **** frame.getVerticalResolution(), frame.getDisplay()); RenderCanvas rc = null; ! if (frame.getDisplay().getType() == Display.Type.FRAMEBUFFER) { JFrame jf = new JFrame(); ! // jf.getRootPane().setDoubleBuffered(false); jf.setTitle(frame.getDisplay().getName()); rc = new RenderCanvas(imageStore); --- 257,268 ---- frame.getVerticalResolution(), frame.getDisplay()); + ZStore zStore = null; + if (displayMode == Display.Mode.Z) + zStore = + new ZStore(frame.getHorizontalResolution(), frame.getVerticalResolution()); RenderCanvas rc = null; ! if (displayType == Display.Type.FRAMEBUFFER) { JFrame jf = new JFrame(); ! jf.getRootPane().setDoubleBuffered(false); jf.setTitle(frame.getDisplay().getName()); rc = new RenderCanvas(imageStore); *************** *** 295,298 **** --- 302,306 ---- float[] filteredSamples = new float[bucketWidth * bucketHeight * 3]; int[] pixels = new int[bucketWidth * bucketHeight]; + float[] depths = new float[bucketWidth * bucketHeight]; long start = System.currentTimeMillis(); Point2f rmin = rasterWindow.getMin(); *************** *** 348,392 **** sampler.sampleBucket(bucket); bucket.flush(); ! sampler.getColors( ! samples, ! (column * sampler.getWidth() ! + (row == 0 ? 0 : 1) ! * (vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * bucketColumns ! * sampler.getWidth()) ! * 3, ! bucketColumns * sampler.getWidth(), ! 3, ! 0); ! samplesFilter.doFilter( ! samples, ! (column * sampler.getWidth() ! - (column == 0 ! ? 0 ! : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 3, ! bucketColumns * sampler.getWidth(), ! filteredSamples, ! 0, ! bucketWidth, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! sampler.getPixelWidth(), ! sampler.getPixelHeight(), ! 3); ! 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), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! bucketWidth); ! if (rc != null) ! rc.repaint( 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)); } System.arraycopy( --- 356,413 ---- sampler.sampleBucket(bucket); bucket.flush(); ! 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()) ! * 3, ! bucketColumns * sampler.getWidth(), ! 3, ! 0); ! samplesFilter.doFilter( ! samples, ! (column * sampler.getWidth() ! - (column == 0 ! ? 0 ! : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 3, ! bucketColumns * sampler.getWidth(), ! filteredSamples, ! 0, ! bucketWidth, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! sampler.getPixelWidth(), ! sampler.getPixelHeight(), ! 3); ! 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), ! bucketHeight - (row == 0 ? vPixelLess : 0), ! bucketWidth); ! if (rc != null) ! rc.repaint( ! 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); ! } } System.arraycopy( *************** *** 404,413 **** * 3); } ! if (frame.getDisplay().getType() == Display.Type.FILE) try { ! String name = frame.getDisplay().getName(); ! String ext = name.substring(name.lastIndexOf('.') + 1); ! File file = new File(frame.getDisplay().getName()); ! ImageIO.write(imageStore.getImage(), ext, file); } catch (Exception e) { System.err.println("Error writing image file: " + e); --- 425,443 ---- * 3); } ! if (displayType == Display.Type.FILE) try { ! if (displayMode == Display.Mode.RGB || displayMode == Display.Mode.RGBA) { ! String name = frame.getDisplay().getName(); ! String ext = name.substring(name.lastIndexOf('.') + 1); ! File file = new File(frame.getDisplay().getName()); ! 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); *************** *** 456,460 **** getBucket(column + 1, row).prefetchMicropolygons(); else if (row < bucketRows - 1) ! getBucket(0, row + 1).prefetchMicropolygons(); } --- 486,490 ---- getBucket(column + 1, row).prefetchMicropolygons(); else if (row < bucketRows - 1) ! getBucket(0, row + 1).prefetchMicropolygons(); } Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Sampler.java 25 Jun 2003 17:14:04 -0000 1.7 --- Sampler.java 17 Aug 2003 22:05:39 -0000 1.8 *************** *** 141,144 **** --- 141,152 ---- } } + + public void getDepths(float[] depths) { + for (int row = 0; row < height; row++) + for (int col = 0; col < width; col++) { + int offset = row * width + col; + depths[offset] = samplePoints[offset].getZ(); + } + } public SamplePoint getSamplePoint(int column, int row) { Index: ImageStore.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ImageStore.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImageStore.java 12 Jul 2003 21:09:42 -0000 1.4 --- ImageStore.java 17 Aug 2003 22:05:39 -0000 1.5 *************** *** 1,4 **** /* ! RenderCanvas.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! ImageStore.java Copyright (C) 2003 Gerardo Horvilleur Martinez |
From: <edi...@us...> - 2003-08-13 03:59:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv16176/src/org/jrman/shaders Modified Files: DisplacementBumpy.java Log Message: Fixed Hyperboloid Normals and Bounding Box Index: DisplacementBumpy.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/DisplacementBumpy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DisplacementBumpy.java 1 Jun 2003 16:59:50 -0000 1.1 --- DisplacementBumpy.java 13 Aug 2003 03:59:39 -0000 1.2 *************** *** 1,12 **** - package org.jrman.shaders; - import org.jrman.geom.Transform; - import org.jrman.grid.FloatGrid; - import org.jrman.grid.Point3fGrid; - import org.jrman.grid.Vector3fGrid; - import org.jrman.parser.Declaration; - import org.jrman.parser.Global; - import org.jrman.parser.Parameter; - import org.jrman.render.ShaderVariables; - /* DisplacementBumpy.java --- 1,2 ---- *************** *** 27,71 **** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ public class DisplacementBumpy extends DisplacementShader { ! ! private static FloatGrid fg1 = new FloatGrid(); ! ! private static Vector3fGrid Nn = new Vector3fGrid(); ! ! private static Point3fGrid P2 = new Point3fGrid(); ! ! protected void initDefaults() { ! float[][] Km = new float[1][]; ! Km[0] = new float[1]; ! Km[0][0] = 1f; ! Parameter param = new Parameter(new Declaration("Km", "uniform float"), Km); ! defaultParameters.put("Km", param); ! String[][] texturename = new String[1][]; ! texturename[0] = new String[1]; ! texturename[0][0] = ""; ! param = new Parameter(new Declaration("texturename", "string"), texturename); ! defaultParameters.put("texturename", param); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Km"); ! float f[][] = (float[][]) param.getData(); ! final float Km = f[0][0]; ! param = (Parameter) getParameter(sv, "texturename"); ! String[][] s = (String[][]) param.getData(); ! final String texturename = s[0][0]; ! if (!texturename.equals("")) ! fg1.texture(texturename, sv.s, sv.t); ! else ! fg1.set(0f); ! fg1.mul(fg1, Km); ! Nn.normalize(sv.N); ! P2.set(fg1); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } --- 17,72 ---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + package org.jrman.shaders; + import org.jrman.grid.FloatGrid; + import org.jrman.grid.Point3fGrid; + import org.jrman.grid.Vector3fGrid; + import org.jrman.parser.Declaration; + import org.jrman.parser.Parameter; + import org.jrman.render.ShaderVariables; public class DisplacementBumpy extends DisplacementShader { ! ! private static FloatGrid fg1 = new FloatGrid(); ! ! private static Vector3fGrid Nn = new Vector3fGrid(); ! ! private static Point3fGrid P2 = new Point3fGrid(); ! ! protected void initDefaults() { ! float[][] Km = new float[1][]; ! Km[0] = new float[1]; ! Km[0][0] = 1f; ! Parameter param = ! new Parameter(new Declaration("Km", "uniform float"), Km); ! defaultParameters.put("Km", param); ! String[][] texturename = new String[1][]; ! texturename[0] = new String[1]; ! texturename[0][0] = ""; ! param = ! new Parameter( ! new Declaration("texturename", "string"), ! texturename); ! defaultParameters.put("texturename", param); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! Parameter param = (Parameter) getParameter(sv, "Km"); ! float f[][] = (float[][]) param.getData(); ! final float Km = f[0][0]; ! param = (Parameter) getParameter(sv, "texturename"); ! String[][] s = (String[][]) param.getData(); ! final String texturename = s[0][0]; ! if (!texturename.equals("")) ! fg1.texture(texturename, sv.s, sv.t); ! else ! fg1.set(0f); ! fg1.mul(fg1, Km); ! Nn.normalize(sv.N); ! P2.set(fg1); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } |
From: <edi...@us...> - 2003-08-13 03:59:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1:/tmp/cvs-serv16176/src/org/jrman/util Modified Files: Calc.java Log Message: Fixed Hyperboloid Normals and Bounding Box Index: Calc.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/Calc.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Calc.java 23 May 2003 06:47:02 -0000 1.9 --- Calc.java 13 Aug 2003 03:59:38 -0000 1.10 *************** *** 27,32 **** import javax.vecmath.Vector3f; - import org.jrman.geom.Transform; - public class Calc { --- 27,30 ---- |
From: <edi...@us...> - 2003-08-13 03:59:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv16176/src/org/jrman/parser Modified Files: Parser.java Log Message: Fixed Hyperboloid Normals and Bounding Box Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Parser.java 25 Jul 2003 13:56:50 -0000 1.56 --- Parser.java 13 Aug 2003 03:59:38 -0000 1.57 *************** *** 1077,1083 **** thetaMin, thetaMax, - thetaMax, - z1, - z2, parameters, getAttributes())); --- 1077,1080 ---- *************** *** 1096,1102 **** thetaMin, thetaMax, - thetaMax, - z1, - z2, parameters, createAttributes(transform, attributes)); --- 1093,1096 ---- |
From: <edi...@us...> - 2003-08-13 03:59:41
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv16176/sampleData Modified Files: hyperboloid.rib hyperboloid2.rib Log Message: Fixed Hyperboloid Normals and Bounding Box Index: hyperboloid.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/hyperboloid.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** hyperboloid.rib 5 Aug 2003 23:52:18 -0000 1.3 --- hyperboloid.rib 13 Aug 2003 03:59:38 -0000 1.4 *************** *** 1,6 **** Option "statistics" "endofframe" 1 ! Format 400 300 1 Display "hyperboloid" "framebuffer" "rgba" ! PixelSamples 2 2 Exposure 1 2.5 Projection "perspective" "fov" 40 --- 1,6 ---- Option "statistics" "endofframe" 1 ! Format 512 384 1 Display "hyperboloid" "framebuffer" "rgba" ! PixelSamples 4 4 Exposure 1 2.5 Projection "perspective" "fov" 40 *************** *** 8,31 **** WorldBegin ! #Attribute "displacementbound" "sphere" 1 ! #ShadingRate 100 ! #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] ! LightSource "ambientlight" 2 "intensity" 0.1 ! #Surface "plastic" ! #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin Color 1 0 0 Hyperboloid 3 3 0 -3 -3 0 135 AttributeEnd ! #AttributeBegin ! # Translate -12 0 0 ! # Color 0 1 0 ! # Hyperboloid -2 -2 0 4 4 0 180 ! #AttributeEnd ! #AttributeBegin ! # Translate 12 0 0 ! # Color 0 0 1 ! # Hyperboloid 1 1 0 5 5 0 360 ! #AttributeEnd WorldEnd --- 8,31 ---- WorldBegin ! ShadingRate 1 ! LightSource "distantlight" 1 "intensity" .9 "from" [1 1 -1] "to" [0 0 0] ! LightSource "ambientlight" 2 "intensity" 1 ! Surface "plastic" ! Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] ! AttributeBegin ! Translate -12 0 0 ! Rotate 45 0 0 1 ! Color 0 1 0 ! Hyperboloid -2 -2 0 4 4 0 180 ! AttributeEnd AttributeBegin Color 1 0 0 Hyperboloid 3 3 0 -3 -3 0 135 AttributeEnd ! AttributeBegin ! Translate 12 0 0 ! Color 0 0 1 ! Hyperboloid 1 1 0 5 5 0 360 ! AttributeEnd WorldEnd Index: hyperboloid2.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/hyperboloid2.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hyperboloid2.rib 5 Aug 2003 23:52:18 -0000 1.1 --- hyperboloid2.rib 13 Aug 2003 03:59:38 -0000 1.2 *************** *** 1,6 **** Option "statistics" "endofframe" 1 ! Format 400 300 1 Display "hyperboloid" "framebuffer" "rgba" ! PixelSamples 2 2 Exposure 1 2.5 Projection "perspective" "fov" 40 --- 1,6 ---- Option "statistics" "endofframe" 1 ! Format 800 600 1 Display "hyperboloid" "framebuffer" "rgba" ! PixelSamples 4 4 Exposure 1 2.5 Projection "perspective" "fov" 40 *************** *** 8,17 **** WorldBegin ! #Attribute "displacementbound" "sphere" 8 ! #ShadingRate 100 ! #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] LightSource "ambientlight" 2 "intensity" 0.1 ! #Surface "plastic" ! #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin Translate 7 -5 0 --- 8,16 ---- WorldBegin ! ShadingRate 0.5 ! LightSource "distantlight" 1 "intensity" .9 "from" [1 1 -1] "to" [0 0 0] LightSource "ambientlight" 2 "intensity" 0.1 ! Surface "plastic" ! Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin Translate 7 -5 0 |
From: <edi...@us...> - 2003-08-13 03:59:41
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv16176/src/org/jrman/primitive Modified Files: Hyperboloid.java Log Message: Fixed Hyperboloid Normals and Bounding Box Index: Hyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Hyperboloid.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Hyperboloid.java 5 Aug 2003 23:52:18 -0000 1.5 --- Hyperboloid.java 13 Aug 2003 03:59:38 -0000 1.6 *************** *** 38,41 **** --- 38,49 ---- private static Vector3f vtmp = new Vector3f(); + + private static Point3f p1 = new Point3f(); + + private static Point3f p2 = new Point3f(); + + private static Vector3f v1 = new Vector3f(); + + private static Vector3f v2 = new Vector3f(); private float x1; *************** *** 55,64 **** private float thetaMax; - private float maxTheta; - - private float maxZ1; - - private float maxZ2; - public Hyperboloid( float x1, --- 63,66 ---- *************** *** 70,76 **** float thetaMin, float thetaMax, - float maxTheta, - float maxZ1, - float maxZ2, Map parameters, Attributes attributes) { --- 72,75 ---- *************** *** 84,119 **** this.thetaMin = thetaMin; this.thetaMax = thetaMax; - this.maxTheta = maxTheta; - this.maxZ1 = maxZ1; - this.maxZ2 = maxZ2; } public BoundingVolume getBoundingVolume() { ! //float cosTMin = (float) Math.cos(thetaMin); ! //float sinTMin = (float) Math.sin(thetaMin); ! //float cosTMax = (float) Math.cos(thetaMax); ! //float sinTMax = (float) Math.sin(thetaMax); ! //float x1Min = x1 * cosTMin - y1 * sinTMin; ! //float y1Min = x1 * sinTMin + y1 * cosTMin; ! //float x1Max = x1 * cosTMax - y1 * sinTMax; ! //float y1Max = x1 * sinTMax + y1 * cosTMax; ! //float gamma1Min = (float) Math.atan2(y1Min, x1Min); ! //float gamma1Max = (float) Math.atan2(y1Max, x1Max); ! float gamma1Min = (float) Math.atan2(y1, x1); if (gamma1Min < 0) ! gamma1Min += Math.PI * 2f; float gamma1Max = gamma1Min + (thetaMax - thetaMin); - if (gamma1Max < 0) - gamma1Max += Math.PI * 2f; - - if ((thetaMax - thetaMin) - (gamma1Max - gamma1Min) > 0.001) - System.out.println("WARNING:" + gamma1Min + ":" + gamma1Max); float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! //int angleCase1 = ! // whichQuadrant(gamma1Min) + (whichQuadrant(gamma1Max) << 2); ! float[] values1 = analizeAngleCase2(r1, gamma1Min, gamma1Max); float x11Min = values1[0]; float x11Max = values1[1]; --- 83,104 ---- this.thetaMin = thetaMin; this.thetaMax = thetaMax; } public BoundingVolume getBoundingVolume() { ! float cosTMin = (float) Math.cos(thetaMin); ! float sinTMin = (float) Math.sin(thetaMin); ! float cosTMax = (float) Math.cos(thetaMax); ! float sinTMax = (float) Math.sin(thetaMax); ! float x1Min = x1 * cosTMin - y1 * sinTMin; ! float y1Min = x1 * sinTMin + y1 * cosTMin; ! float gamma1Min = (float) Math.atan2(y1Min, x1Min); if (gamma1Min < 0) ! gamma1Min += (float) Math.PI * 2f; float gamma1Max = gamma1Min + (thetaMax - thetaMin); float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float[] values1 = analizeAngleCase(r1, gamma1Min, gamma1Max); float x11Min = values1[0]; float x11Max = values1[1]; *************** *** 121,145 **** float y11Max = values1[3]; ! //float x2Min = x2 * cosTMin - y2 * sinTMin; ! //float y2Min = x2 * sinTMin + y2 * cosTMin; ! //float x2Max = x2 * cosTMax - y2 * sinTMax; ! //float y2Max = x2 * sinTMax + y2 * cosTMax; ! //float gamma2Min = (float) Math.atan2(y2Min, x2Min); ! //float gamma2Max = (float) Math.atan2(y2Max, x2Max); ! float gamma2Min = (float) Math.atan2(y2, x2); if (gamma2Min < 0) ! gamma2Min += Math.PI * 2f; float gamma2Max = gamma2Min + (thetaMax - thetaMin); - if (gamma2Max < 0) - gamma2Max += Math.PI * 2f; - - if ((thetaMax - thetaMin) - (gamma2Max - gamma2Min) > 0.001) - System.out.println("WARNING:" + gamma2Min + ":" + gamma2Max); float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! //int angleCase2 = ! // whichQuadrant(gamma2Min) + (whichQuadrant(gamma2Max) << 2); ! float[] values2 = analizeAngleCase2(r2, gamma2Min, gamma2Max); float x22Min = values2[0]; float x22Max = values2[1]; --- 106,119 ---- float y11Max = values1[3]; ! float x2Min = x2 * cosTMin - y2 * sinTMin; ! float y2Min = x2 * sinTMin + y2 * cosTMin; ! float gamma2Min = (float) Math.atan2(y2Min, x2Min); if (gamma2Min < 0) ! gamma2Min += (float) Math.PI * 2f; float gamma2Max = gamma2Min + (thetaMax - thetaMin); float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float[] values2 = analizeAngleCase(r2, gamma2Min, gamma2Max); float x22Min = values2[0]; float x22Max = values2[1]; *************** *** 155,186 **** Bounds3f b3f = new Bounds3f(xMin, xMax, yMin, yMax, zMin, zMax); - //System.out.println("r1:" + r1 + " r2:" + r2); - //System.out.println(b3f); return b3f; } - private int whichQuadrant(float angle) { - int result; - if (angle > Math.PI * 2f) - angle -= Math.PI * 2f; - if (angle >= 0f && angle < Math.PI / 2f) - result = 0; - else if (angle >= Math.PI / 2f && angle < Math.PI) - result = 1; - else if (angle >= Math.PI && angle < Math.PI * 3f / 2f) - result = 2; - else - result = 3; - return result; - } - private boolean passAngle(float angle, float minAngle, float maxAngle) { ! return minAngle <= angle && angle <= maxAngle; } ! private float[] analizeAngleCase2( ! float r, ! float gammaMin, ! float gammaMax) { float[] values = new float[4]; --- 129,140 ---- Bounds3f b3f = new Bounds3f(xMin, xMax, yMin, yMax, zMin, zMax); return b3f; } private boolean passAngle(float angle, float minAngle, float maxAngle) { ! return minAngle < angle && angle < maxAngle; } ! private float[] analizeAngleCase(float r, float gammaMin, float gammaMax) { float[] values = new float[4]; *************** *** 189,378 **** float cosGammaMax = (float) Math.cos(gammaMax); float sinGammaMax = (float) Math.sin(gammaMax); ! float xMin; ! float xMax; ! float yMin; ! float yMax; ! ! xMin = getMin(r, cosGammaMin, cosGammaMax); ! xMax = getMax(r, cosGammaMin, cosGammaMax); ! yMin = getMin(r, sinGammaMin, sinGammaMax); ! yMax = getMax(r, sinGammaMin, sinGammaMax); ! if (passAngle((float) Math.PI / 2f, gammaMin, gammaMax)) { yMax = r; } ! if (passAngle((float) Math.PI, gammaMin, gammaMax)) { xMin = -r; } ! if (passAngle((float) Math.PI * 3f / 2f, gammaMin, gammaMax)) { yMin = -r; } if (passAngle(0f, gammaMin, gammaMax) || passAngle((float) Math.PI * 2f, gammaMin, gammaMax)) { ! xMax = r; } ! values[0] = xMin; ! values[1] = xMax; ! values[2] = yMin; ! values[3] = yMax; ! return values; ! } ! ! private float[] analizeAngleCase( ! int angleCase, ! float r1, ! float gammaMin, ! float gammaMax) { ! ! float[] values = new float[4]; ! float cosGammaMin = (float) Math.cos(gammaMin); ! float sinGammaMin = (float) Math.sin(gammaMin); ! float cosGammaMax = (float) Math.cos(gammaMax); ! float sinGammaMax = (float) Math.sin(gammaMax); ! float xMin; ! float xMax; ! float yMin; ! float yMax; ! switch (angleCase) { ! case 0 : // 0 gammaMin 1 gammaMax 1 ! if (gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 1 : // 1 gammaMin 2 gammaMax 1 ! xMin = -r1; ! xMax = r1; ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 2 : // 1 gammaMin 3 gammaMax 1 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 3 : // 3 gammaMin 4 gammaMax 1 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 4 : // 4 gammaMin 1 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 5 : // 5 gammaMin 2 gammaMax 2 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 6 : // 6 gammaMin 3 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = -r1; ! yMax = r1; ! break; ! case 7 : // 7 gammaMin 4 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 8 : // 8 gammaMin 1 gammaMax 3 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 9 : // 9 gammaMin 2 gammaMax 3 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 10 : //10 gammaMin 3 gammaMax 3 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 11 : //11 gammaMin 4 gammaMax 3 ! xMin = -r1; ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 12 : //12 gammaMin 1 gammaMax 4 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = r1; ! break; ! case 13 : //13 gammaMin 2 gammaMax 4 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 14 : //14 gammaMin 3 gammaMax 4 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! default : //15 gammaMin 4 gammaMax 4 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; } values[0] = xMin; ! values[1] = xMax; ! values[2] = yMin; ! values[3] = yMax; ! return values; ! } ! ! private float getMin(float r, float angle1, float angle2) { ! float result = r * angle1; return Math.min(result, r * angle2); } ! ! private float getMax(float r, float angle1, float angle2) { ! float result = r * angle1; return Math.max(result, r * angle2); } public Primitive[] split() { float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float r = ! (float) Math.sqrt( ! (x2 - x1) * (x2 - x1) ! + (y2 - y1) * (y2 - y1) ! + (z2 - z1) * (z2 - z1)); ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1, r2) > r) { result[0] = new Hyperboloid( --- 143,194 ---- float cosGammaMax = (float) Math.cos(gammaMax); float sinGammaMax = (float) Math.sin(gammaMax); ! float xMin = Math.min(r * cosGammaMin, r * cosGammaMax); ! float xMax = Math.max(r * cosGammaMin, r * cosGammaMax); ! float yMin = Math.min(r * sinGammaMin, r * sinGammaMax); ! float yMax = Math.max(r * sinGammaMin, r * sinGammaMax); ! if (passAngle((float) Math.PI / 2f, gammaMin, gammaMax) ! || passAngle( ! (float) Math.PI / 2f + (float) Math.PI * 2f, ! gammaMin, ! gammaMax)) { yMax = r; } ! if (passAngle((float) Math.PI, gammaMin, gammaMax) ! || passAngle( ! (float) Math.PI + (float) Math.PI * 2f, ! gammaMin, ! gammaMax)) { xMin = -r; } ! if (passAngle((float) Math.PI * 3f / 2f, gammaMin, gammaMax) ! || passAngle( ! (float) Math.PI * 3f / 2f + (float) Math.PI * 2f, ! gammaMin, ! gammaMax)) { yMin = -r; } if (passAngle(0f, gammaMin, gammaMax) || passAngle((float) Math.PI * 2f, gammaMin, gammaMax)) { ! xMax = r; ! } values[0] = xMin; ! values[1] = xMax; ! values[2] = yMin; ! values[3] = yMax; ! return values; ! } public Primitive[] split() { float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float r = ! (float) Math.sqrt( ! (x2 - x1) * (x2 - x1) ! + (y2 - y1) * (y2 - y1) ! + (z2 - z1) * (z2 - z1)); ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1, r2) > r) { result[0] = new Hyperboloid( *************** *** 385,409 **** thetaMin, (thetaMin + thetaMax) / 2f, - maxTheta, - maxZ1, - maxZ2, linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { result[0] = new Hyperboloid( --- 201,219 ---- thetaMin, (thetaMin + thetaMax) / 2f, linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { result[0] = new Hyperboloid( *************** *** 416,466 **** thetaMin, thetaMax, - maxTheta, - maxZ1, - maxZ2, linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); ! result[1] = ! new Hyperboloid( ! (x1 + x2) / 2f, ! (y1 + y2) / 2f, ! (z1 + z2) / 2f, ! x2, ! y2, ! z2, ! thetaMin, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(0f, 1f, .5f, 1f), ! attributes); ! } ! return result; } protected void dice_P(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Point3fGrid P = shaderVariables.P; ! //System.out.println("ThetaMin: " + Math.toDegrees(thetaMin)); ! //System.out.println("ThetaMax: " + Math.toDegrees(thetaMax)); ! //System.out.println("P1: " + x1 + ":" + y1 + ":" + z1); ! //System.out.println("P2: " + x2 + ":" + y2 + ":" + z2); ! for ( ! int u = 0; u < uSize; u++) { ! float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! float nv = (float) v / (vSize - 1); ! float xr = (1f - nv) * x1 + nv * x2; ! float yr = (1f - nv) * y1 + nv * y2; ! float zr = (1f - nv) * z1 + nv * z2; ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! } } } --- 226,269 ---- thetaMin, thetaMax, linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); ! result[1] = ! new Hyperboloid( ! (x1 + x2) / 2f, ! (y1 + y2) / 2f, ! (z1 + z2) / 2f, ! x2, ! y2, ! z2, ! thetaMin, ! thetaMax, ! linearInterpolateParameters(0f, 1f, .5f, 1f), ! attributes); ! } ! return result; ! } protected void dice_P(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! float vDelta = 1f / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! float theta = thetaMin; ! for (int u = 0; u < uSize; u++) { ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! float nv = 0f; ! for (int v = 0; v < vSize; v++) { ! float xr = (1f - nv) * x1 + nv * x2; ! float yr = (1f - nv) * y1 + nv * y2; ! float zr = (1f - nv) * z1 + nv * z2; ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! nv += vDelta; ! } ! theta += thetaDelta; } } *************** *** 468,497 **** protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; ! //float dZ = (-maxZ1 + maxZ2) * maxTheta; ! float dZ = ! (-z1 + z2) * -maxTheta; ! float dX = -x1 + x2; ! float dY = -y1 + y2; ! for (int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { float nv = (float) v / (vSize - 1); ! float vX = (1 - nv) * x1 + nv * x2; ! float vY = (1 - nv) * y1 + nv * y2; ! vtmp.x = dZ * (vX * cosTheta + vY * sinTheta); ! vtmp.y = dZ * (vX * sinTheta + vY * cosTheta); ! vtmp.z = ! maxTheta ! * (dX * sinTheta - dY * cosTheta) ! * (vX * sinTheta + vY * cosTheta) ! - (dX * cosTheta - dY * sinTheta) ! * (vX * cosTheta + vY * sinTheta); ! Ng.set(u, v, vtmp); ! } } } --- 271,296 ---- protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; ! for (int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! float x11 = x1 * cosTheta - y1 * sinTheta; ! float x22 = x2 * cosTheta - y2 * sinTheta; ! float y11 = x1 * sinTheta + y1 * cosTheta; ! float y22 = x2 * sinTheta + y2 * cosTheta; ! p1.set(x11, y11, z1); ! p2.set(x22, y22, z2); ! v1.sub(p1, p2); ! for (int v = 0; v < vSize; v++) { float nv = (float) v / (vSize - 1); ! float xi = (1f - nv) * x11 + nv * x22; ! float yi = (1f - nv) * y11 + nv * y22; ! v2.set(-yi, xi, 0f); ! vtmp.cross(v1, v2); ! Ng.set(u, v, vtmp); ! } } } |
From: <edi...@us...> - 2003-08-05 23:52:21
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv26512/src/org/jrman/parser/keywords Modified Files: KeywordHyperboloid.java Log Message: trying to fix bounding volumne in Hyperboloid. Index: KeywordHyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordHyperboloid.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** KeywordHyperboloid.java 25 Jul 2003 13:56:50 -0000 1.5 --- KeywordHyperboloid.java 5 Aug 2003 23:52:18 -0000 1.6 *************** *** 26,65 **** public class KeywordHyperboloid extends MoveableObjectKeywordParser { ! public void parse(Tokenizer st) throws Exception { ! boolean array = false; ! int token = st.nextToken(); ! // Check por array ! if (token == TK_LBRACE) ! array = true; ! else ! st.pushBack(); ! // Expect x1 ! match(st, TK_NUMBER); ! float x1 = (float) st.nval; ! // Expect y1 ! match(st, TK_NUMBER); ! float y1 = (float) st.nval; ! // Expect z1 ! match(st, TK_NUMBER); ! float z1 = (float) st.nval; ! // Expect x2 ! match(st, TK_NUMBER); ! float x2 = (float) st.nval; ! // Expect y2 ! match(st, TK_NUMBER); ! float y2 = (float) st.nval; ! // Expect z2 ! match(st, TK_NUMBER); ! float z2 = (float) st.nval; ! // Expect theta max ! match(st, TK_NUMBER); ! float thetaMax = (float) st.nval; ! if (array) ! match(st, TK_RBRACE); ! // Expect parameter list ! Map parameters = parseParameterList(st); ! parser.addHyperboloid(x1,y1,z1,x2,y2,z2,thetaMax,parameters); ! } } --- 26,65 ---- public class KeywordHyperboloid extends MoveableObjectKeywordParser { ! public void parse(Tokenizer st) throws Exception { ! boolean array = false; ! int token = st.nextToken(); ! // Check por array ! if (token == TK_LBRACE) ! array = true; ! else ! st.pushBack(); ! // Expect x1 ! match(st, TK_NUMBER); ! float x1 = (float) st.nval; ! // Expect y1 ! match(st, TK_NUMBER); ! float y1 = (float) st.nval; ! // Expect z1 ! match(st, TK_NUMBER); ! float z1 = (float) st.nval; ! // Expect x2 ! match(st, TK_NUMBER); ! float x2 = (float) st.nval; ! // Expect y2 ! match(st, TK_NUMBER); ! float y2 = (float) st.nval; ! // Expect z2 ! match(st, TK_NUMBER); ! float z2 = (float) st.nval; ! // Expect theta max ! match(st, TK_NUMBER); ! float thetaMax = (float) st.nval; ! if (array) ! match(st, TK_RBRACE); ! // Expect parameter list ! Map parameters = parseParameterList(st); ! parser.addHyperboloid(x1, y1, z1, x2, y2, z2, thetaMax, parameters); ! } } |
From: <edi...@us...> - 2003-08-05 23:52:21
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv26512/sampleData Modified Files: hyperboloid.rib Added Files: hyperboloid2.rib Log Message: trying to fix bounding volumne in Hyperboloid. --- NEW FILE: hyperboloid2.rib --- Option "statistics" "endofframe" 1 Format 400 300 1 Display "hyperboloid" "framebuffer" "rgba" PixelSamples 2 2 Exposure 1 2.5 Projection "perspective" "fov" 40 Translate 0 0 40 WorldBegin #Attribute "displacementbound" "sphere" 8 #ShadingRate 100 #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] LightSource "ambientlight" 2 "intensity" 0.1 #Surface "plastic" #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin Translate 7 -5 0 Rotate 90 1 0 0 Color 0 1 1 Hyperboloid -3 -3 0 4 4 0 360 AttributeEnd AttributeBegin Translate 9 -2 0 Color 0 1 1 Hyperboloid -3 -3 0 4 4 0 180 AttributeEnd AttributeBegin Translate 9 -7 0 Rotate 90 1 0 0 Color 0 0.5 0.5 Hyperboloid 2 3 3 2 4 4 360 AttributeEnd AttributeBegin Translate 12 -5 0 Color 0 0.5 0.5 Hyperboloid 2 3 3 2 4 4 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] AttributeEnd AttributeBegin Translate -8 10 0 Rotate 90 1 0 0 Color 1 0 0 Hyperboloid 1 1 1 5 5 5 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] AttributeEnd AttributeBegin Translate -12 -7 0 Color 1 0 0 Hyperboloid 1 1 1 5 5 5 360 AttributeEnd AttributeBegin Translate -2 0 0 Rotate 90 1 0 0 Color 0 1 0 Hyperboloid -3 -3 -3 4 4 4 360 AttributeEnd AttributeBegin Translate 0 -5 0 Rotate 90 1 0 0 Color 0 0 1 Hyperboloid 1 1 1 3 3 3 360 AttributeEnd AttributeBegin Translate 8 12 0 Rotate 90 1 0 0 Color 0.3 0.3 0.3 Hyperboloid 2 2 2 2 2 7 360 AttributeEnd AttributeBegin Translate 11 11 5 Rotate 90 0 1 0 Rotate 45 1 0 0 Color 0.3 0.3 0.3 Hyperboloid 2 2 2 2 2 6 360 AttributeEnd AttributeBegin Translate 6 6 4 Rotate -45 1 0 0 Rotate -45 0 1 0 Color 1 1 1 Paraboloid 3 0 4 360 AttributeEnd AttributeBegin Translate 1 0 6 Rotate 90 1 0 0 Color 1 1 1 Paraboloid 3 0 4 360 AttributeEnd AttributeBegin Translate 5 0 6 Rotate 90 0 1 0 Color 1 1 1 Paraboloid 3 0 4 360 AttributeEnd AttributeBegin Translate -10 1 0 Color 1 1 1 Paraboloid 3 0 4 360 AttributeEnd WorldEnd Index: hyperboloid.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/hyperboloid.rib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hyperboloid.rib 25 Jul 2003 13:56:50 -0000 1.2 --- hyperboloid.rib 5 Aug 2003 23:52:18 -0000 1.3 *************** *** 4,83 **** PixelSamples 2 2 Exposure 1 2.5 ! Projection "perspective" "fov" 30 Translate 0 0 40 WorldBegin ! #ShadingRate 0.25 #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] ! #LightSource "ambientlight" 2 "intensity" 0.1 #Surface "plastic" #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin ! Translate -6 4 0 ! #Rotate 45 1 1 1 ! Rotate 90 1 0 0 ! Color 1 0 0 ! #Hyperboloid 0 0 0 1 1 1 360 "Cs" [1 1 0 1 1 0 0 1 1 0 1 1] ! Hyperboloid -1 -1 -1 2 2 2 360 ! AttributeEnd ! AttributeBegin ! Translate -2 0 0 ! #Rotate -45 1 1 1 ! Rotate 90 1 0 0 ! Color 0 1 0 ! #Hyperboloid 1 1 1 1 0 2 360 "Cs" [1 0 1 1 0 1 0 0 1 0 0 1] ! Hyperboloid -3 -3 -3 4 4 4 360 ! AttributeEnd ! AttributeBegin ! Translate 0 -3 0 ! Color 0 0 1 ! Rotate 90 1 0 0 ! #Hyperboloid 2 2 2 3 3 3 360 "Cs" [0 1 1 0 1 1 0 0 1 0 0 1] ! Hyperboloid 1 1 1 3 3 3 360 ! AttributeEnd ! AttributeBegin ! Translate 2 2 2 ! Color 0.3 0.3 0.3 ! Rotate 90 1 0 0 ! #Hyperboloid 0 0 0 1 1 1 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] ! Hyperboloid 0 0 0 1 1 1 360 ! AttributeEnd ! ! AttributeBegin ! Translate 6 6 4 ! Rotate -45 1 0 0 ! Rotate -45 0 1 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate 1 0 6 ! Rotate 90 1 0 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate 5 0 6 ! Rotate 90 0 1 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate -10 1 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate 4 0 0 ! Rotate 45 1 1 1 ! Color 1 1 1 ! Paraboloid 2 0 3 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] ! AttributeEnd ! AttributeBegin ! Translate 4 4 0 ! Rotate 90 1 1 1 ! Color 1 1 1 ! Paraboloid 1 .5 1 270 AttributeEnd WorldEnd --- 4,31 ---- PixelSamples 2 2 Exposure 1 2.5 ! Projection "perspective" "fov" 40 Translate 0 0 40 WorldBegin ! #Attribute "displacementbound" "sphere" 1 ! #ShadingRate 100 #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] ! LightSource "ambientlight" 2 "intensity" 0.1 #Surface "plastic" #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin ! Color 1 0 0 ! Hyperboloid 3 3 0 -3 -3 0 135 AttributeEnd + #AttributeBegin + # Translate -12 0 0 + # Color 0 1 0 + # Hyperboloid -2 -2 0 4 4 0 180 + #AttributeEnd + #AttributeBegin + # Translate 12 0 0 + # Color 0 0 1 + # Hyperboloid 1 1 0 5 5 0 360 + #AttributeEnd WorldEnd |
From: <edi...@us...> - 2003-08-05 23:52:21
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv26512/src/org/jrman/primitive Modified Files: Hyperboloid.java Log Message: trying to fix bounding volumne in Hyperboloid. Index: Hyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Hyperboloid.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Hyperboloid.java 25 Jul 2003 13:56:50 -0000 1.4 --- Hyperboloid.java 5 Aug 2003 23:52:18 -0000 1.5 *************** *** 91,147 **** public BoundingVolume getBoundingVolume() { float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float cosThetaMin = (float) Math.cos(thetaMin); ! float sinThetaMin = (float) Math.sin(thetaMin); ! float cosThetaMax = (float) Math.cos(thetaMax); ! float sinThetaMax = (float) Math.sin(thetaMax); ! float rMax = Math.max(r1, r2); ! float rMin = Math.min(r1, r2); float xMin; ! float xMax = cosThetaMin * rMin; ! xMax = Math.max(xMax, cosThetaMin * rMax); ! xMax = Math.max(xMax, cosThetaMax * rMin); ! xMax = Math.max(xMax, cosThetaMax * rMax); float yMin; float yMax; ! if (thetaMin < Math.PI && thetaMax > Math.PI) ! xMin = -rMax; ! else { ! xMin = cosThetaMin * rMin; ! xMin = Math.min(xMin, cosThetaMin * rMax); ! xMin = Math.min(xMin, cosThetaMax * rMin); ! xMin = Math.min(xMin, cosThetaMax * rMax); } ! if (thetaMin < Math.PI / 2 && thetaMax > Math.PI / 2) ! yMax = rMax; ! else { ! yMax = sinThetaMin * rMin; ! yMax = Math.max(yMax, sinThetaMin * rMax); ! yMax = Math.max(yMax, sinThetaMax * rMin); ! yMax = Math.max(yMax, sinThetaMax * rMax); } ! if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) ! yMin = -rMax; ! else { ! yMin = sinThetaMin * rMin; ! yMin = Math.min(yMin, sinThetaMin * rMax); ! yMin = Math.min(yMin, sinThetaMax * rMin); ! yMin = Math.min(yMin, sinThetaMax * rMax); } ! Bounds3f result = new Bounds3f(xMin, xMax, yMin, yMax, z1, z2); ! return result; ! } public Primitive[] split() { float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float r = (float)Math.sqrt((x2 -x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)); ! ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1, r2) > r) { result[0] = new Hyperboloid( --- 91,378 ---- public BoundingVolume getBoundingVolume() { + //float cosTMin = (float) Math.cos(thetaMin); + //float sinTMin = (float) Math.sin(thetaMin); + //float cosTMax = (float) Math.cos(thetaMax); + //float sinTMax = (float) Math.sin(thetaMax); + //float x1Min = x1 * cosTMin - y1 * sinTMin; + //float y1Min = x1 * sinTMin + y1 * cosTMin; + //float x1Max = x1 * cosTMax - y1 * sinTMax; + //float y1Max = x1 * sinTMax + y1 * cosTMax; + //float gamma1Min = (float) Math.atan2(y1Min, x1Min); + //float gamma1Max = (float) Math.atan2(y1Max, x1Max); + + float gamma1Min = (float) Math.atan2(y1, x1); + if (gamma1Min < 0) + gamma1Min += Math.PI * 2f; + float gamma1Max = gamma1Min + (thetaMax - thetaMin); + if (gamma1Max < 0) + gamma1Max += Math.PI * 2f; + + if ((thetaMax - thetaMin) - (gamma1Max - gamma1Min) > 0.001) + System.out.println("WARNING:" + gamma1Min + ":" + gamma1Max); + float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); + //int angleCase1 = + // whichQuadrant(gamma1Min) + (whichQuadrant(gamma1Max) << 2); + float[] values1 = analizeAngleCase2(r1, gamma1Min, gamma1Max); + float x11Min = values1[0]; + float x11Max = values1[1]; + float y11Min = values1[2]; + float y11Max = values1[3]; + + //float x2Min = x2 * cosTMin - y2 * sinTMin; + //float y2Min = x2 * sinTMin + y2 * cosTMin; + //float x2Max = x2 * cosTMax - y2 * sinTMax; + //float y2Max = x2 * sinTMax + y2 * cosTMax; + //float gamma2Min = (float) Math.atan2(y2Min, x2Min); + //float gamma2Max = (float) Math.atan2(y2Max, x2Max); + + float gamma2Min = (float) Math.atan2(y2, x2); + if (gamma2Min < 0) + gamma2Min += Math.PI * 2f; + float gamma2Max = gamma2Min + (thetaMax - thetaMin); + if (gamma2Max < 0) + gamma2Max += Math.PI * 2f; + + if ((thetaMax - thetaMin) - (gamma2Max - gamma2Min) > 0.001) + System.out.println("WARNING:" + gamma2Min + ":" + gamma2Max); + float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); + //int angleCase2 = + // whichQuadrant(gamma2Min) + (whichQuadrant(gamma2Max) << 2); + float[] values2 = analizeAngleCase2(r2, gamma2Min, gamma2Max); + float x22Min = values2[0]; + float x22Max = values2[1]; + float y22Min = values2[2]; + float y22Max = values2[3]; ! float xMin = Math.min(x11Min, x22Min); ! float xMax = Math.max(x11Max, x22Max); ! float yMin = Math.min(y11Min, y22Min); ! float yMax = Math.max(y11Max, y22Max); ! float zMin = Math.min(z1, z2); ! float zMax = Math.max(z1, z2); ! ! Bounds3f b3f = new Bounds3f(xMin, xMax, yMin, yMax, zMin, zMax); ! //System.out.println("r1:" + r1 + " r2:" + r2); ! //System.out.println(b3f); ! return b3f; ! } ! ! private int whichQuadrant(float angle) { ! int result; ! if (angle > Math.PI * 2f) ! angle -= Math.PI * 2f; ! if (angle >= 0f && angle < Math.PI / 2f) ! result = 0; ! else if (angle >= Math.PI / 2f && angle < Math.PI) ! result = 1; ! else if (angle >= Math.PI && angle < Math.PI * 3f / 2f) ! result = 2; ! else ! result = 3; ! return result; ! } ! ! private boolean passAngle(float angle, float minAngle, float maxAngle) { ! return minAngle <= angle && angle <= maxAngle; ! } ! ! private float[] analizeAngleCase2( ! float r, ! float gammaMin, ! float gammaMax) { ! ! float[] values = new float[4]; ! float cosGammaMin = (float) Math.cos(gammaMin); ! float sinGammaMin = (float) Math.sin(gammaMin); ! float cosGammaMax = (float) Math.cos(gammaMax); ! float sinGammaMax = (float) Math.sin(gammaMax); float xMin; ! float xMax; float yMin; float yMax; ! ! xMin = getMin(r, cosGammaMin, cosGammaMax); ! xMax = getMax(r, cosGammaMin, cosGammaMax); ! yMin = getMin(r, sinGammaMin, sinGammaMax); ! yMax = getMax(r, sinGammaMin, sinGammaMax); ! ! if (passAngle((float) Math.PI / 2f, gammaMin, gammaMax)) { ! yMax = r; } ! if (passAngle((float) Math.PI, gammaMin, gammaMax)) { ! xMin = -r; } ! if (passAngle((float) Math.PI * 3f / 2f, gammaMin, gammaMax)) { ! yMin = -r; } + if (passAngle(0f, gammaMin, gammaMax) + || passAngle((float) Math.PI * 2f, gammaMin, gammaMax)) { + xMax = r; } + values[0] = xMin; + values[1] = xMax; + values[2] = yMin; + values[3] = yMax; + return values; + } ! private float[] analizeAngleCase( ! int angleCase, ! float r1, ! float gammaMin, ! float gammaMax) { ! ! float[] values = new float[4]; ! float cosGammaMin = (float) Math.cos(gammaMin); ! float sinGammaMin = (float) Math.sin(gammaMin); ! float cosGammaMax = (float) Math.cos(gammaMax); ! float sinGammaMax = (float) Math.sin(gammaMax); ! float xMin; ! float xMax; ! float yMin; ! float yMax; ! switch (angleCase) { ! case 0 : // 0 gammaMin 1 gammaMax 1 ! if (gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 1 : // 1 gammaMin 2 gammaMax 1 ! xMin = -r1; ! xMax = r1; ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 2 : // 1 gammaMin 3 gammaMax 1 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 3 : // 3 gammaMin 4 gammaMax 1 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 4 : // 4 gammaMin 1 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 5 : // 5 gammaMin 2 gammaMax 2 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 6 : // 6 gammaMin 3 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = -r1; ! yMax = r1; ! break; ! case 7 : // 7 gammaMin 4 gammaMax 2 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 8 : // 8 gammaMin 1 gammaMax 3 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 9 : // 9 gammaMin 2 gammaMax 3 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 10 : //10 gammaMin 3 gammaMax 3 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; ! case 11 : //11 gammaMin 4 gammaMax 3 ! xMin = -r1; ! xMax = r1; ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = r1; ! break; ! case 12 : //12 gammaMin 1 gammaMax 4 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = r1; ! break; ! case 13 : //13 gammaMin 2 gammaMax 4 ! xMin = -r1; ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! case 14 : //14 gammaMin 3 gammaMax 4 ! xMin = ! getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = -r1; ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! break; ! default : //15 gammaMin 4 gammaMax 4 ! if ( ! gammaMin < gammaMax) { ! xMin = getMin(r1, cosGammaMin, cosGammaMax); ! xMax = getMax(r1, cosGammaMin, cosGammaMax); ! yMin = getMin(r1, sinGammaMin, sinGammaMax); ! yMax = getMax(r1, sinGammaMin, sinGammaMax); ! } else { ! xMin = -r1; xMax = r1; yMin = -r1; yMax = r1; } ! break; } ! values[0] = xMin; ! values[1] = xMax; ! values[2] = yMin; ! values[3] = yMax; ! return values; ! } ! ! private float getMin(float r, float angle1, float angle2) { ! float result = r * angle1; return Math.min(result, r * angle2); } ! ! private float getMax(float r, float angle1, float angle2) { ! float result = r * angle1; return Math.max(result, r * angle2); } public Primitive[] split() { float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float r = ! (float) Math.sqrt( ! (x2 - x1) * (x2 - x1) ! + (y2 - y1) * (y2 - y1) ! + (z2 - z1) * (z2 - z1)); ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1, r2) > r) { result[0] = new Hyperboloid( *************** *** 159,195 **** linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { result[0] = new Hyperboloid( - (x1 + x2) / 2f, - (y1 + y2) / 2f, - (z1 + z2) / 2f, - x2, - y2, - z2, - thetaMin, - thetaMax, - maxTheta, - maxZ1, - maxZ2, - linearInterpolateParameters(0f, 1f, 0f, .5f), - attributes); - result[1] = - new Hyperboloid( x1, y1, --- 390,411 ---- linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { result[0] = new Hyperboloid( x1, y1, *************** *** 203,263 **** maxZ1, maxZ2, ! linearInterpolateParameters(0f, 1f, .5f, 1f), attributes); ! } ! return result; ! } protected void dice_P(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! //float zDelta = (float) (z2 - z1) / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! for (int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! //float z = z1 + zDelta * v; ! float z = v / (vSize - 1); ! float xr = (1 - z) * x1 + z * x2; ! float yr = (1 - z) * y1 + z * y2; ! float zr = (1 - z) * z1 + z * z2; ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! } } } protected void dice_Ng(ShaderVariables shaderVariables) { - int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; //float dZ = (-maxZ1 + maxZ2) * maxTheta; ! float dZ = (-z1 + z2) * maxTheta; ! float dX = -x1 + x2; ! float dY = -y1 + y2; ! for (int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! float z = v / (vSize - 1); ! float vX = (1 - z) * x1 + z * x2; ! float vY = (1 - z) * y1 + z * y2; ! vtmp.x = dZ * (vX * cosTheta + vY * sinTheta); ! vtmp.y = dZ * (vX * sinTheta + vY * cosTheta); ! vtmp.z = ! (dX * sinTheta - dY * cosTheta) ! * (vX * sinTheta + vY * cosTheta) ! + (dX * cosTheta - dY * sinTheta) ! * (vX * cosTheta - vY * sinTheta); ! Ng.set(u, v, vtmp); ! } } } --- 419,497 ---- maxZ1, maxZ2, ! linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); ! result[1] = ! new Hyperboloid( ! (x1 + x2) / 2f, ! (y1 + y2) / 2f, ! (z1 + z2) / 2f, ! x2, ! y2, ! z2, ! thetaMin, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(0f, 1f, .5f, 1f), ! attributes); ! } ! return result; } protected void dice_P(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Point3fGrid P = shaderVariables.P; ! //System.out.println("ThetaMin: " + Math.toDegrees(thetaMin)); ! //System.out.println("ThetaMax: " + Math.toDegrees(thetaMax)); ! //System.out.println("P1: " + x1 + ":" + y1 + ":" + z1); ! //System.out.println("P2: " + x2 + ":" + y2 + ":" + z2); ! for ( ! int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! float nv = (float) v / (vSize - 1); ! float xr = (1f - nv) * x1 + nv * x2; ! float yr = (1f - nv) * y1 + nv * y2; ! float zr = (1f - nv) * z1 + nv * z2; ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! } } } protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; //float dZ = (-maxZ1 + maxZ2) * maxTheta; ! float dZ = ! (-z1 + z2) * -maxTheta; ! float dX = -x1 + x2; ! float dY = -y1 + y2; ! for (int u = 0; u < uSize; u++) { float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! float nv = (float) v / (vSize - 1); ! float vX = (1 - nv) * x1 + nv * x2; ! float vY = (1 - nv) * y1 + nv * y2; ! vtmp.x = dZ * (vX * cosTheta + vY * sinTheta); ! vtmp.y = dZ * (vX * sinTheta + vY * cosTheta); ! vtmp.z = ! maxTheta ! * (dX * sinTheta - dY * cosTheta) ! * (vX * sinTheta + vY * cosTheta) ! - (dX * cosTheta - dY * sinTheta) ! * (vX * cosTheta + vY * sinTheta); ! Ng.set(u, v, vtmp); ! } } } |
From: <edi...@us...> - 2003-07-26 15:07:10
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv16465/src/org/jrman/parser/keywords Modified Files: KeywordHyperboloid.java Log Message: fixing normal vector on Paraboloid class Index: KeywordHyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordHyperboloid.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordHyperboloid.java 28 May 2003 12:33:37 -0000 1.4 --- KeywordHyperboloid.java 25 Jul 2003 13:56:50 -0000 1.5 *************** *** 60,64 **** // Expect parameter list Map parameters = parseParameterList(st); ! //parser.addHyperboloid(x1,y1,z1,x2,y2,z2,thetaMax,parameters); } --- 60,64 ---- // Expect parameter list Map parameters = parseParameterList(st); ! parser.addHyperboloid(x1,y1,z1,x2,y2,z2,thetaMax,parameters); } |
From: <edi...@us...> - 2003-07-26 14:04:30
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv16465/src/org/jrman/primitive Modified Files: Hyperboloid.java Paraboloid.java Log Message: fixing normal vector on Paraboloid class Index: Hyperboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Hyperboloid.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Hyperboloid.java 27 May 2003 18:34:11 -0000 1.3 --- Hyperboloid.java 25 Jul 2003 13:56:50 -0000 1.4 *************** *** 35,222 **** public class Hyperboloid extends Quadric { ! private static Point3f tmp = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); ! private float x1; ! private float y1; ! private float z1; ! private float x2; ! private float y2; ! private float z2; ! private float thetaMin; ! private float thetaMax; ! public Hyperboloid( ! float x1, ! float y1, ! float z1, ! float x2, ! float y2, ! float z2, ! float thetaMin, ! float thetaMax, ! Map parameters, ! Attributes attributes) { ! super(parameters, attributes); ! this.x1 = x1; ! this.y1 = y1; ! this.z1 = z1; ! this.x2 = x2; ! this.y2 = y2; ! this.z2 = z2; ! this.thetaMin = thetaMin; ! this.thetaMax = thetaMax; ! } ! public BoundingVolume getBoundingVolume() { ! float r1 = (float) Math.sqrt((x1 * x1) + (y1 *y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 *y2)); ! ! float cosThetaMin = (float) Math.cos(thetaMin); ! float sinThetaMin = (float) Math.sin(thetaMin); ! float cosThetaMax = (float) Math.cos(thetaMax); ! float sinThetaMax = (float) Math.sin(thetaMax); ! float rMax = Math.max(r1,r2); ! float rMin = Math.min(r1,r2); ! float xMin; ! float xMax = cosThetaMin * rMin; ! xMax = Math.max(xMax, cosThetaMin * rMax); ! xMax = Math.max(xMax, cosThetaMax * rMin); ! xMax = Math.max(xMax, cosThetaMax * rMax); ! float yMin; ! float yMax; ! if (thetaMin < Math.PI && thetaMax > Math.PI) ! xMin = -rMax; ! else { ! xMin = cosThetaMin * rMin; ! xMin = Math.min(xMin, cosThetaMin * rMax); ! xMin = Math.min(xMin, cosThetaMax * rMin); ! xMin = Math.min(xMin, cosThetaMax * rMax); ! } ! if (thetaMin < Math.PI / 2 && thetaMax > Math.PI / 2) ! yMax = rMax; ! else { ! yMax = sinThetaMin * rMin; ! yMax = Math.max(yMax, sinThetaMin * rMax); ! yMax = Math.max(yMax, sinThetaMax * rMin); ! yMax = Math.max(yMax, sinThetaMax * rMax); ! } ! if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) ! yMin = -rMax; ! else { ! yMin = sinThetaMin * rMin; ! yMin = Math.min(yMin, sinThetaMin * rMax); ! yMin = Math.min(yMin, sinThetaMax * rMin); ! yMin = Math.min(yMin, sinThetaMax * rMax); ! } ! ! Bounds3f result = ! new Bounds3f( ! xMin, ! xMax, ! yMin, ! yMax, ! z1, ! z2); ! return result; ! } ! public Primitive[] split() { ! float r1 = (float) Math.sqrt((x1 * x1) + (y1 *y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 *y2)); ! ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1,r2) > z2 -z1) { ! result[0] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! thetaMin, ! (thetaMin + thetaMax) / 2f, ! linearInterpolateParameters(0f, .5f, 0f, 1f), ! attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { ! result[0] = ! new Hyperboloid( ! x1, ! y1, ! (z1 + z2) / 2f, ! x2, ! y2, ! z2, ! thetaMin, ! thetaMax, ! linearInterpolateParameters(0f, 1f, 0f, .5f), ! attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! (z1 + z2) / 2f, ! thetaMin, ! thetaMax, ! linearInterpolateParameters(0f, 1f, .5f, 1f), ! attributes); ! } ! return result; ! } ! protected void dice_P(ShaderVariables shaderVariables) { ! int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! float zDelta = (float) (z2 - z1) / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! float theta = thetaMin; ! for (int u = 0; u < uSize; u++) { ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! float z = z1; ! for (int v = 0; v < vSize; v++) { ! float xr = ((1 -z) * x1 + z * x2 ); ! float yr = ((1 -z) * y1 + z * y2 ); ! float zr = ((1 -z) * z1 + z * z2 ); ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! z += zDelta; ! } ! theta += thetaDelta; ! } ! } ! protected void dice_Ng(ShaderVariables shaderVariables) { ! shaderVariables.Ng.set(shaderVariables.P); ! } } --- 35,265 ---- public class Hyperboloid extends Quadric { ! private static Point3f tmp = new Point3f(); ! private static Vector3f vtmp = new Vector3f(); ! private float x1; ! private float y1; ! private float z1; ! private float x2; ! private float y2; ! private float z2; ! private float thetaMin; ! private float thetaMax; ! private float maxTheta; ! private float maxZ1; ! private float maxZ2; ! public Hyperboloid( ! float x1, ! float y1, ! float z1, ! float x2, ! float y2, ! float z2, ! float thetaMin, ! float thetaMax, ! float maxTheta, ! float maxZ1, ! float maxZ2, ! Map parameters, ! Attributes attributes) { ! super(parameters, attributes); ! this.x1 = x1; ! this.y1 = y1; ! this.z1 = z1; ! this.x2 = x2; ! this.y2 = y2; ! this.z2 = z2; ! this.thetaMin = thetaMin; ! this.thetaMax = thetaMax; ! this.maxTheta = maxTheta; ! this.maxZ1 = maxZ1; ! this.maxZ2 = maxZ2; ! } ! public BoundingVolume getBoundingVolume() { ! float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float cosThetaMin = (float) Math.cos(thetaMin); ! float sinThetaMin = (float) Math.sin(thetaMin); ! float cosThetaMax = (float) Math.cos(thetaMax); ! float sinThetaMax = (float) Math.sin(thetaMax); ! float rMax = Math.max(r1, r2); ! float rMin = Math.min(r1, r2); ! float xMin; ! float xMax = cosThetaMin * rMin; ! xMax = Math.max(xMax, cosThetaMin * rMax); ! xMax = Math.max(xMax, cosThetaMax * rMin); ! xMax = Math.max(xMax, cosThetaMax * rMax); ! float yMin; ! float yMax; ! if (thetaMin < Math.PI && thetaMax > Math.PI) ! xMin = -rMax; ! else { ! xMin = cosThetaMin * rMin; ! xMin = Math.min(xMin, cosThetaMin * rMax); ! xMin = Math.min(xMin, cosThetaMax * rMin); ! xMin = Math.min(xMin, cosThetaMax * rMax); ! } ! if (thetaMin < Math.PI / 2 && thetaMax > Math.PI / 2) ! yMax = rMax; ! else { ! yMax = sinThetaMin * rMin; ! yMax = Math.max(yMax, sinThetaMin * rMax); ! yMax = Math.max(yMax, sinThetaMax * rMin); ! yMax = Math.max(yMax, sinThetaMax * rMax); ! } ! if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) ! yMin = -rMax; ! else { ! yMin = sinThetaMin * rMin; ! yMin = Math.min(yMin, sinThetaMin * rMax); ! yMin = Math.min(yMin, sinThetaMax * rMin); ! yMin = Math.min(yMin, sinThetaMax * rMax); ! } ! ! Bounds3f result = new Bounds3f(xMin, xMax, yMin, yMax, z1, z2); ! return result; ! } ! ! public Primitive[] split() { ! ! float r1 = (float) Math.sqrt((x1 * x1) + (y1 * y1)); ! float r2 = (float) Math.sqrt((x2 * x2) + (y2 * y2)); ! float r = (float)Math.sqrt((x2 -x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) + (z2 - z1) * (z2 - z1)); ! ! Primitive[] result = new Primitive[2]; ! if ((thetaMax - thetaMin) * (float) Math.max(r1, r2) > r) { ! result[0] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! thetaMin, ! (thetaMin + thetaMax) / 2f, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(0f, .5f, 0f, 1f), ! attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! x2, ! y2, ! z2, ! (thetaMin + thetaMax) / 2f, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(.5f, 1f, 0f, 1f), ! attributes); ! } else { ! result[0] = ! new Hyperboloid( ! (x1 + x2) / 2f, ! (y1 + y2) / 2f, ! (z1 + z2) / 2f, ! x2, ! y2, ! z2, ! thetaMin, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(0f, 1f, 0f, .5f), ! attributes); ! result[1] = ! new Hyperboloid( ! x1, ! y1, ! z1, ! (x1 + x2) / 2f, ! (y1 + y2) / 2f, ! (z1 + z2) / 2f, ! thetaMin, ! thetaMax, ! maxTheta, ! maxZ1, ! maxZ2, ! linearInterpolateParameters(0f, 1f, .5f, 1f), ! attributes); ! } ! return result; ! } ! ! protected void dice_P(ShaderVariables shaderVariables) { ! int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! //float zDelta = (float) (z2 - z1) / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! for (int u = 0; u < uSize; u++) { ! float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! //float z = z1 + zDelta * v; ! float z = v / (vSize - 1); ! float xr = (1 - z) * x1 + z * x2; ! float yr = (1 - z) * y1 + z * y2; ! float zr = (1 - z) * z1 + z * z2; ! tmp.x = xr * cosTheta - yr * sinTheta; ! tmp.y = xr * sinTheta + yr * cosTheta; ! tmp.z = zr; ! P.set(u, v, tmp); ! } ! } ! } ! ! protected void dice_Ng(ShaderVariables shaderVariables) { ! ! int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; ! //float dZ = (-maxZ1 + maxZ2) * maxTheta; ! float dZ = (-z1 + z2) * maxTheta; ! float dX = -x1 + x2; ! float dY = -y1 + y2; ! for (int u = 0; u < uSize; u++) { ! float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! for (int v = 0; v < vSize; v++) { ! float z = v / (vSize - 1); ! float vX = (1 - z) * x1 + z * x2; ! float vY = (1 - z) * y1 + z * y2; ! vtmp.x = dZ * (vX * cosTheta + vY * sinTheta); ! vtmp.y = dZ * (vX * sinTheta + vY * cosTheta); ! vtmp.z = ! (dX * sinTheta - dY * cosTheta) ! * (vX * sinTheta + vY * cosTheta) ! + (dX * cosTheta - dY * sinTheta) ! * (vX * cosTheta - vY * sinTheta); ! Ng.set(u, v, vtmp); ! } ! } ! } } Index: Paraboloid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Paraboloid.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Paraboloid.java 28 May 2003 12:33:38 -0000 1.5 --- Paraboloid.java 25 Jul 2003 13:56:50 -0000 1.6 *************** *** 49,54 **** --- 49,58 ---- private float thetaMax; + private float minZ; + private float maxZ; + private float maxTheta; + public Paraboloid( float radius, *************** *** 57,61 **** --- 61,67 ---- float thetaMin, float thetaMax, + float minZ, float maxZ, + float maxTheta, Map parameters, Attributes attributes) { *************** *** 66,70 **** --- 72,78 ---- this.thetaMin = thetaMin; this.thetaMax = thetaMax; + this.minZ = minZ; this.maxZ = maxZ; + this.maxTheta = maxTheta; } *************** *** 125,129 **** --- 133,139 ---- thetaMin, (thetaMin + thetaMax) / 2f, + minZ, maxZ, + maxTheta, linearInterpolateParameters(0f, .5f, 0f, 1f), attributes); *************** *** 135,139 **** --- 145,151 ---- (thetaMin + thetaMax) / 2f, thetaMax, + minZ, maxZ, + maxTheta, linearInterpolateParameters(.5f, 1f, 0f, 1f), attributes); *************** *** 146,150 **** --- 158,164 ---- thetaMin, thetaMax, + minZ, maxZ, + maxTheta, linearInterpolateParameters(0f, 1f, 0f, .5f), attributes); *************** *** 156,160 **** --- 170,176 ---- thetaMin, thetaMax, + minZ, maxZ, + maxTheta, linearInterpolateParameters(0f, 1f, .5f, 1f), attributes); *************** *** 169,178 **** float zDelta = (zMax - zMin) / (vSize - 1); Point3fGrid P = shaderVariables.P; - float theta = thetaMin; for (int u = 0; u < uSize; u++) { float cosTheta = (float) Math.cos(theta); float sinTheta = (float) Math.sin(theta); - float z = zMin; for (int v = 0; v < vSize; v++) { float r = radius * (float) Math.sqrt(z / maxZ); tmp.x = r * cosTheta; --- 185,194 ---- float zDelta = (zMax - zMin) / (vSize - 1); Point3fGrid P = shaderVariables.P; for (int u = 0; u < uSize; u++) { + float theta = thetaMin + thetaDelta * u; float cosTheta = (float) Math.cos(theta); float sinTheta = (float) Math.sin(theta); for (int v = 0; v < vSize; v++) { + float z = zMin + zDelta * v; float r = radius * (float) Math.sqrt(z / maxZ); tmp.x = r * cosTheta; *************** *** 180,186 **** tmp.z = z; P.set(u, v, tmp); - z += zDelta; } - theta += thetaDelta; } } --- 196,200 ---- *************** *** 191,214 **** float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); float zDelta = (zMax - zMin) / (vSize - 1); ! float a = (float) radius / (maxZ * maxZ); Vector3fGrid Ng = shaderVariables.Ng; - float theta = thetaMin; for (int u = 0; u < uSize; u++) { ! float z = zMin; for (int v = 0; v < vSize; v++) { ! float ang = (float) Math.atan(- 1/(2 * a * z)); ! float cosAng = (float) Math.cos(ang); ! float sinAng = (float) Math.sin(ang); ! float cosThetaCosAng = (float) Math.cos(theta) * cosAng; ! float sinThetaCosAng = (float) Math.sin(theta) * cosAng; ! vtmp.x = cosThetaCosAng; ! vtmp.y = sinThetaCosAng; ! vtmp.z = sinAng; Ng.set(u, v, vtmp); - z += zDelta; } - theta += thetaDelta; } } ! ! } --- 205,230 ---- float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); float zDelta = (zMax - zMin) / (vSize - 1); ! float dZ = (maxZ - minZ) * thetaMax; Vector3fGrid Ng = shaderVariables.Ng; for (int u = 0; u < uSize; u++) { ! float theta = thetaMin + thetaDelta * u; ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); for (int v = 0; v < vSize; v++) { ! float zv = zMin + zDelta * v; ! float r = radius * (float) Math.sqrt(zv / maxZ); ! vtmp.x = r * cosTheta * dZ; ! vtmp.y = r * sinTheta * dZ; ! vtmp.z = ! -0.5f ! * radius ! * radius ! * dZ ! / maxZ ! * (sinTheta * sinTheta + cosTheta * cosTheta); Ng.set(u, v, vtmp); } } } ! ! } |
From: <edi...@us...> - 2003-07-26 12:46:13
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv16465/src/org/jrman/parser Modified Files: Parser.java Log Message: fixing normal vector on Paraboloid class Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Parser.java 10 Jul 2003 14:48:26 -0000 1.55 --- Parser.java 25 Jul 2003 13:56:50 -0000 1.56 *************** *** 1026,1030 **** --- 1026,1032 ---- thetaMin, thetaMax, + zmin, zmax, + thetaMax, parameters, getAttributes())); *************** *** 1040,1044 **** --- 1042,1048 ---- thetaMin, thetaMax, + zmin, zmax, + thetaMax, parameters, createAttributes(transform, attributes)); *************** *** 1073,1076 **** --- 1077,1083 ---- thetaMin, thetaMax, + thetaMax, + z1, + z2, parameters, getAttributes())); *************** *** 1087,1092 **** y2, z2, - thetaMax, thetaMin, parameters, createAttributes(transform, attributes)); --- 1094,1102 ---- y2, z2, thetaMin, + thetaMax, + thetaMax, + z1, + z2, parameters, createAttributes(transform, attributes)); |
From: <edi...@us...> - 2003-07-26 01:41:07
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv16465/sampleData Modified Files: hyperboloid.rib paraboloid.rib Log Message: fixing normal vector on Paraboloid class Index: hyperboloid.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/hyperboloid.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hyperboloid.rib 27 May 2003 18:34:11 -0000 1.1 --- hyperboloid.rib 25 Jul 2003 13:56:50 -0000 1.2 *************** *** 1,31 **** ! Format 480 360 1 ! PixelSamples 4 4 Exposure 1 2.5 ! Projection "perspective" "fov" 20 ! Surface "fakedlight" Translate 0 0 40 WorldBegin ! ShadingRate 1 AttributeBegin ! Translate -4 0 0 ! Rotate 45 1 1 1 Color 1 0 0 ! Hyperboloid 0 0 0 1 0 0 360 "Cs" [1 1 0 1 1 0 0 1 1 0 1 1] AttributeEnd AttributeBegin Translate -2 0 0 ! Rotate -45 1 1 1 Color 0 1 0 ! Hyperboloid 1 1 1 1 0 2 360 "Cs" [1 0 1 1 0 1 0 0 1 0 0 1] AttributeEnd AttributeBegin ! Translate 0 0 0 ! Color .8 .8 1 ! Hyperboloid 2 2 2 3 3 3 360 "Cs" [0 1 1 0 1 1 0 0 1 0 0 1] AttributeEnd AttributeBegin ! Translate 2 0 0 ! Color 1 1 1 ! Hyperboloid 0 0 0 1 1 1 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] AttributeEnd WorldEnd --- 1,83 ---- ! Option "statistics" "endofframe" 1 ! Format 400 300 1 ! Display "hyperboloid" "framebuffer" "rgba" ! PixelSamples 2 2 Exposure 1 2.5 ! Projection "perspective" "fov" 30 Translate 0 0 40 + WorldBegin ! #ShadingRate 0.25 ! #LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] ! #LightSource "ambientlight" 2 "intensity" 0.1 ! #Surface "plastic" ! #Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] AttributeBegin ! Translate -6 4 0 ! #Rotate 45 1 1 1 ! Rotate 90 1 0 0 Color 1 0 0 ! #Hyperboloid 0 0 0 1 1 1 360 "Cs" [1 1 0 1 1 0 0 1 1 0 1 1] ! Hyperboloid -1 -1 -1 2 2 2 360 AttributeEnd AttributeBegin Translate -2 0 0 ! #Rotate -45 1 1 1 ! Rotate 90 1 0 0 Color 0 1 0 ! #Hyperboloid 1 1 1 1 0 2 360 "Cs" [1 0 1 1 0 1 0 0 1 0 0 1] ! Hyperboloid -3 -3 -3 4 4 4 360 AttributeEnd AttributeBegin ! Translate 0 -3 0 ! Color 0 0 1 ! Rotate 90 1 0 0 ! #Hyperboloid 2 2 2 3 3 3 360 "Cs" [0 1 1 0 1 1 0 0 1 0 0 1] ! Hyperboloid 1 1 1 3 3 3 360 AttributeEnd AttributeBegin ! Translate 2 2 2 ! Color 0.3 0.3 0.3 ! Rotate 90 1 0 0 ! #Hyperboloid 0 0 0 1 1 1 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] ! Hyperboloid 0 0 0 1 1 1 360 ! AttributeEnd ! ! AttributeBegin ! Translate 6 6 4 ! Rotate -45 1 0 0 ! Rotate -45 0 1 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate 1 0 6 ! Rotate 90 1 0 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 ! AttributeEnd ! AttributeBegin ! Translate 5 0 6 ! Rotate 90 0 1 0 ! Color 1 1 1 ! Paraboloid 3 0 4 360 AttributeEnd + AttributeBegin + Translate -10 1 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 4 0 0 + Rotate 45 1 1 1 + Color 1 1 1 + Paraboloid 2 0 3 360 "Cs" [1 0 0 1 0 0 0 0 1 0 0 1] + AttributeEnd + AttributeBegin + Translate 4 4 0 + Rotate 90 1 1 1 + Color 1 1 1 + Paraboloid 1 .5 1 270 + AttributeEnd + WorldEnd Index: paraboloid.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/paraboloid.rib,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** paraboloid.rib 12 Jun 2003 18:36:02 -0000 1.4 --- paraboloid.rib 25 Jul 2003 13:56:50 -0000 1.5 *************** *** 1,10 **** Option "statistics" "endofframe" 1 ! Format 480 360 1 ! Display "paraboloid" "framebuffer" "rgb" PixelSamples 4 4 Exposure 1 2.5 ! Projection "perspective" "fov" 20 Translate 0 0 40 WorldBegin AttributeBegin Translate 4 0 0 --- 1,91 ---- + #MakeTexture "earth.4096x2048.jpg" "earth.txr" "periodic" "periodic" "gaussian" 2 2 Option "statistics" "endofframe" 1 ! Format 600 480 1 ! Display "paraboloid" "framebuffer" "rgba" PixelSamples 4 4 Exposure 1 2.5 ! Projection "perspective" "fov" 40 Translate 0 0 40 WorldBegin + ShadingRate 0.25 + LightSource "distantlight" 1 "intensity" .5 "from" [-1 1 -1] "to" [0 0 0] + LightSource "ambientlight" 2 "intensity" 0.1 + Surface "paintedplastic" "texturename" "earth.txr" + Color 1 1 1 + Patch "bilinear" "P" [-80 40 80 80 40 80 -80 -40 80 80 -40 80] + AttributeBegin + Translate 1 1 -1 + Scale 1 2 1 + Sphere 0.2 -0.2 0.2 360 + AttributeEnd + AttributeBegin + Translate 6 6 4 + Rotate -45 1 0 0 + Rotate -45 0 1 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 1 0 6 + Rotate 90 1 0 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 5 0 6 + Rotate 90 0 1 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate -10 1 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 10 1 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 0 -10 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate -11 9 0 + Sphere 3 -1 1 360 + AttributeEnd + AttributeBegin + Translate -10 7 0 + Rotate 45 1 0 0 + Rotate 45 0 1 0 + Color 1 1 0 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 8 8 0 + Rotate -45 1 0 0 + Rotate -45 0 1 0 + Color 1 1 0 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate -10 1 0 + Color 1 1 0 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 1 0 0 + Rotate 90 1 0 0 + Color 1 1 1 + Paraboloid 3 0 4 360 + AttributeEnd + AttributeBegin + Translate 3 -6 0 + Rotate 90 0 1 0 + Color 0 1 1 + Paraboloid 3 0 4 360 + AttributeEnd AttributeBegin Translate 4 0 0 *************** *** 17,21 **** Rotate 90 1 1 1 Color 0 1 0 ! Paraboloid .5 .5 1 270 AttributeEnd AttributeBegin --- 98,102 ---- Rotate 90 1 1 1 Color 0 1 0 ! Paraboloid 1 .5 1 270 AttributeEnd AttributeBegin *************** *** 44,47 **** --- 125,132 ---- Color 0 0 1 Paraboloid 1 0 1 360 + AttributeEnd + AttributeBegin + Translate -8 -8 0 + Sphere 3 -3 3 360 AttributeEnd WorldEnd |