14 # include <openvdb/openvdb.h>
15 openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(
const struct Volume *volume,
62 metadata.
width = resolution.
x * amplify;
63 metadata.
height = resolution.
y * amplify;
64 metadata.
depth = resolution.
z * amplify;
89 const int width = resolution.
x * amplify;
90 const int height = resolution.
y * amplify;
91 const int depth = resolution.
z * amplify;
94 float *fpixels = (
float *)pixels;
97 FluidDomainSettings_density_grid_get_length(&
b_domain.ptr, &
length);
99 FluidDomainSettings_density_grid_get(&
b_domain.ptr, fpixels);
106 FluidDomainSettings_flame_grid_get_length(&
b_domain.ptr, &
length);
108 FluidDomainSettings_flame_grid_get(&
b_domain.ptr, fpixels);
114 FluidDomainSettings_color_grid_get_length(&
b_domain.ptr, &
length);
116 FluidDomainSettings_color_grid_get(&
b_domain.ptr, fpixels);
121 FluidDomainSettings_velocity_grid_get_length(&
b_domain.ptr, &
length);
123 FluidDomainSettings_velocity_grid_get(&
b_domain.ptr, fpixels);
130 FluidDomainSettings_heat_grid_get(&
b_domain.ptr, fpixels);
135 FluidDomainSettings_temperature_grid_get_length(&
b_domain.ptr, &
length);
137 FluidDomainSettings_temperature_grid_get(&
b_domain.ptr, fpixels);
143 "Cycles error: unknown volume attribute %s, skipping\n",
151 fprintf(stderr,
"Cycles error: unexpected smoke volume resolution, skipping\n");
182 float velocity_scale = b_domain.velocity_scale();
185 const float motion_scale = (need_motion) ?
187 (b_scene.render().fps() / b_scene.render().fps_base()) :
190 velocity_scale *= motion_scale;
192 volume->set_velocity_scale(velocity_scale);
208 volume->set_clipping(b_domain.clipping());
225 BL::VolumeRender::precision_enum precision_)
228 b_volume.grids.load(b_data.ptr.data);
233 const bool unload = !b_volume_grid.is_loaded();
237 grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid);
240 b_volume_grid.unload();
248 switch (precision_) {
249 case BL::VolumeRender::precision_FULL:
252 case BL::VolumeRender::precision_HALF:
256 case BL::VolumeRender::precision_VARIABLE:
275 b_volume.grids.load(b_data.ptr.data);
279 volume->set_clipping(b_render.clipping());
280 volume->set_step_size(b_render.step_size());
281 volume->set_object_space((b_render.space() == BL::VolumeRender::space_OBJECT));
284 if (b_volume.velocity_unit() == BL::Volume::velocity_unit_SECOND) {
287 const float motion_scale = (need_motion) ?
289 (b_scene.render().fps() / b_scene.render().fps_base()) :
292 velocity_scale *= motion_scale;
295 volume->set_velocity_scale(velocity_scale);
299 ustring name = ustring(b_grid.name());
318 name == b_volume.velocity_grid()) {
322 name == b_volume.velocity_x_grid()) {
326 name == b_volume.velocity_y_grid()) {
330 name == b_volume.velocity_z_grid()) {
341 b_data, b_volume, name.string(), b_render.precision());
343 params.frame = b_volume.grids.frame();
354 if (view_layer.use_volumes) {
struct VolumeGrid VolumeGrid
struct FluidDomainSettings FluidDomainSettings
struct VolumeRender VolumeRender
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
static void sync_smoke_volume(BL::Scene &b_scene, Scene *scene, BObjectInfo &b_ob_info, Volume *volume, float frame)
static void sync_volume_object(BL::BlendData &b_data, BL::Scene &b_scene, BObjectInfo &b_ob_info, Scene *scene, Volume *volume)
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
ImageHandle & data_voxel()
static const char * standard_name(AttributeStandard std)
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_)
bool need_attribute(Scene *scene, AttributeStandard std)
void tag_update(Scene *scene, bool rebuild)
ImageHandle add_image(const string &filename, const ImageParams ¶ms)
#define CCL_NAMESPACE_END
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)
static void mesh_texture_space(BL::Mesh &b_mesh, float3 &loc, float3 &size)
SyclQueue void void size_t num_bytes void
ccl_gpu_kernel_postfix ccl_global float int num_pixels
@ 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
T length(const vec_base< T, Size > &a)
bool is_real_object_data() const
ImageManager * image_manager
float motion_shutter_time()
virtual void clear(bool preserve_shaders=false) override