1 | #ifndef MXSTDPANE_INCLUDED // -*- C++ -*-
|
---|
2 | #define MXSTDPANE_INCLUDED
|
---|
3 | #if !defined(__GNUC__)
|
---|
4 | # pragma once
|
---|
5 | #endif
|
---|
6 |
|
---|
7 | /************************************************************************
|
---|
8 |
|
---|
9 | MxStdPane
|
---|
10 |
|
---|
11 | Copyright (C) 1998 Michael Garland. See "COPYING.txt" for details.
|
---|
12 |
|
---|
13 | $Id: MxStdPane.h,v 1.1 2002/09/24 16:53:54 wimmer Exp $
|
---|
14 |
|
---|
15 | ************************************************************************/
|
---|
16 |
|
---|
17 | #include "MxGLPane.h"
|
---|
18 | #include "MxStdModel.h"
|
---|
19 | #include "MxGeom3D.h"
|
---|
20 | #include "MxArcball.h"
|
---|
21 | #include "MxCamera.h"
|
---|
22 | #include "MxAsp.h"
|
---|
23 |
|
---|
24 | class MxStdPane : public MxGLPane
|
---|
25 | {
|
---|
26 | private:
|
---|
27 | GLdouble __proj_save[16];
|
---|
28 | int selection_state;
|
---|
29 |
|
---|
30 | protected:
|
---|
31 | MxStdModel *m;
|
---|
32 | MxArcball manip;
|
---|
33 | MxBounds bounds;
|
---|
34 | MxCamera camera;
|
---|
35 | float light_position[4];
|
---|
36 |
|
---|
37 | MxDynBlock<char> typein;
|
---|
38 |
|
---|
39 | uint pick_something(int x, int y, double window, int mode);
|
---|
40 |
|
---|
41 | public:
|
---|
42 | bool will_draw_surface;
|
---|
43 | bool will_draw_mesh;
|
---|
44 | bool will_draw_points;
|
---|
45 | bool will_draw_texture;
|
---|
46 | bool will_illustrate;
|
---|
47 | bool will_light_scene;
|
---|
48 | bool ntsc_output;
|
---|
49 |
|
---|
50 | MxStdPane(MxStdModel *M)
|
---|
51 | : typein(64)
|
---|
52 | {
|
---|
53 | m = M;
|
---|
54 | will_draw_surface = true;
|
---|
55 | will_draw_mesh = false;
|
---|
56 | will_draw_points = false;
|
---|
57 | will_draw_texture = (m->texcoord_binding() != MX_UNBOUND);
|
---|
58 | will_illustrate = true;
|
---|
59 | will_light_scene = true;
|
---|
60 | ntsc_output = false;
|
---|
61 | selection_state = 0;
|
---|
62 |
|
---|
63 | for(MxVertexID v=0; v<m->vert_count(); v++)
|
---|
64 | bounds.add_point(m->vertex(v));
|
---|
65 | bounds.complete();
|
---|
66 |
|
---|
67 | float aspect = 640.0f / 480.0f; // guess at aspect ratio
|
---|
68 | camera.look_at(bounds, aspect);
|
---|
69 | manip.init(bounds, aspect);
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | void write_pane_config(ostream&);
|
---|
74 | void bind_asp_vars(MxAspStore *);
|
---|
75 |
|
---|
76 | uint pick_face(int x, int y);
|
---|
77 | uint pick_vertex(int x, int y);
|
---|
78 | void move_light(float dx, float dy, float dz);
|
---|
79 |
|
---|
80 | void gl_init();
|
---|
81 | void button(int kind, int which, int x, int y);
|
---|
82 | void key(char);
|
---|
83 | void redraw();
|
---|
84 | void begin_redraw();
|
---|
85 | void end_redraw();
|
---|
86 | void illustrate();
|
---|
87 | void size(int width, int height);
|
---|
88 |
|
---|
89 | void quit();
|
---|
90 | };
|
---|
91 |
|
---|
92 | // MXSTDPANE_INCLUDED
|
---|
93 | #endif
|
---|