// output log information void DirectLight::OutputLog() const { LOG_HEADER( "Integrator" ); LOG<<"Integrator algorithm : Direct Light Integrator."<<ENDL; LOG<<"It supports direct lighting , specular reflection and specular refraction."<<ENDL; LOG<<"Soft shadow and area light are also supported in the algorithm."<<ENDL; LOG<<"Indirect lighting , like color bleeding , caustics , is not supported."<<ENDL<<ENDL; }
// output log information void PathTracing::OutputLog() const { LOG_HEADER( "Integrator" ); LOG<<"Integrator algorithm : Path Tracing."<<ENDL; LOG<<"It supports all of the features in direct lighting algorithm."<<ENDL; LOG<<"Some global illumination effect is also supported in path tracing."<<ENDL; LOG<<"While it requires much more samples to reduce the noise to an acceptable level."<<ENDL<<ENDL; }
// output log information void Bvh::OutputLog() const { LOG_HEADER( "Accelerator" ); LOG<<"Accelerator Type :\tBounding Volumn Hierarchy"<<ENDL; LOG<<"BVH Depth :\t"<<m_bvhDepth<<ENDL; LOG<<"Total Node Count :\t"<<m_totalNode<<ENDL; LOG<<"Inner Node Count :\t"<<m_totalNode - m_leafNode<<ENDL; LOG<<"Leaf Node Count :\t"<<m_leafNode<<ENDL; LOG<<"Triangles per leaf:\t"<<(((float)m_primitives->size())/m_leafNode)<<ENDL; LOG<<"Max triangles in leaf:\t"<<m_maxLeafTriNum<<ENDL<<ENDL; }
HRESULT CRARFileSource::ScanArchive (wchar_t *archive_name, CRFSList<CRFSFile> *file_list, int *files_found, int *ok_files_found) { DWORD dwBytesRead; char *filename = NULL; wchar_t *current_rar_filename = NULL, *rar_ext; bool first_archive_file = true, rewind; bool multi_volume = false, new_numbering = false; rar_header_t rh; BYTE marker [7]; BYTE expected [7] = { 0x52, 0x61, 0x72, 0x21, 0x1A, 0x07, 0x00 }; CRFSFilePart *new_part, *prev_part; LONGLONG collected; DWORD ret; DWORD volumes = 0; int volume_digits; CRFSFile *file = NULL; *ok_files_found = 0; int compressed_files_found = 0; int encrypted_files_found = 0; LARGE_INTEGER zero = {0}; MediaType *mType; CRFSList<MediaType> mediaTypeList (true); Anchor<CRFSFile> af (&file); ArrayAnchor<wchar_t> acrf (¤t_rar_filename); HANDLE hFile = INVALID_HANDLE_VALUE; Anchor<HANDLE> ha (&hFile); int cch = lstrlen (archive_name) + 1; current_rar_filename = new wchar_t [cch]; if (!current_rar_filename) { ErrorMsg (0, L"Out of memory."); return E_OUTOFMEMORY; } CopyMemory (current_rar_filename, archive_name, cch * sizeof (wchar_t)); rar_ext = wcsrchr (current_rar_filename, '.'); if (getMediaTypeList (&mediaTypeList) == -1) return E_OUTOFMEMORY; // Scan through archive volume(s) while (true) { ha.Close (); DbgLog((LOG_TRACE, 2, L"Loading file \"%s\".", current_rar_filename)); hFile = CreateFile (current_rar_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) { if (first_archive_file || rewind) { ErrorMsg (GetLastError (), L"Could not open file \"%s\".", current_rar_filename); return E_FAIL; } else break; } rewind = false; // Read marker. if (!ReadFile (hFile, marker, 7, &dwBytesRead, NULL) || dwBytesRead != 7) { ErrorMsg (GetLastError (), L"Could not read RAR header."); return E_FAIL; } if (memcmp (marker, expected, 7)) { ErrorMsg (0, L"Incorrect RAR marker."); return E_UNEXPECTED; } // Read archive header. if (ret = ReadHeader (hFile, &rh)) return ret; LOG_HEADER(&rh); if (rh.ch.type != HEADER_TYPE_ARCHIVE) { ErrorMsg (0, L"Unexpected RAR header type."); return E_UNEXPECTED; } if (rh.ch.flags & MHD_PASSWORD) { ErrorMsg (0, L"Encrypted RAR volumes are not supported."); return RFS_E_ENCRYPTED; } if (first_archive_file) { new_numbering = !!(rh.ch.flags & MHD_NEWNUMBERING); multi_volume = !!(rh.ch.flags & MHD_VOLUME); if (multi_volume) { if (!rar_ext) { ErrorMsg (0, L"Input file does not end with .rar"); return E_UNEXPECTED; } // Locate volume counter if (new_numbering) { volume_digits = 0; do { rar_ext --; volume_digits ++; } while (iswdigit (*(rar_ext - 1))); } else { rar_ext += 2; volume_digits = 2; } if (!(rh.ch.flags & MHD_FIRSTVOLUME)) { DbgLog((LOG_TRACE, 2, L"Rewinding to the first file in the set.")); UpdateArchiveName (rar_ext, volume_digits, volumes, new_numbering); first_archive_file = false; rewind = true; continue; } } } else { ASSERT (new_numbering == !!(rh.ch.flags & MHD_NEWNUMBERING)); ASSERT (rh.ch.flags & MHD_VOLUME); } // Find file headers while (true) { // Read file header. if (ret = ReadHeader (hFile, &rh)) { if (ret == ERROR_HANDLE_EOF) break; else return ret; } LOG_HEADER(&rh); if (rh.ch.type == HEADER_TYPE_END) { // TODO: Verify that the volume number in the header matches our volume counter. // Check for EARC_NEXT_VOLUME removed as this flag is missing on some archives. break; } if (rh.ch.type != HEADER_TYPE_FILE) { SetFilePointerEx (hFile, rh.bytesRemaining, NULL, FILE_CURRENT); DbgLog((LOG_TRACE, 2, L"Skipping unknown header of type %02x.", rh.ch.type)); continue; } DbgLog((LOG_TRACE, 2, L"SIZE %08lx %08lx OS %02x CRC %08lx TIMESTAMP %08lx VERSION %d METHOD %02x LEN %04lx ATTRIB %08lx", rh.fh.size.HighPart, rh.fh.size.LowPart, rh.fh.os, rh.fh.crc, rh.fh.timestamp, rh.fh.version, rh.fh.method, rh.fh.name_len, rh.fh.attributes)); DbgLog((LOG_TRACE, 2, L"FILENAME \"%S\"", rh.fh.filename)); if ((rh.ch.flags & LHD_WINDOWMASK) == LHD_DIRECTORY) { DbgLog((LOG_TRACE, 2, L"Skipping directory.")); HEADER_SKIP_FILE } if (filename) { if (strcmp (filename, rh.fh.filename)) { // TODO: We should probably dump the old file start fresh with this one // since the lazy error handling at other places may cause us to end up here. DbgLog((LOG_TRACE, 2, L"Incorrect file found.")); HEADER_SKIP_FILE } if (!(rh.ch.flags & LHD_SPLIT_BEFORE)) { // TODO: Decide if it's better to ignore the missing flag. DbgLog((LOG_TRACE, 2, L"LHD_SPLIT_BEFORE flag was not set as expected.")); HEADER_SKIP_FILE } delete [] rh.fh.filename; }