2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\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
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
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
22 #ifndef _ENTITYMODEL_H_
\r
23 #define _ENTITYMODEL_H_
\r
27 /*! simulates misc_model entity behaviours for rendering/selection/editing */
\r
28 class CEntityMiscModel : public IRender, public ISelect, public IEdit
\r
31 CEntityMiscModel (entity_t *e);
\r
32 virtual ~CEntityMiscModel ();
\r
34 void IncRef() { refCount++; }
\r
35 void DecRef() { if(--refCount == 0) delete this; }
\r
38 void Draw(int state, int rflags) const;
\r
39 const aabb_t *GetAABB() const { return &m_BBox; }
\r
42 bool TestRay(const ray_t *ray, vec_t *dist) const;
\r
43 //bool TestBox(const aabb_t aabb) const;
\r
46 void Translate(const vec3_t translation);
\r
47 void Rotate(const vec3_t pivot, const vec3_t rotation);
\r
48 const vec_t *GetTranslation() const { return m_translate; }
\r
49 const vec_t *GetRotation() const { return m_euler; }
\r
50 void OnKeyValueChanged(entity_t *e, const char *key, const char* value);
\r
52 void SetName(const char *name);
\r
54 void BuildCacheRequestString(const char *name);
\r
55 /*! updates the AABB and transformation matrix */
\r
56 void UpdateCachedData();
\r
57 entity_interfaces_t *m_model;
\r
66 /*! AABB in local space */
\r
69 /*! worldspace-to-localspace translation */
\r
72 /*! worldspace-to-localspace euler rotation angles */
\r
75 /*! worldspace-to-localspace scale */
\r
78 /*! localspace origin, effectively rotation & scale pivot point */
\r
81 /*! worldspace-to-localspace transform, generated from translate/euler/scale/pivot */
\r
84 /*! localspace-to-worldspace transform */
\r
85 m4x4_t m_inverse_transform;
\r
88 /*! simulates eclass-model entity behaviours for rendering/selection/editing */
\r
89 class CEntityEclassModel : public IRender, public ISelect, public IEdit
\r
92 CEntityEclassModel ();
\r
93 virtual ~CEntityEclassModel ();
\r
95 void IncRef() { refCount++; }
\r
96 void DecRef() { if(--refCount == 0) delete this; }
\r
99 void Draw(int state, int rflags) const;
\r
100 const aabb_t *GetAABB() const { return &m_BBox; }
\r
103 bool TestRay(const ray_t *ray, vec_t *dist) const;
\r
104 //bool TestBox(const aabb_t aabb) const;
\r
107 void Translate(const vec3_t translation);
\r
108 void Rotate(const vec3_t pivot, const vec3_t rotation);
\r
109 const vec_t *GetTranslation() const { return m_translate; }
\r
110 const vec_t *GetRotation() const { return m_euler; }
\r
111 void OnKeyValueChanged(entity_t *e, const char *key, const char* value);
\r
113 void SetName(const char *name);
\r
114 void SetEclass(const eclass_t* eclass);
\r
116 /*! updates the AABB and transformation matrix */
\r
117 void UpdateCachedData();
\r
118 entity_interfaces_t *m_model;
\r
122 string_t m_version;
\r
123 const eclass_t *m_eclass;
\r
125 /*! AABB in local space */
\r
128 /*! worldspace-to-localspace translation */
\r
129 vec3_t m_translate;
\r
131 /*! worldspace-to-localspace euler rotation angles */
\r
134 /*! worldspace-to-localspace scale */
\r
137 /*! localspace origin, effectively rotation & scale pivot point */
\r
140 /*! worldspace-to-localspace transform, generated from translate/euler/scale/pivot */
\r
141 m4x4_t m_transform;
\r
143 /*! localspace-to-worldspace transform */
\r
144 m4x4_t m_inverse_transform;
\r
147 void pivot_draw(const vec3_t pivot);
\r
148 void Entity_UpdateClass(entity_t *e, const char* value);
\r
150 #endif /* _ENTITYMODEL_H_ */
\r