Converted osg::notify to OSG_INFO etc.

This commit is contained in:
Robert Osfield
2010-05-28 16:47:42 +00:00
parent 37470070f2
commit c56b29b7fe
8 changed files with 104 additions and 104 deletions

View File

@@ -124,7 +124,7 @@ void Block::compile(const lwo2::FORM::SURF::BLOK *blok)
}
} else {
osg::notify(osg::WARN) << "Warning: lwosg::Block: only IMAP (image map) block types are supported, this block will be ignored" << std::endl;
OSG_WARN << "Warning: lwosg::Block: only IMAP (image map) block types are supported, this block will be ignored" << std::endl;
}
}

View File

@@ -56,14 +56,14 @@ osg::Group *Converter::convert(Object &obj)
root_->removeChildren(0, root_->getNumChildren());
}
osg::notify(osg::INFO) << "INFO: lwosg::Converter: flattening per-polygon vertex maps\n";
OSG_INFO << "INFO: lwosg::Converter: flattening per-polygon vertex maps\n";
for (Object::Layer_map::iterator i=obj.layers().begin(); i!=obj.layers().end(); ++i) {
for (Layer::Unit_list::iterator j=i->second.units().begin(); j!=i->second.units().end(); ++j) {
j->flatten_maps();
}
}
osg::notify(osg::INFO) << "INFO: lwosg::Converter: creating scene graph\n";
OSG_INFO << "INFO: lwosg::Converter: creating scene graph\n";
build_scene_graph(obj);
return root_.get();
@@ -75,7 +75,7 @@ void Converter::build_scene_graph(Object &obj)
typedef std::map<int, osg::ref_ptr<osg::Group> > Layer_group_map;
Layer_group_map lymap;
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: creating layer structure\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: creating layer structure\n";
// create a flat layer structure, no parenting since it's handled in scene files
for (Object::Layer_map::const_iterator i=obj.layers().begin(); i!=obj.layers().end(); ++i) {
@@ -98,11 +98,11 @@ void Converter::build_scene_graph(Object &obj)
osg::Group *layer_group = lymap[layer.number()].get();
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: processing layer '" << layer_group->getName() << "'\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: processing layer '" << layer_group->getName() << "'\n";
for (Layer::Unit_list::iterator j=layer.units().begin(); j!=layer.units().end(); ++j) {
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: \tcreating primitives\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcreating primitives\n";
int tess_success = 0;
int tess_fail = 0;
@@ -150,11 +150,11 @@ void Converter::build_scene_graph(Object &obj)
}
if (tess_success > 0) {
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: " << tess_success << " polygons have been tessellated correctly\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: " << tess_success << " polygons have been tessellated correctly\n";
}
if (tess_fail > 0) {
osg::notify(osg::WARN) << "Warning: lwosg::Converter: could not tessellate " << tess_fail << " polygons correctly. This is probably due to self-intersecting polygons being used, try to Triple them in Lightwave and restart the conversion" << std::endl;
OSG_WARN << "Warning: lwosg::Converter: could not tessellate " << tess_fail << " polygons correctly. This is probably due to self-intersecting polygons being used, try to Triple them in Lightwave and restart the conversion" << std::endl;
}
// create normal array
@@ -170,7 +170,7 @@ void Converter::build_scene_graph(Object &obj)
const Unit::Index_list &remapping = remappings[surface];
// clean up points and normals according to remapping map
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: \tcleaning up redundant vertices and vertex attributes for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcleaning up redundant vertices and vertex attributes for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n";
osg::ref_ptr<osg::Vec3Array> new_points = new osg::Vec3Array;
osg::ref_ptr<osg::Vec3Array> new_normals = new osg::Vec3Array;
for (unsigned pi=0; pi<j->points()->size(); ++pi) {
@@ -180,7 +180,7 @@ void Converter::build_scene_graph(Object &obj)
}
}
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Converter: \tcreating geometry for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Converter: \tcreating geometry for surface '" << (surface ? surface->get_name() : std::string("anonymous")) << "'\n";
osg::ref_ptr<osg::Geometry> geo = new osg::Geometry;
geo->setVertexArray(new_points.get());

