Open
Conversation
6b28077 to
bcfb134
Compare
cloudwu
reviewed
Feb 9, 2026
src/material_perspective_quad.c
Outdated
| } | ||
| if (get_bool_field(L, 2, "flip_y", 0)) { | ||
| info |= PQUAD_INFO_FLIP_Y; | ||
| } |
Owner
There was a problem hiding this comment.
代码我还没有太仔细看。不过这里我有点疑问:通常都是用负的 scale_x 实现 flip_x ,用负的 scale_y 实现 flip_y 。因为用矩阵做变换时,就是将 scale_x 设为 -1 实现镜像的。
这里需要额外的 flip_x/flip_y 参数吗?
Owner
There was a problem hiding this comment.
scale 为负数时,是不是下面计算 struct corner_primitive prim[PQUAD_CORNER_N] 的时候,就自然镜像了呀?(但好像需要把对称轴线调整一下)
比如把 scale_x 设为 -1 ,那么在计算 tx 的时候就是负的。左右两个点就换过来了。在光栅化的时候就镜像了。
如果在这里就把 prim 都算好的吧,看起来 submit 那里就不需要额外做判断去处理。
不过,如果这样做,感觉需要确保 cull_mode 为 SG_CULLMODE_NONE ( sokol 的确以这个为默认值, soluna 没有额外设置)
4791f3a to
d9442be
Compare
d9442be to
eecdb0f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
see #69
参考讨论内容, 试着实现了四边形透视材质.
soluna.material.perspective_quad模块以及一个matpq.spriteapi.test/perspective_quad.lua测试, 预览地址: https://yuchanns.github.io/soluna/examples/perspective_quad/