zl程序教程

您现在的位置是:首页 >  后端

当前栏目

[ReactVR] Render Custom 3D Objects Using the Model Component in React VR

3DReactVR in The Using model Component
2023-09-14 09:00:50 时间

React VR isn't limited to simple 3D primitives. By using the <Model/> Component we can place a complex 3D models into our scene.

 

import React from 'react';
import {
  AppRegistry,
  asset,
  Pano,
  Text,
  View,
  Image,
  Model,
  Sphere,
  PointLight,
  AmbientLight,
  DirectionalLight,
} from 'react-vr';

export default class app extends React.Component {
  render() {
    return (
      <View>
        <DirectionalLight
          intensity={5} 
          style={{
            transform: [{translateZ: -1}]
          }}
        />
        <Model
          source={{
            obj: asset('girl.obj')
          }}
          style={{
            color: 'white',
            transform: [{translate: [0, -10, -30]}]
          }}
          lit
        />
    </View>
    );
  }
};

AppRegistry.registerComponent('app', () => app);