This repository was archived by the owner on Apr 17, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathsample.cpp
More file actions
84 lines (70 loc) · 2.71 KB
/
Copy pathsample.cpp
File metadata and controls
84 lines (70 loc) · 2.71 KB
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
// // The sample model. You should build a file
// // very similar to this for when you make your model.
// #include "modelerapp.h"
// #include "modelerdraw.h"
// #include "modelerview.h"
// #include <FL/gl.h>
// #include "modelerglobals.h"
// // To make a SampleModel, we inherit off of ModelerView
// class SampleModel : public ModelerView {
// public:
// SampleModel(int x, int y, int w, int h, char *label)
// : ModelerView(x, y, w, h, label) {}
// virtual void draw();
// };
// // We need to make a creator function, mostly because of
// // nasty API stuff that we'd rather stay away from.
// ModelerView *createSampleModel(int x, int y, int w, int h, char *label) {
// return new SampleModel(x, y, w, h, label);
// }
// // We are going to override (is that the right word?) the draw()
// // method of ModelerView to draw out SampleModel
// void SampleModel::draw() {
// // This call takes care of a lot of the nasty projection
// // matrix stuff. Unless you want to fudge directly with the
// // projection matrix, don't bother with this ...
// ModelerView::draw();
// // draw the floor
// setAmbientColor(.1f, .1f, .1f);
// setDiffuseColor(COLOR_RED);
// glPushMatrix();
// glTranslated(-5, 0, -5);
// drawBox(10, 0.01f, 10);
// glPopMatrix();
// // draw the sample model
// setAmbientColor(.1f, .1f, .1f);
// setDiffuseColor(COLOR_GREEN);
// glPushMatrix();
// glTranslated(VAL(XPOS), VAL(YPOS), VAL(ZPOS));
// glPushMatrix();
// glTranslated(-1.5, 0, -2);
// glScaled(3, 1, 4);
// drawBox(1, 1, 1);
// glPopMatrix();
// // draw cannon
// glPushMatrix();
// glRotated(VAL(ROTATE), 0.0, 1.0, 0.0);
// glRotated(-90, 1.0, 0.0, 0.0);
// drawCylinder(VAL(HEIGHT), 0.1, 0.1);
// glTranslated(0.0, 0.0, VAL(HEIGHT));
// drawCylinder(1, 1.0, 0.9);
// glTranslated(0.0, 0.0, 0.5);
// glRotated(90, 1.0, 0.0, 0.0);
// drawCylinder(4, 0.1, 0.2);
// glPopMatrix();
// glPopMatrix();
// }
// int main() {
// // Initialize the controls
// // Constructor is ModelerControl(name, minimumvalue, maximumvalue,
// // stepsize, defaultvalue)
// ModelerControl controls[NUMCONTROLS];
// controls[XPOS] = ModelerControl("X Position", -5, 5, 0.1f, 0);
// controls[YPOS] = ModelerControl("Y Position", 0, 5, 0.1f, 0);
// controls[ZPOS] = ModelerControl("Z Position", -5, 5, 0.1f, 0);
// controls[HEIGHT] = ModelerControl("Height", 1, 2.5, 0.1f, 1);
// controls[ROTATE] = ModelerControl("Rotate", -135, 135, 1, 0);
// ModelerApplication::Instance()->Init(&createSampleModel, controls,
// NUMCONTROLS);
// return ModelerApplication::Instance()->Run();
// }