Cleanup: spelling, doxygen comment formatting
This commit is contained in:
parent
b4e96550ce
commit
6db1fb197c
|
@ -43,14 +43,14 @@ struct MatrixSamplesData {
|
|||
Alembic::AbcCoreAbstract::TimeSamplingPtr time_sampling;
|
||||
};
|
||||
|
||||
/* Helpers to detect if some type is a ccl::array. */
|
||||
/* Helpers to detect if some type is a `ccl::array`. */
|
||||
template<typename> struct is_array : public std::false_type {
|
||||
};
|
||||
|
||||
template<typename T> struct is_array<array<T>> : public std::true_type {
|
||||
};
|
||||
|
||||
/* Holds the data for a cache lookup at a given time, as well as informations to
|
||||
/* Holds the data for a cache lookup at a given time, as well as information to
|
||||
* help disambiguate successes or failures to get data from the cache. */
|
||||
template<typename T> class CacheLookupResult {
|
||||
enum class State {
|
||||
|
|
|
@ -178,8 +178,8 @@ DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
|
|||
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObject)
|
||||
{
|
||||
/* Text
|
||||
* Note: Unicode text is available as CF_TEXT too, the system can do the
|
||||
* conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS.
|
||||
* NOTE: Unicode text is available as CF_TEXT too, the system can do the
|
||||
* conversion, but we do the conversion our self with #WC_NO_BEST_FIT_CHARS.
|
||||
*/
|
||||
FORMATETC fmtetc = {CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
|
||||
if (pDataObject->QueryGetData(&fmtetc) == S_OK) {
|
||||
|
|
|
@ -115,7 +115,7 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev)
|
|||
{
|
||||
MemFileUndoData *mfu = MEM_callocN(sizeof(MemFileUndoData), __func__);
|
||||
|
||||
/* Include recovery infomation since undo-data is written out as #BLENDER_QUIT_FILE. */
|
||||
/* Include recovery information since undo-data is written out as #BLENDER_QUIT_FILE. */
|
||||
const int fileflags = G.fileflags | G_FILE_RECOVER_WRITE;
|
||||
|
||||
/* disk save version */
|
||||
|
|
|
@ -650,10 +650,10 @@ BLI_INLINE bool lib_override_library_create_post_process_object_is_instantiated(
|
|||
ViewLayer *view_layer, Object *object, const bool is_resync)
|
||||
{
|
||||
/* We cannot rely on check for object being actually instantiated in resync case, because often
|
||||
* the overridden collection is 'excluded' from the current viewlayer.
|
||||
* the overridden collection is 'excluded' from the current view-layer.
|
||||
*
|
||||
* Fallback to a basic usercount check then, this is weak (since it could lead to some object not
|
||||
* being instantiated at all), but it should work fine in most common cases. */
|
||||
* Fallback to a basic user-count check then, this is weak (since it could lead to some object
|
||||
* not being instantiated at all), but it should work fine in most common cases. */
|
||||
return ((is_resync && ID_REAL_USERS(object) >= 1) ||
|
||||
(!is_resync && BKE_view_layer_base_find(view_layer, object) != NULL));
|
||||
}
|
||||
|
|
|
@ -176,8 +176,8 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
|
|||
|
||||
CustomData_MeshMasks cddata_masks = scene->customdata_mask;
|
||||
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
|
||||
/* Make sure Freestyle edge/face marks appear in DM for render (see T40315). Due to Line Art
|
||||
* impementation, edge marks should also be shown in viewport. */
|
||||
/* Make sure Freestyle edge/face marks appear in DM for render (see T40315).
|
||||
* Due to Line Art implementation, edge marks should also be shown in viewport. */
|
||||
#ifdef WITH_FREESTYLE
|
||||
cddata_masks.emask |= CD_MASK_FREESTYLE_EDGE;
|
||||
cddata_masks.pmask |= CD_MASK_FREESTYLE_FACE;
|
||||
|
|
|
@ -178,7 +178,7 @@ typedef enum CDT_output_type {
|
|||
CDT_FULL,
|
||||
/** All triangles fully enclosed by constraint edges or faces. */
|
||||
CDT_INSIDE,
|
||||
/** Only point, edge, and face constraints, and their intersections. */
|
||||
/** Only point, edge, and face constraints, and their intersections. */
|
||||
CDT_CONSTRAINTS,
|
||||
/**
|
||||
* Like CDT_CONSTRAINTS, but keep enough
|
||||
|
|
|
@ -531,7 +531,7 @@ static float bm_edge_info_average_length(BMVert *v, SplitEdgeInfo *edge_info)
|
|||
return -1.0f;
|
||||
}
|
||||
|
||||
/**.
|
||||
/**
|
||||
* Fill in any vertices that are in the inset region but not connected to an edge being inset.
|
||||
*
|
||||
*
|
||||
|
|
|
@ -69,10 +69,15 @@ class DebugInfo {
|
|||
|
||||
private:
|
||||
static int m_file_index;
|
||||
static NodeNameMap m_node_names; /**< map nodes to usable names for debug output */
|
||||
static OpNameMap m_op_names; /**< map operations to usable names for debug output */
|
||||
static std::string m_current_node_name; /**< base name for all operations added by a node */
|
||||
static std::string m_current_op_name; /**< base name for automatic sub-operations */
|
||||
static GroupStateMap m_group_states; /**< for visualizing group states */
|
||||
/** Map nodes to usable names for debug output. */
|
||||
static NodeNameMap m_node_names;
|
||||
/** Map operations to usable names for debug output. */
|
||||
static OpNameMap m_op_names;
|
||||
/** Base name for all operations added by a node. */
|
||||
static std::string m_current_node_name;
|
||||
/** Base name for automatic sub-operations. */
|
||||
static std::string m_current_op_name;
|
||||
/** For visualizing group states. */
|
||||
static GroupStateMap m_group_states;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -171,7 +171,8 @@ void EEVEE_bloom_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *ved
|
|||
psl->bloom_accum_ps = NULL;
|
||||
|
||||
if ((effects->enabled_effects & EFFECT_BLOOM) != 0) {
|
||||
/** Bloom algorithm
|
||||
/**
|
||||
* Bloom Algorithm
|
||||
*
|
||||
* Overview:
|
||||
* - Down-sample the color buffer doing a small blur during each step.
|
||||
|
|
|
@ -158,9 +158,10 @@ void EEVEE_occlusion_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
if ((effects->enabled_effects & EFFECT_GTAO) != 0) {
|
||||
/** Occlusion algorithm overview
|
||||
/**
|
||||
* Occlusion Algorithm Overview:
|
||||
*
|
||||
* We separate the computation into 2 steps.
|
||||
* We separate the computation into 2 steps.
|
||||
*
|
||||
* - First we scan the neighborhood pixels to find the maximum horizon angle.
|
||||
* We save this angle in a RG8 array texture.
|
||||
|
|
|
@ -40,7 +40,7 @@ struct CollectionCellValue {
|
|||
class CellValue {
|
||||
public:
|
||||
/* The implementation just uses a `std::variant` for simplicity. It can be encapsulated better,
|
||||
* but it's not really worth the complixity for now. */
|
||||
* but it's not really worth the complexity for now. */
|
||||
using VariantType =
|
||||
std::variant<std::monostate, int, float, bool, ObjectCellValue, CollectionCellValue>;
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ typedef struct TransDataContainer {
|
|||
*/
|
||||
bool use_local_mat;
|
||||
|
||||
/** Mirror option. */
|
||||
/** Mirror option. */
|
||||
union {
|
||||
struct {
|
||||
uint use_mirror_axis_x : 1;
|
||||
|
|
|
@ -141,9 +141,9 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
|
|||
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
|
||||
bGPdata *gpd = ob->data;
|
||||
|
||||
/* Guard early, don't trigger calculation when no gpencil frame is present. Probably should
|
||||
* disable in the isModifierDisabled() function but we need addtional arg for depsgraph and
|
||||
* gpd. */
|
||||
/* Guard early, don't trigger calculation when no grease-pencil frame is present.
|
||||
* Probably should disable in the #isModifierDisabled() function
|
||||
* but we need additional argument for depsgraph and `gpd`. */
|
||||
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
|
||||
if (gpl == NULL) {
|
||||
return;
|
||||
|
|
|
@ -57,22 +57,26 @@ typedef struct LineartTriangle {
|
|||
|
||||
/* Material flag is removed to save space. */
|
||||
unsigned char transparency_mask;
|
||||
unsigned char flags; /* eLineartTriangleFlags */
|
||||
unsigned char flags; /* #eLineartTriangleFlags */
|
||||
|
||||
/* Only use single link list, because we don't need to go back in order.
|
||||
/**
|
||||
* Only use single link list, because we don't need to go back in order.
|
||||
* This variable is also reused to store the pointer to adjacent lines of this triangle before
|
||||
* intersection statge */
|
||||
* intersection stage.
|
||||
*/
|
||||
struct LinkNode *intersecting_verts;
|
||||
} LineartTriangle;
|
||||
|
||||
typedef struct LineartTriangleThread {
|
||||
struct LineartTriangle base;
|
||||
/* This variable is used to store per-thread triangle-line testing pair,
|
||||
/**
|
||||
* This variable is used to store per-thread triangle-line testing pair,
|
||||
* also re-used to store triangle-triangle pair for intersection testing stage.
|
||||
* Do not directly use LineartTriangleThread.
|
||||
* The size of LineartTriangle is dynamically allocated to contain set thread number of
|
||||
* Do not directly use #LineartTriangleThread.
|
||||
* The size of #LineartTriangle is dynamically allocated to contain set thread number of
|
||||
* "testing_e" field. Worker threads will test lines against the "base" triangle.
|
||||
* At least one thread is present, thus we always have at least testing_e[0]. */
|
||||
* At least one thread is present, thus we always have at least `testing_e[0]`.
|
||||
*/
|
||||
struct LineartEdge *testing_e[1];
|
||||
} LineartTriangleThread;
|
||||
|
||||
|
@ -89,7 +93,7 @@ typedef struct LineartElementLinkNode {
|
|||
void *object_ref;
|
||||
eLineArtElementNodeFlag flags;
|
||||
|
||||
/* Per object value, always set, if not enabled by ObjectLineArt, then it's set to global. */
|
||||
/** Per object value, always set, if not enabled by #ObjectLineArt, then it's set to global. */
|
||||
float crease_threshold;
|
||||
} LineartElementLinkNode;
|
||||
|
||||
|
@ -100,10 +104,11 @@ typedef struct LineartLineSegment {
|
|||
/** Occlusion level after "at" point */
|
||||
unsigned char occlusion;
|
||||
|
||||
/** For determining lines beind a glass window material.
|
||||
* the size of this variable should also be dynamically decided, 1 byte to 8 byte,
|
||||
* allows 8 to 64 materials for "transparent mask". 1 byte (8 materials) should be
|
||||
* enought for most cases.
|
||||
/**
|
||||
* For determining lines behind a glass window material.
|
||||
* the size of this variable should also be dynamically decided, 1 byte to 8 byte,
|
||||
* allows 8 to 64 materials for "transparent mask". 1 byte (8 materials) should be
|
||||
* enough for most cases.
|
||||
*/
|
||||
unsigned char transparency_mask;
|
||||
} LineartLineSegment;
|
||||
|
@ -115,9 +120,10 @@ typedef struct LineartVert {
|
|||
/* Scene global index. */
|
||||
int index;
|
||||
|
||||
/** Intersection data flag is here, when LRT_VERT_HAS_INTERSECTION_DATA is set,
|
||||
/**
|
||||
* Intersection data flag is here, when LRT_VERT_HAS_INTERSECTION_DATA is set,
|
||||
* size of the struct is extended to include intersection data.
|
||||
* See eLineArtVertFlags.
|
||||
* See #eLineArtVertFlags.
|
||||
*/
|
||||
char flag;
|
||||
|
||||
|
@ -125,7 +131,7 @@ typedef struct LineartVert {
|
|||
|
||||
typedef struct LineartVertIntersection {
|
||||
struct LineartVert base;
|
||||
/* Use vert index because we only use this to check vertex equal. This way we save 8 Bytes. */
|
||||
/** Use vert index because we only use this to check vertex equal. This way we save 8 Bytes. */
|
||||
int isec1, isec2;
|
||||
struct LineartTriangle *intersecting_with;
|
||||
} LineartVertIntersection;
|
||||
|
@ -136,20 +142,23 @@ typedef enum eLineArtVertFlags {
|
|||
} eLineArtVertFlags;
|
||||
|
||||
typedef struct LineartEdge {
|
||||
/* We only need link node kind of list here. */
|
||||
/** We only need link node kind of list here. */
|
||||
struct LineartEdge *next;
|
||||
struct LineartVert *v1, *v2;
|
||||
/* Local vertex index for two ends, not puting in RenderVert because all verts are loaded, so as
|
||||
* long as fewer than half of the mesh edges are becoming a feature line, we save more memory. */
|
||||
/**
|
||||
* Local vertex index for two ends, not pouting in #RenderVert because all verts are loaded, so
|
||||
* as long as fewer than half of the mesh edges are becoming a feature line, we save more memory.
|
||||
*/
|
||||
int v1_obindex, v2_obindex;
|
||||
struct LineartTriangle *t1, *t2;
|
||||
ListBase segments;
|
||||
char min_occ;
|
||||
|
||||
/** Also for line type determination on chainning */
|
||||
/** Also for line type determination on chaining. */
|
||||
unsigned char flags;
|
||||
|
||||
/** Still need this entry because culled lines will not add to object reln node,
|
||||
/**
|
||||
* Still need this entry because culled lines will not add to object reln node,
|
||||
* TODO: If really need more savings, we can allocate this in a "extended" way too, but we need
|
||||
* another bit in flags to be able to show the difference.
|
||||
*/
|
||||
|
@ -160,10 +169,10 @@ typedef struct LineartLineChain {
|
|||
struct LineartLineChain *next, *prev;
|
||||
ListBase chain;
|
||||
|
||||
/** Calculated before draw cmd. */
|
||||
/** Calculated before draw command. */
|
||||
float length;
|
||||
|
||||
/** Used when re-connecting and gp stroke generation */
|
||||
/** Used when re-connecting and gp stroke generation. */
|
||||
char picked;
|
||||
char level;
|
||||
|
||||
|
@ -216,11 +225,11 @@ typedef struct LineartRenderBuffer {
|
|||
ListBase line_buffer_pointers;
|
||||
ListBase triangle_buffer_pointers;
|
||||
|
||||
/* This one's memory is not from main pool and is free()ed after culling stage. */
|
||||
/** This one's memory is not from main pool and is free()ed after culling stage. */
|
||||
ListBase triangle_adjacent_pointers;
|
||||
|
||||
ListBase intersecting_vertex_buffer;
|
||||
/* Use the one comes with Line Art. */
|
||||
/** Use the one comes with Line Art. */
|
||||
LineartStaticMemPool render_data_pool;
|
||||
ListBase wasted_cuts;
|
||||
SpinLock lock_cuts;
|
||||
|
@ -291,7 +300,7 @@ typedef struct LineartRenderBuffer {
|
|||
float chaining_image_threshold;
|
||||
float angle_splitting_threshold;
|
||||
|
||||
/* FIXME: (Yiming) Temporary solution for speeding up calculation by not including lines that
|
||||
/* FIXME(Yiming): Temporary solution for speeding up calculation by not including lines that
|
||||
* are not in the selected source. This will not be needed after we have a proper scene-wise
|
||||
* cache running because multiple modifiers can then select results from that without further
|
||||
* calculation. */
|
||||
|
@ -342,22 +351,27 @@ typedef struct LineartRenderTaskInfo {
|
|||
|
||||
} LineartRenderTaskInfo;
|
||||
|
||||
/** Bounding area diagram:
|
||||
*
|
||||
/**
|
||||
* Bounding area diagram:
|
||||
* \code{.txt}
|
||||
* +----+ <----U (Upper edge Y value)
|
||||
* | |
|
||||
* +----+ <----B (Bottom edge Y value)
|
||||
* ^ ^
|
||||
* L R (Left/Right edge X value)
|
||||
* \endcode
|
||||
*
|
||||
* Example structure when subdividing 1 bounding areas:
|
||||
* 1 area can be divided into 4 smaller children to
|
||||
* accomodate image areas with denser triangle distribution.
|
||||
* accommodate image areas with denser triangle distribution.
|
||||
* \code{.txt}
|
||||
* +--+--+-----+
|
||||
* +--+--+ |
|
||||
* +--+--+-----+
|
||||
* | | |
|
||||
* +-----+-----+
|
||||
* \endcode
|
||||
*
|
||||
* lp/rp/up/bp is the list for
|
||||
* storing pointers to adjacent bounding areas.
|
||||
*/
|
||||
|
@ -378,7 +392,7 @@ typedef struct LineartBoundingArea {
|
|||
ListBase linked_triangles;
|
||||
ListBase linked_lines;
|
||||
|
||||
/** Reserved for image space reduction && multithread chainning */
|
||||
/** Reserved for image space reduction && multi-thread chaining. */
|
||||
ListBase linked_chains;
|
||||
} LineartBoundingArea;
|
||||
|
||||
|
|
|
@ -512,10 +512,12 @@ static LineartBoundingArea *lineart_bounding_area_get_end_point(LineartRenderBuf
|
|||
return lineart_bounding_area_get_rlci_recursive(rb, root, rlci);
|
||||
}
|
||||
|
||||
/* Here we will try to connect geometry space chains together in image space. However we can't
|
||||
/**
|
||||
* Here we will try to connect geometry space chains together in image space. However we can't
|
||||
* chain two chains together if their end and start points lie on the border between two bounding
|
||||
* areas, this happens either when 1) the geometry is way too dense, or 2) the chaining threshold
|
||||
* is too big that it covers multiple small bounding areas. */
|
||||
* is too big that it covers multiple small bounding areas.
|
||||
*/
|
||||
static void lineart_bounding_area_link_point_recursive(LineartRenderBuffer *rb,
|
||||
LineartBoundingArea *root,
|
||||
LineartLineChain *rlc,
|
||||
|
@ -636,7 +638,9 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb)
|
|||
}
|
||||
}
|
||||
|
||||
/* Note: segment type (crease/material/contour...) is ambiguous after this. */
|
||||
/**
|
||||
* Note: segment type (crease/material/contour...) is ambiguous after this.
|
||||
*/
|
||||
static void lineart_chain_connect(LineartRenderBuffer *UNUSED(rb),
|
||||
LineartLineChain *onto,
|
||||
LineartLineChain *sub,
|
||||
|
@ -700,7 +704,7 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
|
|||
|
||||
LineartChainRegisterEntry *closest_cre = NULL;
|
||||
|
||||
/* Keep using for loop because cre could be removed from the iteration before getting to the
|
||||
/* Keep using for loop because `cre` could be removed from the iteration before getting to the
|
||||
* next one. */
|
||||
LISTBASE_FOREACH_MUTABLE (LineartChainRegisterEntry *, cre, &ba->linked_chains) {
|
||||
if (cre->rlc->object_ref != rlc->object_ref) {
|
||||
|
@ -729,7 +733,7 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
|
|||
if (rb->fuzzy_intersections) {
|
||||
if (!(cre->rlc->type == LRT_EDGE_FLAG_INTERSECTION ||
|
||||
rlc->type == LRT_EDGE_FLAG_INTERSECTION)) {
|
||||
continue; /* Fuzzy intersetions but no intersection line found. */
|
||||
continue; /* Fuzzy intersections but no intersection line found. */
|
||||
}
|
||||
}
|
||||
else { /* Line type different but no fuzzy. */
|
||||
|
@ -776,9 +780,11 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf
|
|||
return closest_cre;
|
||||
}
|
||||
|
||||
/* This function only connects two different chains. It will not do any clean up or smart chaining.
|
||||
/**
|
||||
* This function only connects two different chains. It will not do any clean up or smart chaining.
|
||||
* So no: removing overlapping chains, removal of short isolated segments, and no loop reduction is
|
||||
* implemented yet. */
|
||||
* implemented yet.
|
||||
*/
|
||||
void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
|
||||
{
|
||||
LineartLineChain *rlc;
|
||||
|
@ -856,7 +862,9 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb)
|
|||
}
|
||||
}
|
||||
|
||||
/* Length is in image space. */
|
||||
/**
|
||||
* Length is in image space.
|
||||
*/
|
||||
float MOD_lineart_chain_compute_length(LineartLineChain *rlc)
|
||||
{
|
||||
LineartLineChainItem *rlci;
|
||||
|
@ -904,8 +912,10 @@ void MOD_lineart_chain_clear_picked_flag(LineartRenderBuffer *rb)
|
|||
}
|
||||
}
|
||||
|
||||
/* This should always be the last stage!, see the end of
|
||||
* MOD_lineart_chain_split_for_fixed_occlusion().*/
|
||||
/**
|
||||
* This should always be the last stage!, see the end of
|
||||
* #MOD_lineart_chain_split_for_fixed_occlusion().
|
||||
*/
|
||||
void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshold_rad)
|
||||
{
|
||||
LineartLineChain *rlc, *new_rlc;
|
||||
|
|
|
@ -131,8 +131,8 @@ static void lineart_discard_segment(LineartRenderBuffer *rb, LineartLineSegment
|
|||
|
||||
memset(rls, 0, sizeof(LineartLineSegment));
|
||||
|
||||
/* Storing the node for potentially reuse the memory for new segment data. Line Art data is not
|
||||
* freed after all calulations are done. */
|
||||
/* Storing the node for potentially reuse the memory for new segment data.
|
||||
* Line Art data is not freed after all calculations are done. */
|
||||
BLI_addtail(&rb->wasted_cuts, rls);
|
||||
|
||||
BLI_spin_unlock(&rb->lock_cuts);
|
||||
|
@ -156,7 +156,9 @@ static LineartLineSegment *lineart_give_segment(LineartRenderBuffer *rb)
|
|||
sizeof(LineartLineSegment));
|
||||
}
|
||||
|
||||
/* Cuts the edge in image space and mark occlusion level for each segment. */
|
||||
/**
|
||||
* Cuts the edge in image space and mark occlusion level for each segment.
|
||||
*/
|
||||
static void lineart_edge_cut(LineartRenderBuffer *rb,
|
||||
LineartEdge *e,
|
||||
double start,
|
||||
|
@ -219,7 +221,7 @@ static void lineart_edge_cut(LineartRenderBuffer *rb,
|
|||
ns2 = cut_end_before;
|
||||
break;
|
||||
}
|
||||
/* This check is to prevent rls->at == 1.0 (where we don't need to cut because we are at the
|
||||
/* This check is to prevent `rls->at == 1.0` (where we don't need to cut because we are at the
|
||||
* end point). */
|
||||
if (!rls->next && LRT_DOUBLE_CLOSE_ENOUGH(1, end)) {
|
||||
cut_end_before = rls;
|
||||
|
@ -283,8 +285,8 @@ static void lineart_edge_cut(LineartRenderBuffer *rb,
|
|||
BLI_addtail(&e->segments, ns2);
|
||||
}
|
||||
|
||||
/* If we touched the cut list, we assign the new cut position based on new cut position, this way
|
||||
* we accomomdate precision lost due to multiple cut inserts. */
|
||||
/* If we touched the cut list, we assign the new cut position based on new cut position,
|
||||
* this way we accommodate precision lost due to multiple cut inserts. */
|
||||
ns->at = start;
|
||||
if (!untouched) {
|
||||
ns2->at = end;
|
||||
|
@ -322,7 +324,9 @@ static void lineart_edge_cut(LineartRenderBuffer *rb,
|
|||
e->min_occ = min_occ;
|
||||
}
|
||||
|
||||
/* To see if given line is connected to an adjacent intersection line. */
|
||||
/**
|
||||
* To see if given line is connected to an adjacent intersection line.
|
||||
*/
|
||||
BLI_INLINE bool lineart_occlusion_is_adjacent_intersection(LineartEdge *e, LineartTriangle *rt)
|
||||
{
|
||||
LineartVertIntersection *v1 = (void *)e->v1;
|
||||
|
@ -373,13 +377,13 @@ static void lineart_occlusion_single_line(LineartRenderBuffer *rb, LineartEdge *
|
|||
&r)) {
|
||||
lineart_edge_cut(rb, e, l, r, rt->base.transparency_mask);
|
||||
if (e->min_occ > rb->max_occlusion_level) {
|
||||
/* No need to caluclate any longer on this line because no level more than set value is
|
||||
/* No need to calculate any longer on this line because no level more than set value is
|
||||
* going to show up in the rendered result. */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Marching along e->v1 to e->v2, searching each possible bounding areas it may touch. */
|
||||
/* Marching along `e->v1` to `e->v2`, searching each possible bounding areas it may touch. */
|
||||
nba = lineart_bounding_area_next(nba, e, x, y, k, positive_x, positive_y, &x, &y);
|
||||
}
|
||||
}
|
||||
|
@ -449,9 +453,11 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR
|
|||
}
|
||||
}
|
||||
|
||||
/* All internal functions starting with lineart_main_ is called inside
|
||||
/**
|
||||
* All internal functions starting with lineart_main_ is called inside
|
||||
* MOD_lineart_compute_feature_lines function.
|
||||
* This function handles all occlusion calculation. */
|
||||
* This function handles all occlusion calculation.
|
||||
*/
|
||||
static void lineart_main_occlusion_begin(LineartRenderBuffer *rb)
|
||||
{
|
||||
int thread_count = rb->thread_count;
|
||||
|
@ -478,10 +484,12 @@ static void lineart_main_occlusion_begin(LineartRenderBuffer *rb)
|
|||
MEM_freeN(rti);
|
||||
}
|
||||
|
||||
/* Test if v lies with in the triangle formed by v0, v1, and v2. Returns false when v is exactly on
|
||||
* the edge.
|
||||
/**
|
||||
* Test if v lies with in the triangle formed by v0, v1, and v2.
|
||||
* Returns false when v is exactly on the edge.
|
||||
*
|
||||
* For v to be inside the triangle, it needs to be at the same side of v0->v1, v1->v2, and
|
||||
* v2->v0, where the "side" is determined by checking the sign of cross(v1-v0, v1-v) and so on.
|
||||
* `v2->v0`, where the "side" is determined by checking the sign of `cross(v1-v0, v1-v)` and so on.
|
||||
*/
|
||||
static bool lineart_point_inside_triangle(const double v[2],
|
||||
const double v0[2],
|
||||
|
@ -517,7 +525,7 @@ static bool lineart_point_inside_triangle(const double v[2],
|
|||
|
||||
static int lineart_point_on_line_segment(double v[2], double v0[2], double v1[2])
|
||||
{
|
||||
/* c1!=c2 by default. */
|
||||
/* `c1 != c2` by default. */
|
||||
double c1 = 1, c2 = 0;
|
||||
double l0[2], l1[2];
|
||||
|
||||
|
@ -551,8 +559,10 @@ static int lineart_point_on_line_segment(double v[2], double v0[2], double v1[2]
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Same algorithm as lineart_point_inside_triangle(), but returns differently:
|
||||
* 0-outside 1-on the edge 2-inside. */
|
||||
/**
|
||||
* Same algorithm as lineart_point_inside_triangle(), but returns differently:
|
||||
* 0-outside 1-on the edge 2-inside.
|
||||
*/
|
||||
static int lineart_point_triangle_relation(double v[2], double v0[2], double v1[2], double v2[2])
|
||||
{
|
||||
double cl, c;
|
||||
|
@ -591,8 +601,10 @@ static int lineart_point_triangle_relation(double v[2], double v0[2], double v1[
|
|||
return 2;
|
||||
}
|
||||
|
||||
/* Similar with lineart_point_inside_triangle, but in 3d.
|
||||
* Returns false when not co-plannar. */
|
||||
/**
|
||||
* Similar with #lineart_point_inside_triangle, but in 3d.
|
||||
* Returns false when not co-planar.
|
||||
*/
|
||||
static bool lineart_point_inside_triangle3d(double v[3], double v0[3], double v1[3], double v2[3])
|
||||
{
|
||||
double l[3], r[3];
|
||||
|
@ -630,8 +642,10 @@ static bool lineart_point_inside_triangle3d(double v[3], double v0[3], double v1
|
|||
return true;
|
||||
}
|
||||
|
||||
/* The following lineart_memory_get_XXX_space functions are for allocating new memory for some
|
||||
* modified geometries in the culling stage. */
|
||||
/**
|
||||
* The following `lineart_memory_get_XXX_space` functions are for allocating new memory for some
|
||||
* modified geometries in the culling stage.
|
||||
*/
|
||||
static LineartElementLinkNode *lineart_memory_get_triangle_space(LineartRenderBuffer *rb)
|
||||
{
|
||||
LineartElementLinkNode *reln;
|
||||
|
@ -705,8 +719,10 @@ static bool lineart_edge_match(LineartTriangle *rt, LineartEdge *e, int v1, int
|
|||
(rt->v[v2] == e->v1 && rt->v[v1] == e->v2));
|
||||
}
|
||||
|
||||
/* Does near-plane cut on 1 triangle only. When cutting with far-plane, the camera vectors gets
|
||||
* reversed by the caller so don't need to implement one in a different direction. */
|
||||
/**
|
||||
* Does near-plane cut on 1 triangle only. When cutting with far-plane, the camera vectors gets
|
||||
* reversed by the caller so don't need to implement one in a different direction.
|
||||
*/
|
||||
static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
||||
LineartTriangle *rt,
|
||||
int in0,
|
||||
|
@ -750,7 +766,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
rb->triangle_size * (t_count + 1));
|
||||
|
||||
new_e = &((LineartEdge *)e_eln->pointer)[e_count];
|
||||
/* Init rl to the last rl entry. */
|
||||
/* Init `rl` to the last `rl` entry. */
|
||||
e = new_e;
|
||||
|
||||
#define INCREASE_RL \
|
||||
|
@ -811,8 +827,11 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
* generate 2 new points, 3 lines and 1 triangle. */
|
||||
lineart_triangle_set_cull_flag(rt, LRT_CULL_USED);
|
||||
|
||||
/* (!in0) means "when point 0 is visible".
|
||||
* conditons for point 1, 2 are the same idea.
|
||||
/**
|
||||
* (!in0) means "when point 0 is visible".
|
||||
* conditions for point 1, 2 are the same idea.
|
||||
*
|
||||
* \code{.txt}
|
||||
* 1-----|-------0
|
||||
* | | ---
|
||||
* | |---
|
||||
|
@ -826,6 +845,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
* |
|
||||
* |
|
||||
* (near)---------->(far)
|
||||
* \endcode
|
||||
*/
|
||||
if (!in0) {
|
||||
|
||||
|
@ -857,14 +877,13 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
e->flags = LRT_EDGE_FLAG_CONTOUR;
|
||||
lineart_prepend_edge_direct(&rb->contours, e);
|
||||
}
|
||||
/* Note: inverting e->v1/v2 (left/right point) doesn't matter as long as
|
||||
* rt->rl and rt->v has the same sequence. and the winding direction
|
||||
* can be either CW or CCW but needs to be consistent throughout the calculation.
|
||||
*/
|
||||
/* NOTE: inverting `e->v1/v2` (left/right point) doesn't matter as long as
|
||||
* `rt->rl` and `rt->v` has the same sequence. and the winding direction
|
||||
* can be either CW or CCW but needs to be consistent throughout the calculation. */
|
||||
e->v1 = &rv[1];
|
||||
e->v2 = &rv[0];
|
||||
/* Only one adjacent triangle, because the other side is the near plane. */
|
||||
/* Use tl or tr doesn't matter. */
|
||||
/* Use `tl` or `tr` doesn't matter. */
|
||||
e->t1 = rt1;
|
||||
e->object_ref = ob;
|
||||
|
||||
|
@ -971,8 +990,10 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
* generate 2 new points, 4 lines and 2 triangles. */
|
||||
lineart_triangle_set_cull_flag(rt, LRT_CULL_USED);
|
||||
|
||||
/* (in0) means "when point 0 is invisible".
|
||||
* conditons for point 1, 2 are the same idea.
|
||||
/**
|
||||
* (in0) means "when point 0 is invisible".
|
||||
* conditions for point 1, 2 are the same idea.
|
||||
* \code{.txt}
|
||||
* 0------|----------1
|
||||
* -- | |
|
||||
* ---| |
|
||||
|
@ -990,6 +1011,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
* | *** |
|
||||
* | **2
|
||||
* (near)---------->(far)
|
||||
* \endcode
|
||||
*/
|
||||
if (in0) {
|
||||
/* Cut point for line 0---|------1. */
|
||||
|
@ -1009,7 +1031,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
dot1 = dot_v3v3_db(vv1, view_dir);
|
||||
dot2 = dot_v3v3_db(vv2, view_dir);
|
||||
a = dot2 / (dot1 + dot2);
|
||||
/* Assign to aother new point. */
|
||||
/* Assign to other new point. */
|
||||
interp_v3_v3v3_db(rv[1].gloc, rt->v[0]->gloc, rt->v[2]->gloc, a);
|
||||
mul_v4_m4v3_db(rv[1].fbcoord, vp, rv[1].gloc);
|
||||
rv[1].index = rt->v[0]->index;
|
||||
|
@ -1026,8 +1048,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
e->object_ref = ob;
|
||||
|
||||
/* New line connects new point 0 and old point 1,
|
||||
* this is a border line.
|
||||
*/
|
||||
* this is a border line. */
|
||||
|
||||
SELECT_RL(0, rt->v[1], &rv[0], rt1)
|
||||
SELECT_RL(2, rt->v[2], &rv[1], rt2)
|
||||
|
@ -1156,7 +1177,8 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb,
|
|||
#undef REMOVE_TRIANGLE_RL
|
||||
}
|
||||
|
||||
/* This function cuts triangles with near- or far-plane. Setting clip_far = true for cutting with
|
||||
/**
|
||||
* This function cuts triangles with near- or far-plane. Setting clip_far = true for cutting with
|
||||
* far-plane. For triangles that's crossing the plane, it will generate new 1 or 2 triangles with
|
||||
* new topology that represents the trimmed triangle. (which then became a triangle or a square
|
||||
* formed by two triangles)
|
||||
|
@ -1288,8 +1310,10 @@ static void lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far)
|
|||
#undef LRT_CULL_DECIDE_INSIDE
|
||||
}
|
||||
|
||||
/* Adjacent data is only used during the initial stages of computing. So we can free it using this
|
||||
* function when it is not needed anymore. */
|
||||
/**
|
||||
* Adjacent data is only used during the initial stages of computing.
|
||||
* So we can free it using this function when it is not needed anymore.
|
||||
*/
|
||||
static void lineart_main_free_adjacent_data(LineartRenderBuffer *rb)
|
||||
{
|
||||
LinkData *ld;
|
||||
|
@ -1301,7 +1325,7 @@ static void lineart_main_free_adjacent_data(LineartRenderBuffer *rb)
|
|||
int i;
|
||||
for (i = 0; i < reln->element_count; i++) {
|
||||
/* See definition of rt->intersecting_verts and the usage in
|
||||
* lineart_geometry_object_load() for detailes. */
|
||||
* lineart_geometry_object_load() for detailed. */
|
||||
rt->intersecting_verts = NULL;
|
||||
rt = (LineartTriangle *)(((unsigned char *)rt) + rb->triangle_size);
|
||||
}
|
||||
|
@ -1327,14 +1351,16 @@ static void lineart_main_perspective_division(LineartRenderBuffer *rb)
|
|||
* at the moment.
|
||||
* The algorithm currently doesn't need Z for operation, we use W instead. If Z is needed in
|
||||
* the future, the line below correctly transforms it to view space coordinates. */
|
||||
/* rv[i].fbcoord[2] = -2 * rv[i].fbcoord[2] / (far - near) - (far + near) / (far - near);. */
|
||||
// `rv[i].fbcoord[2] = -2 * rv[i].fbcoord[2] / (far - near) - (far + near) / (far - near);
|
||||
rv[i].fbcoord[0] -= rb->shift_x * 2;
|
||||
rv[i].fbcoord[1] -= rb->shift_y * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Transform a single vert to it's viewing position. */
|
||||
/**
|
||||
* Transform a single vert to it's viewing position.
|
||||
*/
|
||||
static void lineart_vert_transform(
|
||||
BMVert *v, int index, LineartVert *RvBuf, double (*mv_mat)[4], double (*mvp_mat)[4])
|
||||
{
|
||||
|
@ -1345,8 +1371,10 @@ static void lineart_vert_transform(
|
|||
mul_v4_m4v3_db(rv->fbcoord, mvp_mat, co);
|
||||
}
|
||||
|
||||
/* Because we have a variable size for LineartTriangle, we need an access helper. See
|
||||
* LineartTriangleThread for more info. */
|
||||
/**
|
||||
* Because we have a variable size for #LineartTriangle, we need an access helper.
|
||||
* See #LineartTriangleThread for more info.
|
||||
*/
|
||||
static LineartTriangle *lineart_triangle_from_index(LineartRenderBuffer *rb,
|
||||
LineartTriangle *rt_array,
|
||||
int index)
|
||||
|
@ -1588,7 +1616,7 @@ static void lineart_geometry_object_load(Depsgraph *dg,
|
|||
use_crease = rb->crease_threshold;
|
||||
}
|
||||
|
||||
/* FIXME Yiming: Hack for getting clean 3D text, the seam that extruded text object creates
|
||||
/* FIXME(Yiming): Hack for getting clean 3D text, the seam that extruded text object creates
|
||||
* erroneous detection on creases. Future configuration should allow options. */
|
||||
if (ob->type == OB_FONT) {
|
||||
reln->flags |= LRT_ELEMENT_BORDER_ONLY;
|
||||
|
@ -1610,8 +1638,8 @@ static void lineart_geometry_object_load(Depsgraph *dg,
|
|||
lineart_vert_transform(v, i, orv, new_mv, new_mvp);
|
||||
orv[i].index = i + global_i;
|
||||
}
|
||||
/* Register a global index increment. See lineart_triangle_share_edge() and
|
||||
* lineart_main_load_geometries() for detailes. It's okay that global_vindex might eventually
|
||||
/* Register a global index increment. See #lineart_triangle_share_edge() and
|
||||
* #lineart_main_load_geometries() for detailed. It's okay that global_vindex might eventually
|
||||
* overflow, in such large scene it's virtually impossible for two vertex of the same numeric
|
||||
* index to come close together. */
|
||||
(*global_vindex) += bm->totvert;
|
||||
|
@ -1734,10 +1762,12 @@ static bool _lineart_object_not_in_source_collection(Collection *source, Object
|
|||
return true;
|
||||
}
|
||||
|
||||
/* See if this object in such collection is used for generating line art,
|
||||
* Disabling a collection for line art will diable all objects inside.
|
||||
* "_rb" is used to provide source selection info. See the definition of rb->_source_type for
|
||||
* details. */
|
||||
/**
|
||||
* See if this object in such collection is used for generating line art,
|
||||
* Disabling a collection for line art will doable all objects inside.
|
||||
* `_rb` is used to provide source selection info.
|
||||
* See the definition of `rb->_source_type` for details.
|
||||
*/
|
||||
static int lineart_usage_check(Collection *c, Object *ob, LineartRenderBuffer *_rb)
|
||||
{
|
||||
|
||||
|
@ -1850,8 +1880,10 @@ static void lineart_main_load_geometries(
|
|||
DEG_OBJECT_ITER_END;
|
||||
}
|
||||
|
||||
/* Returns the two other verts of the triangle given a vertex. Returns false if the given vertex
|
||||
* doesn't belong to this triangle. */
|
||||
/**
|
||||
* Returns the two other verts of the triangle given a vertex. Returns false if the given vertex
|
||||
* doesn't belong to this triangle.
|
||||
*/
|
||||
static bool lineart_triangle_get_other_verts(const LineartTriangle *rt,
|
||||
const LineartVert *rv,
|
||||
LineartVert **l,
|
||||
|
@ -1915,7 +1947,7 @@ static bool lineart_edge_from_triangle(const LineartTriangle *rt,
|
|||
lst[2] = LRT_MAX3_INDEX(ia, ib, ic); \
|
||||
}
|
||||
|
||||
/* ia ib ic are ordered. */
|
||||
/* `ia ib ic` are ordered. */
|
||||
#define INTERSECT_JUST_GREATER(is, order, num, index) \
|
||||
{ \
|
||||
index = (num < is[order[0]] ? \
|
||||
|
@ -1923,7 +1955,7 @@ static bool lineart_edge_from_triangle(const LineartTriangle *rt,
|
|||
(num < is[order[1]] ? order[1] : (num < is[order[2]] ? order[2] : order[2]))); \
|
||||
}
|
||||
|
||||
/* ia ib ic are ordered. */
|
||||
/* `ia ib ic` are ordered. */
|
||||
#define INTERSECT_JUST_SMALLER(is, order, num, index) \
|
||||
{ \
|
||||
index = (num > is[order[2]] ? \
|
||||
|
@ -1931,10 +1963,11 @@ static bool lineart_edge_from_triangle(const LineartTriangle *rt,
|
|||
(num > is[order[1]] ? order[1] : (num > is[order[0]] ? order[0] : order[0]))); \
|
||||
}
|
||||
|
||||
/* This is the main function to calculate
|
||||
/**
|
||||
* This is the main function to calculate
|
||||
* the occlusion status between 1(one) triangle and 1(one) line.
|
||||
* if returns true, then from/to will carry the occludded segments
|
||||
* in ratio from e->v1 to e->v2. The line is later cut with these two values.
|
||||
* if returns true, then from/to will carry the occluded segments
|
||||
* in ratio from `e->v1` to `e->v2`. The line is later cut with these two values.
|
||||
*/
|
||||
static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
|
||||
const LineartTriangle *rt,
|
||||
|
@ -1976,7 +2009,7 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
|
|||
return false;
|
||||
}
|
||||
|
||||
/* If the the line is one of the edge in the triangle, then it's not occludded. */
|
||||
/* If the the line is one of the edge in the triangle, then it's not occluded. */
|
||||
if (lineart_edge_from_triangle(rt, e, allow_overlapping_edges)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2015,7 +2048,7 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
|
|||
if (!a && !b && !c) {
|
||||
if (!(st_l = lineart_point_triangle_relation(LFBC, FBC0, FBC1, FBC2)) &&
|
||||
!(st_r = lineart_point_triangle_relation(RFBC, FBC0, FBC1, FBC2))) {
|
||||
return 0; /* Intersection point is not inside triangle. */
|
||||
return 0; /* Intersection point is not inside triangle. */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2057,7 +2090,7 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
|
|||
trans[0] -= cam_shift_x * 2;
|
||||
trans[1] -= cam_shift_y * 2;
|
||||
|
||||
/* To accomodate k=0 and k=inf (vertical) lines. here the cut is in image space. */
|
||||
/* To accommodate `k=0` and `k=inf` (vertical) lines. here the cut is in image space. */
|
||||
if (fabs(e->v1->fbcoord[0] - e->v2->fbcoord[0]) > fabs(e->v1->fbcoord[1] - e->v2->fbcoord[1])) {
|
||||
cut = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], trans[0]);
|
||||
}
|
||||
|
@ -2164,8 +2197,10 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
|
|||
#undef INTERSECT_JUST_GREATER
|
||||
#undef INTERSECT_JUST_SMALLER
|
||||
|
||||
/* At this stage of the computation we don't have triangle adjacent info anymore, so we can only
|
||||
* compare the global vert index. */
|
||||
/**
|
||||
* At this stage of the computation we don't have triangle adjacent info anymore,
|
||||
* so we can only compare the global vert index.
|
||||
*/
|
||||
static bool lineart_triangle_share_edge(const LineartTriangle *l, const LineartTriangle *r)
|
||||
{
|
||||
if (l->v[0]->index == r->v[0]->index) {
|
||||
|
@ -2242,7 +2277,9 @@ static LineartVert *lineart_triangle_share_point(const LineartTriangle *l,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* To save time and prevent overlapping lines when computing intersection lines. */
|
||||
/**
|
||||
* To save time and prevent overlapping lines when computing intersection lines.
|
||||
*/
|
||||
static bool lineart_vert_already_intersected_2v(LineartVertIntersection *rv,
|
||||
LineartVertIntersection *v1,
|
||||
LineartVertIntersection *v2)
|
||||
|
@ -2258,9 +2295,10 @@ static void lineart_vert_set_intersection_2v(LineartVert *rv, LineartVert *v1, L
|
|||
irv->isec2 = v2->index;
|
||||
}
|
||||
|
||||
/* This tests a triangle against a virtual line represented by v1---v2. The vertices returned
|
||||
* after
|
||||
* repeated calls to this function is then used to create a triangle/triangle intersection line.
|
||||
/**
|
||||
* This tests a triangle against a virtual line represented by `v1---v2`.
|
||||
* The vertices returned after repeated calls to this function
|
||||
* is then used to create a triangle/triangle intersection line.
|
||||
*/
|
||||
static LineartVert *lineart_triangle_2v_intersection_test(LineartRenderBuffer *rb,
|
||||
LineartVert *v1,
|
||||
|
@ -2327,7 +2365,9 @@ static LineartVert *lineart_triangle_2v_intersection_test(LineartRenderBuffer *r
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Test if two triangles intersect. Generates one intersection line if the check succeeds */
|
||||
/**
|
||||
* Test if two triangles intersect. Generates one intersection line if the check succeeds.
|
||||
*/
|
||||
static LineartEdge *lineart_triangle_intersect(LineartRenderBuffer *rb,
|
||||
LineartTriangle *rt,
|
||||
LineartTriangle *testing)
|
||||
|
@ -2351,8 +2391,8 @@ static LineartEdge *lineart_triangle_intersect(LineartRenderBuffer *rb,
|
|||
LineartVert *share = lineart_triangle_share_point(testing, rt);
|
||||
|
||||
if (share) {
|
||||
/* If triangles have sharing points like (abc) and (acd), then we only need to detect bc
|
||||
* against acd or cd against abc.*/
|
||||
/* If triangles have sharing points like `abc` and `acd`, then we only need to detect `bc`
|
||||
* against `acd` or `cd` against `abc`. */
|
||||
|
||||
LineartVert *new_share;
|
||||
lineart_triangle_get_other_verts(rt, share, &sv1, &sv2);
|
||||
|
@ -2448,8 +2488,8 @@ static LineartEdge *lineart_triangle_intersect(LineartRenderBuffer *rb,
|
|||
|
||||
/* This z transformation is not the same as the rest of the part, because the data don't go
|
||||
* through normal perspective division calls in the pipeline, but this way the 3D result and
|
||||
* occlution on the generated line is correct, and we don't really use 2D for viewport stroke
|
||||
* generation anyway.*/
|
||||
* occlusion on the generated line is correct, and we don't really use 2D for viewport stroke
|
||||
* generation anyway. */
|
||||
v1->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(v1->fbcoord[2]) * (ZMax - ZMin));
|
||||
v2->fbcoord[2] = ZMin * ZMax / (ZMax - fabs(v2->fbcoord[2]) * (ZMax - ZMin));
|
||||
|
||||
|
@ -2539,7 +2579,9 @@ static void lineart_triangle_intersect_in_bounding_area(LineartRenderBuffer *rb,
|
|||
}
|
||||
}
|
||||
|
||||
/* The calculated view vector will point towards the far-plane from the camera position. */
|
||||
/**
|
||||
* The calculated view vector will point towards the far-plane from the camera position.
|
||||
*/
|
||||
static void lineart_main_get_view_vector(LineartRenderBuffer *rb)
|
||||
{
|
||||
float direction[3] = {0, 0, 1};
|
||||
|
@ -2626,7 +2668,7 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene,
|
|||
double clipping_offset = 0;
|
||||
|
||||
if (lmd->calculation_flags & LRT_ALLOW_CLIPPING_BOUNDARIES) {
|
||||
/* This way the clipped lines are "stablely visible" by prevents depth buffer artefacts. */
|
||||
/* This way the clipped lines are "stably visible" by prevents depth buffer artifacts. */
|
||||
clipping_offset = 0.0001;
|
||||
}
|
||||
|
||||
|
@ -2740,7 +2782,9 @@ static void lineart_main_bounding_area_make_initial(LineartRenderBuffer *rb)
|
|||
}
|
||||
}
|
||||
|
||||
/* Re-link adjacent tiles after one gets subdivided. */
|
||||
/**
|
||||
* Re-link adjacent tiles after one gets subdivided.
|
||||
*/
|
||||
static void lineart_bounding_areas_connect_new(LineartRenderBuffer *rb, LineartBoundingArea *root)
|
||||
{
|
||||
LineartBoundingArea *ba = root->child, *tba;
|
||||
|
@ -2874,14 +2918,16 @@ static void lineart_bounding_areas_connect_new(LineartRenderBuffer *rb, LineartB
|
|||
}
|
||||
}
|
||||
|
||||
/* Finally clear parent'scene adjacent list. */
|
||||
/* Finally clear parent's adjacent list. */
|
||||
BLI_listbase_clear(&root->lp);
|
||||
BLI_listbase_clear(&root->rp);
|
||||
BLI_listbase_clear(&root->up);
|
||||
BLI_listbase_clear(&root->bp);
|
||||
}
|
||||
|
||||
/* Subdivide a tile after one tile contains too many triangles. */
|
||||
/**
|
||||
* Subdivide a tile after one tile contains too many triangles.
|
||||
*/
|
||||
static void lineart_bounding_area_split(LineartRenderBuffer *rb,
|
||||
LineartBoundingArea *root,
|
||||
int recursive_level)
|
||||
|
@ -3028,8 +3074,10 @@ static bool lineart_bounding_area_triangle_intersect(LineartRenderBuffer *fb,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* 1) Link triangles with bounding areas for later occlusion test.
|
||||
* 2) Test triangles with existing(added previously) triangles for intersection lines. */
|
||||
/**
|
||||
* 1) Link triangles with bounding areas for later occlusion test.
|
||||
* 2) Test triangles with existing(added previously) triangles for intersection lines.
|
||||
*/
|
||||
static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
|
||||
LineartBoundingArea *root_ba,
|
||||
LineartTriangle *rt,
|
||||
|
@ -3045,9 +3093,9 @@ static void lineart_bounding_area_link_triangle(LineartRenderBuffer *rb,
|
|||
lineart_list_append_pointer_pool(&root_ba->linked_triangles, &rb->render_data_pool, rt);
|
||||
root_ba->triangle_count++;
|
||||
/* If splitting doesn't improve triangle separation, then shouldn't allow splitting anymore.
|
||||
* Here we use recursive limit. This is espetially useful in ortho render, where a lot of
|
||||
* faces could easily line up perfectly in image space, which can not be separated by simply
|
||||
* slicing the image tile. */
|
||||
* Here we use recursive limit. This is especially useful in orthographic render,
|
||||
* where a lot of faces could easily line up perfectly in image space,
|
||||
* which can not be separated by simply slicing the image tile. */
|
||||
if (root_ba->triangle_count > 200 && recursive && recursive_level < 10) {
|
||||
lineart_bounding_area_split(rb, root_ba, recursive_level);
|
||||
}
|
||||
|
@ -3112,7 +3160,9 @@ static void lineart_bounding_area_link_line(LineartRenderBuffer *rb,
|
|||
}
|
||||
}
|
||||
|
||||
/* Link lines to their respective bounding areas. */
|
||||
/**
|
||||
* Link lines to their respective bounding areas.
|
||||
*/
|
||||
static void lineart_main_link_lines(LineartRenderBuffer *rb)
|
||||
{
|
||||
LRT_ITER_ALL_LINES_BEGIN
|
||||
|
@ -3206,8 +3256,7 @@ static bool lineart_get_edge_bounding_areas(LineartRenderBuffer *rb,
|
|||
(*rowend) = rb->tile_count_y - (int)((b[2] + 1.0) / sp_h) - 1;
|
||||
(*rowbegin) = rb->tile_count_y - (int)((b[3] + 1.0) / sp_h) - 1;
|
||||
|
||||
/* It'scene possible that the line stretches too much out to the side, resulting negative value
|
||||
. */
|
||||
/* It's possible that the line stretches too much out to the side, resulting negative value. */
|
||||
if ((*rowend) < (*rowbegin)) {
|
||||
(*rowend) = rb->tile_count_y - 1;
|
||||
}
|
||||
|
@ -3224,7 +3273,9 @@ static bool lineart_get_edge_bounding_areas(LineartRenderBuffer *rb,
|
|||
return true;
|
||||
}
|
||||
|
||||
/* This only gets initial "biggest" tile. */
|
||||
/**
|
||||
* This only gets initial "biggest" tile.
|
||||
*/
|
||||
LineartBoundingArea *MOD_lineart_get_parent_bounding_area(LineartRenderBuffer *rb,
|
||||
double x,
|
||||
double y)
|
||||
|
@ -3296,7 +3347,9 @@ static LineartBoundingArea *lineart_get_bounding_area(LineartRenderBuffer *rb, d
|
|||
return iba;
|
||||
}
|
||||
|
||||
/* Wrapper for more convenience. */
|
||||
/**
|
||||
* Wrapper for more convenience.
|
||||
*/
|
||||
LineartBoundingArea *MOD_lineart_get_bounding_area(LineartRenderBuffer *rb, double x, double y)
|
||||
{
|
||||
LineartBoundingArea *ba;
|
||||
|
@ -3306,7 +3359,9 @@ LineartBoundingArea *MOD_lineart_get_bounding_area(LineartRenderBuffer *rb, doub
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* Sequentially add triangles into render buffer. This also does intersection along the way. */
|
||||
/**
|
||||
* Sequentially add triangles into render buffer. This also does intersection along the way.
|
||||
*/
|
||||
static void lineart_main_add_triangles(LineartRenderBuffer *rb)
|
||||
{
|
||||
LineartTriangle *rt;
|
||||
|
@ -3340,8 +3395,10 @@ static void lineart_main_add_triangles(LineartRenderBuffer *rb)
|
|||
}
|
||||
}
|
||||
|
||||
/* This function gets the tile for the point e->v1, and later use lineart_bounding_area_next() to
|
||||
* get next along the way. */
|
||||
/**
|
||||
* This function gets the tile for the point `e->v1`, and later use #lineart_bounding_area_next()
|
||||
* to get next along the way.
|
||||
*/
|
||||
static LineartBoundingArea *lineart_edge_first_bounding_area(LineartRenderBuffer *rb,
|
||||
LineartEdge *e)
|
||||
{
|
||||
|
@ -3374,8 +3431,10 @@ static LineartBoundingArea *lineart_edge_first_bounding_area(LineartRenderBuffer
|
|||
return lineart_get_bounding_area(rb, data[0], data[1]);
|
||||
}
|
||||
|
||||
/* This march along one render line in image space and
|
||||
* get the next bounding area the line is crossing. */
|
||||
/**
|
||||
* This march along one render line in image space and
|
||||
* get the next bounding area the line is crossing.
|
||||
*/
|
||||
static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this,
|
||||
LineartEdge *e,
|
||||
double x,
|
||||
|
@ -3458,7 +3517,7 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
|
|||
}
|
||||
}
|
||||
}
|
||||
/* If the line is compeletely horizontal, in which Y diffence == 0. */
|
||||
/* If the line is completely horizontal, in which Y difference == 0. */
|
||||
else {
|
||||
r1 = ratiod(e->v1->fbcoord[0], e->v2->fbcoord[0], this->r);
|
||||
if (r1 > 1) {
|
||||
|
@ -3588,14 +3647,16 @@ static LineartBoundingArea *lineart_bounding_area_next(LineartBoundingArea *this
|
|||
}
|
||||
}
|
||||
else {
|
||||
/* egment has no length. */
|
||||
/* Segment has no length. */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This is the entry point of all line art calculations. */
|
||||
/**
|
||||
* This is the entry point of all line art calculations.
|
||||
*/
|
||||
int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifierData *lmd)
|
||||
{
|
||||
LineartRenderBuffer *rb;
|
||||
|
@ -3616,7 +3677,7 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
|
|||
* occlusion levels will get ignored. */
|
||||
rb->max_occlusion_level = MAX2(lmd->level_start, lmd->level_end);
|
||||
|
||||
/* FIXME: (Yiming) See definition of int LineartRenderBuffer::_source_type for detailes. */
|
||||
/* FIXME(Yiming): See definition of int #LineartRenderBuffer::_source_type for detailed. */
|
||||
rb->_source_type = lmd->source_type;
|
||||
rb->_source_collection = lmd->source_collection;
|
||||
rb->_source_object = lmd->source_object;
|
||||
|
@ -3638,7 +3699,7 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
|
|||
* correct coordinates of those clipped lines. Done in two steps,
|
||||
* setting clip_far==false for near plane. */
|
||||
lineart_main_cull_triangles(rb, false);
|
||||
/* clip_far==true for far plane. */
|
||||
/* `clip_far == true` for far plane. */
|
||||
lineart_main_cull_triangles(rb, true);
|
||||
|
||||
/* At this point triangle adjacent info pointers is no longer needed, free them. */
|
||||
|
@ -3676,7 +3737,7 @@ int MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, LineartGpencilModifi
|
|||
MOD_lineart_chain_split_for_fixed_occlusion(rb);
|
||||
|
||||
/* Then we connect chains based on the _proximity_ of their end points in image space, here's
|
||||
* the place threashold value gets involved. */
|
||||
* the place threshold value gets involved. */
|
||||
|
||||
/* do_geometry_space = true. */
|
||||
MOD_lineart_chain_connect(rb);
|
||||
|
@ -3795,8 +3856,8 @@ static void lineart_gpencil_generate(LineartRenderBuffer *rb,
|
|||
}
|
||||
}
|
||||
|
||||
/* Preserved: If we ever do async generation, this picked flag should be set here. */
|
||||
/* rlc->picked = 1;. */
|
||||
/* Preserved: If we ever do asynchronous generation, this picked flag should be set here. */
|
||||
// rlc->picked = 1;
|
||||
|
||||
int array_idx = 0;
|
||||
int count = MOD_lineart_chain_count(rlc);
|
||||
|
@ -3810,8 +3871,8 @@ static void lineart_gpencil_generate(LineartRenderBuffer *rb,
|
|||
stroke_data[array_idx + 1] = rlci->gpos[1];
|
||||
stroke_data[array_idx + 2] = rlci->gpos[2];
|
||||
mul_m4_v3(gp_obmat_inverse, &stroke_data[array_idx]);
|
||||
stroke_data[array_idx + 3] = 1; /* thickness. */
|
||||
stroke_data[array_idx + 4] = opacity; /* hardness?. */
|
||||
stroke_data[array_idx + 3] = 1; /* thickness. */
|
||||
stroke_data[array_idx + 4] = opacity; /* hardness?. */
|
||||
array_idx += 5;
|
||||
}
|
||||
|
||||
|
@ -3882,7 +3943,9 @@ static void lineart_gpencil_generate(LineartRenderBuffer *rb,
|
|||
}
|
||||
}
|
||||
|
||||
/* Wrapper for external calls. */
|
||||
/**
|
||||
* Wrapper for external calls.
|
||||
*/
|
||||
void MOD_lineart_gpencil_generate(LineartRenderBuffer *rb,
|
||||
Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
|
|
|
@ -277,7 +277,7 @@ static int lineart_gpencil_bake_common(bContext *C,
|
|||
BLI_linklist_prepend(&bj->objects, ob);
|
||||
}
|
||||
else {
|
||||
/* CTX_DATA_BEGIN is not available for interating in objects while using the Job system. */
|
||||
/* #CTX_DATA_BEGIN is not available for iterating in objects while using the job system. */
|
||||
CTX_DATA_BEGIN (C, Object *, ob, visible_objects) {
|
||||
if (ob->type == OB_GPENCIL) {
|
||||
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
|
||||
|
|
|
@ -176,12 +176,12 @@ typedef enum eImBufFlags {
|
|||
|
||||
/** \} */
|
||||
typedef struct ImBuf {
|
||||
struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */
|
||||
struct ImBuf *next, *prev; /** < allow lists of #ImBufs, for caches or flip-books. */
|
||||
|
||||
/* dimensions */
|
||||
/** Width and Height of our image buffer.
|
||||
* Should be 'unsigned int' since most formats use this.
|
||||
* but this is problematic with texture math in imagetexture.c
|
||||
* but this is problematic with texture math in `imagetexture.c`
|
||||
* avoid problems and use int. - campbell */
|
||||
int x, y;
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
|
|||
AVDictionary *codec_opts = NULL;
|
||||
/* High quality preset value. */
|
||||
av_dict_set_int(&codec_opts, "crf", crf, 0);
|
||||
/* Prefer smaller filesize. */
|
||||
/* Prefer smaller file-size. */
|
||||
av_dict_set(&codec_opts, "preset", "slow", 0);
|
||||
/* Thread count. */
|
||||
av_dict_set_int(&codec_opts, "threads", BLI_system_thread_count(), 0);
|
||||
|
|
|
@ -846,8 +846,10 @@ typedef struct LineartGpencilModifierData {
|
|||
struct Material *target_material;
|
||||
char target_layer[64];
|
||||
|
||||
/** These two variables are to pass on vertex group information from mesh to strokes.
|
||||
* vgname specifies which vertex groups our strokes from source_vertex_group will go to. */
|
||||
/**
|
||||
* These two variables are to pass on vertex group information from mesh to strokes.
|
||||
* `vgname` specifies which vertex groups our strokes from source_vertex_group will go to.
|
||||
*/
|
||||
char source_vertex_group[64];
|
||||
char vgname[64];
|
||||
|
||||
|
@ -857,10 +859,10 @@ typedef struct LineartGpencilModifierData {
|
|||
unsigned char transparency_flags; /* eLineartGpencilTransparencyFlags */
|
||||
unsigned char transparency_mask;
|
||||
|
||||
/** 0-1 range for cosine angle */
|
||||
/** `0..1` range for cosine angle */
|
||||
float crease_threshold;
|
||||
|
||||
/** 0-PI angle, for splitting strokes at sharp points */
|
||||
/** `0..PI` angle, for splitting strokes at sharp points. */
|
||||
float angle_splitting_threshold;
|
||||
|
||||
/* CPU mode */
|
||||
|
|
|
@ -57,12 +57,12 @@ typedef enum eLineartEdgeFlag {
|
|||
LRT_EDGE_FLAG_CREASE = (1 << 2),
|
||||
LRT_EDGE_FLAG_MATERIAL = (1 << 3),
|
||||
LRT_EDGE_FLAG_INTERSECTION = (1 << 4),
|
||||
/** floating edge, unimplemented yet */
|
||||
/** Floating edge, unimplemented yet. */
|
||||
LRT_EDGE_FLAG_FLOATING = (1 << 5),
|
||||
/** also used as discarded line mark */
|
||||
/** Also used as discarded line mark. */
|
||||
LRT_EDGE_FLAG_CHAIN_PICKED = (1 << 6),
|
||||
LRT_EDGE_FLAG_CLIPPED = (1 << 7),
|
||||
/* Maxed out for 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */
|
||||
/** Limited to 8 bits, DON'T ADD ANYMORE until improvements on the data structure. */
|
||||
} eLineartEdgeFlag;
|
||||
|
||||
#define LRT_EDGE_FLAG_ALL_TYPE 0x3f
|
||||
|
|
|
@ -1081,9 +1081,11 @@ typedef struct NodeCryptomatte_Runtime {
|
|||
} NodeCryptomatte_Runtime;
|
||||
|
||||
typedef struct NodeCryptomatte {
|
||||
/* iuser needs to be first element due to RNA limitations.
|
||||
* When we define the ImageData properties, we can't define them from
|
||||
* storage->iuser, so storage needs to be casted to ImageUser directly. */
|
||||
/**
|
||||
* `iuser` needs to be first element due to RNA limitations.
|
||||
* When we define the #ImageData properties, we can't define them from
|
||||
* `storage->iuser`, so storage needs to be cast to #ImageUser directly.
|
||||
*/
|
||||
ImageUser iuser;
|
||||
|
||||
/* Contains `CryptomatteEntry`. */
|
||||
|
|
|
@ -281,7 +281,7 @@ typedef struct ThemeSpace {
|
|||
unsigned char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4];
|
||||
/** Solid faces. */
|
||||
unsigned char face[4], face_select[4], face_back[4], face_front[4];
|
||||
/** selected color. */
|
||||
/** Selected color. */
|
||||
unsigned char face_dot[4];
|
||||
unsigned char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4];
|
||||
unsigned char normal[4];
|
||||
|
|
|
@ -88,10 +88,10 @@ static void rna_Sequences_move_strip_to_meta(ID *id,
|
|||
{
|
||||
Scene *scene = (Scene *)id;
|
||||
|
||||
/* Move strip to meta */
|
||||
/* Move strip to meta. */
|
||||
SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst);
|
||||
|
||||
/* Udate depsgraph */
|
||||
/* Update depsgraph. */
|
||||
DEG_relations_tag_update(bmain);
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class SocketRef : NonCopyable, NonMovable {
|
|||
PointerRNA rna_;
|
||||
Vector<LinkRef *> directly_linked_links_;
|
||||
|
||||
/* These sockets are linked directly, i.e. with a single link inbetween. */
|
||||
/* These sockets are linked directly, i.e. with a single link in between. */
|
||||
MutableSpan<SocketRef *> directly_linked_sockets_;
|
||||
/* These sockets are linked when reroutes, muted links and muted nodes have been taken into
|
||||
* account. */
|
||||
|
|
Loading…
Reference in New Issue