DynamicUniforms.java
net.minecraft.client.renderer.DynamicUniforms
信息
- 全限定名:net.minecraft.client.renderer.DynamicUniforms
- 类型:public class
- 包:net.minecraft.client.renderer
- 源码路径:src/main/java/net/minecraft/client/renderer/DynamicUniforms.java
- 起始行号:L17
- 实现:AutoCloseable
- 职责:
TODO
字段/常量
-
TRANSFORM_UBO_SIZE- 类型:
int - 修饰符:
public static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
CHUNK_SECTION_UBO_SIZE- 类型:
int - 修饰符:
public static final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
INITIAL_CAPACITY- 类型:
int - 修饰符:
private static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
transforms- 类型:
DynamicUniformStorage<DynamicUniforms.Transform> - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
chunkSections- 类型:
DynamicUniformStorage<DynamicUniforms.ChunkSectionInfo> - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.client.renderer.DynamicUniforms.ChunkSectionInfo- 类型:
record - 修饰符:
public - 源码定位:
L53 - 说明:
TODO
- 类型:
-
net.minecraft.client.renderer.DynamicUniforms.Transform- 类型:
record - 修饰符:
public - 源码定位:
L66 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
public void reset() @ L26
- 方法名:reset
- 源码定位:L26
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void close() @ L31
- 方法名:close
- 源码定位:L31
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public GpuBufferSlice writeTransform(Matrix4fc modelView, Vector4fc colorModulator, Vector3fc modelOffset, Matrix4fc textureMatrix) @ L37
- 方法名:writeTransform
- 源码定位:L37
- 返回类型:GpuBufferSlice
- 修饰符:public
参数:
- modelView: Matrix4fc
- colorModulator: Vector4fc
- modelOffset: Vector3fc
- textureMatrix: Matrix4fc
说明:
TODO
public GpuBufferSlice[] writeTransforms(DynamicUniforms.Transform... transforms) @ L44
- 方法名:writeTransforms
- 源码定位:L44
- 返回类型:GpuBufferSlice[]
- 修饰符:public
参数:
- transforms: DynamicUniforms.Transform…
说明:
TODO
public GpuBufferSlice[] writeChunkSections(DynamicUniforms.ChunkSectionInfo... infos) @ L48
- 方法名:writeChunkSections
- 源码定位:L48
- 返回类型:GpuBufferSlice[]
- 修饰符:public
参数:
- infos: DynamicUniforms.ChunkSectionInfo…
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DynamicUniforms implements AutoCloseable {
public static final int TRANSFORM_UBO_SIZE = new Std140SizeCalculator().putMat4f().putVec4().putVec3().putMat4f().get();
public static final int CHUNK_SECTION_UBO_SIZE = new Std140SizeCalculator().putMat4f().putFloat().putIVec2().putIVec3().get();
private static final int INITIAL_CAPACITY = 2;
private final DynamicUniformStorage<DynamicUniforms.Transform> transforms = new DynamicUniformStorage<>("Dynamic Transforms UBO", TRANSFORM_UBO_SIZE, 2);
private final DynamicUniformStorage<DynamicUniforms.ChunkSectionInfo> chunkSections = new DynamicUniformStorage<>(
"Chunk Sections UBO", CHUNK_SECTION_UBO_SIZE, 2
);
public void reset() {
this.transforms.endFrame();
this.chunkSections.endFrame();
}
@Override
public void close() {
this.transforms.close();
this.chunkSections.close();
}
public GpuBufferSlice writeTransform(Matrix4fc modelView, Vector4fc colorModulator, Vector3fc modelOffset, Matrix4fc textureMatrix) {
return this.transforms
.writeUniform(
new DynamicUniforms.Transform(new Matrix4f(modelView), new Vector4f(colorModulator), new Vector3f(modelOffset), new Matrix4f(textureMatrix))
);
}
public GpuBufferSlice[] writeTransforms(DynamicUniforms.Transform... transforms) {
return this.transforms.writeUniforms(transforms);
}
public GpuBufferSlice[] writeChunkSections(DynamicUniforms.ChunkSectionInfo... infos) {
return this.chunkSections.writeUniforms(infos);
}
@OnlyIn(Dist.CLIENT)
public record ChunkSectionInfo(Matrix4fc modelView, int x, int y, int z, float visibility, int textureAtlasWidth, int textureAtlasHeight)
implements DynamicUniformStorage.DynamicUniform {
@Override
public void write(ByteBuffer buffer) {
Std140Builder.intoBuffer(buffer)
.putMat4f(this.modelView)
.putFloat(this.visibility)
.putIVec2(this.textureAtlasWidth, this.textureAtlasHeight)
.putIVec3(this.x, this.y, this.z);
}
}
@OnlyIn(Dist.CLIENT)
public record Transform(Matrix4fc modelView, Vector4fc colorModulator, Vector3fc modelOffset, Matrix4fc textureMatrix)
implements DynamicUniformStorage.DynamicUniform {
@Override
public void write(ByteBuffer buffer) {
Std140Builder.intoBuffer(buffer).putMat4f(this.modelView).putVec4(this.colorModulator).putVec3(this.modelOffset).putMat4f(this.textureMatrix);
}
}
}引用的其他类
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Std140Builder.intoBuffer()
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
Std140SizeCalculator()
- 引用位置:
-
- 引用位置:
字段
- 引用位置: