CrystalSpace

Public API Reference

csplugincommon/shader/weavercombiner.h
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2003-2007 by Marten Svanfeldt
00003                 2004-2007 by Frank Richter
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Library General Public
00007   License as published by the Free Software Foundation; either
00008   version 2 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013   Library General Public License for more details.
00014 
00015   You should have received a copy of the GNU Library General Public
00016   License along with this library; if not, write to the Free
00017   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_CSPLUGINCOMMON_SHADER_WEAVERCOMBINER_H__
00021 #define __CS_CSPLUGINCOMMON_SHADER_WEAVERCOMBINER_H__
00022 
00023 #include "iutil/document.h"
00024 #include "ivideo/graph3d.h"
00025 
00026 #include "csutil/scf.h"
00027 #include "csgeom/vector4.h"
00028 #include <limits.h>
00029 
00036 struct iString;
00037 
00038 namespace CS
00039 {
00040   namespace PluginCommon
00041   {
00042     namespace ShaderWeaver
00043     {
00044       static const uint NoCoercion = UINT_MAX;
00045 
00046       struct iCoerceChainIterator : public iDocumentNodeIterator
00047       {
00048         SCF_INTERFACE (iCoerceChainIterator, 0, 1, 0);
00049         
00050         virtual csRef<iDocumentNode> Next () = 0;
00051         virtual csRef<iDocumentNode> Next (const char*& fromType, 
00052           const char*& toType) = 0;
00053       };
00054     
00055       struct iCombiner : public virtual iBase
00056       {
00057         SCF_INTERFACE (iCombiner, 1, 0, 1);
00058         
00060         virtual void BeginSnippet (const char* annotation = 0) = 0;
00062         virtual void AddInput (const char* name, const char* type) = 0;
00064         virtual void AddInputValue (const char* name, const char* type,
00065           const char* value) = 0;
00067         virtual void AddOutput (const char* name, const char* type) = 0;
00069         virtual void InputRename (const char* fromName, const char* toName) = 0;
00071         virtual void OutputRename (const char* fromName, const char* toName) = 0;
00076         virtual void PropagateAttributes (const char* fromInput,
00077           const char* toOutput) = 0;
00079         virtual void AddOutputAttribute (const char* outputName, 
00080           const char* name, const char* type) = 0;
00082         virtual void AddInputAttribute (const char* inputName,
00083           const char* name, const char* type, const char* defVal) = 0;
00088         virtual void Link (const char* fromName, const char* toName) = 0;
00090         virtual void WriteBlock (const char* location, 
00091           iDocumentNode* blockNodes) = 0;
00093         virtual bool EndSnippet () = 0;
00094         
00096         virtual void AddGlobal (const char* name, const char* type,
00097           const char* annotation = 0) = 0;
00099         virtual void SetOutput (csRenderTargetAttachment target,
00100           const char* name, const char* annotation = 0) = 0;
00101         
00106         /* @@@ FIXME: A bit of a design issue that weaver nodes are returned,
00107                       since that means combiners have to "know" the syntax of
00108                       weaver input docs! */
00109         virtual csPtr<iCoerceChainIterator> QueryCoerceChain (const char* fromType,
00110           const char* toType) = 0;
00111 
00118         virtual uint CoerceCost (const char* fromType, const char* toType) = 0;
00119         
00121         virtual void WriteToPass (iDocumentNode* pass) = 0;
00122         
00127         virtual bool CompatibleParams (iDocumentNode* params) = 0;
00128 
00135         virtual csRef<iString> QueryInputTag (const char* location, 
00136           iDocumentNode* blockNodes) = 0;
00137           
00142         virtual void SetDescription (const char* descr) = 0;
00143       };
00144       
00145       struct iCombinerLoader : public virtual iBase
00146       {
00147         SCF_INTERFACE (iCombinerLoader, 0, 0, 4);
00148         
00149         virtual csPtr<iCombiner> GetCombiner (iDocumentNode* params) = 0;
00150 
00151         virtual void GenerateConstantInputBlocks (iDocumentNode* node,
00152           const char* locationPrefix, const csVector4& value,
00153           int usedComponents, const char* outputName) = 0;
00154         virtual void GenerateSVInputBlocks (iDocumentNode* node,
00155           const char* locationPrefix, const char* svName, 
00156           const char* outputType, const char* outputName, 
00157           const char* uniqueTag) = 0;
00158         virtual void GenerateBufferInputBlocks (iDocumentNode* node,
00159           const char* locationPrefix, const char* bufName, 
00160           const char* outputType, const char* outputName, 
00161           const char* uniqueTag) = 0;
00162 
00170         virtual const char* GetCodeString() = 0;
00171       };
00172     } // namespace ShaderWeaver
00173   } // namespace PluginCommon
00174 } // namespace CS
00175 
00178 #endif // __CS_CSPLUGINCOMMON_SHADER_WEAVERCOMBINER_H__
00179 

Generated for Crystal Space 2.0 by doxygen 1.7.6.1