| [21] | 1 | /** |
|---|
| 2 | * This source file is part of OgreColladaPlugin |
|---|
| 3 | * an addon for OGRE (Object-oriented Graphics Rendering Engine) |
|---|
| 4 | * For the latest info, see http://www.ogre3d.org/ |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify it under |
|---|
| 7 | * the terms of the GNU Lesser General Public License as published by the Free Software |
|---|
| 8 | * Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 9 | * version. |
|---|
| 10 | |
|---|
| 11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | * You should have received a copy of the GNU Lesser General Public License along with |
|---|
| 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 17 | * Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
|---|
| 18 | * http://www.gnu.org/copyleft/lesser.txt. |
|---|
| 19 | * |
|---|
| 20 | * @author Philipp Hartl |
|---|
| 21 | * @see README |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | #ifndef __COLLADA_TEXTURE_H__ |
|---|
| 25 | #define __COLLADA_TEXTURE_H__ |
|---|
| 26 | |
|---|
| 27 | #include "OgreColladaPrerequisites.h" |
|---|
| 28 | #include "OgreColladaEntity.h" |
|---|
| 29 | |
|---|
| 30 | namespace Ogre |
|---|
| 31 | { |
|---|
| 32 | /** |
|---|
| 33 | * a <image> object |
|---|
| 34 | * currently no raw data is supported |
|---|
| 35 | */ |
|---|
| 36 | class ColladaImage : public ColladaEntity |
|---|
| 37 | { |
|---|
| 38 | public: |
|---|
| 39 | ColladaImage(ColladaDocument *d, xmlNode *n); |
|---|
| 40 | virtual ~ColladaImage(void); |
|---|
| 41 | |
|---|
| 42 | /** |
|---|
| 43 | * import <image> node |
|---|
| 44 | * |
|---|
| 45 | * @see base class |
|---|
| 46 | */ |
|---|
| 47 | virtual bool doImport(void); |
|---|
| 48 | |
|---|
| 49 | virtual EntityTypes getEntityType(void) const { return IMAGE; } |
|---|
| 50 | virtual MovableObject *getOgreInstance(void) const { return NULL; } |
|---|
| 51 | const String &getSource(void) const { return mSource; } |
|---|
| 52 | const String &getFormat(void) const { return mFormat; } |
|---|
| 53 | const uint &getHeight(void) const { return mHeight; } |
|---|
| 54 | const uint &getWidth(void) const { return mWidth; } |
|---|
| 55 | const uint &getDepth(void) const { return mDepth; } |
|---|
| 56 | |
|---|
| 57 | private: |
|---|
| 58 | String mSource; // the filename (URL) |
|---|
| 59 | String mFormat; // image format |
|---|
| 60 | |
|---|
| 61 | uint mHeight; // image height in pixel units |
|---|
| 62 | uint mWidth; // image width in pixel units |
|---|
| 63 | uint mDepth; // image depth in pixel units, default is 1 (2D) |
|---|
| 64 | }; |
|---|
| 65 | |
|---|
| 66 | /** |
|---|
| 67 | * <param name="..."> texture types |
|---|
| 68 | */ |
|---|
| 69 | namespace ColladaTextureSpecific |
|---|
| 70 | { |
|---|
| 71 | enum Type |
|---|
| 72 | { |
|---|
| 73 | AMBIENT = 0, |
|---|
| 74 | DIFFUSE, |
|---|
| 75 | EMISSION, |
|---|
| 76 | SHININESS, |
|---|
| 77 | SPECULAR, |
|---|
| 78 | |
|---|
| 79 | UNKNOWN = -1 |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | /** |
|---|
| 83 | * compare the string with collada syntax |
|---|
| 84 | * |
|---|
| 85 | * @param s the semantic string we have |
|---|
| 86 | * @return the corresponding texture type |
|---|
| 87 | */ |
|---|
| 88 | Type getType(const String &s); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | /** |
|---|
| 92 | * a <texture> object |
|---|
| 93 | */ |
|---|
| 94 | class ColladaTexture : public ColladaEntity |
|---|
| 95 | { |
|---|
| 96 | public: |
|---|
| 97 | ColladaTexture(ColladaDocument *d, xmlNode *n); |
|---|
| 98 | virtual ~ColladaTexture(void); |
|---|
| 99 | |
|---|
| 100 | /** |
|---|
| 101 | * import <texture> node |
|---|
| 102 | * |
|---|
| 103 | * @see base class |
|---|
| 104 | */ |
|---|
| 105 | virtual bool doImport(void); |
|---|
| 106 | |
|---|
| 107 | virtual EntityTypes getEntityType(void) const { return TEXTURE; } |
|---|
| 108 | ColladaImage *getImage(void) const { return mImage; } |
|---|
| 109 | virtual MovableObject *getOgreInstance(void) const { return NULL; } |
|---|
| 110 | // ColladaTextureSpecific::Type getType(void) const { return mType; } |
|---|
| 111 | |
|---|
| 112 | private: |
|---|
| 113 | ColladaImage *mImage; // the image this texture holds |
|---|
| 114 | ColladaTextureSpecific::Type mType; // the texture type |
|---|
| 115 | }; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | #endif // __COLLADA_TEXTURE_H__ |
|---|