Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2017-10-12 17:40:35 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-10-12 17:40:35 +0300
commit557dc7d34353992058451851a6ec1068d25b13d4 (patch)
tree8c86daa924fdf1d8c82fb0236789b3160e016755 /intern/cycles/render
parent5f025a7e5e043a2dbdebf66668217fbae591ef89 (diff)
parenta51688d0b066f00d5912d677d0f4bdad08b28ea6 (diff)
Merge branch 'master' into blender2.8
Conflicts: source/blender/editors/screen/screen_edit.c
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/attribute.cpp10
-rw-r--r--intern/cycles/render/attribute.h2
-rw-r--r--intern/cycles/render/mesh.cpp32
-rw-r--r--intern/cycles/render/mesh.h2
-rw-r--r--intern/cycles/render/nodes.h2
5 files changed, 31 insertions, 17 deletions
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index e157a385904..9dff18691cd 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -502,6 +502,16 @@ Attribute *AttributeSet::find(AttributeRequest& req)
return find(req.std);
}
+void AttributeSet::remove(Attribute *attribute)
+{
+ if(attribute->std == ATTR_STD_NONE) {
+ remove(attribute->name);
+ }
+ else {
+ remove(attribute->std);
+ }
+}
+
void AttributeSet::resize(bool reserve_only)
{
foreach(Attribute& attr, attributes) {
diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h
index a64eb6542d5..d15ee401a72 100644
--- a/intern/cycles/render/attribute.h
+++ b/intern/cycles/render/attribute.h
@@ -120,6 +120,8 @@ public:
Attribute *find(AttributeRequest& req);
+ void remove(Attribute *attribute);
+
void resize(bool reserve_only = false);
void clear();
};
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index c02a5222463..c5eb3a0d3a8 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -107,6 +107,19 @@ void Mesh::Triangle::verts_for_step(const float3 *verts,
}
}
+float3 Mesh::Triangle::compute_normal(const float3 *verts) const
+{
+ const float3& v0 = verts[v[0]];
+ const float3& v1 = verts[v[1]];
+ const float3& v2 = verts[v[2]];
+ const float3 norm = cross(v1 - v0, v2 - v0);
+ const float normlen = len(norm);
+ if(normlen == 0.0f) {
+ return make_float3(1.0f, 0.0f, 0.0f);
+ }
+ return norm / normlen;
+}
+
/* Curve */
void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float *curve_radius, BoundBox& bounds) const
@@ -701,21 +714,6 @@ void Mesh::compute_bounds()
bounds = bnds;
}
-static float3 compute_face_normal(const Mesh::Triangle& t, float3 *verts)
-{
- float3 v0 = verts[t.v[0]];
- float3 v1 = verts[t.v[1]];
- float3 v2 = verts[t.v[2]];
-
- float3 norm = cross(v1 - v0, v2 - v0);
- float normlen = len(norm);
-
- if(normlen == 0.0f)
- return make_float3(1.0f, 0.0f, 0.0f);
-
- return norm / normlen;
-}
-
void Mesh::add_face_normals()
{
/* don't compute if already there */
@@ -733,7 +731,7 @@ void Mesh::add_face_normals()
float3 *verts_ptr = verts.data();
for(size_t i = 0; i < triangles_size; i++) {
- fN[i] = compute_face_normal(get_triangle(i), verts_ptr);
+ fN[i] = get_triangle(i).compute_normal(verts_ptr);
}
}
@@ -795,7 +793,7 @@ void Mesh::add_vertex_normals()
for(size_t i = 0; i < triangles_size; i++) {
for(size_t j = 0; j < 3; j++) {
- float3 fN = compute_face_normal(get_triangle(i), mP);
+ float3 fN = get_triangle(i).compute_normal(mP);
mN[get_triangle(i).v[j]] += fN;
}
}
diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h
index 9a51ca73950..3483ab4fd69 100644
--- a/intern/cycles/render/mesh.h
+++ b/intern/cycles/render/mesh.h
@@ -70,6 +70,8 @@ public:
size_t num_steps,
size_t step,
float3 r_verts[3]) const;
+
+ float3 compute_normal(const float3 *verts) const;
};
Triangle get_triangle(size_t i) const
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index ec4c7c7c50d..4ec485d521b 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -982,6 +982,8 @@ public:
/* ideally we could beter detect this, but we can't query this now */
bool has_spatial_varying() { return true; }
+ bool has_volume_support() { return true; }
+
virtual bool equals(const ShaderNode& /*other*/) { return false; }
string filepath;