33 float4 *raw_data_ =
nullptr;
42 int64_t table_len = table_extent_.x * table_extent_.y * table_extent_.z;
45 out_data[
i] =
T(raw_data_[
i]);
54 template<
typename VecT>
67 file.open(std::string(
name) +
".pfm");
69 file << n_x * n_z <<
" " << n_y * n_w <<
"\n";
76 file.open(std::string(
name) +
".pfm", std::ios_base::app | std::ios::out | std::ios::binary);
84 int64_t src = (n_x * n_y * n_z * src_w) + (n_x * n_y * src_z) + (n_x * src_y) + src_x;
87 data[c] = pixels[src][c];
89 file.write(
reinterpret_cast<char *
>(&
data),
sizeof(
float3));
99 template<
typename VecT>
109 file.open(std::string(
name) +
".hh");
110 file <<
"const float " <<
name;
112 file <<
"[" << n_w <<
"]";
115 file <<
"[" << n_z <<
"]";
118 file <<
"[" << n_y <<
"]";
121 file <<
"[" << n_x <<
"]";
123 file <<
"[" << VecT::type_length <<
"]";
131 if (n_z > 1 || n_w > 1) {
135 if (n_y > 1 || n_z > 1 || n_w > 1) {
139 if (n_x > 1 || n_y > 1 || n_z > 1 || n_w > 1) {
142 int64_t pixel_index = (n_x * n_y * n_z *
w) + (n_x * n_y *
z) + (n_x *
y) +
x;
143 for (
auto c :
IndexRange(VecT::type_length)) {
144 file << std::to_string(pixels[pixel_index][c]);
145 if (c + 1 < VecT::type_length) {
152 if (n_x > 1 || n_y > 1 || n_z > 1 || n_w > 1) {
153 file << (
x + 1 < n_x ?
"}, " :
"}");
156 if (n_y > 1 || n_z > 1 || n_w > 1) {
157 file << (
y + 1 < n_y ?
"},\n" :
"}\n");
160 if (n_z > 1 || n_w > 1) {
161 file << (
z + 1 < n_z ?
"},\n" :
"}\n");
165 file << (
w + 1 < n_w ?
"},\n" :
"}\n");
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static void write_to_header(StringRefNull name, Span< VecT > pixels, int64_t n_x, int64_t n_y=1, int64_t n_z=1, int64_t n_w=1)
Precompute(draw::Manager &manager, PrecomputeType type, int3 table_extent)
static void write_to_pfm(StringRefNull name, Span< VecT > pixels, int64_t n_x, int64_t n_y=1, int64_t n_z=1, int64_t n_w=1)
BLI_STATIC_ASSERT(MBC_BATCH_LEN< 64, "Number of batches exceeded the limit of bit fields")
VecBase< float, 4 > float4
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3