Naming conventions.

There's nothing "legacy" about the OpenGL 3D renderer.
This commit is contained in:
Jeff Young 2021-10-21 14:29:19 +01:00
parent 0fd762dc25
commit 6c0110ecd3
86 changed files with 196 additions and 294 deletions

View File

@ -26,7 +26,7 @@
#include "board_adapter.h" #include "board_adapter.h"
#include <board_design_settings.h> #include <board_design_settings.h>
#include <board_stackup_manager/board_stackup.h> #include <board_stackup_manager/board_stackup.h>
#include <3d_rendering/3d_render_raytracing/shapes2D/polygon_2d.h> #include <3d_rendering/raytracing/shapes2D/polygon_2d.h>
#include <board.h> #include <board.h>
#include <dialogs/dialog_color_picker.h> #include <dialogs/dialog_color_picker.h>
#include <3d_math.h> #include <3d_math.h>
@ -81,7 +81,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
if( PgmOrNull() ) if( PgmOrNull() )
m_colors = Pgm().GetSettingsManager().GetColorSettings(); m_colors = Pgm().GetSettingsManager().GetColorSettings();
m_renderEngine = RENDER_ENGINE::OPENGL_LEGACY; m_renderEngine = RENDER_ENGINE::OPENGL;
m_materialMode = MATERIAL_MODE::NORMAL; m_materialMode = MATERIAL_MODE::NORMAL;
m_boardPos = wxPoint(); m_boardPos = wxPoint();

View File

@ -27,9 +27,9 @@
#include <array> #include <array>
#include <vector> #include <vector>
#include "../3d_rendering/3d_render_raytracing/accelerators/container_2d.h" #include "../3d_rendering/raytracing/accelerators/container_2d.h"
#include "../3d_rendering/3d_render_raytracing/accelerators/container_3d.h" #include "../3d_rendering/raytracing/accelerators/container_3d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/bbox_3d.h" #include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
#include "../3d_rendering/camera.h" #include "../3d_rendering/camera.h"
#include "../3d_enums.h" #include "../3d_enums.h"
#include "../3d_cache/3d_cache.h" #include "../3d_cache/3d_cache.h"

View File

