示例#1
0
        public Texture2DAtlas(int width, int height, GraphicsFormat format, FilterMode filterMode = FilterMode.Point, bool powerOfTwoPadding = false, string name = "", bool useMipMap = true)
        {
            m_Width        = width;
            m_Height       = height;
            m_Format       = format;
            m_UseMipMaps   = useMipMap;
            m_AtlasTexture = RTHandles.Alloc(
                width: m_Width,
                height: m_Height,
                filterMode: filterMode,
                colorFormat: m_Format,
                wrapMode: TextureWrapMode.Clamp,
                useMipMap: useMipMap,
                autoGenerateMips: false,
                name: name
                );
            m_IsAtlasTextureOwner = true;

            // We clear on create to avoid garbage data to be present in the atlas
            int mipCount = useMipMap ? GetTextureMipmapCount(m_Width, m_Height) : 1;

            for (int mipIdx = 0; mipIdx < mipCount; ++mipIdx)
            {
                Graphics.SetRenderTarget(m_AtlasTexture, mipIdx);
                GL.Clear(false, true, Color.clear);
            }

            m_AtlasAllocator = new AtlasAllocator(width, height, powerOfTwoPadding);
        }
        public Texture2DAtlas(int width, int height, GraphicsFormat format)
        {
            m_Width        = width;
            m_Height       = height;
            m_Format       = format;
            m_AtlasTexture = RTHandles.Alloc(m_Width,
                                             m_Height,
                                             1,
                                             DepthBits.None,
                                             m_Format,
                                             FilterMode.Point,
                                             TextureWrapMode.Clamp,
                                             TextureDimension.Tex2D,
                                             false,
                                             true,
                                             false,
                                             false,
                                             1,
                                             0,
                                             MSAASamples.None,
                                             false,
                                             false);

            m_AtlasAllocator = new AtlasAllocator(width, height);
        }
示例#3
0
        public Texture2DAtlas(int width, int height, GraphicsFormat format, FilterMode filterMode = FilterMode.Point, bool powerOfTwoPadding = false, string name = "", bool useMipMap = true)
        {
            m_Width        = width;
            m_Height       = height;
            m_Format       = format;
            m_UseMipMaps   = useMipMap;
            m_AtlasTexture = RTHandles.Alloc(
                width: m_Width,
                height: m_Height,
                filterMode: filterMode,
                colorFormat: m_Format,
                wrapMode: TextureWrapMode.Clamp,
                useMipMap: useMipMap,
                autoGenerateMips: false,
                name: name
                );

            m_AtlasAllocator = new AtlasAllocator(width, height, powerOfTwoPadding);
        }