Make generic renderer level dependent
This commit is contained in:
@@ -128,11 +128,11 @@ public class DhApi
|
||||
*/
|
||||
public static IDhApiWrapperFactory wrapperFactory = null;
|
||||
|
||||
/**
|
||||
* Used to add custom objects to DH's render pass.
|
||||
* @since API 3.0.0
|
||||
*/
|
||||
public static IDhApiCustomRenderRegister renderRegister = null;
|
||||
///**
|
||||
// * Used to add custom objects to DH's render pass.
|
||||
// * @since API 3.0.0
|
||||
// */
|
||||
//public static IDhApiCustomRenderRegister renderRegister = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class Initializer
|
||||
DhApi.Delayed.terrainRepo = DhApiTerrainDataRepo.INSTANCE;
|
||||
DhApi.Delayed.worldProxy = DhApiWorldProxy.INSTANCE;
|
||||
DhApi.Delayed.renderProxy = DhApiRenderProxy.INSTANCE;
|
||||
DhApi.Delayed.renderRegister = GenericObjectRenderer.INSTANCE;
|
||||
//DhApi.Delayed.renderRegister = GenericObjectRenderer.INSTANCE;
|
||||
DhApi.Delayed.wrapperFactory = SingletonInjector.INSTANCE.get(IWrapperFactory.class);
|
||||
if (DhApi.Delayed.wrapperFactory == null)
|
||||
{
|
||||
|
||||
@@ -206,8 +206,9 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
@Override
|
||||
public void setBeaconBeamsForChunk(DhChunkPos chunkPos, List<BeaconBeamDTO> newBeamList)
|
||||
{
|
||||
long pos = DhSectionPos.encode(chunkPos);
|
||||
if (this.beaconBeamRepo != null)
|
||||
GenericObjectRenderer genericObjectRenderer = this.getGenericRenderer();
|
||||
if (this.beaconBeamRepo != null
|
||||
&& genericObjectRenderer != null)
|
||||
{
|
||||
HashSet<DhBlockPos> allPosSet = new HashSet<>();
|
||||
|
||||
@@ -252,7 +253,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
// new beam found, add to DB
|
||||
this.beaconBeamRepo.save(newBeam);
|
||||
|
||||
IDhApiRenderableBoxGroup beaconBox = GenericObjectRenderer.INSTANCE.createForSingleBox(new DhApiRenderableBox(
|
||||
IDhApiRenderableBoxGroup beaconBox = genericObjectRenderer.createForSingleBox(new DhApiRenderableBox(
|
||||
new DhApiVec3f(newBeam.pos.x, newBeam.pos.y+1, newBeam.pos.z),
|
||||
new DhApiVec3f(newBeam.pos.x+1, 6_000, newBeam.pos.z+1),
|
||||
newBeam.color
|
||||
@@ -271,7 +272,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
return refCount;
|
||||
});
|
||||
|
||||
GenericObjectRenderer.INSTANCE.add(beaconBox);
|
||||
genericObjectRenderer.add(beaconBox);
|
||||
}
|
||||
else if (existingBeam != null && newBeam == null)
|
||||
{
|
||||
@@ -281,7 +282,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
IDhApiRenderableBoxGroup beaconBox = this.beamRenderGroupByBlockPos.remove(existingBeam.pos);
|
||||
if (beaconBox != null)
|
||||
{
|
||||
GenericObjectRenderer.INSTANCE.remove(beaconBox.getId());
|
||||
genericObjectRenderer.remove(beaconBox.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +294,9 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
@Override
|
||||
public void loadBeaconBeamsInPos(long pos)
|
||||
{
|
||||
if (this.beaconBeamRepo != null)
|
||||
GenericObjectRenderer genericObjectRenderer = this.getGenericRenderer();
|
||||
if (this.beaconBeamRepo != null
|
||||
&& genericObjectRenderer != null)
|
||||
{
|
||||
// get beams in pos
|
||||
List<BeaconBeamDTO> existingBeamList = this.beaconBeamRepo.getAllBeamsForPos(pos);
|
||||
@@ -301,7 +304,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
{
|
||||
BeaconBeamDTO beam = existingBeamList.get(i);
|
||||
|
||||
IDhApiRenderableBoxGroup beaconBox = GenericObjectRenderer.INSTANCE.createForSingleBox(new DhApiRenderableBox(
|
||||
IDhApiRenderableBoxGroup beaconBox = genericObjectRenderer.createForSingleBox(new DhApiRenderableBox(
|
||||
new DhApiVec3f(beam.pos.x, beam.pos.y+1, beam.pos.z),
|
||||
new DhApiVec3f(beam.pos.x+1, 6_000, beam.pos.z+1),
|
||||
beam.color
|
||||
@@ -319,7 +322,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
if (refCount.getAndIncrement() == 0)
|
||||
{
|
||||
this.beamRenderGroupByBlockPos.put(beam.pos, beaconBox);
|
||||
GenericObjectRenderer.INSTANCE.add(beaconBox);
|
||||
genericObjectRenderer.add(beaconBox);
|
||||
}
|
||||
|
||||
return refCount;
|
||||
@@ -331,7 +334,9 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
@Override
|
||||
public void unloadBeaconBeamsInPos(long pos)
|
||||
{
|
||||
if (this.beaconBeamRepo != null)
|
||||
GenericObjectRenderer genericObjectRenderer = this.getGenericRenderer();
|
||||
if (this.beaconBeamRepo != null
|
||||
&& genericObjectRenderer != null)
|
||||
{
|
||||
// get beams in pos
|
||||
List<BeaconBeamDTO> existingBeamList = this.beaconBeamRepo.getAllBeamsForPos(pos);
|
||||
@@ -352,7 +357,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
IDhApiRenderableBoxGroup beaconBox = this.beamRenderGroupByBlockPos.remove(beam.pos);
|
||||
if (beaconBox != null)
|
||||
{
|
||||
GenericObjectRenderer.INSTANCE.remove(beaconBox.getId());
|
||||
genericObjectRenderer.remove(beaconBox.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,12 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.file.AbstractDataSourceHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.render.LodQuadTree;
|
||||
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.renderer.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.LodRenderer;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
@@ -41,9 +40,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.WillNotClose;
|
||||
import java.io.Closeable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.IDataSourceUpdateFunc<FullDataSourceV2>
|
||||
@@ -128,7 +125,7 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
}
|
||||
if (isBuffersDirty)
|
||||
{
|
||||
clientRenderState.renderer.bufferHandler.MarkAllBuffersDirty();
|
||||
clientRenderState.lodRenderer.bufferHandler.MarkAllBuffersDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +164,7 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
// either the renderer hasn't been started yet, or is being reloaded
|
||||
return;
|
||||
}
|
||||
ClientRenderState.renderer.drawLods(ClientRenderState.clientLevelWrapper, renderEventParam, profiler);
|
||||
ClientRenderState.lodRenderer.drawLods(ClientRenderState.clientLevelWrapper, renderEventParam, profiler);
|
||||
}
|
||||
|
||||
public void renderDeferred(DhApiRenderParam renderEventParam, IProfilerWrapper profiler)
|
||||
@@ -178,7 +175,7 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
// either the renderer hasn't been started yet, or is being reloaded
|
||||
return;
|
||||
}
|
||||
ClientRenderState.renderer.drawDeferredLods(ClientRenderState.clientLevelWrapper, renderEventParam, profiler);
|
||||
ClientRenderState.lodRenderer.drawDeferredLods(ClientRenderState.clientLevelWrapper, renderEventParam, profiler);
|
||||
}
|
||||
|
||||
public void stopRenderer()
|
||||
@@ -275,13 +272,20 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
// helper classes //
|
||||
//================//
|
||||
|
||||
public static class ClientRenderState
|
||||
public static class ClientRenderState implements Closeable
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
public final IClientLevelWrapper clientLevelWrapper;
|
||||
public final LodQuadTree quadtree;
|
||||
public final LodRenderer renderer;
|
||||
public final LodRenderer lodRenderer;
|
||||
public final GenericObjectRenderer genericRenderer;
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public ClientRenderState(IDhClientLevel dhClientLevel, IClientLevelWrapper clientLevelWrapper, FullDataSourceProviderV2 fullDataSourceProvider)
|
||||
{
|
||||
@@ -293,16 +297,22 @@ public class ClientLevelModule implements Closeable, AbstractDataSourceHandler.I
|
||||
fullDataSourceProvider);
|
||||
|
||||
RenderBufferHandler renderBufferHandler = new RenderBufferHandler(this.quadtree);
|
||||
this.renderer = new LodRenderer(renderBufferHandler);
|
||||
this.genericRenderer = new GenericObjectRenderer();
|
||||
this.lodRenderer = new LodRenderer(renderBufferHandler, this.genericRenderer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// base overrides //
|
||||
//================//
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
LOGGER.info("Shutting down " + ClientRenderState.class.getSimpleName());
|
||||
|
||||
this.renderer.close();
|
||||
this.lodRenderer.close();
|
||||
this.quadtree.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.seibel.distanthorizons.core.file.fullDatafile.RemoteFullDataSourcePro
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
@@ -170,4 +171,11 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
public boolean hasSkyLight() { return this.levelWrapper.hasSkyLight(); }
|
||||
|
||||
|
||||
@Override
|
||||
public GenericObjectRenderer getGenericRenderer()
|
||||
{
|
||||
ClientLevelModule.ClientRenderState renderState = this.clientside.ClientRenderStateRef.get();
|
||||
return (renderState != null) ? renderState.genericRenderer : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.render.renderer.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -102,20 +103,7 @@ public class DhClientServerLevel extends AbstractDhLevel implements IDhClientLev
|
||||
if (shouldDoWorldGen && !isWorldGenRunning)
|
||||
{
|
||||
// start world gen
|
||||
|
||||
// create a new queue
|
||||
this.serverside.worldGenModule.startWorldGen(this.serverside.fullDataFileHandler, new ServerLevelModule.WorldGenState(this));
|
||||
|
||||
// TODO I think this used to queue the world gen
|
||||
// is it still needed?
|
||||
// populate the queue based on the current rendering tree
|
||||
//ClientLevelModule.ClientRenderState renderState = this.clientside.ClientRenderStateRef.get();
|
||||
//Iterator<QuadNode<LodRenderSection>> iterator = renderState.quadtree.leafNodeIterator();
|
||||
//while (iterator.hasNext())
|
||||
//{
|
||||
// QuadNode<LodRenderSection> node = iterator.next();
|
||||
// //this.serverside.dataFileHandler.getAsync(node.sectionPos);
|
||||
//}
|
||||
}
|
||||
else if (!shouldDoWorldGen && isWorldGenRunning)
|
||||
{
|
||||
@@ -237,6 +225,14 @@ public class DhClientServerLevel extends AbstractDhLevel implements IDhClientLev
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GenericObjectRenderer getGenericRenderer()
|
||||
{
|
||||
ClientLevelModule.ClientRenderState renderState = this.clientside.ClientRenderStateRef.get();
|
||||
return (renderState != null) ? renderState.genericRenderer : null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// data handling //
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.render.renderer.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -116,6 +117,13 @@ public class DhServerLevel extends AbstractDhLevel implements IDhServerLevel
|
||||
//TODO: Send packet to client
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericObjectRenderer getGenericRenderer()
|
||||
{
|
||||
// server-only levels don't support rendering
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===========//
|
||||
|
||||
@@ -19,13 +19,16 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.render.IDhApiCustomRenderRegister;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -66,5 +69,11 @@ public interface IDhLevel extends AutoCloseable
|
||||
|
||||
void addDebugMenuStringsToList(List<String> messageList);
|
||||
|
||||
/**
|
||||
* Will return null if the renderer isn't set up yet. <br>
|
||||
* Not supported on the server-side.
|
||||
*/
|
||||
@Nullable
|
||||
GenericObjectRenderer getGenericRenderer();
|
||||
|
||||
}
|
||||
|
||||
+24
-28
@@ -74,10 +74,6 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
{
|
||||
// TODO should be level specific, not global
|
||||
@Deprecated
|
||||
public static GenericObjectRenderer INSTANCE = new GenericObjectRenderer();
|
||||
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
public static final ConfigBasedSpamLogger SPAM_LOGGER = new ConfigBasedSpamLogger(LogManager.getLogger(GenericObjectRenderer.class), () -> EDhApiLoggerMode.LOG_ALL_TO_CHAT, 1);
|
||||
|
||||
@@ -164,7 +160,7 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
private GenericObjectRenderer() { }
|
||||
public GenericObjectRenderer() { }
|
||||
|
||||
public void init()
|
||||
{
|
||||
@@ -237,27 +233,27 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
private void addGenericDebugObjects()
|
||||
{
|
||||
// single giant box
|
||||
IDhApiRenderableBoxGroup singleGiantBoxGroup = DhApi.Delayed.renderRegister.createForSingleBox(
|
||||
IDhApiRenderableBoxGroup singleGiantBoxGroup = this.createForSingleBox(
|
||||
new DhApiRenderableBox(
|
||||
new DhApiVec3f(0f,0f,0f), new DhApiVec3f(16f,190f,16f),
|
||||
new Color(Color.CYAN.getRed(), Color.CYAN.getGreen(), Color.CYAN.getBlue(), 125))
|
||||
);
|
||||
singleGiantBoxGroup.setSkyLight(LodUtil.MAX_MC_LIGHT);
|
||||
singleGiantBoxGroup.setBlockLight(LodUtil.MAX_MC_LIGHT);
|
||||
DhApi.Delayed.renderRegister.add(singleGiantBoxGroup);
|
||||
|
||||
|
||||
this.add(singleGiantBoxGroup);
|
||||
|
||||
|
||||
// single slender box
|
||||
IDhApiRenderableBoxGroup singleTallBoxGroup = DhApi.Delayed.renderRegister.createForSingleBox(
|
||||
IDhApiRenderableBoxGroup singleTallBoxGroup = this.createForSingleBox(
|
||||
new DhApiRenderableBox(
|
||||
new DhApiVec3f(16f,0f,31f), new DhApiVec3f(17f,2000f,32f),
|
||||
new Color(Color.GREEN.getRed(), Color.GREEN.getGreen(), Color.GREEN.getBlue(), 125))
|
||||
);
|
||||
singleTallBoxGroup.setSkyLight(LodUtil.MAX_MC_LIGHT);
|
||||
singleTallBoxGroup.setBlockLight(LodUtil.MAX_MC_LIGHT);
|
||||
DhApi.Delayed.renderRegister.add(singleTallBoxGroup);
|
||||
|
||||
|
||||
this.add(singleTallBoxGroup);
|
||||
|
||||
|
||||
// absolute box group
|
||||
ArrayList<DhApiRenderableBox> absBoxList = new ArrayList<>();
|
||||
for (int i = 0; i < 18; i++)
|
||||
@@ -266,10 +262,10 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
new DhApiVec3f(0f+i,150f+i,24f), new DhApiVec3f(1f+i,151f+i,25f),
|
||||
new Color(Color.ORANGE.getRed(), Color.ORANGE.getGreen(), Color.ORANGE.getBlue())));
|
||||
}
|
||||
IDhApiRenderableBoxGroup absolutePosBoxGroup = DhApi.Delayed.renderRegister.createAbsolutePositionedGroup(absBoxList);
|
||||
DhApi.Delayed.renderRegister.add(absolutePosBoxGroup);
|
||||
|
||||
|
||||
IDhApiRenderableBoxGroup absolutePosBoxGroup = this.createAbsolutePositionedGroup(absBoxList);
|
||||
this.add(absolutePosBoxGroup);
|
||||
|
||||
|
||||
// relative box group
|
||||
ArrayList<DhApiRenderableBox> relBoxList = new ArrayList<>();
|
||||
for (int i = 0; i < 8; i+=2)
|
||||
@@ -278,7 +274,7 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
new DhApiVec3f(0f,0f+i,0f), new DhApiVec3f(1f,1f+i,1f),
|
||||
new Color(Color.MAGENTA.getRed(), Color.MAGENTA.getGreen(), Color.MAGENTA.getBlue())));
|
||||
}
|
||||
IDhApiRenderableBoxGroup relativePosBoxGroup = DhApi.Delayed.renderRegister.createRelativePositionedGroup(
|
||||
IDhApiRenderableBoxGroup relativePosBoxGroup = this.createRelativePositionedGroup(
|
||||
new DhApiVec3f(24f, 140f, 24f),
|
||||
relBoxList);
|
||||
relativePosBoxGroup.setPreRenderFunc((event) ->
|
||||
@@ -288,9 +284,9 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
pos.x %= 32;
|
||||
relativePosBoxGroup.setOriginBlockPos(pos);
|
||||
});
|
||||
DhApi.Delayed.renderRegister.add(relativePosBoxGroup);
|
||||
|
||||
|
||||
this.add(relativePosBoxGroup);
|
||||
|
||||
|
||||
// massive relative box group
|
||||
ArrayList<DhApiRenderableBox> massRelBoxList = new ArrayList<>();
|
||||
for (int x = 0; x < 50*2; x+=2)
|
||||
@@ -302,7 +298,7 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
new Color(Color.RED.getRed(), Color.RED.getGreen(), Color.RED.getBlue())));
|
||||
}
|
||||
}
|
||||
IDhApiRenderableBoxGroup massRelativePosBoxGroup = DhApi.Delayed.renderRegister.createRelativePositionedGroup(
|
||||
IDhApiRenderableBoxGroup massRelativePosBoxGroup = this.createRelativePositionedGroup(
|
||||
new DhApiVec3f(-25f, 140f, 0f),
|
||||
massRelBoxList);
|
||||
massRelativePosBoxGroup.setPreRenderFunc((event) ->
|
||||
@@ -312,15 +308,15 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
if (blockPos.y > 150f)
|
||||
{
|
||||
blockPos.y = 140f;
|
||||
|
||||
|
||||
Color newColor = (massRelativePosBoxGroup.get(0).color == Color.RED) ? Color.RED.darker() : Color.RED;
|
||||
massRelativePosBoxGroup.forEach((box) -> { box.color = newColor; });
|
||||
massRelativePosBoxGroup.triggerBoxChange();
|
||||
}
|
||||
|
||||
|
||||
massRelativePosBoxGroup.setOriginBlockPos(blockPos);
|
||||
});
|
||||
DhApi.Delayed.renderRegister.add(massRelativePosBoxGroup);
|
||||
this.add(massRelativePosBoxGroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -522,16 +518,16 @@ public class GenericObjectRenderer implements IDhApiCustomRenderRegister
|
||||
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, boxGroup.instanceColorVbo);
|
||||
GL32.glEnableVertexAttribArray(1);
|
||||
GL32.glVertexAttribPointer(1, 4, GL32.GL_FLOAT, false, 4 * Float.BYTES, 0);
|
||||
vertexAttribDivisor(1, 1);
|
||||
this.vertexAttribDivisor(1, 1);
|
||||
|
||||
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, boxGroup.instanceTranslationVbo);
|
||||
GL32.glEnableVertexAttribArray(2);
|
||||
vertexAttribDivisor(2, 1);
|
||||
this.vertexAttribDivisor(2, 1);
|
||||
GL32.glVertexAttribPointer(2, 3, GL32.GL_FLOAT, false, 3 * Float.BYTES, 0);
|
||||
|
||||
GL32.glBindBuffer(GL32.GL_ARRAY_BUFFER, boxGroup.instanceScaleVbo);
|
||||
GL32.glEnableVertexAttribArray(3);
|
||||
vertexAttribDivisor(3, 1);
|
||||
this.vertexAttribDivisor(3, 1);
|
||||
GL32.glVertexAttribPointer(3, 3, GL32.GL_FLOAT, false, 3 * Float.BYTES, 0);
|
||||
|
||||
|
||||
|
||||
@@ -100,6 +100,8 @@ public class LodRenderer
|
||||
private final ReentrantLock setupLock = new ReentrantLock();
|
||||
|
||||
public final RenderBufferHandler bufferHandler;
|
||||
public final GenericObjectRenderer genericObjectRenderer;
|
||||
|
||||
|
||||
// The shader program
|
||||
IDhApiShaderProgram lodRenderProgram = null;
|
||||
@@ -124,9 +126,10 @@ public class LodRenderer
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public LodRenderer(RenderBufferHandler bufferHandler)
|
||||
public LodRenderer(RenderBufferHandler bufferHandler, GenericObjectRenderer genericObjectRenderer)
|
||||
{
|
||||
this.bufferHandler = bufferHandler;
|
||||
this.genericObjectRenderer = genericObjectRenderer;
|
||||
}
|
||||
|
||||
private boolean rendererClosed = false;
|
||||
@@ -301,7 +304,7 @@ public class LodRenderer
|
||||
|
||||
// custom objects
|
||||
profiler.popPush("Custom Objects");
|
||||
GenericObjectRenderer.INSTANCE.render(renderEventParam, profiler);
|
||||
this.genericObjectRenderer.render(renderEventParam, profiler);
|
||||
|
||||
|
||||
// SSAO
|
||||
|
||||
+2
@@ -321,6 +321,8 @@ public interface IChunkWrapper extends IBindable
|
||||
}
|
||||
}
|
||||
|
||||
// TODO check if the sky is visible
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user