1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Physics/BsPhysicsMaterial.h"
4#include "Private/RTTI/BsPhysicsMaterialRTTI.h"
5#include "Resources/BsResources.h"
6#include "Physics/BsPhysics.h"
7
8namespace bs
9{
10 HPhysicsMaterial PhysicsMaterial::create(float staticFriction, float dynamicFriction, float restitution)
11 {
12 SPtr<PhysicsMaterial> newMaterial = _createPtr(staticFriction, dynamicFriction, restitution);
13
14 return static_resource_cast<PhysicsMaterial>(gResources()._createResourceHandle(newMaterial));
15 }
16
17 SPtr<PhysicsMaterial> PhysicsMaterial::_createPtr(float staticFriction, float dynamicFriction, float restitution)
18 {
19 SPtr<PhysicsMaterial> newMaterial = gPhysics().createMaterial(staticFriction, dynamicFriction, restitution);
20 newMaterial->_setThisPtr(newMaterial);
21 newMaterial->initialize();
22
23 return newMaterial;
24 }
25
26 RTTITypeBase* PhysicsMaterial::getRTTIStatic()
27 {
28 return PhysicsMaterialRTTI::instance();
29 }
30
31 RTTITypeBase* PhysicsMaterial::getRTTI() const
32 {
33 return getRTTIStatic();
34 }
35}