Sha256: 50464bd8ed4f9ee03012200895bedb392177f5f05aeec759a69669ede1f119db

Contents?: true

Size: 914 Bytes

Versions: 6

Compression:

Stored size: 914 Bytes

Contents

package org.sunflow.core.shader;

import org.sunflow.SunflowAPI;
import org.sunflow.core.ParameterList;
import org.sunflow.core.ShadingState;
import org.sunflow.core.Texture;
import org.sunflow.core.TextureCache;
import org.sunflow.image.Color;

public class TexturedAmbientOcclusionShader extends AmbientOcclusionShader {

    private Texture tex;

    public TexturedAmbientOcclusionShader() {
        tex = null;
    }

    @Override
    public boolean update(ParameterList pl, SunflowAPI api) {
        String filename = pl.getString("texture", null);
        if (filename != null) {
            tex = TextureCache.getTexture(api.resolveTextureFilename(filename), false);
        }
        return tex != null && super.update(pl, api);
    }

    @Override
    public Color getBrightColor(ShadingState state) {
        return tex.getPixel(state.getUV().x, state.getUV().y);
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
joonsrenderer-1.3.1-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java
joonsrenderer-1.2.0-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java
joonsrenderer-1.1.3-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java
joonsrenderer-1.1.2-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java
joonsrenderer-1.1.1-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java
joonsrenderer-1.1-java src/main/java/org/sunflow/core/shader/TexturedAmbientOcclusionShader.java