mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:38:27 +02:00
Adding palm accessor method that fetches left or right, as specified.
This commit is contained in:
parent
038f8d5777
commit
f28fc5f79b
2 changed files with 13 additions and 0 deletions
|
@ -41,6 +41,18 @@ PalmData& HandData::addNewPalm() {
|
||||||
const int SIXENSE_CONTROLLER_ID_LEFT_HAND = 0;
|
const int SIXENSE_CONTROLLER_ID_LEFT_HAND = 0;
|
||||||
const int SIXENSE_CONTROLLER_ID_RIGHT_HAND = 1;
|
const int SIXENSE_CONTROLLER_ID_RIGHT_HAND = 1;
|
||||||
|
|
||||||
|
const PalmData* HandData::getPalm(int sixSenseID) const {
|
||||||
|
// the palms are not necessarily added in left-right order,
|
||||||
|
// so we have to search for the right SixSenseID
|
||||||
|
for (int i = 0; i < _palms.size(); i++) {
|
||||||
|
const PalmData* palm = &(_palms[i]);
|
||||||
|
if (palm->getSixenseID() == sixSenseID) {
|
||||||
|
return palm->isActive() ? palm : NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void HandData::getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const {
|
void HandData::getLeftRightPalmIndices(int& leftPalmIndex, int& rightPalmIndex) const {
|
||||||
leftPalmIndex = -1;
|
leftPalmIndex = -1;
|
||||||
rightPalmIndex = -1;
|
rightPalmIndex = -1;
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
|
|
||||||
std::vector<PalmData>& getPalms() { return _palms; }
|
std::vector<PalmData>& getPalms() { return _palms; }
|
||||||
const std::vector<PalmData>& getPalms() const { return _palms; }
|
const std::vector<PalmData>& getPalms() const { return _palms; }
|
||||||
|
const PalmData* getPalm(int sixSenseID) const;
|
||||||
size_t getNumPalms() const { return _palms.size(); }
|
size_t getNumPalms() const { return _palms.size(); }
|
||||||
PalmData& addNewPalm();
|
PalmData& addNewPalm();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue