Skip to content

请教 整数颜色到矢量 转换问题 #8

Description

@chenxiayun

为什么转换代码是
inline static Vec4f vector_from_color(uint32_t rgba) { Vec4f out; out.r = ((rgba >> 16) & 0xff) / 255.0f; out.g = ((rgba >> 8) & 0xff) / 255.0f; out.b = ((rgba >> 0) & 0xff) / 255.0f; out.a = ((rgba >> 24) & 0xff) / 255.0f; return out; }

而不是
inline static Vec4f vector_from_color(uint32_t rgba) { Vec4f out; out.r = ((rgba >> 0) & 0xff) / 255.0f; out.g = ((rgba >> 8) & 0xff) / 255.0f; out.b = ((rgba >> 16) & 0xff) / 255.0f; out.a = ((rgba >> 24 & 0xff)) / 255.0f; return out; }

第一个字节不应该储存的是r吗,是我有哪部分知识遗漏了吗,望大佬赐教

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions