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