Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7c482f68
Commit
7c482f68
authored
Mar 03, 2008
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Jonas Diemer's patch (3D display: enhanced movings from mouse and tools)
parent
56ef4d3b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
765 additions
and
711 deletions
+765
-711
3d_canvas.cpp
3d-viewer/3d_canvas.cpp
+19
-8
3d_draw.cpp
3d-viewer/3d_draw.cpp
+740
-703
change_log.txt
change_log.txt
+6
-0
No files found.
3d-viewer/3d_canvas.cpp
View file @
7c482f68
...
@@ -282,6 +282,8 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
...
@@ -282,6 +282,8 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
}
}
if
(
event
.
Dragging
()
)
if
(
event
.
Dragging
()
)
{
if
(
event
.
LeftIsDown
()
)
{
{
/* drag in progress, simulate trackball */
/* drag in progress, simulate trackball */
trackball
(
spin_quat
,
trackball
(
spin_quat
,
...
@@ -291,6 +293,15 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
...
@@ -291,6 +293,15 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
(
size
.
y
-
2.0
*
event
.
GetY
()
)
/
size
.
y
);
(
size
.
y
-
2.0
*
event
.
GetY
()
)
/
size
.
y
);
add_quats
(
spin_quat
,
g_Parm_3D_Visu
.
m_Quat
,
g_Parm_3D_Visu
.
m_Quat
);
add_quats
(
spin_quat
,
g_Parm_3D_Visu
.
m_Quat
,
g_Parm_3D_Visu
.
m_Quat
);
}
else
if
(
event
.
MiddleIsDown
()
)
{
/* middle button drag -> pan */
/* Current zoom and an additional factor are taken into account for the amount of panning. */
const
float
PAN_FACTOR
=
8.0
*
g_Parm_3D_Visu
.
m_Zoom
;
g_Draw3d_dx
-=
PAN_FACTOR
*
(
g_Parm_3D_Visu
.
m_Beginx
-
event
.
GetX
()
)
/
size
.
x
;
g_Draw3d_dy
-=
PAN_FACTOR
*
(
event
.
GetY
()
-
g_Parm_3D_Visu
.
m_Beginy
)
/
size
.
y
;
}
/* orientation has changed, redraw mesh */
/* orientation has changed, redraw mesh */
DisplayStatus
();
DisplayStatus
();
...
...
3d-viewer/3d_draw.cpp
View file @
7c482f68
//////////////////////////////////////
//////////////////////////////////////
// Name: 3d_draw.cpp
// Name: 3d_draw.cpp
//////////////////////////////////////
//////////////////////////////////////
...
@@ -27,43 +28,51 @@
...
@@ -27,43 +28,51 @@
#include "3d_struct.h"
#include "3d_struct.h"
static
void
Draw3D_FilledCircle
(
double
posx
,
double
posy
,
static
void
Draw3D_FilledCircle
(
double
posx
,
double
posy
,
double
rayon
,
double
hole_rayon
,
double
zpos
);
double
rayon
,
double
hole_rayon
,
double
zpos
);
static
void
Draw3D_FilledSegment
(
double
startx
,
double
starty
,
static
void
Draw3D_FilledSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
);
double
endx
,
double
endy
,
double
width
,
double
zpos
);
static
void
Draw3D_FilledCylinder
(
double
posx
,
double
posy
,
static
void
Draw3D_FilledCylinder
(
double
posx
,
double
posy
,
double
rayon
,
double
height
,
double
zpos
);
double
rayon
,
double
height
,
double
zpos
);
static
void
Draw3D_FilledSegmentWithHole
(
double
startx
,
double
starty
,
static
void
Draw3D_FilledSegmentWithHole
(
double
startx
,
double
endx
,
double
endy
,
double
width
,
double
starty
,
double
holex
,
double
holey
,
double
holeradius
,
double
zpos
);
double
endx
,
double
endy
,
double
width
,
/**********************************/
double
holex
,
double
holey
,
double
holeradius
,
double
zpos
);
/******************************************/
void
Pcb3D_GLCanvas
::
Redraw
(
bool
finish
)
void
Pcb3D_GLCanvas
::
Redraw
(
bool
finish
)
/**********************************/
/**********************************
********
/
{
{
SetCurrent
();
SetCurrent
();
InitGL
();
InitGL
();
glMatrixMode
(
GL_MODELVIEW
);
/* position viewer */
glMatrixMode
(
GL_MODELVIEW
);
/* position viewer */
/* transformations */
/* transformations */
GLfloat
mat
[
4
][
4
];
GLfloat
mat
[
4
][
4
];
// Translatory motion first, so rotations don't mess up the orientation...
glTranslatef
(
g_Draw3d_dx
,
g_Draw3d_dy
,
0.0
F
);
build_rotmatrix
(
mat
,
g_Parm_3D_Visu
.
m_Quat
);
build_rotmatrix
(
mat
,
g_Parm_3D_Visu
.
m_Quat
);
glMultMatrixf
(
&
mat
[
0
][
0
]
);
glMultMatrixf
(
&
mat
[
0
][
0
]
);
glTranslatef
(
g_Draw3d_dx
,
g_Draw3d_dy
,
0.0
F
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
0
],
1.0
,
0.0
,
0.0
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
1
],
0.0
,
1.0
,
0.0
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
0
],
1.0
,
0.0
,
0.0
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
2
],
0.0
,
0.0
,
1.0
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
1
],
0.0
,
1.0
,
0.0
);
glRotatef
(
g_Parm_3D_Visu
.
m_Rot
[
2
],
0.0
,
0.0
,
1.0
);
if
(
m_gllist
)
if
(
m_gllist
)
glCallList
(
m_gllist
);
glCallList
(
m_gllist
);
else
else
{
{
m_gllist
=
CreateDrawGL_List
();
m_gllist
=
CreateDrawGL_List
();
// m_gllist = DisplayCubeforTest(); // Only for test
// m_gllist = DisplayCubeforTest(); // Only for test
}
}
...
@@ -77,14 +86,15 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
...
@@ -77,14 +86,15 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
/**********************************************/
/**********************************************/
GLuint
Pcb3D_GLCanvas
::
CreateDrawGL_List
()
GLuint
Pcb3D_GLCanvas
::
CreateDrawGL_List
()
/**********************************************/
/**********************************************/
/* Creation de la liste des elements a afficher
/* Creation de la liste des elements a afficher
*/
*/
{
{
GLuint
gllist
=
glGenLists
(
1
);
GLuint
gllist
=
glGenLists
(
1
);
WinEDA_BasePcbFrame
*
pcbframe
=
m_Parent
->
m_Parent
;
WinEDA_BasePcbFrame
*
pcbframe
=
m_Parent
->
m_Parent
;
BOARD
*
pcb
=
pcbframe
->
m_Pcb
;
BOARD
*
pcb
=
pcbframe
->
m_Pcb
;
TRACK
*
pt_piste
;
TRACK
*
pt_piste
;
int
ii
;
int
ii
;
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
...
@@ -92,9 +102,10 @@ int ii;
...
@@ -92,9 +102,10 @@ int ii;
g_Parm_3D_Visu
.
m_BoardSettings
=
pcb
->
m_BoardSettings
;
g_Parm_3D_Visu
.
m_BoardSettings
=
pcb
->
m_BoardSettings
;
g_Parm_3D_Visu
.
m_BoardSize
=
pcb
->
m_BoundaryBox
.
GetSize
();
g_Parm_3D_Visu
.
m_BoardSize
=
pcb
->
m_BoundaryBox
.
GetSize
();
g_Parm_3D_Visu
.
m_BoardPos
=
pcb
->
m_BoundaryBox
.
Centre
();
g_Parm_3D_Visu
.
m_BoardPos
=
pcb
->
m_BoundaryBox
.
Centre
();
g_Parm_3D_Visu
.
m_BoardPos
.
y
=
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
;
g_Parm_3D_Visu
.
m_BoardPos
.
y
=
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
;
g_Parm_3D_Visu
.
m_Layers
=
pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
g_Parm_3D_Visu
.
m_Layers
=
pcb
->
m_BoardSettings
->
m_CopperLayerCount
;
g_Parm_3D_Visu
.
m_BoardScale
=
2.0
/
MAX
(
g_Parm_3D_Visu
.
m_BoardSize
.
x
,
g_Parm_3D_Visu
.
m_BoardSize
.
y
);
g_Parm_3D_Visu
.
m_BoardScale
=
2.0
/
MAX
(
g_Parm_3D_Visu
.
m_BoardSize
.
x
,
g_Parm_3D_Visu
.
m_BoardSize
.
y
);
float
epoxy_width
=
1.6
;
// epoxy width in mm
float
epoxy_width
=
1.6
;
// epoxy width in mm
g_Parm_3D_Visu
.
m_Epoxy_Width
=
epoxy_width
/
2.54
*
1000
g_Parm_3D_Visu
.
m_Epoxy_Width
=
epoxy_width
/
2.54
*
1000
*
g_Parm_3D_Visu
.
m_BoardScale
;
*
g_Parm_3D_Visu
.
m_BoardScale
;
...
@@ -108,6 +119,7 @@ int ii;
...
@@ -108,6 +119,7 @@ int ii;
else
else
g_Parm_3D_Visu
.
m_LayerZcoord
[
ii
]
=
g_Parm_3D_Visu
.
m_Epoxy_Width
;
g_Parm_3D_Visu
.
m_LayerZcoord
[
ii
]
=
g_Parm_3D_Visu
.
m_Epoxy_Width
;
}
}
GLfloat
zpos_cu
=
500
*
g_Parm_3D_Visu
.
m_BoardScale
;
GLfloat
zpos_cu
=
500
*
g_Parm_3D_Visu
.
m_BoardScale
;
GLfloat
zpos_cmp
=
g_Parm_3D_Visu
.
m_Epoxy_Width
+
zpos_cu
;
GLfloat
zpos_cmp
=
g_Parm_3D_Visu
.
m_Epoxy_Width
+
zpos_cu
;
g_Parm_3D_Visu
.
m_LayerZcoord
[
ADHESIVE_N_CU
]
=
-
zpos_cu
*
2
;
g_Parm_3D_Visu
.
m_LayerZcoord
[
ADHESIVE_N_CU
]
=
-
zpos_cu
*
2
;
...
@@ -121,46 +133,47 @@ int ii;
...
@@ -121,46 +133,47 @@ int ii;
glNewList
(
gllist
,
GL_COMPILE_AND_EXECUTE
);
glNewList
(
gllist
,
GL_COMPILE_AND_EXECUTE
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
/* draw axes */
/* draw axes */
glEnable
(
GL_COLOR_MATERIAL
);
glEnable
(
GL_COLOR_MATERIAL
);
SetGLColor
(
WHITE
);
SetGLColor
(
WHITE
);
glBegin
(
GL_LINES
);
glBegin
(
GL_LINES
);
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
1.0
,
0.0
,
0.0
);
// X axis
glVertex3f
(
1.0
,
0.0
,
0.0
);
// X axis
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
0.0
,
-
1.0
,
0.0
);
// Y axis
glVertex3f
(
0.0
,
-
1.0
,
0.0
);
// Y axis
glNormal3f
(
1.0
,
0.0
,
0.0
);
// Normal is Y axis
glNormal3f
(
1.0
,
0.0
,
0.0
);
// Normal is Y axis
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
0.0
,
0.0
,
0.0
);
glVertex3f
(
0.0
,
0.0
,
0.3
);
// Z axis
glVertex3f
(
0.0
,
0.0
,
0.3
);
// Z axis
glEnd
();
glEnd
();
/* Draw epoxy limits (do not use, works and test in progress) */
/* Draw epoxy limits (do not use, works and test in progress) */
#if 0
#if 0
glEnable(GL_FOG
);
glEnable( GL_FOG
);
GLfloat param;
GLfloat param;
// param = GL_LINEAR;
// param = GL_LINEAR;
// glFogfv(GL_FOG_MODE, & param);
// glFogfv(GL_FOG_MODE, & param);
param = 0.2;
param = 0.2;
glFogfv(GL_FOG_DENSITY, & param
);
glFogfv( GL_FOG_DENSITY, ¶m
);
param = g_Parm_3D_Visu.m_LayerZcoord[15];
param = g_Parm_3D_Visu.m_LayerZcoord[15];
glFogfv(GL_FOG_END, & param
);
glFogfv( GL_FOG_END, ¶m
);
glBegin(GL_QUADS
);
glBegin( GL_QUADS
);
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N]
);
SetGLColor( g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N]
);
double sx = DataScale3D * g_Parm_3D_Visu.m_BoardSize.x / 2;
double sx = DataScale3D * g_Parm_3D_Visu.m_BoardSize.x / 2;
double sy = DataScale3D * g_Parm_3D_Visu.m_BoardSize.y / 2;
double sy = DataScale3D * g_Parm_3D_Visu.m_BoardSize.y / 2;
double zpos = g_Parm_3D_Visu.m_LayerZcoord[15];
double zpos = g_Parm_3D_Visu.m_LayerZcoord[15];
glNormal3f( 0.0, 0.0, 1.0
); // Normal is Z axis
glNormal3f( 0.0, 0.0, 1.0
); // Normal is Z axis
sx = sy = 0.5;
sx = sy = 0.5;
glVertex3f( -sx, -sy, zpos );
glVertex3f( -sx, -sy, zpos );
glVertex3f( -sx, sy, zpos );
glVertex3f( -sx, sy, zpos );
glVertex3f( sx, sy, zpos );
glVertex3f( sx, sy, zpos );
glVertex3f( sx, -sy, zpos );
glVertex3f( sx, -sy, zpos );
glEnd();
glEnd();
glBegin(GL_QUADS
);
glBegin( GL_QUADS
);
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[COPPER_LAYER_N]
);
SetGLColor( g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[COPPER_LAYER_N]
);
glNormal3f( 0.0, 0.0, -1.0 ); // Normal is -Z axis
glNormal3f( 0.0, 0.0, -1.0 ); // Normal is -Z axis
glVertex3f( -sx, -sy, 0 );
glVertex3f( -sx, -sy, 0 );
glVertex3f( -sx, sy, 0 );
glVertex3f( -sx, sy, 0 );
...
@@ -170,55 +183,56 @@ int ii;
...
@@ -170,55 +183,56 @@ int ii;
#endif
#endif
/* Translation du trac du BOARD pour placer son centre en 0, 0 */
/* Translation du trac du BOARD pour placer son centre en 0, 0 */
glTranslatef
(
-
g_Parm_3D_Visu
.
m_BoardPos
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
,
glTranslatef
(
-
g_Parm_3D_Visu
.
m_BoardPos
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
,
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
,
-
g_Parm_3D_Visu
.
m_BoardPos
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
,
0.0
F
);
0.0
F
);
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
/* Trac des pistes : */
/* Trac des pistes : */
for
(
pt_piste
=
pcb
->
m_Track
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
for
(
pt_piste
=
pcb
->
m_Track
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
{
{
if
(
pt_piste
->
Type
()
==
TYPEVIA
)
if
(
pt_piste
->
Type
()
==
TYPEVIA
)
Draw3D_Via
((
SEGVIA
*
)
pt_piste
);
Draw3D_Via
(
(
SEGVIA
*
)
pt_piste
);
else
else
Draw3D_Track
(
pt_piste
);
Draw3D_Track
(
pt_piste
);
}
}
/* Trac des edges */
/* Trac des edges */
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
for
(
PtStruct
=
pcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
for
(
PtStruct
=
pcb
->
m_Drawings
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
{
#define STRUCT ((DRAWSEGMENT *) PtStruct
)
#define STRUCT ( (DRAWSEGMENT*) PtStruct
)
if
(
PtStruct
->
Type
()
!=
TYPEDRAWSEGMENT
)
if
(
PtStruct
->
Type
()
!=
TYPEDRAWSEGMENT
)
continue
;
continue
;
Draw3D_DrawSegment
(
STRUCT
);
Draw3D_DrawSegment
(
STRUCT
);
}
}
/* trac des modules */
/* trac des modules */
MODULE
*
Module
=
(
MODULE
*
)
pcb
->
m_Modules
;
MODULE
*
Module
=
(
MODULE
*
)
pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
{
{
Module
->
Draw3D
(
this
);
Module
->
Draw3D
(
this
);
}
}
glEndList
();
glEndList
();
/* Test for errors */
/* Test for errors */
GLenum
err
=
glGetError
();
GLenum
err
=
glGetError
();
if
(
err
!=
GL_NO_ERROR
)
if
(
err
!=
GL_NO_ERROR
)
DisplayError
(
this
,
wxT
(
"Error in GL commands"
)
);
DisplayError
(
this
,
wxT
(
"Error in GL commands"
)
);
return
gllist
;
return
gllist
;
}
}
/************************************************/
/************************************************/
void
Pcb3D_GLCanvas
::
Draw3D_Track
(
TRACK
*
track
)
void
Pcb3D_GLCanvas
::
Draw3D_Track
(
TRACK
*
track
)
/************************************************/
/************************************************/
{
{
double
zpos
;
double
zpos
;
int
layer
=
track
->
GetLayer
();
int
layer
=
track
->
GetLayer
();
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
double
ox
,
oy
,
fx
,
fy
;
double
ox
,
oy
,
fx
,
fy
;
double
w
;
double
w
;
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
return
;
return
;
...
@@ -226,7 +240,7 @@ double w;
...
@@ -226,7 +240,7 @@ double w;
layer
=
g_Parm_3D_Visu
.
m_Layers
-
1
;
layer
=
g_Parm_3D_Visu
.
m_Layers
-
1
;
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
SetGLColor
(
color
);
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
w
=
track
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
w
=
track
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
...
@@ -234,20 +248,21 @@ double w;
...
@@ -234,20 +248,21 @@ double w;
oy
=
track
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
oy
=
track
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
fx
=
track
->
m_End
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
fx
=
track
->
m_End
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
fy
=
track
->
m_End
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
fy
=
track
->
m_End
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
Draw3D_FilledSegment
(
ox
,
-
oy
,
fx
,
-
fy
,
w
,
zpos
);
Draw3D_FilledSegment
(
ox
,
-
oy
,
fx
,
-
fy
,
w
,
zpos
);
}
}
/********************************************/
/********************************************/
void
Pcb3D_GLCanvas
::
Draw3D_Via
(
SEGVIA
*
via
)
void
Pcb3D_GLCanvas
::
Draw3D_Via
(
SEGVIA
*
via
)
/*********************************************/
/*********************************************/
/* 3D drawing for a VIA (cylinder + filled circles)
/* 3D drawing for a VIA (cylinder + filled circles)
*/
*/
{
{
double
x
,
y
,
r
,
hole
;
double
x
,
y
,
r
,
hole
;
int
layer
,
top_layer
,
bottom_layer
;
int
layer
,
top_layer
,
bottom_layer
;
double
zpos
,
height
;
double
zpos
,
height
;
int
color
;
int
color
;
r
=
via
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
r
=
via
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
/
2
;
hole
=
via
->
GetDrillValue
();
hole
=
via
->
GetDrillValue
();
...
@@ -255,7 +270,7 @@ int color;
...
@@ -255,7 +270,7 @@ int color;
x
=
via
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
via
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
via
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
via
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
// Drawing filled circles:
// Drawing filled circles:
for
(
layer
=
bottom_layer
;
layer
<
g_Parm_3D_Visu
.
m_Layers
;
layer
++
)
for
(
layer
=
bottom_layer
;
layer
<
g_Parm_3D_Visu
.
m_Layers
;
layer
++
)
...
@@ -267,32 +282,33 @@ int color;
...
@@ -267,32 +282,33 @@ int color;
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
CMP_N
];
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
CMP_N
];
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
continue
;
continue
;
SetGLColor
(
color
);
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
Draw3D_FilledCircle
(
x
,
-
y
,
r
,
hole
,
zpos
);
Draw3D_FilledCircle
(
x
,
-
y
,
r
,
hole
,
zpos
);
if
(
layer
>=
top_layer
)
if
(
layer
>=
top_layer
)
break
;
break
;
}
}
// Drawing hole:
// Drawing hole:
SetGLColor
(
DARKGRAY
);
SetGLColor
(
DARKGRAY
);
height
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
top_layer
]
-
g_Parm_3D_Visu
.
m_LayerZcoord
[
bottom_layer
];
height
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
top_layer
]
-
g_Parm_3D_Visu
.
m_LayerZcoord
[
bottom_layer
];
Draw3D_FilledCylinder
(
x
,
-
y
,
hole
,
height
,
g_Parm_3D_Visu
.
m_LayerZcoord
[
bottom_layer
]
);
Draw3D_FilledCylinder
(
x
,
-
y
,
hole
,
height
,
g_Parm_3D_Visu
.
m_LayerZcoord
[
bottom_layer
]
);
}
}
/*************************************************************/
/*************************************************************/
void
Pcb3D_GLCanvas
::
Draw3D_DrawSegment
(
DRAWSEGMENT
*
segment
)
void
Pcb3D_GLCanvas
::
Draw3D_DrawSegment
(
DRAWSEGMENT
*
segment
)
/*************************************************************/
/*************************************************************/
{
{
int
layer
;
int
layer
;
double
x
,
y
,
xf
,
yf
;
double
x
,
y
,
xf
,
yf
;
double
zpos
,
w
;
double
zpos
,
w
;
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
segment
->
GetLayer
()];
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
segment
->
GetLayer
()];
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
return
;
return
;
SetGLColor
(
color
);
SetGLColor
(
color
);
w
=
segment
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
w
=
segment
->
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
segment
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
x
=
segment
->
m_Start
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
segment
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
segment
->
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
...
@@ -308,7 +324,6 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
...
@@ -308,7 +324,6 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
Draw3D_FilledSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
Draw3D_FilledSegment
(
x
,
-
y
,
xf
,
-
yf
,
w
,
zpos
);
}
}
}
}
else
else
{
{
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
segment
->
GetLayer
()];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
segment
->
GetLayer
()];
...
@@ -318,18 +333,18 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
...
@@ -318,18 +333,18 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
/*********************************************/
/*********************************************/
void
MODULE
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
void
MODULE
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
/*********************************************/
/*********************************************/
{
{
D_PAD
*
pad
=
m_Pads
;
D_PAD
*
pad
=
m_Pads
;
#if 0
#if 0
if( !
DisplayOpt.Show_Modules_Cmp )
if( !
DisplayOpt.Show_Modules_Cmp )
{
{
if( m_Layer == CMP_N )
if( m_Layer == CMP_N )
return;
return;
}
}
if( !
DisplayOpt.Show_Modules_Cu )
if( !
DisplayOpt.Show_Modules_Cu )
{
{
if( m_Layer == COPPER_LAYER_N )
if( m_Layer == COPPER_LAYER_N )
return;
return;
...
@@ -337,23 +352,23 @@ D_PAD * pad = m_Pads;
...
@@ -337,23 +352,23 @@ D_PAD * pad = m_Pads;
#endif
#endif
/* Draw pads */
/* Draw pads */
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Pnext
)
{
{
pad
->
Draw3D
(
glcanvas
);
pad
->
Draw3D
(
glcanvas
);
}
}
/* Draw module shape: 3D shape if exists (or module edge if not exists) */
/* Draw module shape: 3D shape if exists (or module edge if not exists) */
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
Struct3D_Master
*
Struct3D
=
m_3D_Drawings
;
bool
As3dShape
=
FALSE
;
bool
As3dShape
=
FALSE
;
glPushMatrix
();
glPushMatrix
();
glTranslatef
(
m_Pos
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
,
glTranslatef
(
m_Pos
.
x
*
g_Parm_3D_Visu
.
m_BoardScale
,
-
m_Pos
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
,
-
m_Pos
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
,
g_Parm_3D_Visu
.
m_LayerZcoord
[
m_Layer
]
);
g_Parm_3D_Visu
.
m_LayerZcoord
[
m_Layer
]
);
if
(
m_Orient
)
if
(
m_Orient
)
{
{
glRotatef
(
(
double
)
m_Orient
/
10
,
0.0
,
0.0
,
1.0
);
glRotatef
(
(
double
)
m_Orient
/
10
,
0.0
,
0.0
,
1.0
);
}
}
if
(
m_Layer
==
COPPER_LAYER_N
)
if
(
m_Layer
==
COPPER_LAYER_N
)
{
{
...
@@ -362,19 +377,20 @@ bool As3dShape = FALSE;
...
@@ -362,19 +377,20 @@ bool As3dShape = FALSE;
}
}
DataScale3D
=
g_Parm_3D_Visu
.
m_BoardScale
*
UNITS3D_TO_UNITSPCB
;
DataScale3D
=
g_Parm_3D_Visu
.
m_BoardScale
*
UNITS3D_TO_UNITSPCB
;
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
{
{
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
if
(
!
Struct3D
->
m_Shape3DName
.
IsEmpty
()
)
{
{
As3dShape
=
TRUE
;
As3dShape
=
TRUE
;
Struct3D
->
ReadData
();
Struct3D
->
ReadData
();
}
}
}
}
glPopMatrix
();
glPopMatrix
();
if
(
!
As3dShape
)
if
(
!
As3dShape
)
{
{
EDA_BaseStruct
*
Struct
=
m_Drawings
;
EDA_BaseStruct
*
Struct
=
m_Drawings
;
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
for
(
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
for
(
;
Struct
!=
NULL
;
Struct
=
Struct
->
Pnext
)
{
{
...
@@ -384,7 +400,7 @@ bool As3dShape = FALSE;
...
@@ -384,7 +400,7 @@ bool As3dShape = FALSE;
break
;
break
;
case
TYPEEDGEMODULE
:
case
TYPEEDGEMODULE
:
((
EDGE_MODULE
*
)
Struct
)
->
Draw3D
(
glcanvas
);
(
(
EDGE_MODULE
*
)
Struct
)
->
Draw3D
(
glcanvas
);
break
;
break
;
default
:
default
:
...
@@ -396,17 +412,17 @@ bool As3dShape = FALSE;
...
@@ -396,17 +412,17 @@ bool As3dShape = FALSE;
/***************************************************/
/***************************************************/
void
EDGE_MODULE
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
void
EDGE_MODULE
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
/***************************************************/
/***************************************************/
{
{
int
ux0
,
uy0
,
dx
,
dy
,
rayon
,
StAngle
,
EndAngle
;
int
ux0
,
uy0
,
dx
,
dy
,
rayon
,
StAngle
,
EndAngle
;
double
scale
,
x
,
y
,
fx
,
fy
,
w
,
zpos
;
double
scale
,
x
,
y
,
fx
,
fy
,
w
,
zpos
;
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
m_Layer
];
int
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
m_Layer
];
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
return
;
return
;
SetGLColor
(
color
);
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
(
m_Layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
m_Layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
scale
=
g_Parm_3D_Visu
.
m_BoardScale
;
scale
=
g_Parm_3D_Visu
.
m_BoardScale
;
...
@@ -416,6 +432,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
...
@@ -416,6 +432,7 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
dy
=
m_End
.
y
;
dy
=
m_End
.
y
;
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
m_Layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
m_Layer
];
w
=
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
w
=
m_Width
*
g_Parm_3D_Visu
.
m_BoardScale
;
switch
(
m_Shape
)
switch
(
m_Shape
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
...
@@ -423,17 +440,17 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
...
@@ -423,17 +440,17 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
y
=
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
y
=
m_Start
.
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
fx
=
dx
*
g_Parm_3D_Visu
.
m_BoardScale
;
fx
=
dx
*
g_Parm_3D_Visu
.
m_BoardScale
;
fy
=
dy
*
g_Parm_3D_Visu
.
m_BoardScale
;
fy
=
dy
*
g_Parm_3D_Visu
.
m_BoardScale
;
Draw3D_FilledSegment
(
x
,
-
y
,
fx
,
-
fy
,
w
,
zpos
);
Draw3D_FilledSegment
(
x
,
-
y
,
fx
,
-
fy
,
w
,
zpos
);
break
;
break
;
case
S_CIRCLE
:
case
S_CIRCLE
:
rayon
=
(
int
)
hypot
(
(
double
)(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
rayon
=
(
int
)
hypot
(
(
double
)
(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
/* TO DO */
/* TO DO */
break
;
break
;
case
S_ARC
:
case
S_ARC
:
rayon
=
(
int
)
hypot
(
(
double
)(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
rayon
=
(
int
)
hypot
(
(
double
)
(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
StAngle
=
(
int
)
ArcTangente
(
dy
-
uy0
,
dx
-
ux0
);
StAngle
=
(
int
)
ArcTangente
(
dy
-
uy0
,
dx
-
ux0
);
EndAngle
=
StAngle
+
m_Angle
;
EndAngle
=
StAngle
+
m_Angle
;
/* TO DO */
/* TO DO */
break
;
break
;
...
@@ -442,31 +459,32 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
...
@@ -442,31 +459,32 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
/***********************************************/
/***********************************************/
void
D_PAD
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
void
D_PAD
::
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
)
/***********************************************/
/***********************************************/
/* Dessin 3D des pads avec leur trou de percage
/* Dessin 3D des pads avec leur trou de percage
*/
*/
{
{
int
ii
,
ll
,
layer
,
nlmax
;
int
ii
,
ll
,
layer
,
nlmax
;
int
ux0
,
uy0
,
int
ux0
,
uy0
,
dx
,
dx0
,
dy
,
dy0
,
dx
,
dx0
,
dy
,
dy0
,
delta_cx
,
delta_cy
,
delta_cx
,
delta_cy
,
xc
,
yc
;
xc
,
yc
;
int
angle
,
delta_angle
;
int
angle
,
delta_angle
;
int
coord
[
4
][
2
];
int
coord
[
4
][
2
];
double
fcoord
[
8
][
2
],
f_hole_coord
[
8
][
2
];
double
fcoord
[
8
][
2
],
f_hole_coord
[
8
][
2
];
float
scale
;
float
scale
;
double
zpos
;
double
zpos
;
wxPoint
shape_pos
;
wxPoint
shape_pos
;
double
x
,
y
,
r
,
w
,
hole
,
holeX
,
holeY
;
double
x
,
y
,
r
,
w
,
hole
,
holeX
,
holeY
;
double
drillx
,
drilly
;
double
drillx
,
drilly
;
bool
Oncu
,
Oncmp
,
Both
;
bool
Oncu
,
Oncmp
,
Both
;
int
color
;
int
color
;
scale
=
g_Parm_3D_Visu
.
m_BoardScale
;
scale
=
g_Parm_3D_Visu
.
m_BoardScale
;
holeX
=
(
double
)
m_Drill
.
x
*
scale
/
2
;
holeX
=
(
double
)
m_Drill
.
x
*
scale
/
2
;
holeY
=
(
double
)
m_Drill
.
y
*
scale
/
2
;
holeY
=
(
double
)
m_Drill
.
y
*
scale
/
2
;
hole
=
MIN
(
holeX
,
holeY
);
hole
=
MIN
(
holeX
,
holeY
);
/* calcul du centre des formes des pads : */
/* calcul du centre des formes des pads : */
shape_pos
=
ReturnShapePos
();
shape_pos
=
ReturnShapePos
();
...
@@ -485,8 +503,8 @@ int color;
...
@@ -485,8 +503,8 @@ int color;
/* Draw the pad hole (TODO: draw OBLONG hole) */
/* Draw the pad hole (TODO: draw OBLONG hole) */
if
(
holeX
&&
holeY
)
if
(
holeX
&&
holeY
)
{
{
SetGLColor
(
DARKGRAY
);
SetGLColor
(
DARKGRAY
);
Draw3D_FilledCylinder
(
drillx
,
-
drilly
,
hole
,
g_Parm_3D_Visu
.
m_LayerZcoord
[
CMP_N
],
0.0
);
Draw3D_FilledCylinder
(
drillx
,
-
drilly
,
hole
,
g_Parm_3D_Visu
.
m_LayerZcoord
[
CMP_N
],
0.0
);
}
}
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
...
@@ -494,33 +512,35 @@ int color;
...
@@ -494,33 +512,35 @@ int color;
Oncu
=
(
m_Masque_Layer
&
CUIVRE_LAYER
)
?
TRUE
:
FALSE
;
Oncu
=
(
m_Masque_Layer
&
CUIVRE_LAYER
)
?
TRUE
:
FALSE
;
Oncmp
=
(
m_Masque_Layer
&
CMP_LAYER
)
?
TRUE
:
FALSE
;
Oncmp
=
(
m_Masque_Layer
&
CMP_LAYER
)
?
TRUE
:
FALSE
;
Both
=
Oncu
&&
Oncmp
;
Both
=
Oncu
&&
Oncmp
;
switch
(
m_PadShape
&
0x7F
)
switch
(
m_PadShape
&
0x7F
)
{
{
case
PAD_CIRCLE
:
case
PAD_CIRCLE
:
x
=
xc
*
scale
;
x
=
xc
*
scale
;
y
=
yc
*
scale
;
y
=
yc
*
scale
;
r
=
(
double
)
dx
*
scale
;
r
=
(
double
)
dx
*
scale
;
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
{
{
if
(
layer
&&
(
layer
==
nlmax
)
)
if
(
layer
&&
(
layer
==
nlmax
)
)
layer
=
CMP_N
;
layer
=
CMP_N
;
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
continue
;
continue
;
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
continue
;
continue
;
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
continue
;
continue
;
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
color
=
g_Parm_3D_Visu
.
m_BoardSettings
->
m_LayerColor
[
layer
];
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
continue
;
continue
;
SetGLColor
(
color
);
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
Draw3D_FilledCircle
(
x
,
-
y
,
r
,
hole
,
zpos
);
Draw3D_FilledCircle
(
x
,
-
y
,
r
,
hole
,
zpos
);
}
}
break
;
break
;
case
PAD_OVAL
:
case
PAD_OVAL
:
/* calcul de l'entraxe de l'ellipse */
/* calcul de l'entraxe de l'ellipse */
if
(
dx
>
dy
)
/* ellipse horizontale */
if
(
dx
>
dy
)
/* ellipse horizontale */
{
{
...
@@ -536,20 +556,20 @@ int color;
...
@@ -536,20 +556,20 @@ int color;
w
=
m_Size
.
x
*
scale
;
w
=
m_Size
.
x
*
scale
;
delta_angle
=
angle
;
delta_angle
=
angle
;
}
}
RotatePoint
(
&
delta_cx
,
&
delta_cy
,
angle
);
RotatePoint
(
&
delta_cx
,
&
delta_cy
,
angle
);
{
{
double
ox
,
oy
,
fx
,
fy
;
double
ox
,
oy
,
fx
,
fy
;
ox
=
(
double
)
(
ux0
+
delta_cx
)
*
scale
;
ox
=
(
double
)
(
ux0
+
delta_cx
)
*
scale
;
oy
=
(
double
)
(
uy0
+
delta_cy
)
*
scale
;
oy
=
(
double
)
(
uy0
+
delta_cy
)
*
scale
;
fx
=
(
double
)
(
ux0
-
delta_cx
)
*
scale
;
fx
=
(
double
)
(
ux0
-
delta_cx
)
*
scale
;
fy
=
(
double
)
(
uy0
-
delta_cy
)
*
scale
;
fy
=
(
double
)
(
uy0
-
delta_cy
)
*
scale
;
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
for
(
layer
=
FIRST_COPPER_LAYER
;
layer
<=
LAST_COPPER_LAYER
;
layer
++
)
{
{
if
(
layer
&&
(
layer
==
nlmax
)
)
if
(
layer
&&
(
layer
==
nlmax
)
)
layer
=
CMP_N
;
layer
=
CMP_N
;
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
continue
;
continue
;
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
continue
;
continue
;
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
continue
;
continue
;
...
@@ -557,36 +577,37 @@ int color;
...
@@ -557,36 +577,37 @@ int color;
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
continue
;
continue
;
SetGLColor
(
color
);
SetGLColor
(
color
);
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
Draw3D_FilledSegmentWithHole
(
ox
,
-
oy
,
fx
,
-
fy
,
w
,
drillx
,
-
drilly
,
hole
,
zpos
);
Draw3D_FilledSegmentWithHole
(
ox
,
-
oy
,
fx
,
-
fy
,
w
,
drillx
,
-
drilly
,
hole
,
zpos
);
}
}
}
}
break
;
break
;
case
PAD_RECT
:
case
PAD_RECT
:
// case SPECIAL_PAD:
// case SPECIAL_PAD:
case
PAD_TRAPEZOID
:
case
PAD_TRAPEZOID
:
{
{
int
ddx
,
ddy
;
int
ddx
,
ddy
;
ddx
=
m_DeltaSize
.
x
>>
1
;
ddx
=
m_DeltaSize
.
x
>>
1
;
ddy
=
m_DeltaSize
.
y
>>
1
;
/* demi dim dx et dy */
ddy
=
m_DeltaSize
.
y
>>
1
;
/* demi dim dx et dy */
coord
[
0
][
0
]
=
-
dx
-
ddy
;
coord
[
0
][
0
]
=
-
dx
-
ddy
;
coord
[
0
][
1
]
=
+
dy
+
ddx
;
coord
[
0
][
1
]
=
+
dy
+
ddx
;
coord
[
1
][
0
]
=
-
dx
+
ddy
;
coord
[
1
][
0
]
=
-
dx
+
ddy
;
coord
[
1
][
1
]
=
-
dy
-
ddx
;
coord
[
1
][
1
]
=
-
dy
-
ddx
;
coord
[
2
][
0
]
=
+
dx
-
ddy
;
coord
[
2
][
0
]
=
+
dx
-
ddy
;
coord
[
2
][
1
]
=
-
dy
+
ddx
;
coord
[
2
][
1
]
=
-
dy
+
ddx
;
coord
[
3
][
0
]
=
+
dx
+
ddy
;
coord
[
3
][
0
]
=
+
dx
+
ddy
;
coord
[
3
][
1
]
=
+
dy
-
ddx
;
coord
[
3
][
1
]
=
+
dy
-
ddx
;
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
{
{
RotatePoint
(
&
coord
[
ii
][
0
],
&
coord
[
ii
][
1
],
angle
);
RotatePoint
(
&
coord
[
ii
][
0
],
&
coord
[
ii
][
1
],
angle
);
coord
[
ii
][
0
]
+=
ux0
;
coord
[
ii
][
0
]
+=
ux0
;
coord
[
ii
][
1
]
+=
uy0
;
coord
[
ii
][
1
]
+=
uy0
;
ll
=
ii
*
2
;
ll
=
ii
*
2
;
...
@@ -607,8 +628,8 @@ int color;
...
@@ -607,8 +628,8 @@ int color;
{
{
f_hole_coord
[
ii
][
0
]
=
-
hole
*
0.707
;
f_hole_coord
[
ii
][
0
]
=
-
hole
*
0.707
;
f_hole_coord
[
ii
][
1
]
=
hole
*
0.707
;
f_hole_coord
[
ii
][
1
]
=
hole
*
0.707
;
RotatePoint
(
&
f_hole_coord
[
ii
][
0
],
&
f_hole_coord
[
ii
][
1
],
RotatePoint
(
&
f_hole_coord
[
ii
][
0
],
&
f_hole_coord
[
ii
][
1
],
angle
-
(
ii
*
450
)
);
angle
-
(
ii
*
450
)
);
f_hole_coord
[
ii
][
0
]
+=
drillx
;
f_hole_coord
[
ii
][
0
]
+=
drillx
;
f_hole_coord
[
ii
][
1
]
+=
drilly
;
f_hole_coord
[
ii
][
1
]
+=
drilly
;
}
}
...
@@ -617,9 +638,9 @@ int color;
...
@@ -617,9 +638,9 @@ int color;
{
{
if
(
layer
&&
(
layer
==
nlmax
)
)
if
(
layer
&&
(
layer
==
nlmax
)
)
layer
=
CMP_N
;
layer
=
CMP_N
;
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
if
(
(
layer
==
CMP_N
)
&&
!
Oncmp
)
continue
;
continue
;
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
if
(
(
layer
==
COPPER_LAYER_N
)
&&
!
Oncu
)
continue
;
continue
;
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
if
(
(
layer
>
FIRST_COPPER_LAYER
)
&&
(
layer
<
LAST_COPPER_LAYER
)
&&
!
Both
)
continue
;
continue
;
...
@@ -627,14 +648,15 @@ int color;
...
@@ -627,14 +648,15 @@ int color;
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
glNormal3f
(
0.0
,
0.0
,
(
layer
==
COPPER_LAYER_N
)
?
-
1.0
:
1.0
);
if
(
color
&
ITEM_NOT_SHOW
)
if
(
color
&
ITEM_NOT_SHOW
)
continue
;
continue
;
SetGLColor
(
color
);
SetGLColor
(
color
);
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
zpos
=
g_Parm_3D_Visu
.
m_LayerZcoord
[
layer
];
glBegin
(
GL_QUAD_STRIP
);
glBegin
(
GL_QUAD_STRIP
);
for
(
ii
=
0
;
ii
<
8
;
ii
++
)
for
(
ii
=
0
;
ii
<
8
;
ii
++
)
{
{
glVertex3f
(
f_hole_coord
[
ii
][
0
],
-
f_hole_coord
[
ii
][
1
],
zpos
);
glVertex3f
(
f_hole_coord
[
ii
][
0
],
-
f_hole_coord
[
ii
][
1
],
zpos
);
glVertex3f
(
fcoord
[
ii
][
0
],
-
fcoord
[
ii
][
1
],
zpos
);
glVertex3f
(
fcoord
[
ii
][
0
],
-
fcoord
[
ii
][
1
],
zpos
);
}
}
glVertex3f
(
f_hole_coord
[
0
][
0
],
-
f_hole_coord
[
0
][
1
],
zpos
);
glVertex3f
(
f_hole_coord
[
0
][
0
],
-
f_hole_coord
[
0
][
1
],
zpos
);
glVertex3f
(
fcoord
[
0
][
0
],
-
fcoord
[
0
][
1
],
zpos
);
glVertex3f
(
fcoord
[
0
][
0
],
-
fcoord
[
0
][
1
],
zpos
);
glEnd
();
glEnd
();
...
@@ -649,53 +671,55 @@ int color;
...
@@ -649,53 +671,55 @@ int color;
/*************************/
/*************************/
void
SetGLColor
(
int
color
)
void
SetGLColor
(
int
color
)
/*************************/
/*************************/
{
{
double
red
,
green
,
blue
;
double
red
,
green
,
blue
;
StructColors
colordata
=
ColorRefs
[
color
&
MASKCOLOR
];
StructColors
colordata
=
ColorRefs
[
color
&
MASKCOLOR
];
red
=
colordata
.
m_Red
/
255.0
;
red
=
colordata
.
m_Red
/
255.0
;
blue
=
colordata
.
m_Blue
/
255.0
;
blue
=
colordata
.
m_Blue
/
255.0
;
green
=
colordata
.
m_Green
/
255.0
;
green
=
colordata
.
m_Green
/
255.0
;
glColor3f
(
red
,
green
,
blue
);
glColor3f
(
red
,
green
,
blue
);
}
}
/********************************************************/
/********************************************************/
static
void
Draw3D_FilledCircle
(
double
posx
,
double
posy
,
static
void
Draw3D_FilledCircle
(
double
posx
,
double
posy
,
double
rayon
,
double
hole
,
double
zpos
)
double
rayon
,
double
hole
,
double
zpos
)
/********************************************************/
/********************************************************/
{
{
int
ii
,
slice
=
16
;
int
ii
,
slice
=
16
;
double
x
,
y
;
double
x
,
y
;
glBegin
(
GL_QUAD_STRIP
);
glBegin
(
GL_QUAD_STRIP
);
for
(
ii
=
0
;
ii
<=
slice
;
ii
++
)
for
(
ii
=
0
;
ii
<=
slice
;
ii
++
)
{
{
x
=
hole
;
x
=
hole
;
y
=
0.0
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
ii
*
225
);
RotatePoint
(
&
x
,
&
y
,
ii
*
225
);
glVertex3f
(
x
+
posx
,
y
+
posy
,
zpos
);
glVertex3f
(
x
+
posx
,
y
+
posy
,
zpos
);
x
=
rayon
;
x
=
rayon
;
y
=
0.0
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
ii
*
225
);
RotatePoint
(
&
x
,
&
y
,
ii
*
225
);
glVertex3f
(
x
+
posx
,
y
+
posy
,
zpos
);
glVertex3f
(
x
+
posx
,
y
+
posy
,
zpos
);
}
}
glEnd
();
glEnd
();
}
}
/*********************************************************/
/*********************************************************/
static
void
Draw3D_FilledCylinder
(
double
posx
,
double
posy
,
static
void
Draw3D_FilledCylinder
(
double
posx
,
double
posy
,
double
rayon
,
double
height
,
double
zpos
)
double
rayon
,
double
height
,
double
zpos
)
/*********************************************************/
/*********************************************************/
{
{
int
ii
;
int
ii
;
double
x
,
y
;
double
x
,
y
;
#define NB_SEGM 12
#define NB_SEGM 12
S3D_Vertex
coords
[
4
];
S3D_Vertex
coords
[
4
];
double
tmp
=
DataScale3D
;
double
tmp
=
DataScale3D
;
DataScale3D
=
1.0
;
// les coord sont deja a l'echelle pour Set_Object_Data();
DataScale3D
=
1.0
;
// les coord sont deja a l'echelle pour Set_Object_Data();
coords
[
0
].
x
=
coords
[
1
].
x
=
posx
+
rayon
;
coords
[
0
].
x
=
coords
[
1
].
x
=
posx
+
rayon
;
...
@@ -707,7 +731,7 @@ double tmp = DataScale3D;
...
@@ -707,7 +731,7 @@ double tmp = DataScale3D;
{
{
x
=
rayon
;
x
=
rayon
;
y
=
0.0
;
y
=
0.0
;
RotatePoint
(
&
x
,
&
y
,
ii
*
(
3600
/
NB_SEGM
)
);
RotatePoint
(
&
x
,
&
y
,
ii
*
(
3600
/
NB_SEGM
)
);
coords
[
2
].
x
=
coords
[
3
].
x
=
posx
+
x
;
coords
[
2
].
x
=
coords
[
3
].
x
=
posx
+
x
;
coords
[
2
].
y
=
coords
[
3
].
y
=
posy
+
y
;
coords
[
2
].
y
=
coords
[
3
].
y
=
posy
+
y
;
Set_Object_Data
(
coords
,
4
);
Set_Object_Data
(
coords
,
4
);
...
@@ -716,56 +740,60 @@ double tmp = DataScale3D;
...
@@ -716,56 +740,60 @@ double tmp = DataScale3D;
coords
[
1
].
x
=
coords
[
3
].
x
;
coords
[
1
].
x
=
coords
[
3
].
x
;
coords
[
1
].
y
=
coords
[
3
].
y
;
coords
[
1
].
y
=
coords
[
3
].
y
;
}
}
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
glNormal3f
(
0.0
,
0.0
,
1.0
);
// Normal is Z axis
DataScale3D
=
tmp
;
DataScale3D
=
tmp
;
}
}
/*****************************************************************/
/*****************************************************************/
static
void
Draw3D_FilledSegment
(
double
startx
,
double
starty
,
static
void
Draw3D_FilledSegment
(
double
startx
,
double
starty
,
double
endx
,
double
endy
,
double
width
,
double
zpos
)
double
endx
,
double
endy
,
double
width
,
double
zpos
)
/*****************************************************************/
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds
/* trace un polygone semblable a un segment a bouts ronds
*/
*/
{
{
double
dx
,
dy
,
x
,
y
,
firstx
=
0
,
firsty
=
0
;
double
dx
,
dy
,
x
,
y
,
firstx
=
0
,
firsty
=
0
;
int
ii
,
angle
;
int
ii
,
angle
;
// on va calculer les coordonnes du segment suppos horizontal,
// on va calculer les coordonnes du segment suppos horizontal,
// puis tourner les cordonnes de l'angle voulu
// puis tourner les cordonnes de l'angle voulu
dx
=
endx
-
startx
;
dx
=
endx
-
startx
;
dy
=
endy
-
starty
;
dy
=
endy
-
starty
;
angle
=
(
int
)(
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
)
+
0.5
);
angle
=
(
int
)
(
(
atan2
(
dy
,
dx
)
*
1800
/
M_PI
)
+
0.5
);
RotatePoint
(
&
dx
,
&
dy
,
angle
);
// apres rotation: dx = longueur du segment
RotatePoint
(
&
dx
,
&
dy
,
angle
);
// apres rotation: dx = longueur du segment
// dy = 0;
// dy = 0;
width
/=
2
;
width
/=
2
;
glBegin
(
GL_POLYGON
);
glBegin
(
GL_POLYGON
);
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
{
{
x
=
0.0
;
x
=
0.0
;
y
=
-
width
;
y
=
-
width
;
RotatePoint
(
&
x
,
&
y
,
-
ii
*
225
);
RotatePoint
(
&
x
,
&
y
,
-
ii
*
225
);
x
+=
dx
;
x
+=
dx
;
RotatePoint
(
&
x
,
&
y
,
-
angle
);
RotatePoint
(
&
x
,
&
y
,
-
angle
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
if
(
ii
==
0
)
if
(
ii
==
0
)
{
{
firstx
=
startx
+
x
;
firstx
=
startx
+
x
;
firsty
=
starty
+
y
;
firsty
=
starty
+
y
;
}
}
}
}
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
{
{
int
jj
=
ii
*
225
;
int
jj
=
ii
*
225
;
x
=
0.0
;
x
=
0.0
;
y
=
width
;
y
=
width
;
RotatePoint
(
&
x
,
&
y
,
-
angle
-
jj
);
RotatePoint
(
&
x
,
&
y
,
-
angle
-
jj
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
}
}
glVertex3f
(
firstx
,
firsty
,
zpos
);
glVertex3f
(
firstx
,
firsty
,
zpos
);
...
@@ -774,16 +802,23 @@ int ii, angle;
...
@@ -774,16 +802,23 @@ int ii, angle;
/*****************************************************************/
/*****************************************************************/
static
void
Draw3D_FilledSegmentWithHole
(
double
startx
,
double
starty
,
static
void
Draw3D_FilledSegmentWithHole
(
double
startx
,
double
endx
,
double
endy
,
double
width
,
double
starty
,
double
holex
,
double
holey
,
double
holeradius
,
double
zpos
)
double
endx
,
double
endy
,
double
width
,
double
holex
,
double
holey
,
double
holeradius
,
double
zpos
)
/*****************************************************************/
/*****************************************************************/
/* trace un polygone semblable a un segment a bouts ronds avec trou
/* trace un polygone semblable a un segment a bouts ronds avec trou
*/
*/
{
{
double
x
,
y
,
xin
,
yin
;
double
x
,
y
,
xin
,
yin
;
double
firstx
=
0
,
firsty
=
0
,
firstxin
=
0
,
firstyin
=
0
;
double
firstx
=
0
,
firsty
=
0
,
firstxin
=
0
,
firstyin
=
0
;
int
ii
,
angle
,
theta
;
int
ii
,
angle
,
theta
;
// on va calculer les coordonnes du segment suppos horizontal,
// on va calculer les coordonnes du segment suppos horizontal,
// puis tourner les cordonnes de l'angle voulu
// puis tourner les cordonnes de l'angle voulu
...
@@ -793,14 +828,15 @@ int ii, angle, theta;
...
@@ -793,14 +828,15 @@ int ii, angle, theta;
endy
-=
starty
;
endy
-=
starty
;
holex
-=
startx
;
holex
-=
startx
;
holey
-=
starty
;
holey
-=
starty
;
angle
=
(
int
)(
(
atan2
(
endy
,
endx
)
*
1800
/
M_PI
)
+
0.5
);
angle
=
(
int
)
(
(
atan2
(
endy
,
endx
)
*
1800
/
M_PI
)
+
0.5
);
RotatePoint
(
&
endx
,
&
endy
,
angle
);
// apres rotation: endx = longueur du segment
RotatePoint
(
&
endx
,
&
endy
,
angle
);
// apres rotation: endx = longueur du segment
// endy = 0;
// endy = 0;
RotatePoint
(
&
holex
,
&
holey
,
angle
);
RotatePoint
(
&
holex
,
&
holey
,
angle
);
width
/=
2
;
width
/=
2
;
glBegin
(
GL_QUAD_STRIP
);
glBegin
(
GL_QUAD_STRIP
);
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
// trac de l'arrondi a droite (1er demi polygone a la fin du segment)
// autour du demi-trou de percage
// autour du demi-trou de percage
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
...
@@ -810,14 +846,14 @@ int ii, angle, theta;
...
@@ -810,14 +846,14 @@ int ii, angle, theta;
xin
=
0.0
;
xin
=
0.0
;
yin
=
-
holeradius
;
yin
=
-
holeradius
;
theta
=
-
ii
*
225
;
theta
=
-
ii
*
225
;
RotatePoint
(
&
x
,
&
y
,
theta
);
RotatePoint
(
&
x
,
&
y
,
theta
);
RotatePoint
(
&
xin
,
&
yin
,
theta
);
RotatePoint
(
&
xin
,
&
yin
,
theta
);
x
+=
endx
;
x
+=
endx
;
RotatePoint
(
&
x
,
&
y
,
-
angle
);
RotatePoint
(
&
x
,
&
y
,
-
angle
);
xin
+=
holex
;
xin
+=
holex
;
RotatePoint
(
&
xin
,
&
yin
,
-
angle
);
RotatePoint
(
&
xin
,
&
yin
,
-
angle
);
glVertex3f
(
startx
+
xin
,
starty
+
yin
,
zpos
);
glVertex3f
(
startx
+
xin
,
starty
+
yin
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
if
(
ii
==
0
)
// Memorisation du point de dpart du trac
if
(
ii
==
0
)
// Memorisation du point de dpart du trac
{
{
firstx
=
startx
+
x
;
firstx
=
startx
+
x
;
...
@@ -826,19 +862,20 @@ int ii, angle, theta;
...
@@ -826,19 +862,20 @@ int ii, angle, theta;
firstyin
=
starty
+
yin
;
firstyin
=
starty
+
yin
;
}
}
}
}
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
// trac de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
for
(
ii
=
0
;
ii
<=
8
;
ii
++
)
{
{
theta
=
-
ii
*
225
;
theta
=
-
ii
*
225
;
x
=
0.0
;
x
=
0.0
;
y
=
width
;
y
=
width
;
RotatePoint
(
&
x
,
&
y
,
-
angle
+
theta
);
RotatePoint
(
&
x
,
&
y
,
-
angle
+
theta
);
xin
=
0.0
;
xin
=
0.0
;
yin
=
holeradius
;
yin
=
holeradius
;
RotatePoint
(
&
xin
,
&
yin
,
theta
);
RotatePoint
(
&
xin
,
&
yin
,
theta
);
xin
+=
holex
;
xin
+=
holex
;
RotatePoint
(
&
xin
,
&
yin
,
-
angle
);
RotatePoint
(
&
xin
,
&
yin
,
-
angle
);
glVertex3f
(
startx
+
xin
,
starty
+
yin
,
zpos
);
glVertex3f
(
startx
+
xin
,
starty
+
yin
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
glVertex3f
(
startx
+
x
,
starty
+
y
,
zpos
);
}
}
...
...
change_log.txt
View file @
7c482f68
...
@@ -5,6 +5,12 @@ Started 2007-June-11
...
@@ -5,6 +5,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2008-mars-03 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
3d display:
Added Jonas Diemer's patch (enhanced movings from mouse and tools)
2008-Mar-1 UPDATE Dick Hollenbeck <dick@softplc.com>
2008-Mar-1 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
+pcbnew
+pcbnew
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment