mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
extend interface for egg2flt
This commit is contained in:
parent
d2747bd99a
commit
29b4df01d4
@ -195,18 +195,58 @@ write(ostream &out, int indent_level) const {
|
|||||||
get_lod().write(out, indent_level + 2);
|
get_lod().write(out, indent_level + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_billboard_flags(out, indent_level + 2);
|
||||||
|
write_collide_flags(out, indent_level + 2);
|
||||||
|
write_model_flags(out, indent_level + 2);
|
||||||
|
write_switch_flags(out, indent_level + 2);
|
||||||
|
|
||||||
|
if (has_transform()) {
|
||||||
|
EggTransform3d::write(out, indent_level + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
write_object_types(out, indent_level + 2);
|
||||||
|
write_decal_flags(out, indent_level + 2);
|
||||||
|
write_tags(out, indent_level + 2);
|
||||||
|
write_render_mode(out, indent_level + 2);
|
||||||
|
|
||||||
|
// We have to write the children nodes before we write the vertex
|
||||||
|
// references, since we might be referencing a vertex that's defined
|
||||||
|
// in one of those children nodes!
|
||||||
|
EggGroupNode::write(out, indent_level + 2);
|
||||||
|
write_vertex_ref(out, indent_level + 2);
|
||||||
|
|
||||||
|
indent(out, indent_level) << "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_billboard_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes just the <Billboard> entry and related fields to
|
||||||
|
// the indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_billboard_flags(ostream &out, int indent_level) const {
|
||||||
if (get_billboard_type() != BT_none) {
|
if (get_billboard_type() != BT_none) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<Billboard> { " << get_billboard_type() << " }\n";
|
<< "<Billboard> { " << get_billboard_type() << " }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_billboard_center()) {
|
if (has_billboard_center()) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<BillboardCenter> { " << get_billboard_center() << " }\n";
|
<< "<BillboardCenter> { " << get_billboard_center() << " }\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_collide_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes just the <Collide> entry and related fields to
|
||||||
|
// the indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_collide_flags(ostream &out, int indent_level) const {
|
||||||
if (get_cs_type() != CST_none) {
|
if (get_cs_type() != CST_none) {
|
||||||
indent(out, indent_level + 2) << "<Collide> ";
|
indent(out, indent_level) << "<Collide> ";
|
||||||
if (has_collision_name()) {
|
if (has_collision_name()) {
|
||||||
enquote_string(out, get_collision_name()) << " ";
|
enquote_string(out, get_collision_name()) << " ";
|
||||||
}
|
}
|
||||||
@ -218,95 +258,136 @@ write(ostream &out, int indent_level) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (has_collide_mask()) {
|
if (has_collide_mask()) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<Scalar> collide-mask { 0x";
|
<< "<Scalar> collide-mask { 0x";
|
||||||
get_collide_mask().output_hex(out, 0);
|
get_collide_mask().output_hex(out, 0);
|
||||||
out << " }\n";
|
out << " }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_from_collide_mask()) {
|
if (has_from_collide_mask()) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<Scalar> from-collide-mask { 0x";
|
<< "<Scalar> from-collide-mask { 0x";
|
||||||
get_from_collide_mask().output_hex(out, 0);
|
get_from_collide_mask().output_hex(out, 0);
|
||||||
out << " }\n";
|
out << " }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_into_collide_mask()) {
|
if (has_into_collide_mask()) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<Scalar> into-collide-mask { 0x";
|
<< "<Scalar> into-collide-mask { 0x";
|
||||||
get_into_collide_mask().output_hex(out, 0);
|
get_into_collide_mask().output_hex(out, 0);
|
||||||
out << " }\n";
|
out << " }\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_model_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes the <Model> flag and related flags to the
|
||||||
|
// indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_model_flags(ostream &out, int indent_level) const {
|
||||||
if (get_dcs_type() != DC_none) {
|
if (get_dcs_type() != DC_none) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<DCS> { " << get_dcs_type() << " }\n";
|
<< "<DCS> { " << get_dcs_type() << " }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_dart_type() != DT_none) {
|
if (get_dart_type() != DT_none) {
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level)
|
||||||
<< "<Dart> { " << get_dart_type() << " }\n";
|
<< "<Dart> { " << get_dart_type() << " }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_switch_flag()) {
|
|
||||||
indent(out, indent_level + 2) << "<Switch> { 1 }\n";
|
|
||||||
if (get_switch_fps() != 0.0) {
|
|
||||||
indent(out, indent_level + 2)
|
|
||||||
<< "<Scalar> fps { " << get_switch_fps() << " }\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_transform()) {
|
|
||||||
EggTransform3d::write(out, indent_level + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
vector_string::const_iterator oi;
|
|
||||||
for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
|
|
||||||
indent(out, indent_level + 2)
|
|
||||||
<< "<ObjectType> { ";
|
|
||||||
enquote_string(out, (*oi)) << " }\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_model_flag()) {
|
if (get_model_flag()) {
|
||||||
indent(out, indent_level + 2) << "<Model> { 1 }\n";
|
indent(out, indent_level) << "<Model> { 1 }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_texlist_flag()) {
|
if (get_texlist_flag()) {
|
||||||
indent(out, indent_level + 2) << "<TexList> { 1 }\n";
|
indent(out, indent_level) << "<TexList> { 1 }\n";
|
||||||
}
|
|
||||||
|
|
||||||
if (get_nofog_flag()) {
|
|
||||||
indent(out, indent_level + 2) << "<Scalar> no-fog { 1 }\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (get_decal_flag()) {
|
|
||||||
indent(out, indent_level + 2) << "<Scalar> decal { 1 }\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_direct_flag()) {
|
if (get_direct_flag()) {
|
||||||
indent(out, indent_level + 2) << "<Scalar> direct { 1 }\n";
|
indent(out, indent_level) << "<Scalar> direct { 1 }\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EggRenderMode::write(out, indent_level + 2);
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_switch_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes the <Switch> flag and related flags to the
|
||||||
|
// indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_switch_flags(ostream &out, int indent_level) const {
|
||||||
|
if (get_switch_flag()) {
|
||||||
|
indent(out, indent_level) << "<Switch> { 1 }\n";
|
||||||
|
if (get_switch_fps() != 0.0) {
|
||||||
|
indent(out, indent_level)
|
||||||
|
<< "<Scalar> fps { " << get_switch_fps() << " }\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_object_types
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes just the <ObjectTypes> entries, if any, to the
|
||||||
|
// indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_object_types(ostream &out, int indent_level) const {
|
||||||
|
vector_string::const_iterator oi;
|
||||||
|
for (oi = _object_types.begin(); oi != _object_types.end(); ++oi) {
|
||||||
|
indent(out, indent_level)
|
||||||
|
<< "<ObjectType> { ";
|
||||||
|
enquote_string(out, (*oi)) << " }\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_decal_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes the flags related to decalling, if any.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_decal_flags(ostream &out, int indent_level) const {
|
||||||
|
if (get_decal_flag()) {
|
||||||
|
indent(out, indent_level) << "<Scalar> decal { 1 }\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_tags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes just the <Tag> entries, if any, to the
|
||||||
|
// indicated ostream.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_tags(ostream &out, int indent_level) const {
|
||||||
TagData::const_iterator ti;
|
TagData::const_iterator ti;
|
||||||
for (ti = _tag_data.begin(); ti != _tag_data.end(); ++ti) {
|
for (ti = _tag_data.begin(); ti != _tag_data.end(); ++ti) {
|
||||||
const string &key = (*ti).first;
|
const string &key = (*ti).first;
|
||||||
const string &value = (*ti).second;
|
const string &value = (*ti).second;
|
||||||
|
|
||||||
indent(out, indent_level + 2) << "<Tag> ";
|
indent(out, indent_level) << "<Tag> ";
|
||||||
enquote_string(out, key) << " {\n";
|
enquote_string(out, key) << " {\n";
|
||||||
enquote_string(out, value, indent_level + 4) << "\n";
|
enquote_string(out, value, indent_level + 2) << "\n";
|
||||||
indent(out, indent_level + 2) << "}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have to write the children nodes before we write the vertex
|
|
||||||
// references, since we might be referencing a vertex that's defined
|
|
||||||
// in one of those children nodes!
|
|
||||||
EggGroupNode::write(out, indent_level + 2);
|
|
||||||
write_vertex_ref(out, indent_level + 2);
|
|
||||||
|
|
||||||
indent(out, indent_level) << "}\n";
|
indent(out, indent_level) << "}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggGroup::write_render_mode
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes the flags inherited from EggRenderMode and
|
||||||
|
// similar flags that control obscure render effects.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void EggGroup::
|
||||||
|
write_render_mode(ostream &out, int indent_level) const {
|
||||||
|
EggRenderMode::write(out, indent_level);
|
||||||
|
|
||||||
|
if (get_nofog_flag()) {
|
||||||
|
indent(out, indent_level) << "<Scalar> no-fog { 1 }\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -100,6 +100,14 @@ public:
|
|||||||
~EggGroup();
|
~EggGroup();
|
||||||
|
|
||||||
virtual void write(ostream &out, int indent_level) const;
|
virtual void write(ostream &out, int indent_level) const;
|
||||||
|
void write_billboard_flags(ostream &out, int indent_level) const;
|
||||||
|
void write_collide_flags(ostream &out, int indent_level) const;
|
||||||
|
void write_model_flags(ostream &out, int indent_level) const;
|
||||||
|
void write_switch_flags(ostream &out, int indent_level) const;
|
||||||
|
void write_object_types(ostream &out, int indent_level) const;
|
||||||
|
void write_decal_flags(ostream &out, int indent_level) const;
|
||||||
|
void write_tags(ostream &out, int indent_level) const;
|
||||||
|
void write_render_mode(ostream &out, int indent_level) const;
|
||||||
|
|
||||||
virtual bool is_joint() const;
|
virtual bool is_joint() const;
|
||||||
|
|
||||||
|
@ -232,6 +232,80 @@ get_node_to_vertex() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_vertex_frame_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_vertex_frame()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_vertex_frame_ptr() const {
|
||||||
|
return _vertex_frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_node_frame_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_node_frame()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_node_frame_ptr() const {
|
||||||
|
return _node_frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_vertex_frame_inv_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_vertex_frame_inv()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_vertex_frame_inv_ptr() const {
|
||||||
|
return _vertex_frame_inv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_node_frame_inv_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_node_frame_inv()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_node_frame_inv_ptr() const {
|
||||||
|
return _node_frame_inv;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_vertex_to_node_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_vertex_to_node()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_vertex_to_node_ptr() const {
|
||||||
|
return _vertex_to_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: EggNode::get_node_to_vertex_ptr
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns either a NULL pointer or a unique pointer
|
||||||
|
// shared by nodes with the same get_node_to_vertex()
|
||||||
|
// matrix.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const LMatrix4d *EggNode::
|
||||||
|
get_node_to_vertex_ptr() const {
|
||||||
|
return _node_to_vertex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: EggNode::transform
|
// Function: EggNode::transform
|
||||||
|
@ -58,6 +58,13 @@ public:
|
|||||||
INLINE const LMatrix4d &get_vertex_to_node() const;
|
INLINE const LMatrix4d &get_vertex_to_node() const;
|
||||||
INLINE const LMatrix4d &get_node_to_vertex() const;
|
INLINE const LMatrix4d &get_node_to_vertex() const;
|
||||||
|
|
||||||
|
INLINE const LMatrix4d *get_vertex_frame_ptr()const;
|
||||||
|
INLINE const LMatrix4d *get_node_frame_ptr()const;
|
||||||
|
INLINE const LMatrix4d *get_vertex_frame_inv_ptr()const;
|
||||||
|
INLINE const LMatrix4d *get_node_frame_inv_ptr()const;
|
||||||
|
INLINE const LMatrix4d *get_vertex_to_node_ptr()const;
|
||||||
|
INLINE const LMatrix4d *get_node_to_vertex_ptr()const;
|
||||||
|
|
||||||
INLINE void transform(const LMatrix4d &mat);
|
INLINE void transform(const LMatrix4d &mat);
|
||||||
INLINE void transform_vertices_only(const LMatrix4d &mat);
|
INLINE void transform_vertices_only(const LMatrix4d &mat);
|
||||||
INLINE void flatten_transforms();
|
INLINE void flatten_transforms();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user