Fixed shadows warnings in lwo plugin

This commit is contained in:
Robert Osfield 2016-05-25 18:12:43 +01:00
parent f268afd044
commit 95d8d7d993
6 changed files with 31 additions and 33 deletions

View File

@ -56,8 +56,8 @@ void Block::compile(const lwo2::FORM::SURF::BLOK *blok)
read_common_attributes(imap->block_attributes);
// read imagemap-related attributes
for (iff::Chunk_list::const_iterator i=blok->attributes.begin(); i!=blok->attributes.end(); ++i) {
const lwo2::FORM::SURF::BLOK::IMAP::TMAP *tmap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::TMAP *>(*i);
for (iff::Chunk_list::const_iterator bi=blok->attributes.begin(); bi!=blok->attributes.end(); ++bi) {
const lwo2::FORM::SURF::BLOK::IMAP::TMAP *tmap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::TMAP *>(*bi);
if (tmap) {
Texture_mapping mapping;
for (iff::Chunk_list::const_iterator i=tmap->attributes.begin(); i!=tmap->attributes.end(); ++i) {
@ -81,43 +81,43 @@ void Block::compile(const lwo2::FORM::SURF::BLOK *blok)
imap_.mapping = mapping;
}
const lwo2::FORM::SURF::BLOK::IMAP::PROJ *proj = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::PROJ *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::PROJ *proj = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::PROJ *>(*bi);
if (proj) {
imap_.projection = static_cast<Image_map::Projection_mode>(proj->projection_mode);
}
const lwo2::FORM::SURF::BLOK::IMAP::AXIS *axis = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::AXIS *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::AXIS *axis = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::AXIS *>(*bi);
if (axis) {
imap_.axis = static_cast<Image_map::Axis_type>(axis->texture_axis);
}
const lwo2::FORM::SURF::BLOK::IMAP::IMAG *imag = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::IMAG *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::IMAG *imag = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::IMAG *>(*bi);
if (imag) {
imap_.image_map = imag->texture_image.index;
}
const lwo2::FORM::SURF::BLOK::IMAP::WRAP *wrap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRAP *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::WRAP *wrap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRAP *>(*bi);
if (wrap) {
imap_.width_wrap = static_cast<Image_map::Wrap_type>(wrap->width_wrap);
imap_.height_wrap = static_cast<Image_map::Wrap_type>(wrap->height_wrap);
}
const lwo2::FORM::SURF::BLOK::IMAP::WRPW *wrpw = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRPW *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::WRPW *wrpw = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRPW *>(*bi);
if (wrpw) {
imap_.wrap_amount_w = wrpw->cycles.fraction;
}
const lwo2::FORM::SURF::BLOK::IMAP::WRPH *wrph = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRPH *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::WRPH *wrph = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::WRPH *>(*bi);
if (wrph) {
imap_.wrap_amount_h = wrph->cycles.fraction;
}
const lwo2::FORM::SURF::BLOK::IMAP::VMAP *vmap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::VMAP *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::VMAP *vmap = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::VMAP *>(*bi);
if (vmap) {
imap_.uv_map = vmap->txuv_map_name;
}
const lwo2::FORM::SURF::BLOK::IMAP::TAMP *tamp = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::TAMP *>(*i);
const lwo2::FORM::SURF::BLOK::IMAP::TAMP *tamp = dynamic_cast<const lwo2::FORM::SURF::BLOK::IMAP::TAMP *>(*bi);
if (tamp) {
imap_.texture_amplitude = tamp->amplitude.fraction;
}

View File

@ -106,9 +106,9 @@ void Object::parse(const iff::Chunk_list &data)
Layer current_layer;
for (iff::Chunk_list::const_iterator i=data.begin(); i!=data.end(); ++i) {
for (iff::Chunk_list::const_iterator di=data.begin(); di!=data.end(); ++di) {
const lwo2::FORM::LAYR *layr = dynamic_cast<const lwo2::FORM::LAYR *>(*i);
const lwo2::FORM::LAYR *layr = dynamic_cast<const lwo2::FORM::LAYR *>(*di);
if (layr) {
if (!current_layer.units().empty() || current_layer.get_layer_chunk()) {
layers_[current_layer.number()] = current_layer;
@ -117,7 +117,7 @@ void Object::parse(const iff::Chunk_list &data)
current_layer.units().clear();
}
const lwo2::FORM::PNTS *pnts = dynamic_cast<const lwo2::FORM::PNTS *>(*i);
const lwo2::FORM::PNTS *pnts = dynamic_cast<const lwo2::FORM::PNTS *>(*di);
if (pnts) {
Unit new_unit;
for (lwo2::FORM::PNTS::Point_list::const_iterator i=pnts->point_location.begin(); i!=pnts->point_location.end(); ++i) {
@ -127,7 +127,7 @@ void Object::parse(const iff::Chunk_list &data)
current_layer.units().push_back(new_unit);
}
const lwo2::FORM::VMAP *vmap = dynamic_cast<const lwo2::FORM::VMAP *>(*i);
const lwo2::FORM::VMAP *vmap = dynamic_cast<const lwo2::FORM::VMAP *>(*di);
if (vmap && !current_layer.units().empty()) {
std::string type(vmap->type.id, 4);
if (type == "WGHT") {
@ -202,7 +202,7 @@ void Object::parse(const iff::Chunk_list &data)
}
}
const lwo2::FORM::POLS *pols = dynamic_cast<const lwo2::FORM::POLS *>(*i);
const lwo2::FORM::POLS *pols = dynamic_cast<const lwo2::FORM::POLS *>(*di);
if (pols && !current_layer.units().empty()) {
std::string type(pols->type.id, 4);
if (type != "FACE") {
@ -240,12 +240,12 @@ void Object::parse(const iff::Chunk_list &data)
}
}
const lwo2::FORM::TAGS *tags = dynamic_cast<const lwo2::FORM::TAGS *>(*i);
const lwo2::FORM::TAGS *tags = dynamic_cast<const lwo2::FORM::TAGS *>(*di);
if (tags) {
tag_strings = tags->tag_string;
}
const lwo2::FORM::PTAG *ptag = dynamic_cast<const lwo2::FORM::PTAG *>(*i);
const lwo2::FORM::PTAG *ptag = dynamic_cast<const lwo2::FORM::PTAG *>(*di);
if (ptag && !current_layer.units().empty()) {
std::string type(ptag->type.id, 4);
if (type == "SURF") {
@ -265,7 +265,7 @@ void Object::parse(const iff::Chunk_list &data)
}
}
const lwo2::FORM::VMAD *vmad = dynamic_cast<const lwo2::FORM::VMAD *>(*i);
const lwo2::FORM::VMAD *vmad = dynamic_cast<const lwo2::FORM::VMAD *>(*di);
if (vmad && !current_layer.units().empty()) {
std::string type(vmad->type.id, 4);
if (type == "WGHT") {
@ -310,12 +310,12 @@ void Object::parse(const iff::Chunk_list &data)
}
}
const lwo2::FORM::DESC *desc = dynamic_cast<const lwo2::FORM::DESC *>(*i);
const lwo2::FORM::DESC *desc = dynamic_cast<const lwo2::FORM::DESC *>(*di);
if (desc) {
description_ = desc->description_line;
}
const lwo2::FORM::TEXT *text = dynamic_cast<const lwo2::FORM::TEXT *>(*i);
const lwo2::FORM::TEXT *text = dynamic_cast<const lwo2::FORM::TEXT *>(*di);
if (text) {
comment_ = text->comment;
}
@ -338,13 +338,13 @@ void Object::generate_normals()
void Object::generate_auto_texture_maps()
{
for (Surface_map::iterator i=surfaces_.begin(); i!=surfaces_.end(); ++i) {
for (Surface::Block_map::iterator j=i->second.blocks().begin(); j!=i->second.blocks().end(); ++j) {
for (Surface_map::iterator si=surfaces_.begin(); si!=surfaces_.end(); ++si) {
for (Surface::Block_map::iterator j=si->second.blocks().begin(); j!=si->second.blocks().end(); ++j) {
Block &block = j->second;
if (block.get_type() == "IMAP") {
if (block.get_image_map().projection == Image_map::UV) continue;
Image_map::Axis_type axis = block.get_image_map().axis;
Image_map::Axis_type image_axis = block.get_image_map().axis;
std::ostringstream oss;
oss << "Auto_map_" << &block;
@ -416,7 +416,7 @@ void Object::generate_auto_texture_maps()
osg::Vec2 uv;
if (block.get_image_map().projection == Image_map::PLANAR) {
switch (axis) {
switch (image_axis) {
case Image_map::X: uv.set(P.z(), P.y()); break;
case Image_map::Y: uv.set(P.x(), P.z()); break;
case Image_map::Z: uv.set(P.x(), P.y()); break;
@ -426,7 +426,7 @@ void Object::generate_auto_texture_maps()
}
if (block.get_image_map().projection == Image_map::CYLINDRICAL) {
switch (axis) {
switch (image_axis) {
case Image_map::X: uv.set(cylindrical_angle(-P.z(), -P.y()), P.x()); break;
case Image_map::Y: uv.set(cylindrical_angle(P.x(), P.z()), P.y()); break;
case Image_map::Z: uv.set(cylindrical_angle(P.x(), -P.y()), P.z()); break;
@ -439,7 +439,7 @@ void Object::generate_auto_texture_maps()
if (block.get_image_map().projection == Image_map::SPHERICAL) {
float r = P.length();
if (r != 0) {
switch (axis) {
switch (image_axis) {
case Image_map::X: uv.set(cylindrical_angle(-P.z(), -P.y()), (asinf(P.x()/r) + osg::PI_2) / osg::PI); break;
case Image_map::Y: uv.set(cylindrical_angle(P.x(), P.z()), (asinf(P.y()/r) + osg::PI_2) / osg::PI); break;
case Image_map::Z: uv.set(cylindrical_angle(P.x(), -P.y()), (asinf(P.z()/r) + osg::PI_2) / osg::PI); break;

View File

@ -73,7 +73,7 @@ public:
if (result.success()) return result;
if (!options || options->getOptionString() != "USE_OLD_READER") {
ReadResult result = readNode_LWO2(fileName, local_opt.get());
result = readNode_LWO2(fileName, local_opt.get());
if (result.success()) return result;
}

View File

@ -288,8 +288,8 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps
geo->setStateSet(stateset_.get());
int unit = 0;
for (Block_map::const_iterator i=blocks_.begin(); i!=blocks_.end(); ++i) {
const Block &block = i->second;
for (Block_map::const_iterator bi=blocks_.begin(); bi!=blocks_.end(); ++bi) {
const Block &block = bi->second;
if (block.get_type() == "IMAP" && block.get_channel() == "COLR" && block.get_image_map().clip) {
std::string image_file = block.get_image_map().clip->get_still_filename();
if (!image_file.empty()) {

View File

@ -105,8 +105,6 @@ void Unit::flatten_maps()
flatten_map(*i, i->local_normals(), normals_.get());
i->local_normals()->clear();
VertexMap_map::const_iterator j;
// flatten weight maps
while (!i->weight_maps()->empty()) {
VertexMap_map::iterator j = i->weight_maps()->begin();

View File

@ -317,7 +317,7 @@ Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fan
c = d;
while ((next_polygon_index = _find_triangle_begins_with(polygons, a, c)) >= 0)
{
PointData d = polygons[next_polygon_index][2];
d = polygons[next_polygon_index][2];
point_list.push_back(d);
// delete next triangle (mark as deleted)
@ -374,7 +374,7 @@ Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_s
while ((next_polygon_index = _find_triangle_begins_with(polygons, strip_a, strip_b)) >= 0)
{
PointData d = polygons[next_polygon_index][2];
d = polygons[next_polygon_index][2];
point_list.push_back(d);
if (current_strip_a)