/// <summary> /// Called when a basic effect is encountered and potentially replaced by /// BasicPaletteEffect (if not overridden). This is called afer effects have been processed. /// </summary> /// <param name="skinningType">The the skinning type of the meshpart.</param> /// <param name="meshPart">The MeshPart that contains the BasicMaterialContent.</param> protected virtual void ReplaceBasicEffect(SkinningType skinningType, ModelMeshPartContent meshPart) { BasicMaterialContent basic = meshPart.Material as BasicMaterialContent; if (basic != null) { // Create a new PaletteSourceCode object and set its palette size // based on the platform since xbox has fewer registers. PaletteSourceCode source; if (context.TargetPlatform != TargetPlatform.Xbox360) { source = new PaletteSourceCode(56); } else { source = new PaletteSourceCode(40); } // Process the material and set the meshPart material to the new // material. PaletteInfoProcessor processor = new PaletteInfoProcessor(); meshPart.Material = processor.Process( new PaletteInfo(source.SourceCode4BonesPerVertex, source.PALETTE_SIZE, basic), context); } }
/// <summary> /// Called when a basic effect is encountered and potentially replaced by /// BasicPaletteEffect (if not overridden). This is called afer effects have been processed. /// </summary> /// <param name="skinningType">The the skinning type of the meshpart.</param> /// <param name="meshPart">The MeshPart that contains the BasicMaterialContent.</param> protected virtual void ReplaceBasicEffect(SkinningType skinningType, ModelMeshPartContent meshPart) { BasicMaterialContent basic = meshPart.Material as BasicMaterialContent; if (basic != null) { // Create a new PaletteSourceCode object and set its palette size // based on the platform since xbox has fewer registers. PaletteSourceCode source; if (context.TargetPlatform != TargetPlatform.Xbox360) { source = new PaletteSourceCode(56); } else { source = new PaletteSourceCode(40); } // Process the material and set the meshPart material to the new // material. PaletteInfoProcessor processor = new PaletteInfoProcessor(); meshPart.Material = processor.Process( new PaletteInfo(source.SourceCode4BonesPerVertex, source.PALETTE_SIZE, basic), context); } }