Blender  V3.3
Classes | Typedefs | Enumerations | Functions
subdiv_displacement_multires.c File Reference
#include <math.h>
#include "BKE_subdiv.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_multires.h"
#include "BKE_subdiv_eval.h"
#include "MEM_guardedalloc.h"

Go to the source code of this file.

Classes

struct  PolyCornerIndex
 
struct  MultiresDisplacementData
 

Typedefs

typedef struct PolyCornerIndex PolyCornerIndex
 
typedef struct MultiresDisplacementData MultiresDisplacementData
 
typedef enum eAverageWith eAverageWith
 

Enumerations

enum  eAverageWith { AVERAGE_WITH_NONE , AVERAGE_WITH_ALL , AVERAGE_WITH_PREV , AVERAGE_WITH_NEXT }
 

Functions

static int displacement_get_grid_and_coord (SubdivDisplacement *displacement, const int ptex_face_index, const float u, const float v, const MDisps **r_displacement_grid, float *grid_u, float *grid_v)
 
static const MDispsdisplacement_get_other_grid (SubdivDisplacement *displacement, const int ptex_face_index, const int corner, const int corner_delta)
 
BLI_INLINE eAverageWith read_displacement_grid (const MDisps *displacement_grid, const int grid_size, const float grid_u, const float grid_v, float r_tangent_D[3])
 
static void average_convert_grid_coord_to_ptex (const MPoly *poly, const int corner, const float grid_u, const float grid_v, float *r_ptex_face_u, float *r_ptex_face_v)
 
static void average_construct_tangent_matrix (Subdiv *subdiv, const MPoly *poly, const int ptex_face_index, const int corner, const float u, const float v, float r_tangent_matrix[3][3])
 
static void average_read_displacement_tangent (MultiresDisplacementData *data, const MDisps *other_displacement_grid, const float grid_u, const float grid_v, float r_tangent_D[3])
 
static void average_read_displacement_object (MultiresDisplacementData *data, const MDisps *displacement_grid, const float grid_u, const float grid_v, const int ptex_face_index, const int corner_index, float r_D[3])
 
static void average_get_other_ptex_and_corner (MultiresDisplacementData *data, const int ptex_face_index, const int corner, const int corner_delta, int *r_other_ptex_face_index, int *r_other_corner_index)
 
static void average_with_other (SubdivDisplacement *displacement, const int ptex_face_index, const int corner, const float grid_u, const float grid_v, const int corner_delta, float r_D[3])
 
static void average_with_all (SubdivDisplacement *displacement, const int ptex_face_index, const int corner, const float UNUSED(grid_u), const float UNUSED(grid_v), float r_D[3])
 
static void average_with_next (SubdivDisplacement *displacement, const int ptex_face_index, const int corner, const float grid_u, const float UNUSED(grid_v), float r_D[3])
 
static void average_with_prev (SubdivDisplacement *displacement, const int ptex_face_index, const int corner, const float UNUSED(grid_u), const float grid_v, float r_D[3])
 
static void average_displacement (SubdivDisplacement *displacement, eAverageWith average_with, const int ptex_face_index, const int corner, const float grid_u, const float grid_v, float r_D[3])
 
static int displacement_get_face_corner (MultiresDisplacementData *data, const int ptex_face_index, const float u, const float v)
 
static void initialize (SubdivDisplacement *displacement)
 
static void eval_displacement (SubdivDisplacement *displacement, const int ptex_face_index, const float u, const float v, const float dPdu[3], const float dPdv[3], float r_D[3])
 
static void free_displacement (SubdivDisplacement *displacement)
 
static int count_num_ptex_faces (const Mesh *mesh)
 
static void displacement_data_init_mapping (SubdivDisplacement *displacement, const Mesh *mesh)
 
static void displacement_init_data (SubdivDisplacement *displacement, Subdiv *subdiv, Mesh *mesh, const MultiresModifierData *mmd)
 
static void displacement_init_functions (SubdivDisplacement *displacement)
 
void BKE_subdiv_displacement_attach_from_multires (Subdiv *subdiv, Mesh *mesh, const MultiresModifierData *mmd)
 

Typedef Documentation

◆ eAverageWith

typedef enum eAverageWith eAverageWith

◆ MultiresDisplacementData

◆ PolyCornerIndex

Enumeration Type Documentation

◆ eAverageWith

Enumerator
AVERAGE_WITH_NONE 
AVERAGE_WITH_ALL 
AVERAGE_WITH_PREV 
AVERAGE_WITH_NEXT 

Definition at line 55 of file subdiv_displacement_multires.c.

Function Documentation

◆ average_construct_tangent_matrix()

static void average_construct_tangent_matrix ( Subdiv subdiv,
const MPoly poly,
const int  ptex_face_index,
const int  corner,
const float  u,
const float  v,
float  r_tangent_matrix[3][3] 
)
static

