GithubHelp home page GithubHelp logo

ccc-texturecompression's Introduction

CocosCreator 纹理压缩插件

简介

该纹理压缩工具以CocosCreator插件的形式提供,在Creator构建完成以后自动启动移动端(iOS、Android)资源的纹理压缩,压缩后的格式为PVRETC2ETC1。 压缩完全自动化,不需要手动去触发启动。压缩完成以后,将在build/jsb-defaultbuild/jsb-link目录下生成压缩以后纹理目录: packResAndroidpackResIOS

特性

  • iOS端采用PVRETC2混合的方式压缩,由于PVR压缩对原始纹理的规格限制严格(大小是正方形且边长为2的n次幂),压缩的次序是优选采用PVR, 如果无法使用PVR压缩,则使用ETC2压缩

  • Android采用ETC压缩,支持alpha通道

  • 为减小安装包的大小,压缩后的纹理再次使用了gzip压缩

用法

工具安装

  1. 下载PowerVRSDK并安装,安装的时候要勾选上PVRTexTool,默认是选上的

  2. 下载MaliTextureTools,并解压到一个本地目录下

使用插件

  1. 将工程clone到本地

  2. 修改packages/texturecompression/toolsEnv.json文件内容,把里面的两个工具的路径改成实际本地的安装路径(注意,只改安装的路径,SDK内的路径保持不变)。

举例:

  • PVRTextureTool目录: /Applications/Imagination/PowerVR_Graphics/PowerVR_Tools/PVRTexTool/CLI/OSX_x86,可以不用修改
  • ETC工具的路径: /Users/xxxxx/Downloads/Mali_Texture_Compression_Tool_v4.3.0.b81c088_MacOSX_x64/bin, 需要将/Users/xxxxx/Downloads替换成自己的目录
  1. packages目录拷贝到CocosCreator 工程根目录下 或者拷贝到 ~/.CocosCreator目录下

  2. 启动CocosCreator,启动构建任务,构建完成以后,将自动触发纹理压缩

  3. 可以在扩展/纹理压缩菜单下面选择关闭或者开启纹理压缩。如果选择关闭,CocosCreator构建完成以后将不会启动压缩

  1. 将Xcode或者Android Studio里面引用的res资源目录,修改成packResIOS或者packResAndroid下面的res目录

性能

纹理压缩支持增量压缩,没有修改过的图片,将直接使用上一次的压缩结果,大大提升压缩速度

  • 全量压缩

全量压缩

  • 增量压缩

增量压缩

ccc-texturecompression's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.