| Package | sandy.materials.attributes |
| Class | public final class PhongAttributes |
| Inheritance | PhongAttributes ALightAttributes |
In true Phong shading, normals are supposed to be interpolated across the surface; here scaled normal projections are interpolated in the light map space. The downside of this method is that in case of low poly models interpolation results are inaccurate - in this case you can improve the result using GouraudAttributes for ambient and diffuse, and then this attribute for specular reflection.
| Property | Defined by | ||
|---|---|---|---|
![]() | ambient : Number
Ambient reflection factor.
| ALightAttributes | |
![]() | diffuse : Number
Diffuse reflection factor.
| ALightAttributes | |
![]() | flags : uint
Flags for the attribute.
| ALightAttributes | |
![]() | gloss : Number
Specular exponent.
| ALightAttributes | |
| onlySpecular : Boolean = false
Flag for rendering mode.
| PhongAttributes | ||
![]() | specular : Number
Specular reflection factor.
| ALightAttributes | |
| spherize : Number = 0
Non-zero value adds sphere normals to actual normals for light rendering.
| PhongAttributes | ||
| useBright : Boolean
Flag for lightening mode.
| PhongAttributes | ||
| Method | Defined by | ||
|---|---|---|---|
|
PhongAttributes(p_bBright:Boolean = false, p_nAmbient:Number = 0.0, p_nQuality:int = 15, p_nSamples:int = 4)
Create the PhongAttributes object.
| PhongAttributes | ||
|
computeLightMap(p_oLight:Light3D, p_nQuality:int = 4, p_nSamples:int = 4):void
Compute the light map.
| PhongAttributes | ||
![]() |
Draws light on shape.
| ALightAttributes | |
![]() |
Draws light on sprite.
| ALightAttributes | |
| onlySpecular | property |
public var onlySpecular:Boolean = falseFlag for rendering mode.
If true, only specular highlight is rendered, when useBright is also true.
If false (the default) ambient and diffuse reflections will also be rendered.
| spherize | property |
public var spherize:Number = 0Non-zero value adds sphere normals to actual normals for light rendering. Use this with flat surfaces or cylinders.
| useBright | property |
useBright:Boolean [read-write]Flag for lightening mode.
If true (the default), the lit objects use full light range from black to white.
If false they just range from black to their normal appearance; additionally, current
implementation does not render specular reflection in this case.
public function get useBright():Boolean
public function set useBright(value:Boolean):void
| PhongAttributes | () | constructor |
public function PhongAttributes(p_bBright:Boolean = false, p_nAmbient:Number = 0.0, p_nQuality:int = 15, p_nSamples:int = 4)Create the PhongAttributes object.
Parametersp_bBright:Boolean (default = false) — The brightness (value for useBright).
|
|
p_nAmbient:Number (default = 0.0) — The ambient light value. A value between 0 and 1 is expected.
|
|
p_nQuality:int (default = 15) — Quality of light response approximation. A value between 2 and 15 is expected.
|
|
p_nSamples:int (default = 4) — A number of calculated samples per anchor. Positive value is expected.
|
| computeLightMap | () | method |
public function computeLightMap(p_oLight:Light3D, p_nQuality:int = 4, p_nSamples:int = 4):voidCompute the light map.
Normally you should not need to call this function, as it is done for you automatically when it is needed. You might call it to compute light map in advance, though.
Parametersp_oLight:Light3D — Light3D object to make the light map for.
|
|
p_nQuality:int (default = 4) — Quality of light response approximation. A value between 2 and 15 is expected
(Flash radial gradient is used internally light map, thus we can only roughly approximate exact
lighting).
|
|
p_nSamples:int (default = 4) — A number of calculated samples per anchor. Positive value is expected (greater
values will produce a little bit more accurate interpolation with non-equally spaced anchors).
|
See also