Skip to content

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

@chenxiayun

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吗,是我有哪部分知识遗漏了吗,望大佬赐教

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