better objective precompositor setup, vfilesys fixes
authorTerri00 <thrustmediaproductions@gmail.com>
Tue, 26 Mar 2019 02:47:16 +0000 (02:47 +0000)
committerTerri00 <thrustmediaproductions@gmail.com>
Tue, 26 Mar 2019 02:47:16 +0000 (02:47 +0000)
AutoRadar_installer/FileSystemHelper.h
MCDV/interpolation.h
MCDV/main.cpp
MCDV/sample_stuff/de_tavr_test.vmx
MCDV/sample_stuff/map_01.vmx
MCDV/shaders/ss_precomp_objectives.fs
MCDV/vfilesys.hpp

index 2c28f76d58fa8db8c51cf2ee2abbc379a4d91562..4c15f7def6d6302e69a11e5db16188a7b37fd216 100644 (file)
@@ -12,7 +12,6 @@ namespace fs
 
        void mkdr(const char* dir) {
                if (_access_s(dir, 0)) {
-                       std::cout << "mkdr  " << dir << "\n";
                        SHCreateDirectoryExA(NULL, dir, NULL);
                }
        }
index f2540771a472f13bf9e4144e06c86615debe264f..a0a0bd69895e75a8ac765f2bde28797ecf3721d8 100644 (file)
@@ -13,6 +13,12 @@ static T lerpT(T a, T b, float f) {
        return (T)((float)a * (1.0f - f)) + ((float)b * f);
 }
 
