Skip to content

Commit

Permalink
Add object menu link if image controls are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Nov 30, 2023
1 parent 860435e commit 6c07f38
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/inflators/image-loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { addComponent } from "bitecs";
import { HubsWorld } from "../app";
import { MediaImageLoaderData } from "../bit-components";
import { MediaImageLoaderData, MediaLink } from "../bit-components";
import { AlphaModeName, getAlphaModeFromAlphaModeName } from "../utils/create-image-mesh";
import { ProjectionModeName, getProjectionFromProjectionName } from "../utils/projection-mode";
import { inflateMediaLoader } from "./media-loader";
Expand All @@ -9,12 +10,14 @@ export interface ImageLoaderParams {
projection: ProjectionModeName;
alphaMode: AlphaModeName;
alphaCutoff: number;
controls: boolean;
}

const DEFAULTS: Partial<ImageLoaderParams> = {
projection: ProjectionModeName.FLAT,
alphaMode: AlphaModeName.OPAQUE,
alphaCutoff: 0.5
alphaCutoff: 0.5,
controls: false
};

export function inflateImageLoader(world: HubsWorld, eid: number, params: ImageLoaderParams) {
Expand All @@ -35,4 +38,8 @@ export function inflateImageLoader(world: HubsWorld, eid: number, params: ImageL
alphaMode: getAlphaModeFromAlphaModeName(requiredParams.alphaMode),
projection: getProjectionFromProjectionName(requiredParams.projection)
});

if (params.controls) {
addComponent(world, MediaLink, eid);
}
}

0 comments on commit 6c07f38

Please sign in to comment.