Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

97 rader
3.5 KiB

  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file ProgressHandler.h
  34. * @brief Abstract base class 'ProgressHandler'.
  35. */
  36. #ifndef INCLUDED_AI_PROGRESSHANDLER_H
  37. #define INCLUDED_AI_PROGRESSHANDLER_H
  38. #include "types.h"
  39. namespace Assimp {
  40. // ------------------------------------------------------------------------------------
  41. /** @brief CPP-API: Abstract interface for custom progress report receivers.
  42. *
  43. * Each #Importer instance maintains its own #ProgressHandler. The default
  44. * implementation provided by Assimp doesn't do anything at all. */
  45. class ASSIMP_API ProgressHandler
  46. #ifndef SWIG
  47. : public Intern::AllocateFromAssimpHeap
  48. #endif
  49. {
  50. protected:
  51. /** @brief Default constructor */
  52. ProgressHandler () {
  53. }
  54. public:
  55. /** @brief Virtual destructor */
  56. virtual ~ProgressHandler () {
  57. }
  58. // -------------------------------------------------------------------
  59. /** @brief Progress callback.
  60. * @param percentage An estimate of the current loading progress,
  61. * in percent. Or -1.f if such an estimate is not available.
  62. *
  63. * There are restriction on what you may do from within your
  64. * implementation of this method: no exceptions may be thrown and no
  65. * non-const #Importer methods may be called. It is
  66. * not generally possible to predict the number of callbacks
  67. * fired during a single import.
  68. *
  69. * @return Return false to abort loading at the next possible
  70. * occasion (loaders and Assimp are generally allowed to perform
  71. * all needed cleanup tasks prior to returning control to the
  72. * caller). If the loading is aborted, #Importer::ReadFile()
  73. * returns always NULL.
  74. *
  75. * @note Currently, percentage is always -1.f because there is
  76. * no reliable way to compute it.
  77. * */
  78. virtual bool Update(float percentage = -1.f) = 0;
  79. }; // !class ProgressHandler
  80. // ------------------------------------------------------------------------------------
  81. } // Namespace Assimp
  82. #endif