PeriDyno 1.0.0
Loading...
Searching...
No Matches
Attribute.h
Go to the documentation of this file.
1
16#pragma once
17#include "Platform.h"
18
19namespace dyno
20{
26 {
27 public:
28 DYN_FUNC Attribute() {
29 m_tag = 0;
30 this->setDynamic();
32 }
33
34 DYN_FUNC ~Attribute() {};
35
37 {
38 MATERIAL_MASK = 0xC0000000,
39 MATERIAL_FLUID = 0x00000000,
40 MATERIAL_RIGID = 0x40000000,
41 MATERIAL_ELASTIC = 0x80000000,
42 MATERIAL_PLASTIC = 0xC0000000
43 };
44
46 {
47 KINEMATIC_MASK = 0x30000000,
48 KINEMATIC_FIXED = 0x00000000,
49 KINEMATIC_PASSIVE = 0x10000000,
50 KINEMATIC_POSITIVE = 0x20000000
51 };
52
54 {
55 OBJECTID_MASK = 0x000000FF,
56 OBJECTID_INVALID = 0x000000FF,
57 };
58
59 DYN_FUNC inline void setMaterialType(MaterialType type) { m_tag = ((~MATERIAL_MASK) & m_tag) | type; }
60 DYN_FUNC inline void setKinematicType(KinematicType type) { m_tag = ((~KINEMATIC_MASK) & m_tag) | type; }
61 DYN_FUNC inline void setObjectId(unsigned id) { m_tag = ((~OBJECTID_MASK) & m_tag) | ((OBJECTID_MASK)& id); }
62
63 DYN_FUNC inline MaterialType materialType() { return (MaterialType)(m_tag&MATERIAL_MASK); }
65
66 DYN_FUNC inline bool isFluid() { return MaterialType::MATERIAL_FLUID == materialType(); }
67 DYN_FUNC inline bool isRigid() { return MaterialType::MATERIAL_RIGID == materialType(); }
68 DYN_FUNC inline bool isElastic() { return MaterialType::MATERIAL_ELASTIC == materialType(); }
69 DYN_FUNC inline bool isPlastic() { return MaterialType::MATERIAL_PLASTIC == materialType(); }
70
75
76 DYN_FUNC inline bool isFixed() { return KinematicType::KINEMATIC_FIXED == kinematicType(); }
77 DYN_FUNC inline bool isPassive() { return KinematicType::KINEMATIC_PASSIVE == kinematicType(); }
78 DYN_FUNC inline bool isDynamic() { return KinematicType::KINEMATIC_POSITIVE == kinematicType(); }
79
83
84 DYN_FUNC inline unsigned objectId() { return (unsigned)(m_tag&OBJECTID_MASK); }
85
86 private:
88 };
89}
90
DYN_FUNC bool isElastic()
Definition Attribute.h:68
DYN_FUNC KinematicType kinematicType()
Definition Attribute.h:64
DYN_FUNC void setPlastic()
Definition Attribute.h:74
DYN_FUNC unsigned objectId()
Definition Attribute.h:84
DYN_FUNC bool isPlastic()
Definition Attribute.h:69
DYN_FUNC void setFluid()
Definition Attribute.h:71
DYN_FUNC bool isPassive()
Definition Attribute.h:77
DYN_FUNC void setRigid()
Definition Attribute.h:72
DYN_FUNC bool isRigid()
Definition Attribute.h:67
DYN_FUNC void setKinematicType(KinematicType type)
Definition Attribute.h:60
DYN_FUNC MaterialType materialType()
Definition Attribute.h:63
DYN_FUNC void setMaterialType(MaterialType type)
Definition Attribute.h:59
DYN_FUNC bool isDynamic()
Definition Attribute.h:78
DYN_FUNC void setElastic()
Definition Attribute.h:73
DYN_FUNC bool isFluid()
Definition Attribute.h:66
DYN_FUNC bool isFixed()
Definition Attribute.h:76
DYN_FUNC void setObjectId(unsigned id)
Definition Attribute.h:61
DYN_FUNC ~Attribute()
Definition Attribute.h:34
DYN_FUNC void setPassive()
Definition Attribute.h:81
DYN_FUNC Attribute()
Definition Attribute.h:28
DYN_FUNC void setFixed()
Definition Attribute.h:80
DYN_FUNC void setDynamic()
Definition Attribute.h:82
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
unsigned int uint
Definition VkProgram.h:14