Skip to content

Commit

Permalink
Compressed textures generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ddenysiuk committed Feb 16, 2024
1 parent 38e872a commit 5b654f0
Show file tree
Hide file tree
Showing 12 changed files with 1,598 additions and 37 deletions.
946 changes: 909 additions & 37 deletions package-lock.json

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions packages/compressed-textures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# @assetpack/plugin-compressed-textures

AssetPack plugin for generation compressed textures.

## Installation

```sh
npm install --save-dev @assetpack/plugin-compressed-textures
```

## Usage

```js
import { generateAstc, generateBc, generateEtc } from '@assetpack/compressed-textures';

export default {
...
plugins: {
...
generateAstc: generateAstc(),
generateBc: generateBc(),
generateEtc: generateEtc(),
},
};
```

## Options

### generateAstc

- compression: Any settings supported by [@gpu-tex-enc/astc](https://www.npmjs.com/package/@gpu-tex-enc/astc)
- `tags` - An object containing the tags to use for the plugin. Defaults to `{ nc: "nc" }`.
- `nc` - The tag used to denote that the image should not be compressed. Can be placed on a folder or file.

### generateBc

- compression: Any settings supported by [@gpu-tex-enc/bc](https://www.npmjs.com/package/@gpu-tex-enc/bc)
- `tags` - An object containing the tags to use for the plugin. Defaults to `{ nc: "nc" }`.
- `nc` - The tag used to denote that the image should not be compressed. Can be placed on a folder or file.

### generateEtc

- compression: Any settings supported by [@gpu-tex-enc/etc](https://www.npmjs.com/package/@gpu-tex-enc/etc)
- `tags` - An object containing the tags to use for the plugin. Defaults to `{ nc: "nc" }`.
- `nc` - The tag used to denote that the image should not be compressed. Can be placed on a folder or file.
10 changes: 10 additions & 0 deletions packages/compressed-textures/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const sharedConfig = require('../../jest.config');

module.exports = {
...sharedConfig,
rootDir: './',
moduleNameMapper: {
'^@assetpack/plugin-(.*)$': '<rootDir>/../$1/src',
'^@assetpack/(.*)$': '<rootDir>/../$1/src',
},
};
47 changes: 47 additions & 0 deletions packages/compressed-textures/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@assetpack/plugin-compressed-textures",
"version": "0.8.0",
"description": "",
"homepage": "https://github.com/pixijs/assetpack/tree/master/packages/compressed-textures/#readme",
"bugs": "https://github.com/pixijs/assetpack/issues",
"repository": {
"url": "pixijs/assetpack",
"directory": "packages/compressed-textures"
},
"license": "MIT",
"author": "ddenysiuk",
"exports": {
"import": "./dist/es/index.js",
"types": "./dist/types/index.d.ts",
"default": "./dist/cjs/index.js"
},
"main": "./dist/cjs/index.js",
"module": "./dist/es/index.js",
"types": "./dist/types/index.d.ts",
"files": [
"dist",
"*.d.ts"
],
"scripts": {
"prebuild": "rimraf dist",
"build": "rollup -c",
"test": "npx jest --config ./jest.config.js",
"test:types": "tsc --noEmit"
},
"dependencies": {
"fs-extra": "^11.1.0",
"gpu-tex-enc": "^1.1.3"
},
"devDependencies": {
"@assetpack/core": "0.8.0"
},
"peerDependencies": {
"@assetpack/core": ">=0.0.0"
},
"engines": {
"node": ">=16.0.0"
},
"publishConfig": {
"access": "public"
}
}
7 changes: 7 additions & 0 deletions packages/compressed-textures/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { readFileSync } from 'fs';

import { createConfig } from '../../shared/rollup.config.mjs';

export default createConfig({
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
});
Loading

0 comments on commit 5b654f0

Please sign in to comment.