Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added slick-util and started using apache commons math

  • Loading branch information...
commit 2ae0195d6f3ea8c596652eefe87339b7e437c49e 1 parent 303efdc
krka krka authored
76 fear.iml
... ... @@ -1,38 +1,38 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3   - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
4   - <output url="file://$MODULE_DIR$/target/classes" />
5   - <output-test url="file://$MODULE_DIR$/target/test-classes" />
6   - <content url="file://$MODULE_DIR$">
7   - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8   - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9   - <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
10   - <excludeFolder url="file://$MODULE_DIR$/target/classes" />
11   - <excludeFolder url="file://$MODULE_DIR$/target/maven-archiver" />
12   - <excludeFolder url="file://$MODULE_DIR$/target/natives" />
13   - <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
14   - </content>
15   - <orderEntry type="inheritedJdk" />
16   - <orderEntry type="sourceFolder" forTests="false" />
17   - <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
18   - <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
19   - <orderEntry type="library" name="Maven: com.google.guava:guava:11.0" level="project" />
20   - <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
21   - <orderEntry type="library" scope="TEST" name="Maven: se.mockachino:mockachino:0.6.0" level="project" />
22   - <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
23   - <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
24   - <orderEntry type="library" scope="TEST" name="Maven: com.googlecode.gentyref:gentyref:1.1.0" level="project" />
25   - <orderEntry type="library" scope="TEST" name="Maven: asm:asm:3.2" level="project" />
26   - <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl:2.8.2" level="project" />
27   - <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-windows:2.8.2" level="project" />
28   - <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-linux:2.8.2" level="project" />
29   - <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-osx:2.8.2" level="project" />
30   - <orderEntry type="library" name="Maven: net.java.jinput:jinput:2.0.5" level="project" />
31   - <orderEntry type="library" name="Maven: net.java.jutils:jutils:1.0.0" level="project" />
32   - <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-linux:2.0.5" level="project" />
33   - <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-windows:2.0.5" level="project" />
34   - <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-osx:2.0.5" level="project" />
35   - <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl_util:2.8.2" level="project" />
36   - </component>
37   -</module>
38   -
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
  3 + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
  4 + <output url="file://$MODULE_DIR$/target/classes" />
  5 + <output-test url="file://$MODULE_DIR$/target/test-classes" />
  6 + <content url="file://$MODULE_DIR$">
  7 + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
  8 + <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
  9 + <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" />
  10 + <excludeFolder url="file://$MODULE_DIR$/target/classes" />
  11 + <excludeFolder url="file://$MODULE_DIR$/target/natives" />
  12 + <excludeFolder url="file://$MODULE_DIR$/target/test-classes" />
  13 + </content>
  14 + <orderEntry type="inheritedJdk" />
  15 + <orderEntry type="sourceFolder" forTests="false" />
  16 + <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
  17 + <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
  18 + <orderEntry type="library" name="Maven: com.google.guava:guava:11.0" level="project" />
  19 + <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
  20 + <orderEntry type="library" scope="TEST" name="Maven: se.mockachino:mockachino:0.6.0" level="project" />
  21 + <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.2" level="project" />
  22 + <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:1.2" level="project" />
  23 + <orderEntry type="library" scope="TEST" name="Maven: com.googlecode.gentyref:gentyref:1.1.0" level="project" />
  24 + <orderEntry type="library" scope="TEST" name="Maven: asm:asm:3.2" level="project" />
  25 + <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl:2.8.2" level="project" />
  26 + <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-windows:2.8.2" level="project" />
  27 + <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-linux:2.8.2" level="project" />
  28 + <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl-platform:natives-osx:2.8.2" level="project" />
  29 + <orderEntry type="library" name="Maven: net.java.jinput:jinput:2.0.5" level="project" />
  30 + <orderEntry type="library" name="Maven: net.java.jutils:jutils:1.0.0" level="project" />
  31 + <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-linux:2.0.5" level="project" />
  32 + <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-windows:2.0.5" level="project" />
  33 + <orderEntry type="library" scope="RUNTIME" name="Maven: net.java.jinput:jinput-platform:natives-osx:2.0.5" level="project" />
  34 + <orderEntry type="library" name="Maven: org.lwjgl.lwjgl:lwjgl_util:2.8.2" level="project" />
  35 + <orderEntry type="library" name="Maven: org.apache.commons:commons-math:2.0" level="project" />
  36 + </component>
  37 +</module>
  38 +
