Ejemplo n.º 1
0
        /// <summary>Creates our stacks.</summary>
        public static void Start()
        {
            // What's the max available texture size? All screens allow textures that fill them, so we'll base this off the screen size.
            int size = Screen.width;

            if (Screen.height > size)
            {
                size = Screen.height;
            }

            // Setup the major shader:
            DynamicMesh.UIShader = Shader.Find("StandardUI Unlit");

            // Create the global material:
            GlobalMaterial = new Material(DynamicMesh.UIShader);

            // Round size up to the nearest multiple of 2.
            int power = 1;

            while (power < size)
            {
                power *= 2;
            }

            RawMaxSize = power;

            if (SystemInfo.maxTextureSize > RawMaxSize)
            {
                // This isn't always avaiable (or gets set to -1)
                RawMaxSize = SystemInfo.maxTextureSize;
            }

            if (InitialSize > RawMaxSize)
            {
                InitialSize = RawMaxSize;
            }

            // Create our stacks:
            Text = new AtlasStack(TextureFormat.Alpha8, InitialSize);
            Text.LockFilterMode(FilterMode.Bilinear);
            Text.Mode    = AtlasingMode.Columns;
            Text.Spacing = RawTextSpacing;

            // Cache=new AtlasStack(InitialSize);
            Graphics         = new AtlasStack(InitialSize);
            Graphics.Spacing = RawGraphicsSpacing;

            if (RawGraphicsSpacing != 0)
            {
                // Column mode works best when spacing is active:
                Graphics.Mode = AtlasingMode.Columns;
            }
        }
Ejemplo n.º 2
0
        /// <summary>Creates our stacks.</summary>
        public static void Start()
        {
            // What's the max available texture size? All screens allow textures that fill them, so we'll base this off the screen size.
            int size = UnityEngine.Screen.width;

            if (UnityEngine.Screen.height > size)
            {
                size = UnityEngine.Screen.height;
            }

            // Round size up to the nearest multiple of 2.
            int power = 1;

            while (power < size)
            {
                power *= 2;
            }

            RawMaxSize = power;

            if (SystemInfo.maxTextureSize > RawMaxSize)
            {
                // This isn't always avaiable (or gets set to -1)
                RawMaxSize = SystemInfo.maxTextureSize;
            }

            if (InitialSize > RawMaxSize)
            {
                InitialSize = RawMaxSize;
            }

            // Create our stacks:

            // Alpha8 not supported by ReadPixels - have to use CPU copy mode :(
            Text = new AtlasStack(TextureFormat.ARGB32, InitialSize);
            // Blaze.TextureCameras.CPUCopyMode=true;
            // Text.CPUAccess=true;

            Text.LockFilterMode(FilterMode.Bilinear);
            Text.Mode    = AtlasingMode.Columns;
            Text.Spacing = RawTextSpacing;

            // Cache=new AtlasStack(InitialSize);
            Graphics         = new AtlasStack(InitialSize);
            Graphics.Spacing = RawGraphicsSpacing;

            if (RawGraphicsSpacing != 0)
            {
                // Column mode works best when spacing is active:
                Graphics.Mode = AtlasingMode.Columns;
            }
        }