Blender V2.61 - r43446
Defines | Functions | Variables

multires.c File Reference

#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_pbvh.h"
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
#include "BKE_object.h"
#include "CCGSubSurf.h"
#include <math.h>
#include <string.h>

Go to the source code of this file.

Defines

#define DNA_DEPRECATED_ALLOW

Functions

static void multires_mvert_to_ss (DerivedMesh *dm, MVert *mvert)
static void multiresModifier_disp_run (DerivedMesh *dm, Mesh *me, int invert, int add, DMGridData **oldGridData, int totlvl)
DerivedMeshget_multires_dm (Scene *scene, MultiresModifierData *mmd, Object *ob)
MultiresModifierDatafind_multires_modifier_before (Scene *scene, ModifierData *lastmd)
MultiresModifierDataget_multires_modifier (Scene *scene, Object *ob, int use_first)
static int multires_get_level (Object *ob, MultiresModifierData *mmd, int render)
static void multires_set_tot_level (Object *ob, MultiresModifierData *mmd, int lvl)
static void multires_dm_mark_as_modified (DerivedMesh *dm)
void multires_mark_as_modified (Object *ob)
void multires_force_update (Object *ob)
void multires_force_external_reload (Object *ob)
void multires_force_render_update (Object *ob)
int multiresModifier_reshapeFromDM (Scene *scene, MultiresModifierData *mmd, Object *ob, DerivedMesh *srcdm)
int multiresModifier_reshape (Scene *scene, MultiresModifierData *mmd, Object *dst, Object *src)
int multiresModifier_reshapeFromDeformMod (Scene *scene, MultiresModifierData *mmd, Object *ob, ModifierData *md)
static int get_levels_from_disps (Object *ob)
void multiresModifier_set_levels_from_disps (MultiresModifierData *mmd, Object *ob)
static void multires_set_tot_mdisps (Mesh *me, int lvl)
static void multires_reallocate_mdisps (Mesh *me, MDisps *mdisps, int lvl)
static void column_vectors_to_mat3 (float mat[][3], float v1[3], float v2[3], float v3[3])
static void multires_copy_grid (float(*gridA)[3], float(*gridB)[3], int sizeA, int sizeB)
static void multires_copy_dm_grid (DMGridData *gridA, DMGridData *gridB, int sizeA, int sizeB)
static void multires_del_higher (MultiresModifierData *mmd, Object *ob, int lvl)
void multiresModifier_del_levels (MultiresModifierData *mmd, Object *ob, int direction)
static DerivedMeshmultires_dm_create_local (Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple)
static DerivedMeshsubsurf_dm_create_local (Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv)
static float v3_dist_from_plane (float v[3], float center[3], float no[3])
void multiresModifier_base_apply (MultiresModifierData *mmd, Object *ob)
static void multires_subdivide (MultiresModifierData *mmd, Object *ob, int totlvl, int updateblock, int simple)
void multiresModifier_subdivide (MultiresModifierData *mmd, Object *ob, int updateblock, int simple)
static void grid_tangent (int gridSize, int index, int x, int y, int axis, DMGridData **gridData, float t[3])
static void multiresModifier_update (DerivedMesh *dm)
void multires_stitch_grids (Object *ob)
DerivedMeshmultires_dm_create_from_derived (MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob, int useRenderParams, int UNUSED(isFinalCalc))
void old_mdisps_bilinear (float out[3], float(*disps)[3], const int st, float u, float v)
static void old_mdisps_rotate (int S, int UNUSED(newside), int oldside, int x, int y, float *u, float *v)
static void old_mdisps_convert (MFace *mface, MDisps *mdisp)
void multires_load_old_250 (Mesh *me)
static void multires_free_level (MultiresLevel *lvl)
void multires_free (Multires *mr)
static void create_old_vert_face_map (ListBase **map, IndexNode **mem, const MultiresFace *mface, const int totvert, const int totface)
static void create_old_vert_edge_map (ListBase **map, IndexNode **mem, const MultiresEdge *medge, const int totvert, const int totedge)
static MultiresFacefind_old_face (ListBase *map, MultiresFace *faces, int v1, int v2, int v3, int v4)
static MultiresEdgefind_old_edge (ListBase *map, MultiresEdge *edges, int v1, int v2)
static void multires_load_old_edges (ListBase **emap, MultiresLevel *lvl, int *vvmap, int dst, int v1, int v2, int mov)
static void multires_load_old_faces (ListBase **fmap, ListBase **emap, MultiresLevel *lvl, int *vvmap, int dst, int v1, int v2, int v3, int v4, int st2, int st3)
static void multires_load_old_dm (DerivedMesh *dm, Mesh *me, int totlvl)
static void multires_load_old_vcols (Mesh *me)
static void multires_load_old_face_flags (Mesh *me)
void multires_load_old (Object *ob, Mesh *me)
static void multires_sync_levels (Scene *scene, Object *ob, Object *to_ob)
static void multires_apply_smat (Scene *scene, Object *ob, float smat[3][3])
int multires_mdisp_corners (MDisps *s)
void multiresModifier_scale_disp (Scene *scene, Object *ob)
void multiresModifier_prepare_join (Scene *scene, Object *ob, Object *to_ob)
void multires_topology_changed (Scene *scene, Object *ob)
void multires_mdisp_smooth_bounds (MDisps *disps)
static void mdisp_get_crn_rect (int face_side, float crn[3][4][2])
static int mdisp_pt_in_crn (float p[2], float crn[4][2])
static void face_to_crn_interp (float u, float v, float v1[2], float v2[2], float v3[2], float v4[2], float *x)
void mdisp_rot_crn_to_face (const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v)
int mdisp_rot_face_to_crn (const int corners, const int face_side, const float u, const float v, float *x, float *y)
int mdisp_rot_face_to_quad_crn (const int corners, const int face_side, const float u, const float v, float *x, float *y)
void mdisp_apply_weight (const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r)
void mdisp_flip_disp (const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3])
void mdisp_join_tris (MDisps *dst, MDisps *tri1, MDisps *tri2)

