Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Fix GLTF loader from three.js
Browse files Browse the repository at this point in the history
Reviewed By: mikearmstrong001

Differential Revision: D7823251

fbshipit-source-id: 172efd61d736326331ec5a104643b9e5dbc5a503
  • Loading branch information
andrewimm authored and facebook-github-bot committed May 2, 2018
1 parent 0b971cd commit eb59b72
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Libraries/Mesh/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {ViewProps} from 'ViewPropTypes';

type EntitySource =
| {
uri: string,
gltf2: string,
}
| {
obj: string | number,
Expand Down
2 changes: 1 addition & 1 deletion React360/js/Loaders/GLTF2ModelLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class GLTF2MeshInstance {
// loadList[this.url] = [onLoad];

// $FlowFixMe
const loader = new THREE.GLTF2Loader();
const loader = new THREE.GLTFLoader();
loader.load(
this.url,
gltf => {
Expand Down
9 changes: 4 additions & 5 deletions Samples/MultiRoot/ModelView.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import {Animated, View} from 'react-360';
import Model from 'Model';
import Entity from 'Entity';
import AmbientLight from 'AmbientLight';
import PointLight from 'PointLight';
import {connect} from './Store';

const AnimatedModel = Animated.createAnimatedComponent(Model);
const AnimatedEntity = Animated.createAnimatedComponent(Entity);

/**
* Renders the actual model in 3D space, rotating it a full 360 degrees to show
Expand Down Expand Up @@ -34,10 +34,9 @@ class ModelView extends React.Component {
intensity={0.4}
style={{transform: [{translate: [0, 4, -1]}]}}
/>
<AnimatedModel
lit={true}
<AnimatedEntity
style={{transform: [{rotateY: this.rotation}]}}
source={{obj: source.root.url, mtl: source.resources[0].url}}
source={{gltf2: source.root.url}}
/>
</View>
);
Expand Down
4 changes: 2 additions & 2 deletions Samples/MultiRoot/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function initialize(apiKey) {
// Fetch the top 5 posts from Google Poly
const options = {
curated: true,
format: 'OBJ',
format: 'GLTF2',
key: apiKey,
pageSize: 5,
};
Expand All @@ -38,7 +38,7 @@ export function initialize(apiKey) {
.then(body => {
const entries = body.assets.map(asset => {
const objSource = asset.formats.filter(
format => format.formatType === 'OBJ'
format => format.formatType === 'GLTF2'
)[0];
return {
id: asset.name,
Expand Down

0 comments on commit eb59b72

Please sign in to comment.