mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-11 15:57:42 +00:00
36 lines
966 B
Java
36 lines
966 B
Java
package codechicken.lib.lighting;
|
|
|
|
import codechicken.lib.colour.ColourRGBA;
|
|
import codechicken.lib.render.CCRenderState;
|
|
|
|
/**
|
|
* Faster precomputed version of LightModel that only works for axis planar sides
|
|
*/
|
|
public class PlanarLightModel implements CCRenderState.IVertexOperation
|
|
{
|
|
public static PlanarLightModel standardLightModel = LightModel.standardLightModel.reducePlanar();
|
|
|
|
public int[] colours;
|
|
|
|
public PlanarLightModel(int[] colours) {
|
|
this.colours = colours;
|
|
}
|
|
|
|
@Override
|
|
public boolean load() {
|
|
CCRenderState.pipeline.addDependency(CCRenderState.sideAttrib);
|
|
CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib);
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void operate() {
|
|
CCRenderState.setColour(ColourRGBA.multiply(CCRenderState.colour, colours[CCRenderState.side]));
|
|
}
|
|
|
|
@Override
|
|
public int operationID() {
|
|
return LightModel.operationIndex;
|
|
}
|
|
}
|