59 metadata.
width = resolution.
x * amplify;
60 metadata.
height = resolution.
y * amplify;
61 metadata.
depth = resolution.
z * amplify;
90 const int width = resolution.
x * amplify;
91 const int height = resolution.
y * amplify;
92 const int depth = resolution.
z * amplify;
93 const size_t num_pixels = ((size_t)width) * height * depth;
95 float *fpixels = (
float *)pixels;
98 FluidDomainSettings_density_grid_get_length(&
b_domain.ptr, &
length);
99 if (
length == num_pixels) {
100 FluidDomainSettings_density_grid_get(&
b_domain.ptr, fpixels);
107 FluidDomainSettings_flame_grid_get_length(&
b_domain.ptr, &
length);
108 if (
length == num_pixels) {
109 FluidDomainSettings_flame_grid_get(&
b_domain.ptr, fpixels);
115 FluidDomainSettings_color_grid_get_length(&
b_domain.ptr, &
length);
116 if (
length == num_pixels * 4) {
117 FluidDomainSettings_color_grid_get(&
b_domain.ptr, fpixels);
122 FluidDomainSettings_velocity_grid_get_length(&
b_domain.ptr, &
length);
123 if (
length == num_pixels * 3) {
124 FluidDomainSettings_velocity_grid_get(&
b_domain.ptr, fpixels);
130 if (
length == num_pixels) {
131 FluidDomainSettings_heat_grid_get(&
b_domain.ptr, fpixels);
136 FluidDomainSettings_temperature_grid_get_length(&
b_domain.ptr, &
length);
137 if (
length == num_pixels) {
138 FluidDomainSettings_temperature_grid_get(&
b_domain.ptr, fpixels);
144 "Cycles error: unknown volume attribute %s, skipping\n",
152 fprintf(stderr,
"Cycles error: unexpected smoke volume resolution, skipping\n");
183 float velocity_scale = b_domain.velocity_scale();
186 const float motion_scale = (need_motion) ?
188 (b_scene.render().fps() / b_scene.render().fps_base()) :
191 velocity_scale *= motion_scale;
193 volume->set_velocity_scale(velocity_scale);
203 const Interval<int> frame_interval = {b_domain.cache_frame_start(), b_domain.cache_frame_end()};
211 volume->set_clipping(b_domain.clipping());
215 if (!frame_interval.
contains(frame)) {
233 BL::VolumeRender::precision_enum precision_)
236 b_volume.grids.load(b_data.ptr.data);
239 for (BL::VolumeGrid &b_volume_grid :
b_volume.grids) {
240 if (b_volume_grid.name() == grid_name) {
241 const auto *grid_data = static_cast<const blender::bke::VolumeGridData *>(
242 b_volume_grid.ptr.data);
243 grid_data->add_user();
244 volume_grid = blender::bke::GVolumeGrid{grid_data};
245 grid = volume_grid->grid_ptr(tree_access_token);
251 switch (precision_) {
252 case BL::VolumeRender::precision_FULL:
255 case BL::VolumeRender::precision_HALF:
259 case BL::VolumeRender::precision_VARIABLE:
271 blender::bke::GVolumeGrid volume_grid;
272 blender::bke::VolumeTreeAccessToken tree_access_token;
283 b_volume.grids.load(b_data.ptr.data);
285 BL::VolumeRender b_render(b_volume.render());
287 volume->set_clipping(b_render.clipping());
288 volume->set_step_size(b_render.step_size());
289 volume->set_object_space((b_render.space() == BL::VolumeRender::space_OBJECT));
292 if (b_volume.velocity_unit() == BL::Volume::velocity_unit_SECOND) {
295 const float motion_scale = (need_motion) ?
297 (b_scene.render().fps() / b_scene.render().fps_base()) :
300 velocity_scale *= motion_scale;
303 volume->set_velocity_scale(velocity_scale);
306 for (BL::VolumeGrid &b_grid : b_volume.grids) {
307 const ustring name = ustring(b_grid.name());
326 name == b_volume.velocity_grid())
331 name == b_volume.velocity_x_grid())
336 name == b_volume.velocity_y_grid())
341 name == b_volume.velocity_z_grid())
354 b_data, b_volume, name.string(), b_render.precision());
356 params.frame = b_volume.grids.frame();
367 if (view_layer.use_volumes) {
static void sync_smoke_volume(BL::Scene &b_scene, Scene *scene, BObjectInfo &b_ob_info, Volume *volume, const float frame)
static void sync_volume_object(BL::BlendData &b_data, BL::Scene &b_scene, BObjectInfo &b_ob_info, Scene *scene, Volume *volume)
for(;discarded_id_iter !=nullptr;discarded_id_iter=static_cast< ID * >(discarded_id_iter->next))
Attribute * add(ustring name, const TypeDesc type, AttributeElement element)
bool load_pixels(const ImageMetaData &, void *pixels, const size_t, const bool) override
string name() const override
bool load_metadata(const ImageDeviceFeatures &, ImageMetaData &metadata) override
BlenderSmokeLoader(BL::Object &b_ob, AttributeStandard attribute)
BL::FluidDomainSettings b_domain
bool equals(const ImageLoader &other) const override
AttributeStandard attribute
BlenderVolumeLoader(BL::BlendData &b_data, BL::Volume &b_volume, const string &grid_name, BL::VolumeRender::precision_enum precision_)
void tag_update(Scene *scene, bool rebuild)
bool need_attribute(Scene *scene, AttributeStandard std)
VDBImageLoader(const string &grid_name)
static void mesh_texture_space(const ::Mesh &b_mesh, float3 &loc, float3 &size)
static bool object_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
static int3 get_int3(const BL::Array< int, 3 > &array)
static BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b_ob)
#define CCL_NAMESPACE_END
float length(VecOp< float, D >) RET
@ ATTR_STD_VOLUME_VELOCITY_Y
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VOLUME_VELOCITY_Z
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_VOLUME_VELOCITY
@ ATTR_STD_VOLUME_VELOCITY_X
static const char * standard_name(AttributeStandard std)
ImageHandle & data_voxel()
bool is_real_object_data() const
ccl_device_inline_method bool contains(T value) const
unique_ptr< ImageManager > image_manager
float motion_shutter_time()
void clear(bool preserve_shaders=false) override