Permalink
Browse files

added slick-util and started using apache commons math

  • Loading branch information...
1 parent 303efdc commit 2ae0195d6f3ea8c596652eefe87339b7e437c49e @krka krka committed Jan 19, 2012
View
76 fear.iml
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
- <excludeFolder url="file://$MODULE_DIR$/target/classes" />
- <excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
- <excludeFolder url="file://$MODULE_DIR$/target/natives" />
- <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
- <orderEntry type="library" name="Maven: com.google.guava:guava:11.0" level="project" />
- <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: se.mockachino:mockachino:0.6.0" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: com.googlecode.gentyref:gentyref:1.1.0" level="project" />
- <orderEntry type="library" scope="TEST" name="Maven: asm:asm:3.2" level="project" />
- <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl:2.8.2" level="project" />
- <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-windows:2.8.2" level="project" />
- <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-linux:2.8.2" level="project" />
- <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-osx:2.8.2" level="project" />
- <orderEntry type="library" name="Maven: net.java.jinput:jinput:2.0.5" level="project" />
- <orderEntry type="library" name="Maven: net.java.jutils:jutils:1.0.0" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-linux:2.0.5" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-windows:2.0.5" level="project" />
- <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-osx:2.0.5" level="project" />
- <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl_util:2.8.2" level="project" />
- </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
+ <excludeFolder url="file://$MODULE_DIR$/target/classes" />
+ <excludeFolder url="file://$MODULE_DIR$/target/natives" />
+ <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
+ <orderEntry type="library" name="Maven: com.google.guava:guava:11.0" level="project" />
+ <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: se.mockachino:mockachino:0.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.googlecode.gentyref:gentyref:1.1.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: asm:asm:3.2" level="project" />
+ <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl:2.8.2" level="project" />
+ <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-windows:2.8.2" level="project" />
+ <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-linux:2.8.2" level="project" />
+ <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-osx:2.8.2" level="project" />
+ <orderEntry type="library" name="Maven: net.java.jinput:jinput:2.0.5" level="project" />
+ <orderEntry type="library" name="Maven: net.java.jutils:jutils:1.0.0" level="project" />
+ <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-linux:2.0.5" level="project" />
+ <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-windows:2.0.5" level="project" />
+ <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-osx:2.0.5" level="project" />
+ <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl_util:2.8.2" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.commons:commons-math:2.0" level="project" />
+ </component>
+</module>
+
View
BIN lib/slick-util.jar
Binary file not shown.
View
8 mvnhack.txt
@@ -1,8 +0,0 @@
-mvn install:install-file
- -Dfile=<path-to-file>
- -DgroupId=<group-id>
- -DartifactId=<artifact-id>
- -Dversion=<version>
- -Dpackaging=<packaging>
- -DgeneratePom=true
-
View
17 mvninstall.sh
@@ -0,0 +1,17 @@
+function install {
+ FILE=$1
+ ARTIFACTID=$2
+ VERSION=$3
+
+ mvn install:install-file \
+ -Dfile=$FILE \
+ -DgroupId=local \
+ -DartifactId=$ARTIFACTID \
+ -Dversion=$VERSION \
+ -Dpackaging=jar \
+ -DgeneratePom=true
+
+}
+
+install lib/slick-util.jar slick-util 0.0.1
+
View
5 pom.xml
@@ -141,5 +141,10 @@
<artifactId>commons-math</artifactId>
<version>2.0</version>
</dependency>
+ <dependency>
+ <groupId>local</groupId>
+ <artifactId>slick-util</artifactId>
+ <version>0.0.1</version>
+ </dependency>
</dependencies>
</project>
View
9 src/main/java/se/fearlessgames/fear/FearCamera.java
@@ -0,0 +1,9 @@
+package se.fearlessgames.fear;
+
+import org.apache.commons.math.geometry.Rotation;
+import org.apache.commons.math.geometry.Vector3D;
+
+public class FearCamera {
+ private Vector3D position = Vector3D.ZERO;
+ private Rotation rotation = Rotation.IDENTITY;
+}
View
21 src/main/java/se/fearlessgames/fear/FearMesh.java
@@ -0,0 +1,21 @@
+package se.fearlessgames.fear;
+
+import org.apache.commons.math.geometry.Rotation;
+import org.apache.commons.math.geometry.Vector3D;
+
+public class FearMesh {
+ private Vector3D position = Vector3D.ZERO;
+ private Rotation rotation = Rotation.IDENTITY;
+
+ public boolean isOpaque() {
+ return true;
+ }
+
+ public Vector3D getPosition() {
+ return position;
+ }
+
+ public Rotation getRotation() {
+ return rotation;
+ }
+}
View
49 src/main/java/se/fearlessgames/fear/FearNode.java
@@ -0,0 +1,49 @@
+package se.fearlessgames.fear;
+
+import org.apache.commons.math.geometry.Rotation;
+import org.apache.commons.math.geometry.Vector3D;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FearNode {
+ private final List<FearNode> childNodes;
+ private final List<FearMesh> meshes;
+ private boolean visible = true;
+
+ private Vector3D position = Vector3D.ZERO;
+ private Rotation rotation = Rotation.IDENTITY;
+
+ public FearNode() {
+ this(new ArrayList<FearMesh>());
+ }
+
+ public FearNode(List<FearMesh> meshes) {
+ this.meshes = meshes;
+ this.childNodes = new ArrayList<FearNode>();
+ }
+
+ public void addChild(FearNode node) {
+ childNodes.add(node);
+ }
+
+ public List<FearNode> getChildNodes() {
+ return childNodes;
+ }
+
+ public List<FearMesh> getMeshes() {
+ return meshes;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public Vector3D getPosition() {
+ return position;
+ }
+
+ public Rotation getRotation() {
+ return rotation;
+ }
+}
View
53 src/main/java/se/fearlessgames/fear/FearScene.java
@@ -1,6 +1,21 @@
package se.fearlessgames.fear;
+import org.apache.commons.math.geometry.Rotation;
+import org.apache.commons.math.geometry.Vector3D;
+
+import java.util.List;
+
public class FearScene {
+ private final FearNode root;
+
+ public FearScene(FearNode root) {
+ this.root = root;
+ }
+
+ public FearNode getRoot() {
+ return root;
+ }
+
public void render(FearOutput output) {
clear(output);
renderSkybox(output);
@@ -12,11 +27,47 @@ private void renderTransparentObjects(FearOutput output) {
}
private void renderOpaqueObjects(FearOutput output) {
+ render(output, root);
}
- private void renderSkybox(FearOutput output) {
+ private void render(FearOutput output, FearNode node) {
+ if (!node.isVisible()) {
+ return;
+ }
+ Vector3D position = node.getPosition();
+ Rotation rotation = node.getRotation();
+
+ applyTransform(position, rotation);
+ List<FearMesh> meshes = node.getMeshes();
+ for (FearMesh mesh : meshes) {
+ renderMesh(mesh);
+ }
+ for (FearNode child : node.getChildNodes()) {
+ render(output, child);
+ }
+ reverseTransform(position, rotation);
+ }
+
+ private void renderMesh(FearMesh mesh) {
+ Vector3D position = mesh.getPosition();
+ Rotation rotation = mesh.getRotation();
+ applyTransform(position, rotation);
+ // TODO: do GL render stuff here
+ reverseTransform(position, rotation);
+ }
+
+ private void reverseTransform(Vector3D position, Rotation rotation) {
+ // TODO: Do GL stuff here
+ }
+
+ private void applyTransform(Vector3D position, Rotation rotation) {
+ // TODO: Do GL stuff here
+ }
+
+ private void renderSkybox(FearOutput output) {
}
private void clear(FearOutput output) {
+ // TODO: glClear here
}
}
View
8 src/test/java/se/fearlessgames/fear/display/SimpleVisualTest.java
@@ -2,17 +2,21 @@
import org.junit.Test;
import org.lwjgl.input.Keyboard;
+import se.fearlessgames.fear.FearNode;
import se.fearlessgames.fear.FearOutput;
import se.fearlessgames.fear.FearScene;
import se.fearlessgames.fear.display.FearDisplay;
public class SimpleVisualTest {
- @Test
+ @Test
+ public void testDummy() {
+ }
+
public void testSimple() throws Exception {
DisplaySupplier supplier = new DisplaySupplier();
supplier.setDimensions(100, 100);
FearDisplay output = supplier.showDisplay();
- FearScene scene = new FearScene();
+ FearScene scene = new FearScene(new FearNode());
while (true) {
if (hasHitEscape() || output.isCloseRequested()) {
break;

0 comments on commit 2ae0195

Please sign in to comment.