public virtual void     InternalProcessAllTriangles(IInternalTriangleIndexCallback callback, ref IndexedVector3 aabbMin, ref IndexedVector3 aabbMax)
        {
            int            numtotalphysicsverts = 0;
            int            part, graphicssubparts = GetNumSubParts();
            Object         vertexbase  = null;
            Object         indexbase   = null;
            int            indexstride = 3;
            PHY_ScalarType type = PHY_ScalarType.PHY_FLOAT;
            PHY_ScalarType gfxindextype = PHY_ScalarType.PHY_INTEGER;
            int            stride = 0, numverts = 0, numtriangles = 0;

            IndexedVector3[] triangle = new IndexedVector3[3];

            IndexedVector3 meshScaling = GetScaling();

            ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
            for (part = 0; part < graphicssubparts; part++)
            {
                GetLockedReadOnlyVertexIndexBase(out vertexbase, out numverts, out type, out stride, out indexbase, out indexstride, out numtriangles, out gfxindextype, part);
                numtotalphysicsverts += numtriangles * 3;     //upper bound

                switch (gfxindextype)
                {
                case PHY_ScalarType.PHY_INTEGER:
                {
                    int[] indexList = ((ObjectArray <int>)indexbase).GetRawArray();

                    if (vertexbase is ObjectArray <IndexedVector3> )
                    {
                        IndexedVector3[] vertexList = (vertexbase as ObjectArray <IndexedVector3>).GetRawArray();
                        //string filename = "c:/tmp/xna-bvh-mesh-iv3.txt";
                        //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read);
                        //using (StreamWriter writer = new StreamWriter(filestream))
                        //{
                        //writer.WriteLine("XNA IV3");
                        for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                        {
                            int triIndex = (gfxindex * indexstride);

                            //writer.WriteLine(String.Format("indices[{0}][{1}][{2}]", indexList[triIndex], indexList[triIndex + 1], indexList[triIndex + 2]));

                            int index1 = indexList[triIndex];
                            int index2 = indexList[triIndex + 1];
                            int index3 = indexList[triIndex + 2];

                            triangle[0] = vertexList[index1] * meshScaling;
                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[0].X,triangle[0].Y,triangle[0].Z));

                            triangle[1] = vertexList[index2] * meshScaling;
                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[1].X, triangle[1].Y, triangle[1].Z));

                            triangle[2] = vertexList[index3] * meshScaling;
                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[2].X, triangle[2].Y, triangle[2].Z));


                            //writer.WriteLine(String.Format("index[{0}] triangle[0].X =[{1:0.00000000}] triangle[0].Y =[{2:0.00000000}] triangle[0].Z =[{3:0.00000000}]", gfxindex, triangle[0].X, triangle[0].Y, triangle[0].Z));
                            //writer.WriteLine(String.Format("index[{0}] triangle[1].X =[{1:0.00000000}] triangle[1].Y =[{2:0.00000000}] triangle[1].Z =[{3:0.00000000}]", gfxindex, triangle[1].X, triangle[1].Y, triangle[1].Z));
                            //writer.WriteLine(String.Format("index[{0}] triangle[2].X =[{1:0.00000000}] triangle[2].Y =[{2:0.00000000}] triangle[2].Z =[{3:0.00000000}]", gfxindex, triangle[2].X, triangle[2].Y, triangle[2].Z));


                            //if(BulletGlobals.g_streamWriter != null && BulletGlobals.debugStridingMesh && !callback.graphics())
                            //{
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter,"SMI:T0",triangle[0]);
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T1", triangle[1]);
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T2", triangle[2]);
                            //}

                            callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                        }
                        //    writer.Flush();
                        //}
                    }

                    else if (vertexbase is ObjectArray <Microsoft.Xna.Framework.Vector3> )
                    {
                        Microsoft.Xna.Framework.Vector3[] vertexList = (vertexbase as ObjectArray <Microsoft.Xna.Framework.Vector3>).GetRawArray();
                        for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                        {
                            int triIndex = (gfxindex * indexstride);

                            int index1 = indexList[triIndex];
                            int index2 = indexList[triIndex + 1];
                            int index3 = indexList[triIndex + 2];

                            triangle[0] = new IndexedVector3(vertexList[index1]) * meshScaling;
                            triangle[1] = new IndexedVector3(vertexList[index2]) * meshScaling;
                            triangle[2] = new IndexedVector3(vertexList[index3]) * meshScaling;

                            //if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugStridingMesh && !callback.graphics())
                            //{
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T0", triangle[0]);
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T1", triangle[1]);
                            //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T2", triangle[2]);
                            //}

                            callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                        }
                    }

                    else if (vertexbase is ObjectArray <float> )
                    {
                        //string filename = "c:/tmp/xna-bvh-mesh-float.txt";
                        //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read);
                        //using (StreamWriter writer = new StreamWriter(filestream))
                        //{
                        //writer.WriteLine("XNA FLOAT");
                        float[] vertexList = (vertexbase as ObjectArray <float>).GetRawArray();
                        for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                        {
                            int triIndex = (gfxindex * indexstride);
                            //writer.WriteLine(String.Format("indices[{0}][{1}][{2}]", indexList[triIndex], indexList[triIndex + 1], indexList[triIndex + 2]));

                            // ugly!!
                            int index1 = indexList[triIndex];

                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                            triangle[0] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;
                            index1      = indexList[triIndex + 1];
                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                            triangle[1] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;
                            index1      = indexList[triIndex + 2];
                            //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                            triangle[2] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;


                            //writer.WriteLine(String.Format("index[{0}] triangle[0].X =[{1:0.00000000}] triangle[0].Y =[{2:0.00000000}] triangle[0].Z =[{3:0.00000000}]", gfxindex, triangle[0].X, triangle[0].Y, triangle[0].Z));
                            //writer.WriteLine(String.Format("index[{0}] triangle[1].X =[{1:0.00000000}] triangle[1].Y =[{2:0.00000000}] triangle[1].Z =[{3:0.00000000}]", gfxindex, triangle[1].X, triangle[1].Y, triangle[1].Z));
                            //writer.WriteLine(String.Format("index[{0}] triangle[2].X =[{1:0.00000000}] triangle[2].Y =[{2:0.00000000}] triangle[2].Z =[{3:0.00000000}]", gfxindex, triangle[2].X, triangle[2].Y, triangle[2].Z));

                            callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                        }
                        //writer.Flush();
                        //}
                    }
                    else
                    {
                        Debug.Assert(false);     // unsupported type ....
                    }
                    break;
                }

                default:
                {
                    Debug.Assert(gfxindextype == PHY_ScalarType.PHY_INTEGER);
                    break;
                }
                }

                UnLockReadOnlyVertexBase(part);
            }
        }
