vrshoot

annotate libs/assimp/TargetAnimation.h @ 3:c179c72369be

rename candy->vr
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 03 Feb 2014 08:52:13 +0200
parents
children
rev   line source
nuclear@0 1 /*
nuclear@0 2 Open Asset Import Library (assimp)
nuclear@0 3 ----------------------------------------------------------------------
nuclear@0 4
nuclear@0 5 Copyright (c) 2006-2012, assimp team
nuclear@0 6 All rights reserved.
nuclear@0 7
nuclear@0 8 Redistribution and use of this software in source and binary forms,
nuclear@0 9 with or without modification, are permitted provided that the
nuclear@0 10 following conditions are met:
nuclear@0 11
nuclear@0 12 * Redistributions of source code must retain the above
nuclear@0 13 copyright notice, this list of conditions and the
nuclear@0 14 following disclaimer.
nuclear@0 15
nuclear@0 16 * Redistributions in binary form must reproduce the above
nuclear@0 17 copyright notice, this list of conditions and the
nuclear@0 18 following disclaimer in the documentation and/or other
nuclear@0 19 materials provided with the distribution.
nuclear@0 20
nuclear@0 21 * Neither the name of the assimp team, nor the names of its
nuclear@0 22 contributors may be used to endorse or promote products
nuclear@0 23 derived from this software without specific prior
nuclear@0 24 written permission of the assimp team.
nuclear@0 25
nuclear@0 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
nuclear@0 27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
nuclear@0 28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
nuclear@0 29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
nuclear@0 30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
nuclear@0 31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
nuclear@0 32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
nuclear@0 33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
nuclear@0 34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
nuclear@0 35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
nuclear@0 36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nuclear@0 37
nuclear@0 38 ----------------------------------------------------------------------
nuclear@0 39 */
nuclear@0 40
nuclear@0 41 /** @file Defines a helper class for the ASE and 3DS loaders to
nuclear@0 42 help them compute camera and spot light animation channels */
nuclear@0 43 #ifndef AI_TARGET_ANIMATION_H_INC
nuclear@0 44 #define AI_TARGET_ANIMATION_H_INC
nuclear@0 45
nuclear@0 46
nuclear@0 47 namespace Assimp {
nuclear@0 48
nuclear@0 49
nuclear@0 50
nuclear@0 51 // ---------------------------------------------------------------------------
nuclear@0 52 /** Helper class to iterate through all keys in an animation channel.
nuclear@0 53 *
nuclear@0 54 * Missing tracks are interpolated. This is a helper class for
nuclear@0 55 * TargetAnimationHelper, but it can be freely used for other purposes.
nuclear@0 56 */
nuclear@0 57 class KeyIterator
nuclear@0 58 {
nuclear@0 59 public:
nuclear@0 60
nuclear@0 61
nuclear@0 62 // ------------------------------------------------------------------
nuclear@0 63 /** Constructs a new key iterator
nuclear@0 64 *
nuclear@0 65 * @param _objPos Object position track. May be NULL.
nuclear@0 66 * @param _targetObjPos Target object position track. May be NULL.
nuclear@0 67 * @param defaultObjectPos Default object position to be used if
nuclear@0 68 * no animated track is available. May be NULL.
nuclear@0 69 * @param defaultTargetPos Default target position to be used if
nuclear@0 70 * no animated track is available. May be NULL.
nuclear@0 71 */
nuclear@0 72 KeyIterator(const std::vector<aiVectorKey>* _objPos,
nuclear@0 73 const std::vector<aiVectorKey>* _targetObjPos,
nuclear@0 74 const aiVector3D* defaultObjectPos = NULL,
nuclear@0 75 const aiVector3D* defaultTargetPos = NULL);
nuclear@0 76
nuclear@0 77 // ------------------------------------------------------------------
nuclear@0 78 /** Returns true if all keys have been processed
nuclear@0 79 */
nuclear@0 80 bool Finished() const
nuclear@0 81 {return reachedEnd;}
nuclear@0 82
nuclear@0 83 // ------------------------------------------------------------------
nuclear@0 84 /** Increment the iterator
nuclear@0 85 */
nuclear@0 86 void operator++();
nuclear@0 87 inline void operator++(int)
nuclear@0 88 {return ++(*this);}
nuclear@0 89
nuclear@0 90
nuclear@0 91
nuclear@0 92 // ------------------------------------------------------------------
nuclear@0 93 /** Getters to retrieve the current state of the iterator
nuclear@0 94 */
nuclear@0 95 inline const aiVector3D& GetCurPosition() const
nuclear@0 96 {return curPosition;}
nuclear@0 97
nuclear@0 98 inline const aiVector3D& GetCurTargetPosition() const
nuclear@0 99 {return curTargetPosition;}
nuclear@0 100
nuclear@0 101 inline double GetCurTime() const
nuclear@0 102 {return curTime;}
nuclear@0 103
nuclear@0 104 private:
nuclear@0 105
nuclear@0 106 //! Did we reach the end?
nuclear@0 107 bool reachedEnd;
nuclear@0 108
nuclear@0 109 //! Represents the current position of the iterator
nuclear@0 110 aiVector3D curPosition, curTargetPosition;
nuclear@0 111
nuclear@0 112 double curTime;
nuclear@0 113
nuclear@0 114 //! Input tracks and the next key to process
nuclear@0 115 const std::vector<aiVectorKey>* objPos,*targetObjPos;
nuclear@0 116
nuclear@0 117 unsigned int nextObjPos, nextTargetObjPos;
nuclear@0 118 std::vector<aiVectorKey> defaultObjPos,defaultTargetObjPos;
nuclear@0 119 };
nuclear@0 120
nuclear@0 121 // ---------------------------------------------------------------------------
nuclear@0 122 /** Helper class for the 3DS and ASE loaders to compute camera and spot light
nuclear@0 123 * animations.
nuclear@0 124 *
nuclear@0 125 * 3DS and ASE store the differently to Assimp - there is an animation
nuclear@0 126 * channel for the camera/spot light itself and a separate position
nuclear@0 127 * animation channels specifying the position of the camera/spot light
nuclear@0 128 * look-at target */
nuclear@0 129 class TargetAnimationHelper
nuclear@0 130 {
nuclear@0 131 public:
nuclear@0 132
nuclear@0 133 TargetAnimationHelper()
nuclear@0 134 : targetPositions (NULL)
nuclear@0 135 , objectPositions (NULL)
nuclear@0 136 {}
nuclear@0 137
nuclear@0 138
nuclear@0 139 // ------------------------------------------------------------------
nuclear@0 140 /** Sets the target animation channel
nuclear@0 141 *
nuclear@0 142 * This channel specifies the position of the camera/spot light
nuclear@0 143 * target at a specific position.
nuclear@0 144 *
nuclear@0 145 * @param targetPositions Translation channel*/
nuclear@0 146 void SetTargetAnimationChannel (const
nuclear@0 147 std::vector<aiVectorKey>* targetPositions);
nuclear@0 148
nuclear@0 149
nuclear@0 150 // ------------------------------------------------------------------
nuclear@0 151 /** Sets the main animation channel
nuclear@0 152 *
nuclear@0 153 * @param objectPositions Translation channel */
nuclear@0 154 void SetMainAnimationChannel ( const
nuclear@0 155 std::vector<aiVectorKey>* objectPositions);
nuclear@0 156
nuclear@0 157 // ------------------------------------------------------------------
nuclear@0 158 /** Sets the main animation channel to a fixed value
nuclear@0 159 *
nuclear@0 160 * @param fixed Fixed value for the main animation channel*/
nuclear@0 161 void SetFixedMainAnimationChannel(const aiVector3D& fixed);
nuclear@0 162
nuclear@0 163
nuclear@0 164 // ------------------------------------------------------------------
nuclear@0 165 /** Computes final animation channels
nuclear@0 166 * @param distanceTrack Receive camera translation keys ... != NULL. */
nuclear@0 167 void Process( std::vector<aiVectorKey>* distanceTrack );
nuclear@0 168
nuclear@0 169
nuclear@0 170 private:
nuclear@0 171
nuclear@0 172 const std::vector<aiVectorKey>* targetPositions,*objectPositions;
nuclear@0 173 aiVector3D fixedMain;
nuclear@0 174 };
nuclear@0 175
nuclear@0 176
nuclear@0 177 } // ! end namespace Assimp
nuclear@0 178
nuclear@0 179 #endif // include guard