29 float4 *raw_data_ =
nullptr;
38 int64_t table_len = table_extent_.x * table_extent_.y * table_extent_.z;
41 out_data[i] =
T(raw_data_[i]);
50 template<
typename VecT>
63 file.open(std::string(name) +
".pfm");
65 file << n_x * n_z <<
" " << n_y * n_w <<
"\n";
66#ifdef __LITTLE_ENDIAN__
74 file.open(std::string(name) +
".pfm", std::ios_base::app | std::ios::out | std::ios::binary);
82 int64_t src = (n_x * n_y * n_z * src_w) + (n_x * n_y * src_z) + (n_x * src_y) + src_x;
85 data[c] = pixels[src][c];
87 file.write(
reinterpret_cast<char *
>(&data),
sizeof(
float3));
97 template<
typename VecT>
107 file.open(std::string(name) +
".hh");
108 file <<
"const float " << name;
110 file <<
"[" << n_w <<
"]";
113 file <<
"[" << n_z <<
"]";
116 file <<
"[" << n_y <<
"]";
119 file <<
"[" << n_x <<
"]";
121 file <<
"[" << VecT::type_length <<
"]";
129 if (n_z > 1 || n_w > 1) {
133 if (n_y > 1 || n_z > 1 || n_w > 1) {
137 if (n_x > 1 || n_y > 1 || n_z > 1 || n_w > 1) {
140 int64_t pixel_index = (n_x * n_y * n_z *
w) + (n_x * n_y *
z) + (n_x *
y) + x;
141 for (
auto c :
IndexRange(VecT::type_length)) {
142 file << std::to_string(pixels[pixel_index][c]);
143 if (c + 1 < VecT::type_length) {
150 if (n_x > 1 || n_y > 1 || n_z > 1 || n_w > 1) {
151 file << (x + 1 < n_x ?
"}, " :
"}");
154 if (n_y > 1 || n_z > 1 || n_w > 1) {
155 file << (y + 1 < n_y ?
"},\n" :
"}\n");
158 if (n_z > 1 || n_w > 1) {
159 file << (
z + 1 < n_z ?
"},\n" :
"}\n");
163 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< 32, "Number of batches exceeded the limit of bit fields")
VecBase< float, 3 > float3