示例#1
0
        public static Texture2D GenerateBillboardNormalTexture(GameObject prefab, BillboardQuality billboardQuality,
                                                               LODLevel billboardSourceLODLevel, Quaternion rotationOffset, string overrideBillboardAtlasNormalShader, bool recalculateNormals, float normalBlendFactor, bool flipBackNormals)
        {
            Shader normalShader = BillboardShaderDetector.GetNormalBillboardAtlasShader(prefab);

            if (overrideBillboardAtlasNormalShader != "")
            {
                normalShader = Shader.Find(overrideBillboardAtlasNormalShader);
            }

            if (flipBackNormals)
            {
                Shader.SetGlobalInt("_FlipBackNormals", 1);
            }
            else
            {
                Shader.SetGlobalInt("_FlipBackNormals", 0);
            }

            Material  minPostfilter = (Material)Resources.Load("MinPostFilter/MinPostFilter", typeof(Material));
            Texture2D texture       = GenerateBillboardNew(prefab, GetBillboardQualityTileWidth(billboardQuality),
                                                           GetBillboardQualityTileWidth(billboardQuality), GetBillboardQualityColumnCount(billboardQuality),
                                                           GetBillboardQualityRowCount(billboardQuality), normalShader, new Color(0.5f, 0.5f, 1, 0), minPostfilter,
                                                           billboardSourceLODLevel, rotationOffset, false, recalculateNormals, normalBlendFactor);

            Shader.SetGlobalInt("_FlipBackNormals", 0);
            return(texture);
        }
        public static Texture2D GenerateBillboardNormalTexture(GameObject prefab, BillboardQuality billboardQuality,
                                                               int billboardLodIndex, Quaternion rotationOffset)
        {
            Shader    normalShader  = BillboardShaderDetector.GetNormalBillboardAtlasShader(prefab);
            Material  minPostfilter = (Material)Resources.Load("MinPostFilter/MinPostFilter", typeof(Material));
            Texture2D texture       = GenerateBillboardNew(prefab, GetBillboardQualityTileWidth(billboardQuality),
                                                           GetBillboardQualityTileWidth(billboardQuality), GetBillboardQualityColumnCount(billboardQuality),
                                                           GetBillboardQualityRowCount(billboardQuality), normalShader, new Color(0.5f, 0.5f, 1, 0), minPostfilter,
                                                           billboardLodIndex, rotationOffset);

            return(texture);
        }