Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Material.h
1// trax track library
2// AD 2015
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "trax/Configuration.h"
30#include "trax/Units.h"
31
32namespace trax{
33
34 struct Material{
35 enum class Type : int{
36 none = -1,
37 steel = 0,
38 tin,
39 aluminium,
40 copper,
41 stone,
42 coal,
43 soil,
44 wood,
45 asphalt,
46 rubber,
47 filt,
48 glass,
49 paper,
50 concrete,
51 water,
52 plastic,
53 cloth,
54 chalk,
55 diamond,
56 plasma,
57 count_materials
58 } type;
59
60 bool bRinging;
61 One staticFriction;
62 One dynamicFriction;
63 One restitution;
64
65 Material() noexcept
66 : type (Type::steel),
67 bRinging (false),
68 staticFriction (0.6f),
69 dynamicFriction (0.4f),
70 restitution (0.1f)
71 {}
72
73 Material( Type type ) noexcept
74 : type (type),
75 bRinging (false),
76 staticFriction (0.6f),
77 dynamicFriction (0.4f),
78 restitution (0.1f)
79 {}
80 };
81
82 Material::Type operator++( Material::Type& material ) noexcept;
83
84 struct Materials{
85 Materials( Material::Type a, Material::Type b ) noexcept
86 : matA(a), matB(b)
87 {}
88 Materials( unsigned int a, unsigned int b ) noexcept
89 : matA(static_cast<Material::Type>(a)), matB(static_cast<Material::Type>(b))
90 {}
91
92 void Swap() noexcept{
93 std::swap( matA, matB );
94 }
95
96 Material::Type matA;
97 Material::Type matB;
98 };
99
100 dclspc std::string ToString( Material::Type type );
101
102 dclspc Material::Type MaterialType( const std::string& string );
103}
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17