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