LCOV - code coverage report
Current view: top level - Core - OODebugGLDrawing.h (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 20 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : /*
       2             : 
       3             : OODebugDrawing.h
       4             : 
       5             : A set of functions for drawing debug stuff like bounding boxes. These are
       6             : drawn in wireframe without Z buffer reads or writes.
       7             : 
       8             : 
       9             : Copyright (C) 2007-2013 Jens Ayton and contributors
      10             : 
      11             : Permission is hereby granted, free of charge, to any person obtaining a copy
      12             : of this software and associated documentation files (the "Software"), to deal
      13             : in the Software without restriction, including without limitation the rights
      14             : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      15             : copies of the Software, and to permit persons to whom the Software is
      16             : furnished to do so, subject to the following conditions:
      17             : 
      18             : The above copyright notice and this permission notice shall be included in all
      19             : copies or substantial portions of the Software.
      20             : 
      21             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      22             : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      24             : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      26             : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      27             : SOFTWARE.
      28             : 
      29             : */
      30             : 
      31             : #import "OOMaths.h"
      32             : #import "OOColor.h"
      33             : 
      34             : 
      35             : #if !defined(OODEBUGLDRAWING_DISABLE) && defined(NDEBUG)
      36             : #define OODEBUGLDRAWING_DISABLE 1
      37             : #endif
      38             : 
      39             : 
      40             : #ifndef OODEBUGLDRAWING_DISABLE
      41             : 
      42             : @class OOMaterial;
      43             : 
      44           0 : typedef struct
      45             : {
      46           0 :         OOMaterial                      *material;
      47             : } OODebugWFState;
      48             : 
      49             : 
      50           0 : OODebugWFState OODebugBeginWireframe(BOOL ignoreZ);
      51           0 : void OODebugEndWireframe(OODebugWFState state);
      52             : 
      53             : OOINLINE void OODebugDrawBoundingBox(BoundingBox box);
      54             : OOINLINE void OODebugDrawBoundingBoxBetween(Vector min, Vector max);
      55             : OOINLINE void OODebugDrawColoredBoundingBox(BoundingBox box, OOColor *color);
      56           0 : void OODebugDrawColoredBoundingBoxBetween(Vector min, Vector max, OOColor *color);
      57             : 
      58             : // Normals are drawn as cyan lines
      59             : OOINLINE void OODebugDrawNormal(Vector position, Vector normal, GLfloat scale);
      60             : OOINLINE void OODebugDrawNormalAtOrigin(Vector normal, GLfloat scale);
      61             : 
      62             : // Other vectors are drawn as magenta lines by default
      63             : OOINLINE void OODebugDrawVector(Vector position, Vector v);
      64             : OOINLINE void OODebugDrawColoredVector(Vector position, Vector v, OOColor *color);
      65             : OOINLINE void OODebugDrawVectorAtOrigin(Vector v);
      66             : OOINLINE void OODebugDrawColoredVectorAtOrigin(Vector v, OOColor *color);
      67             : 
      68             : // Lines are drawn white by default
      69             : OOINLINE void OODebugDrawLine(Vector start, Vector end);
      70           0 : void OODebugDrawColoredLine(Vector start, Vector end, OOColor *color);
      71             : 
      72             : // Bases are drawn as one red, one green and one blue vector, representing x, y and z axes in the current coordinate frame.
      73           0 : void OODebugDrawBasis(Vector position, GLfloat scale);
      74             : OOINLINE void OODebugDrawBasisAtOrigin(GLfloat scale);
      75             : 
      76           0 : void OODebugDrawPoint(Vector position, OOColor *color);
      77             : 
      78             : 
      79             : /*** Only inline definitions beyond this point ***/
      80             : 
      81           0 : OOINLINE void OODebugDrawBoundingBoxBetween(Vector min, Vector max)
      82             : {
      83             :         OODebugDrawColoredBoundingBoxBetween(min, max, [OOColor blueColor]);
      84             : }
      85             : 
      86             : 
      87           0 : OOINLINE void OODebugDrawBoundingBox(BoundingBox box)
      88             : {
      89             :         OODebugDrawBoundingBoxBetween(box.min, box.max);
      90             : }
      91             : 
      92             : 
      93           0 : OOINLINE void OODebugDrawColoredBoundingBox(BoundingBox box, OOColor *color)
      94             : {
      95             :         OODebugDrawColoredBoundingBoxBetween(box.min, box.max, color);
      96             : }
      97             : 
      98             : 
      99           0 : OOINLINE void OODebugDrawNormal(Vector position, Vector normal, GLfloat scale)
     100             : {
     101             :         OODebugDrawColoredVector(position, vector_add(position, vector_multiply_scalar(normal, scale)), [OOColor cyanColor]);
     102             : }
     103             : 
     104             : 
     105           0 : OOINLINE void OODebugDrawNormalAtOrigin(Vector normal, GLfloat scale)
     106             : {
     107             :         OODebugDrawNormal(kZeroVector, normal, scale);
     108             : }
     109             : 
     110             : 
     111           0 : OOINLINE void OODebugDrawColoredVector(Vector position, Vector v, OOColor *color)
     112             : {
     113             :         OODebugDrawColoredLine(position, vector_add(position, v), color);
     114             : }
     115             : 
     116             : 
     117           0 : OOINLINE void OODebugDrawVector(Vector position, Vector v)
     118             : {
     119             :         OODebugDrawColoredVector(position, v, [OOColor magentaColor]);
     120             : }
     121             : 
     122             : 
     123           0 : OOINLINE void OODebugDrawVectorAtOrigin(Vector v)
     124             : {
     125             :         OODebugDrawVector(kZeroVector, v);
     126             : }
     127             : 
     128             : 
     129           0 : OOINLINE void OODebugDrawColoredVectorAtOrigin(Vector v, OOColor *color)
     130             : {
     131             :         OODebugDrawColoredVector(kZeroVector, v, color);        
     132             : }
     133             : 
     134             : 
     135           0 : OOINLINE void OODebugDrawLine(Vector start, Vector end)
     136             : {
     137             :         OODebugDrawColoredLine(start, end, [OOColor whiteColor]);
     138             : }
     139             : 
     140             : 
     141           0 : OOINLINE void OODebugDrawBasisAtOrigin(GLfloat scale)
     142             : {
     143             :         OODebugDrawBasis(kZeroVector, scale);
     144             : }
     145             : 
     146             : #else   // OODEBUGLDRAWING_DISABLE
     147             : 
     148             : #define OODRAW_NOOP             do {} while (0)
     149             : 
     150             : #define OODebugDrawBoundingBox(box)                                             OODRAW_NOOP
     151             : #define OODebugDrawBoundingBoxBetween(min, max)                 OODRAW_NOOP
     152             : #define OODebugDrawNormal(position, normal, scale)              OODRAW_NOOP
     153             : #define OODebugDrawNormalAtOrigin(normal, scale)                OODRAW_NOOP
     154             : #define OODebugDrawVector(position, v)                                  OODRAW_NOOP
     155             : #define OODebugDrawColoredVector(position, v, color)    OODRAW_NOOP
     156             : #define OODebugDrawVectorAtOrigin(v)                                    OODRAW_NOOP
     157             : #define OODebugDrawColoredVectorAtOrigin(v, color)              OODRAW_NOOP
     158             : #define OODebugDrawBasis(position, scale)                               OODRAW_NOOP
     159             : #define OODebugDrawBasisAtOrigin(scale)                                 OODRAW_NOOP
     160             : 
     161             : #endif  // OODEBUGLDRAWING_DISABLE

Generated by: LCOV version 1.14