首页 > 文档 > normal()设置当前正常向量
2017
08-05

normal()设置当前正常向量

Name

normal()设置当前正常向量

   

Examples

normal()设置当前正常向量 - 第1张  | Processing编程艺术normal()设置当前正常向量 - 第2张  | Processing编程艺术normal()设置当前正常向量 - 第3张  | Processing编程艺术

size(100, 100, P3D);

noStroke();

background(0);

pointLight(150, 250, 150, 10, 30, 50);

beginShape();

normal(0, 0, 1);

vertex(20, 20, -10);

vertex(80, 20, 10);

vertex(80, 80, -10);

vertex(20, 80, 10);

endShape(CLOSE);

Description

Sets the current normal vector. Used for drawing three dimensional shapes and surfaces, normal()specifies a vector perpendicular to a shape’s surface which, in turn, determines how lighting affects it. Processing attempts to automatically assign normals to shapes, but since that’s imperfect, this is a better option when you want more control. This function is identical to glNormal3f() in OpenGL.

设置当前正常向量。用于绘制三维形状和曲面, 法线 () 指定一个垂直于形状表面的向量, 它反过来决定光照对它的影响。处理尝试自动为形状分配法线, 但由于这是不完善的, 所以当您需要更多的控制时, 这是一个更好的选择。此函数与 OpenGL 中的 glNormal3f () 相同。

Syntax

normal(nx, ny, nz)

Parameters

nx

float: x direction

ny

float: y direction

nz

float: z direction

Returns

void

Related

beginShape()
endShape()
lights()



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

留下一个回复

你的email不会被公开。