Пример #1
0
// called before rendering
void Effect::startEffect()
{
  if (!m_pEffect) return;

  m_clipPlaneChanged = false;

  

  // if a clipping plane is specified, it must be converted to projections space
  // the plane is currently assumed to be in world space.
  if (gRenderer.getClipPlaneEnable())
  {
    D3DXMATRIX View, Projection,ViewProj;
    
    
    D3DXPLANE projPlane, worldPlane;

	  //D3DXVECTOR4 projClipPlane;

    gRenderer.getClipPlane(&m_oldClipPlane);
    worldPlane.a = m_oldClipPlane.a;
    worldPlane.b = m_oldClipPlane.b;
    worldPlane.c = m_oldClipPlane.c;
    worldPlane.d = m_oldClipPlane.d;
        
        
    // get all matrices from device    
    pD3DDevice->GetTransform(D3DTS_VIEW, & View);
    pD3DDevice->GetTransform(D3DTS_PROJECTION, & Projection);

    // multiply them
    ViewProj = View * Projection;

    //worldPlane.y *= -1;

    D3DXPlaneNormalize(&worldPlane, &worldPlane);

    D3DXMatrixInverse(&ViewProj, NULL ,&ViewProj);
    D3DXMatrixTranspose(&ViewProj ,&ViewProj);

    D3DXPlaneTransform(&projPlane, &worldPlane, &ViewProj);

    D3DXPlaneNormalize(&projPlane, &projPlane);

    Plane passIn(projPlane.a, projPlane.b, projPlane.c, projPlane.d);

    gRenderer.setClipPlane(passIn);
    
    m_clipPlaneChanged = true;
  }
  
	m_pEffect->Begin(0,0);
	m_pEffect->BeginPass(0);
  m_pEffect->CommitChanges();
}
Пример #2
0
 bool exist(vector<vector<char> > &board, string word) {
     // Start typing your C/C++ solution below
     // DO NOT write int main() function
     for(int i = 0; i < board.size(); i++){
         for(int j = 0; j < board[i].size(); j++){
             if(board[i][j] == word[0]){
                 vector<vector<char>> passIn(board);
                 bool result = recursiveSearch(passIn, i, j, word, 0);
                 if(result)
                     return true;
             }
         }
     }
     return false;
 }