Spec-Zone .ru
спецификации, руководства, описания, API
001/*
002 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package javafx.scene.paint;
027
028import com.sun.javafx.sg.PGPhongMaterial;
029import javafx.application.ConditionalFeature;
030import javafx.application.Platform;
031import javafx.beans.property.BooleanProperty;
032import javafx.beans.property.SimpleBooleanProperty;
033import sun.util.logging.PlatformLogger;
034
035/**
036 * Base class for representing the material of a 3D surface.
037 * 
038 * Note that this is a conditional feature. See
039 * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D}
040 * for more information.
041 *
042 * @since JavaFX 8
043 */
044public abstract class Material {
045    /*
046     *     Material (including Shaders and Textures)
047     Material is not Paint
048     PhongMaterial maybe the first and only material in FX8 (see 3D conceptual implementation for details)
049     Bump map: Normal Map and Height Map -- We may generate a Normal Map when given a Height Map
050     Displacement map? Not in FX8 -- May do Parallex correction mapping to improve quality at performance cost
051     Support auto generated Mipmap
052     No plan to support Multi-texture
053     */
054
055    protected Material() {
056        if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {
057            String logname = Material.class.getName();
058            PlatformLogger.getLogger(logname).warning("System can't support "
059                                                      + "ConditionalFeature.SCENE3D");
060        }
061    }
062    
063    // Material isn't a Node. It can't use the standard dirtyBits pattern that is 
064    // in Node
065    private final BooleanProperty dirty = new SimpleBooleanProperty(true);
066
067    final boolean isDirty() {
068        return dirty.getValue();
069    }
070
071    void setDirty(boolean value) {
072        dirty.setValue(value);
073    }
074
075    /**
076     * @treatAsPrivate implementation detail
077     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
078     */
079    @Deprecated
080    public final BooleanProperty impl_dirtyProperty() {
081        return dirty;
082    }
083
084    /**
085     * @treatAsPrivate implementation detail
086     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
087     */
088    @Deprecated
089    abstract public void impl_updatePG();
090
091    /**
092     * @treatAsPrivate implementation detail
093     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
094     */
095    @Deprecated
096    abstract public PGPhongMaterial impl_getPGMaterial();
097}