KiCad PCB EDA Suite
cobject.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 <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2016 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 
30 #include "cobject.h"
31 #include <stdio.h>
32 
33 
35 
37 
39 {
40  m_obj_type = aObjType;
41  COBJECT3D_STATS::Instance().AddOne( aObjType );
43 }
44 
45 
46 static const char *OBJECT3D_STR[OBJ3D_MAX] =
47 {
48  "OBJ3D_CYLINDER",
49  "OBJ3D_DUMMYBLOCK",
50  "OBJ3D_LAYERITEM",
51  "OBJ3D_XYPLANE",
52  "OBJ3D_ROUNDSEG",
53  "OBJ3D_TRIANGLE"
54 };
55 
56 
58 {
59  printf( "OBJ3D Statistics:\n" );
60 
61  for( unsigned int i = 0; i < OBJ3D_MAX; ++i )
62  {
63  printf( " %20s %u\n", OBJECT3D_STR[i], m_counter[i] );
64  }
65 }
OBJECT3D_TYPE m_obj_type
Definition: cobject.h:55
const CMATERIAL * m_material
Definition: cobject.h:56
void PrintStats()
Definition: cobject.cpp:57
static const char * OBJECT3D_STR[OBJ3D_MAX]
Definition: cobject.cpp:46
void AddOne(OBJECT3D_TYPE aObjType)
Definition: cobject.h:112
COBJECT(OBJECT3D_TYPE aObjType)
Definition: cobject.cpp:38
Blinn Phong based material https://en.wikipedia.org/wiki/Blinn%E2%80%93Phong_shading_model.
Definition: cmaterial.h:248
static const CBLINN_PHONG_MATERIAL s_defaultMaterial
Definition: cobject.cpp:36
unsigned int m_counter[OBJ3D_MAX]
Definition: cobject.h:131
static COBJECT3D_STATS * s_instance
Definition: cobject.h:133
OBJECT3D_TYPE
Definition: cobject.h:38
static COBJECT3D_STATS & Instance()
Definition: cobject.h:116
Implements a class for object statistics using Singleton pattern.
Definition: cobject.h:102