Sign in to follow this  
404

Aspect ratio on repeating rope texture

Recommended Posts

I'm sure I'm missing something simple here, but I can't seem to make a rope with a repeating texture that isn't an aspect ratio of 1:1. Here's my sample code, based on the "Hello World" example:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Hello World</title>
</head>
  <script src="pixi.min.js"></script>
<body>
  <script type="text/javascript">
    let type = "WebGL"
    if(!PIXI.utils.isWebGLSupported()){
      type = "canvas"
    }

    PIXI.utils.sayHello(type); //    PixiJS 5.2.4 - ✰ WebGL ✰      http://www.pixijs.com/    ♥♥♥ 

    const loader = PIXI.Loader.shared;

    let app = new PIXI.Application({width: 512, height: 512, antialias: true});
    document.body.appendChild(app.view);

    loader.add("wall","uglywall2.png"); // 128px wide, 64px tall
    loader.load(setup);
    
    function setup() {
      let walltex = loader.resources.wall.texture;
      let tsprite = new PIXI.TilingSprite(walltex,400,64);
      tsprite.x = 50;
      tsprite.y = 50;
      app.stage.addChild(tsprite);

      let tropepoints = [new PIXI.Point(50,200), new PIXI.Point(450,200)];
      let trope = new PIXI.SimpleRope(walltex,tropepoints, 1);
      walltex.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
      app.stage.addChild(trope);
    }

  </script>
</body>
</html>

I've attached a screenshot of the results. What I would expect is that the two objects appear identical, but the rope's texture gets "squashed" instead. What noob mistake am I making?

rope-texture.png

Share this post


Link to post
Share on other sites

Ok - thanks. Good to know it's not just something dumb I've overlooked. I'm not terribly conversant with the details of RopeGeometry, but I'll start digging and see what I find.

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.