Sha256: 56e5733bf4dc3e143aefd7fe275c9e395fe5ce589294f5101a1626242c35b174
Contents?: true
Size: 829 Bytes
Versions: 6
Compression:
Stored size: 829 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 NormalShader implements Shader { @Override public boolean update(ParameterList pl, SunflowAPI api) { return true; } @Override public Color getRadiance(ShadingState state) { Vector3 n = state.getNormal(); if (n == null) { return Color.BLACK; } float r = (n.x + 1) * 0.5f; float g = (n.y + 1) * 0.5f; float b = (n.z + 1) * 0.5f; return new Color(r, g, b); } @Override public void scatterPhoton(ShadingState state, Color power) { } }
Version data entries
6 entries across 6 versions & 1 rubygems