aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-effects/src/test
diff options
context:
space:
mode:
authorneothemachine <[email protected]>2012-12-05 17:03:16 +0100
committerneothemachine <[email protected]>2012-12-05 17:03:16 +0100
commit9dd02f103042cb8a196f8a3ed2278da443e345bf (patch)
tree422449f0c62ff9518316ce5d4219bb2b12f0ed15 /ardor3d-effects/src/test
parent2b26b12fd794de0f03a064a10024a3d9f5583756 (diff)
move all files from trunk to root folder
Diffstat (limited to 'ardor3d-effects/src/test')
-rw-r--r--ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java19
-rw-r--r--ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java59
2 files changed, 78 insertions, 0 deletions
diff --git a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java
new file mode 100644
index 0000000..70dfa5e
--- /dev/null
+++ b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/MockPSSMCamera.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * Ardor3D is free software: you can redistribute it and/or modify it
+ * under the terms of its license which may be found in the accompanying
+ * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
+ */
+
+package com.ardor3d.extension.shadow.map;
+
+import com.ardor3d.math.Vector3;
+
+public class MockPSSMCamera extends PSSMCamera {
+ public Vector3 getExtents() {
+ return _extents;
+ }
+}
diff --git a/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java
new file mode 100644
index 0000000..fb8bdc0
--- /dev/null
+++ b/ardor3d-effects/src/test/java/com/ardor3d/extension/shadow/map/TestPSSMCamera.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * Ardor3D is free software: you can redistribute it and/or modify it
+ * under the terms of its license which may be found in the accompanying
+ * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
+ */
+
+package com.ardor3d.extension.shadow.map;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+import com.ardor3d.bounding.BoundingBox;
+import com.ardor3d.bounding.BoundingSphere;
+import com.ardor3d.math.Vector3;
+
+public class TestPSSMCamera {
+ @Test
+ public void testBoxSphereCameraPack() {
+ MockPSSMCamera camera = new MockPSSMCamera();
+ camera.setLocation(0, 0, -10);
+ camera.setFrustumPerspective(50, 1, 1, 100);
+
+ final BoundingBox boundingBox = new BoundingBox();
+ boundingBox.setCenter(new Vector3(0, 0, 10));
+ boundingBox.setXExtent(2);
+ boundingBox.setYExtent(2);
+ boundingBox.setZExtent(2);
+
+ camera.pack(boundingBox);
+
+ final double boxNear1 = camera.getFrustumNear();
+ final double boxFar1 = camera.getFrustumFar();
+
+ Assert.assertEquals(new Vector3(2, 2, 2), camera.getExtents());
+
+ camera = new MockPSSMCamera();
+ camera.setLocation(0, 0, -10);
+ camera.setFrustumPerspective(50, 1, 1, 100);
+
+ final BoundingSphere boundingSphere = new BoundingSphere();
+ boundingSphere.setCenter(new Vector3(0, 0, 10));
+ boundingSphere.setRadius(2);
+
+ camera.pack(boundingSphere);
+
+ final double boxNear2 = camera.getFrustumNear();
+ final double boxFar2 = camera.getFrustumFar();
+
+ Assert.assertEquals(new Vector3(2, 2, 2), camera.getExtents());
+
+ Assert.assertEquals(boxNear1, boxNear2);
+ Assert.assertEquals(boxFar1, boxFar2);
+ }
+}