diff --git a/.gitignore b/.gitignore
index a76986a..79abc03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -135,3 +135,4 @@ dist
*.obj
*.mtl
public/assets/skybox.png
+public/assets/players/
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 335f153..2413b62 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,8 @@
"@tweenjs/tween.js": "25.0.0",
"aframe": "^1.6.0",
"aframe-extras": "^7.5.1",
+ "aframe-htmlembed-component": "^1.0.0",
+ "aframe-label": "^0.1.3",
"aframe-orbit-controls": "^1.3.2",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
@@ -764,6 +766,18 @@
"three-pathfinding": "^1.3.0"
}
},
+ "node_modules/aframe-htmlembed-component": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/aframe-htmlembed-component/-/aframe-htmlembed-component-1.0.0.tgz",
+ "integrity": "sha512-zE3OuESH3O1e9oHNOT+ITVDo3gdwuuWfQnITIDs4Ve2fe4+Rm9r/1IL4w7dRwX39s9ihlEcpxbnEyK82a4ua8w==",
+ "license": "MIT"
+ },
+ "node_modules/aframe-label": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/aframe-label/-/aframe-label-0.1.3.tgz",
+ "integrity": "sha512-o5scWFfGG+L/eCyKTsLIU/hU68YVJBCN8UHm97f9Uu0C3Dh/FjReZ34z21CfGZnpzcKw8qnUo2AFZ76DP1rUDQ==",
+ "license": "MIT"
+ },
"node_modules/aframe-orbit-controls": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/aframe-orbit-controls/-/aframe-orbit-controls-1.3.2.tgz",
diff --git a/package.json b/package.json
index d9e3c95..6805c2f 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,8 @@
"@tweenjs/tween.js": "25.0.0",
"aframe": "^1.6.0",
"aframe-extras": "^7.5.1",
+ "aframe-htmlembed-component": "^1.0.0",
+ "aframe-label": "^0.1.3",
"aframe-orbit-controls": "^1.3.2",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
diff --git a/scripts/download-assets.sh b/scripts/download-assets.sh
index 7db262f..90f0afe 100755
--- a/scripts/download-assets.sh
+++ b/scripts/download-assets.sh
@@ -1,4 +1,5 @@
mkdir -p ../public/assets/coral
+mkdir -p ../public/assets/players/skins
curl -o ../public/assets/bottlenose-dolphin.glb https://cmc-cdn.web.cern.ch/assets/reef-simulator/bottlenose-dolphin.glb
curl -o ../public/assets/green-turtle.glb https://cmc-cdn.web.cern.ch/assets/reef-simulator/green-turtle.glb
@@ -24,9 +25,6 @@ curl -o ../public/assets/coral/montastrea-cavernosa.glb https://cmc-cdn.w
curl -o ../public/assets/coral/pseudodiploria-strigosa.glb https://cmc-cdn.web.cern.ch/assets/reef-simulator/Coral%20Assets/pseudodiploria-strigosa.glb
-
-
-
-
-
->>>>>>> Stashed changes
+curl -o ../public/assets/players/characterMediumAllAnimations.glb https://cmc-cdn.web.cern.ch/assets/kenney.nl/characterMediumAllAnimations.glb
+curl -o /tmp/skins.zip https://cmc-cdn.web.cern.ch/assets/kenney.nl/skins.zip
+unzip -o /tmp/skins.zip -d ../public/assets/players/ && rm /tmp/skins.zip
diff --git a/src/aframe-scene.js b/src/aframe-scene.js
index b75adff..16ba41b 100644
--- a/src/aframe-scene.js
+++ b/src/aframe-scene.js
@@ -1,5 +1,5 @@
import AFRAME from 'aframe';
-import NoolsSceneController from './NoolsSceneController';
+import NoolsSceneController from './reef/NoolsSceneController';
import './components/caustics';
import './components/bubble';
@@ -25,10 +25,10 @@ AFRAME.registerComponent('scene-controller', {
this.controller = new NoolsSceneController('ws://localhost:9001');
// // Add some initial corals
- this.controller.addCoral('coral1', 0.5);
- this.controller.addCoral('coral2', 0.7);
- this.controller.addCoral('coral3', 0.6);
- // console.log("Hello Wonderful World");
+ // this.controller.addCoral('coral1', 0.5);
+ // this.controller.addCoral('coral2', 0.7);
+ // this.controller.addCoral('coral3', 0.6);
+ console.log("Hello Wonderful World");
},
// tick: function(time, timeDelta) {
diff --git a/src/index.html b/src/index.html
deleted file mode 100644
index 342a198..0000000
--- a/src/index.html
+++ /dev/null
@@ -1,202 +0,0 @@
-
-
-
-
- Save the reef
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/quizz-scene.js b/src/quizz-scene.js
new file mode 100644
index 0000000..1a9ad86
--- /dev/null
+++ b/src/quizz-scene.js
@@ -0,0 +1,37 @@
+import AFRAME from 'aframe';
+import QuizzSceneController from './quizz/QuizzSceneController';
+
+import './components/caustics';
+import './components/floating-camera';
+import './components/arc-layout';
+import './components/texture-map';
+import './components/look-towards';
+
+import 'aframe-orbit-controls';
+import 'aframe-extras';
+import 'aframe-label';
+import 'aframe-htmlembed-component';
+
+
+// Polyfill global Buffer
+import { Buffer } from 'buffer';
+window.Buffer = Buffer;
+
+const utils = AFRAME.utils;
+
+// AFRAME.registerComponent('scene-controller', {
+// init: function() {
+// // // Replace with your actual MQTT broker URL
+// this.controller = new QuizzSceneController('ws://localhost:9001');
+
+// // // Add some initial corals
+// // this.controller.addCoral('coral1', 0.5);
+// // this.controller.addCoral('coral2', 0.7);
+// // this.controller.addCoral('coral3', 0.6);
+// // console.log("Hello Wonderful World");
+// },
+
+// // tick: function(time, timeDelta) {
+// // // You can add additional per-frame logic here if needed
+// // }
+// });
\ No newline at end of file
diff --git a/src/quizz/QuizzSceneController.js b/src/quizz/QuizzSceneController.js
new file mode 100644
index 0000000..4f4f307
--- /dev/null
+++ b/src/quizz/QuizzSceneController.js
@@ -0,0 +1,94 @@
+import { createMqttHomieObserver, HomiePropertyBuffer } from '@cmcrobotics/homie-lit';
+import * as nools from 'nools';
+
+
+class PropertyUpdate {
+ constructor(deviceId, nodeId, propertyId, value) {
+ this.deviceId = deviceId;
+ this.nodeId = nodeId;
+ this.propertyId = propertyId;
+ this.value = value;
+ }
+}
+
+class Tick {
+ constructor(time) {
+ this.time = time;
+ }
+}
+
+class QuizzSceneController {
+ constructor(brokerUrl, mqttOptions = {}) {
+ this.homieObserver = createMqttHomieObserver(brokerUrl, mqttOptions);
+ this.homieObserver.subscribe("gateway/#")
+ this.propertyBuffer = new HomiePropertyBuffer(this.homieObserver);
+ this.flow = this.initNoolsFlow();
+ this.session = this.flow.getSession();
+ this.tickInterval = 5000;
+
+ this.setupPropertyGroups();
+ this.setupBufferedUpdates();
+
+ }
+
+ initNoolsFlow() {
+ const flow = nools.compile(`
+ rule ProcessPropertyUpdate {
+ when {
+ update: PropertyUpdate
+ }
+ then {
+ console.log("Processing property update:", update);
+ // Implement logic to update AFrame entities based on property updates
+ }
+ }
+
+ // rule GrowCoral {
+ // when {
+ // tick: Tick
+ // }
+ // then {
+ // console.log("Tick received, growing coral at time:", tick.time);
+ // // Implement coral growth logic
+ // // This is where you'd update the scale of coral entities
+ // homieObserver.publish("reef-1/asset-cluster-1/scale", "1.0");
+ // }
+ // }
+ `,{
+ define:{
+ PropertyUpdate : PropertyUpdate,
+ Tick : Tick
+ },
+ scope: {
+ logger: console,
+ homieObserver: this.homieObserver
+ },
+ name: "quizz"
+ });
+
+ return flow;
+ }
+
+ setupPropertyGroups() {
+ this.propertyBuffer.addPropertyGroup({
+ name: 'coral',
+ properties: ['coral/health', 'coral/size', 'coral/color'],
+ priority: 1
+ });
+ // Add more property groups as needed
+ }
+
+ setupBufferedUpdates() {
+ this.propertyBuffer.processBufferedUpdates((updates) => {
+ updates.forEach(update => {
+ this.session.assert(new this.flow.PropertyUpdate(update));
+ });
+ this.session.match();
+ });
+ }
+
+
+
+}
+
+export default QuizzSceneController;
\ No newline at end of file
diff --git a/src/NoolsSceneController.js b/src/reef/NoolsSceneController.js
similarity index 100%
rename from src/NoolsSceneController.js
rename to src/reef/NoolsSceneController.js
diff --git a/webpack.config.js b/webpack.config.js
index fd254fc..ab63008 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -5,6 +5,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
aframe: './src/aframe-scene.js',
+ quizz: './src/quizz-scene.js',
presentation: './src/reveal-presentation.js'
},
output: {