This repository has been archived on 2024-12-30. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2024CG-project-render/include/path_glsl_files.h
github-classroom[bot] 686dcaf351
Initial commit
2024-11-29 09:50:03 +00:00

269 lines
No EOL
7 KiB
C++

#ifndef PATH_GLSL_FILES_H
#define PATH_GLSL_FILES_H
static void setShaderPaths(int task,
std::vector<std::string>& all_paths,
std::vector<std::string>& vertex_shader_paths,
std::vector<std::string>& tess_control_shader_paths,
std::vector<std::string>& tess_evaluation_shader_paths,
std::vector<std::string>& fragment_shader_paths) {
if (task == 0) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/glsl/pass-through.tcs"
};
tess_evaluation_shader_paths = {
"/glsl/interpolate.glsl",
"/glsl/pass-through.tes"
};
fragment_shader_paths = {
"/glsl/pass-through.fs"
};
}
else if (task == 1) {
vertex_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/src/1_model.glsl",
"/src/1_model_view_projection.vs",
};
tess_control_shader_paths = {
"/glsl/pass-through.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/interpolate.glsl",
"/glsl/pass-through.tes",
};
fragment_shader_paths = {
"/src/1_blue_and_gray.fs",
};
}
else if (task == 2) {
vertex_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/src/1_model.glsl",
"/src/1_model_view_projection.vs",
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/interpolate.glsl",
"/glsl/pass-through.tes",
};
fragment_shader_paths = {
"/src/1_blue_and_gray.fs",
};
}
else if (task == 3) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/src/3_snap_to_sphere.tes",
};
fragment_shader_paths = {
"/src/1_blue_and_gray.fs",
};
}
else if (task == 4) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/src/3_snap_to_sphere.tes",
};
fragment_shader_paths = {
"/glsl/PI.glsl",
"/src/4_blinn_phong.glsl",
"/src/4_lit.fs",
};
}
else if (task == 5) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/src/3_snap_to_sphere.tes",
};
fragment_shader_paths = {
"/glsl/PI.glsl",
"/glsl/random2.glsl",
"/src/5_random_direction.glsl",
"/src/5_smooth_step.glsl",
"/src/5_perlin_noise.glsl",
"/src/4_blinn_phong.glsl",
"/src/5_procedural_color.fs",
};
}
else if (task == 6) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/src/3_snap_to_sphere.tes",
};
fragment_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/glsl/random2.glsl",
"/src/5_random_direction.glsl",
"/src/5_smooth_step.glsl",
"/src/5_perlin_noise.glsl",
"/src/4_blinn_phong.glsl",
"/glsl/smooth_heaviside.glsl",
"/glsl/bump_height.glsl",
"/src/6_bump_position.glsl",
"/src/6_tangent.glsl",
"/src/6_bump.fs",
};
}
else if (task == 7) {
vertex_shader_paths = {
"/glsl/pass-through.vs"
};
tess_control_shader_paths = {
"/src/2_tessellate_5.tcs",
};
tess_evaluation_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/src/3_snap_to_sphere.tes",
};
fragment_shader_paths = {
"/glsl/PI.glsl",
"/src/1_identity.glsl",
"/src/1_uniform_scale.glsl",
"/src/1_translate.glsl",
"/src/1_rotate_about_y.glsl",
"/glsl/interpolate.glsl",
"/src/1_model.glsl",
"/glsl/random2.glsl",
"/src/5_random_direction.glsl",
"/src/5_smooth_step.glsl",
"/src/5_perlin_noise.glsl",
"/src/4_blinn_phong.glsl",
"/glsl/smooth_heaviside.glsl",
"/glsl/bump_height.glsl",
"/src/6_bump_position.glsl",
"/src/6_tangent.glsl",
"/src/7_planet.fs",
};
}
// Print to command line
std::cout << "==== Used glsl files: ====" << std::endl;
std::cout << " vertex:" << std::endl;
for (auto& s : vertex_shader_paths) {
std::cout << " " << s << std::endl;
}
std::cout << " tessellation control:" << std::endl;
for (auto& s : tess_control_shader_paths) {
std::cout << " " << s << std::endl;
}
std::cout << " tessellation evaluation:" << std::endl;
for (auto& s : tess_evaluation_shader_paths) {
std::cout << " " << s << std::endl;
}
std::cout << " fragment:" << std::endl;
for (auto& s : fragment_shader_paths) {
std::cout << " " << s << std::endl;
}
std::cout << "==========================" << std::endl;
// Add cmakelists_dir (from main.cpp)
for (std::string& s : vertex_shader_paths) {
s = cmakelists_dir + s;
}
for (std::string& s : tess_control_shader_paths) {
s = cmakelists_dir + s;
}
for (std::string& s : tess_evaluation_shader_paths) {
s = cmakelists_dir + s;
}
for (std::string& s : fragment_shader_paths) {
s = cmakelists_dir + s;
}
// Add "/glsl/version410.glsl" to the beginning of each vector
vertex_shader_paths.insert(vertex_shader_paths.begin(), cmakelists_dir + "/glsl/version410.glsl");
tess_control_shader_paths.insert(tess_control_shader_paths.begin(), cmakelists_dir + "/glsl/version410.glsl");
tess_evaluation_shader_paths.insert(tess_evaluation_shader_paths.begin(), cmakelists_dir + "/glsl/version410.glsl");
fragment_shader_paths.insert(fragment_shader_paths.begin(), cmakelists_dir + "/glsl/version410.glsl");
// Concatenate into one vector
all_paths.insert(all_paths.end(), vertex_shader_paths.begin(), vertex_shader_paths.end());
all_paths.insert(all_paths.end(), tess_control_shader_paths.begin(), tess_control_shader_paths.end());
all_paths.insert(all_paths.end(), tess_evaluation_shader_paths.begin(), tess_evaluation_shader_paths.end());
all_paths.insert(all_paths.end(), fragment_shader_paths.begin(), fragment_shader_paths.end());
}
#endif