Fix coding style
This commit is contained in:
parent
ad528c2443
commit
f64adf35d6
@ -462,7 +462,7 @@ struct Module: public interface::Module, public replicate::Interface
|
|||||||
sv_<PeerId> find_peers_that_know_node(uint node_id)
|
sv_<PeerId> find_peers_that_know_node(uint node_id)
|
||||||
{
|
{
|
||||||
sv_<PeerId> result;
|
sv_<PeerId> result;
|
||||||
for(auto &pair: m_scene_states){
|
for(auto &pair : m_scene_states){
|
||||||
PeerId peer_id = pair.first;
|
PeerId peer_id = pair.first;
|
||||||
magic::SceneReplicationState &scene_state = pair.second;
|
magic::SceneReplicationState &scene_state = pair.second;
|
||||||
auto &node_states = scene_state.nodeStates_;
|
auto &node_states = scene_state.nodeStates_;
|
||||||
|
@ -127,9 +127,9 @@ struct ChunkBuffer
|
|||||||
|
|
||||||
struct Section
|
struct Section
|
||||||
{
|
{
|
||||||
pv::Vector3DInt16 section_p;// Position in sections
|
pv::Vector3DInt16 section_p; // Position in sections
|
||||||
pv::Vector3DInt16 chunk_size;
|
pv::Vector3DInt16 chunk_size;
|
||||||
pv::Region contained_chunks;// Position and size in chunks
|
pv::Region contained_chunks; // Position and size in chunks
|
||||||
// Static voxel nodes (each contains one chunk); Initialized to 0.
|
// Static voxel nodes (each contains one chunk); Initialized to 0.
|
||||||
sp_<pv::RawVolume<uint32_t>> node_ids;
|
sp_<pv::RawVolume<uint32_t>> node_ids;
|
||||||
size_t num_chunks = 0;
|
size_t num_chunks = 0;
|
||||||
@ -222,7 +222,8 @@ ChunkBuffer& Section::get_buffer(const pv::Vector3DInt32 &chunk_p,
|
|||||||
{
|
{
|
||||||
Node *n = scene->GetNode(node_id);
|
Node *n = scene->GetNode(node_id);
|
||||||
if(!n){
|
if(!n){
|
||||||
log_w("voxelworld", "Section::get_buffer(): Node %i not found in scene "
|
log_w("voxelworld",
|
||||||
|
"Section::get_buffer(): Node %i not found in scene "
|
||||||
"for chunk " PV3I_FORMAT " in section " PV3I_FORMAT,
|
"for chunk " PV3I_FORMAT " in section " PV3I_FORMAT,
|
||||||
node_id, PV3I_PARAMS(chunk_p), PV3I_PARAMS(section_p));
|
node_id, PV3I_PARAMS(chunk_p), PV3I_PARAMS(section_p));
|
||||||
return;
|
return;
|
||||||
@ -234,7 +235,8 @@ ChunkBuffer& Section::get_buffer(const pv::Vector3DInt32 &chunk_p,
|
|||||||
interface::deserialize_volume(data);
|
interface::deserialize_volume(data);
|
||||||
buf.volume = sp_<pv::RawVolume<VoxelInstance>>(std::move(volume));
|
buf.volume = sp_<pv::RawVolume<VoxelInstance>>(std::move(volume));
|
||||||
if(!buf.volume){
|
if(!buf.volume){
|
||||||
log_w("voxelworld", "Section::get_buffer(): Voxel volume could not be "
|
log_w("voxelworld",
|
||||||
|
"Section::get_buffer(): Voxel volume could not be "
|
||||||
"loaded from node %i for chunk "
|
"loaded from node %i for chunk "
|
||||||
PV3I_FORMAT " in section " PV3I_FORMAT,
|
PV3I_FORMAT " in section " PV3I_FORMAT,
|
||||||
node_id, PV3I_PARAMS(chunk_p), PV3I_PARAMS(section_p));
|
node_id, PV3I_PARAMS(chunk_p), PV3I_PARAMS(section_p));
|
||||||
@ -475,8 +477,8 @@ struct Module: public interface::Module, public voxelworld::Interface
|
|||||||
// Remove everything managed by us from the scene
|
// Remove everything managed by us from the scene
|
||||||
m_server->access_scene([&](Scene *scene)
|
m_server->access_scene([&](Scene *scene)
|
||||||
{
|
{
|
||||||
for(auto §or_pair : m_sections){
|
for(auto §or_pair: m_sections){
|
||||||
for(auto §ion_pair : sector_pair.second){
|
for(auto §ion_pair: sector_pair.second){
|
||||||
Section §ion = section_pair.second;
|
Section §ion = section_pair.second;
|
||||||
|
|
||||||
auto region = section.node_ids->getEnclosingRegion();
|
auto region = section.node_ids->getEnclosingRegion();
|
||||||
@ -520,7 +522,7 @@ struct Module: public interface::Module, public voxelworld::Interface
|
|||||||
log_v(MODULE, "on_tick(): Doing %zu lazy node physics updates",
|
log_v(MODULE, "on_tick(): Doing %zu lazy node physics updates",
|
||||||
m_nodes_needing_physics_update.size());
|
m_nodes_needing_physics_update.size());
|
||||||
}
|
}
|
||||||
for(QueuedNodePhysicsUpdate &update : m_nodes_needing_physics_update){
|
for(QueuedNodePhysicsUpdate &update: m_nodes_needing_physics_update){
|
||||||
uint node_id = update.node_id;
|
uint node_id = update.node_id;
|
||||||
sp_<pv::RawVolume<VoxelInstance>> volume = update.volume;
|
sp_<pv::RawVolume<VoxelInstance>> volume = update.volume;
|
||||||
Node *n = scene->GetNode(node_id);
|
Node *n = scene->GetNode(node_id);
|
||||||
@ -586,7 +588,7 @@ struct Module: public interface::Module, public voxelworld::Interface
|
|||||||
ar((int32_t)event.node_id);
|
ar((int32_t)event.node_id);
|
||||||
}
|
}
|
||||||
network::access(m_server, [&](network::Interface *inetwork){
|
network::access(m_server, [&](network::Interface *inetwork){
|
||||||
for(auto &peer_id : peers){
|
for(auto &peer_id: peers){
|
||||||
inetwork->send(peer_id, "voxelworld:node_voxel_data_updated",
|
inetwork->send(peer_id, "voxelworld:node_voxel_data_updated",
|
||||||
os.str());
|
os.str());
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,8 @@ struct Module: public interface::Module
|
|||||||
|
|
||||||
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
|
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
|
||||||
{
|
{
|
||||||
interface::VoxelRegistry *voxel_reg = ivoxelworld->get_voxel_reg();
|
interface::VoxelRegistry *voxel_reg =
|
||||||
|
ivoxelworld->get_voxel_reg();
|
||||||
|
|
||||||
Node *n = scene->CreateChild("Testbox");
|
Node *n = scene->CreateChild("Testbox");
|
||||||
n->SetPosition(Vector3(30.0f, 30.0f, 40.0f));
|
n->SetPosition(Vector3(30.0f, 30.0f, 40.0f));
|
||||||
@ -152,7 +153,8 @@ struct Module: public interface::Module
|
|||||||
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
|
RigidBody *body = n->CreateComponent<RigidBody>(LOCAL);
|
||||||
body->SetFriction(0.75f);
|
body->SetFriction(0.75f);
|
||||||
body->SetMass(1.0);
|
body->SetMass(1.0);
|
||||||
CollisionShape *shape = n->CreateComponent<CollisionShape>(LOCAL);
|
CollisionShape *shape =
|
||||||
|
n->CreateComponent<CollisionShape>(LOCAL);
|
||||||
shape->SetConvexHull(model, 0, Vector3::ONE);
|
shape->SetConvexHull(model, 0, Vector3::ONE);
|
||||||
//shape->SetTriangleMesh(model, 0, Vector3::ONE);
|
//shape->SetTriangleMesh(model, 0, Vector3::ONE);
|
||||||
//shape->SetBox(Vector3::ONE);
|
//shape->SetBox(Vector3::ONE);
|
||||||
@ -201,7 +203,8 @@ struct Module: public interface::Module
|
|||||||
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
|
voxelworld::access(m_server, [&](voxelworld::Interface *ivoxelworld)
|
||||||
{
|
{
|
||||||
const pv::Vector3DInt16 §ion_p = event.section_p;
|
const pv::Vector3DInt16 §ion_p = event.section_p;
|
||||||
pv::Region region = ivoxelworld->get_section_region_voxels(section_p);
|
pv::Region region = ivoxelworld->get_section_region_voxels(
|
||||||
|
section_p);
|
||||||
|
|
||||||
pv::Vector3DInt32 p0 = region.getLowerCorner();
|
pv::Vector3DInt32 p0 = region.getLowerCorner();
|
||||||
pv::Vector3DInt32 p1 = region.getUpperCorner();
|
pv::Vector3DInt32 p1 = region.getUpperCorner();
|
||||||
@ -211,7 +214,7 @@ struct Module: public interface::Module
|
|||||||
log_t(MODULE, "on_generation_request(): p1: (%i, %i, %i)",
|
log_t(MODULE, "on_generation_request(): p1: (%i, %i, %i)",
|
||||||
p1.getX(), p1.getY(), p1.getZ());
|
p1.getX(), p1.getY(), p1.getZ());
|
||||||
|
|
||||||
interface::NoiseParams np(0, 35, interface::v3f(160,160,160),
|
interface::NoiseParams np(0, 35, interface::v3f(160, 160, 160),
|
||||||
1, 6, 0.475);
|
1, 6, 0.475);
|
||||||
|
|
||||||
auto lc = region.getLowerCorner();
|
auto lc = region.getLowerCorner();
|
||||||
@ -253,7 +256,7 @@ struct Module: public interface::Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add random trees
|
// Add random trees
|
||||||
auto extent = uc - lc + pv::Vector3DInt32(1,1,1);
|
auto extent = uc - lc + pv::Vector3DInt32(1, 1, 1);
|
||||||
int area = extent.getX() * extent.getZ();
|
int area = extent.getX() * extent.getZ();
|
||||||
auto pr = interface::PseudoRandom(13241);
|
auto pr = interface::PseudoRandom(13241);
|
||||||
for(int i = 0; i < area / 100; i++){
|
for(int i = 0; i < area / 100; i++){
|
||||||
@ -273,7 +276,7 @@ struct Module: public interface::Module
|
|||||||
if(y < lc.getY() - 5 || y > uc.getY() - 5)
|
if(y < lc.getY() - 5 || y > uc.getY() - 5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(int y1=y; y1<y+4; y1++){
|
for(int y1 = y; y1<y+4; y1++){
|
||||||
pv::Vector3DInt32 p(x, y1, z);
|
pv::Vector3DInt32 p(x, y1, z);
|
||||||
ivoxelworld->set_voxel(p, VoxelInstance(3), true);
|
ivoxelworld->set_voxel(p, VoxelInstance(3), true);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ struct Module: public interface::Module
|
|||||||
{
|
{
|
||||||
interface::Server *m_server;
|
interface::Server *m_server;
|
||||||
|
|
||||||
Event::Type m_EventType_test1_thing;// You can cache these for more speed
|
Event::Type m_EventType_test1_thing; // You can cache these for more speed
|
||||||
|
|
||||||
Module(interface::Server *server):
|
Module(interface::Server *server):
|
||||||
interface::Module("test1"),
|
interface::Module("test1"),
|
||||||
|
@ -60,7 +60,7 @@ struct CState: public State
|
|||||||
sp_<app::App> m_app;
|
sp_<app::App> m_app;
|
||||||
ss_ m_remote_cache_path;
|
ss_ m_remote_cache_path;
|
||||||
ss_ m_tmp_path;
|
ss_ m_tmp_path;
|
||||||
sm_<ss_, ss_> m_file_hashes;// name -> hash
|
sm_<ss_, ss_> m_file_hashes; // name -> hash
|
||||||
set_<ss_> m_waiting_files; // name
|
set_<ss_> m_waiting_files; // name
|
||||||
bool m_tell_after_all_files_transferred_requested = false;
|
bool m_tell_after_all_files_transferred_requested = false;
|
||||||
// Connecting is possible only once. After that has happened, the whole
|
// Connecting is possible only once. After that has happened, the whole
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <cinttypes>// PRId64
|
#include <cinttypes> // PRId64
|
||||||
#include <cmath>// isnan/isinf
|
#include <cmath> // isnan/isinf
|
||||||
#include <cfloat> // DBL_MAX/DBL_MIN
|
#include <cfloat> // DBL_MAX/DBL_MIN
|
||||||
#include "sajson.h"
|
#include "sajson.h"
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ done:
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
double d =
|
double d =
|
||||||
0.0;// gcc complains that d might be used uninitialized which isn't true. appease the warning anyway.
|
0.0; // gcc complains that d might be used uninitialized which isn't true. appease the warning anyway.
|
||||||
for(;;){
|
for(;;){
|
||||||
char c = *p;
|
char c = *p;
|
||||||
if(c < '0' || c > '9'){
|
if(c < '0' || c > '9'){
|
||||||
@ -1067,7 +1067,7 @@ done:
|
|||||||
tag = out;
|
tag = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
++p;// "
|
++p; // "
|
||||||
size_t start = p - input.get_data();
|
size_t start = p - input.get_data();
|
||||||
for(;;){
|
for(;;){
|
||||||
if(SAJSON_UNLIKELY(p >= input_end)){
|
if(SAJSON_UNLIKELY(p >= input_end)){
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cinttypes>// PRId64
|
#include <cinttypes> // PRId64
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdio.h> // snprintf
|
#include <stdio.h> // snprintf
|
||||||
|
@ -13,11 +13,11 @@ namespace interface {
|
|||||||
|
|
||||||
ss_ zerr(int ret)
|
ss_ zerr(int ret)
|
||||||
{
|
{
|
||||||
switch (ret) {
|
switch(ret){
|
||||||
case Z_ERRNO:
|
case Z_ERRNO:
|
||||||
if (ferror(stdin))
|
if(ferror(stdin))
|
||||||
return "error reading stdin";
|
return "error reading stdin";
|
||||||
if (ferror(stdout))
|
if(ferror(stdout))
|
||||||
return "error writing stdout";
|
return "error writing stdout";
|
||||||
return "errno";
|
return "errno";
|
||||||
case Z_STREAM_ERROR:
|
case Z_STREAM_ERROR:
|
||||||
@ -140,7 +140,7 @@ void decompress_zlib(std::istream &is, std::ostream &os)
|
|||||||
//dstream<<"z.avail_in="<<z.avail_in<<std::endl;
|
//dstream<<"z.avail_in="<<z.avail_in<<std::endl;
|
||||||
//dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
|
//dstream<<"fail="<<is.fail()<<" bad="<<is.bad()<<std::endl;
|
||||||
// Unget all the data that inflate didn't take
|
// Unget all the data that inflate didn't take
|
||||||
for(size_t i=0; i < z.avail_in; i++)
|
for(size_t i = 0; i < z.avail_in; i++)
|
||||||
{
|
{
|
||||||
is.unget();
|
is.unget();
|
||||||
if(is.fail() || is.bad())
|
if(is.fail() || is.bad())
|
||||||
|
@ -183,7 +183,7 @@ public:
|
|||||||
IsQuadNeededByRegistryPhysics(interface::VoxelRegistry *voxel_reg):
|
IsQuadNeededByRegistryPhysics(interface::VoxelRegistry *voxel_reg):
|
||||||
m_voxel_reg(voxel_reg)
|
m_voxel_reg(voxel_reg)
|
||||||
{}
|
{}
|
||||||
IsQuadNeededByRegistryPhysics():// PolyVox wants this
|
IsQuadNeededByRegistryPhysics(): // PolyVox wants this
|
||||||
m_voxel_reg(nullptr)
|
m_voxel_reg(nullptr)
|
||||||
{}
|
{}
|
||||||
bool operator()(VoxelType back, VoxelType front, uint32_t &materialToUse)
|
bool operator()(VoxelType back, VoxelType front, uint32_t &materialToUse)
|
||||||
@ -601,8 +601,8 @@ void set_voxel_lod_geometry(int lod, CustomGeometry *cg, Context *context,
|
|||||||
auto &lc_orig = region_orig.getLowerCorner();
|
auto &lc_orig = region_orig.getLowerCorner();
|
||||||
auto &uc_orig = region_orig.getUpperCorner();
|
auto &uc_orig = region_orig.getUpperCorner();
|
||||||
|
|
||||||
pv::Region region(lc_orig / lod - pv::Vector3DInt32(1,1,1),
|
pv::Region region(lc_orig / lod - pv::Vector3DInt32(1, 1, 1),
|
||||||
uc_orig / lod + pv::Vector3DInt32(1,1,1));
|
uc_orig / lod + pv::Vector3DInt32(1, 1, 1));
|
||||||
auto &lc = region.getLowerCorner();
|
auto &lc = region.getLowerCorner();
|
||||||
auto &uc = region.getUpperCorner();
|
auto &uc = region.getUpperCorner();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ struct CTCPSocket: public TCPSocket
|
|||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
hints.ai_protocol = IPPROTO_TCP;
|
hints.ai_protocol = IPPROTO_TCP;
|
||||||
if(address == "any")
|
if(address == "any")
|
||||||
hints.ai_flags = AI_PASSIVE;// Wildcard address
|
hints.ai_flags = AI_PASSIVE; // Wildcard address
|
||||||
const char *address_c = (address == "any" ? NULL : address.c_str());
|
const char *address_c = (address == "any" ? NULL : address.c_str());
|
||||||
const char *port_c = (port == "any" ? NULL : port.c_str());
|
const char *port_c = (port == "any" ? NULL : port.c_str());
|
||||||
int err = getaddrinfo(address_c, port_c, &hints, &res0);
|
int err = getaddrinfo(address_c, port_c, &hints, &res0);
|
||||||
@ -194,7 +194,7 @@ struct CTCPSocket: public TCPSocket
|
|||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
}
|
}
|
||||||
if(address1 == "any"){
|
if(address1 == "any"){
|
||||||
hints.ai_flags = AI_PASSIVE;// Wildcard address
|
hints.ai_flags = AI_PASSIVE; // Wildcard address
|
||||||
}
|
}
|
||||||
const char *address_c = (address1 == "any" ? NULL : address1.c_str());
|
const char *address_c = (address1 == "any" ? NULL : address1.c_str());
|
||||||
const char *port_c = (port == "any" ? NULL : port.c_str());
|
const char *port_c = (port == "any" ? NULL : port.c_str());
|
||||||
|
@ -155,11 +155,11 @@ struct CVoxelRegistry: public VoxelRegistry
|
|||||||
lod_seg_def.lod_simulation |=
|
lod_seg_def.lod_simulation |=
|
||||||
interface::ATLAS_LOD_TOP_FACE;
|
interface::ATLAS_LOD_TOP_FACE;
|
||||||
}
|
}
|
||||||
if(i == 5/*Z-*/){
|
if(i == 5 /*Z-*/){
|
||||||
lod_seg_def.lod_simulation |=
|
lod_seg_def.lod_simulation |=
|
||||||
interface::ATLAS_LOD_SEMIBRIGHT1_FACE;
|
interface::ATLAS_LOD_SEMIBRIGHT1_FACE;
|
||||||
}
|
}
|
||||||
if(i == 2/*X+*/){
|
if(i == 2 /*X+*/){
|
||||||
lod_seg_def.lod_simulation |=
|
lod_seg_def.lod_simulation |=
|
||||||
interface::ATLAS_LOD_SEMIBRIGHT2_FACE;
|
interface::ATLAS_LOD_SEMIBRIGHT2_FACE;
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ ss_ serialize_volume_simple(const pv::RawVolume<VoxelInstance> &volume)
|
|||||||
auto region = volume.getEnclosingRegion();
|
auto region = volume.getEnclosingRegion();
|
||||||
auto lc = region.getLowerCorner();
|
auto lc = region.getLowerCorner();
|
||||||
auto uc = region.getUpperCorner();
|
auto uc = region.getUpperCorner();
|
||||||
for(size_t i=0; i<volume.m_dataSize; i++){
|
for(size_t i = 0; i<volume.m_dataSize; i++){
|
||||||
const VoxelInstance &v = volume.m_pData[i];
|
const VoxelInstance &v = volume.m_pData[i];
|
||||||
ar((uint32_t)v.data);
|
ar((uint32_t)v.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
};
|
}
|
||||||
|
|
||||||
ss_ serialize_volume_compressed(const pv::RawVolume<VoxelInstance> &volume)
|
ss_ serialize_volume_compressed(const pv::RawVolume<VoxelInstance> &volume)
|
||||||
{
|
{
|
||||||
@ -44,7 +44,7 @@ ss_ serialize_volume_compressed(const pv::RawVolume<VoxelInstance> &volume)
|
|||||||
auto region = volume.getEnclosingRegion();
|
auto region = volume.getEnclosingRegion();
|
||||||
auto lc = region.getLowerCorner();
|
auto lc = region.getLowerCorner();
|
||||||
auto uc = region.getUpperCorner();
|
auto uc = region.getUpperCorner();
|
||||||
for(size_t i=0; i<volume.m_dataSize; i++){
|
for(size_t i = 0; i<volume.m_dataSize; i++){
|
||||||
const VoxelInstance &v = volume.m_pData[i];
|
const VoxelInstance &v = volume.m_pData[i];
|
||||||
ar((uint32_t)v.data);
|
ar((uint32_t)v.data);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ ss_ serialize_volume_compressed(const pv::RawVolume<VoxelInstance> &volume)
|
|||||||
ar(compressed_os.str());
|
ar(compressed_os.str());
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
};
|
}
|
||||||
|
|
||||||
up_<pv::RawVolume<VoxelInstance>> deserialize_volume(const ss_ &data)
|
up_<pv::RawVolume<VoxelInstance>> deserialize_volume(const ss_ &data)
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ up_<pv::RawVolume<VoxelInstance>> deserialize_volume(const ss_ &data)
|
|||||||
pv::Region region(0, 0, 0, w-1, h-1, d-1);
|
pv::Region region(0, 0, 0, w-1, h-1, d-1);
|
||||||
up_<pv::RawVolume<VoxelInstance>> volume(
|
up_<pv::RawVolume<VoxelInstance>> volume(
|
||||||
new pv::RawVolume<VoxelInstance>(region));
|
new pv::RawVolume<VoxelInstance>(region));
|
||||||
for(size_t i=0; i<volume->m_dataSize; i++){
|
for(size_t i = 0; i<volume->m_dataSize; i++){
|
||||||
uint32_t v;
|
uint32_t v;
|
||||||
ar(v);
|
ar(v);
|
||||||
volume->m_pData[i].data = v;
|
volume->m_pData[i].data = v;
|
||||||
@ -94,7 +94,7 @@ up_<pv::RawVolume<VoxelInstance>> deserialize_volume(const ss_ &data)
|
|||||||
{
|
{
|
||||||
std::istringstream raw_is(raw_os.str(), std::ios::binary);
|
std::istringstream raw_is(raw_os.str(), std::ios::binary);
|
||||||
cereal::PortableBinaryInputArchive ar(raw_is);
|
cereal::PortableBinaryInputArchive ar(raw_is);
|
||||||
for(size_t i=0; i<volume->m_dataSize; i++){
|
for(size_t i = 0; i<volume->m_dataSize; i++){
|
||||||
uint32_t v;
|
uint32_t v;
|
||||||
ar(v);
|
ar(v);
|
||||||
volume->m_pData[i].data = v;
|
volume->m_pData[i].data = v;
|
||||||
@ -102,7 +102,7 @@ up_<pv::RawVolume<VoxelInstance>> deserialize_volume(const ss_ &data)
|
|||||||
}
|
}
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
return up_<pv::RawVolume<VoxelInstance>>();;
|
return up_<pv::RawVolume<VoxelInstance>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace interface
|
|||||||
|
|
||||||
struct AtlasSegmentReference
|
struct AtlasSegmentReference
|
||||||
{
|
{
|
||||||
uint atlas_id = ATLAS_UNDEFINED;// 0 = undefined atlas
|
uint atlas_id = ATLAS_UNDEFINED; // 0 = undefined atlas
|
||||||
uint segment_id = 0;
|
uint segment_id = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace interface
|
|||||||
BlockName name;
|
BlockName name;
|
||||||
BlockTypeId id = BLOCKTYPEID_UNDEFINED;
|
BlockTypeId id = BLOCKTYPEID_UNDEFINED;
|
||||||
uint8_t num_rotations = 0; // Supported: 0, 4, 24
|
uint8_t num_rotations = 0; // Supported: 0, 4, 24
|
||||||
pv::Vector3DUint8 size = pv::Vector3DUint8(0, 0, 0);// Size in voxels
|
pv::Vector3DUint8 size = pv::Vector3DUint8(0, 0, 0); // Size in voxels
|
||||||
sv_<VoxelTypeId> segments; // Rotations*voxels
|
sv_<VoxelTypeId> segments; // Rotations*voxels
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ namespace interface
|
|||||||
{
|
{
|
||||||
BlockName name;
|
BlockName name;
|
||||||
uint8_t num_rotations = 0; // Supported: 0, 4, 24
|
uint8_t num_rotations = 0; // Supported: 0, 4, 24
|
||||||
pv::Vector3DUint8 size = pv::Vector3DUint8(0, 0, 0);// Size in voxels
|
pv::Vector3DUint8 size = pv::Vector3DUint8(0, 0, 0); // Size in voxels
|
||||||
// Definitions for creating voxels
|
// Definitions for creating voxels
|
||||||
sv_<ss_> side_textures; // 6 resource names
|
sv_<ss_> side_textures; // 6 resource names
|
||||||
ss_ handler_module;
|
ss_ handler_module;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace interface
|
namespace interface
|
||||||
{
|
{
|
||||||
void compress_zlib(const ss_ &data_in, std::ostream &os, int level=6);
|
void compress_zlib(const ss_ &data_in, std::ostream &os, int level = 6);
|
||||||
void decompress_zlib(std::istream &is, std::ostream &os);
|
void decompress_zlib(std::istream &is, std::ostream &os);
|
||||||
}
|
}
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -20,7 +20,7 @@ namespace interface
|
|||||||
uint segment_y = 0;
|
uint segment_y = 0;
|
||||||
uint segment_z = 0;
|
uint segment_z = 0;
|
||||||
uint rotation_primary = 0; // 4 possible rotations when looking at a face
|
uint rotation_primary = 0; // 4 possible rotations when looking at a face
|
||||||
uint rotation_secondary = 0;// 6 possible directions for a face to point to
|
uint rotation_secondary = 0; // 6 possible directions for a face to point to
|
||||||
|
|
||||||
ss_ dump() const;
|
ss_ dump() const;
|
||||||
bool operator==(const VoxelName &other) const;
|
bool operator==(const VoxelName &other) const;
|
||||||
@ -104,8 +104,8 @@ namespace interface
|
|||||||
// Create voxel from raw data (MSBs are preserved)
|
// Create voxel from raw data (MSBs are preserved)
|
||||||
VoxelInstance(uint32_t id): data(id){}
|
VoxelInstance(uint32_t id): data(id){}
|
||||||
|
|
||||||
VoxelTypeId getId() const { return data & 0x001fffff; }
|
VoxelTypeId getId() const {return data & 0x001fffff; }
|
||||||
uint8_t getMSB() const { return (data>>24) & 0xff; }
|
uint8_t getMSB() const {return (data>>24) & 0xff; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// vim: set noet ts=4 sw=4:
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -130,7 +130,7 @@ static void binary_input_read_value(lua_State *L, int type_L,
|
|||||||
log_t(MODULE, " = object[\"%s\"]", lua_tostring(L, -2));
|
log_t(MODULE, " = object[\"%s\"]", lua_tostring(L, -2));
|
||||||
binary_input_read_value(L, -1, ar); // Uses type, pushes value
|
binary_input_read_value(L, -1, ar); // Uses type, pushes value
|
||||||
lua_remove(L, -2); // Remove type
|
lua_remove(L, -2); // Remove type
|
||||||
lua_rawset(L, value_result_table_L);// Set t[#-2] = #-1
|
lua_rawset(L, value_result_table_L); // Set t[#-2] = #-1
|
||||||
}
|
}
|
||||||
lua_pop(L, 1); // Continue iterating by popping table value
|
lua_pop(L, 1); // Continue iterating by popping table value
|
||||||
field_i++;
|
field_i++;
|
||||||
|
@ -19,16 +19,16 @@ using namespace Urho3D;
|
|||||||
|
|
||||||
namespace lua_bindings {
|
namespace lua_bindings {
|
||||||
|
|
||||||
#define GET_TOLUA_STUFF(result_name, index, type)\
|
#define GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err);\
|
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err); \
|
||||||
return 0;\
|
return 0; \
|
||||||
}\
|
} \
|
||||||
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
||||||
#define TRY_GET_TOLUA_STUFF(result_name, index, type)\
|
#define TRY_GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
type *result_name = nullptr;\
|
type *result_name = nullptr; \
|
||||||
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
result_name = (type*)tolua_tousertype(L, index, 0);\
|
result_name = (type*)tolua_tousertype(L, index, 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int l_profiler_block_begin(lua_State *L)
|
static int l_profiler_block_begin(lua_State *L)
|
||||||
|
@ -8,21 +8,21 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#define MODULE "lua_bindings"
|
#define MODULE "lua_bindings"
|
||||||
|
|
||||||
#define DEF_METHOD(name){\
|
#define DEF_METHOD(name){ \
|
||||||
lua_pushcfunction(L, l_##name);\
|
lua_pushcfunction(L, l_##name); \
|
||||||
lua_setfield(L, -2, #name);\
|
lua_setfield(L, -2, #name); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GET_TOLUA_STUFF(result_name, index, type)\
|
#define GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err);\
|
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err); \
|
||||||
return 0;\
|
return 0; \
|
||||||
}\
|
} \
|
||||||
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
||||||
#define TRY_GET_TOLUA_STUFF(result_name, index, type)\
|
#define TRY_GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
type *result_name = nullptr;\
|
type *result_name = nullptr; \
|
||||||
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
result_name = (type*)tolua_tousertype(L, index, 0);\
|
result_name = (type*)tolua_tousertype(L, index, 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just do this; Urho3D's stuff doesn't really clash with anything in buildat
|
// Just do this; Urho3D's stuff doesn't really clash with anything in buildat
|
||||||
@ -98,7 +98,7 @@ struct SpatialUpdateQueue
|
|||||||
return;
|
return;
|
||||||
m_set.erase(it);
|
m_set.erase(it);
|
||||||
}
|
}
|
||||||
std::list<Item>::iterator* find(const Value &value){
|
std::list<Item>::iterator*find(const Value &value){
|
||||||
Entry entry(value);
|
Entry entry(value);
|
||||||
auto it = std::lower_bound(m_set.begin(), m_set.end(), entry,
|
auto it = std::lower_bound(m_set.begin(), m_set.end(), entry,
|
||||||
std::greater<Entry>());
|
std::greater<Entry>());
|
||||||
@ -125,7 +125,7 @@ struct SpatialUpdateQueue
|
|||||||
return;
|
return;
|
||||||
log_d(MODULE, "SpatialUpdateQueue(): Items in old queue: %zu",
|
log_d(MODULE, "SpatialUpdateQueue(): Items in old queue: %zu",
|
||||||
m_old_queue.size());
|
m_old_queue.size());
|
||||||
for(int i=0; i<max_operations; i++){
|
for(int i = 0; i<max_operations; i++){
|
||||||
if(m_old_queue.empty())
|
if(m_old_queue.empty())
|
||||||
break;
|
break;
|
||||||
Item &item = m_old_queue.back();
|
Item &item = m_old_queue.back();
|
||||||
@ -407,5 +407,5 @@ void init_spatial_update_queue(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace lua_bindingss
|
} // namespace lua_bindingss
|
||||||
// vim: set noet ts=4 sw=4:
|
|
||||||
|
|
||||||
|
// vim: set noet ts=4 sw=4:
|
||||||
|
@ -27,16 +27,16 @@ using namespace Urho3D;
|
|||||||
|
|
||||||
namespace lua_bindings {
|
namespace lua_bindings {
|
||||||
|
|
||||||
#define GET_TOLUA_STUFF(result_name, index, type)\
|
#define GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(!tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err);\
|
tolua_error(L, __PRETTY_FUNCTION__, &tolua_err); \
|
||||||
return 0;\
|
return 0; \
|
||||||
}\
|
} \
|
||||||
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
type *result_name = (type*)tolua_tousertype(L, index, 0);
|
||||||
#define TRY_GET_TOLUA_STUFF(result_name, index, type)\
|
#define TRY_GET_TOLUA_STUFF(result_name, index, type) \
|
||||||
type *result_name = nullptr;\
|
type *result_name = nullptr; \
|
||||||
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){\
|
if(tolua_isusertype(L, index, #type, 0, &tolua_err)){ \
|
||||||
result_name = (type*)tolua_tousertype(L, index, 0);\
|
result_name = (type*)tolua_tousertype(L, index, 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This API is designed this way because otherwise ownership management of
|
// NOTE: This API is designed this way because otherwise ownership management of
|
||||||
|
@ -219,7 +219,7 @@ struct CState: public State, public interface::Server
|
|||||||
interface::Mutex m_magic_mutex; // Lock for all of Urho3D
|
interface::Mutex m_magic_mutex; // Lock for all of Urho3D
|
||||||
|
|
||||||
sm_<ss_, interface::ModuleInfo> m_module_info; // Info of every seen module
|
sm_<ss_, interface::ModuleInfo> m_module_info; // Info of every seen module
|
||||||
sm_<ss_, ModuleContainer> m_modules;// Currently loaded modules
|
sm_<ss_, ModuleContainer> m_modules; // Currently loaded modules
|
||||||
set_<ss_> m_unloads_requested;
|
set_<ss_> m_unloads_requested;
|
||||||
sm_<ss_, sp_<interface::FileWatch>> m_module_file_watches;
|
sm_<ss_, sp_<interface::FileWatch>> m_module_file_watches;
|
||||||
// Module modifications are accumulated here and core:module_modified events
|
// Module modifications are accumulated here and core:module_modified events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user