15 #include "physxMaterial.h"
16 #include "physxMaterialDesc.h"
17 #include "physxManager.h"
27 link(NxMaterial *materialPtr) {
31 _ptr->userData =
this;
35 scene->_materials.add(
this);
47 _ptr->userData = NULL;
48 _error_type = ET_released;
51 scene->_materials.remove(
this);
62 nassertv(_error_type == ET_ok);
65 _ptr->getScene().releaseMaterial(*_ptr);
77 nassertr(_error_type == ET_ok, NULL);
78 return (
PhysxScene *)(_ptr->getScene().userData);
97 nassertr(_error_type == ET_ok, 0);
98 return _ptr->getMaterialIndex();
110 nassertv(_error_type == ET_ok);
111 _ptr->loadFromDesc(materialDesc._desc);
123 nassertv(_error_type == ET_ok);
124 _ptr->saveToDesc(materialDesc._desc);
138 nassertv(_error_type == ET_ok);
139 _ptr->setRestitution(restitution);
150 nassertr(_error_type == ET_ok, 0.0f);
151 return _ptr->getRestitution();
167 nassertv(_error_type == ET_ok);
168 _ptr->setStaticFriction(coef);
179 nassertr(_error_type == ET_ok, 0.0f);
180 return _ptr->getStaticFriction();
198 nassertv(_error_type == ET_ok);
199 _ptr->setDynamicFriction(coef);
210 nassertr(_error_type == ET_ok, 0.0f);
211 return _ptr->getDynamicFriction();
225 nassertv(_error_type == ET_ok);
226 _ptr->setStaticFrictionV(coef);
238 nassertr(_error_type == ET_ok, 0.0f);
239 return _ptr->getStaticFrictionV();
253 nassertv(_error_type == ET_ok);
254 _ptr->setDynamicFrictionV(coef);
266 nassertr(_error_type == ET_ok, 0.0f);
267 return _ptr->getDynamicFrictionV();
278 nassertv(_error_type == ET_ok);
279 NxU32 flags = _ptr->getFlags();
288 _ptr->setFlags(flags);
299 nassertr(_error_type == ET_ok,
false);
300 return (_ptr->getFlags() & flag) ?
true :
false;
313 nassertv(_error_type == ET_ok);
341 nassertv(_error_type == ET_ok);
342 _ptr->setFrictionCombineMode((NxCombineMode)mode);
353 nassertr(_error_type == ET_ok, CM_average);
354 return (PhysxCombineMode)_ptr->getFrictionCombineMode();
369 nassertv(_error_type == ET_ok);
370 _ptr->setRestitutionCombineMode((NxCombineMode)mode);
381 nassertr(_error_type == ET_ok, CM_average);
382 return (PhysxCombineMode)_ptr->getRestitutionCombineMode();
Descriptor class for materials.
void set_static_friction_v(float coef)
Sets the static friction coefficient along the secondary (V) axis.
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.
static const LVector3f & zero()
Returns a zero-length vector.
float get_restitution() const
Returns the coefficient of restitution.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
A scene is a collection of bodies, constraints, and effectors which can interact. ...
bool get_flag(PhysxMaterialFlag flag) const
Returns the value of a single flag.
float get_static_friction() const
Returns the coefficient of static friction.
float get_dynamic_friction() const
Returns the DynamicFriction value.
PhysxScene * get_scene() const
Returns the scene that owns this material.
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.
LVector3f get_dir_of_anisotropy() const
Returns the direction of anisotropy value.
void set_dynamic_friction_v(float coef)
Sets the dynamic friction coefficient along the secondary (V) axis.
float get_dynamic_friction_v() const
Returns the dynamic friction coefficient for the V direction.
PhysxCombineMode get_friction_combine_mode() const
Returns the friction combine mode.
unsigned short get_material_index() const
Returns the material index for this material.
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.
void save_to_desc(PhysxMaterialDesc &materialDesc) const
Saves the state of the material object to a descriptor.
void set_dynamic_friction(float coef)
Sets the coefficient of dynamic friction.
TypeHandle is the identifier used to differentiate C++ class types.
PhysxCombineMode get_restitution_combine_mode() const
Returns the restitution combine mode.
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.