public override void Process(TraversalContext context) { // Choose the appropriate material TraversalContext.MaterialFlags materialFlags = (LocalMaterialFlags | context.ExternalMaterialFlags) & mSupportedMaterialFlags; EffectApplication currentMaterial = mMaterials[materialFlags & ~(materialFlags - 1)]; // Clear all but the lowest bit (highest priority flag) if (currentMaterial != null) { context.AcceptForRender(this, currentMaterial); } }
// For the key, please only set one flag at a time. // Provide a material to use for special rendering modes. You can supply a null material if the node should not draw anything // for a certain mode (usually to not participate in the shadow pass.) public void AddMaterial(TraversalContext.MaterialFlags materialFlag, EffectApplication material) { mMaterials.Add(materialFlag, material); mSupportedMaterialFlags |= materialFlag; }
// Provide a material to use for special rendering modes. You can supply a null material if the node should not draw anything // for a certain mode (usually to not participate in the shadow pass.) public void AddMaterial(TraversalContext.MaterialFlags materialFlag, EffectApplication material) // For the key, please only set one flag at a time. { mMaterials.Add(materialFlag, material); mSupportedMaterialFlags |= materialFlag; }
public void AddFringeMaterial(TraversalContext.MaterialFlags materialFlag, EffectApplication fringeMaterial) // For the key, please only set one flag at a time. { mFringeMaterials.Add(materialFlag, fringeMaterial); }