package net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.VkModel;

import java.io.*;

public class ModelBinaryData {
    private final String IndexFilePath;
    private final DataOutputStream IndexOutput;
    private final String VertexFilePath;
    private final DataOutputStream VertexOutput;
    private int IndexOffset;
    private int VertexOffset;

    public ModelBinaryData(String ModelPath) throws FileNotFoundException{
        VertexFilePath = ModelPath.substring(0,ModelPath.lastIndexOf('.')) + ".vtx";
        VertexOutput = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(VertexFilePath)));
        IndexFilePath= ModelPath.substring(0,ModelPath.lastIndexOf('.')) + ".idx";
        IndexOutput = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(IndexFilePath)));
    }

    public void Close() throws IOException {
        VertexOutput.close();
        IndexOutput.close();
    }

    public String GetIndexFilePath(){return IndexFilePath;}
    public int GetIndexOffset(){return IndexOffset;}
    public DataOutputStream GetIndexOutput(){return IndexOutput;}
    public String GetVertexFilePath(){return VertexFilePath;}
    public int GetVertexOffset(){return VertexOffset;}
    public DataOutputStream GetVertexOutput(){return VertexOutput;}
    public void IncrementIndexOffset(int Increment){
        IndexOffset+=Increment;
    }
    public void IncrementVertexOffset(int Increment){VertexOffset+=Increment;}
}
