codechicken.lib.math.InterpHelper

Here are the examples of the java api codechicken.lib.math.InterpHelper taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : Quad.java
with GNU Lesser General Public License v2.1
from TheCBProject

/**
 * Used to reset the interpolation values inside the provided helper.
 *
 * @param helper The helper.
 * @param s      The axis. side >> 1;
 * @return The same helper.
 */
public InterpHelper resetInterp(InterpHelper helper, int s) {
    // 
    helper.reset(// 
    vertices[0].dx(s), // 
    vertices[0].dy(s), // 
    vertices[1].dx(s), // 
    vertices[1].dy(s), // 
    vertices[2].dx(s), // 
    vertices[2].dy(s), vertices[3].dx(s), vertices[3].dy(s));
    return helper;
}

19 Source : QuadReInterpolator.java
with GNU Lesser General Public License v2.1
from TheCBProject

/**
 * This transformer Re-Interpolates the Color, UV's and LightMaps.
 * Use this after all transformations that translate vertices in the pipeline.
 * <p>
 * This Transformation can only be used in the BakedPipeline.
 *
 * @author covers1624
 */
public clreplaced QuadReInterpolator extends QuadTransformer {

    public static final IPipelineElementFactory<QuadReInterpolator> FACTORY = QuadReInterpolator::new;

    private final Quad interpCache = new Quad();

    private final InterpHelper interpHelper = new InterpHelper();

    QuadReInterpolator() {
        super();
    }

    @Override
    public void reset(CachedFormat format) {
        super.reset(format);
        interpCache.reset(format);
    }

    @Override
    public void setInputQuad(Quad quad) {
        super.setInputQuad(quad);
        quad.resetInterp(interpHelper, quad.orientation.ordinal() >> 1);
    }

    @Override
    public boolean transform() {
        int s = quad.orientation.ordinal() >> 1;
        if (format.hasColor || format.hasUV || format.hasLightMap) {
            interpCache.copyFrom(quad);
            interpHelper.setup();
            for (Vertex v : quad.vertices) {
                interpHelper.locate(v.dx(s), v.dy(s));
                if (format.hasColor) {
                    v.interpColorFrom(interpHelper, interpCache.vertices);
                }
                if (format.hasUV) {
                    v.interpUVFrom(interpHelper, interpCache.vertices);
                }
                if (format.hasLightMap) {
                    v.interpLightMapFrom(interpHelper, interpCache.vertices);
                }
            }
        }
        return true;
    }
}