@ -30,10 +30,10 @@
* board_items_to_polygon_shape_transform.cpp * board_items_to_polygon_shape_transform.cpp
*/ */
#include "../3d_rendering/3d_render_raytracing/shapes2D/ring_2d.h" #include "../3d_rendering/raytracing/shapes2D/ring_2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes2D/filled_circle_2d.h" #include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes2D/round_segment_2d.h" #include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes2D/triangle_2d.h" #include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
#include <board_adapter.h> #include <board_adapter.h>
#include <board.h> #include <board.h>
#include <footprint.h> #include <footprint.h>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -32,9 +32,9 @@
*/ */
#include "board_adapter.h" #include "board_adapter.h"
#include "../3d_rendering/3d_render_raytracing/shapes2D/ring_2d.h" #include "../3d_rendering/raytracing/shapes2D/ring_2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes2D/filled_circle_2d.h" #include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
#include "../3d_rendering/3d_render_raytracing/shapes3D/cylinder_3d.h" #include "../3d_rendering/raytracing/shapes3D/cylinder_3d.h"
#include <board.h> #include <board.h>
#include <board_design_settings.h> #include <board_design_settings.h>
@ -205,8 +205,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D; BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
m_layerMap[curr_layer_id] = layerContainer; m_layerMap[curr_layer_id] = layerContainer;
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && m_renderEngine == RENDER_ENGINE::OPENGL )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET; SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET;
m_layers_poly[curr_layer_id] = layerPoly; m_layers_poly[curr_layer_id] = layerPoly;
@ -419,8 +418,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
// Creates vertical outline contours of the tracks and add it to the poly of the layer // Creates vertical outline contours of the tracks and add it to the poly of the layer
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && m_renderEngine == RENDER_ENGINE::OPENGL )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
{ {
@ -560,8 +558,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
// Add footprints PADs poly contours (vertical outlines) // Add footprints PADs poly contours (vertical outlines)
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && m_renderEngine == RENDER_ENGINE::OPENGL )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
{ {
@ -641,8 +638,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
// Add graphic item on copper layers to poly contours (vertical outlines) // Add graphic item on copper layers to poly contours (vertical outlines)
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && m_renderEngine == RENDER_ENGINE::OPENGL )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
for( PCB_LAYER_ID cur_layer_id : layer_id ) for( PCB_LAYER_ID cur_layer_id : layer_id )
{ {
@ -729,7 +725,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) && m_renderEngine == RENDER_ENGINE::OPENGL
&& layerPolyContainer != m_layers_poly.end() ) && layerPolyContainer != m_layers_poly.end() )
{ {
auto mut_it = layer_lock.find( layer ); auto mut_it = layer_lock.find( layer );
@ -755,8 +751,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Simplifying copper layers polygons" ) ); aStatusReporter->Report( _( "Simplifying copper layers polygons" ) );
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && m_renderEngine == RENDER_ENGINE::OPENGL )
&& ( m_renderEngine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) && GetFlag( FL_USE_REALISTIC_MODE ) ) if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) && GetFlag( FL_USE_REALISTIC_MODE ) )
{ {

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -29,8 +29,8 @@
#include "../common_ogl/ogl_utils.h" #include "../common_ogl/ogl_utils.h"
#include "eda_3d_canvas.h" #include "eda_3d_canvas.h"
#include <eda_3d_viewer_frame.h> #include <eda_3d_viewer_frame.h>
#include <3d_rendering/3d_render_raytracing/render_3d_raytrace.h> #include <3d_rendering/raytracing/render_3d_raytrace.h>
#include <3d_rendering/legacy/render_3d_legacy.h> #include <3d_rendering/opengl/render_3d_opengl.h>
#include <3d_viewer_id.h> #include <3d_viewer_id.h>
#include <board.h> #include <board.h>
#include <reporter.h> #include <reporter.h>
@ -127,15 +127,15 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
m_is_currently_painting.clear(); m_is_currently_painting.clear();
m_3d_render_raytracing = new RENDER_3D_RAYTRACE( this, m_boardAdapter, m_camera ); m_3d_render_raytracing = new RENDER_3D_RAYTRACE( this, m_boardAdapter, m_camera );
m_3d_render_ogl_legacy = new RENDER_3D_LEGACY( this, m_boardAdapter, m_camera ); m_3d_render_opengl = new RENDER_3D_OPENGL( this, m_boardAdapter, m_camera );
wxASSERT( m_3d_render_raytracing != nullptr ); wxASSERT( m_3d_render_raytracing != nullptr );
wxASSERT( m_3d_render_ogl_legacy != nullptr ); wxASSERT( m_3d_render_opengl != nullptr );
auto busy_indicator_factory = []() { return std::make_unique<WX_BUSY_INDICATOR>(); }; auto busy_indicator_factory = []() { return std::make_unique<WX_BUSY_INDICATOR>(); };
m_3d_render_raytracing->SetBusyIndicatorFactory( busy_indicator_factory ); m_3d_render_raytracing->SetBusyIndicatorFactory( busy_indicator_factory );
m_3d_render_ogl_legacy->SetBusyIndicatorFactory( busy_indicator_factory ); m_3d_render_opengl->SetBusyIndicatorFactory( busy_indicator_factory );
RenderEngineChanged(); RenderEngineChanged();
@ -185,8 +185,8 @@ void EDA_3D_CANVAS::releaseOpenGL()
delete m_3d_render_raytracing; delete m_3d_render_raytracing;
m_3d_render_raytracing = nullptr; m_3d_render_raytracing = nullptr;
delete m_3d_render_ogl_legacy; delete m_3d_render_opengl;
m_3d_render_ogl_legacy = nullptr; m_3d_render_opengl = nullptr;
// This is just a copy of a pointer, can safely be set to NULL. // This is just a copy of a pointer, can safely be set to NULL.
m_3d_render = nullptr; m_3d_render = nullptr;
@ -430,13 +430,13 @@ void EDA_3D_CANVAS::DoRePaint()
// Don't attend to ray trace if OpenGL doesn't support it. // Don't attend to ray trace if OpenGL doesn't support it.
if( !m_opengl_supports_raytracing ) if( !m_opengl_supports_raytracing )
{ {
m_3d_render = m_3d_render_ogl_legacy; m_3d_render = m_3d_render_opengl;
m_render_raytracing_was_requested = false; m_render_raytracing_was_requested = false;
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL_LEGACY ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL );
} }
// Check if a raytacing was requested and need to switch to raytracing mode // Check if a raytacing was requested and need to switch to raytracing mode
if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
{ {
const bool was_camera_changed = m_camera.ParametersChanged(); const bool was_camera_changed = m_camera.ParametersChanged();
@ -447,7 +447,7 @@ void EDA_3D_CANVAS::DoRePaint()
&& m_render_raytracing_was_requested ) && m_render_raytracing_was_requested )
{ {
m_render_raytracing_was_requested = false; m_render_raytracing_was_requested = false;
m_3d_render = m_3d_render_ogl_legacy; m_3d_render = m_3d_render_opengl;
} }
} }
@ -485,8 +485,8 @@ void EDA_3D_CANVAS::DoRePaint()
bool reloadRaytracingForIntersectionCalculations = false; bool reloadRaytracingForIntersectionCalculations = false;
if( ( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL
&& m_3d_render_ogl_legacy->IsReloadRequestPending() ) && m_3d_render_opengl->IsReloadRequestPending() )
{ {
reloadRaytracingForIntersectionCalculations = true; reloadRaytracingForIntersectionCalculations = true;
} }
@ -692,8 +692,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
m_camera.SetCurMousePosition( nativePosition ); m_camera.SetCurMousePosition( nativePosition );
if( !event.Dragging() && if( !event.Dragging() && m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
STATUSBAR_REPORTER reporter( m_parentStatusBar, STATUSBAR_REPORTER reporter( m_parentStatusBar,
static_cast<int>( EDA_3D_VIEWER_STATUSBAR::HOVERED_ITEM ) ); static_cast<int>( EDA_3D_VIEWER_STATUSBAR::HOVERED_ITEM ) );
@ -706,7 +705,7 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
{ {
if( rollOverItem != m_currentRollOverItem ) if( rollOverItem != m_currentRollOverItem )
{ {
m_3d_render_ogl_legacy->SetCurrentRollOverItem( rollOverItem ); m_3d_render_opengl->SetCurrentRollOverItem( rollOverItem );
m_currentRollOverItem = rollOverItem; m_currentRollOverItem = rollOverItem;
Request_refresh(); Request_refresh();
@ -771,10 +770,9 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event )
} }
else else
{ {
if( ( m_currentRollOverItem != nullptr ) && if( m_currentRollOverItem && m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
m_3d_render_ogl_legacy->SetCurrentRollOverItem( nullptr ); m_3d_render_opengl->SetCurrentRollOverItem( nullptr );
Request_refresh(); Request_refresh();
reporter.Report( "" ); reporter.Report( "" );
@ -1108,9 +1106,9 @@ void EDA_3D_CANVAS::RenderEngineChanged()
{ {
switch( m_boardAdapter.GetRenderEngine() ) switch( m_boardAdapter.GetRenderEngine() )
{ {
case RENDER_ENGINE::OPENGL_LEGACY: m_3d_render = m_3d_render_ogl_legacy; break; case RENDER_ENGINE::OPENGL: m_3d_render = m_3d_render_opengl; break;
case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break; case RENDER_ENGINE::RAYTRACING: m_3d_render = m_3d_render_raytracing; break;
default: m_3d_render = nullptr; break; default: m_3d_render = nullptr; break;
} }
if( m_3d_render ) if( m_3d_render )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -27,7 +27,7 @@
#include <atomic> #include <atomic>
#include "board_adapter.h" #include "board_adapter.h"
#include "3d_rendering/3d_render_raytracing/accelerators/accelerator_3d.h" #include "3d_rendering/raytracing/accelerators/accelerator_3d.h"
#include "3d_rendering/render_3d_base.h" #include "3d_rendering/render_3d_base.h"
#include "3d_cache/3d_cache.h" #include "3d_cache/3d_cache.h"
#include <gal/hidpi_gl_canvas.h> #include <gal/hidpi_gl_canvas.h>
@ -39,7 +39,7 @@ class WX_INFOBAR;
class wxStatusBar; class wxStatusBar;
class BOARD; class BOARD;
class RENDER_3D_RAYTRACE; class RENDER_3D_RAYTRACE;
class RENDER_3D_LEGACY; class RENDER_3D_OPENGL;
/** /**
@ -97,7 +97,7 @@ public:
} }
/** /**
* @return the current render ( a RENDER_3D_RAYTRACE* or a RENDER_3D_LEGACY* render ) * @return the current render ( a RENDER_3D_RAYTRACE* or a RENDER_3D_OPENGL* render )
*/ */
RENDER_3D_BASE* GetCurrentRender() const { return m_3d_render; } RENDER_3D_BASE* GetCurrentRender() const { return m_3d_render; }
@ -267,7 +267,7 @@ private:
CAMERA& m_camera; CAMERA& m_camera;
RENDER_3D_BASE* m_3d_render; RENDER_3D_BASE* m_3d_render;
RENDER_3D_RAYTRACE* m_3d_render_raytracing; RENDER_3D_RAYTRACE* m_3d_render_raytracing;
RENDER_3D_LEGACY* m_3d_render_ogl_legacy; RENDER_3D_OPENGL* m_3d_render_opengl;
static const float m_delta_move_step_factor; // Step factor to used with cursor on static const float m_delta_move_step_factor; // Step factor to used with cursor on
// relation to the current zoom // relation to the current zoom

View File

@ -109,7 +109,7 @@ enum class GRID3D_TYPE
/// Render engine mode /// Render engine mode
enum class RENDER_ENGINE enum class RENDER_ENGINE
{ {
OPENGL_LEGACY, OPENGL,
RAYTRACING, RAYTRACING,
}; };

View File

@ -28,9 +28,9 @@
*/ */
#include <iostream> #include <iostream>
#include "3d_rendering/legacy/3d_model.h" #include "3d_rendering/opengl/3d_model.h"
#include "eda_3d_model_viewer.h" #include "eda_3d_model_viewer.h"
#include "../3d_rendering/legacy/ogl_legacy_utils.h" #include "../3d_rendering/opengl/opengl_utils.h"
#include "../3d_cache/3d_cache.h" #include "../3d_cache/3d_cache.h"
#include <wx/dcclient.h> #include <wx/dcclient.h>
#include <base_units.h> #include <base_units.h>

View File

@ -30,7 +30,7 @@
#ifndef CAMERA_H #ifndef CAMERA_H
#define CAMERA_H #define CAMERA_H
#include "../3d_rendering/3d_render_raytracing/ray.h" #include "../3d_rendering/raytracing/ray.h"
#include <wx/gdicmn.h> // for wxSize #include <wx/gdicmn.h> // for wxSize
#include <vector> #include <vector>

View File

@ -31,7 +31,7 @@
#include <gal/opengl/kiglew.h> // Must be included first #include <gal/opengl/kiglew.h> // Must be included first
#include "3d_model.h" #include "3d_model.h"
#include "ogl_legacy_utils.h" #include "opengl_utils.h"
#include "../common_ogl/ogl_utils.h" #include "../common_ogl/ogl_utils.h"
#include "../3d_math.h" #include "../3d_math.h"
#include <wx/debug.h> #include <wx/debug.h>

View File

@ -23,18 +23,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file 3d_model.h
* @brief Implement a legacy 3D model render.
*/
#ifndef _MODEL_3D_H_ #ifndef _MODEL_3D_H_
#define _MODEL_3D_H_ #define _MODEL_3D_H_
#include <vector> #include <vector>
#include <plugins/3dapi/c3dmodel.h> #include <plugins/3dapi/c3dmodel.h>
#include "../../common_ogl/openGL_includes.h" #include "../../common_ogl/openGL_includes.h"
#include "../3d_render_raytracing/shapes3D/bbox_3d.h" #include "../raytracing/shapes3D/bbox_3d.h"
#include "../../3d_enums.h" #include "../../3d_enums.h"
#include <wx/chartype.h> #include <wx/chartype.h>

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "render_3d_legacy.h" #include "render_3d_opengl.h"
#include "ogl_legacy_utils.h" #include "opengl_utils.h"
#include <board.h> #include <board.h>
#include <footprint.h> #include <footprint.h>
#include "../../3d_math.h" #include "../../3d_math.h"
@ -34,9 +34,9 @@
#include <eda_3d_viewer_frame.h> #include <eda_3d_viewer_frame.h>
void RENDER_3D_LEGACY::addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle, void RENDER_3D_OPENGL::addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle,
TRIANGLE_DISPLAY_LIST* aDstLayer, TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop,
float aZtop, float aZbot ) float aZbot )
{ {
const SFVEC2F& center = aFilledCircle->GetCenter(); const SFVEC2F& center = aFilledCircle->GetCenter();
const float radius = aFilledCircle->GetRadius() * 2.0f; // Double because the render triangle const float radius = aFilledCircle->GetRadius() * 2.0f; // Double because the render triangle
@ -64,7 +64,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const FILLED_CIRCLE_2D* aFilledCircle
} }
void RENDER_3D_LEGACY::addObjectTriangles( const POLYGON_4PT_2D* aPoly, void RENDER_3D_OPENGL::addObjectTriangles( const POLYGON_4PT_2D* aPoly,
TRIANGLE_DISPLAY_LIST* aDstLayer, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot ) float aZtop, float aZbot )
{ {
@ -78,7 +78,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const POLYGON_4PT_2D* aPoly,
} }
void RENDER_3D_LEGACY::generateRing( const SFVEC2F& aCenter, float aInnerRadius, void RENDER_3D_OPENGL::generateRing( const SFVEC2F& aCenter, float aInnerRadius,
float aOuterRadius, unsigned int aNr_sides_per_circle, float aOuterRadius, unsigned int aNr_sides_per_circle,
std::vector< SFVEC2F >& aInnerContourResult, std::vector< SFVEC2F >& aInnerContourResult,
std::vector< SFVEC2F >& aOuterContourResult, std::vector< SFVEC2F >& aOuterContourResult,
@ -112,9 +112,8 @@ void RENDER_3D_LEGACY::generateRing( const SFVEC2F& aCenter, float aInnerRadius,
} }
void RENDER_3D_LEGACY::addObjectTriangles( const RING_2D* aRing, void RENDER_3D_OPENGL::addObjectTriangles( const RING_2D* aRing, TRIANGLE_DISPLAY_LIST* aDstLayer,
TRIANGLE_DISPLAY_LIST* aDstLayer, float aZtop, float aZbot )
float aZtop, float aZbot )
{ {
const SFVEC2F& center = aRing->GetCenter(); const SFVEC2F& center = aRing->GetCenter();
const float inner = aRing->GetInnerRadius(); const float inner = aRing->GetInnerRadius();
@ -147,7 +146,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const RING_2D* aRing,
} }
void RENDER_3D_LEGACY::addObjectTriangles( const TRIANGLE_2D* aTri, void RENDER_3D_OPENGL::addObjectTriangles( const TRIANGLE_2D* aTri,
TRIANGLE_DISPLAY_LIST* aDstLayer, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot ) float aZtop, float aZbot )
{ {
@ -159,7 +158,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const TRIANGLE_2D* aTri,
} }
void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg, void RENDER_3D_OPENGL::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
TRIANGLE_DISPLAY_LIST* aDstLayer, TRIANGLE_DISPLAY_LIST* aDstLayer,
float aZtop, float aZbot ) float aZtop, float aZbot )
{ {
@ -244,7 +243,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
} }
OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateHoles( const LIST_OBJECT2D& aListHolesObject2d, OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateHoles( const LIST_OBJECT2D& aListHolesObject2d,
const SHAPE_POLY_SET& aPoly, float aZtop, const SHAPE_POLY_SET& aPoly, float aZtop,
float aZbot, bool aInvertFaces, float aZbot, bool aInvertFaces,
const BVH_CONTAINER_2D* aThroughHoles ) const BVH_CONTAINER_2D* aThroughHoles )
@ -277,7 +276,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateHoles( const LIST_OBJECT2D& aListH
break; break;
default: default:
wxFAIL_MSG( "RENDER_3D_LEGACY::generateHoles: Object type is not implemented" ); wxFAIL_MSG( "RENDER_3D_OPENGL::generateHoles: Object type is not implemented" );
break; break;
} }
} }
@ -300,7 +299,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateHoles( const LIST_OBJECT2D& aListH
} }
OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D* aContainer, OPENGL_RENDER_LIST* RENDER_3D_OPENGL::generateLayerList( const BVH_CONTAINER_2D* aContainer,
const SHAPE_POLY_SET* aPolyList, const SHAPE_POLY_SET* aPolyList,
PCB_LAYER_ID aLayerId, PCB_LAYER_ID aLayerId,
const BVH_CONTAINER_2D* aThroughHoles ) const BVH_CONTAINER_2D* aThroughHoles )
@ -359,7 +358,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
break; break;
default: default:
wxFAIL_MSG( "RENDER_3D_LEGACY: Object type is not implemented" ); wxFAIL_MSG( "RENDER_3D_OPENGL: Object type is not implemented" );
break; break;
} }
} }
@ -375,7 +374,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
} }
OPENGL_RENDER_LIST* RENDER_3D_LEGACY::createBoard( const SHAPE_POLY_SET& aBoardPoly, OPENGL_RENDER_LIST* RENDER_3D_OPENGL::createBoard( const SHAPE_POLY_SET& aBoardPoly,
const BVH_CONTAINER_2D* aThroughHoles ) const BVH_CONTAINER_2D* aThroughHoles )
{ {
OPENGL_RENDER_LIST* dispLists = nullptr; OPENGL_RENDER_LIST* dispLists = nullptr;
@ -431,7 +430,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::createBoard( const SHAPE_POLY_SET& aBoardP
} }
void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningReporter ) void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningReporter )
{ {
m_reloadRequested = false; m_reloadRequested = false;
@ -662,9 +661,9 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
} }
void RENDER_3D_LEGACY::addTopAndBottomTriangles( TRIANGLE_DISPLAY_LIST* aDst, const SFVEC2F& v0, void RENDER_3D_OPENGL::addTopAndBottomTriangles( TRIANGLE_DISPLAY_LIST* aDst, const SFVEC2F& v0,
const SFVEC2F& v1, const SFVEC2F& v2, const SFVEC2F& v1, const SFVEC2F& v2, float top,
float top, float bot ) float bot )
{ {
aDst->m_layer_bot_triangles->AddTriangle( SFVEC3F( v0.x, v0.y, bot ), aDst->m_layer_bot_triangles->AddTriangle( SFVEC3F( v0.x, v0.y, bot ),
SFVEC3F( v1.x, v1.y, bot ), SFVEC3F( v1.x, v1.y, bot ),
@ -676,8 +675,7 @@ void RENDER_3D_LEGACY::addTopAndBottomTriangles( TRIANGLE_DISPLAY_LIST* aDst, co
} }
void RENDER_3D_LEGACY::getLayerZPos( PCB_LAYER_ID aLayerID, float& aOutZtop, void RENDER_3D_OPENGL::getLayerZPos( PCB_LAYER_ID aLayerID, float& aOutZtop, float& aOutZbot ) const
float& aOutZbot ) const
{ {
aOutZbot = m_boardAdapter.GetLayerBottomZPos( aLayerID ); aOutZbot = m_boardAdapter.GetLayerBottomZPos( aLayerID );
aOutZtop = m_boardAdapter.GetLayerTopZPos( aLayerID ); aOutZtop = m_boardAdapter.GetLayerTopZPos( aLayerID );
@ -691,7 +689,7 @@ void RENDER_3D_LEGACY::getLayerZPos( PCB_LAYER_ID aLayerID, float& aOutZtop,
} }
void RENDER_3D_LEGACY::generateCylinder( const SFVEC2F& aCenter, float aInnerRadius, void RENDER_3D_OPENGL::generateCylinder( const SFVEC2F& aCenter, float aInnerRadius,
float aOuterRadius, float aZtop, float aZbot, float aOuterRadius, float aZtop, float aZbot,
unsigned int aNr_sides_per_circle, unsigned int aNr_sides_per_circle,
TRIANGLE_DISPLAY_LIST* aDstLayer ) TRIANGLE_DISPLAY_LIST* aDstLayer )
@ -725,7 +723,7 @@ void RENDER_3D_LEGACY::generateCylinder( const SFVEC2F& aCenter, float aInnerRad
} }
void RENDER_3D_LEGACY::generateViasAndPads() void RENDER_3D_OPENGL::generateViasAndPads()
{ {
if( !m_boardAdapter.GetBoard() ) if( !m_boardAdapter.GetBoard() )
return; return;
@ -869,7 +867,7 @@ void RENDER_3D_LEGACY::generateViasAndPads()
} }
void RENDER_3D_LEGACY::Load3dModelsIfNeeded() void RENDER_3D_OPENGL::Load3dModelsIfNeeded()
{ {
if( m_3dModelMap.size() > 0 ) if( m_3dModelMap.size() > 0 )
return; return;
@ -887,7 +885,7 @@ void RENDER_3D_LEGACY::Load3dModelsIfNeeded()
} }
void RENDER_3D_LEGACY::load3dModels( REPORTER* aStatusReporter ) void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
{ {
if( !m_boardAdapter.GetBoard() ) if( !m_boardAdapter.GetBoard() )
return; return;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,13 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file clayer_triangles.cpp
*/
#include "layer_triangles.h" #include "layer_triangles.h"
#include "../3d_render_raytracing/ray.h" #include "../raytracing/ray.h"
#include <wx/debug.h> // For the wxASSERT #include <wx/debug.h> // For the wxASSERT
#include <mutex> #include <mutex>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,18 +22,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef TRIANGLE_DISPLAY_LIST_H
* @file layer_triangles.h #define TRIANGLE_DISPLAY_LIST_H
*/
#ifndef TRIANGLE_DISPLAY_LIST_H_
#define TRIANGLE_DISPLAY_LIST_H_
#include "../../common_ogl/openGL_includes.h" #include "../../common_ogl/openGL_includes.h"
#include <plugins/3dapi/xv3d_types.h> #include <plugins/3dapi/xv3d_types.h>
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h> #include <geometry/shape_poly_set.h>
#include <3d_render_raytracing/accelerators/container_2d.h> #include <raytracing/accelerators/container_2d.h>
#include <vector> #include <vector>
#include <mutex> #include <mutex>
@ -245,4 +241,4 @@ private:
bool m_draw_it_transparent; bool m_draw_it_transparent;
}; };
#endif // TRIANGLE_DISPLAY_LIST_H_ #endif // TRIANGLE_DISPLAY_LIST_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,14 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file ogl_legacy_utils.cpp
* @brief
*/
#include "../../common_ogl/openGL_includes.h" #include "../../common_ogl/openGL_includes.h"
#include "ogl_legacy_utils.h" #include "opengl_utils.h"
#include <trigo.h> #include <trigo.h>
#include <wx/debug.h> // For the wxASSERT #include <wx/debug.h> // For the wxASSERT

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,16 +22,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef OPENGL_UTILS_H
* @file ogl_legacy_utils.h #define OPENGL_UTILS_H
* @brief
*/
#ifndef OGL_LEGACY_UTILS_H_ #include "../raytracing/shapes3D/bbox_3d.h"
#define OGL_LEGACY_UTILS_H_ #include "../raytracing/shapes2D/round_segment_2d.h"
#include "../3d_render_raytracing/shapes3D/bbox_3d.h"
#include "../3d_render_raytracing/shapes2D/round_segment_2d.h"
/** /**
* Draw a round arrow. * Draw a round arrow.
@ -70,4 +65,4 @@ void DrawHalfOpenCylinder( unsigned int aNrSidesPerCircle );
*/ */
void DrawSegment( const ROUND_SEGMENT_2D& aSegment, unsigned int aNrSidesPerCircle ); void DrawSegment( const ROUND_SEGMENT_2D& aSegment, unsigned int aNrSidesPerCircle );
#endif // OGL_LEGACY_UTILS_H_ #endif // OPENGL_UTILS_H

View File

@ -24,8 +24,8 @@
#include <gal/opengl/kiglew.h> // Must be included first #include <gal/opengl/kiglew.h> // Must be included first
#include "render_3d_legacy.h" #include "render_3d_opengl.h"
#include "ogl_legacy_utils.h" #include "opengl_utils.h"
#include "common_ogl/ogl_utils.h" #include "common_ogl/ogl_utils.h"
#include <footprint.h> #include <footprint.h>
#include <3d_math.h> #include <3d_math.h>
@ -39,10 +39,11 @@
*/ */
#define UNITS3D_TO_UNITSPCB (IU_PER_MM) #define UNITS3D_TO_UNITSPCB (IU_PER_MM)
RENDER_3D_LEGACY::RENDER_3D_LEGACY( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) : RENDER_3D_OPENGL::RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter,
CAMERA& aCamera ) :
RENDER_3D_BASE( aCanvas, aAdapter, aCamera ) RENDER_3D_BASE( aCanvas, aAdapter, aCamera )
{ {
wxLogTrace( m_logTrace, wxT( "RENDER_3D_LEGACY::RENDER_3D_LEGACY" ) ); wxLogTrace( m_logTrace, wxT( "RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
m_layers.clear(); m_layers.clear();
m_outerLayerHoles.clear(); m_outerLayerHoles.clear();
@ -70,9 +71,9 @@ RENDER_3D_LEGACY::RENDER_3D_LEGACY( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdap
} }
RENDER_3D_LEGACY::~RENDER_3D_LEGACY() RENDER_3D_OPENGL::~RENDER_3D_OPENGL()
{ {
wxLogTrace( m_logTrace, wxT( "RENDER_3D_LEGACY::~RENDER_3D_LEGACY" ) ); wxLogTrace( m_logTrace, wxT( "RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
freeAllLists(); freeAllLists();
@ -80,13 +81,13 @@ RENDER_3D_LEGACY::~RENDER_3D_LEGACY()
} }
int RENDER_3D_LEGACY::GetWaitForEditingTimeOut() int RENDER_3D_OPENGL::GetWaitForEditingTimeOut()
{ {
return 50; // ms return 50; // ms
} }
void RENDER_3D_LEGACY::SetCurWindowSize( const wxSize& aSize ) void RENDER_3D_OPENGL::SetCurWindowSize( const wxSize& aSize )
{ {
if( m_windowSize != aSize ) if( m_windowSize != aSize )
{ {
@ -98,7 +99,7 @@ void RENDER_3D_LEGACY::SetCurWindowSize( const wxSize& aSize )
} }
void RENDER_3D_LEGACY::setLightFront( bool enabled ) void RENDER_3D_OPENGL::setLightFront( bool enabled )
{ {
if( enabled ) if( enabled )
glEnable( GL_LIGHT0 ); glEnable( GL_LIGHT0 );
@ -107,7 +108,7 @@ void RENDER_3D_LEGACY::setLightFront( bool enabled )
} }
void RENDER_3D_LEGACY::setLightTop( bool enabled ) void RENDER_3D_OPENGL::setLightTop( bool enabled )
{ {
if( enabled ) if( enabled )
glEnable( GL_LIGHT1 ); glEnable( GL_LIGHT1 );
@ -116,7 +117,7 @@ void RENDER_3D_LEGACY::setLightTop( bool enabled )
} }
void RENDER_3D_LEGACY::setLightBottom( bool enabled ) void RENDER_3D_OPENGL::setLightBottom( bool enabled )
{ {
if( enabled ) if( enabled )
glEnable( GL_LIGHT2 ); glEnable( GL_LIGHT2 );
@ -125,7 +126,7 @@ void RENDER_3D_LEGACY::setLightBottom( bool enabled )
} }
void RENDER_3D_LEGACY::render3dArrows() void RENDER_3D_OPENGL::render3dArrows()
{ {
const float arrow_size = RANGE_SCALE_3D * 0.30f; const float arrow_size = RANGE_SCALE_3D * 0.30f;
@ -164,7 +165,7 @@ void RENDER_3D_LEGACY::render3dArrows()
} }
void RENDER_3D_LEGACY::setupMaterials() void RENDER_3D_OPENGL::setupMaterials()
{ {
m_materials = {}; m_materials = {};
@ -313,7 +314,7 @@ void RENDER_3D_LEGACY::setupMaterials()
} }
void RENDER_3D_LEGACY::setLayerMaterial( PCB_LAYER_ID aLayerID ) void RENDER_3D_OPENGL::setLayerMaterial( PCB_LAYER_ID aLayerID )
{ {
switch( aLayerID ) switch( aLayerID )
{ {
@ -390,7 +391,7 @@ void RENDER_3D_LEGACY::setLayerMaterial( PCB_LAYER_ID aLayerID )
} }
SFVEC4F RENDER_3D_LEGACY::getLayerColor( PCB_LAYER_ID aLayerID ) SFVEC4F RENDER_3D_OPENGL::getLayerColor( PCB_LAYER_ID aLayerID )
{ {
SFVEC4F layerColor = m_boardAdapter.GetLayerColor( aLayerID ); SFVEC4F layerColor = m_boardAdapter.GetLayerColor( aLayerID );
@ -494,13 +495,13 @@ void init_lights( void )
} }
void RENDER_3D_LEGACY::setCopperMaterial() void RENDER_3D_OPENGL::setCopperMaterial()
{ {
OglSetMaterial( m_materials.m_NonPlatedCopper, 1.0f ); OglSetMaterial( m_materials.m_NonPlatedCopper, 1.0f );
} }
void RENDER_3D_LEGACY::setPlatedCopperAndDepthOffset( PCB_LAYER_ID aLayer_id ) void RENDER_3D_OPENGL::setPlatedCopperAndDepthOffset( PCB_LAYER_ID aLayer_id )
{ {
glEnable( GL_POLYGON_OFFSET_FILL ); glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset(-0.1f, -2.0f ); glPolygonOffset(-0.1f, -2.0f );
@ -508,13 +509,13 @@ void RENDER_3D_LEGACY::setPlatedCopperAndDepthOffset( PCB_LAYER_ID aLayer_id )
} }
void RENDER_3D_LEGACY::unsetDepthOffset() void RENDER_3D_OPENGL::unsetDepthOffset()
{ {
glDisable( GL_POLYGON_OFFSET_FILL ); glDisable( GL_POLYGON_OFFSET_FILL );
} }
void RENDER_3D_LEGACY::renderBoardBody( bool aSkipRenderHoles ) void RENDER_3D_OPENGL::renderBoardBody( bool aSkipRenderHoles )
{ {
m_materials.m_EpoxyBoard.m_Diffuse = m_boardAdapter.m_BoardBodyColor; m_materials.m_EpoxyBoard.m_Diffuse = m_boardAdapter.m_BoardBodyColor;
@ -542,7 +543,7 @@ void RENDER_3D_LEGACY::renderBoardBody( bool aSkipRenderHoles )
} }
bool RENDER_3D_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter, bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
REPORTER* aWarningReporter ) REPORTER* aWarningReporter )
{ {
// Initialize OpenGL // Initialize OpenGL
@ -973,7 +974,7 @@ bool RENDER_3D_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
} }
bool RENDER_3D_LEGACY::initializeOpenGL() bool RENDER_3D_OPENGL::initializeOpenGL()
{ {
glEnable( GL_LINE_SMOOTH ); glEnable( GL_LINE_SMOOTH );
glShadeModel( GL_SMOOTH ); glShadeModel( GL_SMOOTH );
@ -1016,7 +1017,7 @@ bool RENDER_3D_LEGACY::initializeOpenGL()
} }
void RENDER_3D_LEGACY::setArrowMaterial() void RENDER_3D_OPENGL::setArrowMaterial()
{ {
glEnable( GL_COLOR_MATERIAL ); glEnable( GL_COLOR_MATERIAL );
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
@ -1035,7 +1036,7 @@ void RENDER_3D_LEGACY::setArrowMaterial()
} }
void RENDER_3D_LEGACY::freeAllLists() void RENDER_3D_OPENGL::freeAllLists()
{ {
if( glIsList( m_grid ) ) if( glIsList( m_grid ) )
glDeleteLists( m_grid, 1 ); glDeleteLists( m_grid, 1 );
@ -1117,7 +1118,7 @@ void RENDER_3D_LEGACY::freeAllLists()
} }
void RENDER_3D_LEGACY::renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPosition, void RENDER_3D_OPENGL::renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPosition,
bool aDrawMiddleSegments, bool aSkipRenderHoles ) bool aDrawMiddleSegments, bool aSkipRenderHoles )
{ {
wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) ); wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) );
@ -1175,7 +1176,7 @@ void RENDER_3D_LEGACY::renderSolderMaskLayer( PCB_LAYER_ID aLayerID, float aZPos
} }
void RENDER_3D_LEGACY::render3dModelsSelected( bool aRenderTopOrBot, bool aRenderTransparentOnly, void RENDER_3D_OPENGL::render3dModelsSelected( bool aRenderTopOrBot, bool aRenderTransparentOnly,
bool aRenderSelectedOnly ) bool aRenderSelectedOnly )
{ {
if( !m_boardAdapter.GetBoard() ) if( !m_boardAdapter.GetBoard() )
@ -1214,7 +1215,7 @@ void RENDER_3D_LEGACY::render3dModelsSelected( bool aRenderTopOrBot, bool aRende
} }
void RENDER_3D_LEGACY::render3dModels( bool aRenderTopOrBot, bool aRenderTransparentOnly ) void RENDER_3D_OPENGL::render3dModels( bool aRenderTopOrBot, bool aRenderTransparentOnly )
{ {
if( m_boardAdapter.GetFlag( FL_USE_SELECTION ) ) if( m_boardAdapter.GetFlag( FL_USE_SELECTION ) )
render3dModelsSelected( aRenderTopOrBot, aRenderTransparentOnly, true ); render3dModelsSelected( aRenderTopOrBot, aRenderTransparentOnly, true );
@ -1223,7 +1224,7 @@ void RENDER_3D_LEGACY::render3dModels( bool aRenderTopOrBot, bool aRenderTranspa
} }
void RENDER_3D_LEGACY::renderFootprint( const FOOTPRINT* aFootprint, bool aRenderTransparentOnly, void RENDER_3D_OPENGL::renderFootprint( const FOOTPRINT* aFootprint, bool aRenderTransparentOnly,
bool aIsSelected ) bool aIsSelected )
{ {
if( !aFootprint->Models().empty() ) if( !aFootprint->Models().empty() )
@ -1324,7 +1325,7 @@ void RENDER_3D_LEGACY::renderFootprint( const FOOTPRINT* aFootprint, bool aRende
} }
void RENDER_3D_LEGACY::generate3dGrid( GRID3D_TYPE aGridType ) void RENDER_3D_OPENGL::generate3dGrid( GRID3D_TYPE aGridType )
{ {
if( glIsList( m_grid ) ) if( glIsList( m_grid ) )
glDeleteLists( m_grid, 1 ); glDeleteLists( m_grid, 1 );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,22 +22,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef RENDER_3D_OPENGL_H
* @file render_3d_legacy.h #define RENDER_3D_OPENGL_H
*/
#ifndef RENDER_3D_LEGACY_H_
#define RENDER_3D_LEGACY_H_
#include "../render_3d_base.h" #include "../render_3d_base.h"
#include "layer_triangles.h" #include "layer_triangles.h"
#include "../3d_render_raytracing/shapes2D/polygon_2d.h" #include "../raytracing/shapes2D/polygon_2d.h"
#include "../3d_render_raytracing/shapes2D/triangle_2d.h" #include "../raytracing/shapes2D/triangle_2d.h"
#include "../3d_render_raytracing/shapes2D/4pt_polygon_2d.h" #include "../raytracing/shapes2D/4pt_polygon_2d.h"
#include "../3d_render_raytracing/shapes2D/filled_circle_2d.h" #include "../raytracing/shapes2D/filled_circle_2d.h"
#include "../3d_render_raytracing/shapes2D/ring_2d.h" #include "../raytracing/shapes2D/ring_2d.h"
#include "../3d_render_raytracing/shapes2D/round_segment_2d.h" #include "../raytracing/shapes2D/round_segment_2d.h"
#include "3d_model.h" #include "3d_model.h"
@ -53,14 +49,14 @@ typedef std::map< wxString, MODEL_3D* > MAP_3DMODEL;
#define SIZE_OF_CIRCLE_TEXTURE 1024 #define SIZE_OF_CIRCLE_TEXTURE 1024
/** /**
* Object to render the board using openGL legacy mode. * Object to render the board using openGL.
*/ */
class RENDER_3D_LEGACY : public RENDER_3D_BASE class RENDER_3D_OPENGL : public RENDER_3D_BASE
{ {
public: public:
explicit RENDER_3D_LEGACY( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ); explicit RENDER_3D_OPENGL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera );
~RENDER_3D_LEGACY(); ~RENDER_3D_OPENGL();
void SetCurWindowSize( const wxSize& aSize ) override; void SetCurWindowSize( const wxSize& aSize ) override;
bool Redraw( bool aIsMoving, REPORTER* aStatusReporter, REPORTER* aWarningReporter ) override; bool Redraw( bool aIsMoving, REPORTER* aStatusReporter, REPORTER* aWarningReporter ) override;
@ -220,4 +216,4 @@ private:
///< outline. ///< outline.
}; };
#endif // RENDER_3D_LEGACY_H_ #endif // RENDER_3D_OPENGL_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2021 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
@ -40,8 +40,6 @@
#include "PerlinNoise.h" #include "PerlinNoise.h"
#include <cmath> #include <cmath>
#include <iostream>
#include <cmath>
#include <random> #include <random>
#include <algorithm> #include <algorithm>
#include <numeric> #include <numeric>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2021 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

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file 3d-viewer/3d_rendering/3d_render_raytracing/create_scene.cpp
*/
#include "render_3d_raytrace.h" #include "render_3d_raytrace.h"
#include "shapes3D/plane_3d.h" #include "shapes3D/plane_3d.h"
#include "shapes3D/round_segment_3d.h" #include "shapes3D/round_segment_3d.h"

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2017 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2017 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file frustum.cpp
*/
#include "frustum.h" #include "frustum.h"

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file hitinfo.h
* @brief
*/
#ifndef _HITINFO_H_ #ifndef _HITINFO_H_
#define _HITINFO_H_ #define _HITINFO_H_

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -27,8 +27,8 @@
* @brief Declare and implement light sources. * @brief Declare and implement light sources.
*/ */
#ifndef _LIGHT_H_ #ifndef LIGHT_H
#define _LIGHT_H_ #define LIGHT_H
#include "ray.h" #include "ray.h"
#include "hitinfo.h" #include "hitinfo.h"
@ -145,4 +145,4 @@ private:
}; };
#endif // _LIGHT_H_ #endif // LIGHT_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file material.cpp
*/
#include "material.h" #include "material.h"
#include <3d_math.h> #include <3d_math.h>
#include <wx/debug.h> #include <wx/debug.h>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,12 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef MATERIAL_H
* @file material.h #define MATERIAL_H
*/
#ifndef _MATERIAL_H_
#define _MATERIAL_H_
#include "ray.h" #include "ray.h"
#include "hitinfo.h" #include "hitinfo.h"
@ -395,4 +391,4 @@ public:
const SFVEC3F& aLightColor, float aShadowAttenuationFactor ) const override; const SFVEC3F& aLightColor, float aShadowAttenuationFactor ) const override;
}; };
#endif // _MATERIAL_H_ #endif // MATERIAL_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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

View File

@ -22,12 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file ray.cpp
* @brief
*/
#include "ray.h" #include "ray.h"
#include "../../3d_fastmath.h" #include "../../3d_fastmath.h"
#include <cstdio> #include <cstdio>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2017 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2017 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,13 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef RAY_H
* @file ray.h #define RAY_H
* @brief
*/
#ifndef _RAY_H_
#define _RAY_H_
#include <plugins/3dapi/xv3d_types.h> #include <plugins/3dapi/xv3d_types.h>
@ -165,4 +160,4 @@ struct RAY4
#endif #endif
#endif // _RAY_H_ #endif // RAY_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file raypacket.cpp
* @brief
*/
#include "raypacket.h" #include "raypacket.h"
#include "../3d_fastmath.h" #include "../3d_fastmath.h"
#include <wx/debug.h> #include <wx/debug.h>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,13 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef RAYPACKET_H
* @file raypacket.h #define RAYPACKET_H
* @brief
*/
#ifndef _RAYPACKET_H_
#define _RAYPACKET_H_
#include "ray.h" #include "ray.h"
#include "frustum.h" #include "frustum.h"
@ -65,4 +60,4 @@ void RAYPACKET_InitRays_with2DDisplacement( const CAMERA& aCamera, const SFVEC2F
const SFVEC2F& a2DWindowsPosDisplacementFactor, const SFVEC2F& a2DWindowsPosDisplacementFactor,
RAY* aRayPck ); RAY* aRayPck );
#endif // _RAYPACKET_H_ #endif // RAYPACKET_H

View File

@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file render_3d_raytrace.cpp
*/
#include <gal/opengl/kiglew.h> // Must be included first #include <gal/opengl/kiglew.h> // Must be included first
#include <algorithm> #include <algorithm>
@ -297,7 +293,7 @@ void RENDER_3D_RAYTRACE::render( GLubyte* ptrPBO, REPORTER* aStatusReporter )
if( m_cameraLight ) if( m_cameraLight )
m_cameraLight->SetDirection( -m_camera.GetDir() ); m_cameraLight->SetDirection( -m_camera.GetDir() );
if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
{ {
// Set all pixels of PBO transparent (Alpha to 0) // Set all pixels of PBO transparent (Alpha to 0)
// This way it will draw the full buffer but only shows the updated ( // This way it will draw the full buffer but only shows the updated (

View File

@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file render_3d_raytrace.h
*/
#ifndef RENDER_3D_RAYTRACE_H #ifndef RENDER_3D_RAYTRACE_H
#define RENDER_3D_RAYTRACE_H #define RENDER_3D_RAYTRACE_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file layer_item_3d.cpp
*/
#include "layer_item_3d.h" #include "layer_item_3d.h"
#include "3d_fastmath.h" #include "3d_fastmath.h"
#include <wx/debug.h> #include <wx/debug.h>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 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
@ -22,12 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/** #ifndef LAYER_ITEM_H
* @file layer_item_3d.h #define LAYER_ITEM_H
*/
#ifndef _LAYER_ITEM_H_
#define _LAYER_ITEM_H_
#include "object_3d.h" #include "object_3d.h"
#include "../shapes2D/object_2d.h" #include "../shapes2D/object_2d.h"
@ -52,4 +48,4 @@ private:
SFVEC3F m_diffusecolor; SFVEC3F m_diffusecolor;
}; };
#endif // _LAYER_ITEM_H_ #endif // LAYER_ITEM_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2021 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
@ -28,12 +28,12 @@
* @brief it run only once and only in debug build * @brief it run only once and only in debug build
*/ */
#include "3d_render_raytracing/frustum.h" #include "raytracing/frustum.h"
#include "3d_render_raytracing/shapes2D/bbox_2d.h" #include "raytracing/shapes2D/bbox_2d.h"
#include "3d_render_raytracing/shapes2D/filled_circle_2d.h" #include "raytracing/shapes2D/filled_circle_2d.h"
#include "3d_render_raytracing/shapes2D/polygon_2d.h" #include "raytracing/shapes2D/polygon_2d.h"
#include "3d_render_raytracing/shapes2D/round_segment_2d.h" #include "raytracing/shapes2D/round_segment_2d.h"
#include "3d_render_raytracing/shapes3D/bbox_3d.h" #include "raytracing/shapes3D/bbox_3d.h"
#include <wx/debug.h> #include <wx/debug.h>
//#ifdef DEBUG //#ifdef DEBUG

View File

@ -195,7 +195,7 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions()
auto raytracingCondition = auto raytracingCondition =
[this]( const SELECTION& aSel ) [this]( const SELECTION& aSel )
{ {
return m_boardAdapter.GetRenderEngine() != RENDER_ENGINE::OPENGL_LEGACY; return m_boardAdapter.GetRenderEngine() != RENDER_ENGINE::OPENGL;
}; };
RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW,
@ -265,14 +265,14 @@ void EDA_3D_VIEWER_FRAME::NewDisplay( bool aForceImmediateRedraw )
void EDA_3D_VIEWER_FRAME::Redraw() void EDA_3D_VIEWER_FRAME::Redraw()
{ {
// Only update in OpenGL for an interactive interaction // Only update in OpenGL for an interactive interaction
if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh( true ); m_canvas->Request_refresh( true );
} }
void EDA_3D_VIEWER_FRAME::refreshRender() void EDA_3D_VIEWER_FRAME::refreshRender()
{ {
if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
NewDisplay( true ); NewDisplay( true );
@ -351,10 +351,10 @@ void EDA_3D_VIEWER_FRAME::OnRenderEngineSelection( wxCommandEvent &event )
{ {
const RENDER_ENGINE old_engine = m_boardAdapter.GetRenderEngine(); const RENDER_ENGINE old_engine = m_boardAdapter.GetRenderEngine();
if( old_engine == RENDER_ENGINE::OPENGL_LEGACY ) if( old_engine == RENDER_ENGINE::OPENGL )
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::RAYTRACING ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::RAYTRACING );
else else
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL_LEGACY ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL );
wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::OnRenderEngineSelection type %s ", wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::OnRenderEngineSelection type %s ",
( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::RAYTRACING ) ? "Raytrace" : ( m_boardAdapter.GetRenderEngine() == RENDER_ENGINE::RAYTRACING ) ? "Raytrace" :
@ -370,7 +370,7 @@ void EDA_3D_VIEWER_FRAME::OnDisableRayTracing( wxCommandEvent& aEvent )
wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::%s disabling ray tracing.", __WXFUNCTION__ ); wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::%s disabling ray tracing.", __WXFUNCTION__ );
m_disable_ray_tracing = true; m_disable_ray_tracing = true;
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL_LEGACY ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL );
} }
@ -506,7 +506,7 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
"EDA_3D_VIEWER_FRAME::LoadSettings render setting Ray Trace" : "EDA_3D_VIEWER_FRAME::LoadSettings render setting Ray Trace" :
"EDA_3D_VIEWER_FRAME::LoadSettings render setting OpenGL" ); "EDA_3D_VIEWER_FRAME::LoadSettings render setting OpenGL" );
#else #else
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL_LEGACY ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL );
#endif #endif
m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) ); m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );

