[692] | 1 | /*
|
---|
| 2 | -----------------------------------------------------------------------------
|
---|
| 3 | This source file is part of OGRE
|
---|
| 4 | (Object-oriented Graphics Rendering Engine)
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
| 23 | -----------------------------------------------------------------------------
|
---|
| 24 | */
|
---|
| 25 | #include "OgreStableHeaders.h"
|
---|
| 26 | #include "OgreAnimable.h"
|
---|
| 27 |
|
---|
| 28 | namespace Ogre {
|
---|
| 29 | //--------------------------------------------------------------------------
|
---|
| 30 | AnimableObject::AnimableDictionaryMap AnimableObject::msAnimableDictionary;
|
---|
| 31 | //--------------------------------------------------------------------------
|
---|
| 32 | void AnimableValue::resetToBaseValue(void)
|
---|
| 33 | {
|
---|
| 34 | switch(mType)
|
---|
| 35 | {
|
---|
| 36 | case INT:
|
---|
| 37 | setValue(mBaseValueInt);
|
---|
| 38 | break;
|
---|
| 39 | case REAL:
|
---|
| 40 | setValue(mBaseValueReal[0]);
|
---|
| 41 | break;
|
---|
| 42 | case VECTOR2:
|
---|
| 43 | setValue(Vector2(mBaseValueReal));
|
---|
| 44 | break;
|
---|
| 45 | case VECTOR3:
|
---|
| 46 | setValue(Vector3(mBaseValueReal));
|
---|
| 47 | break;
|
---|
| 48 | case VECTOR4:
|
---|
| 49 | setValue(Vector4(mBaseValueReal));
|
---|
| 50 | break;
|
---|
| 51 | case QUATERNION:
|
---|
| 52 | setValue(Quaternion(mBaseValueReal));
|
---|
| 53 | break;
|
---|
| 54 | case COLOUR:
|
---|
| 55 | setValue(ColourValue(mBaseValueReal[0], mBaseValueReal[1],
|
---|
| 56 | mBaseValueReal[2], mBaseValueReal[3]));
|
---|
| 57 | break;
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 | //--------------------------------------------------------------------------
|
---|
| 61 | void AnimableValue::setAsBaseValue(const Any& val)
|
---|
| 62 | {
|
---|
| 63 | switch(mType)
|
---|
| 64 | {
|
---|
| 65 | case INT:
|
---|
| 66 | setAsBaseValue(any_cast<int>(val));
|
---|
| 67 | break;
|
---|
| 68 | case REAL:
|
---|
| 69 | setAsBaseValue(any_cast<Real>(val));
|
---|
| 70 | break;
|
---|
| 71 | case VECTOR2:
|
---|
| 72 | setAsBaseValue(any_cast<Vector2>(val));
|
---|
| 73 | break;
|
---|
| 74 | case VECTOR3:
|
---|
| 75 | setAsBaseValue(any_cast<Vector3>(val));
|
---|
| 76 | break;
|
---|
| 77 | case VECTOR4:
|
---|
| 78 | setAsBaseValue(any_cast<Vector4>(val));
|
---|
| 79 | break;
|
---|
| 80 | case QUATERNION:
|
---|
| 81 | setAsBaseValue(any_cast<Quaternion>(val));
|
---|
| 82 | break;
|
---|
| 83 | case COLOUR:
|
---|
| 84 | setAsBaseValue(any_cast<ColourValue>(val));
|
---|
| 85 | break;
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 | //--------------------------------------------------------------------------
|
---|
| 89 | void AnimableValue::setValue(const Any& val)
|
---|
| 90 | {
|
---|
| 91 | switch(mType)
|
---|
| 92 | {
|
---|
| 93 | case INT:
|
---|
| 94 | setValue(any_cast<int>(val));
|
---|
| 95 | break;
|
---|
| 96 | case REAL:
|
---|
| 97 | setValue(any_cast<Real>(val));
|
---|
| 98 | break;
|
---|
| 99 | case VECTOR2:
|
---|
| 100 | setValue(any_cast<Vector2>(val));
|
---|
| 101 | break;
|
---|
| 102 | case VECTOR3:
|
---|
| 103 | setValue(any_cast<Vector3>(val));
|
---|
| 104 | break;
|
---|
| 105 | case VECTOR4:
|
---|
| 106 | setValue(any_cast<Vector4>(val));
|
---|
| 107 | break;
|
---|
| 108 | case QUATERNION:
|
---|
| 109 | setValue(any_cast<Quaternion>(val));
|
---|
| 110 | break;
|
---|
| 111 | case COLOUR:
|
---|
| 112 | setValue(any_cast<ColourValue>(val));
|
---|
| 113 | break;
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | //--------------------------------------------------------------------------
|
---|
| 117 | void AnimableValue::applyDeltaValue(const Any& val)
|
---|
| 118 | {
|
---|
| 119 | switch(mType)
|
---|
| 120 | {
|
---|
| 121 | case INT:
|
---|
| 122 | applyDeltaValue(any_cast<int>(val));
|
---|
| 123 | break;
|
---|
| 124 | case REAL:
|
---|
| 125 | applyDeltaValue(any_cast<Real>(val));
|
---|
| 126 | break;
|
---|
| 127 | case VECTOR2:
|
---|
| 128 | applyDeltaValue(any_cast<Vector2>(val));
|
---|
| 129 | break;
|
---|
| 130 | case VECTOR3:
|
---|
| 131 | applyDeltaValue(any_cast<Vector3>(val));
|
---|
| 132 | break;
|
---|
| 133 | case VECTOR4:
|
---|
| 134 | applyDeltaValue(any_cast<Vector4>(val));
|
---|
| 135 | break;
|
---|
| 136 | case QUATERNION:
|
---|
| 137 | applyDeltaValue(any_cast<Quaternion>(val));
|
---|
| 138 | break;
|
---|
| 139 | case COLOUR:
|
---|
| 140 | applyDeltaValue(any_cast<ColourValue>(val));
|
---|
| 141 | break;
|
---|
| 142 | }
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 | }
|
---|