void UnloadTextures() { Debug.Log("[OD] <--- ScaledSpaceDemand.UnloadTextures destroying " + texture + " and " + normals); // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.material.GetTexture("_MainTex")); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.material.GetTexture("_BumpMap")); } // Flags isLoaded = false; }
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; }
public void UnloadTextures() { Debug.Log("[OD] <--- ScaledSpaceDemand.UnloadTextures destroying " + texture + " and " + normals); // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.sharedMaterial.GetTexture(MainTex)); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.sharedMaterial.GetTexture(BumpMap)); } // Events Events.OnScaledSpaceUnload.Fire(this); // Flags isLoaded = false; }
// OnBecameInvisible(), kill the texture void OnBecameInvisible() { // If it is already loaded, return if (!isLoaded) { return; } // Kill Diffuse if (OnDemandStorage.TextureExists(texture)) { DestroyImmediate(scaledRenderer.material.GetTexture("_MainTex")); } // Kill Normals if (OnDemandStorage.TextureExists(normals)) { DestroyImmediate(scaledRenderer.material.GetTexture("_BumpMap")); } // Flags isLoaded = false; }
// 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; }