Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PhysicalMaterial Class Reference

#include <PhysicalMaterial.h>

Public Member Functions

DLLEXPORT PhysicalMaterial (const std::string &name, int id)
 
DLLEXPORT ~PhysicalMaterial ()
 
DLLEXPORT PhysMaterialDataPairFormPairWith (const PhysicalMaterial &other)
 Data pairing. More...
 
auto * GetPairWith (int otherid) const
 Returns data for this material to interact with another. More...
 
DLLEXPORT int GetID ()
 
DLLEXPORT std::string GetName () const
 

Detailed Description

Definition at line 114 of file PhysicalMaterial.h.

Constructor & Destructor Documentation

◆ PhysicalMaterial()

DLLEXPORT Leviathan::PhysicalMaterial::PhysicalMaterial ( const std::string &  name,
int  id 
)
Note
ID must be unique

Definition at line 6 of file PhysicalMaterial.cpp.

6  :
7  Name(name), ID(id)
8 {}

◆ ~PhysicalMaterial()

DLLEXPORT Leviathan::PhysicalMaterial::~PhysicalMaterial ( )

Definition at line 10 of file PhysicalMaterial.cpp.

10 {}

Member Function Documentation

◆ FormPairWith()

DLLEXPORT PhysMaterialDataPair & Leviathan::PhysicalMaterial::FormPairWith ( const PhysicalMaterial other)

Data pairing.

Note
The returned reference is valid only until the next call to FormPairWith

Definition at line 12 of file PhysicalMaterial.cpp.

14 {
15  return InterractionsWith[other.ID] = PhysMaterialDataPair();
16 }
Defines properties between two materials.

◆ GetID()

DLLEXPORT int Leviathan::PhysicalMaterial::GetID ( )
inline

Definition at line 138 of file PhysicalMaterial.h.

139  {
140  return ID;
141  }

◆ GetName()

DLLEXPORT std::string Leviathan::PhysicalMaterial::GetName ( ) const
inline

Definition at line 146 of file PhysicalMaterial.h.

147  {
148  return Name;
149  }

◆ GetPairWith()

auto* Leviathan::PhysicalMaterial::GetPairWith ( int  otherid) const
inline

Returns data for this material to interact with another.

Definition at line 128 of file PhysicalMaterial.h.

129  {
130  const auto found = InterractionsWith.find(otherid);
131 
132  if(found == InterractionsWith.end())
133  return static_cast<const PhysMaterialDataPair*>(nullptr);
134 
135  return &found->second;
136  }

The documentation for this class was generated from the following files: