Skip to content

Commit

Permalink
"Release 1.20 - November 15th, 2018 - Triangle Visibility Buffer with…
Browse files Browse the repository at this point in the history
… PBR | Ray Marching Unit Test | Font Rendering Dark Mode"
  • Loading branch information
JenkinsConffx committed Nov 16, 2018
1 parent 4d3687d commit daba419
Show file tree
Hide file tree
Showing 455 changed files with 16,368 additions and 6,552 deletions.
14 changes: 12 additions & 2 deletions Common_3/OS/Core/DebugRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ typedef struct GpuProfileDrawDesc GpuProfileDrawDesc;
void initDebugRendererInterface(Renderer* pRenderer, const char* pDebugFontPath, FSRoot root);
void removeDebugRendererInterface();


// adds font to DebugRenderer's Fontstash.
//
// Note that UIApp also has its own Fontstash container and its own DrawText() function.
//
uint32_t addDebugFont(const char* pFontPath, FSRoot root);


// draws the text using the font defined in DebugRenderer's Fontstash.
//
// This function is intended for debugging purposes. If the App wants to render
// text, it should be handled through the UIApp class and its interface instead of this one.
//
void drawDebugText(Cmd* pCmd, float x, float y, const char* pText, const TextDrawDesc* pDrawDesc);

//Use this if you need textRendering in WorldSpace
void drawDebugText(Cmd* pCmd, const mat4& mProjView ,const mat4& mWorldMat,const char* pText, const TextDrawDesc* pDrawDesc);

void drawDebugGpuProfile(Cmd* pCmd, float x, float y, GpuProfiler* pGpuProfiler, const GpuProfileDrawDesc* pDrawDesc);
void drawDebugTexture(Cmd* pCmd, float x, float y, float w, float h, Texture* pTexture, float r, float g, float b);
32 changes: 16 additions & 16 deletions Common_3/OS/Core/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ bool File::Open(const tinystl::string& _fileName, FileMode mode, FSRoot root)
return false;
}

pHandle = _openFile(fileName, pszFileAccessFlags[mode]);
pHandle = open_file(fileName, pszFileAccessFlags[mode]);

