2
0

instance_object.h 962 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. *** :: Instance Object ::
  3. ***
  4. *** Much like a collection of static objects
  5. *** but supports instanced renderering.
  6. ***
  7. **/
  8. #ifndef instance_object_h
  9. #define instance_object_h
  10. #include "cengine.h"
  11. #include "casset.h"
  12. typedef struct {
  13. vec3 position;
  14. vec3 scale;
  15. quat rotation;
  16. mat4 world;
  17. mat3 world_normal;
  18. } instance_data;
  19. typedef struct {
  20. int num_instances;
  21. instance_data* instances;
  22. GLuint world_buffer;
  23. sphere bound;
  24. asset_hndl renderable;
  25. asset_hndl collision_body;
  26. } instance_object;
  27. instance_object* instance_object_new();
  28. void instance_object_delete(instance_object* io);
  29. void instance_object_update(instance_object* io);
  30. void instance_object_add_instance(instance_object* io, vec3 position, vec3 scale, quat rotation);
  31. void instance_object_rem_instance(instance_object* io, int i);
  32. mat4 instance_object_world(instance_object* io, int i);
  33. mat3 instance_object_world_normal(instance_object* io, int i);
  34. #endif