lod emitter service work
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
11b519ef79
commit
f29638ad00
@ -1969,6 +1969,7 @@ Performance improvements
|
|||||||
- 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
|
- Multiple visual LOD levels
|
||||||
|
Lod emitter service checker function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -54,15 +54,7 @@ public class ServerLODComponent implements BehaviorTree {
|
|||||||
@Override
|
@Override
|
||||||
public void simulate(float deltaTime) {
|
public void simulate(float deltaTime) {
|
||||||
Vector3d parentLoc = EntityUtils.getPosition(this.parent);
|
Vector3d parentLoc = EntityUtils.getPosition(this.parent);
|
||||||
boolean fullRes = false;
|
boolean fullRes = Globals.serverState.lodEmitterService.isFullLod(parentLoc);
|
||||||
for(Entity emitter : Globals.serverState.lodEmitterService.getEmitters()){
|
|
||||||
Vector3d emitterLoc = EntityUtils.getPosition(emitter);
|
|
||||||
double dist = parentLoc.distance(emitterLoc);
|
|
||||||
if(dist < LOD_RADIUS){
|
|
||||||
fullRes = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(fullRes){
|
if(fullRes){
|
||||||
if(lodLevel != FULL_RES){
|
if(lodLevel != FULL_RES){
|
||||||
//make full res
|
//make full res
|
||||||
|
|||||||
@ -5,9 +5,14 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.signal.Signal.SignalType;
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
import electrosphere.engine.signal.SignalServiceImpl;
|
import electrosphere.engine.signal.SignalServiceImpl;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
|
import electrosphere.entity.EntityUtils;
|
||||||
|
import electrosphere.entity.state.lod.ServerLODComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages lod emitters
|
* Manages lod emitters
|
||||||
@ -63,4 +68,20 @@ public class LODEmitterService extends SignalServiceImpl {
|
|||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a given position would be full LOD
|
||||||
|
* @param position The position
|
||||||
|
* @return true if it is full lod, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean isFullLod(Vector3d position){
|
||||||
|
for(Entity emitter : Globals.serverState.lodEmitterService.getEmitters()){
|
||||||
|
Vector3d emitterLoc = EntityUtils.getPosition(emitter);
|
||||||
|
double dist = position.distance(emitterLoc);
|
||||||
|
if(dist < ServerLODComponent.FULL_RES){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user