2008-11-24 06:53:43 +00:00
|
|
|
/********************************************************/
|
|
|
|
/* 3d_struct.h : definition des structures de donnees */
|
|
|
|
/* pour la representation 3D des modules */
|
|
|
|
/********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef STRUCT_3D_H
|
|
|
|
#define STRUCT_3D_H
|
|
|
|
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
|
|
|
/* 3D modeler units -> PCB units conversion scale:
|
2008-11-24 06:53:43 +00:00
|
|
|
* 1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */
|
2007-06-05 12:10:51 +00:00
|
|
|
#define UNITS3D_TO_UNITSPCB 1000
|
|
|
|
|
|
|
|
|
|
|
|
class Struct3D_Master;
|
|
|
|
class Struct3D_Shape;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
double m_Red, m_Green, m_Blue;
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
S3D_Color() {
|
|
|
|
m_Red = m_Green = m_Blue = 0;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
double x, y, z;
|
2007-06-05 12:10:51 +00:00
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
S3D_Vertex();
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
class S3D_Material : public EDA_BaseStruct /* openGL "material" data*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
wxString m_Name;
|
|
|
|
S3D_Vertex m_DiffuseColor;
|
2007-06-05 12:10:51 +00:00
|
|
|
S3D_Vertex m_EmissiveColor;
|
|
|
|
S3D_Vertex m_SpecularColor;
|
2008-11-24 06:53:43 +00:00
|
|
|
float m_AmbientIntensity;
|
|
|
|
float m_Transparency;
|
|
|
|
float m_Shininess;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
S3D_Material( Struct3D_Master * father, const wxString &name );
|
|
|
|
|
|
|
|
S3D_Material* Next() const { return (S3D_Material*) Pnext; }
|
|
|
|
S3D_Material* Back() const { return (S3D_Material*) Pback; }
|
|
|
|
|
|
|
|
void SetMaterial();
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
class Struct3D_Master : public EDA_BaseStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************/
|
|
|
|
/* Master structure for a 3D item description */
|
|
|
|
{
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
|
|
|
S3D_Vertex m_MatScale;
|
|
|
|
S3D_Vertex m_MatRotation;
|
|
|
|
S3D_Vertex m_MatPosition;
|
|
|
|
Struct3D_Shape* m_3D_Drawings;
|
|
|
|
S3D_Material* m_Materials;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
Struct3D_Master( EDA_BaseStruct * aParent );
|
2008-11-24 06:53:43 +00:00
|
|
|
~Struct3D_Master();
|
|
|
|
|
|
|
|
Struct3D_Master* Next() const { return (Struct3D_Master*) Pnext; }
|
|
|
|
Struct3D_Master* Back() const { return (Struct3D_Master*) Pback; }
|
|
|
|
|
|
|
|
void Insert( S3D_Material* aMaterial )
|
|
|
|
{
|
|
|
|
aMaterial->SetNext( m_Materials );
|
|
|
|
m_Materials = aMaterial;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Copy( Struct3D_Master* pattern );
|
|
|
|
int ReadData();
|
|
|
|
int ReadMaterial( FILE* file, int* LineNum );
|
|
|
|
int ReadChildren( FILE* file, int* LineNum );
|
|
|
|
int ReadShape( FILE* file, int* LineNum );
|
|
|
|
int ReadAppearance( FILE* file, int* LineNum );
|
|
|
|
int ReadGeometry( FILE* file, int* LineNum );
|
|
|
|
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
class Struct3D_Shape : public EDA_BaseStruct
|
2007-06-05 12:10:51 +00:00
|
|
|
/*********************************************/
|
|
|
|
/* decrit une forme complexe 3D */
|
|
|
|
{
|
|
|
|
public:
|
2008-11-24 06:53:43 +00:00
|
|
|
S3D_Vertex* m_3D_Coord;
|
|
|
|
int* m_3D_CoordIndex;
|
|
|
|
int m_3D_Points;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
Struct3D_Shape( EDA_BaseStruct * aParent );
|
2008-11-24 06:53:43 +00:00
|
|
|
~Struct3D_Shape();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
|
|
|
|
Struct3D_Shape* Back() const { return (Struct3D_Shape*) Pback; }
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
int ReadData( FILE* file, int* LineNum );
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
|
|
|
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
|
|
|
|
/* en INCHES ou MM ou sans unites */
|
|
|
|
/*****************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* internal_unit is the internal unit number by inch:
|
2008-11-24 06:53:43 +00:00
|
|
|
* - 1000 for EESchema
|
|
|
|
* - 10000 for PcbNew
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
class WinEDA_VertexCtrl
|
|
|
|
{
|
|
|
|
private:
|
2008-11-24 06:53:43 +00:00
|
|
|
int m_Units;
|
|
|
|
int m_Internal_Unit;
|
|
|
|
wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
|
|
|
|
wxStaticText* m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
// Constructor and destructor
|
|
|
|
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
|
|
|
|
wxBoxSizer * BoxSizer,
|
|
|
|
int units, int internal_unit );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
~WinEDA_VertexCtrl();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
S3D_Vertex GetValue();
|
|
|
|
void SetValue( S3D_Vertex vertex );
|
|
|
|
void Enable( bool enbl );
|
|
|
|
void SetToolTip( const wxString& text );
|
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* STRUCT_3D_H */
|