particles.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #ifndef __PARTICLES_H__
  17. #define __PARTICLES_H__
  18. #include "util/util_array.h"
  19. #include "util/util_types.h"
  20. CCL_NAMESPACE_BEGIN
  21. class Device;
  22. class DeviceScene;
  23. class Progress;
  24. class Scene;
  25. /* Particle System */
  26. struct Particle {
  27. int index;
  28. float age;
  29. float lifetime;
  30. float3 location;
  31. float4 rotation;
  32. float size;
  33. float3 velocity;
  34. float3 angular_velocity;
  35. };
  36. class ParticleSystem {
  37. public:
  38. ParticleSystem();
  39. ~ParticleSystem();
  40. void tag_update(Scene *scene);
  41. array<Particle> particles;
  42. };
  43. /* ParticleSystem Manager */
  44. class ParticleSystemManager {
  45. public:
  46. bool need_update;
  47. ParticleSystemManager();
  48. ~ParticleSystemManager();
  49. void device_update_particles(Device *device,
  50. DeviceScene *dscene,
  51. Scene *scene,
  52. Progress &progress);
  53. void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
  54. void device_free(Device *device, DeviceScene *dscene);
  55. void tag_update(Scene *scene);
  56. };
  57. CCL_NAMESPACE_END
  58. #endif /* __PARTICLES_H__ */