Exemple #1
0
void CglGroup::compute(){

  //On vérifie si un membre du groupe est sélectionné
  bool match = false;
  for(int i = 0 ; i < numObjects() ; i++){
    if(listObject[i]->isSelected()){
      match = true;
      selected = true;
    }
  }
  if(!match)
    selected = false;

  //On sélectionne les membres du groupe
  if(selected)
    for(int i = 0 ; i < numObjects() ; i++)
      listObject[i]->select();

  //On calcule le centre du groupe
  glm::vec3 tmpCenter;
  for(int i = 0 ; i < pCenters.size() ; i++){
    tmpCenter += *pCenters[i];
  }
  group_center = float( 1.0f/pCenters.size() ) * tmpCenter;
  //On envoie le centre aux objets
  for(int i = 0 ; i < numObjects() ; i++){
    listObject[i]->setRotationCenter(group_center);
  }

}
Exemple #2
0
CglGroup::CglGroup(std::vector<pCglObject> groupOfObjects)
{
  listObject = groupOfObjects;
  group_color = glm::vec3(0,0.7,0);
  bbmin = glm::vec3(100000);
  bbmax = glm::vec3(-100000);

  //Centres du groupe
  for(int i = 0 ; i < numObjects() ; i++){
    pCenters.push_back(listObject[i]->getCenterPtr());
  }

  //BBOX
  /*
  for(int i = 0 ; i < numObjects() ; i++){
    glm::vec3 mini = listObject[i]->getBBMIN();
    glm::vec3 maxi = listObject[i]->getBBMAX();
    bbmin.x = min(bbmin.x, mini.x);
    bbmin.y = min(bbmin.y, mini.y);
    bbmin.z = min(bbmin.z, mini.z);
    bbmax.x = max(bbmax.x, maxi.x);
    bbmax.y = max(bbmax.y, maxi.y);
    bbmax.z = max(bbmax.z, maxi.z);
  }
  */

  compute();
}
Exemple #3
0
void CglGroup::unGroup(){
  //On envoie le centre aux objets
  for(int i = 0 ; i < numObjects() ; i++){
    glm::vec3 new_center = glm::vec3(listObject[i]->getMODEL()[3]);
    listObject[i]->setCenter(new_center);
  }
}
Exemple #4
0
SessionEntry* SessionManager::findSessionByAddress( std::string address )
{
    Group* sessions;
    SessionEntry* session;

    for ( int i = 0; i < numObjects(); i++ )
    {
        sessions = dynamic_cast<Group*>( (*this)[i] );
        for ( int j = 0; j < sessions->numObjects(); j++ )
        {
            session = dynamic_cast<SessionEntry*>( (*sessions)[j] );
            if ( session != NULL &&
                    session->getAddress().compare( address ) == 0 )
                return session;
        }
    }

    gravUtil::logWarning( "SessionManager::findSessionByAddress: session %s "
                          "not found\n", address.c_str() );
    return NULL;
}
Exemple #5
0
  { &GUID_Button,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { &GUID_Button,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
};

static const DIDATAFORMAT c_dfDIJoystickTest = {
    sizeof(DIDATAFORMAT),
    sizeof(DIOBJECTDATAFORMAT),
    DIDF_ABSAXIS,
    sizeof(DIJOYSTATE2),
    numObjects(dfDIJoystickTest),
    (LPDIOBJECTDATAFORMAT)dfDIJoystickTest
};

static HWND get_hwnd(void)
{
    HWND hwnd=GetForegroundWindow();
    if (!hwnd)
        hwnd=GetDesktopWindow();
    return hwnd;
}

typedef struct tagJoystickInfo
{
    IDirectInputDeviceA *pJoystick;
    DWORD axis;
Exemple #6
0
  { NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
  { NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
};

const DIDATAFORMAT c_dfDIJoystick = {
    sizeof(DIDATAFORMAT),
    sizeof(DIOBJECTDATAFORMAT),
    DIDF_ABSAXIS,
    sizeof(DIJOYSTATE),
    numObjects(dfDIJoystick),
    (LPDIOBJECTDATAFORMAT)dfDIJoystick
};

static const DIOBJECTDATAFORMAT dfDIJoystick2[] = {
  { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
  { &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
  { &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
  { &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
void PCObjectContainer::initGMM(double scale, double percent)
{
    for(int i=0;i<numObjects();i++)
        objects.at(i)->initialGMM(scale, percent);
}