Esempio n. 2
0
		public virtual void	InternalProcessAllTriangles(IInternalTriangleIndexCallback callback,ref Vector3 aabbMin,ref Vector3 aabbMax)
        {
	        int numtotalphysicsverts = 0;
	        int part,graphicssubparts = GetNumSubParts();
	        Object vertexbase = null;
            Object indexbase = null;
	        int indexstride = 3;
	        PHY_ScalarType type = PHY_ScalarType.PHY_FLOAT;
	        PHY_ScalarType gfxindextype = PHY_ScalarType.PHY_INTEGER;
	        int stride = 0,numverts = 0 ,numtriangles = 0;

            ObjectArray<Vector3> triangle = new ObjectArray<Vector3>(3);
			// ugly.  - could do with either a static , or allowing these methods to take a list or a fixed array...		
			triangle.Add(Vector3.Zero);
			triangle.Add(Vector3.Zero);
			triangle.Add(Vector3.Zero);

	        float graphicsBase = 0f;

	        Vector3 meshScaling = GetScaling();

	        ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
	        for (part=0;part<graphicssubparts ;part++)
	        {
		        getLockedReadOnlyVertexIndexBase(out vertexbase,out numverts,out type,out stride,out indexbase,out indexstride,out numtriangles,out gfxindextype,part);
		        numtotalphysicsverts+=numtriangles*3; //upper bound

		        switch (gfxindextype)
		        {
		        case PHY_ScalarType.PHY_INTEGER:
			        {
                        ObjectArray<int> indexList = (ObjectArray<int>)indexbase;
						//ObjectArray<float> vertexList = (ObjectArray<float>)vertexbase;

						// hack for now - need to tidy this..

						if (vertexbase is ObjectArray<Vector3>)
						{
                            ObjectArray<Vector3> vertexList = (ObjectArray<Vector3>)vertexbase;
							for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
							{
								// FIXME - Work ref the properindexing on this.
								int index = gfxindex * indexstride;
								int triIndex = (gfxindex * indexstride);

								triangle[0] = vertexList[indexList[triIndex]] * meshScaling;
								triangle[1] = vertexList[indexList[triIndex+1]] * meshScaling;
								triangle[2] = vertexList[indexList[triIndex+2]] * meshScaling;


								callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
							}
						}
                        else if (vertexbase is ObjectArray<float>)
						{
							//triangle[0] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							//triangle[1] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							//triangle[2] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							ObjectArray<float> vertexList = (ObjectArray<float>)vertexbase;
							for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
							{
								// FIXME - Work ref the properindexing on this.
								int index = gfxindex * indexstride;
								int triIndex = (gfxindex * indexstride);

								// ugly!!
								triangle[0] = new Vector3(vertexList[indexList[triIndex]], vertexList[indexList[triIndex] + 1], vertexList[indexList[triIndex] + 2]) * meshScaling;
								triangle[1] = new Vector3(vertexList[indexList[triIndex+1]], vertexList[indexList[triIndex+1] + 1], vertexList[indexList[triIndex+1] + 2]) * meshScaling;
								triangle[2] = new Vector3(vertexList[indexList[triIndex+2]], vertexList[indexList[triIndex+2] + 1], vertexList[indexList[triIndex+2] + 2]) * meshScaling;
								callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
							}


						}
						else
						{
							Debug.Assert(false); // unsupported type ....
						}
				        break;
			        }
		        case PHY_ScalarType.PHY_SHORT:
			        {
                        ObjectArray<ushort> indexList = (ObjectArray<ushort>)indexbase;

                        if (vertexbase is ObjectArray<Vector3>)
						{
							ObjectArray<Vector3> vertexList = (ObjectArray<Vector3>)vertexbase;
							for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
							{
								// FIXME - Work ref the properindexing on this.
								int index = gfxindex * indexstride;
								int triIndex = (gfxindex * indexstride);

								triangle[0] = vertexList[indexList[triIndex]] * meshScaling;
								triangle[1] = vertexList[indexList[triIndex + 1]] * meshScaling;
								triangle[2] = vertexList[indexList[triIndex + 2]] * meshScaling;


								callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
							}
						}
						else if (vertexbase is ObjectArray<float>)
						{
							//triangle[0] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							//triangle[1] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							//triangle[2] = new Vector3(vertexList[indexList[triIndex]] * meshScaling.X, vertexList[indexList[triIndex + 1]] * meshScaling.Y, vertexList[indexList[triIndex + 2]] * meshScaling.Z);
							ObjectArray<float> vertexList = (ObjectArray<float>)vertexbase;
							for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
							{
								// FIXME - Work ref the properindexing on this.
								int index = gfxindex * indexstride;
								int triIndex = (gfxindex * indexstride);

								// ugly!!
								triangle[0] = new Vector3(vertexList[indexList[triIndex]], vertexList[indexList[triIndex] + 1], vertexList[indexList[triIndex] + 2]) * meshScaling;
								triangle[1] = new Vector3(vertexList[indexList[triIndex + 1]], vertexList[indexList[triIndex + 1] + 1], vertexList[indexList[triIndex + 1] + 2]) * meshScaling;
								triangle[2] = new Vector3(vertexList[indexList[triIndex + 2]], vertexList[indexList[triIndex + 2] + 1], vertexList[indexList[triIndex + 2] + 2]) * meshScaling;

								callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
							}


						}
						else
						{
							Debug.Assert(false); // unsupported type ....
						}
						break;
					}
                default:
                    {
                        Debug.Assert((gfxindextype == PHY_ScalarType.PHY_INTEGER) || (gfxindextype == PHY_ScalarType.PHY_SHORT));
                        break;
                    }
		        }

		        UnLockReadOnlyVertexBase(part);
            }
        }
		public virtual void	InternalProcessAllTriangles(IInternalTriangleIndexCallback callback,ref IndexedVector3 aabbMin,ref IndexedVector3 aabbMax)
        {
	        int numtotalphysicsverts = 0;
	        int part,graphicssubparts = GetNumSubParts();
	        Object vertexbase = null;
            Object indexbase = null;
	        int indexstride = 3;
	        PHY_ScalarType type = PHY_ScalarType.PHY_FLOAT;
	        PHY_ScalarType gfxindextype = PHY_ScalarType.PHY_INTEGER;
	        int stride = 0,numverts = 0 ,numtriangles = 0;

            IndexedVector3[] triangle = new IndexedVector3[3];

	        IndexedVector3 meshScaling = GetScaling();

	        ///if the number of parts is big, the performance might drop due to the innerloop switch on indextype
	        for (part=0;part<graphicssubparts ;part++)
	        {
		        GetLockedReadOnlyVertexIndexBase(out vertexbase,out numverts,out type,out stride,out indexbase,out indexstride,out numtriangles,out gfxindextype,part);
		        numtotalphysicsverts+=numtriangles*3; //upper bound

		        switch (gfxindextype)
		        {
		            case PHY_ScalarType.PHY_INTEGER:
			        {
                        int[] indexList = ((ObjectArray<int>)indexbase).GetRawArray();

                        if (vertexbase is ObjectArray<IndexedVector3>)
                        {
                            IndexedVector3[] vertexList = (vertexbase as ObjectArray<IndexedVector3>).GetRawArray();
                            //string filename = "c:/tmp/xna-bvh-mesh-iv3.txt";
                            //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read);
                            //using (StreamWriter writer = new StreamWriter(filestream))
                            //{
                                //writer.WriteLine("XNA IV3");
                                for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                                {
                                    int triIndex = (gfxindex * indexstride);

                                    //writer.WriteLine(String.Format("indices[{0}][{1}][{2}]", indexList[triIndex], indexList[triIndex + 1], indexList[triIndex + 2]));

                                    int index1 = indexList[triIndex];
                                    int index2 = indexList[triIndex + 1];
                                    int index3 = indexList[triIndex + 2];

                                    triangle[0] = vertexList[index1] * meshScaling;
                                    //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[0].X,triangle[0].Y,triangle[0].Z));

                                    triangle[1] = vertexList[index2] * meshScaling;
                                    //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[1].X, triangle[1].Y, triangle[1].Z));

                                    triangle[2] = vertexList[index3] * meshScaling;
                                    //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", triangle[2].X, triangle[2].Y, triangle[2].Z));


                                    //writer.WriteLine(String.Format("index[{0}] triangle[0].X =[{1:0.00000000}] triangle[0].Y =[{2:0.00000000}] triangle[0].Z =[{3:0.00000000}]", gfxindex, triangle[0].X, triangle[0].Y, triangle[0].Z));
                                    //writer.WriteLine(String.Format("index[{0}] triangle[1].X =[{1:0.00000000}] triangle[1].Y =[{2:0.00000000}] triangle[1].Z =[{3:0.00000000}]", gfxindex, triangle[1].X, triangle[1].Y, triangle[1].Z));
                                    //writer.WriteLine(String.Format("index[{0}] triangle[2].X =[{1:0.00000000}] triangle[2].Y =[{2:0.00000000}] triangle[2].Z =[{3:0.00000000}]", gfxindex, triangle[2].X, triangle[2].Y, triangle[2].Z));


                                    //if(BulletGlobals.g_streamWriter != null && BulletGlobals.debugStridingMesh && !callback.graphics())
                                    //{
                                    //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter,"SMI:T0",triangle[0]);
                                    //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T1", triangle[1]);
                                    //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T2", triangle[2]);
                                    //}

                                    callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                                }
                            //    writer.Flush();
                            //}
                        }
#if XNA
                        else if (vertexbase is ObjectArray<Microsoft.Xna.Framework.Vector3>)
                        {
                            Microsoft.Xna.Framework.Vector3[] vertexList = (vertexbase as ObjectArray<Microsoft.Xna.Framework.Vector3>).GetRawArray();
                            for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                            {
                                int triIndex = (gfxindex * indexstride);

                                int index1 = indexList[triIndex];
                                int index2 = indexList[triIndex + 1];
                                int index3 = indexList[triIndex + 2];

                                triangle[0] = new IndexedVector3(vertexList[index1]) * meshScaling;
                                triangle[1] = new IndexedVector3(vertexList[index2]) * meshScaling;
                                triangle[2] = new IndexedVector3(vertexList[index3]) * meshScaling;

                                //if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugStridingMesh && !callback.graphics())
                                //{
                                //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T0", triangle[0]);
                                //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T1", triangle[1]);
                                //    MathUtil.PrintVector3(BulletGlobals.g_streamWriter, "SMI:T2", triangle[2]);
                                //}

                                callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                            }
                        }
#endif
                        else if (vertexbase is ObjectArray<float>)
                        {
                            //string filename = "c:/tmp/xna-bvh-mesh-float.txt";
                            //FileStream filestream = File.Open(filename, FileMode.Create, FileAccess.Write, FileShare.Read);
                            //using (StreamWriter writer = new StreamWriter(filestream))
                            //{
                            //writer.WriteLine("XNA FLOAT");
                            float[] vertexList = (vertexbase as ObjectArray<float>).GetRawArray();
                            for (int gfxindex = 0; gfxindex < numtriangles; gfxindex++)
                            {
                                int triIndex = (gfxindex * indexstride);
                                //writer.WriteLine(String.Format("indices[{0}][{1}][{2}]", indexList[triIndex], indexList[triIndex + 1], indexList[triIndex + 2]));

                                // ugly!!
                                int index1 = indexList[triIndex];

                                //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                                triangle[0] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;
                                index1 = indexList[triIndex + 1];
                                //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                                triangle[1] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;
                                index1 = indexList[triIndex + 2];
                                //writer.WriteLine(String.Format("GB1[{0:0.00000000}][{1:0.00000000}][{2:0.00000000}]", vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]));
                                triangle[2] = new IndexedVector3(vertexList[index1 * stride], vertexList[(index1 * stride) + 1], vertexList[(index1 * stride) + 2]) * meshScaling;


                                //writer.WriteLine(String.Format("index[{0}] triangle[0].X =[{1:0.00000000}] triangle[0].Y =[{2:0.00000000}] triangle[0].Z =[{3:0.00000000}]", gfxindex, triangle[0].X, triangle[0].Y, triangle[0].Z));
                                //writer.WriteLine(String.Format("index[{0}] triangle[1].X =[{1:0.00000000}] triangle[1].Y =[{2:0.00000000}] triangle[1].Z =[{3:0.00000000}]", gfxindex, triangle[1].X, triangle[1].Y, triangle[1].Z));
                                //writer.WriteLine(String.Format("index[{0}] triangle[2].X =[{1:0.00000000}] triangle[2].Y =[{2:0.00000000}] triangle[2].Z =[{3:0.00000000}]", gfxindex, triangle[2].X, triangle[2].Y, triangle[2].Z));

                                callback.InternalProcessTriangleIndex(triangle, part, gfxindex);
                            }
                            //writer.Flush();
                            //}
                        }
                        else
                        {
                            Debug.Assert(false); // unsupported type ....
                        }
				        break;
			        }
                default:
                    {
                        Debug.Assert(gfxindextype == PHY_ScalarType.PHY_INTEGER);
                        break;
                    }
		        }

		        UnLockReadOnlyVertexBase(part);
            }
        }