Blender V2.61 - r43446
|
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <iterator>
#include "camera.h"
#include "film.h"
#include "graph.h"
#include "integrator.h"
#include "light.h"
#include "mesh.h"
#include "nodes.h"
#include "object.h"
#include "shader.h"
#include "scene.h"
#include "subd_mesh.h"
#include "subd_patch.h"
#include "subd_split.h"
#include "util_debug.h"
#include "util_foreach.h"
#include "util_path.h"
#include "util_transform.h"
#include "util_xml.h"
#include "cycles_xml.h"
Go to the source code of this file.
Classes | |
struct | XMLReadState |
Functions | |
static bool | xml_read_bool (bool *value, pugi::xml_node node, const char *name) |
static bool | xml_read_int (int *value, pugi::xml_node node, const char *name) |
static bool | xml_read_int_array (vector< int > &value, pugi::xml_node node, const char *name) |
static bool | xml_read_float (float *value, pugi::xml_node node, const char *name) |
static bool | xml_read_float_array (vector< float > &value, pugi::xml_node node, const char *name) |
static bool | xml_read_float3 (float3 *value, pugi::xml_node node, const char *name) |
static bool | xml_read_float3_array (vector< float3 > &value, pugi::xml_node node, const char *name) |
static bool | xml_read_float4 (float4 *value, pugi::xml_node node, const char *name) |
static bool | xml_read_string (string *str, pugi::xml_node node, const char *name) |
static bool | xml_read_ustring (ustring *str, pugi::xml_node node, const char *name) |
static bool | xml_equal_string (pugi::xml_node node, const char *name, const char *value) |
static bool | xml_read_enum (ustring *str, ShaderEnum &enm, pugi::xml_node node, const char *name) |
static void | xml_read_film (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_integrator (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_camera (const XMLReadState &state, pugi::xml_node node) |
static string | xml_socket_name (const char *name) |
static void | xml_read_shader_graph (const XMLReadState &state, Shader *shader, pugi::xml_node graph_node) |
static void | xml_read_shader (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_background (const XMLReadState &state, pugi::xml_node node) |
static Mesh * | xml_add_mesh (Scene *scene, const Transform &tfm) |
static void | xml_read_mesh (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_patch (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_light (const XMLReadState &state, pugi::xml_node node) |
static void | xml_read_transform (pugi::xml_node node, Transform &tfm) |
static void | xml_read_state (XMLReadState &state, pugi::xml_node node) |
static void | xml_read_include (const XMLReadState &state, const string &src) |
static void | xml_read_scene (const XMLReadState &state, pugi::xml_node scene_node) |
void | xml_read_file (Scene *scene, const char *filepath) |
Definition at line 599 of file cycles_xml.cpp.
References Scene::meshes, and Scene::objects.
Referenced by xml_read_mesh(), and xml_read_patch().
static bool xml_equal_string | ( | pugi::xml_node | node, |
const char * | name, | ||
const char * | value | ||
) | [static] |
Definition at line 196 of file cycles_xml.cpp.
References string_iequals().
Referenced by xml_read_camera(), xml_read_mesh(), xml_read_patch(), and xml_read_state().
static void xml_read_background | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 590 of file cycles_xml.cpp.
References Scene::default_background, XMLReadState::scene, Scene::shaders, and xml_read_shader_graph().
Referenced by xml_read_scene().
static bool xml_read_bool | ( | bool * | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 64 of file cycles_xml.cpp.
References string_iequals().
Referenced by xml_read_integrator(), and xml_read_shader_graph().
static void xml_read_camera | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 276 of file cycles_xml.cpp.
References Camera::aperturesize, Scene::camera, Camera::farclip, Camera::focaldistance, Camera::fov, M_PI, Camera::matrix, Camera::nearclip, Camera::need_update, Camera::ortho, XMLReadState::scene, Camera::shutterclose, Camera::shutteropen, XMLReadState::tfm, Camera::update(), xml_equal_string(), and xml_read_float().
Referenced by xml_read_scene().
static bool xml_read_enum | ( | ustring * | str, |
ShaderEnum & | enm, | ||
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 206 of file cycles_xml.cpp.
References ShaderEnum::exists().
Referenced by xml_read_shader_graph().
void xml_read_file | ( | Scene * | scene, |
const char * | filepath | ||
) |
Definition at line 928 of file cycles_xml.cpp.
References XMLReadState::base, SceneParams::BVH_STATIC, SceneParams::bvh_type, Scene::default_surface, XMLReadState::dicing_rate, Scene::params, path_dirname(), path_filename(), XMLReadState::scene, XMLReadState::shader, XMLReadState::smooth, state, XMLReadState::tfm, transform_identity(), and xml_read_include().
Referenced by scene_init().
static void xml_read_film | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 226 of file cycles_xml.cpp.
References Camera::bottom, Scene::camera, Camera::height, Camera::left, Camera::need_update, Camera::right, XMLReadState::scene, Camera::top, Camera::update(), Camera::width, and xml_read_int().
Referenced by xml_read_scene().
static bool xml_read_float | ( | float * | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 105 of file cycles_xml.cpp.
Referenced by xml_read_camera(), xml_read_mesh(), xml_read_patch(), xml_read_shader_graph(), and xml_read_state().
static bool xml_read_float3 | ( | float3 * | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 134 of file cycles_xml.cpp.
References make_float3(), and xml_read_float_array().
Referenced by xml_read_light(), xml_read_shader_graph(), and xml_read_transform().
static bool xml_read_float3_array | ( | vector< float3 > & | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 146 of file cycles_xml.cpp.
References i, make_float3(), and xml_read_float_array().
Referenced by xml_read_mesh(), and xml_read_patch().
static bool xml_read_float4 | ( | float4 * | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 160 of file cycles_xml.cpp.
References make_float4(), and xml_read_float_array().
Referenced by xml_read_transform().
static bool xml_read_float_array | ( | vector< float > & | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 117 of file cycles_xml.cpp.
References string_split().
Referenced by xml_read_float3(), xml_read_float3_array(), xml_read_float4(), and xml_read_transform().
static void xml_read_include | ( | const XMLReadState & | state, |
const string & | src | ||
) | [static] |
Definition at line 907 of file cycles_xml.cpp.
References XMLReadState::base, path_dirname(), path_join(), state, and xml_read_scene().
Referenced by xml_read_file(), and xml_read_scene().
static bool xml_read_int | ( | int * | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 76 of file cycles_xml.cpp.
Referenced by xml_read_film(), xml_read_integrator(), and xml_read_shader_graph().
static bool xml_read_int_array | ( | vector< int > & | value, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 88 of file cycles_xml.cpp.
References string_split().
Referenced by xml_read_mesh().
static void xml_read_integrator | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 254 of file cycles_xml.cpp.
References Scene::integrator, Integrator::max_bounce, Integrator::max_diffuse_bounce, Integrator::max_glossy_bounce, Integrator::max_transmission_bounce, Integrator::min_bounce, Integrator::no_caustics, XMLReadState::scene, Integrator::seed, Integrator::transparent_max_bounce, Integrator::transparent_min_bounce, Integrator::transparent_shadows, xml_read_bool(), and xml_read_int().
Referenced by xml_read_scene().
static void xml_read_light | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 770 of file cycles_xml.cpp.
References Light::co, Scene::lights, XMLReadState::scene, XMLReadState::shader, Light::shader, XMLReadState::tfm, transform(), and xml_read_float3().
Referenced by xml_read_scene().
static void xml_read_mesh | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 614 of file cycles_xml.cpp.
References SubdMesh::add_face(), Mesh::add_triangle(), SubdMesh::add_vert(), assert, Mesh::attributes, DiagSplit::dicing_rate, XMLReadState::dicing_rate, Mesh::displacement_method, XMLReadState::displacement_method, i, SubdMesh::link_boundary(), P(), AttributeSet::remove(), XMLReadState::scene, XMLReadState::shader, smooth(), XMLReadState::smooth, Attribute::STD_VERTEX_NORMAL, SubdMesh::tesselate(), XMLReadState::tfm, Mesh::used_shaders, Mesh::verts, xml_add_mesh(), xml_equal_string(), xml_read_float(), xml_read_float3_array(), and xml_read_int_array().
Referenced by xml_read_scene().
static void xml_read_patch | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 708 of file cycles_xml.cpp.
References Mesh::attributes, DiagSplit::dicing_rate, XMLReadState::dicing_rate, LinearQuadPatch::hull, BicubicPatch::hull, i, NULL, P(), AttributeSet::remove(), XMLReadState::scene, XMLReadState::shader, XMLReadState::smooth, DiagSplit::split_quad(), Attribute::STD_VERTEX_NORMAL, XMLReadState::tfm, transform(), transform_identity(), Mesh::used_shaders, xml_add_mesh(), xml_equal_string(), xml_read_float(), and xml_read_float3_array().
Referenced by xml_read_scene().
static void xml_read_scene | ( | const XMLReadState & | state, |
pugi::xml_node | scene_node | ||
) | [static] |
Definition at line 855 of file cycles_xml.cpp.
References state, string_iequals(), XMLReadState::tfm, xml_read_background(), xml_read_camera(), xml_read_film(), xml_read_include(), xml_read_integrator(), xml_read_light(), xml_read_mesh(), xml_read_patch(), xml_read_shader(), xml_read_state(), xml_read_string(), and xml_read_transform().
Referenced by xml_read_include().
static void xml_read_shader | ( | const XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 580 of file cycles_xml.cpp.
References Shader::name, XMLReadState::scene, Shader, Scene::shaders, xml_read_shader_graph(), and xml_read_string().
Referenced by xml_read_scene().
static void xml_read_shader_graph | ( | const XMLReadState & | state, |
Shader * | shader, | ||
pugi::xml_node | graph_node | ||
) | [static] |
Definition at line 314 of file cycles_xml.cpp.
References ShaderGraph::add(), AttributeNode::attribute, XMLReadState::base, blend(), MakeCursor::color, VoronoiTextureNode::coloring, VoronoiTextureNode::coloring_enum, ShaderGraph::connect(), MagicTextureNode::depth, GlossyBsdfNode::distribution, GlassBsdfNode::distribution, GlassBsdfNode::distribution_enum, GlossyBsdfNode::distribution_enum, emission(), EnvironmentTextureNode::filename, ImageTextureNode::filename, ShaderNode::inputs, magic, mix(), ShaderOutput::name, NULL, ShaderGraph::output(), ShaderNode::outputs, path_join(), XMLReadState::scene, Shader::set_graph(), SHADER_SOCKET_COLOR, SHADER_SOCKET_FLOAT, SHADER_SOCKET_NORMAL, SHADER_SOCKET_POINT, SHADER_SOCKET_VECTOR, string_iequals(), string_split(), SkyTextureNode::sun_direction, Shader::tag_update(), EmissionNode::total_power, SkyTextureNode::turbidity, MixNode::type, MathNode::type, GradientTextureNode::type, WaveTextureNode::type, MusgraveTextureNode::type, VectorMathNode::type, MusgraveTextureNode::type_enum, MixNode::type_enum, VectorMathNode::type_enum, WaveTextureNode::type_enum, MathNode::type_enum, GradientTextureNode::type_enum, ColorNode::value, ValueNode::value, voronoi(), wood(), xml_read_bool(), xml_read_enum(), xml_read_float(), xml_read_float3(), xml_read_int(), xml_read_string(), xml_read_ustring(), and xml_socket_name().
Referenced by xml_read_background(), and xml_read_shader().
static void xml_read_state | ( | XMLReadState & | state, |
pugi::xml_node | node | ||
) | [static] |
Definition at line 811 of file cycles_xml.cpp.
References XMLReadState::dicing_rate, Mesh::DISPLACE_BOTH, Mesh::DISPLACE_BUMP, Mesh::DISPLACE_TRUE, XMLReadState::displacement_method, i, Shader::name, XMLReadState::scene, XMLReadState::shader, Scene::shaders, XMLReadState::smooth, xml_equal_string(), xml_read_float(), and xml_read_string().
Referenced by xml_read_scene().
static bool xml_read_string | ( | string * | str, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 172 of file cycles_xml.cpp.
Referenced by xml_read_scene(), xml_read_shader(), xml_read_shader_graph(), and xml_read_state().
static void xml_read_transform | ( | pugi::xml_node | node, |
Transform & | tfm | ||
) | [static] |
Definition at line 782 of file cycles_xml.cpp.
References M_PI, make_float3(), make_float4(), rotate(), transform_rotate(), transform_scale(), transform_translate(), transform_transpose(), float4::w, float4::x, xml_read_float3(), xml_read_float4(), xml_read_float_array(), float4::y, and float4::z.
Referenced by xml_read_scene().
static bool xml_read_ustring | ( | ustring * | str, |
pugi::xml_node | node, | ||
const char * | name | ||
) | [static] |
Definition at line 184 of file cycles_xml.cpp.
Referenced by xml_read_shader_graph().
static string xml_socket_name | ( | const char * | name | ) | [static] |