Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain Chunking / Terrain Neighbors #194

Draft
wants to merge 108 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
70b3241
Push Terrain Chunk code
JamesTKhan Jun 6, 2023
8fa012c
Fix outline not updating
JamesTKhan Jun 6, 2023
1b07a9c
Setup neighbor terrains for generated terrain chunks
Dgzt Jun 19, 2023
16c6efc
Move neighbor references from Terrain class to TerrainComponent
Dgzt Jun 22, 2023
0cfc9a9
Save neighbor game object IDs
Dgzt Jun 23, 2023
4f4f4cb
Load neighbor terrains in editor
Dgzt Jun 24, 2023
447f0f9
Load neighbor terrains in runtime
Dgzt Jun 24, 2023
3677558
Merge pull request #191 from Dgzt/terrain_chunks_neighbor_terrains
JamesTKhan Jun 26, 2023
d0bb5e6
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jun 26, 2023
baa826f
Conflict fixes
JamesTKhan Jun 26, 2023
9bc2a3b
Terrain stitching logic
JamesTKhan Jun 27, 2023
19d4752
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jun 28, 2023
d8fce23
Terrain height changes work with neighbors
JamesTKhan Jun 30, 2023
6976d5c
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jun 30, 2023
69d2e3e
Fix terrain material on new terrain chunk
JamesTKhan Jun 30, 2023
eae6a9f
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jun 30, 2023
1b06cff
Splat Map with neighbors
JamesTKhan Jun 30, 2023
23b12e0
Null check for deleted neighbors
JamesTKhan Jul 3, 2023
04d47e9
View and manually assign terrain neighbors
JamesTKhan Jul 3, 2023
067c331
Undo redo command for neighbors
JamesTKhan Jul 3, 2023
055a247
command null safety
JamesTKhan Jul 3, 2023
bb79024
Can't select self as neighbor
JamesTKhan Jul 3, 2023
0b08eda
NPE fix
JamesTKhan Jul 3, 2023
dec69f6
Created TerrainLayerAsset
Dgzt Jul 6, 2023
45e8dcf
Set TerrainLayerAsset's terrain if load TerrainAsset via AssetManager
Dgzt Jul 7, 2023
6468d95
Heightmap work
JamesTKhan Jul 10, 2023
fff2477
Layer Assets, backward compat, loading
JamesTKhan Jul 10, 2023
b48cd57
Throw exception on missing layer asset
JamesTKhan Jul 10, 2023
a08e2b5
Fix double loading
JamesTKhan Jul 10, 2023
bf633cc
Merge remote-tracking branch 'origin/terrain_chunks' into terrain-lay…
JamesTKhan Jul 10, 2023
e9dfc76
Create and assign layer to chunks
JamesTKhan Jul 10, 2023
50dee14
More layering fixes
JamesTKhan Jul 10, 2023
e01684c
Merge remote-tracking branch 'origin/master' into terrain-layer-asset
JamesTKhan Jul 10, 2023
965644d
Use asset file instead of meta
JamesTKhan Jul 10, 2023
1b7573f
Fix NPE on load
JamesTKhan Jul 10, 2023
40238cb
Enable basic terrain cloning
JamesTKhan Jul 10, 2023
4453f59
Add ignore filter to Picker
JamesTKhan Jul 12, 2023
d603eb1
Change layers in UI + other optimizations
JamesTKhan Jul 12, 2023
9c4f245
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jul 12, 2023
7fe7e38
Remove unused fields
JamesTKhan Jul 12, 2023
634dbcb
Update CHANGES
JamesTKhan Jul 12, 2023
8dcd593
Merge remote-tracking branch 'origin/terrain_chunks' into terrain-lay…
JamesTKhan Jul 12, 2023
fc5642b
quick fix for layer count
JamesTKhan Jul 12, 2023
15e2df1
Add tooltip
JamesTKhan Jul 12, 2023
15fc72d
Merge pull request #197 from JamesTKhan/terrain-layer-asset
JamesTKhan Jul 14, 2023
04b273c
re-enable single terrain tile generation
JamesTKhan Jul 17, 2023
72917a9
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jul 17, 2023
c3dde1d
Add initial terrain manager component
JamesTKhan Jul 17, 2023
f83d2bf
Saving of terrain manager component
JamesTKhan Jul 17, 2023
29d8a97
Triplanar toggle
JamesTKhan Jul 17, 2023
49a6615
Add DTO to gwt commons.gwt.xml
JamesTKhan Jul 17, 2023
9058d9d
Add description label
JamesTKhan Jul 17, 2023
f6cddc6
Decouple mesh gen code from Terrain.java
JamesTKhan Jul 17, 2023
805d2fa
Support rectangle helper lines in terrain chunks
Dgzt Jul 22, 2023
347760d
Support hexagon helper lines in terrain chunks on X
Dgzt Jul 25, 2023
e101c34
Support hexagon helper lines in terrain chunks on Y
Dgzt Jul 26, 2023
529cab0
Redraw helper lines if change neighbor
Dgzt Jul 28, 2023
fee2a31
Fix fake line in the first line
Dgzt Jul 29, 2023
ee6b23d
Merge pull request #205 from Dgzt/terrain_chunks-helper-lines-support
JamesTKhan Aug 3, 2023
5ead1db
Handle error when loading
JamesTKhan Aug 11, 2023
b23c573
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Aug 11, 2023
d4f5d70
Fix heightmap terraforming
JamesTKhan Aug 11, 2023
33d423e
Add additive noise check box and functionality
freyinds Aug 31, 2023
52a251e
Merge pull request #237 from freyinds/terrain_chunks
JamesTKhan Sep 7, 2023
51abf4a
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Sep 14, 2023
527b09e
Merge conflict resolution
JamesTKhan Sep 14, 2023
630a573
Fis mouse event consuming
JamesTKhan Sep 14, 2023
048ad7c
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Sep 29, 2023
a18b284
Merge fix
JamesTKhan Sep 29, 2023
3fef908
Reapply noises on terrain chunks (#238)
Dgzt Sep 29, 2023
2d9afad
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Sep 30, 2023
0899e2f
Fix saving changes on generation dialog
JamesTKhan Oct 1, 2023
f1959c5
Initial push for MeshOpt Terrain LoD system
JamesTKhan Oct 1, 2023
1d2b8ee
Code analysis adjustments
JamesTKhan Oct 1, 2023
5adb609
make more readable
JamesTKhan Oct 1, 2023
d754a33
Safety nets
JamesTKhan Oct 1, 2023
9632cdd
Fix undo/redo on terrain heights
JamesTKhan Oct 4, 2023
7cd9ecd
Merge remote-tracking branch 'origin/terrain_chunks' into terrain_chu…
JamesTKhan Oct 4, 2023
4c62cbd
Use LevelOfDetailScheduler
JamesTKhan Oct 4, 2023
1900fea
LodWidget and various improvements
JamesTKhan Oct 5, 2023
5d8e8f7
Temporarily Disable LoD on undo/redo
JamesTKhan Oct 5, 2023
f150236
Fix ramp tool breaking seams
JamesTKhan Oct 5, 2023
19054ac
Fix brushes on scaled terrains
JamesTKhan Oct 5, 2023
a28fd2a
Merge remote-tracking branch 'origin/terrain_chunks' into terrain_chu…
JamesTKhan Oct 5, 2023
bc8c8db
LoD Listener and other improvements
JamesTKhan Oct 5, 2023
3c6ece7
Make LoD GWT compatible
JamesTKhan Oct 5, 2023
d5e4e99
Add LoD Dialog
JamesTKhan Oct 6, 2023
ce580c3
Scheduling and disable LoD improvements
JamesTKhan Oct 6, 2023
04351bc
Add multiple terrain checkbox to new terrain dialog (#256)
Dgzt Oct 6, 2023
e96ad75
Merge remote-tracking branch 'origin/terrain_chunks' into terrain_chu…
JamesTKhan Oct 6, 2023
67d0f9a
Add LoD checkbox to generation
JamesTKhan Oct 6, 2023
9b73529
Scale simplification factor on terrain height
JamesTKhan Oct 6, 2023
a4de78f
Remove debug logging
JamesTKhan Oct 6, 2023
1be976d
Code Doc cleanup
JamesTKhan Oct 6, 2023
47bbae3
Fix visibility
JamesTKhan Oct 7, 2023
10b393b
Merge pull request #254 from JamesTKhan/terrain_chunks_meshoptimizer
JamesTKhan Oct 18, 2023
45206a1
Mouse position fix
Dgzt Oct 19, 2023
7a0e68b
Use OBB for frustum culling
JamesTKhan Oct 19, 2023
15d688b
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Oct 19, 2023
1e8aa7d
Merge pull request #262 from Dgzt/terrain_chunks_mouse_position_fix
JamesTKhan Oct 19, 2023
ebabafb
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Nov 26, 2023
24d295c
Merge remote-tracking branch 'origin/terrain_chunks' into terrain_chunks
JamesTKhan Nov 26, 2023
553656e
Merge fixes
JamesTKhan Nov 26, 2023
a21590a
Hide Edit button on terrain layer asset edit widget
Dgzt Dec 2, 2023
7547b80
Merge pull request #283 from Dgzt/terrain_chunks-hide-edit-button-on-…
JamesTKhan Jan 31, 2024
389f7f6
Merge remote-tracking branch 'origin/master' into terrain_chunks
JamesTKhan Jan 31, 2024
f32ca60
Don't generate LoD if it's checkbox is not enabled
Dgzt Feb 6, 2024
dec9835
Merge pull request #286 from Dgzt/terrain_chunks_terrain_generating_w…
JamesTKhan Apr 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ allprojects {
commonsLangVersion = '3.12.0'
gltfVersion = '2.1.0'
args4jVersion = '2.33'
lwjgl3Version = "3.3.2" // For MeshOptimizer

ktxVersion = '1.12.0-rc1'
}
Expand Down Expand Up @@ -91,6 +92,15 @@ project(":editor") {
implementation "com.esotericsoftware:kryo:$kryoVersion"
implementation "args4j:args4j:$args4jVersion"

api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-linux"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-linux-arm32"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-linux-arm64"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-macos"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-macos-arm64"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-windows"
api "org.lwjgl:lwjgl-meshoptimizer:$lwjgl3Version:natives-windows-x86"

// tests
testImplementation "junit:junit:$junitVersion"
testImplementation "org.mockito:mockito-all:$mockitoVersion"
Expand Down
13 changes: 13 additions & 0 deletions commons/src/main/com/mbrlabs/mundus/commons/assets/Asset.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,17 @@ public String toString() {
*/
public abstract void applyDependencies();

/**
* Returns the loading priority of this asset. Some assets need to be loaded
* before others, e.g. a material asset needs to be loaded before a Model
*
* @return the loading priority of this asset
*/
public int getLoadingPriority() {
if (this instanceof MaterialAsset || this instanceof TerrainLayerAsset) {
return 1;
}
return 2;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import java.io.File;
import java.io.FileFilter;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -267,12 +268,9 @@ protected void queueAssetForLoading(Meta m) {
TerrainLoader.TerrainParameter terrainParameter = new TerrainLoader.TerrainParameter(m.getTerrain());
gdxAssetManager.load(filePath, Terrain.class, terrainParameter);
case MATERIAL:
// loads synchronously
break;
case WATER:
// loads synchronously
break;
case TERRAIN_LAYER:
case SKYBOX:
case WATER:
// loads synchronously
break;
}
Expand Down Expand Up @@ -312,17 +310,16 @@ public void finalizeLoad() throws AssetNotFoundException, MetaFileParseException
loadAsset(metaLoader.load(meta));
}

// resolve material assets
for (Asset asset : assets) {
if (asset instanceof MaterialAsset) {
asset.resolveDependencies(assetIndex);
asset.applyDependencies();
// Sort assets by loading priority
assets.sort(new Comparator<Asset>() {
@Override
public int compare(Asset a1, Asset a2) {
return Integer.compare(a1.getLoadingPriority(), a2.getLoadingPriority());
}
}
});

// resolve other assets
// resolve assets
for (Asset asset : assets) {
if (asset instanceof MaterialAsset) continue;
if (asset instanceof ModelAsset) {
int modelBones = asset.getMeta().getModel().getNumBones();
maxNumBones = Math.max(modelBones, maxNumBones);
Expand Down Expand Up @@ -384,6 +381,9 @@ public Asset loadAsset(Meta meta) throws AssetNotFoundException {
case TERRAIN:
asset = loadTerrainAsset(meta, assetFile);
break;
case TERRAIN_LAYER:
asset = loadTerrainLayerAsset(meta, assetFile);
break;
case MODEL:
asset = loadModelAsset(meta, assetFile);
break;
Expand Down Expand Up @@ -431,6 +431,12 @@ private TerrainAsset loadTerrainAsset(Meta meta, FileHandle assetFile) {
return asset;
}

private TerrainLayerAsset loadTerrainLayerAsset(Meta meta, FileHandle assetFile) {
TerrainLayerAsset asset = new TerrainLayerAsset(meta, assetFile);
asset.load(gdxAssetManager);
return asset;
}

private PixmapTextureAsset loadPixmapTextureAsset(Meta meta, FileHandle assetFile) {
PixmapTextureAsset asset = new PixmapTextureAsset(meta, assetFile);
asset.load(gdxAssetManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.mbrlabs.mundus.commons.assets;

import com.mbrlabs.mundus.commons.shadows.ShadowResolution;

/**
* @author Marcus Brummer
* @version 01-10-2016
Expand All @@ -36,7 +34,9 @@ public enum AssetType {
/** Water file. Contains data for water. */
WATER("Water"),
/** Skybox file. Holds reference to skybox textures. **/
SKYBOX("Skybox");
SKYBOX("Skybox"),
/** Holds the terrain textures to be used. **/
TERRAIN_LAYER("Terrain Layer");

private final String value;

Expand Down
Loading