diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-12-23 18:39:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-12-24 14:00:58 +0300 |
commit | 0b4fae7a51fb869c27d9407b8b5eadeb418d0bfc (patch) | |
tree | dfcaaa1048f91bbe766a8314325ea97c8493b534 /source/blender/render/RE_bake.h | |
parent | 58c697a9ecebdebfec2c50de49946908bd444070 (diff) |
Cleanup: refactoring of bake code in preparation of vertex color baking
Split of internal/external image bake target code off into smaller functions and
refactor associated data structures for clarity. Designed so that a vertex color
bake target is easy to fit in.
Also avoid passing in a huge number of arguments into the main baking function,
pass a struct instead.
Diffstat (limited to 'source/blender/render/RE_bake.h')
-rw-r--r-- | source/blender/render/RE_bake.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/render/RE_bake.h b/source/blender/render/RE_bake.h index 3ed41ede006..3463362adb1 100644 --- a/source/blender/render/RE_bake.h +++ b/source/blender/render/RE_bake.h @@ -39,11 +39,23 @@ typedef struct BakeImage { size_t offset; } BakeImage; -typedef struct BakeImages { - BakeImage *data; /* all the images of an object */ - int *lookup; /* lookup table from Material to BakeImage */ - int size; -} BakeImages; +typedef struct BakeTargets { + /* All images of the object. */ + BakeImage *images; + int num_images; + + /* Lookup table from Material number to BakeImage. */ + int *material_to_image; + int num_materials; + + /* Pixel buffer to bake to. */ + float *result; + int num_pixels; + int num_channels; + + /* Baking to non-color data image. */ + bool is_noncolor; +} BakeTargets; typedef struct BakePixel { int primitive_id, object_id; @@ -70,8 +82,7 @@ bool RE_bake_engine(struct Render *re, struct Object *object, const int object_id, const BakePixel pixel_array[], - const BakeImages *bake_images, - const int depth, + const BakeTargets *targets, const eScenePassType pass_type, const int pass_filter, float result[]); @@ -95,7 +106,7 @@ bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low, void RE_bake_pixels_populate(struct Mesh *me, struct BakePixel *pixel_array, const size_t num_pixels, - const struct BakeImages *bake_images, + const struct BakeTargets *targets, const char *uv_layer); void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask); |