Sha256: 2cf34e17623e5647f382530725f50ffa786be4053931a4f6326e6687f79b14f0
Contents?: true
Size: 897 Bytes
Versions: 6
Compression:
Stored size: 897 Bytes
Contents
package org.sunflow.core.shader; import org.sunflow.SunflowAPI; import org.sunflow.core.ParameterList; import org.sunflow.core.Shader; import org.sunflow.core.ShadingState; import org.sunflow.image.Color; import org.sunflow.math.Vector3; public class PrimIDShader implements Shader { private static final Color[] BORDERS = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW, Color.CYAN, Color.MAGENTA}; @Override public boolean update(ParameterList pl, SunflowAPI api) { return true; } @Override public Color getRadiance(ShadingState state) { Vector3 n = state.getNormal(); float f = n == null ? 1.0f : Math.abs(state.getRay().dot(n)); return BORDERS[state.getPrimitiveID() % BORDERS.length].copy().mul(f); } @Override public void scatterPhoton(ShadingState state, Color power) { } }
Version data entries
6 entries across 6 versions & 1 rubygems