Name | directionalLight()定向光源 | ||||||||||||
Examples
|
size(100, 100, P3D); background(0); noStroke(); directionalLight(51, 102, 126, -1, 0, 0); translate(20, 50, 0); sphere(30);
size(100, 100, P3D); background(0); noStroke(); directionalLight(51, 102, 126, 0, -1, 0); translate(80, 50, 0); sphere(30); |
||||||||||||
Description | Adds a directional light. Directional light comes from one direction: it is stronger when hitting a surface squarely, and weaker if it hits at a gentle angle. After hitting a surface, directional light scatters in all directions. Lights need to be included in the draw() to remain persistent in a looping program. Placing them in the setup() of a looping program will cause them to only have an effect the first time through the loop. The v1, v2, and v3 parameters are interpreted as either RGB or HSB values, depending on the current color mode. The nx, ny, and nz parameters specify the direction the light is facing. For example, setting ny to -1 will cause the geometry to be lit from below (since the light would be facing directly upward). 添加定向光源。定向光来自一个方向: 它是更强的, 当击中一个表面正视, 较弱的, 如果它击中一个温柔的角度。撞击表面后, 定向光向四面八方散射。需要在绘图 () 中包括光源, 以便在循环程序中保持持久性。将它们放在循环程序的设置 () 中将导致它们在第一次循环时产生效果。根据当前颜色模式, v1、v2 和 v3 参数被解释为 rgb 或 hsb 值。这些参数指定光源所面临的方向。例如, 将 ny 设置为-1 将使几何图形从下面点亮 (因为光将直接朝上)。 |
||||||||||||
Syntax | directionalLight(v1, v2, v3, nx, ny, nz) | ||||||||||||
Parameters |
|
||||||||||||
Returns | void | ||||||||||||
Related | lights() ambientLight() pointLight() spotLight() |
- 本文固定链接: http://iprocessing.cn/2017/08/02/directionallight定向光源/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表