void bgExporterMax::ExpScene() { struct tm *newtime; time_t aclock; time(&aclock); newtime = localtime(&aclock); TSTR today = _tasctime(newtime); today.remove(today.length() - 1); _ftprintf(m_pStream, _T("%s\t%s\n"), _T("#BG3D_MODEL"), FixupName(today)); // 날짜 _ftprintf(m_pStream, _T("%s\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n"), _T("#SCENE_INFO"), m_Scene.iVersion, // 버전 m_Scene.iFirstFrame, // 시작 프레임 m_Scene.iLastFrame, // 마지막 프레임 m_Scene.iFrameSpeed, // 프레임 스피드 m_Scene.iTickPerFrame, // 프레임당 틱 m_Scene.iNumMesh, // 메시 갯수 m_Scene.iMaxWeight, // 가중치 m_Scene.iBindPose); // 바인드포즈 }
/****************************************************************************** * \name _tctime * \brief Converts a time_t value into a string and returns a pointer to it. * \param time Pointer to the UTC time. * \remarks The string is stored in thread local buffer, shared between * ctime, gmtime and localtime (both 32 and 64 bit versions). */ _TCHAR * _tctime(const time_t *ptime) { struct tm *ptm = localtime(ptime); if (!ptm) { return 0; } return _tasctime(ptm); }
_TSCHAR * __cdecl _tctime ( const time_t *timp ) { struct tm *tmtemp; if ((tmtemp=localtime(timp)) != NULL) return(_tasctime((const struct tm *)tmtemp)); else return(NULL); }
_TSCHAR * __cdecl _tctime64 ( const __time64_t *timp ) { struct tm tmtemp; errno_t e; _VALIDATE_RETURN( ( timp != NULL ), EINVAL, NULL ) _VALIDATE_RETURN_NOEXC( ( *timp >= 0 ), EINVAL, NULL ) e = _localtime64_s(&tmtemp, timp); if ( e == 0 ) { _BEGIN_SECURE_CRT_DEPRECATION_DISABLE return _tasctime(&tmtemp); _END_SECURE_CRT_DEPRECATION_DISABLE }
// Dump some global animation information. void Exporter::ExportGlobalInfo() { Interval range = ip->GetAnimRange(); struct tm *newtime; time_t aclock; time( &aclock ); newtime = localtime(&aclock); TSTR today = _tasctime(newtime); // The date string has a \n appended. today.remove(today.length()-1); // Remove the \n strcpy(rsm->MaxFileName,FixupName(ip->GetCurFilePath())); // Texmap* env = ip->GetEnvironmentMap(); }
/** * Re-print report to log, aligning markers */ void anchors_print(summary_stat_t * totals) { time_t timer; anchored_line_t * line; TCHAR * buf = malloc((g_anchors[ANCHORS_COUNT-1]+1)*sizeof(TCHAR)); timer = time(NULL); _ftprintf(g_report_file, _T("\n===============================================================================")); _ftprintf(g_report_file, _T("\nCurrent time is %s"), _tasctime(localtime(&timer))); // Output lines from linked list while (NULL != (line = g_first_line)) { TCHAR * p = line->line; if (buf && line->anchors[0]) { int i=0,j,k=0; for (j = 0; j < ANCHORS_COUNT; j++) { while(i < line->anchors[j] && (buf[k++] = p[i]) != 0) { i++; } while(k < g_anchors[j]) { buf[k++] = ' '; } } buf[k] = '\0'; p = buf; } _fputts(p, g_report_file); g_first_line = g_first_line->link; free(line); } print_totals(totals, g_report_file); if(buf) free(buf); }
int OpenDebugLog() { #if defined (FBA_DEBUG) #if defined (APP_DEBUG_LOG) time_t nTime; tm* tmTime; time(&nTime); tmTime = localtime(&nTime); { // Initialise the debug log file #ifdef _UNICODE DebugLog = _tfopen(_T("zzBurnDebug.html"), _T("wb")); if (ftell(DebugLog) == 0) { WRITE_UNICODE_BOM(DebugLog); _ftprintf(DebugLog, _T("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">")); _ftprintf(DebugLog, _T("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=unicode\"></head><body><pre>")); } #else DebugLog = _tfopen(_T("zzBurnDebug.html"), _T("wt")); if (ftell(DebugLog) == 0) { _ftprintf(DebugLog, _T("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">")); _ftprintf(DebugLog, _T("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=windows-%i\"></head><body><pre>"), GetACP()); } #endif _ftprintf(DebugLog, _T("</font><font size=larger color=#000000>")); _ftprintf(DebugLog, _T("Debug log created by ") _T(APP_TITLE) _T(" v%.20s on %s\n<br>"), szAppBurnVer, _tasctime(tmTime)); } #endif { // Initialise the debug console COORD DebugBufferSize = { 80, 1000 }; { // Since AttachConsole is only present in Windows XP, import it manually #if _WIN32_WINNT >= 0x0500 && defined (_MSC_VER) // #error Manually importing AttachConsole() function, but compiling with _WIN32_WINNT >= 0x0500 if (!AttachConsole(ATTACH_PARENT_PROCESS)) { AllocConsole(); } #else #define ATTACH_PARENT_PROCESS ((DWORD)-1) BOOL (WINAPI* pAttachConsole)(DWORD dwProcessId) = NULL; HINSTANCE hKernel32DLL = LoadLibrary(_T("kernel32.dll")); if (hKernel32DLL) { pAttachConsole = (BOOL (WINAPI*)(DWORD))GetProcAddress(hKernel32DLL, "AttachConsole"); } if (pAttachConsole) { if (!pAttachConsole(ATTACH_PARENT_PROCESS)) { AllocConsole(); } } else { AllocConsole(); } if (hKernel32DLL) { FreeLibrary(hKernel32DLL); } #undef ATTACH_PARENT_PROCESS #endif } DWORD ignore; DebugBuffer = CreateConsoleScreenBuffer(GENERIC_WRITE, FILE_SHARE_READ, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); SetConsoleScreenBufferSize(DebugBuffer, DebugBufferSize); SetConsoleActiveScreenBuffer(DebugBuffer); SetConsoleTitle(_T(APP_TITLE) _T(" Debug console")); SetConsoleTextAttribute(DebugBuffer, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); _sntprintf(szConsoleBuffer, 1024, _T("Welcome to the ") _T(APP_TITLE) _T(" debug console.\n")); WriteConsole(DebugBuffer, szConsoleBuffer, _tcslen(szConsoleBuffer), &ignore, NULL); SetConsoleTextAttribute(DebugBuffer, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); if (DebugLog) { _sntprintf(szConsoleBuffer, 1024, _T("Debug messages are logged in zzBurnDebug.html")); if (!DebugLog || bEchoLog) { _sntprintf(szConsoleBuffer + _tcslen(szConsoleBuffer), 1024 - _tcslen(szConsoleBuffer), _T(", and echod to this console")); } _sntprintf(szConsoleBuffer + _tcslen(szConsoleBuffer), 1024 - _tcslen(szConsoleBuffer), _T(".\n\n")); } else { _sntprintf(szConsoleBuffer, 1024, _T("Debug messages are echod to this console.\n\n")); } WriteConsole(DebugBuffer, szConsoleBuffer, _tcslen(szConsoleBuffer), &ignore, NULL); } nPrevConsoleStatus = -1; bprintf = AppDebugPrintf; // Redirect Burn library debug to our function #endif return 0; }
bool GBoneObj::Load(ID3D11Device* pDevice,const TCHAR* szLoadName,const TCHAR* pLoadShaderFile,bool bThread) { FILE *fp; fp = _tfopen(szLoadName, _T("rb")); if (!fp) return false; char szBuffer[MAX_PATH] = { 0, }; size_t convertedChars = 0; tm newtime; fread(&newtime, sizeof(tm), 1, fp); T_STR today = _tasctime(&newtime); // The date string has a \n appended. today[today.size() - 1] = 0; fread(&m_Scene, sizeof(TScene), 1, fp); // 시작 프레임이 0일 아닐 경우가 있기 때문에 무조건 // 시작 프레임을 0으로 맞춘다.( 해당 프레임 만큼만 배열 할당 된다.) m_iStartFrame = 0;//m_Scene.iFirstFrame; m_iLastFrame = m_Scene.iLastFrame - m_Scene.iFirstFrame; m_fElapseTime = (float)m_iStartFrame; m_Scene.iFirstFrame = 0; m_Scene.iLastFrame = m_iLastFrame; SAFE_NEW_ARRAY_CLEAR(m_pMatrix, D3DXMATRIX, m_Scene.iNumMesh); SAFE_NEW_ARRAY_CLEAR(m_ppAniMatrix, LPD3DXMATRIX, m_Scene.iNumMesh); SAFE_NEW_ARRAY_CLEAR(m_ppAniQuater, LPD3DXQUATERNION, m_Scene.iNumMesh); SAFE_NEW_ARRAY_CLEAR(m_ppScaleVector, LPD3DXVECTOR3, m_Scene.iNumMesh); SAFE_NEW_ARRAY_CLEAR(m_ppTransVector, LPD3DXVECTOR3, m_Scene.iNumMesh); int iNumFrame = m_iLastFrame - m_iStartFrame; for (int i = 0; i < m_Scene.iNumMesh; i++) { SAFE_NEW_ARRAY(m_ppAniMatrix[i], D3DXMATRIX, iNumFrame); SAFE_NEW_ARRAY(m_ppAniQuater[i], D3DXQUATERNION, iNumFrame); SAFE_NEW_ARRAY(m_ppScaleVector[i], D3DXVECTOR3, iNumFrame); SAFE_NEW_ARRAY(m_ppTransVector[i], D3DXVECTOR3, iNumFrame); } D3DXQUATERNION qRotate; D3DXVECTOR3 vScale, vTrans; D3DXMATRIX matFrameWorld; for (int ibip = 0; ibip < m_Scene.iNumMesh; ibip++) { for (int iFrame = 0; iFrame < iNumFrame; iFrame++) { fread(&m_ppAniMatrix[ibip][iFrame], sizeof(D3DXMATRIX), 1, fp); } } for (int ibip = 0; ibip < m_Scene.iNumMesh; ibip++) { shared_ptr<tMatMesh> pData = make_shared<tMatMesh>(); shared_ptr<GMesh> pMesh = make_shared<GMesh>(); int iCount; TCHAR szBuffer[256] = { 0, }; TCHAR szName[256] = { 0, }; fread(&pMesh->m_ClassType, sizeof(int), 1, fp); fread(&iCount, sizeof(int), 1, fp); fread(szName, sizeof(TCHAR) * iCount, 1, fp); pMesh->m_strNodeName = szName; fread(&pMesh->m_matWorld, sizeof(D3DXMATRIX), 1, fp); D3DXMatrixInverse(&pData->m_matInverse, 0, &pMesh->m_matWorld); fread(&iCount, sizeof(int), 1, fp); // 메쉬 버텍스 리스트 if (iCount == 2) { pData->m_VertexArray.resize(36); m_iMaxVertex += 36; } else { pData->m_VertexArray.resize(iCount); m_iMaxVertex += iCount; } for (int iVertex = 0; iVertex < iCount; iVertex++) { fread(&pData->m_VertexArray[iVertex], sizeof(PNC_VERTEX), 1, fp); if (m_Scene.iBindPose) { D3DXVec3TransformCoord(&pData->m_VertexArray[iVertex].p, &pData->m_VertexArray[iVertex].p, &pData->m_matInverse); } } // 본과 더미 오브젝트( 최대 및 최소값 2개 출력되어 있음 ) if (iCount == 2) { D3DXVECTOR3 Quad[8]; D3DXVECTOR3 vMax = pData->m_VertexArray[0].p; D3DXVECTOR3 vMin = pData->m_VertexArray[1].p; Quad[0] = D3DXVECTOR3(vMin.x, vMin.y, vMin.z); Quad[1] = D3DXVECTOR3(vMin.x, vMax.y, vMin.z); Quad[2] = D3DXVECTOR3(vMax.x, vMax.y, vMin.z); Quad[3] = D3DXVECTOR3(vMax.x, vMin.y, vMin.z); Quad[4] = D3DXVECTOR3(vMin.x, vMin.y, vMax.z); Quad[5] = D3DXVECTOR3(vMin.x, vMax.y, vMax.z); Quad[6] = D3DXVECTOR3(vMax.x, vMax.y, vMax.z); Quad[7] = D3DXVECTOR3(vMax.x, vMin.y, vMax.z); SetBoundBox(Quad, pData.get()); } pMesh->m_iNumFace = pData->m_VertexArray.size() / 3; m_pMesh.push_back(pMesh); m_pData.push_back(pData); } for (int ibip = 0; ibip < m_Scene.iNumMesh; ibip++) { for (int jFrame = 0; jFrame < m_iLastFrame - m_iStartFrame; jFrame++) { if (m_Scene.iBindPose) { //m_ppAniMatrix[ibip][jFrame] = m_pData[ibip]->m_matWorld * m_ppAniMatrix[ibip][jFrame]; } if (SUCCEEDED(D3DXMatrixDecompose(&vScale, &qRotate, &vTrans, &m_ppAniMatrix[ibip][jFrame]))) { m_ppAniQuater[ibip][jFrame] = qRotate; m_ppScaleVector[ibip][jFrame] = vScale; m_ppTransVector[ibip][jFrame] = vTrans; } else { D3DXQuaternionRotationMatrix(&m_ppAniQuater[ibip][jFrame], &m_ppAniMatrix[ibip][jFrame]); } } } fclose(fp); m_dxobj.m_iNumVertex = m_iMaxVertex; m_dxobj.m_iNumIndex = m_iMaxIndex; m_dxobj.m_iVertexSize = sizeof(PNC_VERTEX); if (!bThread && !Create(pDevice, pLoadShaderFile)) { return false; } return true; }