// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. // By inheriting the ParticleBase we inherit Texturing and the VSMain/PSMain methods, enough to draw a uniformly colored quad shader ParticleCustomShader : ParticleBase { // ------------------------------------- // streams // ------------------------------------- // This shader is settable by the user, and it's a binary tree made up from smaller shaders compose ComputeColor baseColor; // This shader is settable by the user, and it's a binary tree made up from smaller shaders compose ComputeColor baseIntensity; // Shading of the sprite - we override the base shader's Shading(), which only returns ColorScale stage override float4 Shading() { // ----------------------------------------------- // Base particle color RGB // ----------------------------------------------- float4 finalColor = base.Shading() * baseColor.Compute(); // ----------------------------------------------- // Base particle alpha // ----------------------------------------------- finalColor.a = baseIntensity.Compute(); // Don't forget to premultiply the alpha finalColor.rgb *= finalColor.aaa; return finalColor; } };