-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Many changes to: LRUTileCache, assets, docs, graphics and a refactor
- LRUTileCache now fetches tiles async - Added graphics settings (not yet implemented) - Updated docs, research papers and refactored class names - Added bus model - Added AtlasVehicle - probably more I forgot
- Loading branch information
1 parent
a09a314
commit 9adffe3
Showing
20 changed files
with
272 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...a/com/decosegfault/hermes/HermesGame.java → ...ava/com/decosegfault/atlas/AtlasGame.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
core/src/main/kotlin/com/decosegfault/atlas/render/AtlasVehicle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.decosegfault.atlas.render | ||
|
||
import com.badlogic.gdx.graphics.Camera | ||
import com.badlogic.gdx.math.Frustum | ||
import com.badlogic.gdx.math.Intersector | ||
import com.badlogic.gdx.math.Matrix4 | ||
import com.badlogic.gdx.math.Vector3 | ||
import com.badlogic.gdx.math.collision.BoundingBox | ||
import net.mgsx.gltf.scene3d.scene.Scene | ||
|
||
/** | ||
* Atlas's representation of a vehicle, includes gdx-gltf high detail and low detail models and bounding bo. | ||
* | ||
* @author Matt Young | ||
* | ||
* @param sceneHigh high poly 3D model | ||
* @param sceneLow low poly 3D model | ||
*/ | ||
data class AtlasVehicle(val sceneHigh: Scene, val sceneLow: Scene,) { | ||
private val transform = Matrix4() | ||
private val bbox = BoundingBox() | ||
|
||
/** | ||
* @param trans new transform: x, y, theta (rad) | ||
*/ | ||
fun updateTransform(trans: Vector3) { | ||
// update shared transformation for the model | ||
transform.setToTranslation(trans.x, 0.0f, trans.z) // TODO check axes | ||
transform.setToRotation(Vector3.Z, 0.0f) // TODO check axes | ||
|
||
// translate models | ||
sceneHigh.modelInstance.transform.set(transform) | ||
sceneLow.modelInstance.transform.set(transform) | ||
|
||
// just calculate bounding box for high and assume it's the same as low for performance reasons | ||
sceneHigh.modelInstance.calculateBoundingBox(bbox) | ||
} | ||
|
||
fun intersectFrustum(frustum: Frustum): Boolean { | ||
return Intersector.intersectFrustumBounds(frustum, bbox) | ||
} | ||
|
||
fun distanceToCam(camera: Camera): Float { | ||
return camera.position.dst(transform.getTranslation(Vector3())) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
core/src/main/kotlin/com/decosegfault/atlas/render/GraphicsPreset.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.decosegfault.atlas.render | ||
|
||
/** | ||
* Graphics preset for the render. **All distances are in metres.** | ||
* | ||
* @author Matt Young | ||
* | ||
* @param vehicleDrawDist Above this distance, vehicles are not rendered | ||
* @param vehicleLodDist Above this distance, low poly LoDs are used; below, high poly LoDs are used | ||
* @param tileDrawDist Above this distance, map tiles are not rendered | ||
*/ | ||
data class GraphicsPreset( | ||
val name: String, | ||
val description: String, | ||
|
||
val vehicleDrawDist: Float, | ||
val vehicleLodDist: Float, | ||
val tileDrawDist: Float | ||
) |
52 changes: 52 additions & 0 deletions
52
core/src/main/kotlin/com/decosegfault/atlas/render/GraphicsPresets.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.decosegfault.atlas.render | ||
|
||
/** | ||
* Graphics presets for the renderer | ||
* | ||
* @author Matt Young | ||
*/ | ||
class GraphicsPresets { | ||
// presets will be: | ||
// - Genuine Potato (Worst possible settings, honestly just terrible) | ||
// - Standard (Balanced settings for most users) | ||
// - It Runs Crysis (Highest settings not expected to tank the FPS) | ||
// - NASA Supercomputer (Everything maxed out) | ||
|
||
private val genuinePotato = GraphicsPreset( | ||
name="Genuine Potato", | ||
description="Worst possible settings for atrocious computers", | ||
vehicleDrawDist=10.0f, | ||
vehicleLodDist=Float.MAX_VALUE, // always draw low LoDs | ||
tileDrawDist=25.0f, | ||
) | ||
|
||
private val standard = GraphicsPreset( | ||
name="Standard", | ||
description="Balanced settings for good framerate on most computers", | ||
vehicleDrawDist=100.0f, | ||
vehicleLodDist=50.0f, | ||
tileDrawDist=100.0f, | ||
) | ||
|
||
private val itRunsCrysis = GraphicsPreset( | ||
name="It Runs Crysis", | ||
description="High settings for powerful gaming PCs or workstations", | ||
vehicleDrawDist=200.0f, | ||
vehicleLodDist=100.0f, | ||
tileDrawDist=200.0f, | ||
) | ||
|
||
private val nasaSupercomputer = GraphicsPreset( | ||
name="NASA Supercomputer", | ||
description="Max possible settings for ridiculously overpowered PCs to flex", | ||
vehicleDrawDist=Float.MAX_VALUE, // always draw every vehicle | ||
vehicleLodDist=Float.MIN_VALUE, // always draw high LoDs | ||
tileDrawDist=Float.MAX_VALUE, // always draw every tile | ||
) | ||
|
||
private val presets = listOf(genuinePotato, standard, itRunsCrysis, nasaSupercomputer) | ||
|
||
fun forName(name: String): GraphicsPreset { | ||
return presets.first { it.name == name } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.