Giter VIP home page Giter VIP logo

Comments (5)

GoodBoyDigital avatar GoodBoyDigital commented on March 29, 2024

Thanks @floatdrop, an interesting point!
Seems like you cracked the solution.. Was thinking of adding a PIXI.getBaseTexteureFromImage function.. may make life a little clearer?

from pixijs.

floatdrop avatar floatdrop commented on March 29, 2024

Thank you for fast respone, @GoodBoyDigital! I don't think, that duplicating methods for this make someone life easier. But. also I can't propose a good solution.

May be will be better to allow create texture from texture by adding code like this to Texture.js:19:

    if (baseTexture instanceof PIXI.Texture)
        baseTexture = baseTexture.baseTexture;

This will guarantee, that all textures have BaseTexture in baseTexture field.

Or may be better to rethrow event in Texture.js:72 like this:

this.scope.dispatchEvent( { type: 'loaded', content: this } );

but it only updates an width and height, so it is not full solution.

I prefer to just mention it in documentation, that you cannot create Texture from Texture, because I don't see, why there is such limitation (Texture inherited from BaseTexture), therefore I cannot propose a proper solution. Could you clarify the reason of this non-inheritable behavior?

from pixijs.

englercj avatar englercj commented on March 29, 2024

I honestly think the best thing here would be to have PIXI.BaseTexture.fromImage which PIXI.Texture would use under the hood. That way you don't duplicate code, and I can get a BaseTexture without the overhead of a useless texture on top.

from pixijs.

GoodBoyDigital avatar GoodBoyDigital commented on March 29, 2024

Excellent idea @englercj Will add that to the code base for sure.

@floatdrop I think the name of the class "baseTexture" may be slightly misleading. Think of it as a texture source.

In a nut shell: A texture needs a source (baseTexture) and a frame (rectangle)

Hope that helps!

from pixijs.

lock avatar lock commented on March 29, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from pixijs.

Related Issues (20)

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.