Katana Plug-in APIs 0.1

FnRendererInfoPluginClient.h

00001 // Copyright (c) 2012 The Foundry Visionmongers Ltd. All Rights Reserved.
00002 
00003 
00004 #ifndef INCLUDED_RENDERING_FNRENDERERINFOPLUGIN_H
00005 #define INCLUDED_RENDERING_FNRENDERERINFOPLUGIN_H
00006 
00007 #include <FnRendererInfo/suite/FnRendererInfoSuite.h>
00008 #include <FnRendererInfo/suite/RendererObjectDefinitions.h>
00009 
00010 #include <string>
00011 #include <vector>
00012 #include <map>
00013 #include <memory>
00014 
00015 #include <FnAttribute/FnAttribute.h>
00016 #include <FnAttribute/FnGroupBuilder.h>
00017 
00018 #include "FnRendererInfoAPI.h"
00019 #include "ns.h"
00020 
00021 FNRENDERERINFO_NAMESPACE_ENTER
00022 {
00023   class FNRENDERERINFO_API FnRendererObjectInfo
00024   {
00025     public:
00026       FnRendererObjectInfo(const FnAttribute::GroupAttribute & infoAttr);
00027       ~FnRendererObjectInfo();
00028 
00029       typedef std::shared_ptr<FnRendererObjectInfo> Ptr;
00030 
00031       struct ParamInfo
00032       {
00033         std::string name;
00034         int type;
00035         int arraySize;
00036         FnAttribute::Attribute defaultAttr;
00037         FnAttribute::Attribute hintsAttr;
00038         FnAttribute::Attribute enumsAttr;
00039       };
00040 
00041       const std::string & getName() const {return _name;}
00042       const std::string & getType() const {return _type;}
00043       const std::vector<std::string> & getTypeTags() const {return _typeTags;}
00044       const std::string & getLocation() const {return _location;}
00045       const std::string & getFullPath() const {return _fullPath;}
00046       const std::vector<ParamInfo> &getParams() const {return _params;}
00047       int getOutputType() const {return _outputType;}
00048       FnAttribute::Attribute getContainerHints() const {return _containerHints;}
00049 
00050       int getParamIndex(const std::string & name) const
00051       {
00052         std::map<std::string, size_t>::const_iterator I =
00053           _paramIndexMap.find(name);
00054         if (I != _paramIndexMap.end())
00055         {
00056             return (int)(*I).second;
00057         }
00058         return -1;
00059       }
00060 
00061 
00062 
00063     private:
00064       void _parseInfo(const FnAttribute::GroupAttribute & infoAttr);
00065       void _parseProtocol1(const FnAttribute::GroupAttribute & infoAttr);
00066       std::string _stringFromChildAttr(const FnAttribute::GroupAttribute & infoAttr,
00067         const std::string &childName, const std::string &parentStr);
00068       int _intFromChildAttr(const FnAttribute::GroupAttribute & infoAttr,
00069         const std::string &childName, const std::string &parentStr);
00070 
00071       std::string _name;
00072       std::string _type;
00073       std::vector<std::string> _typeTags;
00074       std::string _location;
00075       std::string _fullPath;
00076       std::vector<ParamInfo> _params;
00077       std::map<std::string, size_t> _paramIndexMap;
00078       int _outputType;
00079       FnAttribute::Attribute _containerHints;
00080   };
00081 
00082   // Class that wraps a specific instance of RendererInfoPluginSuite_v2
00083   class FNRENDERERINFO_API FnRendererInfoPlugin
00084   {
00085   public:
00086     FnRendererInfoPlugin(const RendererInfoPluginSuite_v2 *suite);
00087     ~FnRendererInfoPlugin();
00088 
00089     typedef std::shared_ptr<FnRendererInfoPlugin> Ptr;
00090 
00091     FnAttribute::GroupAttribute getRenderMethods();
00092     FnAttribute::GroupAttribute getBatchRenderMethod();
00093 
00094     void getRendererObjectNames(const std::string &type,
00095         const std::vector<std::string> &typeTags, std::vector<std::string> &result);
00096 
00097     void getRendererObjectTypes(const std::string &type, std::vector<std::string> &result);
00098     void getRendererShaderTypeTags(const std::string &shaderType, std::vector<std::string> &result);
00099     void getRendererCoshaderType(std::string &result);
00100     void getRegisteredRendererName(std::string &result);
00101     void getRegisteredRendererVersion(std::string &result);
00102     bool isPresetLocalFileNeeded(const std::string &outputType);
00103     bool isPolymeshFacesetSplittingEnabled();
00104     void getRendererObjectDefaultType(const std::string &type, std::string &result);
00105 
00106     bool isNodeTypeSupported(const std::string &nodeType);
00107 
00108     // Shader Inputs / Outputs
00109     void getShaderInputNames(const std::string &shader,
00110                              std::vector<std::string> &result);
00111 
00112     void getShaderInputTags(const std::string &shader,
00113                             const std::string &inputName,
00114                             std::vector<std::string> &result);
00115 
00116     void getShaderOutputNames(const std::string &shader,
00117                               std::vector<std::string> &result);
00118 
00119     void getShaderOutputTags(const std::string &shader,
00120                              const std::string &outputName,
00121                              std::vector<std::string> &result);
00122 
00123     FnRendererObjectInfo::Ptr getRendererObjectInfo(const std::string &name,
00124         const std::string &type, const FnAttribute::Attribute & inputData);
00125 
00126     void setTypeTagNameFilter(const std::string &filter, const std::string &typeTag);
00127 
00128     void addObjectLocation(const std::string &type, const std::string &location);
00129     void clearObjectLocations(const std::string &type);
00130 
00131     void setPluginPath(const std::string &plugin_path);
00132     void setPluginRootPath(const std::string &plugin_path);
00133 
00134     void setKatanaPath(const std::string &katana_path);
00135 
00136     void setTmpPath(const std::string &tmp_path);
00137 
00138     void flushCaches();
00139 
00140     void getLiveRenderTerminalOps(FnAttribute::GroupAttribute& terminalOps,
00141                                   const FnAttribute::GroupAttribute& stateArgs);
00142     void getRenderTerminalOps(FnAttribute::GroupAttribute& terminalOps,
00143                               const FnAttribute::GroupAttribute& stateArgs);
00144 
00145     const RendererInfoPluginSuite_v2 *getRendererInfoSuite() {return _suite;}
00146     RendererInfoPluginHandle getHandle() {return _handle;}
00147 
00148   private:
00149     const RendererInfoPluginSuite_v2 *_suite;
00150     RendererInfoPluginHandle _handle;
00151 
00152     // no copy/assign
00153     FnRendererInfoPlugin(const FnRendererInfoPlugin &rhs);
00154     FnRendererInfoPlugin &operator=(const FnRendererInfoPlugin &rhs);
00155   };
00156 }
00157 FNRENDERERINFO_NAMESPACE_EXIT
00158 
00159 #endif // INCLUDED_RENDERING_FNRENDERERINFOPLUGIN_H
 All Classes Functions Variables Typedefs Enumerations Enumerator