Skip to content

Commit

Permalink
Fix marker objects being frustum culled
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-mazepas committed Jan 24, 2025
1 parent 750250f commit 07b582d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.171.1] - 2025-01-24

- Fix a bug where markers would disappear based on camera distance.

## [0.171.0] - 2025-01-22

- Add support for realtime marker arrays.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ At a very high level there's 3 important things you need to do:
| ----- | ------------------------------------------------------------ | -------- |
| Prod | https://formantio.github.io/3d-viewer-module/versions/prod/ | 0.170.10 |
| Stage | https://formantio.github.io/3d-viewer-module/versions/stage/ | 0.170.10 |
| Dev | https://formantio.github.io/3d-viewer-module/versions/dist/ | 0.171.0 |
| Dev | https://formantio.github.io/3d-viewer-module/versions/dist/ | 0.171.1 |

# How do I run 3D viewer when i'm developing on it?

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
left: 50px !important;
}
</style>
<script type="module" crossorigin src="./assets/index-29bfbff0.js"></script>
<script type="module" crossorigin src="./assets/index-dc26c58d.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"clean": "rm -rf node_modules",
"init-dev": "yarn clean && yarn",
"dev": "vite",
"dev": "vite --host",
"dev-vr": "vite --host --port 5555 --config ./vite.config.vr.ts",
"build": "tsc && vite build --base './'",
"build-lib": "tsc && vite build --config ./vite.config.lib.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/layers/GeometryLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ function InstancedGeometry({
ref={ref}
args={[null as any, null as any, instances.length]}
up={new Vector3(0, 0, 1)}
frustumCulled={false}
>
{type === "sphere" ? (
<sphereGeometry
Expand Down Expand Up @@ -285,6 +286,7 @@ function InstancedGeometryFromList({ instances }: InstanceGeoListProps) {
// update the instanceMatrix and instanceColor once
if (ref.current) {
ref.current.instanceMatrix.needsUpdate = true;
ref.current.frustumCulled = false;
if (ref.current.instanceColor) {
ref.current.instanceColor.needsUpdate = true;
}
Expand Down Expand Up @@ -704,7 +706,6 @@ export function GeometryLayer(props: IGeometryLayer) {
.deviceId,
dataSource,
(d) => {
console.log("d", d);
if (typeof d === "symbol") {
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/layers/objects/GeometryWorld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class GeometryWorld {
});
}
let type = "";
if (typeof type === "number") {
if (typeof marker.type === "number") {
// if typeis a number, map it to a string
const typeIdMap = {
0: "arrow",
Expand All @@ -181,8 +181,9 @@ export class GeometryWorld {
10: "mesh_resource",
11: "triangle_list",
};
type = typeIdMap[type as keyof typeof typeIdMap];
type = typeIdMap[marker.type as keyof typeof typeIdMap];
} else {
//@ts-ignore
type = marker.type.toString();
}

Expand Down

0 comments on commit 07b582d

Please sign in to comment.