# FuncGodotUtil

Static class with a number of reuseable utility methods that can be called at Editor or Run Time.

# Methods

Method Description Return type
printprofileinfo(message: String, signature: String) Connected by the FuncGodot Map node to the build process' sub components if the Show Profiling Info build flag is set. Also called by the Map node. Void
newline() Return a string that corresponds to the current OS's newline control characters. String
Math
opvec3sum(lhs: Vector3, rhs: Vector3) Returns the sum of the two input vectors. Useful for lambda operations. Vector3
opvec3avg(array: Array[Vector3]) Returns the average vector of an array of vectors. Vector3
opswizzlevec3w(xyz: Vector3, w: float) PackedFloat32Array
idtoopengl(vec: Vector3) Conversion from id tech coordinate system to Godot, from a top-down perspective. Vector3
ispointinconvexhull(planes: Array[Plane], vertex: Vector3) Check if a point is inside a convex hull defined by a series of planes by an epsilon constant. Bool
Patch Def
elevatequadratic(p0: Vector3, p1: Vector3, p2: Vector3) Returns the control points that defines a cubic curve for a equivalent input quadratic curve. Array[Vector3]
createcurve(start: Vector3, control: Vector3, end: Vector3, bakeinterval: float = 0.05) Create a Curve3D and bake points. Curve3D
updaterefcurve(curve: Curve3D, p0: Vector3, p1: Vector3, p2: Vector3, bakeinterval: float = 0.05) Update a Curve3D given quadratic inputs. Void
Textures
loadtexture(texturename: String, wadresources: Array[QuakeWadFile], mapsettings: FuncGodotMapSettings) earches for a Texture2D within the base texture directory or the WAD files added to map settings. If not found, a default texture is returned. Texture2D
isskip(texture: String, mapsettings: FuncGodotMapSettings) Filters faces textured with Skip during the geometry generation step of the build process. Bool
isclip(texture: String, mapsettings: FuncGodotMapSettings) Filters faces textured with Clip during the geometry generation step of the build process. Bool
isorigin(texture: String, mapsettings: FuncGodotMapSettings) Filters faces textured with Origin during the parsing and geometry generation steps of the build process. Bool
filterface(texture: String, mapsettings: FuncGodotMapSettings) Filters faces textured with any of the tool textures during the geometry generation step of the build process. Bool
buildbasematerial(mapsettings: FuncGodotMapSettings, material: BaseMaterial3D, texture: String) Adds PBR textures to an existing BaseMaterial3D. Void
buildtexturemap(entitydata: Array[EntityData], mapsettings: FuncGodotMapSettings) Builds both materials and sizes dictionaries for use in the geometry generation step of the build process. Both dictionaries use texture names as keys. The materials dictionary uses [Material] as values, while the sizes dictionary saves the albedo texture sizes to aid in UV mapping. Array[Dictionary]
UV Mapping
getvalveuv(vertex: Vector3, uaxis: Vector3, vaxis: Vector3, uvbasis := Transform2D.IDENTITY, texturesize := Vector2.ONE) Returns UV coordinate calculated from the Valve 220 UV format. Vector2
getquakeuv(vertex: Vector3, normal: Vector3, uvbasis := Transform2D.IDENTITY, texturesize := Vector2.ONE) Returns UV coordinate calculated from the original id Standard UV format. Vector2
getfacevertexuv(vertex: Vector3, face: FaceData, texturesize: Vector2) Determines which UV format is being used and returns the UV coordinate. Vector2
getvalvetangent(u: Vector3, v: Vector3, normal: Vector3) Returns the tangent calculated from the Valve 220 UV format. PackedFloat32Array
getquaketangent(normal: Vector3, uvyscale: float, uvrotation: float) Returns the tangent calculated from the original id Standard UV format. PackedFloat32Array
getfacetangent(face: FaceData) Determines which UV format is being used and returns the tangent. PackedFloat32Array