UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_geoscape.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "../ui_nodes.h"
28 #include "ui_node_abstractnode.h"
29 #include "../../cl_shared.h"
30 
31 class uiGeoscapeNode : public uiLocatedNode {
32 protected:
33  void smoothTranslate (uiNode_t* node);
34  void smoothRotate (uiNode_t* node);
35  void screenTo3DMap (const uiNode_t* node, int x, int y, vec2_t pos);
36  void screenToMap (const uiNode_t* node, int x, int y, vec2_t pos);
37  void calcAndUploadDayAndNightTexture (uiNode_t* node, float q);
38 public:
39  void draw(uiNode_t* node) override;
40  void onMouseUp(uiNode_t* node, int x, int y, int button) override;
41  void onCapturedMouseMove(uiNode_t* node, int x, int y) override;
42  void onCapturedMouseLost(uiNode_t* node) override;
43  void onLoading(uiNode_t* node) override;
44  bool onScroll(uiNode_t* node, int deltaX, int deltaY) override;
45  void onLeftClick(uiNode_t* node, int x, int y) override;
46  bool onStartDragging(uiNode_t* node, int startX, int startY, int currentX, int currentY, int button) override;
47  void zoom(uiNode_t* node, bool out);
48  void startMouseShifting(uiNode_t* node, int x, int y);
49 };
50 
51 #define UI_MAPEXTRADATA_TYPE mapExtraData_t
52 #define UI_MAPEXTRADATA(node) UI_EXTRADATA(node, UI_MAPEXTRADATA_TYPE)
53 #define UI_MAPEXTRADATACONST(node) UI_EXTRADATACONST(node, UI_MAPEXTRADATA_TYPE)
54 
55 #define DAN_WIDTH 2048
56 #define DAN_HEIGHT 1024
57 
62 #define STANDARD_3D_ZOOM 40.0f
63 
64 #define EARTH_RADIUS 8192.0f
65 #define MOON_RADIUS 1024.0f
66 #define SUN_RADIUS 1024.0f
67 
69 #define GLOBE_RADIUS EARTH_RADIUS * (UI_MAPEXTRADATACONST(node).zoom / STANDARD_3D_ZOOM)
70 
71 typedef struct mapExtraData_s {
72  /* Smoothing variables */
79  float curZoomSpeed;
86  float zoom;
89  float mapzoommin;
90  float mapzoommax;
91  float paddingRight;
98 
99 void UI_RegisterGeoscapeNode(uiBehaviour_t* behaviour);
struct mapExtraData_s mapExtraData_t
static int startX
void calcAndUploadDayAndNightTexture(uiNode_t *node, float q)
Applies alpha values to the night overlay image for 2d geoscape.
void smoothRotate(uiNode_t *node)
smooth rotation of the 3D geoscape
void smoothTranslate(uiNode_t *node)
smooth translation of the 2D geoscape
geoscapeData_t * geoscapeData
bool onScroll(uiNode_t *node, int deltaX, int deltaY) override
void startMouseShifting(uiNode_t *node, int x, int y)
byte * r_dayandnightAlpha
void onLoading(uiNode_t *node) override
Called before loading. Used to set default attribute values.
void zoom(uiNode_t *node, bool out)
void screenToMap(const uiNode_t *node, int x, int y, vec2_t pos)
Return longitude and latitude of a point of the screen for 2D geoscape.
void UI_RegisterGeoscapeNode(uiBehaviour_t *behaviour)
void onCapturedMouseMove(uiNode_t *node, int x, int y) override
static int startY
void screenTo3DMap(const uiNode_t *node, int x, int y, vec2_t pos)
Return longitude and latitude of a point of the screen for 3D geoscape (globe)
void onCapturedMouseLost(uiNode_t *node) override
Called when the node have lost the captured node We clean cached data.
void draw(uiNode_t *node) override
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
vec2_t smoothFinal2DGeoscapeCenter
void onLeftClick(uiNode_t *node, int x, int y) override
node behaviour, how a node work
Definition: ui_behaviour.h:39
void onMouseUp(uiNode_t *node, int x, int y, int button) override
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
bool onStartDragging(uiNode_t *node, int startX, int startY, int currentX, int currentY, int button) override
Send mouse event when a pressed mouse button is dragged.
uint8_t byte
Definition: ufotypes.h:34
vec3_t smoothFinalGlobeAngle