Variables

static const int multires_max_levels = 13
static const int multires_grid_tot [] = {0, 4, 9, 25, 81, 289, 1089, 4225, 16641, 66049, 263169, 1050625, 4198401, 16785409}
static const int multires_side_tot [] = {0, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097}

Detailed Description

Definition in file multires.c.


Define Documentation

#define DNA_DEPRECATED_ALLOW

Definition at line 36 of file multires.c.


Function Documentation

static void column_vectors_to_mat3 ( float  mat[][3],
float  v1[3],
float  v2[3],
float  v3[3] 
) [static]

Definition at line 337 of file multires.c.

References copy_v3_v3().

Referenced by multires_apply_smat(), and multiresModifier_disp_run().

static void create_old_vert_edge_map ( ListBase **  map,
IndexNode **  mem,
const MultiresEdge medge,
const int  totvert,
const int  totedge 
) [static]

Definition at line 1129 of file multires.c.

References BLI_addtail(), i, IndexNode::index, MEM_callocN(), and NULL.

Referenced by multires_load_old_dm().

static void create_old_vert_face_map ( ListBase **  map,
IndexNode **  mem,
const MultiresFace mface,
const int  totvert,
const int  totface 
) [static]

Definition at line 1110 of file multires.c.

References BLI_addtail(), i, IndexNode::index, MEM_callocN(), NULL, and MultiresFace::v.

Referenced by multires_load_old_dm().

static void face_to_crn_interp ( float  u,
float  v,
float  v1[2],
float  v2[2],
float  v3[2],
float  v4[2],
float *  x 
) [static]

Definition at line 1958 of file multires.c.

References simple_enum_gen::d, maxf(), and sqrtf.

Referenced by mdisp_rot_face_to_quad_crn().

MultiresModifierData* find_multires_modifier_before ( Scene scene,
ModifierData lastmd 
) [read]
static MultiresEdge* find_old_edge ( ListBase map,
MultiresEdge edges,
int  v1,
int  v2 
) [static]
static MultiresFace* find_old_face ( ListBase map,
MultiresFace faces,
int  v1,
int  v2,
int  v3,
int  v4 
) [static]

Definition at line 1148 of file multires.c.

References i, IndexNode::index, IndexNode::next, NULL, and MultiresFace::v.

Referenced by multires_load_old_faces().

static int get_levels_from_disps ( Object ob) [static]
DerivedMesh* get_multires_dm ( Scene scene,
MultiresModifierData mmd,
Object ob 
) [read]
MultiresModifierData* get_multires_modifier ( Scene scene,
Object ob,
int  use_first 
) [read]
static void grid_tangent ( int  gridSize,
int  index,
int  x,
int  y,
int  axis,
DMGridData **  gridData,
float  t[3] 
) [static]

Definition at line 688 of file multires.c.

References co, and sub_v3_v3v3().

Referenced by multires_apply_smat(), and multiresModifier_disp_run().

