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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#include "object_3d.h"
26#include <board_item.h>
27#include "../hitinfo.h"
28#include <map>
29
30
32
34
35
37{
38 m_obj_type = aObjType;
42 m_boardItem = nullptr;
43}
44
45
46/*
47 * Lookup table for OBJECT_2D_TYPE printed names
48 */
49// clang-format off
50const std::map<OBJECT_3D_TYPE, const char*> objectTypeNames
51{
52 { OBJECT_3D_TYPE::CYLINDER, "OBJECT_3D_TYPE::CYLINDER" },
53 { OBJECT_3D_TYPE::DUMMYBLOCK, "OBJECT_3D_TYPE::DUMMY_BLOCK" },
54 { OBJECT_3D_TYPE::LAYERITEM, "OBJECT_3D_TYPE::LAYER_ITEM" },
55 { OBJECT_3D_TYPE::XYPLANE, "OBJECT_3D_TYPE::XY_PLANE" },
56 { OBJECT_3D_TYPE::ROUNDSEG, "OBJECT_3D_TYPE::ROUND_SEG" },
57 { OBJECT_3D_TYPE::TRIANGLE, "OBJECT_3D_TYPE::TRIANGLE" }
58};
59// clang-format on
60
61
62// void OBJECT_3D_STATS::PrintStats()
63// {
64// wxLogDebug( "OBJECT_3D_STATS:\n" );
65
66// for( auto& objectType : objectTypeNames )
67// {
68// wxLogDebug( " %20s %u\n", objectType.second,
69// m_counter[static_cast<int>( objectType.first )] );
70// }
71// }
Blinn Phong based material https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model.
Definition material.h:375
Implements a class for object statistics using Singleton pattern.
Definition object_3d.h:109
static OBJECT_3D_STATS & Instance()
Definition object_3d.h:128
static OBJECT_3D_STATS * s_instance
Definition object_3d.h:144
void AddOne(OBJECT_3D_TYPE aObjType)
Definition object_3d.h:121
BOARD_ITEM * m_boardItem
Definition object_3d.h:98
OBJECT_3D_TYPE m_obj_type
Definition object_3d.h:95
OBJECT_3D(OBJECT_3D_TYPE aObjType)
Definition object_3d.cpp:36
float m_modelTransparency
Definition object_3d.h:102
const MATERIAL * m_material
Definition object_3d.h:96
const std::map< OBJECT_2D_TYPE, const char * > objectTypeNames
Definition object_2d.cpp:40
static const BLINN_PHONG_MATERIAL s_defaultMaterial
Definition object_3d.cpp:33
OBJECT_3D_TYPE
Definition object_3d.h:35