I am trying to import MultPatchShapebuffer in Rhino with the sdk
I have no problem to decode the geometry building the appropriate meshes , normals , textures coordinates but when i use
MultiPatch.GetMaterials ( nummaterial, compression,*&part , *&material)
( see the code below ) i get garbage with nummaterial ( huge number) and compression even if MultiPatch.HasMaterials () return true
Is the method GetMaterials fully implemented ?
Is there a workaround ?
Second Question
How to interpret the content of the material pointer
( an array of bytes for each material ) , is it just a binary content of a jpg file , tif ?
I need to get an image file ( jpg, tiff ) to pass as a texture file to rhino
Or a special representation of the image ( how to get resolution , colors )
I made the test on the shape.gdt who contain a multipatch object with texture , and other gdb
i always get garbage on this function call
Thanks for explanations.
sample code :
if ( geo == geometryMultiPatch )
{
MultiPatchShapeBuffer MultiPatch;
if ( hr =row.GetGeometry(MultiPatch) != S_OK ) {
RhinoApp().Print ( " erreur geometry \n");
} else {
int NumParts;
int NumPoints;
MultiPatch.GetNumParts(NumParts);
MultiPatch.GetNumPoints( NumPoints);
RhinoApp().Print ( "MultiPatch: numpoint %d numparts %d textures: %d material :%d \n",
NumPoints, NumParts,MultiPatch.HasTextures(shapeType), MultiPatch.HasMaterials(shapeType) );
if ( MultiPatch.HasTextures(shapeType) == true ) {
int numTextures;
int textureDimension;
int *textureParts;
float *texturesCoords;
fgdbError error;
error = MultiPatch.GetTextures( numTextures, textureDimension, *&textureParts, *&texturesCoords);
RhinoApp().Print ( " Number of texture %d Dimension: %d \n", numTextures, textureDimension);
} // end textures test
if ( MultiPatch.HasMaterials(shapeType) == true ) {
int nummaterial = 0;
int compression = 0;
int *part = NULL;
unsigned char *material = NULL;
fgdbError error;
error = MultiPatch.GetMaterials( nummaterial, compression, *&part, *&material) ;
if ( error != S_OK ) {
RhinoApp().Print ( " Error reading material \n");
} else {
RhinoApp().Print (" nummaterial %d \n", nummaterial);
int n;
for ( n = 0; n < nummaterial; n++ ) {
RhinoApp().Print ( "Compression:%d part:%d material %d \n", compression, part, material);
}
}
} // end material
}
}