Skip to content
Snippets Groups Projects
Commit e98f8c0e authored by netpro2k's avatar netpro2k
Browse files

Merge remote-tracking branch 'origin/master' into features/mode-switching

parents d257d316 8e77089e
No related branches found
No related tags found
No related merge requests found
File added
File deleted
const GLTFCache = {};
AFRAME.AGLTFEntity = {
defaultInflator(el, componentName, componentData) {
if (AFRAME.components[componentName].multiple && Array.isArray(componentData)) {
for (let i = 0; i < componentData.length; i++) {
el.setAttribute(componentName + "__" + i, componentData[i]);
}
} else {
el.setAttribute(componentName, componentData);
}
},
registerComponent(componentKey, componentName, inflator) {
AFRAME.AGLTFEntity.components[componentKey] = {
inflator: inflator || AFRAME.AGLTFEntity.defaultInflator,
componentName
};
},
components: {}
};
// From https://gist.github.com/cdata/f2d7a6ccdec071839bc1954c32595e87
// Tracking glTF cloning here: https://github.com/mrdoob/three.js/issues/11573
function cloneGltf(gltf) {
......@@ -83,6 +102,20 @@ const inflateEntities = function(classPrefix, parentEl, node) {
el.setObject3D(node.type.toLowerCase(), node);
const entityComponents = node.userData.components;
if (entityComponents) {
for (const prop in entityComponents) {
if (entityComponents.hasOwnProperty(prop)) {
const { inflator, componentName } = AFRAME.AGLTFEntity.components[prop];
if (inflator) {
inflator(el, componentName, entityComponents[prop]);
}
}
}
}
children.forEach(childNode => {
inflateEntities(classPrefix, el, childNode);
});
......
import "./elements/a-gltf-entity";
AFRAME.AGLTFEntity.registerComponent("scale-audio-feedback", "scale-audio-feedback");
......@@ -35,10 +35,11 @@
>
<a-assets>
<a-asset-item id="bot-skinned-mesh" response-type="arraybuffer" src="./assets/avatars/Bot_SkinnedWithAnim.glb"></a-asset-item>
<img id="unmuted" src="./assets/hud/unmuted.png" >
<img id="muted" src="./assets/hud/muted.png" >
<img id="avatar" src="./assets/hud/avatar.jpg" >
<a-asset-item id="bot-skinned-mesh" response-type="arraybuffer" src="./assets/avatars/BotDefault_Avatar_Unlit.glb"></a-asset-item>
<a-asset-item id="watch-model" response-type="arraybuffer" src="./assets/hud/watch.glb"></a-asset-item>
<a-asset-item id="meeting-space1-mesh" response-type="arraybuffer" src="./assets/environments/MeetingSpace1_mesh.glb"></a-asset-item>
......@@ -79,9 +80,7 @@
<a-entity
networked-audio-source
networked-audio-analyser
scale-audio-feedback
personal-space-invader
animation-mixer
>
</a-entity>
</template>
......
......@@ -45,7 +45,7 @@ import "./systems/app-mode";
import "./elements/a-gltf-entity";
import "./elements/a-gltf-entity";
import "./gltf-component-mappings";
import { promptForName, getCookie, parseJwt } from "./utils/identity";
import registerNetworkSchemas from "./network-schemas";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment