From 4ab2fef1ac756f276e3d06965f50d59fc8b166a7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 30 Jan 2024 19:33:04 -0600 Subject: [PATCH] reword a couple comments and minor reformatting --- .../events/IDhApiEventInjector.java | 2 +- .../DependencyInjection/OverrideInjector.java | 16 +++++++ .../OverridePriorityListContainer.java | 2 +- .../glObject/texture/DhFramebuffer.java | 43 ++++++++++--------- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/api/src/main/java/com/seibel/distanthorizons/api/interfaces/events/IDhApiEventInjector.java b/api/src/main/java/com/seibel/distanthorizons/api/interfaces/events/IDhApiEventInjector.java index 75f11f2b0..5bcd3eebc 100644 --- a/api/src/main/java/com/seibel/distanthorizons/api/interfaces/events/IDhApiEventInjector.java +++ b/api/src/main/java/com/seibel/distanthorizons/api/interfaces/events/IDhApiEventInjector.java @@ -51,7 +51,7 @@ public interface IDhApiEventInjector extends IDependencyInjector * @param eventParameterObject event parameter * @param the parameter type taken by the event handlers. * @param the {@link IDhApiEvent}'s class - * @return if any of bound event handlers returned that this event should be canceled. + * @return if any of the bound event handlers notified that this event should be canceled. */ > boolean fireAllEvents(Class abstractEvent, T eventParameterObject); diff --git a/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverrideInjector.java b/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverrideInjector.java index e87368089..f858300e0 100644 --- a/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverrideInjector.java +++ b/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverrideInjector.java @@ -48,6 +48,10 @@ public class OverrideInjector implements IOverrideInjector + //==============// + // constructors // + //==============// + public OverrideInjector() { String thisPackageName = this.getClass().getPackage().getName(); @@ -60,6 +64,10 @@ public class OverrideInjector implements IOverrideInjector + //=========// + // binding // + //=========// + @Override public void bind(Class dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException { @@ -103,6 +111,14 @@ public class OverrideInjector implements IOverrideInjector overrideContainer.addOverride(dependencyImplementation); } + + + + + //=========// + // getters // + //=========// + @Override @SuppressWarnings("unchecked") public T get(Class interfaceClass) throws ClassCastException diff --git a/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverridePriorityListContainer.java b/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverridePriorityListContainer.java index 46084accb..4645c0ecf 100644 --- a/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverridePriorityListContainer.java +++ b/api/src/main/java/com/seibel/distanthorizons/coreapi/DependencyInjection/OverridePriorityListContainer.java @@ -42,7 +42,7 @@ public class OverridePriorityListContainer implements IBindable OverridePriorityPair priorityPair = new OverridePriorityPair(override, override.getPriority()); this.overridePairList.add(priorityPair); - sortList(); + this.sortList(); } /** @return true if the override was removed from the list, false otherwise. */ diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/texture/DhFramebuffer.java b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/texture/DhFramebuffer.java index 0cf428597..5104ee602 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/texture/DhFramebuffer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/glObject/texture/DhFramebuffer.java @@ -48,7 +48,7 @@ public class DhFramebuffer public void addDepthAttachment(int texture, EDhDepthBufferFormat depthBufferFormat) { - bind(); + this.bind(); if (depthBufferFormat.isCombinedStencil()) { @@ -61,19 +61,19 @@ public class DhFramebuffer this.hasDepthAttachment = true; } - + + @Override public void addColorAttachment(int index, int texture) { - int fb = id; - bind(); + this.bind(); GL32.glFramebufferTexture2D(GL32.GL_FRAMEBUFFER, GL32.GL_COLOR_ATTACHMENT0 + index, GL32.GL_TEXTURE_2D, texture, 0); - attachments.put(index, texture); + this.attachments.put(index, texture); } public void noDrawBuffers() { - bind(); + this.bind(); GL32.glDrawBuffers(new int[]{GL32.GL_NONE}); } @@ -81,59 +81,60 @@ public class DhFramebuffer { int[] glBuffers = new int[buffers.length]; int index = 0; - if (buffers.length > maxDrawBuffers) + if (buffers.length > this.maxDrawBuffers) { - throw new IllegalArgumentException("Cannot write to more than " + maxDrawBuffers + " draw buffers on this GPU"); + throw new IllegalArgumentException("Cannot write to more than " + this.maxDrawBuffers + " draw buffers on this GPU"); } for (int buffer : buffers) { - if (buffer >= maxColorAttachments) + if (buffer >= this.maxColorAttachments) { - throw new IllegalArgumentException("Only " + maxColorAttachments + " color attachments are supported on this GPU, but an attempt was made to write to a color attachment with index " + buffer); + throw new IllegalArgumentException("Only " + this.maxColorAttachments + " color attachments are supported on this GPU, but an attempt was made to write to a color attachment with index " + buffer); } glBuffers[index++] = GL32.GL_COLOR_ATTACHMENT0 + buffer; } - bind(); + this.bind(); GL32.glDrawBuffers(new int[]{GL32.GL_NONE}); } public void readBuffer(int buffer) { - bind(); + this.bind(); GL32.glReadBuffer(GL32.GL_COLOR_ATTACHMENT0 + buffer); } - public int getColorAttachment(int index) { return attachments.get(index); } + public int getColorAttachment(int index) { return this.attachments.get(index); } - public boolean hasDepthAttachment() { return hasDepthAttachment; } + public boolean hasDepthAttachment() { return this.hasDepthAttachment; } + @Override public void bind() { - if (id == -1) + if (this.id == -1) { throw new IllegalStateException("Framebuffer does not exist!"); } - GL32.glBindFramebuffer(GL32.GL_FRAMEBUFFER, id); + GL32.glBindFramebuffer(GL32.GL_FRAMEBUFFER, this.id); } - public void bindAsReadBuffer() { GL32.glBindFramebuffer(GL32.GL_READ_FRAMEBUFFER, id); } + public void bindAsReadBuffer() { GL32.glBindFramebuffer(GL32.GL_READ_FRAMEBUFFER, this.id); } - public void bindAsDrawBuffer() { GL32.glBindFramebuffer(GL32.GL_DRAW_FRAMEBUFFER, id); } + public void bindAsDrawBuffer() { GL32.glBindFramebuffer(GL32.GL_DRAW_FRAMEBUFFER, this.id); } public void destroyInternal() { - GL32.glDeleteFramebuffers(id); + GL32.glDeleteFramebuffers(this.id); this.id = -1; } + @Override public int getStatus() { - bind(); + this.bind(); int status = GL32.glCheckFramebufferStatus(GL32.GL_FRAMEBUFFER); - return status; }