-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2344dc
commit 96fac9e
Showing
17 changed files
with
168 additions
and
54 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"CurrentProjectSetting": "x64-Debug" | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"OutputFoldersPerTargetSystem": { | ||
"本地计算机": [ | ||
"out\\build\\x64-Debug", | ||
"out\\install\\x64-Debug" | ||
] | ||
}, | ||
"ExpandedNodes": [ | ||
"", | ||
"\\examples", | ||
"\\examples\\helloTri", | ||
"\\include", | ||
"\\include\\utils", | ||
"\\src", | ||
"\\src\\utils" | ||
], | ||
"SelectedNode": "\\examples\\helloTri\\helloTri.cpp", | ||
"PreviewInSolutionExplorer": true | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": "0.2.1", | ||
"defaults": {}, | ||
"configurations": [ | ||
{ | ||
"type": "default", | ||
"project": "CMakeLists.txt", | ||
"projectTarget": "helloTri.exe (examples\\helloTri\\helloTri.exe)", | ||
"name": "helloTri.exe (examples\\helloTri\\helloTri.exe)" | ||
} | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ target_include_directories( | |
target_link_libraries( | ||
helloTri | ||
PUBLIC | ||
Shift | ||
shift_lib | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include <bgfx/bgfx.h> | ||
#include <bx/allocator.h> | ||
#include <bx/readerwriter.h> | ||
#include <string_view> | ||
#include <bx/file.h> | ||
#include <bx/readerwriter.h> | ||
#include <bx/string.h> | ||
#include <iostream> | ||
|
||
namespace shift { | ||
/* bgfx utils */ | ||
/// Get native handle type | ||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(); | ||
|
||
/// Load resources from memory | ||
bgfx::ShaderHandle loadShader(const std::string_view& _name); | ||
|
||
bgfx::ProgramHandle loadProgram(const std::string_view& _vsName, const std::string_view& _fsName); | ||
|
||
} // namespace shift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,15 @@ | ||
set( LIB_NAME | ||
Shift | ||
) | ||
set(LIB_NAME shift_lib) | ||
|
||
set( SOURCES | ||
appBase.cpp | ||
) | ||
set(SOURCES appBase.cpp "utils/bgfx.cpp") | ||
|
||
add_library( | ||
${LIB_NAME} | ||
STATIC | ||
${SOURCES} | ||
) | ||
add_library(${LIB_NAME} STATIC ${SOURCES}) | ||
|
||
target_include_directories( | ||
${LIB_NAME} | ||
PUBLIC | ||
"${CMAKE_SOURCE_DIR}/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bgfx/3rdparty/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bgfx/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bx/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bimg/include/" | ||
) | ||
|
||
target_link_libraries( | ||
${LIB_NAME} | ||
PUBLIC | ||
glm | ||
glfw | ||
bgfx | ||
bx | ||
bimg | ||
) | ||
${LIB_NAME} | ||
PUBLIC "${CMAKE_SOURCE_DIR}/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bgfx/3rdparty/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bgfx/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bx/include/" | ||
"${CMAKE_SOURCE_DIR}/ext/bgfx.cmake/bimg/include/") | ||
|
||
target_link_libraries(${LIB_NAME} PUBLIC glm glfw bgfx bx bimg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <utils/bgfx.hpp> | ||
|
||
namespace shift { | ||
static const bgfx::Memory* loadMem(const std::string_view& _filePath) { | ||
return nullptr; | ||
} | ||
|
||
static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const std::string_view& _name) { | ||
std::string_view shaderPath; | ||
|
||
switch (bgfx::getRendererType()) { | ||
case bgfx::RendererType::Noop: | ||
case bgfx::RendererType::Direct3D11: | ||
case bgfx::RendererType::Direct3D12: shaderPath = ""; break; | ||
case bgfx::RendererType::Agc: | ||
case bgfx::RendererType::Gnm: shaderPath; break; | ||
case bgfx::RendererType::Metal: shaderPath; break; | ||
case bgfx::RendererType::Nvn: shaderPath; break; | ||
case bgfx::RendererType::OpenGL: shaderPath; break; | ||
case bgfx::RendererType::OpenGLES: shaderPath; break; | ||
case bgfx::RendererType::Vulkan: shaderPath; break; | ||
|
||
case bgfx::RendererType::Count: | ||
BX_ASSERT(false, "You should not be here!"); | ||
break; | ||
}; | ||
|
||
bgfx::ShaderHandle handle = bgfx::createShader(loadMem(_name)); | ||
return handle; | ||
} | ||
|
||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType() { | ||
return bgfx::NativeWindowHandleType::Default; | ||
} | ||
|
||
bgfx::ShaderHandle loadShader(const std::string_view& _name) { | ||
return loadShader(_name); | ||
} | ||
} |