PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/visualizations/Vortex/VortexVis/Core/Mesh.cpp

http://github.com/xbmc/xbmc
C++ | 62 lines | 33 code | 8 blank | 21 comment | 4 complexity | 8c50c08d002e23990af9fad60e5fdf49 MD5 | raw file
 1/*
 2 *  Copyright Š 2010-2013 Team XBMC
 3 *  http://xbmc.org
 4 *
 5 *  This program is free software: you can redistribute it and/or modify
 6 *  it under the terms of the GNU General Public License as published by
 7 *  the Free Software Foundation, either version 2 of the License, or
 8 *  (at your option) any later version.
 9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#include "Mesh.h"
21#include <new>
22#include <stdio.h>
23
24Mesh::Mesh()
25{
26	m_iRefCount = 1;
27	m_pMesh = NULL;
28}
29
30Mesh::~Mesh()
31{
32	if ( m_pMesh )
33	{
34		m_pMesh->Release();
35		m_pMesh = NULL;
36	}
37}
38
39//--------------------
40// reference counting
41//--------------------
42
43void Mesh::AddRef()
44{
45	m_iRefCount++;
46}
47
48void Mesh::Release()
49{
50	if ( --m_iRefCount == 0 )
51		delete this;
52}
53
54void Mesh::CreateTextMesh( string& InString, bool bCentered )
55{
56	if ( m_pMesh )
57	{
58		m_pMesh->Release();
59	}
60
61	m_pMesh = Renderer::CreateD3DXTextMesh( InString.c_str(), bCentered );
62}