diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-31 16:32:31 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2016-06-08 22:45:40 +0300 |
commit | dadaf9f0de9bbea728f311d0a3487398552f2040 (patch) | |
tree | 2f6c9a39a3dbca4051f2b76e64334971e1c81ac2 /intern/cycles | |
parent | e90b87f483d05616c94392f211035879892fdbb0 (diff) |
Cycles: Fixes for recent refactor
- add_vertex() can be called from split_vertex() which does not guarantee
to have properly pre-allocate arrays.
- Need to check whether Cycles is compiled with OSL in XML reader.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/app/cycles_xml.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 7 | ||||
-rw-r--r-- | intern/cycles/render/mesh.h | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index 6f9cbe37a58..9f967a4bde9 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -306,6 +306,7 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml snode = env; } +#ifdef WITH_OSL else if(string_iequals(node.name(), "osl_shader")) { if(manager->use_osl()) { std::string filepath; @@ -329,6 +330,7 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml fprintf(stderr, "OSL node without using --shadingsys osl.\n"); } } +#endif else if(string_iequals(node.name(), "sky_texture")) { SkyTextureNode *sky = new SkyTextureNode(); diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index d92226d6910..755b16a51c7 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -206,7 +206,7 @@ void Mesh::clear() int Mesh::split_vertex(int vertex) { /* copy vertex location and vertex attributes */ - add_vertex(verts[vertex]); + add_vertex_slow(verts[vertex]); foreach(Attribute& attr, attributes.attributes) { if(attr.element == ATTR_ELEMENT_VERTEX) { @@ -224,6 +224,11 @@ void Mesh::add_vertex(float3 P) verts.push_back_reserved(P); } +void Mesh::add_vertex_slow(float3 P) +{ + verts.push_back_slow(P); +} + void Mesh::add_triangle(int v0, int v1, int v2, int shader_, bool smooth_, bool forms_quad_) { triangles.push_back_reserved(v0); diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 5c788fc12c7..edad6d32f00 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -156,6 +156,7 @@ public: void reserve_curves(int numcurves, int numkeys); void clear(); void add_vertex(float3 P); + void add_vertex_slow(float3 P); void add_triangle(int v0, int v1, int v2, int shader, bool smooth, bool forms_quad = false); void add_curve_key(float3 loc, float radius); void add_curve(int first_key, int shader); |