BGE: Fix for [#34781] "bge.texture.ImageRender does not show Font object" reported by Monster.
This fix is mostly based off of HG1's patch from the bug report, which had ImageRender::Render() call KX_KetsjiEngine::RenderFonts(). However, I have moved RenderFonts() from KX_KetsjiEngine to KX_Scene where all of the other font and rendering functions are. The real fix for this mess would be to not have ImageRender::Render() have so much duplicate code from KX_KetsjiEngine::Render(), but that's a code cleanup problem for another day.
This commit is contained in:
@@ -54,7 +54,6 @@
|
|||||||
#include "MT_Transform.h"
|
#include "MT_Transform.h"
|
||||||
#include "SCA_IInputDevice.h"
|
#include "SCA_IInputDevice.h"
|
||||||
#include "KX_Camera.h"
|
#include "KX_Camera.h"
|
||||||
#include "KX_FontObject.h"
|
|
||||||
#include "KX_Dome.h"
|
#include "KX_Dome.h"
|
||||||
#include "KX_Light.h"
|
#include "KX_Light.h"
|
||||||
#include "KX_PythonInit.h"
|
#include "KX_PythonInit.h"
|
||||||
@@ -340,7 +339,7 @@ void KX_KetsjiEngine::RenderDome()
|
|||||||
// do the rendering
|
// do the rendering
|
||||||
m_dome->RenderDomeFrame(scene,cam, i);
|
m_dome->RenderDomeFrame(scene,cam, i);
|
||||||
//render all the font objects for this scene
|
//render all the font objects for this scene
|
||||||
RenderFonts(scene);
|
scene->RenderFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
list<class KX_Camera*>* cameras = scene->GetCameras();
|
list<class KX_Camera*>* cameras = scene->GetCameras();
|
||||||
@@ -358,7 +357,7 @@ void KX_KetsjiEngine::RenderDome()
|
|||||||
// do the rendering
|
// do the rendering
|
||||||
m_dome->RenderDomeFrame(scene, (*it),i);
|
m_dome->RenderDomeFrame(scene, (*it),i);
|
||||||
//render all the font objects for this scene
|
//render all the font objects for this scene
|
||||||
RenderFonts(scene);
|
scene->RenderFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
it++;
|
it++;
|
||||||
@@ -1339,23 +1338,12 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
|
|||||||
scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
|
scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
|
||||||
|
|
||||||
//render all the font objects for this scene
|
//render all the font objects for this scene
|
||||||
RenderFonts(scene);
|
scene->RenderFonts();
|
||||||
|
|
||||||
if (scene->GetPhysicsEnvironment())
|
if (scene->GetPhysicsEnvironment())
|
||||||
scene->GetPhysicsEnvironment()->debugDrawWorld();
|
scene->GetPhysicsEnvironment()->debugDrawWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KX_KetsjiEngine::RenderFonts(KX_Scene* scene)
|
|
||||||
{
|
|
||||||
list<class KX_FontObject*>* fonts = scene->GetFonts();
|
|
||||||
|
|
||||||
list<KX_FontObject*>::iterator it = fonts->begin();
|
|
||||||
while (it != fonts->end()) {
|
|
||||||
(*it)->DrawText();
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To run once per scene
|
* To run once per scene
|
||||||
*/
|
*/
|
||||||
|
@@ -205,7 +205,6 @@ private:
|
|||||||
void RenderDebugProperties();
|
void RenderDebugProperties();
|
||||||
void RenderShadowBuffers(KX_Scene *scene);
|
void RenderShadowBuffers(KX_Scene *scene);
|
||||||
void SetBackGround(KX_WorldInfo* worldinfo);
|
void SetBackGround(KX_WorldInfo* worldinfo);
|
||||||
void RenderFonts(KX_Scene* scene);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KX_KetsjiEngine(class KX_ISystem* system);
|
KX_KetsjiEngine(class KX_ISystem* system);
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "MT_assert.h"
|
#include "MT_assert.h"
|
||||||
#include "KX_KetsjiEngine.h"
|
#include "KX_KetsjiEngine.h"
|
||||||
#include "KX_BlenderMaterial.h"
|
#include "KX_BlenderMaterial.h"
|
||||||
|
#include "KX_FontObject.h"
|
||||||
#include "RAS_IPolygonMaterial.h"
|
#include "RAS_IPolygonMaterial.h"
|
||||||
#include "ListValue.h"
|
#include "ListValue.h"
|
||||||
#include "SCA_LogicManager.h"
|
#include "SCA_LogicManager.h"
|
||||||
@@ -352,11 +353,6 @@ list<class KX_Camera*>* KX_Scene::GetCameras()
|
|||||||
return &m_cameras;
|
return &m_cameras;
|
||||||
}
|
}
|
||||||
|
|
||||||
list<class KX_FontObject*>* KX_Scene::GetFonts()
|
|
||||||
{
|
|
||||||
return &m_fonts;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings)
|
void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings)
|
||||||
{
|
{
|
||||||
m_frame_settings = frame_settings;
|
m_frame_settings = frame_settings;
|
||||||
@@ -1639,6 +1635,15 @@ void KX_Scene::RenderBuckets(const MT_Transform & cameratransform,
|
|||||||
KX_BlenderMaterial::EndFrame();
|
KX_BlenderMaterial::EndFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KX_Scene::RenderFonts()
|
||||||
|
{
|
||||||
|
list<KX_FontObject*>::iterator it = m_fonts.begin();
|
||||||
|
while (it != m_fonts.end()) {
|
||||||
|
(*it)->DrawText();
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KX_Scene::UpdateObjectActivity(void)
|
void KX_Scene::UpdateObjectActivity(void)
|
||||||
{
|
{
|
||||||
if (m_activity_culling) {
|
if (m_activity_culling) {
|
||||||
|
@@ -381,10 +381,6 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
/** Font Routines */
|
/** Font Routines */
|
||||||
|
|
||||||
std::list<class KX_FontObject*>*
|
|
||||||
GetFonts(
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Find a font in the scene by pointer. */
|
/** Find a font in the scene by pointer. */
|
||||||
KX_FontObject*
|
KX_FontObject*
|
||||||
@@ -398,6 +394,10 @@ public:
|
|||||||
KX_FontObject*
|
KX_FontObject*
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** Render the fonts in this scene. */
|
||||||
|
void
|
||||||
|
RenderFonts(
|
||||||
|
);
|
||||||
|
|
||||||
/** Camera Routines */
|
/** Camera Routines */
|
||||||
|
|
||||||
|
@@ -275,6 +275,8 @@ void ImageRender::Render()
|
|||||||
|
|
||||||
m_scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
|
m_scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
|
||||||
|
|
||||||
|
m_scene->RenderFonts();
|
||||||
|
|
||||||
// restore the canvas area now that the render is completed
|
// restore the canvas area now that the render is completed
|
||||||
m_canvas->GetWindowArea() = area;
|
m_canvas->GetWindowArea() = area;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user