Skip to content

Commit 6278482

Browse files
authored
Merge pull request #13 from MetacityTools/dev
Releasing v0.2.1
2 parents 44e331d + b004ce7 commit 6278482

File tree

37 files changed

+570
-199
lines changed

37 files changed

+570
-199
lines changed

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![Screenshot](./studio.png)
44

5-
Metacity Studio is an online tool for integrating and visualizing spatial and tabular data.
5+
Metacity Studio is an online tool for integrating and visualization of spatial data.
66

77
Running at [studio.metacity.cc](https://studio.metacity.cc)
88

@@ -11,7 +11,7 @@ Running at [studio.metacity.cc](https://studio.metacity.cc)
1111
Prepare urban visualizations online. Load your data, align it, and export it for viewing online.
1212

1313
- works best with small to medium-sized datasets
14-
- allows yout to connect 3D models and tabular data
14+
- allows yout to connect 3D models and metadata
1515

1616
## What formats can you load in?
1717

@@ -25,20 +25,31 @@ Currently:
2525

2626
The project is in active development. The roadmap is as follows:
2727

28-
### v0.3.0
28+
### v0.4.0
2929

30-
- [ ] Viewer - Details TBA
3130
- [ ] Optional interactivity - build BVH only if user opts-in to make the loaded models clickable
32-
- [ ] Integrate Google Sheets imports
31+
- [ ] Hide and show models
32+
- [ ] Viewer - Details TBA
3333

34-
### v0.2.1
34+
### v0.3.1
3535

36-
- [ ] Project export
37-
- [ ] Resize guard update graphics (The "Oops" message is pretty lame)
38-
- [ ] Transforming original metadata to a table
36+
- [ ] Loading points and lines from SHP
3937
- [ ] Extract Utils to separate SDK form metacity editors
4038

41-
### v0.2.0 - 👨‍💻 In progress
39+
### v0.3.2 - 👨‍💻 In progress
40+
41+
- [ ] Projecting models onto models (2D onto 3D) - ✨WIP https://github.com/vojtatom/geometry
42+
- [ ] Project export
43+
- [ ] Styling???
44+
45+
### v0.2.1 - ✅ Released
46+
47+
- [x] Auto setup shading based on height
48+
- [x] JSON metadata for nodes in hierarchy
49+
- [x] Assign metadata to model nodes
50+
- [x] Resize guard update graphics (The "Oops" message is pretty lame)
51+
52+
### v0.2.0 - ✅ Released
4253

4354
- [x] Infrastructure for the built-in viewer (vite setup, etc.)
4455
- [x] Building a hierarchy of models (floors, buildings, blocks, etc.) - ✨WIP
@@ -103,7 +114,6 @@ The project is in active development. The roadmap is as follows:
103114
## Backlog
104115

105116
- [ ] Merge whole models
106-
- [ ] Loading points and lines from SHP
107117
- [ ] Loading GeoJSON
108118
- [ ] Loading IFC metadata loading (memory-efficiency???)
109119
- [ ] Remesh models - intersection of triangles

package-lock.json

Lines changed: 38 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"name": "metacity-studio",
33
"private": true,
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build": "tsc && vite build --emptyOutDir",
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
1212
"@headlessui/react": "^1.7.14",
1313
"@loaders.gl/core": "^3.3.3",
1414
"@loaders.gl/gltf": "^3.3.3",
15+
"@monaco-editor/react": "^4.5.1",
1516
"@vojtatom/csvts": "^0.1.0",
1617
"allotment": "^1.18.1",
1718
"clsx": "^1.2.1",

studio/src/assets/cat.gif

25.3 KB
Loading

studio/src/assets/cat2.gif

10.5 KB
Loading

studio/src/assets/index.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ body,
3737
}
3838
}
3939

