package S0;

import B0.A;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/* JADX INFO: loaded from: classes.dex */
public final class k implements GLSurfaceView.Renderer, c {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final /* synthetic */ l f6247A;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final j f6248q;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final float[] f6251t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final float[] f6252u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final float[] f6253v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public float f6254w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public float f6255x;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final float[] f6249r = new float[16];

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final float[] f6250s = new float[16];

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final float[] f6256y = new float[16];

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final float[] f6257z = new float[16];

    public k(l lVar, j jVar) {
        this.f6247A = lVar;
        float[] fArr = new float[16];
        this.f6251t = fArr;
        float[] fArr2 = new float[16];
        this.f6252u = fArr2;
        float[] fArr3 = new float[16];
        this.f6253v = fArr3;
        this.f6248q = jVar;
        Matrix.setIdentityM(fArr, 0);
        Matrix.setIdentityM(fArr2, 0);
        Matrix.setIdentityM(fArr3, 0);
        this.f6255x = 3.1415927f;
    }

    @Override // S0.c
    public final synchronized void a(float[] fArr, float f3) {
        float[] fArr2 = this.f6251t;
        System.arraycopy(fArr, 0, fArr2, 0, fArr2.length);
        float f7 = -f3;
        this.f6255x = f7;
        Matrix.setRotateM(this.f6252u, 0, -this.f6254w, (float) Math.cos(f7), (float) Math.sin(this.f6255x), 0.0f);
    }

    @Override // android.opengl.GLSurfaceView.Renderer
    public final void onDrawFrame(GL10 gl10) {
        synchronized (this) {
            Matrix.multiplyMM(this.f6257z, 0, this.f6251t, 0, this.f6253v, 0);
            Matrix.multiplyMM(this.f6256y, 0, this.f6252u, 0, this.f6257z, 0);
        }
        Matrix.multiplyMM(this.f6250s, 0, this.f6249r, 0, this.f6256y, 0);
        this.f6248q.d(this.f6250s);
    }

    @Override // android.opengl.GLSurfaceView.Renderer
    public final void onSurfaceChanged(GL10 gl10, int i, int i5) {
        GLES20.glViewport(0, 0, i, i5);
        float f3 = i / i5;
        Matrix.perspectiveM(this.f6249r, 0, f3 > 1.0f ? (float) (Math.toDegrees(Math.atan(Math.tan(Math.toRadians(45.0d)) / ((double) f3))) * 2.0d) : 90.0f, f3, 0.1f, 100.0f);
    }

    @Override // android.opengl.GLSurfaceView.Renderer
    public final synchronized void onSurfaceCreated(GL10 gl10, EGLConfig eGLConfig) {
        l lVar = this.f6247A;
        lVar.f6264u.post(new A(lVar, 20, this.f6248q.e()));
    }
}
