Anonymous avatar Anonymous committed bd1d1d0 Draft

Code cleanup and comments added

Comments (0)

Files changed (2)

indra/newview/llleapmotioncontroller.cpp

  */
 
 /* 
-	This is experimental code the connects the LeapMotion gesture controller (www.leapmotion.com) 
+	This is experimental code the connects the Leap Motion gesture controller (www.leapmotion.com) 
 	to the Second Life viewer.   
 	
-	To set up your source repo to compile, you need the LeapMotion SDK from www.leapmotion.com.
+	To set up your source repo to compile, you need the Leap Motion SDK from www.leapmotion.com.
 	Linden Lab does not provide this code.
 
-	*	The LeapMotion SDK should be copied to the same folder as the root of the 
+	*	The Leap Motion SDK should be copied to the same folder as the root of the 
 		Second Life viewer source code, otherwise the #include line below will fail.
 
-	*	Copy Leap.lib from the SDK into the build-vc100\packages\lib\release directory, otherwise you 
-		will get linker errors with missing Leapmotion symbols.
+	*	Copy Leap.lib from Leap_SDK\lib\x86 into the build-vc100\packages\lib\release directory, otherwise you 
+		will get linker errors not finding leap.lib.
 	
-	*   Copy Leap.dll from the SDK into the build-vc100\newview\RelWithDebInfo directory, otherwise 
+	*   Copy Leap.dll from Leap_SDK\lib\x86 into the build-vc100\newview\RelWithDebInfo directory, otherwise 
 		secondlife-bin.exe will not run
 
 	This code uses the value of "LeapmotionTestMode" from \indra\newview\app_settings to determine how
 	it functions.   You can change this under the Advanced menu, Show Debug Settings.  Enter or find 
-	"LeapMotionTest" mode in the Debug Settings and change the value as appropriate.
+	"LeapmotionTestMode" mode in the Debug Settings and change the value as appropriate.
 	
 	With this experimental code, "LeapmotionTestMode" can be set to operate as follows:
 
 	
 	See the LLLMImpl::stepFrame() function below to follow the logic.
 
+	For future work, check out LLJoystick* classes and how those devices work with Second Life.
 */
 
 
 }
 
 
-// Callback from Leapmotion code when a new frame is available
+// Callback from Leapmotion code when a new frame is available.  It simply
+// sets a flag so stepFrame() can pick up new controller data
 void LLLMImpl::onFrame(const Leap::Controller& controller) 
 {
 	if (mLMConnected)
 }
 
 
-
+// This is called every SL viewer frame
 void LLLMImpl::stepFrame()
 {
 	if (mLMController &&
-		mFrameAvailable)
+		mFrameAvailable &&
+		mLMConnected)
 	{
 		mFrameAvailable = false;
 
 	}
 }
 
-
+// This controller mode is used to fly the avatar, going up, down, forward and turning.
 void LLLMImpl::modeFlyingControlTest(Leap::HandList & hands)
 {
 	static S32 sLMFlyingHysteresis = 0;
 }
 
 
-
+// This experimental mode sends chat messages into SL on a back channel for LSL scripts
+// to intercept with a listen() event.   This is experimental and not sustainable for
+// a production feature ... many avatars using this would flood the chat system and
+// hurt server performance.   Depending on how useful this proves to be, a better
+// mechanism should be designed to stream data from the viewer into SL scripts.
 void LLLMImpl::modeStreamDataToSL(Leap::HandList & hands)
 {
 	S32 numHands = hands.count();
 	if (numHands == 1 &&
 		mChatMsgTimer.checkExpirationAndReset(LLLEAP_CHAT_MSG_INTERVAL))
 	{
-		// Get the first hand
+		// Get the first (and only) hand
 		Leap::Hand hand = hands[0];
 
 		Leap::Vector palm_pos = hand.palmPosition();
 	}
 }
 
