Propagated side to wedge

This commit is contained in:
2025-02-15 01:30:31 +03:00
parent 2eed8ef509
commit 66838892d5
27 changed files with 4444 additions and 589 deletions

Binary file not shown.

View File

@@ -1,315 +1,478 @@
{ {
"asset" : { "asset":{
"generator" : "Khronos glTF Blender I/O v3.3.32", "generator":"Khronos glTF Blender I/O v3.6.28",
"version" : "2.0" "version":"2.0"
}, },
"extensionsUsed" : [ "extensionsUsed":[
"KHR_materials_specular", "KHR_materials_specular",
"KHR_materials_ior" "KHR_materials_ior"
], ],
"scene" : 0, "scene":0,
"scenes" : [ "scenes":[
{ {
"name" : "Scene", "name":"Scene",
"nodes" : [ "nodes":[
0, 0,
1, 1,
2 2,
] 3,
} 4
], ]
"nodes" : [ }
{ ],
"mesh" : 0, "nodes":[
"name" : "road-lane-center" {
}, "mesh":0,
{ "name":"road-lane-center"
"mesh" : 1, },
"name" : "road-lane-mid", {
"translation" : [ "mesh":1,
1.100000023841858, "name":"road-lane-mid",
0, "translation":[
0 1.100000023841858,
] 0,
}, 0
{ ]
"mesh" : 2, },
"name" : "roadd-sidewalk", {
"translation" : [ "mesh":2,
2.200000047683716, "name":"roadd-sidewalk",
0, "translation":[
0 2.200000047683716,
] 0,
} 0
], ]
"materials" : [ },
{ {
"extensions" : { "mesh":3,
"KHR_materials_specular" : { "name":"roadd-sidewalk_end",
"specularColorFactor" : [ "translation":[
0.474271529955476, 3.3000001907348633,
0.474271529955476, 0,
0.474271529955476 0
] ]
}, },
"KHR_materials_ior" : { {
"ior" : 1.4500000476837158 "mesh":4,
} "name":"roadd-sidewalk_start",
}, "rotation":[
"name" : "road-material", 0,
"pbrMetallicRoughness" : { 0,
"baseColorTexture" : { -1,
"index" : 0 0
}, ],
"metallicFactor" : 0.20000000298023224 "scale":[
} -1,
} -1,
], -1
"meshes" : [ ],
{ "translation":[
"name" : "road-lane-center", 4.55145263671875,
"primitives" : [ 0,
{ 0
"attributes" : { ]
"POSITION" : 0, }
"NORMAL" : 1, ],
"TEXCOORD_0" : 2 "materials":[
}, {
"indices" : 3, "extensions":{
"material" : 0 "KHR_materials_specular":{
} "specularColorFactor":[
] 0.474271529955476,
}, 0.474271529955476,
{ 0.474271529955476
"name" : "road-lane-mid", ]
"primitives" : [ },
{ "KHR_materials_ior":{
"attributes" : { "ior":1.4500000476837158
"POSITION" : 4, }
"NORMAL" : 5, },
"TEXCOORD_0" : 6 "name":"road-material",
}, "pbrMetallicRoughness":{
"indices" : 7, "baseColorTexture":{
"material" : 0 "index":0
} },
] "metallicFactor":0.20000000298023224
}, }
{ }
"name" : "road-sidewalk", ],
"primitives" : [ "meshes":[
{ {
"attributes" : { "name":"road-lane-center",
"POSITION" : 8, "primitives":[
"NORMAL" : 9, {
"TEXCOORD_0" : 10 "attributes":{
}, "POSITION":0,
"indices" : 11, "NORMAL":1,
"material" : 0 "TEXCOORD_0":2
} },
] "indices":3,
} "material":0
], }
"textures" : [ ]
{ },
"sampler" : 0, {
"source" : 0 "name":"road-lane-mid",
} "primitives":[
], {
"images" : [ "attributes":{
{ "POSITION":4,
"mimeType" : "image/png", "NORMAL":5,
"name" : "road", "TEXCOORD_0":6
"uri" : "road.png" },
} "indices":7,
], "material":0
"accessors" : [ }
{ ]
"bufferView" : 0, },
"componentType" : 5126, {
"count" : 32, "name":"road-sidewalk",
"max" : [ "primitives":[
-8.847564458847046e-09, {
0.12099996209144592, "attributes":{
5.960464477539063e-08 "POSITION":8,
], "NORMAL":9,
"min" : [ "TEXCOORD_0":10
-0.9999999403953552, },
-0.09999995678663254, "indices":11,
-0.5 "material":0
], }
"type" : "VEC3" ]
}, },
{ {
"bufferView" : 1, "name":"road-sidewalk.001",
"componentType" : 5126, "primitives":[
"count" : 32, {
"type" : "VEC3" "attributes":{
}, "POSITION":12,
{ "NORMAL":13,
"bufferView" : 2, "TEXCOORD_0":14
"componentType" : 5126, },
"count" : 32, "indices":15,
"type" : "VEC2" "material":0
}, }
{ ]
"bufferView" : 3, },
"componentType" : 5123, {
"count" : 48, "name":"road-sidewalk.006",
"type" : "SCALAR" "primitives":[
}, {
{ "attributes":{
"bufferView" : 4, "POSITION":16,
"componentType" : 5126, "NORMAL":17,
"count" : 80, "TEXCOORD_0":18
"max" : [ },
9.921204764395952e-07, "indices":15,
0.1214386522769928, "material":0
-6.735790520906448e-07 }
], ]
"min" : [ }
-0.9999990463256836, ],
-0.09999995678663254, "textures":[
-0.5000007152557373 {
], "sampler":0,
"type" : "VEC3" "source":0
}, }
{ ],
"bufferView" : 5, "images":[
"componentType" : 5126, {
"count" : 80, "mimeType":"image/png",
"type" : "VEC3" "name":"road",
}, "uri":"road.png"
{ }
"bufferView" : 6, ],
"componentType" : 5126, "accessors":[
"count" : 80, {
"type" : "VEC2" "bufferView":0,
}, "componentType":5126,
{ "count":32,
"bufferView" : 7, "max":[
"componentType" : 5123, -8.847564458847046e-09,
"count" : 126, 0.12099996209144592,
"type" : "SCALAR" 5.960464477539063e-08
}, ],
{ "min":[
"bufferView" : 8, -0.9999999403953552,
"componentType" : 5126, -0.09999995678663254,
"count" : 42, -0.5
"max" : [ ],
2.5033950805664062e-05, "type":"VEC3"
0.19999995827674866, },
0 {
], "bufferView":1,
"min" : [ "componentType":5126,
-1.100000023841858, "count":32,
-0.10000000149011612, "type":"VEC3"
-0.5 },
], {
"type" : "VEC3" "bufferView":2,
}, "componentType":5126,
{ "count":32,
"bufferView" : 9, "type":"VEC2"
"componentType" : 5126, },
"count" : 42, {
"type" : "VEC3" "bufferView":3,
}, "componentType":5123,
{ "count":48,
"bufferView" : 10, "type":"SCALAR"
"componentType" : 5126, },
"count" : 42, {
"type" : "VEC2" "bufferView":4,
}, "componentType":5126,
{ "count":74,
"bufferView" : 11, "max":[
"componentType" : 5123, 9.921204764395952e-07,
"count" : 66, 0.1214386522769928,
"type" : "SCALAR" -6.735790520906448e-07
} ],
], "min":[
"bufferViews" : [ -0.9999990463256836,
{ -0.09999995678663254,
"buffer" : 0, -0.5000007152557373
"byteLength" : 384, ],
"byteOffset" : 0, "type":"VEC3"
"target" : 34962 },
}, {
{ "bufferView":5,
"buffer" : 0, "componentType":5126,
"byteLength" : 384, "count":74,
"byteOffset" : 384, "type":"VEC3"
"target" : 34962 },
}, {
{ "bufferView":6,
"buffer" : 0, "componentType":5126,
"byteLength" : 256, "count":74,
"byteOffset" : 768, "type":"VEC2"
"target" : 34962 },
}, {
{ "bufferView":7,
"buffer" : 0, "componentType":5123,
"byteLength" : 96, "count":126,
"byteOffset" : 1024, "type":"SCALAR"
"target" : 34963 },
}, {
{ "bufferView":8,
"buffer" : 0, "componentType":5126,
"byteLength" : 960, "count":40,
"byteOffset" : 1120, "max":[
"target" : 34962 2.5033950805664062e-05,
}, 0.19999995827674866,
{ 0
"buffer" : 0, ],
"byteLength" : 960, "min":[
"byteOffset" : 2080, -1.100000023841858,
"target" : 34962 -0.10000000149011612,
}, -0.5
{ ],
"buffer" : 0, "type":"VEC3"
"byteLength" : 640, },
"byteOffset" : 3040, {
"target" : 34962 "bufferView":9,
}, "componentType":5126,
{ "count":40,
"buffer" : 0, "type":"VEC3"
"byteLength" : 252, },
"byteOffset" : 3680, {
"target" : 34963 "bufferView":10,
}, "componentType":5126,
{ "count":40,
"buffer" : 0, "type":"VEC2"
"byteLength" : 504, },
"byteOffset" : 3932, {
"target" : 34962 "bufferView":11,
}, "componentType":5123,
{ "count":66,
"buffer" : 0, "type":"SCALAR"
"byteLength" : 504, },
"byteOffset" : 4436, {
"target" : 34962 "bufferView":12,
}, "componentType":5126,
{ "count":418,
"buffer" : 0, "max":[
"byteLength" : 336, 0.00867057777941227,
"byteOffset" : 4940, 0.19999998807907104,
"target" : 34962 0
}, ],
{ "min":[
"buffer" : 0, -1.100000023841858,
"byteLength" : 132, -0.10000000149011612,
"byteOffset" : 5276, -0.5000007152557373
"target" : 34963 ],
} "type":"VEC3"
], },
"samplers" : [ {
{ "bufferView":13,
"magFilter" : 9729, "componentType":5126,
"minFilter" : 9987 "count":418,
} "type":"VEC3"
], },
"buffers" : [ {
{ "bufferView":14,
"byteLength" : 5408, "componentType":5126,
"uri" : "road-lanes.bin" "count":418,
} "type":"VEC2"
] },
{
"bufferView":15,
"componentType":5123,
"count":975,
"type":"SCALAR"
},
{
"bufferView":16,
"componentType":5126,
"count":418,
"max":[
0.00867057777941227,
0.19999998807907104,
0.5
],
"min":[
-1.100000023841858,
-0.10000000149011612,
-7.152557373046875e-07
],
"type":"VEC3"
},
{
"bufferView":17,
"componentType":5126,
"count":418,
"type":"VEC3"
},
{
"bufferView":18,
"componentType":5126,
"count":418,
"type":"VEC2"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":384,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":384,
"byteOffset":384,
"target":34962
},
{
"buffer":0,
"byteLength":256,
"byteOffset":768,
"target":34962
},
{
"buffer":0,
"byteLength":96,
"byteOffset":1024,
"target":34963
},
{
"buffer":0,
"byteLength":888,
"byteOffset":1120,
"target":34962
},
{
"buffer":0,
"byteLength":888,
"byteOffset":2008,
"target":34962
},
{
"buffer":0,
"byteLength":592,
"byteOffset":2896,
"target":34962
},
{
"buffer":0,
"byteLength":252,
"byteOffset":3488,
"target":34963
},
{
"buffer":0,
"byteLength":480,
"byteOffset":3740,
"target":34962
},
{
"buffer":0,
"byteLength":480,
"byteOffset":4220,
"target":34962
},
{
"buffer":0,
"byteLength":320,
"byteOffset":4700,
"target":34962
},
{
"buffer":0,
"byteLength":132,
"byteOffset":5020,
"target":34963
},
{
"buffer":0,
"byteLength":5016,
"byteOffset":5152,
"target":34962
},
{
"buffer":0,
"byteLength":5016,
"byteOffset":10168,
"target":34962
},
{
"buffer":0,
"byteLength":3344,
"byteOffset":15184,
"target":34962
},
{
"buffer":0,
"byteLength":1950,
"byteOffset":18528,
"target":34963
},
{
"buffer":0,
"byteLength":5016,
"byteOffset":20480,
"target":34962
},
{
"buffer":0,
"byteLength":5016,
"byteOffset":25496,
"target":34962
},
{
"buffer":0,
"byteLength":3344,
"byteOffset":30512,
"target":34962
}
],
"samplers":[
{
"magFilter":9729,
"minFilter":9987
}
],
"buffers":[
{
"byteLength":33856,
"uri":"road-lanes.bin"
}
]
} }

