Newer
Older
pixi.js / packages / loaders / src / textureParser.js
@Matt Karl Matt Karl on 31 Oct 2017 501 bytes Next Restructure for v5 (#4387)
import { Resource } from 'resource-loader';
import { Texture } from '@pixi/core';

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();
    };
}