Fix indentation

This commit is contained in:
2015-02-20 19:36:27 -05:00
parent 7c1aa91ad6
commit 8adc28fc6f

View File

@@ -48,46 +48,44 @@ static void register_main_patterns();
void init_graph_tool(){ void init_graph_tool(){
fs::path shaderPath = progDir/"data"/"shaders"; fs::path shaderPath = progDir/"data"/"shaders";
fs::path fragPath = shaderPath/"mask.frag", vertPath = shaderPath/"mask.vert"; fs::path fragPath = shaderPath/"mask.frag", vertPath = shaderPath/"mask.vert";
std::ifstream fin;
do { do {
std::ifstream fin;
std::cerr << "Loading fragment shader from " << fragPath.string() << std::endl;
fin.open(fragPath.string().c_str());
if(!fin.good()) {
std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl;
break;
}
fin.seekg(0, std::ios::end);
int size = fin.tellg();
fin.seekg(0);
char* fbuf = new char[size + 1];
fbuf[size] = 0;
fin.read(fbuf, size);
fbuf[fin.gcount()] = 0;
fin.close();
std::cerr << "Loading fragment shader from " << fragPath.string() << std::endl; std::cerr << "Loading vertex shader from " << vertPath.string() << std::endl;
fin.open(fragPath.string().c_str()); fin.open(vertPath.string().c_str());
if(!fin.good()) { if(!fin.good()) {
std::cerr << std_fmterr << ": Error loading fragment shader" << std::endl; std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl;
break; delete[] fbuf;
} break;
fin.seekg(0, std::ios::end); }
int size = fin.tellg(); fin.seekg(0, std::ios::end);
fin.seekg(0); size = fin.tellg();
char* fbuf = new char[size + 1]; fin.seekg(0);
fbuf[size] = 0; char* vbuf = new char[size + 1];
fin.read(fbuf, size); vbuf[size] = 0;
fbuf[fin.gcount()] = 0; fin.read(vbuf, size);
fin.close(); vbuf[fin.gcount()] = 0;
std::cerr << "Loading vertex shader from " << vertPath.string() << std::endl; if(!maskShader.loadFromMemory(vbuf, fbuf)) {
fin.open(vertPath.string().c_str()); std::cerr << "Error: Failed to load shaders from " << shaderPath << "\nVertex:\n" << vbuf << "\nFragment:\n" << fbuf << std::endl;
if(!fin.good()) { }
std::cerr << std_fmterr << ": Error loading vertex shader" << std::endl;
delete[] fbuf; delete[] fbuf;
break; delete[] vbuf;
}
fin.seekg(0, std::ios::end);
size = fin.tellg();
fin.seekg(0);
char* vbuf = new char[size + 1];
vbuf[size] = 0;
fin.read(vbuf, size);
vbuf[fin.gcount()] = 0;
if(!maskShader.loadFromMemory(vbuf, fbuf)) {
std::cerr << "Error: Failed to load shaders from " << shaderPath << "\nVertex:\n" << vbuf << "\nFragment:\n" << fbuf << std::endl;
}
delete[] fbuf;
delete[] vbuf;
} while(false); } while(false);
int i; int i;
// TODO: The duplication of location here shouldn't be necessary // TODO: The duplication of location here shouldn't be necessary