mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
*** empty log message ***
This commit is contained in:
parent
7c3ddd7643
commit
8cf6081f66
@ -15,12 +15,13 @@
|
|||||||
eggFile.cxx eggFile.h eggPalettize.cxx eggPalettize.h \
|
eggFile.cxx eggFile.h eggPalettize.cxx eggPalettize.h \
|
||||||
filenameUnifier.cxx filenameUnifier.h \
|
filenameUnifier.cxx filenameUnifier.h \
|
||||||
imageFile.cxx imageFile.h omitReason.cxx omitReason.h \
|
imageFile.cxx imageFile.h omitReason.cxx omitReason.h \
|
||||||
|
pal_string_utils.cxx pal_string_utils.h \
|
||||||
paletteGroup.h paletteGroup.cxx \
|
paletteGroup.h paletteGroup.cxx \
|
||||||
paletteGroups.h paletteGroups.cxx paletteImage.h paletteImage.cxx \
|
paletteGroups.h paletteGroups.cxx paletteImage.h paletteImage.cxx \
|
||||||
palettePage.cxx palettePage.h \
|
palettePage.cxx palettePage.h \
|
||||||
palettizer.cxx palettizer.h \
|
palettizer.cxx palettizer.h \
|
||||||
sourceTextureImage.cxx sourceTextureImage.h string_utils.cxx \
|
sourceTextureImage.cxx sourceTextureImage.h \
|
||||||
string_utils.h textureImage.cxx textureImage.h \
|
textureImage.cxx textureImage.h \
|
||||||
texturePlacement.cxx texturePlacement.h \
|
texturePlacement.cxx texturePlacement.h \
|
||||||
texturePosition.cxx texturePosition.h \
|
texturePosition.cxx texturePosition.h \
|
||||||
textureProperties.cxx textureProperties.h textureReference.cxx \
|
textureProperties.cxx textureProperties.h textureReference.cxx \
|
||||||
|
@ -92,7 +92,15 @@ scan_textures() {
|
|||||||
TextureReference *ref = new TextureReference;
|
TextureReference *ref = new TextureReference;
|
||||||
ref->from_egg(this, _data, egg_tex);
|
ref->from_egg(this, _data, egg_tex);
|
||||||
|
|
||||||
_textures.push_back(ref);
|
if (!ref->has_uvs()) {
|
||||||
|
// This texture isn't *really* referenced. (Usually this
|
||||||
|
// happens if the texture is only referenced by "backstage"
|
||||||
|
// geometry, which we don't care about.)
|
||||||
|
delete ref;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_textures.push_back(ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "eggPalettize.h"
|
#include "eggPalettize.h"
|
||||||
#include "palettizer.h"
|
#include "palettizer.h"
|
||||||
#include "eggFile.h"
|
#include "eggFile.h"
|
||||||
#include "string_utils.h"
|
#include "pal_string_utils.h"
|
||||||
#include "filenameUnifier.h"
|
#include "filenameUnifier.h"
|
||||||
|
|
||||||
#include <eggData.h>
|
#include <eggData.h>
|
||||||
@ -252,8 +252,17 @@ describe_input_file() {
|
|||||||
"to groups; instead, it is more useful to assign the egg files "
|
"to groups; instead, it is more useful to assign the egg files "
|
||||||
"they appear on to groups; see below.\n\n");
|
"they appear on to groups; see below.\n\n");
|
||||||
|
|
||||||
|
show_text(" cont", 10,
|
||||||
|
"Normally, a texture file (or egg file) scans the lines in the "
|
||||||
|
"attributes file from the top, and stops on the first line that "
|
||||||
|
"matches its name. If the keyword 'cont' is included on the "
|
||||||
|
"line, however, the texture will apply the properties given "
|
||||||
|
"on the line, and then continue scanning. This trick may be "
|
||||||
|
"used to specify general parameters for all files while still "
|
||||||
|
"allowing the texture to match a more specific line below.\n\n");
|
||||||
|
|
||||||
nout <<
|
nout <<
|
||||||
"The attributes file may also assign certain egg files into various "
|
"The attributes file may also assign egg files to various "
|
||||||
"named palette groups. The syntax is similar to the above:\n\n"
|
"named palette groups. The syntax is similar to the above:\n\n"
|
||||||
|
|
||||||
" car-blue.egg : main\n"
|
" car-blue.egg : main\n"
|
||||||
@ -263,7 +272,7 @@ describe_input_file() {
|
|||||||
|
|
||||||
"Any number of egg files may be named on one line, and the group of "
|
"Any number of egg files may be named on one line, and the group of "
|
||||||
"egg files may be simultaneously assigned to one or more groups. "
|
"egg files may be simultaneously assigned to one or more groups. "
|
||||||
"The groups are defined using the :group command (see below). "
|
"The valid set of groups are defined using the :group command (see below). "
|
||||||
"Each texture that is referenced by a given egg file will be palettized "
|
"Each texture that is referenced by a given egg file will be palettized "
|
||||||
"into at least one of the groups assigned to the egg file.\n\n"
|
"into at least one of the groups assigned to the egg file.\n\n"
|
||||||
|
|
||||||
@ -304,6 +313,31 @@ describe_input_file() {
|
|||||||
"also be overridden for a particular texture using the 'coverage' "
|
"also be overridden for a particular texture using the 'coverage' "
|
||||||
"keyword on the texture line.\n\n");
|
"keyword on the texture line.\n\n");
|
||||||
|
|
||||||
|
show_text(" :imagetype type[,alpha_type]", 10,
|
||||||
|
"This specifies the default type of image file that should be "
|
||||||
|
"generated for each palette image and for each unplaced texture "
|
||||||
|
"copied into the install directory. This may be overridden for "
|
||||||
|
"a particular texture by specifying the image type on the "
|
||||||
|
"texture line.\n\n"
|
||||||
|
|
||||||
|
"If two image type names separate by a comma are given, it means "
|
||||||
|
"to generate a second file of the second type for the alpha "
|
||||||
|
"channel, for images that require an alpha channel. This allows "
|
||||||
|
"support for image file formats that do not support alpha "
|
||||||
|
"(for instance, JPEG).\n\n");
|
||||||
|
|
||||||
|
show_text(" :shadowtype type[,alpha_type]", 10,
|
||||||
|
"When generating palette images, egg-palettize sometimes has to "
|
||||||
|
"read and write the same palette image repeatedly. If the "
|
||||||
|
"palette image is stored in a lossy file format (like JPEG, see "
|
||||||
|
":imagetype), this can eventually lead to degradation of the "
|
||||||
|
"palette images. As a workaround, egg-palettize can store "
|
||||||
|
"its working copies of the palette images in lossless shadow "
|
||||||
|
"images. Specify this to enable this feature; give it the "
|
||||||
|
"name of a lossless image file format. The shadow images will "
|
||||||
|
"be written to the directory specified by -ds on the command "
|
||||||
|
"line.\n\n");
|
||||||
|
|
||||||
show_text(" :group groupname [dir dirname] [with group1 group2 ...]", 10,
|
show_text(" :group groupname [dir dirname] [with group1 group2 ...]", 10,
|
||||||
"This defines a palette group, a logical division of textures. "
|
"This defines a palette group, a logical division of textures. "
|
||||||
"Each texture is assigned to one or more palette groups before "
|
"Each texture is assigned to one or more palette groups before "
|
||||||
@ -369,6 +403,9 @@ run() {
|
|||||||
// Read the Palettizer object from the Bam file written
|
// Read the Palettizer object from the Bam file written
|
||||||
// previously. This will recover all of the state saved from the
|
// previously. This will recover all of the state saved from the
|
||||||
// past session.
|
// past session.
|
||||||
|
nout << "Reading " << FilenameUnifier::make_user_filename(state_filename)
|
||||||
|
<< "\n";
|
||||||
|
|
||||||
if (!state_file.open_read(state_filename)) {
|
if (!state_file.open_read(state_filename)) {
|
||||||
nout << FilenameUnifier::make_user_filename(state_filename)
|
nout << FilenameUnifier::make_user_filename(state_filename)
|
||||||
<< " exists, but cannot be read. Perhaps you should remove it so a new one can be created.\n";
|
<< " exists, but cannot be read. Perhaps you should remove it so a new one can be created.\n";
|
||||||
|
@ -11,6 +11,8 @@ Filename FilenameUnifier::_txa_filename;
|
|||||||
Filename FilenameUnifier::_txa_dir;
|
Filename FilenameUnifier::_txa_dir;
|
||||||
Filename FilenameUnifier::_rel_dirname;
|
Filename FilenameUnifier::_rel_dirname;
|
||||||
|
|
||||||
|
FilenameUnifier::CanonicalFilenames FilenameUnifier::_canonical_filenames;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: FilenameUnifier::set_txa_filename
|
// Function: FilenameUnifier::set_txa_filename
|
||||||
// Access: Public, Static
|
// Access: Public, Static
|
||||||
@ -28,7 +30,7 @@ set_txa_filename(const Filename &txa_filename) {
|
|||||||
if (_txa_dir.empty()) {
|
if (_txa_dir.empty()) {
|
||||||
_txa_dir = ".";
|
_txa_dir = ".";
|
||||||
}
|
}
|
||||||
_txa_dir.make_canonical();
|
make_canonical(_txa_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -47,7 +49,7 @@ void FilenameUnifier::
|
|||||||
set_rel_dirname(const Filename &rel_dirname) {
|
set_rel_dirname(const Filename &rel_dirname) {
|
||||||
_rel_dirname = rel_dirname;
|
_rel_dirname = rel_dirname;
|
||||||
if (!_rel_dirname.empty()) {
|
if (!_rel_dirname.empty()) {
|
||||||
_rel_dirname.make_canonical();
|
make_canonical(_rel_dirname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ set_rel_dirname(const Filename &rel_dirname) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
Filename FilenameUnifier::
|
Filename FilenameUnifier::
|
||||||
make_bam_filename(Filename filename) {
|
make_bam_filename(Filename filename) {
|
||||||
filename.make_canonical();
|
make_canonical(filename);
|
||||||
filename.make_relative_to(_txa_dir);
|
filename.make_relative_to(_txa_dir);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
@ -89,7 +91,7 @@ get_bam_filename(Filename filename) {
|
|||||||
Filename FilenameUnifier::
|
Filename FilenameUnifier::
|
||||||
make_egg_filename(Filename filename) {
|
make_egg_filename(Filename filename) {
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
filename.make_canonical();
|
make_canonical(filename);
|
||||||
filename.make_relative_to(_rel_dirname);
|
filename.make_relative_to(_rel_dirname);
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
@ -105,8 +107,36 @@ make_egg_filename(Filename filename) {
|
|||||||
Filename FilenameUnifier::
|
Filename FilenameUnifier::
|
||||||
make_user_filename(Filename filename) {
|
make_user_filename(Filename filename) {
|
||||||
if (!filename.empty()) {
|
if (!filename.empty()) {
|
||||||
filename.make_canonical();
|
make_canonical(filename);
|
||||||
filename.make_relative_to(ExecutionEnvironment::get_cwd());
|
filename.make_relative_to(ExecutionEnvironment::get_cwd());
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FilenameUnifier::make_canonical
|
||||||
|
// Access: Private, Static
|
||||||
|
// Description: Does the same thing as Filename::make_canonical()--it
|
||||||
|
// converts the filename to its canonical form--but
|
||||||
|
// caches the operation so that repeated calls to
|
||||||
|
// filenames in the same directory will tend to be
|
||||||
|
// faster.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void FilenameUnifier::
|
||||||
|
make_canonical(Filename &filename) {
|
||||||
|
if (filename.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string dirname = filename.get_dirname();
|
||||||
|
|
||||||
|
CanonicalFilenames::iterator fi;
|
||||||
|
fi = _canonical_filenames.find(dirname);
|
||||||
|
if (fi != _canonical_filenames.end()) {
|
||||||
|
filename.set_dirname((*fi).second);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filename.make_canonical();
|
||||||
|
_canonical_filenames.insert(CanonicalFilenames::value_type(dirname, filename.get_dirname()));
|
||||||
|
}
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include <filename.h>
|
#include <filename.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : FilenameUnifier
|
// Class : FilenameUnifier
|
||||||
// Description : This static class does the job of converting
|
// Description : This static class does the job of converting
|
||||||
@ -31,9 +33,14 @@ public:
|
|||||||
static Filename make_user_filename(Filename filename);
|
static Filename make_user_filename(Filename filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void make_canonical(Filename &filename);
|
||||||
|
|
||||||
static Filename _txa_filename;
|
static Filename _txa_filename;
|
||||||
static Filename _txa_dir;
|
static Filename _txa_dir;
|
||||||
static Filename _rel_dirname;
|
static Filename _rel_dirname;
|
||||||
|
|
||||||
|
typedef map<string, string> CanonicalFilenames;
|
||||||
|
static CanonicalFilenames _canonical_filenames;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Filename: string_utils.cxx
|
// Filename: pal_string_utils.cxx
|
||||||
// Created by: drose (30Nov00)
|
// Created by: drose (30Nov00)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "string_utils.h"
|
#include "pal_string_utils.h"
|
||||||
|
|
||||||
#include <pnmFileType.h>
|
#include <pnmFileType.h>
|
||||||
#include <pnmFileTypeRegistry.h>
|
#include <pnmFileTypeRegistry.h>
|
@ -1,10 +1,10 @@
|
|||||||
// Filename: string_utils.h
|
// Filename: pal_string_utils.h
|
||||||
// Created by: drose (30Nov00)
|
// Created by: drose (30Nov00)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef STRING_UTILS_H
|
#ifndef PAL_STRING_UTILS_H
|
||||||
#define STRING_UTILS_H
|
#define PAL_STRING_UTILS_H
|
||||||
|
|
||||||
#include <pandatoolbase.h>
|
#include <pandatoolbase.h>
|
||||||
#include <vector_string.h>
|
#include <vector_string.h>
|
@ -601,6 +601,7 @@ get_image() {
|
|||||||
if (pal->_shadow_color_type != (PNMFileType *)NULL) {
|
if (pal->_shadow_color_type != (PNMFileType *)NULL) {
|
||||||
if (_shadow_image.read(_image)) {
|
if (_shadow_image.read(_image)) {
|
||||||
_got_image = true;
|
_got_image = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (read(_image)) {
|
if (read(_image)) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "palettizer.h"
|
#include "palettizer.h"
|
||||||
#include "eggFile.h"
|
#include "eggFile.h"
|
||||||
#include "textureImage.h"
|
#include "textureImage.h"
|
||||||
#include "string_utils.h"
|
#include "pal_string_utils.h"
|
||||||
#include "paletteGroup.h"
|
#include "paletteGroup.h"
|
||||||
#include "filenameUnifier.h"
|
#include "filenameUnifier.h"
|
||||||
|
|
||||||
|
@ -374,6 +374,12 @@ get_margin() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool TextureImage::
|
bool TextureImage::
|
||||||
is_surprise() const {
|
is_surprise() const {
|
||||||
|
if (_placement.empty()) {
|
||||||
|
// A texture that is not actually placed anywhere is not
|
||||||
|
// considered a surprise.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return _is_surprise;
|
return _is_surprise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,14 @@
|
|||||||
#include <eggTexture.h>
|
#include <eggTexture.h>
|
||||||
#include <eggData.h>
|
#include <eggData.h>
|
||||||
#include <eggGroupNode.h>
|
#include <eggGroupNode.h>
|
||||||
|
#include <eggGroup.h>
|
||||||
#include <eggNurbsSurface.h>
|
#include <eggNurbsSurface.h>
|
||||||
#include <eggVertexPool.h>
|
#include <eggVertexPool.h>
|
||||||
#include <datagram.h>
|
#include <datagram.h>
|
||||||
#include <datagramIterator.h>
|
#include <datagramIterator.h>
|
||||||
#include <bamReader.h>
|
#include <bamReader.h>
|
||||||
#include <bamWriter.h>
|
#include <bamWriter.h>
|
||||||
|
#include <string_utils.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -394,11 +396,21 @@ write(ostream &out, int indent_level) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void TextureReference::
|
void TextureReference::
|
||||||
get_uv_range(EggGroupNode *group) {
|
get_uv_range(EggGroupNode *group) {
|
||||||
EggGroupNode::iterator ci;
|
if (group->is_of_type(EggGroup::get_class_type())) {
|
||||||
|
EggGroup *egg_group;
|
||||||
|
DCAST_INTO_V(egg_group, group);
|
||||||
|
if (egg_group->has_objecttype() &&
|
||||||
|
cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) {
|
||||||
|
// If we reach a <Group> node with the "backstage" flag set,
|
||||||
|
// ignore it and everything under it.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool group_any_uvs = false;
|
bool group_any_uvs = false;
|
||||||
TexCoordd group_min_uv, group_max_uv;
|
TexCoordd group_min_uv, group_max_uv;
|
||||||
|
|
||||||
|
EggGroupNode::iterator ci;
|
||||||
for (ci = group->begin(); ci != group->end(); ci++) {
|
for (ci = group->begin(); ci != group->end(); ci++) {
|
||||||
EggNode *child = (*ci);
|
EggNode *child = (*ci);
|
||||||
if (child->is_of_type(EggNurbsSurface::get_class_type())) {
|
if (child->is_of_type(EggNurbsSurface::get_class_type())) {
|
||||||
@ -473,11 +485,21 @@ get_uv_range(EggGroupNode *group) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void TextureReference::
|
void TextureReference::
|
||||||
update_uv_range(EggGroupNode *group) {
|
update_uv_range(EggGroupNode *group) {
|
||||||
EggGroupNode::iterator ci;
|
if (group->is_of_type(EggGroup::get_class_type())) {
|
||||||
|
EggGroup *egg_group;
|
||||||
|
DCAST_INTO_V(egg_group, group);
|
||||||
|
if (egg_group->has_objecttype() &&
|
||||||
|
cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) {
|
||||||
|
// If we reach a <Group> node with the "backstage" flag set,
|
||||||
|
// ignore it and everything under it.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool group_any_uvs = false;
|
bool group_any_uvs = false;
|
||||||
TexCoordd group_min_uv, group_max_uv;
|
TexCoordd group_min_uv, group_max_uv;
|
||||||
|
|
||||||
|
EggGroupNode::iterator ci;
|
||||||
for (ci = group->begin(); ci != group->end(); ci++) {
|
for (ci = group->begin(); ci != group->end(); ci++) {
|
||||||
EggNode *child = (*ci);
|
EggNode *child = (*ci);
|
||||||
if (child->is_of_type(EggNurbsSurface::get_class_type())) {
|
if (child->is_of_type(EggNurbsSurface::get_class_type())) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "txaFile.h"
|
#include "txaFile.h"
|
||||||
#include "string_utils.h"
|
#include "pal_string_utils.h"
|
||||||
#include "palettizer.h"
|
#include "palettizer.h"
|
||||||
#include "paletteGroup.h"
|
#include "paletteGroup.h"
|
||||||
#include "textureImage.h"
|
#include "textureImage.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "txaLine.h"
|
#include "txaLine.h"
|
||||||
#include "string_utils.h"
|
#include "pal_string_utils.h"
|
||||||
#include "eggFile.h"
|
#include "eggFile.h"
|
||||||
#include "palettizer.h"
|
#include "palettizer.h"
|
||||||
#include "textureImage.h"
|
#include "textureImage.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user