Search in sources :

Example 1 with VertexAttribute

use of codechicken.lib.render.CCRenderState.VertexAttribute in project CodeChickenLib by Chicken-Bones.

the class CCRenderPipeline method rebuild.

public void rebuild() {
    if (ops.isEmpty() || CCRenderState.model == null)
        return;
    //ensure enough nodes for all ops
    while (nodes.size() < CCRenderState.operationCount()) nodes.add(new PipelineNode());
    unbuild();
    if (CCRenderState.useNormals)
        addAttribute(CCRenderState.normalAttrib);
    if (CCRenderState.useColour)
        addAttribute(CCRenderState.colourAttrib);
    if (CCRenderState.computeLighting)
        addAttribute(CCRenderState.lightingAttrib);
    for (int i = 0; i < ops.size(); i++) {
        IVertexOperation op = ops.get(i);
        loading = nodes.get(op.operationID());
        boolean loaded = op.load();
        if (loaded)
            loading.op = op;
        if (op instanceof VertexAttribute)
            if (loaded)
                attribs.add((VertexAttribute) op);
            else
                ((VertexAttribute) op).active = false;
    }
    for (int i = 0; i < nodes.size(); i++) nodes.get(i).add();
}
Also used : IVertexOperation(codechicken.lib.render.CCRenderState.IVertexOperation) VertexAttribute(codechicken.lib.render.CCRenderState.VertexAttribute)

Aggregations

IVertexOperation (codechicken.lib.render.CCRenderState.IVertexOperation)1 VertexAttribute (codechicken.lib.render.CCRenderState.VertexAttribute)1