[C++] The IN55 project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scene.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __SCENE_H__
  2. #define __SCENE_H__
  3. #include <assimp/cimport.h>
  4. #include <assimp/scene.h>
  5. #include <assimp/postprocess.h>
  6. class SceneHandler;
  7. #include <vertice.h>
  8. #include <bone.h>
  9. #include <mesh.h>
  10. #include <boneAnim.h>
  11. #include <utils.h>
  12. #define min(x,y) (x<y?x:y)
  13. #define max(x,y) (y>x?y:x)
  14. const aiNode *getNode(const aiScene *scene, aiString name);
  15. const aiNode *getChildNode(aiString name, const aiNode *node);
  16. class SceneHandler
  17. {
  18. private:
  19. const struct aiScene* scene;
  20. Mesh **meshList;
  21. int meshNumber;
  22. aiVector3D scene_min, scene_max, scene_center;
  23. float scale, angle;
  24. int numFrame;
  25. bool isAnimating;
  26. unsigned int numAnimation;
  27. clock_t m_startTime;
  28. GLuint m_WVPLocation;
  29. GLuint m_WorldMatrixLocation;
  30. GLuint shaderProg;
  31. public:
  32. SceneHandler(char *fName, GLuint prog);
  33. virtual ~SceneHandler();
  34. void initMeshList(const aiNode *nd);
  35. void render();
  36. void get_bounding_box_for_node (const aiNode* nd, aiMatrix4x4* trafo);
  37. void get_bounding_box ();
  38. void resetNumFrame();
  39. const aiScene *getScene() { return scene; };
  40. void activateAnimation(bool b){if(numAnimation<=scene->mNumAnimations){isAnimating=b;}};
  41. int getMeshNumber() { return meshNumber; };
  42. void setNumAnimation(int n) {
  43. for (int i = 0; i < meshNumber; i++) {
  44. meshList[i]->setCurrentAnim(n);
  45. }
  46. numAnimation=n;
  47. };
  48. bool getAnimating(){return isAnimating;};
  49. };
  50. #endif