View File

@@ -65,15 +65,15 @@ void Object::build(const iff::Chunk_list &data)
comment_ = "";
description_ = "";
osg::notify(osg::INFO) << "INFO: lwosg::Object: scanning clips\n";
OSG_INFO << "INFO: lwosg::Object: scanning clips\n";
scan_clips(data);
osg::notify(osg::INFO) << "INFO: lwosg::Object: scanning surfaces\n";
OSG_INFO << "INFO: lwosg::Object: scanning surfaces\n";
scan_surfaces(data);
osg::notify(osg::INFO) << "INFO: lwosg::Object: parsing LWO2 chunks and building object\n";
OSG_INFO << "INFO: lwosg::Object: parsing LWO2 chunks and building object\n";
parse(data);
osg::notify(osg::INFO) << "INFO: lwosg::Object: generating normals\n";
OSG_INFO << "INFO: lwosg::Object: generating normals\n";
generate_normals();
osg::notify(osg::INFO) << "INFO: lwosg::Object: generating automatic texture maps\n";
OSG_INFO << "INFO: lwosg::Object: generating automatic texture maps\n";
generate_auto_texture_maps();
}
@@ -130,7 +130,7 @@ void Object::parse(const iff::Chunk_list &data)
std::string type(vmap->type.id, 4);
if (type == "WGHT") {
if (vmap->dimension != 1) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().weight_maps()->getOrCreate(vmap->name);
@@ -140,7 +140,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "MNVW") {
if (vmap->dimension != 1) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().subpatch_weight_maps()->getOrCreate(vmap->name);
@@ -150,7 +150,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "TXUV") {
if (vmap->dimension != 2) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().texture_maps()->getOrCreate(vmap->name);
@@ -160,7 +160,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "RGB ") {
if (vmap->dimension != 3) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().rgb_maps()->getOrCreate(vmap->name);
@@ -170,7 +170,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "RGBA") {
if (vmap->dimension != 4) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().rgba_maps()->getOrCreate(vmap->name);
@@ -180,7 +180,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "MORF") {
if (vmap->dimension != 3) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().displacement_maps()->getOrCreate(vmap->name);
@@ -190,7 +190,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "SPOT") {
if (vmap->dimension != 3) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " vertex map dimension: " << vmap->dimension << std::endl;
continue;
}
VertexMap *new_map = current_layer.units().back().spot_maps()->getOrCreate(vmap->name);
@@ -204,7 +204,7 @@ void Object::parse(const iff::Chunk_list &data)
if (pols && !current_layer.units().empty()) {
std::string type(pols->type.id, 4);
if (type != "FACE") {
osg::notify(osg::INFO) << "INFO: Lwo2Object: polygon list of type " << type << " not supported, rendering may be inaccurate" << std::endl;
OSG_INFO << "INFO: Lwo2Object: polygon list of type " << type << " not supported, rendering may be inaccurate" << std::endl;
}
for (lwo2::FORM::POLS::Polygon_list::const_iterator i=pols->polygons.begin(); i!=pols->polygons.end(); ++i) {
Polygon polygon;
@@ -268,7 +268,7 @@ void Object::parse(const iff::Chunk_list &data)
std::string type(vmad->type.id, 4);
if (type == "WGHT") {
if (vmad->dimension != 1) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
continue;
}
for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) {
@@ -278,7 +278,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "TXUV") {
if (vmad->dimension != 2) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
continue;
}
for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) {
@@ -288,7 +288,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "RGB ") {
if (vmad->dimension != 3) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
continue;
}
for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) {
@@ -298,7 +298,7 @@ void Object::parse(const iff::Chunk_list &data)
}
if (type == "RGBA") {
if (vmad->dimension != 4) {
osg::notify(osg::WARN) << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
OSG_WARN << "Warning: Lwo2Object: invalid " << type << " discontinuous vertex map dimension: " << vmad->dimension << std::endl;
continue;
}
for (lwo2::FORM::VMAD::Mapping_list::const_iterator i=vmad->mapping.begin(); i!=vmad->mapping.end(); ++i) {
@@ -348,7 +348,7 @@ void Object::generate_auto_texture_maps()
oss << "Auto_map_" << &block;
std::string map_name = oss.str();
osg::notify(osg::DEBUG_INFO) << "DEBUG INFO: lwosg::Object: creating automatic texture map '" << map_name << "'\n";
OSG_DEBUG << "DEBUG INFO: lwosg::Object: creating automatic texture map '" << map_name << "'\n";
for (Layer_map::iterator k=layers_.begin(); k!=layers_.end(); ++k) {
for (Layer::Unit_list::iterator h=k->second.units().begin(); h!=k->second.units().end(); ++h) {
@@ -357,7 +357,7 @@ void Object::generate_auto_texture_maps()
(*h->texture_maps())[map_name] = new_map.get();
if (block.get_image_map().projection == Image_map::FRONT_PROJECTION) {
osg::notify(osg::WARN) << "Warning: lwosg::Object: front projection is not supported" << std::endl;
OSG_WARN << "Warning: lwosg::Object: front projection is not supported" << std::endl;
}
if (block.get_image_map().projection == Image_map::CUBIC) {

View File

@@ -190,9 +190,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
if (!lw)
return ReadResult::FILE_NOT_HANDLED;
osg::notify(osg::INFO) << "faces " << lw->face_cnt << std::endl;
osg::notify(osg::INFO) << "materials " << lw->material_cnt << std::endl;
osg::notify(osg::INFO) << "vertices " << lw->vertex_cnt << std::endl;
OSG_INFO << "faces " << lw->face_cnt << std::endl;
OSG_INFO << "materials " << lw->material_cnt << std::endl;
OSG_INFO << "vertices " << lw->vertex_cnt << std::endl;
typedef std::map<int,GeometryCollection> MaterialToGeometryCollectionMap;
MaterialToGeometryCollectionMap mtgcm;
@@ -241,7 +241,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
{
if (lw_material.ctex.flags && strlen(lw_material.ctex.name)!=0)
{
osg::notify(osg::INFO) << "ctex " << lw_material.ctex.name << std::endl;
OSG_INFO << "ctex " << lw_material.ctex.name << std::endl;
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(lw_material.ctex.name);
if (image.valid())
{

View File

@@ -120,7 +120,7 @@ void Surface::compile(const lwo2::FORM::SURF *surf, const Clip_map &clips)
if (i != clips.end()) {
new_block.get_image_map().clip = &i->second;
} else {
osg::notify(osg::WARN) << "Warning: lwosg::Surface: cannot find clip number " << new_block.get_image_map().image_map << std::endl;
OSG_WARN << "Warning: lwosg::Surface: cannot find clip number " << new_block.get_image_map().image_map << std::endl;
}
}
blocks_.insert(Block_map::value_type(new_block.get_ordinal(), new_block));
@@ -192,7 +192,7 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr
if (unit >= max_tex_units && max_tex_units > 0)
{
osg::notify(osg::WARN) << "Warning: lwosg::Surface: maximum number of texture units (" << max_tex_units << ") has been reached, skipping incoming blocks" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: maximum number of texture units (" << max_tex_units << ") has been reached, skipping incoming blocks" << std::endl;
break;
}
@@ -237,7 +237,7 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr
break;
case Block::SUBTRACTIVE:
osg::notify(osg::WARN) << "Warning: lwosg::Surface: 'Subtractive' blending mode is not supported, falling back to 'Difference' mode" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: 'Subtractive' blending mode is not supported, falling back to 'Difference' mode" << std::endl;
case Block::DIFFERENCE:
tec->setCombine_RGB(osg::TexEnvCombine::SUBTRACT);
break;
@@ -247,15 +247,15 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr
break;
case Block::DIVIDE:
osg::notify(osg::WARN) << "Warning: lwosg::Surface: 'Divide' blending mode is not supported" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: 'Divide' blending mode is not supported" << std::endl;
break;
case Block::ALPHA:
osg::notify(osg::WARN) << "Warning: lwosg::Surface: 'Alpha' blending mode is not supported" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: 'Alpha' blending mode is not supported" << std::endl;
break;
case Block::TEXTURE_DISPLACEMENT:
osg::notify(osg::WARN) << "Warning: lwosg::Surface: 'Texture Displacement' blending mode is not supported" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: 'Texture Displacement' blending mode is not supported" << std::endl;
break;
default:
@@ -269,7 +269,7 @@ void Surface::generate_stateset(unsigned int max_tex_units, bool force_arb_compr
}
else
{
osg::notify(osg::WARN) << "Warning: lwosg::Surface: texture channels of type '" << block.get_channel() << "' are not supported, this block will be ignored" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: texture channels of type '" << block.get_channel() << "' are not supported, this block will be ignored" << std::endl;
}
}
}
@@ -298,7 +298,7 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps
if (i != texture_maps->end()) {
geo->setTexCoordArray(unit, i->second->asVec2Array(num_points));
} else {
osg::notify(osg::WARN) << "Warning: lwosg::Surface: surface '" << name_ << "' needs texture map named '" << block.get_image_map().uv_map << "' but I can't find it" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: surface '" << name_ << "' needs texture map named '" << block.get_image_map().uv_map << "' but I can't find it" << std::endl;
}
}
++unit;
@@ -314,13 +314,13 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps
{
if (geo->getTexCoordArray(vi->second) != 0)
{
osg::notify(osg::WARN) << "Warning: lwosg::Surface: explicing binding of texture map '" << vi->first << "' to texunit " << vi->second << " will replace existing texture map" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: explicing binding of texture map '" << vi->first << "' to texunit " << vi->second << " will replace existing texture map" << std::endl;
}
geo->setTexCoordArray(vi->second, j->second->asVec2Array(num_points));
}
else
{
osg::notify(osg::WARN) << "Warning: lwosg::Surface: explicit binding of texture map '" << vi->first << "' to texunit " << vi->second << " was requested but there is no such map in this LWO file" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: explicit binding of texture map '" << vi->first << "' to texunit " << vi->second << " was requested but there is no such map in this LWO file" << std::endl;
}
}
}
@@ -343,14 +343,14 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps
geo->setColorArray(i->second->asVec4Array(num_points, color * color_map_intensity_, color * color_map_intensity_));
geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
} else {
osg::notify(osg::WARN) << "Warning: lwosg::Surface: surface '" << name_ << "' needs color map named '" << color_map_name_ << "' but I can't find it" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: surface '" << name_ << "' needs color map named '" << color_map_name_ << "' but I can't find it" << std::endl;
}
}
// create osgFX specularity if needed
if (use_osgfx && glossiness_ > 0 && specularity_ > 0) {
if (unit >= max_tex_units && max_tex_units > 0) {
osg::notify(osg::WARN) << "Warning: lwosg::Surface: can't apply osgFX specular lighting: maximum number of texture units (" << max_tex_units << ") has been reached" << std::endl;
OSG_WARN << "Warning: lwosg::Surface: can't apply osgFX specular lighting: maximum number of texture units (" << max_tex_units << ") has been reached" << std::endl;
} else {
osg::ref_ptr<osgFX::SpecularHighlights> sh = new osgFX::SpecularHighlights;
sh->setTextureUnit(unit);

View File

@@ -59,7 +59,7 @@ VertexMap *VertexMap::remap(const std::vector<int> &remapping) const
for (VertexMap::const_iterator i=begin(); i!=end(); ++i) {
if (i->first >= static_cast<int>(remapping.size())) {
osg::notify(osg::WARN) << "Warning: lwosg::remap(): remapping index not found for vertex " << i->first << " (map size " << remapping.size() << ")" << std::endl;
OSG_WARN << "Warning: lwosg::remap(): remapping index not found for vertex " << i->first << " (map size " << remapping.size() << ")" << std::endl;
} else {
int new_index = remapping[i->first];
if (new_index != -1) {

View File

@@ -67,12 +67,12 @@ Lwo2::~Lwo2()
bool
Lwo2::ReadFile( const string& filename )
{
notify(INFO) << "Opening file: " << filename << std::endl;
OSG_INFO << "Opening file: " << filename << std::endl;
_fin.open(filename.c_str(), ios::in | ios::binary );
if (!_fin.is_open())
{
notify(INFO) << "Can't open file '" << filename << "'" << std::endl;
OSG_INFO << "Can't open file '" << filename << "'" << std::endl;
return false;
}
@@ -80,30 +80,30 @@ Lwo2::ReadFile( const string& filename )
// http://www.lightwave3d.com/developer/75lwsdk/docs/filefmts/eaiff85.html
if (_read_uint() != tag_FORM)
{
notify(INFO) << "File '" << filename << "' is not IFF format file." << std::endl;
OSG_INFO << "File '" << filename << "' is not IFF format file." << std::endl;
_fin.close();
return false;
}
else
{
notify(INFO) << "Detected EA-IFF85 format" << std::endl;
OSG_INFO << "Detected EA-IFF85 format" << std::endl;
}
unsigned int form_size = _read_uint();
notify(INFO) << "Form size: " << form_size << std::endl;
OSG_INFO << "Form size: " << form_size << std::endl;
// checking LWO2 format
// http://www.lightwave3d.com/developer/75lwsdk/docs/filefmts/lwo2.html
if (_read_uint() != tag_LWO2)
{
unsigned long make_id(const char*);
notify(INFO) << "File '" << filename << "' is not LWO2 format file." << std::endl;
OSG_INFO << "File '" << filename << "' is not LWO2 format file." << std::endl;
_fin.close();
return false;
}
else
{
notify(INFO) << "Detected LWO2 format" << std::endl;
OSG_INFO << "Detected LWO2 format" << std::endl;
}
unsigned long read_bytes = 4;
@@ -224,7 +224,7 @@ Lwo2::_read_string(string& str)
void
Lwo2::_print_tag(unsigned int tag, unsigned int size) {
notify(DEBUG_INFO) << "Found tag "
OSG_DEBUG << "Found tag "
<< char(tag >> 24)
<< char(tag >> 16)
<< char(tag >> 8)
@@ -236,7 +236,7 @@ Lwo2::_print_tag(unsigned int tag, unsigned int size) {
// print 4-char type
void
Lwo2::_print_type(unsigned int type) {
notify(DEBUG_INFO) << " type \t"
OSG_DEBUG << " type \t"
<< char(type >> 24)
<< char(type >> 16)
<< char(type >> 8)
@@ -256,7 +256,7 @@ Lwo2::_read_tag_strings(unsigned long size)
size -= name.length() + name.length() % 2;
_tags.push_back(name);
notify(DEBUG_INFO) << " name \t'" << name.c_str() << "'" << std::endl;
OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl;
}
}
@@ -298,7 +298,7 @@ void Lwo2::_read_layer(unsigned long size)
void Lwo2::_read_points(unsigned long size)
{
int count = size / 12;
notify(DEBUG_INFO) << " count \t" << count << std::endl;
OSG_DEBUG << " count \t" << count << std::endl;
while (count--)
{
@@ -324,12 +324,12 @@ void Lwo2::_read_vertex_mapping(unsigned long size)
short dimension = _read_short();
size -= 2;
notify(DEBUG_INFO) << " dimension \t" << dimension << std::endl;
OSG_DEBUG << " dimension \t" << dimension << std::endl;
string name;
_read_string(name);
size -= name.length() + name.length() % 2;
notify(DEBUG_INFO) << " name \t'" << name.c_str() << "'" << std::endl;
OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl;
if (type == tag_TXUV && dimension == 2)
{
@@ -354,7 +354,7 @@ void Lwo2::_read_vertex_mapping(unsigned long size)
{
// not recognized yet
notify(DEBUG_INFO) << " skipping..." << std::endl;
OSG_DEBUG << " skipping..." << std::endl;
_fin.seekg(size + size % 2, ios::cur);
}
}
@@ -399,7 +399,7 @@ Lwo2::_read_polygons(unsigned long size)
{
// not recognized yet
notify(DEBUG_INFO) << " skipping..." << std::endl;
OSG_DEBUG << " skipping..." << std::endl;
_fin.seekg(size + size % 2, ios::cur);
}
}
@@ -432,7 +432,7 @@ void Lwo2::_read_polygon_tag_mapping(unsigned long size)
{
// not recognized yet
notify(DEBUG_INFO) << " skipping..." << std::endl;
OSG_DEBUG << " skipping..." << std::endl;
_fin.seekg(size + size % 2, ios::cur);
}
}
@@ -449,18 +449,18 @@ void Lwo2::_read_polygons_mapping(unsigned long size)
short dimension = _read_short();
size -= 2;
notify(DEBUG_INFO) << " dimension \t" << dimension << std::endl;
OSG_DEBUG << " dimension \t" << dimension << std::endl;
string name;
_read_string(name);
size -= name.length() + name.length() % 2;
notify(DEBUG_INFO) << " name \t'" << name.c_str() << "'" << std::endl;
OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl;
if (type == tag_TXUV && dimension == 2)
{
notify(DEBUG_INFO) << " polygons mappings:" << endl;
notify(DEBUG_INFO) << "\tpoint\tpolygon\ttexcoord" << endl;
notify(DEBUG_INFO) << "\t=====\t=======\t========" << endl;
OSG_DEBUG << " polygons mappings:" << endl;
OSG_DEBUG << "\tpoint\tpolygon\ttexcoord" << endl;
OSG_DEBUG << "\t=====\t=======\t========" << endl;
int count = size / 12;
@@ -475,7 +475,7 @@ void Lwo2::_read_polygons_mapping(unsigned long size)
u = _read_float();
v = _read_float();
notify(DEBUG_INFO) << " \t" << point_index << "\t" << polygon_index << "\t" << Vec2(u, v) << endl;
OSG_DEBUG << " \t" << point_index << "\t" << polygon_index << "\t" << Vec2(u, v) << endl;
// apply texture coordinates
PointsList& points_list = _current_layer->_polygons[polygon_index];
@@ -492,7 +492,7 @@ void Lwo2::_read_polygons_mapping(unsigned long size)
{
// not recognized yet
notify(DEBUG_INFO) << " skipping..." << std::endl;
OSG_DEBUG << " skipping..." << std::endl;
_fin.seekg(size + size % 2, ios::cur);
}
@@ -505,7 +505,7 @@ Lwo2::_read_image_definition(unsigned long size)
{
unsigned int index = _read_uint();
size -= 4;
notify(DEBUG_INFO) << " index \t" << index << std::endl;
OSG_DEBUG << " index \t" << index << std::endl;
unsigned int type;
while (size > 0)
@@ -531,7 +531,7 @@ Lwo2::_read_image_definition(unsigned long size)
_images[index] = name.c_str();
notify(DEBUG_INFO) << " name \t'" << name.c_str() << "'" << std::endl;
OSG_DEBUG << " name \t'" << name.c_str() << "'" << std::endl;
}
}
@@ -545,12 +545,12 @@ void Lwo2::_read_surface(unsigned long size)
_read_string(surface->name);
size -= surface->name.length() + surface->name.length() % 2;
notify(DEBUG_INFO) << " name \t'" << surface->name.c_str() << "'" << std::endl;
OSG_DEBUG << " name \t'" << surface->name.c_str() << "'" << std::endl;
string source;
_read_string(source);
size -= source.length() + source.length() % 2;
notify(DEBUG_INFO) << " source \t'" << source.c_str() << "'" << std::endl;
OSG_DEBUG << " source \t'" << source.c_str() << "'" << std::endl;
unsigned long current_tag_name;
unsigned short current_tag_size;
@@ -576,13 +576,13 @@ void Lwo2::_read_surface(unsigned long size)
blok_size -= 4;
current_tag_size = _read_short();
blok_size -= 2;
notify(DEBUG_INFO) << " ";
OSG_DEBUG << " ";
_print_tag(current_tag_name, current_tag_size);
if (current_tag_name == tag_IMAG)
{
surface->image_index = _read_short();
notify(DEBUG_INFO) << " image index\t" << surface->image_index << std::endl;
OSG_DEBUG << " image index\t" << surface->image_index << std::endl;
blok_size -= 2;
}
else if (current_tag_name == tag_IMAP)
@@ -595,7 +595,7 @@ void Lwo2::_read_surface(unsigned long size)
string ordinal;
_read_string(ordinal);
imap_size -= ordinal.length() + ordinal.length() % 2;
notify(DEBUG_INFO) << " ordinal \t'" << ordinal.c_str() << "'" << std::endl;
OSG_DEBUG << " ordinal \t'" << ordinal.c_str() << "'" << std::endl;
while(imap_size > 0)
{
@@ -603,7 +603,7 @@ void Lwo2::_read_surface(unsigned long size)
imap_size -= 4;
current_tag_size = _read_short();
imap_size -= 2;
notify(DEBUG_INFO) << " ";
OSG_DEBUG << " ";
_print_tag(current_tag_name, current_tag_size);
_fin.seekg(current_tag_size + current_tag_size % 2, ios::cur);
@@ -623,7 +623,7 @@ void Lwo2::_read_surface(unsigned long size)
float g = _read_float();
float b = _read_float();
surface->color.set(r,g,b);
notify(DEBUG_INFO) << " color \t" << surface->color << std::endl;
OSG_DEBUG << " color \t" << surface->color << std::endl;
current_tag_size -= 12;
size -= 12;
@@ -656,14 +656,14 @@ Lwo2::GenerateGroup( Group& group )
{
osg::Geode* geode = new osg::Geode();
notify(DEBUG_INFO) << "Generate geode for layer " << (*itr).first << std::endl;
OSG_DEBUG << "Generate geode for layer " << (*itr).first << std::endl;
DrawableToTagMapping tag_mapping;
(*itr).second->GenerateGeode(*geode, _tags.size(), tag_mapping);
// assign StateSet for each PTAG group
for (unsigned int i = 0; i < geode->getNumDrawables(); i++)
{
notify(DEBUG_INFO) << " Assigning surface " << _tags[tag_mapping[i]] << " to drawable " << i << std::endl;
OSG_DEBUG << " Assigning surface " << _tags[tag_mapping[i]] << " to drawable " << i << std::endl;
geode->getDrawable(i)->setStateSet(_surfaces[_tags[tag_mapping[i]]]->state_set);
// copy material color to color array of geometry
@@ -702,14 +702,14 @@ Lwo2::_generate_statesets_from_surfaces()
StateSet* state_set = new osg::StateSet;
bool use_blending = false;
notify(DEBUG_INFO) << "\tcreating surface " << (*itr_surf).first << std::endl;
OSG_DEBUG << "\tcreating surface " << (*itr_surf).first << std::endl;
// check if exist texture image for this surface
if (surface->image_index >= 0)
{
osg::ref_ptr<Image> image = osgDB::readRefImageFile(_images[surface->image_index]);
notify(DEBUG_INFO) << "\tloaded image '" << _images[surface->image_index] << "'" << std::endl;
notify(DEBUG_INFO) << "\tresult - " << image << std::endl;
OSG_DEBUG << "\tloaded image '" << _images[surface->image_index] << "'" << std::endl;
OSG_DEBUG << "\tresult - " << image << std::endl;
if (image.valid())
{
// create texture

View File

@@ -41,51 +41,51 @@ Lwo2Layer::~Lwo2Layer()
void
Lwo2Layer::notify(NotifySeverity severity)
{
osg::notify(severity) << "Current layer: " << _number << endl;
osg::notify(severity) << " flags \t" << _flags << endl;
osg::notify(severity) << " pivot \t" << _pivot << endl;
osg::notify(severity) << " name: \t'" << _name.c_str() << "'" << endl;
osg::notify(severity) << " parent:\t" << _parent << endl;
OSG_NOTIFY(severity) << "Current layer: " << _number << endl;
OSG_NOTIFY(severity) << " flags \t" << _flags << endl;
OSG_NOTIFY(severity) << " pivot \t" << _pivot << endl;
OSG_NOTIFY(severity) << " name: \t'" << _name.c_str() << "'" << endl;
OSG_NOTIFY(severity) << " parent:\t" << _parent << endl;
// points
osg::notify(severity) << " points:\t" << _points.size() << endl;
osg::notify(severity) << "\tcoord\t\t\t\ttexcoord" << endl;
osg::notify(severity) << "\t=====\t\t\t\t========" << endl;
OSG_NOTIFY(severity) << " points:\t" << _points.size() << endl;
OSG_NOTIFY(severity) << "\tcoord\t\t\t\ttexcoord" << endl;
OSG_NOTIFY(severity) << "\t=====\t\t\t\t========" << endl;
IteratorPoint itr;
for (itr = _points.begin(); itr != _points.end(); itr++)
{
osg::notify(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl;
OSG_NOTIFY(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl;
}
// polygons
osg::notify(severity) << " polygons:\t" << _polygons.size() << endl;
osg::notify(severity) << "\tcoord\t\t\t\ttexcoord" << endl;
osg::notify(severity) << "\t=====\t\t\t\t========" << endl;
OSG_NOTIFY(severity) << " polygons:\t" << _polygons.size() << endl;
OSG_NOTIFY(severity) << "\tcoord\t\t\t\ttexcoord" << endl;
OSG_NOTIFY(severity) << "\t=====\t\t\t\t========" << endl;
IteratorPolygonsList polygon_iterator;
int polygon_index = 0;
for (polygon_iterator = _polygons.begin(); polygon_iterator != _polygons.end(); polygon_iterator++, polygon_index++)
{
osg::notify(severity) << " \t" << polygon_index << " ("<< (*polygon_iterator).size() << " vertexes" << "):" << endl;
OSG_NOTIFY(severity) << " \t" << polygon_index << " ("<< (*polygon_iterator).size() << " vertexes" << "):" << endl;
for (itr = (*polygon_iterator).begin(); itr != (*polygon_iterator).end(); itr++)
{
osg::notify(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl;
OSG_NOTIFY(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl;
}
osg::notify(severity) << endl;
OSG_NOTIFY(severity) << endl;
}
// polygons tags
osg::notify(severity) << " polygons tags:\t" << _polygons_tag.size() << endl;
OSG_NOTIFY(severity) << " polygons tags:\t" << _polygons_tag.size() << endl;
IteratorShort short_itr;
for (short_itr = _polygons_tag.begin(); short_itr != _polygons_tag.end(); short_itr++)
{
osg::notify(severity) << "\t" << (*short_itr) << endl;
OSG_NOTIFY(severity) << "\t" << (*short_itr) << endl;
}
}
void
Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping& tag_mapping)
{
notify(DEBUG_INFO);
OSG_DEBUG;
// variable used to track using textures
bool have_texture_coords;
@@ -240,7 +240,7 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping&
geode.addDrawable(geometry.get());
osg::notify(DEBUG_INFO) << " inserting tag " << geode.getNumDrawables() - 1 << ":" << current_tag << std::endl;
OSG_DEBUG << " inserting tag " << geode.getNumDrawables() - 1 << ":" << current_tag << std::endl;
tag_mapping.insert(PairDrawableToTag(geode.getNumDrawables() - 1, current_tag));
}
}
@@ -258,7 +258,7 @@ Lwo2Layer::_find_triangle_fans(PolygonsList& polygons, PolygonsList& triangle_fa
if (triangle_fans.size() > 0)
{
osg::notify(INFO) << "LWO2 loader, optimizing: found " << triangle_fans.size() << " triangle fans" << endl;
OSG_INFO << "LWO2 loader, optimizing: found " << triangle_fans.size() << " triangle fans" << endl;
}
return found;
@@ -276,7 +276,7 @@ Lwo2Layer::_find_triangle_strips(PolygonsList& polygons, PolygonsList& triangle_
if (triangle_strips.size() > 0)
{
osg::notify(INFO) << "LWO2 loader, optimizing: found " << triangle_strips.size() << " triangle strips" << endl;
OSG_INFO << "LWO2 loader, optimizing: found " << triangle_strips.size() << " triangle strips" << endl;
}
return found;