[657] | 1 | <html> |
---|
| 2 | <head> |
---|
| 3 | <title>OgreMaterial.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 4 | <link type="text/css" rel="stylesheet" href="style.css"> |
---|
| 5 | </head> |
---|
| 6 | |
---|
| 7 | <body> |
---|
| 8 | <!-- Generated by Doxygen 1.3.6 --> |
---|
| 9 | <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
---|
| 10 | <h1>OgreMaterial.h</h1><a href="OgreMaterial_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> |
---|
| 11 | 00002 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
| 12 | 00003 <span class="comment">This source file is part of OGRE</span> |
---|
| 13 | 00004 <span class="comment">(Object-oriented Graphics Rendering Engine)</span> |
---|
| 14 | 00005 <span class="comment">For the latest info, see http://www.ogre3d.org/</span> |
---|
| 15 | 00006 <span class="comment"></span> |
---|
| 16 | 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> |
---|
| 17 | 00008 <span class="comment">Also see acknowledgements in Readme.html</span> |
---|
| 18 | 00009 <span class="comment"></span> |
---|
| 19 | 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> |
---|
| 20 | 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> |
---|
| 21 | 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> |
---|
| 22 | 00013 <span class="comment">version.</span> |
---|
| 23 | 00014 <span class="comment"></span> |
---|
| 24 | 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> |
---|
| 25 | 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> |
---|
| 26 | 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> |
---|
| 27 | 00018 <span class="comment"></span> |
---|
| 28 | 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> |
---|
| 29 | 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> |
---|
| 30 | 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> |
---|
| 31 | 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> |
---|
| 32 | 00023 <span class="comment">-----------------------------------------------------------------------------</span> |
---|
| 33 | 00024 <span class="comment">*/</span> |
---|
| 34 | 00025 <span class="preprocessor">#ifndef _Material_H__</span> |
---|
| 35 | 00026 <span class="preprocessor"></span><span class="preprocessor">#define _Material_H__</span> |
---|
| 36 | 00027 <span class="preprocessor"></span> |
---|
| 37 | 00028 <span class="preprocessor">#include "<a class="code" href="OgrePrerequisites_8h.html">OgrePrerequisites.h</a>"</span> |
---|
| 38 | 00029 |
---|
| 39 | 00030 <span class="preprocessor">#include "<a class="code" href="OgreResource_8h.html">OgreResource.h</a>"</span> |
---|
| 40 | 00031 <span class="preprocessor">#include "<a class="code" href="OgreIteratorWrappers_8h.html">OgreIteratorWrappers.h</a>"</span> |
---|
| 41 | 00032 <span class="preprocessor">#include "<a class="code" href="OgreCommon_8h.html">OgreCommon.h</a>"</span> |
---|
| 42 | 00033 <span class="preprocessor">#include "<a class="code" href="OgreColourValue_8h.html">OgreColourValue.h</a>"</span> |
---|
| 43 | 00034 <span class="preprocessor">#include "<a class="code" href="OgreBlendMode_8h.html">OgreBlendMode.h</a>"</span> |
---|
| 44 | 00035 |
---|
| 45 | 00036 |
---|
| 46 | 00037 <span class="keyword">namespace </span>Ogre { |
---|
| 47 | 00038 |
---|
| 48 | 00039 <span class="comment">// Forward declaration</span> |
---|
| 49 | 00040 <span class="keyword">class </span>MaterialPtr; |
---|
| 50 | 00041 |
---|
| 51 | <a name="l00079"></a><a class="code" href="classOgre_1_1Material.html">00079</a> <span class="keyword">class </span><a class="code" href="OgrePlatform_8h.html#a16">_OgreExport</a> Material : <span class="keyword">public</span> <a class="code" href="classOgre_1_1Resource.html">Resource</a> |
---|
| 52 | 00080 { |
---|
| 53 | <a name="l00081"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialn0">00081</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOgre_1_1SceneManager.html">SceneManager</a>; |
---|
| 54 | <a name="l00082"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialn1">00082</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOgre_1_1MaterialManager.html">MaterialManager</a>; |
---|
| 55 | 00083 |
---|
| 56 | 00084 <span class="keyword">public</span>: |
---|
| 57 | <a name="l00086"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialw0">00086</a> <span class="keyword">typedef</span> std::vector<Real> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialw0">LodDistanceList</a>; |
---|
| 58 | <a name="l00087"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialw1">00087</a> <span class="keyword">typedef</span> <a class="code" href="classOgre_1_1ConstVectorIterator.html">ConstVectorIterator<LodDistanceList></a> <a class="code" href="classOgre_1_1ConstVectorIterator.html">LodDistanceIterator</a>; |
---|
| 59 | 00088 <span class="keyword">protected</span>: |
---|
| 60 | 00089 |
---|
| 61 | 00090 |
---|
| 62 | 00093 <span class="keywordtype">void</span> applyDefaults(<span class="keywordtype">void</span>); |
---|
| 63 | 00094 |
---|
| 64 | <a name="l00095"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx0">00095</a> <span class="keyword">typedef</span> std::vector<Technique*> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx0">Techniques</a>; |
---|
| 65 | <a name="l00096"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp0">00096</a> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx0">Techniques</a> mTechniques; |
---|
| 66 | <a name="l00097"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp1">00097</a> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx0">Techniques</a> mSupportedTechniques; |
---|
| 67 | <a name="l00098"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx1">00098</a> <span class="keyword">typedef</span> std::map<unsigned short, Technique*> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx1">BestTechniqueList</a>; |
---|
| 68 | <a name="l00099"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp2">00099</a> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialx1">BestTechniqueList</a> mBestTechniqueList; |
---|
| 69 | 00100 |
---|
| 70 | <a name="l00101"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp3">00101</a> <a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialw0">LodDistanceList</a> mLodDistances; |
---|
| 71 | <a name="l00102"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp4">00102</a> <span class="keywordtype">bool</span> mReceiveShadows; |
---|
| 72 | <a name="l00103"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp5">00103</a> <span class="keywordtype">bool</span> mTransparencyCastsShadows; |
---|
| 73 | <a name="l00105"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialp6">00105</a> <span class="keywordtype">bool</span> mCompilationRequired; |
---|
| 74 | 00106 |
---|
| 75 | 00112 <span class="keywordtype">void</span> fixupBestTechniqueList(<span class="keywordtype">void</span>); |
---|
| 76 | 00113 |
---|
| 77 | 00116 <span class="keywordtype">void</span> loadImpl(<span class="keywordtype">void</span>); |
---|
| 78 | 00117 |
---|
| 79 | 00122 <span class="keywordtype">void</span> unloadImpl(<span class="keywordtype">void</span>); |
---|
| 80 | <a name="l00124"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialb4">00124</a> size_t calculateSize(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 0; } <span class="comment">// TODO </span> |
---|
| 81 | 00125 <span class="keyword">public</span>: |
---|
| 82 | 00126 |
---|
| 83 | 00129 Material(<a class="code" href="classOgre_1_1ResourceManager.html">ResourceManager</a>* creator, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& name, <a class="code" href="namespaceOgre.html#a485">ResourceHandle</a> handle, |
---|
| 84 | 00130 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& group, <span class="keywordtype">bool</span> isManual = <span class="keyword">false</span>, <a class="code" href="classOgre_1_1ManualResourceLoader.html">ManualResourceLoader</a>* loader = 0); |
---|
| 85 | 00131 |
---|
| 86 | 00132 ~Material(); |
---|
| 87 | 00135 Material& operator=( <span class="keyword">const</span> Material& rhs ); |
---|
| 88 | 00136 |
---|
| 89 | 00140 <span class="keywordtype">bool</span> isTransparent(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
| 90 | 00141 |
---|
| 91 | <a name="l00155"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala4">00155</a> <span class="keywordtype">void</span> setReceiveShadows(<span class="keywordtype">bool</span> enabled) { mReceiveShadows = enabled; } |
---|
| 92 | <a name="l00157"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala5">00157</a> <span class="keywordtype">bool</span> getReceiveShadows(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mReceiveShadows; } |
---|
| 93 | 00158 |
---|
| 94 | <a name="l00167"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala6">00167</a> <span class="keywordtype">void</span> setTransparencyCastsShadows(<span class="keywordtype">bool</span> enabled) { mTransparencyCastsShadows = enabled; } |
---|
| 95 | <a name="l00169"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala7">00169</a> <span class="keywordtype">bool</span> getTransparencyCastsShadows(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mTransparencyCastsShadows; } |
---|
| 96 | 00170 |
---|
| 97 | 00185 <a class="code" href="classOgre_1_1Technique.html">Technique</a>* createTechnique(<span class="keywordtype">void</span>); |
---|
| 98 | 00187 <a class="code" href="classOgre_1_1Technique.html">Technique</a>* getTechnique(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> index); |
---|
| 99 | 00189 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> getNumTechniques(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
| 100 | 00191 <span class="keywordtype">void</span> removeTechnique(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> index); |
---|
| 101 | 00193 <span class="keywordtype">void</span> removeAllTechniques(<span class="keywordtype">void</span>); |
---|
| 102 | <a name="l00194"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materialw2">00194</a> <span class="keyword">typedef</span> <a class="code" href="classOgre_1_1VectorIterator.html">VectorIterator<Techniques></a> <a class="code" href="classOgre_1_1VectorIterator.html">TechniqueIterator</a>; |
---|
| 103 | 00196 <a class="code" href="classOgre_1_1VectorIterator.html">TechniqueIterator</a> getTechniqueIterator(<span class="keywordtype">void</span>); |
---|
| 104 | 00203 <a class="code" href="classOgre_1_1VectorIterator.html">TechniqueIterator</a> getSupportedTechniqueIterator(<span class="keywordtype">void</span>); |
---|
| 105 | 00204 |
---|
| 106 | 00206 <a class="code" href="classOgre_1_1Technique.html">Technique</a>* getSupportedTechnique(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> index); |
---|
| 107 | 00208 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> getNumSupportedTechniques(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
| 108 | 00209 |
---|
| 109 | <a name="l00215"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala17">00215</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> getNumLodLevels(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ |
---|
| 110 | 00216 <span class="keywordflow">return</span> static_cast<unsigned short>(mBestTechniqueList.size()); } |
---|
| 111 | 00217 |
---|
| 112 | 00229 <a class="code" href="classOgre_1_1Technique.html">Technique</a>* getBestTechnique(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> lodIndex = 0); |
---|
| 113 | 00230 |
---|
| 114 | 00231 |
---|
| 115 | 00237 <a class="code" href="classOgre_1_1MaterialPtr.html">MaterialPtr</a> clone(<span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& newName, <span class="keywordtype">bool</span> changeGroup = <span class="keyword">false</span>, |
---|
| 116 | 00238 <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a426">String</a>& newGroup = StringUtil::BLANK) <span class="keyword">const</span>; |
---|
| 117 | 00239 |
---|
| 118 | 00244 <span class="keywordtype">void</span> copyDetailsTo(<a class="code" href="classOgre_1_1MaterialPtr.html">MaterialPtr</a>& mat) <span class="keyword">const</span>; |
---|
| 119 | 00245 |
---|
| 120 | 00261 <span class="keywordtype">void</span> compile(<span class="keywordtype">bool</span> autoManageTextureUnits = <span class="keyword">true</span>); |
---|
| 121 | 00262 |
---|
| 122 | 00263 <span class="comment">// -------------------------------------------------------------------------------</span> |
---|
| 123 | 00264 <span class="comment">// The following methods are to make migration from previous versions simpler</span> |
---|
| 124 | 00265 <span class="comment">// and to make code easier to write when dealing with simple materials</span> |
---|
| 125 | 00266 <span class="comment">// They set the properties which have been moved to Pass for all Techniques and all Passes</span> |
---|
| 126 | 00267 |
---|
| 127 | 00277 <span class="keywordtype">void</span> setAmbient(<a class="code" href="namespaceOgre.html#a420">Real</a> red, <a class="code" href="namespaceOgre.html#a420">Real</a> green, <a class="code" href="namespaceOgre.html#a420">Real</a> blue); |
---|
| 128 | 00278 |
---|
| 129 | 00288 <span class="keywordtype">void</span> setAmbient(<span class="keyword">const</span> <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a>& ambient); |
---|
| 130 | 00289 |
---|
| 131 | 00299 <span class="keywordtype">void</span> setDiffuse(<a class="code" href="namespaceOgre.html#a420">Real</a> red, <a class="code" href="namespaceOgre.html#a420">Real</a> green, <a class="code" href="namespaceOgre.html#a420">Real</a> blue, <a class="code" href="namespaceOgre.html#a420">Real</a> alpha); |
---|
| 132 | 00300 |
---|
| 133 | 00310 <span class="keywordtype">void</span> setDiffuse(<span class="keyword">const</span> <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a>& diffuse); |
---|
| 134 | 00311 |
---|
| 135 | 00321 <span class="keywordtype">void</span> setSpecular(<a class="code" href="namespaceOgre.html#a420">Real</a> red, <a class="code" href="namespaceOgre.html#a420">Real</a> green, <a class="code" href="namespaceOgre.html#a420">Real</a> blue, <a class="code" href="namespaceOgre.html#a420">Real</a> alpha); |
---|
| 136 | 00322 |
---|
| 137 | 00332 <span class="keywordtype">void</span> setSpecular(<span class="keyword">const</span> <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a>& specular); |
---|
| 138 | 00333 |
---|
| 139 | 00343 <span class="keywordtype">void</span> setShininess(<a class="code" href="namespaceOgre.html#a420">Real</a> val); |
---|
| 140 | 00344 |
---|
| 141 | 00354 <span class="keywordtype">void</span> setSelfIllumination(<a class="code" href="namespaceOgre.html#a420">Real</a> red, <a class="code" href="namespaceOgre.html#a420">Real</a> green, <a class="code" href="namespaceOgre.html#a420">Real</a> blue); |
---|
| 142 | 00355 |
---|
| 143 | 00365 <span class="keywordtype">void</span> setSelfIllumination(<span class="keyword">const</span> <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a>& selfIllum); |
---|
| 144 | 00366 |
---|
| 145 | 00376 <span class="keywordtype">void</span> setDepthCheckEnabled(<span class="keywordtype">bool</span> enabled); |
---|
| 146 | 00377 |
---|
| 147 | 00387 <span class="keywordtype">void</span> setDepthWriteEnabled(<span class="keywordtype">bool</span> enabled); |
---|
| 148 | 00388 |
---|
| 149 | 00398 <span class="keywordtype">void</span> setDepthFunction( CompareFunction func ); |
---|
| 150 | 00399 |
---|
| 151 | 00409 <span class="keywordtype">void</span> setColourWriteEnabled(<span class="keywordtype">bool</span> enabled); |
---|
| 152 | 00410 |
---|
| 153 | 00420 <span class="keywordtype">void</span> setCullingMode( CullingMode mode ); |
---|
| 154 | 00421 |
---|
| 155 | 00431 <span class="keywordtype">void</span> setManualCullingMode( ManualCullingMode mode ); |
---|
| 156 | 00432 |
---|
| 157 | 00442 <span class="keywordtype">void</span> setLightingEnabled(<span class="keywordtype">bool</span> enabled); |
---|
| 158 | 00443 |
---|
| 159 | 00453 <span class="keywordtype">void</span> setShadingMode( ShadeOptions mode ); |
---|
| 160 | 00454 |
---|
| 161 | 00464 <span class="keywordtype">void</span> setFog( |
---|
| 162 | 00465 <span class="keywordtype">bool</span> overrideScene, |
---|
| 163 | 00466 FogMode mode = FOG_NONE, |
---|
| 164 | 00467 <span class="keyword">const</span> <a class="code" href="classOgre_1_1ColourValue.html">ColourValue</a>& colour = ColourValue::White, |
---|
| 165 | 00468 <a class="code" href="namespaceOgre.html#a420">Real</a> expDensity = 0.001, <a class="code" href="namespaceOgre.html#a420">Real</a> linearStart = 0.0, <a class="code" href="namespaceOgre.html#a420">Real</a> linearEnd = 1.0 ); |
---|
| 166 | 00469 |
---|
| 167 | 00479 <span class="keywordtype">void</span> setDepthBias(<a class="code" href="namespaceOgre.html#a422">ushort</a> bias); |
---|
| 168 | 00480 |
---|
| 169 | 00489 <span class="keywordtype">void</span> setTextureFiltering(TextureFilterOptions filterType); |
---|
| 170 | 00498 <span class="keywordtype">void</span> setTextureAnisotropy(<span class="keywordtype">int</span> maxAniso); |
---|
| 171 | 00499 |
---|
| 172 | 00509 <span class="keywordtype">void</span> setSceneBlending( <span class="keyword">const</span> SceneBlendType sbt ); |
---|
| 173 | 00510 |
---|
| 174 | 00520 <span class="keywordtype">void</span> setSceneBlending( <span class="keyword">const</span> SceneBlendFactor sourceFactor, <span class="keyword">const</span> SceneBlendFactor destFactor); |
---|
| 175 | 00521 |
---|
| 176 | 00522 |
---|
| 177 | 00524 <span class="keywordtype">void</span> _notifyNeedsRecompile(<span class="keywordtype">void</span>); |
---|
| 178 | 00525 |
---|
| 179 | 00538 <span class="keywordtype">void</span> setLodLevels(<span class="keyword">const</span> LodDistanceList& lodDistances); |
---|
| 180 | 00546 LodDistanceIterator getLodDistanceIterator(<span class="keywordtype">void</span>) <span class="keyword">const</span>; |
---|
| 181 | 00547 |
---|
| 182 | 00549 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> getLodIndex(<a class="code" href="namespaceOgre.html#a420">Real</a> d) <span class="keyword">const</span>; |
---|
| 183 | 00551 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> getLodIndexSquaredDepth(<a class="code" href="namespaceOgre.html#a420">Real</a> squaredDepth) <span class="keyword">const</span>; |
---|
| 184 | 00552 |
---|
| 185 | <a name="l00555"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala50">00555</a> <span class="keywordtype">void</span> touch(<span class="keywordtype">void</span>) |
---|
| 186 | 00556 { |
---|
| 187 | 00557 <span class="keywordflow">if</span> (mCompilationRequired) |
---|
| 188 | 00558 compile(); |
---|
| 189 | 00559 <span class="comment">// call superclass</span> |
---|
| 190 | 00560 Resource::touch(); |
---|
| 191 | 00561 } |
---|
| 192 | 00562 |
---|
| 193 | <a name="l00566"></a><a class="code" href="classOgre_1_1Material.html#Ogre_1_1Materiala51">00566</a> <span class="keywordtype">bool</span> getCompilationRequired()<span class="keyword"> const</span> |
---|
| 194 | 00567 <span class="keyword"> </span>{ |
---|
| 195 | 00568 <span class="keywordflow">return</span> mCompilationRequired; |
---|
| 196 | 00569 } |
---|
| 197 | 00570 |
---|
| 198 | 00571 |
---|
| 199 | 00572 }; |
---|
| 200 | 00573 |
---|
| 201 | <a name="l00580"></a><a class="code" href="classOgre_1_1MaterialPtr.html">00580</a> <span class="keyword">class </span><a class="code" href="class__OgreExport.html">_OgreExport</a> MaterialPtr : <span class="keyword">public</span> <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><Material> |
---|
| 202 | 00581 { |
---|
| 203 | 00582 <span class="keyword">public</span>: |
---|
| 204 | <a name="l00583"></a><a class="code" href="classOgre_1_1MaterialPtr.html#Ogre_1_1MaterialPtra0">00583</a> MaterialPtr() : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><Material>() {} |
---|
| 205 | <a name="l00584"></a><a class="code" href="classOgre_1_1MaterialPtr.html#Ogre_1_1MaterialPtra1">00584</a> <span class="keyword">explicit</span> MaterialPtr(Material* rep) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><Material>(rep) {} |
---|
| 206 | <a name="l00585"></a><a class="code" href="classOgre_1_1MaterialPtr.html#Ogre_1_1MaterialPtra2">00585</a> MaterialPtr(<span class="keyword">const</span> MaterialPtr& r) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><Material>(r) {} |
---|
| 207 | <a name="l00586"></a><a class="code" href="classOgre_1_1MaterialPtr.html#Ogre_1_1MaterialPtra3">00586</a> MaterialPtr(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& r) : <a class="code" href="classOgre_1_1SharedPtr.html">SharedPtr</a><Material>() |
---|
| 208 | 00587 { |
---|
| 209 | 00588 <span class="comment">// lock & copy other mutex pointer</span> |
---|
| 210 | 00589 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) |
---|
| 211 | 00590 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) |
---|
| 212 | 00591 pRep = static_cast<Material*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); |
---|
| 213 | 00592 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); |
---|
| 214 | 00593 <span class="keywordflow">if</span> (pUseCount) |
---|
| 215 | 00594 { |
---|
| 216 | 00595 ++(*pUseCount); |
---|
| 217 | 00596 } |
---|
| 218 | 00597 } |
---|
| 219 | 00598 |
---|
| 220 | <a name="l00600"></a><a class="code" href="classOgre_1_1MaterialPtr.html#Ogre_1_1MaterialPtra4">00600</a> MaterialPtr& operator=(<span class="keyword">const</span> <a class="code" href="classOgre_1_1SharedPtr.html">ResourcePtr</a>& r) |
---|
| 221 | 00601 { |
---|
| 222 | 00602 <span class="keywordflow">if</span> (pRep == static_cast<Material*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>())) |
---|
| 223 | 00603 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 224 | 00604 release(); |
---|
| 225 | 00605 <span class="comment">// lock & copy other mutex pointer</span> |
---|
| 226 | 00606 <a class="code" href="OgrePrerequisites_8h.html#a14">OGRE_LOCK_MUTEX</a>(*r.OGRE_AUTO_MUTEX_NAME) |
---|
| 227 | 00607 <a class="code" href="OgrePrerequisites_8h.html#a19">OGRE_COPY_AUTO_SHARED_MUTEX</a>(r.OGRE_AUTO_MUTEX_NAME) |
---|
| 228 | 00608 pRep = static_cast<Material*>(r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra12">getPointer</a>()); |
---|
| 229 | 00609 pUseCount = r.<a class="code" href="classOgre_1_1SharedPtr.html#Ogre_1_1SharedPtra11">useCountPointer</a>(); |
---|
| 230 | 00610 <span class="keywordflow">if</span> (pUseCount) |
---|
| 231 | 00611 { |
---|
| 232 | 00612 ++(*pUseCount); |
---|
| 233 | 00613 } |
---|
| 234 | 00614 <span class="keywordflow">return</span> *<span class="keyword">this</span>; |
---|
| 235 | 00615 } |
---|
| 236 | 00616 }; |
---|
| 237 | 00617 |
---|
| 238 | 00618 } <span class="comment">//namespace </span> |
---|
| 239 | 00619 |
---|
| 240 | 00620 <span class="preprocessor">#endif</span> |
---|
| 241 | </pre></div><hr> |
---|
| 242 | <p> |
---|
| 243 | Copyright © 2000-2005 by The OGRE Team<br /> |
---|
| 244 | <!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.png"/></a><br/> |
---|
| 245 | This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-ShareAlike 2.5 License</a>.<br/> |
---|
| 246 | <!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
| 247 | <Work rdf:about=""> |
---|
| 248 | <license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/" /> |
---|
| 249 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" /> |
---|
| 250 | </Work> |
---|
| 251 | <License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License></rdf:RDF> --> |
---|
| 252 | |
---|
| 253 | Last modified Sun Feb 12 12:59:47 2006 |
---|
| 254 | </p> |
---|
| 255 | </body> |
---|
| 256 | </html> |
---|