/*
- CONVEXER v0.91
+ CONVEXER v0.95
A GNU/Linux-first Source1 Hammer replacement
built with Blender, for mapmakers
Copyright (C) 2022 Harry Godden (hgn)
+LICENSE: GPLv3.0, please see COPYING and LICENSE for more information
+
Features:
- Brush decomposition into convex pieces for well defined geometry
- Freely form displacements without limits
#ifdef CXR_VALVE_MAP_FILE
typedef struct cxr_vdf cxr_vdf;
typedef struct cxr_texinfo cxr_texinfo;
+ typedef struct cxr_visgroup cxr_visgroup;
typedef struct cxr_vmf_context cxr_vmf_context;
#endif /* CXR_VALVE_MAP_FILE */
double winding;
};
+struct cxr_visgroup
+{
+ const char *name;
+};
+
/*
* Simplified VDF writing interface. No allocations or nodes, just write to file
*/
*detailvbsp,
*detailmaterial;
+ cxr_visgroup *visgroups;
+ i32 visgroup_count;
+
/* Transform settings */
double scale;
v3f offset;
- i32 lightmap_scale;
+ i32 lightmap_scale,
+ visgroupid;
/* Current stats */
i32 brush_count,
const char *cxr_build_time = __DATE__ " @" __TIME__;
#endif
+#if _WIN32 || _WIN64
+#if _WIN64
+#else
+#warning 32 bit is not supported in blender 3.0
+#endif
+#endif
+
static void (*cxr_log_func)(const char *str);
static void (*cxr_line_func)( v3f p0, v3f p1, v4f colour );
if( !newvert )
{
+ free( graph );
+ free( vertinfo );
return 0;
}
}
}
}
-#ifdef CXR_DEBUG
- cxr_log( "Broken displacement!\n" );
-#endif
free( graph );
free( vertinfo );
return 0;
v3_muladds( face_center, refn, 1.5, pn );
v3_muladds( face_center, refv, 1.5, pv );
v3_muladds( face_center, refu, 1.5, pu );
+
+ v3_muladds( face_center, refn, 2.0, face_center );
}
/* Create world coordinates */
cxr_vdf_node( output, "editor");
cxr_vdf_colour255( output, "color",
colours_random[cxr_range(ctx->brush_count,8)]);
-
+
+ cxr_vdf_ki32( output, "visgroupid", ctx->visgroupid );
cxr_vdf_ki32( output, "visgroupshown",1);
cxr_vdf_ki32( output, "visgroupautoshown",1);
cxr_vdf_edon( output );
cxr_vdf_edon( output );
cxr_vdf_node( output, "visgroups" );
+
+ for( int i=0; i<ctx->visgroup_count; i++ )
+ {
+ cxr_vdf_node( output, "visgroup" );
+ cxr_vdf_kv( output, "name", ctx->visgroups[i].name );
+ cxr_vdf_ki32( output, "visgroupid", i+1 );
+ cxr_vdf_edon( output );
+ }
+
cxr_vdf_edon( output );
cxr_vdf_node( output, "viewsettings" );
if( solid->displacement )
{
- cxr_write_disp( solid->pmesh, world, ctx, output );
+ if( !cxr_write_disp( solid->pmesh, world, ctx, output ) )
+ {
+ cxr_log( "Warning: Invalid displacement\n" );
+ }
continue;
}
cxr_vdf_colour255( output, "color",
colours_random[cxr_range(ctx->brush_count,8)]);
+ cxr_vdf_ki32( output, "visgroupid", ctx->visgroupid );
cxr_vdf_ki32( output, "visgroupshown", 1 );
cxr_vdf_ki32( output, "visgroupautoshown", 1 );
cxr_vdf_edon( output );