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++; }
36 if ( --refCount == 0 ) {
42 void Draw( int state, int rflags ) const;
43 const aabb_t *GetAABB() const { return &m_BBox; }
46 bool TestRay( const ray_t *ray, vec_t *dist ) const;
47 //bool TestBox(const aabb_t aabb) const;
50 void Translate( const vec3_t translation );
51 void Rotate( const vec3_t pivot, const vec3_t rotation );
52 const vec_t *GetTranslation() const { return m_translate; }
53 const vec_t *GetRotation() const { return m_euler; }
54 void OnKeyValueChanged( entity_t *e, const char *key, const char* value );
56 void SetName( const char *name );
58 void BuildCacheRequestString( const char *name );
59 /*! updates the AABB and transformation matrix */
60 void UpdateCachedData();
61 entity_interfaces_t *m_model;
70 /*! AABB in local space */
73 /*! worldspace-to-localspace translation */
76 /*! worldspace-to-localspace euler rotation angles */
79 /*! worldspace-to-localspace scale */
82 /*! localspace origin, effectively rotation & scale pivot point */
85 /*! worldspace-to-localspace transform, generated from translate/euler/scale/pivot */
88 /*! localspace-to-worldspace transform */
89 m4x4_t m_inverse_transform;
92 /*! simulates eclass-model entity behaviours for rendering/selection/editing */
93 class CEntityEclassModel : public IRender, public ISelect, public IEdit
96 CEntityEclassModel ();
97 virtual ~CEntityEclassModel ();
99 void IncRef() { refCount++; }
101 if ( --refCount == 0 ) {
107 void Draw( int state, int rflags ) const;
108 const aabb_t *GetAABB() const { return &m_BBox; }
111 bool TestRay( const ray_t *ray, vec_t *dist ) const;
112 //bool TestBox(const aabb_t aabb) const;
115 void Translate( const vec3_t translation );
116 void Rotate( const vec3_t pivot, const vec3_t rotation );
117 const vec_t *GetTranslation() const { return m_translate; }
118 const vec_t *GetRotation() const { return m_euler; }
119 void OnKeyValueChanged( entity_t *e, const char *key, const char* value );
121 void SetName( const char *name );
122 void SetEclass( const eclass_t* eclass );
124 /*! updates the AABB and transformation matrix */
125 void UpdateCachedData();
126 entity_interfaces_t *m_model;
131 const eclass_t *m_eclass;
133 /*! AABB in local space */
136 /*! worldspace-to-localspace translation */
139 /*! worldspace-to-localspace euler rotation angles */
142 /*! worldspace-to-localspace scale */
145 /*! localspace origin, effectively rotation & scale pivot point */
148 /*! worldspace-to-localspace transform, generated from translate/euler/scale/pivot */
151 /*! localspace-to-worldspace transform */
152 m4x4_t m_inverse_transform;
155 void pivot_draw( const vec3_t pivot );
156 void Entity_UpdateClass( entity_t *e, const char* value );
158 #endif /* _ENTITYMODEL_H_ */