MeshFile.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef MESH_FILE_H
  2. #define MESH_FILE_H
  3. #include <Ogre.h>
  4. #include "BsxFile.h"
  5. #include "common/File.h"
  6. class MeshFile : public File
  7. {
  8. public:
  9. explicit MeshFile(const Ogre::String& file);
  10. explicit MeshFile(File* pFile);
  11. MeshFile(File* pFile, const u32 offset, const u32 length);
  12. MeshFile(u8* pBuffer, const u32 offset, const u32 length);
  13. virtual ~MeshFile();
  14. Ogre::ColourValue readColor( const u32 offset );
  15. void GetData(const Ogre::String& name, const int offset_to_parts, const int number_of_parts, Ogre::MeshPtr mesh, VectorTexForGenBsx& textures );
  16. void AddTexture( TexForGenBsx& texture, VectorTexForGenBsx& textures );
  17. enum BufferBinding
  18. {
  19. POSITION_BINDING = 0x0
  20. , COLOUR_BINDING = 0x1
  21. , TEXTURE_BINDING = 0x2
  22. , NORMAL_BINDING = 0x3
  23. };
  24. private:
  25. int offset_to_4;
  26. int offset_to_5;
  27. void readQuad( const u32 offset_to_poly, std::vector<Ogre::Vector3>& vertexes, float* &pPos, u16* &index, u32 &cur_vertex, Ogre::RGBA* &cur_colour, bool multi_color );
  28. void readTriangle( const u32 offset_to_poly, std::vector<Ogre::Vector3>& vertexes, float* &pPos, u16* &index, u32 &cur_vertex, Ogre::RGBA* &cur_colour, bool multi_color );
  29. void readPart( const Ogre::String& name, const u32 i, const u32 offset_to_part, Ogre::MeshPtr mesh, VectorTexForGenBsx& textures );
  30. };
  31. #endif // NESH_FILE_h