if (!pHandle)
{
Expand Down Expand Up @@ -431,7 +431,7 @@ void File::Close()
{
if (pHandle)
{
_closeFile(pHandle);
close_file(pHandle);
pHandle = 0;
mPosition = 0;
mSize = 0;
Expand All @@ -443,7 +443,7 @@ void File::Close()
void File::Flush()
{
if (pHandle)
_flushFile(pHandle);
flush_file(pHandle);
}

unsigned File::Read(void* dest, unsigned size)
Expand All @@ -467,11 +467,11 @@ unsigned File::Read(void* dest, unsigned size)

if (mReadSyncNeeded)
{
_seekFile(pHandle, mPosition + mOffset, SEEK_SET);
seek_file(pHandle, mPosition + mOffset, SEEK_SET);
mReadSyncNeeded = false;
}

size = (unsigned int)_readFile(dest, size, pHandle);
size = (unsigned int)read_file(dest, size, pHandle);
mWriteSyncNeeded = true;
mPosition += size;
return size;
Expand Down Expand Up @@ -503,7 +503,7 @@ unsigned File::Seek(unsigned position, SeekDir seekDir /* = SeekDir::SEEK_DIR_BE
default:
break;
}
_seekFile(pHandle, position + mOffset, origin);
seek_file(pHandle, position + mOffset, origin);
mPosition = position;
mReadSyncNeeded = false;
mWriteSyncNeeded = false;
Expand All @@ -529,17 +529,17 @@ unsigned File::Write(const void* data, unsigned size)

if (mWriteSyncNeeded)
{
_seekFile(pHandle, mPosition + mOffset, SEEK_SET);
seek_file(pHandle, mPosition + mOffset, SEEK_SET);
mWriteSyncNeeded = false;
}

// fwrite returns how many bytes were written.
// which should be the same as size.
// If not, then it's a write error.
if (_writeFile(data, size, pHandle) != 1)
if (write_file(data, size, pHandle) != 1)
{
// Return to the position where the write began
_seekFile(pHandle, mPosition + mOffset, SEEK_SET);
seek_file(pHandle, mPosition + mOffset, SEEK_SET);
LOGERROR("Error while writing to file " + GetName());
return 0;
}
Expand Down Expand Up @@ -699,15 +699,15 @@ void FileSystem::ClearModifiedRootPaths()

unsigned FileSystem::GetLastModifiedTime(const tinystl::string& fileName)
{
return (unsigned)_getFileLastModifiedTime(fileName);
return (unsigned)get_file_last_modified_time(fileName);
}

unsigned FileSystem::GetFileSize(FileHandle handle)
{
long curPos = _tellFile((::FILE*)handle);
_seekFile(handle, 0, SEEK_END);
size_t length = _tellFile((::FILE*)handle);
_seekFile((::FILE*)handle, curPos, SEEK_SET);
long curPos = tell_file((::FILE*)handle);
seek_file(handle, 0, SEEK_END);
size_t length = tell_file((::FILE*)handle);
seek_file((::FILE*)handle, curPos, SEEK_SET);
return (unsigned)length;
}

Expand Down Expand Up @@ -744,8 +744,8 @@ tinystl::string FileSystem::FixPath(const tinystl::string& pszFileName, FSRoot r

#ifdef TARGET_IOS
// iOS is deployed on the device so we need to get the
// bundle path via _getCurrentDir()
const tinystl::string currDir = _getCurrentDir();
// bundle path via get_current_dir()
const tinystl::string currDir = get_current_dir();
if (res.find(currDir, 0) == tinystl::string::npos)
res = currDir + "/" + res;
res.replace('\\', '/'); // eliminate windows separators here.
Expand Down
4 changes: 2 additions & 2 deletions Common_3/OS/Core/ThreadSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ Thread::Thread(ThreadPool* pThreadSystem)
pItem->pFunc = ThreadPool::ProcessItems;
pItem->mCompleted = false;

pHandle = _createThread(pItem);
pHandle = create_thread(pItem);
}

Thread::~Thread()
{
if (pHandle != 0)
{
_destroyThread(pHandle);
destroy_thread(pHandle);
conf_free(pItem);
}
}
Expand Down
46 changes: 23 additions & 23 deletions Common_3/OS/Interfaces/IFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ typedef void* FileHandle;

/// Low level file system interface providing basic file I/O operations
/// Implementations platform dependent
FileHandle _openFile(const char* filename, const char* flags);
void _closeFile(FileHandle handle);
void _flushFile(FileHandle handle);
size_t _readFile(void *buffer, size_t byteCount, FileHandle handle);
bool _seekFile(FileHandle handle, long offset, int origin);
long _tellFile(FileHandle handle);
size_t _writeFile(const void *buffer, size_t byteCount, FileHandle handle);
size_t _getFileLastModifiedTime(const char* _fileName);

tinystl::string _getCurrentDir();
tinystl::string _getExePath();
tinystl::string _getAppPrefsDir(const char* org, const char* app);
tinystl::string _getUserDocumentsDir();
void _getFilesWithExtension(const char* dir, const char* ext, tinystl::vector<tinystl::string>& filesOut);
bool _fileExists(const char* fileFullPath);

void _setCurrentDir(const char* path);
FileHandle open_file(const char* filename, const char* flags);
void close_file(FileHandle handle);
void flush_file(FileHandle handle);
size_t read_file(void *buffer, size_t byteCount, FileHandle handle);
bool seek_file(FileHandle handle, long offset, int origin);
long tell_file(FileHandle handle);
size_t write_file(const void *buffer, size_t byteCount, FileHandle handle);
size_t get_file_last_modified_time(const char* _fileName);

tinystl::string get_current_dir();
tinystl::string get_exe_path();
tinystl::string get_app_prefs_dir(const char* org, const char* app);
tinystl::string get_user_documents_dir();
void get_files_with_extensions(const char* dir, const char* ext, tinystl::vector<tinystl::string>& filesOut);
bool file_exists(const char* fileFullPath);

void set_current_dir(const char* path);

enum FileMode
{
Expand Down Expand Up @@ -284,13 +284,13 @@ class FileSystem
static tinystl::string FixPath(const tinystl::string& pszFileName, FSRoot root);
static bool FileExists(const tinystl::string& pszFileName, FSRoot root);

static tinystl::string GetCurrentDir() { return AddTrailingSlash(_getCurrentDir()); }
static tinystl::string GetProgramDir() { return GetPath(_getExePath()); }
static tinystl::string GetUserDocumentsDir() { return AddTrailingSlash(_getUserDocumentsDir()); }
static tinystl::string GetAppPreferencesDir(const tinystl::string& org, const tinystl::string& app) { return AddTrailingSlash(_getAppPrefsDir(org, app)); }
static void GetFilesWithExtension(const tinystl::string& dir, const tinystl::string& ext, tinystl::vector<tinystl::string>& files) { _getFilesWithExtension(dir.c_str(), ext.c_str(), files); }
static tinystl::string GetCurrentDir() { return AddTrailingSlash(get_current_dir()); }
static tinystl::string GetProgramDir() { return GetPath(get_exe_path()); }
static tinystl::string GetUserDocumentsDir() { return AddTrailingSlash(get_user_documents_dir()); }
static tinystl::string GetAppPreferencesDir(const tinystl::string& org, const tinystl::string& app) { return AddTrailingSlash(get_app_prefs_dir(org, app)); }
static void GetFilesWithExtension(const tinystl::string& dir, const tinystl::string& ext, tinystl::vector<tinystl::string>& files) { get_files_with_extensions(dir.c_str(), ext.c_str(), files); }

static void SetCurrentDir(const tinystl::string& path) { _setCurrentDir(path.c_str()); }
static void SetCurrentDir(const tinystl::string& path) { set_current_dir(path.c_str()); }

static void SplitPath(const tinystl::string& fullPath, tinystl::string* pathName, tinystl::string* fileName, tinystl::string* extension, bool lowercaseExtension = true);
static tinystl::string GetPath(const tinystl::string& fullPath);
Expand Down
6 changes: 3 additions & 3 deletions Common_3/OS/Interfaces/IThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ typedef void* ThreadHandle;
typedef pthread_t ThreadHandle;
#endif

ThreadHandle _createThread(WorkItem* pItem);
void _destroyThread(ThreadHandle handle);
void _joinThread(ThreadHandle handle);
ThreadHandle create_thread(WorkItem* pItem);
void destroy_thread(ThreadHandle handle);
void join_thread(ThreadHandle handle);

struct Thread
{
Expand Down
26 changes: 13 additions & 13 deletions Common_3/OS/Linux/LinuxFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,44 +53,44 @@ const char* pszRoots[FSR_Count] =
};


FileHandle _openFile(const char* filename, const char* flags)
FileHandle open_file(const char* filename, const char* flags)
{
FILE* fp;
fp = fopen(filename, flags);
return fp;
}

void _closeFile(FileHandle handle)
void close_file(FileHandle handle)
{
fclose((::FILE*)handle);
}

void _flushFile(FileHandle handle)
void flush_file(FileHandle handle)
{
fflush((::FILE*)handle);
}

size_t _readFile(void *buffer, size_t byteCount, FileHandle handle)
size_t read_file(void *buffer, size_t byteCount, FileHandle handle)
{
return fread(buffer, 1, byteCount, (::FILE*)handle);
}

bool _seekFile(FileHandle handle, long offset, int origin)
bool seek_file(FileHandle handle, long offset, int origin)
{
return fseek((::FILE*)handle, offset, origin) == 0;
}

long _tellFile(FileHandle handle)
long tell_file(FileHandle handle)
{
return ftell((::FILE*)handle);
}

size_t _writeFile(const void *buffer, size_t byteCount, FileHandle handle)
size_t write_file(const void *buffer, size_t byteCount, FileHandle handle)
{
return fwrite(buffer, byteCount, 1, (::FILE*)handle);
}

size_t _getFileLastModifiedTime(const char* _fileName)
size_t get_file_last_modified_time(const char* _fileName)
{
struct stat fileInfo;

Expand All @@ -105,14 +105,14 @@ size_t _getFileLastModifiedTime(const char* _fileName)
}
}

tinystl::string _getCurrentDir()
tinystl::string get_current_dir()
{
char curDir[MAX_PATH];
getcwd(curDir, sizeof(curDir));
return tinystl::string (curDir);
}

tinystl::string _getExePath()
tinystl::string get_exe_path()
{
char exeName[MAX_PATH];
exeName[0] = 0;
Expand All @@ -121,7 +121,7 @@ tinystl::string _getExePath()
return tinystl::string(exeName);
}

tinystl::string _getAppPrefsDir(const char *org, const char *app)
tinystl::string get_app_prefs_dir(const char *org, const char *app)
{
const char* homedir;

Expand All @@ -132,7 +132,7 @@ tinystl::string _getAppPrefsDir(const char *org, const char *app)
return tinystl::string(homedir);
}

tinystl::string _getUserDocumentsDir()
tinystl::string get_user_documents_dir()
{
const char* homedir;
if ((homedir = getenv("HOME")) == NULL)
Expand All @@ -145,7 +145,7 @@ tinystl::string _getUserDocumentsDir()
return homeString;
}

void _setCurrentDir(const char* path)
void set_current_dir(const char* path)
{
// change working directory
// http://man7.org/linux/man-pages/man2/chdir.2.html
Expand Down
6 changes: 3 additions & 3 deletions Common_3/OS/Linux/LinuxThreadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ bool Thread::IsMainThread()
return GetCurrentThreadID() == mainThreadID;
}

ThreadHandle _createThread(WorkItem* pData)
ThreadHandle create_thread(WorkItem* pData)
{
pthread_t handle;
int res = pthread_create(&handle,NULL,ThreadFunctionStatic,pData);
assert(res==0);
return (ThreadHandle)handle;
}

void _destroyThread(ThreadHandle handle)
void destroy_thread(ThreadHandle handle)
{
pthread_join(handle, NULL);
handle = NULL;
}

void _joinThread(ThreadHandle handle)
void join_thread(ThreadHandle handle)
{
pthread_join(handle, NULL);
}
Expand Down
Loading

0 comments on commit daba419

Please sign in to comment.