void IniNewSelect() { if (UnityTerrain){ DestroyImmediate(UnityTerrain); if(Child){ Selection.activeTransform = Child.transform; vertexInfo = 0; trisInfo = 0; partofT4MObj = 0; if (nbrT4MObj == 0){ Child.gameObject.GetComponent <T4MObjSC>().EnabledLODSystem = ActivatedLOD; Child.gameObject.GetComponent <T4MObjSC>().enabledBillboard = ActivatedBillboard; Child.gameObject.GetComponent <T4MObjSC>().enabledLayerCul = ActivatedLayerCul; Child.gameObject.GetComponent <T4MObjSC>().CloseView = CloseDistMaxView; Child.gameObject.GetComponent <T4MObjSC>().NormalView = NormalDistMaxView; Child.gameObject.GetComponent <T4MObjSC>().FarView = FarDistMaxView; Child.gameObject.GetComponent <T4MObjSC>().BackGroundView = BGDistMaxView; Child.gameObject.GetComponent <T4MObjSC>().Master = 1; } } } if (CurrentSelect && CurrentSelect.GetComponent <T4MObjSC>() && CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial){ EditorUtility.SetSelectedWireframeHidden(CurrentSelect.renderer, true); initMaster = false; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat0")){ Layer1 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat0"); Layer1Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat0"); }else Layer1 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat1")){ Layer2 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat1"); Layer2Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat1"); }else Layer2 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat2")){ Layer3 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat2"); Layer3Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat2"); }else Layer3 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat3")){ Layer4 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat3"); Layer4Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat3"); }else Layer4 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat4")){ Layer5 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat4"); Layer5Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat4"); }else Layer5 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Splat5")){ Layer6 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Splat5"); Layer6Tile = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Splat5"); }else Layer6 =null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_BumpSplat0")){ Layer1Bump =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_BumpSplat0"); Layer2Bump =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_BumpSplat1"); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_BumpSplat2")) Layer3Bump =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_BumpSplat2"); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_BumpSplat3")) Layer4Bump =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_BumpSplat3"); } if(CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.shader == Shader.Find("T4MShaders/ShaderModel1/T4M 2 Textures ManualAdd BeastLM_1DC") || CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.shader == Shader.Find("T4MShaders/ShaderModel1/T4M 2 Textures ManualAdd CustoLM 1DC")){ LMMan = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Lightmap"); } CheckShader(); ActivatedLOD =CurrentSelect.GetComponent <T4MObjSC>().EnabledLODSystem ; ActivatedBillboard = CurrentSelect.GetComponent <T4MObjSC>().enabledBillboard ; MaximunView = CurrentSelect.GetComponent <T4MObjSC>().MaxViewDistance; StartLOD2= CurrentSelect.GetComponent <T4MObjSC>().LOD2Start; StartLOD3 = CurrentSelect.GetComponent <T4MObjSC>().LOD3Start; UpdateInterval = CurrentSelect.GetComponent <T4MObjSC>().Interval; PlayerCam = CurrentSelect.GetComponent <T4MObjSC>().PlayerCamera; BillInterval = CurrentSelect.GetComponent <T4MObjSC>().BillInterval; BillboardDist = CurrentSelect.GetComponent <T4MObjSC>().BillMaxViewDistance; ActivatedLayerCul = CurrentSelect.GetComponent <T4MObjSC>().enabledLayerCul; BGDistMaxView = CurrentSelect.GetComponent <T4MObjSC>().BackGroundView; FarDistMaxView=CurrentSelect.GetComponent <T4MObjSC>().FarView; NormalDistMaxView=CurrentSelect.GetComponent <T4MObjSC>().NormalView; CloseDistMaxView=CurrentSelect.GetComponent <T4MObjSC>().CloseView; if (CurrentSelect.GetComponent <T4MObjSC>().Mode == 1) LODModeControler = LODMod.Mass_Control; else LODModeControler = LODMod.Independent_Control; if(CurrentSelect.GetComponent <T4MObjSC>().Axis == 0) BillBoardAxis = BillbAxe.Y_Axis; else BillBoardAxis = BillbAxe.All_Axis; if(CurrentSelect.GetComponent <T4MObjSC>().LODbasedOnScript == true) LODocclusion = OccludeBy.Max_View_Distance; else LODocclusion = OccludeBy.Layer_Cull_Distances; if(CurrentSelect.GetComponent <T4MObjSC>().BilBbasedOnScript == true) BilBocclusion = OccludeBy.Max_View_Distance; else BilBocclusion = OccludeBy.Layer_Cull_Distances; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().BillboardPosition != null && CurrentSelect.gameObject.GetComponent <T4MObjSC>().BillboardPosition.Length>0) billActivate = true; else billActivate = false; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().ObjPosition != null && CurrentSelect.gameObject.GetComponent <T4MObjSC>().ObjPosition.Length>0) LodActivate = true; else LodActivate = false; if (PlayerCam == null && Camera.main) PlayerCam = Camera.main.transform; else if (PlayerCam == null && !Camera.main){ Camera[] Cam = GameObject.FindObjectsOfType(typeof(Camera)) as Camera[]; for (var b =0; b <Cam.Length;b++){ if (Cam[b].GetComponent<AudioListener>()){ PlayerCam = Cam[b].transform; } } } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_SpecColor")){ ShinessColor = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetColor("_SpecColor"); if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL0")){ shiness0 = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetFloat ("_ShininessL0"); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL1")){ shiness1 = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetFloat ("_ShininessL1"); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL2")){ shiness2 = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetFloat ("_ShininessL2"); } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_ShininessL3")){ shiness3 =CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetFloat ("_ShininessL3"); } } if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Control2") && CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Control2")) T4MMaskTex2 = (Texture2D)CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Control2"); else T4MMaskTex2 = null; if (CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.HasProperty("_Control")) { T4MMaskTexUVCoord = CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTextureScale("_Control").x; T4MMaskTex = (Texture2D)CurrentSelect.gameObject.GetComponent <T4MObjSC>().T4MMaterial.GetTexture("_Control"); intialized=true; } } Projector[] projectorObj = FindObjectsOfType(typeof(Projector)) as Projector[]; if(projectorObj.Length>0) for (var i = 0; i < projectorObj.Length; i++) { if (projectorObj[i].gameObject.name == "PreviewT4M") DestroyImmediate (projectorObj[i].gameObject); } terrainDat = null; vertexInfo = 0; trisInfo= 0; partofT4MObj = 0; TexTexture = null; T4MSelectID = Selection.activeInstanceID; }
void Billboard(){ EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Culling BillBoard Mode", EditorStyles.boldLabel); BilBocclusion = (OccludeBy) EditorGUILayout.EnumPopup ("Mode", BilBocclusion, GUILayout.Width(340)); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("BillBoard Rotation Axis", EditorStyles.boldLabel); BillBoardAxis =(BillbAxe) EditorGUILayout.EnumPopup ("Axis", BillBoardAxis, GUILayout.Width(340)); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("BillBoard Update Interval in Seconde", EditorStyles.boldLabel, GUILayout.Width(400)); GUILayout.BeginHorizontal(); GUILayout.Label("(less value = less performance)", GUILayout.Width(300)); BillInterval = EditorGUILayout.FloatField(BillInterval, GUILayout.Width(50)); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("Maximum View Distance", EditorStyles.boldLabel, GUILayout.Width(298)); BillboardDist= EditorGUILayout.FloatField(BillboardDist, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); BillboardDist=GUILayout.HorizontalScrollbar (BillboardDist,0.0f,0f,200f,GUILayout.Width(350)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); Texture Swap; string buttonBill; if (billActivate == true){ buttonBill = "DEACTIVATE"; Swap= (Texture)Resources.LoadAssetAtPath(T4MEditorFolder+"Img/on.png", typeof(Texture)); }else{ buttonBill = "ACTIVATE"; Swap= (Texture)Resources.LoadAssetAtPath(T4MEditorFolder+"Img/off.png", typeof(Texture)); } if (GUILayout.Button(buttonBill, GUILayout.Width(100), GUILayout.Height(30))) { ActivateDeactivateBillBoard(); } GUILayout.Label(Swap, GUILayout.Width(75), GUILayout.Height(30)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); }
void LODManager() { if (T4MMaster){ EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("LOD Mode", EditorStyles.boldLabel); LODModeControler =(LODMod) EditorGUILayout.EnumPopup ("controller", LODModeControler, GUILayout.Width(340)); EditorGUILayout.Space(); GUILayout.Label("Culling LOD Object Mode", EditorStyles.boldLabel); LODocclusion = (OccludeBy) EditorGUILayout.EnumPopup ("Mode", LODocclusion, GUILayout.Width(340)); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("Maximum View Distance", EditorStyles.boldLabel, GUILayout.Width(300)); MaximunView = EditorGUILayout.FloatField(MaximunView, GUILayout.Width(50)); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("LOD Update Interval in Seconde", EditorStyles.boldLabel, GUILayout.Width(400)); GUILayout.BeginHorizontal(); GUILayout.Label("(less value = less performance)", GUILayout.Width(300)); UpdateInterval = EditorGUILayout.FloatField(UpdateInterval, GUILayout.Width(50)); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("LOD2 Start", EditorStyles.boldLabel, GUILayout.Width(170)); GUILayout.FlexibleSpace(); StartLOD2= EditorGUILayout.FloatField(StartLOD2, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); StartLOD2= GUILayout.HorizontalScrollbar (StartLOD2,0.0f,10f,MaximunView,GUILayout.Width(350)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (StartLOD2 > StartLOD3-5) StartLOD3= StartLOD2+5; if(StartLOD2 > MaximunView-10) StartLOD2 = MaximunView-10; if(StartLOD3 > MaximunView-5) StartLOD3 = MaximunView-5; EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("LOD3 Start", EditorStyles.boldLabel, GUILayout.Width(170)); GUILayout.FlexibleSpace(); StartLOD3= EditorGUILayout.FloatField(StartLOD3, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); StartLOD3= GUILayout.HorizontalScrollbar (StartLOD3,0.0f,10f,MaximunView,GUILayout.Width(350)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); string buttonLod; Texture Swap; if (LodActivate == true){ buttonLod = "DEACTIVATE"; Swap= (Texture)Resources.LoadAssetAtPath(T4MEditorFolder+"Img/on.png", typeof(Texture)); }else{ buttonLod = "ACTIVATE"; Swap= (Texture)Resources.LoadAssetAtPath(T4MEditorFolder+"Img/off.png", typeof(Texture)); } if (GUILayout.Button(buttonLod, GUILayout.Width(100), GUILayout.Height(30))) { ActivateDeactivateLOD (); } GUILayout.Label(Swap, GUILayout.Width(75), GUILayout.Height(30)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); }else{ GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Need to be an Master T4M", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } }