11 #include "../application/AppCanvas.h"
12 #include "../application/AppConfig.h"
13 #include "../application/AppView.h"
14 #include "../application/Controller.h"
108 cout <<
"FRS_set_context: context 0x" <<
C <<
" scene 0x" <<
CTX_data_scene(
C) << endl;
133 float thickness = 1.0f;
139 thickness =
height / 480.0f;
153 cout <<
"\n=== Dimensions of the 2D image coordinate system ===" << endl;
154 cout <<
"Width : " <<
width << endl;
155 cout <<
"Height : " <<
height << endl;
157 cout <<
"Border : (" << xmin <<
", " << ymin <<
") - (" << xmax <<
", " << ymax <<
")"
160 cout <<
"Unit line thickness : " << thickness <<
" pixel(s)" << endl;
166 char *s = (
char *)
MEM_mallocN(strlen(name) * 2 + 1,
"escape_quotes");
180 const char *fmt =
"__import__('parameter_editor').process('%s', '%s')\n";
200 int target_condition = 0;
201 int num_non_target_positive_conditions = 0;
202 int num_non_target_negative_conditions = 0;
204 for (
int i = 0; i < num_edge_types; i++) {
205 if (conditions[i].edge_type == target) {
206 target_condition = conditions[i].
value;
208 else if (conditions[i].value > 0) {
209 ++num_non_target_positive_conditions;
211 else if (conditions[i].value < 0) {
212 ++num_non_target_negative_conditions;
219 if (num_non_target_positive_conditions > 0) {
222 if (target_condition > 0) {
225 if (target_condition < 0) {
228 if (num_non_target_negative_conditions > 0) {
233 if (target_condition > 0) {
236 if (num_non_target_negative_conditions > 0) {
239 if (target_condition < 0) {
242 if (num_non_target_positive_conditions > 0) {
249 if (target_condition > 0) {
252 if (target_condition < 0) {
256 if (num_non_target_positive_conditions > 0) {
259 if (num_non_target_negative_conditions > 0) {
264 if (num_non_target_negative_conditions > 0) {
267 if (num_non_target_positive_conditions > 0) {
293 cout <<
"\n=== Rendering options ===" << endl;
297 switch (config->
mode) {
300 cout <<
"Modules :" << endl;
304 module_conf = module_conf->next) {
305 if (module_conf->script && module_conf->is_displayed) {
306 const char *
id_name = module_conf->script->id.name + 2;
308 cout <<
" " << layer_count + 1 <<
": " <<
id_name;
309 if (module_conf->script->filepath) {
310 cout <<
" (" << module_conf->script->filepath <<
")";
330 int use_ridges_and_valleys = 0;
331 int use_suggestive_contours = 0;
332 int use_material_boundaries = 0;
346 cout <<
"Linesets:" << endl;
349 lineset = lineset->next) {
352 cout <<
" " << layer_count + 1 <<
": " << lineset->name <<
" - "
353 << (lineset->linestyle ? (lineset->linestyle->id.name + 2) :
"<NULL>") << endl;
360 ++use_ridges_and_valleys;
361 ++use_suggestive_contours;
362 ++use_material_boundaries;
366 for (
int i = 0; i < num_edge_types; i++) {
367 if (!(lineset->edge_types & conditions[i].
edge_type)) {
368 conditions[i].
value = 0;
370 else if (!(lineset->exclude_edge_types & conditions[i].
edge_type)) {
371 conditions[i].
value = 1;
374 conditions[i].
value = -1;
385 for (
int i = 0; i < num_edge_types; i++) {
386 conditions[i].
value *= -1;
388 logical_and = !logical_and;
392 ++use_ridges_and_valleys;
399 ++use_suggestive_contours;
406 ++use_material_boundaries;
432 cout <<
"Ridges and valleys : "
434 cout <<
"Suggestive contours : "
436 cout <<
"Suggestive contour Kr derivative epsilon : "
438 cout <<
"Material boundaries : "
445 bool diffuse =
false,
z =
false;
457 cout <<
"Passes :" << endl;
458 cout <<
" Diffuse = " << (diffuse ?
"enabled" :
"disabled") << endl;
459 cout <<
" Z = " << (
z ?
"enabled" :
"disabled") << endl;
476 float *
src, *
dest, *pixSrc, *pixDest;
477 int x,
y, rectx, recty;
479 if (freestyle_render ==
nullptr || freestyle_render->
result ==
nullptr) {
491 cout <<
"No source render layer to composite" << endl;
499 cout <<
"No source result image to composite" << endl;
505 cout <<
"src: " << rl->
rectx <<
" x " << rl->
recty << endl;
512 cout <<
"No destination render layer to composite to" << endl;
527 cout <<
"No destination result image to composite to" << endl;
533 cout <<
"dest: " << rl->
rectx <<
" x " << rl->
recty << endl;
539 for (
y = 0;
y < recty;
y++) {
540 for (
x = 0;
x < rectx;
x++) {
541 pixSrc =
src + 4 * (rectx *
y +
x);
542 if (pixSrc[3] > 0.0) {
543 pixDest =
dest + 4 * (rectx *
y +
x);
569 lineset = lineset->next) {
589 cout <<
"#===============================================================" << endl;
590 cout <<
"# Freestyle" << endl;
591 cout <<
"#===============================================================" << endl;
612 cout <<
"----------------------------------------------------------" << endl;
613 cout <<
"| " << (re->
scene->
id.
name + 2) <<
"|" << view_layer->
name << endl;
614 cout <<
"----------------------------------------------------------" << endl;
642 cout <<
"Break" << endl;
654 Render *freestyle_render =
nullptr;
655 if (strokeCount > 0) {
663 if (freestyle_render) {
684 printf(
"View map cache freed\n");
735 if (lineset->
group) {
737 lineset->
group =
nullptr;
769 Material *ma = BlenderStrokeRenderer::GetStrokeShader(bmain, nt,
true);
void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
struct Scene * CTX_data_scene(const bContext *C)
bool BKE_freestyle_lineset_delete(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
void BKE_freestyle_lineset_unique_name(struct FreestyleConfig *config, struct FreestyleLineSet *lineset)
struct FreestyleLineSet * BKE_freestyle_lineset_get_active(struct FreestyleConfig *config)
void id_us_min(struct ID *id)
void id_us_plus(struct ID *id)
Blender kernel freestyle line style functionality.
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph)
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
void unit_m4(float m[4][4])
MINLINE void zero_v3(float r[3])
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
Depsgraph * DEG_graph_new(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, eEvaluationMode mode)
struct Depsgraph Depsgraph
void DEG_graph_free(Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
Object groups, one object can be in many groups at once.
@ FREESTYLE_FACE_SMOOTHNESS_FLAG
@ FREESTYLE_MATERIAL_BOUNDARIES_FLAG
@ FREESTYLE_RIDGES_AND_VALLEYS_FLAG
@ FREESTYLE_VIEW_MAP_CACHE
@ FREESTYLE_SUGGESTIVE_CONTOURS_FLAG
@ FREESTYLE_AS_RENDER_PASS
@ FREESTYLE_FE_SILHOUETTE
@ FREESTYLE_FE_RIDGE_VALLEY
@ FREESTYLE_FE_EXTERNAL_CONTOUR
@ FREESTYLE_FE_SUGGESTIVE_CONTOUR
@ FREESTYLE_FE_MATERIAL_BOUNDARY
@ FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE
@ FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE
@ FREESTYLE_SEL_EDGE_TYPES
@ FREESTYLE_LINESET_FE_AND
@ FREESTYLE_LINESET_ENABLED
@ FREESTYLE_LINESET_CURRENT
@ FREESTYLE_LINESET_FE_NOT
@ FREESTYLE_CONTROL_EDITOR_MODE
@ FREESTYLE_CONTROL_SCRIPT_MODE
#define RE_PASSNAME_COMBINED
#define R_LINE_THICKNESS_ABSOLUTE
#define RE_PASSNAME_DIFFUSE_COLOR
#define RE_PASSNAME_FREESTYLE
#define R_LINE_THICKNESS_RELATIVE
void FRS_paste_active_lineset(FreestyleConfig *config)
void FRS_end_stroke_rendering(Render *)
static bool test_edge_type_conditions(struct edge_type_condition *conditions, int num_edge_types, bool logical_and, int target, bool distinct)
struct FreestyleGlobals g_freestyle
static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_render)
int FRS_is_freestyle_enabled(ViewLayer *view_layer)
static void init_view(Render *re)
static char * escape_quotes(char *name)
static bool lineset_copied
static int displayed_layer_count(ViewLayer *view_layer)
bool FRS_move_active_lineset(FreestyleConfig *config, int direction)
void FRS_delete_active_lineset(FreestyleConfig *config)
static bCallbackFuncStore load_post_callback_funcstore
static void load_post_callback(struct Main *, struct PointerRNA **, const int, void *)
void FRS_begin_stroke_rendering(Render *UNUSED(re))
void FRS_init_stroke_renderer(Render *re)
void FRS_free_view_map_cache(void)
static char * create_lineset_handler(char *layer_name, char *lineset_name)
void FRS_set_context(bContext *C)
static Controller * controller
Material * FRS_create_stroke_material(Main *bmain, struct FreestyleLineStyle *linestyle)
static bool freestyle_is_initialized
static Config::Path * pathconfig
void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer)
void FRS_copy_active_lineset(FreestyleConfig *config)
static FreestyleLineSet lineset_buffer
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
void setHeight(unsigned int height)
void setWidth(unsigned int width)
void setBorder(int xmin, int ymin, int xmax, int ymax)
void setThickness(float thickness)
Render * RenderStrokes(Render *re, bool render)
void setComputeSuggestiveContoursFlag(bool b)
void setPassZ(float *buf, int width, int height)
bool getFaceSmoothness() const
bool getComputeMaterialBoundariesFlag() const
void toggleLayer(unsigned index, bool iDisplay)
void setSphereRadius(float s)
void setComputeMaterialBoundariesFlag(bool b)
void setVisibilityAlgo(int algo)
void setComputeRidgesAndValleysFlag(bool b)
void setFaceSmoothness(bool iBool)
void setPassDiffuse(float *buf, int width, int height)
float getSphereRadius() const
void DeleteViewMap(bool freeCache=false)
int LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
bool getComputeSuggestiveContoursFlag() const
void setViewMapCache(bool iBool)
void setContext(bContext *C)
void setSuggestiveContourKrDerivativeEpsilon(float dkr)
void setCreaseAngle(float angle)
float getCreaseAngle() const
void InsertStyleModule(unsigned index, const char *iFileName)
bool getComputeRidgesAndValleysFlag() const
float getSuggestiveContourKrDerivativeEpsilon() const
void setView(AppView *iView)
void setRenderMonitor(RenderMonitor *iRenderMonitor)
std::string id_name(void *id)
FreestyleLineStyle linestyle
const Depsgraph * depsgraph
SyclQueue void void * src
struct Object * RE_GetCamera(Render *re)
void RE_GetCameraWindow(struct Render *re, const struct Object *camera, float r_winmat[4][4])
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
void RE_FreeRender(Render *re)
RenderLayer * render_get_active_layer(Render *re, RenderResult *rr)
RenderLayer * RE_GetRenderLayer(RenderResult *rr, const char *name)
float * RE_RenderLayerGetPass(RenderLayer *rl, const char *name, const char *viewname)
static struct PyModuleDef module
void RE_create_render_pass(RenderResult *rr, const char *name, int channels, const char *chan_id, const char *layername, const char *viewname, const bool allocate)
struct Collection * group
struct FreestyleLineStyle * linestyle
struct bNodeTree * nodetree
float unit_line_thickness
void(* stats_draw)(void *handle, RenderStats *ri)
int(* test_break)(void *handle)
struct FreestyleConfig freestyle_config