69 return (cache && cache->
is_dirty ==
false);
77 volume->batch_cache = cache = MEM_cnew<VolumeBatchCache>(__func__);
80 memset(cache, 0,
sizeof(*cache));
103 if (cache ==
nullptr) {
144 void *userdata,
const float (*
verts)[3],
const int (*edges)[2],
int totvert,
int totedge)
147 Scene *scene = data->scene;
148 Volume *volume = data->volume;
158 uint pos_hq_id, nor_hq_id;
161 if (
format.attr_len == 0) {
170 static float normal[3] = {1.0f, 0.0f, 0.0f};
195 for (
int i = 0; i < totedge; i++) {
218 if (volume_grid ==
nullptr) {
234 void *userdata,
float (*
verts)[3],
int (*tris)[3],
int totvert,
int tottris)
241 if (
format.attr_len == 0) {
253 for (
int i = 0; i < tottris; i++) {
267 if (volume_grid ==
nullptr) {
277 const bke::VolumeGridData *grid,
284 if (cache_grid->name == name) {
290 DRWVolumeGrid *cache_grid = MEM_cnew<DRWVolumeGrid>(__func__);
300 if (!
ELEM(channels, 1, 3)) {
319 if (cache_grid->
texture !=
nullptr) {
326 printf(
"Error: Could not allocate 3D texture for volume.\n");
334 const bke::VolumeGridData *volume_grid)
338 return (grid->texture !=
nullptr) ? grid :
nullptr;
343 return max_ii(1, volume->totcol);
const blender::bke::VolumeGridData * BKE_volume_grid_active_get_for_read(const Volume *volume)
bool BKE_volume_load(const Volume *volume, const Main *bmain)
@ BKE_VOLUME_BATCH_DIRTY_ALL
Volume data-block rendering and viewport drawing utilities.
void BKE_volume_dense_float_grid_clear(DenseFloatVolumeGrid *dense_grid)
void BKE_volume_grid_selection_surface(const Volume *volume, const blender::bke::VolumeGridData *volume_grid, BKE_volume_selection_surface_cb cb, void *cb_userdata)
bool BKE_volume_grid_dense_floats(const Volume *volume, const blender::bke::VolumeGridData *volume_grid, DenseFloatVolumeGrid *r_dense_grid)
void BKE_volume_grid_wireframe(const Volume *volume, const blender::bke::VolumeGridData *volume_grid, BKE_volume_wireframe_cb cb, void *cb_userdata)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Object is a sort of wrapper for general info.
@ VOLUME_WIREFRAME_POINTS
#define DRW_TEXTURE_FREE_SAFE(tex)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
#define GPU_batch_create(primitive_type, vertex_buf, index_buf)
int GPU_batch_vertbuf_add(blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf, bool own_vbo)
#define GPU_BATCH_DISCARD_SAFE(batch)
bool GPU_use_hq_normals_workaround()
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
blender::gpu::IndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *)
void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder *, uint v1, uint v2)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
GPUTexture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_texture_swizzle_set(GPUTexture *texture, const char swizzle[4])
void GPU_vertbuf_attr_fill_stride(blender::gpu::VertBuf *, uint a_idx, uint stride, const void *data)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_attr_fill(blender::gpu::VertBuf *, uint a_idx, const void *data)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
Read Guarded memory(de)allocation.
const DRWContextState * DRW_context_state_get()
struct @620::@623 attr_id
void MEM_freeN(void *vmemh)
std::string get_name(const VolumeGridData &grid)
int get_channels_num(VolumeGridType type)
VolumeGridType get_type(const VolumeGridData &grid)
blender::gpu::Batch * DRW_volume_batch_cache_get_selection_surface(Volume *volume)
static void volume_batch_cache_clear(Volume *volume)
static void volume_batch_cache_init(Volume *volume)
void DRW_volume_batch_cache_free(Volume *volume)
void DRW_volume_batch_cache_validate(Volume *volume)
void DRW_volume_batch_cache_dirty_tag(Volume *volume, int mode)
blender::gpu::Batch * DRW_volume_batch_cache_get_wireframes_face(Volume *volume)
static bool volume_batch_cache_valid(Volume *volume)
static DRWVolumeGrid * volume_grid_cache_get(const Volume *volume, const bke::VolumeGridData *grid, VolumeBatchCache *cache)
void DRW_vertbuf_create_wiredata(blender::gpu::VertBuf *vbo, const int vert_len)
static VolumeBatchCache * volume_batch_cache_get(Volume *volume)
static void drw_volume_selection_surface_cb(void *userdata, float(*verts)[3], int(*tris)[3], int totvert, int tottris)
DRWVolumeGrid * DRW_volume_batch_cache_get_grid(Volume *volume, const bke::VolumeGridData *volume_grid)
int DRW_volume_material_count_get(const Volume *volume)
static void drw_volume_wireframe_cb(void *userdata, const float(*verts)[3], const int(*edges)[2], int totvert, int totedge)
CartesianBasis invert(const CartesianBasis &basis)
MatBase< float, 4, 4 > float4x4
blender::float4x4 object_to_texture
blender::float4x4 texture_to_object
float texture_to_object[4][4]
gpu::Batch * selection_surface
struct blender::draw::VolumeBatchCache::@265 face_wire
gpu::VertBuf * pos_nor_in_order