[ODE] TriMesh Data woes

Beau Albiston albiston at cynergy.com
Tue Aug 7 16:20:49 MST 2007


"...it's likely to be in packed 3-float format if it's not interleaved 
such that Simple can't be used."

Rodrigo Hernandez wrote:
> How about making it take a pointer to a float and an offset in bytes 
> between a vertex and the next (like VBO do)
>
> In Example:
>
> /* Data for a mesh, inlcuding UVs, one vertex per line, format x,y,z,u,v: */
> float triangle[] =
> {
> 0.0,0.0,0.0,0.0,0.0,
> 1.0,0.0,1.0,0.2,0.5,
> 1.0,2.0,0.0,0.2,1.0,
> };
>
> dTriMeshDataBuildSimple(triangle,sizeof(float)*5);
>
>
> I think I wrote something like this for the convex code.
>
> Cheers!
>
> Jon Watte (ODE) wrote:
>   
>> dTriMeshDataBuildSimple() is documented as taking a dVector3*, which 
>> actually is a 4-element vector, which I know (after all, I explain it 
>> often enough :-) but it still bit me the other day. Geometry that comes 
>> from externally is unlikely to actually be in ODE format; it's likely to 
>> be in packed 3-float format if it's not interleaved such that Simple 
>> can't be used.
>>
>> I propose we change TriMeshDataBuildSimple() to take an array of real 
>> three-vectors. To make it clear we're changing the API, let it take a 
>> struct ExternalVertexPosition {} which can contain three floats. Pretty 
>> much everyone using the function uses type-casts anyway.
>>
>> Also, here is a patch I think is necessary (also in the patch tracker). 
>> It makes sure that swapping trimesh data (without changing the geom in 
>> other ways) actually re-calculates the AABB correctly. I believe I saw 
>> this not happening when debugging the above problem.
>>
>>
>> Index: collision_trimesh_opcode.cpp
>> ===================================================================
>> --- collision_trimesh_opcode.cpp        (revision 1199)
>> +++ collision_trimesh_opcode.cpp        (working copy)
>> @@ -698,6 +698,8 @@
>>  {
>>         dUASSERT(g && g->type == dTriMeshClass, "argument not a trimesh");
>>         ((dxTriMesh*)g)->Data = Data;
>> +       //  I changed my data -- I know nothing about my own AABB anymore.
>> +       ((dxTriMesh*)g)->gflags |= (GEOM_DIRTY|GEOM_AABB_BAD);
>>  }
>>
>>  dTriMeshDataID dGeomTriMeshGetData(dGeomID g)
>> _______________________________________________
>> ODE mailing list
>> ODE at ode.org
>> http://ode.org/mailman/listinfo/ode
>>
>>
>>   
>>     
>
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>
> __________ NOD32 2442 (20070807) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
>   



More information about the ODE mailing list