首页 > 文档 > directionalLight()定向光源
2017
08-02

directionalLight()定向光源

Name directionalLight()定向光源
Examples

       directionalLight()定向光源 - 第1张  | Processing编程艺术

directionalLight()定向光源 - 第2张  | Processing编程艺术directionalLight()定向光源 - 第3张  | Processing编程艺术

size(100, 100, P3D);

background(0);

noStroke();

directionalLight(51, 102, 126, -1, 0, 0);

translate(20, 50, 0);

sphere(30);

directionalLight()定向光源 - 第4张  | Processing编程艺术directionalLight()定向光源 - 第5张  | Processing编程艺术directionalLight()定向光源 - 第6张  | Processing编程艺术

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 v1v2, and v3 parameters are interpreted as either RGB or HSB values, depending on the current color mode. The nxny, 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).

添加定向光源。定向光来自一个方向: 它是更强的, 当击中一个表面正视, 较弱的, 如果它击中一个温柔的角度。撞击表面后, 定向光向四面八方散射。需要在绘图 () 中包括光源, 以便在循环程序中保持持久性。将它们放在循环程序的设置 () 中将导致它们在第一次循环时产生效果。根据当前颜色模式, v1v2 v3 参数被解释为 rgb hsb 值。这些参数指定光源所面临的方向。例如, ny 设置为-1 将使几何图形从下面点亮 (因为光将直接朝上)

Syntax directionalLight(v1, v2, v3, nx, ny, nz)
Parameters
v1 float: red or hue value (depending on current color mode)

红色或色相值 (取决于当前颜色模式)

v2 float: green or saturation value (depending on current color mode)

绿色或饱和值 (取决于当前颜色模式)

v3 float: blue or brightness value (depending on current color mode)

蓝色或亮度值 (取决于当前颜色模式)

nx float: direction along the x-axis

沿X轴方向

ny float: direction along the y-axis

沿Y轴方向

nz float: direction along the z-axis

沿Z轴方向

Returns void
Related lights()
ambientLight()
pointLight()
spotLight()


最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。