Skip to content
Browse files

Changing this project to be a client only, so moved client classes to…

… main project, disabled common and server projects, moving their functionality bit by bit to other projects.
  • Loading branch information...
1 parent da5c273 commit d61869fd50121db8218d6a986e7efe3589cfbdbb zzorn committed
Showing with 174 additions and 600 deletions.
  1. 0 {client → }/assets/shaders/GroundTest.frag
  2. 0 {client → }/assets/shaders/GroundTest.j3md
  3. 0 {client → }/assets/shaders/GroundTest.vert
  4. 0 {client → }/assets/shaders/ShaderUtils.glsl
  5. 0 {client → }/assets/shaders/SimpleSky.frag
  6. 0 {client → }/assets/shaders/SimpleSky.j3md
  7. 0 {client → }/assets/shaders/SimpleSky.vert
  8. 0 {client → }/assets/shapes/TestShape.yaml
  9. 0 {client → }/assets/textures/grey_rock-diffuse.png
  10. 0 {client → }/assets/textures/placeholder.png
  11. 0 {client → }/assets/textures/regolith-bump.png
  12. 0 {client → }/assets/textures/regolith-diffuse.png
  13. 0 {client → }/assets/textures/regolith.png
  14. 0 {client → }/assets/textures/regolith.xcf
  15. 0 {client → }/assets/textures/sand.png
  16. 0 {client → }/assets/textures/sand.xcf
  17. 0 {client → }/assets/textures/test_crate.png
  18. 0 {client → }/assets/textures/test_crate_arrow.png
  19. 0 {client → }/assets/textures/twisty_grass-diffuse.png
  20. 0 {client → }/assets/textures/twisty_grass.png
  21. +25 −24 {client → }/build.sbt
  22. +0 −34 client/src/main/scala/org/skycastle/client/shapes/RotationCameraControl.scala
  23. +0 −190 client/src/main/scala/org/skycastle/client/shapes/ShapeViewer.scala
  24. +0 −15 client/src/main/scala/org/skycastle/client/shapes/components/Ball.scala
  25. +0 −42 client/src/main/scala/org/skycastle/client/shapes/components/Cube.scala
  26. +0 −47 client/src/main/scala/org/skycastle/client/shapes/components/Model.scala
  27. +0 −45 client/src/main/scala/org/skycastle/client/shapes/components/ScatterAlong.scala
  28. +0 −13 client/src/main/scala/org/skycastle/client/shapes/components/Tome.scala
  29. +0 −10 client/src/main/scala/org/skycastle/client/shapes/components/Tube.scala
  30. +0 −109 client/src/main/scala/org/skycastle/client/shapes/loader/ModelLoader.scala
  31. 0 {client → }/lib/logging/logback-classic-0.9.28-sources.jar
  32. 0 {client → }/lib/logging/logback-classic-0.9.28.jar
  33. 0 {client → }/lib/logging/logback-core-0.9.28-sources.jar
  34. 0 {client → }/lib/logging/logback-core-0.9.28.jar
  35. 0 {client → }/lib/logging/slf4j-api-1.6.1-sources.jar
  36. 0 {client → }/lib/logging/slf4j-api-1.6.1.jar
  37. +0 −9 project/Build.scala
  38. 0 {client → }/src/main/java/org/skycastle/client/ClampingNoiseModulator.java
  39. 0 {common/src/main/scala → src/main/java}/org/skycastle/utils/SimplexGradientNoise.java
  40. 0 {client → }/src/main/scala/org/skycastle/client/Client.scala
  41. +39 −48 {client → }/src/main/scala/org/skycastle/client/ClipmapTerrainSpike.scala
  42. 0 {client → }/src/main/scala/org/skycastle/client/TerrainSpike.scala
  43. 0 {client → }/src/main/scala/org/skycastle/client/network/ClientNetworking.scala
  44. 0 {client → }/src/main/scala/org/skycastle/client/network/EntityId.scala
  45. 0 {client → }/src/main/scala/org/skycastle/client/network/ServerHandler.scala
  46. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/Message.scala
  47. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/MessageProtocol.scala
  48. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/ProtocolException.scala
  49. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/binary/BinaryProtocol.scala
  50. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/binary/BinarySerializer.scala
  51. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/binary/PackedNumbers.scala
  52. 0 {client → }/src/main/scala/org/skycastle/client/network/protocol/binary/TypeSerializer.scala
  53. 0 {client → }/src/main/scala/org/skycastle/client/sky/Sky.scala
  54. 0 {client → }/src/main/scala/org/skycastle/client/terrain/BlockPos.scala
  55. 0 {client → }/src/main/scala/org/skycastle/client/terrain/FunctionalTerrainBlockSource.scala
  56. +4 −6 {client → }/src/main/scala/org/skycastle/client/terrain/Ground.scala
  57. 0 {client → }/src/main/scala/org/skycastle/client/terrain/GroundCameraControl.scala
  58. +1 −1 {client → }/src/main/scala/org/skycastle/client/terrain/GroundLodStrategy.scala
  59. 0 {client → }/src/main/scala/org/skycastle/client/terrain/GroundSizeSettings.scala
  60. +3 −3 {client → }/src/main/scala/org/skycastle/client/terrain/GroundTree.scala
  61. 0 {client → }/src/main/scala/org/skycastle/client/terrain/SimpleGroundLodStrategy.scala
  62. +2 −2 {client → }/src/main/scala/org/skycastle/client/terrain/TerrainBlock.scala
  63. 0 {client → }/src/main/scala/org/skycastle/client/terrain/TerrainBlockSource.scala
  64. 0 {client → }/src/main/scala/org/skycastle/client/terrain/TestTerrain.scala
  65. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/FoundationLayer.scala
  66. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/Fun2d.scala
  67. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/GroundDef.scala
  68. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/GroundMaterial.scala
  69. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/Layer.scala
  70. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/MaterialLayer.scala
  71. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/MountainFun.scala
  72. +0 −2 {client → }/src/main/scala/org/skycastle/client/terrain/definition/NoiseFun.scala
  73. 0 {client → }/src/main/scala/org/skycastle/client/terrain/definition/TurbulenceFun.scala
  74. 0 {client → }/src/main/scala/org/skycastle/utils/BufferConverters.scala
  75. 0 {common → }/src/main/scala/org/skycastle/utils/LangUtils.scala
  76. +44 −0 src/main/scala/org/skycastle/utils/Logging.scala
  77. 0 {client → }/src/main/scala/org/skycastle/utils/MathUtils.scala
  78. 0 {client → }/src/main/scala/org/skycastle/utils/MeshBuilder.scala
  79. 0 {client → }/src/main/scala/org/skycastle/utils/ParameterChecker.scala
  80. 0 {common → }/src/main/scala/org/skycastle/utils/RandomUtils.scala
  81. 0 {client → }/src/main/scala/org/skycastle/utils/SimplexNoise.scala
  82. +56 −0 src/main/scala/org/skycastle/utils/StringUtils.scala
