Beispiel #1
0
 private void Init()
 {
     if (this.m_PreviewUtility == null)
     {
         this.m_PreviewUtility = new PreviewRenderUtility(true);
         this.m_PreviewUtility.m_CameraFieldOfView  = 30f;
         this.m_PreviewUtility.m_Camera.cullingMask = 1 << Camera.PreviewCullingLayer;
     }
     if (AvatarPreview.s_Styles == null)
     {
         AvatarPreview.s_Styles = new AvatarPreview.Styles();
     }
     if (this.m_FloorPlane == null)
     {
         this.m_FloorPlane = (Resources.GetBuiltinResource(typeof(Mesh), "New-Plane.fbx") as Mesh);
     }
     if (this.m_FloorTexture == null)
     {
         this.m_FloorTexture = (Texture2D)EditorGUIUtility.Load("Avatar/Textures/AvatarFloor.png");
     }
     if (this.m_FloorMaterial == null)
     {
         Shader shader = EditorGUIUtility.LoadRequired("Previews/PreviewPlaneWithShadow.shader") as Shader;
         this.m_FloorMaterial                  = new Material(shader);
         this.m_FloorMaterial.mainTexture      = this.m_FloorTexture;
         this.m_FloorMaterial.mainTextureScale = Vector2.one * 5f * 4f;
         this.m_FloorMaterial.SetVector("_Alphas", new Vector4(0.5f, 0.3f, 0f, 0f));
         this.m_FloorMaterial.hideFlags             = HideFlags.HideAndDontSave;
         this.m_FloorMaterialSmall                  = new Material(this.m_FloorMaterial);
         this.m_FloorMaterialSmall.mainTextureScale = Vector2.one * 0.2f * 4f;
         this.m_FloorMaterialSmall.hideFlags        = HideFlags.HideAndDontSave;
     }
     if (this.m_ShadowMaskMaterial == null)
     {
         Shader shader2 = EditorGUIUtility.LoadRequired("Previews/PreviewShadowMask.shader") as Shader;
         this.m_ShadowMaskMaterial           = new Material(shader2);
         this.m_ShadowMaskMaterial.hideFlags = HideFlags.HideAndDontSave;
     }
     if (this.m_ShadowPlaneMaterial == null)
     {
         Shader shader3 = EditorGUIUtility.LoadRequired("Previews/PreviewShadowPlaneClip.shader") as Shader;
         this.m_ShadowPlaneMaterial           = new Material(shader3);
         this.m_ShadowPlaneMaterial.hideFlags = HideFlags.HideAndDontSave;
     }
 }
		private void Init()
		{
			if (this.m_PreviewUtility == null)
			{
				this.m_PreviewUtility = new PreviewRenderUtility(true);
				this.m_PreviewUtility.m_CameraFieldOfView = 30f;
				this.m_PreviewUtility.m_Camera.cullingMask = 1 << Camera.PreviewCullingLayer;
			}
			if (AvatarPreview.s_Styles == null)
			{
				AvatarPreview.s_Styles = new AvatarPreview.Styles();
			}
			if (this.m_FloorPlane == null)
			{
				this.m_FloorPlane = (Resources.GetBuiltinResource(typeof(Mesh), "New-Plane.fbx") as Mesh);
			}
			if (this.m_FloorTexture == null)
			{
				this.m_FloorTexture = (Texture2D)EditorGUIUtility.Load("Avatar/Textures/AvatarFloor.png");
			}
			if (this.m_FloorMaterial == null)
			{
				Shader shader = EditorGUIUtility.LoadRequired("Previews/PreviewPlaneWithShadow.shader") as Shader;
				this.m_FloorMaterial = new Material(shader);
				this.m_FloorMaterial.mainTexture = this.m_FloorTexture;
				this.m_FloorMaterial.mainTextureScale = Vector2.one * 5f * 4f;
				this.m_FloorMaterial.SetVector("_Alphas", new Vector4(0.5f, 0.3f, 0f, 0f));
				this.m_FloorMaterial.hideFlags = HideFlags.HideAndDontSave;
				this.m_FloorMaterialSmall = new Material(this.m_FloorMaterial);
				this.m_FloorMaterialSmall.mainTextureScale = Vector2.one * 0.2f * 4f;
				this.m_FloorMaterialSmall.hideFlags = HideFlags.HideAndDontSave;
			}
			if (this.m_ShadowMaskMaterial == null)
			{
				Shader shader2 = EditorGUIUtility.LoadRequired("Previews/PreviewShadowMask.shader") as Shader;
				this.m_ShadowMaskMaterial = new Material(shader2);
				this.m_ShadowMaskMaterial.hideFlags = HideFlags.HideAndDontSave;
			}
			if (this.m_ShadowPlaneMaterial == null)
			{
				Shader shader3 = EditorGUIUtility.LoadRequired("Previews/PreviewShadowPlaneClip.shader") as Shader;
				this.m_ShadowPlaneMaterial = new Material(shader3);
				this.m_ShadowPlaneMaterial.hideFlags = HideFlags.HideAndDontSave;
			}
		}