Hello,
Marcus Lindblom wrote:
> Olivier Tournaire wrote:
>> Thank you Carsten for the patch.
>>
>>
>> attached is a patch that adds a flipNormals function. It compiles
>> for me, but it's untested, so if you like I'd appreciate if you
>> could give it a try and let me know if it works.
>>
>>
>> I will try it as soon as I know how I get a Geometry* from
>> SceneFileHandler::the()->read(...) which seems to return a
>> NodeTransitPtr. Any hint ?
>
> 1. Store the NodeTransitPtr in a NodeRefPtr.
> 2. Get the Core from the Node.
> 3. Cast the Core to Geometry. (assuming there are no transform/material
> groups in the way)
>
> I.e.
>
> NodeRefPtr node = SceneFileHandler::the()-read(...);
> GeometryRefPtr geo = dynamic_pointer_cast<Geometry>(node->getCore());
^^^^^
I think this has to be dynamic_cast<Geometry *>(...) (this may be needed
in other places as well)
The {dynamic,static}_pointer_cast functions are only necessary when the
*source* pointer is one of the OpenSG RefPointer types (i.e. FooRefPtr,
FooUnrecPtr, FooWeakPtr, etc.).
I think I had once added support for {dynamic,static}_pointer_cast to
work on raw pointers (i.e. Foo *) as well, but it got removed - perhaps
it had problems with certain cases?
IMHO it is more convenient for users not having to worry about whether a
function returns a raw pointer or a ref pointer and allow everyone to
just write dynamic_pointer_cast for all cases, those that like to save a
few keystrokes are of course free to use dynamic_cast directly where
possible.
The other thing to consider here is perhaps what boost does? Does anyone
know if the boost::dynamic_pointer_cast<>() for their boost::shared_ptr
works with raw pointers?
Cheers,
Carsten
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users