Exemple #1
0
neBool SearchResult::SearchFV(s32 initialFace, neBool & assigned)
{
	for (s32 i = 0; i < objA.mesh.numFaces; i++)
	{
		_visited[i] = false;

		if (objA.isBox)
		{
			objA.mesh.normals[i].v[3] = objA.mesh.vertices[objA.mesh.faces[i].neighbourVerts[0]].Dot(objA.mesh.normals[i]) * -1.0f;
		}
	}
	
	if (!TestFace(initialFace, assigned))
		return false;

	//ASSERT(assigned);

	neBool found = true;

	s32 currentFace = initialFace;

	while (found)
	{
		found = false;

		for (s32 ii = 0; ii < objA.mesh.numNeighbour; ii++)
		{
			s32 i = objA.mesh.FaceGetFaceNeighbour(currentFace, ii);

			if (_visited[i])
				continue;

			neBool _assigned;

			if (!TestFace(i, _assigned))
				return false;

			if (_assigned)
				found = true;
		}
		if (found)
		{
			currentFace = indexA;
		}
	}
	return true;
}
Exemple #2
0
  static void
  ExecuteTest( char*  testfont )
  {
    FT_Library  context;
    FT_Face     face;


    if ( FT_Init_FreeType( &context ) )
    {
      fprintf( stderr, "Can't initialize FreeType.\n" );
      exit( 1 );
    }

    if ( FT_New_Face( context, testfont, 0, &face ) )
    {
      /* The font is erroneous, so if this fails that's ok. */
      exit( 0 );
    }

    if ( face->num_faces == 1 )
      TestFace( face );
    else
    {
      long  i, num;


      num = face->num_faces;
      FT_Done_Face( face );

      for ( i = 0; i < num; i++ )
      {
        if ( !FT_New_Face( context, testfont, i, &face ) )
          TestFace( face );
      }
    }

    FT_Done_FreeType( context );

    exit( 0 );
  }
Exemple #3
0
void TestBoard( HWND hWnd, BOARD *p_board, int x, int y, int msg )
{
    POINT pt;
    unsigned col,row;

    pt.x = x;
    pt.y = y;

    if( PtInRect( &p_board->mines_rect, pt ) && p_board->status != GAMEOVER
    && p_board->status != WON )
        TestMines( p_board, pt, msg );
    else {
        UnpressBoxes( p_board,
            p_board->press.x,
            p_board->press.y );
        p_board->press.x = 0;
        p_board->press.y = 0;
    }

    if( p_board->boxes_left == 0 ) {
        p_board->status = WON;

        if (p_board->num_flags < p_board->mines) {
            for( row = 1; row <= p_board->rows; row++ ) {
                for( col = 1; col <= p_board->cols; col++ ) {
                    if (p_board->box[col][row].IsMine && p_board->box[col][row].FlagType != FLAG)
                        p_board->box[col][row].FlagType = FLAG;
                }
            }

            p_board->num_flags = p_board->mines;

            RedrawWindow( p_board->hWnd, NULL, 0,
                RDW_INVALIDATE | RDW_UPDATENOW );
        }

        if( p_board->difficulty != CUSTOM &&
                    p_board->time < p_board->best_time[p_board->difficulty] ) {
            p_board->best_time[p_board->difficulty] = p_board->time;

            DialogBoxParam( p_board->hInst, "DLG_CONGRATS", hWnd,
                    CongratsDlgProc, (LPARAM) p_board);

            DialogBoxParam( p_board->hInst, "DLG_TIMES", hWnd,
                    TimesDlgProc, (LPARAM) p_board);
        }
    }
    TestFace( p_board, pt, msg );
}
void bloomenthal_polygonizer::PolygonizeSurface(const Location& startinglocation)
{
	// Create initial cube
	if(mark_center(startinglocation))
		return;

	Cube c(startinglocation);
	for(TqInt n = 0; n < 8; n++)
		c.corners[n] = get_cached_corner(startinglocation + Location(bit_value(n, 2), bit_value(n, 1), bit_value(n, 0)));

	// Push it on stack
	m_active_cubes.push(c);

	// Process active cubes till none left
	while(!m_active_cubes.empty())
	{
		Cube c = m_active_cubes.top();
		m_active_cubes.pop();

		// Polygonize
		switch(m_Decomposition)
		{
				case MARCHINGCUBES:
				MarchingCube(c);
				break;
				case TETRAHEDRAL:
				// Decompose into tetrahedra and polygonize
				TriangulateTet(c, LBN, LTN, RBN, LBF);
				TriangulateTet(c, RTN, LTN, LBF, RBN);
				TriangulateTet(c, RTN, LTN, LTF, LBF);
				TriangulateTet(c, RTN, RBN, LBF, RBF);
				TriangulateTet(c, RTN, LBF, LTF, RBF);
				TriangulateTet(c, RTN, LTF, RTF, RBF);
				break;
				default:
				Aqsis::log() << warning << "Unknow decomposition " << std::endl;
				MarchingCube(c);
				break;

		}

		// Test six face directions, maybe add to stack
		TestFace(c.l.Left(), c, L, LBN, LBF, LTN, LTF);
		TestFace(c.l.Right(), c, R, RBN, RBF, RTN, RTF);
		TestFace(c.l.Bottom(), c, B, LBN, LBF, RBN, RBF);
		TestFace(c.l.Top(), c, T, LTN, LTF, RTN, RTF);
		TestFace(c.l.Near(), c, N, LBN, LTN, RBN, RTN);
		TestFace(c.l.Far(), c, F, LBF, LTF, RBF, RTF);
	}
}