protected override void OnEntityComponentAdding(Entity entity, [NotNull] DecalComponent component, [NotNull] AssociatedData data) { var model = new Model(); // We create the cube via the *ProceduralModel class rather than GeometricPrimitive.*.New // because there are additional vertext data that gets created through this which are required by the Material var procCube = new CubeProceduralModel(); // Set up a new material with our decal shader. var shader = new ComputeShaderClassColor { MixinReference = "DecalShader" // This is referring to our shader at Effects\DecalShader.xksl }; var materialDescription = new MaterialDescriptor { Attributes = { DiffuseModel = new MaterialDiffuseLambertModelFeature(), Diffuse = new MaterialDiffuseMapFeature(shader), Transparency = new MaterialTransparencyBlendFeature(), CullMode = CullMode.Back, } }; procCube.MaterialInstance.IsShadowCaster = false; procCube.Generate(Services, model); var material = Material.New(_graphicsDevice, materialDescription); UpdateMaterialParameters(component, data.TransformComponent, material); data.Material = material; data.Model = model; }
/// <summary> /// Initializes a new instance of the <see cref="MaterialEmissiveMapFeature"/> class. /// </summary> /// <param name="emissiveMap">The emissive map.</param> /// <exception cref="System.ArgumentNullException">emissiveMap</exception> public MaterialShaderFeature(ComputeShaderClassColor shader) { if (shader == null) { throw new ArgumentNullException("shader"); } Shader = shader; }