mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
Rave Glove demo: activation mode and stage (dark backdrop) drawing.
This commit is contained in:
parent
57a722a7bd
commit
39130aef58
3 changed files with 36 additions and 0 deletions
|
@ -2033,6 +2033,7 @@ void Application::update(float deltaTime) {
|
||||||
// Leap finger-sensing device
|
// Leap finger-sensing device
|
||||||
LeapManager::enableFakeFingers(_simulateLeapHand->isChecked() || _testRaveGlove->isChecked());
|
LeapManager::enableFakeFingers(_simulateLeapHand->isChecked() || _testRaveGlove->isChecked());
|
||||||
LeapManager::nextFrame();
|
LeapManager::nextFrame();
|
||||||
|
_myAvatar.getHand().setRaveGloveActive(_testRaveGlove->isChecked());
|
||||||
_myAvatar.getHand().setLeapFingers(LeapManager::getFingerTips(), LeapManager::getFingerRoots());
|
_myAvatar.getHand().setLeapFingers(LeapManager::getFingerTips(), LeapManager::getFingerRoots());
|
||||||
_myAvatar.getHand().setLeapHands(LeapManager::getHandPositions(), LeapManager::getHandNormals());
|
_myAvatar.getHand().setLeapHands(LeapManager::getHandPositions(), LeapManager::getHandNormals());
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,43 @@ void Hand::render(bool lookingInMirror) {
|
||||||
|
|
||||||
calculateGeometry();
|
calculateGeometry();
|
||||||
|
|
||||||
|
if (_isRaveGloveActive)
|
||||||
|
renderRaveGloveStage();
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
renderHandSpheres();
|
renderHandSpheres();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hand::renderRaveGloveStage() {
|
||||||
|
if (_owningAvatar && _owningAvatar->isMyAvatar()) {
|
||||||
|
Head& head = _owningAvatar->getHead();
|
||||||
|
glm::quat headOrientation = head.getOrientation();
|
||||||
|
glm::vec3 headPosition = head.getPosition();
|
||||||
|
float scale = 100.0f;
|
||||||
|
glm::vec3 vc = headOrientation * glm::vec3( 0.0f, 0.0f, -30.0f) + headPosition;
|
||||||
|
glm::vec3 v0 = headOrientation * (glm::vec3(-1.0f, -1.0f, 0.0f) * scale) + vc;
|
||||||
|
glm::vec3 v1 = headOrientation * (glm::vec3( 1.0f, -1.0f, 0.0f) * scale) + vc;
|
||||||
|
glm::vec3 v2 = headOrientation * (glm::vec3( 1.0f, 1.0f, 0.0f) * scale) + vc;
|
||||||
|
glm::vec3 v3 = headOrientation * (glm::vec3(-1.0f, 1.0f, 0.0f) * scale) + vc;
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
glVertex3fv((float*)&vc);
|
||||||
|
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
|
||||||
|
glVertex3fv((float*)&v0);
|
||||||
|
glVertex3fv((float*)&v1);
|
||||||
|
glVertex3fv((float*)&v2);
|
||||||
|
glVertex3fv((float*)&v3);
|
||||||
|
glVertex3fv((float*)&v0);
|
||||||
|
glEnd();
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Hand::renderHandSpheres() {
|
void Hand::renderHandSpheres() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
// Draw the leap balls
|
// Draw the leap balls
|
||||||
|
|
|
@ -46,9 +46,11 @@ public:
|
||||||
const std::vector<glm::vec3>& fingerRoots);
|
const std::vector<glm::vec3>& fingerRoots);
|
||||||
void setLeapHands (const std::vector<glm::vec3>& handPositions,
|
void setLeapHands (const std::vector<glm::vec3>& handPositions,
|
||||||
const std::vector<glm::vec3>& handNormals);
|
const std::vector<glm::vec3>& handNormals);
|
||||||
|
void setRaveGloveActive(bool active) { _isRaveGloveActive = active; }
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
const glm::vec3& getLeapBallPosition (int ball) const { return _leapBalls[ball].position;}
|
const glm::vec3& getLeapBallPosition (int ball) const { return _leapBalls[ball].position;}
|
||||||
|
bool isRaveGloveActive () const { return _isRaveGloveActive; }
|
||||||
|
|
||||||
// position conversion
|
// position conversion
|
||||||
glm::vec3 leapPositionToWorldPosition(const glm::vec3& leapPosition);
|
glm::vec3 leapPositionToWorldPosition(const glm::vec3& leapPosition);
|
||||||
|
@ -61,12 +63,14 @@ private:
|
||||||
Avatar* _owningAvatar;
|
Avatar* _owningAvatar;
|
||||||
float _renderAlpha;
|
float _renderAlpha;
|
||||||
bool _lookingInMirror;
|
bool _lookingInMirror;
|
||||||
|
bool _isRaveGloveActive;
|
||||||
glm::vec3 _ballColor;
|
glm::vec3 _ballColor;
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::quat _orientation;
|
glm::quat _orientation;
|
||||||
std::vector<HandBall> _leapBalls;
|
std::vector<HandBall> _leapBalls;
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
|
void renderRaveGloveStage();
|
||||||
void renderHandSpheres();
|
void renderHandSpheres();
|
||||||
void calculateGeometry();
|
void calculateGeometry();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue