[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_LIGHT_H__ |
---|
| 25 | #define __COLLADA_LIGHT_H__ |
---|
| 26 | |
---|
| 27 | #include "OgreColladaPrerequisites.h" |
---|
| 28 | #include "OgreColladaEntity.h" |
---|
| 29 | |
---|
| 30 | #include "OgreColourValue.h" |
---|
| 31 | |
---|
| 32 | namespace Ogre |
---|
| 33 | { |
---|
| 34 | /** |
---|
| 35 | * light specific types |
---|
| 36 | */ |
---|
| 37 | namespace ColladaLightSpecific |
---|
| 38 | { |
---|
| 39 | enum Type |
---|
| 40 | { |
---|
| 41 | AMBIENT = 0, |
---|
| 42 | DIRECTIONAL, |
---|
| 43 | POINT, |
---|
| 44 | SPOT, |
---|
| 45 | |
---|
| 46 | UNKNOWN = -1 |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | enum Function |
---|
| 50 | { |
---|
| 51 | CONSTANT = 0, |
---|
| 52 | LINEAR, |
---|
| 53 | QUADRATIC |
---|
| 54 | }; |
---|
| 55 | |
---|
| 56 | /** |
---|
| 57 | * compare the string with collada syntax |
---|
| 58 | * |
---|
| 59 | * @param s the type string we've parsed |
---|
| 60 | * @return the corresponding light type |
---|
| 61 | */ |
---|
| 62 | Type getType(const String &s); |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * return the right function in case of given string |
---|
| 66 | * |
---|
| 67 | * @param s the function string |
---|
| 68 | * @return the corresponding function type |
---|
| 69 | */ |
---|
| 70 | Function getFunction(const String &s); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | class ColladaLight : public ColladaEntity |
---|
| 74 | { |
---|
| 75 | public: |
---|
| 76 | ColladaLight(ColladaDocument *d, xmlNode *n); |
---|
| 77 | virtual ~ColladaLight(void); |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | * create ogre light |
---|
| 81 | * |
---|
| 82 | * @see base class |
---|
| 83 | */ |
---|
| 84 | virtual MovableObject *getOgreInstance(void) const; |
---|
| 85 | |
---|
| 86 | /** |
---|
| 87 | * import <light> |
---|
| 88 | * |
---|
| 89 | * @param none |
---|
| 90 | * @return true if succeeds, false otherwise |
---|
| 91 | */ |
---|
| 92 | virtual bool doImport(void); |
---|
| 93 | |
---|
| 94 | virtual EntityTypes getEntityType(void) const { return LIGHT; } |
---|
| 95 | |
---|
| 96 | private: |
---|
| 97 | // for all light types |
---|
| 98 | ColladaLightSpecific::Type mType; |
---|
| 99 | ColourValue mColour; |
---|
| 100 | |
---|
| 101 | // point light specific |
---|
| 102 | float mAttenuationScale; |
---|
| 103 | ColladaLightSpecific::Function mAttenuation; |
---|
| 104 | |
---|
| 105 | // spot light specific |
---|
| 106 | float mAngle; |
---|
| 107 | float mFalloffScale; |
---|
| 108 | ColladaLightSpecific::Function mFalloff; |
---|
| 109 | }; |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | #endif // __COLLADA_LIGHT_H__ |
---|