◆ average_convert_grid_coord_to_ptex()

static void average_convert_grid_coord_to_ptex ( const MPoly poly,
const int  corner,
const float  grid_u,
const float  grid_v,
float r_ptex_face_u,
float r_ptex_face_v 
)
static

◆ average_displacement()

static void average_displacement ( SubdivDisplacement displacement,
eAverageWith  average_with,
const int  ptex_face_index,
const int  corner,
const float  grid_u,
const float  grid_v,
float  r_D[3] 
)
static

◆ average_get_other_ptex_and_corner()

static void average_get_other_ptex_and_corner ( MultiresDisplacementData data,
const int  ptex_face_index,
const int  corner,
const int  corner_delta,
int *  r_other_ptex_face_index,
int *  r_other_corner_index 
)
static

Definition at line 191 of file subdiv_displacement_multires.c.

References data, PolyCornerIndex::poly_index, and MPoly::totloop.

Referenced by average_with_other().

◆ average_read_displacement_object()

static void average_read_displacement_object ( MultiresDisplacementData data,
const MDisps displacement_grid,
const float  grid_u,
const float  grid_v,
const int  ptex_face_index,
const int  corner_index,
float  r_D[3] 
)
static

◆ average_read_displacement_tangent()

static void average_read_displacement_tangent ( MultiresDisplacementData data,
const MDisps other_displacement_grid,
const float  grid_u,
const float  grid_v,
float  r_tangent_D[3] 
)
static

Definition at line 156 of file subdiv_displacement_multires.c.

References data, and read_displacement_grid().

Referenced by average_read_displacement_object().

◆ average_with_all()

static void average_with_all ( SubdivDisplacement displacement,
const int  ptex_face_index,
const int  corner,
const float   UNUSEDgrid_u,
const float   UNUSEDgrid_v,
float  r_D[3] 
)
static

◆ average_with_next()

static void average_with_next ( SubdivDisplacement displacement,
const int  ptex_face_index,
const int  corner,
const float  grid_u,
const float   UNUSEDgrid_v,
float  r_D[3] 
)
static

Definition at line 254 of file subdiv_displacement_multires.c.

References average_with_other().

Referenced by average_displacement().

◆ average_with_other()

static void average_with_other ( SubdivDisplacement displacement,
const int  ptex_face_index,
const int  corner,
const float  grid_u,
const float  grid_v,
const int  corner_delta,
float  r_D[3] 
)
static

◆ average_with_prev()

static void average_with_prev ( SubdivDisplacement displacement,
const int  ptex_face_index,
const int  corner,
const float   UNUSEDgrid_u,
const float  grid_v,
float  r_D[3] 
)
static

Definition at line 264 of file subdiv_displacement_multires.c.

References average_with_other().

Referenced by average_displacement().

◆ BKE_subdiv_displacement_attach_from_multires()

void BKE_subdiv_displacement_attach_from_multires ( Subdiv subdiv,
Mesh mesh,
const MultiresModifierData mmd 
)

◆ count_num_ptex_faces()

static int count_num_ptex_faces ( const Mesh mesh)
static

◆ displacement_data_init_mapping()

static void displacement_data_init_mapping ( SubdivDisplacement displacement,
const Mesh mesh 
)
static

◆ displacement_get_face_corner()

static int displacement_get_face_corner ( MultiresDisplacementData data,
const int  ptex_face_index,
const float  u,
const float  v 
)
static

◆ displacement_get_grid_and_coord()

static int displacement_get_grid_and_coord ( SubdivDisplacement displacement,
const int  ptex_face_index,
const float  u,
const float  v,
const MDisps **  r_displacement_grid,
float grid_u,
float grid_v 
)
static

◆ displacement_get_other_grid()

static const MDisps* displacement_get_other_grid ( SubdivDisplacement displacement,
const int  ptex_face_index,
const int  corner,
const int  corner_delta 
)
static

◆ displacement_init_data()

static void displacement_init_data ( SubdivDisplacement displacement,
Subdiv subdiv,
Mesh mesh,
const MultiresModifierData mmd 
)
static

◆ displacement_init_functions()

static void displacement_init_functions ( SubdivDisplacement displacement)
static

◆ eval_displacement()

static void eval_displacement ( SubdivDisplacement displacement,
const int  ptex_face_index,
const float  u,
const float  v,
const float  dPdu[3],
const float  dPdv[3],
float  r_D[3] 
)
static

◆ free_displacement()

static void free_displacement ( SubdivDisplacement displacement)
static

◆ initialize()

static void initialize ( SubdivDisplacement displacement)
static

◆ read_displacement_grid()

BLI_INLINE eAverageWith read_displacement_grid ( const MDisps displacement_grid,
const int  grid_size,
const float  grid_u,
const float  grid_v,
float  r_tangent_D[3] 
)