This document is archived and information here might be outdated. Recommended version. |
Interface to get infomation of a GeneralMultiPatch.
Name | Description | |
---|---|---|
IdCount | Get Id Count. | |
IsMaterialTextured | Get Is Material textured. | |
MaterialColor | Get material color. | |
MaterialCount | Get Material Count. | |
MaterialCullBackface | Get backface culling enabled, | |
MaterialTextureBytesPerPixel | Get Material texture bytes per pixel. | |
MaterialTextureColumnCount | Get Material texture column count. | |
MaterialTexturePixelColor | Get Material texture pixel color. | |
MaterialTextureRowCount | Get Material texture row count. | |
MaterialTransparencyPercent | Get transparency %, in range of 0 - 100 | |
MCount | Get M Count. | |
NormalCount | Get Normal Count. | |
PatchCount | Get Patch Count. | |
PatchM | Get M for patch at vertex index. | |
PatchMaterialIndex | Get patch material index. | |
PatchPriority | Get patch priority. | |
PatchTextureVertex | Get Texture WKSPoint for a patch at vertex index. | |
PatchTextureVertexCount | Get texture vertex count for a patch. | |
PatchType | Get patch type. | |
PatchVertex | Get Point for patch at vertex index. | |
PatchVertexCount | Get count of vertices in patch. | |
PatchVertexID | Get vertex Id for a patch at vertex index. | |
QueryPatchNormal | Copies the Normal for patch at specified vertex index into the input vector. | |
TextureVertexCount | Get Texture Vertex Count. | |
VertexCount | Get Vertex Count. |
CoClasses and Classes | Description |
---|---|
MultiPatch | A collection of surface patches. |
Use this interface to obtain a multipatch's geometry information, including those of its geometry material, if any.
public static void MultiPatchToString(IMultiPatch multiPatch)
{
IGeneralMultiPatchInfo generalMultiPatchInfo=multiPatch as IGeneralMultiPatchInfo;
int materialCount=generalMultiPatchInfo.MaterialCount;
int patchCount=generalMultiPatchInfo.PatchCount;
Trace.WriteLine("----------------------");
Trace.WriteLine("High Level Description");
Trace.WriteLine("----------------------");
Trace.WriteLine("Material Count: " + materialCount);
Trace.WriteLine("Patch Count: " + patchCount);
Trace.WriteLine(" Point Count: " + generalMultiPatchInfo.VertexCount);
Trace.WriteLine(" M Count: " + generalMultiPatchInfo.MCount);
Trace.WriteLine(" ID Count: " + generalMultiPatchInfo.IdCount);
Trace.WriteLine(" Normal Count: " + generalMultiPatchInfo.NormalCount);
Trace.WriteLine(" Texture Point Count: " + generalMultiPatchInfo.TextureVertexCount);
Trace.WriteLine("---------------------");
Trace.WriteLine("Low Level Description");
Trace.WriteLine("---------------------");
Trace.WriteLine("Materials: ");
for (int materialIndex=0; materialIndex < materialCount; materialIndex++)
{
Trace.WriteLine(" Material " + materialIndex + ": ");
Trace.WriteLine(" Color: " + generalMultiPatchInfo.get_MaterialColor(materialIndex));
Trace.WriteLine(" Texture: ");
Trace.WriteLine(" IsTextured: " + generalMultiPatchInfo.get_IsMaterialTextured(materialIndex));
int columnCount=generalMultiPatchInfo.get_MaterialTextureColumnCount(materialIndex);
int rowCount=generalMultiPatchInfo.get_MaterialTextureRowCount(materialIndex);
int bytesPerPixel=generalMultiPatchInfo.get_MaterialTextureBytesPerPixel(materialIndex);
Trace.WriteLine(" RowCount: " + rowCount);
Trace.WriteLine(" ColumnCount: " + columnCount);
Trace.WriteLine(" BytesPerPixel: " + bytesPerPixel);
double sizeInKB=(double)rowCount * (double)columnCount * (double)bytesPerPixel * Math.Pow(10, -3);
Trace.WriteLine(" SizeInKB: " + sizeInKB);
for (int rowIndex=0; rowIndex < rowCount; rowIndex++)
{
for (int columnIndex=0; columnIndex < columnCount; columnIndex++)
{
Trace.WriteLine(" Pixel (" + rowIndex + ", " + columnIndex + "): ");
Trace.WriteLine(" Color: " + generalMultiPatchInfo.get_MaterialTexturePixelColor(materialIndex, rowIndex, columnIndex));
}
}
Trace.WriteLine(" TransparencyPercent: " + generalMultiPatchInfo.get_MaterialTransparencyPercent(materialIndex));
Trace.WriteLine(" IsBackfaceCulled: " + generalMultiPatchInfo.get_MaterialCullBackface(materialIndex));
}
Trace.WriteLine("Patches: ");
for (int patchIndex=0; patchIndex < patchCount; patchIndex++)
{
Trace.WriteLine(" Patch " + patchIndex + ": ");
Trace.WriteLine(" Type: " + generalMultiPatchInfo.get_PatchType(patchIndex));
Trace.WriteLine(" Priority: " + generalMultiPatchInfo.get_PatchPriority(patchIndex));
Trace.WriteLine(" MaterialIndex: " + generalMultiPatchInfo.get_PatchMaterialIndex(patchIndex));
int pointCount=generalMultiPatchInfo.get_PatchVertexCount(patchIndex);
Trace.WriteLine(" PointCount: " + pointCount);
for (int pointIndex=0; pointIndex < pointCount; pointIndex++)
{
WKSPointZ point=generalMultiPatchInfo.get_PatchVertex(patchIndex, pointIndex);
Trace.WriteLine(" Point " + pointIndex + ": ");
Trace.WriteLine(" X: " + point.X);
Trace.WriteLine(" Y: " + point.Y);
Trace.WriteLine(" Z: " + point.Z);
double m=generalMultiPatchInfo.get_PatchM(patchIndex, pointIndex);
int id=generalMultiPatchInfo.get_PatchVertexID(patchIndex, pointIndex);
Trace.WriteLine(" M: " + m);
Trace.WriteLine(" ID: " + id);
IVector3D normalVector3D=new Vector3DClass();
generalMultiPatchInfo.QueryPatchNormal(patchIndex, pointIndex, normalVector3D);
Trace.WriteLine(" Normal: ");
Trace.WriteLine(" XComponent: " + normalVector3D.XComponent);
Trace.WriteLine(" YComponent: " + normalVector3D.YComponent);
Trace.WriteLine(" ZComponent: " + normalVector3D.ZComponent);
}
int texturePointCount=generalMultiPatchInfo.get_PatchTextureVertexCount(patchIndex);
Trace.WriteLine(" TexturePointCount: " + texturePointCount);
for (int texturePointIndex=0; texturePointIndex < texturePointCount; texturePointIndex++)
{
WKSPoint texturePoint=generalMultiPatchInfo.get_PatchTextureVertex(patchIndex, texturePointIndex);
Trace.WriteLine(" TexturePoint " + texturePointIndex + ": ");
Trace.WriteLine(" S: " + texturePoint.X);
Trace.WriteLine(" T: " + texturePoint.Y);
}
}
}