CompliantBatch.java 文件源码

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

项目:gdx-cclibs 作者:
/** Constructs a CompliantQuadBatch with a specified capacity and optional default shader.
 * @param maxVertices The number of vertices this FlexBatch can batch at once. Maximum of 32767.
 * @param generateDefaultShader Whether a default shader should be created. The default shader is owned by the
 *           CompliantQuadBatch, so it is disposed when the CompliantQuadBatch is disposed. If an alternate shader has been
 *           applied with {@link #setShader(ShaderProgram)}, the default can be used again by setting the shader to null.
 * @param supportPolygons Whether Poly2Ds are supported for drawing. The FlexBatch will not be optimized for
 *           FixedSizeBatchables. */
public CompliantBatch (Class<T> batchableType, int maxVertices, boolean generateDefaultShader, boolean supportPolygons) {
    super(batchableType, maxVertices, supportPolygons ? maxVertices * 2 : 0);
    try {
        tmp = batchableType.newInstance();
    } catch (Exception e) {
        throw new IllegalArgumentException("Batchable classes must be public and have an empty constructor.", e);
    }
    if (generateDefaultShader) {
        defaultShader = new ShaderProgram(BatchablePreparation.generateGenericVertexShader(1),
            BatchablePreparation.generateGenericFragmentShader(1));
        if (defaultShader.isCompiled() == false)
            throw new IllegalArgumentException("Error compiling shader: " + defaultShader.getLog());
        setShader(defaultShader);
    } else {
        defaultShader = null;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号