View
0 client/assets/shaders/GroundTest.frag → assets/shaders/GroundTest.frag
File renamed without changes.
View
0 client/assets/shaders/GroundTest.j3md → assets/shaders/GroundTest.j3md
File renamed without changes.
View
0 client/assets/shaders/GroundTest.vert → assets/shaders/GroundTest.vert
File renamed without changes.
View
0 client/assets/shaders/ShaderUtils.glsl → assets/shaders/ShaderUtils.glsl
File renamed without changes.
View
0 client/assets/shaders/SimpleSky.frag → assets/shaders/SimpleSky.frag
File renamed without changes.
View
0 client/assets/shaders/SimpleSky.j3md → assets/shaders/SimpleSky.j3md
File renamed without changes.
View
0 client/assets/shaders/SimpleSky.vert → assets/shaders/SimpleSky.vert
File renamed without changes.
View
0 client/assets/shapes/TestShape.yaml → assets/shapes/TestShape.yaml
File renamed without changes.
View
0 client/assets/textures/grey_rock-diffuse.png → assets/textures/grey_rock-diffuse.png
File renamed without changes
View
0 client/assets/textures/placeholder.png → assets/textures/placeholder.png
File renamed without changes
View
0 client/assets/textures/regolith-bump.png → assets/textures/regolith-bump.png
File renamed without changes
View
0 client/assets/textures/regolith-diffuse.png → assets/textures/regolith-diffuse.png
File renamed without changes
View
0 client/assets/textures/regolith.png → assets/textures/regolith.png
File renamed without changes
View
0 client/assets/textures/regolith.xcf → assets/textures/regolith.xcf
File renamed without changes.
View
0 client/assets/textures/sand.png → assets/textures/sand.png
File renamed without changes
View
0 client/assets/textures/sand.xcf → assets/textures/sand.xcf
File renamed without changes.
View
0 client/assets/textures/test_crate.png → assets/textures/test_crate.png
File renamed without changes
View
0 client/assets/textures/test_crate_arrow.png → assets/textures/test_crate_arrow.png
File renamed without changes
View
0 .../assets/textures/twisty_grass-diffuse.png → assets/textures/twisty_grass-diffuse.png
File renamed without changes
View
0 client/assets/textures/twisty_grass.png → assets/textures/twisty_grass.png
File renamed without changes
View
49 client/build.sbt → build.sbt
@@ -46,37 +46,38 @@ libraryDependencies ++= Seq(
// JMonkey Engine 3.0 for 3D gfx
libraryDependencies ++= Seq( // Core lib
- "com.jme3" % "jME3-core" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-core" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-effects" % "3.0.0.20120512-SNAPSHOT"
,// Test data (TODO: Large, remove in prod!)
- "com.jme3" % "jmonkeyengine3" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jME3-testdata" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jmonkeyengine3" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-testdata" % "3.0.0.20120512-SNAPSHOT"
,// LWJGL
- "com.jme3" % "jME3-lwjgl" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jME3-lwjgl-natives" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "lwjgl" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-lwjgl" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-lwjgl-natives" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "lwjgl" % "3.0.0.20120512-SNAPSHOT"
,// Bullet physics
- "com.jme3" % "jME3-jbullet" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jbullet" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-jbullet" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jbullet" % "3.0.0.20120512-SNAPSHOT"
,// Feature libs
- "com.jme3" % "jME3-blender" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jME3-desktop" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jME3-plugins" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "jME3-terrain" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-blender" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-desktop" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-plugins" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "jME3-terrain" % "3.0.0.20120512-SNAPSHOT"
,// Ogg audio
- "com.jme3" % "jME3-jogg" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "j-ogg-oggd" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "j-ogg-vorbisd" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-jogg" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "j-ogg-oggd" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "j-ogg-vorbisd" % "3.0.0.20120512-SNAPSHOT"
,// Third party libs
- "com.jme3" % "jinput" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "eventbus" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "stack-alloc" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "vecmath" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "xmlpull-xpp3" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jinput" % "3.0.0.20120512-SNAPSHOT",
+ //"com.jme3" % "eventbus" % "3.0.0.20120512-SNAPSHOT",
+ //"com.jme3" % "stack-alloc" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "vecmath" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "xmlpull-xpp3" % "3.0.0.20120512-SNAPSHOT"
,// Nifty GUI
- "com.jme3" % "jME3-niftygui" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "nifty" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "nifty-default-controls" % "3.0.0.20120209-SNAPSHOT",
- "com.jme3" % "nifty-style-black" % "3.0.0.20120209-SNAPSHOT"
+ "com.jme3" % "jME3-niftygui" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "nifty" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "nifty-default-controls" % "3.0.0.20120512-SNAPSHOT",
+ "com.jme3" % "nifty-style-black" % "3.0.0.20120512-SNAPSHOT"
)
View
34 client/src/main/scala/org/skycastle/client/shapes/RotationCameraControl.scala
@@ -1,34 +0,0 @@
-package org.skycastle.client.shapes
-
-import com.jme3.renderer.Camera
-import com.jme3.input.controls.{KeyTrigger, MouseAxisTrigger}
-import com.jme3.input.{KeyInput, MouseInput, InputManager, ChaseCamera}
-import com.jme3.math.FastMath
-
-/**
- *
- */
-// TODO: Something that doesn't capture the mouse
-class RotationCameraControl(cam: Camera, inputManager: InputManager) extends ChaseCamera(cam, inputManager) {
-
- inputManager.addMapping("ChaseCamMoveLeft", new KeyTrigger(KeyInput.KEY_A), new KeyTrigger(KeyInput.KEY_LEFT))
- inputManager.addMapping("ChaseCamMoveRight", new KeyTrigger(KeyInput.KEY_D), new KeyTrigger(KeyInput.KEY_RIGHT))
- inputManager.addMapping("ChaseCamDown", new KeyTrigger(KeyInput.KEY_S), new KeyTrigger(KeyInput.KEY_DOWN))
- inputManager.addMapping("ChaseCamUp", new KeyTrigger(KeyInput.KEY_W), new KeyTrigger(KeyInput.KEY_UP))
- inputManager.addMapping("ChaseCamZoomIn", new KeyTrigger(KeyInput.KEY_E), new KeyTrigger(KeyInput.KEY_PGUP))
- inputManager.addMapping("ChaseCamZoomOut", new KeyTrigger(KeyInput.KEY_Q), new KeyTrigger(KeyInput.KEY_PGDN))
-
- rotationSpeed = 2f
- zoomSpeed = 5f
-
- setMinVerticalRotation(-FastMath.PI / 2f + 0.01f)
- setMaxVerticalRotation( FastMath.PI / 2f - 0.01f)
-
- def setRotationSpeed(speed: Float) {rotationSpeed = speed}
- def getRotationSpeed: Float = rotationSpeed
-
- def setZoomSpeed(speed: Float) {zoomSpeed = speed}
- def getZoomSpeed: Float = zoomSpeed
-
-
-}
View
190 client/src/main/scala/org/skycastle/client/shapes/ShapeViewer.scala
@@ -1,190 +0,0 @@
-package org.skycastle.client.shapes
-
-import java.io.File
-
-import com.jme3.app.SimpleApplication
-import com.jme3.system.AppSettings
-import com.jme3.asset.plugins.FileLocator
-import com.jme3.material.Material
-import com.jme3.math.{ColorRGBA, Vector3f}
-import com.jme3.asset.AssetManager
-import com.jme3.scene.{Spatial, Geometry}
-import com.jme3.scene.shape.Box
-import com.jme3.app.state.ScreenshotAppState
-import com.jme3.input.controls.KeyTrigger
-import com.jme3.input.KeyInput
-
-import org.skycastle.client.sky.Sky
-import org.skycastle.utils.{Logging, FileChangeMonitor}
-
-import components.{Tome, Model}
-import loader.ModelLoader
-
-/**
- * Live preview of procedural shape defined in a config file.
- * Support for updating the shape when the config file is changed.
- */
-object ShapeViewer extends SimpleApplication with Logging {
-
- private val wireframe = false
- private val limitFps= true
-
- private val startX = 0
- private val startY = 5
- private val startZ = 20
-
- private var shape: Spatial = null
-
- private var model: Model = null
-
- private var tomes: Map[String, Tome] = Map()
-
- private var chaseCamera: RotationCameraControl = null
-
- private var modelLoader: ModelLoader = null
- private val modelSource: File = new File("assets/shapes/TestShape.yaml")
- private var modelSourcesToRead: File = null
- private var fileChangeMonitor: FileChangeMonitor = null
-
- def main(args: Array[String]) {
- Logging.initializeLogging()
-
- modelLoader = new ModelLoader()
-
- val settings: AppSettings = new AppSettings(true)
- if (limitFps) {
- settings.setFrameRate(60)
- settings.setVSync(true)
- }
- else {
- settings.setFrameRate(-1)
- settings.setVSync(false)
- }
- setSettings(settings)
-
- setPauseOnLostFocus(false)
-
- // Start polling
- fileChangeMonitor = new FileChangeMonitor(modelSource, setFileToRead _)
- fileChangeMonitor.start()
-
- start()
- }
-
- private def setFileToRead(file: File) {
- synchronized {
- modelSourcesToRead = file
- }
- }
-
- private def getFileToRead(): File = {
- synchronized {
- val file = modelSourcesToRead
- modelSourcesToRead = null
- file
- }
- }
-
- def updateModel(modelFile: File) {
- if (shape != null) {
- shape.removeControl(chaseCamera)
- rootNode.detachChild(shape)
- }
-
- shape = createModel(assetManager,modelFile);
-
- if (shape != null) {
- rootNode.attachChild(shape)
- shape.addControl(chaseCamera)
- }
- }
-
- def simpleInitApp() {
-
- assetManager.registerLocator("assets", classOf[FileLocator])
-
- // getCamera.setFrustumFar(320000)
-
- // Setup camera control
- chaseCamera = new RotationCameraControl(getCamera, inputManager)
- chaseCamera.setDragToRotate(true)
-
-
- // Allow screenshots
- stateManager.attach(new ScreenshotAppState());
-
- // Background
- viewPort.setBackgroundColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1f));
-
- // Sky
- val sky = new Sky(getCamera, assetManager)
- rootNode.attachChild(sky)
- sky.createLights(rootNode)
-
- // Start pos
- val startPos: Vector3f = new Vector3f(startX, startY, startZ)
- this.getCamera.setLocation(startPos);
-
- // Load model
- //updateModel()
-
- // TODO: Wireframe support
- // val terrainMaterial = if (wireframe) createWireframeMaterial(assetManager) else createSimpleTerrainMaterial(getAssetManager)
-
-
- setupKeys()
-
-
- }
-
-
- override def simpleUpdate(tpf: Float) {
- val file = getFileToRead()
- if (file != null) {
- updateModel(file)
- }
-
-
- }
-
- private def createModel(assetManager: AssetManager, modelFile: File): Spatial = {
- model = loadModel(modelFile)
- if (model != null) model.createSpatial(assetManager)
- else null
- }
-
- private def loadModel(modelFile: File): Model = {
- val newTomes: Map[String, Tome] = modelLoader.loadModels(modelFile)
- tomes ++= newTomes
-
- if (newTomes.isEmpty) null
- else newTomes.head._2.model
-
- // TODO: Detect removed tomes
-
- //new Cube()
- }
-
- private def setupKeys() {
- inputManager.addMapping("ReloadModel", new KeyTrigger(KeyInput.KEY_SPACE));
-
- /*
- inputManager.addListener(new ActionListener {
- def onAction(name: String, isPressed: Boolean, tpf: Float) { if (!isPressed) updateModel() }
- }, "ReloadModel")
- */
- }
-
-
- private def makeTestBox(pos: Vector3f = Vector3f.ZERO): Geometry = {
- val box = new Geometry("box", new Box(1, 1, 1))
- box.setLocalTranslation(pos)
- val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- mat.setColor("Color", ColorRGBA.randomColor());
- box.setMaterial(mat)
- box
- }
-
-
-
-}
View
15 client/src/main/scala/org/skycastle/client/shapes/components/Ball.scala
@@ -1,15 +0,0 @@
-package org.skycastle.client.shapes.components
-
-import org.skycastle.utils.MeshBuilder
-
-/**
- *
- */
-
-class Ball extends Model {
-
- def buildMesh(builder: MeshBuilder) {
- // TODO
- }
-
-}
View
42 client/src/main/scala/org/skycastle/client/shapes/components/Cube.scala
@@ -1,42 +0,0 @@
-package org.skycastle.client.shapes.components
-
-import com.jme3.scene.Mesh
-import org.skycastle.utils.MeshBuilder
-import reflect.BeanProperty
-import com.jme3.math.{Matrix4f, Transform, Vector3f}
-
-/**
- *
- */
-
-case class Cube(@BeanProperty var sizeX: Float = 1f,
- @BeanProperty var sizeY: Float = 1f,
- @BeanProperty var sizeZ: Float = 1f) extends Model {
-
- def this() {
- this(1f, 1f, 1f)
- }
-
-
- def buildMesh(builder: MeshBuilder) {
-
- val v000 = builder.addVertex(new Vector3f(-sizeX, -sizeY, -sizeZ))
- val v001 = builder.addVertex(new Vector3f(-sizeX, -sizeY, sizeZ))
- val v010 = builder.addVertex(new Vector3f(-sizeX, sizeY, -sizeZ))
- val v011 = builder.addVertex(new Vector3f(-sizeX, sizeY, sizeZ))
- val v100 = builder.addVertex(new Vector3f( sizeX, -sizeY, -sizeZ))
- val v101 = builder.addVertex(new Vector3f( sizeX, -sizeY, sizeZ))
- val v110 = builder.addVertex(new Vector3f( sizeX, sizeY, -sizeZ))
- val v111 = builder.addVertex(new Vector3f( sizeX, sizeY, sizeZ))
-
- builder.addQuad(v000, v001, v011, v010)
- builder.addQuad(v100, v110, v111, v101)
-
- builder.addQuad(v010, v011, v111, v110)
- builder.addQuad(v000, v100, v101, v001)
-
- builder.addQuad(v001, v101, v111, v011)
- builder.addQuad(v000, v010, v110, v100)
- }
-
-}
View
47 client/src/main/scala/org/skycastle/client/shapes/components/Model.scala
@@ -1,47 +0,0 @@
-package org.skycastle.client.shapes.components
-
-import com.jme3.material.Material
-import com.jme3.app.Application._
-import com.jme3.asset.AssetManager
-import com.jme3.scene.{Mesh, Geometry, Spatial}
-import org.skycastle.utils.MeshBuilder
-import com.jme3.math.{Matrix4f, Transform, ColorRGBA}
-
-
-/**
- *
- */
-
-trait Model {
-
-
- def createSpatial(assetManager: AssetManager): Spatial = {
- val mesh = createMesh()
- val geometry: Geometry = new Geometry("shape", mesh)
- geometry.setMaterial(createMaterial(assetManager))
- geometry
- }
-
- def buildMesh(builder: MeshBuilder)
-
- def buildMesh(builder: MeshBuilder, transformation: Matrix4f) {
- builder.pushTransform(transformation)
- buildMesh(builder)
- builder.popTransform()
- }
-
- def createMesh(): Mesh = {
- val builder = new MeshBuilder()
- buildMesh(builder)
- builder.createMesh()
- }
-
- def createMaterial(assetManager: AssetManager): Material = {
- val mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
- //val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- //mat.setColor("Color", ColorRGBA.randomColor());
-
- mat
- }
-
-}
View
45 client/src/main/scala/org/skycastle/client/shapes/components/ScatterAlong.scala
@@ -1,45 +0,0 @@
-package org.skycastle.client.shapes.components
-import reflect.BeanProperty
-import org.skycastle.utils.MeshBuilder
-import com.jme3.math.Matrix4f
-
-
-/**
- *
- */
-
-case class ScatterAlong(@BeanProperty var model: Model,
- @BeanProperty var start: Double = 0.0,
- @BeanProperty var end: Double = 1.0,
- @BeanProperty var number: Int = 10,
- @BeanProperty var path: Double => (Double, Double, Double) = t => (0.0, 0.0, 0.0),
- @BeanProperty var scale: Double => Double = t => 1.0) extends Model {
-
- def this() {
- this(null)
- }
-
-
- def buildMesh(builder: MeshBuilder) {
- if (model != null && number > 0) {
- val localTransform = new Matrix4f()
-
- var t = start
- val step = (end - start) / number
- while (t <= end) {
- val pos = path(t)
- val s = scale(t).toFloat
-
- // Transform according to functions
- localTransform.loadIdentity()
- localTransform.setTranslation(pos._1.toFloat, pos._2.toFloat, pos._3.toFloat)
- localTransform.setScale(s, s, s)
-
- model.buildMesh(builder, localTransform)
-
- t += step
- }
- }
- }
-
-}
View
13 client/src/main/scala/org/skycastle/client/shapes/components/Tome.scala
@@ -1,13 +0,0 @@
-package org.skycastle.client.shapes.components
-
-import scala.reflect._
-
-/**
- * Wraps a library entry, provides authorship etc info?
- */
-class Tome() {
-
- @BeanProperty var name: String = null
- @BeanProperty var model: Model = null
-
-}
View
10 client/src/main/scala/org/skycastle/client/shapes/components/Tube.scala
@@ -1,10 +0,0 @@
-package org.skycastle.client.shapes.components
-
-/**
- * Tube shaped mesh. Follows some path.
- */
-class Tube {
-
-
-
-}
View
109 client/src/main/scala/org/skycastle/client/shapes/loader/ModelLoader.scala
@@ -1,109 +0,0 @@
-package org.skycastle.client.shapes.loader
-
-import org.skycastle.client.shapes.components._
-import org.skycastle.functions.{Abs, Noise1to3, Noise1to2, Noise1to1}
-
-import org.skycastle.utils.Logging
-
-import java.io.{FileReader, File}
-import org.yaml.snakeyaml.introspector.BeanAccess
-import org.yaml.snakeyaml.composer.Composer
-import org.yaml.snakeyaml.representer.Representer
-import org.yaml.snakeyaml.nodes.Tag
-import org.yaml.snakeyaml.constructor.{Constructor, SafeConstructor}
-import org.yaml.snakeyaml.constructor.Constructor._
-import org.yaml.snakeyaml.{TypeDescription, Yaml}
-import scala.Predef._
-
-/**
- *
- */
-// TODO: Support for expressions, and anonymous functions (parse with parser combinators and create janino expression)
-// TODO: Eventually, universal graphical editor
-class ModelLoader {
-
- private val constructor = new FilterConstructor(classOf[Tome])
- private val representer = new Representer()
-
- allowType[Tome]
- allowType[Cube]
- allowType[Tube]
- allowType[Ball]
- allowType[ScatterAlong]
- allowType[Noise1to1]
- allowType[Noise1to2]
- allowType[Noise1to3]
- allowType[Abs]
-
- def allowType[T <: AnyRef](implicit m: Manifest[T]) {
- val kind: Class[T] = m.erasure.asInstanceOf[Class[T]]
- constructor.registerType[T]
- representer.addClassTag(kind, new Tag("!" + kind.getSimpleName))
- }
-
- def loadModels(files: List[File]): Map[String, Tome] = {
- var result = Map[String, Tome]()
- files foreach {f => result ++= loadModels(f)}
- result
- }
-
- def loadModels(file: File): Map[String, Tome] = {
- println("Loading models from " + file)
-
- var result = Map[String, Tome]()
-
- constructor.source = file.getPath
- val yaml = new Yaml(constructor, representer)
- val reader = new FileReader(file)
- try {
- val tomes = yaml.loadAll(reader).iterator()
- while (tomes.hasNext) {
- val tome = tomes.next().asInstanceOf[Tome]
- result += (tome.name -> tome)
- }
- }
- catch {
- case e: Exception =>
- println("Error while loading '"+file.getName+"': " + e.getMessage)
- result
- }
- finally {
- if (reader != null) reader.close()
- }
-
- result
- }
-
- class FilterConstructor(rootClass: Class[_ <: AnyRef]) extends Constructor(rootClass) with Logging {
-
- private var mappings: Map[String, Class[_ <: AnyRef ]] = Map()
-
- var source = "unknown"
-
-
- def registerType[T <: AnyRef](implicit m: Manifest[T]) {
-
- val kind: Class[T] = m.erasure.asInstanceOf[Class[T]]
- val tag: String = "!" + m.erasure.getSimpleName
- addTypeDescription(new TypeDescription(kind, tag))
- mappings += kind.getName -> kind
-
- log.info("Registered tag '"+tag+"' for type '"+kind.getName +"'")
- println("Registered tag '"+tag+"' for type '"+kind.getName +"'")
- }
-
- override def getClassForName(name: String): Class[_] = {
-
- if (mappings.contains(name)) mappings(name)
- else throw FilterException(name, source)
- }
-
- /**
- * Exception used if non-permitted class is loaded.
- */
- case class FilterException(forbiddenClass: String, source: String)
- extends Error("The class '"+forbiddenClass+"' is not permitted, but it was used in "+source)
-
- }
-
-}
View
0 ...ogging/logback-classic-0.9.28-sources.jar → ...ogging/logback-classic-0.9.28-sources.jar
File renamed without changes.
View
0 ...nt/lib/logging/logback-classic-0.9.28.jar → lib/logging/logback-classic-0.9.28.jar
File renamed without changes.
View
0 ...b/logging/logback-core-0.9.28-sources.jar → lib/logging/logback-core-0.9.28-sources.jar
File renamed without changes.
View
0 client/lib/logging/logback-core-0.9.28.jar → lib/logging/logback-core-0.9.28.jar
File renamed without changes.
View
0 ...t/lib/logging/slf4j-api-1.6.1-sources.jar → lib/logging/slf4j-api-1.6.1-sources.jar
File renamed without changes.
View
0 client/lib/logging/slf4j-api-1.6.1.jar → lib/logging/slf4j-api-1.6.1.jar
File renamed without changes.
View
9 project/Build.scala
@@ -1,9 +0,0 @@
-import sbt._
-import Keys._
-
-object ProjectBuild extends Build {
- lazy val root = Project(id = "skycastle", base = file(".")) aggregate(common, client, server)
- lazy val client = Project(id = "skycastle-client", base = file("client"))dependsOn(common)
- lazy val server = Project(id = "skycastle-server", base = file("server"))dependsOn(common)
- lazy val common = Project(id = "skycastle-common", base = file("common"))
-}
View
0 ...castle/client/ClampingNoiseModulator.java → ...castle/client/ClampingNoiseModulator.java
File renamed without changes.
View
0 ...skycastle/utils/SimplexGradientNoise.java → ...skycastle/utils/SimplexGradientNoise.java
File renamed without changes.
View
0 ...n/scala/org/skycastle/client/Client.scala → ...n/scala/org/skycastle/client/Client.scala
File renamed without changes.
View
87 ...kycastle/client/ClipmapTerrainSpike.scala → ...kycastle/client/ClipmapTerrainSpike.scala
@@ -2,11 +2,9 @@ package org.skycastle.client
import com.jme3.app.SimpleApplication
import com.jme3.material.Material
-import com.jme3.bullet.control.CharacterControl
import com.jme3.terrain.noise.fractal.FractalSum
import com.jme3.terrain.noise.filter.{IterativeFilter, SmoothFilter, OptimizedErode, PerturbFilter}
import com.jme3.post.FilterPostProcessor
-import com.jme3.water.WaterFilter
import com.jme3.system.AppSettings
import com.jme3.app.Application._
import com.jme3.app.SimpleApplication._
@@ -16,26 +14,19 @@ import com.jme3.terrain.noise.basis.FilteredBasis
import com.jme3.terrain.geomipmap.grid.FractalTileLoader
import com.jme3.terrain.geomipmap.{TerrainLodControl, TerrainGrid, TerrainQuad}
import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator
-import com.jme3.audio.AudioNode
-import com.jme3.util.SkyFactory
import com.jme3.asset.AssetManager
import com.jme3.scene.{Geometry, Node, Spatial}
-import com.jme3.post.filters.FogFilter
import network.protocol.Message
import network.{ServerHandler, ClientNetworking}
import sky.Sky
import terrain._
-import com.jme3.light.{AmbientLight, DirectionalLight}
import com.jme3.math.{ColorRGBA, Vector3f}
import com.jme3.asset.plugins.FileLocator
import definition._
-import com.jme3.renderer.queue.RenderQueue.Bucket
import com.jme3.scene.shape.{Sphere, Dome, Box}
-import com.jme3.bounding.BoundingSphere
-import com.jme3.texture.{Image, TextureCubeMap, Texture}
-import com.jme3.scene.control.AbstractControl
-import com.jme3.renderer.{RenderManager, ViewPort}
import org.skycastle.utils.Logging
+import com.jme3.texture.Texture
+import com.jme3.water.WaterFilter
/**
*
@@ -74,10 +65,10 @@ object ClipmapTerrainSpike extends SimpleApplication {
}
})
- networking.setup();
+ networking.setup()
//networking.createAccount("localhost", 6283, "TestUser1", "testPass%31# 32sdf");
- networking.login("localhost", 6283, "TestUser1", "testPass%31# 32sdf");
+// networking.login("localhost", 6283, "TestUser1", "testPass%31# 32sdf");
val settings: AppSettings = new AppSettings(true)
if (limitFps) {
@@ -88,7 +79,7 @@ object ClipmapTerrainSpike extends SimpleApplication {
settings.setFrameRate(-1)
settings.setVSync(false)
}
- setSettings(settings);
+ setSettings(settings)
start()
}
@@ -101,7 +92,7 @@ object ClipmapTerrainSpike extends SimpleApplication {
getCamera.setFrustumFar(320000)
// Allow screenshots
- this.stateManager.attach(new ScreenshotAppState());
+ this.stateManager.attach(new ScreenshotAppState())
// Terrain
/*
@@ -124,10 +115,10 @@ object ClipmapTerrainSpike extends SimpleApplication {
new SimpleGroundLodStrategy(2, 0.25),
assetManager)
- this.rootNode.attachChild(terrain);
+ this.rootNode.attachChild(terrain)
// Water
- if (waterOn) viewPort.addProcessor(createWater(assetManager, rootNode, lightDir, 0));
+ if (waterOn) viewPort.addProcessor(createWater(assetManager, rootNode, lightDir, 0))
@@ -146,13 +137,13 @@ object ClipmapTerrainSpike extends SimpleApplication {
// Start pos
val startPos: Vector3f = new Vector3f(startX, groundDef.getHeight(startX, startZ, 1).toFloat + 2, startZ)
- this.getCamera.setLocation(startPos);
+ this.getCamera.setLocation(startPos)
// Refpoint
val box = new Geometry("box", new Box(1, 1, 1))
box.setLocalTranslation(startPos)
- val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- mat.setColor("Color", ColorRGBA.Red);
+ val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")
+ mat.setColor("Color", ColorRGBA.Red)
box.setMaterial(mat)
rootNode.attachChild(box)
@@ -268,30 +259,30 @@ object ClipmapTerrainSpike extends SimpleApplication {
//mat_terrain = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md")
//mat_terrain.setTexture("DiffuseMap", texture1);
mat_terrain = new Material(assetManager, "shaders/GroundTest.j3md")
- mat_terrain.setTexture("Ecotope1Map", texture1);
- mat_terrain.setTexture("Ecotope2Map", texture2);
- mat_terrain.setTexture("Ecotope3Map", texture3);
+ mat_terrain.setTexture("Ecotope1Map", texture1)
+ mat_terrain.setTexture("Ecotope2Map", texture2)
+ mat_terrain.setTexture("Ecotope3Map", texture3)
}
else {
mat_terrain = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")
- mat_terrain.setTexture("ColorMap", texture1);
+ mat_terrain.setTexture("ColorMap", texture1)
}
mat_terrain
}
def createWireframeMaterial(assetManager: AssetManager): Material = {
- val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
- mat.setColor("Color", ColorRGBA.Green);
+ val mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")
+ mat.setColor("Color", ColorRGBA.Green)
// Wireframe mode
- mat.getAdditionalRenderState.setWireframe(true);
+ mat.getAdditionalRenderState.setWireframe(true)
mat
}
def createTerrainMaterial(assetManager: AssetManager, grassScale: Float, dirtScale: Float, rockScale: Float): Material = {
// TERRAIN TEXTURE material
- val mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md");
+ val mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/HeightBasedTerrain.j3md")
// Parameters to material:
@@ -306,35 +297,35 @@ object ClipmapTerrainSpike extends SimpleApplication {
// terrainSize: the total size of the terrain (used for scaling the texture)
// GRASS texture
val grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg")
- grass.setWrap(WrapMode.Repeat);
- mat_terrain.setTexture("region1ColorMap", grass);
- mat_terrain.setVector3("region1", new Vector3f(15, 200, grassScale));
+ grass.setWrap(WrapMode.Repeat)
+ mat_terrain.setTexture("region1ColorMap", grass)
+ mat_terrain.setVector3("region1", new Vector3f(15, 200, grassScale))
// DIRT texture
- val dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
- dirt.setWrap(WrapMode.Repeat);
- mat_terrain.setTexture("region2ColorMap", dirt);
- mat_terrain.setVector3("region2", new Vector3f(0, 20, dirtScale));
+ val dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg")
+ dirt.setWrap(WrapMode.Repeat)
+ mat_terrain.setTexture("region2ColorMap", dirt)
+ mat_terrain.setVector3("region2", new Vector3f(0, 20, dirtScale))
// ROCK texture
- val rock = assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
- rock.setWrap(WrapMode.Repeat);
- mat_terrain.setTexture("region3ColorMap", rock);
- mat_terrain.setVector3("region3", new Vector3f(198, 260, rockScale));
+ val rock = assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg")
+ rock.setWrap(WrapMode.Repeat)
+ mat_terrain.setTexture("region3ColorMap", rock)
+ mat_terrain.setVector3("region3", new Vector3f(198, 260, rockScale))
- mat_terrain.setTexture("region4ColorMap", rock);
- mat_terrain.setVector3("region4", new Vector3f(198, 260, rockScale));
+ mat_terrain.setTexture("region4ColorMap", rock)
+ mat_terrain.setVector3("region4", new Vector3f(198, 260, rockScale))
- mat_terrain.setTexture("slopeColorMap", rock);
- mat_terrain.setFloat("slopeTileFactor", 32);
+ mat_terrain.setTexture("slopeColorMap", rock)
+ mat_terrain.setFloat("slopeTileFactor", 32)
- mat_terrain.setFloat("terrainSize", 513);
+ mat_terrain.setFloat("terrainSize", 513)
mat_terrain
}
def createWater(assetManager: AssetManager, rootNode: Node, lightDir: Vector3f, initialWaterHeight: Float): FilterPostProcessor = {
- val water = new WaterFilter(rootNode, lightDir);
- water.setWaterHeight(initialWaterHeight);
+ val water = new WaterFilter(rootNode, lightDir)
+ water.setWaterHeight(initialWaterHeight)
//water.setSpeed(0.6f)
//water.setWaveScale(0.001f)
//water.setDeepWaterColor(new ColorRGBA(0.0001f, 0.00196f, 0.145f, 1.0f))
@@ -343,8 +334,8 @@ object ClipmapTerrainSpike extends SimpleApplication {
//water.setUseFoam(false)
water.setFoamIntensity(1f)
- val fpp = new FilterPostProcessor(assetManager);
- fpp.addFilter(water);
+ val fpp = new FilterPostProcessor(assetManager)
+ fpp.addFilter(water)
fpp
}
View
0 ...a/org/skycastle/client/TerrainSpike.scala → ...a/org/skycastle/client/TerrainSpike.scala
File renamed without changes.
View
0 ...tle/client/network/ClientNetworking.scala → ...tle/client/network/ClientNetworking.scala
File renamed without changes.
View
0 ...g/skycastle/client/network/EntityId.scala → ...g/skycastle/client/network/EntityId.scala
File renamed without changes.
View
0 ...castle/client/network/ServerHandler.scala → ...castle/client/network/ServerHandler.scala
File renamed without changes.
View
0 ...tle/client/network/protocol/Message.scala → ...tle/client/network/protocol/Message.scala
File renamed without changes.
View
0 ...nt/network/protocol/MessageProtocol.scala → ...nt/network/protocol/MessageProtocol.scala
File renamed without changes.
View
0 .../network/protocol/ProtocolException.scala → .../network/protocol/ProtocolException.scala
File renamed without changes.
View
0 ...work/protocol/binary/BinaryProtocol.scala → ...work/protocol/binary/BinaryProtocol.scala
File renamed without changes.
View
0 ...rk/protocol/binary/BinarySerializer.scala → ...rk/protocol/binary/BinarySerializer.scala
File renamed without changes.
View
0 ...twork/protocol/binary/PackedNumbers.scala → ...twork/protocol/binary/PackedNumbers.scala
File renamed without changes.
View
0 ...work/protocol/binary/TypeSerializer.scala → ...work/protocol/binary/TypeSerializer.scala
File renamed without changes.
View
0 .../scala/org/skycastle/client/sky/Sky.scala → .../scala/org/skycastle/client/sky/Sky.scala
File renamed without changes.
View
0 ...g/skycastle/client/terrain/BlockPos.scala → ...g/skycastle/client/terrain/BlockPos.scala
File renamed without changes.
View
0 ...errain/FunctionalTerrainBlockSource.scala → ...errain/FunctionalTerrainBlockSource.scala
File renamed without changes.
View
10 ...org/skycastle/client/terrain/Ground.scala → ...org/skycastle/client/terrain/Ground.scala
@@ -2,8 +2,6 @@ package org.skycastle.client.terrain
import com.jme3.asset.AssetManager
import com.jme3.scene.Node
-import com.jme3.terrain.geomipmap.TerrainLodControl
-import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator
import com.jme3.renderer.Camera
import com.jme3.math.Vector3f
import definition.GroundDef
@@ -61,10 +59,10 @@ class Ground(sizeSettings: GroundSizeSettings,
checkRootBlocksToBeRemoved()
// Check if new root blocks should be added
- checkRootBlocksToAdd
+ checkRootBlocksToAdd()
// Update internal structure of current root blocks
- updateRootBlocks
+ updateRootBlocks()
}
private def checkRootBlocksToBeRemoved() {
@@ -85,7 +83,7 @@ class Ground(sizeSettings: GroundSizeSettings,
rootBlocksToRemove.clear()
}
- private def checkRootBlocksToAdd {
+ private def checkRootBlocksToAdd() {
val newRootBlocks = groundLodStrategy.getRootBlocks(cameraPos, rootGrid.keySet(), sizeSettings)
newRootBlocks foreach {
newBlockPos =>
@@ -95,7 +93,7 @@ class Ground(sizeSettings: GroundSizeSettings,
}
}
- private def updateRootBlocks {
+ private def updateRootBlocks() {
rootGrid.values() foreach {
rootTree =>
rootTree.update(cameraPos, groundLodStrategy, terrainFunction, sizeSettings)
View
0 .../client/terrain/GroundCameraControl.scala → .../client/terrain/GroundCameraControl.scala
File renamed without changes.
View
2 ...le/client/terrain/GroundLodStrategy.scala → ...le/client/terrain/GroundLodStrategy.scala
@@ -5,7 +5,7 @@ import javax.vecmath.Vector3d
import java.util.{HashSet, HashMap}
/**
- * Check wether to split or merge or do nothing for a block at a specific level of detail and position, given the camera position.
+ * Check whether to split or merge or do nothing for a block at a specific level of detail and position, given the camera position.
*/
trait GroundLodStrategy {
View
0 ...e/client/terrain/GroundSizeSettings.scala → ...e/client/terrain/GroundSizeSettings.scala
File renamed without changes.
View
6 ...skycastle/client/terrain/GroundTree.scala → ...skycastle/client/terrain/GroundTree.scala
@@ -81,11 +81,11 @@ class GroundTree(val pos: BlockPos, parentNode: Node, source: TerrainBlockSource
}
def remove() {
- removeChildren
- removeBlock
+ removeChildren()
+ removeBlock()
}
- private def removeBlock {
+ private def removeBlock() {
if (block != null) {
block.freeResources()
parentNode.detachChild(block)
View
0 ...ent/terrain/SimpleGroundLodStrategy.scala → ...ent/terrain/SimpleGroundLodStrategy.scala
File renamed without changes.
View
4 ...ycastle/client/terrain/TerrainBlock.scala → ...ycastle/client/terrain/TerrainBlock.scala
@@ -31,7 +31,7 @@ class TerrainBlock(
lazy val placeholderMaterial: GroundMaterial = new GroundMaterial('placeholderium, assetManager.loadTexture("textures/placeholder.png"))
- private var block: Geometry = null;
+ private var block: Geometry = null
block = createBlock()
attachChild(block)
@@ -42,7 +42,7 @@ class TerrainBlock(
private def createBlock(): Geometry = {
- val tempTextureScale = 1.0/100;
+ val tempTextureScale = 1.0/100
val maxNumberOfGroundMaterials = 4
View
0 ...e/client/terrain/TerrainBlockSource.scala → ...e/client/terrain/TerrainBlockSource.scala
File renamed without changes.
View
0 ...kycastle/client/terrain/TestTerrain.scala → ...kycastle/client/terrain/TestTerrain.scala
File renamed without changes.
View
0 .../terrain/definition/FoundationLayer.scala → .../terrain/definition/FoundationLayer.scala
File renamed without changes.
View
0 ...tle/client/terrain/definition/Fun2d.scala → ...tle/client/terrain/definition/Fun2d.scala
File renamed without changes.
View
0 ...client/terrain/definition/GroundDef.scala → ...client/terrain/definition/GroundDef.scala
File renamed without changes.
View
0 ...t/terrain/definition/GroundMaterial.scala → ...t/terrain/definition/GroundMaterial.scala
File renamed without changes.
View
0 ...tle/client/terrain/definition/Layer.scala → ...tle/client/terrain/definition/Layer.scala
File renamed without changes.
View
0 ...nt/terrain/definition/MaterialLayer.scala → ...nt/terrain/definition/MaterialLayer.scala
File renamed without changes.
View
0 ...ient/terrain/definition/MountainFun.scala → ...ient/terrain/definition/MountainFun.scala
File renamed without changes.
View
2 .../client/terrain/definition/NoiseFun.scala → .../client/terrain/definition/NoiseFun.scala
@@ -1,7 +1,5 @@
package org.skycastle.client.terrain.definition
-import javax.vecmath.Vector2f
-import java.util.Random
import org.skycastle.utils.{SimplexGradientNoise}
import org.skycastle.utils.{RandomUtils}
View
0 ...nt/terrain/definition/TurbulenceFun.scala → ...nt/terrain/definition/TurbulenceFun.scala
File renamed without changes.
View
0 ...rg/skycastle/utils/BufferConverters.scala → ...rg/skycastle/utils/BufferConverters.scala
File renamed without changes.
View
0 ...scala/org/skycastle/utils/LangUtils.scala → ...scala/org/skycastle/utils/LangUtils.scala
File renamed without changes.
View
44 src/main/scala/org/skycastle/utils/Logging.scala
@@ -0,0 +1,44 @@
+package org.skycastle.utils
+
+import org.slf4j.{Logger, LoggerFactory}
+import org.apache.log4j.PropertyConfigurator
+import java.util.Properties
+
+//import org.apache.log4j.PropertyConfigurator
+
+object Logging {
+ /**
+ * Should be called from entry point / main class one as the application starts up, to configure the logging used.
+ */
+ def initializeLogging() {
+ val properties: Properties = new Properties()
+
+ // Set logging levels and appenders
+ properties.setProperty("log4j.rootLogger", "DEBUG, CONSOLE_APPENDER")
+ properties.setProperty("org.skycastle", "DEBUG, CONSOLE_APPENDER")
+
+ // Setup pattern for log rows
+ properties.setProperty("log4j.appender.CONSOLE_APPENDER", "org.apache.log4j.ConsoleAppender")
+ properties.setProperty("log4j.appender.CONSOLE_APPENDER.layout", "org.apache.log4j.PatternLayout")
+ properties.setProperty("log4j.appender.CONSOLE_APPENDER.layout.ConversionPattern", "%-4r [%t] %-5p %c %x - %m%n")
+
+ PropertyConfigurator.configure(properties)
+
+ // Setup log4j logging using config file
+ //PropertyConfigurator.configure("log4j.properties")
+ }
+}
+
+/**
+ * A mixin that provides various logging methods that delegate to the SLF4J framework.
+ */
+trait Logging {
+
+ def loggingPath = getClass
+
+ lazy val log: Logger = LoggerFactory.getLogger(loggingPath)
+
+}
+
+
+
View
0 ...scala/org/skycastle/utils/MathUtils.scala → ...scala/org/skycastle/utils/MathUtils.scala
File renamed without changes.
View
0 ...ala/org/skycastle/utils/MeshBuilder.scala → ...ala/org/skycastle/utils/MeshBuilder.scala
File renamed without changes.
View
0 ...rg/skycastle/utils/ParameterChecker.scala → ...rg/skycastle/utils/ParameterChecker.scala
File renamed without changes.
View
0 ...ala/org/skycastle/utils/RandomUtils.scala → ...ala/org/skycastle/utils/RandomUtils.scala
File renamed without changes.
View
0 ...la/org/skycastle/utils/SimplexNoise.scala → ...la/org/skycastle/utils/SimplexNoise.scala
File renamed without changes.
View
56 src/main/scala/org/skycastle/utils/StringUtils.scala
@@ -0,0 +1,56 @@
+package org.skycastle.utils
+
+/**
+ *
+ */
+
+object StringUtils {
+
+ /**
+ * Adds a prefix, capitalizing the body, except if the prefix if empty, in which case the body is returned as-is.
+ */
+ def addPrefix( prefix : String, body : String ) : String = {
+ if (prefix == null || prefix == "") body
+ else prefix + capitalize( body )
+ }
+
+ def removeSuffix(s: String, suffix: String): String = {
+ if (s.endsWith(suffix)) {
+ s.substring(0, s.length() - suffix.length())
+ }
+ else s
+ }
+
+ /**
+ * Changes the first letter to upper case of the string.
+ */
+ def capitalize( s : String ) : String = {
+ if (s == null || s.isEmpty) s
+ else s(0).toUpperCase.toString + s.substring(1)
+ }
+
+ /**
+ * Adds zeroes in front of a non-negative integer until we get a string of the desired length.
+ */
+ def zeroPadInteger(number: Int, desiredLength: Int) : String = {
+ if (number < 0) throw new IllegalArgumentException("Argument should not be negative")
+
+ var numZeropad = number.toString
+ while (numZeropad.length < desiredLength) {
+ numZeropad = "0" + numZeropad;
+ }
+ return numZeropad
+ }
+
+ /**
+ * True if s is a java style identifier (starts with letter, followed by numbers and letters, should be non-empty).
+ */
+ def isIdentifier( s : String ) : Boolean = {
+ if (s == null || s.length <= 0) false
+ else if ( !Character.isJavaIdentifierStart( s.charAt( 0 ) ) ) false
+ else {
+ s forall Character.isJavaIdentifierPart
+ }
+ }
+
+}

0 comments on commit d61869f

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