void mdisp_apply_weight ( const int  S,
const int  corners,
int  x,
int  y,
const int  face_side,
float  crn_weight[4][2],
float *  u_r,
float *  v_r 
)

Definition at line 2105 of file multires.c.

References mdisp_rot_crn_to_face().

Referenced by layerInterp_mdisps().

void mdisp_flip_disp ( const int  S,
const int  corners,
const float  axis_x[2],
const float  axis_y[2],
float  disp[3] 
)

Definition at line 2139 of file multires.c.

References add_v2_v2v2(), copy_v2_v2(), dot_v2v2(), len_v2(), mul_v2_v2fl(), and project_v2_v2v2().

Referenced by layerInterp_mdisps().

static void mdisp_get_crn_rect ( int  face_side,
float  crn[3][4][2] 
) [static]

Definition at line 1914 of file multires.c.

Referenced by mdisp_rot_crn_to_face(), and mdisp_rot_face_to_quad_crn().

void mdisp_join_tris ( MDisps dst,
MDisps tri1,
MDisps tri2 
)
static int mdisp_pt_in_crn ( float  p[2],
float  crn[4][2] 
) [static]

Definition at line 1938 of file multires.c.

References cross_v2v2(), and sub_v2_v2v2().

Referenced by mdisp_rot_face_to_quad_crn().

void mdisp_rot_crn_to_face ( const int  S,
const int  corners,
const int  face_side,
const float  x,
const float  y,
float *  u,
float *  v 
)

Definition at line 1977 of file multires.c.

References interp_v2_v2v2(), isect_seg_seg_v2_point(), mdisp_get_crn_rect(), and p.

Referenced by mdisp_apply_weight(), and mdisp_join_tris().

int mdisp_rot_face_to_crn ( const int  corners,
const int  face_side,
const float  u,
const float  v,
float *  x,
float *  y 
)

Definition at line 2005 of file multires.c.

References simple_enum_gen::w.

Referenced by get_ccgdm_data().

int mdisp_rot_face_to_quad_crn ( const int  corners,
const int  face_side,
const float  u,
const float  v,
float *  x,
float *  y 
)

Definition at line 2060 of file multires.c.

References face_to_crn_interp(), mdisp_get_crn_rect(), mdisp_pt_in_crn(), and p.

Referenced by layerInterp_mdisps(), and mdisp_join_tris().

static void multires_apply_smat ( Scene scene,
Object ob,
float  smat[3][3] 
) [static]
static void multires_copy_dm_grid ( DMGridData gridA,
DMGridData gridB,
int  sizeA,
int  sizeB 
) [static]

Definition at line 364 of file multires.c.

References co, and copy_v3_v3().

Referenced by multires_subdivide(), and multiresModifier_update().

static void multires_copy_grid ( float(*)  gridA[3],
float(*)  gridB[3],
int  sizeA,
int  sizeB 
) [static]

Definition at line 344 of file multires.c.

References copy_v3_v3().

Referenced by multires_del_higher().

static void multires_del_higher ( MultiresModifierData mmd,
Object ob,
int  lvl 
) [static]
DerivedMesh* multires_dm_create_from_derived ( MultiresModifierData mmd,
int  local_mmd,
DerivedMesh dm,
Object ob,
int  useRenderParams,
int   UNUSEDisFinalCalc 
)
static DerivedMesh* multires_dm_create_local ( Object ob,
DerivedMesh dm,
int  lvl,
int  totlvl,
int  simple 
) [static]
static void multires_dm_mark_as_modified ( DerivedMesh dm) [static]
void multires_force_external_reload ( Object ob)
void multires_force_render_update ( Object ob)
void multires_force_update ( Object ob)
void multires_free ( Multires mr)
static void multires_free_level ( MultiresLevel lvl) [static]

Definition at line 1073 of file multires.c.

References MultiresLevel::colfaces, MultiresLevel::edges, MultiresLevel::faces, and MEM_freeN().

Referenced by multires_free().

static int multires_get_level ( Object ob,
MultiresModifierData mmd,
int  render 
) [static]
void multires_load_old ( Object ob,
Mesh me 
)
void multires_load_old_250 ( Mesh me)
static void multires_load_old_dm ( DerivedMesh dm,
Mesh me,
int  totlvl 
) [static]
static void multires_load_old_edges ( ListBase **  emap,
MultiresLevel lvl,
int *  vvmap,
int  dst,
int  v1,
int  v2,
int  mov 
) [static]
static void multires_load_old_face_flags ( Mesh me) [static]

Definition at line 1495 of file multires.c.

References MultiresLevel::faces, MFace::flag, MultiresFace::flag, i, Mesh::mface, and Mesh::totface.

