【问题标题】:iOS Metal shader language how to flip order of values inside float2?iOS Metal着色器语言如何翻转float2中的值顺序?
【发布时间】:2021-01-29 19:32:54
【问题描述】:

如果我有一个金属着色器语言的结构:

如何访问单个结构(如 float2)元素并翻转它们的顺序?

const float2 sampledCameraPoint = cameraSamplePatternBuffer[vertexID]; // (has x and y)
const float2 flipped = float2(?, ?) // how to get (sampledCameraPoint.y, sampledCameraPoint.x)?

【问题讨论】:

    标签: c++ metal ios14


    【解决方案1】:

    您可以使用xy 等访问元素,因此应该可以:

    float2 flipped = otherFloat2.yx;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-03
      • 1970-01-01
      • 1970-01-01
      • 2019-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多