multiple visual lod levels
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
33cfc3601b
commit
11b519ef79
@ -1968,6 +1968,7 @@ Performance improvements
|
|||||||
- Character services references set of already-loaded characters when simulating macro data
|
- Character services references set of already-loaded characters when simulating macro data
|
||||||
- Normal outline pipeline use draw accumulator
|
- Normal outline pipeline use draw accumulator
|
||||||
- Reduced the visual LOD cutoff
|
- Reduced the visual LOD cutoff
|
||||||
|
- Multiple visual LOD levels
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,9 @@ public class ClientSimulation {
|
|||||||
Globals.profiler.beginCpuSample("update actor animations");
|
Globals.profiler.beginCpuSample("update actor animations");
|
||||||
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
|
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
|
if(currentActor.getLodLevel() == Actor.LOD_LEVEL_STATIC){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(currentActor.isPlayingAnimation()){
|
if(currentActor.isPlayingAnimation()){
|
||||||
currentActor.incrementAnimationTime((float)Globals.engineState.timekeeper.getSimFrameTime());
|
currentActor.incrementAnimationTime((float)Globals.engineState.timekeeper.getSimFrameTime());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,12 +47,17 @@ public class Actor {
|
|||||||
/**
|
/**
|
||||||
* full-resolution lod level
|
* full-resolution lod level
|
||||||
*/
|
*/
|
||||||
public static final int LOD_LEVEL_FULL = 1;
|
public static final int LOD_LEVEL_FULL = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lower-resolution lod level
|
* lower-resolution lod level
|
||||||
*/
|
*/
|
||||||
public static final int LOD_LEVEL_LOWER = 0;
|
public static final int LOD_LEVEL_LOWER = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs static draw
|
||||||
|
*/
|
||||||
|
public static final int LOD_LEVEL_STATIC = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -523,7 +528,7 @@ public class Actor {
|
|||||||
|
|
||||||
//fetch the model
|
//fetch the model
|
||||||
String pathToFetch = this.modelPath;
|
String pathToFetch = this.modelPath;
|
||||||
if(this.lodLevel == Actor.LOD_LEVEL_LOWER && this.lowResPath != null){
|
if(this.lodLevel <= Actor.LOD_LEVEL_LOWER && this.lowResPath != null){
|
||||||
pathToFetch = this.lowResPath;
|
pathToFetch = this.lowResPath;
|
||||||
}
|
}
|
||||||
Model model = Globals.assetManager.fetchModel(pathToFetch);
|
Model model = Globals.assetManager.fetchModel(pathToFetch);
|
||||||
@ -581,7 +586,7 @@ public class Actor {
|
|||||||
public boolean isStaticDrawCall(){
|
public boolean isStaticDrawCall(){
|
||||||
return
|
return
|
||||||
//is low lod level
|
//is low lod level
|
||||||
this.lodLevel == Actor.LOD_LEVEL_LOWER ||
|
this.lodLevel == Actor.LOD_LEVEL_STATIC ||
|
||||||
//actor doesn't have anything complicated render-wise (animations, custom textures, etc)
|
//actor doesn't have anything complicated render-wise (animations, custom textures, etc)
|
||||||
(
|
(
|
||||||
this.animationQueue.size() == 0 &&
|
this.animationQueue.size() == 0 &&
|
||||||
|
|||||||
@ -26,7 +26,12 @@ public class DrawTargetEvaluator {
|
|||||||
/**
|
/**
|
||||||
* Cutoff after which we start using LOD models
|
* Cutoff after which we start using LOD models
|
||||||
*/
|
*/
|
||||||
public static final int LOD_CUTOFF = 50;
|
public static final int LOD_STATIC_CUTOFF = 50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cutoff after which we draw lower resolution models
|
||||||
|
*/
|
||||||
|
public static final int LOD_LOWER_CUTOFF = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates the draw targets
|
* Evaluates the draw targets
|
||||||
@ -75,10 +80,12 @@ public class DrawTargetEvaluator {
|
|||||||
|
|
||||||
//evaluate LOD level
|
//evaluate LOD level
|
||||||
if(currentActor.getLowResPath() != null){
|
if(currentActor.getLowResPath() != null){
|
||||||
if(dist < LOD_CUTOFF){
|
if(dist < LOD_LOWER_CUTOFF){
|
||||||
currentActor.setLodLevel(Actor.LOD_LEVEL_FULL);
|
currentActor.setLodLevel(Actor.LOD_LEVEL_FULL);
|
||||||
} else {
|
} else if(dist < LOD_STATIC_CUTOFF) {
|
||||||
currentActor.setLodLevel(Actor.LOD_LEVEL_LOWER);
|
currentActor.setLodLevel(Actor.LOD_LEVEL_LOWER);
|
||||||
|
} else {
|
||||||
|
currentActor.setLodLevel(Actor.LOD_LEVEL_STATIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user