Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
23 changes: 22 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
Billboard,
Children,
Opacity,
} from "./components/index.js";
} from "./components.js";

import RayControl from "./lib/RayControl.js";
import Teleport from "./lib/Teleport.js";
Expand Down Expand Up @@ -196,6 +196,27 @@ export function init() {

var w = 100;
ecsyWorld = new World();

ecsyWorld
.registerComponent(Object3D)
.registerComponent(Rotation)
.registerComponent(Position)
.registerComponent(ParentObject3D)
.registerComponent(Text)
.registerComponent(BoundingBox)
.registerComponent(BoundingSphere)
.registerComponent(Area)
.registerComponent(AreaEntering)
.registerComponent(AreaExiting)
.registerComponent(AreaInside)
.registerComponent(AreaChecker)
.registerComponent(AreaReactor)
.registerComponent(DebugHelper)
.registerComponent(DebugHelperMesh)
.registerComponent(Billboard)
.registerComponent(Children)
.registerComponent(Opacity);

ecsyWorld
.registerSystem(SDFTextSystem)
.registerSystem(AreaCheckerSystem)
Expand Down
53 changes: 29 additions & 24 deletions src/rooms/Panorama.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as THREE from 'three';
import { Text, Position, ParentObject3D } from '../components/index.js';
import * as THREE from "three";
import { Text, Position, ParentObject3D } from "../components.js";

var pano = null, context, panel, panelText;
var pano = null,
context,
panel,
panelText;

const NUM_PANOS = 5;

const DATA = [
'Tiger and Turtle - Magic Mountain\nArt installation in Agerpark, Germany.',
'Hiking trail at Lake Byllesby Regional Park near Cannon Falls, USA.',
'Dellwiger Bach natural reserve in Dortmund, Germany.',
'Zapporthorn summit in Lepontine Alps, Switzerland.',
'Ruin of romanesque Paulinzella abbey (1106) in Thuringia, Germany.',
"Tiger and Turtle - Magic Mountain\nArt installation in Agerpark, Germany.",
"Hiking trail at Lake Byllesby Regional Park near Cannon Falls, USA.",
"Dellwiger Bach natural reserve in Dortmund, Germany.",
"Zapporthorn summit in Lepontine Alps, Switzerland.",
"Ruin of romanesque Paulinzella abbey (1106) in Thuringia, Germany.",
];

var panoMaterials = [];
Expand All @@ -19,34 +22,37 @@ export function setup(ctx) {
const assets = ctx.assets;
const geometry = new THREE.SphereBufferGeometry(500, 60, 40);
for (var i = 0; i < NUM_PANOS; i++) {
const panoName = 'pano'+(i + 2);
panoMaterials[i] = new THREE.MeshBasicMaterial( { map: assets[panoName], side: THREE.BackSide });
const panoName = "pano" + (i + 2);
panoMaterials[i] = new THREE.MeshBasicMaterial({
map: assets[panoName],
side: THREE.BackSide,
});
}
pano = new THREE.Mesh(geometry, panoMaterials[0]);

panel = assets['hall_model'].scene.getObjectByName('infopanel');
panel.material = new THREE.MeshBasicMaterial({color: 0x040404});
panel = assets["hall_model"].scene.getObjectByName("infopanel");
panel.material = new THREE.MeshBasicMaterial({ color: 0x040404 });
panel.position.set(0, 0.1, 0);
panel.parent.remove(panel);

panelText = ctx.world.createEntity();
panelText
.addComponent(Text, {
color: '#ffffff',
color: "#ffffff",
fontSize: 0.02,
anchor: 'left',
textAlign: 'left',
baseline: 'center',
anchor: "left",
textAlign: "left",
baseline: "center",
maxWidth: 0.34,
lineHeight: 1.3,
text: DATA[i],
})
.addComponent(ParentObject3D, {value: panel})
.addComponent(Position, {x: -0.17, y: 0.003, z: 0.01});
.addComponent(ParentObject3D, { value: panel })
.addComponent(Position, { x: -0.17, y: 0.003, z: 0.01 });

ctx.raycontrol.addState('panorama', {
ctx.raycontrol.addState("panorama", {
raycaster: false,
onSelectEnd: onSelectEnd
onSelectEnd: onSelectEnd,
});
}

Expand All @@ -61,7 +67,7 @@ export function enter(ctx) {

ctx.controllers[1].add(panel);

ctx.raycontrol.activateState('panorama');
ctx.raycontrol.activateState("panorama");

context = ctx;
}
Expand All @@ -70,11 +76,10 @@ export function exit(ctx) {
ctx.scene.remove(pano);
ctx.controllers[1].remove(panel);

ctx.raycontrol.deactivateState('panorama');
ctx.raycontrol.deactivateState("panorama");
}

export function execute(ctx, delta, time) {
}
export function execute(ctx, delta, time) {}

export function onSelectEnd(evt) {
context.goto = 0;
Expand Down
Loading