float* getCursor(){ float* c = (float*) malloc(sizeof(float)*2); c[0] = getPalm().X; c[1] = getPalm().Y; return c; return 0; }
//LEFT HAND:: handle rotation void checkLCursor(hand_h* lhand){ if((isLGrab() && !switchHand) || (switchHand && isGrab())) { XnPoint3D point; if(switchHand) point = getPalm(); else point = getLPalm(); lhand->storeHand(point); //keep the hand movement history //first time grab gesture occurs for left hand if(!stateGrabL) { set_state(1); stateGrabL = true; } //still in grab gesture else{ commitScene(lhand->gettranslateX(), lhand->gettranslateY(), lhand->gettranslateZ()); recalNormal(); } } else{ //just release if(stateGrabL){ stateGrabL = false; lhand->clearHandList(); } } }
int ControllerScriptingInterface::getNumberOfActivePalms() const { const HandData* handData = Application::getInstance()->getAvatar()->getHandData(); int numberOfPalms = handData->getNumPalms(); int numberOfActivePalms = 0; for (int i = 0; i < numberOfPalms; i++) { if (getPalm(i)->isActive()) { numberOfActivePalms++; } } return numberOfActivePalms; }
int ControllerScriptingInterface::getNumberOfActivePalms() const { const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData(); int numberOfPalms = handData->getNumPalms(); int numberOfActivePalms = 0; for (int i = 0; i < numberOfPalms; i++) { if (getPalm(i)->isActive()) { numberOfActivePalms++; } } return numberOfActivePalms; }
const PalmData* ControllerScriptingInterface::getActivePalm(int palmIndex) const { const HandData* handData = Application::getInstance()->getAvatar()->getHandData(); int numberOfPalms = handData->getNumPalms(); int numberOfActivePalms = 0; for (int i = 0; i < numberOfPalms; i++) { if (getPalm(i)->isActive()) { if (numberOfActivePalms == palmIndex) { return &handData->getPalms()[i]; } numberOfActivePalms++; } } return NULL; }
const PalmData* ControllerScriptingInterface::getActivePalm(int palmIndex) const { const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData(); int numberOfPalms = handData->getNumPalms(); int numberOfActivePalms = 0; for (int i = 0; i < numberOfPalms; i++) { if (getPalm(i)->isActive()) { if (numberOfActivePalms == palmIndex) { return &handData->getPalms()[i]; } numberOfActivePalms++; } } return NULL; }
void UIhandler(){ Master_ui->check_click(((getPalm().X/800)*4)-2, (getPalm().Y/800)*4-2); }
//RIGHT HAND:: treat grab as a mouse click. void checkRCursor(int func, hand_h* rhand){ if(isGrab()) { rhand->storeHand(getPalm()); //keep the hand movement history //first time grab gesture occurs for right hand if(!stateGrabR) { //adjust with width and height of the screen float* cursor = getCursor(); cursorX = cursor[0]; cursorY = cursor[1]; set_state(1); stateGrabR = true; } //still in grab gesture else{ //sculpt if(func == 1) { //select a mesh once //we don't need this for painting set_state(2); if(switchHand){ commitScene(rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ()); recalNormal(); } else{ //grab group of mesh if(sListContain(getSelection()) >= 0 ){ shape = true; interpolate(getsList(), rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ(), getRotX(), getRotY()); recalNormal(); } //grab one mesh else if(getSelection() >= 0 && getSelection() < getFaceListSize()){ shape = true; interpolate(getSelection(), rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ(), getRotX(), getRotY()); recalNormal(); } } } //paint else if(func ==2){ if(switchHand){ commitScene(rhand->gettranslateX(), rhand->gettranslateY(), rhand->gettranslateZ()); recalNormal(); }else{ if(getSelection() >=0 && getSelection() < getFaceListSize()){ //printf("selection ->%d\n", getSelection()); paintMesh(getSelection(), getBrushColor()); } } } //selection? else if(func ==3){ } } } else{ //just release if(stateGrabR){ //selection list //if(selection && getSelection() > 0 && getSelection() < getFaceListSize()){ // store_selection(getSelection()); //} stateGrabR = false; rhand->clearHandList(); setNullSelection(); //show no mesh response when hand released //undo if(func == 1 && shape) { copy_vmmodel(); shape = false; } } } }
float* getCursor(){ float* c = (float*) malloc(sizeof(float)*2); c[0] = (g_nXRes-getPalm().X)*w/g_nXRes; c[1] = getPalm().Y*h/g_nYRes; return c; }