18 #include "util/color.h"
33 const char *layer_name,
45 if (layer_name ==
NULL) {
55 if (attr_uv !=
NULL) {
89 return mesh->get_subd_num_corners()[face_num];
103 return mesh->get_triangles()[face_num * 3 + vert_num];
114 return face_num * 3 + vert_num;
126 const float3 vP =
mesh->get_verts()[vertex_index];
149 const float3 orco = (userdata->
orco[vertex_index] + orco_loc) / orco_size;
180 if (
mesh->get_smooth()[face_num]) {
210 const BL::Mesh &b_mesh,
const char *layer_name,
Mesh *
mesh,
bool need_sign,
bool active_render)
218 name = ustring((
string(layer_name) +
".tangent").c_str());
221 name = ustring(
"orco.tangent");
229 float3 *tangent = attr->data_float3();
231 float *tangent_sign =
NULL;
235 if (layer_name !=
NULL) {
236 name_sign = ustring((
string(layer_name) +
".tangent_sign").c_str());
239 name_sign = ustring(
"orco.tangent_sign");
254 memset(&sm_interface, 0,
sizeof(sm_interface));
264 context.m_pUserData = &userdata;
265 context.m_pInterface = &sm_interface;
270 template<
typename TypeInCycles,
typename GetValueAtIndex>
273 const BL::Attribute::domain_enum b_domain,
274 const bool subdivision,
275 const GetValueAtIndex &get_value_at_index)
278 case BL::Attribute::domain_CORNER: {
280 for (BL::MeshPolygon &p : b_mesh.polygons) {
281 int n = p.loop_total();
282 for (
int i = 0; i < n; i++) {
283 *
data = get_value_at_index(p.loop_start() + i);
289 for (BL::MeshLoopTriangle &
t : b_mesh.loop_triangles) {
290 const int index =
t.index() * 3;
291 BL::Array<int, 3> loops =
t.loops();
292 data[index] = get_value_at_index(loops[0]);
293 data[index + 1] = get_value_at_index(loops[1]);
294 data[index + 2] = get_value_at_index(loops[2]);
299 case BL::Attribute::domain_EDGE: {
300 if constexpr (std::is_same_v<TypeInCycles, uchar4>) {
307 const size_t num_verts = b_mesh.vertices.length();
310 for (BL::MeshEdge &
e : b_mesh.edges) {
311 BL::Array<int, 2> vertices =
e.vertices();
312 TypeInCycles value = get_value_at_index(
e.index());
314 data[vertices[0]] += value;
315 data[vertices[1]] += value;
316 count[vertices[0]]++;
317 count[vertices[1]]++;
320 for (
size_t i = 0; i < num_verts; i++) {
328 case BL::Attribute::domain_POINT: {
329 const int num_verts = b_mesh.vertices.length();
330 for (
int i = 0; i < num_verts; i++) {
331 data[i] = get_value_at_index(i);
335 case BL::Attribute::domain_FACE: {
337 const int num_polygons = b_mesh.polygons.length();
338 for (
int i = 0; i < num_polygons; i++) {
339 data[i] = get_value_at_index(i);
343 for (BL::MeshLoopTriangle &
t : b_mesh.loop_triangles) {
344 data[
t.index()] = get_value_at_index(
t.polygon_index());
358 if (!(b_attribute.domain() == BL::Attribute::domain_POINT) &&
359 (b_attribute.data_type() == BL::Attribute::data_type_FLOAT_VECTOR)) {
363 BL::FloatVectorAttribute b_vector_attribute(b_attribute);
364 const int numverts =
mesh->get_verts().
size();
375 float motion_times[2] = {-1.0f, 1.0f};
376 for (
int step = 0; step < 2; step++) {
377 const float relative_time = motion_times[step] * 0.5f * motion_scale;
380 for (
int i = 0; i < numverts; i++) {
381 mP[i] =
P[i] +
get_float3(b_vector_attribute.data[i].vector()) * relative_time;
389 const bool subdivision,
390 const bool need_motion,
391 const float motion_scale)
394 static const ustring u_velocity(
"velocity");
396 int attribute_index = 0;
397 int render_color_index = b_mesh.
attributes.render_color_index();
400 const ustring name{b_attribute.name().c_str()};
401 const bool is_render_color = (attribute_index++ == render_color_index);
403 if (need_motion && name == u_velocity) {
411 if (attributes.
find(name)) {
415 const BL::Attribute::domain_enum b_domain = b_attribute.domain();
416 const BL::Attribute::data_type_enum b_data_type = b_attribute.data_type();
420 case BL::Attribute::domain_CORNER:
423 case BL::Attribute::domain_POINT:
426 case BL::Attribute::domain_EDGE:
429 case BL::Attribute::domain_FACE:
439 switch (b_data_type) {
440 case BL::Attribute::data_type_FLOAT: {
441 BL::FloatAttribute b_float_attribute{b_attribute};
445 return b_float_attribute.data[i].value();
449 case BL::Attribute::data_type_BOOLEAN: {
450 BL::BoolAttribute b_bool_attribute{b_attribute};
454 return (
float)b_bool_attribute.data[i].value();
458 case BL::Attribute::data_type_INT: {
459 BL::IntAttribute b_int_attribute{b_attribute};
463 return (
float)b_int_attribute.data[i].value();
467 case BL::Attribute::data_type_FLOAT_VECTOR: {
468 BL::FloatVectorAttribute b_vector_attribute{b_attribute};
472 BL::Array<float, 3>
v = b_vector_attribute.data[i].vector();
477 case BL::Attribute::data_type_BYTE_COLOR: {
478 BL::ByteColorAttribute b_color_attribute{b_attribute};
484 if (is_render_color) {
499 BL::Array<float, 4>
v = b_color_attribute.data[i].color();
505 case BL::Attribute::data_type_FLOAT_COLOR: {
506 BL::FloatColorAttribute b_color_attribute{b_attribute};
509 if (is_render_color) {
515 BL::Array<float, 4>
v = b_color_attribute.data[i].color();
520 case BL::Attribute::data_type_FLOAT2: {
521 BL::Float2Attribute b_float2_attribute{b_attribute};
525 BL::Array<float, 2>
v = b_float2_attribute.data[i].vector();
540 if (!b_mesh.uv_layers.empty()) {
541 for (BL::MeshUVLoopLayer &
l : b_mesh.uv_layers) {
542 const bool active_render =
l.active_render();
544 ustring uv_name = ustring(
l.name().c_str());
546 ustring tangent_name = ustring((
string(
l.name().c_str()) +
".tangent").c_str());
560 if (need_uv || need_tangent) {
570 for (BL::MeshLoopTriangle &
t : b_mesh.loop_triangles) {
582 ustring sign_name = ustring((
string(
l.name().c_str()) +
".tangent_sign").c_str());
588 if (!need_uv && uv_attr !=
NULL) {
604 if (!b_mesh.uv_layers.empty()) {
605 BL::Mesh::uv_layers_iterator
l;
608 for (b_mesh.uv_layers.begin(
l);
l != b_mesh.uv_layers.end(); ++
l, ++i) {
609 bool active_render =
l->active_render();
611 ustring uv_name = ustring(
l->name().c_str());
613 ustring tangent_name = ustring((
string(
l->name().c_str()) +
".tangent").c_str());
625 if (need_uv || need_tangent) {
627 uv_attr =
mesh->subd_attributes.add(uv_std, uv_name);
637 for (BL::MeshPolygon &p : b_mesh.polygons) {
638 int n = p.loop_total();
639 for (
int j = 0; j < n; j++) {
640 *(fdata++) =
get_float2(
l->data[p.loop_start() + j].uv());
648 ustring sign_name = ustring((
string(
l->name().c_str()) +
".tangent_sign").c_str());
654 if (!need_uv && uv_attr !=
NULL) {
655 mesh->subd_attributes.remove(uv_attr);
677 bool operator()(
const int &vert_idx_a,
const int &vert_idx_b)
681 if (vert_a == vert_b) {
683 return vert_idx_a > vert_idx_b;
685 const float x1 = vert_a.
x + vert_a.
y + vert_a.
z;
686 const float x2 = vert_b.
x + vert_b.
y + vert_b.
z;
699 const int num_verts = b_mesh.vertices.length();
700 if (num_verts == 0) {
707 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
708 sorted_vert_indeices[vert_index] = vert_index;
711 sort(sorted_vert_indeices.begin(), sorted_vert_indeices.end(), compare);
716 for (
int sorted_vert_index = 0; sorted_vert_index < num_verts; ++sorted_vert_index) {
717 const int vert_index = sorted_vert_indeices[sorted_vert_index];
718 const float3 &vert_co =
mesh->get_verts()[vert_index];
720 for (
int other_sorted_vert_index = sorted_vert_index + 1; other_sorted_vert_index < num_verts;
721 ++other_sorted_vert_index) {
722 const int other_vert_index = sorted_vert_indeices[other_sorted_vert_index];
723 const float3 &other_vert_co =
mesh->get_verts()[other_vert_index];
725 if ((other_vert_co.
x + other_vert_co.
y + other_vert_co.
z) -
726 (vert_co.
x + vert_co.
y + vert_co.
z) >
731 if (
len_squared(other_vert_co - vert_co) < FLT_EPSILON) {
733 vert_orig_index[vert_index] = other_vert_index;
738 vert_orig_index[vert_index] = vert_index;
742 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
743 int orig_index = vert_orig_index[vert_index];
744 while (orig_index != vert_orig_index[orig_index]) {
745 orig_index = vert_orig_index[orig_index];
747 vert_orig_index[vert_index] = orig_index;
755 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
757 const int orig_index = vert_orig_index[vert_index];
758 vert_normal[orig_index] +=
normal;
763 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
764 const int orig_index = vert_orig_index[vert_index];
765 vert_normal[vert_index] =
normalize(vert_normal[orig_index]);
771 BL::Mesh::edges_iterator
e;
775 for (b_mesh.edges.begin(
e);
e != b_mesh.edges.end(); ++
e, ++edge_index) {
776 const int v0 = vert_orig_index[b_mesh.edges[edge_index].vertices()[0]],
777 v1 = vert_orig_index[b_mesh.edges[edge_index].vertices()[1]];
784 edge_accum[v0] += edge;
785 edge_accum[
v1] += -edge;
789 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
790 const int orig_index = vert_orig_index[vert_index];
791 if (orig_index != vert_index) {
801 raw_data[vert_index] = 0.0f;
807 float *
data = attr->data_float();
808 memcpy(
data, &raw_data[0],
sizeof(
float) * raw_data.size());
811 visited_edges.
clear();
812 for (b_mesh.edges.begin(
e);
e != b_mesh.edges.end(); ++
e, ++edge_index) {
813 const int v0 = vert_orig_index[b_mesh.edges[edge_index].vertices()[0]],
814 v1 = vert_orig_index[b_mesh.edges[edge_index].vertices()[1]];
824 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
828 for (
int vert_index = 0; vert_index < num_verts; ++vert_index) {
829 const int orig_index = vert_orig_index[vert_index];
830 data[vert_index] =
data[orig_index];
853 int number_of_vertices = b_mesh.vertices.length();
854 if (number_of_vertices == 0) {
860 for (BL::MeshEdge &
e : b_mesh.edges) {
861 vertices_sets.
join(
e.vertices()[0],
e.vertices()[1]);
869 for (BL::MeshLoopTriangle &
t : b_mesh.loop_triangles) {
874 for (BL::MeshPolygon &p : b_mesh.polygons) {
886 const bool need_motion,
887 const float motion_scale,
888 const bool subdivision =
false,
889 const bool subdivide_uvs =
true)
892 int numverts = b_mesh.vertices.length();
893 int numfaces = (!subdivision) ? b_mesh.loop_triangles.length() : b_mesh.polygons.length();
897 bool use_loop_normals = b_mesh.use_auto_smooth() &&
909 for (BL::MeshPolygon &p : b_mesh.polygons) {
910 numngons += (p.loop_total() == 4) ? 0 : 1;
911 numcorners += p.loop_total();
923 BL::Mesh::vertices_iterator
v;
924 for (b_mesh.vertices.begin(
v);
v != b_mesh.vertices.end(); ++
v)
929 float3 *
N = attr_N->data_float3();
931 for (b_mesh.vertices.begin(
v);
v != b_mesh.vertices.end(); ++
v, ++
N)
933 N = attr_N->data_float3();
936 const bool need_default_tangent = (subdivision ==
false) && (b_mesh.uv_layers.empty()) &&
948 for (b_mesh.vertices.begin(
v);
v != b_mesh.vertices.end(); ++
v) {
955 for (BL::MeshLoopTriangle &
t : b_mesh.loop_triangles) {
956 BL::MeshPolygon p = b_mesh.polygons[
t.polygon_index()];
959 int shader =
clamp(p.material_index(), 0, used_shaders.
size() - 1);
960 bool smooth = p.use_smooth() || use_loop_normals;
962 if (use_loop_normals) {
963 BL::Array<float, 9> loop_normals =
t.split_normals();
964 for (
int i = 0; i < 3; i++) {
966 loop_normals[i * 3], loop_normals[i * 3 + 1], loop_normals[i * 3 + 2]);
980 for (BL::MeshPolygon &p : b_mesh.polygons) {
981 int n = p.loop_total();
982 int shader =
clamp(p.material_index(), 0, used_shaders.
size() - 1);
983 bool smooth = p.use_smooth() || use_loop_normals;
986 for (
int i = 0; i < n; i++) {
988 vi[i] = b_mesh.loops[p.loop_start() + i].vertex_index();
1029 const bool need_motion,
1030 const float motion_scale,
1032 int max_subdivisions)
1036 BL::SubsurfModifier subsurf_mod(b_ob.modifiers[b_ob.modifiers.length() - 1]);
1037 bool subdivide_uvs = subsurf_mod.uv_smooth() != BL::SubsurfModifier::uv_smooth_NONE;
1039 create_mesh(
scene,
mesh, b_mesh, used_shaders, need_motion, motion_scale,
true, subdivide_uvs);
1042 size_t num_creases = 0;
1044 for (BL::MeshEdge &
e : b_mesh.edges) {
1045 if (
e.crease() != 0.0f) {
1052 for (BL::MeshEdge &
e : b_mesh.edges) {
1053 if (
e.crease() != 0.0f) {
1058 for (BL::MeshVertexCreaseLayer &
c : b_mesh.vertex_creases) {
1059 for (
int i = 0; i <
c.data.length(); ++i) {
1060 if (
c.data[i].value() != 0.0f) {
1068 float subd_dicing_rate =
max(0.1f,
RNA_float_get(&cobj,
"dicing_rate") * dicing_rate);
1070 mesh->set_subd_dicing_rate(subd_dicing_rate);
1071 mesh->set_subd_max_level(max_subdivisions);
1084 new_mesh.set_used_shaders(used_shaders);
1086 if (view_layer.use_surfaces) {
1090 new_mesh.set_subdivision_type(
1097 b_data, b_ob_info, b_depsgraph, need_undeformed, new_mesh.get_subdivision_type());
1102 const float motion_scale = (need_motion) ?
1104 (b_scene.render().fps() / b_scene.render().fps_base()) :
1113 new_mesh.get_used_shaders(),
1122 new_mesh.get_used_shaders(),
1137 if (socket.
name ==
"use_motion_blur" || socket.
name ==
"motion_steps" ||
1138 socket.
name ==
"used_shaders") {
1145 mesh->subd_attributes.update(std::move(new_mesh.subd_attributes));
1150 bool rebuild = (
mesh->triangles_is_modified()) || (
mesh->subd_num_corners_is_modified()) ||
1151 (
mesh->subd_shader_is_modified()) || (
mesh->subd_smooth_is_modified()) ||
1152 (
mesh->subd_ptex_offset_is_modified()) ||
1153 (
mesh->subd_start_corner_is_modified()) ||
1154 (
mesh->subd_face_corners_is_modified());
1159 void BlenderSync::sync_mesh_motion(
BL::Depsgraph b_depsgraph,
1165 size_t numverts =
mesh->get_verts().
size();
1166 if (numverts == 0) {
1178 const std::string ob_name = b_ob_info.
real_object.name();
1187 bool new_attribute =
false;
1194 new_attribute =
true;
1202 BL::Mesh::vertices_iterator
v;
1204 for (b_mesh.vertices.begin(
v);
v != b_mesh.vertices.end() && i < numverts; ++
v, ++i) {
1209 if (new_attribute) {
1211 if (b_mesh.vertices.length() != numverts ||
1212 memcmp(mP, &
mesh->get_verts()[0],
sizeof(
float3) * numverts) == 0) {
1214 if (b_mesh.vertices.length() != numverts) {
1215 VLOG_WARNING <<
"Topology differs, disabling motion blur for object " << ob_name;
1218 VLOG_DEBUG <<
"No actual deformation motion for object " << ob_name;
1224 else if (motion_step > 0) {
1225 VLOG_DEBUG <<
"Filling deformation motion for object " << ob_name;
1230 for (
int step = 0; step < motion_step; step++) {
1238 if (b_mesh.vertices.length() != numverts) {
1239 VLOG_WARNING <<
"Topology differs, discarding motion blur for object " << ob_name
1240 <<
" at time " << motion_step;
1241 memcpy(mP, &
mesh->get_verts()[0],
sizeof(
float3) * numverts);
typedef float(TangentPoint)[2]
int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob)
MINLINE float safe_acosf(float a)
void map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
struct Depsgraph Depsgraph
_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 x2
_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 t
_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 v1
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Attribute
static void attr_create_generic(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, const bool subdivision, const bool need_motion, const float motion_scale)
static int mikk_corner_index(const Mesh *mesh, const int face_num, const int vert_num)
static void fill_generic_attribute(BL::Mesh &b_mesh, TypeInCycles *data, const BL::Attribute::domain_enum b_domain, const bool subdivision, const GetValueAtIndex &get_value_at_index)
static void mikk_get_position(const SMikkTSpaceContext *context, float P[3], const int face_num, const int vert_num)
static void attr_create_motion(Mesh *mesh, BL::Attribute &b_attribute, const float motion_scale)
static void attr_create_random_per_island(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivision)
static int mikk_get_num_verts_of_face(const SMikkTSpaceContext *context, const int face_num)
static int mikk_vertex_index(const Mesh *mesh, const int face_num, const int vert_num)
static void mikk_get_texture_coordinate(const SMikkTSpaceContext *context, float uv[2], const int face_num, const int vert_num)
static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, const array< Node * > &used_shaders, const bool need_motion, const float motion_scale, const bool subdivision=false, const bool subdivide_uvs=true)
static void attr_create_subd_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivide_uvs)
static void mikk_set_tangent_space(const SMikkTSpaceContext *context, const float T[], const float sign, const int face_num, const int vert_num)
static void mikk_compute_tangents(const BL::Mesh &b_mesh, const char *layer_name, Mesh *mesh, bool need_sign, bool active_render)
static void create_subd_mesh(Scene *scene, Mesh *mesh, BObjectInfo &b_ob_info, BL::Mesh &b_mesh, const array< Node * > &used_shaders, const bool need_motion, const float motion_scale, float dicing_rate, int max_subdivisions)
static int mikk_get_num_faces(const SMikkTSpaceContext *context)
static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivision)
static void mikk_get_normal(const SMikkTSpaceContext *context, float N[3], const int face_num, const int vert_num)
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
void update(AttributeSet &&new_attributes)
list< Attribute > attributes
Attribute * find(ustring name) const
void remove(ustring name)
Transform * data_transform()
void join(size_t x, size_t y)
void insert(int v0, int v1)
bool exists(int v0, int v1)
bool need_attribute(Scene *scene, AttributeStandard std)
void tag_update(Scene *scene, bool rebuild)
VertexAverageComparator(const array< float3 > &verts)
bool operator()(const int &vert_idx_a, const int &vert_idx_b)
const array< float3 > & verts_
#define CCL_NAMESPACE_END
static float4 get_float4(const BL::Array< float, 4 > &array)
static void free_object_to_mesh(BL::BlendData &, BObjectInfo &b_ob_info, BL::Mesh &mesh)
static BL::Mesh object_to_mesh(BL::BlendData &, BObjectInfo &b_ob_info, BL::Depsgraph &, bool, Mesh::SubdivisionType subdivision_type)
static float3 get_float3(const BL::Array< float, 2 > &array)
static bool object_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
static int3 get_int3(const BL::Array< int, 3 > &array)
static float2 get_float2(const BL::Array< float, 2 > &array)
static Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob, bool preview, bool experimental)
static Transform get_transform(const BL::Array< float, 16 > &array)
static void mesh_texture_space(BL::Mesh &b_mesh, float3 &loc, float3 &size)
ccl_device_inline float hash_uint_to_float(uint kx)
IconTextureDrawCall normal
ccl_gpu_kernel_postfix ccl_global int * counter
@ ATTR_STD_GENERATED_TRANSFORM
@ ATTR_STD_MOTION_VERTEX_NORMAL
@ ATTR_STD_MOTION_VERTEX_POSITION
@ ATTR_STD_UV_TANGENT_SIGN
@ ATTR_STD_RANDOM_PER_ISLAND
@ ATTR_ELEMENT_CORNER_BYTE
ccl_device_inline float3 zero_float3()
ccl_device_inline float len_squared(const float3 a)
tbool genTangSpaceDefault(const SMikkTSpaceContext *pContext)
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
T clamp(const T &a, const T &min, const T &max)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
smooth(Type::FLOAT, "mask_weight")
static constexpr TypeDesc TypeRGBA(TypeDesc::FLOAT, TypeDesc::VEC4, TypeDesc::COLOR)
CCL_NAMESPACE_BEGIN static constexpr OIIO_NAMESPACE_USING TypeDesc TypeFloat2(TypeDesc::FLOAT, TypeDesc::VEC2)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
const PointerRNA PointerRNA_NULL
float RNA_float_get(PointerRNA *ptr, const char *name)
float3 normal(const Mesh *mesh) const
float3 compute_normal(const float3 *verts) const
void reserve_subd_faces(int numfaces, int num_ngons, int numcorners)
size_t get_num_subd_faces() const
void add_edge_crease(int v0, int v1, float weight)
void reserve_subd_creases(size_t num_creases)
Triangle get_triangle(size_t i) const
void copy_center_to_motion_step(const int motion_step)
void reserve_mesh(int numverts, int numfaces)
@ SUBDIVISION_CATMULL_CLARK
size_t num_triangles() const
void set_num_subd_faces(size_t num_subd_faces_)
void add_vertex(float3 P)
void add_vertex_crease(int v, float weight)
void add_triangle(int v0, int v1, int v2, int shader, bool smooth)
SubdFace get_subd_face(size_t index) const
void add_subd_face(const int *corners, int num_corners, int shader_, bool smooth_)
MikkUserData(const BL::Mesh &b_mesh, const char *layer_name, const Mesh *mesh, float3 *tangent, float *tangent_sign)
vector< SocketType, std::allocator< SocketType > > inputs
void set_value(const SocketType &input, const Node &other, const SocketType &other_input)
void(* m_getNormal)(const SMikkTSpaceContext *pContext, float fvNormOut[], const int iFace, const int iVert)
void(* m_getPosition)(const SMikkTSpaceContext *pContext, float fvPosOut[], const int iFace, const int iVert)
void(* m_getTexCoord)(const SMikkTSpaceContext *pContext, float fvTexcOut[], const int iFace, const int iVert)
void(* m_setTSpaceBasic)(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int iFace, const int iVert)
int(* m_getNumFaces)(const SMikkTSpaceContext *pContext)
int(* m_getNumVerticesOfFace)(const SMikkTSpaceContext *pContext, const int iFace)
BakeManager * bake_manager
float motion_shutter_time()
ccl_device uchar4 color_float4_to_uchar4(float4 c)
ccl_device float4 color_linear_to_srgb_v4(float4 c)