public void Set( int MTXPLT_COUNT, bool ENABLE_VERTEX_COLOR, int TEX_COUNT, bool ENABLE_TEXANIM, int LIGHT_COUNT, LightingType LIGHTING_TYPE, NormalMapType NORMALMAP_TYPE, int[] TEXCOORD, TexType[] TEXTYPE, TexBlendFunc[] BLENDFUNC, bool ENABLE_ALPHA_THRESHHOLD ) { this.MTXPLT_COUNT = MTXPLT_COUNT; this.ENABLE_VERTEX_COLOR = ENABLE_VERTEX_COLOR; this.TEX_COUNT = TEX_COUNT; this.ENABLE_TEXANIM = ENABLE_TEXANIM; this.LIGHT_COUNT = LIGHT_COUNT; this.LIGHTING_TYPE = LIGHTING_TYPE; if (this.LIGHT_COUNT <= 0) { this.LIGHTING_TYPE = LightingType.kLIGHTING_NONE; } this.NORMALMAP_TYPE = NORMALMAP_TYPE; for (int i = 0; i < this.TEXCOORD.Length; i++) { if (i < TEX_COUNT) { this.TEXCOORD[i] = TEXCOORD[i]; this.TEXTYPE[i] = TEXTYPE[i]; this.BLENDFUNC[i] = BLENDFUNC[i]; } else { this.TEXCOORD[i] = 0; this.TEXTYPE[i] = TexType.kTEXTYPE_NONE; this.BLENDFUNC[i] = TexBlendFunc.kBLEND_NONE; } } this.ENABLE_ALPHA_THRESHHOLD = ENABLE_ALPHA_THRESHHOLD; makeNames(); }
public BasicShaderName(int worldCount, int lightCount, BasicMaterial material) { BasicLayer[] layers = material.Layers; int texCount = (layers.Length <= 3) ? layers.Length : 3; // bool texAnim = material.UseTexAnim; bool a_useTexAnim = false; // basic int a_lightCount = 0; LightingType a_lightType = LightingType.kLIGHTING_NONE; NormalMapType a_normalMapType = NormalMapType.kNORMALMAP_NONE; if (material.LightEnable != 0) { a_lightCount = lightCount; a_lightType = LightingType.kLIGHTING_FLAGMENT; a_normalMapType = NormalMapType.kNORMALMAP_NONE; } int[] texCoords = { 0, 0, 0 }; TexType[] texTypes = { 0, 0, 0 }; TexBlendFunc[] texBlendFuncs = { 0, 0, 0 }; int layerCount = (layers.Length <= 3) ? layers.Length : 3; for (int i = 0; i < layerCount; i++) { BasicLayer layer = layers[i]; // ここが無駄 if ((TexType)layer.TexType != TexType.kTEXTYPE_NONE) { if ((TexType)layer.TexType == TexType.kTEXTYPE_VERTEXNORMAL) { a_normalMapType = NormalMapType.kNORMALMAP_VERTEX; } else if ((TexType)layer.TexType == TexType.kTEXTYPE_IMAGENORMALL) { a_normalMapType = NormalMapType.kNORMALMAP_IMAGE; } } texCoords[i] = layer.TexCoord; texTypes[i] = (TexType)layer.TexType; texBlendFuncs[i] = (TexBlendFunc)layer.TexBlendFunc; if (layer.TexAnimBoneIdx >= 0) { a_useTexAnim = true; } } this.Set( worldCount, material.VertexColorEnable != 0, texCount, a_useTexAnim, a_lightCount, a_lightType, a_normalMapType, texCoords, texTypes, texBlendFuncs, material.AlphaThreshold > 0.0f ); }
/// <summary> /// Creates a normal map with given texture and type /// </summary> /// <param name="texture">Texture reference</param> /// <param name="type">Type of normal mapping</param> public NormalMap(TextureReference texture, NormalMapType type) { Texture = texture; Type = type; ParallaxScale = new Vector2(0.03f, -0.025f); }
/// <summary> /// Creates a normal map with given texture and type /// </summary> /// <param name="texture">Texture reference</param> /// <param name="type">Type of normal mapping</param> public NormalMap(TextureReference texture, NormalMapType type) { Texture = texture; Type = type; ParallaxScale = new Vector2(0.03f, -0.025f); }
/// 引数付コンストラクタ public BasicShaderName( int MTXPLT_COUNT, bool ENABLE_VERTEX_COLOR, int TEX_COUNT, bool ENABLE_TEXANIM, int LIGHT_COUNT, LightingType LIGHTING_TYPE, NormalMapType NORMALMAP_TYPE, int[] TEXCOORD, TexType[] TEXTYPE, TexBlendFunc[] BLENDFUNC, bool ENABLE_ALPHA_THRESHHOLD ) { this.Set( MTXPLT_COUNT, ENABLE_VERTEX_COLOR, TEX_COUNT, ENABLE_TEXANIM, LIGHT_COUNT, LIGHTING_TYPE, NORMALMAP_TYPE, TEXCOORD, TEXTYPE, BLENDFUNC, ENABLE_ALPHA_THRESHHOLD ); }
/// キーとして利用する NormalMapType に符号化する string toNormalMapTypeCode( NormalMapType flg ) { if( flg == NormalMapType.kNORMALMAP_NONE ){ return "N"; }else if( flg == NormalMapType.kNORMALMAP_VERTEX ){ return "V"; }else if( flg == NormalMapType.kNORMALMAP_IMAGE ){ return "I"; } return "N"; }
public void Set( int MTXPLT_COUNT, bool ENABLE_VERTEX_COLOR, int TEX_COUNT, bool ENABLE_TEXANIM, int LIGHT_COUNT, LightingType LIGHTING_TYPE, NormalMapType NORMALMAP_TYPE, int[] TEXCOORD, TexType[] TEXTYPE, TexBlendFunc[] BLENDFUNC, bool ENABLE_ALPHA_THRESHHOLD ) { this.MTXPLT_COUNT = MTXPLT_COUNT; this.ENABLE_VERTEX_COLOR = ENABLE_VERTEX_COLOR; this.TEX_COUNT = TEX_COUNT; this.ENABLE_TEXANIM = ENABLE_TEXANIM; this.LIGHT_COUNT = LIGHT_COUNT; this.LIGHTING_TYPE = LIGHTING_TYPE; if( this.LIGHT_COUNT <= 0 ){ this.LIGHTING_TYPE = LightingType.kLIGHTING_NONE; } this.NORMALMAP_TYPE = NORMALMAP_TYPE; for( int i = 0; i < this.TEXCOORD.Length; i++ ){ if( i < TEX_COUNT ){ this.TEXCOORD[i] = TEXCOORD[i]; this.TEXTYPE[i] = TEXTYPE[i]; this.BLENDFUNC[i] = BLENDFUNC[i]; }else{ this.TEXCOORD[i] = 0; this.TEXTYPE[i] = TexType.kTEXTYPE_NONE; this.BLENDFUNC[i] = TexBlendFunc.kBLEND_NONE; } } this.ENABLE_ALPHA_THRESHHOLD = ENABLE_ALPHA_THRESHHOLD; makeNames(); }