Re-fixed ObjReader

This commit is contained in:
Tobias Grundel 2013-11-21 12:47:47 +01:00
parent a94429fd9d
commit ddbc808977
4 changed files with 30 additions and 22 deletions

View File

@ -15,14 +15,14 @@ OBJReader::~OBJReader()
}
void OBJReader::readOBJFile( wstring fileName )
void OBJReader::readOBJFile( std::wstring fileName )
{
fstream inStream;
string typeOfData = " ";
std::fstream inStream;
std::string typeOfData = " ";
float vertexData;
string face1, face2, face3;
std::string face1, face2, face3;
inStream.open( fileName, fstream::in );
inStream.open( fileName, std::fstream::in );
if( inStream.is_open() )
{
@ -95,11 +95,11 @@ void OBJReader::readOBJFile( wstring fileName )
}
//Private functions
void OBJReader::stringSplit( string strToSplit )
void OBJReader::stringSplit( std::string strToSplit )
{
char delim = '/';
string vPos, vNormal, vTexel;
stringstream aStream(strToSplit);
std::string vPos, vNormal, vTexel;
std::stringstream aStream(strToSplit);
getline( aStream, vPos, delim );
getline( aStream, vTexel, delim );
getline( aStream, vNormal );

View File

@ -19,8 +19,8 @@ class OBJReader
struct OBJMaterialData
{
string _name;
string _mapKd;
std::string _name;
std::string _mapKd;
float _kd[3];
float _ka[3];
float _tf[3];
@ -35,19 +35,19 @@ class OBJReader
std::vector<OBJFormat> _myOBJ;
private:
vector<Oyster::Math::Float3> _mVertexCoord, _mVertexNormal;
vector<Oyster::Math::Float2> _mVertexTexture;
std::vector<Oyster::Math::Float3> _mVertexCoord, _mVertexNormal;
std::vector<Oyster::Math::Float2> _mVertexTexture;
int _mNrOfCoords, _mNrOfNormals, _mNrOfTexels, _mNrOfFaces;
int _mPos, _mNormal, _mTexel;
void stringSplit( string strToSplit );
void stringSplit( std::string strToSplit );
void addToOBJarray();
public:
OBJReader();
~OBJReader();
void readOBJFile( wstring fileName);
void readOBJFile( std::wstring fileName);
};
#endif

View File

@ -145,8 +145,9 @@
<ClCompile Include="Core\Core.cpp" />
<ClCompile Include="Core\Init.cpp" />
<ClCompile Include="Core\ShaderManager.cpp" />
<ClCompile Include="Render\Preparations\Basic.cpp" />
<ClCompile Include="Render\Rendering\Basic.cpp" />
<ClCompile Include="FileLoader\ObjReader.cpp" />
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
<ClCompile Include="Resources\Resources.cpp" />
</ItemGroup>
<ItemGroup>
@ -154,6 +155,7 @@
<ClInclude Include="Core\Core.h" />
<ClInclude Include="Core\CoreIncludes.h" />
<ClInclude Include="EngineIncludes.h" />
<ClInclude Include="FileLoader\ObjReader.h" />
<ClInclude Include="Model\Model.h" />
<ClInclude Include="Model\ModelInfo.h" />
<ClInclude Include="Render\Preparations\Preparations.h" />

View File

@ -27,15 +27,18 @@
<ClCompile Include="Core\Init.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Preparations\Basic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Rendering\Basic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Resources\Resources.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Preparations\BasicPreparations.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Render\Rendering\BasicRender.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FileLoader\ObjReader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Core\Buffer.h">
@ -65,6 +68,9 @@
<ClInclude Include="Resources\Resources.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="FileLoader\ObjReader.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />