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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-14 15:50:03 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-17 22:39:16 +0300
commit0e8cd14dfee9788f24854aa8f4148033ef042f51 (patch)
tree4fd7fdb358f9ef4ccdcb934025b74ee6f25598ad /intern/cycles/app/cycles_xml.cpp
parent08670d3b8117cda608c178688f261e1204794a0d (diff)
Code refactor: use shader pointers rather than shader indexes.
Diffstat (limited to 'intern/cycles/app/cycles_xml.cpp')
-rw-r--r--intern/cycles/app/cycles_xml.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 262e8c063a9..6b0ef3275f3 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -52,7 +52,7 @@ struct XMLReadState {
Scene *scene; /* scene pointer */
Transform tfm; /* current transform state */
bool smooth; /* smooth normal state */
- int shader; /* current shader */
+ Shader *shader; /* current shader */
string base; /* base path to current file*/
float dicing_rate; /* current dicing rate */
Mesh::DisplacementMethod displacement_method;
@@ -60,7 +60,7 @@ struct XMLReadState {
XMLReadState()
: scene(NULL),
smooth(false),
- shader(0),
+ shader(NULL),
dicing_rate(0.0f),
displacement_method(Mesh::DISPLACE_BUMP)
{
@@ -865,7 +865,7 @@ static void xml_read_background(const XMLReadState& state, pugi::xml_node node)
xml_read_bool(&bg->transparent, node, "transparent");
/* Background Shader */
- Shader *shader = state.scene->shaders[state.scene->default_background];
+ Shader *shader = state.scene->default_background;
xml_read_bool(&shader->heterogeneous_volume, node, "heterogeneous_volume");
xml_read_int(&shader->volume_interpolation_method, node, "volume_interpolation_method");
@@ -904,7 +904,7 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
mesh->used_shaders.push_back(state.shader);
/* read state */
- int shader = state.shader;
+ int shader = 0;
bool smooth = state.smooth;
mesh->displacement_method = state.displacement_method;
@@ -1064,7 +1064,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
mesh->used_shaders.push_back(state.shader);
/* split */
- SubdParams sdparams(mesh, state.shader, state.smooth);
+ SubdParams sdparams(mesh, 0, state.smooth);
xml_read_float(&sdparams.dicing_rate, node, "dicing_rate");
DiagSplit dsplit(sdparams);
@@ -1161,17 +1161,14 @@ static void xml_read_state(XMLReadState& state, pugi::xml_node node)
string shadername;
if(xml_read_string(&shadername, node, "shader")) {
- int i = 0;
bool found = false;
foreach(Shader *shader, state.scene->shaders) {
if(shader->name == shadername) {
- state.shader = i;
+ state.shader = shader;
found = true;
break;
}
-
- i++;
}
if(!found)