📄 renderbin.java
字号:
case J3dMessage.ORDERED_GROUP_INSERTED: case J3dMessage.ORDERED_GROUP_REMOVED: if(m.args[3] != null) { Object[] ogArr = (Object[]) m.args[3]; Object[] ogTableArr = (Object[]) m.args[4]; for(j=0; j<ogArr.length; j++) { if(ogArr[j] != null) { ((OrderedGroupRetained)ogArr[j]).childIndexOrder = ((int[])ogTableArr[j]); } } } break; } m.decRefcount(); } } if (addOpaqueBin != null) { if (opaqueBin != null) { tmp = opaqueBin; while (tmp.next != null) { tmp = tmp.next; } addOpaqueBin.prev = tmp; tmp.next = addOpaqueBin; } else { opaqueBin = addOpaqueBin; } } if (bgAddOpaqueBin != null) { if (bgOpaqueBin != null) { tmp = bgOpaqueBin; while (tmp.next != null) { tmp = tmp.next; } bgAddOpaqueBin.prev = tmp; tmp.next = bgAddOpaqueBin; } else { bgOpaqueBin = bgAddOpaqueBin; } } size = orderedBinsList.size(); if (size > 0 ) { for (i = 0; i < size; i++) { ArrayList obs= (ArrayList) orderedBinsList.get(i); ArrayList list = (ArrayList) toBeAddedBinList.get(i); int lSize = list.size(); for (j = 0; j < lSize; j++) { obs.add(list.get(j)); } } } size = raLocaleVwcBoundsUpdateList.size(); if ( size > 0) { RenderAtom renderAtom; for (i = 0; i < size; i++) { renderAtom = (RenderAtom)raLocaleVwcBoundsUpdateList.get(i); renderAtom.updateLocaleVwcBounds(); } } if ((size = aBinUpdateList.size()) > 0) { for (i = 0; i < size; i++) { AttributeBin abin = (AttributeBin)aBinUpdateList.get(i); abin.updateNodeComponent(); } } if ((size = sBinUpdateList.size()) > 0) { for (i = 0; i < size; i++) { ShaderBin sbin = (ShaderBin)sBinUpdateList.get(i); sbin.updateNodeComponent(); } } // Update the sole user TextureBins. if (tbUpdateList.size() > 0) { TextureBin tb; size = tbUpdateList.size(); for (i = 0; i < size; i++) { tb = (TextureBin) tbUpdateList.get(i); tb.updateNodeComponent(); } // do another pass to re-sort TextureBin based on the // texture in the first texture unit state for (i = 0; i < size; i++) { tb = (TextureBin) tbUpdateList.get(i); // Bug Id : 4701430 - Have to be sure tb.shaderBin is // not equal to null. This is a temporary fix for j3d1.3. if (((tb.tbFlag & TextureBin.RESORT) != 0) && (tb.shaderBin != null)) { tb.shaderBin.reInsertTextureBin(tb); tb.tbFlag &= ~TextureBin.RESORT; } } } // Update the soleUser node components first // This way material equivalence during insertion // of new RMs is based on the updated ones if ((size = rmUpdateList.size()) > 0) { for (i = 0; i < size; i++) { rm = (RenderMolecule)rmUpdateList.get(i); boolean changeLists = rm.updateNodeComponent(); // If an existing rm went from opaque to transparent or vice-versa // and has not been removed, then switch the RM if (changeLists && rm.textureBin != null) { rm.textureBin.changeLists(rm); } } for (i = 0; i < size; i++) { rm = (RenderMolecule)rmUpdateList.get(i); rm.reEvaluateEquivalence(); } } size = objUpdateList.size(); if ( size > 0) { for (i = 0; i < size; i++) { ob = (ObjectUpdate)objUpdateList.get(i); ob.updateObject(); } } size = dirtyReferenceGeomList.size(); if ( size > 0) { GeometryArrayRetained geo; Canvas3D canvases[] = view.getCanvases(); for (i = 0; i < size; i++) { geo = (GeometryArrayRetained) dirtyReferenceGeomList.get(i); // Evaluate the nodeComponentList for all the canvases geo.geomLock.getLock(); j = 0; // Do the setup only once{if necessary} for each geometry boolean found = false; while(j < canvases.length && !found) { if ((canvases[j].extensionsSupported & Canvas3D.SUN_GLOBAL_ALPHA) == 0) { if ((geo.vertexFormat & GeometryArray.INTERLEAVED) != 0) { geo.setupMirrorInterleavedColorPointer(true); found = true; } else { geo.setupMirrorColorPointer((geo.vertexType & GeometryArrayRetained.COLOR_DEFINED),true); found = true; } } j++; } geo.geomLock.unLock(); } } if (reEvaluateBg) { setBackground(currentActiveBackground); } size = textureBinList.size();//System.err.println("textureBinList.size= " + size); if (size > 0) { Canvas3D canvasList[][] = view.getCanvasList(false); Canvas3D cv; boolean useSharedCtx = false; TextureRetained texture; // do a quick check to see if there is any canvas using // shared context for (j = 0; j < canvasList.length && !useSharedCtx; j++) { cv = canvasList[j][0]; if (cv.useSharedCtx) { useSharedCtx = true; } } for (int m = 0; m <size; m++) { k = 0; TextureBin tb = (TextureBin) textureBinList.get(m); tb.tbFlag |= TextureBin.ON_RENDER_BIN_LIST; if (tb.texUnitState == null) continue; for (i = 0; i < tb.texUnitState.length; i++) { if (tb.texUnitState[i] != null && tb.texUnitState[i].texture != null) { texture = tb.texUnitState[i].texture; // for all the textures in this texture bin list that // need to be reloaded, add the textures to the // corresponding resource reload list if the // resource uses shared context, // so that the texture can be reloaded up front, and // we don't need to do make context current for // each texture reload. Make Context current isn't // cheap. if (useSharedCtx) { synchronized (texture.resourceLock) { for (j = 0; j < canvasList.length; j++) { cv = canvasList[j][0]; if (cv.useSharedCtx && cv.screen.renderer != null && ((cv.screen.renderer.rendererBit & (texture.resourceCreationMask | texture.resourceInReloadList)) == 0)) { cv.screen.renderer.textureReloadList.add( texture); texture.resourceInReloadList |= cv.screen.renderer.rendererBit; } } } } } } } } size = newNodeComponentList.size(); if ( size > 0) {//System.err.println("newNodeComponentlist.size= " + size); Canvas3D canvases[] = view.getCanvases(); for (i = 0; i < size; i++) { // Evaluate the nodeComponentList for all the canvases ImageComponentRetained nc = (ImageComponentRetained)newNodeComponentList.get(i); if (nc.isByReference()) { nc.geomLock.getLock(); for (j = 0; j <canvases.length; j++) { // If the context is null, then the extension // will be evaluated during context creation in // the renderer if (canvases[j].ctx != null) { nc.evaluateExtensions(canvases[j]); } } nc.geomLock.unLock(); } else { for (j = 0; j <canvases.length; j++) { // If the context is null, then the extension // will be evaluated during context creation in // the renderer if (canvases[j].ctx != null) { nc.evaluateExtensions(canvases[j]); } } } nodeComponentList.add(nc); } } size = removeNodeComponentList.size(); if ( size > 0) { for (i = 0; i < size; i++) { nodeComponentList.remove(removeNodeComponentList.get(i)); } } // reevaluate dirty node component size = dirtyNodeComponentList.size(); if (size > 0) { Canvas3D canvases[] = view.getCanvases(); for (i = 0; i < size; i++) { // Evaluate the nodeComponentList for all the canvases ImageComponentRetained nc = (ImageComponentRetained)dirtyNodeComponentList.get(i); if (nc.isByReference()) { nc.geomLock.getLock(); for (j = 0; j <canvases.length; j++) { // If the context is null, then the extension // will be evaluated during context creation in // the renderer if (canvases[j].ctx != null) { nc.evaluateExtensions( canvases[j]); } } nc.geomLock.unLock(); } else { for (j = 0; j <canvases.length; j++) { // If the context is null, then the extension // will be evaluated during context creation in // the renderer if (canvases[j].ctx != null) { nc.evaluateExtensions(canvases[j]); } } } } } if (reEvaluateClip) { double[] retVal = null; if ((retVal = universe.renderingEnvironmentStructure.backClipDistanceInVworld(vpSchedSphereInVworld, view)) != null) { backClipDistanceInVworld = retVal[0]; backClipActive = true; } else { backClipActive = false; } view.vDirtyMask |= View.CLIP_DIRTY; } // Issue 113 - multiScreen no longer used// multiScreen = ((view.getScreens()).length > 1); // renderBin is ready now, so send the offScreen message size = offScreenMessage.size(); if ( size > 0) { J3dMessage m; for (i=size-1; i>=0; i--) { m = (J3dMessage) offScreenMessage.get(i); m.threads = J3dThread.RENDER_THREAD; ((Canvas3D)m.args[0]).screen.renderer.rendererStructure.addMessage(m); // the above call will increment the reference count again m.decRefcount(); } } // called from renderBin when there are dirtyOrientedRAs // This routin cache the dirtyOrintedRAs to be updated // by mastercontrol if (dirtyOrientedRAs.size() > 0) { // Keep a copy to be handled by mastercontrol cachedDirtyOrientedRAs = (ArrayList)dirtyOrientedRAs.clone(); } boolean sortAll = false; if (reEvaluateSortMode && transpSortMode != cachedTranspSortMode) { convertTransparentRenderingStruct(transpSortMode, cachedTranspSortMode); transpSortMode = cachedTranspSortMode; if (transpSortMode == View.TRANSPARENCY_SORT_GEOMETRY) { if (transparentInfo != null){ sortAll = true; } } } if (vpcToVworldDirty) { vworldToVpc.invert(vpcToVworld); // Have the send down the lights, so set the canvas // lightbin to null Canvas3D canvases[] = view.getCanvases(); for (i = 0; i < canvases.length; i++) { canvases[i].lightBin = null; } if (canvases.length > 0) { Transform3D xform; canvases[0].getCenterEyeInImagePlate(eyeInVworld); // xform is imagePlateToLocal xform = canvases[0].canvasViewCache.getImagePlateToVworld(); xform.transform(eyeInVworld); } if (transpSortMode == View.TRANSPARENCY_SORT_GEOMETRY && transparentInfo != null) { // System.err.println("sortAll 1"); sortAll = true; } } size = dirtyDepthSortRenderAtom.size(); if (sortAll || size > 0) { int tsize = allTransparentObjects.size(); double zVal; for (i = 0; i < tsize; i++) { RenderAtom renderAtom = (RenderAtom)allTransparentObjects.get(i); for (k = 0; k < renderAtom.rListInfo.length; k++) { if (renderAtom.rListInfo[k].geometry() == null) continue; zVal = renderAtom.geometryAtom.centroid[k].distanceSquared(eyeInVworld); renderAtom.parentTInfo[k].zVal = zVal; renderAtom.parentTInfo[k].geometryAtom = renderAtom.geometryAtom; } } // Check to see if a majority of the transparent Objects have changed // If less than 66% of all transparentStructs are dirty // then, remove and insert, otherwise resort everything if (size > 0 && 1.5f * numDirtyTinfo > nElements) { // System.err.println("sortAll 3, size = "+size); sortAll = true; } if (size > 0) { TransparentRenderingInfo dirtyList = null, rList; Iterator dirtyDepthSortIterator = dirtyDepthSortRenderAtom.iterator(); while (dirtyDepthSortIterator.hasNext()) { RenderAtom renderAtom = (RenderAtom)dirtyDepthSortIterator.next(); if (!renderAtom.inRenderBin()) continue; renderAtom.dirtyMask &= ~RenderAtom.IN_SORTED_POS_DIRTY_TRANSP_LIST; if (!sortAll) { dirtyList = collectDirtyTRInfo(dirtyList, renderAtom); } } if (dirtyList != null) { // System.err.println("====> sort Some"); dirtyList = depthSortAll(dirtyList); // Now merge the newly sorted list with the old one transparentInfo = mergeDepthSort(transparentInfo, dirtyList); } } // Sort all the transparent renderAtoms if (sortAll) { transparentInfo = depthSortAll(transparentInfo); } } // Remove entries that are found on both the add and remove lists if (addDlist.size() > 0 && removeDlist.size() > 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -