本文整理汇总了C++中vec4::w方法的典型用法代码示例。如果您正苦于以下问题:C++ vec4::w方法的具体用法?C++ vec4::w怎么用?C++ vec4::w使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec4
的用法示例。
在下文中一共展示了vec4::w方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderAAQuadAlongXNinePatch
void Mesh::RenderAAQuadAlongXNinePatch(const vec3 &bottom_left,
const vec3 &top_right,
const vec2i &texture_size,
const vec4 &patch_info) {
static const Attribute format[] = {kPosition3f, kTexCoord2f, kEND};
static const unsigned short indices[] = {
0, 2, 1, 1, 2, 3, 2, 4, 3, 3, 4, 5, 4, 6, 5, 5, 6, 7,
1, 3, 8, 8, 3, 9, 3, 5, 9, 9, 5, 10, 5, 7, 10, 10, 7, 11,
8, 9, 12, 12, 9, 13, 9, 10, 13, 13, 10, 14, 10, 11, 14, 14, 11, 15,
};
auto max = vec2::Max(bottom_left.xy(), top_right.xy());
auto min = vec2::Min(bottom_left.xy(), top_right.xy());
auto p0 = vec2(texture_size) * patch_info.xy() + min;
auto p1 = max - vec2(texture_size) * (mathfu::kOnes2f - patch_info.zw());
// Check if the 9 patch edges are not overwrapping.
// In that case, adjust 9 patch geometry locations not to overwrap.
if (p0.x() > p1.x()) {
p0.x() = p1.x() = (min.x() + max.x()) / 2;
}
if (p0.y() > p1.y()) {
p0.y() = p1.y() = (min.y() + max.y()) / 2;
}
// vertex format is [x, y, z] [u, v]:
float z = bottom_left.z();
// clang-format off
const float vertices[] = {
min.x(), min.y(), z, 0.0f, 0.0f,
p0.x(), min.y(), z, patch_info.x(), 0.0f,
min.x(), p0.y(), z, 0.0f, patch_info.y(),
p0.x(), p0.y(), z, patch_info.x(), patch_info.y(),
min.x(), p1.y(), z, 0.0, patch_info.w(),
p0.x(), p1.y(), z, patch_info.x(), patch_info.w(),
min.x(), max.y(), z, 0.0, 1.0,
p0.x(), max.y(), z, patch_info.x(), 1.0,
p1.x(), min.y(), z, patch_info.z(), 0.0f,
p1.x(), p0.y(), z, patch_info.z(), patch_info.y(),
p1.x(), p1.y(), z, patch_info.z(), patch_info.w(),
p1.x(), max.y(), z, patch_info.z(), 1.0f,
max.x(), min.y(), z, 1.0f, 0.0f,
max.x(), p0.y(), z, 1.0f, patch_info.y(),
max.x(), p1.y(), z, 1.0f, patch_info.w(),
max.x(), max.y(), z, 1.0f, 1.0f,
};
// clang-format on
Mesh::RenderArray(kTriangles, 6 * 9, format, sizeof(float) * 5,
reinterpret_cast<const char *>(vertices), indices);
}
示例2:
void Graphics::setFloat4(ConstantLocation position, vec4 value) {
setFloat4(position, value.x(), value.y(), value.z(), value.w());
}