CrystalSpace

Public API Reference

imap/services.h
Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001 by Norman Kraemer
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IMAP_SYNTAXSERVICE_H__
00020 #define __CS_IMAP_SYNTAXSERVICE_H__
00021 
00028 #include "csutil/scf.h"
00029 
00030 #include "iutil/databuff.h"
00031 #include "ivideo/graph3d.h"
00032 
00033 class csBox3;
00034 class csColor;
00035 class csColor4;
00036 class csMatrix3;
00037 class csOBB;
00038 class csPlane3;
00039 class csShaderVariable;
00040 class csVector2;
00041 class csVector3;
00042 
00043 struct csAlphaMode;
00044 
00045 struct iDocumentNode;
00046 struct iGradient;
00047 struct iKeyValuePair;
00048 struct iLoaderContext;
00049 struct iMaterialWrapper;
00050 struct iRenderBuffer;
00051 struct iSector;
00052 struct iShader;
00053 struct iShaderVariableAccessor;
00054 struct iString;
00055 struct iStringSet;
00056 
00059 
00060 #define CSTEX_UV 1  
00061 
00062 #define CSTEX_V1 2  
00063 
00064 #define CSTEX_V2 4  
00065 
00066 #define CSTEX_UV_SHIFT 8 
00067 
00069 namespace CS
00070 {
00071   namespace Utility
00072   {
00073     struct PortalParameters
00074     {
00075       uint32 flags;
00076       bool mirror;
00077       bool warp;
00078       int msv;
00079       csMatrix3 m;
00080       csVector3 before;
00081       csVector3 after;
00082       iString* destSector;
00083       bool autoresolve;
00084       
00085       PortalParameters() : flags (0), mirror (false), warp (false), msv (-1),
00086         before(0.0f), after(0.0f), destSector (0), autoresolve (true) {}
00087     };
00088   } // namespace CS
00089 } // namespace CS
00090 
00095 struct iSyntaxService : public virtual iBase
00096 {
00097   SCF_INTERFACE (iSyntaxService, 3, 0, 1);
00098   
00105   virtual void ReportError (const char* msgid, iDocumentNode* errornode,
00106         const char* msg, ...) CS_GNUC_PRINTF(4,5) = 0;
00107 
00112   virtual void ReportBadToken (iDocumentNode* badtokennode) = 0;
00113 
00118   virtual void Report (const char* msgid, int severity, 
00119     iDocumentNode* errornode, const char* msg, ...) CS_GNUC_PRINTF(5,6) = 0;
00136   virtual bool ParseBool (iDocumentNode* node, bool& result,
00137         bool def_result) = 0;
00138  
00161   virtual bool ParseBoolAttribute (iDocumentNode* node, const char* attrname,
00162         bool& result, bool def_result, bool required) = 0;
00163 
00167   virtual bool WriteBool (iDocumentNode* node, const char* name, 
00168     bool value) = 0;
00169   
00174   bool WriteBool (iDocumentNode* node, const char* name, bool value, 
00175     bool default_value) 
00176   { 
00177     if (value != default_value) 
00178       return WriteBool (node, name, value); 
00179     else
00180       return true;
00181   }
00182 
00186   virtual bool ParsePlane (iDocumentNode* node, csPlane3 &p) = 0;
00187 
00191   virtual bool WritePlane (iDocumentNode* node, const csPlane3& p) = 0;
00192   
00196   virtual bool ParseMatrix (iDocumentNode* node, csMatrix3 &m) = 0;
00197 
00201   virtual bool WriteMatrix (iDocumentNode* node, const csMatrix3& m) = 0;
00202 
00206   virtual bool ParseVector (iDocumentNode* node, csVector3 &v) = 0;
00207 
00211   virtual bool WriteVector (iDocumentNode* node, const csVector3& v) = 0;
00212 
00216   virtual bool ParseVector (iDocumentNode* node, csVector2 &v) = 0;
00217 
00221   virtual bool WriteVector (iDocumentNode* node, const csVector2& v) = 0;
00222 
00226   virtual bool ParseBox (iDocumentNode* node, csBox3 &v) = 0;
00227 
00231   virtual bool WriteBox (iDocumentNode* node, const csBox3& v) = 0;
00232 
00236   virtual bool ParseBox (iDocumentNode* node, csOBB &b) = 0;
00237 
00241   virtual bool WriteBox (iDocumentNode* node, const csOBB& b) = 0;
00242 
00246   virtual bool ParseColor (iDocumentNode* node, csColor &c) = 0;
00247 
00251   virtual bool WriteColor (iDocumentNode* node, const csColor& c) = 0;
00252 
00256   virtual bool ParseColor (iDocumentNode* node, csColor4 &c) = 0;
00257 
00261   virtual bool WriteColor (iDocumentNode* node, const csColor4& c) = 0;
00262 
00266   virtual bool ParseMixmode (iDocumentNode* node, uint &mixmode,
00267     bool allowFxMesh = false) = 0;
00268 
00272   virtual bool WriteMixmode (iDocumentNode* node, uint mixmode,
00273     bool allowFxMesh) = 0;
00274 
00281   virtual bool ParseGradient (iDocumentNode* node,
00282                               iGradient* gradient) = 0;
00283 
00287   virtual bool WriteGradient (iDocumentNode* node,
00288                               iGradient* gradient) = 0;
00289 
00293   virtual bool ParseShaderVar (iLoaderContext* ldr_context,
00294       iDocumentNode* node, csShaderVariable& var,
00295       iStringArray* failedTextures = 0) = 0;
00300   virtual csRef<iShaderVariableAccessor> ParseShaderVarExpr (
00301     iDocumentNode* node) = 0;
00302                             
00306   virtual bool WriteShaderVar (iDocumentNode* node, 
00307     csShaderVariable& var) = 0;
00308                             
00312   virtual bool ParseAlphaMode (iDocumentNode* node, iStringSet* strings,
00313     csAlphaMode& alphaMode, bool allowAutoMode = true) = 0;
00314     
00318   virtual bool WriteAlphaMode (iDocumentNode* node, iStringSet* strings,
00319     const csAlphaMode& alphaMode) = 0;
00320     
00330   virtual bool ParseZMode (iDocumentNode* node, csZBufMode& zmode,
00331     bool allowZmesh = false) = 0;
00332 
00336   virtual bool WriteZMode (iDocumentNode* node, csZBufMode zmode,
00337     bool allowZmesh) = 0;
00338 
00343   virtual csPtr<iKeyValuePair> ParseKey (iDocumentNode* node) = 0;
00344   
00349   virtual bool WriteKey (iDocumentNode* node, iKeyValuePair* keyvalue) = 0;
00350 
00354   virtual csRef<iRenderBuffer> ParseRenderBuffer (iDocumentNode* node) = 0;
00355 
00361   virtual bool ParseRenderBuffer (iDocumentNode* node, iRenderBuffer* buffer) = 0;
00362 
00371   virtual bool WriteRenderBuffer (iDocumentNode* node, iRenderBuffer* buffer) = 0;
00372   
00378   virtual csRef<iRenderBuffer> ReadRenderBuffer (iDataBuffer* buf) = 0;
00379   
00384   virtual csRef<iDataBuffer> StoreRenderBuffer (iRenderBuffer* rbuf) = 0;
00385   
00396   virtual csRef<iShader> ParseShaderRef (iLoaderContext* ldr_context,
00397       iDocumentNode* node) = 0;
00398 
00403   virtual csRef<iShader> ParseShader (iLoaderContext* ldr_context,
00404       iDocumentNode* node) = 0;
00405 
00418   virtual bool HandlePortalParameter (
00419     iDocumentNode* child, iLoaderContext* ldr_context,
00420     csRef<csRefCount>& parseState, CS::Utility::PortalParameters& params,
00421     bool& handled) = 0;
00422 
00426   virtual bool ParseMatrix (iDocumentNode* node, CS::Math::Matrix4& m) = 0;
00427 };
00428 
00431 #endif // __CS_IMAP_SYNTAXSERVICE_H__
00432 

Generated for Crystal Space 2.0 by doxygen 1.7.6.1