PageRenderTime 624ms CodeModel.GetById 419ms app.highlight 8ms RepoModel.GetById 127ms app.codeStats 0ms

/indra/newview/llbreastmotion.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 154 lines | 59 code | 32 blank | 63 comment | 0 complexity | 27e35be669b582a0b7bc0131b9908929 MD5 | raw file
  1/** 
  2 * @file llbreastmotion.h
  3 * @brief Implementation of LLBreastMotion class.
  4 *
  5 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2011, 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_LLBREASTMOTION_H
 28#define LL_LLBREASTMOTION_H
 29
 30//-----------------------------------------------------------------------------
 31// Header files
 32//-----------------------------------------------------------------------------
 33#include "llmotion.h"
 34#include "llframetimer.h"
 35
 36#define BREAST_MOTION_FADEIN_TIME 1.0f
 37#define BREAST_MOTION_FADEOUT_TIME 1.0f
 38
 39class LLViewerVisualParam;
 40
 41//-----------------------------------------------------------------------------
 42// class LLBreastMotion
 43//-----------------------------------------------------------------------------
 44class LLBreastMotion :
 45	public LLMotion
 46{
 47public:
 48	// Constructor
 49	LLBreastMotion(const LLUUID &id);
 50
 51	// Destructor
 52	virtual ~LLBreastMotion();
 53
 54public:
 55	//-------------------------------------------------------------------------
 56	// functions to support MotionController and MotionRegistry
 57	//-------------------------------------------------------------------------
 58
 59	// static constructor
 60	// all subclasses must implement such a function and register it
 61	static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
 62
 63public:
 64	//-------------------------------------------------------------------------
 65	// animation callbacks to be implemented by subclasses
 66	//-------------------------------------------------------------------------
 67
 68	// motions must specify whether or not they loop
 69	virtual BOOL getLoop() { return TRUE; }
 70
 71	// motions must report their total duration
 72	virtual F32 getDuration() { return 0.0; }
 73
 74	// motions must report their "ease in" duration
 75	virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
 76
 77	// motions must report their "ease out" duration.
 78	virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
 79
 80	// called to determine when a motion should be activated/deactivated based on avatar pixel coverage
 81	virtual F32 getMinPixelArea();
 82
 83	// motions must report their priority
 84	virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
 85
 86	virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
 87
 88	// run-time (post constructor) initialization,
 89	// called after parameters have been set
 90	// must return true to indicate success and be available for activation
 91	virtual LLMotionInitStatus onInitialize(LLCharacter *character);
 92
 93	// called when a motion is activated
 94	// must return TRUE to indicate success, or else
 95	// it will be deactivated
 96	virtual BOOL onActivate();
 97
 98	// called per time step
 99	// must return TRUE while it is active, and
100	// must return FALSE when the motion is completed.
101	virtual BOOL onUpdate(F32 time, U8* joint_mask);
102
103	// called when a motion is deactivated
104	virtual void onDeactivate();
105
106protected:
107	LLVector3 toLocal(const LLVector3 &world_vector);
108	LLVector3 calculateVelocity_local(const F32 time_delta);
109	LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
110										  const F32 time_delta);
111	F32 calculateTimeDelta();
112private:
113	//-------------------------------------------------------------------------
114	// joint states to be animated
115	//-------------------------------------------------------------------------
116	LLPointer<LLJointState> mChestState;
117	LLCharacter*		mCharacter;
118
119
120	//-------------------------------------------------------------------------
121	// miscellaneous parameters
122	//-------------------------------------------------------------------------
123	LLViewerVisualParam *mBreastParamsUser[3];
124	LLViewerVisualParam *mBreastParamsDriven[3];
125	LLVector3           mBreastParamsMin;
126	LLVector3           mBreastParamsMax;
127
128	LLVector3           mCharLastPosition_world_pt; // Last position of the avatar
129	LLVector3			mCharLastVelocity_local_vec; // How fast the character is moving
130	LLVector3           mCharLastAcceleration_local_vec; // Change in character velocity
131
132	LLVector3           mBreastLastPosition_local_pt; // Last parameters for breast
133	LLVector3           mBreastVelocity_local_vec; // How fast the breast params are moving
134	LLVector3           mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent
135
136
137	F32 mBreastMassParam;
138	F32 mBreastGravityParam;
139	U32 mBreastSmoothingParam;
140
141	LLVector3 mBreastSpringParam;
142	LLVector3 mBreastDampingParam;
143	LLVector3 mBreastGainParam;
144	LLVector3 mBreastMaxVelocityParam;
145	LLVector3 mBreastDragParam;
146
147	LLFrameTimer	mTimer;
148	F32             mLastTime;
149	
150	U32            mFileTicks;
151};
152
153#endif // LL_LLBREASTMOTION_H
154