RenderTargetDescriptor.java
com.mojang.blaze3d.resource.RenderTargetDescriptor
信息
- 全限定名:com.mojang.blaze3d.resource.RenderTargetDescriptor
- 类型:public record
- 包:com.mojang.blaze3d.resource
- 源码路径:src/main/java/com/mojang/blaze3d/resource/RenderTargetDescriptor.java
- 起始行号:L10
- 实现:ResourceDescriptor
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public RenderTarget allocate() @ L11
- 方法名:allocate
- 源码定位:L11
- 返回类型:RenderTarget
- 修饰符:public
参数:
- 无
说明:
TODO
public void prepare(RenderTarget resource) @ L15
- 方法名:prepare
- 源码定位:L15
- 返回类型:void
- 修饰符:public
参数:
- resource: RenderTarget
说明:
TODO
public void free(RenderTarget resource) @ L25
- 方法名:free
- 源码定位:L25
- 返回类型:void
- 修饰符:public
参数:
- resource: RenderTarget
说明:
TODO
public boolean canUsePhysicalResource(ResourceDescriptor<?> other) @ L29
- 方法名:canUsePhysicalResource
- 源码定位:L29
- 返回类型:boolean
- 修饰符:public
参数:
- other: ResourceDescriptor<?>
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record RenderTargetDescriptor(int width, int height, boolean useDepth, int clearColor) implements ResourceDescriptor<RenderTarget> {
public RenderTarget allocate() {
return new TextureTarget(null, this.width, this.height, this.useDepth);
}
public void prepare(RenderTarget resource) {
if (this.useDepth) {
RenderSystem.getDevice()
.createCommandEncoder()
.clearColorAndDepthTextures(resource.getColorTexture(), this.clearColor, resource.getDepthTexture(), 1.0);
} else {
RenderSystem.getDevice().createCommandEncoder().clearColorTexture(resource.getColorTexture(), this.clearColor);
}
}
public void free(RenderTarget resource) {
resource.destroyBuffers();
}
@Override
public boolean canUsePhysicalResource(ResourceDescriptor<?> other) {
return !(other instanceof RenderTargetDescriptor descriptor)
? false
: this.width == descriptor.width && this.height == descriptor.height && this.useDepth == descriptor.useDepth;
}
}引用的其他类
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
TextureTarget()
- 引用位置:
-
- 引用位置:
参数/实现
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
RenderSystem.getDevice()
- 引用位置: