From: <ma...@us...> - 2003-05-22 07:36:29
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1:/tmp/cvs-serv23650/src/org/jrman/parser Modified Files: Parser.java Log Message: Started work on bicubic patches. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Parser.java 22 May 2003 04:50:14 -0000 1.46 --- Parser.java 22 May 2003 07:36:26 -0000 1.47 *************** *** 57,60 **** --- 57,61 ---- import org.jrman.options.Quantizer; import org.jrman.parser.keywords.KeywordParser; + import org.jrman.primitive.BicubicPatch; import org.jrman.primitive.BilinearPatch; import org.jrman.primitive.Cone; *************** *** 889,950 **** } ! public void addPoints(final Map parameters) { ! if (inAreaLightSource) ! return; ! Parameter pParam = (Parameter) parameters.get("P"); ! parameters.remove("P"); ! Parameter widthParam = (Parameter) parameters.get("width"); ! parameters.remove("width"); ! Parameter constantWidthParam = (Parameter) parameters.get("constantwidth"); ! parameters.remove("constantwidth"); ! Parameter csParam = (Parameter) parameters.get("Cs"); ! parameters.remove("Cs"); ! Parameter osParam = (Parameter) parameters.get("Os"); ! parameters.remove("Os"); ! Point3f[][] points = (Point3f[][]) pParam.getData(); ! float[][] widths; ! if (widthParam != null) ! widths = (float[][]) widthParam.getData(); ! else ! widths = (float[][]) constantWidthParam.getData(); ! Color3f[][] Cs = null; ! Declaration CsDecl = null; ! if (csParam != null) { ! Cs = (Color3f[][]) csParam.getData(); ! CsDecl = csParam.getDeclaration(); ! } ! Color3f[][] Os = null; ! Declaration OsDecl = null; ! if (osParam != null) { ! Os = (Color3f[][]) osParam.getData(); ! OsDecl = osParam.getDeclaration(); ! } ! for (int i = 0; i < points.length; i++) { ! final Point3f p = points[i][0]; ! float tw; ! if (widthParam != null) ! tw = widths[i][0]; ! else ! tw = widths[0][0]; ! final float w = tw; ! Map tparam; ! if (Cs == null && Os == null) ! tparam = parameters; ! else { ! tparam = new HashMap(parameters); ! if (Cs != null) { ! Color3f[][] cs = new Color3f[1][]; ! cs[0] = Cs[i]; ! tparam.put("Cs", new Parameter(CsDecl, cs)); ! } ! if (Os != null) { ! Color3f[][] os = new Color3f[1][]; ! os[0] = Os[i]; ! tparam.put("Os", new Parameter(OsDecl, os)); ! } ! } ! final Map param = tparam; if (!inObject) ! renderer.addPrimitive(new Point(w, p.x, p.y, p.z, param, getAttributes())); else { final Transform transform = currentAttributes.getTransform(); --- 890,898 ---- } ! public void addBicubicPatch(final Map parameters) { ! if (inAreaLightSource) ! return; if (!inObject) ! renderer.addPrimitive(new BicubicPatch(parameters, getAttributes())); else { final Transform transform = currentAttributes.getTransform(); *************** *** 952,961 **** .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { public Primitive create(Attributes attributes) { ! return new Point( ! w, ! p.x, ! p.y, ! p.z, ! param, createAttributes(transform, attributes)); } --- 900,905 ---- .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { public Primitive create(Attributes attributes) { ! return new BicubicPatch( ! parameters, createAttributes(transform, attributes)); } *************** *** 963,966 **** } } ! } } --- 907,985 ---- } } ! ! public void addPoints(final Map parameters) { ! if (inAreaLightSource) ! return; ! Parameter pParam = (Parameter) parameters.get("P"); ! parameters.remove("P"); ! Parameter widthParam = (Parameter) parameters.get("width"); ! parameters.remove("width"); ! Parameter constantWidthParam = (Parameter) parameters.get("constantwidth"); ! parameters.remove("constantwidth"); ! Parameter csParam = (Parameter) parameters.get("Cs"); ! parameters.remove("Cs"); ! Parameter osParam = (Parameter) parameters.get("Os"); ! parameters.remove("Os"); ! Point3f[][] points = (Point3f[][]) pParam.getData(); ! float[][] widths; ! if (widthParam != null) ! widths = (float[][]) widthParam.getData(); ! else ! widths = (float[][]) constantWidthParam.getData(); ! Color3f[][] Cs = null; ! Declaration CsDecl = null; ! if (csParam != null) { ! Cs = (Color3f[][]) csParam.getData(); ! CsDecl = csParam.getDeclaration(); ! } ! Color3f[][] Os = null; ! Declaration OsDecl = null; ! if (osParam != null) { ! Os = (Color3f[][]) osParam.getData(); ! OsDecl = osParam.getDeclaration(); ! } ! for (int i = 0; i < points.length; i++) { ! final Point3f p = points[i][0]; ! float tw; ! if (widthParam != null) ! tw = widths[i][0]; ! else ! tw = widths[0][0]; ! final float w = tw; ! Map tparam; ! if (Cs == null && Os == null) ! tparam = parameters; ! else { ! tparam = new HashMap(parameters); ! if (Cs != null) { ! Color3f[][] cs = new Color3f[1][]; ! cs[0] = Cs[i]; ! tparam.put("Cs", new Parameter(CsDecl, cs)); ! } ! if (Os != null) { ! Color3f[][] os = new Color3f[1][]; ! os[0] = Os[i]; ! tparam.put("Os", new Parameter(OsDecl, os)); ! } ! } ! final Map param = tparam; ! if (!inObject) ! renderer.addPrimitive(new Point(w, p.x, p.y, p.z, param, getAttributes())); ! else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! return new Point( ! w, ! p.x, ! p.y, ! p.z, ! param, ! createAttributes(transform, attributes)); ! } ! }); ! } ! } ! } } |