PageRenderTime 35ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llrender/llcubemap.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 86 lines | 46 code | 14 blank | 26 comment | 0 complexity | 637147fdc6969966e6867db3ebd1a443 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llcubemap.h
  3. * @brief LLCubeMap class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLCUBEMAP_H
  27. #define LL_LLCUBEMAP_H
  28. #include "llgl.h"
  29. #include <vector>
  30. class LLVector3;
  31. // Environment map hack!
  32. class LLCubeMap : public LLRefCount
  33. {
  34. public:
  35. LLCubeMap();
  36. void init(const std::vector<LLPointer<LLImageRaw> >& rawimages);
  37. void initGL();
  38. void initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages);
  39. void initGLData();
  40. void bind();
  41. void enable(S32 stage);
  42. void enableTexture(S32 stage);
  43. void enableTextureCoords(S32 stage);
  44. S32 getStage(void) { return mTextureStage; }
  45. void disable(void);
  46. void disableTexture(void);
  47. void disableTextureCoords(void);
  48. void setMatrix(S32 stage);
  49. void restoreMatrix();
  50. void setReflection (void);
  51. void finishPaint();
  52. GLuint getGLName();
  53. LLVector3 map(U8 side, U16 v_val, U16 h_val) const;
  54. BOOL project(F32& v_val, F32& h_val, BOOL& outside,
  55. U8 side, const LLVector3& dir) const;
  56. BOOL project(F32& v_min, F32& v_max, F32& h_min, F32& h_max,
  57. U8 side, LLVector3 dir[4]) const;
  58. void paintIn(LLVector3 dir[4], const LLColor4U& col);
  59. void destroyGL();
  60. public:
  61. static bool sUseCubeMaps;
  62. protected:
  63. friend class LLTexUnit;
  64. ~LLCubeMap();
  65. LLGLenum mTargets[6];
  66. LLPointer<LLImageGL> mImages[6];
  67. LLPointer<LLImageRaw> mRawImages[6];
  68. S32 mTextureStage;
  69. S32 mTextureCoordStage;
  70. S32 mMatrixStage;
  71. };
  72. #endif