Newer
Older
pixi.js / src / loaders / textureParser.js
@Matt Karl Matt Karl on 22 Feb 2017 511 bytes 4.4.0
import { Resource } from 'resource-loader';
import Texture from '../core/textures/Texture';

export default function ()
{
    return function textureParser(resource, next)
    {
        // create a new texture if the data is an Image object
        if (resource.data && resource.type === Resource.TYPE.IMAGE)
        {
            resource.texture = Texture.fromLoader(
                resource.data,
                resource.url,
                resource.name
            );
        }
        next();
    };
}