From 572a146c242cb3a8451ac8b5e56cc378126a0450 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 13 Jan 2006 18:38:07 +0000 Subject: [PATCH] untabify --- direct/src/dcparse/dcparse.cxx | 10 +- direct/src/dcparser/dcClass.cxx | 20 +- direct/src/dcparser/dcParser.yxx | 232 ++++---- .../src/distributed/cConnectionRepository.cxx | 58 +- direct/src/distributed/config_distributed.cxx | 4 +- dtool/src/cppparser/cppBison.yxx | 2 +- dtool/src/dtoolbase/ptmalloc2_smp.c | 394 +++++++------- dtool/src/dtoolutil/executionEnvironment.cxx | 2 +- dtool/src/dtoolutil/filename.cxx | 6 +- .../interfaceMakerPythonNative.cxx | 228 ++++---- dtool/src/interrogatedb/py_panda.cxx | 20 +- dtool/src/interrogatedb/py_panda.h | 138 ++--- dtool/src/prc/configPageManager.cxx | 36 +- panda/src/display/graphicsOutput.h | 6 +- panda/src/display/graphicsWindow.cxx | 6 +- panda/src/downloader/httpChannel.cxx | 2 +- panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx | 30 +- panda/src/dxgsg7/dxTextureContext7.cxx | 2 +- panda/src/dxgsg8/dxGeomMunger8.cxx | 2 +- panda/src/dxgsg8/wdxGraphicsWindow8.cxx | 40 +- panda/src/egg/eggGroupNode.cxx | 2 +- panda/src/egg/eggTexture.cxx | 14 +- panda/src/egg/parser.yxx | 12 +- panda/src/egg2pg/eggLoader.cxx | 18 +- panda/src/express/patchfile.cxx | 24 +- panda/src/express/trueClock.cxx | 76 +-- .../glstuff/glGraphicsStateGuardian_src.cxx | 34 +- panda/src/glstuff/glmisc_src.cxx | 8 +- panda/src/glstuff/panda_glext.h | 6 +- panda/src/glxdisplay/glxext.h | 16 +- panda/src/gobj/config_gobj.cxx | 14 +- panda/src/gobj/texturePool.cxx | 24 +- panda/src/gobj/videoTexture.I | 2 +- panda/src/gobj/videoTexture.h | 2 +- panda/src/grutil/openCVTexture.cxx | 112 ++-- panda/src/grutil/openCVTexture.h | 8 +- panda/src/linmath/compose_matrix_src.I | 2 +- panda/src/mathutil/perlinNoise2.I | 2 +- panda/src/mathutil/perlinNoise2.cxx | 2 +- panda/src/mathutil/perlinNoise2.h | 4 +- panda/src/mathutil/perlinNoise3.I | 2 +- panda/src/mathutil/perlinNoise3.cxx | 10 +- panda/src/mathutil/perlinNoise3.h | 2 +- panda/src/parametrics/parametricCurve.cxx | 14 +- panda/src/parametrics/parametricCurve.h | 4 +- .../particlesystem/spriteParticleRenderer.I | 2 +- panda/src/pgraph/cullTraverser.cxx | 30 +- panda/src/pgraph/cullableObject.cxx | 320 +++++------ panda/src/pgraph/lightAttrib.cxx | 2 +- panda/src/pgraph/loader.h | 2 +- panda/src/pgraph/nodePath.cxx | 14 +- panda/src/pgraph/nodePath.h | 2 +- panda/src/pgraph/nodePathLerps.h | 14 +- panda/src/pgraph/sequenceNode.h | 2 +- panda/src/pgraph/texGenAttrib.cxx | 16 +- panda/src/pgraph/textureAttrib.cxx | 2 +- panda/src/pgraph/transformState.cxx | 4 +- panda/src/pgui/pgFrameStyle.cxx | 2 +- panda/src/pgui/pgFrameStyle.h | 2 +- panda/src/pnmimage/pnmImage.cxx | 2 +- panda/src/pnmimage/pnmImage.h | 4 +- panda/src/pnmimage/pnmImageHeader.cxx | 6 +- panda/src/pnmimage/pnmImageHeader.h | 4 +- .../pnmimagetypes/pnmFileTypeJPGReader.cxx | 18 +- .../pnmimagetypes/pnmFileTypeJPGWriter.cxx | 12 +- panda/src/putil/animInterface.cxx | 4 +- panda/src/putil/bamReader.cxx | 58 +- panda/src/putil/test_uniqueIdAllocator.cxx | 58 +- panda/src/testbed/pview.cxx | 14 +- panda/src/text/config_text.cxx | 74 +-- panda/src/text/dynamicTextGlyph.h | 4 +- panda/src/text/dynamicTextPage.cxx | 2 +- panda/src/text/dynamicTextPage.h | 2 +- panda/src/text/geomTextGlyph.cxx | 2 +- panda/src/text/geomTextGlyph.h | 2 +- panda/src/text/textGlyph.I | 2 +- panda/src/text/textGlyph.h | 2 +- panda/src/tform/buttonThrower.cxx | 6 +- panda/src/tform/buttonThrower.h | 2 +- panda/src/tform/mouseWatcher.cxx | 22 +- panda/src/windisplay/winGraphicsWindow.cxx | 6 +- pandaapp/src/indexify/fontSamples.cxx | 26 +- pandaapp/src/indexify/indexImage.cxx | 58 +- pandaapp/src/indexify/indexImage.h | 8 +- pandaapp/src/indexify/indexParameters.cxx | 8 +- pandaapp/src/indexify/indexParameters.h | 2 +- pandaapp/src/indexify/indexify.cxx | 118 ++-- pandaapp/src/indexify/photo.cxx | 2 +- pandaapp/src/indexify/rollDirectory.cxx | 72 +-- pandaapp/src/indexify/rollDirectory.h | 12 +- pandaapp/src/stitchbase/stitchParser.yxx | 2 +- pandatool/src/dxf/dxfFile.cxx | 92 ++-- pandatool/src/dxf/dxfFile.h | 2 +- pandatool/src/dxf/dxfLayer.h | 2 +- pandatool/src/dxf/dxfLayerMap.h | 2 +- pandatool/src/dxf/dxfVertex.h | 2 +- pandatool/src/dxfegg/dxfToEggLayer.h | 2 +- pandatool/src/dxfprogs/eggToDXFLayer.cxx | 26 +- pandatool/src/egg-qtess/eggQtess.cxx | 2 +- pandatool/src/egg-qtess/isoPlacer.cxx | 48 +- pandatool/src/egg-qtess/qtessInputEntry.cxx | 118 ++-- pandatool/src/egg-qtess/qtessInputFile.cxx | 214 ++++---- pandatool/src/egg-qtess/qtessSurface.cxx | 28 +- pandatool/src/egg-qtess/subdivSegment.cxx | 4 +- pandatool/src/eggbase/eggWriter.cxx | 4 +- pandatool/src/flt/fltHeader.h | 2 +- pandatool/src/fltegg/fltToEggConverter.cxx | 2 +- pandatool/src/imageprogs/imageTrans.cxx | 26 +- .../src/lwo/lwoDiscontinuousVertexMap.cxx | 14 +- pandatool/src/maxegg/maxDllEntry.cxx | 48 +- pandatool/src/maxegg/maxEgg.cxx | 28 +- pandatool/src/maxegg/maxEgg.h | 4 +- pandatool/src/maxegg/maxEggExpOptions.cxx | 44 +- pandatool/src/maxegg/maxEggExpOptions.h | 4 +- pandatool/src/maxegg/maxLogger.cxx | 504 +++++++++--------- pandatool/src/maxegg/maxLogger.h | 154 +++--- pandatool/src/maxegg/maxNodeDesc.h | 4 +- pandatool/src/maxegg/maxNodeTree.cxx | 12 +- pandatool/src/maxegg/maxToEgg.cxx | 12 +- pandatool/src/maxegg/maxToEggConverter.cxx | 326 +++++------ pandatool/src/maxegg/maxToEggConverter.h | 2 +- pandatool/src/maxeggimport/maxEggImport.cxx | 6 +- pandatool/src/maxprogs/maxEggImport.cxx | 6 +- pandatool/src/mayaegg/mayaNodeDesc.cxx | 4 +- pandatool/src/mayaprogs/mayaEggImport.cxx | 2 +- pandatool/src/ptloader/config_ptloader.cxx | 4 +- pandatool/src/softegg/soft2Egg.c | 66 +-- pandatool/src/vrml/vrml2egg.cxx | 86 +-- pandatool/src/vrml/vrml2egg.h | 20 +- pandatool/src/vrml/vrmlLexer.lxx | 2 +- pandatool/src/vrml/vrmlNodeType.cxx | 36 +- pandatool/src/vrml/vrmlNodeType.h | 2 +- pandatool/src/vrml/vrmlParser.yxx | 18 +- pandatool/src/vrmlegg/indexedFaceSet.cxx | 342 ++++++------ pandatool/src/vrmlegg/indexedFaceSet.h | 8 +- pandatool/src/vrmlegg/vrmlAppearance.cxx | 10 +- pandatool/src/vrmlegg/vrmlToEggConverter.cxx | 50 +- pandatool/src/xfile/xParser.yxx | 42 +- 138 files changed, 2558 insertions(+), 2558 deletions(-) diff --git a/direct/src/dcparse/dcparse.cxx b/direct/src/dcparse/dcparse.cxx index 8521ae3608..51fae3f565 100644 --- a/direct/src/dcparse/dcparse.cxx +++ b/direct/src/dcparse/dcparse.cxx @@ -68,7 +68,7 @@ help() { void write_class_hierarchy(int indent_level, const DCFile &file, - const DCClass *this_dclass) { + const DCClass *this_dclass) { indent(cout, indent_level) << this_dclass->get_name() << "\n"; @@ -110,13 +110,13 @@ write_complete_field_list(const DCFile &file) { const DCField *field = dclass->get_inherited_field(j); cout << " "; if (field->get_class() != dclass) { - cout << field->get_class()->get_name() << "::"; + cout << field->get_class()->get_name() << "::"; } cout << field->get_name(); if (field->as_atomic_field() != (DCAtomicField *)NULL || - field->as_molecular_field() != (DCMolecularField *)NULL) { - // It's a "method". - cout << "()"; + field->as_molecular_field() != (DCMolecularField *)NULL) { + // It's a "method". + cout << "()"; } field->output_keywords(cout); cout << "\n"; diff --git a/direct/src/dcparser/dcClass.cxx b/direct/src/dcparser/dcClass.cxx index 9c8dc42a9e..20b81b2eb9 100644 --- a/direct/src/dcparser/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -44,9 +44,9 @@ ConfigVariableBool dc_multiple_inheritance ConfigVariableBool dc_virtual_inheritance ("dc-virtual-inheritance", true, PRC_DESC("Set this true to support proper virtual inheritance in the " - "dc file, so that diamond-of-death type constructs can be used. " - "This also enables shadowing (overloading) of inherited method " - "names from a base class.")); + "dc file, so that diamond-of-death type constructs can be used. " + "This also enables shadowing (overloading) of inherited method " + "names from a base class.")); #endif // WITHIN_PANDA @@ -323,7 +323,7 @@ get_inherited_field(int n) const { for (pi = _parents.begin(); pi != _parents.end(); ++pi) { int psize = (*pi)->get_num_inherited_fields(); if (n < psize) { - return (*pi)->get_inherited_field(n); + return (*pi)->get_inherited_field(n); } n -= psize; @@ -528,7 +528,7 @@ receive_update_broadcast_required(PyObject *distobj, DatagramIterator &di) const //////////////////////////////////////////////////////////////////// void DCClass:: receive_update_broadcast_required_owner(PyObject *distobj, - DatagramIterator &di) const { + DatagramIterator &di) const { #ifdef WITHIN_PANDA PStatTimer timer(((DCClass *)this)->_class_update_pcollector); #endif @@ -542,14 +542,14 @@ receive_update_broadcast_required_owner(PyObject *distobj, field->is_required()) { packer.begin_unpack(field); if (field->is_ownrecv()) { - field->receive_update(packer, distobj); + field->receive_update(packer, distobj); } else { - // It's not an ownrecv field; skip over it. It's difficult - // to filter this on the server, ask Roger for the reason. - packer.unpack_skip(); + // It's not an ownrecv field; skip over it. It's difficult + // to filter this on the server, ask Roger for the reason. + packer.unpack_skip(); } if (!packer.end_unpack()) { - break; + break; } } } diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index 65ac5f7bbd..bbda4e0f25 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -165,13 +165,13 @@ dc_cleanup_parser() { %% grammar: - START_DC dc - | START_PARAMETER_VALUE parameter_value - | START_PARAMETER_DESCRIPTION parameter_description + START_DC dc + | START_PARAMETER_VALUE parameter_value + | START_PARAMETER_DESCRIPTION parameter_description { parameter_description = $2; } - ; + ; dc: empty @@ -200,50 +200,50 @@ dc: slash_identifier: IDENTIFIER - | slash_identifier '/' IDENTIFIER + | slash_identifier '/' IDENTIFIER { $$ = $1 + string("/") + $3; } - ; + ; import_identifier: slash_identifier - | import_identifier '.' slash_identifier + | import_identifier '.' slash_identifier { $$ = $1 + string(".") + $3; } - ; + ; import: - KW_IMPORT import_identifier + KW_IMPORT import_identifier { dc_file->add_import_module($2); } - | KW_FROM import_identifier KW_IMPORT + | KW_FROM import_identifier KW_IMPORT { dc_file->add_import_module($2); } - import_symbol_list_or_star - ; + import_symbol_list_or_star + ; import_symbol_list_or_star: - import_symbol_list - | '*' + import_symbol_list + | '*' { dc_file->add_import_symbol("*"); } - ; + ; import_symbol_list: - slash_identifier + slash_identifier { dc_file->add_import_symbol($1); } - | import_symbol_list ',' slash_identifier + | import_symbol_list ',' slash_identifier { dc_file->add_import_symbol($3); } - ; + ; typedef_decl: KW_TYPEDEF parameter_with_default @@ -261,7 +261,7 @@ typedef_decl: } } } - ; + ; keyword_decl: KW_KEYWORD IDENTIFIER @@ -276,12 +276,12 @@ keyword_decl: // historical hash code support later. ((DCKeyword *)$2)->clear_historical_flag(); } - ; + ; dclass_or_struct: dclass - | struct - ; + | struct + ; dclass: KW_DCLASS optional_name @@ -317,7 +317,7 @@ dclass_name: $$ = dclass; } } - ; + ; dclass_derivation: empty @@ -360,7 +360,7 @@ dclass_fields: ; dclass_field: - atomic_field keyword_list + atomic_field keyword_list { if ($1 != (DCField *)NULL) { if ($1->get_name().empty()) { @@ -370,8 +370,8 @@ dclass_field: } $$ = $1; } - | molecular_field no_keyword_list - | unnamed_parameter_with_default keyword_list + | molecular_field no_keyword_list + | unnamed_parameter_with_default keyword_list { yyerror("Unnamed parameters are not allowed on a dclass"); if ($1 != (DCField *)NULL) { @@ -379,14 +379,14 @@ dclass_field: } $$ = $1; } - | named_parameter_with_default keyword_list + | named_parameter_with_default keyword_list { if ($1 != (DCField *)NULL) { $1->copy_keywords(current_keyword_list); } $$ = $1; } - ; + ; struct: KW_STRUCT optional_name @@ -422,7 +422,7 @@ struct_name: $$ = dstruct; } } - ; + ; struct_derivation: empty @@ -458,23 +458,23 @@ struct_fields: ; struct_field: - atomic_field no_keyword_list + atomic_field no_keyword_list { if ($1->get_name().empty()) { yyerror("Field name required."); } $$ = $1; } - | molecular_field no_keyword_list - | unnamed_parameter_with_default no_keyword_list + | molecular_field no_keyword_list + | unnamed_parameter_with_default no_keyword_list { $$ = $1; } - | named_parameter_with_default no_keyword_list + | named_parameter_with_default no_keyword_list { $$ = $1; } - ; + ; atomic_field: optional_name '(' @@ -512,7 +512,7 @@ atomic_element: current_atomic->add_element($1); } } - ; + ; named_parameter: type_definition @@ -523,15 +523,15 @@ named_parameter: { $$ = $3; } - ; + ; unnamed_parameter: - type_definition - ; + type_definition + ; named_parameter_with_default: named_parameter - | named_parameter '=' + | named_parameter '=' { current_packer = &default_packer; current_packer->clear_data(); @@ -539,7 +539,7 @@ named_parameter_with_default: current_packer->begin_pack($1); } } - parameter_value + parameter_value { bool is_valid = false; if ($1 != (DCField *)NULL) { @@ -557,11 +557,11 @@ named_parameter_with_default: // just ignore the default value in this case. } } - ; + ; unnamed_parameter_with_default: unnamed_parameter - | unnamed_parameter '=' + | unnamed_parameter '=' { current_packer = &default_packer; current_packer->clear_data(); @@ -569,7 +569,7 @@ unnamed_parameter_with_default: current_packer->begin_pack($1); } } - parameter_value + parameter_value { bool is_valid = false; if ($1 != (DCField *)NULL) { @@ -587,7 +587,7 @@ unnamed_parameter_with_default: // just ignore the default value in this case. } } - ; + ; parameter: named_parameter @@ -608,29 +608,29 @@ parameter_or_atomic: { $$ = $1; } - ; + ; parameter_description: - atomic_field no_keyword_list + atomic_field no_keyword_list { $$ = $1; } - | unnamed_parameter_with_default no_keyword_list + | unnamed_parameter_with_default no_keyword_list { $$ = $1; } - | named_parameter_with_default no_keyword_list + | named_parameter_with_default no_keyword_list { $$ = $1; } - ; + ; simple_type_name: - type_token + type_token { $$ = new DCSimpleParameter($1); } - | simple_type_name '(' double_range ')' + | simple_type_name '(' double_range ')' { DCSimpleParameter *simple_param = $1->as_simple_parameter(); nassertr(simple_param != (DCSimpleParameter *)NULL, 0); @@ -667,11 +667,11 @@ simple_type_name: } $$ = simple_param; } - ; + ; type_name: simple_type_name - | IDENTIFIER + | IDENTIFIER { if (dc_file == (DCFile *)NULL) { yyerror("Invalid type."); @@ -703,7 +703,7 @@ type_name: $$ = dtypedef->make_new_parameter(); } } - | struct + | struct { // This is an inline struct definition. if ($1 == (DCClass *)NULL) { @@ -719,7 +719,7 @@ type_name: $$ = new DCClassParameter($1); } } - | switch + | switch { // This is an inline switch definition. if ($1 == (DCSwitch *)NULL) { @@ -735,28 +735,28 @@ type_name: $$ = new DCSwitchParameter($1); } } - ; + ; double_range: - empty + empty { double_range.clear(); } - | char_or_number + | char_or_number { double_range.clear(); if (!double_range.add_range($1, $1)) { yyerror("Overlapping range"); } } - | char_or_number '-' char_or_number + | char_or_number '-' char_or_number { double_range.clear(); if (!double_range.add_range($1, $3)) { yyerror("Overlapping range"); } } - | char_or_number number + | char_or_number number { double_range.clear(); if ($2 >= 0) { @@ -765,19 +765,19 @@ double_range: yyerror("Overlapping range"); } } - | double_range ',' char_or_number + | double_range ',' char_or_number { if (!double_range.add_range($3, $3)) { yyerror("Overlapping range"); } } - | double_range ',' char_or_number '-' char_or_number + | double_range ',' char_or_number '-' char_or_number { if (!double_range.add_range($3, $5)) { yyerror("Overlapping range"); } } - | double_range ',' char_or_number number + | double_range ',' char_or_number number { if ($4 >= 0) { yyerror("Syntax error"); @@ -785,57 +785,57 @@ double_range: yyerror("Overlapping range"); } } - ; + ; uint_range: - empty + empty { uint_range.clear(); } - | char_or_uint + | char_or_uint { uint_range.clear(); if (!uint_range.add_range($1, $1)) { yyerror("Overlapping range"); } } - | char_or_uint '-' char_or_uint + | char_or_uint '-' char_or_uint { uint_range.clear(); if (!uint_range.add_range($1, $3)) { yyerror("Overlapping range"); } } - | char_or_uint small_negative_integer + | char_or_uint small_negative_integer { uint_range.clear(); if (!uint_range.add_range($1, $2)) { yyerror("Overlapping range"); } } - | uint_range ',' char_or_uint + | uint_range ',' char_or_uint { if (!uint_range.add_range($3, $3)) { yyerror("Overlapping range"); } } - | uint_range ',' char_or_uint '-' char_or_uint + | uint_range ',' char_or_uint '-' char_or_uint { if (!uint_range.add_range($3, $5)) { yyerror("Overlapping range"); } } - | uint_range ',' char_or_uint small_negative_integer + | uint_range ',' char_or_uint small_negative_integer { if (!uint_range.add_range($3, $4)) { yyerror("Overlapping range"); } } - ; + ; type_definition: type_name - | type_definition '[' uint_range ']' + | type_definition '[' uint_range ']' { if ($1 == (DCParameter *)NULL) { $$ = NULL; @@ -843,7 +843,7 @@ type_definition: $$ = $1->append_array_specification(uint_range); } } - ; + ; parameter_definition: IDENTIFIER @@ -881,14 +881,14 @@ parameter_definition: } } } - | parameter_definition '[' uint_range ']' + | parameter_definition '[' uint_range ']' { $$ = $1->append_array_specification(uint_range); } - ; + ; char_or_uint: - STRING + STRING { if ($1.length() != 1) { yyerror("Single character required."); @@ -897,11 +897,11 @@ char_or_uint: $$ = (unsigned char)$1[0]; } } - | small_unsigned_integer - ; + | small_unsigned_integer + ; small_unsigned_integer: - UNSIGNED_INTEGER + UNSIGNED_INTEGER { $$ = (unsigned int)$1; if ($$ != $1) { @@ -909,10 +909,10 @@ small_unsigned_integer: $$ = 1; } } - ; + ; small_negative_integer: - SIGNED_INTEGER + SIGNED_INTEGER { $$ = (unsigned int)-$1; if ($1 >= 0) { @@ -923,30 +923,30 @@ small_negative_integer: $$ = 1; } } - ; + ; signed_integer: SIGNED_INTEGER - ; + ; unsigned_integer: - UNSIGNED_INTEGER - ; + UNSIGNED_INTEGER + ; number: - unsigned_integer + unsigned_integer { $$ = (double)$1; } - | signed_integer + | signed_integer { $$ = (double)$1; } - | REAL - ; + | REAL + ; char_or_number: - STRING + STRING { if ($1.length() != 1) { yyerror("Single character required."); @@ -955,8 +955,8 @@ char_or_number: $$ = (double)(unsigned char)$1[0]; } } - | number - ; + | number + ; parameter_value: @@ -964,7 +964,7 @@ parameter_value: { $$ = $1; } - | IDENTIFIER '=' + | IDENTIFIER '=' { if ($1 != current_packer->get_current_field_name()) { ostringstream strm; @@ -973,18 +973,18 @@ parameter_value: yyerror(strm.str()); } } - parameter_actual_value + parameter_actual_value { $$ = $4; } - ; + ; parameter_actual_value: - signed_integer + signed_integer { current_packer->pack_int64($1); } - | unsigned_integer + | unsigned_integer { current_packer->pack_uint64($1); } @@ -1157,7 +1157,7 @@ keyword_list: { current_keyword_list.add_keyword($2); } - ; + ; no_keyword_list: keyword_list @@ -1166,7 +1166,7 @@ no_keyword_list: yyerror("Communication keywords are not allowed here."); } } - ; + ; molecular_field: IDENTIFIER ':' @@ -1193,7 +1193,7 @@ atomic_name: } } } - ; + ; molecular_atom_list: atomic_name @@ -1220,21 +1220,21 @@ optional_name: { $$ = ""; } - | IDENTIFIER - ; + | IDENTIFIER + ; switch: - KW_SWITCH optional_name '(' parameter_or_atomic ')' '{' + KW_SWITCH optional_name '(' parameter_or_atomic ')' '{' { $$ = current_switch; current_switch = new DCSwitch($2, $4); } - switch_fields '}' + switch_fields '}' { $$ = current_switch; current_switch = (DCSwitch *)$7; } - ; + ; switch_fields: @@ -1256,13 +1256,13 @@ switch_fields: ; switch_case: - KW_CASE + KW_CASE { current_packer = &default_packer; current_packer->clear_data(); current_packer->begin_pack(current_switch->get_key_parameter()); } - parameter_value ':' + parameter_value ':' { if (!current_packer->end_pack()) { yyerror("Invalid value for switch parameter"); @@ -1274,34 +1274,34 @@ switch_case: } } } - ; + ; switch_default: - KW_DEFAULT ':' + KW_DEFAULT ':' { if (!current_switch->add_default()) { yyerror("Default case already defined"); } } - ; + ; switch_break: - KW_BREAK + KW_BREAK { current_switch->add_break(); } - ; + ; switch_field: - unnamed_parameter_with_default + unnamed_parameter_with_default { $$ = $1; } - | named_parameter_with_default + | named_parameter_with_default { $$ = $1; } - ; + ; empty: ; diff --git a/direct/src/distributed/cConnectionRepository.cxx b/direct/src/distributed/cConnectionRepository.cxx index d848b8a900..3dbe46f415 100644 --- a/direct/src/distributed/cConnectionRepository.cxx +++ b/direct/src/distributed/cConnectionRepository.cxx @@ -248,13 +248,13 @@ check_datagram() { case CLIENT_OBJECT_UPDATE_FIELD: case STATESERVER_OBJECT_UPDATE_FIELD: if (_has_owner_view) { - if (!handle_update_field_owner()) { - return false; - } + if (!handle_update_field_owner()) { + return false; + } } else { - if (!handle_update_field()) { - return false; - } + if (!handle_update_field()) { + return false; + } } break; #endif // HAVE_PYTHON @@ -580,20 +580,20 @@ handle_update_field_owner() { int field_id = packer.raw_unpack_uint16(); DCField *field = dclass->get_field_by_index(field_id); if (field->is_ownrecv()) { - // It's a good idea to ensure the reference count to distobjOV is - // raised while we call the update method--otherwise, the update - // method might get into trouble if it tried to delete the - // object from the doId2do map. - Py_INCREF(distobjOV); - // make a copy of the datagram iterator so that we can use the main - // iterator for the non-owner update - DatagramIterator _odi(_di); - dclass->receive_update(distobjOV, _odi); - Py_DECREF(distobjOV); + // It's a good idea to ensure the reference count to distobjOV is + // raised while we call the update method--otherwise, the update + // method might get into trouble if it tried to delete the + // object from the doId2do map. + Py_INCREF(distobjOV); + // make a copy of the datagram iterator so that we can use the main + // iterator for the non-owner update + DatagramIterator _odi(_di); + dclass->receive_update(distobjOV, _odi); + Py_DECREF(distobjOV); - if (PyErr_Occurred()) { - return false; - } + if (PyErr_Occurred()) { + return false; + } } } @@ -619,17 +619,17 @@ handle_update_field_owner() { int field_id = packer.raw_unpack_uint16(); DCField *field = dclass->get_field_by_index(field_id); if (true) {//field->is_broadcast()) { - // It's a good idea to ensure the reference count to distobj is - // raised while we call the update method--otherwise, the update - // method might get into trouble if it tried to delete the - // object from the doId2do map. - Py_INCREF(distobj); - dclass->receive_update(distobj, _di); - Py_DECREF(distobj); + // It's a good idea to ensure the reference count to distobj is + // raised while we call the update method--otherwise, the update + // method might get into trouble if it tried to delete the + // object from the doId2do map. + Py_INCREF(distobj); + dclass->receive_update(distobj, _di); + Py_DECREF(distobj); - if (PyErr_Occurred()) { - return false; - } + if (PyErr_Occurred()) { + return false; + } } } diff --git a/direct/src/distributed/config_distributed.cxx b/direct/src/distributed/config_distributed.cxx index e40ff3f375..52348eee23 100644 --- a/direct/src/distributed/config_distributed.cxx +++ b/direct/src/distributed/config_distributed.cxx @@ -36,13 +36,13 @@ ConfigVariableDouble min_lag ("min-lag", 0.0, PRC_DESC("This represents the time in seconds by which to artificially lag " "inbound messages. It is useful to test a game's tolerance of " - "network latency.")); + "network latency.")); ConfigVariableDouble max_lag ("max-lag", 0.0, PRC_DESC("This represents the time in seconds by which to artificially lag " "inbound messages. It is useful to test a game's tolerance of " - "network latency.")); + "network latency.")); //////////////////////////////////////////////////////////////////// // Function: init_libdistributed diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index 702ce929d8..bfdd92acda 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -1346,7 +1346,7 @@ formal_parameter: $$ = new CPPInstance($2, $3, 0, @3.file); $$->set_initializer($4); } - | formal_const_expr + | formal_const_expr { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_parameter)); diff --git a/dtool/src/dtoolbase/ptmalloc2_smp.c b/dtool/src/dtoolbase/ptmalloc2_smp.c index 676eb6aadd..754edda455 100644 --- a/dtool/src/dtoolbase/ptmalloc2_smp.c +++ b/dtool/src/dtoolbase/ptmalloc2_smp.c @@ -208,14 +208,14 @@ Configuration and functionality options: USE_DL_PREFIX NOT defined - PTMALLOC_IN_CPPNAMESPACE NOT defined + PTMALLOC_IN_CPPNAMESPACE NOT defined USE_PUBLIC_MALLOC_WRAPPERS NOT defined MALLOC_DEBUG NOT defined REALLOC_ZERO_BYTES_FREES 1 MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op TRIM_FASTBINS 0 FIRST_SORTED_BIN_SIZE 512 - MORECORE_IS_MMAP NOT defined + MORECORE_IS_MMAP NOT defined Options for customizing MORECORE: @@ -250,24 +250,24 @@ typedef pthread_t thread_id; /* mutex */ -typedef pthread_mutex_t mutex_t; +typedef pthread_mutex_t mutex_t; -#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER /* Even if not linking with libpthread, ensure usability of mutex as an `in use' flag, see also the NO_THREADS case below. Assume pthread_mutex_t is at least one int wide. */ -#define mutex_init(m) \ +#define mutex_init(m) \ (__pthread_mutex_init != NULL \ ? __pthread_mutex_init (m, NULL) : (*(int *)(m) = 0)) -#define mutex_lock(m) \ +#define mutex_lock(m) \ (__pthread_mutex_lock != NULL \ ? __pthread_mutex_lock (m) : ((*(int *)(m) = 1), 0)) -#define mutex_trylock(m) \ +#define mutex_trylock(m) \ (__pthread_mutex_trylock != NULL \ ? __pthread_mutex_trylock (m) : (*(int *)(m) ? 1 : ((*(int *)(m) = 1), 0))) -#define mutex_unlock(m) \ +#define mutex_unlock(m) \ (__pthread_mutex_unlock != NULL \ ? __pthread_mutex_unlock (m) : (*(int*)(m) = 0)) @@ -314,11 +314,11 @@ typedef pthread_mutex_t mutex_t; #include -typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */ -__libc_tsd_define (, MALLOC) /* declaration/common definition */ -#define tsd_key_create(key, destr) ((void) (key)) -#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data)) -#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC)) +typedef int tsd_key_t[1]; /* no key data structure, libc magic does it */ +__libc_tsd_define (, MALLOC) /* declaration/common definition */ +#define tsd_key_create(key, destr) ((void) (key)) +#define tsd_setspecific(key, data) __libc_tsd_set (MALLOC, (data)) +#define tsd_getspecific(key, vptr) ((vptr) = __libc_tsd_get (MALLOC)) #endif @@ -1891,17 +1891,17 @@ int __posix_memalign(void **, size_t, size_t); to help it optimize the function calls. But this works only with gcc 2.8.x and egcs. */ # if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8) -# define __THROW throw () +# define __THROW throw () # else # define __THROW # endif -# define __MALLOC_P(args) args __THROW +# define __MALLOC_P(args) args __THROW /* This macro will be used for functions which might take C++ callback functions. */ -# define __MALLOC_PMT(args) args +# define __MALLOC_PMT(args) args -#else /* Not GCC. */ +#else /* Not GCC. */ # ifdef __cplusplus # define __THROW throw() @@ -1913,23 +1913,23 @@ int __posix_memalign(void **, size_t, size_t); # if (defined __STDC__ && __STDC__) || defined __cplusplus -# define __MALLOC_P(args) args __THROW -# define __MALLOC_PMT(args) args +# define __MALLOC_P(args) args __THROW +# define __MALLOC_PMT(args) args -# else /* Not ANSI C or C++. */ +# else /* Not ANSI C or C++. */ -# define __MALLOC_P(args) () /* No prototypes. */ -# define __MALLOC_PMT(args) () +# define __MALLOC_P(args) () /* No prototypes. */ +# define __MALLOC_PMT(args) () -# endif /* ANSI C or C++. */ +# endif /* ANSI C or C++. */ -#endif /* GCC. */ +#endif /* GCC. */ #ifndef NULL # ifdef __cplusplus -# define NULL 0 +# define NULL 0 # else -# define NULL ((__malloc_ptr_t) 0) +# define NULL ((__malloc_ptr_t) 0) # endif #endif @@ -1943,16 +1943,16 @@ extern struct mallinfo mallinfo __MALLOC_P ((void)); /* SVID2/XPG mallopt options */ #ifndef M_MXFAST -# define M_MXFAST 1 /* maximum request size for "fastbins" */ +# define M_MXFAST 1 /* maximum request size for "fastbins" */ #endif #ifndef M_NLBLKS -# define M_NLBLKS 2 /* UNUSED in this malloc */ +# define M_NLBLKS 2 /* UNUSED in this malloc */ #endif #ifndef M_GRAIN -# define M_GRAIN 3 /* UNUSED in this malloc */ +# define M_GRAIN 3 /* UNUSED in this malloc */ #endif #ifndef M_KEEP -# define M_KEEP 4 /* UNUSED in this malloc */ +# define M_KEEP 4 /* UNUSED in this malloc */ #endif /* mallopt options that actually do something */ @@ -1989,15 +1989,15 @@ extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr)); extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void)); /* Hooks for debugging and user-defined versions. */ extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr, - __const __malloc_ptr_t)); + __const __malloc_ptr_t)); extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size, - __const __malloc_ptr_t)); + __const __malloc_ptr_t)); extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr, - size_t __size, - __const __malloc_ptr_t)); + size_t __size, + __const __malloc_ptr_t)); extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment, - size_t __size, - __const __malloc_ptr_t)); + size_t __size, + __const __malloc_ptr_t)); extern void (*__after_morecore_hook) __MALLOC_PMT ((void)); /* Activate a standard set of debugging hooks. */ @@ -2011,10 +2011,10 @@ extern mstate _int_new_arena __MALLOC_P ((size_t __ini_size)); extern __malloc_ptr_t _int_malloc __MALLOC_P ((mstate __m, size_t __size)); extern void _int_free __MALLOC_P ((mstate __m, __malloc_ptr_t __ptr)); extern __malloc_ptr_t _int_realloc __MALLOC_P ((mstate __m, - __malloc_ptr_t __ptr, - size_t __size)); + __malloc_ptr_t __ptr, + size_t __size)); extern __malloc_ptr_t _int_memalign __MALLOC_P ((mstate __m, size_t __alignment, - size_t __size)); + size_t __size)); #if defined(__cplusplus) && !defined(PTMALLOC_IN_CPPNAMESPACE) }; /* end of extern "C" */ @@ -2079,9 +2079,9 @@ static mchunkptr internal_function mremap_chunk(mchunkptr p, size_t new_size); static Void_t* malloc_check(size_t sz, const Void_t *caller); static void free_check(Void_t* mem, const Void_t *caller); static Void_t* realloc_check(Void_t* oldmem, size_t bytes, - const Void_t *caller); + const Void_t *caller); static Void_t* memalign_check(size_t alignment, size_t bytes, - const Void_t *caller); + const Void_t *caller); #ifndef NO_THREADS static Void_t* malloc_starter(size_t sz, const Void_t *caller); static void free_starter(Void_t* mem, const Void_t *caller); @@ -2582,8 +2582,8 @@ static int largebin_index(unsigned int sz) { #elif defined(_MSC_VER) && defined(_M_IX86) __asm { - bsr eax, [x] - mov [m], eax + bsr eax, [x] + mov [m], eax } #else { @@ -3068,9 +3068,9 @@ int __malloc_initialized = -1; /* atfork support. */ static __malloc_ptr_t (*save_malloc_hook) __MALLOC_P ((size_t __size, - __const __malloc_ptr_t)); + __const __malloc_ptr_t)); static void (*save_free_hook) __MALLOC_P ((__malloc_ptr_t __ptr, - __const __malloc_ptr_t)); + __const __malloc_ptr_t)); static Void_t* save_arena; /* Magic value for the thread-specific arena pointer when @@ -3233,20 +3233,20 @@ next_env_entry (char ***position) while (*current != NULL) { if (__builtin_expect ((*current)[0] == 'M', 0) - && (*current)[1] == 'A' - && (*current)[2] == 'L' - && (*current)[3] == 'L' - && (*current)[4] == 'O' - && (*current)[5] == 'C' - && (*current)[6] == '_') - { - result = &(*current)[7]; + && (*current)[1] == 'A' + && (*current)[2] == 'L' + && (*current)[3] == 'L' + && (*current)[4] == 'O' + && (*current)[5] == 'C' + && (*current)[6] == '_') + { + result = &(*current)[7]; - /* Save current position for next visit. */ - *position = ++current; + /* Save current position for next visit. */ + *position = ++current; - break; - } + break; + } ++current; } @@ -3307,55 +3307,55 @@ ptmalloc_init __MALLOC_P((void)) char *envline; while (__builtin_expect ((envline = next_env_entry (&runp)) != NULL, - 0)) + 0)) { - size_t len = strcspn (envline, "="); + size_t len = strcspn (envline, "="); - if (envline[len] != '=') - /* This is a "MALLOC_" variable at the end of the string - without a '=' character. Ignore it since otherwise we - will access invalid memory below. */ - continue; + if (envline[len] != '=') + /* This is a "MALLOC_" variable at the end of the string + without a '=' character. Ignore it since otherwise we + will access invalid memory below. */ + continue; - switch (len) - { - case 6: - if (memcmp (envline, "CHECK_", 6) == 0) - s = &envline[7]; - break; - case 8: - if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0) - mALLOPt(M_TOP_PAD, atoi(&envline[9])); - break; - case 9: - if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0) - mALLOPt(M_MMAP_MAX, atoi(&envline[10])); - break; - case 15: - if (! secure) - { - if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0) - mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16])); - else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0) - mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16])); - } - break; - default: - break; - } + switch (len) + { + case 6: + if (memcmp (envline, "CHECK_", 6) == 0) + s = &envline[7]; + break; + case 8: + if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0) + mALLOPt(M_TOP_PAD, atoi(&envline[9])); + break; + case 9: + if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0) + mALLOPt(M_MMAP_MAX, atoi(&envline[10])); + break; + case 15: + if (! secure) + { + if (memcmp (envline, "TRIM_THRESHOLD_", 15) == 0) + mALLOPt(M_TRIM_THRESHOLD, atoi(&envline[16])); + else if (memcmp (envline, "MMAP_THRESHOLD_", 15) == 0) + mALLOPt(M_MMAP_THRESHOLD, atoi(&envline[16])); + } + break; + default: + break; + } } } #else if (! secure) { if((s = getenv("MALLOC_TRIM_THRESHOLD_"))) - mALLOPt(M_TRIM_THRESHOLD, atoi(s)); + mALLOPt(M_TRIM_THRESHOLD, atoi(s)); if((s = getenv("MALLOC_TOP_PAD_"))) - mALLOPt(M_TOP_PAD, atoi(s)); + mALLOPt(M_TOP_PAD, atoi(s)); if((s = getenv("MALLOC_MMAP_THRESHOLD_"))) - mALLOPt(M_MMAP_THRESHOLD, atoi(s)); + mALLOPt(M_MMAP_THRESHOLD, atoi(s)); if((s = getenv("MALLOC_MMAP_MAX_"))) - mALLOPt(M_MMAP_MAX, atoi(s)); + mALLOPt(M_MMAP_MAX, atoi(s)); } s = getenv("MALLOC_CHECK_"); #endif @@ -3649,7 +3649,7 @@ _int_new_arena __MALLOC_P((size_t size)) unsigned long misalign; h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT), - mp_.top_pad); + mp_.top_pad); if(!h) { /* Maybe size is too large to fit in a single heap. So, just try to create a minimally-sized arena and let _int_malloc() attempt @@ -3948,7 +3948,7 @@ static void do_check_malloc_state(mstate av) /* A contiguous main_arena is consistent with sbrk_base. */ if (av == &main_arena && contiguous(av)) assert((char*)mp_.sbrk_base + av->system_mem == - (char*)av->top + chunksize(av->top)); + (char*)av->top + chunksize(av->top)); /* properties of fastbins */ @@ -4127,7 +4127,7 @@ memalign_hook_ini(alignment, sz, caller) void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL; void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr, - const __malloc_ptr_t)) = NULL; + const __malloc_ptr_t)) = NULL; __malloc_ptr_t weak_variable (*__malloc_hook) __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini; __malloc_ptr_t weak_variable (*__realloc_hook) @@ -4236,7 +4236,7 @@ mem2chunk_check(mem) Void_t* mem; /* Must be a chunk in conventional heap memory. */ if(chunk_is_mmapped(p) || ( (sz = chunksize(p)), - ((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) ) || + ((char*)p + sz)>=(mp_.sbrk_base+main_arena.system_mem) ) || szprev_size&MALLOC_ALIGN_MASK || (long)prev_chunk(p)<(long)mp_.sbrk_base || @@ -4403,11 +4403,11 @@ realloc_check(oldmem, bytes, caller) { /* Note the extra SIZE_SZ overhead. */ if(oldsize - SIZE_SZ >= nb) - newmem = oldmem; /* do nothing */ + newmem = oldmem; /* do nothing */ else { /* Must alloc, copy, free. */ if (top_check() >= 0) - newmem = _int_malloc(&main_arena, bytes+1); + newmem = _int_malloc(&main_arena, bytes+1); if (newmem) { MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ); munmap_chunk(oldp); @@ -4427,7 +4427,7 @@ realloc_check(oldmem, bytes, caller) oldsize - (2*sizeof(mbinptr)+2*SIZE_SZ+1)); } else if(nb > oldsize+SIZE_SZ) { memset((char*)BOUNDED_N(chunk2mem(newp), bytes) + oldsize, - 0, nb - (oldsize+SIZE_SZ)); + 0, nb - (oldsize+SIZE_SZ)); } #endif #if HAVE_MMAP @@ -4619,23 +4619,23 @@ public_sET_STATe(Void_t* msptr) first(b) = last(b) = b; } else { if(iav[2*i+2]))==i && - largebin_index(chunksize(ms->av[2*i+3]))==i)) { - first(b) = ms->av[2*i+2]; - last(b) = ms->av[2*i+3]; - /* Make sure the links to the bins within the heap are correct. */ - first(b)->bk = b; - last(b)->fd = b; - /* Set bit in binblocks. */ - mark_bin(&main_arena, i); + largebin_index(chunksize(ms->av[2*i+3]))==i)) { + first(b) = ms->av[2*i+2]; + last(b) = ms->av[2*i+3]; + /* Make sure the links to the bins within the heap are correct. */ + first(b)->bk = b; + last(b)->fd = b; + /* Set bit in binblocks. */ + mark_bin(&main_arena, i); } else { - /* Oops, index computation from chunksize must have changed. + /* Oops, index computation from chunksize must have changed. Link the whole list into unsorted_chunks. */ - first(b) = last(b) = b; - b = unsorted_chunks(&main_arena); - ms->av[2*i+2]->bk = b; - ms->av[2*i+3]->fd = b->fd; - b->fd->bk = ms->av[2*i+3]; - b->fd = ms->av[2*i+2]; + first(b) = last(b) = b; + b = unsorted_chunks(&main_arena); + ms->av[2*i+2]->bk = b; + ms->av[2*i+3]->fd = b->fd; + b->fd->bk = ms->av[2*i+3]; + b->fd = ms->av[2*i+2]; } } } @@ -4823,7 +4823,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; assert((old_top == initial_top(av) && old_size == 0) || ((CHUNK_SIZE_T) (old_size) >= MINSIZE && prev_inuse(old_top) && - ((CHUNK_SIZE_T)old_end & pagemask) == 0)); + ((CHUNK_SIZE_T)old_end & pagemask) == 0)); /* Precondition: not enough current space to satisfy nb request */ assert((CHUNK_SIZE_T)(old_size) < (CHUNK_SIZE_T)(nb + MINSIZE)); @@ -4848,7 +4848,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; max_total_mem = mmapped_mem + arena_mem + sbrked_mem; #endif set_head(old_top, (((char *)old_heap + old_heap->size) - (char *)old_top) - | PREV_INUSE); + | PREV_INUSE); } else if ((heap = new_heap(nb + (MINSIZE + sizeof(*heap)), mp_.top_pad))) { /* Use a newly allocated heap. */ @@ -4858,7 +4858,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; arena_mem += heap->size; #if 0 if((CHUNK_SIZE_T)(mmapped_mem + arena_mem + sbrked_mem) > max_total_mem) - max_total_mem = mmapped_mem + arena_mem + sbrked_mem; + max_total_mem = mmapped_mem + arena_mem + sbrked_mem; #endif /* Set up the new top. */ top(av) = chunk_at_offset(heap, sizeof(*heap)); @@ -4866,18 +4866,18 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; /* Setup fencepost and free the old top chunk. */ /* The fencepost takes at least MINSIZE bytes, because it might - become the top chunk again later. Note that a footer is set - up, too, although the chunk is marked in use. */ + become the top chunk again later. Note that a footer is set + up, too, although the chunk is marked in use. */ old_size -= MINSIZE; set_head(chunk_at_offset(old_top, old_size + 2*SIZE_SZ), 0|PREV_INUSE); if (old_size >= MINSIZE) { - set_head(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)|PREV_INUSE); - set_foot(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)); - set_head(old_top, old_size|PREV_INUSE|NON_MAIN_ARENA); - _int_free(av, chunk2mem(old_top)); + set_head(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)|PREV_INUSE); + set_foot(chunk_at_offset(old_top, old_size), (2*SIZE_SZ)); + set_head(old_top, old_size|PREV_INUSE|NON_MAIN_ARENA); + _int_free(av, chunk2mem(old_top)); } else { - set_head(old_top, (old_size + 2*SIZE_SZ)|PREV_INUSE); - set_foot(old_top, (old_size + 2*SIZE_SZ)); + set_head(old_top, (old_size + 2*SIZE_SZ)|PREV_INUSE); + set_foot(old_top, (old_size + 2*SIZE_SZ)); } } @@ -5001,7 +5001,7 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; else { /* Count foreign sbrk as system_mem. */ if (old_size) - av->system_mem += brk - old_end; + av->system_mem += brk - old_end; front_misalign = 0; end_misalign = 0; correction = 0; @@ -5088,9 +5088,9 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av; correction = 0; set_noncontiguous(av); } else - /* Call the `morecore' hook if necessary. */ - if (__after_morecore_hook) - (*__after_morecore_hook) (); + /* Call the `morecore' hook if necessary. */ + if (__after_morecore_hook) + (*__after_morecore_hook) (); } /* handle non-contiguous cases */ @@ -5239,7 +5239,7 @@ static int sYSTRIm(pad, av) size_t pad; mstate av; MORECORE(-extra); /* Call the `morecore' hook if necessary. */ if (__after_morecore_hook) - (*__after_morecore_hook) (); + (*__after_morecore_hook) (); new_brk = (char*)(MORECORE(0)); if (new_brk != (char*)MORECORE_FAILURE) { @@ -5378,7 +5378,7 @@ public_mALLOc(size_t bytes) } else (void)mutex_unlock(&ar_ptr->mutex); assert(!victim || chunk_is_mmapped(mem2chunk(victim)) || - ar_ptr == arena_for_chunk(mem2chunk(victim))); + ar_ptr == arena_for_chunk(mem2chunk(victim))); return victim; } @@ -5435,7 +5435,7 @@ public_rEALLOc(Void_t* oldmem, size_t bytes) Void_t* newp; /* chunk to return */ __malloc_ptr_t (*hook) __MALLOC_P ((__malloc_ptr_t, size_t, - __const __malloc_ptr_t)) = + __const __malloc_ptr_t)) = __realloc_hook; if (hook != NULL) return (*hook)(oldmem, bytes, RETURN_ADDRESS (0)); @@ -5493,7 +5493,7 @@ public_rEALLOc(Void_t* oldmem, size_t bytes) (void)mutex_unlock(&ar_ptr->mutex); assert(!newp || chunk_is_mmapped(mem2chunk(newp)) || - ar_ptr == arena_for_chunk(mem2chunk(newp))); + ar_ptr == arena_for_chunk(mem2chunk(newp))); return newp; } @@ -5504,7 +5504,7 @@ public_mEMALIGn(size_t alignment, size_t bytes) Void_t *p; __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, - __const __malloc_ptr_t)) = + __const __malloc_ptr_t)) = __memalign_hook; if (hook != NULL) return (*hook)(alignment, bytes, RETURN_ADDRESS (0)); @@ -5538,7 +5538,7 @@ public_mEMALIGn(size_t alignment, size_t bytes) } } assert(!p || chunk_is_mmapped(mem2chunk(p)) || - ar_ptr == arena_for_chunk(mem2chunk(p))); + ar_ptr == arena_for_chunk(mem2chunk(p))); return p; } @@ -5623,7 +5623,7 @@ public_cALLOc(size_t n, size_t elem_size) (void)mutex_unlock(&av->mutex); assert(!mem || chunk_is_mmapped(mem2chunk(mem)) || - av == arena_for_chunk(mem2chunk(mem))); + av == arena_for_chunk(mem2chunk(mem))); if (mem == 0) { /* Maybe the failure is due to running out of mmapped areas. */ @@ -5681,12 +5681,12 @@ public_cALLOc(size_t n, size_t elem_size) *(d+3) = 0; *(d+4) = 0; if (nclears > 6) { - *(d+5) = 0; - *(d+6) = 0; - if (nclears > 8) { - *(d+7) = 0; - *(d+8) = 0; - } + *(d+5) = 0; + *(d+6) = 0; + if (nclears > 8) { + *(d+7) = 0; + *(d+8) = 0; + } } } } @@ -5859,7 +5859,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) bck->fd = bin; if (av != &main_arena) - victim->size |= NON_MAIN_ARENA; + victim->size |= NON_MAIN_ARENA; check_malloced_chunk(av, victim, nb); return chunk2mem(victim); } @@ -5923,7 +5923,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) remainder->bk = remainder->fd = unsorted_chunks(av); set_head(victim, nb | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head(remainder, remainder_size | PREV_INUSE); set_foot(remainder, remainder_size); @@ -5939,8 +5939,8 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) if (size == nb) { set_inuse_bit_at_offset(victim, size); - if (av != &main_arena) - victim->size |= NON_MAIN_ARENA; + if (av != &main_arena) + victim->size |= NON_MAIN_ARENA; check_malloced_chunk(av, victim, nb); return chunk2mem(victim); } @@ -5959,7 +5959,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) if (fwd != bck) { /* if smaller than smallest, place first */ - assert((bck->bk->size & NON_MAIN_ARENA) == 0); + assert((bck->bk->size & NON_MAIN_ARENA) == 0); if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(bck->bk->size)) { fwd = bck; bck = bck->bk; @@ -5969,11 +5969,11 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) /* maintain large bins in sorted order */ size |= PREV_INUSE; /* Or with inuse bit to speed comparisons */ - assert((fwd->size & NON_MAIN_ARENA) == 0); - while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size)) { + assert((fwd->size & NON_MAIN_ARENA) == 0); + while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size)) { fwd = fwd->fd; - assert((fwd->size & NON_MAIN_ARENA) == 0); - } + assert((fwd->size & NON_MAIN_ARENA) == 0); + } bck = fwd->bk; } } @@ -6006,9 +6006,9 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) /* Exhaust */ if (remainder_size < MINSIZE) { set_inuse_bit_at_offset(victim, size); - if (av != &main_arena) - victim->size |= NON_MAIN_ARENA; - check_malloced_chunk(av, victim, nb); + if (av != &main_arena) + victim->size |= NON_MAIN_ARENA; + check_malloced_chunk(av, victim, nb); return chunk2mem(victim); } /* Split */ @@ -6016,11 +6016,11 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) remainder = chunk_at_offset(victim, nb); unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder; remainder->bk = remainder->fd = unsorted_chunks(av); - set_head(victim, nb | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + set_head(victim, nb | PREV_INUSE | + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head(remainder, remainder_size | PREV_INUSE); set_foot(remainder, remainder_size); - check_malloced_chunk(av, victim, nb); + check_malloced_chunk(av, victim, nb); return chunk2mem(victim); } } @@ -6090,8 +6090,8 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) /* Exhaust */ if (remainder_size < MINSIZE) { set_inuse_bit_at_offset(victim, size); - if (av != &main_arena) - victim->size |= NON_MAIN_ARENA; + if (av != &main_arena) + victim->size |= NON_MAIN_ARENA; check_malloced_chunk(av, victim, nb); return chunk2mem(victim); } @@ -6107,7 +6107,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) av->last_remainder = remainder; set_head(victim, nb | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head(remainder, remainder_size | PREV_INUSE); set_foot(remainder, remainder_size); check_malloced_chunk(av, victim, nb); @@ -6140,7 +6140,7 @@ _int_malloc __MALLOC_P((mstate av, size_t bytes)) remainder = chunk_at_offset(victim, nb); av->top = remainder; set_head(victim, nb | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head(remainder, remainder_size | PREV_INUSE); check_malloced_chunk(av, victim, nb); @@ -6239,7 +6239,7 @@ _int_free __MALLOC_P((mstate av, Void_t* mem)) unlink(nextchunk, bck, fwd); size += nextsize; } else - clear_inuse_bit_at_offset(nextchunk, 0); + clear_inuse_bit_at_offset(nextchunk, 0); /* Place the chunk in unsorted chunk list. Chunks are @@ -6289,20 +6289,20 @@ _int_free __MALLOC_P((mstate av, Void_t* mem)) if (have_fastchunks(av)) malloc_consolidate(av); - if (av == &main_arena) { + if (av == &main_arena) { #ifndef MORECORE_CANNOT_TRIM if ((CHUNK_SIZE_T)(chunksize(av->top)) >= - (CHUNK_SIZE_T)(mp_.trim_threshold)) - sYSTRIm(mp_.top_pad, av); + (CHUNK_SIZE_T)(mp_.trim_threshold)) + sYSTRIm(mp_.top_pad, av); #endif - } else { - /* Always try heap_trim(), even if the top chunk is not + } else { + /* Always try heap_trim(), even if the top chunk is not large, because the corresponding heap might go away. */ - heap_info *heap = heap_for_ptr(top(av)); + heap_info *heap = heap_for_ptr(top(av)); - assert(heap->ar_ptr == av); - heap_trim(heap, mp_.top_pad); - } + assert(heap->ar_ptr == av); + heap_trim(heap, mp_.top_pad); + } } } @@ -6411,7 +6411,7 @@ static void malloc_consolidate(av) mstate av; size += nextsize; unlink(nextchunk, bck, fwd); } else - clear_inuse_bit_at_offset(nextchunk, 0); + clear_inuse_bit_at_offset(nextchunk, 0); first_unsorted = unsorted_bin->fd; unsorted_bin->fd = p; @@ -6505,7 +6505,7 @@ _int_realloc __MALLOC_P((mstate av, Void_t* oldmem, size_t bytes)) set_head_size(oldp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0)); av->top = chunk_at_offset(oldp, nb); set_head(av->top, (newsize - nb) | PREV_INUSE); - check_inuse_chunk(av, oldp); + check_inuse_chunk(av, oldp); return chunk2mem(oldp); } @@ -6589,7 +6589,7 @@ _int_realloc __MALLOC_P((mstate av, Void_t* oldmem, size_t bytes)) remainder = chunk_at_offset(newp, nb); set_head_size(newp, nb | (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head(remainder, remainder_size | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); /* Mark remainder as inuse so free() won't complain */ set_inuse_bit_at_offset(remainder, remainder_size); _int_free(av, chunk2mem(remainder)); @@ -6742,7 +6742,7 @@ _int_memalign __MALLOC_P((mstate av, size_t alignment, size_t bytes)) /* Otherwise, give back leader, use the rest */ set_head(newp, newsize | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_inuse_bit_at_offset(newp, newsize); set_head_size(p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0)); _int_free(av, chunk2mem(p)); @@ -6759,7 +6759,7 @@ _int_memalign __MALLOC_P((mstate av, size_t alignment, size_t bytes)) remainder_size = size - nb; remainder = chunk_at_offset(p, nb); set_head(remainder, remainder_size | PREV_INUSE | - (av != &main_arena ? NON_MAIN_ARENA : 0)); + (av != &main_arena ? NON_MAIN_ARENA : 0)); set_head_size(p, nb); _int_free(av, chunk2mem(remainder)); } @@ -7220,7 +7220,7 @@ void mSTATs() #if HAVE_MMAP fprintf(stderr, "max mmap regions = %10u\n", (unsigned int)mp_.max_n_mmaps); fprintf(stderr, "max mmap bytes = %10lu\n", - (unsigned long)mp_.max_mmapped_mem); + (unsigned long)mp_.max_mmapped_mem); #endif #if THREAD_STATS fprintf(stderr, "heaps created = %10d\n", stat_n_heaps); @@ -7465,7 +7465,7 @@ int mALLOPt(param_number, value) int param_number; int value; /* Deliberately fails to force use of mmap() */ static void *sbrkfail (long size) { - return MORECORE_FAILURE; + return MORECORE_FAILURE; } #endif @@ -7478,7 +7478,7 @@ static void *sbrkfail (long size) /* Wait for spin lock */ static long slwait (long *sl) { while (InterlockedCompareExchange ((LONG volatile *) sl, 1, 0) != 0) - Sleep (0); + Sleep (0); return 0; } @@ -7547,8 +7547,8 @@ static int region_list_remove (region_list_entry **last) { return TRUE; } -#define CEIL(size,to) (((size)+(to)-1)&~((to)-1)) -#define FLOOR(size,to) ((size)&~((to)-1)) +#define CEIL(size,to) (((size)+(to)-1)&~((to)-1)) +#define FLOOR(size,to) ((size)&~((to)-1)) #define SBRK_SCALE 0 /* #define SBRK_SCALE 1 */ @@ -7610,7 +7610,7 @@ static void *sbrk (long size) { assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); { /* Commit this */ void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size, - MEM_COMMIT, PAGE_READWRITE); + MEM_COMMIT, PAGE_READWRITE); /* Check returned pointer for consistency */ if (base_committed != g_last->top_committed) goto sbrk_exit; @@ -7672,7 +7672,7 @@ static void *sbrk (long size) { assert (0 < reserve_size && reserve_size % g_regionsize == 0); /* Try to reserve this */ base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size, - MEM_RESERVE, PAGE_NOACCESS); + MEM_RESERVE, PAGE_NOACCESS); if (! base_reserved) { int rc = GetLastError (); if (rc != ERROR_INVALID_ADDRESS) @@ -7718,7 +7718,7 @@ static void *sbrk (long size) { assert (0 < commit_size && commit_size % g_pagesize == 0); { /* Commit this */ void *base_committed = VirtualAlloc (g_last->top_committed, commit_size, - MEM_COMMIT, PAGE_READWRITE); + MEM_COMMIT, PAGE_READWRITE); /* Check returned pointer for consistency */ if (base_committed != g_last->top_committed) goto sbrk_exit; @@ -7955,13 +7955,13 @@ static int mprotect(const void *addr, long len, int prot) else if(prot & PROT_WRITE) ntprot|=PAGE_READWRITE; else ntprot|=PAGE_NOACCESS; if(prot) - { /* Do we need to commit any? */ + { /* Do we need to commit any? */ MEMORY_BASIC_INFORMATION mbi; DWORD read=0; for(; read nedprod.com) - * Merged Wolfram Gloger's SMP changes in with Doug Lea's v2.7.2 version - * Copy & pasted Gloger's external C file includes directly into this file - * Made various adjustments to let this compile as C++ & PTMALLOC_IN_CPPNAMESPACE - * Merged back in Win32 support, added MORECORE_IS_MMAP - * Added Win32 emulation of mprotect() plus made mmap() set page protection - correctly. No longer always commits arenas, now reserves and commits on demand - * Made all Win32 emulations decommit memory with PROT_NONE - * Added MSVC assembler op for largebin_index() + * Merged Wolfram Gloger's SMP changes in with Doug Lea's v2.7.2 version + * Copy & pasted Gloger's external C file includes directly into this file + * Made various adjustments to let this compile as C++ & PTMALLOC_IN_CPPNAMESPACE + * Merged back in Win32 support, added MORECORE_IS_MMAP + * Added Win32 emulation of mprotect() plus made mmap() set page protection + correctly. No longer always commits arenas, now reserves and commits on demand + * Made all Win32 emulations decommit memory with PROT_NONE + * Added MSVC assembler op for largebin_index() V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) * Fix malloc_state bitmap array misdeclaration diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index c451154079..58c16b9974 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -471,7 +471,7 @@ read_args() { if (index == 0) { if (_binary_name.empty()) - _binary_name = arg; + _binary_name = arg; } else { _args.push_back(arg); } diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 3ae9b1e7c5..61829f9d00 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -607,8 +607,8 @@ get_filename_index(int index) const { if (_hash_end != _hash_start) { ostringstream strm; strm << _filename.substr(0, _hash_start) - << setw(_hash_end - _hash_start) << setfill('0') << index - << _filename.substr(_hash_end); + << setw(_hash_end - _hash_start) << setfill('0') << index + << _filename.substr(_hash_end); file.set_fullpath(strm.str()); } file.set_pattern(false); @@ -863,7 +863,7 @@ make_true_case() { assert(l < MAX_PATH + 1); Filename true_case = Filename::from_os_specific(long_name); - + // Now sanity-check the true-case filename. If it's not the same as // the source file, except for case, reject it. string orig_filename = get_fullpath(); diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 9956e2e763..5e3aed69cc 100755 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -331,17 +331,17 @@ std::string make_safe_name(const std::string & name) /* static const char safe_chars2[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; - std::string result = name; + std::string result = name; - size_t pos = result.find_first_not_of(safe_chars2); - while (pos != std::string::npos) - { - result[pos] = '_'; - pos = result.find_first_not_of(safe_chars2); - } + size_t pos = result.find_first_not_of(safe_chars2); + while (pos != std::string::npos) + { + result[pos] = '_'; + pos = result.find_first_not_of(safe_chars2); + } - return result; - */ + return result; + */ } bool isInplaceFunction(const std::string &cppName) @@ -640,8 +640,8 @@ void InterfaceMakerPythonNative::write_ClasseDetails(ostream &out, Object * obj) GetThis << " DTOOL_Call_ExtractThisPointerForType(self,&Dtool_"<< ClassName<<",(void **)&local_this);\n"; GetThis << " if(local_this == NULL) {\n"; GetThis << " // This might happen if Python called a reverse operator like __rsub__().\n"; - GetThis << " Py_INCREF(Py_NotImplemented);\n"; - GetThis << " return Py_NotImplemented;\n"; + GetThis << " Py_INCREF(Py_NotImplemented);\n"; + GetThis << " return Py_NotImplemented;\n"; GetThis << " }\n"; write_function_for_top(out, func,GetThis.str()); @@ -1322,12 +1322,12 @@ write_module_class(ostream &out, Object *obj) { out << " if(local_this != NULL)\n"; out << " {\n"; out << " ostringstream os;\n"; - if (need_repr == 2) { - out << " local_this->output(os);\n"; - } else { - out << " local_this->python_repr(os, \"" - << classNameFromCppName(ClassName) << "\");\n"; - } + if (need_repr == 2) { + out << " local_this->output(os);\n"; + } else { + out << " local_this->python_repr(os, \"" + << classNameFromCppName(ClassName) << "\");\n"; + } out << " std::string ss = os.str();\n"; out << " return PyString_FromStringAndSize(ss.data(),ss.length());\n"; out << " };\n"; @@ -1386,7 +1386,7 @@ write_module_class(ostream &out, Object *obj) { << ".As_PyTypeObject().tp_doc =\n"; output_quoted(out, 10, obj->_itype.get_comment()); out << ";\n" - << "#endif\n"; + << "#endif\n"; } // add bases/// @@ -2934,43 +2934,43 @@ NeedsAStrFunction(const InterrogateType &itype_class) { const InterrogateFunction &ifunc = idb->get_function(func_index); if (ifunc.get_name() == "write") { if (ifunc._instances != (InterrogateFunction::Instances *)NULL) { - InterrogateFunction::Instances::const_iterator ii; - for (ii = ifunc._instances->begin(); - ii != ifunc._instances->end(); - ++ii) { - CPPInstance *cppinst = (*ii).second; - CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); - - if (cppfunc != NULL) { - if (cppfunc->_parameters != NULL && - cppfunc->_return_type != NULL && - TypeManager::is_void(cppfunc->_return_type)) { - if (cppfunc->_parameters->_parameters.size() == 1) { - CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; - if (TypeManager::is_pointer_to_ostream(inst1->_type)) { - // write(ostream) - return 1; - } - } + InterrogateFunction::Instances::const_iterator ii; + for (ii = ifunc._instances->begin(); + ii != ifunc._instances->end(); + ++ii) { + CPPInstance *cppinst = (*ii).second; + CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); - if (cppfunc->_parameters->_parameters.size() == 2) { - CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; - if (TypeManager::is_pointer_to_ostream(inst1->_type)) { - inst1 = cppfunc->_parameters->_parameters[1]; - if (inst1->_initializer != NULL) { - // write(ostream, int = 0) - return 1; - } - - if (TypeManager::is_integer(inst1->_type)) { - // write(ostream, int) - return 2; - } - } - } - } - } - } + if (cppfunc != NULL) { + if (cppfunc->_parameters != NULL && + cppfunc->_return_type != NULL && + TypeManager::is_void(cppfunc->_return_type)) { + if (cppfunc->_parameters->_parameters.size() == 1) { + CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; + if (TypeManager::is_pointer_to_ostream(inst1->_type)) { + // write(ostream) + return 1; + } + } + + if (cppfunc->_parameters->_parameters.size() == 2) { + CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; + if (TypeManager::is_pointer_to_ostream(inst1->_type)) { + inst1 = cppfunc->_parameters->_parameters[1]; + if (inst1->_initializer != NULL) { + // write(ostream, int = 0) + return 1; + } + + if (TypeManager::is_integer(inst1->_type)) { + // write(ostream, int) + return 2; + } + } + } + } + } + } } } } @@ -3000,31 +3000,31 @@ NeedsAReprFunction(const InterrogateType &itype_class) { const InterrogateFunction &ifunc = idb->get_function(func_index); if (ifunc.get_name() == "python_repr") { if (ifunc._instances != (InterrogateFunction::Instances *)NULL) { - InterrogateFunction::Instances::const_iterator ii; - for (ii = ifunc._instances->begin(); - ii != ifunc._instances->end(); - ++ii) { - CPPInstance *cppinst = (*ii).second; - CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); - - if (cppfunc != NULL) { - if (cppfunc->_parameters != NULL && - cppfunc->_return_type != NULL && - TypeManager::is_void(cppfunc->_return_type)) { - if (cppfunc->_parameters->_parameters.size() == 2) { - CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; - if (TypeManager::is_pointer_to_ostream(inst1->_type)) { - inst1 = cppfunc->_parameters->_parameters[1]; - if (TypeManager::is_string(inst1->_type) || - TypeManager::is_char_pointer(inst1->_type)) { - // python_repr(ostream, string) - return 1; - } - } - } - } - } - } + InterrogateFunction::Instances::const_iterator ii; + for (ii = ifunc._instances->begin(); + ii != ifunc._instances->end(); + ++ii) { + CPPInstance *cppinst = (*ii).second; + CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); + + if (cppfunc != NULL) { + if (cppfunc->_parameters != NULL && + cppfunc->_return_type != NULL && + TypeManager::is_void(cppfunc->_return_type)) { + if (cppfunc->_parameters->_parameters.size() == 2) { + CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; + if (TypeManager::is_pointer_to_ostream(inst1->_type)) { + inst1 = cppfunc->_parameters->_parameters[1]; + if (TypeManager::is_string(inst1->_type) || + TypeManager::is_char_pointer(inst1->_type)) { + // python_repr(ostream, string) + return 1; + } + } + } + } + } + } } } } @@ -3034,38 +3034,38 @@ NeedsAReprFunction(const InterrogateType &itype_class) { const InterrogateFunction &ifunc = idb->get_function(func_index); if (ifunc.get_name() == "output") { if (ifunc._instances != (InterrogateFunction::Instances *)NULL) { - InterrogateFunction::Instances::const_iterator ii; - for (ii = ifunc._instances->begin(); - ii != ifunc._instances->end(); - ++ii) { - CPPInstance *cppinst = (*ii).second; - CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); - - if (cppfunc != NULL) { - if (cppfunc->_parameters != NULL && - cppfunc->_return_type != NULL && - TypeManager::is_void(cppfunc->_return_type)) { - if (cppfunc->_parameters->_parameters.size() == 1) { - CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; - if (TypeManager::is_pointer_to_ostream(inst1->_type)) { - // output(ostream) - return 2; - } - } + InterrogateFunction::Instances::const_iterator ii; + for (ii = ifunc._instances->begin(); + ii != ifunc._instances->end(); + ++ii) { + CPPInstance *cppinst = (*ii).second; + CPPFunctionType *cppfunc = cppinst->_type->as_function_type(); - if (cppfunc->_parameters->_parameters.size() >= 2) { - CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; - if (TypeManager::is_pointer_to_ostream(inst1->_type)) { - inst1 = cppfunc->_parameters->_parameters[1]; - if (inst1->_initializer != NULL) { - // output(ostream, foo = bar, ...) - return 2; - } - } - } - } - } - } + if (cppfunc != NULL) { + if (cppfunc->_parameters != NULL && + cppfunc->_return_type != NULL && + TypeManager::is_void(cppfunc->_return_type)) { + if (cppfunc->_parameters->_parameters.size() == 1) { + CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; + if (TypeManager::is_pointer_to_ostream(inst1->_type)) { + // output(ostream) + return 2; + } + } + + if (cppfunc->_parameters->_parameters.size() >= 2) { + CPPInstance *inst1 = cppfunc->_parameters->_parameters[0]; + if (TypeManager::is_pointer_to_ostream(inst1->_type)) { + inst1 = cppfunc->_parameters->_parameters[1]; + if (inst1->_initializer != NULL) { + // output(ostream, foo = bar, ...) + return 2; + } + } + } + } + } + } } } } @@ -3097,15 +3097,15 @@ output_quoted(ostream &out, int indent_level, const std::string &str) { case '\n': out << "\\n\"\n"; indent(out, indent_level) - << '"'; + << '"'; break; default: if (!isprint(*si)) { - out << "\\" << oct << setw(3) << setfill('0') << (unsigned int)(*si) - << dec; + out << "\\" << oct << setw(3) << setfill('0') << (unsigned int)(*si) + << dec; } else { - out << *si; + out << *si; } } } diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index dd22766a9e..6ee1b5fb27 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -21,11 +21,11 @@ #ifdef HAVE_PYTHON PyMemberDef standard_type_members[] = { - {"this", T_INT, offsetof(Dtool_PyInstDef,_ptr_to_object),READONLY,"C++ This if any"}, - {"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"}, - {"this_signiture", T_INT, offsetof(Dtool_PyInstDef, _signiture), READONLY,"A type check signiture"}, - {"this_metatype", T_OBJECT, offsetof(Dtool_PyInstDef, _My_Type), READONLY,"The dtool meta object"}, - {NULL} /* Sentinel */ + {"this", T_INT, offsetof(Dtool_PyInstDef,_ptr_to_object),READONLY,"C++ This if any"}, + {"this_ownership", T_INT, offsetof(Dtool_PyInstDef, _memory_rules), READONLY,"C++ 'this' ownership rules"}, + {"this_signiture", T_INT, offsetof(Dtool_PyInstDef, _signiture), READONLY,"A type check signiture"}, + {"this_metatype", T_OBJECT, offsetof(Dtool_PyInstDef, _My_Type), READONLY,"The dtool meta object"}, + {NULL} /* Sentinel */ }; @@ -160,7 +160,7 @@ PyObject * DTool_CreatePyInstanceTyped(void * local_this_in, Dtool_PyTypedObject // if we get this far .. just wrap the thing in the known type ?? // better than aborting...I guess.... ///////////////////////////////////////////////////// - Dtool_PyInstDef * self = (Dtool_PyInstDef *) known_class_type.As_PyTypeObject().tp_new(&known_class_type.As_PyTypeObject(), NULL,NULL); + Dtool_PyInstDef * self = (Dtool_PyInstDef *) known_class_type.As_PyTypeObject().tp_new(&known_class_type.As_PyTypeObject(), NULL,NULL); if(self != NULL) { self->_ptr_to_object = local_this_in; @@ -248,9 +248,9 @@ RegisterRuntimeClass(Dtool_PyTypedObject * otype, int class_id) { // There was already an entry in the dictionary for class_id. Dtool_PyTypedObject *other_type = (*result.first).second; interrogatedb_cat.warning() - << "Classes " << otype->_name << " and " << other_type->_name - << " share the same TypeHandle value (" << class_id - << "); check class definitions.\n"; + << "Classes " << otype->_name << " and " << other_type->_name + << " share the same TypeHandle value (" << class_id + << "); check class definitions.\n"; } else { GetRunTimeTypeList().insert(class_id); @@ -432,7 +432,7 @@ int DTOOL_PyObject_Compare_old(PyObject *v1, PyObject *v2) Py_DECREF(args); } Py_DECREF(func); - PyErr_Clear(); // just in case the function threw an error + PyErr_Clear(); // just in case the function threw an error // only use if the cuntion return an INT... hmm if(res != NULL && PyInt_Check(res)) { diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index 01bb61cb2b..ee9e5b3795 100755 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -22,8 +22,8 @@ // for performance and is treading on thin ice for function python or c++ will // course there types to other types. // -// The linking step will produce allot of warnings -// warning LNK4049: locally defined symbol.. +// The linking step will produce allot of warnings +// warning LNK4049: locally defined symbol.. // // Get a second coder to review this file and the generated code .. // @@ -135,49 +135,49 @@ struct Dtool_PyTypedObject //////////////////////////////////////////////////////////////////////// #define Define_Dtool_Class(MODULE_NAME, CLASS_NAME, PUBLIC_NAME) \ static PyNumberMethods Dtool_PyNumberMethods_##CLASS_NAME ={\ - 0,/*binaryfunc nb_add*/\ - 0,/*binaryfunc nb_subtract*/\ - 0,/*binaryfunc nb_multiply*/\ - 0,/*binaryfunc nb_divide*/\ - 0,/*binaryfunc nb_remainder*/\ - 0,/*binaryfunc nb_divmod*/\ - 0,/*ternaryfunc nb_power*/\ - 0,/*unaryfunc nb_negative*/\ - 0,/*unaryfunc nb_positive*/\ - 0,/*unaryfunc nb_absolute*/\ - 0,/*inquiry nb_nonzero*/\ - 0,/*unaryfunc nb_invert*/\ - 0,/*binaryfunc nb_lshift*/\ - 0,/*binaryfunc nb_rshift*/\ - 0,/*binaryfunc nb_and*/\ - 0,/*binaryfunc nb_xor*/\ - 0,/*binaryfunc nb_or*/\ - 0,/*coercion nb_coerce*/\ - 0,/*unaryfunc nb_int*/\ - 0,/*unaryfunc nb_long*/\ - 0,/*unaryfunc nb_float*/\ - 0,/*unaryfunc nb_oct*/\ - 0,/*unaryfunc nb_hex*/\ - 0,/*binaryfunc nb_inplace_add*/\ - 0,/*binaryfunc nb_inplace_subtract*/\ - 0,/*binaryfunc nb_inplace_multiply*/\ - 0,/*binaryfunc nb_inplace_divide*/\ - 0,/*binaryfunc nb_inplace_remainder*/\ - 0,/*ternaryfunc nb_inplace_power*/\ - 0,/*binaryfunc nb_inplace_lshift*/\ - 0,/*binaryfunc nb_inplace_rshift*/\ - 0,/*binaryfunc nb_inplace_and*/\ - 0,/*binaryfunc nb_inplace_xor*/\ - 0,/*binaryfunc nb_inplace_or*/\ - 0,/*binaryfunc nb_floor_divide*/\ - 0,/*binaryfunc nb_true_divide*/\ - 0,/*binaryfunc nb_inplace_floor_divide*/\ - 0,/*binaryfunc nb_inplace_true_divide*/\ + 0,/*binaryfunc nb_add*/\ + 0,/*binaryfunc nb_subtract*/\ + 0,/*binaryfunc nb_multiply*/\ + 0,/*binaryfunc nb_divide*/\ + 0,/*binaryfunc nb_remainder*/\ + 0,/*binaryfunc nb_divmod*/\ + 0,/*ternaryfunc nb_power*/\ + 0,/*unaryfunc nb_negative*/\ + 0,/*unaryfunc nb_positive*/\ + 0,/*unaryfunc nb_absolute*/\ + 0,/*inquiry nb_nonzero*/\ + 0,/*unaryfunc nb_invert*/\ + 0,/*binaryfunc nb_lshift*/\ + 0,/*binaryfunc nb_rshift*/\ + 0,/*binaryfunc nb_and*/\ + 0,/*binaryfunc nb_xor*/\ + 0,/*binaryfunc nb_or*/\ + 0,/*coercion nb_coerce*/\ + 0,/*unaryfunc nb_int*/\ + 0,/*unaryfunc nb_long*/\ + 0,/*unaryfunc nb_float*/\ + 0,/*unaryfunc nb_oct*/\ + 0,/*unaryfunc nb_hex*/\ + 0,/*binaryfunc nb_inplace_add*/\ + 0,/*binaryfunc nb_inplace_subtract*/\ + 0,/*binaryfunc nb_inplace_multiply*/\ + 0,/*binaryfunc nb_inplace_divide*/\ + 0,/*binaryfunc nb_inplace_remainder*/\ + 0,/*ternaryfunc nb_inplace_power*/\ + 0,/*binaryfunc nb_inplace_lshift*/\ + 0,/*binaryfunc nb_inplace_rshift*/\ + 0,/*binaryfunc nb_inplace_and*/\ + 0,/*binaryfunc nb_inplace_xor*/\ + 0,/*binaryfunc nb_inplace_or*/\ + 0,/*binaryfunc nb_floor_divide*/\ + 0,/*binaryfunc nb_true_divide*/\ + 0,/*binaryfunc nb_inplace_floor_divide*/\ + 0,/*binaryfunc nb_inplace_true_divide*/\ };\ static PyMappingMethods Dtool_PyMappingMethods_##CLASS_NAME ={\ - 0,/*inquiry mp_length */\ - 0,/*binaryfunc mp_subscript */\ - 0,/*objobjargproc mp_ass_subscript */\ + 0,/*inquiry mp_length */\ + 0,/*binaryfunc mp_subscript */\ + 0,/*objobjargproc mp_ass_subscript */\ };\ EXPORT_THIS Dtool_PyTypedObject Dtool_##CLASS_NAME = {\ {\ @@ -196,31 +196,31 @@ EXPORT_THIS Dtool_PyTypedObject Dtool_##CLASS_NAME = {\ 0, /*tp_as_sequence*/\ &Dtool_PyMappingMethods_##CLASS_NAME, /*tp_as_mapping*/\ 0, /*tp_hash */\ - 0, /* tp_call */\ - 0, /* tp_str */\ - PyObject_GenericGetAttr, /* tp_getattro */\ - PyObject_GenericSetAttr, /* tp_setattro */\ - 0, /* tp_as_buffer */\ - (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), /* tp_flags */\ - 0, /* tp_doc */\ - 0, /* tp_traverse */\ - 0, /* tp_clear */\ - 0, /* tp_richcompare */\ - 0, /* tp_weaklistoffset */\ - 0, /* tp_iter */\ - 0, /* tp_iternext */\ - Dtool_Methods_##CLASS_NAME, /* tp_methods */\ - standard_type_members, /* tp_members */\ - 0, /* tp_getset */\ - 0, /* tp_base */\ - 0, /* tp_dict */\ - 0, /* tp_descr_get */\ - 0, /* tp_descr_set */\ - 0, /* tp_dictoffset */\ - Dtool_Init_##CLASS_NAME, /* tp_init */\ - PyType_GenericAlloc, /* tp_alloc */\ - Dtool_new_##CLASS_NAME, /* tp_new */\ - _PyObject_Del, /* tp_free */\ + 0, /* tp_call */\ + 0, /* tp_str */\ + PyObject_GenericGetAttr, /* tp_getattro */\ + PyObject_GenericSetAttr, /* tp_setattro */\ + 0, /* tp_as_buffer */\ + (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_CHECKTYPES), /* tp_flags */\ + 0, /* tp_doc */\ + 0, /* tp_traverse */\ + 0, /* tp_clear */\ + 0, /* tp_richcompare */\ + 0, /* tp_weaklistoffset */\ + 0, /* tp_iter */\ + 0, /* tp_iternext */\ + Dtool_Methods_##CLASS_NAME, /* tp_methods */\ + standard_type_members, /* tp_members */\ + 0, /* tp_getset */\ + 0, /* tp_base */\ + 0, /* tp_dict */\ + 0, /* tp_descr_get */\ + 0, /* tp_descr_set */\ + 0, /* tp_dictoffset */\ + Dtool_Init_##CLASS_NAME, /* tp_init */\ + PyType_GenericAlloc, /* tp_alloc */\ + Dtool_new_##CLASS_NAME, /* tp_new */\ + _PyObject_Del, /* tp_free */\ },\ #CLASS_NAME, \ false,\ @@ -245,7 +245,7 @@ inline void Dtool_Deallocate_General(PyObject * self) #define Define_Dtool_new(CLASS_NAME,CNAME)\ PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyObject *kwds)\ {\ - PyObject * self = type->tp_alloc(type, 0);\ + PyObject * self = type->tp_alloc(type, 0);\ ((Dtool_PyInstDef *)self)->_signiture = PY_PANDA_SIGNITURE;\ ((Dtool_PyInstDef *)self)->_ptr_to_object = NULL;\ ((Dtool_PyInstDef *)self)->_memory_rules = false;\ diff --git a/dtool/src/prc/configPageManager.cxx b/dtool/src/prc/configPageManager.cxx index a57767b87d..42dcec9b08 100644 --- a/dtool/src/prc/configPageManager.cxx +++ b/dtool/src/prc/configPageManager.cxx @@ -497,24 +497,24 @@ scan_up_from(Filename &result, const Filename &dir, if (consider.scan_directory(files)) { vector_string::const_iterator fi; for (fi = files.begin(); fi != files.end(); ++fi) { - Globs::const_iterator gi; - for (gi = _prc_patterns.begin(); - gi != _prc_patterns.end(); - ++gi) { - if ((*gi).matches(*fi)) { - result = consider; - return true; - } - } - - for (gi = _prc_executable_patterns.begin(); - gi != _prc_executable_patterns.end(); - ++gi) { - if ((*gi).matches(*fi)) { - result = consider; - return true; - } - } + Globs::const_iterator gi; + for (gi = _prc_patterns.begin(); + gi != _prc_patterns.end(); + ++gi) { + if ((*gi).matches(*fi)) { + result = consider; + return true; + } + } + + for (gi = _prc_executable_patterns.begin(); + gi != _prc_executable_patterns.end(); + ++gi) { + if ((*gi).matches(*fi)) { + result = consider; + return true; + } + } } } } diff --git a/panda/src/display/graphicsOutput.h b/panda/src/display/graphicsOutput.h index 31836ba218..af2cbd2b09 100644 --- a/panda/src/display/graphicsOutput.h +++ b/panda/src/display/graphicsOutput.h @@ -129,9 +129,9 @@ PUBLISHED: GraphicsOutput *make_texture_buffer(const string &name, int x_size, int y_size, Texture *tex = NULL, bool to_ram = false); GraphicsOutput *make_cube_map(const string &name, int size, - NodePath &camera_rig, - DrawMask camera_mask = DrawMask::all_on(), - bool to_ram = false); + NodePath &camera_rig, + DrawMask camera_mask = DrawMask::all_on(), + bool to_ram = false); INLINE static Filename make_screenshot_filename(const string &prefix = "screenshot"); INLINE Filename save_screenshot_default(const string &prefix = "screenshot"); diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index 751bb3c2a2..ba3ad9f8c5 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -599,8 +599,8 @@ set_properties_now(WindowProperties &properties) { if (reshape_props.get_x_size() != _properties.get_x_size() || reshape_props.get_y_size() != _properties.get_y_size() || - (has_origin && (x_origin != _properties.get_x_origin() || - y_origin != _properties.get_y_origin()))) { + (has_origin && (x_origin != _properties.get_x_origin() || + y_origin != _properties.get_y_origin()))) { if (do_reshape_request(x_origin, y_origin, has_origin, reshape_props.get_x_size(), reshape_props.get_y_size())) { @@ -668,7 +668,7 @@ reset_window(bool swapchain) { //////////////////////////////////////////////////////////////////// bool GraphicsWindow:: do_reshape_request(int x_origin, int y_origin, bool has_origin, - int x_size, int y_size) { + int x_size, int y_size) { return false; } diff --git a/panda/src/downloader/httpChannel.cxx b/panda/src/downloader/httpChannel.cxx index 0f43582d1d..0dd0cef14c 100644 --- a/panda/src/downloader/httpChannel.cxx +++ b/panda/src/downloader/httpChannel.cxx @@ -1818,7 +1818,7 @@ run_reading_header() { } reset_url(_request.get_url(), new_url); _request.set_url(new_url); - _want_ssl = _request.get_url().is_ssl(); + _want_ssl = _request.get_url().is_ssl(); make_header(); make_request_text(); diff --git a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx index a27b1c16dd..c8740477ba 100644 --- a/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx +++ b/panda/src/dxgsg7/dxGraphicsStateGuardian7.cxx @@ -134,7 +134,7 @@ TextureContext *DXGraphicsStateGuardian7:: prepare_texture(Texture *tex) { DXTextureContext7 *dtc = new DXTextureContext7(tex); if (dtc->create_texture(_d3d_device, _num_tex_formats, _tex_formats, - &_screen->D3DDevDesc) == NULL) { + &_screen->D3DDevDesc) == NULL) { delete dtc; return NULL; } @@ -175,14 +175,14 @@ apply_texture(int i, TextureContext *tc) { // error or oversight. if ((dirty & Texture::DF_image) == 0) { dxgsg7_cat.warning() - << "Texture " << *dtc->_texture << " has changed mipmap state.\n"; + << "Texture " << *dtc->_texture << " has changed mipmap state.\n"; } if (!dtc->create_texture(_d3d_device, _num_tex_formats, _tex_formats, - &_screen->D3DDevDesc)) { + &_screen->D3DDevDesc)) { // Oops, we can't re-create the texture for some reason. dxgsg7_cat.error() - << "Unable to re-create texture " << *dtc->_texture << endl; + << "Unable to re-create texture " << *dtc->_texture << endl; _d3d_device->SetTextureStageState(i, D3DTSS_COLOROP, D3DTOP_DISABLE); return; } @@ -198,7 +198,7 @@ apply_texture(int i, TextureContext *tc) { _d3d_device->SetTextureStageState(i, D3DTSS_ADDRESSV, get_texture_wrap_mode(wrap_v)); _d3d_device->SetTextureStageState(i, D3DTSS_BORDERCOLOR, - Colorf_to_D3DCOLOR(tex->get_border_color())); + Colorf_to_D3DCOLOR(tex->get_border_color())); uint aniso_degree = tex->get_anisotropic_degree(); Texture::FilterType ft = tex->get_magfilter(); @@ -295,7 +295,7 @@ do_clear(const RenderBuffer &buffer) { } HRESULT hr = _d3d_device->Clear(0, NULL, flags, _d3dcolor_clear_value, - (D3DVALUE) _depth_clear_value, 0); + (D3DVALUE) _depth_clear_value, 0); if (hr != DD_OK) { dxgsg7_cat.error() << "clear_buffer failed: Clear returned " << ConvD3DErrorToString(hr) @@ -938,7 +938,7 @@ reset() { // range-based fog only works with vertex fog in dx7/8 if(dx_use_rangebased_fog && (_screen->D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGRANGE)) - _screen->pD3DDevice->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, true); + _screen->pD3DDevice->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, true); } } @@ -969,7 +969,7 @@ reset() { _max_texture_stages = 1; _max_texture_dimension = min(_screen->D3DDevDesc.dwMaxTextureWidth, - _screen->D3DDevDesc.dwMaxTextureHeight); + _screen->D3DDevDesc.dwMaxTextureHeight); _supports_texture_combine = false; _supports_texture_saved_result = false; @@ -1774,12 +1774,12 @@ do_issue_texture() { } else { LMatrix4f m = tex_mat->get_mat(); _d3d_device->SetTransform(get_tex_mat_sym(i), (D3DMATRIX *)m.get_data()); - DWORD transform_flags = texcoord_dimensions; - if (m.get_col(3) != LVecBase4f(0.0f, 0.0f, 0.0f, 1.0f)) { - // If we have a projected texture matrix, we also need to - // set D3DTTFF_COUNT4. - transform_flags = D3DTTFF_COUNT4 | D3DTTFF_PROJECTED; - } + DWORD transform_flags = texcoord_dimensions; + if (m.get_col(3) != LVecBase4f(0.0f, 0.0f, 0.0f, 1.0f)) { + // If we have a projected texture matrix, we also need to + // set D3DTTFF_COUNT4. + transform_flags = D3DTTFF_COUNT4 | D3DTTFF_PROJECTED; + } _d3d_device->SetTextureStageState(i, D3DTSS_TEXTURETRANSFORMFLAGS, transform_flags); } @@ -2512,7 +2512,7 @@ enum_tex_formats_callback(LPDDPIXELFORMAT pddpf, void *param) { DXGraphicsStateGuardian7 *gsg = (DXGraphicsStateGuardian7 *)param; nassertr(gsg->_num_tex_formats < MAX_DX_TEXPIXFMTS, E_FAIL); memcpy(&(gsg->_tex_formats[gsg->_num_tex_formats]), pddpf, - sizeof(DDPIXELFORMAT)); + sizeof(DDPIXELFORMAT)); gsg->_num_tex_formats++; return DDENUMRET_OK; diff --git a/panda/src/dxgsg7/dxTextureContext7.cxx b/panda/src/dxgsg7/dxTextureContext7.cxx index 5f1a96511a..62446a7cf6 100644 --- a/panda/src/dxgsg7/dxTextureContext7.cxx +++ b/panda/src/dxgsg7/dxTextureContext7.cxx @@ -331,7 +331,7 @@ HRESULT ConvertPixBuftoDDSurf(ConversionType ConvNeeded,BYTE *pbuf,LPDIRECTDRAWS for(DWORD y=0; ySwapEffect = D3DSWAPEFFECT_COPY_VSYNC; presentation_params->SwapEffect = D3DSWAPEFFECT_DISCARD; } else { diff --git a/panda/src/egg/eggGroupNode.cxx b/panda/src/egg/eggGroupNode.cxx index 163f6fdacc..3bdc589988 100644 --- a/panda/src/egg/eggGroupNode.cxx +++ b/panda/src/egg/eggGroupNode.cxx @@ -1788,7 +1788,7 @@ r_collect_tangent_binormal(const GlobPattern &uv_name, // texcoords on the polygon. A front-facing polygon // should not contribute to the tangent and binormal of // a back-facing polygon, and vice-versa. - value._facing = is_right(w1 - w2, w3 - w1); + value._facing = is_right(w1 - w2, w3 - w1); double x1 = p2[0] - p1[0]; double x2 = p3[0] - p1[0]; diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index 0fc0dab69f..a8642daa92 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/panda/src/egg/eggTexture.cxx @@ -359,7 +359,7 @@ is_equivalent_to(const EggTexture &other, int eq) const { if (eq & E_attributes) { //cout << "compared by attributes" << endl; if (_texture_type != other._texture_type || - _format != other._format || + _format != other._format || _wrap_mode != other._wrap_mode || _wrap_u != other._wrap_u || _wrap_v != other._wrap_v || @@ -610,18 +610,18 @@ string_texture_type(const string &string) { return TT_1d_texture; } else if (cmp_nocase_uh(string, "2d") == 0 || - cmp_nocase_uh(string, "2dtexture") == 0 || - cmp_nocase_uh(string, "2d_texture") == 0) { + cmp_nocase_uh(string, "2dtexture") == 0 || + cmp_nocase_uh(string, "2d_texture") == 0) { return TT_2d_texture; } else if (cmp_nocase_uh(string, "3d") == 0 || - cmp_nocase_uh(string, "3dtexture") == 0 || - cmp_nocase_uh(string, "3d_texture") == 0) { + cmp_nocase_uh(string, "3dtexture") == 0 || + cmp_nocase_uh(string, "3d_texture") == 0) { return TT_2d_texture; } else if (cmp_nocase_uh(string, "cube") == 0 || - cmp_nocase_uh(string, "cubemap") == 0 || - cmp_nocase_uh(string, "cube_map") == 0) { + cmp_nocase_uh(string, "cubemap") == 0 || + cmp_nocase_uh(string, "cube_map") == 0) { return TT_cube_map; } else { diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index 2c1219dc46..cf7602cffb 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -947,7 +947,7 @@ vertex_body: vertex->set_uv_obj(uv); } } - vertex_uv_body '}' + vertex_uv_body '}' { egg_stack.pop_back(); } @@ -1535,7 +1535,7 @@ rotz: ; rotate3d: - ROTATE '{' real real real real '}' + ROTATE '{' real real real real '}' { egg_stack.back()->as_transform()->add_rotate3d($3, LVector3d($4, $5, $6)); } @@ -1549,14 +1549,14 @@ scale2d: ; scale3d: - SCALE '{' real real real '}' + SCALE '{' real real real '}' { egg_stack.back()->as_transform()->add_scale3d(LVecBase3d($3, $4, $5)); } - ; + ; uniform_scale: - SCALE '{' real '}' + SCALE '{' real '}' { egg_stack.back()->as_transform()->add_uniform_scale($3); } @@ -1865,7 +1865,7 @@ primitive_body: // the component attributes. egg_stack.push_back(new EggPolygon); } - primitive_component_body '}' + primitive_component_body '}' { PT(EggPrimitive) prim = DCAST(EggPrimitive, egg_stack.back()); egg_stack.pop_back(); diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index 488c31f53a..047bdf64f5 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -878,12 +878,12 @@ load_texture(TextureDef &def, const EggTexture *egg_tex) { case EggTexture::TT_2d_texture: if (egg_tex->has_alpha_filename() && wanted_alpha) { tex = TexturePool::load_texture(egg_tex->get_fullpath(), - egg_tex->get_alpha_fullpath(), - wanted_channels, - egg_tex->get_alpha_file_channel()); + egg_tex->get_alpha_fullpath(), + wanted_channels, + egg_tex->get_alpha_file_channel()); } else { tex = TexturePool::load_texture(egg_tex->get_fullpath(), - wanted_channels); + wanted_channels); } break; @@ -2035,10 +2035,10 @@ make_vertex_data(const EggRenderState *render_state, CPT(InternalName) delta_name = InternalName::get_morph(InternalName::get_normal(), morph.get_name()); gvw.set_column(delta_name); - Normald morphed_normal = orig_normal + morph.get_offset(); - Normald transformed_morphed_normal = normalize(morphed_normal * transform); - LVector3d delta = transformed_morphed_normal - transformed_normal; - gvw.add_data3f(LCAST(float, delta)); + Normald morphed_normal = orig_normal + morph.get_offset(); + Normald transformed_morphed_normal = normalize(morphed_normal * transform); + LVector3d delta = transformed_morphed_normal - transformed_normal; + gvw.add_data3f(LCAST(float, delta)); } } } @@ -2336,7 +2336,7 @@ make_sphere(EggGroup *egg_group, EggGroup::CollideFlags flags, for (vi = vertices.begin(); vi != vertices.end(); ++vi) { EggVertex *vtx = (*vi); LPoint3d p3 = vtx->get_pos3(); - LVector3d v = p3 * mat - d_center; + LVector3d v = p3 * mat - d_center; radius2 = max(radius2, v.length_squared()); } diff --git a/panda/src/express/patchfile.cxx b/panda/src/express/patchfile.cxx index 05e7049dd5..2bc08e2eb0 100644 --- a/panda/src/express/patchfile.cxx +++ b/panda/src/express/patchfile.cxx @@ -686,8 +686,8 @@ calc_match_length(const char* buf1, const char* buf2, PN_uint32 max_length, if (min_length >= max_length) return 0; if (buf1[min_length] != buf2[min_length] || - buf1[min_length-1] != buf2[min_length-1] || - buf1[min_length-2] != buf2[min_length-2]) { + buf1[min_length-1] != buf2[min_length-1] || + buf1[min_length-2] != buf2[min_length-2]) { return 0; } } @@ -725,11 +725,11 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 ©_pos, PN_uint16 ©_lengt // calc match length copy_length = (PN_uint16)calc_match_length(&buffer_new[new_pos], - &buffer_orig[copy_pos], - min(min((length_new - new_pos), - (length_orig - copy_pos)), - _MAX_RUN_LENGTH), - 0); + &buffer_orig[copy_pos], + min(min((length_new - new_pos), + (length_orig - copy_pos)), + _MAX_RUN_LENGTH), + 0); // run through link table, see if we find any longer matches PN_uint32 match_offset; @@ -738,11 +738,11 @@ find_longest_match(PN_uint32 new_pos, PN_uint32 ©_pos, PN_uint16 ©_lengt while (match_offset != _NULL_VALUE) { match_length = (PN_uint16)calc_match_length(&buffer_new[new_pos], - &buffer_orig[match_offset], - min(min((length_new - new_pos), - (length_orig - match_offset)), - _MAX_RUN_LENGTH), - copy_length); + &buffer_orig[match_offset], + min(min((length_new - new_pos), + (length_orig - match_offset)), + _MAX_RUN_LENGTH), + copy_length); // have we found a longer match? if (match_length > copy_length) { diff --git a/panda/src/express/trueClock.cxx b/panda/src/express/trueClock.cxx index 1441108d8a..9882cf1658 100644 --- a/panda/src/express/trueClock.cxx +++ b/panda/src/express/trueClock.cxx @@ -150,15 +150,15 @@ TrueClock() { (QueryPerformanceFrequency((LARGE_INTEGER *)&int_frequency) != 0); if (_has_high_res) { if (int_frequency <= 0) { - express_cat.error() - << "TrueClock::get_real_time() - frequency is negative!" << endl; - _has_high_res = false; + express_cat.error() + << "TrueClock::get_real_time() - frequency is negative!" << endl; + _has_high_res = false; } else { - _frequency = (double)int_frequency; - _recip_frequency = 1.0 / _frequency; - - QueryPerformanceCounter((LARGE_INTEGER *)&_init_count); + _frequency = (double)int_frequency; + _recip_frequency = 1.0 / _frequency; + + QueryPerformanceCounter((LARGE_INTEGER *)&_init_count); } } } @@ -295,9 +295,9 @@ correct_time(double time) { double corrected_time = time * _time_scale + _time_offset; double corrected_tod = tod + _tod_offset; if (corrected_time - corrected_tod > paranoid_clock_jump_error_max_delta && - _time_scale > 0.00001) { + _time_scale > 0.00001) { express_cat.info() - << "Force-adjusting time_scale to catch up to errors.\n"; + << "Force-adjusting time_scale to catch up to errors.\n"; set_time_scale(time, _time_scale * 0.5); } @@ -338,25 +338,25 @@ correct_time(double time) { // since we last reported it. double ratio = _time_scale / _last_reported_time_scale; if (fabs(ratio - 1.0) > paranoid_clock_report_scale_factor) { - _time_scale_changed = true; - _last_reported_time_scale = _time_scale; - // Actually report it a little bit later, to give the time - // scale a chance to settle down. - _report_time_scale_time = tod + _tod_offset + keep_interval; - if (express_cat.is_debug()) { - express_cat.debug() - << "Will report time scale, now " << 100.0 / _time_scale - << "%, tod_age = " << tod_age << ", time_age = " << time_age - << ", ratio = " << ratio << "\n"; - } + _time_scale_changed = true; + _last_reported_time_scale = _time_scale; + // Actually report it a little bit later, to give the time + // scale a chance to settle down. + _report_time_scale_time = tod + _tod_offset + keep_interval; + if (express_cat.is_debug()) { + express_cat.debug() + << "Will report time scale, now " << 100.0 / _time_scale + << "%, tod_age = " << tod_age << ", time_age = " << time_age + << ", ratio = " << ratio << "\n"; + } } } // Clean out old entries in the timestamps queue. if (tod_age > keep_interval) { while (!_timestamps.empty() && - tod - _timestamps.front()._tod > keep_interval) { - _timestamps.pop_front(); + tod - _timestamps.front()._tod > keep_interval) { + _timestamps.pop_front(); } } @@ -398,11 +398,11 @@ correct_time(double time) { // We caught up. _chase_clock = CC_keep_even; if (express_cat.is_debug()) { - express_cat.debug() - << "Clock back down to real time.\n"; - // Let's report the clock error now, so an app can resync now - // that we're at a good time. - ++_error_count; + express_cat.debug() + << "Clock back down to real time.\n"; + // Let's report the clock error now, so an app can resync now + // that we're at a good time. + ++_error_count; } } else { @@ -420,18 +420,18 @@ correct_time(double time) { _chase_clock = CC_speed_up; if (express_cat.is_debug()) { - express_cat.debug() - << "Clock is behind by " << (corrected_tod - corrected_time) - << "s; speeding up to correct.\n"; + express_cat.debug() + << "Clock is behind by " << (corrected_tod - corrected_time) + << "s; speeding up to correct.\n"; } } else if ((corrected_time - corrected_tod) > paranoid_clock_chase_threshold) { // Oops, we're going too fast; need to slow down. _chase_clock = CC_slow_down; if (express_cat.is_debug()) { - express_cat.debug() - << "Clock is ahead by " << (corrected_time - corrected_tod) - << "s; slowing down to correct.\n"; + express_cat.debug() + << "Clock is ahead by " << (corrected_time - corrected_tod) + << "s; slowing down to correct.\n"; } } break; @@ -441,11 +441,11 @@ correct_time(double time) { // We caught up. _chase_clock = CC_keep_even; if (express_cat.is_debug()) { - express_cat.debug() - << "Clock back up to real time.\n"; - // Let's report the clock error now, so an app can resync now - // that we're at a good time. - ++_error_count; + express_cat.debug() + << "Clock back up to real time.\n"; + // Let's report the clock error now, so an app can resync now + // that we're at a good time. + ++_error_count; } } else { diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 5f1a2fc5d1..8f6d9a18b6 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1276,16 +1276,16 @@ begin_draw_primitives(const Geom *geom, const GeomMunger *munger, // buffers are unbound, or the nVidia drivers may crash. if (_current_vbuffer_index != 0) { if (GLCAT.is_spam()) { - GLCAT.spam() - << "unbinding vertex buffer\n"; + GLCAT.spam() + << "unbinding vertex buffer\n"; } _glBindBuffer(GL_ARRAY_BUFFER, 0); _current_vbuffer_index = 0; } if (_current_ibuffer_index != 0) { if (GLCAT.is_spam()) { - GLCAT.spam() - << "unbinding index buffer\n"; + GLCAT.spam() + << "unbinding index buffer\n"; } _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); _current_ibuffer_index = 0; @@ -2139,7 +2139,7 @@ apply_vertex_buffer(VertexBufferContext *vbc) { if (_current_vbuffer_index != gvbc->_index) { if (GLCAT.is_spam()) { GLCAT.spam() - << "binding vertex buffer " << gvbc->_index << "\n"; + << "binding vertex buffer " << gvbc->_index << "\n"; } _glBindBuffer(GL_ARRAY_BUFFER, gvbc->_index); _current_vbuffer_index = gvbc->_index; @@ -2199,7 +2199,7 @@ release_vertex_buffer(VertexBufferContext *vbc) { if (_current_vbuffer_index == gvbc->_index) { if (GLCAT.is_spam()) { GLCAT.spam() - << "unbinding vertex buffer\n"; + << "unbinding vertex buffer\n"; } _glBindBuffer(GL_ARRAY_BUFFER, 0); _current_vbuffer_index = 0; @@ -2239,8 +2239,8 @@ setup_array_data(const GeomVertexArrayData *data) { // are configured off. if (_current_vbuffer_index != 0) { if (GLCAT.is_spam()) { - GLCAT.spam() - << "unbinding vertex buffer\n"; + GLCAT.spam() + << "unbinding vertex buffer\n"; } _glBindBuffer(GL_ARRAY_BUFFER, 0); _current_vbuffer_index = 0; @@ -2306,7 +2306,7 @@ apply_index_buffer(IndexBufferContext *ibc) { if (_current_ibuffer_index != gibc->_index) { if (GLCAT.is_spam()) { GLCAT.spam() - << "binding index buffer " << gibc->_index << "\n"; + << "binding index buffer " << gibc->_index << "\n"; } _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gibc->_index); _current_ibuffer_index = gibc->_index; @@ -2366,7 +2366,7 @@ release_index_buffer(IndexBufferContext *ibc) { if (_current_ibuffer_index == gibc->_index) { if (GLCAT.is_spam()) { GLCAT.spam() - << "unbinding index buffer\n"; + << "unbinding index buffer\n"; } _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); _current_ibuffer_index = 0; @@ -2406,8 +2406,8 @@ setup_primitive(const GeomPrimitive *data) { // are configured off. if (_current_ibuffer_index != 0) { if (GLCAT.is_spam()) { - GLCAT.spam() - << "unbinding index buffer\n"; + GLCAT.spam() + << "unbinding index buffer\n"; } _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); _current_ibuffer_index = 0; @@ -4847,7 +4847,7 @@ do_auto_rescale_normal() { if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); if (GLCAT.is_spam()) { - GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; + GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; } } @@ -4857,13 +4857,13 @@ do_auto_rescale_normal() { GLP(Enable)(GL_RESCALE_NORMAL); GLP(Disable)(GL_NORMALIZE); if (GLCAT.is_spam()) { - GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n"; - GLCAT.spam() << "glDisable(GL_NORMALIZE)\n"; + GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n"; + GLCAT.spam() << "glDisable(GL_NORMALIZE)\n"; } } else { GLP(Enable)(GL_NORMALIZE); if (GLCAT.is_spam()) { - GLCAT.spam() << "glEnable(GL_NORMALIZE)\n"; + GLCAT.spam() << "glEnable(GL_NORMALIZE)\n"; } } @@ -4876,7 +4876,7 @@ do_auto_rescale_normal() { if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); if (GLCAT.is_spam()) { - GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; + GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; } } } diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index fb71213c37..a3c68604e2 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -32,15 +32,15 @@ ConfigVariableBool CLP(support_clamp_to_border) ("gl-support-clamp-to-border", true, PRC_DESC("Configure this true to enable the use of the clamp_to_border " "extension if the GL claims to support it, or false not to " - "use it even if it appears to be available. (On some OpenGL " - "drivers, enabling this mode can force software rendering.)")); + "use it even if it appears to be available. (On some OpenGL " + "drivers, enabling this mode can force software rendering.)")); ConfigVariableBool CLP(support_rescale_normal) ("gl-support-rescale-normal", true, PRC_DESC("Configure this true to enable the use of the rescale_normal " "extension if the GL claims to support it, or false not to use " - "it even if it appears to be available. (This appears to be " - "buggy on some drivers.)")); + "it even if it appears to be available. (This appears to be " + "buggy on some drivers.)")); ConfigVariableBool CLP(ignore_filters) ("gl-ignore-filters", false, diff --git a/panda/src/glstuff/panda_glext.h b/panda/src/glstuff/panda_glext.h index 62214f0c11..61a207c580 100644 --- a/panda/src/glstuff/panda_glext.h +++ b/panda/src/glstuff/panda_glext.h @@ -3043,7 +3043,7 @@ extern "C" { #include #ifndef GL_VERSION_2_0 /* GL type for program/shader text */ -typedef char GLchar; /* native character */ +typedef char GLchar; /* native character */ #endif #ifndef GL_VERSION_1_5 @@ -3060,8 +3060,8 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for handling shader object handles and program/shader text */ -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ #endif /* GL types for "half" precision (s10e5) float data in host memory */ diff --git a/panda/src/glxdisplay/glxext.h b/panda/src/glxdisplay/glxext.h index 65bac4d2b8..5fba57a2f4 100644 --- a/panda/src/glxdisplay/glxext.h +++ b/panda/src/glxdisplay/glxext.h @@ -322,16 +322,16 @@ typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; typedef XID GLXPbufferSGIX; typedef struct { int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came for SendEvent request */ - Display *display; /* display the event was read from */ - GLXDrawable drawable; /* i.d. of Drawable */ - int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ - int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ - unsigned int mask; /* mask indicating which buffers are affected*/ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ int x, y; int width, height; - int count; /* if nonzero, at least this many more */ + int count; /* if nonzero, at least this many more */ } GLXBufferClobberEventSGIX; #endif diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index e187fa14d9..8a2012440f 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -102,10 +102,10 @@ ConfigVariableBool vertex_arrays "to using immediate-mode commands like glVertex3f(), etc., to " "issue the vertices, which is potentially much slower than " "vertex arrays. Setting this false also disables vertex buffers, " - "effectively ignoring the setting of the vertex-buffers variable " - "(since vertex buffers are a special case of vertex arrays in " - "OpenGL). This variable is normally not enabled in a production " - "build. This has no effect on DirectX rendering.")); + "effectively ignoring the setting of the vertex-buffers variable " + "(since vertex buffers are a special case of vertex arrays in " + "OpenGL). This variable is normally not enabled in a production " + "build. This has no effect on DirectX rendering.")); ConfigVariableBool display_lists ("display-lists", false, @@ -192,9 +192,9 @@ extern EXPCL_PANDA ConfigVariableBool textures_header_only; ConfigVariableBool textures_header_only ("textures-header-only", false, PRC_DESC("If this is true, texture images will not actually be loaded from " - "disk, but the image header information will be consulted to verify " - "number of channels and so forth. The texture images themselves " - "will be generated in a default blue color.")); + "disk, but the image header information will be consulted to verify " + "number of channels and so forth. The texture images themselves " + "will be generated in a default blue color.")); ConfigVariableInt geom_cache_size ("geom-cache-size", 5000, diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 284ee296e1..bee2ae7b2c 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -135,7 +135,7 @@ write_texture_types(ostream &out, int indent_level) const { string name = tex->get_type().get_name(); indent(out, indent_level) << name; indent(out, max(30 - (int)name.length(), 0)) - << " ." << extension << "\n"; + << " ." << extension << "\n"; } } } @@ -166,10 +166,10 @@ TexturePool() { ConfigVariableString fake_texture_image ("fake-texture-image", "", PRC_DESC("Set this to enable a speedy-load mode in which you don't care " - "what the world looks like, you just want it to load in minimal " - "time. This causes all texture loads via the TexturePool to use " - "the same texture file, which will presumably only be loaded " - "once.")); + "what the world looks like, you just want it to load in minimal " + "time. This causes all texture loads via the TexturePool to use " + "the same texture file, which will presumably only be loaded " + "once.")); _fake_texture_image = fake_texture_image; } @@ -456,7 +456,7 @@ ns_garbage_collect() { _normalization_cube_map->get_ref_count() == 1) { if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Releasing normalization cube map\n"; + << "Releasing normalization cube map\n"; } ++num_released; _normalization_cube_map = NULL; @@ -497,14 +497,14 @@ report_texture_unreadable(const Filename &filename) const { // fully-qualified--therefore, it wasn't found along either // search path. gobj_cat.error() - << "Unable to find texture \"" << filename << "\"" - << " on texture_path " << texture_path - << " or model_path " << model_path <<"\n"; + << "Unable to find texture \"" << filename << "\"" + << " on texture_path " << texture_path + << " or model_path " << model_path <<"\n"; } else { // A fully-specified filename is not searched along the path, so // don't mislead the user with the error message. gobj_cat.error() - << "Texture \"" << filename << "\" does not exist.\n"; + << "Texture \"" << filename << "\" does not exist.\n"; } } else { @@ -516,8 +516,8 @@ report_texture_unreadable(const Filename &filename) const { MakeTextureFunc *func = get_texture_type(filename.get_extension()); if (func == (MakeTextureFunc *)NULL) { gobj_cat.error() - << "Texture extension \"" << filename.get_extension() - << "\" is unknown. Supported texture types:\n"; + << "Texture extension \"" << filename.get_extension() + << "\" is unknown. Supported texture types:\n"; write_texture_types(gobj_cat.error(false), 2); } } diff --git a/panda/src/gobj/videoTexture.I b/panda/src/gobj/videoTexture.I index 306caa1346..9aa68791f3 100644 --- a/panda/src/gobj/videoTexture.I +++ b/panda/src/gobj/videoTexture.I @@ -67,7 +67,7 @@ get_tex_scale() const { LVecBase2f(1.0f, 1.0f); } return LVecBase2f((float)_video_width / _x_size, - (float)_video_height / _y_size); + (float)_video_height / _y_size); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/videoTexture.h b/panda/src/gobj/videoTexture.h index 51f27a6439..b67c6f27b9 100644 --- a/panda/src/gobj/videoTexture.h +++ b/panda/src/gobj/videoTexture.h @@ -73,7 +73,7 @@ public: AnimInterface::init_type(); register_type(_type_handle, "VideoTexture", Texture::get_class_type(), - AnimInterface::get_class_type()); + AnimInterface::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/grutil/openCVTexture.cxx b/panda/src/grutil/openCVTexture.cxx index b5df2047c1..8186022c96 100644 --- a/panda/src/grutil/openCVTexture.cxx +++ b/panda/src/grutil/openCVTexture.cxx @@ -259,7 +259,7 @@ modify_page(int z) { //////////////////////////////////////////////////////////////////// bool OpenCVTexture:: reconsider_video_properties(const OpenCVTexture::VideoStream &stream, - int num_components, int z) { + int num_components, int z) { double frame_rate = 0.0f; int num_frames = 0; @@ -291,7 +291,7 @@ reconsider_video_properties(const OpenCVTexture::VideoStream &stream, } if (!reconsider_image_properties(x_size, y_size, num_components, - T_unsigned_byte, z)) { + T_unsigned_byte, z)) { return false; } @@ -342,68 +342,68 @@ update_frame(int frame) { } if (page._color.is_valid()) { nassertv(get_num_components() >= 3 && get_component_width() == 1); - + const unsigned char *source = page._color.get_frame_data(frame); if (source != NULL) { - nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size); - unsigned char *dest = _image.p() + get_expected_ram_page_size() * z; - - int dest_row_width = (_x_size * _num_components * _component_width); - int source_row_width = get_video_width() * 3; - - if (get_num_components() == 3) { - // The easy case--copy the whole thing in, row by row. - for (int y = 0; y < get_video_height(); ++y) { - memcpy(dest, source, source_row_width); - dest += dest_row_width; - source += source_row_width; - } - - } else { - // The harder case--interleave the color in with the alpha, - // pixel by pixel. - nassertv(get_num_components() == 4); - for (int y = 0; y < get_video_height(); ++y) { - int dx = 0; - int sx = 0; - for (int x = 0; x < get_video_width(); ++x) { - dest[dx] = source[sx]; - dest[dx + 1] = source[sx + 1]; - dest[dx + 2] = source[sx + 2]; - dx += 4; - sx += 3; - } - dest += dest_row_width; - source += source_row_width; - } - } + nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size); + unsigned char *dest = _image.p() + get_expected_ram_page_size() * z; + + int dest_row_width = (_x_size * _num_components * _component_width); + int source_row_width = get_video_width() * 3; + + if (get_num_components() == 3) { + // The easy case--copy the whole thing in, row by row. + for (int y = 0; y < get_video_height(); ++y) { + memcpy(dest, source, source_row_width); + dest += dest_row_width; + source += source_row_width; + } + + } else { + // The harder case--interleave the color in with the alpha, + // pixel by pixel. + nassertv(get_num_components() == 4); + for (int y = 0; y < get_video_height(); ++y) { + int dx = 0; + int sx = 0; + for (int x = 0; x < get_video_width(); ++x) { + dest[dx] = source[sx]; + dest[dx + 1] = source[sx + 1]; + dest[dx + 2] = source[sx + 2]; + dx += 4; + sx += 3; + } + dest += dest_row_width; + source += source_row_width; + } + } } } if (page._alpha.is_valid()) { nassertv(get_num_components() == 4 && get_component_width() == 1); - + const unsigned char *source = page._alpha.get_frame_data(frame); if (source != NULL) { - nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size); - unsigned char *dest = _image.p() + get_expected_ram_page_size() * z; - - int dest_row_width = (_x_size * _num_components * _component_width); - int source_row_width = get_video_width() * 3; - - // Interleave the alpha in with the color, pixel by pixel. - // Even though the alpha will probably be a grayscale video, - // the OpenCV library presents it as RGB. - for (int y = 0; y < get_video_height(); ++y) { - int dx = 3; - int sx = _alpha_file_channel; - for (int x = 0; x < get_video_width(); ++x) { - dest[dx] = source[sx]; - dx += 4; - sx += 3; - } - dest += dest_row_width; - source += source_row_width; - } + nassertv(get_video_width() <= _x_size && get_video_height() <= _y_size); + unsigned char *dest = _image.p() + get_expected_ram_page_size() * z; + + int dest_row_width = (_x_size * _num_components * _component_width); + int source_row_width = get_video_width() * 3; + + // Interleave the alpha in with the color, pixel by pixel. + // Even though the alpha will probably be a grayscale video, + // the OpenCV library presents it as RGB. + for (int y = 0; y < get_video_height(); ++y) { + int dx = 3; + int sx = _alpha_file_channel; + for (int x = 0; x < get_video_width(); ++x) { + dest[dx] = source[sx]; + dx += 4; + sx += 3; + } + dest += dest_row_width; + source += source_row_width; + } } } } diff --git a/panda/src/grutil/openCVTexture.h b/panda/src/grutil/openCVTexture.h index c0bc4188ff..b438812e92 100644 --- a/panda/src/grutil/openCVTexture.h +++ b/panda/src/grutil/openCVTexture.h @@ -48,10 +48,10 @@ PUBLISHED: bool from_camera(int camera_index = -1, int z = 0); virtual bool read(const Filename &fullpath, int z = 0, - int primary_file_num_channels = 0); + int primary_file_num_channels = 0); virtual bool read(const Filename &fullpath, const Filename &alpha_fullpath, - int z = 0, - int primary_file_num_channels = 0, int alpha_file_channel = 0); + int z = 0, + int primary_file_num_channels = 0, int alpha_file_channel = 0); virtual bool load(const PNMImage &pnmimage, int z = 0); public: @@ -66,7 +66,7 @@ private: VideoPage &modify_page(int z); bool reconsider_video_properties(const VideoStream &stream, - int num_components, int z); + int num_components, int z); void do_update(); class VideoStream { diff --git a/panda/src/linmath/compose_matrix_src.I b/panda/src/linmath/compose_matrix_src.I index 6452e144b0..c70df9c791 100644 --- a/panda/src/linmath/compose_matrix_src.I +++ b/panda/src/linmath/compose_matrix_src.I @@ -101,7 +101,7 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &shear, + FLOATNAME(LVecBase3) &shear, FLOATNAME(LVecBase3) &hpr, FLOATNAME(LVecBase3) &translate, CoordinateSystem cs) { diff --git a/panda/src/mathutil/perlinNoise2.I b/panda/src/mathutil/perlinNoise2.I index 6bc65bb439..ce4a1fd300 100644 --- a/panda/src/mathutil/perlinNoise2.I +++ b/panda/src/mathutil/perlinNoise2.I @@ -43,7 +43,7 @@ PerlinNoise2() : //////////////////////////////////////////////////////////////////// INLINE PerlinNoise2:: PerlinNoise2(double sx, double sy, - int table_size, unsigned long seed) : + int table_size, unsigned long seed) : PerlinNoise(table_size, seed) { init_unscaled_xform(); diff --git a/panda/src/mathutil/perlinNoise2.cxx b/panda/src/mathutil/perlinNoise2.cxx index 6d68d0569f..c6c08363be 100644 --- a/panda/src/mathutil/perlinNoise2.cxx +++ b/panda/src/mathutil/perlinNoise2.cxx @@ -77,5 +77,5 @@ init_unscaled_xform() { // And come up with a random translation too, just so the // singularity at (0, 0) is also unpredicatable. _unscaled_xform.set_row(2, LVecBase2d(random_real_unit(), - random_real_unit())); + random_real_unit())); } diff --git a/panda/src/mathutil/perlinNoise2.h b/panda/src/mathutil/perlinNoise2.h index 90193e0400..6f9d3e6d83 100644 --- a/panda/src/mathutil/perlinNoise2.h +++ b/panda/src/mathutil/perlinNoise2.h @@ -33,8 +33,8 @@ class EXPCL_PANDA PerlinNoise2 : public PerlinNoise { PUBLISHED: INLINE PerlinNoise2(); INLINE PerlinNoise2(double sx, double sy, - int table_size = 256, - unsigned long seed = 0); + int table_size = 256, + unsigned long seed = 0); INLINE PerlinNoise2(const PerlinNoise2 ©); INLINE void operator = (const PerlinNoise2 ©); diff --git a/panda/src/mathutil/perlinNoise3.I b/panda/src/mathutil/perlinNoise3.I index 4b4b4e0c69..1880a7be5c 100644 --- a/panda/src/mathutil/perlinNoise3.I +++ b/panda/src/mathutil/perlinNoise3.I @@ -43,7 +43,7 @@ PerlinNoise3() : //////////////////////////////////////////////////////////////////// INLINE PerlinNoise3:: PerlinNoise3(double sx, double sy, double sz, - int table_size, unsigned long seed) : + int table_size, unsigned long seed) : PerlinNoise(table_size, seed) { init_unscaled_xform(); diff --git a/panda/src/mathutil/perlinNoise3.cxx b/panda/src/mathutil/perlinNoise3.cxx index 59c2c65375..d3c4fc745b 100644 --- a/panda/src/mathutil/perlinNoise3.cxx +++ b/panda/src/mathutil/perlinNoise3.cxx @@ -86,15 +86,15 @@ noise(const LVecBase3d &value) const { void PerlinNoise3:: init_unscaled_xform() { LRotationd rot(random_real_unit(), - random_real_unit(), - random_real_unit(), - random_real_unit()); + random_real_unit(), + random_real_unit(), + random_real_unit()); rot.normalize(); rot.extract_to_matrix(_unscaled_xform); // And come up with a random translation too, just so the // singularity at (0, 0, 0) is also unpredicatable. _unscaled_xform.set_row(3, LVecBase3d(random_real_unit(), - random_real_unit(), - random_real_unit())); + random_real_unit(), + random_real_unit())); } diff --git a/panda/src/mathutil/perlinNoise3.h b/panda/src/mathutil/perlinNoise3.h index d08a8489b3..7dff97ecbb 100644 --- a/panda/src/mathutil/perlinNoise3.h +++ b/panda/src/mathutil/perlinNoise3.h @@ -33,7 +33,7 @@ class EXPCL_PANDA PerlinNoise3 : public PerlinNoise { PUBLISHED: INLINE PerlinNoise3(); INLINE PerlinNoise3(double sx, double sy, double sz, - int table_size = 256, unsigned long seed = 0); + int table_size = 256, unsigned long seed = 0); INLINE PerlinNoise3(const PerlinNoise3 ©); INLINE void operator = (const PerlinNoise3 ©); diff --git a/panda/src/parametrics/parametricCurve.cxx b/panda/src/parametrics/parametricCurve.cxx index 1266f68fb6..c53aa1d726 100644 --- a/panda/src/parametrics/parametricCurve.cxx +++ b/panda/src/parametrics/parametricCurve.cxx @@ -796,11 +796,11 @@ r_find_length(float target_length, float &found_t, // Compute t value that corresponds to target_length // Maybe the point is in the left half of the segment? if (r_find_t(target_length, found_t, t1, tmid, p1, pmid)) { - return true; + return true; } // Maybe it's on the right half? if (r_find_t(target_length - left, found_t, tmid, t2, pmid, p2)) { - return true; + return true; } } return false; @@ -908,8 +908,8 @@ r_find_t(float target_length, float &found_t, //////////////////////////////////////////////////////////////////// bool ParametricCurve:: find_t_linear(float target_length, float &found_t, - float t1, float t2, - const LPoint3f &p1, const LPoint3f &p2) const { + float t1, float t2, + const LPoint3f &p1, const LPoint3f &p2) const { const float length_tolerance = (p1-p2).length()/tolerance_divisor; const float t_tolerance = (t1+t2)/tolerance_divisor; @@ -939,8 +939,8 @@ find_t_linear(float target_length, float &found_t, /* if (parametrics_cat.is_spam()) { parametrics_cat.spam() - << "tleft " << tleft << " tright " << tright << - " tmid " << tmid << " len " << len << endl; + << "tleft " << tleft << " tright " << tright << + " tmid " << tmid << " len " << len << endl; } */ @@ -953,7 +953,7 @@ find_t_linear(float target_length, float &found_t, /* if (parametrics_cat.is_spam()) { parametrics_cat.spam() - << "tright-tleft " << tright-tleft << " t_tolerance " << t_tolerance << endl; + << "tright-tleft " << tright-tleft << " t_tolerance " << t_tolerance << endl; } */ diff --git a/panda/src/parametrics/parametricCurve.h b/panda/src/parametrics/parametricCurve.h index 246980dc9c..d58925de8f 100644 --- a/panda/src/parametrics/parametricCurve.h +++ b/panda/src/parametrics/parametricCurve.h @@ -140,8 +140,8 @@ private: float t1, float t2, const LPoint3f &p1, const LPoint3f &p2) const; bool find_t_linear(float target_length, float &found_t, - float t1, float t2, - const LPoint3f &p1, const LPoint3f &p2) const; + float t1, float t2, + const LPoint3f &p1, const LPoint3f &p2) const; protected: int _curve_type; diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index ccf5b89170..621da60276 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -60,7 +60,7 @@ add_texture(Texture *tex, float texels_per_unit, bool resize) { } else { if(tex != (Texture *)NULL) { if (tex != (Texture *)NULL) { - _anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); + _anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); } if(resize) { // We scale the particle size by the size of the texture. diff --git a/panda/src/pgraph/cullTraverser.cxx b/panda/src/pgraph/cullTraverser.cxx index ab570faea5..1e84dbd16a 100644 --- a/panda/src/pgraph/cullTraverser.cxx +++ b/panda/src/pgraph/cullTraverser.cxx @@ -214,12 +214,12 @@ traverse_below(CullTraverserData &data) { _geoms_pcollector.add_level(num_geoms); for (int i = 0; i < num_geoms; i++) { CullableObject *object = new CullableObject(data, geom_node, i); - if (object->_state->has_cull_callback() && - !object->_state->cull_callback(this, data)) { - delete object; - } else { - _cull_handler->record_object(object, this); - } + if (object->_state->has_cull_callback() && + !object->_state->cull_callback(this, data)) { + delete object; + } else { + _cull_handler->record_object(object, this); + } } } @@ -541,7 +541,7 @@ start_decal(const CullTraverserData &data) { CullableObject *next_object = new CullableObject(data, geom_node, i, object); if (next_object->_state->has_cull_callback() && - !next_object->_state->cull_callback(this, data)) { + !next_object->_state->cull_callback(this, data)) { next_object->_next = NULL; delete next_object; } else { @@ -607,15 +607,15 @@ r_get_decals(CullTraverserData &data, CullableObject *decals) { int num_geoms = geom_node->get_num_geoms(); _geoms_pcollector.add_level(num_geoms); for (int i = num_geoms - 1; i >= 0; i--) { - CullableObject *next_decals = - new CullableObject(data, geom_node, i, decals); - if (next_decals->_state->has_cull_callback() && - !next_decals->_state->cull_callback(this, data)) { + CullableObject *next_decals = + new CullableObject(data, geom_node, i, decals); + if (next_decals->_state->has_cull_callback() && + !next_decals->_state->cull_callback(this, data)) { next_decals->_next = NULL; - delete next_decals; - } else { - decals = next_decals; - } + delete next_decals; + } else { + decals = next_decals; + } } } } diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index af9c8552f2..f51dc395ca 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -91,10 +91,10 @@ munge_geom(GraphicsStateGuardianBase *gsg, // the vertices in the CPU--and we have to do it before we call // munge_geom(), which might lose the tangent and binormal. CPT(GeomVertexData) animated_vertices = - _munged_data->animate_vertices(); + _munged_data->animate_vertices(); if (animated_vertices != _munged_data) { - cpu_animated = true; - _munged_data = animated_vertices; + cpu_animated = true; + _munged_data = animated_vertices; } munge_texcoord_light_vector(traverser); } @@ -113,10 +113,10 @@ munge_geom(GraphicsStateGuardianBase *gsg, // animation in hardware--then we have to calculate that // animation now. CPT(GeomVertexData) animated_vertices = - _munged_data->animate_vertices(); + _munged_data->animate_vertices(); if (animated_vertices != _munged_data) { - cpu_animated = true; - _munged_data = animated_vertices; + cpu_animated = true; + _munged_data = animated_vertices; } } @@ -212,8 +212,8 @@ munge_points_to_quads(const CullTraverser *traverser) { PT(GeomVertexArrayFormat) new_array_format = new GeomVertexArrayFormat(InternalName::get_vertex(), 4, - Geom::NT_float32, - Geom::C_clip_point); + Geom::NT_float32, + Geom::C_clip_point); if (has_normal) { const GeomVertexColumn *c = normal.get_column(); new_array_format->add_column @@ -316,27 +316,27 @@ munge_points_to_quads(const CullTraverser *traverser) { unsigned int *vertices_end = vertices + num_vertices; if (primitive->is_indexed()) { - GeomVertexReader index(primitive->get_vertices(), 0); - for (unsigned int *vi = vertices; vi != vertices_end; ++vi) { - // Get the point in eye-space coordinates. - unsigned int v = index.get_data1i(); - nassertv(v < (unsigned int)num_points); - (*vi) = v; - vertex.set_row(v); - points[v]._eye = modelview.xform_point(vertex.get_data3f()); - points[v]._dist = gsg->compute_distance_to(points[v]._eye); - } + GeomVertexReader index(primitive->get_vertices(), 0); + for (unsigned int *vi = vertices; vi != vertices_end; ++vi) { + // Get the point in eye-space coordinates. + unsigned int v = index.get_data1i(); + nassertv(v < (unsigned int)num_points); + (*vi) = v; + vertex.set_row(v); + points[v]._eye = modelview.xform_point(vertex.get_data3f()); + points[v]._dist = gsg->compute_distance_to(points[v]._eye); + } } else { - // Nonindexed case. - unsigned int first_vertex = primitive->get_first_vertex(); - for (int i = 0; i < num_vertices; ++i) { - unsigned int v = i + first_vertex; - nassertv(v < (unsigned int)num_points); - vertices[i] = v; - vertex.set_row(v); - points[v]._eye = modelview.xform_point(vertex.get_data3f()); - points[v]._dist = gsg->compute_distance_to(points[v]._eye); - } + // Nonindexed case. + unsigned int first_vertex = primitive->get_first_vertex(); + for (int i = 0; i < num_vertices; ++i) { + unsigned int v = i + first_vertex; + nassertv(v < (unsigned int)num_points); + vertices[i] = v; + vertex.set_row(v); + points[v]._eye = modelview.xform_point(vertex.get_data3f()); + points[v]._dist = gsg->compute_distance_to(points[v]._eye); + } } // Now sort the points in order from back-to-front so they will @@ -352,111 +352,111 @@ munge_points_to_quads(const CullTraverser *traverser) { PT(GeomPrimitive) new_primitive = new GeomTriangles(Geom::UH_client); for (unsigned int *vi = vertices; vi != vertices_end; ++vi) { - // The point in eye coordinates. - const LPoint3f &eye = points[*vi]._eye; + // The point in eye coordinates. + const LPoint3f &eye = points[*vi]._eye; - // The point in clip coordinates. - LPoint4f p4 = LPoint4f(eye[0], eye[1], eye[2], 1.0f) * projection; + // The point in clip coordinates. + LPoint4f p4 = LPoint4f(eye[0], eye[1], eye[2], 1.0f) * projection; - if (has_size) { - size.set_row(*vi); - point_size = size.get_data1f(); - } + if (has_size) { + size.set_row(*vi); + point_size = size.get_data1f(); + } - float scale_y = point_size; - if (perspective) { - // Perspective-sized points. Here point_size is the point's - // height in 3-d units. To arrange that, we need to figure - // out the appropriate scaling factor based on the current - // viewport and projection matrix. - float scale = _modelview_transform->get_scale()[1]; - LVector3f height(0.0f, point_size * scale, scale); - height = height * height_projection; - scale_y = height[1] * viewport_height; + float scale_y = point_size; + if (perspective) { + // Perspective-sized points. Here point_size is the point's + // height in 3-d units. To arrange that, we need to figure + // out the appropriate scaling factor based on the current + // viewport and projection matrix. + float scale = _modelview_transform->get_scale()[1]; + LVector3f height(0.0f, point_size * scale, scale); + height = height * height_projection; + scale_y = height[1] * viewport_height; - // We should then divide the radius by the distance from the - // camera plane, to emulate the glPointParameters() behavior. - if (!lens->is_orthographic()) { - scale_y /= gsg->compute_distance_to(eye); - } - } + // We should then divide the radius by the distance from the + // camera plane, to emulate the glPointParameters() behavior. + if (!lens->is_orthographic()) { + scale_y /= gsg->compute_distance_to(eye); + } + } - // Also factor in the homogeneous scale for being in clip - // coordinates still. - scale_y *= p4[3]; + // Also factor in the homogeneous scale for being in clip + // coordinates still. + scale_y *= p4[3]; - float scale_x = scale_y; - if (has_aspect_ratio) { - aspect_ratio.set_row(*vi); - scale_x *= aspect_ratio.get_data1f(); - } + float scale_x = scale_y; + if (has_aspect_ratio) { + aspect_ratio.set_row(*vi); + scale_x *= aspect_ratio.get_data1f(); + } - // Define the first two corners based on the scales in X and Y. - LPoint2f c0(scale_x, scale_y); - LPoint2f c1(-scale_x, scale_y); + // Define the first two corners based on the scales in X and Y. + LPoint2f c0(scale_x, scale_y); + LPoint2f c1(-scale_x, scale_y); - if (has_rotate) { - // If we have a rotate factor, apply it to those two corners. - rotate.set_row(*vi); - float r = rotate.get_data1f(); - LMatrix3f mat = LMatrix3f::rotate_mat(r); - c0 = c0 * mat; - c1 = c1 * mat; - } + if (has_rotate) { + // If we have a rotate factor, apply it to those two corners. + rotate.set_row(*vi); + float r = rotate.get_data1f(); + LMatrix3f mat = LMatrix3f::rotate_mat(r); + c0 = c0 * mat; + c1 = c1 * mat; + } - // Finally, scale the corners in their newly-rotated position, - // to compensate for the aspect ratio of the viewport. - float rx = 1.0f / viewport_width; - float ry = 1.0f / viewport_height; - c0.set(c0[0] * rx, c0[1] * ry); - c1.set(c1[0] * rx, c1[1] * ry); + // Finally, scale the corners in their newly-rotated position, + // to compensate for the aspect ratio of the viewport. + float rx = 1.0f / viewport_width; + float ry = 1.0f / viewport_height; + c0.set(c0[0] * rx, c0[1] * ry); + c1.set(c1[0] * rx, c1[1] * ry); - new_vertex.add_data4f(p4[0] + c0[0], p4[1] + c0[1], p4[2], p4[3]); - new_vertex.add_data4f(p4[0] + c1[0], p4[1] + c1[1], p4[2], p4[3]); - new_vertex.add_data4f(p4[0] - c1[0], p4[1] - c1[1], p4[2], p4[3]); - new_vertex.add_data4f(p4[0] - c0[0], p4[1] - c0[1], p4[2], p4[3]); + new_vertex.add_data4f(p4[0] + c0[0], p4[1] + c0[1], p4[2], p4[3]); + new_vertex.add_data4f(p4[0] + c1[0], p4[1] + c1[1], p4[2], p4[3]); + new_vertex.add_data4f(p4[0] - c1[0], p4[1] - c1[1], p4[2], p4[3]); + new_vertex.add_data4f(p4[0] - c0[0], p4[1] - c0[1], p4[2], p4[3]); - if (has_normal) { - normal.set_row(*vi); - Normalf c = render_transform.xform_vec(normal.get_data3f()); - new_normal.add_data3f(c); - new_normal.add_data3f(c); - new_normal.add_data3f(c); - new_normal.add_data3f(c); - } - if (has_color) { - color.set_row(*vi); - const Colorf &c = color.get_data4f(); - new_color.add_data4f(c); - new_color.add_data4f(c); - new_color.add_data4f(c); - new_color.add_data4f(c); - } - if (sprite_texcoord) { - new_texcoord.add_data2f(1.0f, 0.0f); - new_texcoord.add_data2f(0.0f, 0.0f); - new_texcoord.add_data2f(1.0f, 1.0f); - new_texcoord.add_data2f(0.0f, 1.0f); - } else if (has_texcoord) { - texcoord.set_row(*vi); - const LVecBase4f &c = texcoord.get_data4f(); - new_texcoord.add_data4f(c); - new_texcoord.add_data4f(c); - new_texcoord.add_data4f(c); - new_texcoord.add_data4f(c); - } + if (has_normal) { + normal.set_row(*vi); + Normalf c = render_transform.xform_vec(normal.get_data3f()); + new_normal.add_data3f(c); + new_normal.add_data3f(c); + new_normal.add_data3f(c); + new_normal.add_data3f(c); + } + if (has_color) { + color.set_row(*vi); + const Colorf &c = color.get_data4f(); + new_color.add_data4f(c); + new_color.add_data4f(c); + new_color.add_data4f(c); + new_color.add_data4f(c); + } + if (sprite_texcoord) { + new_texcoord.add_data2f(1.0f, 0.0f); + new_texcoord.add_data2f(0.0f, 0.0f); + new_texcoord.add_data2f(1.0f, 1.0f); + new_texcoord.add_data2f(0.0f, 1.0f); + } else if (has_texcoord) { + texcoord.set_row(*vi); + const LVecBase4f &c = texcoord.get_data4f(); + new_texcoord.add_data4f(c); + new_texcoord.add_data4f(c); + new_texcoord.add_data4f(c); + new_texcoord.add_data4f(c); + } - new_primitive->add_vertex(new_vi); - new_primitive->add_vertex(new_vi + 1); - new_primitive->add_vertex(new_vi + 2); - new_primitive->close_primitive(); + new_primitive->add_vertex(new_vi); + new_primitive->add_vertex(new_vi + 1); + new_primitive->add_vertex(new_vi + 2); + new_primitive->close_primitive(); - new_primitive->add_vertex(new_vi + 2); - new_primitive->add_vertex(new_vi + 1); - new_primitive->add_vertex(new_vi + 3); - new_primitive->close_primitive(); + new_primitive->add_vertex(new_vi + 2); + new_primitive->add_vertex(new_vi + 1); + new_primitive->add_vertex(new_vi + 3); + new_primitive->close_primitive(); - new_vi += 4; + new_vi += 4; } new_geom->add_primitive(new_primitive); @@ -508,15 +508,15 @@ munge_texcoord_light_vector(const CullTraverser *traverser) { // use the most important light in the current state. CPT(RenderAttrib) attrib = _state->get_attrib(LightAttrib::get_class_type()); if (attrib != (RenderAttrib *)NULL) { - CPT(LightAttrib) la = DCAST(LightAttrib, attrib); - light = la->get_most_important_light(); - /* - if (!light.is_empty()) { - // Remove that light, now that we're accounting for it in - // the normal map. - _state->set_attrib(la->remove_on_light(light)); - } - */ + CPT(LightAttrib) la = DCAST(LightAttrib, attrib); + light = la->get_most_important_light(); + /* + if (!light.is_empty()) { + // Remove that light, now that we're accounting for it in + // the normal map. + _state->set_attrib(la->remove_on_light(light)); + } + */ } } if (!light.is_empty()) { @@ -532,38 +532,38 @@ munge_texcoord_light_vector(const CullTraverser *traverser) { CPT(InternalName) texcoord_name = stage->get_texcoord_name(); if (_munged_data->has_column(tangent_name) && - _munged_data->has_column(binormal_name)) { - // Create a new column for the new texcoords. - PT(GeomVertexData) new_data = _munged_data->replace_column - (texcoord_name, 3, Geom::NT_float32, Geom::C_texcoord); - _munged_data = new_data; - - // Remove this TexGen stage from the state, since we're handling - // it now. - _state = _state->add_attrib(tex_gen->remove_stage(stage)); - - // Get the transform from the light to the object. - CPT(TransformState) light_transform = - net_transform->invert_compose(light.get_net_transform()); - const LMatrix4f &light_mat = light_transform->get_mat(); - - GeomVertexWriter texcoord(new_data, texcoord_name); - GeomVertexReader vertex(new_data, InternalName::get_vertex()); - GeomVertexReader tangent(new_data, tangent_name); - GeomVertexReader binormal(new_data, binormal_name); - GeomVertexReader normal(new_data, InternalName::get_normal()); - - while (!vertex.is_at_end()) { - LPoint3f p = vertex.get_data3f(); - LVector3f t = tangent.get_data3f(); - LVector3f b = binormal.get_data3f(); - LVector3f n = normal.get_data3f(); - - LVector3f lv; - if (light_obj->get_vector_to_light(lv, p, light_mat)) { - texcoord.add_data3f(lv.dot(t), lv.dot(b), lv.dot(n)); - } - } + _munged_data->has_column(binormal_name)) { + // Create a new column for the new texcoords. + PT(GeomVertexData) new_data = _munged_data->replace_column + (texcoord_name, 3, Geom::NT_float32, Geom::C_texcoord); + _munged_data = new_data; + + // Remove this TexGen stage from the state, since we're handling + // it now. + _state = _state->add_attrib(tex_gen->remove_stage(stage)); + + // Get the transform from the light to the object. + CPT(TransformState) light_transform = + net_transform->invert_compose(light.get_net_transform()); + const LMatrix4f &light_mat = light_transform->get_mat(); + + GeomVertexWriter texcoord(new_data, texcoord_name); + GeomVertexReader vertex(new_data, InternalName::get_vertex()); + GeomVertexReader tangent(new_data, tangent_name); + GeomVertexReader binormal(new_data, binormal_name); + GeomVertexReader normal(new_data, InternalName::get_normal()); + + while (!vertex.is_at_end()) { + LPoint3f p = vertex.get_data3f(); + LVector3f t = tangent.get_data3f(); + LVector3f b = binormal.get_data3f(); + LVector3f n = normal.get_data3f(); + + LVector3f lv; + if (light_obj->get_vector_to_light(lv, p, light_mat)) { + texcoord.add_data3f(lv.dot(t), lv.dot(b), lv.dot(n)); + } + } } } } diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index fb01c2bda9..2b73ec4c35 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -565,7 +565,7 @@ get_most_important_light() const { nassertr(!np.is_empty() && np.node()->as_light() != (Light *)NULL, NodePath()); if (!np.node()->is_exact_type(AmbientLight::get_class_type())) { if (best.is_empty() || compare(np, best)) { - best = np; + best = np; } } } diff --git a/panda/src/pgraph/loader.h b/panda/src/pgraph/loader.h index 4676315a26..52a71adbf2 100644 --- a/panda/src/pgraph/loader.h +++ b/panda/src/pgraph/loader.h @@ -73,7 +73,7 @@ PUBLISHED: Results &results) const; INLINE PT(PandaNode) load_sync(const Filename &filename, - const LoaderOptions &options = LoaderOptions()) const; + const LoaderOptions &options = LoaderOptions()) const; uint request_load(const string &event_name, const Filename &filename, bool search = true); bool check_load(uint id); diff --git a/panda/src/pgraph/nodePath.cxx b/panda/src/pgraph/nodePath.cxx index 1c5342fc2c..d75e725fac 100644 --- a/panda/src/pgraph/nodePath.cxx +++ b/panda/src/pgraph/nodePath.cxx @@ -3780,7 +3780,7 @@ project_texture(TextureStage *stage, Texture *tex, const NodePath &projector) { //////////////////////////////////////////////////////////////////// void NodePath:: set_normal_map(Texture *normal_map, const string &texcoord_name, - bool preserve_color) { + bool preserve_color) { clear_normal_map(); // First, we apply the normal map itself, to the bottom layer. @@ -3804,7 +3804,7 @@ set_normal_map(Texture *normal_map, const string &texcoord_name, // Finally, we enable M_light_vector texture coordinate generation. set_tex_gen(normalization_map_ts, TexGenAttrib::M_light_vector, - texcoord_name, NodePath()); + texcoord_name, NodePath()); if (preserve_color) { // One more stage to get back the original color. @@ -3836,14 +3836,14 @@ clear_normal_map() { for (int i = 0; i < ta->get_num_on_stages(); i++) { TextureStage *stage = ta->get_on_stage(i); if (stage->get_name() == "__normal_map") { - clear_texture(stage); + clear_texture(stage); } else if (stage->get_name() == "__normalization_map") { - clear_texture(stage); - clear_tex_gen(stage); + clear_texture(stage); + clear_tex_gen(stage); } else if (stage->get_name() == "__orig_color") { - clear_texture(stage); + clear_texture(stage); } } } @@ -5783,7 +5783,7 @@ r_has_vertex_column(PandaNode *node, const InternalName *name) const { const Geom *geom = gnode->get_geom(i); CPT(GeomVertexData) vdata = geom->get_vertex_data(); if (vdata->has_column(name)) { - return true; + return true; } } } diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 1f11f63536..465fa69b74 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -643,7 +643,7 @@ PUBLISHED: INLINE void clear_project_texture(TextureStage *stage); void set_normal_map(Texture *normal_map, const string &texcoord_name = string(), - bool preserve_color = false); + bool preserve_color = false); void clear_normal_map(); INLINE bool has_texcoord(const string &texcoord_name) const; diff --git a/panda/src/pgraph/nodePathLerps.h b/panda/src/pgraph/nodePathLerps.h index f0c7f96364..ab4054bd65 100644 --- a/panda/src/pgraph/nodePathLerps.h +++ b/panda/src/pgraph/nodePathLerps.h @@ -326,8 +326,8 @@ private: PUBLISHED: HprScaleLerpFunctor(NodePath np, - LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, - LVecBase3f send) + LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, + LVecBase3f send) : LerpFunctor(), _node_path(np), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _sstart(sstart), _send(send), @@ -340,15 +340,15 @@ PUBLISHED: _hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz), _send(sex, sey, sez), _sdiff_cache(_send-_sstart), _is_wrt(false) {} HprScaleLerpFunctor(NodePath np, - LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, - LVecBase3f send, NodePath wrt) + LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, + LVecBase3f send, NodePath wrt) : LerpFunctor(), _node_path(np), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _sstart(sstart), _send(send), _sdiff_cache(send-sstart), _is_wrt(true), _wrt_path(wrt) {} HprScaleLerpFunctor(NodePath np, float hsx, float hsy, - float hsz, float hex, float hey, float hez, float ssx, - float ssy, float ssz, float sex, float sey, float sez, - NodePath wrt) + float hsz, float hex, float hey, float hez, float ssx, + float ssy, float ssz, float sex, float sey, float sez, + NodePath wrt) : LerpFunctor(), _node_path(np), _hstart(hsx, hsy, hsz), _hend(hex, hey, hez), _hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz), diff --git a/panda/src/pgraph/sequenceNode.h b/panda/src/pgraph/sequenceNode.h index 696d2b2144..057c00d145 100644 --- a/panda/src/pgraph/sequenceNode.h +++ b/panda/src/pgraph/sequenceNode.h @@ -68,7 +68,7 @@ public: AnimInterface::init_type(); register_type(_type_handle, "SequenceNode", SelectiveChildNode::get_class_type(), - AnimInterface::get_class_type()); + AnimInterface::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/pgraph/texGenAttrib.cxx b/panda/src/pgraph/texGenAttrib.cxx index e7c6a2dc66..75b6ad4a56 100755 --- a/panda/src/pgraph/texGenAttrib.cxx +++ b/panda/src/pgraph/texGenAttrib.cxx @@ -494,17 +494,17 @@ record_stage(TextureStage *stage, TexGenAttrib::ModeDef &mode_def) { case M_light_vector: { if (!mode_def._light.is_empty()) { - Light *light_obj = mode_def._light.node()->as_light(); - if (light_obj == (Light *)NULL) { + Light *light_obj = mode_def._light.node()->as_light(); + if (light_obj == (Light *)NULL) { #ifndef NDEBUG - ostringstream strm; - strm << "Not a light: " << mode_def._light; - nassert_raise(strm.str()); + ostringstream strm; + strm << "Not a light: " << mode_def._light; + nassert_raise(strm.str()); #endif - mode_def._light = NodePath(); - } + mode_def._light = NodePath(); + } } - + _light_vectors.insert(stage); _geom_rendering |= Geom::GR_texcoord_light_vector; _num_light_vectors++; diff --git a/panda/src/pgraph/textureAttrib.cxx b/panda/src/pgraph/textureAttrib.cxx index b2691646d7..023998d944 100644 --- a/panda/src/pgraph/textureAttrib.cxx +++ b/panda/src/pgraph/textureAttrib.cxx @@ -560,7 +560,7 @@ compose_impl(const RenderAttrib *other) const { if ((*ai).first < (*ci)) { // Here is a stage that we have in the original, which is not // present in the secondary. - new_attrib->_on_textures.insert(new_attrib->_on_textures.end(), *ai); + new_attrib->_on_textures.insert(new_attrib->_on_textures.end(), *ai); new_attrib->_on_stages.push_back((*ai).first); ++ai; diff --git a/panda/src/pgraph/transformState.cxx b/panda/src/pgraph/transformState.cxx index c050be748b..53ac761ef0 100644 --- a/panda/src/pgraph/transformState.cxx +++ b/panda/src/pgraph/transformState.cxx @@ -469,8 +469,8 @@ set_scale(const LVecBase3f &scale) const { // Don't inflate from 2-d to 3-d just because we got a uniform // scale. return make_pos_rotate_scale_shear2d(get_pos2d(), get_rotate2d(), - LVecBase2f(scale[0], scale[0]), - get_shear2d()); + LVecBase2f(scale[0], scale[0]), + get_shear2d()); } // nassertr(has_components(), this); diff --git a/panda/src/pgui/pgFrameStyle.cxx b/panda/src/pgui/pgFrameStyle.cxx index 5616f7f12e..626c24522c 100644 --- a/panda/src/pgui/pgFrameStyle.cxx +++ b/panda/src/pgui/pgFrameStyle.cxx @@ -160,7 +160,7 @@ xform(const LMatrix4f &mat) { //////////////////////////////////////////////////////////////////// NodePath PGFrameStyle:: generate_into(const NodePath &parent, const LVecBase4f &frame, - int sort) { + int sort) { PT(PandaNode) new_node; LPoint2f center((frame[0] + frame[1]) / 2.0f, diff --git a/panda/src/pgui/pgFrameStyle.h b/panda/src/pgui/pgFrameStyle.h index 6e8cedd0b2..acc1b40b5e 100644 --- a/panda/src/pgui/pgFrameStyle.h +++ b/panda/src/pgui/pgFrameStyle.h @@ -76,7 +76,7 @@ PUBLISHED: public: bool xform(const LMatrix4f &mat); NodePath generate_into(const NodePath &parent, const LVecBase4f &frame, - int sort = 0); + int sort = 0); private: PT(PandaNode) generate_flat_geom(const LVecBase4f &frame); diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index 947f426226..19570a1eca 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -162,7 +162,7 @@ read(const Filename &filename, PNMFileType *type, bool report_unknown_type) { clear(); PNMReader *reader = PNMImageHeader::make_reader(filename, type, - report_unknown_type); + report_unknown_type); if (reader == (PNMReader *)NULL) { return false; } diff --git a/panda/src/pnmimage/pnmImage.h b/panda/src/pnmimage/pnmImage.h index d4ff2e4a40..3ace68c0e0 100644 --- a/panda/src/pnmimage/pnmImage.h +++ b/panda/src/pnmimage/pnmImage.h @@ -88,10 +88,10 @@ PUBLISHED: void alpha_fill_val(xelval alpha = 0); bool read(const Filename &filename, PNMFileType *type = NULL, - bool report_unknown_type = true); + bool report_unknown_type = true); bool read(istream &data, const string &filename = string(), PNMFileType *type = NULL, - bool report_unknown_type = true); + bool report_unknown_type = true); bool read(PNMReader *reader); bool write(const Filename &filename, PNMFileType *type = NULL) const; diff --git a/panda/src/pnmimage/pnmImageHeader.cxx b/panda/src/pnmimage/pnmImageHeader.cxx index f7add336f2..d9fc0d9cb8 100644 --- a/panda/src/pnmimage/pnmImageHeader.cxx +++ b/panda/src/pnmimage/pnmImageHeader.cxx @@ -59,7 +59,7 @@ read_header(const Filename &filename, PNMFileType *type) { //////////////////////////////////////////////////////////////////// PNMReader *PNMImageHeader:: make_reader(const Filename &filename, PNMFileType *type, - bool report_unknown_type) const { + bool report_unknown_type) const { if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() << "Reading image from " << filename << "\n"; @@ -90,7 +90,7 @@ make_reader(const Filename &filename, PNMFileType *type, } return make_reader(file, owns_file, filename, string(), type, - report_unknown_type); + report_unknown_type); } @@ -126,7 +126,7 @@ make_reader(const Filename &filename, PNMFileType *type, PNMReader *PNMImageHeader:: make_reader(istream *file, bool owns_file, const Filename &filename, string magic_number, PNMFileType *type, - bool report_unknown_type) const { + bool report_unknown_type) const { if (type == (PNMFileType *)NULL) { if (!read_magic_number(file, magic_number, 2)) { // No magic number. No image. diff --git a/panda/src/pnmimage/pnmImageHeader.h b/panda/src/pnmimage/pnmImageHeader.h index 925616d2a3..5bd3eebc33 100644 --- a/panda/src/pnmimage/pnmImageHeader.h +++ b/panda/src/pnmimage/pnmImageHeader.h @@ -80,12 +80,12 @@ PUBLISHED: PNMReader *make_reader(const Filename &filename, PNMFileType *type = NULL, - bool report_unknown_type = true) const; + bool report_unknown_type = true) const; PNMReader *make_reader(istream *file, bool owns_file = true, const Filename &filename = Filename(), string magic_number = string(), PNMFileType *type = NULL, - bool report_unknown_type = true) const; + bool report_unknown_type = true) const; PNMWriter *make_writer(const Filename &filename, PNMFileType *type = NULL) const; diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx index 76427bcdf2..76306bed18 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx @@ -55,16 +55,16 @@ extern "C" { /* Expanded data source object for stdio input */ typedef struct { - struct jpeg_source_mgr pub; /* public fields */ + struct jpeg_source_mgr pub; /* public fields */ - istream * infile; /* source stream */ - JOCTET * buffer; /* start of buffer */ - boolean start_of_file; /* have we gotten any data yet? */ + istream * infile; /* source stream */ + JOCTET * buffer; /* start of buffer */ + boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; -#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ +#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ /* @@ -128,7 +128,7 @@ fill_input_buffer (j_decompress_ptr cinfo) nbytes = src->infile->gcount(); if (nbytes <= 0) { - if (src->start_of_file) /* Treat empty input file as fatal error */ + if (src->start_of_file) /* Treat empty input file as fatal error */ ERREXIT(cinfo, JERR_INPUT_EMPTY); WARNMS(cinfo, JWRN_JPEG_EOF); /* Insert a fake EOI marker */ @@ -223,14 +223,14 @@ jpeg_istream_src (j_decompress_ptr cinfo, istream * infile) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ - if (cinfo->src == NULL) { /* first time for this JPEG object? */ + if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(my_source_mgr)); + sizeof(my_source_mgr)); src = (my_src_ptr) cinfo->src; src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - INPUT_BUF_SIZE * sizeof(JOCTET)); + INPUT_BUF_SIZE * sizeof(JOCTET)); } src = (my_src_ptr) cinfo->src; diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx index ca66a3f45e..9286be067d 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPGWriter.cxx @@ -60,13 +60,13 @@ extern "C" { typedef struct { struct jpeg_destination_mgr pub; /* public fields */ - ostream * outfile; /* target stream */ - JOCTET * buffer; /* start of buffer */ + ostream * outfile; /* target stream */ + JOCTET * buffer; /* start of buffer */ } my_destination_mgr; typedef my_destination_mgr * my_dest_ptr; -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ +#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ /* @@ -82,7 +82,7 @@ init_destination (j_compress_ptr cinfo) /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - OUTPUT_BUF_SIZE * sizeof(JOCTET)); + OUTPUT_BUF_SIZE * sizeof(JOCTET)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; @@ -171,10 +171,10 @@ jpeg_ostream_dest (j_compress_ptr cinfo, ostream * outfile) * manager serially with the same JPEG object, because their private object * sizes may be different. Caveat programmer. */ - if (cinfo->dest == NULL) { /* first time for this JPEG object? */ + if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, - sizeof(my_destination_mgr)); + sizeof(my_destination_mgr)); } dest = (my_dest_ptr) cinfo->dest; diff --git a/panda/src/putil/animInterface.cxx b/panda/src/putil/animInterface.cxx index 5df6fd15c2..03e1072c37 100644 --- a/panda/src/putil/animInterface.cxx +++ b/panda/src/putil/animInterface.cxx @@ -391,9 +391,9 @@ get_full_fframe() const { nassertr(_play_frames >= 0.0, 0.0); double f = cmod(get_f(), _play_frames * 2.0); if (f > _play_frames) { - return (_play_frames * 2.0 - f) + _start_frame; + return (_play_frames * 2.0 - f) + _start_frame; } else { - return f + _start_frame; + return f + _start_frame; } } } diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index 966342b799..06234f58cc 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -1032,19 +1032,19 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) { // See if we have the pointer available now. CreatedObjs::const_iterator oi = _created_objs.find(child_id); if (oi == _created_objs.end()) { - // No, too bad. - is_complete = false; - + // No, too bad. + is_complete = false; + } else { - const CreatedObj &child_obj = (*oi).second; - if (child_obj._change_this != NULL) { - // It's been created, but the pointer might still change. - is_complete = false; - - } else { - // Yes, it's ready. - references.push_back(child_obj._ptr); - } + const CreatedObj &child_obj = (*oi).second; + if (child_obj._change_this != NULL) { + // It's been created, but the pointer might still change. + is_complete = false; + + } else { + // Yes, it's ready. + references.push_back(child_obj._ptr); + } } } } @@ -1054,8 +1054,8 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) { int num_completed = object->complete_pointers(&references[0], this); if (num_completed != (int)references.size()) { bam_cat.warning() - << object->get_type() << " completed " << num_completed - << " of " << references.size() << " pointers.\n"; + << object->get_type() << " completed " << num_completed + << " of " << references.size() << " pointers.\n"; } return true; } @@ -1073,7 +1073,7 @@ resolve_object_pointers(TypedWritable *object, const vector_int &pointer_ids) { //////////////////////////////////////////////////////////////////// bool BamReader:: resolve_cycler_pointers(PipelineCyclerBase *cycler, - const vector_int &pointer_ids) { + const vector_int &pointer_ids) { // Now make sure we have all of the pointers this cycler is // waiting for. If any of the pointers has not yet been read // in, we can't resolve this cycler--we can't do anything for a @@ -1095,19 +1095,19 @@ resolve_cycler_pointers(PipelineCyclerBase *cycler, // See if we have the pointer available now. CreatedObjs::const_iterator oi = _created_objs.find(child_id); if (oi == _created_objs.end()) { - // No, too bad. - is_complete = false; - + // No, too bad. + is_complete = false; + } else { - const CreatedObj &child_obj = (*oi).second; - if (child_obj._change_this != NULL) { - // It's been created, but the pointer might still change. - is_complete = false; - - } else { - // Yes, it's ready. - references.push_back(child_obj._ptr); - } + const CreatedObj &child_obj = (*oi).second; + if (child_obj._change_this != NULL) { + // It's been created, but the pointer might still change. + is_complete = false; + + } else { + // Yes, it's ready. + references.push_back(child_obj._ptr); + } } } } @@ -1119,8 +1119,8 @@ resolve_cycler_pointers(PipelineCyclerBase *cycler, cycler->release_write(cdata); if (num_completed != (int)references.size()) { bam_cat.warning() - << "CycleData object completed " << num_completed - << " of " << references.size() << " pointers.\n"; + << "CycleData object completed " << num_completed + << " of " << references.size() << " pointers.\n"; } return true; } diff --git a/panda/src/putil/test_uniqueIdAllocator.cxx b/panda/src/putil/test_uniqueIdAllocator.cxx index 4a05f6c4af..be39a01450 100644 --- a/panda/src/putil/test_uniqueIdAllocator.cxx +++ b/panda/src/putil/test_uniqueIdAllocator.cxx @@ -10,37 +10,37 @@ using namespace std; int _tmain(int argc, _TCHAR* argv[]) { - cout <<"UniqueIdAllocator Test"<load_models(framework.get_models(), argc, argv); if (delete_models) { - for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) { - Filename model = Filename::from_os_specific(argv[i]); - if (model.exists()) { - nout << "Deleting " << model << "\n"; - model.unlink(); - } - } + for (int i = 1; i < argc && argv[i] != (char *)NULL; i++) { + Filename model = Filename::from_os_specific(argv[i]); + if (model.exists()) { + nout << "Deleting " << model << "\n"; + model.unlink(); + } + } } } window->loop_animations(hierarchy_match_flags); diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 74bf0843e1..b96f88232e 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -41,82 +41,82 @@ ConfigureFn(config_text) { ConfigVariableBool text_flatten ("text-flatten", true, PRC_DESC("Set this true to flatten text when it is generated, or false to " - "keep it as a deep hierarchy. Unless you are debugging the text " - "interface, it is almost always a good idea to leave this at " - "its default, true.")); + "keep it as a deep hierarchy. Unless you are debugging the text " + "interface, it is almost always a good idea to leave this at " + "its default, true.")); ConfigVariableInt text_anisotropic_degree ("text-anisotropic-degree", 1, PRC_DESC("This is the default anisotropic-degree that is set on dynamic " - "font textures. Setting this to a value greater than 1 can help " - "smooth out the antialiasing for small letters.")); + "font textures. Setting this to a value greater than 1 can help " + "smooth out the antialiasing for small letters.")); ConfigVariableInt text_texture_margin ("text-texture-margin", 2, PRC_DESC("This is the number of texels of empty space reserved around each " - "glyph in the texture. Setting this value larger will decrease " - "the tendency for adjacent glyphs to bleed into each other at " - "small sizes, but it will increase amount of wasted texture " - "memory.")); + "glyph in the texture. Setting this value larger will decrease " + "the tendency for adjacent glyphs to bleed into each other at " + "small sizes, but it will increase amount of wasted texture " + "memory.")); ConfigVariableDouble text_poly_margin ("text-poly-margin", 0.0f, PRC_DESC("This is the amount by which to make each glyph polygon larger " - "than strictly necessary, in screen units that are added to each " - "margin. Increasing this value will decrease the tendency for " - "letters to get chopped off at the edges, but it will also " - "increase the tendency for adjacent glyphs to bleed into each " - "other (unless you also increase text-texture-margin).")); + "than strictly necessary, in screen units that are added to each " + "margin. Increasing this value will decrease the tendency for " + "letters to get chopped off at the edges, but it will also " + "increase the tendency for adjacent glyphs to bleed into each " + "other (unless you also increase text-texture-margin).")); ConfigVariableInt text_page_size ("text-page-size", "256 256", PRC_DESC("This is the default size for new textures created for dynamic " - "fonts.")); + "fonts.")); ConfigVariableBool text_small_caps ("text-small-caps", false, PRC_DESC("This controls the default setting for " - "TextNode::set_small_caps().")); + "TextNode::set_small_caps().")); ConfigVariableDouble text_small_caps_scale ("text-small-caps-scale", 0.8f, PRC_DESC("This controls the default setting for " - "TextNode::set_small_caps_scale().")); + "TextNode::set_small_caps_scale().")); ConfigVariableFilename text_default_font ("text-default-font", "", PRC_DESC("This names a filename that will be loaded at startup time as " - "the default font for any TextNode that does not specify a font " - "otherwise. The default is to use a special font that is " - "compiled into Panda, if available.")); + "the default font for any TextNode that does not specify a font " + "otherwise. The default is to use a special font that is " + "compiled into Panda, if available.")); ConfigVariableDouble text_tab_width ("text-tab-width", 5.0f, PRC_DESC("This controls the default setting for " - "TextNode::set_tab_width().")); + "TextNode::set_tab_width().")); ConfigVariableInt text_push_properties_key ("text-push-properties-key", 1, PRC_DESC("This is the decimal character number that, embedded in " - "a string, is used to bracket the name of a TextProperties " - "structure added to the TextPropertiesManager object, to " - "control the appearance of subsequent text.")); + "a string, is used to bracket the name of a TextProperties " + "structure added to the TextPropertiesManager object, to " + "control the appearance of subsequent text.")); ConfigVariableInt text_pop_properties_key ("text-pop-properties-key", 2, PRC_DESC("This is the decimal character number that undoes the " - "effect of a previous appearance of text_push_properties_key.")); + "effect of a previous appearance of text_push_properties_key.")); ConfigVariableInt text_soft_hyphen_key ("text-soft-hyphen-key", 3, PRC_DESC("This is the decimal character number that, embedded in a " - "string, is identified as the soft-hyphen character.")); + "string, is identified as the soft-hyphen character.")); ConfigVariableInt text_soft_break_key ("text-soft-break-key", 4, PRC_DESC("This is similar to text-soft-hyphen-key, except that " - "when it is used as a break point, no character is " - "introduced in its place.")); + "when it is used as a break point, no character is " + "introduced in its place.")); wstring get_text_soft_hyphen_output() { @@ -124,8 +124,8 @@ get_text_soft_hyphen_output() { static ConfigVariableString cv("text-soft-hyphen-output", "-", PRC_DESC("This is the string that is output, encoded in the default " - "encoding, to represent the hyphen character that is " - "introduced when the line is broken at a soft-hyphen key.")); + "encoding, to represent the hyphen character that is " + "introduced when the line is broken at a soft-hyphen key.")); if (text_soft_hyphen_output == NULL) { TextEncoder encoder; @@ -138,8 +138,8 @@ get_text_soft_hyphen_output() { ConfigVariableDouble text_hyphen_ratio ("text-hyphen-ratio", 0.7, PRC_DESC("If the rightmost whitespace character falls before this " - "fraction of the line, hyphenate a word to the right of that " - "if possible.")); + "fraction of the line, hyphenate a word to the right of that " + "if possible.")); wstring get_text_never_break_before() { @@ -147,9 +147,9 @@ get_text_never_break_before() { static ConfigVariableString cv("text-never-break-before", ",.-:?!;", PRC_DESC("This string represents a list of individual characters " - "that should never appear at the beginning of a line " - "following a forced break. Typically these will be " - "punctuation characters.")); + "that should never appear at the beginning of a line " + "following a forced break. Typically these will be " + "punctuation characters.")); if (text_never_break_before == NULL) { TextEncoder encoder; @@ -162,8 +162,8 @@ get_text_never_break_before() { ConfigVariableInt text_max_never_break ("text-max-never-break", 3, PRC_DESC("If we have more than this number of text-never-break-before " - "characters in a row, do not treat any of them as special and " - "instead break the line wherever we can.")); + "characters in a row, do not treat any of them as special and " + "instead break the line wherever we can.")); ConfigVariableEnum text_minfilter ("text-minfilter", Texture::FT_linear_mipmap_linear, diff --git a/panda/src/text/dynamicTextGlyph.h b/panda/src/text/dynamicTextGlyph.h index 2bc0ad0688..b90d37d3ba 100644 --- a/panda/src/text/dynamicTextGlyph.h +++ b/panda/src/text/dynamicTextGlyph.h @@ -37,8 +37,8 @@ class DynamicTextPage; class EXPCL_PANDA DynamicTextGlyph : public TextGlyph { public: INLINE DynamicTextGlyph(int character, DynamicTextPage *page, - int x, int y, int x_size, int y_size, - int margin); + int x, int y, int x_size, int y_size, + int margin); INLINE DynamicTextGlyph(int character, float advance); private: INLINE DynamicTextGlyph(const DynamicTextGlyph ©); diff --git a/panda/src/text/dynamicTextPage.cxx b/panda/src/text/dynamicTextPage.cxx index b86e14fcd0..a6c3460fb6 100644 --- a/panda/src/text/dynamicTextPage.cxx +++ b/panda/src/text/dynamicTextPage.cxx @@ -76,7 +76,7 @@ slot_glyph(int character, int x_size, int y_size, int margin) { // The glyph can be fit at (x, y). Slot it. PT(DynamicTextGlyph) glyph = new DynamicTextGlyph(character, this, - x, y, x_size, y_size, margin); + x, y, x_size, y_size, margin); _glyphs.push_back(glyph); return glyph; } diff --git a/panda/src/text/dynamicTextPage.h b/panda/src/text/dynamicTextPage.h index ddf41b86f9..d88c619bbb 100644 --- a/panda/src/text/dynamicTextPage.h +++ b/panda/src/text/dynamicTextPage.h @@ -42,7 +42,7 @@ public: DynamicTextPage(DynamicTextFont *font, int page_number); DynamicTextGlyph *slot_glyph(int character, - int x_size, int y_size, int margin); + int x_size, int y_size, int margin); INLINE int get_x_size() const; INLINE int get_y_size() const; diff --git a/panda/src/text/geomTextGlyph.cxx b/panda/src/text/geomTextGlyph.cxx index 18c61a8a9c..23b0d9f7a2 100644 --- a/panda/src/text/geomTextGlyph.cxx +++ b/panda/src/text/geomTextGlyph.cxx @@ -205,7 +205,7 @@ register_with_read_factory() { TypedWritable* GeomTextGlyph:: make_GeomTextGlyph(const FactoryParams ¶ms) { GeomTextGlyph *me = new GeomTextGlyph((DynamicTextGlyph *)NULL, - (GeomVertexData *)NULL); + (GeomVertexData *)NULL); DatagramIterator scan; BamReader *manager; diff --git a/panda/src/text/geomTextGlyph.h b/panda/src/text/geomTextGlyph.h index 60062b5ca2..fab384203f 100644 --- a/panda/src/text/geomTextGlyph.h +++ b/panda/src/text/geomTextGlyph.h @@ -38,7 +38,7 @@ class EXPCL_PANDA GeomTextGlyph : public Geom { public: GeomTextGlyph(DynamicTextGlyph *glyph, - const GeomVertexData *data); + const GeomVertexData *data); GeomTextGlyph(const GeomTextGlyph ©); void operator = (const GeomTextGlyph ©); virtual ~GeomTextGlyph(); diff --git a/panda/src/text/textGlyph.I b/panda/src/text/textGlyph.I index 43428dd41d..d3be0f87aa 100644 --- a/panda/src/text/textGlyph.I +++ b/panda/src/text/textGlyph.I @@ -37,7 +37,7 @@ TextGlyph(int character) : //////////////////////////////////////////////////////////////////// INLINE TextGlyph:: TextGlyph(int character, const Geom *geom, - const RenderState *state, float advance) : + const RenderState *state, float advance) : _character(character), _geom(geom), _state(state), diff --git a/panda/src/text/textGlyph.h b/panda/src/text/textGlyph.h index 2f89fac508..24fdfae324 100644 --- a/panda/src/text/textGlyph.h +++ b/panda/src/text/textGlyph.h @@ -36,7 +36,7 @@ class EXPCL_PANDA TextGlyph : public ReferenceCount { public: INLINE TextGlyph(int character); INLINE TextGlyph(int character, const Geom *geom, - const RenderState *state, float advance); + const RenderState *state, float advance); INLINE TextGlyph(const TextGlyph ©); INLINE void operator = (const TextGlyph ©); virtual ~TextGlyph(); diff --git a/panda/src/tform/buttonThrower.cxx b/panda/src/tform/buttonThrower.cxx index 624b3e7900..cc1728d440 100644 --- a/panda/src/tform/buttonThrower.cxx +++ b/panda/src/tform/buttonThrower.cxx @@ -398,7 +398,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) { if (!_throw_buttons_active || has_throw_button(_mods, be._button)) { // Process this button. do_specific_event(event_name, be._time); - do_general_event(be, event_name); + do_general_event(be, event_name); } else { // Don't process this button; instead, pass it down to future @@ -422,7 +422,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) { // of the modifier keys. if (!_throw_buttons_active || has_throw_button(be._button)) { do_specific_event(event_name + "-up", be._time); - do_general_event(be, event_name); + do_general_event(be, event_name); } if (_throw_buttons_active) { // Now pass the event on to future generations. We always @@ -436,7 +436,7 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) { // Some other kind of button event (e.g. keypress). Don't // throw an event for this, but do pass it down. _button_events->add_event(be); - do_general_event(be, ""); + do_general_event(be, ""); } } } diff --git a/panda/src/tform/buttonThrower.h b/panda/src/tform/buttonThrower.h index 186536af18..bf34d0c0dd 100644 --- a/panda/src/tform/buttonThrower.h +++ b/panda/src/tform/buttonThrower.h @@ -87,7 +87,7 @@ public: private: void do_specific_event(const string &event_name, double time); void do_general_event(const ButtonEvent &button_event, - const string &event_name); + const string &event_name); private: string _button_down_event; diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 112678f71d..af466b86dc 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -1040,18 +1040,18 @@ do_transmit_data(const DataNodeTransmit &input, DataNodeTransmit &output) { float left, right, bottom, top; _display_region->get_dimensions(left, right, bottom, top); - // Need to translate this into DisplayRegion [0, 1] space - float x = (f[0] + 1.0f) / 2.0f; - // Scale in DR space - float xp = (x - left) / (right - left); - // Translate back into [-1, 1] space - float xpp = (xp * 2.0f) - 1.0f; + // Need to translate this into DisplayRegion [0, 1] space + float x = (f[0] + 1.0f) / 2.0f; + // Scale in DR space + float xp = (x - left) / (right - left); + // Translate back into [-1, 1] space + float xpp = (xp * 2.0f) - 1.0f; - float y = (f[1] + 1.0f) / 2.0f; - float yp = (y - bottom) / (top - bottom); - float ypp = (yp * 2.0f) - 1.0f; - - LVecBase2f new_f(xpp, ypp); + float y = (f[1] + 1.0f) / 2.0f; + float yp = (y - bottom) / (top - bottom); + float ypp = (yp * 2.0f) - 1.0f; + + LVecBase2f new_f(xpp, ypp); LVecBase2f new_p(p[0] - xo, p[1] - xo); set_mouse(new_f, new_p); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index b47546ad95..e2df19f5c1 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -547,7 +547,7 @@ fullscreen_restored(WindowProperties &) { //////////////////////////////////////////////////////////////////// bool WinGraphicsWindow:: do_reshape_request(int x_origin, int y_origin, bool has_origin, - int x_size, int y_size) { + int x_size, int y_size) { if (windisplay_cat.is_debug()) { windisplay_cat.debug() << "Got reshape request (" << x_origin << ", " << y_origin @@ -820,7 +820,7 @@ open_regular_window() { RECT win_rect; SetRect(&win_rect, x_origin, y_origin, - x_origin + x_size, y_origin + y_size); + x_origin + x_size, y_origin + y_size); // compute window size based on desired client area size if (!AdjustWindowRect(&win_rect, window_style, FALSE)) { @@ -2372,7 +2372,7 @@ ClearToBlack(HWND hWnd, const WindowProperties &props) { if (!props.has_origin()) { if (windisplay_cat.is_debug()) { windisplay_cat.debug() - << "Skipping ClearToBlack, no origin specified yet.\n"; + << "Skipping ClearToBlack, no origin specified yet.\n"; } return; } diff --git a/pandaapp/src/indexify/fontSamples.cxx b/pandaapp/src/indexify/fontSamples.cxx index 4403b231b1..9d5efbe267 100644 --- a/pandaapp/src/indexify/fontSamples.cxx +++ b/pandaapp/src/indexify/fontSamples.cxx @@ -164,8 +164,8 @@ post_command_line() { if (!_name_font_filename.empty()) { _name_text_maker = new PNMTextMaker(_name_font_filename, 0); if (!_name_text_maker->is_valid()) { - delete _name_text_maker; - _name_text_maker = (PNMTextMaker *)NULL; + delete _name_text_maker; + _name_text_maker = (PNMTextMaker *)NULL; } } @@ -173,9 +173,9 @@ post_command_line() { _name_text_maker = new PNMTextMaker((const char *)default_font, default_font_size, 0); if (!_name_text_maker->is_valid()) { - nout << "Unable to open default font.\n"; - delete _name_text_maker; - _name_text_maker = (PNMTextMaker *)NULL; + nout << "Unable to open default font.\n"; + delete _name_text_maker; + _name_text_maker = (PNMTextMaker *)NULL; } } } @@ -215,11 +215,11 @@ run() { if (y > _image_height - vert_per_font) { // Write out the current image. snprintf(output_filename, output_filename_size, - _output_filename.c_str(), output_index); + _output_filename.c_str(), output_index); nout << "Writing " << output_filename << "\n"; if (!output_image.write(output_filename)) { - nout << "Unable to write to " << output_filename << "\n"; - exit(1); + nout << "Unable to write to " << output_filename << "\n"; + exit(1); } output_index++; output_image.fill(1, 1, 1); @@ -233,11 +233,11 @@ run() { text_maker->set_scale_factor(_font_aa_factor); text_maker->set_pixel_size(_sample_height); text_maker->generate_into(_sample_text, output_image, - 16, y + _sample_height); + 16, y + _sample_height); if (_name_text_maker != (PNMTextMaker *)NULL) { - string desc = filename.get_basename() + ": " + text_maker->get_name(); - _name_text_maker->generate_into(desc, output_image, - 16, y + _sample_height + _name_height); + string desc = filename.get_basename() + ": " + text_maker->get_name(); + _name_text_maker->generate_into(desc, output_image, + 16, y + _sample_height + _name_height); } } @@ -246,7 +246,7 @@ run() { } snprintf(output_filename, output_filename_size, - _output_filename.c_str(), output_index); + _output_filename.c_str(), output_index); nout << "Writing " << output_filename << "\n"; if (!output_image.write(output_filename)) { nout << "Unable to write to " << output_filename << "\n"; diff --git a/pandaapp/src/indexify/indexImage.cxx b/pandaapp/src/indexify/indexImage.cxx index 4c55276813..117482b311 100644 --- a/pandaapp/src/indexify/indexImage.cxx +++ b/pandaapp/src/indexify/indexImage.cxx @@ -298,7 +298,7 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image, // anyway when force_reduced is true. photo_filename.set_binary(); if (!copy_file(photo_filename, reduced_dir)) { - return false; + return false; } } else { @@ -328,8 +328,8 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image, // We still read the image header to determine its size. PNMImageHeader photo_image; if (!photo_image.read_header(photo_filename)) { - nout << "Unable to read " << photo_filename << "\n"; - return false; + nout << "Unable to read " << photo_filename << "\n"; + return false; } photo->_full_x_size = photo_image.get_x_size(); @@ -337,35 +337,35 @@ make_reduced_image(Photo *photo, PNMImage &reduced_image, photo->_has_reduced = true; if (dummy_mode) { - // In dummy mode, we may or may not actually have a reduced - // image. In either case, ignore the file and compute its - // appropriate size from the source image. - compute_reduction(photo_image, reduced_image, reduced_width, reduced_height); - photo->_reduced_x_size = reduced_image.get_x_size(); - photo->_reduced_y_size = reduced_image.get_y_size(); - + // In dummy mode, we may or may not actually have a reduced + // image. In either case, ignore the file and compute its + // appropriate size from the source image. + compute_reduction(photo_image, reduced_image, reduced_width, reduced_height); + photo->_reduced_x_size = reduced_image.get_x_size(); + photo->_reduced_y_size = reduced_image.get_y_size(); + } else if (generate_index_image) { - // Now read the reduced image from disk, so we can put it on - // the index image. - nout << "Reading " << reduced_filename << "\n"; - - if (!reduced_image.read(reduced_filename)) { - nout << "Unable to read.\n"; - return false; - } - - photo->_reduced_x_size = reduced_image.get_x_size(); - photo->_reduced_y_size = reduced_image.get_y_size(); + // Now read the reduced image from disk, so we can put it on + // the index image. + nout << "Reading " << reduced_filename << "\n"; + + if (!reduced_image.read(reduced_filename)) { + nout << "Unable to read.\n"; + return false; + } + + photo->_reduced_x_size = reduced_image.get_x_size(); + photo->_reduced_y_size = reduced_image.get_y_size(); } else { - // If we're not generating an index image, we don't even need - // the reduced image--just scan its header to get its size. - if (!reduced_image.read_header(reduced_filename)) { - nout << "Unable to read " << reduced_filename << "\n"; - return false; - } - photo->_reduced_x_size = reduced_image.get_x_size(); - photo->_reduced_y_size = reduced_image.get_y_size(); + // If we're not generating an index image, we don't even need + // the reduced image--just scan its header to get its size. + if (!reduced_image.read_header(reduced_filename)) { + nout << "Unable to read " << reduced_filename << "\n"; + return false; + } + photo->_reduced_x_size = reduced_image.get_x_size(); + photo->_reduced_y_size = reduced_image.get_y_size(); } } } diff --git a/pandaapp/src/indexify/indexImage.h b/pandaapp/src/indexify/indexImage.h index 69a7590bce..098492574c 100644 --- a/pandaapp/src/indexify/indexImage.h +++ b/pandaapp/src/indexify/indexImage.h @@ -67,10 +67,10 @@ private: static void draw_box(PNMImage &image); static void draw_frame(PNMImage &image, - int frame_left, int frame_top, - int frame_width, int frame_height, - int hole_left, int hole_top, - int hole_width, int hole_height); + int frame_left, int frame_top, + int frame_width, int frame_height, + int hole_left, int hole_top, + int hole_width, int hole_height); private: RollDirectory *_dir; diff --git a/pandaapp/src/indexify/indexParameters.cxx b/pandaapp/src/indexify/indexParameters.cxx index 7aed866cbf..28d9ecf05e 100644 --- a/pandaapp/src/indexify/indexParameters.cxx +++ b/pandaapp/src/indexify/indexParameters.cxx @@ -238,10 +238,10 @@ escape_html(const string &input) { bool found_match = false; for (int i = 0; !found_match && tokens[i].name != NULL; i++) { if (code == tokens[i].code) { - result += '&'; - result += tokens[i].name; - result += ';'; - found_match = true; + result += '&'; + result += tokens[i].name; + result += ';'; + found_match = true; } } diff --git a/pandaapp/src/indexify/indexParameters.h b/pandaapp/src/indexify/indexParameters.h index c689b61c4f..92828d427d 100644 --- a/pandaapp/src/indexify/indexParameters.h +++ b/pandaapp/src/indexify/indexParameters.h @@ -144,7 +144,7 @@ extern int thumb_interior_width; extern int thumb_interior_height; Filename compose_href(const Filename &rel_dir, const Filename &user_prefix, - const Filename &basename = Filename()); + const Filename &basename = Filename()); string escape_html(const string &input); bool copy_file(const Filename &source_file, const Filename &dest_dir); diff --git a/pandaapp/src/indexify/indexify.cxx b/pandaapp/src/indexify/indexify.cxx index 2e933a5253..5bc6958588 100644 --- a/pandaapp/src/indexify/indexify.cxx +++ b/pandaapp/src/indexify/indexify.cxx @@ -323,12 +323,12 @@ handle_args(ProgramBase::Args &args) { if (filename.is_directory()) { string basename = filename.get_basename(); if (basename == "icons" || basename == "html" || - basename == "reduced" || basename == "thumbs") { - nout << "Ignoring " << filename << "; indexify-generated directory.\n"; + basename == "reduced" || basename == "thumbs") { + nout << "Ignoring " << filename << "; indexify-generated directory.\n"; } else { - RollDirectory *roll_dir = new RollDirectory(filename); - _roll_dirs.push_back(roll_dir); + RollDirectory *roll_dir = new RollDirectory(filename); + _roll_dirs.push_back(roll_dir); } } else if (filename.exists()) { @@ -417,8 +417,8 @@ post_command_line() { if (!_font_filename.empty()) { _text_maker = new PNMTextMaker(_font_filename, 0); if (!_text_maker->is_valid()) { - delete _text_maker; - _text_maker = (PNMTextMaker *)NULL; + delete _text_maker; + _text_maker = (PNMTextMaker *)NULL; } } @@ -426,9 +426,9 @@ post_command_line() { _text_maker = new PNMTextMaker((const char *)default_font, default_font_size, 0); if (!_text_maker->is_valid()) { - nout << "Unable to open default font.\n"; - delete _text_maker; - _text_maker = (PNMTextMaker *)NULL; + nout << "Unable to open default font.\n"; + delete _text_maker; + _text_maker = (PNMTextMaker *)NULL; } } @@ -445,80 +445,80 @@ post_command_line() { Filename icon_filename(archive_dir, prev_icon); if (force_regenerate || !icon_filename.exists()) { - nout << "Generating " << icon_filename << "\n"; - icon_filename.make_dir(); - icon_filename.set_binary(); + nout << "Generating " << icon_filename << "\n"; + icon_filename.make_dir(); + icon_filename.set_binary(); - ofstream output; - if (!icon_filename.open_write(output)) { - nout << "Unable to write to " << icon_filename << "\n"; - exit(1); - } - output.write((const char *)default_left_icon, default_left_icon_len); + ofstream output; + if (!icon_filename.open_write(output)) { + nout << "Unable to write to " << icon_filename << "\n"; + exit(1); + } + output.write((const char *)default_left_icon, default_left_icon_len); } } if (next_icon.empty()) { next_icon = Filename("icons", default_right_icon_filename); Filename icon_filename(archive_dir, next_icon); if (force_regenerate || !icon_filename.exists()) { - nout << "Generating " << icon_filename << "\n"; - icon_filename.make_dir(); - icon_filename.set_binary(); - - ofstream output; - if (!icon_filename.open_write(output)) { - nout << "Unable to write to " << icon_filename << "\n"; - exit(1); - } - output.write((const char *)default_right_icon, default_right_icon_len); + nout << "Generating " << icon_filename << "\n"; + icon_filename.make_dir(); + icon_filename.set_binary(); + + ofstream output; + if (!icon_filename.open_write(output)) { + nout << "Unable to write to " << icon_filename << "\n"; + exit(1); + } + output.write((const char *)default_right_icon, default_right_icon_len); } } if (up_icon.empty()) { up_icon = Filename("icons", default_up_icon_filename); Filename icon_filename(archive_dir, up_icon); if (force_regenerate || !icon_filename.exists()) { - nout << "Generating " << icon_filename << "\n"; - icon_filename.make_dir(); - icon_filename.set_binary(); + nout << "Generating " << icon_filename << "\n"; + icon_filename.make_dir(); + icon_filename.set_binary(); - ofstream output; - if (!icon_filename.open_write(output)) { - nout << "Unable to write to " << icon_filename << "\n"; - exit(1); - } - output.write((const char *)default_up_icon, default_up_icon_len); + ofstream output; + if (!icon_filename.open_write(output)) { + nout << "Unable to write to " << icon_filename << "\n"; + exit(1); + } + output.write((const char *)default_up_icon, default_up_icon_len); } } if (movie_icon.empty()) { movie_icon = Filename("icons", default_movie_icon_filename); Filename icon_filename(archive_dir, movie_icon); if (force_regenerate || !icon_filename.exists()) { - nout << "Generating " << icon_filename << "\n"; - icon_filename.make_dir(); - icon_filename.set_binary(); + nout << "Generating " << icon_filename << "\n"; + icon_filename.make_dir(); + icon_filename.set_binary(); - ofstream output; - if (!icon_filename.open_write(output)) { - nout << "Unable to write to " << icon_filename << "\n"; - exit(1); - } - output.write((const char *)default_movie_icon, default_movie_icon_len); + ofstream output; + if (!icon_filename.open_write(output)) { + nout << "Unable to write to " << icon_filename << "\n"; + exit(1); + } + output.write((const char *)default_movie_icon, default_movie_icon_len); } } if (sound_icon.empty()) { sound_icon = Filename("icons", default_sound_icon_filename); Filename icon_filename(archive_dir, sound_icon); if (force_regenerate || !icon_filename.exists()) { - nout << "Generating " << icon_filename << "\n"; - icon_filename.make_dir(); - icon_filename.set_binary(); + nout << "Generating " << icon_filename << "\n"; + icon_filename.make_dir(); + icon_filename.set_binary(); - ofstream output; - if (!icon_filename.open_write(output)) { - nout << "Unable to write to " << icon_filename << "\n"; - exit(1); - } - output.write((const char *)default_sound_icon, default_sound_icon_len); + ofstream output; + if (!icon_filename.open_write(output)) { + nout << "Unable to write to " << icon_filename << "\n"; + exit(1); + } + output.write((const char *)default_sound_icon, default_sound_icon_len); } } } @@ -694,10 +694,10 @@ do_generate_images() { RollDirectory *roll_dir = (*di); if (!roll_dir->is_empty()) { index_html - << "get_basename() << "\">\n" - << "
  • get_basename() << ".htm\">" - << roll_dir->get_name() << " " << escape_html(roll_dir->get_desc()) - << "
  • \n"; + << "get_basename() << "\">\n" + << "
  • get_basename() << ".htm\">" + << roll_dir->get_name() << " " << escape_html(roll_dir->get_desc()) + << "
  • \n"; } } diff --git a/pandaapp/src/indexify/photo.cxx b/pandaapp/src/indexify/photo.cxx index 55eb49f38a..4f0c98a0f8 100644 --- a/pandaapp/src/indexify/photo.cxx +++ b/pandaapp/src/indexify/photo.cxx @@ -42,7 +42,7 @@ Photo(RollDirectory *dir, const Filename &basename, if (_frame_number.substr(0, dirname.length()) == dirname) { _frame_number = _frame_number.substr(dirname.length()); while (_frame_number.length() > 1 && _frame_number[0] == '0') { - _frame_number = _frame_number.substr(1); + _frame_number = _frame_number.substr(1); } } } diff --git a/pandaapp/src/indexify/rollDirectory.cxx b/pandaapp/src/indexify/rollDirectory.cxx index ef9db269b7..61290ff968 100644 --- a/pandaapp/src/indexify/rollDirectory.cxx +++ b/pandaapp/src/indexify/rollDirectory.cxx @@ -148,18 +148,18 @@ scan(const string &photo_extension, const string &movie_extension, string word; ds >> word; while (!ds.eof() && !ds.fail()) { - if (!_desc.empty()) { - _desc += ' '; - } - _desc += word; - word = string(); - ds >> word; + if (!_desc.empty()) { + _desc += ' '; + } + _desc += word; + word = string(); + ds >> word; } if (!word.empty()) { - if (!_desc.empty()) { - _desc += ' '; - } - _desc += word; + if (!_desc.empty()) { + _desc += ' '; + } + _desc += word; } } } @@ -180,33 +180,33 @@ scan(const string &photo_extension, const string &movie_extension, string word; ls >> word; while (!ls.eof() && !ls.fail()) { - any_words = true; - Filename try_filename(_dir, word); - if (!try_filename.exists()) { - try_filename = Filename(_dir, word + "." + photo_extension); - } - if (!try_filename.exists()) { - try_filename = Filename(_dir, _basename + word + "." + photo_extension); - } - if (!try_filename.exists()) { - try_filename = Filename(_dir, _basename + "0" + word + "." + photo_extension); - } - if (try_filename.exists()) { + any_words = true; + Filename try_filename(_dir, word); + if (!try_filename.exists()) { + try_filename = Filename(_dir, word + "." + photo_extension); + } + if (!try_filename.exists()) { + try_filename = Filename(_dir, _basename + word + "." + photo_extension); + } + if (!try_filename.exists()) { + try_filename = Filename(_dir, _basename + "0" + word + "." + photo_extension); + } + if (try_filename.exists()) { add_photo(try_filename.get_basename(), movie_extension, - sound_extension); - } else { - nout << "Frame " << word << " not found in " << _name << "\n"; - } - ls >> word; + sound_extension); + } else { + nout << "Frame " << word << " not found in " << _name << "\n"; + } + ls >> word; } if (!any_words) { - // An empty .ls file just means reverse the order. - reverse_order = true; + // An empty .ls file just means reverse the order. + reverse_order = true; } else { - // A non-empty .ls file has listed all the files we need; no - // need to scan the directory. - explicit_list = true; + // A non-empty .ls file has listed all the files we need; no + // need to scan the directory. + explicit_list = true; } } } @@ -445,14 +445,14 @@ generate_html(const Filename &archive_dir, const Filename &roll_dir_root) { // If the comment file for the roll exists, insert its contents // here instead of the generic header. if (!insert_html_comment(comment_strm, cm_filename)) { - return false; + return false; } } else { comment_strm - << "

    " << _name << "

    \n"; + << "

    " << _name << "

    \n"; if (!_desc.empty()) { - comment_strm << "

    " << escape_html(_desc) << ".

    \n"; + comment_strm << "

    " << escape_html(_desc) << ".

    \n"; } } } @@ -695,7 +695,7 @@ insert_html_comment(ostream &html, Filename cm_filename) { //////////////////////////////////////////////////////////////////// void RollDirectory:: add_photo(const Filename &basename, const string &movie_extension, - const string &sound_extension) { + const string &sound_extension) { Photo *photo = new Photo(this, basename, movie_extension, sound_extension); _photos.push_back(photo); } diff --git a/pandaapp/src/indexify/rollDirectory.h b/pandaapp/src/indexify/rollDirectory.h index 03c4a96f21..10dc6d7388 100644 --- a/pandaapp/src/indexify/rollDirectory.h +++ b/pandaapp/src/indexify/rollDirectory.h @@ -43,7 +43,7 @@ public: const string &get_name() const; const string &get_desc() const; bool scan(const string &photo_extension, const string &movie_extension, - const string &sound_extension); + const string &sound_extension); void collect_index_images(); bool sort_date_before(const RollDirectory &other) const; @@ -59,7 +59,7 @@ public: bool generate_images(const Filename &archive_dir, PNMTextMaker *text_maker); bool generate_html(const Filename &archive_dir, - const Filename &roll_dir_root); + const Filename &roll_dir_root); const string &get_comment_html() const; const string &get_index_html() const; @@ -72,14 +72,14 @@ public: private: void add_photo(const Filename &basename, const string &movie_extension, - const string &sound_extension); + const string &sound_extension); void add_contributing_filename(const Filename &filename); static bool insert_html_comment_body(ostream &html, istream &cm); static string format_basename(const string &basename); void generate_nav_buttons(ostream &html, - const Filename &prev_roll_filename, - const Filename &next_roll_filename, - const string &up_href); + const Filename &prev_roll_filename, + const Filename &next_roll_filename, + const string &up_href); static bool compare_filenames(const string &a, const string &b); public: diff --git a/pandaapp/src/stitchbase/stitchParser.yxx b/pandaapp/src/stitchbase/stitchParser.yxx index 356b0de7ac..7c40b4a941 100644 --- a/pandaapp/src/stitchbase/stitchParser.yxx +++ b/pandaapp/src/stitchbase/stitchParser.yxx @@ -442,7 +442,7 @@ vec3: '(' NUMBER NUMBER NUMBER ')' ; length_pair: - '(' length ',' length ')' + '(' length ',' length ')' { $$.set($2, $4, 0.0, 0.0); $$ = 2; diff --git a/pandatool/src/dxf/dxfFile.cxx b/pandatool/src/dxf/dxfFile.cxx index 0ace15fe0a..fb33eea9b3 100644 --- a/pandatool/src/dxf/dxfFile.cxx +++ b/pandatool/src/dxf/dxfFile.cxx @@ -330,23 +330,23 @@ process(istream &in) { if (get_group()) { switch (_state) { case ST_top: - state_top(); - break; + state_top(); + break; case ST_section: - state_section(); - break; + state_section(); + break; case ST_entity: - state_entity(); - break; + state_entity(); + break; case ST_verts: - state_verts(); - break; + state_verts(); + break; default: - break; + break; } } } @@ -460,8 +460,8 @@ find_color(double r, double g, double b) { for (int i = 0; i < 255; i++) { double diff = ((r - _colors[i].r) * (r - _colors[i].r) + - (g - _colors[i].g) * (g - _colors[i].g) + - (b - _colors[i].b) * (b - _colors[i].b)); + (g - _colors[i].g) * (g - _colors[i].g) + + (b - _colors[i].b) * (b - _colors[i].b)); if (diff < best_diff) { best_diff = diff; best_index = i; @@ -546,9 +546,9 @@ compute_ocs() { // Now build a rotate matrix from these vectors. LMatrix4d ocs( x[0], x[1], x[2], 0, - y[0], y[1], y[2], 0, - _z[0], _z[1], _z[2], 0, - 0, 0, 0, 1); + y[0], y[1], y[2], 0, + _z[0], _z[1], _z[2], 0, + 0, 0, 0, 1); _ocs2wcs.invert_from(ocs); } @@ -714,29 +714,29 @@ void DXFFile:: state_top() { if (_code != 0) { nout << "Group code 0 not found at top level; found code " << _code - << " instead.\n"; + << " instead.\n"; change_state(ST_error); } else { if (_string == "SECTION") { if (get_group()) { - if (_code != 2) { - nout << "Group code 0 not immediately followed by code 2; found code " - << _code << " instead.\n"; - } else { - if (_string == "HEADER") { - change_section(SE_header); - } else if (_string == "TABLES") { - change_section(SE_tables); - } else if (_string == "BLOCKS") { - change_section(SE_blocks); - } else if (_string == "ENTITIES") { - change_section(SE_entities); - } else if (_string == "OBJECTS") { - change_section(SE_objects); - } else { - change_section(SE_unknown); - } - } + if (_code != 2) { + nout << "Group code 0 not immediately followed by code 2; found code " + << _code << " instead.\n"; + } else { + if (_string == "HEADER") { + change_section(SE_header); + } else if (_string == "TABLES") { + change_section(SE_tables); + } else if (_string == "BLOCKS") { + change_section(SE_blocks); + } else if (_string == "ENTITIES") { + change_section(SE_entities); + } else if (_string == "OBJECTS") { + change_section(SE_objects); + } else { + change_section(SE_unknown); + } + } } } else if (_string == "EOF") { change_state(ST_done); @@ -765,19 +765,19 @@ state_section() { change_state(ST_top); } else { if (_section == SE_entities) { - if (_string == "3DFACE") { - change_entity(EN_3dface); - } else if (_string == "POINT") { - change_entity(EN_point); - } else if (_string == "INSERT") { - change_entity(EN_insert); - } else if (_string == "VERTEX") { - change_entity(EN_vertex); - } else if (_string == "POLYLINE") { - change_entity(EN_polyline); - } else { - change_entity(EN_unknown); - } + if (_string == "3DFACE") { + change_entity(EN_3dface); + } else if (_string == "POINT") { + change_entity(EN_point); + } else if (_string == "INSERT") { + change_entity(EN_insert); + } else if (_string == "VERTEX") { + change_entity(EN_vertex); + } else if (_string == "POLYLINE") { + change_entity(EN_polyline); + } else { + change_entity(EN_unknown); + } } } break; diff --git a/pandatool/src/dxf/dxfFile.h b/pandatool/src/dxf/dxfFile.h index f4b7853ac0..e35e7fe532 100644 --- a/pandatool/src/dxf/dxfFile.h +++ b/pandatool/src/dxf/dxfFile.h @@ -33,7 +33,7 @@ static const int DXF_max_line = 256; static const int DXF_num_colors = 256; //////////////////////////////////////////////////////////////////// -// Class : DXFFile +// Class : DXFFile // Description : A generic DXF-reading class. This class can read a // DXF file but doesn't actually do anything with the // data; it's intended to be inherited from and the diff --git a/pandatool/src/dxf/dxfLayer.h b/pandatool/src/dxf/dxfLayer.h index 25ed3456a9..38d81f7be8 100644 --- a/pandatool/src/dxf/dxfLayer.h +++ b/pandatool/src/dxf/dxfLayer.h @@ -23,7 +23,7 @@ #include "namable.h" //////////////////////////////////////////////////////////////////// -// Class : DXFLayer +// Class : DXFLayer // Description : This represents a "layer" as read from the DXF file. // A layer may be defined by reading the header part of // the file, or it may be implicitly defined by an diff --git a/pandatool/src/dxf/dxfLayerMap.h b/pandatool/src/dxf/dxfLayerMap.h index a4895e1cdd..e1de7bab4c 100644 --- a/pandatool/src/dxf/dxfLayerMap.h +++ b/pandatool/src/dxf/dxfLayerMap.h @@ -26,7 +26,7 @@ class DXFLayer; class DXFFile; //////////////////////////////////////////////////////////////////// -// Class : DXFLayerMap +// Class : DXFLayerMap // Description : A map of string (layer name) to DXFLayer: that is, // the layers of a file ordered by name. This is used // as a lookup within DXFFile to locate the layer diff --git a/pandatool/src/dxf/dxfVertex.h b/pandatool/src/dxf/dxfVertex.h index 69212d0a12..d592a1d3c1 100644 --- a/pandatool/src/dxf/dxfVertex.h +++ b/pandatool/src/dxf/dxfVertex.h @@ -24,7 +24,7 @@ #include "luse.h" //////////////////////////////////////////////////////////////////// -// Class : DXFVertex +// Class : DXFVertex // Description : Stored within DXFFile, this is the basic Vertex data // of a DXF file. When DXFFile::DoneEntity() is called, // if the entity is a type to have vertices, then diff --git a/pandatool/src/dxfegg/dxfToEggLayer.h b/pandatool/src/dxfegg/dxfToEggLayer.h index 1e3dc78f87..c7a621d4cb 100644 --- a/pandatool/src/dxfegg/dxfToEggLayer.h +++ b/pandatool/src/dxfegg/dxfToEggLayer.h @@ -32,7 +32,7 @@ class DXFVertex; class DXFToEggConverter; //////////////////////////////////////////////////////////////////// -// Class : DXFToEggLayer +// Class : DXFToEggLayer // Description : The specialization of DXFLayer used by // DXFToEggConverter. It contains a pointer to an // EggGroup and a vertex pool; these are used to build diff --git a/pandatool/src/dxfprogs/eggToDXFLayer.cxx b/pandatool/src/dxfprogs/eggToDXFLayer.cxx index a4f634700d..9e7feadba6 100644 --- a/pandatool/src/dxfprogs/eggToDXFLayer.cxx +++ b/pandatool/src/dxfprogs/eggToDXFLayer.cxx @@ -147,9 +147,9 @@ write_polyline(EggPolygon *poly, ostream &out) { EggVertex *vtx = (*vi); LVecBase3d pos = vtx->get_pos3() * _group->get_vertex_frame(); out << "0\nVERTEX\n" - << "10\n" << pos[0] << "\n" - << "20\n" << pos[1] << "\n" - << "30\n" << pos[2] << "\n"; + << "10\n" << pos[0] << "\n" + << "20\n" << pos[1] << "\n" + << "30\n" << pos[2] << "\n"; } out << "0\nSEQEND\n"; } @@ -171,14 +171,14 @@ write_3d_face(EggPolygon *poly, ostream &out) { for (ci = group->begin(); ci != group->end(); ++ci) { EggNode *child = (*ci); if (child->is_of_type(EggPolygon::get_class_type())) { - write_3d_face(DCAST(EggPolygon, child), out); + write_3d_face(DCAST(EggPolygon, child), out); } } } else if (poly->size() > 2) { // Otherwise, if we have a tri or a quad, just write it out. out << "0\n3DFACE\n" - << "8\n" << _group->get_name() << "\n"; + << "8\n" << _group->get_name() << "\n"; // Since DXF uses a clockwise ordering convention, we must // reverse the order in which we write out the vertices. @@ -188,13 +188,13 @@ write_3d_face(EggPolygon *poly, ostream &out) { EggVertex *vtx = (*vi); LVecBase3d pos = vtx->get_pos3() * _group->get_vertex_frame(); out << 10 + i << "\n" << pos[0] << "\n" - << 20 + i << "\n" << pos[1] << "\n" - << 30 + i << "\n" << pos[2] << "\n"; + << 20 + i << "\n" << pos[1] << "\n" + << 30 + i << "\n" << pos[2] << "\n"; if (i == 2 && poly->size() == 3) { - // A special case for triangles: repeat the last vertex. - out << 11 + i << "\n" << pos[0] << "\n" - << 21 + i << "\n" << pos[1] << "\n" - << 31 + i << "\n" << pos[2] << "\n"; + // A special case for triangles: repeat the last vertex. + out << 11 + i << "\n" << pos[0] << "\n" + << 21 + i << "\n" << pos[1] << "\n" + << 31 + i << "\n" << pos[2] << "\n"; } } } @@ -215,9 +215,9 @@ write_entities(ostream &out) { if (child->is_of_type(EggPolygon::get_class_type())) { EggPolygon *poly = DCAST(EggPolygon, child); if (_egg2dxf->_use_polyline) { - write_polyline(poly, out); + write_polyline(poly, out); } else { - write_3d_face(poly, out); + write_3d_face(poly, out); } } } diff --git a/pandatool/src/egg-qtess/eggQtess.cxx b/pandatool/src/egg-qtess/eggQtess.cxx index b0b1a17c85..49cd3f201f 100644 --- a/pandatool/src/egg-qtess/eggQtess.cxx +++ b/pandatool/src/egg-qtess/eggQtess.cxx @@ -157,7 +157,7 @@ run() { } else { nout << _surfaces.size() << " NURBS surfaces found; " - << default_entry.get_num_surfaces() + << default_entry.get_num_surfaces() << " unaccounted for by input file.\n"; } diff --git a/pandatool/src/egg-qtess/isoPlacer.cxx b/pandatool/src/egg-qtess/isoPlacer.cxx index a05c5c28fc..4b8c665d84 100644 --- a/pandatool/src/egg-qtess/isoPlacer.cxx +++ b/pandatool/src/egg-qtess/isoPlacer.cxx @@ -63,35 +63,35 @@ get_scores(int subdiv, int across, double ratio, for (i = -1; i < _maxi; i++) { double u = (double)(i+1) / (double)(_maxi+1); if (s) { - surf->eval_point(u, v, pnext); + surf->eval_point(u, v, pnext); } else { - surf->eval_point(v, u, pnext); + surf->eval_point(v, u, pnext); } // We'll ignore consecutive equal points. They don't contribute // to curvature or size. if (!pnext.almost_equal(p3)) { - num_points++; - p1 = p2; - p2 = p3; - p3 = pnext; + num_points++; + p1 = p2; + p2 = p3; + p3 = pnext; - v1 = v2; - v2 = p3 - p2; - double vlength = length(v2); - v2 /= vlength; + v1 = v2; + v2 = p3 - p2; + double vlength = length(v2); + v2 /= vlength; - if (i >= 0) { - _sscore[i] += vlength; - } + if (i >= 0) { + _sscore[i] += vlength; + } - if (num_points >= 3) { - // We only have a meaningful v1, v2 when we've read at least - // three non-equal points. - double d = v1.dot(v2); - - _cscore[i] += acos(max(min(d, 1.0), -1.0)); - } + if (num_points >= 3) { + // We only have a meaningful v1, v2 when we've read at least + // three non-equal points. + double d = v1.dot(v2); + + _cscore[i] += acos(max(min(d, 1.0), -1.0)); + } } } } @@ -143,8 +143,8 @@ place(int count, pvector &iso_points) { // well as at least 50% more curvy than the average curvature, to // qualify as a bend point. if (_cscore[i] > _cscore[i-1]+0.001 && - _cscore[i] > _cscore[i+1]+0.001 && - _cscore[i] > 1.5 * avg_curve) { + _cscore[i] > _cscore[i+1]+0.001 && + _cscore[i] > 1.5 * avg_curve) { bpoints.push_back(i); } } @@ -161,7 +161,7 @@ place(int count, pvector &iso_points) { if (bnext != bpoints.end() && (*bnext) - (*bi) < min_separation) { // Too close. Remove one. if (_cscore[*bnext] > _cscore[*bi]) { - *bi = *bnext; + *bi = *bnext; } bpoints.erase(bnext); } else { @@ -177,7 +177,7 @@ place(int count, pvector &iso_points) { BendPoints::iterator mi = bi; for (++bi; bi != bpoints.end(); ++bi) { if (_cscore[*bi] < _cscore[*mi]) { - mi = bi; + mi = bi; } } bpoints.erase(mi); diff --git a/pandatool/src/egg-qtess/qtessInputEntry.cxx b/pandatool/src/egg-qtess/qtessInputEntry.cxx index e93dda4af1..d9d25b3434 100644 --- a/pandatool/src/egg-qtess/qtessInputEntry.cxx +++ b/pandatool/src/egg-qtess/qtessInputEntry.cxx @@ -141,7 +141,7 @@ set_uv(int u, int v, const string params[], int num_params) { DoubleAlmostMatches(value)), _iso_v.end()); break; - + default: qtess_cat.warning() << "Ignoring invalid parameter: " << params[i] << "\n"; @@ -226,79 +226,79 @@ match(QtessSurface *surface) { // We have a winner! switch (_type) { case T_importance: - // A type of "Importance" is a special case. This entry - // doesn't specify any kind of tesselation on the surface, and - // in fact doesn't preclude the surface from matching anything - // later. It just specifies the relative importance of the - // surface to all the other surfaces. - if (qtess_cat.is_debug()) { - qtess_cat.debug() + // A type of "Importance" is a special case. This entry + // doesn't specify any kind of tesselation on the surface, and + // in fact doesn't preclude the surface from matching anything + // later. It just specifies the relative importance of the + // surface to all the other surfaces. + if (qtess_cat.is_debug()) { + qtess_cat.debug() << "Assigning importance of " << _importance*100.0 << "% to " << name << "\n"; - } - surface->set_importance(_importance); - return T_undefined; + } + surface->set_importance(_importance); + return T_undefined; case T_match_uu: case T_match_uv: - // Similarly for type "matchUU". This indicates that all the - // surfaces that match this one must all share the - // U-tesselation with whichever surface first matched against - // the first node name. - if (nni == _node_names.begin() && _constrain_u==NULL) { - // This is the lucky surface that dominates! - _constrain_u = surface; - } else { - if (_type == T_match_uu) { - surface->set_match_u(&_constrain_u, true); - } else { - surface->set_match_v(&_constrain_u, false); - } - } - return T_undefined; + // Similarly for type "matchUU". This indicates that all the + // surfaces that match this one must all share the + // U-tesselation with whichever surface first matched against + // the first node name. + if (nni == _node_names.begin() && _constrain_u==NULL) { + // This is the lucky surface that dominates! + _constrain_u = surface; + } else { + if (_type == T_match_uu) { + surface->set_match_u(&_constrain_u, true); + } else { + surface->set_match_v(&_constrain_u, false); + } + } + return T_undefined; case T_match_vv: case T_match_vu: - // Ditto for "matchVV". - if (nni == _node_names.begin() && _constrain_v==NULL) { - // This is the lucky surface that dominates! - _constrain_v = surface; - } else { - if (_type == T_match_vv) { - surface->set_match_v(&_constrain_v, true); - } else { - surface->set_match_u(&_constrain_v, false); - } - } - return T_undefined; + // Ditto for "matchVV". + if (nni == _node_names.begin() && _constrain_v==NULL) { + // This is the lucky surface that dominates! + _constrain_v = surface; + } else { + if (_type == T_match_vv) { + surface->set_match_v(&_constrain_v, true); + } else { + surface->set_match_u(&_constrain_v, false); + } + } + return T_undefined; case T_min_u: - // And for min U and V. - if (qtess_cat.is_debug()) { - qtess_cat.debug() + // And for min U and V. + if (qtess_cat.is_debug()) { + qtess_cat.debug() << "Assigning minimum of " << _num_u << " in U to " << name << "\n"; - } - surface->set_min_u(_num_u); - return T_undefined; + } + surface->set_min_u(_num_u); + return T_undefined; case T_min_v: - if (qtess_cat.is_debug()) { - qtess_cat.debug() + if (qtess_cat.is_debug()) { + qtess_cat.debug() << "Assigning minimum of " << _num_v << " in V to " << name << "\n"; - } - surface->set_min_v(_num_v); - return T_undefined; + } + surface->set_min_v(_num_v); + return T_undefined; default: - _surfaces.push_back(surface); - if (_auto_distribute) { - _num_patches += surface->get_score(_curvature_ratio); - } else { - _num_patches += surface->count_patches(); - } - return _type; + _surfaces.push_back(surface); + if (_auto_distribute) { + _num_patches += surface->get_score(_curvature_ratio); + } else { + _num_patches += surface->count_patches(); + } + return _type; } } } @@ -343,9 +343,9 @@ count_tris(double tri_factor, int attempts) { case T_uv: if (!_iso_u.empty() && !_iso_v.empty() && !_auto_place) { - surface->tesselate_specific(_iso_u, _iso_v); + surface->tesselate_specific(_iso_u, _iso_v); } else { - surface->tesselate_uv(_num_u, _num_v, _auto_place, _curvature_ratio); + surface->tesselate_uv(_num_u, _num_v, _auto_place, _curvature_ratio); } break; @@ -479,7 +479,7 @@ output(ostream &out) const { if (show_auto) { out << " " << (_auto_place?"":"!") << "ap" - << " " << (_auto_distribute?"":"!") << "ad"; + << " " << (_auto_distribute?"":"!") << "ad"; if (_auto_place || _auto_distribute) { out << " ar" << _curvature_ratio; } diff --git a/pandatool/src/egg-qtess/qtessInputFile.cxx b/pandatool/src/egg-qtess/qtessInputFile.cxx index 6830107ffe..22ad25eb4f 100644 --- a/pandatool/src/egg-qtess/qtessInputFile.cxx +++ b/pandatool/src/egg-qtess/qtessInputFile.cxx @@ -78,23 +78,23 @@ read(const Filename &filename) { complete_line = string(); if (!line.empty()) { - QtessInputEntry entry; - - // Scan for the first colon followed by whitespace. - size_t colon = line.find(": "); - if (colon == string::npos) { - qtess_cat.error() + QtessInputEntry entry; + + // Scan for the first colon followed by whitespace. + size_t colon = line.find(": "); + if (colon == string::npos) { + qtess_cat.error() << _filename << ": line " << line_number << " has no colon followed by whitespace.\n"; - return false; - } - if (colon == 0) { - qtess_cat.error() + return false; + } + if (colon == 0) { + qtess_cat.error() << _filename << ": line " << line_number << " has no nodes.\n"; - return false; - } - + return false; + } + // Split the line into two groups of words at the colon: names // before the colon, and params following it. vector_string names, params; @@ -106,136 +106,136 @@ read(const Filename &filename) { entry.add_node_name(*ni); } - // Scan for things like ap, ad, ar, and pull them out of the - // stream. - vector_string::iterator ci, cnext; - ci = params.begin(); - while (ci != params.end()) { - cnext = ci; - ++cnext; - - string param = *ci; - bool invert = false; - if (param[0] == '!' && param.size() > 1) { - invert = true; - param = param.substr(1); - } - if (tolower(param[0]) == 'a' && param.size() > 1) { - switch (tolower(param[1])) { - case 'p': - entry._auto_place = !invert; - break; + // Scan for things like ap, ad, ar, and pull them out of the + // stream. + vector_string::iterator ci, cnext; + ci = params.begin(); + while (ci != params.end()) { + cnext = ci; + ++cnext; - case 'd': - entry._auto_distribute = !invert; - break; + string param = *ci; + bool invert = false; + if (param[0] == '!' && param.size() > 1) { + invert = true; + param = param.substr(1); + } + if (tolower(param[0]) == 'a' && param.size() > 1) { + switch (tolower(param[1])) { + case 'p': + entry._auto_place = !invert; + break; - case 'r': + case 'd': + entry._auto_distribute = !invert; + break; + + case 'r': if (!string_to_double(param.substr(2), entry._curvature_ratio)) { - qtess_cat.error() + qtess_cat.error() << _filename << ": line " << line_number << " - invalid field " << param << "\n"; - return false; - } - break; + return false; + } + break; - default: - qtess_cat.error() + default: + qtess_cat.error() << _filename << ": invalid parameters at line " << line_number << ".\n"; - return false; - } - params.erase(ci); - } else { - ci = cnext; - } - } - - if (!params.empty()) { - bool okflag = true; - if (cmp_nocase(params[0], "omit")==0) { - entry.set_omit(); + return false; + } + params.erase(ci); + } else { + ci = cnext; + } + } - } else if (cmp_nocase(params[0], "matchuu")==0) { - entry.set_match_uu(); - if (params.size() > 1 && cmp_nocase(params[1], "matchvv")==0) { - entry.set_match_vv(); - } + if (!params.empty()) { + bool okflag = true; + if (cmp_nocase(params[0], "omit")==0) { + entry.set_omit(); - } else if (cmp_nocase(params[0], "matchvv")==0) { - entry.set_match_vv(); - if (params.size() > 1 && cmp_nocase(params[1], "matchuu")==0) { - entry.set_match_uu(); - } + } else if (cmp_nocase(params[0], "matchuu")==0) { + entry.set_match_uu(); + if (params.size() > 1 && cmp_nocase(params[1], "matchvv")==0) { + entry.set_match_vv(); + } - } else if (cmp_nocase(params[0], "matchuv")==0) { - entry.set_match_uv(); - if (params.size() > 1 && cmp_nocase(params[1], "matchvu")==0) { - entry.set_match_vu(); - } + } else if (cmp_nocase(params[0], "matchvv")==0) { + entry.set_match_vv(); + if (params.size() > 1 && cmp_nocase(params[1], "matchuu")==0) { + entry.set_match_uu(); + } - } else if (cmp_nocase(params[0], "matchvu")==0) { - entry.set_match_vu(); - if (params.size() > 1 && cmp_nocase(params[1], "matchuv")==0) { - entry.set_match_uv(); - } + } else if (cmp_nocase(params[0], "matchuv")==0) { + entry.set_match_uv(); + if (params.size() > 1 && cmp_nocase(params[1], "matchvu")==0) { + entry.set_match_vu(); + } - } else if (cmp_nocase(params[0], "minu")==0) { - // minu #: minimum tesselation in U. - if (params.size() < 2) { - okflag = false; - } else { + } else if (cmp_nocase(params[0], "matchvu")==0) { + entry.set_match_vu(); + if (params.size() > 1 && cmp_nocase(params[1], "matchuv")==0) { + entry.set_match_uv(); + } + + } else if (cmp_nocase(params[0], "minu")==0) { + // minu #: minimum tesselation in U. + if (params.size() < 2) { + okflag = false; + } else { int value = 0; okflag = string_to_int(params[1], value); - entry.set_min_u(value); - } + entry.set_min_u(value); + } - } else if (cmp_nocase(params[0], "minv")==0) { - // minu #: minimum tesselation in V. - if (params.size() < 2) { - okflag = false; - } else { + } else if (cmp_nocase(params[0], "minv")==0) { + // minu #: minimum tesselation in V. + if (params.size() < 2) { + okflag = false; + } else { int value = 0; okflag = string_to_int(params[1], value); - entry.set_min_v(value); - } + entry.set_min_v(value); + } - } else if (tolower(params[0][0]) == 'i') { - // "i#": per-isoparam tesselation. + } else if (tolower(params[0][0]) == 'i') { + // "i#": per-isoparam tesselation. int value = 0; okflag = string_to_int(params[0].substr(1), value); entry.set_per_isoparam(value); - } else if (params[0][params[0].length() - 1] == '%') { + } else if (params[0][params[0].length() - 1] == '%') { double value = 0.0; okflag = string_to_double(params[0].substr(0, params[0].length() - 1), value); - entry.set_importance(value / 100.0); + entry.set_importance(value / 100.0); - } else if (params.size() == 1) { - // One numeric parameter: the number of triangles. + } else if (params.size() == 1) { + // One numeric parameter: the number of triangles. int value = 0; okflag = string_to_int(params[0], value); entry.set_num_tris(value); - } else if (params.size() >= 2) { - // Two or more numeric parameters: the number of u by v quads, - // followed by an optional list of specific isoparams. + } else if (params.size() >= 2) { + // Two or more numeric parameters: the number of u by v quads, + // followed by an optional list of specific isoparams. int u = 0, v = 0; okflag = string_to_int(params[0], u) && string_to_int(params[1], v); - entry.set_uv(u, v, ¶ms[2], params.size() - 2); + entry.set_uv(u, v, ¶ms[2], params.size() - 2); - } else { - okflag = false; - } + } else { + okflag = false; + } - if (!okflag) { - qtess_cat.error() + if (!okflag) { + qtess_cat.error() << _filename << ": invalid parameters at line " << line_number << ".\n"; - return false; - } - } - _entries.push_back(entry); + return false; + } + } + _entries.push_back(entry); } } } diff --git a/pandatool/src/egg-qtess/qtessSurface.cxx b/pandatool/src/egg-qtess/qtessSurface.cxx index 0c97fb7711..e8c49b4fd4 100644 --- a/pandatool/src/egg-qtess/qtessSurface.cxx +++ b/pandatool/src/egg-qtess/qtessSurface.cxx @@ -75,10 +75,10 @@ QtessSurface(EggNurbsSurface *egg_surface) : if (QtessGlobals::_respect_egg) { if (egg_surface->get_u_subdiv() != 0) { - _num_u = egg_surface->get_u_subdiv(); + _num_u = egg_surface->get_u_subdiv(); } if (egg_surface->get_v_subdiv() != 0) { - _num_v = egg_surface->get_v_subdiv(); + _num_v = egg_surface->get_v_subdiv(); } } } @@ -347,16 +347,16 @@ apply_match() { << "No surface to match " << get_name() << " to in U.\n"; } else { if (qtess_cat.is_debug()) { - qtess_cat.debug() + qtess_cat.debug() << "Matching " << get_name() << " in U to " << m->get_name() << " in " << (_match_u_to_u?'U':'V') << ".\n"; } if (_match_u_to_u) { - _tess_u = m->_tess_u; - _iso_u = m->_iso_u; + _tess_u = m->_tess_u; + _iso_u = m->_iso_u; } else { - _tess_u = m->_tess_v; - _iso_u = m->_iso_v; + _tess_u = m->_tess_v; + _iso_u = m->_iso_v; } } } @@ -368,16 +368,16 @@ apply_match() { << "No surface to match " << get_name() << " in V.\n"; } else { if (qtess_cat.is_debug()) { - qtess_cat.debug() + qtess_cat.debug() << "Matching " << get_name() << " in V to " << m->get_name() << " in " << (_match_v_to_v?'V':'U') << ".\n"; } if (_match_v_to_v) { - _tess_v = m->_tess_v; - _iso_v = m->_iso_v; + _tess_v = m->_tess_v; + _iso_v = m->_iso_v; } else { - _tess_v = m->_tess_u; - _iso_v = m->_iso_u; + _tess_v = m->_tess_u; + _iso_v = m->_iso_u; } } } @@ -448,9 +448,9 @@ do_uniform_tesselate(int &tris) const { } for (ui = 0; ui < num_u; ui++) { if (_iso_u.empty()) { - u = (double)ui / (double)(num_u-1); + u = (double)ui / (double)(num_u-1); } else { - u = _iso_u[ui] / _iso_u.back(); + u = _iso_u[ui] / _iso_u.back(); } PT(EggVertex) egg_vertex = evaluate_vertex(u, v); diff --git a/pandatool/src/egg-qtess/subdivSegment.cxx b/pandatool/src/egg-qtess/subdivSegment.cxx index a8b92ea44d..e9fddfff86 100644 --- a/pandatool/src/egg-qtess/subdivSegment.cxx +++ b/pandatool/src/egg-qtess/subdivSegment.cxx @@ -69,8 +69,8 @@ cut() { int mv = 0; for (c = 0; c < (int)_cuts.size(); c++) { if (mc == -1 || _cuts[c] - last > mv) { - mc = c; - mv = _cuts[c] - last; + mc = c; + mv = _cuts[c] - last; } last = _cuts[c]; } diff --git a/pandatool/src/eggbase/eggWriter.cxx b/pandatool/src/eggbase/eggWriter.cxx index 5426a947d3..cf87ab85ab 100644 --- a/pandatool/src/eggbase/eggWriter.cxx +++ b/pandatool/src/eggbase/eggWriter.cxx @@ -172,8 +172,8 @@ post_process_egg_file() { } else { for (vector_string::const_iterator si = _tbn_names.begin(); - si != _tbn_names.end(); - ++si) { + si != _tbn_names.end(); + ++si) { GlobPattern uv_name(*si); nout << "Computing tangent and binormal for \"" << uv_name << "\"\n"; _data->recompute_tangent_binormal(uv_name); diff --git a/pandatool/src/flt/fltHeader.h b/pandatool/src/flt/fltHeader.h index ecebaf25d5..0a51533979 100644 --- a/pandatool/src/flt/fltHeader.h +++ b/pandatool/src/flt/fltHeader.h @@ -59,7 +59,7 @@ public: PathReplace *get_path_replace(); const PathReplace *get_path_replace() const; Filename convert_path(const Filename &orig_filename, - const DSearchPath &additional_path = DSearchPath()); + const DSearchPath &additional_path = DSearchPath()); void set_flt_filename(const Filename &flt_filename); const Filename &get_flt_filename() const; diff --git a/pandatool/src/fltegg/fltToEggConverter.cxx b/pandatool/src/fltegg/fltToEggConverter.cxx index 4bb5884deb..d7f3c4f8be 100644 --- a/pandatool/src/fltegg/fltToEggConverter.cxx +++ b/pandatool/src/fltegg/fltToEggConverter.cxx @@ -638,7 +638,7 @@ parse_comment(const FltBead *flt_bead, EggNode *egg_node) { bool FltToEggConverter:: parse_comment(const FltTexture *flt_texture, EggNode *egg_node) { return parse_comment(flt_texture->get_comment(), - flt_texture->get_texture_filename(), egg_node); + flt_texture->get_texture_filename(), egg_node); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/imageprogs/imageTrans.cxx b/pandatool/src/imageprogs/imageTrans.cxx index 967dc32d7e..417e985eab 100644 --- a/pandatool/src/imageprogs/imageTrans.cxx +++ b/pandatool/src/imageprogs/imageTrans.cxx @@ -90,24 +90,24 @@ run() { if (_has_color_scale) { if (_color_scale[0] != 1.0f || - _color_scale[1] != 1.0f || - _color_scale[2] != 1.0f) { + _color_scale[1] != 1.0f || + _color_scale[2] != 1.0f) { for (int yi = 0; yi < _image.get_y_size(); ++yi) { - for (int xi = 0; xi < _image.get_x_size(); ++xi) { - RGBColord rgb = _image.get_xel(xi, yi); - _image.set_xel(xi, yi, - rgb[0] * _color_scale[0], - rgb[1] * _color_scale[1], - rgb[2] * _color_scale[2]); - } + for (int xi = 0; xi < _image.get_x_size(); ++xi) { + RGBColord rgb = _image.get_xel(xi, yi); + _image.set_xel(xi, yi, + rgb[0] * _color_scale[0], + rgb[1] * _color_scale[1], + rgb[2] * _color_scale[2]); + } } } if (_image.has_alpha() && _color_scale[3] != 1.0f) { for (int yi = 0; yi < _image.get_y_size(); ++yi) { - for (int xi = 0; xi < _image.get_x_size(); ++xi) { - float a = _image.get_alpha(xi, yi); - _image.set_alpha(xi, yi, a * _color_scale[3]); - } + for (int xi = 0; xi < _image.get_x_size(); ++xi) { + float a = _image.get_alpha(xi, yi); + _image.set_alpha(xi, yi, a * _color_scale[3]); + } } } } diff --git a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx index 03e4108323..e2ddd13f3d 100644 --- a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx +++ b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx @@ -109,14 +109,14 @@ read_iff(IffInputFile *in, size_t stop_at) { << " specified by discontinuous vertex map.\n" << "Original value = "; - PTA_float::const_iterator vi; - for (vi = orig_value.begin(); vi != orig_value.end(); ++vi) { - nout << (*vi) << " "; - } + PTA_float::const_iterator vi; + for (vi = orig_value.begin(); vi != orig_value.end(); ++vi) { + nout << (*vi) << " "; + } nout << " new value = "; - for (vi = value.begin(); vi != value.end(); ++vi) { - nout << (*vi) << " "; - } + for (vi = value.begin(); vi != value.end(); ++vi) { + nout << (*vi) << " "; + } nout << "\n"; } } diff --git a/pandatool/src/maxegg/maxDllEntry.cxx b/pandatool/src/maxegg/maxDllEntry.cxx index db7a5e4b8d..58ec276f5f 100755 --- a/pandatool/src/maxegg/maxDllEntry.cxx +++ b/pandatool/src/maxegg/maxDllEntry.cxx @@ -1,14 +1,14 @@ /********************************************************************** *< - FILE: DllEntry.cpp + FILE: DllEntry.cpp - DESCRIPTION: Contains the Dll Entry stuff + DESCRIPTION: Contains the Dll Entry stuff - CREATED BY: + CREATED BY: - HISTORY: + HISTORY: - *> Copyright (c) 2000, All Rights Reserved. + *> Copyright (c) 2000, All Rights Reserved. **********************************************************************/ #include "MaxEgg.h" @@ -26,38 +26,38 @@ int controlsInit = FALSE; BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { - hInstance = hinstDLL; // Hang on to this DLL's instance handle. + hInstance = hinstDLL; // Hang on to this DLL's instance handle. - if (!controlsInit) { - controlsInit = TRUE; - InitCustomControls(hInstance); // Initialize MAX's custom controls - InitCommonControls(); // Initialize Win95 controls - } - - return (TRUE); + if (!controlsInit) { + controlsInit = TRUE; + InitCustomControls(hInstance); // Initialize MAX's custom controls + InitCommonControls(); // Initialize Win95 controls + } + + return (TRUE); } // This function returns a string that describes the DLL and where the user // could purchase the DLL if they don't have it. __declspec( dllexport ) const TCHAR* LibDescription() { - return GetString(IDS_LIBDESCRIPTION); + return GetString(IDS_LIBDESCRIPTION); } // This function returns the number of plug-in classes this DLL operates on. //TODO: Must change this number when adding a new class __declspec( dllexport ) int LibNumberClasses() { - return 1; + return 1; } // This function returns the descriptions of the plug-in classes this DLL operates on. __declspec( dllexport ) ClassDesc* LibClassDesc(int i) { - switch(i) { - case 0: return GetMaxEggPluginDesc(); - default: return NULL; - } + switch(i) { + case 0: return GetMaxEggPluginDesc(); + default: return NULL; + } } // This function returns a pre-defined constant indicating the version of @@ -65,15 +65,15 @@ __declspec( dllexport ) ClassDesc* LibClassDesc(int i) // to catch obsolete DLLs. __declspec( dllexport ) ULONG LibVersion() { - return VERSION_3DSMAX; + return VERSION_3DSMAX; } TCHAR *GetString(int id) { - static TCHAR buf[256]; + static TCHAR buf[256]; - if (hInstance) - return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; - return NULL; + if (hInstance) + return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; + return NULL; } diff --git a/pandatool/src/maxegg/maxEgg.cxx b/pandatool/src/maxegg/maxEgg.cxx index 0f80ffd3d7..9ec748f173 100755 --- a/pandatool/src/maxegg/maxEgg.cxx +++ b/pandatool/src/maxegg/maxEgg.cxx @@ -58,7 +58,7 @@ IObjParam *MaxEggPlugin::iObjParams; */ BOOL CALLBACK MaxEggPluginOptionsDlgProc( HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam ) + WPARAM wParam, LPARAM lParam ) { MaxEggExpOptions *tempEgg; int sel, res; @@ -189,10 +189,10 @@ void MaxEggPlugin::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev iObjParams = ip; if ( !hMaxEggParams ) { hMaxEggParams = ip->AddRollupPage(hInstance, - MAKEINTRESOURCE(IDD_PANEL), - MaxEggPluginOptionsDlgProc, - GetString(IDS_PARAMS), - (LPARAM)this ); + MAKEINTRESOURCE(IDD_PANEL), + MaxEggPluginOptionsDlgProc, + GetString(IDS_PARAMS), + (LPARAM)this ); ip->RegisterDlgWnd(hMaxEggParams); } else { SetWindowLongPtr( hMaxEggParams, GWLP_USERDATA, (LPARAM)this ); @@ -204,10 +204,10 @@ void MaxEggPlugin::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev void MaxEggPlugin::EndEditParams( IObjParam *ip, ULONG flags,Animatable *prev) { SaveCheckState(); - if ( flags&END_EDIT_REMOVEUI ) { + if ( flags&END_EDIT_REMOVEUI ) { ip->UnRegisterDlgWnd(hMaxEggParams); ip->DeleteRollupPage(hMaxEggParams); - hMaxEggParams = NULL; + hMaxEggParams = NULL; } else { SetWindowLongPtr( hMaxEggParams, GWLP_USERDATA, NULL ); } @@ -375,7 +375,7 @@ public: }; int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) -{ +{ if (msg==MOUSE_POINT||msg==MOUSE_MOVE) { switch(point) { case 0: @@ -384,9 +384,9 @@ int MaxEggPluginCreateMouseCallBack::proc(ViewExp *vpt,int msg, int point, int f case 1: mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE)); if (msg==MOUSE_POINT) return CREATE_STOP; - break; + break; } - } else if (msg == MOUSE_ABORT) { + } else if (msg == MOUSE_ABORT) { return CREATE_ABORT; } return CREATE_CONTINUE; @@ -437,11 +437,11 @@ void MaxEggPlugin::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box int MaxEggPlugin::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { HitRegion hitRegion; - DWORD savedLimits; + DWORD savedLimits; Matrix3 m; - GraphicsWindow *gw = vpt->getGW(); + GraphicsWindow *gw = vpt->getGW(); Material *mtl = gw->getMaterial(); - MakeHitRegion(hitRegion,type,crossing,4,p); + MakeHitRegion(hitRegion,type,crossing,4,p); gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM); GetMat(t,inode,vpt,m); gw->setTransform(m); @@ -484,7 +484,7 @@ Interval MaxEggPlugin::ObjectValidity(TimeValue t) { Interval ivalid; ivalid.SetInfinite(); - return ivalid; + return ivalid; } RefTargetHandle MaxEggPlugin::Clone(RemapDir& remap) diff --git a/pandatool/src/maxegg/maxEgg.h b/pandatool/src/maxegg/maxEgg.h index cbf4ad1b50..d3d73f45ca 100755 --- a/pandatool/src/maxegg/maxEgg.h +++ b/pandatool/src/maxegg/maxEgg.h @@ -26,7 +26,7 @@ */ #include "maxLogger.h" #define ME Logger::ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM6 -#define MaxEggPlugin_CLASS_ID Class_ID(0x7ac0d6b7, 0x55731ef6) +#define MaxEggPlugin_CLASS_ID Class_ID(0x7ac0d6b7, 0x55731ef6) /* Externed Globals */ @@ -119,7 +119,7 @@ class MaxEggPlugin : public HelperObject const double meshVerts[252][3] = { - {0.729464, 0.714986, -0.919852}, + {0.729464, 0.714986, -0.919852}, {0.466137, 0.160201, -0.594656}, {-0.265897, 0.714986, -1.14704}, {0.466137, 0.160201, -0.594656}, diff --git a/pandatool/src/maxegg/maxEggExpOptions.cxx b/pandatool/src/maxegg/maxEggExpOptions.cxx index 1e6a4d879e..f28c67c0df 100755 --- a/pandatool/src/maxegg/maxEggExpOptions.cxx +++ b/pandatool/src/maxegg/maxEggExpOptions.cxx @@ -235,7 +235,7 @@ choosingNodes(false), prev_type(AT_model) { } BOOL CALLBACK MaxEggExpOptionsProc( HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam ) + WPARAM wParam, LPARAM lParam ) { char tempFilename[2048]; //We pass in our plugin through the lParam variable. Let's convert it back. @@ -653,27 +653,27 @@ bool MaxEggExpOptions::DoExport(IObjParam *ip, bool autoOverwrite, bool saveLog) //Set the various logging levels for the subsystems. Logger::SetOneErrorMask( ME, Logger::SAT_ALL ); Logger::SetOneErrorMask( MTE, Logger::SAT_NULL_ERROR | - Logger::SAT_CRITICAL_ERROR | - Logger::SAT_PARAMETER_INVALID_ERROR | - Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL ); + Logger::SAT_CRITICAL_ERROR | + Logger::SAT_PARAMETER_INVALID_ERROR | + Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL ); Logger::SetOneErrorMask( MTEC, Logger::SAT_NULL_ERROR | - Logger::SAT_CRITICAL_ERROR | - Logger::SAT_PARAMETER_INVALID_ERROR | - Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | - Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL | - Logger::SAT_DEBUG_SPAM_LEVEL ); + Logger::SAT_CRITICAL_ERROR | + Logger::SAT_PARAMETER_INVALID_ERROR | + Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | + Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL | + Logger::SAT_DEBUG_SPAM_LEVEL ); Logger::SetOneErrorMask( MNEG, Logger::SAT_NULL_ERROR | - Logger::SAT_CRITICAL_ERROR | - Logger::SAT_PARAMETER_INVALID_ERROR | - Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | - Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL ); + Logger::SAT_CRITICAL_ERROR | + Logger::SAT_PARAMETER_INVALID_ERROR | + Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | + Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL ); Logger::SetOneErrorMask( MNEG_GEOMETRY_GENERATION, Logger::SAT_NULL_ERROR | - Logger::SAT_CRITICAL_ERROR | - Logger::SAT_PARAMETER_INVALID_ERROR | - Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | - Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL ); + Logger::SAT_CRITICAL_ERROR | + Logger::SAT_PARAMETER_INVALID_ERROR | + Logger::SAT_OTHER_ERROR | Logger::SAT_HIGH_LEVEL | + Logger::SAT_MEDIUM_LEVEL | Logger::SAT_LOW_LEVEL ); Logger::SetOneErrorMask( LLOGGING, Logger::SAT_ALL ); - + Logger::FunctionEntry( "MaxEggPlugin::DoExport" ); // Copy the output filename so that it can be modified if necessary @@ -750,14 +750,14 @@ bool MaxEggExpOptions::DoExport(IObjParam *ip, bool autoOverwrite, bool saveLog) // would throw an exception. That no longer happens, but this is still // here for good measure try { - Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before deleting pmteconverter"); + Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before deleting pmteconverter"); delete pmteConverter; } catch (...) { - Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before error message window"); + Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before error message window"); MessageBox(ip->GetMAXHWnd(), "I just got an unknown exception.", - "Panda3D Converter", MB_OK); + "Panda3D Converter", MB_OK); } - Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before logger function exit"); + Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "before logger function exit"); Logger::FunctionExit(); //Free the error logger if ( Logger::globalLoggingInstance ) diff --git a/pandatool/src/maxegg/maxEggExpOptions.h b/pandatool/src/maxegg/maxEggExpOptions.h index ca1cceb613..d6f7bfd9e3 100755 --- a/pandatool/src/maxegg/maxEggExpOptions.h +++ b/pandatool/src/maxegg/maxEggExpOptions.h @@ -50,7 +50,7 @@ int ChunkLoadInt(ILoad *iload); bool ChunkLoadBool(ILoad *iload); void SetICustEdit(HWND wnd, int nIDDlgItem, char *text); BOOL CALLBACK MaxEggExpOptionsProc( HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam ); + WPARAM wParam, LPARAM lParam ); class MaxEggExpOptions { @@ -108,7 +108,7 @@ class MaxEggExpOptions IOResult Save(ISave *isave); //int DoExport(const TCHAR *name,ExpInterface *ei, - // Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); + // Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0); }; #endif // __MaxEggExpOptions__H diff --git a/pandatool/src/maxegg/maxLogger.cxx b/pandatool/src/maxegg/maxLogger.cxx index 23ebe35a4c..e454f484dd 100755 --- a/pandatool/src/maxegg/maxLogger.cxx +++ b/pandatool/src/maxegg/maxLogger.cxx @@ -1,361 +1,361 @@ #include "maxLogger.h" -/* Globals & Static Members +/* Globals & Static Members */ Logger *Logger::globalLoggingInstance = 0; -/* Error Logger Member Functions +/* Error Logger Member Functions */ Logger::Logger() { - VoidEverything(); - LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, "A new, void Logging instance has been created." ); + VoidEverything(); + LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, "A new, void Logging instance has been created." ); } Logger::Logger( LoggingPipeType toWhere, char *additionalStringInfo ) { - VoidEverything(); - SetPipeInstance( toWhere, additionalStringInfo ); - - sprintf( GetLogString(), "A new, piped logging instance has been created with data '%s'.", additionalStringInfo ); - LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, GetLogString() ); + VoidEverything(); + SetPipeInstance( toWhere, additionalStringInfo ); + + sprintf( GetLogString(), "A new, piped logging instance has been created with data '%s'.", additionalStringInfo ); + LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, GetLogString() ); } Logger::~Logger() { - //Send message telling everyone we're going away. - LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, "Error logger shutting down!" ); - //If we've got an open file, close that muthafugga! - if ( ( myLogDestination == PIPE_TO_FILE ) && myFileOutputLog.is_open() ) - myFileOutputLog.close(); - VoidEverything(); + //Send message telling everyone we're going away. + LogInstance( LLOGGING, SAT_MEDIUM_LEVEL, "Error logger shutting down!" ); + //If we've got an open file, close that muthafugga! + if ( ( myLogDestination == PIPE_TO_FILE ) && myFileOutputLog.is_open() ) + myFileOutputLog.close(); + VoidEverything(); } -/* Public, Static Member Functions +/* Public, Static Member Functions */ void Logger::FunctionEntry( char *newFunctionName ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->FunctionEntryInstance( newFunctionName ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->FunctionEntryInstance( newFunctionName ); } void Logger::FunctionExit() { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->FunctionExitInstance(); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->FunctionExitInstance(); } int Logger::GetHierarchyLevel() { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - return globalLoggingInstance->GetHierarchyLevelInstance(); - else return 0; + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + return globalLoggingInstance->GetHierarchyLevelInstance(); + else return 0; } char * Logger::GetLogString() { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - return globalLoggingInstance->GetLogStringInstance(); - else return 0; + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + return globalLoggingInstance->GetLogStringInstance(); + else return 0; } void Logger::Log( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->LogInstance( whichSystem, whichErrorKind, errorDescription ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->LogInstance( whichSystem, whichErrorKind, errorDescription ); } void Logger::SetCurrentFunctionName( char *newFunctionName ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->SetCurrentFunctionNameInstance( newFunctionName ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->SetCurrentFunctionNameInstance( newFunctionName ); } void Logger::SetHierarchyLevel( unsigned int newIndentLevel ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->SetHierarchyLevelInstance( newIndentLevel ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->SetHierarchyLevelInstance( newIndentLevel ); } void Logger::SetOneErrorMask( SystemType whichType, long int whichErrors ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->SetOneErrorMaskInstance( whichType, whichErrors ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->SetOneErrorMaskInstance( whichType, whichErrors ); } void Logger::SetPipe( LoggingPipeType toWhere, char *additionalStringInfo ) { - if ( !globalLoggingInstance ) - globalLoggingInstance = new Logger(); - if ( globalLoggingInstance ) - globalLoggingInstance->SetPipeInstance( toWhere, additionalStringInfo ); + if ( !globalLoggingInstance ) + globalLoggingInstance = new Logger(); + if ( globalLoggingInstance ) + globalLoggingInstance->SetPipeInstance( toWhere, additionalStringInfo ); } -/* Private Member Functions +/* Private Member Functions */ void Logger::FunctionEntryInstance( char *newFunctionName ) { - SetCurrentFunctionNameInstance( newFunctionName ); - SetHierarchyLevelInstance( GetHierarchyLevelInstance() + 1 ); + SetCurrentFunctionNameInstance( newFunctionName ); + SetHierarchyLevelInstance( GetHierarchyLevelInstance() + 1 ); } void Logger::FunctionExitInstance() { - char endMsg[64]; + char endMsg[64]; - SetHierarchyLevelInstance( GetHierarchyLevelInstance() - 1 ); - if ( myFunctionNames.back() ) - { - if ( myWrittenHierarchyLevel >= myHierarchyLevel ) - { - sprintf( endMsg, "#END {%s}", myFunctionNames.back() ); - WriteToPipe( endMsg ); - //LogInstance( LLOGGING, this->SAT_HIGH_LEVEL, GetLogStringInstance()); - --myWrittenHierarchyLevel; - } - free( (void *)myFunctionNames.back() ); - myFunctionNames.pop_back(); - } + SetHierarchyLevelInstance( GetHierarchyLevelInstance() - 1 ); + if ( myFunctionNames.back() ) + { + if ( myWrittenHierarchyLevel >= myHierarchyLevel ) + { + sprintf( endMsg, "#END {%s}", myFunctionNames.back() ); + WriteToPipe( endMsg ); + //LogInstance( LLOGGING, this->SAT_HIGH_LEVEL, GetLogStringInstance()); + --myWrittenHierarchyLevel; + } + free( (void *)myFunctionNames.back() ); + myFunctionNames.pop_back(); + } } int Logger::GetHierarchyLevelInstance() { - return myHierarchyLevel; + return myHierarchyLevel; } char * Logger::GetLogStringInstance() { - return myLogString; + return myLogString; } void Logger::LogInstance( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ) { - unsigned int i; - char *typeBuf; - char beginMsg[64]; + unsigned int i; + char *typeBuf; + char beginMsg[64]; - if ( !errorDescription ) - return; - if ( !( (int)whichErrorKind & myErrorMasks[(int)whichSystem] ) ) - return; - typeBuf = (char *)malloc( strlen( errorDescription ) + 64 ); - if ( !typeBuf ) - return; - typeBuf = strcpy( typeBuf, errorDescription ); - switch( whichErrorKind ) - { - case SAT_NONE: - break; - case SAT_NULL_ERROR: - strcat( typeBuf, " - (***!!!NULL ERROR!!!***, " ); - break; - case SAT_CRITICAL_ERROR: - strcat( typeBuf, " - (***!!!CRITICAL ERROR!!!***, " ); - break; - case SAT_PARAMETER_INVALID_ERROR: - strcat( typeBuf, " - (***PARAMETER ERROR***, " ); - break; - case SAT_OTHER_ERROR: - strcat( typeBuf, " - (***OTHER ERROR***, " ); - break; - case SAT_HIGH_LEVEL: - strcat( typeBuf, " - (---HIGH LEVEL---, " ); - break; - case SAT_MEDIUM_LEVEL: - strcat( typeBuf, " - (MEDIUM LEVEL, " ); - break; - case SAT_LOW_LEVEL: - strcat( typeBuf, " - (LOW LEVEL, " ); - break; - case SAT_DEBUG_SPAM_LEVEL: - strcat( typeBuf, " - (SPAM LEVEL, " ); - break; - case SAT_ALL: - strcat( typeBuf, " - (ALL INCLUSIVE, " ); - break; - } - switch( whichSystem ) - { - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM1: - strcat( typeBuf, "SYS_ONE)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM2: - strcat( typeBuf, "SYS_TWO)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM3: - strcat( typeBuf, "SYS_THREE)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4: - strcat( typeBuf, "SYS_FOUR)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM5: - strcat( typeBuf, "SYS_FIVE)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM6: - strcat( typeBuf, "SYS_SIX)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM7: - strcat( typeBuf, "SYS_SEVEN)" ); - break; - case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM8: - strcat( typeBuf, "SYS_EIGHT)" ); - break; - } - - //Now that we've created the correct logging line to print, we need to worry - //about function entries and exits. Only do this if we're not writing to a dialog box. - if ( myLogDestination != PIPE_TO_DIALOG_BOX ) - { - unsigned int tempHierarchyLevel = myHierarchyLevel; + if ( !errorDescription ) + return; + if ( !( (int)whichErrorKind & myErrorMasks[(int)whichSystem] ) ) + return; + typeBuf = (char *)malloc( strlen( errorDescription ) + 64 ); + if ( !typeBuf ) + return; + typeBuf = strcpy( typeBuf, errorDescription ); + switch( whichErrorKind ) + { + case SAT_NONE: + break; + case SAT_NULL_ERROR: + strcat( typeBuf, " - (***!!!NULL ERROR!!!***, " ); + break; + case SAT_CRITICAL_ERROR: + strcat( typeBuf, " - (***!!!CRITICAL ERROR!!!***, " ); + break; + case SAT_PARAMETER_INVALID_ERROR: + strcat( typeBuf, " - (***PARAMETER ERROR***, " ); + break; + case SAT_OTHER_ERROR: + strcat( typeBuf, " - (***OTHER ERROR***, " ); + break; + case SAT_HIGH_LEVEL: + strcat( typeBuf, " - (---HIGH LEVEL---, " ); + break; + case SAT_MEDIUM_LEVEL: + strcat( typeBuf, " - (MEDIUM LEVEL, " ); + break; + case SAT_LOW_LEVEL: + strcat( typeBuf, " - (LOW LEVEL, " ); + break; + case SAT_DEBUG_SPAM_LEVEL: + strcat( typeBuf, " - (SPAM LEVEL, " ); + break; + case SAT_ALL: + strcat( typeBuf, " - (ALL INCLUSIVE, " ); + break; + } + switch( whichSystem ) + { + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM1: + strcat( typeBuf, "SYS_ONE)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM2: + strcat( typeBuf, "SYS_TWO)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM3: + strcat( typeBuf, "SYS_THREE)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4: + strcat( typeBuf, "SYS_FOUR)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM5: + strcat( typeBuf, "SYS_FIVE)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM6: + strcat( typeBuf, "SYS_SIX)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM7: + strcat( typeBuf, "SYS_SEVEN)" ); + break; + case ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM8: + strcat( typeBuf, "SYS_EIGHT)" ); + break; + } - i = 0; - for( CharStarVectorIterator hierarchyDepthIterator = myFunctionNames.begin(); - hierarchyDepthIterator != myFunctionNames.end(); - ++hierarchyDepthIterator ) - { - ++i; - //Since we're writing some output, we need to print all function headings - //leading up to this output, bumping up our written hierarchy level to match - //the "actual" level. - //If we've reached a function level that's deeper than what we've written out already... - if ( i > myWrittenHierarchyLevel ) - { - myHierarchyLevel = myWrittenHierarchyLevel; - sprintf( beginMsg, "#BEGIN {%s}", *hierarchyDepthIterator ); - WriteToPipe( beginMsg ); - myHierarchyLevel = tempHierarchyLevel; - ++myWrittenHierarchyLevel; - } - } - } - WriteToPipe( typeBuf ); - free(typeBuf); + //Now that we've created the correct logging line to print, we need to worry + //about function entries and exits. Only do this if we're not writing to a dialog box. + if ( myLogDestination != PIPE_TO_DIALOG_BOX ) + { + unsigned int tempHierarchyLevel = myHierarchyLevel; + + i = 0; + for( CharStarVectorIterator hierarchyDepthIterator = myFunctionNames.begin(); + hierarchyDepthIterator != myFunctionNames.end(); + ++hierarchyDepthIterator ) + { + ++i; + //Since we're writing some output, we need to print all function headings + //leading up to this output, bumping up our written hierarchy level to match + //the "actual" level. + //If we've reached a function level that's deeper than what we've written out already... + if ( i > myWrittenHierarchyLevel ) + { + myHierarchyLevel = myWrittenHierarchyLevel; + sprintf( beginMsg, "#BEGIN {%s}", *hierarchyDepthIterator ); + WriteToPipe( beginMsg ); + myHierarchyLevel = tempHierarchyLevel; + ++myWrittenHierarchyLevel; + } + } + } + WriteToPipe( typeBuf ); + free(typeBuf); } void Logger::SetCurrentFunctionNameInstance( char *newFunctionName ) { - char *newBuf; + char *newBuf; - //No FunctionEntry Instance allowed...that function uses this! - if ( !newFunctionName ) - { - LogInstance( LLOGGING, SAT_NULL_ERROR, "newFunctionName is null!" ); - return; - } - newBuf = strdup( newFunctionName ); - myFunctionNames.push_back( newBuf ); + //No FunctionEntry Instance allowed...that function uses this! + if ( !newFunctionName ) + { + LogInstance( LLOGGING, SAT_NULL_ERROR, "newFunctionName is null!" ); + return; + } + newBuf = strdup( newFunctionName ); + myFunctionNames.push_back( newBuf ); } void Logger::SetHierarchyLevelInstance( unsigned int newIndentLevel ) { - myHierarchyLevel = newIndentLevel; + myHierarchyLevel = newIndentLevel; } void Logger::SetOneErrorMaskInstance( SystemType whichType, long int whichErrors ) { - if ( ( (int)whichType < 0 ) || ( (int)whichType >= MY_MAX_NUM_SYSTEMS ) ) - { - LogInstance( LLOGGING, SAT_PARAMETER_INVALID_ERROR, "whichType is out of bounds!" ); - return; - } - //Now that the sanity check is out of the way, let us change the error mask! - myErrorMasks[(int)whichType] = whichErrors; - sprintf( GetLogStringInstance(), "Set error mask for system with ID %x to %x.", (int)whichType, whichErrors ); - LogInstance( LLOGGING, SAT_LOW_LEVEL, GetLogStringInstance() ); + if ( ( (int)whichType < 0 ) || ( (int)whichType >= MY_MAX_NUM_SYSTEMS ) ) + { + LogInstance( LLOGGING, SAT_PARAMETER_INVALID_ERROR, "whichType is out of bounds!" ); + return; + } + //Now that the sanity check is out of the way, let us change the error mask! + myErrorMasks[(int)whichType] = whichErrors; + sprintf( GetLogStringInstance(), "Set error mask for system with ID %x to %x.", (int)whichType, whichErrors ); + LogInstance( LLOGGING, SAT_LOW_LEVEL, GetLogStringInstance() ); } void Logger::SetPipeInstance( LoggingPipeType toWhere, char *additionalStringInfo ) { - myLogDestination = toWhere; - switch( myLogDestination ) - { - case PIPE_TO_FILE: - if ( myFileOutputLog.is_open() ) - myFileOutputLog.close(); - if ( additionalStringInfo ) - myFileOutputLog.open( additionalStringInfo, ofstream::out | ofstream::trunc ); - else - myFileOutputLog.open( "Kens_Logger_Log_File.txt", ofstream::out | ofstream::trunc ); - LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to file." ); - break; - case PIPE_TO_COUT: - LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to cout." ); - break; - case PIPE_TO_CERR: - LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to cerr." ); - break; - case PIPE_TO_DIALOG_BOX: - LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to dialog box." ); - break; - case PIPE_TO_DEV_NULL: - LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to dev null." ); - break; - } + myLogDestination = toWhere; + switch( myLogDestination ) + { + case PIPE_TO_FILE: + if ( myFileOutputLog.is_open() ) + myFileOutputLog.close(); + if ( additionalStringInfo ) + myFileOutputLog.open( additionalStringInfo, ofstream::out | ofstream::trunc ); + else + myFileOutputLog.open( "Kens_Logger_Log_File.txt", ofstream::out | ofstream::trunc ); + LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to file." ); + break; + case PIPE_TO_COUT: + LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to cout." ); + break; + case PIPE_TO_CERR: + LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to cerr." ); + break; + case PIPE_TO_DIALOG_BOX: + LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to dialog box." ); + break; + case PIPE_TO_DEV_NULL: + LogInstance( LLOGGING, SAT_LOW_LEVEL, "Error output piped to dev null." ); + break; + } } void Logger::VoidEverything() { - myLogDestination = PIPE_TO_DEV_NULL; - myHierarchyLevel = 0; - myWrittenHierarchyLevel = 0; - //(Get rid of the stack of called functions.) - for (CharStarVectorIterator it = myFunctionNames.begin(); it < myFunctionNames.end(); it++) { - if (*it) - free ((void *)(*it)); - } - myFunctionNames.erase( myFunctionNames.begin(), myFunctionNames.end() ); - //Make it so that our logger blindly accepts all logs... - for( int i = 0; i < MY_MAX_NUM_SYSTEMS; ++i ) - SetOneErrorMaskInstance( (SystemType)i, (long int)SAT_ALL ); - //...but pipes them all to /dev/null. Mwahaha! The irony! - strncpy( myLogString, "No Error", LOGGER_STRING_BUFFER_SIZE - 1 ); + myLogDestination = PIPE_TO_DEV_NULL; + myHierarchyLevel = 0; + myWrittenHierarchyLevel = 0; + //(Get rid of the stack of called functions.) + for (CharStarVectorIterator it = myFunctionNames.begin(); it < myFunctionNames.end(); it++) { + if (*it) + free ((void *)(*it)); + } + myFunctionNames.erase( myFunctionNames.begin(), myFunctionNames.end() ); + //Make it so that our logger blindly accepts all logs... + for( int i = 0; i < MY_MAX_NUM_SYSTEMS; ++i ) + SetOneErrorMaskInstance( (SystemType)i, (long int)SAT_ALL ); + //...but pipes them all to /dev/null. Mwahaha! The irony! + strncpy( myLogString, "No Error", LOGGER_STRING_BUFFER_SIZE - 1 ); } void Logger::WriteToPipe( char *textToPipe ) { - switch( myLogDestination ) - { - case PIPE_TO_FILE: - if ( myFileOutputLog.is_open() ) - { - for (unsigned int i = 0; i < myHierarchyLevel; ++i ) - myFileOutputLog << " "; - myFileOutputLog << textToPipe << endl; - myFileOutputLog.flush(); - } - break; - case PIPE_TO_COUT: - cout << "(" << textToPipe << ")" << endl; - break; - case PIPE_TO_CERR: - cerr << "(" << textToPipe << ")" << endl; - break; - case PIPE_TO_DIALOG_BOX: - MessageBox( NULL, textToPipe, "Logger", MB_OK ); - break; - case PIPE_TO_DEV_NULL: - break; - } + switch( myLogDestination ) + { + case PIPE_TO_FILE: + if ( myFileOutputLog.is_open() ) + { + for (unsigned int i = 0; i < myHierarchyLevel; ++i ) + myFileOutputLog << " "; + myFileOutputLog << textToPipe << endl; + myFileOutputLog.flush(); + } + break; + case PIPE_TO_COUT: + cout << "(" << textToPipe << ")" << endl; + break; + case PIPE_TO_CERR: + cerr << "(" << textToPipe << ")" << endl; + break; + case PIPE_TO_DIALOG_BOX: + MessageBox( NULL, textToPipe, "Logger", MB_OK ); + break; + case PIPE_TO_DEV_NULL: + break; + } } diff --git a/pandatool/src/maxegg/maxLogger.h b/pandatool/src/maxegg/maxLogger.h index 24008ea57c..fe93cbd374 100755 --- a/pandatool/src/maxegg/maxLogger.h +++ b/pandatool/src/maxegg/maxLogger.h @@ -1,7 +1,7 @@ #ifndef __maxLogger__H #define __maxLogger__H -/* Standard C++ Includes for file and stream output +/* Standard C++ Includes for file and stream output */ //For file IO and cmd line output @@ -17,105 +17,105 @@ #include using namespace std; -/* Vector definitions +/* Vector definitions */ typedef vector CharStarVector; typedef CharStarVector::iterator CharStarVectorIterator; -/* Class Defintions +/* Class Defintions */ class Logger { public: - enum SystemAspectType - { - SAT_NONE = 0x0000, - SAT_NULL_ERROR = 0x0001, - SAT_CRITICAL_ERROR = 0x0002, - SAT_PARAMETER_INVALID_ERROR = 0x0004, - SAT_OTHER_ERROR = 0x0008, - SAT_HIGH_LEVEL = 0x0010, - SAT_MEDIUM_LEVEL = 0x0020, - SAT_LOW_LEVEL = 0x0040, - SAT_DEBUG_SPAM_LEVEL = 0x0080, - SAT_ALL = 0x00FF - }; + enum SystemAspectType + { + SAT_NONE = 0x0000, + SAT_NULL_ERROR = 0x0001, + SAT_CRITICAL_ERROR = 0x0002, + SAT_PARAMETER_INVALID_ERROR = 0x0004, + SAT_OTHER_ERROR = 0x0008, + SAT_HIGH_LEVEL = 0x0010, + SAT_MEDIUM_LEVEL = 0x0020, + SAT_LOW_LEVEL = 0x0040, + SAT_DEBUG_SPAM_LEVEL = 0x0080, + SAT_ALL = 0x00FF + }; - enum SystemType - { - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM1 = 0x0000, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM2 = 0x0001, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM3 = 0x0002, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4 = 0x0003, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM5 = 0x0004, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM6 = 0x0005, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM7 = 0x0006, - ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM8 = 0x0007 - }; + enum SystemType + { + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM1 = 0x0000, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM2 = 0x0001, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM3 = 0x0002, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM4 = 0x0003, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM5 = 0x0004, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM6 = 0x0005, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM7 = 0x0006, + ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM8 = 0x0007 + }; - enum LoggingPipeType - { - PIPE_TO_FILE, PIPE_TO_COUT, PIPE_TO_CERR, PIPE_TO_DIALOG_BOX, PIPE_TO_DEV_NULL - }; + enum LoggingPipeType + { + PIPE_TO_FILE, PIPE_TO_COUT, PIPE_TO_CERR, PIPE_TO_DIALOG_BOX, PIPE_TO_DEV_NULL + }; private: - //Which errors to display - long int myErrorMasks[MY_MAX_NUM_SYSTEMS]; - //For use when the the logger is set to pipe to a file. - ofstream myFileOutputLog; - //The stack of called functions. - CharStarVector myFunctionNames; - //For formatting purposes, in the file, cerr, or cout versions, add n whitespace to the front, where n is this. - unsigned int myHierarchyLevel; - //A memory of which state we're in, as far as output is concerned - LoggingPipeType myLogDestination; - //A pre-allocated string to use with sprintf, or when error logging just needs a little scratch space. - char myLogString[LOGGER_STRING_BUFFER_SIZE]; - //An integer that keeps track of how far down into the indent hierarchy we've actually written. - unsigned int myWrittenHierarchyLevel; - + //Which errors to display + long int myErrorMasks[MY_MAX_NUM_SYSTEMS]; + //For use when the the logger is set to pipe to a file. + ofstream myFileOutputLog; + //The stack of called functions. + CharStarVector myFunctionNames; + //For formatting purposes, in the file, cerr, or cout versions, add n whitespace to the front, where n is this. + unsigned int myHierarchyLevel; + //A memory of which state we're in, as far as output is concerned + LoggingPipeType myLogDestination; + //A pre-allocated string to use with sprintf, or when error logging just needs a little scratch space. + char myLogString[LOGGER_STRING_BUFFER_SIZE]; + //An integer that keeps track of how far down into the indent hierarchy we've actually written. + unsigned int myWrittenHierarchyLevel; + public: - //A static pointer to an active errorLogger that any class can get to. - static Logger *globalLoggingInstance; + //A static pointer to an active errorLogger that any class can get to. + static Logger *globalLoggingInstance; + + //Constructors & Destructor + Logger(); + Logger( LoggingPipeType toWhere, char *additionalStringInfo ); + ~Logger(); + //Static functions that constitute the main interface to this class. + static void FunctionEntry( char *newFunctionName ); + static void FunctionExit(); + static int GetHierarchyLevel(); + static char * GetLogString(); + static void Log( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ); + static void SetCurrentFunctionName( char *newFunctionName ); + static void SetHierarchyLevel( unsigned int newIndentLevel ); + static void SetOneErrorMask( SystemType whichType, long int whichErrors ); + static void SetPipe( LoggingPipeType toWhere, char *additionalStringInfo ); - //Constructors & Destructor - Logger(); - Logger( LoggingPipeType toWhere, char *additionalStringInfo ); - ~Logger(); - //Static functions that constitute the main interface to this class. - static void FunctionEntry( char *newFunctionName ); - static void FunctionExit(); - static int GetHierarchyLevel(); - static char * GetLogString(); - static void Log( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ); - static void SetCurrentFunctionName( char *newFunctionName ); - static void SetHierarchyLevel( unsigned int newIndentLevel ); - static void SetOneErrorMask( SystemType whichType, long int whichErrors ); - static void SetPipe( LoggingPipeType toWhere, char *additionalStringInfo ); - private: - //Private functions called by the static versions if a globalLogging instance exists. - void FunctionEntryInstance( char *newFunctionName ); - void FunctionExitInstance(); - int GetHierarchyLevelInstance(); - char * GetLogStringInstance(); - void LogInstance( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ); - void SetCurrentFunctionNameInstance( char *newFunctionName ); - void SetHierarchyLevelInstance( unsigned int newIndentLevel ); - void SetOneErrorMaskInstance( SystemType whichType, long int whichErrors ); - void SetPipeInstance( LoggingPipeType toWhere, char *additionalStringInfo ); - void VoidEverything(); - void WriteToPipe( char *textToPipe ); + //Private functions called by the static versions if a globalLogging instance exists. + void FunctionEntryInstance( char *newFunctionName ); + void FunctionExitInstance(); + int GetHierarchyLevelInstance(); + char * GetLogStringInstance(); + void LogInstance( SystemType whichSystem, SystemAspectType whichErrorKind, char *errorDescription ); + void SetCurrentFunctionNameInstance( char *newFunctionName ); + void SetHierarchyLevelInstance( unsigned int newIndentLevel ); + void SetOneErrorMaskInstance( SystemType whichType, long int whichErrors ); + void SetPipeInstance( LoggingPipeType toWhere, char *additionalStringInfo ); + void VoidEverything(); + void WriteToPipe( char *textToPipe ); }; -/* Subsystem defs for logger. +/* Subsystem defs for logger. */ #define LLOGGING Logger::ST_MAP_ME_TO_APP_SPECIFIC_SYSTEM1 -/* Externed Globals +/* Externed Globals */ #endif diff --git a/pandatool/src/maxegg/maxNodeDesc.h b/pandatool/src/maxegg/maxNodeDesc.h index 02f0925997..9ab556caed 100755 --- a/pandatool/src/maxegg/maxNodeDesc.h +++ b/pandatool/src/maxegg/maxNodeDesc.h @@ -85,8 +85,8 @@ class MaxNodeDesc : public ReferenceCount, public Namable { enum JointType { JT_none, // Not a joint. JT_node_joint, // Node that represents a joint in the geometry - // but not the actual joint itself - JT_joint, // An actual joint in Max. + // but not the actual joint itself + JT_joint, // An actual joint in Max. JT_pseudo_joint, // Not a joint in Max, but treated just like a // joint for the purposes of the converter. JT_joint_parent, // A parent or ancestor of a joint or pseudo joint. diff --git a/pandatool/src/maxegg/maxNodeTree.cxx b/pandatool/src/maxegg/maxNodeTree.cxx index ce1eae0664..1f91d344e9 100755 --- a/pandatool/src/maxegg/maxNodeTree.cxx +++ b/pandatool/src/maxegg/maxNodeTree.cxx @@ -132,7 +132,7 @@ build_complete_hierarchy(INode *root, ULONG *selection_list, int len) { } Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, - "finished building complete hierarchy" ); + "finished building complete hierarchy" ); return all_ok; } @@ -350,7 +350,7 @@ get_egg_table(MaxNodeDesc *node_desc) { EggTable *egg_table = new EggTable(node_desc->get_name()); node_desc->_anim = new EggXfmSAnim("xform", - _egg_data->get_coordinate_system()); + _egg_data->get_coordinate_system()); node_desc->_anim->set_fps(_fps); egg_table->add_child(node_desc->_anim); @@ -445,13 +445,13 @@ r_build_joint(MaxNodeDesc *node_desc, INode *max_node) if (node_desc == _root) { node_joint = new MaxNodeDesc(_root, max_node->GetName()); _nodes.push_back(node_joint); - return node_joint; - } else if (node_desc->is_node_joint() && node_desc->_joint_entry) { + return node_joint; + } else if (node_desc->is_node_joint() && node_desc->_joint_entry) { node_joint = new MaxNodeDesc(node_desc->_joint_entry, max_node->GetName()); _nodes.push_back(node_joint); - return node_joint; + return node_joint; } else { - return r_build_joint(node_desc->_parent, max_node); + return r_build_joint(node_desc->_parent, max_node); } } diff --git a/pandatool/src/maxegg/maxToEgg.cxx b/pandatool/src/maxegg/maxToEgg.cxx index a2271ea351..4a5ea36b97 100755 --- a/pandatool/src/maxegg/maxToEgg.cxx +++ b/pandatool/src/maxegg/maxToEgg.cxx @@ -29,11 +29,11 @@ MaxToEgg::MaxToEgg() : SomethingToEgg("3D Studio Max",".max") set_program_description("This program converts 3D Studio Max model files to egg."); /*add_option("p", "", 0, - "Generate polygon output only. Convert scene to triangle mesh " - "before converting.", &MaxToEgg::dispatch_none, &alertOnBegin);*/ + "Generate polygon output only. Convert scene to triangle mesh " + "before converting.", &MaxToEgg::dispatch_none, &alertOnBegin);*/ add_option("bface", "", 0, - "Export all polygons as double-sided ", - &MaxToEgg::dispatch_none, &doubleSided); + "Export all polygons as double-sided ", + &MaxToEgg::dispatch_none, &doubleSided); //Fill in the member variables. pMaxInterface = null; successfulOutput = false; @@ -66,7 +66,7 @@ void MaxToEgg::Run(ULONG *selection_list, int len) Logger::Log( MTE, Logger::SAT_DEBUG_SPAM_LEVEL, "Setting Max Interface." ); converter.setMaxInterface( pMaxInterface ); Logger::Log( MTE, Logger::SAT_DEBUG_SPAM_LEVEL, - "Setting converter's egg data." ); + "Setting converter's egg data." ); converter.set_egg_data( _data ); // applies the parameters from the command line options apply_parameters(converter); @@ -85,7 +85,7 @@ void MaxToEgg::Run(ULONG *selection_list, int len) /* SetMaxInterface(Interface *) - This is how we know how to traverse the Max - scene graph. For this to be a standalone application, we'd want to be able + scene graph. For this to be a standalone application, we'd want to be able to build one of these interfaces for the input file. */ void MaxToEgg::SetMaxInterface(Interface *pInterface) diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx index e74a83f8a9..8e9cb78892 100755 --- a/pandatool/src/maxegg/maxToEggConverter.cxx +++ b/pandatool/src/maxegg/maxToEggConverter.cxx @@ -205,9 +205,9 @@ convert_max(bool from_selection) { case AC_pose: // pose: set to a specific frame, then get out the static geometry. sprintf(Logger::GetLogString(), "Extracting geometry from frame #%d.", - start_frame); + start_frame); Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, Logger::GetLogString() ); - _current_frame = start_frame; + _current_frame = start_frame; // fall through case AC_none: @@ -257,7 +257,7 @@ convert_max(bool from_selection) { Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, "Converted, no errors." ); } else { Logger::Log(MTEC, Logger::SAT_MEDIUM_LEVEL, - "Errors encountered in conversion." ); + "Errors encountered in conversion." ); } maxInterface->ProgressEnd(); @@ -307,7 +307,7 @@ convert_flip(double start_frame, double end_frame, double frame_inc, double frame_stop = end_frame; while (frame <= frame_stop) { sprintf(Logger::GetLogString(), "Extracting geometry from frame #%lf.", - frame); + frame); Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, Logger::GetLogString() ); ostringstream name_strm; name_strm << "frame" << frame; @@ -381,42 +381,42 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc, int i; sprintf(Logger::GetLogString(), - "sf %lf ef %lf inc %lf ofr %lf.", - start_frame, end_frame, frame_inc, output_frame_rate ); + "sf %lf ef %lf inc %lf ofr %lf.", + start_frame, end_frame, frame_inc, output_frame_rate ); Logger::Log(MNEG_GEOMETRY_GENERATION, Logger::SAT_LOW_LEVEL, - Logger::GetLogString() ); + Logger::GetLogString() ); TimeValue frame = start_frame; TimeValue frame_stop = end_frame; while (frame <= frame_stop) { _current_frame = frame; sprintf(Logger::GetLogString(), - "Current frame: %lf.", - _current_frame ); + "Current frame: %lf.", + _current_frame ); Logger::Log(MNEG_GEOMETRY_GENERATION, Logger::SAT_LOW_LEVEL, - Logger::GetLogString() ); + Logger::GetLogString() ); for (i = 0; i < num_nodes; i++) { // Find all joints in the hierarchy MaxNodeDesc *node_desc = _tree.get_node(i); if (node_desc->is_joint()) { - tgroup = new EggGroup(); - INode *max_node = node_desc->get_max_node(); + tgroup = new EggGroup(); + INode *max_node = node_desc->get_max_node(); - if (node_desc->_parent && node_desc->_parent->is_joint()) { - // If this joint also has a joint as a parent, the parent's - // transformation has to be divided out of this joint's TM - get_joint_transform(max_node, node_desc->_parent->get_max_node(), - tgroup); - } else { - get_joint_transform(max_node, NULL, tgroup); - } + if (node_desc->_parent && node_desc->_parent->is_joint()) { + // If this joint also has a joint as a parent, the parent's + // transformation has to be divided out of this joint's TM + get_joint_transform(max_node, node_desc->_parent->get_max_node(), + tgroup); + } else { + get_joint_transform(max_node, NULL, tgroup); + } EggXfmSAnim *anim = _tree.get_egg_anim(node_desc); if (!anim->add_data(tgroup->get_transform3d())) { - // *** log an error - } - delete tgroup; + // *** log an error + } + delete tgroup; } } @@ -496,48 +496,48 @@ process_model_node(MaxNodeDesc *node_desc) { Mesh max_mesh; //Call the correct exporter based on what type of object this is. switch( state.obj->SuperClassID() ){ - //A geometric object. + //A geometric object. case GEOMOBJECT_CLASS_ID: - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - "Found a geometric object in the hierarchy!" ); + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + "Found a geometric object in the hierarchy!" ); egg_group = _tree.get_egg_group(node_desc); - get_transform(max_node, egg_group); + get_transform(max_node, egg_group); //Try converting this geometric object to a mesh we can use. - if (!state.obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) { - Logger::Log(MTEC, Logger::SAT_OTHER_ERROR, - "Cannot create geometry from state.obj!"); - // Logger::FunctionExit(); - return false; - } - //Convert our state object to a TriObject. - myMaxTriObject = (TriObject *) state.obj->ConvertToType(time, Class_ID(TRIOBJ_CLASS_ID, 0 )); - // *** Want to figure this problem out - // If actual conversion was required, then we want to delete this - // new mesh later to avoid mem leaks. **BROKEN. doesnt delete - - //Now, get the mesh. - max_mesh = myMaxTriObject->GetMesh(); - Logger::Log( MTEC, Logger::SAT_LOW_LEVEL, - "TriObject attached and mesh generated!" ); - - make_polyset(max_node, &max_mesh, egg_group); - - if (myMaxTriObject != state.obj) - delete myMaxTriObject; - break; + if (!state.obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) { + Logger::Log(MTEC, Logger::SAT_OTHER_ERROR, + "Cannot create geometry from state.obj!"); + // Logger::FunctionExit(); + return false; + } + //Convert our state object to a TriObject. + myMaxTriObject = (TriObject *) state.obj->ConvertToType(time, Class_ID(TRIOBJ_CLASS_ID, 0 )); + // *** Want to figure this problem out + // If actual conversion was required, then we want to delete this + // new mesh later to avoid mem leaks. **BROKEN. doesnt delete + + //Now, get the mesh. + max_mesh = myMaxTriObject->GetMesh(); + Logger::Log( MTEC, Logger::SAT_LOW_LEVEL, + "TriObject attached and mesh generated!" ); + + make_polyset(max_node, &max_mesh, egg_group); + + if (myMaxTriObject != state.obj) + delete myMaxTriObject; + break; case SHAPE_CLASS_ID: if (state.obj->ClassID() == EDITABLE_SURF_CLASS_ID) { - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - "Found a NURB object in the hierarchy!" ); + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + "Found a NURB object in the hierarchy!" ); NURBSSet getSet; if (GetNURBSSet(state.obj, time, getSet, TRUE)) { NURBSObject *nObj = getSet.GetNURBSObject(0); if (nObj->GetType() == kNCVCurve) { //It's a CV Curve, process it egg_group = _tree.get_egg_group(node_desc); - get_transform(max_node, egg_group); + get_transform(max_node, egg_group); make_nurbs_curve((NURBSCVCurve *)nObj, string(max_node->GetName()), time, egg_group); } @@ -546,25 +546,25 @@ process_model_node(MaxNodeDesc *node_desc) { break; case CAMERA_CLASS_ID: - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - "Found a camera object in the hierarchy!" ); - break; + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + "Found a camera object in the hierarchy!" ); + break; case LIGHT_CLASS_ID: - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - "Found a light object in the hierarchy!" ); - break; + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + "Found a light object in the hierarchy!" ); + break; case HELPER_CLASS_ID: - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - "Found a helper object in the hierarchy!" ); - break; + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + "Found a helper object in the hierarchy!" ); + break; /* default: char buf[1024]; sprintf(buf, "Unknown Superclass ID: %x, ClassID: %x,%x", state.obj->SuperClassID(), state.obj->ClassID().PartA(), state.obj->ClassID().PartB()); - Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, - buf ); */ + Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL, + buf ); */ } } @@ -688,7 +688,7 @@ get_transform(INode *max_node, EggGroup *egg_group) { Logger::FunctionEntry("MaxNodeEggGroup::ApplyTransformFromMaxNodeToEggGroup"); if ( !egg_group ) { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_NULL_ERROR, - "Destination EggGroup is null!" ); + "Destination EggGroup is null!" ); Logger::FunctionExit(); return; } @@ -770,11 +770,11 @@ get_transform(INode *max_node, EggGroup *egg_group) { row1 = pivot.GetRow(1); row2 = pivot.GetRow(2); row3 = pivot.GetRow(3); - + LMatrix4d m4d(row0.x, row0.y, row0.z, 0.0f, - row1.x, row1.y, row1.z, 0.0f, - row2.x, row2.y, row2.z, 0.0f, - row3.x, row3.y, row3.z, 1.0f ); + row1.x, row1.y, row1.z, 0.0f, + row2.x, row2.y, row2.z, 0.0f, + row3.x, row3.y, row3.z, 1.0f ); // Now here's the tricky part. I believe this command strips out the node // "frame" which is the sum of all transformations enacted by the parent of // this node. This should reduce to the transformation relative to this @@ -783,10 +783,10 @@ get_transform(INode *max_node, EggGroup *egg_group) { if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) { egg_group->add_matrix4(m4d); Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Non-identity matrix applied to node!" ); + "Non-identity matrix applied to node!" ); } else { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Resultant matrix too close to identity; no transformation applied!" ); + "Resultant matrix too close to identity; no transformation applied!" ); } Logger::FunctionExit(); } @@ -819,11 +819,11 @@ get_object_transform(INode *max_node) { row1 = pivot.GetRow(1); row2 = pivot.GetRow(2); row3 = pivot.GetRow(3); - + LMatrix4d m4d(row0.x, row0.y, row0.z, 0.0f, - row1.x, row1.y, row1.z, 0.0f, - row2.x, row2.y, row2.z, 0.0f, - row3.x, row3.y, row3.z, 1.0f ); + row1.x, row1.y, row1.z, 0.0f, + row2.x, row2.y, row2.z, 0.0f, + row3.x, row3.y, row3.z, 1.0f ); Logger::FunctionExit(); return m4d; } @@ -854,7 +854,7 @@ get_joint_transform(INode *max_node, EggGroup *egg_group) { Logger::FunctionEntry("MaxNodeEggGroup::ApplyTransformFromMaxNodeToEggGroup"); if ( !egg_group ) { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_NULL_ERROR, - "Destination EggGroup is null!" ); + "Destination EggGroup is null!" ); Logger::FunctionExit(); return; } @@ -866,11 +866,11 @@ get_joint_transform(INode *max_node, EggGroup *egg_group) { row1 = pivot.GetRow(1); row2 = pivot.GetRow(2); row3 = pivot.GetRow(3); - + LMatrix4d m4d(row0.x, row0.y, row0.z, 0.0f, - row1.x, row1.y, row1.z, 0.0f, - row2.x, row2.y, row2.z, 0.0f, - row3.x, row3.y, row3.z, 1.0f ); + row1.x, row1.y, row1.z, 0.0f, + row2.x, row2.y, row2.z, 0.0f, + row3.x, row3.y, row3.z, 1.0f ); // Now here's the tricky part. I believe this command strips out the node // "frame" which is the sum of all transformations enacted by the parent of // this node. This should reduce to the transformation relative to this @@ -879,10 +879,10 @@ get_joint_transform(INode *max_node, EggGroup *egg_group) { if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) { egg_group->add_matrix4(m4d); Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Non-identity matrix applied to node!" ); + "Non-identity matrix applied to node!" ); } else { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Resultant matrix too close to identity; no transformation applied!" ); + "Resultant matrix too close to identity; no transformation applied!" ); } Logger::FunctionExit(); } @@ -914,7 +914,7 @@ get_joint_transform(INode *max_node, INode *parent_node, EggGroup *egg_group) { Logger::FunctionEntry("MaxNodeEggGroup::ApplyTransformFromMaxNodeToEggGroup"); if ( !egg_group ) { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_NULL_ERROR, - "Destination EggGroup is null!" ); + "Destination EggGroup is null!" ); Logger::FunctionExit(); return; } @@ -926,11 +926,11 @@ get_joint_transform(INode *max_node, INode *parent_node, EggGroup *egg_group) { row1 = pivot.GetRow(1); row2 = pivot.GetRow(2); row3 = pivot.GetRow(3); - + LMatrix4d m4d(row0.x, row0.y, row0.z, 0.0f, - row1.x, row1.y, row1.z, 0.0f, - row2.x, row2.y, row2.z, 0.0f, - row3.x, row3.y, row3.z, 1.0f ); + row1.x, row1.y, row1.z, 0.0f, + row2.x, row2.y, row2.z, 0.0f, + row3.x, row3.y, row3.z, 1.0f ); if (parent_node) { parent_pivot = parent_node->GetNodeTM(_current_frame * GetTicksPerFrame()); @@ -939,11 +939,11 @@ if (parent_node) { row1 = parent_pivot.GetRow(1); row2 = parent_pivot.GetRow(2); row3 = parent_pivot.GetRow(3); - + LMatrix4d pi_m4d(row0.x, row0.y, row0.z, 0.0f, - row1.x, row1.y, row1.z, 0.0f, - row2.x, row2.y, row2.z, 0.0f, - row3.x, row3.y, row3.z, 1.0f ); + row1.x, row1.y, row1.z, 0.0f, + row2.x, row2.y, row2.z, 0.0f, + row3.x, row3.y, row3.z, 1.0f ); // Now here's the tricky part. I believe this command strips out the node // "frame" which is the sum of all transformations enacted by the parent of @@ -955,10 +955,10 @@ if (parent_node) { if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) { egg_group->add_matrix4(m4d); Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Non-identity matrix applied to node!" ); + "Non-identity matrix applied to node!" ); } else { Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL, - "Resultant matrix too close to identity; no transformation applied!" ); + "Resultant matrix too close to identity; no transformation applied!" ); } Logger::FunctionExit(); } @@ -1377,7 +1377,7 @@ make_nurbs_curve(NURBSCVCurve *curve, const string &name, void MaxToEggConverter:: make_polyset(INode *max_node, Mesh *mesh, EggGroup *egg_group, Shader *default_shader) { - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Entered make_poly_set." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Entered make_poly_set." ); //bool double_sided = false; @@ -1392,7 +1392,7 @@ make_polyset(INode *max_node, Mesh *mesh, if (mesh->getNumFaces() == 0) { Logger::Log(MNEG_GEOMETRY_GENERATION, Logger::SAT_MEDIUM_LEVEL, - "Ignoring empty mesh "); + "Ignoring empty mesh "); return; } @@ -1430,10 +1430,10 @@ make_polyset(INode *max_node, Mesh *mesh, // will be identity; but if the node is under an instance // (particularly, for instance, a billboard) then the vertex space // will be different from world space. - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before obtaining transform." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before obtaining transform." ); LMatrix4d vertex_frame = get_object_transform(max_node) * egg_group->get_vertex_frame_inv(); - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After obtaining transform." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After obtaining transform." ); // *** Not quite sure how this vertex color flag is handled. Check on later @@ -1448,7 +1448,7 @@ make_polyset(INode *max_node, Mesh *mesh, */ for ( int iFace=0; iFace < mesh->getNumFaces(); iFace++ ) { - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Getting face." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Getting face." ); EggPolygon *egg_poly = new EggPolygon; egg_group->add_child(egg_poly); @@ -1513,19 +1513,19 @@ make_polyset(INode *max_node, Mesh *mesh, */ // Get the vertices for the polygon. - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before getting vertices." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before getting vertices." ); - for ( int iVertex=0; iVertex < 3; iVertex++ ) { - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Getting vertex." ); + for ( int iVertex=0; iVertex < 3; iVertex++ ) { + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Getting vertex." ); - EggVertex vert; + EggVertex vert; // Get the vertex position Point3 vertex = mesh->getVert(face.v[iVertex]); LPoint3d p3d(vertex.x, vertex.y, vertex.z); p3d = p3d * vertex_frame; vert.set_pos(p3d); - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After getting vertex pos before getting normal." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After getting vertex pos before getting normal." ); // Get the vertex normal @@ -1535,7 +1535,7 @@ make_polyset(INode *max_node, Mesh *mesh, // explain why normals were weird previously n3d = n3d * vertex_frame; vert.set_normal(n3d); - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After getting normal." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "After getting normal." ); // *** More shader stuff to ignore for now /* @@ -1558,15 +1558,15 @@ make_polyset(INode *max_node, Mesh *mesh, // Get the UVs for this vertex if (mesh->getNumTVerts()) { - UVVert vertTexCoord = mesh->getTVert(mesh->tvFace[iFace].t[iVertex]); - vert.set_uv( TexCoordd(vertTexCoord.x, vertTexCoord.y)); - sprintf(Logger::GetLogString(), - "Got tex vertex %d of %d from local tex data.", - iVertex, mesh->getNumTVerts() ); - Logger::Log(MNEG_GEOMETRY_GENERATION, Logger::SAT_LOW_LEVEL, - Logger::GetLogString() ); + UVVert vertTexCoord = mesh->getTVert(mesh->tvFace[iFace].t[iVertex]); + vert.set_uv( TexCoordd(vertTexCoord.x, vertTexCoord.y)); + sprintf(Logger::GetLogString(), + "Got tex vertex %d of %d from local tex data.", + iVertex, mesh->getNumTVerts() ); + Logger::Log(MNEG_GEOMETRY_GENERATION, Logger::SAT_LOW_LEVEL, + Logger::GetLogString() ); } - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "after getting TVerts." ); + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "after getting TVerts." ); // *** Leaving out vertex colors for now @@ -1609,15 +1609,15 @@ make_polyset(INode *max_node, Mesh *mesh, egg_poly->set_vertex(2, verts[0]); } - // *** More shader stuff to ignore - /* + // *** More shader stuff to ignore + /* // Now apply the shader. if (shader != (MayaShader *)NULL) { set_shader_attributes(*egg_poly, *shader); } - */ - Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before set_material_attributes" ); - + */ + Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, "Before set_material_attributes" ); + set_material_attributes(*egg_poly, max_node->GetMtl(), &face); } @@ -1701,7 +1701,7 @@ Point3 MaxToEggConverter::get_max_vertex_normal(Mesh *mesh, int faceNo, int vert int numNormals; Point3 vertexNormal; - + // Is normal specified // SPCIFIED is not currently used, but may be used in future versions. if (rv->rFlags & SPECIFIED_NORMAL) { @@ -1719,9 +1719,9 @@ Point3 MaxToEggConverter::get_max_vertex_normal(Mesh *mesh, int faceNo, int vert // and find the vertex with the same smoothing group as the current face. // You will find multiple normals in the ern member. for (int i = 0; i < numNormals; i++) { - if (rv->ern[i].getSmGroup() & smGroup) { - vertexNormal = rv->ern[i].getNormal(); - } + if (rv->ern[i].getSmGroup() & smGroup) { + vertexNormal = rv->ern[i].getNormal(); + } } } } @@ -1821,7 +1821,7 @@ get_vertex_weights(INode *max_node, EggVertexPool *vpool) { for (vi = vpool->begin(); vi != vpool->end(); ++vi) { EggVertex *vert = (*vi); int max_vi = vert->get_external_index(); - + for (int ji = 0; ji < skinMC->GetNumAssignedBones(max_vi); ++ji) { float weight = skinMC->GetBoneWeight(max_vi, ji); if (weight > 0.0f) { @@ -1989,11 +1989,11 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { bool has_trans_texture = false; Point3 diffuseColor = Point3(1, 1, 1); - + Logger::FunctionEntry( "MaxToEggConverter::CreateEggTextureFromINode" ); //First, get the material data associated with this node. -// maxMaterial = max_node->GetMtl(); +// maxMaterial = max_node->GetMtl(); if ( !maxMaterial ) { Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); Logger::FunctionExit(); @@ -2027,13 +2027,13 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { maxBitmap = maxBitmapTex->GetBitmap(0); //Query some parameters of the bitmap to get the format option. if ( maxBitmap && maxBitmap->HasAlpha() ) { - has_trans_texture = true; - tex.set_format(EggTexture::F_rgba); + has_trans_texture = true; + tex.set_format(EggTexture::F_rgba); } else { - tex.set_format(EggTexture::F_rgb); + tex.set_format(EggTexture::F_rgb); } EggTexture *new_tex = - _textures.create_unique_texture(tex, ~EggTexture::E_tref_name); + _textures.create_unique_texture(tex, ~EggTexture::E_tref_name); primitive.set_texture(new_tex); } @@ -2067,17 +2067,17 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { primitive.set_color(rgba); } else if ( maxMaterial->ClassID() == Class_ID(MULTI_CLASS_ID, 0 )) { - // It's a multi-material. Find the submaterial for this face. + // It's a multi-material. Find the submaterial for this face. // and call set_material_attributes again on the submaterial. - MtlID matID = face->getMatID(); - if (matID < maxMaterial->NumSubMtls()) { - set_material_attributes(primitive, maxMaterial->GetSubMtl(matID), face); - } else { - sprintf(Logger::GetLogString(), - "SubMaterial ID %d is greater than the total submaterial for this material", - matID); - Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); - } + MtlID matID = face->getMatID(); + if (matID < maxMaterial->NumSubMtls()) { + set_material_attributes(primitive, maxMaterial->GetSubMtl(matID), face); + } else { + sprintf(Logger::GetLogString(), + "SubMaterial ID %d is greater than the total submaterial for this material", + matID); + Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); + } } else { // It's non-standard material. At the moment, let's just // return @@ -2111,11 +2111,11 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { bool has_trans_texture = false; Point3 diffuseColor = Point3(1, 1, 1); - + Logger::FunctionEntry( "MaxToEggConverter::CreateEggTextureFromINode" ); //First, get the material data associated with this node. -// maxMaterial = max_node->GetMtl(); +// maxMaterial = max_node->GetMtl(); if ( !maxMaterial ) { Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); Logger::FunctionExit(); @@ -2128,19 +2128,19 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { maxStandardMaterial = (StdMat *)maxMaterial; - // Access the Diffuse map and see if it's a Bitmap texture + // Access the Diffuse map and see if it's a Bitmap texture diffuseTexmap = maxMaterial->GetSubTexmap(ID_DI); - if (diffuseTexmap && (diffuseTexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))) { + if (diffuseTexmap && (diffuseTexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))) { has_diffuse_texture = true; - diffuseBitmapTex = (BitmapTex *) diffuseTexmap; - } + diffuseBitmapTex = (BitmapTex *) diffuseTexmap; + } // Access the Opacity map and see if it's a Bitmap texture - transTexmap = maxMaterial->GetSubTexmap(ID_OP); - if (transTexmap && (transTexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))) { + transTexmap = maxMaterial->GetSubTexmap(ID_OP); + if (transTexmap && (transTexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0))) { has_trans_texture = true; - transBitmapTex = (BitmapTex *) transTexmap; - } + transBitmapTex = (BitmapTex *) transTexmap; + } if (has_diffuse_texture || has_trans_texture) { ostringstream name_strm; @@ -2225,19 +2225,19 @@ set_material_attributes(EggPrimitive &primitive, Mtl *maxMaterial, Face *face) { primitive.set_color(rgba); } else if ( maxMaterial->ClassID() == Class_ID(MULTI_CLASS_ID, 0 )) { - // It's a multi-material. Find the submaterial for this face. + // It's a multi-material. Find the submaterial for this face. // and call set_material_attributes again on the submaterial. - MtlID matID = face->getMatID(); - if (matID < maxMaterial->NumSubMtls()) { - set_material_attributes(primitive, maxMaterial->GetSubMtl(matID), face); - } else { - sprintf(Logger::GetLogString(), - "SubMaterial ID %d is greater than the total submaterial for this material", - matID); - Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); - } + MtlID matID = face->getMatID(); + if (matID < maxMaterial->NumSubMtls()) { + set_material_attributes(primitive, maxMaterial->GetSubMtl(matID), face); + } else { + sprintf(Logger::GetLogString(), + "SubMaterial ID %d is greater than the total submaterial for this material", + matID); + Logger::Log(MTEC, Logger::SAT_NULL_ERROR, "maxMaterial is null!"); + } } else { - // It's another non-standard material. At the moment, let's just + // It's another non-standard material. At the moment, let's just // return Logger::FunctionExit(); return; @@ -2350,7 +2350,7 @@ reparent_decals(EggGroupNode *egg_parent) { EggGroup *child_group = (EggGroup *) child; if (child_group->has_object_type("decalbase")) { if (decal_base != (EggNode *)NULL) { - // error + // error okflag = false; } child_group->remove_object_type("decalbase"); @@ -2442,10 +2442,10 @@ Modifier* MaxToEggConverter::FindSkinModifier (INode* node, const Class_ID &type Modifier* mod = pDerObj->GetModifier(stackId); // Is this what we are looking for? - if (mod->ClassID() == type ) - return mod; - } - + if (mod->ClassID() == type ) + return mod; + } + // continue with next derived object pObj = pDerObj->GetObjRef(); } diff --git a/pandatool/src/maxegg/maxToEggConverter.h b/pandatool/src/maxegg/maxToEggConverter.h index 70824f6164..209ce6a61a 100755 --- a/pandatool/src/maxegg/maxToEggConverter.h +++ b/pandatool/src/maxegg/maxToEggConverter.h @@ -125,7 +125,7 @@ class MaxToEggConverter : public SomethingToEggConverter { LMatrix4d get_object_transform(INode *max_node); void get_joint_transform(INode *max_node, EggGroup *egg_group); void get_joint_transform(INode *max_node, INode *parent_node, - EggGroup *egg_group); + EggGroup *egg_group); // *** Leaving out these functions til there use/support in Max is determined /* diff --git a/pandatool/src/maxeggimport/maxEggImport.cxx b/pandatool/src/maxeggimport/maxEggImport.cxx index ca164461df..b43ec22c85 100755 --- a/pandatool/src/maxeggimport/maxEggImport.cxx +++ b/pandatool/src/maxeggimport/maxEggImport.cxx @@ -44,7 +44,7 @@ public: // GUI-related methods MaxEggImporter(); ~MaxEggImporter(); - int ExtCount(); // Number of extensions supported + int ExtCount(); // Number of extensions supported const TCHAR * Ext(int n); // Extension #n (i.e. "EGG") const TCHAR * LongDesc(); // Long ASCII description (i.e. "Egg Importer") const TCHAR * ShortDesc(); // Short ASCII description (i.e. "Egg") @@ -53,8 +53,8 @@ public: const TCHAR * OtherMessage1(); // Other message #1 const TCHAR * OtherMessage2(); // Other message #2 unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301) - void ShowAbout(HWND hWnd); // Show DLL's "About..." box - int DoImport(const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts); + void ShowAbout(HWND hWnd); // Show DLL's "About..." box + int DoImport(const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts); public: // GUI-related fields diff --git a/pandatool/src/maxprogs/maxEggImport.cxx b/pandatool/src/maxprogs/maxEggImport.cxx index ca164461df..b43ec22c85 100755 --- a/pandatool/src/maxprogs/maxEggImport.cxx +++ b/pandatool/src/maxprogs/maxEggImport.cxx @@ -44,7 +44,7 @@ public: // GUI-related methods MaxEggImporter(); ~MaxEggImporter(); - int ExtCount(); // Number of extensions supported + int ExtCount(); // Number of extensions supported const TCHAR * Ext(int n); // Extension #n (i.e. "EGG") const TCHAR * LongDesc(); // Long ASCII description (i.e. "Egg Importer") const TCHAR * ShortDesc(); // Short ASCII description (i.e. "Egg") @@ -53,8 +53,8 @@ public: const TCHAR * OtherMessage1(); // Other message #1 const TCHAR * OtherMessage2(); // Other message #2 unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301) - void ShowAbout(HWND hWnd); // Show DLL's "About..." box - int DoImport(const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts); + void ShowAbout(HWND hWnd); // Show DLL's "About..." box + int DoImport(const TCHAR *name,ImpInterface *ei,Interface *i, BOOL suppressPrompts); public: // GUI-related fields diff --git a/pandatool/src/mayaegg/mayaNodeDesc.cxx b/pandatool/src/mayaegg/mayaNodeDesc.cxx index 74888fd2a3..bfb0820d4e 100755 --- a/pandatool/src/mayaegg/mayaNodeDesc.cxx +++ b/pandatool/src/mayaegg/mayaNodeDesc.cxx @@ -393,8 +393,8 @@ check_blend_shapes(const MFnDagNode &node, const string &attrib_name) { // construct created by Maya for Maya's internal purposes // only. We don't want to fiddle with the parallel blenders. MPlug plug = blends.findPlug("pb"); - bool is_parallel_blender; - status = plug.getValue(is_parallel_blender); + bool is_parallel_blender; + status = plug.getValue(is_parallel_blender); if (!status) { status.perror("Could not get value of pb plug."); is_parallel_blender = false; diff --git a/pandatool/src/mayaprogs/mayaEggImport.cxx b/pandatool/src/mayaprogs/mayaEggImport.cxx index 187af8395a..5d61349968 100755 --- a/pandatool/src/mayaprogs/mayaEggImport.cxx +++ b/pandatool/src/mayaprogs/mayaEggImport.cxx @@ -94,7 +94,7 @@ MStatus MayaEggImporter::reader ( const MFileObject& file, const MString flagModel("model"); const MString flagAnim("anim"); - // Start parsing. + // Start parsing. // MStringArray optionList; MStringArray theOption; diff --git a/pandatool/src/ptloader/config_ptloader.cxx b/pandatool/src/ptloader/config_ptloader.cxx index 4a32d00629..7f8b2ff45e 100644 --- a/pandatool/src/ptloader/config_ptloader.cxx +++ b/pandatool/src/ptloader/config_ptloader.cxx @@ -42,8 +42,8 @@ ConfigureFn(config_ptloader) { ConfigVariableEnum ptloader_units ("ptloader-units", DU_invalid, PRC_DESC("Specifies the preferred units into which models will be converted " - "when using libptloader to automatically convert files to Panda " - "at load time, via e.g. \"pview myMayaFile.mb\".")); + "when using libptloader to automatically convert files to Panda " + "at load time, via e.g. \"pview myMayaFile.mb\".")); //////////////////////////////////////////////////////////////////// // Function: init_libptloader diff --git a/pandatool/src/softegg/soft2Egg.c b/pandatool/src/softegg/soft2Egg.c index 20c57bc4bc..8291c1b669 100755 --- a/pandatool/src/softegg/soft2Egg.c +++ b/pandatool/src/softegg/soft2Egg.c @@ -815,15 +815,15 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) if ( fileNameLen ) { - fileName = (char *)malloc(sizeof(char)*++fileNameLen); - SAA_texture2DGetPicName( scene, texture, fileNameLen, fileName ); + fileName = (char *)malloc(sizeof(char)*++fileNameLen); + SAA_texture2DGetPicName( scene, texture, fileNameLen, fileName ); } - + // make sure we are not being passed a NULL image, an empty image // string or the default image created by egg2soft if ( (fileName != NULL) && strlen( fileName ) && strcmp( fileName, "/fat/people/gregw/new_test/PICTURES/default") && - ( strstr( fileName, "noIcon" ) == NULL) ) + ( strstr( fileName, "noIcon" ) == NULL) ) { char *texName = NULL; char *texNamePath = NULL; @@ -840,16 +840,16 @@ ConvertTexture( SAA_Scene *scene, SAA_Elem *texture ) float transp; - // check for alpha - SAA_texture2DGetTransparency( scene, texture, &transp ); + // check for alpha + SAA_texture2DGetTransparency( scene, texture, &transp ); - if ( transp != 0.0f ) { + if ( transp != 0.0f ) { texName = (char *)malloc(sizeof(char)*(strlen(tmpName)+6)); sprintf( texName, "%s.rgba", tmpName ); - } else { + } else { texName = (char *)malloc(sizeof(char)*(strlen(tmpName)+5)); sprintf( texName, "%s.rgb", tmpName ); - } + } fileNameExt = (char *)malloc(sizeof(char)*(strlen(fileName)+5)); sprintf( fileNameExt, "%s.pic", fileName ); @@ -972,9 +972,9 @@ FindClosestTriVert( EggVertexPool *vpool, SAA_DVector *vertices, int numVert ) closest, numVert-1, vertices[closest].x, vertices[closest].y, vertices[closest].z, closestDist ); } - } + } - return( vertMap ); + return( vertMap ); } @@ -1698,7 +1698,7 @@ MakeEgg( EggGroup *parent, EggJoint *lastJoint, AnimGroup *lastAnim, for ( i = 0; i < numTri; i++ ) { result = SAA_materialRelationGetT2DLocNbElements( scene, - &materials[i], FALSE, &relinfo, &numTexTri[i] ); + &materials[i], FALSE, &relinfo, &numTexTri[i] ); // polytex if ( result == SI_SUCCESS ) @@ -3740,18 +3740,18 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, //models, numModels ), &type ); SAA_modelGetType( scene, &envelopes[i], &type ); - - if ( verbose >= 1 ) - { + + if ( verbose >= 1 ) + { fprintf( outStream, "envelope model type "); - - if ( type == SAA_MSMSH ) - fprintf( outStream, "MESH\n" ); - else if ( type == SAA_MNSRF ) - fprintf( outStream, "NURBS\n" ); - else - fprintf( outStream, "OTHER\n" ); - } + + if ( type == SAA_MSMSH ) + fprintf( outStream, "MESH\n" ); + else if ( type == SAA_MNSRF ) + fprintf( outStream, "NURBS\n" ); + else + fprintf( outStream, "OTHER\n" ); + } int *envVtxIndices = NULL; envVtxIndices = (int *)malloc(sizeof(int)*numEnvVertices[i]); @@ -3813,9 +3813,9 @@ MakeSoftSkin( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, EggJoint *joint = (EggJoint *)(skeleton->FindDescendent( name )); - // this doesn't seem to be necessary 4/7/99 + // this doesn't seem to be necessary 4/7/99 //EggJoint *parent = (EggJoint *)joint->parent; - //assert(parent->IsA(NT_EggJoint)); + //assert(parent->IsA(NT_EggJoint)); // for every envelope vertex for (j = 0; j < numEnvVertices[i]; j++) @@ -4507,23 +4507,23 @@ MakeWeightedMorphTable( SAA_Scene *scene, SAA_Elem *model, SAA_Elem *models, { for ( int i = 1; i < numShapes; i++ ) { - SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); + SAA_fcurveEval( scene, &weightCurves[i], time, &curveVal ); - // make sure soft gave us a reasonable number - if (!isNum(curveVal)) - curveVal = 0.0f; + // make sure soft gave us a reasonable number + if (!isNum(curveVal)) + curveVal = 0.0f; - if ( verbose >= 2 ) - fprintf( outStream, "at time %f, weightCurve[%d] for %s = %f\n", time, i, name, curveVal ); + if ( verbose >= 2 ) + fprintf( outStream, "at time %f, weightCurve[%d] for %s = %f\n", time, i, name, curveVal ); // derive table name from the model name tableName = MakeTableName( name, i ); - // find and populate shape table + // find and populate shape table if ( verbose >= 2 ) fprintf( outStream, "Weight: looking for table '%s'\n", - tableName ); + tableName ); //find the morph table associated with this key shape thisTable = (SAnimTable *)(morphRoot->FindDescendent( tableName )); diff --git a/pandatool/src/vrml/vrml2egg.cxx b/pandatool/src/vrml/vrml2egg.cxx index c41215aecf..d5e13693f2 100644 --- a/pandatool/src/vrml/vrml2egg.cxx +++ b/pandatool/src/vrml/vrml2egg.cxx @@ -82,7 +82,7 @@ ShowOpts() { //////////////////////////////////////////////////////////////////// boolean MainProgram:: HandleGetopts(char flag, char *optarg, int &optind, - int argc, char **argv) { + int argc, char **argv) { bool okflag = true; switch (flag) { @@ -119,7 +119,7 @@ HandleArgs(int &argc, char **&argv) { //////////////////////////////////////////////////////////////////// void MainProgram:: vrml_group(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform) { + const pfMatrix &net_transform) { const MFArray *children = node->get_value("children")._mf; MFArray::const_iterator ci; for (ci = children->begin(); ci != children->end(); ++ci) { @@ -135,7 +135,7 @@ vrml_group(const VrmlNode *node, EggGroup *group, //////////////////////////////////////////////////////////////////// void MainProgram:: vrml_transform(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform) { + const pfMatrix &net_transform) { const double *scale = node->get_value("scale")._sfvec; const double *rotation = node->get_value("rotation")._sfvec; const double *translation = node->get_value("translation")._sfvec; @@ -152,31 +152,31 @@ vrml_transform(const VrmlNode *node, EggGroup *group, any_transform = true; if (center[0] != 0.0 || center[1] != 0.0 || center[2] != 0.0) { local_transform.postTrans(local_transform, - -center[0], -center[1], -center[2]); + -center[0], -center[1], -center[2]); if (o[3] != 0.0) { - local_transform.postRot(local_transform, - -o[3] * 180.0 / pi, o[0], o[1], o[2]); - local_transform.postScale(local_transform, - scale[0], scale[1], scale[2]); - local_transform.postRot(local_transform, - o[3] * 180.0 / pi, o[0], o[1], o[2]); + local_transform.postRot(local_transform, + -o[3] * 180.0 / pi, o[0], o[1], o[2]); + local_transform.postScale(local_transform, + scale[0], scale[1], scale[2]); + local_transform.postRot(local_transform, + o[3] * 180.0 / pi, o[0], o[1], o[2]); } else { - local_transform.postScale(local_transform, - scale[0], scale[1], scale[2]); + local_transform.postScale(local_transform, + scale[0], scale[1], scale[2]); } local_transform.postTrans(local_transform, - center[0], center[1], center[2]); + center[0], center[1], center[2]); } else { if (o[3] != 0.0) { - local_transform.postRot(local_transform, - -o[3] * 180.0 / pi, o[0], o[1], o[2]); - local_transform.postScale(local_transform, - scale[0], scale[1], scale[2]); - local_transform.postRot(local_transform, - o[3] * 180.0 / pi, o[0], o[1], o[2]); + local_transform.postRot(local_transform, + -o[3] * 180.0 / pi, o[0], o[1], o[2]); + local_transform.postScale(local_transform, + scale[0], scale[1], scale[2]); + local_transform.postRot(local_transform, + o[3] * 180.0 / pi, o[0], o[1], o[2]); } else { - local_transform.postScale(local_transform, - scale[0], scale[1], scale[2]); + local_transform.postScale(local_transform, + scale[0], scale[1], scale[2]); } } } @@ -185,17 +185,17 @@ vrml_transform(const VrmlNode *node, EggGroup *group, any_transform = true; if (center[0] != 0.0 || center[1] != 0.0 || center[2] != 0.0) { local_transform.postTrans(local_transform, - -center[0], -center[1], -center[2]); + -center[0], -center[1], -center[2]); local_transform.postRot(local_transform, - rotation[3] * 180.0 / pi, - rotation[0], rotation[1], rotation[2]); + rotation[3] * 180.0 / pi, + rotation[0], rotation[1], rotation[2]); local_transform.postTrans(local_transform, - center[0], center[1], center[2]); + center[0], center[1], center[2]); } else { local_transform.postRot(local_transform, - rotation[3] * 180.0 / pi, - rotation[0], rotation[1], rotation[2]); + rotation[3] * 180.0 / pi, + rotation[0], rotation[1], rotation[2]); } } @@ -204,9 +204,9 @@ vrml_transform(const VrmlNode *node, EggGroup *group, translation[2] != 0.0) { any_transform = true; local_transform.postTrans(local_transform, - translation[0], - translation[1], - translation[2]); + translation[0], + translation[1], + translation[2]); } if (any_transform) { @@ -232,7 +232,7 @@ vrml_transform(const VrmlNode *node, EggGroup *group, //////////////////////////////////////////////////////////////////// void MainProgram:: vrml_shape(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform) { + const pfMatrix &net_transform) { const VrmlNode *geometry = node->get_value("geometry")._sfnode._p; double transparency = 0.0; @@ -263,10 +263,10 @@ vrml_shape(const VrmlNode *node, EggGroup *group, //////////////////////////////////////////////////////////////////// void MainProgram:: vrml_grouping_node(const SFNodeRef &vrml, EggGroup *egg, - const pfMatrix &net_transform, - void (MainProgram::*process_func) - (const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform)) { + const pfMatrix &net_transform, + void (MainProgram::*process_func) + (const VrmlNode *node, EggGroup *group, + const pfMatrix &net_transform)) { const VrmlNode *node = vrml._p; assert(node != NULL); const char *name = vrml._name; @@ -310,7 +310,7 @@ vrml_grouping_node(const SFNodeRef &vrml, EggGroup *egg, //////////////////////////////////////////////////////////////////// void MainProgram:: vrml_node(const SFNodeRef &vrml, EggGroup *egg, - const pfMatrix &net_transform) { + const pfMatrix &net_transform) { const VrmlNode *node = vrml._p; if (node != NULL) { // Now add it to the egg file at this point. @@ -349,7 +349,7 @@ get_all_defs(SFNodeRef &vrml, MainProgram::Nodes &nodes) { ni = nodes.find(vrml._name); if (ni != nodes.end()) { cerr << "Warning: node name " << vrml._name - << " appears multiple times.\n"; + << " appears multiple times.\n"; } */ nodes[vrml._name] = vrml._p; @@ -377,13 +377,13 @@ get_all_defs(SFNodeRef &vrml, MainProgram::Nodes &nodes) { VrmlNode::Fields::iterator fi; for (fi = node->_fields.begin(); fi != node->_fields.end(); ++fi) { if ((*fi)._type->type == SFNODE) { - get_all_defs((*fi)._value._sfnode, nodes); + get_all_defs((*fi)._value._sfnode, nodes); } else if ((*fi)._type->type == MFNODE) { - MFArray *children = (*fi)._value._mf; - MFArray::iterator ci; - for (ci = children->begin(); ci != children->end(); ++ci) { - get_all_defs((*ci)._sfnode, nodes); - } + MFArray *children = (*fi)._value._mf; + MFArray::iterator ci; + for (ci = children->begin(); ci != children->end(); ++ci) { + get_all_defs((*ci)._sfnode, nodes); + } } } } diff --git a/pandatool/src/vrml/vrml2egg.h b/pandatool/src/vrml/vrml2egg.h index a3e8abc6f8..7b46882c42 100644 --- a/pandatool/src/vrml/vrml2egg.h +++ b/pandatool/src/vrml/vrml2egg.h @@ -26,7 +26,7 @@ class EggGroup; class pfMatrix; //////////////////////////////////////////////////////////////////// -// Class : MainProgram +// Class : MainProgram // Description : The vrml2egg program class. This handles the user // input and gets things going. //////////////////////////////////////////////////////////////////// @@ -41,26 +41,26 @@ public: virtual boolean HandleGetopts(char flag, char *optarg, int &optind, - int argc, char **argv); + int argc, char **argv); virtual boolean HandleArgs(int &argc, char **&argv); void vrml_group(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform); + const pfMatrix &net_transform); void vrml_transform(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform); + const pfMatrix &net_transform); void vrml_shape(const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform); + const pfMatrix &net_transform); void vrml_grouping_node(const SFNodeRef &vrml, EggGroup *egg, - const pfMatrix &net_transform, - void (MainProgram::*process_func) - (const VrmlNode *node, EggGroup *group, - const pfMatrix &net_transform)); + const pfMatrix &net_transform, + void (MainProgram::*process_func) + (const VrmlNode *node, EggGroup *group, + const pfMatrix &net_transform)); void vrml_node(const SFNodeRef &vrml, - EggGroup *egg, const pfMatrix &net_transform); + EggGroup *egg, const pfMatrix &net_transform); typedef map Nodes; diff --git a/pandatool/src/vrml/vrmlLexer.lxx b/pandatool/src/vrml/vrmlLexer.lxx index 53a512525c..4773f8db15 100644 --- a/pandatool/src/vrml/vrmlLexer.lxx +++ b/pandatool/src/vrml/vrmlLexer.lxx @@ -561,7 +561,7 @@ idRestChar ([^\x00-\x20\x22\x23\x27\x2b-\x2c\x2e\x5b-\x5d\x7b\x7d]) <*>{wsnnl}+ ; /* This is also whitespace, but we'll keep track of line number */ /* to report in errors: */ -<*>{wsnnl}*\n{wsnnl}* ; +<*>{wsnnl}*\n{wsnnl}* ; /* This catch-all rule catches anything not covered by any of */ /* the above: */ diff --git a/pandatool/src/vrml/vrmlNodeType.cxx b/pandatool/src/vrml/vrmlNodeType.cxx index f72ebcc60d..543496e033 100644 --- a/pandatool/src/vrml/vrmlNodeType.cxx +++ b/pandatool/src/vrml/vrmlNodeType.cxx @@ -28,7 +28,7 @@ plist VrmlNodeType::typeList; static ostream & output_array(ostream &out, const MFArray *mf, - int type, int indent_level, int items_per_row) { + int type, int indent_level, int items_per_row) { if (mf->empty()) { out << "[ ]"; } else { @@ -37,14 +37,14 @@ output_array(ostream &out, const MFArray *mf, int col = 0; for (mi = mf->begin(); mi != mf->end(); ++mi) { if (col == 0) { - out << "\n"; - indent(out, indent_level + 2); + out << "\n"; + indent(out, indent_level + 2); } output_value(out, (*mi), type, indent_level + 2); if (++col >= items_per_row) { - col = 0; + col = 0; } else { - out << " "; + out << " "; } } out << "\n"; @@ -55,7 +55,7 @@ output_array(ostream &out, const MFArray *mf, ostream & output_value(ostream &out, const VrmlFieldValue &value, int type, - int indent) { + int indent) { switch (type) { case SFBOOL: return out << (value._sfbool ? "TRUE" : "FALSE"); @@ -71,11 +71,11 @@ output_value(ostream &out, const VrmlFieldValue &value, int type, { out << '"'; for (const char *p = value._sfstring; *p != '\0'; p++) { - if (*p == '"') { - out << "\\\""; - } else { - out << *p; - } + if (*p == '"') { + out << "\\\""; + } else { + out << *p; + } } return out << '"'; } @@ -86,11 +86,11 @@ output_value(ostream &out, const VrmlFieldValue &value, int type, case SFCOLOR: case SFVEC3F: return out << value._sfvec[0] << " " << value._sfvec[1] << " " - << value._sfvec[2]; + << value._sfvec[2]; case SFROTATION: return out << value._sfvec[0] << " " << value._sfvec[1] << " " - << value._sfvec[2] << " " << value._sfvec[3]; + << value._sfvec[2] << " " << value._sfvec[3]; case SFNODE: switch (value._sfnode._type) { @@ -233,25 +233,25 @@ VrmlNodeType::find(const char *_name) void VrmlNodeType::addEventIn(const char *name, int type, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { add(eventIns, name, type, dflt); }; void VrmlNodeType::addEventOut(const char *name, int type, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { add(eventOuts, name, type, dflt); }; void VrmlNodeType::addField(const char *name, int type, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { add(fields, name, type, dflt); }; void VrmlNodeType::addExposedField(const char *name, int type, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { char tmp[1000]; add(fields, name, type, dflt); @@ -263,7 +263,7 @@ VrmlNodeType::addExposedField(const char *name, int type, void VrmlNodeType::add(plist &recs, const char *name, int type, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { NameTypeRec *r = new NameTypeRec; r->name = strdup(name); diff --git a/pandatool/src/vrml/vrmlNodeType.h b/pandatool/src/vrml/vrmlNodeType.h index 5d3261d148..e455cf99ca 100644 --- a/pandatool/src/vrml/vrmlNodeType.h +++ b/pandatool/src/vrml/vrmlNodeType.h @@ -43,7 +43,7 @@ typedef pvector MFArray; ostream &output_value(ostream &out, const VrmlFieldValue &value, int type, - int indent = 0); + int indent = 0); class VrmlNodeType { diff --git a/pandatool/src/vrml/vrmlParser.yxx b/pandatool/src/vrml/vrmlParser.yxx index f4df36a1fb..c58b7f18ca 100644 --- a/pandatool/src/vrml/vrmlParser.yxx +++ b/pandatool/src/vrml/vrmlParser.yxx @@ -88,8 +88,8 @@ int addEventIn(const char *type, const char *name, const VrmlFieldValue *dflt = int addEventOut(const char *type, const char *name, const VrmlFieldValue *dflt = NULL); int addExposedField(const char *type, const char *name, const VrmlFieldValue *dflt = NULL); int add(void (VrmlNodeType::*func)(const char *, int, const VrmlFieldValue *), - const char *typeString, const char *name, - const VrmlFieldValue *dflt); + const char *typeString, const char *name, + const VrmlFieldValue *dflt); int fieldType(const char *type); void enterNode(const char *); VrmlNode *exitNode(); @@ -298,7 +298,7 @@ nodeGut: ; fieldValue: - SFBOOL + SFBOOL | SFCOLOR | MFCOLOR | SFFLOAT @@ -386,26 +386,26 @@ endProto() int addField(const char *type, const char *name, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { return add(&VrmlNodeType::addField, type, name, dflt); } int addEventIn(const char *type, const char *name, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { return add(&VrmlNodeType::addEventIn, type, name, dflt); } int addEventOut(const char *type, const char *name, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { return add(&VrmlNodeType::addEventOut, type, name, dflt); } int addExposedField(const char *type, const char *name, - const VrmlFieldValue *dflt) + const VrmlFieldValue *dflt) { return add(&VrmlNodeType::addExposedField, type, name, dflt); } @@ -525,9 +525,9 @@ enterField(const char *fieldName) return; const VrmlNodeType::NameTypeRec *typeRec = - fr->nodeType->hasField(fieldName); + fr->nodeType->hasField(fieldName); if (typeRec != NULL) { - fr->typeRec = typeRec; + fr->typeRec = typeRec; // Let the lexer know what field type to expect: expect(typeRec->type); } diff --git a/pandatool/src/vrmlegg/indexedFaceSet.cxx b/pandatool/src/vrmlegg/indexedFaceSet.cxx index d0f078e03b..399dd6098b 100644 --- a/pandatool/src/vrmlegg/indexedFaceSet.cxx +++ b/pandatool/src/vrmlegg/indexedFaceSet.cxx @@ -116,7 +116,7 @@ get_polys() { //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: get_vrml_colors(const VrmlNode *color_node, double transparency, - pvector &color_list) { + pvector &color_list) { const MFArray *color = color_node->get_value("color")._mf; MFArray::const_iterator ci; for (ci = color->begin(); ci != color->end(); ++ci) { @@ -134,7 +134,7 @@ get_vrml_colors(const VrmlNode *color_node, double transparency, //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: get_vrml_normals(const VrmlNode *normal_node, - pvector &normal_list) { + pvector &normal_list) { const MFArray *point = normal_node->get_value("vector")._mf; MFArray::const_iterator ci; for (ci = point->begin(); ci != point->end(); ++ci) { @@ -152,7 +152,7 @@ get_vrml_normals(const VrmlNode *normal_node, //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: get_vrml_uvs(const VrmlNode *texCoord_node, - pvector &uv_list) { + pvector &uv_list) { const MFArray *point = texCoord_node->get_value("point")._mf; MFArray::const_iterator ci; for (ci = point->begin(); ci != point->end(); ++ci) { @@ -183,51 +183,51 @@ get_colors() { size_t pi = 0; size_t pv = 0; for (ci = colorIndex->begin(); ci != colorIndex->end(); ++ci) { - if ((*ci)._sfint32 < 0) { - // End of poly. - if (pv != _polys[pi]._verts.size()) { - cerr << "Color indices don't match up!\n"; - return false; - } - pi++; - pv = 0; - } else { - if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { - cerr << "Color indices don't match up!\n"; - return false; - } - _polys[pi]._verts[pv]._attrib.set_color(color_list[(*ci)._sfint32]); - pv++; - } + if ((*ci)._sfint32 < 0) { + // End of poly. + if (pv != _polys[pi]._verts.size()) { + cerr << "Color indices don't match up!\n"; + return false; + } + pi++; + pv = 0; + } else { + if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { + cerr << "Color indices don't match up!\n"; + return false; + } + _polys[pi]._verts[pv]._attrib.set_color(color_list[(*ci)._sfint32]); + pv++; + } } if (pi != _polys.size()) { - cerr << "Not enough color indices!\n"; - return false; + cerr << "Not enough color indices!\n"; + return false; } } else { if (!colorIndex->empty()) { - MFArray::const_iterator ci; - size_t pi = 0; - if (colorIndex->size() != _polys.size()) { - cerr << "Wrong number of color indices!\n"; - return false; - } - for (ci = colorIndex->begin(); ci != colorIndex->end(); ++ci) { - if ((*ci)._sfint32 < 0 || (*ci)._sfint32 >= (int)color_list.size()) { - cerr << "Invalid color index!\n"; - return false; - } - _polys[pi]._attrib.set_color(color_list[(*ci)._sfint32]); - pi++; - } + MFArray::const_iterator ci; + size_t pi = 0; + if (colorIndex->size() != _polys.size()) { + cerr << "Wrong number of color indices!\n"; + return false; + } + for (ci = colorIndex->begin(); ci != colorIndex->end(); ++ci) { + if ((*ci)._sfint32 < 0 || (*ci)._sfint32 >= (int)color_list.size()) { + cerr << "Invalid color index!\n"; + return false; + } + _polys[pi]._attrib.set_color(color_list[(*ci)._sfint32]); + pi++; + } } else { - if (color_list.size() != _polys.size()) { - cerr << "Wrong number of colors!\n"; - return false; - } - for (size_t pi = 0; pi < color_list.size(); pi++) { - _polys[pi]._attrib.set_color(color_list[pi]); - } + if (color_list.size() != _polys.size()) { + cerr << "Wrong number of colors!\n"; + return false; + } + for (size_t pi = 0; pi < color_list.size(); pi++) { + _polys[pi]._attrib.set_color(color_list[pi]); + } } } return true; @@ -253,8 +253,8 @@ get_normals() { MFArray::const_iterator ci; if (normalPerVertex && - normal_list.size() == _polys.size() && - normalIndex->empty()) { + normal_list.size() == _polys.size() && + normalIndex->empty()) { // Here's an interesting formZ bug. We end up with a VRML file // that claims to have normals per vertex, yet there is no // normal index list, and there are exactly enough normals in @@ -265,15 +265,15 @@ get_normals() { if (normalPerVertex) { if (normalIndex->empty()) { - // If we have *no* normal index array, but we do have - // per-vertex normals, assume the VRML writer meant to imply a - // one-to-one mapping. This works around a broken formZ VRML - // file writer. - for (size_t i = 0; i < normal_list.size(); i++) { - VrmlFieldValue fv; - fv._sfint32 = i; - (*normalIndex).push_back(fv); - } + // If we have *no* normal index array, but we do have + // per-vertex normals, assume the VRML writer meant to imply a + // one-to-one mapping. This works around a broken formZ VRML + // file writer. + for (size_t i = 0; i < normal_list.size(); i++) { + VrmlFieldValue fv; + fv._sfint32 = i; + (*normalIndex).push_back(fv); + } } // It's possible that this .wrl file indexes normals directly @@ -283,86 +283,86 @@ get_normals() { // vertices, and none of the indices is -1. bool linear_list = (normalIndex->size() == _coord_values.size()); for (ci = normalIndex->begin(); - ci != normalIndex->end() && linear_list; - ++ci) { - linear_list = ((*ci)._sfint32 >= 0); + ci != normalIndex->end() && linear_list; + ++ci) { + linear_list = ((*ci)._sfint32 >= 0); } if (linear_list) { - // Ok, we do have such a list. This .wrl file seems to store - // its texture coordinates one per vertex, instead of one per - // polygon vertex. - _per_vertex_normals.reserve(_coord_values.size()); + // Ok, we do have such a list. This .wrl file seems to store + // its texture coordinates one per vertex, instead of one per + // polygon vertex. + _per_vertex_normals.reserve(_coord_values.size()); + + for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { + size_t vi = (*ci)._sfint32; + nassertr(vi >= 0, false); + if (vi >= normal_list.size()) { + cerr << "Invalid normal index: " << vi << "\n"; + return false; + } + _per_vertex_normals.push_back(normal_list[vi]); + } + nassertr(_per_vertex_normals.size() == _coord_values.size(), false); - for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { - size_t vi = (*ci)._sfint32; - nassertr(vi >= 0, false); - if (vi >= normal_list.size()) { - cerr << "Invalid normal index: " << vi << "\n"; - return false; - } - _per_vertex_normals.push_back(normal_list[vi]); - } - nassertr(_per_vertex_normals.size() == _coord_values.size(), false); - } else { - // This is a "correct" .wrl file that stores its texture - // coordinates one per polygon vertex. This allows a shared - // vertex to contain two different normal values in differing - // polygons (meaning it's not actually shared). - - MFArray::const_iterator ci; - size_t pi = 0; - size_t pv = 0; - for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { - if ((*ci)._sfint32 < 0) { - // End of poly. - if (pv != _polys[pi]._verts.size()) { - cerr << "Normal indices don't match up!\n"; - return false; - } - pi++; - pv = 0; - } else { - if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { - cerr << "Normal indices don't match up!\n"; - return false; - } - const Normald &d = normal_list[(*ci)._sfint32]; - _polys[pi]._verts[pv]._attrib.set_normal(d); - pv++; - } - } - if (pi != _polys.size()) { - cerr << "Not enough normal indices!\n"; - return false; - } + // This is a "correct" .wrl file that stores its texture + // coordinates one per polygon vertex. This allows a shared + // vertex to contain two different normal values in differing + // polygons (meaning it's not actually shared). + + MFArray::const_iterator ci; + size_t pi = 0; + size_t pv = 0; + for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { + if ((*ci)._sfint32 < 0) { + // End of poly. + if (pv != _polys[pi]._verts.size()) { + cerr << "Normal indices don't match up!\n"; + return false; + } + pi++; + pv = 0; + } else { + if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { + cerr << "Normal indices don't match up!\n"; + return false; + } + const Normald &d = normal_list[(*ci)._sfint32]; + _polys[pi]._verts[pv]._attrib.set_normal(d); + pv++; + } + } + if (pi != _polys.size()) { + cerr << "Not enough normal indices!\n"; + return false; + } } } else { if (!normalIndex->empty()) { - size_t pi = 0; - if (normalIndex->size() != _polys.size()) { - cerr << "Wrong number of normal indices!\n"; - return false; - } - for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { - if ((*ci)._sfint32 < 0 || (*ci)._sfint32 >= (int)normal_list.size()) { - cerr << "Invalid normal index!\n"; - return false; - } - const Normald &d = normal_list[(*ci)._sfint32]; - _polys[pi]._attrib.set_normal(d); - pi++; - } + size_t pi = 0; + if (normalIndex->size() != _polys.size()) { + cerr << "Wrong number of normal indices!\n"; + return false; + } + for (ci = normalIndex->begin(); ci != normalIndex->end(); ++ci) { + if ((*ci)._sfint32 < 0 || (*ci)._sfint32 >= (int)normal_list.size()) { + cerr << "Invalid normal index!\n"; + return false; + } + const Normald &d = normal_list[(*ci)._sfint32]; + _polys[pi]._attrib.set_normal(d); + pi++; + } } else { - if (normal_list.size() != _polys.size()) { - cerr << "Wrong number of normals!\n"; - return false; - } - for (size_t pi = 0; pi < normal_list.size(); pi++) { - const Normald &d = normal_list[pi]; - _polys[pi]._attrib.set_normal(d); - } + if (normal_list.size() != _polys.size()) { + cerr << "Wrong number of normals!\n"; + return false; + } + for (size_t pi = 0; pi < normal_list.size(); pi++) { + const Normald &d = normal_list[pi]; + _polys[pi]._attrib.set_normal(d); + } } } return true; @@ -385,8 +385,8 @@ assign_per_vertex_normals() { for (size_t pv = 0; pv < _polys[pi]._verts.size(); pv++) { VrmlVertex &vv = _polys[pi]._verts[pv]; if (vv._index >= 0 && vv._index < (int)_per_vertex_normals.size()) { - const Normald &d = _per_vertex_normals[vv._index]; - vv._attrib.set_normal(d); + const Normald &d = _per_vertex_normals[vv._index]; + vv._attrib.set_normal(d); } } } @@ -415,9 +415,9 @@ get_uvs() { // imply a one-to-one mapping. This works around a broken formZ // VRML file writer. for (size_t i = 0; i < uv_list.size(); i++) { - VrmlFieldValue fv; - fv._sfint32 = i; - (*texCoordIndex).push_back(fv); + VrmlFieldValue fv; + fv._sfint32 = i; + (*texCoordIndex).push_back(fv); } } @@ -428,8 +428,8 @@ get_uvs() { // of vertices, and none of the indices is -1. bool linear_list = (texCoordIndex->size() == _coord_values.size()); for (ci = texCoordIndex->begin(); - ci != texCoordIndex->end() && linear_list; - ++ci) { + ci != texCoordIndex->end() && linear_list; + ++ci) { linear_list = ((*ci)._sfint32 >= 0); } @@ -440,13 +440,13 @@ get_uvs() { _per_vertex_uvs.reserve(_coord_values.size()); for (ci = texCoordIndex->begin(); ci != texCoordIndex->end(); ++ci) { - size_t vi = (*ci)._sfint32; - nassertr(vi >= 0, false); - if (vi >= uv_list.size()) { - cerr << "Invalid texCoord index: " << vi << "\n"; - return false; - } - _per_vertex_uvs.push_back(uv_list[vi]); + size_t vi = (*ci)._sfint32; + nassertr(vi >= 0, false); + if (vi >= uv_list.size()) { + cerr << "Invalid texCoord index: " << vi << "\n"; + return false; + } + _per_vertex_uvs.push_back(uv_list[vi]); } nassertr(_per_vertex_uvs.size() == _coord_values.size(), false); @@ -459,26 +459,26 @@ get_uvs() { size_t pi = 0; size_t pv = 0; for (ci = texCoordIndex->begin(); ci != texCoordIndex->end(); ++ci) { - if ((*ci)._sfint32 < 0) { - // End of poly. - if (pv != _polys[pi]._verts.size()) { - cerr << "texCoord indices don't match up!\n"; - return false; - } - pi++; - pv = 0; - } else { - if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { - cerr << "texCoord indices don't match up!\n"; - return false; - } - _polys[pi]._verts[pv]._attrib.set_uv(uv_list[(*ci)._sfint32]); - pv++; - } + if ((*ci)._sfint32 < 0) { + // End of poly. + if (pv != _polys[pi]._verts.size()) { + cerr << "texCoord indices don't match up!\n"; + return false; + } + pi++; + pv = 0; + } else { + if (pi >= _polys.size() || pv >= _polys[pi]._verts.size()) { + cerr << "texCoord indices don't match up!\n"; + return false; + } + _polys[pi]._verts[pv]._attrib.set_uv(uv_list[(*ci)._sfint32]); + pv++; + } } if (pi != _polys.size()) { - cerr << "Not enough texCoord indices!\n"; - return false; + cerr << "Not enough texCoord indices!\n"; + return false; } } return true; @@ -501,8 +501,8 @@ assign_per_vertex_uvs() { for (size_t pv = 0; pv < _polys[pi]._verts.size(); pv++) { VrmlVertex &vv = _polys[pi]._verts[pv]; if (vv._index >= 0 && vv._index < (int)_per_vertex_uvs.size()) { - const TexCoordd &d = _per_vertex_uvs[vv._index]; - vv._attrib.set_uv(d); + const TexCoordd &d = _per_vertex_uvs[vv._index]; + vv._attrib.set_uv(d); } } } @@ -516,7 +516,7 @@ assign_per_vertex_uvs() { //////////////////////////////////////////////////////////////////// void IndexedFaceSet:: make_polys(EggVertexPool *vpool, EggGroup *group, - const LMatrix4d &net_transform) { + const LMatrix4d &net_transform) { bool ccw = _geometry->get_value("ccw")._sfbool; bool solid = _geometry->get_value("solid")._sfbool; @@ -540,22 +540,22 @@ make_polys(EggVertexPool *vpool, EggGroup *group, if (ccw) { // The vertices are counterclockwise, same as Egg. for (int pv = 0; pv < (int)_polys[pi]._verts.size(); pv++) { - EggVertex vert(_polys[pi]._verts[pv]._attrib); - Vertexd pos = - _polys[pi]._verts[pv]._pos * net_transform; - vert.set_pos(pos); - - poly->add_vertex(vpool->create_unique_vertex(vert)); + EggVertex vert(_polys[pi]._verts[pv]._attrib); + Vertexd pos = + _polys[pi]._verts[pv]._pos * net_transform; + vert.set_pos(pos); + + poly->add_vertex(vpool->create_unique_vertex(vert)); } } else { // The vertices are clockwise, so add 'em in reverse order. for (int pv = (int)_polys[pi]._verts.size() - 1; pv >= 0; pv--) { - EggVertex vert(_polys[pi]._verts[pv]._attrib); - Vertexd pos = - _polys[pi]._verts[pv]._pos * net_transform; - vert.set_pos(pos); - - poly->add_vertex(vpool->create_unique_vertex(vert)); + EggVertex vert(_polys[pi]._verts[pv]._attrib); + Vertexd pos = + _polys[pi]._verts[pv]._pos * net_transform; + vert.set_pos(pos); + + poly->add_vertex(vpool->create_unique_vertex(vert)); } } } diff --git a/pandatool/src/vrmlegg/indexedFaceSet.h b/pandatool/src/vrmlegg/indexedFaceSet.h index 3b5f1fac8d..cb954cde90 100644 --- a/pandatool/src/vrmlegg/indexedFaceSet.h +++ b/pandatool/src/vrmlegg/indexedFaceSet.h @@ -44,11 +44,11 @@ private: void get_coord_values(); void get_polys(); void get_vrml_colors(const VrmlNode *color_node, double transparency, - pvector &color_list); + pvector &color_list); void get_vrml_normals(const VrmlNode *normal_node, - pvector &normal_list); + pvector &normal_list); void get_vrml_uvs(const VrmlNode *texCoord_node, - pvector &uv_list); + pvector &uv_list); bool get_colors(); bool get_normals(); @@ -56,7 +56,7 @@ private: bool get_uvs(); void assign_per_vertex_uvs(); void make_polys(EggVertexPool *vpool, EggGroup *group, - const LMatrix4d &net_transform); + const LMatrix4d &net_transform); void compute_normals(EggGroup *group); class VrmlVertex { diff --git a/pandatool/src/vrmlegg/vrmlAppearance.cxx b/pandatool/src/vrmlegg/vrmlAppearance.cxx index 6079c663bd..f72a3f57ae 100644 --- a/pandatool/src/vrmlegg/vrmlAppearance.cxx +++ b/pandatool/src/vrmlegg/vrmlAppearance.cxx @@ -33,11 +33,11 @@ VRMLAppearance(const VrmlNode *appearance) { const VrmlNode *texture = appearance->get_value("texture")._sfnode._p; if (texture != NULL) { if (strcmp(texture->_type->getName(), "ImageTexture") == 0) { - MFArray *url = texture->get_value("url")._mf; - if (!url->empty()) { - const char *filename = (*url->begin())._sfstring; - _tex = new EggTexture("tref", filename); - } + MFArray *url = texture->get_value("url")._mf; + if (!url->empty()) { + const char *filename = (*url->begin())._sfstring; + _tex = new EggTexture("tref", filename); + } } } } diff --git a/pandatool/src/vrmlegg/vrmlToEggConverter.cxx b/pandatool/src/vrmlegg/vrmlToEggConverter.cxx index 13a360a203..f3c37580b6 100644 --- a/pandatool/src/vrmlegg/vrmlToEggConverter.cxx +++ b/pandatool/src/vrmlegg/vrmlToEggConverter.cxx @@ -151,7 +151,7 @@ get_all_defs(SFNodeRef &vrml, VRMLToEggConverter::Nodes &nodes) { ni = nodes.find(vrml._name); if (ni != nodes.end()) { cerr << "Warning: node name " << vrml._name - << " appears multiple times.\n"; + << " appears multiple times.\n"; } */ nodes[vrml._name] = vrml._p; @@ -182,13 +182,13 @@ get_all_defs(SFNodeRef &vrml, VRMLToEggConverter::Nodes &nodes) { VrmlNode::Fields::iterator fi; for (fi = node->_fields.begin(); fi != node->_fields.end(); ++fi) { if ((*fi)._type->type == SFNODE) { - get_all_defs((*fi)._value._sfnode, nodes); + get_all_defs((*fi)._value._sfnode, nodes); } else if ((*fi)._type->type == MFNODE) { - MFArray *children = (*fi)._value._mf; - MFArray::iterator ci; - for (ci = children->begin(); ci != children->end(); ++ci) { - get_all_defs((*ci)._sfnode, nodes); - } + MFArray *children = (*fi)._value._mf; + MFArray::iterator ci; + for (ci = children->begin(); ci != children->end(); ++ci) { + get_all_defs((*ci)._sfnode, nodes); + } } } } @@ -203,7 +203,7 @@ get_all_defs(SFNodeRef &vrml, VRMLToEggConverter::Nodes &nodes) { //////////////////////////////////////////////////////////////////// void VRMLToEggConverter:: vrml_node(const SFNodeRef &vrml, EggGroupNode *egg, - const LMatrix4d &net_transform) { + const LMatrix4d &net_transform) { const VrmlNode *node = vrml._p; if (node != NULL) { // Now add it to the egg file at this point. @@ -232,10 +232,10 @@ vrml_node(const SFNodeRef &vrml, EggGroupNode *egg, //////////////////////////////////////////////////////////////////// void VRMLToEggConverter:: vrml_grouping_node(const SFNodeRef &vrml, EggGroupNode *egg, - const LMatrix4d &net_transform, - void (VRMLToEggConverter::*process_func) - (const VrmlNode *node, EggGroup *group, - const LMatrix4d &net_transform)) { + const LMatrix4d &net_transform, + void (VRMLToEggConverter::*process_func) + (const VrmlNode *node, EggGroup *group, + const LMatrix4d &net_transform)) { const VrmlNode *node = vrml._p; nassertv(node != NULL); string name; @@ -285,7 +285,7 @@ vrml_grouping_node(const SFNodeRef &vrml, EggGroupNode *egg, //////////////////////////////////////////////////////////////////// void VRMLToEggConverter:: vrml_group(const VrmlNode *node, EggGroup *group, - const LMatrix4d &net_transform) { + const LMatrix4d &net_transform) { const MFArray *children = node->get_value("children")._mf; MFArray::const_iterator ci; for (ci = children->begin(); ci != children->end(); ++ci) { @@ -301,7 +301,7 @@ vrml_group(const VrmlNode *node, EggGroup *group, //////////////////////////////////////////////////////////////////// void VRMLToEggConverter:: vrml_transform(const VrmlNode *node, EggGroup *group, - const LMatrix4d &net_transform) { + const LMatrix4d &net_transform) { const double *scale = node->get_value("scale")._sfvec; const double *rotation = node->get_value("rotation")._sfvec; const double *translation = node->get_value("translation")._sfvec; @@ -320,15 +320,15 @@ vrml_transform(const VrmlNode *node, EggGroup *group, LMatrix4d::translate_mat(-center[0], -center[1], -center[2]); if (o[3] != 0.0) { - local_transform *= + local_transform *= LMatrix4d::rotate_mat(rad_2_deg(-o[3]), LVector3d(o[0], o[1], o[2])); - local_transform *= + local_transform *= LMatrix4d::scale_mat(scale[0], scale[1], scale[2]); - local_transform *= + local_transform *= LMatrix4d::rotate_mat(rad_2_deg(o[3]), LVector3d(o[0], o[1], o[2])); } else { - local_transform *= + local_transform *= LMatrix4d::scale_mat(scale[0], scale[1], scale[2]); } local_transform *= @@ -336,15 +336,15 @@ vrml_transform(const VrmlNode *node, EggGroup *group, } else { if (o[3] != 0.0) { - local_transform *= + local_transform *= LMatrix4d::rotate_mat(rad_2_deg(-o[3]), LVector3d(o[0], o[1], o[2])); - local_transform *= + local_transform *= LMatrix4d::scale_mat(scale[0], scale[1], scale[2]); - local_transform *= + local_transform *= LMatrix4d::rotate_mat(rad_2_deg(o[3]), LVector3d(o[0], o[1], o[2])); } else { - local_transform *= + local_transform *= LMatrix4d::scale_mat(scale[0], scale[1], scale[2]); } } @@ -357,14 +357,14 @@ vrml_transform(const VrmlNode *node, EggGroup *group, LMatrix4d::translate_mat(-center[0], -center[1], -center[2]); local_transform *= LMatrix4d::rotate_mat(rad_2_deg(rotation[3]), - LVector3d(rotation[0], rotation[1], rotation[2])); + LVector3d(rotation[0], rotation[1], rotation[2])); local_transform *= LMatrix4d::translate_mat(center[0], center[1], center[2]); } else { local_transform *= LMatrix4d::rotate_mat(rad_2_deg(rotation[3]), - LVector3d(rotation[0], rotation[1], rotation[2])); + LVector3d(rotation[0], rotation[1], rotation[2])); } } @@ -398,7 +398,7 @@ vrml_transform(const VrmlNode *node, EggGroup *group, //////////////////////////////////////////////////////////////////// void VRMLToEggConverter:: vrml_shape(const VrmlNode *node, EggGroup *group, - const LMatrix4d &net_transform) { + const LMatrix4d &net_transform) { const VrmlNode *geometry = node->get_value("geometry")._sfnode._p; if (geometry != NULL) { diff --git a/pandatool/src/xfile/xParser.yxx b/pandatool/src/xfile/xParser.yxx index 9b89a613b7..1d0fd53e8a 100644 --- a/pandatool/src/xfile/xParser.yxx +++ b/pandatool/src/xfile/xParser.yxx @@ -112,14 +112,14 @@ xfile: ; template: - TOKEN_TEMPLATE singleword_name TOKEN_OBRACE class_id + TOKEN_TEMPLATE singleword_name TOKEN_OBRACE class_id { $$ = current_node; XFileTemplate *templ = new XFileTemplate(x_file, $2, $4); current_node->add_child(templ); current_node = templ; } - template_parts TOKEN_CBRACE + template_parts TOKEN_CBRACE { $$ = current_node; current_node = $5; @@ -277,10 +277,10 @@ template_option_list: | template_option_list template_option_part { } - ; + ; template_option_part: - singleword_name + singleword_name { XFileTemplate *xtemplate = x_file->find_template($1); if (xtemplate == (XFileTemplate *)NULL) { @@ -289,7 +289,7 @@ template_option_part: DCAST(XFileTemplate, current_node)->add_option(xtemplate); } } - | singleword_name class_id + | singleword_name class_id { XFileTemplate *xtemplate = x_file->find_template($2); if (xtemplate == (XFileTemplate *)NULL) { @@ -305,16 +305,16 @@ template_option_part: ; singleword_name: - TOKEN_NAME - ; + TOKEN_NAME + ; multiword_name: TOKEN_NAME - | multiword_name TOKEN_NAME + | multiword_name TOKEN_NAME { $$ = $1 + " " + $2; } - | multiword_name TOKEN_INTEGER + | multiword_name TOKEN_INTEGER { $$ = $1 + " " + $2; } @@ -329,7 +329,7 @@ optional_multiword_name: ; class_id: - TOKEN_GUID + TOKEN_GUID ; optional_class_id: @@ -359,7 +359,7 @@ object: current_node = templ; } } - optional_class_id data_parts_list TOKEN_CBRACE + optional_class_id data_parts_list TOKEN_CBRACE { XFileDataNodeTemplate *current_template = DCAST(XFileDataNodeTemplate, current_node); @@ -368,7 +368,7 @@ object: $$ = current_node; current_node = $4; } - ; + ; data_parts_list: empty @@ -381,7 +381,7 @@ data_part: // nested references should be added as children too. current_node->add_child($2); } - | object + | object { // nested objects are just quietly added as children. } @@ -397,7 +397,7 @@ data_part: DCAST(XFileDataNodeTemplate, current_node); current_template->add_parse_double($1); } - | string list_separator + | string list_separator { XFileDataNodeTemplate *current_template = DCAST(XFileDataNodeTemplate, current_node); @@ -409,21 +409,21 @@ data_part: ; integer_list: - TOKEN_INTEGER_LIST + TOKEN_INTEGER_LIST ; realnum_list: - TOKEN_REALNUM_LIST + TOKEN_REALNUM_LIST ; string: - TOKEN_STRING + TOKEN_STRING ; list_separator: - TOKEN_SEMICOLON - | TOKEN_COMMA - ; + TOKEN_SEMICOLON + | TOKEN_COMMA + ; data_reference: multiword_name @@ -435,7 +435,7 @@ data_reference: $$ = new XFileDataNodeReference(data_object); } - | multiword_name class_id + | multiword_name class_id { XFileDataNodeTemplate *data_object = x_file->find_data_object($2); if (data_object == (XFileDataObject *)NULL) {