Jump to content

Question about Mesh with typescript in v5.3.7


jcwilk
 Share

Recommended Posts

Hi,

So I've been trying to get shaders working in typescript (can run them just fine in javascript) but all the examples (eg https://pixijs.io/examples/#/mesh-and-shaders/triangle-color.js) use the following pattern:

const geometry = new PIXI.Geometry();
const shader = PIXI.Shader.from(`shader code`);
const triangle = new PIXI.Mesh(geometry, shader);

but in v5.3.7 the Mesh constructor is defined to take in only an instance of MeshMaterial for its second argument, not an instance of Shader: https://github.com/pixijs/pixi.js/blob/dacad3a452c8f27f4fd2d064cda206182f22ebff/packages/mesh/src/Mesh.ts#L65 even though the member variable shader can return either a Shader or a MeshMaterial: https://github.com/pixijs/pixi.js/blob/dacad3a452c8f27f4fd2d064cda206182f22ebff/packages/mesh/src/Mesh.ts#L83. I'm new to typescript though, so I must be missing something since this would make the most straightforward example usage of shaders done throughout almost all of the shader examples invalid in typescript. Mind giving me a tip about what I'm doing wrong? I'm excited to do typed webgl and appreciate all of your efforts!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...