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
8e7bc566
Commit
8e7bc566
authored
Mar 10, 2015
by
unknown
Committed by
jean-pierre charras
Mar 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3d viewer: fix current shading issues with some models.
parent
f87577ca
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
180 additions
and
81 deletions
+180
-81
3d_canvas.cpp
3d-viewer/3d_canvas.cpp
+1
-1
3d_draw.cpp
3d-viewer/3d_draw.cpp
+3
-10
3d_frame.cpp
3d-viewer/3d_frame.cpp
+16
-6
3d_mesh_model.cpp
3d-viewer/3d_mesh_model.cpp
+143
-59
3d_mesh_model.h
3d-viewer/3d_mesh_model.h
+3
-0
3d_toolbar.cpp
3d-viewer/3d_toolbar.cpp
+10
-3
3d_viewer_id.h
3d-viewer/3d_viewer_id.h
+2
-1
info3d_visu.h
3d-viewer/info3d_visu.h
+2
-1
No files found.
3d-viewer/3d_canvas.cpp
View file @
8e7bc566
...
@@ -563,7 +563,7 @@ void EDA_3D_CANVAS::InitGL()
...
@@ -563,7 +563,7 @@ void EDA_3D_CANVAS::InitGL()
void
EDA_3D_CANVAS
::
SetLights
()
void
EDA_3D_CANVAS
::
SetLights
()
{
{
// activate light. the source is above the xy plane, at source_pos
// activate light. the source is above the xy plane, at source_pos
GLfloat
source_pos
[
4
]
=
{
0.0
,
0.0
,
3
0.0
,
0.0
};
GLfloat
source_pos
[
4
]
=
{
0.0
,
0.0
,
100
0.0
,
0.0
};
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
;
...
...
3d-viewer/3d_draw.cpp
View file @
8e7bc566
...
@@ -342,16 +342,9 @@ void EDA_3D_CANVAS::Redraw()
...
@@ -342,16 +342,9 @@ void EDA_3D_CANVAS::Redraw()
glClearStencil
(
0
);
glClearStencil
(
0
);
glClearDepth
(
1.0
);
glClearDepth
(
1.0
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
|
GL_STENCIL_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
|
GL_STENCIL_BUFFER_BIT
);
if
(
isEnabled
(
FL_RENDER_SMOOTH
)
)
glShadeModel
(
GL_SMOOTH
);
{
glShadeModel
(
GL_SMOOTH
);
}
else
{
glShadeModel
(
GL_FLAT
);
}
// Draw background
// Draw background
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
glLoadIdentity
();
glLoadIdentity
();
...
...
3d-viewer/3d_frame.cpp
View file @
8e7bc566
...
@@ -54,7 +54,8 @@ static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
...
@@ -54,7 +54,8 @@ static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
static
const
wxChar
keyRenderShadows
[]
=
wxT
(
"Render_Shadows"
);
static
const
wxChar
keyRenderShadows
[]
=
wxT
(
"Render_Shadows"
);
static
const
wxChar
keyRenderRemoveHoles
[]
=
wxT
(
"Render_RemoveHoles"
);
static
const
wxChar
keyRenderRemoveHoles
[]
=
wxT
(
"Render_RemoveHoles"
);
static
const
wxChar
keyRenderTextures
[]
=
wxT
(
"Render_Textures"
);
static
const
wxChar
keyRenderTextures
[]
=
wxT
(
"Render_Textures"
);
static
const
wxChar
keyRenderSmooth
[]
=
wxT
(
"Render_Smooth"
);
static
const
wxChar
keyRenderSmoothNormals
[]
=
wxT
(
"Render_Smooth_Normals"
);
static
const
wxChar
keyRenderUseModelNormals
[]
=
wxT
(
"Render_Use_Model_Normals"
);
static
const
wxChar
keyRenderMaterial
[]
=
wxT
(
"Render_Material"
);
static
const
wxChar
keyRenderMaterial
[]
=
wxT
(
"Render_Material"
);
static
const
wxChar
keyShowAxis
[]
=
wxT
(
"ShowAxis"
);
static
const
wxChar
keyShowAxis
[]
=
wxT
(
"ShowAxis"
);
...
@@ -247,8 +248,11 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
...
@@ -247,8 +248,11 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg
->
Read
(
keyRenderTextures
,
&
tmp
,
false
);
aCfg
->
Read
(
keyRenderTextures
,
&
tmp
,
false
);
prms
.
SetFlag
(
FL_RENDER_TEXTURES
,
tmp
);
prms
.
SetFlag
(
FL_RENDER_TEXTURES
,
tmp
);
aCfg
->
Read
(
keyRenderSmooth
,
&
tmp
,
false
);
aCfg
->
Read
(
keyRenderSmoothNormals
,
&
tmp
,
false
);
prms
.
SetFlag
(
FL_RENDER_SMOOTH
,
tmp
);
prms
.
SetFlag
(
FL_RENDER_SMOOTH_NORMALS
,
tmp
);
aCfg
->
Read
(
keyRenderUseModelNormals
,
&
tmp
,
false
);
prms
.
SetFlag
(
FL_RENDER_USE_MODEL_NORMALS
,
tmp
);
aCfg
->
Read
(
keyRenderMaterial
,
&
tmp
,
false
);
aCfg
->
Read
(
keyRenderMaterial
,
&
tmp
,
false
);
prms
.
SetFlag
(
FL_RENDER_MATERIAL
,
tmp
);
prms
.
SetFlag
(
FL_RENDER_MATERIAL
,
tmp
);
...
@@ -312,7 +316,8 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
...
@@ -312,7 +316,8 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg
->
Write
(
keyRenderShadows
,
prms
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
aCfg
->
Write
(
keyRenderShadows
,
prms
.
GetFlag
(
FL_RENDER_SHADOWS
)
);
aCfg
->
Write
(
keyRenderRemoveHoles
,
prms
.
GetFlag
(
FL_RENDER_SHOW_HOLES_IN_ZONES
)
);
aCfg
->
Write
(
keyRenderRemoveHoles
,
prms
.
GetFlag
(
FL_RENDER_SHOW_HOLES_IN_ZONES
)
);
aCfg
->
Write
(
keyRenderTextures
,
prms
.
GetFlag
(
FL_RENDER_TEXTURES
)
);
aCfg
->
Write
(
keyRenderTextures
,
prms
.
GetFlag
(
FL_RENDER_TEXTURES
)
);
aCfg
->
Write
(
keyRenderSmooth
,
prms
.
GetFlag
(
FL_RENDER_SMOOTH
)
);
aCfg
->
Write
(
keyRenderSmoothNormals
,
prms
.
GetFlag
(
FL_RENDER_SMOOTH_NORMALS
)
);
aCfg
->
Write
(
keyRenderUseModelNormals
,
prms
.
GetFlag
(
FL_RENDER_USE_MODEL_NORMALS
)
);
aCfg
->
Write
(
keyRenderMaterial
,
prms
.
GetFlag
(
FL_RENDER_MATERIAL
)
);
aCfg
->
Write
(
keyRenderMaterial
,
prms
.
GetFlag
(
FL_RENDER_MATERIAL
)
);
aCfg
->
Write
(
keyShowAxis
,
prms
.
GetFlag
(
FL_AXIS
)
);
aCfg
->
Write
(
keyShowAxis
,
prms
.
GetFlag
(
FL_AXIS
)
);
...
@@ -488,8 +493,13 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -488,8 +493,13 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
NewDisplay
(
GL_ID_TECH_LAYERS
);
NewDisplay
(
GL_ID_TECH_LAYERS
);
return
;
return
;
case
ID_MENU3D_FL_RENDER_SMOOTH
:
case
ID_MENU3D_FL_RENDER_SMOOTH_NORMALS
:
GetPrm3DVisu
().
SetFlag
(
FL_RENDER_SMOOTH
,
isChecked
);
GetPrm3DVisu
().
SetFlag
(
FL_RENDER_SMOOTH_NORMALS
,
isChecked
);
NewDisplay
();
return
;
case
ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS
:
GetPrm3DVisu
().
SetFlag
(
FL_RENDER_USE_MODEL_NORMALS
,
isChecked
);
NewDisplay
();
NewDisplay
();
return
;
return
;
...
...
3d-viewer/3d_mesh_model.cpp
View file @
8e7bc566
This diff is collapsed.
Click to expand it.
3d-viewer/3d_mesh_model.h
View file @
8e7bc566
...
@@ -95,6 +95,9 @@ private:
...
@@ -95,6 +95,9 @@ private:
bool
isPerPointNormalsComputed
;
bool
isPerPointNormalsComputed
;
void
calcPerPointNormals
();
void
calcPerPointNormals
();
bool
isPerVertexNormalsVerified
;
void
perVertexNormalsVerify_and_Repair
();
};
};
...
...
3d-viewer/3d_toolbar.cpp
View file @
8e7bc566
...
@@ -175,9 +175,13 @@ void EDA_3D_FRAME::CreateMenuBar()
...
@@ -175,9 +175,13 @@ void EDA_3D_FRAME::CreateMenuBar()
_
(
"Apply a grid/cloud textures to Board, Solder Mask and Silkscreen"
),
_
(
"Apply a grid/cloud textures to Board, Solder Mask and Silkscreen"
),
KiBitmap
(
green_xpm
),
wxITEM_CHECK
);
KiBitmap
(
green_xpm
),
wxITEM_CHECK
);
AddMenuItem
(
renderOptionsMenu
,
ID_MENU3D_FL_RENDER_SMOOTH
,
AddMenuItem
(
renderOptionsMenu
,
ID_MENU3D_FL_RENDER_SMOOTH
_NORMALS
,
_
(
"Render Smooth Normals"
),
_
(
"Render Smooth Normals"
),
KiBitmap
(
green_xpm
),
wxITEM_CHECK
);
KiBitmap
(
green_xpm
),
wxITEM_CHECK
);
AddMenuItem
(
renderOptionsMenu
,
ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS
,
_
(
"Use Model Normals"
),
KiBitmap
(
green_xpm
),
wxITEM_CHECK
);
AddMenuItem
(
renderOptionsMenu
,
ID_MENU3D_FL_RENDER_MATERIAL
,
AddMenuItem
(
renderOptionsMenu
,
ID_MENU3D_FL_RENDER_MATERIAL
,
_
(
"Render Material Properties"
),
_
(
"Render Material Properties"
),
...
@@ -287,8 +291,11 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
...
@@ -287,8 +291,11 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_TEXTURES
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_TEXTURES
);
item
->
Check
(
GetPrm3DVisu
().
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_NORMALS
);
item
->
Check
(
GetPrm3DVisu
().
GetFlag
(
FL_RENDER_SMOOTH
)
);
item
->
Check
(
GetPrm3DVisu
().
GetFlag
(
FL_RENDER_SMOOTH_NORMALS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS
);
item
->
Check
(
GetPrm3DVisu
().
GetFlag
(
FL_RENDER_USE_MODEL_NORMALS
)
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_MATERIAL
);
item
=
menuBar
->
FindItem
(
ID_MENU3D_FL_RENDER_MATERIAL
);
item
->
Check
(
GetPrm3DVisu
().
GetFlag
(
FL_RENDER_MATERIAL
)
);
item
->
Check
(
GetPrm3DVisu
().
GetFlag
(
FL_RENDER_MATERIAL
)
);
...
...
3d-viewer/3d_viewer_id.h
View file @
8e7bc566
...
@@ -49,7 +49,8 @@ enum id_3dview_frm
...
@@ -49,7 +49,8 @@ enum id_3dview_frm
ID_MENU3D_FL_RENDER_SHADOWS
,
ID_MENU3D_FL_RENDER_SHADOWS
,
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES
,
ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES
,
ID_MENU3D_FL_RENDER_TEXTURES
,
ID_MENU3D_FL_RENDER_TEXTURES
,
ID_MENU3D_FL_RENDER_SMOOTH
,
ID_MENU3D_FL_RENDER_SMOOTH_NORMALS
,
ID_MENU3D_FL_RENDER_USE_MODEL_NORMALS
,
ID_MENU3D_FL_RENDER_MATERIAL
,
ID_MENU3D_FL_RENDER_MATERIAL
,
ID_END_COMMAND_3D
,
ID_END_COMMAND_3D
,
...
...
3d-viewer/info3d_visu.h
View file @
8e7bc566
...
@@ -75,7 +75,8 @@ enum DISPLAY3D_FLG {
...
@@ -75,7 +75,8 @@ enum DISPLAY3D_FLG {
FL_RENDER_SHADOWS
,
FL_RENDER_SHADOWS
,
FL_RENDER_SHOW_HOLES_IN_ZONES
,
FL_RENDER_SHOW_HOLES_IN_ZONES
,
FL_RENDER_TEXTURES
,
FL_RENDER_TEXTURES
,
FL_RENDER_SMOOTH
,
FL_RENDER_SMOOTH_NORMALS
,
FL_RENDER_USE_MODEL_NORMALS
,
FL_RENDER_MATERIAL
,
FL_RENDER_MATERIAL
,
FL_LAST
FL_LAST
};
};
...
...
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