<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Crystal Space 1.2.1: cstool/proctex.h Source File (Crystal Space 1.2.1 Public API Reference)</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="head"> <tr height="59"> <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td> <td class="head"><h2>Public API Reference</h2></td> </tr> <tr height="11"> <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td> </tr> </table> <div class="content"> <!-- Generated by Doxygen 1.5.3 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> <h1>cstool/proctex.h</h1><a href="proctex_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 2000-2001 by Jorrit Tyberghein</span> <a name="l00003"></a>00003 <span class="comment"> Copyright (C) 2000 by Samuel Humphreys</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00006"></a>00006 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00007"></a>00007 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00008"></a>00008 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> Library General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment"> You should have received a copy of the GNU Library General Public</span> <a name="l00016"></a>00016 <span class="comment"> License along with this library; if not, write to the Free</span> <a name="l00017"></a>00017 <span class="comment"> Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00018"></a>00018 <span class="comment">*/</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#ifndef __CS_PROCTEX_H__</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __CS_PROCTEX_H__</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00027"></a>00027 <span class="preprocessor">#include "csextern.h"</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="csobject_8h.html" title="Implementation for iObject.">csutil/csobject.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="ref_8h.html" title="Smart Pointers.">csutil/ref.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="scf__implementation_8h.html" title="Crystal Space Shared Class Facility (SCF) - implementation creation support.">csutil/scf_implementation.h</a>"</span> <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="iproctex_8h.html" title="Interface with properties common to all procedural textures.">itexture/iproctex.h</a>"</span> <a name="l00033"></a>00033 <span class="preprocessor">#include "<a class="code" href="iengine_2texture_8h.html" title="Texture interfaces.">iengine/texture.h</a>"</span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <a name="l00036"></a>00036 <span class="keyword">struct </span><a class="code" href="structiEngine.html" title="This interface is the main interface to the 3D engine.">iEngine</a>; <a name="l00037"></a>00037 <span class="keyword">struct </span><a class="code" href="structiEventHandler.html" title="This interface describes an entity that can receive events.">iEventHandler</a>; <a name="l00038"></a>00038 <span class="keyword">struct </span><a class="code" href="structiGraphics2D.html" title="This is the interface for 2D renderer.">iGraphics2D</a>; <a name="l00039"></a>00039 <span class="keyword">struct </span><a class="code" href="structiGraphics3D.html" title="This is the standard 3D graphics interface.">iGraphics3D</a>; <a name="l00040"></a>00040 <span class="keyword">struct </span><a class="code" href="structiMaterialWrapper.html" title="A material wrapper is an engine-level object that wraps around an actual material...">iMaterialWrapper</a>; <a name="l00041"></a>00041 <span class="keyword">struct </span><a class="code" href="structiObjectRegistry.html" title="This interface serves as a registry of other objects.">iObjectRegistry</a>; <a name="l00042"></a>00042 <span class="keyword">struct </span><a class="code" href="structiTextureManager.html" title="This is the standard texture manager interface.">iTextureManager</a>; <a name="l00043"></a>00043 <span class="keyword">struct </span><a class="code" href="structiTextureWrapper.html" title="A texture wrapper is an engine-level object that wraps around an actual texture (iTextureHandle)...">iTextureWrapper</a>; <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="keyword">class </span>csProcTexEventHandler; <a name="l00046"></a>00046 <a name="l00050"></a><a class="code" href="structiProcTexCallback.html">00050</a> <span class="keyword">struct </span><a class="code" href="structiProcTexCallback.html" title="A callback for when a iTextureWrapper is used.">iProcTexCallback</a> : <span class="keyword">public</span> <span class="keyword">virtual</span> <a class="code" href="structiBase.html" title="This is the basic interface: all other interfaces should be derived from this one...">iBase</a> <a name="l00051"></a>00051 { <a name="l00052"></a>00052 SCF_INTERFACE(<a class="code" href="structiProcTexCallback.html" title="A callback for when a iTextureWrapper is used.">iProcTexCallback</a>, 2,0,0); <a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="structiProcTexture.html" title="Interface to a texture factory.">iProcTexture</a>* <a class="code" href="structiProcTexCallback.html#4799df0a32b0ac12df949cebd091272a" title="Get csProcTexture.">GetProcTexture</a>() <span class="keyword">const</span> = 0; <a name="l00055"></a>00055 }; <a name="l00056"></a>00056 <a name="l00061"></a><a class="code" href="classcsProcTexture.html">00061</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsProcTexture.html" title="Generic superclass for procedural textures.">csProcTexture</a> : <a name="l00062"></a>00062 <span class="keyword">public</span> <a class="code" href="classscfImplementationExt2.html">scfImplementationExt2</a><csProcTexture, csObject, iTextureWrapper, <a name="l00063"></a>00063 iProcTexture> <a name="l00064"></a>00064 { <a name="l00065"></a><a class="code" href="classcsProcTexture.html#b3bb47fabcee34925bad8177a34c0c20">00065</a> <span class="keyword">friend</span> <span class="keyword">struct </span>csProcTexCallback; <a name="l00066"></a><a class="code" href="classcsProcTexture.html#def87d49369cc3edfbb7f62eb906a2bf">00066</a> <span class="keyword">friend</span> <span class="keyword">class </span>csProcTexEventHandler; <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="keyword">private</span>: <a name="l00069"></a>00069 <span class="comment">// Setup the procedural event handler (used for updating visible</span> <a name="l00070"></a>00070 <span class="comment">// proc textures).</span> <a name="l00071"></a>00071 <span class="keyword">static</span> <a class="code" href="structiEventHandler.html" title="This interface describes an entity that can receive events.">iEventHandler</a>* SetupProcEventHandler (<a class="code" href="structiObjectRegistry.html" title="This interface serves as a registry of other objects.">iObjectRegistry</a>* object_reg); <a name="l00072"></a>00072 <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iEventHandler></a> proceh; <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="keyword">protected</span>: <a name="l00075"></a>00075 <span class="comment">// Will be set to true as soon as pt is initialized.</span> <a name="l00076"></a><a class="code" href="classcsProcTexture.html#ffc85505160215f04fa4749567d47966">00076</a> <span class="keywordtype">bool</span> ptReady; <a name="l00077"></a>00077 <a name="l00078"></a>00078 <span class="comment">// Flags uses for the texture.</span> <a name="l00079"></a><a class="code" href="classcsProcTexture.html#30c8136d99baa03b55365894e06ae77c">00079</a> <span class="keywordtype">int</span> texFlags; <a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="comment">// Texture wrapper.</span> <a name="l00082"></a><a class="code" href="classcsProcTexture.html#7e5a89ca3b1f8e4d35230e7609639d22">00082</a> <a class="code" href="structiTextureWrapper.html" title="A texture wrapper is an engine-level object that wraps around an actual texture (iTextureHandle)...">iTextureWrapper</a>* tex; <a name="l00083"></a>00083 <span class="comment">// Dimensions of texture.</span> <a name="l00084"></a><a class="code" href="classcsProcTexture.html#e299c0a58650efa0e5af59bed6454ff4">00084</a> <span class="keywordtype">int</span> mat_w, mat_h; <a name="l00085"></a><a class="code" href="classcsProcTexture.html#1bd6c4922dd8d4ba2cf6b7d8540c9e05">00085</a> <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iImage></a> proc_image; <a name="l00086"></a><a class="code" href="classcsProcTexture.html#34d415c0ae5b093095676a32f8037f4b">00086</a> <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iGraphics3D></a> g3d; <a name="l00087"></a><a class="code" href="classcsProcTexture.html#f6ddb7a3444e1277ab638700c3524f75">00087</a> <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iGraphics2D></a> g2d; <a name="l00088"></a><a class="code" href="classcsProcTexture.html#776ff2703ead3f08a5bbe0fa565347f1">00088</a> <a class="code" href="structiObjectRegistry.html" title="This interface serves as a registry of other objects.">iObjectRegistry</a>* object_reg; <a name="l00089"></a><a class="code" href="classcsProcTexture.html#f2d06b15a86e2a5dff923188ca674fc8">00089</a> <span class="keywordtype">bool</span> anim_prepared; <a name="l00090"></a>00090 <a name="l00091"></a><a class="code" href="classcsProcTexture.html#e79a8b01dc1d43ec7124be9ce4c1f86e">00091</a> <span class="keywordtype">bool</span> key_color; <a name="l00092"></a><a class="code" href="classcsProcTexture.html#7056e8eb2fabefe0fe2071c804b3edd0">00092</a> <span class="keywordtype">int</span> key_red, key_green, key_blue; <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="comment">// If true (default) then proc texture will register a callback</span> <a name="l00095"></a>00095 <span class="comment">// so that the texture is automatically updated (Animate is called)</span> <a name="l00096"></a>00096 <span class="comment">// whenever it is used.</span> <a name="l00097"></a><a class="code" href="classcsProcTexture.html#16027e1806949fcb38df706796b17d0f">00097</a> <span class="keywordtype">bool</span> use_cb; <a name="l00098"></a>00098 <span class="comment">// always animate, even if not visible</span> <a name="l00099"></a><a class="code" href="classcsProcTexture.html#765c42b8c5bc46b4543cbbb188067816">00099</a> <span class="keywordtype">bool</span> always_animate; <a name="l00100"></a>00100 <span class="comment">// Are we visible? Can be 'false' if animated w/ 'always animate'.</span> <a name="l00101"></a><a class="code" href="classcsProcTexture.html#05fb2c1c662fcfceb675be4a0bbacdb2">00101</a> <span class="keywordtype">bool</span> visible; <a name="l00102"></a>00102 <a name="l00103"></a>00103 <span class="keyword">virtual</span> <a class="code" href="structiObject.html" title="This interface is an SCF interface for encapsulating csObject.">iObject</a> *QueryObject(); <a name="l00104"></a>00104 <span class="keyword">virtual</span> <a class="code" href="structiTextureWrapper.html" title="A texture wrapper is an engine-level object that wraps around an actual texture (iTextureHandle)...">iTextureWrapper</a> *Clone () <span class="keyword">const</span>; <a name="l00105"></a>00105 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetImageFile (<a class="code" href="structiImage.html" title="The iImage interface is used to work with image objects.">iImage</a> *Image); <a name="l00106"></a>00106 <span class="keyword">virtual</span> <a class="code" href="structiImage.html" title="The iImage interface is used to work with image objects.">iImage</a>* GetImageFile (); <a name="l00107"></a>00107 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetTextureHandle (<a class="code" href="structiTextureHandle.html" title="A texture handle as returned by iTextureManager.">iTextureHandle</a> *tex); <a name="l00108"></a>00108 <span class="keyword">virtual</span> <a class="code" href="structiTextureHandle.html" title="A texture handle as returned by iTextureManager.">iTextureHandle</a>* GetTextureHandle (); <a name="l00109"></a>00109 <span class="keyword">virtual</span> <span class="keywordtype">void</span> GetKeyColor (<span class="keywordtype">int</span> &red, <span class="keywordtype">int</span> &green, <span class="keywordtype">int</span> &blue) <span class="keyword">const</span>; <a name="l00110"></a>00110 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetFlags (<span class="keywordtype">int</span> flags); <a name="l00111"></a>00111 <span class="keyword">virtual</span> <span class="keywordtype">int</span> GetFlags () <span class="keyword">const</span>; <a name="l00112"></a>00112 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Register (<a class="code" href="structiTextureManager.html" title="This is the standard texture manager interface.">iTextureManager</a> *txtmng); <a name="l00113"></a>00113 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetUseCallback (<a class="code" href="structiTextureCallback.html" title="A callback for when a iTextureWrapper is used.">iTextureCallback</a>* callback); <a name="l00114"></a>00114 <span class="keyword">virtual</span> <a class="code" href="structiTextureCallback.html" title="A callback for when a iTextureWrapper is used.">iTextureCallback</a>* GetUseCallback () <span class="keyword">const</span>; <a name="l00115"></a>00115 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Visit (); <a name="l00116"></a>00116 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsVisitRequired () <span class="keyword">const</span>; <a name="l00117"></a>00117 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetKeepImage (<span class="keywordtype">bool</span> k); <a name="l00118"></a>00118 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> KeepImage () <span class="keyword">const</span>; <a name="l00119"></a>00119 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetTextureClass (<span class="keyword">const</span> <span class="keywordtype">char</span>* className); <a name="l00120"></a>00120 <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* GetTextureClass (); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> GetAlwaysAnimate () <span class="keyword">const</span>; <a name="l00123"></a>00123 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetAlwaysAnimate (<span class="keywordtype">bool</span> enable); <a name="l00124"></a>00124 <span class="keyword">virtual</span> <a class="code" href="structiTextureFactory.html" title="Interface to a texture factory.">iTextureFactory</a>* GetFactory(); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">virtual</span> <span class="keywordtype">void</span> UseTexture (); <a name="l00127"></a>00127 <span class="keyword">public</span>: <a name="l00128"></a>00128 <span class="comment">// The current time the previous time the callback was called.</span> <a name="l00129"></a>00129 <span class="comment">// This is used to detect if the callback is called multiple times</span> <a name="l00130"></a>00130 <span class="comment">// in one frame.</span> <a name="l00131"></a><a class="code" href="classcsProcTexture.html#71929c49dadf91bbca3222317e3452a5">00131</a> <a class="code" href="group__util.html#g28e82998c4c2d1197a1d412bba7da793" title="A time value measured in milliseconds (1/1000 of a second).">csTicks</a> last_cur_time; <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="keyword">private</span>: <a name="l00134"></a>00134 <span class="keyword">static</span> <span class="keywordtype">void</span> ProcCallback (<a class="code" href="structiTextureWrapper.html" title="A texture wrapper is an engine-level object that wraps around an actual texture (iTextureHandle)...">iTextureWrapper</a>* txt, <span class="keywordtype">void</span>* data); <a name="l00135"></a>00135 <a name="l00137"></a>00137 <a class="code" href="classcsRef.html" title="A smart pointer.">csRef<iTextureFactory></a> parent; <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="keyword">public</span>: <a name="l00140"></a>00140 <a class="code" href="classcsProcTexture.html" title="Generic superclass for procedural textures.">csProcTexture</a> (<a class="code" href="structiTextureFactory.html" title="Interface to a texture factory.">iTextureFactory</a>* p = 0, <a class="code" href="structiImage.html" title="The iImage interface is used to work with image objects.">iImage</a>* image = 0); <a name="l00141"></a>00141 <span class="keyword">virtual</span> ~<a class="code" href="classcsProcTexture.html" title="Generic superclass for procedural textures.">csProcTexture</a> (); <a name="l00142"></a>00142 <a name="l00143"></a><a class="code" href="classcsProcTexture.html#c35535f1f6dbdfa0c8b04ebff6ec28c0">00143</a> <a class="code" href="structiGraphics3D.html" title="This is the standard 3D graphics interface.">iGraphics3D</a>* GetG3D () { <span class="keywordflow">return</span> g3d; } <a name="l00144"></a><a class="code" href="classcsProcTexture.html#8a058cc8a0516570dc506e7d8520fef4">00144</a> <a class="code" href="structiGraphics2D.html" title="This is the interface for 2D renderer.">iGraphics2D</a>* GetG2D () { <span class="keywordflow">return</span> g2d; } <a name="l00145"></a>00145 <a name="l00153"></a><a class="code" href="classcsProcTexture.html#861662bb35dac2b9df9a98e788e24ee7">00153</a> <span class="keywordtype">void</span> DisableAutoUpdate () { use_cb = <span class="keyword">false</span>; } <a name="l00154"></a>00154 <a name="l00166"></a>00166 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Initialize (<a class="code" href="structiObjectRegistry.html" title="This interface serves as a registry of other objects.">iObjectRegistry</a>* object_reg); <a name="l00167"></a>00167 <a name="l00176"></a>00176 <a class="code" href="structiMaterialWrapper.html" title="A material wrapper is an engine-level object that wraps around an actual material...">iMaterialWrapper</a>* Initialize (<a class="code" href="structiObjectRegistry.html" title="This interface serves as a registry of other objects.">iObjectRegistry</a>* object_reg, <a class="code" href="structiEngine.html" title="This interface is the main interface to the 3D engine.">iEngine</a>* engine, <a name="l00177"></a>00177 <a class="code" href="structiTextureManager.html" title="This is the standard texture manager interface.">iTextureManager</a>* txtmgr, <span class="keyword">const</span> <span class="keywordtype">char</span>* name); <a name="l00178"></a>00178 <a name="l00182"></a>00182 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> PrepareAnim (); <a name="l00183"></a>00183 <a name="l00185"></a><a class="code" href="classcsProcTexture.html#4359f3fbbfc0536cf18c852f39ec40ed">00185</a> <span class="keywordtype">void</span> SetKeyColor (<span class="keywordtype">int</span> red, <span class="keywordtype">int</span> green, <span class="keywordtype">int</span> blue) <a name="l00186"></a>00186 { <a name="l00187"></a>00187 key_color = <span class="keyword">true</span>; <a name="l00188"></a>00188 key_red = red; <a name="l00189"></a>00189 key_green = green; <a name="l00190"></a>00190 key_blue = blue; <a name="l00191"></a>00191 tex->SetKeyColor (red, green, blue); <a name="l00192"></a>00192 } <a name="l00193"></a>00193 <a name="l00198"></a>00198 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Animate (<a class="code" href="group__util.html#g28e82998c4c2d1197a1d412bba7da793" title="A time value measured in milliseconds (1/1000 of a second).">csTicks</a> current_time) = 0; <a name="l00199"></a>00199 <a name="l00201"></a><a class="code" href="classcsProcTexture.html#19b13e1e334ff1b95680e1159c6c455a">00201</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> GetDimension (<span class="keywordtype">int</span> &w, <span class="keywordtype">int</span> &h)<span class="keyword"> const</span> <a name="l00202"></a>00202 <span class="keyword"> </span>{ w = mat_w; h = mat_h; } <a name="l00203"></a>00203 <a name="l00204"></a><a class="code" href="classcsProcTexture.html#4b6bd4b5f4de1eab173e4d4b6ed257e3">00204</a> <span class="keyword">static</span> <span class="keywordtype">int</span> GetRandom (<span class="keywordtype">int</span> max) <a name="l00205"></a>00205 { <a name="l00206"></a>00206 <span class="keywordflow">return</span> int ((<span class="keywordtype">float</span>(max)*rand()/(RAND_MAX+1.0))); <a name="l00207"></a>00207 } <a name="l00208"></a>00208 <a name="l00210"></a><a class="code" href="classcsProcTexture.html#97614265b4dc72298c226d2e64911543">00210</a> <a class="code" href="structiTextureWrapper.html" title="A texture wrapper is an engine-level object that wraps around an actual texture (iTextureHandle)...">iTextureWrapper</a>* GetTextureWrapper () <a name="l00211"></a>00211 { <span class="keywordflow">return</span> <span class="keyword">this</span>; } <a name="l00212"></a>00212 <a name="l00213"></a>00213 }; <a name="l00214"></a>00214 <a name="l00215"></a>00215 <span class="preprocessor">#endif // __CS_PROCTEX_H__</span> </pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 </small></address> </div></body> </html>