--- /dev/null
+// TAVR - AUTO RADAR. v 2.0.0
+
+{
+ "CTSpawn_x" "0.470000"
+ "CTSpawn_y" "0.650000"
+ "TSpawn_x" "0.340000"
+ "TSpawn_y" "0.170000"
+ "material" "overviews/"
+ "pos_x" "-2390.324951"
+ "pos_y" "3072.000000"
+ "scale" "4.860000"
+}
}
/* 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_game_path = "D:/SteamLibrary/steamapps/common/Counter-Strike Global Offensive/csgo";
+#endif
//derived strings
std::string m_mapfile_name;
std::string m_overviews_folder;
std::string m_resources_folder;
-bool m_outputMasks;
+bool m_outputMasks = true;
bool m_onlyOutputMasks;
-uint32_t m_renderWidth;
-uint32_t m_renderHeight;
+uint32_t m_renderWidth = 1024;
+uint32_t m_renderHeight = 1024;
/* Main program */
int app(int argc, const char** argv) {
+#ifndef _DEBUG
cxxopts::Options options("AutoRadar", "Auto radar");
options.add_options()
("v,version", "Shows the software version")
("w,width", "Render width in pixels (experimental)", cxxopts::value<uint32_t>()->default_value("1024"))
("h,height", "Render height in pixels (experimental)", cxxopts::value<uint32_t>()->default_value("1024"))
+ // Experimental
+ ("autoModulate", "Enables automatic height modulation between two levels")
+ ("minHeightDiff", "Minumum height difference(units) to modulate between two levels", cxxopts::value<int>()->default_value("128"))
+
+ // Future
+ ("useVBSP", "Use VBSP.exe to pre-process brush unions automatically")
+ ("useLightmaps", "Use lightmaps generated by vvis in the VBSP. (If this flag is set, Auto Radar must be ran after vvis.exe)")
+
("positional", "Positional parameters", cxxopts::value<std::vector<std::string>>());
options.parse_positional("positional");
m_mapfile_path = sutil::ReplaceAll(m_mapfile_path, "\\", "/");
m_game_path = sutil::ReplaceAll(m_game_path, "\\", "/");
- //Derive the ones
- m_mapfile_name = split(m_mapfile_path, '/').back();
- m_overviews_folder = m_game_path + "/resource/overviews/";
- m_resources_folder = m_overviews_folder + m_mapfile_name + ".resources/";
-
/* Check the rest of the flags */
m_onlyOutputMasks = result["onlyMasks"].as<bool>();
m_outputMasks = result["dumpMasks"].as<bool>() || m_onlyOutputMasks;
m_renderWidth = result["width"].as<uint32_t>();
m_renderHeight = result["height"].as<uint32_t>();
+#endif
+
+ //Derive the ones
+ m_mapfile_name = split(m_mapfile_path, '/').back();
+ m_overviews_folder = m_game_path + "/resource/overviews/";
+ m_resources_folder = m_overviews_folder + m_mapfile_name + ".resources/";
+
std::cout << "Launching with options:\n";
std::cout << " Render width: " << m_renderWidth << "\n";
std::cout << " Render height: " << m_renderHeight << "\n";
std::cout << "______________________________________________________________\n";
std::cout << "Shader compilation step failed.\n";
glfwTerminate();
+#ifdef _DEBUG
+ system("PAUSE");
+#endif
return 1;
}
vmf_main.ComputeGLMeshes();
vmf_main.ComputeDisplacements();
+
+ std::cout << "Collecting Objects... \n";
std::vector<vmf::Solid*> tavr_solids = vmf_main.getAllBrushesInVisGroup("tavr_layout");
- std::vector<vmf::Solid*> tavr_solids_funcbrush = vmf_main.getAllBrushesByClassName("func_brush");
+ std::vector<vmf::Solid*> tavr_solids_negative = vmf_main.getAllBrushesInVisGroup("tavr_negative");
+ std::vector<vmf::Solid*> tavr_entire_brushlist = vmf_main.getAllRenderBrushes();
+ //std::vector<vmf::Solid*> tavr_solids_funcbrush = vmf_main.getAllBrushesByClassName("func_brush");
std::vector<vmf::Solid*> tavr_buyzones = vmf_main.getAllBrushesByClassName("func_buyzone");
std::vector<vmf::Solid*> tavr_bombtargets = vmf_main.getAllBrushesByClassName("func_bomb_target");
#pragma region render_playable_space
std::cout << "Rendering playable space... ";
+ // ======================================================== REGULAR ORDER ========================================================
+
fb_comp.Bind(); //Bind framebuffer
glClearColor(0.00f, 0.00f, 0.00f, 1.00f);
shader_depth.setFloat("HEIGHT_MIN", z_render_min);
shader_depth.setFloat("HEIGHT_MAX", z_render_max);
+ shader_depth.setFloat("write_playable", 0.0f);
+ // Render entire map first
+ for (auto && brush : tavr_entire_brushlist) brush->mesh->Draw();
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ // Render playable area over it
+ shader_depth.setFloat("write_playable", 1.0f);
for (auto && s_solid : tavr_solids) {
if(!s_solid->containsDisplacements)
s_solid->mesh->Draw();
}
}
+ // ======================================================== REVERSE ORDER ========================================================
fb_comp_1.Bind();
shader_depth.setFloat("HEIGHT_MIN", z_render_min);
shader_depth.setFloat("HEIGHT_MAX", z_render_max);
+ shader_depth.setFloat("write_playable", 0.0f);
for (auto && s_solid : tavr_solids) {
if (!s_solid->containsDisplacements)
glDepthFunc(GL_LESS);
glDisable(GL_CULL_FACE);
+ // ========================================================== PRE-COMP ===========================================================
+
// Apply diffusion
fb_tex_playspace.Bind();
shader_precomp_playspace.use();
- shader_precomp_playspace.setFloat("HEIGHT_MIN", z_render_min);
- shader_precomp_playspace.setFloat("HEIGHT_MAX", z_render_max);
+ //shader_precomp_playspace.setFloat("HEIGHT_MIN", z_render_min);
+ //shader_precomp_playspace.setFloat("HEIGHT_MAX", z_render_max);
fb_comp.BindRTtoTexSlot(0);
shader_precomp_playspace.setInt("tex_in", 0);
fb_comp_1.BindRTtoTexSlot(1);
shader_precomp_playspace.setInt("tex_in_1", 1);
- tex_height_modulate.bindOnSlot(2);
- shader_precomp_playspace.setInt("tex_modulate", 2);
+ //tex_height_modulate.bindOnSlot(2);
+ //shader_precomp_playspace.setInt("tex_modulate", 2);
mesh_screen_quad->Draw();
save_to_dds(1024, 1024, std::string(m_overviews_folder + m_mapfile_name + "_radar.dds").c_str());
}
+ if (m_outputMasks)
+ render_to_png(1024, 1024, "test.png");
+
#pragma region generate_radar_txt
std::cout << "Generating radar .TXT... ";
//Exit safely
glfwTerminate();
+#ifdef _DEBUG
+ system("PAUSE");
+#endif
+
return 0;
}
{
"editorversion" "400"
"editorbuild" "8075"
- "mapversion" "32"
+ "mapversion" "36"
"formatversion" "100"
"prefab" "0"
}
world
{
"id" "1"
- "mapversion" "32"
+ "mapversion" "36"
"classname" "worldspawn"
"detailmaterial" "detail/detailsprites"
"detailvbsp" "detail.vbsp"
}
}
solid
- {
- "id" "78"
- side
- {
- "id" "165"
- "plane" "(-768 1024 16) (256 1024 16) (256 128 16)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[1 0 0 0] 0.25"
- "vaxis" "[0 -1 0 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "164"
- "plane" "(-768 128 0) (256 128 0) (256 1024 0)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[1 0 0 0] 0.25"
- "vaxis" "[0 -1 0 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "163"
- "plane" "(-768 1024 16) (-768 128 16) (-768 128 0)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[0 1 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "162"
- "plane" "(256 1024 0) (256 128 0) (256 128 16)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[0 1 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "161"
- "plane" "(256 1024 16) (-768 1024 16) (-768 1024 0)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[1 0 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "160"
- "plane" "(256 128 0) (-768 128 0) (-768 128 16)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[1 0 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- editor
- {
- "color" "0 145 202"
- "visgroupid" "8"
- "visgroupshown" "1"
- "visgroupautoshown" "1"
- }
- }
- solid
{
"id" "79"
side
"visgroupautoshown" "1"
}
}
- hidden
+ solid
{
- solid
+ "id" "144"
+ side
{
- "id" "144"
- side
- {
- "id" "291"
- "plane" "(-768 640 0) (-2048 640 0) (-2048 -512 0)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[-1 0 0 0] 0.25"
- "vaxis" "[0 1 0 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "290"
- "plane" "(-768 -512 0) (-768 -512 64) (-768 640 64)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[0 -1 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "289"
- "plane" "(-2048 640 0) (-2048 640 128) (-2048 -512 128)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[0 -1 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "288"
- "plane" "(-2048 -512 0) (-2048 -512 128) (-768 -512 64)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[-1 0 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "287"
- "plane" "(-768 640 0) (-768 640 64) (-2048 640 128)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[-1 0 0 0] 0.25"
- "vaxis" "[0 0 -1 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- side
- {
- "id" "286"
- "plane" "(-768 -512 64) (-2048 -512 128) (-2048 640 128)"
- "material" "DEV/GRAYGRID"
- "uaxis" "[-1 0 0 0] 0.25"
- "vaxis" "[0 1 0 0] 0.25"
- "rotation" "0"
- "lightmapscale" "16"
- "smoothing_groups" "0"
- }
- editor
- {
- "color" "0 145 202"
- "visgroupid" "9"
- "visgroupshown" "0"
- "visgroupautoshown" "1"
- }
+ "id" "291"
+ "plane" "(-768 640 0) (-2048 640 0) (-2048 -512 0)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[-1 0 0 0] 0.25"
+ "vaxis" "[0 1 0 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "290"
+ "plane" "(-768 -512 0) (-768 -512 64) (-768 640 64)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[0 -1 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "289"
+ "plane" "(-2048 640 0) (-2048 640 128) (-2048 -512 128)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[0 -1 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "288"
+ "plane" "(-2048 -512 0) (-2048 -512 128) (-768 -512 64)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[-1 0 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "287"
+ "plane" "(-768 640 0) (-768 640 64) (-2048 640 128)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[-1 0 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "286"
+ "plane" "(-768 -512 64) (-2048 -512 128) (-2048 640 128)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[-1 0 0 0] 0.25"
+ "vaxis" "[0 1 0 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ editor
+ {
+ "color" "0 145 202"
+ "visgroupid" "8"
+ "visgroupshown" "1"
+ "visgroupautoshown" "1"
}
}
group
}
}
entity
+{
+ "id" "397"
+ "classname" "func_detail"
+ solid
+ {
+ "id" "78"
+ side
+ {
+ "id" "465"
+ "plane" "(-768 1024 16) (256 1024 16) (256 128 16)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[1 0 0 0] 0.25"
+ "vaxis" "[0 -1 0 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "464"
+ "plane" "(-768 128 0) (256 128 0) (256 1024 0)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[1 0 0 0] 0.25"
+ "vaxis" "[0 -1 0 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "463"
+ "plane" "(-768 1024 16) (-768 128 16) (-768 128 0)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[0 1 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "462"
+ "plane" "(256 1024 0) (256 128 0) (256 128 16)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[0 1 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "461"
+ "plane" "(256 1024 16) (-768 1024 16) (-768 1024 0)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[1 0 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ side
+ {
+ "id" "460"
+ "plane" "(256 128 0) (-768 128 0) (-768 128 16)"
+ "material" "DEV/GRAYGRID"
+ "uaxis" "[1 0 0 0] 0.25"
+ "vaxis" "[0 0 -1 0] 0.25"
+ "rotation" "0"
+ "lightmapscale" "16"
+ "smoothing_groups" "0"
+ }
+ editor
+ {
+ "color" "0 180 0"
+ "visgroupshown" "1"
+ "visgroupautoshown" "1"
+ }
+ }
+ editor
+ {
+ "color" "0 180 0"
+ "visgroupid" "8"
+ "visgroupid" "9"
+ "visgroupshown" "1"
+ "visgroupautoshown" "1"
+ "logicalpos" "[0 0]"
+ }
+}
+entity
{
"id" "367"
"classname" "info_player_terrorist"
out vec4 FragColor;
uniform vec3 color;
-uniform float test;
uniform float HEIGHT_MIN;
uniform float HEIGHT_MAX;
+uniform float write_playable;
in vec3 FragPos;
in float Depth;
-in float Alpha;
// Simple remap from-to range.
float remap(float value, float low1, float high1, float low2, float high2)
{
float height = pow(remap(FragPos.y, HEIGHT_MIN, HEIGHT_MAX, 0, 1), 2.2);
- FragColor = vec4(1, height, 0, 1);
+ FragColor = vec4(write_playable, height, 0, 1);
}
\ No newline at end of file
// ( Standard generated maps from the engine )
uniform sampler2D tex_background; // Background texture
uniform sampler2D tex_playspace; // Playspace
- // R: Playable space (0 or 1),
- // G: Height (0-1 normalized)
- // B: AO map (mask 0-1)
- // A: Outline (mask 0-1) (need to subtract the playable space from this)
+ // R: Height (Regular)
+ // G: Height (Reverse rendering order)
+ // **B: Baked Lighting
+ // A: Playable Space (0 or 1)
uniform sampler2D tex_objectives; // Objectives
// R: Buzones (0 or 1)
- // G: Bombsites (0 or 1)
- // **B: Glow map (mask 0-1)
- // **A: Outline (mask 0-1)
+ // G: none
+ // B: none
+ // A: Buyzones & Bombsites (mask 0-1)
uniform sampler2D tex_props; // Props
- // **R: Props (0 or 1)
- // **G: Height (0-1 normalized)
- // **B: Glow map (mask 0-1)
- // **A: Outline (mask 0-1)
+ // **R: Height (0-1 normalized)
+ // **G: none
+ // **B: none
+ // **A: Props (0 or 1)
uniform sampler2D tex_gradient; // Gradient input
- // **RGBA: 256x1 image defining a gradient
+ // RGBA: 256x1 image defining a gradient
uniform sampler2D texture0; // Custom Image input 3 (**RGBA)
uniform sampler2D texture1; // Custom Image input 4 (**RGBA)
vec4 blend_normal(vec4 a, vec4 b, float s)
{
- return vec4(lerp(a.rgb, b.rgb, b.a * s), b.a + (a.a * s));
+ return vec4(lerp(a.rgb, b.rgb, b.a * s), a.a + (b.a * s));
}
vec4 blend_add(vec4 a, vec4 b, float s)
return vec4(a.rgb + (b.rgb * s), a.a);
}
+// -------------------------------------- sample helpers --------------------------------------
+
vec4 sample_gradient(float height)
{
return vec4(texture(tex_gradient, vec2(height, 0)));
}
+float get_playspace(vec4 sample_playspace) { return sample_playspace.a; }
+float get_playspace_height(vec4 sample_playspace) { return sample_playspace.a * sample_playspace.r; }
+float get_playspace_inverse_height(vec4 sample_playspace) { return sample_playspace.a * sample_playspace.g; }
+
+float get_height(vec4 sample_playspace) { return sample_playspace.g; }
+float get_baked_light(vec4 sample_playspace) { return sample_playspace.r; }
+
+// -------------------------------------- kernel filters --------------------------------------
+// Given an 0-1 mask, return a 'glow value'
+float kernel_filter_glow(sampler2D sampler, int channelID = 0, int sample_size = 16)
+{
+ vec2 pixel_size = 1.0 / vec2(textureSize(sampler, 0));
+
+ float sT = 0;
+ int sample_double = sample_size * 2;
+
+ // Process kernel
+ for(int x = 0; x <= sample_double; x++){
+ for(int y = 0; y <= sample_double; y++){
+ sT += texture(sampler, TexCoords + vec2((-sample_size + x) * pixel_size.x, (-sample_size + y) * pixel_size.y))[channelID];
+ }
+ }
+
+ sT /= (sample_double * sample_double);
+
+ return sT;
+}
+
+// Given a 0-1 mask, return an outline drawn around that mask
+float kernel_filter_outline(sampler2D sampler, int channelID = 0, int sample_size = 2)
+{
+ vec2 pixel_size = 1.0 / vec2(textureSize(sampler, 0));
+
+ float sT = 0;
+ int sample_double = sample_size * 2;
+
+ // Process kernel
+ for(int x = 0; x <= sample_double; x++){
+ for(int y = 0; y <= sample_double; y++){
+ sT += //texture(sampler, TexCoords + vec2((-sample_size + x) * pixel_size.x, (-sample_size + y) * pixel_size.y))[channelID];
+ (sample_size - min(length(vec2(-sample_size + x, -sample_size + y)), sample_size)) *
+ texture(sampler, TexCoords + vec2((-sample_size + x) * pixel_size.x, (-sample_size + y) * pixel_size.y))[channelID];
+ }
+ }
+
+ return max(min(sT, 1) - texture(sampler, TexCoords)[channelID], 0);
+}
+
// SHADER PROGRAM
// ____________________________________________________________________________________________
// ( Write all your shader code & functions here )
vec4 sObjectives = vec4(texture(tex_objectives, TexCoords));
vec4 final = sBackground;
- final = blend_normal(final, ao_color, sPlayspace.b); // Drop shadow
- final = blend_normal(final, sample_gradient(sPlayspace.g), sPlayspace.r); // Playspace
- final = blend_normal(final, outline_color, sPlayspace.a - sPlayspace.r); // Outline
+ final = blend_normal(final, ao_color, kernel_filter_glow(tex_playspace, 3, 16)); // Drop shadow
+ final = blend_normal(final, sample_gradient(get_playspace_height(sPlayspace)), get_playspace(sPlayspace)); // Playspace
+ final = blend_normal(final, outline_color, kernel_filter_outline(tex_playspace, 3, 2)); // Outline
- final = blend_normal(final, objective_color, sObjectives.r * sObjectives.a); // Objectives
- final = blend_normal(final, buyzone_color, sObjectives.g * sObjectives.a); // Buyzones
+ //final = blend_normal(final, objective_color, sObjectives.r * sObjectives.a); // Objectives
+ //final = blend_normal(final, buyzone_color, sObjectives.g * sObjectives.a); // Buyzones
// Return the final output color
FragColor = final;
}
\ No newline at end of file
// Image Inputs _______________________________________________________________________________
uniform sampler2D tex_in; // Background texture
-// SHADER HELPERS
-// ____________________________________________________________________________________________
-// ( Simple sample with offset )
-vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0));
-vec4 getSample(vec2 offset)
-{
- return vec4(texture(tex_in, TexCoords + (offset * pixel_size)));
-}
-
// SHADER PROGRAM
// ____________________________________________________________________________________________
// ( Write all your shader code & functions here )
void main()
{
- vec4 sIn = getSample(vec2(0,0));
-
- //Temp
- int sampleCount = 64;
- int outlineWidth = 1;
-
- vec2 sT = vec2(0, 0);
-
- // Glow sampler ==========================================================
- for(int x = 0; x <= sampleCount; x++)
- {
- for(int y = 0; y <= sampleCount; y++)
- {
- sT += (vec2(1, 1)-getSample(vec2(-32 + x,-32 + y)).rg) * (1 - ((abs(-32 +x) * abs(-32 +y)) / 512));
- }
- }
-
- // Outline sampler =======================================================
- vec2 olT = vec2(0, 0);
- for(int x = 0; x <= outlineWidth * 2; x++)
- {
- for(int y = 0; y <= outlineWidth * 2; y++)
- {
- olT += vec2(1, 1) - getSample(vec2(-outlineWidth + x,-outlineWidth + y)).rg;
- }
- }
-
- float global_opacity = 0.075;
-
- sT /= (sampleCount * sampleCount);
- sT = vec2(pow(sT.r, 1.5), pow(sT.g, 1.5));
- sT *= 0.75;
- FragColor = vec4((sIn.r * olT.r) + (sIn.r * sT.r) + (sIn.r * global_opacity), (sIn.g * olT.g) + (sIn.g * sT.g) + (sIn.g * global_opacity), 0, sIn.r + sIn.g);
+ vec4 sample = vec4(texture(tex_in, TexCoords));
+ FragColor = vec4(sample.r, 0, 0, sample.r + sample.g);
}
\ No newline at end of file
--- /dev/null
+#version 330 core
+// OPENGL
+// ____________________________________________________________________________________________
+in vec2 TexCoords;
+out vec4 FragColor;
+
+// SAMPLER UNIFORMS
+// Image Inputs _______________________________________________________________________________
+uniform sampler2D tex_in; // Background texture
+
+// SHADER HELPERS
+// ____________________________________________________________________________________________
+// ( Simple sample with offset )
+vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0));
+vec4 getSample(vec2 offset)
+{
+ return vec4(texture(tex_in, TexCoords + (offset * pixel_size)));
+}
+
+// SHADER PROGRAM
+// ____________________________________________________________________________________________
+// ( Write all your shader code & functions here )
+
+void main()
+{
+ vec4 sIn = getSample(vec2(0,0));
+
+ //Temp
+ int sampleCount = 64;
+ int outlineWidth = 1;
+
+ vec2 sT = vec2(0, 0);
+
+ // Glow sampler ==========================================================
+ for(int x = 0; x <= sampleCount; x++)
+ {
+ for(int y = 0; y <= sampleCount; y++)
+ {
+ sT += (vec2(1, 1)-getSample(vec2(-32 + x,-32 + y)).rg) * (1 - ((abs(-32 +x) * abs(-32 +y)) / 512));
+ }
+ }
+
+ // Outline sampler =======================================================
+ vec2 olT = vec2(0, 0);
+ for(int x = 0; x <= outlineWidth * 2; x++)
+ {
+ for(int y = 0; y <= outlineWidth * 2; y++)
+ {
+ olT += vec2(1, 1) - getSample(vec2(-outlineWidth + x,-outlineWidth + y)).rg;
+ }
+ }
+
+ float global_opacity = 0.075;
+
+ sT /= (sampleCount * sampleCount);
+ sT = vec2(pow(sT.r, 1.5), pow(sT.g, 1.5));
+ sT *= 0.75;
+ FragColor = vec4((sIn.r * olT.r) + (sIn.r * sT.r) + (sIn.r * global_opacity), (sIn.g * olT.g) + (sIn.g * sT.g) + (sIn.g * global_opacity), 0, sIn.r + sIn.g);
+}
\ No newline at end of file
in vec2 TexCoords;
out vec4 FragColor;
-
// SAMPLER UNIFORMS
// Image Inputs _______________________________________________________________________________
uniform sampler2D tex_in; // Background texture
uniform sampler2D tex_in_1;
-uniform sampler2D tex_modulate;
-
-uniform float HEIGHT_MIN;
-uniform float HEIGHT_MAX;
-
-// SHADER HELPERS
-// ____________________________________________________________________________________________
-// ( Simple sample with offset )
-vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0));
-vec4 getSample(vec2 offset)
-{
- return vec4(texture(tex_in, TexCoords + (offset * pixel_size)));
-}
-
-// Simple remap from-to range.
-float remap(float value, float low1, float high1, float low2, float high2)
-{
- return low2 + (value - low1) * (high2 - low2) / (high1 - low1);
-}
// SHADER PROGRAM
// ____________________________________________________________________________________________
// ( Write all your shader code & functions here )
void main()
{
- vec4 sIn = getSample(vec2(0,0));
- if(sIn.r > 0.0)
- {
- float height1 = sIn.g;
- float height2 = texture(tex_in_1, TexCoords).g;
- float heightOut = sIn.g;
-
- if((height1 - height2) > remap(128, HEIGHT_MIN, HEIGHT_MAX, 0, 1)){
- if(texture(tex_modulate, TexCoords).r > 0.5){
- heightOut = height2;
- }
- }
-
- FragColor = vec4(sIn.r, heightOut, sIn.g, sIn.a);
- }
- else
- {
- //Temp
- int sampleCount = 32;
- int outlineWidth = 2;
-
- // Glow sampler ==========================================================
- float sT = 0;
- for(int x = 0; x <= sampleCount; x++)
- {
- for(int y = 0; y <= sampleCount; y++)
- {
- sT += getSample(vec2(-16 + x,-16 + y)).r;
- }
- }
-
- //Adjust slightly
- sT *= 2;
- sT /= (sampleCount * sampleCount);
-
- // Outline sampler =======================================================
- float olT = 0;
- for(int x = 0; x <= outlineWidth * 2; x++)
- {
- for(int y = 0; y <= outlineWidth * 2; y++)
- {
- olT += getSample(vec2(-outlineWidth + x,-outlineWidth + y)).r;
- }
- }
+ vec4 sample_a = vec4(texture(tex_in, TexCoords));
+ vec4 sample_b = vec4(texture(tex_in_1, TexCoords));
- FragColor = vec4(sIn.r, sIn.g, sT, olT);
- }
+ FragColor = vec4(sample_a.g, sample_b.g, 0, sample_a.r);
}
\ No newline at end of file
--- /dev/null
+#version 330 core
+// OPENGL
+// ____________________________________________________________________________________________
+in vec2 TexCoords;
+out vec4 FragColor;
+
+
+// SAMPLER UNIFORMS
+// Image Inputs _______________________________________________________________________________
+uniform sampler2D tex_in; // Background texture
+uniform sampler2D tex_in_1;
+uniform sampler2D tex_modulate;
+
+uniform float HEIGHT_MIN;
+uniform float HEIGHT_MAX;
+
+// SHADER HELPERS
+// ____________________________________________________________________________________________
+// ( Simple sample with offset )
+vec2 pixel_size = 1.0 / vec2(textureSize(tex_in, 0));
+vec4 getSample(vec2 offset)
+{
+ return vec4(texture(tex_in, TexCoords + (offset * pixel_size)));
+}
+
+// Simple remap from-to range.
+float remap(float value, float low1, float high1, float low2, float high2)
+{
+ return low2 + (value - low1) * (high2 - low2) / (high1 - low1);
+}
+
+// SHADER PROGRAM
+// ____________________________________________________________________________________________
+// ( Write all your shader code & functions here )
+void main()
+{
+ vec4 sIn = getSample(vec2(0,0));
+ if(sIn.r > 0.0)
+ {
+ float height1 = sIn.g;
+ float height2 = texture(tex_in_1, TexCoords).g;
+ float heightOut = sIn.g;
+
+ if((height1 - height2) > remap(128, HEIGHT_MIN, HEIGHT_MAX, 0, 1)){
+ if(texture(tex_modulate, TexCoords).r > 0.5){
+ heightOut = height2;
+ }
+ }
+
+ FragColor = vec4(sIn.r, heightOut, sIn.g, sIn.a);
+ }
+ else
+ {
+ //Temp
+ int sampleCount = 32;
+ int outlineWidth = 2;
+
+ // Glow sampler ==========================================================
+ float sT = 0;
+ for(int x = 0; x <= sampleCount; x++)
+ {
+ for(int y = 0; y <= sampleCount; y++)
+ {
+ sT += getSample(vec2(-16 + x,-16 + y)).r;
+ }
+ }
+
+ //Adjust slightly
+ sT *= 2;
+ sT /= (sampleCount * sampleCount);
+
+ // Outline sampler =======================================================
+ float olT = 0;
+ for(int x = 0; x <= outlineWidth * 2; x++)
+ {
+ for(int y = 0; y <= outlineWidth * 2; y++)
+ {
+ olT += getSample(vec2(-outlineWidth + x,-outlineWidth + y)).r;
+ }
+ }
+
+ FragColor = vec4(sIn.r, sIn.g, sT, olT);
+ }
+}
\ No newline at end of file
std::cout << "\n";
#pragma endregion Solids
-
+#pragma region Entities
std::cout << "Processing entites\n";
//Process entities list
solid.faces.push_back(side);
}
- kv::DataBlock* editorValues = cBlock.GetFirstByName("editor");
+ kv::DataBlock* editorValues = block.GetFirstByName("editor");
//Gather up the visgroups
int viscount = -1;
this->entities.push_back(ent);
}
+#pragma endregion
std::cout << "Processing visgroups\n";
return list;
}
+ std::vector<Solid*> getAllRenderBrushes() {
+ std::vector<Solid*> list;
+ for (auto && s : this->solids)
+ list.push_back(&s);
+
+ for (auto && ent : this->entities) {
+ if (ent.classname == "func_detail" || ent.classname == "func_brush") {
+ for (auto && s : ent.internal_solids) {
+ list.push_back(&s);
+ }
+ }
+ }
+
+ return list;
+ }
+
+ std::vector<Solid*> getAllBrushesByClassNameAppend(std::string classname) {
+
+ }
+
std::vector<Solid*> getAllBrushesByClassName(std::string classname) {
std::vector<Solid*> list;
for (auto && ent : this->entities) {