Пример #1
0
void Cube_Init(struct Cube* This, int _x, int _y, int _z, int px, int py, int pz)
{
    float dsize = 0.0f;
    float tu = 64.0f, tv = 64.0f;
    This->render = render;
    This->rotate_x = This->rotate_y = This->rotate_z = 0.0f;
    {
        int it;
        for (it = 0; it < 6; ++it)
        {
            Face_Init(&This->face[it], 0.0f, 0.0f, 0.0f, 0.0f, -1, 0);
        }
    }
    {
        int x = pz, y = px, z = py;
        int tx = _z, ty = _x, tz = _y;
        int findex = 5;
        if (py == 0)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
        {
            int imap[][4] = {{4, 5, 6, 7}, {0, 1, 2, 3}};
            int it;
            for (it = 0; it < 4; ++it)
            {
                This->pos[imap[0][it]].y = (-0.5f + 1.0f / tz * z) * tz + 1.0f / tz * dsize;
                This->pos[imap[1][it]].y = (-0.5f + 1.0f / tz * (z + 1)) * tz - 1.0f / tz * dsize;
            }
        }
    }
    {
        int x = pz, y = px;
        int tx = _z, ty = _x, tz = _y;
        int findex = 0;
        if (py + 1 == _y)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
    }
    {
        int x = px, y = py, z = pz;
        int tx = _x, ty = _y, tz = _z;
        int findex = 4;
        if (pz == 0)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
        {
            int imap[][4] = {{1, 2, 6, 5}, {0, 3, 7, 4}};
            int it;
            for (it = 0; it < 4; ++it)
            {
                This->pos[imap[0][it]].z = (-0.5f + 1.0f / tz * z) * tz + 1.0f / tz * dsize;
                This->pos[imap[1][it]].z = (-0.5f + 1.0f / tz * (z + 1)) * tz - 1.0f / tz * dsize;
            }
        }
    }
    {
        int x = px, y = py;
        int tx = _x, ty = _y, tz = _z;
        int findex = 1;
        if (pz + 1 == _z)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
    }
    {
        int x = py, y = pz, z = px;
        int tx = _y, ty = _z, tz = _x;
        int findex = 2;
        if (px == 0)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
        {
            int imap[][4] = {{2, 3, 6, 7}, {0, 1, 4, 5}};
            int it;
            for (it = 0; it < 4; ++it)
            {
                This->pos[imap[0][it]].x = (-0.5f + 1.0f / tz * z) * tz + 1.0f / tz * dsize;
                This->pos[imap[1][it]].x = (-0.5f + 1.0f / tz * (z + 1) ) * tz- 1.0f / tz * dsize;
            }
        }
    }
    {
        int x = py, y = pz;
        int tx = _y, ty = _z, tz = _x;
        int findex = 3;
        if (px + 1 == _x)
        {
            Face_Init(&This->face[findex], 0, 0, tu, tv, findex, 1);
        }
    }
}
Пример #2
0
BOOL CSmartVillageApp::InitInstance()
{
	//XP数据库支持
	//ZOGNA//DOWN
	AfxOleInit();
	//CoInitialize(NULL);

	//AfxGetStaticModuleState();
//	AfxGetModuleState()->m_hCurrentInstanceHandle = GetModuleHandle(NULL); 
/*

	HRESULT hr = OleInitialize(NULL);   
	if(hr == S_FALSE)   
	{   
		OleUninitialize();   
	}   
	AfxEnableControlContainer();   
	COleObjectFactory::RegisterAll(); 
*/
	//当前路径
	GetCurrentDirectory(ZOG_MAX_PATH_STR, CurrentDir);
	sprintf(DlgSetSystem.SystemIniPath,"%s\\yrsysteminfo.ini",CurrentDir);
	
	//ZOGNA//UP
	//读系统配置表
	DlgSetSystem.Read2Dlg();

	CWzdSplash wndSplash;                 //创建启动窗口类的实例
	wndSplash.Create(IDB_SPLASH);
	wndSplash.CenterWindow();
	wndSplash.UpdateWindow();          //send WM_PAINT

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif


	////////////////lynn/////////////////
	////////////////lynn/////////////////
	int ioError = MySqlIO.ConnectionMySQL("YRSVDataBaseConfig.db");
	if(ioError == ReadFile_FAIL)
	{
		CDLGWarnning dlgw;
		dlgw.m_wintxt="连接数据库";					//窗口标题
		dlgw.m_warntxt="读数据库配置文件失败";	//窗口内容
		dlgw.DoModal();

		return FALSE;
	}
	else if(ioError == MySQLInit_FAIL)
	{
		CDLGWarnning dlgw;
		dlgw.m_wintxt="连接数据库";					//窗口标题
		dlgw.m_warntxt="数据库ADO初始化失败";	//窗口内容
		dlgw.DoModal();

		return FALSE;
	}
	else if(ioError == ContOpen_FAIL)
	{
		CDLGWarnning dlgw;
		dlgw.m_wintxt="连接数据库";					//窗口标题
		dlgw.m_warntxt="数据库无法连接:账号密码IP异常 或文件夹带()";	//窗口内容
		dlgw.DoModal();

		return FALSE;
	}
	else if(ioError == Connectd_DONE)
	{
		//MessageBox("连接数据库成功");
	}
#if OPEN_FACEDETECT_CODE
	//初始化人脸模型
	SetCurrentDirectory(CurrentDir);
	if(Face_Init("models", &RWmodule_handle) != 0)
	{
		CDLGWarnning dlgw;
		dlgw.m_wintxt="人脸模型";					//窗口标题
		dlgw.m_warntxt="人脸模型加载失败";	//窗口内容
		dlgw.DoModal();
	}
#endif

	wndSplash.DestroyWindow();//销毁初始画面窗口

	////////////////lynn/////////////////

	LPWSTR *szArglist = NULL;  
    int nArgs = 0;  
    szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);  
    if( nArgs > 1)  
    {  
		//szArglist就是保存参数的数组  
		//nArgs是数组中参数的个数  
		//数组的第一个元素表示进程的path,也就是szArglist[0],其他的元素依次是输入参数。  
		DlgLogin.SilentMode=TRUE;
		DlgLogin.flag=LOGIN_IN;
		DlgLogin.m_user = szArglist[1];
		DlgLogin.m_password = szArglist[2];
		//静默登陆
		DlgLogin.OnOK_Silent();
    }  
	else
	{
		DlgLogin.SilentMode=FALSE;
		//登陆框
		DlgLogin.flag=LOGIN_IN;
		if( IDCANCEL == DlgLogin.DoModal())
		{
#if OPEN_FACEDETECT_CODE
			Face_UnInit();
#endif
			return FALSE;
		}
	}
    //取得参数后,释放CommandLineToArgvW申请的空间  
    LocalFree(szArglist);  

		
	//主界面
	CSmartVillageDlg dlg;
	m_pMainWnd = &dlg;

	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

#if OPEN_FACEDETECT_CODE
	Face_UnInit();
#endif

	//ZOGNA//DOWN
	//CoUninitialize();
	//ZOGNA//UP

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}