Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
PhysicsMaterialSimple.h
Go to the documentation of this file.
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
8
10
13{
14public:
16
17
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
28protected:
29 // See: PhysicsMaterial::RestoreBinaryState
30 virtual void RestoreBinaryState(StreamIn &inStream) override;
31
32private:
33 String mDebugName;
34 Color mDebugColor = Color::sGrey;
35};
36
#define JPH_EXPORT
Definition: Core.h:227
#define JPH_NAMESPACE_END
Definition: Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
std::basic_string< char, std::char_traits< char >, STLAllocator< char > > String
Definition: STLAllocator.h:82
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition: SerializableObject.h:100
Class that holds an RGBA color with 8-bits per component.
Definition: Color.h:16
static const Color sGrey
Definition: Color.h:62
Definition: PhysicsMaterial.h:23
virtual void RestoreBinaryState(StreamIn &inStream)
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition: PhysicsMaterial.cpp:25
virtual void SaveBinaryState(StreamOut &inStream) const
Saves the contents of the material in binary form to inStream.
Definition: PhysicsMaterial.cpp:20
Sample implementation of PhysicsMaterial that just holds the needed properties directly.
Definition: PhysicsMaterialSimple.h:13
virtual Color GetDebugColor() const override
Definition: PhysicsMaterialSimple.h:23
virtual const char * GetDebugName() const override
Definition: PhysicsMaterialSimple.h:22
Simple binary input stream.
Definition: StreamIn.h:13
Simple binary output stream.
Definition: StreamOut.h:13