Java源码示例:com.jme3.post.filters.FXAAFilter

示例1
@Override
@JmeThread
public void initialize(@NotNull final AppStateManager stateManager, @NotNull final Application application) {
    super.initialize(stateManager, application);

    final SceneNode currentModel = getCurrentModel();

    if (currentModel != null) {
        getModelNode().attachChild(currentModel);
    }

    final JmeApplication jmeApplication = JmeApplication.getInstance();
    final FXAAFilter fxaaFilter = jmeApplication.getFXAAFilter();
    fxaaFilter.setEnabled(false);

    final ToneMapFilter toneMapFilter = jmeApplication.getToneMapFilter();
    toneMapFilter.setEnabled(false);
}
 
示例2
@Override
@JmeThread
public void cleanup() {
    super.cleanup();

    final SceneNode currentModel = getCurrentModel();

    if (currentModel != null) {
        getModelNode().detachChild(currentModel);
    }

    final EditorConfig editorConfig = EditorConfig.getInstance();
    final JmeApplication jmeApplication = JmeApplication.getInstance();

    final FXAAFilter fxaaFilter = jmeApplication.getFXAAFilter();
    fxaaFilter.setEnabled(editorConfig.getBoolean(PREF_FILTER_FXAA, PREF_DEFAULT_FXAA_FILTER));

    final ToneMapFilter toneMapFilter = jmeApplication.getToneMapFilter();
    toneMapFilter.setEnabled(editorConfig.getBoolean(PREF_FILTER_TONEMAP, PREF_DEFAULT_TONEMAP_FILTER));
}
 
示例3
@Override
protected Sheet createSheet() {
    Sheet sheet = super.createSheet();

    Sheet.Set set = Sheet.createPropertiesSet();
    set.setDisplayName("FXAA");
    set.setName("FXAA");
    FXAAFilter obj = (FXAAFilter) filter;

    if (obj == null) {
        return sheet;
    }

    createFields(FXAAFilter.class, set, obj);

    sheet.put(set);
    return sheet;

}
 
示例4
@Test
public void registerFilter() {
    MANAGER.addOnAfterCreateJmeContext(() -> {
        final FXAAFilter filter = new FXAAFilter();
        final RenderFilterExtension filterExtension = RenderFilterExtension.getInstance();
        filterExtension.register(filter);
        filterExtension.setOnRefresh(filter, Object::notify);
    });
}
 
示例5
public void setupLights() {
    AmbientLight al = new AmbientLight();
    al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1));
    rootNode.addLight(al);
    
    SpotLight sl = new SpotLight();
    sl.setColor(ColorRGBA.White.mult(1.0f));
    sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f));
    sl.setDirection(sl.getPosition().mult(-1)); 
    sl.setSpotOuterAngle(0.1f);
    sl.setSpotInnerAngle(0.004f);      
    rootNode.addLight(sl);
    
    //pointlight to fake indirect light coming from the ground
    PointLight pl = new PointLight();
    pl.setColor(ColorRGBA.White.mult(1.5f));
    pl.setPosition(new Vector3f(0, 0, 1));
    pl.setRadius(2);
    rootNode.addLight(pl);
    
    SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024);
    shadows.setLight(sl);
    shadows.setShadowIntensity(0.3f);
    shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
    viewPort.addProcessor(shadows);

    
    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    SSAOFilter filter = new SSAOFilter(0.10997847f,0.440001f,0.39999998f,-0.008000026f);;
    fpp.addFilter(filter);
    fpp.addFilter(new FXAAFilter());
    fpp.addFilter(new FXAAFilter());     
    
    viewPort.addProcessor(fpp);
}
 
示例6
@Override
protected Filter doCreateFilter() {
    return new FXAAFilter();
}
 
示例7
public JmeFXAAFilter(FXAAFilter filter, DataObject object, boolean readOnly) {
    super(filter);
    this.dataObject = object;
    this.readOnly = readOnly;
}
 
示例8
@Override
public Class<?> getExplorerObjectClass() {
    return FXAAFilter.class;
}
 
示例9
@Override
public Node[] createNodes(Object key, DataObject dataObject, boolean readOnly) {
    return new Node[]{new JmeFXAAFilter((FXAAFilter) key, dataObject, readOnly)};
}
 
示例10
/**
 * Get the FXAA filter.
 *
 * @return the FXAA filter.
 */
@JmeThread
public @NotNull FXAAFilter getFXAAFilter() {
    return notNull(fxaaFilter);
}