Class HammerOverlayBuilder
Namespace: ValveResourceFormat.IO
Assembly: ValveResourceFormat.dll
Rebuilds a from its projected map geometry, this code attempts to figure out the source mesh the overlay was projected from.
public static class HammerOverlayBuilderInheritance
Fields
MeshHeight
How far above the surface the reconstructed overlay mesh should sit.
public const float MeshHeight = 16Field Value
ProjectionMargin
How much further than its receiving surfaces an overlay projects, and how much wider than their angle to the projection it accepts faces, this gives some leeway to account for imprecision.
public const float ProjectionMargin = 8Field Value
Methods
FromProjectedGeometry(ReadOnlySpan<Vector3>, ReadOnlySpan<Vector2>, ReadOnlySpan<int>, string, Func<string, Vector2?>?)
Rebuilds the overlays a compiled overlay mesh came from, the geometry is welded and split into connected pieces first using .
public static List<CMapStaticOverlay> FromProjectedGeometry(ReadOnlySpan<Vector3> positions, ReadOnlySpan<Vector2> texCoords, ReadOnlySpan<int> triangles, string material, Func<string, Vector2?>? textureSizeProvider = null)Parameters
positions ReadOnlySpan<Vector3>
texCoords ReadOnlySpan<Vector2>
triangles ReadOnlySpan<int>
material string
textureSizeProvider Func<string, Vector2?>?
Returns
FromProjectedMesh(PolygonMesh, string, Func<string, Vector2?>?)
Rebuilds an overlay from a .
public static CMapStaticOverlay? FromProjectedMesh(PolygonMesh projected, string material, Func<string, Vector2?>? textureSizeProvider = null)Parameters
projected PolygonMesh
material string
textureSizeProvider Func<string, Vector2?>?
Returns
FromProjectedMesh(ReadOnlySpan<Vector3>, ReadOnlySpan<Vector2>, ReadOnlySpan<int>, string, Func<string, Vector2?>?)
Rebuilds an overlay from its projected triangles, this should only be fed singular connected mesh islands.
public static CMapStaticOverlay? FromProjectedMesh(ReadOnlySpan<Vector3> positions, ReadOnlySpan<Vector2> texCoords, ReadOnlySpan<int> triangles, string material, Func<string, Vector2?>? textureSizeProvider = null)Parameters
positions ReadOnlySpan<Vector3>
texCoords ReadOnlySpan<Vector2>
triangles ReadOnlySpan<int>
material string
textureSizeProvider Func<string, Vector2?>?
Returns
RemoveStackedDuplicates(ReadOnlySpan<Vector3>, ReadOnlySpan<Vector2>, ReadOnlySpan<int>)
Flags projected triangles that duplicate the same decal region on a surface stacked behind another. The compiler clips a decal against every surface its projection reaches, so a surface hidden behind another carries a second copy that would come back as duplicated faces stacked on the rebuilt overlay. Returns one flag per triangle, set when the triangle is such a duplicate and should be left out.
public static bool[] RemoveStackedDuplicates(ReadOnlySpan<Vector3> positions, ReadOnlySpan<Vector2> texCoords, ReadOnlySpan<int> triangles)Parameters
positions ReadOnlySpan<Vector3>
texCoords ReadOnlySpan<Vector2>
triangles ReadOnlySpan<int>
Returns
bool[]

