model.cpp 644 B

123456789101112131415161718192021222324252627282930
  1. #include "model.h"
  2. #include "objParser.h"
  3. Model::Model(std::string path, TransformParameters &initParameters){
  4. OBJ::buildMeshFromFile(mMesh, path);
  5. mBounds.buildAABB(mMesh);
  6. mModelMatrix = Matrix4::transformMatrix(initParameters);
  7. }
  8. Mesh * Model::getMesh(){
  9. return &mMesh;
  10. }
  11. void Model::update(){
  12. //You'd get physics updates or user input updates or whatever here
  13. //Recalculate model matrix for movement or scaling
  14. mBounds.update(mModelMatrix);
  15. }
  16. AABox *Model::getBounds(){
  17. return &mBounds;
  18. }
  19. Matrix4 *Model::getModelMatrix(){
  20. return &mModelMatrix;
  21. }
  22. Texture *Model::getAlbedo(){
  23. return &mAlbedo;
  24. }