// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.math.hitdetection.projection;

import javax.annotation.Nonnull;
import com.hypixel.hytale.math.matrix.Matrix4d;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.math.hitdetection.MatrixProvider;

public class OrthogonalProjectionProvider implements MatrixProvider
{
    public static final BuilderCodec<OrthogonalProjectionProvider> CODEC;
    protected final Matrix4d matrix;
    protected final Matrix4d rotMatrix;
    protected boolean invalid;
    protected double left;
    protected double right;
    protected double bottom;
    protected double top;
    protected double near;
    protected double far;
    protected double yaw;
    protected double pitch;
    protected double roll;
    
    public OrthogonalProjectionProvider() {
        this(new Matrix4d(), 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0);
    }
    
    public OrthogonalProjectionProvider(final Matrix4d matrix, final double left, final double right, final double bottom, final double top, final double near, final double far, final double yaw, final double pitch, final double roll) {
        this.rotMatrix = new Matrix4d();
        this.matrix = matrix;
        this.left = left;
        this.right = right;
        this.bottom = bottom;
        this.top = top;
        this.near = near;
        this.far = far;
        this.yaw = yaw;
        this.pitch = pitch;
        this.roll = roll;
        this.invalid = true;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setLeft(final double left) {
        this.left = left;
        this.invalid = true;
        return this;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setRight(final double right) {
        this.right = right;
        this.invalid = true;
        return this;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setBottom(final double bottom) {
        this.bottom = bottom;
        this.invalid = true;
        return this;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setTop(final double top) {
        this.top = top;
        this.invalid = true;
        return this;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setNear(final double near) {
        this.near = near;
        this.invalid = true;
        return this;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setFar(final double far) {
        this.far = far;
        this.invalid = true;
        return this;
    }
    
    public double getRange() {
        return this.far;
    }
    
    @Nonnull
    public OrthogonalProjectionProvider setRotation(final double yaw, final double pitch, final double roll) {
        this.yaw = yaw;
        this.pitch = pitch;
        this.roll = roll;
        return this;
    }
    
    @Override
    public Matrix4d getMatrix() {
        if (this.invalid) {
            this.matrix.projectionOrtho(this.left, this.right, this.bottom, this.top, this.near, this.far);
            this.matrix.rotateAxis(this.roll, 0.0, 0.0, 1.0, this.rotMatrix);
            this.matrix.rotateAxis(this.pitch, 1.0, 0.0, 0.0, this.rotMatrix);
            this.matrix.rotateAxis(this.yaw, 0.0, 1.0, 0.0, this.rotMatrix);
            this.invalid = false;
        }
        return this.matrix;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "OrthogonalProjectionProvider{left=" + this.left + ", right=" + this.right + ", bottom=" + this.bottom + ", top=" + this.top + ", near=" + this.near + ", far=" + this.far;
    }
    
    static {
        // 
        // This method could not be decompiled.
        // 
        // Original Bytecode:
        // 
        //     2: invokedynamic   BootstrapMethod #1, get:()Ljava/util/function/Supplier;
        //     7: invokestatic    com/hypixel/hytale/codec/builder/BuilderCodec.builder:(Ljava/lang/Class;Ljava/util/function/Supplier;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //    10: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //    13: dup            
        //    14: ldc             "Left"
        //    16: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //    19: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //    22: invokedynamic   BootstrapMethod #2, accept:()Ljava/util/function/BiConsumer;
        //    27: invokedynamic   BootstrapMethod #3, apply:()Ljava/util/function/Function;
        //    32: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //    35: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //    38: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //    41: dup            
        //    42: ldc             "Right"
        //    44: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //    47: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //    50: invokedynamic   BootstrapMethod #4, accept:()Ljava/util/function/BiConsumer;
        //    55: invokedynamic   BootstrapMethod #5, apply:()Ljava/util/function/Function;
        //    60: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //    63: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //    66: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //    69: dup            
        //    70: ldc             "Top"
        //    72: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //    75: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //    78: invokedynamic   BootstrapMethod #6, accept:()Ljava/util/function/BiConsumer;
        //    83: invokedynamic   BootstrapMethod #7, apply:()Ljava/util/function/Function;
        //    88: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //    91: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //    94: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //    97: dup            
        //    98: ldc             "Bottom"
        //   100: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //   103: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //   106: invokedynamic   BootstrapMethod #8, accept:()Ljava/util/function/BiConsumer;
        //   111: invokedynamic   BootstrapMethod #9, apply:()Ljava/util/function/Function;
        //   116: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //   119: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //   122: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //   125: dup            
        //   126: ldc             "Near"
        //   128: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //   131: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //   134: invokedynamic   BootstrapMethod #10, accept:()Ljava/util/function/BiConsumer;
        //   139: invokedynamic   BootstrapMethod #11, apply:()Ljava/util/function/Function;
        //   144: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //   147: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //   150: new             Lcom/hypixel/hytale/codec/KeyedCodec;
        //   153: dup            
        //   154: ldc             "Far"
        //   156: getstatic       com/hypixel/hytale/codec/Codec.DOUBLE:Lcom/hypixel/hytale/codec/codecs/simple/DoubleCodec;
        //   159: invokespecial   com/hypixel/hytale/codec/KeyedCodec.<init>:(Ljava/lang/String;Lcom/hypixel/hytale/codec/Codec;)V
        //   162: invokedynamic   BootstrapMethod #12, accept:()Ljava/util/function/BiConsumer;
        //   167: invokedynamic   BootstrapMethod #13, apply:()Ljava/util/function/Function;
        //   172: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.addField:(Lcom/hypixel/hytale/codec/KeyedCodec;Ljava/util/function/BiConsumer;Ljava/util/function/Function;)Lcom/hypixel/hytale/codec/builder/BuilderCodec$BuilderBase;
        //   175: checkcast       Lcom/hypixel/hytale/codec/builder/BuilderCodec$Builder;
        //   178: invokevirtual   com/hypixel/hytale/codec/builder/BuilderCodec$Builder.build:()Lcom/hypixel/hytale/codec/builder/BuilderCodec;
        //   181: putstatic       com/hypixel/hytale/math/hitdetection/projection/OrthogonalProjectionProvider.CODEC:Lcom/hypixel/hytale/codec/builder/BuilderCodec;
        //   184: return         
        // 
        // The error that occurred was:
        // 
        // java.lang.UnsupportedOperationException: The requested operation is not supported.
        //     at com.strobel.util.ContractUtils.unsupported(ContractUtils.java:27)
        //     at com.strobel.assembler.metadata.TypeReference.getRawType(TypeReference.java:284)
        //     at com.strobel.assembler.metadata.TypeReference.getRawType(TypeReference.java:279)
        //     at com.strobel.assembler.metadata.TypeReference.makeGenericType(TypeReference.java:154)
        //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitParameterizedType(TypeSubstitutionVisitor.java:225)
        //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitParameterizedType(TypeSubstitutionVisitor.java:25)
        //     at com.strobel.assembler.metadata.ParameterizedType.accept(ParameterizedType.java:103)
        //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visit(TypeSubstitutionVisitor.java:40)
        //     at com.strobel.assembler.metadata.TypeSubstitutionVisitor.visitMethod(TypeSubstitutionVisitor.java:314)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2611)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1510)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:790)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2689)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1510)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:790)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferCall(TypeAnalysis.java:2689)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1040)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:782)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:778)
        //     at com.strobel.decompiler.ast.TypeAnalysis.doInferTypeForExpression(TypeAnalysis.java:1083)
        //     at com.strobel.decompiler.ast.TypeAnalysis.inferTypeForExpression(TypeAnalysis.java:815)
        //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:684)
        //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:667)
        //     at com.strobel.decompiler.ast.TypeAnalysis.runInference(TypeAnalysis.java:373)
        //     at com.strobel.decompiler.ast.TypeAnalysis.run(TypeAnalysis.java:95)
        //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:344)
        //     at com.strobel.decompiler.ast.AstOptimizer.optimize(AstOptimizer.java:42)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:206)
        //     at com.strobel.decompiler.languages.java.ast.AstMethodBodyBuilder.createMethodBody(AstMethodBodyBuilder.java:93)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethodBody(AstBuilder.java:868)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createMethod(AstBuilder.java:761)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addTypeMembers(AstBuilder.java:638)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeCore(AstBuilder.java:605)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createTypeNoCache(AstBuilder.java:195)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.createType(AstBuilder.java:162)
        //     at com.strobel.decompiler.languages.java.ast.AstBuilder.addType(AstBuilder.java:137)
        //     at com.strobel.decompiler.languages.java.JavaLanguage.buildAst(JavaLanguage.java:71)
        //     at com.strobel.decompiler.languages.java.JavaLanguage.decompileType(JavaLanguage.java:59)
        //     at com.strobel.decompiler.DecompilerDriver.decompileType(DecompilerDriver.java:333)
        //     at com.strobel.decompiler.DecompilerDriver.decompileJar(DecompilerDriver.java:254)
        //     at com.strobel.decompiler.DecompilerDriver.main(DecompilerDriver.java:129)
        // 
        throw new IllegalStateException("An error occurred while decompiling this method.");
    }
}
