Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
ab8c9e1
Initial structure for TerrainQuadTest
AlexanderGrooff Mar 16, 2016
7331b95
Added test for getQuad
AlexanderGrooff Mar 16, 2016
2f4b929
Tests for all children of root for findRightQuad
AlexanderGrooff Mar 16, 2016
0d56f93
Added tests for findDown, Left and Top quad
AlexanderGrooff Mar 16, 2016
3f74b58
Added parent findQuad tests
AlexanderGrooff Mar 16, 2016
0333703
lod test
BdeBock Mar 16, 2016
fbe6c8e
lod test
BdeBock Mar 16, 2016
5980a7d
Added FakeTerrainQuad with public getQuad method
AlexanderGrooff Mar 16, 2016
d01c559
Added method to create nested quads
AlexanderGrooff Mar 16, 2016
e5f5b41
Tests for all children of root for findRightQuad
AlexanderGrooff Mar 16, 2016
a4ef98f
Added tests for findDown, Left and Top quad
AlexanderGrooff Mar 16, 2016
c37003a
Added parent findQuad tests
AlexanderGrooff Mar 16, 2016
0ae84d8
lod test
BdeBock Mar 16, 2016
aab659e
lod test
BdeBock Mar 16, 2016
4b2538a
Changed tests to cover everything except useFinder lines
AlexanderGrooff Mar 16, 2016
61b82f7
Merge remote-tracking branch 'origin/test_findQuad' into test_findQuad
AlexanderGrooff Mar 16, 2016
de6d1de
Merge pull request #1 from AlexanderGrooff/test_findQuad
BdeBock Mar 18, 2016
ea54662
Added test for getPatch
AlexanderGrooff Mar 18, 2016
65929d9
Added exception variable and tests for findRightPatch
AlexanderGrooff Mar 18, 2016
669ec4f
Added null checks to getPatch and findRightPatch tests
AlexanderGrooff Mar 18, 2016
2f74803
Refactoring and Testing of createQuadPatch method in TerrainQuad.
BdeBock Mar 23, 2016
a9e539a
Merge remote-tracking branch 'origin/test_calculateLod' into test_cal…
BdeBock Mar 23, 2016
7515a97
Fixed exception assertion in patch tests
AlexanderGrooff Mar 23, 2016
7214fae
Added final patch tests
AlexanderGrooff Mar 23, 2016
e22dd16
First step of refactoring findQuad
AlexanderGrooff Mar 23, 2016
6fde442
Improved readability of findQuad, added test to compare new methods t…
AlexanderGrooff Mar 23, 2016
03e639a
Added functionality for neighbourfinder in all directions
AlexanderGrooff Mar 23, 2016
e9880da
createQuadPatch is refactored to setPatchChildren
BdeBock Mar 23, 2016
6b62d7d
Added Javadoc to the createQuadPatch methods.
BdeBock Mar 23, 2016
4ae6bf2
Added testclass for NeighbourFinder
AlexanderGrooff Mar 23, 2016
c8ec865
Add test for using NeighbourFinder in findQuad
AlexanderGrooff Mar 23, 2016
6744ad4
Refactored findDownQuad etc to findQuad(dir) in tests, and assured 10…
AlexanderGrooff Mar 23, 2016
c3d2bfe
Deprecated all findXQuad() methods
AlexanderGrooff Mar 23, 2016
2e54026
Refactored to findPatch methods in TerrainPatch
AlexanderGrooff Mar 30, 2016
af18050
Added comparison tests between old code and refactored code
AlexanderGrooff Mar 30, 2016
90dcab5
Removed dead test code
AlexanderGrooff Mar 30, 2016
6df3135
Added deprecated tags to old code
AlexanderGrooff Mar 30, 2016
e94b2e1
Set deprecated code back to tests and the code itself
AlexanderGrooff Mar 30, 2016
3837d1a
Added test coverage for the NeighbourFinder in the legacy code
AlexanderGrooff Mar 30, 2016
3517d1c
Reversed legacy code to its original code
AlexanderGrooff Mar 30, 2016
38c64ad
Changed existing code to use the new findPatch method
AlexanderGrooff Mar 30, 2016
5ef92d0
Merge pull request #2 from AlexanderGrooff/test_findPatch
BdeBock Mar 30, 2016
6e4c6a1
testGetHeightmapHeight
BdeBock Mar 30, 2016
37bad81
TerrainQuadTest updated
BdeBock Mar 30, 2016
104d093
Created new class QuadrantFinder to reduce duplicate code
AlexanderGrooff Mar 30, 2016
2e1dba7
Removed unused field `i` from QuadrantFinder class
AlexanderGrooff Mar 30, 2016
fce1632
Removed most duplicate code between fixEdges and findNeighboursLod
AlexanderGrooff Mar 30, 2016
3c13053
created getHeight test, to test the private method findMatchingChild …
BdeBock Mar 30, 2016
18747ab
fixed javadoc for tests
BdeBock Mar 31, 2016
9d1ea50
Merge pull request #3 from AlexanderGrooff/test_DRY_principles
BdeBock Mar 31, 2016
41cc9e7
Merge branch 'refactorings' into test_calculateLod
AlexanderGrooff Mar 31, 2016
1814799
Reverted refactorings merge
AlexanderGrooff Mar 31, 2016
0f4e481
Merge branch 'test_calculateLod' into refactorings
AlexanderGrooff Mar 31, 2016
e4415c3
Fixed auto-merge issues related to test_calculateLod
AlexanderGrooff Mar 31, 2016
a680b05
changed name of testCalculateLod to testHasLodChanged.
BdeBock Mar 31, 2016
4d07a53
hasLodChanged javadoc.
BdeBock Mar 31, 2016
da6135c
Merge pull request #5 from AlexanderGrooff/hasLodChanged_javadoc
BdeBock Mar 31, 2016
7073754
Added names to createNestedQuad, added first test for fixEdges
AlexanderGrooff Apr 9, 2016
8cd31b0
Improved testFixEdges
AlexanderGrooff Apr 9, 2016
844a034
Added test for findNeighboursLod
AlexanderGrooff Apr 9, 2016
33a2758
Added test for all setLod methods in UTP
AlexanderGrooff Apr 9, 2016
925a09f
Added setLod with test
AlexanderGrooff Apr 9, 2016
bb4d9b6
Added getNeighbours to TerrainPatch and refactored fixEdges
AlexanderGrooff Apr 9, 2016
e33dba8
Refactored findNeighboursLod
AlexanderGrooff Apr 9, 2016
dbf0ba8
Updated JavaDoc
AlexanderGrooff Apr 9, 2016
25ab700
Merge branch 'refactorings' into refactor-fixedges
AlexanderGrooff Apr 9, 2016
12da5b1
Fixed createNestedQuad update
AlexanderGrooff Apr 9, 2016
45f935a
Merge branch 'refactor-fixedges' into refactorings
AlexanderGrooff Apr 9, 2016
6c5b702
Fixed merge conflicts for refactor-fixedges branch
AlexanderGrooff Apr 9, 2016
9977cd0
Small bugfix
AlexanderGrooff Apr 9, 2016
fd993c1
Merge pull request #7 from AlexanderGrooff/terrainquadtest-hotfix
AlexanderGrooff Apr 9, 2016
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
619 changes: 619 additions & 0 deletions Test Results - TerrainQuadTest.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 01 20:04:11 EST 2014
#Wed Mar 16 12:05:41 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
15 changes: 8 additions & 7 deletions jme3-core/src/main/resources/com/jme3/system/version.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# THIS IS AN AUTO-GENERATED FILE..
# DO NOT MODIFY!
build.date=1900-01-01
git.revision=0
git.branch=unknown
git.hash=
git.hash.short=
git.tag=
name.full=jMonkeyEngine 3.1.0-UNKNOWN
build.date=2016-03-16
git.revision=5475
git.branch=refactorings
git.hash=10947e8b5096f6d7e2bf0e327faa43b275adeb34
git.hash.short=10947e8
git.tag=null
name.full=jMonkeyEngine 3.1-refactorings-5475
version.full=3.1-refactorings-5475
version.number=3.1.0
version.tag=SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,14 @@ public void simpleInitApp() {
*/
terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
TerrainLodControl control = new TerrainLodControl(terrain, getCamera());
control.setLodCalculator( new DistanceLodCalculator(65, 2.7f) ); // patch size, and a multiplier
control.setLodCalculator(new DistanceLodCalculator(65, 2.7f)); // patch size, and a multiplier
terrain.addControl(control);
terrain.setMaterial(matRock);
terrain.setLocalTranslation(0, -100, 0);
terrain.setLocalScale(2f, 0.5f, 2f);
rootNode.attachChild(terrain);


DirectionalLight light = new DirectionalLight();
light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
rootNode.addLight(light);
Expand All @@ -187,6 +188,7 @@ private void setupKeys() {
inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
inputManager.addListener(actionListener, "triPlanar");
}

private ActionListener actionListener = new ActionListener() {

public void onAction(String name, boolean pressed, float tpf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@
import com.jme3.renderer.Camera;
import com.jme3.terrain.geomipmap.lodcalc.DistanceLodCalculator;
import com.jme3.terrain.geomipmap.lodcalc.LodCalculator;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
* An extension of the TerrainLodControl that handles
* multiple terrains at once. This is to be used if you
* multiple terrains at once. This is to be used if you
* have your own tiling/paging terrain system, such as
* TerrainGrid.
*
*
* @author Brent Owens
*/
public class MultiTerrainLodControl extends TerrainLodControl {

List<TerrainQuad> terrains = new ArrayList<TerrainQuad>();
private List<TerrainQuad> addedTerrains = new ArrayList<TerrainQuad>();
private List<TerrainQuad> removedTerrains = new ArrayList<TerrainQuad>();
Expand All @@ -64,7 +65,7 @@ public MultiTerrainLodControl(Camera camera) {
this.cameras = cams;
lodCalculator = new DistanceLodCalculator(65, 2.7f);
}

/**
* Add a terrain that will have its LOD handled by this control.
* It will be added next update run. You should only call this from
Expand All @@ -73,7 +74,7 @@ public MultiTerrainLodControl(Camera camera) {
public void addTerrain(TerrainQuad tq) {
addedTerrains.add(tq);
}

/**
* Add a terrain that will no longer have its LOD handled by this control.
* It will be removed next update run. You should only call this from
Expand All @@ -82,12 +83,12 @@ public void addTerrain(TerrainQuad tq) {
public void removeTerrain(TerrainQuad tq) {
removedTerrains.add(tq);
}

@Override
protected UpdateLOD getLodThread(List<Vector3f> locations, LodCalculator lodCalculator) {
return new UpdateMultiLOD(locations, lodCalculator);
}

@Override
protected void prepareTerrain() {
if (!addedTerrains.isEmpty()) {
Expand All @@ -97,57 +98,57 @@ protected void prepareTerrain() {
}
addedTerrains.clear();
}

if (!removedTerrains.isEmpty()) {
terrains.removeAll(removedTerrains);
removedTerrains.clear();
}

for (TerrainQuad terrain : terrains)
terrain.cacheTerrainTransforms();// cache the terrain's world transforms so they can be accessed on the separate thread safely
}

/**
* Overrides the parent UpdateLOD runnable to process
* multiple terrains.
*/
protected class UpdateMultiLOD extends UpdateLOD {


protected UpdateMultiLOD(List<Vector3f> camLocations, LodCalculator lodCalculator) {
super(camLocations, lodCalculator);
}

@Override
public HashMap<String, UpdatedTerrainPatch> call() throws Exception {

setLodCalcRunning(true);
HashMap<String,UpdatedTerrainPatch> updated = new HashMap<String,UpdatedTerrainPatch>();

HashMap<String, UpdatedTerrainPatch> updated = new HashMap<String, UpdatedTerrainPatch>();

for (TerrainQuad terrainQuad : terrains) {
// go through each patch and calculate its LOD based on camera distance
terrainQuad.calculateLod(camLocations, updated, lodCalculator); // 'updated' gets populated here
terrainQuad.hasLodChanged(camLocations, updated, lodCalculator); // 'updated' gets populated here
}

for (TerrainQuad terrainQuad : terrains) {
// then calculate the neighbour LOD values for seaming
terrainQuad.findNeighboursLod(updated);
}

for (TerrainQuad terrainQuad : terrains) {
// check neighbour quads that need their edges seamed
terrainQuad.fixEdges(updated);
}

for (TerrainQuad terrainQuad : terrains) {
// perform the edge seaming, if it requires it
terrainQuad.reIndexPages(updated, lodCalculator.usesVariableLod());
}

//setUpdateQuadLODs(updated); // set back to main ogl thread
setLodCalcRunning(false);

return updated;
}
}
Expand Down
Loading