mirror of
https://github.com/MapMakersAndProgrammers/Alternativa3D.git
synced 2025-10-27 10:29:07 -07:00
ASDoc for shadows
This commit is contained in:
@@ -43,9 +43,9 @@ package alternativa.engine3d.shadows {
|
|||||||
use namespace alternativa3d;
|
use namespace alternativa3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class of shadow, that is created by one source of light(<code>DirectionalLight</code>). Shadow is rendered in fixed volume.
|
* Class of the shadow, that is created by one source of light(<code>DirectionalLight</code>). Shadow is rendered in fixed volume.
|
||||||
* For binding of shadow to light source you need:
|
* For binding of shadow to light source you need:
|
||||||
* 1) to set <code>DirectionalLightShadow</code> as a value of property <code>shadow</code> of light source;
|
* 1) to set instance of the <code>DirectionalLightShadow</code> as a value of property <code>shadow</code> of light source;
|
||||||
* 2) to add <code>Object3D</code> to corresponding list, using the method <code>addCaster()</code>.
|
* 2) to add <code>Object3D</code> to corresponding list, using the method <code>addCaster()</code>.
|
||||||
*
|
*
|
||||||
* @see #addCaster()
|
* @see #addCaster()
|
||||||
@@ -820,7 +820,7 @@ package alternativa.engine3d.shadows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the list of objects, that cast shadow.
|
* Clears the list of objects, which cast shadow.
|
||||||
*/
|
*/
|
||||||
public function clearCasters():void {
|
public function clearCasters():void {
|
||||||
_casters.length = 0;
|
_casters.length = 0;
|
||||||
|
|||||||
@@ -40,6 +40,17 @@ package alternativa.engine3d.shadows {
|
|||||||
|
|
||||||
use namespace alternativa3d;
|
use namespace alternativa3d;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class of the shadow, that is created by one source of light(<code>OmniLight</code>). Shadow is rendered in fixed volume.
|
||||||
|
* For binding of shadow to light source you need:
|
||||||
|
* 1) to set instance of the <code>OmniLight</code> as a value of property <code>shadow</code> of light source;
|
||||||
|
* 2) to add <code>Object3D</code> to corresponding list, using the method <code>addCaster()</code>.
|
||||||
|
*
|
||||||
|
* @see #addCaster()
|
||||||
|
* @see alternativa.engine3d.lights.OmniLight#shadow
|
||||||
|
* @see #farBoundPosition
|
||||||
|
*/
|
||||||
|
|
||||||
public class OmniLightShadow extends Shadow {
|
public class OmniLightShadow extends Shadow {
|
||||||
|
|
||||||
// TODO: calculate bias automaticaly
|
// TODO: calculate bias automaticaly
|
||||||
@@ -514,8 +525,7 @@ package alternativa.engine3d.shadows {
|
|||||||
if (bb.maxX * plane.x + bb.maxY * plane.y + bb.minZ * plane.z >= plane.offset) result = plane.frontCameras;
|
if (bb.maxX * plane.x + bb.maxY * plane.y + bb.minZ * plane.z >= plane.offset) result = plane.frontCameras;
|
||||||
if (bb.minX * plane.x + bb.minY * plane.y + bb.maxZ * plane.z < plane.offset) result |= plane.backCameras;
|
if (bb.minX * plane.x + bb.minY * plane.y + bb.maxZ * plane.z < plane.offset) result |= plane.backCameras;
|
||||||
}
|
}
|
||||||
else
|
else if (plane.z >= 0) {
|
||||||
if (plane.z >= 0) {
|
|
||||||
if (bb.maxX * plane.x + bb.minY * plane.y + bb.maxZ * plane.z >= plane.offset) result = plane.frontCameras;
|
if (bb.maxX * plane.x + bb.minY * plane.y + bb.maxZ * plane.z >= plane.offset) result = plane.frontCameras;
|
||||||
if (bb.minX * plane.x + bb.maxY * plane.y + bb.minZ * plane.z < plane.offset) result |= plane.backCameras;
|
if (bb.minX * plane.x + bb.maxY * plane.y + bb.minZ * plane.z < plane.offset) result |= plane.backCameras;
|
||||||
} else {
|
} else {
|
||||||
@@ -721,7 +731,6 @@ package alternativa.engine3d.shadows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------- ShadowMap Shader in material----------
|
//------------- ShadowMap Shader in material----------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -876,8 +885,8 @@ package alternativa.engine3d.shadows {
|
|||||||
private static const componentByIndex:Array = ["x", "y", "z", "w"];
|
private static const componentByIndex:Array = ["x", "y", "z", "w"];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Добавляет <code>object</code> в список объектов, отбрасывающих тень.
|
* Adds given object to list of objects, that cast shadow.
|
||||||
* @param object Добавляемый объект.
|
* @param object Added object.
|
||||||
*/
|
*/
|
||||||
public function addCaster(object:Object3D):void {
|
public function addCaster(object:Object3D):void {
|
||||||
if (_casters.indexOf(object) < 0) {
|
if (_casters.indexOf(object) < 0) {
|
||||||
@@ -885,6 +894,10 @@ package alternativa.engine3d.shadows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes given object from shadow casters list.
|
||||||
|
* @param object Object which should be removed from shadow casters list.
|
||||||
|
*/
|
||||||
public function removeCaster(object:Object3D):void {
|
public function removeCaster(object:Object3D):void {
|
||||||
var index:int = _casters.indexOf(object);
|
var index:int = _casters.indexOf(object);
|
||||||
if (index < 0) throw new Error("Caster not found");
|
if (index < 0) throw new Error("Caster not found");
|
||||||
@@ -892,14 +905,15 @@ package alternativa.engine3d.shadows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Очищает список объектов, отбрасывающих тень.
|
* Clears the list of objects, that cast shadow.
|
||||||
*/
|
*/
|
||||||
public function clearCasters():void {
|
public function clearCasters():void {
|
||||||
_casters.length = 0;
|
_casters.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Качество тени. Задает разрешение shadowmap. Может принимать значения от <code>2</code> до <code>11</code>.
|
* Set resolution of shadow map. This property can get value of power of 2 (up to 2048).
|
||||||
|
* OmniLightShadow uses 6 shadow maps.
|
||||||
*/
|
*/
|
||||||
public function get mapSize():int {
|
public function get mapSize():int {
|
||||||
return _mapSize;
|
return _mapSize;
|
||||||
@@ -927,8 +941,7 @@ package alternativa.engine3d.shadows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Смещение Percentage Closer Filtering. Этот способ фильтрации используется для смягчения границ тени.
|
* Offset of Percentage Closer Filtering. This way of filtering is used for mitigation of shadow bounds.
|
||||||
* 1 pcfOffset equivalent 1 degree for all blur
|
|
||||||
*/
|
*/
|
||||||
public function get pcfOffset():Number {
|
public function get pcfOffset():Number {
|
||||||
return _pcfOffset;
|
return _pcfOffset;
|
||||||
@@ -971,6 +984,7 @@ import flash.utils.Dictionary;
|
|||||||
class ShadowDebugMaterial extends Material {
|
class ShadowDebugMaterial extends Material {
|
||||||
|
|
||||||
use namespace alternativa3d;
|
use namespace alternativa3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Прозрачность.
|
* Прозрачность.
|
||||||
* Является дополнительным множителем к прозрачности текстуры.
|
* Является дополнительным множителем к прозрачности текстуры.
|
||||||
|
|||||||
Reference in New Issue
Block a user