|
From: James W. <ja...@fr...> - 2008-05-12 18:34:42
|
Daniele Cavallini wrote: > At last I installed Visual studio 8 into my Computer. > So I can utilize Mutating Algorithms. With mac I increase very much > performance. > I use the function doLoadModel modified like below but I have an error > when I call MergeTriMeshes function. > An example of file is at > www.interstudio.net/quesa/Roof.3DMF > Have you some idea? Please be more specific about the error. What was the error message? > > //============================================================================= > // doLoadModel : Loads a Model from File > //----------------------------------------------------------------------------- > static TQ3Object > doLoadModel(TQ3ViewObject theView) > { > TQ3StorageObject storageObj; > TQ3Object notOptimizedModel,theModel; > float xBounds, yBounds, zBounds, scaleFactor; > TQ3BoundingBox theBounds; > TQ3Vector3D translateToOrigin = { 0.0f, 0.0f, 0.0f }; > TQ3Matrix4x4 translateMatrix; > TQ3Matrix4x4 scaleMatrix; > TextureImporterProcPtr funcPtr = TextureImportCallback; > TQ3BoundingBox dummyBounds; > // Get the file > storageObj = Qut_SelectMetafileToOpen(); > if( storageObj == NULL ) > return NULL; > > > // Attach texture import callback in case this is VRML. > #if !TARGET_API_MAC_OS8 > Q3Object_SetProperty( storageObj, kTextureImportCallbackPropertyType, > sizeof(TextureImporterProcPtr), &funcPtr ); > #endif > > > // Read the file (note, this disposes of storageObj) > notOptimizedModel = Qut_ReadModel(storageObj); > > > // Adjust the scale and translation required for the model > // > // Qut positions the camera 5 units away from the origin, with a > hither-yon > // distance of ~10 units. By scaling the object to be 3.75f units > across, > // we obtain something which fits within the visible range of the > camera. > if(notOptimizedModel) > { > // theModel=optmizeModel(notOptimizedModel,theView); > TQ3Status stato; > TQ3ViewStatus viewStatus; > TQ3BoundingBox dummyBounds; > > RemoveExtraReferences(notOptimizedModel); > > stato=Q3View_StartBoundingBox( theView, kQ3ComputeBoundsApproximate ); > Qut_SubmitDefaultState(theView); > DecomposeGeometries( notOptimizedModel, theView ); > > viewStatus=Q3View_EndBoundingBox( theView, &dummyBounds ); > > if(stato==kQ3Success) > do > { > > Q3Object_Submit(notOptimizedModel,theView); > > DecomposeGeometries( notOptimizedModel, theView ); > viewStatus=Q3View_EndBoundingBox( theView, > &dummyBounds); > }//do > while (viewStatus==kQ3ViewStatusRetraverse); > > > > LowerAttributesToGeometries( notOptimizedModel); > //TQ3GroupObject oldgroup=notOptimizedModel; > > theModel=(TQ3GroupObject) FlattenHierarchy(notOptimizedModel,0 ); > //Q3Object_Dispose(oldgroup); > > OptimizeTriMeshes(theModel); > MergeTriMeshes( theModel); > > Qut_CalcBounds(theView, theModel, &theBounds); > xBounds = (theBounds.max.x - theBounds.min.x); > yBounds = (theBounds.max.y - theBounds.min.y); > zBounds = (theBounds.max.z - theBounds.min.z); > > scaleFactor = (xBounds > yBounds) ? xBounds : yBounds; > scaleFactor = (zBounds > scaleFactor) ? zBounds : scaleFactor; > scaleFactor = 3.75f / scaleFactor; > > translateToOrigin.x = -(theBounds.min.x + (xBounds * 0.5f)); > translateToOrigin.y = -(theBounds.min.y + (yBounds * 0.5f)); > translateToOrigin.z = -(theBounds.min.z + (zBounds * 0.5f)); > > > Q3Matrix4x4_SetTranslate(&translateMatrix,translateToOrigin.x,translateToOrigin.y,translateToOrigin.z); > > Q3Matrix4x4_SetScale(&scaleMatrix,scaleFactor,scaleFactor,scaleFactor); > > Q3Matrix4x4_SetIdentity(&gMatrixCurrent); > > > Q3Matrix4x4_Multiply(&gMatrixCurrent,&translateMatrix,&gMatrixCurrent); > Q3Matrix4x4_Multiply(&gMatrixCurrent,&scaleMatrix,&gMatrixCurrent); > > } > return theModel; > > > } > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Quesa-develop mailing list > Que...@li... > https://lists.sourceforge.net/lists/listinfo/quesa-develop > -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |