Start of engine rewrite

This commit is contained in:
Speiger 2024-04-03 21:14:02 +02:00
parent 51afb9d82e
commit e1d827223d
36 changed files with 287 additions and 120 deletions

View File

@ -22,7 +22,7 @@ import speiger.src.coreengine.rendering.input.window.Window;
import speiger.src.coreengine.rendering.input.window.WindowProvider;
import speiger.src.coreengine.rendering.shaderOld.ProjectionBuffer;
import speiger.src.coreengine.rendering.shaderOld.ShaderTracker;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
import speiger.src.coreengine.rendering.utils.Cursor;
import speiger.src.coreengine.utils.counters.timers.FPSTimer;
import speiger.src.coreengine.utils.eventbus.EventBus;

View File

@ -1,7 +1,7 @@
package speiger.src.coreengine.rendering.gui;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
public class UITextures
{

View File

@ -1,7 +1,7 @@
package speiger.src.coreengine.rendering.gui.components;
import speiger.src.coreengine.rendering.gui.GuiComponent;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
public class IconComponent extends GuiComponent
{

View File

@ -2,7 +2,7 @@ package speiger.src.coreengine.rendering.gui.components.icon;
import speiger.src.coreengine.math.misc.ColorUtils;
import speiger.src.coreengine.rendering.gui.renderer.UIRenderer;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
public class TexturedIcon implements IIcon
{

View File

@ -36,11 +36,11 @@ import speiger.src.collections.objects.misc.pairs.ObjectObjectPair;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.math.vector.ints.Vec2i;
import speiger.src.coreengine.rendering.gui.renderer.IFontRenderer.CharInstance;
import speiger.src.coreengine.rendering.textures.atlas.AtlasStitcher;
import speiger.src.coreengine.rendering.textures.atlas.AtlasStitcher.Entry;
import speiger.src.coreengine.rendering.textures.custom.TextureAtlas;
import speiger.src.coreengine.rendering.textures.custom.TextureAtlas.AtlasEntry;
import speiger.src.coreengine.rendering.textures.custom.TextureAtlas.Builder;
import speiger.src.coreengine.rendering.texturesOld.atlas.AtlasStitcher;
import speiger.src.coreengine.rendering.texturesOld.atlas.AtlasStitcher.Entry;
import speiger.src.coreengine.rendering.texturesOld.custom.TextureAtlas;
import speiger.src.coreengine.rendering.texturesOld.custom.TextureAtlas.AtlasEntry;
import speiger.src.coreengine.rendering.texturesOld.custom.TextureAtlas.Builder;
public class FontBuilder {
public static final int LITERAL = 1;

View File

@ -23,7 +23,7 @@ import speiger.src.coreengine.rendering.models.DrawCall;
import speiger.src.coreengine.rendering.tesselationOld.IVertexBuilder;
import speiger.src.coreengine.rendering.tesselationOld.Tesselator;
import speiger.src.coreengine.rendering.tesselationOld.VertexType;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.utils.helpers.TextUtil;
public class FontRenderer implements IFontRenderer

View File

@ -1,7 +1,7 @@
package speiger.src.coreengine.rendering.gui.renderer;
import speiger.src.coreengine.rendering.gui.components.TextComponent;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
public interface IFontRenderer
{

View File

@ -27,8 +27,8 @@ import speiger.src.coreengine.rendering.shaderOld.uniforms.UniformVec2f;
import speiger.src.coreengine.rendering.tesselation.GLCall;
import speiger.src.coreengine.rendering.tesselationOld.Tesselator;
import speiger.src.coreengine.rendering.tesselationOld.VertexType;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
import speiger.src.coreengine.rendering.utils.GLStateTracker;
import speiger.src.coreengine.utils.collections.pools.SimplePool;

View File

@ -16,8 +16,8 @@ import speiger.src.coreengine.math.vector.ints.Vec2i;
import speiger.src.coreengine.rendering.gui.helper.FontBuilder;
import speiger.src.coreengine.rendering.gui.helper.FontBuilder.WrittenChar;
import speiger.src.coreengine.rendering.gui.renderer.IFontRenderer.CharInstance;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
import speiger.src.coreengine.utils.helpers.JsonUtil;
public class BitmapFontProvider implements IFontProvider

View File

@ -3,7 +3,7 @@ package speiger.src.coreengine.rendering.gui.renderer.provider;
import com.google.gson.JsonObject;
import speiger.src.coreengine.rendering.gui.renderer.IFontRenderer.CharInstance;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.utils.helpers.JsonUtil;
public interface IFontProvider

View File

@ -7,7 +7,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.GL32;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class TextureAttachment implements IFrameAttachment
{

View File

@ -55,12 +55,13 @@ public non-sealed class GuiComponent extends FlagObject implements ICastable, IL
protected void renderChildren(IUIRenderer renderer, int mouseX, int mouseY, float particalTicks) {
for(GuiComponent child : children) {
if(child.isManualManaged()) continue;
renderComponent(child, renderer, mouseX, mouseY, particalTicks);
}
}
public static boolean renderComponent(GuiComponent comp, IUIRenderer renderer, int mouseX, int mouseY, float particalTicks) {
if(!comp.isVisible() || comp.isManualManaged() || (comp.isScissored() && !renderer.isInScissors(comp.getBox()))) return false;
if(!comp.isVisible() || (comp.isScissored() && !renderer.isInScissors(comp.getBox()))) return false;
if(comp.isScissored()) {
renderer.pushScissors(comp.getBox());
if(comp.renderer != null) {

View File

@ -1,9 +1,24 @@
package speiger.src.coreengine.rendering.newGui.renderer;
import speiger.src.coreengine.math.vector.quaternion.Quaternion;
import speiger.src.coreengine.rendering.gui.helper.box.IGuiBox;
public interface IUIRenderer {
public boolean isInScissors(IGuiBox box);
public void pushScissors(IGuiBox box);
public void popScissors();
public void flush();
public void pushTransform();
public void popTransform();
public void translate(float z);
public void translate(float x, float y);
public void translate(float x, float y, float z);
public void scale(float scale);
public void scale(float x, float y);
public void rotate(Quaternion rotation);
}

View File

@ -1,7 +1,7 @@
package speiger.src.coreengine.rendering.shaderOld.uniforms;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class UniformTexture extends UniformInt {
int bank;

View File

@ -11,6 +11,8 @@ public interface IVertexBuilder extends IVertexBuffer {
public IVertexBuilder putInt(int offset, int value);
public IVertexBuilder putFloat(int offset, float value);
public int size();
@Override
default IVertexBuffer pos(float x, float y) {
validate(this, Usage.POS, 2);

View File

@ -56,6 +56,9 @@ public class VertexBuilder implements IVertexBuilder {
return this;
}
@Override
public int size() { return vertecies; }
@Override
public IVertexBuilder put(int offset, byte value) {
buffer.put(totalStoredBytes + offset, value);

View File

@ -0,0 +1,76 @@
package speiger.src.coreengine.rendering.textures.base;
import org.lwjgl.opengl.GL11;
public abstract class BaseTexture implements ITexture {
protected int id;
protected BaseTexture() {
this(GL11.glGenTextures());
}
protected BaseTexture(int id) {
this.id = id;
}
@Override
public int id() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void bind() {
// TODO Auto-generated method stub
}
@Override
public void reload() {
// TODO Auto-generated method stub
}
@Override
public void delete() {
// TODO Auto-generated method stub
}
@Override
public int width() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int height() {
// TODO Auto-generated method stub
return 0;
}
@Override
public float minU() {
// TODO Auto-generated method stub
return 0;
}
@Override
public float minV() {
// TODO Auto-generated method stub
return 0;
}
@Override
public float maxU() {
// TODO Auto-generated method stub
return 0;
}
@Override
public float maxV() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -1,56 +1,16 @@
package speiger.src.coreengine.rendering.textures.base;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
public interface ITexture {
public int id();
public void bind();
public void reload();
public void delete();
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.reloader.IReloadableResource;
import speiger.src.coreengine.rendering.textures.normal.DirectTexture;
import speiger.src.coreengine.rendering.textures.normal.SimpleTexture;
import speiger.src.coreengine.rendering.textures.stb.STBDirectTexture;
import speiger.src.coreengine.rendering.textures.stb.STBTexture;
public int width();
public int height();
public interface ITexture extends IReloadableResource
{
public int getTextureId();
public void bindTexture();
public void deleteTexture();
public int getWidth();
public int getHeight();
public float getUMin();
public float getVMin();
public float getUMax();
public float getVMax();
public ITexture makeReloadable();
public default float getInterpolatedU(float u){return getUMin() + ((getUMax() - getUMin()) * u);}
public default float getInterpolatedV(float v){return getUMin() + ((getUMax() - getUMin()) * v);}
public static ITexture simple(AssetLocation location) {
return new STBTexture(location);
}
public static ITexture direct(ByteBuffer stbImageData, int width, int height) {
return new STBDirectTexture(stbImageData, width, height);
}
public static ITexture direct(long stbImageData, int width, int height) {
return new STBDirectTexture(stbImageData, width, height);
}
public static ITexture direct(BufferedImage imageData) {
return new STBDirectTexture(imageData);
}
public static ITexture awtSimple(AssetLocation location) {
return new SimpleTexture(location);
}
public static ITexture awtDirect(BufferedImage imageData) {
return new DirectTexture(imageData);
}
public float minU();
public float minV();
public float maxU();
public float maxV();
}

View File

@ -0,0 +1,55 @@
package speiger.src.coreengine.rendering.textures.base;
import java.util.function.Predicate;
import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.objects.lists.ObjectList;
import speiger.src.collections.objects.sets.ObjectLinkedOpenHashSet;
import speiger.src.collections.objects.sets.ObjectSet;
import speiger.src.coreengine.assets.base.IAssetProvider;
import speiger.src.coreengine.assets.base.IManagedAsset;
import speiger.src.coreengine.assets.base.IReloadableAsset.ISimpleRealodableAsset;
public class TextureTracker implements ISimpleRealodableAsset, IManagedAsset {
IAssetProvider provider;
ObjectList<ITexture> textures = new ObjectArrayList<>();
ObjectSet<ITexture> reloadable = new ObjectLinkedOpenHashSet<>();
public void registerTexture(ITexture texture) {
register(texture, false);
}
public void registerReloadable(ITexture texture) {
register(texture, true);
}
public void register(ITexture texture, boolean reloadable) {
textures.add(texture);
if(reloadable) this.reloadable.add(texture);
}
public void deleteTexture(ITexture texture) {
textures.remove(texture);
reloadable.remove(texture);
}
@Override
public void onAssetsReloaded(IAssetProvider provider) {
textures.filter(((Predicate<ITexture>)reloadable::contains).negate()).forEach(ITexture::delete);
textures.clear();
reloadable.peek(ITexture::reload).forEach(textures::add);
}
@Override
public void destroy() {
textures.forEach(ITexture::delete);
textures.clear();
reloadable.clear();
}
@Override
public String getName() { return "Texture Tracker"; }
@Override
public void setProvider(IAssetProvider provider) { this.provider = provider; }
}

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.atlas;
package speiger.src.coreengine.rendering.texturesOld.atlas;
import java.util.List;
@ -6,7 +6,7 @@ import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.objects.utils.ObjectIterables;
import speiger.src.collections.utils.HashUtil;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.rendering.textures.atlas.AtlasStitcher.Entry;
import speiger.src.coreengine.rendering.texturesOld.atlas.AtlasStitcher.Entry;
public class AtlasStitcher<T extends Entry> {
@ -20,6 +20,10 @@ public class AtlasStitcher<T extends Entry> {
List<Record<T>> toStitch = new ObjectArrayList<>();
Slot<T> slot = null;
public AtlasStitcher(int bounds) {
this(bounds, bounds);
}
public AtlasStitcher(int maxWidth, int maxHeight) {
this.maxWidth = maxWidth;
this.maxHeight = maxHeight;
@ -30,9 +34,7 @@ public class AtlasStitcher<T extends Entry> {
public int height() { return height; }
public boolean isValid() { return valid; }
public void add(T entry) {
add(new Record<T>(entry));
}
public void add(T entry) { add(new Record<T>(entry)); }
public void addAll(Iterable<? extends T> iterables) {
ObjectIterables.map(iterables, Record<T>::new).forEach(this::add);
@ -96,9 +98,7 @@ public class AtlasStitcher<T extends Entry> {
this(entry, entry.width(), entry.height());
}
public int pixels() {
return width() * height();
}
public int pixels() { return width() * height(); }
@Override
public int compareTo(Record<T> o) {

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.base;
package speiger.src.coreengine.rendering.texturesOld.base;
public abstract class AbstractTexture implements ITexture {
protected int textureID;

View File

@ -0,0 +1,56 @@
package speiger.src.coreengine.rendering.texturesOld.base;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.reloader.IReloadableResource;
import speiger.src.coreengine.rendering.texturesOld.normal.DirectTexture;
import speiger.src.coreengine.rendering.texturesOld.normal.SimpleTexture;
import speiger.src.coreengine.rendering.texturesOld.stb.STBDirectTexture;
import speiger.src.coreengine.rendering.texturesOld.stb.STBTexture;
public interface ITexture extends IReloadableResource
{
public int getTextureId();
public void bindTexture();
public void deleteTexture();
public int getWidth();
public int getHeight();
public float getUMin();
public float getVMin();
public float getUMax();
public float getVMax();
public ITexture makeReloadable();
public default float getInterpolatedU(float u){return getUMin() + ((getUMax() - getUMin()) * u);}
public default float getInterpolatedV(float v){return getUMin() + ((getUMax() - getUMin()) * v);}
public static ITexture simple(AssetLocation location) {
return new STBTexture(location);
}
public static ITexture direct(ByteBuffer stbImageData, int width, int height) {
return new STBDirectTexture(stbImageData, width, height);
}
public static ITexture direct(long stbImageData, int width, int height) {
return new STBDirectTexture(stbImageData, width, height);
}
public static ITexture direct(BufferedImage imageData) {
return new STBDirectTexture(imageData);
}
public static ITexture awtSimple(AssetLocation location) {
return new SimpleTexture(location);
}
public static ITexture awtDirect(BufferedImage imageData) {
return new DirectTexture(imageData);
}
}

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.base;
package speiger.src.coreengine.rendering.texturesOld.base;
import java.io.Closeable;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.base;
package speiger.src.coreengine.rendering.texturesOld.base;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.base;
package speiger.src.coreengine.rendering.texturesOld.base;
public class WrappedTexture implements ITexture
{

View File

@ -1,6 +1,6 @@
package speiger.src.coreengine.rendering.textures.custom;
package speiger.src.coreengine.rendering.texturesOld.custom;
import speiger.src.coreengine.rendering.textures.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
public interface IDynamicTexture extends ITexture
{

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.custom;
package speiger.src.coreengine.rendering.texturesOld.custom;
import java.util.Iterator;
import java.util.List;

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.normal;
package speiger.src.coreengine.rendering.texturesOld.normal;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
@ -8,8 +8,8 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL30;
import org.lwjgl.system.MemoryUtil;
import speiger.src.coreengine.rendering.textures.base.AbstractTexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.AbstractTexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class DirectTexture extends AbstractTexture
{

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.normal;
package speiger.src.coreengine.rendering.texturesOld.normal;
import java.nio.ByteBuffer;
import java.util.Arrays;
@ -20,9 +20,9 @@ import speiger.src.collections.ints.sets.IntSet;
import speiger.src.collections.ints.utils.maps.Int2ObjectMaps;
import speiger.src.collections.utils.ITrimmable;
import speiger.src.coreengine.math.BitUtil;
import speiger.src.coreengine.rendering.textures.base.AbstractTexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.textures.custom.IDynamicTexture;
import speiger.src.coreengine.rendering.texturesOld.base.AbstractTexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.custom.IDynamicTexture;
import speiger.src.coreengine.rendering.utils.AllocationTracker;
public class DynamicTexture extends AbstractTexture implements IDynamicTexture

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.normal;
package speiger.src.coreengine.rendering.texturesOld.normal;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
@ -10,8 +10,8 @@ import org.lwjgl.system.MemoryUtil;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.base.IAsset;
import speiger.src.coreengine.rendering.textures.base.AbstractTexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.AbstractTexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class SimpleTexture extends AbstractTexture
{

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.stb;
package speiger.src.coreengine.rendering.texturesOld.stb;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
@ -13,8 +13,8 @@ import org.lwjgl.opengl.GL30;
import org.lwjgl.stb.STBImage;
import org.lwjgl.system.MemoryUtil;
import speiger.src.coreengine.rendering.textures.base.AbstractTexture;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.AbstractTexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class STBDirectTexture extends AbstractTexture
{

View File

@ -1,4 +1,4 @@
package speiger.src.coreengine.rendering.textures.stb;
package speiger.src.coreengine.rendering.texturesOld.stb;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -11,9 +11,9 @@ import org.lwjgl.system.MemoryUtil;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.base.IAsset;
import speiger.src.coreengine.rendering.textures.base.AbstractTexture;
import speiger.src.coreengine.rendering.textures.base.NativeMemoryParser;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.AbstractTexture;
import speiger.src.coreengine.rendering.texturesOld.base.NativeMemoryParser;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public class STBTexture extends AbstractTexture
{

View File

@ -13,7 +13,7 @@ import speiger.src.collections.objects.utils.maps.Object2ObjectMaps;
import speiger.src.coreengine.assets.AssetLocation;
import speiger.src.coreengine.assets.reloader.IReloadableResource;
import speiger.src.coreengine.rendering.input.window.Window;
import speiger.src.coreengine.rendering.textures.base.TextureManager;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;
public final class Cursor implements IReloadableResource {
public static final Cursor INSTANCE = new Cursor();

View File

@ -9,15 +9,13 @@ import org.lwjgl.opengl.GL33;
import speiger.src.collections.ints.collections.IntStack;
import speiger.src.collections.ints.lists.IntArrayList;
import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.objects.maps.impl.hash.Object2ObjectOpenHashMap;
import speiger.src.collections.objects.maps.interfaces.Object2ObjectMap;
import speiger.src.collections.objects.maps.interfaces.Object2ObjectMap.Entry;
import speiger.src.collections.objects.sets.ObjectLinkedOpenHashSet;
import speiger.src.collections.utils.Stack;
public class GLStamper {
public static GLStamper INSTANCE = new GLStamper();
Object2ObjectMap<String, Set<GLStamp>> stamps = new Object2ObjectOpenHashMap<>();
Object2ObjectMap<String, Set<GLStamp>> stamps = Object2ObjectMap.builder().linkedMap();
Stack<GLStamp> unusedStamps = new ObjectArrayList<>();
IntStack queryIDs = new IntArrayList();
@ -31,18 +29,14 @@ public class GLStamper {
public void removeOwner(String ownerID) {
Set<GLStamp> set = stamps.remove(ownerID);
if(set != null) {
for(GLStamp stamp : set) {
stamp.release();
}
}
if(set == null) return;
set.forEach(GLStamp::release);
}
public void cleanup() {
if(!stamps.isEmpty()) {
for(Iterator<Entry<String, Set<GLStamp>>> iter = stamps.object2ObjectEntrySet().iterator();iter.hasNext();) {
iter.next().getValue().forEach(GLStamp::release);
iter.remove();
for(Iterator<Set<GLStamp>> iter = stamps.values().iterator();iter.hasNext();iter.remove()) {
iter.next().forEach(GLStamp::release);
}
}
if(queryIDs.isEmpty()) return;

View File

@ -11,6 +11,7 @@ import speiger.src.collections.objects.lists.ObjectArrayList;
import speiger.src.collections.objects.lists.ObjectList;
import speiger.src.coreengine.rendering.shader.ShaderTracker;
import speiger.src.coreengine.rendering.shader.uniform.GlobalUniforms;
import speiger.src.coreengine.rendering.textures.base.TextureTracker;
import speiger.src.coreengine.rendering.utils.states.BlendState;
import speiger.src.coreengine.rendering.utils.states.CullState;
import speiger.src.coreengine.rendering.utils.states.FloatState;
@ -24,6 +25,7 @@ import speiger.src.coreengine.utils.counters.averager.Counter;
public class GLStateTracker {
static final ObjectList<IGLState> ALL_STATES = new ObjectArrayList<>();
//GPU States
public static final GLState MULTI_SAMPLING = addState(new GLState(GL13.GL_MULTISAMPLE));
public static final GLWireFrame WIRE_FRAME = addState(new GLWireFrame(GLCullType.BOTH));
public static final GLState PROVOKING_VERTEX = addState(new GLProvoking());
@ -35,10 +37,13 @@ public class GLStateTracker {
public static final FloatState LINE_SIZE = addState(new FloatState(1F, GL11::glLineWidth));
public static final ScissorsManager TESTER = new ScissorsManager(100);
public static final Counter[] COUNTERS = Counter.createCounters(4);
public static final ViewPortStack VIEW_PORT = new ViewPortStack();
public static final ShaderTracker SHADERS = new ShaderTracker();
public static final GlobalUniforms UNIFORMS = new GlobalUniforms();
public static final TextureState TEXTURES = addState(new TextureState());
public static final ViewPortStack VIEW_PORT = new ViewPortStack();
//Trackers
public static final ShaderTracker SHADERS = new ShaderTracker();
public static final TextureTracker TEXTURE_TRACKER = new TextureTracker();
public static final GlobalUniforms UNIFORMS = new GlobalUniforms();
public static <T extends IGLState> T addState(T state) {
ALL_STATES.add(state);