Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/engines/image/image_private.hh')
-rw-r--r--source/blender/draw/engines/image/image_private.hh135
1 files changed, 9 insertions, 126 deletions
diff --git a/source/blender/draw/engines/image/image_private.hh b/source/blender/draw/engines/image/image_private.hh
index fc3ce72d0aa..05ed2881145 100644
--- a/source/blender/draw/engines/image/image_private.hh
+++ b/source/blender/draw/engines/image/image_private.hh
@@ -24,6 +24,11 @@
#include <optional>
+#include "BKE_image.h"
+
+#include "image_instance_data.hh"
+#include "image_texture_info.hh"
+
/* Forward declarations */
extern "C" {
struct GPUTexture;
@@ -35,32 +40,13 @@ struct Image;
namespace blender::draw::image_engine {
-/* GPUViewport.storage
- * Is freed every time the viewport engine changes. */
-struct IMAGE_PassList {
- DRWPass *image_pass;
-};
-
-struct IMAGE_PrivateData {
- void *lock;
- struct ImBuf *ibuf;
- struct Image *image;
- struct DRWView *view;
-
- struct GPUTexture *texture;
- bool owns_texture;
-};
-
-struct IMAGE_StorageList {
- IMAGE_PrivateData *pd;
-};
-
struct IMAGE_Data {
void *engine_type;
DRWViewportEmptyList *fbl;
DRWViewportEmptyList *txl;
- IMAGE_PassList *psl;
- IMAGE_StorageList *stl;
+ DRWViewportEmptyList *psl;
+ DRWViewportEmptyList *stl;
+ IMAGE_InstanceData *instance_data;
};
/* Shader parameters. */
@@ -69,105 +55,6 @@ struct IMAGE_Data {
#define IMAGE_DRAW_FLAG_SHUFFLING (1 << 2)
#define IMAGE_DRAW_FLAG_DEPTH (1 << 3)
#define IMAGE_DRAW_FLAG_DO_REPEAT (1 << 4)
-#define IMAGE_DRAW_FLAG_USE_WORLD_POS (1 << 5)
-
-struct ShaderParameters {
- constexpr static float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
-
- int flags = 0;
- float shuffle[4];
- float far_near[2];
- bool use_premul_alpha = false;
-
- ShaderParameters()
- {
- copy_v4_fl(shuffle, 1.0f);
- copy_v2_fl2(far_near, 100.0f, 0.0f);
- }
-};
-
-/**
- * Space accessor.
- *
- * Image engine is used to draw the images inside multiple spaces \see SpaceLink.
- * The AbstractSpaceAccessor is an interface to communicate with a space.
- */
-class AbstractSpaceAccessor {
- public:
- virtual ~AbstractSpaceAccessor() = default;
-
- /**
- * Return the active image of the space.
- *
- * The returned image will be drawn in the space.
- *
- * The return value is optional.
- */
- virtual Image *get_image(Main *bmain) = 0;
-
- /**
- * Return the #ImageUser of the space.
- *
- * The return value is optional.
- */
- virtual ImageUser *get_image_user() = 0;
-
- /**
- * Acquire the image buffer of the image.
- *
- * \param image: Image to get the buffer from. Image is the same as returned from the #get_image
- * member.
- * \param lock: pointer to a lock object.
- * \return Image buffer of the given image.
- */
- virtual ImBuf *acquire_image_buffer(Image *image, void **lock) = 0;
-
- /**
- * Release a previous locked image from #acquire_image_buffer.
- */
- virtual void release_buffer(Image *image, ImBuf *image_buffer, void *lock) = 0;
-
- /**
- * Update the r_shader_parameters with space specific settings.
- *
- * Only update the #ShaderParameters.flags and #ShaderParameters.shuffle. Other parameters
- * are updated inside the image engine.
- */
- virtual void get_shader_parameters(ShaderParameters &r_shader_parameters,
- ImBuf *image_buffer,
- bool is_tiled) = 0;
-
- /**
- * Retrieve the gpu textures to draw.
- */
- virtual void get_gpu_textures(Image *image,
- ImageUser *iuser,
- ImBuf *image_buffer,
- GPUTexture **r_gpu_texture,
- bool *r_owns_texture,
- GPUTexture **r_tex_tile_data) = 0;
-
- /**
- * Does this space override the view.
- * When so this member should return true and the create_view_override must return the view to
- * use during drawing.
- */
- virtual bool has_view_override() const = 0;
-
- /**
- * Override the view for drawing.
- * Should match #has_view_override.
- */
- virtual DRWView *create_view_override(const ARegion *UNUSED(region)) = 0;
-
- /**
- * Initialize the matrix that will be used to draw the image. The matrix will be send as object
- * matrix to the drawing pipeline.
- */
- virtual void get_image_mat(const ImBuf *image_buffer,
- const ARegion *region,
- float r_mat[4][4]) const = 0;
-}; // namespace blender::draw::image_engine
/**
* Abstract class for a drawing mode of the image engine.
@@ -179,11 +66,7 @@ class AbstractDrawingMode {
public:
virtual ~AbstractDrawingMode() = default;
virtual void cache_init(IMAGE_Data *vedata) const = 0;
- virtual void cache_image(AbstractSpaceAccessor *space,
- IMAGE_Data *vedata,
- Image *image,
- ImageUser *iuser,
- ImBuf *image_buffer) const = 0;
+ virtual void cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser) const = 0;
virtual void draw_scene(IMAGE_Data *vedata) const = 0;
virtual void draw_finish(IMAGE_Data *vedata) const = 0;
};