OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
physicmeshshape.cpp
Go to the documentation of this file.
1
#include "
physicmeshshape.h
"
2
3
#include "
graphics/mesh/submesh/packedmesh.h
"
4
#include "
dynamicworld.h
"
5
6
float
PhysicMeshShape::friction
()
const
{
7
return
frict;
8
}
9
10
PhysicMeshShape
*
PhysicMeshShape::load
(
PackedMesh
&& packed) {
11
uint32_t count = 0;
12
for
(
auto
& i : packed.subMeshes)
13
if
(!i.material.disable_collision && i.iboLength > 0) {
14
count++;
15
}
16
if
(count == 0)
17
return
nullptr
;
18
return
new
PhysicMeshShape
(std::move(packed));
19
}
20
21
PhysicMeshShape::PhysicMeshShape
(
PackedMesh
&& sPacked)
22
:mesh(std::move(sPacked)), shape(&mesh, mesh.useQuantization(), true) {
23
for
(
auto
& i:sPacked.subMeshes)
24
frict +=
DynamicWorld
::materialFriction(i.material.group);
25
frict = frict/float(sPacked.subMeshes.size());
26
}
DynamicWorld
Definition
dynamicworld.h:28
PackedMesh
Definition
packedmesh.h:15
PhysicMeshShape
Definition
physicmeshshape.h:6
PhysicMeshShape::PhysicMeshShape
PhysicMeshShape(const PhysicMeshShape &)=delete
PhysicMeshShape::friction
float friction() const
Definition
physicmeshshape.cpp:6
PhysicMeshShape::load
static PhysicMeshShape * load(PackedMesh &&packed)
Definition
physicmeshshape.cpp:10
dynamicworld.h
packedmesh.h
physicmeshshape.h
game
physics
physicmeshshape.cpp
Generated by
1.9.8