Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Hubs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
Hubs
Commits
78d2c4aa
Commit
78d2c4aa
authored
6 years ago
by
Greg Fodor
Browse files
Options
Downloads
Patches
Plain Diff
Rename
parent
76fe2ee9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/gltf-model-plus.js
+9
-6
9 additions, 6 deletions
src/components/gltf-model-plus.js
src/components/media-loader.js
+1
-1
1 addition, 1 deletion
src/components/media-loader.js
with
10 additions
and
7 deletions
src/components/gltf-model-plus.js
+
9
−
6
View file @
78d2c4aa
...
@@ -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
,
s
cale
)
{
const
inflateEntities
=
function
(
node
,
templates
,
isRoot
,
modelToWorldS
cale
)
{
// 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
*
(
s
cale
!==
undefined
?
s
cale
:
1
),
x
:
node
.
scale
.
x
*
(
modelToWorldS
cale
!==
undefined
?
modelToWorldS
cale
:
1
),
y
:
node
.
scale
.
y
*
(
s
cale
!==
undefined
?
s
cale
:
1
),
y
:
node
.
scale
.
y
*
(
modelToWorldS
cale
!==
undefined
?
modelToWorldS
cale
:
1
),
z
:
node
.
scale
.
z
*
(
s
cale
!==
undefined
?
s
cale
:
1
)
z
:
node
.
scale
.
z
*
(
modelToWorldS
cale
!==
undefined
?
modelToWorldS
cale
:
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
},
s
cale
:
{
type
:
"
number
"
,
default
:
1
}
modelToWorldS
cale
:
{
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
...
...
This diff is collapsed.
Click to expand it.
src/components/media-loader.js
+
1
−
1
View file @
78d2c4aa
...
@@ -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
,
s
cale
:
0.0001
modelToWorldS
cale
:
0.0001
});
});
}
else
{
}
else
{
throw
new
Error
(
`Unsupported content type:
${
contentType
}
`
);
throw
new
Error
(
`Unsupported content type:
${
contentType
}
`
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment