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

📄 renderingenvironmentstructure.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
			if ((list = (ArrayList)viewScopedFogs.get(view)) == null) {			    list = new ArrayList();			    viewScopedFogs.put(view, list);			}			list.add(n);		    }		} else if (n instanceof AlternateAppearanceRetained) {		    ((AlternateAppearanceRetained)n).isViewScoped = true;		    numberOfAltApps++;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			if ((list = (ArrayList)viewScopedAltAppearances.get(view)) == null) {			    list = new ArrayList();			    viewScopedAltAppearances.put(view, list);			}			list.add(n);		    }		} else if (n instanceof BackgroundRetained) {		    ((BackgroundRetained)n).isViewScoped = true;		    numberOfBgs++;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			if ((list = (ArrayList)viewScopedBackgrounds.get(view)) == null) {			    list = new ArrayList();			    viewScopedBackgrounds.put(view, list);			}			list.add(n);		    }		    		} else if (n instanceof ClipRetained) {		    ((ClipRetained)n).isViewScoped = true;		    numberOfClips++;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			if ((list = (ArrayList)viewScopedClips.get(view)) == null) {			    list = new ArrayList();			    viewScopedClips.put(view, list);			}			list.add(n);		    }		} else if (n instanceof ModelClipRetained) {		    ((ModelClipRetained)n).isViewScoped = true;		    numberOfModelClips++;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			if ((list = (ArrayList)viewScopedModelClips.get(view)) == null) {			    list = new ArrayList();			    viewScopedModelClips.put(view, list);			}			list.add(n);		    }		}	    }	}	if (numberOfLights > retlights.length)	    retlights = new LightRetained[numberOfLights];	if (intersectedFogs.length < numberOfFogs)	    intersectedFogs = new FogRetained[numberOfFogs];	if (intersectedAltApps.length < numberOfAltApps)	    intersectedAltApps = new AlternateAppearanceRetained[numberOfAltApps];	if (intersectedBacks.length < numberOfBgs) 	    intersectedBacks = new BackgroundRetained[numberOfBgs];	if (intersectedClips.length < numberOfClips) 	    intersectedClips = new ClipRetained[numberOfClips];	if (intersectedModelClips.length < numberOfModelClips)	    intersectedModelClips = new ModelClipRetained[numberOfModelClips];    }    void removeNodes(J3dMessage m) {	Object[] nodes = (Object[])m.args[0];	ArrayList viewScopedNodes = (ArrayList)m.args[3];	ArrayList scopedNodesViewList = (ArrayList)m.args[4];        Object n;        int i;	GeometryAtom ga;	LeafRetained oldsrc = null;	// System.err.println("RE : removeNodes message " + m);	// System.err.println("RE : removeNodes m.args[0] " + m.args[0]);	for (i=0; i<nodes.length; i++) {	    n = nodes[i];	    if (n instanceof LightRetained) {		LightRetained lt = (LightRetained)n;		if (lt.inBackgroundGroup) {		    lt.geometryBackground.lights.remove(lt);		}		else {		    nonViewScopedLights.remove(nonViewScopedLights.indexOf(n));		}				numberOfLights--;	    } else if (n instanceof FogRetained) {		numberOfFogs--;                FogRetained fg = (FogRetained)n;		if (fg.inBackgroundGroup) {		    fg.geometryBackground.fogs.remove(fg);		} else {		    nonViewScopedFogs.remove(nonViewScopedFogs.indexOf(n));		}	    } else if (n instanceof  AlternateAppearanceRetained) {		numberOfAltApps--;	        nonViewScopedAltAppearances.remove(nonViewScopedAltAppearances.indexOf(n));	    }else if (n instanceof BackgroundRetained) {		numberOfBgs--;	        nonViewScopedBackgrounds.remove(nonViewScopedBackgrounds.indexOf(n));	    } else if (n instanceof ClipRetained) {		numberOfClips--;	        nonViewScopedClips.remove(nonViewScopedClips.indexOf(n));	    } else if (n instanceof ModelClipRetained) {		ModelClipRetained mc = (ModelClipRetained)n;		numberOfModelClips--;		nonViewScopedModelClips.remove(nonViewScopedModelClips.indexOf(n));		    	    }	    else if (n instanceof GeometryAtom) {		ga = (GeometryAtom)n;		// Check that we have not already cleared the mirrorobject		// since mant geometry atoms could be generated for one		// mirror shape		if (ga.source != oldsrc) {		    ga.source.clearMirrorShape();		    oldsrc = ga.source;		}	    }	    else if (n instanceof OrderedGroupRetained) {		// Clear the orderedBins for this orderedGroup		((OrderedGroupRetained)n).clearDerivedDataStructures();	    }	}	if (viewScopedNodes != null) {	    int size = viewScopedNodes.size();	    int vlsize;	    ArrayList list;	    for (i = 0; i < size; i++) {		n = (NodeRetained)viewScopedNodes.get(i);		ArrayList vl = (ArrayList) scopedNodesViewList.get(i);		if (n instanceof LightRetained) {		    ((LightRetained)n).isViewScoped = false;		    numberOfLights--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedLights.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedLights.remove(view);			}		    }		} else if (n instanceof FogRetained) {		    ((FogRetained)n).isViewScoped = false;		    numberOfFogs--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedFogs.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedFogs.remove(view);			}		    }		} else if (n instanceof AlternateAppearanceRetained) {		    ((AlternateAppearanceRetained)n).isViewScoped = false;		    numberOfAltApps--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedAltAppearances.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedAltAppearances.remove(view);			}		    }		} else if (n instanceof BackgroundRetained) {		    ((BackgroundRetained)n).isViewScoped = false;		    numberOfBgs--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedBackgrounds.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedBackgrounds.remove(view);			}		    }		    		} else if (n instanceof ClipRetained) {		    ((ClipRetained)n).isViewScoped = false;		    numberOfClips--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedClips.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedClips.remove(view);			}		    }		} else if (n instanceof ModelClipRetained) {		    ((ModelClipRetained)n).isViewScoped = false;		    numberOfModelClips--;		    vlsize = vl.size();		    for (int k = 0; k < vlsize; k++) {			View view = (View)vl.get(k);			list = (ArrayList)viewScopedModelClips.get(view);			list.remove(n);			if (list.size() == 0) {			    viewScopedModelClips.remove(view);			}		    }		}	    }	}    }    LightRetained[] getInfluencingLights(RenderAtom ra, View view) {	LightRetained[] lightAry = null;        ArrayList globalLights;	int numLights;	int i, j, n;	// Need to lock retlights, since on a multi-processor	// system with 2 views on a single universe, there might	// be councurrent access	synchronized (retlights) {	    numLights = 0;	    if (ra.geometryAtom.source.inBackgroundGroup) {		globalLights = ra.geometryAtom.source.geometryBackground.lights;		numLights = processLights(globalLights, ra, numLights);	    } else {		if ((globalLights = (ArrayList)viewScopedLights.get(view)) != null) {		    numLights = processLights(globalLights, ra, numLights);		}		// now process the common lights		numLights = processLights(nonViewScopedLights, ra, numLights);	    }	    boolean newLights = false;	    if (ra.lights != null && ra.lights.length == numLights) {		for (i=0; i<ra.lights.length; i++) {		    for (j=0; j<numLights; j++) {			if (ra.lights[i] == retlights[j]) {			    break;			}		    }		    if (j==numLights) {			newLights = true;			break;		    }		}	    } else {		newLights = true;	    }	    if (newLights) {		lightAry = new LightRetained[numLights];		for (i = 0; i < numLights; i++) {		    lightAry[i] = (LightRetained)retlights[i];		}		return (lightAry);	    } else {		return(ra.lights);	    }	}    }    // Called while holding the retlights lock    int processLights(ArrayList globalLights, RenderAtom ra, int numLights) {	LightRetained[] shapeScopedLt;        Bounds bounds;	int i, j, n;        bounds = ra.localeVwcBounds;	int size = globalLights.size();	if (size > 0) {	    for (i=0; i<size; i++) {		LightRetained light = (LightRetained)globalLights.get(i);		//		System.err.println("vwcBounds = "+bounds);		//		System.err.println("light.region = "+light.region);		//		System.err.println("Intersected = "+bounds.intersect(light.region));		//		System.err.println("");		    		//		    if ((light.viewList != null && light.viewList.contains(view)) &&		// Treat lights in background geo as having infinite bounds		if (light.lightOn && light.switchState.currentSwitchOn &&		    (ra.geometryAtom.source.inBackgroundGroup || bounds.intersect(light.region))){		    // Get the mirror Shape3D node 		    n = ((Shape3DRetained)ra.geometryAtom.source).numlights;		    shapeScopedLt = ((Shape3DRetained)ra.geometryAtom.source).lights;		    // System.err.println("numLights per shape= "+n);		    // scoped Fog/light is kept in the original		    // shape3D node, what happens if this list changes		    // while accessing them?. So, Lock.		    if (light.isScoped) {			for (j = 0; j < n; j++) {			    // then check if the light is scoped to 			    // this group			    if (light == shapeScopedLt[j]) {				retlights[numLights++] = light;				break;			    }			}		    }		    else {			retlights[numLights++] = light;		    }		}	    }	}	return numLights;    }    FogRetained getInfluencingFog(RenderAtom ra, View view) {	FogRetained fog = null;	int i, j, k, n, nfogs;	Bounds closestBounds;        ArrayList globalFogs;	int numFogs;	// Need to lock lockObj, since on a multi-processor	// system with 2 views on a single universe, there might	// be councurrent access		synchronized(lockObj) {	    nfogs = 0;	    Bounds bounds = ra.localeVwcBounds;	    if (intersectedBounds.length < numberOfFogs)		intersectedBounds = new Bounds[numberOfFogs];	    if (ra.geometryAtom.source.inBackgroundGroup) {		globalFogs = ra.geometryAtom.source.geometryBackground.fogs;		nfogs = processFogs(globalFogs, ra, nfogs);		// If background, then nfogs > 1, take the first one		if (nfogs >= 1)		    fog = intersectedFogs[0];			    } else {		if ((globalFogs = (ArrayList)viewScopedFogs.get(view)) != null) {		    nfogs = processFogs(globalFogs, ra, nfogs);		}		// now process the common fogs		nfogs = processFogs(nonViewScopedFogs, ra, nfogs);	    		if (nfogs == 1)		    fog = intersectedFogs[0];		else if (nfogs > 1) {		    closestBounds = bounds.closestIntersection(intersectedBounds);		    for (j= 0; j < nfogs; j++) {			if (intersectedBounds[j] == closestBounds) {			    fog = intersectedFogs[j];			    break;			}		    }		}	    }	    return (fog);	}    }    // Called while holding lockObj lock    int processFogs(ArrayList globalFogs, RenderAtom ra, int numFogs) {	int size = globalFogs.size();	FogRetained fog;	int i, k, n;        Bounds bounds = ra.localeVwcBounds;	FogRetained[] shapeScopedFog;	if (globalFogs.size() > 0) {	    for (i = 0 ; i < size; i++) {		fog = (FogRetained) globalFogs.get(i);		// Note : There is no enable check for fog		if (fog.region != null && fog.switchState.currentSwitchOn &&		    (ra.geometryAtom.source.inBackgroundGroup || fog.region.intersect(bounds))) {		    n = ((Shape3DRetained)ra.geometryAtom.source).numfogs;		    shapeScopedFog = ((Shape3DRetained)ra.geometryAtom.source).fogs;		    if (fog.isScoped) {			for (k = 0; k < n; k++) {			    // then check if the Fog is scoped to 			    // this group			    if (fog == shapeScopedFog[k]) {				    				intersectedBounds[numFogs] = fog.region;				intersectedFogs[numFogs++] = fog;				break;			    }			}		    }		    else {			intersectedBounds[numFogs] = fog.region;			intersectedFogs[numFogs++] = fog;		    }		}	    }	}	return numFogs;    }    ModelClipRetained getInfluencingModelClip(RenderAtom ra, View view) {	ModelClipRetained modelClip = null;	int i, j, k, n, nModelClips;	Bounds closestBounds;        ArrayList globalModelClips;		if (ra.geometryAtom.source.inBackgroundGroup) {	    return null;	}	// Need to lock lockObj, since on a multi-processor	// system with 2 views on a single universe, there might	// be councurrent access		synchronized(lockObj) {	    Bounds bounds = ra.localeVwcBounds;	    nModelClips = 0;	    if (intersectedBounds.length < numberOfModelClips)		intersectedBounds = new Bounds[numberOfModelClips];	    if ((globalModelClips = (ArrayList)viewScopedModelClips.get(view)) != null) {		nModelClips = processModelClips(globalModelClips, ra, nModelClips);	    }	    // now process the common clips	    nModelClips = processModelClips(nonViewScopedModelClips, ra, nModelClips);	    modelClip = null;	    if (nModelClips == 1)		modelClip = intersectedModelClips[0];	    else if (nModelClips > 1) {		closestBounds = bounds.closestIntersection(intersectedBounds);

⌨️ 快捷键说明

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