free(data);
}
+/* Renders opengl in opaque mode (normal) */
+void opengl_render_opaque() {
+ glDisable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+}
+
+/* Renders opengl in addative mode */
+void opengl_render_additive() {
+ glDepthMask(GL_TRUE);
+ glEnable(GL_BLEND);
+
+ // I still do not fully understand OPENGL blend modes. However these equations looks nice for the grid floor.
+ glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
+ glBlendFuncSeparate(GL_ONE, GL_ONE, GL_ZERO, GL_ONE);
+}
+
/* Command line variables */
#ifndef _DEBUG
std::string m_mapfile_path;
std::string m_game_path;
#endif
#ifdef _DEBUG
-std::string m_mapfile_path = "sample_stuff/de_tavr_test";
+std::string m_mapfile_path = "sample_stuff/de_crimson_v16";
std::string m_game_path = "D:/SteamLibrary/steamapps/common/Counter-Strike Global Offensive/csgo";
#endif
auto result = options.parse(argc, argv);
/* Check required parameters */
- if (result.count("game")) m_game_path = result["game"].as<std::string>();
+ if (result.count("game")) m_game_path = sutil::ReplaceAll(result["game"].as<std::string>(), "\n", "");
else throw cxxopts::option_required_exception("game");
if(result.count("mapfile")) m_mapfile_path = result["mapfile"].as<std::string>();
else if (result.count("positional")) {
auto& positional = result["positional"].as<std::vector<std::string>>();
- m_mapfile_path = positional[0];
+ m_mapfile_path = sutil::ReplaceAll(positional[0], "\n", "");
}
else throw cxxopts::option_required_exception("mapfile"); // We need a map file
s_solid->mesh->Draw();
}
+ fb_comp_1.Bind();
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
shader_unlit.setVec3("color", 1.0f, 0.0f, 0.0f);
for (auto && s_solid : tavr_bombtargets) {
fb_comp.BindRTtoTexSlot(0);
shader_precomp_objectives.setInt("tex_in", 0);
+ fb_comp_1.BindRTtoTexSlot(1);
+ shader_precomp_objectives.setInt("tex_in_1", 1);
+
mesh_screen_quad->Draw();
if (m_outputMasks)
// SAMPLER UNIFORMS
// Image Inputs _______________________________________________________________________________
-uniform sampler2D tex_in; // Background texture
+uniform sampler2D tex_in; // Buyzones
+uniform sampler2D tex_in_1; // Bombtargets
// SHADER PROGRAM
// ____________________________________________________________________________________________
void main()
{
vec4 sample = vec4(texture(tex_in, TexCoords));
- FragColor = vec4(sample.r, sample.g, 0, sample.r + sample.g);
+ vec4 sample1 = vec4(texture(tex_in_1, TexCoords));
+ vec4 o = sample + sample1;
+ FragColor = vec4(o.r, o.g, 0, o.r + o.g);
}
\ No newline at end of file
namespace sutil
{
+ std::string get_unquoted_material(std::string in) {
+ std::vector<std::string> sgts = split(in, '\"');
+ std::string u = "";
+ int i = 0;
+ for (auto && s : sgts) {
+ if (i++ % 2 != 0) continue;
+ u += s;
+ }
+ return u;
+ }
+
std::string pad0(std::string in, int count) {
int zerosNeeded = count - in.size();
std::string out = "";
line = split(line, "//")[0];
- if (line.find("{") != std::string::npos) {
+ if (sutil::get_unquoted_material(line).find("{") != std::string::npos) {
std::string pname = prev;
prev.erase(std::remove(prev.begin(), prev.end(), '"'), prev.end());
this->SubBlocks.push_back(DataBlock(stream, pname, progress_callback));
continue;
}
- if (line.find("}") != std::string::npos) {
+ if (sutil::get_unquoted_material(line).find("}") != std::string::npos) {
return;
}
for (int i = 0; i < SolidList.size(); i++){
std::cout << "Solid " << i + 1 << "/" << total << "\r";
+ if (i >= SolidList.size() - 1)
+ {
+ std::cout << "last\n";
+ }
kv::DataBlock cBlock = SolidList[i];
Solid solid;
kv::DataBlock* editorValues = cBlock.GetFirstByName("editor");
- //Gather up the visgroups
- int viscount = -1;
- while (editorValues->Values.count("visgroupid" + (++viscount > 0 ? std::to_string(viscount) : "")))
- solid.visgroupids.push_back(std::stoi(editorValues->Values["visgroupid" + (viscount > 0 ? std::to_string(viscount) : "")]));
+ if (editorValues != NULL) {
+ //Gather up the visgroups
+ int viscount = -1;
+ while (editorValues->Values.count("visgroupid" + (++viscount > 0 ? std::to_string(viscount) : "")))
+ solid.visgroupids.push_back(std::stoi(editorValues->Values["visgroupid" + (viscount > 0 ? std::to_string(viscount) : "")]));
- glm::vec3 color;
- if (vmf_parse::Vector3f(editorValues->Values["color"], &color))
- solid.color = glm::vec3(color.x / 255.0f, color.y / 255.0f, color.z / 255.0f);
- else
+ glm::vec3 color;
+ if (vmf_parse::Vector3f(editorValues->Values["color"], &color))
+ solid.color = glm::vec3(color.x / 255.0f, color.y / 255.0f, color.z / 255.0f);
+ else
solid.color = glm::vec3(1, 0, 0);
+ }
+ else {
+ std::cout << "Editor values was null!\n";
+ }
this->solids.push_back(solid);
}