📄 rendermolecule.java
字号:
VirtualUniverse.mc.getDefaultRenderMethod(); primaryMoleculeType = RASTER_MOLECULE; } } prev = null; next = null; prevMap = null; nextMap = null; primaryRenderAtomList = null; vertexArrayRenderAtomList = null; switch (ga.geoType) { case GeometryRetained.GEO_TYPE_POINT_SET: case GeometryRetained.GEO_TYPE_INDEXED_POINT_SET: this.geometryType = POINT; break; case GeometryRetained.GEO_TYPE_LINE_SET: case GeometryRetained.GEO_TYPE_LINE_STRIP_SET: case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET: case GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET: this.geometryType = LINE; break; case GeometryRetained.GEO_TYPE_RASTER: this.geometryType = RASTER; break; case GeometryRetained.GEO_TYPE_COMPRESSED: this.geometryType = COMPRESSED; switch (((CompressedGeometryRetained)geo).getBufferType()) { case CompressedGeometryHeader.POINT_BUFFER: this.geometryType |= POINT ; break ; case CompressedGeometryHeader.LINE_BUFFER: this.geometryType |= LINE ; break ; default: case CompressedGeometryHeader.TRIANGLE_BUFFER: this.geometryType |= SURFACE ; if (polygonAttributes != null) { if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { this.geometryType |= POINT; } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { this.geometryType |= LINE; } } break ; } break; default: this.geometryType = SURFACE; if (polygonAttributes != null) { if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { this.geometryType |= POINT; } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { this.geometryType |= LINE; } } break; } isQuadGeometryArray = (geo.getClassType() == GeometryRetained.QUAD_TYPE); isTriGeometryArray = (geo.getClassType() == GeometryRetained.TRIANGLE_TYPE); this.localToVworld = transform; this.localToVworldIndex = transformIndex; doInfinite = ga.source.inBackgroundGroup; if (doInfinite) { if (infLocalToVworld == null) { infLocalToVworld = new Transform3D[2]; infLocalToVworld[0] = infLocalToVworld[1] = new Transform3D(); } localToVworld[0].getRotation(infLocalToVworld[0]); } int mask = 0; if (polygonAttributes != null) { if (polygonAttributes.changedFrequent != 0) { definingPolygonAttributes = polygonAttributes; mask |= POLYGONATTRS_DIRTY; } else { if (definingPolygonAttributes != null) { definingPolygonAttributes.set(polygonAttributes); } else { definingPolygonAttributes = (PolygonAttributesRetained)polygonAttributes.clone(); } } polygonMode = definingPolygonAttributes.polygonMode; } else { polygonMode = PolygonAttributes.POLYGON_FILL; definingPolygonAttributes = null; } if (lineAttributes != null) { if (lineAttributes.changedFrequent != 0) { definingLineAttributes = lineAttributes; mask |= LINEATTRS_DIRTY; } else { if (definingLineAttributes != null) { definingLineAttributes.set(lineAttributes); } else { definingLineAttributes = (LineAttributesRetained)lineAttributes.clone(); } } lineAA = definingLineAttributes.lineAntialiasing; } else { lineAA = false; definingLineAttributes = null; } if (pointAttributes != null) { if (pointAttributes.changedFrequent != 0) { definingPointAttributes = pointAttributes; mask |= POINTATTRS_DIRTY; } else { if (definingPointAttributes != null) { definingPointAttributes.set(pointAttributes); } else { definingPointAttributes = (PointAttributesRetained)pointAttributes.clone(); } } pointAA = definingPointAttributes.pointAntialiasing; } else { pointAA = false; definingPointAttributes = null; } normalPresent = true; if (geo instanceof GeometryArrayRetained) { GeometryArrayRetained gr = (GeometryArrayRetained)geo; this.vertexFormat = gr.vertexFormat; if (gr.texCoordSetMap != null) { this.texCoordSetMapLen = gr.texCoordSetMap.length; } else { this.texCoordSetMapLen = 0; } // Throw an exception if lighting is enabled, but no normals defined if ((vertexFormat & GeometryArray.NORMALS) == 0) { // Force lighting to false normalPresent = false; } } else if (geo instanceof CompressedGeometryRetained) { this.vertexFormat = ((CompressedGeometryRetained)geo).getVertexFormat(); // Throw an exception if lighting is enabled, but no normals defined if ((vertexFormat & GeometryArray.NORMALS) == 0) { // Force lighting to false normalPresent = false; } this.texCoordSetMapLen = 0; } else { this.vertexFormat = -1; this.texCoordSetMapLen = 0; } if (material != null) { if (material.changedFrequent != 0) { definingMaterial = material; mask |= MATERIAL_DIRTY; } else { if (definingMaterial != null) definingMaterial.set(material); else { definingMaterial = (MaterialRetained)material.clone(); } } } else { definingMaterial = null; } evalMaterialCachedState(); if (coloringAttributes != null) { if (coloringAttributes.changedFrequent != 0) { definingColoringAttributes = coloringAttributes; mask |= COLORINGATTRS_DIRTY; } else { if (definingColoringAttributes != null) { definingColoringAttributes.set(coloringAttributes); } else { definingColoringAttributes = (ColoringAttributesRetained)coloringAttributes.clone(); } } red = coloringAttributes.color.x; green = coloringAttributes.color.y; blue = coloringAttributes.color.z; } else { red = 1.0f; green = 1.0f; blue = 1.0f; definingColoringAttributes = null; } if (transparency != null) { if (transparency.changedFrequent != 0) { definingTransparency = transparency; mask |= TRANSPARENCY_DIRTY; } else { if (definingTransparency != null) { definingTransparency.set(transparency); } else { definingTransparency = (TransparencyAttributesRetained)transparency.clone(); } } alpha = 1.0f - transparency.transparency; } else { alpha = 1.0f; definingTransparency = null; } locale = ga.source.locale; if (locale != renderBin.locale) { if (localeLocalToVworld == null) { localeLocalToVworld = new Transform3D[2]; } localeLocalToVworld[0] = new Transform3D(); localeLocalToVworld[1] = new Transform3D(); localeTranslation = new Vector3d(); ga.locale.hiRes.difference(renderBin.locale.hiRes, localeTranslation); translate(); } else { localeLocalToVworld = localToVworld; } if (doInfinite) { trans = infLocalToVworld; } else { trans = localeLocalToVworld; } evalAlphaUsage(renderAttrs, texUnits); isOpaqueOrInOG = isOpaque() || (ga.source.orderedPath != null); inOrderedGroup = (ga.source.orderedPath != null); // System.err.println("isOpaque = "+isOpaque() +" OrInOG = "+isOpaqueOrInOG); if (mask != 0) { if ((soleUserCompDirty& ALL_DIRTY_BITS) == 0 ) { renderBin.rmUpdateList.add(this); } soleUserCompDirty |= mask; } } /** * This tests if the given attributes matches this TextureBin */ boolean equals(RenderAtom ra, PolygonAttributesRetained polygonAttributes, LineAttributesRetained lineAttributes, PointAttributesRetained pointAttributes, MaterialRetained material, ColoringAttributesRetained coloringAttributes, TransparencyAttributesRetained transparency, Transform3D[] transform) { int geoType = 0; GeometryAtom ga = ra.geometryAtom; int eAttrs = 0; if (this.localToVworld != transform) { return (false); } if (locale != ra.geometryAtom.source.locale) { return (false); } if (ra.geometryAtom.source.closestSwitchParent != closestSwitchParent || ra.geometryAtom.source.closestSwitchIndex != closestSwitchIndex) { return (false); } // Find the first non-null geometey GeometryRetained geo = null; int k = 0; while (geo == null && (k < ga.geometryArray.length)) { geo = ga.geometryArray[k]; k++; } // XXXX: Add tags switch (ga.geoType) { case GeometryRetained.GEO_TYPE_POINT_SET: case GeometryRetained.GEO_TYPE_INDEXED_POINT_SET: geoType = POINT; break; case GeometryRetained.GEO_TYPE_LINE_SET: case GeometryRetained.GEO_TYPE_LINE_STRIP_SET: case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET: case GeometryRetained.GEO_TYPE_INDEXED_LINE_STRIP_SET: geoType = LINE; break; case GeometryRetained.GEO_TYPE_RASTER: geoType = RASTER; break; case GeometryRetained.GEO_TYPE_COMPRESSED: geoType = COMPRESSED; switch (((CompressedGeometryRetained)geo).getBufferType()) { case CompressedGeometryHeader.POINT_BUFFER: geoType |= POINT ; break ; case CompressedGeometryHeader.LINE_BUFFER: geoType |= LINE ; break ; default: case CompressedGeometryHeader.TRIANGLE_BUFFER: geoType |= SURFACE ; break ; } break; default: geoType = SURFACE; if (polygonAttributes != null) { if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_POINT) { geoType |= POINT; } else if (polygonAttributes.polygonMode == PolygonAttributes.POLYGON_LINE) { geoType |= LINE; } } break; } if (this.geometryType != geoType) { return (false); } /* // XXXX : Check this if (useDisplayList && (ga.geometry.isEditable || ga.geometry.refCount > 1 || ((GroupRetained)ga.source.parent).switchLevel >= 0 || ga.alphaEditable)) { return (false); } */ if (ga.geoType == GeometryRetained.GEO_TYPE_TEXT3D && primaryMoleculeType != 0 && ((primaryMoleculeType & TEXT3D_MOLECULE) == 0)) { return (false); } if(!(ra.geometryAtom.source instanceof OrientedShape3DRetained) && ((primaryMoleculeType & ORIENTEDSHAPE3D_MOLECULE) != 0)) { //System.err.println("RA's NOT a OrientedShape3DRetained and RM is a ORIENTEDSHAPE3D_MOLECULE "); return (false); } // XXXX: Its is necessary to have same vformat for dl, // Howabout iteration, should we have 2 vformats in rm? if (geo instanceof GeometryArrayRetained) { GeometryArrayRetained gr = (GeometryArrayRetained)geo; if (this.vertexFormat != gr.vertexFormat) { return (false); } // we are requiring that texCoordSetMap length to be the same // so that we can either put all multi-tex ga to a display list, // or punt all to vertex array. And we don't need to worry // about some of the ga can be in display list for this canvas, // and some other can be in display list for the other canvas. if (((gr.texCoordSetMap != null) && (this.texCoordSetMapLen != gr.texCoordSetMap.length)) || ((gr.texCoordSetMap == null) && (this.texCoordSetMapLen != 0))) { return (false); } if (VirtualUniverse.mc.isD3D() && (((geo.getClassType() == GeometryRetained.QUAD_TYPE) && !isQuadGeometryArray) || ((geo.getClassType() == GeometryRetained.TRIANGLE_TYPE) && !isTriGeometryArray))) { return false; } } else if (geo instanceof CompressedGeometryRetained) { if (this.vertexFormat != ((CompressedGeometryRetained)geo).getVertexFormat()) { return (false); } } else { //XXXX: compare isEditable if (this.vertexFormat != -1) { return (false); } } // If the any reference to the appearance components that is cached renderMolecule // can change frequently, make a separate bin if (soleUser || (ra.geometryAtom.source.appearance != null && ((ra.geometryAtom.source.appearance.changedFrequent & RM_COMPONENTS) != 0))) { if (appHandle == (Object)ra.geometryAtom.source.appearance) { // if this RenderMolecule 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,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -