RenderCylinderBox.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:HardVox 作者:
@Override
public void render(Vector3 cameraPos) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buf = tessellator.getBuffer();

    double xPos = this.centreX - cameraPos.getX();
    double zPos = this.centreZ - cameraPos.getZ();

    for (LineStyle line : this.style.getLines()) {
        if (!line.prepare(this.style.getRenderType())) {
            continue;
        }

        double twoPi = Math.PI * 2;
        for (int yBlock : new int[] { this.minY, this.maxY + 1 }) {
            buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
            line.applyColour();

            for (int i = 0; i <= 75; i++) {
                double tempTheta = i * twoPi / 75;
                double tempX = this.radX * Math.cos(tempTheta);
                double tempZ = this.radZ * Math.sin(tempTheta);

                buf.pos(xPos + tempX, yBlock - cameraPos.getY(), zPos + tempZ).endVertex();
            }
            tessellator.draw();
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号