Blender
V5.3
intern
cycles
scene
image_loader.h
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2011-2026 Blender Foundation
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#pragma once
6
7
#include <atomic>
8
9
#include "
util/param.h
"
10
#include "
util/string.h
"
11
#include "
util/types_image.h
"
12
13
CCL_NAMESPACE_BEGIN
14
15
class
Progress
;
16
class
ImageMetaData
;
17
18
/* Parameters for image loading. */
19
struct
ImageLoaderParams
{
20
bool
use_texture_cache
=
true
;
21
bool
auto_texture_cache
=
true
;
22
string
texture_cache_path
;
23
ustring
colorspace
;
24
ImageAlphaType
alpha_type
;
25
26
/* Error reporting. */
27
std::atomic<int> &
load_failure_num
;
28
std::atomic<int> &
tx_failure_num
;
29
};
30
31
/* Image loader base class, that can be subclassed to load image data
32
* from custom sources (file, memory, procedurally generated, etc). */
33
class
ImageLoader
{
34
public
:
35
ImageLoader
();
36
virtual
~ImageLoader
() =
default
;
37
38
/* Load metadata without actual image yet, should be fast. */
39
virtual
bool
load_metadata
(
ImageMetaData
&metadata,
40
const
ImageLoaderParams
¶ms,
41
Progress
&progress) = 0;
42
43
/* Load full image pixels.
44
* This is expected to call metadata.conform_pixels(). */
45
virtual
bool
load_pixels
(
const
ImageMetaData
&metadata,
void
*pixels) = 0;
46
47
/* Load pixels for a single tile, if ImageMetaData.tile_size is set.
48
* This is expected to call metadata.conform_pixels(). */
49
virtual
bool
load_pixels_tile
(
const
ImageMetaData
&
/*metadata*/
,
50
const
int
/*miplevel*/
,
51
const
int64_t
/*x*/
,
52
const
int64_t
/*y*/
,
53
const
int64_t
/*w*/
,
54
const
int64_t
/*h*/
,
55
const
int64_t
/*x_stride*/
,
56
const
int64_t
/*y_stride*/
,
57
const
int64_t
/*padding*/
,
58
const
ExtensionType
/*extension*/
,
59
uint8_t *
/*pixels*/
)
60
{
61
return
false
;
62
}
63
64
/* Name for logs and stats. */
65
virtual
string
name
()
const
= 0;
66
67
/* Optional for tiled textures loaded externally. */
68
virtual
int
get_tile_number
()
const
;
69
70
/* Free any memory used for loading metadata and pixels. */
71
virtual
void
cleanup
() {};
72
73
/* Compare avoid loading the same image multiple times. */
74
virtual
bool
equals
(
const
ImageLoader
&other)
const
= 0;
75
static
bool
equals
(
const
ImageLoader
*a,
const
ImageLoader
*
b
);
76
77
/* Test if this loader will load NanoVDB. */
78
virtual
bool
is_vdb_loader
()
const
;
79
};
80
81
CCL_NAMESPACE_END
int64_t
long long int int64_t
Definition
btConvexHullComputer.cpp:31
ImageLoader::~ImageLoader
virtual ~ImageLoader()=default
ImageLoader::load_pixels_tile
virtual bool load_pixels_tile(const ImageMetaData &, const int, const int64_t, const int64_t, const int64_t, const int64_t, const int64_t, const int64_t, const int64_t, const ExtensionType, uint8_t *)
Definition
image_loader.h:49
ImageLoader::cleanup
virtual void cleanup()
Definition
image_loader.h:71
ImageLoader::equals
virtual bool equals(const ImageLoader &other) const =0
ImageLoader::ImageLoader
ImageLoader()
ImageLoader::load_pixels
virtual bool load_pixels(const ImageMetaData &metadata, void *pixels)=0
ImageLoader::load_metadata
virtual bool load_metadata(ImageMetaData &metadata, const ImageLoaderParams ¶ms, Progress &progress)=0
ImageLoader::get_tile_number
virtual int get_tile_number() const
Definition
image_loader.cpp:13
ImageLoader::name
virtual string name() const =0
ImageLoader::is_vdb_loader
virtual bool is_vdb_loader() const
Definition
image_loader.cpp:26
ImageMetaData
Definition
image_metadata.h:24
Progress
Definition
progress.h:21
b
b
Definition
compositor_morphological_distance_infos.hh:36
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
CCL_NAMESPACE_BEGIN
Definition
python.cpp:41
colorspace
Definition
eevee_colorspace_lib.bsl.hh:9
param.h
string.h
ImageLoaderParams
Definition
image_loader.h:19
ImageLoaderParams::use_texture_cache
bool use_texture_cache
Definition
image_loader.h:20
ImageLoaderParams::texture_cache_path
string texture_cache_path
Definition
image_loader.h:22
ImageLoaderParams::auto_texture_cache
bool auto_texture_cache
Definition
image_loader.h:21
ImageLoaderParams::tx_failure_num
std::atomic< int > & tx_failure_num
Definition
image_loader.h:28
ImageLoaderParams::load_failure_num
std::atomic< int > & load_failure_num
Definition
image_loader.h:27
ImageLoaderParams::alpha_type
ImageAlphaType alpha_type
Definition
image_loader.h:24
types_image.h
ImageAlphaType
ImageAlphaType
Definition
types_image.h:61
ExtensionType
ExtensionType
Definition
types_image.h:80
Generated on
for Blender by
doxygen
1.18.0