示例#1
0
            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;
            }
示例#2
0
            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;
            }
示例#3
0
        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;
        }
示例#4
0
            // 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;
            }
示例#5
0
            // 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;
            }
示例#6
0
        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;
        }