Panda3D
physxClothNode.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 physxClothNode.h
10  * @author enn0x
11  * @date 2010-04-05
12  */
13 
14 #ifndef PHYSXCLOTHNODE_H
15 #define PHYSXCLOTHNODE_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 PhysxCloth;
29 
30 /**
31  * Renderable geometry which represents a cloth mesh.
32  */
33 class EXPCL_PANDAPHYSX PhysxClothNode : public GeomNode {
34 PUBLISHED:
35  INLINE explicit PhysxClothNode(const char *name);
36  INLINE ~PhysxClothNode();
37 
38  bool set_texcoords(const Filename &filename);
39 
40 public:
41  void allocate(PhysxCloth *cloth);
42  void update();
43 
44 private:
45  void create_geom();
46  void update_geom();
47  void update_texcoords();
48 
49  unsigned int _numVertices;
50 
51  NxMeshData _mesh;
52 
53  PT(GeomVertexData) _vdata;
54  PT(Geom) _geom;
55  PT(GeomTriangles) _prim;
56 
57  PT(PhysxCloth) _cloth;
58 
59  unsigned int _numTexcoords;
60  float *_texcoords;
61 
62 public:
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  GeomNode::init_type();
68  register_type(_type_handle, "PhysxClothNode",
69  GeomNode::get_class_type());
70  }
71  virtual TypeHandle get_type() const {
72  return get_class_type();
73  }
74  virtual TypeHandle force_init_type() {
75  init_type();
76  return get_class_type();
77  }
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "physxClothNode.I"
84 
85 #endif // PHYSXCLOTHNODE_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for geometry primitives.
Definition: geom.h:54
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of disconnected triangles.
Definition: geomTriangles.h:23
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A node that holds Geom objects, renderable pieces of geometry.
Definition: geomNode.h:34
Renderable geometry which represents a cloth mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.