From: Gerardo H. <ma...@us...> - 2006-12-25 07:51:10
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26654/src/org/jrman/parser Modified Files: Global.java Parser.java Log Message: First implementation of cubic curves. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** Parser.java 24 Dec 2006 05:25:57 -0000 1.108 --- Parser.java 25 Dec 2006 07:50:37 -0000 1.109 *************** *** 76,79 **** --- 76,80 ---- import org.jrman.primitive.BilinearPatch; import org.jrman.primitive.Cone; + import org.jrman.primitive.CubicCurve; import org.jrman.primitive.Cylinder; import org.jrman.primitive.DelayedReadArchive; *************** *** 1291,1296 **** for (int j = 0; j < indexes.length; j++) indexes[j] = ptr++; ! addLinearCurve(periodic, parameters.selectValues(uniformIndex, ! indexes, indexes)); } } --- 1292,1321 ---- for (int j = 0; j < indexes.length; j++) indexes[j] = ptr++; ! addLinearCurve(periodic, ! parameters.selectValues(uniformIndex, ! indexes, indexes)); ! } ! } ! ! private void addCubicCurve(final boolean periodic, ! final ParameterList parameters) { ! if (inAreaLightSource) ! return; ! if (!inObject) { ! CubicCurve curve = new CubicCurve(periodic, parameters, ! getAttributes()); ! renderer.addPrimitive(curve); ! curveCount++; ! } else { ! final Transform transform = currentAttributes.getTransform(); ! currentObjectInstanceList ! .addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() { ! public Primitive create(Attributes attributes) { ! curveCount++; ! return new CubicCurve(periodic, parameters, ! createAttributes(transform, ! attributes)); ! } ! }); } } *************** *** 1298,1302 **** public void addCubicCurves(int[] nVertices, String wrap, ParameterList parameters) { ! } --- 1323,1349 ---- public void addCubicCurves(int[] nVertices, String wrap, ParameterList parameters) { ! boolean periodic = wrap.equals("periodic"); ! int vStep = currentAttributes.getVStep(); ! int[] uniformIndex = new int[1]; ! int varyingPtr = 0; ! int vertexPtr = 0; ! for (int i = 0; i < nVertices.length; i++) { ! uniformIndex[0] = i; ! int nv; ! if (periodic) ! nv = nVertices[i] / vStep; ! else ! nv = (nVertices[i] - 4) / vStep + 2; ! int[] varyingIndexes = new int[nv]; ! for (int j = 0; j < nv; j++) ! varyingIndexes[j] = varyingPtr++; ! int[] vertexIndexes = new int[nVertices[i]]; ! for (int j = 0; j < vertexIndexes.length; j++) ! vertexIndexes[j] = vertexPtr++; ! addCubicCurve(periodic, ! parameters.selectValues(uniformIndex, ! varyingIndexes, ! vertexIndexes)); ! } } Index: Global.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Global.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Global.java 6 Dec 2006 17:17:10 -0000 1.12 --- Global.java 25 Dec 2006 07:50:37 -0000 1.13 *************** *** 1,5 **** /* Global.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or --- 1,5 ---- /* Global.java ! Copyright (C) 2003, 2006 Gerardo Horvilleur Martinez This program is free software; you can redistribute it and/or *************** *** 36,43 **** declarations.put("origin", new Declaration("origin", "integer[2]")); declarations.put("gridsize", new Declaration("gridsize", "integer")); ! declarations.put("bucketsize", new Declaration("bucketsize", "integer[2]")); ! declarations.put("endofframe", new Declaration("endofframe", "integer")); declarations.put("file", new Declaration("file", "integer")); ! declarations.put("highlights", new Declaration("highlights", "integer")); declarations.put("intensity", new Declaration("intensity", "float")); declarations.put("lightcolor", new Declaration("lightcolor", "color")); --- 36,46 ---- declarations.put("origin", new Declaration("origin", "integer[2]")); declarations.put("gridsize", new Declaration("gridsize", "integer")); ! declarations.put("bucketsize", ! new Declaration("bucketsize", "integer[2]")); ! declarations.put("endofframe", ! new Declaration("endofframe", "integer")); declarations.put("file", new Declaration("file", "integer")); ! declarations.put("highlights", ! new Declaration("highlights", "integer")); declarations.put("intensity", new Declaration("intensity", "float")); declarations.put("lightcolor", new Declaration("lightcolor", "color")); *************** *** 45,50 **** declarations.put("to", new Declaration("to", "point")); declarations.put("coneangle", new Declaration("coneangle", "float")); ! declarations.put("conedeltaangle", new Declaration("conedeltaangle", "float")); ! declarations.put("beamdistribution", new Declaration("beamdistribution", "float")); declarations.put("Ka", new Declaration("Ka", "float")); declarations.put("Kd", new Declaration("Kd", "float")); --- 48,55 ---- declarations.put("to", new Declaration("to", "point")); declarations.put("coneangle", new Declaration("coneangle", "float")); ! declarations.put("conedeltaangle", ! new Declaration("conedeltaangle", "float")); ! declarations.put("beamdistribution", ! new Declaration("beamdistribution", "float")); declarations.put("Ka", new Declaration("Ka", "float")); declarations.put("Kd", new Declaration("Kd", "float")); *************** *** 53,65 **** declarations.put("Km", new Declaration("Km", "float")); declarations.put("roughness", new Declaration("roughness", "float")); ! declarations.put("specularcolor", new Declaration("specularcolor", "color")); ! declarations.put("texturename", new Declaration("texturename", "string")); declarations.put("amplitude", new Declaration("float", "float")); declarations.put("distance", new Declaration("distance", "float")); ! declarations.put("mindistance", new Declaration("mindistance", "float")); ! declarations.put("maxdistance", new Declaration("maxdistance", "float")); ! declarations.put("background", new Declaration("background", "color")); ! declarations.put("sphere", new Declaration("sphere", "float")); ! declarations.put("coordinatesystem", new Declaration("coordinatesystem", "string")); declarations.put("name", new Declaration("name", "string")); declarations.put("sense", new Declaration("name", "string")); --- 58,77 ---- declarations.put("Km", new Declaration("Km", "float")); declarations.put("roughness", new Declaration("roughness", "float")); ! declarations.put("specularcolor", ! new Declaration("specularcolor", "color")); ! declarations.put("texturename", ! new Declaration("texturename", "string")); declarations.put("amplitude", new Declaration("float", "float")); declarations.put("distance", new Declaration("distance", "float")); ! declarations.put("mindistance", ! new Declaration("mindistance", "float")); ! declarations.put("maxdistance", ! new Declaration("maxdistance", "float")); ! declarations.put("background", ! new Declaration("background", "color")); ! declarations.put("sphere", ! new Declaration("sphere", "float")); ! declarations.put("coordinatesystem", ! new Declaration("coordinatesystem", "string")); declarations.put("name", new Declaration("name", "string")); declarations.put("sense", new Declaration("name", "string")); *************** *** 73,82 **** declarations.put("t", new Declaration("t", "varying float")); declarations.put("st", new Declaration("st", "varying float[2]")); ! declarations.put("width", new Declaration("width", "vertex float")); ! declarations.put("constantwidth", new Declaration("constantwidth", "uniform float")); ! declarations.put("__category", new Declaration("__category", "uniform string")); ! declarations.put("__nondiffuse", new Declaration("__nondiffuse", "uniform float")); ! declarations.put("__nonspecular", new Declaration("__nonspecular", "uniform float")); ! declarations.put("truedisplacement", new Declaration("truedisplacement", "integer")); } --- 85,99 ---- declarations.put("t", new Declaration("t", "varying float")); declarations.put("st", new Declaration("st", "varying float[2]")); ! declarations.put("width", new Declaration("width", "varying float")); ! declarations.put("constantwidth", ! new Declaration("constantwidth", "uniform float")); ! declarations.put("__category", ! new Declaration("__category", "uniform string")); ! declarations.put("__nondiffuse", ! new Declaration("__nondiffuse", "uniform float")); ! declarations.put("__nonspecular", ! new Declaration("__nonspecular", "uniform float")); ! declarations.put("truedisplacement", ! new Declaration("truedisplacement", "integer")); } |