• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript THREE.Object3D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中THREE.Object3D的典型用法代码示例。如果您正苦于以下问题:TypeScript Object3D类的具体用法?TypeScript Object3D怎么用?TypeScript Object3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Object3D类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: require

( { context, require, cache, detached } ) => {
  if ( !cache.object3d ) {
    const THREE = require ( 'THREE' )
    let lights = new THREE.Object3D ()
    cache.object3d = lights
    let l
    // Sky light
    l = new THREE.PointLight ( 0xffffff, 1, 0 )
    l.position.set ( 0, 20, 0 )
    lights.add ( l )
    // Sun light
    l = new THREE.PointLight ( 0xffffff, 1, 0 )
    l.position.set ( 10, 20, 10 )
    lights.add ( l )
    // Back light
    l = new THREE.PointLight ( 0xffffff, 1, 0 )
    l.position.set ( -10, -20, -10 )
    lights.add ( l )
    
    context.object3d.add ( cache.object3d )
  }

  const object3d = cache.object3d
  if ( detached ) {
    if ( object3d.parent ) {
      object3d.parent.remove ( object3d )
    }
  }

  return { object3d }
}
开发者ID:lucidogen,项目名称:lucy-library,代码行数:31,代码来源:three.Lights.ts


示例2: squareFactory

 params.map(({ color, width, offsetX, offsetY }) => {
   const square = new THREE.Object3D();
   square.add(
     squareFactory({
       color,
       width,
       offsetX,
       offsetY,
     })
   );
   square.visible = false;
   squareParticles.add(square);
 });
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:13,代码来源:square-particles.ts


示例3: triangleFactory

 params.map(({ color, offsetX, offsetY }, index) => {
   var triangle = new THREE.Object3D();
   triangle.add(
     triangleFactory({
       index,
       color,
       offsetX,
       offsetY,
     })
   );
   triangle.add(blackBarsFactory(offsetX, index));
   triangle.visible = false;
   triangleParticles.add(triangle);
 });
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:14,代码来源:triangle-particles.ts


示例4: Array

export const triangleParticlesFactory = () => {
  const triangleParticles = new THREE.Object3D();
  const params = new Array();
  for (let n = 1; n <= 5; n++) {
    params.push({ color: colors[n - 1], offsetX: (n - 3) * 100, offsetY: 0 });
  }

  params.map(({ color, offsetX, offsetY }, index) => {
    var triangle = new THREE.Object3D();
    triangle.add(
      triangleFactory({
        index,
        color,
        offsetX,
        offsetY,
      })
    );
    triangle.add(blackBarsFactory(offsetX, index));
    triangle.visible = false;
    triangleParticles.add(triangle);
  });

  triangleParticles.position.y = 40;
  triangleParticles.position.z = 240;
  return triangleParticles;
};
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:26,代码来源:triangle-particles.ts


示例5: Array

export const squareParticlesFactory = () => {
  const params = new Array();
  for (let y = -5; y <= 5; y++) {
    for (let x = -5; x <= 5; x++) {
      params.push({
        color: colors[Math.floor(Math.random() * 5)],
        width: 100,
        offsetX: 120 * x,
        offsetY: 120 * y,
      });
    }
  }

  const squareParticles = new THREE.Object3D();

  params.map(({ color, width, offsetX, offsetY }) => {
    const square = new THREE.Object3D();
    square.add(
      squareFactory({
        color,
        width,
        offsetX,
        offsetY,
      })
    );
    square.visible = false;
    squareParticles.add(square);
  });

  return squareParticles;
};
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:31,代码来源:square-particles.ts


