We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么转换代码是 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 >> 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; }
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吗,是我有哪部分知识遗漏了吗,望大佬赐教
The text was updated successfully, but these errors were encountered:
你确实是知识有遗漏,谁说第一个字节就要是 r ?这个叫做 pixel format,光 32 位,就有:
A8R8G8B8 A8B8G8R8 P8R8G8B8 P8B8G8R8 R8G8B8A8 B8G8R8A8 R8G8B8P8 A2R10G10B10 A2B10G10R10 ...
懒得给你写了,像素格式是由:rmask, gmask, bmask, amask 决定的,无穷无尽。
Sorry, something went wrong.
感谢大佬回答,图形学方面我确实有很多地方不知道从何学起。这几天学习了大佬代码,感觉对渲染的认知相比以往提升了很多,继续向大佬学习呀
No branches or pull requests
为什么转换代码是
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吗,是我有哪部分知识遗漏了吗,望大佬赐教
The text was updated successfully, but these errors were encountered: