]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/imodel.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / include / imodel.h
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 #ifndef _IMODEL_H_\r
23 #define _IMODEL_H_\r
24 \r
25 #define MODEL_MAJOR "model"\r
26 \r
27 /*!\r
28 loads model from model file name specified,\r
29 fills model struct with pointers to model interfaces\r
30 \r
31 name is a relative path, we'll use VFS to extract a basepath to add to get the absolute path.\r
32 */\r
33 typedef void (* PFN_LOADMODEL) (entity_interfaces_t *model, const char *name);\r
34 \r
35 struct _QERPlugModelTable\r
36 {\r
37   int           m_nSize;\r
38   PFN_LOADMODEL       m_pfnLoadModel;\r
39 };\r
40 \r
41 \r
42 //forward declare entity_t\r
43 struct entity_s;\r
44 typedef struct entity_s entity_t;\r
45 \r
46 // any module relying on imodel will need to link against the mathlib\r
47 #include "mathlib.h"\r
48 \r
49 // state flags\r
50 #define DRAW_GL_FILL          0x0001\r
51 #define DRAW_GL_LIGHTING      0x0010\r
52 #define DRAW_GL_TEXTURE_2D    0x0100\r
53 #define DRAW_GL_BLEND         0x1000\r
54 \r
55 // predefined state combinations\r
56 #define DRAW_GL_WIRE                                    0x0000\r
57 #define DRAW_GL_FLAT                                    0x0001\r
58 #define DRAW_GL_SOLID                                   0x0011\r
59 #define DRAW_GL_TEXTURED                        0x0111\r
60 \r
61 // mode\r
62 #define DRAW_WIRE                                                       0\r
63 #define DRAW_SOLID                                              1\r
64 #define DRAW_TEXTURED                                   2\r
65 \r
66 // render flags\r
67 #define DRAW_RF_NONE          0x0000\r
68 #define DRAW_RF_SEL_OUTLINE   0x0001\r
69 #define DRAW_RF_SEL_FILL      0x0010\r
70 #define DRAW_RF_XY            0x0011\r
71 #define DRAW_RF_CAM           0x0100\r
72 \r
73 class IRender\r
74 {\r
75 public:\r
76   virtual ~IRender() { }\r
77   virtual void IncRef() = 0; // increments the reference counter for this object\r
78   virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero\r
79   virtual void Draw(int state, int rflags) const = 0; // render the object - state = the opengl state\r
80   virtual const aabb_t *GetAABB() const = 0;\r
81 };\r
82 \r
83 class ISelect\r
84 {\r
85 public:\r
86   virtual ~ISelect() { }\r
87         virtual void IncRef() = 0; // increments the reference counter for this object\r
88         virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero\r
89   virtual bool TestRay(const ray_t *ray, vec_t *dist) const = 0; // test ray intersection, return bool true if intersects, and store distance to closest point of intersection\r
90   //virtual bool TestBox(const aabb_t *aabb) const = 0; // test aabb intersection, return bool true if touching or intersecting\r
91 };\r
92 \r
93 class IEdit\r
94 {\r
95 public:\r
96   virtual ~IEdit() { }\r
97         virtual void IncRef() = 0; // increments the reference counter for this object\r
98         virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero\r
99   virtual void Translate(const vec3_t translation) = 0;\r
100   virtual void Rotate(const vec3_t pivot, const vec3_t rotation) = 0;\r
101   virtual const vec_t *GetTranslation() const = 0;\r
102   virtual const vec_t *GetRotation() const = 0;\r
103   virtual void OnKeyValueChanged(entity_t *e, const char *key, const char* value) = 0;\r
104 };\r
105 \r
106 #endif /* _IMODEL_H_ */\r