Binary file not shown.

View File

@@ -0,0 +1,153 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v3.6.28",
"version":"2.0"
},
"extensionsUsed":[
"KHR_materials_specular",
"KHR_materials_ior"
],
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"terrain-col"
}
],
"materials":[
{
"alphaCutoff":0.5,
"alphaMode":"MASK",
"extensions":{
"KHR_materials_specular":{
"specularColorFactor":[
0.474271529955476,
0.474271529955476,
0.474271529955476
]
},
"KHR_materials_ior":{
"ior":1.4500000476837158
}
},
"name":"material_atlas_36953_1",
"pbrMetallicRoughness":{
"baseColorTexture":{
"index":0
},
"metallicFactor":0
}
}
],
"meshes":[
{
"name":"Plane",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3,
"material":0
}
]
}
],
"textures":[
{
"sampler":0,
"source":0
}
],
"images":[
{
"mimeType":"image/png",
"name":"Atlas_36953",
"uri":"Atlas_36953.png"
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":295,
"max":[
19.861404418945312,
0.3628370761871338,
19.687721252441406
],
"min":[
-19.76592445373535,
-4.110562324523926,
-19.641536712646484
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":295,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":295,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":552,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":3540,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":3540,
"byteOffset":3540,
"target":34962
},
{
"buffer":0,
"byteLength":2360,
"byteOffset":7080,
"target":34962
},
{
"buffer":0,
"byteLength":1104,
"byteOffset":9440,
"target":34963
}
],
"samplers":[
{
"magFilter":9729,
"minFilter":9987
}
],
"buffers":[
{
"byteLength":10544,
"uri":"lot-small-m0.bin"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://astream/terrain/details/lot-small-m0.gltf" type="PackedScene" id=1]
[node name="lot-small-m0" instance=ExtResource( 1 )]

View File

@@ -80,15 +80,15 @@
{ {
"bufferView":0, "bufferView":0,
"componentType":5126, "componentType":5126,
"count":315, "count":317,
"max":[ "max":[
29.999271392822266, 29.999271392822266,
0.30028843879699707, 0.32523614168167114,
29.77977752685547 29.77977752685547
], ],
"min":[ "min":[
-29.844146728515625, -29.844146728515625,
-4.802618026733398, -4.110562324523926,
-29.613506317138672 -29.613506317138672
], ],
"type":"VEC3" "type":"VEC3"
@@ -96,13 +96,13 @@
{ {
"bufferView":1, "bufferView":1,
"componentType":5126, "componentType":5126,
"count":315, "count":317,
"type":"VEC3" "type":"VEC3"
}, },
{ {
"bufferView":2, "bufferView":2,
"componentType":5126, "componentType":5126,
"count":315, "count":317,
"type":"VEC2" "type":"VEC2"
}, },
{ {
@@ -115,26 +115,26 @@
"bufferViews":[ "bufferViews":[
{ {
"buffer":0, "buffer":0,
"byteLength":3780, "byteLength":3804,
"byteOffset":0, "byteOffset":0,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":3780, "byteLength":3804,
"byteOffset":3780, "byteOffset":3804,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":2520, "byteLength":2536,
"byteOffset":7560, "byteOffset":7608,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":1104, "byteLength":1104,
"byteOffset":10080, "byteOffset":10144,
"target":34963 "target":34963
} }
], ],
@@ -146,7 +146,7 @@
], ],
"buffers":[ "buffers":[
{ {
"byteLength":11184, "byteLength":11248,
"uri":"lot-small0.bin" "uri":"lot-small0.bin"
} }
] ]

View File

@@ -0,0 +1,158 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v3.6.28",
"version":"2.0"
},
"extensionsUsed":[
"KHR_materials_specular",
"KHR_materials_ior"
],
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"garage-door",
"translation":[
0,
4,
0
]
}
],
"materials":[
{
"alphaCutoff":0.5,
"alphaMode":"MASK",
"extensions":{
"KHR_materials_specular":{
"specularColorFactor":[
0.474271529955476,
0.474271529955476,
0.474271529955476
]
},
"KHR_materials_ior":{
"ior":1.4500000476837158
}
},
"name":"material_atlas_36953_1",
"pbrMetallicRoughness":{
"baseColorTexture":{
"index":0
},
"metallicFactor":0
}
}
],
"meshes":[
{
"name":"Cube.002",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3,
"material":0
}
]
}
],
"textures":[
{
"sampler":0,
"source":0
}
],
"images":[
{
"mimeType":"image/png",
"name":"Atlas_36953",
"uri":"Atlas_36953.png"
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":985,
"max":[
2.4556546211242676,
0.05903172492980957,
0.09999994933605194
],
"min":[
-2.4556546211242676,
-3.980344295501709,
-0.27000004053115845
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":985,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":985,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2172,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":11820,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":11820,
"byteOffset":11820,
"target":34962
},
{
"buffer":0,
"byteLength":7880,
"byteOffset":23640,
"target":34962
},
{
"buffer":0,
"byteLength":4344,
"byteOffset":31520,
"target":34963
}
],
"samplers":[
{
"magFilter":9729,
"minFilter":9987
}
],
"buffers":[
{
"byteLength":35864,
"uri":"residental-garage-door.bin"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v3.6.28",
"version":"2.0"
},
"extensionsUsed":[
"KHR_materials_specular",
"KHR_materials_ior"
],
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"garage-roof-col",
"translation":[
0.27659401297569275,
0,
0
]
}
],
"materials":[
{
"alphaCutoff":0.5,
"alphaMode":"MASK",
"extensions":{
"KHR_materials_specular":{
"specularColorFactor":[
0.474271529955476,
0.474271529955476,
0.474271529955476
]
},
"KHR_materials_ior":{
"ior":1.4500000476837158
}
},
"name":"material_atlas_36953_1",
"pbrMetallicRoughness":{
"baseColorTexture":{
"index":0
},
"metallicFactor":0
}
}
],
"meshes":[
{
"name":"Cube.002",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3,
"material":0
}
]
}
],
"textures":[
{
"sampler":0,
"source":0
}
],
"images":[
{
"mimeType":"image/png",
"name":"Atlas_36953",
"uri":"Atlas_36953.png"
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":34,
"max":[
12.723405838012695,
2,
4
],
"min":[
-12.276594161987305,
0,
-4
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":34,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":34,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":60,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":408,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":408,
"byteOffset":408,
"target":34962
},
{
"buffer":0,
"byteLength":272,
"byteOffset":816,
"target":34962
},
{
"buffer":0,
"byteLength":120,
"byteOffset":1088,
"target":34963
}
],
"samplers":[
{
"magFilter":9729,
"minFilter":9987
}
],
"buffers":[
{
"byteLength":1208,
"uri":"residental-garage-roof1.bin"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -12,25 +12,14 @@
{ {
"name":"Scene", "name":"Scene",
"nodes":[ "nodes":[
1, 0
2
] ]
} }
], ],
"nodes":[ "nodes":[
{ {
"mesh":0, "mesh":0,
"name":"garage-col-colonly" "name":"parking--col"
},
{
"children":[
0
],
"mesh":1,
"name":"garage"
},
{
"name":"NurbsPath"
} }
], ],
"materials":[ "materials":[
@@ -60,7 +49,7 @@
], ],
"meshes":[ "meshes":[
{ {
"name":"Cube", "name":"Cube.002",
"primitives":[ "primitives":[
{ {
"attributes":{ "attributes":{
@@ -68,20 +57,7 @@
"NORMAL":1, "NORMAL":1,
"TEXCOORD_0":2 "TEXCOORD_0":2
}, },
"indices":3 "indices":3,
}
]
},
{
"name":"Cube.014",
"primitives":[
{
"attributes":{
"POSITION":4,
"NORMAL":5,
"TEXCOORD_0":6
},
"indices":7,
"material":0 "material":0
} }
] ]
@@ -106,14 +82,14 @@
"componentType":5126, "componentType":5126,
"count":160, "count":160,
"max":[ "max":[
19, 3,
6, 0.09999999403953552,
4.5 2
], ],
"min":[ "min":[
-12.100000381469727, -3,
-0.5, -0.019999999552965164,
-4.5 -2
], ],
"type":"VEC3" "type":"VEC3"
}, },
@@ -132,41 +108,7 @@
{ {
"bufferView":3, "bufferView":3,
"componentType":5123, "componentType":5123,
"count":420, "count":372,
"type":"SCALAR"
},
{
"bufferView":4,
"componentType":5126,
"count":129,
"max":[
19,
6,
4.500000953674316
],
"min":[
-12.100000381469727,
-0.5,
-4.499999046325684
],
"type":"VEC3"
},
{
"bufferView":5,
"componentType":5126,
"count":129,
"type":"VEC3"
},
{
"bufferView":6,
"componentType":5126,
"count":129,
"type":"VEC2"
},
{
"bufferView":7,
"componentType":5123,
"count":306,
"type":"SCALAR" "type":"SCALAR"
} }
], ],
@@ -191,33 +133,9 @@
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":840, "byteLength":744,
"byteOffset":5120, "byteOffset":5120,
"target":34963 "target":34963
},
{
"buffer":0,
"byteLength":1548,
"byteOffset":5960,
"target":34962
},
{
"buffer":0,
"byteLength":1548,
"byteOffset":7508,
"target":34962
},
{
"buffer":0,
"byteLength":1032,
"byteOffset":9056,
"target":34962
},
{
"buffer":0,
"byteLength":612,
"byteOffset":10088,
"target":34963
} }
], ],
"samplers":[ "samplers":[
@@ -228,7 +146,7 @@
], ],
"buffers":[ "buffers":[
{ {
"byteLength":10700, "byteLength":5864,
"uri":"residental-garage.bin" "uri":"residental-garage.bin"
} }
] ]

