本文整理汇总了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);
}
});
示例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;
}
示例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;
}
示例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());
}
示例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;