by jasper » 20 April 2016, 10:18
Just #include the header in which you define the class... ComObjectRootEx is declared in the ATL headers. You may need to include those as well.
Yes, the compounds interface is implemented by the PP, which provides the compound definitions. However, the material object may contain a sub-set of the compounds in the PP. So the PP will call GetCompoundList on the MO's implementation to see which compounds are present on the MO.
If you always keep PP order, I suppose you can pass this call back on the PP, and let the PP answer its own question.
Note that the PP will likely ask you this once in between every call to SetMaterial and store the result. At least, this is how the MaterialContext is intended (not all implementations may follow this strategy). So if you have only one material object to work with, only call SetMaterial once. However, if you change the compound list on the material object, you must call SetMaterial again.