Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/extern/include/RE_bake.h
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup render | * \ingroup render | ||||
| */ | */ | ||||
| #ifndef __RE_BAKE_H__ | #ifndef __RE_BAKE_H__ | ||||
| #define __RE_BAKE_H__ | #define __RE_BAKE_H__ | ||||
| #include "DNA_object_types.h" | |||||
| struct Depsgraph; | struct Depsgraph; | ||||
| struct ImBuf; | struct ImBuf; | ||||
| struct Mesh; | struct Mesh; | ||||
| struct Render; | struct Render; | ||||
| typedef struct BakeImage { | typedef struct BakeImage { | ||||
| struct Image *image; | struct Image *image; | ||||
| int width; | int width; | ||||
| int height; | int height; | ||||
| size_t offset; | bool *mat_mask; | ||||
| int mat_mask_length; | |||||
| } BakeImage; | } 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 BakePixel { | typedef struct BakePixel { | ||||
| int primitive_id, object_id; | int primitive_id, object_id; | ||||
| float uv[2]; | float uv[2]; | ||||
| float du_dx, du_dy; | float du_dx, du_dy; | ||||
| float dv_dx, dv_dy; | float dv_dx, dv_dy; | ||||
| } BakePixel; | } BakePixel; | ||||
| typedef struct BakeHighPolyData { | typedef struct BakeHighPolyData { | ||||
| struct Object *ob; | struct Object *ob; | ||||
| struct Object *ob_eval; | struct Object *ob_eval; | ||||
| struct Mesh *me; | struct Mesh *me; | ||||
| bool is_flip_object; | bool is_flip_object; | ||||
| float obmat[4][4]; | float obmat[4][4]; | ||||
| float imat[4][4]; | float imat[4][4]; | ||||
| } BakeHighPolyData; | } BakeHighPolyData; | ||||
| typedef struct BakeResult { | |||||
| float *pixels; | |||||
| unsigned int num_pixels; | |||||
| int depth; | |||||
| bool is_color; | |||||
| bool is_normal; | |||||
| float fill_color[4]; | |||||
| char identifier[64]; | |||||
| } BakeResult; | |||||
| /* external_engine.c */ | /* external_engine.c */ | ||||
| bool RE_bake_has_engine(struct Render *re); | bool RE_bake_has_engine(struct Render *re); | ||||
| bool RE_bake_engine(struct Render *re, | bool RE_bake_engine(struct Render *re, | ||||
| struct Depsgraph *depsgraph, | struct Depsgraph *depsgraph, | ||||
| struct BakePass *bp, | |||||
| struct Object *object, | struct Object *object, | ||||
| const int object_id, | const int object_id, | ||||
| const BakePixel pixel_array[], | const BakePixel pixel_array[], | ||||
| const size_t num_pixels, | BakeResult *result); | ||||
| const int depth, | |||||
| const eScenePassType pass_type, | |||||
| const int pass_filter, | |||||
| float result[]); | |||||
| /* bake.c */ | /* bake.c */ | ||||
| int RE_pass_depth(const eScenePassType pass_type); | |||||
| bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low, | bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low, | ||||
| BakePixel pixel_array_from[], | BakePixel pixel_array_from[], | ||||
| BakePixel pixel_array_to[], | BakePixel pixel_array_to[], | ||||
| BakeHighPolyData highpoly[], | BakeHighPolyData highpoly[], | ||||
| const int tot_highpoly, | const int tot_highpoly, | ||||
| const size_t num_pixels, | const size_t num_pixels, | ||||
| const bool is_custom_cage, | const bool is_custom_cage, | ||||
| const float cage_extrusion, | const float cage_extrusion, | ||||
| float mat_low[4][4], | float mat_low[4][4], | ||||
| float mat_cage[4][4], | float mat_cage[4][4], | ||||
| struct Mesh *me_cage); | struct Mesh *me_cage); | ||||
| void RE_bake_pixels_populate(struct Mesh *me, | void RE_bake_pixels_populate(struct Mesh *me, | ||||
| struct BakePixel *pixel_array, | struct BakePixel *pixel_array, | ||||
| const size_t num_pixels, | const size_t num_pixels, | ||||
| const struct BakeImages *bake_images, | const struct BakeImage *bake_image, | ||||
| const char *uv_layer); | const char *uv_layer); | ||||
| void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask); | void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask); | ||||
| void RE_bake_margin(struct ImBuf *ibuf, char *mask, const int margin); | void RE_bake_margin(struct ImBuf *ibuf, char *mask, const int margin, bool preserve_existing); | ||||
| void RE_bake_normal_world_to_object(const BakePixel pixel_array[], | void RE_bake_normal_world_to_object(const BakePixel pixel_array[], | ||||
| const size_t num_pixels, | const size_t num_pixels, | ||||
| const int depth, | const int depth, | ||||
| float result[], | float result[], | ||||
| struct Object *ob, | struct Object *ob, | ||||
| const eBakeNormalSwizzle normal_swizzle[3]); | const eBakeNormalSwizzle normal_swizzle[3]); | ||||
| void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], | void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], | ||||
| const size_t num_pixels, | const size_t num_pixels, | ||||
| const int depth, | const int depth, | ||||
| float result[], | float result[], | ||||
| struct Mesh *me, | struct Mesh *me, | ||||
| const eBakeNormalSwizzle normal_swizzle[3], | const eBakeNormalSwizzle normal_swizzle[3], | ||||
| float mat[4][4]); | float mat[4][4]); | ||||
| void RE_bake_normal_world_to_world(const BakePixel pixel_array[], | void RE_bake_normal_world_to_world(const BakePixel pixel_array[], | ||||
| const size_t num_pixels, | const size_t num_pixels, | ||||
| const int depth, | const int depth, | ||||
| float result[], | float result[], | ||||
| const eBakeNormalSwizzle normal_swizzle[3]); | const eBakeNormalSwizzle normal_swizzle[3]); | ||||
| void RE_bake_ibuf_clear(struct Image *image, const bool is_tangent); | void RE_bake_ibuf_clear(struct Image *image, const float clear_color[3]); | ||||
| #endif /* __RE_BAKE_H__ */ | #endif /* __RE_BAKE_H__ */ | ||||