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

📄 texturebin.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        if (texUnitState != null) {		            TextureRetained tex;            for (int i = 0; i < texUnitState.length; i++) {                if (texUnitState[i] != null) {                    if (texUnitState[i].texture != null) {                        tex = texUnitState[i].texture;                        tex.decTextureBinRefCount(this);                        if (tex.getTextureBinRefCount(this) == 0) {                            renderBin.addTextureResourceFreeList(tex);                        }			texUnitState[i].texture = null;                    }                    // make sure there is no more reference to the scenegraph                    texUnitState[i].mirror = null;                    texUnitState[i].texture = null;                    if (texUnitState[i].texAttrs != null &&                            texUnitState[i].texAttrs.source != null) {                        texUnitState[i].texAttrs = null;                    }                    if (texUnitState[i].texGen != null &&                            texUnitState[i].texGen.source != null) {                        texUnitState[i].texGen = null;                    }                }            }        }    }	    /**     * This tests if the qiven textureUnitState matches this TextureBin     */    boolean equals(TextureUnitStateRetained state[], RenderAtom ra) {	int i, j, k = 0;	TextureRetained texture;														      	// if this TextureBin is a soleUser case or the incoming	// app has changedFrequent bit set for any of the texture	// related component, then either the current TextureBin	// or the incoming app requires the same app match	if (((tbFlag & TextureBin.SOLE_USER) != 0) || 		((ra.app != null) &&              		 (ra.app.changedFrequent &                	    (AppearanceRetained.TEXTURE |                 	     AppearanceRetained.TEXCOORD_GEN |                 	     AppearanceRetained.TEXTURE_ATTR |                 	     AppearanceRetained.TEXTURE_UNIT_STATE)) != 0)) {	    if (app == ra.app) {		// if this textureBin is currently on a zombie state,		// we'll need to put it on the update list to reevaluate		// the state, because while it is on a zombie state,		// texture state could have been changed. Example,		// application could have detached an appearance,		// made changes to the texture references, and then		// reattached the appearance. In this case, the texture		// changes would not have reflected to the textureBin		if (numEditingRenderMolecules == 0) {		    //System.err.println("===> TB in zombie state  " + this);            	    if (soleUserCompDirty == 0) {                        this.renderBin.tbUpdateList.add(this);            	    }            	    soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_REF;		}		return true;	    } else {		return false;	    }	}	if (texUnitState == null && state == null)	    return (true);	if (texUnitState == null || state == null)	    return (false);	    	if (state.length != texUnitState.length) 	    return (false);	for (i = 0; i < texUnitState.length; i++) {	    // If texture Unit State is null	    if (texUnitState[i] == null) {		if (state[i] != null)		    return (false);	    }	    else {		if (!texUnitState[i].equivalent(state[i])) {		    return (false);		}	    }	}	// Check if the image component has changed(may be a clearLive texture	// change img component. setLive case)	//	if ((tbFlag & TextureBin.ON_RENDER_BIN_LIST) == 0) {	    renderBin.addTextureBin(this);	    tbFlag |= TextureBin.ON_RENDER_BIN_LIST;	}	return (true);    }    /*    // updateNodeComponentCheck is called for each soleUser TextureBin     // into which new renderAtom has been added. This method is called before    // updateNodeComponent() to allow TextureBin to catch any node    // component changes that have been missed because the changes    // come when there is no active renderAtom associated with the    // TextureBin. See bug# 4503926 for details.    public void updateNodeComponentCheck() {	//System.err.println("TextureBin.updateNodeComponentCheck()");	tbFlag &= ~TextureBin.ON_UPDATE_CHECK_LIST;	if ((soleUserCompDirty & SOLE_USER_DIRTY_REF) != 0) {	    return ;	}       	if ((app.compChanged & (AppearanceRetained.TEXTURE |                 		AppearanceRetained.TEXCOORD_GEN |                 		AppearanceRetained.TEXTURE_ATTR |                 		AppearanceRetained.TEXTURE_UNIT_STATE)) != 0) {            if (soleUserCompDirty == 0) {                this.renderBin.tbUpdateList.add(this);            }            soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_REF;        } else if (app.texUnitState != null) {	    // if one texture unit state has to be reevaluated, then	    // it's enough update checking because reevaluating texture unit	    // state will automatically take care of its node component	    // updates.	    boolean done = false;            for (int i = 0; i < app.texUnitState.length && !done; i++) {                if (app.texUnitState[i] != null) {		    if (app.texUnitState[i].compChanged != 0) { 		        if (soleUserCompDirty == 0) {			    this.renderBin.tbUpdateList.add(this);		        }		        soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TUS;			done = true;		    } else {			if (app.texUnitState[i].texAttrs != null &&				app.texUnitState[i].texAttrs.compChanged != 0) {			    if (soleUserCompDirty == 0) {				this.renderBin.tbUpdateList.add(this);			    }			    soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TA;			}			if (app.texUnitState[i].texGen != null &&				app.texUnitState[i].texGen.compChanged != 0) {			    if (soleUserCompDirty == 0) {				this.renderBin.tbUpdateList.add(this);			    }			    soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TC;			}			if (app.texUnitState[i].texture != null &&				((app.texUnitState[i].texture.compChanged &				    TextureRetained.ENABLE_CHANGED) != 0)) {			    if (soleUserCompDirty == 0) {				this.renderBin.tbUpdateList.add(this);			    }			    soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TEXTURE;			}		    }		}	    }	}    }     */		         /**     * updateNodeComponent is called from RenderBin to update the     * clone copy of the sole user node component in TextureBin when the     * corresponding node component is being modified     */    public void updateNodeComponent() {	// don't bother to update if the TextureBin is already	// removed from RenderBin	if ((tbFlag & TextureBin.ON_RENDER_BIN_LIST) == 0) 	    return;	// if any of the texture reference in the appearance referenced	// by a sole user TextureBin is being modified, just do a reset	if (((tbFlag & TextureBin.SOLE_USER) != 0) && 		((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_REF) != 0)) { 	    resetTextureState(app.texUnitState);	    return;	} 	if (texUnitState == null)  {	    soleUserCompDirty = 0;	    return;	}	if ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_TUS) != 0) {	    // Now take care of the Texture Unit State changes	    TextureUnitStateRetained tus, mirrorTUS = null;	    boolean soleUser = ((tbFlag & TextureBin.SOLE_USER) != 0);	    for (int i = 0; i < texUnitState.length; i++) {	        tus = texUnitState[i];	        if (tus != null) {		    if (tus.mirror != null) {		        mirrorTUS = (TextureUnitStateRetained)tus.mirror;					if (tus.texture != mirrorTUS.texture) {			    if (tus.texture != null) {				tus.texture.decTextureBinRefCount(this);			    }		            tus.texture = mirrorTUS.texture;			    if (tus.texture != null) {				tus.texture.incTextureBinRefCount(this);			    }			    // the first texture (TextureBin sorting			    // criteria) is modified, so needs to resort			    if (i == 0) {				tbFlag |= TextureBin.RESORT;			    }			}			  		        if (mirrorTUS.texAttrs != null) {			    if (mirrorTUS.texAttrs.changedFrequent != 0) {			        tus.texAttrs = mirrorTUS.texAttrs;			    } else {			        if (tus.texAttrs == null ||				  	tus.texAttrs.source != null) {				    tus.texAttrs = 					new TextureAttributesRetained();			        }			        tus.texAttrs.set(mirrorTUS.texAttrs);				tus.texAttrs.mirrorCompDirty = true;								if (soleUser) {				    tus.texAttrs.mirror = mirrorTUS.texAttrs;				} else {				    tus.texAttrs.mirror = null;				}			    }		        } else {			    tus.texAttrs = null;		        }				        if (mirrorTUS.texGen != null) {			    if (mirrorTUS.texGen.changedFrequent != 0) {			        tus.texGen = mirrorTUS.texGen;			    } else {			        if (tus.texGen == null ||				  	tus.texGen.source != null) {				    tus.texGen = 					    new TexCoordGenerationRetained();			        }			        tus.texGen.set(mirrorTUS.texGen);				tus.texGen.mirrorCompDirty = true;								if (soleUser) {				    tus.texGen.mirror = mirrorTUS.texGen;				} else {				    tus.texGen.mirror = null;				}			    }		        } else {			    tus.texGen = null;		        }		    }	        }	    }	    // need to reEvaluate # of active textures after the update	    soleUserCompDirty |= TextureBin.SOLE_USER_DIRTY_TEXTURE;	    // TextureUnitState update automatically taken care of	    // TextureAttributes & TexCoordGeneration update	    soleUserCompDirty &= ~(TextureBin.SOLE_USER_DIRTY_TA |					TextureBin.SOLE_USER_DIRTY_TC);	} 	if ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_TEXTURE) != 0) {	    boolean foundDisableUnit = false;	    numActiveTexUnit = 0;	    lastActiveTexUnitIndex = 0;	    tbFlag |= TextureBin.CONTIGUOUS_ACTIVE_UNITS;	    for (int i = 0; i < texUnitState.length; i++) {                // Track the last active texture unit and the total number                // of active texture units. Note that this total number                // now includes disabled units so that there is always                // a one-to-one mapping. We no longer remap texture units.                if (texUnitState[i] != null &&			texUnitState[i].isTextureEnabled()) {                    lastActiveTexUnitIndex = i;                    numActiveTexUnit = i + 1;                    if (foundDisableUnit) {                        // mark that active texture units are not                        // contiguous                        tbFlag &= ~TextureBin.CONTIGUOUS_ACTIVE_UNITS;                    }                } else {                    foundDisableUnit = true;                }	    }	}	if ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_TA) != 0) {	    for (int i = 0; i < texUnitState.length; i++) {		if (texUnitState[i] != null &&			texUnitState[i].texAttrs != null &&			texUnitState[i].texAttrs.mirror != null &&		        texUnitState[i].texAttrs.mirror.changedFrequent != 0) {		    texUnitState[i].texAttrs = (TextureAttributesRetained)				texUnitState[i].texAttrs.mirror;		}	    }	}	if ((soleUserCompDirty & TextureBin.SOLE_USER_DIRTY_TC) != 0) {	    for (int i = 0; i < texUnitState.length; i++) {		if (texUnitState[i] != null &&			texUnitState[i].texGen != null &&			texUnitState[i].texGen.mirror != null &&		        texUnitState[i].texGen.mirror.changedFrequent != 0) {		    texUnitState[i].texGen = (TexCoordGenerationRetained)				texUnitState[i].texGen.mirror;		}	    }	}	soleUserCompDirty = 0;    }    public void updateObject() {	if (!addOpaqueRMs.isEmpty()) {	    opaqueRMList = addAll(opaqueRenderMoleculeMap, addOpaqueRMs, 					opaqueRMList, true);	}	if (!addTransparentRMs.isEmpty()) {	    // If transparent and not in bg geometry and inodepth 	    // sorted transparency	    if (transparentRMList == null &&		(renderBin.transpSortMode == View.TRANSPARENCY_SORT_NONE ||		environmentSet.lightBin.geometryBackground != null)) {		//		System.err.println("========> addTransparentTextureBin "+this); 		transparentRMList = addAll(transparentRenderMoleculeMap, 				addTransparentRMs, transparentRMList, false);		// Eventhough we are adding to transparentList , if all the RMS		// have been switched already due to changeLists, then there is		// nothing to add, and TBIN does not have any transparentRMList		if (transparentRMList != null) {		    renderBin.addTransparentObject(this);		}	    }	    else {		transparentRMList = addAll(transparentRenderMoleculeMap, 				addTransparentRMs, transparentRMList, false);	    }		

⌨️ 快捷键说明

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