shadow type

This commit is contained in:
Leonid Gaev
2012-06-13 17:54:35 +06:00
parent b54ae57f7c
commit 12a3e5c8e9
4 changed files with 11 additions and 27 deletions

View File

@@ -1145,28 +1145,9 @@ package alternativa.engine3d.materials {
(glossinessMap != null) ? GLOSSINESS_MAP : 0 +
(specularMap != null) ? SPECULAR_MAP : 0;
// TODO: rewrite
switch (light.shadow.type){
case "OS":
materialKey += 7 << OMNI_LIGHT_BIT;
break;
case "os":
materialKey += 6 << OMNI_LIGHT_BIT;
break;
case "DS":
materialKey += 7 << DIRECTIONAL_LIGHT_BIT;
break;
case "ds":
materialKey += 6 << DIRECTIONAL_LIGHT_BIT;
break;
}
// if (light is OmniLight) OmniLightCount++;
// else if (light is DirectionalLight) DirectionalLightCount++;
// else if (light is SpotLight) SpotLightCount++;
//
// materialKey += light.shadow.type;
// materialKey += light.lightID;
if (light is OmniLight) materialKey += light.shadow.type << OMNI_LIGHT_BIT;
else if (light is DirectionalLight) materialKey += light.shadow.type << DIRECTIONAL_LIGHT_BIT;
else if (light is SpotLight) materialKey += light.shadow.type << SPOT_LIGHT_BIT;
// Для группы создаем программу и дроуюнит

View File

@@ -214,7 +214,7 @@ package alternativa.engine3d.shadows {
this._mapSize = mapSize;
this._pcfOffset = pcfOffset;
this.type = _pcfOffset > 0 ? "DS" : "ds";
this.type = _pcfOffset > 0 ? Shadow.PCF_MODE : Shadow.SIMPLE_MODE;
vertexShadowProcedure = getVShader();
fragmentShadowProcedure = _pcfOffset > 0 ? getFShaderPCF() : getFShader();
@@ -866,7 +866,7 @@ package alternativa.engine3d.shadows {
*/
public function set pcfOffset(value:Number):void {
_pcfOffset = value;
type = _pcfOffset > 0 ? "S" : "s";
type = _pcfOffset > 0 ? Shadow.PCF_MODE : Shadow.SIMPLE_MODE;
fragmentShadowProcedure = _pcfOffset > 0 ? getFShaderPCF() : getFShader();
}

View File

@@ -104,7 +104,7 @@ package alternativa.engine3d.shadows {
this.pcfOffset = pcfOffset;
vertexShadowProcedure = getVShader();
type = _pcfOffset > 0 ? "OS" : "os";
type = _pcfOffset > 0 ? Shadow.PCF_MODE : Shadow.SIMPLE_MODE;
fragmentShadowProcedure = _pcfOffset > 0 ? getFShaderPCF() : getFShader();
debugMaterial = new ShadowDebugMaterial();
@@ -939,7 +939,7 @@ package alternativa.engine3d.shadows {
*/
public function set pcfOffset(value:Number):void {
_pcfOffset = value;
type = _pcfOffset > 0 ? "OS" : "os";
type = _pcfOffset > 0 ? Shadow.PCF_MODE : Shadow.SIMPLE_MODE;
fragmentShadowProcedure = _pcfOffset > 0 ? getFShaderPCF() : getFShader();
}

View File

@@ -23,6 +23,9 @@ package alternativa.engine3d.shadows {
*/
public class Shadow {
alternativa3d static const SIMPLE_MODE:int = 6;
alternativa3d static const PCF_MODE:int = 7;
/**
* Debug mode.
*/
@@ -32,7 +35,7 @@ package alternativa.engine3d.shadows {
* @private
* Key for processing in materials.
*/
alternativa3d var type:String = "s";
alternativa3d var type:int = 6;
/**
* @private