void mkdr(const char* dir) {
if (_access_s(dir, 0)) {
- std::cout << "mkdr " << dir << "\n";
SHCreateDirectoryExA(NULL, dir, NULL);
}
}
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),
std::string m_overviews_folder;
std::string m_resources_folder;
+vfilesys* filesys = NULL;
+
#ifdef _DEBUG
bool m_outputMasks = true;
bool m_onlyOutputMasks;
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");
}
return 0;
}
- filesys->debug();
+ filesys->debug_info();
std::cout << "Initializing OpenGL\n";
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
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";
#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
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();
{
"editorversion" "400"
"editorbuild" "8075"
- "mapversion" "153"
+ "mapversion" "155"
"formatversion" "100"
"prefab" "0"
}
world
{
"id" "1"
- "mapversion" "153"
+ "mapversion" "155"
"classname" "worldspawn"
"detailmaterial" "detail/detailsprites"
"detailvbsp" "detail.vbsp"
"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"
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"
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"
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"
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"
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"
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"
{
"editorversion" "400"
"editorbuild" "8075"
- "mapversion" "781"
+ "mapversion" "783"
"formatversion" "100"
"prefab" "0"
}
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
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"
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"
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"
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"
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"
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"
// Image Inputs _______________________________________________________________________________
uniform sampler2D tex_in; // Buyzones
uniform sampler2D tex_in_1; // Bombtargets
+uniform sampler2D tex_in_2; // playspace
// SHADER PROGRAM
// ____________________________________________________________________________________________
{
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
#include "vtx.hpp"
#include "../AutoRadar_installer/FileSystemHelper.h"
-class vfilesys {
+class vfilesys : public util::verboseControl {
public:
// Cached items
vpk::index* vpkIndex;
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())) {
}
/* 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";
}
/* 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;
}