+// This mode tries to detect simple hand motion and either triggers an avatar gesture or 
+// sends a chat message into SL in response.   It is very rough, hard-coded for detecting 
+// a hand wave (a SL gesture) or the wiggling-thumb gun trigger (a chat message sent to a
+// special version of the popgun).
 void LLLMImpl::modeGestureDetection1(Leap::HandList & hands)
 {
 	static S32 trigger_direction = -1;
 		static S32 last_num_fingers = 0;
 
 		if (num_fingers == 1)
-		{
+		{	// One finger ... possibly reset the 
 			Leap::Finger finger = finger_list[0];
 			Leap::Vector finger_dir = finger.direction();
 
 	}
 }
 
+
+// This mode tries to move the avatar and camera in Second Life.   It's pretty rough and needs a lot of work
 void LLLMImpl::modeMoveAndCamTest1(Leap::HandList & hands)
 {
 	S32 numHands = hands.count();		
 }
 
 
-
+// This controller mode just dumps out a bunch of the Leap Motion device data, which can then be
+// analyzed for other use.
 void LLLMImpl::modeDumpDebugInfo(Leap::HandList & hands)
 {
 	S32 numHands = hands.count();		
 }
 
 
+// --------------------------------------------------------------------------------
+// The LLLeapMotionController class is a thin public glue layer into the LLLMImpl
+// class, which does all the interesting work.
+
+// One controller instance to rule them all
 LLLeapMotionController::LLLeapMotionController()
 {
 	mController = new LLLMImpl();
 		mController->stepFrame();
 	}
 }
