Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Collision/PhysicsMaterialSimple.h
9912 views
1
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3
// SPDX-License-Identifier: MIT
4
5
#pragma once
6
7
#include <Jolt/Physics/Collision/PhysicsMaterial.h>
8
9
JPH_NAMESPACE_BEGIN
10
11
/// Sample implementation of PhysicsMaterial that just holds the needed properties directly
12
class JPH_EXPORT PhysicsMaterialSimple : public PhysicsMaterial
13
{
14
JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PhysicsMaterialSimple)
15
16
public:
17
/// Constructor
18
PhysicsMaterialSimple() = default;
19
PhysicsMaterialSimple(const string_view &inName, ColorArg inColor) : mDebugName(inName), mDebugColor(inColor) { }
20
21
// Properties
22
virtual const char * GetDebugName() const override { return mDebugName.c_str(); }
23
virtual Color GetDebugColor() const override { return mDebugColor; }
24
25
// See: PhysicsMaterial::SaveBinaryState
26
virtual void SaveBinaryState(StreamOut &inStream) const override;
27
28
protected:
29
// See: PhysicsMaterial::RestoreBinaryState
30
virtual void RestoreBinaryState(StreamIn &inStream) override;
31
32
private:
33
String mDebugName; ///< Name of the material, used for debugging purposes
34
Color mDebugColor = Color::sGrey; ///< Color of the material, used to render the shapes
35
};
36
37
JPH_NAMESPACE_END
38
39