Update of /cvsroot/jrman/drafts/src/org/jrman/primitive
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16144/src/org/jrman/primitive
Modified Files:
PointsPolygons.java
Added Files:
SubdivisionMesh.java
Log Message:
Started working on SubdivisionMeshes.
Started migration to Java 5.
Index: PointsPolygons.java
===================================================================
RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/PointsPolygons.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** PointsPolygons.java 24 Dec 2006 05:25:57 -0000 1.6
--- PointsPolygons.java 26 Feb 2007 15:25:15 -0000 1.7
***************
*** 1,5 ****
/*
! PointsPolygon.java
! Copyright (C) 2004 Gerardo Horvilleur Martinez
This program is free software; you can redistribute it and/or
--- 1,5 ----
/*
! PointsPolygons.java
! Copyright (C) 2004, 2007 Gerardo Horvilleur Martinez
This program is free software; you can redistribute it and/or
--- NEW FILE: SubdivisionMesh.java ---
/*
SubdivisionMesh.java
Copyright (C) 2007 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 javax.vecmath.Point3f;
import org.jrman.attributes.Attributes;
import org.jrman.geom.BoundingVolume;
import org.jrman.geom.ConvexHull3f;
import org.jrman.geom.MutableBounds3f;
import org.jrman.parameters.ParameterList;
import org.jrman.parameters.VaryingScalarTuple3f;
public class SubdivisionMesh extends Primitive {
static Point3f tmpPoint = new Point3f();
int[] nvertices;
int[] vertices;
String[] tags;
int[] nargs;
int[] intargs;
float[] floatargs;
VaryingScalarTuple3f points;
public SubdivisionMesh(String scheme,
int[] nvertices,
int[] vertices,
String[] tags,
int[] nargs,
int[] intargs,
float[] floatargs,
ParameterList parameters,
Attributes attributes) {
if (!scheme.equals("catmull-clark"))
throw new IllegalArgumentException("Subdivison scheme " + scheme +
" not supported");
this.parameters = parameters;
this.attributes = attributes;
this.nvertices = nvertices;
this.vertices = vertices;
this.tags = tags;
this.nargs = nargs;
this.intargs = intargs;
this.floatargs = floatargs;
points = (VaryingScalarTuple3f) parameters.getParameter("P");
parameters.removeParameter("P");
}
public BoundingVolume getBoundingVolume() {
MutableBounds3f mb = new MutableBounds3f();
for (int i = 0, n = points.getCount(); i < n; i++) {
points.getValue(i, tmpPoint);
mb.addPoint(tmpPoint);
}
return mb;
}
public Primitive[] split() {
return null;
}
public boolean isReadyToBeDiced(int gridsize) {
return false;
}
}
|