18 #include "pandabase.h" 20 #include "eggGroupNode.h" 21 #include "eggRenderMode.h" 22 #include "eggTransform.h" 23 #include "eggVertex.h" 24 #include "eggSwitchCondition.h" 25 #include "pt_EggVertex.h" 28 #include "collideMask.h" 29 #include "vector_string.h" 45 GT_group = 0x00000000,
46 GT_instance = 0x00000001,
47 GT_joint = 0x00000002,
51 DC_unspecified = 0x00000000,
53 DC_local = 0x00000020,
55 DC_no_touch = 0x00000040,
56 DC_default = 0x00000050,
62 BT_point_camera_relative = 0x00000040,
63 BT_point_world_relative = 0x00000080,
65 enum CollisionSolidType {
68 CST_none = 0x00000000,
69 CST_plane = 0x00010000,
70 CST_polygon = 0x00020000,
71 CST_polyset = 0x00030000,
72 CST_sphere = 0x00040000,
73 CST_tube = 0x00050000,
74 CST_inv_sphere = 0x00060000,
76 CST_floor_mesh = 0x00080000,
82 CF_descend = 0x00100000,
83 CF_event = 0x00200000,
85 CF_solid = 0x00800000,
86 CF_center = 0x01000000,
87 CF_turnstile = 0x02000000,
88 CF_level = 0x04000000,
89 CF_intangible = 0x08000000,
95 DT_structured = 0x10000000,
97 DT_nosync = 0x30000000,
98 DT_default = 0x40000000,
119 BO_one_minus_incoming_color,
121 BO_one_minus_fbuffer_color,
123 BO_one_minus_incoming_alpha,
125 BO_one_minus_fbuffer_alpha,
127 BO_one_minus_constant_color,
129 BO_one_minus_constant_alpha,
130 BO_incoming_color_saturate,
132 BO_one_minus_color_scale,
134 BO_one_minus_alpha_scale,
142 virtual void write(ostream &out,
int indent_level)
const;
143 void write_billboard_flags(ostream &out,
int indent_level)
const;
144 void write_collide_flags(ostream &out,
int indent_level)
const;
145 void write_model_flags(ostream &out,
int indent_level)
const;
146 void write_switch_flags(ostream &out,
int indent_level)
const;
147 void write_object_types(ostream &out,
int indent_level)
const;
148 void write_decal_flags(ostream &out,
int indent_level)
const;
149 void write_tags(ostream &out,
int indent_level)
const;
150 void write_render_mode(ostream &out,
int indent_level)
const;
164 void set_group_type(GroupType type);
165 INLINE GroupType get_group_type()
const;
166 INLINE
bool is_instance_type()
const;
168 INLINE
void set_billboard_type(BillboardType type);
169 INLINE BillboardType get_billboard_type()
const;
171 INLINE
void set_billboard_center(
const LPoint3d &billboard_center);
172 INLINE
void clear_billboard_center();
173 INLINE
bool has_billboard_center()
const;
174 INLINE
const LPoint3d &get_billboard_center()
const;
176 INLINE
void set_cs_type(CollisionSolidType type);
177 INLINE CollisionSolidType get_cs_type()
const;
179 INLINE
void set_collide_flags(
int flags);
180 INLINE CollideFlags get_collide_flags()
const;
182 INLINE
void set_collision_name(
const string &collision_name);
183 INLINE
void clear_collision_name();
184 INLINE
bool has_collision_name()
const;
185 INLINE
const string &get_collision_name()
const;
187 INLINE
void set_dcs_type(DCSType type);
188 INLINE DCSType get_dcs_type()
const;
189 INLINE
bool has_dcs_type()
const;
191 INLINE
void set_dart_type(DartType type);
192 INLINE DartType get_dart_type()
const;
194 INLINE
void set_switch_flag(
bool flag);
195 INLINE
bool get_switch_flag()
const;
197 INLINE
void set_switch_fps(
double fps);
198 INLINE
double get_switch_fps()
const;
200 INLINE
void add_object_type(
const string &object_type);
201 INLINE
void clear_object_types();
202 INLINE
int get_num_object_types()
const;
203 INLINE
string get_object_type(
int index)
const;
204 MAKE_SEQ(get_object_types, get_num_object_types, get_object_type);
205 bool has_object_type(
const string &object_type)
const;
206 bool remove_object_type(
const string &object_type);
208 INLINE
void set_model_flag(
bool flag);
209 INLINE
bool get_model_flag()
const;
211 INLINE
void set_texlist_flag(
bool flag);
212 INLINE
bool get_texlist_flag()
const;
214 INLINE
void set_nofog_flag(
bool flag);
215 INLINE
bool get_nofog_flag()
const;
217 INLINE
void set_decal_flag(
bool flag);
218 INLINE
bool get_decal_flag()
const;
220 INLINE
void set_direct_flag(
bool flag);
221 INLINE
bool get_direct_flag()
const;
223 INLINE
void set_portal_flag(
bool flag);
224 INLINE
bool get_portal_flag()
const;
226 INLINE
void set_occluder_flag(
bool flag);
227 INLINE
bool get_occluder_flag()
const;
229 INLINE
void set_polylight_flag(
bool flag);
230 INLINE
bool get_polylight_flag()
const;
232 INLINE
void set_indexed_flag(
bool flag);
233 INLINE
void clear_indexed_flag();
234 INLINE
bool has_indexed_flag()
const;
235 INLINE
bool get_indexed_flag()
const;
238 INLINE
void clear_collide_mask();
239 INLINE
bool has_collide_mask()
const;
242 INLINE
void set_from_collide_mask(
CollideMask mask);
243 INLINE
void clear_from_collide_mask();
244 INLINE
bool has_from_collide_mask()
const;
247 INLINE
void set_into_collide_mask(
CollideMask mask);
248 INLINE
void clear_into_collide_mask();
249 INLINE
bool has_into_collide_mask()
const;
252 INLINE
void set_blend_mode(BlendMode blend_mode);
253 INLINE BlendMode get_blend_mode()
const;
254 INLINE
void set_blend_operand_a(BlendOperand blend_operand_a);
255 INLINE BlendOperand get_blend_operand_a()
const;
256 INLINE
void set_blend_operand_b(BlendOperand blend_operand_b);
257 INLINE BlendOperand get_blend_operand_b()
const;
258 INLINE
void set_blend_color(
const LColor &blend_color);
259 INLINE
void clear_blend_color();
260 INLINE
bool has_blend_color()
const;
261 INLINE
const LColor &get_blend_color()
const;
264 INLINE
void clear_lod();
265 INLINE
bool has_lod()
const;
268 INLINE
void set_tag(
const string &key,
const string &value);
269 INLINE
string get_tag(
const string &key)
const;
270 INLINE
bool has_tag(
const string &key)
const;
271 INLINE
void clear_tag(
const string &key);
275 INLINE
void set_default_pose(
const EggTransform &transform);
276 INLINE
void clear_default_pose();
278 INLINE
void set_scroll_u(
const double u_speed);
279 INLINE
void set_scroll_v(
const double v_speed);
280 INLINE
void set_scroll_w(
const double w_speed);
281 INLINE
void set_scroll_r(
const double r_speed);
282 INLINE
double get_scroll_u()
const;
283 INLINE
double get_scroll_v()
const;
284 INLINE
double get_scroll_w()
const;
285 INLINE
double get_scroll_r()
const;
287 INLINE
bool has_scrolling_uvs();
290 INLINE TagData::const_iterator tag_begin()
const;
291 INLINE TagData::const_iterator tag_end()
const;
292 INLINE TagData::size_type tag_size()
const;
295 void ref_vertex(
EggVertex *vert,
double membership = 1.0);
297 void unref_all_vertices();
298 double get_vertex_membership(
const EggVertex *vert)
const;
299 void set_vertex_membership(
EggVertex *vert,
double membership);
303 INLINE VertexRef::const_iterator vref_begin()
const;
304 INLINE VertexRef::const_iterator vref_end()
const;
305 INLINE VertexRef::size_type vref_size()
const;
309 void test_vref_integrity()
const;
311 void test_vref_integrity()
const { }
314 void add_group_ref(
EggGroup *group);
315 int get_num_group_refs()
const;
316 EggGroup *get_group_ref(
int n)
const;
317 MAKE_SEQ(get_group_refs, get_num_group_refs, get_group_ref);
318 void remove_group_ref(
int n);
319 void clear_group_refs();
321 static GroupType string_group_type(
const string &strval);
322 static DartType string_dart_type(
const string &strval);
323 static DCSType string_dcs_type(
const string &strval);
324 static BillboardType string_billboard_type(
const string &strval);
325 static CollisionSolidType string_cs_type(
const string &strval);
326 static CollideFlags string_collide_flags(
const string &strval);
327 static BlendMode string_blend_mode(
const string &strval);
328 static BlendOperand string_blend_operand(
const string &strval);
334 void write_vertex_ref(ostream &out,
int indent_level)
const;
335 virtual bool egg_start_parse_body();
336 virtual void adjust_under();
338 CoordinateSystem to_cs);
339 virtual void r_flatten_transforms();
341 virtual void transform_changed();
346 F_group_type = 0x00000003,
348 F_billboard_type = 0x000000e0,
349 F_switch_flag = 0x00000100,
350 F_model_flag = 0x00000400,
351 F_texlist_flag = 0x00000800,
352 F_nofog_flag = 0x00001000,
353 F_decal_flag = 0x00002000,
354 F_direct_flag = 0x00004000,
355 F_cs_type = 0x000f0000,
356 F_collide_flags = 0x0ff00000,
357 F_dart_type = 0xf0000000,
360 F2_collide_mask = 0x00000001,
361 F2_from_collide_mask = 0x00000002,
362 F2_into_collide_mask = 0x00000004,
363 F2_billboard_center = 0x00000008,
365 F2_dcs_type = 0x00000070,
366 F2_portal_flag = 0x00000080,
367 F2_polylight_flag = 0x00000100,
368 F2_indexed_flag = 0x00000200,
369 F2_has_indexed_flag = 0x00000400,
370 F2_has_blend_color = 0x00000800,
371 F2_occluder_flag = 0x00001000,
376 CollideMask _collide_mask, _from_collide_mask, _into_collide_mask;
377 BlendMode _blend_mode;
378 BlendOperand _blend_operand_a;
379 BlendOperand _blend_operand_b;
382 vector_string _object_types;
383 string _collision_name;
401 GroupRefs _group_refs;
409 static void init_type() {
410 EggGroupNode::init_type();
411 EggRenderMode::init_type();
412 register_type(_type_handle,
"EggGroup",
413 EggGroupNode::get_class_type(),
414 EggRenderMode::get_class_type());
417 return get_class_type();
419 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
425 ostream &operator << (ostream &out, EggGroup::GroupType t);
426 ostream &operator << (ostream &out, EggGroup::DartType t);
427 ostream &operator << (ostream &out, EggGroup::DCSType t);
428 ostream &operator << (ostream &out, EggGroup::BillboardType t);
429 ostream &operator << (ostream &out, EggGroup::CollisionSolidType t);
430 ostream &operator << (ostream &out, EggGroup::CollideFlags t);
431 ostream &operator << (ostream &out, EggGroup::BlendMode t);
432 ostream &operator << (ostream &out, EggGroup::BlendOperand t);
435 #include "eggGroup.I" virtual bool determine_indexed()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "indexed" sc...
virtual void write(ostream &out, int indent_level) const
Writes the group and all of its children to the indicated output stream in Egg format.
This is a 4-by-4 transform matrix.
A base class for nodes in the hierarchy that are not leaf nodes.
virtual EggRenderMode * determine_draw_order()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_depth_test_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
This class stores miscellaneous rendering properties that is associated with geometry, and which may be set on the geometry primitive level, on the group above it, or indirectly via a texture.
virtual EggTransform * as_transform()
Returns this object cross-cast to an EggTransform pointer, if it inherits from EggTransform, or NULL if it does not.
virtual bool determine_decal()
Walks back up the hierarchy, looking for an EggGroup at this level or above that has the "decal" flag...
virtual EggRenderMode * determine_visibility_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
virtual EggRenderMode * determine_depth_write_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual EggRenderMode * determine_alpha_mode()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
virtual bool is_joint() const
Returns true if this particular node represents a <Joint> entry or not.
virtual EggRenderMode * determine_bin()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
This is the base class for all three-component vectors and points.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
TypeHandle is the identifier used to differentiate C++ class types.
virtual EggRenderMode * determine_depth_offset()
Walks back up the hierarchy, looking for an EggGroup or EggPrimitive or some such object at this leve...
This corresponds to a <SwitchCondition> entry within a group.