2016-07-19 17:35:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
2020-08-18 14:17:16 +00:00
|
|
|
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-07-19 17:35:25 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cobject.cpp
|
|
|
|
* @brief
|
|
|
|
*/
|
|
|
|
|
2021-01-03 22:23:00 +00:00
|
|
|
#include "object_3d.h"
|
2021-01-05 22:19:00 +00:00
|
|
|
#include <board_item.h>
|
|
|
|
#include "../hitinfo.h"
|
2019-12-30 13:01:06 +00:00
|
|
|
#include <map>
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
|
2021-01-02 21:05:29 +00:00
|
|
|
OBJECT_3D_STATS* OBJECT_3D_STATS::s_instance = 0;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2021-01-02 21:05:29 +00:00
|
|
|
static const BLINN_PHONG_MATERIAL s_defaultMaterial = BLINN_PHONG_MATERIAL();
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2020-12-11 13:51:42 +00:00
|
|
|
|
2021-01-02 21:05:29 +00:00
|
|
|
OBJECT_3D::OBJECT_3D( OBJECT_3D_TYPE aObjType )
|
2016-07-19 17:35:25 +00:00
|
|
|
{
|
|
|
|
m_obj_type = aObjType;
|
2021-01-02 21:05:29 +00:00
|
|
|
OBJECT_3D_STATS::Instance().AddOne( aObjType );
|
2016-07-19 17:35:25 +00:00
|
|
|
m_material = &s_defaultMaterial;
|
2020-04-25 14:38:41 +00:00
|
|
|
m_modelTransparency = 0.0f;
|
2020-09-04 00:00:56 +00:00
|
|
|
m_boardItem = nullptr;
|
2016-07-19 17:35:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-12-30 13:01:06 +00:00
|
|
|
/*
|
2021-01-02 21:05:29 +00:00
|
|
|
* Lookup table for OBJECT_2D_TYPE printed names
|
2019-12-30 13:01:06 +00:00
|
|
|
*/
|
|
|
|
// clang-format off
|
2021-01-02 21:05:29 +00:00
|
|
|
const std::map<OBJECT_3D_TYPE, const char*> objectTypeNames
|
2020-04-25 14:38:41 +00:00
|
|
|
{
|
2021-01-02 21:05:29 +00:00
|
|
|
{ OBJECT_3D_TYPE::CYLINDER, "OBJECT_3D_TYPE::CYLINDER" },
|
|
|
|
{ OBJECT_3D_TYPE::DUMMYBLOCK, "OBJECT_3D_TYPE::DUMMY_BLOCK" },
|
|
|
|
{ OBJECT_3D_TYPE::LAYERITEM, "OBJECT_3D_TYPE::LAYER_ITEM" },
|
|
|
|
{ OBJECT_3D_TYPE::XYPLANE, "OBJECT_3D_TYPE::XY_PLANE" },
|
|
|
|
{ OBJECT_3D_TYPE::ROUNDSEG, "OBJECT_3D_TYPE::ROUND_SEG" },
|
|
|
|
{ OBJECT_3D_TYPE::TRIANGLE, "OBJECT_3D_TYPE::TRIANGLE" }
|
2016-07-19 17:35:25 +00:00
|
|
|
};
|
2019-12-30 13:01:06 +00:00
|
|
|
// clang-format on
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
|
2021-05-03 20:07:16 +00:00
|
|
|
// void OBJECT_3D_STATS::PrintStats()
|
|
|
|
// {
|
|
|
|
// wxLogDebug( "OBJECT_3D_STATS:\n" );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2021-05-03 20:07:16 +00:00
|
|
|
// for( auto& objectType : objectTypeNames )
|
|
|
|
// {
|
|
|
|
// wxLogDebug( " %20s %u\n", objectType.second,
|
|
|
|
// m_counter[static_cast<int>( objectType.first )] );
|
|
|
|
// }
|
|
|
|
// }
|