View File

@ -38,8 +38,8 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS()
m_Camera() m_Camera()
{ {
m_params.emplace_back( new PARAM<int>( "render.engine", &m_Render.engine, m_params.emplace_back( new PARAM<int>( "render.engine", &m_Render.engine,
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ), static_cast<int>( RENDER_ENGINE::OPENGL ),
static_cast<int>( RENDER_ENGINE::OPENGL_LEGACY ), static_cast<int>( RENDER_ENGINE::OPENGL ),
static_cast<int>( RENDER_ENGINE::RAYTRACING ) ) ); static_cast<int>( RENDER_ENGINE::RAYTRACING ) ) );
m_params.emplace_back( new PARAM<int>( "render.grid_type", &m_Render.grid_type, m_params.emplace_back( new PARAM<int>( "render.grid_type", &m_Render.grid_type,

View File

@ -29,7 +29,7 @@
#include <kiface_base.h> #include <kiface_base.h>
#include <tools/eda_3d_controller.h> #include <tools/eda_3d_controller.h>
#include "eda_3d_actions.h" #include "eda_3d_actions.h"
#include <3d_rendering/legacy/render_3d_legacy.h> #include <3d_rendering/opengl/render_3d_opengl.h>
bool EDA_3D_CONTROLLER::Init() bool EDA_3D_CONTROLLER::Init()
@ -162,7 +162,7 @@ int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent )
default: wxFAIL; break; default: wxFAIL; break;
} }
if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
m_canvas->RenderRaytracingRequest(); m_canvas->RenderRaytracingRequest();
@ -190,7 +190,7 @@ int EDA_3D_CONTROLLER::ToggleOrtho( const TOOL_EVENT& aEvent )
{ {
m_camera->ToggleProjection(); m_camera->ToggleProjection();
if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
m_canvas->RenderRaytracingRequest(); m_canvas->RenderRaytracingRequest();
@ -218,7 +218,7 @@ int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
case FL_RENDER_RAYTRACING_REFRACTIONS: case FL_RENDER_RAYTRACING_REFRACTIONS:
case FL_RENDER_RAYTRACING_REFLECTIONS: case FL_RENDER_RAYTRACING_REFLECTIONS:
case FL_RENDER_RAYTRACING_ANTI_ALIASING: case FL_RENDER_RAYTRACING_ANTI_ALIASING:
if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
else else
m_canvas->RenderRaytracingRequest(); m_canvas->RenderRaytracingRequest();
@ -229,9 +229,9 @@ int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent )
case FL_FP_ATTRIBUTES_NORMAL_INSERT: case FL_FP_ATTRIBUTES_NORMAL_INSERT:
case FL_FP_ATTRIBUTES_VIRTUAL: case FL_FP_ATTRIBUTES_VIRTUAL:
// Loading 3D shapes can be needed if not yet loaded // Loading 3D shapes can be needed if not yet loaded
if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter->GetRenderEngine() == RENDER_ENGINE::OPENGL )
{ {
RENDER_3D_LEGACY* render = static_cast< RENDER_3D_LEGACY* > ( m_canvas->GetCurrentRender() ); RENDER_3D_OPENGL* render = static_cast<RENDER_3D_OPENGL*>( m_canvas->GetCurrentRender() );
render->Load3dModelsIfNeeded(); render->Load3dModelsIfNeeded();
m_canvas->Request_refresh(); m_canvas->Request_refresh();
} }

View File

@ -15,8 +15,8 @@ include_directories(
) )
# directories # directories
set( DIR_DLG 3d_cache/dialogs ) set( DIR_DLG dialogs )
set( DIR_RAY 3d_rendering/3d_render_raytracing ) set( DIR_RAY 3d_rendering/raytracing )
set( DIR_RAY_ACC ${DIR_RAY}/accelerators ) set( DIR_RAY_ACC ${DIR_RAY}/accelerators )
set( DIR_RAY_2D ${DIR_RAY}/shapes2D ) set( DIR_RAY_2D ${DIR_RAY}/shapes2D )
set( DIR_RAY_3D ${DIR_RAY}/shapes3D ) set( DIR_RAY_3D ${DIR_RAY}/shapes3D )
@ -39,11 +39,11 @@ set(3D-VIEWER_SRCS
3d_canvas/eda_3d_canvas.cpp 3d_canvas/eda_3d_canvas.cpp
3d_canvas/eda_3d_canvas_pivot.cpp 3d_canvas/eda_3d_canvas_pivot.cpp
3d_model_viewer/eda_3d_model_viewer.cpp 3d_model_viewer/eda_3d_model_viewer.cpp
3d_rendering/legacy/3d_model.cpp 3d_rendering/opengl/3d_model.cpp
3d_rendering/legacy/ogl_legacy_utils.cpp 3d_rendering/opengl/opengl_utils.cpp
3d_rendering/legacy/create_scene.cpp 3d_rendering/opengl/create_scene.cpp
3d_rendering/legacy/render_3d_legacy.cpp 3d_rendering/opengl/render_3d_opengl.cpp
3d_rendering/legacy/layer_triangles.cpp 3d_rendering/opengl/layer_triangles.cpp
${DIR_RAY_ACC}/accelerator_3d.cpp ${DIR_RAY_ACC}/accelerator_3d.cpp
${DIR_RAY_ACC}/bvh_packet_traversal.cpp ${DIR_RAY_ACC}/bvh_packet_traversal.cpp
${DIR_RAY_ACC}/bvh_pbrt.cpp ${DIR_RAY_ACC}/bvh_pbrt.cpp

View File

@ -204,7 +204,7 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
if( cfg ) if( cfg )
{ {
m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL_LEGACY ); m_boardAdapter.SetRenderEngine( RENDER_ENGINE::OPENGL );
m_boardAdapter.SetFlag( FL_USE_REALISTIC_MODE, cfg->m_Render.realistic ); m_boardAdapter.SetFlag( FL_USE_REALISTIC_MODE, cfg->m_Render.realistic );
m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) ); m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );

View File

@ -39,7 +39,7 @@
#include <footprint_editor_settings.h> #include <footprint_editor_settings.h>
#include <dialog_footprint_properties_fp_editor.h> #include <dialog_footprint_properties_fp_editor.h>
#include <panel_fp_properties_3d_model.h> #include <panel_fp_properties_3d_model.h>
#include "3d_rendering/legacy/3d_model.h" #include "3d_rendering/opengl/3d_model.h"
#include "filename_resolver.h" #include "filename_resolver.h"
#include <pgm_base.h> #include <pgm_base.h>
#include "dialogs/panel_preview_3d_model.h" #include "dialogs/panel_preview_3d_model.h"