Hello Johannes, On 02/05/2013 06:13 AM, Johannes Brunen wrote: > I'm curious about the VariantMaterial. I could not find documentation or > simple examples for this material. Only the CgFXMaterial seems to use > it, but this is a complex beast :-).
I'm purely going by what I understood from looking at the code... > So some questions about it: > > 1. What is the idea behind this material? I believe the idea is that it acts a bit like a switch, but instead of the user explicitly setting a switch value, the "RenderProperties" set on the RenderAction are used to select a material (or the fallback if no material matching the RenderProperties is found). > 2. How to use it properly? basically you just put a couple of materials in with: VariantMaterial::addMaterial(PrimeMaterial * const materialP, MaterialMapKey key = 0); and a fallback with: VariantMaterial::setFallbackMaterial(PrimeMaterial * const value); Of course the real question is how to generate meaningful MaterialMapKeys so that the material selection based on RenderProperties works. Unfortunately I don't know that part, sorry. > 3. Is it always used as a base class? it's not abstract and I think it can be used on its own. > 4. How can I iterate over the materials contained in a VariantMaterial? you can use: const SFMaterialPtrMap *VariantMaterial::getSFMaterialStore(void) const; The returned SField stores a std::map<MaterialMapKey, PrimeMaterial *>. Cheers, Carsten ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users