马里奥赛车“镜像模式” - OpenGL
我想知道像《马里奥赛车》这样的游戏的开发者是如何改变他们的关卡方向的。有没有一种简单的方法可以在 OpenGL 中做到这一点?对于那些不知道的人来说,如果您要在“镜像”模式下玩关卡,通常位于左侧的门将位于右侧。
这是一个小例子,
具有这四个顶点的多边形
X Y
Z W
将是
Y X
W Z
I am wondering about how the developers of games like Mario Kart go about switching the orientation of their levels. Is there an easy way to do this in OpenGL. For those who aren't aware, if you were to play a level in "mirror" mode, a door that is usually on the left would then be on the right.
Here is a small example
A polygon with these four verticies
X Y
Z W
Would be
Y X
W Z
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要它。
glScalef(-1.0f, 1.0f, 1.0f)
,例如是x轴镜像。GL_CW
调用glFrontFace
。即,将正面更改为“相反”值。相同的原理可以用于 3.0 着色器,即使您必须使用其他东西来构建
比例矩阵
虽然,是的,在视频游戏的情况下,只需在关卡编辑器中翻转整个地图并保存可能会更容易(碰撞检测)它作为新的水平,而不是即时翻转它。
You don't need that.
glScalef(-1.0f, 1.0f, 1.0f)
, for example is x-axis mirror.glFrontFace
withGL_CW
. I.e. change front face to "opposite" value.Same principle can be used with 3.0 shaders, even if you'll have to use something else to build
Scale matrix
Although, yes, in case of video game it might be easier (collision detection) just to flip entire map in level editor and save it as new level instead of flipping it on the fly.