コード例 #1
0
/**
 * @fn OneGridSceneCreation(CSceneDef const &def, int resW, int resH)
 *
 * @brief Implements the creation of a single grid (not multi-grid) scene.
 *
 * @param def - The scene definition
 *
 * @param resW - Width of the scene
 *
 * @param resH - Height of the scene
 *
 * @return - Pointer to the created scene, NULL to indicate failure
 */
CFlux2DScene* OneGridSceneCreation(CSceneDef const &def, int resW, int resH)
{
    CFlux2DSceneDef scnDef;
    // Validate the filename
    if (!IsFileNameCSV(def.fileName))
    {
        // Load the scene from the file
        if (!LoadScnDefFromBitmap(def, scnDef))
        {
            return NULL;
        }
    }
    else // Load from the profile
    {
        if (!LoadScnDefFromCSVProfile(def, resW, resH, scnDef))
        {
            return NULL;
        }
    }

    // Allocate the scene
    CFlux2DScene* pScn = new (UseOwnMem) CFlux2DScene(1);
    // Add the single grid
    pScn->AddGrid(scnDef, resW, resH, CRegion(0.0f, 0.0f, scnDef.lenWidth, scnDef.lenHeight));
    pScn->CalculateBoundingRegion();

    return pScn;
}
コード例 #2
0
ファイル: Dungeon.cpp プロジェクト: dark-saron/Fantasy-Maze
CDungeon::CDungeon()
         : _standardCellType(0),
           _level(0)
{
    //sets the regions in the array
    for (int regionX = 0; regionX< AMOUNT_REGION_X; ++regionX)
    {
        for (int regionY = 0; regionY < AMOUNT_REGION_Y; ++regionY)
        {
            _regions[regionX][regionY] = CRegion(regionX, regionY);
        }
    }

    
}
コード例 #3
0
/**
 * @fn SceneCreateMGridExperiment3GFlip()
 *
 * @brief Creates a multi-grid experimental scene
 *
 * @return Pointer to the created scene
 */
CFlux2DScene* SceneCreateMGridExperiment3GFlip()
{
    CFlux2DScene* pScene = NULL;

    // Create the test definition
    CSceneDef       testDef( L"data/hm_cape.bmp"  , -5.0f, 5.0f, 256.0f, 256.0f );
    // Load the test scene definition
    CFlux2DSceneDef scnDef;
    if (!LoadScnDefFromBitmap(testDef, scnDef))
    {
        return NULL;
    }
    
    // Create the scene
    pScene = new (UseOwnMem) CFlux2DScene(3);

    // Add grids for left, top, and bottom
    int X0=64;
    int leftGrid = pScene->AddGrid(scnDef, X0, 256, CRegion(0.0f, 0.0f, (float)X0, 256.0f));
    int rightTopGrid = pScene->AddGrid(scnDef, (256-X0)/2, (128)/2, CRegion((float)X0, 0.0f, 256.0f, 128.0f));
    int rightBtmGrid = pScene->AddGrid(scnDef, 256-X0, 128, CRegion((float)X0, 128.0f, 256.0f, 256.0f));
    // Calculate the bounding box
    pScene->CalculateBoundingRegion();
    CSeamData* pSD;
    
    // Add a horizontal seam 
    pSD = &(pScene->m_SeamArray.Append());
    pSD->GridTop = rightTopGrid;
    pSD->GridBottom = rightBtmGrid;
    pSD->GridLeft = -1;
    pSD->GridRight = -1;
    // Add a vertical  seam
    pSD = &(pScene->m_SeamArray.Append());
    pSD->GridTop = -1;
    pSD->GridBottom = -1;
    pSD->GridLeft = leftGrid;
    pSD->GridRight = rightTopGrid;
    // Add second vertical seam
    pSD = &(pScene->m_SeamArray.Append());
    pSD->GridTop = -1;
    pSD->GridBottom = -1;
    pSD->GridLeft = leftGrid;
    pSD->GridRight = rightBtmGrid;

    // Add border conditions & initialize

    // To the top-right part
    CFlux2DGrid *pF = pScene->GetGrid(rightTopGrid);
    pF->ResetToZeroState();
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::TOP));
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::RIGHT));
    
    // To the bottom-right part
    pF = pScene->GetGrid(rightBtmGrid);
    pF->ResetToZeroState();
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::BOTTOM));
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::RIGHT));
    
    // To the left part
    pF = pScene->GetGrid(leftGrid);
    pF->ResetToZeroState();
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::TOP));
    pF->AddAction(new (UseOwnMem) CFlux2DBCCopy(CFlux2DBCCopy::BOTTOM));
    pF->AddAction(new (UseOwnMem) CFlux2DBCSineWaveGenVerticalLeft(2.5f, 1.7f, 0.0f));
    //CFlux2DAddBC_CopyRt(*pF); (DEPRECATED)

    return pScene;
}
コード例 #4
0
/**
 * @fn OneGridSceneCreation(int resW, int resH, float lenW, float lenH)
 *
 * @brief Implements the creation of a single grid (not multi-grid) scene.
 *
 * @param resW - Width of the scene
 *
 * @param resH - Height of the scene
 *
 * @param lenW - Width of the region
 *
 * @param lenH - Height of the region
 *
 * @return - Pointer to the created scene
 */
CFlux2DScene* OneGridSceneCreation(int resW, int resH, float lenW, float lenH)
{
    CFlux2DScene* pScn = new (UseOwnMem) CFlux2DScene(1);
    pScn->AddGrid(resW, resH, CRegion(0.0f, 0.0f, lenW, lenH));
    return pScn;
}