Added beginnings of project website.
This commit is contained in:
parent
31b20f012e
commit
4ff29c4ddd
27 changed files with 1156 additions and 41 deletions
|
|
@ -1,22 +1,10 @@
|
|||
(ns cc.journeyman.climate-game.core
|
||||
(:require [jme-clj.core :refer [add-to-root box defsimpleapp geo material set* start]])
|
||||
(:import [aaronperkins.planeteg PlanetApp]
|
||||
[com.jme3.math ColorRGBA Vector3f]
|
||||
[com.jme3.app SimpleApplication]
|
||||
[com.jme3.scene Geometry]
|
||||
[com.jme3.material Material]
|
||||
[com.jme3.light DirectionalLight]))
|
||||
"Launcher."
|
||||
(:require [cc.journeyman.climate-game.planet.geometry :refer [init-planet]]
|
||||
[jme-clj.core :refer [add-light-to-root add-to-root box defsimpleapp generate geo get*
|
||||
light load-texture material rotate set* sphere start vec3]])
|
||||
(:import [cc.journeyman.climate_game ClimateGameApp]))
|
||||
|
||||
;; (defn init []
|
||||
;; (let [box (box 1 1 1)
|
||||
;; geom (geo "Box" box)
|
||||
;; mat (material "Common/MatDefs/Misc/Unshaded.j3md")]
|
||||
;; (set* mat :color "Color" ColorRGBA/Blue)
|
||||
;; (set* geom :material mat)
|
||||
;; (add-to-root geom)))
|
||||
|
||||
;; (defsimpleapp app :init init)
|
||||
|
||||
(def app (PlanetApp.))
|
||||
(def app (ClimateGameApp.))
|
||||
|
||||
(start app)
|
||||
18
src/clj/cc/journeyman/climate_game/planet/geometry.clj
Normal file
18
src/clj/cc/journeyman/climate_game/planet/geometry.clj
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
(ns cc.journeyman.climate-game.planet.geometry
|
||||
"Intended to replace java/cc/journeyman/cimate_game/ClimateGameApp.java, but not yet working."
|
||||
(:require [jme-clj.core :refer [add-light-to-root add-to-root box defsimpleapp geo light material set* start vec3]])
|
||||
(:import [aaronperkins.planeteg PlanetMeshGen]))
|
||||
|
||||
(defn init-planet
|
||||
"Initialise an app with a planet in the centre of the screen. Not yet working."
|
||||
[]
|
||||
(let [generator (PlanetMeshGen.)]
|
||||
(.generateHeightmap generator)
|
||||
(-> (light :directional)
|
||||
(set* :direction (vec3 -0.1 -0.7 -1.0))
|
||||
(add-light-to-root))
|
||||
(->
|
||||
(set* (geo "Planet" (.generateMesh generator))
|
||||
:material
|
||||
(material "Common/MatDefs/Light/Lighting.j3md"))
|
||||
add-to-root)))
|
||||
52
src/java/cc/journeyman/climate_game/ClimateGameApp.java
Normal file
52
src/java/cc/journeyman/climate_game/ClimateGameApp.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package cc.journeyman.climate_game;
|
||||
|
||||
import aaronperkins.planeteg.PlanetMeshGen;
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.light.DirectionalLight;
|
||||
|
||||
/**
|
||||
* Replacement for Aaron Perkins PlanetApp, doing stuff I need/want. Intended
|
||||
* to be replaced by the same functionality in Clojure, but I haven't yet made
|
||||
* that work.
|
||||
*/
|
||||
public class ClimateGameApp extends SimpleApplication {
|
||||
Geometry planet;
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
|
||||
// Setup camera
|
||||
this.getCamera().setLocation(new Vector3f(0,0,1000));
|
||||
this.getFlyByCamera().setMoveSpeed(200.0f);
|
||||
|
||||
// Add sun
|
||||
DirectionalLight sun = new DirectionalLight();
|
||||
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
|
||||
rootNode.addLight(sun);
|
||||
|
||||
// Add planet
|
||||
planet = new Geometry("Planet");
|
||||
|
||||
PlanetMeshGen planetMeshGen = new PlanetMeshGen();
|
||||
planetMeshGen.generateHeightmap();
|
||||
planet.setMesh(planetMeshGen.generateMesh());
|
||||
|
||||
Material mat = new Material(this.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
|
||||
mat.setBoolean("UseVertexColor", true);
|
||||
// Uncommet for wireframe
|
||||
//mat.getAdditionalRenderState().setWireframe(true);
|
||||
|
||||
planet.setMaterial(mat);
|
||||
|
||||
rootNode.attachChild(planet);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
planet.rotate(0, 0.005f*tpf, 0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue