23 #include "../application/AppConfig.h"
24 #include "../stroke/Canvas.h"
157 object_camera->loc[2] = 1.0f;
216 bNode *output_linestyle =
nullptr;
230 output_linestyle =
node;
243 input_attr_color->
locx = 0.0f;
244 input_attr_color->
locy = -200.0f;
250 mix_rgb_color->
locx = 200.0f;
251 mix_rgb_color->
locy = -200.0f;
257 input_attr_alpha->
locx = 400.0f;
258 input_attr_alpha->
locy = 300.0f;
264 mix_rgb_alpha->
locx = 600.0f;
265 mix_rgb_alpha->
locy = 300.0f;
271 shader_emission->
locx = 400.0f;
272 shader_emission->
locy = -200.0f;
275 input_light_path->
locx = 400.0f;
276 input_light_path->
locy = 100.0f;
279 mix_shader_color->
locx = 600.0f;
280 mix_shader_color->
locy = -100.0f;
283 shader_transparent->
locx = 600.0f;
284 shader_transparent->
locy = 100.0f;
287 mix_shader_alpha->
locx = 800.0f;
288 mix_shader_alpha->
locy = 100.0f;
291 output_material->
locx = 1000.0f;
292 output_material->
locy = 100.0f;
330 if (output_linestyle) {
373 color[0] = color[1] = color[2] =
RNA_float_get(&fromptr,
"default_value");
397 input_uvmap->
locx =
node->locx - 200.0f;
440 const vector<Strip *> &strips = iStrokeRep->
getStrips();
441 const bool hasTex = iStrokeRep->
hasTex();
442 int totvert = 0, totedge = 0, totpoly = 0, totloop = 0;
443 int visible_faces, visible_segments;
444 for (vector<Strip *>::const_iterator s = strips.begin(), send = strips.end(); s != send; ++s) {
449 if (visible_faces == 0) {
453 totvert += visible_faces + visible_segments * 2;
454 totedge += visible_faces * 2 + visible_segments;
455 totpoly += visible_faces;
456 totloop += visible_faces * 3;
462 if (groups->empty() || !(groups->back()->totvert + totvert <
MESH_MAX_VERTS &&
463 groups->back()->materials.size() + 1 <
MAXMAT)) {
465 groups->push_back(group);
468 group = groups->back();
470 group->
strokes.push_back(iStrokeRep);
487 xl = xu = yl = yu = 0;
488 for (
int i = 0; i < 3; i++) {
503 return !(xl == 3 || xu == 3 || yl == 3 || yu == 3);
509 int *visible_segments)
const
511 const int strip_vertex_count = strip_vertices.size();
512 Strip::vertex_container::iterator
v[3];
519 v[0] = strip_vertices.begin();
522 *visible_faces = *visible_segments = 0;
524 for (
int n = 2; n < strip_vertex_count; n++,
v[0]++,
v[1]++,
v[2]++) {
531 (*visible_segments)++;
544 vector<StrokeGroup *>::const_iterator it, itend;
557 vector<StrokeGroup *>::const_iterator it, itend;
605 MLoopUV *loopsuv[2] = {
nullptr};
633 const int matnr = item.value;
644 int vertex_index = 0, edge_index = 0, loop_index = 0;
645 int visible_faces, visible_segments;
647 Strip::vertex_container::iterator
v[3];
651 for (vector<StrokeRep *>::const_iterator it = group->
strokes.begin(),
657 vector<Strip *> &strips = (*it)->getStrips();
658 for (vector<Strip *>::const_iterator s = strips.begin(), send = strips.end(); s != send; ++s) {
660 int strip_vertex_count = strip_vertices.size();
664 if (visible_faces == 0) {
668 v[0] = strip_vertices.begin();
676 for (
int n = 2; n < strip_vertex_count; n++,
v[0]++,
v[1]++,
v[2]++) {
686 vertices->
co[0] = svRep[0]->
point2d()[0];
687 vertices->
co[1] = svRep[0]->
point2d()[1];
691 vertices->
no[2] = SHRT_MAX;
696 vertices->
co[0] = svRep[1]->
point2d()[0];
697 vertices->
co[1] = svRep[1]->
point2d()[1];
701 vertices->
no[2] = SHRT_MAX;
706 edges->
v1 = vertex_index - 2;
707 edges->
v2 = vertex_index - 1;
714 vertices->
co[0] = svRep[2]->
point2d()[0];
715 vertices->
co[1] = svRep[2]->
point2d()[1];
719 vertices->
no[2] = SHRT_MAX;
724 edges->
v1 = vertex_index - 1;
725 edges->
v2 = vertex_index - 3;
729 edges->
v1 = vertex_index - 1;
730 edges->
v2 = vertex_index - 2;
744 loops[0].
v = vertex_index - 1;
745 loops[0].
e = edge_index - 2;
747 loops[1].
v = vertex_index - 3;
748 loops[1].
e = edge_index - 3;
750 loops[2].
v = vertex_index - 2;
751 loops[2].
e = edge_index - 1;
754 loops[0].
v = vertex_index - 1;
755 loops[0].
e = edge_index - 1;
757 loops[1].
v = vertex_index - 2;
758 loops[1].
e = edge_index - 3;
760 loops[2].
v = vertex_index - 3;
761 loops[2].
e = edge_index - 2;
770 for (
int L = 0;
L < 2;
L++) {
799 for (
int i = 0; i < 3; i++) {
801 rgba[i][3] = svRep[i]->
alpha();
814 transp[0].
r = transp[0].
g = transp[0].
b = colors[0].
a;
815 transp[1].
r = transp[1].
g = transp[1].
b = colors[1].
a;
816 transp[2].
r = transp[2].
g = transp[2].
b = colors[2].
a;
866 cout <<
"clip_start " << camera->
clip_start <<
", clip_end " << camera->
clip_end << endl;
873 RE_RenderFreestyleStrokes(
876 return freestyle_render;
bool BKE_collection_object_add(struct Main *bmain, struct Collection *collection, struct Object *ob)
CustomData interface, see also DNA_customdata_types.h.
void CustomData_set_layer_active(struct CustomData *data, int type, int n)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
struct IDProperty * IDP_CopyProperty_ex(const struct IDProperty *prop, const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void id_us_min(struct ID *id)
void id_us_plus(struct ID *id)
struct Main * BKE_main_new(void)
void BKE_main_free(struct Main *mainvar)
General operations, lookup, etc. for materials.
void BKE_object_materials_test(struct Main *bmain, struct Object *ob, struct ID *id)
struct Material * BKE_material_add(struct Main *bmain, const char *name)
struct Mesh * BKE_mesh_add(struct Main *bmain, const char *name)
void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd)
bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask)
#define SH_NODE_MIX_SHADER
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock)
#define SH_NODE_UVALONGSTROKE
struct bNodeTree * ntreeCopyTree_ex(const struct bNodeTree *ntree, struct Main *bmain, const bool do_id_user)
void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree)
struct bNodeLink * nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock)
struct bNodeTree * ntreeAddTree(struct Main *bmain, const char *name, const char *idname)
struct bNode * nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type)
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node)
#define SH_NODE_ATTRIBUTE
#define SH_NODE_LIGHT_PATH
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_add_only_object(struct Main *bmain, int type, const char *name) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
struct Object * BKE_object_add(struct Main *bmain, struct ViewLayer *view_layer, int type, const char *name) ATTR_NONNULL(1
void BKE_scene_set_background(struct Main *bmain, struct Scene *sce)
int BKE_render_num_threads(const struct RenderData *r)
struct Scene * BKE_scene_add(struct Main *bmain, const char *name)
void BKE_scene_copy_data_eevee(struct Scene *sce_dst, const struct Scene *sce_src)
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4])
MINLINE void copy_v3fl_v3db(float r[3], const double a[3])
#define STRNCPY(dst, src)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Depsgraph * DEG_graph_new(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, eEvaluationMode mode)
void DEG_graph_id_tag_update(struct Main *bmain, struct Depsgraph *depsgraph, struct ID *id, int flag)
void DEG_graph_free(Depsgraph *graph)
void DEG_graph_tag_relations_update(struct Depsgraph *graph)
void DEG_relations_tag_update(struct Main *bmain)
void DEG_graph_relations_update(struct Depsgraph *graph)
Object groups, one object can be in many groups at once.
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
#define R_IMF_PLANES_RGBA
#define R_NO_FRAME_UPDATE
_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 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 GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction SH_NODE_BSDF_TRANSPARENT
Group RGB to Bright Vector Camera Vector Combine Material Light SH_NODE_OUTPUT_LINESTYLE
Group RGB to Bright Vector Camera Vector Combine SH_NODE_OUTPUT_MATERIAL
ATTR_WARN_UNUSED_RESULT const BMVert * v
bool test_triangle_visibility(StrokeVertexRep *svRep[3]) const
vector< StrokeGroup * > texturedStrokeGroups
vector< StrokeGroup * > strokeGroups
Render * RenderScene(Render *re, bool render)
void test_strip_visibility(Strip::vertex_container &strip_vertices, int *visible_faces, int *visible_segments) const
static const char * uvNames[]
void GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
virtual ~BlenderStrokeRenderer()
static Material * GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user)
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
float get_stroke_vertex_z(void) const
BlenderStrokeRenderer(Render *re, int render_count)
unsigned int get_stroke_mesh_id(void) const
Depsgraph * freestyle_depsgraph
int get_stroke_count() const
struct GHash * _nodetree_hash
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
std::vector< StrokeVertexRep * > vertex_container
bNodeTree * getNodeTree() const
void setMaterial(Material *mat)
vector< Strip * > & getStrips()
Vec2r & texCoord(bool tips=false)
Value lookup_default(const Key &key, const Value &default_value) const
void add_new(const Key &key, const Value &value)
ItemIterator items() const
bool contains(const Key &key) const
void *(* MEM_mallocN)(size_t len, const char *str)
Render * RE_NewSceneRender(const Scene *scene)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
vector< StrokeRep * > strokes
blender::Map< Material *, int > materials
struct bNodeTree * nodetree
struct CustomData pdata ldata
struct MLoopCol * mloopcol
struct ImageFormatData im_format
struct Collection * master_collection