View File

@@ -1,6 +1,8 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://astream/terrain/details/residental-garage.gltf" type="PackedScene" id=1] [ext_resource path="res://astream/terrain/details/residental-garage.gltf" type="PackedScene" id=1]
[ext_resource path="res://astream/terrain/details/residental-garage-roof1.gltf" type="PackedScene" id=2]
[ext_resource path="res://astream/terrain/details/residental-garage-door.gltf" type="PackedScene" id=3]
[sub_resource type="CubeMesh" id=1] [sub_resource type="CubeMesh" id=1]
size = Vector3( 27, 1, 10 ) size = Vector3( 27, 1, 10 )
@@ -23,10 +25,11 @@ lod_range = 35.0
[node name="residental-garage" parent="LOD/MergeGroup" instance=ExtResource( 1 )] [node name="residental-garage" parent="LOD/MergeGroup" instance=ExtResource( 1 )]
[node name="MeshInstance" type="MeshInstance" parent="LOD/MergeGroup"] [node name="residental-garage-roof1" parent="LOD/MergeGroup" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.427596, 6.49411, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 ) [node name="residental-garage-door" parent="LOD/MergeGroup" instance=ExtResource( 3 )]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 12.7459, 1, 0 )
[node name="MergeGroup1" type="MergeGroup" parent="LOD"] [node name="MergeGroup1" type="MergeGroup" parent="LOD"]
visible = false visible = false

