如何翻转 CC3PlaneNode 上的纹理?
我正在创建一个 CC3PlaneNode (cocos3d),其代码如下所示:
CC3PlaneNode *bnode = [CC3PlaneNode nodeWithName: name];
CC3Texture *texture = [CC3Texture textureFromFile: texName];
[bnode populateAsCenteredRectangleWithSize: sz
andTessellation: ccg(1, 1)
withTexture: texture
invertTexture: YES];
bnode.material.specularColor = kCCC4FLightGray;
bnode.material.emissionColor = kCCC4FWhite;
bnode.material.isOpaque = NO;
bnode.shouldCullBackFaces = NO;
bnode.isTouchEnabled = YES;
bnode.location = loc;
[bnode retainVertexLocations];
在某些情况下,我希望平面显示其纹理的镜像(a la 上的水平翻转功能)许多图像程序。)我不只是想翻转飞机本身,因为这会导致它的所有子节点错位,这是不良行为。
也就是说,如果 X & Y 是我的纹理的一部分,“c”和“c'”是该图中的子节点:
+--------+
| |
| x y |
| |
+--------+
c c'
翻转后,我希望事情看起来像这样:
+--------+
| |
| y x |
| |
+--------+
c c'
除了不想旋转/自旋/翻转平面本身之外,否则我对解决方案非常灵活。
有什么提示吗?
谢谢!
I'm creating a CC3PlaneNode (cocos3d) with code that looks something like this:
CC3PlaneNode *bnode = [CC3PlaneNode nodeWithName: name];
CC3Texture *texture = [CC3Texture textureFromFile: texName];
[bnode populateAsCenteredRectangleWithSize: sz
andTessellation: ccg(1, 1)
withTexture: texture
invertTexture: YES];
bnode.material.specularColor = kCCC4FLightGray;
bnode.material.emissionColor = kCCC4FWhite;
bnode.material.isOpaque = NO;
bnode.shouldCullBackFaces = NO;
bnode.isTouchEnabled = YES;
bnode.location = loc;
[bnode retainVertexLocations];
Under certain circumstances, I'd like the plane to display the mirror image of its texture (a la the Flip Horizontal feature on many image programs.) I don't just want to flip the plane, itself, because that would throw out-of-position all of it's child-nodes, which is undesirable behaviour.
That is, if X & Y are parts of my texture, and "c" and "c'" are child-nodes in this diagram:
+--------+
| |
| x y |
| |
+--------+
c c'
after the flip, I want things to look like this:
+--------+
| |
| y x |
| |
+--------+
c c'
Other than not wanting to rotate/spin/flip the plane, itself, I'm otherwise pretty flexible on a solution.
Any hints?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论