Commit cd85ee62 authored by jean-pierre charras's avatar jean-pierre charras

Cosmetic enhancement: change plot icon in menus.

3dviewer: back to double (from float) in class S3D_MASTER for 3 members (m_MatScale, m_MatRotation, m_MatPosition) which are used in dialogs and r/w file functions, which expect double.
Using float create minor but unwanted issues in  r/w file functions.
S3D_MATERIAL: enable all color options: if a 3d shape has bad color parameters, the shape must be modified, not the 3d rendering.
The rendering now matches what we see in other vrml viewer like FreeCAD.
Some minor coding style fixes.
parent 468e9e4a
...@@ -151,7 +151,7 @@ void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUni ...@@ -151,7 +151,7 @@ void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUni
glEnd(); glEnd();
} }
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer ) S3DPOINT_VALUE_CTRL::S3DPOINT_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
{ {
wxString text; wxString text;
...@@ -187,15 +187,16 @@ VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer ) ...@@ -187,15 +187,16 @@ VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
} }
VERTEX_VALUE_CTRL::~VERTEX_VALUE_CTRL() S3DPOINT_VALUE_CTRL::~S3DPOINT_VALUE_CTRL()
{ {
// Nothing to delete: all items are managed by the parent window.
} }
S3D_VERTEX VERTEX_VALUE_CTRL::GetValue() S3DPOINT S3DPOINT_VALUE_CTRL::GetValue()
{ {
S3D_VERTEX value; S3DPOINT value;
double dtmp; double dtmp;
m_XValueCtrl->GetValue().ToDouble( &dtmp ); m_XValueCtrl->GetValue().ToDouble( &dtmp );
value.x = dtmp; value.x = dtmp;
...@@ -207,7 +208,7 @@ S3D_VERTEX VERTEX_VALUE_CTRL::GetValue() ...@@ -207,7 +208,7 @@ S3D_VERTEX VERTEX_VALUE_CTRL::GetValue()
} }
void VERTEX_VALUE_CTRL::SetValue( S3D_VERTEX vertex ) void S3DPOINT_VALUE_CTRL::SetValue( S3DPOINT vertex )
{ {
wxString text; wxString text;
...@@ -225,7 +226,7 @@ void VERTEX_VALUE_CTRL::SetValue( S3D_VERTEX vertex ) ...@@ -225,7 +226,7 @@ void VERTEX_VALUE_CTRL::SetValue( S3D_VERTEX vertex )
} }
void VERTEX_VALUE_CTRL::Enable( bool onoff ) void S3DPOINT_VALUE_CTRL::Enable( bool onoff )
{ {
m_XValueCtrl->Enable( onoff ); m_XValueCtrl->Enable( onoff );
m_YValueCtrl->Enable( onoff ); m_YValueCtrl->Enable( onoff );
......
...@@ -78,11 +78,11 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) : ...@@ -78,11 +78,11 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
m_ShapeType = FILE3D_NONE; m_ShapeType = FILE3D_NONE;
m_use_modelfile_diffuseColor = true; m_use_modelfile_diffuseColor = true;
m_use_modelfile_emissiveColor = false; m_use_modelfile_emissiveColor = true;
m_use_modelfile_specularColor = false; m_use_modelfile_specularColor = true;
m_use_modelfile_ambientIntensity = false; m_use_modelfile_ambientIntensity = true;
m_use_modelfile_transparency = true; m_use_modelfile_transparency = true;
m_use_modelfile_shininess = false; m_use_modelfile_shininess = true;
} }
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
class S3D_MASTER; class S3D_MASTER;
class S3D_MATERIAL : public EDA_ITEM /* openGL "material" data*/ class S3D_MATERIAL : public EDA_ITEM // openGL "material" data
{ {
public: public:
wxString m_Name; wxString m_Name;
// Material list // Material list
std::vector< glm::vec3 > m_AmbientColor; std::vector< glm::vec3 > m_AmbientColor;
std::vector< glm::vec3 > m_DiffuseColor; std::vector< glm::vec3 > m_DiffuseColor;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com> * Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com>
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
#include <base_struct.h> #include <base_struct.h>
#include <3d_material.h> #include <3d_material.h>
#include <gal/opengl/glm/glm.hpp> #include <gal/opengl/glm/glm.hpp>
/* 3D modeling units -> PCB units conversion scale: /**
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch = 100 mils * @note For historical reasons the 3D modeling unit is 0.1 inch
* 1 3Dunit = 2.54 mm = 0.1 inch = 100 mils
*/ */
#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100) #define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100)
...@@ -45,19 +46,42 @@ ...@@ -45,19 +46,42 @@
class S3D_MASTER; class S3D_MASTER;
class STRUCT_3D_SHAPE; class STRUCT_3D_SHAPE;
/* S3D_VERTEX manages a 3D coordinate (3 float numbers: x,y,z coordinates)*/ // S3D_VERTEX manages a opengl 3D coordinate (3 float numbers: x,y,z coordinates)
// float are widely used in opengl functions.
// they are used here in coordinates which are also used in opengl functions.
#define S3D_VERTEX glm::vec3 #define S3D_VERTEX glm::vec3
// S3DPOINT manages a set of 3 double values (x,y,z )
// It is used for values which are not directly used in opengl functions.
// It is used in dialogs, or when reading/writing files for instance
class S3DPOINT
{
public:
double x, y, z;
public:
S3DPOINT()
{
x = y = z = 0.0;
}
S3DPOINT( double px, double py, double pz)
{
x = px;
y = py;
z = pz;
}
};
/* Master structure for a 3D item description */ // Master structure for a 3D footprint shape description
class S3D_MASTER : public EDA_ITEM class S3D_MASTER : public EDA_ITEM
{ {
public: public:
S3D_VERTEX m_MatScale; S3DPOINT m_MatScale; ///< a scaling factor for the entire 3D footprint shape
S3D_VERTEX m_MatRotation; S3DPOINT m_MatRotation; ///< a grotation for the entire 3D footprint shape
S3D_VERTEX m_MatPosition; S3DPOINT m_MatPosition; ///< an offset for the entire 3D footprint shape
STRUCT_3D_SHAPE* m_3D_Drawings; STRUCT_3D_SHAPE* m_3D_Drawings; ///< the list of basic shapes
S3D_MATERIAL* m_Materials; S3D_MATERIAL* m_Materials; ///< the list of materiels used by the shapes
enum FILE3D_TYPE enum FILE3D_TYPE
{ {
...@@ -76,9 +100,9 @@ public: ...@@ -76,9 +100,9 @@ public:
bool m_use_modelfile_shininess; bool m_use_modelfile_shininess;
private: private:
wxString m_Shape3DName; /* 3D shape name in 3D library */ wxString m_Shape3DName; // the 3D shape filename in 3D library
FILE3D_TYPE m_ShapeType; FILE3D_TYPE m_ShapeType;
double m_lastTransparency; // last transparency value from double m_lastTransparency; // last transparency value from
// last material in use // last material in use
bool m_loadTransparentObjects; bool m_loadTransparentObjects;
bool m_loadNonTransparentObjects; bool m_loadNonTransparentObjects;
...@@ -185,26 +209,26 @@ public: ...@@ -185,26 +209,26 @@ public:
/** /**
* Class VERTEX_VALUE_CTRL * Class S3DPOINT_VALUE_CTRL
* displays a vertex for editing. A vertex is a triplet of values * displays a S3DPOINT for editing (in dialogs). A S3DPOINT is a triplet of values
* Values can be scale, rotation, offset... * Values can be scale, rotation, offset...
*/ */
class VERTEX_VALUE_CTRL class S3DPOINT_VALUE_CTRL
{ {
private: private:
wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl; wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
public: public:
VERTEX_VALUE_CTRL( wxWindow* parent, wxBoxSizer* BoxSizer ); S3DPOINT_VALUE_CTRL( wxWindow* parent, wxBoxSizer* BoxSizer );
~VERTEX_VALUE_CTRL(); ~S3DPOINT_VALUE_CTRL();
/** /**
* Function GetValue * Function GetValue
* @return the vertex in internal units. * @return the 3D point in internal units.
*/ */
S3D_VERTEX GetValue(); S3DPOINT GetValue();
void SetValue( S3D_VERTEX vertex ); void SetValue( S3DPOINT a3Dpoint );
void Enable( bool enbl ); void Enable( bool enbl );
void SetToolTip( const wxString& text ); void SetToolTip( const wxString& text );
}; };
......
...@@ -84,8 +84,8 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -84,8 +84,8 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
glRotatef(-matRot.z, 0.0f, 0.0f, 1.0f ); glRotatef(-matRot.z, 0.0f, 0.0f, 1.0f );
glRotatef(-matRot.y, 0.0f, 1.0f, 0.0f ); glRotatef(-matRot.y, 0.0f, 1.0f, 0.0f );
glRotatef(-matRot.x, 1.0f, 0.0f, 0.0f ); glRotatef(-matRot.x, 1.0f, 0.0f, 0.0f );
glScalef( matScale.x, matScale.y, matScale.z ); glScalef( matScale.x, matScale.y, matScale.z );
// Switch the locale to standard C (needed to print floating point numbers like 1.3) // Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
...@@ -103,9 +103,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -103,9 +103,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
if( strcmp( text, "Separator" ) == 0 ) if( strcmp( text, "Separator" ) == 0 )
{ {
m_model = new S3D_MESH(); m_model = new S3D_MESH();
childs.push_back( m_model ); childs.push_back( m_model );
read_separator(); read_separator();
} }
} }
...@@ -114,7 +112,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -114,7 +112,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
SetLocaleTo_Default(); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
//DBG( printf( "chils size:%lu\n", childs.size() ) ); //DBG( printf( "chils size:%lu\n", childs.size() ) );
if( GetMaster()->IsOpenGlAllowed() ) if( GetMaster()->IsOpenGlAllowed() )
{ {
...@@ -137,13 +135,16 @@ int VRML1_MODEL_PARSER::read_separator() ...@@ -137,13 +135,16 @@ int VRML1_MODEL_PARSER::read_separator()
if( strcmp( text, "Material" ) == 0 ) if( strcmp( text, "Material" ) == 0 )
{ {
readMaterial( ); readMaterial( );
} else if( strcmp( text, "Coordinate3" ) == 0 ) }
else if( strcmp( text, "Coordinate3" ) == 0 )
{ {
readCoordinate3(); readCoordinate3();
} else if( strcmp( text, "IndexedFaceSet" ) == 0 ) }
else if( strcmp( text, "IndexedFaceSet" ) == 0 )
{ {
readIndexedFaceSet(); readIndexedFaceSet();
} else if( strcmp( text, "Separator" ) == 0 ) }
else if( strcmp( text, "Separator" ) == 0 )
{ {
S3D_MESH *parent = m_model; S3D_MESH *parent = m_model;
...@@ -157,11 +158,13 @@ int VRML1_MODEL_PARSER::read_separator() ...@@ -157,11 +158,13 @@ int VRML1_MODEL_PARSER::read_separator()
read_separator(); read_separator();
m_model = parent; m_model = parent;
}else if ( ( *text != '}' ) ) }
else if ( ( *text != '}' ) )
{ {
//DBG( printf( "read_NotImplemented %s\n", text ) ); //DBG( printf( "read_NotImplemented %s\n", text ) );
read_NotImplemented( m_file, '}'); read_NotImplemented( m_file, '}');
} else }
else
{ {
break; break;
} }
...@@ -201,19 +204,24 @@ int VRML1_MODEL_PARSER::readMaterial() ...@@ -201,19 +204,24 @@ int VRML1_MODEL_PARSER::readMaterial()
if( strcmp( text, "ambientColor" ) == 0 ) if( strcmp( text, "ambientColor" ) == 0 )
{ {
readMaterial_ambientColor(); readMaterial_ambientColor();
} else if( strcmp( text, "diffuseColor" ) == 0 ) }
else if( strcmp( text, "diffuseColor" ) == 0 )
{ {
readMaterial_diffuseColor( ); readMaterial_diffuseColor( );
} else if( strcmp( text, "emissiveColor" ) == 0 ) }
else if( strcmp( text, "emissiveColor" ) == 0 )
{ {
readMaterial_emissiveColor( ); readMaterial_emissiveColor( );
}else if( strcmp( text, "specularColor" ) == 0 ) }
else if( strcmp( text, "specularColor" ) == 0 )
{ {
readMaterial_specularColor( ); readMaterial_specularColor( );
}else if( strcmp( text, "shininess" ) == 0 ) }
else if( strcmp( text, "shininess" ) == 0 )
{ {
readMaterial_shininess( ); readMaterial_shininess( );
}else if( strcmp( text, "transparency" ) == 0 ) }
else if( strcmp( text, "transparency" ) == 0 )
{ {
readMaterial_transparency( ); readMaterial_transparency( );
} }
...@@ -272,7 +280,8 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet( ) ...@@ -272,7 +280,8 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet( )
if( strcmp( text, "coordIndex" ) == 0 ) if( strcmp( text, "coordIndex" ) == 0 )
{ {
readIndexedFaceSet_coordIndex( ); readIndexedFaceSet_coordIndex( );
} else if( strcmp( text, "materialIndex" ) == 0 ) }
else if( strcmp( text, "materialIndex" ) == 0 )
{ {
readIndexedFaceSet_materialIndex( ); readIndexedFaceSet_materialIndex( );
} }
...@@ -292,7 +301,7 @@ int VRML1_MODEL_PARSER::readMaterial_ambientColor( ) ...@@ -292,7 +301,7 @@ int VRML1_MODEL_PARSER::readMaterial_ambientColor( )
int VRML1_MODEL_PARSER::readMaterial_diffuseColor( ) int VRML1_MODEL_PARSER::readMaterial_diffuseColor( )
{ {
//DBG( printf( " readMaterial_diffuseColor\n" ) ); //DBG( printf( " readMaterial_diffuseColor\n" ) );
return parseVertexList( m_file, m_model->m_Materials->m_DiffuseColor); return parseVertexList( m_file, m_model->m_Materials->m_DiffuseColor);
} }
...@@ -334,6 +343,7 @@ int VRML1_MODEL_PARSER::readMaterial_shininess( ) ...@@ -334,6 +343,7 @@ int VRML1_MODEL_PARSER::readMaterial_shininess( )
m_model->m_Materials->m_Shininess.clear(); m_model->m_Materials->m_Shininess.clear();
float shininess_value; float shininess_value;
while( fscanf( m_file, "%f,", &shininess_value ) ) while( fscanf( m_file, "%f,", &shininess_value ) )
{ {
// VRML value is normalized and openGL expects a value 0 - 128 // VRML value is normalized and openGL expects a value 0 - 128
...@@ -346,7 +356,7 @@ int VRML1_MODEL_PARSER::readMaterial_shininess( ) ...@@ -346,7 +356,7 @@ int VRML1_MODEL_PARSER::readMaterial_shininess( )
m_model->m_Materials->m_Shininess.clear(); m_model->m_Materials->m_Shininess.clear();
} }
//DBG( printf( " m_Shininess.size: %ld\n", m_model->m_Materials->m_Shininess.size() ) ); //DBG( printf( " m_Shininess.size: %ld\n", m_model->m_Materials->m_Shininess.size() ) );
return 0; return 0;
} }
...@@ -359,6 +369,7 @@ int VRML1_MODEL_PARSER::readMaterial_transparency() ...@@ -359,6 +369,7 @@ int VRML1_MODEL_PARSER::readMaterial_transparency()
m_model->m_Materials->m_Transparency.clear(); m_model->m_Materials->m_Transparency.clear();
float tmp; float tmp;
while( fscanf (m_file, "%f,", &tmp) ) while( fscanf (m_file, "%f,", &tmp) )
{ {
m_model->m_Materials->m_Transparency.push_back( tmp ); m_model->m_Materials->m_Transparency.push_back( tmp );
...@@ -368,8 +379,8 @@ int VRML1_MODEL_PARSER::readMaterial_transparency() ...@@ -368,8 +379,8 @@ int VRML1_MODEL_PARSER::readMaterial_transparency()
{ {
m_model->m_Materials->m_Transparency.clear(); m_model->m_Materials->m_Transparency.clear();
} }
//DBG( printf( " m_Transparency.size: %ld\n", m_model->m_Materials->m_Transparency.size() ) ); //DBG( printf( " m_Transparency.size: %ld\n", m_model->m_Materials->m_Transparency.size() ) );
return 0; return 0;
} }
...@@ -378,7 +389,7 @@ int VRML1_MODEL_PARSER::readMaterial_transparency() ...@@ -378,7 +389,7 @@ int VRML1_MODEL_PARSER::readMaterial_transparency()
int VRML1_MODEL_PARSER::readCoordinate3_point() int VRML1_MODEL_PARSER::readCoordinate3_point()
{ {
//DBG( printf( " readCoordinate3_point\n" ) ); //DBG( printf( " readCoordinate3_point\n" ) );
if( parseVertexList( m_file, m_model->m_Point ) == 0 ) if( parseVertexList( m_file, m_model->m_Point ) == 0 )
{ {
return 0; return 0;
...@@ -420,7 +431,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex() ...@@ -420,7 +431,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex()
m_model->m_CoordIndex.push_back( coord_list ); m_model->m_CoordIndex.push_back( coord_list );
} }
//DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) ); //DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) );
return 0; return 0;
} }
...@@ -438,7 +449,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_materialIndex() ...@@ -438,7 +449,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_materialIndex()
m_model->m_MaterialIndex.push_back( index ); m_model->m_MaterialIndex.push_back( index );
} }
//DBG( printf( " m_MaterialIndex.size: %ld\n", m_model->m_MaterialIndex.size() ) ); //DBG( printf( " m_MaterialIndex.size: %ld\n", m_model->m_MaterialIndex.size() ) );
return 0; return 0;
} }
...@@ -73,9 +73,12 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -73,9 +73,12 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits ); glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
glm::vec3 matScale( GetMaster()->m_MatScale.x, GetMaster()->m_MatScale.y, GetMaster()->m_MatScale.z ); glm::vec3 matScale( GetMaster()->m_MatScale.x, GetMaster()->m_MatScale.y,
glm::vec3 matRot( GetMaster()->m_MatRotation.x, GetMaster()->m_MatRotation.y, GetMaster()->m_MatRotation.z ); GetMaster()->m_MatScale.z );
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y, GetMaster()->m_MatPosition.z ); glm::vec3 matRot( GetMaster()->m_MatRotation.x, GetMaster()->m_MatRotation.y,
GetMaster()->m_MatRotation.z );
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y,
GetMaster()->m_MatPosition.z );
#define SCALE_3D_CONV ((IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB) #define SCALE_3D_CONV ((IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB)
...@@ -104,7 +107,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -104,7 +107,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
if( strcmp( text, "Transform" ) == 0 ) if( strcmp( text, "Transform" ) == 0 )
{ {
m_model = new S3D_MESH(); m_model = new S3D_MESH();
childs.push_back( m_model ); childs.push_back( m_model );
read_Transform(); read_Transform();
...@@ -113,7 +115,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename ) ...@@ -113,7 +115,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
else if( strcmp( text, "DEF" ) == 0 ) else if( strcmp( text, "DEF" ) == 0 )
{ {
m_model = new S3D_MESH(); m_model = new S3D_MESH();
childs.push_back( m_model ); childs.push_back( m_model );
read_DEF(); read_DEF();
...@@ -294,15 +295,11 @@ int VRML2_MODEL_PARSER::read_DEF() ...@@ -294,15 +295,11 @@ int VRML2_MODEL_PARSER::read_DEF()
else if( strcmp( text, "Shape" ) == 0 ) else if( strcmp( text, "Shape" ) == 0 )
{ {
S3D_MESH *parent = m_model; S3D_MESH *parent = m_model;
S3D_MESH *new_mesh_model = new S3D_MESH(); S3D_MESH *new_mesh_model = new S3D_MESH();
m_model->childs.push_back( new_mesh_model ); m_model->childs.push_back( new_mesh_model );
m_model = new_mesh_model; m_model = new_mesh_model;
read_Shape(); read_Shape();
m_model = parent; m_model = parent;
} }
} }
...@@ -401,9 +398,7 @@ int VRML2_MODEL_PARSER::read_material() ...@@ -401,9 +398,7 @@ int VRML2_MODEL_PARSER::read_material()
{ {
wxString mat_name; wxString mat_name;
material = new S3D_MATERIAL( GetMaster(), mat_name ); material = new S3D_MATERIAL( GetMaster(), mat_name );
GetMaster()->Insert( material ); GetMaster()->Insert( material );
m_model->m_Materials = material; m_model->m_Materials = material;
if( strcmp( text, "Material" ) == 0 ) if( strcmp( text, "Material" ) == 0 )
...@@ -423,9 +418,7 @@ int VRML2_MODEL_PARSER::read_material() ...@@ -423,9 +418,7 @@ int VRML2_MODEL_PARSER::read_material()
mat_name = FROM_UTF8( text ); mat_name = FROM_UTF8( text );
material = new S3D_MATERIAL( GetMaster(), mat_name ); material = new S3D_MATERIAL( GetMaster(), mat_name );
GetMaster()->Insert( material ); GetMaster()->Insert( material );
m_model->m_Materials = material; m_model->m_Materials = material;
if( GetNextTag( m_file, text ) ) if( GetNextTag( m_file, text ) )
...@@ -506,6 +499,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -506,6 +499,7 @@ int VRML2_MODEL_PARSER::read_Material()
//DBG( printf( " specularColor") ); //DBG( printf( " specularColor") );
parseVertex ( m_file, vertex); parseVertex ( m_file, vertex);
//DBG( printf( "\n") ); //DBG( printf( "\n") );
if( GetMaster()->m_use_modelfile_specularColor == true ) if( GetMaster()->m_use_modelfile_specularColor == true )
{ {
m_model->m_Materials->m_SpecularColor.push_back( vertex ); m_model->m_Materials->m_SpecularColor.push_back( vertex );
...@@ -516,6 +510,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -516,6 +510,7 @@ int VRML2_MODEL_PARSER::read_Material()
float ambientIntensity; float ambientIntensity;
parseFloat( m_file, &ambientIntensity ); parseFloat( m_file, &ambientIntensity );
//DBG( printf( " ambientIntensity %f\n", ambientIntensity) ); //DBG( printf( " ambientIntensity %f\n", ambientIntensity) );
if( GetMaster()->m_use_modelfile_ambientIntensity == true ) if( GetMaster()->m_use_modelfile_ambientIntensity == true )
{ {
m_model->m_Materials->m_AmbientColor.push_back( glm::vec3( ambientIntensity, ambientIntensity, ambientIntensity ) ); m_model->m_Materials->m_AmbientColor.push_back( glm::vec3( ambientIntensity, ambientIntensity, ambientIntensity ) );
...@@ -526,6 +521,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -526,6 +521,7 @@ int VRML2_MODEL_PARSER::read_Material()
float transparency; float transparency;
parseFloat( m_file, &transparency ); parseFloat( m_file, &transparency );
//DBG( printf( " transparency %f\n", transparency) ); //DBG( printf( " transparency %f\n", transparency) );
if( GetMaster()->m_use_modelfile_transparency == true ) if( GetMaster()->m_use_modelfile_transparency == true )
{ {
m_model->m_Materials->m_Transparency.push_back( transparency ); m_model->m_Materials->m_Transparency.push_back( transparency );
...@@ -535,6 +531,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -535,6 +531,7 @@ int VRML2_MODEL_PARSER::read_Material()
{ {
float shininess; float shininess;
parseFloat( m_file, &shininess ); parseFloat( m_file, &shininess );
//DBG( printf( " shininess %f\n", shininess) ); //DBG( printf( " shininess %f\n", shininess) );
// VRML value is normalized and openGL expects a value 0 - 128 // VRML value is normalized and openGL expects a value 0 - 128
if( GetMaster()->m_use_modelfile_shininess == true ) if( GetMaster()->m_use_modelfile_shininess == true )
...@@ -590,7 +587,8 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() ...@@ -590,7 +587,8 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{ {
//DBG( printf( " colorPerVertex = true\n") ); //DBG( printf( " colorPerVertex = true\n") );
colorPerVertex = true; colorPerVertex = true;
} else }
else
{ {
colorPerVertex = false; colorPerVertex = false;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -319,9 +319,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() ...@@ -319,9 +319,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_CostRot180Ctrl->SetValue( m_CurrentModule->GetPlacementCost180() ); m_CostRot180Ctrl->SetValue( m_CurrentModule->GetPlacementCost180() );
// Initialize 3D parameters // Initialize 3D parameters
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale ); m_3D_Scale = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset ); m_3D_Offset = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation ); m_3D_Rotation = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape // if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
if( m_3D_ShapeNameListBox->GetCount() > 0 ) if( m_3D_ShapeNameListBox->GetCount() > 0 )
...@@ -352,8 +352,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay( ...@@ -352,8 +352,7 @@ void DIALOG_MODULE_BOARD_EDITOR::Transfert3DValuesToDisplay(
} }
else else
{ {
S3D_VERTEX dummy_vertex; S3DPOINT dummy_vertex( 1.0, 1.0, 1.0 );
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex ); m_3D_Scale->SetValue( dummy_vertex );
} }
} }
......
...@@ -20,9 +20,9 @@ private: ...@@ -20,9 +20,9 @@ private:
TEXTE_MODULE* m_ValueCopy; TEXTE_MODULE* m_ValueCopy;
std::vector <S3D_MASTER*> m_Shapes3D_list; std::vector <S3D_MASTER*> m_Shapes3D_list;
int m_LastSelected3DShapeIndex; int m_LastSelected3DShapeIndex;
VERTEX_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Scale;
VERTEX_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Offset;
VERTEX_VALUE_CTRL * m_3D_Rotation; S3DPOINT_VALUE_CTRL * m_3D_Rotation;
public: public:
......
...@@ -161,9 +161,9 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties() ...@@ -161,9 +161,9 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
m_CostRot180Ctrl->SetValue( m_currentModule->GetPlacementCost180() ); m_CostRot180Ctrl->SetValue( m_currentModule->GetPlacementCost180() );
// Initialize 3D parameters // Initialize 3D parameters
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale ); m_3D_Scale = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale );
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset ); m_3D_Offset = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset );
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation ); m_3D_Rotation = new S3DPOINT_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation );
// Initialize dialog relative to masks clearances // Initialize dialog relative to masks clearances
m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
...@@ -222,8 +222,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStru ...@@ -222,8 +222,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStru
} }
else else
{ {
S3D_VERTEX dummy_vertex; S3DPOINT dummy_vertex( 1.0, 1.0, 1.0 );
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
m_3D_Scale->SetValue( dummy_vertex ); m_3D_Scale->SetValue( dummy_vertex );
} }
} }
......
...@@ -23,9 +23,9 @@ private: ...@@ -23,9 +23,9 @@ private:
TEXTE_MODULE* m_valueCopy; TEXTE_MODULE* m_valueCopy;
std::vector <S3D_MASTER*> m_shapes3D_list; std::vector <S3D_MASTER*> m_shapes3D_list;
int m_lastSelected3DShapeIndex; int m_lastSelected3DShapeIndex;
VERTEX_VALUE_CTRL * m_3D_Scale; S3DPOINT_VALUE_CTRL * m_3D_Scale;
VERTEX_VALUE_CTRL * m_3D_Offset; S3DPOINT_VALUE_CTRL * m_3D_Offset;
VERTEX_VALUE_CTRL * m_3D_Rotation; S3DPOINT_VALUE_CTRL * m_3D_Rotation;
public: public:
......
...@@ -1936,7 +1936,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule ) ...@@ -1936,7 +1936,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule )
else if( TESTLINE( "Sc" ) ) // Scale else if( TESTLINE( "Sc" ) ) // Scale
{ {
sscanf( line + SZ( "Sc" ), "%f %f %f\n", sscanf( line + SZ( "Sc" ), "%lf %lf %lf\n",
&t3D->m_MatScale.x, &t3D->m_MatScale.x,
&t3D->m_MatScale.y, &t3D->m_MatScale.y,
&t3D->m_MatScale.z ); &t3D->m_MatScale.z );
...@@ -1944,7 +1944,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule ) ...@@ -1944,7 +1944,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule )
else if( TESTLINE( "Of" ) ) // Offset else if( TESTLINE( "Of" ) ) // Offset
{ {
sscanf( line + SZ( "Of" ), "%f %f %f\n", sscanf( line + SZ( "Of" ), "%lf %lf %lf\n",
&t3D->m_MatPosition.x, &t3D->m_MatPosition.x,
&t3D->m_MatPosition.y, &t3D->m_MatPosition.y,
&t3D->m_MatPosition.z ); &t3D->m_MatPosition.z );
...@@ -1952,7 +1952,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule ) ...@@ -1952,7 +1952,7 @@ void LEGACY_PLUGIN::load3D( MODULE* aModule )
else if( TESTLINE( "Ro" ) ) // Rotation else if( TESTLINE( "Ro" ) ) // Rotation
{ {
sscanf( line + SZ( "Ro" ), "%f %f %f\n", sscanf( line + SZ( "Ro" ), "%lf %lf %lf\n",
&t3D->m_MatRotation.x, &t3D->m_MatRotation.x,
&t3D->m_MatRotation.y, &t3D->m_MatRotation.y,
&t3D->m_MatRotation.z ); &t3D->m_MatRotation.z );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment