protected void SetRandomValues(DeviceContextHolder holder, EffectOnlyResourceVariable texture, EffectOnlyVector4Variable size, bool accumulationMode, Vector2 targetSize) { if (_accumulationMode != accumulationMode) { _accumulationMode = accumulationMode; var randomSize = accumulationMode ? 16 : 4; texture.SetResource(holder.GetRandomTexture(randomSize, randomSize)); _randomSize = randomSize; if (!accumulationMode) { size.Set(new Vector4(targetSize.X / _randomSize, targetSize.Y / _randomSize, 0f, 0f)); } } else if (accumulationMode) { size.Set(new Vector4(targetSize.X / _randomSize, targetSize.Y / _randomSize, MathUtils.Random(0f, 1f), MathUtils.Random(0f, 1f))); } }
public static void Set([CanBeNull] this SourceReady ready, [NotNull] EffectOnlyResourceVariable resource, [NotNull] EffectOnlyVector4Variable channelsAssignments) { resource.SetResource(ready?.View); channelsAssignments.Set(ready?.ChannelsAssignments ?? default(Vector4)); }