001: /*
002: * $RCSfile: UpdateTargets.java,v $
003: *
004: * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006: *
007: * This code is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License version 2 only, as
009: * published by the Free Software Foundation. Sun designates this
010: * particular file as subject to the "Classpath" exception as provided
011: * by Sun in the LICENSE file that accompanied this code.
012: *
013: * This code is distributed in the hope that it will be useful, but WITHOUT
014: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: * version 2 for more details (a copy is included in the LICENSE file that
017: * accompanied this code).
018: *
019: * You should have received a copy of the GNU General Public License version
020: * 2 along with this work; if not, write to the Free Software Foundation,
021: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022: *
023: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024: * CA 95054 USA or visit www.sun.com if you need additional information or
025: * have any questions.
026: *
027: * $Revision: 1.6 $
028: * $Date: 2008/02/28 20:17:32 $
029: * $State: Exp $
030: */
031:
032: package javax.media.j3d;
033:
034: class UpdateTargets {
035:
036: static int updateSwitchThreads[] = {
037: // GEO
038: J3dThread.UPDATE_RENDER
039: | J3dThread.UPDATE_RENDERING_ENVIRONMENT
040: | J3dThread.UPDATE_GEOMETRY,
041:
042: // ENV
043: J3dThread.UPDATE_RENDER
044: | J3dThread.UPDATE_RENDERING_ENVIRONMENT,
045:
046: // BEH
047: J3dThread.UPDATE_BEHAVIOR,
048:
049: // SND
050: J3dThread.UPDATE_SOUND | J3dThread.SOUND_SCHEDULER,
051:
052: // VPF
053: J3dThread.UPDATE_RENDER | J3dThread.UPDATE_BEHAVIOR
054: | J3dThread.UPDATE_SOUND
055: | J3dThread.SOUND_SCHEDULER,
056:
057: // BLN
058: J3dThread.UPDATE_RENDER
059: | J3dThread.UPDATE_RENDERING_ENVIRONMENT
060: | J3dThread.UPDATE_BEHAVIOR
061: | J3dThread.UPDATE_SOUND,
062:
063: // GRP
064: 0 };
065:
066: UnorderList[] targetList = new UnorderList[Targets.MAX_NODELIST];
067:
068: int computeSwitchThreads() {
069: int switchThreads = 0;
070:
071: for (int i = 0; i < Targets.MAX_NODELIST; i++) {
072: if (targetList[i] != null) {
073: switchThreads |= updateSwitchThreads[i];
074: }
075: }
076: return switchThreads | J3dThread.UPDATE_TRANSFORM;
077: }
078:
079: void addNode(Object node, int targetType) {
080: if (targetList[targetType] == null)
081: targetList[targetType] = new UnorderList(1);
082:
083: targetList[targetType].add(node);
084: }
085:
086: void addNodeArray(Object[] nodeArr, int targetType) {
087: if (targetList[targetType] == null)
088: targetList[targetType] = new UnorderList(1);
089:
090: targetList[targetType].add(nodeArr);
091: }
092:
093: void clearNodes() {
094: for (int i = 0; i < Targets.MAX_NODELIST; i++) {
095: if (targetList[i] != null) {
096: targetList[i].clear();
097: }
098: }
099: }
100:
101: void addCachedTargets(CachedTargets cachedTargets) {
102: for (int i = 0; i < Targets.MAX_NODELIST; i++) {
103: if (cachedTargets.targetArr[i] != null) {
104: addNodeArray(cachedTargets.targetArr[i], i);
105: }
106: }
107: }
108:
109: void dump() {
110: for (int i = 0; i < Targets.MAX_NODELIST; i++) {
111: if (targetList[i] != null) {
112: System.err.println(" " + CachedTargets.typeString[i]);
113: for (int j = 0; j < targetList[i].size(); j++) {
114: System.err.println(" " + targetList[i].get(j));
115: }
116: }
117: }
118: }
119: }
|