mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-12-15 06:51:19 +00:00
Merge branch 'Mateos81-InvalidMiscModelFix'
This commit is contained in:
commit
a3e015da0a
7 changed files with 31 additions and 7 deletions
|
@ -77,6 +77,7 @@ virtual ~IRender() { }
|
||||||
virtual void IncRef() = 0; // increments the reference counter for this object
|
virtual void IncRef() = 0; // increments the reference counter for this object
|
||||||
virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero
|
virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero
|
||||||
virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state
|
virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state
|
||||||
|
virtual const bool IsModelNotNull() const = 0;
|
||||||
virtual const aabb_t *GetAABB() const = 0;
|
virtual const aabb_t *GetAABB() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CEntityMiscModel : public IRender, public ISelect, public IEdit
|
||||||
|
|
||||||
// IRender
|
// IRender
|
||||||
void Draw( int state, int rflags ) const;
|
void Draw( int state, int rflags ) const;
|
||||||
|
const bool IsModelNotNull() const { return m_model && m_model->pRender; }
|
||||||
const aabb_t *GetAABB() const { return &m_BBox; }
|
const aabb_t *GetAABB() const { return &m_BBox; }
|
||||||
|
|
||||||
// ISelect
|
// ISelect
|
||||||
|
@ -105,6 +106,7 @@ class CEntityEclassModel : public IRender, public ISelect, public IEdit
|
||||||
|
|
||||||
// IRender
|
// IRender
|
||||||
void Draw( int state, int rflags ) const;
|
void Draw( int state, int rflags ) const;
|
||||||
|
const bool IsModelNotNull() const { return m_model && m_model->pRender; }
|
||||||
const aabb_t *GetAABB() const { return &m_BBox; }
|
const aabb_t *GetAABB() const { return &m_BBox; }
|
||||||
|
|
||||||
// ISelect
|
// ISelect
|
||||||
|
|
|
@ -66,6 +66,7 @@ void Reload( void );
|
||||||
void Draw( int state, vector<IShader*> shaders, int rflags ) const;
|
void Draw( int state, vector<IShader*> shaders, int rflags ) const;
|
||||||
//IRender
|
//IRender
|
||||||
virtual void Draw( int state, int rflags ) const;
|
virtual void Draw( int state, int rflags ) const;
|
||||||
|
virtual const bool IsModelNotNull() const { return true; }
|
||||||
virtual const aabb_t *GetAABB() const { return &m_BBox; }
|
virtual const aabb_t *GetAABB() const { return &m_BBox; }
|
||||||
|
|
||||||
//ISelect
|
//ISelect
|
||||||
|
|
|
@ -141,6 +141,9 @@ virtual void DecRef(){
|
||||||
virtual void Draw( int state, int rflags ) const {
|
virtual void Draw( int state, int rflags ) const {
|
||||||
m_model->Draw( state, m_shaders, rflags );
|
m_model->Draw( state, m_shaders, rflags );
|
||||||
}
|
}
|
||||||
|
virtual const bool IsModelNotNull() const {
|
||||||
|
return m_model != NULL;
|
||||||
|
}
|
||||||
virtual const aabb_t *GetAABB() const {
|
virtual const aabb_t *GetAABB() const {
|
||||||
return m_model->GetAABB();
|
return m_model->GetAABB();
|
||||||
}
|
}
|
||||||
|
@ -300,6 +303,9 @@ virtual void DecRef(){
|
||||||
virtual void Draw( int state, int rflags ) const {
|
virtual void Draw( int state, int rflags ) const {
|
||||||
m_model->Draw( state, rflags );
|
m_model->Draw( state, rflags );
|
||||||
}
|
}
|
||||||
|
virtual const bool IsModelNotNull() const {
|
||||||
|
return m_model != NULL;
|
||||||
|
}
|
||||||
virtual const aabb_t *GetAABB() const {
|
virtual const aabb_t *GetAABB() const {
|
||||||
return m_model->GetAABB();
|
return m_model->GetAABB();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ void DecRef() {
|
||||||
|
|
||||||
//IRender
|
//IRender
|
||||||
void Draw( int state, int rflags ) const;
|
void Draw( int state, int rflags ) const;
|
||||||
|
const bool IsModelNotNull() const { return true; }
|
||||||
const aabb_t *GetAABB() const { return &m_BBox; }
|
const aabb_t *GetAABB() const { return &m_BBox; }
|
||||||
|
|
||||||
//ISelect
|
//ISelect
|
||||||
|
|
|
@ -2222,7 +2222,8 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
|
||||||
if ( b->owner->eclass->fixedsize
|
if ( b->owner->eclass->fixedsize
|
||||||
&& b->owner->model.pSelect
|
&& b->owner->model.pSelect
|
||||||
&& !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) )
|
&& !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) )
|
||||||
&& g_PrefsDlg.m_nEntityShowState != ENTITY_BOX ) {
|
&& g_PrefsDlg.m_nEntityShowState != ENTITY_BOX
|
||||||
|
&& b->owner->model.pRender->IsModelNotNull() ) {
|
||||||
ray_t ray_local;
|
ray_t ray_local;
|
||||||
vec_t dist_local = FLT_MAX;
|
vec_t dist_local = FLT_MAX;
|
||||||
ray_construct_for_vec3( &ray_local, origin, dir );
|
ray_construct_for_vec3( &ray_local, origin, dir );
|
||||||
|
@ -2259,8 +2260,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
|
||||||
for ( i = 0 ; i < 3 ; i++ )
|
for ( i = 0 ; i < 3 ; i++ )
|
||||||
p1[i] = p1[i] + frac * ( p2[i] - p1[i] );
|
p1[i] = p1[i] + frac * ( p2[i] - p1[i] );
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
for ( i = 0 ; i < 3 ; i++ )
|
for ( i = 0 ; i < 3 ; i++ )
|
||||||
p2[i] = p1[i] + frac * ( p2[i] - p1[i] );
|
p2[i] = p1[i] + frac * ( p2[i] - p1[i] );
|
||||||
}
|
}
|
||||||
|
@ -2640,8 +2640,9 @@ void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ){
|
||||||
// leave it alone
|
// leave it alone
|
||||||
//
|
//
|
||||||
if ( i != w->numpoints ) {
|
if ( i != w->numpoints ) {
|
||||||
if ( i == 0 ) { // see if the first clockwise point was the
|
// see if the first clockwise point was the
|
||||||
// last point on the winding
|
// last point on the winding
|
||||||
|
if ( i == 0 ) {
|
||||||
d = DotProduct( w->points[w->numpoints - 1]
|
d = DotProduct( w->points[w->numpoints - 1]
|
||||||
, f->plane.normal ) - f->plane.dist;
|
, f->plane.normal ) - f->plane.dist;
|
||||||
if ( d > -ON_EPSILON && d < ON_EPSILON ) {
|
if ( d > -ON_EPSILON && d < ON_EPSILON ) {
|
||||||
|
|
|
@ -925,13 +925,25 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){
|
||||||
if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) {
|
if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) {
|
||||||
qglColor4fv( material );
|
qglColor4fv( material );
|
||||||
}
|
}
|
||||||
else{ qglColor4fv( identity ); }
|
else {
|
||||||
|
qglColor4fv( identity );
|
||||||
|
}
|
||||||
|
|
||||||
if ( nGLState & DRAW_GL_LIGHTING ) {
|
if ( nGLState & DRAW_GL_LIGHTING ) {
|
||||||
qglShadeModel( GL_SMOOTH );
|
qglShadeModel( GL_SMOOTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check model validity
|
||||||
|
// If the model is NULL or invalid, draw a box instead
|
||||||
|
bool isModelValid = b->owner->model.pRender->IsModelNotNull();
|
||||||
|
if ( isModelValid ) {
|
||||||
b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM );
|
b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
qglColor4fv( material );
|
||||||
|
aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE );
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DRAW_WIRE:
|
case DRAW_WIRE:
|
||||||
VectorCopy( b->owner->eclass->color, material );
|
VectorCopy( b->owner->eclass->color, material );
|
||||||
|
|
Loading…
Reference in a new issue