40+
@layer components {
41+
.disable-blur {
42+
-webkit-image-rendering: pixelated;
43+
-moz-image-rendering: pixelated;
44+
-o-image-rendering: pixelated;
45+
image-rendering: pixelated;
46+
}
47+
}
48+
4049
@layer components {
4150
input[type='range'] {
4251
@apply appearance-none bg-transparent cursor-pointer outline-none;

studio/src/bananagl/bananagl.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { Attributes } from './models/attributes';
55
import { Buffer, ElementBuffer } from './models/buffer';
66
import { Model } from './models/model';
77
import { Pickable } from './models/pickable';
8-
import { Renderable } from './models/renderable';
8+
import { PRIMITIVE_MODE, PrimitiveMode, Renderable } from './models/renderable';
99
import { Selectable } from './models/selectable';
10+
import { BBox } from './picking/bbox';
1011
import { Ray } from './picking/ray';
1112
import { Renderer } from './renderer/renderer';
1213
import { mountRenderer, unmountRenderer } from './renderer/setup';
@@ -37,9 +38,11 @@ export {
3738
Profiler,
3839
ShortcutOnPress,
3940
ShortcutOnMouseMove,
41+
BBox,
4042
mountRenderer,
4143
unmountRenderer,
4244
cloneUniforms,
45+
PrimitiveMode,
4346
};
4447

45-
export type { Selectable, Shortcut, TypedArray };
48+
export type { Selectable, Shortcut, TypedArray, PRIMITIVE_MODE };

studio/src/bananagl/models/renderable.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ import { Shader, UniformValue } from '@bananagl/shaders/shader';
44

55
import { Attributes } from './attributes';
66

7+
export type TRIANGLES_MODE = WebGLRenderingContextBase['TRIANGLES'];
8+
export type LINES_MODE = WebGLRenderingContextBase['LINES'];
9+
export type PRIMITIVE_MODE = TRIANGLES_MODE | LINES_MODE;
10+
11+
export enum PrimitiveMode {
12+
TRIANGLES = 4,
13+
LINES = 1,
14+
POINTS = 4,
15+
}
16+
717
export abstract class Renderable {
818
private attributes_: Attributes = new Attributes();
919
private position_: vec3 = [0, 0, 0];
1020
private rotation_: vec3 = [0, 0, 0];
1121
private scale_: vec3 = [1, 1, 1];
1222
private disposed_ = false;
1323
private visible_ = true;
14-
public mode: WebGLRenderingContextBase['TRIANGLES'] | WebGLRenderingContextBase['LINES'] = 4;
15-
24+
public mode: PRIMITIVE_MODE = PrimitiveMode.TRIANGLES;
1625

1726
private uniforms_: { [name: string]: UniformValue } = {
1827
uModelMatrix: mat4.identity(mat4.create()),

studio/src/bananagl/picking/bbox.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vec3 } from 'gl-matrix';
1+
import { vec2, vec3 } from 'gl-matrix';
22

33
import { TypedArray } from '@bananagl/shaders/shader';
44

@@ -60,6 +60,15 @@ export class BBox {
6060
);
6161
}
6262

63+
overlapedBy(from: vec2, to: vec2): boolean {
64+
return !(
65+
from[0] > this.max[0] ||
66+
to[0] < this.min[0] ||
67+
from[1] > this.max[1] ||
68+
to[1] < this.min[1]
69+
);
70+
}
71+
6372
get longestSide(): number {
6473
const [x, y, z] = this.max.map((v, i) => v - this.min[i]);
6574
return Math.max(x, y, z);

studio/src/bananagl/picking/triangles/bvh.triangle.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vec3 } from 'gl-matrix';
1+
import { vec2, vec3 } from 'gl-matrix';
22

33
import { Attribute } from '@bananagl/models/attribute';
44
import { Renderable } from '@bananagl/models/renderable';
@@ -167,4 +167,38 @@ export class TriangleBVH implements BVH {
167167
if (hit) indices.push(i);
168168
}
169169
}
170+
171+
//--------------------------------------------------------------------------------
172+
traceArea(from: vec2, to: vec2) {
173+
if (!this.root) return [];
174+
175+
const stack = new Array<BVHNode>();
176+
stack.push(this.root);
177+
178+
const indices: number[] = [];
179+
180+
while (stack.length > 0) {
181+
const node = stack.pop();
182+
if (!node) continue;
183+
if (node.bbox) {
184+
if (!node.bbox.overlapedBy(from, to)) continue;
185+
186+
if (node.left) stack.push(node.left);
187+
if (node.right) stack.push(node.right);
188+
189+
if (node.from !== undefined) {
190+
this.traverseLeafTriangleArea(node, indices);
191+
}
192+
}
193+
}
194+
195+
return indices;
196+
}
197+
198+
private traverseLeafTriangleArea(node: BVHNode, indices: number[]) {
199+
for (let i = node.from!; i < node.to!; i++) {
200+
//TODO optimize, not all triangles are inside the area
201+
indices.push(i);
202+
}
203+
}
170204
}

0 commit comments

Comments
 (0)