24 link(NxMaterial *materialPtr) {
28 _ptr->userData =
this;
32 scene->_materials.add(
this);
42 _ptr->userData =
nullptr;
43 _error_type = ET_released;
46 scene->_materials.remove(
this);
55 nassertv(_error_type == ET_ok);
58 _ptr->getScene().releaseMaterial(*_ptr);
68 nassertr(_error_type == ET_ok,
nullptr);
69 return (
PhysxScene *)(_ptr->getScene().userData);
85 nassertr(_error_type == ET_ok, 0);
86 return _ptr->getMaterialIndex();
96 nassertv(_error_type == ET_ok);
97 _ptr->loadFromDesc(materialDesc._desc);
106 nassertv(_error_type == ET_ok);
107 _ptr->saveToDesc(materialDesc._desc);
118 nassertv(_error_type == ET_ok);
119 _ptr->setRestitution(restitution);
128 nassertr(_error_type == ET_ok, 0.0f);
129 return _ptr->getRestitution();
141 nassertv(_error_type == ET_ok);
142 _ptr->setStaticFriction(coef);
151 nassertr(_error_type == ET_ok, 0.0f);
152 return _ptr->getStaticFriction();
165 nassertv(_error_type == ET_ok);
166 _ptr->setDynamicFriction(coef);
175 nassertr(_error_type == ET_ok, 0.0f);
176 return _ptr->getDynamicFriction();
187 nassertv(_error_type == ET_ok);
188 _ptr->setStaticFrictionV(coef);
197 nassertr(_error_type == ET_ok, 0.0f);
198 return _ptr->getStaticFrictionV();
209 nassertv(_error_type == ET_ok);
210 _ptr->setDynamicFrictionV(coef);
219 nassertr(_error_type == ET_ok, 0.0f);
220 return _ptr->getDynamicFrictionV();
229 nassertv(_error_type == ET_ok);
230 NxU32 flags = _ptr->getFlags();
239 _ptr->setFlags(flags);
248 nassertr(_error_type == ET_ok,
false);
249 return (_ptr->getFlags() & flag) ?
true :
false;
259 nassertv(_error_type == ET_ok);
269 nassertr(_error_type == ET_ok, LVector3f::zero());
281 nassertv(_error_type == ET_ok);
282 _ptr->setFrictionCombineMode((NxCombineMode)mode);
291 nassertr(_error_type == ET_ok, CM_average);
292 return (PhysxCombineMode)_ptr->getFrictionCombineMode();
303 nassertv(_error_type == ET_ok);
304 _ptr->setRestitutionCombineMode((NxCombineMode)mode);
313 nassertr(_error_type == ET_ok, CM_average);
314 return (PhysxCombineMode)_ptr->getRestitutionCombineMode();
Descriptor class for materials.
PhysxScene * get_scene() const
Returns the scene that owns this material.
float get_static_friction() const
Returns the coefficient of static friction.
void set_static_friction_v(float coef)
Sets the static friction coefficient along the secondary (V) axis.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void load_from_desc(const PhysxMaterialDesc &materialDesc)
Loads the entire state of the material from a descriptor with a single call.
float get_static_friction_v() const
Returns the static friction coefficient for the V direction.
void set_restitution_combine_mode(PhysxCombineMode mode)
Sets the restitution combine mode.
PhysxCombineMode get_restitution_combine_mode() const
Returns the restitution combine mode.
A scene is a collection of bodies, constraints, and effectors which can interact.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LVector3f get_dir_of_anisotropy() const
Returns the direction of anisotropy value.
float get_dynamic_friction() const
Returns the DynamicFriction value.
PhysxCombineMode get_friction_combine_mode() const
Returns the friction combine mode.
void set_static_friction(float coef)
Sets the coefficient of static friction.
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
float get_dynamic_friction_v() const
Returns the dynamic friction coefficient for the V direction.
unsigned short get_material_index() const
Returns the material index for this material.
void set_dynamic_friction_v(float coef)
Sets the dynamic friction coefficient along the secondary (V) axis.
void set_flag(PhysxMaterialFlag flag, bool value)
Sets the value of a single flag.
void set_friction_combine_mode(PhysxCombineMode mode)
Sets the friction combine mode.
float get_restitution() const
Returns the coefficient of restitution.
void set_dynamic_friction(float coef)
Sets the coefficient of dynamic friction.
TypeHandle is the identifier used to differentiate C++ class types.
bool get_flag(PhysxMaterialFlag flag) const
Returns the value of a single flag.
void save_to_desc(PhysxMaterialDesc &materialDesc) const
Saves the state of the material object to a descriptor.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_restitution(float rest)
Sets the coefficient of restitution.
void set_dir_of_anisotropy(const LVector3f dir)
Sets the shape space direction (unit vector) of anisotropy.