3485bcb2a0
Now batches are actually batches. Also added the MeshFactory class. Drawing modes are now specified with DrawMode instead of the GLenum. Renderables must be specified with a draw mode.
32 lines
644 B
C++
32 lines
644 B
C++
#include "Util.h"
|
|
|
|
#include <fstream>
|
|
#include <string>
|
|
|
|
#include "Exception.h"
|
|
|
|
std::string Util::load_file(const std::string& path)
|
|
{
|
|
std::ifstream input_stream;
|
|
try
|
|
{
|
|
input_stream.open(path);
|
|
}
|
|
catch (std::ios::failure& e)
|
|
{
|
|
throw Exception(std::string("Error Opening File: ") + e.what(), "class Util");
|
|
}
|
|
if (input_stream.is_open())
|
|
{
|
|
input_stream.seekg(0, std::ios::end);
|
|
std::size_t size = input_stream.tellg();
|
|
std::string buffer(size, ' ');
|
|
input_stream.seekg(std::ios::beg);
|
|
input_stream.read(&buffer[0], size);
|
|
return buffer;
|
|
}
|
|
else
|
|
{
|
|
throw Exception("Unable to access file: " + path, "class Util");
|
|
}
|
|
} |