Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/ogreceguirenderer/OgreCEGUITexture.h @ 6966

Last change on this file since 6966 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 5.4 KB
RevLine 
[1638]1/************************************************************************
[2602]2        filename:       OgreCEGUITexture.h
3        created:        11/5/2004
4        author:         Paul D Turner
5       
6        purpose:        Interface to Texture implemented via Ogre engine
[1638]7*************************************************************************/
8/*************************************************************************
9    Crazy Eddie's GUI System (http://www.cegui.org.uk)
10    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
11
12    This library is free software; you can redistribute it and/or
13    modify it under the terms of the GNU Lesser General Public
14    License as published by the Free Software Foundation; either
15    version 2.1 of the License, or (at your option) any later version.
16
17    This library is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20    Lesser General Public License for more details.
21
22    You should have received a copy of the GNU Lesser General Public
23    License along with this library; if not, write to the Free Software
24    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25*************************************************************************/
[2569]26#ifndef _OgreCEGUITexture_h_
27#define _OgreCEGUITexture_h_
[1638]28
29#include <CEGUIBase.h>
30#include <CEGUIRenderer.h>
31#include <CEGUITexture.h>
32#include "OgreCEGUIRenderer.h"
33
34// Start of CEGUI namespace section
35namespace CEGUI
36{
37/*!
38\brief
[2602]39        Texture class that is created by OgreCEGUIRenderer objects
[1638]40*/
41class _OgrePrivate OgreCEGUITexture : public Texture
42{
43private:
[2602]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);
[1638]51
52
[2602]53        /*************************************************************************
54                Construction & Destruction (by Renderer object only)
55        *************************************************************************/
56        OgreCEGUITexture(Renderer* owner);
57        virtual ~OgreCEGUITexture(void);
[1638]58
59public:
[2602]60        /*!
61        \brief
62                Returns the current pixel width of the texture
[1638]63
[2602]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;}
[1638]68
69
[2602]70        /*!
71        \brief
72                Returns the current pixel height of the texture
[1638]73
[2602]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;}
[1638]78
79
[2602]80        /*!
81        \brief
82                Loads the specified image file into the texture.  The texture is resized as required to hold the image.
[1638]83
[2602]84        \param filename
85                The filename of the image file that is to be loaded into the texture
[1638]86
[2602]87        \return
88                Nothing.
89        */
90        virtual void    loadFromFile(const String& filename, const String& resourceGroup);
[1638]91
92
[2602]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);
[1638]113
114
[2602]115        /*!
116        \brief
117                Return a pointer to the internal Ogre::Texture object
[1638]118
[2602]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;}
[1638]123
124
[2602]125        /*!
126        \brief
127                set the size of the internal Ogre texture.  Previous Ogre texture is lost.
[1638]128
[2602]129        \param size
130                pixel size of the new internal texture.  This will be rounded up to a power of 2.
[1638]131
[2602]132        \return
133                Nothing.
134        */
135        void    setOgreTextureSize(uint size);
[1638]136
137
[2602]138        /*!
139        \brief
140                Set the internal Ogre::TexturePtr object.
[1638]141
[2602]142        \param texture
143                Reference to an Ogre::TexturePtr object that is to be used by this Texture object.
[1638]144
[2602]145        \return
146                Nothing.
147        */
148        void    setOgreTexture(Ogre::TexturePtr& texture);
[1638]149
150
151private:
[2602]152        /*************************************************************************
153                Implementation Functions
154        *************************************************************************/
155        // safely free Ogre::Texture texture (can be called multiple times with no ill effect)
156        void    freeOgreTexture(void);
[1638]157
[2602]158        // return a Ogre::string that contains a unique name.
159        Ogre::String    getUniqueName(void);
[1638]160
161
[2602]162        /*************************************************************************
163                Implementation Data
164        *************************************************************************/
165        static  uint32          d_texturenumber;        //!< Counter used to provide unique texture names.
[1638]166
[2602]167        Ogre::TexturePtr                d_ogre_texture;         //!< The 'real' texture.
[1638]168
[2602]169        ushort                                  d_width;                        //!< cached width of the texture
170        ushort                                  d_height;                       //!< cached height of the texture
[1638]171
[2602]172        bool    d_isLinked;             //!< True if we are linked to a texture we did not actually create.
[1638]173};
174
175
176} // End of  CEGUI namespace section
177
178
[2569]179#endif  // end of guard _OgreCEGUITexture_h_
Note: See TracBrowser for help on using the repository browser.