TexturedQuad.java 文件源码

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

项目:Backmemed 作者:
/**
 * Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the
 * renderer and reused later.
 */
public void draw(VertexBuffer renderer, float scale)
{
    Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D);
    Vec3d vec3d1 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D);
    Vec3d vec3d2 = vec3d1.crossProduct(vec3d).normalize();
    float f = (float)vec3d2.xCoord;
    float f1 = (float)vec3d2.yCoord;
    float f2 = (float)vec3d2.zCoord;

    if (this.invertNormal)
    {
        f = -f;
        f1 = -f1;
        f2 = -f2;
    }

    if (Config.isShaders())
    {
        renderer.begin(7, SVertexFormat.defVertexFormatTextured);
    }
    else
    {
        renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL);
    }

    for (int i = 0; i < 4; ++i)
    {
        PositionTextureVertex positiontexturevertex = this.vertexPositions[i];
        renderer.pos(positiontexturevertex.vector3D.xCoord * (double)scale, positiontexturevertex.vector3D.yCoord * (double)scale, positiontexturevertex.vector3D.zCoord * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).normal(f, f1, f2).endVertex();
    }

    Tessellator.getInstance().draw();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号