Merge branch 'master' of https://gitee.com/lveyou/dl
# Conflicts: # project/dl_midi
This commit is contained in:
+21
-14
@@ -29,7 +29,7 @@ else()
|
||||
set(DL_DISABLE_AUDIO false)
|
||||
set(DL_DISABLE_OPENSSL false)
|
||||
set(DL_DISABLE_CURL false)
|
||||
set(DL_DISABLE_CONSOLE false)
|
||||
set(DL_DISABLE_CONSOLE false) # 仅控制是否有控制台
|
||||
set(DL_USE_MT false)
|
||||
endif()
|
||||
|
||||
@@ -144,23 +144,30 @@ add_subdirectory ("dl")
|
||||
if(NOT DL_DISABLE_RENDER)
|
||||
message("------------------解析dl_test-----------------------")
|
||||
add_subdirectory ("project/dl_test")
|
||||
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt)
|
||||
message("------------------解析dl_editor-----------------------")
|
||||
add_subdirectory ("project/dl_editor")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt)
|
||||
message("------------------解析dl_midi-----------------------")
|
||||
add_subdirectory ("project/dl_midi")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt)
|
||||
message("------------------解析dl_chess-----------------------")
|
||||
add_subdirectory ("project/dl_chess")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_snake/CMakeLists.txt)
|
||||
message("------------------解析dl_snake-----------------------")
|
||||
add_subdirectory ("project/dl_snake")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("------------------解析dl_console-----------------------")
|
||||
add_subdirectory ("project/dl_console")
|
||||
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_editor/CMakeLists.txt)
|
||||
message("------------------解析dl_editor-----------------------")
|
||||
add_subdirectory ("project/dl_editor")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_midi/CMakeLists.txt)
|
||||
message("------------------解析dl_midi-----------------------")
|
||||
add_subdirectory ("project/dl_midi")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_chess/CMakeLists.txt)
|
||||
message("------------------解析dl_chess-----------------------")
|
||||
add_subdirectory ("project/dl_chess")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_SOURCE_DIR}/project/dl_config/CMakeLists.txt)
|
||||
message("------------------解析dl_config-----------------------")
|
||||
add_subdirectory ("project/dl_config")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -84,6 +84,11 @@ public:
|
||||
return Integer(min, max);
|
||||
}
|
||||
|
||||
static unsigned Uint(unsigned min, unsigned max)
|
||||
{
|
||||
return Integer(min, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 从容器随机选择一个
|
||||
* @param[in] container 容器(不能为空)
|
||||
|
||||
@@ -151,6 +151,7 @@ public:
|
||||
/**
|
||||
* @brief 创建默认精灵
|
||||
*/
|
||||
[[nodiscard]]
|
||||
gcSprite CreateSpriteDefault(const Color& col = ColorDef::WHITE);
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace dl
|
||||
// message[1] = 64;
|
||||
// message[2] = 91;
|
||||
// _out->sendMessage(&message);
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
// message[0] = 128;
|
||||
// message[1] = 70;
|
||||
// message[2] = 40;
|
||||
@@ -98,4 +98,10 @@ namespace dl
|
||||
_imp->_out->sendMessage((unsigned char*)buf.data(), buf.size());
|
||||
}
|
||||
|
||||
void Midi::PlayC()
|
||||
{
|
||||
/*unsigned char
|
||||
_imp->_out->sendMessage(,);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public:
|
||||
~Midi();
|
||||
|
||||
void Play(BufferView buf);
|
||||
void PlayC();
|
||||
private:
|
||||
MidiImp* _imp;
|
||||
};
|
||||
|
||||
+42
-32
@@ -22,8 +22,8 @@ namespace dl
|
||||
struct Vertex
|
||||
{
|
||||
Position3 _pos;
|
||||
Position3 _normal;
|
||||
Position2 _uv;
|
||||
Position3 _normal;
|
||||
Position3 _tangent;
|
||||
static VkVertexInputBindingDescription getBindingDescription()
|
||||
{
|
||||
@@ -36,22 +36,26 @@ struct Vertex
|
||||
static std::array<VkVertexInputAttributeDescription, 4> getAttributeDescriptions()
|
||||
{
|
||||
std::array<VkVertexInputAttributeDescription, 4> attributeDescriptions{};
|
||||
attributeDescriptions[0].binding = 0;
|
||||
attributeDescriptions[0].location = 0;
|
||||
attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[0].offset = offsetof(Vertex, _pos);
|
||||
attributeDescriptions[1].binding = 0;
|
||||
attributeDescriptions[1].location = 2;
|
||||
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[1].offset = offsetof(Vertex, _normal);
|
||||
attributeDescriptions[2].binding = 0;
|
||||
attributeDescriptions[2].location = 1;
|
||||
attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
|
||||
attributeDescriptions[2].offset = offsetof(Vertex, _uv);
|
||||
attributeDescriptions[3].binding = 0;
|
||||
attributeDescriptions[3].location = 3;
|
||||
attributeDescriptions[3].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[3].offset = offsetof(Vertex, _tangent);
|
||||
uint32_t i = 0;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(Vertex, _pos);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(Vertex, _uv);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(Vertex, _normal);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(Vertex, _tangent);
|
||||
return attributeDescriptions;
|
||||
}
|
||||
};
|
||||
@@ -61,11 +65,12 @@ constexpr size_t NUM_BONE = 4;
|
||||
struct VertexBone
|
||||
{
|
||||
Position3 _pos;
|
||||
Position3 _normal;
|
||||
Position2 _uv0;
|
||||
Position2 _uv1;
|
||||
std::array<uint32_t, NUM_BONE> _joint0;
|
||||
Position3 _normal;
|
||||
Position3 _tangent;
|
||||
Position4 _weight0;
|
||||
std::array<uint32_t, NUM_BONE> _joint0;
|
||||
Position4 _color;
|
||||
static VkVertexInputBindingDescription getBindingDescription()
|
||||
{
|
||||
@@ -75,19 +80,14 @@ struct VertexBone
|
||||
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
|
||||
return bindingDescription;
|
||||
}
|
||||
static std::array<VkVertexInputAttributeDescription, 7> getAttributeDescriptions()
|
||||
static std::array<VkVertexInputAttributeDescription, 8> getAttributeDescriptions()
|
||||
{
|
||||
std::array<VkVertexInputAttributeDescription, 7> attributeDescriptions{};
|
||||
std::array<VkVertexInputAttributeDescription, 8> attributeDescriptions{};
|
||||
uint32_t i = 0;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _pos);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _normal);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
@@ -98,6 +98,21 @@ struct VertexBone
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _uv1);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _normal);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _tangent);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _weight0);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
@@ -106,12 +121,7 @@ struct VertexBone
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _weight0);
|
||||
++i;
|
||||
attributeDescriptions[i].binding = 0;
|
||||
attributeDescriptions[i].location = i;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_UINT;
|
||||
attributeDescriptions[i].format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
attributeDescriptions[i].offset = offsetof(VertexBone, _color);
|
||||
|
||||
return attributeDescriptions;
|
||||
|
||||
+2
-2
@@ -352,9 +352,9 @@ public:
|
||||
void* pUserData)
|
||||
{
|
||||
if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT)
|
||||
;// log_test0(pCallbackData->pMessage);
|
||||
log_test0(pCallbackData->pMessage);
|
||||
else if (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
|
||||
log_info0(pCallbackData->pMessage);//提高了一个等级,方便断点
|
||||
log_info0(pCallbackData->pMessage);
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
project ("dl_snake")
|
||||
|
||||
# 项目资源路径
|
||||
set(PATH_RES ${PROJECT_SOURCE_DIR}/res)
|
||||
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# 设置处理
|
||||
if (DL_DISABLE_RENDER)
|
||||
message(SEND_ERROR ${PROJECT_NAME}"必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!")
|
||||
|
||||
endif()
|
||||
# 添加源、设置可执行文件
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_LIST_TEST)
|
||||
|
||||
# 安卓为动态链接库
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
if(DL_DISABLE_CONSOLE)
|
||||
add_compile_definitions(DL_DISABLE_CONSOLE)
|
||||
add_executable (${PROJECT_NAME} WIN32 ${SRC_LIST_TEST})
|
||||
else()
|
||||
add_executable (${PROJECT_NAME} ${SRC_LIST_TEST})
|
||||
endif()
|
||||
else()
|
||||
add_library (${PROJECT_NAME} SHARED ${SRC_LIST_TEST})
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 23)
|
||||
endif()
|
||||
|
||||
# dl库
|
||||
include_directories(${CMAKE_SOURCE_DIR}/dl)
|
||||
target_link_libraries(${PROJECT_NAME} dl)
|
||||
|
||||
# fmt
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/fmt/include)
|
||||
# json
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/json)
|
||||
# tinyxml2
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/tinyxml2)
|
||||
# asio
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/asio/include)
|
||||
# angelscript
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/angelscript/angelscript/include)
|
||||
# lua
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/lua)
|
||||
# lua bridge
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/LuaBridge3/Source)
|
||||
|
||||
# dl资源文件夹
|
||||
set(DL_PATH_RES ${CMAKE_SOURCE_DIR}/res)
|
||||
# vld资源文件夹
|
||||
if(CMAKE_CL_64)
|
||||
set(DL_PATH_VLD ${CMAKE_SOURCE_DIR}/third/vld/bin/Win64)
|
||||
else()
|
||||
set(DL_PATH_VLD ${CMAKE_SOURCE_DIR}/third/vld/bin/Win32)
|
||||
endif()
|
||||
|
||||
# 目标文件夹
|
||||
set(PATH_OUT ${CMAKE_BINARY_DIR}/project/${PROJECT_NAME}/${CMAKE_CONFIGURATION_TYPES})
|
||||
|
||||
# 复制文件
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DL_PATH_RES}/dl ${PATH_OUT}/dl)
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PATH_RES} ${PATH_OUT})
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DL_PATH_VLD} ${PATH_OUT})
|
||||
add_custom_command(TARGET ${PROJECT_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/third/vld/vld.ini ${PATH_OUT})
|
||||
endif()
|
||||
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
install(DIRECTORY ${PATH_RES} DESTINATION bin)
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"path": "sound/",
|
||||
"whitelist": []
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
#pragma once
|
||||
#include "head.h"
|
||||
constexpr Size MAP_SIZE = { 16,16 };
|
||||
constexpr Size MAP_NODE_SIZE = { 12,12 };
|
||||
|
||||
|
||||
enum class MapNodeState {
|
||||
PASS,
|
||||
FOOD,
|
||||
BODY
|
||||
};
|
||||
|
||||
class MapNode {
|
||||
public:
|
||||
void SetNodeXy(const PointU& xy) {
|
||||
_xy = xy;
|
||||
}
|
||||
|
||||
void SetNodeState(MapNodeState s) {
|
||||
_state = s;
|
||||
switch (_state)
|
||||
{
|
||||
case MapNodeState::PASS:
|
||||
_spr.CancelRef();
|
||||
break;
|
||||
case MapNodeState::FOOD:
|
||||
_spr = g_factory->CreateSpriteDefault(ColorDef::RED);
|
||||
_spr->SetQuad({10,10});
|
||||
_spr->SetQuad(createQuad(Position{10.0f,10.0f}, false));
|
||||
_spr->SetOrder(0.8);
|
||||
_spr->AddCoor();
|
||||
_spr->GetCoor()->SetPosition(toPosition(_xy * MAP_NODE_SIZE));
|
||||
break;
|
||||
case MapNodeState::BODY:
|
||||
_spr = g_factory->CreateSpriteDefault(ColorDef::YELLOW);
|
||||
_spr->SetQuad({ 10,10 });
|
||||
_spr->SetQuad(createQuad(Position{ 10.0f,10.0f }, false));
|
||||
_spr->SetOrder(0.8);
|
||||
_spr->AddCoor();
|
||||
_spr->GetCoor()->SetPosition(toPosition(_xy * MAP_NODE_SIZE));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderNode() {
|
||||
if (_spr)
|
||||
{
|
||||
_spr->Render();
|
||||
}
|
||||
}
|
||||
private:
|
||||
MapNodeState _state;
|
||||
PointU _xy;
|
||||
|
||||
gcSprite _spr;
|
||||
|
||||
};
|
||||
|
||||
class Map {
|
||||
public:
|
||||
void Reset() {
|
||||
_vec.resize(MAP_SIZE[0] * MAP_SIZE[1]);
|
||||
for (unsigned j = 0; j< MAP_SIZE[1]; ++j)
|
||||
{
|
||||
for (unsigned i = 0; i < MAP_SIZE[0]; ++i)
|
||||
{
|
||||
unsigned idx = MAP_SIZE[0] * j + i;
|
||||
_vec[idx].SetNodeState(MapNodeState::PASS);
|
||||
_vec[idx].SetNodeXy({i,j});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreateFood(const PointU& xy) {
|
||||
unsigned idx = MAP_SIZE[0] * xy[1] + xy[0];
|
||||
if (idx >= _vec.size())
|
||||
{
|
||||
log_err("创建food下标越界:x: {},y: {}", xy[0], xy[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
_vec[idx].SetNodeState(MapNodeState::FOOD);
|
||||
}
|
||||
|
||||
void RenderMap() {
|
||||
for (size_t i = 0; i < _vec.size(); ++i)
|
||||
{
|
||||
_vec[i].RenderNode();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<MapNode> _vec;
|
||||
};
|
||||
|
||||
class Game{
|
||||
|
||||
public:
|
||||
Game() {
|
||||
Random::SetSeed(0);
|
||||
_sprBg = g_factory->CreateSpriteDefault(ColorDef::GREEN);
|
||||
_txtFps = g_factory->CreateTextDefault();
|
||||
|
||||
_map.Reset();
|
||||
_map.CreateFood({
|
||||
Random::Uint(0, MAP_SIZE[0] - 1) ,
|
||||
Random::Uint(0, MAP_SIZE[1] - 1)
|
||||
});
|
||||
}
|
||||
|
||||
void Update() {
|
||||
_sprBg->SetQuad(createQuad(g_system->GetWindowSize(), false));
|
||||
_sprBg->SetOrder(0.9);
|
||||
_sprBg->Render();
|
||||
|
||||
_txtFps->SetString(std::to_string(g_time->GetFPS()));
|
||||
_txtFps->GetCoor()->SetPosition({ 200, 200 });
|
||||
_txtFps->SetOrder(0.5);
|
||||
_txtFps->Render();
|
||||
|
||||
_map.RenderMap();
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
gcSprite _sprBg;
|
||||
gcText _txtFps;
|
||||
Map _map;
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "head.h"
|
||||
#include "game.h"
|
||||
|
||||
Game* g_Game;
|
||||
|
||||
void Init() {
|
||||
g_Game = new Game;
|
||||
|
||||
}
|
||||
|
||||
void Run() {
|
||||
g_Game->Update();
|
||||
}
|
||||
|
||||
int Main()
|
||||
{
|
||||
dl::Engine::Init();
|
||||
log_msg("snake start");
|
||||
|
||||
g_factory->SetPath("img/","model/","out/","temp/");
|
||||
|
||||
g_system->SetFuncInit(Init);
|
||||
g_system->SetFuncRun(Run);
|
||||
|
||||
ParamWindow pw;
|
||||
pw._strTitle = "snake";
|
||||
pw._size = { 800,600 };
|
||||
|
||||
g_system->Start(pw);
|
||||
|
||||
|
||||
dl::Engine::Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <dl.h>
|
||||
using namespace dl;
|
||||
|
||||
int Main();
|
||||
class Game;
|
||||
extern Game* g_Game;
|
||||
@@ -0,0 +1,13 @@
|
||||
#include <wtypes.h>
|
||||
|
||||
extern int Main();
|
||||
//int CALLBACK WinMain(
|
||||
// __in HINSTANCE hInstance,
|
||||
// __in HINSTANCE hPrevInstance,
|
||||
// __in LPSTR lpCmdLine,
|
||||
// __in int nCmdShow
|
||||
//)
|
||||
int main()
|
||||
{
|
||||
return Main();
|
||||
}
|
||||
@@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# 设置处理
|
||||
if (DL_DISABLE_RENDER)
|
||||
message(SEND_ERROR "dl_test必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!")
|
||||
message(SEND_ERROR ${PROJECT_NAME}"必须启动绘图系统,将会编译失败(DL_DISABLE_RENDER)!")
|
||||
endif()
|
||||
|
||||
# dl目录
|
||||
@@ -49,6 +49,10 @@ include_directories(${CMAKE_SOURCE_DIR}/third/tinyxml2)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/asio/include)
|
||||
# angelscript
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/angelscript/angelscript/include)
|
||||
# lua
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/lua)
|
||||
# lua bridge
|
||||
include_directories(${CMAKE_SOURCE_DIR}/third/LuaBridge3/Source)
|
||||
|
||||
# dl资源文件夹
|
||||
set(DL_PATH_RES ${CMAKE_SOURCE_DIR}/res)
|
||||
|
||||
+18
-18
@@ -154,24 +154,24 @@ void Init()
|
||||
//g_factory->LoadModel("axis.glb", "axis");
|
||||
|
||||
// 脚本加载
|
||||
{
|
||||
g_as->SetPathRoot("as/");
|
||||
std::vector<std::string> vec;
|
||||
File::GetPathFileAll("as/", vec, {}, false);
|
||||
for (auto& iter : vec)
|
||||
{
|
||||
g_as->LoadModule(iter);
|
||||
}
|
||||
}
|
||||
// mod加载
|
||||
{
|
||||
std::vector<std::string> vec;
|
||||
File::GetPathFileAll("mod/", vec, {}, false);
|
||||
for (auto& iter : vec)
|
||||
{
|
||||
g_mod->LoadMod(iter);
|
||||
}
|
||||
}
|
||||
//{
|
||||
// g_as->SetPathRoot("as/");
|
||||
// std::vector<std::string> vec;
|
||||
// File::GetPathFileAll("as/", vec, {}, false);
|
||||
// for (auto& iter : vec)
|
||||
// {
|
||||
// g_as->LoadModule(iter);
|
||||
// }
|
||||
//}
|
||||
//// mod加载
|
||||
//{
|
||||
// std::vector<std::string> vec;
|
||||
// File::GetPathFileAll("mod/", vec, {}, false);
|
||||
// for (auto& iter : vec)
|
||||
// {
|
||||
// g_mod->LoadMod(iter);
|
||||
// }
|
||||
//}
|
||||
|
||||
g_ui->SetStandardSize({ 800, 600 });
|
||||
g_ui->RegisterAll("ui/");
|
||||
|
||||
@@ -49,8 +49,8 @@ UIMain::UIMain()
|
||||
_ruler = Tool::Ruler::Create();
|
||||
|
||||
|
||||
g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)",
|
||||
_panelMod, std::string{ "dddddddddd" });
|
||||
/*g_as->ExcuteFunction("mod管理器", "UI::Panel@ initUI(string)",
|
||||
_panelMod, std::string{ "dddddddddd" });*/
|
||||
|
||||
int x = 3;
|
||||
}
|
||||
|
||||
Binary file not shown.
+12
-12
@@ -1,30 +1,30 @@
|
||||
::3d普通
|
||||
glslc.exe shader.vert -o vert.spv
|
||||
glslc.exe shader.frag -o frag.spv
|
||||
copy vert.spv ..\res\shader\
|
||||
copy frag.spv ..\res\shader\
|
||||
glslc.exe shader_pbr.vert -o vert.spv
|
||||
glslc.exe shader_pbr.frag -o frag.spv
|
||||
copy vert.spv ..\res\dl\shader\
|
||||
copy frag.spv ..\res\dl\shader\
|
||||
del vert.spv
|
||||
del frag.spv
|
||||
|
||||
::3d骨骼
|
||||
glslc.exe shader.vert -D=BONE -o vert_bone.spv
|
||||
glslc.exe shader.frag -D=BONE -o frag_bone.spv
|
||||
copy vert_bone.spv ..\res\shader\
|
||||
copy frag_bone.spv ..\res\shader\
|
||||
glslc.exe shader_pbr.vert -D=BONE -o vert_bone.spv
|
||||
glslc.exe shader_pbr.frag -D=BONE -o frag_bone.spv
|
||||
copy vert_bone.spv ..\res\dl\shader\
|
||||
copy frag_bone.spv ..\res\dl\shader\
|
||||
del vert_bone.spv
|
||||
del frag_bone.spv
|
||||
|
||||
glslc.exe shader_2d.vert -o vert_2d.spv
|
||||
glslc.exe shader_2d.frag -o frag_2d.spv
|
||||
copy vert_2d.spv ..\res\shader\
|
||||
copy frag_2d.spv ..\res\shader\
|
||||
copy vert_2d.spv ..\res\dl\shader\
|
||||
copy frag_2d.spv ..\res\dl\shader\
|
||||
del vert_2d.spv
|
||||
del frag_2d.spv
|
||||
|
||||
glslc.exe shader_gfx.vert -o vert_gfx.spv
|
||||
glslc.exe shader_gfx.frag -o frag_gfx.spv
|
||||
copy vert_gfx.spv ..\res\shader\
|
||||
copy frag_gfx.spv ..\res\shader\
|
||||
copy vert_gfx.spv ..\res\dl\shader\
|
||||
copy frag_gfx.spv ..\res\dl\shader\
|
||||
del vert_gfx.spv
|
||||
del frag_gfx.spv
|
||||
|
||||
|
||||
+4
-2
@@ -20,12 +20,14 @@ layout (set = 1, binding = 0) uniform UniformBufferBone
|
||||
|
||||
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec2 inTexCoord;
|
||||
layout(location = 2) in vec3 inNormal;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
layout(location = 2) in vec2 inTexCoord;
|
||||
layout(location = 3) in vec3 inTangent;
|
||||
#ifdef BONE
|
||||
layout(location = 4) in vec4 boneWeight;
|
||||
layout(location = 5) in uvec4 boneIndex;
|
||||
layout(location = 6) in vec2 inTexCoord1;
|
||||
layout(location = 7) in vec4 inColor;
|
||||
#endif
|
||||
|
||||
layout(location = 0) out vec3 fragColor;
|
||||
|
||||
+10
-3
@@ -19,13 +19,20 @@ layout (set = 1, binding = 0) uniform UniformBufferBone
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BONE
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec2 inTexCoord;
|
||||
layout(location = 2) in vec2 inTexCoord1;
|
||||
layout(location = 3) in vec3 inNormal;
|
||||
layout(location = 4) in vec3 inTangent;
|
||||
layout(location = 5) in vec3 boneWeight;
|
||||
layout(location = 6) in uvec4 boneIndex;
|
||||
layout(location = 7) in vec4 inColor;
|
||||
#else
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec2 inTexCoord;
|
||||
layout(location = 2) in vec3 inNormal;
|
||||
layout(location = 3) in vec3 inTangent;
|
||||
#ifdef BONE
|
||||
layout(location = 4) in vec3 boneWeight;
|
||||
layout(location = 5) in uvec4 boneIndex;
|
||||
#endif
|
||||
|
||||
layout(location = 0) out vec3 fragColor;
|
||||
|
||||
Reference in New Issue
Block a user