Fix coding style
This commit is contained in:
parent
7cbd9d3ac4
commit
52b9031100
3
3rdparty/c55lib/c55/interval_loop.h
vendored
3
3rdparty/c55lib/c55/interval_loop.h
vendored
@ -43,8 +43,7 @@ void interval_loop(int interval_us, std::function<bool(float load_avg)> f)
|
|||||||
|
|
||||||
int64_t t_tick_end = get_timeofday_us();
|
int64_t t_tick_end = get_timeofday_us();
|
||||||
int64_t t_tick_length = t_tick_end > t_tick_start ? t_tick_end -
|
int64_t t_tick_length = t_tick_end > t_tick_start ? t_tick_end -
|
||||||
t_tick_start :
|
t_tick_start : 0;
|
||||||
0;
|
|
||||||
float load_ratio = (float)t_tick_length / interval_us;
|
float load_ratio = (float)t_tick_length / interval_us;
|
||||||
//log_i("loop", "load_ratio=%f", load_ratio);
|
//log_i("loop", "load_ratio=%f", load_ratio);
|
||||||
load_log[load_log_i] = load_ratio;
|
load_log[load_log_i] = load_ratio;
|
||||||
|
@ -10,7 +10,7 @@ namespace main_context
|
|||||||
{
|
{
|
||||||
struct OpaqueSceneReference;
|
struct OpaqueSceneReference;
|
||||||
typedef OpaqueSceneReference* SceneReference;
|
typedef OpaqueSceneReference* SceneReference;
|
||||||
};
|
}
|
||||||
|
|
||||||
namespace ground_plane_lighting
|
namespace ground_plane_lighting
|
||||||
{
|
{
|
||||||
|
@ -236,7 +236,7 @@ struct CInstance: public ground_plane_lighting::Instance
|
|||||||
ar(s);
|
ar(s);
|
||||||
}
|
}
|
||||||
network::access(m_server, [&](network::Interface *inetwork){
|
network::access(m_server, [&](network::Interface *inetwork){
|
||||||
for(auto &peer : m_clients_initialized){
|
for(auto &peer: m_clients_initialized){
|
||||||
inetwork->send(peer, "ground_plane_lighting:update",
|
inetwork->send(peer, "ground_plane_lighting:update",
|
||||||
os.str());
|
os.str());
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ struct Module: public interface::Module, public ground_plane_lighting::Interface
|
|||||||
{
|
{
|
||||||
// Drop instance of the deleted scene (there should be only one, but
|
// Drop instance of the deleted scene (there should be only one, but
|
||||||
// loop through all of them just for robustness)
|
// loop through all of them just for robustness)
|
||||||
for(auto it = m_instances.begin(); it != m_instances.end(); ){
|
for(auto it = m_instances.begin(); it != m_instances.end();){
|
||||||
auto current_it = it++;
|
auto current_it = it++;
|
||||||
up_<CInstance> &instance = current_it->second;
|
up_<CInstance> &instance = current_it->second;
|
||||||
if(instance->m_scene_ref == event.scene){
|
if(instance->m_scene_ref == event.scene){
|
||||||
|
@ -224,10 +224,10 @@ struct ResolveState
|
|||||||
{
|
{
|
||||||
log_d(MODULE, "step_through()");
|
log_d(MODULE, "step_through()");
|
||||||
|
|
||||||
while(step(true)) ;
|
while(step(true));
|
||||||
if(m_failed) return false;
|
if(m_failed) return false;
|
||||||
|
|
||||||
while(step(false)) ;
|
while(step(false));
|
||||||
if(m_failed) return false;
|
if(m_failed) return false;
|
||||||
|
|
||||||
for(const ss_ &name : m_required_modules){
|
for(const ss_ &name : m_required_modules){
|
||||||
|
@ -25,7 +25,7 @@ namespace main_context
|
|||||||
{
|
{
|
||||||
SceneReference scene;
|
SceneReference scene;
|
||||||
|
|
||||||
SceneDeleted(SceneReference scene): scene(scene) {}
|
SceneDeleted(SceneReference scene): scene(scene){}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Interface
|
struct Interface
|
||||||
|
@ -61,7 +61,7 @@ struct OpaqueSceneReference
|
|||||||
{
|
{
|
||||||
SharedPtr<Scene> scene;
|
SharedPtr<Scene> scene;
|
||||||
|
|
||||||
OpaqueSceneReference(const SharedPtr<Scene> &scene): scene(scene) {}
|
OpaqueSceneReference(const SharedPtr<Scene> &scene): scene(scene){}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Module: public interface::Module, public main_context::Interface
|
struct Module: public interface::Module, public main_context::Interface
|
||||||
|
@ -16,7 +16,7 @@ namespace main_context
|
|||||||
{
|
{
|
||||||
struct OpaqueSceneReference;
|
struct OpaqueSceneReference;
|
||||||
typedef OpaqueSceneReference* SceneReference;
|
typedef OpaqueSceneReference* SceneReference;
|
||||||
};
|
}
|
||||||
|
|
||||||
namespace replicate
|
namespace replicate
|
||||||
{
|
{
|
||||||
|
@ -85,10 +85,12 @@ struct Module: public interface::Module, public replicate::Interface
|
|||||||
if(ps.scene_ref != nullptr){
|
if(ps.scene_ref != nullptr){
|
||||||
scene = imc->find_scene(ps.scene_ref);
|
scene = imc->find_scene(ps.scene_ref);
|
||||||
if(!scene)
|
if(!scene)
|
||||||
log_w(MODULE, "~Module(): Scene %p not found", ps.scene_ref);
|
log_w(MODULE, "~Module(): Scene %p not found",
|
||||||
|
ps.scene_ref);
|
||||||
}
|
}
|
||||||
if(scene){
|
if(scene){
|
||||||
scene->CleanupConnection((magic::Connection*)&ps.scene_state);
|
scene->CleanupConnection(
|
||||||
|
(magic::Connection*)&ps.scene_state);
|
||||||
}
|
}
|
||||||
// Make sure to fully clear the SceneReplicationState in
|
// Make sure to fully clear the SceneReplicationState in
|
||||||
// the context of main_context. Otherwise race conditions can
|
// the context of main_context. Otherwise race conditions can
|
||||||
@ -530,7 +532,7 @@ struct Module: public interface::Module, public replicate::Interface
|
|||||||
main_context::SceneReference scene_ref)
|
main_context::SceneReference scene_ref)
|
||||||
{
|
{
|
||||||
sv_<PeerId> result;
|
sv_<PeerId> result;
|
||||||
for(auto &pair: m_peers){
|
for(auto &pair : m_peers){
|
||||||
PeerState &ps = pair.second;
|
PeerState &ps = pair.second;
|
||||||
if(ps.scene_ref == nullptr || ps.scene_ref != scene_ref)
|
if(ps.scene_ref == nullptr || ps.scene_ref != scene_ref)
|
||||||
continue;
|
continue;
|
||||||
@ -543,7 +545,7 @@ struct Module: public interface::Module, public replicate::Interface
|
|||||||
main_context::SceneReference scene_ref, uint node_id)
|
main_context::SceneReference scene_ref, uint node_id)
|
||||||
{
|
{
|
||||||
sv_<PeerId> result;
|
sv_<PeerId> result;
|
||||||
for(auto &pair: m_peers){
|
for(auto &pair : m_peers){
|
||||||
PeerState &ps = pair.second;
|
PeerState &ps = pair.second;
|
||||||
if(ps.scene_ref == nullptr || ps.scene_ref != scene_ref)
|
if(ps.scene_ref == nullptr || ps.scene_ref != scene_ref)
|
||||||
continue;
|
continue;
|
||||||
|
@ -21,7 +21,7 @@ namespace main_context
|
|||||||
{
|
{
|
||||||
struct OpaqueSceneReference;
|
struct OpaqueSceneReference;
|
||||||
typedef OpaqueSceneReference* SceneReference;
|
typedef OpaqueSceneReference* SceneReference;
|
||||||
};
|
}
|
||||||
|
|
||||||
namespace voxelworld
|
namespace voxelworld
|
||||||
{
|
{
|
||||||
@ -126,10 +126,11 @@ namespace voxelworld
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool access(interface::Server *server, SceneReference scene_ref,
|
inline bool access(interface::Server *server, SceneReference scene_ref,
|
||||||
std::function<void(voxelworld::Instance *instance)> cb)
|
std::function<void(voxelworld::Instance*instance)> cb)
|
||||||
{
|
{
|
||||||
return access(server, [&](voxelworld::Interface *i){
|
return access(server, [&](voxelworld::Interface *i){
|
||||||
voxelworld::Instance *instance = check(i->get_instance(scene_ref));
|
voxelworld::Instance *instance =
|
||||||
|
check(i->get_instance(scene_ref));
|
||||||
cb(instance);
|
cb(instance);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ struct CInstance: public voxelworld::Instance
|
|||||||
ss_ voxel_reg_data = m_voxel_reg->serialize();
|
ss_ voxel_reg_data = m_voxel_reg->serialize();
|
||||||
|
|
||||||
network::access(m_server, [&](network::Interface *inetwork){
|
network::access(m_server, [&](network::Interface *inetwork){
|
||||||
for(auto &peer : m_clients_initialized){
|
for(auto &peer: m_clients_initialized){
|
||||||
inetwork->send(peer, "voxelworld:voxel_registry",
|
inetwork->send(peer, "voxelworld:voxel_registry",
|
||||||
voxel_reg_data);
|
voxel_reg_data);
|
||||||
}
|
}
|
||||||
@ -1185,7 +1185,7 @@ struct Module: public interface::Module, public voxelworld::Interface
|
|||||||
{
|
{
|
||||||
// Drop instance of the deleted scene (there should be only one, but
|
// Drop instance of the deleted scene (there should be only one, but
|
||||||
// loop through all of them just for robustness)
|
// loop through all of them just for robustness)
|
||||||
for(auto it = m_instances.begin(); it != m_instances.end(); ){
|
for(auto it = m_instances.begin(); it != m_instances.end();){
|
||||||
auto current_it = it++;
|
auto current_it = it++;
|
||||||
up_<CInstance> &instance = current_it->second;
|
up_<CInstance> &instance = current_it->second;
|
||||||
if(instance->m_scene_ref == event.scene){
|
if(instance->m_scene_ref == event.scene){
|
||||||
|
@ -11,7 +11,7 @@ namespace main_context
|
|||||||
{
|
{
|
||||||
struct OpaqueSceneReference;
|
struct OpaqueSceneReference;
|
||||||
typedef OpaqueSceneReference* SceneReference;
|
typedef OpaqueSceneReference* SceneReference;
|
||||||
};
|
}
|
||||||
|
|
||||||
namespace worldgen
|
namespace worldgen
|
||||||
{
|
{
|
||||||
@ -59,14 +59,15 @@ namespace worldgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool access(interface::Server *server, SceneReference scene_ref,
|
inline bool access(interface::Server *server, SceneReference scene_ref,
|
||||||
std::function<void(worldgen::Instance *instance)> cb)
|
std::function<void(worldgen::Instance*instance)> cb)
|
||||||
{
|
{
|
||||||
return access(server, [&](worldgen::Interface *i){
|
return access(server, [&](worldgen::Interface *i){
|
||||||
worldgen::Instance *instance = check(i->get_instance(scene_ref));
|
worldgen::Instance *instance =
|
||||||
|
check(i->get_instance(scene_ref));
|
||||||
cb(instance);
|
cb(instance);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: set noet ts=4 sw=4:
|
|
||||||
|
|
||||||
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -249,7 +249,7 @@ void GenerateThread::run(interface::Thread *thread)
|
|||||||
[&](worldgen::Interface *iworldgen)
|
[&](worldgen::Interface *iworldgen)
|
||||||
{
|
{
|
||||||
// Generate one section for each instance
|
// Generate one section for each instance
|
||||||
for(auto &pair : m_module->m_instances){
|
for(auto &pair: m_module->m_instances){
|
||||||
up_<CInstance> &instance = pair.second;
|
up_<CInstance> &instance = pair.second;
|
||||||
if(!instance->m_enabled && !instance->m_queued_sections.empty()){
|
if(!instance->m_enabled && !instance->m_queued_sections.empty()){
|
||||||
// Has to be checked later
|
// Has to be checked later
|
||||||
|
@ -228,18 +228,15 @@ PathDefinition server_paths[] = {
|
|||||||
{PD_READ, "share_path",
|
{PD_READ, "share_path",
|
||||||
"",
|
"",
|
||||||
"/builtin/network/network.cpp",
|
"/builtin/network/network.cpp",
|
||||||
"Static files"
|
"Static files"},
|
||||||
},
|
|
||||||
{PD_READ, "interface_path",
|
{PD_READ, "interface_path",
|
||||||
"/src/interface",
|
"/src/interface",
|
||||||
"/event.h",
|
"/event.h",
|
||||||
"Interface files"
|
"Interface files"},
|
||||||
},
|
|
||||||
{PD_WRITE, "rccpp_build_path",
|
{PD_WRITE, "rccpp_build_path",
|
||||||
"/cache/rccpp_build",
|
"/cache/rccpp_build",
|
||||||
"/write.test",
|
"/write.test",
|
||||||
"RCC++ build directory"
|
"RCC++ build directory"},
|
||||||
},
|
|
||||||
{PD_END, "", "", "", ""},
|
{PD_END, "", "", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -257,8 +254,7 @@ PathDefinition compiler_bin_paths[] = {
|
|||||||
{PD_RUN, "compiler_command",
|
{PD_RUN, "compiler_command",
|
||||||
"c++",
|
"c++",
|
||||||
" --version",
|
" --version",
|
||||||
"Compiler command"
|
"Compiler command"},
|
||||||
},
|
|
||||||
{PD_END, "", "", "", ""},
|
{PD_END, "", "", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -266,7 +262,8 @@ static bool detect_compiler_bin_paths(core::Config &config)
|
|||||||
{
|
{
|
||||||
sv_<ss_> roots;
|
sv_<ss_> roots;
|
||||||
generate_compiler_binary_dir_alternatives(roots);
|
generate_compiler_binary_dir_alternatives(roots);
|
||||||
return detect_paths(config, roots, compiler_bin_paths, "Compiler binary directory");
|
return detect_paths(config, roots, compiler_bin_paths,
|
||||||
|
"Compiler binary directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client-only paths
|
// Client-only paths
|
||||||
@ -275,13 +272,11 @@ PathDefinition client_paths[] = {
|
|||||||
{PD_READ, "share_path",
|
{PD_READ, "share_path",
|
||||||
"",
|
"",
|
||||||
"/client/init.lua",
|
"/client/init.lua",
|
||||||
"Static files"
|
"Static files"},
|
||||||
},
|
|
||||||
{PD_WRITE, "cache_path",
|
{PD_WRITE, "cache_path",
|
||||||
"/cache",
|
"/cache",
|
||||||
"/write.test",
|
"/write.test",
|
||||||
"Cache directory"
|
"Cache directory"},
|
||||||
},
|
|
||||||
{PD_END, "", "", "", ""},
|
{PD_END, "", "", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -298,8 +293,7 @@ PathDefinition server_urho3d_paths[] = {
|
|||||||
{PD_READ, "urho3d_path",
|
{PD_READ, "urho3d_path",
|
||||||
"",
|
"",
|
||||||
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
|
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
|
||||||
"Urho3D path"
|
"Urho3D path"},
|
||||||
},
|
|
||||||
{PD_END, "", "", "", ""},
|
{PD_END, "", "", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -316,8 +310,7 @@ PathDefinition client_urho3d_paths[] = {
|
|||||||
{PD_READ, "urho3d_path",
|
{PD_READ, "urho3d_path",
|
||||||
"",
|
"",
|
||||||
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
|
"/Bin/CoreData/Shaders/GLSL/Basic.glsl",
|
||||||
"Urho3D path"
|
"Urho3D path"},
|
||||||
},
|
|
||||||
{PD_END, "", "", "", ""},
|
{PD_END, "", "", "", ""},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -378,5 +371,6 @@ bool detect_client_paths(core::Config &config)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -25,7 +25,8 @@ namespace boot
|
|||||||
|
|
||||||
// Force '.' as decimal point
|
// Force '.' as decimal point
|
||||||
try {
|
try {
|
||||||
std::locale::global(std::locale(std::locale(""), "C", std::locale::numeric));
|
std::locale::global(std::locale(std::locale(""), "C",
|
||||||
|
std::locale::numeric));
|
||||||
} catch(std::runtime_error &e){
|
} catch(std::runtime_error &e){
|
||||||
// Can happen on Wine
|
// Can happen on Wine
|
||||||
fprintf(stderr, "Failed to set numeric C++ locale\n");
|
fprintf(stderr, "Failed to set numeric C++ locale\n");
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
#include <DebugRenderer.h>
|
#include <DebugRenderer.h>
|
||||||
#include <Profiler.h>
|
#include <Profiler.h>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
}
|
}
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#define MODULE "__app"
|
#define MODULE "__app"
|
||||||
@ -353,7 +353,8 @@ struct CApp: public App, public magic::Application
|
|||||||
lua_bindings::replicate::set_scene(L, m_scene);
|
lua_bindings::replicate::set_scene(L, m_scene);
|
||||||
|
|
||||||
// Run initial client Lua scripts
|
// Run initial client Lua scripts
|
||||||
ss_ init_lua_path = g_client_config.get<ss_>("share_path")+"/client/init.lua";
|
ss_ init_lua_path = g_client_config.get<ss_>("share_path")+
|
||||||
|
"/client/init.lua";
|
||||||
int error = luaL_dofile(L, init_lua_path.c_str());
|
int error = luaL_dofile(L, init_lua_path.c_str());
|
||||||
if(error){
|
if(error){
|
||||||
log_w(MODULE, "luaL_dofile: An error occurred: %s\n",
|
log_w(MODULE, "luaL_dofile: An error occurred: %s\n",
|
||||||
|
@ -329,7 +329,8 @@ void CState::setup_packet_handlers()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ss_ file_hash_hex = interface::sha1::hex(file_hash);
|
ss_ file_hash_hex = interface::sha1::hex(file_hash);
|
||||||
ss_ path = g_client_config.get<ss_>("cache_path")+"/remote/"+file_hash_hex;
|
ss_ path = g_client_config.get<ss_>("cache_path")+"/remote/"+
|
||||||
|
file_hash_hex;
|
||||||
log_i(MODULE, "Saving %s to %s", cs(file_name), cs(path));
|
log_i(MODULE, "Saving %s to %s", cs(file_name), cs(path));
|
||||||
std::ofstream of(path, std::ios::binary);
|
std::ofstream of(path, std::ios::binary);
|
||||||
of<<file_content;
|
of<<file_content;
|
||||||
|
@ -702,7 +702,7 @@ namespace sajson {
|
|||||||
*temp++ = make_element(result.value_type, out - current_base - 1);
|
*temp++ = make_element(result.value_type, out - current_base - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if(0 == peek_structure()){
|
if(0 == peek_structure()){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -1186,7 +1186,7 @@ done:
|
|||||||
case 't':
|
case 't':
|
||||||
replacement = '\t';
|
replacement = '\t';
|
||||||
goto replace;
|
goto replace;
|
||||||
replace:
|
replace:
|
||||||
*end++ = replacement;
|
*end++ = replacement;
|
||||||
++p;
|
++p;
|
||||||
break;
|
break;
|
||||||
|
@ -87,7 +87,7 @@ static inline ss_ ftos(float f){
|
|||||||
#define SLEN(x) (sizeof(x)/sizeof((x)[0]))
|
#define SLEN(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static inline ss_ dump(const T &v);
|
static inline ss_ dump(const T &v);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline ss_ dump(const double &v){
|
inline ss_ dump(const double &v){
|
||||||
@ -165,10 +165,10 @@ static inline const T* check(const T *v){
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // Don't use this; this isn't needed on MinGW 4.9.1 and newer
|
#if 0 // Don't use this; this isn't needed on MinGW 4.9.1 and newer
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
// MinGW doesn't have std::to_string (as of mingw-w64 4.8.1); define something to replace it
|
// MinGW doesn't have std::to_string (as of mingw-w64 4.8.1); define something to replace it
|
||||||
// This include is going to fuck things up for Linux users that use modules developed on Windows
|
// This include is going to fuck things up for Linux users that use modules developed on Windows
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
namespace std {
|
namespace std {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ss_ to_string(const T &v){
|
ss_ to_string(const T &v){
|
||||||
@ -179,7 +179,7 @@ namespace std {
|
|||||||
}
|
}
|
||||||
// Also this doesn't exist on MinGW (as of mingw-w64 4.8.1)
|
// Also this doesn't exist on MinGW (as of mingw-w64 4.8.1)
|
||||||
typedef int ssize_t;
|
typedef int ssize_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -116,5 +116,6 @@ bool path_exists(const ss_ &path)
|
|||||||
return c55fs::PathExists(path);
|
return c55fs::PathExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -173,7 +173,7 @@ void set_8bit_voxel_geometry(CustomGeometry *cg, Context *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename VoxelType>
|
template<typename VoxelType>
|
||||||
class IsQuadNeededByRegistryPhysics
|
class IsQuadNeededByRegistryPhysics
|
||||||
{
|
{
|
||||||
interface::VoxelRegistry *m_voxel_reg;
|
interface::VoxelRegistry *m_voxel_reg;
|
||||||
// NOTE: The voxel type id is used directly as PolyVox material value
|
// NOTE: The voxel type id is used directly as PolyVox material value
|
||||||
@ -282,7 +282,7 @@ Model* create_voxel_physics_model(Context *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename VoxelType>
|
template<typename VoxelType>
|
||||||
class IsQuadNeededByRegistry
|
class IsQuadNeededByRegistry
|
||||||
{
|
{
|
||||||
interface::VoxelRegistry *m_voxel_reg;
|
interface::VoxelRegistry *m_voxel_reg;
|
||||||
// NOTE: The voxel type id is used directly as PolyVox material value
|
// NOTE: The voxel type id is used directly as PolyVox material value
|
||||||
@ -848,6 +848,7 @@ void generate_voxel_physics_boxes(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t v = (def && def->physically_solid);
|
uint8_t v = (def && def->physically_solid);
|
||||||
volume.setVoxelAt(x, y, z, v);
|
volume.setVoxelAt(x, y, z, v);
|
||||||
}
|
}
|
||||||
@ -875,7 +876,7 @@ void generate_voxel_physics_boxes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // Done
|
break; // Done
|
||||||
found_non_covered_voxel:
|
found_non_covered_voxel:
|
||||||
// Stretch this box first in x, then y and then z to be as large as
|
// Stretch this box first in x, then y and then z to be as large as
|
||||||
// possible without covering any non-solid voxels
|
// possible without covering any non-solid voxels
|
||||||
int x1 = x0;
|
int x1 = x0;
|
||||||
@ -891,7 +892,7 @@ found_non_covered_voxel:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue; // Fits
|
continue; // Fits
|
||||||
x_plane_does_not_fit:
|
x_plane_does_not_fit:
|
||||||
x1--;
|
x1--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -905,7 +906,7 @@ x_plane_does_not_fit:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue; // Fits
|
continue; // Fits
|
||||||
y_plane_does_not_fit:
|
y_plane_does_not_fit:
|
||||||
y1--;
|
y1--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -919,7 +920,7 @@ y_plane_does_not_fit:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue; // Fits
|
continue; // Fits
|
||||||
z_plane_does_not_fit:
|
z_plane_does_not_fit:
|
||||||
z1--;
|
z1--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ struct CThreadPool: public ThreadPool
|
|||||||
}
|
}
|
||||||
// Run the task's threaded part
|
// Run the task's threaded part
|
||||||
try {
|
try {
|
||||||
while(!current->thread()) ;
|
while(!current->thread());
|
||||||
} catch(std::exception &e){
|
} catch(std::exception &e){
|
||||||
log_w(MODULE, "Worker task failed: %s", e.what());
|
log_w(MODULE, "Worker task failed: %s", e.what());
|
||||||
interface::debug::log_exception_backtrace();
|
interface::debug::log_exception_backtrace();
|
||||||
@ -100,7 +100,7 @@ struct CThreadPool: public ThreadPool
|
|||||||
void add_task(up_<Task> task)
|
void add_task(up_<Task> task)
|
||||||
{
|
{
|
||||||
// TODO: Limit task->pre() execution time per frame
|
// TODO: Limit task->pre() execution time per frame
|
||||||
while(!task->pre()) ;
|
while(!task->pre());
|
||||||
interface::MutexScope ms(m_mutex);
|
interface::MutexScope ms(m_mutex);
|
||||||
m_input_queue.push_back(std::move(task));
|
m_input_queue.push_back(std::move(task));
|
||||||
m_tasks_sem.post();
|
m_tasks_sem.post();
|
||||||
|
@ -14,7 +14,7 @@ namespace interface {
|
|||||||
// pv::RawVolume<T>
|
// pv::RawVolume<T>
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ss_ generic_serialize_volume_simple(const pv::RawVolume<T> &volume)
|
ss_ generic_serialize_volume_simple(const pv::RawVolume<T> &volume)
|
||||||
{
|
{
|
||||||
std::ostringstream os(std::ios::binary);
|
std::ostringstream os(std::ios::binary);
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@ ss_ generic_serialize_volume_simple(const pv::RawVolume<T> &volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ss_ generic_serialize_volume_compressed(const pv::RawVolume<T> &volume)
|
ss_ generic_serialize_volume_compressed(const pv::RawVolume<T> &volume)
|
||||||
{
|
{
|
||||||
std::ostringstream os(std::ios::binary);
|
std::ostringstream os(std::ios::binary);
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ ss_ generic_serialize_volume_compressed(const pv::RawVolume<T> &volume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
up_<pv::RawVolume<T>> generic_deserialize_volume(const ss_ &data)
|
up_<pv::RawVolume<T>> generic_deserialize_volume(const ss_ &data)
|
||||||
{
|
{
|
||||||
std::istringstream is(data, std::ios::binary);
|
std::istringstream is(data, std::ios::binary);
|
||||||
cereal::PortableBinaryInputArchive ar(is);
|
cereal::PortableBinaryInputArchive ar(is);
|
||||||
|
@ -8,8 +8,8 @@ namespace interface
|
|||||||
{
|
{
|
||||||
namespace debug
|
namespace debug
|
||||||
{
|
{
|
||||||
void log_current_backtrace(const ss_ &title="Current backtrace:");
|
void log_current_backtrace(const ss_ &title = "Current backtrace:");
|
||||||
void log_exception_backtrace(const ss_ &title="Exception backtrace:");
|
void log_exception_backtrace(const ss_ &title = "Exception backtrace:");
|
||||||
|
|
||||||
static const size_t BACKTRACE_SIZE = 48;
|
static const size_t BACKTRACE_SIZE = 48;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ namespace interface
|
|||||||
void get_exception_backtrace(StoredBacktrace &result);
|
void get_exception_backtrace(StoredBacktrace &result);
|
||||||
|
|
||||||
void log_backtrace(const StoredBacktrace &result,
|
void log_backtrace(const StoredBacktrace &result,
|
||||||
const ss_ &title="Stored backtrace:");
|
const ss_ &title = "Stored backtrace:");
|
||||||
|
|
||||||
struct ThreadBacktrace {
|
struct ThreadBacktrace {
|
||||||
ss_ thread_name;
|
ss_ thread_name;
|
||||||
|
@ -26,6 +26,6 @@ namespace interface
|
|||||||
bool check_file_extension(const char *path, const char *ext);
|
bool check_file_extension(const char *path, const char *ext);
|
||||||
ss_ strip_file_extension(const ss_ &path);
|
ss_ strip_file_extension(const ss_ &path);
|
||||||
ss_ strip_file_name(const ss_ &path);
|
ss_ strip_file_name(const ss_ &path);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "core/types.h"
|
#include "core/types.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace lua_bindings
|
namespace lua_bindings
|
||||||
|
@ -67,7 +67,7 @@ static const char* library_error(){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void*(*RCCPP_Constructor)(interface::Server *server);
|
typedef void*(*RCCPP_Constructor)(interface::Server * server);
|
||||||
|
|
||||||
struct RCCPP_Info {
|
struct RCCPP_Info {
|
||||||
void *module;
|
void *module;
|
||||||
|
@ -284,7 +284,7 @@ void ModuleThread::run(interface::Thread *thread)
|
|||||||
if(direct_cb){
|
if(direct_cb){
|
||||||
// Handle the direct callback
|
// Handle the direct callback
|
||||||
handle_direct_cb(direct_cb);
|
handle_direct_cb(direct_cb);
|
||||||
} else if(got_event) {
|
} else if(got_event){
|
||||||
// Handle the event
|
// Handle the event
|
||||||
handle_event(event);
|
handle_event(event);
|
||||||
} else {
|
} else {
|
||||||
@ -459,7 +459,8 @@ struct CState: public State, public interface::Server
|
|||||||
up_<interface::Thread> m_file_watch_thread;
|
up_<interface::Thread> m_file_watch_thread;
|
||||||
|
|
||||||
CState():
|
CState():
|
||||||
m_compiler(rccpp::createCompiler(g_server_config.get<ss_>("compiler_command"))),
|
m_compiler(rccpp::createCompiler(
|
||||||
|
g_server_config.get<ss_>("compiler_command"))),
|
||||||
m_thread_pool(interface::thread_pool::createThreadPool())
|
m_thread_pool(interface::thread_pool::createThreadPool())
|
||||||
{
|
{
|
||||||
m_thread_pool->start(4); // TODO: Configurable
|
m_thread_pool->start(4); // TODO: Configurable
|
||||||
@ -476,7 +477,8 @@ struct CState: public State, public interface::Server
|
|||||||
m_compiler->include_directories.push_back(
|
m_compiler->include_directories.push_back(
|
||||||
g_server_config.get<ss_>("interface_path")+"/..");
|
g_server_config.get<ss_>("interface_path")+"/..");
|
||||||
m_compiler->include_directories.push_back(
|
m_compiler->include_directories.push_back(
|
||||||
g_server_config.get<ss_>("interface_path")+"/../../3rdparty/cereal/include");
|
g_server_config.get<ss_>(
|
||||||
|
"interface_path")+"/../../3rdparty/cereal/include");
|
||||||
m_compiler->include_directories.push_back(
|
m_compiler->include_directories.push_back(
|
||||||
g_server_config.get<ss_>("interface_path")+
|
g_server_config.get<ss_>("interface_path")+
|
||||||
"/../../3rdparty/polyvox/library/PolyVoxCore/include");
|
"/../../3rdparty/polyvox/library/PolyVoxCore/include");
|
||||||
@ -874,7 +876,8 @@ struct CState: public State, public interface::Server
|
|||||||
mc.get())
|
mc.get())
|
||||||
new_sublist.push_back(mc1);
|
new_sublist.push_back(mc1);
|
||||||
else
|
else
|
||||||
log_v(MODULE, "Removing %s subscription to event %zu",
|
log_v(MODULE,
|
||||||
|
"Removing %s subscription to event %zu",
|
||||||
cs(module_name), type);
|
cs(module_name), type);
|
||||||
}
|
}
|
||||||
sublist = new_sublist;
|
sublist = new_sublist;
|
||||||
@ -899,7 +902,8 @@ struct CState: public State, public interface::Server
|
|||||||
" reference; unloading shared executable is probably unsafe",
|
" reference; unloading shared executable is probably unsafe",
|
||||||
cs(module_name));
|
cs(module_name));
|
||||||
// Drop reference to container
|
// Drop reference to container
|
||||||
log_t(MODULE, "unload_module_u[%s]: Dropping container", cs(module_name));
|
log_t(MODULE, "unload_module_u[%s]: Dropping container",
|
||||||
|
cs(module_name));
|
||||||
mc.reset();
|
mc.reset();
|
||||||
// Unload shared executable
|
// Unload shared executable
|
||||||
log_t(MODULE, "unload_module_u[%s]: Unloading shared executable",
|
log_t(MODULE, "unload_module_u[%s]: Unloading shared executable",
|
||||||
@ -1346,7 +1350,7 @@ void FileWatchThread::run(interface::Thread *thread)
|
|||||||
{
|
{
|
||||||
interface::MutexScope ms(m_server->m_modules_mutex);
|
interface::MutexScope ms(m_server->m_modules_mutex);
|
||||||
for(auto &pair : m_server->m_module_file_watches){
|
for(auto &pair : m_server->m_module_file_watches){
|
||||||
for(int fd: active_sockets){
|
for(int fd : active_sockets){
|
||||||
pair.second->report_fd(fd);
|
pair.second->report_fd(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user