|
From: Daniele C. <dca...@in...> - 2008-05-12 08:45:17
|
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? //============================================================================= // 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; } |
|
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/> |
|
From: Daniele C. <dca...@in...> - 2008-05-13 14:25:55
|
The error prompt is:
Expression: vector subscript out the range
The problem is when there is a trimesh and edges are not definite.
I modify function MergeTrimeshList , I add
if(tmData.edges>0)
AppendArrayToVec(... ... ...)
It seem work fine.
James Walker ha scritto:
> 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
>>
>>
>
>
>
|
|
From: James W. <ja...@fr...> - 2008-05-13 17:30:07
|
Daniele Cavallini wrote: > The error prompt is: > Expression: vector subscript out the range > The problem is when there is a trimesh and edges are not definite. > I modify function MergeTrimeshList , I add > if(tmData.edges>0) > AppendArrayToVec(... ... ...) > > It seem work fine. Thanks. I have committed a slightly different fix, which does the check inside AppendArrayToVec. -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |
|
From: Daniele C. <dca...@in...> - 2008-05-15 16:23:26
|
I made a little modify ad the function: MergeTriMeshList
I think it is necessary initialize mergedEdges to NULL but I don't found
like do it.
.....
TQ3TriMeshEdgeData *pEdge;
int dimEdge=mergedEdges.size();
if (dimEdge>0)
pEdge=&mergedEdges[0];
else
pEdge=NULL;
TQ3TriMeshData mergedData = {
overallAtts.get(),
mergedFaces.size(),
&mergedFaces[0],
(mergedFaceNormals.size() == mergedFaces.size()? 1 : 0),
&faceAtt,
mergedEdges.size(),
pEdge,
0,
NULL,
mergedPoints.size(),
&mergedPoints[0],
vertAtts.size(),
&vertAtts[0],
theBounds
};
James Walker ha scritto:
> Daniele Cavallini wrote:
>
>
>> The error prompt is:
>> Expression: vector subscript out the range
>> The problem is when there is a trimesh and edges are not definite.
>> I modify function MergeTrimeshList , I add
>> if(tmData.edges>0)
>> AppendArrayToVec(... ... ...)
>>
>> It seem work fine.
>>
>
> Thanks. I have committed a slightly different fix, which does the check
> inside AppendArrayToVec.
>
>
|
|
From: Daniele C. <dca...@in...> - 2008-05-16 08:11:37
|
Error message is "vector subscript out of range" if mergedEdges.size()
is zero I write
TQ3TriMeshEdgeData *pEdge=NULL;
pEdge=&mergedEdges[0]; <---------------- ERROR
So I made the little modify. I don' t find other solution.
James Walker wrote:
> Daniele Cavallini wrote:
>
>
>> I made a little modify ad the function: MergeTriMeshList
>> I think it is necessary initialize mergedEdges to NULL but I don't found
>> like do it.
>>
>
> Did you get an error message about this? I don't know what you mean by
> "I don't found like do it".
>
>
>
>>
>> .....
>>
>> TQ3TriMeshEdgeData *pEdge;
>> int dimEdge=mergedEdges.size();
>> if (dimEdge>0)
>> pEdge=&mergedEdges[0];
>> else
>> pEdge=NULL;
>>
>> TQ3TriMeshData mergedData = {
>> overallAtts.get(),
>> mergedFaces.size(),
>> &mergedFaces[0],
>> (mergedFaceNormals.size() == mergedFaces.size()? 1 : 0),
>> &faceAtt,
>> mergedEdges.size(),
>> pEdge,
>> 0,
>> NULL,
>> mergedPoints.size(),
>> &mergedPoints[0],
>> vertAtts.size(),
>> &vertAtts[0],
>> theBounds
>> };
>>
>
>
>
|
|
From: James W. W. <os...@jw...> - 2008-05-17 15:53:51
|
I checked in another modification to MergeTriMeshList.cpp. Let me know if you get any more errors. |
|
From: James W. <ja...@fr...> - 2008-05-15 19:30:46
|
Daniele Cavallini wrote:
> I made a little modify ad the function: MergeTriMeshList
> I think it is necessary initialize mergedEdges to NULL but I don't found
> like do it.
Did you get an error message about this? I don't know what you mean by
"I don't found like do it".
>
> .....
>
> TQ3TriMeshEdgeData *pEdge;
> int dimEdge=mergedEdges.size();
> if (dimEdge>0)
> pEdge=&mergedEdges[0];
> else
> pEdge=NULL;
>
> TQ3TriMeshData mergedData = {
> overallAtts.get(),
> mergedFaces.size(),
> &mergedFaces[0],
> (mergedFaceNormals.size() == mergedFaces.size()? 1 : 0),
> &faceAtt,
> mergedEdges.size(),
> pEdge,
> 0,
> NULL,
> mergedPoints.size(),
> &mergedPoints[0],
> vertAtts.size(),
> &vertAtts[0],
> theBounds
> };
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
|
|
From: Roger H. <rog...@mi...> - 2008-05-16 15:14:28
|
I have not checked out for about a year (and do not want to), so maybe this has been fixed. I have two trigrids, one with a texture shader in is attribute set and the second one without. If I put them in a group I get the texture shader of the first displayed on the second one. If I put them both in their own display group this does not happen. If I make the groups 'inline' the problem comes back. Should Quesa save the graphic state, or at least the texture state, around each object in a group? Is there some resetting code missing? Am I just out of date? Roger |
|
From: James W. W. <os...@jw...> - 2008-05-16 16:29:00
|
On May 16, 2008, at 8:09 AM, Roger Holmes wrote: > I have not checked out for about a year (and do not want to), so > maybe this has been fixed. > > I have two trigrids, one with a texture shader in is attribute set > and the second one without. If I put them in a group I get the > texture shader of the first displayed on the second one. If I put > them both in their own display group this does not happen. If I make > the groups 'inline' the problem comes back. > > Should Quesa save the graphic state, or at least the texture state, > around each object in a group? Is there some resetting code missing? > Am I just out of date? That does sound like a bug, but I don't know whether it may have been fixed. I haven't seen it. Does it matter which renderer you use? |
|
From: Roger H. <rog...@mi...> - 2008-05-16 19:05:13
|
On 16 May, 2008, at 17:28, James W. Walker wrote: > > On May 16, 2008, at 8:09 AM, Roger Holmes wrote: > >> I have not checked out for about a year (and do not want to), so >> maybe this has been fixed. >> >> I have two trigrids, one with a texture shader in is attribute set >> and the second one without. If I put them in a group I get the >> texture shader of the first displayed on the second one. If I put >> them both in their own display group this does not happen. If I make >> the groups 'inline' the problem comes back. >> >> Should Quesa save the graphic state, or at least the texture state, >> around each object in a group? Is there some resetting code missing? >> Am I just out of date? > > That does sound like a bug, but I don't know whether it may have been > fixed. I haven't seen it. Does it matter which renderer you use? It goes wrong with at least three renderers, so I think the problem is in Quesa's handling of the graphics state outside the sending of data to the renderer. I suspect it is not just Tri-grids, though it could be when the Tri-grids get converted to Tri-meshes. |
|
From: James W. W. <os...@jw...> - 2008-05-17 20:42:20
|
On May 16, 2008, at 12:04 PM, Roger Holmes wrote: > It goes wrong with at least three renderers, so I think the problem > is in Quesa's handling of the graphics state outside the sending of > data to the renderer. I suspect it is not just Tri-grids, though it > could be when the Tri-grids get converted to Tri-meshes. It is just TriGrids. In fact a textured TriGrid gets cached as a group of triangles, not a TriMesh, and the problem was that it was an inline group. I've checked in a fix. |
|
From: Roger H. <rog...@mi...> - 2008-05-18 22:45:06
|
> >> It goes wrong with at least three renderers, so I think the problem >> is in Quesa's handling of the graphics state outside the sending of >> data to the renderer. I suspect it is not just Tri-grids, though it >> could be when the Tri-grids get converted to Tri-meshes. > > It is just TriGrids. In fact a textured TriGrid gets cached as a > group of triangles, not a TriMesh, and the problem was that it was an > inline group. I've checked in a fix. Wonderful. Thank you. Roger. |
|
From: Roger H. <rog...@mi...> - 2008-05-19 12:19:07
|
On 17 May, 2008, at 21:42, James W. Walker wrote: > It is just TriGrids. In fact a textured TriGrid gets cached as a > group of triangles, not a TriMesh, and the problem was that it was an > inline group. I've checked in a fix. I just realised something. Does this mean that if I have two triangle objects in an ordinary group, the first with a texture and the second without, that the same problem occurs? Maybe for a group generated from a TriGrid, the texture is loose in the group before the triangles? |
|
From: James W. W. <os...@jw...> - 2008-05-19 16:17:55
|
On May 19, 2008, at 5:18 AM, Roger Holmes wrote: > > On 17 May, 2008, at 21:42, James W. Walker wrote: > >> It is just TriGrids. In fact a textured TriGrid gets cached as a >> group of triangles, not a TriMesh, and the problem was that it was an >> inline group. I've checked in a fix. > > > I just realised something. Does this mean that if I have two triangle > objects in an ordinary group, the first with a texture and the second > without, that the same problem occurs? Maybe for a group generated > from a TriGrid, the texture is loose in the group before the > triangles? If I recall correctly, the texture shader is in an attribute set in the group before the triangles. |