-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy path3dsFile.cpp
executable file
·50 lines (32 loc) · 1.05 KB
/
3dsFile.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright(c) 2005-2006. All Rights Reserved
// By Jean-René Bédard (https://github.com/jrbedard/3d-converter)
#include "StdAfx.h"
#include "3dsFile.h"
// Uhhh, TODO : un-nest these classes
C3dsFile::CObject::CMesh::CFace::CFace():
m_flag(0),
m_smoothingGroup(false,0),
m_materialID(0)
{
}
C3dsFile::CObject::CMesh::CFace::~CFace()
{
}
uint C3dsFile::AddMaterial(const std::string& materialName)
{
static uint materialID = 0;
m_materials.insert( std::make_pair(materialID, C3dsFile::CMaterial(materialName)));
return (++materialID - 1);
}
uint C3dsFile::FindMaterial(const std::string& materialName)
{
C3dsFile::MaterialMap::iterator materialIt;
C3dsFile::MaterialMap::const_iterator materialEnd = m_materials.end();
for( materialIt = m_materials.begin(); materialIt != materialEnd; ++materialIt )
{
if( materialIt->second.GetMaterialName() == materialName )
return materialIt->first;
}
MSG_WARNING("Invalid Material Name: '" << materialName << "'. Returning the first material.");
return 0;
}