aboutsummaryrefslogtreecommitdiff
path: root/engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java
diff options
context:
space:
mode:
authorScott Barta <sbarta@google.com>2012-03-01 12:35:35 -0800
committerScott Barta <sbarta@google.com>2012-03-01 12:40:08 -0800
commit59b2e6871c65f58fdad78cd7229c292f6a177578 (patch)
tree2d4e7bfc05b93f40b34675d77e403dd1c25efafd /engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java
parentf9b30489e75ac1eabc365064959804e99534f7ab (diff)
downloadjmonkeyengine-59b2e6871c65f58fdad78cd7229c292f6a177578.tar.gz
Adds the jMonkeyEngine library to the build.
Adds the jMonkeyEngine open source 3D game engine to the build. This is built as a static library and is only used by the Finsky client. Change-Id: I06a3f054df7b8a67757267d884854f70c5a16ca0
Diffstat (limited to 'engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java')
-rw-r--r--engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java b/engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java
new file mode 100644
index 0000000..3e949bd
--- /dev/null
+++ b/engine/src/bullet/com/jme3/bullet/collision/shapes/PlaneCollisionShape.java
@@ -0,0 +1,66 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.jme3.bullet.collision.shapes;
+
+import com.jme3.export.InputCapsule;
+import com.jme3.export.JmeExporter;
+import com.jme3.export.JmeImporter;
+import com.jme3.export.OutputCapsule;
+import com.jme3.math.Plane;
+import com.jme3.math.Vector3f;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class PlaneCollisionShape extends CollisionShape{
+ private Plane plane;
+
+ public PlaneCollisionShape() {
+ }
+
+ /**
+ * Creates a plane Collision shape
+ * @param plane the plane that defines the shape
+ */
+ public PlaneCollisionShape(Plane plane) {
+ this.plane = plane;
+ createShape();
+ }
+
+ public final Plane getPlane() {
+ return plane;
+ }
+
+ public void write(JmeExporter ex) throws IOException {
+ super.write(ex);
+ OutputCapsule capsule = ex.getCapsule(this);
+ capsule.write(plane, "collisionPlane", new Plane());
+ }
+
+ public void read(JmeImporter im) throws IOException {
+ super.read(im);
+ InputCapsule capsule = im.getCapsule(this);
+ plane = (Plane) capsule.readSavable("collisionPlane", new Plane());
+ createShape();
+ }
+
+ protected void createShape() {
+ objectId = createShape(plane.getNormal(), plane.getConstant());
+ Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Created Shape {0}", Long.toHexString(objectId));
+// objectId = new StaticPlaneShape(Converter.convert(plane.getNormal()),plane.getConstant());
+// objectId.setLocalScaling(Converter.convert(getScale()));
+// objectId.setMargin(margin);
+ setScale(scale);
+ setMargin(margin);
+ }
+
+ private native long createShape(Vector3f normal, float constant);
+
+}