71 lines
1.8 KiB
Java
71 lines
1.8 KiB
Java
package com.mojang.blaze3d.textures;
|
|
|
|
import com.mojang.blaze3d.DontObfuscate;
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
@DontObfuscate
|
|
public abstract class GpuTexture implements AutoCloseable {
|
|
private final TextureFormat format;
|
|
private final int width;
|
|
private final int height;
|
|
private final int mipLevels;
|
|
private final String label;
|
|
protected AddressMode addressModeU = AddressMode.REPEAT;
|
|
protected AddressMode addressModeV = AddressMode.REPEAT;
|
|
protected FilterMode minFilter = FilterMode.NEAREST;
|
|
protected FilterMode magFilter = FilterMode.LINEAR;
|
|
protected boolean useMipmaps = true;
|
|
|
|
public GpuTexture(String string, TextureFormat textureFormat, int i, int j, int k) {
|
|
this.label = string;
|
|
this.format = textureFormat;
|
|
this.width = i;
|
|
this.height = j;
|
|
this.mipLevels = k;
|
|
}
|
|
|
|
public int getWidth(int i) {
|
|
return this.width >> i;
|
|
}
|
|
|
|
public int getHeight(int i) {
|
|
return this.height >> i;
|
|
}
|
|
|
|
public int getMipLevels() {
|
|
return this.mipLevels;
|
|
}
|
|
|
|
public TextureFormat getFormat() {
|
|
return this.format;
|
|
}
|
|
|
|
public void setAddressMode(AddressMode addressMode) {
|
|
this.setAddressMode(addressMode, addressMode);
|
|
}
|
|
|
|
public void setAddressMode(AddressMode addressMode, AddressMode addressMode2) {
|
|
this.addressModeU = addressMode;
|
|
this.addressModeV = addressMode2;
|
|
}
|
|
|
|
public void setTextureFilter(FilterMode filterMode, boolean bl) {
|
|
this.setTextureFilter(filterMode, filterMode, bl);
|
|
}
|
|
|
|
public void setTextureFilter(FilterMode filterMode, FilterMode filterMode2, boolean bl) {
|
|
this.minFilter = filterMode;
|
|
this.magFilter = filterMode2;
|
|
this.useMipmaps = bl;
|
|
}
|
|
|
|
public String getLabel() {
|
|
return this.label;
|
|
}
|
|
|
|
public abstract void close();
|
|
|
|
public abstract boolean isClosed();
|
|
}
|