Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Collision/PhysicsMaterial.h
9912 views
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)1// SPDX-FileCopyrightText: 2021 Jorrit Rouwe2// SPDX-License-Identifier: MIT34#pragma once56#include <Jolt/Core/Reference.h>7#include <Jolt/Core/Color.h>8#include <Jolt/Core/Result.h>9#include <Jolt/ObjectStream/SerializableObject.h>1011JPH_NAMESPACE_BEGIN1213class StreamIn;14class StreamOut;1516/// This structure describes the surface of (part of) a shape. You should inherit from it to define additional17/// information that is interesting for the simulation. The 2 materials involved in a contact could be used18/// to decide which sound or particle effects to play.19///20/// If you inherit from this material, don't forget to create a suitable default material in sDefault21class JPH_EXPORT PhysicsMaterial : public SerializableObject, public RefTarget<PhysicsMaterial>22{23JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, PhysicsMaterial)2425public:26/// Virtual destructor27virtual ~PhysicsMaterial() override = default;2829/// Default material that is used when a shape has no materials defined30static RefConst<PhysicsMaterial> sDefault;3132// Properties33virtual const char * GetDebugName() const { return "Unknown"; }34virtual Color GetDebugColor() const { return Color::sGrey; }3536/// Saves the contents of the material in binary form to inStream.37virtual void SaveBinaryState(StreamOut &inStream) const;3839using PhysicsMaterialResult = Result<Ref<PhysicsMaterial>>;4041/// Creates a PhysicsMaterial of the correct type and restores its contents from the binary stream inStream.42static PhysicsMaterialResult sRestoreFromBinaryState(StreamIn &inStream);4344protected:45/// This function should not be called directly, it is used by sRestoreFromBinaryState.46virtual void RestoreBinaryState(StreamIn &inStream);47};4849using PhysicsMaterialList = Array<RefConst<PhysicsMaterial>>;5051JPH_NAMESPACE_END525354