3D: fix bounding box assert and include order

This commit is contained in:
Mário Luzeiro 2016-04-06 21:48:51 -04:00 committed by Chris Pavlina
parent c2a60d14d7
commit ffc7740cc2
5 changed files with 7 additions and 26 deletions

View File

@ -1129,14 +1129,15 @@ void EDA_3D_CANVAS::render3DComponentShape( MODULE* module,
shape3D->Render( aIsRenderingJustNonTransparentObjects,
aIsRenderingJustTransparentObjects );
if( isEnabled( FL_RENDER_SHOW_MODEL_BBOX ) )
const CBBOX &shapeBBox = shape3D->getBBox();
if( isEnabled( FL_RENDER_SHOW_MODEL_BBOX ) && shapeBBox.IsInitialized() )
{
// Set the alpha current color to opaque
float currentColor[4];
glGetFloatv( GL_CURRENT_COLOR,currentColor );
currentColor[3] = 1.0f;
glColor4fv( currentColor );
OGL_draw_bbox( shape3D->getBBox() );
OGL_draw_bbox( shapeBBox );
}
glPopMatrix();

View File

@ -112,24 +112,12 @@ void S3D_MESH::calcBBoxAllChilds( )
void S3D_MESH::calcBBox( )
{
CBBOX tmpBBox;
bool firstBBox = true;
m_BBox.Reset();
// Calc boudingbox for all coords
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
{
for( unsigned int ii = 0; ii < m_CoordIndex[idx].size(); ii++ )
if( firstBBox )
{
firstBBox = false;
tmpBBox = CBBOX( m_Point[m_CoordIndex[idx][ii]] ); // Initialize with the first vertex found
}
else
tmpBBox.Union( m_Point[m_CoordIndex[idx][ii]] );
}
m_BBox = tmpBBox;
m_BBox.Union( m_Point[m_CoordIndex[idx][ii]] );
}

View File

@ -139,15 +139,9 @@ void S3D_MASTER::calcBBox()
if( m_parser == NULL )
return;
bool firstBBox = true;
m_BBox.Reset();
for( unsigned int idx = 0; idx < m_parser->childs.size(); idx++ )
if( firstBBox )
{
firstBBox = false;
m_BBox = m_parser->childs[idx]->getBBox();
}
else
m_BBox.Union( m_parser->childs[idx]->getBBox() );
// Calc transformation matrix to apply in AABBox

View File

@ -36,9 +36,9 @@
#error Please build wxWidgets with Opengl support (./configure --with-opengl)
#endif
#include <wx/glcanvas.h>
#include <3d_struct.h>
#include <info3d_visu.h>
#include <wx/glcanvas.h>
/// A variable name whose value holds the path of 3D shape files.
/// Currently an environment variable, eventually a project variable.

View File

@ -32,8 +32,6 @@
#include <layers_id_colors_and_visibility.h> // Layers id definitions
#include <wx/glcanvas.h>
#ifdef __WXMAC__
# ifdef __DARWIN__
# include <OpenGL/glu.h>