zoukankan      html  css  js  c++  java
  • [ReactVR] Add Shapes Using 3D Primitives in React VR

    React VR ships with a handful of 3D primitives. We'll importprimitives like <Sphere/><Box/><Cylinder/>, and <Plane/> and explore how they can positioned in a three dimensional space.

    We'll also check out some of their properties that let us change their size and polygon counts. However we are not limited to simply changing their geometry! We'll see how we can change material and texture options as well.

    import React from 'react';
    import {
      AppRegistry,
      asset,
      Pano,
      Text,
      View,
      Image,
      Sphere,
      PointLight,
    } from 'react-vr';
    
    export default class app extends React.Component {
      render() {
        return (
          <View>
            <Sphere
              style={{
                color: 'lightblue',
                transform: [{translateZ: -2}]
              }}
              lit
              heightSegments={20}
              widthSegments={20}
            ></Sphere>
            <PointLight
              intensity={1}
              style={{transform: [{translate: [0, 700, 700]}]}}
            ></PointLight>
          </View>
        );
      }
    };
    
    AppRegistry.registerComponent('app', () => app);

    Add texture for earth:

            <Sphere
              style={{
                color: 'lightblue',
                transform: [{translateZ: -2}]
              }}
              lit
              texture={asset('earth.jpg')}
              heightSegments={20}
              widthSegments={20}
            ></Sphere>

  • 相关阅读:
    OO第三次阶段性总结
    OO第二次阶段性总结
    OO第一次阶段性总结
    【软工】提问回顾与个人总结
    【软工】结对编程作业
    【软工】第一次阅读作业
    【软工】第0次个人作业
    oo作业总结(四)
    OO作业总结(三)
    oo作业总结(二)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/8429898.html
Copyright © 2011-2022 走看看