summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp64
1 files changed, 47 insertions, 17 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index b6a2dac1e9..8178dade8b 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -113,6 +113,7 @@
#include "llskinningutil.h"
#include "llperfstats.h"
+#include "lleventapi.h"
#include <boost/lexical_cast.hpp>
@@ -5424,14 +5425,6 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
gGL.setSceneBlendType(LLRender::BT_ADD);
gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
- // gGL.begin(LLRender::QUADS);
- // gGL.vertex3fv((pos+left-up).mV);
- // gGL.vertex3fv((pos-left-up).mV);
- // gGL.vertex3fv((pos-left+up).mV);
- // gGL.vertex3fv((pos+left+up).mV);
- // gGL.end();
-
-
gGL.begin(LLRender::LINES);
gGL.color4f(1.f,1.f,1.f,1.f);
F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f);
@@ -5452,15 +5445,22 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
gGL.color4ubv(color.mV);
gGL.getTexUnit(diffuse_channel)->bind(&mImpostor);
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0,0);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.texCoord2f(1,0);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.texCoord2f(1,1);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.texCoord2f(0,1);
- gGL.vertex3fv((pos+left+up).mV);
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv((pos + left - up).mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv((pos - left - up).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((pos - left + up).mV);
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv((pos + left - up).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((pos - left + up).mV);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv((pos + left + up).mV);
+ }
gGL.end();
gGL.flush();
}
@@ -11818,3 +11818,33 @@ bool LLVOAvatar::isBuddy() const
return is_friend;
}
+class LLVOAvatarListener : public LLEventAPI
+{
+ public:
+ LLVOAvatarListener() : LLEventAPI("LLVOAvatar", "LLVOAvatar listener to retrieve avatar info")
+ {
+ add("getSpeed",
+ "Return the avatar movement speed in the XY plane",
+ &LLVOAvatarListener::getSpeed,
+ LLSD().with("reply", LLSD()));
+ add("isInAir",
+ "Return the info whether avatar is in the air, and if so the time in the air",
+ &LLVOAvatarListener::isInAir,
+ LLSD().with("reply", LLSD()));
+ }
+
+ private:
+ void getSpeed(const LLSD &request) const
+ {
+ LLVector3 avatar_velocity = gAgentAvatarp->getCharacterVelocity() * gAgentAvatarp->getTimeDilation();
+ avatar_velocity.mV[VZ] = 0.f;
+ Response response(llsd::map("value", avatar_velocity.magVec()), request);
+ }
+ void isInAir(const LLSD &request) const
+ {
+ Response response(llsd::map("value", gAgentAvatarp->mInAir,
+ "duration", gAgentAvatarp->mInAir ? gAgentAvatarp->mTimeInAir.getElapsedTimeF32() : 0), request);
+ }
+};
+
+static LLVOAvatarListener VOAvatarListener;