Skip to content

Commit

Permalink
UPBGE: Pass show boundingbox/armature flags to KX_Scene::DebugDraw.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Dec 31, 2017
1 parent 14105f3 commit b4324ae
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions source/gameengine/Ketsji/KX_Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "KX_Globals.h"
#include "KX_KetsjiEngine.h"
#include "KX_Scene.h"
#include "RAS_Rasterizer.h"

extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void KX_KetsjiEngine::RenderCamera(KX_Scene *scene, const CameraRenderData& came

RAS_DebugDraw& debugDraw = m_rasterizer->GetDebugDraw(scene);
// Draw debug infos like bouding box, armature ect.. if enabled.
scene->DrawDebug(debugDraw, objects);
scene->DrawDebug(debugDraw, objects, m_showBoundingBox, m_showArmature);
// Draw debug camera frustum.
DrawDebugCameraFrustum(scene, debugDraw, cameraFrameData);
DrawDebugShadowFrustum(scene, debugDraw);
Expand Down
5 changes: 4 additions & 1 deletion source/gameengine/Ketsji/KX_KetsjiEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include <string>
#include "KX_ISystem.h"
#include "KX_Scene.h"
#include "KX_TimeCategoryLogger.h"
#include "EXP_Python.h"
#include "KX_WorldInfo.h"
Expand All @@ -44,13 +43,17 @@
#include <vector>

struct TaskScheduler;
class KX_Scene;
class KX_Camera;
class KX_ISystem;
class BL_Converter;
class KX_NetworkMessageManager;
class RAS_ICanvas;
class RAS_OffScreen;
class RAS_Query;
class SCA_IInputDevice;
template <class T>
class EXP_ListValue;

enum class KX_ExitRequest
{
Expand Down
5 changes: 2 additions & 3 deletions source/gameengine/Ketsji/KX_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,9 @@ void KX_Scene::CalculateVisibleMeshes(std::vector<KX_GameObject *>& objects, con
m_boundingBoxManager->ClearModified();
}

void KX_Scene::DrawDebug(RAS_DebugDraw& debugDraw, const std::vector<KX_GameObject *>& objects)
void KX_Scene::DrawDebug(RAS_DebugDraw& debugDraw, const std::vector<KX_GameObject *>& objects,
KX_DebugOption showBoundingBox, KX_DebugOption showArmatures)
{
const KX_DebugOption showBoundingBox = KX_GetActiveEngine()->GetShowBoundingBox();
if (showBoundingBox != KX_DebugOption::DISABLE) {
for (KX_GameObject *gameobj : objects) {
const mt::vec3& scale = gameobj->NodeGetWorldScaling();
Expand All @@ -1181,7 +1181,6 @@ void KX_Scene::DrawDebug(RAS_DebugDraw& debugDraw, const std::vector<KX_GameObje
}
}

const KX_DebugOption showArmatures = KX_GetActiveEngine()->GetShowArmatures();
if (showArmatures != KX_DebugOption::DISABLE) {
// The side effect of a armature is that it was added in the animated object list.
for (KX_GameObject *gameobj : m_animatedlist) {
Expand Down
4 changes: 3 additions & 1 deletion source/gameengine/Ketsji/KX_Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "KX_PhysicsEngineEnums.h"
#include "KX_TextureRendererManager.h" // For KX_TextureRendererManager::RendererCategory.
#include "KX_PythonComponentManager.h"
#include "KX_KetsjiEngine.h" // For KX_DebugOption.

#include "SG_Node.h"
#include "SG_Frustum.h"
Expand Down Expand Up @@ -354,7 +355,8 @@ class KX_Scene : public EXP_Value, public SCA_IScene
void CalculateVisibleMeshes(std::vector<KX_GameObject *>& objects, const SG_Frustum& frustum, int layer);

/// \section Debug draw.
void DrawDebug(RAS_DebugDraw& debugDraw, const std::vector<KX_GameObject *>& objects);
void DrawDebug(RAS_DebugDraw& debugDraw, const std::vector<KX_GameObject *>& objects,
KX_DebugOption showBoundingBox, KX_DebugOption showArmatures);
void RenderDebugProperties(RAS_DebugDraw& debugDraw, int xindent, int ysize, int& xcoord, int& ycoord, unsigned short propsMax);

/// Replicate the logic bricks associated to this object.
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Ketsji/KX_WorldInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
#define __KX_WORLDINFO_H__

#include "mathfu.h"
#include "KX_KetsjiEngine.h"
#include "EXP_Value.h"

#ifdef USE_MATHUTILS
void KX_WorldInfo_Mathutils_Callback_Init(void);
#endif

class RAS_Rasterizer;
struct Scene;
struct World;

Expand Down
1 change: 1 addition & 0 deletions source/gameengine/Launcher/LA_Launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "GPG_Canvas.h"

#include "KX_KetsjiEngine.h"
#include "KX_Scene.h"
#include "KX_Globals.h"
#include "KX_PythonInit.h"
#include "KX_PythonMain.h"
Expand Down

0 comments on commit b4324ae

Please sign in to comment.