- Timestamp:
- Jan 29, 2009, 7:12:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2/src/ogreceguirenderer/OgreCEGUITexture.h
r2569 r2602 1 1 /************************************************************************ 2 3 4 5 6 2 filename: OgreCEGUITexture.h 3 created: 11/5/2004 4 author: Paul D Turner 5 6 purpose: Interface to Texture implemented via Ogre engine 7 7 *************************************************************************/ 8 8 /************************************************************************* … … 37 37 /*! 38 38 \brief 39 39 Texture class that is created by OgreCEGUIRenderer objects 40 40 */ 41 41 class _OgrePrivate OgreCEGUITexture : public Texture 42 42 { 43 43 private: 44 45 46 47 48 49 50 44 /************************************************************************* 45 Friends (to allow construction and destruction) 46 *************************************************************************/ 47 friend Texture* OgreCEGUIRenderer::createTexture(void); 48 friend Texture* OgreCEGUIRenderer::createTexture(const String& filename, const String& resourceGroup); 49 friend Texture* OgreCEGUIRenderer::createTexture(float size); 50 friend void OgreCEGUIRenderer::destroyTexture(Texture* texture); 51 51 52 52 53 54 55 56 57 53 /************************************************************************* 54 Construction & Destruction (by Renderer object only) 55 *************************************************************************/ 56 OgreCEGUITexture(Renderer* owner); 57 virtual ~OgreCEGUITexture(void); 58 58 59 59 public: 60 61 62 60 /*! 61 \brief 62 Returns the current pixel width of the texture 63 63 64 65 66 67 64 \return 65 ushort value that is the current width of the texture in pixels 66 */ 67 virtual ushort getWidth(void) const {return d_width;} 68 68 69 69 70 71 72 70 /*! 71 \brief 72 Returns the current pixel height of the texture 73 73 74 75 76 77 74 \return 75 ushort value that is the current height of the texture in pixels 76 */ 77 virtual ushort getHeight(void) const {return d_height;} 78 78 79 79 80 81 82 80 /*! 81 \brief 82 Loads the specified image file into the texture. The texture is resized as required to hold the image. 83 83 84 85 84 \param filename 85 The filename of the image file that is to be loaded into the texture 86 86 87 88 89 90 87 \return 88 Nothing. 89 */ 90 virtual void loadFromFile(const String& filename, const String& resourceGroup); 91 91 92 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 93 /*! 94 \brief 95 Loads (copies) an image in memory into the texture. The texture is resized as required to hold the image. 96 97 \param buffPtr 98 Pointer to the buffer containing the image data 99 100 \param buffWidth 101 Width of the buffer (in pixels as specified by \a pixelFormat ) 102 103 \param buffHeight 104 Height of the buffer (in pixels as specified by \a pixelFormat ) 105 106 \param pixelFormat 107 PixelFormat value describing the format contained in \a buffPtr 108 109 \return 110 Nothing. 111 */ 112 virtual void loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat); 113 113 114 114 115 116 117 115 /*! 116 \brief 117 Return a pointer to the internal Ogre::Texture object 118 118 119 120 121 122 119 \return 120 Pointer to the Ogre::Texture object currently being used by this Texture object 121 */ 122 Ogre::TexturePtr getOgreTexture(void) const {return d_ogre_texture;} 123 123 124 124 125 126 127 125 /*! 126 \brief 127 set the size of the internal Ogre texture. Previous Ogre texture is lost. 128 128 129 130 129 \param size 130 pixel size of the new internal texture. This will be rounded up to a power of 2. 131 131 132 133 134 135 132 \return 133 Nothing. 134 */ 135 void setOgreTextureSize(uint size); 136 136 137 137 138 139 140 138 /*! 139 \brief 140 Set the internal Ogre::TexturePtr object. 141 141 142 143 142 \param texture 143 Reference to an Ogre::TexturePtr object that is to be used by this Texture object. 144 144 145 146 147 148 145 \return 146 Nothing. 147 */ 148 void setOgreTexture(Ogre::TexturePtr& texture); 149 149 150 150 151 151 private: 152 153 154 155 156 152 /************************************************************************* 153 Implementation Functions 154 *************************************************************************/ 155 // safely free Ogre::Texture texture (can be called multiple times with no ill effect) 156 void freeOgreTexture(void); 157 157 158 159 158 // return a Ogre::string that contains a unique name. 159 Ogre::String getUniqueName(void); 160 160 161 161 162 163 164 165 162 /************************************************************************* 163 Implementation Data 164 *************************************************************************/ 165 static uint32 d_texturenumber; //!< Counter used to provide unique texture names. 166 166 167 167 Ogre::TexturePtr d_ogre_texture; //!< The 'real' texture. 168 168 169 170 169 ushort d_width; //!< cached width of the texture 170 ushort d_height; //!< cached height of the texture 171 171 172 172 bool d_isLinked; //!< True if we are linked to a texture we did not actually create. 173 173 }; 174 174
Note: See TracChangeset
for help on using the changeset viewer.