BIN  lib/slick-util.jar
Binary file not shown
8 mvnhack.txt
... ... @@ -1,8 +0,0 @@
1   -mvn install:install-file
2   - -Dfile=<path-to-file>
3   - -DgroupId=<group-id>
4   - -DartifactId=<artifact-id>
5   - -Dversion=<version>
6   - -Dpackaging=<packaging>
7   - -DgeneratePom=true
8   -
17 mvninstall.sh
... ... @@ -0,0 +1,17 @@
  1 +function install {
  2 + FILE=$1
  3 + ARTIFACTID=$2
  4 + VERSION=$3
  5 +
  6 + mvn install:install-file \
  7 + -Dfile=$FILE \
  8 + -DgroupId=local \
  9 + -DartifactId=$ARTIFACTID \
  10 + -Dversion=$VERSION \
  11 + -Dpackaging=jar \
  12 + -DgeneratePom=true
  13 +
  14 +}
  15 +
  16 +install lib/slick-util.jar slick-util 0.0.1
  17 +
5 pom.xml
@@ -141,5 +141,10 @@
141 141 <artifactId>commons-math</artifactId>
142 142 <version>2.0</version>
143 143 </dependency>
  144 + <dependency>
  145 + <groupId>local</groupId>
  146 + <artifactId>slick-util</artifactId>
  147 + <version>0.0.1</version>
  148 + </dependency>
144 149 </dependencies>
145 150 </project>
9 src/main/java/se/fearlessgames/fear/FearCamera.java
... ... @@ -0,0 +1,9 @@
  1 +package se.fearlessgames.fear;
  2 +
  3 +import org.apache.commons.math.geometry.Rotation;
  4 +import org.apache.commons.math.geometry.Vector3D;
  5 +
  6 +public class FearCamera {
  7 + private Vector3D position = Vector3D.ZERO;
  8 + private Rotation rotation = Rotation.IDENTITY;
  9 +}
21 src/main/java/se/fearlessgames/fear/FearMesh.java
... ... @@ -0,0 +1,21 @@
  1 +package se.fearlessgames.fear;
  2 +
  3 +import org.apache.commons.math.geometry.Rotation;
  4 +import org.apache.commons.math.geometry.Vector3D;
  5 +
  6 +public class FearMesh {
  7 + private Vector3D position = Vector3D.ZERO;
  8 + private Rotation rotation = Rotation.IDENTITY;
  9 +
  10 + public boolean isOpaque() {
  11 + return true;
  12 + }
  13 +
  14 + public Vector3D getPosition() {
  15 + return position;
  16 + }
  17 +
  18 + public Rotation getRotation() {
  19 + return rotation;
  20 + }
  21 +}
49 src/main/java/se/fearlessgames/fear/FearNode.java
... ... @@ -0,0 +1,49 @@
  1 +package se.fearlessgames.fear;
  2 +
  3 +import org.apache.commons.math.geometry.Rotation;
  4 +import org.apache.commons.math.geometry.Vector3D;
  5 +
  6 +import java.util.ArrayList;
  7 +import java.util.List;
  8 +
  9 +public class FearNode {
  10 + private final List<FearNode> childNodes;
  11 + private final List<FearMesh> meshes;
  12 + private boolean visible = true;
  13 +
  14 + private Vector3D position = Vector3D.ZERO;
  15 + private Rotation rotation = Rotation.IDENTITY;
  16 +
  17 + public FearNode() {
  18 + this(new ArrayList<FearMesh>());
  19 + }
  20 +
  21 + public FearNode(List<FearMesh> meshes) {
  22 + this.meshes = meshes;
  23 + this.childNodes = new ArrayList<FearNode>();
  24 + }
  25 +
  26 + public void addChild(FearNode node) {
  27 + childNodes.add(node);
  28 + }
  29 +
  30 + public List<FearNode> getChildNodes() {
  31 + return childNodes;
  32 + }
  33 +
  34 + public List<FearMesh> getMeshes() {
  35 + return meshes;
  36 + }
  37 +
  38 + public boolean isVisible() {
  39 + return visible;
  40 + }
  41 +
  42 + public Vector3D getPosition() {
  43 + return position;
  44 + }
  45 +
  46 + public Rotation getRotation() {
  47 + return rotation;
  48 + }
  49 +}
