Blender V2.61 - r43446
|
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_world_types.h"
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BLI_math_geom.h"
#include "BKE_blender.h"
#include "BKE_screen.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_multires.h"
#include "BKE_report.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_modifier.h"
#include "BKE_DerivedMesh.h"
#include "BKE_subsurf.h"
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
#include "PIL_time.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "GPU_draw.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_object.h"
#include "object_intern.h"
Go to the source code of this file.
Classes | |
struct | MultiresBakerJobData |
struct | MultiresBakeJob |
struct | MultiresBakeRender |
struct | MResolvePixelData |
struct | MBakeRast |
struct | MHeightBakeData |
struct | MNormalBakeData |
struct | BakeRender |
Typedefs | |
typedef struct MultiresBakerJobData | MultiresBakerJobData |
typedef void(* | MPassKnownData )(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y) |
typedef void *(* | MInitBakeData )(MultiresBakeRender *bkr, Image *ima) |
typedef void(* | MApplyBakeData )(void *bake_data) |
typedef void(* | MFreeBakeData )(void *bake_data) |
typedef void(* | MFlushPixel )(const MResolvePixelData *data, const int x, const int y) |
typedef struct BakeRender | BakeRender |
Functions | |
static void | multiresbake_get_normal (const MResolvePixelData *data, float norm[], const int face_num, const int vert_index) |
static void | init_bake_rast (MBakeRast *bake_rast, const ImBuf *ibuf, const MResolvePixelData *data, MFlushPixel flush_pixel) |
static void | flush_pixel (const MResolvePixelData *data, const int x, const int y) |
static void | set_rast_triangle (const MBakeRast *bake_rast, const int x, const int y) |
static void | rasterize_half (const MBakeRast *bake_rast, const float s0_s, const float t0_s, const float s1_s, const float t1_s, const float s0_l, const float t0_l, const float s1_l, const float t1_l, const int y0_in, const int y1_in, const int is_mid_right) |
static void | bake_rasterize (const MBakeRast *bake_rast, const float st0_in[2], const float st1_in[2], const float st2_in[2]) |
static int | multiresbake_test_break (MultiresBakeRender *bkr) |
static void | do_multires_bake (MultiresBakeRender *bkr, Image *ima, MPassKnownData passKnownData, MInitBakeData initBakeData, MApplyBakeData applyBakeData, MFreeBakeData freeBakeData) |
static void | interp_bilinear_quad_data (float data[4][3], float u, float v, float res[3]) |
static void | interp_barycentric_tri_data (float data[3][3], float u, float v, float res[3]) |
static void | interp_bilinear_grid (DMGridData *grid, int grid_size, float crn_x, float crn_y, int mode, float res[3]) |
static void | get_ccgdm_data (DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex, const int lvl, const int face_index, const float u, const float v, float co[3], float n[3]) |
static void | interp_bilinear_mface (DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3]) |
static void | interp_barycentric_mface (DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3]) |
static void * | init_heights_data (MultiresBakeRender *bkr, Image *ima) |
static void * | init_normal_data (MultiresBakeRender *bkr, Image *UNUSED(ima)) |
static void | free_normal_data (void *bake_data) |
static void | apply_heights_data (void *bake_data) |
static void | free_heights_data (void *bake_data) |
static void | apply_heights_callback (DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float UNUSED(tangmat[3][3]), const int x, const int y) |
static void | apply_tangmat_callback (DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y) |
static void | count_images (MultiresBakeRender *bkr) |
static void | bake_images (MultiresBakeRender *bkr) |
static void | finish_images (MultiresBakeRender *bkr) |
static void | multiresbake_start (MultiresBakeRender *bkr) |
static int | multiresbake_check (bContext *C, wmOperator *op) |
static DerivedMesh * | multiresbake_create_loresdm (Scene *scene, Object *ob, int *lvl) |
static DerivedMesh * | multiresbake_create_hiresdm (Scene *scene, Object *ob, int *lvl, int *simple) |
static void | clear_images (MTFace *mtface, int totface) |
static int | multiresbake_image_exec_locked (bContext *C, wmOperator *op) |
static void | init_multiresbake_job (bContext *C, MultiresBakeJob *bkj) |
static void | multiresbake_startjob (void *bkv, short *stop, short *do_update, float *progress) |
static void | multiresbake_freejob (void *bkv) |
static int | multiresbake_image_exec (bContext *C, wmOperator *op) |
static int | thread_break (void *UNUSED(arg)) |
static int | test_bake_internal (bContext *C, ReportList *reports) |
static void | init_bake_internal (BakeRender *bkr, bContext *C) |
static void | finish_bake_internal (BakeRender *bkr) |
static void * | do_bake_render (void *bake_v) |
static void | bake_startjob (void *bkv, short *stop, short *do_update, float *progress) |
static void | bake_update (void *bkv) |
static void | bake_freejob (void *bkv) |
static int | objects_bake_render_modal (bContext *C, wmOperator *UNUSED(op), wmEvent *event) |
static int | is_multires_bake (Scene *scene) |
static int | objects_bake_render_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(_event)) |
static int | bake_image_exec (bContext *C, wmOperator *op) |
void | OBJECT_OT_bake_image (wmOperatorType *ot) |
Definition in file object_bake.c.
typedef struct BakeRender BakeRender |
typedef void(* MApplyBakeData)(void *bake_data) |
Definition at line 124 of file object_bake.c.
typedef void(* MFlushPixel)(const MResolvePixelData *data, const int x, const int y) |
Definition at line 142 of file object_bake.c.
typedef void(* MFreeBakeData)(void *bake_data) |
Definition at line 125 of file object_bake.c.
typedef void*(* MInitBakeData)(MultiresBakeRender *bkr, Image *ima) |
Definition at line 123 of file object_bake.c.
typedef void(* MPassKnownData)(DerivedMesh *lores_dm, DerivedMesh *hires_dm, const void *bake_data, const int face_index, const int lvl, const float st[2], float tangmat[3][3], const int x, const int y) |
Definition at line 119 of file object_bake.c.
typedef struct MultiresBakerJobData MultiresBakerJobData |
static void apply_heights_callback | ( | DerivedMesh * | lores_dm, |
DerivedMesh * | hires_dm, | ||
const void * | bake_data, | ||
const int | face_index, | ||
const int | lvl, | ||
const float | st[2], | ||
float | UNUSEDtangmat[3][3], | ||
const int | x, | ||
const int | y | ||
) | [static] |
Definition at line 699 of file object_bake.c.
References BKE_image_get_ibuf(), CD_MTFACE, CLAMP(), CustomData_get_layer(), dot_v3v3(), DerivedMesh::faceData, get_ccgdm_data(), DerivedMesh::getFace, MHeightBakeData::height_max, MHeightBakeData::height_min, MHeightBakeData::heights, IB_RECT_INVALID, interp_barycentric_mface(), interp_bilinear_mface(), len(), NULL, MHeightBakeData::origindex, ImBuf::rect, ImBuf::rect_float, resolve_quad_uv(), resolve_tri_uv(), MHeightBakeData::ssdm, sub_v3_v3v3(), MTFace::tpage, ImBuf::userflags, MTFace::uv, MFace::v4, and ImBuf::x.
Referenced by bake_images().
static void apply_heights_data | ( | void * | bake_data | ) | [static] |
Definition at line 646 of file object_bake.c.
References BKE_image_get_ibuf(), credits_svn_gen::e, FILTER_MASK_USED, FTOCHAR, MHeightBakeData::height_max, MHeightBakeData::height_min, MHeightBakeData::heights, i, IB_RECT_INVALID, MHeightBakeData::ima, max, min, NULL, ImBuf::rect, ImBuf::rect_float, ImBuf::userdata, ImBuf::userflags, ImBuf::x, and ImBuf::y.
Referenced by bake_images().
static void apply_tangmat_callback | ( | DerivedMesh * | lores_dm, |
DerivedMesh * | hires_dm, | ||
const void * | bake_data, | ||
const int | face_index, | ||
const int | lvl, | ||
const float | st[2], | ||
float | tangmat[3][3], | ||
const int | x, | ||
const int | y | ||
) | [static] |
Definition at line 766 of file object_bake.c.
References add_v3_v3(), BKE_image_get_ibuf(), CD_MTFACE, CLAMP(), CustomData_get_layer(), DerivedMesh::faceData, FTOCHAR, get_ccgdm_data(), DerivedMesh::getFace, IB_RECT_INVALID, mul_v3_fl(), mul_v3_m3v3(), normalize_v3(), NULL, MNormalBakeData::origindex, ImBuf::rect, ImBuf::rect_float, resolve_quad_uv(), resolve_tri_uv(), MTFace::tpage, ImBuf::userflags, MTFace::uv, MFace::v4, and ImBuf::x.
Referenced by bake_images().
static void bake_freejob | ( | void * | bkv | ) | [static] |
Definition at line 1396 of file object_bake.c.
References BKE_report(), finish_bake_internal(), G, MEM_freeN(), BakeRender::reports, RPT_ERROR, and BakeRender::tot.
Referenced by objects_bake_render_invoke().
static int bake_image_exec | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 1478 of file object_bake.c.
References RenderData::bake_flag, RenderData::bake_mode, BKE_report(), blender_test_break(), BLI_end_threads(), BLI_init_threads(), BLI_insert_thread(), CTX_data_main(), CTX_data_scene(), do_bake_render(), finish_bake_internal(), G, init_bake_internal(), is_multires_bake(), Scene::lay, multiresbake_image_exec_locked(), NC_SCENE, ND_RENDER_RESULT, NULL, OBACT, OPERATOR_CANCELLED, OPERATOR_FINISHED, PIL_sleep_ms(), Scene::r, R_BAKE_TO_ACTIVE, BakeRender::re, RE_Database_Baking(), RE_test_break_cb(), BakeRender::ready, BakeRender::reports, wmOperator::reports, RPT_ERROR, test_bake_internal(), thread_break(), threads, BakeRender::tot, and WM_event_add_notifier().
Referenced by OBJECT_OT_bake_image().
static void bake_images | ( | MultiresBakeRender * | bkr | ) | [static] |
Definition at line 846 of file object_bake.c.
References apply_heights_callback(), apply_heights_data(), apply_tangmat_callback(), BKE_image_get_ibuf(), LinkData::data, do_multires_bake(), ListBase::first, ID::flag, free_heights_data(), free_normal_data(), Image::id, MultiresBakeRender::image, init_heights_data(), init_normal_data(), LIB_DOIT, link(), MEM_callocN(), MultiresBakeRender::mode, LinkData::next, NULL, RE_BAKE_DISPLACEMENT, RE_BAKE_NORMALS, and ImBuf::userdata.
Referenced by multiresbake_start().
static void bake_rasterize | ( | const MBakeRast * | bake_rast, |
const float | st0_in[2], | ||
const float | st1_in[2], | ||
const float | st2_in[2] | ||
) | [static] |
Definition at line 313 of file object_bake.c.
References ceilf, MBakeRast::h, rasterize_half(), SWAP, simple_enum_gen::w, and MBakeRast::w.
Referenced by do_multires_bake().
static void bake_startjob | ( | void * | bkv, |
short * | stop, | ||
short * | do_update, | ||
float * | progress | ||
) | [static] |
Definition at line 1366 of file object_bake.c.
References BakeRender::actob, RenderData::bake_mode, BakeRender::do_update, G, Scene::lay, BakeRender::main, NULL, BakeRender::progress, Scene::r, BakeRender::re, RE_bake_shade_all_selected(), RE_Database_Baking(), RE_test_break_cb(), BakeRender::scene, BakeRender::stop, thread_break(), and BakeRender::tot.
Referenced by objects_bake_render_invoke().
static void bake_update | ( | void * | bkv | ) | [static] |
Definition at line 1385 of file object_bake.c.
References ListBase::first, SpaceImage::image, RE_bake_shade_get_image(), BakeRender::sa, SPACE_IMAGE, ScrArea::spacedata, and ScrArea::spacetype.
Referenced by objects_bake_render_invoke().
static void clear_images | ( | MTFace * | mtface, |
int | totface | ||
) | [static] |
Definition at line 1032 of file object_bake.c.
References BKE_image_get_ibuf(), ID::flag, MTFace::flag, Image::id, IMB_rectfill(), LIB_DOIT, NULL, ImBuf::planes, R_IMF_PLANES_RGBA, and MTFace::tpage.
Referenced by multiresbake_image_exec_locked(), and multiresbake_startjob().
static void count_images | ( | MultiresBakeRender * | bkr | ) | [static] |
Definition at line 818 of file object_bake.c.
References BLI_addtail(), BLI_genericNodeN(), CD_MTFACE, CustomData_get_layer(), data, DerivedMesh::faceData, ListBase::first, ID::flag, MTFace::flag, DerivedMesh::getNumFaces, Image::id, MultiresBakeRender::image, ListBase::last, LIB_DOIT, MultiresBakeRender::lores_dm, NULL, MultiresBakeRender::tot_image, and MTFace::tpage.
Referenced by multiresbake_start().
static void* do_bake_render | ( | void * | bake_v | ) | [static] |
Definition at line 1356 of file object_bake.c.
References BakeRender::actob, RenderData::bake_mode, NULL, BakeRender::progress, Scene::r, BakeRender::re, RE_bake_shade_all_selected(), BakeRender::ready, BakeRender::scene, and BakeRender::tot.
Referenced by bake_image_exec().
static void do_multires_bake | ( | MultiresBakeRender * | bkr, |
Image * | ima, | ||
MPassKnownData | passKnownData, | ||
MInitBakeData | initBakeData, | ||
MApplyBakeData | applyBakeData, | ||
MFreeBakeData | freeBakeData | ||
) | [static] |
Definition at line 364 of file object_bake.c.
References MResolvePixelData::bake_data, bake_rasterize(), MultiresBakeRender::baked_faces, MultiresBakeRender::baked_objects, BKE_image_get_ibuf(), CD_MTFACE, CD_NORMAL, CD_TANGENT, CustomData_get_layer_index(), data, DM_add_tangent_layer(), DM_get_face_data_layer(), MultiresBakeRender::do_update, MResolvePixelData::face_index, DerivedMesh::faceData, flush_pixel(), DerivedMesh::getFaceArray, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, DerivedMesh::getVertArray, MResolvePixelData::h, MultiresBakeRender::hires_dm, MResolvePixelData::hires_dm, MResolvePixelData::i0, MResolvePixelData::i1, MResolvePixelData::i2, init_bake_rast(), MResolvePixelData::lores_dm, MultiresBakeRender::lores_dm, MResolvePixelData::lvl, MultiresBakeRender::lvl, MResolvePixelData::mface, MResolvePixelData::mtface, multiresbake_test_break(), MResolvePixelData::mvert, NULL, MResolvePixelData::pass_data, MResolvePixelData::precomputed_normals, MultiresBakeRender::progress, MResolvePixelData::pvtangent, MultiresBakeRender::tot_obj, MTFace::tpage, MTFace::uv, MFace::v4, MResolvePixelData::w, ImBuf::x, and ImBuf::y.
Referenced by bake_images().
static void finish_bake_internal | ( | BakeRender * | bkr | ) | [static] |
Definition at line 1320 of file object_bake.c.
References BakeRender::actob, RenderData::bake_mode, BKE_image_get_ibuf(), G, GPU_free_image(), IB_BITMAPDIRTY, Image::id, IMA_OK_LOADED, imb_freemipmapImBuf(), MEM_freeN(), RenderData::mode, World::mode, ID::next, NULL, Image::ok, BakeRender::prev_r_raytrace, BakeRender::prev_wo_amb_occ, Scene::r, R_RAYTRACE, BakeRender::re, RE_BAKE_AO, RE_Database_Free(), BakeRender::scene, BakeRender::tot, ImBuf::userdata, ImBuf::userflags, WO_AMB_OCC, and Scene::world.
Referenced by bake_freejob(), and bake_image_exec().
static void finish_images | ( | MultiresBakeRender * | bkr | ) | [static] |
Definition at line 872 of file object_bake.c.
References MultiresBakeRender::bake_filter, BKE_image_get_ibuf(), LinkData::data, ListBase::first, IB_BITMAPDIRTY, IB_MIPMAP_INVALID, IB_RECT_INVALID, MultiresBakeRender::image, imb_freemipmapImBuf(), link(), MEM_freeN(), LinkData::next, NULL, and RE_bake_ibuf_filter().
Referenced by multiresbake_start().
static void flush_pixel | ( | const MResolvePixelData * | data, |
const int | x, | ||
const int | y | ||
) | [static] |
Definition at line 209 of file object_bake.c.
References MResolvePixelData::bake_data, cross_v3_v3v3(), MResolvePixelData::face_index, MResolvePixelData::h, MResolvePixelData::hires_dm, MResolvePixelData::i0, MResolvePixelData::i1, MResolvePixelData::i2, invert_m3_m3(), MResolvePixelData::lores_dm, MResolvePixelData::lvl, MResolvePixelData::mtface, mul_v3_fl(), multiresbake_get_normal(), MResolvePixelData::pass_data, MResolvePixelData::pvtangent, resolve_tri_uv(), TNT::sign(), MTFace::uv, simple_enum_gen::w, and MResolvePixelData::w.
Referenced by do_multires_bake(), init_bake_rast(), and set_rast_triangle().
static void free_heights_data | ( | void * | bake_data | ) | [static] |
Definition at line 682 of file object_bake.c.
References MHeightBakeData::heights, MEM_freeN(), DerivedMesh::release, and MHeightBakeData::ssdm.
Referenced by bake_images().
static void free_normal_data | ( | void * | bake_data | ) | [static] |
static void get_ccgdm_data | ( | DerivedMesh * | lodm, |
DerivedMesh * | hidm, | ||
const int * | origindex, | ||
const int | lvl, | ||
const int | face_index, | ||
const float | u, | ||
const float | v, | ||
float | co[3], | ||
float | n[3] | ||
) | [static] |
Definition at line 509 of file object_bake.c.
References CLAMP(), DerivedMesh::getFace, DerivedMesh::getGridData, DerivedMesh::getGridOffset, DerivedMesh::getGridSize, interp_bilinear_grid(), mdisp_rot_face_to_crn(), NULL, and MFace::v4.
Referenced by apply_heights_callback(), and apply_tangmat_callback().
static void init_bake_internal | ( | BakeRender * | bkr, |
bContext * | C | ||
) | [static] |
Definition at line 1296 of file object_bake.c.
References BakeRender::actob, RenderData::bake_flag, RenderData::bake_mode, BKE_screen_find_big_area(), CTX_data_main(), CTX_data_scene(), CTX_wm_screen(), ED_object_exit_editmode(), BakeRender::main, RenderData::mode, World::mode, NULL, OBACT, BakeRender::prev_r_raytrace, BakeRender::prev_wo_amb_occ, Scene::r, R_BAKE_TO_ACTIVE, R_RAYTRACE, BakeRender::re, RE_BAKE_AO, RE_NewRender(), BakeRender::sa, BakeRender::scene, SPACE_IMAGE, WO_AMB_OCC, and Scene::world.
Referenced by bake_image_exec(), and objects_bake_render_invoke().
static void init_bake_rast | ( | MBakeRast * | bake_rast, |
const ImBuf * | ibuf, | ||
const MResolvePixelData * | data, | ||
MFlushPixel | flush_pixel | ||
) | [static] |
Definition at line 198 of file object_bake.c.
References data, MBakeRast::data, flush_pixel(), MBakeRast::flush_pixel, MBakeRast::h, MBakeRast::texels, ImBuf::userdata, MBakeRast::w, ImBuf::x, and ImBuf::y.
Referenced by do_multires_bake().
static void* init_heights_data | ( | MultiresBakeRender * | bkr, |
Image * | ima | ||
) | [static] |
Definition at line 594 of file object_bake.c.
References BKE_image_get_ibuf(), CD_ORIGINDEX, CLAMP(), eSubsurfModifierFlag_SubsurfUv, SubsurfModifierData::flags, FLT_MAX, DerivedMesh::getFaceDataArray, MHeightBakeData::height_max, MHeightBakeData::height_min, MHeightBakeData::heights, MHeightBakeData::ima, SubsurfModifierData::levels, MultiresBakeRender::lores_dm, MultiresBakeRender::lvl, ME_SIMPLE_SUBSURF, MEM_callocN(), NULL, MHeightBakeData::origindex, SubsurfModifierData::renderLevels, MultiresBakeRender::simple, MHeightBakeData::ssdm, SubsurfModifierData::subdivType, subsurf_make_derived_from_derived(), MultiresBakeRender::tot_lvl, MultiresBakeRender::use_lores_mesh, ImBuf::x, and ImBuf::y.
Referenced by bake_images().
static void init_multiresbake_job | ( | bContext * | C, |
MultiresBakeJob * | bkj | ||
) | [static] |
Definition at line 1115 of file object_bake.c.
References MultiresBakeJob::bake_clear, RenderData::bake_filter, MultiresBakeJob::bake_filter, RenderData::bake_flag, RenderData::bake_mode, BLI_addtail(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_scene(), MultiresBakeJob::data, data, MultiresBakerJobData::hires_dm, MultiresBakerJobData::lores_dm, MultiresBakerJobData::lvl, MEM_callocN(), MultiresBakeJob::mode, multires_force_update(), multiresbake_create_hiresdm(), multiresbake_create_loresdm(), Scene::r, R_BAKE_CLEAR, R_BAKE_LORES_MESH, MultiresBakerJobData::simple, MultiresBakerJobData::tot_lvl, and MultiresBakeJob::use_lores_mesh.
Referenced by multiresbake_image_exec().
static void* init_normal_data | ( | MultiresBakeRender * | bkr, |
Image * | UNUSEDima | ||
) | [static] |
Definition at line 627 of file object_bake.c.
References CD_ORIGINDEX, DerivedMesh::getFaceDataArray, MultiresBakeRender::lores_dm, MEM_callocN(), and MNormalBakeData::origindex.
Referenced by bake_images().
static void interp_barycentric_mface | ( | DerivedMesh * | dm, |
MFace * | mface, | ||
const float | u, | ||
const float | v, | ||
const int | mode, | ||
float | res[3] | ||
) | [static] |
Definition at line 577 of file object_bake.c.
References data, DerivedMesh::getVertCo, DerivedMesh::getVertNo, interp_barycentric_tri_data(), MFace::v1, MFace::v2, and MFace::v3.
Referenced by apply_heights_callback().
static void interp_barycentric_tri_data | ( | float | data[3][3], |
float | u, | ||
float | v, | ||
float | res[3] | ||
) | [static] |
Definition at line 465 of file object_bake.c.
References add_v3_v3(), copy_v3_v3(), and mul_v3_fl().
Referenced by interp_barycentric_mface().
static void interp_bilinear_grid | ( | DMGridData * | grid, |
int | grid_size, | ||
float | crn_x, | ||
float | crn_y, | ||
int | mode, | ||
float | res[3] | ||
) | [static] |
Definition at line 479 of file object_bake.c.
References co, copy_v3_v3(), data, and interp_bilinear_quad_data().
Referenced by get_ccgdm_data().
static void interp_bilinear_mface | ( | DerivedMesh * | dm, |
MFace * | mface, | ||
const float | u, | ||
const float | v, | ||
const int | mode, | ||
float | res[3] | ||
) | [static] |
Definition at line 556 of file object_bake.c.
References data, DerivedMesh::getVertCo, DerivedMesh::getVertNo, interp_bilinear_quad_data(), MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by apply_heights_callback().
static void interp_bilinear_quad_data | ( | float | data[4][3], |
float | u, | ||
float | v, | ||
float | res[3] | ||
) | [static] |
Definition at line 451 of file object_bake.c.
References add_v3_v3(), copy_v3_v3(), and mul_v3_fl().
Referenced by interp_bilinear_grid(), and interp_bilinear_mface().
static int is_multires_bake | ( | Scene * | scene | ) | [static] |
Definition at line 1422 of file object_bake.c.
References RenderData::bake_flag, RenderData::bake_mode, ELEM, Scene::r, R_BAKE_MULTIRES, RE_BAKE_DISPLACEMENT, and RE_BAKE_NORMALS.
Referenced by bake_image_exec(), and objects_bake_render_invoke().
static int multiresbake_check | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 909 of file object_bake.c.
References BKE_image_get_ibuf(), BKE_report(), ImBuf::channels, CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_scene(), Object::data, eModifierMode_Realtime, get_multires_modifier(), MultiresModifierData::modifier, modifier_isEnabled(), Mesh::mtface, ModifierData::next, NULL, OB_MESH, ImBuf::rect, ImBuf::rect_float, wmOperator::reports, RPT_ERROR, Mesh::totface, MultiresModifierData::totlvl, MTFace::tpage, and Object::type.
Referenced by multiresbake_image_exec(), and multiresbake_image_exec_locked().
static DerivedMesh* multiresbake_create_hiresdm | ( | Scene * | scene, |
Object * | ob, | ||
int * | lvl, | ||
int * | simple | ||
) | [static] |
Definition at line 1013 of file object_bake.c.
References CDDM_from_mesh(), Object::data, get_multires_modifier(), MultiresModifierData::lvl, multires_dm_create_from_derived(), DerivedMesh::release, and MultiresModifierData::sculptlvl.
Referenced by init_multiresbake_job(), and multiresbake_image_exec_locked().
static DerivedMesh* multiresbake_create_loresdm | ( | Scene * | scene, |
Object * | ob, | ||
int * | lvl | ||
) | [static] |
Definition at line 991 of file object_bake.c.
References CDDM_from_mesh(), Object::data, get_multires_modifier(), MultiresModifierData::lvl, multires_dm_create_from_derived(), NULL, and DerivedMesh::release.
Referenced by init_multiresbake_job(), and multiresbake_image_exec_locked().
static void multiresbake_freejob | ( | void * | bkv | ) | [static] |
Definition at line 1196 of file object_bake.c.
References MultiresBakeJob::data, data, ListBase::first, MultiresBakerJobData::hires_dm, MultiresBakerJobData::lores_dm, MEM_freeN(), MultiresBakerJobData::next, next, and DerivedMesh::release.
Referenced by multiresbake_image_exec().
static void multiresbake_get_normal | ( | const MResolvePixelData * | data, |
float | norm[], | ||
const int | face_num, | ||
const int | vert_index | ||
) | [static] |
Definition at line 163 of file object_bake.c.
References MVert::co, copy_v3_v3(), MFace::flag, indices, ME_SMOOTH, MResolvePixelData::mface, MResolvePixelData::mvert, MVert::no, normal_quad_v3(), normal_short_to_float_v3(), normal_tri_v3(), normalize_v3(), MResolvePixelData::precomputed_normals, MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
Referenced by flush_pixel().
static int multiresbake_image_exec | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 1213 of file object_bake.c.
References BKE_report(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), MultiresBakeJob::data, ListBase::first, G, init_multiresbake_job(), MEM_callocN(), multiresbake_check(), multiresbake_freejob(), multiresbake_startjob(), NC_IMAGE, NULL, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, wmOperator::reports, RPT_ERROR, WM_cursor_wait(), WM_event_add_modal_handler(), WM_JOB_EXCL_RENDER, WM_JOB_PRIORITY, WM_JOB_PROGRESS, WM_jobs_callbacks(), WM_jobs_customdata(), WM_jobs_get(), WM_jobs_start(), and WM_jobs_timer().
Referenced by objects_bake_render_invoke().
static int multiresbake_image_exec_locked | ( | bContext * | C, |
wmOperator * | op | ||
) | [static] |
Definition at line 1056 of file object_bake.c.
References RenderData::bake_filter, MultiresBakeRender::bake_filter, RenderData::bake_flag, RenderData::bake_mode, BKE_report(), BLI_freelistN(), clear_images(), CTX_DATA_BEGIN, CTX_DATA_END, CTX_data_scene(), Object::data, MultiresBakeRender::hires_dm, MultiresBakeRender::image, MultiresBakeRender::lores_dm, MultiresBakeRender::lvl, MultiresBakeRender::mode, Mesh::mtface, multires_force_update(), multiresbake_check(), multiresbake_create_hiresdm(), multiresbake_create_loresdm(), multiresbake_start(), OPERATOR_CANCELLED, OPERATOR_FINISHED, Scene::r, R_BAKE_CLEAR, R_BAKE_LORES_MESH, DerivedMesh::release, wmOperator::reports, RPT_ERROR, MultiresBakeRender::simple, MultiresBakeRender::tot_lvl, Mesh::totface, and MultiresBakeRender::use_lores_mesh.
Referenced by bake_image_exec().
static void multiresbake_start | ( | MultiresBakeRender * | bkr | ) | [static] |
Definition at line 902 of file object_bake.c.
References bake_images(), count_images(), and finish_images().
Referenced by multiresbake_image_exec_locked(), and multiresbake_startjob().
static void multiresbake_startjob | ( | void * | bkv, |
short * | stop, | ||
short * | do_update, | ||
float * | progress | ||
) | [static] |
Definition at line 1148 of file object_bake.c.
References MultiresBakeJob::bake_clear, MultiresBakeJob::bake_filter, MultiresBakeRender::bake_filter, MultiresBakeRender::baked_objects, BLI_countlist(), BLI_freelistN(), CD_MTFACE, clear_images(), CustomData_get_layer(), MultiresBakeJob::data, data, MultiresBakeRender::do_update, DerivedMesh::faceData, ListBase::first, DerivedMesh::getNumFaces, MultiresBakerJobData::hires_dm, MultiresBakeRender::hires_dm, MultiresBakeRender::image, MultiresBakeRender::lores_dm, MultiresBakerJobData::lores_dm, MultiresBakerJobData::lvl, MultiresBakeRender::lvl, MultiresBakeJob::mode, MultiresBakeRender::mode, multiresbake_start(), MultiresBakerJobData::next, MultiresBakeRender::progress, MultiresBakerJobData::simple, MultiresBakeRender::simple, MultiresBakeRender::stop, MultiresBakerJobData::tot_lvl, MultiresBakeRender::tot_lvl, MultiresBakeRender::tot_obj, MultiresBakeJob::use_lores_mesh, and MultiresBakeRender::use_lores_mesh.
Referenced by multiresbake_image_exec().
static int multiresbake_test_break | ( | MultiresBakeRender * | bkr | ) | [static] |
Definition at line 354 of file object_bake.c.
References G, and MultiresBakeRender::stop.
Referenced by do_multires_bake().
void OBJECT_OT_bake_image | ( | wmOperatorType * | ot | ) |
Definition at line 1531 of file object_bake.c.
References bake_image_exec(), wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, objects_bake_render_invoke(), and objects_bake_render_modal().
Referenced by ED_operatortypes_object().
static int objects_bake_render_invoke | ( | bContext * | C, |
wmOperator * | op, | ||
wmEvent * | UNUSED_event | ||
) | [static] |
Definition at line 1430 of file object_bake.c.
References bake_freejob(), bake_startjob(), bake_update(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), G, init_bake_internal(), is_multires_bake(), MEM_callocN(), multiresbake_image_exec(), NC_IMAGE, NC_SCENE, ND_RENDER_RESULT, NULL, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, BakeRender::reports, wmOperator::reports, test_bake_internal(), WM_cursor_wait(), WM_event_add_modal_handler(), WM_event_add_notifier(), WM_JOB_EXCL_RENDER, WM_JOB_PRIORITY, WM_JOB_PROGRESS, WM_jobs_callbacks(), WM_jobs_customdata(), WM_jobs_get(), WM_jobs_start(), WM_jobs_test(), and WM_jobs_timer().
Referenced by OBJECT_OT_bake_image().
static int objects_bake_render_modal | ( | bContext * | C, |
wmOperator * | UNUSEDop, | ||
wmEvent * | event | ||
) | [static] |
Definition at line 1407 of file object_bake.c.
References CTX_data_scene(), CTX_wm_manager(), ESCKEY, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, OPERATOR_RUNNING_MODAL, wmEvent::type, and WM_jobs_test().
Referenced by OBJECT_OT_bake_image().
static void rasterize_half | ( | const MBakeRast * | bake_rast, |
const float | s0_s, | ||
const float | t0_s, | ||
const float | s1_s, | ||
const float | t1_s, | ||
const float | s0_l, | ||
const float | t0_l, | ||
const float | s1_l, | ||
const float | t1_l, | ||
const int | y0_in, | ||
const int | y1_in, | ||
const int | is_mid_right | ||
) | [static] |
Definition at line 274 of file object_bake.c.
References ceilf, fabsf, MBakeRast::h, set_rast_triangle(), SWAP, simple_enum_gen::w, and MBakeRast::w.
Referenced by bake_rasterize().
static void set_rast_triangle | ( | const MBakeRast * | bake_rast, |
const int | x, | ||
const int | y | ||
) | [static] |
Definition at line 261 of file object_bake.c.
References MBakeRast::data, FILTER_MASK_USED, flush_pixel(), MBakeRast::h, MBakeRast::texels, simple_enum_gen::w, and MBakeRast::w.
Referenced by rasterize_half().
static int test_bake_internal | ( | bContext * | C, |
ReportList * | reports | ||
) | [static] |
Definition at line 1279 of file object_bake.c.
References RenderData::bake_flag, RenderData::bake_mode, BKE_report(), CTX_data_active_object(), CTX_data_scene(), NULL, Scene::r, R_BAKE_TO_ACTIVE, RE_BAKE_AO, RPT_ERROR, and Scene::world.
Referenced by bake_image_exec(), and objects_bake_render_invoke().
static int thread_break | ( | void * | UNUSEDarg | ) | [static] |
Definition at line 1250 of file object_bake.c.
References G.
Referenced by bake_image_exec(), and bake_startjob().