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

📄 geometryarrayretained.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
      		if (p.y > ymax) ymax = p.y;		if (p.y < ymin) ymin = p.y;   		if (p.z > zmax) zmax = p.z;		if (p.z < zmin) zmin = p.z;      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }            synchronized void update() {    }        void setupMirrorVertexPointer(int vType) {	int i, index;		switch (vType) { 	case PF:	    if (floatRefCoords == null) {		if ((vertexType & VERTEX_DEFINED) == PF) {		    vertexType &= ~PF;		    mirrorFloatRefCoords = null;		    mirrorVertexAllocated &= ~PF;		}	    }	    else {		vertexType |= PF;		mirrorFloatRefCoords = floatRefCoords;		mirrorVertexAllocated &= ~PF;	    }	    break;	case PD:	    if (doubleRefCoords == null) {		if ((vertexType & VERTEX_DEFINED) == PD) {		    mirrorDoubleRefCoords = null;		    mirrorVertexAllocated &= ~PD;		    vertexType &= ~PD;		}		vertexType &= ~PD;	    }	    else {		vertexType |= PD;		mirrorDoubleRefCoords = doubleRefCoords;		mirrorVertexAllocated &= ~PD;	    }	    break;	case P3F:	    if (p3fRefCoords == null) {		vertexType &= ~P3F;		// Don't set the mirrorFloatRefCoords to null,		// may be able to re-use		//	    mirrorFloatRefCoords = null;	    }	    else {		vertexType |= P3F;				if ((mirrorVertexAllocated & PF) == 0) {		    mirrorFloatRefCoords = new float[vertexCount * 3];		    mirrorVertexAllocated |= PF;		}		index = initialCoordIndex * 3;		for ( i=initialCoordIndex; i<validVertexCount; i++) {		    mirrorFloatRefCoords[index++] = p3fRefCoords[i].x;		    mirrorFloatRefCoords[index++] = p3fRefCoords[i].y;		    mirrorFloatRefCoords[index++] = p3fRefCoords[i].z;		}	    }	    break;	case P3D:	    if (p3dRefCoords == null) {		vertexType &= ~P3D;		// Don't set the mirrorDoubleRefCoords to null,		// may be able to re-use		//	    mirrorDoubleRefCoords = null;	    }	    else {		vertexType |= P3D;		if ((mirrorVertexAllocated & PD) == 0) {		    mirrorDoubleRefCoords = new double[vertexCount * 3];		    mirrorVertexAllocated |= PD;		}		index = initialCoordIndex * 3;		for ( i=initialCoordIndex; i<validVertexCount; i++) {		    mirrorDoubleRefCoords[index++] = p3dRefCoords[i].x;		    mirrorDoubleRefCoords[index++] = p3dRefCoords[i].y;		    mirrorDoubleRefCoords[index++] = p3dRefCoords[i].z;		}	    }	    break;	default:	    break;	    	}    }    // If turned transparent the first time, then force it to allocate    void setupMirrorInterleavedColorPointer(boolean force) {	int index, length, offset;	int i;	if (force || (c4fAllocated != 0)) { // Color is present	    	    length = 4 * vertexCount;	    	    if (mirrorInterleavedColorPointer == null) {		mirrorInterleavedColorPointer = new float[1][length];	    }	    	    index = 4 * initialVertexIndex;	    offset = stride * initialVertexIndex + colorOffset;	    	    if ((vertexFormat & GeometryArray.USE_NIO_BUFFER) == 0 && 		interLeavedVertexData != null ) { // java array	    		if ((vertexFormat  & GeometryArray.WITH_ALPHA) != 0) {		    for (i = initialVertexIndex; i < validVertexCount; i++) {			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset];			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset+1];			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset+2];			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset+3];			offset += stride;		    }		}		else {		    for (i = initialVertexIndex; i < validVertexCount; i++) {			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset];			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset+1];			mirrorInterleavedColorPointer[0][index++] = 			    interLeavedVertexData[offset+2];			mirrorInterleavedColorPointer[0][index++] = 1.0f;			offset += stride;		    }		}	    } else { // NIO BUFFER		if ((vertexFormat  & GeometryArray.WITH_ALPHA) != 0 &&		    interleavedFloatBufferImpl != null) {		    for (i = initialVertexIndex; i < validVertexCount; i++) {			interleavedFloatBufferImpl.position(offset); 			interleavedFloatBufferImpl.get(mirrorInterleavedColorPointer[0],						       index , 4);			index += 4;			offset += stride;		    }		}		else {		    for (i = initialVertexIndex; i < validVertexCount; i++) {			interleavedFloatBufferImpl.position(offset);			interleavedFloatBufferImpl.get(mirrorInterleavedColorPointer[0],						       index, 3);			mirrorInterleavedColorPointer[0][index+3] = 1.0f;			index += 4;			offset += stride;					    }		}			    }	    c4fAllocated = GeometryArray.WITH_ALPHA;	}    }        // If turned transparent the first time, then force it to allocate    void setupMirrorColorPointer(int ctype, boolean force) {	int i, srcIndex = 0, dstIndex = 0;	int multiplier; 	if (c4fAllocated == 0 && !force) {	    multiplier = 3;	} else {			    // If the first time, we are forced to allocate 4f, then	    // we need to force the allocation of the colors again	    // for the case when allocation has previously occurred	    // only for RGB	    if (force && (c4fAllocated == 0) &&		(vertexFormat & GeometryArray.WITH_ALPHA) == 0)  {		mirrorColorAllocated = 0;	    }	    c4fAllocated = GeometryArray.WITH_ALPHA;	    multiplier = 4;	}	if ((vertexFormat & GeometryArray.USE_NIO_BUFFER) == 0) { // java array	    switch (ctype) { 	    case CF:		if (floatRefColors == null) {		    if ((c4fAllocated == 0) && !force &&			(vertexType & COLOR_DEFINED) == CF) {			mirrorFloatRefColors[0] = null;			mirrorColorAllocated &= ~CF;		    }		    vertexType &= ~CF;		    return;		}			vertexType |= CF;		if (c4fAllocated == 0 && !force) {		    mirrorFloatRefColors[0] = floatRefColors;		    mirrorColorAllocated &= ~CF;		}		else { 		    if ((mirrorColorAllocated & CF) == 0) {			mirrorFloatRefColors[0] = new float[4 * vertexCount];			mirrorColorAllocated |= CF;		    }		    if ((vertexFormat & GeometryArray.WITH_ALPHA) == 0) {			srcIndex = initialColorIndex * 3;			dstIndex = initialColorIndex * 4;						for (i = initialColorIndex; i < validVertexCount; i++) {			    mirrorFloatRefColors[0][dstIndex++] = 				floatRefColors[srcIndex++];			    mirrorFloatRefColors[0][dstIndex++] = 				floatRefColors[srcIndex++];			    mirrorFloatRefColors[0][dstIndex++] = 				floatRefColors[srcIndex++];			    mirrorFloatRefColors[0][dstIndex++] = 1.0f;			}		    		    }		    else {			srcIndex = initialColorIndex * 4;			System.arraycopy(floatRefColors, srcIndex, 					 mirrorFloatRefColors[0], srcIndex, 					 (4*validVertexCount));		    }		}		break;	    case CUB: 		if (byteRefColors == null) {		    if (c4fAllocated == 0 && !force &&			((vertexType & COLOR_DEFINED) == CUB) ) {			mirrorUnsignedByteRefColors[0] = null;			mirrorColorAllocated &= ~CUB;		    }		    vertexType &= ~CUB;		    return;		}		vertexType |= CUB;		if (c4fAllocated == 0 && !force) {		    mirrorUnsignedByteRefColors[0] = byteRefColors;		    mirrorColorAllocated &= ~CUB;;		}		else {		    if ((mirrorColorAllocated & CUB) == 0) {			mirrorUnsignedByteRefColors[0] = new byte[4 * vertexCount];			mirrorColorAllocated |= CUB;		    }		    if ((vertexFormat & GeometryArray.WITH_ALPHA) == 0) {			srcIndex = initialColorIndex * 3;			dstIndex = initialColorIndex * 4;						for (i = initialColorIndex; i < validVertexCount; i++) {			    mirrorUnsignedByteRefColors[0][dstIndex++] =				byteRefColors[srcIndex++];			    mirrorUnsignedByteRefColors[0][dstIndex++] =				byteRefColors[srcIndex++];			    mirrorUnsignedByteRefColors[0][dstIndex++] =				byteRefColors[srcIndex++];			    mirrorUnsignedByteRefColors[0][dstIndex++] =				(byte)(255.0);			}		    }		    else {			srcIndex = initialColorIndex * 4;			System.arraycopy(byteRefColors, srcIndex, 					 mirrorUnsignedByteRefColors[0], srcIndex,					 (4*validVertexCount));		    }		}				break;	    case C3F:		if (c3fRefColors == null) {		    vertexType &= ~C3F;		    return;		}		vertexType |=C3F ;		if ((mirrorColorAllocated & CF) == 0) {		    mirrorFloatRefColors[0] = new float[vertexCount * multiplier];		    mirrorColorAllocated |= CF;		}		if ((c4fAllocated & GeometryArray.WITH_ALPHA) == 0) {		    dstIndex = initialColorIndex * 3;		    for (i = initialColorIndex; i < validVertexCount; i++) {			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].x;			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].y;			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].z;		    }		} else {		    dstIndex = initialColorIndex * 4;		    for (i = initialColorIndex; i < validVertexCount; i++) {			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].x;			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].y;			mirrorFloatRefColors[0][dstIndex++] = c3fRefColors[i].z;			mirrorFloatRefColors[0][dstIndex++] = 1.0f;		    }		}		break;	    case C4F: 		if (c4fRefColors == null) {		    vertexType &= ~C4F;		    return;		}		vertexType |=C4F ;		if ((mirrorColorAllocated & CF) == 0) {		    mirrorFloatRefColors[0] = new float[vertexCount << 2];		    mirrorColorAllocated |= CF;		}		dstIndex = initialColorIndex * 4;		for (i = initialColorIndex; i < validVertexCount; i++) {		    mirrorFloatRefColors[0][dstIndex++] = c4fRefColors[i].x;		    mirrorFloatRefColors[0][dstIndex++] = c4fRefColors[i].y;		    mirrorFloatRefColors[0][dstIndex++] = c4fRefColors[i].z;		    mirrorFloatRefColors[0][dstIndex++] = c4fRefColors[i].w;		}		break;	    case C3UB: 		if (c3bRefColors == null) {		    vertexType &= ~C3UB;		    return;		}		vertexType |=C3UB ;		if ((mirrorColorAllocated & CUB) == 0) {		    mirrorUnsignedByteRefColors[0] = 			new byte[vertexCount * multiplier];		    mirrorColorAllocated |= CUB;		}		if ((c4fAllocated & GeometryArray.WITH_ALPHA) == 0) {		    dstIndex = initialColorIndex * 3;		    for (i = initialColorIndex; i < validVertexCount; i++) {			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].x;			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].y;			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].z;		    }		} else {		    dstIndex = initialColorIndex * 4;		    for (i = initialColorIndex; i < validVertexCount; i++) {			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].x;			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].y;			mirrorUnsignedByteRefColors[0][dstIndex++] = c3bRefColors[i].z;			mirrorUnsignedByteRefColors[0][dstIndex++] = (byte)255;		    }		}		break;	    case C4UB: 		if (c4bRefColors == null) {		    vertexType &= ~C4UB;		    return;		}		vertexType |=C4UB ;		if ((mirrorColorAllocated & CUB) == 0) {		    mirrorUnsignedByteRefColors[0] = new byte[vertexCount << 2];		    mirrorColorAllocated |= CUB;		}		dstIndex = initialColorIndex * 4;		for (i = initialColorIndex; i < validVertexCount; i++) {		    mirrorUnsignedByteRefColors[0][dstIndex++] = c4bRefColors[i].x;		    mirrorUnsignedByteRefColors[0][dstIndex++] = c4bRefColors[i].y;		    mirrorUnsignedByteRefColors[0][dstIndex++] = c4bRefColors[i].z;		    mirrorUnsignedByteRefColors[0][dstIndex++] = c4bRefColors[i].w;		}		break;	    default:		break;	    }	}	else {  //USE_NIO_BUFFER is set	    if(	colorRefBuffer == null) {		if (c4fAllocated == 0 && !force &&		    (vertexType & COLOR_DEFINED) == CF) {		    mirrorFloatRefColors[0] = null;		    mirrorColorAllocated &= ~CF;		}		vertexType &= ~CF;				if (c4fAllocated == 0 && !force &&		    ((vertexType & COLOR_DEFINED) == CUB) ) {		    mirrorUnsignedByteRefColors[0] = null;		    mirrorColorAllocated &= ~CUB;		}		vertexType &= ~CUB;		return;			    } else if( floatBufferRefColors != null) {		vertexType |= CF;		vertexType &= ~CUB;		if (c4fAllocated == 0 && !force) {		    // NOTE: make suren mirrorFloatRefColors[0] is set right		    mirrorFloatRefColors[0] = null; 		    mirrorColorAllocated &= ~CF;		}		else {		    if ((mirrorColorAllocated & CF) == 0) {			mirrorFloatRefColors[0] = new float[4 * vertexCount];			mirrorColorAllocated |= CF;		    }		    floatBufferRefColors.rewind();		    if ((vertexFormat & GeometryArray.WITH_ALPHA) == 0) {			srcIndex = initialColorIndex * 3;			dstIndex = initialColorIndex * 4;			floatBufferRefColors.position(srcIndex);

⌨️ 快捷键说明

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