aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llemote.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llemote.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llemote.cpp')
-rw-r--r--linden/indra/newview/llemote.cpp145
1 files changed, 145 insertions, 0 deletions
diff --git a/linden/indra/newview/llemote.cpp b/linden/indra/newview/llemote.cpp
new file mode 100644
index 0000000..28f56b5
--- /dev/null
+++ b/linden/indra/newview/llemote.cpp
@@ -0,0 +1,145 @@
1/**
2 * @file llemote.cpp
3 * @brief Implementation of LLEmote class
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28//-----------------------------------------------------------------------------
29// Header Files
30//-----------------------------------------------------------------------------
31#include "llviewerprecompiledheaders.h"
32
33#include "llemote.h"
34#include "llcharacter.h"
35#include "m3math.h"
36#include "llvoavatar.h"
37#include "llagent.h"
38
39//-----------------------------------------------------------------------------
40// Constants
41//-----------------------------------------------------------------------------
42
43//-----------------------------------------------------------------------------
44// LLEmote()
45// Class Constructor
46//-----------------------------------------------------------------------------
47LLEmote::LLEmote(const LLUUID &id) : LLMotion(id)
48{
49 mCharacter = NULL;
50
51 //RN: flag face joint as highest priority for now, until we implement a proper animation track
52 mJointSignature[0][LL_FACE_JOINT_NUM] = 0xff;
53 mJointSignature[1][LL_FACE_JOINT_NUM] = 0xff;
54 mJointSignature[2][LL_FACE_JOINT_NUM] = 0xff;
55}
56
57
58//-----------------------------------------------------------------------------
59// ~LLEmote()
60// Class Destructor
61//-----------------------------------------------------------------------------
62LLEmote::~LLEmote()
63{
64}
65
66//-----------------------------------------------------------------------------
67// LLEmote::onInitialize(LLCharacter *character)
68//-----------------------------------------------------------------------------
69LLMotion::LLMotionInitStatus LLEmote::onInitialize(LLCharacter *character)
70{
71 mCharacter = character;
72 return STATUS_SUCCESS;
73}
74
75
76//-----------------------------------------------------------------------------
77// LLEmote::onActivate()
78//-----------------------------------------------------------------------------
79BOOL LLEmote::onActivate()
80{
81 LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
82 if( default_param )
83 {
84 default_param->setWeight( default_param->getMaxWeight(), FALSE );
85 }
86
87 mParam = mCharacter->getVisualParam(mName.c_str());
88 if (mParam)
89 {
90 mParam->setWeight(0.f, FALSE);
91 mCharacter->updateVisualParams();
92 }
93
94 return TRUE;
95}
96
97
98//-----------------------------------------------------------------------------
99// LLEmote::onUpdate()
100//-----------------------------------------------------------------------------
101BOOL LLEmote::onUpdate(F32 time, U8* joint_mask)
102{
103 if( mParam )
104 {
105 F32 weight = mParam->getMinWeight() + mPose.getWeight() * (mParam->getMaxWeight() - mParam->getMinWeight());
106 mParam->setWeight(weight, FALSE);
107
108 // Cross fade against the default parameter
109 LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
110 if( default_param )
111 {
112 F32 default_param_weight = default_param->getMinWeight() +
113 (1.f - mPose.getWeight()) * ( default_param->getMaxWeight() - default_param->getMinWeight() );
114
115 default_param->setWeight( default_param_weight, FALSE );
116 }
117
118 mCharacter->updateVisualParams();
119 }
120
121 return TRUE;
122}
123
124
125//-----------------------------------------------------------------------------
126// LLEmote::onDeactivate()
127//-----------------------------------------------------------------------------
128void LLEmote::onDeactivate()
129{
130 if( mParam )
131 {
132 mParam->setWeight( mParam->getDefaultWeight(), FALSE );
133 }
134
135 LLVisualParam* default_param = mCharacter->getVisualParam( "Express_Closed_Mouth" );
136 if( default_param )
137 {
138 default_param->setWeight( default_param->getMaxWeight(), FALSE );
139 }
140
141 mCharacter->updateVisualParams();
142}
143
144
145// End