Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019 Google LLC |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkParticleAffector_DEFINED |
| 9 | #define SkParticleAffector_DEFINED |
| 10 | |
| 11 | #include "SkReflected.h" |
| 12 | |
| 13 | #include "SkPoint.h" |
| 14 | |
| 15 | struct SkParticlePoseAndVelocity; |
| 16 | struct SkParticleUpdateParams; |
| 17 | |
| 18 | class SkParticleAffector : public SkReflected { |
| 19 | public: |
| 20 | REFLECTED_ABSTRACT(SkParticleAffector, SkReflected) |
| 21 | |
| 22 | virtual void apply(SkParticleUpdateParams& params, SkParticlePoseAndVelocity& pv) = 0; |
| 23 | |
| 24 | static void RegisterAffectorTypes(); |
| 25 | |
| 26 | static sk_sp<SkParticleAffector> MakeDirectionalForce(SkVector force); |
| 27 | static sk_sp<SkParticleAffector> MakeRangedForce(const SkCurve& angle, const SkCurve& strength, |
| 28 | bool bidirectional); |
| 29 | static sk_sp<SkParticleAffector> MakePointForce(SkPoint point, SkScalar constant, |
| 30 | SkScalar invSquare); |
| 31 | static sk_sp<SkParticleAffector> MakeOrientAlongVelocity(); |
| 32 | }; |
| 33 | |
| 34 | #endif // SkParticleAffector_DEFINED |