+namespace util {
+       static float roundf(float a, float r) {
+               return glm::round(a / r) * r;
+       }
+}
+
 static glm::vec3 lerp(glm::vec3 a, glm::vec3 b, float f) {
        return glm::vec3(lerpf(a.x, b.x, f),
                lerpf(a.y, b.y, f),
index ab55dfc99b7eea35ce9131b91d838f0850399f6f..5db00dccf0aa102a6700b9bf43cd619e85e9f4cf 100644 (file)
@@ -84,6 +84,8 @@ std::string m_mapfile_name;
 std::string m_overviews_folder;
 std::string m_resources_folder;
 
+vfilesys* filesys = NULL;
+
 #ifdef _DEBUG
 bool m_outputMasks = true;
 bool m_onlyOutputMasks;
@@ -192,7 +194,7 @@ int app(int argc, const char** argv) {
        std::cout << "    AO:              " << (m_comp_ao_enable ? "YES" : "NO") << "\n";
        std::cout << "    Shadows:         " << (m_comp_shadows_enable ? "YES" : "NO") << "\n";
        */
-       vfilesys* filesys = NULL;
+
        try {
                filesys = new vfilesys(m_game_path + "/gameinfo.txt");
        }
@@ -203,7 +205,7 @@ int app(int argc, const char** argv) {
                return 0;
        }
 
-       filesys->debug();
+       filesys->debug_info();
 
        std::cout << "Initializing OpenGL\n";
 
@@ -556,8 +558,7 @@ int app(int argc, const char** argv) {
 
        glEnable(GL_DEPTH_TEST);
 
-       if(m_outputMasks)
-               render_to_png(m_renderWidth, m_renderHeight, std::string(m_overviews_folder + m_mapfile_name + ".resources.playable_space.png").c_str());
+       if(m_outputMasks) render_to_png(m_renderWidth, m_renderHeight, filesys->create_output_filepath("resource/overviews/" + m_mapfile_name + ".resources/playspace.png", true).c_str());
 
        std::cout << "done!\n";
 #pragma endregion 
@@ -607,10 +608,12 @@ int app(int argc, const char** argv) {
        fb_comp_1.BindRTtoTexSlot(1);
        shader_precomp_objectives.setInt("tex_in_1", 1);
 
+       fb_tex_playspace.BindRTtoTexSlot(2);
+       shader_precomp_objectives.setInt("tex_in_2", 2);
+
        mesh_screen_quad->Draw();
 
-       if (m_outputMasks)
-               render_to_png(m_renderWidth, m_renderHeight, std::string(m_overviews_folder + m_mapfile_name + ".resources.buyzone_bombtargets.png").c_str());
+       if (m_outputMasks) render_to_png(m_renderWidth, m_renderHeight, filesys->create_output_filepath("resource/overviews/" + m_mapfile_name + ".resources/buyzones_bombtargets.png", true).c_str());
 
        glEnable(GL_DEPTH_TEST);
        std::cout << "done!\n";
@@ -670,12 +673,9 @@ int app(int argc, const char** argv) {
 #pragma endregion
 
 #pragma region auto_export_game
-       if (!m_onlyOutputMasks) {
-               save_to_dds(m_renderWidth, m_renderHeight, std::string(m_overviews_folder + m_mapfile_name + "_radar.dds").c_str());
-       }
 
-       if (m_outputMasks)
-               render_to_png(m_renderWidth, m_renderHeight, std::string(m_overviews_folder + m_mapfile_name + ".resources.final_raw.png").c_str());
+       if (!m_onlyOutputMasks) save_to_dds(m_renderWidth, m_renderHeight, filesys->create_output_filepath("resource/overviews/" + m_mapfile_name + "_radar.dds", true).c_str());
+       if (m_outputMasks) render_to_png(m_renderWidth, m_renderHeight, filesys->create_output_filepath("resource/overviews/" + m_mapfile_name + ".resources/raw.png", true).c_str());
 
 #pragma region generate_radar_txt
 
@@ -694,15 +694,15 @@ int app(int argc, const char** argv) {
        glm::vec3* loc_spawnT = vmf_main.calculateSpawnLocation(vmf::team::terrorist);
 
        if (loc_spawnCT != NULL) {
-               node_radar.Values.insert({ "CTSpawn_x", std::to_string(glm::round(remap(loc_spawnCT->x, view_origin.x, view_origin.x + render_ortho_scale, 0.0f, 1.0f) / 0.01f) * 0.01f) });
-               node_radar.Values.insert({ "CTSpawn_y", std::to_string(glm::round(remap(loc_spawnCT->y, view_origin.y, view_origin.y - render_ortho_scale, 0.0f, 1.0f) / 0.01f) * 0.01f) });
+               node_radar.Values.insert({ "CTSpawn_x", std::to_string(util::roundf(remap(loc_spawnCT->x, view_origin.x, view_origin.x + render_ortho_scale, 0.0f, 1.0f), 0.01f)) });
+               node_radar.Values.insert({ "CTSpawn_y", std::to_string(util::roundf(remap(loc_spawnCT->y, view_origin.y, view_origin.y - render_ortho_scale, 0.0f, 1.0f), 0.01f)) });
        }
        if (loc_spawnT != NULL) {
-               node_radar.Values.insert({ "TSpawn_x", std::to_string(glm::round(remap(loc_spawnT->x, view_origin.x, view_origin.x + render_ortho_scale, 0.0f, 1.0f) / 0.01f) * 0.01f) });
-               node_radar.Values.insert({ "TSpawn_y", std::to_string(glm::round(remap(loc_spawnT->y, view_origin.y, view_origin.y - render_ortho_scale, 0.0f, 1.0f) / 0.01f) * 0.01f) });
+               node_radar.Values.insert({ "TSpawn_x", std::to_string(util::roundf(remap(loc_spawnT->x, view_origin.x, view_origin.x + render_ortho_scale, 0.0f, 1.0f), 0.01f)) });
+               node_radar.Values.insert({ "TSpawn_y", std::to_string(util::roundf(remap(loc_spawnT->y, view_origin.y, view_origin.y - render_ortho_scale, 0.0f, 1.0f), 0.01f)) });
        }
 
-       std::ofstream out(std::string(m_overviews_folder + m_mapfile_name + ".txt").c_str());
+       std::ofstream out(filesys->create_output_filepath("resource/overviews/" + m_mapfile_name + ".txt", true).c_str());
        out << "// TAVR - AUTO RADAR. v 2.0.0\n";
        node_radar.Serialize(out);
        out.close();
index 99f4cdb808ad76c85a95191902d724247a8f0379..81577691fcbcaf4325c4db84297c43e30e251ea1 100644 (file)
@@ -2,7 +2,7 @@ versioninfo
 {
        "editorversion" "400"
        "editorbuild" "8075"
-       "mapversion" "153"
+       "mapversion" "155"
        "formatversion" "100"
        "prefab" "0"
 }
@@ -56,7 +56,7 @@ viewsettings
 world
 {
        "id" "1"
-       "mapversion" "153"
+       "mapversion" "155"
        "classname" "worldspawn"
        "detailmaterial" "detail/detailsprites"
        "detailvbsp" "detail.vbsp"
@@ -2784,7 +2784,7 @@ entity
        "angles" "0 0 0"
        "fademindist" "-1"
        "fadescale" "1"
-       "model" "models/props/de_nuke/this_mdl_doesnt_exist.mdl"
+       "model" "models/props/de_nuke/car_nuke.mdl"
        "renderamt" "255"
        "rendercolor" "255 255 255"
        "skin" "0"
@@ -3182,10 +3182,10 @@ entity
                side
                {
                        "id" "315"
-                       "plane" "(-273 -367 160) (-273 17 160) (207 17 160)"
+                       "plane" "(-64 -576 160) (-64 -192 160) (416 -192 160)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[1 0 0 72.8] 3.75"
-                       "vaxis" "[0 -1 0 5.66667] 3"
+                       "uaxis" "[1 0 0 17.0667] 3.75"
+                       "vaxis" "[0 -1 0 -64] 3"
                        "rotation" "0"
                        "lightmapscale" "16"
                        "smoothing_groups" "0"
@@ -3193,10 +3193,10 @@ entity
                side
                {
                        "id" "314"
-                       "plane" "(-273 17 16) (-273 -367 16) (207 -367 16)"
+                       "plane" "(-64 -192 16) (-64 -576 16) (416 -576 16)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[1 0 0 72.8] 3.75"
-                       "vaxis" "[0 -1 0 5.66667] 3"
+                       "uaxis" "[1 0 0 17.0667] 3.75"
+                       "vaxis" "[0 -1 0 -64] 3"
                        "rotation" "0"
                        "lightmapscale" "16"
                        "smoothing_groups" "0"
@@ -3204,9 +3204,9 @@ entity
                side
                {
                        "id" "313"
-                       "plane" "(-273 -367 16) (-273 17 16) (-273 17 160)"
+                       "plane" "(-64 -576 16) (-64 -192 16) (-64 -192 160)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[0 1 0 -5.66667] 3"
+                       "uaxis" "[0 1 0 64] 3"
                        "vaxis" "[0 0 -1 14.2222] 1.125"
                        "rotation" "0"
                        "lightmapscale" "16"
@@ -3215,9 +3215,9 @@ entity
                side
                {
                        "id" "312"
-                       "plane" "(207 17 16) (207 -367 16) (207 -367 160)"
+                       "plane" "(416 -192 16) (416 -576 16) (416 -576 160)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[0 1 0 -5.66667] 3"
+                       "uaxis" "[0 1 0 64] 3"
                        "vaxis" "[0 0 -1 14.2222] 1.125"
                        "rotation" "0"
                        "lightmapscale" "16"
@@ -3226,9 +3226,9 @@ entity
                side
                {
                        "id" "311"
-                       "plane" "(-273 17 16) (207 17 16) (207 17 160)"
+                       "plane" "(-64 -192 16) (416 -192 16) (416 -192 160)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[1 0 0 72.8] 3.75"
+                       "uaxis" "[1 0 0 17.0667] 3.75"
                        "vaxis" "[0 0 -1 14.2222] 1.125"
                        "rotation" "0"
                        "lightmapscale" "16"
@@ -3237,9 +3237,9 @@ entity
                side
                {
                        "id" "310"
-                       "plane" "(207 -367 16) (-273 -367 16) (-273 -367 160)"
+                       "plane" "(416 -576 16) (-64 -576 16) (-64 -576 160)"
                        "material" "TERRI/TOOLS/TOOLS_TRIGGER"
-                       "uaxis" "[1 0 0 72.8] 3.75"
+                       "uaxis" "[1 0 0 17.0667] 3.75"
                        "vaxis" "[0 0 -1 14.2222] 1.125"
                        "rotation" "0"
                        "lightmapscale" "16"
index 23ae348c0b722b59c5de81ff7a5c36c33c019d13..872097abdd61e343b0c47ad107b914aeeff2ba73 100644 (file)
@@ -2,7 +2,7 @@ versioninfo
 {
        "editorversion" "400"
        "editorbuild" "8075"
-       "mapversion" "781"
+       "mapversion" "783"
        "formatversion" "100"
        "prefab" "0"
 }
@@ -50,13 +50,134 @@ viewsettings
 world
 {
        "id" "1"
-       "mapversion" "781"
+       "mapversion" "783"
        "classname" "worldspawn"
        "detailmaterial" "detail/detailsprites"
        "detailvbsp" "detail.vbsp"
        "maxpropscreenwidth" "-1"
        "skyname" "sky_arpeggio"
        solid
+       {
+               "id" "296330"
+               side
+               {
+                       "id" "101560"
+                       "plane" "(293.6 1307.75 352) (272 1256 352) (293.6 1204.25 352)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 -1 0 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101561"
+                       "plane" "(344 1328 544) (394.4 1307.75 544) (416 1256 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 -1 0 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101562"
+                       "plane" "(344 1328 352) (394.4 1307.75 352) (394.4 1307.75 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101563"
+                       "plane" "(394.4 1307.75 352) (416 1256 352) (416 1256 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[0 1 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101564"
+                       "plane" "(416 1256 352) (394.4 1204.25 352) (394.4 1204.25 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[0 1 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101565"
+                       "plane" "(394.4 1204.25 352) (344 1184 352) (344 1184 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101566"
+                       "plane" "(344 1184 352) (293.6 1204.25 352) (293.6 1204.25 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101567"
+                       "plane" "(293.6 1204.25 352) (272 1256 352) (272 1256 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[0 1 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101568"
+                       "plane" "(272 1256 352) (293.6 1307.75 352) (293.6 1307.75 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[0 1 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               side
+               {
+                       "id" "101569"
+                       "plane" "(293.6 1307.75 352) (344 1328 352) (344 1328 544)"
+                       "material" "/RAFFLE_OVERLAY"
+                       "uaxis" "[1 0 0 0] 0.25"
+                       "vaxis" "[0 0 -1 0] 0.25"
+                       "rotation" "0"
+                       "lightmapscale" "16"
+                       "smoothing_groups" "0"
+               }
+               editor
+               {
+                       "color" "0 129 178"
+                       "visgroupid" "25"
+                       "visgroupshown" "1"
+                       "visgroupautoshown" "1"
+               }
+       }
+       solid
        {
                "id" "295105"
                side
@@ -190407,7 +190528,7 @@ entity
                side
                {
                        "id" "14646"
-                       "plane" "(128 1088 256) (128 1600 256) (512 1600 256)"
+                       "plane" "(-48 1008 256) (-48 1696 256) (592 1696 256)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[1 0 0 0] 0.25"
                        "vaxis" "[0 -1 0 0] 0.25"
@@ -190418,7 +190539,7 @@ entity
                side
                {
                        "id" "14645"
-                       "plane" "(128 1600 64) (128 1088 64) (512 1088 64)"
+                       "plane" "(-48 1696 64) (-48 1008 64) (592 1008 64)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[1 0 0 0] 0.25"
                        "vaxis" "[0 -1 0 0] 0.25"
@@ -190429,7 +190550,7 @@ entity
                side
                {
                        "id" "14644"
-                       "plane" "(128 1088 64) (128 1600 64) (128 1600 256)"
+                       "plane" "(-48 1008 64) (-48 1696 64) (-48 1696 256)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[0 1 0 0] 0.25"
                        "vaxis" "[0 0 -1 0] 0.25"
@@ -190440,7 +190561,7 @@ entity
                side
                {
                        "id" "14643"
-                       "plane" "(512 1600 64) (512 1088 64) (512 1088 256)"
+                       "plane" "(592 1696 64) (592 1008 64) (592 1008 256)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[0 1 0 0] 0.25"
                        "vaxis" "[0 0 -1 0] 0.25"
@@ -190451,7 +190572,7 @@ entity
                side
                {
                        "id" "14642"
-                       "plane" "(128 1600 64) (512 1600 64) (512 1600 256)"
+                       "plane" "(-48 1696 64) (592 1696 64) (592 1696 256)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[1 0 0 0] 0.25"
                        "vaxis" "[0 0 -1 0] 0.25"
@@ -190462,7 +190583,7 @@ entity
                side
                {
                        "id" "14641"
-                       "plane" "(512 1088 64) (128 1088 64) (128 1088 256)"
+                       "plane" "(592 1008 64) (-48 1008 64) (-48 1008 256)"
                        "material" "TOOLS/TOOLSTRIGGER"
                        "uaxis" "[1 0 0 0] 0.25"
                        "vaxis" "[0 0 -1 0] 0.25"
index ece1763297fd8e5db6499ecacd52d95764130ab3..16cd137cac28fc24201f5ae4f0210fe8fff11653 100644 (file)
@@ -8,6 +8,7 @@ out vec4 FragColor;
 // Image Inputs _______________________________________________________________________________
 uniform sampler2D tex_in;      // Buyzones
 uniform sampler2D tex_in_1;    // Bombtargets
+uniform sampler2D tex_in_2; // playspace
 
 //                                       SHADER PROGRAM
 // ____________________________________________________________________________________________
@@ -17,6 +18,7 @@ void main()
 {
        vec4 sample = vec4(texture(tex_in, TexCoords));
        vec4 sample1 = vec4(texture(tex_in_1, TexCoords));
+       vec4 a = vec4(texture(tex_in_2, TexCoords));
        vec4 o = sample + sample1;
-       FragColor = vec4(o.r, o.g, 0, o.r + o.g);
+       FragColor = vec4(o.r * a.a, o.g * a.a, 0, o.r + o.g);
 }
\ No newline at end of file
index 3967d849df71369842e63a283193601cb449b1c1..6bdf87d0560da57ba09b97541fcbc18f9200fc8d 100644 (file)
@@ -6,7 +6,7 @@
 #include "vtx.hpp"
 #include "../AutoRadar_installer/FileSystemHelper.h"
 
-class vfilesys {
+class vfilesys : public util::verboseControl {
 public:
        // Cached items
        vpk::index* vpkIndex;
@@ -63,6 +63,8 @@ public:
                        if (fs::checkFileExist(_path.c_str())) this->searchPaths.push_back(_path);
                }
 
+               this->searchPaths.push_back(this->dir_gamedir);
+
                // Look for pak01_dir.vpk in all search paths
                for (auto && sp : this->searchPaths) {
                        if (fs::checkFileExist((sp + "pak01_dir.vpk").c_str())) {
@@ -78,7 +80,7 @@ public:
        }
 
        /* Dump out what this filesystem has in memory */
-       void debug() {
+       void debug_info() {
                std::cout << "Directories:\n";
                std::cout << "  dir_game: " << dir_gamedir << "\n";
                std::cout << "  dir_exe:  " << dir_exedir << "\n";
@@ -125,10 +127,15 @@ public:
        }
 
        /* Generate a path to a file inside the gamedir. Optionally automatically create new directories (shell). */
-       std::string create_output_filepath(std::string relpath, bool mkdr = false) {
+       std::string create_output_filepath(std::string relpath, bool mkdr = false, bool verbose = true) {
+               this->use_verbose = verbose;
+
                std::string fullpath = this->dir_gamedir + relpath;
 
-               if(mkdr) fs::mkdr(fullpath.c_str());
+               if (mkdr) {
+                       if (!fs::checkFileExist(fs::getDirName(fullpath).c_str())) this->debug("MKDIR: ", fs::getDirName(fullpath));
+                       fs::mkdr(fs::getDirName(fullpath).c_str());
+               }
 
                return fullpath;
        }