public MaterialShader(ShaderBlock shader, out ShaderPostprocessBitmapNewBlock[] bitmapBlocks) { CacheKey cacheKey; if (!shader.TryGetCacheKey(out cacheKey)) { bitmapBlocks = new ShaderPostprocessBitmapNewBlock[0]; return; } this.shader = shader; // Load shader template class and load shader passes bitmapBlocks = shader.PostprocessDefinition[0].Bitmaps; var shaderTemplateIdent = ( TagIdent )shader.PostprocessDefinition[0].ShaderTemplateIndex; shaderTemplate = ( ShaderTemplateBlock )shaderTemplateIdent.Get(cacheKey); shaderPasses = new ShaderPassBlock[shaderTemplate.PostprocessDefinition[0].Passes.Length]; shaderPassPaths = new string[shaderTemplate.PostprocessDefinition[0].Passes.Length]; for (var i = 0; i < shaderPasses.Length; ++i) { var item = shaderTemplate.PostprocessDefinition[0].Passes[i]; shaderPasses[i] = ( ShaderPassBlock )item.Pass.Get(cacheKey); shaderPassPaths[i] = item.Pass.ToString( ); } }
public TextureHandle(ShaderPostprocessBitmapNewBlock bitmapParam) { Key = new TagIdent(bitmapParam.BitmapGroup.Index, ( short )bitmapParam.BitmapIndex); LogDimension = bitmapParam.LogBitmapDimension; }
private static TagIdent GetBitmapKey(ShaderPostprocessBitmapNewBlock bitmap) { // Pack the bitmap layer-index into the salt of the ident to create a unique id return(new TagIdent(bitmap.BitmapGroup.Index, ( short )bitmap.BitmapIndex)); }