Three.js:可以翻转精灵吗? [英] Three.js: Possible to flip a sprite?

查看:58
本文介绍了Three.js:可以翻转精灵吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:是否可以翻转/镜像 Three.js sprites 纹理?

Question: Is it possible to flip/mirror a Three.js sprites texture?

背景:使用three.js的当前DEV分支

Background: Using the current DEV branch of three.js

目前的发现:我首先尝试改变它的 3d 旋转,但没有任何影响.然后我检查了精灵代码,看到旋转在 Sprite.js 中的这一行中被重置:

Findings so far: I first try'd to change it's 3d rotation without any effect. Then I inspected the sprites code and saw that the rotation is reseted in this line in Sprite.js:

this.rotation3d.set( 0, 0, this.rotation );

更改那里的值没有任何效果.深入挖掘,我最终在 SpriteRenderer 插件中完全迷失了方向.

Changing the values there didn't had any effect. Digging deeper I ended up in the SpriteRenderer plugin where I got completely lost.

我的理解是,three.js 使用着色器来渲染精灵,这是一个巨大的性能优势.所以使用简单的面孔编写我自己的精灵实现感觉像是错误的方向.

My understanding is that three.js is using shaders to render sprites and that this is a huge performance plus. So writing my own sprite implementation using simple faces feels like the wrong direction.

推荐答案

好吧,这是一个远景,但尝试将您的精灵的 scale 设置为 -1(在您想要翻转的方向上)).

Okey, this is a long shot, but try setting your sprite's scale to -1 (in the directions you want to flip it).

这篇关于Three.js:可以翻转精灵吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