This file is indexed.

/usr/share/doc/libgtkglextmm-x11-1.2-doc/shapes_8h-example.html is in libgtkglextmm-x11-1.2-doc 1.2.0-8.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gtkglextmm: shapes.h</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="examples.html">Examples</a></div>
<h1>shapes.h</h1>Geometric object rendering example.<p>
<div class="fragment"><pre class="fragment"><span class="comment">// -*- C++ -*-</span>
<span class="comment">/*</span>
<span class="comment"> * shapes.h:</span>
<span class="comment"> * shapes demo.</span>
<span class="comment"> *</span>
<span class="comment"> * written by Naofumi Yasufuku  &lt;naofumi@users.sourceforge.net&gt;</span>
<span class="comment"> */</span>

<span class="preprocessor">#ifndef _SHAPES_H</span>
<span class="preprocessor"></span><span class="preprocessor">#define _SHAPES_H</span>
<span class="preprocessor"></span>
<span class="preprocessor">#include &lt;gtkmm.h&gt;</span>

<span class="preprocessor">#include &lt;<a class="code" href="gtkglmm_8h.html">gtkglmm.h</a>&gt;</span>


<span class="comment">//</span>
<span class="comment">// Shapes classes.</span>
<span class="comment">//</span>
<span class="comment"></span>
<span class="keyword">namespace </span>Shapes
{

  <span class="keyword">class </span>Scene;

  <span class="comment">//</span>
  <span class="comment">// View class.</span>
  <span class="comment">//</span>

  <span class="keyword">class </span>View : <span class="keyword">public</span> sigc::trackable
  {
    <span class="keyword">friend</span> <span class="keyword">class </span>Scene;

  <span class="keyword">public</span>:
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> NEAR_CLIP;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> FAR_CLIP;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_POS_X;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_POS_Y;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_POS_Z;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_AXIS_X;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_AXIS_Y;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_AXIS_Z;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_ANGLE;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> INIT_SCALE;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> SCALE_MAX;
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> SCALE_MIN;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> ANIMATE_THRESHOLD;

  <span class="keyword">public</span>:
    View();
    <span class="keyword">virtual</span> ~View();

  <span class="keyword">public</span>:
    <span class="keywordtype">void</span> frustum(<span class="keywordtype">int</span> w, <span class="keywordtype">int</span> h);

    <span class="keywordtype">void</span> xform();

    <span class="keywordtype">void</span> reset();

    <span class="keywordtype">void</span> set_pos(<span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y, <span class="keywordtype">float</span> z)
    { m_Pos[0] = x; m_Pos[1] = y; m_Pos[2] = z; }

    <span class="keywordtype">void</span> set_quat(<span class="keywordtype">float</span> q0, <span class="keywordtype">float</span> q1, <span class="keywordtype">float</span> q2, <span class="keywordtype">float</span> q3)
    { m_Quat[0] = q0; m_Quat[1] = q1; m_Quat[2] = q2; m_Quat[3] = q3; }

    <span class="keywordtype">void</span> set_scale(<span class="keywordtype">float</span> scale)
    { m_Scale = scale; }

    <span class="keywordtype">void</span> enable_animation();

    <span class="keywordtype">void</span> disable_animation();

    <span class="keywordtype">bool</span> is_animate()<span class="keyword"> const</span>
<span class="keyword">    </span>{ <span class="keywordflow">return</span> m_Animate; }

  <span class="keyword">protected</span>:
    <span class="comment">// Signal handlers:</span>
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_button_press_event(GdkEventButton* event, Scene* scene);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_button_release_event(GdkEventButton* event, Scene* scene);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_motion_notify_event(GdkEventMotion* event, Scene* scene);

  <span class="keyword">private</span>:
    <span class="keywordtype">float</span> m_Pos[3];
    <span class="keywordtype">float</span> m_Quat[4];
    <span class="keywordtype">float</span> m_Scale;

    <span class="keywordtype">float</span> m_QuatDiff[4];
    <span class="keywordtype">float</span> m_BeginX;
    <span class="keywordtype">float</span> m_BeginY;
    <span class="keywordtype">float</span> m_DX;
    <span class="keywordtype">float</span> m_DY;

    <span class="keywordtype">bool</span> m_Animate;

  };


  <span class="comment">//</span>
  <span class="comment">// Model class.</span>
  <span class="comment">//</span>

  <span class="keyword">class </span>Model
  {
    <span class="keyword">friend</span> <span class="keyword">class </span>Scene;

  <span class="keyword">public</span>:
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> NUM_SHAPES;

    <span class="keyword">enum</span> ShapeType
      {
        CUBE,
        SPHERE,
        CONE,
        TORUS,
        TETRAHEDRON,
        OCTAHEDRON,
        DODECAHEDRON,
        ICOSAHEDRON,
        TEAPOT,
      };

    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_CUBE;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_SPHERE;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_CONE;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_TORUS;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_TETRAHEDRON;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_OCTAHEDRON;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_DODECAHEDRON;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_ICOSAHEDRON;
    <span class="keyword">static</span> <span class="keyword">const</span> ShapeType SHAPE_TEAPOT;

  <span class="keyword">public</span>:
    
    <span class="keyword">struct </span>MaterialProp
    {
      GLfloat ambient[4];
      GLfloat diffuse[4];
      GLfloat specular[4];
      GLfloat shininess;
    };

    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_EMERALD;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_JADE;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_OBSIDIAN;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_PEARL;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_RUBY;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_TURQUOISE;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_BRASS;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_BRONZE;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_CHROME;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_COPPER;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_GOLD;
    <span class="keyword">static</span> <span class="keyword">const</span> MaterialProp MAT_SILVER;

  <span class="keyword">public</span>:
    Model();
    <span class="keyword">virtual</span> ~Model();

  <span class="keyword">private</span>:
    <span class="keywordtype">void</span> init_gl(Glib::RefPtr&lt;Gdk::GL::Drawable&gt;&amp; gldrawable);

  <span class="keyword">public</span>:
    <span class="keywordtype">void</span> draw(Glib::RefPtr&lt;Gdk::GL::Drawable&gt;&amp; gldrawable);

    <span class="keywordtype">void</span> set_shape(ShapeType shape)
    { m_CurrentShape = shape; }

    <span class="keywordtype">void</span> set_material(<span class="keyword">const</span> MaterialProp* material)
    { m_CurrentMat = material; }

  <span class="keyword">private</span>:
    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_ListBase;
    ShapeType m_CurrentShape;
    <span class="keyword">const</span> MaterialProp* m_CurrentMat;

  };


  <span class="comment">//</span>
  <span class="comment">// Scene class.</span>
  <span class="comment">//</span>

  <span class="keyword">class </span>Scene : <span class="keyword">public</span> Gtk::GL::DrawingArea
  {
    <span class="keyword">friend</span> <span class="keyword">class </span>View;
    <span class="keyword">friend</span> <span class="keyword">class </span>Model;

  <span class="keyword">public</span>:
    <span class="comment">// OpenGL scene related constants:</span>
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> CLEAR_COLOR[4];
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> CLEAR_DEPTH;

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> LIGHT0_POSITION[4];
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> LIGHT0_AMBIENT[4];
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> LIGHT0_DIFFUSE[4];

    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> LIGHT_MODEL_AMBIENT[4];
    <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">float</span> LIGHT_MODEL_LOCAL_VIEWER[1];

  <span class="keyword">public</span>:
    <span class="keyword">explicit</span> Scene();
    <span class="keyword">virtual</span> ~Scene();

  <span class="keyword">protected</span>:
    <span class="comment">// signal handlers:</span>
    <span class="keyword">virtual</span> <span class="keywordtype">void</span> on_realize();
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_configure_event(GdkEventConfigure* event);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_expose_event(GdkEventExpose* event);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_button_press_event(GdkEventButton* event);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_unmap_event(GdkEventAny* event);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_visibility_notify_event(GdkEventVisibility* event);
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_idle();

  <span class="keyword">public</span>:
    <span class="comment">// Invalidate whole window.</span>
    <span class="keywordtype">void</span> invalidate() {
      get_window()-&gt;invalidate_rect(get_allocation(), <span class="keyword">false</span>);
    }

    <span class="comment">// Update window synchronously (fast).</span>
    <span class="keywordtype">void</span> update()
    { get_window()-&gt;process_updates(<span class="keyword">false</span>); }

  <span class="keyword">protected</span>:
    <span class="comment">// idle signal connection:</span>
    sigc::connection m_ConnectionIdle;

    <span class="keywordtype">void</span> idle_add();
    <span class="keywordtype">void</span> idle_remove();

  <span class="keyword">protected</span>:
    <span class="keywordtype">void</span> change_shape(Model::ShapeType shape);
    <span class="keywordtype">void</span> change_material(<span class="keyword">const</span> Model::MaterialProp* material);

  <span class="keyword">protected</span>:
    Gtk::Menu* create_popup_menu();

  <span class="keyword">protected</span>:
    <span class="comment">// Popup menu:</span>
    Gtk::Menu* m_Menu;

  <span class="keyword">protected</span>:
    <span class="comment">// OpenGL scene related objects:</span>
    View m_View;
    Model m_Model;

  };


  <span class="comment">//</span>
  <span class="comment">// Application class.</span>
  <span class="comment">//</span>

  <span class="keyword">class </span>Application : <span class="keyword">public</span> Gtk::Window
  {
  <span class="keyword">public</span>:
    <span class="keyword">static</span> <span class="keyword">const</span> Glib::ustring APP_NAME;

  <span class="keyword">public</span>:
    Application();
    <span class="keyword">virtual</span> ~Application();

  <span class="keyword">protected</span>:
    <span class="comment">// signal handlers:</span>
    <span class="keyword">virtual</span> <span class="keywordtype">void</span> on_button_quit_clicked();
    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> on_key_press_event(GdkEventKey* event);

  <span class="keyword">protected</span>:
    <span class="comment">// member widgets:</span>
    Gtk::VBox m_VBox;
    Scene m_Scene;
    Gtk::Button m_ButtonQuit;
  };


} <span class="comment">// namespace Shapes</span>


<span class="preprocessor">#endif // _SHAPES_H</span>
</pre></div> <hr size="1"><address style="align: right;"><small>Generated on Mon Feb 27 18:46:52 2006 for gtkglextmm by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
</body>
</html>