ObjReader

This commit is contained in:
Tobias Grundel 2013-11-21 13:45:11 +01:00
parent ddbc808977
commit f08e9491ed
4 changed files with 31 additions and 3 deletions

View File

@ -94,6 +94,32 @@ void OBJReader::readOBJFile( std::wstring fileName )
inStream.close();
}
Oyster::Graphics::Render::ModelInfo OBJReader::toModel()
{
Oyster::Graphics::Buffer b;
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
Oyster::Graphics::Render::ModelInfo modelInfo;
desc.ElementSize = sizeof(OBJReader::OBJFormat);
desc.InitData = &this->_myOBJ[0];
desc.NumElements = (UINT32)this->_myOBJ.size();
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::CONSTANT_BUFFER_VS;
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE_IMMUTABLE;
HRESULT hr = S_OK;
hr = b.Init(desc);
if(FAILED(hr))
{
//Something isn't okay here
}
modelInfo.Indexed = false;
modelInfo.VertexCount = (int)desc.NumElements;
modelInfo.Vertices = b;
return modelInfo;
}
//Private functions
void OBJReader::stringSplit( std::string strToSplit )
{

View File

@ -2,6 +2,7 @@
#define OBJREADER_H
#include "..\..\Misc\Utilities.h"
#include "..\..\OysterMath\OysterMath.h"
#include "..\Model\ModelInfo.h"
//#include <fstream>
@ -48,6 +49,7 @@ class OBJReader
~OBJReader();
void readOBJFile( std::wstring fileName);
Oyster::Graphics::Render::ModelInfo toModel();
};
#endif

View File

@ -11,7 +11,7 @@
//#include "ICollideable.h"
#include "ModelInfo.h"
using namespace Oyster::Math;
//using namespace Oyster::Math;
namespace Oyster
{
@ -22,7 +22,7 @@ namespace Oyster
struct Model
{
ModelInfo* info;
Float4x4 *World;
Oyster::Math::Float4x4 *World;
bool Visible;
};
}

View File

@ -10,7 +10,7 @@
//#include "OysterMath.h"
//#include "ICollideable.h"
using namespace Oyster::Math;
//using namespace Oyster::Math;
namespace Oyster
{