⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backgroundretained.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * Get the Backgound's application region.     * @return this Backgound's application region information     */      final Bounds getApplicationBounds() {	return (applicationRegion != null ?  (Bounds) applicationRegion.clone() : null);    }    /**     * Initializes the Background's application region      * to the specified Leaf node.     */      void initApplicationBoundingLeaf(BoundingLeaf region) {	if (region != null) {	    boundingLeaf = (BoundingLeafRetained)region.retained;	} else {	    boundingLeaf = null;	}    }    /**     * Set the Background's application region to the specified Leaf node.     */      void setApplicationBoundingLeaf(BoundingLeaf region) {	if (boundingLeaf != null)	    boundingLeaf.mirrorBoundingLeaf.removeUser(this);	    	if (region != null) {	    boundingLeaf = (BoundingLeafRetained)region.retained;	    boundingLeaf.mirrorBoundingLeaf.addUser(this);	} else {	    boundingLeaf = null;	}	J3dMessage createMessage = new J3dMessage();	createMessage.threads = targetThreads | 	    J3dThread.UPDATE_RENDERING_ENVIRONMENT;	createMessage.type = J3dMessage.BACKGROUND_CHANGED;	createMessage.universe = universe;	createMessage.args[0] = this;	createMessage.args[1]= new Integer(BOUNDINGLEAF_CHANGED);	if (boundingLeaf != null) {	    createMessage.args[2] = boundingLeaf.mirrorBoundingLeaf;	    createMessage.args[3] = null;	} else {	    createMessage.args[2] = null;	    if (applicationRegion != null)		createMessage.args[3] = applicationRegion.clone();	    else 		createMessage.args[3] = null;	}	VirtualUniverse.mc.processMessage(createMessage);    }    /**     * Get the Background's application region     */      BoundingLeaf getApplicationBoundingLeaf() {	return (boundingLeaf != null ?		(BoundingLeaf)boundingLeaf.source : null);    }    /**     * This sets the immedate mode context flag     */    void setInImmCtx(boolean inCtx) {        inImmCtx = inCtx;    }     /**     * This gets the immedate mode context flag     */    boolean getInImmCtx() {        return (inImmCtx);    }    void setGeometryBranch(BranchGroupRetained branch) {        setLiveState.reset(locale);        setLiveState.inBackgroundGroup = true;        setLiveState.geometryBackground = this;        setLiveState.currentTransforms[0] = new Transform3D[2];        setLiveState.currentTransforms[0][0] = new Transform3D();        setLiveState.currentTransforms[0][1] = new Transform3D();	setLiveState.currentTransformsIndex[0] = new int[2];	setLiveState.currentTransformsIndex[0][0] = 0;	setLiveState.currentTransformsIndex[0][1] = 0;	setLiveState.localToVworld = setLiveState.currentTransforms;	setLiveState.localToVworldIndex = setLiveState.currentTransformsIndex;        setLiveState.branchGroupPaths = new ArrayList();        setLiveState.branchGroupPaths.add(new BranchGroupRetained[0]);        setLiveState.orderedPaths = new ArrayList(1);        setLiveState.orderedPaths.add(new OrderedPath());        setLiveState.switchStates = new ArrayList(1);        setLiveState.switchStates.add(new SwitchState(false));	branch.setLive(setLiveState);    }    void clearGeometryBranch(BranchGroupRetained branch) {        setLiveState.reset(locale);        setLiveState.inBackgroundGroup = true;        setLiveState.geometryBackground = this;        branch.clearLive(setLiveState);        branch.setParent(null);        branch.setLocale(null);    }    /**     * This setLive routine first calls the superclass's method, then     * it adds itself to the list of lights     */    void setLive(SetLiveState s) {	TransformGroupRetained[] tlist;	int i;	super.doSetLive(s);        if (inImmCtx) {           throw new IllegalSharingException(				J3dI18N.getString("BackgroundRetained1"));        }        if (inBackgroundGroup) {            throw new              IllegalSceneGraphException(J3dI18N.getString("BackgroundRetained5"));        }	if (inSharedGroup) {	    throw new		IllegalSharingException(J3dI18N.getString("BackgroundRetained6"));	}        if (geometryBranch != null) {            BranchGroupRetained branch =                 (BranchGroupRetained)geometryBranch.retained;            if (branch.inBackgroundGroup == true)               throw new IllegalSharingException(				J3dI18N.getString("BackgroundRetained0"));            if (branch.parent != null)                              throw new IllegalSharingException(				J3dI18N.getString("BackgroundRetained3"));            if (branch.locale != null)                  throw new IllegalSharingException(				J3dI18N.getString("BackgroundRetained4"));	    if (setLiveState == null) {	   	setLiveState = new SetLiveState(universe);		setLiveState.universe = universe;	    }            setGeometryBranch((BranchGroupRetained)geometryBranch.retained);	    // add background geometry nodes to setLiveState's nodeList            s.nodeList.addAll(setLiveState.nodeList);	    s.notifyThreads |= setLiveState.notifyThreads;	    s.ogList.addAll(setLiveState.ogList);	    s.ogChildIdList.addAll(setLiveState.ogChildIdList);	    s.ogOrderedIdList.addAll(setLiveState.ogOrderedIdList);	    // Free up memory.            setLiveState.reset(null);        }		if ((s.viewScopedNodeList != null) && (s.viewLists != null)) {	    s.viewScopedNodeList.add(this);	    s.scopedNodesViewList.add(s.viewLists.get(0));	} else {	    s.nodeList.add(this);	}	// System.err.println("bkg.setlive nodeList " + s.nodeList);        // process switch leaf        if (s.switchTargets != null && s.switchTargets[0] != null) {            s.switchTargets[0].addNode(this, Targets.ENV_TARGETS);        }        switchState = (SwitchState)s.switchStates.get(0);	// Initialize some mirror values	if (boundingLeaf != null) {	    transformedRegion = 		(Bounds)boundingLeaf.mirrorBoundingLeaf.transformedRegion;	}	else { // Evaluate applicationRegion if not null	    if (applicationRegion != null) {		transformedRegion = (Bounds)applicationRegion.clone();		transformedRegion.transform(					applicationRegion,					getLastLocalToVworld());	    }	    else {		transformedRegion = null;	    }	    	}	cachedLocale = s.locale;        // add this node to the transform target        if (s.transformTargets != null && s.transformTargets[0] != null) {            s.transformTargets[0].addNode(this, Targets.ENV_TARGETS);	    s.notifyThreads |= J3dThread.UPDATE_TRANSFORM;        }	s.notifyThreads |= J3dThread.UPDATE_RENDERING_ENVIRONMENT|	    J3dThread.UPDATE_RENDER;	if (texture != null) {	    texture.setLive(inBackgroundGroup, refCount);	}	super.markAsLive();    }     /**     * This clearLive routine first calls the superclass's method, then     * it removes itself to the list of lights     */    void clearLive(SetLiveState s) {        super.clearLive(s);	if ((s.viewScopedNodeList != null) && (s.viewLists != null)) {	    s.viewScopedNodeList.add(this);	    s.scopedNodesViewList.add(s.viewLists.get(0));	} else {	    s.nodeList.add(this);	}        if (s.transformTargets != null && s.transformTargets[0] != null) {            s.transformTargets[0].addNode(this, Targets.ENV_TARGETS);	    s.notifyThreads |= J3dThread.UPDATE_TRANSFORM;        }        if (s.switchTargets != null && s.switchTargets[0] != null) {            s.switchTargets[0].addNode(this, Targets.ENV_TARGETS);        }        if (geometryBranch != null) {            BranchGroupRetained branch =                (BranchGroupRetained)geometryBranch.retained;            clearGeometryBranch((BranchGroupRetained)geometryBranch.retained);            // add background geometry nodes to setLiveState's nodeList            s.nodeList.addAll(setLiveState.nodeList);            s.ogList.addAll(setLiveState.ogList);            s.ogChildIdList.addAll(setLiveState.ogChildIdList);	    s.notifyThreads |= setLiveState.notifyThreads;	    // Free up memory.	    setLiveState.reset(null);            lights.clear();            fogs.clear();        }	if (texture != null) {	    texture.clearLive(refCount);	}	s.notifyThreads |= J3dThread.UPDATE_RENDERING_ENVIRONMENT|	    J3dThread.UPDATE_RENDER;    }    // The update Object function.    synchronized void updateImmediateMirrorObject(Object[] objs) {	int component = ((Integer)objs[1]).intValue();	Transform3D trans;	// If initialization		// Bounds message only sent when boundingleaf is null	if  ((component & BOUNDS_CHANGED) != 0) {	    if (objs[2] != null) {		transformedRegion = ((Bounds)((Bounds) objs[2])).copy(transformedRegion);		transformedRegion.transform(			(Bounds) objs[2], getCurrentLocalToVworld());	    }	    else {		transformedRegion = null;	    }	}	else if  ((component & BOUNDINGLEAF_CHANGED) != 0) {	    if (objs[2] != null) {		transformedRegion = ((BoundingLeafRetained)objs[2]).transformedRegion;	    }	    else { // Evaluate applicationRegion if not null		Bounds appRegion = (Bounds)objs[3];		if (appRegion != null) {		    transformedRegion = appRegion.copy(transformedRegion);		    transformedRegion.transform(			appRegion, getCurrentLocalToVworld());		}		else {		    transformedRegion = null;		}			    }	}    }    /** Note: This routine will only be called      * to  update the object's     * transformed region      */    void updateBoundingLeaf() {        if (boundingLeaf != null &&		boundingLeaf.mirrorBoundingLeaf.switchState.currentSwitchOn) {            transformedRegion =                        boundingLeaf.mirrorBoundingLeaf.transformedRegion;        } else { // Evaluate applicationRegion if not null            if (applicationRegion != null) {		transformedRegion = applicationRegion.copy(transformedRegion);                transformedRegion.transform(			applicationRegion, getCurrentLocalToVworld());            } else {                transformedRegion = null;            }        }    }    void updateImmediateTransformChange() {        // If bounding leaf is null, tranform the bounds object        if (boundingLeaf == null) {            if (applicationRegion != null) {		transformedRegion = applicationRegion.copy(transformedRegion);                transformedRegion.transform(			applicationRegion, getCurrentLocalToVworld());            }        }    }    final void sendMessage(int attrMask, Object attr) {	J3dMessage createMessage = new J3dMessage();	createMessage.threads = targetThreads;	createMessage.universe = universe;	createMessage.type = J3dMessage.BACKGROUND_CHANGED;	createMessage.args[0] = this;	createMessage.args[1]= new Integer(attrMask);	createMessage.args[2] = attr;	VirtualUniverse.mc.processMessage(createMessage);    }    void addBgGeometryAtomList(GeometryAtom geomAtom) {        bgGeometryAtomList.add(geomAtom);        bgGeometryAtomListDirty = true;    }    void removeBgGeometryAtomList(GeometryAtom geomAtom) {        bgGeometryAtomList.remove(bgGeometryAtomList.indexOf(geomAtom));        bgGeometryAtomListDirty = true;    }    GeometryAtom[] getBackgroundGeometryAtoms() {        if (bgGeometryAtomListDirty) {            int nAtoms = bgGeometryAtomList.size();            if (nAtoms == 0) {                bgGeometryAtoms = null;            } else {                bgGeometryAtoms = new GeometryAtom[nAtoms];                for (int i=0; i<bgGeometryAtoms.length; i++) {                    bgGeometryAtoms[i] = (GeometryAtom)bgGeometryAtomList.get(i) ;                }            bgGeometryAtomListDirty = false;           }        }        return(bgGeometryAtoms);    }    void mergeTransform(TransformGroupRetained xform) {	super.mergeTransform(xform);        if (applicationRegion != null) {            applicationRegion.transform(xform.transform);        }    }    // notifies the Background object that the image data in a referenced    // ImageComponent object is changed.    // Currently we are not making use of this information.    void notifyImageComponentImageChanged(ImageComponentRetained image,                                        ImageComponentUpdateInfo value) {    }    void getMirrorObjects(ArrayList leafList, HashKey key) {	leafList.add(this); // No Mirror in this case    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -