PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llcharacter/llhandmotion.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 139 lines | 53 code | 26 blank | 60 comment | 0 complexity | b61a4b07675237f3c5512af39c92b2c8 MD5 | raw file
  1/** 
  2 * @file llhandmotion.h
  3 * @brief Implementation of LLHandMotion class.
  4 *
  5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLHANDMOTION_H
 28#define LL_LLHANDMOTION_H
 29
 30//-----------------------------------------------------------------------------
 31// Header files
 32//-----------------------------------------------------------------------------
 33#include "llmotion.h"
 34#include "lltimer.h"
 35
 36#define MIN_REQUIRED_PIXEL_AREA_HAND 10000.f;
 37
 38//-----------------------------------------------------------------------------
 39// class LLHandMotion
 40//-----------------------------------------------------------------------------
 41class LLHandMotion :
 42	public LLMotion
 43{
 44public:
 45	typedef enum e_hand_pose
 46	{
 47		HAND_POSE_SPREAD,
 48		HAND_POSE_RELAXED,
 49		HAND_POSE_POINT,
 50		HAND_POSE_FIST,
 51		HAND_POSE_RELAXED_L,
 52		HAND_POSE_POINT_L,
 53		HAND_POSE_FIST_L,
 54		HAND_POSE_RELAXED_R,
 55		HAND_POSE_POINT_R,
 56		HAND_POSE_FIST_R,
 57		HAND_POSE_SALUTE_R,
 58		HAND_POSE_TYPING,
 59		HAND_POSE_PEACE_R,
 60		HAND_POSE_PALM_R,
 61		NUM_HAND_POSES
 62	} eHandPose;
 63
 64	// Constructor
 65	LLHandMotion(const LLUUID &id);
 66
 67	// Destructor
 68	virtual ~LLHandMotion();
 69
 70public:
 71	//-------------------------------------------------------------------------
 72	// functions to support MotionController and MotionRegistry
 73	//-------------------------------------------------------------------------
 74
 75	// static constructor
 76	// all subclasses must implement such a function and register it
 77	static LLMotion *create(const LLUUID &id) { return new LLHandMotion(id); }
 78
 79public:
 80	//-------------------------------------------------------------------------
 81	// animation callbacks to be implemented by subclasses
 82	//-------------------------------------------------------------------------
 83
 84	// motions must specify whether or not they loop
 85	virtual BOOL getLoop() { return TRUE; }
 86
 87	// motions must report their total duration
 88	virtual F32 getDuration() { return 0.0; }
 89
 90	// motions must report their "ease in" duration
 91	virtual F32 getEaseInDuration() { return 0.0; }
 92
 93	// motions must report their "ease out" duration.
 94	virtual F32 getEaseOutDuration() { return 0.0; }
 95
 96	// called to determine when a motion should be activated/deactivated based on avatar pixel coverage
 97	virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_HAND; }
 98
 99	// motions must report their priority
100	virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
101
102	virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
103
104	// run-time (post constructor) initialization,
105	// called after parameters have been set
106	// must return true to indicate success and be available for activation
107	virtual LLMotionInitStatus onInitialize(LLCharacter *character);
108
109	// called when a motion is activated
110	// must return TRUE to indicate success, or else
111	// it will be deactivated 
112	virtual BOOL onActivate();
113
114	// called per time step
115	// must return TRUE while it is active, and
116	// must return FALSE when the motion is completed.
117	virtual BOOL onUpdate(F32 time, U8* joint_mask);
118
119	// called when a motion is deactivated
120	virtual void onDeactivate();
121
122	virtual BOOL canDeprecate() { return FALSE; }
123
124	static std::string getHandPoseName(eHandPose pose);
125	static eHandPose getHandPose(std::string posename);
126
127public:
128	//-------------------------------------------------------------------------
129	// joint states to be animated
130	//-------------------------------------------------------------------------
131
132	LLCharacter			*mCharacter;
133
134	F32					mLastTime;
135	eHandPose			mCurrentPose;
136	eHandPose			mNewPose;
137};
138#endif // LL_LLHANDMOTION_H
139