move PfmFile to pnmimage
This commit is contained in:
parent
5a9cb3f934
commit
0f1098c1ae
|
|
@ -25,8 +25,6 @@
|
|||
lineSegs.I lineSegs.h \
|
||||
multitexReducer.I multitexReducer.h multitexReducer.cxx \
|
||||
nodeVertexTransform.I nodeVertexTransform.h \
|
||||
pfmFile.I pfmFile.h \
|
||||
pnmFileTypePfm.h \
|
||||
rigidBodyCombiner.I rigidBodyCombiner.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
|
|
@ -41,8 +39,6 @@
|
|||
sceneGraphAnalyzerMeter.cxx \
|
||||
heightfieldTesselator.cxx \
|
||||
nodeVertexTransform.cxx \
|
||||
pfmFile.cxx \
|
||||
pnmFileTypePfm.cxx \
|
||||
pipeOcclusionCullTraverser.cxx \
|
||||
lineSegs.cxx \
|
||||
rigidBodyCombiner.cxx
|
||||
|
|
@ -60,8 +56,6 @@
|
|||
lineSegs.I lineSegs.h \
|
||||
multitexReducer.I multitexReducer.h \
|
||||
nodeVertexTransform.I nodeVertexTransform.h \
|
||||
pfmFile.I pfmFile.h \
|
||||
pnmFileTypePfm.h \
|
||||
rigidBodyCombiner.I rigidBodyCombiner.h
|
||||
|
||||
#define IGATESCAN all
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
#include "nodeVertexTransform.h"
|
||||
#include "rigidBodyCombiner.h"
|
||||
#include "pipeOcclusionCullTraverser.h"
|
||||
#include "pnmFileTypePfm.h"
|
||||
#include "pnmFileTypeRegistry.h"
|
||||
|
||||
#include "dconfig.h"
|
||||
|
||||
|
|
@ -63,29 +61,6 @@ ConfigVariableDouble scene_graph_analyzer_meter_scale
|
|||
ConfigVariableDouble scene_graph_analyzer_meter_side_margins
|
||||
("scene-graph-analyzer-meter-side-margins", 0.5);
|
||||
|
||||
ConfigVariableBool pfm_force_littleendian
|
||||
("pfm-force-littleendian", false,
|
||||
PRC_DESC("This forces a pfm file to be read as a sequence of little-endian "
|
||||
"floats, even if its scale factor is given as a positive number."));
|
||||
|
||||
ConfigVariableBool pfm_reverse_dimensions
|
||||
("pfm-reverse-dimensions", false,
|
||||
PRC_DESC("Understands that the width and height of a pfm file are given "
|
||||
"backwards, in the form height width instead of width height, "
|
||||
"on input. Does not affect output, which is always written width height."));
|
||||
|
||||
ConfigVariableInt pfm_vis_max_vertices
|
||||
("pfm-vis-max-vertices", 65535,
|
||||
PRC_DESC("Specifies the maximum number of vertex entries that may appear in "
|
||||
"a single generated mesh. If the mesh would require more than that, "
|
||||
"the mesh is subdivided into smaller pieces."));
|
||||
|
||||
ConfigVariableInt pfm_vis_max_indices
|
||||
("pfm-vis-max-indices", 1048576,
|
||||
PRC_DESC("Specifies the maximum number of vertex references that may appear in "
|
||||
"a single generated mesh. If the mesh would require more than that, "
|
||||
"the mesh is subdivided into smaller pieces."));
|
||||
|
||||
ConfigVariableBool movies_sync_pages
|
||||
("movies-sync-pages", true,
|
||||
PRC_DESC("Set this true to force multi-page MovieTextures to hold pages "
|
||||
|
|
@ -134,10 +109,5 @@ init_libgrutil() {
|
|||
TexturePool *ts = TexturePool::get_global_ptr();
|
||||
ts->register_texture_type(MovieTexture::make_texture, "avi mov mpg mpeg mp4 wmv asf flv nut ogm mkv");
|
||||
#endif // HAVE_FFMPEG
|
||||
|
||||
PNMFileTypeRegistry *tr = PNMFileTypeRegistry::get_global_ptr();
|
||||
PNMFileTypePfm::init_type();
|
||||
PNMFileTypePfm::register_with_read_factory();
|
||||
tr->register_type(new PNMFileTypePfm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,6 @@ extern ConfigVariableInt scene_graph_analyzer_meter_layer_sort;
|
|||
extern ConfigVariableDouble scene_graph_analyzer_meter_scale;
|
||||
extern ConfigVariableDouble scene_graph_analyzer_meter_side_margins;
|
||||
|
||||
extern ConfigVariableBool pfm_force_littleendian;
|
||||
extern ConfigVariableBool pfm_reverse_dimensions;
|
||||
extern ConfigVariableInt pfm_vis_max_vertices;
|
||||
extern ConfigVariableInt pfm_vis_max_indices;
|
||||
|
||||
extern ConfigVariableBool movies_sync_pages;
|
||||
|
||||
extern EXPCL_PANDA_GRUTIL void init_libgrutil();
|
||||
|
|
|
|||
|
|
@ -4,5 +4,3 @@
|
|||
#include "rigidBodyCombiner.cxx"
|
||||
#include "meshDrawer.cxx"
|
||||
#include "meshDrawer2D.cxx"
|
||||
#include "pfmFile.cxx"
|
||||
#include "pnmFileTypePfm.cxx"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#define SOURCES \
|
||||
config_pnmimage.h \
|
||||
pfmFile.I pfmFile.h \
|
||||
pnmFileTypePfm.h \
|
||||
pnmbitio.h \
|
||||
pnmBrush.h pnmBrush.I \
|
||||
pnmFileType.h pnmFileTypeRegistry.h pnmImage.I \
|
||||
|
|
@ -22,6 +24,8 @@
|
|||
|
||||
#define INCLUDED_SOURCES \
|
||||
config_pnmimage.cxx \
|
||||
pfmFile.cxx \
|
||||
pnmFileTypePfm.cxx \
|
||||
pnm-image-filter.cxx \
|
||||
pnmbitio.cxx \
|
||||
pnmBrush.cxx \
|
||||
|
|
@ -33,6 +37,8 @@
|
|||
|
||||
#define INSTALL_HEADERS \
|
||||
config_pnmimage.h \
|
||||
pfmFile.I pfmFile.h \
|
||||
pnmFileTypePfm.h \
|
||||
pnmBrush.h pnmBrush.I \
|
||||
pnmFileType.h pnmFileTypeRegistry.h pnmImage.I \
|
||||
pnmImage.h pnmImageHeader.I pnmImageHeader.h \
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "config_pnmimage.h"
|
||||
#include "pnmFileType.h"
|
||||
#include "pnmFileTypePfm.h"
|
||||
#include "pnmFileTypeRegistry.h"
|
||||
|
||||
#include "dconfig.h"
|
||||
|
||||
|
|
@ -24,6 +26,29 @@ ConfigureFn(config_pnmimage) {
|
|||
init_libpnmimage();
|
||||
}
|
||||
|
||||
ConfigVariableBool pfm_force_littleendian
|
||||
("pfm-force-littleendian", false,
|
||||
PRC_DESC("This forces a pfm file to be read as a sequence of little-endian "
|
||||
"floats, even if its scale factor is given as a positive number."));
|
||||
|
||||
ConfigVariableBool pfm_reverse_dimensions
|
||||
("pfm-reverse-dimensions", false,
|
||||
PRC_DESC("Understands that the width and height of a pfm file are given "
|
||||
"backwards, in the form height width instead of width height, "
|
||||
"on input. Does not affect output, which is always written width height."));
|
||||
|
||||
ConfigVariableInt pfm_vis_max_vertices
|
||||
("pfm-vis-max-vertices", 65535,
|
||||
PRC_DESC("Specifies the maximum number of vertex entries that may appear in "
|
||||
"a single generated mesh. If the mesh would require more than that, "
|
||||
"the mesh is subdivided into smaller pieces."));
|
||||
|
||||
ConfigVariableInt pfm_vis_max_indices
|
||||
("pfm-vis-max-indices", 1048576,
|
||||
PRC_DESC("Specifies the maximum number of vertex references that may appear in "
|
||||
"a single generated mesh. If the mesh would require more than that, "
|
||||
"the mesh is subdivided into smaller pieces."));
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libpnmimage
|
||||
// Description: Initializes the library. This must be called at
|
||||
|
|
@ -41,4 +66,9 @@ init_libpnmimage() {
|
|||
initialized = true;
|
||||
|
||||
PNMFileType::init_type();
|
||||
|
||||
PNMFileTypeRegistry *tr = PNMFileTypeRegistry::get_global_ptr();
|
||||
PNMFileTypePfm::init_type();
|
||||
PNMFileTypePfm::register_with_read_factory();
|
||||
tr->register_type(new PNMFileTypePfm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,16 @@
|
|||
|
||||
#include "pandabase.h"
|
||||
#include "notifyCategoryProxy.h"
|
||||
#include "configVariableInt.h"
|
||||
#include "configVariableBool.h"
|
||||
|
||||
NotifyCategoryDecl(pnmimage, EXPCL_PANDA_PNMIMAGE, EXPTP_PANDA_PNMIMAGE);
|
||||
|
||||
extern ConfigVariableBool pfm_force_littleendian;
|
||||
extern ConfigVariableBool pfm_reverse_dimensions;
|
||||
extern ConfigVariableInt pfm_vis_max_vertices;
|
||||
extern ConfigVariableInt pfm_vis_max_indices;
|
||||
|
||||
extern EXPCL_PANDA_PNMIMAGE void init_libpnmimage();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include "config_pnmimage.cxx"
|
||||
#include "pfmFile.cxx"
|
||||
#include "pnmFileTypePfm.cxx"
|
||||
#include "pnm-image-filter.cxx"
|
||||
#include "pnmbitio.cxx"
|
||||
#include "pnmBrush.cxx"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "config_grutil.h"
|
||||
#include "config_pnmimage.h"
|
||||
#include "pfmFile.h"
|
||||
#include "virtualFileSystem.h"
|
||||
#include "pandaFileStream.h"
|
||||
|
|
@ -144,13 +144,13 @@ read(const Filename &fullpath) {
|
|||
PT(VirtualFile) file = vfs->get_file(filename);
|
||||
if (file == (VirtualFile *)NULL) {
|
||||
// No such file.
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "Could not find " << fullpath << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (grutil_cat.is_debug()) {
|
||||
grutil_cat.debug()
|
||||
if (pnmimage_cat.is_debug()) {
|
||||
pnmimage_cat.debug()
|
||||
<< "Reading PFM file " << filename << "\n";
|
||||
}
|
||||
|
||||
|
|
@ -201,13 +201,13 @@ read(istream &in, const Filename &fullpath, const string &magic_number) {
|
|||
PNMReader *reader = pnm.make_reader
|
||||
(&in, false, fullpath, identifier, NULL, false);
|
||||
if (reader == (PNMReader *)NULL) {
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "Not a PFM file or known image file type: " << fullpath << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!pnm.read(reader)) {
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "Invalid image file: " << fullpath << "\n";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ read(istream &in, const Filename &fullpath, const string &magic_number) {
|
|||
PN_float32 scale;
|
||||
in >> width >> height >> scale;
|
||||
if (!in) {
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "Error parsing PFM header: " << fullpath << "\n";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ read(istream &in, const Filename &fullpath, const string &magic_number) {
|
|||
bool PfmFile::
|
||||
write(const Filename &fullpath) {
|
||||
if (!is_valid()) {
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "PFM file is invalid.\n";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -299,7 +299,7 @@ write(const Filename &fullpath) {
|
|||
Filename filename = Filename::binary_filename(fullpath);
|
||||
pofstream out;
|
||||
if (!filename.open_write(out)) {
|
||||
grutil_cat.error()
|
||||
pnmimage_cat.error()
|
||||
<< "Unable to open " << filename << "\n";
|
||||
return false;
|
||||
}
|
||||
|
|
@ -319,8 +319,8 @@ write(const Filename &fullpath) {
|
|||
}
|
||||
}
|
||||
|
||||
if (grutil_cat.is_debug()) {
|
||||
grutil_cat.debug()
|
||||
if (pnmimage_cat.is_debug()) {
|
||||
pnmimage_cat.debug()
|
||||
<< "Writing PFM file " << filename << "\n";
|
||||
}
|
||||
|
||||
|
|
@ -1485,8 +1485,8 @@ make_vis_mesh_geom(GeomNode *gnode, bool inverted) const {
|
|||
}
|
||||
|
||||
// OK, now we know how many cells we need.
|
||||
if (grutil_cat.is_debug()) {
|
||||
grutil_cat.debug()
|
||||
if (pnmimage_cat.is_debug()) {
|
||||
pnmimage_cat.debug()
|
||||
<< "Generating mesh with " << num_x_cells << " x " << num_y_cells
|
||||
<< " pieces.\n";
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ class GeomVertexWriter;
|
|||
// numbers, either 3-component or 1-component, or with a
|
||||
// special extension, 4-component.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA_GRUTIL PfmFile {
|
||||
class EXPCL_PANDA_PNMIMAGE PfmFile {
|
||||
PUBLISHED:
|
||||
PfmFile();
|
||||
PfmFile(const PfmFile ©);
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pnmFileTypePfm.h"
|
||||
#include "config_grutil.h"
|
||||
#include "config_pnmimage.h"
|
||||
|
||||
#include "pnmFileTypeRegistry.h"
|
||||
#include "bamReader.h"
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
#include "pandabase.h"
|
||||
|
||||
#include "pnmFileType.h"
|
||||
#include "pnmImage.h"
|
||||
#include "pnmReader.h"
|
||||
#include "pnmWriter.h"
|
||||
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
// Description : For reading and writing PFM files using the basic
|
||||
// PNMImage interface, as if they were basic RGB files.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA_GRUTIL PNMFileTypePfm : public PNMFileType {
|
||||
class EXPCL_PANDA_PNMIMAGE PNMFileTypePfm : public PNMFileType {
|
||||
public:
|
||||
PNMFileTypePfm();
|
||||
|
||||
Loading…
Reference in New Issue