KiCad PCB EDA Suite
Loading...
Searching...
No Matches
object_3d.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29#include "object_3d.h"
30#include <board_item.h>
31#include "../hitinfo.h"
32#include <map>
33
34
36
38
39
41{
42 m_obj_type = aObjType;
46 m_boardItem = nullptr;
47}
48
49
50/*
51 * Lookup table for OBJECT_2D_TYPE printed names
52 */
53// clang-format off
54const std::map<OBJECT_3D_TYPE, const char*> objectTypeNames
55{
56 { OBJECT_3D_TYPE::CYLINDER, "OBJECT_3D_TYPE::CYLINDER" },
57 { OBJECT_3D_TYPE::DUMMYBLOCK, "OBJECT_3D_TYPE::DUMMY_BLOCK" },
58 { OBJECT_3D_TYPE::LAYERITEM, "OBJECT_3D_TYPE::LAYER_ITEM" },
59 { OBJECT_3D_TYPE::XYPLANE, "OBJECT_3D_TYPE::XY_PLANE" },
60 { OBJECT_3D_TYPE::ROUNDSEG, "OBJECT_3D_TYPE::ROUND_SEG" },
61 { OBJECT_3D_TYPE::TRIANGLE, "OBJECT_3D_TYPE::TRIANGLE" }
62};
63// clang-format on
64
65
66// void OBJECT_3D_STATS::PrintStats()
67// {
68// wxLogDebug( "OBJECT_3D_STATS:\n" );
69
70// for( auto& objectType : objectTypeNames )
71// {
72// wxLogDebug( " %20s %u\n", objectType.second,
73// m_counter[static_cast<int>( objectType.first )] );
74// }
75// }
Blinn Phong based material https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model.
Definition: material.h:379
Implements a class for object statistics using Singleton pattern.
Definition: object_3d.h:113
static OBJECT_3D_STATS & Instance()
Definition: object_3d.h:132
static OBJECT_3D_STATS * s_instance
Definition: object_3d.h:148
void AddOne(OBJECT_3D_TYPE aObjType)
Definition: object_3d.h:125
BOARD_ITEM * m_boardItem
Definition: object_3d.h:102
OBJECT_3D_TYPE m_obj_type
Definition: object_3d.h:99
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition: object_3d.cpp:40
float m_modelTransparency
Definition: object_3d.h:106
const MATERIAL * m_material
Definition: object_3d.h:100
static const BLINN_PHONG_MATERIAL s_defaultMaterial
Definition: object_3d.cpp:37
const std::map< OBJECT_3D_TYPE, const char * > objectTypeNames
Definition: object_3d.cpp:55
OBJECT_3D_TYPE
Definition: object_3d.h:39