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 + (glossinessMap != null) ? GLOSSINESS_MAP : 0 +
(specularMap != null) ? SPECULAR_MAP : 0; (specularMap != null) ? SPECULAR_MAP : 0;
// TODO: rewrite if (light is OmniLight) materialKey += light.shadow.type << OMNI_LIGHT_BIT;
switch (light.shadow.type){ else if (light is DirectionalLight) materialKey += light.shadow.type << DIRECTIONAL_LIGHT_BIT;
case "OS": else if (light is SpotLight) materialKey += light.shadow.type << SPOT_LIGHT_BIT;
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;
// Для группы создаем программу и дроуюнит // Для группы создаем программу и дроуюнит

View File

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

View File

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

View File

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