View File

@@ -80,61 +80,61 @@
{ {
"bufferView":0, "bufferView":0,
"componentType":5126, "componentType":5126,
"count":778, "count":1148,
"max":[ "max":[
15.457839012145996, 11.783405303955078,
0.18514837324619293, 0.1851484179496765,
13.391965866088867 9.890567779541016
], ],
"min":[ "min":[
-15.484124183654785, -11.841397285461426,
-3.5783910751342773, -4.024284839630127,
-13.159601211547852 -9.954931259155273
], ],
"type":"VEC3" "type":"VEC3"
}, },
{ {
"bufferView":1, "bufferView":1,
"componentType":5126, "componentType":5126,
"count":778, "count":1148,
"type":"VEC3" "type":"VEC3"
}, },
{ {
"bufferView":2, "bufferView":2,
"componentType":5126, "componentType":5126,
"count":778, "count":1148,
"type":"VEC2" "type":"VEC2"
}, },
{ {
"bufferView":3, "bufferView":3,
"componentType":5123, "componentType":5123,
"count":1176, "count":1728,
"type":"SCALAR" "type":"SCALAR"
} }
], ],
"bufferViews":[ "bufferViews":[
{ {
"buffer":0, "buffer":0,
"byteLength":9336, "byteLength":13776,
"byteOffset":0, "byteOffset":0,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":9336, "byteLength":13776,
"byteOffset":9336, "byteOffset":13776,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":6224, "byteLength":9184,
"byteOffset":18672, "byteOffset":27552,
"target":34962 "target":34962
}, },
{ {
"buffer":0, "buffer":0,
"byteLength":2352, "byteLength":3456,
"byteOffset":24896, "byteOffset":36736,
"target":34963 "target":34963
} }
], ],
@@ -146,7 +146,7 @@
], ],
"buffers":[ "buffers":[
{ {
"byteLength":27248, "byteLength":40192,
"uri":"sideroad-short1.bin" "uri":"sideroad-short1.bin"
} }
] ]

View File

