1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_EFFECTOR_H
17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_EFFECTOR_H
18 
19 #include "rs_render_particle.h"
20 #include "rs_particle_noise_field.h"
21 namespace OHOS {
22 namespace Rosen {
23 
24 class RSRenderParticleEffector {
25 public:
26     RSRenderParticleEffector();
27 
28     Vector4<int16_t> CalculateColorInt(const std::shared_ptr<RSRenderParticle>& particle, Vector4<int16_t> colorInt,
29         Vector4<float> colorF, Vector4<float> colorSpeed, float deltaTime);
30 
31     void UpdateCurveValue(float& value,
32         const std::vector<std::shared_ptr<ChangeInOverLife<float>>>& valChangeOverLife, int64_t activeTime);
33 
34     void UpdateColorCurveValue(Color& color,
35         const std::vector<std::shared_ptr<ChangeInOverLife<Color>>>& valChangeOverLife, int64_t activeTime);
36 
37     void UpdateColor(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
38 
39     void UpdateOpacity(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
40 
41     void UpdateScale(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
42 
43     void UpdateSpin(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
44 
45     void UpdateAccelerationAngle(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
46 
47     void UpdateAccelerationValue(const std::shared_ptr<RSRenderParticle>& particle, float deltaTime);
48 
49     void UpdatePosition(const std::shared_ptr<RSRenderParticle>& particle,
50         const std::shared_ptr<ParticleNoiseFields>& particleNoiseFields, float deltaTime);
51 
52     void UpdateActiveTime(const std::shared_ptr<RSRenderParticle>& particle, int64_t deltaTime);
53 
54     void Update(const std::shared_ptr<RSRenderParticle>& particle,
55         const std::shared_ptr<ParticleNoiseFields>& particleNoiseFields, int64_t deltaTime);
56 };
57 
58 } // namespace Rosen
59 } // namespace OHOS
60 
61 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_EFFECTOR_H
62