// Load the Map public void Load() { // Check if the Map is already loaded if (IsLoaded) { return; } // Load the Map Texture2D map = OnDemandStorage.LoadTexture(Path, false, false, false); // If the map isn't null if (map != null) { CreateMap(Depth, map); timer = new Timer(60000d); timer.Elapsed += delegate(object sender, ElapsedEventArgs e) { Unload(); }; timer.Start(); IsLoaded = true; Debug.Log("[OD] Map " + name + " enabling self. Path = " + Path); return; } // Return nothing Debug.Log("[OD] ERROR: Failed to load map " + name + " at path " + Path); }
void LoadTextures() { Debug.Log("[OD] --> ScaledSpaceDemand.LoadTextures loading " + texture + " and " + normals); // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.material.SetTexture("_MainTex", OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.material.SetTexture("_BumpMap", OnDemandStorage.LoadTexture(normals, false, true, false)); } // Flags isLoaded = true; }
// Load the Map public void Load() { // Check if the Map is already loaded if (IsLoaded) { return; } // Load the Map Texture2D map = OnDemandStorage.LoadTexture(Path, false, false, false); // If the map isn't null if (map != null) { CreateMap(Depth, map); IsLoaded = true; Debug.Log("[OD] ---> Map " + name + " enabling self. Path = " + Path); return; } // Return nothing Debug.Log("[OD] ERROR: Failed to load map " + name + " at path " + Path); }
// OnBecameVisible(), load the texture void OnBecameVisible() { // If it is already loaded, return if (isLoaded) { return; } // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.material.SetTexture("_MainTex", OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.material.SetTexture("_BumpMap", OnDemandStorage.LoadTexture(normals, false, true, false)); } // Flags isLoaded = true; }
public void LoadTextures() { Debug.Log("[OD] --> ScaledSpaceDemand.LoadTextures loading " + texture + " and " + normals); // Load Diffuse if (OnDemandStorage.TextureExists(texture)) { scaledRenderer.sharedMaterial.SetTexture(MainTex, OnDemandStorage.LoadTexture(texture, false, true, true)); } // Load Normals if (OnDemandStorage.TextureExists(normals)) { scaledRenderer.sharedMaterial.SetTexture(BumpMap, OnDemandStorage.LoadTexture(normals, false, true, false)); } // Events Events.OnScaledSpaceLoad.Fire(this); // Flags isLoaded = true; }