Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
ClipplaneTool.java
Log Message:
Fixed some issues with clipping planes:
- The ClipPlane are defined by a CoordinateSystem (which can return a plane)
to make some calculations easier
- The ClipPlane now always points away from camera when being defined.
- The corners of the ClipPlane are calculated in local coordinates of the plane
with a margin of 1 (meter) to better distinguish the plane from existing geometry.
Then translated to global coordinates.
- The ClipPlane are moved 0.001 (a millimeter) in the positive direction.
- The edges of the ClipPlane are shown.
- Clipping is turned off when drawing the 2d overlay (space names)
- The modelview matrix is pushed after camera setup, which fixes a weird
OpenGL lighting problem (involving clipplanes and the 2d overlay).
Index: ClipplaneTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ClipplaneTool.java 4 Nov 2005 09:38:55 -0000 1.3
--- ClipplaneTool.java 6 Nov 2005 16:33:44 -0000 1.4
***************
*** 9,13 ****
--- 9,15 ----
import net.sourceforge.bprocessor.gl.GLView;
import net.sourceforge.bprocessor.gl.model.ClippingPlane;
+ import net.sourceforge.bprocessor.model.CoordinateSystem;
import net.sourceforge.bprocessor.model.Surface;
+ import net.sourceforge.bprocessor.model.Vertex;
import java.awt.event.MouseEvent;
***************
*** 39,43 ****
if (e.getButton() == MouseEvent.BUTTON1) {
if (target instanceof Surface) {
! ClippingPlane cp = new ClippingPlane(((Surface)target).plane());
(glv.getView()).addClippingPlane(cp);
}
--- 41,60 ----
if (e.getButton() == MouseEvent.BUTTON1) {
if (target instanceof Surface) {
! Surface surface = (Surface) target;
! CoordinateSystem system = surface.coordinateSystem();
! Vertex n = system.getN();
! Vertex i = system.getI();
! Vertex j = system.getJ();
! Vertex o = system.origin();
! boolean front = glv.getView().facingFront(system);
! if (front) {
! n.scale(-1);
! }
! Vertex v = n.copy();
! v.scale(0.001);
! o = o.add(v);
! system = new CoordinateSystem(i, j, n, o);
!
! ClippingPlane cp = new ClippingPlane(system);
(glv.getView()).addClippingPlane(cp);
}
|