示例6: if

 ], (instance: Object3D,
     {rotation, quaternion, lookAt}: {
       rotation?: Euler,
       quaternion?: Quaternion,
       lookAt?: Vector3,
     }) => {
   if (lookAt != null) {
     if (isNonProduction) {
       if (quaternion != null) {
         console.warn("An object is being updated with both 'lookAt' and 'quaternion' properties.\n" +
           "Only 'lookAt' will be applied.");
       } else if (rotation != null) {
         console.warn("An object is being updated with both 'lookAt' and 'rotation' properties.\n" +
           "Only 'lookAt' will be applied.");
       }
     }
     instance.lookAt(lookAt);
   } else if ((quaternion != null)) {
     instance.quaternion.copy(quaternion);
   } else if ((rotation != null)) {
     instance.rotation.copy(rotation);
   } else {
     // looks like everything is unset
     instance.quaternion.set(0, 0, 0, 0);
   }
 }).withTypes({
开发者ID:sychuginaanna,项目名称:react-three-renderer-fiber,代码行数:26,代码来源:object3DBase.ts


示例7:

export const circleSpectrumFactory = () => {
  const spectrum = new THREE.Object3D();
  const split = 48;
  const theta = Math.PI / split;
  const ofs = 5;
  const width = 1;

  for (let i = 0; i < split * 2; i++) {
    const rectShape = new THREE.Shape();
    rectShape.moveTo(
      ofs * Math.cos(theta * i) +
        width * 0.5 * Math.cos(theta * i - Math.PI / 2),
      ofs * Math.sin(theta * i) +
        width * 0.5 * Math.sin(theta * i - Math.PI / 2)
    );
    rectShape.lineTo(
      ofs * Math.cos(theta * i) +
        width * 0.5 * Math.cos(theta * i + Math.PI / 2),
      ofs * Math.sin(theta * i) +
        width * 0.5 * Math.sin(theta * i + Math.PI / 2)
    );
    rectShape.lineTo(
      10 * Math.cos(theta * i) +
        width * 0.5 * Math.cos(theta * i + Math.PI / 2),
      10 * Math.sin(theta * i) + width * 0.5 * Math.sin(theta * i + Math.PI / 2)
    );
    rectShape.lineTo(
      10 * Math.cos(theta * i) +
        width * 0.5 * Math.cos(theta * i - Math.PI / 2),
      10 * Math.sin(theta * i) + width * 0.5 * Math.sin(theta * i - Math.PI / 2)
    );

    const geometry = new THREE.ShapeGeometry(rectShape);
    const material = new THREE.MeshBasicMaterial({
      color: colors[2],
      fog: false,
    });
    const line = new THREE.Mesh(geometry, material);
    spectrum.add(line);
  }

  spectrum.position.set(0, 0, 30);
  spectrum.visible = false;

  return spectrum;
};
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:46,代码来源:circle-spectrum.ts


示例8:

export const blackBarsFactory = (offsetX: number, index: number) => {
  const geometry = new THREE.PlaneBufferGeometry(1024, 8, 1, 1);
  const material = new THREE.MeshBasicMaterial({
    color: 0x212121,
    fog: false,
    transparent: true,
    opacity: 1,
  });

  const lines = new THREE.Object3D();
  const split = 6;
  for (let i = 0; i < split; i++) {
    const line = new THREE.Mesh(geometry, material);
    line.position.set(i * 50 - 112 + offsetX, 0, -400 + index);
    line.rotateZ(Math.PI / 3);
    lines.add(line);
  }

  return lines;
};
开发者ID:Leonardo-mbc,项目名称:Sound-Walker,代码行数:20,代码来源:black-bars.ts


示例9: buildSceneContainer

    buildSceneContainer() {
        let container = new three.Object3D()

        let geometry = new three.Geometry()

        let momenttensor = this.polygonizedMomentTensor.momentTensor
        
        // moment tensor representing only double couple
        let sphericalTensor = beachballs.sdr2mt({ strike: momenttensor.strike, dip: momenttensor.dip, rake: momenttensor.slip })
        
        let doubleCouple = {
            Mrr: sphericalTensor.Mrr,
            Mtt: sphericalTensor.Mtt,
            Mpp: sphericalTensor.Mpp,
            Mrt: sphericalTensor.Mrt,
            Mrp: sphericalTensor.Mrp,
            Mtp: sphericalTensor.Mtp,
            strike: momenttensor.strike,
            dip: momenttensor.dip,
            slip: momenttensor.slip
        }

        let polygons = beachballs.lowerHemisphereEqualAreaNet(doubleCouple).map(polygon =>
            ({ vertices: polygon.vertices.map(point => point.map(v => v)), compressional: polygon.compressional }))

        this.fillGeometry(geometry, polygons)

        geometry.computeFaceNormals()
        geometry.computeVertexNormals()

        let mesh = new three.Mesh(geometry, new three.MeshBasicMaterial({
            vertexColors: three.VertexColors,
            side: three.DoubleSide,
            wireframe: false,
            opacity: 1,
            visible: true
        }))
        container.add(mesh)

        return container
    }
开发者ID:timofeevda,项目名称:seismic-beachballs-demo,代码行数:41,代码来源:threedoublecouplescene.component.ts


示例10: buildSceneContainer

    buildSceneContainer() {
        let container = new three.Object3D()

        let geometry = new three.Geometry()

        let originalPolygons = this.polygonizedMomentTensor.polygons.map(polygon => 
            ({vertices: polygon.vertices.map(point => point.map(v => v)), compressional: polygon.compressional}))
                
        let polygons = []
        switch (this.projection) {
            case "equalarea":
            polygons = beachballs.rawLowerHemisphereEqualAreaNet(originalPolygons)
                break;
            case "wulff":
                polygons = beachballs.rawLowerHemisphereWulffNet(originalPolygons)
                break;
            case "orthographic":
                polygons = beachballs.rawLowerHemisphereOrthographic(originalPolygons)
                break;         
            default:
                polygons = []
        }

        this.fillGeometry(geometry, polygons)

        geometry.computeFaceNormals()
        geometry.computeVertexNormals()

        let mesh = new three.Mesh(geometry, new three.MeshBasicMaterial({
            vertexColors: three.VertexColors,
            side: three.DoubleSide,
            wireframe: false,
            opacity: 1,
            visible: true
        }))
        container.add(mesh)

        return container
    }
开发者ID:timofeevda,项目名称:seismic-beachballs-demo,代码行数:39,代码来源:projectedtensorscene.component.ts



注:本文中的THREE.Object3D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript THREE.PerspectiveCamera类代码示例发布时间:2022-05-25
下一篇:
TypeScript THREE.Mesh类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap