问题
I'm making a 360 viewer, so textures are inside a cylinder. Problem is that they appear inverted horizontally.
I know about texture.flipY
but I haven't found a texture.flipX
on the source.
So how can I flip a texture horizontally, or along the x axis, directly in the code? (not using an image editor)
回答1:
To flip a texture horizontally, you can do the following:
texture.wrapS = THREE.RepeatWrapping;
texture.repeat.x = - 1;
As mentioned in the comments, this approach requires the texture to be a power-of-two in size.
three.js r.87
回答2:
The answer was easier than I thought.
cylinder.scale.x = -1;
And don't forget to add
material.side = THREE.DoubleSide;
来源:https://stackoverflow.com/questions/29974578/how-to-flip-a-three-js-texture-horizontally