Skip to content
Snippets Groups Projects
Commit 78d2c4aa authored by Greg Fodor's avatar Greg Fodor
Browse files

Rename

parent 76fe2ee9
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ function cloneGltf(gltf) { ...@@ -87,7 +87,7 @@ function cloneGltf(gltf) {
/// or templates associated with any of their nodes.) /// or templates associated with any of their nodes.)
/// ///
/// Returns the A-Frame entity associated with the given node, if one was constructed. /// Returns the A-Frame entity associated with the given node, if one was constructed.
const inflateEntities = function(node, templates, isRoot, scale) { const inflateEntities = function(node, templates, isRoot, modelToWorldScale) {
// inflate subtrees first so that we can determine whether or not this node needs to be inflated // inflate subtrees first so that we can determine whether or not this node needs to be inflated
const childEntities = []; const childEntities = [];
const children = node.children.slice(0); // setObject3D mutates the node's parent, so we have to copy const children = node.children.slice(0); // setObject3D mutates the node's parent, so we have to copy
...@@ -136,9 +136,9 @@ const inflateEntities = function(node, templates, isRoot, scale) { ...@@ -136,9 +136,9 @@ const inflateEntities = function(node, templates, isRoot, scale) {
z: node.rotation.z * THREE.Math.RAD2DEG z: node.rotation.z * THREE.Math.RAD2DEG
}); });
el.setAttribute("scale", { el.setAttribute("scale", {
x: node.scale.x * (scale !== undefined ? scale : 1), x: node.scale.x * (modelToWorldScale !== undefined ? modelToWorldScale : 1),
y: node.scale.y * (scale !== undefined ? scale : 1), y: node.scale.y * (modelToWorldScale !== undefined ? modelToWorldScale : 1),
z: node.scale.z * (scale !== undefined ? scale : 1) z: node.scale.z * (modelToWorldScale !== undefined ? modelToWorldScale : 1)
}); });
node.matrixAutoUpdate = false; node.matrixAutoUpdate = false;
...@@ -286,7 +286,7 @@ AFRAME.registerComponent("gltf-model-plus", { ...@@ -286,7 +286,7 @@ AFRAME.registerComponent("gltf-model-plus", {
contentType: { type: "string" }, contentType: { type: "string" },
useCache: { default: true }, useCache: { default: true },
inflate: { default: false }, inflate: { default: false },
scale: { type: "number", default: 1 } modelToWorldScale: { type: "number", default: 1 }
}, },
init() { init() {
...@@ -356,7 +356,10 @@ AFRAME.registerComponent("gltf-model-plus", { ...@@ -356,7 +356,10 @@ AFRAME.registerComponent("gltf-model-plus", {
} }
let object3DToSet = this.model; let object3DToSet = this.model;
if (this.data.inflate && (this.inflatedEl = inflateEntities(this.model, this.templates, true, this.data.scale))) { if (
this.data.inflate &&
(this.inflatedEl = inflateEntities(this.model, this.templates, true, this.data.modelToWorldScale))
) {
this.el.appendChild(this.inflatedEl); this.el.appendChild(this.inflatedEl);
object3DToSet = this.inflatedEl.object3D; object3DToSet = this.inflatedEl.object3D;
// TODO: Still don't fully understand the lifecycle here and how it differs between browsers, we should dig in more // TODO: Still don't fully understand the lifecycle here and how it differs between browsers, we should dig in more
......
...@@ -196,7 +196,7 @@ AFRAME.registerComponent("media-loader", { ...@@ -196,7 +196,7 @@ AFRAME.registerComponent("media-loader", {
src: accessibleUrl, src: accessibleUrl,
contentType: contentType, contentType: contentType,
inflate: true, inflate: true,
scale: 0.0001 modelToWorldScale: 0.0001
}); });
} else { } else {
throw new Error(`Unsupported content type: ${contentType}`); throw new Error(`Unsupported content type: ${contentType}`);
......
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