package p000; import javax.microedition.m3g.Appearance; import javax.microedition.m3g.Camera; import javax.microedition.m3g.CompositingMode; import javax.microedition.m3g.Image2D; import javax.microedition.m3g.Mesh; import javax.microedition.m3g.Node; import javax.microedition.m3g.Texture2D; import javax.microedition.m3g.TriangleStripArray; import javax.microedition.m3g.VertexArray; import javax.microedition.m3g.VertexBuffer; /* renamed from: b */ /* loaded from: microcounterstrike.jar:b.class */ public final class AnimatedBillboardSprite { /* renamed from: a */ public Mesh mesh121; /* renamed from: d */ private Appearance appearance122; /* renamed from: b */ public Texture2D[] texture123; /* renamed from: e */ private int value124; /* renamed from: f */ private int value125; /* renamed from: c */ public boolean flag126; /* renamed from: g */ private Camera camera127; /* renamed from: h */ private float[] value128; public AnimatedBillboardSprite(Image2D[] image2DArr, Camera camera, float f) { this.value128 = new float[3]; this.camera127 = camera; VertexBuffer vertexBufferM179b = getVertexBuffer179(); TriangleStripArray triangleStripArray = new TriangleStripArray(new int[]{1, 2, 0, 3}, new int[]{4}); this.value124 = image2DArr.length; this.value125 = 0; this.texture123 = getTexture2DArray180(image2DArr, this.value124); this.appearance122 = getAppearance181(this.texture123[this.value125]); this.mesh121 = new Mesh(vertexBufferM179b, triangleStripArray, this.appearance122); float f2 = f * 0.5f; this.mesh121.scale(f2, f2, f2); if (this.camera127 != null) { this.mesh121.setAlignment(this.camera127, 148, (Node) null, 144); } this.mesh121.setPickingEnable(false); execute183(false); } public AnimatedBillboardSprite(Mesh mesh, Texture2D[] texture2DArr, Camera camera) { this.value128 = new float[3]; this.value125 = 0; this.texture123 = texture2DArr; this.value124 = texture2DArr.length; this.mesh121 = mesh.duplicate(); this.appearance122 = this.mesh121.getAppearance(0); this.appearance122.setTexture(0, texture2DArr[this.value125]); this.camera127 = camera; if (this.camera127 != null) { this.mesh121.setAlignment(this.camera127, 148, (Node) null, 144); } this.mesh121.setPickingEnable(false); execute183(false); } /* renamed from: b */ private static VertexBuffer getVertexBuffer179() { short[] sArr = {-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0}; VertexArray vertexArray = new VertexArray(sArr.length / 3, 3, 2); vertexArray.set(0, sArr.length / 3, sArr); short[] sArr2 = {0, 1, 1, 1, 1, 0, 0, 0}; VertexArray vertexArray2 = new VertexArray(sArr2.length / 2, 2, 2); vertexArray2.set(0, sArr2.length / 2, sArr2); VertexBuffer vertexBuffer = new VertexBuffer(); vertexBuffer.setPositions(vertexArray, 0.25f, (float[]) null); vertexBuffer.setTexCoords(0, vertexArray2, 1.0f, (float[]) null); return vertexBuffer; } /* renamed from: a */ private static Texture2D[] getTexture2DArray180(Image2D[] image2DArr, int i) { Texture2D[] texture2DArr = new Texture2D[i]; for (int i2 = 0; i2 < i; i2++) { if (image2DArr[i2] != null) { texture2DArr[i2] = new Texture2D(image2DArr[i2]); texture2DArr[i2].setFiltering(210, 210); texture2DArr[i2].setWrapping(240, 240); texture2DArr[i2].setBlending(228); } else { System.out.println(new StringBuffer("Image ").append(i2).append(" is null").toString()); } } return texture2DArr; } /* renamed from: a */ private Appearance getAppearance181(Texture2D texture2D) { this.appearance122 = new Appearance(); CompositingMode compositingMode = new CompositingMode(); compositingMode.setBlending(64); this.appearance122.setCompositingMode(compositingMode); this.appearance122.setTexture(0, texture2D); return this.appearance122; } /* renamed from: a */ public final void execute182(float f, float f2, float f3) { this.mesh121.setTranslation(f, f2, f3); } /* renamed from: a */ public final void execute183(boolean z) { this.flag126 = z; if (!this.flag126) { this.mesh121.setRenderingEnable(false); return; } this.mesh121.setRenderingEnable(true); this.value125 = 0; this.value128[0] = 0.0f; this.value128[0] = 0.0f; this.value128[0] = 0.0f; } /* renamed from: a */ public final void execute184() { if (this.flag126) { if (this.camera127 != null) { this.mesh121.align(this.camera127); } if (this.value125 == this.value124) { execute183(false); return; } this.appearance122.setTexture(0, this.texture123[this.value125]); this.value125++; if (this.value128[0] == 0.0f && this.value128[1] == 0.0f && this.value128[2] == 0.0f) { return; } float[] fArr = new float[3]; this.mesh121.getTranslation(fArr); float[] fArrM262c = VectorMath.getFloatArray262(fArr, this.value128); execute182(fArrM262c[0], fArrM262c[1], fArrM262c[2]); } } /* renamed from: a */ public final void execute185(float[] fArr) { System.arraycopy(fArr, 0, this.value128, 0, this.value128.length); } }