llgltfscenemanager.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * @file llgltfscenemanager.h
  3. * @brief LLGLTFSceneManager class declaration.
  4. *
  5. * $LicenseInfo:firstyear=2024&license=viewergpl$
  6. *
  7. * Copyright (c) 2024, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLLGLTFSCENEMANAGER_H
  33. #define LL_LLLGLTFSCENEMANAGER_H
  34. #include "hbfastset.h"
  35. #include "llgltfasset.h"
  36. #include "llpointer.h"
  37. class LLDrawable;
  38. class LLVector2;
  39. class LLVector4a;
  40. class LLViewerObject;
  41. class LLVOVolume;
  42. // Purely static class (instead of a LLSimpleton in LL's code). HB
  43. class LLGLTFSceneManager
  44. {
  45. protected:
  46. LOG_CLASS(LLGLTFSceneManager);
  47. public:
  48. LLGLTFSceneManager() = delete;
  49. ~LLGLTFSceneManager() = delete;
  50. // Called before clearing objects list on viewer shutdown. HB
  51. static void cleanup();
  52. // Returns an empty string on success, or the reason for a failure. HB
  53. static std::string load(const std::string& filename,
  54. const LLUUID& handle_obj_id);
  55. static bool lineSegmentIntersect(LLVOVolume* volp, LLGLTF::Asset* assetp,
  56. const LLVector4a& start,
  57. const LLVector4a& end, S32 face,
  58. bool pick_transparent, bool pick_rigged,
  59. S32* node_hitp, S32* prim_hitp,
  60. LLVector4a* interp,LLVector2* tcoordp,
  61. LLVector4a* normp, LLVector4a* tgtp);
  62. static LLDrawable* lineSegmentIntersect(const LLVector4a& start,
  63. const LLVector4a& end,
  64. bool pick_transparent,
  65. bool pick_rigged, S32* node_hitp,
  66. S32* prim_hitp, LLVector4a* interp,
  67. LLVector2* tcoordp,
  68. LLVector4a* normp,
  69. LLVector4a* tgtp);
  70. static void update();
  71. static void render(bool opaque, bool rigged = false);
  72. LL_INLINE static void renderOpaque(bool rigged = false)
  73. {
  74. render(true, rigged);
  75. }
  76. LL_INLINE static void renderAlpha(bool rigged = false)
  77. {
  78. render(false, rigged);
  79. }
  80. static void renderDebug();
  81. public:
  82. typedef fast_hset<LLPointer<LLViewerObject> > objects_set_t;
  83. static objects_set_t sObjects;
  84. };
  85. #endif // LL_LLLGLTFSCENEMANAGER_H