group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
SurfaceType.hpp File Reference

Surface-material classification shared across collision, raycasts, VFX, SFX, and damage falloff. More...

#include <cstdint>
#include <string_view>
Include dependency graph for SurfaceType.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  SurfaceType : uint8_t {
  Metal = 0 , Concrete = 1 , Flesh = 2 , Wood = 3 ,
  Energy = 4 , Count = 5
}
 Surface material hit by a projectile / hitscan / contact. More...

Functions

constexpr SurfaceType surfaceTypeFromMaterialName (std::string_view name) noexcept
 Parse a Blender material name into a SurfaceType.
constexpr std::string_view surfaceTypeName (SurfaceType s) noexcept
 Display name for a SurfaceType. Used in debug UI / logging.

Detailed Description

Surface-material classification shared across collision, raycasts, VFX, SFX, and damage falloff.

Lives in the physics layer because primitives carry a per-instance SurfaceType (cooked from Blender material names) that drives the downstream gameplay systems. Projectile.hpp re-includes this header to preserve the existing #include "Projectile.hpp" paths that read the enum.

Enumeration Type Documentation

◆ SurfaceType

enum class SurfaceType : uint8_t
strong

Surface material hit by a projectile / hitscan / contact.

Cook-time mapping (Blender material name → enum, case-insensitive):

  • mat_metal → Metal
  • mat_concrete → Concrete (also the default for unprefixed names)
  • mat_flesh → Flesh
  • mat_wood → Wood
  • mat_energy → Energy

Unknown / unprefixed materials fall back to Concrete, matching the hard-coded behaviour of the original (pre-Phase-3) raycast code.

Enumerator
Metal 
Concrete 
Flesh 
Wood 
Energy 
Count 

Function Documentation

◆ surfaceTypeFromMaterialName()

SurfaceType surfaceTypeFromMaterialName ( std::string_view name)
nodiscardconstexprnoexcept

Parse a Blender material name into a SurfaceType.

Accepts either the bare suffix ("metal") or the mat_ prefix ("mat_metal"). Case-insensitive. Returns Concrete for unrecognised input — matches the pre-Phase-3 default behaviour so missing material tags never break a map.

◆ surfaceTypeName()

std::string_view surfaceTypeName ( SurfaceType s)
nodiscardconstexprnoexcept

Display name for a SurfaceType. Used in debug UI / logging.