cstool/userrndbuf.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

cstool/userrndbuf.h
Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2003 by Philipp Aumayr
    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_CSTOOL_USERRNDBUF_H__
    00020 #define __CS_CSTOOL_USERRNDBUF_H__
    00021
    00026 #include "csextern.h"
    00027
    00028 #include "ivideo/shader/shader.h"
    00029
    00030 #include "csutil/scf.h"
    00031 #include "csutil/strset.h"
    00032
    00033 struct iRenderBuffer;
    00034
    00038 struct iUserRenderBufferIterator : public virtual iBase
    00039 {
    00040   SCF_INTERFACE(iUserRenderBufferIterator, 2,0,0);
    00042   virtual bool HasNext() = 0;
    00044   virtual CS::ShaderVarStringID Next (csRef<iRenderBuffer>* buf = 0) = 0;
    00046   virtual void Reset() = 0;
    00047 };
    00048
    00053 class CS_CRYSTALSPACE_EXPORT csUserRenderBufferManager
    00054 {
    00055   struct userbuffer
    00056   {
    00057     csRef<iRenderBuffer> buf;
    00058     CS::ShaderVarStringID name;
    00059   };
    00060   class UserBufArrayCmp : public csArrayCmp<userbuffer, CS::ShaderVarStringID>
    00061   {
    00062     static int BufKeyCompare (userbuffer const& b, CS::ShaderVarStringID const& k)
    00063     {
    00064       return b.name - k;
    00065     }
    00066   public:
    00067     UserBufArrayCmp (CS::ShaderVarStringID key) :
    00068       csArrayCmp<userbuffer, CS::ShaderVarStringID> (key, &BufKeyCompare)
    00069     {
    00070     }
    00071   };
    00072   static int BufCompare (userbuffer const& r, userbuffer const& k);
    00073
    00074   csArray<userbuffer> userBuffers;
    00075 public:
    00077   iRenderBuffer* GetRenderBuffer (CS::ShaderVarStringID name) const;
    00082   bool AddRenderBuffer (CS::ShaderVarStringID name, iRenderBuffer* buffer);
    00087   bool RemoveRenderBuffer (CS::ShaderVarStringID name);
    00088
    00089   csRef<iUserRenderBufferIterator> GetBuffers() const;
    00090 };
    00091
    00092 #endif // __CS_CSTOOL_USERRNDBUF_H__