Pie Noon
An open source project by FPL.
 All Classes Pages
drip_and_vanish.h
1 // Copyright 2015 Google Inc. All rights reserved.
2 //
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 #ifndef COMPONENTS_DRIPANDVANISH_H_
16 #define COMPONENTS_DRIPANDVANISH_H_
17 
18 #include "common.h"
19 #include "components_generated.h"
20 #include "corgi/component.h"
21 #include "mathfu/constants.h"
22 #include "scene_description.h"
23 
24 namespace fpl {
25 namespace pie_noon {
26 
27 // Data for accessory components.
29  float lifetime_remaining;
30  float slide_time;
31  float drip_distance;
32  mathfu::vec3_packed start_position;
33  mathfu::vec3_packed start_scale;
34 };
35 
36 // Basic behavior for pie splatters: They stay there for a while,
37 // and then they slowly drip down and vanish.
38 class DripAndVanishComponent : public corgi::Component<DripAndVanishData> {
39  public:
40  virtual void AddFromRawData(corgi::EntityRef& entity, const void* data);
41  virtual void UpdateAllEntities(corgi::WorldTime /*delta_time*/);
42  virtual void InitEntity(corgi::EntityRef& entity);
43  void SetStartingValues(corgi::EntityRef& entity);
44 };
45 
46 } // pie_noon
47 } // fpl
48 
49 CORGI_REGISTER_COMPONENT(fpl::pie_noon::DripAndVanishComponent,
51 
52 #endif // COMPONENTS_DRIPANDVANISH_H_
Definition: drip_and_vanish.h:38
Definition: drip_and_vanish.h:28