44 #define IMAGE_DRAW_FLAG_SHOW_ALPHA (1 << 0)
45 #define IMAGE_DRAW_FLAG_APPLY_ALPHA (1 << 1)
46 #define IMAGE_DRAW_FLAG_SHUFFLING (1 << 2)
47 #define IMAGE_DRAW_FLAG_DEPTH (1 << 3)
48 #define IMAGE_DRAW_FLAG_DO_REPEAT (1 << 4)
49 #define IMAGE_DRAW_FLAG_USE_WORLD_POS (1 << 5)
59 float translate_x = 0.0f;
60 float translate_y = 0.0f;
65 const float ibuf_width = ibuf->
x;
66 const float ibuf_height = ibuf->
y;
67 const float x = (region->
winx - snode->
zoom * ibuf_width) / 2 + snode->
xof;
68 const float y = (region->
winy - snode->
zoom * ibuf_height) / 2 + snode->
yof;
70 zoom_x = ibuf_width * snode->
zoom;
71 zoom_y = ibuf_height * snode->
zoom;
84 obmat[3][1] = translate_y;
85 obmat[3][0] = translate_x;
87 if (is_tiled_texture) {
89 const int tile_x = ((tile->tile_number - 1001) % 10);
90 const int tile_y = ((tile->tile_number - 1001) / 10);
91 obmat[3][1] = (
float)tile_y + translate_y;
92 obmat[3][0] = (
float)tile_x + translate_x;
105 bool *r_owns_texture,
122 BLI_assert(!
"Integer based depth buffers not supported");
127 *r_owns_texture =
true;
132 *r_owns_texture =
true;
138 *r_owns_texture =
false;
142 *r_owns_texture =
false;
151 bool *r_owns_texture,
155 *r_owns_texture =
false;
156 *r_tex_tile_data =
NULL;
163 bool *r_owns_texture,
175 image, iuser, ibuf, r_gpu_texture, r_owns_texture, r_tex_tile_data);
196 static float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
197 static float shuffle[4] = {1.0f, 1.0f, 1.0f, 1.0f};
198 static float far_near[2] = {100.0f, 0.0f};
206 const bool is_tiled_texture = tex_tile_data !=
NULL;
212 const bool do_repeat = (!is_tiled_texture) && ((sima->
flag &
SI_DRAW_TILE) != 0);
294 if (is_tiled_texture) {
346 const char space_type = space_link->
spacetype;
363 float winmat[4][4], viewmat[4][4];
411 static float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
412 GPU_framebuffer_clear_color_depth(dfbl->
default_fb, clear_col, 1.0);
typedef float(TangentPoint)[2]
struct Main * CTX_data_main(const bContext *C)
void BKE_image_multiview_index(struct Image *ima, struct ImageUser *iuser)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
bool BKE_image_has_gpu_texture_premultiplied_alpha(struct Image *image, struct ImBuf *ibuf)
struct GPUTexture * BKE_image_get_gpu_tiles(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
struct RenderPass * BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser)
struct Image * BKE_image_ensure_viewer(struct Main *bmain, int type, const char *name)
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
struct GPUTexture * BKE_image_get_gpu_tilemap(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
General operations, lookup, etc. for blender objects.
#define LISTBASE_FOREACH(type, var, list)
void orthographic_m4(float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip)
void unit_m4(float m[4][4])
MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
#define SET_FLAG_FROM_TEST(value, test, flag)
@ DRW_STATE_BLEND_ALPHA_PREMUL
#define DRW_shgroup_call_obmat(shgroup, geom, obmat)
#define DRW_VIEWPORT_DATA_SIZE(ty)
void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock)
struct Image * ED_space_image(struct SpaceImage *sima)
int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf)
struct ImBuf * ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
_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 y
struct GPUShader GPUShader
struct GPUTexture GPUTexture
void GPU_texture_free(GPUTexture *tex)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
GPUBatch * DRW_cache_quad_get(void)
DefaultFramebufferList * DRW_viewport_framebuffer_list_get(void)
const DRWContextState * DRW_context_state_get(void)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
DRWView * DRW_view_create(const float viewmat[4][4], const float winmat[4][4], const float(*culling_viewmat)[4], const float(*culling_winmat)[4], DRWCallVisibilityFn *visibility_fn)
void DRW_shgroup_uniform_texture_ex(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex, eGPUSamplerState sampler_state)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
DRWPass * DRW_pass_create(const char *name, DRWState state)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_view_set_active(DRWView *view)
void DRW_draw_pass(DRWPass *pass)
static void IMAGE_cache_init(void *ved)
#define IMAGE_DRAW_FLAG_DO_REPEAT
static void image_draw_finish(IMAGE_Data *ved)
static void space_node_gpu_texture_get(Image *image, ImageUser *iuser, ImBuf *ibuf, GPUTexture **r_gpu_texture, bool *r_owns_texture, GPUTexture **r_tex_tile_data)
static void IMAGE_draw_scene(void *ved)
static void IMAGE_cache_populate(void *UNUSED(vedata), Object *UNUSED(ob))
static const DrawEngineDataSize IMAGE_data_size
static void IMAGE_engine_init(void *ved)
#define IMAGE_DRAW_FLAG_SHOW_ALPHA
static void space_image_gpu_texture_get(Image *image, ImageUser *iuser, ImBuf *ibuf, GPUTexture **r_gpu_texture, bool *r_owns_texture, GPUTexture **r_tex_tile_data)
static void image_cache_image_add(DRWShadingGroup *grp, Image *image, ImBuf *ibuf)
DrawEngineType draw_engine_image_type
#define IMAGE_DRAW_FLAG_SHUFFLING
static void IMAGE_engine_free(void)
#define IMAGE_DRAW_FLAG_USE_WORLD_POS
#define IMAGE_DRAW_FLAG_APPLY_ALPHA
static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser, ImBuf *ibuf)
#define IMAGE_DRAW_FLAG_DEPTH
static void image_gpu_texture_get(Image *image, ImageUser *iuser, ImBuf *ibuf, GPUTexture **r_gpu_texture, bool *r_owns_texture, GPUTexture **r_tex_tile_data)
GPUShader * IMAGE_shader_image_get(bool is_tiled_image)
void IMAGE_shader_library_ensure(void)
void IMAGE_shader_free(void)
static void shuffle(float2 points[], int size, int rng_seed)
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)
void *(* MEM_callocN)(size_t len, const char *str)
struct SpaceLink * space_data
const struct bContext * evil_C
struct GPUFrameBuffer * default_fb
struct GPUTexture * texture