Panda3D
|
00001 // Filename: characterJointEffect.h 00002 // Created by: drose (26Jul06) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CHARACTERJOINTEFFECT_H 00016 #define CHARACTERJOINTEFFECT_H 00017 00018 #include "pandabase.h" 00019 00020 #include "renderEffect.h" 00021 #include "luse.h" 00022 #include "nodePath.h" 00023 #include "character.h" 00024 #include "weakPointerTo.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : CharacterJointEffect 00028 // Description : This effect will be added automatically to a node by 00029 // CharacterJoint::add_net_transform() and 00030 // CharacterJoint::add_local_transform(). 00031 // 00032 // The effect binds the node back to the character, so 00033 // that querying the relative transform of the affected 00034 // node will automatically force the indicated character 00035 // to be updated first. 00036 //////////////////////////////////////////////////////////////////// 00037 class EXPCL_PANDA_CHAR CharacterJointEffect : public RenderEffect { 00038 private: 00039 INLINE CharacterJointEffect(); 00040 00041 PUBLISHED: 00042 static CPT(RenderEffect) make(Character *character); 00043 00044 INLINE Character *get_character() const; 00045 00046 public: 00047 virtual bool safe_to_transform() const; 00048 virtual bool safe_to_combine() const; 00049 virtual void output(ostream &out) const; 00050 00051 virtual bool has_cull_callback() const; 00052 virtual void cull_callback(CullTraverser *trav, CullTraverserData &data, 00053 CPT(TransformState) &node_transform, 00054 CPT(RenderState) &node_state) const; 00055 00056 virtual bool has_adjust_transform() const; 00057 virtual void adjust_transform(CPT(TransformState) &net_transform, 00058 CPT(TransformState) &node_transform, 00059 PandaNode *node) const; 00060 00061 protected: 00062 virtual int compare_to_impl(const RenderEffect *other) const; 00063 00064 private: 00065 WPT(Character) _character; 00066 00067 public: 00068 static void register_with_read_factory(); 00069 virtual void write_datagram(BamWriter *manager, Datagram &dg); 00070 virtual int complete_pointers(TypedWritable **plist, 00071 BamReader *manager); 00072 00073 protected: 00074 static TypedWritable *make_from_bam(const FactoryParams ¶ms); 00075 void fillin(DatagramIterator &scan, BamReader *manager); 00076 00077 public: 00078 static TypeHandle get_class_type() { 00079 return _type_handle; 00080 } 00081 static void init_type() { 00082 RenderEffect::init_type(); 00083 register_type(_type_handle, "CharacterJointEffect", 00084 RenderEffect::get_class_type()); 00085 } 00086 virtual TypeHandle get_type() const { 00087 return get_class_type(); 00088 } 00089 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00090 00091 private: 00092 static TypeHandle _type_handle; 00093 }; 00094 00095 #include "characterJointEffect.I" 00096 00097 #endif 00098