Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/graph.h
| Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | #define SHADER_NODE_NO_CLONE_CLASS(type) \ | ||||
| virtual void compile(SVMCompiler& compiler); \ | virtual void compile(SVMCompiler& compiler); \ | ||||
| virtual void compile(OSLCompiler& compiler); \ | virtual void compile(OSLCompiler& compiler); \ | ||||
| #define SHADER_NODE_BASE_CLASS(type) \ | #define SHADER_NODE_BASE_CLASS(type) \ | ||||
| virtual ShaderNode *clone() const { return new type(*this); } \ | virtual ShaderNode *clone() const { return new type(*this); } \ | ||||
| virtual void compile(SVMCompiler& compiler); \ | virtual void compile(SVMCompiler& compiler); \ | ||||
| virtual void compile(OSLCompiler& compiler); \ | virtual void compile(OSLCompiler& compiler); \ | ||||
| class ShaderNodeIDComparator | |||||
| { | |||||
| public: | |||||
| bool operator()(const ShaderNode *n1, const ShaderNode *n2) const | |||||
| { | |||||
| return n1->id < n2->id; | |||||
| } | |||||
| }; | |||||
| typedef set<ShaderNode*, ShaderNodeIDComparator> ShaderNodeSet; | |||||
| typedef map<ShaderNode*, ShaderNode*, ShaderNodeIDComparator> ShaderNodeMap; | |||||
| /* Graph | /* Graph | ||||
| * | * | ||||
| * Shader graph of nodes. Also does graph manipulations for default inputs, | * Shader graph of nodes. Also does graph manipulations for default inputs, | ||||
| * bump mapping from displacement, and possibly other things in the future. */ | * bump mapping from displacement, and possibly other things in the future. */ | ||||
| class ShaderGraph { | class ShaderGraph { | ||||
| public: | public: | ||||
| list<ShaderNode*> nodes; | list<ShaderNode*> nodes; | ||||
| Show All 20 Lines | public: | ||||
| int get_num_closures(); | int get_num_closures(); | ||||
| void dump_graph(const char *filename); | void dump_graph(const char *filename); | ||||
| protected: | protected: | ||||
| typedef pair<ShaderNode* const, ShaderNode*> NodePair; | typedef pair<ShaderNode* const, ShaderNode*> NodePair; | ||||
| void find_dependencies(set<ShaderNode*>& dependencies, ShaderInput *input); | void find_dependencies(ShaderNodeSet& dependencies, ShaderInput *input); | ||||
| void copy_nodes(set<ShaderNode*>& nodes, map<ShaderNode*, ShaderNode*>& nnodemap); | void copy_nodes(ShaderNodeSet& nodes, ShaderNodeMap& nnodemap); | ||||
| void break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack); | void break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack); | ||||
| void clean(Scene *scene); | void clean(Scene *scene); | ||||
| void simplify_nodes(Scene *scene); | void simplify_nodes(Scene *scene); | ||||
| void bump_from_displacement(); | void bump_from_displacement(); | ||||
| void refine_bump_nodes(); | void refine_bump_nodes(); | ||||
| void default_inputs(bool do_osl); | void default_inputs(bool do_osl); | ||||
| void transform_multi_closure(ShaderNode *node, ShaderOutput *weight_out, bool volume); | void transform_multi_closure(ShaderNode *node, ShaderOutput *weight_out, bool volume); | ||||
| }; | }; | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif /* __GRAPH_H__ */ | #endif /* __GRAPH_H__ */ | ||||