59 xml_attribute attr =
node.attribute(name);
62 *value = atoi(attr.value());
71 xml_attribute attr =
node.attribute(name);
77 foreach (
const string &token, tokens)
78 value.push_back(atoi(token.c_str()));
88 xml_attribute attr =
node.attribute(name);
91 *value = (
float)atof(attr.value());
100 xml_attribute attr =
node.attribute(name);
106 foreach (
const string &token, tokens)
107 value.push_back((
float)atof(token.c_str()));
132 for (
size_t i = 0; i <
array.
size(); i += 3)
155 xml_attribute attr =
node.attribute(name);
167 xml_attribute attr =
node.attribute(name);
185 cam->set_full_width(
width);
186 cam->set_full_height(
height);
190 cam->set_matrix(
state.tfm);
201 AlembicProcedural *proc =
state.scene->create_node<AlembicProcedural>();
204 for (xml_node
node = graph_node.first_child();
node;
node =
node.next_sibling()) {
208 ustring object_path(path, 0);
209 AlembicObject *
object =
static_cast<AlembicObject *
>(
210 proc->get_or_create_object(object_path));
214 object->set_used_shaders(used_shaders);
233 for (xml_node
node = graph_node.first_child();
node;
node =
node.next_sibling()) {
234 ustring node_name(
node.name());
236 if (node_name ==
"connect") {
243 if (from_tokens.size() == 2 && to_tokens.size() == 2) {
244 ustring from_node_name(from_tokens[0]);
245 ustring from_socket_name(from_tokens[1]);
246 ustring to_node_name(to_tokens[0]);
247 ustring to_socket_name(to_tokens[1]);
253 if (graph_reader.
node_map.find(from_node_name) != graph_reader.
node_map.end()) {
262 "Unknown output socket name \"%s\" on \"%s\".\n",
263 from_node_name.c_str(),
264 from_socket_name.c_str());
267 fprintf(stderr,
"Unknown shader node name \"%s\".\n", from_node_name.c_str());
269 if (graph_reader.
node_map.find(to_node_name) != graph_reader.
node_map.end()) {
278 "Unknown input socket name \"%s\" on \"%s\".\n",
279 to_socket_name.c_str(),
280 to_node_name.c_str());
283 fprintf(stderr,
"Unknown shader node name \"%s\".\n", to_node_name.c_str());
290 fprintf(stderr,
"Invalid from or to value for connect node.\n");
298 if (node_name ==
"osl_shader") {
302 std::string filepath;
309 snode = OSLShaderManager::osl_node(
graph, manager, filepath,
"");
312 fprintf(stderr,
"Failed to create OSL node from \"%s\".\n", filepath.c_str());
317 fprintf(stderr,
"OSL node missing \"src\" attribute.\n");
322 fprintf(stderr,
"OSL node without using --shadingsys osl.\n");
330 if (node_name ==
"background")
331 node_name =
"background_shader";
336 fprintf(stderr,
"Unknown shader node \"%s\".\n",
node.name());
340 fprintf(stderr,
"Node type \"%s\" is not a shader node.\n", node_type->
name.c_str());
344 fprintf(stderr,
"Can't create abstract node type \"%s\".\n", node_type->
name.c_str());
354 if (node_name ==
"image_texture") {
356 ustring filename(
path_join(
state.base, img->get_filename().string()));
357 img->set_filename(filename);
359 else if (node_name ==
"environment_texture") {
361 ustring filename(
path_join(
state.base, env->get_filename().string()));
362 env->set_filename(filename);
379 state.scene->shaders.push_back(shader);
404 object->set_geometry(
mesh);
405 object->set_tfm(tfm);
417 mesh->set_used_shaders(used_shaders);
445 mesh->set_verts(P_array);
447 size_t num_triangles = 0;
448 for (
size_t i = 0; i < nverts.size(); i++)
449 num_triangles += nverts[i] - 2;
453 int index_offset = 0;
455 for (
size_t i = 0; i < nverts.size(); i++) {
456 for (
int j = 0; j < nverts[i] - 2; j++) {
457 int v0 =
verts[index_offset];
458 int v1 =
verts[index_offset + j + 1];
459 int v2 =
verts[index_offset + j + 2];
461 assert(v0 < (
int)
P.size());
462 assert(
v1 < (
int)
P.size());
463 assert(
v2 < (
int)
P.size());
468 index_offset += nverts[i];
472 ustring name = ustring(
"UVMap");
478 for (
size_t i = 0; i < nverts.size(); i++) {
479 for (
int j = 0; j < nverts[i] - 2; j++) {
480 int v0 = index_offset;
481 int v1 = index_offset + j + 1;
482 int v2 = index_offset + j + 2;
484 assert(v0 * 2 + 1 < (
int)UV.size());
485 assert(
v1 * 2 + 1 < (
int)UV.size());
486 assert(
v2 * 2 + 1 < (
int)UV.size());
488 fdata[0] =
make_float2(UV[v0 * 2], UV[v0 * 2 + 1]);
494 index_offset += nverts[i];
500 mesh->set_verts(P_array);
502 size_t num_ngons = 0;
503 size_t num_corners = 0;
504 for (
size_t i = 0; i < nverts.size(); i++) {
505 num_ngons += (nverts[i] == 4) ? 0 : 1;
506 num_corners += nverts[i];
511 int index_offset = 0;
513 for (
size_t i = 0; i < nverts.size(); i++) {
515 index_offset += nverts[i];
520 ustring name = ustring(
"UVMap");
531 for (
size_t i = 0; i < nverts.size(); i++) {
532 for (
int j = 0; j < nverts[i]; j++) {
539 float dicing_rate =
state.dicing_rate;
541 dicing_rate =
std::max(0.1f, dicing_rate);
543 mesh->set_subd_dicing_rate(dicing_rate);
562 light->set_shader(
state.shader);
565 state.scene->lights.push_back(light);
572 if (
node.attribute(
"matrix")) {
580 if (
node.attribute(
"translate")) {
586 if (
node.attribute(
"rotate")) {
592 if (
node.attribute(
"scale")) {
610 if (shader->
name == shadername) {
611 state.shader = shader;
618 fprintf(stderr,
"Unknown shader \"%s\".\n", shadername.c_str());
627 state.smooth =
false;
636 for (xml_node
node = scene_node.first_child();
node;
node =
node.next_sibling()) {
682 fprintf(stderr,
"Unknown node \"%s\".\n",
node.name());
692 xml_parse_result parse_result;
695 parse_result = doc.load_file(path.c_str());
701 xml_node cycles = doc.child(
"cycles");
705 fprintf(stderr,
"%s read error: %s\n",
src.c_str(), parse_result.description());
719 state.smooth =
false;
720 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 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 width
_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
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
void set_graph(ShaderGraph *graph)
void tag_update(Scene *scene)
void push_back_slow(const T &t)
#define CCL_NAMESPACE_END
ccl_device_inline Transform projection_to_transform(const ProjectionTransform &a)
ccl_device_inline ProjectionTransform projection_transpose(const ProjectionTransform &a)
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)
SyclQueue void void * src
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
ccl_device_inline float3 zero_float3()
ccl_device_inline float4 zero_float4()
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken Shader("Shader", pxr::TfToken::Immortal)
void xml_read_node(XMLReader &reader, Node *node, xml_node xml_node)
smooth(Type::FLOAT, "mask_weight")
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)
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)
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(const int *corners, int num_corners, int shader_, bool smooth_)
static const NodeType * find(ustring name)
void set_owner(const NodeOwner *owner_)
vector< Geometry * > geometry
vector< Object * > objects
map< ustring, Node * > node_map