Hi Antonio,
the easiest way is to add a name attachment to your materials.
Andreas
void setName(osg::MaterialPtr &mat, const char *name)
{
if(mat == NullFC)
return;
// get mat name
NamePtr namea =
NamePtr::dcast(mat->findAttachment(Name::getClassType()));
// if it doesn't exist create it
if(namea == NullFC)
{
namea = Name::create();
beginEditCP(mat);
mat->addAttachment(namea);
endEditCP(mat);
}
beginEditCP(namea);
namea->getFieldPtr()->getValue().assign(name);
endEditCP(namea);
}
/*!
* \brief Gets the name of a material.
* \param material pointer.
* \return name.
*/
const char *getName(const osg::MaterialPtr &mat)
{
static string name;
name = "<noname>";
if(mat == NullFC)
return name.c_str();
NamePtr namea =
NamePtr::dcast(mat->findAttachment(Name::getClassType()));
if(namea != NullFC)
name = namea->getFieldPtr()->getValue().c_str();
else
name = mat->getType().getName().str();
return name.c_str();
}
> Hi,
>
> I need to save a couple of more information into an osb file. I have a list of
> shaders in my library, each of them has a unique ID and e.g. a name. I'd like
> to add those information into the osb file in order to re-assosciate the
> material to the element of my shader lib. So here's the question: Is there an
> "easy" way to add this information to the material or do I have to inherit
> some
> OSG class and add fieldcontainers holding those information?
>
> Regards,
>
> Toni
>
> --
> Ing. Antonio Bleile
> Seac02 S.r.l.
> via Avogadro 4
> 10121 Torino Italia
> Tel. +39.011.197.006.52
> Fax +39.011.197.006.53
> E-mail [EMAIL PROTECTED]
> Sito www.seac02.it
>
> Questa E-mail è rivolta unicamente alle persone o enti ai quali è indirizzata.
> Essa può contenere informazioni la cui riservatezza è tutelata.
> Sono vietati la riproduzione e qualsiasi uso di questa e-mail e/o delle
> informazioni in essa contenute in mancanza di autorizzazione del destinatario.
> This e-mail is intended only for the person or entity to which is addressed.
> It may contain information that is privileged, proprietary, confidential,
> attorney work product or otherwise exempted from disclosure under applicable
> law. Copying, dissemination or use of this e-mail or the information herein by
> anyone other than the intended recipient is prohibited.
>
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users