27 # include <openvdb/openvdb.h>
28 openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(
const struct Volume *volume,
75 metadata.
width = resolution.
x * amplify;
76 metadata.
height = resolution.
y * amplify;
77 metadata.
depth = resolution.
z * amplify;
102 const int width = resolution.
x * amplify;
103 const int height = resolution.
y * amplify;
104 const int depth = resolution.
z * amplify;
105 const size_t num_pixels = ((size_t)
width) *
height * depth;
107 float *fpixels = (
float *)pixels;
110 FluidDomainSettings_density_grid_get_length(&
b_domain.ptr, &
length);
111 if (
length == num_pixels) {
112 FluidDomainSettings_density_grid_get(&
b_domain.ptr, fpixels);
119 FluidDomainSettings_flame_grid_get_length(&
b_domain.ptr, &
length);
120 if (
length == num_pixels) {
121 FluidDomainSettings_flame_grid_get(&
b_domain.ptr, fpixels);
127 FluidDomainSettings_color_grid_get_length(&
b_domain.ptr, &
length);
128 if (
length == num_pixels * 4) {
129 FluidDomainSettings_color_grid_get(&
b_domain.ptr, fpixels);
134 FluidDomainSettings_velocity_grid_get_length(&
b_domain.ptr, &
length);
135 if (
length == num_pixels * 3) {
136 FluidDomainSettings_velocity_grid_get(&
b_domain.ptr, fpixels);
142 if (
length == num_pixels) {
143 FluidDomainSettings_heat_grid_get(&
b_domain.ptr, fpixels);
148 FluidDomainSettings_temperature_grid_get_length(&
b_domain.ptr, &
length);
149 if (
length == num_pixels) {
150 FluidDomainSettings_temperature_grid_get(&
b_domain.ptr, fpixels);
156 "Cycles error: unknown volume attribute %s, skipping\n",
164 fprintf(stderr,
"Cycles error: unexpected smoke volume resolution, skipping\n");
205 volume->set_clipping(b_domain.clipping());
222 b_volume.grids.load(b_data.ptr.data);
227 const bool unload = !b_volume_grid.is_loaded();
231 grid = BKE_volume_grid_openvdb_for_read(volume, volume_grid);
234 b_volume_grid.unload();
252 b_volume.grids.load(b_data.ptr.data);
256 volume->set_clipping(b_render.clipping());
257 volume->set_step_size(b_render.step_size());
258 volume->set_object_space((b_render.space() == BL::VolumeRender::space_OBJECT));
262 ustring name = ustring(b_grid.name());
292 params.frame = b_volume.grids.frame();
303 if (view_layer.use_volumes) {
304 if (b_ob.type() == BL::Object::type_VOLUME) {
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 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
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
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)
static void sync_volume_object(BL::BlendData &b_data, BL::Object &b_ob, Scene *scene, Volume *volume)
static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Volume *volume, float frame)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
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)
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
@ ATTR_STD_VOLUME_TEMPERATURE
@ ATTR_STD_VOLUME_DENSITY
@ ATTR_STD_VOLUME_VELOCITY
ImageManager * image_manager
virtual void clear(bool preserve_shaders=false) override