Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GLDebugRenderer.h « rendering « intern « freestyle « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: abf76d079daaa3dd660f333df3d374665aa972bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//
//  Filename         : GLDebugRenderer.h
//  Author(s)        : Stephane Grabli
//  Purpose          : Class to render the debug informations related to
//                     a scene
//  Date of creation : 03/04/2002
//
///////////////////////////////////////////////////////////////////////////////


//
//  Copyright (C) : Please refer to the COPYRIGHT file distributed 
//   with this source distribution. 
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef  GLDEBUGRENDERER_H
# define GLDEBUGRENDERER_H

# include <float.h>
# include "../system/FreestyleConfig.h"
# include "GLRenderer.h"
# include "../view_map/Silhouette.h"
# include "../winged_edge/Curvature.h"

class WSMeshShape;
class WSExactShape;

class LIB_RENDERING_EXPORT GLDebugRenderer : public GLRenderer
{
public:

  inline GLDebugRenderer() : GLRenderer() {
    _bboxSize = 2.0;
    SetMaxValue(&_minEdgeSize);
    _SelectedFEdge = 0;
  }

  inline ~GLDebugRenderer() {}

  VISIT_DECL(NodeShape)

  VISIT_DECL(IndexedFaceSet)
  VISIT_DECL(LineRep)
  VISIT_DECL(OrientedLineRep)
  VISIT_DECL(VertexRep)

  /*! Renders a bitmap string in world coordinates 
   *  x, y, z
   *    The world coordinates of the sentence's starting point
   *  font
   *    The font used to display the text. 
   *    Must be one of :
   *    - GLUT_STROKE_ROMAN 
   *    - GLUT_STROKE_MONO_ROMAN 
   *  string
   *    The text to display
   *  size
   *    The relative size of the text to display
   */
  void renderBitmapString(real x, 
			  real y, 
			  real z, 
			  void *font, 
			  char *string,
			  float size = 1.f)  ; 

  /*! Reinitialize the Renderer so as the previous 
   *  text size does not affect the current one.
   *  iBBoxSize
   *    The size of the scene bounding box.
   */
  inline void ReInit(real iBBoxSize) {_bboxSize = iBBoxSize; SetMaxValue(&_minEdgeSize);}

  inline void SetSelectedFEdge(FEdge *iFEdge) {_SelectedFEdge = iFEdge;}
  inline FEdge * selectedFEdge() {return _SelectedFEdge;}

protected:

  /*! Renders a face made of a triangles strip
   *    iVertices
   *      Array of float containing the face vertices. 3 floats per 
   *      x, y, z vertex coordinates
   *    iNormals 
   *      Array of float containing the face normals. 3 floats per 
   *      x, y, z vertex normal coordinates
   *    iVIndices
   *      Array of the indices (to use with the iVertices array) 
   *      describing the vertices parsing order
   *    iNIndices
   *      Array of normals indices (to use with iNormals array)
   *      describing the normals parsing order
   *    iNVertices
   *      The number of vertices in the face
   */
  virtual void RenderTriangleStrip(const real *iVertices, 
                                   const real *iNormals,
                                   const Material *const* iMaterials, 
                                   const unsigned* iVIndices, 
                                   const unsigned* iNIndices,
                                   const unsigned* iMIndices,
                                   const unsigned iNVertices);

  /*! Renders a face made of a triangles fan
   *    iVertices
   *      Array of float containing the face vertices. 3 floats per 
   *      x, y, z vertex coordinates
   *    iNormals 
   *      Array of float containing the face normals. 3 floats per 
   *      x, y, z vertex normal coordinates
   *    iVIndices
   *      Array of the indices (to use with the iVertices array) 
   *      describing the vertices parsing order
   *    iNIndices
   *      Array of normals indices (to use with iNormals array)
   *      describing the normals parsing order
   *    iNVertices
   *      The number of vertices in the face
   */
  virtual void RenderTriangleFan(const real *iVertices, 
                                   const real *iNormals,
                                   const Material *const*iMaterials, 
                                   const unsigned* iVIndices, 
                                   const unsigned* iNIndices,
                                   const unsigned* iMIndices,
                                   const unsigned iNVertices);

  /*! Renders a face made of single triangles
   *    iVertices
   *      Array of float containing the face vertices. 3 floats per 
   *      x, y, z vertex coordinates
   *    iNormals 
   *      Array of float containing the face normals. 3 floats per 
   *      x, y, z vertex normal coordinates
   *    iVIndices
   *      Array of the indices (to use with the iVertices array) 
   *      describing the vertices parsing order
   *    iNIndices
   *      Array of normals indices (to use with iNormals array)
   *      describing the normals parsing order
   *    iNVertices
   *      The number of vertices in the face
   */
  virtual void RenderTriangles(const real *iVertices, 
                                   const real *iNormals,
                                   const Material *const* iMaterials, 
                                   const unsigned* iVIndices, 
                                   const unsigned* iNIndices,
                                   const unsigned* iMIndices,
                                   const unsigned iNVertices);

  /*! glTranslatef or glTranslated */
  inline void glTranslater(float x, float y, float z) {glTranslatef(x,y,z);}
  inline void glTranslater(real x, real y, real z) {glTranslated(x,y,z);}


private:

  inline void SetMaxValue(float *oValue) {*oValue = FLT_MAX;}
  inline void SetMaxValue(real *oValue) {*oValue = DBL_MAX;}

  mutable real _bboxSize; 
  mutable real _minEdgeSize;

  FEdge *_SelectedFEdge;
};

#endif // GLDEBUGRENDERER_H