*** empty log message ***
This commit is contained in:
parent
4cccd97752
commit
4d5aa17daf
|
|
@ -256,7 +256,8 @@ run() {
|
|||
}
|
||||
|
||||
if (!_txa_filename.exists()) {
|
||||
nout << _txa_filename << " does not exist; cannot run.\n";
|
||||
nout << FilenameUnifier::make_user_filename(_txa_filename)
|
||||
<< " does not exist; cannot run.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +269,8 @@ run() {
|
|||
BamFile state_file;
|
||||
|
||||
if (!state_filename.exists()) {
|
||||
nout << state_filename << " does not exist; starting palettization from scratch.\n";
|
||||
nout << FilenameUnifier::make_user_filename(state_filename)
|
||||
<< " does not exist; starting palettization from scratch.\n";
|
||||
pal = new Palettizer;
|
||||
|
||||
} else {
|
||||
|
|
@ -282,12 +284,14 @@ run() {
|
|||
|
||||
TypedWriteable *obj = state_file.read_object();
|
||||
if (obj == (TypedWriteable *)NULL || !state_file.resolve()) {
|
||||
nout << state_filename << " exists, but appears to be corrupt. Perhaps you should remove it so a new one can be created.\n";
|
||||
nout << FilenameUnifier::make_user_filename(state_filename)
|
||||
<< " exists, but appears to be corrupt. Perhaps you should remove it so a new one can be created.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!obj->is_of_type(Palettizer::get_class_type())) {
|
||||
nout << state_filename << " exists, but does not appear to be "
|
||||
nout << FilenameUnifier::make_user_filename(state_filename)
|
||||
<< " exists, but does not appear to be "
|
||||
<< "an egg-palettize output file. Perhaps you "
|
||||
<< "should remove it so a new one can be created.\n";
|
||||
exit(1);
|
||||
|
|
|
|||
|
|
@ -38,12 +38,15 @@ Palettizer() {
|
|||
_pi_version = 0;
|
||||
|
||||
_map_dirname = "%g";
|
||||
_shadow_dirname = "shadow";
|
||||
_margin = 2;
|
||||
_coverage_threshold = 2.5;
|
||||
_aggressively_clean_mapdir = true;
|
||||
_force_power_2 = true;
|
||||
_color_type = PNMFileTypeRegistry::get_ptr()->get_type_from_extension("rgb");
|
||||
_alpha_type = (PNMFileType *)NULL;
|
||||
_shadow_color_type = (PNMFileType *)NULL;
|
||||
_shadow_alpha_type = (PNMFileType *)NULL;
|
||||
_pal_x_size = _pal_y_size = 512;
|
||||
|
||||
_round_uvs = true;
|
||||
|
|
@ -64,6 +67,8 @@ report_pi() const {
|
|||
cout
|
||||
<< "\nparams\n"
|
||||
<< " map directory: " << _map_dirname << "\n"
|
||||
<< " shadow directory: "
|
||||
<< FilenameUnifier::make_user_filename(_shadow_dirname) << "\n"
|
||||
<< " egg relative directory: "
|
||||
<< FilenameUnifier::make_user_filename(_rel_dirname) << "\n"
|
||||
<< " palettize size: " << _pal_x_size << " by " << _pal_y_size << "\n"
|
||||
|
|
@ -101,6 +106,15 @@ report_pi() const {
|
|||
cout << "\n";
|
||||
}
|
||||
|
||||
if (_shadow_color_type != (PNMFileType *)NULL) {
|
||||
cout << " generate shadow palette files of type: "
|
||||
<< _shadow_color_type->get_suggested_extension();
|
||||
if (_shadow_alpha_type != (PNMFileType *)NULL) {
|
||||
cout << "," << _shadow_alpha_type->get_suggested_extension();
|
||||
}
|
||||
cout << "\n";
|
||||
}
|
||||
|
||||
cout << "\ntexture source pathnames and sizes\n";
|
||||
Textures::const_iterator ti;
|
||||
for (ti = _textures.begin(); ti != _textures.end(); ++ti) {
|
||||
|
|
@ -604,6 +618,7 @@ void Palettizer::
|
|||
write_datagram(BamWriter *writer, Datagram &datagram) {
|
||||
datagram.add_int32(_pi_version);
|
||||
datagram.add_string(_map_dirname);
|
||||
datagram.add_string(FilenameUnifier::make_bam_filename(_shadow_dirname));
|
||||
datagram.add_string(FilenameUnifier::make_bam_filename(_rel_dirname));
|
||||
datagram.add_int32(_pal_x_size);
|
||||
datagram.add_int32(_pal_y_size);
|
||||
|
|
@ -617,6 +632,8 @@ write_datagram(BamWriter *writer, Datagram &datagram) {
|
|||
datagram.add_int32((int)_remap_uv);
|
||||
writer->write_pointer(datagram, _color_type);
|
||||
writer->write_pointer(datagram, _alpha_type);
|
||||
writer->write_pointer(datagram, _shadow_color_type);
|
||||
writer->write_pointer(datagram, _shadow_alpha_type);
|
||||
|
||||
datagram.add_int32(_egg_files.size());
|
||||
EggFiles::const_iterator ei;
|
||||
|
|
@ -651,7 +668,7 @@ write_datagram(BamWriter *writer, Datagram &datagram) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
int Palettizer::
|
||||
complete_pointers(vector_typedWriteable &plist, BamReader *manager) {
|
||||
nassertr((int)plist.size() >= 2 + _num_egg_files + _num_groups + _num_textures, 0);
|
||||
nassertr((int)plist.size() >= 4 + _num_egg_files + _num_groups + _num_textures, 0);
|
||||
int index = 0;
|
||||
|
||||
if (plist[index] != (TypedWriteable *)NULL) {
|
||||
|
|
@ -664,6 +681,16 @@ complete_pointers(vector_typedWriteable &plist, BamReader *manager) {
|
|||
}
|
||||
index++;
|
||||
|
||||
if (plist[index] != (TypedWriteable *)NULL) {
|
||||
DCAST_INTO_R(_shadow_color_type, plist[index], index);
|
||||
}
|
||||
index++;
|
||||
|
||||
if (plist[index] != (TypedWriteable *)NULL) {
|
||||
DCAST_INTO_R(_shadow_alpha_type, plist[index], index);
|
||||
}
|
||||
index++;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < _num_egg_files; i++) {
|
||||
EggFile *egg_file;
|
||||
|
|
@ -721,6 +748,7 @@ void Palettizer::
|
|||
fillin(DatagramIterator &scan, BamReader *manager) {
|
||||
_pi_version = scan.get_int32();
|
||||
_map_dirname = scan.get_string();
|
||||
_shadow_dirname = FilenameUnifier::get_bam_filename(scan.get_string());
|
||||
_rel_dirname = FilenameUnifier::get_bam_filename(scan.get_string());
|
||||
FilenameUnifier::set_rel_dirname(_rel_dirname);
|
||||
_pal_x_size = scan.get_int32();
|
||||
|
|
@ -735,6 +763,8 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|||
_remap_uv = (RemapUV)scan.get_int32();
|
||||
manager->read_pointer(scan, this); // _color_type
|
||||
manager->read_pointer(scan, this); // _alpha_type
|
||||
manager->read_pointer(scan, this); // _shadow_color_type
|
||||
manager->read_pointer(scan, this); // _shadow_alpha_type
|
||||
|
||||
_num_egg_files = scan.get_int32();
|
||||
manager->read_pointers(scan, this, _num_egg_files);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
// and palettes. These values are stored in the bam file for future
|
||||
// reference.
|
||||
string _map_dirname;
|
||||
Filename _shadow_dirname;
|
||||
Filename _rel_dirname;
|
||||
int _pal_x_size, _pal_y_size;
|
||||
int _margin;
|
||||
|
|
@ -83,6 +84,8 @@ public:
|
|||
RemapUV _remap_uv;
|
||||
PNMFileType *_color_type;
|
||||
PNMFileType *_alpha_type;
|
||||
PNMFileType *_shadow_color_type;
|
||||
PNMFileType *_shadow_alpha_type;
|
||||
|
||||
private:
|
||||
typedef map<string, EggFile *> EggFiles;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ read(Filename filename) {
|
|||
} else if (words[0] == ":imagetype") {
|
||||
okflag = parse_imagetype_line(words);
|
||||
|
||||
} else if (words[0] == ":shadowtype") {
|
||||
okflag = parse_shadowtype_line(words);
|
||||
|
||||
} else if (words[0] == ":round") {
|
||||
okflag = parse_round_line(words);
|
||||
|
||||
|
|
@ -331,6 +334,32 @@ parse_imagetype_line(const vector_string &words) {
|
|||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TxaFile::parse_shadowtype_line
|
||||
// Access: Private
|
||||
// Description: Handles the line in a .txa file that begins with the
|
||||
// keyword ":shadowtype" and indicates the image file
|
||||
// type to convert working copies of the palette images
|
||||
// to.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool TxaFile::
|
||||
parse_shadowtype_line(const vector_string &words) {
|
||||
if (words.size() != 2) {
|
||||
nout << "Exactly one parameter required for :shadowtype.\n";
|
||||
return false;
|
||||
}
|
||||
const string &shadowtype = words[1];
|
||||
if (!parse_image_type_request(shadowtype, pal->_shadow_color_type,
|
||||
pal->_shadow_alpha_type)) {
|
||||
nout << "\nKnown image types are:\n";
|
||||
PNMFileTypeRegistry::get_ptr()->write_types(nout, 2);
|
||||
nout << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: TxaFile::parse_round_line
|
||||
// Access: Private
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ private:
|
|||
bool parse_margin_line(const vector_string &words);
|
||||
bool parse_coverage_line(const vector_string &words);
|
||||
bool parse_imagetype_line(const vector_string &words);
|
||||
bool parse_shadowtype_line(const vector_string &words);
|
||||
bool parse_round_line(const vector_string &words);
|
||||
bool parse_remap_line(const vector_string &words);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue