Panda3D

Loading...
Searching...
No Matches
physxSoftBodyNode.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxSoftBodyNode.h
10 * @author enn0x
11 * @date 2010-09-13
12 */
13
14#ifndef PHYSXSOFTBODYNODE_H
15#define PHYSXSOFTBODYNODE_H
16
17#include "pandabase.h"
18#include "pointerTo.h"
19#include "geomNode.h"
20#include "transformState.h"
21#include "geom.h"
22#include "geomVertexData.h"
23#include "geomTriangles.h"
24#include "filename.h"
25
26#include "physx_includes.h"
27
28 class PhysxSoftBody;
29
30/**
31 * Renderable geometry which represents a soft body mesh.
32 */
33 class EXPCL_PANDAPHYSX PhysxSoftBodyNode : public GeomNode {
34PUBLISHED:
35 INLINE explicit PhysxSoftBodyNode(const char *name);
36 INLINE ~PhysxSoftBodyNode();
37
38 void set_from_geom(const Geom *geom);
39
40 public:
41 void allocate(PhysxSoftBody *cloth);
42 void update();
43
44 private:
45
46 struct TetraLink {
47 int tetraNr;
48 NxVec3 barycentricCoords;
49 };
50
51 void update_bounds();
52 void build_tetra_links();
53 bool update_tetra_links();
54 void update_normals();
55 void remove_tris_related_to_vertex(const int vertexIndex);
56 NxVec3 compute_bary_coords(NxVec3 vertex, NxVec3 p0, NxVec3 p1, NxVec3 p2, NxVec3 p3) const;
57
58 pvector<TetraLink> _tetraLinks;
59 pvector<bool> _drainedTriVertices;
60 pvector<LVecBase3f> _normals;
61
62 NxBounds3 _bounds;
63 NxMeshData _mesh;
64
65 PT(GeomVertexData) _vdata;
66 PT(Geom) _geom;
67 PT(GeomTriangles) _prim;
68
69 PT(PhysxSoftBody) _softbody;
70
71 public:
72 static TypeHandle get_class_type() {
73 return _type_handle;
74 }
75 static void init_type() {
76 GeomNode::init_type();
77 register_type(_type_handle, "PhysxSoftBodyNode",
78 GeomNode::get_class_type());
79 }
80 virtual TypeHandle get_type() const {
81 return get_class_type();
82 }
83 virtual TypeHandle force_init_type() {
84 init_type();
85 return get_class_type();
86 }
87
88 private:
89 static TypeHandle _type_handle;
90};
91
92#include "physxSoftBodyNode.I"
93
94#endif // PHYSXSOFTBODYNODE_H
GeomTriangles
Defines a series of disconnected triangles.
Definition geomTriangles.h:23
GeomVertexData
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
Definition geomVertexData.h:68
Geom
A container for geometry primitives.
Definition geom.h:54
PhysxSoftBodyNode::set_from_geom
void set_from_geom(const Geom *geom)
Reads the vertices and indices from an existing Geom and makes a decomposed copy of the data.
Definition physxSoftBodyNode.cxx:71
PhysxSoftBody
Definition physxSoftBody.h:32
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
filename.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geomNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geomTriangles.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geomVertexData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geom.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxSoftBodyNode.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physx_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
transformState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.