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>

  • 相关阅读:
    3288 积木大赛
    3284 疯狂的黄大神
    1531 山峰
    1018 单词接龙
    1432 总数统计
    1507 酒厂选址
    1063 合并果子
    几个sort不能过的题目
    poj 2245 Lotto
    求两圆相交面积模板
  • 原文地址:https://www.cnblogs.com/Answer1215/p/8429898.html
Copyright © 2011-2022 走看看