Esempio n. 1
0
int main() {
	// Test the system
	SystemTest();

	// Read the configure file
	ReadConfFile();

	// Load all the frames
	LoadFrames();

	// Put both topological and geometrical data into arrays
	GetTopologyAndGeometry();

	// Get the global bounding box
	GetGlobalBoundingBox();

	// Calculate the number of blocks in X, Y and Z
	CalculateNumOfBlocksInXYZ();

	// Divide the flow domain into blocks
	//Division();

	InitializationForNaiveTracing();

	// Initially locate global tetrahedral cells for interesting Cartesian grid points
	InitialCellLocation();

	//int xRes = configure->GetBoundingBoxXRes();
	//int yRes = configure->GetBoundingBoxYRes();
	//int zRes = configure->GetBoundingBoxZRes();
	//int numOfGridPoints = (xRes + 1) * (yRes + 1) * (zRes + 1);

	//// Evaluate the device usage
	//int need = SizeOfDeviceArrays(globalNumOfPoints, globalNumOfCells, numOfGridPoints, numOfInitialActiveParticles, numOfQueries,
	//	       	   startOffsetInPoint[numOfInterestingBlocks], startOffsetInCell[numOfInterestingBlocks],
	//		   numOfInterestingBlocks);

	//printf("need = %d bytes\n", need);

	///// Check the natural coordinates of some points
	//CheckNaturalCoordinates();

	///// DEBUG ///
	////return 0;

	// Main Tracing Process
	Tracing();

	// Get final positions for initial active particles
	GetFinalPositions();

	return 0;
}
Esempio n. 2
0
void Game::OnMain()
{
    SetPlanSize(cxSize2F(2048, 1536));
//
    const cxStr *data = nullptr;
    {
        cxStr *code = cxStr::UTF8("8347834");
        IndexType message = IndexType_init_zero;
        message.tid = 200;
        message.code = CX_STR_PB_ENCODE(code);
        data = cxStr::PBEncode(IndexType_fields, &message);
        cxUtil::Instance()->WriteDocument("test.dat", data, true);
    }
    {
        cxStr *code = cxStr::Create();
        IndexType m2 = IndexType_init_zero;
        m2.code = CX_STR_PB_DECODE(code);
        cxBool ok = data->PBDecode(IndexType_fields, &m2);
        CX_LOGGER("%d",ok);
    }
    
//    LoadTexture("grid.png","grid");
//
//    cxSprite *sp = cxSprite::Create();
//    sp->SetSize(cxSize2F(64));
//    sp->SetTexture("grid");
//    Window()->Append(sp);
//    
//    cxMoveTo::Create(cxPoint2F(0, 512), 6)->AttachTo(sp)->onExit+=cxAction::Remove;
//    
//    {
//        cxSprite *sp2 = cxSprite::Create();
//        sp2->SetSize(cxSize2F(64));
//        sp2->SetTexture("grid");
//        sp2->SetColor(cxColor4F::RED);
//        Window()->Append(sp2);
//        
//        cxFollow::Create(sp, 50)->AttachTo(sp2);
//    }
    
//    Controller *cv = Controller::Create(6, 6);
//    cv->SetResizeFlags(cxView::ResizeBottom);
//    Window()->Append(cv);
//
//    return;
    //加载纹理
    LoadTexture("jl.lqt");
    //加载帧序列
    LoadFrames("frames.csv");
    //加载动作组
    LoadActions("actions.csv");
    //获取法师帧序列
    const cxFrames *fs = GetFrames("Mage");
    //获取法师的动作列表
    const cxActionGroup *ag = GetActions("Mage");
    //获得move动作
    
    //创建动画
    {
        //获得动作组
        const cxActionAttr *move = ag->Action("attack");
        //创建动画
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //创建载体
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->Append(animate);//加入动画
        //载体加入绘制
        Window()->Append(atlas);
    }
    
    {
        const cxActionAttr *move = ag->Action("move");
        cxAnimate *animate = fs->Animate();
        animate->onFrame+=[](cxAnimate *pav,cxInt frame){
            CX_LOGGER("%d %d",frame,pav->IsKeyFrame());
        };
        animate->SetAction(move, 1);
        animate->SetSpeed(1.0f);
        //
        cxAtlas *atlas = cxAtlas::Create();
        atlas->SetFlipX(true);
        atlas->SetSize(cxSize2F(200, 200));
        atlas->SetPosition(cxPoint2F(0, 300));
        animate->AttachTo(atlas);
        Window()->Append(atlas);
    }
}