• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionc974a42f23b7092a370d1c594eb1e782da9f61c8 (tree)
Time2010-04-24 23:47:06
AuthorSteve Streeting <steve@stev...>
CommiterSteve Streeting

Log Message

Fix bug 240: TextAreaOverlayElement incorrectly loads Font in background thread (OGRE_THREAD_SUPPORT == 2)

Change Summary

Incremental Difference

diff -r be6cf446fba9 -r c974a42f23b7 OgreMain/include/OgreTextAreaOverlayElement.h
--- a/OgreMain/include/OgreTextAreaOverlayElement.h Sat Apr 24 14:59:34 2010 +0100
+++ b/OgreMain/include/OgreTextAreaOverlayElement.h Sat Apr 24 15:47:06 2010 +0100
@@ -70,6 +70,8 @@
7070 /** See OverlayElement. */
7171 virtual const String& getTypeName(void) const;
7272 /** See Renderable. */
73+ const MaterialPtr& getMaterial(void) const;
74+ /** See Renderable. */
7375 void getRenderOperation(RenderOperation& op);
7476 /** Overridden from OverlayElement */
7577 void setMaterialName(const String& matName);
diff -r be6cf446fba9 -r c974a42f23b7 OgreMain/src/OgreTextAreaOverlayElement.cpp
--- a/OgreMain/src/OgreTextAreaOverlayElement.cpp Sat Apr 24 14:59:34 2010 +0100
+++ b/OgreMain/src/OgreTextAreaOverlayElement.cpp Sat Apr 24 15:47:06 2010 +0100
@@ -359,10 +359,6 @@
359359 if (mpFont.isNull())
360360 OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Could not find font " + font,
361361 "TextAreaOverlayElement::setFontName" );
362- mpFont->load();
363- mpMaterial = mpFont->getMaterial();
364- mpMaterial->setDepthCheckEnabled(false);
365- mpMaterial->setLightingEnabled(false);
366362
367363 mGeomPositionsOutOfDate = true;
368364 mGeomUVsOutOfDate = true;
@@ -432,8 +428,23 @@
432428 return msTypeName;
433429 }
434430 //---------------------------------------------------------------------
431+ const MaterialPtr& TextAreaOverlayElement::getMaterial(void) const
432+ {
433+ // On-demand load
434+ // Moved from setFontName to avoid issues with background parsing of scripts
435+ if (mpMaterial.isNull() && !mpFont.isNull())
436+ {
437+ mpFont->load();
438+ // Ugly hack, but we need to override for lazy-load
439+ *const_cast<MaterialPtr*>(&mpMaterial) = mpFont->getMaterial();
440+ mpMaterial->setDepthCheckEnabled(false);
441+ mpMaterial->setLightingEnabled(false);
442+ }
443+ return mpMaterial;
444+ }
445+ //---------------------------------------------------------------------
435446 void TextAreaOverlayElement::getRenderOperation(RenderOperation& op)
436- {
447+ {
437448 op = mRenderOp;
438449 }
439450 //---------------------------------------------------------------------