[ODE] Trimesh Temporal Coherence Patches
Adam D. Moss
adam at gimp.org
Sun Dec 7 17:35:27 MST 2003
Aras Pranckevicius wrote:
>>In fact, from a read of the collision_trimesh_box.cpp code
>>it looks as if geoms are entered by pointer into the TCCache,
>>which would cause not only the little incremental memory wastage
>
> Yes, but it adds an ever-growing pointer array to each trimesh anyway :)
I was agreeing with you! :)
>>you mention but also some really unpredictable behaviour and/or
>>crashes if those geoms are freed or re-used later.
>
> Hoping for the best, it shouldn't crash :) TC cache is only searched for a
> matching pointer of "current colliding" geom
I see, that's not so terminal.
> - so dead geoms just have
> pointers to them, but aren't actually ever used. If geoms are RE-used, then I
> think Opcode internally does some checks - but my memory might be wrong.
Ah, so in a roundabout way (accident or design? :)) the old pointer
sitting in the TCCache still has to correspond to /a/ dxGeom (probably
even of the right class) to have gotten this far and matched with
the 'new' pointer... but the data which is cached (hmm, there's
an OBB cached in there, it seems, amongst another things)
might not even remotely resemble the real attributes of the
geom using that pointer any more. From a quick scan of OBBCache
and OBBCollider I see no reasonable defense against this (I
don't think this is really easily 'fixed' from the opcode side).
>>So, how would people feel if I disable temporal coherence by
>>default? Unless I'm mis-reading the code (i.e. not finding the
>>code that lets, say, a box remember all of the mesh TCCaches it's
>>in so it can notify them when it's destroyed, or a refcount)
>
> I haven't found any place of observer-like behavior either. Personally I just
> insert remove whole TC check directly from colliding function :) TC is a good
> thing, but the current implementation should really be made optional.
I see good reasons to make TC disable-able, so I'll be checking in
Vadim's patch soon.
Thanks,
--Adam
--
Adam D. Moss . ,,^^ adam at gimp.org http://www.foxbox.org/ co:3
Consume Less, Live More
More information about the ODE
mailing list