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-05-15 03:56:37
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv4763/src/org/jrman/render Modified Files: ShaderVariables.java Log Message: Implemented Illuminate. Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ShaderVariables.java 15 May 2003 03:15:31 -0000 1.6 --- ShaderVariables.java 15 May 2003 03:56:32 -0000 1.7 *************** *** 28,32 **** import org.jrman.attributes.Attributes; import org.jrman.geom.Transform; - import org.jrman.grid.BooleanGrid; import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; --- 28,31 ---- *************** *** 76,81 **** public Point3f E = new Point3f(); - - public BooleanGrid lightCond = new BooleanGrid(); public Attributes attributes; --- 75,78 ---- |
From: <ma...@us...> - 2003-05-15 03:16:09
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src/org/jrman/parser Modified Files: Parser.java Log Message: Did some work on shaders. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Parser.java 11 May 2003 02:53:43 -0000 1.37 --- Parser.java 15 May 2003 03:15:32 -0000 1.38 *************** *** 42,45 **** --- 42,46 ---- import org.jrman.attributes.Orientation; import org.jrman.attributes.ShadingInterpolation; + import org.jrman.attributes.Space; import org.jrman.attributes.TrimCurveSense; import org.jrman.geom.AffineTransform; *************** *** 398,401 **** --- 399,403 ---- setIdentity(); worldStack.push(new World(world)); + currentAttributes.setSpace(Space.WORLD); renderer = Renderer.createRenderer(frame, world); } *************** *** 406,409 **** --- 408,412 ---- world = (World) worldStack.pop(); popState(); + currentAttributes.setSpace(Space.CAMERA); } *************** *** 613,625 **** public void setSurface(String name, Map parameters) { ! currentAttributes.setSurface(SurfaceShader.createShader(name, parameters)); } public void setAtmosphere(String name, Map parameters) { ! currentAttributes.setAtmosphere(VolumeShader.createShader(name, parameters)); } public void setExterior(String name, Map parameters) { ! currentAttributes.setExterior(VolumeShader.createShader(name, parameters)); } --- 616,631 ---- public void setSurface(String name, Map parameters) { ! currentAttributes.setSurface( ! SurfaceShader.createShader(name, parameters, currentAttributes.getTransform())); } public void setAtmosphere(String name, Map parameters) { ! currentAttributes.setAtmosphere( ! VolumeShader.createShader(name, parameters, currentAttributes.getTransform())); } public void setExterior(String name, Map parameters) { ! currentAttributes.setExterior( ! VolumeShader.createShader(name, parameters, currentAttributes.getTransform())); } *************** *** 629,637 **** public void setInterior(String name, Map parameters) { ! currentAttributes.setInterior(VolumeShader.createShader(name, parameters)); } public void createLightSource(String name, int sequenceNumber, Map parameters) { ! LightShader light = LightShader.createShader(name, parameters); world.addLight(sequenceNumber, light); turnOnLight(light); --- 635,645 ---- public void setInterior(String name, Map parameters) { ! currentAttributes.setInterior( ! VolumeShader.createShader(name, parameters, currentAttributes.getTransform())); } public void createLightSource(String name, int sequenceNumber, Map parameters) { ! LightShader light = ! LightShader.createShader(name, parameters, currentAttributes.getTransform()); world.addLight(sequenceNumber, light); turnOnLight(light); |
From: <ma...@us...> - 2003-05-15 03:16:05
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src/org/jrman/render Modified Files: ShaderVariables.java SamplePoint.java Log Message: Did some work on shaders. Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ShaderVariables.java 11 May 2003 02:53:43 -0000 1.5 --- ShaderVariables.java 15 May 2003 03:15:31 -0000 1.6 *************** *** 26,30 **** --- 26,32 ---- import javax.vecmath.Point3f; + import org.jrman.attributes.Attributes; import org.jrman.geom.Transform; + import org.jrman.grid.BooleanGrid; import org.jrman.grid.Color3fGrid; import org.jrman.grid.FloatGrid; *************** *** 74,77 **** --- 76,85 ---- public Point3f E = new Point3f(); + + public BooleanGrid lightCond = new BooleanGrid(); + + public Attributes attributes; + + public Map parameters; private Map map = new HashMap(); Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SamplePoint.java 12 May 2003 16:46:16 -0000 1.10 --- SamplePoint.java 15 May 2003 03:15:31 -0000 1.11 *************** *** 1,4 **** /* ! SamplePoints.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! SamplePoint.java Copyright (C) 2003 Gerardo Horvilleur Martinez |
From: <ma...@us...> - 2003-05-15 03:16:04
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src/org/jrman/primitive Modified Files: Primitive.java Quadric.java Log Message: Did some work on shaders. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Primitive.java 12 May 2003 16:46:17 -0000 1.11 --- Primitive.java 15 May 2003 03:15:31 -0000 1.12 *************** *** 50,54 **** public abstract Primitive[] split(); ! public abstract void dice(ShaderVariables shaderVariables); public abstract boolean isReadyToBeDiced(int gridSize); --- 50,57 ---- public abstract Primitive[] split(); ! public void dice(ShaderVariables shaderVariables) { ! shaderVariables.attributes = attributes; ! shaderVariables.parameters = parameters; ! } public abstract boolean isReadyToBeDiced(int gridSize); Index: Quadric.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Quadric.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Quadric.java 10 May 2003 03:57:29 -0000 1.10 --- Quadric.java 15 May 2003 03:15:31 -0000 1.11 *************** *** 54,57 **** --- 54,58 ---- public void dice(ShaderVariables shaderVariables) { + super.dice(shaderVariables); dice_P(shaderVariables); dice_Ng(shaderVariables); |
From: <ma...@us...> - 2003-05-15 03:16:04
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src/org/jrman/shaders Modified Files: ConstantShader.java SurfaceShader.java DisplacementShader.java LightShader.java FakedLightShader.java VolumeShader.java Added Files: Shader.java RandomColorsShader.java Log Message: Did some work on shaders. --- NEW FILE: Shader.java --- /* Shader.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 java.util.HashMap; import java.util.Map; import org.jrman.geom.Transform; import org.jrman.render.ShaderVariables; public class Shader { protected String name; protected Map parameters; protected Transform transform; protected Map defaultParameters = new HashMap(); protected void init(String name, Map parameters, Transform transform) { this.name = name; this.parameters = parameters; this.transform = transform; } protected Object getParameter(ShaderVariables sv, String name) { Object result = sv.parameters.get(name); if (result != null) return result; result = parameters.get(name); if (result != null) return result; return defaultParameters.get(name); } public String getName() { return name; } public Map getParameters() { return parameters; } public Transform getTransform() { return transform; } } --- NEW FILE: RandomColorsShader.java --- /* RandomColorsShader.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.Vector3f; import org.jrman.grid.FloatGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.render.ShaderVariables; public class RandomColorsShader extends SurfaceShader { private static Vector3fGrid tmpN = new Vector3fGrid(); private static FloatGrid light = new FloatGrid(); private Vector3f lightDirection = new Vector3f(1f, 1f, -1f); public void shade(ShaderVariables sv) { super.shade(sv); tmpN.faceforward(sv.N, sv.I); tmpN.normalize(tmpN); light.dot(tmpN, lightDirection); light.max(light, 0f); light.mul(light, .7f); light.add(light, .2f); light.clamp(light, 0f, 1f); sv.Oi.set(sv.Os); sv.Ci.random(); sv.Ci.mul(sv.Os, sv.Ci); tmpN.setxcomp(light); tmpN.setycomp(light); tmpN.setzcomp(light); sv.Ci.mul(sv.Ci, tmpN); } } Index: ConstantShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/ConstantShader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ConstantShader.java 2 May 2003 05:02:07 -0000 1.2 --- ConstantShader.java 15 May 2003 03:15:30 -0000 1.3 *************** *** 20,34 **** package org.jrman.shaders; ! import java.util.Map; ! ! import org.jrman.render.*; public class ConstantShader extends SurfaceShader { - public ConstantShader(String name, Map parameters) { - super(name, parameters); - } - public void shade(ShaderVariables sv) { sv.Oi.set(sv.Os); sv.Ci.mul(sv.Os, sv.Cs); --- 20,29 ---- package org.jrman.shaders; ! import org.jrman.render.ShaderVariables; public class ConstantShader extends SurfaceShader { public void shade(ShaderVariables sv) { + super.shade(sv); sv.Oi.set(sv.Os); sv.Ci.mul(sv.Os, sv.Cs); Index: SurfaceShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/SurfaceShader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SurfaceShader.java 3 May 2003 18:02:49 -0000 1.5 --- SurfaceShader.java 15 May 2003 03:15:31 -0000 1.6 *************** *** 20,45 **** package org.jrman.shaders; import java.util.Map; ! import org.jrman.render.*; ! public abstract class SurfaceShader { ! protected Map parameters; ! protected String name; ! public static SurfaceShader createShader(String name, Map parameters) { if (name.equals("constant")) ! return new ConstantShader(name, parameters); // Just for now... ! return new FakedLightShader(name, parameters); } ! ! protected SurfaceShader(String name, Map parameters) { ! this.name = name; ! this.parameters = parameters; } ! public abstract void shade(ShaderVariables shaderVariables); } --- 20,140 ---- package org.jrman.shaders; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collection; + import java.util.Iterator; + import java.util.List; import java.util.Map; + import java.util.Set; + import java.util.TreeSet; + import java.util.regex.Pattern; ! import javax.vecmath.Color3f; ! import org.jrman.geom.Transform; ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.render.ShaderVariables; ! ! public abstract class SurfaceShader extends Shader{ ! ! private final static Color3f BLACK = new Color3f(); ! private final static Color3f WHITE = new Color3f(1f, 1f, 1f); ! ! private final static Color3f OPAQUE = WHITE; ! private static Pattern SEPARATOR = Pattern.compile(", *"); ! protected abstract class Statement { ! public abstract void execute(ShaderVariables sv); ! } ! ! public static SurfaceShader createShader(String name, Map parameters, Transform transform) { ! SurfaceShader result; if (name.equals("constant")) ! result = new ConstantShader(); // Just for now... ! else if (name.equals("randomColors")) ! result = new RandomColorsShader(); ! else ! result = new FakedLightShader(); ! result.init(name, parameters, transform); ! return result; } ! ! protected void ambient(ShaderVariables sv, Color3fGrid out) { ! out.set(BLACK); ! Set lights = sv.attributes.getLightSources(); ! for (Iterator iter = lights.iterator(); iter.hasNext();) { ! LightShader ls = (LightShader) iter.next(); ! if (ls.isAmbient()) { ! ls.shade(sv, null, null, 0); ! out.add(out, sv.Cl); ! } ! } } ! protected void doIlluminance( ! ShaderVariables sv, ! Collection lights, ! Point3fGrid P, ! Vector3fGrid N, ! float angle, ! Statement statement) { ! for (Iterator iter = lights.iterator(); iter.hasNext();) { ! LightShader ls = (LightShader) iter.next(); ! sv.Cl.set(BLACK); ! ls.shade(sv, P, N, angle); ! statement.execute(sv); ! } ! } ! ! protected void illuminance( ! ShaderVariables sv, ! String categoryList, ! Point3fGrid P, ! Vector3fGrid N, ! float angle, ! Statement statement) { ! Collection selectedLights; ! if (categoryList == null) ! selectedLights = sv.attributes.getLightSources(); ! else ! selectedLights = getLightsByCategory(sv, categoryList); ! doIlluminance(sv, selectedLights, P, N, angle, statement); ! } ! ! protected Collection getLightsByCategory(ShaderVariables sv, String categoryList) { ! boolean inverse = false; ! if (categoryList.startsWith("-")) { ! categoryList = categoryList.substring(1); ! inverse = true; ! } ! Set categories = new TreeSet(); ! categories.addAll(Arrays.asList(SEPARATOR.split(categoryList))); ! List result = new ArrayList(); ! Set lights = sv.attributes.getLightSources(); ! for (Iterator iter = lights.iterator(); iter.hasNext();) { ! LightShader ls = (LightShader) iter.next(); ! if (ls.isAmbient()) ! continue; ! Map param = ls.getParameters(); ! String __category = (String) param.get("__category"); ! if (inverse) { ! if (__category == null || !categories.contains(__category)) ! result.add(ls); ! } else { ! if (__category != null && categories.contains(__category)) ! result.add(ls); ! } ! } ! return result; ! } ! ! public void shade(ShaderVariables sv) { ! sv.Ci.set(WHITE); ! sv.Oi.set(OPAQUE); ! } } Index: DisplacementShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/DisplacementShader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DisplacementShader.java 12 Apr 2003 06:10:31 -0000 1.2 --- DisplacementShader.java 15 May 2003 03:15:31 -0000 1.3 *************** *** 22,38 **** import java.util.Map; ! public class DisplacementShader { ! ! protected String name; ! ! protected Map parameters; ! ! public static DisplacementShader createShader(String name, Map parameters) { ! return new DisplacementShader(name, parameters); // Just for now... ! } ! protected DisplacementShader(String name, Map parameters) { ! this.name = name; ! this.parameters = parameters; } --- 22,35 ---- import java.util.Map; ! import org.jrman.geom.Transform; ! ! ! public class DisplacementShader extends Shader { ! public static DisplacementShader createShader( ! String name, ! Map parameters, ! Transform transform) { ! return null; // Just for now.... } Index: LightShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/LightShader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LightShader.java 12 Apr 2003 06:10:31 -0000 1.1 --- LightShader.java 15 May 2003 03:15:31 -0000 1.2 *************** *** 22,38 **** import java.util.Map; ! public class LightShader { ! ! protected String name; ! ! protected Map parameters; ! public static LightShader createShader(String name, Map parameters) { ! return new LightShader(name, parameters); // Just for now... } ! ! protected LightShader(String name, Map parameters) { ! this.name = name; ! this.parameters = parameters; } --- 22,76 ---- import java.util.Map; ! import javax.vecmath.Color3f; ! import javax.vecmath.Vector3f; ! ! import org.jrman.geom.Transform; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.render.ShaderVariables; ! ! public abstract class LightShader extends Shader { ! private final static Color3f BLACK = new Color3f(); ! ! protected static FloatGrid fg = new FloatGrid(); ! ! protected abstract class Statement { ! public abstract void execute(ShaderVariables sv); } ! ! public static LightShader createShader(String name, Map parameters, Transform transform) { ! return null; // Just for now... ! } ! ! protected boolean solar( ! ShaderVariables sv, ! Point3fGrid P, ! Vector3fGrid N, ! float surfaceAngle, ! Vector3f D, ! float lightAngle, Statement statement) { ! if (P != null) ! sv.Ps.set(P); ! else ! sv.Ps.set(sv.P); ! if (N != null && D != null) { ! fg.dot(N, D); ! sv.lightCond.lessOrEqual(fg, (float) Math.cos(surfaceAngle + lightAngle)); ! if (sv.lightCond.allFalse()) ! return false; ! } else ! sv.lightCond.set(true); ! statement.execute(sv); ! if (N != null) ! sv.L.set(N); ! return true; ! } ! ! public abstract boolean isAmbient(); ! ! public void shade(ShaderVariables sv, Point3fGrid P, Vector3fGrid N, float angle) { ! sv.Cl.set(BLACK); } Index: FakedLightShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/FakedLightShader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FakedLightShader.java 4 May 2003 02:34:36 -0000 1.2 --- FakedLightShader.java 15 May 2003 03:15:31 -0000 1.3 *************** *** 20,25 **** package org.jrman.shaders; - import java.util.Map; - import javax.vecmath.Vector3f; --- 20,23 ---- *************** *** 30,48 **** public class FakedLightShader extends SurfaceShader { ! private Vector3fGrid tmpN; ! private FloatGrid light; private Vector3f lightDirection = new Vector3f(1f, 1f, -1f); - public FakedLightShader(String name, Map parameters) { - super(name, parameters); - } - public void shade(ShaderVariables sv) { ! if (tmpN == null) ! tmpN = new Vector3fGrid(); ! if (light == null) ! light = new FloatGrid(); tmpN.faceforward(sv.N, sv.I); tmpN.normalize(tmpN); --- 28,39 ---- public class FakedLightShader extends SurfaceShader { ! private static Vector3fGrid tmpN = new Vector3fGrid(); ! private static FloatGrid light = new FloatGrid(); private Vector3f lightDirection = new Vector3f(1f, 1f, -1f); public void shade(ShaderVariables sv) { ! super.shade(sv); tmpN.faceforward(sv.N, sv.I); tmpN.normalize(tmpN); Index: VolumeShader.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/VolumeShader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VolumeShader.java 12 Apr 2003 06:10:31 -0000 1.2 --- VolumeShader.java 15 May 2003 03:15:31 -0000 1.3 *************** *** 22,38 **** import java.util.Map; ! public class VolumeShader { ! ! protected String name; ! ! protected Map parameters; ! ! public static VolumeShader createShader(String name, Map parameters) { ! return new VolumeShader(name, parameters); // Just for now.... ! } ! ! protected VolumeShader(String name, Map parameters) { ! this.name = name; ! this.parameters = parameters; } --- 22,34 ---- import java.util.Map; ! import org.jrman.geom.Transform; ! ! public class VolumeShader extends Shader { ! ! public static VolumeShader createShader( ! String name, ! Map parameters, ! Transform transform) { ! return null; // Just for now.... } |
From: <ma...@us...> - 2003-05-15 03:16:03
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv13495/sampleData Modified Files: torus.rib ManySpheres3.rib Added Files: capsules.rib capsule.rib Log Message: Did some work on shaders. --- NEW FILE: capsules.rib --- Format 1000 750 1 PixelSamples 4 4 Exposure 1 2.5 Clipping 1 1000 Projection "perspective" "fov" 40 Surface "fakedlight" Translate 0 0 75 Rotate -33 1 0 0 Rotate 23 0 1 0 WorldBegin ShadingRate 1 ReadArchive "capsulesData.rib" WorldEnd --- NEW FILE: capsule.rib --- AttributeBegin Surface "fakedlight" Opacity 1 1 1 Color .2 .2 1 Cylinder .5 -1 0 360 TransformBegin Translate 0 0 -1 Sphere .5 -.5 0 360 TransformEnd Opacity .2 .5 .2 Color 1 1 1 Cylinder .5 0 1 360 TransformBegin Translate 0 0 1 Sphere .5 0 .5 360 TransformEnd Surface "randomColors" Opacity 1 1 1 Cylinder .49 0 1 360 Translate 0 0 1 Sphere .49 0 .49 360 AttributeEnd Index: torus.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/torus.rib,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** torus.rib 11 May 2003 02:53:43 -0000 1.5 --- torus.rib 15 May 2003 03:15:27 -0000 1.6 *************** *** 25,27 **** --- 25,32 ---- Torus 4 1 0 360 360 AttributeEnd + TransformBegin + Translate -6 0 0 + Rotate -90 1 0 0 + ReadArchive "capsule.rib" + TransformEnd WorldEnd Index: ManySpheres3.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/ManySpheres3.rib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ManySpheres3.rib 9 May 2003 00:05:14 -0000 1.1 --- ManySpheres3.rib 15 May 2003 03:15:28 -0000 1.2 *************** *** 1,3 **** ! Format 1000 700 1 PixelSamples 4 4 Exposure 1 2.5 --- 1,3 ---- ! Format 1000 750 1 PixelSamples 4 4 Exposure 1 2.5 *************** *** 98,101 **** --- 98,108 ---- Rotate 45 1 .5 1 Cylinder 4 -5 5 360 + TransformEnd + TransformBegin + Color .3 1 .2 + Opacity 1 1 1 + Translate 15 5 -35 + Rotate -90 1 0 0 + Cone 10 2 360 TransformEnd WorldEnd |
From: <ma...@us...> - 2003-05-15 03:16:03
|
Update of /cvsroot/jrman/drafts/src/org/jrman/attributes In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src/org/jrman/attributes Modified Files: Attributes.java MutableAttributes.java Added Files: Space.java Log Message: Did some work on shaders. --- NEW FILE: Space.java --- /* Space.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.attributes; public class Space { public final static Space CAMERA = new Space("CAMERA"); public final static Space WORLD = new Space("WORLD"); private String name; private Space(String name) { this.name = name; } public String toString() { return name; } } Index: Attributes.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/attributes/Attributes.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Attributes.java 9 Apr 2003 05:04:57 -0000 1.1 --- Attributes.java 15 May 2003 03:15:30 -0000 1.2 *************** *** 84,88 **** protected int vStep; ! protected Attributes() { } --- 84,90 ---- protected int vStep; ! ! protected Space space; ! protected Attributes() { } *************** *** 112,119 **** objectIdentifier = other.getObjectIdentifier(); trimCurveSense = other.getTrimCurveSense(); ! uBasis = Basis.BEZIER; ! uStep = 3; ! vBasis = Basis.BEZIER; ! vStep = 3; } --- 114,122 ---- objectIdentifier = other.getObjectIdentifier(); trimCurveSense = other.getTrimCurveSense(); ! uBasis = other.getUBasis(); ! uStep = other.getUStep(); ! vBasis = other.getVBasis(); ! vStep = other.getVStep(); ! space = other.getSpace(); } *************** *** 213,219 **** --- 216,234 ---- return uBasis; } + + public int getUStep() { + return uStep; + } public Basis getVBasis() { return vBasis; + } + + public int getVStep() { + return vStep; + } + + public Space getSpace() { + return space; } Index: MutableAttributes.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/attributes/MutableAttributes.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MutableAttributes.java 13 Apr 2003 05:15:33 -0000 1.3 --- MutableAttributes.java 15 May 2003 03:15:30 -0000 1.4 *************** *** 39,43 **** textureCoordinates = new TextureCoordinates(0f, 0f, 1f, 0f, 0f, 1f, 1f, 1f); lightSources = Collections.EMPTY_SET; ! surface = SurfaceShader.createShader("constant", new HashMap()); displacement = null; atmosphere = null; --- 39,44 ---- textureCoordinates = new TextureCoordinates(0f, 0f, 1f, 0f, 0f, 1f, 1f, 1f); lightSources = Collections.EMPTY_SET; ! surface = ! SurfaceShader.createShader("constant", new HashMap(), AffineTransform.IDENTITY); displacement = null; atmosphere = null; *************** *** 57,60 **** --- 58,66 ---- objectIdentifier = null; trimCurveSense = TrimCurveSense.INSIDE; + uBasis = Basis.BEZIER; + uStep = 3; + vBasis = Basis.BEZIER; + vStep =3; + space = Space.WORLD; } *************** *** 191,194 **** --- 197,205 ---- this.vBasis = vBasis; this.vStep = vStep; + modified = true; + } + + public void setSpace(Space space) { + this.space = space; modified = true; } |
From: <ma...@us...> - 2003-05-15 03:15:37
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1:/tmp/cvs-serv13495/src Added Files: GenCapsules.java Log Message: Did some work on shaders. --- NEW FILE: GenCapsules.java --- /* GenCapsules.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. */ public class GenCapsules { public static void main(String[] args) { int n = Integer.parseInt(args[0]); float x = - n * 3f / 2f; for (int xi = 0; xi < n; xi++) { float y = -n * 3f / 2f; for (int yi =0; yi < n; yi++) { float z = -n * 3f / 2f; for (int zi = 0; zi < n; zi++) { System.out.println("TransformBegin"); System.out.println("Translate " + x + " " + y + " " + z); System.out.println("Rotate " + Math.random() * 180 + " " + Math.random() + " " + Math.random() + " " + Math.random()); System.out.println("ReadArchive \"capsule.rib\""); System.out.println("TransformEnd"); z += 3f; } y += 3f; } x += 3f; } } } |
From: <ma...@us...> - 2003-05-12 16:55:01
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv920/src/org/jrman/render Modified Files: SamplePoint.java RendererHidden.java Sampler.java Log Message: Fine tuned visibility optimizations. Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SamplePoint.java 9 May 2003 06:33:10 -0000 1.9 --- SamplePoint.java 12 May 2003 16:46:16 -0000 1.10 *************** *** 26,47 **** import javax.vecmath.Point2f; public class SamplePoint { ! ! private Point2f point = new Point2f();; ! private List samples = new ArrayList(); ! private Color3f color = new Color3f(); ! private Color3f opacity = new Color3f(); ! private boolean opaque; ! private float z; ! public void init(float x, float y) { point.set(x, y); samples.clear(); opaque = false; } --- 26,62 ---- import javax.vecmath.Point2f; + import org.jrman.util.Constants; + public class SamplePoint { ! ! private Point2f point = new Point2f(); ! private List samples = new ArrayList(); ! private Color3f color = new Color3f(); ! private Color3f opacity = new Color3f(); ! ! private Sampler sampler; ! ! private int row; ! ! private int column; ! private boolean opaque; ! private float z; ! ! public SamplePoint(Sampler sampler, int column, int row) { ! this.sampler = sampler; ! this.column = column; ! this.row = row; ! } ! public void init(float x, float y) { point.set(x, y); samples.clear(); opaque = false; + z = Constants.INFINITY; } *************** *** 52,59 **** if (s.behind(sample)) { samples.add(--i, sample); ! if (sample.isOpaque()) { ! z = sample.getZ(); ! opaque = true; ! } return; } else if (s.isOpaque()) --- 67,72 ---- if (s.behind(sample)) { samples.add(--i, sample); ! if (sample.isOpaque()) ! update(sample.getZ()); return; } else if (s.isOpaque()) *************** *** 61,70 **** } samples.add(sample); ! if (sample.isOpaque()) { ! z = sample.getZ(); opaque = true; } } ! public void getColor(Color3f ocolor) { ocolor.set(0f, 0f, 0f); --- 74,89 ---- } samples.add(sample); ! if (sample.isOpaque()) ! update(sample.getZ()); ! } ! ! private void update(float nz) { ! if (nz < z || !opaque) { ! z = nz; opaque = true; + sampler.updateDepth(column, row); } } ! public void getColor(Color3f ocolor) { ocolor.set(0f, 0f, 0f); *************** *** 90,98 **** return point; } ! public boolean isOpaque() { return opaque; } ! public float getZ() { return z; --- 109,117 ---- return point; } ! public boolean isOpaque() { return opaque; } ! public float getZ() { return z; Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RendererHidden.java 11 May 2003 02:53:43 -0000 1.17 --- RendererHidden.java 12 May 2003 16:46:16 -0000 1.18 *************** *** 281,284 **** --- 281,286 ---- System.out.println( "Patches culled: " + invisiblePatchCount * 100f / primitivePatchCount + "%"); + System.out.println("Root count: " + Sampler.rootCount); + System.out.println("Pixel count: " + Sampler.pixelCount); System.out.println( "gridCount = " *************** *** 295,329 **** System.out.println("Total micropolygon samples: " + Micropolygon.sampledSampleCount); System.out.println("Micropolygons/second: " + Micropolygon.count / time); } private boolean isPrimitiveVisible(Primitive p, Sampler sampler) { ! Point2f smin = sampler.getMin(); ! Bounds2f pb = p.getRasterBounds(); ! float pMinX = pb.getMinX() - smin.x; ! float pMaxX = pb.getMaxX() - smin.x; ! float pMinY = pb.getMinY() - smin.y; ! float pMaxY = pb.getMaxY() - smin.y; ! int minColumn = ! Calc.clamp((int) (pMinX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); ! int minRow = ! Calc.clamp((int) (pMinY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); ! int maxColumn = ! Calc.clamp( ! (int) Math.ceil(pMaxX / sampler.getSampleWidth()), ! 0, ! sampler.getWidth() - 1); ! int maxRow = ! Calc.clamp( ! (int) Math.ceil(pMaxY / sampler.getSampleHeight()), ! 0, ! sampler.getHeight() - 1); ! for (int row = minRow; row <= maxRow; row++) { ! for (int col = minColumn; col <= maxColumn; col++) { ! SamplePoint sp = sampler.getSamplePoint(col, row); ! if (!sp.isOpaque() || sp.getZ() > p.getDistance()) ! return true; ! } ! } ! return false; } --- 297,306 ---- System.out.println("Total micropolygon samples: " + Micropolygon.sampledSampleCount); System.out.println("Micropolygons/second: " + Micropolygon.count / time); + System.out.println("Bucket samples: " + Sampler.bucketSamplesCount); + System.out.println("Modified bucket samples: " + Sampler.modifiedSampleBucketsCount); } private boolean isPrimitiveVisible(Primitive p, Sampler sampler) { ! return sampler.isVisible(p.getRasterBounds(), p.getDistance()); } Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Sampler.java 8 May 2003 05:00:33 -0000 1.5 --- Sampler.java 12 May 2003 16:46:16 -0000 1.6 *************** *** 23,26 **** --- 23,30 ---- import javax.vecmath.Point2f; + import org.jrman.geom.Bounds2f; + import org.jrman.util.Calc; + import org.jrman.util.Constants; + public class Sampler { *************** *** 31,34 **** --- 35,46 ---- private int height; + private int bucketWidth; + + private int bucketHeight; + + private int pixelWidth; + + private int pixelHeight; + private float sampleWidth; *************** *** 36,53 **** private SamplePoint[] samplePoints; ! private Color3f[] colors; public Sampler(int bucketWidth, int bucketHeight, float hSamples, float vSamples) { width = (int) Math.ceil(bucketWidth * hSamples); height = (int) Math.ceil(bucketHeight * vSamples); sampleWidth = 1f / hSamples; sampleHeight = 1f / hSamples; samplePoints = new SamplePoint[width * height]; ! for (int i = 0; i < samplePoints.length; i++) ! samplePoints[i] = new SamplePoint(); colors = new Color3f[width * height]; for (int i = 0; i < colors.length; i++) colors[i] = new Color3f(); } --- 48,104 ---- private SamplePoint[] samplePoints; ! private Color3f[] colors; + private MaskElement rootVisibility = new MaskElement(); + + private MaskElement[] pixelsVisibility; + + private boolean modified; + + public static int rootCount; + + public static int pixelCount; + + public static int bucketSamplesCount; + + public static int modifiedSampleBucketsCount; + + public static class MaskElement { + + float z; + + boolean opaque; + + boolean modified; + + void reset() { + z = Constants.INFINITY; + opaque = false; + modified = false; + } + + } + public Sampler(int bucketWidth, int bucketHeight, float hSamples, float vSamples) { + this.bucketWidth = bucketWidth; + this.bucketHeight = bucketHeight; width = (int) Math.ceil(bucketWidth * hSamples); height = (int) Math.ceil(bucketHeight * vSamples); + pixelWidth = width / bucketWidth; + pixelHeight = height / bucketHeight; sampleWidth = 1f / hSamples; sampleHeight = 1f / hSamples; samplePoints = new SamplePoint[width * height]; ! for (int row = 0; row < height; row++) ! for (int column = 0; column < width; column++) ! samplePoints[row * width + column] = ! new SamplePoint(this, column / pixelWidth, row / pixelHeight); colors = new Color3f[width * height]; for (int i = 0; i < colors.length; i++) colors[i] = new Color3f(); + pixelsVisibility = new MaskElement[bucketWidth * bucketHeight]; + for (int i = 0; i < pixelsVisibility.length; i++) + pixelsVisibility[i] = new MaskElement(); } *************** *** 63,73 **** --- 114,133 ---- y += sampleHeight; } + rootVisibility.reset(); + for (int i = 0; i < pixelsVisibility.length; i++) + pixelsVisibility[i].reset(); } public void sampleBucket(Bucket bucket) { + bucketSamplesCount++; + modified = false; while (bucket.hasMoreMicropolygons()) { Micropolygon mp = bucket.getNextMicropolygon(); mp.sample(this); } + if (modified) { + modifiedSampleBucketsCount++; + updatePyramid(); + } } *************** *** 100,103 **** --- 160,264 ---- public int getWidth() { return width; + } + + public void updateDepth(int column, int row) { + modified = true; + MaskElement me = pixelsVisibility[row * bucketWidth + column]; + me.modified = true; + } + + private void updatePyramid() { + for (int row = 0; row < bucketHeight; row++) + for (int column = 0; column < bucketWidth; column++) { + MaskElement me = pixelsVisibility[row * bucketWidth + column]; + if (!me.modified) + continue; + boolean opaque = true; + float z = -Constants.INFINITY; + CheckOpacity : for (int r = 0; r < pixelHeight; r++) + for (int c = 0; c < pixelWidth; c++) { + SamplePoint sp = + getSamplePoint(column * pixelWidth + c, row * pixelHeight + r); + if (!sp.isOpaque()) { + opaque = false; + break CheckOpacity; + } else + z = Math.max(z, sp.getZ()); + } + if (opaque) { + if (z < me.z) { + me.opaque = true; + me.z = z; + } + } + } + updateRoot(); + } + + private void updateRoot() { + rootVisibility.opaque = true; + float z = -Constants.INFINITY; + for (int i = 0; i < pixelsVisibility.length; i++) { + if (!pixelsVisibility[i].opaque) { + rootVisibility.opaque = false; + break; + } + z = Math.max(z, pixelsVisibility[i].z); + } + if (rootVisibility.opaque) + rootVisibility.z = z; + } + + public boolean isVisible(Bounds2f bounds, float z) { + if (rootVisibility.opaque && rootVisibility.z < z) { + rootCount++; + return false; + } + boolean visible = false; + float minX = bounds.getMinX() - min.x; + float minY = bounds.getMinY() - min.y; + float maxX = bounds.getMaxX() - min.x; + float maxY = bounds.getMaxY() - min.y; + int minCol = (int) Calc.clamp(minX, 0f, bucketWidth - 1); + int minRow = (int) Calc.clamp(minY, 0f, bucketHeight - 1); + int maxCol = (int) Calc.clamp((float) Math.ceil(maxX), 0f, bucketWidth - 1); + int maxRow = (int) Calc.clamp((float) Math.ceil(maxY), 0f, bucketHeight - 1); + PixelsLoop : for (int row = minRow; row <= maxRow; row++) + for (int column = minCol; column <= maxCol; column++) { + MaskElement me = pixelsVisibility[row * bucketWidth + column]; + if (!me.opaque || me.z > z) { + visible = true; + break PixelsLoop; + } + } + if (!visible) { + pixelCount++; + return false; + } + return true; + } + + public int getBucketHeight() { + return bucketHeight; + } + + public int getBucketWidth() { + return bucketWidth; + } + + public int getPixelHeight() { + return pixelHeight; + } + + public MaskElement[] getPixelsVisibility() { + return pixelsVisibility; + } + + public int getPixelWidth() { + return pixelWidth; + } + + public MaskElement getRootVisibility() { + return rootVisibility; } |
From: <ma...@us...> - 2003-05-12 16:54:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv920/src/org/jrman/primitive Modified Files: Primitive.java Log Message: Fine tuned visibility optimizations. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Primitive.java 10 May 2003 07:41:11 -0000 1.10 --- Primitive.java 12 May 2003 16:46:17 -0000 1.11 *************** *** 28,40 **** public abstract class Primitive { ! protected Map parameters; ! protected Attributes attributes; ! protected Bounds2f rasterBounds; ! protected float distance; ! protected Primitive(Map parameters, Attributes attributes) { this.parameters = parameters; --- 28,40 ---- public abstract class Primitive { ! protected Map parameters; ! protected Attributes attributes; ! protected Bounds2f rasterBounds; ! protected float distance; ! protected Primitive(Map parameters, Attributes attributes) { this.parameters = parameters; *************** *** 45,69 **** return attributes; } ! public abstract BoundingVolume getBoundingVolume(); ! public abstract Primitive[] split(); ! public abstract void dice(ShaderVariables shaderVariables); ! public abstract boolean isReadyToBeDiced(int gridSize); public void setRasterBounds(Bounds2f bounds) { ! this.rasterBounds = bounds; } public void setDistance(float f) { ! distance = f; } ! public float getDistance() { return distance; } ! public Bounds2f getRasterBounds() { return rasterBounds; --- 45,69 ---- return attributes; } ! public abstract BoundingVolume getBoundingVolume(); ! public abstract Primitive[] split(); ! public abstract void dice(ShaderVariables shaderVariables); ! public abstract boolean isReadyToBeDiced(int gridSize); public void setRasterBounds(Bounds2f bounds) { ! this.rasterBounds = bounds; } public void setDistance(float f) { ! distance = f; } ! public float getDistance() { return distance; } ! public Bounds2f getRasterBounds() { return rasterBounds; |
From: <ma...@us...> - 2003-05-12 16:46:22
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv920/sampleData Modified Files: ManySpheres.rib rings.rib Log Message: Fine tuned visibility optimizations. Index: ManySpheres.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/ManySpheres.rib,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ManySpheres.rib 10 May 2003 03:57:29 -0000 1.10 --- ManySpheres.rib 12 May 2003 16:46:17 -0000 1.11 *************** *** 1,81 **** ! Format 800 600 1 ! PixelSamples 4 4 ! Exposure 1 2.5 ! Display "ManySpheres.tif" "framebuffer" "rgb" ! #Display "ManySpheres.tif" "file" "rgb" ! #Option "limits" "bucketsize" [32 32] "gridsize" [1024] ! PixelFilter "box" 1 1 ! Projection "perspective" "fov" 50 ! #Projection "perspective" "fov" 90 ! ShadingRate 1 ! Surface "fakedlight" ! Translate 0 0 60 ! Rotate 20 0 0 1 ! Rotate -50 1 0 0 ! WorldBegin ! ReadArchive "AllSpheres.rib" ! #ReadArchive "ss.rib" ! Translate 0 7 0 ! Color 1 1 0 ! TransformBegin ! Translate 1 0 2 ! Rotate 30 0 1 0 ! Scale 2 2 2 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate -1 0 2.5 ! Rotate 60 1 0 0 ! Scale 2 2 2 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate 6 0 6 ! Color 1 1 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate -6 0 6 ! Color 1 1 0 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate 6 0 -6 ! Color 0 1 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate -6 0 -6 ! Color 1 0 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! Opacity 1 1 1 ! TransformBegin ! Color .7 .7 1 ! Translate -20 0 10 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .7 .3 ! Translate 10 2 15 ! Rotate 45 1 1 1 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .5 .8 ! Opacity .8 .8 .8 ! Translate 20 0 -15 ! Rotate 90 1 0 0 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .7 .7 ! Opacity 1 1 1 ! Translate -15 0 -20 ! Torus 4 1 0 360 360 ! TransformEnd ! WorldEnd --- 1,81 ---- ! Format 800 600 1 ! PixelSamples 4 4 ! Exposure 1 2.5 ! Display "ManySpheres.tif" "framebuffer" "rgb" ! #Display "ManySpheres.tif" "file" "rgb" ! #Option "limits" "bucketsize" [32 32] "gridsize" [1024] ! PixelFilter "box" 1 1 ! Projection "perspective" "fov" 50 ! #Projection "perspective" "fov" 90 ! ShadingRate 1 ! Surface "fakedlight" ! Translate 0 0 60 ! Rotate 20 0 0 1 ! Rotate -50 1 0 0 ! WorldBegin ! ReadArchive "AllSpheres.rib" ! #ReadArchive "ss.rib" ! Translate 0 7 0 ! Color 1 1 0 ! TransformBegin ! Translate 1 0 2 ! Rotate 30 0 1 0 ! Scale 2 2 2 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate -1 0 2.5 ! Rotate 60 1 0 0 ! Scale 2 2 2 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate 6 0 6 ! Color 1 1 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate -6 0 6 ! Color 1 1 0 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate 6 0 -6 ! Color 0 1 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! TransformBegin ! Translate -6 0 -6 ! Color 1 0 1 ! Opacity .6 .6 .6 ! Sphere 2 -2 2 360 ! TransformEnd ! Opacity 1 1 1 ! TransformBegin ! Color .7 .7 1 ! Translate -20 0 10 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .7 .3 ! Translate 10 2 15 ! Rotate 45 1 1 1 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .5 .8 ! Opacity .8 .8 .8 ! Translate 20 0 -15 ! Rotate 90 1 0 0 ! ReadArchive "Toruses.rib" ! TransformEnd ! TransformBegin ! Color 1 .7 .7 ! Opacity 1 1 1 ! Translate -15 0 -20 ! Torus 4 1 0 360 360 ! TransformEnd ! WorldEnd Index: rings.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/rings.rib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rings.rib 5 May 2003 02:17:39 -0000 1.2 --- rings.rib 12 May 2003 16:46:17 -0000 1.3 *************** *** 1,26 **** ! Format 800 600 1 ! PixelSamples 4 4 ! Exposure 1 2.5 ! Clipping 1 1000 ! Projection "perspective" "fov" 10 ! Surface "fakedlight" ! Translate 0 0 30 ! WorldBegin ! ShadingRate 1 ! TransformBegin ! Color 0 0 .6 ! Rotate 90 1 0 0 ! Sphere 100 -100 100 180 ! TransformEnd ! Color 1 1 0 ! TransformBegin ! Translate 1 0 2 ! Rotate 30 0 1 0 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate -1 0 2.5 ! Rotate 60 1 0 0 ! Sphere 2 -.6 .6 360 ! TransformEnd ! WorldEnd --- 1,27 ---- ! Format 800 600 1 ! Display "rings.rib" "framebuffer" "rgb" ! PixelSamples 4 4 ! Exposure 1 2.5 ! Clipping 1 1000 ! Projection "perspective" "fov" 10 ! Surface "fakedlight" ! Translate 0 0 30 ! WorldBegin ! ShadingRate 1 ! TransformBegin ! Color 0 0 .6 ! Rotate 90 1 0 0 ! Sphere 100 -100 100 180 ! TransformEnd ! Color 1 1 0 ! TransformBegin ! Translate 1 0 2 ! Rotate 30 0 1 0 ! Sphere 2 -.6 .6 360 ! TransformEnd ! TransformBegin ! Translate -1 0 2.5 ! Rotate 60 1 0 0 ! Sphere 2 -.6 .6 360 ! TransformEnd ! WorldEnd |
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/parser/keywords Modified Files: KeywordTransformBegin.java KeywordConcatTransform.java KeywordPerspective.java KeywordObjectBegin.java KeywordTranslate.java KeywordTransformEnd.java KeywordDisk.java KeywordTransform.java KeywordSkew.java KeywordCone.java KeywordRotate.java KeywordScale.java KeywordObjectInstance.java KeywordObjectEnd.java KeywordIdentity.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. Index: KeywordTransformBegin.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordTransformBegin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordTransformBegin.java 7 Apr 2003 08:24:18 -0000 1.2 --- KeywordTransformBegin.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordTransformBegin extends SolidKeywordParser { + + public KeywordTransformBegin() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordConcatTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordConcatTransform.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordConcatTransform.java 7 Apr 2003 08:24:31 -0000 1.2 --- KeywordConcatTransform.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 22,28 **** --- 22,33 ---- import javax.vecmath.Matrix4f; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordConcatTransform extends MotionKeywordParser { + + public KeywordConcatTransform() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordPerspective.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPerspective.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** KeywordPerspective.java 18 Apr 2003 04:51:36 -0000 1.4 --- KeywordPerspective.java 11 May 2003 02:53:43 -0000 1.5 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordPerspective extends MotionKeywordParser { + + public KeywordPerspective() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordObjectBegin.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordObjectBegin.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordObjectBegin.java 7 Apr 2003 08:24:30 -0000 1.2 --- KeywordObjectBegin.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 23,32 **** public class KeywordObjectBegin extends SolidKeywordParser { ! public void parse(Tokenizer st) throws Exception { // Expect sequence number match(st, TK_NUMBER); int sequenceNumber = (int)st.nval; - parser.objectBegin(sequenceNumber); } --- 23,31 ---- public class KeywordObjectBegin extends SolidKeywordParser { ! public void parse(Tokenizer st) throws Exception { // Expect sequence number match(st, TK_NUMBER); int sequenceNumber = (int)st.nval; parser.objectBegin(sequenceNumber); } Index: KeywordTranslate.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordTranslate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordTranslate.java 7 Apr 2003 08:24:22 -0000 1.2 --- KeywordTranslate.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordTranslate extends MotionKeywordParser { + + public KeywordTranslate() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordTransformEnd.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordTransformEnd.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordTransformEnd.java 7 Apr 2003 08:24:31 -0000 1.2 --- KeywordTransformEnd.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordTransformEnd extends SolidKeywordParser { + + public KeywordTransformEnd() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordDisk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDisk.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordDisk.java 10 May 2003 20:37:51 -0000 1.3 --- KeywordDisk.java 11 May 2003 02:53:43 -0000 1.4 *************** *** 34,53 **** else st.pushBack(); - // Expect height match(st, TK_NUMBER); float height = (float) st.nval; - // Expect radius match(st, TK_NUMBER); float radius = (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); --- 34,48 ---- Index: KeywordTransform.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordTransform.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordTransform.java 7 Apr 2003 08:24:25 -0000 1.2 --- KeywordTransform.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 22,28 **** --- 22,33 ---- import javax.vecmath.Matrix4f; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordTransform extends MotionKeywordParser { + + public KeywordTransform() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordSkew.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordSkew.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordSkew.java 7 Apr 2003 08:24:25 -0000 1.2 --- KeywordSkew.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordSkew extends MotionKeywordParser { + + public KeywordSkew() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { Index: KeywordCone.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordCone.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordCone.java 10 May 2003 20:37:51 -0000 1.3 --- KeywordCone.java 11 May 2003 02:53:43 -0000 1.4 *************** *** 34,38 **** else st.pushBack(); - // Expect height match(st, TK_NUMBER); --- 34,37 ---- *************** *** 46,50 **** if (array) match(st, TK_RBRACE); - // Expect parameter list Map parameters = parseParameterList(st); --- 45,48 ---- Index: KeywordRotate.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordRotate.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** KeywordRotate.java 3 May 2003 18:02:48 -0000 1.3 --- KeywordRotate.java 11 May 2003 02:53:43 -0000 1.4 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordRotate extends MotionKeywordParser { + + public KeywordRotate() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { *************** *** 28,44 **** match(st, TK_NUMBER); float angle = (float) st.nval; - // Expect dx match(st, TK_NUMBER); float dx = (float) st.nval; - // Expect dy match(st, TK_NUMBER); float dy = (float) st.nval; - // Expect dz match(st, TK_NUMBER); float dz = (float) st.nval; - parser.rotate(angle, dx, dy, dz); } --- 33,45 ---- Index: KeywordScale.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordScale.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordScale.java 7 Apr 2003 08:24:22 -0000 1.2 --- KeywordScale.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordScale extends MotionKeywordParser { + + public KeywordScale() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { *************** *** 28,40 **** match(st, TK_NUMBER); float sx = (float) st.nval; - // Expect sy match(st, TK_NUMBER); float sy = (float) st.nval; - // Expect sz match(st, TK_NUMBER); float sz = (float) st.nval; ! parser.scale(sx, sy, sz); } --- 33,43 ---- match(st, TK_NUMBER); float sx = (float) st.nval; // Expect sy match(st, TK_NUMBER); float sy = (float) st.nval; // Expect sz match(st, TK_NUMBER); float sz = (float) st.nval; ! parser.scale(sx, sy, sz); } Index: KeywordObjectInstance.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordObjectInstance.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordObjectInstance.java 7 Apr 2003 08:24:25 -0000 1.2 --- KeywordObjectInstance.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 32,36 **** // Expect sequence number match(st, TK_NUMBER); ! } --- 32,37 ---- // Expect sequence number match(st, TK_NUMBER); ! int n = (int) st.nval; ! parser.objectInstance(n); } Index: KeywordObjectEnd.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordObjectEnd.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordObjectEnd.java 7 Apr 2003 08:24:31 -0000 1.2 --- KeywordObjectEnd.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 31,35 **** public void parse(Tokenizer st) throws Exception { // Doesn't have any arguments - parser.objectEnd(); } --- 31,34 ---- Index: KeywordIdentity.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordIdentity.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordIdentity.java 7 Apr 2003 08:24:30 -0000 1.2 --- KeywordIdentity.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 20,26 **** --- 20,31 ---- package org.jrman.parser.keywords; + import org.jrman.parser.Parser; import org.jrman.parser.Tokenizer; public class KeywordIdentity extends MotionKeywordParser { + + public KeywordIdentity() { + validStates.add(Parser.State.OBJECT); + } public void parse(Tokenizer st) throws Exception { |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/parser Modified Files: Parser.java Added Files: ObjectInstanceList.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. --- NEW FILE: ObjectInstanceList.java --- /* ObjectInstance.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.parser; import java.util.ArrayList; import java.util.List; import org.jrman.attributes.Attributes; import org.jrman.attributes.MutableAttributes; import org.jrman.geom.BoundingVolume; import org.jrman.geom.MutableBounds3f; import org.jrman.geom.Transform; import org.jrman.primitive.Primitive; public class ObjectInstanceList { private List primitiveCreators = new ArrayList(); private BoundingVolume boundingVolume; public static abstract class PrimitiveCreator { public abstract Primitive create(Attributes attributes); protected Attributes createAttributes(Transform transform, Attributes attributes) { MutableAttributes ma = new MutableAttributes(attributes); ma.setTransform(ma.getTransform().concat(transform)); return ma; } } public void addPrimitiveCreator(PrimitiveCreator pc) { primitiveCreators.add(pc); } public Primitive[] createPrimitives(Attributes attributes) { Primitive[] result = new Primitive[primitiveCreators.size()]; for (int i = 0; i < primitiveCreators.size(); i++) result[i] = ((PrimitiveCreator) primitiveCreators.get(i)).create(attributes); return result; } public BoundingVolume getBoundingVolume() { if (boundingVolume == null) { MutableBounds3f mb = new MutableBounds3f(); Primitive[] primitives = createPrimitives(new MutableAttributes()); for (int i = 0; i < primitives.length; i++) { BoundingVolume bv = primitives[i].getBoundingVolume(); bv = bv.transform(primitives[i].getAttributes().getTransform()); mb.addBoundingVolume(bv); } boundingVolume = mb; } return boundingVolume; } } Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Parser.java 10 May 2003 20:37:51 -0000 1.36 --- Parser.java 11 May 2003 02:53:43 -0000 1.37 *************** *** 40,44 **** import org.jrman.attributes.GeometricApproximation; import org.jrman.attributes.MutableAttributes; - import org.jrman.attributes.ObjectInstance; import org.jrman.attributes.Orientation; import org.jrman.attributes.ShadingInterpolation; --- 40,43 ---- *************** *** 59,62 **** --- 58,63 ---- import org.jrman.primitive.Cylinder; import org.jrman.primitive.Disk; + import org.jrman.primitive.ObjectInstance; + import org.jrman.primitive.Primitive; import org.jrman.primitive.Sphere; import org.jrman.primitive.Torus; *************** *** 102,106 **** private String currentOperation; // Just now to avoid compiler warnings... ! private Map objectInstances = new HashMap(); public static class State { --- 103,111 ---- private String currentOperation; // Just now to avoid compiler warnings... ! private Map objectInstanceLists = new HashMap(); ! ! private ObjectInstanceList currentObjectInstanceList; ! ! private boolean inObject; public static class State { *************** *** 203,208 **** } ! private void newObjectInstance(int sequenceNumber) { ! objectInstances.put(new Integer(sequenceNumber), new ObjectInstance()); } --- 208,222 ---- } ! private void newObjectInstanceList(int sequenceNumber) { ! currentObjectInstanceList = new ObjectInstanceList(); ! objectInstanceLists.put(new Integer(sequenceNumber), currentObjectInstanceList); ! } ! ! private ObjectInstanceList getObjectInstanceList(int sequenceNumber) { ! ObjectInstanceList result = ! (ObjectInstanceList) objectInstanceLists.get(new Integer(sequenceNumber)); ! if (result == null) ! throw new IllegalArgumentException("Unknown instance: " + sequenceNumber); ! return result; } *************** *** 356,363 **** pushAttributes(); pushState(State.OBJECT); ! newObjectInstance(sequenceNumber); } public void objectEnd() { popState(); popAttributes(); --- 370,381 ---- pushAttributes(); pushState(State.OBJECT); ! setIdentity(); ! newObjectInstanceList(sequenceNumber); ! inObject = true; } public void objectEnd() { + currentObjectInstanceList = null; + inObject = false; popState(); popAttributes(); *************** *** 649,734 **** } public void addSphere( ! float radius, float zMin, float zMax, ! float thetaMax, ! Map parameters) { if (inAreaLightSource) return; ! float phiMin = (float) ((zMin <= -radius) ? -Math.PI / 2 : Math.asin(zMin / radius)); ! float phiMax = (float) ((zMax >= radius) ? Math.PI / 2 : Math.asin(zMax / radius)); ! float thetaMin = 0f; ! thetaMax = (float) Math.toRadians(thetaMax); ! renderer.addPrimitive( ! new Sphere( ! radius, ! phiMin, ! phiMax, ! thetaMin, ! thetaMax, ! parameters, ! getAttributes())); } public void addTorus( ! float majorRadius, ! float minorRadius, ! float phiMin, ! float phiMax, ! float thetaMax, ! Map parameters) { if (inAreaLightSource) return; ! phiMin = (float) Math.toRadians(phiMin); ! phiMax = (float) Math.toRadians(phiMax); ! thetaMax = (float) Math.toRadians(thetaMax); ! renderer.addPrimitive( ! new Torus( ! majorRadius, ! minorRadius, ! phiMin, ! phiMax, ! 0f, ! thetaMax, ! parameters, ! getAttributes())); } public void addCylinder( ! float radius, ! float zmin, ! float zmax, ! float thetaMax, ! Map parameters) { if (inAreaLightSource) return; ! thetaMax = (float) Math.toRadians(thetaMax); ! renderer.addPrimitive( ! new Cylinder(radius, zmin, zmax, 0f, thetaMax, parameters, getAttributes())); } ! public void addCone( ! float height, ! float radius, ! float thetaMax, ! Map parameters) { if (inAreaLightSource) return; ! thetaMax = (float) Math.toRadians(thetaMax); ! renderer.addPrimitive( ! new Cone(radius, 0f, height, 0f, thetaMax, height, parameters, getAttributes())); } public void addDisk( ! float height, ! float radius, ! float thetaMax, ! Map parameters) { if (inAreaLightSource) return; ! thetaMax = (float) Math.toRadians(thetaMax); ! renderer.addPrimitive( ! new Disk(radius, height, 0f, thetaMax, parameters, getAttributes())); } } --- 667,853 ---- } + public void objectInstance(int n) { + renderer.addPrimitive(new ObjectInstance(getObjectInstanceList(n), getAttributes())); + } + public void addSphere( ! final float radius, float zMin, float zMax, ! float tMax, ! final Map parameters) { if (inAreaLightSource) return; ! final float phiMin = ! (float) ((zMin <= -radius) ? -Math.PI / 2 : Math.asin(zMin / radius)); ! final float phiMax = ! (float) ((zMax >= radius) ? Math.PI / 2 : Math.asin(zMax / radius)); ! final float thetaMin = 0f; ! final float thetaMax = (float) Math.toRadians(tMax); ! if (!inObject) ! renderer.addPrimitive( ! new Sphere( ! radius, ! phiMin, ! phiMax, ! thetaMin, ! thetaMax, ! parameters, ! getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Sphere( ! radius, ! phiMin, ! phiMax, ! thetaMin, ! thetaMax, ! parameters, ! createAttributes(transform, attributes)); ! } ! }); ! } } public void addTorus( ! final float majorRadius, ! final float minorRadius, ! float pMin, ! float pMax, ! float tMax, ! final Map parameters) { if (inAreaLightSource) return; ! final float phiMin = (float) Math.toRadians(pMin); ! final float phiMax = (float) Math.toRadians(pMax); ! final float thetaMax = (float) Math.toRadians(tMax); ! if (!inObject) ! renderer.addPrimitive( ! new Torus( ! majorRadius, ! minorRadius, ! phiMin, ! phiMax, ! 0f, ! thetaMax, ! parameters, ! getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Torus( ! majorRadius, ! minorRadius, ! phiMin, ! phiMax, ! 0f, ! thetaMax, ! parameters, ! createAttributes(transform, attributes)); ! } ! }); ! } } public void addCylinder( ! final float radius, ! final float zmin, ! final float zmax, ! float tMax, ! final Map parameters) { if (inAreaLightSource) return; ! final float thetaMax = (float) Math.toRadians(tMax); ! if (!inObject) ! renderer.addPrimitive( ! new Cylinder(radius, zmin, zmax, 0f, thetaMax, parameters, getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Cylinder( ! radius, ! zmin, ! zmax, ! 0f, ! thetaMax, ! parameters, ! createAttributes(transform, attributes)); ! } ! }); ! } } ! public void addCone( ! final float height, ! final float radius, ! float tMax, ! final Map parameters) { if (inAreaLightSource) return; ! final float thetaMax = (float) Math.toRadians(tMax); ! if (!inObject) ! renderer.addPrimitive( ! new Cone( ! radius, ! 0f, ! height, ! 0f, ! thetaMax, ! height, ! parameters, ! getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Cone( ! radius, ! 0f, ! height, ! 0f, ! thetaMax, ! height, ! parameters, ! createAttributes(transform, attributes)); ! } ! }); ! } } public void addDisk( ! final float height, ! final float radius, ! float tMax, ! final Map parameters) { if (inAreaLightSource) return; ! final float thetaMax = (float) Math.toRadians(tMax); ! if (!inObject) ! renderer.addPrimitive( ! new Disk(radius, height, 0f, thetaMax, parameters, getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Disk( ! radius, ! height, ! 0f, ! thetaMax, ! parameters, ! createAttributes(transform, attributes)); ! } ! }); ! } } + } |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/render Modified Files: RendererHidden.java ShaderVariables.java Micropolygon.java Added Files: SimpleMicropolygon.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. --- NEW FILE: SimpleMicropolygon.java --- /* Micropolygon.java Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.jrman.render; import javax.vecmath.Point2f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; import org.jrman.util.Calc; import org.jrman.util.Constants; public class SimpleMicropolygon extends Micropolygon { // These static Vector3f are not thead safe!!! private static Vector3f ab = new Vector3f(); private static Vector3f ac = new Vector3f(); private static Vector3f cp = new Vector3f(); private float ax; private float ay; private float az; private float bx; private float by; private float cx; private float cy; private float nx; private float ny; private float oneOverNz; private float colorRed; private float colorGreen; private float colorBlue; private float opacityRed; private float opacityGreen; private float opacityBlue; private float minX = Constants.INFINITY; private float maxX = -Constants.INFINITY; private float minY = Constants.INFINITY; private float maxY = -Constants.INFINITY; private float minZ = Constants.INFINITY; public boolean init( Point3f a, Point3f b, Point3f c, float cRed, float cGreen, float cBlue, float oRed, float oGreen, float oBlue) { count++; // Face forward ab.sub(b, a); ac.sub(c, a); cp.cross(ab, ac); if (cp.z == 0f) return false; if (cp.z > 0) { Point3f tmp = b; b = c; c = tmp; } nx = cp.x; ny = cp.y; oneOverNz = 1f / cp.z; // get bounds addPointToBounds(a.x, a.y, a.z); addPointToBounds(b.x, b.y, b.z); addPointToBounds(c.x, c.y, c.z); ax = a.x; ay = a.y; az = a.z; bx = b.x; by = b.y; cx = c.x; cy = c.y; colorRed = cRed; colorGreen = cGreen; colorBlue = cBlue; opacityRed = oRed; opacityGreen = oGreen; opacityBlue = oBlue; return true; } private void addPointToBounds(float x, float y, float z) { minX = Math.min(minX, x); maxX = Math.max(maxX, x); minY = Math.min(minY, y); maxY = Math.max(maxY, y); minZ = Math.min(minZ, z); } public void sample(Sampler sampler) { Point2f smin = sampler.getMin(); float mpMinX = minX - smin.x; float mpMaxX = maxX - smin.x; float mpMinY = minY - smin.y; float mpMaxY = maxY - smin.y; int minColumn = Calc.clamp((int) (mpMinX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); int minRow = Calc.clamp((int) (mpMinY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); int maxColumn = Calc.clamp( (int) Math.ceil(mpMaxX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); int maxRow = Calc.clamp( (int) Math.ceil(mpMaxY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); for (int row = minRow; row <= maxRow; row++) { boolean found = false; for (int col = minColumn; col <= maxColumn; col++) { sampleCount++; SamplePoint sp = sampler.getSamplePoint(col, row); if (sp.isOpaque() && sp.getZ() < minZ) { invisibleSampleCount++; continue; } boolean touched = sample(sp); if (touched) sampledSampleCount++; if (found && !touched) break; found = touched; } } } public boolean sample(SamplePoint sp) { Point2f point = sp.getPoint(); if ((ay - by) * (point.x - ax) + (bx - ax) * (point.y - ay) > 0f) return false; if ((by - cy) * (point.x - bx) + (cx - bx) * (point.y - by) > 0f) return false; if ((cy - ay) * (point.x - cx) + (ax - cx) * (point.y - cy) > 0f) return false; float z = (nx * (ax - point.x) + ny * (ay - point.y)) * oneOverNz + az; sp.addSample( new Sample( colorRed, colorGreen, colorBlue, opacityRed, opacityGreen, opacityBlue, z)); return true; } public float getMaxX() { return maxX; } public float getMaxY() { return maxY; } public float getMinX() { return minX; } public float getMinY() { return minY; } } Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RendererHidden.java 10 May 2003 07:41:12 -0000 1.16 --- RendererHidden.java 11 May 2003 02:53:43 -0000 1.17 *************** *** 185,189 **** } ! public void addToBuckets(Micropolygon mp) { float mpMinX = mp.getMinX() - rasterWindowMin.x; float mpMinY = mp.getMinY() - rasterWindowMin.y; --- 185,189 ---- } ! public void addToBuckets(SimpleMicropolygon mp) { float mpMinX = mp.getMinX() - rasterWindowMin.x; float mpMinY = mp.getMinY() - rasterWindowMin.y; *************** *** 289,292 **** --- 289,298 ---- + gridCount / time + "grids/second"); + System.out.println("Total micropolygons: " + Micropolygon.count); + System.out.println("Total subpixel samples: " + Micropolygon.sampleCount); + System.out.println( + "Invisible micropolygon samples: " + Micropolygon.invisibleSampleCount); + System.out.println("Total micropolygon samples: " + Micropolygon.sampledSampleCount); + System.out.println("Micropolygons/second: " + Micropolygon.count / time); } Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ShaderVariables.java 8 May 2003 05:00:33 -0000 1.4 --- ShaderVariables.java 11 May 2003 02:53:43 -0000 1.5 *************** *** 102,106 **** for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; ! Micropolygon mp = new Micropolygon(); if (mp .init( --- 102,106 ---- for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; ! SimpleMicropolygon mp = new SimpleMicropolygon(); if (mp .init( *************** *** 115,119 **** o[offset].z)) rh.addToBuckets(mp); ! mp = new Micropolygon(); if (mp .init( --- 115,119 ---- o[offset].z)) rh.addToBuckets(mp); ! mp = new SimpleMicropolygon(); if (mp .init( Index: Micropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Micropolygon.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Micropolygon.java 9 May 2003 06:33:10 -0000 1.10 --- Micropolygon.java 11 May 2003 02:53:43 -0000 1.11 *************** *** 20,197 **** package org.jrman.render; - import javax.vecmath.Point2f; - import javax.vecmath.Point3f; - import javax.vecmath.Vector3f; - - import org.jrman.util.Calc; - import org.jrman.util.Constants; - - public class Micropolygon { - - // These static Vector3f are not thead safe!!! - private static Vector3f ab = new Vector3f(); - - private static Vector3f ac = new Vector3f(); - - private static Vector3f cp = new Vector3f(); - - private float ax; - - private float ay; - - private float az; - - private float bx; - - private float by; - - private float cx; - - private float cy; - - private float nx; - - private float ny; - - private float oneOverNz; - - private float colorRed; - - private float colorGreen; - - private float colorBlue; - - private float opacityRed; - - private float opacityGreen; - - private float opacityBlue; - - private float minX = Constants.INFINITY; - - private float maxX = -Constants.INFINITY; - - private float minY = Constants.INFINITY; - - private float maxY = -Constants.INFINITY; - - private float minZ = Constants.INFINITY; - - public boolean init( - Point3f a, - Point3f b, - Point3f c, - float cRed, - float cGreen, - float cBlue, - float oRed, - float oGreen, - float oBlue) { - // Face forward - ab.sub(b, a); - ac.sub(c, a); - cp.cross(ab, ac); - if (cp.z == 0f) - return false; - if (cp.z > 0) { - Point3f tmp = b; - b = c; - c = tmp; - } - nx = cp.x; - ny = cp.y; - oneOverNz = 1f / cp.z; - // get bounds - addPointToBounds(a.x, a.y, a.z); - addPointToBounds(b.x, b.y, b.z); - addPointToBounds(c.x, c.y, c.z); - ax = a.x; - ay = a.y; - az = a.z; - bx = b.x; - by = b.y; - cx = c.x; - cy = c.y; - colorRed = cRed; - colorGreen = cGreen; - colorBlue = cBlue; - opacityRed = oRed; - opacityGreen = oGreen; - opacityBlue = oBlue; - return true; - } ! private void addPointToBounds(float x, float y, float z) { ! minX = Math.min(minX, x); ! maxX = Math.max(maxX, x); ! minY = Math.min(minY, y); ! maxY = Math.max(maxY, y); ! minZ = Math.min(minZ, z); ! } ! ! public void sample(Sampler sampler) { ! Point2f smin = sampler.getMin(); ! float mpMinX = minX - smin.x; ! float mpMaxX = maxX - smin.x; ! float mpMinY = minY - smin.y; ! float mpMaxY = maxY - smin.y; ! int minColumn = ! Calc.clamp((int) (mpMinX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); ! int minRow = ! Calc.clamp((int) (mpMinY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); ! int maxColumn = ! Calc.clamp((int) Math.ceil(mpMaxX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); ! int maxRow = ! Calc.clamp((int) Math.ceil(mpMaxY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); ! for (int row = minRow; row <= maxRow; row++) { ! boolean found = false; ! for (int col = minColumn; col <= maxColumn; col++) { ! SamplePoint sp = sampler.getSamplePoint(col, row); ! if (sp.isOpaque() && sp.getZ() < minZ) ! continue; ! boolean touched = sample(sp); ! if (found && !touched) ! break; ! found = touched; ! } ! } ! } ! public boolean sample(SamplePoint sp) { ! Point2f point = sp.getPoint(); ! if ((ay - by) * (point.x - ax) + (bx - ax) * (point.y - ay) > 0f) ! return false; ! if ((by - cy) * (point.x - bx) + (cx - bx) * (point.y - by) > 0f) ! return false; ! if ((cy - ay) * (point.x - cx) + (ax - cx) * (point.y - cy) > 0f) ! return false; ! float z = (nx * (ax - point.x) + ny * (ay - point.y)) * oneOverNz + az; ! sp.addSample( ! new Sample( ! colorRed, ! colorGreen, ! colorBlue, ! opacityRed, ! opacityGreen, ! opacityBlue, ! z)); ! return true; ! } ! public float getMaxX() { ! return maxX; ! } ! public float getMaxY() { ! return maxY; ! } ! public float getMinX() { ! return minX; ! } ! public float getMinY() { ! return minY; ! } ! } --- 20,35 ---- package org.jrman.render; ! public abstract class Micropolygon { ! public static int count; ! public static int sampleCount; ! public static int invisibleSampleCount; ! public static int sampledSampleCount; ! public abstract void sample(Sampler sampler); ! } \ No newline at end of file |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/geom Modified Files: MutableBounds3f.java Bounds3f.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. Index: MutableBounds3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/MutableBounds3f.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MutableBounds3f.java 10 May 2003 03:57:28 -0000 1.2 --- MutableBounds3f.java 11 May 2003 02:53:43 -0000 1.3 *************** *** 41,44 **** --- 41,53 ---- addPoint(hpoint.x / hpoint.w, hpoint.y / hpoint.w, hpoint.z/hpoint.w); } + + public void addBounds3f(Bounds3f b) { + addPoint(b.minX, b.minY, b.minZ); + addPoint(b.maxX, b.maxY, b.maxZ); + } + + public void addBoundingVolume(BoundingVolume bv) { + addBounds3f(bv.getBoundingBox()); + } } Index: Bounds3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/Bounds3f.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Bounds3f.java 10 May 2003 07:41:12 -0000 1.10 --- Bounds3f.java 11 May 2003 02:53:43 -0000 1.11 *************** *** 248,252 **** .append(", ") .append(minY) ! .append("' ") .append(minZ) .append(')'); --- 248,252 ---- .append(", ") .append(minY) ! .append(", ") .append(minZ) .append(')'); |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/primitive Modified Files: Cone.java Disk.java Added Files: ObjectInstance.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. --- NEW FILE: ObjectInstance.java --- /* ObjectInstance.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.primitive; import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; import org.jrman.parser.ObjectInstanceList; import org.jrman.render.ShaderVariables; public class ObjectInstance extends Primitive { private ObjectInstanceList objectInstanceList; public ObjectInstance(ObjectInstanceList oil, Attributes attributes) { super(null, attributes); objectInstanceList = oil; } public BoundingVolume getBoundingVolume() { return objectInstanceList.getBoundingVolume(); } public Primitive[] split() { return objectInstanceList.createPrimitives(attributes); } public void dice(ShaderVariables shaderVariables) { throw new RuntimeException("Tried to dice an object instance!"); } public boolean isReadyToBeDiced(int gridSize) { return false; } } Index: Cone.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Cone.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Cone.java 10 May 2003 20:37:51 -0000 1.1 --- Cone.java 11 May 2003 02:53:43 -0000 1.2 *************** *** 1,4 **** /* ! Cylinder.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! Cone.java Copyright (C) 2003 Gerardo Horvilleur Martinez *************** *** 35,49 **** public class Cone extends Quadric { ! float radius; ! float zmin; ! float zmax; ! float thetaMin; ! float thetaMax; ! float height; public Cone( --- 35,49 ---- public class Cone extends Quadric { ! private float radius; ! private float zmin; ! private float zmax; ! private float thetaMin; ! private float thetaMax; ! private float height; public Cone( *************** *** 109,113 **** public Primitive[] split() { Primitive[] result = new Primitive[2]; ! float r = Math.max(radius * (1-zmax/height), radius * (1-zmin/height)); if ((thetaMax - thetaMin) * r > zmax - zmin) { result[0] = --- 109,113 ---- public Primitive[] split() { Primitive[] result = new Primitive[2]; ! float r = Math.max(radius * (1 - zmax / height), radius * (1 - zmin / height)); if ((thetaMax - thetaMin) * r > zmax - zmin) { result[0] = *************** *** 183,202 **** int vSize = Grid.getVSize(); float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! float zDelta = (zmax - zmin) / (vSize - 1); Vector3fGrid Ng = shaderVariables.Ng; Vector3f tmp = new Vector3f(); float theta = thetaMin; - tmp.x = 0f; - tmp.y = 0f; for (int u = 0; u < uSize; u++) { ! float z = zmin; for (int v = 0; v < vSize; v++) { ! tmp.z = z; Ng.set(u, v, tmp); - z += zDelta; } theta += thetaDelta; } - Ng.sub(shaderVariables.P, Ng); } --- 183,203 ---- int vSize = Grid.getVSize(); float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! float ang = (float) (Math.PI / 2 - Math.atan(height / radius)); ! float cosAng = (float) Math.cos(ang); ! float sinAng = (float) Math.sin(ang); Vector3fGrid Ng = shaderVariables.Ng; Vector3f tmp = new Vector3f(); float theta = thetaMin; for (int u = 0; u < uSize; u++) { ! float cosThetaCosAng = (float) Math.cos(theta) * cosAng; ! float sinThetaCosAng = (float) Math.sin(theta) * cosAng; for (int v = 0; v < vSize; v++) { ! tmp.x = cosThetaCosAng; ! tmp.y = sinThetaCosAng; ! tmp.z = sinAng; Ng.set(u, v, tmp); } theta += thetaDelta; } } Index: Disk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Disk.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Disk.java 10 May 2003 20:37:51 -0000 1.1 --- Disk.java 11 May 2003 02:53:43 -0000 1.2 *************** *** 35,45 **** public class Disk extends Quadric { ! float radius; ! float height; ! float thetaMin; ! float thetaMax; public Disk( --- 35,45 ---- public class Disk extends Quadric { ! private float radius; ! private float height; ! private float thetaMin; ! private float thetaMax; public Disk( *************** *** 77,81 **** else { yMax = sinThetaMin * radius; ! yMax = Math.max(yMax,sinThetaMax * radius); } if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) --- 77,81 ---- else { yMax = sinThetaMin * radius; ! yMax = Math.max(yMax, sinThetaMax * radius); } if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) *************** *** 107,156 **** interpolateParameters(.5f, 1f, 0f, 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 rDelta = radius / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! Point3f tmp = new Point3f(); ! float theta = thetaMin; ! for (int u = 0; u < uSize; u++) { ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! float r = 0; ! for (int v = 0; v < vSize; v++) { ! tmp.x = radius * (1-r) * cosTheta; ! tmp.y = radius * (1-r) * sinTheta; ! tmp.z = height; ! P.set(u, v, tmp); ! r += rDelta; ! } ! theta += thetaDelta; } - } ! protected void dice_Ng(ShaderVariables shaderVariables) { ! int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); ! Vector3fGrid Ng = shaderVariables.Ng; ! Vector3f tmp = new Vector3f(); ! float theta = thetaMin; ! tmp.x = 0f; ! tmp.y = 0f; ! tmp.z = 0f; ! for (int u = 0; u < uSize; u++) { ! for (int v = 0; v < vSize; v++) { ! tmp.z = height; ! Ng.set(u, v, tmp); } - theta += thetaDelta; } ! Ng.sub(shaderVariables.P, Ng); ! } } --- 107,149 ---- interpolateParameters(.5f, 1f, 0f, 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 rDelta = radius / (vSize - 1); ! Point3fGrid P = shaderVariables.P; ! Point3f tmp = new Point3f(); ! float theta = thetaMin; ! for (int u = 0; u < uSize; u++) { ! float cosTheta = (float) Math.cos(theta); ! float sinTheta = (float) Math.sin(theta); ! float r = 0; ! for (int v = 0; v < vSize; v++) { ! tmp.x = radius * (1 - r) * cosTheta; ! tmp.y = radius * (1 - r) * sinTheta; ! tmp.z = height; ! P.set(u, v, tmp); ! r += rDelta; ! } ! theta += thetaDelta; } } ! ! protected void dice_Ng(ShaderVariables shaderVariables) { ! int uSize = Grid.getUSize(); ! int vSize = Grid.getVSize(); ! Vector3fGrid Ng = shaderVariables.Ng; ! Vector3f tmp = new Vector3f(); ! tmp.x = 0f; ! tmp.y = 0f; ! tmp.z = 1f; ! for (int u = 0; u < uSize; u++) ! for (int v = 0; v < vSize; v++) ! Ng.set(u, v, tmp); ! } } |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/attributes In directory sc8-pr-cvs1:/tmp/cvs-serv20106/src/org/jrman/attributes Removed Files: ObjectInstance.java Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. --- ObjectInstance.java DELETED --- |
From: <ma...@us...> - 2003-05-11 02:53:46
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv20106/sampleData Modified Files: torus.rib cubeScene.rib Added Files: cubeSceneInstances.rib Log Message: Implemented object instances. Fixed Cone Normal. Fixed Disk Normal. --- NEW FILE: cubeSceneInstances.rib --- Format 800 600 1 PixelSamples 4 4 Exposure 1 2.5 Display "cubeSceneInstances.tif" "framebuffer" "rgb" PixelFilter "box" 1 1 Projection "perspective" "fov" 50 ShadingRate 1 Surface "fakedlight" Translate 0 0 60 Rotate 20 0 0 1 Rotate -30 1 0 0 WorldBegin ObjectBegin 1 ReadArchive "cube.rib" ObjectEnd # red AttributeBegin Color 1 0 0 Translate 20 20 0 Rotate 60 1 1 1 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # green AttributeBegin Color 0 1 0 Translate -15 20 0 Rotate 60 1 0 1 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # blue AttributeBegin Color 0 0 1 Translate 20 -10 0 Rotate 45 0 1 1 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # yellow AttributeBegin Color 1 1 0 Translate -15 -12 0 Rotate 45 1 1 0 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # cyan AttributeBegin Color 0 1 1 Translate 0 0 15 Rotate 0 1 0 0 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # magenta AttributeBegin Color 1 0 1 Translate 10 -20 5 Rotate -60 1 0 1 Scale 1.5 1.5 1.5 ObjectInstance 1 AttributeEnd # large gray AttributeBegin Color .6 .6 .6 Translate 0 -50 100 Scale 12 12 12 ObjectInstance 1 AttributeEnd WorldEnd Index: torus.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/torus.rib,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** torus.rib 10 May 2003 20:37:51 -0000 1.4 --- torus.rib 11 May 2003 02:53:43 -0000 1.5 *************** *** 11,20 **** Rotate -45 1 1 1 Color 1 .2 .2 ! Cylinder 2 -2 2 270 AttributeEnd AttributeBegin Translate 0 4 0 Color .2 .8 .2 ! Cone 3 3 360 AttributeEnd AttributeBegin --- 11,21 ---- Rotate -45 1 1 1 Color 1 .2 .2 ! Cylinder 2 -2 2 360 AttributeEnd AttributeBegin Translate 0 4 0 + Rotate -110 1 0 0 Color .2 .8 .2 ! Cone 3 2 360 AttributeEnd AttributeBegin Index: cubeScene.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/cubeScene.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cubeScene.rib 10 May 2003 07:41:12 -0000 1.3 --- cubeScene.rib 11 May 2003 02:53:43 -0000 1.4 *************** *** 1,3 **** ! Format 1000 750 1 PixelSamples 4 4 Exposure 1 2.5 --- 1,3 ---- ! Format 800 600 1 PixelSamples 4 4 Exposure 1 2.5 *************** *** 66,68 **** ReadArchive "cube.rib" AttributeEnd ! WorldEnd \ No newline at end of file --- 66,68 ---- ReadArchive "cube.rib" AttributeEnd ! WorldEnd |
From: <ega...@us...> - 2003-05-10 20:37:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv4093/src/org/jrman/primitive Added Files: Cone.java Disk.java Log Message: Added Cone and Disk primitives. Normal vectors are incorrect. --- NEW FILE: Cone.java --- /* Cylinder.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.primitive; import java.util.Map; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds3f; import org.jrman.grid.Grid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.render.ShaderVariables; public class Cone extends Quadric { float radius; float zmin; float zmax; float thetaMin; float thetaMax; float height; public Cone( float radius, float zmin, float zmax, float thetaMin, float thetaMax, float height, Map parameters, Attributes attributes) { super(parameters, attributes); this.radius = radius; this.zmin = zmin; this.zmax = zmax; this.thetaMin = thetaMin; this.thetaMax = thetaMax; this.height = height; } public BoundingVolume getBoundingVolume() { 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 = radius * (1 - zmin / height); float rMin = radius * (1 - zmax / height); 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, zmin, zmax); return result; } public Primitive[] split() { Primitive[] result = new Primitive[2]; float r = Math.max(radius * (1-zmax/height), radius * (1-zmin/height)); if ((thetaMax - thetaMin) * r > zmax - zmin) { result[0] = new Cone( radius, zmin, zmax, thetaMin, (thetaMin + thetaMax) / 2f, height, interpolateParameters(0f, .5f, 0f, 1f), attributes); result[1] = new Cone( radius, zmin, zmax, (thetaMin + thetaMax) / 2f, thetaMax, height, interpolateParameters(.5f, 1f, 0f, 1f), attributes); } else { result[0] = new Cone( radius, zmin, (zmin + zmax) / 2f, thetaMin, thetaMax, height, interpolateParameters(0f, 1f, 0f, .5f), attributes); result[1] = new Cone( radius, (zmin + zmax) / 2f, zmax, thetaMin, thetaMax, height, interpolateParameters(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 = (zmax - zmin) / (vSize - 1); Point3fGrid P = shaderVariables.P; Point3f tmp = new Point3f(); 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++) { tmp.x = radius * (1 - z / height) * cosTheta; tmp.y = radius * (1 - z / height) * sinTheta; tmp.z = z; P.set(u, v, tmp); z += zDelta; } theta += thetaDelta; } } protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); int vSize = Grid.getVSize(); float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); float zDelta = (zmax - zmin) / (vSize - 1); Vector3fGrid Ng = shaderVariables.Ng; Vector3f tmp = new Vector3f(); float theta = thetaMin; tmp.x = 0f; tmp.y = 0f; for (int u = 0; u < uSize; u++) { float z = zmin; for (int v = 0; v < vSize; v++) { tmp.z = z; Ng.set(u, v, tmp); z += zDelta; } theta += thetaDelta; } Ng.sub(shaderVariables.P, Ng); } } --- NEW FILE: Disk.java --- /* Cylinder.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.primitive; import java.util.Map; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds3f; import org.jrman.grid.Grid; import org.jrman.grid.Point3fGrid; import org.jrman.grid.Vector3fGrid; import org.jrman.render.ShaderVariables; public class Disk extends Quadric { float radius; float height; float thetaMin; float thetaMax; public Disk( float radius, float height, float thetaMin, float thetaMax, Map parameters, Attributes attributes) { super(parameters, attributes); this.radius = radius; this.height = height; this.thetaMin = thetaMin; this.thetaMax = thetaMax; } public BoundingVolume getBoundingVolume() { 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 xMin; float xMax = cosThetaMin * radius; xMax = Math.max(xMax, cosThetaMax * radius); float yMin; float yMax; if (thetaMin < Math.PI && thetaMax > Math.PI) xMin = -radius; else { xMin = cosThetaMin * radius; xMin = Math.min(xMin, cosThetaMax * radius); } if (thetaMin < Math.PI / 2 && thetaMax > Math.PI / 2) yMax = radius; else { yMax = sinThetaMin * radius; yMax = Math.max(yMax,sinThetaMax * radius); } if (thetaMin < Math.PI * 3 / 2 && thetaMax > Math.PI * 3 / 2) yMin = -radius; else { yMin = sinThetaMin * radius; yMin = Math.min(yMin, sinThetaMax * radius); } Bounds3f result = new Bounds3f(xMin, xMax, yMin, yMax, height, height); return result; } public Primitive[] split() { Primitive[] result = new Primitive[2]; result[0] = new Disk( radius, height, thetaMin, (thetaMin + thetaMax) / 2f, interpolateParameters(0f, .5f, 0f, 1f), attributes); result[1] = new Disk( radius, height, (thetaMin + thetaMax) / 2f, thetaMax, interpolateParameters(.5f, 1f, 0f, 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 rDelta = radius / (vSize - 1); Point3fGrid P = shaderVariables.P; Point3f tmp = new Point3f(); float theta = thetaMin; for (int u = 0; u < uSize; u++) { float cosTheta = (float) Math.cos(theta); float sinTheta = (float) Math.sin(theta); float r = 0; for (int v = 0; v < vSize; v++) { tmp.x = radius * (1-r) * cosTheta; tmp.y = radius * (1-r) * sinTheta; tmp.z = height; P.set(u, v, tmp); r += rDelta; } theta += thetaDelta; } } protected void dice_Ng(ShaderVariables shaderVariables) { int uSize = Grid.getUSize(); int vSize = Grid.getVSize(); float thetaDelta = (thetaMax - thetaMin) / (uSize - 1); Vector3fGrid Ng = shaderVariables.Ng; Vector3f tmp = new Vector3f(); float theta = thetaMin; tmp.x = 0f; tmp.y = 0f; tmp.z = 0f; for (int u = 0; u < uSize; u++) { for (int v = 0; v < vSize; v++) { tmp.z = height; Ng.set(u, v, tmp); } theta += thetaDelta; } Ng.sub(shaderVariables.P, Ng); } } |
From: <ega...@us...> - 2003-05-10 20:37:55
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv4093/sampleData Modified Files: torus.rib Added Files: disk.rib cone.rib Log Message: Added Cone and Disk primitives. Normal vectors are incorrect. --- NEW FILE: disk.rib --- 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 0 -4 0 Color 1 .2 .2 Disk 1 2 360 AttributeEnd AttributeBegin Translate 0 4 0 Rotate 90 1 0 0 Color .2 .8 .2 Disk 1 1 360 AttributeEnd AttributeBegin Rotate 60 1 0 0 Rotate -75 1 1 1 Color .7 .7 1 Disk 2 1 90 AttributeEnd AttributeBegin Translate 4 0 0 Rotate -45 1 1 1 Color 1 .2 .2 Disk 1 2 180 AttributeEnd AttributeBegin Translate -4 0 0 Rotate -80 1 1 1 Color .2 .8 .2 Disk 5 2 360 AttributeEnd AttributeBegin Translate -2 0 0 Rotate -75 1 1 1 Color .7 .7 1 Disk 4 1 90 AttributeEnd WorldEnd --- NEW FILE: cone.rib --- 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 0 -4 0 Rotate -45 1 1 1 Color 1 .2 .2 Cone 1 2 360 AttributeEnd AttributeBegin Translate 0 4 0 Rotate 90 1 0 1 Color .2 .8 .2 Cone 1 1 270 AttributeEnd AttributeBegin Rotate 60 1 0 0 Rotate -75 1 1 1 Color .7 .7 1 Cone 2 1 90 AttributeEnd AttributeBegin Translate 4 0 0 Rotate -45 1 1 1 Color 1 .2 .2 Cone 1 2 180 AttributeEnd AttributeBegin Translate -4 0 0 Rotate -80 1 1 1 Color .2 .8 .2 Cone 5 2 360 AttributeEnd AttributeBegin Translate -2 0 0 Rotate -75 1 1 1 Color .7 .7 1 Cone 4 1 90 AttributeEnd WorldEnd Index: torus.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/torus.rib,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** torus.rib 8 May 2003 05:00:24 -0000 1.3 --- torus.rib 10 May 2003 20:37:51 -0000 1.4 *************** *** 8,15 **** ShadingRate 1 AttributeBegin ! Translate 0 4 0 Rotate -45 1 1 1 Color 1 .2 .2 ! Cylinder 2 -2 2 360 AttributeEnd AttributeBegin --- 8,20 ---- ShadingRate 1 AttributeBegin ! Translate 0 -4 0 Rotate -45 1 1 1 Color 1 .2 .2 ! Cylinder 2 -2 2 270 ! AttributeEnd ! AttributeBegin ! Translate 0 4 0 ! Color .2 .8 .2 ! Cone 3 3 360 AttributeEnd AttributeBegin |
From: <ega...@us...> - 2003-05-10 20:37:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv4093/src/org/jrman/parser Modified Files: Parser.java Log Message: Added Cone and Disk primitives. Normal vectors are incorrect. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Parser.java 7 May 2003 07:08:35 -0000 1.35 --- Parser.java 10 May 2003 20:37:51 -0000 1.36 *************** *** 56,60 **** --- 56,62 ---- import org.jrman.options.Quantizer; import org.jrman.parser.keywords.KeywordParser; + import org.jrman.primitive.Cone; import org.jrman.primitive.Cylinder; + import org.jrman.primitive.Disk; import org.jrman.primitive.Sphere; import org.jrman.primitive.Torus; *************** *** 706,709 **** --- 708,734 ---- new Cylinder(radius, zmin, zmax, 0f, thetaMax, parameters, getAttributes())); } + + public void addCone( + float height, + float radius, + float thetaMax, + Map parameters) { + if (inAreaLightSource) + return; + thetaMax = (float) Math.toRadians(thetaMax); + renderer.addPrimitive( + new Cone(radius, 0f, height, 0f, thetaMax, height, parameters, getAttributes())); + } + public void addDisk( + float height, + float radius, + float thetaMax, + Map parameters) { + if (inAreaLightSource) + return; + thetaMax = (float) Math.toRadians(thetaMax); + renderer.addPrimitive( + new Disk(radius, height, 0f, thetaMax, parameters, getAttributes())); + } } |
From: <ega...@us...> - 2003-05-10 20:37:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1:/tmp/cvs-serv4093/src/org/jrman/parser/keywords Modified Files: KeywordCone.java KeywordDisk.java Log Message: Added Cone and Disk primitives. Normal vectors are incorrect. Index: KeywordCone.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordCone.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordCone.java 7 Apr 2003 08:24:22 -0000 1.2 --- KeywordCone.java 10 May 2003 20:37:51 -0000 1.3 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parser.keywords; + import java.util.Map; + import org.jrman.parser.Tokenizer; *************** *** 35,50 **** // Expect height match(st, TK_NUMBER); ! // Expect radius match(st, TK_NUMBER); ! // Expect theta max match(st, TK_NUMBER); ! if (array) match(st, TK_RBRACE); // Expect parameter list ! parseParameterList(st); } --- 37,53 ---- // Expect height match(st, TK_NUMBER); ! float height = (float) st.nval; // Expect radius match(st, TK_NUMBER); ! float radius = (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.addCone(height,radius,thetaMax,parameters); } Index: KeywordDisk.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordDisk.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** KeywordDisk.java 7 Apr 2003 08:24:22 -0000 1.2 --- KeywordDisk.java 10 May 2003 20:37:51 -0000 1.3 *************** *** 20,23 **** --- 20,25 ---- package org.jrman.parser.keywords; + import java.util.Map; + import org.jrman.parser.Tokenizer; *************** *** 35,44 **** --- 37,49 ---- // Expect height match(st, TK_NUMBER); + float height = (float) st.nval; // Expect radius match(st, TK_NUMBER); + float radius = (float) st.nval; // Expect theta max match(st, TK_NUMBER); + float thetaMax = (float) st.nval; if (array) *************** *** 46,50 **** // Expect parameter list ! parseParameterList(st); } --- 51,56 ---- // Expect parameter list ! Map parameters = parseParameterList(st); ! parser.addDisk(height,radius,thetaMax,parameters); } |
From: <ma...@us...> - 2003-05-10 07:41:16
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1:/tmp/cvs-serv18678/src/org/jrman/primitive Modified Files: Primitive.java Cylinder.java Torus.java Sphere.java Log Message: Undid small unnecesary changes. Added more displayed statistics. Index: Primitive.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Primitive.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Primitive.java 10 May 2003 03:57:29 -0000 1.9 --- Primitive.java 10 May 2003 07:41:11 -0000 1.10 *************** *** 23,28 **** import org.jrman.attributes.Attributes; import org.jrman.geom.Bounds2f; - import org.jrman.geom.Bounds3f; import org.jrman.render.ShaderVariables; --- 23,28 ---- import org.jrman.attributes.Attributes; + import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds2f; import org.jrman.render.ShaderVariables; *************** *** 46,50 **** } ! public abstract Bounds3f getBoundingVolume(); public abstract Primitive[] split(); --- 46,50 ---- } ! public abstract BoundingVolume getBoundingVolume(); public abstract Primitive[] split(); Index: Cylinder.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Cylinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Cylinder.java 10 May 2003 03:57:29 -0000 1.2 --- Cylinder.java 10 May 2003 07:41:12 -0000 1.3 *************** *** 26,29 **** --- 26,30 ---- import org.jrman.attributes.Attributes; + import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds3f; import org.jrman.grid.Grid; *************** *** 60,64 **** } ! public Bounds3f getBoundingVolume() { float cosThetaMin = (float) Math.cos(thetaMin); float sinThetaMin = (float) Math.sin(thetaMin); --- 61,65 ---- } ! public BoundingVolume getBoundingVolume() { float cosThetaMin = (float) Math.cos(thetaMin); float sinThetaMin = (float) Math.sin(thetaMin); Index: Torus.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Torus.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Torus.java 10 May 2003 03:57:29 -0000 1.3 --- Torus.java 10 May 2003 07:41:12 -0000 1.4 *************** *** 26,29 **** --- 26,30 ---- import org.jrman.attributes.Attributes; + import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds3f; import org.jrman.grid.Grid; *************** *** 64,68 **** } ! public Bounds3f getBoundingVolume() { float zMin; float zMax; --- 65,69 ---- } ! public BoundingVolume getBoundingVolume() { float zMin; float zMax; Index: Sphere.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/Sphere.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Sphere.java 10 May 2003 03:57:29 -0000 1.16 --- Sphere.java 10 May 2003 07:41:12 -0000 1.17 *************** *** 25,28 **** --- 25,29 ---- import org.jrman.attributes.Attributes; + import org.jrman.geom.BoundingVolume; import org.jrman.geom.Bounds3f; import org.jrman.grid.Grid; *************** *** 67,71 **** } ! public Bounds3f getBoundingVolume() { float zMin = (float) Math.sin(phiMin) * radius; float zMax = (float) Math.sin(phiMax) * radius; --- 68,72 ---- } ! public BoundingVolume getBoundingVolume() { float zMin = (float) Math.sin(phiMin) * radius; float zMax = (float) Math.sin(phiMax) * radius; |
From: <ma...@us...> - 2003-05-10 07:41:16
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1:/tmp/cvs-serv18678/src/org/jrman/geom Modified Files: BoundingVolume.java Bounds3f.java ConvexHull3f.java Log Message: Undid small unnecesary changes. Added more displayed statistics. Index: BoundingVolume.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/BoundingVolume.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BoundingVolume.java 10 May 2003 03:57:28 -0000 1.4 --- BoundingVolume.java 10 May 2003 07:41:12 -0000 1.5 *************** *** 22,26 **** public interface BoundingVolume { ! BoundingVolume transform3f(Transform transform); Plane.Side whichSideOf(Plane plane); --- 22,26 ---- public interface BoundingVolume { ! BoundingVolume transform(Transform transform); Plane.Side whichSideOf(Plane plane); Index: Bounds3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/Bounds3f.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Bounds3f.java 10 May 2003 03:57:28 -0000 1.9 --- Bounds3f.java 10 May 2003 07:41:12 -0000 1.10 *************** *** 113,117 **** } ! public BoundingVolume transform3f(Transform transform) { /* MutableBounds3f mb = new MutableBounds3f(); --- 113,117 ---- } ! public BoundingVolume transform(Transform transform) { /* MutableBounds3f mb = new MutableBounds3f(); *************** *** 151,155 **** c.addPoint(maxX, maxY, minZ); c.addPoint(maxX, maxY, maxZ); ! return c.transform3f(transform); } --- 151,155 ---- c.addPoint(maxX, maxY, minZ); c.addPoint(maxX, maxY, maxZ); ! return c.transform(transform); } Index: ConvexHull3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/ConvexHull3f.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ConvexHull3f.java 10 May 2003 03:57:28 -0000 1.9 --- ConvexHull3f.java 10 May 2003 07:41:12 -0000 1.10 *************** *** 56,60 **** } ! public BoundingVolume transform3f(Transform transform) { ConvexHull3f result = new ConvexHull3f(); Point3f tmp = new Point3f(); --- 56,60 ---- } ! public BoundingVolume transform(Transform transform) { ConvexHull3f result = new ConvexHull3f(); Point3f tmp = new Point3f(); |
From: <ma...@us...> - 2003-05-10 07:41:16
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv18678/src/org/jrman/render Modified Files: RendererHidden.java Log Message: Undid small unnecesary changes. Added more displayed statistics. Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RendererHidden.java 10 May 2003 03:57:29 -0000 1.15 --- RendererHidden.java 10 May 2003 07:41:12 -0000 1.16 *************** *** 71,75 **** private int bucketHeight; ! private int invisibleCount; public void init(Frame frame, World world) { --- 71,77 ---- private int bucketHeight; ! private int primitivePatchCount; ! ! private int invisiblePatchCount; public void init(Frame frame, World world) { *************** *** 111,115 **** boolean check) { BoundingVolume bv = primitive.getBoundingVolume(); ! bv = bv.transform3f(objectToCamera); if (clippingVolume.whereIs(bv) == Plane.Side.OUTSIDE) return true; --- 113,117 ---- boolean check) { BoundingVolume bv = primitive.getBoundingVolume(); ! bv = bv.transform(objectToCamera); if (clippingVolume.whereIs(bv) == Plane.Side.OUTSIDE) return true; *************** *** 140,144 **** int row, boolean check) { ! bv = bv.transform3f(cameraToRaster); primitive.setDistance(bv.getMinZ()); Bounds2f bounds = bv.toBounds2f(); --- 142,146 ---- int row, boolean check) { ! bv = bv.transform(cameraToRaster); primitive.setDistance(bv.getMinZ()); Bounds2f bounds = bv.toBounds2f(); *************** *** 231,234 **** --- 233,237 ---- sampler.init(samplerX, samplerY); while (bucket.hasMorePrimitives()) { + primitivePatchCount++; Primitive p = bucket.getNextPrimitive(); if (isPrimitiveVisible(p, sampler)) { *************** *** 250,255 **** internalAddPrimitive(sub[i], column, row, true); } ! } else placeInNextBucket(p, column, row); } sampler.sampleBucket(bucket); --- 253,260 ---- internalAddPrimitive(sub[i], column, row, true); } ! } else { placeInNextBucket(p, column, row); + invisiblePatchCount++; + } } sampler.sampleBucket(bucket); *************** *** 271,274 **** --- 276,284 ---- long end = System.currentTimeMillis(); float time = (end - start) / 1000f; + System.out.println("Total patches: " + primitivePatchCount); + System.out.println("Patches/second: " + primitivePatchCount / time); + System.out.println("Invisible patches: " + invisiblePatchCount); + System.out.println( + "Patches culled: " + invisiblePatchCount * 100f / primitivePatchCount + "%"); System.out.println( "gridCount = " *************** *** 279,283 **** + gridCount / time + "grids/second"); - System.out.println("Invisibles: " + invisibleCount); } --- 289,292 ---- *************** *** 310,314 **** } } - invisibleCount++; return false; } --- 319,322 ---- |