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
24 #include "entity_entitymodel.h"
26 void Entity_UpdateClass( entity_t *e, const char* value ){
27 if ( strcmp( value, "misc_model" ) == 0
28 || ( strcmp( value, "misc_gamemodel" ) == 0 )
29 || ( strcmp( value, "model_static" ) == 0 ) ) {
30 if ( e->model.pRender ) {
31 e->model.pRender->DecRef();
33 if ( e->model.pSelect ) {
34 e->model.pSelect->DecRef();
36 if ( e->model.pEdit ) {
37 e->model.pEdit->DecRef();
39 e->model.pRender = NULL;
40 e->model.pSelect = NULL;
41 e->model.pEdit = NULL;
43 CEntityMiscModel *model = new CEntityMiscModel( e );
45 e->model.pRender = (IRender*)model;
46 e->model.pRender->IncRef();
47 e->model.pSelect = (ISelect*)model;
48 e->model.pSelect->IncRef();
49 e->model.pEdit = (IEdit*)model;
50 e->model.pEdit->IncRef();
54 else if ( e->eclass && e->eclass->modelpath ) {
55 if ( e->model.pRender ) {
56 e->model.pRender->DecRef();
58 if ( e->model.pSelect ) {
59 e->model.pSelect->DecRef();
61 if ( e->model.pEdit ) {
62 e->model.pEdit->DecRef();
64 e->model.pRender = NULL;
65 e->model.pSelect = NULL;
66 e->model.pEdit = NULL;
68 CEntityEclassModel *model = new CEntityEclassModel;
70 model->SetEclass( e->eclass );
71 model->SetName( e->eclass->modelpath );
73 e->model.pRender = (IRender*)model;
74 e->model.pRender->IncRef();
75 e->model.pSelect = (ISelect*)model;
76 e->model.pSelect->IncRef();
77 e->model.pEdit = (IEdit*)model;
78 e->model.pEdit->IncRef();
84 void pivot_draw( const vec3_t pivot ){
85 vec3_t vCenter, vMin, vMax;
86 VectorCopy( pivot, vCenter );
88 g_QglTable.m_pfn_qglPointSize( 4 );
90 g_QglTable.m_pfn_qglBegin( GL_POINTS );
91 g_QglTable.m_pfn_qglVertex3fv( vCenter );
92 g_QglTable.m_pfn_qglEnd();
94 g_QglTable.m_pfn_qglBegin( GL_LINES );
96 g_QglTable.m_pfn_qglVertex3fv( vCenter );
98 g_QglTable.m_pfn_qglVertex3fv( vCenter );
101 g_QglTable.m_pfn_qglVertex3fv( vCenter );
103 g_QglTable.m_pfn_qglVertex3fv( vCenter );
106 g_QglTable.m_pfn_qglVertex3fv( vCenter );
108 g_QglTable.m_pfn_qglVertex3fv( vCenter );
110 g_QglTable.m_pfn_qglEnd();
112 VectorCopy( vCenter, vMin );
113 VectorCopy( vCenter, vMax );
121 g_QglTable.m_pfn_qglBegin( GL_LINE_LOOP );
122 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMin[1],vMin[2] );
123 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMin[1],vMin[2] );
124 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMax[1],vMin[2] );
125 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMax[1],vMin[2] );
126 g_QglTable.m_pfn_qglEnd();
128 g_QglTable.m_pfn_qglBegin( GL_LINE_LOOP );
129 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMin[1],vMax[2] );
130 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMin[1],vMax[2] );
131 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMax[1],vMax[2] );
132 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMax[1],vMax[2] );
133 g_QglTable.m_pfn_qglEnd();
135 g_QglTable.m_pfn_qglBegin( GL_LINES );
136 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMin[1],vMin[2] );
137 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMin[1],vMax[2] );
138 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMax[1],vMax[2] );
139 g_QglTable.m_pfn_qglVertex3f( vMin[0],vMax[1],vMin[2] );
140 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMin[1],vMin[2] );
141 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMin[1],vMax[2] );
142 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMax[1],vMax[2] );
143 g_QglTable.m_pfn_qglVertex3f( vMax[0],vMax[1],vMin[2] );
144 g_QglTable.m_pfn_qglEnd();