コード例 #1
0
        public static void Install()
        {
            GGriffinBrpResources resources = GGriffinBrpResources.Instance;

            if (resources == null)
            {
                Debug.Log("Unable to load Griffin BuiltinRP Resources.");
            }

            List <GWizardMaterialTemplate> terrainMaterialTemplates = new List <GWizardMaterialTemplate>();

            #region PBR materials
            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4,
                Material       = resources.TerrainPbr4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4Normals4,
                Material       = resources.TerrainPbr4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats8,
                Material       = resources.TerrainPbr8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.GradientLookup,
                Material       = resources.TerrainPbrGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.VertexColor,
                Material       = resources.TerrainPbrVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.PBR,
                TexturingModel = GTexturingModel.ColorMap,
                Material       = resources.TerrainPbrColorMapMaterial
            });
            #endregion
            #region Lambert materials
            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4,
                Material       = resources.TerrainLambert4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4Normals4,
                Material       = resources.TerrainLambert4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats8,
                Material       = resources.TerrainLambert8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.GradientLookup,
                Material       = resources.TerrainLambertGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.VertexColor,
                Material       = resources.TerrainLambertVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.Lambert,
                TexturingModel = GTexturingModel.ColorMap,
                Material       = resources.TerrainLambertColorMapMaterial
            });
            #endregion
            #region Blinn-Phong materials
            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4,
                Material       = resources.TerrainBlinnPhong4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats4Normals4,
                Material       = resources.TerrainBlinnPhong4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.Splat,
                SplatsModel    = GSplatsModel.Splats8,
                Material       = resources.TerrainBlinnPhong8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.GradientLookup,
                Material       = resources.TerrainBlinnPhongGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.VertexColor,
                Material       = resources.TerrainBlinnPhongVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new GWizardMaterialTemplate()
            {
                Pipeline       = GRenderPipelineType.Builtin,
                LightingModel  = GLightingModel.BlinnPhong,
                TexturingModel = GTexturingModel.ColorMap,
                Material       = resources.TerrainBlinnPhongColorMapMaterial
            });
            #endregion

            GCreateTerrainWizardSettings wizardSetting = GGriffinSettings.Instance.WizardSettings;
            wizardSetting.BuiltinRPMaterials         = terrainMaterialTemplates;
            GGriffinSettings.Instance.WizardSettings = wizardSetting;

            GTerrainDataDefault terrainDataDefault = GGriffinSettings.Instance.TerrainDataDefault;
            GFoliageDefault     foliageDefault     = terrainDataDefault.Foliage;
            foliageDefault.GrassMaterial            = resources.GrassMaterial;
            foliageDefault.GrassInteractiveMaterial = resources.GrassInteractiveMaterial;
            foliageDefault.TreeBillboardMaterial    = resources.TreeBillboardMaterial;
            foliageDefault.GrassPreviewMaterial     = resources.GrassPreviewMaterial;
            terrainDataDefault.Foliage = foliageDefault;
            GGriffinSettings.Instance.TerrainDataDefault = terrainDataDefault;

            EditorUtility.SetDirty(GGriffinSettings.Instance);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            EditorUtility.DisplayDialog("Completed", "Successfully installed Polaris V2 Built-in Render Pipeline support.", "OK");
        }
コード例 #2
0
        public static void Install()
        {
            GGriffinBrpResources resources = GGriffinBrpResources.Instance;

            if (resources == null)
            {
                Debug.Log("Unable to load Griffin BuiltinRP Resources.");
            }

            List <TerrainMaterialTemplate> terrainMaterialTemplates = new List <TerrainMaterialTemplate>();

            #region PBR materials
            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4,
                material       = resources.TerrainPbr4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4Normals4,
                material       = resources.TerrainPbr4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats8,
                material       = resources.TerrainPbr8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.GradientLookup,
                material       = resources.TerrainPbrGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.VertexColor,
                material       = resources.TerrainPbrVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.PBR,
                texturingModel = GTexturingModel.ColorMap,
                material       = resources.TerrainPbrColorMapMaterial
            });
            #endregion
            #region Lambert materials
            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4,
                material       = resources.TerrainLambert4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4Normals4,
                material       = resources.TerrainLambert4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats8,
                material       = resources.TerrainLambert8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.GradientLookup,
                material       = resources.TerrainLambertGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.VertexColor,
                material       = resources.TerrainLambertVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.Lambert,
                texturingModel = GTexturingModel.ColorMap,
                material       = resources.TerrainLambertColorMapMaterial
            });
            #endregion
            #region Blinn-Phong materials
            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4,
                material       = resources.TerrainBlinnPhong4SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats4Normals4,
                material       = resources.TerrainBlinnPhong4Splats4NormalsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.Splat,
                splatsModel    = GSplatsModel.Splats8,
                material       = resources.TerrainBlinnPhong8SplatsMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.GradientLookup,
                material       = resources.TerrainBlinnPhongGradientLookupMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.VertexColor,
                material       = resources.TerrainBlinnPhongVertexColorMaterial
            });

            terrainMaterialTemplates.Add(new TerrainMaterialTemplate()
            {
                lightingModel  = GLightingModel.BlinnPhong,
                texturingModel = GTexturingModel.ColorMap,
                material       = resources.TerrainBlinnPhongColorMapMaterial
            });
            #endregion

            GRuntimeSettings.Instance.terrainRendering.builtinRpMaterials       = terrainMaterialTemplates;
            GRuntimeSettings.Instance.foliageRendering.grassMaterial            = resources.GrassMaterial;
            GRuntimeSettings.Instance.foliageRendering.grassBillboardMaterial   = resources.GrassBillboardMaterial;
            GRuntimeSettings.Instance.foliageRendering.grassInteractiveMaterial = resources.GrassInteractiveMaterial;
            GRuntimeSettings.Instance.foliageRendering.treeBillboardMaterial    = resources.TreeBillboardMaterial;

            EditorUtility.SetDirty(GRuntimeSettings.Instance);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            EditorUtility.DisplayDialog("Completed", "Successfully installed Polaris Built-in Render Pipeline support.", "OK");
        }