use PT(EggData) instead of concrete EggData
This commit is contained in:
parent
aff265b771
commit
ff6b6dad89
|
|
@ -101,15 +101,15 @@ run() {
|
|||
bam_file.resolve();
|
||||
bam_file.close();
|
||||
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
_vpool = new EggVertexPool("vpool");
|
||||
_data.add_child(_vpool);
|
||||
_data->add_child(_vpool);
|
||||
|
||||
if (objects.size() == 1 &&
|
||||
objects[0]->is_of_type(PandaNode::get_class_type())) {
|
||||
PandaNode *node = DCAST(PandaNode, objects[0]);
|
||||
NodePath root(node);
|
||||
convert_node(WorkingNodePath(root), &_data, false);
|
||||
convert_node(WorkingNodePath(root), _data, false);
|
||||
|
||||
} else {
|
||||
nout << "File does not contain a scene graph.\n";
|
||||
|
|
@ -118,7 +118,7 @@ run() {
|
|||
|
||||
// Remove the vertex pool if it has no vertices.
|
||||
if (_vpool->empty()) {
|
||||
_data.remove_child(_vpool);
|
||||
_data->remove_child(_vpool);
|
||||
}
|
||||
|
||||
write_egg_file();
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ run() {
|
|||
if (!_got_coordinate_system) {
|
||||
// If the user didn't specify otherwise, ensure the coordinate
|
||||
// system is Z-up.
|
||||
_data.set_coordinate_system(CS_zup_right);
|
||||
_data->set_coordinate_system(CS_zup_right);
|
||||
}
|
||||
|
||||
PT(PandaNode) root = load_egg_data(_data);
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ get_merge_externals() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void SomethingToEggConverter::
|
||||
clear_egg_data() {
|
||||
set_egg_data((EggData *)NULL, false);
|
||||
set_egg_data((EggData *)NULL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -495,9 +495,9 @@ clear_egg_data() {
|
|||
// Access: Public
|
||||
// Description: Returns the EggData structure.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE EggData &SomethingToEggConverter::
|
||||
INLINE EggData *SomethingToEggConverter::
|
||||
get_egg_data() {
|
||||
return *_egg_data;
|
||||
return _egg_data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ SomethingToEggConverter() {
|
|||
_control_flags = 0;
|
||||
_merge_externals = false;
|
||||
_egg_data = (EggData *)NULL;
|
||||
_owns_egg_data = false;
|
||||
_error = false;
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +56,6 @@ SomethingToEggConverter(const SomethingToEggConverter ©) :
|
|||
_merge_externals(copy._merge_externals)
|
||||
{
|
||||
_egg_data = (EggData *)NULL;
|
||||
_owns_egg_data = false;
|
||||
_error = false;
|
||||
}
|
||||
|
||||
|
|
@ -76,18 +74,11 @@ SomethingToEggConverter::
|
|||
// Access: Public
|
||||
// Description: Sets the egg data that will be filled in when
|
||||
// convert_file() is called. This must be called before
|
||||
// convert_file(). If owns_egg_data is true, the
|
||||
// egg_data will be deleted when the converter
|
||||
// destructs. (We don't use the reference counting on
|
||||
// EggData, to allow static EggDatas to be passed in.)
|
||||
// convert_file().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void SomethingToEggConverter::
|
||||
set_egg_data(EggData *egg_data, bool owns_egg_data) {
|
||||
if (_owns_egg_data) {
|
||||
delete _egg_data;
|
||||
}
|
||||
set_egg_data(EggData *egg_data) {
|
||||
_egg_data = egg_data;
|
||||
_owns_egg_data = owns_egg_data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -137,9 +128,9 @@ handle_external_reference(EggGroupNode *egg_parent,
|
|||
const Filename &ref_filename) {
|
||||
if (_merge_externals) {
|
||||
SomethingToEggConverter *ext = make_copy();
|
||||
EggData egg_data;
|
||||
egg_data.set_coordinate_system(get_egg_data().get_coordinate_system());
|
||||
ext->set_egg_data(&egg_data, false);
|
||||
PT(EggData) egg_data = new EggData;
|
||||
egg_data->set_coordinate_system(get_egg_data()->get_coordinate_system());
|
||||
ext->set_egg_data(egg_data);
|
||||
|
||||
if (!ext->convert_file(ref_filename)) {
|
||||
delete ext;
|
||||
|
|
@ -148,7 +139,7 @@ handle_external_reference(EggGroupNode *egg_parent,
|
|||
return false;
|
||||
}
|
||||
|
||||
egg_parent->steal_children(egg_data);
|
||||
egg_parent->steal_children(*egg_data);
|
||||
delete ext;
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ public:
|
|||
INLINE void set_merge_externals(bool merge_externals);
|
||||
INLINE bool get_merge_externals() const;
|
||||
|
||||
void set_egg_data(EggData *egg_data, bool owns_egg_data);
|
||||
void set_egg_data(EggData *egg_data);
|
||||
INLINE void clear_egg_data();
|
||||
INLINE EggData &get_egg_data();
|
||||
INLINE EggData *get_egg_data();
|
||||
|
||||
virtual string get_name() const=0;
|
||||
virtual string get_extension() const=0;
|
||||
|
|
@ -143,8 +143,7 @@ protected:
|
|||
|
||||
bool _merge_externals;
|
||||
|
||||
EggData *_egg_data;
|
||||
bool _owns_egg_data;
|
||||
PT(EggData) _egg_data;
|
||||
|
||||
bool _error;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ convert_file(const Filename &filename) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
DXFLayer *DXFToEggConverter::
|
||||
new_layer(const string &name) {
|
||||
return new DXFToEggLayer(name, &get_egg_data());
|
||||
return new DXFToEggLayer(name, get_egg_data());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ void DXFToEgg::
|
|||
run() {
|
||||
nout << "Reading " << _input_filename << "\n";
|
||||
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
DXFToEggConverter converter;
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
converter._allow_errors = _allow_errors;
|
||||
|
||||
apply_parameters(converter);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ EggToDXF() :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void EggToDXF::
|
||||
run() {
|
||||
get_layers(&_data);
|
||||
get_layers(_data);
|
||||
if (_layers.empty()) {
|
||||
nout << "Egg file contains no polygons. Output file not written.\n";
|
||||
exit(1);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ run() {
|
|||
read_qtess = true;
|
||||
}
|
||||
|
||||
find_surfaces(&_data);
|
||||
find_surfaces(_data);
|
||||
|
||||
QtessInputEntry &default_entry = _qtess_file.get_default_entry();
|
||||
if (!read_qtess || default_entry.get_num_surfaces() == 0) {
|
||||
|
|
@ -215,7 +215,7 @@ run() {
|
|||
// vertices.
|
||||
_surfaces.clear();
|
||||
|
||||
_data.remove_unused_vertices();
|
||||
_data->remove_unused_vertices();
|
||||
write_egg_file();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ convert_paths(EggNode *node, PathReplace *path_replace,
|
|||
// call it explicitly.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggBase::
|
||||
append_command_comment(EggData &data) {
|
||||
append_command_comment(EggData *data) {
|
||||
append_command_comment(data, get_exec_command());
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +194,8 @@ append_command_comment(EggData &data) {
|
|||
// call it explicitly.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggBase::
|
||||
append_command_comment(EggData &data, const string &comment) {
|
||||
data.insert(data.begin(), new EggComment("", comment));
|
||||
append_command_comment(EggData *data, const string &comment) {
|
||||
data->insert(data->begin(), new EggComment("", comment));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ public:
|
|||
const DSearchPath &additional_path);
|
||||
|
||||
protected:
|
||||
void append_command_comment(EggData &_data);
|
||||
static void append_command_comment(EggData &_data, const string &comment);
|
||||
void append_command_comment(EggData *_data);
|
||||
static void append_command_comment(EggData *_data, const string &comment);
|
||||
|
||||
static bool dispatch_normals(ProgramBase *self, const string &opt, const string &arg, void *mode);
|
||||
bool ns_dispatch_normals(const string &opt, const string &arg, void *mode);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ post_command_line() {
|
|||
if (_got_coordinate_system) {
|
||||
data->set_coordinate_system(_coordinate_system);
|
||||
}
|
||||
append_command_comment(*data);
|
||||
append_command_comment(data);
|
||||
}
|
||||
|
||||
return EggMultiBase::post_command_line();
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ handle_args(ProgramBase::Args &args) {
|
|||
// get implicitly loaded up into one big egg file.
|
||||
|
||||
if (!args.empty()) {
|
||||
_data.set_egg_filename(Filename::from_os_specific(args[0]));
|
||||
_data->set_egg_filename(Filename::from_os_specific(args[0]));
|
||||
}
|
||||
Args::const_iterator ai;
|
||||
for (ai = args.begin(); ai != args.end(); ++ai) {
|
||||
|
|
@ -207,7 +207,7 @@ handle_args(ProgramBase::Args &args) {
|
|||
// specified _path_replace.
|
||||
convert_paths(&file_data, _path_replace, file_path);
|
||||
|
||||
_data.merge(file_data);
|
||||
_data->merge(file_data);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -247,7 +247,7 @@ do_reader_options() {
|
|||
}
|
||||
|
||||
if (_delod >= 0.0) {
|
||||
do_delod(&_data);
|
||||
do_delod(_data);
|
||||
}
|
||||
|
||||
return okflag;
|
||||
|
|
@ -265,7 +265,7 @@ bool EggReader::
|
|||
copy_textures() {
|
||||
bool success = true;
|
||||
EggTextureCollection textures;
|
||||
textures.find_used_textures(&_data);
|
||||
textures.find_used_textures(_data);
|
||||
|
||||
EggTextureCollection::const_iterator ti;
|
||||
for (ti = textures.begin(); ti != textures.end(); ++ti) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggSingleBase::
|
||||
EggSingleBase() {
|
||||
EggSingleBase() :
|
||||
_data(new EggData)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -76,7 +78,7 @@ as_writer() {
|
|||
bool EggSingleBase::
|
||||
post_command_line() {
|
||||
if (_got_coordinate_system) {
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
}
|
||||
|
||||
return EggBase::post_command_line();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "eggBase.h"
|
||||
#include "coordinateSystem.h"
|
||||
#include "eggData.h"
|
||||
#include "pointerTo.h"
|
||||
|
||||
class EggReader;
|
||||
class EggWriter;
|
||||
|
|
@ -51,7 +52,7 @@ protected:
|
|||
virtual bool post_command_line();
|
||||
|
||||
protected:
|
||||
EggData _data;
|
||||
PT(EggData) _data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -131,30 +131,30 @@ post_process_egg_file() {
|
|||
_transform.write(nout, 2);
|
||||
LVecBase3d scale, hpr, translate;
|
||||
if (decompose_matrix(_transform, scale, hpr, translate,
|
||||
_data.get_coordinate_system())) {
|
||||
_data->get_coordinate_system())) {
|
||||
nout << "(scale " << scale << ", hpr " << hpr << ", translate "
|
||||
<< translate << ")\n";
|
||||
}
|
||||
_data.transform(_transform);
|
||||
_data->transform(_transform);
|
||||
}
|
||||
|
||||
switch (_normals_mode) {
|
||||
case NM_strip:
|
||||
nout << "Stripping normals.\n";
|
||||
_data.strip_normals();
|
||||
_data.remove_unused_vertices();
|
||||
_data->strip_normals();
|
||||
_data->remove_unused_vertices();
|
||||
break;
|
||||
|
||||
case NM_polygon:
|
||||
nout << "Recomputing polygon normals.\n";
|
||||
_data.recompute_polygon_normals();
|
||||
_data.remove_unused_vertices();
|
||||
_data->recompute_polygon_normals();
|
||||
_data->remove_unused_vertices();
|
||||
break;
|
||||
|
||||
case NM_vertex:
|
||||
nout << "Recomputing vertex normals.\n";
|
||||
_data.recompute_vertex_normals(_normals_threshold);
|
||||
_data.remove_unused_vertices();
|
||||
_data->recompute_vertex_normals(_normals_threshold);
|
||||
_data->remove_unused_vertices();
|
||||
break;
|
||||
|
||||
case NM_preserve:
|
||||
|
|
@ -175,7 +175,7 @@ post_process_egg_file() {
|
|||
void EggWriter::
|
||||
write_egg_file() {
|
||||
post_process_egg_file();
|
||||
_data.write_egg(get_output());
|
||||
_data->write_egg(get_output());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -196,13 +196,13 @@ add_merge_externals_options() {
|
|||
// done automatically when the file is written out.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void SomethingToEgg::
|
||||
apply_units_scale(EggData &data) {
|
||||
apply_units_scale(EggData *data) {
|
||||
if (_output_units != DU_invalid && _input_units != DU_invalid &&
|
||||
_input_units != _output_units) {
|
||||
nout << "Converting from " << format_long_unit(_input_units)
|
||||
<< " to " << format_long_unit(_output_units) << "\n";
|
||||
double scale = convert_units(_input_units, _output_units);
|
||||
data.transform(LMatrix4d::scale_mat(scale));
|
||||
data->transform(LMatrix4d::scale_mat(scale));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
void add_merge_externals_options();
|
||||
|
||||
protected:
|
||||
void apply_units_scale(EggData &data);
|
||||
void apply_units_scale(EggData *data);
|
||||
void apply_parameters(SomethingToEggConverter &converter);
|
||||
|
||||
virtual bool handle_args(Args &args);
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ post_command_line() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void EggCrop::
|
||||
run() {
|
||||
int num_removed = strip_prims(&_data);
|
||||
int num_removed = strip_prims(_data);
|
||||
nout << "Removed " << num_removed << " primitives.\n";
|
||||
|
||||
_data.remove_unused_vertices();
|
||||
_data->remove_unused_vertices();
|
||||
write_egg_file();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ run() {
|
|||
|
||||
// First, create an enclosing group and a vertex pool.
|
||||
_group = new EggGroup("tube");
|
||||
_data.add_child(_group);
|
||||
_data->add_child(_group);
|
||||
|
||||
_vpool = new EggVertexPool("tube");
|
||||
_group->add_child(_vpool);
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ run() {
|
|||
// vertices. We can use the same four vertices on all polygons.
|
||||
|
||||
EggGroup *group = new EggGroup();
|
||||
_data.add_child(group);
|
||||
_data->add_child(group);
|
||||
|
||||
// If we have more than one tile, make the group a sequence, as a
|
||||
// convenience. If we view the egg file directly we can see all the
|
||||
|
|
|
|||
|
|
@ -95,23 +95,23 @@ EggToC() :
|
|||
void EggToC::
|
||||
run() {
|
||||
nout << "Removing invalid primitives.\n";
|
||||
int num_removed = _data.remove_invalid_primitives();
|
||||
int num_removed = _data->remove_invalid_primitives();
|
||||
nout << " (" << num_removed << " removed.)\n";
|
||||
|
||||
if (_triangulate_polygons) {
|
||||
nout << "Triangulating polygons.\n";
|
||||
int num_produced = _data.triangulate_polygons(true);
|
||||
int num_produced = _data->triangulate_polygons(~0);
|
||||
nout << " (" << num_produced << " triangles produced.)\n";
|
||||
}
|
||||
|
||||
_data.apply_texmats();
|
||||
_data.flatten_transforms();
|
||||
_data.remove_unused_vertices();
|
||||
_data->apply_texmats();
|
||||
_data->flatten_transforms();
|
||||
_data->remove_unused_vertices();
|
||||
|
||||
// Collect all the polygons together into polysets.
|
||||
EggPolysetMaker pmaker;
|
||||
pmaker.set_properties(0);
|
||||
pmaker.make_bins(&_data);
|
||||
pmaker.make_bins(_data);
|
||||
|
||||
get_output()
|
||||
<< "/*\n"
|
||||
|
|
@ -122,7 +122,7 @@ run() {
|
|||
|
||||
_next_vpool_index = 0;
|
||||
_next_bin_index = 0;
|
||||
traverse(&_data);
|
||||
traverse(_data);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -89,44 +89,44 @@ void EggTrans::
|
|||
run() {
|
||||
if (_remove_invalid_primitives) {
|
||||
nout << "Removing invalid primitives.\n";
|
||||
int num_removed = _data.remove_invalid_primitives();
|
||||
int num_removed = _data->remove_invalid_primitives();
|
||||
nout << " (" << num_removed << " removed.)\n";
|
||||
_data.remove_unused_vertices();
|
||||
_data->remove_unused_vertices();
|
||||
}
|
||||
|
||||
if (_triangulate_polygons) {
|
||||
nout << "Triangulating polygons.\n";
|
||||
int num_produced = _data.triangulate_polygons(~0);
|
||||
int num_produced = _data->triangulate_polygons(~0);
|
||||
nout << " (" << num_produced << " triangles produced.)\n";
|
||||
}
|
||||
|
||||
if (_mesh_triangles) {
|
||||
nout << "Meshing triangles.\n";
|
||||
_data.mesh_triangles(~0);
|
||||
_data->mesh_triangles(~0);
|
||||
}
|
||||
|
||||
if (_apply_texmats) {
|
||||
nout << "Applying texture matrices.\n";
|
||||
_data.apply_texmats();
|
||||
_data.remove_unused_vertices();
|
||||
_data->apply_texmats();
|
||||
_data->remove_unused_vertices();
|
||||
}
|
||||
|
||||
if (_collapse_equivalent_textures) {
|
||||
nout << "Collapsing equivalent textures.\n";
|
||||
int num_removed = _data.collapse_equivalent_textures();
|
||||
int num_removed = _data->collapse_equivalent_textures();
|
||||
nout << " (" << num_removed << " removed.)\n";
|
||||
}
|
||||
|
||||
if (_flatten_transforms) {
|
||||
nout << "Flattening transforms.\n";
|
||||
_data.flatten_transforms();
|
||||
_data.remove_unused_vertices();
|
||||
_data->flatten_transforms();
|
||||
_data->remove_unused_vertices();
|
||||
}
|
||||
|
||||
if (_standardize_names) {
|
||||
nout << "Standardizing group names.\n";
|
||||
EggGroupUniquifier uniquifier;
|
||||
uniquifier.uniquify(&_data);
|
||||
uniquifier.uniquify(_data);
|
||||
}
|
||||
|
||||
if (!do_reader_options()) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ run() {
|
|||
_flt_header = new FltHeader(_path_replace);
|
||||
_flt_header->set_auto_attr_update(_auto_attr_update);
|
||||
|
||||
traverse(&_data, _flt_header, FltGeometry::BT_none);
|
||||
traverse(_data, _flt_header, FltGeometry::BT_none);
|
||||
|
||||
// Finally, write the resulting file out.
|
||||
FltError result = _flt_header->write_flt(get_output());
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ FltToEgg() :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void FltToEgg::
|
||||
run() {
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
FltToEggConverter converter;
|
||||
converter.set_merge_externals(_merge_externals);
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
converter._compose_transforms = _compose_transforms;
|
||||
converter._allow_errors = _allow_errors;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,6 @@ connect_egg() {
|
|||
<< "; cannot parent layer " << _layer->_number << " properly.\n";
|
||||
}
|
||||
|
||||
_converter->get_egg_data().add_child(_egg_group.p());
|
||||
_converter->get_egg_data()->add_child(_egg_group.p());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ make_faces() {
|
|||
}
|
||||
}
|
||||
|
||||
CoordinateSystem cs = _converter->get_egg_data().get_coordinate_system();
|
||||
CoordinateSystem cs = _converter->get_egg_data()->get_coordinate_system();
|
||||
if (smooth_angle > 0.0) {
|
||||
_egg_group->recompute_vertex_normals(rad_2_deg(smooth_angle), cs);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -66,14 +66,14 @@ LwoToEgg() :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void LwoToEgg::
|
||||
run() {
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
if (_input_units == DU_invalid) {
|
||||
_input_units = DU_meters;
|
||||
}
|
||||
|
||||
LwoToEggConverter converter;
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
apply_parameters(converter);
|
||||
|
||||
if (!converter.convert_file(_input_filename)) {
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ convert_maya() {
|
|||
|
||||
case AC_none:
|
||||
// none: just get out a static model, no animation.
|
||||
all_ok = convert_hierarchy(&get_egg_data());
|
||||
all_ok = convert_hierarchy(get_egg_data());
|
||||
break;
|
||||
|
||||
case AC_flip:
|
||||
|
|
@ -485,7 +485,7 @@ convert_maya() {
|
|||
break;
|
||||
};
|
||||
|
||||
reparent_decals(&get_egg_data());
|
||||
reparent_decals(get_egg_data());
|
||||
}
|
||||
|
||||
if (had_error()) {
|
||||
|
|
@ -564,7 +564,7 @@ convert_flip(double start_frame, double end_frame, double frame_inc,
|
|||
bool all_ok = true;
|
||||
|
||||
EggGroup *sequence_node = new EggGroup(_character_name);
|
||||
get_egg_data().add_child(sequence_node);
|
||||
get_egg_data()->add_child(sequence_node);
|
||||
if (_animation_convert == AC_flip) {
|
||||
sequence_node->set_switch_flag(true);
|
||||
sequence_node->set_switch_fps(output_frame_rate);
|
||||
|
|
@ -612,7 +612,7 @@ convert_char_model() {
|
|||
_tree.reset_sliders();
|
||||
|
||||
EggGroup *char_node = new EggGroup(_character_name);
|
||||
get_egg_data().add_child(char_node);
|
||||
get_egg_data()->add_child(char_node);
|
||||
char_node->set_dart_type(EggGroup::DT_default);
|
||||
|
||||
return convert_hierarchy(char_node);
|
||||
|
|
@ -631,7 +631,7 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc,
|
|||
// MStatus status;
|
||||
|
||||
EggTable *root_table_node = new EggTable();
|
||||
get_egg_data().add_child(root_table_node);
|
||||
get_egg_data()->add_child(root_table_node);
|
||||
EggTable *bundle_node = new EggTable(_character_name);
|
||||
bundle_node->set_table_type(EggTable::TT_bundle);
|
||||
root_table_node->add_child(bundle_node);
|
||||
|
|
@ -643,7 +643,7 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc,
|
|||
// Set the frame rate before we start asking for anim tables to be
|
||||
// created.
|
||||
_tree._fps = output_frame_rate;
|
||||
_tree.clear_egg(&get_egg_data(), NULL, skeleton_node, morph_node);
|
||||
_tree.clear_egg(get_egg_data(), NULL, skeleton_node, morph_node);
|
||||
|
||||
// Now we can get the animation data by walking through all of the
|
||||
// frames, one at a time, and getting the joint angles at each
|
||||
|
|
@ -732,7 +732,7 @@ bool MayaToEggConverter::
|
|||
convert_hierarchy(EggGroupNode *egg_root) {
|
||||
int num_nodes = _tree.get_num_nodes();
|
||||
|
||||
_tree.clear_egg(&get_egg_data(), egg_root, NULL, NULL);
|
||||
_tree.clear_egg(get_egg_data(), egg_root, NULL, NULL);
|
||||
for (int i = 0; i < num_nodes; i++) {
|
||||
MayaNodeDesc *node = _tree.get_node(i);
|
||||
if (!process_model_node(node)) {
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ convert(const NodePath &parent) {
|
|||
// Also search along the model path.
|
||||
path_replace->_path.append_path(get_model_path());
|
||||
|
||||
EggData egg_data;
|
||||
converter.set_egg_data(&egg_data, false);
|
||||
PT(EggData) egg_data = new EggData;
|
||||
converter.set_egg_data(egg_data);
|
||||
converter.set_from_selection(true);
|
||||
|
||||
if (!converter.convert_maya()) {
|
||||
|
|
@ -157,7 +157,7 @@ convert(const NodePath &parent) {
|
|||
|
||||
// Now the converter has filled up our egg structure with data, so
|
||||
// convert this egg data to Panda data for immediate viewing.
|
||||
egg_data.set_coordinate_system(CS_default);
|
||||
egg_data->set_coordinate_system(CS_default);
|
||||
PT(PandaNode) result = load_egg_data(egg_data);
|
||||
|
||||
if (result == (PandaNode *)NULL) {
|
||||
|
|
|
|||
|
|
@ -195,9 +195,9 @@ run() {
|
|||
if (!_got_coordinate_system) {
|
||||
_coordinate_system = converter._maya->get_coordinate_system();
|
||||
}
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
|
||||
if (!converter.convert_file(_input_filename)) {
|
||||
nout << "Errors in conversion.\n";
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ PT(PandaNode) LoaderFileTypePandatool::
|
|||
load_file(const Filename &path, bool) const {
|
||||
PT(PandaNode) result;
|
||||
|
||||
EggData egg_data;
|
||||
_converter->set_egg_data(&egg_data, false);
|
||||
PT(EggData) egg_data = new EggData;
|
||||
_converter->set_egg_data(egg_data);
|
||||
|
||||
DSearchPath file_path;
|
||||
file_path.append_directory(path.get_dirname());
|
||||
|
|
@ -116,11 +116,11 @@ load_file(const Filename &path, bool) const {
|
|||
<< "Converting from " << format_long_unit(input_units)
|
||||
<< " to " << format_long_unit(ptloader_units) << "\n";
|
||||
double scale = convert_units(input_units, ptloader_units);
|
||||
egg_data.transform(LMatrix4d::scale_mat(scale));
|
||||
egg_data->transform(LMatrix4d::scale_mat(scale));
|
||||
}
|
||||
|
||||
if (!egg_data.has_normals()) {
|
||||
egg_data.recompute_polygon_normals();
|
||||
if (!egg_data->has_normals()) {
|
||||
egg_data->recompute_polygon_normals();
|
||||
}
|
||||
|
||||
result = load_egg_data(egg_data);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ convert_file(const Filename &filename) {
|
|||
// build the egg structure.
|
||||
VrmlScene::const_iterator csi;
|
||||
for (csi = scene->begin(); csi != scene->end(); ++csi) {
|
||||
vrml_node((*csi)._node, &get_egg_data(), LMatrix4d::ident_mat());
|
||||
vrml_node((*csi)._node, get_egg_data(), LMatrix4d::ident_mat());
|
||||
}
|
||||
|
||||
return !had_error();
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ void VRMLToEgg::
|
|||
run() {
|
||||
nout << "Reading " << _input_filename << "\n";
|
||||
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
VRMLToEggConverter converter;
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
converter._allow_errors = _allow_errors;
|
||||
|
||||
apply_parameters(converter);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ create_hierarchy(XFileToEggConverter *converter) {
|
|||
// Egg animation tables start off with one Table entry, enclosing a
|
||||
// Bundle entry.
|
||||
EggTable *table = new EggTable(get_name());
|
||||
converter->get_egg_data().add_child(table);
|
||||
converter->get_egg_data()->add_child(table);
|
||||
EggTable *bundle = new EggTable(converter->_char_name);
|
||||
table->add_child(bundle);
|
||||
bundle->set_table_type(EggTable::TT_bundle);
|
||||
|
|
@ -150,7 +150,7 @@ mirror_table(XFileToEggConverter *converter,
|
|||
EggTable *new_table = new EggTable(group->get_name());
|
||||
anim_node->add_child(new_table);
|
||||
CoordinateSystem cs =
|
||||
converter->get_egg_data().get_coordinate_system();
|
||||
converter->get_egg_data()->get_coordinate_system();
|
||||
EggXfmSAnim *xform = new EggXfmSAnim("xform", cs);
|
||||
new_table->add_child(xform);
|
||||
xform->set_fps(converter->_frame_rate);
|
||||
|
|
|
|||
|
|
@ -75,15 +75,15 @@ write(const Filename &filename) {
|
|||
// failure.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool XFileMaker::
|
||||
add_tree(EggData &egg_data) {
|
||||
add_tree(EggData *egg_data) {
|
||||
_meshes.clear();
|
||||
|
||||
// Now collect all the polygons together into polysets.
|
||||
EggPolysetMaker pmaker;
|
||||
pmaker.make_bins(&egg_data);
|
||||
pmaker.make_bins(egg_data);
|
||||
|
||||
// And now we're ready to traverse the egg hierarchy.
|
||||
if (!recurse_nodes(&egg_data, _x_file)) {
|
||||
if (!recurse_nodes(egg_data, _x_file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
bool write(const Filename &filename);
|
||||
|
||||
bool add_tree(EggData &egg_data);
|
||||
bool add_tree(EggData *egg_data);
|
||||
|
||||
private:
|
||||
bool add_node(EggNode *egg_node, XFileNode *x_parent);
|
||||
|
|
|
|||
|
|
@ -87,10 +87,10 @@ XFileToEgg() :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void XFileToEgg::
|
||||
run() {
|
||||
_data.set_coordinate_system(_coordinate_system);
|
||||
_data->set_coordinate_system(_coordinate_system);
|
||||
|
||||
XFileToEggConverter converter;
|
||||
converter.set_egg_data(&_data, false);
|
||||
converter.set_egg_data(_data);
|
||||
|
||||
converter._frame_rate = _frame_rate;
|
||||
converter._make_char = _make_char;
|
||||
|
|
|
|||
Loading…
Reference in New Issue