本文整理汇总了C++中TextFile::get_content方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::get_content方法的具体用法?C++ TextFile::get_content怎么用?C++ TextFile::get_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::get_content方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: construct_from_file
void ShadingModel::construct_from_file(TextFile const& file) {
shader_stages_ = std::vector<ShaderStage>(4);
Json::Value value;
Json::Reader reader;
if (!reader.parse(file.get_content(), value)) {
Logger::LOG_WARNING << "Failed to parse shading model \"" << file.get_file_name() << "\": "
"File does not exist!" << std::endl;
return;
}
if (value["gbuffer_vertex_stage"] == Json::Value::null) {
Logger::LOG_WARNING << "Failed to parse shading model \"" << file.get_file_name() << "\": "
"Gbuffer-Vertex-Stage is missing!" << std::endl;
return;
}
if (value["gbuffer_fragment_stage"] == Json::Value::null) {
Logger::LOG_WARNING << "Failed to parse shading model \"" << file.get_file_name() << "\": "
"Gbuffer-Fragment-Stage is missing!" << std::endl;
return;
}
if (value["lbuffer_stage"] == Json::Value::null) {
Logger::LOG_WARNING << "Failed to parse shading model \"" << file.get_file_name() << "\": "
"Lbuffer-stage is missing!" << std::endl;
return;
}
if (value["final_shading_stage"] == Json::Value::null) {
Logger::LOG_WARNING << "Failed to parse shading model \"" << file.get_file_name() << "\": "
"Final-Shading-Stage is missing!" << std::endl;
return;
}
shader_stages_[GBUFFER_VERTEX_STAGE] = ShaderStage(value["gbuffer_vertex_stage"]);
shader_stages_[GBUFFER_FRAGMENT_STAGE] = ShaderStage(value["gbuffer_fragment_stage"]);
shader_stages_[LIGHTING_STAGE] = ShaderStage(value["lbuffer_stage"]);
shader_stages_[FINAL_STAGE] = ShaderStage(value["final_shading_stage"]);
// add default layers
shader_stages_[GBUFFER_VERTEX_STAGE].get_outputs()["gua_position"] = BufferComponent::F3;
shader_stages_[GBUFFER_FRAGMENT_STAGE].get_outputs()["gua_normal"] = BufferComponent::F3;
shader_stages_[FINAL_STAGE].get_outputs()["gua_color"] = BufferComponent::F3;
}