@@ -38,6 +38,7 @@ building_data = {
"foundation60": "res://astream/terrain/details/foundation60.tscn", "foundation60": "res://astream/terrain/details/foundation60.tscn",
"bus-stop": "res://astream/terrain/details/bus-stop.tscn", "bus-stop": "res://astream/terrain/details/bus-stop.tscn",
"lot-small0": "res://astream/terrain/details/lot-small0.tscn", "lot-small0": "res://astream/terrain/details/lot-small0.tscn",
"lot-small-m0": "res://astream/terrain/details/lot-small-m0.tscn",
"lot-small1": "res://astream/terrain/details/lot-small1.tscn", "lot-small1": "res://astream/terrain/details/lot-small1.tscn",
"lot-small2": "res://astream/terrain/details/lot-small2.tscn", "lot-small2": "res://astream/terrain/details/lot-small2.tscn",
"lot-large1": "res://astream/terrain/details/lot-large1.tscn", "lot-large1": "res://astream/terrain/details/lot-large1.tscn",
@@ -75,12 +76,22 @@ lot_offset = 33.8
lot_y_rotation = 90.0 lot_y_rotation = 90.0
[lines/edges/lot-small0/left] [lines/edges/lot-small0/left]
lot_offset = 26.5 lot_offset = 33.0
lot_y_rotation = 0 lot_y_rotation = 0
lot_y_offset = 0 lot_y_offset = 0
[lines/edges/lot-small0/right] [lines/edges/lot-small0/right]
lot_offset = 26.5 lot_offset = 33.0
lot_y_rotation = 180
lot_y_offset = 0
[lines/edges/lot-small-m0/left]
lot_offset = 24.8
lot_y_rotation = 0
lot_y_offset = 0
[lines/edges/lot-small-m0/right]
lot_offset = 25.5
lot_y_rotation = 180 lot_y_rotation = 180
lot_y_offset = 0 lot_y_offset = 0
@@ -90,7 +101,7 @@ lot_y_rotation = 0
lot_y_offset = 0 lot_y_offset = 0
[lines/edges/lot-small1/right] [lines/edges/lot-small1/right]
lot_offset = 36 lot_offset = 37.5
lot_y_rotation = 180 lot_y_rotation = 180
lot_y_offset = 0 lot_y_offset = 0

View File

@@ -20,6 +20,9 @@
struct CLine { struct CLine {
struct RoadLinesData::road_line line; struct RoadLinesData::road_line line;
}; };
struct CLineIndex {
struct RoadLinesData::road_line_index index;
};
class LinesAccessor { class LinesAccessor {
public: public:
@@ -121,17 +124,6 @@ public:
struct CLine *cl = e.get_mut<CLine>(); struct CLine *cl = e.get_mut<CLine>();
cl->line.points[index].origin = position; cl->line.points[index].origin = position;
} }
inline void clear_all_line_indices()
{
BaseData::get_singleton()->get_singleton()->get().each(
[](CLine &cl) { cl.line.indices.clear(); });
}
inline void clear_line_indices(const String &key)
{
flecs::entity e = lookup(key);
struct CLine *cl = e.get_mut<CLine>();
cl->line.indices.clear();
}
inline int get_line_points_count(const String &key) const inline int get_line_points_count(const String &key) const
{ {
flecs::entity e = lookup(key); flecs::entity e = lookup(key);
@@ -145,18 +137,6 @@ public:
const struct CLine *cl = e.get<CLine>(); const struct CLine *cl = e.get<CLine>();
return cl->line.points[index].origin; return cl->line.points[index].origin;
} }
inline void add_line_index(const String &key, int id)
{
flecs::entity e = lookup(key);
struct CLine *cl = e.get_mut<CLine>();
cl->line.indices.push_back(id);
}
inline void insert_line_index(const String &key, int index, int id)
{
flecs::entity e = lookup(key);
struct CLine *cl = e.get_mut<CLine>();
cl->line.indices.insert(cl->line.indices.begin() + index, id);
}
inline void clear_line_segments(const String &key) inline void clear_line_segments(const String &key)
{ {
flecs::entity e = lookup(key); flecs::entity e = lookup(key);
@@ -224,7 +204,82 @@ public:
} }
}; };
class IndexAccessor {
public:
IndexAccessor()
{
BaseData::get_singleton()->get().component<CLineIndex>();
}
inline const struct RoadLinesData::road_line_index &
operator[](const String &key) const
{
flecs::entity e = lookup(key);
const struct CLineIndex *cl = e.get<CLineIndex>();
return cl->index;
}
const flecs::world &get() const
{
return BaseData::get_singleton()->get();
}
flecs::world &get()
{
return BaseData::get_singleton()->get();
}
template <typename F> void each(F &&func) const
{
get().each<F>(func);
}
inline flecs::entity lookup(const String &key) const
{
String ename = "line:" + key;
flecs::entity e = get().lookup(ename.ascii().ptr());
if (!e.is_valid())
print_line("can't find: " + key);
assert(e.is_valid());
return e;
}
inline void clear_all_line_indices()
{
BaseData::get_singleton()->get_singleton()->get().each(
[](CLineIndex &cl) { cl.index.indices.clear(); });
}
inline void clear_line_indices(const String &key)
{
flecs::entity e = lookup(key);
struct CLineIndex *cl = e.get_mut<CLineIndex>();
assert(cl);
cl->index.indices.clear();
}
inline void add_line_index(const String &key, int id)
{
flecs::entity e = lookup(key);
struct CLineIndex *cl = e.get_mut<CLineIndex>();
cl->index.indices.push_back(id);
}
inline void insert_line_index(const String &key, int index, int id)
{
flecs::entity e = lookup(key);
struct CLineIndex *cl = e.get_mut<CLineIndex>();
cl->index.indices.insert(cl->index.indices.begin() + index, id);
}
inline void
set_index(const String &key,
const struct RoadLinesData::road_line_index &index)
{
flecs::entity e = lookup_create(key);
e.set<CLineIndex>({ index });
}
inline flecs::entity lookup_create(const String &key) const
{
String ename = "line:" + key;
flecs::entity e = get().entity(ename.ascii().ptr());
assert(e.is_valid());
return e;
}
};
static LinesAccessor lines; static LinesAccessor lines;
static IndexAccessor indices;
ImmediateGeometry *RoadLinesData::debug_im = nullptr; ImmediateGeometry *RoadLinesData::debug_im = nullptr;
static Ref<Material> debug_material; static Ref<Material> debug_material;
@@ -243,6 +298,11 @@ const RoadLinesData::road_line &RoadLinesData::lines(const String &key) const
{ {
return ::lines[key]; return ::lines[key];
} }
const RoadLinesData::road_line_index &
RoadLinesData::indices(const String &key) const
{
return ::indices[key];
}
void RoadLinesData::set_line(const String &key, const road_line &line) void RoadLinesData::set_line(const String &key, const road_line &line)
{ {
::lines.set_line(key, line); ::lines.set_line(key, line);
@@ -267,11 +327,11 @@ void RoadLinesData::set_line_point_position(const String &key, int index,
} }
void RoadLinesData::clear_all_line_indices() void RoadLinesData::clear_all_line_indices()
{ {
::lines.clear_all_line_indices(); ::indices.clear_all_line_indices();
} }
void RoadLinesData::clear_line_indices(const String &key) void RoadLinesData::clear_line_indices(const String &key)
{ {
::lines.clear_line_indices(key); ::indices.clear_line_indices(key);
} }
void RoadLinesData::set_line_metadata(const String &key, void RoadLinesData::set_line_metadata(const String &key,
const Dictionary &metadata) const Dictionary &metadata)
@@ -366,7 +426,6 @@ void RoadLinesData::load_data()
rline.pattern = pattern; rline.pattern = pattern;
rline.points.resize(points.size()); rline.points.resize(points.size());
rline.edges.resize(edges.size()); rline.edges.resize(edges.size());
rline.indices.resize(indices.size());
for (i = 0; i < (int)points.size(); i++) { for (i = 0; i < (int)points.size(); i++) {
String point_s = points[i]; String point_s = points[i];
rline.points[i] = from_string<Transform>(point_s); rline.points[i] = from_string<Transform>(point_s);
@@ -375,13 +434,11 @@ void RoadLinesData::load_data()
const Dictionary &d = edges[i]; const Dictionary &d = edges[i];
rline.edges[i].from_dict(rline.edges[i], d); rline.edges[i].from_dict(rline.edges[i], d);
} }
for (i = 0; i < (int)indices.size(); i++) {
int index = indices[i];
rline.indices[i] = index;
}
// TODO: wtf is flags? // TODO: wtf is flags?
rline.lanes = lanes; rline.lanes = lanes;
set_line(key, rline); set_line(key, rline);
RoadLinesData::road_line_index index;
::indices.set_index(key, index);
e = e->next(); e = e->next();
} }
{ {
@@ -414,9 +471,10 @@ void RoadLinesData::save_data()
points[i] = to_string(lines(e->get()).points[i]); points[i] = to_string(lines(e->get()).points[i]);
for (i = 0; i < (int)lines(e->get()).edges.size(); i++) for (i = 0; i < (int)lines(e->get()).edges.size(); i++)
edges[i] = lines(e->get()).edges[i].to_dict(); edges[i] = lines(e->get()).edges[i].to_dict();
indices.resize(lines(e->get()).indices.size()); indices.resize(this->indices(e->get()).indices.size());
for (i = 0; i < (int)lines(e->get()).indices.size(); i++) for (i = 0; i < (int)this->indices(e->get()).indices.size();
indices[i] = lines(e->get()).indices[i]; i++)
indices[i] = this->indices(e->get()).indices[i];
pvalues["points"] = points; pvalues["points"] = points;
pvalues["edges"] = edges; pvalues["edges"] = edges;
// pvalues["indices"] = indices; // pvalues["indices"] = indices;
@@ -488,7 +546,7 @@ void RoadLinesData::road_lines_curve_index(
std::vector<Vector3> &road_lines_nodes) std::vector<Vector3> &road_lines_nodes)
{ {
int i, j; int i, j;
::lines.clear_line_indices(key); ::indices.clear_line_indices(key);
for (i = 0; i < (int)::lines.get_line_points_count(key); i++) { for (i = 0; i < (int)::lines.get_line_points_count(key); i++) {
Vector3 pt = ::lines.get_line_point_position(key, i); Vector3 pt = ::lines.get_line_point_position(key, i);
int pt_hash = road_lines_hash(pt); int pt_hash = road_lines_hash(pt);
@@ -518,7 +576,7 @@ void RoadLinesData::road_lines_curve_index(
road_lines_nodes.begin(), road_lines_nodes.end(), pt); road_lines_nodes.begin(), road_lines_nodes.end(), pt);
assert(it != road_lines_nodes.end()); assert(it != road_lines_nodes.end());
int index = it - road_lines_nodes.begin(); int index = it - road_lines_nodes.begin();
::lines.add_line_index(key, index); ::indices.add_line_index(key, index);
} }
} }
void RoadLinesData::index_lines( void RoadLinesData::index_lines(
@@ -545,19 +603,20 @@ void RoadLinesData::index_lines(
static inline int get_segment_index(const String &road, int pos) static inline int get_segment_index(const String &road, int pos)
{ {
RoadLinesData *rld = RoadLinesData::get_singleton(); RoadLinesData *rld = RoadLinesData::get_singleton();
int idx = rld->get_line(road).indices[pos]; int idx = rld->indices(road).indices[pos];
return idx; return idx;
} }
void RoadLinesData::create_segments(const String &road, void RoadLinesData::create_segments(const String &road,
std::vector<int> &segments) std::vector<int> &segments)
{ {
int i; int i;
for (i = 0; i < (int)::lines[road].indices.size() - 1; i++) { for (i = 0; i < (int)::indices[road].indices.size() - 1; i++) {
segments.push_back(i); segments.push_back(i);
segments.push_back(i + 1); segments.push_back(i + 1);
} }
} }
/* add close points on each line to the line */ /* add close points on each line to the line */
// FIXME: used?
void RoadLinesData::insert_close_points(std::vector<Vector3> &road_lines_nodes, void RoadLinesData::insert_close_points(std::vector<Vector3> &road_lines_nodes,
float distance_squared) float distance_squared)
{ {
@@ -602,8 +661,8 @@ void RoadLinesData::insert_close_points(std::vector<Vector3> &road_lines_nodes,
distance_squared) { distance_squared) {
/* split segment and replace road /* split segment and replace road
point with a point on segment */ point with a point on segment */
::lines.insert_line_index(rkey, idx, ::indices.insert_line_index(rkey, idx,
idx3); idx3);
road_lines_nodes[idx3] = closest; road_lines_nodes[idx3] = closest;
} }
} }
@@ -648,12 +707,12 @@ void RoadLinesData::update_road_lines_nodes(
std::tuple<String, String> data = kcmp[it->first]; std::tuple<String, String> data = kcmp[it->first];
const String &k = std::get<0>(data); const String &k = std::get<0>(data);
const String &r = std::get<1>(data); const String &r = std::get<1>(data);
if (::lines[k].indices.size() < 2) if (::indices[k].indices.size() < 2)
continue; continue;
if (::lines[r].indices.size() < 2) if (::indices[r].indices.size() < 2)
continue; continue;
for (i = 0; i < (int)::lines[k].indices.size() - 1; i++) { for (i = 0; i < (int)::indices[k].indices.size() - 1; i++) {
for (j = 0; j < (int)::lines[k].indices.size() - 1; for (j = 0; j < (int)::indices[k].indices.size() - 1;
j++) { j++) {
uint32_t key = k.hash() ^ i ^ r.hash() ^ j ^ uint32_t key = k.hash() ^ i ^ r.hash() ^ j ^
2147483137; 2147483137;
@@ -661,10 +720,12 @@ void RoadLinesData::update_road_lines_nodes(
2147463167; 2147463167;
if (checks.find(key) == checks.end() && if (checks.find(key) == checks.end() &&
checks.find(key2) == checks.end()) { checks.find(key2) == checks.end()) {
int idx_a1 = ::lines[k].indices[i]; int idx_a1 = ::indices[k].indices[i];
int idx_a2 = ::lines[k].indices[i + 1]; int idx_a2 =
int idx_b1 = ::lines[k].indices[j]; ::indices[k].indices[i + 1];
int idx_b2 = ::lines[k].indices[j + 1]; int idx_b1 = ::indices[k].indices[j];
int idx_b2 =
::indices[k].indices[j + 1];
std::vector<int> cmp1 = { idx_a1, std::vector<int> cmp1 = { idx_a1,
idx_a2 }; idx_a2 };
if (std::find(cmp1.begin(), cmp1.end(), if (std::find(cmp1.begin(), cmp1.end(),
@@ -730,14 +791,14 @@ void RoadLinesData::update_road_lines_nodes(
int nidx = road_lines_nodes.size(); int nidx = road_lines_nodes.size();
road_lines_nodes.push_back(pxt); road_lines_nodes.push_back(pxt);
// int il = (int)road_lines[k].indices.size(); // int il = (int)road_lines[k].indices.size();
assert(std::find(::lines[k].indices.begin(), assert(std::find(::indices[k].indices.begin(),
::lines[k].indices.end(), ::indices[k].indices.end(),
nidx) == ::lines[k].indices.end()); nidx) == ::indices[k].indices.end());
assert(std::find(::lines[r].indices.begin(), assert(std::find(::indices[r].indices.begin(),
::lines[r].indices.end(), ::indices[r].indices.end(),
nidx) == ::lines[r].indices.end()); nidx) == ::indices[r].indices.end());
::lines.insert_line_index(k, i + 1, nidx); ::indices.insert_line_index(k, i + 1, nidx);
::lines.insert_line_index(r, j + 1, nidx); ::indices.insert_line_index(r, j + 1, nidx);
} }
} }
} }

View File

@@ -192,7 +192,6 @@ public:
struct road_line { struct road_line {
std::vector<Transform> points; std::vector<Transform> points;
std::vector<struct road_edge> edges; std::vector<struct road_edge> edges;
std::vector<int> indices;
std::vector<struct line_segment> segments; std::vector<struct line_segment> segments;
int lanes; int lanes;
int pattern; int pattern;
@@ -200,6 +199,9 @@ public:
Dictionary metadata; Dictionary metadata;
_Signal<void> line_updated; _Signal<void> line_updated;
}; };
struct road_line_index {
std::vector<int> indices;
};
public: public:
static ImmediateGeometry *get_debug_node(); static ImmediateGeometry *get_debug_node();
@@ -210,6 +212,7 @@ private:
public: public:
const struct road_line &get_line(const String &key) const; const struct road_line &get_line(const String &key) const;
const struct road_line &lines(const String &key) const; const struct road_line &lines(const String &key) const;
const struct road_line_index &indices(const String &key) const;
void set_line(const String &key, const struct road_line &line); void set_line(const String &key, const struct road_line &line);
bool has_line(const String &key); bool has_line(const String &key);
void insert_line_point(const String &key, int index, void insert_line_point(const String &key, int index,

View File

@@ -578,7 +578,6 @@ void RoadLinesEditor::create_new_line_at_cursor(const String &line_name)
RoadLinesData *rld = RoadLinesData::get_singleton(); RoadLinesData *rld = RoadLinesData::get_singleton();
struct RoadLinesData::road_line rline; struct RoadLinesData::road_line rline;
rline.flags = 0; rline.flags = 0;
rline.indices.resize(0);
rline.lanes = -1; rline.lanes = -1;
if (line_name.ends_with("_road")) if (line_name.ends_with("_road"))
rline.lanes = 4; rline.lanes = 4;
@@ -1197,6 +1196,38 @@ class EdgeEditorHandler {
} }
return true; return true;
} }
void set_lot(RoadLinesData::road_edge_side &side, const String &pname,
float dir_offt)
{
side.lot_type = pname.replace("lot-", "");
if (side.lot == 0) {
side.lot = 1;
side.lot_offset = get_edge_conf<float>(pname, "left",
"lot_offset");
side.lot_y_rotation = get_edge_conf<float>(
pname, "left", "lot_y_rotation");
side.lot_offset = get_edge_conf<float>(pname, "left",
"lot_offset");
side.lot_dir_offset = dir_offt;
}
}
String get_pname(PopupMenu *menu, int id)
{
String pname;
switch (id) {
case 200:
pname = "clear";
break;
case 201:
pname = "clear-buildings";
break;
default: {
int item_index = menu->get_item_index(id);
pname = menu->get_item_metadata(item_index);
} break;
}
return pname;
}
void event_handler(const String &event, const Vector<Variant> &args) void event_handler(const String &event, const Vector<Variant> &args)
{ {
if (event == "road_lines_edge_editor::edit") { if (event == "road_lines_edge_editor::edit") {
@@ -1234,44 +1265,13 @@ class EdgeEditorHandler {
RoadLinesData *rld = RoadLinesData::get_singleton(); RoadLinesData *rld = RoadLinesData::get_singleton();
RoadLinesData::road_line rl = RoadLinesData::road_line rl =
rld->get_line(current_line); rld->get_line(current_line);
String pname; String pname = get_pname(menu, id);
switch (id) {
case 200:
pname = "clear";
break;
case 201:
pname = "clear-buildings";
break;
default:
pname = menu->get_item_metadata(item_index);
break;
}
if (pname.begins_with("lot-")) { if (pname.begins_with("lot-")) {
rl.edges[index].left.lot_type = float dir_offt =
pname.replace("lot-", ""); rl.points[index + 1].origin.distance_to(
if (rl.edges[index].left.lot == 0) { rl.points[index].origin) /
rl.edges[index].left.lot = 1; 2.0f;
rl.edges[index].left.lot_offset = set_lot(rl.edges[index].left, pname, dir_offt);
get_edge_conf<float>(
pname, "left",
"lot_offset");
rl.edges[index].left.lot_y_rotation =
get_edge_conf<float>(
pname, "left",
"lot_y_rotation");
rl.edges[index].left.lot_offset =
get_edge_conf<float>(
pname, "left",
"lot_offset");
float dir_offt =
rl.points[index + 1]
.origin.distance_to(
rl.points[index]
.origin) /
2.0f;
rl.edges[index].left.lot_dir_offset =
dir_offt;
}
} else if (pname.begins_with("residental-")) { } else if (pname.begins_with("residental-")) {
struct RoadLinesData::road_edge_side::buildings struct RoadLinesData::road_edge_side::buildings
b; b;
@@ -1291,17 +1291,20 @@ class EdgeEditorHandler {
->building_aabbs ->building_aabbs
["lot-" + ["lot-" +
lot_id]; lot_id];
pack_buildings( bool pack_result = pack_buildings(
aabb_lot, aabb_lot,
rl.edges[index] rl.edges[index]
.left.buildings, .left.buildings,
2.0f); 2.0f);
assert(pack_result);
} }
} }
} else if (pname == "clear") { } else if (pname == "clear") {
rl.edges[index].left.lot_type = ""; rl.edges[index].left.lot_type = "";
rl.edges[index].left.lot = 0; rl.edges[index].left.lot = 0;
rl.edges[index].left.buildings.clear(); rl.edges[index].left.buildings.clear();
} else if (pname == "clear-buildings") {
rl.edges[index].right.buildings.clear();
} }
rld->set_line(current_line, rl); rld->set_line(current_line, rl);
editor->rebuild_roads(); editor->rebuild_roads();
@@ -1309,47 +1312,16 @@ class EdgeEditorHandler {
PopupMenu *menu = Object::cast_to<PopupMenu>(args[0]); PopupMenu *menu = Object::cast_to<PopupMenu>(args[0]);
int id = args[1]; int id = args[1];
int item_index = menu->get_item_index(id); int item_index = menu->get_item_index(id);
String pname; String pname = get_pname(menu, id);
switch (id) {
case 200:
pname = "clear";
break;
case 201:
pname = "clear-buildings";
break;
default:
pname = menu->get_item_metadata(item_index);
break;
}
RoadLinesData *rld = RoadLinesData::get_singleton(); RoadLinesData *rld = RoadLinesData::get_singleton();
RoadLinesData::road_line rl = RoadLinesData::road_line rl =
rld->get_line(current_line); rld->get_line(current_line);
if (pname.begins_with("lot-")) { if (pname.begins_with("lot-")) {
rl.edges[index].right.lot_type = float dir_offt =
pname.replace("lot-", ""); rl.points[index + 1].origin.distance_to(
if (rl.edges[index].right.lot == 0) { rl.points[index].origin) /
rl.edges[index].right.lot = 1; 2.0f;
rl.edges[index].right.lot_offset = set_lot(rl.edges[index].right, pname, dir_offt);
get_edge_conf<float>(
pname, "right",
"lot_offset");
rl.edges[index].right.lot_y_rotation =
get_edge_conf<float>(
pname, "right",
"lot_y_rotation");
rl.edges[index].right.lot_offset =
get_edge_conf<float>(
pname, "right",
"lot_offset");
float dir_offt =
rl.points[index + 1]
.origin.distance_to(
rl.points[index]
.origin) /
2.0f;
rl.edges[index].right.lot_dir_offset =
dir_offt;
}
} else if (pname.begins_with("residental-") || } else if (pname.begins_with("residental-") ||
pname.begins_with("business-")) { pname.begins_with("business-")) {
struct RoadLinesData::road_edge_side::buildings struct RoadLinesData::road_edge_side::buildings
@@ -1370,17 +1342,20 @@ class EdgeEditorHandler {
->building_aabbs ->building_aabbs
["lot-" + ["lot-" +
lot_id]; lot_id];
pack_buildings( bool pack_result = pack_buildings(
aabb_lot, aabb_lot,
rl.edges[index] rl.edges[index]
.right.buildings, .right.buildings,
2.0f); 2.0f);
assert(pack_result);
} }
} }
} else if (pname == "clear") { } else if (pname == "clear") {
rl.edges[index].right.lot_type = ""; rl.edges[index].right.lot_type = "";
rl.edges[index].right.lot = 0; rl.edges[index].right.lot = 0;
rl.edges[index].right.buildings.clear(); rl.edges[index].right.buildings.clear();
} else if (pname == "clear-buildings") {
rl.edges[index].right.buildings.clear();
} }
rld->set_line(current_line, rl); rld->set_line(current_line, rl);
editor->rebuild_roads(); editor->rebuild_roads();

View File

@@ -24,14 +24,26 @@ struct wedge {
Vector3 p[3]; Vector3 p[3];
Vector3 y[3]; Vector3 y[3];
int width1, width2; int width1, width2;
const RoadLinesData::road_edge_side *side1, *side2;
}; };
struct RoadLinesProcessing { struct RoadLinesProcessing {
std::vector<Vector3> nodes; std::vector<Vector3> nodes;
struct edgedata { struct edgedata {
std::vector<int> neighbors; std::vector<int> neighbors;
RoadLinesData::road_edge_side *side;
}; };
std::unordered_map<int, struct edgedata> edges; std::unordered_map<int, struct edgedata> edges;
struct side_hash {
std::size_t operator()(const std::pair<int, int> &key) const
{
return std::hash<int>()(key.first) ^
(std::hash<int>()(key.second) << 8);
}
};
std::unordered_map<std::pair<int, int>,
const RoadLinesData::road_edge_side *, side_hash>
sides;
std::unordered_map<uint32_t, std::vector<struct wedge> > wedges; std::unordered_map<uint32_t, std::vector<struct wedge> > wedges;
String road_center_mesh_path, road_mid_mesh_path, String road_center_mesh_path, road_mid_mesh_path,
road_sidewalk_mesh_path; road_sidewalk_mesh_path;
@@ -386,14 +398,16 @@ out2:;
List<String>::Element *e = keys.front(); List<String>::Element *e = keys.front();
while (e) { while (e) {
const String &key = e->get(); const String &key = e->get();
if (rld->lines(key).indices.size() < 2) { if (rld->indices(key).indices.size() < 2) {
e = e->next(); e = e->next();
continue; continue;
} }
for (i = 0; i < (int)rld->lines(key).indices.size() - 1; /* creating neighbor data */
for (i = 0;
i < (int)rld->indices(key).indices.size() - 1;
i++) { i++) {
int idx1 = rld->lines(key).indices[i]; int idx1 = rld->indices(key).indices[i];
int idx2 = rld->lines(key).indices[i + 1]; int idx2 = rld->indices(key).indices[i + 1];
if (edges.find(idx1) == edges.end()) { if (edges.find(idx1) == edges.end()) {
struct edgedata ed; struct edgedata ed;
ed.neighbors.clear(); ed.neighbors.clear();
@@ -407,13 +421,19 @@ out2:;
if (std::find(edges[idx1].neighbors.begin(), if (std::find(edges[idx1].neighbors.begin(),
edges[idx1].neighbors.end(), edges[idx1].neighbors.end(),
idx2) == idx2) ==
edges[idx1].neighbors.end()) edges[idx1].neighbors.end()) {
edges[idx1].neighbors.push_back(idx2); edges[idx1].neighbors.push_back(idx2);
sides[{ idx1, idx2 }] =
&rld->lines(key).edges[i].right;
}
if (std::find(edges[idx2].neighbors.begin(), if (std::find(edges[idx2].neighbors.begin(),
edges[idx2].neighbors.end(), edges[idx2].neighbors.end(),
idx1) == idx1) ==
edges[idx2].neighbors.end()) edges[idx2].neighbors.end()) {
edges[idx2].neighbors.push_back(idx1); edges[idx2].neighbors.push_back(idx1);
sides[{ idx2, idx1 }] =
&rld->lines(key).edges[i].left;
}
} }
e = e->next(); e = e->next();
} }
@@ -476,6 +496,10 @@ out2:;
} }
} }
if (dst <= maxdst * maxdst) { if (dst <= maxdst * maxdst) {
/* split edge too close to other node
replace node's position with point on the edge
we don't create any new nodes here, only new edges.
*/
nodes[k] = np; nodes[k] = np;
edges[n2].neighbors.erase(std::remove( edges[n2].neighbors.erase(std::remove(
edges[n2].neighbors.begin(), edges[n2].neighbors.begin(),
@@ -485,20 +509,30 @@ out2:;
edges[n1].neighbors.end(), n2)); edges[n1].neighbors.end(), n2));
if (std::find(edges[k].neighbors.begin(), if (std::find(edges[k].neighbors.begin(),
edges[k].neighbors.end(), edges[k].neighbors.end(),
n1) == edges[k].neighbors.end()) n1) == edges[k].neighbors.end()) {
edges[k].neighbors.push_back(n1); edges[k].neighbors.push_back(n1);
assert(sides.find({ n2, n1 }) !=
sides.end());
sides[{ k, n1 }] = sides[{ n2, n1 }];
}
if (std::find(edges[k].neighbors.begin(), if (std::find(edges[k].neighbors.begin(),
edges[k].neighbors.end(), edges[k].neighbors.end(),
n2) == edges[k].neighbors.end()) n2) == edges[k].neighbors.end()) {
edges[k].neighbors.push_back(n2); edges[k].neighbors.push_back(n2);
sides[{ k, n2 }] = sides[{ n1, n2 }];
}
if (std::find(edges[n1].neighbors.begin(), if (std::find(edges[n1].neighbors.begin(),
edges[n1].neighbors.end(), edges[n1].neighbors.end(),
k) == edges[n1].neighbors.end()) k) == edges[n1].neighbors.end()) {
edges[n1].neighbors.push_back(k); edges[n1].neighbors.push_back(k);
sides[{ n1, k }] = sides[{ n1, n2 }];
}
if (std::find(edges[n2].neighbors.begin(), if (std::find(edges[n2].neighbors.begin(),
edges[n2].neighbors.end(), edges[n2].neighbors.end(),
k) == edges[n2].neighbors.end()) k) == edges[n2].neighbors.end()) {
edges[n2].neighbors.push_back(k); edges[n2].neighbors.push_back(k);
sides[{ n2, k }] = sides[{ n2, n1 }];
}
print_verbose("FIXED: " + itos(k) + ": " + print_verbose("FIXED: " + itos(k) + ": " +
String::num(dst)); String::num(dst));
} }
@@ -536,7 +570,20 @@ out2:;
for (j = 0; j < (int)edges[i].neighbors.size(); j++) { for (j = 0; j < (int)edges[i].neighbors.size(); j++) {
if (edges[i].neighbors.size() == 0) if (edges[i].neighbors.size() == 0)
continue; continue;
/* 1 = side to center, 2 - center to other side */
int idx1 = i;
int idx2 = edges[i].neighbors[j];
int onext = (j + 1) % edges[i].neighbors.size(); int onext = (j + 1) % edges[i].neighbors.size();
int idx3 = edges[i].neighbors[onext];
const RoadLinesData::road_edge_side *side1 =
sides[{ idx2, idx1 }];
const RoadLinesData::road_edge_side *side2 =
sides[{ idx1, idx3 }];
print_line(itos(sides.size()));
print_line(itos(idx2) + " " + itos(idx1));
print_line(itos(idx1) + " " + itos(idx3));
assert(side1);
assert(side2);
Vector3 n1 = normal(node - neighbors[j]); Vector3 n1 = normal(node - neighbors[j]);
Vector3 n2 = normal(neighbors[onext] - node); Vector3 n2 = normal(neighbors[onext] - node);
float angle = n1.signed_angle_to( float angle = n1.signed_angle_to(
@@ -604,6 +651,8 @@ out2:;
w.y[2] = o3; w.y[2] = o3;
w.width1 = 2.0f * 5.0f; w.width1 = 2.0f * 5.0f;
w.width2 = 2.0f * 5.0f; w.width2 = 2.0f * 5.0f;
w.side1 = side1;
w.side2 = side2;
wedges[i].push_back(w); wedges[i].push_back(w);
} }
} }