01: /*
02: * $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/utils/vpbehaviors/VPCollisionInterface.java,v 1.1 2005/04/20 21:05:15 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is Java 3D(tm) Fly Through.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dfly.utils.vpbehaviors;
19:
20: import java.util.ArrayList;
21:
22: import javax.media.j3d.BranchGroup;
23: import javax.media.j3d.Transform3D;
24: import javax.media.j3d.Locale;
25: import javax.vecmath.Vector3f;
26:
27: /**
28: * Interface for all collision detection implementations
29: */
30: public interface VPCollisionInterface {
31:
32: /**
33: * Add a BranchGroup to check for collision.
34: * setCapabilites() should be called before the BranchGroup is
35: * added.
36: *
37: * @param bg BranchGroup to add to set of BranchGroups checked for
38: * collision
39: */
40: public void addCollisionBG(BranchGroup bg);
41:
42: /**
43: * Check for collision with all geometry in <code>locale</code>
44: * Ensure the capability bits in each branchGraph are set correctly
45: * by calling setCapabilities()
46: *
47: * @param locale Collision detection will be performed on all geometry in
48: * the locale.
49: *
50: * @see setCapabilities( BranchGroup branchGroup )
51: */
52: public void setCollisionLocale(Locale locale);
53:
54: /**
55: * Set the capabilities in the BranchGroup to allow this collision
56: * detection to work. The branchGroup must not be live or compiled.
57: *
58: * @param branchGroup Root of graph in which all necessary capabilities
59: * will be set
60: */
61: public void setCapabilities(BranchGroup branchGroup);
62:
63: /**
64: * Set the SweptVolume to be used in collision calculations
65: */
66: public void setVPSweptVolume(SweptVolume volume);
67:
68: /**
69: * Get the SweptVolume used in collision calculations
70: */
71: public SweptVolume getVPSweptVolume();
72:
73: /**
74: * Get the number of collision BranchGroups that are checked for
75: * collision
76: */
77: public int getCollisionBGCount();
78:
79: /**
80: * Get the BranchGroup at the specified index that is used for
81: * collision detection
82: */
83: public BranchGroup getCollisionBG(int index);
84:
85: /**
86: * Check for collision when casting the swept volume from currentLocation to currentLocation
87: * modified by the roll, pitch, yaw and velocity
88: *
89: * nextLocation will return the next NON COLLISION location, this will be implementation dependent.
90: *
91: * If collision occurred the data for all the collisions will be returned in
92: * SweptVolumeCollision. If no collision occurred null will be returned.
93: */
94: public SweptVolumeCollision getCollisions(
95: Transform3D currentLocation, Transform3D nextLocation,
96: Vector3f velocity, float roll, float pitch, float yaw);
97:
98: }
|