Sha256: 05541d0d2e545ee76ce4ebcd385435349cbcc437dc08b92d6f093ec9c48db168

Contents?: true

Size: 989 Bytes

Versions: 11

Compression:

Stored size: 989 Bytes

Contents

package toxi.processing;

import toxi.color.ReadonlyTColor;
import toxi.color.ToneMap;
import toxi.geom.Vec3D;

/**
 *
 * @author tux
 */
public class DeltaOrientationMapper implements NormalMapper {

    /**
     *
     */
    protected Vec3D dir;

    /**
     *
     */
    protected ToneMap toneMap;

    /**
     *
     */
    protected double toneScale;

    /**
     *
     * @param dir
     * @param toneMap
     */
    public DeltaOrientationMapper(Vec3D dir, ToneMap toneMap) {
        this.dir = dir;
        setToneMap(toneMap);
    }

    /**
     *
     * @param normal
     * @return
     */
    @Override
    public ReadonlyTColor getRGBForNormal(Vec3D normal) {
        float dot = (float) (dir.dot(normal) * toneScale + toneScale);
        return toneMap.getToneFor(dot);
    }

    /**
     *
     * @param toneMap
     */
    public final void setToneMap(ToneMap toneMap) {
        this.toneMap = toneMap;
        this.toneScale = toneMap.map.getInputMedian();
    }
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
toxiclibs-2.1.0 src/main/java/toxi/processing/DeltaOrientationMapper.java
toxiclibs-2.0.0 src/main/java/toxi/processing/DeltaOrientationMapper.java
toxiclibs-1.0.0 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.9.3 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.9.2 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.9.1 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.9.0 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.8.0 src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.6.0-java src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.5.1-java src/toxi/processing/DeltaOrientationMapper.java
toxiclibs-0.5.0-java src/toxi/processing/DeltaOrientationMapper.java