blob: 120082197ba1be69cd5c14a5230d0777e88fe0b3 [file] [log] [blame]
Brian Osman7c979f52019-02-12 13:27:51 -05001/*
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
15struct SkParticlePoseAndVelocity;
16struct SkParticleUpdateParams;
17
18class SkParticleAffector : public SkReflected {
19public:
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