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
4c20fb4c
Commit
4c20fb4c
authored
Aug 21, 2014
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3d-viewer: code cleaning.
parent
5e032ef0
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
265 additions
and
243 deletions
+265
-243
3d_canvas.cpp
3d-viewer/3d_canvas.cpp
+54
-79
3d_canvas.h
3d-viewer/3d_canvas.h
+6
-3
3d_draw_basic_functions.cpp
3d-viewer/3d_draw_basic_functions.cpp
+6
-7
3d_draw_helper_functions.cpp
3d-viewer/3d_draw_helper_functions.cpp
+1
-1
3d_frame.cpp
3d-viewer/3d_frame.cpp
+70
-56
3d_material.cpp
3d-viewer/3d_material.cpp
+24
-24
3d_material.h
3d-viewer/3d_material.h
+7
-1
3d_mesh_model.cpp
3d-viewer/3d_mesh_model.cpp
+10
-5
3d_read_mesh.cpp
3d-viewer/3d_read_mesh.cpp
+1
-1
3d_toolbar.cpp
3d-viewer/3d_toolbar.cpp
+23
-23
3d_viewer.h
3d-viewer/3d_viewer.h
+17
-2
info3d_visu.cpp
3d-viewer/info3d_visu.cpp
+7
-6
info3d_visu.h
3d-viewer/info3d_visu.h
+9
-10
modelparsers.h
3d-viewer/modelparsers.h
+14
-7
vrml_v1_modelparser.cpp
3d-viewer/vrml_v1_modelparser.cpp
+4
-7
vrml_v2_modelparser.cpp
3d-viewer/vrml_v2_modelparser.cpp
+3
-3
vrmlmodelparser.cpp
3d-viewer/vrmlmodelparser.cpp
+5
-5
x3dmodelparser.cpp
3d-viewer/x3dmodelparser.cpp
+2
-2
export_vrml.cpp
pcbnew/exporters/export_vrml.cpp
+2
-1
No files found.
3d-viewer/3d_canvas.cpp
View file @
4c20fb4c
...
@@ -161,7 +161,7 @@ void EDA_3D_CANVAS::OnChar( wxKeyEvent& event )
...
@@ -161,7 +161,7 @@ void EDA_3D_CANVAS::OnChar( wxKeyEvent& event )
void
EDA_3D_CANVAS
::
SetView3D
(
int
keycode
)
void
EDA_3D_CANVAS
::
SetView3D
(
int
keycode
)
{
{
int
ii
;
int
ii
;
double
delta_move
=
0.7
*
g_Parm_3D_Visu
.
m_Zoom
;
double
delta_move
=
0.7
*
GetPrm3DVisu
()
.
m_Zoom
;
switch
(
keycode
)
switch
(
keycode
)
{
{
...
@@ -182,22 +182,22 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
...
@@ -182,22 +182,22 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
break
;
break
;
case
WXK_HOME
:
case
WXK_HOME
:
g_Parm_3D_Visu
.
m_Zoom
=
1.0
;
GetPrm3DVisu
()
.
m_Zoom
=
1.0
;
m_draw3dOffset
.
x
=
m_draw3dOffset
.
y
=
0
;
m_draw3dOffset
.
x
=
m_draw3dOffset
.
y
=
0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
break
;
break
;
case
WXK_END
:
case
WXK_END
:
break
;
break
;
case
WXK_F1
:
case
WXK_F1
:
g_Parm_3D_Visu
.
m_Zoom
/=
1.4
;
GetPrm3DVisu
()
.
m_Zoom
/=
1.4
;
if
(
g_Parm_3D_Visu
.
m_Zoom
<=
0.01
)
if
(
GetPrm3DVisu
()
.
m_Zoom
<=
0.01
)
g_Parm_3D_Visu
.
m_Zoom
=
0.01
;
GetPrm3DVisu
()
.
m_Zoom
=
0.01
;
break
;
break
;
case
WXK_F2
:
case
WXK_F2
:
g_Parm_3D_Visu
.
m_Zoom
*=
1.4
;
GetPrm3DVisu
()
.
m_Zoom
*=
1.4
;
break
;
break
;
case
'+'
:
case
'+'
:
...
@@ -210,59 +210,59 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
...
@@ -210,59 +210,59 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
case
'R'
:
case
'R'
:
m_draw3dOffset
.
x
=
m_draw3dOffset
.
y
=
0
;
m_draw3dOffset
.
x
=
m_draw3dOffset
.
y
=
0
;
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
break
;
break
;
case
'x'
:
case
'x'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
g_Parm_3D_Visu
.
m_ROTZ
=
-
90
;
GetPrm3DVisu
()
.
m_ROTZ
=
-
90
;
g_Parm_3D_Visu
.
m_ROTX
=
-
90
;
GetPrm3DVisu
()
.
m_ROTX
=
-
90
;
break
;
break
;
case
'X'
:
case
'X'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
g_Parm_3D_Visu
.
m_ROTZ
=
90
;
GetPrm3DVisu
()
.
m_ROTZ
=
90
;
g_Parm_3D_Visu
.
m_ROTX
=
-
90
;
GetPrm3DVisu
()
.
m_ROTX
=
-
90
;
break
;
break
;
case
'y'
:
case
'y'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
g_Parm_3D_Visu
.
m_ROTX
=
-
90
;
GetPrm3DVisu
()
.
m_ROTX
=
-
90
;
break
;
break
;
case
'Y'
:
case
'Y'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
g_Parm_3D_Visu
.
m_ROTX
=
-
90
;
GetPrm3DVisu
()
.
m_ROTX
=
-
90
;
g_Parm_3D_Visu
.
m_ROTZ
=
-
180
;
GetPrm3DVisu
()
.
m_ROTZ
=
-
180
;
break
;
break
;
case
'z'
:
case
'z'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
break
;
break
;
case
'Z'
:
case
'Z'
:
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
g_Parm_3D_Visu
.
m_Rot
[
ii
]
=
0.0
;
GetPrm3DVisu
()
.
m_Rot
[
ii
]
=
0.0
;
trackball
(
g_Parm_3D_Visu
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
trackball
(
GetPrm3DVisu
()
.
m_Quat
,
0.0
,
0.0
,
0.0
,
0.0
);
g_Parm_3D_Visu
.
m_ROTX
=
-
180
;
GetPrm3DVisu
()
.
m_ROTX
=
-
180
;
break
;
break
;
default
:
default
:
...
@@ -279,47 +279,35 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
...
@@ -279,47 +279,35 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
if
(
event
.
ShiftDown
()
)
if
(
event
.
ShiftDown
()
)
{
{
if
(
event
.
GetWheelRotation
()
<
0
)
if
(
event
.
GetWheelRotation
()
<
0
)
{
SetView3D
(
WXK_UP
);
// move up
/* up */
SetView3D
(
WXK_UP
);
}
else
else
{
SetView3D
(
WXK_DOWN
);
// move down
/* down */
SetView3D
(
WXK_DOWN
);
}
}
}
else
if
(
event
.
ControlDown
()
)
else
if
(
event
.
ControlDown
()
)
{
{
if
(
event
.
GetWheelRotation
()
>
0
)
if
(
event
.
GetWheelRotation
()
>
0
)
{
SetView3D
(
WXK_RIGHT
);
// move right
/* right */
SetView3D
(
WXK_RIGHT
);
}
else
else
{
SetView3D
(
WXK_LEFT
);
// move left
/* left */
SetView3D
(
WXK_LEFT
);
}
}
}
else
else
{
{
if
(
event
.
GetWheelRotation
()
>
0
)
if
(
event
.
GetWheelRotation
()
>
0
)
{
{
g_Parm_3D_Visu
.
m_Zoom
/=
1.4
;
GetPrm3DVisu
()
.
m_Zoom
/=
1.4
;
if
(
g_Parm_3D_Visu
.
m_Zoom
<=
0.01
)
if
(
GetPrm3DVisu
()
.
m_Zoom
<=
0.01
)
g_Parm_3D_Visu
.
m_Zoom
=
0.01
;
GetPrm3DVisu
()
.
m_Zoom
=
0.01
;
}
}
else
else
g_Parm_3D_Visu
.
m_Zoom
*=
1.4
;
GetPrm3DVisu
()
.
m_Zoom
*=
1.4
;
DisplayStatus
();
DisplayStatus
();
Refresh
(
false
);
Refresh
(
false
);
}
}
g_Parm_3D_Visu
.
m_Beginx
=
event
.
GetX
();
GetPrm3DVisu
()
.
m_Beginx
=
event
.
GetX
();
g_Parm_3D_Visu
.
m_Beginy
=
event
.
GetY
();
GetPrm3DVisu
()
.
m_Beginy
=
event
.
GetY
();
}
}
...
@@ -334,12 +322,12 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
...
@@ -334,12 +322,12 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
{
{
/* drag in progress, simulate trackball */
/* drag in progress, simulate trackball */
trackball
(
spin_quat
,
trackball
(
spin_quat
,
(
2.0
*
g_Parm_3D_Visu
.
m_Beginx
-
size
.
x
)
/
size
.
x
,
(
2.0
*
GetPrm3DVisu
()
.
m_Beginx
-
size
.
x
)
/
size
.
x
,
(
size
.
y
-
2.0
*
g_Parm_3D_Visu
.
m_Beginy
)
/
size
.
y
,
(
size
.
y
-
2.0
*
GetPrm3DVisu
()
.
m_Beginy
)
/
size
.
y
,
(
2.0
*
event
.
GetX
()
-
size
.
x
)
/
size
.
x
,
(
2.0
*
event
.
GetX
()
-
size
.
x
)
/
size
.
x
,
(
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
,
GetPrm3DVisu
().
m_Quat
,
GetPrm3DVisu
()
.
m_Quat
);
}
}
else
if
(
event
.
MiddleIsDown
()
)
else
if
(
event
.
MiddleIsDown
()
)
{
{
...
@@ -347,11 +335,11 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
...
@@ -347,11 +335,11 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
/* Current zoom and an additional factor are taken into account
/* Current zoom and an additional factor are taken into account
* for the amount of panning. */
* for the amount of panning. */
const
double
PAN_FACTOR
=
8.0
*
g_Parm_3D_Visu
.
m_Zoom
;
const
double
PAN_FACTOR
=
8.0
*
GetPrm3DVisu
()
.
m_Zoom
;
m_draw3dOffset
.
x
-=
PAN_FACTOR
*
m_draw3dOffset
.
x
-=
PAN_FACTOR
*
(
g_Parm_3D_Visu
.
m_Beginx
-
event
.
GetX
()
)
/
size
.
x
;
(
GetPrm3DVisu
()
.
m_Beginx
-
event
.
GetX
()
)
/
size
.
x
;
m_draw3dOffset
.
y
-=
PAN_FACTOR
*
m_draw3dOffset
.
y
-=
PAN_FACTOR
*
(
event
.
GetY
()
-
g_Parm_3D_Visu
.
m_Beginy
)
/
size
.
y
;
(
event
.
GetY
()
-
GetPrm3DVisu
()
.
m_Beginy
)
/
size
.
y
;
}
}
/* orientation has changed, redraw mesh */
/* orientation has changed, redraw mesh */
...
@@ -359,8 +347,8 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
...
@@ -359,8 +347,8 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
Refresh
(
false
);
Refresh
(
false
);
}
}
g_Parm_3D_Visu
.
m_Beginx
=
event
.
GetX
();
GetPrm3DVisu
()
.
m_Beginx
=
event
.
GetX
();
g_Parm_3D_Visu
.
m_Beginy
=
event
.
GetY
();
GetPrm3DVisu
()
.
m_Beginy
=
event
.
GetY
();
}
}
...
@@ -502,7 +490,7 @@ void EDA_3D_CANVAS::DisplayStatus()
...
@@ -502,7 +490,7 @@ void EDA_3D_CANVAS::DisplayStatus()
msg
.
Printf
(
wxT
(
"dy %3.2f"
),
m_draw3dOffset
.
y
);
msg
.
Printf
(
wxT
(
"dy %3.2f"
),
m_draw3dOffset
.
y
);
Parent
()
->
SetStatusText
(
msg
,
2
);
Parent
()
->
SetStatusText
(
msg
,
2
);
msg
.
Printf
(
wxT
(
"View: %3.1f"
),
45
*
g_Parm_3D_Visu
.
m_Zoom
);
msg
.
Printf
(
wxT
(
"View: %3.1f"
),
45
*
GetPrm3DVisu
()
.
m_Zoom
);
Parent
()
->
SetStatusText
(
msg
,
3
);
Parent
()
->
SetStatusText
(
msg
,
3
);
}
}
...
@@ -539,7 +527,8 @@ GLuint load_and_generate_texture( tsImage *image )
...
@@ -539,7 +527,8 @@ GLuint load_and_generate_texture( tsImage *image )
glGenTextures
(
1
,
&
texture
);
glGenTextures
(
1
,
&
texture
);
glBindTexture
(
GL_TEXTURE_2D
,
texture
);
glBindTexture
(
GL_TEXTURE_2D
,
texture
);
gluBuild2DMipmaps
(
GL_TEXTURE_2D
,
GL_RGBA
,
image
->
width
,
image
->
height
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
image
->
pixel_data
);
gluBuild2DMipmaps
(
GL_TEXTURE_2D
,
GL_RGBA
,
image
->
width
,
image
->
height
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
image
->
pixel_data
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR_MIPMAP_LINEAR
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_MIN_FILTER
,
GL_LINEAR_MIPMAP_LINEAR
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
glTexParameterf
(
GL_TEXTURE_2D
,
GL_TEXTURE_MAG_FILTER
,
GL_LINEAR
);
...
@@ -561,7 +550,7 @@ void EDA_3D_CANVAS::InitGL()
...
@@ -561,7 +550,7 @@ void EDA_3D_CANVAS::InitGL()
m_text_pcb
=
load_and_generate_texture
(
(
tsImage
*
)
&
text_pcb
);
m_text_pcb
=
load_and_generate_texture
(
(
tsImage
*
)
&
text_pcb
);
m_text_silk
=
load_and_generate_texture
(
(
tsImage
*
)
&
text_silk
);
m_text_silk
=
load_and_generate_texture
(
(
tsImage
*
)
&
text_silk
);
g_Parm_3D_Visu
.
m_Zoom
=
1.0
;
GetPrm3DVisu
()
.
m_Zoom
=
1.0
;
m_ZBottom
=
1.0
;
m_ZBottom
=
1.0
;
m_ZTop
=
10.0
;
m_ZTop
=
10.0
;
...
@@ -590,12 +579,8 @@ void EDA_3D_CANVAS::InitGL()
...
@@ -590,12 +579,8 @@ void EDA_3D_CANVAS::InitGL()
/* Initialize OpenGL light sources. */
/* Initialize OpenGL light sources. */
void
EDA_3D_CANVAS
::
SetLights
()
void
EDA_3D_CANVAS
::
SetLights
()
{
{
/* set viewing projection */
// activate light. the source is above the xy plane, at source_pos
GLfloat
Z_axis_pos
[
4
]
=
{
0.0
,
0.0
,
30.0
,
0.0
};
GLfloat
source_pos
[
4
]
=
{
0.0
,
0.0
,
30.0
,
0.0
};
// GLfloat lowZ_axis_pos[4] = { 0.0, 0.0, -30.0, 0.5 };
// activate lights. 2 lights are used:
// One is above the xy plane, the other is below the xy plane
GLfloat
light_color
[
4
];
// color of lights (RGBA values)
GLfloat
light_color
[
4
];
// color of lights (RGBA values)
light_color
[
3
]
=
1.0
;
light_color
[
3
]
=
1.0
;
...
@@ -609,22 +594,12 @@ void EDA_3D_CANVAS::SetLights()
...
@@ -609,22 +594,12 @@ void EDA_3D_CANVAS::SetLights()
light_color
[
0
]
=
light_color
[
1
]
=
light_color
[
2
]
=
1.0
;
light_color
[
0
]
=
light_color
[
1
]
=
light_color
[
2
]
=
1.0
;
glLightfv
(
GL_LIGHT0
,
GL_SPECULAR
,
light_color
);
glLightfv
(
GL_LIGHT0
,
GL_SPECULAR
,
light_color
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
Z_axis
_pos
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
source
_pos
);
light_color
[
0
]
=
light_color
[
1
]
=
light_color
[
2
]
=
0.1
;
light_color
[
0
]
=
light_color
[
1
]
=
light_color
[
2
]
=
0.1
;
glLightModelfv
(
GL_LIGHT_MODEL_AMBIENT
,
light_color
);
glLightModelfv
(
GL_LIGHT_MODEL_AMBIENT
,
light_color
);
/*
// Light below the xy plane
glLightfv( GL_LIGHT1, GL_POSITION, lowZ_axis_pos );
light_color[0] = light_color[1] = light_color[2] = 0.4;
glLightfv( GL_LIGHT1, GL_DIFFUSE, light_color );
light_color[0] = light_color[1] = light_color[2] = 0.1;
glLightfv( GL_LIGHT1, GL_SPECULAR, light_color );
*/
glEnable
(
GL_LIGHT0
);
// White spot on Z axis ( top )
glEnable
(
GL_LIGHT0
);
// White spot on Z axis ( top )
glDisable
(
GL_LIGHT1
);
// White spot on Z axis ( bottom )
glEnable
(
GL_LIGHTING
);
glEnable
(
GL_LIGHTING
);
}
}
...
...
3d-viewer/3d_canvas.h
View file @
4c20fb4c
...
@@ -64,12 +64,12 @@ enum GL_LIST_ID
...
@@ -64,12 +64,12 @@ enum GL_LIST_ID
GL_ID_AUX_LAYERS
,
// List id for user layers (draw, eco, comment)
GL_ID_AUX_LAYERS
,
// List id for user layers (draw, eco, comment)
GL_ID_3DSHAPES_SOLID_FRONT
,
// List id for 3D shapes, non transparent entities
GL_ID_3DSHAPES_SOLID_FRONT
,
// List id for 3D shapes, non transparent entities
GL_ID_3DSHAPES_TRANSP_FRONT
,
// List id for 3D shapes, transparent entities
GL_ID_3DSHAPES_TRANSP_FRONT
,
// List id for 3D shapes, transparent entities
GL_ID_3DSHAPES_SOLID_BACK
,
// List id for 3D shapes, non transparent entities
GL_ID_3DSHAPES_SOLID_BACK
,
// List id for 3D shapes, non transparent entities
GL_ID_3DSHAPES_TRANSP_BACK
,
// List id for 3D shapes, transparent entities
GL_ID_3DSHAPES_TRANSP_BACK
,
// List id for 3D shapes, transparent entities
GL_ID_SHADOW_FRONT
,
GL_ID_SHADOW_FRONT
,
GL_ID_SHADOW_BACK
,
GL_ID_SHADOW_BACK
,
GL_ID_SHADOW_BOARD
,
GL_ID_SHADOW_BOARD
,
GL_ID_BODY
,
// Body only list
GL_ID_BODY
,
// Body only list
GL_ID_END
GL_ID_END
};
};
...
@@ -142,6 +142,9 @@ public:
...
@@ -142,6 +142,9 @@ public:
m_draw3dOffset
.
y
=
aPosY
;
m_draw3dOffset
.
y
=
aPosY
;
}
}
/** @return the INFO3D_VISU which contains the current parameters
* to draw the 3D view og the board
*/
INFO3D_VISU
&
GetPrm3DVisu
()
const
;
INFO3D_VISU
&
GetPrm3DVisu
()
const
;
...
...
3d-viewer/3d_draw_basic_functions.cpp
View file @
4c20fb4c
...
@@ -121,12 +121,11 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
...
@@ -121,12 +121,11 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
void
SetGLColor
(
EDA_COLOR_T
color
,
double
alpha
)
void
SetGLColor
(
EDA_COLOR_T
color
,
double
alpha
)
{
{
double
red
,
green
,
blue
;
const
StructColors
&
colordata
=
g_ColorRefs
[
ColorGetBase
(
color
)];
const
StructColors
&
colordata
=
g_ColorRefs
[
ColorGetBase
(
color
)];
red
=
colordata
.
m_Red
/
255.0
;
double
red
=
colordata
.
m_Red
/
255.0
;
blue
=
colordata
.
m_Blue
/
255.0
;
double
blue
=
colordata
.
m_Blue
/
255.0
;
green
=
colordata
.
m_Green
/
255.0
;
double
green
=
colordata
.
m_Green
/
255.0
;
glColor4f
(
red
,
green
,
blue
,
alpha
);
glColor4f
(
red
,
green
,
blue
,
alpha
);
}
}
...
@@ -170,7 +169,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
...
@@ -170,7 +169,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
g_Parm_3D_Visu
.
m_CurrentZpos
=
zpos
;
g_Parm_3D_Visu
.
m_CurrentZpos
=
zpos
;
v_data
[
2
]
=
aZpos
+
(
aThickness
/
2.0
);
v_data
[
2
]
=
aZpos
+
(
aThickness
/
2.0
);
// Set normal to
toward positive Z axis, for a solid object only (to draw the top side)
// Set normal to
ward positive Z axis, for a solid object on the top side
if
(
aThickness
)
if
(
aThickness
)
SetNormalZpos
();
SetNormalZpos
();
...
@@ -222,7 +221,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
...
@@ -222,7 +221,7 @@ void Draw3D_SolidHorizontalPolyPolygons( const CPOLYGONS_LIST& aPolysList,
zpos
=
(
aZpos
-
(
aThickness
/
2.0
)
)
*
aBiuTo3DUnits
;
zpos
=
(
aZpos
-
(
aThickness
/
2.0
)
)
*
aBiuTo3DUnits
;
g_Parm_3D_Visu
.
m_CurrentZpos
=
zpos
;
g_Parm_3D_Visu
.
m_CurrentZpos
=
zpos
;
v_data
[
2
]
=
zpos
;
v_data
[
2
]
=
zpos
;
//
Now;, set normal to toward negative Z axis, for the solid object
bottom side
//
Set normal toward negative Z axis, for a solid object on
bottom side
SetNormalZneg
();
SetNormalZneg
();
}
}
...
@@ -432,7 +431,7 @@ void CALLBACK tessCPolyPt2Vertex( const GLvoid* data )
...
@@ -432,7 +431,7 @@ void CALLBACK tessCPolyPt2Vertex( const GLvoid* data )
if
(
g_Parm_3D_Visu
.
IsRealisticMode
()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_TEXTURES
)
)
if
(
g_Parm_3D_Visu
.
IsRealisticMode
()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_TEXTURES
)
)
{
{
glTexCoord2f
(
ptr
->
x
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
m_texture_scale
,
glTexCoord2f
(
ptr
->
x
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
m_texture_scale
,
-
ptr
->
y
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
m_texture_scale
);
-
ptr
->
y
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
m_texture_scale
);
}
}
glVertex3d
(
ptr
->
x
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
,
glVertex3d
(
ptr
->
x
*
g_Parm_3D_Visu
.
m_BiuTo3Dunits
,
...
...
3d-viewer/3d_draw_helper_functions.cpp
View file @
4c20fb4c
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
INFO3D_VISU
&
EDA_3D_CANVAS
::
GetPrm3DVisu
()
const
INFO3D_VISU
&
EDA_3D_CANVAS
::
GetPrm3DVisu
()
const
{
{
return
g_Parm_3D_Visu
;
return
Parent
()
->
GetPrm3DVisu
()
;
}
}
wxSize
EDA_3D_CANVAS
::
getBoardSize
()
const
wxSize
EDA_3D_CANVAS
::
getBoardSize
()
const
...
...
3d-viewer/3d_frame.cpp
View file @
4c20fb4c
This diff is collapsed.
Click to expand it.
3d-viewer/3d_material.cpp
View file @
4c20fb4c
...
@@ -71,77 +71,77 @@ void SetOpenGlDefaultMaterial()
...
@@ -71,77 +71,77 @@ void SetOpenGlDefaultMaterial()
}
}
void
S3D_MATERIAL
::
SetOpenGLMaterial
(
unsigned
int
materialIndex
)
void
S3D_MATERIAL
::
SetOpenGLMaterial
(
unsigned
int
aMaterialIndex
,
bool
aUseMaterial
)
{
{
S3D_MASTER
*
s3dParent
=
(
S3D_MASTER
*
)
GetParent
();
S3D_MASTER
*
s3dParent
=
(
S3D_MASTER
*
)
GetParent
();
if
(
!
s3dParent
->
IsOpenGlAllowed
()
)
if
(
!
s3dParent
->
IsOpenGlAllowed
()
)
return
;
return
;
if
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_MATERIAL
)
)
if
(
aUseMaterial
)
{
{
float
transparency_value
=
0.0
f
;
float
transparency_value
=
0.0
f
;
if
(
m_Transparency
.
size
()
>
m
aterialIndex
)
if
(
m_Transparency
.
size
()
>
aM
aterialIndex
)
{
{
transparency_value
=
m_Transparency
[
m
aterialIndex
];
transparency_value
=
m_Transparency
[
aM
aterialIndex
];
s3dParent
->
SetLastTransparency
(
transparency_value
);
s3dParent
->
SetLastTransparency
(
transparency_value
);
}
}
if
(
m_DiffuseColor
.
size
()
>
materialIndex
)
if
(
m_DiffuseColor
.
size
()
>
aMaterialIndex
)
{
{
glm
::
vec3
color
=
m_DiffuseColor
[
m
aterialIndex
];
glm
::
vec3
color
=
m_DiffuseColor
[
aM
aterialIndex
];
if
(
m_AmbientColor
.
size
()
==
0
)
if
(
m_AmbientColor
.
size
()
==
0
)
{
{
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
}
}
glColor4f
(
color
.
x
,
color
.
y
,
color
.
z
,
1.0
-
transparency_value
);
glColor4f
(
color
.
x
,
color
.
y
,
color
.
z
,
1.0
-
transparency_value
);
}
}
if
(
m_Shininess
.
size
()
>
m
aterialIndex
)
if
(
m_Shininess
.
size
()
>
aM
aterialIndex
)
{
{
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
m_Shininess
[
m
aterialIndex
]
);
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
m_Shininess
[
aM
aterialIndex
]
);
}
}
// emissive
// emissive
if
(
m_EmissiveColor
.
size
()
>
m
aterialIndex
)
if
(
m_EmissiveColor
.
size
()
>
aM
aterialIndex
)
{
{
glm
::
vec4
emissive
;
glm
::
vec4
emissive
;
emissive
[
0
]
=
m_EmissiveColor
[
m
aterialIndex
].
x
;
emissive
[
0
]
=
m_EmissiveColor
[
aM
aterialIndex
].
x
;
emissive
[
1
]
=
m_EmissiveColor
[
m
aterialIndex
].
y
;
emissive
[
1
]
=
m_EmissiveColor
[
aM
aterialIndex
].
y
;
emissive
[
2
]
=
m_EmissiveColor
[
m
aterialIndex
].
z
;
emissive
[
2
]
=
m_EmissiveColor
[
aM
aterialIndex
].
z
;
emissive
[
3
]
=
1.0
f
;
emissive
[
3
]
=
1.0
f
;
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
&
emissive
.
x
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
&
emissive
.
x
);
}
}
// specular
// specular
if
(
m_SpecularColor
.
size
()
>
m
aterialIndex
)
if
(
m_SpecularColor
.
size
()
>
aM
aterialIndex
)
{
{
glm
::
vec4
specular
;
glm
::
vec4
specular
;
specular
[
0
]
=
m_SpecularColor
[
m
aterialIndex
].
x
;
specular
[
0
]
=
m_SpecularColor
[
aM
aterialIndex
].
x
;
specular
[
1
]
=
m_SpecularColor
[
m
aterialIndex
].
y
;
specular
[
1
]
=
m_SpecularColor
[
aM
aterialIndex
].
y
;
specular
[
2
]
=
m_SpecularColor
[
m
aterialIndex
].
z
;
specular
[
2
]
=
m_SpecularColor
[
aM
aterialIndex
].
z
;
specular
[
3
]
=
1.0
f
;
specular
[
3
]
=
1.0
f
;
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
&
specular
.
x
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
&
specular
.
x
);
}
}
// ambient
// ambient
if
(
m_AmbientColor
.
size
()
>
m
aterialIndex
)
if
(
m_AmbientColor
.
size
()
>
aM
aterialIndex
)
{
{
glm
::
vec4
ambient
;
glm
::
vec4
ambient
;
ambient
[
0
]
=
m_AmbientColor
[
m
aterialIndex
].
x
;
ambient
[
0
]
=
m_AmbientColor
[
aM
aterialIndex
].
x
;
ambient
[
1
]
=
m_AmbientColor
[
m
aterialIndex
].
y
;
ambient
[
1
]
=
m_AmbientColor
[
aM
aterialIndex
].
y
;
ambient
[
2
]
=
m_AmbientColor
[
m
aterialIndex
].
z
;
ambient
[
2
]
=
m_AmbientColor
[
aM
aterialIndex
].
z
;
ambient
[
3
]
=
1.0
f
;
ambient
[
3
]
=
1.0
f
;
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
&
ambient
.
x
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
&
ambient
.
x
);
}
}
}
}
else
else
{
{
if
(
m_DiffuseColor
.
size
()
>
materialIndex
)
if
(
m_DiffuseColor
.
size
()
>
aMaterialIndex
)
{
{
glm
::
vec3
color
=
m_DiffuseColor
[
m
aterialIndex
];
glm
::
vec3
color
=
m_DiffuseColor
[
aM
aterialIndex
];
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
GL_AMBIENT_AND_DIFFUSE
);
glColor4f
(
color
.
x
,
color
.
y
,
color
.
z
,
1.0
);
glColor4f
(
color
.
x
,
color
.
y
,
color
.
z
,
1.0
);
}
}
...
...
3d-viewer/3d_material.h
View file @
4c20fb4c
...
@@ -54,7 +54,13 @@ public:
...
@@ -54,7 +54,13 @@ public:
S3D_MATERIAL
*
Next
()
const
{
return
(
S3D_MATERIAL
*
)
Pnext
;
}
S3D_MATERIAL
*
Next
()
const
{
return
(
S3D_MATERIAL
*
)
Pnext
;
}
S3D_MATERIAL
*
Back
()
const
{
return
(
S3D_MATERIAL
*
)
Pback
;
}
S3D_MATERIAL
*
Back
()
const
{
return
(
S3D_MATERIAL
*
)
Pback
;
}
void
SetOpenGLMaterial
(
unsigned
int
materialIndex
);
/**
* Initialize the material prms.
* @param aMaterialIndex = the index in list of available materials
* @param aUseMaterial = true to use the values found in the available material
* = false to use only the color, and other prms are fixed
*/
void
SetOpenGLMaterial
(
unsigned
int
aMaterialIndex
,
bool
aUseMaterial
);
#if defined(DEBUG)
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
...
...
3d-viewer/3d_mesh_model.cpp
View file @
4c20fb4c
...
@@ -89,10 +89,13 @@ void S3D_MESH::openGL_RenderAllChilds()
...
@@ -89,10 +89,13 @@ void S3D_MESH::openGL_RenderAllChilds()
void
S3D_MESH
::
openGL_Render
()
void
S3D_MESH
::
openGL_Render
()
{
{
//DBG( printf( "openGL_Render" ) );
//DBG( printf( "openGL_Render" ) );
bool
useMaterial
=
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_MATERIAL
);
bool
smoothShapes
=
g_Parm_3D_Visu
.
IsRealisticMode
()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
);
if
(
m_Materials
)
if
(
m_Materials
)
{
{
m_Materials
->
SetOpenGLMaterial
(
0
);
m_Materials
->
SetOpenGLMaterial
(
0
,
useMaterial
);
}
}
if
(
m_CoordIndex
.
size
()
==
0
)
if
(
m_CoordIndex
.
size
()
==
0
)
...
@@ -113,7 +116,7 @@ void S3D_MESH::openGL_Render()
...
@@ -113,7 +116,7 @@ void S3D_MESH::openGL_Render()
if
(
m_PerVertexNormalsNormalized
.
size
()
==
0
)
if
(
m_PerVertexNormalsNormalized
.
size
()
==
0
)
{
{
if
(
g_Parm_3D_Visu
.
IsRealisticMode
()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
)
)
if
(
smoothShapes
)
{
{
calcPerPointNormals
();
calcPerPointNormals
();
}
}
...
@@ -125,7 +128,7 @@ void S3D_MESH::openGL_Render()
...
@@ -125,7 +128,7 @@ void S3D_MESH::openGL_Render()
{
{
if
(
m_Materials
)
if
(
m_Materials
)
{
{
m_Materials
->
SetOpenGLMaterial
(
m_MaterialIndex
[
idx
]
);
m_Materials
->
SetOpenGLMaterial
(
m_MaterialIndex
[
idx
]
,
useMaterial
);
}
}
}
}
...
@@ -148,7 +151,8 @@ void S3D_MESH::openGL_Render()
...
@@ -148,7 +151,8 @@ void S3D_MESH::openGL_Render()
glm
::
vec3
point
=
m_Point
[
m_CoordIndex
[
idx
][
ii
]];
glm
::
vec3
point
=
m_Point
[
m_CoordIndex
[
idx
][
ii
]];
glVertex3fv
(
&
point
.
x
);
glVertex3fv
(
&
point
.
x
);
}
}
}
else
if
(
g_Parm_3D_Visu
.
IsRealisticMode
()
&&
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
)
)
}
else
if
(
smoothShapes
)
{
{
std
::
vector
<
glm
::
vec3
>
normals_list
;
std
::
vector
<
glm
::
vec3
>
normals_list
;
normals_list
=
m_PerFaceVertexNormals
[
idx
];
normals_list
=
m_PerFaceVertexNormals
[
idx
];
...
@@ -161,7 +165,8 @@ void S3D_MESH::openGL_Render()
...
@@ -161,7 +165,8 @@ void S3D_MESH::openGL_Render()
glm
::
vec3
point
=
m_Point
[
m_CoordIndex
[
idx
][
ii
]];
glm
::
vec3
point
=
m_Point
[
m_CoordIndex
[
idx
][
ii
]];
glVertex3fv
(
&
point
.
x
);
glVertex3fv
(
&
point
.
x
);
}
}
}
else
}
else
{
{
// Flat
// Flat
glm
::
vec3
normal
=
m_PerFaceNormalsNormalized
[
idx
];
glm
::
vec3
normal
=
m_PerFaceNormalsNormalized
[
idx
];
...
...
3d-viewer/3d_read_mesh.cpp
View file @
4c20fb4c
...
@@ -119,7 +119,7 @@ int S3D_MASTER::ReadData()
...
@@ -119,7 +119,7 @@ int S3D_MASTER::ReadData()
if
(
parser
)
if
(
parser
)
{
{
parser
->
Load
(
filename
);
parser
->
Load
(
filename
,
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
UNITS3D_TO_UNITSPCB
);
delete
parser
;
delete
parser
;
return
0
;
return
0
;
}
}
...
...
3d-viewer/3d_toolbar.cpp
View file @
4c20fb4c
...
@@ -211,12 +211,12 @@ void EDA_3D_FRAME::CreateMenuBar()
...
@@ -211,12 +211,12 @@ void EDA_3D_FRAME::CreateMenuBar()
gridlistMenu
->
AppendCheckItem
(
ID_MENU3D_GRID_1_MM
,
_
(
"3D Grid 1 mm"
),
wxEmptyString
);
gridlistMenu
->
AppendCheckItem
(
ID_MENU3D_GRID_1_MM
,
_
(
"3D Grid 1 mm"
),
wxEmptyString
);
// If the grid is on, check the corresponding menuitem showing the grid size
// If the grid is on, check the corresponding menuitem showing the grid size
if
(
g_Parm_3D_Visu
.
GetFlag
(
FL_GRID
)
)
if
(
IsEnabled
(
FL_GRID
)
)
{
{
gridlistMenu
->
Check
(
ID_MENU3D_GRID_10_MM
,
g_Parm_3D_Visu
.
m_3D_Grid
==
10.0
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_10_MM
,
GetPrm3DVisu
()
.
m_3D_Grid
==
10.0
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_5_MM
,
g_Parm_3D_Visu
.
m_3D_Grid
==
5.0
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_5_MM
,
GetPrm3DVisu
()
.
m_3D_Grid
==
5.0
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_2P5_MM
,
g_Parm_3D_Visu
.
m_3D_Grid
==
2.5
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_2P5_MM
,
GetPrm3DVisu
()
.
m_3D_Grid
==
2.5
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_1_MM
,
g_Parm_3D_Visu
.
m_3D_Grid
==
1.0
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_1_MM
,
GetPrm3DVisu
()
.
m_3D_Grid
==
1.0
);
}
}
else
else
gridlistMenu
->
Check
(
ID_MENU3D_GRID_NOGRID
,
true
);
gridlistMenu
->
Check
(
ID_MENU3D_GRID_NOGRID
,
true
);
...
@@ -273,58 +273,58 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
...
@@ -273,58 +273,58 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
wxMenuItem
*
item
;
wxMenuItem
*
item
;
// Set the state of toggle menus according to the current display options
// Set the state of toggle menus according to the current display options
item
=
menuBar
->
FindItem
(
ID_MENU3D_REALISTIC_MODE
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_REALISTIC_MODE
);
item
->
Check
(
g_Parm_3D_Visu
.
IsRealisticMode
()
);
item
->
Check
(
GetPrm3DVisu
()
.
IsRealisticMode
()
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHADOWS
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHADOWS
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHADOWS
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHADOWS
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SHOW_HOLES_IN_ZONES
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_SHOW_HOLES_IN_ZONES
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_TEXTURES
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_TEXTURES
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_TEXTURES
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_TEXTURES
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SMOOTH
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_SMOOTH
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_SMOOTH
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_SMOOTH
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_MATERIAL
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_MATERIAL
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_RENDER_MATERIAL
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_RENDER_MATERIAL
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SHOW_BOARD_BODY
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SHOW_BOARD_BODY
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_SHOW_BOARD_BODY
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_SHOW_BOARD_BODY
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_USE_COPPER_THICKNESS
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_USE_COPPER_THICKNESS
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_USE_COPPER_THICKNESS
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_USE_COPPER_THICKNESS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_MODULE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_MODULE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_MODULE
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_MODULE
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ZONE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ZONE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_ZONE
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_ZONE
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_AXIS_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_AXIS_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_AXIS
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_AXIS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ADHESIVE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ADHESIVE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_ADHESIVE
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_ADHESIVE
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SILKSCREEN_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SILKSCREEN_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_SILKSCREEN
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_SILKSCREEN
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SOLDER_MASK_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SOLDER_MASK_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_SOLDERMASK
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_SOLDERMASK
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SOLDER_PASTE_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_SOLDER_PASTE_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_SOLDERPASTE
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_SOLDERPASTE
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_COMMENTS_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_COMMENTS_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_COMMENTS
)
);
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_COMMENTS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ECO_ONOFF
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_ECO_ONOFF
);
item
->
Check
(
g_Parm_3D_Visu
.
GetFlag
(
FL_ECO
));
item
->
Check
(
GetPrm3DVisu
()
.
GetFlag
(
FL_ECO
));
}
}
void
EDA_3D_FRAME
::
SetToolbars
()
void
EDA_3D_FRAME
::
SetToolbars
()
...
...
3d-viewer/3d_viewer.h
View file @
4c20fb4c
...
@@ -98,9 +98,21 @@ public:
...
@@ -98,9 +98,21 @@ public:
/// Toggles orthographic projection on and off
/// Toggles orthographic projection on and off
void
ToggleOrtho
(){
m_ortho
=
!
m_ortho
;
Refresh
(
true
);};
void
ToggleOrtho
(){
m_ortho
=
!
m_ortho
;
Refresh
(
true
);};
///
Returns
the orthographic projection flag
///
@return
the orthographic projection flag
bool
ModeIsOrtho
()
{
return
m_ortho
;};
bool
ModeIsOrtho
()
{
return
m_ortho
;};
/** @return the INFO3D_VISU which contains the current parameters
* to draw the 3D view og the board
*/
INFO3D_VISU
&
GetPrm3DVisu
()
const
;
/**
* @return true if aItem must be displayed
* @param aItem = an item of DISPLAY3D_FLG enum
*/
bool
IsEnabled
(
DISPLAY3D_FLG
aItem
)
const
;
private
:
private
:
// Event handlers:
// Event handlers:
void
Exit3DFrame
(
wxCommandEvent
&
event
);
void
Exit3DFrame
(
wxCommandEvent
&
event
);
...
@@ -128,7 +140,10 @@ private:
...
@@ -128,7 +140,10 @@ private:
double
BestZoom
();
double
BestZoom
();
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
void
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
);
bool
Set3DBgColor
(
S3D_COLOR
&
color
);
// Get a S3D_COLOR from a wx colour dialog
// return true if a new color is chosen, false if
// no change or aborted by user
bool
Get3DColorFromUser
(
S3D_COLOR
&
color
);
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
};
};
...
...
3d-viewer/info3d_visu.cpp
View file @
4c20fb4c
/*
/*
* 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) 201
2
Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 201
4
Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-201
1
KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-201
4
KiCad Developers, see AUTHORS.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -65,6 +65,7 @@ INFO3D_VISU::INFO3D_VISU()
...
@@ -65,6 +65,7 @@ INFO3D_VISU::INFO3D_VISU()
m_copperThickness
=
0
;
m_copperThickness
=
0
;
m_epoxyThickness
=
0
;
m_epoxyThickness
=
0
;
m_nonCopperLayerThickness
=
0
;
m_nonCopperLayerThickness
=
0
;
m_BiuTo3Dunits
=
1.0
;
// Set copper color, in realistic mode
// Set copper color, in realistic mode
#define LUMINANCE 0.7/255.0
#define LUMINANCE 0.7/255.0
...
@@ -94,8 +95,7 @@ INFO3D_VISU::INFO3D_VISU()
...
@@ -94,8 +95,7 @@ INFO3D_VISU::INFO3D_VISU()
m_BoardBodyColor
.
m_Blue
=
110.0
*
LUMINANCE
;
m_BoardBodyColor
.
m_Blue
=
110.0
*
LUMINANCE
;
// default all special item layers Visible
// default all special item layers Visible
for
(
ii
=
0
;
ii
<
FL_LAST
;
ii
++
)
m_drawFlags
.
set
();
m_drawFlags
[
ii
]
=
true
;
SetFlag
(
FL_GRID
,
false
);
SetFlag
(
FL_GRID
,
false
);
SetFlag
(
FL_USE_COPPER_THICKNESS
,
false
);
SetFlag
(
FL_USE_COPPER_THICKNESS
,
false
);
...
@@ -230,9 +230,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
...
@@ -230,9 +230,10 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
*/
*/
double
INFO3D_VISU
::
GetModulesZcoord3DIU
(
bool
aIsFlipped
)
double
INFO3D_VISU
::
GetModulesZcoord3DIU
(
bool
aIsFlipped
)
{
{
// NOTE: Z position to display modules in top of Paste and near the shadow
if
(
aIsFlipped
)
if
(
aIsFlipped
)
return
m_layerZcoord
[
B_Paste
]
-
(
m_copperThickness
/
2
);
//B_Cu NOTE: in order to display modules in top of Paste and near the shadow
return
m_layerZcoord
[
B_Paste
]
-
(
m_copperThickness
/
2
);
else
else
return
m_layerZcoord
[
F_Paste
]
+
(
m_copperThickness
/
2
);
//F_Cu
return
m_layerZcoord
[
F_Paste
]
+
(
m_copperThickness
/
2
);
}
}
3d-viewer/info3d_visu.h
View file @
4c20fb4c
...
@@ -52,7 +52,9 @@
...
@@ -52,7 +52,9 @@
class
BOARD_DESIGN_SETTINGS
;
class
BOARD_DESIGN_SETTINGS
;
class
S3D_COLOR
/* 3D color (R, G, B) 3 floats range 0 to 1.0*/
/** Minor class to store a 3D color (R, G, B) 3 floats range 0 to 1.0
*/
class
S3D_COLOR
{
{
public
:
public
:
double
m_Red
,
m_Green
,
m_Blue
;
double
m_Red
,
m_Green
,
m_Blue
;
...
@@ -62,7 +64,6 @@ public: S3D_COLOR()
...
@@ -62,7 +64,6 @@ public: S3D_COLOR()
}
}
};
};
/* information needed to display 3D board */
enum
DISPLAY3D_FLG
{
enum
DISPLAY3D_FLG
{
FL_AXIS
=
0
,
FL_MODULE
,
FL_ZONE
,
FL_AXIS
=
0
,
FL_MODULE
,
FL_ZONE
,
FL_ADHESIVE
,
FL_SILKSCREEN
,
FL_SOLDERMASK
,
FL_SOLDERPASTE
,
FL_ADHESIVE
,
FL_SILKSCREEN
,
FL_SOLDERMASK
,
FL_SOLDERPASTE
,
...
@@ -79,6 +80,8 @@ enum DISPLAY3D_FLG {
...
@@ -79,6 +80,8 @@ enum DISPLAY3D_FLG {
FL_LAST
FL_LAST
};
};
/** Helper class to handle information needed to display 3D board
*/
class
INFO3D_VISU
class
INFO3D_VISU
{
{
public
:
public
:
...
@@ -112,27 +115,25 @@ private:
...
@@ -112,27 +115,25 @@ private:
double
m_copperThickness
;
// Copper thickness (normalized)
double
m_copperThickness
;
// Copper thickness (normalized)
double
m_epoxyThickness
;
// Epoxy thickness (normalized)
double
m_epoxyThickness
;
// Epoxy thickness (normalized)
double
m_nonCopperLayerThickness
;
// Non copper layers thickness
double
m_nonCopperLayerThickness
;
// Non copper layers thickness
bool
m_drawFlags
[
FL_LAST
];
// Enable/disable flags (see DISPLAY3D_FLG list)
std
::
bitset
<
FL_LAST
>
m_drawFlags
;
// Enable/disable flags (see DISPLAY3D_FLG list)
public
:
INFO3D_VISU
();
public
:
INFO3D_VISU
();
~
INFO3D_VISU
();
~
INFO3D_VISU
();
// Accessors
// Accessors
bool
GetFlag
(
DISPLAY3D_FLG
aFlag
)
const
{
return
m_drawFlags
[
aFlag
];
}
bool
GetFlag
(
DISPLAY3D_FLG
aFlag
)
const
{
return
m_drawFlags
[
aFlag
];
}
bool
SetFlag
(
DISPLAY3D_FLG
aFlag
,
bool
aState
)
void
SetFlag
(
DISPLAY3D_FLG
aFlag
,
bool
aState
)
{
{
return
m_drawFlags
[
aFlag
]
=
aState
;
m_drawFlags
[
aFlag
]
=
aState
;
}
}
/**
/**
* Function InitSettings
* Initialize 3D Parameters depending on aBoard
* Initialize info 3D Parameters from aBoard
* @param aBoard: the board to display
* @param aBoard: the board to display
*/
*/
void
InitSettings
(
BOARD
*
aBoard
);
void
InitSettings
(
BOARD
*
aBoard
);
/**
/**
* function GetModulesZcoord3DIU
* @return the Z position of 3D shapes, in 3D Units
* @return the Z position of 3D shapes, in 3D Units
* @param aIsFlipped: true for modules on Front (top) layer, false
* @param aIsFlipped: true for modules on Front (top) layer, false
* if on back (bottom) layer
* if on back (bottom) layer
...
@@ -140,7 +141,6 @@ public: INFO3D_VISU();
...
@@ -140,7 +141,6 @@ public: INFO3D_VISU();
double
GetModulesZcoord3DIU
(
bool
aIsFlipped
);
double
GetModulesZcoord3DIU
(
bool
aIsFlipped
);
/**
/**
* function GetLayerZcoordBIU
* @return the Z coordinate of the layer aLayer, in Board Internal Units
* @return the Z coordinate of the layer aLayer, in Board Internal Units
* @param aLayerId: the layer number
* @param aLayerId: the layer number
*/
*/
...
@@ -150,7 +150,6 @@ public: INFO3D_VISU();
...
@@ -150,7 +150,6 @@ public: INFO3D_VISU();
}
}
/**
/**
* function GetCopperThicknessBIU
* @return the thickness (Z size) of the copper, in Board Internal Units
* @return the thickness (Z size) of the copper, in Board Internal Units
* note: the thickness (Z size) of the copper is not the thickness
* note: the thickness (Z size) of the copper is not the thickness
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
* of the layer (the thickness of the layer is the epoxy thickness / layer count)
...
...
3d-viewer/modelparsers.h
View file @
4c20fb4c
...
@@ -66,12 +66,15 @@ public:
...
@@ -66,12 +66,15 @@ public:
* @param aExtension is file extension of the file you are going to parse.
* @param aExtension is file extension of the file you are going to parse.
*/
*/
static
S3D_MODEL_PARSER
*
Create
(
S3D_MASTER
*
aMaster
,
const
wxString
aExtension
);
static
S3D_MODEL_PARSER
*
Create
(
S3D_MASTER
*
aMaster
,
const
wxString
aExtension
);
/**
/**
* Function Load
* pure virtual Function
*
* Concrete parsers should implement this function
* Concrete parsers should implement this function
* @param aFilename = the full file name of the file to load
* @param aVrmlunits_to_3Dunits = the scaling factor, i.e. the
* convertion from file unit to internal 3D units
*/
*/
virtual
void
Load
(
const
wxString
aFilename
)
=
0
;
virtual
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
)
=
0
;
private
:
private
:
S3D_MASTER
*
master
;
S3D_MASTER
*
master
;
...
@@ -89,7 +92,8 @@ class X3D_MODEL_PARSER: public S3D_MODEL_PARSER
...
@@ -89,7 +92,8 @@ class X3D_MODEL_PARSER: public S3D_MODEL_PARSER
public
:
public
:
X3D_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
X3D_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
~
X3D_MODEL_PARSER
();
~
X3D_MODEL_PARSER
();
void
Load
(
const
wxString
aFilename
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
typedef
std
::
map
<
wxString
,
wxString
>
PROPERTY_MAP
;
typedef
std
::
map
<
wxString
,
wxString
>
PROPERTY_MAP
;
typedef
std
::
vector
<
wxXmlNode
*
>
NODE_LIST
;
typedef
std
::
vector
<
wxXmlNode
*
>
NODE_LIST
;
...
@@ -148,7 +152,8 @@ class VRML2_MODEL_PARSER: public S3D_MODEL_PARSER
...
@@ -148,7 +152,8 @@ class VRML2_MODEL_PARSER: public S3D_MODEL_PARSER
public
:
public
:
VRML2_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
VRML2_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
~
VRML2_MODEL_PARSER
();
~
VRML2_MODEL_PARSER
();
void
Load
(
const
wxString
aFilename
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
/**
/**
* Return string representing VRML2 file in vrml2 format
* Return string representing VRML2 file in vrml2 format
...
@@ -191,7 +196,8 @@ class VRML1_MODEL_PARSER: public S3D_MODEL_PARSER
...
@@ -191,7 +196,8 @@ class VRML1_MODEL_PARSER: public S3D_MODEL_PARSER
public
:
public
:
VRML1_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
VRML1_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
~
VRML1_MODEL_PARSER
();
~
VRML1_MODEL_PARSER
();
void
Load
(
const
wxString
aFilename
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
/**
/**
* Return string representing VRML2 file in vrml2 format
* Return string representing VRML2 file in vrml2 format
...
@@ -236,7 +242,8 @@ class VRML_MODEL_PARSER: public S3D_MODEL_PARSER
...
@@ -236,7 +242,8 @@ class VRML_MODEL_PARSER: public S3D_MODEL_PARSER
public
:
public
:
VRML_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
VRML_MODEL_PARSER
(
S3D_MASTER
*
aMaster
);
~
VRML_MODEL_PARSER
();
~
VRML_MODEL_PARSER
();
void
Load
(
const
wxString
aFilename
);
void
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
);
private
:
private
:
VRML1_MODEL_PARSER
*
vrml1_parser
;
VRML1_MODEL_PARSER
*
vrml1_parser
;
...
...
3d-viewer/vrml_v1_modelparser.cpp
View file @
4c20fb4c
...
@@ -53,11 +53,11 @@ VRML1_MODEL_PARSER::~VRML1_MODEL_PARSER()
...
@@ -53,11 +53,11 @@ VRML1_MODEL_PARSER::~VRML1_MODEL_PARSER()
}
}
void
VRML1_MODEL_PARSER
::
Load
(
const
wxString
aFilename
)
void
VRML1_MODEL_PARSER
::
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
)
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( "Load %s\n",
static_cast<const char*>(aFilename.mb_str()
) ) );
// DBG( printf( "Load %s\n",
GetChars(aFilename
) ) );
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
if
(
m_file
==
NULL
)
if
(
m_file
==
NULL
)
...
@@ -65,7 +65,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -65,7 +65,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
return
;
return
;
}
}
float
vrmlunits_to_3Dunits
=
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
UNITS3D_TO_UNITSPCB
;
float
vrmlunits_to_3Dunits
=
aVrmlunits_to_3Dunits
;
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
,
glm
::
vec3
matScale
(
GetMaster
()
->
m_MatScale
.
x
,
GetMaster
()
->
m_MatScale
.
y
,
...
@@ -87,8 +87,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -87,8 +87,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
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)
LOCALE_IO
toggle
;
// Switch the locale to standard C
SetLocaleTo_C_standard
();
childs
.
clear
();
childs
.
clear
();
...
@@ -108,8 +107,6 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -108,8 +107,6 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
}
}
fclose
(
m_file
);
fclose
(
m_file
);
SetLocaleTo_Default
();
// revert to the current locale
// DBG( printf( "chils size:%lu\n", childs.size() ) );
// DBG( printf( "chils size:%lu\n", childs.size() ) );
...
...
3d-viewer/vrml_v2_modelparser.cpp
View file @
4c20fb4c
...
@@ -55,11 +55,11 @@ VRML2_MODEL_PARSER::~VRML2_MODEL_PARSER()
...
@@ -55,11 +55,11 @@ VRML2_MODEL_PARSER::~VRML2_MODEL_PARSER()
}
}
void
VRML2_MODEL_PARSER
::
Load
(
const
wxString
aFilename
)
void
VRML2_MODEL_PARSER
::
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
)
{
{
char
text
[
128
];
char
text
[
128
];
// DBG( printf( "Load %s\n",
static_cast<const char*>(aFilename.mb_str()
) ) );
// DBG( printf( "Load %s\n",
GetChars(aFilename
) ) );
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
m_file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
if
(
m_file
==
NULL
)
if
(
m_file
==
NULL
)
...
@@ -67,7 +67,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -67,7 +67,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
return
;
return
;
}
}
float
vrmlunits_to_3Dunits
=
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
UNITS3D_TO_UNITSPCB
;
float
vrmlunits_to_3Dunits
=
aVrmlunits_to_3Dunits
;
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
,
glm
::
vec3
matScale
(
GetMaster
()
->
m_MatScale
.
x
,
GetMaster
()
->
m_MatScale
.
y
,
...
...
3d-viewer/vrmlmodelparser.cpp
View file @
4c20fb4c
...
@@ -59,12 +59,12 @@ VRML_MODEL_PARSER::~VRML_MODEL_PARSER()
...
@@ -59,12 +59,12 @@ VRML_MODEL_PARSER::~VRML_MODEL_PARSER()
}
}
void
VRML_MODEL_PARSER
::
Load
(
const
wxString
aFilename
)
void
VRML_MODEL_PARSER
::
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
)
{
{
char
line
[
12
];
char
line
[
12
8
];
FILE
*
file
;
FILE
*
file
;
//DBG( printf( "Load %s",
static_cast<const char*>(aFilename.mb_str()
) ) );
//DBG( printf( "Load %s",
GetChars( aFilename
) ) );
file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
file
=
wxFopen
(
aFilename
,
wxT
(
"rt"
)
);
...
@@ -86,14 +86,14 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -86,14 +86,14 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
if
(
stricmp
(
line
,
"#VRML V2.0"
)
==
0
)
if
(
stricmp
(
line
,
"#VRML V2.0"
)
==
0
)
{
{
//DBG( printf( "About to parser a #VRML V2.0 file\n" ) );
//DBG( printf( "About to parser a #VRML V2.0 file\n" ) );
vrml2_parser
->
Load
(
aFilename
);
vrml2_parser
->
Load
(
aFilename
,
aVrmlunits_to_3Dunits
);
return
;
return
;
}
}
else
if
(
stricmp
(
line
,
"#VRML V1.0"
)
==
0
)
else
if
(
stricmp
(
line
,
"#VRML V1.0"
)
==
0
)
{
{
//DBG( printf( "About to parser a #VRML V1.0 file\n" ) );
//DBG( printf( "About to parser a #VRML V1.0 file\n" ) );
vrml1_parser
->
Load
(
aFilename
);
vrml1_parser
->
Load
(
aFilename
,
aVrmlunits_to_3Dunits
);
return
;
return
;
}
}
...
...
3d-viewer/x3dmodelparser.cpp
View file @
4c20fb4c
...
@@ -52,7 +52,7 @@ X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
...
@@ -52,7 +52,7 @@ X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
}
}
void
X3D_MODEL_PARSER
::
Load
(
const
wxString
aFilename
)
void
X3D_MODEL_PARSER
::
Load
(
const
wxString
&
aFilename
,
double
aVrmlunits_to_3Dunits
)
{
{
wxXmlDocument
doc
;
wxXmlDocument
doc
;
...
@@ -69,7 +69,7 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -69,7 +69,7 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename )
}
}
float
vrmlunits_to_3Dunits
=
g_Parm_3D_Visu
.
m_BiuTo3Dunits
*
UNITS3D_TO_UNITSPCB
;
float
vrmlunits_to_3Dunits
=
aVrmlunits_to_3Dunits
;
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
,
glm
::
vec3
matScale
(
GetMaster
()
->
m_MatScale
.
x
,
GetMaster
()
->
m_MatScale
.
y
,
...
...
pcbnew/exporters/export_vrml.cpp
View file @
4c20fb4c
...
@@ -1320,7 +1320,8 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule
...
@@ -1320,7 +1320,8 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule
if
(
parser
)
if
(
parser
)
{
{
// embed x3d model in vrml format
// embed x3d model in vrml format
parser
->
Load
(
fname
);
double
vrml_to_x3d
=
aVRMLModelsToBiu
;
parser
->
Load
(
fname
,
vrml_to_x3d
);
try
try
{
{
...
...
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