53 src/main/java/se/fearlessgames/fear/FearScene.java
... ... @@ -1,6 +1,21 @@
1 1 package se.fearlessgames.fear;
2 2
  3 +import org.apache.commons.math.geometry.Rotation;
  4 +import org.apache.commons.math.geometry.Vector3D;
  5 +
  6 +import java.util.List;
  7 +
3 8 public class FearScene {
  9 + private final FearNode root;
  10 +
  11 + public FearScene(FearNode root) {
  12 + this.root = root;
  13 + }
  14 +
  15 + public FearNode getRoot() {
  16 + return root;
  17 + }
  18 +
4 19 public void render(FearOutput output) {
5 20 clear(output);
6 21 renderSkybox(output);
@@ -12,11 +27,47 @@ private void renderTransparentObjects(FearOutput output) {
12 27 }
13 28
14 29 private void renderOpaqueObjects(FearOutput output) {
  30 + render(output, root);
15 31 }
16 32
17   - private void renderSkybox(FearOutput output) {
  33 + private void render(FearOutput output, FearNode node) {
  34 + if (!node.isVisible()) {
  35 + return;
  36 + }
  37 + Vector3D position = node.getPosition();
  38 + Rotation rotation = node.getRotation();
  39 +
  40 + applyTransform(position, rotation);
  41 + List<FearMesh> meshes = node.getMeshes();
  42 + for (FearMesh mesh : meshes) {
  43 + renderMesh(mesh);
  44 + }
  45 + for (FearNode child : node.getChildNodes()) {
  46 + render(output, child);
  47 + }
  48 + reverseTransform(position, rotation);
  49 + }
  50 +
  51 + private void renderMesh(FearMesh mesh) {
  52 + Vector3D position = mesh.getPosition();
  53 + Rotation rotation = mesh.getRotation();
  54 + applyTransform(position, rotation);
  55 + // TODO: do GL render stuff here
  56 + reverseTransform(position, rotation);
  57 + }
  58 +
  59 + private void reverseTransform(Vector3D position, Rotation rotation) {
  60 + // TODO: Do GL stuff here
  61 + }
  62 +
  63 + private void applyTransform(Vector3D position, Rotation rotation) {
  64 + // TODO: Do GL stuff here
  65 + }
  66 +
  67 + private void renderSkybox(FearOutput output) {
18 68 }
19 69
20 70 private void clear(FearOutput output) {
  71 + // TODO: glClear here
21 72 }
22 73 }
8 src/test/java/se/fearlessgames/fear/display/SimpleVisualTest.java
@@ -2,17 +2,21 @@
2 2
3 3 import org.junit.Test;
4 4 import org.lwjgl.input.Keyboard;
  5 +import se.fearlessgames.fear.FearNode;
5 6 import se.fearlessgames.fear.FearOutput;
6 7 import se.fearlessgames.fear.FearScene;
7 8 import se.fearlessgames.fear.display.FearDisplay;
8 9
9 10 public class SimpleVisualTest {
10   - @Test
  11 + @Test
  12 + public void testDummy() {
  13 + }
  14 +
11 15 public void testSimple() throws Exception {
12 16 DisplaySupplier supplier = new DisplaySupplier();
13 17 supplier.setDimensions(100, 100);
14 18 FearDisplay output = supplier.showDisplay();
15   - FearScene scene = new FearScene();
  19 + FearScene scene = new FearScene(new FearNode());
16 20 while (true) {
17 21 if (hasHitEscape() || output.isCloseRequested()) {
18 22 break;

0 comments on commit 2ae0195

Please sign in to comment.
Something went wrong with that request. Please try again.