Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16636/src/net/sourceforge/bprocessor/gl/view
Modified Files:
View.java
Log Message:
Added GLObject to the gl/model and made view contain a list of them to draw and intersect
Index: View.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v
retrieving revision 1.165
retrieving revision 1.166
diff -C2 -d -r1.165 -r1.166
*** View.java 28 Nov 2006 16:43:26 -0000 1.165
--- View.java 13 Dec 2006 17:42:10 -0000 1.166
***************
*** 9,12 ****
--- 9,13 ----
import net.sourceforge.bprocessor.gl.GLView;
import net.sourceforge.bprocessor.gl.tool.SpaceTool;
+ import net.sourceforge.bprocessor.gl.model.GlObject;
import net.sourceforge.bprocessor.gl.model.Intersection;
import net.sourceforge.bprocessor.gui.Toolbar;
***************
*** 349,352 ****
--- 350,356 ----
private Set highligts;
+ /** GL objects that are in the model */
+ private Set glObjects3D;
+
/** Max number of clipplanes */
private int maxClippingPlanes;
***************
*** 466,469 ****
--- 470,474 ----
onTopEntities = new HashSet();
colorMap = new HashMap();
+ glObjects3D = new HashSet();
Toolbar tb = Toolbar.getInstance();
***************
*** 968,971 ****
--- 973,984 ----
drawConstructorPlanes();
+ {
+ Iterator it = glObjects3D.iterator();
+ while (it.hasNext()) {
+ GlObject glo = (GlObject) it.next();
+ glo.draw(gld);
+ }
+ }
+
gl.glDisable(GL.GL_DEPTH_TEST);
{
***************
*** 2049,2052 ****
--- 2062,2076 ----
}
}
+ if (selectMode == ALL) {
+ {
+ Iterator it = glObjects3D.iterator();
+ while (it.hasNext()) {
+ GlObject glo = (GlObject) it.next();
+ pushName(gl, glo);
+ glo.draw(gld);
+ popName(gl);
+ }
+ }
+ }
if (selectMode == CONSTRUCTORS || selectMode == ALL) {
{
***************
*** 2626,2629 ****
--- 2650,2660 ----
Vertex intersection = p.intersection(ray);
if (intersection != null) {
+ return new Intersection(intersection, Intersection.PLANE_INTERSECTION, p);
+ }
+ } else if (object instanceof GlObject) {
+ // find out what is intersected
+ GlObject glo = (GlObject) object;
+ Vertex intersection = glo.intersection(ray);
+ if (intersection != null) {
return new Intersection(intersection, Intersection.PLANE_INTERSECTION, xy);
}
***************
*** 3264,3266 ****
--- 3295,3322 ----
tempConstructors.remove(c);
}
+
+ /**
+ * remove a object from the glObjects3D set
+ * @param glo the GLObject to remove
+ * @return if it were a succes
+ */
+ public boolean removeGlObjects3D(GlObject glo) {
+ return glObjects3D.remove(glo);
+ }
+
+ /**
+ * Add a whole list of GLObject
+ * @param glObjects The glObjects to add.
+ */
+ public void addGlObjects3D(Set glObjects) {
+ this.glObjects3D.addAll(glObjects);
+ }
+
+ /**
+ * Add a single GLObject
+ * @param glo The glObject to add.
+ */
+ public void addGlObjects3D(GlObject glo) {
+ this.glObjects3D.add(glo);
+ }
}
|