[osg-users] RE : Re: Getting texture coordinates of loaded models
Hi Alberto, Indeed, that conversion is not possible. Do you know any other algorithms to retrieve texture coordinates of nodes made of a loaded model? In your previous post, you mention using indexes but assuming a Geometry node. The problem here is that here there is no Geometry node so your previous advice was not a huge boon. I thought that I could use a visitorto retrieve its Drawable objects, turn them into Geometry objects and use your trick but I was wrong as it is impossible to convert from Drawable to Geometry. Here is the situation. Waiting for your reply. F. Alberto Luaces [EMAIL PROTECTED] a écrit : Hi Franclin, El Jueves 31 Julio 2008ES 14:10:13 Franclin Foping escribió: retrieve its Drawable objects, convert them to Geometry As you have been told earlier, that conversion can only be done if the Drawable pointer really points to a Geometry object. Otherwise no conversion is made and you get a null pointer. Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org - Envoyé avec Yahoo! Mail. Une boite mail plus intelligente. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RE : Re: Getting texture coordinates of loaded models
Franclin Foping wrote: Hi Alberto, Indeed, that conversion is not possible. Do you know any other algorithms to retrieve texture coordinates of nodes made of a loaded model? In your previous post, you mention using indexes but assuming a Geometry node. The problem here is that here there is no Geometry node If the drawable of interest isn't a Geometry, then what class is it? Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RE : Re: Getting texture coordinates of loaded models
Franclin, El Jueves 31 Julio 2008ES 14:33:30 Franclin Foping escribió: visitorto retrieve its Drawable objects, turn them into Geometry objects and use your trick but I was wrong as it is impossible to convert from Drawable to Geometry. You still don't get it. You are not converting one type to another, but the pointers that reference those objects. This is only possible if the object pointed is really of the type you are requesting. I have been doing this a zillion times until now, provided that I know beforehand that my meshes are stored as Geometry(s). As you have been recommended, it's important that you know how polymorphism works in C++ and the rest of OO languages. Then you will understand why you can't magically convert one object of one class to another. As for the retrieval of the UV coordinates of a ShapeDrawable, they are hard-wired directly into the code, so I'm afraid you'll have to read OSG code to find how they are calculated (ShapeDrawable.cpp). The good news is that you won't have to do this work at runtime anymore :) Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RE : Re: Getting texture coordinates of loaded models
Franclin Foping wrote on Thursday, July 31, 2008 7:34 AM: Hi Alberto, Indeed, that conversion is not possible. Do you know any other algorithms to retrieve texture coordinates of nodes made of a loaded model? In your previous post, you mention using indexes but assuming a Geometry node. The problem here is that here there is no Geometry node so your previous advice was not a huge boon. I thought that I could use a visitorto retrieve its Drawable objects, turn them into Geometry objects and use your trick but I was wrong as it is impossible to convert from Drawable to Geometry. Here is the situation. Waiting for your reply. F. If the Drawable's supports(AttributeFunctor) returns true, you can write a subclass of AttributeFunctor to access the texture coordinates. ShapeDrawable's supports(ConstAttributeFunctor) returns true, so if you have ShapeDrawables you could use that. Something like (untested): class GetTextureCoords : public osg::Drawable::ConstAttributeFunctor { public: void apply(AttributeType type, unsigned int count, const GLbyte* coords) { if (type != TEXTURE_COORDS) return; // coords contains texture coordinates here } // ... other apply() functions ... }; HTH Alberto Luaces [EMAIL PROTECTED] a écrit : Hi Franclin, El Jueves 31 Julio 2008ES 14:10:13 Franclin Foping escribió: retrieve its Drawable objects, convert them to Geometry As you have been told earlier, that conversion can only be done if the Drawable pointer really points to a Geometry object. Otherwise no conversion is made and you get a null pointer. Alberto -- Bryan Thrall FlightSafety International [EMAIL PROTECTED] ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org