当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript WebGLRenderer.setClearColor方法代码示例

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


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

示例1: if

 this.hasPropGroup(["clearColor", "clearAlpha"], (instance: WebGLRenderer,
                                                  newColors: {
                                                    clearColor?: number,
                                                    clearAlpha?: number,
                                                  }) => {
   if (newColors.clearColor !== undefined) {
     if (newColors.clearAlpha !== undefined) {
       instance.setClearColor(newColors.clearColor, newColors.clearAlpha);
     } else {
       instance.setClearColor(newColors.clearColor, instance.getClearAlpha());
     }
   } else if (newColors.clearAlpha !== undefined) {
     instance.setClearAlpha(newColors.clearAlpha);
   }
 });
开发者ID:sychuginaanna,项目名称:react-three-renderer-fiber,代码行数:15,代码来源:webGLRenderer.ts

示例2: createRenderer

export function createRenderer(elm: HTMLElement): THREE.WebGLRenderer {
  const renderer = new WebGLRenderer({ antialias: true });
  renderer.setSize(elm.clientWidth, elm.clientHeight);
  elm.appendChild(renderer.domElement);
  renderer.setClearColor(0xffffff, 1.0);
  return renderer;
}
开发者ID:ygoto3,项目名称:sample-threejs-typescript,代码行数:7,代码来源:three.ts

示例3: createRenderer

 createRenderer() {
   var renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
   renderer.setPixelRatio(window.devicePixelRatio);
   renderer.setClearColor('#ebe5e7');
   renderer.setSize(this.WIDTH, this.HEIGHT);
   renderer.shadowMap.enabled = true;
   return renderer;
 }
开发者ID:403177368,项目名称:all,代码行数:8,代码来源:index.ts

示例4: init

  public init(container: HTMLElement, meshFactory: MeshFactory, heightStretch:number, widthStretch:number, viewWidth:number, viewDepth:number) {
    this.container = container;
    this.meshFactory = meshFactory;
    this.heightStretch = heightStretch;
    this.widthStretch = widthStretch;
    this.viewWidth = viewWidth;
    this.viewDepth = viewDepth;


    const width = this.container.clientWidth;
    const height = this.container.clientHeight;

    // Clock
  	this.clock = new Clock();

    // Camera
    this.camera = new PerspectiveCamera( 60, width / height, 1, 20000 );
    this.camera.position.y = 3000;
    this.camera.position.x = 2000;
    this.camera.position.z = 1800;

    // Controls
    this.controls = new OrbitControls(this.camera, container);
    this.controls.center.set( 0.0, 100.0, 0.0 );
    this.controls.keyPanSpeed = 100;
    this.controls.center.y = 1000;

    // Scene
    this.scene = new Scene();

    this.renderer = new WebGLRenderer();
    this.renderer.setClearColor( 0xbfd1e5 );
    this.renderer.setSize( width, height );

    // Mouse
    this.mouse = new Vector2();

    // Raycaster
    this.raycaster = new Raycaster();

    // RollOverMesh
//      	this.rollOverMesh = rollOverMesh.clone();
//      	this.scene.add(this.rollOverMesh);

    container.appendChild( this.renderer.domElement );

    // start animation
    this.animate();

    // bind to window resizes
    window.addEventListener('resize', _ => this.onResize());
  }
开发者ID:NomadHu,项目名称:first_steps,代码行数:52,代码来源:render-service.ts

示例5: PointLight

camera.position.z = 15;
camera.lookAt(snake.getPosition());

// create a point light
const pointLight = new PointLight(LIGHT_COLOR);

// set its position
pointLight.position.x = 10;
pointLight.position.y = 50;
pointLight.position.z = 130;

// add to the scene
scene.add(pointLight);

renderer.setClearColor(BACKGROUND_COLOR);

// Event listener for the controls
document.addEventListener('keydown', (event) => {
    switch (event.key.toLowerCase()) {
        case 'w':
            playerOrientation = Orientation.UP;
            break;
        case 's':
            playerOrientation = Orientation.DOWN;
            break;
        case 'a':
            playerOrientation = Orientation.LEFT;
            break;
        case 'd':
            playerOrientation = Orientation.RIGHT;
开发者ID:nbabanov,项目名称:threejs-playground,代码行数:30,代码来源:main.ts


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