1 /* 2 * Copyright 2011-2013 Blender Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __PARTICLES_H__ 18 #define __PARTICLES_H__ 19 20 #include "util/util_array.h" 21 #include "util/util_types.h" 22 23 #include "graph/node.h" 24 25 CCL_NAMESPACE_BEGIN 26 27 class Device; 28 class DeviceScene; 29 class Progress; 30 class Scene; 31 32 /* Particle System */ 33 34 struct Particle { 35 int index; 36 float age; 37 float lifetime; 38 float3 location; 39 float4 rotation; 40 float size; 41 float3 velocity; 42 float3 angular_velocity; 43 }; 44 45 class ParticleSystem : public Node { 46 public: 47 NODE_DECLARE 48 49 ParticleSystem(); 50 ~ParticleSystem(); 51 52 void tag_update(Scene *scene); 53 54 array<Particle> particles; 55 }; 56 57 /* ParticleSystem Manager */ 58 59 class ParticleSystemManager { 60 public: 61 bool need_update; 62 63 ParticleSystemManager(); 64 ~ParticleSystemManager(); 65 66 void device_update_particles(Device *device, 67 DeviceScene *dscene, 68 Scene *scene, 69 Progress &progress); 70 void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress); 71 void device_free(Device *device, DeviceScene *dscene); 72 73 void tag_update(Scene *scene); 74 }; 75 76 CCL_NAMESPACE_END 77 78 #endif /* __PARTICLES_H__ */ 79