Panda3D
characterJointEffect.h
1 // Filename: characterJointEffect.h
2 // Created by: drose (26Jul06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef CHARACTERJOINTEFFECT_H
16 #define CHARACTERJOINTEFFECT_H
17 
18 #include "pandabase.h"
19 
20 #include "renderEffect.h"
21 #include "luse.h"
22 #include "nodePath.h"
23 #include "character.h"
24 #include "weakPointerTo.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : CharacterJointEffect
28 // Description : This effect will be added automatically to a node by
29 // CharacterJoint::add_net_transform() and
30 // CharacterJoint::add_local_transform().
31 //
32 // The effect binds the node back to the character, so
33 // that querying the relative transform of the affected
34 // node will automatically force the indicated character
35 // to be updated first.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDA_CHAR CharacterJointEffect : public RenderEffect {
38 private:
39  INLINE CharacterJointEffect();
40 
41 PUBLISHED:
42  static CPT(RenderEffect) make(Character *character);
43 
44  INLINE Character *get_character() const;
45 
46 public:
47  virtual bool safe_to_transform() const;
48  virtual bool safe_to_combine() const;
49  virtual void output(ostream &out) const;
50 
51  virtual bool has_cull_callback() const;
52  virtual void cull_callback(CullTraverser *trav, CullTraverserData &data,
53  CPT(TransformState) &node_transform,
54  CPT(RenderState) &node_state) const;
55 
56  virtual bool has_adjust_transform() const;
57  virtual void adjust_transform(CPT(TransformState) &net_transform,
58  CPT(TransformState) &node_transform,
59  PandaNode *node) const;
60 
61 protected:
62  virtual int compare_to_impl(const RenderEffect *other) const;
63 
64 private:
65  WPT(Character) _character;
66 
67 public:
68  static void register_with_read_factory();
69  virtual void write_datagram(BamWriter *manager, Datagram &dg);
71  BamReader *manager);
72 
73 protected:
74  static TypedWritable *make_from_bam(const FactoryParams &params);
75  void fillin(DatagramIterator &scan, BamReader *manager);
76 
77 public:
78  static TypeHandle get_class_type() {
79  return _type_handle;
80  }
81  static void init_type() {
82  RenderEffect::init_type();
83  register_type(_type_handle, "CharacterJointEffect",
84  RenderEffect::get_class_type());
85  }
86  virtual TypeHandle get_type() const {
87  return get_class_type();
88  }
89  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
90 
91 private:
92  static TypeHandle _type_handle;
93 };
94 
95 #include "characterJointEffect.I"
96 
97 #endif
98 
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
An animated character, with skeleton-morph animation and either soft-skinned or hard-skinned vertices...
Definition: character.h:41
This effect will be added automatically to a node by CharacterJoint::add_net_transform() and Characte...
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is the base class for a number of special render effects that may be set on scene graph nodes to...
Definition: renderEffect.h:56
This is our own Panda specialization on the default STL list.
Definition: plist.h:38
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of RenderEffect by calling the...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48