-
-
-
-
-/*
-Hand debugging 
-			if (num_fingers >= 1) 
-			{	// Calculate the hand's average finger tip position
-				Leap::Vector pos(0, 0, 0);
-				Leap::Vector direction(0, 0, 0);
-				for (size_t i = 0; i < num_fingers; ++i) 
-				{
-					const Leap::Finger& finger = finger_list[i];
-					const Leap::Ray& tip = finger.tip();
-					pos.x += tip.position.x;
-					pos.y += tip.position.y;
-					pos.z += tip.position.z;
-					direction.x += tip.direction.x;
-					direction.y += tip.direction.y;
-					direction.z += tip.direction.z;
-				}
-				pos = Leap::Vector(pos.x/num_fingers, pos.y/num_fingers, pos.z/num_fingers);
-				direction = Leap::Vector(direction.x/num_fingers, direction.y/num_fingers, direction.z/num_fingers);
-
-				llinfos << "Hand has " << num_fingers << " fingers with average tip position"
-					<< " (" << pos.x << ", " << pos.y << ", " << pos.z << ")" 
-					<< " direction (" << direction.x << ", " << direction.y << ", " << direction.z << ")" 
-					<< llendl;
-
-			}
-
-			const  Leap::Ray * palm_ray = hand.palm();
-			const  Leap::Vector * palm_normal = hand.normal();
-			if (palm_ray && palm_normal)
-			{
-				llinfos << "Palm pos " << palm_pos.x
-					<< ", " <<  palm_pos.y
-					<< ", " <<  palm_pos.z
-					<< ".   Direction: " << palm_ray->direction.x
-					<< ", " << palm_ray->direction.y
-					<< ", " << palm_ray->direction.z
-					<< ".   Normal: " << palm_normal.x
-					<< ", " << palm_normal.y
-					<< ", " << palm_normal.z
-					<< llendl;
-			}
-
-*/
-
-
-/* first control code
-		F32 orbit_rate = 0.f;
-
-				if (num_fingers == 1)
-				{	// 1 finger - move avatar
-					if (pos.x < -LM_DEAD_ZONE)
-					{	// Move left
-						gAgent.moveLeft(1.f);
-					}
-					else if (pos.x > LM_DEAD_ZONE)
-					{
-						gAgent.moveLeft(-1.f);
-					}
-					if (pos.z < -LM_DEAD_ZONE)
-					{
-						gAgent.moveAt(1.f);
-					}
-					else if (pos.z > LM_DEAD_ZONE)
-					{	
-						gAgent.moveAt(-1.f);
-					}
-
-					if (pos.y < -LM_DEAD_ZONE)
-					{
-						gAgent.moveUp(1.f);
-					}
-					else if (pos.y > LM_DEAD_ZONE)
-					{
-						gAgent.moveUp(1.f);
-					}
-				}	// end 1 finger
-				else if (num_fingers == 2)
-				{	// 2 fingers - move camera around
-					// X values run from about -170 to +170
-					if (pos.x < -LM_DEAD_ZONE)
-					{	// Camera rotate left
-						gAgentCamera.unlockView();
-						orbit_rate = (llabs(pos.x) - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitLeftKey(orbit_rate);
-					}
-					else if (pos.x > LM_DEAD_ZONE)
-					{
-						gAgentCamera.unlockView();
-						orbit_rate = (pos.x - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitRightKey(orbit_rate);
-					}
-					if (pos.z < -LM_DEAD_ZONE)
-					{	// Camera zoom in
-						gAgentCamera.unlockView();
-						orbit_rate = (llabs(pos.z) - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitInKey(orbit_rate);
-					}
-					else if (pos.z > LM_DEAD_ZONE)
-					{	// Camera zoom out
-						gAgentCamera.unlockView();
-						orbit_rate = (pos.z - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitOutKey(orbit_rate);
-					}
-
-					if (pos.y < -LM_DEAD_ZONE)
-					{	// Camera zoom in
-						gAgentCamera.unlockView();
-						orbit_rate = (llabs(pos.y) - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitUpKey(orbit_rate);
-					}
-					else if (pos.y > LM_DEAD_ZONE)
-					{	// Camera zoom out
-						gAgentCamera.unlockView();
-						orbit_rate = (pos.y - LM_DEAD_ZONE) / LM_ORBIT_RATE_FACTOR;
-						gAgentCamera.setOrbitDownKey(orbit_rate);
-					}
-				}	// end 2 finger
-				*/
-
-/*
-// Library includes
-#include "llcoord.h"
-#include "indra_constants.h"
-#include "llrender.h"
-
-// Project includes
-#include "llui.h"
-#include "llagent.h"
-#include "llagentcamera.h"
-#include "llviewertexture.h"
-#include "llviewertexturelist.h"
-#include "llviewerwindow.h"
-#include "llmoveview.h"
-
-#include "llglheaders.h"
-
-static LLDefaultChildRegistry::Register<LLJoystickAgentSlide> r1("joystick_slide");
-static LLDefaultChildRegistry::Register<LLJoystickAgentTurn> r2("joystick_turn");
-static LLDefaultChildRegistry::Register<LLJoystickCameraRotate> r3("joystick_rotate");
-static LLDefaultChildRegistry::Register<LLJoystickCameraTrack> r5("joystick_track");
-
-
-
-const F32 NUDGE_TIME = 0.25f;		// in seconds
-const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed
-
-//
-// Public Methods
-//
-void QuadrantNames::declareValues()
-{
-	declare("origin", JQ_ORIGIN);
-	declare("up", JQ_UP);
-	declare("down", JQ_DOWN);
-	declare("left", JQ_LEFT);
-	declare("right", JQ_RIGHT);
-}
-
-
-LLJoystick::LLJoystick(const LLJoystick::Params& p)
-:	LLButton(p),
-	mInitialOffset(0, 0),
-	mLastMouse(0, 0),
-	mFirstMouse(0, 0),
-	mVertSlopNear(0),
-	mVertSlopFar(0),
-	mHorizSlopNear(0),
-	mHorizSlopFar(0),
-	mHeldDown(FALSE),
-	mHeldDownTimer(),
-	mInitialQuadrant(p.quadrant)
-{
-	setHeldDownCallback(&LLJoystick::onBtnHeldDown, this);
-}
-
-
-void LLJoystick::updateSlop()
-{
-	mVertSlopNear = getRect().getHeight();
-	mVertSlopFar = getRect().getHeight() * 2;
-
-	mHorizSlopNear = getRect().getWidth();
-	mHorizSlopFar = getRect().getWidth() * 2;
-
-	// Compute initial mouse offset based on initial quadrant.
-	// Place the mouse evenly between the near and far zones.
-	switch (mInitialQuadrant)
-	{
-	case JQ_ORIGIN:
-		mInitialOffset.set(0, 0);
-		break;
-
-	case JQ_UP:
-		mInitialOffset.mX = 0;
-		mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
-		break;
-
-	case JQ_DOWN:
-		mInitialOffset.mX = 0;
-		mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
-		break;
-
-	case JQ_LEFT:
-		mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
-		mInitialOffset.mY = 0;
-		break;
-
-	case JQ_RIGHT:
-		mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
-		mInitialOffset.mY = 0;
-		break;
-
-	default:
-		llerrs << "LLJoystick::LLJoystick() - bad switch case" << llendl;
-		break;
-	}
-
-	return;
-}
-
-bool LLJoystick::pointInCircle(S32 x, S32 y) const 
-{ 
-	if(this->getLocalRect().getHeight() != this->getLocalRect().getWidth())
-	{
-		llwarns << "Joystick shape is not square"<<llendl;
-		return true;
-	}
-	//center is x and y coordinates of center of joystick circle, and also its radius
-	int center = this->getLocalRect().getHeight()/2;
-	bool in_circle = (x - center) * (x - center) + (y - center) * (y - center) <= center * center;
-	return in_circle;
-}
-
-BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask)
-{
-	//llinfos << "joystick mouse down " << x << ", " << y << llendl;
-	bool handles = false;
-
-	if(pointInCircle(x, y))
-	{
-		mLastMouse.set(x, y);
-		mFirstMouse.set(x, y);
-		mMouseDownTimer.reset();
-		handles = LLButton::handleMouseDown(x, y, mask);
-	}
-
-	return handles;
-}
-
-
-BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask)
-{
-	// llinfos << "joystick mouse up " << x << ", " << y << llendl;
-
-	if( hasMouseCapture() )
-	{
-		mLastMouse.set(x, y);
-		mHeldDown = FALSE;
-		onMouseUp();
-	}
-
-	return LLButton::handleMouseUp(x, y, mask);
-}
-
-
-BOOL LLJoystick::handleHover(S32 x, S32 y, MASK mask)
-{
-	if( hasMouseCapture() )
-	{
-		mLastMouse.set(x, y);
-	}
-
-	return LLButton::handleHover(x, y, mask);
-}
-
-F32 LLJoystick::getElapsedHeldDownTime()
-{
-	if( mHeldDown )
-	{
-		return getHeldDownTime();
-	}
-	else
-	{
-		return 0.f;
-	}
-}
-
-// static
-void LLJoystick::onBtnHeldDown(void *userdata)
-{
-	LLJoystick *self = (LLJoystick *)userdata;
-	if (self)
-	{
-		self->mHeldDown = TRUE;
-		self->onHeldDown();
-	}
-}
-
-EJoystickQuadrant LLJoystick::selectQuadrant(LLXMLNodePtr node)
-{
-	
-	EJoystickQuadrant quadrant = JQ_RIGHT;
-
-	if (node->hasAttribute("quadrant"))
-	{
-		std::string quadrant_name;
-		node->getAttributeString("quadrant", quadrant_name);
-
-		quadrant = quadrantFromName(quadrant_name);
-	}
-	return quadrant;
-}
-
-
-std::string LLJoystick::nameFromQuadrant(EJoystickQuadrant	quadrant)
-{
-	if (quadrant == JQ_ORIGIN)	    return std::string("origin");
-	else if (quadrant == JQ_UP)	    return std::string("up");
-	else if (quadrant == JQ_DOWN)	return std::string("down");
-	else if (quadrant == JQ_LEFT)	return std::string("left");
-	else if (quadrant == JQ_RIGHT)	return std::string("right");
-	else return std::string();
-}
-
-
-EJoystickQuadrant LLJoystick::quadrantFromName(const std::string& sQuadrant)
-{
-	EJoystickQuadrant quadrant = JQ_RIGHT;
-
-	if (sQuadrant == "origin")
-	{
-		quadrant = JQ_ORIGIN;
-	}
-	else if (sQuadrant == "up")
-	{
-		quadrant = JQ_UP;
-	}
-	else if (sQuadrant == "down")
-	{
-		quadrant = JQ_DOWN;
-	}
-	else if (sQuadrant == "left")
-	{
-		quadrant = JQ_LEFT;
-	}
-	else if (sQuadrant == "right")
-	{
-		quadrant = JQ_RIGHT;
-	}
-
-	return quadrant;
-}
-
-
-//-------------------------------------------------------------------------------
-// LLJoystickAgentTurn
-//-------------------------------------------------------------------------------
-
-void LLJoystickAgentTurn::onHeldDown()
-{
-	F32 time = getElapsedHeldDownTime();
-	updateSlop();
-
-	//llinfos << "move forward/backward (and/or turn)" << llendl;
-
-	S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
-	S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
-	float m = (float) (dx)/abs(dy);
-	
-	if (m > 1) {
-		m = 1;
-	}
-	else if (m < -1) {
-		m = -1;
-	}
-	gAgent.moveYaw(-LLFloaterMove::getYawRate(time)*m);
-	
-
-	// handle forward/back movement
-	if (dy > mVertSlopFar)
-	{
-		// ...if mouse is forward of run region run forward
-		gAgent.moveAt(1);
-	}
-	else if (dy > mVertSlopNear)
-	{
-		if( time < NUDGE_TIME )
-		{
-			gAgent.moveAtNudge(1);
-		}
-		else
-		{
-			// ...else if mouse is forward of walk region walk forward
-			// JC 9/5/2002 - Always run / move quickly.
-			gAgent.moveAt(1);
-		}
-	}
-	else if (dy < -mVertSlopFar)
-	{
-		// ...else if mouse is behind run region run backward
-		gAgent.moveAt(-1);
-	}
-	else if (dy < -mVertSlopNear)
-	{
-		if( time < NUDGE_TIME )
-		{
-			gAgent.moveAtNudge(-1);
-		}
-		else
-		{
-			// ...else if mouse is behind walk region walk backward
-			// JC 9/5/2002 - Always run / move quickly.
-			gAgent.moveAt(-1);
-		}
-	}
-}
-
-//-------------------------------------------------------------------------------
-// LLJoystickAgentSlide
-//-------------------------------------------------------------------------------
-
-void LLJoystickAgentSlide::onMouseUp()
-{
-	F32 time = getElapsedHeldDownTime();
-	if( time < NUDGE_TIME )
-	{
-		switch (mInitialQuadrant)
-		{
-		case JQ_LEFT:
-			gAgent.moveLeftNudge(1);
-			break;
-
-		case JQ_RIGHT:
-			gAgent.moveLeftNudge(-1);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-void LLJoystickAgentSlide::onHeldDown()
-{
-	//llinfos << "slide left/right (and/or move forward/backward)" << llendl;
-
-	updateSlop();
-
-	S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
-	S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
-	// handle left-right sliding
-	if (dx > mHorizSlopNear)
-	{
-		gAgent.moveLeft(-1);
-	}
-	else if (dx < -mHorizSlopNear)
-	{
-		gAgent.moveLeft(1);
-	}
-
-	// handle forward/back movement
-	if (dy > mVertSlopFar)
-	{
-		// ...if mouse is forward of run region run forward
-		gAgent.moveAt(1);
-	}
-	else if (dy > mVertSlopNear)
-	{
-		// ...else if mouse is forward of walk region walk forward
-		gAgent.moveAtNudge(1);
-	}
-	else if (dy < -mVertSlopFar)
-	{
-		// ...else if mouse is behind run region run backward
-		gAgent.moveAt(-1);
-	}
-	else if (dy < -mVertSlopNear)
-	{
-		// ...else if mouse is behind walk region walk backward
-		gAgent.moveAtNudge(-1);
-	}
-}
-
-
-//-------------------------------------------------------------------------------
-// LLJoystickCameraRotate
-//-------------------------------------------------------------------------------
-
-LLJoystickCameraRotate::LLJoystickCameraRotate(const LLJoystickCameraRotate::Params& p)
-:	LLJoystick(p), 
-	mInLeft( FALSE ),
-	mInTop( FALSE ),
-	mInRight( FALSE ),
-	mInBottom( FALSE )
-{ }
-
-
-void LLJoystickCameraRotate::updateSlop()
-{
-	// do the initial offset calculation based on mousedown location
-
-	// small fixed slop region
-	mVertSlopNear = 16;
-	mVertSlopFar = 32;
-
-	mHorizSlopNear = 16;
-	mHorizSlopFar = 32;
-
-	return;
-}
-
-
-BOOL LLJoystickCameraRotate::handleMouseDown(S32 x, S32 y, MASK mask)
-{
-	updateSlop();
-
-	// Set initial offset based on initial click location
-	S32 horiz_center = getRect().getWidth() / 2;
-	S32 vert_center = getRect().getHeight() / 2;
-
-	S32 dx = x - horiz_center;
-	S32 dy = y - vert_center;
-
-	if (dy > dx && dy > -dx)
-	{
-		// top
-		mInitialOffset.mX = 0;
-		mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2;
-		mInitialQuadrant = JQ_UP;
-	}
-	else if (dy > dx && dy <= -dx)
-	{
-		// left
-		mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2;
-		mInitialOffset.mY = 0;
-		mInitialQuadrant = JQ_LEFT;
-	}
-	else if (dy <= dx && dy <= -dx)
-	{
-		// bottom
-		mInitialOffset.mX = 0;
-		mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2;
-		mInitialQuadrant = JQ_DOWN;
-	}
-	else
-	{
-		// right
-		mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2;
-		mInitialOffset.mY = 0;
-		mInitialQuadrant = JQ_RIGHT;
-	}
-
-	return LLJoystick::handleMouseDown(x, y, mask);
-}
-
-
-void LLJoystickCameraRotate::onHeldDown()
-{
-	updateSlop();
-
-	S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
-	S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
-	// left-right rotation
-	if (dx > mHorizSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setOrbitLeftKey(getOrbitRate());
-	}
-	else if (dx < -mHorizSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setOrbitRightKey(getOrbitRate());
-	}
-
-	// over/under rotation
-	if (dy > mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setOrbitUpKey(getOrbitRate());
-	}
-	else if (dy < -mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setOrbitDownKey(getOrbitRate());
-	}
-}
-
-F32 LLJoystickCameraRotate::getOrbitRate()
-{
-	F32 time = getElapsedHeldDownTime();
-	if( time < NUDGE_TIME )
-	{
-		F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME;
-		//llinfos << rate << llendl;
-		return rate;
-	}
-	else
-	{
-		return 1;
-	}
-}
-
-
-// Only used for drawing
-void LLJoystickCameraRotate::setToggleState( BOOL left, BOOL top, BOOL right, BOOL bottom )
-{
-	mInLeft = left;
-	mInTop = top;
-	mInRight = right;
-	mInBottom = bottom;
-}
-
-void LLJoystickCameraRotate::draw()
-{
-	LLGLSUIDefault gls_ui;
-
-	getImageUnselected()->draw( 0, 0 );
-	LLPointer<LLUIImage> image = getImageSelected();
-
-	if( mInTop )
-	{
-		drawRotatedImage( getImageSelected(), 0 );
-	}
-
-	if( mInRight )
-	{
-		drawRotatedImage( getImageSelected(), 1 );
-	}
-
-	if( mInBottom )
-	{
-		drawRotatedImage( getImageSelected(), 2 );
-	}
-
-	if( mInLeft )
-	{
-		drawRotatedImage( getImageSelected(), 3 );
-	}
-}
-
-// Draws image rotated by multiples of 90 degrees
-void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations )
-{
-	S32 width = image->getWidth();
-	S32 height = image->getHeight();
-	LLTexture* texture = image->getImage();
-
-//	 * Scale  texture coordinate system 
-//	 * to handle the different between image size and size of texture.
-//	 * If we will use default matrix, 
-//	 * it may break texture mapping after rotation.
-//	 * see EXT-2023 Camera floater: arrows became shifted when pressed.
-	F32 uv[][2] = 
-	{
-		{ (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
-		{ 0.f, (F32)height/texture->getHeight() },
-		{ 0.f, 0.f },
-		{ (F32)width/texture->getWidth(), 0.f }
-	};
-
-	gGL.getTexUnit(0)->bind(texture);
-
-	gGL.color4fv(UI_VERTEX_COLOR.mV);
-	
-	gGL.begin(LLRender::QUADS);
-	{
-		gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
-		gGL.vertex2i(width, height );
-
-		gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
-		gGL.vertex2i(0, height );
-
-		gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
-		gGL.vertex2i(0, 0);
-
-		gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
-		gGL.vertex2i(width, 0);
-	}
-	gGL.end();
-}
-
-
-
-//-------------------------------------------------------------------------------
-// LLJoystickCameraTrack
-//-------------------------------------------------------------------------------
-
-LLJoystickCameraTrack::Params::Params()
-{
-	held_down_delay.seconds(0.0);
-}
-
-LLJoystickCameraTrack::LLJoystickCameraTrack(const LLJoystickCameraTrack::Params& p)
-:	LLJoystickCameraRotate(p)
-{}
-
-
-void LLJoystickCameraTrack::onHeldDown()
-{
-	updateSlop();
-
-	S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX;
-	S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY;
-
-	if (dx > mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setPanRightKey(getOrbitRate());
-	}
-	else if (dx < -mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setPanLeftKey(getOrbitRate());
-	}
-
-	// over/under rotation
-	if (dy > mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setPanUpKey(getOrbitRate());
-	}
-	else if (dy < -mVertSlopNear)
-	{
-		gAgentCamera.unlockView();
-		gAgentCamera.setPanDownKey(getOrbitRate());
-	}
-}
-*/

indra/newview/llleapmotioncontroller.h

 
 
 /* 
-	This is experimental code the connects the LeapMotion gesture controller (www.leapmotion.com) 
-	to the Second Life viewer.   It requires the LeapMotion SDK to properly build.   See
+	This is experimental code the connects the Leap Motion gesture controller (www.leapmotion.com) 
+	to the Second Life viewer.   It requires the Leap Motion SDK to properly build.   See
 	the comments at the head of llleapmotioncontroller.cpp
 */
 class	LLLMImpl;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.