M3File.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #pragma once
  2. #include "Array.h"
  3. #include "ReferenceCounter.h"
  4. namespace Framework
  5. {
  6. class Text;
  7. class Model3DData;
  8. class Bone;
  9. class Datei;
  10. class GraphicsApi;
  11. //! Manages a file in which 3D models are stored
  12. class M3Datei : public virtual ReferenceCounter
  13. {
  14. private:
  15. Text pfad;
  16. RCArray<Text>* modelName;
  17. Array<__int64>* modelPos;
  18. void saveKnochen(Bone* k, Datei* zDat);
  19. Bone* readKnochen(Datei* zDat) const;
  20. public:
  21. //! Constructor
  22. DLLEXPORT M3Datei();
  23. //! Constructor
  24. //! \param pfad The path to the file
  25. DLLEXPORT M3Datei(const char* pfad);
  26. //! Constructor
  27. //! \param pfad The path to the file
  28. DLLEXPORT M3Datei(Text* pfad);
  29. //! Destructor
  30. DLLEXPORT ~M3Datei();
  31. //! Sets the path to the file
  32. //! \param pfad Path to the file
  33. DLLEXPORT void setPfad(const char* pfad);
  34. //! Reads basic information from the file needed for its usage
  35. DLLEXPORT void leseDaten();
  36. //! Saves 3D model data to the file
  37. //! \param zMdr A pointer to the data to be saved without increased
  38. //! reference counter \param name The name under which the data should be
  39. //! stored in the file \return 1 if the model was saved. 0 if an error
  40. //! occurred during saving
  41. DLLEXPORT bool saveModel(Model3DData* zMdr, Text* name);
  42. //! Saves 3D model data to the file
  43. //! \param zMdr A pointer to the data to be saved without increased
  44. //! reference counter \param name The name under which the data should be
  45. //! stored in the file \return 1 if the model was saved. 0 if an error
  46. //! occurred during saving
  47. DLLEXPORT bool saveModel(Model3DData* zMdr, const char* name);
  48. //! Deletes a 3D model from the file
  49. //! \param name The name of the model
  50. //! \return 1 if the model was deleted. 0 if the model was not
  51. //! found, or an error occurred during saving
  52. DLLEXPORT bool removeModel(Text* name);
  53. //! Deletes a 3D model from the file
  54. //! \param name The name of the model
  55. //! \return 1 if the model was deleted. 0 if the model was not
  56. //! found, or an error occurred during saving
  57. DLLEXPORT bool removeModel(const char* name);
  58. //! Loads a 3D model from the file
  59. //! \param name The name of the model to load
  60. //! \return The loaded data
  61. DLLEXPORT Model3DData* ladeModel(
  62. Text* name, GraphicsApi* zApi, Text* uniqueName) const;
  63. //! Loads a 3D model from the file
  64. //! \param name The name of the model to load
  65. //! \return The loaded data
  66. DLLEXPORT Model3DData* ladeModel(
  67. const char* name, GraphicsApi* zApi, const char* uniqueName) const;
  68. //! Checks whether a specific 3D model exists in the file
  69. //! \param name The name of the 3D model to search for
  70. //! \return 1 if the model was found. 0 otherwise
  71. DLLEXPORT bool hatModel(const char* name) const;
  72. //! Returns the number of stored models
  73. DLLEXPORT int getModelAnzahl() const;
  74. //! Returns the name of a specific model
  75. //! \param i The index of the model
  76. //! \return A pointer to the name of the model without increased reference
  77. //! counter
  78. DLLEXPORT Text* zModelName(int i) const;
  79. };
  80. } // namespace Framework