67 return (cache && cache->
is_dirty ==
false);
78 memset(cache, 0,
sizeof(*cache));
101 if (cache ==
nullptr) {
142 void *userdata,
const float (*
verts)[3],
const int (*edges)[2],
int totvert,
int totedge)
154 uint pos_hq_id, nor_hq_id;
161 &
format,
"nor", blender::gpu::VertAttrType::SNORM_10_10_10_2);
168 &
format,
"pos", gpu::VertAttrType::SFLOAT_32_32_32);
170 &
format,
"nor", blender::gpu::VertAttrType::SNORM_16_16_16_16);
181 const float3 normal(1.0f, 0.0f, 0.0f);
204 for (
int i = 0;
i < totedge;
i++) {
227 if (volume_grid ==
nullptr) {
243 void *userdata,
float (*
verts)[3],
int (*tris)[3],
int totvert,
int tottris)
263 for (
int i = 0;
i < tottris;
i++) {
277 if (volume_grid ==
nullptr) {
287 const bke::VolumeGridData *grid,
294 if (cache_grid->name ==
name) {
310 if (!
ELEM(channels, 1, 3)) {
321 blender::gpu::TextureFormat::SFLOAT_16_16_16 :
322 blender::gpu::TextureFormat::SFLOAT_16;
331 if (cache_grid->
texture !=
nullptr) {
338 printf(
"Error: Could not allocate 3D texture for volume.\n");
346 const bke::VolumeGridData *volume_grid)
350 return (grid->
texture !=
nullptr) ? grid :
nullptr;
const blender::bke::VolumeGridData * BKE_volume_grid_active_get_for_read(const Volume *volume)
@ BKE_VOLUME_BATCH_DIRTY_ALL
bool BKE_volume_load(const Volume *volume, const Main *bmain)
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(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
@ VOLUME_WIREFRAME_POINTS
#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)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
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_swizzle_set(blender::gpu::Texture *texture, const char swizzle[4])
void GPU_texture_extend_mode(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
#define GPU_TEXTURE_FREE_SAFE(texture)
blender::gpu::Texture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_vertbuf_attr_fill_stride(blender::gpu::VertBuf *, uint a_idx, uint stride, const void *data)
void GPU_vertbuf_attr_fill(blender::gpu::VertBuf *, uint a_idx, const void *data)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
#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.
BMesh const char void * data
const DRWContext * DRW_context_get()
struct @021025263243242147216143265077100330027142264337::@240232116316110053135047106323056371161236243121 attr_id
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
std::string get_name(const VolumeGridData &grid)
int get_channels_num(VolumeGridType type)
VolumeGridType get_type(const VolumeGridData &grid)
void DRW_vertbuf_create_wiredata(gpu::VertBuf *vbo, const int vert_len)
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)
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)
static void drw_volume_wireframe_cb(void *userdata, const float(*verts)[3], const int(*edges)[2], int totvert, int totedge)
GPUType convert_normal(const float3 &src)
CartesianBasis invert(const CartesianBasis &basis)
MatBase< float, 4, 4 > float4x4
blender::VecBase< int16_t, 4 > short4
VecBase< float, 3 > float3
float texture_to_object[4][4]
float4x4 texture_to_object
float4x4 object_to_texture
struct blender::draw::VolumeBatchCache::@251277341041107130027136061041241155223024010047 face_wire
gpu::Batch * selection_surface
gpu::VertBuf * pos_nor_in_order