Referenced by multires_load_old().

static void multires_load_old_faces ( ListBase **  fmap,
ListBase **  emap,
MultiresLevel lvl,
int *  vvmap,
int  dst,
int  v1,
int  v2,
int  v3,
int  v4,
int  st2,
int  st3 
) [static]
static void multires_load_old_vcols ( Mesh me) [static]
void multires_mark_as_modified ( Object ob)

Definition at line 158 of file multires.c.

References Object::derivedFinal, and multires_dm_mark_as_modified().

Referenced by sculpt_flush_update(), and sculpt_undo_restore().

int multires_mdisp_corners ( MDisps s)
void multires_mdisp_smooth_bounds ( MDisps disps)

Definition at line 1786 of file multires.c.

References data, MDisps::disps, mul_v3_fl(), multires_mdisp_corners(), sqrt(), and MDisps::totdisp.

Referenced by layerInterp_mdisps().

static void multires_mvert_to_ss ( DerivedMesh dm,
MVert mvert 
) [static]
static void multires_reallocate_mdisps ( Mesh me,
MDisps mdisps,
int  lvl 
) [static]
static void multires_set_tot_level ( Object ob,
MultiresModifierData mmd,
int  lvl 
) [static]
static void multires_set_tot_mdisps ( Mesh me,
int  lvl 
) [static]
void multires_stitch_grids ( Object ob)
static void multires_subdivide ( MultiresModifierData mmd,
Object ob,
int  totlvl,
int  updateblock,
int  simple 
) [static]
static void multires_sync_levels ( Scene scene,
Object ob,
Object to_ob 
) [static]
void multires_topology_changed ( Scene scene,
Object ob 
)
void multiresModifier_base_apply ( MultiresModifierData mmd,
Object ob 
)
void multiresModifier_del_levels ( MultiresModifierData mmd,
Object ob,
int  direction 
)
static void multiresModifier_disp_run ( DerivedMesh dm,
Mesh me,
int  invert,
int  add,
DMGridData **  oldGridData,
int  totlvl 
) [static]
void multiresModifier_prepare_join ( Scene scene,
Object ob,
Object to_ob 
)
int multiresModifier_reshape ( Scene scene,
MultiresModifierData mmd,
Object dst,
Object src 
)
int multiresModifier_reshapeFromDeformMod ( Scene scene,
MultiresModifierData mmd,
Object ob,
ModifierData md 
)
int multiresModifier_reshapeFromDM ( Scene scene,
MultiresModifierData mmd,
Object ob,
DerivedMesh srcdm 
)
void multiresModifier_scale_disp ( Scene scene,
Object ob 
)

Definition at line 1709 of file multires.c.

References multires_apply_smat(), and object_scale_to_mat3().

Referenced by apply_objects_internal().

void multiresModifier_set_levels_from_disps ( MultiresModifierData mmd,
Object ob 
)
void multiresModifier_subdivide ( MultiresModifierData mmd,
Object ob,
int  updateblock,
int  simple 
)

Definition at line 683 of file multires.c.

References multires_subdivide(), and MultiresModifierData::totlvl.

Referenced by multires_load_old(), and multires_subdivide_exec().

static void multiresModifier_update ( DerivedMesh dm) [static]
void old_mdisps_bilinear ( float  out[3],
float(*)  disps[3],
const int  st,
float  u,
float  v 
)
static void old_mdisps_convert ( MFace mface,
MDisps mdisp 
) [static]
static void old_mdisps_rotate ( int  S,
int   UNUSEDnewside,
int  oldside,
int  x,
int  y,
float *  u,
float *  v 
) [static]

Definition at line 1014 of file multires.c.

Referenced by old_mdisps_convert().

static DerivedMesh* subsurf_dm_create_local ( Object ob,
DerivedMesh dm,
int  lvl,
int  simple,
int  optimal,
int  plain_uv 
) [static]
static float v3_dist_from_plane ( float  v[3],
float  center[3],
float  no[3] 
) [static]

Definition at line 488 of file multires.c.

References dot_v3v3(), and sub_v3_v3v3().

Referenced by multiresModifier_base_apply().


Variable Documentation

const int multires_grid_tot[] = {0, 4, 9, 25, 81, 289, 1089, 4225, 16641, 66049, 263169, 1050625, 4198401, 16785409} [static]
const int multires_max_levels = 13 [static]

Definition at line 65 of file multires.c.

Referenced by multires_subdivide().

const int multires_side_tot[] = {0, 2, 3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097} [static]