71 xml_attribute attr =
node.attribute(name);
74 *value = atoi(attr.value());
83 xml_attribute attr =
node.attribute(name);
89 foreach (
const string &token, tokens)
90 value.push_back(atoi(token.c_str()));
100 xml_attribute attr =
node.attribute(name);
103 *value = (
float)atof(attr.value());
112 xml_attribute attr =
node.attribute(name);
118 foreach (
const string &token, tokens)
119 value.push_back((
float)atof(token.c_str()));
144 for (
size_t i = 0; i <
array.
size(); i += 3)
167 xml_attribute attr =
node.attribute(name);
179 xml_attribute attr =
node.attribute(name);
197 cam->set_full_width(
width);
198 cam->set_full_height(
height);
202 cam->set_matrix(
state.tfm);
220 for (xml_node
node = graph_node.first_child();
node;
node =
node.next_sibling()) {
221 ustring node_name(
node.name());
223 if (node_name ==
"connect") {
230 if (from_tokens.size() == 2 && to_tokens.size() == 2) {
231 ustring from_node_name(from_tokens[0]);
232 ustring from_socket_name(from_tokens[1]);
233 ustring to_node_name(to_tokens[0]);
234 ustring to_socket_name(to_tokens[1]);
240 if (graph_reader.
node_map.find(from_node_name) != graph_reader.
node_map.end()) {
249 "Unknown output socket name \"%s\" on \"%s\".\n",
250 from_node_name.c_str(),
251 from_socket_name.c_str());
254 fprintf(stderr,
"Unknown shader node name \"%s\".\n", from_node_name.c_str());
256 if (graph_reader.
node_map.find(to_node_name) != graph_reader.
node_map.end()) {
265 "Unknown input socket name \"%s\" on \"%s\".\n",
266 to_socket_name.c_str(),
267 to_node_name.c_str());
270 fprintf(stderr,
"Unknown shader node name \"%s\".\n", to_node_name.c_str());
277 fprintf(stderr,
"Invalid from or to value for connect node.\n");
285 if (node_name ==
"osl_shader") {
289 std::string filepath;
296 snode = OSLShaderManager::osl_node(
graph, manager, filepath,
"");
299 fprintf(stderr,
"Failed to create OSL node from \"%s\".\n", filepath.c_str());
304 fprintf(stderr,
"OSL node missing \"src\" attribute.\n");
309 fprintf(stderr,
"OSL node without using --shadingsys osl.\n");
317 if (node_name ==
"background")
318 node_name =
"background_shader";
323 fprintf(stderr,
"Unknown shader node \"%s\".\n",
node.name());
327 fprintf(stderr,
"Node type \"%s\" is not a shader node.\n", node_type->
name.c_str());
331 fprintf(stderr,
"Can't create abstract node type \"%s\".\n", node_type->
name.c_str());
340 if (node_name ==
"image_texture") {
342 ustring filename(
path_join(
state.base, img->get_filename().string()));
343 img->set_filename(filename);
345 else if (node_name ==
"environment_texture") {
347 ustring filename(
path_join(
state.base, env->get_filename().string()));
348 env->set_filename(filename);
390 object->set_geometry(
mesh);
391 object->set_tfm(tfm);
403 mesh->set_used_shaders(used_shaders);
407 bool smooth =
state.smooth;
431 mesh->set_verts(P_array);
433 size_t num_triangles = 0;
434 for (
size_t i = 0; i < nverts.size(); i++)
435 num_triangles += nverts[i] - 2;
439 int index_offset = 0;
441 for (
size_t i = 0; i < nverts.size(); i++) {
442 for (
int j = 0; j < nverts[i] - 2; j++) {
443 int v0 =
verts[index_offset];
444 int v1 =
verts[index_offset + j + 1];
445 int v2 =
verts[index_offset + j + 2];
447 assert(v0 < (
int)
P.size());
448 assert(
v1 < (
int)
P.size());
449 assert(
v2 < (
int)
P.size());
454 index_offset += nverts[i];
458 ustring name = ustring(
"UVMap");
464 for (
size_t i = 0; i < nverts.size(); i++) {
465 for (
int j = 0; j < nverts[i] - 2; j++) {
466 int v0 = index_offset;
467 int v1 = index_offset + j + 1;
468 int v2 = index_offset + j + 2;
470 assert(v0 * 2 + 1 < (
int)UV.size());
471 assert(
v1 * 2 + 1 < (
int)UV.size());
472 assert(
v2 * 2 + 1 < (
int)UV.size());
474 fdata[0] =
make_float2(UV[v0 * 2], UV[v0 * 2 + 1]);
480 index_offset += nverts[i];
486 mesh->set_verts(P_array);
488 size_t num_ngons = 0;
489 size_t num_corners = 0;
490 for (
size_t i = 0; i < nverts.size(); i++) {
491 num_ngons += (nverts[i] == 4) ? 0 : 1;
492 num_corners += nverts[i];
497 int index_offset = 0;
499 for (
size_t i = 0; i < nverts.size(); i++) {
501 index_offset += nverts[i];
506 ustring name = ustring(
"UVMap");
517 for (
size_t i = 0; i < nverts.size(); i++) {
518 for (
int j = 0; j < nverts[i]; j++) {
525 float dicing_rate =
state.dicing_rate;
527 dicing_rate =
std::max(0.1f, dicing_rate);
529 mesh->set_subd_dicing_rate(dicing_rate);
548 light->set_shader(
state.shader);
551 state.scene->lights.push_back(light);
558 if (
node.attribute(
"matrix")) {
566 if (
node.attribute(
"translate")) {
572 if (
node.attribute(
"rotate")) {
578 if (
node.attribute(
"scale")) {
596 if (
shader->name == shadername) {
604 fprintf(stderr,
"Unknown shader \"%s\".\n", shadername.c_str());
613 state.smooth =
false;
622 for (xml_node
node = scene_node.first_child();
node;
node =
node.next_sibling()) {
663 fprintf(stderr,
"Unknown node \"%s\".\n",
node.name());
673 xml_parse_result parse_result;
676 parse_result = doc.load_file(path.c_str());
682 xml_node cycles = doc.child(
"cycles");
686 fprintf(stderr,
"%s read error: %s\n", src.c_str(), parse_result.description());
700 state.smooth =
false;
701 state.dicing_rate = 1.0f;
typedef float(TangentPoint)[2]
_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 width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Shader
ATTR_WARN_UNUSED_RESULT const BMVert * v2
SIMD_FORCE_INLINE btVector3 rotate(const btVector3 &wAxis, const btScalar angle) const
Return a rotated version of this vector.
Attribute * add(ustring name, TypeDesc type, AttributeElement element)
bool need_attribute(Scene *scene, AttributeStandard std)
vector< ShaderOutput * > outputs
vector< ShaderInput * > inputs
const SocketType & socket_type
void push_back_slow(const T &t)
static bool xml_read_float4(float4 *value, xml_node node, const char *name)
static bool xml_read_float3(float3 *value, xml_node node, const char *name)
static void xml_read_include(XMLReadState &state, const string &src)
static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node graph_node)
static bool xml_read_int_array(vector< int > &value, xml_node node, const char *name)
static bool xml_read_int(int *value, xml_node node, const char *name)
static bool xml_read_float_array(vector< float > &value, xml_node node, const char *name)
void xml_read_file(Scene *scene, const char *filepath)
static bool xml_read_string(string *str, xml_node node, const char *name)
static void xml_read_mesh(const XMLReadState &state, xml_node node)
static Mesh * xml_add_mesh(Scene *scene, const Transform &tfm)
static bool xml_equal_string(xml_node node, const char *name, const char *value)
static bool xml_read_float3_array(vector< float3 > &value, xml_node node, const char *name)
static void xml_read_light(XMLReadState &state, xml_node node)
static void xml_read_state(XMLReadState &state, xml_node node)
static void xml_read_camera(XMLReadState &state, xml_node node)
static void xml_read_transform(xml_node node, Transform &tfm)
static bool xml_read_float(float *value, xml_node node, const char *name)
static void xml_read_scene(XMLReadState &state, xml_node scene_node)
static void xml_read_shader(XMLReadState &state, xml_node node)
static void xml_read_background(XMLReadState &state, xml_node node)
#define CCL_NAMESPACE_END
#define make_float2(x, y)
#define make_float4(x, y, z, w)
#define make_float3(x, y, z)
void KERNEL_FUNCTION_FULL_NAME() shader(KernelGlobals *kg, uint4 *input, float4 *output, int type, int filter, int i, int offset, int sample)
void xml_read_node(XMLReader &reader, Node *node, xml_node xml_node)
void update(Scene *scene)
void reserve_subd_faces(int numfaces, int num_ngons, int numcorners)
void reserve_mesh(int numverts, int numfaces)
@ SUBDIVISION_CATMULL_CLARK
void add_triangle(int v0, int v1, int v2, int shader, bool smooth)
void add_subd_face(int *corners, int num_corners, int shader_, bool smooth_)
static const NodeType * find(ustring name)
vector< Geometry * > geometry
vector< Object * > objects
map< ustring, Node * > node_map
ccl_device_inline float3 zero_float3()
ccl_device_inline float4 zero_float4()
string path_dirname(const string &path)
bool path_is_relative(const string &path)
string path_join(const string &dir, const string &file)
string path_filename(const string &path)
ccl_device_inline Transform projection_to_transform(const ProjectionTransform &a)
ccl_device_inline ProjectionTransform projection_transpose(const ProjectionTransform &a)
bool string_iequals(const string &a, const string &b)
void string_split(vector< string > &tokens, const string &str, const string &separators, bool skip_empty_tokens)