ShadowFeatureRenderer.java
net.minecraft.client.renderer.feature.ShadowFeatureRenderer
信息
- 全限定名:net.minecraft.client.renderer.feature.ShadowFeatureRenderer
- 类型:public class
- 包:net.minecraft.client.renderer.feature
- 源码路径:src/main/java/net/minecraft/client/renderer/feature/ShadowFeatureRenderer.java
- 起始行号:L20
- 职责:
TODO
字段/常量
SHADOW_RENDER_TYPE- 类型:
RenderType - 修饰符:
private static final - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public void renderTranslucent(SubmitNodeCollection nodeCollection, MultiBufferSource.BufferSource bufferSource) @ L23
- 方法名:renderTranslucent
- 源码定位:L23
- 返回类型:void
- 修饰符:public
参数:
- nodeCollection: SubmitNodeCollection
- bufferSource: MultiBufferSource.BufferSource
说明:
TODO
private static void shadowVertex(Matrix4fc pose, VertexConsumer buffer, int color, float x, float y, float z, float u, float v) @ L48
- 方法名:shadowVertex
- 源码定位:L48
- 返回类型:void
- 修饰符:private static
参数:
- pose: Matrix4fc
- buffer: VertexConsumer
- color: int
- x: float
- y: float
- z: float
- u: float
- v: float
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class ShadowFeatureRenderer {
private static final RenderType SHADOW_RENDER_TYPE = RenderTypes.entityShadow(Identifier.withDefaultNamespace("textures/misc/shadow.png"));
public void renderTranslucent(SubmitNodeCollection nodeCollection, MultiBufferSource.BufferSource bufferSource) {
VertexConsumer buffer = bufferSource.getBuffer(SHADOW_RENDER_TYPE);
for (SubmitNodeStorage.ShadowSubmit submit : nodeCollection.getShadowSubmits()) {
for (EntityRenderState.ShadowPiece piece : submit.pieces()) {
AABB aabb = piece.shapeBelow().bounds();
float x01 = piece.relativeX() + (float)aabb.minX;
float x11 = piece.relativeX() + (float)aabb.maxX;
float y01 = piece.relativeY() + (float)aabb.minY;
float z01 = piece.relativeZ() + (float)aabb.minZ;
float z11 = piece.relativeZ() + (float)aabb.maxZ;
float radius = submit.radius();
float u0 = -x01 / 2.0F / radius + 0.5F;
float u1 = -x11 / 2.0F / radius + 0.5F;
float v0 = -z01 / 2.0F / radius + 0.5F;
float v1 = -z11 / 2.0F / radius + 0.5F;
int color = ARGB.white(piece.alpha());
shadowVertex(submit.pose(), buffer, color, x01, y01, z01, u0, v0);
shadowVertex(submit.pose(), buffer, color, x01, y01, z11, u0, v1);
shadowVertex(submit.pose(), buffer, color, x11, y01, z11, u1, v1);
shadowVertex(submit.pose(), buffer, color, x11, y01, z01, u1, v0);
}
}
}
private static void shadowVertex(Matrix4fc pose, VertexConsumer buffer, int color, float x, float y, float z, float u, float v) {
Vector3f position = pose.transformPosition(x, y, z, new Vector3f());
buffer.addVertex(position.x(), position.y(), position.z(), color, u, v, OverlayTexture.NO_OVERLAY, 15728880, 0.0F, 1.0F, 0.0F);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
RenderTypes.entityShadow()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Identifier.withDefaultNamespace()
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ARGB.white()
- 引用位置: