simplify draw call logic
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-29 15:53:07 -04:00
parent f7d8072122
commit 897b867641
3 changed files with 39 additions and 25 deletions

View File

@ -2061,6 +2061,8 @@ More tests
Move actor masks into dedicated package
Actor code cleanup
Refactor animation logic into dedicated actor class
Simplify draw call logic
Error report on window.java

View File

@ -173,22 +173,32 @@ public class Actor {
public void draw(RenderPipelineState renderPipelineState, OpenGLState openGLState){
Globals.profiler.beginAggregateCpuSample("Actor.draw");
//
//fetch the model
String pathToFetch = this.baseModelPath;
if(this.lodLevel <= Actor.LOD_LEVEL_LOWER && this.lowResBaseModelPath != null){
pathToFetch = this.lowResBaseModelPath;
}
Model model = Globals.assetManager.fetchModel(pathToFetch);
if(model == null){
Globals.profiler.endCpuSample();
return;
}
//
//update core data on the model
model.setModelMatrix(this.modelMatrix);
model.setWorldPos(this.worldPos);
//frustum cull then draw
if(Actor.isWithinFrustumBox(renderPipelineState,model,frustumCull)){
//
//frustum cull
if(!Actor.isWithinFrustumBox(renderPipelineState,model,frustumCull)){
Globals.profiler.endCpuSample();
return;
}
//
//main draw logic
this.animationData.applyAnimationMasks(model);
meshMask.processMeshMaskQueue();
model.setMeshMask(meshMask);
@ -211,7 +221,6 @@ public class Actor {
model.draw(renderPipelineState,openGLState);
model.getShaderMask().clear();
model.setTextureMask(null);
}
Globals.profiler.endCpuSample();
}

View File

@ -631,6 +631,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
@Override
public void addChild(Element child) {
if(child.getParent() != null){
throw new Error("Child has a parent!");
}
childList.add(child);
child.setParent(this);
if(child instanceof DrawableElement){