iutil/visualdebug.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

iutil/visualdebug.h
Go to the documentation of this file.

    00001 /*
    00002   Copyright (C) 2010 Christian Van Brussel, Institute of Information
    00003       and Communication Technologies, Electronics and Applied Mathematics
    00004       at Universite catholique de Louvain, Belgium
    00005       http://www.uclouvain.be/en-icteam.html
    00006
    00007   This library is free software; you can redistribute it and/or
    00008   modify it under the terms of the GNU Library General Public
    00009   License as published by the Free Software Foundation; either
    00010   version 2 of the License, or (at your option) any later version.
    00011
    00012   This library is distributed in the hope that it will be useful,
    00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015   Library General Public License for more details.
    00016
    00017   You should have received a copy of the GNU Library General Public
    00018   License along with this library; if not, write to the Free
    00019   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00020 */
    00021 #ifndef __VISUALDEBUG_H__
    00022 #define __VISUALDEBUG_H__
    00023
    00024 #include "iutil/plugin.h"
    00025 #include "csutil/cscolor.h"
    00026
    00027 class csReversibleTransform;
    00028 class csVector3;
    00029 struct iObjectRegistry;
    00030 struct iView;
    00031
    00036 namespace CS {
    00037 namespace Debug {
    00038
    00042 struct iVisualDebugger : public virtual iBase
    00043 {
    00044   SCF_INTERFACE(iVisualDebugger, 1, 0, 0);
    00045
    00055   virtual void DebugTransform (const csReversibleTransform& transform,
    00056                                bool persist = false,
    00057                                float size = 0.1f) = 0;
    00058
    00070   virtual void DebugPosition (const csVector3& position,
    00071                               bool persist = false,
    00072                               csColor color = csColor (0.0f, 1.0f, 0.0f),
    00073                               size_t size = 3) = 0;
    00074
    00084   virtual void DebugVector (const csReversibleTransform& transform,
    00085                             const csVector3& vector,
    00086                             bool persist = false,
    00087                             csColor color = csColor (0.0f, 1.0f, 0.0f)) = 0;
    00088
    00094   virtual void Display (iView* view) = 0;
    00095 };
    00096
    00101 class VisualDebuggerHelper
    00102 {
    00103  public:
    00107   static void DebugTransform (iObjectRegistry* object_reg,
    00108                               const csReversibleTransform& transform,
    00109                               bool persist = false,
    00110                               float size = 0.1f)
    00111   {
    00112     csRef<iVisualDebugger> debugger = csQueryRegistryOrLoad<iVisualDebugger>
    00113       (object_reg, "crystalspace.utilities.visualdebugger");
    00114     debugger->DebugTransform (transform, persist, size);
    00115   }
    00116
    00120   static void DebugPosition (iObjectRegistry* object_reg,
    00121                              const csVector3& position,
    00122                              bool persist = false,
    00123                              csColor color = csColor (0.0f, 1.0f, 0.0f),
    00124                              size_t size = 3)
    00125   {
    00126     csRef<iVisualDebugger> debugger = csQueryRegistryOrLoad<iVisualDebugger>
    00127       (object_reg, "crystalspace.utilities.visualdebugger");
    00128     debugger->DebugPosition (position, persist, color, size);
    00129   }
    00130
    00134   static void DebugVector (iObjectRegistry* object_reg,
    00135                            const csReversibleTransform& transform,
    00136                            const csVector3& vector,
    00137                            bool persist = false,
    00138                            csColor color = csColor (0.0f, 1.0f, 0.0f))
    00139   {
    00140     csRef<iVisualDebugger> debugger = csQueryRegistryOrLoad<iVisualDebugger>
    00141       (object_reg, "crystalspace.utilities.visualdebugger");
    00142     debugger->DebugVector (transform, vector, persist, color);
    00143   }
    00144
    00148   static void Display (iObjectRegistry* object_reg, iView* view)
    00149   {
    00150     csRef<iVisualDebugger> debugger = csQueryRegistryOrLoad<iVisualDebugger>
    00151       (object_reg, "crystalspace.utilities.visualdebugger");
    00152     debugger->Display (view);
    00153   }
    00154 };
    00155
    00156 } // namespace CS
    00157 } // namespace Debug
    00158
    00159 #endif // __VISUALDEBUG_H__