-
Notifications
You must be signed in to change notification settings - Fork 6
/
MCMapOpenGLView.h
executable file
·208 lines (169 loc) · 5.87 KB
/
MCMapOpenGLView.h
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
/*
* MCMapOpenGLView.h
* MCMap Live
*
* Created by DK on 10/13/10.
*
*/
#define MINECRAFT_TILE_COUNT 256
#import <OpenGL/gl.h>
#import <OpenGL/glext.h>
#import <OpenGL/glu.h>
#import <ApplicationServices/ApplicationServices.h>
#import <list>
#import <set>
typedef struct {
GLdouble x,y,z;
} recVec;
typedef struct { int c[MINECRAFT_TILE_COUNT][5]; } MinecraftColors;
typedef struct {
recVec viewPos; // View position
GLint viewWidth, viewHeight; // current window/screen height and width
} recCamera;
@interface MCMapOpenGLView : NSOpenGLView
{
// string attributes
NSMutableDictionary * stanStringAttrib;
NSTimer* timer;
bool fAnimate;
IBOutlet NSMenuItem * animateMenuItem;
bool fInfo;
IBOutlet NSMenuItem * infoMenuItem;
// Controls
IBOutlet NSMenuItem * resetViewMenuItem;
// Info
IBOutlet NSTextField * statusTextField;
// Render Options
IBOutlet NSMenuItem * netherMenuItem;
IBOutlet NSMenuItem * endMenuItem;
IBOutlet NSMenuItem * showplayersMenuItem;
IBOutlet NSMenuItem * hideWaterMenuItem;
IBOutlet NSMenuItem * mystCraftAgesMenuItem;
// Colors
IBOutlet NSMenu * colorsMenu;
IBOutlet NSMenuItem * defaultcolorsMenuItem;
IBOutlet NSMenuItem * customcolorsMenuItem;
// Lighting Mode Menu Items
IBOutlet NSMenuItem * uniformMenuItem;
IBOutlet NSMenuItem * dayMenuItem;
IBOutlet NSMenuItem * torchlightMenuItem;
IBOutlet NSMenuItem * nightMenuItem;
IBOutlet NSMenuItem * caveMenuItem;
// Noise Menu Items
IBOutlet NSMenuItem * noise0menuItem;
IBOutlet NSMenuItem * noise5menuItem;
IBOutlet NSMenuItem * noise10menuItem;
IBOutlet NSMenuItem * noise15menuItem;
IBOutlet NSMenuItem * noise20menuItem;
// Depth Slider
IBOutlet NSSlider * depthSlider;
IBOutlet NSTextField * depthIndicator;
// Singleplayer World openers
IBOutlet NSMenu * worldsMenu;
// Orientations
IBOutlet NSMenuItem * seUpMenuItem;
IBOutlet NSMenuItem * swUpMenuItem;
IBOutlet NSMenuItem * nwUpMenuItem;
IBOutlet NSMenuItem * neUpMenuItem;
// Save menu items
IBOutlet NSMenuItem * saveChunkMenuItem;
IBOutlet NSMenuItem * saveWorldMenuItem;
IBOutlet NSView * imageFormat;
IBOutlet NSPopUpButton * imageFormatPopup;
// Biome Menu
IBOutlet NSMenuItem * showBiomesMenuItem;
IBOutlet NSMenuItem * deleteBiomeDataMenuItem;
// Tools
IBOutlet NSPanel * blockFinderPanel;
IBOutlet NSPopUpButton* blockFinderPopButton;
IBOutlet NSMenu * blockFinderPopup;
bool show_players;
CFAbsoluteTime time;
// camera handling
recCamera camera;
}
+ (NSOpenGLPixelFormat*) basicPixelFormat;
// File Menu
- (IBAction) openWorldFolder: (id) sender;
- (IBAction) openWorld: (id) sender;
- (IBAction) saveWorld: (id) sender;
- (IBAction) saveChunk: (id) sender;
- (IBAction) changeSaveFormat: (id) sender;
- (void) rescanWorldsMenu;
// Options Menu
-(IBAction) setDimensionToNether: (id) sender;
-(IBAction) setDimensionToEnd: (id) sender;
-(void) resetLightingModeMenu;
-(IBAction) setLightingMode: (id) sender;
-(void) resetNoiseLevelMenu;
-(IBAction) setNoiseLevel: (id) sender;
-(void) resetOrientationMenu;
-(IBAction) setOrientation: (id) sender;
-(IBAction) setColors: (id) sender;
-(IBAction) showPlayerLocations: (id) sender;
-(IBAction) toggleHideWater: (id) sender;
-(IBAction) resetView: (id) sender;
-(IBAction) flushCache: (id) sender;
// Biomes Menu
-(IBAction) setUseBiomes: (id) sender;
-(IBAction) generateBiomes: (id) sender;
-(IBAction) deleteBiomes: (id) sender;
-(void) toggleUseBiomes:(BOOL)forceon;
-(void) startGenerateBiomes:(BOOL)forceon;
-(void) finishGenerateBiomes;
// Tools Menu
- (IBAction) createColorsTxt: (id) sender;
- (IBAction) saveSliceSequence:(id)sender;
// User Interface Controls
- (IBAction) setHeight: (id) sender;
// OpenGL view functions
- (void) updateProjection;
- (void) updateModelView;
- (void) resizeGL;
- (void) prepareOpenGL;
- (void) drawRect:(NSRect)rect;
// Keeping the map updated
- (void)chunkDidRender:(NSNotification *)aNotification;
- (void)animationTimer:(NSTimer *)timer;
// User input even handling
- (void) magnifyWithEvent:(NSEvent *)theEvent;
- (void) swipeWithEvent:(NSEvent *)anEvent;
- (void) beginGestureWithEvent:(NSEvent *)event;
- (void) endGestureWithEvent:(NSEvent *)event;
- (void) keyDown:(NSEvent *)theEvent;
- (void) mouseDown:(NSEvent *)theEvent;
- (void) mouseUp:(NSEvent *)theEvent;
- (void) mouseDragged:(NSEvent *)theEvent;
- (void) scrollWheel:(NSEvent *)theEvent;
// Mapping functions
- (void) drawChunk:(GLuint)texture X:(int)bx Y:(int)by;
- (BOOL) blockIsVisibleX:(int)bx Y:(int)by;
- (void) resetForNewWorld:(BOOL)setView;
- (void) scanAndInitWorld:(NSString*)world_path newBounds:(BOOL)newBounds;
- (void) changeCoords:(int*)coords fromOrientation:(int)fromOr toOrientation:(int)toOr;
- (void) reorientCamera:(int)new_orientation;
- (void) setupMapChunk;
- (void) invalidateAllChunks;
- (void) checkProcessingTask;
// Utility functions
- (BOOL) createColorArrayFromTextFile:(NSString*)textpath colorArray:(MinecraftColors*)colors;
- (BOOL) createColorArrayFromPng:(NSString*)loadpath colorArray:(MinecraftColors*)colors;
- (void) writeColorsFromArray:(MinecraftColors*)colors savePath:(NSString*)savepath;
- (void) startBlockFinder:(NSArray*)blocksToShow inColor:(NSColor*)color xray:(double)xray;
- (void) storeColor;
- (void) restoreColor;
// User Preferences
- (void) loadRenderDefaults;
- (void) setRenderDefaults;
- (void) resetRenderDefaults;
- (void) rescanColorsMenu;
- (void) setMaxSimultaneousRenders:(int)count;
- (int) getMaxSimultaneousRenders;
- (void) saveChunkRange:(NSString*)savepath minx:(int)minx maxx:(int)maxx miny:(int)miny maxy:(int)maxy;
// Cocoa implementation details
- (BOOL) acceptsFirstResponder;
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
- (id) initWithFrame: (NSRect) frameRect;
- (void) awakeFromNib;
@end