Skip to content

Commit 9db78c0

Browse files
committed
*Artist parameters (shader constants, etc.) can now be modified at run-time by using the arrow buttons
*Rendering will now pause when application is not in focus *Added high resolution timer for better delta time precision *Added support for multithreaded resource loading *32-bit binaries are now exported in the 'Bin/x86/' folder (instead of Win32) *Moved all platform specific code to Framework class *Added Gainput library for platform independent input handling *Added FreeType 2.6 library for rendering on-screen text *Created a new pass which uses FreeType 2.6 to render text in a texture which then gets drawn on-screen *Removed the depth bias from DeferrredLightDir shader in favor of depth bias and slope scale depth bias render states set before rendering each cascade *Fixed a bug in RSMUpscale shader *Added a NoPCF() utility function in Utils.hlsl which has the same prototype as the other PCF functions *Fixed some shadow map issues *Shaders are now compiled during the build process via a custom build step in order for errors to be easier to fix; the outputs are assembly vertex and pixel programs (*vsasm *psasm) which are not used by the actual program, but allow Visual Studio to decide whether or not to recompile shaders (it's a lengthy process) *Disabled bokeh DoF effect by default since it is very expensive *Added a font file (Arial) *Made some minor modifications to project files with regard to intermediary and output directories *Removed debug information from Release builds *Added some checks for null pointers in ResourceManager class *Fixed some invalid file references in LibRenderer project (it did not affect the build process, but it would cause it to always rebuild) *Organized file filters in all projects
1 parent 8816bc1 commit 9db78c0

File tree

811 files changed

+248976
-1368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

811 files changed

+248976
-1368
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ bld/
1919
[Oo]bj/
2020
[Bb]in[Tt]emp/
2121

22+
*.vsasm
23+
*.psasm
24+
2225
# Roslyn cache directories
2326
*.ide/
2427

GITechDemo/Build/build_win.py

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
import os
22
import shutil
33
import fnmatch
44
import errno
@@ -14,50 +14,49 @@
1414
BUILD_CONFIGURATION = "Release"
1515

1616
def copyfiles(srcdir, dstdir, filepattern):
17-
def failed(exc):
18-
raise exc
19-
20-
for dirpath, dirs, files in os.walk(srcdir, topdown=True, onerror=failed):
21-
for file in fnmatch.filter(files, filepattern):
22-
shutil.copy2(os.path.join(dirpath, file), dstdir)
23-
break # no recursion
17+
def failed(exc):
18+
raise exc
19+
for dirpath, dirs, files in os.walk(srcdir, topdown=True, onerror=failed):
20+
for file in fnmatch.filter(files, filepattern):
21+
shutil.copy2(os.path.join(dirpath, file), dstdir)
22+
break # no recursion
2423

2524
def makedir(path):
26-
try:
27-
os.makedirs(path)
28-
except OSError as exception:
29-
if exception.errno != errno.EEXIST:
30-
raise
25+
try:
26+
os.makedirs(path)
27+
except OSError as exception:
28+
if exception.errno != errno.EEXIST:
29+
raise
3130

3231
def copytree(src, dst, symlinks = False, ignore = None):
33-
if not os.path.exists(dst):
34-
os.makedirs(dst)
35-
shutil.copystat(src, dst)
36-
lst = os.listdir(src)
37-
if ignore:
38-
excl = ignore(src, lst)
39-
lst = [x for x in lst if x not in excl]
40-
for item in lst:
41-
s = os.path.join(src, item)
42-
d = os.path.join(dst, item)
43-
if symlinks and os.path.islink(s):
44-
if os.path.lexists(d):
45-
os.remove(d)
46-
os.symlink(os.readlink(s), d)
47-
try:
48-
st = os.lstat(s)
49-
mode = stat.S_IMODE(st.st_mode)
50-
os.lchmod(d, mode)
51-
except:
52-
pass # lchmod not available
53-
elif os.path.isdir(s):
54-
copytree(s, d, symlinks, ignore)
55-
else:
56-
shutil.copy2(s, d)
32+
if not os.path.exists(dst):
33+
os.makedirs(dst)
34+
shutil.copystat(src, dst)
35+
lst = os.listdir(src)
36+
if ignore:
37+
excl = ignore(src, lst)
38+
lst = [x for x in lst if x not in excl]
39+
for item in lst:
40+
s = os.path.join(src, item)
41+
d = os.path.join(dst, item)
42+
if symlinks and os.path.islink(s):
43+
if os.path.lexists(d):
44+
os.remove(d)
45+
os.symlink(os.readlink(s), d)
46+
try:
47+
st = os.lstat(s)
48+
mode = stat.S_IMODE(st.st_mode)
49+
os.lchmod(d, mode)
50+
except:
51+
pass # lchmod not available
52+
elif os.path.isdir(s):
53+
copytree(s, d, symlinks, ignore)
54+
else:
55+
shutil.copy2(s, d)
5756

5857
def buildsln(pathToTools, envSetupBat, platform, buildConfig):
5958
os.environ["PATH"] += os.pathsep + pathToTools
60-
cmd =envSetupBat + " && MSBuild.exe /maxcpucount /p:Configuration=" + buildConfig + " /p:Platform=" + platform
59+
cmd = envSetupBat + " && MSBuild.exe /maxcpucount /p:Configuration=" + buildConfig + " /p:Platform=" + platform
6160
if(FORCE_REBUILD):
6261
cmd += " /t:rebuild "
6362
else:
@@ -126,8 +125,8 @@ def buildsln(pathToTools, envSetupBat, platform, buildConfig):
126125
copyfiles("../Bin/x64/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME + "/", rootBuildDir + "/bin/x64", "*.dll")
127126

128127
# Copy 32bit binaries
129-
copyfiles("../Bin/Win32/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME + "/", rootBuildDir + "/bin/x86", "*.exe")
130-
copyfiles("../Bin/Win32/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME + "/", rootBuildDir + "/bin/x86", "*.dll")
128+
copyfiles("../Bin/x86/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME + "/", rootBuildDir + "/bin/x86", "*.exe")
129+
copyfiles("../Bin/x86/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME + "/", rootBuildDir + "/bin/x86", "*.dll")
131130

132131
# Copy data
133132
copytree("../Data/", rootBuildDir + "/data")
@@ -154,4 +153,4 @@ def buildsln(pathToTools, envSetupBat, platform, buildConfig):
154153
exit")
155154
x86bat.close()
156155

157-
print("DONE!")
156+
print("DONE!")
Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,48 @@
11
#ifndef APP_H_
22
#define APP_H_
33

4-
#define CREATE_APP(CLASS) App* AppMain = new CLASS();
4+
#include <gainput/gainput.h>
5+
6+
#include <gmtl\gmtl.h>
7+
using namespace gmtl;
8+
9+
#define CREATE_APP(CLASS) \
10+
CLASS AppMainRef; \
11+
AppFramework::App* AppFramework::AppMain = &AppMainRef;
512

613
#define IMPLEMENT_APP(CLASS) \
714
CLASS (); \
815
~ CLASS (); \
9-
void Init(void* hWnd); \
16+
bool Init(void* hWnd); \
17+
void LoadResources(unsigned int thId, unsigned int thCount); \
1018
void Update(const float fDeltaTime); \
1119
void Draw();
1220

13-
#include <gmtl\gmtl.h>
14-
using namespace gmtl;
15-
16-
class App
21+
namespace gainput
1722
{
18-
public:
19-
virtual ~App() {}
20-
21-
virtual void Init(void* hWnd) = 0;
22-
virtual void Update(const float fDeltaTime) = 0;
23-
virtual void Draw() = 0;
23+
class InputManager;
24+
}
2425

25-
struct Camera
26+
namespace AppFramework
27+
{
28+
class App
2629
{
27-
Camera() : fSpeedFactor(1.f) {}
30+
public:
31+
App() { m_pInputManager = new gainput::InputManager(); }
32+
virtual ~App() { if (m_pInputManager) delete m_pInputManager; }
2833

29-
Vec3f vPos;
30-
Matrix44f mRot;
31-
Vec3f vMoveVec;
32-
float fSpeedFactor;
33-
};
34+
virtual bool Init(void* hWnd) = 0;
35+
virtual void LoadResources(unsigned int thId, unsigned int thCount) = 0;
36+
virtual void Update(const float fDeltaTime) = 0;
37+
virtual void Draw() = 0;
3438

35-
Camera& GetCamera() { return tCamera; }
39+
gainput::InputManager* GetInputManager() { return m_pInputManager; }
3640

37-
protected:
38-
Camera tCamera;
39-
};
41+
protected:
42+
gainput::InputManager* m_pInputManager;
43+
};
4044

41-
extern App* AppMain;
45+
extern App* AppMain;
46+
}
4247

4348
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ifndef FRAMEWORK_H_
2+
#define FRAMEWORK_H_
3+
4+
namespace AppFramework
5+
{
6+
class Framework
7+
{
8+
public:
9+
Framework() { m_pInstance = this; };
10+
virtual ~Framework() { m_pInstance = nullptr; };
11+
12+
virtual int Run() = 0;
13+
static Framework* const GetInstance() { return m_pInstance; }
14+
15+
// Low level, platform specific functionality required by the application
16+
virtual void ShowCursor(const bool bShow) = 0;
17+
virtual bool IsCursorHidden() = 0;
18+
virtual void SetCursorAtPos(const int x, const int y) = 0;
19+
virtual void GetClientArea(int& left, int& top, int& right, int& bottom) = 0;
20+
virtual void GetWindowArea(int& left, int& top, int& right, int& bottom) = 0;
21+
22+
protected:
23+
virtual unsigned int GetTicks() = 0;
24+
virtual float CalculateDeltaTime() = 0; // in miliseconds
25+
26+
static Framework* m_pInstance;
27+
};
28+
}
29+
30+
#endif // FRAMEWORK_H_
Binary file not shown.

0 commit comments

Comments
 (0)