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.shape; 027 028import com.sun.javafx.geom.BaseBounds; 029import com.sun.javafx.geom.PickRay; 030import com.sun.javafx.scene.input.PickResultChooser; 031import com.sun.javafx.sg.PGTriangleMesh; 032import javafx.application.ConditionalFeature; 033import javafx.application.Platform; 034import javafx.beans.property.BooleanProperty; 035import javafx.beans.property.SimpleBooleanProperty; 036import javafx.scene.Node; 037import sun.util.logging.PlatformLogger; 038 039/** 040 * Base class for representing a 3D geometric surface. 041 * 042 * Note that this is a conditional feature. See 043 * {@link javafx.application.ConditionalFeature#SCENE3D ConditionalFeature.SCENE3D} 044 * for more information. 045 * 046 * @since JavaFX 8 047 */ 048public abstract class Mesh { 049 050 protected Mesh() { 051 if (!Platform.isSupported(ConditionalFeature.SCENE3D)) { 052 String logname = Mesh.class.getName(); 053 PlatformLogger.getLogger(logname).warning("System can't support " 054 + "ConditionalFeature.SCENE3D"); 055 } 056 } 057 058 // Mesh isn't a Node. It can't use the standard dirtyBits pattern that is 059 // in Node 060 // TODO: 3D - Material and Mesh have similar pattern. We should look into creating 061 // a "NodeComponent" class if more non-Node classes are needed. 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 final BooleanProperty dirtyProperty() { 076 return dirty; 077 } 078 079 // We only support one type of mesh for FX 8. 080 abstract PGTriangleMesh getPGMesh(); 081 abstract void impl_updatePG(); 082 083 abstract BaseBounds computeBounds(BaseBounds b); 084 085 /** 086 * Picking implementation. 087 * @param pickRay The pick ray 088 * @param pickResult The pick result to be updated (if a closer intersection is found) 089 * @param candidate The Node that owns this mesh to be filled in the pick 090 * result in case a closer intersection is found 091 * @param cullFace The cull face of the node that owns this mesh 092 * @param reportFace Whether to report the hit face 093 * @return true if the pickRay intersects this mesh (regardless of whether 094 * the pickResult has been updated) 095 * 096 * @treatAsPrivate implementation detail 097 * @deprecated This is an internal API that is not intended for use and will be removed in the next version 098 */ 099 @Deprecated 100 abstract protected boolean impl_computeIntersects(PickRay pickRay, 101 PickResultChooser pickResult, Node candidate, CullFace cullFace, 102 boolean reportFace); 103}