Updated test
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -70,7 +70,8 @@
|
||||
"format": "cpp",
|
||||
"future": "cpp",
|
||||
"cassert": "cpp",
|
||||
"bitset": "cpp"
|
||||
"bitset": "cpp",
|
||||
"unordered_set": "cpp"
|
||||
},
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
}
|
||||
@@ -132,7 +132,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 49, 50, 51, 52 ],
|
||||
"children": [ 49, 50, 51, 52, 53 ],
|
||||
"commands": [ ],
|
||||
"index": 17,
|
||||
"name": "zone_3",
|
||||
@@ -260,7 +260,7 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 53, 54, 55 ],
|
||||
"children": [ 54, 55, 56 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 30,
|
||||
"name": "zone_0",
|
||||
@@ -268,7 +268,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 56, 57 ],
|
||||
"children": [ 57, 58 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 31,
|
||||
"name": "zone_1",
|
||||
@@ -286,7 +286,7 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 58 ],
|
||||
"children": [ 59 ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 33,
|
||||
"name": "stair_0",
|
||||
@@ -296,7 +296,7 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 59, 60, 61 ],
|
||||
"children": [ 60, 61, 62 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 34,
|
||||
"name": "zone_0",
|
||||
@@ -304,7 +304,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 62, 63 ],
|
||||
"children": [ 63, 64 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 35,
|
||||
"name": "zone_1",
|
||||
@@ -312,7 +312,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 64 ],
|
||||
"children": [ 65 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 36,
|
||||
"name": "zone_0",
|
||||
@@ -320,7 +320,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 65, 66 ],
|
||||
"children": [ 66, 67 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 37,
|
||||
"name": "zone_1",
|
||||
@@ -328,7 +328,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 67 ],
|
||||
"children": [ 68 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 38,
|
||||
"name": "zone_0",
|
||||
@@ -336,7 +336,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 68 ],
|
||||
"children": [ 69 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 39,
|
||||
"name": "zone_1",
|
||||
@@ -344,7 +344,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 69 ],
|
||||
"children": [ 70 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 40,
|
||||
"name": "zone_0",
|
||||
@@ -352,7 +352,7 @@ entries=[ {
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 70 ],
|
||||
"children": [ 71 ],
|
||||
"commands": [ [ 3, [ ] ], [ 4, [ ] ] ],
|
||||
"index": 41,
|
||||
"name": "zone_1",
|
||||
@@ -471,8 +471,18 @@ entries=[ {
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"commands": [ ],
|
||||
"index": 53,
|
||||
"name": "enterance_1",
|
||||
"order": 5,
|
||||
"room_area": 16.0,
|
||||
"room_type": 304,
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 54,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -482,7 +492,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 54,
|
||||
"index": 55,
|
||||
"name": "wc_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
@@ -492,7 +502,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 55,
|
||||
"index": 56,
|
||||
"name": "bedroom_0",
|
||||
"order": 2,
|
||||
"room_area": 36.0,
|
||||
@@ -502,7 +512,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 56,
|
||||
"index": 57,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 36.0,
|
||||
@@ -512,7 +522,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 57,
|
||||
"index": 58,
|
||||
"name": "kitchen_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
@@ -520,17 +530,17 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 71, 72 ],
|
||||
"children": [ 72, 73 ],
|
||||
"commands": [ ],
|
||||
"floor_index": 1,
|
||||
"index": 58,
|
||||
"index": 59,
|
||||
"name": "floor_0",
|
||||
"order": 0,
|
||||
"type": "floor"
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 59,
|
||||
"index": 60,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -540,7 +550,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 60,
|
||||
"index": 61,
|
||||
"name": "bathroom_0",
|
||||
"order": 1,
|
||||
"room_area": 16.0,
|
||||
@@ -550,7 +560,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 61,
|
||||
"index": 62,
|
||||
"name": "bedroom_0",
|
||||
"order": 2,
|
||||
"room_area": 64.0,
|
||||
@@ -560,7 +570,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 62,
|
||||
"index": 63,
|
||||
"name": "kitchen_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -570,7 +580,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 63,
|
||||
"index": 64,
|
||||
"name": "living_room_0",
|
||||
"order": 1,
|
||||
"room_area": 144.0,
|
||||
@@ -580,7 +590,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 64,
|
||||
"index": 65,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -590,7 +600,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 65,
|
||||
"index": 66,
|
||||
"name": "kitchen_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -600,7 +610,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 66,
|
||||
"index": 67,
|
||||
"name": "living_room_0",
|
||||
"order": 1,
|
||||
"room_area": 64.0,
|
||||
@@ -610,7 +620,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 67,
|
||||
"index": 68,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -620,7 +630,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 68,
|
||||
"index": 69,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -630,7 +640,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 69,
|
||||
"index": 70,
|
||||
"name": "bathroom_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -640,7 +650,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ [ 5, [ ] ] ],
|
||||
"index": 70,
|
||||
"index": 71,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -648,24 +658,24 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 73 ],
|
||||
"children": [ 74 ],
|
||||
"commands": [ ],
|
||||
"index": 71,
|
||||
"index": 72,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 1
|
||||
}, {
|
||||
"children": [ 74, 75 ],
|
||||
"children": [ 75, 76 ],
|
||||
"commands": [ ],
|
||||
"index": 72,
|
||||
"index": 73,
|
||||
"name": "unit_0",
|
||||
"order": 0,
|
||||
"type": "unit"
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 73,
|
||||
"index": 74,
|
||||
"name": "storage_room_0",
|
||||
"order": 0,
|
||||
"room_area": 64.0,
|
||||
@@ -673,17 +683,17 @@ entries=[ {
|
||||
"type": "room",
|
||||
"window": true
|
||||
}, {
|
||||
"children": [ 76 ],
|
||||
"children": [ 77 ],
|
||||
"commands": [ ],
|
||||
"index": 74,
|
||||
"index": 75,
|
||||
"name": "zone_0",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
"zone_type": 0
|
||||
}, {
|
||||
"children": [ 77 ],
|
||||
"children": [ 78 ],
|
||||
"commands": [ ],
|
||||
"index": 75,
|
||||
"index": 76,
|
||||
"name": "zone_1",
|
||||
"order": 0,
|
||||
"type": "zone",
|
||||
@@ -691,7 +701,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 76,
|
||||
"index": 77,
|
||||
"name": "wc_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
@@ -701,7 +711,7 @@ entries=[ {
|
||||
}, {
|
||||
"children": [ ],
|
||||
"commands": [ ],
|
||||
"index": 77,
|
||||
"index": 78,
|
||||
"name": "living_room_0",
|
||||
"order": 0,
|
||||
"room_area": 16.0,
|
||||
|
||||
Submodule src/flecs updated: 3710bec505...e3219d774d
Submodule src/godot updated: 12e9b22777...f75abbb3ec
Submodule src/meshoptimizer updated: ebd0378fd3...bab69978d8
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
#include "base_data.h"
|
||||
#include "world_editor.h"
|
||||
#include "building_layout_graph.h"
|
||||
#include "grid_misc.h"
|
||||
#include "graph_module.h"
|
||||
|
||||
void BuildingLayoutGraph::graph_module::room_growth_module(
|
||||
@@ -430,6 +431,15 @@ void BuildingLayoutGraph::graph_module::room_growth_module(
|
||||
if (id >= 0) {
|
||||
flecs::entity selected_e =
|
||||
prio.get_entity(id);
|
||||
int mcount = 0;
|
||||
selected_e.each<
|
||||
WorldEditor::components::
|
||||
belongs_room>(
|
||||
[&mcount](flecs::entity
|
||||
e) {
|
||||
mcount++;
|
||||
});
|
||||
assert(mcount == 0);
|
||||
selected_e.add<
|
||||
WorldEditor::components::
|
||||
belongs_room>(
|
||||
|
||||
@@ -78,7 +78,6 @@ void region_tree::dump(flecs::entity grid_floor_e) const
|
||||
|
||||
void region_tree::grow()
|
||||
{
|
||||
#ifndef TESTS
|
||||
List<struct region_tree *> grow_list;
|
||||
List<struct region_tree *> queue;
|
||||
List<struct region_tree *>::Element *e, *e1;
|
||||
@@ -296,12 +295,10 @@ void region_tree::grow()
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void region_tree::place(flecs::entity grid_floor_e) const
|
||||
{
|
||||
#ifndef TESTS
|
||||
int i, j;
|
||||
List<const struct region_tree *> queue;
|
||||
int grid_size = grid_floor_e
|
||||
@@ -340,12 +337,10 @@ void region_tree::place(flecs::entity grid_floor_e) const
|
||||
queue.push_back(item->children[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void region_tree::get_rects(List<RegionRect2i> *rect_list) const
|
||||
{
|
||||
#ifndef TESTS
|
||||
List<const struct region_tree *> queue;
|
||||
queue.push_back(this);
|
||||
while (!queue.empty()) {
|
||||
@@ -362,14 +357,12 @@ void region_tree::get_rects(List<RegionRect2i> *rect_list) const
|
||||
for (i = 0; i < (int)item->children.size(); i++)
|
||||
queue.push_back(item->children[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool region_tree::check_candidate(int i, const RegionRect2i &candidate) const
|
||||
{
|
||||
int j;
|
||||
bool ok = true;
|
||||
#ifndef TESTS
|
||||
if (!region.rect.encloses(candidate))
|
||||
return false;
|
||||
for (j = 0; j < children.size(); j++) {
|
||||
@@ -392,14 +385,12 @@ bool region_tree::check_candidate(int i, const RegionRect2i &candidate) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool region_tree::check_candidate(const RegionRect2i &candidate) const
|
||||
{
|
||||
bool ok = true;
|
||||
#ifndef TESTS
|
||||
if (parent && !parent->region.rect.encloses(candidate))
|
||||
return false;
|
||||
if (candidate.intersects(region.rect))
|
||||
@@ -410,7 +401,6 @@ bool region_tree::check_candidate(const RegionRect2i &candidate) const
|
||||
ok = false;
|
||||
if (region.rect.intersects(candidate))
|
||||
ok = false;
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -421,7 +411,6 @@ flecs::entity region_tree::update_cell(flecs::entity grid_floor_e,
|
||||
flecs::entity region_e = grid_floor_e.world().entity(region_et);
|
||||
flecs::entity parent_e = grid_floor_e.world().entity(parent_et);
|
||||
flecs::log::dbg("create_cell: %s %d", region_e.path().c_str(), id);
|
||||
#ifndef TESTS
|
||||
String pname("cell_" + itos(id));
|
||||
flecs::entity cell_e = grid_floor_e.lookup(pname.ascii().ptr());
|
||||
if (!cell_e.is_valid()) {
|
||||
@@ -459,19 +448,14 @@ flecs::entity region_tree::update_cell(flecs::entity grid_floor_e,
|
||||
cell_e.add<WorldEditor::components::belongs_room>(
|
||||
region_e);
|
||||
}
|
||||
#else
|
||||
flecs::entity cell_e;
|
||||
#endif
|
||||
return cell_e;
|
||||
}
|
||||
|
||||
void region_tree::update_candidate(const RegionRect2i &candidate)
|
||||
{
|
||||
#if 0
|
||||
int orig_area = region.rect.get_area();
|
||||
region.rect = candidate;
|
||||
int new_area = candidate.get_area();
|
||||
int avalue = MAX(0, new_area - orig_area);
|
||||
region.remains_area -= avalue;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -68,6 +68,100 @@ String &String::operator+=(const char *p_str) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool String::operator==(const String &p_str) const {
|
||||
if (length() != p_str.length()) {
|
||||
return false;
|
||||
}
|
||||
if (empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int l = length();
|
||||
|
||||
const CharType *src = c_str();
|
||||
const CharType *dst = p_str.c_str();
|
||||
|
||||
/* Compare char by char */
|
||||
for (int i = 0; i < l; i++) {
|
||||
if (src[i] != dst[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool String::operator!=(const String &p_str) const {
|
||||
return !(*this == p_str);
|
||||
}
|
||||
|
||||
bool String::operator==(const char *p_str) const {
|
||||
int len = 0;
|
||||
const char *aux = p_str;
|
||||
|
||||
while (*(aux++) != 0) {
|
||||
len++;
|
||||
}
|
||||
|
||||
if (length() != len) {
|
||||
return false;
|
||||
}
|
||||
if (empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int l = length();
|
||||
|
||||
const CharType *dst = c_str();
|
||||
|
||||
/* Compare char by char */
|
||||
for (int i = 0; i < l; i++) {
|
||||
if (p_str[i] != dst[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool String::operator==(const CharType *p_str) const {
|
||||
int len = 0;
|
||||
const CharType *aux = p_str;
|
||||
|
||||
while (*(aux++) != 0) {
|
||||
len++;
|
||||
}
|
||||
|
||||
if (length() != len) {
|
||||
return false;
|
||||
}
|
||||
if (empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int l = length();
|
||||
|
||||
const CharType *dst = c_str();
|
||||
|
||||
/* Compare char by char */
|
||||
for (int i = 0; i < l; i++) {
|
||||
if (p_str[i] != dst[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool String::operator!=(const char *p_str) const {
|
||||
return (!(*this == p_str));
|
||||
}
|
||||
|
||||
bool String::operator!=(const CharType *p_str) const {
|
||||
return (!(*this == p_str));
|
||||
}
|
||||
|
||||
|
||||
CharString String::ascii(bool p_allow_extended) const {
|
||||
if (!length()) {
|
||||
return CharString();
|
||||
@@ -314,5 +408,56 @@ const CharType *String::c_str() const {
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const char *p_chr, const String &p_str) {
|
||||
return p_str == p_chr;
|
||||
}
|
||||
|
||||
String operator+(const char *p_chr, const String &p_str) {
|
||||
String tmp = p_chr;
|
||||
tmp += p_str;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
String itos(int64_t p_val) {
|
||||
return String::num_int64(p_val);
|
||||
}
|
||||
|
||||
String String::num_int64(int64_t p_num, int base, bool capitalize_hex) {
|
||||
bool sign = p_num < 0;
|
||||
|
||||
int64_t n = p_num;
|
||||
|
||||
int chars = 0;
|
||||
do {
|
||||
n /= base;
|
||||
chars++;
|
||||
} while (n);
|
||||
|
||||
if (sign) {
|
||||
chars++;
|
||||
}
|
||||
String s;
|
||||
s.resize(chars + 1);
|
||||
CharType *c = s.ptrw();
|
||||
c[chars] = 0;
|
||||
n = p_num;
|
||||
do {
|
||||
int mod = ABS(n % base);
|
||||
if (mod >= 10) {
|
||||
char a = (capitalize_hex ? 'A' : 'a');
|
||||
c[--chars] = a + (mod - 10);
|
||||
} else {
|
||||
c[--chars] = '0' + mod;
|
||||
}
|
||||
|
||||
n /= base;
|
||||
} while (n);
|
||||
|
||||
if (sign) {
|
||||
c[0] = '-';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ void Vector<T>::append_array(Vector<T> p_other) {
|
||||
template <class T>
|
||||
bool Vector<T>::push_back(T p_elem) {
|
||||
Error err = resize(size() + 1);
|
||||
assert(err != OK);
|
||||
assert(err == OK);
|
||||
set(size() - 1, p_elem);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,34 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
flecs::world ecs;
|
||||
flecs::entity graph_base_e = ecs.entity("graph");
|
||||
flecs::entity graph_e = ecs.entity("v1").child_of(graph_base_e);
|
||||
flecs::entity grid_base_e = ecs.entity("grid");
|
||||
flecs::entity grid_e = ecs.entity("v1").child_of(grid_base_e);
|
||||
flecs::entity grid_floor_e = ecs.entity("floor_0").child_of(grid_e);
|
||||
List<struct region> region_list;
|
||||
struct region region;
|
||||
region.region_et = graph_e.id();
|
||||
region.rect = RegionRect2i(0, 0, 25, 25);
|
||||
struct region_tree regions;
|
||||
regions.region = region;
|
||||
regions.dump(grid_floor_e);
|
||||
flecs::entity zone1_e = ecs.entity("zone1").child_of(graph_e),
|
||||
zone2_e = ecs.entity("zone2").child_of(graph_e),
|
||||
zone3_e = ecs.entity("zone3").child_of(graph_e);
|
||||
struct region region_data[] = {
|
||||
{.region_et = zone1_e.id(), .rect = {0, 0, 1, 1}},
|
||||
{.region_et = zone2_e.id(), .rect = {2, 2, 1, 1}},
|
||||
{.region_et = zone3_e.id(), .rect = {4, 4, 1 ,1}}
|
||||
};
|
||||
for (i = 0; i < sizeof(region_data) / sizeof(region_data[0]); i++)
|
||||
region_list.push_back(region_data[i]);
|
||||
regions.split(region_list);
|
||||
regions.dump(grid_floor_e);
|
||||
regions.grow();
|
||||
regions.dump(grid_floor_e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user