From 5eeccfa5d6a74c8804dcae4e6d7c4e7858aae821 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 27 May 2019 19:52:41 +1000 Subject: [PATCH] cleaned up a bit remind me to clean up camera --- .../renderers/ParticleRenderer.java | 11 +++++++---- .../renderers/ParticleRenderer.class | Bin 4604 -> 5997 bytes 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.java b/src/main/java/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.java index 6012cef..af92c80 100644 --- a/src/main/java/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.java +++ b/src/main/java/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.java @@ -37,9 +37,7 @@ public class ParticleRenderer { Matrix4f viewMatrix = Maths.createViewMatrix(camera); prepare(); for(ParticleTexture texture : particles.keySet()) { - GL13.glActiveTexture(GL13.GL_TEXTURE0); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); - shader.loadNumberOfRows(texture.getNumberOfRows()); + bindTexture(texture); for(Particle particle : particles.get(texture)) { updateModelViewMatrix(particle.getPosition(), particle.getRotation(), particle.getScale().x, viewMatrix); } @@ -53,6 +51,12 @@ public class ParticleRenderer { shader.cleanUp(); } + private void bindTexture(ParticleTexture texture) { + GL13.glActiveTexture(GL13.GL_TEXTURE0); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); + shader.loadNumberOfRows(texture.getNumberOfRows()); + } + private void updateModelViewMatrix(Vector3f position, float rotation, float scale, Matrix4f viewMatrix) { Matrix4f modelMatrix = new Matrix4f(); Matrix4f.translate(position, modelMatrix, modelMatrix); @@ -68,7 +72,6 @@ public class ParticleRenderer { Matrix4f.rotate((float)Math.toRadians(rotation), new Vector3f(0,0,1), modelMatrix, modelMatrix); Matrix4f.scale(new Vector3f(scale,scale,scale), modelMatrix, modelMatrix); Matrix4f modelViewMatrix = Matrix4f.mul(viewMatrix, modelMatrix, null); - shader.loadModelViewMatrix(modelViewMatrix); } private void prepare(){ diff --git a/target/classes/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.class b/target/classes/io/github/hydos/ginger/engine/renderEngine/renderers/ParticleRenderer.class index d00a04639abfeb3344f34ddf693f00576c27de6a..a36334819e3267096c164a8417d3b4f852e2cb78 100644 GIT binary patch delta 2099 zcmaJ?2~<>782;{TZ4Z`VkIvno(@4wyqeeaul&nBN57<1t7 zUAqAc#$OV240+0FUEcPo!%c}6Fihc?ic$t^x!YSg#kDY4>vu5>cPKV%rjlte^R!Yc z#$X!9bj(l|Nm+enG4z-xFOZ$JLAS?Q~TfG1FwW?hGEKlmZpp}$Ha5^ zP{Y6$(mz!(_&EXyDu>ODNeejYKmlp494ICPYU>#y={kh3 zFX2w5iT71jvc$erR^f5U-l;VfT!gzgmV@hoC3`Hm8;XS0iZeP+%F5=r2WymFraq>7 zIo4sla>NvGYQ+5#?h_eGjAUqd01q-mS9!*Dr_$&sEKDo4U=o@*9>RKto&>bGwz}Nq zpD?GyR~HZ)Kg_Wik1)h|d~#*?AcMh?FY1>eUJQ?MJdP(AqJn35GE@TW~0w{A=!N*b5iHJA&PoD$?=q6Q(v8#Db`POY}eLV>Ut+fb0nT6;w>Dl z+Io;0Z{ye%i4PL-XE>gX)T{Z=aqNlYtLx`E_C?~=YQYN}FGdmuS@1FrNO+}FRUX+} z<-Af3&gFO&uL+>O61mb%Uk*fhD7y8J=c!m)n8yvTx+I3?j*%1h9HN1`o?P8#2cA2?2n0&|ro&nuS;l#Te2 z<0m0nD|PX>yp{R2-U{LWh2vL|998AXbqBQUllYzE59$|+b}{p&-aS}DIgBvV)l%O- zj7y8tTQMS|4Wk*_kjIc?+=4Q@u?^!H$zf8CA>D3h#pDdTp$%m^a?NbRRg@-eL8@Jf zq|MGTrQ1y{xJC?>Vwl^EYX`JqzDTKM*wArE^i-{e&9vpB?Q{SGdeN8;3ympss8mGZ z60#h~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