00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024 #ifndef UTILS_HPP
00025 #define UTILS_HPP
00026
00027 #include <map>
00028 #include <list>
00029 #include "ShChannelNode.hpp"
00030 #include "ShTextureNode.hpp"
00031 #include "ShCtrlGraph.hpp"
00032 #include "ShProgramNode.hpp"
00033
00034 namespace shgl {
00035
00036 typedef std::map<SH::ShChannelNodePtr, SH::ShTextureNodePtr> ChannelMap;
00037
00038
00039 struct ChannelGatherer {
00040 ChannelGatherer(ChannelMap& channel_map, SH::ShTextureDims dims)
00041 : channel_map(channel_map),
00042 dims(dims)
00043 {
00044 }
00045
00046 void operator()(const SH::ShCtrlGraphNode* node);
00047
00048 ChannelMap& channel_map;
00049 SH::ShTextureDims dims;
00050 };
00051
00052
00053
00054
00055 class TexFetcher {
00056 public:
00057 TexFetcher(ChannelMap& channel_map,
00058 const SH::ShVariableNodePtr& tc_node,
00059 bool indexed,
00060 const SH::ShProgramNodePtr& program);
00061
00062 void operator()(SH::ShCtrlGraphNode* node);
00063
00064 private:
00065 ChannelMap& channel_map;
00066 SH::ShVariableNodePtr tc_node;
00067 bool indexed;
00068 SH::ShProgramNodePtr program;
00069 };
00070
00071 void split_program(SH::ShProgramNode* program,
00072 std::list<SH::ShProgramNodePtr>& programs,
00073 const std::string& target);
00074
00075 }
00076
00077 #endif