From fcb24f02ef2d8901d7e86bcf7ebe0a0e0b3b22ee Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 25 May 2001 15:56:49 +0000 Subject: [PATCH] remove tab characters --- direct/src/dcparser/dcAtomicField.cxx | 14 +- direct/src/dcparser/dcAtomicField.h | 2 +- direct/src/dcparser/dcClass.h | 2 +- direct/src/dcparser/dcField.h | 2 +- direct/src/dcparser/dcFile.h | 2 +- direct/src/dcparser/dcLexer.lxx | 2 +- direct/src/dcparser/dcMolecularField.h | 2 +- direct/src/dcparser/dcParser.yxx | 180 +- direct/src/dcparser/dcSubatomicType.h | 2 +- direct/src/dcparser/hashGenerator.h | 2 +- direct/src/dcparser/primeNumberGenerator.cxx | 4 +- direct/src/dcparser/primeNumberGenerator.h | 2 +- direct/src/deadrec/correction.cxx | 6 +- direct/src/showbase/showBase.cxx | 14 +- direct/src/showbase/showBase.h | 8 +- dtool/src/cppparser/cppArrayType.cxx | 8 +- dtool/src/cppparser/cppArrayType.h | 16 +- dtool/src/cppparser/cppBison.yxx | 1030 +-- dtool/src/cppparser/cppBisonDefs.h | 8 +- .../src/cppparser/cppClassTemplateParameter.h | 6 +- dtool/src/cppparser/cppCommentBlock.h | 2 +- dtool/src/cppparser/cppConstType.cxx | 8 +- dtool/src/cppparser/cppConstType.h | 16 +- dtool/src/cppparser/cppDeclaration.cxx | 4 +- dtool/src/cppparser/cppDeclaration.h | 12 +- dtool/src/cppparser/cppEnumType.cxx | 8 +- dtool/src/cppparser/cppEnumType.h | 12 +- dtool/src/cppparser/cppExpression.cxx | 188 +- dtool/src/cppparser/cppExpression.h | 10 +- dtool/src/cppparser/cppExpressionParser.h | 2 +- dtool/src/cppparser/cppExtensionType.cxx | 6 +- dtool/src/cppparser/cppExtensionType.h | 10 +- dtool/src/cppparser/cppFile.cxx | 8 +- dtool/src/cppparser/cppFile.h | 6 +- dtool/src/cppparser/cppFunctionGroup.cxx | 2 +- dtool/src/cppparser/cppFunctionGroup.h | 4 +- dtool/src/cppparser/cppFunctionType.cxx | 16 +- dtool/src/cppparser/cppFunctionType.h | 28 +- dtool/src/cppparser/cppIdentifier.cxx | 92 +- dtool/src/cppparser/cppIdentifier.h | 32 +- dtool/src/cppparser/cppInstance.cxx | 38 +- dtool/src/cppparser/cppInstance.h | 20 +- dtool/src/cppparser/cppInstanceIdentifier.cxx | 16 +- dtool/src/cppparser/cppInstanceIdentifier.h | 4 +- dtool/src/cppparser/cppManifest.cxx | 32 +- dtool/src/cppparser/cppManifest.h | 6 +- dtool/src/cppparser/cppNamespace.h | 6 +- dtool/src/cppparser/cppParameterList.cxx | 14 +- dtool/src/cppparser/cppParameterList.h | 10 +- dtool/src/cppparser/cppParser.h | 2 +- dtool/src/cppparser/cppPointerType.cxx | 8 +- dtool/src/cppparser/cppPointerType.h | 16 +- dtool/src/cppparser/cppPreprocessor.cxx | 486 +- dtool/src/cppparser/cppPreprocessor.h | 30 +- dtool/src/cppparser/cppReferenceType.cxx | 8 +- dtool/src/cppparser/cppReferenceType.h | 16 +- dtool/src/cppparser/cppScope.cxx | 184 +- dtool/src/cppparser/cppScope.h | 36 +- dtool/src/cppparser/cppSimpleType.h | 4 +- dtool/src/cppparser/cppStructType.cxx | 116 +- dtool/src/cppparser/cppStructType.h | 18 +- dtool/src/cppparser/cppTBDType.cxx | 2 +- dtool/src/cppparser/cppTBDType.h | 10 +- .../cppparser/cppTemplateParameterList.cxx | 40 +- .../src/cppparser/cppTemplateParameterList.h | 12 +- dtool/src/cppparser/cppTemplateScope.cxx | 6 +- dtool/src/cppparser/cppTemplateScope.h | 8 +- dtool/src/cppparser/cppToken.cxx | 4 +- dtool/src/cppparser/cppToken.h | 8 +- dtool/src/cppparser/cppType.cxx | 4 +- dtool/src/cppparser/cppType.h | 12 +- dtool/src/cppparser/cppTypeDeclaration.cxx | 2 +- dtool/src/cppparser/cppTypeDeclaration.h | 8 +- dtool/src/cppparser/cppTypeParser.h | 2 +- dtool/src/cppparser/cppTypeProxy.cxx | 6 +- dtool/src/cppparser/cppTypeProxy.h | 12 +- dtool/src/cppparser/cppTypedef.cxx | 2 +- dtool/src/cppparser/cppTypedef.h | 8 +- dtool/src/cppparser/cppUsing.h | 4 +- dtool/src/dconfig/configTable.cxx | 536 +- dtool/src/dconfig/configTable.h | 2 +- dtool/src/dconfig/dconfig.h | 74 +- dtool/src/dconfig/notify.cxx | 28 +- dtool/src/dconfig/notify.h | 10 +- dtool/src/dconfig/notifyCategory.cxx | 24 +- dtool/src/dconfig/notifyCategory.h | 4 +- dtool/src/dconfig/notifyCategoryProxy.h | 2 +- dtool/src/dconfig/serialization.h | 138 +- dtool/src/dconfig/symbolEnt.h | 6 +- dtool/src/dconfig/test_pfstream.cxx | 2 +- dtool/src/dconfig/test_serialization.cxx | 4 +- dtool/src/dtoolbase/version.h | 20 +- dtool/src/dtoolutil/dSearchPath.I | 2 +- dtool/src/dtoolutil/dSearchPath.cxx | 4 +- dtool/src/dtoolutil/dSearchPath.h | 6 +- dtool/src/dtoolutil/executionEnvironment.cxx | 26 +- dtool/src/dtoolutil/executionEnvironment.h | 2 +- dtool/src/dtoolutil/filename.cxx | 58 +- dtool/src/dtoolutil/filename.h | 12 +- dtool/src/dtoolutil/gnu_getopt.h | 32 +- dtool/src/dtoolutil/load_dso.cxx | 2 +- dtool/src/dtoolutil/pfstreamBuf.cxx | 4 +- dtool/src/dtoolutil/vector_src.cxx | 2 +- dtool/src/dtoolutil/vector_src.h | 2 +- dtool/src/interrogate/interrogateBuilder.cxx | 486 +- dtool/src/interrogate/interrogateBuilder.h | 42 +- dtool/src/interrogate/interrogate_module.cxx | 52 +- dtool/src/interrogate/parameterRemap.h | 4 +- .../parameterRemapBasicStringRefToString.h | 2 +- .../parameterRemapBasicStringToString.h | 4 +- .../parameterRemapCharStarToString.h | 2 +- .../parameterRemapConcreteToPointer.h | 2 +- .../parameterRemapConstToNonConst.h | 2 +- .../src/interrogate/parameterRemapEnumToInt.h | 2 +- .../interrogate/parameterRemapPTToPointer.h | 2 +- .../parameterRemapReferenceToConcrete.h | 2 +- .../parameterRemapReferenceToPointer.h | 2 +- dtool/src/interrogate/parameterRemapThis.h | 2 +- .../src/interrogate/parameterRemapToString.h | 2 +- .../src/interrogate/parameterRemapUnchanged.h | 2 +- dtool/src/interrogate/parse_file.cxx | 98 +- dtool/src/interrogate/typeManager.cxx | 102 +- dtool/src/interrogate/typeManager.h | 4 +- dtool/src/interrogate/wrapperBuilder.cxx | 122 +- dtool/src/interrogate/wrapperBuilder.h | 16 +- dtool/src/interrogate/wrapperBuilderC.cxx | 2 +- dtool/src/interrogate/wrapperBuilderC.h | 2 +- .../src/interrogate/wrapperBuilderPython.cxx | 24 +- dtool/src/interrogate/wrapperBuilderPython.h | 2 +- dtool/src/interrogatedb/indexRemapper.h | 2 +- .../src/interrogatedb/interrogateComponent.h | 2 +- dtool/src/interrogatedb/interrogateDatabase.I | 12 +- .../src/interrogatedb/interrogateDatabase.cxx | 118 +- dtool/src/interrogatedb/interrogateDatabase.h | 14 +- dtool/src/interrogatedb/interrogateElement.h | 2 +- dtool/src/interrogatedb/interrogateFunction.h | 2 +- .../interrogateFunctionWrapper.h | 2 +- dtool/src/interrogatedb/interrogateManifest.h | 2 +- dtool/src/interrogatedb/interrogateType.h | 2 +- dtool/src/parser-inc/files.h | 38 +- dtool/src/parser-inc/hex.h | 28 +- dtool/src/parser-inc/md5.h | 38 +- .../src/test_interrogate/test_interrogate.cxx | 38 +- panda/src/audio/audio_gui_functor.cxx | 2 +- panda/src/audio/audio_gui_functor.h | 6 +- panda/src/audio/audio_linux_traits.cxx | 26 +- panda/src/audio/audio_linux_traits.h | 10 +- panda/src/audio/audio_mikmod_traits.h | 12 +- panda/src/audio/audio_null_traits.h | 4 +- panda/src/audio/audio_sound.I | 24 +- panda/src/audio/audio_sound.h | 8 +- panda/src/audio/audio_trait.cxx | 4 +- panda/src/audio/audio_win_traits.I | 6 +- panda/src/audio/audio_win_traits.h | 8 +- panda/src/audio/config_audio.cxx | 6 +- panda/src/audio/test_audio.cxx | 2 +- panda/src/audiotraits/audio_load_midi.cxx | 2 +- panda/src/audiotraits/audio_load_wav.cxx | 2 +- panda/src/builder/builder.I | 6 +- panda/src/builder/builder.cxx | 44 +- panda/src/builder/builder.h | 8 +- panda/src/builder/builderAttribTempl.h | 2 +- panda/src/builder/builderBucket.h | 2 +- panda/src/builder/builderBucketNode.I | 6 +- panda/src/builder/builderBucketNode.cxx | 20 +- panda/src/builder/builderBucketNode.h | 2 +- panda/src/builder/builderFuncs.I | 252 +- panda/src/builder/builderFuncs.h | 6 +- panda/src/builder/builderMisc.cxx | 4 +- panda/src/builder/builderNormalVisualizer.h | 2 +- panda/src/builder/builderPrim.cxx | 26 +- panda/src/builder/builderPrim.h | 26 +- panda/src/builder/builderPrimTempl.I | 84 +- panda/src/builder/builderPrimTempl.h | 4 +- panda/src/builder/builderProperties.cxx | 4 +- panda/src/builder/builderVertex.h | 4 +- panda/src/builder/builderVertexTempl.h | 4 +- panda/src/builder/mesherEdge.I | 10 +- panda/src/builder/mesherEdge.h | 2 +- panda/src/builder/mesherFanMaker.I | 24 +- panda/src/builder/mesherFanMaker.h | 2 +- panda/src/builder/mesherStrip.I | 274 +- panda/src/builder/mesherStrip.h | 26 +- panda/src/builder/mesherTempl.I | 184 +- panda/src/builder/test_builder.cxx | 20 +- panda/src/chan/animBundle.h | 2 +- panda/src/chan/animBundleNode.h | 4 +- panda/src/chan/animChannel.cxx | 6 +- panda/src/chan/animChannel.h | 2 +- panda/src/chan/animChannelBase.h | 2 +- panda/src/chan/animChannelFixed.I | 2 +- panda/src/chan/animChannelFixed.h | 2 +- panda/src/chan/animChannelMatrixXfmTable.cxx | 12 +- panda/src/chan/animChannelMatrixXfmTable.h | 2 +- panda/src/chan/animChannelScalarTable.cxx | 148 +- panda/src/chan/animChannelScalarTable.h | 2 +- panda/src/chan/animControl.cxx | 76 +- panda/src/chan/animControl.h | 4 +- panda/src/chan/animControlCollection.cxx | 2 +- panda/src/chan/animGroup.cxx | 2 +- panda/src/chan/animGroup.h | 4 +- panda/src/chan/auto_bind.cxx | 60 +- panda/src/chan/auto_bind.h | 2 +- panda/src/chan/movingPart.I | 2 +- panda/src/chan/movingPart.h | 4 +- panda/src/chan/movingPartBase.cxx | 10 +- panda/src/chan/movingPartBase.h | 6 +- panda/src/chan/movingPartMatrix.I | 2 +- panda/src/chan/movingPartMatrix.cxx | 62 +- panda/src/chan/movingPartMatrix.h | 6 +- panda/src/chan/movingPartScalar.I | 2 +- panda/src/chan/movingPartScalar.h | 4 +- panda/src/chan/partBundle.cxx | 10 +- panda/src/chan/partBundle.h | 6 +- panda/src/chan/partBundleNode.h | 4 +- panda/src/chan/partGroup.cxx | 104 +- panda/src/chan/partGroup.h | 10 +- panda/src/chancfg/chancfg.h | 2 +- panda/src/chancfg/chanparse.I | 2 +- panda/src/chancfg/chanparse.cxx | 36 +- panda/src/chancfg/chansetup.I | 4 +- panda/src/chancfg/chansetup.h | 2 +- panda/src/chancfg/chanwindow.I | 22 +- panda/src/chancfg/chanwindow.h | 4 +- panda/src/char/character.cxx | 54 +- panda/src/char/character.h | 8 +- panda/src/char/characterJoint.cxx | 34 +- panda/src/char/characterJoint.h | 8 +- panda/src/char/characterJointBundle.h | 2 +- panda/src/char/characterSlider.h | 2 +- panda/src/char/computedVertices.h | 2 +- panda/src/char/dynamicVertices.h | 2 +- panda/src/chat/chatHelpers.cxx | 4 +- panda/src/chat/chatInput.cxx | 42 +- panda/src/chat/chatInput.h | 2 +- panda/src/collide/collisionEntry.h | 4 +- panda/src/collide/collisionHandler.h | 4 +- panda/src/collide/collisionHandlerEvent.I | 2 +- panda/src/collide/collisionHandlerEvent.cxx | 20 +- panda/src/collide/collisionHandlerEvent.h | 6 +- panda/src/collide/collisionHandlerFloor.cxx | 68 +- panda/src/collide/collisionHandlerFloor.h | 4 +- panda/src/collide/collisionHandlerPhysical.h | 4 +- panda/src/collide/collisionHandlerPusher.cxx | 160 +- panda/src/collide/collisionHandlerPusher.h | 4 +- panda/src/collide/collisionHandlerQueue.h | 4 +- panda/src/collide/collisionLevelState.cxx | 2 +- panda/src/collide/collisionNode.cxx | 2 +- panda/src/collide/collisionNode.h | 4 +- panda/src/collide/collisionPlane.cxx | 6 +- panda/src/collide/collisionPlane.h | 12 +- panda/src/collide/collisionPolygon.I | 8 +- panda/src/collide/collisionPolygon.cxx | 60 +- panda/src/collide/collisionPolygon.h | 22 +- panda/src/collide/collisionRay.I | 2 +- panda/src/collide/collisionRay.cxx | 4 +- panda/src/collide/collisionRay.h | 10 +- panda/src/collide/collisionSegment.I | 2 +- panda/src/collide/collisionSegment.cxx | 2 +- panda/src/collide/collisionSegment.h | 10 +- panda/src/collide/collisionSolid.cxx | 12 +- panda/src/collide/collisionSolid.h | 18 +- panda/src/collide/collisionSphere.cxx | 10 +- panda/src/collide/collisionSphere.h | 16 +- panda/src/collide/collisionTraverser.cxx | 202 +- panda/src/collide/collisionTraverser.h | 24 +- panda/src/cull/cullState.cxx | 2 +- panda/src/cull/cullState.h | 6 +- panda/src/cull/cullStateLookup.cxx | 22 +- panda/src/cull/cullStateLookup.h | 16 +- panda/src/cull/cullStateSubtree.I | 6 +- panda/src/cull/cullStateSubtree.cxx | 4 +- panda/src/cull/cullStateSubtree.h | 18 +- panda/src/cull/cullTraverser.I | 18 +- panda/src/cull/cullTraverser.cxx | 76 +- panda/src/cull/cullTraverser.h | 38 +- panda/src/cull/directRenderTransition.h | 4 +- panda/src/cull/geomBin.h | 8 +- panda/src/cull/geomBinAttribute.h | 4 +- panda/src/cull/geomBinBackToFront.I | 2 +- panda/src/cull/geomBinBackToFront.cxx | 46 +- panda/src/cull/geomBinBackToFront.h | 8 +- panda/src/cull/geomBinFixed.I | 2 +- panda/src/cull/geomBinFixed.cxx | 4 +- panda/src/cull/geomBinFixed.h | 8 +- panda/src/cull/geomBinGroup.cxx | 2 +- panda/src/cull/geomBinGroup.h | 6 +- panda/src/cull/geomBinNormal.cxx | 2 +- panda/src/cull/geomBinNormal.h | 2 +- panda/src/cull/geomBinTransition.h | 4 +- panda/src/cull/geomBinUnsorted.cxx | 28 +- panda/src/cull/geomBinUnsorted.h | 6 +- panda/src/cull/test_cull.cxx | 12 +- panda/src/device/analogNode.cxx | 16 +- panda/src/device/buttonNode.cxx | 4 +- panda/src/device/clientAnalogDevice.cxx | 2 +- panda/src/device/clientBase.cxx | 6 +- panda/src/device/clientBase.h | 8 +- panda/src/device/clientButtonDevice.cxx | 14 +- panda/src/device/clientDevice.cxx | 2 +- panda/src/device/clientDevice.h | 2 +- panda/src/device/dialNode.cxx | 2 +- panda/src/device/mouse.cxx | 8 +- panda/src/device/mouse.h | 2 +- panda/src/device/trackerNode.cxx | 4 +- panda/src/dgraph/buttonEventDataAttribute.cxx | 6 +- panda/src/dgraph/buttonEventDataAttribute.h | 4 +- panda/src/dgraph/buttonEventDataTransition.h | 4 +- panda/src/dgraph/dataGraphTraverser.cxx | 26 +- panda/src/dgraph/dataGraphTraverser.h | 4 +- panda/src/dgraph/dataNode.cxx | 2 +- panda/src/dgraph/dataNode.h | 6 +- panda/src/dgraph/dataRelation.h | 4 +- panda/src/dgraph/describe_data_verbose.cxx | 22 +- panda/src/dgraph/describe_data_verbose.h | 2 +- panda/src/dgraph/doubleDataAttribute.h | 4 +- panda/src/dgraph/doubleDataTransition.h | 4 +- panda/src/dgraph/doublePtrDataAttribute.h | 4 +- panda/src/dgraph/doublePtrDataTransition.h | 4 +- panda/src/dgraph/intDataAttribute.h | 4 +- panda/src/dgraph/intDataTransition.h | 4 +- panda/src/dgraph/matrixDataAttribute.h | 4 +- panda/src/dgraph/matrixDataTransition.h | 4 +- panda/src/dgraph/numericDataAttribute.h | 8 +- panda/src/dgraph/numericDataTransition.h | 8 +- panda/src/dgraph/pointerDataAttribute.h | 8 +- panda/src/dgraph/pointerDataTransition.h | 8 +- panda/src/dgraph/test_dgraph.cxx | 22 +- panda/src/dgraph/vec3DataAttribute.h | 4 +- panda/src/dgraph/vec3DataTransition.h | 4 +- panda/src/dgraph/vec4DataAttribute.h | 4 +- panda/src/dgraph/vec4DataTransition.h | 4 +- panda/src/dgraph/vectorDataAttribute.h | 10 +- panda/src/dgraph/vectorDataTransition.h | 10 +- panda/src/display/config_display.cxx | 4 +- panda/src/display/displayRegion.cxx | 2 +- panda/src/display/displayRegion.h | 6 +- panda/src/display/displayRegionStack.h | 2 +- panda/src/display/frameBufferStack.h | 2 +- panda/src/display/graphicsChannel.h | 2 +- panda/src/display/graphicsLayer.h | 4 +- panda/src/display/graphicsPipe.cxx | 18 +- panda/src/display/graphicsPipe.h | 4 +- panda/src/display/graphicsStateGuardian.I | 2 +- panda/src/display/graphicsStateGuardian.cxx | 148 +- panda/src/display/graphicsStateGuardian.h | 22 +- panda/src/display/graphicsWindow.I | 2 +- panda/src/display/graphicsWindow.cxx | 22 +- panda/src/display/graphicsWindow.h | 6 +- panda/src/display/hardwareChannel.cxx | 2 +- panda/src/display/hardwareChannel.h | 30 +- panda/src/display/interactiveGraphicsPipe.cxx | 2 +- .../display/noninteractiveGraphicsPipe.cxx | 2 +- panda/src/display/renderBuffer.h | 2 +- panda/src/display/savedFrameBuffer.h | 6 +- panda/src/display/textureContext.h | 4 +- panda/src/doc/sampleClass.h | 2 +- panda/src/downloader/asyncDecompressor.cxx | 24 +- panda/src/downloader/asyncDecompressor.h | 6 +- panda/src/downloader/asyncDownloader.I | 2 +- panda/src/downloader/asyncDownloader.cxx | 302 +- panda/src/downloader/asyncDownloader.h | 28 +- panda/src/downloader/asyncExtractor.cxx | 16 +- panda/src/downloader/asyncExtractor.h | 2 +- panda/src/downloader/asyncUtility.cxx | 10 +- panda/src/downloader/config_downloader.cxx | 18 +- panda/src/downloader/decompressor.cxx | 10 +- panda/src/downloader/downloadDb.cxx | 92 +- panda/src/downloader/downloader.I | 2 +- panda/src/downloader/downloader.cxx | 76 +- panda/src/downloader/downloader.h | 6 +- panda/src/downloader/multiplexStream.I | 18 +- panda/src/downloader/multiplexStreamBuf.cxx | 8 +- panda/src/downloader/multiplexStreamBuf.h | 6 +- panda/src/downloader/zcompressor.I | 2 +- panda/src/downloader/zcompressor.cxx | 10 +- panda/src/downloader/zcompressor.h | 12 +- panda/src/downloadertools/multify.cxx | 14 +- panda/src/dxgsg/dxGraphicsStateGuardian.I | 188 +- panda/src/dxgsg/dxGraphicsStateGuardian.cxx | 6830 ++++++++--------- panda/src/dxgsg/dxGraphicsStateGuardian.h | 66 +- panda/src/dxgsg/dxSavedFrameBuffer.h | 6 +- panda/src/dxgsg/dxTextureContext.cxx | 2608 +++---- panda/src/effects/lensFlareNode.cxx | 94 +- panda/src/effects/lensFlareNode.h | 28 +- panda/src/egg/eggAnimData.h | 2 +- panda/src/egg/eggAttributes.cxx | 6 +- panda/src/egg/eggAttributes.h | 2 +- panda/src/egg/eggBin.h | 2 +- panda/src/egg/eggBinMaker.cxx | 18 +- panda/src/egg/eggBinMaker.h | 8 +- panda/src/egg/eggComment.h | 2 +- panda/src/egg/eggCoordinateSystem.h | 2 +- panda/src/egg/eggCurve.h | 2 +- panda/src/egg/eggData.cxx | 4 +- panda/src/egg/eggData.h | 4 +- panda/src/egg/eggExternalReference.h | 2 +- panda/src/egg/eggFilenameNode.h | 2 +- panda/src/egg/eggGroup.I | 2 +- panda/src/egg/eggGroup.cxx | 22 +- panda/src/egg/eggGroup.h | 6 +- panda/src/egg/eggGroupNode.cxx | 194 +- panda/src/egg/eggGroupNode.h | 8 +- panda/src/egg/eggGroupUniquifier.h | 6 +- panda/src/egg/eggMaterial.cxx | 20 +- panda/src/egg/eggMaterial.h | 4 +- panda/src/egg/eggMaterialCollection.I | 2 +- panda/src/egg/eggMaterialCollection.cxx | 30 +- panda/src/egg/eggMaterialCollection.h | 4 +- panda/src/egg/eggMiscFuncs.cxx | 36 +- panda/src/egg/eggMiscFuncs.h | 4 +- panda/src/egg/eggMorph.h | 2 +- panda/src/egg/eggMorphList.h | 2 +- panda/src/egg/eggNameUniquifier.cxx | 6 +- panda/src/egg/eggNameUniquifier.h | 8 +- panda/src/egg/eggNamedObject.h | 6 +- panda/src/egg/eggNode.h | 6 +- panda/src/egg/eggNurbsCurve.cxx | 2 +- panda/src/egg/eggNurbsCurve.h | 2 +- panda/src/egg/eggNurbsSurface.cxx | 6 +- panda/src/egg/eggNurbsSurface.h | 4 +- panda/src/egg/eggObject.h | 4 +- panda/src/egg/eggParameters.h | 2 +- panda/src/egg/eggPoint.h | 2 +- panda/src/egg/eggPolygon.cxx | 158 +- panda/src/egg/eggPolygon.h | 2 +- panda/src/egg/eggPoolUniquifier.h | 4 +- panda/src/egg/eggPrimitive.cxx | 66 +- panda/src/egg/eggPrimitive.h | 8 +- panda/src/egg/eggRenderMode.h | 2 +- panda/src/egg/eggSAnimData.cxx | 6 +- panda/src/egg/eggSAnimData.h | 2 +- panda/src/egg/eggSurface.h | 2 +- panda/src/egg/eggSwitchCondition.cxx | 2 +- panda/src/egg/eggSwitchCondition.h | 10 +- panda/src/egg/eggTable.h | 2 +- panda/src/egg/eggTexture.I | 2 +- panda/src/egg/eggTexture.cxx | 30 +- panda/src/egg/eggTextureCollection.I | 2 +- panda/src/egg/eggTextureCollection.cxx | 30 +- panda/src/egg/eggTextureCollection.h | 4 +- panda/src/egg/eggUtilities.I | 36 +- panda/src/egg/eggVertex.cxx | 4 +- panda/src/egg/eggVertex.h | 6 +- panda/src/egg/eggVertexPool.cxx | 24 +- panda/src/egg/eggVertexPool.h | 4 +- panda/src/egg/eggXfmAnimData.cxx | 40 +- panda/src/egg/eggXfmAnimData.h | 6 +- panda/src/egg/eggXfmSAnim.cxx | 246 +- panda/src/egg/eggXfmSAnim.h | 16 +- panda/src/egg/lexer.lxx | 6 +- panda/src/egg/parser.yxx | 692 +- panda/src/egg/parserDefs.h | 2 +- panda/src/egg2sg/animBundleMaker.cxx | 96 +- panda/src/egg2sg/animBundleMaker.h | 8 +- panda/src/egg2sg/characterMaker.cxx | 30 +- panda/src/egg2sg/characterMaker.h | 6 +- panda/src/egg2sg/computedVerticesMaker.cxx | 94 +- panda/src/egg2sg/computedVerticesMaker.h | 12 +- .../src/egg2sg/computedVerticesMakerEntity.I | 2 +- .../src/egg2sg/computedVerticesMakerEntity.h | 8 +- panda/src/egg2sg/deferredArcProperty.h | 2 +- panda/src/egg2sg/deferredArcTraverser.cxx | 4 +- panda/src/egg2sg/deferredArcTraverser.h | 6 +- panda/src/egg2sg/eggBinner.h | 2 +- panda/src/egg2sg/eggLoader.cxx | 412 +- panda/src/egg2sg/eggLoader.h | 34 +- panda/src/egg2sg/loaderFileTypeEgg.h | 2 +- panda/src/egg2sg/test_loader.cxx | 30 +- panda/src/event/event.h | 4 +- panda/src/event/eventHandler.h | 8 +- panda/src/event/eventParameter.h | 6 +- panda/src/event/eventQueue.cxx | 10 +- panda/src/event/eventQueue.h | 2 +- panda/src/event/eventReceiver.h | 2 +- panda/src/event/throw_event.I | 34 +- panda/src/event/throw_event.h | 34 +- panda/src/express/bigEndian.h | 2 +- panda/src/express/checksumHashGenerator.h | 2 +- panda/src/express/config_express.cxx | 8 +- panda/src/express/crypto_utils.cxx | 2 +- panda/src/express/datagram.cxx | 12 +- panda/src/express/datagram.h | 4 +- panda/src/express/datagramGenerator.h | 2 +- panda/src/express/datagramInputFile.h | 2 +- panda/src/express/datagramIterator.I | 38 +- panda/src/express/datagramIterator.cxx | 6 +- panda/src/express/datagramIterator.h | 2 +- panda/src/express/datagramOutputFile.h | 2 +- panda/src/express/datagramSink.h | 2 +- panda/src/express/error_utils.cxx | 12 +- panda/src/express/get_config_path.cxx | 8 +- panda/src/express/hashGeneratorBase.h | 2 +- panda/src/express/hashVal.I | 6 +- panda/src/express/hashVal.h | 2 +- panda/src/express/indent.I | 14 +- panda/src/express/indent.h | 8 +- panda/src/express/littleEndian.h | 2 +- panda/src/express/memoryUsage.cxx | 56 +- panda/src/express/memoryUsage.h | 10 +- panda/src/express/memoryUsagePointers.cxx | 2 +- panda/src/express/memoryUsagePointers.h | 6 +- panda/src/express/multifile.cxx | 36 +- panda/src/express/namable.h | 4 +- panda/src/express/nativeNumericData.h | 2 +- panda/src/express/pointerTo.I | 20 +- panda/src/express/pointerTo.h | 6 +- panda/src/express/referenceCount.I | 12 +- panda/src/express/referenceCount.h | 6 +- panda/src/express/reversedNumericData.h | 2 +- panda/src/express/tokenBoard.I | 2 +- panda/src/express/trueClock.cxx | 2 +- panda/src/express/typeHandle.I | 26 +- panda/src/express/typeHandle.h | 40 +- panda/src/express/typedObject.h | 2 +- panda/src/express/typedReferenceCount.h | 6 +- panda/src/framework/framework.cxx | 526 +- panda/src/glgsg/glGraphicsStateGuardian.I | 98 +- panda/src/glgsg/glGraphicsStateGuardian.cxx | 204 +- panda/src/glgsg/glGraphicsStateGuardian.h | 28 +- panda/src/glgsg/glSavedFrameBuffer.h | 6 +- panda/src/glgsg/glTextureContext.h | 4 +- panda/src/glutdisplay/config_glutdisplay.cxx | 4 +- panda/src/glutdisplay/glutGraphicsPipe.cxx | 2 +- panda/src/glutdisplay/glutGraphicsWindow.cxx | 8 +- panda/src/glutdisplay/glutGraphicsWindow.h | 6 +- panda/src/glxdisplay/config_glxdisplay.cxx | 4 +- panda/src/glxdisplay/glxDisplay.cxx | 2 +- panda/src/glxdisplay/glxDisplay.h | 2 +- panda/src/glxdisplay/glxGraphicsPipe.cxx | 4 +- panda/src/glxdisplay/glxGraphicsPipe.h | 4 +- panda/src/glxdisplay/glxGraphicsWindow.cxx | 264 +- panda/src/glxdisplay/glxGraphicsWindow.h | 42 +- panda/src/gobj/LOD.cxx | 2 +- panda/src/gobj/LOD.h | 10 +- panda/src/gobj/drawable.h | 14 +- panda/src/gobj/fog.cxx | 6 +- panda/src/gobj/fog.h | 14 +- panda/src/gobj/geom.cxx | 90 +- panda/src/gobj/geom.h | 44 +- panda/src/gobj/geomPoint.h | 2 +- panda/src/gobj/geomPolygon.h | 2 +- panda/src/gobj/geomQuad.cxx | 4 +- panda/src/gobj/geomQuad.h | 2 +- panda/src/gobj/geomSprite.h | 4 +- panda/src/gobj/geomTri.cxx | 60 +- panda/src/gobj/geomTri.h | 2 +- panda/src/gobj/geomTrifan.cxx | 60 +- panda/src/gobj/geomTrifan.h | 2 +- panda/src/gobj/geomTristrip.cxx | 108 +- panda/src/gobj/geomTristrip.h | 2 +- panda/src/gobj/imageBuffer.cxx | 4 +- panda/src/gobj/imageBuffer.h | 8 +- panda/src/gobj/material.h | 2 +- panda/src/gobj/materialPool.cxx | 6 +- panda/src/gobj/orthoProjection.cxx | 4 +- panda/src/gobj/orthoProjection.h | 4 +- panda/src/gobj/perspectiveProjection.cxx | 20 +- panda/src/gobj/perspectiveProjection.h | 10 +- panda/src/gobj/pixelBuffer.I | 10 +- panda/src/gobj/pixelBuffer.cxx | 120 +- panda/src/gobj/projection.h | 10 +- panda/src/gobj/texture.h | 10 +- panda/src/gobj/texturePool.cxx | 6 +- panda/src/gobj/texturePool.h | 2 +- panda/src/graph/allAttributesWrapper.T | 2 +- panda/src/graph/allAttributesWrapper.cxx | 2 +- panda/src/graph/allAttributesWrapper.h | 6 +- panda/src/graph/allTransitionsWrapper.I | 6 +- panda/src/graph/allTransitionsWrapper.T | 2 +- panda/src/graph/allTransitionsWrapper.h | 8 +- panda/src/graph/arcChain.h | 2 +- panda/src/graph/bitMask32Transition.h | 2 +- panda/src/graph/bitMaskAttribute.h | 8 +- panda/src/graph/bitMaskTransition.h | 8 +- panda/src/graph/boundedObject.h | 2 +- panda/src/graph/dftraverser.T | 16 +- panda/src/graph/dftraverser.h | 14 +- panda/src/graph/graphReducer.cxx | 46 +- panda/src/graph/graphReducer.h | 6 +- panda/src/graph/immediateAttribute.h | 6 +- panda/src/graph/immediateTransition.h | 4 +- panda/src/graph/lmatrix4fTransition.h | 2 +- panda/src/graph/matrixAttribute.h | 8 +- panda/src/graph/matrixTransition.h | 8 +- panda/src/graph/multiAttribute.T | 6 +- panda/src/graph/multiAttribute.h | 10 +- panda/src/graph/multiNodeAttribute.h | 8 +- panda/src/graph/multiNodeTransition.h | 8 +- panda/src/graph/multiTransition.T | 56 +- panda/src/graph/multiTransition.h | 8 +- panda/src/graph/multiTransitionHelpers.I | 106 +- panda/src/graph/multiTransitionHelpers.h | 24 +- panda/src/graph/namedNode.h | 6 +- panda/src/graph/node.cxx | 54 +- panda/src/graph/node.h | 20 +- panda/src/graph/nodeAttribute.h | 4 +- panda/src/graph/nodeAttributeWrapper.h | 2 +- panda/src/graph/nodeAttributes.T | 2 +- panda/src/graph/nodeAttributes.cxx | 12 +- panda/src/graph/nodeAttributes.h | 4 +- panda/src/graph/nodeConnection.h | 2 +- panda/src/graph/nodeRelation.T | 2 +- panda/src/graph/nodeRelation.cxx | 38 +- panda/src/graph/nodeRelation.h | 8 +- panda/src/graph/nodeTransition.cxx | 2 +- panda/src/graph/nodeTransition.h | 10 +- panda/src/graph/nodeTransitionCache.cxx | 46 +- panda/src/graph/nodeTransitionCache.h | 12 +- panda/src/graph/nodeTransitionCacheEntry.I | 12 +- panda/src/graph/nodeTransitionCacheEntry.h | 12 +- panda/src/graph/nodeTransitionWrapper.I | 6 +- panda/src/graph/nodeTransitionWrapper.h | 6 +- panda/src/graph/nodeTransitions.I | 2 +- panda/src/graph/nodeTransitions.T | 2 +- panda/src/graph/nodeTransitions.cxx | 30 +- panda/src/graph/nodeTransitions.h | 6 +- panda/src/graph/nullAttributeWrapper.h | 2 +- panda/src/graph/nullLevelState.h | 2 +- panda/src/graph/nullTransitionWrapper.I | 4 +- panda/src/graph/nullTransitionWrapper.h | 6 +- panda/src/graph/onAttribute.h | 4 +- panda/src/graph/onOffAttribute.h | 4 +- panda/src/graph/onOffTransition.h | 4 +- panda/src/graph/onTransition.h | 4 +- panda/src/graph/pointerNameClass.h | 2 +- panda/src/graph/setTransitionHelpers.T | 268 +- panda/src/graph/setTransitionHelpers.h | 46 +- panda/src/graph/test_graph.cxx | 54 +- panda/src/graph/traverserVisitor.T | 20 +- panda/src/graph/traverserVisitor.h | 12 +- panda/src/graph/wrt.I | 304 +- panda/src/graph/wrt.h | 24 +- panda/src/grutil/lineSegs.I | 4 +- panda/src/grutil/lineSegs.cxx | 48 +- panda/src/grutil/lineSegs.h | 2 +- panda/src/gsgbase/graphicsStateGuardianBase.h | 16 +- panda/src/gsgmisc/geomIssuer.cxx | 10 +- panda/src/gsgmisc/geomIssuer.h | 20 +- panda/src/gui/guiBackground.cxx | 12 +- panda/src/gui/guiBackground.h | 2 +- panda/src/gui/guiBehavior.cxx | 2 +- panda/src/gui/guiBehavior.h | 4 +- panda/src/gui/guiButton.I | 8 +- panda/src/gui/guiButton.h | 6 +- panda/src/gui/guiChooser.cxx | 14 +- panda/src/gui/guiChooser.h | 4 +- panda/src/gui/guiCollection.cxx | 8 +- panda/src/gui/guiCollection.h | 2 +- panda/src/gui/guiFrame.cxx | 210 +- panda/src/gui/guiFrame.h | 12 +- panda/src/gui/guiItem.I | 6 +- panda/src/gui/guiItem.h | 2 +- panda/src/gui/guiLabel.I | 38 +- panda/src/gui/guiLabel.h | 4 +- panda/src/gui/guiListBox.cxx | 20 +- panda/src/gui/guiListBox.h | 4 +- panda/src/gui/guiManager.I | 4 +- panda/src/gui/guiRollover.cxx | 8 +- panda/src/gui/guiRollover.h | 2 +- panda/src/gui/guiSign.cxx | 4 +- panda/src/gui/guiSign.h | 2 +- panda/src/ipc/ipc_condition.h | 6 +- panda/src/ipc/ipc_mach_traits.h | 408 +- panda/src/ipc/ipc_nspr_traits.h | 86 +- panda/src/ipc/ipc_nt_traits.cxx | 8 +- panda/src/ipc/ipc_nt_traits.h | 788 +- panda/src/ipc/ipc_posix_traits.h | 480 +- panda/src/ipc/ipc_ps2_traits.h | 486 +- panda/src/ipc/ipc_semaphore.h | 4 +- panda/src/ipc/ipc_solaris_traits.h | 314 +- panda/src/ipc/ipc_thread.h | 216 +- panda/src/ipc/ipc_traits.cxx | 4 +- panda/src/ipc/loom.cxx | 24 +- panda/src/ipc/loom.h | 6 +- panda/src/ipc/loom_internal.h | 50 +- panda/src/ipc/loom_main.cxx | 56 +- panda/src/ipc/loom_test1.cxx | 54 +- panda/src/ipc/loom_test2.cxx | 2 +- panda/src/ipc/test_diners.cxx | 94 +- panda/src/ipc/test_file.cxx | 4 +- panda/src/ipc/test_priority.cxx | 6 +- panda/src/ipc/test_prodcons.cxx | 44 +- panda/src/ipc/test_threaddata.cxx | 22 +- panda/src/lerp/lerp.cxx | 30 +- panda/src/lerp/lerp.h | 6 +- panda/src/lerp/lerpblend.h | 10 +- panda/src/lerp/lerpchans.h | 2 +- panda/src/lerp/lerpfunctor.h | 8 +- panda/src/light/ambientLight.h | 2 +- panda/src/light/directionalLight.h | 4 +- panda/src/light/light.h | 22 +- panda/src/light/lightAttribute.cxx | 2 +- panda/src/light/lightAttribute.h | 6 +- panda/src/light/lightNameClass.h | 2 +- panda/src/light/lightTransition.cxx | 2 +- panda/src/light/lightTransition.h | 6 +- panda/src/light/pointLight.h | 4 +- panda/src/light/spotlight.cxx | 10 +- panda/src/light/spotlight.h | 12 +- panda/src/linmath/compose_matrix_src.I | 46 +- panda/src/linmath/compose_matrix_src.cxx | 168 +- panda/src/linmath/compose_matrix_src.h | 50 +- panda/src/linmath/ioPtaDatagramLinMath.h | 2 +- panda/src/linmath/lmatrix3_src.I | 92 +- panda/src/linmath/lmatrix3_src.cxx | 20 +- panda/src/linmath/lmatrix3_src.h | 24 +- panda/src/linmath/lmatrix4_src.I | 152 +- panda/src/linmath/lmatrix4_src.cxx | 68 +- panda/src/linmath/lmatrix4_src.h | 38 +- panda/src/linmath/lorientation_src.cxx | 2 +- panda/src/linmath/lpoint2_src.cxx | 2 +- panda/src/linmath/lpoint2_src.h | 2 +- panda/src/linmath/lpoint3_src.cxx | 2 +- panda/src/linmath/lpoint3_src.h | 8 +- panda/src/linmath/lpoint4_src.cxx | 2 +- panda/src/linmath/lpoint4_src.h | 2 +- panda/src/linmath/lquaternion_src.I | 10 +- panda/src/linmath/lquaternion_src.cxx | 2 +- panda/src/linmath/lrotation_src.cxx | 2 +- panda/src/linmath/lvecBase2_src.I | 12 +- panda/src/linmath/lvecBase2_src.h | 12 +- panda/src/linmath/lvecBase3_src.I | 28 +- panda/src/linmath/lvecBase3_src.h | 12 +- panda/src/linmath/lvecBase4_src.I | 36 +- panda/src/linmath/lvecBase4_src.h | 12 +- panda/src/linmath/lvector2_src.cxx | 2 +- panda/src/linmath/lvector2_src.h | 2 +- panda/src/linmath/lvector3_src.cxx | 2 +- panda/src/linmath/lvector3_src.h | 4 +- panda/src/linmath/lvector4_src.cxx | 2 +- panda/src/linmath/lvector4_src.h | 2 +- panda/src/linmath/test_math.cxx | 4 +- panda/src/loader/bamFile.h | 2 +- panda/src/loader/loader.cxx | 28 +- panda/src/loader/loader.h | 2 +- panda/src/loader/loaderFileType.h | 2 +- panda/src/loader/loaderFileTypeBam.cxx | 10 +- panda/src/loader/loaderFileTypeBam.h | 2 +- panda/src/loader/loaderFileTypeRegistry.cxx | 2 +- panda/src/loader/loaderFileTypeRegistry.h | 2 +- panda/src/loader/modelPool.cxx | 6 +- panda/src/mathutil/boundingHexahedron.cxx | 24 +- panda/src/mathutil/boundingHexahedron.h | 16 +- panda/src/mathutil/boundingLine.cxx | 4 +- panda/src/mathutil/boundingLine.h | 8 +- panda/src/mathutil/boundingSphere.cxx | 94 +- panda/src/mathutil/boundingSphere.h | 16 +- panda/src/mathutil/boundingVolume.cxx | 4 +- panda/src/mathutil/boundingVolume.h | 16 +- panda/src/mathutil/fftCompressor.cxx | 18 +- panda/src/mathutil/fftCompressor.h | 4 +- panda/src/mathutil/finiteBoundingVolume.h | 4 +- panda/src/mathutil/frustum_src.I | 40 +- panda/src/mathutil/frustum_src.h | 14 +- panda/src/mathutil/geometricBoundingVolume.I | 2 +- panda/src/mathutil/geometricBoundingVolume.h | 10 +- panda/src/mathutil/omniBoundingVolume.cxx | 8 +- panda/src/mathutil/omniBoundingVolume.h | 14 +- panda/src/mathutil/plane_src.I | 10 +- panda/src/mathutil/plane_src.h | 12 +- panda/src/mathutil/rotate_to_src.cxx | 4 +- panda/src/mpg123/genre.h | 514 +- panda/src/mpg123/l2tables.h | 258 +- panda/src/mpg123/mpg123.h | 28 +- panda/src/mpg123/mpgaudio.h | 10 +- panda/src/mpg123/xfermem.h | 18 +- panda/src/net/connection.cxx | 22 +- panda/src/net/connection.h | 2 +- panda/src/net/connectionListener.h | 6 +- panda/src/net/connectionManager.cxx | 6 +- panda/src/net/connectionManager.h | 6 +- panda/src/net/connectionReader.cxx | 164 +- panda/src/net/connectionReader.h | 4 +- panda/src/net/connectionWriter.cxx | 10 +- panda/src/net/connectionWriter.h | 8 +- panda/src/net/datagramQueue.h | 2 +- panda/src/net/datagramTCPHeader.cxx | 4 +- panda/src/net/datagramTCPHeader.h | 2 +- panda/src/net/datagramUDPHeader.cxx | 4 +- panda/src/net/datagramUDPHeader.h | 2 +- panda/src/net/datagram_ui.cxx | 78 +- panda/src/net/netAddress.cxx | 8 +- panda/src/net/netAddress.h | 2 +- panda/src/net/netDatagram.h | 4 +- panda/src/net/pprerror.cxx | 2 +- panda/src/net/queuedConnectionListener.cxx | 8 +- panda/src/net/queuedConnectionListener.h | 12 +- panda/src/net/queuedConnectionManager.h | 4 +- panda/src/net/queuedConnectionReader.h | 4 +- panda/src/net/queuedReturn.h | 2 +- panda/src/net/recentConnectionReader.h | 2 +- panda/src/net/test_spam_client.cxx | 16 +- panda/src/net/test_spam_server.cxx | 30 +- panda/src/net/test_tcp_client.cxx | 16 +- panda/src/net/test_tcp_server.cxx | 66 +- panda/src/net/test_udp.cxx | 16 +- panda/src/parametrics/classicNurbsCurve.cxx | 46 +- panda/src/parametrics/classicNurbsCurve.h | 16 +- panda/src/parametrics/cubicCurveseg.cxx | 26 +- panda/src/parametrics/cubicCurveseg.h | 16 +- panda/src/parametrics/curveFitter.cxx | 32 +- panda/src/parametrics/hermiteCurve.cxx | 28 +- panda/src/parametrics/hermiteCurve.h | 16 +- panda/src/parametrics/nurbsCurveDrawer.cxx | 12 +- panda/src/parametrics/nurbsCurveDrawer.h | 2 +- panda/src/parametrics/nurbsCurveInterface.cxx | 2 +- panda/src/parametrics/nurbsCurveInterface.h | 4 +- panda/src/parametrics/nurbsPPCurve.cxx | 14 +- panda/src/parametrics/nurbsPPCurve.h | 14 +- panda/src/parametrics/parametricCurve.cxx | 16 +- panda/src/parametrics/parametricCurve.h | 14 +- .../parametrics/parametricCurveCollection.cxx | 56 +- .../parametrics/parametricCurveCollection.h | 2 +- .../src/parametrics/parametricCurveDrawer.cxx | 44 +- panda/src/parametrics/parametricCurveDrawer.h | 4 +- panda/src/parametrics/piecewiseCurve.h | 6 +- panda/src/parametrics/test_parametrics.cxx | 4 +- .../particlesystem/geomParticleRenderer.cxx | 12 +- .../src/particlesystem/geomParticleRenderer.h | 4 +- .../particlesystem/lineParticleRenderer.cxx | 14 +- panda/src/particlesystem/particleSystem.I | 4 +- panda/src/particlesystem/particleSystem.cxx | 16 +- .../particlesystem/pointParticleRenderer.cxx | 30 +- .../particlesystem/pointParticleRenderer.h | 12 +- .../sparkleParticleRenderer.cxx | 20 +- .../particlesystem/sparkleParticleRenderer.h | 12 +- .../particlesystem/spriteParticleRenderer.cxx | 10 +- .../particlesystem/spriteParticleRenderer.h | 2 +- panda/src/physics/actorNode.cxx | 2 +- panda/src/physics/actorNode.h | 2 +- panda/src/physics/angularEulerIntegrator.cxx | 10 +- panda/src/physics/angularEulerIntegrator.h | 4 +- panda/src/physics/angularForce.h | 2 +- panda/src/physics/angularIntegrator.cxx | 2 +- panda/src/physics/angularIntegrator.h | 4 +- panda/src/physics/angularVectorForce.h | 2 +- panda/src/physics/baseForce.h | 2 +- panda/src/physics/baseIntegrator.cxx | 4 +- panda/src/physics/baseIntegrator.h | 4 +- panda/src/physics/forceNode.I | 2 +- panda/src/physics/forceNode.cxx | 2 +- panda/src/physics/forceNode.h | 2 +- .../src/physics/linearCylinderVortexForce.cxx | 2 +- panda/src/physics/linearCylinderVortexForce.h | 10 +- panda/src/physics/linearDistanceForce.h | 4 +- panda/src/physics/linearEulerIntegrator.cxx | 16 +- panda/src/physics/linearEulerIntegrator.h | 4 +- panda/src/physics/linearForce.h | 2 +- panda/src/physics/linearFrictionForce.h | 2 +- panda/src/physics/linearIntegrator.cxx | 2 +- panda/src/physics/linearIntegrator.h | 4 +- panda/src/physics/linearJitterForce.h | 2 +- panda/src/physics/linearNoiseForce.cxx | 8 +- panda/src/physics/linearNoiseForce.h | 2 +- panda/src/physics/linearRandomForce.h | 2 +- panda/src/physics/linearSinkForce.cxx | 4 +- panda/src/physics/linearSinkForce.h | 4 +- panda/src/physics/linearSourceForce.cxx | 4 +- panda/src/physics/linearSourceForce.h | 4 +- panda/src/physics/linearUserDefinedForce.cxx | 2 +- panda/src/physics/linearUserDefinedForce.h | 6 +- panda/src/physics/linearVectorForce.h | 4 +- panda/src/physics/physical.I | 6 +- panda/src/physics/physical.cxx | 4 +- panda/src/physics/physical.h | 2 +- panda/src/physics/physicalNode.I | 2 +- panda/src/physics/physicalNode.cxx | 2 +- panda/src/physics/physicalNode.h | 2 +- panda/src/physics/physicsObject.h | 2 +- panda/src/pnm/bitio.h | 9 +- panda/src/pnm/pbmfont.h | 22 +- panda/src/pnm/pbmplus.h | 6 +- panda/src/pnm/ppm.h | 6 +- panda/src/pnm/rast.h | 52 +- panda/src/pnmimage/pnm-image-filter-core.cxx | 14 +- panda/src/pnmimage/pnm-image-filter.cxx | 62 +- panda/src/pnmimage/pnmFileType.h | 4 +- panda/src/pnmimage/pnmFileTypeRegistry.cxx | 18 +- panda/src/pnmimage/pnmFileTypeRegistry.h | 2 +- panda/src/pnmimage/pnmImage.I | 20 +- panda/src/pnmimage/pnmImage.cxx | 38 +- panda/src/pnmimage/pnmImage.h | 16 +- panda/src/pnmimage/pnmImageHeader.cxx | 64 +- panda/src/pnmimage/pnmImageHeader.h | 18 +- panda/src/pnmimage/pnmReader.h | 2 +- panda/src/pnmimage/pnmReaderTypes.h | 8 +- panda/src/pnmimage/pnmWriter.h | 2 +- panda/src/pnmimagetypes/bmp.h | 183 +- panda/src/pnmimagetypes/color.h | 190 +- panda/src/pnmimagetypes/pnmFileTypeAlias.cxx | 16 +- panda/src/pnmimagetypes/pnmFileTypeAlias.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeBMP.h | 12 +- .../pnmimagetypes/pnmFileTypeBMPReader.cxx | 511 +- .../pnmimagetypes/pnmFileTypeBMPWriter.cxx | 87 +- panda/src/pnmimagetypes/pnmFileTypeIMG.cxx | 12 +- panda/src/pnmimagetypes/pnmFileTypeIMG.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeJPG.cxx | 2 +- panda/src/pnmimagetypes/pnmFileTypeJPG.h | 12 +- .../pnmimagetypes/pnmFileTypeJPGReader.cxx | 8 +- panda/src/pnmimagetypes/pnmFileTypePNM.cxx | 20 +- panda/src/pnmimagetypes/pnmFileTypePNM.h | 4 +- .../src/pnmimagetypes/pnmFileTypeRadiance.cxx | 4 +- panda/src/pnmimagetypes/pnmFileTypeRadiance.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeSGI.h | 4 +- .../pnmimagetypes/pnmFileTypeSGIReader.cxx | 74 +- .../pnmimagetypes/pnmFileTypeSGIWriter.cxx | 18 +- .../pnmimagetypes/pnmFileTypeSoftImage.cxx | 168 +- .../src/pnmimagetypes/pnmFileTypeSoftImage.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeTGA.cxx | 570 +- panda/src/pnmimagetypes/pnmFileTypeTGA.h | 6 +- panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx | 324 +- panda/src/pnmimagetypes/pnmFileTypeTIFF.h | 4 +- panda/src/pnmimagetypes/pnmFileTypeYUV.h | 4 +- panda/src/pnmimagetypes/resolu.h | 44 +- panda/src/pstatclient/pStatClient.cxx | 16 +- panda/src/pstatclient/pStatClient.h | 2 +- .../pstatclient/pStatClientControlMessage.cxx | 12 +- .../pstatclient/pStatClientControlMessage.h | 2 +- panda/src/pstatclient/pStatClientVersion.h | 2 +- panda/src/pstatclient/pStatCollector.h | 18 +- panda/src/pstatclient/pStatCollectorDef.h | 2 +- panda/src/pstatclient/pStatFrameData.h | 2 +- .../pstatclient/pStatServerControlMessage.h | 2 +- panda/src/pstatclient/pStatThread.h | 2 +- panda/src/pstatclient/pStatTimer.h | 2 +- panda/src/pstatclient/test_client.cxx | 6 +- panda/src/putil/bamReader.I | 4 +- panda/src/putil/bamReader.cxx | 64 +- panda/src/putil/bamReader.h | 4 +- panda/src/putil/bamReaderParam.h | 4 +- panda/src/putil/bamWriter.cxx | 4 +- panda/src/putil/bamWriter.h | 2 +- panda/src/putil/buttonEvent.I | 2 +- panda/src/putil/buttonEvent.h | 2 +- panda/src/putil/buttonHandle.h | 2 +- panda/src/putil/buttonRegistry.h | 4 +- panda/src/putil/configurable.h | 8 +- panda/src/putil/factory.I | 2 +- panda/src/putil/factory.h | 10 +- panda/src/putil/factoryBase.I | 2 +- panda/src/putil/factoryBase.cxx | 8 +- panda/src/putil/factoryBase.h | 14 +- panda/src/putil/factoryParam.h | 4 +- panda/src/putil/factoryParams.h | 2 +- panda/src/putil/globPattern.I | 2 +- panda/src/putil/globPattern.cxx | 46 +- panda/src/putil/globPattern.h | 12 +- panda/src/putil/globalPointerRegistry.cxx | 10 +- panda/src/putil/globalPointerRegistry.h | 2 +- panda/src/putil/indirectCompareNames.h | 2 +- panda/src/putil/indirectCompareTo.h | 2 +- panda/src/putil/ioPtaDatagramFloat.h | 2 +- panda/src/putil/ioPtaDatagramInt.h | 2 +- panda/src/putil/ioPtaDatagramShort.h | 2 +- panda/src/putil/iterator_types.h | 6 +- panda/src/putil/keyboardButton.h | 2 +- panda/src/putil/modifierButtons.I | 2 +- panda/src/putil/modifierButtons.h | 2 +- panda/src/putil/mouseButton.h | 2 +- panda/src/putil/nameUniquifier.cxx | 2 +- panda/src/putil/nameUniquifier.h | 4 +- panda/src/putil/pointerToArray.I | 6 +- panda/src/putil/pointerToArray.h | 4 +- panda/src/putil/string_utils.h | 2 +- panda/src/putil/test_bam.h | 10 +- panda/src/putil/test_filename.cxx | 16 +- panda/src/putil/test_glob.cxx | 4 +- panda/src/putil/test_linestream.cxx | 10 +- panda/src/putil/test_types.cxx | 8 +- panda/src/putil/timedCycle.I | 2 +- panda/src/putil/typedWritable.h | 8 +- panda/src/putil/typedWritableReferenceCount.h | 8 +- panda/src/putil/updateSeq.h | 2 +- panda/src/putil/writable.h | 2 +- panda/src/putil/writableConfigurable.h | 10 +- panda/src/putil/writableParam.h | 4 +- panda/src/ribdisplay/config_ribdisplay.cxx | 4 +- panda/src/ribdisplay/ribGraphicsPipe.cxx | 2 +- panda/src/ribdisplay/ribGraphicsPipe.h | 2 +- panda/src/ribdisplay/ribGraphicsWindow.cxx | 60 +- panda/src/ribdisplay/ribGraphicsWindow.h | 2 +- panda/src/ribgsg/config_ribgsg.cxx | 2 +- panda/src/ribgsg/ribGraphicsStateGuardian.cxx | 144 +- panda/src/ribgsg/ribGraphicsStateGuardian.h | 28 +- panda/src/ribgsg/ribStuffTraverser.cxx | 8 +- panda/src/ribgsg/ribStuffTraverser.h | 2 +- panda/src/sgattrib/alphaTransformAttribute.h | 4 +- panda/src/sgattrib/alphaTransformProperty.h | 2 +- panda/src/sgattrib/alphaTransformTransition.h | 4 +- panda/src/sgattrib/attribTraverser.cxx | 28 +- panda/src/sgattrib/attribTraverser.h | 4 +- panda/src/sgattrib/billboardTransition.h | 10 +- panda/src/sgattrib/clipPlaneAttribute.cxx | 2 +- panda/src/sgattrib/clipPlaneAttribute.h | 6 +- panda/src/sgattrib/clipPlaneTransition.cxx | 2 +- panda/src/sgattrib/clipPlaneTransition.h | 6 +- panda/src/sgattrib/colorAttribute.h | 4 +- panda/src/sgattrib/colorBlendAttribute.h | 4 +- panda/src/sgattrib/colorBlendProperty.h | 14 +- panda/src/sgattrib/colorBlendTransition.h | 4 +- panda/src/sgattrib/colorMaskAttribute.h | 4 +- panda/src/sgattrib/colorMaskProperty.h | 2 +- panda/src/sgattrib/colorMaskTransition.h | 4 +- panda/src/sgattrib/colorMatrixAttribute.h | 4 +- panda/src/sgattrib/colorMatrixTransition.h | 4 +- panda/src/sgattrib/colorProperty.h | 2 +- panda/src/sgattrib/colorTransition.h | 4 +- panda/src/sgattrib/cullFaceAttribute.h | 4 +- panda/src/sgattrib/cullFaceProperty.h | 8 +- panda/src/sgattrib/cullFaceTransition.h | 4 +- panda/src/sgattrib/decalAttribute.h | 4 +- panda/src/sgattrib/decalTransition.h | 4 +- panda/src/sgattrib/depthTestAttribute.h | 4 +- panda/src/sgattrib/depthTestProperty.cxx | 4 +- panda/src/sgattrib/depthTestProperty.h | 14 +- panda/src/sgattrib/depthTestTransition.h | 4 +- panda/src/sgattrib/depthWriteAttribute.h | 4 +- panda/src/sgattrib/depthWriteTransition.h | 4 +- panda/src/sgattrib/drawBoundsTransition.cxx | 6 +- panda/src/sgattrib/drawBoundsTransition.h | 10 +- panda/src/sgattrib/fogAttribute.h | 4 +- panda/src/sgattrib/fogTransition.h | 4 +- panda/src/sgattrib/linesmoothAttribute.h | 4 +- panda/src/sgattrib/linesmoothTransition.h | 4 +- panda/src/sgattrib/materialAttribute.h | 4 +- panda/src/sgattrib/materialTransition.h | 6 +- panda/src/sgattrib/pointShapeAttribute.h | 4 +- panda/src/sgattrib/pointShapeTransition.h | 4 +- panda/src/sgattrib/polygonOffsetAttribute.h | 4 +- panda/src/sgattrib/polygonOffsetProperty.h | 2 +- panda/src/sgattrib/polygonOffsetTransition.h | 4 +- panda/src/sgattrib/pruneTransition.cxx | 2 +- panda/src/sgattrib/pruneTransition.h | 10 +- panda/src/sgattrib/renderModeAttribute.h | 4 +- panda/src/sgattrib/renderModeProperty.h | 2 +- panda/src/sgattrib/renderModeTransition.h | 6 +- panda/src/sgattrib/renderRelation.cxx | 2 +- panda/src/sgattrib/renderRelation.h | 2 +- panda/src/sgattrib/showHideAttribute.cxx | 2 +- panda/src/sgattrib/showHideAttribute.h | 6 +- panda/src/sgattrib/showHideNameClass.h | 2 +- panda/src/sgattrib/showHideTransition.cxx | 2 +- panda/src/sgattrib/showHideTransition.h | 6 +- panda/src/sgattrib/stencilAttribute.h | 4 +- panda/src/sgattrib/stencilProperty.cxx | 4 +- panda/src/sgattrib/stencilProperty.h | 14 +- panda/src/sgattrib/stencilTransition.I | 2 +- panda/src/sgattrib/stencilTransition.h | 6 +- panda/src/sgattrib/test_attrib.cxx | 16 +- panda/src/sgattrib/texGenAttribute.h | 4 +- panda/src/sgattrib/texGenProperty.h | 2 +- panda/src/sgattrib/texGenTransition.h | 4 +- panda/src/sgattrib/texMatrixAttribute.h | 4 +- panda/src/sgattrib/texMatrixTransition.h | 4 +- panda/src/sgattrib/textureApplyAttribute.h | 4 +- panda/src/sgattrib/textureApplyProperty.h | 2 +- panda/src/sgattrib/textureApplyTransition.h | 4 +- panda/src/sgattrib/textureAttribute.h | 4 +- panda/src/sgattrib/textureTransition.h | 6 +- panda/src/sgattrib/transformAttribute.h | 4 +- panda/src/sgattrib/transformTransition.h | 4 +- panda/src/sgattrib/transparencyAttribute.h | 4 +- panda/src/sgattrib/transparencyProperty.h | 14 +- panda/src/sgattrib/transparencyTransition.h | 4 +- panda/src/sgidisplay/sgiGraphicsPipe.cxx | 30 +- panda/src/sgidisplay/sgiGraphicsPipe.h | 6 +- panda/src/sgidisplay/sgiHardwareChannel.cxx | 14 +- panda/src/sgidisplay/sgiHardwareChannel.h | 4 +- .../sgiglutdisplay/config_sgiglutdisplay.cxx | 2 +- .../sgiglutdisplay/sgiglutGraphicsPipe.cxx | 2 +- .../src/sgiglutdisplay/sgiglutGraphicsPipe.h | 4 +- .../sgiglxdisplay/config_sgiglxdisplay.cxx | 2 +- .../src/sgiglxdisplay/sgiglxGraphicsPipe.cxx | 4 +- panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h | 4 +- panda/src/sgmanip/findApproxLevel.cxx | 8 +- panda/src/sgmanip/findApproxLevel.h | 8 +- panda/src/sgmanip/findApproxPath.cxx | 6 +- panda/src/sgmanip/nodePath.I | 18 +- panda/src/sgmanip/nodePath.cxx | 110 +- panda/src/sgmanip/nodePath.h | 78 +- panda/src/sgmanip/nodePathBase.h | 2 +- panda/src/sgmanip/nodePathCollection.cxx | 6 +- panda/src/sgmanip/nodePathLerps.cxx | 2 +- panda/src/sgmanip/nodePathLerps.h | 76 +- panda/src/sgraph/camera.h | 2 +- panda/src/sgraph/geomNode.h | 4 +- panda/src/sgraph/geomTransformer.cxx | 34 +- panda/src/sgraph/geomTransformer.h | 2 +- panda/src/sgraph/planeNode.h | 2 +- panda/src/sgraph/projectionNode.cxx | 10 +- panda/src/sgraph/projectionNode.h | 8 +- panda/src/sgraph/renderTraverser.I | 2 +- panda/src/sgraph/renderTraverser.h | 8 +- panda/src/sgraph/switchNode.h | 2 +- panda/src/sgraphutil/appTraverser.cxx | 2 +- panda/src/sgraphutil/appTraverser.h | 2 +- .../src/sgraphutil/directRenderTraverser.cxx | 52 +- panda/src/sgraphutil/directRenderTraverser.h | 16 +- panda/src/sgraphutil/frustumCullTraverser.I | 190 +- panda/src/sgraphutil/frustumCullTraverser.h | 38 +- panda/src/sgraphutil/get_rel_pos.I | 16 +- panda/src/sgraphutil/get_rel_pos.cxx | 10 +- panda/src/sgraphutil/get_rel_pos.h | 24 +- panda/src/sgraphutil/sceneGraphAnalyzer.cxx | 34 +- panda/src/sgraphutil/sceneGraphAnalyzer.h | 2 +- panda/src/sgraphutil/sceneGraphReducer.cxx | 40 +- panda/src/sgraphutil/sceneGraphReducer.h | 6 +- panda/src/shader/casterShader.h | 4 +- panda/src/shader/outlineShader.h | 6 +- panda/src/shader/planarReflector.cxx | 26 +- panda/src/shader/planarReflector.h | 24 +- panda/src/shader/projtexShader.cxx | 2 +- panda/src/shader/projtexShader.h | 8 +- panda/src/shader/projtexShadower.cxx | 4 +- panda/src/shader/projtexShadower.h | 18 +- panda/src/shader/shader.h | 20 +- panda/src/shader/shaderTransition.cxx | 4 +- panda/src/shader/shaderTransition.h | 10 +- panda/src/shader/spheretexHighlighter.cxx | 22 +- panda/src/shader/spheretexHighlighter.h | 16 +- panda/src/shader/spheretexReflector.cxx | 2 +- panda/src/shader/spheretexReflector.h | 20 +- panda/src/shader/spheretexShader.h | 12 +- panda/src/shader/spotlightShader.h | 2 +- panda/src/switchnode/LODNode.I | 2 +- panda/src/switchnode/LODNode.h | 2 +- panda/src/switchnode/sequenceNode.h | 2 +- panda/src/switchnode/switchNodeOne.I | 2 +- panda/src/switchnode/switchNodeOne.h | 2 +- panda/src/testbed/deadrec_rec.cxx | 234 +- panda/src/testbed/deadrec_send.cxx | 66 +- panda/src/testbed/demo.cxx | 44 +- panda/src/testbed/gui_demo.cxx | 80 +- panda/src/testbed/herc.cxx | 32 +- panda/src/testbed/indirect.cxx | 78 +- panda/src/testbed/min_herc.cxx | 32 +- panda/src/testbed/min_shader.cxx | 16 +- panda/src/testbed/panda.cxx | 28 +- panda/src/testbed/shader_test.cxx | 18 +- panda/src/testbed/test_eggWrite.cxx | 14 +- panda/src/testbed/test_recparticles.cxx | 2 +- panda/src/testbed/text_test.cxx | 8 +- panda/src/text/textFont.cxx | 26 +- panda/src/text/textFont.h | 4 +- panda/src/text/textNode.I | 12 +- panda/src/text/textNode.cxx | 88 +- panda/src/text/textNode.h | 14 +- panda/src/tform/buttonThrower.cxx | 34 +- panda/src/tform/dataValve.cxx | 44 +- panda/src/tform/driveInterface.cxx | 58 +- panda/src/tform/mouseWatcher.cxx | 84 +- panda/src/tform/mouseWatcher.h | 4 +- panda/src/tform/mouseWatcherRegion.I | 2 +- panda/src/tform/mouseWatcherRegion.h | 6 +- panda/src/tform/planarSlider.cxx | 16 +- panda/src/tform/trackball.cxx | 10 +- panda/src/tform/transform2sg.cxx | 4 +- panda/src/tiff/g3states.h | 98 +- panda/src/tiff/t4.h | 458 +- panda/src/tiff/tif_fax3.h | 56 +- panda/src/tiff/tiff.h | 382 +- panda/src/tiff/tiffcomp.h | 24 +- panda/src/tiff/tiffconf.h | 56 +- panda/src/tiff/tiffio.h | 214 +- panda/src/tiff/tiffiop.h | 546 +- panda/src/vrpn/vrpnAnalog.cxx | 8 +- panda/src/vrpn/vrpnAnalogDevice.cxx | 2 +- panda/src/vrpn/vrpnAnalogDevice.h | 2 +- panda/src/vrpn/vrpnButtonDevice.cxx | 2 +- panda/src/vrpn/vrpnButtonDevice.h | 2 +- panda/src/vrpn/vrpnClient.I | 4 +- panda/src/vrpn/vrpnClient.cxx | 2 +- panda/src/vrpn/vrpnClient.h | 6 +- panda/src/vrpn/vrpnDialDevice.cxx | 2 +- panda/src/vrpn/vrpnDialDevice.h | 2 +- panda/src/vrpn/vrpnTracker.cxx | 10 +- panda/src/vrpn/vrpnTrackerDevice.cxx | 4 +- panda/src/vrpn/vrpnTrackerDevice.h | 4 +- panda/src/wdxdisplay/config_wdxdisplay.cxx | 8 +- panda/src/wdxdisplay/wdxGraphicsPipe.cxx | 3022 ++++---- panda/src/wdxdisplay/wdxGraphicsPipe.h | 6 +- panda/src/wdxdisplay/wdxGraphicsWindow.cxx | 1952 ++--- panda/src/wdxdisplay/wdxGraphicsWindow.h | 26 +- panda/src/wgldisplay/config_wgldisplay.cxx | 8 +- panda/src/wgldisplay/wglGraphicsPipe.cxx | 164 +- panda/src/wgldisplay/wglGraphicsPipe.h | 8 +- panda/src/wgldisplay/wglGraphicsWindow.cxx | 22 +- panda/src/wgldisplay/wglGraphicsWindow.h | 32 +- pandatool/src/bam/bamInfo.h | 2 +- pandatool/src/bam/eggToBam.h | 2 +- pandatool/src/converter/distanceUnit.cxx | 8 +- pandatool/src/converter/distanceUnit.h | 2 +- .../src/converter/somethingToEggConverter.I | 10 +- .../src/converter/somethingToEggConverter.cxx | 8 +- .../src/converter/somethingToEggConverter.h | 22 +- pandatool/src/cvscopy/cvsCopy.cxx | 8 +- pandatool/src/cvscopy/cvsCopy.h | 12 +- pandatool/src/cvscopy/cvsSourceDirectory.cxx | 6 +- pandatool/src/cvscopy/cvsSourceDirectory.h | 4 +- pandatool/src/cvscopy/cvsSourceTree.cxx | 40 +- pandatool/src/cvscopy/cvsSourceTree.h | 14 +- pandatool/src/cvscopy/testCopy.cxx | 2 +- pandatool/src/cvscopy/testCopy.h | 6 +- pandatool/src/egg-mkfont/charBitmap.cxx | 18 +- pandatool/src/egg-mkfont/charBitmap.h | 6 +- pandatool/src/egg-mkfont/charLayout.cxx | 4 +- pandatool/src/egg-mkfont/charLayout.h | 4 +- pandatool/src/egg-mkfont/charPlacement.I | 2 +- pandatool/src/egg-mkfont/charPlacement.cxx | 2 +- pandatool/src/egg-mkfont/charPlacement.h | 4 +- pandatool/src/egg-mkfont/eggMakeFont.cxx | 58 +- pandatool/src/egg-mkfont/eggMakeFont.h | 2 +- pandatool/src/egg-mkfont/fontFile.h | 4 +- pandatool/src/egg-mkfont/pkFontFile.cxx | 90 +- pandatool/src/egg-mkfont/pkFontFile.h | 4 +- .../src/egg-palettize/destTextureImage.cxx | 4 +- .../src/egg-palettize/destTextureImage.h | 4 +- pandatool/src/egg-palettize/eggFile.cxx | 36 +- pandatool/src/egg-palettize/eggFile.h | 12 +- pandatool/src/egg-palettize/eggPalettize.cxx | 344 +- pandatool/src/egg-palettize/eggPalettize.h | 2 +- pandatool/src/egg-palettize/filenameUnifier.h | 2 +- pandatool/src/egg-palettize/imageFile.cxx | 18 +- pandatool/src/egg-palettize/imageFile.h | 4 +- pandatool/src/egg-palettize/omitReason.h | 2 +- .../src/egg-palettize/pal_string_utils.cxx | 2 +- .../src/egg-palettize/pal_string_utils.h | 2 +- pandatool/src/egg-palettize/paletteGroup.cxx | 24 +- pandatool/src/egg-palettize/paletteGroup.h | 8 +- pandatool/src/egg-palettize/paletteGroups.cxx | 4 +- pandatool/src/egg-palettize/paletteGroups.h | 6 +- pandatool/src/egg-palettize/paletteImage.cxx | 38 +- pandatool/src/egg-palettize/paletteImage.h | 6 +- pandatool/src/egg-palettize/palettePage.h | 8 +- pandatool/src/egg-palettize/palettizer.cxx | 42 +- pandatool/src/egg-palettize/palettizer.h | 8 +- .../src/egg-palettize/sourceTextureImage.cxx | 2 +- .../src/egg-palettize/sourceTextureImage.h | 8 +- pandatool/src/egg-palettize/textureImage.cxx | 150 +- pandatool/src/egg-palettize/textureImage.h | 14 +- .../egg-palettize/textureMemoryCounter.cxx | 10 +- .../src/egg-palettize/textureMemoryCounter.h | 4 +- .../src/egg-palettize/texturePlacement.cxx | 100 +- .../src/egg-palettize/texturePlacement.h | 6 +- pandatool/src/egg-palettize/texturePosition.h | 4 +- .../src/egg-palettize/textureProperties.cxx | 12 +- .../src/egg-palettize/textureProperties.h | 12 +- .../src/egg-palettize/textureReference.cxx | 136 +- .../src/egg-palettize/textureReference.h | 14 +- pandatool/src/egg-palettize/textureRequest.h | 2 +- pandatool/src/egg-palettize/txaFile.cxx | 62 +- pandatool/src/egg-palettize/txaFile.h | 2 +- pandatool/src/egg-palettize/txaLine.cxx | 192 +- pandatool/src/egg-palettize/txaLine.h | 2 +- pandatool/src/eggbase/eggBase.cxx | 2 +- pandatool/src/eggbase/eggBase.h | 2 +- pandatool/src/eggbase/eggConverter.cxx | 6 +- pandatool/src/eggbase/eggConverter.h | 8 +- pandatool/src/eggbase/eggFilter.h | 2 +- pandatool/src/eggbase/eggMultiBase.cxx | 2 +- pandatool/src/eggbase/eggMultiBase.h | 2 +- pandatool/src/eggbase/eggMultiFilter.cxx | 22 +- pandatool/src/eggbase/eggMultiFilter.h | 2 +- pandatool/src/eggbase/eggReader.cxx | 2 +- pandatool/src/eggbase/eggReader.h | 2 +- pandatool/src/eggbase/eggToSomething.cxx | 36 +- pandatool/src/eggbase/eggToSomething.h | 8 +- pandatool/src/eggbase/eggWriter.cxx | 34 +- pandatool/src/eggbase/eggWriter.h | 2 +- pandatool/src/eggbase/somethingToEgg.cxx | 16 +- pandatool/src/eggbase/somethingToEgg.h | 8 +- pandatool/src/eggcharbase/eggBackPointer.h | 4 +- .../src/eggcharbase/eggCharacterCollection.I | 2 +- .../eggcharbase/eggCharacterCollection.cxx | 186 +- .../src/eggcharbase/eggCharacterCollection.h | 16 +- pandatool/src/eggcharbase/eggCharacterData.I | 8 + .../src/eggcharbase/eggCharacterData.cxx | 8 +- pandatool/src/eggcharbase/eggCharacterData.h | 5 +- .../src/eggcharbase/eggCharacterFilter.cxx | 2 +- .../src/eggcharbase/eggCharacterFilter.h | 2 +- .../src/eggcharbase/eggComponentData.cxx | 2 +- pandatool/src/eggcharbase/eggComponentData.h | 4 +- pandatool/src/eggcharbase/eggJointData.cxx | 4 +- pandatool/src/eggcharbase/eggJointData.h | 4 +- .../src/eggcharbase/eggJointNodePointer.h | 4 +- pandatool/src/eggcharbase/eggJointPointer.h | 4 +- .../src/eggcharbase/eggMatrixTablePointer.cxx | 24 +- .../src/eggcharbase/eggMatrixTablePointer.h | 4 +- pandatool/src/eggcharbase/eggSliderData.cxx | 2 +- pandatool/src/eggcharbase/eggSliderData.h | 4 +- pandatool/src/eggcharbase/eggVertexPointer.h | 4 +- pandatool/src/eggprogs/eggTextureCards.h | 2 +- pandatool/src/eggprogs/eggTopstrip.cxx | 110 +- pandatool/src/eggprogs/eggTopstrip.h | 6 +- pandatool/src/eggprogs/eggTrans.h | 2 +- pandatool/src/flt/fltBead.cxx | 2 +- pandatool/src/flt/fltBead.h | 4 +- pandatool/src/flt/fltBeadID.h | 4 +- pandatool/src/flt/fltCurve.h | 4 +- pandatool/src/flt/fltExternalReference.h | 4 +- pandatool/src/flt/fltEyepoint.h | 2 +- pandatool/src/flt/fltFace.h | 4 +- pandatool/src/flt/fltGeometry.I | 2 +- pandatool/src/flt/fltGeometry.cxx | 14 +- pandatool/src/flt/fltGeometry.h | 4 +- pandatool/src/flt/fltGroup.h | 4 +- pandatool/src/flt/fltHeader.cxx | 64 +- pandatool/src/flt/fltHeader.h | 10 +- pandatool/src/flt/fltInstanceDefinition.h | 4 +- pandatool/src/flt/fltInstanceRef.h | 4 +- pandatool/src/flt/fltLOD.h | 4 +- pandatool/src/flt/fltLightSourceDefinition.h | 4 +- pandatool/src/flt/fltLocalVertexPool.cxx | 38 +- pandatool/src/flt/fltLocalVertexPool.h | 4 +- pandatool/src/flt/fltMaterial.h | 4 +- pandatool/src/flt/fltMesh.h | 4 +- pandatool/src/flt/fltMeshPrimitive.cxx | 2 +- pandatool/src/flt/fltMeshPrimitive.h | 4 +- pandatool/src/flt/fltObject.h | 4 +- pandatool/src/flt/fltPackedColor.h | 2 +- pandatool/src/flt/fltRecord.cxx | 82 +- pandatool/src/flt/fltRecord.h | 4 +- pandatool/src/flt/fltRecordReader.cxx | 2 +- pandatool/src/flt/fltRecordReader.h | 2 +- pandatool/src/flt/fltRecordWriter.cxx | 4 +- pandatool/src/flt/fltRecordWriter.h | 4 +- pandatool/src/flt/fltTexture.cxx | 26 +- pandatool/src/flt/fltTexture.h | 4 +- pandatool/src/flt/fltTrackplane.h | 2 +- pandatool/src/flt/fltTransformGeneralMatrix.h | 4 +- pandatool/src/flt/fltTransformPut.h | 14 +- pandatool/src/flt/fltTransformRecord.h | 4 +- .../src/flt/fltTransformRotateAboutEdge.h | 4 +- .../src/flt/fltTransformRotateAboutPoint.h | 4 +- pandatool/src/flt/fltTransformRotateScale.h | 6 +- pandatool/src/flt/fltTransformScale.h | 4 +- pandatool/src/flt/fltTransformTranslate.h | 4 +- pandatool/src/flt/fltUnsupportedRecord.h | 4 +- pandatool/src/flt/fltVertex.I | 2 +- pandatool/src/flt/fltVertex.cxx | 4 +- pandatool/src/flt/fltVertex.h | 4 +- pandatool/src/flt/fltVertexList.h | 4 +- pandatool/src/fltegg/fltToEggConverter.cxx | 38 +- pandatool/src/fltegg/fltToEggConverter.h | 10 +- pandatool/src/fltegg/fltToEggLevelState.cxx | 16 +- pandatool/src/fltegg/fltToEggLevelState.h | 6 +- pandatool/src/fltprogs/fltCopy.cxx | 22 +- pandatool/src/fltprogs/fltCopy.h | 12 +- pandatool/src/fltprogs/fltToEgg.h | 2 +- pandatool/src/fltprogs/fltTrans.cxx | 8 +- pandatool/src/fltprogs/fltTrans.h | 2 +- pandatool/src/gtk-stats/gtkStats.h | 2 +- .../src/gtk-stats/gtkStatsBadVersionWindow.h | 2 +- pandatool/src/gtk-stats/gtkStatsGuide.cxx | 2 +- pandatool/src/gtk-stats/gtkStatsGuide.h | 2 +- pandatool/src/gtk-stats/gtkStatsLabel.cxx | 6 +- pandatool/src/gtk-stats/gtkStatsLabel.h | 4 +- pandatool/src/gtk-stats/gtkStatsMainWindow.h | 2 +- pandatool/src/gtk-stats/gtkStatsMonitor.h | 2 +- pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx | 16 +- pandatool/src/gtk-stats/gtkStatsPianoRoll.h | 4 +- .../src/gtk-stats/gtkStatsPianoWindow.cxx | 24 +- pandatool/src/gtk-stats/gtkStatsPianoWindow.h | 4 +- pandatool/src/gtk-stats/gtkStatsServer.h | 2 +- .../src/gtk-stats/gtkStatsStripChart.cxx | 20 +- pandatool/src/gtk-stats/gtkStatsStripChart.h | 6 +- .../src/gtk-stats/gtkStatsStripWindow.cxx | 24 +- pandatool/src/gtk-stats/gtkStatsStripWindow.h | 4 +- pandatool/src/gtk-stats/gtkStatsWindow.cxx | 12 +- pandatool/src/gtk-stats/gtkStatsWindow.h | 2 +- pandatool/src/gtkbase/basicGtkDialog.h | 2 +- pandatool/src/gtkbase/basicGtkWindow.cxx | 4 +- pandatool/src/gtkbase/basicGtkWindow.h | 2 +- pandatool/src/gtkbase/gtkBase.h | 2 +- pandatool/src/imagebase/imageBase.h | 2 +- pandatool/src/imagebase/imageFilter.cxx | 2 +- pandatool/src/imagebase/imageFilter.h | 2 +- pandatool/src/imagebase/imageReader.h | 2 +- pandatool/src/imagebase/imageWriter.cxx | 2 +- pandatool/src/imagebase/imageWriter.h | 2 +- pandatool/src/imageprogs/imageTrans.h | 2 +- pandatool/src/lwo/iffChunk.h | 4 +- pandatool/src/lwo/iffGenericChunk.h | 4 +- pandatool/src/lwo/iffId.cxx | 2 +- pandatool/src/lwo/iffId.h | 2 +- pandatool/src/lwo/iffInputFile.cxx | 52 +- pandatool/src/lwo/iffInputFile.h | 4 +- pandatool/src/lwo/lwoBoundingBox.h | 4 +- pandatool/src/lwo/lwoChunk.h | 4 +- pandatool/src/lwo/lwoClip.h | 4 +- .../src/lwo/lwoDiscontinuousVertexMap.cxx | 20 +- pandatool/src/lwo/lwoDiscontinuousVertexMap.h | 4 +- pandatool/src/lwo/lwoGroupChunk.h | 4 +- pandatool/src/lwo/lwoHeader.h | 4 +- pandatool/src/lwo/lwoInputFile.cxx | 2 +- pandatool/src/lwo/lwoInputFile.h | 4 +- pandatool/src/lwo/lwoLayer.h | 4 +- pandatool/src/lwo/lwoPoints.h | 4 +- pandatool/src/lwo/lwoPolygonTags.h | 4 +- pandatool/src/lwo/lwoPolygons.cxx | 32 +- pandatool/src/lwo/lwoPolygons.h | 4 +- pandatool/src/lwo/lwoStillImage.h | 4 +- pandatool/src/lwo/lwoSurface.cxx | 20 +- pandatool/src/lwo/lwoSurface.h | 4 +- pandatool/src/lwo/lwoSurfaceBlock.cxx | 2 +- pandatool/src/lwo/lwoSurfaceBlock.h | 2 +- pandatool/src/lwo/lwoSurfaceBlockAxis.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockChannel.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockCoordSys.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockEnabled.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockHeader.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockImage.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockOpacity.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockProjection.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockRefObj.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockRepeat.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockTMap.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockTransform.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockVMapName.h | 4 +- pandatool/src/lwo/lwoSurfaceBlockWrap.h | 4 +- pandatool/src/lwo/lwoSurfaceColor.h | 4 +- pandatool/src/lwo/lwoSurfaceParameter.h | 4 +- pandatool/src/lwo/lwoSurfaceSidedness.h | 4 +- pandatool/src/lwo/lwoSurfaceSmoothingAngle.h | 4 +- pandatool/src/lwo/lwoTags.h | 4 +- pandatool/src/lwo/lwoVertexMap.h | 4 +- pandatool/src/lwoegg/cLwoClip.h | 2 +- pandatool/src/lwoegg/cLwoLayer.cxx | 2 +- pandatool/src/lwoegg/cLwoLayer.h | 2 +- pandatool/src/lwoegg/cLwoPoints.I | 2 +- pandatool/src/lwoegg/cLwoPoints.cxx | 4 +- pandatool/src/lwoegg/cLwoPoints.h | 4 +- pandatool/src/lwoegg/cLwoPolygons.I | 2 +- pandatool/src/lwoegg/cLwoPolygons.cxx | 56 +- pandatool/src/lwoegg/cLwoPolygons.h | 6 +- pandatool/src/lwoegg/cLwoSurface.I | 2 +- pandatool/src/lwoegg/cLwoSurface.cxx | 72 +- pandatool/src/lwoegg/cLwoSurface.h | 6 +- pandatool/src/lwoegg/cLwoSurfaceBlock.cxx | 20 +- pandatool/src/lwoegg/cLwoSurfaceBlock.h | 2 +- pandatool/src/lwoegg/cLwoSurfaceBlockTMap.cxx | 12 +- pandatool/src/lwoegg/cLwoSurfaceBlockTMap.h | 2 +- pandatool/src/lwoegg/lwoToEggConverter.cxx | 48 +- pandatool/src/lwoegg/lwoToEggConverter.h | 2 +- pandatool/src/lwoprogs/lwoScan.h | 2 +- pandatool/src/lwoprogs/lwoToEgg.h | 2 +- pandatool/src/maya/mayaFile.cxx | 224 +- pandatool/src/maya/mayaFile.h | 14 +- pandatool/src/maya/mayaShader.cxx | 36 +- pandatool/src/maya/mayaToEgg.h | 2 +- pandatool/src/maya/maya_funcs.I | 6 +- pandatool/src/maya/maya_funcs.cxx | 32 +- pandatool/src/maya/maya_funcs.h | 12 +- pandatool/src/progbase/programBase.cxx | 130 +- pandatool/src/progbase/programBase.h | 22 +- pandatool/src/progbase/withOutputFile.cxx | 24 +- pandatool/src/progbase/withOutputFile.h | 4 +- pandatool/src/pstatserver/pStatClientData.cxx | 8 +- pandatool/src/pstatserver/pStatClientData.h | 4 +- pandatool/src/pstatserver/pStatGraph.h | 2 +- pandatool/src/pstatserver/pStatListener.cxx | 4 +- pandatool/src/pstatserver/pStatListener.h | 6 +- pandatool/src/pstatserver/pStatMonitor.h | 2 +- pandatool/src/pstatserver/pStatPianoRoll.cxx | 12 +- pandatool/src/pstatserver/pStatPianoRoll.h | 4 +- pandatool/src/pstatserver/pStatReader.cxx | 12 +- pandatool/src/pstatserver/pStatReader.h | 2 +- pandatool/src/pstatserver/pStatServer.h | 2 +- pandatool/src/pstatserver/pStatStripChart.cxx | 42 +- pandatool/src/pstatserver/pStatStripChart.h | 4 +- pandatool/src/pstatserver/pStatThreadData.cxx | 26 +- pandatool/src/pstatserver/pStatThreadData.h | 2 +- pandatool/src/pstatserver/pStatView.cxx | 38 +- pandatool/src/pstatserver/pStatView.h | 2 +- pandatool/src/pstatserver/pStatViewLevel.h | 2 +- .../src/ptloader/loaderFileTypePandatool.h | 2 +- pandatool/src/softprogs/softCVS.cxx | 76 +- pandatool/src/softprogs/softCVS.h | 4 +- pandatool/src/softprogs/softFilename.cxx | 14 +- pandatool/src/softprogs/softFilename.h | 2 +- pandatool/src/text-stats/textMonitor.cxx | 10 +- pandatool/src/text-stats/textMonitor.h | 2 +- pandatool/src/text-stats/textStats.h | 2 +- 1484 files changed, 24983 insertions(+), 24954 deletions(-) diff --git a/direct/src/dcparser/dcAtomicField.cxx b/direct/src/dcparser/dcAtomicField.cxx index 49f8e8e1b2..1991ff4175 100644 --- a/direct/src/dcparser/dcAtomicField.cxx +++ b/direct/src/dcparser/dcAtomicField.cxx @@ -158,9 +158,9 @@ end_array() { // prepend the array length. int length = _default_value.length(); _default_value = - string(1, (char)(length & 0xff)) + - string(1, (char)((length >> 8) & 0xff)) + - _default_value; + string(1, (char)(length & 0xff)) + + string(1, (char)((length >> 8) & 0xff)) + + _default_value; } return true; @@ -242,7 +242,7 @@ format_default_value(double num, string &formatted) const { int length = str.length(); for (size_t i = 0; i < 8; i++) { - str += formatted[length - 1 - i]; + str += formatted[length - 1 - i]; } formatted = str; } @@ -277,9 +277,9 @@ format_default_value(const string &str, string &formatted) const { { int length = str.length(); formatted = - string(1, (char)(length & 0xff)) + - string(1, (char)((length >> 8) & 0xff)) + - str; + string(1, (char)(length & 0xff)) + + string(1, (char)((length >> 8) & 0xff)) + + str; } break; diff --git a/direct/src/dcparser/dcAtomicField.h b/direct/src/dcparser/dcAtomicField.h index 4d79a7e257..c969f54970 100644 --- a/direct/src/dcparser/dcAtomicField.h +++ b/direct/src/dcparser/dcAtomicField.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DCAtomicField +// Class : DCAtomicField // Description : A single atomic field of a Distributed Class, as read // from a .dc file. This defines an interface to the // Distributed Class, and is always implemented as a diff --git a/direct/src/dcparser/dcClass.h b/direct/src/dcparser/dcClass.h index 9962ef63d4..53a5c1d157 100644 --- a/direct/src/dcparser/dcClass.h +++ b/direct/src/dcparser/dcClass.h @@ -15,7 +15,7 @@ class HashGenerator; //////////////////////////////////////////////////////////////////// -// Class : DCClass +// Class : DCClass // Description : Defines a particular DistributedClass as read from an // input .dc file. //////////////////////////////////////////////////////////////////// diff --git a/direct/src/dcparser/dcField.h b/direct/src/dcparser/dcField.h index 2c55a0c2f4..65f165c943 100644 --- a/direct/src/dcparser/dcField.h +++ b/direct/src/dcparser/dcField.h @@ -13,7 +13,7 @@ class DCMolecularField; class HashGenerator; //////////////////////////////////////////////////////////////////// -// Class : DCField +// Class : DCField // Description : A single field of a Distributed Class, either atomic // or molecular. //////////////////////////////////////////////////////////////////// diff --git a/direct/src/dcparser/dcFile.h b/direct/src/dcparser/dcFile.h index 2cc19f283a..56b4bb50e4 100644 --- a/direct/src/dcparser/dcFile.h +++ b/direct/src/dcparser/dcFile.h @@ -15,7 +15,7 @@ class HashGenerator; //////////////////////////////////////////////////////////////////// -// Class : DCFile +// Class : DCFile // Description : Represents the complete list of Distributed Class // descriptions as read from a .dc file. //////////////////////////////////////////////////////////////////// diff --git a/direct/src/dcparser/dcLexer.lxx b/direct/src/dcparser/dcLexer.lxx index 4049e63725..b4780233a1 100644 --- a/direct/src/dcparser/dcLexer.lxx +++ b/direct/src/dcparser/dcLexer.lxx @@ -126,7 +126,7 @@ input_chars(char *buffer, int &result, int max_size) { // Truncate it at the newline. char *end = strchr(current_line, '\n'); if (end != NULL) { - *end = '\0'; + *end = '\0'; } } diff --git a/direct/src/dcparser/dcMolecularField.h b/direct/src/dcparser/dcMolecularField.h index cf2d9d19ae..28fdefd9d2 100644 --- a/direct/src/dcparser/dcMolecularField.h +++ b/direct/src/dcparser/dcMolecularField.h @@ -14,7 +14,7 @@ class DCAtomicField; //////////////////////////////////////////////////////////////////// -// Class : DCMolecularField +// Class : DCMolecularField // Description : A single molecular field of a Distributed Class, as // read from a .dc file. This represents a combination // of two or more related atomic fields, that will often diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index 0d16a52334..266fd7dbd3 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -82,13 +82,13 @@ dc_cleanup_parser() { %% dc: - empty - | dc ';' - | dc dclass - ; + empty + | dc ';' + | dc dclass + ; dclass: - KW_DCLASS IDENTIFIER + KW_DCLASS IDENTIFIER { current_class = new DCClass; current_class->_name = $2; @@ -96,11 +96,11 @@ dclass: yyerror("Duplicate class name: " + current_class->_name); } } - dclass_derivation '{' dclass_fields '}' - ; + dclass_derivation '{' dclass_fields '}' + ; dclass_name: - IDENTIFIER + IDENTIFIER { DCFile::ClassesByName::const_iterator ni; ni = dc_file->_classes_by_name.find($1); @@ -113,34 +113,34 @@ dclass_name: } dclass_derivation: - empty - | ':' base_list - ; + empty + | ':' base_list + ; base_list: - dclass_name + dclass_name { if ($1 != (DCClass *)NULL) { current_class->_parents.push_back($1); } } - | base_list ',' dclass_name + | base_list ',' dclass_name { if ($3 != (DCClass *)NULL) { current_class->_parents.push_back($3); } } - ; + ; dclass_fields: - empty - | dclass_fields ';' - | dclass_fields atomic_field - | dclass_fields molecular_field - ; + empty + | dclass_fields ';' + | dclass_fields atomic_field + | dclass_fields molecular_field + ; atomic_field: - IDENTIFIER '(' + IDENTIFIER '(' { current_atomic = new DCAtomicField; current_atomic->_name = $1; @@ -148,11 +148,11 @@ atomic_field: yyerror("Duplicate field name: " + current_atomic->_name); } } - parameter_list ')' atomic_flags - ; + parameter_list ')' atomic_flags + ; atomic_name: - IDENTIFIER + IDENTIFIER { DCField *field = current_class->get_field_by_name($1); $$ = (DCAtomicField *)NULL; @@ -167,60 +167,60 @@ atomic_name: } parameter_list: - empty - | nonempty_parameter_list - ; + empty + | nonempty_parameter_list + ; nonempty_parameter_list: - atomic_element - | nonempty_parameter_list ',' atomic_element - ; + atomic_element + | nonempty_parameter_list ',' atomic_element + ; atomic_element: - type_token + type_token { atomic_element = DCAtomicField::ElementType(); atomic_element._type = $1; } - atomic_element_definition + atomic_element_definition { current_atomic->_elements.push_back(atomic_element) } - ; + ; atomic_element_definition: - empty - | atomic_element_definition '/' INTEGER + empty + | atomic_element_definition '/' INTEGER { atomic_element._divisor = $3; } - | atomic_element_definition IDENTIFIER + | atomic_element_definition IDENTIFIER { atomic_element._name = $2; } - | atomic_element_definition '=' INTEGER + | atomic_element_definition '=' INTEGER { if (!atomic_element.set_default_value($3)) { yyerror("Invalid default value: " + $3); } } - | atomic_element_definition '=' REAL + | atomic_element_definition '=' REAL { if (!atomic_element.set_default_value($3)) { yyerror("Invalid default value: " + $3); } } - | atomic_element_definition '=' STRING + | atomic_element_definition '=' STRING { if (!atomic_element.set_default_value($3)) { yyerror("Invalid default value: \"" + $3 + "\""); } } - | atomic_element_definition '=' HEX_STRING + | atomic_element_definition '=' HEX_STRING { atomic_element.set_default_value($3); } - | atomic_element_definition '=' '{' default_array '}' + | atomic_element_definition '=' '{' default_array '}' { if (!atomic_element.end_array()) { yyerror("Array default value inappropriate"); @@ -228,37 +228,37 @@ atomic_element_definition: atomic_element._has_default_value = true; } } - ; + ; default_array: - empty - | default_array_def maybe_comma - ; + empty + | default_array_def maybe_comma + ; maybe_comma: - empty - | ',' - ; + empty + | ',' + ; default_array_def: - default_array_element - | default_array_def ',' default_array_element - ; + default_array_element + | default_array_def ',' default_array_element + ; default_array_element: - INTEGER + INTEGER { if (!atomic_element.add_default_value($1)) { yyerror("Invalid default value: " + $1); } } - | REAL + | REAL { if (!atomic_element.add_default_value($1)) { yyerror("Invalid default value: " + $1); } } - | INTEGER '*' INTEGER + | INTEGER '*' INTEGER { for (int i = 0; i < $3; i++) { if (!atomic_element.add_default_value($1)) { @@ -267,7 +267,7 @@ default_array_element: } } } - | REAL '*' INTEGER + | REAL '*' INTEGER { for (int i = 0; i < $3; i++) { if (!atomic_element.add_default_value($1)) { @@ -276,109 +276,109 @@ default_array_element: } } } - ; + ; type_token: - KW_INT8 + KW_INT8 { $$ = ST_int8; } - | KW_INT16 + | KW_INT16 { $$ = ST_int16; } - | KW_INT32 + | KW_INT32 { $$ = ST_int32; } - | KW_INT64 + | KW_INT64 { $$ = ST_int64; } - | KW_UINT8 + | KW_UINT8 { $$ = ST_uint8; } - | KW_UINT16 + | KW_UINT16 { $$ = ST_uint16; } - | KW_UINT32 + | KW_UINT32 { $$ = ST_uint32; } - | KW_UINT64 + | KW_UINT64 { $$ = ST_uint64; } - | KW_FLOAT64 + | KW_FLOAT64 { $$ = ST_float64; } - | KW_STRING + | KW_STRING { $$ = ST_string; } - | KW_BLOB + | KW_BLOB { $$ = ST_blob; } - | KW_INT16ARRAY + | KW_INT16ARRAY { $$ = ST_int16array; } - | KW_INT32ARRAY + | KW_INT32ARRAY { $$ = ST_int32array; } - | KW_UINT16ARRAY + | KW_UINT16ARRAY { $$ = ST_uint16array; } - | KW_UINT32ARRAY + | KW_UINT32ARRAY { $$ = ST_uint32array; } - ; + ; atomic_flags: - empty - | atomic_flags KW_REQUIRED + empty + | atomic_flags KW_REQUIRED { current_atomic->_flags |= DCAtomicField::F_required; } - | atomic_flags KW_BROADCAST + | atomic_flags KW_BROADCAST { current_atomic->_flags |= DCAtomicField::F_broadcast; } - | atomic_flags KW_P2P + | atomic_flags KW_P2P { current_atomic->_flags |= DCAtomicField::F_p2p; } - | atomic_flags KW_RAM + | atomic_flags KW_RAM { current_atomic->_flags |= DCAtomicField::F_ram; } - | atomic_flags KW_DB + | atomic_flags KW_DB { current_atomic->_flags |= DCAtomicField::F_db; } - | atomic_flags KW_CLSEND + | atomic_flags KW_CLSEND { current_atomic->_flags |= DCAtomicField::F_clsend; } - | atomic_flags KW_CLRECV + | atomic_flags KW_CLRECV { current_atomic->_flags |= DCAtomicField::F_clrecv; } - | atomic_flags KW_OWNSEND + | atomic_flags KW_OWNSEND { current_atomic->_flags |= DCAtomicField::F_ownsend; } - ; + ; molecular_field: - IDENTIFIER ':' + IDENTIFIER ':' { current_molecular = new DCMolecularField; current_molecular->_name = $1; @@ -386,28 +386,28 @@ molecular_field: yyerror("Duplicate field name: " + current_molecular->_name); } } - molecular_atom_list - ; + molecular_atom_list + ; molecular_atom_list: - atomic_name + atomic_name { if ($1 != (DCAtomicField *)NULL) { current_molecular->_fields.push_back($1); } } - | molecular_atom_list ',' atomic_name + | molecular_atom_list ',' atomic_name { if ($3 != (DCAtomicField *)NULL) { current_molecular->_fields.push_back($3); if (current_molecular->_fields[0]->_flags != $3->_flags) { yyerror("Mismatched flags in molecule between " + - current_molecular->_fields[0]->_name + " and " + - $3->_name); + current_molecular->_fields[0]->_name + " and " + + $3->_name); } } } - ; + ; empty: - ; + ; diff --git a/direct/src/dcparser/dcSubatomicType.h b/direct/src/dcparser/dcSubatomicType.h index 278dca1644..9f7f02c636 100644 --- a/direct/src/dcparser/dcSubatomicType.h +++ b/direct/src/dcparser/dcSubatomicType.h @@ -10,7 +10,7 @@ BEGIN_PUBLISH //////////////////////////////////////////////////////////////////// -// Enum : DCSubatomicType +// Enum : DCSubatomicType // Description : This defines the numeric type of each element of a // DCAtomicField; that is, the particular values that // will get added to the message when the atomic field diff --git a/direct/src/dcparser/hashGenerator.h b/direct/src/dcparser/hashGenerator.h index f2d76492e8..3990375176 100644 --- a/direct/src/dcparser/hashGenerator.h +++ b/direct/src/dcparser/hashGenerator.h @@ -10,7 +10,7 @@ #include "primeNumberGenerator.h" //////////////////////////////////////////////////////////////////// -// Class : HashGenerator +// Class : HashGenerator // Description : This class generates an arbitrary hash number from a // sequence of ints. //////////////////////////////////////////////////////////////////// diff --git a/direct/src/dcparser/primeNumberGenerator.cxx b/direct/src/dcparser/primeNumberGenerator.cxx index c50d69517e..28ab558c0c 100644 --- a/direct/src/dcparser/primeNumberGenerator.cxx +++ b/direct/src/dcparser/primeNumberGenerator.cxx @@ -38,8 +38,8 @@ operator [] (int n) { int j = 0; while (maybe_prime && _primes[j] * _primes[j] <= candidate) { if ((_primes[j] * (candidate / _primes[j])) == candidate) { - // This one is not prime. - maybe_prime = false; + // This one is not prime. + maybe_prime = false; } j++; nassertr(j < (int)_primes.size(), 0); diff --git a/direct/src/dcparser/primeNumberGenerator.h b/direct/src/dcparser/primeNumberGenerator.h index b4cf927e6f..4b7bfbc88f 100644 --- a/direct/src/dcparser/primeNumberGenerator.h +++ b/direct/src/dcparser/primeNumberGenerator.h @@ -9,7 +9,7 @@ #include "dcbase.h" //////////////////////////////////////////////////////////////////// -// Class : PrimeNumberGenerator +// Class : PrimeNumberGenerator // Description : This class generates a table of prime numbers, up to // the limit of an int. For a given integer n, it will // return the nth prime number. This will involve a diff --git a/direct/src/deadrec/correction.cxx b/direct/src/deadrec/correction.cxx index c45c0e0377..94b26960df 100644 --- a/direct/src/deadrec/correction.cxx +++ b/direct/src/deadrec/correction.cxx @@ -11,9 +11,9 @@ NotifyCategoryDeclNoExport(correction); NotifyCategoryDef(correction, ""); Correction::Correction(LPoint3f& start, LVector3f& s_vel) : _curr_p(start), - _curr_v(s_vel) { + _curr_v(s_vel) { correction_cat->debug() << "construction with:" << endl << "start = " - << start << endl << "vel = " << s_vel << endl; + << start << endl << "vel = " << s_vel << endl; } Correction::~Correction(void) { @@ -131,7 +131,7 @@ void SplineCorrection::step(void) { correction_cat->spam() << "time >= dur, holding at current pos" << endl; } else correction_cat->spam() << "have_both is false, no point calculated" - << endl; + << endl; } void SplineCorrection::new_target(LPoint3f& target, LVector3f& v_target) { diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index d75811baed..68f05d7772 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -53,7 +53,7 @@ std::string chan_config = "single"; std::string window_title = "Panda3D"; void render_frame(GraphicsPipe *pipe, - NodeAttributes &initial_state) { + NodeAttributes &initial_state) { int num_windows = pipe->get_num_windows(); for (int w = 0; w < num_windows; w++) { GraphicsWindow *win = pipe->get_window(w); @@ -66,7 +66,7 @@ void render_frame(GraphicsPipe *pipe, class WindowCallback : public GraphicsWindow::Callback { public: WindowCallback(GraphicsPipe *pipe, Node *render, - NodeAttributes *initial_state) : + NodeAttributes *initial_state) : _pipe(pipe), _render(render), _initial_state(initial_state), @@ -112,9 +112,9 @@ PT(GraphicsPipe) make_graphics_pipe() { } PT(GraphicsWindow) make_graphics_window(GraphicsPipe *pipe, - NamedNode *render, - NamedNode *camera, - NodeAttributes &initial_state) { + NamedNode *render, + NamedNode *camera, + NodeAttributes &initial_state) { PT(GraphicsWindow) main_win; ChanCfgOverrides override; @@ -128,7 +128,7 @@ PT(GraphicsWindow) make_graphics_window(GraphicsPipe *pipe, initial_state.set_attribute(DepthWriteTransition::get_class_type(), dwa); override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE))); + ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE))); std::string title = config_showbase.GetString("window-title", window_title); override.setField(ChanCfgOverrides::Title, title); @@ -278,7 +278,7 @@ void take_snapshot(GraphicsWindow *win, const string &name) { int height = dr->get_pixel_height(); PixelBuffer p(width, height, 3, 1, PixelBuffer::T_unsigned_byte, - PixelBuffer::F_rgb); + PixelBuffer::F_rgb); p.copy(gsg, dr, rb); p.write(name); diff --git a/direct/src/showbase/showBase.h b/direct/src/showbase/showBase.h index c6ea8b45f7..72f4f2ee74 100644 --- a/direct/src/showbase/showBase.h +++ b/direct/src/showbase/showBase.h @@ -31,13 +31,13 @@ EXPCL_DIRECT DSearchPath &get_particle_path(); EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe(); EXPCL_DIRECT PT(GraphicsWindow) make_graphics_window(GraphicsPipe *pipe, - NamedNode *render, - NamedNode *camera, - NodeAttributes &initial_state); + NamedNode *render, + NamedNode *camera, + NodeAttributes &initial_state); EXPCL_DIRECT NodePath setup_panda_2d(GraphicsWindow *win, const string &name); EXPCL_DIRECT void add_render_layer(GraphicsWindow *win, Node *render_top, - Camera *camera); + Camera *camera); EXPCL_DIRECT void toggle_wireframe(NodeAttributes &initial_state); EXPCL_DIRECT void toggle_texture(NodeAttributes &initial_state); diff --git a/dtool/src/cppparser/cppArrayType.cxx b/dtool/src/cppparser/cppArrayType.cxx index c504449bda..cc7d01609b 100644 --- a/dtool/src/cppparser/cppArrayType.cxx +++ b/dtool/src/cppparser/cppArrayType.cxx @@ -93,7 +93,7 @@ is_equivalent(const CPPType &other) const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPArrayType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -145,8 +145,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { //////////////////////////////////////////////////////////////////// void CPPArrayType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { ostringstream brackets; brackets << "["; if (_bounds != NULL) { @@ -156,7 +156,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, string bracketsstr = brackets.str(); _element_type->output_instance(out, indent_level, scope, complete, - prename, name + bracketsstr); + prename, name + bracketsstr); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppArrayType.h b/dtool/src/cppparser/cppArrayType.h index d840e5a992..d02968a48d 100644 --- a/dtool/src/cppparser/cppArrayType.h +++ b/dtool/src/cppparser/cppArrayType.h @@ -13,7 +13,7 @@ class CPPExpression; /////////////////////////////////////////////////////////////////// -// Class : CPPArrayType +// Class : CPPArrayType // Description : //////////////////////////////////////////////////////////////////// class CPPArrayType : public CPPType { @@ -25,20 +25,20 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index 1c2f51a0ae..7f4e4979e4 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -101,7 +101,7 @@ parse_cpp(CPPParser *cp) { CPPExpression * parse_const_expr(CPPPreprocessor *pp, CPPScope *new_current_scope, - CPPScope *new_global_scope) { + CPPScope *new_global_scope) { CPPScope *old_scope = current_scope; CPPScope *old_global_scope = global_scope; CPPPreprocessor *old_lexer = current_lexer; @@ -125,7 +125,7 @@ parse_const_expr(CPPPreprocessor *pp, CPPScope *new_current_scope, CPPType * parse_type(CPPPreprocessor *pp, CPPScope *new_current_scope, - CPPScope *new_global_scope) { + CPPScope *new_global_scope) { CPPScope *old_scope = current_scope; CPPScope *old_global_scope = global_scope; CPPPreprocessor *old_lexer = current_lexer; @@ -372,34 +372,34 @@ pop_struct() { %% grammar: - START_CPP cpp - | START_CONST_EXPR const_expr + START_CPP cpp + | START_CONST_EXPR const_expr { current_expr = $2; } - | START_TYPE full_type + | START_TYPE full_type { current_type = $2; } - ; + ; cpp: - empty - | cpp ';' - | cpp declaration - ; + empty + | cpp ';' + | cpp declaration + ; constructor_inits: - constructor_init - | constructor_inits ',' constructor_init - ; + constructor_init + | constructor_inits ',' constructor_init + ; constructor_init: - name '(' optional_const_expr_comma ')' + name '(' optional_const_expr_comma ')' { delete $3; } - ; + ; /* This is principally for the syntax: extern "C" { ... }. @@ -407,26 +407,26 @@ constructor_init: shift/reduce conflicts with yacc's limited differentiation ability. */ extern_c: - storage_class '{' + storage_class '{' { push_storage_class((current_storage_class & ~CPPInstance::SC_c_binding) | - ($1 & CPPInstance::SC_c_binding)); + ($1 & CPPInstance::SC_c_binding)); } - cpp '}' + cpp '}' { pop_storage_class(); } - ; + ; declaration: - type_like_declaration - | template_declaration - | extern_c - | namespace_declaration - | using_declaration - | friend_declaration - | KW_TYPEDEF typedef_declaration - | KW_BEGIN_PUBLISH + type_like_declaration + | template_declaration + | extern_c + | namespace_declaration + | using_declaration + | friend_declaration + | KW_TYPEDEF typedef_declaration + | KW_BEGIN_PUBLISH { if (publish_nest_level != 0) { yyerror("Unclosed __begin_publish", publish_loc); @@ -439,7 +439,7 @@ declaration: publish_nest_level++; current_scope->set_current_vis(V_published); } - | KW_END_PUBLISH + | KW_END_PUBLISH { if (publish_nest_level != 1) { yyerror("Unmatched __end_publish", @1); @@ -448,49 +448,49 @@ declaration: } publish_nest_level = 0; } - | KW_PUBLISHED ':' + | KW_PUBLISHED ':' { current_scope->set_current_vis(V_published); } - | KW_PUBLIC ':' + | KW_PUBLIC ':' { current_scope->set_current_vis(V_public); } - | KW_PROTECTED ':' + | KW_PROTECTED ':' { current_scope->set_current_vis(V_protected); } - | KW_PRIVATE ':' + | KW_PRIVATE ':' { current_scope->set_current_vis(V_private); } - ; + ; friend_declaration: - KW_FRIEND + KW_FRIEND { CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("temp"), - V_public); + V_public); push_scope(new_scope); } - declaration + declaration { delete current_scope; pop_scope(); } - ; + ; storage_class: - empty + empty { $$ = 0; } - | storage_class KW_EXTERN + | storage_class KW_EXTERN { $$ = $1 | (int)CPPInstance::SC_extern; } - | storage_class KW_EXTERN string + | storage_class KW_EXTERN string { $$ = $1 | (int)CPPInstance::SC_extern; if ($3 == "C") { @@ -501,42 +501,42 @@ storage_class: yywarning("Ignoring unknown linkage type \"" + $3 + "\"", @3); } } - | storage_class KW_STATIC + | storage_class KW_STATIC { $$ = $1 | (int)CPPInstance::SC_static; } - | storage_class KW_INLINE + | storage_class KW_INLINE { $$ = $1 | (int)CPPInstance::SC_inline; } - | storage_class KW_VIRTUAL + | storage_class KW_VIRTUAL { $$ = $1 | (int)CPPInstance::SC_virtual; } - | storage_class KW_EXPLICIT + | storage_class KW_EXPLICIT { $$ = $1 | (int)CPPInstance::SC_explicit; } - | storage_class KW_VOLATILE + | storage_class KW_VOLATILE { $$ = $1 | (int)CPPInstance::SC_volatile; } - | storage_class KW_MUTABLE + | storage_class KW_MUTABLE { $$ = $1 | (int)CPPInstance::SC_mutable; } - | storage_class KW_REGISTER + | storage_class KW_REGISTER { $$ = $1 | (int)CPPInstance::SC_register; } - ; + ; type_like_declaration: - multiple_var_declaration + multiple_var_declaration { /* multiple_var_declaration adds itself to the scope. */ } - | storage_class type_decl ';' + | storage_class type_decl ';' { // We don't really care about the storage class here. In fact, it's // not actually legal to define a class or struct using a particular @@ -545,7 +545,7 @@ type_like_declaration: current_scope->add_declaration($2, global_scope, current_lexer, @2); } - | storage_class function_prototype maybe_initialize_or_function_body + | storage_class function_prototype maybe_initialize_or_function_body { if ($2 != (CPPInstance *)NULL) { $2->_storage_class |= (current_storage_class | $1); @@ -553,10 +553,10 @@ type_like_declaration: $2->set_initializer($3); } } - ; + ; multiple_var_declaration: - storage_class type_decl + storage_class type_decl { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -567,70 +567,70 @@ multiple_var_declaration: } push_storage_class($1); } - multiple_instance_identifiers + multiple_instance_identifiers { pop_storage_class(); } - | storage_class KW_CONST type + | storage_class KW_CONST type { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. current_type = $3; push_storage_class($1); } - multiple_const_instance_identifiers + multiple_const_instance_identifiers { pop_storage_class(); } - /* We don't need to include a rule for variables that point to + /* We don't need to include a rule for variables that point to functions, because we get those from the function_prototype definition. */ - ; + ; multiple_instance_identifiers: - instance_identifier maybe_initialize_or_function_body + instance_identifier maybe_initialize_or_function_body { CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(inst, global_scope, current_lexer, @1); } - | instance_identifier maybe_initialize ',' multiple_instance_identifiers + | instance_identifier maybe_initialize ',' multiple_instance_identifiers { CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(inst, global_scope, current_lexer, @1); } - ; + ; multiple_const_instance_identifiers: - instance_identifier maybe_initialize_or_function_body + instance_identifier maybe_initialize_or_function_body { $1->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(inst, global_scope, current_lexer, @1); } - | instance_identifier maybe_initialize ',' multiple_const_instance_identifiers + | instance_identifier maybe_initialize ',' multiple_const_instance_identifiers { $1->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(inst, global_scope, current_lexer, @1); } - ; + ; typedef_declaration: - storage_class type_decl + storage_class type_decl { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. @@ -641,22 +641,22 @@ typedef_declaration: } push_storage_class($1); } - typedef_instance_identifiers + typedef_instance_identifiers { pop_storage_class(); } - | storage_class KW_CONST type + | storage_class KW_CONST type { // We don't need to push/pop type, because we can't nest // multiple_var_declarations. current_type = $3; push_storage_class($1); } - typedef_const_instance_identifiers + typedef_const_instance_identifiers { pop_storage_class(); } - | storage_class function_prototype maybe_initialize_or_function_body + | storage_class function_prototype maybe_initialize_or_function_body { if ($2 != (CPPDeclaration *)NULL) { CPPInstance *inst = $2->as_instance(); @@ -667,56 +667,56 @@ typedef_declaration: } } } - ; + ; typedef_instance_identifiers: - instance_identifier maybe_initialize_or_function_body + instance_identifier maybe_initialize_or_function_body { CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(new CPPTypedef(inst, current_scope == global_scope), global_scope, current_lexer, @1); } - | instance_identifier maybe_initialize ',' typedef_instance_identifiers + | instance_identifier maybe_initialize ',' typedef_instance_identifiers { CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(new CPPTypedef(inst, current_scope == global_scope), global_scope, current_lexer, @1); } - ; + ; typedef_const_instance_identifiers: - instance_identifier maybe_initialize_or_function_body + instance_identifier maybe_initialize_or_function_body { $1->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(new CPPTypedef(inst, current_scope == global_scope), global_scope, current_lexer, @1); } - | instance_identifier maybe_initialize ',' typedef_const_instance_identifiers + | instance_identifier maybe_initialize ',' typedef_const_instance_identifiers { $1->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance(current_type, $1, - current_storage_class, - @1.file); + current_storage_class, + @1.file); inst->set_initializer($2); current_scope->add_declaration(new CPPTypedef(inst, current_scope == global_scope), global_scope, current_lexer, @1); } - ; + ; function_prototype: /* Functions with implicit return types, and constructors */ - IDENTIFIER '(' + IDENTIFIER '(' { push_scope($1->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); CPPType *type; @@ -734,11 +734,11 @@ function_prototype: $$ = new CPPInstance(type, ii, 0, @1.file); } - | TYPENAME_IDENTIFIER '(' + | TYPENAME_IDENTIFIER '(' { push_scope($1->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); CPPType *type; @@ -758,11 +758,11 @@ function_prototype: } /* Destructors */ - | '~' name '(' + | '~' name '(' { push_scope($2->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); if ($2->is_scoped()) { @@ -788,11 +788,11 @@ function_prototype: because it doesn't catch a lot of subtle variants on this form--but this will get at least the 99% most common uses. */ - | TYPENAME_IDENTIFIER '(' '*' instance_identifier ')' '(' + | TYPENAME_IDENTIFIER '(' '*' instance_identifier ')' '(' { push_scope($4->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer); @@ -803,11 +803,11 @@ function_prototype: ii->add_func_modifier($8, $10); $$ = new CPPInstance(type, ii, 0, @1.file); } - | TYPENAME_IDENTIFIER '(' SCOPING '*' instance_identifier ')' '(' + | TYPENAME_IDENTIFIER '(' SCOPING '*' instance_identifier ')' '(' { push_scope($5->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer); @@ -820,13 +820,13 @@ function_prototype: } /* Typecast operators */ - | KW_OPERATOR type not_paren_formal_parameter_identifier '(' + | KW_OPERATOR type not_paren_formal_parameter_identifier '(' { if ($1 != NULL) { push_scope($1->get_scope(current_scope, global_scope)); } } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { if ($1 != NULL) { pop_scope(); @@ -851,13 +851,13 @@ function_prototype: $$ = CPPInstance::make_typecast_function (new CPPInstance($2, $3, 0, @3.file), ident, $6, $8); } - | KW_OPERATOR KW_CONST type not_paren_formal_parameter_identifier '(' + | KW_OPERATOR KW_CONST type not_paren_formal_parameter_identifier '(' { if ($1 != NULL) { push_scope($1->get_scope(current_scope, global_scope)); } } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { if ($1 != NULL) { pop_scope(); @@ -877,7 +877,7 @@ function_prototype: /* Not actually a function prototype, but maybe a template instantiation. Just included here (instead of somewhere else) to avoid shift/reduce conflicts. */ - | IDENTIFIER + | IDENTIFIER { CPPDeclaration *decl = $1->find_symbol(current_scope, global_scope, current_lexer); @@ -887,274 +887,274 @@ function_prototype: $$ = (CPPInstance *)NULL; } } - ; + ; function_post: - empty + empty { $$ = 0; } - | KW_CONST + | KW_CONST { $$ = (int)CPPFunctionType::F_const_method; } - | function_post KW_THROW '(' ')' + | function_post KW_THROW '(' ')' { $$ = $1; } - | function_post KW_THROW '(' name ')' + | function_post KW_THROW '(' name ')' { $$ = $1; } - ; + ; function_operator: - '!' + '!' { $$ = "!"; } - | '~' + | '~' { $$ = "~"; } - | '*' + | '*' { $$ = "*"; } - | '/' + | '/' { $$ = "/"; } - | '%' + | '%' { $$ = "%"; } - | '+' + | '+' { $$ = "+"; } - | '-' + | '-' { $$ = "-"; } - | '|' + | '|' { $$ = "|"; } - | '&' + | '&' { $$ = "&"; } - | '^' + | '^' { $$ = "^"; } - | OROR + | OROR { $$ = "||"; } - | ANDAND + | ANDAND { $$ = "&&"; } - | EQCOMPARE + | EQCOMPARE { $$ = "=="; } - | NECOMPARE + | NECOMPARE { $$ = "!="; } - | LECOMPARE + | LECOMPARE { $$ = "<="; } - | GECOMPARE + | GECOMPARE { $$ = ">="; } - | '<' + | '<' { $$ = "<"; } - | '>' + | '>' { $$ = ">"; } - | LSHIFT + | LSHIFT { $$ = "<<"; } - | RSHIFT + | RSHIFT { $$ = ">>"; } - | '=' + | '=' { $$ = "="; } - | ',' + | ',' { $$ = ","; } - | PLUSPLUS + | PLUSPLUS { $$ = "++"; } - | MINUSMINUS + | MINUSMINUS { $$ = "--"; } - | TIMESEQUAL + | TIMESEQUAL { $$ = "*="; } - | DIVIDEEQUAL + | DIVIDEEQUAL { $$ = "/="; } - | MODEQUAL + | MODEQUAL { $$ = "%="; } - | PLUSEQUAL + | PLUSEQUAL { $$ = "+="; } - | MINUSEQUAL + | MINUSEQUAL { $$ = "-="; } - | OREQUAL + | OREQUAL { $$ = "|="; } - | ANDEQUAL + | ANDEQUAL { $$ = "&="; } - | XOREQUAL + | XOREQUAL { $$ = "^="; } - | LSHIFTEQUAL + | LSHIFTEQUAL { $$ = "<<="; } - | RSHIFTEQUAL + | RSHIFTEQUAL { $$ = ">>="; } - | POINTSAT + | POINTSAT { $$ = "->"; } - | '[' ']' + | '[' ']' { $$ = "[]"; } - | '(' ')' + | '(' ')' { $$ = "()"; } - | KW_NEW + | KW_NEW { $$ = "new"; } - | KW_DELETE + | KW_DELETE { $$ = "delete"; } - ; + ; more_template_declaration: - type_like_declaration - | template_declaration - ; + type_like_declaration + | template_declaration + ; template_declaration: - KW_TEMPLATE + KW_TEMPLATE { push_scope(new CPPTemplateScope(current_scope)); } - '<' template_formal_parameters '>' more_template_declaration + '<' template_formal_parameters '>' more_template_declaration { pop_scope(); } - ; + ; template_formal_parameters: - empty - | template_nonempty_formal_parameters - ; + empty + | template_nonempty_formal_parameters + ; -template_nonempty_formal_parameters: - template_formal_parameter +template_nonempty_formal_parameters: + template_formal_parameter { CPPTemplateScope *ts = current_scope->as_template_scope(); assert(ts != NULL); ts->add_template_parameter($1); } - | template_nonempty_formal_parameters ',' template_formal_parameter + | template_nonempty_formal_parameters ',' template_formal_parameter { CPPTemplateScope *ts = current_scope->as_template_scope(); assert(ts != NULL); ts->add_template_parameter($3); } - ; + ; template_formal_parameter: - KW_CLASS name + KW_CLASS name { $$ = CPPType::new_type(new CPPClassTemplateParameter($2)); } - | KW_CLASS name '=' full_type + | KW_CLASS name '=' full_type { $$ = CPPType::new_type(new CPPClassTemplateParameter($2, $4)); } - | template_formal_parameter_type formal_parameter_identifier template_parameter_maybe_initialize + | template_formal_parameter_type formal_parameter_identifier template_parameter_maybe_initialize { CPPInstance *inst = new CPPInstance($1, $2, 0, @2.file); inst->set_initializer($3); $$ = inst; } - | KW_CONST template_formal_parameter_type formal_parameter_identifier template_parameter_maybe_initialize + | KW_CONST template_formal_parameter_type formal_parameter_identifier template_parameter_maybe_initialize { $3->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance($2, $3, 0, @3.file); inst->set_initializer($4); $$ = inst; } - ; + ; template_formal_parameter_type: - simple_type + simple_type { $$ = CPPType::new_type($1); } - | IDENTIFIER + | IDENTIFIER { yywarning("Not a type: " + $1->get_fully_scoped_name(), @1); $$ = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = $1->find_type(current_scope, global_scope, false, current_lexer); assert($$ != NULL); } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - ; + ; instance_identifier: - name + name { $$ = new CPPInstanceIdentifier($1); } - | KW_OPERATOR function_operator + | KW_OPERATOR function_operator { // For an operator function. We implement this simply by building a // ficticious name for the function; in other respects it's just @@ -1168,155 +1168,155 @@ instance_identifier: $$ = new CPPInstanceIdentifier(ident); } - | KW_CONST instance_identifier %prec UNARY + | KW_CONST instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_const); } - | '*' instance_identifier %prec UNARY + | '*' instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_pointer); } - | '&' instance_identifier %prec UNARY + | '&' instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_reference); } - | SCOPING '*' instance_identifier %prec UNARY + | SCOPING '*' instance_identifier %prec UNARY { $$ = $3; $$->add_scoped_pointer_modifier($1); } - | instance_identifier '[' optional_const_expr ']' + | instance_identifier '[' optional_const_expr ']' { $$ = $1; $$->add_array_modifier($3); } - | '(' instance_identifier ')' + | '(' instance_identifier ')' { $$ = $2; $$->add_modifier(IIT_paren); } - | instance_identifier '(' + | instance_identifier '(' { push_scope($1->get_scope(current_scope, global_scope)); } - formal_parameter_list ')' function_post + formal_parameter_list ')' function_post { pop_scope(); $$ = $1; $$->add_func_modifier($4, $6); } - ; + ; formal_parameter_list: - empty + empty { $$ = new CPPParameterList; } - | ELLIPSIS + | ELLIPSIS { $$ = new CPPParameterList; $$->_includes_ellipsis = true; } - | formal_parameters + | formal_parameters { $$ = $1; } - | formal_parameters ',' ELLIPSIS + | formal_parameters ',' ELLIPSIS { $$ = $1; $$->_includes_ellipsis = true; } - | formal_parameters ELLIPSIS + | formal_parameters ELLIPSIS { $$ = $1; $$->_includes_ellipsis = true; } - ; + ; formal_parameters: - formal_parameter + formal_parameter { $$ = new CPPParameterList; $$->_parameters.push_back($1); } - | formal_parameters ',' formal_parameter + | formal_parameters ',' formal_parameter { $$ = $1; $$->_parameters.push_back($3); } - ; + ; template_parameter_maybe_initialize: - empty + empty { $$ = (CPPExpression *)NULL; } - | '=' no_angle_bracket_const_expr + | '=' no_angle_bracket_const_expr { $$ = $2; } - ; + ; maybe_initialize: - empty + empty { $$ = (CPPExpression *)NULL; } - | '=' const_expr + | '=' const_expr { $$ = $2; } - ; + ; maybe_initialize_or_function_body: - ';' + ';' { $$ = (CPPExpression *)NULL; } - | '{' code '}' + | '{' code '}' { $$ = (CPPExpression *)NULL; } - | ':' constructor_inits '{' code '}' + | ':' constructor_inits '{' code '}' { $$ = (CPPExpression *)NULL; } - | '=' const_expr ';' + | '=' const_expr ';' { $$ = $2; } - | '=' '{' structure_init '}' + | '=' '{' structure_init '}' { $$ = (CPPExpression *)NULL; } - ; + ; structure_init: - empty - | structure_init_body - | structure_init_body ',' - ; + empty + | structure_init_body + | structure_init_body ',' + ; structure_init_body: - const_expr + const_expr { } - | '{' structure_init '}' - | structure_init_body ',' const_expr - | structure_init_body ',' '{' structure_init '}' - ; + | '{' structure_init '}' + | structure_init_body ',' const_expr + | structure_init_body ',' '{' structure_init '}' + ; formal_parameter: - type formal_parameter_identifier maybe_initialize + type formal_parameter_identifier maybe_initialize { $$ = new CPPInstance($1, $2, 0, @2.file); $$->set_initializer($3); } - | IDENTIFIER formal_parameter_identifier maybe_initialize + | IDENTIFIER formal_parameter_identifier maybe_initialize { yywarning("Not a type: " + $1->get_fully_scoped_name(), @1); CPPType *type = @@ -1324,169 +1324,169 @@ formal_parameter: $$ = new CPPInstance(type, $2, 0, @2.file); $$->set_initializer($3); } - | KW_CONST type formal_parameter_identifier maybe_initialize + | KW_CONST type formal_parameter_identifier maybe_initialize { $3->add_modifier(IIT_const); $$ = new CPPInstance($2, $3, 0, @3.file); $$->set_initializer($4); } - ; + ; not_paren_formal_parameter_identifier: - empty + empty { $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } - | IDENTIFIER + | IDENTIFIER { $$ = new CPPInstanceIdentifier($1); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = new CPPInstanceIdentifier($1); } - | KW_CONST not_paren_formal_parameter_identifier %prec UNARY + | KW_CONST not_paren_formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_const); } - | '*' not_paren_formal_parameter_identifier %prec UNARY + | '*' not_paren_formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_pointer); } - | '&' not_paren_formal_parameter_identifier %prec UNARY + | '&' not_paren_formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_reference); } - | SCOPING '*' not_paren_formal_parameter_identifier %prec UNARY + | SCOPING '*' not_paren_formal_parameter_identifier %prec UNARY { $$ = $3; $$->add_scoped_pointer_modifier($1); } - | not_paren_formal_parameter_identifier '[' optional_const_expr ']' + | not_paren_formal_parameter_identifier '[' optional_const_expr ']' { $$ = $1; $$->add_array_modifier($3); } - ; + ; formal_parameter_identifier: - empty + empty { $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } - | IDENTIFIER + | IDENTIFIER { $$ = new CPPInstanceIdentifier($1); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = new CPPInstanceIdentifier($1); } - | KW_CONST formal_parameter_identifier %prec UNARY + | KW_CONST formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_const); } - | '*' formal_parameter_identifier %prec UNARY + | '*' formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_pointer); } - | '&' formal_parameter_identifier %prec UNARY + | '&' formal_parameter_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_reference); } - | SCOPING '*' formal_parameter_identifier %prec UNARY + | SCOPING '*' formal_parameter_identifier %prec UNARY { $$ = $3; $$->add_scoped_pointer_modifier($1); } - | formal_parameter_identifier '[' optional_const_expr ']' + | formal_parameter_identifier '[' optional_const_expr ']' { $$ = $1; $$->add_array_modifier($3); } - | '(' formal_parameter_identifier ')' '(' formal_parameter_list ')' function_post + | '(' formal_parameter_identifier ')' '(' formal_parameter_list ')' function_post { $$ = $2; $$->add_modifier(IIT_paren); $$->add_func_modifier($5, $7); } - ; + ; empty_instance_identifier: - empty + empty { $$ = new CPPInstanceIdentifier((CPPIdentifier *)NULL); } - | KW_CONST empty_instance_identifier %prec UNARY + | KW_CONST empty_instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_const); } - | '*' empty_instance_identifier %prec UNARY + | '*' empty_instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_pointer); } - | '&' empty_instance_identifier %prec UNARY + | '&' empty_instance_identifier %prec UNARY { $$ = $2; $$->add_modifier(IIT_reference); } - | SCOPING '*' empty_instance_identifier %prec UNARY + | SCOPING '*' empty_instance_identifier %prec UNARY { $$ = $3; $$->add_scoped_pointer_modifier($1); } - | empty_instance_identifier '[' optional_const_expr ']' + | empty_instance_identifier '[' optional_const_expr ']' { $$ = $1; $$->add_array_modifier($3); } - | '(' empty_instance_identifier ')' '(' formal_parameter_list ')' function_post + | '(' empty_instance_identifier ')' '(' formal_parameter_list ')' function_post { $$ = $2; $$->add_modifier(IIT_paren); $$->add_func_modifier($5, $7); } - ; + ; type: - simple_type + simple_type { $$ = CPPType::new_type($1); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = $1->find_type(current_scope, global_scope, false, current_lexer); assert($$ != NULL); } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - | anonymous_struct + | anonymous_struct { $$ = CPPType::new_type($1); } - | named_struct + | named_struct { $$ = CPPType::new_type($1); } - | anonymous_enum + | anonymous_enum { $$ = CPPType::new_type($1); } - | named_enum + | named_enum { $$ = CPPType::new_type($1); } - | struct_keyword name + | struct_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1502,7 +1502,7 @@ type: $$ = et; } } - | enum_keyword name + | enum_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1518,39 +1518,39 @@ type: $$ = et; } } - ; + ; type_decl: - simple_type + simple_type { $$ = CPPType::new_type($1); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = $1->find_type(current_scope, global_scope, false, current_lexer); assert($$ != NULL); } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - | anonymous_struct + | anonymous_struct { $$ = CPPType::new_type($1); } - | named_struct + | named_struct { $$ = new CPPTypeDeclaration(CPPType::new_type($1)); } - | anonymous_enum + | anonymous_enum { $$ = CPPType::new_type($1); } - | named_enum + | named_enum { $$ = new CPPTypeDeclaration(CPPType::new_type($1)); } - | struct_keyword name + | struct_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1566,7 +1566,7 @@ type_decl: $$ = et; } } - | enum_keyword name + | enum_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1582,23 +1582,23 @@ type_decl: $$ = et; } } - ; + ; predefined_type: - simple_type + simple_type { $$ = CPPType::new_type($1); } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = $1->find_type(current_scope, global_scope, false, current_lexer); assert($$ != NULL); } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - | struct_keyword name + | struct_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1614,7 +1614,7 @@ predefined_type: $$ = et; } } - | enum_keyword name + | enum_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { @@ -1630,50 +1630,50 @@ predefined_type: $$ = et; } } - ; + ; full_type: - type empty_instance_identifier + type empty_instance_identifier { CPPInstance *inst = new CPPInstance($1, $2, 0, @1.file); $$ = inst->_type; delete inst; } - | KW_CONST type empty_instance_identifier + | KW_CONST type empty_instance_identifier { $3->add_modifier(IIT_const); CPPInstance *inst = new CPPInstance($2, $3, 0, @1.file); $$ = inst->_type; delete inst; } - ; + ; anonymous_struct: - struct_keyword '{' + struct_keyword '{' { CPPVisibility starting_vis = ($1 == CPPExtensionType::T_class) ? V_private : V_public; CPPScope *new_scope = new CPPScope(current_scope, CPPNameComponent("anon"), - starting_vis); + starting_vis); CPPStructType *st = new CPPStructType($1, NULL, current_scope, - new_scope, @1.file); + new_scope, @1.file); new_scope->set_struct_type(st); push_scope(new_scope); push_struct(st); } - cpp '}' + cpp '}' { $$ = current_struct; current_struct->_incomplete = false; pop_struct(); pop_scope(); } - ; + ; named_struct: - struct_keyword name + struct_keyword name { CPPVisibility starting_vis = ($1 == CPPExtensionType::T_class) ? V_private : V_public; @@ -1683,151 +1683,151 @@ named_struct: scope = current_scope; } CPPScope *new_scope = new CPPScope(scope, $2->_names.back(), - starting_vis); + starting_vis); CPPStructType *st = new CPPStructType($1, $2, current_scope, - new_scope, @1.file); + new_scope, @1.file); new_scope->set_struct_type(st); current_scope->define_extension_type(st); push_scope(new_scope); push_struct(st); } - maybe_class_derivation '{' cpp '}' + maybe_class_derivation '{' cpp '}' { $$ = current_struct; current_struct->_incomplete = false; pop_struct(); pop_scope(); } - ; + ; maybe_class_derivation: - empty - | class_derivation - ; + empty + | class_derivation + ; class_derivation: - ':' base_specification - | class_derivation ',' base_specification - ; + ':' base_specification + | class_derivation ',' base_specification + ; base_specification: - KW_PUBLIC class_derivation_name + KW_PUBLIC class_derivation_name { current_struct->append_derivation($2, V_public, false); } - | KW_PROTECTED class_derivation_name + | KW_PROTECTED class_derivation_name { current_struct->append_derivation($2, V_protected, false); } - | KW_PRIVATE class_derivation_name + | KW_PRIVATE class_derivation_name { current_struct->append_derivation($2, V_private, false); } - | KW_VIRTUAL KW_PUBLIC class_derivation_name + | KW_VIRTUAL KW_PUBLIC class_derivation_name { current_struct->append_derivation($3, V_public, true); } - | KW_VIRTUAL KW_PROTECTED class_derivation_name + | KW_VIRTUAL KW_PROTECTED class_derivation_name { current_struct->append_derivation($3, V_protected, true); } - | KW_VIRTUAL KW_PRIVATE class_derivation_name + | KW_VIRTUAL KW_PRIVATE class_derivation_name { current_struct->append_derivation($3, V_private, true); } - | KW_PUBLIC KW_VIRTUAL class_derivation_name + | KW_PUBLIC KW_VIRTUAL class_derivation_name { current_struct->append_derivation($3, V_public, true); } - | KW_PROTECTED KW_VIRTUAL class_derivation_name + | KW_PROTECTED KW_VIRTUAL class_derivation_name { current_struct->append_derivation($3, V_protected, true); } - | KW_PRIVATE KW_VIRTUAL class_derivation_name + | KW_PRIVATE KW_VIRTUAL class_derivation_name { current_struct->append_derivation($3, V_private, true); } - ; + ; anonymous_enum: - enum_keyword '{' + enum_keyword '{' { current_enum = new CPPEnumType(NULL, current_scope, @1.file); } - enum_body '}' + enum_body '}' { $$ = current_enum; current_enum = NULL; } - ; + ; named_enum: - enum_keyword name '{' + enum_keyword name '{' { current_enum = new CPPEnumType($2, current_scope, @1.file); } - enum_body '}' + enum_body '}' { $$ = current_enum; current_enum = NULL; } - ; + ; enum_body: - empty - | enum_body_no_trailing_comma - | enum_body_no_trailing_comma ',' - ; + empty + | enum_body_no_trailing_comma + | enum_body_no_trailing_comma ',' + ; enum_body_no_trailing_comma: - name + name { assert(current_enum != NULL); current_enum->add_element($1->get_simple_name(), current_scope); } - | name '=' const_expr + | name '=' const_expr { assert(current_enum != NULL); current_enum->add_element($1->get_simple_name(), current_scope, $3); } - | enum_body_no_trailing_comma ',' name + | enum_body_no_trailing_comma ',' name { assert(current_enum != NULL); current_enum->add_element($3->get_simple_name(), current_scope); } - | enum_body_no_trailing_comma ',' name '=' const_expr + | enum_body_no_trailing_comma ',' name '=' const_expr { assert(current_enum != NULL); current_enum->add_element($3->get_simple_name(), current_scope, $5); } - ; + ; enum_keyword: - KW_ENUM + KW_ENUM { $$ = CPPExtensionType::T_enum; } - ; + ; struct_keyword: - KW_CLASS + KW_CLASS { $$ = CPPExtensionType::T_class; } - | KW_STRUCT + | KW_STRUCT { $$ = CPPExtensionType::T_struct; } - | KW_UNION + | KW_UNION { $$ = CPPExtensionType::T_union; } - ; + ; namespace_declaration: - KW_NAMESPACE name '{' + KW_NAMESPACE name '{' { CPPScope *scope = $2->find_scope(current_scope, global_scope, current_lexer); if (scope == NULL) { @@ -1845,78 +1845,78 @@ namespace_declaration: current_scope->define_namespace(nspace); push_scope(scope); } - cpp '}' + cpp '}' { pop_scope(); } - | KW_NAMESPACE '{' cpp '}' - ; + | KW_NAMESPACE '{' cpp '}' + ; using_declaration: - KW_USING name + KW_USING name { CPPUsing *using_decl = new CPPUsing($2, false, @1.file); current_scope->add_declaration(using_decl, global_scope, current_lexer, @1); current_scope->add_using(using_decl, global_scope, current_lexer); } - | KW_USING KW_NAMESPACE name + | KW_USING KW_NAMESPACE name { CPPUsing *using_decl = new CPPUsing($3, true, @1.file); current_scope->add_declaration(using_decl, global_scope, current_lexer, @1); current_scope->add_using(using_decl, global_scope, current_lexer); } - ; + ; simple_type: - simple_int_type - | simple_float_type - | simple_void_type - ; + simple_int_type + | simple_float_type + | simple_void_type + ; simple_int_type: KW_BOOL { $$ = new CPPSimpleType(CPPSimpleType::T_bool); } - | KW_CHAR + | KW_CHAR { $$ = new CPPSimpleType(CPPSimpleType::T_char); } - | KW_SHORT + | KW_SHORT { $$ = new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_short); + CPPSimpleType::F_short); } - | KW_LONG + | KW_LONG { $$ = new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_long); + CPPSimpleType::F_long); } - | KW_LONGLONG + | KW_LONGLONG { $$ = new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_longlong); + CPPSimpleType::F_longlong); } - | KW_UNSIGNED + | KW_UNSIGNED { $$ = new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_unsigned); + CPPSimpleType::F_unsigned); } - | KW_SIGNED + | KW_SIGNED { $$ = new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_signed); + CPPSimpleType::F_signed); } - | KW_INT + | KW_INT { $$ = new CPPSimpleType(CPPSimpleType::T_int); } - | KW_SHORT simple_int_type + | KW_SHORT simple_int_type { $$ = $2; $$->_flags |= CPPSimpleType::F_short; } - | KW_LONG simple_int_type + | KW_LONG simple_int_type { $$ = $2; if ($$->_flags & CPPSimpleType::F_long) { @@ -1925,50 +1925,50 @@ simple_int_type: $$->_flags |= CPPSimpleType::F_long; } } - | KW_UNSIGNED simple_int_type + | KW_UNSIGNED simple_int_type { $$ = $2; $$->_flags |= CPPSimpleType::F_unsigned; } - | KW_SIGNED simple_int_type + | KW_SIGNED simple_int_type { $$ = $2; $$->_flags |= CPPSimpleType::F_signed; } - ; + ; simple_float_type: - KW_FLOAT + KW_FLOAT { $$ = new CPPSimpleType(CPPSimpleType::T_float); } - | KW_LONG KW_FLOAT + | KW_LONG KW_FLOAT { $$ = new CPPSimpleType(CPPSimpleType::T_float, - CPPSimpleType::F_long); + CPPSimpleType::F_long); } - | KW_DOUBLE + | KW_DOUBLE { $$ = new CPPSimpleType(CPPSimpleType::T_double); } - | KW_LONG KW_LONG KW_FLOAT + | KW_LONG KW_LONG KW_FLOAT { $$ = new CPPSimpleType(CPPSimpleType::T_float, - CPPSimpleType::F_longlong); + CPPSimpleType::F_longlong); } - | KW_LONG KW_DOUBLE + | KW_LONG KW_DOUBLE { $$ = new CPPSimpleType(CPPSimpleType::T_double, - CPPSimpleType::F_long); + CPPSimpleType::F_long); } - ; + ; simple_void_type: - KW_VOID + KW_VOID { $$ = new CPPSimpleType(CPPSimpleType::T_void); } - ; + ; /* We don't care what the code is. We just want to be sure we match up opening and closing braces properly. For anything else, we'll @@ -1977,130 +1977,130 @@ code: { current_lexer->_resolve_identifiers = false; } - code_block + code_block { current_lexer->_resolve_identifiers = true; } - ; + ; code_block: - empty - | code_block element - ; + empty + | code_block element + ; element: - REAL + REAL { } - | INTEGER + | INTEGER { } - | STRING + | STRING { } - | CHAR + | CHAR { } - | IDENTIFIER + | IDENTIFIER { } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { } - | SCOPING + | SCOPING { } - | SIMPLE_IDENTIFIER + | SIMPLE_IDENTIFIER { } - | ELLIPSIS | OROR | ANDAND - | EQCOMPARE | NECOMPARE | LECOMPARE | GECOMPARE - | LSHIFT | RSHIFT | POINTSAT_STAR | DOT_STAR | POINTSAT - | SCOPE | PLUSPLUS | MINUSMINUS - | TIMESEQUAL | DIVIDEEQUAL | MODEQUAL | PLUSEQUAL | MINUSEQUAL - | OREQUAL | ANDEQUAL | XOREQUAL | LSHIFTEQUAL | RSHIFTEQUAL - | KW_BOOL | KW_CATCH | KW_CHAR | KW_CLASS | KW_CONST - | KW_DELETE | KW_DOUBLE | KW_DYNAMIC_CAST | KW_ELSE | KW_ENUM - | KW_EXTERN | KW_EXPLICIT | KW_FALSE - | KW_FLOAT | KW_FRIEND | KW_FOR | KW_GOTO - | KW_IF | KW_INLINE | KW_INT - | KW_LONG | KW_MUTABLE | KW_NEW | KW_PRIVATE | KW_PROTECTED - | KW_PUBLIC | KW_PUBLISHED | KW_REGISTER | KW_RETURN - | KW_SHORT | KW_SIGNED | KW_SIZEOF | KW_STATIC | KW_STATIC_CAST - | KW_STRUCT | KW_THROW | KW_TRUE | KW_TRY | KW_TYPEDEF | KW_TYPENAME - | KW_UNION | KW_UNSIGNED | KW_VIRTUAL | KW_VOID | KW_VOLATILE - | KW_WHILE | TOKENPASTE - | KW_OPERATOR + | ELLIPSIS | OROR | ANDAND + | EQCOMPARE | NECOMPARE | LECOMPARE | GECOMPARE + | LSHIFT | RSHIFT | POINTSAT_STAR | DOT_STAR | POINTSAT + | SCOPE | PLUSPLUS | MINUSMINUS + | TIMESEQUAL | DIVIDEEQUAL | MODEQUAL | PLUSEQUAL | MINUSEQUAL + | OREQUAL | ANDEQUAL | XOREQUAL | LSHIFTEQUAL | RSHIFTEQUAL + | KW_BOOL | KW_CATCH | KW_CHAR | KW_CLASS | KW_CONST + | KW_DELETE | KW_DOUBLE | KW_DYNAMIC_CAST | KW_ELSE | KW_ENUM + | KW_EXTERN | KW_EXPLICIT | KW_FALSE + | KW_FLOAT | KW_FRIEND | KW_FOR | KW_GOTO + | KW_IF | KW_INLINE | KW_INT + | KW_LONG | KW_MUTABLE | KW_NEW | KW_PRIVATE | KW_PROTECTED + | KW_PUBLIC | KW_PUBLISHED | KW_REGISTER | KW_RETURN + | KW_SHORT | KW_SIGNED | KW_SIZEOF | KW_STATIC | KW_STATIC_CAST + | KW_STRUCT | KW_THROW | KW_TRUE | KW_TRY | KW_TYPEDEF | KW_TYPENAME + | KW_UNION | KW_UNSIGNED | KW_VIRTUAL | KW_VOID | KW_VOLATILE + | KW_WHILE | TOKENPASTE + | KW_OPERATOR { } - | '+' | '-' | '*' | '/' | '&' | '|' | '^' | '!' | '~' | '=' | '%' - | '<' | '>' | '(' | ')' | '.' | ',' | ';' | ':' | '[' | ']' - | '?' | '{' code_block '}' - ; + | '+' | '-' | '*' | '/' | '&' | '|' | '^' | '!' | '~' | '=' | '%' + | '<' | '>' | '(' | ')' | '.' | ',' | ';' | ':' | '[' | ']' + | '?' | '{' code_block '}' + ; optional_const_expr: - empty + empty { $$ = (CPPExpression *)NULL; } - | const_expr + | const_expr { $$ = $1; } - ; + ; optional_const_expr_comma: - empty + empty { $$ = (CPPExpression *)NULL; } - | const_expr_comma + | const_expr_comma { $$ = $1; } - ; + ; const_expr_comma: - const_expr + const_expr { $$ = $1; } - | const_expr_comma ',' const_expr + | const_expr_comma ',' const_expr { $$ = new CPPExpression(',', $1, $3) } - ; + ; no_angle_bracket_const_expr: - const_operand + const_operand { $$ = $1; } - | '(' full_type ')' no_angle_bracket_const_expr %prec UNARY + | '(' full_type ')' no_angle_bracket_const_expr %prec UNARY { $$ = new CPPExpression(CPPExpression::typecast_op($2, $4)); } - | KW_STATIC_CAST '<' full_type '>' '(' const_expr_comma ')' + | KW_STATIC_CAST '<' full_type '>' '(' const_expr_comma ')' { $$ = new CPPExpression(CPPExpression::typecast_op($3, $6)); } - | KW_DYNAMIC_CAST '<' full_type '>' '(' const_expr_comma ')' + | KW_DYNAMIC_CAST '<' full_type '>' '(' const_expr_comma ')' { $$ = new CPPExpression(CPPExpression::typecast_op($3, $6)); } - | KW_SIZEOF '(' full_type ')' %prec UNARY + | KW_SIZEOF '(' full_type ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::sizeof_func($3)); } - | '!' no_angle_bracket_const_expr %prec UNARY + | '!' no_angle_bracket_const_expr %prec UNARY { $$ = new CPPExpression(UNARY_NOT, $2); } - | '~' no_angle_bracket_const_expr %prec UNARY + | '~' no_angle_bracket_const_expr %prec UNARY { $$ = new CPPExpression(UNARY_NEGATE, $2); } - | '-' no_angle_bracket_const_expr %prec UNARY + | '-' no_angle_bracket_const_expr %prec UNARY { if ($2->_type == CPPExpression::T_integer) { $$ = $2; @@ -2112,208 +2112,208 @@ no_angle_bracket_const_expr: $$ = new CPPExpression(UNARY_MINUS, $2); } } - | '*' no_angle_bracket_const_expr %prec UNARY + | '*' no_angle_bracket_const_expr %prec UNARY { $$ = new CPPExpression(UNARY_STAR, $2); } - | '&' no_angle_bracket_const_expr %prec UNARY + | '&' no_angle_bracket_const_expr %prec UNARY { $$ = new CPPExpression(UNARY_REF, $2); } - | no_angle_bracket_const_expr '*' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '*' no_angle_bracket_const_expr { $$ = new CPPExpression('*', $1, $3) } - | no_angle_bracket_const_expr '/' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '/' no_angle_bracket_const_expr { $$ = new CPPExpression('/', $1, $3) } - | no_angle_bracket_const_expr '%' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '%' no_angle_bracket_const_expr { $$ = new CPPExpression('%', $1, $3) } - | no_angle_bracket_const_expr '+' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '+' no_angle_bracket_const_expr { $$ = new CPPExpression('+', $1, $3) } - | no_angle_bracket_const_expr '-' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '-' no_angle_bracket_const_expr { $$ = new CPPExpression('-', $1, $3) } - | no_angle_bracket_const_expr '|' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '|' no_angle_bracket_const_expr { $$ = new CPPExpression('|', $1, $3) } - | no_angle_bracket_const_expr '&' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '&' no_angle_bracket_const_expr { $$ = new CPPExpression('&', $1, $3) } - | no_angle_bracket_const_expr OROR no_angle_bracket_const_expr + | no_angle_bracket_const_expr OROR no_angle_bracket_const_expr { $$ = new CPPExpression(OROR, $1, $3) } - | no_angle_bracket_const_expr ANDAND no_angle_bracket_const_expr + | no_angle_bracket_const_expr ANDAND no_angle_bracket_const_expr { $$ = new CPPExpression(ANDAND, $1, $3) } - | no_angle_bracket_const_expr EQCOMPARE no_angle_bracket_const_expr + | no_angle_bracket_const_expr EQCOMPARE no_angle_bracket_const_expr { $$ = new CPPExpression(EQCOMPARE, $1, $3) } - | no_angle_bracket_const_expr NECOMPARE no_angle_bracket_const_expr + | no_angle_bracket_const_expr NECOMPARE no_angle_bracket_const_expr { $$ = new CPPExpression(NECOMPARE, $1, $3) } - | no_angle_bracket_const_expr LECOMPARE no_angle_bracket_const_expr + | no_angle_bracket_const_expr LECOMPARE no_angle_bracket_const_expr { $$ = new CPPExpression(LECOMPARE, $1, $3) } - | no_angle_bracket_const_expr GECOMPARE no_angle_bracket_const_expr + | no_angle_bracket_const_expr GECOMPARE no_angle_bracket_const_expr { $$ = new CPPExpression(GECOMPARE, $1, $3) } - | no_angle_bracket_const_expr LSHIFT no_angle_bracket_const_expr + | no_angle_bracket_const_expr LSHIFT no_angle_bracket_const_expr { $$ = new CPPExpression(LSHIFT, $1, $3) } - | no_angle_bracket_const_expr RSHIFT no_angle_bracket_const_expr + | no_angle_bracket_const_expr RSHIFT no_angle_bracket_const_expr { $$ = new CPPExpression(RSHIFT, $1, $3) } - | no_angle_bracket_const_expr '?' no_angle_bracket_const_expr ':' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '?' no_angle_bracket_const_expr ':' no_angle_bracket_const_expr { $$ = new CPPExpression('?', $1, $3, $5) } - | no_angle_bracket_const_expr '[' const_expr ']' + | no_angle_bracket_const_expr '[' const_expr ']' { $$ = new CPPExpression('[', $1, $3); } - | no_angle_bracket_const_expr '(' const_expr_comma ')' + | no_angle_bracket_const_expr '(' const_expr_comma ')' { $$ = new CPPExpression('f', $1, $3); } - | no_angle_bracket_const_expr '(' ')' + | no_angle_bracket_const_expr '(' ')' { $$ = new CPPExpression('f', $1); } - | no_angle_bracket_const_expr '.' no_angle_bracket_const_expr + | no_angle_bracket_const_expr '.' no_angle_bracket_const_expr { $$ = new CPPExpression('.', $1, $3) } - | no_angle_bracket_const_expr POINTSAT no_angle_bracket_const_expr + | no_angle_bracket_const_expr POINTSAT no_angle_bracket_const_expr { $$ = new CPPExpression(POINTSAT, $1, $3) } - | '(' const_expr_comma ')' + | '(' const_expr_comma ')' { $$ = $2; } - ; - + ; + const_expr: - const_operand + const_operand { $$ = $1; } - | '(' full_type ')' const_expr %prec UNARY + | '(' full_type ')' const_expr %prec UNARY { $$ = new CPPExpression(CPPExpression::typecast_op($2, $4)); } - | KW_STATIC_CAST '<' full_type '>' '(' const_expr_comma ')' + | KW_STATIC_CAST '<' full_type '>' '(' const_expr_comma ')' { $$ = new CPPExpression(CPPExpression::typecast_op($3, $6)); } - | KW_DYNAMIC_CAST '<' full_type '>' '(' const_expr_comma ')' + | KW_DYNAMIC_CAST '<' full_type '>' '(' const_expr_comma ')' { $$ = new CPPExpression(CPPExpression::typecast_op($3, $6)); } - | TYPENAME_IDENTIFIER '(' optional_const_expr_comma ')' + | TYPENAME_IDENTIFIER '(' optional_const_expr_comma ')' { // A constructor call. CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer); assert(type != NULL); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_INT '(' optional_const_expr_comma ')' + | KW_INT '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_CHAR '(' optional_const_expr_comma ')' + | KW_CHAR '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_char)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_BOOL '(' optional_const_expr_comma ')' + | KW_BOOL '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_bool)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_SHORT '(' optional_const_expr_comma ')' + | KW_SHORT '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_short)); + CPPSimpleType::F_short)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_LONG '(' optional_const_expr_comma ')' + | KW_LONG '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_long)); + CPPSimpleType::F_long)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_UNSIGNED '(' optional_const_expr_comma ')' + | KW_UNSIGNED '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_unsigned)); + CPPSimpleType::F_unsigned)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_SIGNED '(' optional_const_expr_comma ')' + | KW_SIGNED '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_signed)); + CPPSimpleType::F_signed)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_FLOAT '(' optional_const_expr_comma ')' + | KW_FLOAT '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_float)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_DOUBLE '(' optional_const_expr_comma ')' + | KW_DOUBLE '(' optional_const_expr_comma ')' { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_double)); $$ = new CPPExpression(CPPExpression::construct_op(type, $3)); } - | KW_SIZEOF '(' full_type ')' %prec UNARY + | KW_SIZEOF '(' full_type ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::sizeof_func($3)); } - | KW_NEW predefined_type %prec UNARY + | KW_NEW predefined_type %prec UNARY { $$ = new CPPExpression(CPPExpression::new_op($2)); } - | KW_NEW predefined_type '(' optional_const_expr_comma ')' %prec UNARY + | KW_NEW predefined_type '(' optional_const_expr_comma ')' %prec UNARY { $$ = new CPPExpression(CPPExpression::new_op($2, $4)); } - | '!' const_expr %prec UNARY + | '!' const_expr %prec UNARY { $$ = new CPPExpression(UNARY_NOT, $2); } - | '~' const_expr %prec UNARY + | '~' const_expr %prec UNARY { $$ = new CPPExpression(UNARY_NEGATE, $2); } - | '-' const_expr %prec UNARY + | '-' const_expr %prec UNARY { if ($2->_type == CPPExpression::T_integer) { $$ = $2; @@ -2325,145 +2325,145 @@ const_expr: $$ = new CPPExpression(UNARY_MINUS, $2); } } - | '*' const_expr %prec UNARY + | '*' const_expr %prec UNARY { $$ = new CPPExpression(UNARY_STAR, $2); } - | '&' const_expr %prec UNARY + | '&' const_expr %prec UNARY { $$ = new CPPExpression(UNARY_REF, $2); } - | const_expr '*' const_expr + | const_expr '*' const_expr { $$ = new CPPExpression('*', $1, $3) } - | const_expr '/' const_expr + | const_expr '/' const_expr { $$ = new CPPExpression('/', $1, $3) } - | const_expr '%' const_expr + | const_expr '%' const_expr { $$ = new CPPExpression('%', $1, $3) } - | const_expr '+' const_expr + | const_expr '+' const_expr { $$ = new CPPExpression('+', $1, $3) } - | const_expr '-' const_expr + | const_expr '-' const_expr { $$ = new CPPExpression('-', $1, $3) } - | const_expr '|' const_expr + | const_expr '|' const_expr { $$ = new CPPExpression('|', $1, $3) } - | const_expr '&' const_expr + | const_expr '&' const_expr { $$ = new CPPExpression('&', $1, $3) } - | const_expr OROR const_expr + | const_expr OROR const_expr { $$ = new CPPExpression(OROR, $1, $3) } - | const_expr ANDAND const_expr + | const_expr ANDAND const_expr { $$ = new CPPExpression(ANDAND, $1, $3) } - | const_expr EQCOMPARE const_expr + | const_expr EQCOMPARE const_expr { $$ = new CPPExpression(EQCOMPARE, $1, $3) } - | const_expr NECOMPARE const_expr + | const_expr NECOMPARE const_expr { $$ = new CPPExpression(NECOMPARE, $1, $3) } - | const_expr LECOMPARE const_expr + | const_expr LECOMPARE const_expr { $$ = new CPPExpression(LECOMPARE, $1, $3) } - | const_expr GECOMPARE const_expr + | const_expr GECOMPARE const_expr { $$ = new CPPExpression(GECOMPARE, $1, $3) } - | const_expr '<' const_expr + | const_expr '<' const_expr { $$ = new CPPExpression('<', $1, $3) } - | const_expr '>' const_expr + | const_expr '>' const_expr { $$ = new CPPExpression('>', $1, $3) } - | const_expr LSHIFT const_expr + | const_expr LSHIFT const_expr { $$ = new CPPExpression(LSHIFT, $1, $3) } - | const_expr RSHIFT const_expr + | const_expr RSHIFT const_expr { $$ = new CPPExpression(RSHIFT, $1, $3) } - | const_expr '?' const_expr ':' const_expr + | const_expr '?' const_expr ':' const_expr { $$ = new CPPExpression('?', $1, $3, $5) } - | const_expr '[' const_expr ']' + | const_expr '[' const_expr ']' { $$ = new CPPExpression('[', $1, $3); } - | const_expr '(' const_expr_comma ')' + | const_expr '(' const_expr_comma ')' { $$ = new CPPExpression('f', $1, $3); } - | const_expr '(' ')' + | const_expr '(' ')' { $$ = new CPPExpression('f', $1); } - | const_expr '.' const_expr + | const_expr '.' const_expr { $$ = new CPPExpression('.', $1, $3) } - | const_expr POINTSAT const_expr + | const_expr POINTSAT const_expr { $$ = new CPPExpression(POINTSAT, $1, $3) } - | '(' const_expr_comma ')' + | '(' const_expr_comma ')' { $$ = $2; } - ; + ; const_operand: - INTEGER + INTEGER { $$ = new CPPExpression($1); } - | KW_TRUE + | KW_TRUE { $$ = new CPPExpression(true); } - | KW_FALSE + | KW_FALSE { $$ = new CPPExpression(false); } - | CHAR + | CHAR { $$ = new CPPExpression($1); } - | REAL + | REAL { $$ = new CPPExpression($1); } - | string + | string { $$ = new CPPExpression($1); } - | IDENTIFIER + | IDENTIFIER { $$ = new CPPExpression($1, current_scope, global_scope, current_lexer); } - ; + ; class_derivation_name: - name + name { CPPType *type = $1->find_type(current_scope, global_scope, true); if (type == NULL) { @@ -2471,7 +2471,7 @@ class_derivation_name: } $$ = type; } - | struct_keyword name + | struct_keyword name { CPPType *type = $2->find_type(current_scope, global_scope, true, current_lexer); if (type == NULL) { @@ -2479,49 +2479,49 @@ class_derivation_name: } $$ = type; } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - ; + ; -/* +/* typedefname: - TYPENAME_IDENTIFIER + TYPENAME_IDENTIFIER { CPPType *type = $1->find_type(current_scope, global_scope, false, current_lexer); assert(type != NULL); $$ = type; } - | KW_TYPENAME name + | KW_TYPENAME name { $$ = CPPType::new_type(new CPPTBDType($2)); } - ; + ; */ name: - IDENTIFIER + IDENTIFIER { $$ = $1; } - | TYPENAME_IDENTIFIER + | TYPENAME_IDENTIFIER { $$ = $1; } - ; + ; string: - STRING + STRING { $$ = $1; } - | string STRING + | string STRING { $$ = $1 + $2; } - ; + ; empty: - ; + ; diff --git a/dtool/src/cppparser/cppBisonDefs.h b/dtool/src/cppparser/cppBisonDefs.h index 825f19513e..ec86fbe239 100644 --- a/dtool/src/cppparser/cppBisonDefs.h +++ b/dtool/src/cppparser/cppBisonDefs.h @@ -37,11 +37,11 @@ class CPPIdentifier; void parse_cpp(CPPParser *cp); CPPExpression *parse_const_expr(CPPPreprocessor *pp, - CPPScope *new_current_scope, - CPPScope *new_global_scope); + CPPScope *new_current_scope, + CPPScope *new_global_scope); CPPType *parse_type(CPPPreprocessor *pp, - CPPScope *new_current_scope, - CPPScope *new_global_scope); + CPPScope *new_current_scope, + CPPScope *new_global_scope); extern CPPScope *current_scope; extern CPPScope *global_scope; diff --git a/dtool/src/cppparser/cppClassTemplateParameter.h b/dtool/src/cppparser/cppClassTemplateParameter.h index 622c0c9891..65ea2e3849 100644 --- a/dtool/src/cppparser/cppClassTemplateParameter.h +++ b/dtool/src/cppparser/cppClassTemplateParameter.h @@ -13,17 +13,17 @@ class CPPIdentifier; /////////////////////////////////////////////////////////////////// -// Class : CPPClassTemplateParameter +// Class : CPPClassTemplateParameter // Description : //////////////////////////////////////////////////////////////////// class CPPClassTemplateParameter : public CPPType { public: CPPClassTemplateParameter(CPPIdentifier *ident, - CPPType *default_type = NULL); + CPPType *default_type = NULL); virtual bool is_fully_specified() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPClassTemplateParameter *as_class_template_parameter(); diff --git a/dtool/src/cppparser/cppCommentBlock.h b/dtool/src/cppparser/cppCommentBlock.h index 122bde4ecd..6a996ff612 100644 --- a/dtool/src/cppparser/cppCommentBlock.h +++ b/dtool/src/cppparser/cppCommentBlock.h @@ -13,7 +13,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CPPCommentBlock +// Class : CPPCommentBlock // Description : This represents a comment appearing in the source // code. The CPPPreprocessor collects these, and saves // the complete list of comments encountered; it also diff --git a/dtool/src/cppparser/cppConstType.cxx b/dtool/src/cppparser/cppConstType.cxx index df991b3590..6b8d547cc6 100644 --- a/dtool/src/cppparser/cppConstType.cxx +++ b/dtool/src/cppparser/cppConstType.cxx @@ -39,7 +39,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPConstType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -132,10 +132,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { //////////////////////////////////////////////////////////////////// void CPPConstType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { _wrapped_around->output_instance(out, indent_level, scope, complete, - "const " + prename, name); + "const " + prename, name); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppConstType.h b/dtool/src/cppparser/cppConstType.h index b6361bf761..8708dc1b68 100644 --- a/dtool/src/cppparser/cppConstType.h +++ b/dtool/src/cppparser/cppConstType.h @@ -11,7 +11,7 @@ #include "cppType.h" /////////////////////////////////////////////////////////////////// -// Class : CPPConstType +// Class : CPPConstType // Description : //////////////////////////////////////////////////////////////////// class CPPConstType : public CPPType { @@ -22,21 +22,21 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppDeclaration.cxx b/dtool/src/cppparser/cppDeclaration.cxx index 43b1dfabb0..8411265ae0 100644 --- a/dtool/src/cppparser/cppDeclaration.cxx +++ b/dtool/src/cppparser/cppDeclaration.cxx @@ -125,8 +125,8 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPDeclaration:: instantiate(const CPPTemplateParameterList *, - CPPScope *, CPPScope *, - CPPPreprocessor *error_sink) const { + CPPScope *, CPPScope *, + CPPPreprocessor *error_sink) const { if (error_sink != NULL) { error_sink->warning("Ignoring template parameters"); } diff --git a/dtool/src/cppparser/cppDeclaration.h b/dtool/src/cppparser/cppDeclaration.h index 432d7dae7e..c0efd94e8e 100644 --- a/dtool/src/cppparser/cppDeclaration.h +++ b/dtool/src/cppparser/cppDeclaration.h @@ -45,7 +45,7 @@ class CPPTemplateScope; class CPPPreprocessor; /////////////////////////////////////////////////////////////////// -// Class : CPPDeclaration +// Class : CPPDeclaration // Description : //////////////////////////////////////////////////////////////////// class CPPDeclaration { @@ -89,19 +89,19 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration * instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; typedef map SubstDecl; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); typedef set Instantiations; Instantiations _instantiations; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const=0; + bool complete) const=0; virtual SubType get_subtype() const=0; diff --git a/dtool/src/cppparser/cppEnumType.cxx b/dtool/src/cppparser/cppEnumType.cxx index 7dcb94e3bb..2bbb6162e1 100644 --- a/dtool/src/cppparser/cppEnumType.cxx +++ b/dtool/src/cppparser/cppEnumType.cxx @@ -19,7 +19,7 @@ //////////////////////////////////////////////////////////////////// CPPEnumType:: CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope, - const CPPFile &file) : + const CPPFile &file) : CPPExtensionType(T_enum, ident, current_scope, file) { } @@ -33,7 +33,7 @@ void CPPEnumType:: add_element(const string &name, CPPScope *scope, CPPExpression *value) { CPPType *type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int, - CPPSimpleType::F_unsigned)); + CPPSimpleType::F_unsigned)); CPPIdentifier *ident = new CPPIdentifier(name); CPPInstance *inst = new CPPInstance(type, ident); inst->_initializer = value; @@ -59,7 +59,7 @@ is_incomplete() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPEnumType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -110,7 +110,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { for (ei = _elements.begin(); ei != _elements.end(); ++ei) { indent(out, indent_level + 2) << (*ei)->get_local_name(); if ((*ei)->_initializer != NULL) { - out << " = " << *(*ei)->_initializer; + out << " = " << *(*ei)->_initializer; } out << ",\n"; } diff --git a/dtool/src/cppparser/cppEnumType.h b/dtool/src/cppparser/cppEnumType.h index 9aaf6118a7..75dc17cb93 100644 --- a/dtool/src/cppparser/cppEnumType.h +++ b/dtool/src/cppparser/cppEnumType.h @@ -18,25 +18,25 @@ class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPEnumType +// Class : CPPEnumType // Description : //////////////////////////////////////////////////////////////////// class CPPEnumType : public CPPExtensionType { public: CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope, - const CPPFile &file); + const CPPFile &file); void add_element(const string &name, CPPScope *scope, - CPPExpression *value = (CPPExpression *)NULL); + CPPExpression *value = (CPPExpression *)NULL); virtual bool is_incomplete() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPEnumType *as_enum_type(); diff --git a/dtool/src/cppparser/cppExpression.cxx b/dtool/src/cppparser/cppExpression.cxx index 8c73cf0937..003e476e31 100644 --- a/dtool/src/cppparser/cppExpression.cxx +++ b/dtool/src/cppparser/cppExpression.cxx @@ -211,7 +211,7 @@ CPPExpression(const string &value) : //////////////////////////////////////////////////////////////////// CPPExpression:: CPPExpression(CPPIdentifier *ident, CPPScope *current_scope, - CPPScope *global_scope, CPPPreprocessor *error_sink) : + CPPScope *global_scope, CPPPreprocessor *error_sink) : CPPDeclaration(CPPFile()) { CPPDeclaration *decl = @@ -275,7 +275,7 @@ CPPExpression(int binary_operator, CPPExpression *op1, CPPExpression *op2) : //////////////////////////////////////////////////////////////////// CPPExpression:: CPPExpression(int trinary_operator, CPPExpression *op1, CPPExpression *op2, - CPPExpression *op3) : + CPPExpression *op3) : CPPDeclaration(CPPFile()) { _type = T_trinary_operation; @@ -401,15 +401,15 @@ evaluate() const { if (r1._type != RT_error) { CPPSimpleType *stype = _u._typecast._to->as_simple_type(); if (stype != NULL) { - if (stype->_type == CPPSimpleType::T_int) { - return Result(r1.as_integer()); - } else if (stype->_type == CPPSimpleType::T_float || - stype->_type == CPPSimpleType::T_double) { - return Result(r1.as_real()); - } + if (stype->_type == CPPSimpleType::T_int) { + return Result(r1.as_integer()); + } else if (stype->_type == CPPSimpleType::T_float || + stype->_type == CPPSimpleType::T_double) { + return Result(r1.as_real()); + } } if (_u._typecast._to->as_pointer_type()) { - return Result(r1.as_pointer()); + return Result(r1.as_pointer()); } } return Result(); @@ -433,7 +433,7 @@ evaluate() const { // In all other cases, both operands must be valid in order for // the operation to be valid. if (r2._type == RT_error && - (_u._op._operator != OROR && _u._op._operator != ANDAND)) { + (_u._op._operator != OROR && _u._op._operator != ANDAND)) { return r2; } // Fall through @@ -469,16 +469,16 @@ evaluate() const { case '*': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() * r2.as_real()); + return Result(r1.as_real() * r2.as_real()); } else { - return Result(r1.as_integer() * r2.as_integer()); + return Result(r1.as_integer() * r2.as_integer()); } case '/': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() / r2.as_real()); + return Result(r1.as_real() / r2.as_real()); } else { - return Result(r1.as_integer() / r2.as_integer()); + return Result(r1.as_integer() / r2.as_integer()); } case '%': @@ -486,16 +486,16 @@ evaluate() const { case '+': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() + r2.as_real()); + return Result(r1.as_real() + r2.as_real()); } else { - return Result(r1.as_integer() + r2.as_integer()); + return Result(r1.as_integer() + r2.as_integer()); } case '-': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() - r2.as_real()); + return Result(r1.as_real() - r2.as_real()); } else { - return Result(r1.as_integer() - r2.as_integer()); + return Result(r1.as_integer() - r2.as_integer()); } case '|': @@ -506,58 +506,58 @@ evaluate() const { case OROR: if (r1.as_integer()) { - return r1; + return r1; } else { - return r2; + return r2; } case ANDAND: if (r1.as_integer()) { - return r2; + return r2; } else { - return r1; + return r1; } case EQCOMPARE: if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() == r2.as_real()); + return Result(r1.as_real() == r2.as_real()); } else { - return Result(r1.as_integer() == r2.as_integer()); + return Result(r1.as_integer() == r2.as_integer()); } case NECOMPARE: if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() != r2.as_real()); + return Result(r1.as_real() != r2.as_real()); } else { - return Result(r1.as_integer() != r2.as_integer()); + return Result(r1.as_integer() != r2.as_integer()); } case LECOMPARE: if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() <= r2.as_real()); + return Result(r1.as_real() <= r2.as_real()); } else { - return Result(r1.as_integer() <= r2.as_integer()); + return Result(r1.as_integer() <= r2.as_integer()); } case GECOMPARE: if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() >= r2.as_real()); + return Result(r1.as_real() >= r2.as_real()); } else { - return Result(r1.as_integer() >= r2.as_integer()); + return Result(r1.as_integer() >= r2.as_integer()); } case '<': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() < r2.as_real()); + return Result(r1.as_real() < r2.as_real()); } else { - return Result(r1.as_integer() < r2.as_integer()); + return Result(r1.as_integer() < r2.as_integer()); } case '>': if (r1._type == RT_real || r2._type == RT_real) { - return Result(r1.as_real() > r2.as_real()); + return Result(r1.as_real() > r2.as_real()); } else { - return Result(r1.as_integer() > r2.as_integer()); + return Result(r1.as_integer() > r2.as_integer()); } case LSHIFT: @@ -568,7 +568,7 @@ evaluate() const { case '?': return r1.as_integer() ? - _u._op._op2->evaluate() : _u._op._op3->evaluate(); + _u._op._op2->evaluate() : _u._op._op3->evaluate(); case '.': case POINTSAT: @@ -633,10 +633,10 @@ determine_type() const { case T_string: return char_star_type; - + case T_variable: return _u._variable->_type; - + case T_function: if (_u._fgroup->get_return_type() == (CPPType *)NULL) { // There are multiple functions by this name that have different @@ -685,12 +685,12 @@ determine_type() const { case UNARY_STAR: case '[': // Array element reference if (t1 != NULL) { - if (t1->as_pointer_type()) { - return t1->as_pointer_type()->_pointing_at; - } - if (t1->as_array_type()) { - return t1->as_array_type()->_element_type; - } + if (t1->as_pointer_type()) { + return t1->as_pointer_type()->_pointing_at; + } + if (t1->as_array_type()) { + return t1->as_array_type()->_element_type; + } } return NULL; @@ -702,14 +702,14 @@ determine_type() const { case '+': case '-': if (t1 == NULL) { - return t2; + return t2; } else if (t2 == NULL) { - return t1; + return t1; } else if (t1->as_pointer_type()) { - if (t2->as_pointer_type()) { - return int_type; - } - return t1; + if (t2->as_pointer_type()) { + return int_type; + } + return t1; } return elevate_type(t1, t2); @@ -739,10 +739,10 @@ determine_type() const { case 'f': // Function evaluation if (t1 != NULL) { - CPPFunctionType *ftype = t1->as_function_type(); - if (ftype != (CPPFunctionType *)NULL) { - return ftype->_return_type; - } + CPPFunctionType *ftype = t1->as_function_type(); + if (ftype != (CPPFunctionType *)NULL) { + return ftype->_return_type; + } } return NULL; @@ -769,7 +769,7 @@ determine_type() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPExpression:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPDeclaration *top = CPPDeclaration::substitute_decl(subst, current_scope, global_scope); if (top != this) { @@ -785,14 +785,14 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, decl = _u._variable->substitute_decl(subst, current_scope, global_scope); if (decl != rep->_u._variable) { if (decl->as_instance()) { - // Replacing the variable reference with another variable reference. - rep->_u._variable = decl->as_instance(); - any_changed = true; + // Replacing the variable reference with another variable reference. + rep->_u._variable = decl->as_instance(); + any_changed = true; } else if (decl->as_expression()) { - // Replacing the variable reference with an expression. - delete rep; - rep = decl->as_expression(); - any_changed = true; + // Replacing the variable reference with an expression. + delete rep; + rep = decl->as_expression(); + any_changed = true; } } break; @@ -914,35 +914,35 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { { string::const_iterator si; for (si = _str.begin(); si != _str.end(); ++si) { - switch (*si) { - case '\n': - out << "\\n"; - break; - - case '\t': - out << "\\t"; - break; - - case '\r': - out << "\\r"; - break; - - case '\a': - out << "\\a"; - break; - - case '"': - out << "\\\""; - break; + switch (*si) { + case '\n': + out << "\\n"; + break; - default: - if (isprint(*si)) { - out << *si; - } else { - out << '\\' << oct << setw(3) << setfill('0') << (int)(*si) - << dec << setw(0); - } - } + case '\t': + out << "\\t"; + break; + + case '\r': + out << "\\r"; + break; + + case '\a': + out << "\\a"; + break; + + case '"': + out << "\\\""; + break; + + default: + if (isprint(*si)) { + out << *si; + } else { + out << '\\' << oct << setw(3) << setfill('0') << (int)(*si) + << dec << setw(0); + } + } } } out << '"'; @@ -968,7 +968,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { case T_construct: out << "(" << _u._typecast._to->get_typedef_name(scope) - << "(" << *_u._typecast._op1 << "))"; + << "(" << *_u._typecast._op1 << "))"; break; case T_default_construct: @@ -977,7 +977,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { case T_new: out << "(new " << *_u._typecast._to - << "(" << *_u._typecast._op1 << "))"; + << "(" << *_u._typecast._op1 << "))"; break; case T_default_new: @@ -1078,13 +1078,13 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { default: out << "(" << *_u._op._op1 << " " << (char)_u._op._operator - << " " << *_u._op._op2 << ")"; + << " " << *_u._op._op2 << ")"; } break; case T_trinary_operation: out << "(" << *_u._op._op1 << " ? " << *_u._op._op2 - << " : " << *_u._op._op3 << ")"; + << " : " << *_u._op._op3 << ")"; break; default: @@ -1151,7 +1151,7 @@ elevate_type(CPPType *t1, CPPType *t2) { st1->_type == CPPSimpleType::T_double) { return st1; } else if (st2->_type == CPPSimpleType::T_float || - st2->_type == CPPSimpleType::T_double) { + st2->_type == CPPSimpleType::T_double) { return st2; } else if (st1->_type == CPPSimpleType::T_int) { return st1; diff --git a/dtool/src/cppparser/cppExpression.h b/dtool/src/cppparser/cppExpression.h index bee8a4da05..6d899eb7d6 100644 --- a/dtool/src/cppparser/cppExpression.h +++ b/dtool/src/cppparser/cppExpression.h @@ -16,7 +16,7 @@ class CPPPreprocessor; class CPPFunctionGroup; /////////////////////////////////////////////////////////////////// -// Class : CPPExpression +// Class : CPPExpression // Description : //////////////////////////////////////////////////////////////////// class CPPExpression : public CPPDeclaration { @@ -25,7 +25,7 @@ public: CPPExpression(const string &value); CPPExpression(double value); CPPExpression(CPPIdentifier *ident, CPPScope *current_scope, - CPPScope *global_scope, CPPPreprocessor *error_sink = NULL); + CPPScope *global_scope, CPPPreprocessor *error_sink = NULL); CPPExpression(int unary_operator, CPPExpression *op1); CPPExpression(int binary_operator, CPPExpression *op1, CPPExpression *op2); CPPExpression(int trinary_operator, CPPExpression *op1, CPPExpression *op2, CPPExpression *op3); @@ -70,11 +70,11 @@ public: bool is_tbd() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPExpression *as_expression(); diff --git a/dtool/src/cppparser/cppExpressionParser.h b/dtool/src/cppparser/cppExpressionParser.h index be8cd380fe..186312b05b 100644 --- a/dtool/src/cppparser/cppExpressionParser.h +++ b/dtool/src/cppparser/cppExpressionParser.h @@ -14,7 +14,7 @@ class CPPExpression; class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPExpressionParser +// Class : CPPExpressionParser // Description : //////////////////////////////////////////////////////////////////// class CPPExpressionParser : public CPPPreprocessor { diff --git a/dtool/src/cppparser/cppExtensionType.cxx b/dtool/src/cppparser/cppExtensionType.cxx index 16374bd1ca..4a35a226c0 100644 --- a/dtool/src/cppparser/cppExtensionType.cxx +++ b/dtool/src/cppparser/cppExtensionType.cxx @@ -17,8 +17,8 @@ //////////////////////////////////////////////////////////////////// CPPExtensionType:: CPPExtensionType(CPPExtensionType::Type type, - CPPIdentifier *ident, CPPScope *current_scope, - const CPPFile &file) : + CPPIdentifier *ident, CPPScope *current_scope, + const CPPFile &file) : CPPType(file), _type(type), _ident(ident) { @@ -100,7 +100,7 @@ is_tbd() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPExtensionType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; diff --git a/dtool/src/cppparser/cppExtensionType.h b/dtool/src/cppparser/cppExtensionType.h index 166c90f194..a28395ba9c 100644 --- a/dtool/src/cppparser/cppExtensionType.h +++ b/dtool/src/cppparser/cppExtensionType.h @@ -15,7 +15,7 @@ class CPPScope; class CPPIdentifier; /////////////////////////////////////////////////////////////////// -// Class : CPPExtensionType +// Class : CPPExtensionType // Description : //////////////////////////////////////////////////////////////////// class CPPExtensionType : public CPPType { @@ -28,7 +28,7 @@ public: }; CPPExtensionType(Type type, CPPIdentifier *ident, CPPScope *current_scope, - const CPPFile &file); + const CPPFile &file); virtual string get_simple_name() const; virtual string get_local_name(CPPScope *scope = NULL) const; @@ -38,14 +38,14 @@ public: virtual bool is_tbd() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPExtensionType *as_extension_type(); diff --git a/dtool/src/cppparser/cppFile.cxx b/dtool/src/cppparser/cppFile.cxx index 3ec0507fc9..b405a9f6b3 100644 --- a/dtool/src/cppparser/cppFile.cxx +++ b/dtool/src/cppparser/cppFile.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// CPPFile:: CPPFile(const Filename &filename, const Filename &filename_as_referenced, - Source source) : + Source source) : _filename(filename), _filename_as_referenced(filename_as_referenced), _source(source) { @@ -90,8 +90,8 @@ is_c_or_i_file(const Filename &filename) { } return (extension == "c" || extension == "cc" || - extension == "cpp" || extension == "c++" || extension == "cxx" || - extension == "i" || extension == "t"); + extension == "cpp" || extension == "c++" || extension == "cxx" || + extension == "i" || extension == "t"); } //////////////////////////////////////////////////////////////////// @@ -126,7 +126,7 @@ is_c_file(const Filename &filename) { } return (extension == "c" || extension == "cc" || - extension == "cpp" || extension == "c++" || extension == "cxx"); + extension == "cpp" || extension == "c++" || extension == "cxx"); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppFile.h b/dtool/src/cppparser/cppFile.h index aa3fff3607..386b86b16f 100644 --- a/dtool/src/cppparser/cppFile.h +++ b/dtool/src/cppparser/cppFile.h @@ -10,7 +10,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CPPFile +// Class : CPPFile // Description : This defines a source file (typically a C++ header // file) that is parsed by the CPPParser. Each // declaration indicates the source file where it @@ -26,8 +26,8 @@ public: }; CPPFile(const Filename &filename = "", - const Filename &filename_as_referenced = "", - Source source = S_none); + const Filename &filename_as_referenced = "", + Source source = S_none); CPPFile(const CPPFile ©); void operator = (const CPPFile ©); ~CPPFile(); diff --git a/dtool/src/cppparser/cppFunctionGroup.cxx b/dtool/src/cppparser/cppFunctionGroup.cxx index 292dedbe7c..d9deefed94 100644 --- a/dtool/src/cppparser/cppFunctionGroup.cxx +++ b/dtool/src/cppparser/cppFunctionGroup.cxx @@ -48,7 +48,7 @@ get_return_type() const { ++ii; while (ii != _instances.end()) { if ((*ii)->_type->as_function_type()->_return_type != return_type) { - return (CPPType *)NULL; + return (CPPType *)NULL; } ++ii; } diff --git a/dtool/src/cppparser/cppFunctionGroup.h b/dtool/src/cppparser/cppFunctionGroup.h index e4c1851dd5..419fb47164 100644 --- a/dtool/src/cppparser/cppFunctionGroup.h +++ b/dtool/src/cppparser/cppFunctionGroup.h @@ -13,7 +13,7 @@ class CPPInstance; /////////////////////////////////////////////////////////////////// -// Class : CPPFunctionGroup +// Class : CPPFunctionGroup // Description : This class is simply a container for one or more // CPPInstances for functions of the same name. It's // handy for storing in the CPPScope, so that @@ -29,7 +29,7 @@ public: CPPType *get_return_type() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPFunctionGroup *as_function_group(); diff --git a/dtool/src/cppparser/cppFunctionType.cxx b/dtool/src/cppparser/cppFunctionType.cxx index 8b273c5173..1c1a8c0aeb 100644 --- a/dtool/src/cppparser/cppFunctionType.cxx +++ b/dtool/src/cppparser/cppFunctionType.cxx @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// CPPFunctionType:: CPPFunctionType(CPPType *return_type, CPPParameterList *parameters, - int flags) : + int flags) : CPPType(CPPFile()), _return_type(return_type), _parameters(parameters), @@ -86,7 +86,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPFunctionType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -192,8 +192,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete, //////////////////////////////////////////////////////////////////// void CPPFunctionType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { output_instance(out, indent_level, scope, complete, prename, name, -1); } @@ -209,8 +209,8 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, //////////////////////////////////////////////////////////////////// void CPPFunctionType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name, int num_default_parameters) const { + bool complete, const string &prename, + const string &name, int num_default_parameters) const { ostringstream parm_string; parm_string << "("; _parameters->output(parm_string, scope, true, num_default_parameters); @@ -224,10 +224,10 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, } else { if (prename.empty()) { _return_type->output_instance(out, indent_level, scope, complete, - "", prename + name + str); + "", prename + name + str); } else { _return_type->output_instance(out, indent_level, scope, complete, - "", "(" + prename + name + ")" + str); + "", "(" + prename + name + ")" + str); } } diff --git a/dtool/src/cppparser/cppFunctionType.h b/dtool/src/cppparser/cppFunctionType.h index 335276fa8f..4b0a3d12d4 100644 --- a/dtool/src/cppparser/cppFunctionType.h +++ b/dtool/src/cppparser/cppFunctionType.h @@ -14,7 +14,7 @@ class CPPParameterList; class CPPIdentifier; /////////////////////////////////////////////////////////////////// -// Class : CPPFunctionType +// Class : CPPFunctionType // Description : //////////////////////////////////////////////////////////////////// class CPPFunctionType : public CPPType { @@ -28,7 +28,7 @@ public: }; CPPFunctionType(CPPType *return_type, CPPParameterList *parameters, - int flags); + int flags); CPPFunctionType(const CPPFunctionType ©); void operator = (const CPPFunctionType ©); @@ -38,27 +38,27 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; void output(ostream &out, int indent_level, CPPScope *scope, - bool complete, int num_default_parameters) const; + bool complete, int num_default_parameters) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name, - int num_default_parameters) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name, + int num_default_parameters) const; int get_num_default_parameters() const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppIdentifier.cxx b/dtool/src/cppparser/cppIdentifier.cxx index f370a49ba6..1837c404e6 100644 --- a/dtool/src/cppparser/cppIdentifier.cxx +++ b/dtool/src/cppparser/cppIdentifier.cxx @@ -151,7 +151,7 @@ get_local_name(CPPScope *scope) const { } else { result = my_scope->get_local_name(scope); if (!result.empty()) { - result += "::"; + result += "::"; } result += _names.back().get_name_with_templ(scope); } @@ -223,7 +223,7 @@ is_tbd() const { //////////////////////////////////////////////////////////////////// CPPScope *CPPIdentifier:: get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { assert(!_names.empty()); CPPScope *scope = _native_scope; @@ -243,15 +243,15 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope, CPPScope *next_scope = scope->find_scope(_names[i].get_name()); if (next_scope == (CPPScope *)NULL) { if (error_sink != NULL) { - error_sink->error("Symbol " + _names[i].get_name() + - " is not a known scope in " + - scope->get_fully_scoped_name()); + error_sink->error("Symbol " + _names[i].get_name() + + " is not a known scope in " + + scope->get_fully_scoped_name()); } return (CPPScope *)NULL; } if (_names[i].has_templ()) { next_scope = next_scope->instantiate(_names[i].get_templ(), - current_scope, global_scope); + current_scope, global_scope); } scope = next_scope; i++; @@ -267,8 +267,8 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPScope *CPPIdentifier:: get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPDeclaration::SubstDecl &subst, - CPPPreprocessor *error_sink) const { + CPPDeclaration::SubstDecl &subst, + CPPPreprocessor *error_sink) const { assert(!_names.empty()); CPPScope *scope = _native_scope; @@ -286,18 +286,18 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope, while (i + 1 < (int)_names.size() && scope != NULL) { CPPScope *next_scope = scope->find_scope(_names[i].get_name(), subst, - global_scope); + global_scope); if (next_scope == (CPPScope *)NULL) { if (error_sink != NULL) { - error_sink->error("Symbol " + _names[i].get_name() + - " is not a known scope in " + - scope->get_fully_scoped_name()); + error_sink->error("Symbol " + _names[i].get_name() + + " is not a known scope in " + + scope->get_fully_scoped_name()); } return (CPPScope *)NULL; } if (_names[i].has_templ()) { next_scope = next_scope->instantiate(_names[i].get_templ(), - current_scope, global_scope); + current_scope, global_scope); } scope = next_scope; i++; @@ -321,8 +321,8 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPType *CPPIdentifier:: find_type(CPPScope *current_scope, CPPScope *global_scope, - bool force_instantiate, - CPPPreprocessor *error_sink) const { + bool force_instantiate, + CPPPreprocessor *error_sink) const { CPPScope *scope = get_scope(current_scope, global_scope, error_sink); if (scope == NULL) { return NULL; @@ -338,18 +338,18 @@ find_type(CPPScope *current_scope, CPPScope *global_scope, /* if (type != NULL) { if (!type->is_incomplete() || force_instantiate) { - type = type->instantiate(_names.back().get_templ(), - current_scope, global_scope, - error_sink)->as_type(); - - // If we ended up with another template, instantiate later. - if (type->is_template() && !force_instantiate) { - type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); - } - + type = type->instantiate(_names.back().get_templ(), + current_scope, global_scope, + error_sink)->as_type(); + + // If we ended up with another template, instantiate later. + if (type->is_template() && !force_instantiate) { + type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); + } + } else { - // Otherwise, we'll have to instantiate the type later. - type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); + // Otherwise, we'll have to instantiate the type later. + type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); } // type->_file.replace_nearer(_file); } @@ -367,8 +367,8 @@ find_type(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPType *CPPIdentifier:: find_type(CPPScope *current_scope, CPPScope *global_scope, - CPPDeclaration::SubstDecl &subst, - CPPPreprocessor *error_sink) const { + CPPDeclaration::SubstDecl &subst, + CPPPreprocessor *error_sink) const { CPPScope *scope = get_scope(current_scope, global_scope, subst, error_sink); if (scope == NULL) { return NULL; @@ -381,17 +381,17 @@ find_type(CPPScope *current_scope, CPPScope *global_scope, // If our identifier fully specifies the instantiation, then // apply it. CPPDeclaration *decl = - type->instantiate(_names.back().get_templ(), - current_scope, global_scope, - error_sink); + type->instantiate(_names.back().get_templ(), + current_scope, global_scope, + error_sink); assert(decl != NULL); CPPType *new_type = decl->as_type(); assert(new_type != NULL); - if (new_type == type) { - type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); - // type = new_type; + if (new_type == type) { + type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); + // type = new_type; } else { - type = new_type; + type = new_type; } } else { // Otherwise, we'll have to instantiate the type later. @@ -410,7 +410,7 @@ find_type(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPIdentifier:: find_symbol(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { CPPScope *scope = get_scope(current_scope, global_scope, error_sink); if (scope == NULL) { return NULL; @@ -424,12 +424,12 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope, if (sym != NULL) { CPPType *type = sym->as_type(); if (type != NULL && type->is_incomplete()) { - // We can't instantiate an incomplete type. - sym = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); + // We can't instantiate an incomplete type. + sym = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this)); } else { - // Instantiate the symbol. - sym = sym->instantiate(_names.back().get_templ(), current_scope, - global_scope, error_sink); + // Instantiate the symbol. + sym = sym->instantiate(_names.back().get_templ(), current_scope, + global_scope, error_sink); } } } @@ -444,7 +444,7 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPIdentifier:: find_template(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { CPPScope *scope = get_scope(current_scope, global_scope, error_sink); if (scope == NULL) { return NULL; @@ -459,7 +459,7 @@ find_template(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPScope *CPPIdentifier:: find_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { CPPScope *scope = get_scope(current_scope, global_scope, error_sink); if (scope == NULL) { return NULL; @@ -475,16 +475,16 @@ find_scope(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPIdentifier *CPPIdentifier:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPIdentifier *rep = new CPPIdentifier(*this); bool anything_changed = false; for (int i = 0; i < (int)rep->_names.size(); i++) { if (_names[i].has_templ()) { rep->_names[i].set_templ - (_names[i].get_templ()->substitute_decl(subst, current_scope, global_scope)); + (_names[i].get_templ()->substitute_decl(subst, current_scope, global_scope)); if (rep->_names[i].get_templ() != _names[i].get_templ()) { - anything_changed = true; + anything_changed = true; } } } diff --git a/dtool/src/cppparser/cppIdentifier.h b/dtool/src/cppparser/cppIdentifier.h index 9d47d6fedf..0f26436e89 100644 --- a/dtool/src/cppparser/cppIdentifier.h +++ b/dtool/src/cppparser/cppIdentifier.h @@ -21,7 +21,7 @@ class CPPPreprocessor; class CPPTemplateParameterList; /////////////////////////////////////////////////////////////////// -// Class : CPPIdentifier +// Class : CPPIdentifier // Description : //////////////////////////////////////////////////////////////////// class CPPIdentifier { @@ -46,30 +46,30 @@ public: CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPPreprocessor *error_sink = NULL) const; CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPDeclaration::SubstDecl &subst, - CPPPreprocessor *error_sink = NULL) const; + CPPDeclaration::SubstDecl &subst, + CPPPreprocessor *error_sink = NULL) const; CPPType *find_type(CPPScope *current_scope, CPPScope *global_scope, - bool force_instantiate = false, - CPPPreprocessor *error_sink = NULL) const; + bool force_instantiate = false, + CPPPreprocessor *error_sink = NULL) const; CPPType *find_type(CPPScope *current_scope, CPPScope *global_scope, - CPPDeclaration::SubstDecl &subst, - CPPPreprocessor *error_sink = NULL) const; + CPPDeclaration::SubstDecl &subst, + CPPPreprocessor *error_sink = NULL) const; CPPDeclaration *find_symbol(CPPScope *current_scope, - CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; CPPDeclaration *find_template(CPPScope *current_scope, - CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; CPPScope *find_scope(CPPScope *current_scope, - CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; CPPIdentifier *substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); void output(ostream &out, CPPScope *scope) const; void output_local_name(ostream &out, CPPScope *scope) const; diff --git a/dtool/src/cppparser/cppInstance.cxx b/dtool/src/cppparser/cppInstance.cxx index 5be002fb32..b379cc8b84 100644 --- a/dtool/src/cppparser/cppInstance.cxx +++ b/dtool/src/cppparser/cppInstance.cxx @@ -59,7 +59,7 @@ CPPInstance(CPPType *type, CPPIdentifier *ident, int storage_class) : //////////////////////////////////////////////////////////////////// CPPInstance:: CPPInstance(CPPType *type, CPPInstanceIdentifier *ii, int storage_class, - const CPPFile &file) : + const CPPFile &file) : CPPDeclaration(file) { _type = ii->unroll_type(type); @@ -107,7 +107,7 @@ CPPInstance:: //////////////////////////////////////////////////////////////////// CPPInstance *CPPInstance:: make_typecast_function(CPPInstance *inst, CPPIdentifier *ident, - CPPParameterList *parameters, int function_flags) { + CPPParameterList *parameters, int function_flags) { CPPType *type = CPPType::new_type(inst->_type); delete inst; @@ -252,7 +252,7 @@ is_scoped() const { //////////////////////////////////////////////////////////////////// CPPScope *CPPInstance:: get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { if (_ident == NULL) { return current_scope; } else { @@ -323,20 +323,20 @@ check_for_constructor(CPPScope *current_scope, CPPScope *global_scope) { if (!method_name.empty() && !class_name.empty()) { if (method_name == class_name) { - CPPType *void_type = CPPType::new_type - (new CPPSimpleType(CPPSimpleType::T_void)); + CPPType *void_type = CPPType::new_type + (new CPPSimpleType(CPPSimpleType::T_void)); - _type = CPPType::new_type - (new CPPFunctionType(void_type, func->_parameters, - func->_flags | CPPFunctionType::F_constructor)); + _type = CPPType::new_type + (new CPPFunctionType(void_type, func->_parameters, + func->_flags | CPPFunctionType::F_constructor)); } else if (method_name == "~" + class_name) { - CPPType *void_type = CPPType::new_type - (new CPPSimpleType(CPPSimpleType::T_void)); + CPPType *void_type = CPPType::new_type + (new CPPSimpleType(CPPSimpleType::T_void)); - _type = CPPType::new_type - (new CPPFunctionType(void_type, func->_parameters, - func->_flags | CPPFunctionType::F_destructor)); + _type = CPPType::new_type + (new CPPFunctionType(void_type, func->_parameters, + func->_flags | CPPFunctionType::F_destructor)); } } } @@ -349,12 +349,12 @@ check_for_constructor(CPPScope *current_scope, CPPScope *global_scope) { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPInstance:: instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink) const { if (!is_template()) { if (error_sink != NULL) { error_sink->warning("Ignoring template parameters for instance " + - _ident->get_local_name()); + _ident->get_local_name()); } return (CPPInstance *)this; } @@ -372,7 +372,7 @@ instantiate(const CPPTemplateParameterList *actual_params, CPPDeclaration::SubstDecl subst; actual_params->build_subst_decl(tscope->_parameters, subst, - current_scope, global_scope); + current_scope, global_scope); CPPInstance *inst = ((CPPInstance *)this)->substitute_decl(subst, current_scope, global_scope) @@ -423,7 +423,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPInstance:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPDeclaration *top = CPPDeclaration::substitute_decl(subst, current_scope, global_scope); if (top != this) { @@ -517,7 +517,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete, if (_type->as_function_type()) { _type->as_function_type()-> output_instance(out, indent_level, scope, complete, "", name, - num_default_parameters); + num_default_parameters); } else { _type->output_instance(out, indent_level, scope, complete, "", name); } diff --git a/dtool/src/cppparser/cppInstance.h b/dtool/src/cppparser/cppInstance.h index 1a621c3216..9e55b09a2b 100644 --- a/dtool/src/cppparser/cppInstance.h +++ b/dtool/src/cppparser/cppInstance.h @@ -20,7 +20,7 @@ class CPPScope; class CPPExpression; /////////////////////////////////////////////////////////////////// -// Class : CPPInstance +// Class : CPPInstance // Description : //////////////////////////////////////////////////////////////////// class CPPInstance : public CPPDeclaration { @@ -46,13 +46,13 @@ public: CPPInstance(CPPType *type, const string &name, int storage_class = 0); CPPInstance(CPPType *type, CPPIdentifier *ident, int storage_class = 0); CPPInstance(CPPType *type, CPPInstanceIdentifier *ii, - int storage_class, const CPPFile &file); + int storage_class, const CPPFile &file); CPPInstance(const CPPInstance ©); ~CPPInstance(); static CPPInstance * make_typecast_function(CPPInstance *inst, CPPIdentifier *ident, - CPPParameterList *parameters, int function_flags); + CPPParameterList *parameters, int function_flags); bool operator == (const CPPInstance &other) const; bool operator != (const CPPInstance &other) const; @@ -62,7 +62,7 @@ public: bool is_scoped() const; CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPPreprocessor *error_sink = NULL) const; string get_simple_name() const; string get_local_name(CPPScope *scope = NULL) const; @@ -72,18 +72,18 @@ public: virtual CPPDeclaration * instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; void output(ostream &out, int indent_level, CPPScope *scope, - bool complete, int num_default_parameters) const; + bool complete, int num_default_parameters) const; virtual SubType get_subtype() const; virtual CPPInstance *as_instance(); diff --git a/dtool/src/cppparser/cppInstanceIdentifier.cxx b/dtool/src/cppparser/cppInstanceIdentifier.cxx index 5c6048604c..4d1f83dbbc 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.cxx +++ b/dtool/src/cppparser/cppInstanceIdentifier.cxx @@ -132,7 +132,7 @@ add_array_modifier(CPPExpression *expr) { //////////////////////////////////////////////////////////////////// CPPScope *CPPInstanceIdentifier:: get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPPreprocessor *error_sink) const { if (_ident == NULL) { return current_scope; } else { @@ -147,7 +147,7 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope, //////////////////////////////////////////////////////////////////// CPPType *CPPInstanceIdentifier:: r_unroll_type(CPPType *start_type, - CPPInstanceIdentifier::Modifiers::const_iterator mi) { + CPPInstanceIdentifier::Modifiers::const_iterator mi) { start_type = CPPType::new_type(start_type); if (mi == _modifiers.end()) { @@ -173,10 +173,10 @@ r_unroll_type(CPPType *start_type, CPPType *type = r_unroll_type(start_type, mi); CPPFunctionType *ftype = type->as_function_type(); if (ftype != NULL) { - ftype = new CPPFunctionType(*ftype); - ftype->_class_owner = mod._scoping; - ftype->_flags |= CPPFunctionType::F_method_pointer; - type = ftype; + ftype = new CPPFunctionType(*ftype); + ftype->_class_owner = mod._scoping; + ftype->_flags |= CPPFunctionType::F_method_pointer; + type = ftype; } result = new CPPPointerType(type); } @@ -184,7 +184,7 @@ r_unroll_type(CPPType *start_type, case IIT_array: result = new CPPArrayType(r_unroll_type(start_type, mi), - mod._expr); + mod._expr); break; case IIT_const: @@ -199,7 +199,7 @@ r_unroll_type(CPPType *start_type, { CPPType *return_type = r_unroll_type(start_type, mi); result = new CPPFunctionType(return_type, mod._func_params, - mod._func_flags); + mod._func_flags); } break; diff --git a/dtool/src/cppparser/cppInstanceIdentifier.h b/dtool/src/cppparser/cppInstanceIdentifier.h index 531e79bd3b..94b2f090f4 100644 --- a/dtool/src/cppparser/cppInstanceIdentifier.h +++ b/dtool/src/cppparser/cppInstanceIdentifier.h @@ -31,7 +31,7 @@ enum CPPInstanceIdentifierType { }; /////////////////////////////////////////////////////////////////// -// Class : CPPInstanceIdentifier +// Class : CPPInstanceIdentifier // Description : This class is used in parser.y to build up a variable // instance definition. An instance is something like // 'int *&a'; the InstanceIdentifier stores everything @@ -50,7 +50,7 @@ public: void add_array_modifier(CPPExpression *expr); CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPPreprocessor *error_sink = NULL) const; CPPIdentifier *_ident; diff --git a/dtool/src/cppparser/cppManifest.cxx b/dtool/src/cppparser/cppManifest.cxx index 7d78e7d617..a890efda0e 100644 --- a/dtool/src/cppparser/cppManifest.cxx +++ b/dtool/src/cppparser/cppManifest.cxx @@ -103,9 +103,9 @@ expand(const vector_string &args) const { if ((*ei)._parm_number >= 0) { int i = (*ei)._parm_number; if (i < (int)args.size()) { - result += " " + args[i] + " "; + result += " " + args[i] + " "; } else { - result += " "; + result += " "; } } if (!(*ei)._str.empty()) { @@ -144,7 +144,7 @@ output(ostream &out) const { if (_num_parameters > 0) { out << "$1"; for (int i = 1; i < _num_parameters; i++) { - out << ", $" << i + 1; + out << ", $" << i + 1; } } out << ")"; @@ -172,7 +172,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// void CPPManifest:: parse_parameters(const string &args, size_t &p, - vector_string ¶meter_names) { + vector_string ¶meter_names) { assert(p < args.size()); assert(args[p] == '('); @@ -185,7 +185,7 @@ parse_parameters(const string &args, size_t &p, // Here's the beginning of a parm. size_t q = p; while (p < args.size() && !isspace(args[p]) && - args[p] != ')' && args[p] != ',') { + args[p] != ')' && args[p] != ',') { p++; } parameter_names.push_back(args.substr(q, p - q)); @@ -199,7 +199,7 @@ parse_parameters(const string &args, size_t &p, p++; // Skip whitespace after a comma. while (p < args.size() && isspace(args[p])) { - p++; + p++; } } } @@ -228,7 +228,7 @@ save_expansion(const string &exp, const vector_string ¶meter_names) { size_t q = p; p++; while (p < exp.size() && isalnum(exp[p]) || exp[p] == '_') { - p++; + p++; } string ident = exp.substr(q, p - q); @@ -236,18 +236,18 @@ save_expansion(const string &exp, const vector_string ¶meter_names) { // Is this identifier one of our parameters? int pnum = -1; for (int i = 0; pnum == -1 && i < (int)parameter_names.size(); i++) { - if (parameter_names[i] == ident) { - pnum = i; - } + if (parameter_names[i] == ident) { + pnum = i; + } } if (pnum != -1) { - // Yep! - if (last != q) { - _expansion.push_back(ExpansionNode(exp.substr(last, q - last))); - } - _expansion.push_back(pnum); - last = p; + // Yep! + if (last != q) { + _expansion.push_back(ExpansionNode(exp.substr(last, q - last))); + } + _expansion.push_back(pnum); + last = p; } } else { p++; diff --git a/dtool/src/cppparser/cppManifest.h b/dtool/src/cppparser/cppManifest.h index 2d4ccc2701..30ea437036 100644 --- a/dtool/src/cppparser/cppManifest.h +++ b/dtool/src/cppparser/cppManifest.h @@ -17,7 +17,7 @@ class CPPExpression; class CPPType; /////////////////////////////////////////////////////////////////// -// Class : CPPManifest +// Class : CPPManifest // Description : //////////////////////////////////////////////////////////////////// class CPPManifest { @@ -44,9 +44,9 @@ public: private: void parse_parameters(const string &args, size_t &p, - vector_string ¶meter_names); + vector_string ¶meter_names); void save_expansion(const string &exp, - const vector_string ¶meter_names); + const vector_string ¶meter_names); class ExpansionNode { public: diff --git a/dtool/src/cppparser/cppNamespace.h b/dtool/src/cppparser/cppNamespace.h index fbf1907593..41fb7c931d 100644 --- a/dtool/src/cppparser/cppNamespace.h +++ b/dtool/src/cppparser/cppNamespace.h @@ -14,13 +14,13 @@ class CPPIdentifier; class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPNamespace +// Class : CPPNamespace // Description : //////////////////////////////////////////////////////////////////// class CPPNamespace : public CPPDeclaration { public: CPPNamespace(CPPIdentifier *ident, CPPScope *scope, - const CPPFile &file); + const CPPFile &file); string get_simple_name() const; string get_local_name(CPPScope *scope = NULL) const; @@ -28,7 +28,7 @@ public: CPPScope *get_scope() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPNamespace *as_namespace(); diff --git a/dtool/src/cppparser/cppParameterList.cxx b/dtool/src/cppparser/cppParameterList.cxx index 22c63e02f9..59edaa3387 100644 --- a/dtool/src/cppparser/cppParameterList.cxx +++ b/dtool/src/cppparser/cppParameterList.cxx @@ -144,7 +144,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPParameterList *CPPParameterList:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPParameterList *rep = new CPPParameterList; bool any_changed = false; for (int i = 0; i < (int)_parameters.size(); i++) { @@ -212,7 +212,7 @@ output(ostream &out, CPPScope *scope, bool parameter_names, if (!_parameters.empty()) { for (int i = 0; i < (int)_parameters.size(); i++) { if (i != 0) { - out << ", "; + out << ", "; } // Save the default value expression; we might be about to @@ -220,15 +220,15 @@ output(ostream &out, CPPScope *scope, bool parameter_names, CPPExpression *expr = _parameters[i]->_initializer; if (num_default_parameters >= 0 && - i < (int)_parameters.size() - num_default_parameters) { - // Don't show the default value for this parameter. - _parameters[i]->_initializer = (CPPExpression *)NULL; + i < (int)_parameters.size() - num_default_parameters) { + // Don't show the default value for this parameter. + _parameters[i]->_initializer = (CPPExpression *)NULL; } if (parameter_names) { - _parameters[i]->output(out, 0, scope, false); + _parameters[i]->output(out, 0, scope, false); } else { - _parameters[i]->_type->output(out, 0, scope, false); + _parameters[i]->_type->output(out, 0, scope, false); } // Restore the default value expression. diff --git a/dtool/src/cppparser/cppParameterList.h b/dtool/src/cppparser/cppParameterList.h index a44f5ba41f..3d3b76aded 100644 --- a/dtool/src/cppparser/cppParameterList.h +++ b/dtool/src/cppparser/cppParameterList.h @@ -16,7 +16,7 @@ class CPPInstance; class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPParameterList +// Class : CPPParameterList // Description : //////////////////////////////////////////////////////////////////// class CPPParameterList { @@ -33,11 +33,11 @@ public: bool is_fully_specified() const; CPPParameterList *substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); CPPParameterList *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); // This vector contains a list of formal parameters, in order. A // parameter may have an empty identifer name. @@ -46,7 +46,7 @@ public: bool _includes_ellipsis; void output(ostream &out, CPPScope *scope, bool parameter_names, - int num_default_parameters = -1) const; + int num_default_parameters = -1) const; }; inline ostream & diff --git a/dtool/src/cppparser/cppParser.h b/dtool/src/cppparser/cppParser.h index 051192e189..b6f9d3aff4 100644 --- a/dtool/src/cppparser/cppParser.h +++ b/dtool/src/cppparser/cppParser.h @@ -14,7 +14,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CPPParser +// Class : CPPParser // Description : //////////////////////////////////////////////////////////////////// class CPPParser : public CPPScope, public CPPPreprocessor { diff --git a/dtool/src/cppparser/cppPointerType.cxx b/dtool/src/cppparser/cppPointerType.cxx index 29699e5ef7..a96b0a9c1f 100644 --- a/dtool/src/cppparser/cppPointerType.cxx +++ b/dtool/src/cppparser/cppPointerType.cxx @@ -41,7 +41,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPPointerType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -142,8 +142,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { //////////////////////////////////////////////////////////////////// void CPPPointerType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { string star = "*"; CPPFunctionType *ftype = _pointing_at->as_function_type(); @@ -155,7 +155,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, } _pointing_at->output_instance(out, indent_level, scope, complete, - star + prename, name); + star + prename, name); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppPointerType.h b/dtool/src/cppparser/cppPointerType.h index a2479c62ce..5936265938 100644 --- a/dtool/src/cppparser/cppPointerType.h +++ b/dtool/src/cppparser/cppPointerType.h @@ -20,7 +20,7 @@ #include "cppType.h" /////////////////////////////////////////////////////////////////// -// Class : CPPPointerType +// Class : CPPPointerType // Description : //////////////////////////////////////////////////////////////////// class CPPPointerType : public CPPType { @@ -31,21 +31,21 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 19fbbaa48d..859701e46a 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -332,75 +332,75 @@ get_next_token0() { // parse the template parameters. CPPDeclaration *decl = ident->find_template(current_scope, global_scope); if (decl != NULL) { - ident->_names.back().set_templ - (nested_parse_template_instantiation(decl->get_template_scope())); - token = internal_get_next_token(); + ident->_names.back().set_templ + (nested_parse_template_instantiation(decl->get_template_scope())); + token = internal_get_next_token(); } } while (token._token == SCOPE || token._token == TOKENPASTE) { if (token._token == TOKENPASTE) { - // The token-pasting operator creates one continuous - // identifier across whitespace. - token = internal_get_next_token(); - if (token._token == SIMPLE_IDENTIFIER) { - name += token._lval.str; - ident->_names.back().append_name(token._lval.str); + // The token-pasting operator creates one continuous + // identifier across whitespace. + token = internal_get_next_token(); + if (token._token == SIMPLE_IDENTIFIER) { + name += token._lval.str; + ident->_names.back().append_name(token._lval.str); - token = internal_get_next_token(); + token = internal_get_next_token(); - } else { - // Token-paste with nothing. - } + } else { + // Token-paste with nothing. + } } else { // token._token == SCOPE - name += "::"; - token = internal_get_next_token(); - string token_prefix; + name += "::"; + token = internal_get_next_token(); + string token_prefix; - if (token._token == '~') { - // A scoping operator followed by a tilde can only be the - // start of a scoped destructor name. Make the tilde be part - // of the name. - name += "~"; - token_prefix = "~"; - token = internal_get_next_token(); - } - - if (token._token != SIMPLE_IDENTIFIER) { - // The last useful token was a SCOPE, thus this is a scoping - // token. - - if (token._token == KW_OPERATOR) { - // Unless the last token we came across was the "operator" - // keyword. We make a special case for this, because it's - // occasionally scoped in normal use. - token._lval = result; - return token; - } - _saved_tokens.push_back(token); - return CPPToken(SCOPING, first_line, first_col, first_file, - name, result); - } + if (token._token == '~') { + // A scoping operator followed by a tilde can only be the + // start of a scoped destructor name. Make the tilde be part + // of the name. + name += "~"; + token_prefix = "~"; + token = internal_get_next_token(); + } - name += token._lval.str; - ident->_names.push_back(token_prefix + token._lval.str); + if (token._token != SIMPLE_IDENTIFIER) { + // The last useful token was a SCOPE, thus this is a scoping + // token. - token = internal_get_next_token(); + if (token._token == KW_OPERATOR) { + // Unless the last token we came across was the "operator" + // keyword. We make a special case for this, because it's + // occasionally scoped in normal use. + token._lval = result; + return token; + } + _saved_tokens.push_back(token); + return CPPToken(SCOPING, first_line, first_col, first_file, + name, result); + } + + name += token._lval.str; + ident->_names.push_back(token_prefix + token._lval.str); + + token = internal_get_next_token(); } if (token._token == '<') { - // If the next token is an angle bracket and the current - // indentifier wants template instantiation, assume the angle - // bracket begins the instantiation and call yacc recursively to - // parse the template parameters. - CPPDeclaration *decl = - ident->find_template(current_scope, global_scope); - if (decl != NULL) { - ident->_names.back().set_templ - (nested_parse_template_instantiation(decl->get_template_scope())); - token = internal_get_next_token(); - } + // If the next token is an angle bracket and the current + // indentifier wants template instantiation, assume the angle + // bracket begins the instantiation and call yacc recursively to + // parse the template parameters. + CPPDeclaration *decl = + ident->find_template(current_scope, global_scope); + if (decl != NULL) { + ident->_names.back().set_templ + (nested_parse_template_instantiation(decl->get_template_scope())); + token = internal_get_next_token(); + } } } // The last useful token was a SIMPLE_IDENTIFIER, thus this is a @@ -410,12 +410,12 @@ get_next_token0() { int token_type = IDENTIFIER; CPPDeclaration *decl = ident->find_symbol(current_scope, global_scope); if (decl != NULL && - (decl->as_typedef() != NULL || decl->as_type() != NULL)) { + (decl->as_typedef() != NULL || decl->as_type() != NULL)) { token_type = TYPENAME_IDENTIFIER; } return CPPToken(token_type, first_line, first_col, first_file, - name, result); + name, result); } // This is the normal case: just pass through whatever token we got. @@ -438,8 +438,8 @@ warning(const string &message, int line, int col, CPPFile file) { file = get_file(); } cerr << "\nWarning in " << file - << " near line " << line << ", column " << col << ":\n" - << message << "\n"; + << " near line " << line << ", column " << col << ":\n" + << message << "\n"; } _warning_count++; } @@ -466,8 +466,8 @@ error(const string &message, int line, int col, CPPFile file) { file = get_file(); } cerr << "\nError in " << file - << " near line " << line << ", column " << col << ":\n" - << message << "\n"; + << " near line " << line << ", column " << col << ":\n" + << message << "\n"; } _error_count++; } @@ -510,16 +510,16 @@ get_comment_before(int line, CPPFile file) { if (comment->_file == file) { wrong_file_count = 0; if (comment->_last_line == line || comment->_last_line == line - 1) { - return comment; + return comment; } if (comment->_last_line < line) { - return (CPPCommentBlock *)NULL; + return (CPPCommentBlock *)NULL; } } else { wrong_file_count++; if (wrong_file_count > 10) { - return (CPPCommentBlock *)NULL; + return (CPPCommentBlock *)NULL; } } @@ -651,7 +651,7 @@ push_string(const string &input, bool lock_position) { //////////////////////////////////////////////////////////////////// CPPExpression *CPPPreprocessor:: parse_expr(const string &input_expr, CPPScope *current_scope, - CPPScope *global_scope) { + CPPScope *global_scope) { // Get a copy of the expression string we can modify. string expr = input_expr; @@ -668,28 +668,28 @@ parse_expr(const string &input_expr, CPPScope *current_scope, size_t p = 0; while (p < expr.size()) { if (isalpha(expr[p]) || expr[p] == '_') { - size_t q = p; - while (p < expr.size() && (isalnum(expr[p]) || expr[p] == '_')) { - p++; - } - string ident = expr.substr(q, p - q); - - // Here's an identifier. Is it "defined"? - if (ident == "defined") { - expand_defined_function(expr, q, p); - } else { - // Is it a manifest? - Manifests::const_iterator mi = _manifests.find(ident); - if (mi != _manifests.end()) { - const CPPManifest *manifest = (*mi).second; - if (already_expanded.insert(manifest).second) { - expand_manifest_inline(expr, q, p, (*mi).second); - manifest_found = true; - } - } - } + size_t q = p; + while (p < expr.size() && (isalnum(expr[p]) || expr[p] == '_')) { + p++; + } + string ident = expr.substr(q, p - q); + + // Here's an identifier. Is it "defined"? + if (ident == "defined") { + expand_defined_function(expr, q, p); + } else { + // Is it a manifest? + Manifests::const_iterator mi = _manifests.find(ident); + if (mi != _manifests.end()) { + const CPPManifest *manifest = (*mi).second; + if (already_expanded.insert(manifest).second) { + expand_manifest_inline(expr, q, p, (*mi).second); + manifest_found = true; + } + } + } } else { - p++; + p++; } } @@ -869,16 +869,16 @@ internal_get_next_token() { case ',': if (_paren_nesting <= 0) { - _state = S_end_nested; - return CPPToken::eof(); + _state = S_end_nested; + return CPPToken::eof(); } break; case '>': if (_paren_nesting <= 0) { - _angle_bracket_found = true; - _state = S_end_nested; - return CPPToken::eof(); + _angle_bracket_found = true; + _state = S_end_nested; + return CPPToken::eof(); } } } @@ -958,22 +958,22 @@ skip_c_comment(int c) { while (c != EOF) { if (c == '*') { - comment->_comment += c; - c = get(); - if (c == '/') { - comment->_comment += c; - comment->_last_line = get_line_number(); - return get(); - } + comment->_comment += c; + c = get(); + if (c == '/') { + comment->_comment += c; + comment->_last_line = get_line_number(); + return get(); + } } else { - comment->_comment += c; - c = get(); + comment->_comment += c; + c = get(); } } warning("Comment is unterminated", - comment->_line_number, comment->_col_number, - comment->_file); + comment->_line_number, comment->_col_number, + comment->_file); } else { CPPFile first_file = get_file(); @@ -982,18 +982,18 @@ skip_c_comment(int c) { while (c != EOF) { if (c == '*') { - c = get(); - if (c == '/') { - return get(); - } + c = get(); + if (c == '/') { + return get(); + } } else { - c = get(); + c = get(); } } warning("Comment is unterminated", - first_line_number, first_col_number, - first_file); + first_line_number, first_col_number, + first_file); } return c; @@ -1097,7 +1097,7 @@ process_directive(int c) { handle_error_directive(args, first_line, first_col, first_file); } else { warning("Ignoring unknown directive #" + command, - first_line, first_col, first_file); + first_line, first_col, first_file); } _start_of_line = true; @@ -1144,14 +1144,14 @@ get_preprocessor_args(int c, string &args) { if (c == '\\') { int next_c = get(); if (next_c == '\n') { - // Here we have an escaped newline: a continuation. - args += '\n'; + // Here we have an escaped newline: a continuation. + args += '\n'; } else { - // Just a backslash followed by some non-backslash, keep both. - args += c; - if (next_c != EOF) { - args += next_c; - } + // Just a backslash followed by some non-backslash, keep both. + args += c; + if (next_c != EOF) { + args += next_c; + } } } else { args += c; @@ -1172,17 +1172,17 @@ get_preprocessor_args(int c, string &args) { //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: handle_define_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file) { + int first_col, const CPPFile &first_file) { if (args.empty()) { warning("Ignoring empty #define directive", - first_line, first_col, first_file); + first_line, first_col, first_file); } else { CPPManifest *manifest = new CPPManifest(args, first_file); manifest->_vis = preprocessor_vis; if (!manifest->_has_parameters) { string expr_string = manifest->expand(); if (!expr_string.empty()) { - manifest->_expr = parse_expr(expr_string, global_scope, global_scope); + manifest->_expr = parse_expr(expr_string, global_scope, global_scope); } } _manifests[manifest->_name] = manifest; @@ -1196,10 +1196,10 @@ handle_define_directive(const string &args, int first_line, //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: handle_undef_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file) { + int first_col, const CPPFile &first_file) { if (args.empty()) { warning("Ignoring empty #undef directive", - first_line, first_col, first_file); + first_line, first_col, first_file); } else { Manifests::iterator mi = _manifests.find(args); if (mi != _manifests.end()) { @@ -1250,7 +1250,7 @@ handle_ifndef_directive(const string &args, int, int, const CPPFile &) { //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: handle_if_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file) { + int first_col, const CPPFile &first_file) { CPPExpression *expr = parse_expr(args, global_scope, global_scope); int expression_result = 0; @@ -1259,13 +1259,13 @@ handle_if_directive(const string &args, int first_line, CPPExpression::Result result = expr->evaluate(); if (result._type == CPPExpression::RT_error) { warning("Ignoring invalid expression " + args, - first_line, first_col, first_file); + first_line, first_col, first_file); } else { expression_result = result.as_integer(); } } else { warning("Ignoring invalid expression " + args, - first_line, first_col, first_file); + first_line, first_col, first_file); } if (expression_result) { @@ -1284,7 +1284,7 @@ handle_if_directive(const string &args, int first_line, //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: handle_include_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file) { + int first_col, const CPPFile &first_file) { bool okflag = false; Filename filename; Filename filename_as_referenced; @@ -1296,10 +1296,10 @@ handle_include_directive(const string &args, int first_line, okflag = true; if (_files.size() == 1) { - // If we're currently processing a top-level file, record the - // include directive. We don't need to record includes from - // included files. - _quote_includes.insert(filename); + // If we're currently processing a top-level file, record the + // include directive. We don't need to record includes from + // included files. + _quote_includes.insert(filename); } } else if (args[0] == '<' && args[args.size() - 1] == '>') { filename = args.substr(1, args.size() - 2); @@ -1307,10 +1307,10 @@ handle_include_directive(const string &args, int first_line, okflag = true; if (_files.size() == 1) { - // If we're currently processing a top-level file, record the - // include directive. We don't need to record includes from - // included files. - _angle_includes.insert(filename); + // If we're currently processing a top-level file, record the + // include directive. We don't need to record includes from + // included files. + _angle_includes.insert(filename); } } } @@ -1342,17 +1342,17 @@ handle_include_directive(const string &args, int first_line, if (!found_file) { warning("Cannot find " + filename.get_fullpath(), - first_line, first_col, first_file); + first_line, first_col, first_file); } else { _last_c = '\0'; if (!push_file(CPPFile(filename, filename_as_referenced, source))) { - warning("Unable to read " + filename.get_fullpath(), - first_line, first_col, first_file); + warning("Unable to read " + filename.get_fullpath(), + first_line, first_col, first_file); } } } else { warning("Ignoring invalid #include directive", - first_line, first_col, first_file); + first_line, first_col, first_file); } } @@ -1363,7 +1363,7 @@ handle_include_directive(const string &args, int first_line, //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: handle_error_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file) { + int first_col, const CPPFile &first_file) { error(args, first_line, first_col, first_file); } @@ -1391,30 +1391,30 @@ skip_false_if_block(bool consider_elifs) { string command; c = get_preprocessor_command(c, command); if (command == "if" || command == "ifdef" || command == "ifndef") { - // Hmm, a nested if block. Even more to skip. - level++; + // Hmm, a nested if block. Even more to skip. + level++; } else if (command == "else") { - if (level == 0 && consider_elifs) { - // This will do! - _save_comments = true; - return; - } + if (level == 0 && consider_elifs) { + // This will do! + _save_comments = true; + return; + } } else if (command == "elif") { - if (level == 0 && consider_elifs) { - // If we pass this test, we're in. - _save_comments = true; - string args; - c = get_preprocessor_args(c, args); - handle_if_directive(args, first_line, first_col, first_file); - return; - } + if (level == 0 && consider_elifs) { + // If we pass this test, we're in. + _save_comments = true; + string args; + c = get_preprocessor_args(c, args); + handle_if_directive(args, first_line, first_col, first_file); + return; + } } else if (command == "endif") { - if (level == 0) { - // Here's the end! - _save_comments = true; - return; - } - level--; + if (level == 0) { + // Here's the end! + _save_comments = true; + return; + } + level--; } } else { c = skip_comment(get()); @@ -1506,7 +1506,7 @@ get_identifier(int c) { } return CPPToken(SIMPLE_IDENTIFIER, first_line, first_col, first_file, - name); + name); } //////////////////////////////////////////////////////////////////// @@ -1546,7 +1546,7 @@ expand_manifest(const CPPManifest *manifest) { //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: extract_manifest_args(const string &name, int num_args, - vector_string &args) { + vector_string &args) { CPPFile first_file = get_file(); int first_line = get_line_number(); int first_col = get_col_number(); @@ -1572,27 +1572,27 @@ extract_manifest_args(const string &name, int num_args, string arg; while (c != EOF && c != ')') { if (c == ',') { - args.push_back(arg); - arg = ""; + args.push_back(arg); + arg = ""; } else if (c == '(') { - // Nested parens. - int paren_level = 1; - while (c != EOF && paren_level > 0) { - arg += c; - c = get(); - if (c == '(') { - paren_level++; - } else if (c == ')') { - paren_level--; - } - } - if (c != EOF) { - arg += c; - } - + // Nested parens. + int paren_level = 1; + while (c != EOF && paren_level > 0) { + arg += c; + c = get(); + if (c == '(') { + paren_level++; + } else if (c == ')') { + paren_level--; + } + } + if (c != EOF) { + arg += c; + } + } else { - arg += c; + arg += c; } c = get(); } @@ -1603,7 +1603,7 @@ extract_manifest_args(const string &name, int num_args, if ((int)args.size() != num_args) { warning("Wrong number of arguments for manifest " + name, - first_line, first_col, first_file); + first_line, first_col, first_file); } } @@ -1641,11 +1641,11 @@ expand_defined_function(string &expr, size_t q, size_t &p) { //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: expand_manifest_inline(string &expr, size_t q, size_t &p, - const CPPManifest *manifest) { + const CPPManifest *manifest) { vector_string args; if (manifest->_has_parameters) { extract_manifest_args_inline(manifest->_name, manifest->_num_parameters, - args, expr, p); + args, expr, p); } string result = manifest->expand(args); @@ -1660,8 +1660,8 @@ expand_manifest_inline(string &expr, size_t q, size_t &p, //////////////////////////////////////////////////////////////////// void CPPPreprocessor:: extract_manifest_args_inline(const string &name, int num_args, - vector_string &args, - const string &expr, size_t &p) { + vector_string &args, + const string &expr, size_t &p) { // Skip whitespace till paren. while (p < expr.size() && isspace(expr[p])) { p++; @@ -1679,20 +1679,20 @@ extract_manifest_args_inline(const string &name, int num_args, size_t q = p; while (p < expr.size() && expr[p] != ')') { if (expr[p] == ',') { - args.push_back(expr.substr(q, p - q)); - q = p+1; + args.push_back(expr.substr(q, p - q)); + q = p+1; } else if (expr[p] == '(') { - // Nested parens. - int paren_level = 1; - while (p+1 < expr.size() && paren_level > 0) { - p++; - if (expr[p] == '(') { - paren_level++; - } else if (expr[p] == ')') { - paren_level--; - } - } + // Nested parens. + int paren_level = 1; + while (p+1 < expr.size() && paren_level > 0) { + p++; + if (expr[p] == '(') { + paren_level++; + } else if (expr[p] == ')') { + paren_level--; + } + } } p++; } @@ -1773,12 +1773,12 @@ get_number(int c, int c2) { num += c; c = get(); if (c == '-' || c == '+') { - num += c; - c = get(); + num += c; + c = get(); } while (c != EOF && isdigit(c)) { - num += c; - c = get(); + num += c; + c = get(); } } @@ -1901,31 +1901,31 @@ scan_quoted(int c) { c = get(); switch (c) { case 'n': - c = '\n'; - break; + c = '\n'; + break; case 't': - c = '\t'; - break; + c = '\t'; + break; case 'r': - c = '\r'; - break; + c = '\r'; + break; case 'x': - // hex character. - c = get(); - if (isxdigit(c)) { - int val = hex_val(c); - c = get(); - if (isxdigit(c)) { - val = (val << 4) | hex_val(c); - } else { - unget(c); - } - c = val; - } - break; + // hex character. + c = get(); + if (isxdigit(c)) { + int val = hex_val(c); + c = get(); + if (isxdigit(c)) { + val = (val << 4) | hex_val(c); + } else { + unget(c); + } + c = val; + } + break; case '0': case '1': @@ -1935,24 +1935,24 @@ scan_quoted(int c) { case '5': case '6': case '7': - // Octal character. - { - int val = (c - '0'); - c = get(); - if (c >= '0' && c <= '7') { - val = (val << 3) | (c - '0'); - c = get(); - if (c >= '0' && c <= '7') { - val = (val << 3) | (c - '0'); - } else { - unget(c); - } - } else { - unget(c); - } - c = val; - } - break; + // Octal character. + { + int val = (c - '0'); + c = get(); + if (c >= '0' && c <= '7') { + val = (val << 3) | (c - '0'); + c = get(); + if (c >= '0' && c <= '7') { + val = (val << 3) | (c - '0'); + } else { + unget(c); + } + } else { + unget(c); + } + c = val; + } + break; } } @@ -2106,18 +2106,18 @@ nested_parse_template_instantiation(CPPTemplateScope *scope) { _saved_tokens.push_back(CPPToken(START_TYPE)); CPPType *type = ::parse_type(this, current_scope, global_scope); if (type == NULL) { - warning("Invalid type", first_line, first_col, first_file); - skip_to_end_nested(); - type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); + warning("Invalid type", first_line, first_col, first_file); + skip_to_end_nested(); + type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown)); } actual_params->_parameters.push_back(type); } else { _saved_tokens.push_back(CPPToken(START_CONST_EXPR)); CPPExpression *expr = parse_const_expr(this, current_scope, global_scope); if (expr == NULL) { - warning("Invalid expression", first_line, first_col, first_file); - skip_to_end_nested(); - expr = new CPPExpression(0); + warning("Invalid expression", first_line, first_col, first_file); + skip_to_end_nested(); + expr = new CPPExpression(0); } actual_params->_parameters.push_back(expr); } diff --git a/dtool/src/cppparser/cppPreprocessor.h b/dtool/src/cppparser/cppPreprocessor.h index 59c0a39ebe..705ea124cc 100644 --- a/dtool/src/cppparser/cppPreprocessor.h +++ b/dtool/src/cppparser/cppPreprocessor.h @@ -27,7 +27,7 @@ class CPPExpression; //#define CPP_VERBOSE_LEX /////////////////////////////////////////////////////////////////// -// Class : CPPPreprocessor +// Class : CPPPreprocessor // Description : //////////////////////////////////////////////////////////////////// class CPPPreprocessor { @@ -50,9 +50,9 @@ public: #endif void warning(const string &message, int line = 0, int col = 0, - CPPFile file = CPPFile()); + CPPFile file = CPPFile()); void error(const string &message, int line = 0, int col = 0, - CPPFile file = CPPFile()); + CPPFile file = CPPFile()); CPPCommentBlock *get_comment_before(int line, CPPFile file); @@ -95,7 +95,7 @@ protected: bool push_string(const string &input, bool lock_position); CPPExpression *parse_expr(const string &expr, CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); private: CPPToken internal_get_next_token(); @@ -109,19 +109,19 @@ private: int get_preprocessor_args(int c, string &args); void handle_define_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_undef_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_ifdef_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_ifndef_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_if_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_include_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void handle_error_directive(const string &args, int first_line, - int first_col, const CPPFile &first_file); + int first_col, const CPPFile &first_file); void skip_false_if_block(bool consider_elifs); @@ -130,13 +130,13 @@ private: CPPToken get_identifier(int c); CPPToken expand_manifest(const CPPManifest *manifest); void extract_manifest_args(const string &name, int num_args, - vector_string &args); + vector_string &args); void expand_defined_function(string &expr, size_t q, size_t &p); void expand_manifest_inline(string &expr, size_t q, size_t &p, - const CPPManifest *manifest); + const CPPManifest *manifest); void extract_manifest_args_inline(const string &name, int num_args, - vector_string &args, - const string &expr, size_t &p); + vector_string &args, + const string &expr, size_t &p); CPPToken get_number(int c, int c2 = 0); static int check_keyword(const string &name); diff --git a/dtool/src/cppparser/cppReferenceType.cxx b/dtool/src/cppparser/cppReferenceType.cxx index 4ad7526e1d..6b1fdee0ba 100644 --- a/dtool/src/cppparser/cppReferenceType.cxx +++ b/dtool/src/cppparser/cppReferenceType.cxx @@ -39,7 +39,7 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPReferenceType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { return (*si).second; @@ -132,10 +132,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { //////////////////////////////////////////////////////////////////// void CPPReferenceType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { _pointing_at->output_instance(out, indent_level, scope, complete, - "&" + prename, name); + "&" + prename, name); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppReferenceType.h b/dtool/src/cppparser/cppReferenceType.h index 5ba45a8430..0b6bc19b92 100644 --- a/dtool/src/cppparser/cppReferenceType.h +++ b/dtool/src/cppparser/cppReferenceType.h @@ -11,7 +11,7 @@ #include "cppType.h" /////////////////////////////////////////////////////////////////// -// Class : CPPReferenceType +// Class : CPPReferenceType // Description : //////////////////////////////////////////////////////////////////// class CPPReferenceType : public CPPType { @@ -22,21 +22,21 @@ public: virtual bool is_fully_specified() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; virtual bool is_equivalent(const CPPType &other) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index 86721124e0..d624d39731 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -30,7 +30,7 @@ //////////////////////////////////////////////////////////////////// CPPScope:: CPPScope(CPPScope *parent_scope, - const CPPNameComponent &name, CPPVisibility starting_vis) : + const CPPNameComponent &name, CPPVisibility starting_vis) : _name(name), _parent_scope(parent_scope), _current_vis(starting_vis) @@ -113,7 +113,7 @@ get_current_vis() const { //////////////////////////////////////////////////////////////////// void CPPScope:: add_declaration(CPPDeclaration *decl, CPPScope *global_scope, - CPPPreprocessor *preprocessor, const cppyyltype &pos) { + CPPPreprocessor *preprocessor, const cppyyltype &pos) { decl->_vis = _current_vis; // Get the recent comments from the preprocessor. These are the @@ -215,7 +215,7 @@ define_namespace(CPPNamespace *scope) { //////////////////////////////////////////////////////////////////// void CPPScope:: add_using(CPPUsing *using_decl, CPPScope *global_scope, - CPPPreprocessor *error_sink) { + CPPPreprocessor *error_sink) { if (using_decl->_full_namespace) { CPPScope *scope = using_decl->_ident->find_scope(this, global_scope); @@ -223,7 +223,7 @@ add_using(CPPUsing *using_decl, CPPScope *global_scope, _using.insert(scope); } else { if (error_sink != NULL) { - error_sink->warning("Attempt to use undefined namespace: " + using_decl->_ident->get_fully_scoped_name()); + error_sink->warning("Attempt to use undefined namespace: " + using_decl->_ident->get_fully_scoped_name()); } } } else { @@ -232,7 +232,7 @@ add_using(CPPUsing *using_decl, CPPScope *global_scope, handle_declaration(decl, global_scope); } else { if (error_sink != NULL) { - error_sink->warning("Attempt to use unknown symbol: " + using_decl->_ident->get_fully_scoped_name()); + error_sink->warning("Attempt to use unknown symbol: " + using_decl->_ident->get_fully_scoped_name()); } } } @@ -287,15 +287,15 @@ is_fully_specified() const { //////////////////////////////////////////////////////////////////// CPPScope *CPPScope:: instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink) const { CPPScope *this_scope = (CPPScope *)this; if (_parent_scope == NULL || _parent_scope->as_template_scope() == NULL) { if (error_sink != NULL) { error_sink->warning("Ignoring template parameters for scope " + - get_local_name()); + get_local_name()); } return this_scope; } @@ -314,14 +314,14 @@ instantiate(const CPPTemplateParameterList *actual_params, /* cerr << "Instantiating " << get_simple_name() - << "<" << *actual_params << ">\n"; + << "<" << *actual_params << ">\n"; */ // Build the mapping of formal parameters to actual parameters. CPPTemplateScope *tscope = _parent_scope->as_template_scope(); CPPDeclaration::SubstDecl subst; actual_params->build_subst_decl(tscope->_parameters, subst, - current_scope, global_scope); + current_scope, global_scope); CPPScope *scope; if (subst.empty()) { @@ -338,16 +338,16 @@ instantiate(const CPPTemplateParameterList *actual_params, // "instantiated" this scope with another template parameter. CPPTemplateParameterList::Parameters::const_iterator pi; for (pi = actual_params->_parameters.begin(); - pi != actual_params->_parameters.end(); - ++pi) { + pi != actual_params->_parameters.end(); + ++pi) { CPPDeclaration *decl = (*pi); CPPClassTemplateParameter *ctp = decl->as_class_template_parameter(); if (ctp != NULL) { - CPPInstance *inst = new CPPInstance(ctp, ctp->_ident); - CPPTypedef *td = new CPPTypedef(inst, true); - scope->_typedefs.insert(Typedefs::value_type - (ctp->_ident->get_local_name(), - td)); + CPPInstance *inst = new CPPInstance(ctp, ctp->_ident); + CPPTypedef *td = new CPPTypedef(inst, true); + scope->_typedefs.insert(Typedefs::value_type + (ctp->_ident->get_local_name(), + td)); } } } @@ -366,7 +366,7 @@ instantiate(const CPPTemplateParameterList *actual_params, //////////////////////////////////////////////////////////////////// CPPScope *CPPScope:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) const { + CPPScope *current_scope, CPPScope *global_scope) const { CPPScope *this_scope = (CPPScope *)this; if (is_fully_specified()) { @@ -434,14 +434,14 @@ find_type(const string &name, bool recurse) const { if (_struct_type != NULL) { CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType *st = (*di)._base->as_struct_type(); if (st != NULL) { - CPPType *type = st->_scope->find_type(name, false); - if (type != NULL) { - return type; - } + CPPType *type = st->_scope->find_type(name, false); + if (type != NULL) { + return type; + } } } } @@ -460,7 +460,7 @@ find_type(const string &name, bool recurse) const { //////////////////////////////////////////////////////////////////// CPPType *CPPScope:: find_type(const string &name, CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope, bool recurse) const { + CPPScope *global_scope, bool recurse) const { Typedefs::const_iterator ti; ti = _typedefs.find(name); if (ti != _typedefs.end()) { @@ -480,15 +480,15 @@ find_type(const string &name, CPPDeclaration::SubstDecl &subst, if (_struct_type != NULL) { CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType *st = (*di)._base->as_struct_type(); if (st != NULL) { - CPPType *type = st->_scope->find_type(name, subst, global_scope, - false); - if (type != NULL) { - return type; - } + CPPType *type = st->_scope->find_type(name, subst, global_scope, + false); + if (type != NULL) { + return type; + } } } } @@ -522,11 +522,11 @@ find_scope(const string &name, bool recurse) const { } else if (_struct_type != NULL) { CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType *st = (*di)._base->as_struct_type(); if (st != NULL) { - type = st->_scope->find_type(name, false); + type = st->_scope->find_type(name, false); } } } @@ -560,7 +560,7 @@ find_scope(const string &name, bool recurse) const { //////////////////////////////////////////////////////////////////// CPPScope *CPPScope:: find_scope(const string &name, CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope, bool recurse) const { + CPPScope *global_scope, bool recurse) const { CPPType *type = find_type(name, subst, global_scope, recurse); if (type == NULL) { return NULL; @@ -617,14 +617,14 @@ find_symbol(const string &name, bool recurse) const { if (_struct_type != NULL) { CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType *st = (*di)._base->as_struct_type(); if (st != NULL) { - CPPDeclaration *decl = st->_scope->find_symbol(name, false); - if (decl != NULL) { - return decl; - } + CPPDeclaration *decl = st->_scope->find_symbol(name, false); + if (decl != NULL) { + return decl; + } } } } @@ -660,14 +660,14 @@ find_template(const string &name, bool recurse) const { if (_struct_type != NULL) { CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType *st = (*di)._base->as_struct_type(); if (st != NULL) { - CPPDeclaration *decl = st->_scope->find_template(name, false); - if (decl != NULL) { - return decl; - } + CPPDeclaration *decl = st->_scope->find_template(name, false); + if (decl != NULL) { + return decl; + } } } } @@ -769,7 +769,7 @@ write(ostream &out, int indent_level, CPPScope *scope) const { bool complete = false; if (cd->as_typedef() != NULL || cd->as_type() != NULL || - cd->as_namespace() != NULL) { + cd->as_namespace() != NULL) { complete = true; } @@ -822,7 +822,7 @@ as_template_scope() { //////////////////////////////////////////////////////////////////// bool CPPScope:: copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope) const { + CPPScope *global_scope) const { bool anything_changed = false; if (_struct_type != NULL) { @@ -832,21 +832,21 @@ copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst, } to_scope->_struct_type = new CPPStructType(_struct_type->_type, - new CPPIdentifier(to_scope->_name), - native_scope, to_scope, _struct_type->_file); + new CPPIdentifier(to_scope->_name), + native_scope, to_scope, _struct_type->_file); to_scope->_struct_type->_incomplete = false; // Copy the derivation to the new type. CPPStructType::Derivation::const_iterator di; for (di = _struct_type->_derivation.begin(); - di != _struct_type->_derivation.end(); - ++di) { + di != _struct_type->_derivation.end(); + ++di) { CPPStructType::Base b = (*di); b._base = - (*di)._base->substitute_decl(subst, to_scope, global_scope)->as_type(); + (*di)._base->substitute_decl(subst, to_scope, global_scope)->as_type(); to_scope->_struct_type->_derivation.push_back(b); if (b._base != (*di)._base) { - anything_changed = true; + anything_changed = true; } } } @@ -926,13 +926,13 @@ copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst, CPPFunctionGroup::Instances::const_iterator ii; for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end(); - ++ii) { + ii != fgroup->_instances.end(); + ++ii) { CPPInstance *inst = - (*ii)->substitute_decl(subst, to_scope, global_scope)->as_instance(); + (*ii)->substitute_decl(subst, to_scope, global_scope)->as_instance(); to_fgroup->_instances.push_back(inst); if (inst != (*ii)) { - anything_changed = true; + anything_changed = true; } } } @@ -994,7 +994,7 @@ handle_declaration(CPPDeclaration *decl, CPPScope *global_scope) { // by the same name in another scope. if (find_template(name) == NULL) { - _templates.insert(Templates::value_type(name, def)); + _templates.insert(Templates::value_type(name, def)); } } return; @@ -1016,42 +1016,42 @@ handle_declaration(CPPDeclaration *decl, CPPScope *global_scope) { string name = inst->get_simple_name(); if (!name.empty() && inst->get_scope(this, global_scope) == this) { if (inst->_type->as_function_type()) { - // This is a function declaration; hence it gets added to - // the _functions member. But we must be careful to share - // common-named functions. - - CPPFunctionGroup *fgroup; - Functions::const_iterator fi; - fi = _functions.find(name); - if (fi == _functions.end()) { - fgroup = new CPPFunctionGroup(name); - _functions.insert(Functions::value_type(name, fgroup)); - } else { - fgroup = (*fi).second; - } - fgroup->_instances.push_back(inst); - + // This is a function declaration; hence it gets added to + // the _functions member. But we must be careful to share + // common-named functions. + + CPPFunctionGroup *fgroup; + Functions::const_iterator fi; + fi = _functions.find(name); + if (fi == _functions.end()) { + fgroup = new CPPFunctionGroup(name); + _functions.insert(Functions::value_type(name, fgroup)); + } else { + fgroup = (*fi).second; + } + fgroup->_instances.push_back(inst); + } else { - // This is not a function declaration; hence it gets added - // to the _variables member. - _variables[name] = inst; + // This is not a function declaration; hence it gets added + // to the _variables member. + _variables[name] = inst; } if (inst->is_template()) { - // Don't add a new template definition if we already had one - // by the same name in another scope. + // Don't add a new template definition if we already had one + // by the same name in another scope. - if (find_template(name) == NULL) { - _templates.insert(Templates::value_type(name, inst)); - } - - /* - if (inst->_type->as_function_type() == NULL || - (inst->_type->as_function_type()->_flags & - CPPFunctionType::F_constructor) == 0) { - _templates.insert(Templates::value_type(name, inst)); - } - */ + if (find_template(name) == NULL) { + _templates.insert(Templates::value_type(name, inst)); + } + + /* + if (inst->_type->as_function_type() == NULL || + (inst->_type->as_function_type()->_flags & + CPPFunctionType::F_constructor) == 0) { + _templates.insert(Templates::value_type(name, inst)); + } + */ } } return; diff --git a/dtool/src/cppparser/cppScope.h b/dtool/src/cppparser/cppScope.h index 95f4ff1296..707e08f15f 100644 --- a/dtool/src/cppparser/cppScope.h +++ b/dtool/src/cppparser/cppScope.h @@ -35,13 +35,13 @@ class CPPNameComponent; struct cppyyltype; /////////////////////////////////////////////////////////////////// -// Class : CPPScope +// Class : CPPScope // Description : //////////////////////////////////////////////////////////////////// class CPPScope { public: CPPScope(CPPScope *parent_scope, - const CPPNameComponent &name, CPPVisibility starting_vis); + const CPPNameComponent &name, CPPVisibility starting_vis); virtual ~CPPScope(); void set_current_vis(CPPVisibility current_vis); @@ -52,40 +52,40 @@ public: CPPScope *get_parent_scope() const; virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope, - CPPPreprocessor *preprocessor, - const cppyyltype &pos); + CPPPreprocessor *preprocessor, + const cppyyltype &pos); virtual void add_enum_value(CPPInstance *inst); virtual void define_extension_type(CPPExtensionType *type); virtual void define_namespace(CPPNamespace *scope); virtual void add_using(CPPUsing *using_decl, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL); + CPPPreprocessor *error_sink = NULL); virtual bool is_fully_specified() const; CPPScope * instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; CPPScope * substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope) const; + CPPScope *current_scope, + CPPScope *global_scope) const; CPPType *find_type(const string &name, bool recurse = true) const; CPPType *find_type(const string &name, - CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope, - bool recurse = true) const; + CPPDeclaration::SubstDecl &subst, + CPPScope *global_scope, + bool recurse = true) const; CPPScope *find_scope(const string &name, bool recurse = true) const; CPPScope *find_scope(const string &name, - CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope, - bool recurse = true) const; + CPPDeclaration::SubstDecl &subst, + CPPScope *global_scope, + bool recurse = true) const; CPPDeclaration *find_symbol(const string &name, - bool recurse = true) const; + bool recurse = true) const; CPPDeclaration *find_template(const string &name, - bool recurse = true) const; + bool recurse = true) const; virtual string get_simple_name() const; virtual string get_local_name(CPPScope *scope = NULL) const; @@ -100,7 +100,7 @@ public: private: bool copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst, - CPPScope *global_scope) const; + CPPScope *global_scope) const; void handle_declaration(CPPDeclaration *decl, CPPScope *global_scope); diff --git a/dtool/src/cppparser/cppSimpleType.h b/dtool/src/cppparser/cppSimpleType.h index 5eb3a8200d..d8ad8af7c5 100644 --- a/dtool/src/cppparser/cppSimpleType.h +++ b/dtool/src/cppparser/cppSimpleType.h @@ -11,7 +11,7 @@ #include "cppType.h" /////////////////////////////////////////////////////////////////// -// Class : CPPSimpleType +// Class : CPPSimpleType // Description : //////////////////////////////////////////////////////////////////// class CPPSimpleType : public CPPType { @@ -44,7 +44,7 @@ public: virtual string get_preferred_name() const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPSimpleType *as_simple_type(); diff --git a/dtool/src/cppparser/cppStructType.cxx b/dtool/src/cppparser/cppStructType.cxx index 7a6f41b497..496a3150f7 100644 --- a/dtool/src/cppparser/cppStructType.cxx +++ b/dtool/src/cppparser/cppStructType.cxx @@ -35,8 +35,8 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// CPPStructType:: CPPStructType(CPPStructType::Type type, CPPIdentifier *ident, - CPPScope *current_scope, CPPScope *scope, - const CPPFile &file) : + CPPScope *current_scope, CPPScope *scope, + const CPPFile &file) : CPPExtensionType(type, ident, current_scope, file), _scope(scope) { @@ -180,12 +180,12 @@ get_destructor() const { fi = _scope->_functions.lower_bound("~"); while (fi != _scope->_functions.end() && - (*fi).first[0] == '~') { + (*fi).first[0] == '~') { CPPFunctionGroup *fgroup = (*fi).second; CPPFunctionGroup::Instances::const_iterator ii; for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end(); - ++ii) { + ii != fgroup->_instances.end(); + ++ii) { CPPInstance *inst = (*ii); assert(inst->_type != (CPPType *)NULL); @@ -193,7 +193,7 @@ get_destructor() const { assert(ftype != (CPPFunctionType *)NULL); if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) { - return inst; + return inst; } } ++fi; @@ -209,8 +209,8 @@ get_destructor() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPStructType:: instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink) const { + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink) const { // I *think* this assertion is no longer valid. Who knows. // assert(!_incomplete); @@ -218,7 +218,7 @@ instantiate(const CPPTemplateParameterList *actual_params, if (_scope == NULL) { if (error_sink != NULL) { error_sink->warning("Ignoring template parameters for class " + - get_local_name()); + get_local_name()); } return (CPPDeclaration *)this; } @@ -255,7 +255,7 @@ instantiate(const CPPTemplateParameterList *actual_params, //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPStructType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { SubstDecl::const_iterator si = subst.find(this); if (si != subst.end()) { assert((*si).second != NULL); @@ -295,18 +295,18 @@ substitute_decl(CPPDeclaration::SubstDecl &subst, CPPScope *pscope = rep->_scope->get_parent_scope(); if (pscope != (CPPScope *)NULL && - pscope->_name.has_templ()) { + pscope->_name.has_templ()) { - // If the struct name didn't have an explicit template - // reference before, now it does. - if (!_ident->_names.empty() && !_ident->_names.back().has_templ()) { - if (rep->is_template()) { - rep->_template_scope = (CPPTemplateScope *)NULL; - CPPNameComponent nc(get_simple_name()); - nc.set_templ(pscope->_name.get_templ()); - rep->_ident = new CPPIdentifier(nc); - } - } + // If the struct name didn't have an explicit template + // reference before, now it does. + if (!_ident->_names.empty() && !_ident->_names.back().has_templ()) { + if (rep->is_template()) { + rep->_template_scope = (CPPTemplateScope *)NULL; + CPPNameComponent nc(get_simple_name()); + nc.set_templ(pscope->_name.get_templ()); + rep->_ident = new CPPIdentifier(nc); + } + } } } } @@ -389,8 +389,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const { out << ": " << *di; ++di; while (di != _derivation.end()) { - out << ", " << *di; - ++di; + out << ", " << *di; + ++di; } } @@ -464,10 +464,10 @@ get_virtual_funcs(VFunctions &funcs) const { // destructors up by name. CPPInstance *destructor = get_destructor(); if (destructor != (CPPInstance *)NULL) { - // It's a match! This destructor is virtual. - funcs.erase(vfi); - destructor->_storage_class |= - (CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual); + // It's a match! This destructor is virtual. + funcs.erase(vfi); + destructor->_storage_class |= + (CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual); } } else { @@ -477,34 +477,34 @@ get_virtual_funcs(VFunctions &funcs) const { fi = _scope->_functions.find(fname); if (fi != _scope->_functions.end()) { - CPPFunctionGroup *fgroup = (*fi).second; - - // Look for a matching function amid this group. - bool match_found = false; - CPPFunctionGroup::Instances::const_iterator ii; - for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end() && !match_found; - ++ii) { - CPPInstance *new_inst = (*ii); - assert(new_inst->_type != (CPPType *)NULL); - - CPPFunctionType *new_ftype = new_inst->_type->as_function_type(); - assert(new_ftype != (CPPFunctionType *)NULL); - - if (new_ftype->is_equivalent_function(*base_ftype)) { - // It's a match! We now know it's virtual. Erase this - // function from the list, so we can add it back in below. - funcs.erase(vfi); - match_found = true; + CPPFunctionGroup *fgroup = (*fi).second; - // In fact, it's not only definitely virtual, but it's - // *inherited* virtual, which means only that the - // interface is defined in some parent class. Sometimes - // this is useful to know. - new_inst->_storage_class |= - (CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual); - } - } + // Look for a matching function amid this group. + bool match_found = false; + CPPFunctionGroup::Instances::const_iterator ii; + for (ii = fgroup->_instances.begin(); + ii != fgroup->_instances.end() && !match_found; + ++ii) { + CPPInstance *new_inst = (*ii); + assert(new_inst->_type != (CPPType *)NULL); + + CPPFunctionType *new_ftype = new_inst->_type->as_function_type(); + assert(new_ftype != (CPPFunctionType *)NULL); + + if (new_ftype->is_equivalent_function(*base_ftype)) { + // It's a match! We now know it's virtual. Erase this + // function from the list, so we can add it back in below. + funcs.erase(vfi); + match_found = true; + + // In fact, it's not only definitely virtual, but it's + // *inherited* virtual, which means only that the + // interface is defined in some parent class. Sometimes + // this is useful to know. + new_inst->_storage_class |= + (CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual); + } + } } } vfi = vfnext; @@ -518,12 +518,12 @@ get_virtual_funcs(VFunctions &funcs) const { CPPFunctionGroup *fgroup = (*fi).second; CPPFunctionGroup::Instances::const_iterator ii; for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end(); - ++ii) { + ii != fgroup->_instances.end(); + ++ii) { CPPInstance *inst = (*ii); if ((inst->_storage_class & CPPInstance::SC_virtual) != 0) { - // Here's a virtual function. - funcs.push_back(inst); + // Here's a virtual function. + funcs.push_back(inst); } } } diff --git a/dtool/src/cppparser/cppStructType.h b/dtool/src/cppparser/cppStructType.h index 33371b710e..91a2359ab4 100644 --- a/dtool/src/cppparser/cppStructType.h +++ b/dtool/src/cppparser/cppStructType.h @@ -18,15 +18,15 @@ class CPPScope; class CPPTypeProxy; /////////////////////////////////////////////////////////////////// -// Class : CPPStructType +// Class : CPPStructType // Description : //////////////////////////////////////////////////////////////////// class CPPStructType : public CPPExtensionType { public: CPPStructType(Type type, CPPIdentifier *ident, - CPPScope *current_scope, - CPPScope *scope, - const CPPFile &file); + CPPScope *current_scope, + CPPScope *scope, + const CPPFile &file); CPPStructType(const CPPStructType ©); void operator = (const CPPStructType ©); @@ -43,15 +43,15 @@ public: virtual CPPDeclaration * instantiate(const CPPTemplateParameterList *actual_params, - CPPScope *current_scope, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL) const; + CPPScope *current_scope, CPPScope *global_scope, + CPPPreprocessor *error_sink = NULL) const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPStructType *as_struct_type(); diff --git a/dtool/src/cppparser/cppTBDType.cxx b/dtool/src/cppparser/cppTBDType.cxx index f5c3540b24..550b646c52 100644 --- a/dtool/src/cppparser/cppTBDType.cxx +++ b/dtool/src/cppparser/cppTBDType.cxx @@ -95,7 +95,7 @@ get_fully_scoped_name() const { //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPTBDType:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPDeclaration *top = CPPDeclaration::substitute_decl(subst, current_scope, global_scope); if (top != this) { diff --git a/dtool/src/cppparser/cppTBDType.h b/dtool/src/cppparser/cppTBDType.h index 98eb09ace5..ca2a4a3053 100644 --- a/dtool/src/cppparser/cppTBDType.h +++ b/dtool/src/cppparser/cppTBDType.h @@ -13,7 +13,7 @@ class CPPIdentifier; /////////////////////////////////////////////////////////////////// -// Class : CPPTBDType +// Class : CPPTBDType // Description : This represents a type whose exact meaning is still // to-be-determined. It happens when a typename is // referenced in a template class (especially using the @@ -25,7 +25,7 @@ public: CPPTBDType(CPPIdentifier *ident); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; @@ -34,11 +34,11 @@ public: virtual string get_fully_scoped_name() const; virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPTBDType *as_tbd_type(); diff --git a/dtool/src/cppparser/cppTemplateParameterList.cxx b/dtool/src/cppparser/cppTemplateParameterList.cxx index f97897ca67..e55df519ba 100644 --- a/dtool/src/cppparser/cppTemplateParameterList.cxx +++ b/dtool/src/cppparser/cppTemplateParameterList.cxx @@ -41,8 +41,8 @@ get_string() const { //////////////////////////////////////////////////////////////////// void CPPTemplateParameterList:: build_subst_decl(const CPPTemplateParameterList &formal_params, - CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) const { + CPPDeclaration::SubstDecl &subst, + CPPScope *current_scope, CPPScope *global_scope) const { Parameters::const_iterator pfi, pai; for (pfi = formal_params._parameters.begin(), pai = _parameters.begin(); pfi != formal_params._parameters.end() && pai != _parameters.end(); @@ -66,25 +66,25 @@ build_subst_decl(const CPPTemplateParameterList &formal_params, // A value template parameter. Its default is an expression. CPPInstance *inst = decl->as_instance(); if (inst->_initializer != NULL) { - CPPDeclaration *decl = - inst->_initializer->substitute_decl(subst, current_scope, - global_scope); - if (!(*decl == *inst)) { - subst.insert(CPPDeclaration::SubstDecl::value_type - (inst, decl)); - } + CPPDeclaration *decl = + inst->_initializer->substitute_decl(subst, current_scope, + global_scope); + if (!(*decl == *inst)) { + subst.insert(CPPDeclaration::SubstDecl::value_type + (inst, decl)); + } } } else if (decl->as_class_template_parameter()) { // A class template parameter. CPPClassTemplateParameter *cparam = decl->as_class_template_parameter(); if (cparam->_default_type != NULL) { - CPPDeclaration *decl = - cparam->_default_type->substitute_decl(subst, current_scope, - global_scope); - if (!(*cparam == *decl)) { - subst.insert(CPPDeclaration::SubstDecl::value_type - (cparam, decl)); - } + CPPDeclaration *decl = + cparam->_default_type->substitute_decl(subst, current_scope, + global_scope); + if (!(*cparam == *decl)) { + subst.insert(CPPDeclaration::SubstDecl::value_type + (cparam, decl)); + } } } ++pfi; @@ -124,7 +124,7 @@ is_tbd() const { for (int i = 0; i < (int)_parameters.size(); i++) { CPPType *type = _parameters[i]->as_type(); if (type != (CPPType *)NULL && - (type->is_tbd() || type->as_class_template_parameter() != NULL)) { + (type->is_tbd() || type->as_class_template_parameter() != NULL)) { return true; } CPPExpression *expr = _parameters[i]->as_expression(); @@ -188,7 +188,7 @@ operator < (const CPPTemplateParameterList &other) const { //////////////////////////////////////////////////////////////////// CPPTemplateParameterList *CPPTemplateParameterList:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPTemplateParameterList *rep = new CPPTemplateParameterList(*this); bool anything_changed = false; @@ -221,7 +221,7 @@ output(ostream &out, CPPScope *scope) const { ++pi; while (pi != _parameters.end()) { - out << ", "; + out << ", "; (*pi)->output(out, 0, scope, false); ++pi; } @@ -244,7 +244,7 @@ write_formal(ostream &out, CPPScope *scope) const { ++pi; while (pi != _parameters.end()) { - out << ", "; + out << ", "; (*pi)->output(out, 0, scope, true); ++pi; } diff --git a/dtool/src/cppparser/cppTemplateParameterList.h b/dtool/src/cppparser/cppTemplateParameterList.h index 8f9820aa41..cbc20644c2 100644 --- a/dtool/src/cppparser/cppTemplateParameterList.h +++ b/dtool/src/cppparser/cppTemplateParameterList.h @@ -16,7 +16,7 @@ class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPTemplateParameterList +// Class : CPPTemplateParameterList // Description : This class serves to store the parameter list for a // template function or class, both for the formal // parameter list (given when the template is defined) @@ -29,8 +29,8 @@ public: string get_string() const; void build_subst_decl(const CPPTemplateParameterList &formal_params, - CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) const; + CPPDeclaration::SubstDecl &subst, + CPPScope *current_scope, CPPScope *global_scope) const; bool is_fully_specified() const; bool is_tbd() const; @@ -40,8 +40,8 @@ public: bool operator < (const CPPTemplateParameterList &other) const; CPPTemplateParameterList *substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); void output(ostream &out, CPPScope *scope) const; void write_formal(ostream &out, CPPScope *scope) const; @@ -62,7 +62,7 @@ operator << (ostream &out, const CPPTemplateParameterList &plist) { class CPPTPLCompare { public: bool operator () (const CPPTemplateParameterList *a, - const CPPTemplateParameterList *b) const { + const CPPTemplateParameterList *b) const { return (*a) < (*b); } }; diff --git a/dtool/src/cppparser/cppTemplateScope.cxx b/dtool/src/cppparser/cppTemplateScope.cxx index c62fd34934..6811331df6 100644 --- a/dtool/src/cppparser/cppTemplateScope.cxx +++ b/dtool/src/cppparser/cppTemplateScope.cxx @@ -29,8 +29,8 @@ CPPTemplateScope(CPPScope *parent_scope) : //////////////////////////////////////////////////////////////////// void CPPTemplateScope:: add_declaration(CPPDeclaration *decl, CPPScope *global_scope, - CPPPreprocessor *preprocessor, - const cppyyltype &pos) { + CPPPreprocessor *preprocessor, + const cppyyltype &pos) { decl->_template_scope = this; assert(_parent_scope != NULL); _parent_scope->add_declaration(decl, global_scope, preprocessor, pos); @@ -78,7 +78,7 @@ define_namespace(CPPNamespace *scope) { //////////////////////////////////////////////////////////////////// void CPPTemplateScope:: add_using(CPPUsing *using_decl, CPPScope *global_scope, - CPPPreprocessor *error_sink) { + CPPPreprocessor *error_sink) { assert(_parent_scope != NULL); _parent_scope->add_using(using_decl, global_scope, error_sink); } diff --git a/dtool/src/cppparser/cppTemplateScope.h b/dtool/src/cppparser/cppTemplateScope.h index 9a91e53c56..3531228efd 100644 --- a/dtool/src/cppparser/cppTemplateScope.h +++ b/dtool/src/cppparser/cppTemplateScope.h @@ -12,7 +12,7 @@ #include "cppTemplateParameterList.h" /////////////////////////////////////////////////////////////////// -// Class : CPPTemplateScope +// Class : CPPTemplateScope // Description : This is an implicit scope that is created following // the appearance of a "template" or // some such line in a C++ file. It simply defines the @@ -25,13 +25,13 @@ public: void add_template_parameter(CPPDeclaration *param); virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope, - CPPPreprocessor *preprocessor, - const cppyyltype &pos); + CPPPreprocessor *preprocessor, + const cppyyltype &pos); virtual void add_enum_value(CPPInstance *inst); virtual void define_extension_type(CPPExtensionType *type); virtual void define_namespace(CPPNamespace *scope); virtual void add_using(CPPUsing *using_decl, CPPScope *global_scope, - CPPPreprocessor *error_sink = NULL); + CPPPreprocessor *error_sink = NULL); virtual bool is_fully_specified() const; diff --git a/dtool/src/cppparser/cppToken.cxx b/dtool/src/cppparser/cppToken.cxx index 92d5825417..2fd42b90f8 100644 --- a/dtool/src/cppparser/cppToken.cxx +++ b/dtool/src/cppparser/cppToken.cxx @@ -17,8 +17,8 @@ //////////////////////////////////////////////////////////////////// CPPToken:: CPPToken(int token, int line_number, int col_number, - const CPPFile &file, const string &str, - const YYSTYPE &lval) : + const CPPFile &file, const string &str, + const YYSTYPE &lval) : _token(token), _lval(lval) { _lval.str = str; diff --git a/dtool/src/cppparser/cppToken.h b/dtool/src/cppparser/cppToken.h index 5d5750b413..1e40a4a832 100644 --- a/dtool/src/cppparser/cppToken.h +++ b/dtool/src/cppparser/cppToken.h @@ -11,15 +11,15 @@ #include "cppBisonDefs.h" /////////////////////////////////////////////////////////////////// -// Class : CPPToken +// Class : CPPToken // Description : //////////////////////////////////////////////////////////////////// class CPPToken { public: CPPToken(int token, int line_number = 0, int col_number = 0, - const CPPFile &file = CPPFile(""), - const string &str = string(), - const YYSTYPE &lval = YYSTYPE()); + const CPPFile &file = CPPFile(""), + const string &str = string(), + const YYSTYPE &lval = YYSTYPE()); CPPToken(const CPPToken ©); void operator = (const CPPToken ©); diff --git a/dtool/src/cppparser/cppType.cxx b/dtool/src/cppparser/cppType.cxx index 93478c7c34..1e08271d21 100644 --- a/dtool/src/cppparser/cppType.cxx +++ b/dtool/src/cppparser/cppType.cxx @@ -192,8 +192,8 @@ output_instance(ostream &out, const string &name, CPPScope *scope) const { //////////////////////////////////////////////////////////////////// void CPPType:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { output(out, indent_level, scope, complete); out << " " << prename << name; } diff --git a/dtool/src/cppparser/cppType.h b/dtool/src/cppparser/cppType.h index e492faba88..d511e13310 100644 --- a/dtool/src/cppparser/cppType.h +++ b/dtool/src/cppparser/cppType.h @@ -25,7 +25,7 @@ public: }; /////////////////////////////////////////////////////////////////// -// Class : CPPType +// Class : CPPType // Description : //////////////////////////////////////////////////////////////////// class CPPType : public CPPDeclaration { @@ -36,7 +36,7 @@ public: CPPType(const CPPFile &file); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; @@ -52,11 +52,11 @@ public: virtual bool is_equivalent(const CPPType &other) const; void output_instance(ostream &out, const string &name, - CPPScope *scope) const; + CPPScope *scope) const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual CPPType *as_type(); diff --git a/dtool/src/cppparser/cppTypeDeclaration.cxx b/dtool/src/cppparser/cppTypeDeclaration.cxx index 8651c4f8b4..3994f7175d 100644 --- a/dtool/src/cppparser/cppTypeDeclaration.cxx +++ b/dtool/src/cppparser/cppTypeDeclaration.cxx @@ -29,7 +29,7 @@ CPPTypeDeclaration(CPPType *type) : //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPTypeDeclaration:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPDeclaration *decl = CPPInstance::substitute_decl(subst, current_scope, global_scope); assert(decl != NULL); diff --git a/dtool/src/cppparser/cppTypeDeclaration.h b/dtool/src/cppparser/cppTypeDeclaration.h index 8185c8e3b7..c78e0792fe 100644 --- a/dtool/src/cppparser/cppTypeDeclaration.h +++ b/dtool/src/cppparser/cppTypeDeclaration.h @@ -11,7 +11,7 @@ #include "cppInstance.h" /////////////////////////////////////////////////////////////////// -// Class : CPPTypeDeclaration +// Class : CPPTypeDeclaration // Description : A CPPTypeDeclaration is a special declaration that // represents the top-level declaration of a type in a // source file. Typically this is the first appearance @@ -22,11 +22,11 @@ public: CPPTypeDeclaration(CPPType *type); virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPTypeDeclaration *as_type_declaration(); diff --git a/dtool/src/cppparser/cppTypeParser.h b/dtool/src/cppparser/cppTypeParser.h index 336382b07c..9cbfc33f02 100644 --- a/dtool/src/cppparser/cppTypeParser.h +++ b/dtool/src/cppparser/cppTypeParser.h @@ -14,7 +14,7 @@ class CPPType; class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPTypeParser +// Class : CPPTypeParser // Description : //////////////////////////////////////////////////////////////////// class CPPTypeParser : public CPPPreprocessor { diff --git a/dtool/src/cppparser/cppTypeProxy.cxx b/dtool/src/cppparser/cppTypeProxy.cxx index 861ddb851a..75c561251e 100644 --- a/dtool/src/cppparser/cppTypeProxy.cxx +++ b/dtool/src/cppparser/cppTypeProxy.cxx @@ -170,14 +170,14 @@ is_incomplete() const { //////////////////////////////////////////////////////////////////// void CPPTypeProxy:: output_instance(ostream &out, int indent_level, CPPScope *scope, - bool complete, const string &prename, - const string &name) const { + bool complete, const string &prename, + const string &name) const { if (_actual_type == (CPPType *)NULL) { out << "unknown " << prename << name; return; } _actual_type->output_instance(out, indent_level, scope, complete, - prename, name); + prename, name); } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/cppparser/cppTypeProxy.h b/dtool/src/cppparser/cppTypeProxy.h index da434f9cf7..bf6baefe47 100644 --- a/dtool/src/cppparser/cppTypeProxy.h +++ b/dtool/src/cppparser/cppTypeProxy.h @@ -12,7 +12,7 @@ /////////////////////////////////////////////////////////////////// -// Class : CPPTypeProxy +// Class : CPPTypeProxy // Description : This is a special kind of type that is a placeholder // for some type, currently unknown, that will be filled // in later. It's used when a type that references @@ -23,7 +23,7 @@ public: CPPTypeProxy(); virtual CPPType *resolve_type(CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *global_scope); virtual bool is_tbd() const; @@ -38,11 +38,11 @@ public: virtual bool is_incomplete() const; virtual void output_instance(ostream &out, int indent_level, - CPPScope *scope, - bool complete, const string &prename, - const string &name) const; + CPPScope *scope, + bool complete, const string &prename, + const string &name) const; virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; diff --git a/dtool/src/cppparser/cppTypedef.cxx b/dtool/src/cppparser/cppTypedef.cxx index 7323dd4476..27c549fbe5 100644 --- a/dtool/src/cppparser/cppTypedef.cxx +++ b/dtool/src/cppparser/cppTypedef.cxx @@ -39,7 +39,7 @@ CPPTypedef(CPPInstance *inst, bool global) : CPPInstance(*inst) //////////////////////////////////////////////////////////////////// CPPDeclaration *CPPTypedef:: substitute_decl(CPPDeclaration::SubstDecl &subst, - CPPScope *current_scope, CPPScope *global_scope) { + CPPScope *current_scope, CPPScope *global_scope) { CPPDeclaration *decl = CPPInstance::substitute_decl(subst, current_scope, global_scope); assert(decl != NULL); diff --git a/dtool/src/cppparser/cppTypedef.h b/dtool/src/cppparser/cppTypedef.h index e027b671a5..79ad492889 100644 --- a/dtool/src/cppparser/cppTypedef.h +++ b/dtool/src/cppparser/cppTypedef.h @@ -11,7 +11,7 @@ #include "cppInstance.h" /////////////////////////////////////////////////////////////////// -// Class : CPPTypedef +// Class : CPPTypedef // Description : //////////////////////////////////////////////////////////////////// class CPPTypedef : public CPPInstance { @@ -19,11 +19,11 @@ public: CPPTypedef(CPPInstance *instance, bool global); virtual CPPDeclaration *substitute_decl(SubstDecl &subst, - CPPScope *current_scope, - CPPScope *global_scope); + CPPScope *current_scope, + CPPScope *global_scope); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPTypedef *as_typedef(); diff --git a/dtool/src/cppparser/cppUsing.h b/dtool/src/cppparser/cppUsing.h index 9014bea635..e0570f2c54 100644 --- a/dtool/src/cppparser/cppUsing.h +++ b/dtool/src/cppparser/cppUsing.h @@ -14,7 +14,7 @@ class CPPIdentifier; class CPPScope; /////////////////////////////////////////////////////////////////// -// Class : CPPUsing +// Class : CPPUsing // Description : //////////////////////////////////////////////////////////////////// class CPPUsing : public CPPDeclaration { @@ -22,7 +22,7 @@ public: CPPUsing(CPPIdentifier *ident, bool full_namespace, const CPPFile &file); virtual void output(ostream &out, int indent_level, CPPScope *scope, - bool complete) const; + bool complete) const; virtual SubType get_subtype() const; virtual CPPUsing *as_using(); diff --git a/dtool/src/dconfig/configTable.cxx b/dtool/src/dconfig/configTable.cxx index bd6924ca92..4c6482afe4 100644 --- a/dtool/src/dconfig/configTable.cxx +++ b/dtool/src/dconfig/configTable.cxx @@ -41,9 +41,9 @@ bool ConfigTable::IsComment(const ConfigString& S) { if (!S.empty()) { for (ConfigString::iterator i=configcmt.begin(); - i!=configcmt.end(); ++i) + i!=configcmt.end(); ++i) if (S[0] == (*i)) - return true; + return true; } return false; } @@ -74,35 +74,35 @@ void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename) while (!is.eof()) { std::getline(is, line); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "read from " << Filename << ": '" << line - << "'" << endl; + microconfig_cat->spam() << "read from " << Filename << ": '" << line + << "'" << endl; CropString(line); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "cropped line to: '" << line << "'" - << endl; + microconfig_cat->spam() << "cropped line to: '" << line << "'" + << endl; if (!IsComment(line)) { - ConfigString protosym(PopNextWord(line)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "protosym is '" << protosym - << "' with value of '" << line << "'" - << endl; - size_t i(protosym.find(".")); - if (i == ConfigString::npos) { - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "this is an unqualified symbol" - << endl; - unqualified[protosym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename)); - } else { - ConfigString scope(protosym.substr(0, i)); - ConfigString sym(protosym.substr(i+1, ConfigString::npos)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "this is a qualified symbol." - << " scope '" << scope - << "', symbol '" << sym << "'" << endl; - (qualified[scope])[sym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename)); - } + ConfigString protosym(PopNextWord(line)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "protosym is '" << protosym + << "' with value of '" << line << "'" + << endl; + size_t i(protosym.find(".")); + if (i == ConfigString::npos) { + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "this is an unqualified symbol" + << endl; + unqualified[protosym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename)); + } else { + ConfigString scope(protosym.substr(0, i)); + ConfigString sym(protosym.substr(i+1, ConfigString::npos)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "this is a qualified symbol." + << " scope '" << scope + << "', symbol '" << sym << "'" << endl; + (qualified[scope])[sym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename)); + } } else if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "line is detected as a comment" << endl; + microconfig_cat->spam() << "line is detected as a comment" << endl; } } @@ -130,7 +130,7 @@ void ConfigTable::ReadConfigFile(void) { int i = configpath.find_first_of(" "); ConfigString stmp = configpath.substr(0, i); if (ExecutionEnvironment::has_environment_variable(stmp)) { - S += " "; + S += " "; S += ExecutionEnvironment::get_environment_variable(stmp); } configpath.erase(0, i); @@ -143,7 +143,7 @@ void ConfigTable::ReadConfigFile(void) { } if (microconfig_cat->is_spam()) microconfig_cat->spam() << "evaluated value of configpath '" - << configpath << "'" << endl; + << configpath << "'" << endl; DSearchPath config_search(configpath); DSearchPath::Results config_files; @@ -151,24 +151,24 @@ void ConfigTable::ReadConfigFile(void) { if (!configsuffix.empty()) { if (microconfig_cat->is_spam()) microconfig_cat->spam() << "agregate config name is: " - << (configname + configsuffix) << endl; + << (configname + configsuffix) << endl; config_search.find_all_files(configname + configsuffix, config_files); if (microconfig_cat->is_spam()) microconfig_cat->spam() << "found " << config_files.get_num_files() - << " files" << endl; + << " files" << endl; } else { if (microconfig_cat->is_spam()) microconfig_cat->spam() << "searching for '" << configname << "'" - << endl; + << endl; config_search.find_all_files(configname, config_files); if (microconfig_cat->is_spam()) microconfig_cat->spam() << "found " << config_files.get_num_files() - << " files" << endl; + << " files" << endl; } if (microconfig_cat->is_spam()) microconfig_cat->spam() << "configpath parsed and searched" - << endl; + << endl; int num_config_files = config_files.get_num_files(); for (int i = num_config_files - 1; i >= 0; i--) { @@ -176,19 +176,19 @@ void ConfigTable::ReadConfigFile(void) { if (microconfig_cat->is_spam()) microconfig_cat->spam() << "examining file '" << config_file << "'" - << endl; + << endl; if (config_file.is_executable()) { ConfigString line = config_file.to_os_specific() + " " - + ExecutionEnvironment::get_binary_name(); + + ExecutionEnvironment::get_binary_name(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "file is executable, running '" - << line << "'" << endl; + microconfig_cat->spam() << "file is executable, running '" + << line << "'" << endl; IPipeStream ifs(line); ParseConfigFile(ifs, config_file); } else { if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "file is not executable, reading normally" << endl; + microconfig_cat->spam() + << "file is not executable, reading normally" << endl; #ifdef PENV_PS2 ConfigString line = PS2_FILE_PREFIX + convert_pathname(config_file); @@ -202,8 +202,8 @@ void ConfigTable::ReadConfigFile(void) { while (sceRead(fd, line_buffer, 2048) > 0) { - file_buffer += line_buffer; - memset(line_buffer, 0, 2048); + file_buffer += line_buffer; + memset(line_buffer, 0, 2048); } sceClose(fd); @@ -221,43 +221,43 @@ void ConfigTable::ParseCommandEnv(ConfigString& S, const ConfigString& sym) { if (microconfig_cat->is_spam()) microconfig_cat->spam() << "value of '" << sym << "' is '" << S << "'" - << endl; + << endl; while (!S.empty()) { ConfigString protosym(PopNextWord(S)); bool ok = false; bool state = false; if (protosym[0] == '-') - ok = true; + ok = true; else if (protosym[0] == '+') { - ok = true; - state = true; + ok = true; + state = true; } if (ok) { - protosym.erase(0, 1); - CropString(protosym); - size_t i(protosym.find(".")); - if (i == ConfigString::npos) { - unqualified[protosym].push_back(SymEnt(SymEnt::CommandEnv, - NextWord(S), sym, state)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "unqualified symbol '" << protosym - << "' with value '" << NextWord(S) - << "'" << endl; - } else { - ConfigString scope(protosym.substr(0, i)); - ConfigString sym(protosym.substr(i+1, ConfigString::npos)); - (qualified[scope])[sym].push_back(SymEnt(SymEnt::CommandEnv, - NextWord(S), sym, state)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "qualified symbol '" << sym - << "' in scope '" << scope - << "' and value '" << NextWord(S) - << "'" << endl; - } + protosym.erase(0, 1); + CropString(protosym); + size_t i(protosym.find(".")); + if (i == ConfigString::npos) { + unqualified[protosym].push_back(SymEnt(SymEnt::CommandEnv, + NextWord(S), sym, state)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "unqualified symbol '" << protosym + << "' with value '" << NextWord(S) + << "'" << endl; + } else { + ConfigString scope(protosym.substr(0, i)); + ConfigString sym(protosym.substr(i+1, ConfigString::npos)); + (qualified[scope])[sym].push_back(SymEnt(SymEnt::CommandEnv, + NextWord(S), sym, state)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "qualified symbol '" << sym + << "' in scope '" << scope + << "' and value '" << NextWord(S) + << "'" << endl; + } } else if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "'" << protosym - << "' was not recognized as an option" - << endl; + microconfig_cat->spam() << "'" << protosym + << "' was not recognized as an option" + << endl; } } @@ -283,31 +283,31 @@ void ConfigTable::ParseArgs(void) size_t i(line.find(".")); ConfigString aparam; if (n + 1 < num_args) { - aparam = ExecutionEnvironment::get_arg(n + 1); + aparam = ExecutionEnvironment::get_arg(n + 1); } if (i == ConfigString::npos) { - unqualified[line].push_back(SymEnt(SymEnt::Commandline, - aparam, "", state)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "unqualified symbol '" << line - << "' with value '" << aparam - << "'" << endl; + unqualified[line].push_back(SymEnt(SymEnt::Commandline, + aparam, "", state)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "unqualified symbol '" << line + << "' with value '" << aparam + << "'" << endl; } else { - ConfigString scope(line.substr(0, i)); - ConfigString sym(line.substr(i+1, ConfigString::npos)); - (qualified[scope])[sym].push_back(SymEnt(SymEnt::Commandline, - aparam, "", state)); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "qualified symbol '" << sym - << "' with scope '" << scope - << "' and value '" << aparam - << "'" << endl; + ConfigString scope(line.substr(0, i)); + ConfigString sym(line.substr(i+1, ConfigString::npos)); + (qualified[scope])[sym].push_back(SymEnt(SymEnt::Commandline, + aparam, "", state)); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "qualified symbol '" << sym + << "' with scope '" << scope + << "' and value '" << aparam + << "'" << endl; } } else if (microconfig_cat->is_spam()) { microconfig_cat->spam() << "argument #" << n << " ('" << line - << "') is not recognized as an option" - << endl; + << "') is not recognized as an option" + << endl; } ++n; } @@ -349,149 +349,149 @@ void ConfigTable::MicroConfig(void) if (!cc.empty()) { ConfigString configconfig(cc); if (configconfig.length() > 1) { - ConfigString assign = "="; - ConfigString sep = configconfig.substr(0, 1); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "separator character is: '" << sep - << "'" << endl; - typedef std::vector strvec; - typedef Serialize::Deserializer > deser; - configconfig.erase(0, 1); - deser ds(configconfig, sep); - strvec sv = ds; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "extracted vector of microconfig options" << endl; - for (strvec::iterator i=sv.begin(); i!=sv.end(); ++i) { - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "parsing microconfig option '" - << *i << "'" << endl; - if ((*i).length() == 1) { - // new assignment character - assign += *i; - continue; - } - size_t j = (*i).find_first_of(assign); - if (j != ConfigString::npos) { - ConfigString tok = (*i).substr(0, j); - ConfigString rest = (*i).substr(j+1, ConfigString::npos); - if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "split microconfig option into '" - << tok << "' and '" << rest << "'" - << endl; - if (tok == "pathsep") { - pathsep = rest; - psep = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig pathsep directive, " - << "setting the path separator to '" << pathsep << "'" - << endl; - } else if (tok == "filesep") { - filesep = rest; - fsep = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig filesep directive, " - << "setting the file separator to '" << filesep << "'" - << endl; - } else if (tok == "configname") { - configname = rest; - cname = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configname directive, " - << "setting the configfile name to '" << configname - << "'" << endl; - } else if (tok == "configsuffix") { - configsuffix = rest; - csuff = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configsuffix directive, " - << "setting the config file suffix to '" - << configsuffix << "'" - << endl; - } else if (tok == "configpath") { - if (cpath) { - configpath += " " + rest; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configpath directive, " - << "adding '" << rest << "' to the configpath" - << endl; - } else { - configpath = rest; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configpath directive, " - << "setting the configpath to '" << configpath << "'" - << endl; - } - cpath = true; - } else if (tok == "configcmt") { - configcmt = rest; - ccmt = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configcmt directive, " - << "setting the config comment to '" << configcmt - << "'" << endl; - } else if (tok == "argsuffix") { - argsuffix = rest; - asuff = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig argsuffix directive, " - << "setting the argument environment suffix to '" - << argsuffix << "'" << endl; - } else if (tok == "commandstub") { - commandstub = rest; - cstub = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig commandstub directive, " - << "setting the command environment stub " - << "to '" << commandstub << "'" << endl; - } else if (tok == "configdbg") { - configdbg = TrueOrFalse(rest); - cdbg = true; - if (configdbg) { - microconfig_cat->set_severity(NS_spam); - dconfig_cat->set_severity(NS_spam); - } else { - microconfig_cat->set_severity(NS_info); - dconfig_cat->set_severity(NS_info); - } - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig configdbg directive, " - << "setting the config spam state to " << configdbg - << endl; - } else if (tok == "readargs") { - readargs = TrueOrFalse(rest); - rdarg = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig readargs directive, " - << (readargs?"will":"will not") - << " read from the commandline." << endl; - } else if (tok == "readenv") { - readenvs = TrueOrFalse(rest); - rdenv = true; - if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "got a microconfig readenv directive, " - << (readargs?"will":"will not") - << " read the environment." << endl; - } - } else if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "no '=' in microconfig option, ignoring it" << endl; - } + ConfigString assign = "="; + ConfigString sep = configconfig.substr(0, 1); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "separator character is: '" << sep + << "'" << endl; + typedef std::vector strvec; + typedef Serialize::Deserializer > deser; + configconfig.erase(0, 1); + deser ds(configconfig, sep); + strvec sv = ds; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "extracted vector of microconfig options" << endl; + for (strvec::iterator i=sv.begin(); i!=sv.end(); ++i) { + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "parsing microconfig option '" + << *i << "'" << endl; + if ((*i).length() == 1) { + // new assignment character + assign += *i; + continue; + } + size_t j = (*i).find_first_of(assign); + if (j != ConfigString::npos) { + ConfigString tok = (*i).substr(0, j); + ConfigString rest = (*i).substr(j+1, ConfigString::npos); + if (microconfig_cat->is_spam()) + microconfig_cat->spam() << "split microconfig option into '" + << tok << "' and '" << rest << "'" + << endl; + if (tok == "pathsep") { + pathsep = rest; + psep = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig pathsep directive, " + << "setting the path separator to '" << pathsep << "'" + << endl; + } else if (tok == "filesep") { + filesep = rest; + fsep = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig filesep directive, " + << "setting the file separator to '" << filesep << "'" + << endl; + } else if (tok == "configname") { + configname = rest; + cname = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configname directive, " + << "setting the configfile name to '" << configname + << "'" << endl; + } else if (tok == "configsuffix") { + configsuffix = rest; + csuff = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configsuffix directive, " + << "setting the config file suffix to '" + << configsuffix << "'" + << endl; + } else if (tok == "configpath") { + if (cpath) { + configpath += " " + rest; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configpath directive, " + << "adding '" << rest << "' to the configpath" + << endl; + } else { + configpath = rest; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configpath directive, " + << "setting the configpath to '" << configpath << "'" + << endl; + } + cpath = true; + } else if (tok == "configcmt") { + configcmt = rest; + ccmt = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configcmt directive, " + << "setting the config comment to '" << configcmt + << "'" << endl; + } else if (tok == "argsuffix") { + argsuffix = rest; + asuff = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig argsuffix directive, " + << "setting the argument environment suffix to '" + << argsuffix << "'" << endl; + } else if (tok == "commandstub") { + commandstub = rest; + cstub = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig commandstub directive, " + << "setting the command environment stub " + << "to '" << commandstub << "'" << endl; + } else if (tok == "configdbg") { + configdbg = TrueOrFalse(rest); + cdbg = true; + if (configdbg) { + microconfig_cat->set_severity(NS_spam); + dconfig_cat->set_severity(NS_spam); + } else { + microconfig_cat->set_severity(NS_info); + dconfig_cat->set_severity(NS_info); + } + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig configdbg directive, " + << "setting the config spam state to " << configdbg + << endl; + } else if (tok == "readargs") { + readargs = TrueOrFalse(rest); + rdarg = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig readargs directive, " + << (readargs?"will":"will not") + << " read from the commandline." << endl; + } else if (tok == "readenv") { + readenvs = TrueOrFalse(rest); + rdenv = true; + if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "got a microconfig readenv directive, " + << (readargs?"will":"will not") + << " read the environment." << endl; + } + } else if (microconfig_cat->is_spam()) + microconfig_cat->spam() + << "no '=' in microconfig option, ignoring it" << endl; + } } else if (microconfig_cat->is_spam()) - microconfig_cat->spam() - << "CONFIG_CONFIG contains only a single character" << endl; + microconfig_cat->spam() + << "CONFIG_CONFIG contains only a single character" << endl; } else if (microconfig_cat->is_spam()) microconfig_cat->spam() << "CONFIG_CONFIG is empty" << endl; if (!cdbg) @@ -499,72 +499,72 @@ void ConfigTable::MicroConfig(void) if (!psep) { PathSepDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for pathsep, " - << "setting to default '" << pathsep << "'" - << endl; + microconfig_cat->spam() << "no microconfig for pathsep, " + << "setting to default '" << pathsep << "'" + << endl; } if (!fsep) { FileSepDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for filesep, " - << "setting to default '" << filesep << "'" - << endl; + microconfig_cat->spam() << "no microconfig for filesep, " + << "setting to default '" << filesep << "'" + << endl; } if (!cname) { ConfigNameDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for configname, " - << "setting to default '" << configname - << "'" << endl; + microconfig_cat->spam() << "no microconfig for configname, " + << "setting to default '" << configname + << "'" << endl; } if (!csuff) { ConfigSuffixDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for configsuffix, " - << "setting to default '" << configsuffix - << "'" << endl; + microconfig_cat->spam() << "no microconfig for configsuffix, " + << "setting to default '" << configsuffix + << "'" << endl; } if (!cpath) { ConfigPathDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for configpath, " - << "setting to default '" << configpath - << "'" << endl; + microconfig_cat->spam() << "no microconfig for configpath, " + << "setting to default '" << configpath + << "'" << endl; } if (!ccmt) { ConfigCmtDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for configcmt, " - << "setting to default '" << configcmt - << "'" << endl; + microconfig_cat->spam() << "no microconfig for configcmt, " + << "setting to default '" << configcmt + << "'" << endl; } if (!asuff) { ArgSuffixDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for argsuffix, " - << "setting to default '" << argsuffix - << "'" << endl; + microconfig_cat->spam() << "no microconfig for argsuffix, " + << "setting to default '" << argsuffix + << "'" << endl; } if (!cstub) { CommandStubDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for commandstub, " - << "setting to default '" << commandstub - << "'" << endl; + microconfig_cat->spam() << "no microconfig for commandstub, " + << "setting to default '" << commandstub + << "'" << endl; } if (!rdarg) { ReadArgsDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for readargs, " - << "setting to default: " - << (readargs?"true":"false") << endl; + microconfig_cat->spam() << "no microconfig for readargs, " + << "setting to default: " + << (readargs?"true":"false") << endl; } if (!rdenv) { ReadEnvsDefault(); if (microconfig_cat->is_spam()) - microconfig_cat->spam() << "no microconfig for readenv, " - << "setting to default: " - << (readargs?"true":"false") << endl; + microconfig_cat->spam() << "no microconfig for readenv, " + << "setting to default: " + << (readargs?"true":"false") << endl; } } @@ -576,7 +576,7 @@ void ConfigTable::GetData(void) { ConfigString comarg = commandstub + argsuffix; if (microconfig_cat->is_spam()) microconfig_cat->spam() << "comarg is '" << comarg << "'" - << endl; + << endl; if (ExecutionEnvironment::has_environment_variable(comarg)) { ConfigString env = ExecutionEnvironment::get_environment_variable(comarg); ParseCommandEnv(env, comarg); @@ -585,7 +585,7 @@ void ConfigTable::GetData(void) { UpCase(line); if (microconfig_cat->is_spam()) microconfig_cat->spam() << "binarg is '" << line << "'" - << endl; + << endl; if (ExecutionEnvironment::has_environment_variable(line)) { ConfigString env = ExecutionEnvironment::get_environment_variable(line); ParseCommandEnv(env, line); @@ -632,13 +632,13 @@ bool ConfigTable::TrueOrFalse(const ConfigString& in, bool def) { } bool ConfigTable::Defined(const ConfigString& sym, - const ConfigString qual) { + const ConfigString qual) { #ifdef DISABLE_CONFIG return false; #else if (qual.empty()) { return (unqualified.count(sym) != 0 || - ExecutionEnvironment::has_environment_variable(sym)); + ExecutionEnvironment::has_environment_variable(sym)); } else { TableMap::const_iterator ti; @@ -646,7 +646,7 @@ bool ConfigTable::Defined(const ConfigString& sym, if (ti != qualified.end()) { const SymbolTable &table = (*ti).second; if (table.count(sym) != 0) { - return true; + return true; } } @@ -656,7 +656,7 @@ bool ConfigTable::Defined(const ConfigString& sym, } ConfigTable::SymEnt ConfigTable::Get(const ConfigString& sym, - const ConfigString qual) { + const ConfigString qual) { #ifndef DISABLE_CONFIG const ConfigTable::Symbol &symbol = GetSym(sym, qual); if (!symbol.empty()) { @@ -680,7 +680,7 @@ ConfigTable::SymEnt ConfigTable::Get(const ConfigString& sym, } const ConfigTable::Symbol& ConfigTable::GetSym(const ConfigString& sym, - const ConfigString qual) { + const ConfigString qual) { static ConfigTable::Symbol empty_symbol; #ifndef DISABLE_CONFIG @@ -700,7 +700,7 @@ const ConfigTable::Symbol& ConfigTable::GetSym(const ConfigString& sym, SymbolTable::const_iterator si; si = table.find(sym); if (si != table.end()) { - return (*si).second; + return (*si).second; } } } diff --git a/dtool/src/dconfig/configTable.h b/dtool/src/dconfig/configTable.h index 8c6a988596..c2433e72ce 100644 --- a/dtool/src/dconfig/configTable.h +++ b/dtool/src/dconfig/configTable.h @@ -72,7 +72,7 @@ class EXPCL_DTOOLCONFIG ConfigTable { bool Defined(const ConfigString& sym, const ConfigString qual=""); SymEnt Get(const ConfigString& sym, const ConfigString qual = ""); const Symbol& GetSym(const ConfigString& sym, - const ConfigString qual = ""); + const ConfigString qual = ""); INLINE ConfigString GetConfigPath(void) const; }; diff --git a/dtool/src/dconfig/dconfig.h b/dtool/src/dconfig/dconfig.h index abe264ee3f..205889fdcf 100644 --- a/dtool/src/dconfig/dconfig.h +++ b/dtool/src/dconfig/dconfig.h @@ -63,14 +63,14 @@ class Config { static bool Defined(const ConfigString& sym); static ConfigString Get(const ConfigString sym); static ConfigTable::Symbol& GetAll(const ConfigString, - ConfigTable::Symbol&); + ConfigTable::Symbol&); PUBLISHED: static bool GetBool(const ConfigString sym, bool def = false); static int GetInt(const ConfigString sym, int def = 0); static float GetFloat(const ConfigString sym, float def = 0.); static double GetDouble(const ConfigString sym, double def = 0.); static ConfigString GetString(const ConfigString sym, - const ConfigString def = ""); + const ConfigString def = ""); }; // Implementation follows @@ -121,11 +121,11 @@ void Config::Init(void) ConfigString s = Get("notify-level-config"); NotifySeverity sev = Notify::string_severity(s); if (sev != NS_unspecified) { - microconfig_cat->set_severity(sev); - dconfig_cat->set_severity(sev); + microconfig_cat->set_severity(sev); + dconfig_cat->set_severity(sev); } else { - microconfig_cat->set_severity(NS_info); - dconfig_cat->set_severity(NS_info); + microconfig_cat->set_severity(NS_info); + dconfig_cat->set_severity(NS_info); } } else { microconfig_cat->set_severity(NS_info); @@ -137,11 +137,11 @@ void Config::Init(void) if (dconfig_cat->is_spam()) dconfig_cat->spam() << "calling ConfigFunc for '" << Name() << "'" - << endl; + << endl; ConfigFunc(); if (dconfig_cat->is_spam()) dconfig_cat->spam() << "back from ConfigFunc for '" << Name() << "'" - << endl; + << endl; total_time_external_init += clock(); } @@ -187,7 +187,7 @@ ConfigString Config::Get(ConfigString sym) template ConfigTable::Symbol& Config::GetAll(const ConfigString sym, - ConfigTable::Symbol& s) + ConfigTable::Symbol& s) { Init(); ConfigTable* tab = ConfigTable::Instance(); @@ -214,15 +214,15 @@ bool Config::GetBool(const ConfigString sym, bool def) ConfigString s = Get(sym); bool ret = ConfigTable::TrueOrFalse(s, def); if (dconfig_cat->is_spam()) - dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " - << (ret?"true":"false") << endl; + dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " + << (ret?"true":"false") << endl; return ret; } else { if (dconfig_cat->is_spam()) - dconfig_cat->spam() - << "symbol '" << sym - << "' is not defined, returning provided default: " - << (def?"true":"false") << endl; + dconfig_cat->spam() + << "symbol '" << sym + << "' is not defined, returning provided default: " + << (def?"true":"false") << endl; return def; } } @@ -237,14 +237,14 @@ int Config::GetInt(const ConfigString sym, int def) int i; s >> i; if (dconfig_cat->is_spam()) - dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " - << i << endl; + dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " + << i << endl; return i; } else { if (dconfig_cat->is_spam()) - dconfig_cat->spam() - << "symbol '" << sym - << "' is not defined, returning provided default: " << def << endl; + dconfig_cat->spam() + << "symbol '" << sym + << "' is not defined, returning provided default: " << def << endl; return def; } } @@ -259,14 +259,14 @@ float Config::GetFloat(const ConfigString sym, float def) float f; s >> f; if (dconfig_cat->is_spam()) - dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " - << f << endl; + dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " + << f << endl; return f; } else { if (dconfig_cat->is_spam()) - dconfig_cat->spam() - << "symbol '" << sym - << "' is not defined, returning provided default: " << def << endl; + dconfig_cat->spam() + << "symbol '" << sym + << "' is not defined, returning provided default: " << def << endl; return def; } } @@ -281,35 +281,35 @@ double Config::GetDouble(const ConfigString sym, double def) double d; s >> d; if (dconfig_cat->is_spam()) - dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " - << d << endl; + dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: " + << d << endl; return d; } else { if (dconfig_cat->is_spam()) - dconfig_cat->spam() - << "symbol '" << sym - << "' is not defined, returning provided default: " << def << endl; + dconfig_cat->spam() + << "symbol '" << sym + << "' is not defined, returning provided default: " << def << endl; return def; } } template ConfigString Config::GetString(const ConfigString sym, - const ConfigString def) + const ConfigString def) { Init(); if (Defined(sym)) { ConfigString ret = Get(sym); if (dconfig_cat->is_spam()) - dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: '" - << ret << "'" << endl; + dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: '" + << ret << "'" << endl; return ret; } else { if (dconfig_cat->is_spam()) - dconfig_cat->spam() - << "symbol '" << sym - << "' is not defined, returning provided default: '" << def - << "'" << endl; + dconfig_cat->spam() + << "symbol '" << sym + << "' is not defined, returning provided default: '" << def + << "'" << endl; return def; } } diff --git a/dtool/src/dconfig/notify.cxx b/dtool/src/dconfig/notify.cxx index 13d8f0fb9f..4235f3ade5 100644 --- a/dtool/src/dconfig/notify.cxx +++ b/dtool/src/dconfig/notify.cxx @@ -378,7 +378,7 @@ ptr() { //////////////////////////////////////////////////////////////////// bool Notify:: assert_failure(const char *expression, int line, - const char *source_file) { + const char *source_file) { ostringstream message_str; message_str << expression << " at line " << line << " of " << source_file; @@ -471,23 +471,23 @@ config_initialized() { string notify_output = config_notify.GetString("notify-output", ""); if (!notify_output.empty()) { if (notify_output == "stdout") { - cout.setf(ios::unitbuf); - set_ostream_ptr(&cout, false); + cout.setf(ios::unitbuf); + set_ostream_ptr(&cout, false); } else if (notify_output == "stderr") { - set_ostream_ptr(&cerr, false); + set_ostream_ptr(&cerr, false); } else { - Filename filename = notify_output; - filename.set_text(); - ofstream *out = new ofstream; - if (!filename.open_write(*out)) { - nout << "Unable to open file " << filename << " for output.\n"; - delete out; - } else { - out->setf(ios::unitbuf); - set_ostream_ptr(out, true); - } + Filename filename = notify_output; + filename.set_text(); + ofstream *out = new ofstream; + if (!filename.open_write(*out)) { + nout << "Unable to open file " << filename << " for output.\n"; + delete out; + } else { + out->setf(ios::unitbuf); + set_ostream_ptr(out, true); + } } } } diff --git a/dtool/src/dconfig/notify.h b/dtool/src/dconfig/notify.h index 3a5619f030..01ce119d63 100644 --- a/dtool/src/dconfig/notify.h +++ b/dtool/src/dconfig/notify.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : Notify +// Class : Notify // Description : An object that handles general error reporting to the // user. It contains a pointer to an ostream, initially // cerr, which can be reset at will to point to @@ -38,7 +38,7 @@ PUBLISHED: ostream *get_ostream_ptr() const; typedef bool AssertHandler(const char *expression, int line, - const char *source_file); + const char *source_file); void set_assert_handler(AssertHandler *assert_handler); void clear_assert_handler(); @@ -51,9 +51,9 @@ PUBLISHED: NotifyCategory *get_top_category(); NotifyCategory *get_category(const string &basename, - NotifyCategory *parent_category); + NotifyCategory *parent_category); NotifyCategory *get_category(const string &basename, - const string &parent_fullname); + const string &parent_fullname); NotifyCategory *get_category(const string &fullname); static ostream &out(); @@ -65,7 +65,7 @@ public: static long get_literal_flag(); bool assert_failure(const char *expression, int line, - const char *source_file); + const char *source_file); static NotifySeverity string_severity(const string &string); diff --git a/dtool/src/dconfig/notifyCategory.cxx b/dtool/src/dconfig/notifyCategory.cxx index 97ffee343f..c8513a8629 100644 --- a/dtool/src/dconfig/notifyCategory.cxx +++ b/dtool/src/dconfig/notifyCategory.cxx @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// NotifyCategory:: NotifyCategory(const string &fullname, const string &basename, - NotifyCategory *parent) : + NotifyCategory *parent) : _fullname(fullname), _basename(basename), _parent(parent) @@ -49,8 +49,8 @@ NotifyCategory(const string &fullname, const string &basename, _severity = Notify::string_severity(severity_name); if (_severity == NS_unspecified) { - nout << "Invalid severity name for " << config_name << ": " - << severity_name << "\n"; + nout << "Invalid severity name for " << config_name << ": " + << severity_name << "\n"; } } } @@ -86,19 +86,19 @@ out(NotifySeverity severity, bool prefix) const { if (is_on(severity)) { if (prefix) { if (get_notify_timestamp()) { - // Format a timestamp to include as a prefix as well. - time_t now = time(NULL); - struct tm *ptm = localtime(&now); - - char buffer[128]; - strftime(buffer, 128, ":%m-%d-%Y %H:%M:%S ", ptm); - nout << buffer; + // Format a timestamp to include as a prefix as well. + time_t now = time(NULL); + struct tm *ptm = localtime(&now); + + char buffer[128]; + strftime(buffer, 128, ":%m-%d-%Y %H:%M:%S ", ptm); + nout << buffer; } if (severity == NS_info) { - return nout << *this << ": "; + return nout << *this << ": "; } else { - return nout << *this << "(" << severity << "): "; + return nout << *this << "(" << severity << "): "; } } else { return nout; diff --git a/dtool/src/dconfig/notifyCategory.h b/dtool/src/dconfig/notifyCategory.h index 8f307d225e..a0dbc711d0 100644 --- a/dtool/src/dconfig/notifyCategory.h +++ b/dtool/src/dconfig/notifyCategory.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NotifyCategory +// Class : NotifyCategory // Description : A particular category of error messages. Typically // there will be one of these per package, so that we // can turn on or off error messages at least at a @@ -25,7 +25,7 @@ class EXPCL_DTOOLCONFIG NotifyCategory { private: NotifyCategory(const string &fullname, const string &basename, - NotifyCategory *parent); + NotifyCategory *parent); PUBLISHED: INLINE string get_fullname() const; diff --git a/dtool/src/dconfig/notifyCategoryProxy.h b/dtool/src/dconfig/notifyCategoryProxy.h index c64516f677..f57c0fe8b3 100644 --- a/dtool/src/dconfig/notifyCategoryProxy.h +++ b/dtool/src/dconfig/notifyCategoryProxy.h @@ -13,7 +13,7 @@ #include "notify.h" //////////////////////////////////////////////////////////////////// -// Class : NotifyCategoryProxy +// Class : NotifyCategoryProxy // Description : A handy wrapper around a NotifyCategory pointer. // This wrapper pretends to be a NotifyCategory object // itself, except that it is capable of initializing its diff --git a/dtool/src/dconfig/serialization.h b/dtool/src/dconfig/serialization.h index 73efccdbac..47c2be235c 100644 --- a/dtool/src/dconfig/serialization.h +++ b/dtool/src/dconfig/serialization.h @@ -16,9 +16,9 @@ template class StdIns { public: INLINE ConfigString operator()(const X& val) { - ostringstream oss; - oss << val; - return oss.str(); + ostringstream oss; + oss << val; + return oss.str(); } }; @@ -26,10 +26,10 @@ template class StdExt { public: INLINE X operator()(ConfigString S) { - istringstream iss(S); - X ret; - iss >> ret; - return ret; + istringstream iss(S); + X ret; + iss >> ret; + return ret; } }; @@ -47,15 +47,15 @@ class Serializer { Serializer() {} public: Serializer(const Collection& C, ConfigString Delim = ":") : - _result(Serializer::SerializeToString(C, Delim)) {} + _result(Serializer::SerializeToString(C, Delim)) {} Serializer(const Serializer& c) : _result(c._result) {} ~Serializer() {} INLINE ConfigString operator()() { return _result; } INLINE ConfigString operator()(const Collection& C, - const ConfigString& Delim = ":") { - _result = SerializeToString(C, Delim); - return _result; + const ConfigString& Delim = ":") { + _result = SerializeToString(C, Delim); + return _result; } INLINE operator ConfigString() { return _result; } }; @@ -63,14 +63,14 @@ class Serializer { template ConfigString Serializer::SerializeToString(const Collection& C, - const ConfigString& Delim) + const ConfigString& Delim) { ConfigString ret; Inserter in; for (TYPENAME Collection::const_iterator i=C.begin(); i!=C.end(); ++i) { if (i != C.begin()) - ret += Delim; + ret += Delim; ret += in(*i); } return ret; @@ -84,86 +84,86 @@ class Deserializer { INLINE void Clear() { _result.erase(_result.begin(), _result.end()); } template int FindFirstOfInString(ConfigString S, ForwardIterator DelimBegin, - ForwardIterator DelimEnd) { - int i = ConfigString::npos; - ForwardIterator j = DelimBegin; + ForwardIterator DelimEnd) { + int i = ConfigString::npos; + ForwardIterator j = DelimBegin; - while (j != DelimEnd) { - int k = S.find(*j); - if (k != ConfigString::npos) - if ((i == ConfigString::npos) || (i > k)) - i = k; - ++j; - } - return i; + while (j != DelimEnd) { + int k = S.find(*j); + if (k != ConfigString::npos) + if ((i == ConfigString::npos) || (i > k)) + i = k; + ++j; + } + return i; } template int FindFirstNotOfInString(ConfigString S, ForwardIterator DelimBegin, - ForwardIterator DelimEnd) { - int i = ConfigString::npos; - ForwardIterator j = DelimBegin; - ForwardIterator k = DelimBegin; + ForwardIterator DelimEnd) { + int i = ConfigString::npos; + ForwardIterator j = DelimBegin; + ForwardIterator k = DelimBegin; - while (j != DelimEnd) { - int l = S.find(*j); - if (l != ConfigString::npos) - if ((i == ConfigString::npos) || (i > l)) { - i = l; - k = j; - } - ++j; - } - if (i != ConfigString::npos) { - i += Serialize::Length(*k); - if (i >= S.length()) - i = ConfigString::npos; - } - return i; + while (j != DelimEnd) { + int l = S.find(*j); + if (l != ConfigString::npos) + if ((i == ConfigString::npos) || (i > l)) { + i = l; + k = j; + } + ++j; + } + if (i != ConfigString::npos) { + i += Serialize::Length(*k); + if (i >= S.length()) + i = ConfigString::npos; + } + return i; } template void DeserializeFromString(ConfigString S, ForwardIterator DelimBegin, - ForwardIterator DelimEnd) { - Clear(); - Extractor ex; + ForwardIterator DelimEnd) { + Clear(); + Extractor ex; - while (!S.empty()) { - int i = FindFirstOfInString(S, DelimBegin, DelimEnd); - _result.push_back(ex(S.substr(0, i))); - S.erase(0, i); - i = FindFirstNotOfInString(S, DelimBegin, DelimEnd); - S.erase(0, i); - } + while (!S.empty()) { + int i = FindFirstOfInString(S, DelimBegin, DelimEnd); + _result.push_back(ex(S.substr(0, i))); + S.erase(0, i); + i = FindFirstNotOfInString(S, DelimBegin, DelimEnd); + S.erase(0, i); + } } void DeserializeFromString(ConfigString S, ConfigString Delim) { - Clear(); - Extractor ex; + Clear(); + Extractor ex; - while (!S.empty()) { - size_t i = S.find_first_of(Delim); - _result.push_back(ex(S.substr(0, i))); - if (i == ConfigString::npos) - S.erase(0, i); - else - S.erase(0, i+1); - } + while (!S.empty()) { + size_t i = S.find_first_of(Delim); + _result.push_back(ex(S.substr(0, i))); + if (i == ConfigString::npos) + S.erase(0, i); + else + S.erase(0, i+1); + } } Deserializer() {} public: Deserializer(ConfigString S, ConfigString Delim = ":") { - Deserializer::DeserializeFromString(S, Delim); + Deserializer::DeserializeFromString(S, Delim); } template Deserializer(ConfigString S, ForwardIterator DelimBegin, - ForwardIterator DelimEnd) { - Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd); + ForwardIterator DelimEnd) { + Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd); } ~Deserializer() {} INLINE const Collection& operator()() { return _result; } template INLINE const Collection& operator()(ConfigString S, - ForwardIterator DelimBegin, - ForwardIterator DelimEnd) { - Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd); + ForwardIterator DelimBegin, + ForwardIterator DelimEnd) { + Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd); } INLINE operator const Collection&() { return _result; } }; diff --git a/dtool/src/dconfig/symbolEnt.h b/dtool/src/dconfig/symbolEnt.h index 7234987b7a..7bc06225b3 100644 --- a/dtool/src/dconfig/symbolEnt.h +++ b/dtool/src/dconfig/symbolEnt.h @@ -17,7 +17,7 @@ namespace Config { class EXPCL_DTOOLCONFIG SymbolEnt { public: enum SymbolEntSrc { ConfigFile, Environment, CommandEnv, Commandline, - Other, Invalid }; + Other, Invalid }; private: ConfigString _src; ConfigString _val; @@ -26,8 +26,8 @@ class EXPCL_DTOOLCONFIG SymbolEnt { public: SymbolEnt() : _srctok(Invalid) {} SymbolEnt(enum SymbolEntSrc tok, const ConfigString& val, - const ConfigString& src = "", bool state = false) - : _src(src), _val(val), _state(state), _srctok(tok) {} + const ConfigString& src = "", bool state = false) + : _src(src), _val(val), _state(state), _srctok(tok) {} SymbolEnt(const SymbolEnt& c) : _src(c._src), _val(c._val), _state(c._state), _srctok(c._srctok) {} INLINE SymbolEnt& operator=(const SymbolEnt&); diff --git a/dtool/src/dconfig/test_pfstream.cxx b/dtool/src/dconfig/test_pfstream.cxx index fdfa66511f..f5daa28dd7 100644 --- a/dtool/src/dconfig/test_pfstream.cxx +++ b/dtool/src/dconfig/test_pfstream.cxx @@ -12,7 +12,7 @@ void ReadIt(istream& ifs) { while (!ifs.eof()) { std::getline(ifs, line); if (line.length() != 0) - cout << line << endl; + cout << line << endl; } } diff --git a/dtool/src/dconfig/test_serialization.cxx b/dtool/src/dconfig/test_serialization.cxx index b64667248a..0fc955548e 100644 --- a/dtool/src/dconfig/test_serialization.cxx +++ b/dtool/src/dconfig/test_serialization.cxx @@ -42,7 +42,7 @@ void TestFromString() intlist ides1 = intdes1; for (intlist::iterator i=ides1.begin(); i!=ides1.end(); ++i) { if (i != ides1.begin()) - cout << ", "; + cout << ", "; cout << (*i); } cout << endl; @@ -52,7 +52,7 @@ void TestFromString() floatvec fdes1 = floatdes1; for (floatvec::iterator j=fdes1.begin(); j!=fdes1.end(); ++j) { if (j != fdes1.begin()) - cout << ", "; + cout << ", "; cout << (*j); } cout << endl; diff --git a/dtool/src/dtoolbase/version.h b/dtool/src/dtoolbase/version.h index c1a19f9595..44c78df161 100644 --- a/dtool/src/dtoolbase/version.h +++ b/dtool/src/dtoolbase/version.h @@ -1,10 +1,10 @@ -#define PANDA_VERSION_MAJOR 0 -#define PANDA_VERSION_MINOR 0 -#define PANDA_VERSION_BUILDSUBVERSION 0 -#define PANDA_VERSION_BUILDSUBSUBVERSION 1 - -#define PANDA_VERSION_MAJOR_STR "0" -#define PANDA_VERSION_MINOR_STR "0" -#define PANDA_VERSION_BUILDSUBVERSION_STR "0" -#define PANDA_VERSION_BUILDSUBSUBVERSION_STR "1" - +#define PANDA_VERSION_MAJOR 0 +#define PANDA_VERSION_MINOR 0 +#define PANDA_VERSION_BUILDSUBVERSION 0 +#define PANDA_VERSION_BUILDSUBSUBVERSION 1 + +#define PANDA_VERSION_MAJOR_STR "0" +#define PANDA_VERSION_MINOR_STR "0" +#define PANDA_VERSION_BUILDSUBVERSION_STR "0" +#define PANDA_VERSION_BUILDSUBSUBVERSION_STR "1" + diff --git a/dtool/src/dtoolutil/dSearchPath.I b/dtool/src/dtoolutil/dSearchPath.I index 770b74b999..61283d9206 100644 --- a/dtool/src/dtoolutil/dSearchPath.I +++ b/dtool/src/dtoolutil/dSearchPath.I @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// INLINE Filename DSearchPath:: search_path(const Filename &filename, const string &path, - const string &delimiters) { + const string &delimiters) { DSearchPath search(path, delimiters); return search.find_file(filename); } diff --git a/dtool/src/dtoolutil/dSearchPath.cxx b/dtool/src/dtoolutil/dSearchPath.cxx index b1af50db55..a703e185f2 100644 --- a/dtool/src/dtoolutil/dSearchPath.cxx +++ b/dtool/src/dtoolutil/dSearchPath.cxx @@ -202,7 +202,7 @@ prepend_path(const DSearchPath &path) { if (!path._directories.empty()) { Directories new_directories = path._directories; copy(_directories.begin(), _directories.end(), - back_inserter(new_directories)); + back_inserter(new_directories)); _directories.swap(new_directories); } } @@ -270,7 +270,7 @@ find_file(const Filename &filename) const { //////////////////////////////////////////////////////////////////// int DSearchPath:: find_all_files(const Filename &filename, - DSearchPath::Results &results) const { + DSearchPath::Results &results) const { results._files.clear(); Directories::const_iterator di; diff --git a/dtool/src/dtoolutil/dSearchPath.h b/dtool/src/dtoolutil/dSearchPath.h index c557190f56..f651b26165 100644 --- a/dtool/src/dtoolutil/dSearchPath.h +++ b/dtool/src/dtoolutil/dSearchPath.h @@ -13,7 +13,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : DSearchPath +// Class : DSearchPath // Description : This class stores a list of directories that can be // searched, in order, to locate a particular file. It // is normally constructed by passing it a traditional @@ -51,7 +51,7 @@ PUBLISHED: void append_directory(const Filename &directory); void prepend_directory(const Filename &directory); void append_path(const string &path, - const string &delimiters = ": \t\n"); + const string &delimiters = ": \t\n"); void append_path(const DSearchPath &path); void prepend_path(const DSearchPath &path); @@ -64,7 +64,7 @@ PUBLISHED: INLINE static Filename search_path(const Filename &filename, const string &path, - const string &delimiters = ": \t\n"); + const string &delimiters = ": \t\n"); void output(ostream &out, const string &separator = ":") const; void write(ostream &out, int indent_level = 0) const; diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index dafa46a4fe..7744032935 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -82,20 +82,20 @@ expand_string(const string &str) { size_t end = start; if (str[start] == '{') { - // Curly braces delimit the variable name explicitly. - end = str.find('}', start + 1); - if (end != string::npos) { - varname = str.substr(start + 1, end - (start + 1)); - end++; - } + // Curly braces delimit the variable name explicitly. + end = str.find('}', start + 1); + if (end != string::npos) { + varname = str.substr(start + 1, end - (start + 1)); + end++; + } } if (end == start) { - // Scan for the end of the variable name. - while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) { - end++; - } - varname = str.substr(start, end - start); + // Scan for the end of the variable name. + while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) { + end++; + } + varname = str.substr(start, end - start); } string subst = @@ -274,8 +274,8 @@ read_environment_variables() { if (ch == '=') { ch = proc.get(); while (!proc.eof() && !proc.fail() && ch != '\0') { - value += (char)ch; - ch = proc.get(); + value += (char)ch; + ch = proc.get(); } } diff --git a/dtool/src/dtoolutil/executionEnvironment.h b/dtool/src/dtoolutil/executionEnvironment.h index fc1869b72d..34c8ea3afa 100644 --- a/dtool/src/dtoolutil/executionEnvironment.h +++ b/dtool/src/dtoolutil/executionEnvironment.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ExecutionEnvironment +// Class : ExecutionEnvironment // Description : Encapsulates access to the environment variables and // command-line arguments at the time of execution. // This is encapsulated to support accessing these diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 3c3a839d1a..5fb16ab860 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -117,8 +117,8 @@ convert_pathname(const string &unix_style_pathname) { windows_pathname = front_to_back_slash(unix_style_pathname); } else if (unix_style_pathname.length() > 3 && - isalpha(unix_style_pathname[1]) && - unix_style_pathname[2] == '/') { + isalpha(unix_style_pathname[1]) && + unix_style_pathname[2] == '/') { // This is a pathname that begins with a single letter. That must // be the drive letter. windows_pathname = @@ -242,7 +242,7 @@ from_os_specific(const string &os_specific, Filename::Type type) { for (p = 0; p < panda_root.length() && matches; p++) { char c = tolower(panda_root[p]); if (c == '\\') { - c = '/'; + c = '/'; } matches = (c == tolower(result[p])); } @@ -253,7 +253,7 @@ from_os_specific(const string &os_specific, Filename::Type type) { result = result.substr(panda_root.length()); assert(!result.empty()); if (result[0] != '/') { - result = '/' + result; + result = '/' + result; } Filename filename(result); filename.set_type(type); @@ -500,7 +500,7 @@ standardize() { if (component == ".") { // Ignore /./. } else if (component == ".." && !components.empty() && - !(components.back() == "..")) { + !(components.back() == "..")) { // Back up. components.pop_back(); } else { @@ -808,8 +808,8 @@ is_executable() const { //////////////////////////////////////////////////////////////////// int Filename:: compare_timestamps(const Filename &other, - bool this_missing_is_old, - bool other_missing_is_old) const { + bool this_missing_is_old, + bool other_missing_is_old) const { string os_specific = to_os_specific(); string other_os_specific = other.to_os_specific(); @@ -883,7 +883,7 @@ compare_timestamps(const Filename &other, //////////////////////////////////////////////////////////////////// bool Filename:: resolve_filename(const DSearchPath &searchpath, - const string &default_extension) { + const string &default_extension) { string found; if (is_local()) { @@ -893,9 +893,9 @@ resolve_filename(const DSearchPath &searchpath, // We didn't find it with the given extension; can we try the // default extension? if (get_extension().empty() && !default_extension.empty()) { - Filename try_ext = *this; - try_ext.set_extension(default_extension); - found = searchpath.find_file(try_ext.get_fullpath()); + Filename try_ext = *this; + try_ext.set_extension(default_extension); + found = searchpath.find_file(try_ext.get_fullpath()); } } @@ -908,11 +908,11 @@ resolve_filename(const DSearchPath &searchpath, // The full pathname doesn't exist with the given extension; // does it exist with the default extension? if (get_extension().empty() && !default_extension.empty()) { - Filename try_ext = *this; - try_ext.set_extension(default_extension); - if (try_ext.exists()) { - found = try_ext; - } + Filename try_ext = *this; + try_ext.set_extension(default_extension); + if (try_ext.exists()) { + found = try_ext; + } } } } @@ -1226,8 +1226,8 @@ touch() const { // So the file doesn't already exist; create it. int fd = creat(os_specific.c_str(), 0666); if (fd < 0) { - perror(os_specific.c_str()); - return false; + perror(os_specific.c_str()); + return false; } close(fd); return true; @@ -1274,17 +1274,17 @@ rename_to(const Filename &other) const { string os_specific = to_os_specific(); string other_os_specific = other.to_os_specific(); return (rename(os_specific.c_str(), - other_os_specific.c_str()) == 0); + other_os_specific.c_str()) == 0); } //////////////////////////////////////////////////////////////////// // Function: Filename::make_dir // Access: Public // Description: Creates all the directories in the path to the file -// specified in the filename, except for the basename -// itself. This assumes that the Filename contains the -// name of a file, not a directory name; it ensures that -// the directory containing the file exists. +// specified in the filename, except for the basename +// itself. This assumes that the Filename contains the +// name of a file, not a directory name; it ensures that +// the directory containing the file exists. //////////////////////////////////////////////////////////////////// bool Filename:: make_dir() const { @@ -1343,14 +1343,14 @@ locate_basename() { // we want to treat them as a single slash. The directory // therefore actually ends at the first of these; back up a bit. while (_dirname_end > 0 && _filename[_dirname_end-1] == '/') { - _dirname_end--; + _dirname_end--; } // Another exception: if the dirname was nothing but slashes, it // was the root directory, or / itself. In this case the dirname // does include the terminal slash (of course). if (_dirname_end == 0) { - _dirname_end = 1; + _dirname_end = 1; } } else { @@ -1424,7 +1424,7 @@ get_common_prefix(const string &other) const { // First, get the length of the common initial substring. while (len < length() && len < other.length() && - _filename[len] == other[len]) { + _filename[len] == other[len]) { len++; } @@ -1455,11 +1455,11 @@ count_slashes(const string &str) { // Skip consecutive slashes. ++si; while (*si == '/') { - ++si; + ++si; } if (si == str.end()) { - // Oops, that was a terminal slash. Don't count it. - count--; + // Oops, that was a terminal slash. Don't count it. + count--; } } else { diff --git a/dtool/src/dtoolutil/filename.h b/dtool/src/dtoolutil/filename.h index 925ed0d40e..86f6136006 100644 --- a/dtool/src/dtoolutil/filename.h +++ b/dtool/src/dtoolutil/filename.h @@ -24,7 +24,7 @@ class DSearchPath; //////////////////////////////////////////////////////////////////// -// Class : Filename +// Class : Filename // Description : The name of a file, such as a texture file or an Egg // file. Stores the full pathname, and includes // functions for extracting out the directory prefix @@ -72,9 +72,9 @@ PUBLISHED: INLINE static Filename executable_filename(const string &filename); static Filename from_os_specific(const string &os_specific, - Type type = T_general); + Type type = T_general); static Filename temporary(const string &dirname, const string &prefix, - Type type = T_general); + Type type = T_general); // Assignment is via the = operator. INLINE Filename &operator = (const string &filename); @@ -134,10 +134,10 @@ PUBLISHED: bool is_directory() const; bool is_executable() const; int compare_timestamps(const Filename &other, - bool this_missing_is_old = true, - bool other_missing_is_old = true) const; + bool this_missing_is_old = true, + bool other_missing_is_old = true) const; bool resolve_filename(const DSearchPath &searchpath, - const string &default_extension = string()); + const string &default_extension = string()); bool make_relative_to(Filename directory, bool allow_backups = true); int find_on_searchpath(const DSearchPath &searchpath); diff --git a/dtool/src/dtoolutil/gnu_getopt.h b/dtool/src/dtoolutil/gnu_getopt.h index 7b7b6803ba..41d58ab19d 100644 --- a/dtool/src/dtoolutil/gnu_getopt.h +++ b/dtool/src/dtoolutil/gnu_getopt.h @@ -25,7 +25,7 @@ #define getopt_long gnu_getopt_long #define getopt_long_only gnu_getopt_long_only -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -66,9 +66,9 @@ extern int optopt; zero. The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -83,7 +83,7 @@ extern int optopt; struct option { -#if __STDC__ +#if __STDC__ const char *name; #else char *name; @@ -97,28 +97,28 @@ struct option /* Names for the values of the `has_arg' field of `struct option'. */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 extern EXPCL_DTOOL int getopt (int argc, char *const *argv, const char *shortopts); extern EXPCL_DTOOL int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *long_options, int *opt_index); + const struct option *long_options, int *opt_index); extern EXPCL_DTOOL int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *long_options, - int *opt_index); + const char *shortopts, + const struct option *long_options, + int *opt_index); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); -#ifdef __cplusplus +#ifdef __cplusplus } #endif diff --git a/dtool/src/dtoolutil/load_dso.cxx b/dtool/src/dtoolutil/load_dso.cxx index 5f4ede5027..5c34cafb02 100644 --- a/dtool/src/dtoolutil/load_dso.cxx +++ b/dtool/src/dtoolutil/load_dso.cxx @@ -83,7 +83,7 @@ load_dso(const Filename &filename) { cerr << "_dyld_image_count() = " << _dyld_image_count() << endl; for (unsigned long i=0; i<_dyld_image_count(); ++i) cerr << "_dyld_get_image_name(" << i << ") = '" << _dyld_get_image_name(i) - << "'" << endl; + << "'" << endl; string stmp = filename; cerr << "filename = '" << filename << "'" << endl; int i = stmp.rfind(".dylib"); diff --git a/dtool/src/dtoolutil/pfstreamBuf.cxx b/dtool/src/dtoolutil/pfstreamBuf.cxx index 4ba125b72f..55a7e949f4 100644 --- a/dtool/src/dtoolutil/pfstreamBuf.cxx +++ b/dtool/src/dtoolutil/pfstreamBuf.cxx @@ -12,7 +12,7 @@ typedef int streamsize; #endif /* HAVE_STREAMSIZE */ PipeStreamBuf::PipeStreamBuf(PipeStreamBuf::Direction dir) : _dir(dir), - _pipe((FILE*)0L) { + _pipe((FILE*)0L) { #ifndef WIN32_VC // taken from Dr. Ose. // These lines, which are essential on Irix and Linux, seem to be @@ -144,6 +144,6 @@ void PipeStreamBuf::write_chars(const char* start, int length, bool flush) { size_t wrote = fwrite(line.c_str(), 1, line.length(), _pipe); if (wrote != line.length()) cerr << "wrote only " << wrote << " of " << line.length() - << " bytes to pipe" << endl; + << " bytes to pipe" << endl; fflush(_pipe); } diff --git a/dtool/src/dtoolutil/vector_src.cxx b/dtool/src/dtoolutil/vector_src.cxx index 11930d5cf0..644932f76f 100644 --- a/dtool/src/dtoolutil/vector_src.cxx +++ b/dtool/src/dtoolutil/vector_src.cxx @@ -35,7 +35,7 @@ /* void insert_into_vector(NAME &vec, NAME::iterator where, - NAME::const_pointer begin, NAME::const_pointer end) { + NAME::const_pointer begin, NAME::const_pointer end) { vec.insert(where, begin, end); } */ diff --git a/dtool/src/dtoolutil/vector_src.h b/dtool/src/dtoolutil/vector_src.h index 2d73e36f86..eccfc9d6eb 100644 --- a/dtool/src/dtoolutil/vector_src.h +++ b/dtool/src/dtoolutil/vector_src.h @@ -62,7 +62,7 @@ typedef std::vector NAME; /* extern EXPCL void insert_into_vector(NAME &vec, NAME::iterator where, - const TYPE *begin, const TYPE *end); + const TYPE *begin, const TYPE *end); */ diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 8406f8028e..9f540697db 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -96,19 +96,19 @@ read_command_file(istream &in) { // Get the first word. size_t q = p; while (q < line.length() && !isspace(line[q])) { - q++; + q++; } string command = line.substr(p, q - p); // Get the rest. p = q; while (p < line.length() && isspace(line[p])) { - p++; + p++; } // Except for the trailing whitespace. q = line.length(); while (q > p && isspace(line[q - 1])) { - q--; + q--; } string params = line.substr(p, q - p); @@ -149,10 +149,10 @@ do_command(const string &command, const string ¶ms) { CPPType *type = parser.parse_type(orig_name); if (type == (CPPType *)NULL) { - nout << "Unknown type: renametype " << orig_name << "\n"; + nout << "Unknown type: renametype " << orig_name << "\n"; } else { - type = type->resolve_type(&parser, &parser); - _renametype[type->get_local_name(&parser)] = new_name; + type = type->resolve_type(&parser, &parser); + _renametype[type->get_local_name(&parser)] = new_name; } } @@ -226,22 +226,22 @@ build() { if ((*di)->get_subtype() == CPPDeclaration::ST_instance) { CPPInstance *inst = (*di)->as_instance(); if (inst->_type->get_subtype() == CPPDeclaration::ST_function) { - // Here's a function declaration. - scan_function(inst); + // Here's a function declaration. + scan_function(inst); } else { - // Here's a data element declaration. - scan_element(inst, (CPPStructType *)NULL, &parser); + // Here's a data element declaration. + scan_element(inst, (CPPStructType *)NULL, &parser); } } else if ((*di)->get_subtype() == CPPDeclaration::ST_typedef) { CPPTypedef *tdef = (*di)->as_typedef(); if (tdef->_type->get_subtype() == CPPDeclaration::ST_struct) { - // A typedef counts as a declaration. This lets us pick up - // most template instantiations. - CPPStructType *struct_type = - tdef->_type->resolve_type(&parser, &parser)->as_struct_type(); - scan_struct_type(struct_type); + // A typedef counts as a declaration. This lets us pick up + // most template instantiations. + CPPStructType *struct_type = + tdef->_type->resolve_type(&parser, &parser)->as_struct_type(); + scan_struct_type(struct_type); } } else if ((*di)->get_subtype() == CPPDeclaration::ST_type_declaration) { @@ -249,14 +249,14 @@ build() { type->_vis = (*di)->_vis; if (type->get_subtype() == CPPDeclaration::ST_struct) { - CPPStructType *struct_type = - type->as_type()->resolve_type(&parser, &parser)->as_struct_type(); - scan_struct_type(struct_type); - + CPPStructType *struct_type = + type->as_type()->resolve_type(&parser, &parser)->as_struct_type(); + scan_struct_type(struct_type); + } else if (type->get_subtype() == CPPDeclaration::ST_enum) { - CPPEnumType *enum_type = - type->as_type()->resolve_type(&parser, &parser)->as_enum_type(); - scan_enum_type(enum_type); + CPPEnumType *enum_type = + type->as_type()->resolve_type(&parser, &parser)->as_enum_type(); + scan_enum_type(enum_type); } } } @@ -304,8 +304,8 @@ write_code(ostream &out, InterrogateModuleDef *def) { // #include lines. if (!no_database) { out << "#include \n" - << "#include \n" - << "#include \n"; + << "#include \n" + << "#include \n"; } if (watch_asserts) { out << "#include \n"; @@ -320,9 +320,9 @@ write_code(ostream &out, InterrogateModuleDef *def) { char delimiter = (*ifi).second; if (should_include(filename)) { if (delimiter == '"') { - out << "#include \"" << filename << "\"\n"; + out << "#include \"" << filename << "\"\n"; } else { - out << "#include <" << filename << ">\n"; + out << "#include <" << filename << ">\n"; } } } @@ -335,9 +335,9 @@ write_code(ostream &out, InterrogateModuleDef *def) { if (generate_spam) { out << "#include \n" - << "#include \n\n" - << "NotifyCategoryDeclNoExport(in_" << library_name << ");\n" - << "NotifyCategoryDef(in_" << library_name << ", interrogatedb_cat);\n\n"; + << "#include \n\n" + << "NotifyCategoryDeclNoExport(in_" << library_name << ");\n" + << "NotifyCategoryDef(in_" << library_name << ", interrogatedb_cat);\n\n"; } // Now, define all of our wrappers. @@ -350,8 +350,8 @@ write_code(ostream &out, InterrogateModuleDef *def) { { map::iterator ii; for (ii = wrappers_by_index.begin(); - ii != wrappers_by_index.end(); - ++ii) { + ii != wrappers_by_index.end(); + ++ii) { WrapperBuilder *wbuilder = (*ii).second; string wrapper_name = wbuilder->get_wrapper_name(_library_hash_name); @@ -359,24 +359,24 @@ write_code(ostream &out, InterrogateModuleDef *def) { // Record the wrapper's name in the database. InterrogateFunctionWrapper &iwrapper = InterrogateDatabase::get_ptr()-> - update_wrapper(wbuilder->_wrapper_index); + update_wrapper(wbuilder->_wrapper_index); if (true_wrapper_names) { - // If we're reporting "true" names, it means we set the - // wrapper's name to the name of the function it wraps. That - // means we need to look up the function. - const InterrogateFunction &ifunction = InterrogateDatabase::get_ptr()-> - get_function(iwrapper.get_function()); + // If we're reporting "true" names, it means we set the + // wrapper's name to the name of the function it wraps. That + // means we need to look up the function. + const InterrogateFunction &ifunction = InterrogateDatabase::get_ptr()-> + get_function(iwrapper.get_function()); - iwrapper._name = clean_identifier(ifunction.get_scoped_name()); + iwrapper._name = clean_identifier(ifunction.get_scoped_name()); } else { - iwrapper._name = wrapper_name; + iwrapper._name = wrapper_name; } if (output_function_names) { - // If we're keeping the function names, record that the - // wrapper is callable. - iwrapper._flags |= InterrogateFunctionWrapper::F_callable_by_name; + // If we're keeping the function names, record that the + // wrapper is callable. + iwrapper._flags |= InterrogateFunctionWrapper::F_callable_by_name; } } } @@ -389,18 +389,18 @@ write_code(ostream &out, InterrogateModuleDef *def) { map::iterator ii; int next_index = 1; for (ii = wrappers_by_index.begin(); - ii != wrappers_by_index.end(); - ++ii) { + ii != wrappers_by_index.end(); + ++ii) { int this_index = (*ii).first; while (next_index < this_index) { - out << " (void *)0,\n"; - next_index++; + out << " (void *)0,\n"; + next_index++; } assert(next_index == this_index); WrapperBuilder *wbuilder = (*ii).second; out << " (void *)&" << wbuilder->get_wrapper_name(_library_hash_name) - << ",\n"; + << ",\n"; next_index++; } while (next_index < num_wrappers + 1) { @@ -413,15 +413,15 @@ write_code(ostream &out, InterrogateModuleDef *def) { if (save_unique_names) { // Write out the table of unique names, in alphabetical order by name. out << "static InterrogateUniqueNameDef _in_unique_names[" - << num_wrappers << "] = {\n"; + << num_wrappers << "] = {\n"; for (hi = _wrappers_by_hash.begin(); - hi != _wrappers_by_hash.end(); - ++hi) { + hi != _wrappers_by_hash.end(); + ++hi) { WrapperBuilder *wbuilder = (*hi).second; if (wbuilder != (WrapperBuilder *)NULL) { - out << " { \"" - << (*hi).first << "\", " - << wbuilder->_wrapper_index - 1 << " },\n"; + out << " { \"" + << (*hi).first << "\", " + << wbuilder->_wrapper_index - 1 << " },\n"; } } out << "};\n\n"; @@ -434,32 +434,32 @@ write_code(ostream &out, InterrogateModuleDef *def) { out << "static PyMethodDef python_methods[] = {\n"; for (hi = _wrappers_by_hash.begin(); - hi != _wrappers_by_hash.end(); - ++hi) { - WrapperBuilder *wbuilder = (*hi).second; - string wrapper_name = wbuilder->get_wrapper_name(_library_hash_name); - string true_name = wrapper_name; - if (true_wrapper_names) { - true_name = wbuilder->_function->get_simple_name(); - } - out << " { \"" - << true_name << "\", &" - << wrapper_name << ", METH_VARARGS },\n"; + hi != _wrappers_by_hash.end(); + ++hi) { + WrapperBuilder *wbuilder = (*hi).second; + string wrapper_name = wbuilder->get_wrapper_name(_library_hash_name); + string true_name = wrapper_name; + if (true_wrapper_names) { + true_name = wbuilder->_function->get_simple_name(); + } + out << " { \"" + << true_name << "\", &" + << wrapper_name << ", METH_VARARGS },\n"; } out << " { NULL, NULL }\n" - << "};\n\n" + << "};\n\n" - << "#ifdef _WIN32\n" - << "extern \"C\" __declspec(dllexport) void init" << def->library_name << "();\n" - << "#else\n" - << "extern \"C\" void init" << def->library_name << "();\n" - << "#endif\n\n" + << "#ifdef _WIN32\n" + << "extern \"C\" __declspec(dllexport) void init" << def->library_name << "();\n" + << "#else\n" + << "extern \"C\" void init" << def->library_name << "();\n" + << "#endif\n\n" - << "void init" << def->library_name << "() {\n" - << " Py_InitModule(\"" << def->library_name - << "\", python_methods);\n" - << "}\n\n"; + << "void init" << def->library_name << "() {\n" + << " Py_InitModule(\"" << def->library_name + << "\", python_methods);\n" + << "}\n\n"; } } @@ -467,44 +467,44 @@ write_code(ostream &out, InterrogateModuleDef *def) { // Now build the module definition structure to add ourselves to // the global interrogate database. out << "static InterrogateModuleDef _in_module_def = {\n" - << " " << def->file_identifier << ", /* file_identifier */\n" - << " \"" << def->library_name << "\", /* library_name */\n" - << " \"" << def->library_hash_name << "\", /* library_hash_name */\n" - << " \"" << def->module_name << "\", /* module_name */\n"; + << " " << def->file_identifier << ", /* file_identifier */\n" + << " \"" << def->library_name << "\", /* library_name */\n" + << " \"" << def->library_hash_name << "\", /* library_hash_name */\n" + << " \"" << def->module_name << "\", /* module_name */\n"; if (def->database_filename != (const char *)NULL) { out << " \"" << def->database_filename - << "\", /* database_filename */\n"; + << "\", /* database_filename */\n"; } else { out << " (const char *)0, /* database_filename */\n"; } if (save_unique_names) { out << " _in_unique_names,\n" - << " " << num_wrappers << ", /* num_unique_names */\n"; + << " " << num_wrappers << ", /* num_unique_names */\n"; } else { out << " (InterrogateUniqueNameDef *)0, /* unique_names */\n" - << " 0, /* num_unique_names */\n"; + << " 0, /* num_unique_names */\n"; } if (output_function_pointers) { out << " _in_fptrs,\n" - << " " << num_wrappers << ", /* num_fptrs */\n"; + << " " << num_wrappers << ", /* num_fptrs */\n"; } else { out << " (void **)0, /* fptrs */\n" - << " 0, /* num_fptrs */\n"; + << " 0, /* num_fptrs */\n"; } out << " 1, /* first_index */\n" - << " " << InterrogateDatabase::get_ptr()->get_next_index() - << " /* next_index */\n" - << "};\n\n"; + << " " << InterrogateDatabase::get_ptr()->get_next_index() + << " /* next_index */\n" + << "};\n\n"; // And now write the static-init code that tells the interrogate // database to load up this module. out << "Configure(_in_configure_" << library_name << ");\n" - << "ConfigureFn(_in_configure_" << library_name << ") {\n" - << " interrogate_request_module(&_in_module_def);\n" - << "}\n\n"; + << "ConfigureFn(_in_configure_" << library_name << ") {\n" + << " interrogate_request_module(&_in_module_def);\n" + << "}\n\n"; } } @@ -557,8 +557,8 @@ clean_identifier(const string &name) { for (ni = name.begin(); ni != name.end(); ++ni) { if (isalnum(*ni)) { if (last_invalid) { - result += '_'; - last_invalid = false; + result += '_'; + last_invalid = false; } result += (*ni); } else { @@ -629,7 +629,7 @@ get_preferred_name(CPPType *type) { //////////////////////////////////////////////////////////////////// void InterrogateBuilder:: insert_param_list(InterrogateBuilder::Commands &commands, - const string ¶ms) { + const string ¶ms) { size_t p = 0; while (p < params.length()) { while (p < params.length() && isspace(params[p])) { @@ -733,15 +733,15 @@ in_ignoreinvolved(CPPType *type) const { { CPPFunctionType *ftype = type->as_function_type(); if (in_ignoreinvolved(ftype->_return_type)) { - return true; + return true; } const CPPParameterList::Parameters ¶ms = - ftype->_parameters->_parameters; + ftype->_parameters->_parameters; CPPParameterList::Parameters::const_iterator pi; for (pi = params.begin(); pi != params.end(); ++pi) { - if (in_ignoreinvolved((*pi)->_type)) { - return true; - } + if (in_ignoreinvolved((*pi)->_type)) { + return true; + } } return false; } @@ -876,7 +876,7 @@ void InterrogateBuilder:: scan_function(CPPInstance *function) { assert(function != (CPPInstance *)NULL); assert(function->_type != (CPPType *)NULL && - function->_type->as_function_type() != (CPPFunctionType *)NULL); + function->_type->as_function_type() != (CPPFunctionType *)NULL); CPPFunctionType *ftype = function->_type->resolve_type(&parser, &parser)->as_function_type(); assert(ftype != (CPPFunctionType *)NULL); @@ -910,7 +910,7 @@ scan_function(CPPInstance *function) { // export functions whose prototypes appear in an .h file. return; } - + if (function->_file._source != CPPFile::S_local || in_ignorefile(function->_file._filename_as_referenced)) { // The function is defined in some other package or in an @@ -941,8 +941,8 @@ scan_function(CPPInstance *function) { } get_function(function, "", - (CPPStructType *)NULL, scope, true, - WrapperBuilder::T_normal); + (CPPStructType *)NULL, scope, true, + WrapperBuilder::T_normal); } //////////////////////////////////////////////////////////////////// @@ -983,10 +983,10 @@ scan_struct_type(CPPStructType *type) { bool any_exported = false; CPPScope::Declarations::const_iterator di; for (di = scope->_declarations.begin(); - di != scope->_declarations.end() && !any_exported; - ++di) { + di != scope->_declarations.end() && !any_exported; + ++di) { if ((*di)->_vis <= min_vis) { - any_exported = true; + any_exported = true; } } @@ -1091,12 +1091,12 @@ scan_manifest(CPPManifest *manifest) { // We have a more complex expression. Generate a getter // function. FunctionIndex getter = - get_getter(type, manifest->_name, (CPPStructType *)NULL, &parser, - (CPPInstance *)NULL); - + get_getter(type, manifest->_name, (CPPStructType *)NULL, &parser, + (CPPInstance *)NULL); + if (getter != 0) { - imanifest._flags |= InterrogateManifest::F_has_getter; - imanifest._getter = getter; + imanifest._flags |= InterrogateManifest::F_has_getter; + imanifest._getter = getter; } } } @@ -1114,7 +1114,7 @@ scan_manifest(CPPManifest *manifest) { //////////////////////////////////////////////////////////////////// ElementIndex InterrogateBuilder:: scan_element(CPPInstance *element, CPPStructType *struct_type, - CPPScope *scope) { + CPPScope *scope) { if (element == (CPPInstance *)NULL) { return 0; } @@ -1187,7 +1187,7 @@ scan_element(CPPInstance *element, CPPStructType *struct_type, // Generate a getter and setter function for the element. FunctionIndex getter = get_getter(parameter_type, element->get_local_name(scope), - struct_type, scope, element); + struct_type, scope, element); if (getter != 0) { ielement._flags |= InterrogateElement::F_has_getter; ielement._getter = getter; @@ -1195,11 +1195,11 @@ scan_element(CPPInstance *element, CPPStructType *struct_type, if (TypeManager::is_assignable(element_type)) { FunctionIndex setter = - get_setter(parameter_type, element->get_local_name(scope), - struct_type, scope, element); + get_setter(parameter_type, element->get_local_name(scope), + struct_type, scope, element); if (setter != 0) { - ielement._flags |= InterrogateElement::F_has_setter; - ielement._setter = setter; + ielement._flags |= InterrogateElement::F_has_setter; + ielement._setter = setter; } } } @@ -1224,8 +1224,8 @@ scan_element(CPPInstance *element, CPPStructType *struct_type, //////////////////////////////////////////////////////////////////// FunctionIndex InterrogateBuilder:: get_getter(CPPType *expr_type, string expression, - CPPStructType *struct_type, CPPScope *scope, - CPPInstance *element) { + CPPStructType *struct_type, CPPScope *scope, + CPPInstance *element) { // Make up a name for the function. string function_name = clean_identifier("get_" + expression); @@ -1289,8 +1289,8 @@ get_getter(CPPType *expr_type, string expression, // It's clear; make a getter. FunctionIndex index = get_function(function, description, - struct_type, scope, false, - WrapperBuilder::T_getter, expression); + struct_type, scope, false, + WrapperBuilder::T_getter, expression); InterrogateDatabase::get_ptr()->update_function(index)._comment = description; return index; @@ -1304,8 +1304,8 @@ get_getter(CPPType *expr_type, string expression, //////////////////////////////////////////////////////////////////// FunctionIndex InterrogateBuilder:: get_setter(CPPType *expr_type, string expression, - CPPStructType *struct_type, CPPScope *scope, - CPPInstance *element) { + CPPStructType *struct_type, CPPScope *scope, + CPPInstance *element) { // Make up a name for the function. string function_name = clean_identifier("set_" + expression); @@ -1362,8 +1362,8 @@ get_setter(CPPType *expr_type, string expression, // It's clear; make a setter. FunctionIndex index = get_function(function, description, - struct_type, scope, false, - WrapperBuilder::T_setter, expression); + struct_type, scope, false, + WrapperBuilder::T_setter, expression); InterrogateDatabase::get_ptr()->update_function(index)._comment = description; return index; @@ -1378,7 +1378,7 @@ get_setter(CPPType *expr_type, string expression, //////////////////////////////////////////////////////////////////// FunctionIndex InterrogateBuilder:: get_cast_function(CPPType *to_type, CPPType *from_type, - const string &prefix) { + const string &prefix) { CPPInstance *function; CPPStructType *struct_type = from_type->as_struct_type(); CPPScope *scope = &parser; @@ -1407,7 +1407,7 @@ get_cast_function(CPPType *to_type, CPPType *from_type, // Make up a name for the function. string function_name = clean_identifier(prefix + "_" + get_preferred_name(from_type) + - "_to_" + get_preferred_name(to_type)); + "_to_" + get_preferred_name(to_type)); // Make up a CPPFunctionType. CPPType *from_ptr_type = CPPType::new_type(new CPPPointerType(from_type)); @@ -1428,8 +1428,8 @@ get_cast_function(CPPType *to_type, CPPType *from_type, FunctionIndex index = get_function(function, description, - struct_type, scope, false, - WrapperBuilder::T_typecast); + struct_type, scope, false, + WrapperBuilder::T_typecast); InterrogateDatabase::get_ptr()->update_function(index)._comment = description; return index; @@ -1444,9 +1444,9 @@ get_cast_function(CPPType *to_type, CPPType *from_type, //////////////////////////////////////////////////////////////////// FunctionIndex InterrogateBuilder:: get_function(CPPInstance *function, string description, - CPPStructType *struct_type, - CPPScope *scope, bool global, WrapperBuilder::Type wtype, - const string &expression) { + CPPStructType *struct_type, + CPPScope *scope, bool global, WrapperBuilder::Type wtype, + const string &expression) { // Get a unique function signature. Make sure we tell the function // where its native scope is, so we get a fully-scoped signature. @@ -1485,7 +1485,7 @@ get_function(CPPInstance *function, string description, if (function->_leading_comment != (CPPCommentBlock *)NULL) { string comment = trim_blanks(function->_leading_comment->_comment); if (!ifunction._comment.empty()) { - ifunction._comment += "\n\n"; + ifunction._comment += "\n\n"; } ifunction._comment += comment; } @@ -1565,34 +1565,34 @@ make_wrappers() { int num_default_parameters = nf._ftype->get_num_default_parameters(); InterrogateFunction &ifunction = - InterrogateDatabase::get_ptr()->update_function(nf._function_index); + InterrogateDatabase::get_ptr()->update_function(nf._function_index); if (build_c_wrappers) { - // Make the C wrapper(s). - for (int dp = 0; dp <= num_default_parameters; dp++) { - FunctionWrapperIndex wrapper = - get_wrapper(nf._function_index, new WrapperBuilderC, - nf._function, nf._description, - nf._struct_type, nf._scope, - nf._wtype, nf._expression, dp); - if (wrapper != 0) { - ifunction._c_wrappers.push_back(wrapper); - } - } + // Make the C wrapper(s). + for (int dp = 0; dp <= num_default_parameters; dp++) { + FunctionWrapperIndex wrapper = + get_wrapper(nf._function_index, new WrapperBuilderC, + nf._function, nf._description, + nf._struct_type, nf._scope, + nf._wtype, nf._expression, dp); + if (wrapper != 0) { + ifunction._c_wrappers.push_back(wrapper); + } + } } if (build_python_wrappers) { - // Make the Python wrapper. - for (int dp = 0; dp <= num_default_parameters; dp++) { - FunctionWrapperIndex wrapper = - get_wrapper(nf._function_index, new WrapperBuilderPython, - nf._function, nf._description, - nf._struct_type, nf._scope, - nf._wtype, nf._expression, dp); - if (wrapper != 0) { - ifunction._python_wrappers.push_back(wrapper); - } - } + // Make the Python wrapper. + for (int dp = 0; dp <= num_default_parameters; dp++) { + FunctionWrapperIndex wrapper = + get_wrapper(nf._function_index, new WrapperBuilderPython, + nf._function, nf._description, + nf._struct_type, nf._scope, + nf._wtype, nf._expression, dp); + if (wrapper != 0) { + ifunction._python_wrappers.push_back(wrapper); + } + } } } } @@ -1607,11 +1607,11 @@ make_wrappers() { //////////////////////////////////////////////////////////////////// FunctionWrapperIndex InterrogateBuilder:: get_wrapper(FunctionIndex function_index, WrapperBuilder *wbuilder, - CPPInstance *function, string description, - CPPStructType *struct_type, - CPPScope *scope, WrapperBuilder::Type wtype, - const string &expression, - int num_default_parameters) { + CPPInstance *function, string description, + CPPStructType *struct_type, + CPPScope *scope, WrapperBuilder::Type wtype, + const string &expression, + int num_default_parameters) { string function_signature = TypeManager::get_function_signature(function, num_default_parameters); @@ -1625,8 +1625,8 @@ get_wrapper(FunctionIndex function_index, WrapperBuilder *wbuilder, } if (!wbuilder->set_function(function, description, struct_type, scope, - function_signature, wtype, - expression, num_default_parameters)) { + function_signature, wtype, + expression, num_default_parameters)) { // This function can't be exported for some reason. delete wbuilder; return 0; @@ -1687,7 +1687,7 @@ get_wrapper(FunctionIndex function_index, WrapperBuilder *wbuilder, if (wbuilder->return_value_needs_management()) { iwrapper._flags |= InterrogateFunctionWrapper::F_caller_manages; iwrapper._return_value_destructor = - wbuilder->get_return_value_destructor(); + wbuilder->get_return_value_destructor(); } } @@ -1804,21 +1804,21 @@ get_type(CPPType *type, bool global) { if (ext_type->_ident != (CPPIdentifier *)NULL) { CPPScope *scope = ext_type->_ident->get_scope(&parser, &parser); while (scope->as_template_scope() != (CPPTemplateScope *)NULL) { - assert(scope->get_parent_scope() != scope); - scope = scope->get_parent_scope(); - assert(scope != (CPPScope *)NULL); + assert(scope->get_parent_scope() != scope); + scope = scope->get_parent_scope(); + assert(scope != (CPPScope *)NULL); } if (scope != &parser) { - // We're scoped! - itype._scoped_name = - descope(scope->get_local_name(&parser) + "::" + itype._name); - CPPStructType *struct_type = scope->get_struct_type(); - - if (struct_type != (CPPStructType *)NULL) { - itype._flags |= InterrogateType::F_nested; - itype._outer_class = get_type(struct_type, false); - } + // We're scoped! + itype._scoped_name = + descope(scope->get_local_name(&parser) + "::" + itype._name); + CPPStructType *struct_type = scope->get_struct_type(); + + if (struct_type != (CPPStructType *)NULL) { + itype._flags |= InterrogateType::F_nested; + itype._outer_class = get_type(struct_type, false); + } } } } @@ -2022,35 +2022,35 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, // Do we need to synthesize upcast and downcast functions? bool generate_casts = false; if (base._is_virtual) { - // We do in the presence of virtual inheritance. - generate_casts = true; + // We do in the presence of virtual inheritance. + generate_casts = true; } else if (bi != cpptype->_derivation.begin()) { - // Or if we're not talking about the leftmost fork of multiple - // inheritance. - generate_casts = true; + // Or if we're not talking about the leftmost fork of multiple + // inheritance. + generate_casts = true; } else if (cpptype->_derivation.size() != 1 && - left_inheritance_requires_upcast) { - // Or even if we are the leftmost fork of multiple - // inheritance, if the flag is set indicating that this - // requires a pointer change. (For most compilers, this does - // not require a pointer change.) - generate_casts = true; + left_inheritance_requires_upcast) { + // Or even if we are the leftmost fork of multiple + // inheritance, if the flag is set indicating that this + // requires a pointer change. (For most compilers, this does + // not require a pointer change.) + generate_casts = true; } if (generate_casts) { - d._upcast = get_cast_function(base_type, cpptype, "upcast"); - d._flags |= InterrogateType::DF_upcast; + d._upcast = get_cast_function(base_type, cpptype, "upcast"); + d._flags |= InterrogateType::DF_upcast; - if (base._is_virtual) { - // If this is a virtual inheritance, we can't write a - // downcast. - d._flags |= InterrogateType::DF_downcast_impossible; - } else { - d._downcast = get_cast_function(cpptype, base_type, "downcast"); - d._flags |= InterrogateType::DF_downcast; - } + if (base._is_virtual) { + // If this is a virtual inheritance, we can't write a + // downcast. + d._flags |= InterrogateType::DF_downcast_impossible; + } else { + d._downcast = get_cast_function(cpptype, base_type, "downcast"); + d._flags |= InterrogateType::DF_downcast; + } } itype._derivations.push_back(d); @@ -2064,35 +2064,35 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, if ((*di)->get_subtype() == CPPDeclaration::ST_instance) { CPPInstance *inst = (*di)->as_instance(); if (inst->_type->get_subtype() == CPPDeclaration::ST_function) { - // Here's a method declaration. - define_method(inst, itype, cpptype, scope); - + // Here's a method declaration. + define_method(inst, itype, cpptype, scope); + } else { - // Here's a data member declaration. - ElementIndex data_member = scan_element(inst, cpptype, scope); - if (data_member != 0) { - itype._elements.push_back(data_member); - } + // Here's a data member declaration. + ElementIndex data_member = scan_element(inst, cpptype, scope); + if (data_member != 0) { + itype._elements.push_back(data_member); + } } } else if ((*di)->get_subtype() == CPPDeclaration::ST_type_declaration) { CPPType *type = (*di)->as_type_declaration()->_type; if ((*di)->_vis <= min_vis) { - if (type->as_struct_type() != (CPPStructType *)NULL || - type->as_enum_type() != (CPPEnumType *)NULL) { - // Here's a nested class or enum definition. - type->_vis = (*di)->_vis; - - CPPExtensionType *nested_type = type->as_extension_type(); - assert(nested_type != (CPPExtensionType *)NULL); - - // Only try to export named types. - if (nested_type->_ident != (CPPIdentifier *)NULL) { - TypeIndex nested_index = get_type(nested_type, false); - itype._nested_types.push_back(nested_index); - } - } + if (type->as_struct_type() != (CPPStructType *)NULL || + type->as_enum_type() != (CPPEnumType *)NULL) { + // Here's a nested class or enum definition. + type->_vis = (*di)->_vis; + + CPPExtensionType *nested_type = type->as_extension_type(); + assert(nested_type != (CPPExtensionType *)NULL); + + // Only try to export named types. + if (nested_type->_ident != (CPPIdentifier *)NULL) { + TypeIndex nested_index = get_type(nested_type, false); + itype._nested_types.push_back(nested_index); + } + } } } } @@ -2108,10 +2108,10 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, itype._destructor = base_type._destructor; } else if ((itype._flags & - (InterrogateType::F_true_destructor | - InterrogateType::F_private_destructor | - InterrogateType::F_inherited_destructor | - InterrogateType::F_implicit_destructor)) == 0) { + (InterrogateType::F_true_destructor | + InterrogateType::F_private_destructor | + InterrogateType::F_inherited_destructor | + InterrogateType::F_implicit_destructor)) == 0) { // If we didn't get a destructor at all, we should make a wrapper // for one anyway. string function_name = "~" + cpptype->get_simple_name(); @@ -2126,8 +2126,8 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, CPPInstance *function = new CPPInstance(ftype, function_name); itype._destructor = get_function(function, "", - cpptype, cpptype->get_scope(), - false, WrapperBuilder::T_normal); + cpptype, cpptype->get_scope(), + false, WrapperBuilder::T_normal); itype._flags |= InterrogateType::F_implicit_destructor; } } @@ -2144,7 +2144,7 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype, //////////////////////////////////////////////////////////////////// void InterrogateBuilder:: update_method_comment(CPPInstance *function, CPPStructType *struct_type, - CPPScope *scope) { + CPPScope *scope) { if (function->_leading_comment == (CPPCommentBlock *)NULL) { // No comment anyway. Forget it. return; @@ -2194,7 +2194,7 @@ update_method_comment(CPPInstance *function, CPPStructType *struct_type, //////////////////////////////////////////////////////////////////// void InterrogateBuilder:: define_method(CPPFunctionGroup *fgroup, InterrogateType &itype, - CPPStructType *struct_type, CPPScope *scope) { + CPPStructType *struct_type, CPPScope *scope) { CPPFunctionGroup::Instances::const_iterator fi; for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) { CPPInstance *function = (*fi); @@ -2209,10 +2209,10 @@ define_method(CPPFunctionGroup *fgroup, InterrogateType &itype, //////////////////////////////////////////////////////////////////// void InterrogateBuilder:: define_method(CPPInstance *function, InterrogateType &itype, - CPPStructType *struct_type, CPPScope *scope) { + CPPStructType *struct_type, CPPScope *scope) { assert(function != (CPPInstance *)NULL); assert(function->_type != (CPPType *)NULL && - function->_type->as_function_type() != (CPPFunctionType *)NULL); + function->_type->as_function_type() != (CPPFunctionType *)NULL); CPPFunctionType *ftype = function->_type->resolve_type(scope, &parser)->as_function_type(); @@ -2290,12 +2290,12 @@ define_method(CPPInstance *function, InterrogateType &itype, FunctionIndex index = get_function(function, "", struct_type, scope, - false, WrapperBuilder::T_normal); + false, WrapperBuilder::T_normal); if (index != 0) { if ((ftype->_flags & CPPFunctionType::F_constructor) != 0) { if (find(itype._constructors.begin(), itype._constructors.end(), - index) == itype._constructors.end()) { - itype._constructors.push_back(index); + index) == itype._constructors.end()) { + itype._constructors.push_back(index); } } else if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) { @@ -2304,14 +2304,14 @@ define_method(CPPInstance *function, InterrogateType &itype, } else if ((ftype->_flags & CPPFunctionType::F_operator_typecast) != 0) { if (find(itype._casts.begin(), itype._casts.end(), - index) == itype._casts.end()) { - itype._casts.push_back(index); + index) == itype._casts.end()) { + itype._casts.push_back(index); } } else { if (find(itype._methods.begin(), itype._methods.end(), - index) == itype._methods.end()) { - itype._methods.push_back(index); + index) == itype._methods.end()) { + itype._methods.push_back(index); } } } @@ -2414,7 +2414,7 @@ define_extension_type(InterrogateType &itype, CPPExtensionType *cpptype) { void InterrogateBuilder:: hash_function_signature(WrapperBuilder *wbuilder) { string hash = hash_string(wbuilder->_function_signature, - wbuilder->get_calling_convention()); + wbuilder->get_calling_convention()); // Now make sure we don't have another function with the same hash. WrappersByHash::iterator hi; @@ -2431,7 +2431,7 @@ hash_function_signature(WrapperBuilder *wbuilder) { // The same function signature has already appeared. This // shouldn't happen. nout << "Internal error! Function signature " - << wbuilder->_function_signature << " repeated!\n"; + << wbuilder->_function_signature << " repeated!\n"; wbuilder->_hash = hash; return; } @@ -2447,20 +2447,20 @@ hash_function_signature(WrapperBuilder *wbuilder) { (*hi).second = (WrapperBuilder *)NULL; other_wbuilder->_hash += hash_string(other_wbuilder->_function_signature, - other_wbuilder->get_calling_convention(), - 11); + other_wbuilder->get_calling_convention(), + 11); bool inserted = _wrappers_by_hash.insert (WrappersByHash::value_type(other_wbuilder->_hash, other_wbuilder)).second; if (!inserted) { nout << "Internal error! Hash " << other_wbuilder->_hash - << " already appears!\n"; + << " already appears!\n"; } cerr << "first to " << other_wbuilder->_hash << "\n"; } hash += hash_string(wbuilder->_function_signature, - wbuilder->get_calling_convention(), - 11); + wbuilder->get_calling_convention(), + 11); bool inserted = _wrappers_by_hash.insert (WrappersByHash::value_type(hash, wbuilder)).second; @@ -2473,12 +2473,12 @@ hash_function_signature(WrapperBuilder *wbuilder) { for (char ch = 'a'; ch <= 'z' && !inserted; ch++) { hash = old_hash + ch; inserted = _wrappers_by_hash.insert - (WrappersByHash::value_type(hash, wbuilder)).second; + (WrappersByHash::value_type(hash, wbuilder)).second; } cerr << "New hash is " << hash << "\n"; if (!inserted) { nout << "Internal error! Too many conflicts with hash " - << hash << "\n"; + << hash << "\n"; } } diff --git a/dtool/src/interrogate/interrogateBuilder.h b/dtool/src/interrogate/interrogateBuilder.h index a1ee8b4092..17fe645c3c 100644 --- a/dtool/src/interrogate/interrogateBuilder.h +++ b/dtool/src/interrogate/interrogateBuilder.h @@ -33,7 +33,7 @@ class CPPManifest; class InterrogateType; //////////////////////////////////////////////////////////////////// -// Class : InterrogateBuilder +// Class : InterrogateBuilder // Description : This class builds up the InterrogateDatabase based on // the data indicated by CPPParser after reading the // source code. @@ -57,7 +57,7 @@ private: typedef set Commands; typedef map CommandParams; void insert_param_list(InterrogateBuilder::Commands &commands, - const string ¶ms); + const string ¶ms); bool in_forcetype(const string &name) const; string in_renametype(const string &name) const; @@ -76,29 +76,29 @@ private: void scan_enum_type(CPPEnumType *type); void scan_manifest(CPPManifest *manifest); ElementIndex scan_element(CPPInstance *element, CPPStructType *struct_type, - CPPScope *scope); + CPPScope *scope); FunctionIndex get_getter(CPPType *expr_type, string expression, - CPPStructType *struct_type, CPPScope *scope, - CPPInstance *element); + CPPStructType *struct_type, CPPScope *scope, + CPPInstance *element); FunctionIndex get_setter(CPPType *expr_type, string expression, - CPPStructType *struct_type, CPPScope *scope, - CPPInstance *element); + CPPStructType *struct_type, CPPScope *scope, + CPPInstance *element); FunctionIndex get_cast_function(CPPType *to_type, CPPType *from_type, - const string &prefix); + const string &prefix); FunctionIndex get_function(CPPInstance *function, string description, - CPPStructType *struct_type, CPPScope *scope, - bool global, WrapperBuilder::Type wtype, - const string &expression = string()); + CPPStructType *struct_type, CPPScope *scope, + bool global, WrapperBuilder::Type wtype, + const string &expression = string()); void make_wrappers(); FunctionWrapperIndex get_wrapper(FunctionIndex function_index, - WrapperBuilder *wbuilder, CPPInstance *function, - string description, CPPStructType *struct_type, CPPScope *scope, - WrapperBuilder::Type wtype, const string &expression, - int num_default_parameters); + WrapperBuilder *wbuilder, CPPInstance *function, + string description, CPPStructType *struct_type, CPPScope *scope, + WrapperBuilder::Type wtype, const string &expression, + int num_default_parameters); TypeIndex get_atomic_string_type(); TypeIndex get_type(CPPType *type, bool global); @@ -107,21 +107,21 @@ private: void define_wrapped_type(InterrogateType &itype, CPPPointerType *cpptype); void define_wrapped_type(InterrogateType &itype, CPPConstType *cpptype); void define_struct_type(InterrogateType &itype, CPPStructType *cpptype, - bool forced); + bool forced); void update_method_comment(CPPInstance *function, CPPStructType *struct_type, - CPPScope *scope); + CPPScope *scope); void define_method(CPPFunctionGroup *fgroup, InterrogateType &itype, - CPPStructType *struct_type, CPPScope *scope); + CPPStructType *struct_type, CPPScope *scope); void define_method(CPPInstance *function, InterrogateType &itype, - CPPStructType *struct_type, CPPScope *scope); + CPPStructType *struct_type, CPPScope *scope); void define_enum_type(InterrogateType &itype, CPPEnumType *cpptype); void define_extension_type(InterrogateType &itype, CPPExtensionType *cpptype); void hash_function_signature(WrapperBuilder *wbuilder); string hash_string(const string &name, - int additional_number = 0, - int shift_offset = 5); + int additional_number = 0, + int shift_offset = 5); static string trim_blanks(const string &str); diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 24f36baeed..04580fe25b 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -82,23 +82,23 @@ write_python_table(ostream &out) { // Consider only those that belong in the module we asked for. if (interrogate_function_has_module_name(function_index) && - module_name == interrogate_function_module_name(function_index)) { + module_name == interrogate_function_module_name(function_index)) { // For each function, get all of the python wrappers. int num_wrappers = - interrogate_function_number_of_python_wrappers(function_index); + interrogate_function_number_of_python_wrappers(function_index); for (int wi = 0; wi < num_wrappers; wi++) { - FunctionWrapperIndex wrapper_index = - interrogate_function_python_wrapper(function_index, wi); + FunctionWrapperIndex wrapper_index = + interrogate_function_python_wrapper(function_index, wi); - if (interrogate_wrapper_is_callable_by_name(wrapper_index)) { - count++; - const char *wrapper_name = - interrogate_wrapper_name(wrapper_index); - out << " PyObject *" << wrapper_name - << "(PyObject *self, PyObject *args);\n"; - } + if (interrogate_wrapper_is_callable_by_name(wrapper_index)) { + count++; + const char *wrapper_name = + interrogate_wrapper_name(wrapper_index); + out << " PyObject *" << wrapper_name + << "(PyObject *self, PyObject *args);\n"; + } } } } @@ -114,22 +114,22 @@ write_python_table(ostream &out) { // Consider only those that belong in the module we asked for. if (interrogate_function_has_module_name(function_index) && - module_name == interrogate_function_module_name(function_index)) { + module_name == interrogate_function_module_name(function_index)) { // For each function, get all of the python wrappers. int num_wrappers = - interrogate_function_number_of_python_wrappers(function_index); + interrogate_function_number_of_python_wrappers(function_index); for (int wi = 0; wi < num_wrappers; wi++) { - FunctionWrapperIndex wrapper_index = - interrogate_function_python_wrapper(function_index, wi); + FunctionWrapperIndex wrapper_index = + interrogate_function_python_wrapper(function_index, wi); - if (interrogate_wrapper_is_callable_by_name(wrapper_index)) { - const char *wrapper_name = - interrogate_wrapper_name(wrapper_index); - out << " { \"" - << wrapper_name << "\", &" - << wrapper_name << ", METH_VARARGS },\n"; - } + if (interrogate_wrapper_is_callable_by_name(wrapper_index)) { + const char *wrapper_name = + interrogate_wrapper_name(wrapper_index); + out << " { \"" + << wrapper_name << "\", &" + << wrapper_name << ", METH_VARARGS },\n"; + } } } } @@ -221,8 +221,8 @@ main(int argc, char *argv[]) { nout << "Loading " << pathname << "\n"; void *dl = load_dso(pathname); if (dl == NULL) { - nout << "Unable to load: " << load_dso_error() << "\n"; - exit(1); + nout << "Unable to load: " << load_dso_error() << "\n"; + exit(1); } } } @@ -235,8 +235,8 @@ main(int argc, char *argv[]) { nout << "Unable to write to " << output_code_filename << "\n"; } else { if (build_python_wrappers) { - int count = write_python_table(output_code); - nout << count << " python function wrappers exported.\n"; + int count = write_python_table(output_code); + nout << count << " python function wrappers exported.\n"; } } } diff --git a/dtool/src/interrogate/parameterRemap.h b/dtool/src/interrogate/parameterRemap.h index ee349641ae..ea2b11b448 100644 --- a/dtool/src/interrogate/parameterRemap.h +++ b/dtool/src/interrogate/parameterRemap.h @@ -14,7 +14,7 @@ class CPPType; class CPPExpression; //////////////////////////////////////////////////////////////////// -// Class : ParameterRemap +// Class : ParameterRemap // Description : An abstract base class for a number of different // kinds of ways to remap parameters for passing to // wrapper functions. @@ -46,7 +46,7 @@ public: virtual void pass_parameter(ostream &out, const string &variable_name); virtual string prepare_return_expr(ostream &out, int indent_level, - const string &expression); + const string &expression); virtual string get_return_expr(const string &expression); virtual string temporary_to_return(const string &temporary); virtual bool return_value_needs_management(); diff --git a/dtool/src/interrogate/parameterRemapBasicStringRefToString.h b/dtool/src/interrogate/parameterRemapBasicStringRefToString.h index df9ecfd6f0..961eb594c8 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringRefToString.h +++ b/dtool/src/interrogate/parameterRemapBasicStringRefToString.h @@ -11,7 +11,7 @@ #include "parameterRemapToString.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapBasicStringRefToString +// Class : ParameterRemapBasicStringRefToString // Description : Maps a const reference to a basic_string to an // atomic string. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapBasicStringToString.h b/dtool/src/interrogate/parameterRemapBasicStringToString.h index 1d3e0ac08a..d4edcbfb60 100644 --- a/dtool/src/interrogate/parameterRemapBasicStringToString.h +++ b/dtool/src/interrogate/parameterRemapBasicStringToString.h @@ -11,7 +11,7 @@ #include "parameterRemapToString.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapBasicStringToString +// Class : ParameterRemapBasicStringToString // Description : Maps a concrete basic_string to an atomic // string. //////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ public: virtual void pass_parameter(ostream &out, const string &variable_name); virtual string prepare_return_expr(ostream &out, int indent_level, - const string &expression); + const string &expression); virtual string get_return_expr(const string &expression); }; diff --git a/dtool/src/interrogate/parameterRemapCharStarToString.h b/dtool/src/interrogate/parameterRemapCharStarToString.h index 93f20088ab..348deff740 100644 --- a/dtool/src/interrogate/parameterRemapCharStarToString.h +++ b/dtool/src/interrogate/parameterRemapCharStarToString.h @@ -11,7 +11,7 @@ #include "parameterRemapToString.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapCharStarToString +// Class : ParameterRemapCharStarToString // Description : Maps from (char *) or (const char *) to the atomic // string type. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapConcreteToPointer.h b/dtool/src/interrogate/parameterRemapConcreteToPointer.h index 93b4dda292..8d6dea0a22 100644 --- a/dtool/src/interrogate/parameterRemapConcreteToPointer.h +++ b/dtool/src/interrogate/parameterRemapConcreteToPointer.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapConcreteToPointer +// Class : ParameterRemapConcreteToPointer // Description : A ParameterRemap class that handles remapping a // concrete structure or class parameter to a pointer // parameter. diff --git a/dtool/src/interrogate/parameterRemapConstToNonConst.h b/dtool/src/interrogate/parameterRemapConstToNonConst.h index 69c5ce7f4f..be71874cea 100644 --- a/dtool/src/interrogate/parameterRemapConstToNonConst.h +++ b/dtool/src/interrogate/parameterRemapConstToNonConst.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapConstToNonConst +// Class : ParameterRemapConstToNonConst // Description : A ParameterRemap class that handles remapping a // simple const parameter (like const int) to an // ordinary parameter (line int). It doesn't apply to diff --git a/dtool/src/interrogate/parameterRemapEnumToInt.h b/dtool/src/interrogate/parameterRemapEnumToInt.h index d7e9f591c1..7f7cff5e31 100644 --- a/dtool/src/interrogate/parameterRemapEnumToInt.h +++ b/dtool/src/interrogate/parameterRemapEnumToInt.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapEnumToInt +// Class : ParameterRemapEnumToInt // Description : A ParameterRemap class that handles remapping an // enumerated type to an integer parameter. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapPTToPointer.h b/dtool/src/interrogate/parameterRemapPTToPointer.h index 090e8d17f8..c43382e69a 100644 --- a/dtool/src/interrogate/parameterRemapPTToPointer.h +++ b/dtool/src/interrogate/parameterRemapPTToPointer.h @@ -14,7 +14,7 @@ class CPPType; class CPPStructType; //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapPTToPointer +// Class : ParameterRemapPTToPointer // Description : A ParameterRemap class that handles remapping a // PT(Type) or PointerTo to a Type *. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapReferenceToConcrete.h b/dtool/src/interrogate/parameterRemapReferenceToConcrete.h index 06eef96f0a..ce0593d792 100644 --- a/dtool/src/interrogate/parameterRemapReferenceToConcrete.h +++ b/dtool/src/interrogate/parameterRemapReferenceToConcrete.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapReferenceToConcrete +// Class : ParameterRemapReferenceToConcrete // Description : A ParameterRemap class that handles remapping a // const reference parameter to a concrete. This only // makes sense when we're talking about a const diff --git a/dtool/src/interrogate/parameterRemapReferenceToPointer.h b/dtool/src/interrogate/parameterRemapReferenceToPointer.h index 2676bd46a6..38407a00ab 100644 --- a/dtool/src/interrogate/parameterRemapReferenceToPointer.h +++ b/dtool/src/interrogate/parameterRemapReferenceToPointer.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapReferenceToPointer +// Class : ParameterRemapReferenceToPointer // Description : A ParameterRemap class that handles remapping a // reference (or a const reference) parameter to a // pointer (or const pointer) parameter. diff --git a/dtool/src/interrogate/parameterRemapThis.h b/dtool/src/interrogate/parameterRemapThis.h index 5e1c3ebc87..2df7d29e51 100644 --- a/dtool/src/interrogate/parameterRemapThis.h +++ b/dtool/src/interrogate/parameterRemapThis.h @@ -13,7 +13,7 @@ class CPPStructType; //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapThis +// Class : ParameterRemapThis // Description : A ParameterRemap class that represents a generated // "this" parameter. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parameterRemapToString.h b/dtool/src/interrogate/parameterRemapToString.h index 7c7591aab0..cd1ea97e02 100644 --- a/dtool/src/interrogate/parameterRemapToString.h +++ b/dtool/src/interrogate/parameterRemapToString.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapToString +// Class : ParameterRemapToString // Description : A base class for several different remapping types // that convert to an atomic string class. // diff --git a/dtool/src/interrogate/parameterRemapUnchanged.h b/dtool/src/interrogate/parameterRemapUnchanged.h index 57443803b2..0c2ccc4630 100644 --- a/dtool/src/interrogate/parameterRemapUnchanged.h +++ b/dtool/src/interrogate/parameterRemapUnchanged.h @@ -11,7 +11,7 @@ #include "parameterRemap.h" //////////////////////////////////////////////////////////////////// -// Class : ParameterRemapUnchanged +// Class : ParameterRemapUnchanged // Description : A ParameterRemap class that represents no change to // the parameter: the parameter type is legal as is. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/parse_file.cxx b/dtool/src/interrogate/parse_file.cxx index 627d28c21c..65f23b9e5f 100644 --- a/dtool/src/interrogate/parse_file.cxx +++ b/dtool/src/interrogate/parse_file.cxx @@ -58,40 +58,40 @@ show_type_or_expression(const string &str) { CPPType *type = parser.parse_type(str); if (type != NULL) { cout << "\nType: " << *type << "\n" - << "Defined in: " << type->_file << "\n\n"; + << "Defined in: " << type->_file << "\n\n"; CPPStructType *stype = type->as_struct_type(); if (stype != (CPPStructType *)NULL) { - stype->check_virtual(); + stype->check_virtual(); } type->output(cout, 0, &parser, true); cout << "\n\n" - << "is_template = " << type->is_template() << "\n" - << "is_fully_specified = " << type->is_fully_specified() << "\n" - << "is_tbd = " << type->is_tbd() << "\n"; + << "is_template = " << type->is_template() << "\n" + << "is_fully_specified = " << type->is_fully_specified() << "\n" + << "is_tbd = " << type->is_tbd() << "\n"; if (type->has_typedef_name()) { - cout << "get_typedef_name = " << type->get_typedef_name() << "\n"; + cout << "get_typedef_name = " << type->get_typedef_name() << "\n"; } cout << "get_simple_name = " << type->get_simple_name() << "\n" - << "get_local_name = " << type->get_local_name() << "\n" - << "get_fully_scoped_name = " << type->get_fully_scoped_name() << "\n" - << "get_preferred_name = " << type->get_preferred_name() << "\n" - << "is_incomplete = " << type->is_incomplete() << "\n"; + << "get_local_name = " << type->get_local_name() << "\n" + << "get_fully_scoped_name = " << type->get_fully_scoped_name() << "\n" + << "get_preferred_name = " << type->get_preferred_name() << "\n" + << "is_incomplete = " << type->is_incomplete() << "\n"; if (stype != (CPPStructType *)NULL) { - cout << "scope = " << stype->get_scope()->get_fully_scoped_name() << "\n"; - bool is_abstract = stype->is_abstract(); - cout << "is_abstract = " << is_abstract << "\n"; - if (is_abstract) { - cout << "pure virtual functions:\n"; - CPPStructType::VFunctions vf; - stype->get_pure_virtual_funcs(vf); - CPPStructType::VFunctions::const_iterator fi; - for (fi = vf.begin(); fi != vf.end(); ++fi) { - cout << " " << *(*fi) << "\n"; - } - } + cout << "scope = " << stype->get_scope()->get_fully_scoped_name() << "\n"; + bool is_abstract = stype->is_abstract(); + cout << "is_abstract = " << is_abstract << "\n"; + if (is_abstract) { + cout << "pure virtual functions:\n"; + CPPStructType::VFunctions vf; + stype->get_pure_virtual_funcs(vf); + CPPStructType::VFunctions::const_iterator fi; + for (fi = vf.begin(); fi != vf.end(); ++fi) { + cout << " " << *(*fi) << "\n"; + } + } } cout << "\n"; @@ -126,8 +126,8 @@ show_methods(const string &str) { CPPFunctionGroup::Instances::const_iterator ii; for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end(); - ++ii) { + ii != fgroup->_instances.end(); + ++ii) { CPPInstance *inst = (*ii); cerr << " " << *inst << "\n"; } @@ -240,14 +240,14 @@ main(int argc, char *argv[]) { if (argc < 2) { cerr << "parse-file [opts] file1.h [file2.h ... ]\n" - << "\nOptions:\n\n" - << " -I include_path\n" - << " -S system_include_path\n" - << " -D manifest_name\n" - << " -D manifest_name=manifest_definition\n" - << " -o output_file (ignored)\n" - << " -v (increase verbosity)\n" - << " -p (prompt for expression instead of dumping output)\n"; + << "\nOptions:\n\n" + << " -I include_path\n" + << " -S system_include_path\n" + << " -D manifest_name\n" + << " -D manifest_name=manifest_definition\n" + << " -o output_file (ignored)\n" + << " -v (increase verbosity)\n" + << " -p (prompt for expression instead of dumping output)\n"; exit(1); } @@ -268,23 +268,23 @@ main(int argc, char *argv[]) { getline(cin, str); if (!str.empty()) { - size_t space = str.find(' '); - if (space != string::npos) { - string first_word = str.substr(0, space); - string remainder = str.substr(space + 1); + size_t space = str.find(' '); + if (space != string::npos) { + string first_word = str.substr(0, space); + string remainder = str.substr(space + 1); - if (first_word == "methods") { - show_methods(remainder); - } else if (first_word == "members") { - show_data_members(remainder); - } else if (first_word == "typedefs") { - show_typedefs(remainder); - } else { - show_type_or_expression(str); - } - } else { - show_type_or_expression(str); - } + if (first_word == "methods") { + show_methods(remainder); + } else if (first_word == "members") { + show_data_members(remainder); + } else if (first_word == "typedefs") { + show_typedefs(remainder); + } else { + show_type_or_expression(str); + } + } else { + show_type_or_expression(str); + } } } } else { @@ -323,7 +323,7 @@ main(int argc, char *argv[]) { for (ci = parser._comments.begin(); ci != parser._comments.end(); ++ci) { const CPPParser::CommentBlock &c = (*ci); cout << "Comment in file " << c._file << " at line " << c._line_number - << ":\n" << c._comment << "\n\n"; + << ":\n" << c._comment << "\n\n"; } */ diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index 376d7e5524..e7d9422059 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -364,9 +364,9 @@ is_char(CPPType *type) { { CPPSimpleType *simple_type = type->as_simple_type(); if (simple_type != (CPPSimpleType *)NULL) { - return - simple_type->_type == CPPSimpleType::T_char && - simple_type->_flags == 0; + return + simple_type->_type == CPPSimpleType::T_char && + simple_type->_flags == 0; } } @@ -472,8 +472,8 @@ is_bool(CPPType *type) { { CPPSimpleType *simple_type = type->as_simple_type(); if (simple_type != (CPPSimpleType *)NULL) { - return - simple_type->_type == CPPSimpleType::T_bool; + return + simple_type->_type == CPPSimpleType::T_bool; } } @@ -504,10 +504,10 @@ is_integer(CPPType *type) { { CPPSimpleType *simple_type = type->as_simple_type(); if (simple_type != (CPPSimpleType *)NULL) { - return - (simple_type->_type == CPPSimpleType::T_bool || - simple_type->_type == CPPSimpleType::T_char || - simple_type->_type == CPPSimpleType::T_int); + return + (simple_type->_type == CPPSimpleType::T_bool || + simple_type->_type == CPPSimpleType::T_char || + simple_type->_type == CPPSimpleType::T_int); } } @@ -535,9 +535,9 @@ is_float(CPPType *type) { { CPPSimpleType *simple_type = type->as_simple_type(); if (simple_type != (CPPSimpleType *)NULL) { - return - (simple_type->_type == CPPSimpleType::T_float || - simple_type->_type == CPPSimpleType::T_double); + return + (simple_type->_type == CPPSimpleType::T_float || + simple_type->_type == CPPSimpleType::T_double); } } @@ -589,11 +589,11 @@ is_reference_count(CPPType *type) { CPPStructType *stype = type->as_struct_type(); CPPStructType::Derivation::const_iterator di; for (di = stype->_derivation.begin(); - di != stype->_derivation.end(); - ++di) { - if (is_reference_count((*di)._base)) { - return true; - } + di != stype->_derivation.end(); + ++di) { + if (is_reference_count((*di)._base)) { + return true; + } } } @@ -651,11 +651,11 @@ is_pointer_to_base(CPPType *type) { CPPStructType *stype = type->as_struct_type(); CPPStructType::Derivation::const_iterator di; for (di = stype->_derivation.begin(); - di != stype->_derivation.end(); - ++di) { - if (is_pointer_to_base((*di)._base)) { - return true; - } + di != stype->_derivation.end(); + ++di) { + if (is_pointer_to_base((*di)._base)) { + return true; + } } } @@ -728,7 +728,7 @@ involves_unpublished(CPPType *type) { // unpublished. if (type->_declaration != (CPPTypeDeclaration *)NULL) { if (type->_declaration->_vis <= min_vis) { - return false; + return false; } } { @@ -737,11 +737,11 @@ involves_unpublished(CPPType *type) { bool any_exported = false; CPPScope::Declarations::const_iterator di; for (di = scope->_declarations.begin(); - di != scope->_declarations.end() && !any_exported; - ++di) { - if ((*di)->_vis <= min_vis) { - any_exported = true; - } + di != scope->_declarations.end() && !any_exported; + ++di) { + if ((*di)->_vis <= min_vis) { + any_exported = true; + } } return !any_exported; @@ -750,7 +750,7 @@ involves_unpublished(CPPType *type) { case CPPDeclaration::ST_function: if (type->_declaration != (CPPTypeDeclaration *)NULL) { if (type->_declaration->_vis <= min_vis) { - return false; + return false; } } return true; @@ -758,15 +758,15 @@ involves_unpublished(CPPType *type) { { CPPFunctionType *ftype = type->as_function_type(); if (involves_unpublished(ftype->_return_type)) { - return true; + return true; } const CPPParameterList::Parameters ¶ms = - ftype->_parameters->_parameters; + ftype->_parameters->_parameters; CPPParameterList::Parameters::const_iterator pi; for (pi = params.begin(); pi != params.end(); ++pi) { - if (involves_unpublished((*pi)->_type)) { - return true; - } + if (involves_unpublished((*pi)->_type)) { + return true; + } } return false; } @@ -805,15 +805,15 @@ involves_protected(CPPType *type) { { CPPFunctionType *ftype = type->as_function_type(); if (involves_protected(ftype->_return_type)) { - return true; + return true; } const CPPParameterList::Parameters ¶ms = - ftype->_parameters->_parameters; + ftype->_parameters->_parameters; CPPParameterList::Parameters::const_iterator pi; for (pi = params.begin(); pi != params.end(); ++pi) { - if (involves_protected((*pi)->_type)) { - return true; - } + if (involves_protected((*pi)->_type)) { + return true; + } } return false; } @@ -945,14 +945,14 @@ get_pointer_type(CPPStructType *pt_type) { // takes no parameters. CPPFunctionGroup::Instances::iterator ii; for (ii = fgroup->_instances.begin(); - ii != fgroup->_instances.end(); - ++ii) { + ii != fgroup->_instances.end(); + ++ii) { CPPInstance *function = (*ii); CPPFunctionType *ftype = function->_type->as_function_type(); assert(ftype != (CPPFunctionType *)NULL); if (ftype->_parameters->_parameters.empty()) { - // Here's the function p(). What's its return type? - return resolve_type(ftype->_return_type); + // Here's the function p(). What's its return type? + return resolve_type(ftype->_return_type); } } } @@ -1089,7 +1089,7 @@ get_int_type() { //////////////////////////////////////////////////////////////////// string TypeManager:: get_function_signature(CPPInstance *function, - int num_default_parameters) { + int num_default_parameters) { CPPFunctionType *ftype = function->_type->as_function_type(); assert(ftype != (CPPFunctionType *)NULL); @@ -1168,13 +1168,13 @@ has_protected_destructor(CPPType *type) { if ((*di)->get_subtype() == CPPDeclaration::ST_instance) { CPPInstance *inst = (*di)->as_instance(); if (inst->_type->get_subtype() == CPPDeclaration::ST_function) { - // Here's a function declaration. - CPPFunctionType *ftype = inst->_type->as_function_type(); - assert(ftype != (CPPFunctionType *)NULL); - if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) { - // Here's the destructor! Is it protected? - return (inst->_vis > V_public); - } + // Here's a function declaration. + CPPFunctionType *ftype = inst->_type->as_function_type(); + assert(ftype != (CPPFunctionType *)NULL); + if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) { + // Here's the destructor! Is it protected? + return (inst->_vis > V_public); + } } } } diff --git a/dtool/src/interrogate/typeManager.h b/dtool/src/interrogate/typeManager.h index cc691e4173..6d4bc0b211 100644 --- a/dtool/src/interrogate/typeManager.h +++ b/dtool/src/interrogate/typeManager.h @@ -24,7 +24,7 @@ class CPPNameComponent; class CPPManifest; //////////////////////////////////////////////////////////////////// -// Class : TypeManager +// Class : TypeManager // Description : This is just a collection of static methods that // perform useful operations on CPPTypes for // interrogate. The class is really just a namespace @@ -85,7 +85,7 @@ public: static CPPType *get_int_type(); static string get_function_signature(CPPInstance *function, - int num_default_parameters = 0); + int num_default_parameters = 0); static bool has_protected_destructor(CPPType *type); }; diff --git a/dtool/src/interrogate/wrapperBuilder.cxx b/dtool/src/interrogate/wrapperBuilder.cxx index 0eb36f1001..cf1f8418f0 100644 --- a/dtool/src/interrogate/wrapperBuilder.cxx +++ b/dtool/src/interrogate/wrapperBuilder.cxx @@ -97,11 +97,11 @@ clear() { //////////////////////////////////////////////////////////////////// bool WrapperBuilder:: set_function(CPPInstance *function, const string &description, - CPPStructType *struct_type, - CPPScope *scope, const string &function_signature, - WrapperBuilder::Type type, - const string &expression, - int num_default_parameters) { + CPPStructType *struct_type, + CPPScope *scope, const string &function_signature, + WrapperBuilder::Type type, + const string &expression, + int num_default_parameters) { clear(); _function = function; @@ -150,16 +150,16 @@ set_function(CPPInstance *function, const string &description, // assignment-style operators, flag it as such. string fname = _function->get_simple_name(); if (fname == "operator =" || - fname == "operator *=" || - fname == "operator /=" || - fname == "operator %=" || - fname == "operator +=" || - fname == "operator -=" || - fname == "operator |=" || - fname == "operator &=" || - fname == "operator ^=" || - fname == "operator <<=" || - fname == "operator >>=") { + fname == "operator *=" || + fname == "operator /=" || + fname == "operator %=" || + fname == "operator +=" || + fname == "operator -=" || + fname == "operator |=" || + fname == "operator &=" || + fname == "operator ^=" || + fname == "operator <<=" || + fname == "operator >>=") { _type = T_assignment_method; } } @@ -310,26 +310,26 @@ make_remap(CPPType *orig_type) { // convert basic_string's to atomic strings. if (_struct_type == (CPPStructType *)NULL || - !TypeManager::is_basic_string_char(_struct_type)) { + !TypeManager::is_basic_string_char(_struct_type)) { if (TypeManager::is_basic_string_char(orig_type)) { - return new ParameterRemapBasicStringToString(orig_type); - + return new ParameterRemapBasicStringToString(orig_type); + } else if (TypeManager::is_const_ref_to_basic_string_char(orig_type)) { - return new ParameterRemapBasicStringRefToString(orig_type); + return new ParameterRemapBasicStringRefToString(orig_type); } } } if (manage_reference_counts) { if (TypeManager::is_pointer_to_base(orig_type) || - TypeManager::is_const_ref_to_pointer_to_base(orig_type)) { + TypeManager::is_const_ref_to_pointer_to_base(orig_type)) { CPPType *pt_type = TypeManager::unwrap_reference(orig_type); // Don't convert PointerTo<>'s to pointers for methods of the // PointerTo itself! if (_struct_type == (CPPStructType *)NULL || - !(pt_type->get_local_name(&parser) == _struct_type->get_local_name(&parser))) { - return new ParameterRemapPTToPointer(orig_type); + !(pt_type->get_local_name(&parser) == _struct_type->get_local_name(&parser))) { + return new ParameterRemapPTToPointer(orig_type); } } } @@ -371,7 +371,7 @@ make_remap(CPPType *orig_type) { //////////////////////////////////////////////////////////////////// string WrapperBuilder:: manage_return_value(ostream &out, int indent_level, - const string &return_expr) const { + const string &return_expr) const { if (_manage_reference_count) { // If we're managing reference counts, and we're about to return a // reference countable object, then increment its count. @@ -390,12 +390,12 @@ manage_return_value(ostream &out, int indent_level, out << " = " << return_expr << ";\n"; indent(out, indent_level) - << "if (" << return_expr << " != (" - << _return_type->get_new_type()->get_local_name(&parser) << ")0) {\n"; + << "if (" << return_expr << " != (" + << _return_type->get_new_type()->get_local_name(&parser) << ")0) {\n"; indent(out, indent_level + 2) - << return_expr << "->ref();\n"; + << return_expr << "->ref();\n"; indent(out, indent_level) - << "}\n"; + << "}\n"; output_ref(out, indent_level, "refcount"); return _return_type->temporary_to_return("refcount"); } @@ -489,7 +489,7 @@ get_call_str(const vector_string &pexprs) const { if (_type == T_getter) { if (_has_this) { call << "(" << get_parameter_expr(pn, pexprs) << ")->" - << _expression; + << _expression; } else { call << _expression; } @@ -497,7 +497,7 @@ get_call_str(const vector_string &pexprs) const { } else if (_type == T_setter) { if (_has_this) { call << "(" << get_parameter_expr(pn, pexprs) << ")->" - << _expression; + << _expression; pn++; } else { call << _expression; @@ -512,7 +512,7 @@ get_call_str(const vector_string &pexprs) const { // If we have a synthesized "this" parameter, the calling // convention is a bit different. call << "(" << get_parameter_expr(pn, pexprs) << ")->" - << _function->get_local_name(); + << _function->get_local_name(); pn++; } else if (_type == T_constructor) { @@ -528,9 +528,9 @@ get_call_str(const vector_string &pexprs) const { _parameters[pn]._remap->pass_parameter(call, get_parameter_expr(pn, pexprs)); pn++; while (pn < (int)_parameters.size()) { - call << ", "; - _parameters[pn]._remap->pass_parameter(call, get_parameter_expr(pn, pexprs)); - pn++; + call << ", "; + _parameters[pn]._remap->pass_parameter(call, get_parameter_expr(pn, pexprs)); + pn++; } } call << ")"; @@ -555,7 +555,7 @@ get_call_str(const vector_string &pexprs) const { //////////////////////////////////////////////////////////////////// string WrapperBuilder:: call_function(ostream &out, int indent_level, bool convert_result, - const vector_string &pexprs) const { + const vector_string &pexprs) const { string return_expr; if (_type == T_destructor) { @@ -568,10 +568,10 @@ call_function(ostream &out, int indent_level, bool convert_result, // Except for a reference-count type object, in which case the // destructor is a wrapper around unref_delete(). indent(out, indent_level) - << "unref_delete(" << get_parameter_expr(0, pexprs) << ");\n"; + << "unref_delete(" << get_parameter_expr(0, pexprs) << ");\n"; } else { indent(out, indent_level) - << "delete " << get_parameter_expr(0, pexprs) << ";\n"; + << "delete " << get_parameter_expr(0, pexprs) << ";\n"; } } else if (_type == T_typecast_method) { @@ -585,7 +585,7 @@ call_function(ostream &out, int indent_level, bool convert_result, return_expr = cast_expr; } else { string new_str = - _return_type->prepare_return_expr(out, indent_level, cast_expr); + _return_type->prepare_return_expr(out, indent_level, cast_expr); return_expr = _return_type->get_return_expr(new_str); } @@ -603,7 +603,7 @@ call_function(ostream &out, int indent_level, bool convert_result, return_expr = cast_expr; } else { string new_str = - _return_type->prepare_return_expr(out, indent_level, cast_expr); + _return_type->prepare_return_expr(out, indent_level, cast_expr); return_expr = _return_type->get_return_expr(new_str); } @@ -623,7 +623,7 @@ call_function(ostream &out, int indent_level, bool convert_result, return_expr = ref_expr; } else { string new_str = - _return_type->prepare_return_expr(out, indent_level, ref_expr); + _return_type->prepare_return_expr(out, indent_level, ref_expr); return_expr = _return_type->get_return_expr(new_str); // Now a simple special-case test. Often, we will have converted @@ -638,8 +638,8 @@ call_function(ostream &out, int indent_level, bool convert_result, // like "&(*this)", though. if (return_expr == "&(" + ref_expr + ")" || - return_expr == "&" + ref_expr) { - return_expr = this_expr; + return_expr == "&" + ref_expr) { + return_expr = this_expr; } } @@ -655,22 +655,22 @@ call_function(ostream &out, int indent_level, bool convert_result, } else { if (_return_type->return_value_should_be_simple()) { - // We have to assign the result to a temporary first; this makes - // it a bit easier on poor old VC++. - indent(out, indent_level); - _return_type->get_orig_type()->output_instance(out, "result", - &parser); - out << " = " << call << ";\n"; - - string new_str = - _return_type->prepare_return_expr(out, indent_level, "result"); - return_expr = _return_type->get_return_expr(new_str); - + // We have to assign the result to a temporary first; this makes + // it a bit easier on poor old VC++. + indent(out, indent_level); + _return_type->get_orig_type()->output_instance(out, "result", + &parser); + out << " = " << call << ";\n"; + + string new_str = + _return_type->prepare_return_expr(out, indent_level, "result"); + return_expr = _return_type->get_return_expr(new_str); + } else { - // This should be simple enough that we can return it directly. - string new_str = - _return_type->prepare_return_expr(out, indent_level, call); - return_expr = _return_type->get_return_expr(new_str); + // This should be simple enough that we can return it directly. + string new_str = + _return_type->prepare_return_expr(out, indent_level, call); + return_expr = _return_type->get_return_expr(new_str); } } } @@ -690,13 +690,13 @@ void WrapperBuilder:: write_spam_message(ostream &out) const { if (generate_spam) { out << "#ifndef NDEBUG\n" - << " if (in_" << library_name << "_cat.is_spam()) {\n" - << " in_" << library_name << "_cat.spam()\n" - << " << \""; + << " if (in_" << library_name << "_cat.is_spam()) {\n" + << " in_" << library_name << "_cat.spam()\n" + << " << \""; write_quoted_string(out, _description); out << "\\n\";\n" - << " }\n" - << "#endif\n"; + << " }\n" + << "#endif\n"; } } diff --git a/dtool/src/interrogate/wrapperBuilder.h b/dtool/src/interrogate/wrapperBuilder.h index 6173454a6f..3555dcb130 100644 --- a/dtool/src/interrogate/wrapperBuilder.h +++ b/dtool/src/interrogate/wrapperBuilder.h @@ -21,7 +21,7 @@ class CPPFunctionType; class ParameterRemap; //////////////////////////////////////////////////////////////////// -// Class : WrapperBuilder +// Class : WrapperBuilder // Description : Contains all the information necessary to synthesize // a wrapper around a particular function. This // includes choosing appropriate parameter types to @@ -51,10 +51,10 @@ public: void clear(); bool set_function(CPPInstance *function, const string &description, - CPPStructType *struct_type, CPPScope *scope, - const string &function_signature, Type type, - const string &expression, - int num_default_parameters); + CPPStructType *struct_type, CPPScope *scope, + const string &function_signature, Type type, + const string &expression, + int num_default_parameters); bool is_valid() const; bool return_value_needs_management() const; @@ -103,7 +103,7 @@ public: protected: virtual ParameterRemap *make_remap(CPPType *orig_type); string manage_return_value(ostream &out, int indent_level, - const string &return_expr) const; + const string &return_expr) const; void output_ref(ostream &out, int indent_level, const string &varname) const; string get_parameter_name(int n) const; @@ -111,8 +111,8 @@ protected: string get_call_str(const vector_string &pexprs = vector_string()) const; string call_function(ostream &out, int indent_level, - bool convert_result = true, - const vector_string &pexprs = vector_string()) const; + bool convert_result = true, + const vector_string &pexprs = vector_string()) const; void write_spam_message(ostream &out) const; void write_quoted_string(ostream &out, const string &str) const; diff --git a/dtool/src/interrogate/wrapperBuilderC.cxx b/dtool/src/interrogate/wrapperBuilderC.cxx index dba510bf1b..28884c495e 100644 --- a/dtool/src/interrogate/wrapperBuilderC.cxx +++ b/dtool/src/interrogate/wrapperBuilderC.cxx @@ -61,7 +61,7 @@ write_wrapper(ostream &out, const string &wrapper_name) const { while (pn < (int)_parameters.size()) { out << ", "; _parameters[pn]._remap->get_new_type()-> - output_instance(out, get_parameter_name(pn), &parser); + output_instance(out, get_parameter_name(pn), &parser); pn++; } } diff --git a/dtool/src/interrogate/wrapperBuilderC.h b/dtool/src/interrogate/wrapperBuilderC.h index c579fbed44..ee0dc2d5bd 100644 --- a/dtool/src/interrogate/wrapperBuilderC.h +++ b/dtool/src/interrogate/wrapperBuilderC.h @@ -11,7 +11,7 @@ #include "wrapperBuilder.h" //////////////////////////////////////////////////////////////////// -// Class : WrapperBuilderC +// Class : WrapperBuilderC // Description : A specialization on WrapperBuilder that builds // C-style wrapper functions. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogate/wrapperBuilderPython.cxx b/dtool/src/interrogate/wrapperBuilderPython.cxx index 995421debb..8414a6a0d2 100644 --- a/dtool/src/interrogate/wrapperBuilderPython.cxx +++ b/dtool/src/interrogate/wrapperBuilderPython.cxx @@ -76,19 +76,19 @@ write_wrapper(ostream &out, const string &wrapper_name) const { if (_parameters[pn]._remap->new_type_is_atomic_string()) { if (TypeManager::is_char_pointer(orig_type)) { - out << "char *" << get_parameter_name(pn); - format_specifiers += "s"; - parameter_list += ", &" + get_parameter_name(pn); + out << "char *" << get_parameter_name(pn); + format_specifiers += "s"; + parameter_list += ", &" + get_parameter_name(pn); } else { - out << "char *" << get_parameter_name(pn) - << "_str; int " << get_parameter_name(pn) << "_len"; - format_specifiers += "s#"; - parameter_list += ", &" + get_parameter_name(pn) - + "_str, &" + get_parameter_name(pn) + "_len"; - pexpr_string = "basic_string(" + - get_parameter_name(pn) + "_str, " + - get_parameter_name(pn) + "_len)"; + out << "char *" << get_parameter_name(pn) + << "_str; int " << get_parameter_name(pn) << "_len"; + format_specifiers += "s#"; + parameter_list += ", &" + get_parameter_name(pn) + + "_str, &" + get_parameter_name(pn) + "_len"; + pexpr_string = "basic_string(" + + get_parameter_name(pn) + "_str, " + + get_parameter_name(pn) + "_len)"; } } else if (TypeManager::is_bool(type)) { @@ -247,7 +247,7 @@ pack_return_value(ostream &out, string return_expr) const { } else { out << "\"s#\", " << return_expr << ".data(), " - << return_expr << ".length()"; + << return_expr << ".length()"; } } else if (TypeManager::is_integer(type)) { diff --git a/dtool/src/interrogate/wrapperBuilderPython.h b/dtool/src/interrogate/wrapperBuilderPython.h index c36089f710..d43392e1f0 100644 --- a/dtool/src/interrogate/wrapperBuilderPython.h +++ b/dtool/src/interrogate/wrapperBuilderPython.h @@ -11,7 +11,7 @@ #include "wrapperBuilder.h" //////////////////////////////////////////////////////////////////// -// Class : WrapperBuilderPython +// Class : WrapperBuilderPython // Description : A specialization on WrapperBuilder that builds // Python-style wrapper functions. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/indexRemapper.h b/dtool/src/interrogatedb/indexRemapper.h index b112474205..7bd4ce18de 100644 --- a/dtool/src/interrogatedb/indexRemapper.h +++ b/dtool/src/interrogatedb/indexRemapper.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : IndexRemapper +// Class : IndexRemapper // Description : This class manages a mapping of integers to integers. // It's used in this package to resequence some or all // of the index numbers in the database to a different diff --git a/dtool/src/interrogatedb/interrogateComponent.h b/dtool/src/interrogatedb/interrogateComponent.h index 5bb804ec3c..2878828372 100644 --- a/dtool/src/interrogatedb/interrogateComponent.h +++ b/dtool/src/interrogatedb/interrogateComponent.h @@ -16,7 +16,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateComponent +// Class : InterrogateComponent // Description : The base class for things that are part of the // interrogate database. This includes types, // functions, and function wrappers. diff --git a/dtool/src/interrogatedb/interrogateDatabase.I b/dtool/src/interrogatedb/interrogateDatabase.I index 7a290ecb81..6c1a4dec8d 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.I +++ b/dtool/src/interrogatedb/interrogateDatabase.I @@ -28,7 +28,7 @@ INLINE TypeIndex InterrogateDatabase:: lookup_type_by_name(const string &name) { check_latest(); return lookup(name, _types_by_name, LT_type_name, - &InterrogateDatabase::freshen_types_by_name); + &InterrogateDatabase::freshen_types_by_name); } //////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ INLINE TypeIndex InterrogateDatabase:: lookup_type_by_scoped_name(const string &name) { check_latest(); return lookup(name, _types_by_scoped_name, LT_type_scoped_name, - &InterrogateDatabase::freshen_types_by_scoped_name); + &InterrogateDatabase::freshen_types_by_scoped_name); } //////////////////////////////////////////////////////////////////// @@ -56,7 +56,7 @@ INLINE TypeIndex InterrogateDatabase:: lookup_type_by_true_name(const string &name) { check_latest(); return lookup(name, _types_by_true_name, LT_type_true_name, - &InterrogateDatabase::freshen_types_by_true_name); + &InterrogateDatabase::freshen_types_by_true_name); } //////////////////////////////////////////////////////////////////// @@ -70,7 +70,7 @@ INLINE ManifestIndex InterrogateDatabase:: lookup_manifest_by_name(const string &name) { check_latest(); return lookup(name, _manifests_by_name, LT_manifest_name, - &InterrogateDatabase::freshen_manifests_by_name); + &InterrogateDatabase::freshen_manifests_by_name); } //////////////////////////////////////////////////////////////////// @@ -84,7 +84,7 @@ INLINE ElementIndex InterrogateDatabase:: lookup_element_by_name(const string &name) { check_latest(); return lookup(name, _elements_by_name, LT_element_name, - &InterrogateDatabase::freshen_elements_by_name); + &InterrogateDatabase::freshen_elements_by_name); } //////////////////////////////////////////////////////////////////// @@ -98,5 +98,5 @@ INLINE ElementIndex InterrogateDatabase:: lookup_element_by_scoped_name(const string &name) { check_latest(); return lookup(name, _elements_by_scoped_name, LT_element_scoped_name, - &InterrogateDatabase::freshen_elements_by_scoped_name); + &InterrogateDatabase::freshen_elements_by_scoped_name); } diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index 2bca5a0e2e..c168ceac8c 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -36,7 +36,7 @@ get_ptr() { if (_global_ptr == (InterrogateDatabase *)NULL) { if (interrogatedb_cat->is_debug()) { interrogatedb_cat->debug() - << "Creating interrogate database\n"; + << "Creating interrogate database\n"; } _global_ptr = new InterrogateDatabase; } @@ -57,10 +57,10 @@ request_module(InterrogateModuleDef *def) { if (interrogatedb_cat->is_debug()) { if (def->library_name == (const char *)NULL) { interrogatedb_cat->debug() - << "Got interrogate data for anonymous module\n"; + << "Got interrogate data for anonymous module\n"; } else { interrogatedb_cat->debug() - << "Got interrogate data for module " << def->library_name << "\n"; + << "Got interrogate data for module " << def->library_name << "\n"; } } @@ -413,8 +413,8 @@ get_wrapper_by_unique_name(const string &unique_name) { InterrogateModuleDef *def = (*mi).second; int index_offset = binary_search_wrapper_hash(def->unique_names, - def->unique_names + def->num_unique_names, - wrapper_hash_name); + def->unique_names + def->num_unique_names, + wrapper_hash_name); if (index_offset >= 0) { return def->first_index + index_offset; } @@ -534,7 +534,7 @@ add_function(FunctionIndex index, const InterrogateFunction &function) { //////////////////////////////////////////////////////////////////// void InterrogateDatabase:: add_wrapper(FunctionWrapperIndex index, - const InterrogateFunctionWrapper &wrapper) { + const InterrogateFunctionWrapper &wrapper) { bool inserted = _wrapper_map.insert(FunctionWrapperMap::value_type(index, wrapper)).second; assert(inserted); @@ -833,8 +833,8 @@ read(istream &in, InterrogateModuleDef *def) { int next = temp.remap_indices(def->first_index); if (next != def->next_index) { interrogatedb_cat->error() - << "Module database file " << def->database_filename - << " is out of date.\n"; + << "Module database file " << def->database_filename + << " is out of date.\n"; return false; } } @@ -863,49 +863,49 @@ load_latest() { Filename filename = def->database_filename; Filename pathname = filename; if (!pathname.empty() && pathname[0] != '/') { - pathname = searchpath.find_file(pathname); + pathname = searchpath.find_file(pathname); } if (pathname.empty()) { - interrogatedb_cat->error() - << "Unable to find " << filename << " on " << searchpath << "\n"; + interrogatedb_cat->error() + << "Unable to find " << filename << " on " << searchpath << "\n"; } else { - ifstream input; - pathname.set_text(); - if (!pathname.open_read(input)) { - interrogatedb_cat->error() << "Unable to read " << pathname << ".\n"; - } else { - int file_identifier; - input >> file_identifier - >> _file_major_version >> _file_minor_version; + ifstream input; + pathname.set_text(); + if (!pathname.open_read(input)) { + interrogatedb_cat->error() << "Unable to read " << pathname << ".\n"; + } else { + int file_identifier; + input >> file_identifier + >> _file_major_version >> _file_minor_version; - if (def->file_identifier != 0 && - file_identifier != def->file_identifier) { - interrogatedb_cat->warning() - << "Interrogate data in " << pathname - << " is out of sync with the compiled-in data.\n"; - } + if (def->file_identifier != 0 && + file_identifier != def->file_identifier) { + interrogatedb_cat->warning() + << "Interrogate data in " << pathname + << " is out of sync with the compiled-in data.\n"; + } - if (_file_major_version != _current_major_version || - _file_minor_version > _current_minor_version) { - interrogatedb_cat->error() - << "Cannot read interrogate data in " << pathname - << "; database is version " << _file_major_version << "." - << _file_minor_version << " while we are expecting " - << _current_major_version << "." << _current_minor_version - << ".\n"; - } else { - if (interrogatedb_cat->is_debug()) { - interrogatedb_cat->debug() - << "Reading " << filename << "\n"; - } - if (!read(input, def)) { - interrogatedb_cat->error() - << "Error reading " << pathname << ".\n"; - } - } - } + if (_file_major_version != _current_major_version || + _file_minor_version > _current_minor_version) { + interrogatedb_cat->error() + << "Cannot read interrogate data in " << pathname + << "; database is version " << _file_major_version << "." + << _file_minor_version << " while we are expecting " + << _current_major_version << "." << _current_minor_version + << ".\n"; + } else { + if (interrogatedb_cat->is_debug()) { + interrogatedb_cat->debug() + << "Reading " << filename << "\n"; + } + if (!read(input, def)) { + interrogatedb_cat->error() + << "Error reading " << pathname << ".\n"; + } + } + } } } } @@ -942,7 +942,7 @@ read_new(istream &in, InterrogateModuleDef *def) { InterrogateFunction function(def); in >> index >> function; if (in.fail()) { - return false; + return false; } add_function(index, function); @@ -962,7 +962,7 @@ read_new(istream &in, InterrogateModuleDef *def) { InterrogateFunctionWrapper wrapper(def); in >> index >> wrapper; if (in.fail()) { - return false; + return false; } add_wrapper(index, wrapper); @@ -982,7 +982,7 @@ read_new(istream &in, InterrogateModuleDef *def) { InterrogateType type(def); in >> index >> type; if (in.fail()) { - return false; + return false; } add_type(index, type); @@ -1002,7 +1002,7 @@ read_new(istream &in, InterrogateModuleDef *def) { InterrogateManifest manifest(def); in >> index >> manifest; if (in.fail()) { - return false; + return false; } add_manifest(index, manifest); @@ -1022,7 +1022,7 @@ read_new(istream &in, InterrogateModuleDef *def) { InterrogateElement element(def); in >> index >> element; if (in.fail()) { - return false; + return false; } add_element(index, element); @@ -1067,10 +1067,10 @@ merge_from(const InterrogateDatabase &other) { map::iterator ni; ni = types_by_name.find(other_type.get_true_name()); if (ni != types_by_name.end()) { - // Here's a type that we seem to have in common! We'll have - // to merge them. - TypeIndex this_type_index = (*ni).second; - remap.add_mapping(other_type_index, this_type_index); + // Here's a type that we seem to have in common! We'll have + // to merge them. + TypeIndex this_type_index = (*ni).second; + remap.add_mapping(other_type_index, this_type_index); } } } @@ -1092,9 +1092,9 @@ merge_from(const InterrogateDatabase &other) { InterrogateType &this_type = update_type(this_type_index); if (!this_type.is_global() && other_type.is_global()) { - // If the type is about to become global, we need to add it - // to our global_types list. - _global_types.push_back(this_type_index); + // If the type is about to become global, we need to add it + // to our global_types list. + _global_types.push_back(this_type_index); } InterrogateType merge_type = other_type; @@ -1161,7 +1161,7 @@ merge_from(const InterrogateDatabase &other) { //////////////////////////////////////////////////////////////////// bool InterrogateDatabase:: find_module(FunctionWrapperIndex wrapper, InterrogateModuleDef *&def, - int &module_index) { + int &module_index) { if (_modules.empty()) { return false; } @@ -1205,8 +1205,8 @@ binary_search_module(int begin, int end, FunctionIndex function) { //////////////////////////////////////////////////////////////////// int InterrogateDatabase:: binary_search_wrapper_hash(InterrogateUniqueNameDef *begin, - InterrogateUniqueNameDef *end, - const string &wrapper_hash_name) { + InterrogateUniqueNameDef *end, + const string &wrapper_hash_name) { if (end <= begin) { return -1; } diff --git a/dtool/src/interrogatedb/interrogateDatabase.h b/dtool/src/interrogatedb/interrogateDatabase.h index b7ec3e220f..579077b47f 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.h +++ b/dtool/src/interrogatedb/interrogateDatabase.h @@ -21,7 +21,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateDatabase +// Class : InterrogateDatabase // Description : This stores all of the interrogate data and handles // reading the data from a disk file when necessary. //////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public: void add_type(TypeIndex index, const InterrogateType &type); void add_function(FunctionIndex index, const InterrogateFunction &function); void add_wrapper(FunctionWrapperIndex index, - const InterrogateFunctionWrapper &wrapper); + const InterrogateFunctionWrapper &wrapper); void add_manifest(ManifestIndex index, const InterrogateManifest &manifest); void add_element(ElementIndex index, const InterrogateElement &element); @@ -102,11 +102,11 @@ private: void merge_from(const InterrogateDatabase &other); bool find_module(FunctionWrapperIndex wrapper, - InterrogateModuleDef *&def, int &module_index); + InterrogateModuleDef *&def, int &module_index); int binary_search_module(int begin, int end, FunctionIndex function); int binary_search_wrapper_hash(InterrogateUniqueNameDef *begin, - InterrogateUniqueNameDef *end, - const string &wrapper_hash_name); + InterrogateUniqueNameDef *end, + const string &wrapper_hash_name); // This data is loaded from the various database files. typedef map TypeMap; @@ -172,8 +172,8 @@ private: void freshen_elements_by_scoped_name(); int lookup(const string &name, - Lookup &lookup, LookupType type, - void (InterrogateDatabase::*freshen)()); + Lookup &lookup, LookupType type, + void (InterrogateDatabase::*freshen)()); static InterrogateDatabase *_global_ptr; static int _file_major_version; diff --git a/dtool/src/interrogatedb/interrogateElement.h b/dtool/src/interrogatedb/interrogateElement.h index 2a53098125..d45b23ad1b 100644 --- a/dtool/src/interrogatedb/interrogateElement.h +++ b/dtool/src/interrogatedb/interrogateElement.h @@ -13,7 +13,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateElement +// Class : InterrogateElement // Description : An internal representation of a data element, like a // data member or a global variable. //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogateFunction.h b/dtool/src/interrogatedb/interrogateFunction.h index 885e77c3fc..6d970ebfa9 100644 --- a/dtool/src/interrogatedb/interrogateFunction.h +++ b/dtool/src/interrogatedb/interrogateFunction.h @@ -15,7 +15,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateFunction +// Class : InterrogateFunction // Description : An internal representation of a function. //////////////////////////////////////////////////////////////////// class EXPCL_DTOOLCONFIG InterrogateFunction : public InterrogateComponent { diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.h b/dtool/src/interrogatedb/interrogateFunctionWrapper.h index d8d3a77eb5..c93a63edf2 100644 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.h +++ b/dtool/src/interrogatedb/interrogateFunctionWrapper.h @@ -15,7 +15,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateFunctionWrapper +// Class : InterrogateFunctionWrapper // Description : An internal representation of a function. //////////////////////////////////////////////////////////////////// class EXPCL_DTOOLCONFIG InterrogateFunctionWrapper : public InterrogateComponent { diff --git a/dtool/src/interrogatedb/interrogateManifest.h b/dtool/src/interrogatedb/interrogateManifest.h index bd7dcd6e37..aca8cca1bf 100644 --- a/dtool/src/interrogatedb/interrogateManifest.h +++ b/dtool/src/interrogatedb/interrogateManifest.h @@ -13,7 +13,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateManifest +// Class : InterrogateManifest // Description : An internal representation of a manifest constant. //////////////////////////////////////////////////////////////////// class EXPCL_DTOOLCONFIG InterrogateManifest : public InterrogateComponent { diff --git a/dtool/src/interrogatedb/interrogateType.h b/dtool/src/interrogatedb/interrogateType.h index c8926a7502..b1618c28f6 100644 --- a/dtool/src/interrogatedb/interrogateType.h +++ b/dtool/src/interrogatedb/interrogateType.h @@ -15,7 +15,7 @@ class IndexRemapper; //////////////////////////////////////////////////////////////////// -// Class : InterrogateType +// Class : InterrogateType // Description : An internal representation of a type. //////////////////////////////////////////////////////////////////// class EXPCL_DTOOLCONFIG InterrogateType : public InterrogateComponent { diff --git a/dtool/src/parser-inc/files.h b/dtool/src/parser-inc/files.h index 1344e10ebe..81777c54d8 100644 --- a/dtool/src/parser-inc/files.h +++ b/dtool/src/parser-inc/files.h @@ -1,19 +1,19 @@ -// Filename: files.h -// Created by: drose (07Nov00) -// -//////////////////////////////////////////////////////////////////// - -// This file, and all the other files in this directory, aren't -// intended to be compiled--they're just parsed by CPPParser (and -// interrogate) in lieu of the actual system headers, to generate the -// interrogate database. - -#ifndef FILES_H -#define FILES_H - -namespace CryptoPP { - class FileSource; - class FileSink; -}; - -#endif +// Filename: files.h +// Created by: drose (07Nov00) +// +//////////////////////////////////////////////////////////////////// + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef FILES_H +#define FILES_H + +namespace CryptoPP { + class FileSource; + class FileSink; +}; + +#endif diff --git a/dtool/src/parser-inc/hex.h b/dtool/src/parser-inc/hex.h index 080a2731ca..04f4b74b6d 100644 --- a/dtool/src/parser-inc/hex.h +++ b/dtool/src/parser-inc/hex.h @@ -1,14 +1,14 @@ -// Filename: hex.h -// Created by: drose (17Nov00) -// -//////////////////////////////////////////////////////////////////// - -// This file, and all the other hex in this directory, aren't -// intended to be compiled--they're just parsed by CPPParser (and -// interrogate) in lieu of the actual system headers, to generate the -// interrogate database. - -#ifndef HEX_H -#define HEX_H - -#endif +// Filename: hex.h +// Created by: drose (17Nov00) +// +//////////////////////////////////////////////////////////////////// + +// This file, and all the other hex in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef HEX_H +#define HEX_H + +#endif diff --git a/dtool/src/parser-inc/md5.h b/dtool/src/parser-inc/md5.h index 990bf90981..f30d9f23e9 100644 --- a/dtool/src/parser-inc/md5.h +++ b/dtool/src/parser-inc/md5.h @@ -1,19 +1,19 @@ -// Filename: md5.h -// Created by: drose (07Nov00) -// -//////////////////////////////////////////////////////////////////// - -// This file, and all the other files in this directory, aren't -// intended to be compiled--they're just parsed by CPPParser (and -// interrogate) in lieu of the actual system headers, to generate the -// interrogate database. - -#ifndef MD5_H -#define MD5_H - -namespace CryptoPP { - class MD5; -}; - -#endif - +// Filename: md5.h +// Created by: drose (07Nov00) +// +//////////////////////////////////////////////////////////////////// + +// This file, and all the other files in this directory, aren't +// intended to be compiled--they're just parsed by CPPParser (and +// interrogate) in lieu of the actual system headers, to generate the +// interrogate database. + +#ifndef MD5_H +#define MD5_H + +namespace CryptoPP { + class MD5; +}; + +#endif + diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index 2b53c7a13c..827b5b6894 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -34,7 +34,7 @@ show_type(int type, bool verbose = false) { cout << interrogate_type_name(type) << " "; if (verbose) { if (strcmp(interrogate_type_name(type), - interrogate_type_true_name(type)) != 0) { + interrogate_type_true_name(type)) != 0) { cout << "(" << interrogate_type_true_name(type) << ") "; } } @@ -148,7 +148,7 @@ describe_function(int function, int indent_level) { } for (w = 0; w < num_c_wrappers; w++) { describe_wrapper(interrogate_function_c_wrapper(function, w), - indent_level + 4); + indent_level + 4); } int num_python_wrappers = @@ -163,7 +163,7 @@ describe_function(int function, int indent_level) { } for (w = 0; w < num_python_wrappers; w++) { describe_wrapper(interrogate_function_python_wrapper(function, w), - indent_level + 4); + indent_level + 4); } } @@ -184,7 +184,7 @@ report_manifests() { cout << " of unknown type\n"; } cout << " definition is \"" - << interrogate_manifest_definition(manifest) << "\"\n"; + << interrogate_manifest_definition(manifest) << "\"\n"; if (interrogate_manifest_has_getter(manifest)) { cout << " value getter: "; @@ -194,8 +194,8 @@ report_manifests() { if (interrogate_manifest_has_int_value(manifest)) { cout << " int value = " - << interrogate_manifest_get_int_value(manifest) - << "\n"; + << interrogate_manifest_get_int_value(manifest) + << "\n"; } } } @@ -309,8 +309,8 @@ describe_type(int type, int indent_level) { if (num_enum_values > 0) { for (int i = 0; i < num_enum_values; i++) { indent(cout, indent_level + 4) - << interrogate_type_enum_value_name(type, i) - << " = " << interrogate_type_enum_value(type, i) << "\n"; + << interrogate_type_enum_value_name(type, i) + << " = " << interrogate_type_enum_value(type, i) << "\n"; } } int num_constructors = interrogate_type_number_of_constructors(type); @@ -359,22 +359,22 @@ describe_type(int type, int indent_level) { indent(cout, indent_level + 4); show_type(derivation); if (interrogate_type_derivation_has_upcast(type, i)) { - cout << " (has upcast)"; + cout << " (has upcast)"; } if (interrogate_type_derivation_downcast_is_impossible(type, i)) { - cout << " (downcast is impossible)"; + cout << " (downcast is impossible)"; } if (interrogate_type_derivation_has_downcast(type, i)) { - cout << " (has downcast)"; + cout << " (has downcast)"; } cout << "\n"; /* - if (interrogate_type_derivation_has_upcast(type, i)) { - describe_function(interrogate_type_get_upcast(type, i), 8); - } - if (interrogate_type_derivation_has_downcast(type, i)) { - describe_function(interrogate_type_get_downcast(type, i), 8); - } + if (interrogate_type_derivation_has_upcast(type, i)) { + describe_function(interrogate_type_get_upcast(type, i), 8); + } + if (interrogate_type_derivation_has_downcast(type, i)) { + describe_function(interrogate_type_get_downcast(type, i), 8); + } */ } } @@ -515,8 +515,8 @@ main(int argc, char *argv[]) { cerr << "Loading " << pathname << "\n"; void *dl = load_dso(pathname); if (dl == NULL) { - cerr << "Unable to load: " << load_dso_error() << "\n"; - return_status++; + cerr << "Unable to load: " << load_dso_error() << "\n"; + return_status++; } } } diff --git a/panda/src/audio/audio_gui_functor.cxx b/panda/src/audio/audio_gui_functor.cxx index f6cfe81a98..592da6c2df 100644 --- a/panda/src/audio/audio_gui_functor.cxx +++ b/panda/src/audio/audio_gui_functor.cxx @@ -8,7 +8,7 @@ TypeHandle AudioGuiFunctor::_type_handle; AudioGuiFunctor::AudioGuiFunctor(AudioSound* sound, - GuiBehavior::BehaviorFunctor* prev) + GuiBehavior::BehaviorFunctor* prev) : GuiBehavior::BehaviorFunctor(), _prev(prev), _sound(sound) {} AudioGuiFunctor::~AudioGuiFunctor(void) { diff --git a/panda/src/audio/audio_gui_functor.h b/panda/src/audio/audio_gui_functor.h index 60852a4514..a3a9417634 100644 --- a/panda/src/audio/audio_gui_functor.h +++ b/panda/src/audio/audio_gui_functor.h @@ -18,8 +18,8 @@ public: virtual void doit(GuiBehavior*); PUBLISHED: AudioGuiFunctor(AudioSound* = (AudioSound*)0L, - GuiBehavior::BehaviorFunctor* = - (GuiBehavior::BehaviorFunctor*)0L); + GuiBehavior::BehaviorFunctor* = + (GuiBehavior::BehaviorFunctor*)0L); INLINE AudioSound* get_sound(void) const { return _sound; } INLINE GuiBehavior::BehaviorFunctor* get_prev(void) const { return _prev; } public: @@ -30,7 +30,7 @@ public: static void init_type(void) { GuiBehavior::BehaviorFunctor::init_type(); register_type(_type_handle, "AudioGuiFunctor", - GuiBehavior::BehaviorFunctor::get_class_type()); + GuiBehavior::BehaviorFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/audio/audio_linux_traits.cxx b/panda/src/audio/audio_linux_traits.cxx index abd8549888..4f23b0afe4 100644 --- a/panda/src/audio/audio_linux_traits.cxx +++ b/panda/src/audio/audio_linux_traits.cxx @@ -53,7 +53,7 @@ INLINE static signed short read_buffer(byte* buf, int idx) { break; default: audio_cat->debug() << "unknown sample size (" << sample_size << ")" - << endl; + << endl; break; } return ret; @@ -69,7 +69,7 @@ INLINE static void write_buffer(byte* buf, int idx, signed short val) { break; default: audio_cat->debug() << "unknown sample size (" << sample_size << ")" - << endl; + << endl; break; } } @@ -85,7 +85,7 @@ INLINE static signed short sound_clamp(signed int value) { break; default: audio_cat->debug() << "unknown sample size (" << sample_size << ")" - << endl; + << endl; break; } return ret; @@ -200,10 +200,10 @@ static void* internal_update(void*) { } else { write(output_fd, current_buffer, audio_buffer_size); { - mutex_lock m(buffer_mutex); - swap_buffers(); - --have_buffers; - ++want_buffers; + mutex_lock m(buffer_mutex); + swap_buffers(); + --have_buffers; + ++want_buffers; } } } @@ -248,7 +248,7 @@ static void initialize(void) { audio_cat->info() << "spawning internal update thread" << endl; update_thread = thread::create(internal_update, (void*)0L, - thread::PRIORITY_NORMAL); + thread::PRIORITY_NORMAL); AudioManager::set_update_func(update_linux); AudioManager::set_shutdown_func(shutdown_linux); @@ -330,8 +330,8 @@ LinuxSamplePlayer::~LinuxSamplePlayer(void) { } void LinuxSamplePlayer::play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass* playing, - float start_time) { + AudioTraits::PlayingClass* playing, + float start_time) { initialize(); LinuxSamplePlaying* lplaying = (LinuxSamplePlaying*)playing; if (!AudioManager::get_sfx_active()) @@ -348,7 +348,7 @@ void LinuxSamplePlayer::play_sound(AudioTraits::SoundClass*, } void LinuxSamplePlayer::stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass* playing) { + AudioTraits::PlayingClass* playing) { initialize(); LinuxSamplePlaying* lplaying = (LinuxSamplePlaying*)playing; if (!AudioManager::get_sfx_active()) @@ -377,12 +377,12 @@ LinuxMusicPlayer::~LinuxMusicPlayer(void) { } void LinuxMusicPlayer::play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float) { + AudioTraits::PlayingClass*, float) { initialize(); } void LinuxMusicPlayer::stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*) { + AudioTraits::PlayingClass*) { initialize(); } diff --git a/panda/src/audio/audio_linux_traits.h b/panda/src/audio/audio_linux_traits.h index 74024fbbb9..68f8bf483d 100644 --- a/panda/src/audio/audio_linux_traits.h +++ b/panda/src/audio/audio_linux_traits.h @@ -32,7 +32,7 @@ private: } public: INLINE Buffer(byte* data, unsigned long size) : _data(data), _size(size), - _pos(0), _done(false) {} + _pos(0), _done(false) {} INLINE byte* get_buffer(byte* buf) { unsigned long copy_size = buffer_min(_size-_pos, audio_buffer_size); unsigned long residue = audio_buffer_size - copy_size; @@ -117,9 +117,9 @@ public: virtual ~LinuxSamplePlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: @@ -135,9 +135,9 @@ public: virtual ~LinuxMusicPlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: diff --git a/panda/src/audio/audio_mikmod_traits.h b/panda/src/audio/audio_mikmod_traits.h index 2c2968db99..4064c07d66 100644 --- a/panda/src/audio/audio_mikmod_traits.h +++ b/panda/src/audio/audio_mikmod_traits.h @@ -102,9 +102,9 @@ public: virtual ~MikModSamplePlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: @@ -120,9 +120,9 @@ public: virtual ~MikModFmsynthPlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: @@ -138,9 +138,9 @@ public: virtual ~MikModMidiPlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: diff --git a/panda/src/audio/audio_null_traits.h b/panda/src/audio/audio_null_traits.h index a5ef53a6db..152678ba91 100644 --- a/panda/src/audio/audio_null_traits.h +++ b/panda/src/audio/audio_null_traits.h @@ -39,9 +39,9 @@ public: virtual ~NullPlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); }; diff --git a/panda/src/audio/audio_sound.I b/panda/src/audio/audio_sound.I index a32c6bbc49..d5c6b6239e 100644 --- a/panda/src/audio/audio_sound.I +++ b/panda/src/audio/audio_sound.I @@ -9,14 +9,14 @@ // Description: initialize a new sound //////////////////////////////////////////////////////////////////// INLINE AudioSound::AudioSound(AudioTraits::SoundClass* sound, - AudioTraits::PlayingClass* state, - AudioTraits::PlayerClass* player, - AudioTraits::DeletePlayingFunc* destroy, - const string& filename) : Namable(filename), - _sound(sound), - _state(state), - _player(player), - _delstate(destroy) {} + AudioTraits::PlayingClass* state, + AudioTraits::PlayerClass* player, + AudioTraits::DeletePlayingFunc* destroy, + const string& filename) : Namable(filename), + _sound(sound), + _state(state), + _player(player), + _delstate(destroy) {} //////////////////////////////////////////////////////////////////// // Function: AudioSound::copy constructor @@ -24,10 +24,10 @@ INLINE AudioSound::AudioSound(AudioTraits::SoundClass* sound, // Description: copy a sound, but we don't really want to allow this //////////////////////////////////////////////////////////////////// INLINE AudioSound::AudioSound(const AudioSound& c) : Namable(c.get_name()), - _sound(c._sound), - _state(c._state), - _player(c._player), - _delstate(c._delstate) {} + _sound(c._sound), + _state(c._state), + _player(c._player), + _delstate(c._delstate) {} //////////////////////////////////////////////////////////////////// // Function: AudioSound::assignment operator diff --git a/panda/src/audio/audio_sound.h b/panda/src/audio/audio_sound.h index 2c22ee01e3..bddd2549ec 100644 --- a/panda/src/audio/audio_sound.h +++ b/panda/src/audio/audio_sound.h @@ -27,8 +27,8 @@ private: AudioTraits::DeletePlayingFunc *_delstate; protected: INLINE AudioSound(AudioTraits::SoundClass*, AudioTraits::PlayingClass*, - AudioTraits::PlayerClass*, AudioTraits::DeletePlayingFunc*, - const string&); + AudioTraits::PlayerClass*, AudioTraits::DeletePlayingFunc*, + const string&); INLINE AudioSound(const AudioSound&); INLINE AudioSound& operator=(const AudioSound&); @@ -56,11 +56,11 @@ public: /* TypedObject::init_type(); register_type(_type_handle, "AudioSound", - TypedObject::get_class_type()); + TypedObject::get_class_type()); */ TypedReferenceCount::init_type(); register_type(_type_handle, "AudioSound", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/audio/audio_trait.cxx b/panda/src/audio/audio_trait.cxx index df489f613f..5b2ff7f449 100644 --- a/panda/src/audio/audio_trait.cxx +++ b/panda/src/audio/audio_trait.cxx @@ -43,12 +43,12 @@ AudioTraits::PlayerClass::~PlayerClass(void) { } void AudioTraits::PlayerClass::play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float) { + AudioTraits::PlayingClass*, float) { audio_cat->error() << "In abstract PlayerClass::play_sound!" << endl; } void AudioTraits::PlayerClass::stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*) { + AudioTraits::PlayingClass*) { audio_cat->error() << "In abstract PlayerClass::stop_sound!" << endl; } diff --git a/panda/src/audio/audio_win_traits.I b/panda/src/audio/audio_win_traits.I index bc8a271aff..e95c4b12b3 100644 --- a/panda/src/audio/audio_win_traits.I +++ b/panda/src/audio/audio_win_traits.I @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// INLINE WinSample::WinSample(void) : AudioTraits::SoundClass(), _data(NULL), - _len(0) { + _len(0) { } INLINE DWORD WinSample::get_length(void) const { @@ -16,8 +16,8 @@ INLINE WAVEFORMATEX WinSample::get_format(void) const { } INLINE WinMusic::WinMusic(void) : AudioTraits::SoundClass(), - _performance(NULL), _music(NULL), - _buffer(NULL), _synth(NULL) { + _performance(NULL), _music(NULL), + _buffer(NULL), _synth(NULL) { init(); } diff --git a/panda/src/audio/audio_win_traits.h b/panda/src/audio/audio_win_traits.h index 18c76c3214..74b82a0c22 100644 --- a/panda/src/audio/audio_win_traits.h +++ b/panda/src/audio/audio_win_traits.h @@ -96,9 +96,9 @@ public: virtual ~WinSamplePlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: @@ -114,9 +114,9 @@ public: virtual ~WinMusicPlayer(void); virtual void play_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*, float); + AudioTraits::PlayingClass*, float); virtual void stop_sound(AudioTraits::SoundClass*, - AudioTraits::PlayingClass*); + AudioTraits::PlayingClass*); virtual void set_volume(AudioTraits::PlayingClass*, float); virtual bool adjust_volume(AudioTraits::PlayingClass*); public: diff --git a/panda/src/audio/config_audio.cxx b/panda/src/audio/config_audio.cxx index 990dc3a313..5b4f55461f 100644 --- a/panda/src/audio/config_audio.cxx +++ b/panda/src/audio/config_audio.cxx @@ -21,7 +21,7 @@ string* audio_driver_params; int audio_buffer_size = config_audio.GetInt("audio-buffer-size", 4096); string* audio_device; int audio_auto_update_delay = config_audio.GetInt("audio-auto-update-delay", - 1000000); + 1000000); bool audio_is_active = config_audio.GetBool("audio-is-active", true); bool audio_sfx_active = config_audio.GetBool("audio-sfx-active", true); bool audio_music_active = config_audio.GetBool("audio-music-active", true); @@ -54,7 +54,7 @@ ConfigureFn(config_audio) { } audio_device = new string(config_audio.GetString("audio-device", - "/dev/dsp")); + "/dev/dsp")); string stmp = config_audio.GetString("audio-thread-priority", "NORMAL"); for (string::iterator q=stmp.begin(); q!=stmp.end(); ++q) @@ -79,7 +79,7 @@ void audio_load_loaders(void) { config_audio.GetAll("audio-loader", loaders); for (i=loaders.begin(); i!=loaders.end(); ++i) { Filename dlname = Filename::dso_filename("libaudio_load_" + (*i).Val() + - ".so"); + ".so"); audio_cat->info() << "loading '" << (*i).Val() << "' loader" << endl; void* tmp = load_dso(dlname); if (tmp == (void*)0L) diff --git a/panda/src/audio/test_audio.cxx b/panda/src/audio/test_audio.cxx index 4753d9ab39..60836f5d24 100644 --- a/panda/src/audio/test_audio.cxx +++ b/panda/src/audio/test_audio.cxx @@ -35,7 +35,7 @@ main(int argc, char* argv[]) { } AudioSound* sample = AudioPool::load_sound("test.mp3"); audio_cat->info() << "test.wav is " << sample->length() << " sec long" - << endl; + << endl; audio_cat->info() << "Playing test.wav" << endl; AudioManager::play(sample); while (sample->status() == AudioSound::PLAYING) { diff --git a/panda/src/audiotraits/audio_load_midi.cxx b/panda/src/audiotraits/audio_load_midi.cxx index d53dcf50c9..e639ebeea2 100644 --- a/panda/src/audiotraits/audio_load_midi.cxx +++ b/panda/src/audiotraits/audio_load_midi.cxx @@ -32,7 +32,7 @@ EXPCL_MISC AudioTraits::SoundClass* AudioLoadMidi(Filename filename) { AudioTraits::SoundClass* AudioLoadMidi(Filename) { audio_cat->warning() << "linux doesn't support reading midi data yet" - << endl; + << endl; return (AudioTraits::SoundClass*)0L; } diff --git a/panda/src/audiotraits/audio_load_wav.cxx b/panda/src/audiotraits/audio_load_wav.cxx index 750a3d85f9..77049dcca6 100644 --- a/panda/src/audiotraits/audio_load_wav.cxx +++ b/panda/src/audiotraits/audio_load_wav.cxx @@ -33,7 +33,7 @@ EXPCL_MISC AudioTraits::SoundClass* AudioLoadWav(Filename filename) { AudioTraits::SoundClass* AudioLoadWav(Filename) { audio_cat->error() << "Linux driver does not natively support WAV." - << " Try the 'st' loader." << endl; + << " Try the 'st' loader." << endl; return (AudioTraits::SoundClass*)0L; } diff --git a/panda/src/builder/builder.I b/panda/src/builder/builder.I index f07817508e..cf3f4a1a61 100644 --- a/panda/src/builder/builder.I +++ b/panda/src/builder/builder.I @@ -19,7 +19,7 @@ //////////////////////////////////////////////////////////////////// INLINE bool Builder:: add_prim(const BuilderBucket &bucket, - const BuilderPrim &prim) { + const BuilderPrim &prim) { add_bucket(bucket); return ((BuilderBucketNode &)(*_bi)).add_prim(prim); } @@ -39,7 +39,7 @@ add_prim(const BuilderBucket &bucket, //////////////////////////////////////////////////////////////////// INLINE bool Builder:: add_prim(const BuilderBucket &bucket, - const BuilderPrimI &prim) { + const BuilderPrimI &prim) { add_bucket(bucket); return ((BuilderBucketNode &)(*_bi)).add_prim(prim); } @@ -63,7 +63,7 @@ add_prim(const BuilderBucket &bucket, //////////////////////////////////////////////////////////////////// INLINE bool Builder:: add_prim_nonindexed(const BuilderBucket &bucket, - const BuilderPrimI &prim) { + const BuilderPrimI &prim) { add_bucket(bucket); return ((BuilderBucketNode &)(*_bi)).add_prim_nonindexed(prim); } diff --git a/panda/src/builder/builder.cxx b/panda/src/builder/builder.cxx index 8ab13825b9..0ffaae958c 100644 --- a/panda/src/builder/builder.cxx +++ b/panda/src/builder/builder.cxx @@ -134,14 +134,14 @@ build(const string &default_name) { // The node is not a GeomNode, so look it up in the map. GeomNodeMap::iterator f = geom_nodes.find(NodeMap(node, bucket)); if (f != geom_nodes.end()) { - geom_node = (*f).second; - + geom_node = (*f).second; + } else { - // No such node/name combination. Create a new one. - geom_node = bucket->make_geom_node(); - if (geom_node != NULL) { - geom_nodes[NodeMap(node, bucket)] = geom_node; - } + // No such node/name combination. Create a new one. + geom_node = bucket->make_geom_node(); + if (geom_node != NULL) { + geom_nodes[NodeMap(node, bucket)] = geom_node; + } } } @@ -171,10 +171,10 @@ build(const string &default_name) { // Assign the name to the geom, if it doesn't have one already. if (!geom_node->has_name()) { if (!name.empty()) { - geom_node->set_name(name); - + geom_node->set_name(name); + } else if (!default_name.empty()) { - geom_node->set_name(default_name); + geom_node->set_name(default_name); } } @@ -183,20 +183,20 @@ build(const string &default_name) { geom_node->get_num_parents(RenderRelation::get_class_type()); if (num_parents == 0) { if (geom_node->get_num_geoms() == 0) { - // If there was nothing added, never mind. - delete geom_node; - + // If there was nothing added, never mind. + delete geom_node; + } else if (node==NULL) { - nassertr(base_geom_node == NULL, NULL); - base_geom_node = geom_node; - + nassertr(base_geom_node == NULL, NULL); + base_geom_node = geom_node; + } else { - RenderRelation *arc = new RenderRelation(node, geom_node); - // Now, this is our only opportunity to apply the scene-graph - // state specified in the bucket to the node: we have created - // our own geom_node for these buckets, and we have parented - // it to the scene graph. - arc->copy_transitions_from(trans); + RenderRelation *arc = new RenderRelation(node, geom_node); + // Now, this is our only opportunity to apply the scene-graph + // state specified in the bucket to the node: we have created + // our own geom_node for these buckets, and we have parented + // it to the scene graph. + arc->copy_transitions_from(trans); } } } diff --git a/panda/src/builder/builder.h b/panda/src/builder/builder.h index 30ddbc577e..5c310b3412 100644 --- a/panda/src/builder/builder.h +++ b/panda/src/builder/builder.h @@ -166,7 +166,7 @@ class GeomNode; /////////////////////////////////////////////////////////////////// -// Class : Builder +// Class : Builder // Description : The main driver class to the builder package. See // the comments above. //////////////////////////////////////////////////////////////////// @@ -176,11 +176,11 @@ public: ~Builder(); INLINE bool add_prim(const BuilderBucket &bucket, - const BuilderPrim &prim); + const BuilderPrim &prim); INLINE bool add_prim(const BuilderBucket &bucket, - const BuilderPrimI &prim); + const BuilderPrimI &prim); INLINE bool add_prim_nonindexed(const BuilderBucket &bucket, - const BuilderPrimI &prim); + const BuilderPrimI &prim); GeomNode *build(const string &default_name = ""); diff --git a/panda/src/builder/builderAttribTempl.h b/panda/src/builder/builderAttribTempl.h index 913137b40d..cae0ccba62 100644 --- a/panda/src/builder/builderAttribTempl.h +++ b/panda/src/builder/builderAttribTempl.h @@ -64,7 +64,7 @@ protected: template INLINE ostream &operator << (ostream &out, - const BuilderAttribTempl &attrib) { + const BuilderAttribTempl &attrib) { return attrib.output(out); } diff --git a/panda/src/builder/builderBucket.h b/panda/src/builder/builderBucket.h index 83ac31c750..e929e7301d 100644 --- a/panda/src/builder/builderBucket.h +++ b/panda/src/builder/builderBucket.h @@ -28,7 +28,7 @@ class GeomNode; /////////////////////////////////////////////////////////////////// -// Class : BuilderBucket +// Class : BuilderBucket // Description : The main grouping tool for BuilderPrims. See the // comments at the beginning of builder.h. // diff --git a/panda/src/builder/builderBucketNode.I b/panda/src/builder/builderBucketNode.I index e7f84600c7..087c927b96 100644 --- a/panda/src/builder/builderBucketNode.I +++ b/panda/src/builder/builderBucketNode.I @@ -88,8 +88,8 @@ operator < (const BuilderBucketNode &other) const { INLINE bool BuilderBucketNode:: operator == (const BuilderBucketNode &other) const { return !((*_bucket) < (*other._bucket) || - (*other._bucket) < (*_bucket)); -} + (*other._bucket) < (*_bucket)); +} //////////////////////////////////////////////////////////////////// // Function: BuilderBucketNode::Nonequivalence operator @@ -99,4 +99,4 @@ operator == (const BuilderBucketNode &other) const { INLINE bool BuilderBucketNode:: operator != (const BuilderBucketNode &other) const { return !operator == (other); -} +} diff --git a/panda/src/builder/builderBucketNode.cxx b/panda/src/builder/builderBucketNode.cxx index 0eea92e711..7a4d452d12 100644 --- a/panda/src/builder/builderBucketNode.cxx +++ b/panda/src/builder/builderBucketNode.cxx @@ -53,12 +53,12 @@ build(GeomNode *geom_node) const { last_pi = _prims.begin(); for (pi = _prims.begin(); - pi != _prims.end(); - ++pi) { + pi != _prims.end(); + ++pi) { if ((*last_pi) < (*pi)) { - count += mesh_and_build(last_pi, pi, *_bucket, geom_node, - (BuilderPrim *)0); - last_pi = pi; + count += mesh_and_build(last_pi, pi, *_bucket, geom_node, + (BuilderPrim *)0); + last_pi = pi; } } count += mesh_and_build(last_pi, pi, *_bucket, geom_node, @@ -71,12 +71,12 @@ build(GeomNode *geom_node) const { last_pi = _iprims.begin(); for (pi = _iprims.begin(); - pi != _iprims.end(); - ++pi) { + pi != _iprims.end(); + ++pi) { if ((*last_pi) < (*pi)) { - count += mesh_and_build(last_pi, pi, *_bucket, geom_node, - (BuilderPrimI *)0); - last_pi = pi; + count += mesh_and_build(last_pi, pi, *_bucket, geom_node, + (BuilderPrimI *)0); + last_pi = pi; } } count += mesh_and_build(last_pi, pi, *_bucket, geom_node, diff --git a/panda/src/builder/builderBucketNode.h b/panda/src/builder/builderBucketNode.h index fb8c4d0736..b8cdfcdea6 100644 --- a/panda/src/builder/builderBucketNode.h +++ b/panda/src/builder/builderBucketNode.h @@ -17,7 +17,7 @@ class GeomNode; /////////////////////////////////////////////////////////////////// -// Class : BuilderBucketNode +// Class : BuilderBucketNode // Description : This is a wrapper class around BuilderBucket, used by // the Builder class. It stores a pointer to a // BuilderBucket object, as well as lists of the diff --git a/panda/src/builder/builderFuncs.I b/panda/src/builder/builderFuncs.I index 172531b745..1d0d4f2363 100644 --- a/panda/src/builder/builderFuncs.I +++ b/panda/src/builder/builderFuncs.I @@ -29,15 +29,15 @@ struct DecompVtx { template static bool decomp_concave(const PrimType &prim, BuilderBucket &bucket, - OutputIterator result, - int asum, int x, int y) { + OutputIterator result, + int asum, int x, int y) { #define VX(p, c) p->coord[c] vector output_prims; DecompVtx *p0, *p1, *p2, *t0, *vert; DecompVtx *m[3]; - float xmin, xmax, ymin, ymax; + float xmin, xmax, ymin, ymax; int i, init, csum, chek; float a[3], b[3], c[3], s[3]; @@ -74,9 +74,9 @@ decomp_concave(const PrimType &prim, BuilderBucket &bucket, while (p0 != p2->next) { /* Polygon is self-intersecting so punt */ if (chek && - m[0] == p0 && - m[1] == p1 && - m[2] == p2) { + m[0] == p0 && + m[1] == p1 && + m[2] == p2) { // builder_cat.info() << "Could not decompose concave polygon!"; return false; @@ -101,67 +101,67 @@ decomp_concave(const PrimType &prim, BuilderBucket &bucket, /* current angle is convex */ xmin = (VX(p0, x) < VX(p1, x)) ? VX(p0, x) : VX(p1, x); if (xmin > VX(p2, x)) - xmin = VX(p2, x); + xmin = VX(p2, x); xmax = (VX(p0, x) > VX(p1, x)) ? VX(p0, x) : VX(p1, x); if (xmax < VX(p2, x)) - xmax = VX(p2, x); + xmax = VX(p2, x); ymin = (VX(p0, y) < VX(p1, y)) ? VX(p0, y) : VX(p1, y); if (ymin > VX(p2, y)) - ymin = VX(p2, y); + ymin = VX(p2, y); ymax = (VX(p0, y) > VX(p1, y)) ? VX(p0, y) : VX(p1, y); if (ymax < VX(p2, y)) - ymax = VX(p2, y); + ymax = VX(p2, y); for (init = 1, t0 = p2->next; t0 != p0; t0 = t0->next) { - if (VX(t0, x) >= xmin && VX(t0, x) <= xmax && - VX(t0, y) >= ymin && VX(t0, y) <= ymax) { - if (init) { - a[1] = VX(p2, y) - VX(p0, y); - b[1] = VX(p0, x) - VX(p2, x); - init = 0; - c[0] = VX(p1, x) * VX(p2, y) - VX(p2, x) * VX(p1, y); - c[1] = VX(p2, x) * VX(p0, y) - VX(p0, x) * VX(p2, y); - c[2] = VX(p0, x) * VX(p1, y) - VX(p1, x) * VX(p0, y); - } - - s[0] = a[0] * VX(t0, x) + b[0] * VX(t0, y) + c[0]; - s[1] = a[1] * VX(t0, x) + b[1] * VX(t0, y) + c[1]; - s[2] = a[2] * VX(t0, x) + b[2] * VX(t0, y) + c[2]; - - if (asum) { - if (s[0] >= 0.0 && s[1] >= 0.0 && s[2] >= 0.0) - break; - } else { - if (s[0] <= 0.0 && s[1] <= 0.0 && s[2] <= 0.0) - break; - } - } + if (VX(t0, x) >= xmin && VX(t0, x) <= xmax && + VX(t0, y) >= ymin && VX(t0, y) <= ymax) { + if (init) { + a[1] = VX(p2, y) - VX(p0, y); + b[1] = VX(p0, x) - VX(p2, x); + init = 0; + c[0] = VX(p1, x) * VX(p2, y) - VX(p2, x) * VX(p1, y); + c[1] = VX(p2, x) * VX(p0, y) - VX(p0, x) * VX(p2, y); + c[2] = VX(p0, x) * VX(p1, y) - VX(p1, x) * VX(p0, y); + } + + s[0] = a[0] * VX(t0, x) + b[0] * VX(t0, y) + c[0]; + s[1] = a[1] * VX(t0, x) + b[1] * VX(t0, y) + c[1]; + s[2] = a[2] * VX(t0, x) + b[2] * VX(t0, y) + c[2]; + + if (asum) { + if (s[0] >= 0.0 && s[1] >= 0.0 && s[2] >= 0.0) + break; + } else { + if (s[0] <= 0.0 && s[1] <= 0.0 && s[2] <= 0.0) + break; + } + } } if (t0 != p0) { - p0 = p1; - p1 = p2; - p2 = p2->next; + p0 = p1; + p1 = p2; + p2 = p2->next; } else { - PrimType new_prim(prim); - new_prim.set_type(BPT_tri); - new_prim.clear_vertices(); - new_prim.add_vertex(prim.get_vertex(p0->index)); - new_prim.add_vertex(prim.get_vertex(p1->index)); - new_prim.add_vertex(prim.get_vertex(p2->index)); - output_prims.push_back(new_prim); - - p0->next = p1->next; - p1 = p2; - p2 = p2->next; - - m[0] = p0; - m[1] = p1; - m[2] = p2; - chek = 0; + PrimType new_prim(prim); + new_prim.set_type(BPT_tri); + new_prim.clear_vertices(); + new_prim.add_vertex(prim.get_vertex(p0->index)); + new_prim.add_vertex(prim.get_vertex(p1->index)); + new_prim.add_vertex(prim.get_vertex(p2->index)); + output_prims.push_back(new_prim); + + p0->next = p1->next; + p1 = p2; + p2 = p2->next; + + m[0] = p0; + m[1] = p1; + m[2] = p2; + chek = 0; } } } @@ -187,7 +187,7 @@ decomp_concave(const PrimType &prim, BuilderBucket &bucket, template static bool triangulate_poly(const PrimType &prim, BuilderBucket &bucket, - OutputIterator result) { + OutputIterator result) { BuilderV p0, p1, as; float dx1, dy1, dx2, dy2, max; int i, flag, asum, csum, index, x, y, v0, v1, v, even; @@ -225,16 +225,16 @@ triangulate_poly(const PrimType &prim, BuilderBucket &bucket, for (i = 0; i < 3; i++) { if (as[i] >= 0.0) { if (as[i] > max) { - max = as[i]; - index = i; - flag = 1; + max = as[i]; + index = i; + flag = 1; } } else { as[i] = -as[i]; if (as[i] > max) { - max = as[i]; - index = i; - flag = 0; + max = as[i]; + index = i; + flag = 0; } } } @@ -335,7 +335,7 @@ triangulate_poly(const PrimType &prim, BuilderBucket &bucket, template static bool expand_polys(PrimType &prim, BuilderBucket &, - OutputIterator result) { + OutputIterator result) { switch (prim.get_num_verts()) { case 0: case 1: @@ -367,7 +367,7 @@ expand_polys(PrimType &prim, BuilderBucket &, template static bool expand_points(const PrimType &prim, BuilderBucket &, - OutputIterator result) { + OutputIterator result) { // Each vertex goes in its own primitive. int num_verts = prim.get_num_verts(); @@ -389,7 +389,7 @@ expand_points(const PrimType &prim, BuilderBucket &, template static bool expand_lines(const PrimType &prim, BuilderBucket &, - OutputIterator result) { + OutputIterator result) { // Each line segment goes in its own primitive. This breaks up the // linestrips already defined; we'll re-strip them later if the // generate-tstrips flag is enabled. @@ -439,7 +439,7 @@ expand(const PrimType &prim, BuilderBucket &bucket, OutputIterator result) { new_prim.remove_doubled_verts(true); if (!bucket._subdivide_polys || - (bucket._mesh && new_prim.get_num_verts() <= 4)) { + (bucket._mesh && new_prim.get_num_verts() <= 4)) { // If we're meshing, we'd like to send quads through without // subdividing. The mesher can take advantage of the extra // information (and will eventually produce tris anyway). @@ -474,8 +474,8 @@ expand(const PrimType &prim, BuilderBucket &bucket, OutputIterator result) { template static int build_geoms(InputIterator first, InputIterator last, - BuilderBucket &bucket, GeomNode *geom_node, - PrimType *) { + BuilderBucket &bucket, GeomNode *geom_node, + PrimType *) { if (first==last) { return 0; } @@ -542,21 +542,21 @@ build_geoms(InputIterator first, InputIterator last, } else if (bind_normals != G_OFF) { // Test rule 2. if ((*i).has_vertex_normal()) { - bind_normals = G_PER_VERTEX; + bind_normals = G_PER_VERTEX; } else if (bind_normals != G_PER_VERTEX) { - // Test rule 3. - if ((*i).has_component_normal()) { - bind_normals = G_PER_COMPONENT; - } else if (bind_normals != G_PER_COMPONENT) { - // Test rule 4. - nassertr((*i).has_overall_normal(), 0); - if (first_normal) { - overall_normal = (*i).get_normal(); - first_normal = false; - } else if ( !((*i).get_normal() == overall_normal)) { - bind_normals = G_PER_PRIM; - } - } + // Test rule 3. + if ((*i).has_component_normal()) { + bind_normals = G_PER_COMPONENT; + } else if (bind_normals != G_PER_COMPONENT) { + // Test rule 4. + nassertr((*i).has_overall_normal(), 0); + if (first_normal) { + overall_normal = (*i).get_normal(); + first_normal = false; + } else if ( !((*i).get_normal() == overall_normal)) { + bind_normals = G_PER_PRIM; + } + } } } @@ -568,21 +568,21 @@ build_geoms(InputIterator first, InputIterator last, } else if (bind_colors != G_OFF) { // Test rule 2. if ((*i).has_vertex_color()) { - bind_colors = G_PER_VERTEX; + bind_colors = G_PER_VERTEX; } else if (bind_colors != G_PER_VERTEX) { - // Test rule 3. - if ((*i).has_component_color()) { - bind_colors = G_PER_COMPONENT; - } else if (bind_colors != G_PER_COMPONENT) { - // Test rule 4. - nassertr((*i).has_overall_color(), 0); - if (first_color) { - overall_color = (*i).get_color(); - first_color = false; - } else if ( !((*i).get_color() == overall_color)) { - bind_colors = G_PER_PRIM; - } - } + // Test rule 3. + if ((*i).has_component_color()) { + bind_colors = G_PER_COMPONENT; + } else if (bind_colors != G_PER_COMPONENT) { + // Test rule 4. + nassertr((*i).has_overall_color(), 0); + if (first_color) { + overall_color = (*i).get_color(); + first_color = false; + } else if ( !((*i).get_color() == overall_color)) { + bind_colors = G_PER_PRIM; + } + } } } @@ -661,7 +661,7 @@ build_geoms(InputIterator first, InputIterator last, j = 0; for (i = first; i != last; ++i) { if ((*i).is_valid()) { - lengths[j++] = (*i).get_num_verts(); + lengths[j++] = (*i).get_num_verts(); } } nassertr(j == num_prims, 0); @@ -683,35 +683,35 @@ build_geoms(InputIterator first, InputIterator last, num_verts = (*i).get_num_verts(); total_verts += num_verts; for (v = 0; v < num_verts; v++) { - coords.push_back((*i).get_vertex(v).get_coord()); - - if (bind_normals == G_PER_VERTEX) { - normals.push_back((*i).get_vertex(v).get_normal()); - } - if (bind_texcoords == G_PER_VERTEX) { - texcoords.push_back((*i).get_vertex(v).get_texcoord()); - } - if (bind_colors == G_PER_VERTEX) { - colors.push_back((*i).get_vertex(v).get_color()); - } + coords.push_back((*i).get_vertex(v).get_coord()); + + if (bind_normals == G_PER_VERTEX) { + normals.push_back((*i).get_vertex(v).get_normal()); + } + if (bind_texcoords == G_PER_VERTEX) { + texcoords.push_back((*i).get_vertex(v).get_texcoord()); + } + if (bind_colors == G_PER_VERTEX) { + colors.push_back((*i).get_vertex(v).get_color()); + } } num_components = (*i).get_num_components(); total_components += num_components; for (c = 0; c < num_components; c++) { - if (bind_normals == G_PER_COMPONENT) { - normals.push_back((*i).get_component(c).get_normal()); - } - if (bind_colors == G_PER_COMPONENT) { - colors.push_back((*i).get_component(c).get_color()); - } + if (bind_normals == G_PER_COMPONENT) { + normals.push_back((*i).get_component(c).get_normal()); + } + if (bind_colors == G_PER_COMPONENT) { + colors.push_back((*i).get_component(c).get_color()); + } } if (bind_normals == G_PER_PRIM) { - normals.push_back((*i).get_normal()); + normals.push_back((*i).get_normal()); } if (bind_colors == G_PER_PRIM) { - colors.push_back((*i).get_color()); + colors.push_back((*i).get_color()); } } } @@ -732,11 +732,11 @@ build_geoms(InputIterator first, InputIterator last, } PrimType::fill_geom(geom, coords, - bind_normals, normals, - bind_texcoords, texcoords, - bind_colors, colors, - bucket, num_prims, - total_components, total_verts); + bind_normals, normals, + bind_texcoords, texcoords, + bind_colors, colors, + bucket, num_prims, + total_components, total_verts); /* if ((*first).has_pixel_size()) { @@ -762,7 +762,7 @@ build_geoms(InputIterator first, InputIterator last, ///////////////////////////////////////////////////////////////////// -// Class : PrimByType +// Class : PrimByType // Description : An STL function object to sort primitives in order by // type. //////////////////////////////////////////////////////////////////// @@ -785,8 +785,8 @@ public: template static int __mesh_and_build(InputIterator first, InputIterator last, - BuilderBucket &bucket, GeomNode *geom_node, - PrimType *) { + BuilderBucket &bucket, GeomNode *geom_node, + PrimType *) { if (first==last) { return 0; } @@ -831,8 +831,8 @@ __mesh_and_build(InputIterator first, InputIterator last, last_pi = pi; for (++pi; pi != prims.end(); ++pi) { if ((*pi).get_type() != (*last_pi).get_type()) { - count += build_geoms(last_pi, pi, *bucket_ptr, geom_node, (PrimType*)0); - last_pi = pi; + count += build_geoms(last_pi, pi, *bucket_ptr, geom_node, (PrimType*)0); + last_pi = pi; } } count += build_geoms(last_pi, pi, *bucket_ptr, geom_node, (PrimType*)0); @@ -868,7 +868,7 @@ __mesh_and_build(InputIterator first, InputIterator last, template int mesh_and_build(InputIterator first, InputIterator last, - BuilderBucket &bucket, GeomNode *geom_node, + BuilderBucket &bucket, GeomNode *geom_node, value_type *value_type_ptr) { return __mesh_and_build(first, last, bucket, geom_node, value_type_ptr); } @@ -881,8 +881,8 @@ mesh_and_build(InputIterator first, InputIterator last, //////////////////////////////////////////////////////////////////// template OutputIterator split(InputIterator first, InputIterator last, - OutputIterator true_result, OutputIterator false_result, - Predicate pred) { + OutputIterator true_result, OutputIterator false_result, + Predicate pred) { while (first != last) { if (pred(*first)) { *true_result++ = *first++; diff --git a/panda/src/builder/builderFuncs.h b/panda/src/builder/builderFuncs.h index 31c3691ae2..5981a68070 100644 --- a/panda/src/builder/builderFuncs.h +++ b/panda/src/builder/builderFuncs.h @@ -47,7 +47,7 @@ expand(const PrimType &prim, BuilderBucket &bucket, template int mesh_and_build(InputIterator first, InputIterator last, - BuilderBucket &bucket, GeomNode *geom_node); + BuilderBucket &bucket, GeomNode *geom_node); @@ -58,8 +58,8 @@ mesh_and_build(InputIterator first, InputIterator last, //////////////////////////////////////////////////////////////////// template OutputIterator split(InputIterator first, InputIterator last, - OutputIterator true_result, OutputIterator false_result, - Predicate pred); + OutputIterator true_result, OutputIterator false_result, + Predicate pred); #include "builderFuncs.I" diff --git a/panda/src/builder/builderMisc.cxx b/panda/src/builder/builderMisc.cxx index 10e7c72ab2..8f9d9d0675 100644 --- a/panda/src/builder/builderMisc.cxx +++ b/panda/src/builder/builderMisc.cxx @@ -28,10 +28,10 @@ make_random_color(Colorf &color) { #ifdef WIN32_VC color.set(rgb[0], rgb[1], rgb[2], - 0.25 + 0.75 * (double)rand() / (double)RAND_MAX); + 0.25 + 0.75 * (double)rand() / (double)RAND_MAX); #else color.set(rgb[0], rgb[1], rgb[2], - 0.25 + 0.75 * (double)random() / (double)RAND_MAX); + 0.25 + 0.75 * (double)random() / (double)RAND_MAX); #endif } diff --git a/panda/src/builder/builderNormalVisualizer.h b/panda/src/builder/builderNormalVisualizer.h index 7ad1c1c5d1..d5d40ce543 100644 --- a/panda/src/builder/builderNormalVisualizer.h +++ b/panda/src/builder/builderNormalVisualizer.h @@ -20,7 +20,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : BuilderNormalVisualizer +// Class : BuilderNormalVisualizer // Description : A useful class for collecting information about // vertices and their associated normals as geometry is // built, so that its normals may be visualized via diff --git a/panda/src/builder/builderPrim.cxx b/panda/src/builder/builderPrim.cxx index dfdfc8b42e..83885d76c4 100644 --- a/panda/src/builder/builderPrim.cxx +++ b/panda/src/builder/builderPrim.cxx @@ -22,7 +22,7 @@ //////////////////////////////////////////////////////////////////// BuilderPrim &BuilderPrim:: nonindexed_copy(const BuilderPrimTempl ©, - const BuilderBucket &bucket) { + const BuilderBucket &bucket) { clear(); set_type(copy.get_type()); @@ -119,10 +119,10 @@ flatten_vertex_properties() { //////////////////////////////////////////////////////////////////// void BuilderPrim:: fill_geom(Geom *geom, const PTA_BuilderV &v_array, - GeomBindType n_attr, const PTA_BuilderN &n_array, - GeomBindType t_attr, const PTA_BuilderTC &t_array, - GeomBindType c_attr, const PTA_BuilderC &c_array, - const BuilderBucket &, int, int, int) { + GeomBindType n_attr, const PTA_BuilderN &n_array, + GeomBindType t_attr, const PTA_BuilderTC &t_array, + GeomBindType c_attr, const PTA_BuilderC &c_array, + const BuilderBucket &, int, int, int) { // WARNING! This is questionable practice. We have a // PTA_BuilderV etc.; since a BuilderV is just a proxy @@ -168,11 +168,11 @@ flatten_vertex_properties() { //////////////////////////////////////////////////////////////////// void BuilderPrimI:: fill_geom(Geom *geom, const PTA_ushort &v_array, - GeomBindType n_attr, PTA_ushort n_array, - GeomBindType t_attr, PTA_ushort t_array, - GeomBindType c_attr, PTA_ushort c_array, - const BuilderBucket &bucket, - int num_prims, int num_components, int num_verts) { + GeomBindType n_attr, PTA_ushort n_array, + GeomBindType t_attr, PTA_ushort t_array, + GeomBindType c_attr, PTA_ushort c_array, + const BuilderBucket &bucket, + int num_prims, int num_components, int num_verts) { PTA_Vertexf v_data = bucket.get_coords(); PTA_Normalf n_data = bucket.get_normals(); PTA_TexCoordf t_data = bucket.get_texcoords(); @@ -217,7 +217,7 @@ fill_geom(Geom *geom, const PTA_ushort &v_array, if (memcmp(v_array, t_array, sizeof(ushort) * t_len)==0) { t_array = v_array; } else if (t_len <= n_len && - memcmp(n_array, t_array, sizeof(ushort) * t_len)==0) { + memcmp(n_array, t_array, sizeof(ushort) * t_len)==0) { t_array = n_array; } } @@ -225,10 +225,10 @@ fill_geom(Geom *geom, const PTA_ushort &v_array, if (memcmp(v_array, c_array, sizeof(ushort) * c_len)==0) { c_array = v_array; } else if (c_len <= n_len && - memcmp(n_array, c_array, sizeof(ushort) * c_len)==0) { + memcmp(n_array, c_array, sizeof(ushort) * c_len)==0) { c_array = n_array; } else if (c_len <= t_len && - memcmp(t_array, c_array, sizeof(ushort) * c_len)==0) { + memcmp(t_array, c_array, sizeof(ushort) * c_len)==0) { c_array = t_array; } } diff --git a/panda/src/builder/builderPrim.h b/panda/src/builder/builderPrim.h index 048b45a028..9d86fc39c5 100644 --- a/panda/src/builder/builderPrim.h +++ b/panda/src/builder/builderPrim.h @@ -63,7 +63,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BuilderPrimTempl); ///////////////////////////////////////////////////////////////////// -// Class : BuilderPrim +// Class : BuilderPrim // Description : The basic class for passing nonindexed primitives // to the builder. See the comments at the the head of // this file, and in builder.h. @@ -78,21 +78,21 @@ public: INLINE BuilderPrim &operator = (const BuilderPrim ©); BuilderPrim &nonindexed_copy(const BuilderPrimTempl ©, - const BuilderBucket &bucket); + const BuilderBucket &bucket); void flatten_vertex_properties(); static void fill_geom(Geom *geom, const PTA_BuilderV &v_array, - GeomBindType n_attr, const PTA_BuilderN &n_array, - GeomBindType t_attr, const PTA_BuilderTC &t_array, - GeomBindType c_attr, const PTA_BuilderC &c_array, - const BuilderBucket &bucket, - int num_prims, int num_components, int num_verts); + GeomBindType n_attr, const PTA_BuilderN &n_array, + GeomBindType t_attr, const PTA_BuilderTC &t_array, + GeomBindType c_attr, const PTA_BuilderC &c_array, + const BuilderBucket &bucket, + int num_prims, int num_components, int num_verts); }; /////////////////////////////////////////////////////////////////// -// Class : BuilderPrimI +// Class : BuilderPrimI // Description : The basic class for passing indexed primitives // to the builder. // @@ -108,11 +108,11 @@ public: void flatten_vertex_properties(); static void fill_geom(Geom *geom, const PTA_ushort &v_array, - GeomBindType n_attr, PTA_ushort n_array, - GeomBindType t_attr, PTA_ushort t_array, - GeomBindType c_attr, PTA_ushort c_array, - const BuilderBucket &bucket, - int num_prims, int num_components, int num_verts); + GeomBindType n_attr, PTA_ushort n_array, + GeomBindType t_attr, PTA_ushort t_array, + GeomBindType c_attr, PTA_ushort c_array, + const BuilderBucket &bucket, + int num_prims, int num_components, int num_verts); }; #include "builderPrim.I" diff --git a/panda/src/builder/builderPrimTempl.I b/panda/src/builder/builderPrimTempl.I index 22ca0fc191..9188b214b5 100644 --- a/panda/src/builder/builderPrimTempl.I +++ b/panda/src/builder/builderPrimTempl.I @@ -869,13 +869,13 @@ update_overall_attrib() { has_vertex_normal = true; for (i = 1; i < num_verts; i++) { - Vertex &vertex = get_vertex(i); - has_vertex_normal = - (has_vertex_normal && vertex.has_normal()); - if (!vertex.has_normal() || - !(vertex.get_normal() == common_normal)) { - has_common_normal = false; - } + Vertex &vertex = get_vertex(i); + has_vertex_normal = + (has_vertex_normal && vertex.has_normal()); + if (!vertex.has_normal() || + !(vertex.get_normal() == common_normal)) { + has_common_normal = false; + } } } if (get_vertex(0).has_color()) { @@ -884,13 +884,13 @@ update_overall_attrib() { has_vertex_color = true; for (i = 1; i < num_verts; i++) { - Vertex &vertex = get_vertex(i); - has_vertex_color = - (has_vertex_color && vertex.has_color()); - if (!vertex.has_color() || - !(vertex.get_color() == common_color)) { - has_common_color = false; - } + Vertex &vertex = get_vertex(i); + has_vertex_color = + (has_vertex_color && vertex.has_color()); + if (!vertex.has_color() || + !(vertex.get_color() == common_color)) { + has_common_color = false; + } } } if (get_vertex(0).has_pixel_size()) { @@ -899,13 +899,13 @@ update_overall_attrib() { has_vertex_pixel_size = true; for (i = 1; i < num_verts; i++) { - Vertex &vertex = get_vertex(i); - has_vertex_pixel_size = - (has_vertex_pixel_size && vertex.has_pixel_size()); - if (!vertex.has_pixel_size() || - !(vertex.get_pixel_size() == common_pixel_size)) { - has_common_pixel_size = false; - } + Vertex &vertex = get_vertex(i); + has_vertex_pixel_size = + (has_vertex_pixel_size && vertex.has_pixel_size()); + if (!vertex.has_pixel_size() || + !(vertex.get_pixel_size() == common_pixel_size)) { + has_common_pixel_size = false; + } } } } @@ -917,13 +917,13 @@ update_overall_attrib() { has_component_normal = true; for (i = 1; i < num_components; i++) { - DAttrib &component = get_component(i); - has_component_normal = - (has_component_normal && component.has_normal()); - if (!component.has_normal() || - !(component.get_normal() == common_normal)) { - has_common_normal = false; - } + DAttrib &component = get_component(i); + has_component_normal = + (has_component_normal && component.has_normal()); + if (!component.has_normal() || + !(component.get_normal() == common_normal)) { + has_common_normal = false; + } } } if (!has_vertex_color && get_component(0).has_color()) { @@ -932,13 +932,13 @@ update_overall_attrib() { has_component_color = true; for (i = 1; i < num_components; i++) { - DAttrib &component = get_component(i); - has_component_color = - (has_component_color && component.has_color()); - if (!component.has_color() || - !(component.get_color() == common_color)) { - has_common_color = false; - } + DAttrib &component = get_component(i); + has_component_color = + (has_component_color && component.has_color()); + if (!component.has_color() || + !(component.get_color() == common_color)) { + has_common_color = false; + } } } if (!has_vertex_pixel_size && get_component(0).has_pixel_size()) { @@ -947,13 +947,13 @@ update_overall_attrib() { has_component_pixel_size = true; for (i = 1; i < num_components; i++) { - DAttrib &component = get_component(i); - has_component_pixel_size = - (has_component_pixel_size && component.has_pixel_size()); - if (!component.has_pixel_size() || - !(component.get_pixel_size() == common_pixel_size)) { - has_common_pixel_size = false; - } + DAttrib &component = get_component(i); + has_component_pixel_size = + (has_component_pixel_size && component.has_pixel_size()); + if (!component.has_pixel_size() || + !(component.get_pixel_size() == common_pixel_size)) { + has_common_pixel_size = false; + } } } } diff --git a/panda/src/builder/builderPrimTempl.h b/panda/src/builder/builderPrimTempl.h index 895cc2fe4d..b7c039a550 100644 --- a/panda/src/builder/builderPrimTempl.h +++ b/panda/src/builder/builderPrimTempl.h @@ -16,7 +16,7 @@ ///////////////////////////////////////////////////////////////////// -// Class : BuilderPrimTempl +// Class : BuilderPrimTempl // Description : The main body of BuilderPrim and BuilderPrimI. This // is a template class on vertex type, which must be // either BuilderVertex or BuilderVertexI; these classes @@ -133,7 +133,7 @@ protected: template INLINE ostream &operator << (ostream &out, - const BuilderPrimTempl &prim) { + const BuilderPrimTempl &prim) { return prim.output(out); } diff --git a/panda/src/builder/builderProperties.cxx b/panda/src/builder/builderProperties.cxx index ab5e4a1b6c..a1d5639eb2 100644 --- a/panda/src/builder/builderProperties.cxx +++ b/panda/src/builder/builderProperties.cxx @@ -69,7 +69,7 @@ output(ostream &out) const { } if (_retesselate_coplanar) { out << "Retesselate coplanar triangles when needed; threshold = " - << _coplanar_threshold << "\n"; + << _coplanar_threshold << "\n"; } } if (_subdivide_polys) { @@ -77,7 +77,7 @@ output(ostream &out) const { } if (_consider_fans) { out << "Look for possible triangle fans with max per-triangle angle of " - << _max_tfan_angle << " degrees.\n"; + << _max_tfan_angle << " degrees.\n"; if (_min_tfan_tris==0) { out << "Do not create tfans"; } else { diff --git a/panda/src/builder/builderVertex.h b/panda/src/builder/builderVertex.h index acd4fe2ac8..8912d5958c 100644 --- a/panda/src/builder/builderVertex.h +++ b/panda/src/builder/builderVertex.h @@ -48,7 +48,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BUILDERVERTEXTEMPL_BUILDER EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEGG, EXPTP_PANDAEGG, BUILDERVERTEXTEMPL_USHORT); ///////////////////////////////////////////////////////////////////// -// Class : BuilderVertex +// Class : BuilderVertex // Description : The basic class for passing nonindexed vertices to // the builder. See the comments at the the head of // this file, and in builder.h. @@ -79,7 +79,7 @@ public: ///////////////////////////////////////////////////////////////////// -// Class : BuilderVertexI +// Class : BuilderVertexI // Description : The basic class for passing indexed vertices to the // builder. See the comments at the the head of this // file, and in builder.h. diff --git a/panda/src/builder/builderVertexTempl.h b/panda/src/builder/builderVertexTempl.h index 8df09dba5c..1224e4d9c2 100644 --- a/panda/src/builder/builderVertexTempl.h +++ b/panda/src/builder/builderVertexTempl.h @@ -15,7 +15,7 @@ ///////////////////////////////////////////////////////////////////// -// Class : BuilderVertexTempl +// Class : BuilderVertexTempl // Description : The main body of BuilderVertex and BuilderVertexI. // This is a template class on each of the four // attribute types: vertex coordinates, normal, texture @@ -68,7 +68,7 @@ protected: template INLINE ostream &operator << (ostream &out, - const BuilderVertexTempl &vertex) { + const BuilderVertexTempl &vertex) { return vertex.output(out); } diff --git a/panda/src/builder/mesherEdge.I b/panda/src/builder/mesherEdge.I index 9a3745abdd..739c1d98c3 100644 --- a/panda/src/builder/mesherEdge.I +++ b/panda/src/builder/mesherEdge.I @@ -63,7 +63,7 @@ template INLINE float MesherEdge:: compute_length(const BuilderBucket &bucket) const { LVector3f v = ((const Vertexf &)_a->get_coord_value(bucket) - - (const Vertexf &)_b->get_coord_value(bucket)); + (const Vertexf &)_b->get_coord_value(bucket)); return length(v); } @@ -71,7 +71,7 @@ template INLINE Vertexf MesherEdge:: compute_box(const BuilderBucket &bucket) const { LVector3f v = ((const Vertexf &)_a->get_coord_value(bucket) - - (const Vertexf &)_b->get_coord_value(bucket)); + (const Vertexf &)_b->get_coord_value(bucket)); return Vertexf(fabs(v[0]), fabs(v[1]), fabs(v[2])); } @@ -136,11 +136,11 @@ output(ostream &out) const { if (_opposite!=NULL) { out << " opposite " - << _opposite->_strips.size() << " strips:"; + << _opposite->_strips.size() << " strips:"; for (si = _opposite->_strips.begin(); - si != _opposite->_strips.end(); - ++si) { + si != _opposite->_strips.end(); + ++si) { out << " " << (*si)->_index; } } diff --git a/panda/src/builder/mesherEdge.h b/panda/src/builder/mesherEdge.h index fd231caf5e..6a6719e174 100644 --- a/panda/src/builder/mesherEdge.h +++ b/panda/src/builder/mesherEdge.h @@ -55,7 +55,7 @@ public: template INLINE ostream &operator << (ostream &out, - const MesherEdge &edge) { + const MesherEdge &edge) { return edge.output(out); } diff --git a/panda/src/builder/mesherFanMaker.I b/panda/src/builder/mesherFanMaker.I index 1cf10057a5..7f84f06799 100644 --- a/panda/src/builder/mesherFanMaker.I +++ b/panda/src/builder/mesherFanMaker.I @@ -52,7 +52,7 @@ INLINE bool MesherFanMaker:: is_coplanar_with(const MesherFanMaker &other) const { return _planar && other._planar && _strips.front()->is_coplanar_with(*other._strips.front(), - _bucket->_coplanar_threshold); + _bucket->_coplanar_threshold); } template @@ -181,11 +181,11 @@ build() { for (++si, ++ei; si != _strips.end() && !found_seam; ++si, ++ei) { nassertr(ei != _edges.end(), 0); if ( !((*si)->_prims.front() == (*last_si)->_prims.front()) || - !(*si)->is_coplanar_with(*(*last_si), _bucket->_coplanar_threshold)) { - // Here's a seam. Break the fan here. - found_seam = true; - _edges.splice(_edges.begin(), _edges, ei, _edges.end()); - _strips.splice(_strips.begin(), _strips, si, _strips.end()); + !(*si)->is_coplanar_with(*(*last_si), _bucket->_coplanar_threshold)) { + // Here's a seam. Break the fan here. + found_seam = true; + _edges.splice(_edges.begin(), _edges, ei, _edges.end()); + _strips.splice(_strips.begin(), _strips, si, _strips.end()); } } @@ -200,11 +200,11 @@ build() { for (++si, ++ei; si != _strips.end(); ++si, ++ei) { nassertr(ei != _edges.end(), 0); if ( !((*si)->_prims.front() == (*last_si)->_prims.front()) || - !(*si)->is_coplanar_with(*(*last_si), _bucket->_coplanar_threshold)) { - // Here's the end of a run of matching pieces. - count += unroll(last_si, si, last_ei, ei); - last_si = si; - last_ei = ei; + !(*si)->is_coplanar_with(*(*last_si), _bucket->_coplanar_threshold)) { + // Here's the end of a run of matching pieces. + count += unroll(last_si, si, last_ei, ei); + last_si = si; + last_ei = ei; } } count += unroll(last_si, si, last_ei, ei); @@ -299,7 +299,7 @@ unroll(Strips::iterator strip_begin, Strips::iterator strip_end, vector::iterator ti; for (ti = tris.begin(); ti != tris.end(); ++ti) { - _mesher->add_prim(*ti); + _mesher->add_prim(*ti); } } } diff --git a/panda/src/builder/mesherFanMaker.h b/panda/src/builder/mesherFanMaker.h index 52f99a9427..d556e670cd 100644 --- a/panda/src/builder/mesherFanMaker.h +++ b/panda/src/builder/mesherFanMaker.h @@ -52,7 +52,7 @@ public: int build(); int unroll(Strips::iterator strip_begin, Strips::iterator strip_end, - Edges::iterator edge_begin, Edges::iterator edge_end); + Edges::iterator edge_begin, Edges::iterator edge_end); ostream &output(ostream &out) const; diff --git a/panda/src/builder/mesherStrip.I b/panda/src/builder/mesherStrip.I index 6912bf4bc4..a90e521f1e 100644 --- a/panda/src/builder/mesherStrip.I +++ b/panda/src/builder/mesherStrip.I @@ -271,17 +271,17 @@ make_prim(const BuilderBucket &bucket) { pi = _prims.begin(); int count = 0; for (vi = _verts.begin(); - vi != _verts.end() && pi != _prims.end(); - ++vi) { + vi != _verts.end() && pi != _prims.end(); + ++vi) { const Vertex *v = *vi; nassertr(v != (Vertex *)NULL, p); if (++count >= 3) { - // Beginning with the third vertex, we increment pi. Thus, the - // first two vertices stand alone, then each vertex beginning - // with the third completes a triangle. - p.add_component(*pi); - ++pi; + // Beginning with the third vertex, we increment pi. Thus, the + // first two vertices stand alone, then each vertex beginning + // with the third completes a triangle. + p.add_component(*pi); + ++pi; } p.add_vertex(*v); } @@ -305,7 +305,7 @@ make_prim(const BuilderBucket &bucket) { template void MesherStrip:: measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows, - int first_row_id, int this_row_id, int this_row_distance) { + int first_row_id, int this_row_id, int this_row_distance) { if (new_row) { // If we would create a new row by stepping here, we won't stay if // there was any other row already defined here. @@ -367,36 +367,36 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows, int want_count; if (secondary) { - want_count = new_row ? 0 : 1; + want_count = new_row ? 0 : 1; } else { - want_count = new_row ? 1 : 0; + want_count = new_row ? 1 : 0; } for (ei = _edges.begin(); ei != _edges.end(); ++ei) { - int common_verts = - ((*ei)->_a == a || (*ei)->_a == b) + - ((*ei)->_b == a || (*ei)->_b == b); - - if (common_verts == want_count) { - // Here's the edge. Look at all its connections. Hopefully, - // there will only be one besides ourselves, but there may be - // more. Pick the best. - - Edge::Strips &strips = (*ei)->_strips; - MesherStrip *mate = NULL; - for (si = strips.begin(); si != strips.end(); ++si) { - if ((*si)->_row_id < first_row_id) { - if (mate==NULL || pick_sheet_mate(**si, *mate)) { - mate = *si; - } - } - } - if (mate!=NULL) { - mate->measure_sheet(*ei, secondary, num_prims, num_rows, - first_row_id, this_row_id, - this_row_distance + secondary); - } - } + int common_verts = + ((*ei)->_a == a || (*ei)->_a == b) + + ((*ei)->_b == a || (*ei)->_b == b); + + if (common_verts == want_count) { + // Here's the edge. Look at all its connections. Hopefully, + // there will only be one besides ourselves, but there may be + // more. Pick the best. + + Edge::Strips &strips = (*ei)->_strips; + MesherStrip *mate = NULL; + for (si = strips.begin(); si != strips.end(); ++si) { + if ((*si)->_row_id < first_row_id) { + if (mate==NULL || pick_sheet_mate(**si, *mate)) { + mate = *si; + } + } + } + if (mate!=NULL) { + mate->measure_sheet(*ei, secondary, num_prims, num_rows, + first_row_id, this_row_id, + this_row_distance + secondary); + } + } } } @@ -413,21 +413,21 @@ measure_sheet(const Edge *edge, int new_row, int &num_prims, int &num_rows, for (ei = _edges.begin(); ei != _edges.end(); ++ei) { if (!(*ei)->matches(*edge)) { - // Here's the edge. Same drill as above. - - Edge::Strips &strips = (*ei)->_strips; - MesherStrip *mate = NULL; - for (si = strips.begin(); si != strips.end(); ++si) { - if ((*si)->_row_id < first_row_id) { - if (mate==NULL || pick_sheet_mate(**si, *mate)) { - mate = *si; - } - } - } - if (mate!=NULL) { - mate->measure_sheet(*ei, false, num_prims, num_rows, - first_row_id, this_row_id, this_row_distance); - } + // Here's the edge. Same drill as above. + + Edge::Strips &strips = (*ei)->_strips; + MesherStrip *mate = NULL; + for (si = strips.begin(); si != strips.end(); ++si) { + if ((*si)->_row_id < first_row_id) { + if (mate==NULL || pick_sheet_mate(**si, *mate)) { + mate = *si; + } + } + } + if (mate!=NULL) { + mate->measure_sheet(*ei, false, num_prims, num_rows, + first_row_id, this_row_id, this_row_distance); + } } } } @@ -460,8 +460,8 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) { Edge::Strips &strips = (*ei)->_strips; for (si = strips.begin(); si != strips.end(); ++si) { if ((*si)->_row_id > _row_id) { - // Here's a different row in the sheet! - strip_ptrs.push_back(*si); + // Here's a different row in the sheet! + strip_ptrs.push_back(*si); } } } @@ -485,37 +485,37 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) { ei = _edges.begin(); while (ei != _edges.end() && not_any) { - Edge::Strips &strips = (*ei)->_strips; - si = strips.begin(); - while (si != strips.end() && not_any) { - if (*si != this && (*si)->_row_id == _row_id) { - // Here's one! - not_any = false; - MesherStrip *mate = *si; + Edge::Strips &strips = (*ei)->_strips; + si = strips.begin(); + while (si != strips.end() && not_any) { + if (*si != this && (*si)->_row_id == _row_id) { + // Here's one! + not_any = false; + MesherStrip *mate = *si; - // We also recurse on these guys so they can spread the - // word to their own neighbors. This time we don't need - // to build a temporary list, because we'll be restarting - // from the beginning of our edge list after we do this. - // We also pass do_mate = false to these guys because - // we're the ones doing the mating here. - mate->cut_sheet(first_row_id, false, bucket); + // We also recurse on these guys so they can spread the + // word to their own neighbors. This time we don't need + // to build a temporary list, because we'll be restarting + // from the beginning of our edge list after we do this. + // We also pass do_mate = false to these guys because + // we're the ones doing the mating here. + mate->cut_sheet(first_row_id, false, bucket); - if (_status == MS_alive && mate->_status == MS_alive) { - // Now mate. This will either succeed or fail. It ought - // to succeed, but if it doesn't, no harm done; it will - // simply remove the common edge and return. We'll go - // around again and not encounter this neighbor next time. - mate_pieces(*ei, *this, *mate, bucket); - } - } - if (not_any) { - ++si; - } - } - if (not_any) { - ++ei; - } + if (_status == MS_alive && mate->_status == MS_alive) { + // Now mate. This will either succeed or fail. It ought + // to succeed, but if it doesn't, no harm done; it will + // simply remove the common edge and return. We'll go + // around again and not encounter this neighbor next time. + mate_pieces(*ei, *this, *mate, bucket); + } + } + if (not_any) { + ++si; + } + } + if (not_any) { + ++ei; + } } } while (!not_any); @@ -523,7 +523,7 @@ cut_sheet(int first_row_id, int do_mate, const BuilderBucket &bucket) { _row_id = -first_row_id; } } - + @@ -572,7 +572,7 @@ mate(const BuilderBucket &bucket) { template bool MesherStrip:: find_ideal_mate(MesherStrip *&mate, Edge *&common_edge, - const BuilderBucket &bucket) { + const BuilderBucket &bucket) { Edges::iterator ei; mate = NULL; @@ -583,11 +583,11 @@ find_ideal_mate(MesherStrip *&mate, Edge *&common_edge, Edge::Strips::iterator si; for (si = strips.begin(); si != strips.end(); ++si) { if (*si != this) { - if (mate==NULL || pick_mate(**si, *mate, **ei, *common_edge, - bucket)) { - mate = *si; - common_edge = *ei; - } + if (mate==NULL || pick_mate(**si, *mate, **ei, *common_edge, + bucket)) { + mate = *si; + common_edge = *ei; + } } } } @@ -607,7 +607,7 @@ find_ideal_mate(MesherStrip *&mate, Edge *&common_edge, template bool MesherStrip:: mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, - const BuilderBucket &bucket) { + const BuilderBucket &bucket) { nassertr(front._status == MS_alive, false); nassertr(back._status == MS_alive, false); nassertr(&front != &back, false); @@ -622,8 +622,8 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, if (front._type==BPT_tri && back._type==BPT_tri) { if (is_coplanar && bucket._retesselate_coplanar && - front._prims.front() == back._prims.front() && - convex_quad(common_edge, front, back, bucket)) { + front._prims.front() == back._prims.front() && + convex_quad(common_edge, front, back, bucket)) { // If we're joining two equivalent coplanar triangles, call it a // quad. @@ -641,17 +641,17 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, ++b; if (common_edge->contains_vertex(*a)) { - if (common_edge->contains_vertex(*b)) { - // It goes between a and b. - front._verts.insert(b, new_vert); - } else { - // It goes at the end. - front._verts.push_back(new_vert); - } + if (common_edge->contains_vertex(*b)) { + // It goes between a and b. + front._verts.insert(b, new_vert); + } else { + // It goes at the end. + front._verts.push_back(new_vert); + } } else { - // It goes between b and c. - ++b; - front._verts.insert(b, new_vert); + // It goes between b and c. + ++b; + front._verts.insert(b, new_vert); } front._prims.splice(front._prims.end(), back._prims); @@ -674,7 +674,7 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, } } else if ((front._type==BPT_quad || front._type==BPT_quadstrip) && - (back._type==BPT_quad || back._type==BPT_quadstrip)) { + (back._type==BPT_quad || back._type==BPT_quadstrip)) { // Joining two quads, two quadstrips, or a quad and a quadstrip. // This makes another quadstrip. @@ -708,14 +708,14 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, success = mate_strips(common_edge, back, front, BPT_tristrip); if (success) { - // Yay! Now return all the stuff to front. - front._verts.splice(front._verts.end(), back._verts); - front._prims.splice(front._prims.end(), back._prims); + // Yay! Now return all the stuff to front. + front._verts.splice(front._verts.end(), back._verts); + front._prims.splice(front._prims.end(), back._prims); } else { - // A miserable failure. Never try to join these two again. + // A miserable failure. Never try to join these two again. - common_edge->remove(&front); - common_edge->remove(&back); + common_edge->remove(&front); + common_edge->remove(&back); } } } @@ -760,7 +760,7 @@ mate_pieces(Edge *common_edge, MesherStrip &front, MesherStrip &back, template bool MesherStrip:: mate_strips(Edge *common_edge, MesherStrip &front, MesherStrip &back, - BuilderPrimType type) { + BuilderPrimType type) { // If we start with a quad or tri, rotate the vertices around so we // start with the common edge. if (front._type==BPT_tri || front._type==BPT_quad) { @@ -837,11 +837,11 @@ mate_strips(Edge *common_edge, MesherStrip &front, MesherStrip &back, if (! (front.get_tail_edge() == back.get_head_edge()) ) { builder_cat.error() << "\nFailure, trying to connect " << front - << "\nto " << back - << "\nreverse_front = " << reverse_front - << " reverse_back = " << reverse_back - << " invert_front = " << invert_front - << "\n"; + << "\nto " << back + << "\nreverse_front = " << reverse_front + << " reverse_back = " << reverse_back + << " invert_front = " << invert_front + << "\n"; Edges::iterator ei; nout << "\nFront edges:\n"; @@ -880,7 +880,7 @@ mate_strips(Edge *common_edge, MesherStrip &front, MesherStrip &back, template bool MesherStrip:: must_invert(const MesherStrip &front, const MesherStrip &back, - bool will_reverse_back, BuilderPrimType type) { + bool will_reverse_back, BuilderPrimType type) { bool invert = false; if ((front._type == BPT_quad || front._type == BPT_quadstrip) && @@ -917,7 +917,7 @@ must_invert(const MesherStrip &front, const MesherStrip &back, template bool MesherStrip:: convex_quad(Edge *common_edge, MesherStrip &front, MesherStrip &back, - const BuilderBucket &bucket) { + const BuilderBucket &bucket) { // Find the edge from the apex of one triangle to the apex of the // other. This is the "other" diagonal of the quad-to-be, other // than the common_edge. @@ -1018,8 +1018,8 @@ show_neighbors(ostream &out) const { for (ei = _edges.begin(); ei != _edges.end(); ++ei) { for (si = (*ei)->_strips.begin(); - si != (*ei)->_strips.end(); - ++si) { + si != (*ei)->_strips.end(); + ++si) { out << " " << (*si)->_index; } } @@ -1353,21 +1353,21 @@ convert_to_type(BuilderPrimType wantType) { vi = _verts.begin(); even = 0; while (vi != _verts.end()) { - vi2 = vi; - ++vi2; - nassertv(vi2 != _verts.end()); + vi2 = vi; + ++vi2; + nassertv(vi2 != _verts.end()); - // vi and vi2 are a pair. Should we reverse them? - if (even) { - const Vertex *t = *vi2; - *vi2 = *vi; - *vi = t; - } - - // Increment - vi = vi2; - ++vi; - even = !even; + // vi and vi2 are a pair. Should we reverse them? + if (even) { + const Vertex *t = *vi2; + *vi2 = *vi; + *vi = t; + } + + // Increment + vi = vi2; + ++vi; + even = !even; } break; @@ -1434,10 +1434,10 @@ combine_edges(MesherStrip &other, int removeSides) { // Is this edge to be saved or is it fodder? if (!(**ei == head) && !(**ei == tail)) { - // Fodder! But we can't remove it right away, because this - // will upset the current list; instead, we'll splice it to - // junk_edges. - junk_edges.splice(junk_edges.end(), _edges, ei); + // Fodder! But we can't remove it right away, because this + // will upset the current list; instead, we'll splice it to + // junk_edges. + junk_edges.splice(junk_edges.end(), _edges, ei); } ei = next_ei; } @@ -1483,8 +1483,8 @@ remove_all_edges() { template bool MesherStrip:: pick_mate(const MesherStrip &a_strip, const MesherStrip &b_strip, - const Edge &a_edge, const Edge &b_edge, - const BuilderBucket &bucket) const { + const Edge &a_edge, const Edge &b_edge, + const BuilderBucket &bucket) const { // First, try to avoid polluting quads, quadstrips, and tristrips // with arbitrary triangles. When we mate a tri or tristrip to a // quadstrip, we end up with a tristrip that may be less versatile diff --git a/panda/src/builder/mesherStrip.h b/panda/src/builder/mesherStrip.h index 61b50ed8c2..ef7d8de3e4 100644 --- a/panda/src/builder/mesherStrip.h +++ b/panda/src/builder/mesherStrip.h @@ -45,23 +45,23 @@ public: Prim make_prim(const BuilderBucket &bucket); void measure_sheet(const Edge *edge, int new_row, - int &num_prims, int &num_rows, - int first_row_id, int this_row_id, - int this_row_distance); + int &num_prims, int &num_rows, + int first_row_id, int this_row_id, + int this_row_distance); void cut_sheet(int first_row_id, int do_mate, - const BuilderBucket &bucket); + const BuilderBucket &bucket); bool mate(const BuilderBucket &bucket); bool find_ideal_mate(MesherStrip *&mate, Edge *&common_edge, - const BuilderBucket &bucket); + const BuilderBucket &bucket); static bool mate_pieces(Edge *common_edge, MesherStrip &front, - MesherStrip &back, const BuilderBucket &bucket); + MesherStrip &back, const BuilderBucket &bucket); static bool mate_strips(Edge *common_edge, MesherStrip &front, - MesherStrip &back, BuilderPrimType type); + MesherStrip &back, BuilderPrimType type); static bool must_invert(const MesherStrip &front, const MesherStrip &back, - bool will_reverse_back, BuilderPrimType type); + bool will_reverse_back, BuilderPrimType type); static bool convex_quad(Edge *common_edge, MesherStrip &front, - MesherStrip &back, const BuilderBucket &bucket); + MesherStrip &back, const BuilderBucket &bucket); int count_neighbors() const; ostream &show_neighbors(ostream &out) const; @@ -97,11 +97,11 @@ public: INLINE bool operator != (const MesherStrip &other) const; bool pick_mate(const MesherStrip &a_strip, const MesherStrip &b_strip, - const Edge &a_edge, const Edge &b_edge, - const BuilderBucket &bucket) const; + const Edge &a_edge, const Edge &b_edge, + const BuilderBucket &bucket) const; bool pick_sheet_mate(const MesherStrip &a_strip, - const MesherStrip &b_strip) const; + const MesherStrip &b_strip) const; ostream &output(ostream &out) const; @@ -126,7 +126,7 @@ public: template INLINE ostream &operator << (ostream &out, - const MesherStrip &strip) { + const MesherStrip &strip) { return strip.output(out); } diff --git a/panda/src/builder/mesherTempl.I b/panda/src/builder/mesherTempl.I index 867ed7e15a..c71f7c8fc3 100644 --- a/panda/src/builder/mesherTempl.I +++ b/panda/src/builder/mesherTempl.I @@ -107,12 +107,12 @@ mesh() { Strips::iterator si; for (si = _quads.begin(); si != _quads.end(); ++si) { if ((*si)._status == MS_alive) { - (*si)._status = MS_done; + (*si)._status = MS_done; } } for (si = _strips.begin(); si != _strips.end(); ++si) { if ((*si)._status == MS_alive) { - (*si)._status = MS_done; + (*si)._status = MS_done; } } } @@ -185,7 +185,7 @@ getPrim() { if (num_components > 0) { prim.get_component(0).set_color_value(&_colors[0], i1); for (int i = 1; i < num_components; i++) { - prim.get_component(i).set_color_value(&_colors[0], i2); + prim.get_component(i).set_color_value(&_colors[0], i2); } } else { prim.set_color_value(&_colors[0], i1); @@ -208,13 +208,13 @@ getPrim() { ColorSheetMap::iterator ci = _color_sheets.find(strip._row_id); if (ci == _color_sheets.end()) { - Colorf color1; - make_random_color(color1); - i1 = _colors.size(); - _colors.push_back(color1); - _color_sheets[strip._row_id] = i1; + Colorf color1; + make_random_color(color1); + i1 = _colors.size(); + _colors.push_back(color1); + _color_sheets[strip._row_id] = i1; } else { - i1 = (*ci).second; + i1 = (*ci).second; } } @@ -257,41 +257,41 @@ getPrim() { } else { switch (orig_type) { case BPT_quad: - i1 = 2; - break; + i1 = 2; + break; case BPT_quadstrip: - i1 = 3; - break; + i1 = 3; + break; case BPT_tristrip: - make_random_color(color1); - // Make it a shade of red. - if (color1[0] < color1[1]) { - float t = color1[0]; - color1[0] = color1[1]; - color1[1] = t; - } - color1[2] = color1[1]; - i1 = _colors.size(); - _colors.push_back(color1); - break; - + make_random_color(color1); + // Make it a shade of red. + if (color1[0] < color1[1]) { + float t = color1[0]; + color1[0] = color1[1]; + color1[1] = t; + } + color1[2] = color1[1]; + i1 = _colors.size(); + _colors.push_back(color1); + break; + case BPT_trifan: - make_random_color(color1); - // Make it a shade of green. - if (color1[0] > color1[1]) { - float t = color1[0]; - color1[0] = color1[1]; - color1[1] = t; - } - color1[2] = color1[0]; - i1 = _colors.size(); - _colors.push_back(color1); - break; + make_random_color(color1); + // Make it a shade of green. + if (color1[0] > color1[1]) { + float t = color1[0]; + color1[0] = color1[1]; + color1[1] = t; + } + color1[2] = color1[0]; + i1 = _colors.size(); + _colors.push_back(color1); + break; default: - i1 = 0; + i1 = 0; } } @@ -343,7 +343,7 @@ show(ostream &out) { EdgePtrs::const_iterator ei; for (ei = edges.begin(); ei != edges.end(); ++ei) { if (!(*ei)->_strips.empty() || !(*ei)->_opposite->_strips.empty()) { - out << " " << **ei << "\n"; + out << " " << **ei << "\n"; } } } @@ -419,8 +419,8 @@ build_sheets() { // this quad. Leave it alone. We also need to leave it be if it // has no available edges. if ((*best)._row_id >= 0 && - (*best)._status == MS_alive && - !(*best)._edges.empty()) { + (*best)._status == MS_alive && + !(*best)._edges.empty()) { // There are two possible sheets we could make from this quad, // in two different orientations. Measure them both and figure // out which one is best. @@ -432,7 +432,7 @@ build_sheets() { int num_rows_a = 0; int first_row_id_a = first_row_id; (*best).measure_sheet(edge_a, true, num_prims_a, num_rows_a, - first_row_id_a, 0, 0); + first_row_id_a, 0, 0); first_row_id += num_rows_a; double avg_length_a = (double)num_prims_a / (double)num_rows_a; @@ -441,32 +441,32 @@ build_sheets() { int first_row_id_b = first_row_id; double avg_length_b; if (edge_b != NULL) { - (*best).measure_sheet(edge_b, true, num_prims_b, num_rows_b, - first_row_id_b, 0, 0); - first_row_id += num_rows_b; - avg_length_b = (double)num_prims_b / (double)num_rows_b; + (*best).measure_sheet(edge_b, true, num_prims_b, num_rows_b, + first_row_id_b, 0, 0); + first_row_id += num_rows_b; + avg_length_b = (double)num_prims_b / (double)num_rows_b; } // Which sheet is better? if (edge_b != NULL && avg_length_b >= avg_length_a) { - // Sheet b. That's easy. - (*best).cut_sheet(first_row_id_b, true, *_bucket); + // Sheet b. That's easy. + (*best).cut_sheet(first_row_id_b, true, *_bucket); } else { - // Nope, sheet a is better. This is a bit of a nuisance - // because we've unfortunately wiped out the information we - // stored when we measured sheet a. We'll have to do it - // again. + // Nope, sheet a is better. This is a bit of a nuisance + // because we've unfortunately wiped out the information we + // stored when we measured sheet a. We'll have to do it + // again. - num_prims_a = 0; - num_rows_a = 0; - first_row_id_a = first_row_id; - (*best).measure_sheet(edge_a, true, num_prims_a, num_rows_a, - first_row_id_a, 0, 0); - first_row_id += num_rows_a; + num_prims_a = 0; + num_rows_a = 0; + first_row_id_a = first_row_id; + (*best).measure_sheet(edge_a, true, num_prims_a, num_rows_a, + first_row_id_a, 0, 0); + first_row_id += num_rows_a; - // Now we can cut it. - (*best).cut_sheet(first_row_id_a, true, *_bucket); + // Now we can cut it. + (*best).cut_sheet(first_row_id_a, true, *_bucket); } } @@ -507,43 +507,43 @@ find_fans() { EdgePtrs::iterator ei; Edge::Strips::iterator si; for (ei = edges.begin(); ei != edges.end(); ++ei) { - for (si = (*ei)->_strips.begin(); - si != (*ei)->_strips.end(); - ++si) { - Strip *strip = *si; - if (strip->_type == BPT_tri) { - fans.push_back(FanMaker(&v, strip, this)); - } - } + for (si = (*ei)->_strips.begin(); + si != (*ei)->_strips.end(); + ++si) { + Strip *strip = *si; + if (strip->_type == BPT_tri) { + fans.push_back(FanMaker(&v, strip, this)); + } + } } // Sort the fans list by edge pointers, and remove duplicates. sort(fans.begin(), fans.end()); fans.erase(unique(fans.begin(), fans.end()), - fans.end()); + fans.end()); FanMakers::iterator fi, fi2; // Now pull out connected edges. int joined_any; do { - joined_any = false; - for (fi = fans.begin(); fi != fans.end(); ++fi) { - if (!(*fi).is_empty()) { - fi2 = fi; - for (++fi2; fi2 != fans.end(); ++fi2) { - if (!(*fi2).is_empty()) { - joined_any = (*fi).join(*fi2); - } - } - } - } + joined_any = false; + for (fi = fans.begin(); fi != fans.end(); ++fi) { + if (!(*fi).is_empty()) { + fi2 = fi; + for (++fi2; fi2 != fans.end(); ++fi2) { + if (!(*fi2).is_empty()) { + joined_any = (*fi).join(*fi2); + } + } + } + } } while (joined_any); for (fi = fans.begin(); fi != fans.end(); ++fi) { - if ((*fi).is_valid()) { - (*fi).build(); - } + if ((*fi).is_valid()) { + (*fi).build(); + } } } } @@ -588,16 +588,16 @@ make_quads() { if (tri->_status == MS_alive) { if (tri->find_ideal_mate(mate, common_edge, *_bucket)) { - // Does our chosen mate want us too? - if (mate->_type == BPT_tri && mate->_status == MS_alive && - mate->find_ideal_mate(mate2, common_edge2, *_bucket) && - mate2 == tri) { - // Hooray! - soulmates.push_back(Matched(Pair(tri, mate), common_edge)); - // We'll temporarily mark the two tris as paired. - tri->_status = MS_paired; - mate->_status = MS_paired; - } + // Does our chosen mate want us too? + if (mate->_type == BPT_tri && mate->_status == MS_alive && + mate->find_ideal_mate(mate2, common_edge2, *_bucket) && + mate2 == tri) { + // Hooray! + soulmates.push_back(Matched(Pair(tri, mate), common_edge)); + // We'll temporarily mark the two tris as paired. + tri->_status = MS_paired; + mate->_status = MS_paired; + } } } } diff --git a/panda/src/builder/test_builder.cxx b/panda/src/builder/test_builder.cxx index 3cd9723e55..deed368049 100644 --- a/panda/src/builder/test_builder.cxx +++ b/panda/src/builder/test_builder.cxx @@ -43,7 +43,7 @@ reached_node(Node *node, const NullAttributeWrapper &, NullLevelState &) { if (node->is_of_type(GeomNode::get_class_type())) { GeomNode *geomNode = (GeomNode *)node; nout << "\n" << *geomNode << ", " << geomNode->get_num_geoms() - << " geoms:\n"; + << " geoms:\n"; int num_geoms = geomNode->get_num_geoms(); for (int i = 0; i < num_geoms; i++) { dDrawable *draw = geomNode->get_geom(i); @@ -99,7 +99,7 @@ main(void) { nout << "\nTraversing root:\n"; df_traverse(root, rg, NullAttributeWrapper(), NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); #else Builder builder; @@ -167,17 +167,17 @@ main(void) { p = y*xi + x; BuilderVertexI bv0(p), bv1(p+1), bv4(p+xi), bv5(p+xi+1); if (p==0) { - builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(1)); - builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(1)); + builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(1)); + builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(1)); } else if (p==5) { - builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(1)); - builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(1)); + builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(1)); + builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(1)); } else if (p==1 || p==4) { - builder.add_prim(BuilderPrimI(bv0, bv1, bv4).set_color(1)); - builder.add_prim(BuilderPrimI(bv1, bv5, bv4).set_color(1)); + builder.add_prim(BuilderPrimI(bv0, bv1, bv4).set_color(1)); + builder.add_prim(BuilderPrimI(bv1, bv5, bv4).set_color(1)); } else { - builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(0)); - builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(0)); + builder.add_prim(BuilderPrimI(bv0, bv5, bv4).set_color(0)); + builder.add_prim(BuilderPrimI(bv1, bv5, bv0).set_color(0)); } } diff --git a/panda/src/chan/animBundle.h b/panda/src/chan/animBundle.h index ef5b9a3487..367e59101c 100644 --- a/panda/src/chan/animBundle.h +++ b/panda/src/chan/animBundle.h @@ -54,7 +54,7 @@ public: static void init_type() { AnimGroup::init_type(); register_type(_type_handle, "AnimBundle", - AnimGroup::get_class_type()); + AnimGroup::get_class_type()); } private: diff --git a/panda/src/chan/animBundleNode.h b/panda/src/chan/animBundleNode.h index 2e69ca05ff..84247a3526 100644 --- a/panda/src/chan/animBundleNode.h +++ b/panda/src/chan/animBundleNode.h @@ -36,7 +36,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_AnimBundleNode(const FactoryParams ¶ms); @@ -56,7 +56,7 @@ public: static void init_type() { NamedNode::init_type(); register_type(_type_handle, "AnimBundleNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } private: diff --git a/panda/src/chan/animChannel.cxx b/panda/src/chan/animChannel.cxx index dd15bbe0a0..1d9259ee3c 100644 --- a/panda/src/chan/animChannel.cxx +++ b/panda/src/chan/animChannel.cxx @@ -23,10 +23,10 @@ output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) { if (decompose_matrix(value, scale, hpr, translate)) { if (!scale.almost_equal(LVecBase3f(1.0, 1.0, 1.0))) { if (IS_NEARLY_EQUAL(scale[0], scale[1]) && - IS_NEARLY_EQUAL(scale[1], scale[2])) { - out << " scale " << scale[0]; + IS_NEARLY_EQUAL(scale[1], scale[2])) { + out << " scale " << scale[0]; } else { - out << " scale " << scale; + out << " scale " << scale; } } diff --git a/panda/src/chan/animChannel.h b/panda/src/chan/animChannel.h index a6bb223c6e..9f84aa91bd 100644 --- a/panda/src/chan/animChannel.h +++ b/panda/src/chan/animChannel.h @@ -56,7 +56,7 @@ public: static void init_type() { AnimChannelBase::init_type(); register_type(_type_handle, SwitchType::get_channel_type_name(), - AnimChannelBase::get_class_type()); + AnimChannelBase::get_class_type()); } private: diff --git a/panda/src/chan/animChannelBase.h b/panda/src/chan/animChannelBase.h index 6a269eb6e9..0842222b03 100644 --- a/panda/src/chan/animChannelBase.h +++ b/panda/src/chan/animChannelBase.h @@ -59,7 +59,7 @@ public: static void init_type() { AnimGroup::init_type(); register_type(_type_handle, "AnimChannelBase", - AnimGroup::get_class_type()); + AnimGroup::get_class_type()); } private: diff --git a/panda/src/chan/animChannelFixed.I b/panda/src/chan/animChannelFixed.I index 334e3c933a..421132310a 100644 --- a/panda/src/chan/animChannelFixed.I +++ b/panda/src/chan/animChannelFixed.I @@ -15,7 +15,7 @@ TypeHandle AnimChannelFixed::_type_handle; template INLINE AnimChannelFixed:: AnimChannelFixed(AnimGroup *parent, const string &name, - const ValueType &value) + const ValueType &value) : AnimChannel(parent, name), _value(value) { } diff --git a/panda/src/chan/animChannelFixed.h b/panda/src/chan/animChannelFixed.h index 08eada42c8..7cf69e5f7e 100644 --- a/panda/src/chan/animChannelFixed.h +++ b/panda/src/chan/animChannelFixed.h @@ -44,7 +44,7 @@ public: static void init_type() { AnimChannel::init_type(); register_type(_type_handle, SwitchType::get_fixed_channel_type_name(), - AnimChannel::get_class_type()); + AnimChannel::get_class_type()); } private: diff --git a/panda/src/chan/animChannelMatrixXfmTable.cxx b/panda/src/chan/animChannelMatrixXfmTable.cxx index 846d454e06..123dd45b53 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.cxx +++ b/panda/src/chan/animChannelMatrixXfmTable.cxx @@ -55,8 +55,8 @@ has_changed(int last_frame, int this_frame) { for (int i = 0; i < num_tables; i++) { if (_tables[i].size() > 1) { if (_tables[i][last_frame % _tables[i].size()] != - _tables[i][this_frame % _tables[i].size()]) { - return true; + _tables[i][this_frame % _tables[i].size()]) { + return true; } } } @@ -239,7 +239,7 @@ write_datagram(BamWriter *manager, Datagram &me) for(int i = 0; i < num_tables; i++) { me.add_uint16(_tables[i].size()); for(int j = 0; j < (int)_tables[i].size(); j++) { - me.add_float32(_tables[i][j]); + me.add_float32(_tables[i][j]); } } @@ -298,7 +298,7 @@ fillin(DatagramIterator& scan, BamReader* manager) int size = scan.get_uint16(); PTA_float ind_table; for(int j = 0; j < size; j++) { - ind_table.push_back(scan.get_float32()); + ind_table.push_back(scan.get_float32()); } _tables[i] = ind_table; } @@ -307,14 +307,14 @@ fillin(DatagramIterator& scan, BamReader* manager) // Compressed channels. if (manager->get_file_minor_ver() < 1) { chan_cat.error() - << "Cannot read old-style quantized channels.\n"; + << "Cannot read old-style quantized channels.\n"; clear_all_tables(); return; } if (!read_compressed_channels) { chan_cat.info() - << "Not reading compressed animation channels.\n"; + << "Not reading compressed animation channels.\n"; clear_all_tables(); return; } diff --git a/panda/src/chan/animChannelMatrixXfmTable.h b/panda/src/chan/animChannelMatrixXfmTable.h index a593c61411..ff0cd74249 100644 --- a/panda/src/chan/animChannelMatrixXfmTable.h +++ b/panda/src/chan/animChannelMatrixXfmTable.h @@ -74,7 +74,7 @@ public: static void init_type() { AnimChannelMatrix::init_type(); register_type(_type_handle, "AnimChannelMatrixXfmTable", - AnimChannelMatrix::get_class_type()); + AnimChannelMatrix::get_class_type()); } private: diff --git a/panda/src/chan/animChannelScalarTable.cxx b/panda/src/chan/animChannelScalarTable.cxx index 923dbc9ecf..96e212145e 100644 --- a/panda/src/chan/animChannelScalarTable.cxx +++ b/panda/src/chan/animChannelScalarTable.cxx @@ -47,7 +47,7 @@ bool AnimChannelScalarTable:: has_changed(int last_frame, int this_frame) { if (_table.size() > 1) { if (_table[last_frame % _table.size()] != - _table[this_frame % _table.size()]) { + _table[this_frame % _table.size()]) { return true; } } @@ -147,8 +147,8 @@ write_datagram(BamWriter *manager, Datagram &me) map index; int i; for (i = 0; - i < (int)_table.size() && (int)index.size() <= max_values; - i++) { + i < (int)_table.size() && (int)index.size() <= max_values; + i++) { int value = (int)floor(_table[i] * scale + 0.5); index.insert(map::value_type(value, index.size())); } @@ -160,48 +160,48 @@ write_datagram(BamWriter *manager, Datagram &me) me.add_uint8(index_length); if (index_length > 0) { - // We need to write the index in order by its index number; for - // this, we need to invert the index. - vector_float reverse_index(index_length); - map::iterator mi; - for (mi = index.begin(); mi != index.end(); ++mi) { - float f = (float)(*mi).first / scale; - int i = (*mi).second; - nassertv(i >= 0 && i < (int)reverse_index.size()); - reverse_index[i] = f; - } - - for (i = 0; i < index_length; i++) { - me.add_float32(reverse_index[i]); - } - - // Now write out the actual channels. We write these two at a - // time, in the high and low nibbles of each byte. - int table_length = _table.size(); - me.add_uint16(table_length); - - if (index_length == 1) { - // In fact, we don't even need to write the channels at all, - // if there weren't at least two different values. + // We need to write the index in order by its index number; for + // this, we need to invert the index. + vector_float reverse_index(index_length); + map::iterator mi; + for (mi = index.begin(); mi != index.end(); ++mi) { + float f = (float)(*mi).first / scale; + int i = (*mi).second; + nassertv(i >= 0 && i < (int)reverse_index.size()); + reverse_index[i] = f; + } - } else { - for (i = 0; i < table_length - 1; i+= 2) { - int value1 = (int)floor(_table[i] * scale + 0.5); - int value2 = (int)floor(_table[i + 1] * scale + 0.5); - int i1 = index[value1]; - int i2 = index[value2]; - - me.add_uint8((i1 << 4) | i2); - } - - // There might be one odd value. - if (i < table_length) { - int value1 = (int)floor(_table[i] * scale + 0.5); - int i1 = index[value1]; - - me.add_uint8(i1 << 4); - } - } + for (i = 0; i < index_length; i++) { + me.add_float32(reverse_index[i]); + } + + // Now write out the actual channels. We write these two at a + // time, in the high and low nibbles of each byte. + int table_length = _table.size(); + me.add_uint16(table_length); + + if (index_length == 1) { + // In fact, we don't even need to write the channels at all, + // if there weren't at least two different values. + + } else { + for (i = 0; i < table_length - 1; i+= 2) { + int value1 = (int)floor(_table[i] * scale + 0.5); + int value2 = (int)floor(_table[i + 1] * scale + 0.5); + int i1 = index[value1]; + int i2 = index[value2]; + + me.add_uint8((i1 << 4) | i2); + } + + // There might be one odd value. + if (i < table_length) { + int value1 = (int)floor(_table[i] * scale + 0.5); + int i1 = index[value1]; + + me.add_uint8(i1 << 4); + } + } } } else { @@ -246,7 +246,7 @@ fillin(DatagramIterator& scan, BamReader* manager) // Compressed channels. if (manager->get_file_minor_ver() < 1) { chan_cat.error() - << "Cannot read old-style quantized channels.\n"; + << "Cannot read old-style quantized channels.\n"; return; } @@ -256,36 +256,36 @@ fillin(DatagramIterator& scan, BamReader* manager) if (index_length < 0xff) { // Discrete. Read in the index. if (index_length > 0) { - float *index = (float *)alloca(index_length * sizeof(float)); + float *index = (float *)alloca(index_length * sizeof(float)); - int i; - for (i = 0; i < index_length; i++) { - index[i] = scan.get_float32(); - } - - // Now read in the channel values. - int table_length = scan.get_uint16(); - if (index_length == 1) { - // With only one index value, we can infer the table. - for (i = 0; i < table_length; i++) { - temp_table.push_back(index[0]); - } - } else { - // Otherwise, we must read it. - for (i = 0; i < table_length - 1; i+= 2) { - int num = scan.get_uint8(); - int i1 = (num >> 4) & 0xf; - int i2 = num & 0xf; - temp_table.push_back(index[i1]); - temp_table.push_back(index[i2]); - } - // There might be one odd value. - if (i < table_length) { - int num = scan.get_uint8(); - int i1 = (num >> 4) & 0xf; - temp_table.push_back(index[i1]); - } - } + int i; + for (i = 0; i < index_length; i++) { + index[i] = scan.get_float32(); + } + + // Now read in the channel values. + int table_length = scan.get_uint16(); + if (index_length == 1) { + // With only one index value, we can infer the table. + for (i = 0; i < table_length; i++) { + temp_table.push_back(index[0]); + } + } else { + // Otherwise, we must read it. + for (i = 0; i < table_length - 1; i+= 2) { + int num = scan.get_uint8(); + int i1 = (num >> 4) & 0xf; + int i2 = num & 0xf; + temp_table.push_back(index[i1]); + temp_table.push_back(index[i2]); + } + // There might be one odd value. + if (i < table_length) { + int num = scan.get_uint8(); + int i1 = (num >> 4) & 0xf; + temp_table.push_back(index[i1]); + } + } } } else { // Continuous channels. diff --git a/panda/src/chan/animChannelScalarTable.h b/panda/src/chan/animChannelScalarTable.h index cb6c7caa77..b250802ee4 100644 --- a/panda/src/chan/animChannelScalarTable.h +++ b/panda/src/chan/animChannelScalarTable.h @@ -56,7 +56,7 @@ public: static void init_type() { AnimChannelScalar::init_type(); register_type(_type_handle, "AnimChannelScalarTable", - AnimChannelScalar::get_class_type()); + AnimChannelScalar::get_class_type()); } private: diff --git a/panda/src/chan/animControl.cxx b/panda/src/chan/animControl.cxx index 3d3575f23b..2f5002dca6 100644 --- a/panda/src/chan/animControl.cxx +++ b/panda/src/chan/animControl.cxx @@ -134,7 +134,7 @@ loop(bool restart, int from, int to) { // differently. if ((to == 0 && from == get_num_frames()-1) || - (to == from-1)) { + (to == from-1)) { // In this case, the user has specified to loop over the whole // range of animation. We don't need a special jump action to @@ -148,12 +148,12 @@ loop(bool restart, int from, int to) { // if the number of frames in the loop is large enough and/or the // frame rate is high enough. insert_jump_action(_actions, (to-1+get_num_frames())%get_num_frames(), - from); + from); } } else { if ((from == 0 && to == get_num_frames()-1) || - (from == to-1)) { + (from == to-1)) { // In this case, the user has specified to loop over the whole // range of animation. We don't need a special jump action to @@ -243,7 +243,7 @@ remove_event(const string &event_name) { for (ai = _user_actions.begin(); ai != _user_actions.end(); ++ai) { const Action &action = (*ai).second; if (action._type == AT_event && - action._event->get_name() == event_name) { + action._event->get_name() == event_name) { // Remove this event by not copying it to new_actions. removed++; } else { @@ -259,15 +259,15 @@ remove_event(const string &event_name) { new_actions.clear(); int p_removed = 0; for (ai = _actions.begin(); ai != _actions.end(); ++ai) { - const Action &action = (*ai).second; - if (action._type == AT_event && - action._event->get_name() == event_name) { - // Remove this event by not copying it to new_actions. - p_removed++; - } else { - // Preserve this event. - new_actions.insert(*ai); - } + const Action &action = (*ai).second; + if (action._type == AT_event && + action._event->get_name() == event_name) { + // Remove this event by not copying it to new_actions. + p_removed++; + } else { + // Preserve this event. + new_actions.insert(*ai); + } } nassertr(p_removed == removed, removed); _actions.swap(new_actions); @@ -333,25 +333,25 @@ advance_time(double time) { // actions in reverse order. if (new_frame >= 0) { - do_actions_backward(orig_frame-1, new_frame); + do_actions_backward(orig_frame-1, new_frame); } else { - if (do_actions_backward(orig_frame-1, 0)) { - _frame = _frame - floor(_frame / num_frames) * num_frames; - new_frame = get_frame(); - do_actions_backward(get_num_frames(), new_frame); - } + if (do_actions_backward(orig_frame-1, 0)) { + _frame = _frame - floor(_frame / num_frames) * num_frames; + new_frame = get_frame(); + do_actions_backward(get_num_frames(), new_frame); + } } } else { // Normally, we'll be playing the animation forward. if (new_frame < get_num_frames()) { - do_actions_forward(orig_frame+1, new_frame); + do_actions_forward(orig_frame+1, new_frame); } else { - if (do_actions_forward(orig_frame+1, get_num_frames()-1)) { - _frame = _frame - floor(_frame / num_frames) * num_frames; - new_frame = get_frame(); - do_actions_forward(0, new_frame); - } + if (do_actions_forward(orig_frame+1, get_num_frames()-1)) { + _frame = _frame - floor(_frame / num_frames) * num_frames; + new_frame = get_frame(); + do_actions_forward(0, new_frame); + } } } } @@ -492,12 +492,12 @@ do_actions_forward(int from, int to) { const Action &action = (*ai).second; if (sequence_frame != -1 && frame > sequence_frame) { - // We encountered an action that resequenced our frame numbers. - // Now that we've finished evaluating all the other actions that - // occurred in the same frame, evaluate this one action and - // exit. - do_sequence_action(sequence_frame, *sequence_action); - return false; + // We encountered an action that resequenced our frame numbers. + // Now that we've finished evaluating all the other actions that + // occurred in the same frame, evaluate this one action and + // exit. + do_sequence_action(sequence_frame, *sequence_action); + return false; } do_action(frame, action, sequence_frame, sequence_action); @@ -544,12 +544,12 @@ do_actions_backward(int from, int to) { const Action &action = (*ai).second; if (sequence_frame != -1 && frame < sequence_frame) { - // We encountered an action that resequenced our frame numbers. - // Now that we've finished evaluating all the other actions that - // occurred in the same frame, evaluate this one action and - // exit. - do_sequence_action(sequence_frame, *sequence_action); - return false; + // We encountered an action that resequenced our frame numbers. + // Now that we've finished evaluating all the other actions that + // occurred in the same frame, evaluate this one action and + // exit. + do_sequence_action(sequence_frame, *sequence_action); + return false; } do_action(frame, action, sequence_frame, sequence_action); @@ -578,7 +578,7 @@ do_actions_backward(int from, int to) { //////////////////////////////////////////////////////////////////// void AnimControl:: do_action(int frame, const Action &action, - int &sequence_frame, const Action *&sequence_action) { + int &sequence_frame, const Action *&sequence_action) { switch (action._type) { case AT_stop: case AT_jump: diff --git a/panda/src/chan/animControl.h b/panda/src/chan/animControl.h index 7df67edfbf..ee684ff381 100644 --- a/panda/src/chan/animControl.h +++ b/panda/src/chan/animControl.h @@ -107,7 +107,7 @@ private: bool do_actions_backward(int from, int to); void do_action(int frame, const Action &action, - int &sequence_frame, const Action *&sequence_action); + int &sequence_frame, const Action *&sequence_action); void do_sequence_action(int frame, const Action &action); Actions _actions; @@ -141,7 +141,7 @@ public: static void init_type() { ReferenceCount::init_type(); register_type(_type_handle, "AnimControl", - ReferenceCount::get_class_type()); + ReferenceCount::get_class_type()); } private: diff --git a/panda/src/chan/animControlCollection.cxx b/panda/src/chan/animControlCollection.cxx index 57c93767bb..549bed7d62 100644 --- a/panda/src/chan/animControlCollection.cxx +++ b/panda/src/chan/animControlCollection.cxx @@ -207,7 +207,7 @@ which_anim_playing() const { for (ci = _controls.begin(); ci != _controls.end(); ++ci) { if ((*ci).second->is_playing()) { if (!result.empty()) { - result += " "; + result += " "; } result += (*ci).first; } diff --git a/panda/src/chan/animGroup.cxx b/panda/src/chan/animGroup.cxx index 2a009da7e8..c87879b267 100644 --- a/panda/src/chan/animGroup.cxx +++ b/panda/src/chan/animGroup.cxx @@ -215,7 +215,7 @@ complete_pointers(vector_typedWritable &plist, BamReader*) if (plist[i] == TypedWritable::Null) { chan_cat->warning() << get_type().get_name() - << " Ignoring null child" << endl; + << " Ignoring null child" << endl; } else { diff --git a/panda/src/chan/animGroup.h b/panda/src/chan/animGroup.h index fd6cfe0a88..ce5b69262c 100644 --- a/panda/src/chan/animGroup.h +++ b/panda/src/chan/animGroup.h @@ -57,7 +57,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_AnimGroup(const FactoryParams ¶ms); @@ -79,7 +79,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "AnimGroup", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } private: diff --git a/panda/src/chan/auto_bind.cxx b/panda/src/chan/auto_bind.cxx index b3312c9a79..8c462e526c 100644 --- a/panda/src/chan/auto_bind.cxx +++ b/panda/src/chan/auto_bind.cxx @@ -33,7 +33,7 @@ class CollectNodes : public TraverserVisitor { public: bool reached_node(Node *node, const NullAttributeWrapper &, - NullLevelState &) { + NullLevelState &) { if (node->is_of_type(AnimBundleNode::get_class_type())) { AnimBundleNode *bn = DCAST(AnimBundleNode, node); _anims[bn->get_bundle()->get_name()].insert(bn); @@ -60,8 +60,8 @@ public: //////////////////////////////////////////////////////////////////// static void bind_anims(const PartNodes &parts, const AnimNodes &anims, - AnimControlCollection &controls, - int hierarchy_match_flags) { + AnimControlCollection &controls, + int hierarchy_match_flags) { PartNodes::const_iterator pni; @@ -73,38 +73,38 @@ bind_anims(const PartNodes &parts, const AnimNodes &anims, AnimBundle *anim = (*ani)->get_bundle(); if (chan_cat.is_info()) { - chan_cat.info() - << "Attempting to bind " << *part << " to " << *anim << "\n"; + chan_cat.info() + << "Attempting to bind " << *part << " to " << *anim << "\n"; } PT(AnimControl) control = - part->bind_anim(anim, hierarchy_match_flags); + part->bind_anim(anim, hierarchy_match_flags); string name = anim->get_name(); if (control != (AnimControl *)NULL) { - if (controls.find_anim(name) != (AnimControl *)NULL) { - // That name's already used; synthesize another one. - int index = 0; - string new_name; - do { - index++; - new_name = name + '.' + format_string(index); - } while (controls.find_anim(new_name) != (AnimControl *)NULL); - name = new_name; - } + if (controls.find_anim(name) != (AnimControl *)NULL) { + // That name's already used; synthesize another one. + int index = 0; + string new_name; + do { + index++; + new_name = name + '.' + format_string(index); + } while (controls.find_anim(new_name) != (AnimControl *)NULL); + name = new_name; + } - controls.store_anim(control, name); + controls.store_anim(control, name); } if (chan_cat.is_info()) { - if (control == NULL) { - chan_cat.info() - << "Bind failed.\n"; - } else { - chan_cat.info() - << "Bind succeeded, index " - << control->get_channel_index() << "; accessible as " - << name << "\n"; - } + if (control == NULL) { + chan_cat.info() + << "Bind failed.\n"; + } else { + chan_cat.info() + << "Bind succeeded, index " + << control->get_channel_index() << "; accessible as " + << name << "\n"; + } } } } @@ -121,12 +121,12 @@ bind_anims(const PartNodes &parts, const AnimNodes &anims, // filled into controls. //////////////////////////////////////////////////////////////////// void auto_bind(Node *root_node, AnimControlCollection &controls, - int hierarchy_match_flags) { + int hierarchy_match_flags) { // First, locate all the bundles in the subgraph. CollectNodes cn; df_traverse(root_node, cn, NullAttributeWrapper(), NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); // Now, match up the bundles by name. @@ -145,7 +145,7 @@ void auto_bind(Node *root_node, AnimControlCollection &controls, } else { // But here we have (at least one) match! bind_anims((*pi).second, (*ai).second, controls, - hierarchy_match_flags); + hierarchy_match_flags); ++pi; // We don't increment the anim counter yet. That way, the same @@ -155,4 +155,4 @@ void auto_bind(Node *root_node, AnimControlCollection &controls, } } - + diff --git a/panda/src/chan/auto_bind.h b/panda/src/chan/auto_bind.h index 1225db855b..998d02239c 100644 --- a/panda/src/chan/auto_bind.h +++ b/panda/src/chan/auto_bind.h @@ -25,7 +25,7 @@ BEGIN_PUBLISH //////////////////////////////////////////////////////////////////// EXPCL_PANDA void auto_bind(Node *root_node, AnimControlCollection &controls, - int hierarchy_match_flags = 0); + int hierarchy_match_flags = 0); END_PUBLISH #endif diff --git a/panda/src/chan/movingPart.I b/panda/src/chan/movingPart.I index 1282e0a7bf..f8edbcd606 100644 --- a/panda/src/chan/movingPart.I +++ b/panda/src/chan/movingPart.I @@ -41,7 +41,7 @@ MovingPart(const MovingPart ©) : template INLINE MovingPart:: MovingPart(PartGroup *parent, const string &name, - const ValueType &initial_value) : + const ValueType &initial_value) : MovingPartBase(parent, name), _value(initial_value), _initial_value(initial_value) diff --git a/panda/src/chan/movingPart.h b/panda/src/chan/movingPart.h index 2afd38c7c4..9acbea4c9c 100644 --- a/panda/src/chan/movingPart.h +++ b/panda/src/chan/movingPart.h @@ -28,7 +28,7 @@ protected: public: INLINE MovingPart(PartGroup *parent, const string &name, - const ValueType &_initial_value); + const ValueType &_initial_value); virtual TypeHandle get_value_type() const; virtual AnimChannelBase *make_initial_channel() const; @@ -57,7 +57,7 @@ public: static void init_type() { MovingPartBase::init_type(); register_type(_type_handle, SwitchType::get_part_type_name(), - MovingPartBase::get_class_type()); + MovingPartBase::get_class_type()); } private: diff --git a/panda/src/chan/movingPartBase.cxx b/panda/src/chan/movingPartBase.cxx index e1b8fc2e7d..3851ce004d 100644 --- a/panda/src/chan/movingPartBase.cxx +++ b/panda/src/chan/movingPartBase.cxx @@ -77,7 +77,7 @@ write_with_value(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void MovingPartBase:: do_update(PartBundle *root, PartGroup *parent, - bool parent_changed, bool anim_changed) { + bool parent_changed, bool anim_changed) { bool needs_update = anim_changed; // See if any of the channel values have changed since last time. @@ -108,7 +108,7 @@ do_update(PartBundle *root, PartGroup *parent, Children::iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { (*ci)->do_update(root, this, parent_changed || needs_update, - anim_changed); + anim_changed); } } @@ -146,7 +146,7 @@ pick_channel_index(list &holes, int &next) const { int hole = (*ii); nassertv(hole >= 0 && hole < next); if (hole < (int)_channels.size() || - _channels[hole] != (AnimChannelBase *)NULL) { + _channels[hole] != (AnimChannelBase *)NULL) { // We can't accept this hole; we're using it! holes.erase(ii); } @@ -158,8 +158,8 @@ pick_channel_index(list &holes, int &next) const { int i; for (i = next; i < (int)_channels.size(); i++) { if (_channels[i] == (AnimChannelBase*)0L) { - // Here's a hole we do have. - holes.push_back(i); + // Here's a hole we do have. + holes.push_back(i); } } next = _channels.size(); diff --git a/panda/src/chan/movingPartBase.h b/panda/src/chan/movingPartBase.h index b38a29f16d..bc39cc76fe 100644 --- a/panda/src/chan/movingPartBase.h +++ b/panda/src/chan/movingPartBase.h @@ -36,11 +36,11 @@ public: virtual void output_value(ostream &out) const=0; virtual void do_update(PartBundle *root, PartGroup *parent, - bool parent_changed, bool anim_changed); + bool parent_changed, bool anim_changed); virtual void get_blend_value(const PartBundle *root)=0; virtual void update_internals(PartGroup *parent, bool self_changed, - bool parent_changed); + bool parent_changed); protected: MovingPartBase(void); @@ -65,7 +65,7 @@ public: static void init_type() { PartGroup::init_type(); register_type(_type_handle, "MovingPartBase", - PartGroup::get_class_type()); + PartGroup::get_class_type()); } private: diff --git a/panda/src/chan/movingPartMatrix.I b/panda/src/chan/movingPartMatrix.I index 65ed9fa061..ab243661ac 100644 --- a/panda/src/chan/movingPartMatrix.I +++ b/panda/src/chan/movingPartMatrix.I @@ -23,7 +23,7 @@ MovingPartMatrix(const MovingPartMatrix ©) : //////////////////////////////////////////////////////////////////// INLINE MovingPartMatrix:: MovingPartMatrix(PartGroup *parent, const string &name, - const LMatrix4f &initial_value) + const LMatrix4f &initial_value) : MovingPart(parent, name, initial_value) { } diff --git a/panda/src/chan/movingPartMatrix.cxx b/panda/src/chan/movingPartMatrix.cxx index 7d80515ca5..b3d1c1c8f0 100644 --- a/panda/src/chan/movingPartMatrix.cxx +++ b/panda/src/chan/movingPartMatrix.cxx @@ -54,20 +54,20 @@ get_blend_value(const PartBundle *root) { PartBundle::ChannelBlend::const_iterator cbi; for (cbi = blend.begin(); cbi != blend.end(); ++cbi) { - AnimControl *control = (*cbi).first; - float effect = (*cbi).second; - nassertv(effect != 0.0); - - int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); - ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - nassertv(channel != NULL); - - ValueType v; - channel->get_value(control->get_frame(), v); - - _value += v * effect; - net += effect; + AnimControl *control = (*cbi).first; + float effect = (*cbi).second; + nassertv(effect != 0.0); + + int channel_index = control->get_channel_index(); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); + ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); + nassertv(channel != NULL); + + ValueType v; + channel->get_value(control->get_frame(), v); + + _value += v * effect; + net += effect; } nassertv(net != 0.0); @@ -85,23 +85,23 @@ get_blend_value(const PartBundle *root) { PartBundle::ChannelBlend::const_iterator cbi; for (cbi = blend.begin(); cbi != blend.end(); ++cbi) { - AnimControl *control = (*cbi).first; - float effect = (*cbi).second; - nassertv(effect != 0.0); - - int channel_index = control->get_channel_index(); - nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); - ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - nassertv(channel != NULL); - - ValueType v; - channel->get_value_no_scale(control->get_frame(), v); - LVector3f s; - channel->get_scale(control->get_frame(), &s[0]); - - _value += v * effect; - scale += s * effect; - net += effect; + AnimControl *control = (*cbi).first; + float effect = (*cbi).second; + nassertv(effect != 0.0); + + int channel_index = control->get_channel_index(); + nassertv(channel_index >= 0 && channel_index < (int)_channels.size()); + ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); + nassertv(channel != NULL); + + ValueType v; + channel->get_value_no_scale(control->get_frame(), v); + LVector3f s; + channel->get_scale(control->get_frame(), &s[0]); + + _value += v * effect; + scale += s * effect; + net += effect; } nassertv(net != 0.0); diff --git a/panda/src/chan/movingPartMatrix.h b/panda/src/chan/movingPartMatrix.h index 9e71a64179..4737dc5155 100644 --- a/panda/src/chan/movingPartMatrix.h +++ b/panda/src/chan/movingPartMatrix.h @@ -25,8 +25,8 @@ protected: public: INLINE MovingPartMatrix(PartGroup *parent, const string &name, - const LMatrix4f &initial_value = - LMatrix4f::ident_mat()); + const LMatrix4f &initial_value = + LMatrix4f::ident_mat()); virtual void get_blend_value(const PartBundle *root); @@ -52,7 +52,7 @@ public: MovingPart::init_type(); AnimChannelFixed::init_type(); register_type(_type_handle, "MovingPartMatrix", - MovingPart::get_class_type()); + MovingPart::get_class_type()); } private: diff --git a/panda/src/chan/movingPartScalar.I b/panda/src/chan/movingPartScalar.I index aac6692d02..4199033ffc 100644 --- a/panda/src/chan/movingPartScalar.I +++ b/panda/src/chan/movingPartScalar.I @@ -23,7 +23,7 @@ MovingPartScalar(const MovingPartScalar ©) : //////////////////////////////////////////////////////////////////// INLINE MovingPartScalar:: MovingPartScalar(PartGroup *parent, const string &name, - const float &initial_value) + const float &initial_value) : MovingPart(parent, name, initial_value) { } diff --git a/panda/src/chan/movingPartScalar.h b/panda/src/chan/movingPartScalar.h index 850c0c5f4a..991f0580d8 100644 --- a/panda/src/chan/movingPartScalar.h +++ b/panda/src/chan/movingPartScalar.h @@ -25,7 +25,7 @@ protected: public: INLINE MovingPartScalar(PartGroup *parent, const string &name, - const float &initial_value = 0); + const float &initial_value = 0); virtual void get_blend_value(const PartBundle *root); @@ -49,7 +49,7 @@ public: MovingPart::init_type(); AnimChannelFixed::init_type(); register_type(_type_handle, "MovingPartScalar", - MovingPart::get_class_type()); + MovingPart::get_class_type()); } private: diff --git a/panda/src/chan/partBundle.cxx b/panda/src/chan/partBundle.cxx index 2bc840505d..23484d2146 100644 --- a/panda/src/chan/partBundle.cxx +++ b/panda/src/chan/partBundle.cxx @@ -250,10 +250,10 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags) { // Make sure the root names match. if (get_name() != anim->get_name()) { if (chan_cat.is_error()) { - chan_cat.error() - << "Root name of part (" << get_name() - << ") does not match that of anim (" << anim->get_name() - << ")\n"; + chan_cat.error() + << "Root name of part (" << get_name() + << ") does not match that of anim (" << anim->get_name() + << ")\n"; } return NULL; } @@ -302,7 +302,7 @@ bind_anim(AnimBundle *anim, int hierarchy_match_flags) { //////////////////////////////////////////////////////////////////// bool PartBundle:: bind_anim(AnimBundle *anim, const string &name, - int hierarchy_match_flags) { + int hierarchy_match_flags) { PT(AnimControl) control = bind_anim(anim, hierarchy_match_flags); if (control == (AnimControl *)NULL) { return false; diff --git a/panda/src/chan/partBundle.h b/panda/src/chan/partBundle.h index 14364b5da9..cf5d059253 100644 --- a/panda/src/chan/partBundle.h +++ b/panda/src/chan/partBundle.h @@ -100,10 +100,10 @@ PUBLISHED: virtual void write(ostream &out, int indent_level) const; PT(AnimControl) bind_anim(AnimBundle *anim, - int hierarchy_match_flags = 0); + int hierarchy_match_flags = 0); bool bind_anim(AnimBundle *anim, const string &name, - int hierarchy_match_flags = 0); + int hierarchy_match_flags = 0); public: // The following functions aren't really part of the public @@ -144,7 +144,7 @@ public: static void init_type() { PartGroup::init_type(); register_type(_type_handle, "PartBundle", - PartGroup::get_class_type()); + PartGroup::get_class_type()); } private: diff --git a/panda/src/chan/partBundleNode.h b/panda/src/chan/partBundleNode.h index 4f47822069..eb6d4b1421 100644 --- a/panda/src/chan/partBundleNode.h +++ b/panda/src/chan/partBundleNode.h @@ -38,7 +38,7 @@ private: public: virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: void fillin(DatagramIterator& scan, BamReader* manager); @@ -55,7 +55,7 @@ public: static void init_type() { NamedNode::init_type(); register_type(_type_handle, "PartBundleNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } private: diff --git a/panda/src/chan/partGroup.cxx b/panda/src/chan/partGroup.cxx index 99b232ab90..f8bd78a9d4 100644 --- a/panda/src/chan/partGroup.cxx +++ b/panda/src/chan/partGroup.cxx @@ -180,13 +180,13 @@ sort_descendants() { //////////////////////////////////////////////////////////////////// bool PartGroup:: check_hierarchy(const AnimGroup *anim, const PartGroup *, - int hierarchy_match_flags) const { + int hierarchy_match_flags) const { if (anim->get_value_type() != get_value_type()) { if (chan_cat.is_error()) { chan_cat.error() - << "Part " << get_name() << " expects type " << get_value_type() - << " while matching anim node has type " << anim->get_value_type() - << ".\n"; + << "Part " << get_name() << " expects type " << get_value_type() + << " while matching anim node has type " << anim->get_value_type() + << ".\n"; } return false; } @@ -199,88 +199,88 @@ check_hierarchy(const AnimGroup *anim, const PartGroup *, bool match = true; if (anim->get_num_children() != get_num_children()) { chan_cat.info() - << "Part " << get_name() << " has " << get_num_children() - << " children, while matching anim node has " - << anim->get_num_children() << ":\n"; + << "Part " << get_name() << " has " << get_num_children() + << " children, while matching anim node has " + << anim->get_num_children() << ":\n"; match = false; } else { for (int i = 0; match && i < get_num_children(); i++) { - PartGroup *pc = get_child(i); - AnimGroup *ac = anim->get_child(i); - - match = (pc->get_name() == ac->get_name()); + PartGroup *pc = get_child(i); + AnimGroup *ac = anim->get_child(i); + + match = (pc->get_name() == ac->get_name()); } if (!match) { - chan_cat.info() - << "Part " << get_name() << " has a different set of children " - << " than matching anim node:\n"; + chan_cat.info() + << "Part " << get_name() << " has a different set of children " + << " than matching anim node:\n"; } } if (!match) { int i = 0, j = 0; while (i < get_num_children() && - j < anim->get_num_children()) { - PartGroup *pc = get_child(i); - AnimGroup *ac = anim->get_child(j); - - if (pc->get_name() < ac->get_name()) { - chan_cat.info() - << " part has " << pc->get_name() - << ", not in anim.\n"; - i++; - } else if (ac->get_name() < pc->get_name()) { - chan_cat.info() - << " anim has " << ac->get_name() - << ", not in part.\n"; - j++; - } else { - // chan_cat.info() << " part and anim both have " << ac->get_name() << "\n"; - i++; - j++; - } + j < anim->get_num_children()) { + PartGroup *pc = get_child(i); + AnimGroup *ac = anim->get_child(j); + + if (pc->get_name() < ac->get_name()) { + chan_cat.info() + << " part has " << pc->get_name() + << ", not in anim.\n"; + i++; + } else if (ac->get_name() < pc->get_name()) { + chan_cat.info() + << " anim has " << ac->get_name() + << ", not in part.\n"; + j++; + } else { + // chan_cat.info() << " part and anim both have " << ac->get_name() << "\n"; + i++; + j++; + } } while (i < get_num_children()) { - PartGroup *pc = get_child(i); - chan_cat.info() - << " part has " << pc->get_name() - << ", not in anim.\n"; - i++; + PartGroup *pc = get_child(i); + chan_cat.info() + << " part has " << pc->get_name() + << ", not in anim.\n"; + i++; } while (j < anim->get_num_children()) { - AnimGroup *ac = anim->get_child(j); - chan_cat.info() - << " anim has " << ac->get_name() - << ", not in part.\n"; - j++; + AnimGroup *ac = anim->get_child(j); + chan_cat.info() + << " anim has " << ac->get_name() + << ", not in part.\n"; + j++; } } } // Now walk the list of children and check the matching // sub-hierarchies only. - + int i = 0, j = 0; while (i < get_num_children() && - j < anim->get_num_children()) { + j < anim->get_num_children()) { PartGroup *pc = get_child(i); AnimGroup *ac = anim->get_child(j); - + if (pc->get_name() < ac->get_name()) { if ((hierarchy_match_flags & HMF_ok_part_extra) == 0) { - return false; + return false; } i++; } else if (ac->get_name() < pc->get_name()) { if ((hierarchy_match_flags & HMF_ok_anim_extra) == 0) { - return false; + return false; } j++; } else { if (!pc->check_hierarchy(ac, this, hierarchy_match_flags)) { - return false; + return false; } i++; j++; @@ -340,7 +340,7 @@ write_with_value(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void PartGroup:: do_update(PartBundle *root, PartGroup *, - bool parent_changed, bool anim_changed) { + bool parent_changed, bool anim_changed) { Children::iterator ci; for (ci = _children.begin(); ci != _children.end(); ++ci) { (*ci)->do_update(root, this, parent_changed, anim_changed); @@ -413,7 +413,7 @@ bind_hierarchy(AnimGroup *anim, int channel_index) { while (i < part_num_children && j < anim_num_children) { PartGroup *pc = get_child(i); AnimGroup *ac = anim->get_child(j); - + if (pc->get_name() < ac->get_name()) { // Here's a part, not in the anim. Bind it to the special NULL // anim. @@ -490,7 +490,7 @@ complete_pointers(vector_typedWritable &plist, BamReader*) if (plist[i] == TypedWritable::Null) { chan_cat->warning() << get_type().get_name() - << " Ignoring null PartGroup" << endl; + << " Ignoring null PartGroup" << endl; } else { diff --git a/panda/src/chan/partGroup.h b/panda/src/chan/partGroup.h index 720ac2f638..c4c2c6bcdb 100644 --- a/panda/src/chan/partGroup.h +++ b/panda/src/chan/partGroup.h @@ -66,11 +66,11 @@ public: void sort_descendants(); bool check_hierarchy(const AnimGroup *anim, - const PartGroup *parent, - int hierarchy_match_flags = 0) const; + const PartGroup *parent, + int hierarchy_match_flags = 0) const; virtual void do_update(PartBundle *root, PartGroup *parent, - bool parent_changed, bool anim_changed); + bool parent_changed, bool anim_changed); protected: void write_descendants(ostream &out, int indent_level) const; @@ -86,7 +86,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_PartGroup(const FactoryParams ¶ms); @@ -110,7 +110,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "PartGroup", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } private: diff --git a/panda/src/chancfg/chancfg.h b/panda/src/chancfg/chancfg.h index 7dcd5e9329..092fecba91 100644 --- a/panda/src/chancfg/chancfg.h +++ b/panda/src/chancfg/chancfg.h @@ -90,7 +90,7 @@ extern ChanCfgOverrides ChanOverrideNone; PT(GraphicsWindow) EXPCL_PANDA ChanConfig(GraphicsPipe*, std::string, Node *camera_node, Node *render, - ChanCfgOverrides& = ChanOverrideNone); + ChanCfgOverrides& = ChanOverrideNone); #include "chancfg.I" diff --git a/panda/src/chancfg/chanparse.I b/panda/src/chancfg/chanparse.I index 4bd46f9bc8..a2a8b2cf39 100644 --- a/panda/src/chancfg/chanparse.I +++ b/panda/src/chancfg/chanparse.I @@ -76,7 +76,7 @@ INLINE int ChanReadNextIntB(std::string& S) { if ((stmp.length() != 2)||(stmp[1] != 'f')) { // error, not #f.. #t is not allowed in this case nout << "error, '" << stmp << "' is not allowed, only #f or an int" - << endl; + << endl; i = -1; } else { diff --git a/panda/src/chancfg/chanparse.cxx b/panda/src/chancfg/chanparse.cxx index 2a169874a8..2c54bc22e3 100644 --- a/panda/src/chancfg/chanparse.cxx +++ b/panda/src/chancfg/chanparse.cxx @@ -82,20 +82,20 @@ void ChanParse(istream& is, ChanParseFunctor* p) { int i; while (true) { if ((!S.empty()) && (S[0] != '(')) { - // error, should have leading paren - nout << "error, no leading paren in '" << S << "'" << endl; - S.erase(0, S.find_first_of("(")); + // error, should have leading paren + nout << "error, no leading paren in '" << S << "'" << endl; + S.erase(0, S.find_first_of("(")); } while ((S.empty())||(i = ChanMatchingParen(S)) == -1) { - S += " "; - S += ChanReadLine(is); - if (file_done) { - if (!S.empty() && (!(S == " "))) - // error, trailing text usually indicates an error in the file - nout << "error, trailing text in file S = '" << S << "'" << endl; - return; - } - ChanEatFrontWhite(S); + S += " "; + S += ChanReadLine(is); + if (file_done) { + if (!S.empty() && (!(S == " "))) + // error, trailing text usually indicates an error in the file + nout << "error, trailing text in file S = '" << S << "'" << endl; + return; + } + ChanEatFrontWhite(S); } (*p)(S.substr(1, i-2)); S.erase(0, i); @@ -107,14 +107,14 @@ void ChanParse(istream& is, ChanParseFunctor* p) { int i; while (true) { if ((!S.empty()) && (S[0] != '(')) { - // error, should have leading paren - nout << "error, no leading paren in '" << S << "'" << endl; - S.erase(0, S.find_first_of("(")); + // error, should have leading paren + nout << "error, no leading paren in '" << S << "'" << endl; + S.erase(0, S.find_first_of("(")); } while ((S.empty())||(i = ChanMatchingParen(S)) == -1) { - S += " "; - S += ChanReadLine(is); - ChanEatFrontWhite(S); + S += " "; + S += ChanReadLine(is); + ChanEatFrontWhite(S); } (*p)(S.substr(1, i-2)); S.erase(0, i); diff --git a/panda/src/chancfg/chansetup.I b/panda/src/chancfg/chansetup.I index a3643ebdc3..3494c25acd 100644 --- a/panda/src/chancfg/chansetup.I +++ b/panda/src/chancfg/chansetup.I @@ -81,8 +81,8 @@ INLINE void SetupItem::AddRecurse(std::string& l, std::string& s) { } INLINE void SetupItem::setState(const bool st, const bool hw, const int pvc, - const ChanViewport& v, const SetupFOV& f, - const Orientation& o) { + const ChanViewport& v, const SetupFOV& f, + const Orientation& o) { _stereo = st; _hw_chan = hw; _chan = pvc; diff --git a/panda/src/chancfg/chansetup.h b/panda/src/chancfg/chansetup.h index 4717a38731..9e2e50697b 100644 --- a/panda/src/chancfg/chansetup.h +++ b/panda/src/chancfg/chansetup.h @@ -62,7 +62,7 @@ public: INLINE void AddRecurse(std::string&, std::string&); INLINE void setState(const bool, const bool, const int, const ChanViewport&, - const SetupFOV&, const Orientation&); + const SetupFOV&, const Orientation&); INLINE bool getRecurse(void) const; INLINE SetupSyms getLayouts(void) const; diff --git a/panda/src/chancfg/chanwindow.I b/panda/src/chancfg/chanwindow.I index 2e046d01ef..54203b90ac 100644 --- a/panda/src/chancfg/chanwindow.I +++ b/panda/src/chancfg/chanwindow.I @@ -6,23 +6,23 @@ INLINE WindowItem::WindowItem(void) {} INLINE WindowItem::WindowItem(const bool h, const bool d, const int o, - const std::string& l, const SetupSyms& s, - const int x, const int y, const bool b, - const bool c) : _hw_chans(h), _dvr(d), + const std::string& l, const SetupSyms& s, + const int x, const int y, const bool b, + const bool c) : _hw_chans(h), _dvr(d), _border(b), _cursor(c), _chan_offset(o), _sizeX(x), _sizeY(y), _layout(l), _setups(s) {} INLINE WindowItem::WindowItem(const WindowItem& c) : _hw_chans(c._hw_chans), - _dvr(c._dvr), - _border(c._border), - _cursor(c._cursor), - _chan_offset(c._chan_offset), - _sizeX(c._sizeX), - _sizeY(c._sizeY), - _layout(c._layout), - _setups(c._setups) {} + _dvr(c._dvr), + _border(c._border), + _cursor(c._cursor), + _chan_offset(c._chan_offset), + _sizeX(c._sizeX), + _sizeY(c._sizeY), + _layout(c._layout), + _setups(c._setups) {} INLINE WindowItem::~WindowItem(void) {} diff --git a/panda/src/chancfg/chanwindow.h b/panda/src/chancfg/chanwindow.h index a7fb09896e..228f792d95 100644 --- a/panda/src/chancfg/chanwindow.h +++ b/panda/src/chancfg/chanwindow.h @@ -22,8 +22,8 @@ private: public: INLINE WindowItem(void); INLINE WindowItem(const bool, const bool, const int, const std::string&, - const SetupSyms&, const int, const int, const bool, - const bool); + const SetupSyms&, const int, const int, const bool, + const bool); INLINE WindowItem(const WindowItem&); INLINE ~WindowItem(void); diff --git a/panda/src/char/character.cxx b/panda/src/char/character.cxx index 6154aed23f..ada9f58439 100644 --- a/panda/src/char/character.cxx +++ b/panda/src/char/character.cxx @@ -211,7 +211,7 @@ r_copy_subgraph(TypeHandle graph_type, Node::InstanceMap &) const { //////////////////////////////////////////////////////////////////// void Character:: r_copy_char(Node *dest, const Node *source, TypeHandle graph_type, - const Character *from, Character::ArcMap &arc_map) { + const Character *from, Character::ArcMap &arc_map) { if (source->is_of_type(GeomNode::get_class_type())) { const GeomNode *source_gnode; GeomNode *dest_gnode; @@ -223,9 +223,9 @@ r_copy_char(Node *dest, const Node *source, TypeHandle graph_type, for (int i = 0; i < num_geoms; i++) { dDrawable *d = source_gnode->get_geom(i); if (d->is_of_type(Geom::get_class_type())) { - dest_gnode->add_geom(copy_geom(DCAST(Geom, d), from)); + dest_gnode->add_geom(copy_geom(DCAST(Geom, d), from)); } else { - dest_gnode->add_geom(d); + dest_gnode->add_geom(d); } } } @@ -338,37 +338,37 @@ copy_arc_pointers(const Character *from, const Character::ArcMap &arc_map) { CharacterJoint::ArcList::const_iterator ai; for (ai = source_joint->_net_transform_arcs.begin(); - ai != source_joint->_net_transform_arcs.end(); - ++ai) { - NodeRelation *source_arc = (*ai); + ai != source_joint->_net_transform_arcs.end(); + ++ai) { + NodeRelation *source_arc = (*ai); - ArcMap::const_iterator mi; - mi = arc_map.find(source_arc); - if (mi != arc_map.end()) { - NodeRelation *dest_arc = (*mi).second; + ArcMap::const_iterator mi; + mi = arc_map.find(source_arc); + if (mi != arc_map.end()) { + NodeRelation *dest_arc = (*mi).second; - // Here's an internal joint that the source Character was - // animating directly. We'll animate our corresponding - // joint the same way. - dest_joint->add_net_transform(dest_arc); - } + // Here's an internal joint that the source Character was + // animating directly. We'll animate our corresponding + // joint the same way. + dest_joint->add_net_transform(dest_arc); + } } for (ai = source_joint->_local_transform_arcs.begin(); - ai != source_joint->_local_transform_arcs.end(); - ++ai) { - NodeRelation *source_arc = (*ai); + ai != source_joint->_local_transform_arcs.end(); + ++ai) { + NodeRelation *source_arc = (*ai); - ArcMap::const_iterator mi; - mi = arc_map.find(source_arc); - if (mi != arc_map.end()) { - NodeRelation *dest_arc = (*mi).second; + ArcMap::const_iterator mi; + mi = arc_map.find(source_arc); + if (mi != arc_map.end()) { + NodeRelation *dest_arc = (*mi).second; - // Here's an internal joint that the source Character was - // animating directly. We'll animate our corresponding - // joint the same way. - dest_joint->add_local_transform(dest_arc); - } + // Here's an internal joint that the source Character was + // animating directly. We'll animate our corresponding + // joint the same way. + dest_joint->add_local_transform(dest_arc); + } } } } diff --git a/panda/src/char/character.h b/panda/src/char/character.h index 719f30c10b..d845b7e7f0 100644 --- a/panda/src/char/character.h +++ b/panda/src/char/character.h @@ -57,9 +57,9 @@ private: typedef map ArcMap; virtual Node *r_copy_subgraph(TypeHandle graph_type, - InstanceMap &inst_map) const; + InstanceMap &inst_map) const; void r_copy_char(Node *dest, const Node *source, TypeHandle graph_type, - const Character *from, ArcMap &arc_map); + const Character *from, ArcMap &arc_map); PT(Geom) copy_geom(Geom *source, const Character *from); void copy_arc_pointers(const Character *from, const ArcMap &arc_map); @@ -87,7 +87,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_Character(const FactoryParams ¶ms); @@ -106,7 +106,7 @@ public: static void init_type() { PartBundleNode::init_type(); register_type(_type_handle, "Character", - PartBundleNode::get_class_type()); + PartBundleNode::get_class_type()); } private: diff --git a/panda/src/char/characterJoint.cxx b/panda/src/char/characterJoint.cxx index 7bbcd5ff31..aa5ae045d3 100644 --- a/panda/src/char/characterJoint.cxx +++ b/panda/src/char/characterJoint.cxx @@ -45,7 +45,7 @@ CharacterJoint(const CharacterJoint ©) : //////////////////////////////////////////////////////////////////// CharacterJoint:: CharacterJoint(PartGroup *parent, const string &name, - const LMatrix4f &initial_value) + const LMatrix4f &initial_value) : MovingPartMatrix(parent, name, initial_value) { // Now that we've constructed and we're in the tree, let's call @@ -97,14 +97,14 @@ update_internals(PartGroup *parent, bool self_changed, bool) { while (ai != _net_transform_arcs.end()) { NodeRelation *arc = *ai; if (arc->is_attached()) { - arc->set_transition(t); - ++ai; + arc->set_transition(t); + ++ai; } else { - // The arc is now invalid; its geometry must have been - // removed. Remove the arc from our set. - ArcList::iterator invalid = ai; - ++ai; - _net_transform_arcs.erase(invalid); + // The arc is now invalid; its geometry must have been + // removed. Remove the arc from our set. + ArcList::iterator invalid = ai; + ++ai; + _net_transform_arcs.erase(invalid); } } } @@ -117,14 +117,14 @@ update_internals(PartGroup *parent, bool self_changed, bool) { while (ai != _local_transform_arcs.end()) { NodeRelation *arc = *ai; if (arc->is_attached()) { - arc->set_transition(t); - ++ai; + arc->set_transition(t); + ++ai; } else { - // The arc is now invalid; its geometry must have been - // removed. Remove the arc from our set. - ArcList::iterator invalid = ai; - ++ai; - _local_transform_arcs.erase(invalid); + // The arc is now invalid; its geometry must have been + // removed. Remove the arc from our set. + ArcList::iterator invalid = ai; + ++ai; + _local_transform_arcs.erase(invalid); } } } @@ -338,7 +338,7 @@ complete_pointers(vector_typedWritable &plist, BamReader* manager) if (plist[i] == TypedWritable::Null) { char_cat->warning() << get_name() - << " Ignoring null Net NodeRelation" << endl; + << " Ignoring null Net NodeRelation" << endl; } else { @@ -351,7 +351,7 @@ complete_pointers(vector_typedWritable &plist, BamReader* manager) if (plist[i] == TypedWritable::Null) { char_cat->warning() << get_name() - << " Ignoring null Local NodeRelation" << endl; + << " Ignoring null Local NodeRelation" << endl; } else { diff --git a/panda/src/char/characterJoint.h b/panda/src/char/characterJoint.h index 5a88e9e90c..970b45e7f0 100644 --- a/panda/src/char/characterJoint.h +++ b/panda/src/char/characterJoint.h @@ -26,12 +26,12 @@ protected: public: CharacterJoint(PartGroup *parent, const string &name, - const LMatrix4f &initial_value); + const LMatrix4f &initial_value); virtual PartGroup *make_copy() const; virtual void update_internals(PartGroup *parent, bool self_changed, - bool parent_changed); + bool parent_changed); PUBLISHED: bool add_net_transform(NodeRelation *arc); @@ -53,7 +53,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_CharacterJoint(const FactoryParams ¶ms); @@ -85,7 +85,7 @@ public: static void init_type() { MovingPartMatrix::init_type(); register_type(_type_handle, "CharacterJoint", - MovingPartMatrix::get_class_type()); + MovingPartMatrix::get_class_type()); } private: diff --git a/panda/src/char/characterJointBundle.h b/panda/src/char/characterJointBundle.h index a2cbf16784..b5e81072f3 100644 --- a/panda/src/char/characterJointBundle.h +++ b/panda/src/char/characterJointBundle.h @@ -47,7 +47,7 @@ public: static void init_type() { PartBundle::init_type(); register_type(_type_handle, "CharacterJointBundle", - PartBundle::get_class_type()); + PartBundle::get_class_type()); } private: diff --git a/panda/src/char/characterSlider.h b/panda/src/char/characterSlider.h index d70209e98f..b9348099f0 100644 --- a/panda/src/char/characterSlider.h +++ b/panda/src/char/characterSlider.h @@ -42,7 +42,7 @@ public: static void init_type() { MovingPartScalar::init_type(); register_type(_type_handle, "CharacterSlider", - MovingPartScalar::get_class_type()); + MovingPartScalar::get_class_type()); } private: diff --git a/panda/src/char/computedVertices.h b/panda/src/char/computedVertices.h index a728cbd123..70e892abbc 100644 --- a/panda/src/char/computedVertices.h +++ b/panda/src/char/computedVertices.h @@ -89,7 +89,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "ComputedVertices", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } private: diff --git a/panda/src/char/dynamicVertices.h b/panda/src/char/dynamicVertices.h index 6bb0f41404..0adfeff12b 100644 --- a/panda/src/char/dynamicVertices.h +++ b/panda/src/char/dynamicVertices.h @@ -49,7 +49,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "DynamicVertices", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } private: diff --git a/panda/src/chat/chatHelpers.cxx b/panda/src/chat/chatHelpers.cxx index c9914a5ab8..94eb83c311 100644 --- a/panda/src/chat/chatHelpers.cxx +++ b/panda/src/chat/chatHelpers.cxx @@ -11,8 +11,8 @@ //////////////////////////////////////////////////////////////////// // Function: add_line_wraps // Description: Take an input string and format it so that lines -// will wrap before they reach line_length (unless -// there is no whitespace). +// will wrap before they reach line_length (unless +// there is no whitespace). //////////////////////////////////////////////////////////////////// string add_line_wraps(const string& str, int line_length) { string new_str; diff --git a/panda/src/chat/chatInput.cxx b/panda/src/chat/chatInput.cxx index 2ef7dc4d7d..bf1c97c0a2 100644 --- a/panda/src/chat/chatInput.cxx +++ b/panda/src/chat/chatInput.cxx @@ -63,24 +63,24 @@ transmit_data(NodeAttributes &data) { const ButtonEvent &be = (*bi); if (be._down) { - if (be._button == KeyboardButton::enter()) { - throw_event("chat_exit"); - - } else if (be._button == KeyboardButton::backspace()) { - if (!_str.empty()) { - _str = _str.substr(0, _str.length()-1); - _text_node->set_text(_str); - } - - } else if (be._button.has_ascii_equivalent()) { - char ch = be._button.get_ascii_equivalent(); - - if (isprint(ch)) { - if (!append_character(ch)) { - throw_event("chat_overflow"); - } - } - } + if (be._button == KeyboardButton::enter()) { + throw_event("chat_exit"); + + } else if (be._button == KeyboardButton::backspace()) { + if (!_str.empty()) { + _str = _str.substr(0, _str.length()-1); + _text_node->set_text(_str); + } + + } else if (be._button.has_ascii_equivalent()) { + char ch = be._button.get_ascii_equivalent(); + + if (isprint(ch)) { + if (!append_character(ch)) { + throw_event("chat_overflow"); + } + } + } } } } @@ -95,11 +95,11 @@ void ChatInput:: init_type(void) { DataNode::init_type(); register_type(_type_handle, "ChatInput", - DataNode::get_class_type()); + DataNode::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } //////////////////////////////////////////////////////////////////// @@ -156,7 +156,7 @@ append_character(char ch) { string::const_iterator pi; for (pi = text.begin(); pi != text.end(); ++pi) { if (*pi == '\n') { - ++num_lines; + ++num_lines; } } diff --git a/panda/src/chat/chatInput.h b/panda/src/chat/chatInput.h index fb846b3343..2048ca8952 100644 --- a/panda/src/chat/chatInput.h +++ b/panda/src/chat/chatInput.h @@ -74,7 +74,7 @@ protected: F_max_width = 0x004, }; int _flags; - + public: virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionEntry.h b/panda/src/collide/collisionEntry.h index 49e3e70869..7d53948582 100644 --- a/panda/src/collide/collisionEntry.h +++ b/panda/src/collide/collisionEntry.h @@ -18,7 +18,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CollisionEntry +// Class : CollisionEntry // Description : Defines a single collision event. One of these is // created for each collision detected by a // CollisionTraverser, to be dealt with by the @@ -99,7 +99,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "CollisionEntry", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandler.h b/panda/src/collide/collisionHandler.h index 345c57c45c..8c6ba28d3e 100644 --- a/panda/src/collide/collisionHandler.h +++ b/panda/src/collide/collisionHandler.h @@ -13,7 +13,7 @@ class CollisionEntry; /////////////////////////////////////////////////////////////////// -// Class : CollisionHandler +// Class : CollisionHandler // Description : The abstract interface to a number of classes that // decide what to do what a collision is detected. One // of these must be assigned to the CollisionTraverser @@ -36,7 +36,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "CollisionHandler", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandlerEvent.I b/panda/src/collide/collisionHandlerEvent.I index 6ceb615c32..1f10a8892d 100644 --- a/panda/src/collide/collisionHandlerEvent.I +++ b/panda/src/collide/collisionHandlerEvent.I @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// INLINE bool CollisionHandlerEvent::SortEntries:: operator () (const PT(CollisionEntry) &a, - const PT(CollisionEntry) &b) const { + const PT(CollisionEntry) &b) const { if (a->get_from_node() != b->get_from_node()) { return a->get_from_node() < b->get_from_node(); } diff --git a/panda/src/collide/collisionHandlerEvent.cxx b/panda/src/collide/collisionHandlerEvent.cxx index 854a87a34a..3966f8ba9c 100644 --- a/panda/src/collide/collisionHandlerEvent.cxx +++ b/panda/src/collide/collisionHandlerEvent.cxx @@ -164,26 +164,26 @@ throw_event_pattern(const string &pattern, CollisionEntry *entry) { string cmd = pattern.substr(p + 1, 2); p += 2; if (cmd == "fn") { - event += entry->get_from_node()->get_name(); + event += entry->get_from_node()->get_name(); } else if (cmd == "in") { - event += entry->get_into_node()->get_name(); + event += entry->get_into_node()->get_name(); } else if (cmd == "ft") { - event += - (!entry->get_from()->is_tangible() ? 'i' : 't'); + event += + (!entry->get_from()->is_tangible() ? 'i' : 't'); } else if (cmd == "it") { - event += - (entry->has_into() && !entry->get_into()->is_tangible() ? 'i' : 't'); + event += + (entry->has_into() && !entry->get_into()->is_tangible() ? 'i' : 't'); } else if (cmd == "ig") { - event += - (entry->has_into() ? 'c' : 'g'); + event += + (entry->has_into() ? 'c' : 'g'); } else { - collide_cat.error() - << "Invalid symbol in event_pattern: %" << cmd << "\n"; + collide_cat.error() + << "Invalid symbol in event_pattern: %" << cmd << "\n"; } } else { event += pattern[p]; diff --git a/panda/src/collide/collisionHandlerEvent.h b/panda/src/collide/collisionHandlerEvent.h index 22c95d6a6c..78bd3d57e9 100644 --- a/panda/src/collide/collisionHandlerEvent.h +++ b/panda/src/collide/collisionHandlerEvent.h @@ -15,7 +15,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CollisionHandlerEvent +// Class : CollisionHandlerEvent // Description : A specialized kind of CollisionHandler that throws an // event for each collision detected. The event thrown // may be based on the name of the moving object or the @@ -55,7 +55,7 @@ private: public: INLINE bool operator () (const PT(CollisionEntry) &a, - const PT(CollisionEntry) &b) const; + const PT(CollisionEntry) &b) const; INLINE void operator = (const SortEntries &other); }; @@ -70,7 +70,7 @@ public: static void init_type() { CollisionHandler::init_type(); register_type(_type_handle, "CollisionHandlerEvent", - CollisionHandler::get_class_type()); + CollisionHandler::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandlerFloor.cxx b/panda/src/collide/collisionHandlerFloor.cxx index 2f8be80fd5..fefde28d19 100644 --- a/panda/src/collide/collisionHandlerFloor.cxx +++ b/panda/src/collide/collisionHandlerFloor.cxx @@ -54,8 +54,8 @@ handle_entries() { // it this CollisionHandler pointer--but they didn't tell us // about the node. collide_cat.error() - << "CollisionHandlerFloor doesn't know about " - << *from_node << "\n"; + << "CollisionHandlerFloor doesn't know about " + << *from_node << "\n"; } else { const ColliderDef &def = (*ci).second; @@ -66,48 +66,48 @@ handle_entries() { Entries::const_iterator ei; for (ei = entries.begin(); ei != entries.end(); ++ei) { - CollisionEntry *entry = (*ei); - nassertv(entry != (CollisionEntry *)NULL); - nassertv(from_node == entry->get_from_node()); + CollisionEntry *entry = (*ei); + nassertv(entry != (CollisionEntry *)NULL); + nassertv(from_node == entry->get_from_node()); - if (entry->has_from_intersection_point()) { - LPoint3f point = entry->get_from_intersection_point(); - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Intersection point detected at " << point << "\n"; - } + if (entry->has_from_intersection_point()) { + LPoint3f point = entry->get_from_intersection_point(); + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Intersection point detected at " << point << "\n"; + } - float height = point[2]; - if (!got_max || height > max_height) { - got_max = true; - max_height = height; - } - } + float height = point[2]; + if (!got_max || height > max_height) { + got_max = true; + max_height = height; + } + } } // Now set our height accordingly. float adjust = max_height + _offset; if (!IS_THRESHOLD_ZERO(adjust, 0.001)) { - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Adjusting height by " << adjust << "\n"; - } + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Adjusting height by " << adjust << "\n"; + } - if (adjust < 0.0 && _max_velocity != 0.0) { - float max_adjust = - _max_velocity * ClockObject::get_global_clock()->get_dt(); - adjust = max(adjust, -max_adjust); - } + if (adjust < 0.0 && _max_velocity != 0.0) { + float max_adjust = + _max_velocity * ClockObject::get_global_clock()->get_dt(); + adjust = max(adjust, -max_adjust); + } - LMatrix4f mat; - def.get_mat(mat); - mat(3, 2) += adjust; - def.set_mat(mat); + LMatrix4f mat; + def.get_mat(mat); + mat(3, 2) += adjust; + def.set_mat(mat); } else { - if (collide_cat.is_spam()) { - collide_cat.spam() - << "Leaving height unchanged.\n"; - } + if (collide_cat.is_spam()) { + collide_cat.spam() + << "Leaving height unchanged.\n"; + } } } } diff --git a/panda/src/collide/collisionHandlerFloor.h b/panda/src/collide/collisionHandlerFloor.h index 07e294a34f..90fe0e91a0 100644 --- a/panda/src/collide/collisionHandlerFloor.h +++ b/panda/src/collide/collisionHandlerFloor.h @@ -12,7 +12,7 @@ #include "collisionNode.h" /////////////////////////////////////////////////////////////////// -// Class : CollisionHandlerFloor +// Class : CollisionHandlerFloor // Description : A specialized kind of CollisionHandler that sets the // Z height of the collider to a fixed linear offset // from the highest detected collision point each frame. @@ -46,7 +46,7 @@ public: static void init_type() { CollisionHandlerPhysical::init_type(); register_type(_type_handle, "CollisionHandlerFloor", - CollisionHandlerPhysical::get_class_type()); + CollisionHandlerPhysical::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandlerPhysical.h b/panda/src/collide/collisionHandlerPhysical.h index 3ecf31dde2..8e4af9fff9 100644 --- a/panda/src/collide/collisionHandlerPhysical.h +++ b/panda/src/collide/collisionHandlerPhysical.h @@ -16,7 +16,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CollisionHandlerPhysical +// Class : CollisionHandlerPhysical // Description : The abstract base class for a number of // CollisionHandlers that have some physical effect on // their moving bodies: they need to update the nodes' @@ -69,7 +69,7 @@ public: static void init_type() { CollisionHandlerEvent::init_type(); register_type(_type_handle, "CollisionHandlerPhysical", - CollisionHandlerEvent::get_class_type()); + CollisionHandlerEvent::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandlerPusher.cxx b/panda/src/collide/collisionHandlerPusher.cxx index 0a45394f0a..4c1d37b4a9 100644 --- a/panda/src/collide/collisionHandlerPusher.cxx +++ b/panda/src/collide/collisionHandlerPusher.cxx @@ -9,7 +9,7 @@ TypeHandle CollisionHandlerPusher::_type_handle; /////////////////////////////////////////////////////////////////// -// Class : ShoveData +// Class : ShoveData // Description : The ShoveData class is used within // CollisionHandlerPusher::handle_entries(), to track // multiple shoves onto a given collider. It's not @@ -64,8 +64,8 @@ handle_entries() { // it this CollisionHandler pointer--but they didn't tell us // about the node. collide_cat.error() - << "CollisionHandlerPusher doesn't know about " - << *from_node << "\n"; + << "CollisionHandlerPusher doesn't know about " + << *from_node << "\n"; } else { const ColliderDef &def = (*ci).second; @@ -83,94 +83,94 @@ handle_entries() { Entries::const_iterator ei; for (ei = entries.begin(); ei != entries.end(); ++ei) { - CollisionEntry *entry = (*ei); - nassertv(entry != (CollisionEntry *)NULL); - nassertv(from_node == entry->get_from_node()); + CollisionEntry *entry = (*ei); + nassertv(entry != (CollisionEntry *)NULL); + nassertv(from_node == entry->get_from_node()); - if (!entry->has_into_surface_normal() || - !entry->has_into_depth()) { - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Cannot shove on " << *from_node << " for collision into " - << *entry->get_into_node() << "; no normal/depth information.\n"; - } + if (!entry->has_into_surface_normal() || + !entry->has_into_depth()) { + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Cannot shove on " << *from_node << " for collision into " + << *entry->get_into_node() << "; no normal/depth information.\n"; + } - } else { - // Shove it just enough to clear the volume. - if (entry->get_into_depth() != 0.0) { - ShoveData sd; - sd._shove = - entry->get_into_surface_normal() * - entry->get_into_depth(); - - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Shove on " << *from_node << " from " - << *entry->get_into_node() << ": " << sd._shove << "\n"; - } + } else { + // Shove it just enough to clear the volume. + if (entry->get_into_depth() != 0.0) { + ShoveData sd; + sd._shove = + entry->get_into_surface_normal() * + entry->get_into_depth(); - sd._length = sd._shove.length(); - sd._normalized_shove = sd._shove / sd._length; - sd._valid = true; - - shoves.push_back(sd); - } - } + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Shove on " << *from_node << " from " + << *entry->get_into_node() << ": " << sd._shove << "\n"; + } + + sd._length = sd._shove.length(); + sd._normalized_shove = sd._shove / sd._length; + sd._valid = true; + + shoves.push_back(sd); + } + } } if (!shoves.empty()) { - // Now we combine any two shoves that shove in largely the - // same direction. Hacky. + // Now we combine any two shoves that shove in largely the + // same direction. Hacky. - Shoves::iterator si; - for (si = shoves.begin(); si != shoves.end(); ++si) { - ShoveData &sd = (*si); - Shoves::iterator sj; - for (sj = shoves.begin(); sj != si; ++sj) { - ShoveData &sd2 = (*sj); - if (sd2._valid) { + Shoves::iterator si; + for (si = shoves.begin(); si != shoves.end(); ++si) { + ShoveData &sd = (*si); + Shoves::iterator sj; + for (sj = shoves.begin(); sj != si; ++sj) { + ShoveData &sd2 = (*sj); + if (sd2._valid) { - float d = sd._normalized_shove.dot(sd2._normalized_shove); - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Considering dot product " << d << "\n"; - } + float d = sd._normalized_shove.dot(sd2._normalized_shove); + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Considering dot product " << d << "\n"; + } - if (d > 0.9) { - // These two shoves are largely in the same direction; - // save the larger of the two. - if (sd2._length < sd._length) { - sd2._valid = false; - } else { - sd._valid = false; - } - } - } - } - } + if (d > 0.9) { + // These two shoves are largely in the same direction; + // save the larger of the two. + if (sd2._length < sd._length) { + sd2._valid = false; + } else { + sd._valid = false; + } + } + } + } + } - // Now we can determine the net shove. - LVector3f net_shove(0.0, 0.0, 0.0); - for (si = shoves.begin(); si != shoves.end(); ++si) { - const ShoveData &sd = (*si); - if (sd._valid) { - net_shove += sd._shove; - } - } - - if (_horizontal) { - net_shove[2] = 0.0; - } + // Now we can determine the net shove. + LVector3f net_shove(0.0, 0.0, 0.0); + for (si = shoves.begin(); si != shoves.end(); ++si) { + const ShoveData &sd = (*si); + if (sd._valid) { + net_shove += sd._shove; + } + } + + if (_horizontal) { + net_shove[2] = 0.0; + } - if (collide_cat.is_debug()) { - collide_cat.debug() - << "Net shove on " << *from_node << " is: " - << net_shove << "\n"; - } - - LMatrix4f mat; - def.get_mat(mat); - def.set_mat(LMatrix4f::translate_mat(net_shove) * mat); + if (collide_cat.is_debug()) { + collide_cat.debug() + << "Net shove on " << *from_node << " is: " + << net_shove << "\n"; + } + + LMatrix4f mat; + def.get_mat(mat); + def.set_mat(LMatrix4f::translate_mat(net_shove) * mat); } } } diff --git a/panda/src/collide/collisionHandlerPusher.h b/panda/src/collide/collisionHandlerPusher.h index f7952122cb..d9825d50eb 100644 --- a/panda/src/collide/collisionHandlerPusher.h +++ b/panda/src/collide/collisionHandlerPusher.h @@ -12,7 +12,7 @@ #include "collisionNode.h" /////////////////////////////////////////////////////////////////// -// Class : CollisionHandlerPusher +// Class : CollisionHandlerPusher // Description : A specialized kind of CollisionHandler that simply // pushes back on things that attempt to move into solid // walls. This is the simplest kind of "real-world" @@ -40,7 +40,7 @@ public: static void init_type() { CollisionHandlerPhysical::init_type(); register_type(_type_handle, "CollisionHandlerPusher", - CollisionHandlerPhysical::get_class_type()); + CollisionHandlerPhysical::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionHandlerQueue.h b/panda/src/collide/collisionHandlerQueue.h index fcf23e9584..eeeb6a3f46 100644 --- a/panda/src/collide/collisionHandlerQueue.h +++ b/panda/src/collide/collisionHandlerQueue.h @@ -12,7 +12,7 @@ #include "collisionEntry.h" /////////////////////////////////////////////////////////////////// -// Class : CollisionHandlerQueue +// Class : CollisionHandlerQueue // Description : A special kind of CollisionHandler that does nothing // except remember the CollisionEntries detected the // last pass. This set of CollisionEntries may then be @@ -46,7 +46,7 @@ public: static void init_type() { CollisionHandler::init_type(); register_type(_type_handle, "CollisionHandlerQueue", - CollisionHandler::get_class_type()); + CollisionHandler::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionLevelState.cxx b/panda/src/collide/collisionLevelState.cxx index 59992ec2d4..66392dd6ab 100644 --- a/panda/src/collide/collisionLevelState.cxx +++ b/panda/src/collide/collisionLevelState.cxx @@ -73,7 +73,7 @@ xform(const LMatrix4f &mat) { new_bounds.reserve(num_colliders); for (int c = 0; c < num_colliders; c++) { if (!has_collider(c) || - get_local_bound(c) == (GeometricBoundingVolume *)NULL) { + get_local_bound(c) == (GeometricBoundingVolume *)NULL) { new_bounds.push_back((GeometricBoundingVolume *)NULL); } else { const GeometricBoundingVolume *old_bound = get_local_bound(c); diff --git a/panda/src/collide/collisionNode.cxx b/panda/src/collide/collisionNode.cxx index 5cc52f8a70..62da7b4b9a 100644 --- a/panda/src/collide/collisionNode.cxx +++ b/panda/src/collide/collisionNode.cxx @@ -173,7 +173,7 @@ recompute_bound() { << "Cannot put " << _bound->get_type() << " around:\n"; for (int i = 0; i < (int)child_volumes.size(); i++) { collide_cat.error(false) - << " " << *child_volumes[i] << "\n"; + << " " << *child_volumes[i] << "\n"; } } #endif diff --git a/panda/src/collide/collisionNode.h b/panda/src/collide/collisionNode.h index ac8baf0955..e59b32ae8a 100644 --- a/panda/src/collide/collisionNode.h +++ b/panda/src/collide/collisionNode.h @@ -66,7 +66,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_CollisionNode(const FactoryParams ¶ms); @@ -80,7 +80,7 @@ public: static void init_type(void) { NamedNode::init_type(); register_type(_type_handle, "CollisionNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/collide/collisionPlane.cxx b/panda/src/collide/collisionPlane.cxx index aac7da009c..50b88bfb9b 100644 --- a/panda/src/collide/collisionPlane.cxx +++ b/panda/src/collide/collisionPlane.cxx @@ -39,7 +39,7 @@ make_copy() { //////////////////////////////////////////////////////////////////// int CollisionPlane:: test_intersection(CollisionHandler *, const CollisionEntry &, - const CollisionSolid *) const { + const CollisionSolid *) const { // Planes cannot currently be intersected from, only into. Do not // add a CollisionPlane to a CollisionTraverser. nassertr(false, 0); @@ -105,7 +105,7 @@ recompute_bound() { //////////////////////////////////////////////////////////////////// int CollisionPlane:: test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { const CollisionSphere *sphere; DCAST_INTO_R(sphere, entry.get_from(), 0); @@ -144,7 +144,7 @@ test_intersection_from_sphere(CollisionHandler *record, //////////////////////////////////////////////////////////////////// int CollisionPlane:: test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { const CollisionRay *ray; DCAST_INTO_R(ray, entry.get_from(), 0); diff --git a/panda/src/collide/collisionPlane.h b/panda/src/collide/collisionPlane.h index c5e644fcd2..74ee456505 100644 --- a/panda/src/collide/collisionPlane.h +++ b/panda/src/collide/collisionPlane.h @@ -14,7 +14,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CollisionPlane +// Class : CollisionPlane // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA CollisionPlane : public CollisionSolid { @@ -30,8 +30,8 @@ public: virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const; + const CollisionEntry &entry, + const CollisionSolid *into) const; virtual void xform(const LMatrix4f &mat); virtual LPoint3f get_collision_origin() const; @@ -51,10 +51,10 @@ protected: protected: virtual int test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual void recompute_viz(Node *parent); @@ -77,7 +77,7 @@ public: static void init_type() { CollisionSolid::init_type(); register_type(_type_handle, "CollisionPlane", - CollisionSolid::get_class_type()); + CollisionSolid::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionPolygon.I b/panda/src/collide/collisionPolygon.I index cb9011de54..9f5850c4e7 100644 --- a/panda/src/collide/collisionPolygon.I +++ b/panda/src/collide/collisionPolygon.I @@ -10,7 +10,7 @@ //////////////////////////////////////////////////////////////////// INLINE CollisionPolygon:: CollisionPolygon(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c) { + const LPoint3f &c) { LPoint3f array[3]; array[0] = a; array[1] = b; @@ -25,7 +25,7 @@ CollisionPolygon(const LPoint3f &a, const LPoint3f &b, //////////////////////////////////////////////////////////////////// INLINE CollisionPolygon:: CollisionPolygon(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c, const LPoint3f &d) { + const LPoint3f &c, const LPoint3f &d) { LPoint3f array[4]; array[0] = a; array[1] = b; @@ -63,7 +63,7 @@ CollisionPolygon(void) { //////////////////////////////////////////////////////////////////// INLINE bool CollisionPolygon:: verify_points(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c) { + const LPoint3f &c) { LPoint3f array[3]; array[0] = a; array[1] = b; @@ -80,7 +80,7 @@ verify_points(const LPoint3f &a, const LPoint3f &b, //////////////////////////////////////////////////////////////////// INLINE bool CollisionPolygon:: verify_points(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c, const LPoint3f &d) { + const LPoint3f &c, const LPoint3f &d) { LPoint3f array[4]; array[0] = a; array[1] = b; diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index 1e33233485..54569c6931 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -95,9 +95,9 @@ verify_points(const LPoint3f *begin, const LPoint3f *end) { // Make sure no points are repeated. const LPoint3f *pj; for (pj = begin; pj != pi && all_ok; ++pj) { - if ((*pj).almost_equal(*pi)) { - all_ok = false; - } + if ((*pj).almost_equal(*pi)) { + all_ok = false; + } } } } @@ -112,7 +112,7 @@ verify_points(const LPoint3f *begin, const LPoint3f *end) { //////////////////////////////////////////////////////////////////// int CollisionPolygon:: test_intersection(CollisionHandler *, const CollisionEntry &, - const CollisionSolid *into) const { + const CollisionSolid *into) const { // Polygons cannot currently be intersected from, only into. Do not // add a CollisionPolygon to a CollisionTraverser. nassertr(false, 0); @@ -136,7 +136,7 @@ xform(const LMatrix4f &mat) { mat.write(collide_cat.debug(false), 2); if (_points.empty()) { collide_cat.debug(false) - << " (no points)\n"; + << " (no points)\n"; } } @@ -215,7 +215,7 @@ recompute_bound() { //////////////////////////////////////////////////////////////////// int CollisionPolygon:: test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { if (_points.size() < 3) { return 0; } @@ -241,7 +241,7 @@ test_intersection_from_sphere(CollisionHandler *record, LPoint3f plane_point; bool really_intersects = get_plane().intersects_line(plane_point, - from_center, from_center + get_normal()); + from_center, from_center + get_normal()); nassertr(really_intersects, 0); LPoint2f p = to_2d(plane_point); @@ -278,23 +278,23 @@ test_intersection_from_sphere(CollisionHandler *record, float rim_length = length(rim); if (rim_length <= from_radius) { - // Here's a surprise: the center of the polygon is within the - // circle! Since the center is guaranteed to be interior to the - // polygon (the polygon is convex), it follows that the circle - // intersects the polygon. + // Here's a surprise: the center of the polygon is within the + // circle! Since the center is guaranteed to be interior to the + // polygon (the polygon is convex), it follows that the circle + // intersects the polygon. } else { - // Now scale this vector to length radius, and get the new point. - rim = (rim * from_radius / rim_length) + p; + // Now scale this vector to length radius, and get the new point. + rim = (rim * from_radius / rim_length) + p; - // Is the new point within the polygon? - if (is_inside(rim)) { - // It sure is! The circle intersects! + // Is the new point within the polygon? + if (is_inside(rim)) { + // It sure is! The circle intersects! - } else { - // No intersection. - return 0; - } + } else { + // No intersection. + return 0; + } } } } @@ -323,7 +323,7 @@ test_intersection_from_sphere(CollisionHandler *record, //////////////////////////////////////////////////////////////////// int CollisionPolygon:: test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { if (_points.size() < 3) { return 0; } @@ -371,7 +371,7 @@ test_intersection_from_ray(CollisionHandler *record, //////////////////////////////////////////////////////////////////// int CollisionPolygon:: test_intersection_from_segment(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { if (_points.size() < 3) { return 0; } @@ -430,7 +430,7 @@ recompute_viz(Node *parent) { if (_points.size() < 3) { if (collide_cat.is_debug()) { collide_cat.debug() - << "(Degenerate poly, ignoring.)\n"; + << "(Degenerate poly, ignoring.)\n"; } return; } @@ -477,7 +477,7 @@ is_inside(const LPoint2f &p) const { } } if (is_right(p - _points[_points.size() - 1], - _points[0] - _points[_points.size() - 1])) { + _points[0] - _points[_points.size() - 1])) { return false; } @@ -552,10 +552,10 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) { collide_cat.error() << "Invalid points in CollisionPolygon:\n"; const LPoint3f *pi; for (pi = begin; pi != end; ++pi) { - collide_cat.error(false) << " " << (*pi) << "\n"; + collide_cat.error(false) << " " << (*pi) << "\n"; } collide_cat.error(false) - << " normal " << normal << " with length " << normal.length() << "\n"; + << " normal " << normal << " with length " << normal.length() << "\n"; return; } @@ -701,16 +701,16 @@ to_3d(const LPoint2f &point2d) const { switch (_axis) { case AT_x: return LPoint3f(-(normal[1]*point2d[0] + normal[2]*point2d[1] + D)/normal[0], - point2d[0], point2d[1]); + point2d[0], point2d[1]); case AT_y: return LPoint3f(point2d[0], - -(normal[0]*point2d[0] + normal[2]*point2d[1] + D)/normal[1], - point2d[1]); + -(normal[0]*point2d[0] + normal[2]*point2d[1] + D)/normal[1], + point2d[1]); case AT_z: return LPoint3f(point2d[0], point2d[1], - -(normal[0]*point2d[0] + normal[1]*point2d[1] + D)/normal[2]); + -(normal[0]*point2d[0] + normal[1]*point2d[1] + D)/normal[2]); } nassertr(false, LPoint3f(0.0f, 0.0f, 0.0f)); diff --git a/panda/src/collide/collisionPolygon.h b/panda/src/collide/collisionPolygon.h index 21d5fb36fa..77483153e3 100644 --- a/panda/src/collide/collisionPolygon.h +++ b/panda/src/collide/collisionPolygon.h @@ -13,15 +13,15 @@ #include /////////////////////////////////////////////////////////////////// -// Class : CollisionPolygon +// Class : CollisionPolygon // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA CollisionPolygon : public CollisionPlane { PUBLISHED: INLINE CollisionPolygon(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c); + const LPoint3f &c); INLINE CollisionPolygon(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c, const LPoint3f &d); + const LPoint3f &c, const LPoint3f &d); INLINE CollisionPolygon(const LPoint3f *begin, const LPoint3f *end); public: @@ -30,16 +30,16 @@ public: virtual CollisionSolid *make_copy(); INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c); + const LPoint3f &c); INLINE static bool verify_points(const LPoint3f &a, const LPoint3f &b, - const LPoint3f &c, const LPoint3f &d); + const LPoint3f &c, const LPoint3f &d); static bool verify_points(const LPoint3f *begin, const LPoint3f *end); virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const; + const CollisionEntry &entry, + const CollisionSolid *into) const; virtual void xform(const LMatrix4f &mat); virtual LPoint3f get_collision_origin() const; @@ -53,13 +53,13 @@ protected: protected: virtual int test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_segment(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual void recompute_viz(Node *parent); @@ -98,7 +98,7 @@ public: static void init_type() { CollisionPlane::init_type(); register_type(_type_handle, "CollisionPolygon", - CollisionPlane::get_class_type()); + CollisionPlane::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionRay.I b/panda/src/collide/collisionRay.I index ce92a038aa..10875176ea 100644 --- a/panda/src/collide/collisionRay.I +++ b/panda/src/collide/collisionRay.I @@ -36,7 +36,7 @@ CollisionRay(const LPoint3f &origin, const LVector3f &direction) : //////////////////////////////////////////////////////////////////// INLINE CollisionRay:: CollisionRay(float ox, float oy, float oz, - float dx, float dy, float dz) : + float dx, float dy, float dz) : _origin(ox, oy, oz), _direction(dx, dy, dz) { } diff --git a/panda/src/collide/collisionRay.cxx b/panda/src/collide/collisionRay.cxx index 4aa7027c08..daf7b8a53e 100644 --- a/panda/src/collide/collisionRay.cxx +++ b/panda/src/collide/collisionRay.cxx @@ -35,7 +35,7 @@ make_copy() { //////////////////////////////////////////////////////////////////// int CollisionRay:: test_intersection(CollisionHandler *record, const CollisionEntry &entry, - const CollisionSolid *into) const { + const CollisionSolid *into) const { return into->test_intersection_from_ray(record, entry); } @@ -135,7 +135,7 @@ recompute_viz(Node *parent) { for (int i = 0; i < 100; i++) { verts.push_back(_origin + (double)i * _direction); colors.push_back(Colorf(1.0, 1.0, 1.0, 1.0) + - ((double)i / 100.0) * Colorf(0.0, 0.0, 0.0, -1.0)); + ((double)i / 100.0) * Colorf(0.0, 0.0, 0.0, -1.0)); } ray->set_coords(verts, G_PER_VERTEX); ray->set_colors(colors, G_PER_VERTEX); diff --git a/panda/src/collide/collisionRay.h b/panda/src/collide/collisionRay.h index 1507451f17..c6d3a92a7c 100644 --- a/panda/src/collide/collisionRay.h +++ b/panda/src/collide/collisionRay.h @@ -13,7 +13,7 @@ class ProjectionNode; /////////////////////////////////////////////////////////////////// -// Class : CollisionRay +// Class : CollisionRay // Description : An infinite ray, with a specific origin and // direction. It begins at its origin and continues in // one direction to infinity, and it has no radius. @@ -25,7 +25,7 @@ PUBLISHED: INLINE CollisionRay(); INLINE CollisionRay(const LPoint3f &origin, const LVector3f &direction); INLINE CollisionRay(float ox, float oy, float oz, - float dx, float dy, float dz); + float dx, float dy, float dz); public: INLINE CollisionRay(const CollisionRay ©); @@ -33,8 +33,8 @@ public: virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const; + const CollisionEntry &entry, + const CollisionSolid *into) const; virtual void xform(const LMatrix4f &mat); virtual LPoint3f get_collision_origin() const; @@ -70,7 +70,7 @@ public: static void init_type() { CollisionSolid::init_type(); register_type(_type_handle, "CollisionRay", - CollisionSolid::get_class_type()); + CollisionSolid::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionSegment.I b/panda/src/collide/collisionSegment.I index 1dfae6e29d..d3c8bc33fa 100644 --- a/panda/src/collide/collisionSegment.I +++ b/panda/src/collide/collisionSegment.I @@ -36,7 +36,7 @@ CollisionSegment(const LPoint3f &a, const LPoint3f &b) : //////////////////////////////////////////////////////////////////// INLINE CollisionSegment:: CollisionSegment(float ax, float ay, float az, - float bx, float by, float bz) : + float bx, float by, float bz) : _a(ax, ay, az), _b(bx, by, bz) { } diff --git a/panda/src/collide/collisionSegment.cxx b/panda/src/collide/collisionSegment.cxx index d8dc9ad1b8..63306d7f9a 100644 --- a/panda/src/collide/collisionSegment.cxx +++ b/panda/src/collide/collisionSegment.cxx @@ -35,7 +35,7 @@ make_copy() { //////////////////////////////////////////////////////////////////// int CollisionSegment:: test_intersection(CollisionHandler *record, const CollisionEntry &entry, - const CollisionSolid *into) const { + const CollisionSolid *into) const { return into->test_intersection_from_segment(record, entry); } diff --git a/panda/src/collide/collisionSegment.h b/panda/src/collide/collisionSegment.h index 8729da4045..d7504c9d27 100644 --- a/panda/src/collide/collisionSegment.h +++ b/panda/src/collide/collisionSegment.h @@ -13,7 +13,7 @@ class ProjectionNode; /////////////////////////////////////////////////////////////////// -// Class : CollisionSegment +// Class : CollisionSegment // Description : A finite line segment, with two specific endpoints // but no thickness. It's similar to a CollisionRay, // except it does not continue to infinity. @@ -28,7 +28,7 @@ PUBLISHED: INLINE CollisionSegment(); INLINE CollisionSegment(const LPoint3f &a, const LPoint3f &db); INLINE CollisionSegment(float ax, float ay, float az, - float bx, float by, float bz); + float bx, float by, float bz); public: INLINE CollisionSegment(const CollisionSegment ©); @@ -36,8 +36,8 @@ public: virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const; + const CollisionEntry &entry, + const CollisionSolid *into) const; virtual void xform(const LMatrix4f &mat); virtual LPoint3f get_collision_origin() const; @@ -72,7 +72,7 @@ public: static void init_type() { CollisionSolid::init_type(); register_type(_type_handle, "CollisionSegment", - CollisionSolid::get_class_type()); + CollisionSolid::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionSolid.cxx b/panda/src/collide/collisionSolid.cxx index 635a2dd0b0..39519bee2b 100644 --- a/panda/src/collide/collisionSolid.cxx +++ b/panda/src/collide/collisionSolid.cxx @@ -101,9 +101,9 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// int CollisionSolid:: test_intersection_from_sphere(CollisionHandler *, - const CollisionEntry &) const { + const CollisionEntry &) const { report_undefined_intersection_test(CollisionSphere::get_class_type(), - get_type()); + get_type()); return 0; } @@ -114,9 +114,9 @@ test_intersection_from_sphere(CollisionHandler *, //////////////////////////////////////////////////////////////////// int CollisionSolid:: test_intersection_from_ray(CollisionHandler *, - const CollisionEntry &) const { + const CollisionEntry &) const { report_undefined_intersection_test(CollisionRay::get_class_type(), - get_type()); + get_type()); return 0; } @@ -127,9 +127,9 @@ test_intersection_from_ray(CollisionHandler *, //////////////////////////////////////////////////////////////////// int CollisionSolid:: test_intersection_from_segment(CollisionHandler *, - const CollisionEntry &) const { + const CollisionEntry &) const { report_undefined_intersection_test(CollisionSegment::get_class_type(), - get_type()); + get_type()); return 0; } diff --git a/panda/src/collide/collisionSolid.h b/panda/src/collide/collisionSolid.h index 2d5b8d36a0..0e018761f5 100644 --- a/panda/src/collide/collisionSolid.h +++ b/panda/src/collide/collisionSolid.h @@ -24,7 +24,7 @@ class GeomNode; class CollisionNode; /////////////////////////////////////////////////////////////////// -// Class : CollisionSolid +// Class : CollisionSolid // Description : The abstract base class for all things that can // collide with other things in the world, and all the // things they can collide with (except geometry). @@ -53,8 +53,8 @@ PUBLISHED: public: virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const=0; + const CollisionEntry &entry, + const CollisionSolid *into) const=0; virtual void xform(const LMatrix4f &mat)=0; @@ -67,17 +67,17 @@ PUBLISHED: protected: virtual int test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_segment(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; static void report_undefined_intersection_test(TypeHandle from_type, - TypeHandle into_type); + TypeHandle into_type); INLINE void mark_viz_stale(); void clear_viz_arcs(); @@ -108,8 +108,8 @@ public: TypedWritableReferenceCount::init_type(); BoundedObject::init_type(); register_type(_type_handle, "CollisionSolid", - TypedWritableReferenceCount::get_class_type(), - BoundedObject::get_class_type()); + TypedWritableReferenceCount::get_class_type(), + BoundedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 89d73699d7..2341e44810 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -38,7 +38,7 @@ make_copy() { //////////////////////////////////////////////////////////////////// int CollisionSphere:: test_intersection(CollisionHandler *record, const CollisionEntry &entry, - const CollisionSolid *into) const { + const CollisionSolid *into) const { return into->test_intersection_from_sphere(record, entry); } @@ -104,7 +104,7 @@ recompute_bound() { //////////////////////////////////////////////////////////////////// int CollisionSphere:: test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { const CollisionSphere *sphere; DCAST_INTO_R(sphere, entry.get_from(), 0); @@ -150,7 +150,7 @@ test_intersection_from_sphere(CollisionHandler *record, //////////////////////////////////////////////////////////////////// int CollisionSphere:: test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { const CollisionRay *ray; DCAST_INTO_R(ray, entry.get_from(), 0); @@ -194,7 +194,7 @@ test_intersection_from_ray(CollisionHandler *record, //////////////////////////////////////////////////////////////////// int CollisionSphere:: test_intersection_from_segment(CollisionHandler *record, - const CollisionEntry &entry) const { + const CollisionEntry &entry) const { const CollisionSegment *segment; DCAST_INTO_R(segment, entry.get_from(), 0); @@ -278,7 +278,7 @@ recompute_viz(Node *parent) { //////////////////////////////////////////////////////////////////// bool CollisionSphere:: intersects_line(double &t1, double &t2, - const LPoint3f &from, const LVector3f &delta) const { + const LPoint3f &from, const LVector3f &delta) const { // Solve the equation for the intersection of a line with a sphere // using the quadratic formula. diff --git a/panda/src/collide/collisionSphere.h b/panda/src/collide/collisionSphere.h index abe7e45c3c..657911c6e7 100644 --- a/panda/src/collide/collisionSphere.h +++ b/panda/src/collide/collisionSphere.h @@ -11,7 +11,7 @@ #include "collisionSolid.h" /////////////////////////////////////////////////////////////////// -// Class : CollisionSphere +// Class : CollisionSphere // Description : A spherical collision volume or object. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA CollisionSphere : public CollisionSolid { @@ -25,8 +25,8 @@ public: virtual int test_intersection(CollisionHandler *record, - const CollisionEntry &entry, - const CollisionSolid *into) const; + const CollisionEntry &entry, + const CollisionSolid *into) const; virtual void xform(const LMatrix4f &mat); virtual LPoint3f get_collision_origin() const; @@ -48,18 +48,18 @@ protected: protected: virtual int test_intersection_from_sphere(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_ray(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual int test_intersection_from_segment(CollisionHandler *record, - const CollisionEntry &entry) const; + const CollisionEntry &entry) const; virtual void recompute_viz(Node *parent); bool intersects_line(double &t1, double &t2, - const LPoint3f &from, const LVector3f &delta) const; + const LPoint3f &from, const LVector3f &delta) const; private: LPoint3f _center; @@ -80,7 +80,7 @@ public: static void init_type() { CollisionSolid::init_type(); register_type(_type_handle, "CollisionSphere", - CollisionSolid::get_class_type()); + CollisionSolid::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 3b8e6efbe3..f2f6fa2258 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -76,14 +76,14 @@ add_collider(CollisionNode *node, CollisionHandler *handler) { (*hi).second--; nassertv((*hi).second >= 0); if ((*hi).second == 0) { - _handlers.erase(hi); + _handlers.erase(hi); } hi = _handlers.find(handler); if (hi == _handlers.end()) { - _handlers.insert(Handlers::value_type(handler, 1)); + _handlers.insert(Handlers::value_type(handler, 1)); } else { - (*hi).second++; + (*hi).second++; } } @@ -240,7 +240,7 @@ traverse(const NodePath &root) { } df_traverse(root.node(), *this, NullAttributeWrapper(), - level_state, _graph_type); + level_state, _graph_type); for (hi = _handlers.begin(); hi != _handlers.end(); ++hi) { (*hi).first->end_group(); @@ -307,21 +307,21 @@ prepare_colliders(CollisionLevelState &level_state) { #ifndef NDEBUG if (def._space.is_nan()) { collide_cat.error() - << "Collider " << *cnode - << " has become NaN. Dropping from traverser.\n"; + << "Collider " << *cnode + << " has become NaN. Dropping from traverser.\n"; // This is safe to do while traversing the list of colliders, // because we do not increment i in this case. remove_collider(cnode); } else #endif { - int num_solids = cnode->get_num_solids(); - for (int s = 0; s < num_solids; s++) { - CollisionSolid *collider = cnode->get_solid(s); - def._collider = collider; - level_state.prepare_collider(def); - } - i++; + int num_solids = cnode->get_num_solids(); + for (int s = 0; s < num_solids; s++) { + CollisionSolid *collider = cnode->get_solid(s); + def._collider = collider; + level_state.prepare_collider(def); + } + i++; } } } @@ -333,7 +333,7 @@ prepare_colliders(CollisionLevelState &level_state) { //////////////////////////////////////////////////////////////////// bool CollisionTraverser:: reached_node(Node *node, NullAttributeWrapper &, - CollisionLevelState &level_state) { + CollisionLevelState &level_state) { if (node->is_of_type(CollisionNode::get_class_type())) { level_state.reached_collision_node(); @@ -353,29 +353,29 @@ reached_node(Node *node, NullAttributeWrapper &, int num_colliders = level_state.get_num_colliders(); for (int c = 0; c < num_colliders; c++) { if (level_state.has_collider(c)) { - entry._from_node = level_state.get_node(c); + entry._from_node = level_state.get_node(c); + + if ((entry._from_node->get_from_collide_mask() & + cnode->get_into_collide_mask()) != 0) { + entry._from = level_state.get_collider(c); + entry._from_space = level_state.get_space(c); - if ((entry._from_node->get_from_collide_mask() & - cnode->get_into_collide_mask()) != 0) { - entry._from = level_state.get_collider(c); - entry._from_space = level_state.get_space(c); - NodePath root; - LMatrix4f into_space_inv = root.get_mat(entry._into_node_path); - entry._wrt_space = entry._from_space * into_space_inv; - entry._inv_wrt_space = - entry._into_space * level_state.get_inv_space(c); - - const GeometricBoundingVolume *col_gbv = - level_state.get_local_bound(c); - - compare_collider_to_node(entry, col_gbv, node_gbv); - } + LMatrix4f into_space_inv = root.get_mat(entry._into_node_path); + entry._wrt_space = entry._from_space * into_space_inv; + entry._inv_wrt_space = + entry._into_space * level_state.get_inv_space(c); + + const GeometricBoundingVolume *col_gbv = + level_state.get_local_bound(c); + + compare_collider_to_node(entry, col_gbv, node_gbv); + } } } } else if (node->is_of_type(GeomNode::get_class_type()) && - level_state.has_any_collide_geom()) { + level_state.has_any_collide_geom()) { GeomNode *gnode; DCAST_INTO_R(gnode, node, false); const BoundingVolume &node_bv = gnode->get_bound(); @@ -391,21 +391,21 @@ reached_node(Node *node, NullAttributeWrapper &, int num_colliders = level_state.get_num_colliders(); for (int c = 0; c < num_colliders; c++) { if (level_state.has_collider_with_geom(c)) { - entry._from_node = level_state.get_node(c); + entry._from_node = level_state.get_node(c); - entry._from = level_state.get_collider(c); - entry._from_space = level_state.get_space(c); - - LMatrix4f into_space_inv; - get_rel_mat(NULL, node, into_space_inv, _graph_type); - entry._wrt_space = entry._from_space * into_space_inv; - entry._inv_wrt_space = - entry._into_space * level_state.get_inv_space(c); - - const GeometricBoundingVolume *col_gbv = - level_state.get_local_bound(c); - - compare_collider_to_geom_node(entry, col_gbv, node_gbv); + entry._from = level_state.get_collider(c); + entry._from_space = level_state.get_space(c); + + LMatrix4f into_space_inv; + get_rel_mat(NULL, node, into_space_inv, _graph_type); + entry._wrt_space = entry._from_space * into_space_inv; + entry._inv_wrt_space = + entry._into_space * level_state.get_inv_space(c); + + const GeometricBoundingVolume *col_gbv = + level_state.get_local_bound(c); + + compare_collider_to_geom_node(entry, col_gbv, node_gbv); } } } @@ -420,8 +420,8 @@ reached_node(Node *node, NullAttributeWrapper &, //////////////////////////////////////////////////////////////////// bool CollisionTraverser:: forward_arc(NodeRelation *arc, NullTransitionWrapper &, - NullAttributeWrapper &, NullAttributeWrapper &, - CollisionLevelState &level_state) { + NullAttributeWrapper &, NullAttributeWrapper &, + CollisionLevelState &level_state) { // Check the bounding volume on the arc against each of our // colliders. const BoundingVolume &arc_bv = arc->get_bound(); @@ -432,15 +432,15 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, int num_colliders = level_state.get_num_colliders(); for (int c = 0; c < num_colliders; c++) { if (level_state.has_collider(c)) { - const GeometricBoundingVolume *col_gbv = - level_state.get_local_bound(c); - if (col_gbv != (GeometricBoundingVolume *)NULL) { - if (arc_gbv->contains(col_gbv) == 0) { - // This collider certainly does not intersect with any - // geometry at this arc or below. - level_state.omit_collider(c); - } - } + const GeometricBoundingVolume *col_gbv = + level_state.get_local_bound(c); + if (col_gbv != (GeometricBoundingVolume *)NULL) { + if (arc_gbv->contains(col_gbv) == 0) { + // This collider certainly does not intersect with any + // geometry at this arc or below. + level_state.omit_collider(c); + } + } } } } @@ -472,14 +472,14 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, //////////////////////////////////////////////////////////////////// void CollisionTraverser:: compare_collider_to_node(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *into_node_gbv) { + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *into_node_gbv) { bool within_node_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL && into_node_gbv != (GeometricBoundingVolume *)NULL) { within_node_bounds = (into_node_gbv->contains(from_node_gbv) != 0); } - + if (within_node_bounds) { CollisionNode *cnode; DCAST_INTO_V(cnode, entry._into_node); @@ -487,19 +487,19 @@ compare_collider_to_node(CollisionEntry &entry, for (int s = 0; s < num_solids; s++) { entry._into = cnode->get_solid(s); if (entry._from != entry._into) { - const BoundingVolume &solid_bv = entry._into->get_bound(); - const GeometricBoundingVolume *solid_gbv = NULL; - if (num_solids > 1 && - solid_bv.is_of_type(GeometricBoundingVolume::get_class_type())) { - // Only bother to test against each solid's bounding - // volume if we have more than one solid in the node, as a - // slight optimization. (If the node contains just one - // solid, then the node's bounding volume, which we just - // tested, is the same as the solid's bounding volume.) - DCAST_INTO_V(solid_gbv, &solid_bv); - } - - compare_collider_to_solid(entry, from_node_gbv, solid_gbv); + const BoundingVolume &solid_bv = entry._into->get_bound(); + const GeometricBoundingVolume *solid_gbv = NULL; + if (num_solids > 1 && + solid_bv.is_of_type(GeometricBoundingVolume::get_class_type())) { + // Only bother to test against each solid's bounding + // volume if we have more than one solid in the node, as a + // slight optimization. (If the node contains just one + // solid, then the node's bounding volume, which we just + // tested, is the same as the solid's bounding volume.) + DCAST_INTO_V(solid_gbv, &solid_bv); + } + + compare_collider_to_solid(entry, from_node_gbv, solid_gbv); } } } @@ -512,14 +512,14 @@ compare_collider_to_node(CollisionEntry &entry, //////////////////////////////////////////////////////////////////// void CollisionTraverser:: compare_collider_to_geom_node(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *into_node_gbv) { + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *into_node_gbv) { bool within_node_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL && into_node_gbv != (GeometricBoundingVolume *)NULL) { within_node_bounds = (into_node_gbv->contains(from_node_gbv) != 0); } - + if (within_node_bounds) { GeomNode *gnode; DCAST_INTO_V(gnode, entry._into_node); @@ -528,19 +528,19 @@ compare_collider_to_geom_node(CollisionEntry &entry, entry._into = (CollisionSolid *)NULL; Geom *geom = DCAST(Geom, gnode->get_geom(s)); if (geom != (Geom *)NULL) { - const BoundingVolume &geom_bv = geom->get_bound(); - const GeometricBoundingVolume *geom_gbv = NULL; - if (num_geoms > 1 && - geom_bv.is_of_type(GeometricBoundingVolume::get_class_type())) { - // Only bother to test against each geom's bounding - // volume if we have more than one geom in the node, as a - // slight optimization. (If the node contains just one - // geom, then the node's bounding volume, which we just - // tested, is the same as the geom's bounding volume.) - DCAST_INTO_V(geom_gbv, &geom_bv); - } - - compare_collider_to_geom(entry, geom, from_node_gbv, geom_gbv); + const BoundingVolume &geom_bv = geom->get_bound(); + const GeometricBoundingVolume *geom_gbv = NULL; + if (num_geoms > 1 && + geom_bv.is_of_type(GeometricBoundingVolume::get_class_type())) { + // Only bother to test against each geom's bounding + // volume if we have more than one geom in the node, as a + // slight optimization. (If the node contains just one + // geom, then the node's bounding volume, which we just + // tested, is the same as the geom's bounding volume.) + DCAST_INTO_V(geom_gbv, &geom_bv); + } + + compare_collider_to_geom(entry, geom, from_node_gbv, geom_gbv); } } } @@ -553,8 +553,8 @@ compare_collider_to_geom_node(CollisionEntry &entry, //////////////////////////////////////////////////////////////////// void CollisionTraverser:: compare_collider_to_solid(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *solid_gbv) { + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *solid_gbv) { bool within_solid_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL && solid_gbv != (GeometricBoundingVolume *)NULL) { @@ -575,8 +575,8 @@ compare_collider_to_solid(CollisionEntry &entry, //////////////////////////////////////////////////////////////////// void CollisionTraverser:: compare_collider_to_geom(CollisionEntry &entry, Geom *geom, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *geom_gbv) { + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *geom_gbv) { bool within_geom_bounds = true; if (from_node_gbv != (GeometricBoundingVolume *)NULL && geom_gbv != (GeometricBoundingVolume *)NULL) { @@ -595,15 +595,15 @@ compare_collider_to_geom(CollisionEntry &entry, Geom *geom, for (int i = 0; i < (int)tris.size(); i += 3) { if (CollisionPolygon::verify_points(coords[tris[i]], - coords[tris[i + 1]], - coords[tris[i + 2]])) { - // Generate a temporary CollisionPolygon on the fly for each - // triangle in the Geom. - CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]], - coords[tris[i + 2]]); - if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) { - return; - } + coords[tris[i + 1]], + coords[tris[i + 2]])) { + // Generate a temporary CollisionPolygon on the fly for each + // triangle in the Geom. + CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]], + coords[tris[i + 2]]); + if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) { + return; + } } } } diff --git a/panda/src/collide/collisionTraverser.h b/panda/src/collide/collisionTraverser.h index 5128851120..a7fcadd770 100644 --- a/panda/src/collide/collisionTraverser.h +++ b/panda/src/collide/collisionTraverser.h @@ -26,7 +26,7 @@ class Geom; class NodePath; //////////////////////////////////////////////////////////////////// -// Class : CollisionTraverser +// Class : CollisionTraverser // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA CollisionTraverser : @@ -57,25 +57,25 @@ public: // behavior of the CollisionTraverser as it traverses the graph. // Normally you would never call these directly. bool reached_node(Node *node, NullAttributeWrapper &render_state, - CollisionLevelState &level_state); + CollisionLevelState &level_state); bool forward_arc(NodeRelation *arc, NullTransitionWrapper &trans, - NullAttributeWrapper &pre, NullAttributeWrapper &post, - CollisionLevelState &level_state); + NullAttributeWrapper &pre, NullAttributeWrapper &post, + CollisionLevelState &level_state); private: void compare_collider_to_node(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *into_node_gbv); + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *into_node_gbv); void compare_collider_to_geom_node(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *into_node_gbv); + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *into_node_gbv); void compare_collider_to_solid(CollisionEntry &entry, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *solid_gbv); + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *solid_gbv); void compare_collider_to_geom(CollisionEntry &entry, Geom *geom, - const GeometricBoundingVolume *from_node_gbv, - const GeometricBoundingVolume *solid_gbv); + const GeometricBoundingVolume *from_node_gbv, + const GeometricBoundingVolume *solid_gbv); private: PT(CollisionHandler) _default_handler; diff --git a/panda/src/cull/cullState.cxx b/panda/src/cull/cullState.cxx index 240607ea9b..d11a262797 100644 --- a/panda/src/cull/cullState.cxx +++ b/panda/src/cull/cullState.cxx @@ -20,7 +20,7 @@ //////////////////////////////////////////////////////////////////// bool CullState:: check_currency(Node *node, const AllTransitionsWrapper &, - UpdateSeq as_of) { + UpdateSeq as_of) { // First, check the verified time stamp. Verified::iterator vi; vi = _verified.find(node); diff --git a/panda/src/cull/cullState.h b/panda/src/cull/cullState.h index 28b1703f64..8c7502551b 100644 --- a/panda/src/cull/cullState.h +++ b/panda/src/cull/cullState.h @@ -26,7 +26,7 @@ class GraphicsStateGuardian; class GeomBin; //////////////////////////////////////////////////////////////////// -// Class : CullState +// Class : CullState // Description : This is the basic grouping unit of the CullTraverser. // A single CullState object represents all of the // GeomNodes throughout the scene graph that share an @@ -46,8 +46,8 @@ public: INLINE int compare_to(const CullState &other) const; bool check_currency(Node *node, - const AllTransitionsWrapper &trans, - UpdateSeq as_of); + const AllTransitionsWrapper &trans, + UpdateSeq as_of); INLINE void mark_verified(Node *node, UpdateSeq now); diff --git a/panda/src/cull/cullStateLookup.cxx b/panda/src/cull/cullStateLookup.cxx index d504dcf36d..2d47d7b277 100644 --- a/panda/src/cull/cullStateLookup.cxx +++ b/panda/src/cull/cullStateLookup.cxx @@ -48,8 +48,8 @@ clear() { //////////////////////////////////////////////////////////////////// CullState *CullStateLookup:: find_node(Node *node, - const AllTransitionsWrapper &trans, - UpdateSeq now) { + const AllTransitionsWrapper &trans, + UpdateSeq now) { if (cull_cat.is_spam()) { cull_cat.spam() << "Looking up " << *node << " in lookup " << (void *)this << "\n"; @@ -60,7 +60,7 @@ find_node(Node *node, // No entry for the node. if (cull_cat.is_spam()) { cull_cat.spam() - << "No entry for the node.\n"; + << "No entry for the node.\n"; } return NULL; } @@ -70,7 +70,7 @@ find_node(Node *node, // The entry is current enough to use. if (cull_cat.is_spam()) { cull_cat.spam() - << "The entry is found and current.\n"; + << "The entry is found and current.\n"; } return cs; } @@ -107,9 +107,9 @@ find_node(Node *node, //////////////////////////////////////////////////////////////////// CullStateSubtree *CullStateLookup:: get_subtree(const PT_NodeRelation &arc, - const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq now) { + const AllTransitionsWrapper &trans, + Node *top_subtree, + UpdateSeq now) { if (cull_cat.is_spam()) { cull_cat.spam() << "Getting subtree for " << *arc << " in lookup " @@ -121,7 +121,7 @@ get_subtree(const PT_NodeRelation &arc, // No entry for the arc. if (cull_cat.is_spam()) { cull_cat.spam() - << "No entry for the arc; creating new one.\n"; + << "No entry for the arc; creating new one.\n"; } CullStateSubtree *subtree = new CullStateSubtree(this, trans, top_subtree, now); @@ -134,7 +134,7 @@ get_subtree(const PT_NodeRelation &arc, // The entry is current enough to use. if (cull_cat.is_spam()) { cull_cat.spam() - << "The entry is found and current.\n"; + << "The entry is found and current.\n"; } return subtree; } @@ -165,7 +165,7 @@ clean_out_old_nodes() { CullState *cs = (*csi).second; if (!cs->has_bin() && cs->is_empty() && - cs->get_empty_frames_count() > 100) { + cs->get_empty_frames_count() > 100) { _cull_states.erase(csi); } csi = csnext; @@ -210,7 +210,7 @@ get_top_subtree() const { //////////////////////////////////////////////////////////////////// void CullStateLookup:: compose_trans(const AllTransitionsWrapper &from, - AllTransitionsWrapper &to) const { + AllTransitionsWrapper &to) const { to = from; } diff --git a/panda/src/cull/cullStateLookup.h b/panda/src/cull/cullStateLookup.h index 1cc6ab8d4f..bd1b6052cf 100644 --- a/panda/src/cull/cullStateLookup.h +++ b/panda/src/cull/cullStateLookup.h @@ -19,7 +19,7 @@ class CullState; class CullStateSubtree; //////////////////////////////////////////////////////////////////// -// Class : CullStateLookup +// Class : CullStateLookup // Description : This object stores a set of CullState pointers, one // for each unique state encountered in the scene graph. // It can combine two identical states encountered at @@ -41,22 +41,22 @@ public: INLINE bool is_completely_empty() const; CullState *find_node(Node *node, - const AllTransitionsWrapper &trans, - UpdateSeq now); + const AllTransitionsWrapper &trans, + UpdateSeq now); CullStateSubtree *get_subtree(const PT_NodeRelation &arc, - const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq now); + const AllTransitionsWrapper &trans, + Node *top_subtree, + UpdateSeq now); INLINE void record_node(Node *node, CullState *cs, - UpdateSeq now); + UpdateSeq now); void clean_out_old_nodes(); virtual Node *get_top_subtree() const; virtual void compose_trans(const AllTransitionsWrapper &from, - AllTransitionsWrapper &to) const; + AllTransitionsWrapper &to) const; virtual void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/cull/cullStateSubtree.I b/panda/src/cull/cullStateSubtree.I index 0d31ec5e96..4969987713 100644 --- a/panda/src/cull/cullStateSubtree.I +++ b/panda/src/cull/cullStateSubtree.I @@ -10,9 +10,9 @@ //////////////////////////////////////////////////////////////////// INLINE CullStateSubtree:: CullStateSubtree(CullStateLookup *parent, - const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq now) : + const AllTransitionsWrapper &trans, + Node *top_subtree, + UpdateSeq now) : _parent(parent), _trans(trans), _top_subtree(top_subtree), diff --git a/panda/src/cull/cullStateSubtree.cxx b/panda/src/cull/cullStateSubtree.cxx index 90db5e7541..bb200d1323 100644 --- a/panda/src/cull/cullStateSubtree.cxx +++ b/panda/src/cull/cullStateSubtree.cxx @@ -25,7 +25,7 @@ CullStateSubtree:: //////////////////////////////////////////////////////////////////// bool CullStateSubtree:: check_currency(const AllTransitionsWrapper &, Node *top_subtree, - UpdateSeq as_of) { + UpdateSeq as_of) { if (cull_cat.is_spam()) { cull_cat.spam() << "Checking currency for subtree " << (void *)this @@ -70,7 +70,7 @@ get_top_subtree() const { //////////////////////////////////////////////////////////////////// void CullStateSubtree:: compose_trans(const AllTransitionsWrapper &from, - AllTransitionsWrapper &to) const { + AllTransitionsWrapper &to) const { to = _trans_from_root; to.compose_in_place(from); } diff --git a/panda/src/cull/cullStateSubtree.h b/panda/src/cull/cullStateSubtree.h index a5be628460..7d86a75e93 100644 --- a/panda/src/cull/cullStateSubtree.h +++ b/panda/src/cull/cullStateSubtree.h @@ -17,7 +17,7 @@ class CullStateLookup; //////////////////////////////////////////////////////////////////// -// Class : CullStateSubtree +// Class : CullStateSubtree // Description : A specialization of CullStateLookup for tracking the // state at and below an instanced node in the scene // graph. @@ -25,22 +25,22 @@ class CullStateLookup; class EXPCL_PANDA CullStateSubtree : public CullStateLookup { public: INLINE CullStateSubtree(CullStateLookup *parent, - const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq now); + const AllTransitionsWrapper &trans, + Node *top_subtree, + UpdateSeq now); virtual ~CullStateSubtree(); bool check_currency(const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq as_of); + Node *top_subtree, + UpdateSeq as_of); INLINE void update(const AllTransitionsWrapper &trans, - Node *top_subtree, - UpdateSeq now); + Node *top_subtree, + UpdateSeq now); virtual Node *get_top_subtree() const; virtual void compose_trans(const AllTransitionsWrapper &from, - AllTransitionsWrapper &to) const; + AllTransitionsWrapper &to) const; private: CullStateLookup *_parent; diff --git a/panda/src/cull/cullTraverser.I b/panda/src/cull/cullTraverser.I index 55c1b17930..f3b76da938 100644 --- a/panda/src/cull/cullTraverser.I +++ b/panda/src/cull/cullTraverser.I @@ -53,7 +53,7 @@ draw_geom(const ArcChain &arc_chain, const AllAttributesWrapper &initial_state) //////////////////////////////////////////////////////////////////// INLINE void CullTraverser:: draw_direct(const ArcChain &arc_chain, - const AllAttributesWrapper &initial_state) { + const AllAttributesWrapper &initial_state) { nassertv(!arc_chain.empty()); Node *node = arc_chain.back()->get_child(); if (cull_cat.is_spam()) { @@ -78,7 +78,7 @@ draw_direct(const ArcChain &arc_chain, //////////////////////////////////////////////////////////////////// INLINE CullStateLookup *CullTraverser:: add_instance(NodeRelation *arc, const AllTransitionsWrapper &trans, - Node *top_subtree, const CullLevelState &level_state) { + Node *top_subtree, const CullLevelState &level_state) { return level_state._lookup->get_subtree (arc, trans, top_subtree, level_state._as_of); } @@ -107,21 +107,21 @@ find_bin_state(const AllTransitionsWrapper &trans) { // The insert succeeded, so the CullState was not there // previously. cull_cat.spam() - << "Created CullState " << (void *)cs << " for:\n"; + << "Created CullState " << (void *)cs << " for:\n"; trans.write(cull_cat.spam(false), 2); } else { CullState *found_cs = *result.first; cull_cat.spam() - << "Found existing CullState " << (void *)found_cs - << " which has:\n"; + << "Found existing CullState " << (void *)found_cs + << " which has:\n"; found_cs->get_transitions().write(cull_cat.spam(false), 2); cull_cat.spam(false) - << "for:\n"; + << "for:\n"; trans.write(cull_cat.spam(false), 2); } } #endif - + return *result.first; } @@ -132,7 +132,7 @@ find_bin_state(const AllTransitionsWrapper &trans) { //////////////////////////////////////////////////////////////////// INLINE void CullTraverser:: backward_arc(NodeRelation *arc, NullTransitionWrapper &, - NullAttributeWrapper &, NullAttributeWrapper &, - const CullLevelState &) { + NullAttributeWrapper &, NullAttributeWrapper &, + const CullLevelState &) { mark_backward_arc(arc); } diff --git a/panda/src/cull/cullTraverser.cxx b/panda/src/cull/cullTraverser.cxx index eb2388c135..654c0d056c 100644 --- a/panda/src/cull/cullTraverser.cxx +++ b/panda/src/cull/cullTraverser.cxx @@ -49,7 +49,7 @@ PStatCollector CullTraverser::_cull_bins_btf_pcollector("Cull:Bins:BTF"); //////////////////////////////////////////////////////////////////// CullTraverser:: CullTraverser(GraphicsStateGuardian *gsg, TypeHandle graph_type, - const ArcChain &arc_chain) : + const ArcChain &arc_chain) : RenderTraverser(gsg, graph_type, arc_chain) { _nested_count = 0; @@ -178,8 +178,8 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void CullTraverser:: traverse(Node *root, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { // Statistics PStatTimer timer(_cull_pcollector); @@ -229,7 +229,7 @@ traverse(Node *root, } fc_traverse(_arc_chain, root, rel_from_camera, *this, - NullAttributeWrapper(), level_state, _gsg, _graph_type); + NullAttributeWrapper(), level_state, _gsg, _graph_type); if (is_initial) { draw(); @@ -284,27 +284,27 @@ setup_initial_bins() { if (words.size() != 3) { cull_cat.error() - << "Invalid cull-bin definition: " << def << "\n" - << "Definition should be three words: bin_name sort type\n"; + << "Invalid cull-bin definition: " << def << "\n" + << "Definition should be three words: bin_name sort type\n"; } else { int sort; if (!string_to_int(words[1], sort)) { - cull_cat.error() - << "Invalid cull-bin definition: " << def << "\n" - << "Sort token " << words[1] << " is not an integer.\n"; + cull_cat.error() + << "Invalid cull-bin definition: " << def << "\n" + << "Sort token " << words[1] << " is not an integer.\n"; } else { - TypeHandle type = GeomBin::parse_bin_type(words[2]); - if (type == TypeHandle::none()) { - cull_cat.error() - << "Invalid cull-bin definition: " << def << "\n" - << "Bin type " << words[2] << " is not known.\n"; - } else { - PT(GeomBin) bin = GeomBin::make_bin(type, words[0]); - nassertv(bin != (GeomBin *)NULL); - bin->set_sort(sort); - bin->set_traverser(this); - } + TypeHandle type = GeomBin::parse_bin_type(words[2]); + if (type == TypeHandle::none()) { + cull_cat.error() + << "Invalid cull-bin definition: " << def << "\n" + << "Bin type " << words[2] << " is not known.\n"; + } else { + PT(GeomBin) bin = GeomBin::make_bin(type, words[0]); + nassertv(bin != (GeomBin *)NULL); + bin->set_sort(sort); + bin->set_traverser(this); + } } } } @@ -328,7 +328,7 @@ draw() { for (si = _states.begin(); si != _states.end(); ++si) { CullState *cs = (*si); if (!cs->is_empty()) { - num_states++; + num_states++; } } @@ -383,12 +383,12 @@ draw() { if (_gsg != (GraphicsStateGuardian *)NULL) { if (cull_cat.is_debug()) { cull_cat.debug() - << "Drawing " << _sub_bins.size() << " bins.\n"; + << "Drawing " << _sub_bins.size() << " bins.\n"; } for (sbi = _sub_bins.begin(); sbi != _sub_bins.end(); ++sbi) { GeomBin *bin = (*sbi).second; if (bin->is_active()) { - bin->draw(this); + bin->draw(this); } } } @@ -433,7 +433,7 @@ clean_out_old_states() { //////////////////////////////////////////////////////////////////// void CullTraverser:: add_geom_node(GeomNode *node, const AllTransitionsWrapper &trans, - const CullLevelState &level_state) { + const CullLevelState &level_state) { // Using the PStatTimer here to start and stop the collector // implicitly gives VC++ a headache and an internal compiler error, // but explicitly starting and stopping it is ok. @@ -459,7 +459,7 @@ add_geom_node(GeomNode *node, const AllTransitionsWrapper &trans, if (cs == (CullState *)NULL) { if (cull_cat.is_spam()) { cull_cat.spam() - << "Finding a new bin state\n"; + << "Finding a new bin state\n"; } // The node didn't have a previously-associated CullState that we @@ -485,7 +485,7 @@ add_geom_node(GeomNode *node, const AllTransitionsWrapper &trans, //////////////////////////////////////////////////////////////////// void CullTraverser:: add_direct_node(Node *node, const AllTransitionsWrapper &trans, - const CullLevelState &level_state) { + const CullLevelState &level_state) { PStatTimer timer(_cull_direct_node_pcollector); nassertv(node != (Node *)NULL); @@ -521,8 +521,8 @@ add_direct_node(Node *node, const AllTransitionsWrapper &trans, //////////////////////////////////////////////////////////////////// bool CullTraverser:: forward_arc(NodeRelation *arc, NullTransitionWrapper &, - NullAttributeWrapper &, NullAttributeWrapper &, - CullLevelState &level_state) { + NullAttributeWrapper &, NullAttributeWrapper &, + CullLevelState &level_state) { nassertr(level_state._lookup != (CullStateLookup *)NULL, false); if (arc->has_transition(PruneTransition::get_class_type())) { @@ -585,7 +585,7 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, } else if (support_subrender == SD_hide) { if ((node_has_sub_render || arc_num_sub_render != 0) && - !arc->has_transition(DecalTransition::get_class_type())) { + !arc->has_transition(DecalTransition::get_class_type())) { return false; } node_has_sub_render = false; @@ -629,8 +629,8 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, // In any of these cases, we'll need to determine the net // transition to this node. wrt_subtree(arc, level_state._lookup->get_top_subtree(), - level_state._as_of, _now, - trans, _graph_type); + level_state._as_of, _now, + trans, _graph_type); } if (arc_num_sub_render != 0 || node_has_sub_render) { @@ -643,9 +643,9 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, AllTransitionsWrapper new_trans; if (!arc->sub_render_trans(attrib, new_trans, this) || - !node->sub_render(attrib, new_trans, this)) { - mark_backward_arc(arc); - return false; + !node->sub_render(attrib, new_trans, this)) { + mark_backward_arc(arc); + return false; } trans.compose_in_place(new_trans); @@ -667,14 +667,14 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, level_state._lookup = add_instance(arc, trans, node, level_state); if (cull_cat.is_spam()) { cull_cat.spam() - << "Added " << *node << " as instance.\n"; + << "Added " << *node << " as instance.\n"; } // It might also be an instanced GeomNode. if (is_geom) { if (cull_cat.is_spam()) { - cull_cat.spam() - << "Added " << *node << "\n"; + cull_cat.spam() + << "Added " << *node << "\n"; } add_geom_node(DCAST(GeomNode, node), AllTransitionsWrapper(), level_state); } @@ -682,7 +682,7 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &, } else if (is_geom) { if (cull_cat.is_spam()) { cull_cat.spam() - << "Added " << *node << "\n"; + << "Added " << *node << "\n"; } add_geom_node(DCAST(GeomNode, node), trans, level_state); } diff --git a/panda/src/cull/cullTraverser.h b/panda/src/cull/cullTraverser.h index 877ded6b17..1892a88165 100644 --- a/panda/src/cull/cullTraverser.h +++ b/panda/src/cull/cullTraverser.h @@ -27,7 +27,7 @@ class CullState; class AllTransitionsWrapper; //////////////////////////////////////////////////////////////////// -// Class : CullTraverser +// Class : CullTraverser // Description : A special kind of RenderTraverser that makes a // complete "cull" pass over the scene graph, grouping // the geometry by state and adding it to individual @@ -38,7 +38,7 @@ class EXPCL_PANDA CullTraverser : public TraverserVisitor { public: CullTraverser(GraphicsStateGuardian *gsg, TypeHandle graph_type, - const ArcChain &arc_chain = ArcChain()); + const ArcChain &arc_chain = ArcChain()); virtual ~CullTraverser(); PUBLISHED: @@ -52,15 +52,15 @@ PUBLISHED: public: virtual void traverse(Node *root, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); INLINE void draw_geom(GeomNode *geom_node, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); INLINE void draw_geom(const ArcChain &arc_chain, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); INLINE void draw_direct(const ArcChain &arc_chain, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); private: void setup_initial_bins(); @@ -69,16 +69,16 @@ private: void clean_out_old_states(); void add_geom_node(GeomNode *node, - const AllTransitionsWrapper &trans, - const CullLevelState &level_state); + const AllTransitionsWrapper &trans, + const CullLevelState &level_state); void add_direct_node(Node *node, - const AllTransitionsWrapper &trans, - const CullLevelState &level_state); - + const AllTransitionsWrapper &trans, + const CullLevelState &level_state); + INLINE CullStateLookup *add_instance(NodeRelation *arc, - const AllTransitionsWrapper &trans, - Node *top_subtree, - const CullLevelState &level_state); + const AllTransitionsWrapper &trans, + Node *top_subtree, + const CullLevelState &level_state); INLINE CullState *find_bin_state(const AllTransitionsWrapper &trans); @@ -88,13 +88,13 @@ public: // behavior of the RenderTraverser as it traverses the graph. // Normally you would never call these directly. bool forward_arc(NodeRelation *arc, NullTransitionWrapper &trans, - NullAttributeWrapper &pre, NullAttributeWrapper &post, - CullLevelState &level_state); + NullAttributeWrapper &pre, NullAttributeWrapper &post, + CullLevelState &level_state); INLINE void backward_arc(NodeRelation *arc, NullTransitionWrapper &trans, - NullAttributeWrapper &pre, NullAttributeWrapper &post, - const CullLevelState &level_state); + NullAttributeWrapper &pre, NullAttributeWrapper &post, + const CullLevelState &level_state); private: void attach_toplevel_bin(GeomBin *bin); diff --git a/panda/src/cull/directRenderTransition.h b/panda/src/cull/directRenderTransition.h index 3aa7faff89..9592eb4c03 100644 --- a/panda/src/cull/directRenderTransition.h +++ b/panda/src/cull/directRenderTransition.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DirectRenderTransition +// Class : DirectRenderTransition // Description : When this transition is attached to an arc, it // indicates that the node below this arc, and all // subsequent nodes below, should be treated as a single @@ -49,7 +49,7 @@ public: static void init_type() { ImmediateTransition::init_type(); register_type(_type_handle, "DirectRenderTransition", - ImmediateTransition::get_class_type()); + ImmediateTransition::get_class_type()); } private: diff --git a/panda/src/cull/geomBin.h b/panda/src/cull/geomBin.h index 4ab16681d9..d59830e022 100644 --- a/panda/src/cull/geomBin.h +++ b/panda/src/cull/geomBin.h @@ -24,7 +24,7 @@ class GeomNode; class CullTraverser; //////////////////////////////////////////////////////////////////// -// Class : GeomBin +// Class : GeomBin // Description : This is an abstract class that defines the interface // for a number of different kinds of bins that may be // assigned to a CullTraverser. The traverser will @@ -64,8 +64,8 @@ public: virtual void clear_current_states()=0; virtual void record_current_state(GraphicsStateGuardian *gsg, - CullState *cs, int draw_order, - CullTraverser *trav)=0; + CullState *cs, int draw_order, + CullTraverser *trav)=0; virtual void remove_state(CullState *cs); virtual void draw(CullTraverser *trav)=0; @@ -95,7 +95,7 @@ public: Namable::init_type(); register_type(_type_handle, "GeomBin", TypedReferenceCount::get_class_type(), - Namable::get_class_type()); + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/cull/geomBinAttribute.h b/panda/src/cull/geomBinAttribute.h index b31a5316c6..d2fdd663e2 100644 --- a/panda/src/cull/geomBinAttribute.h +++ b/panda/src/cull/geomBinAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinAttribute +// Class : GeomBinAttribute // Description : See GeomBinTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA GeomBinAttribute : public OnOffAttribute { @@ -49,7 +49,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "GeomBinAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/cull/geomBinBackToFront.I b/panda/src/cull/geomBinBackToFront.I index 949164ad53..27a103b61e 100644 --- a/panda/src/cull/geomBinBackToFront.I +++ b/panda/src/cull/geomBinBackToFront.I @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// INLINE GeomBinBackToFront::NodeEntry:: NodeEntry(float distance, const PT(CullState) &state, - const ArcChain &arc_chain, bool is_direct) : + const ArcChain &arc_chain, bool is_direct) : _distance(distance), _state(state), _arc_chain(arc_chain), diff --git a/panda/src/cull/geomBinBackToFront.cxx b/panda/src/cull/geomBinBackToFront.cxx index e0acbca733..ac8595a860 100644 --- a/panda/src/cull/geomBinBackToFront.cxx +++ b/panda/src/cull/geomBinBackToFront.cxx @@ -37,13 +37,13 @@ clear_current_states() { //////////////////////////////////////////////////////////////////// void GeomBinBackToFront:: record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int, - CullTraverser *trav) { + CullTraverser *trav) { PStatTimer timer(CullTraverser::_cull_bins_btf_pcollector); // Get the transform matrix from the state. TransformAttribute *trans_attrib = NULL; get_attribute_into(trans_attrib, cs->get_attributes(), - TransformTransition::get_class_type()); + TransformTransition::get_class_type()); CullState::geom_const_iterator gi; for (gi = cs->geom_begin(); gi != cs->geom_end(); ++gi) { @@ -55,13 +55,13 @@ record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int, const BoundingVolume &volume = node->get_bound(); if (!volume.is_empty() && - volume.is_of_type(GeometricBoundingVolume::get_class_type())) { + volume.is_of_type(GeometricBoundingVolume::get_class_type())) { const GeometricBoundingVolume *gbv; DCAST_INTO_V(gbv, &volume); LPoint3f center = gbv->get_approx_center(); if (trans_attrib != (TransformAttribute *)NULL) { - center = center * trans_attrib->get_matrix(); + center = center * trans_attrib->get_matrix(); } float distance = gsg->compute_distance_to(center); @@ -81,13 +81,13 @@ record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int, bool got_distance = false; if (!volume.is_empty() && - volume.is_of_type(GeometricBoundingVolume::get_class_type())) { + volume.is_of_type(GeometricBoundingVolume::get_class_type())) { const GeometricBoundingVolume *gbv; DCAST_INTO_V(gbv, &volume); LPoint3f center = gbv->get_approx_center(); if (trans_attrib != (TransformAttribute *)NULL) { - center = center * trans_attrib->get_matrix(); + center = center * trans_attrib->get_matrix(); } distance = gsg->compute_distance_to(center); @@ -102,27 +102,27 @@ record_current_state(GraphicsStateGuardian *gsg, CullState *cs, int, TypeHandle graph_type = trav->get_graph_type(); int num_children = node->get_num_children(graph_type); for (int i = 0; i < num_children; i++) { - NodeRelation *arc = node->get_child(graph_type, i); + NodeRelation *arc = node->get_child(graph_type, i); - const BoundingVolume &volume = arc->get_bound(); - if (!volume.is_empty() && - volume.is_of_type(GeometricBoundingVolume::get_class_type())) { - const GeometricBoundingVolume *gbv; - DCAST_INTO_V(gbv, &volume); - - LPoint3f center = gbv->get_approx_center(); - avg += center; - num_points++; - } + const BoundingVolume &volume = arc->get_bound(); + if (!volume.is_empty() && + volume.is_of_type(GeometricBoundingVolume::get_class_type())) { + const GeometricBoundingVolume *gbv; + DCAST_INTO_V(gbv, &volume); + + LPoint3f center = gbv->get_approx_center(); + avg += center; + num_points++; + } } if (num_points > 0) { - avg /= (float)num_points; - if (trans_attrib != (TransformAttribute *)NULL) { - avg = avg * trans_attrib->get_matrix(); - } - distance = gsg->compute_distance_to(avg); - got_distance = true; + avg /= (float)num_points; + if (trans_attrib != (TransformAttribute *)NULL) { + avg = avg * trans_attrib->get_matrix(); + } + distance = gsg->compute_distance_to(avg); + got_distance = true; } } diff --git a/panda/src/cull/geomBinBackToFront.h b/panda/src/cull/geomBinBackToFront.h index 24846c8ca0..1d7d682ef0 100644 --- a/panda/src/cull/geomBinBackToFront.h +++ b/panda/src/cull/geomBinBackToFront.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinBackToFront +// Class : GeomBinBackToFront // Description : This kind of GeomBin renders its GeomNodes in order // according to distance from the camera plane, // beginning with the farthest away. It's particularly @@ -30,8 +30,8 @@ PUBLISHED: public: virtual void clear_current_states(); virtual void record_current_state(GraphicsStateGuardian *gsg, - CullState *cs, int draw_order, - CullTraverser *trav); + CullState *cs, int draw_order, + CullTraverser *trav); virtual void draw(CullTraverser *trav); @@ -39,7 +39,7 @@ private: class NodeEntry { public: INLINE NodeEntry(float distance, const PT(CullState) &state, - const ArcChain &arc_chain, bool is_direct); + const ArcChain &arc_chain, bool is_direct); INLINE NodeEntry(const NodeEntry ©); INLINE void operator = (const NodeEntry ©); diff --git a/panda/src/cull/geomBinFixed.I b/panda/src/cull/geomBinFixed.I index 6341414cc1..e725a4bcaf 100644 --- a/panda/src/cull/geomBinFixed.I +++ b/panda/src/cull/geomBinFixed.I @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// INLINE GeomBinFixed::NodeEntry:: NodeEntry(int draw_order, const PT(CullState) &state, - const ArcChain &arc_chain, bool is_direct) : + const ArcChain &arc_chain, bool is_direct) : _draw_order(draw_order), _state(state), _arc_chain(arc_chain), diff --git a/panda/src/cull/geomBinFixed.cxx b/panda/src/cull/geomBinFixed.cxx index 0b632fa40c..6ec3bf5d3c 100644 --- a/panda/src/cull/geomBinFixed.cxx +++ b/panda/src/cull/geomBinFixed.cxx @@ -38,13 +38,13 @@ clear_current_states() { //////////////////////////////////////////////////////////////////// void GeomBinFixed:: record_current_state(GraphicsStateGuardian *, CullState *cs, - int draw_order, CullTraverser *) { + int draw_order, CullTraverser *) { PStatTimer timer(CullTraverser::_cull_bins_fixed_pcollector); // Get the transform matrix from the state. TransformAttribute *trans_attrib = NULL; get_attribute_into(trans_attrib, cs->get_attributes(), - TransformTransition::get_class_type()); + TransformTransition::get_class_type()); CullState::geom_const_iterator gi; for (gi = cs->geom_begin(); gi != cs->geom_end(); ++gi) { diff --git a/panda/src/cull/geomBinFixed.h b/panda/src/cull/geomBinFixed.h index 959dfb8b81..666b5c71ea 100644 --- a/panda/src/cull/geomBinFixed.h +++ b/panda/src/cull/geomBinFixed.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinFixed +// Class : GeomBinFixed // Description : This kind of GeomBin renders its GeomNodes in a // user-specified order according to the draw_order // specified at each GeomBinTransition. @@ -27,8 +27,8 @@ PUBLISHED: public: virtual void clear_current_states(); virtual void record_current_state(GraphicsStateGuardian *gsg, - CullState *cs, int draw_order, - CullTraverser *trav); + CullState *cs, int draw_order, + CullTraverser *trav); virtual void draw(CullTraverser *trav); @@ -36,7 +36,7 @@ private: class NodeEntry { public: INLINE NodeEntry(int draw_order, const PT(CullState) &state, - const ArcChain &arc_chain, bool is_direct); + const ArcChain &arc_chain, bool is_direct); INLINE NodeEntry(const NodeEntry ©); INLINE void operator = (const NodeEntry ©); diff --git a/panda/src/cull/geomBinGroup.cxx b/panda/src/cull/geomBinGroup.cxx index cdadd00314..cf618029f2 100644 --- a/panda/src/cull/geomBinGroup.cxx +++ b/panda/src/cull/geomBinGroup.cxx @@ -130,7 +130,7 @@ clear_current_states() { //////////////////////////////////////////////////////////////////// void GeomBinGroup:: record_current_state(GraphicsStateGuardian *gsg, CullState *cs, - int draw_order, CullTraverser *trav) { + int draw_order, CullTraverser *trav) { int index = choose_bin(cs); if (index >= 0 && index < get_num_bins()) { get_bin(index)->record_current_state(gsg, cs, draw_order, trav); diff --git a/panda/src/cull/geomBinGroup.h b/panda/src/cull/geomBinGroup.h index 99bf18ed87..4fbeae7445 100644 --- a/panda/src/cull/geomBinGroup.h +++ b/panda/src/cull/geomBinGroup.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinGroup +// Class : GeomBinGroup // Description : A special kind of abstract GeomBin that assigns its // CullState objects to any of a number of sub-bins. // This class is abstract because it does not define the @@ -39,8 +39,8 @@ public: virtual void clear_current_states(); virtual void record_current_state(GraphicsStateGuardian *gsg, - CullState *cs, int draw_order, - CullTraverser *trav); + CullState *cs, int draw_order, + CullTraverser *trav); virtual void draw(CullTraverser *trav); diff --git a/panda/src/cull/geomBinNormal.cxx b/panda/src/cull/geomBinNormal.cxx index 7759480196..50e18b504c 100644 --- a/panda/src/cull/geomBinNormal.cxx +++ b/panda/src/cull/geomBinNormal.cxx @@ -43,7 +43,7 @@ choose_bin(CullState *cs) const { TransparencyAttribute *trans_attrib; if (get_attribute_into(trans_attrib, cs->get_attributes(), - TransparencyTransition::get_class_type())) { + TransparencyTransition::get_class_type())) { is_transparent = (trans_attrib->get_mode() != TransparencyProperty::M_none); } diff --git a/panda/src/cull/geomBinNormal.h b/panda/src/cull/geomBinNormal.h index 2c639b10ad..5f73677e12 100644 --- a/panda/src/cull/geomBinNormal.h +++ b/panda/src/cull/geomBinNormal.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinNormal +// Class : GeomBinNormal // Description : This is the most typical kind of GeomBin: it renders // nontransparent geometry in state-sorted order, // followed by transparent geometry sorted diff --git a/panda/src/cull/geomBinTransition.h b/panda/src/cull/geomBinTransition.h index f53d35e421..a49aa620f9 100644 --- a/panda/src/cull/geomBinTransition.h +++ b/panda/src/cull/geomBinTransition.h @@ -12,7 +12,7 @@ #include "geomBin.h" //////////////////////////////////////////////////////////////////// -// Class : GeomBinTransition +// Class : GeomBinTransition // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA GeomBinTransition : public OnOffTransition { @@ -58,7 +58,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "GeomBinTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/cull/geomBinUnsorted.cxx b/panda/src/cull/geomBinUnsorted.cxx index 5ac57098cc..77b4ce88df 100644 --- a/panda/src/cull/geomBinUnsorted.cxx +++ b/panda/src/cull/geomBinUnsorted.cxx @@ -50,7 +50,7 @@ clear_current_states() { //////////////////////////////////////////////////////////////////// void GeomBinUnsorted:: record_current_state(GraphicsStateGuardian *, CullState *cs, int, - CullTraverser *) { + CullTraverser *) { PStatTimer timer(CullTraverser::_cull_bins_unsorted_pcollector); // This shouldn't be called twice for a particular CullState on this @@ -82,9 +82,9 @@ draw(CullTraverser *trav) { const CullState *cs = (*csi); if (cull_cat.is_spam()) { cull_cat.spam() - << "GeomBinUnsorted state with " << cs->geom_size() << " geoms and " - << cs->direct_size() << " direct nodes.\n" - << "setting state " << cs->get_attributes() << "\n"; + << "GeomBinUnsorted state with " << cs->geom_size() << " geoms and " + << cs->direct_size() << " direct nodes.\n" + << "setting state " << cs->get_attributes() << "\n"; } if (cs->geom_size() != 0) { @@ -93,15 +93,15 @@ draw(CullTraverser *trav) { CullState::geom_iterator gi; for (gi = cs->geom_begin(); gi != cs->geom_end(); ++gi) { - const ArcChain &arc_chain = (*gi); - nassertv(!arc_chain.empty()); - GeomNode *geom_node; - DCAST_INTO_V(geom_node, arc_chain.back()->get_child()); - if (cull_cat.is_spam()) { - cull_cat.spam() - << "Drawing " << *geom_node << "\n"; - } - geom_node->draw(gsg); + const ArcChain &arc_chain = (*gi); + nassertv(!arc_chain.empty()); + GeomNode *geom_node; + DCAST_INTO_V(geom_node, arc_chain.back()->get_child()); + if (cull_cat.is_spam()) { + cull_cat.spam() + << "Drawing " << *geom_node << "\n"; + } + geom_node->draw(gsg); } } @@ -109,7 +109,7 @@ draw(CullTraverser *trav) { for (di = cs->direct_begin(); di != cs->direct_end(); ++di) { const ArcChain &arc_chain = (*di); nassertv(!arc_chain.empty()); - + trav->draw_direct(arc_chain, cs->get_attributes()); } } diff --git a/panda/src/cull/geomBinUnsorted.h b/panda/src/cull/geomBinUnsorted.h index 1735e1cdbe..1487aa1851 100644 --- a/panda/src/cull/geomBinUnsorted.h +++ b/panda/src/cull/geomBinUnsorted.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GeomBinUnsorted +// Class : GeomBinUnsorted // Description : This kind of GeomBin will group the GeomNodes // together by state (since that's how they come from // the CullTraverser, anyway), but won't attempt to @@ -30,8 +30,8 @@ PUBLISHED: public: virtual void clear_current_states(); virtual void record_current_state(GraphicsStateGuardian *gsg, - CullState *cs, int draw_order, - CullTraverser *trav); + CullState *cs, int draw_order, + CullTraverser *trav); virtual void draw(CullTraverser *trav); diff --git a/panda/src/cull/test_cull.cxx b/panda/src/cull/test_cull.cxx index 978a8be1af..ecc65d8c66 100644 --- a/panda/src/cull/test_cull.cxx +++ b/panda/src/cull/test_cull.cxx @@ -32,14 +32,14 @@ public: return true; } bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + NullLevelState &) { _indent_level += 2; return true; } void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - const NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + const NullLevelState &) { _indent_level -= 2; } int _indent_level; @@ -123,8 +123,8 @@ main(int argc, char *argv[]) { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - AllAttributesWrapper(), NullLevelState(), - NodeRelation::get_class_type()); + AllAttributesWrapper(), NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; CullTraverser ct(NULL, NodeRelation::get_class_type()); diff --git a/panda/src/device/analogNode.cxx b/panda/src/device/analogNode.cxx index 544dfa668b..a368e01c95 100644 --- a/panda/src/device/analogNode.cxx +++ b/panda/src/device/analogNode.cxx @@ -88,12 +88,12 @@ transmit_data(NodeAttributes &data) { _analog->lock(); for (int i = 0; i < max_outputs; i++) { if (_outputs[i]._index >= 0 && - _analog->is_control_known(_outputs[i]._index)) { - if (_outputs[i]._flip) { - out[i] = -_analog->get_control_state(_outputs[i]._index); - } else { - out[i] = _analog->get_control_state(_outputs[i]._index); - } + _analog->is_control_known(_outputs[i]._index)) { + if (_outputs[i]._flip) { + out[i] = -_analog->get_control_state(_outputs[i]._index); + } else { + out[i] = _analog->get_control_state(_outputs[i]._index); + } } } _analog->unlock(); @@ -112,10 +112,10 @@ void AnalogNode:: init_type() { DataNode::init_type(); register_type(_type_handle, "AnalogNode", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "XYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); } diff --git a/panda/src/device/buttonNode.cxx b/panda/src/device/buttonNode.cxx index e726e3db82..e70d1e9323 100644 --- a/panda/src/device/buttonNode.cxx +++ b/panda/src/device/buttonNode.cxx @@ -127,10 +127,10 @@ void ButtonNode:: init_type() { DataNode::init_type(); register_type(_type_handle, "ButtonNode", - DataNode::get_class_type()); + DataNode::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/device/clientAnalogDevice.cxx b/panda/src/device/clientAnalogDevice.cxx index 8718648109..428a074dab 100644 --- a/panda/src/device/clientAnalogDevice.cxx +++ b/panda/src/device/clientAnalogDevice.cxx @@ -55,7 +55,7 @@ write_controls(ostream &out, int indent_level) const { any_controls = true; indent(out, indent_level) - << (int)(ai - _controls.begin()) << ". " << state._state << "\n"; + << (int)(ai - _controls.begin()) << ". " << state._state << "\n"; } } diff --git a/panda/src/device/clientBase.cxx b/panda/src/device/clientBase.cxx index e615f6f6ad..d449e9d2d8 100644 --- a/panda/src/device/clientBase.cxx +++ b/panda/src/device/clientBase.cxx @@ -83,8 +83,8 @@ fork_asynchronous_thread(double poll_time) { _forked = true; if (device_cat.is_debug()) { device_cat.debug() - << "fork_asynchronous_thread() - forking client thread" - << endl; + << "fork_asynchronous_thread() - forking client thread" + << endl; } return true; } @@ -154,7 +154,7 @@ get_device(TypeHandle device_type, const string &device_name) { //////////////////////////////////////////////////////////////////// bool ClientBase:: disconnect_device(TypeHandle device_type, const string &device_name, - ClientDevice *device) { + ClientDevice *device) { DevicesByName &dbn = _devices[device_type]; DevicesByName::iterator dbni; diff --git a/panda/src/device/clientBase.h b/panda/src/device/clientBase.h index bcd2e41014..c07af00125 100644 --- a/panda/src/device/clientBase.h +++ b/panda/src/device/clientBase.h @@ -48,15 +48,15 @@ PUBLISHED: public: PT(ClientDevice) get_device(TypeHandle device_type, - const string &device_name); + const string &device_name); protected: virtual PT(ClientDevice) make_device(TypeHandle device_type, - const string &device_name)=0; + const string &device_name)=0; virtual bool disconnect_device(TypeHandle device_type, - const string &device_name, - ClientDevice *device); + const string &device_name, + ClientDevice *device); virtual void do_poll(); diff --git a/panda/src/device/clientButtonDevice.cxx b/panda/src/device/clientButtonDevice.cxx index 5bbeeae382..e658f4da43 100644 --- a/panda/src/device/clientButtonDevice.cxx +++ b/panda/src/device/clientButtonDevice.cxx @@ -98,14 +98,14 @@ output_buttons(ostream &out) const { const ButtonState &state = (*bi); if (state._state != S_unknown) { if (any_buttons) { - out << ", "; + out << ", "; } any_buttons = true; out << (int)(bi - _buttons.begin()) << "="; if (state._state == S_up) { - out << "up"; + out << "up"; } else { - out << "down"; + out << "down"; } } } @@ -131,16 +131,16 @@ write_buttons(ostream &out, int indent_level) const { any_buttons = true; indent(out, indent_level) - << (int)(bi - _buttons.begin()) << ". "; + << (int)(bi - _buttons.begin()) << ". "; if (state._handle != ButtonHandle::none()) { - out << "(" << state._handle << ") "; + out << "(" << state._handle << ") "; } if (state._state == S_up) { - out << "up"; + out << "up"; } else { - out << "down"; + out << "down"; } out << "\n"; } diff --git a/panda/src/device/clientDevice.cxx b/panda/src/device/clientDevice.cxx index 21ae54aa92..a09399d442 100644 --- a/panda/src/device/clientDevice.cxx +++ b/panda/src/device/clientDevice.cxx @@ -17,7 +17,7 @@ TypeHandle ClientDevice::_type_handle; //////////////////////////////////////////////////////////////////// ClientDevice:: ClientDevice(ClientBase *client, TypeHandle device_type, - const string &device_name) : + const string &device_name) : _client(client), _device_type(device_type), _device_name(device_name) diff --git a/panda/src/device/clientDevice.h b/panda/src/device/clientDevice.h index f761efd57c..1266c9d603 100644 --- a/panda/src/device/clientDevice.h +++ b/panda/src/device/clientDevice.h @@ -26,7 +26,7 @@ class ClientBase; class EXPCL_PANDA ClientDevice : public TypedReferenceCount { protected: ClientDevice(ClientBase *client, TypeHandle device_type, - const string &device_name); + const string &device_name); public: virtual ~ClientDevice(); diff --git a/panda/src/device/dialNode.cxx b/panda/src/device/dialNode.cxx index 6da8bb17b7..b4b1a75761 100644 --- a/panda/src/device/dialNode.cxx +++ b/panda/src/device/dialNode.cxx @@ -77,6 +77,6 @@ void DialNode:: init_type() { DataNode::init_type(); register_type(_type_handle, "DialNode", - DataNode::get_class_type()); + DataNode::get_class_type()); } diff --git a/panda/src/device/mouse.cxx b/panda/src/device/mouse.cxx index db6246ad67..bd1bf21e35 100644 --- a/panda/src/device/mouse.cxx +++ b/panda/src/device/mouse.cxx @@ -95,14 +95,14 @@ void MouseAndKeyboard:: init_type() { DataNode::init_type(); register_type(_type_handle, "MouseAndKeyboard", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_pixel_xyz_type, "PixelXYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); register_data_transition(_xyz_type, "XYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/device/mouse.h b/panda/src/device/mouse.h index d36928e680..b111599646 100644 --- a/panda/src/device/mouse.h +++ b/panda/src/device/mouse.h @@ -47,7 +47,7 @@ const int MIN_MOVE = 2; class EXPCL_PANDA MouseAndKeyboard : public DataNode { PUBLISHED: MouseAndKeyboard(GraphicsWindow *window, int device, - const string& name = ""); + const string& name = ""); public: virtual void transmit_data(NodeAttributes &data); diff --git a/panda/src/device/trackerNode.cxx b/panda/src/device/trackerNode.cxx index 845098fe7f..15cc7864c0 100644 --- a/panda/src/device/trackerNode.cxx +++ b/panda/src/device/trackerNode.cxx @@ -95,10 +95,10 @@ void TrackerNode:: init_type() { DataNode::init_type(); register_type(_type_handle, "TrackerNode", - DataNode::get_class_type()); + DataNode::get_class_type()); MatrixDataTransition::init_type(); register_data_transition(_transform_type, "Transform", - MatrixDataTransition::get_class_type()); + MatrixDataTransition::get_class_type()); } diff --git a/panda/src/dgraph/buttonEventDataAttribute.cxx b/panda/src/dgraph/buttonEventDataAttribute.cxx index b09ae7bb9c..d6f6512192 100644 --- a/panda/src/dgraph/buttonEventDataAttribute.cxx +++ b/panda/src/dgraph/buttonEventDataAttribute.cxx @@ -85,7 +85,7 @@ merge(const NodeAttribute *other) const { new ButtonEventDataAttribute(*this); new_attrib->_buttons.insert(new_attrib->_buttons.end(), - oa->_buttons.begin(), oa->_buttons.end()); + oa->_buttons.begin(), oa->_buttons.end()); return new_attrib; } } @@ -130,12 +130,12 @@ internal_compare_to(const NodeAttribute *other) const { if (ot->_buttons == _buttons) return 0; else if (lexicographical_compare(_buttons.begin(), _buttons.end(), - ot->_buttons.begin(), ot->_buttons.end())) + ot->_buttons.begin(), ot->_buttons.end())) return -1; else return 1; #else return lexicographical_compare_3way(_buttons.begin(), _buttons.end(), - ot->_buttons.begin(), ot->_buttons.end()); + ot->_buttons.begin(), ot->_buttons.end()); #endif } diff --git a/panda/src/dgraph/buttonEventDataAttribute.h b/panda/src/dgraph/buttonEventDataAttribute.h index dd6703627d..84544609fc 100644 --- a/panda/src/dgraph/buttonEventDataAttribute.h +++ b/panda/src/dgraph/buttonEventDataAttribute.h @@ -17,7 +17,7 @@ class ButtonEventDataTransition; class ModifierButtons; //////////////////////////////////////////////////////////////////// -// Class : ButtonEventDataAttribute +// Class : ButtonEventDataAttribute // Description : This data graph attribute stores a collection of // button events that have been generated by the user // since the last time the data graph pulsed, in the @@ -73,7 +73,7 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, "ButtonEventDataAttribute", - NodeAttribute::get_class_type()); + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/buttonEventDataTransition.h b/panda/src/dgraph/buttonEventDataTransition.h index e8543fdc7b..3c0e9471b1 100644 --- a/panda/src/dgraph/buttonEventDataTransition.h +++ b/panda/src/dgraph/buttonEventDataTransition.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ButtonEventDataTransition +// Class : ButtonEventDataTransition // Description : A ButtonEventDataAttribute is a collection of buttons // that have been pressed recently, in the order they // were pressed. The ButtonEventDataTransition does @@ -46,7 +46,7 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, "ButtonEventDataTransition", - NodeTransition::get_class_type()); + NodeTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/dataGraphTraverser.cxx b/panda/src/dgraph/dataGraphTraverser.cxx index 4573a82e8e..636a91fe7c 100644 --- a/panda/src/dgraph/dataGraphTraverser.cxx +++ b/panda/src/dgraph/dataGraphTraverser.cxx @@ -39,14 +39,14 @@ r_traverse(Node *node, NodeAttributes &data, bool has_spam_mode) { if (data_node != (DataNode *)NULL) { #ifdef NOTIFY_DEBUG if (has_spam_mode && dgraph_cat.is_info()) { - dgraph_cat.info() << "Sending into " << *node << " {\n"; - describe_data_verbose(dgraph_cat.info(false), data, 2); - dgraph_cat.info(false) << "}\n"; - + dgraph_cat.info() << "Sending into " << *node << " {\n"; + describe_data_verbose(dgraph_cat.info(false), data, 2); + dgraph_cat.info(false) << "}\n"; + } else if (dgraph_cat.is_spam()) { - dgraph_cat.spam() << "Sending into " << *node << " {\n"; - describe_data_verbose(dgraph_cat.spam(false), data, 2); - dgraph_cat.spam(false) << "}\n"; + dgraph_cat.spam() << "Sending into " << *node << " {\n"; + describe_data_verbose(dgraph_cat.spam(false), data, 2); + dgraph_cat.spam(false) << "}\n"; } #endif @@ -85,11 +85,11 @@ r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode) { for (int i = 0; i < num_children - 1; i++) { NodeAttributes copy = data; if (data_node != (DataNode *)NULL) { - data_node->transmit_data_per_child(copy, i); + data_node->transmit_data_per_child(copy, i); } NodeRelation *arc = - node->get_child(DataRelation::get_class_type(), i); + node->get_child(DataRelation::get_class_type(), i); r_traverse(arc->get_child(), copy, has_spam_mode); } @@ -134,9 +134,9 @@ save(Node *node, const NodeAttributes &data, bool has_spam_mode, if (dgraph_cat.is_spam()) { dgraph_cat.spam() - << "Encountered " << *node << " with " << num_parents - << " parents; " << state._num_parents_so_far - << " processed so far.\n"; + << "Encountered " << *node << " with " << num_parents + << " parents; " << state._num_parents_so_far + << " processed so far.\n"; } nassertv(state._num_parents_so_far <= num_parents); @@ -213,7 +213,7 @@ resume_all() { for (int i = 0; i < num_parents; i++) { NodeRelation *arc = node->get_parent(DataRelation::get_class_type(), i); dgraph_cat.warning(false) - << " " << *arc << "\n"; + << " " << *arc << "\n"; } resume(node, state); diff --git a/panda/src/dgraph/dataGraphTraverser.h b/panda/src/dgraph/dataGraphTraverser.h index 6697a7999a..bf83490c9e 100644 --- a/panda/src/dgraph/dataGraphTraverser.h +++ b/panda/src/dgraph/dataGraphTraverser.h @@ -13,7 +13,7 @@ class Node; //////////////////////////////////////////////////////////////////// -// Class : DataGraphTraverser +// Class : DataGraphTraverser // Description : This class manages the traversal of the data graph, // so that all data attributes generated by nodes in the // graph are transmitted to nodes below them. @@ -42,7 +42,7 @@ private: void r_traverse(Node *node, NodeAttributes &data, bool has_spam_mode); void r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode); void save(Node *node, const NodeAttributes &data, bool has_spam_mode, - int num_parents); + int num_parents); void resume(Node *node, SavedState &state); void resume_all(); diff --git a/panda/src/dgraph/dataNode.cxx b/panda/src/dgraph/dataNode.cxx index edcd1292cc..62a18d9770 100644 --- a/panda/src/dgraph/dataNode.cxx +++ b/panda/src/dgraph/dataNode.cxx @@ -75,7 +75,7 @@ get_spam_mode() const { //////////////////////////////////////////////////////////////////// void register_data_transition(TypeHandle &type_handle, const string &name, - TypeHandle derived_from) { + TypeHandle derived_from) { // Make sure the user gave us a transition type as the base. nassertv(derived_from.is_derived_from(NodeTransition::get_class_type())); diff --git a/panda/src/dgraph/dataNode.h b/panda/src/dgraph/dataNode.h index 55bb37a0b7..1728eaf24c 100644 --- a/panda/src/dgraph/dataNode.h +++ b/panda/src/dgraph/dataNode.h @@ -55,7 +55,7 @@ class NodeAttributes; //////////////////////////////////////////////////////////////////// -// Class : DataNode +// Class : DataNode // Description : The main node of the data graph. This could // represent a device that produces data, or an object // that operates on data received from a device. @@ -93,7 +93,7 @@ public: static void init_type() { NamedNode::init_type(); register_type(_type_handle, "DataNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } private: @@ -115,7 +115,7 @@ private: //////////////////////////////////////////////////////////////////// void EXPCL_PANDA register_data_transition(TypeHandle &type_handle, const string &name, - TypeHandle derived_from); + TypeHandle derived_from); #endif diff --git a/panda/src/dgraph/dataRelation.h b/panda/src/dgraph/dataRelation.h index 3534777efe..9699c86744 100644 --- a/panda/src/dgraph/dataRelation.h +++ b/panda/src/dgraph/dataRelation.h @@ -11,7 +11,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : DataRelation +// Class : DataRelation // Description : The arc type specific to data graphs. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DataRelation : public NodeRelation { @@ -40,7 +40,7 @@ public: static void init_type() { NodeRelation::init_type(); register_type(_type_handle, "DataRelation", - NodeRelation::get_class_type()); + NodeRelation::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/dgraph/describe_data_verbose.cxx b/panda/src/dgraph/describe_data_verbose.cxx index 3b9368940e..8540871e39 100644 --- a/panda/src/dgraph/describe_data_verbose.cxx +++ b/panda/src/dgraph/describe_data_verbose.cxx @@ -22,7 +22,7 @@ static const int data_indent_level = 12; //////////////////////////////////////////////////////////////////// void describe_data_verbose(ostream &out, const NodeAttributes &state, - int indent_level) { + int indent_level) { NodeAttributes::const_iterator nai; for (nai = state.begin(); nai != state.end(); ++nai) { @@ -34,22 +34,22 @@ describe_data_verbose(ostream &out, const NodeAttributes &state, string::size_type underscore = actual_name.rfind('_'); string name; if (underscore == string::npos) { - // There was no underscore, so this name wasn't created via - // register_data_transition(). Huh. Well, that's legitimate - // (if unexpected), so just print the whole name. - name = actual_name; + // There was no underscore, so this name wasn't created via + // register_data_transition(). Huh. Well, that's legitimate + // (if unexpected), so just print the whole name. + name = actual_name; } else { - // Assume that, if the name was created via - // register_data_transition(), the original name was the part - // before the last underscore. - name = actual_name.substr(0, underscore); + // Assume that, if the name was created via + // register_data_transition(), the original name was the part + // before the last underscore. + name = actual_name.substr(0, underscore); } indent(out, indent_level) << name; if ((int)name.length() < data_indent_level) { - indent(out, data_indent_level - name.length()); + indent(out, data_indent_level - name.length()); } else { - out << " "; + out << " "; } out << *attrib << "\n"; } diff --git a/panda/src/dgraph/describe_data_verbose.h b/panda/src/dgraph/describe_data_verbose.h index cdf7eab3a9..27b2e878f9 100644 --- a/panda/src/dgraph/describe_data_verbose.h +++ b/panda/src/dgraph/describe_data_verbose.h @@ -17,6 +17,6 @@ class NodeAttributes; // data values included in the indicated state. //////////////////////////////////////////////////////////////////// void describe_data_verbose(ostream &out, const NodeAttributes &state, - int indent_level = 0); + int indent_level = 0); #endif diff --git a/panda/src/dgraph/doubleDataAttribute.h b/panda/src/dgraph/doubleDataAttribute.h index ea9a5bb435..d79ecbc474 100644 --- a/panda/src/dgraph/doubleDataAttribute.h +++ b/panda/src/dgraph/doubleDataAttribute.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute); //////////////////////////////////////////////////////////////////// -// Class : DoubleDataAttribute +// Class : DoubleDataAttribute // Description : A NumericDataAttribute templated on double types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DoubleDataAttribute : @@ -36,7 +36,7 @@ public: static void init_type() { NumericDataAttribute::init_type(); register_type(_type_handle, "DoubleDataAttribute", - NumericDataAttribute::get_class_type()); + NumericDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/doubleDataTransition.h b/panda/src/dgraph/doubleDataTransition.h index d999baab0e..5cc05970b9 100644 --- a/panda/src/dgraph/doubleDataTransition.h +++ b/panda/src/dgraph/doubleDataTransition.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition); //////////////////////////////////////////////////////////////////// -// Class : DoubleDataTransition +// Class : DoubleDataTransition // Description : A NumericDataTransition templated on double types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DoubleDataTransition : @@ -36,7 +36,7 @@ public: static void init_type() { NumericDataTransition::init_type(); register_type(_type_handle, "DoubleDataTransition", - NumericDataTransition::get_class_type()); + NumericDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/doublePtrDataAttribute.h b/panda/src/dgraph/doublePtrDataAttribute.h index 4218283355..74f174a702 100644 --- a/panda/src/dgraph/doublePtrDataAttribute.h +++ b/panda/src/dgraph/doublePtrDataAttribute.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataAttribute); //////////////////////////////////////////////////////////////////// -// Class : DoublePtrDataAttribute +// Class : DoublePtrDataAttribute // Description : A PointerDataAttribute templated on double types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DoublePtrDataAttribute : @@ -36,7 +36,7 @@ public: static void init_type() { PointerDataAttribute::init_type(); register_type(_type_handle, "DoublePtrDataAttribute", - PointerDataAttribute::get_class_type()); + PointerDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/doublePtrDataTransition.h b/panda/src/dgraph/doublePtrDataTransition.h index 74ff46f4d9..905dcb18f2 100644 --- a/panda/src/dgraph/doublePtrDataTransition.h +++ b/panda/src/dgraph/doublePtrDataTransition.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataTransition); //////////////////////////////////////////////////////////////////// -// Class : DoublePtrDataTransition +// Class : DoublePtrDataTransition // Description : A PointerDataTransition templated on double types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DoublePtrDataTransition : @@ -36,7 +36,7 @@ public: static void init_type() { PointerDataTransition::init_type(); register_type(_type_handle, "DoublePtrDataTransition", - PointerDataTransition::get_class_type()); + PointerDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/intDataAttribute.h b/panda/src/dgraph/intDataAttribute.h index 8474ad78b0..7c372e2fb9 100644 --- a/panda/src/dgraph/intDataAttribute.h +++ b/panda/src/dgraph/intDataAttribute.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute); //////////////////////////////////////////////////////////////////// -// Class : IntDataAttribute +// Class : IntDataAttribute // Description : A NumericDataAttribute templated on integer types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA IntDataAttribute : @@ -36,7 +36,7 @@ public: static void init_type() { NumericDataAttribute::init_type(); register_type(_type_handle, "IntDataAttribute", - NumericDataAttribute::get_class_type()); + NumericDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/intDataTransition.h b/panda/src/dgraph/intDataTransition.h index ac102984f6..9e13cc69eb 100644 --- a/panda/src/dgraph/intDataTransition.h +++ b/panda/src/dgraph/intDataTransition.h @@ -13,7 +13,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition); //////////////////////////////////////////////////////////////////// -// Class : IntDataTransition +// Class : IntDataTransition // Description : A NumericDataTransition templated on integer types. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA IntDataTransition : @@ -36,7 +36,7 @@ public: static void init_type() { NumericDataTransition::init_type(); register_type(_type_handle, "IntDataTransition", - NumericDataTransition::get_class_type()); + NumericDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/matrixDataAttribute.h b/panda/src/dgraph/matrixDataAttribute.h index 73af978a27..6c7bdc2319 100644 --- a/panda/src/dgraph/matrixDataAttribute.h +++ b/panda/src/dgraph/matrixDataAttribute.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LMATRIX4F); //////////////////////////////////////////////////////////////////// -// Class : MatrixDataAttribute +// Class : MatrixDataAttribute // Description : A VectorDataAttribute templated on LMatrix4f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA MatrixDataAttribute : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataAttribute::init_type(); register_type(_type_handle, "MatrixDataAttribute", - VectorDataAttribute::get_class_type()); + VectorDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/matrixDataTransition.h b/panda/src/dgraph/matrixDataTransition.h index 46dd7146ec..6063d90627 100644 --- a/panda/src/dgraph/matrixDataTransition.h +++ b/panda/src/dgraph/matrixDataTransition.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LMATRIX4F); //////////////////////////////////////////////////////////////////// -// Class : MatrixDataTransition +// Class : MatrixDataTransition // Description : A VectorDataTransition templated on LMatrix4f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA MatrixDataTransition : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataTransition::init_type(); register_type(_type_handle, "MatrixDataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/numericDataAttribute.h b/panda/src/dgraph/numericDataAttribute.h index a2673d2ee0..81e9e9ce53 100644 --- a/panda/src/dgraph/numericDataAttribute.h +++ b/panda/src/dgraph/numericDataAttribute.h @@ -15,7 +15,7 @@ template class NumericDataTransition; //////////////////////////////////////////////////////////////////// -// Class : NumericDataAttribute +// Class : NumericDataAttribute // Description : //////////////////////////////////////////////////////////////////// template @@ -52,9 +52,9 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, - string("NumericDataAttribute<") + - get_type_handle(NumType).get_name() + ">", - NodeAttribute::get_class_type()); + string("NumericDataAttribute<") + + get_type_handle(NumType).get_name() + ">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/numericDataTransition.h b/panda/src/dgraph/numericDataTransition.h index 6dc32eb98b..66a2d9d850 100644 --- a/panda/src/dgraph/numericDataTransition.h +++ b/panda/src/dgraph/numericDataTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NumericDataTransition +// Class : NumericDataTransition // Description : A NumericDataAttribute is a special data graph // attribute that is used to pass around a single // number. A NumericDataTransition isn't often used, @@ -62,9 +62,9 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, - string("NumericDataTransition<") + - get_type_handle(NumType).get_name() + ">", - NodeTransition::get_class_type()); + string("NumericDataTransition<") + + get_type_handle(NumType).get_name() + ">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/pointerDataAttribute.h b/panda/src/dgraph/pointerDataAttribute.h index cec92fc4fb..cce9f93a59 100644 --- a/panda/src/dgraph/pointerDataAttribute.h +++ b/panda/src/dgraph/pointerDataAttribute.h @@ -15,7 +15,7 @@ template class PointerDataTransition; //////////////////////////////////////////////////////////////////// -// Class : PointerDataTransition +// Class : PointerDataTransition // Description : //////////////////////////////////////////////////////////////////// template @@ -52,9 +52,9 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, - string("PointerDataAttribute<") + - get_type_handle(PtrType).get_name() + ">", - NodeAttribute::get_class_type()); + string("PointerDataAttribute<") + + get_type_handle(PtrType).get_name() + ">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/pointerDataTransition.h b/panda/src/dgraph/pointerDataTransition.h index 3fea0679c4..044bc1037e 100644 --- a/panda/src/dgraph/pointerDataTransition.h +++ b/panda/src/dgraph/pointerDataTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PointerDataTransition +// Class : PointerDataTransition // Description : A PointerDataAttribute is a special data graph // attribute that is used to pass around a single // pointer. @@ -53,9 +53,9 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, - string("PointerDataTransition<") + - get_type_handle(PtrType).get_name() + ">", - NodeTransition::get_class_type()); + string("PointerDataTransition<") + + get_type_handle(PtrType).get_name() + ">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/test_dgraph.cxx b/panda/src/dgraph/test_dgraph.cxx index 93fac30528..88d917a657 100644 --- a/panda/src/dgraph/test_dgraph.cxx +++ b/panda/src/dgraph/test_dgraph.cxx @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////// -// Class : Producer +// Class : Producer // Description : Simulates some data-generating device, such as a // mouse. //////////////////////////////////////////////////////////////////// @@ -47,14 +47,14 @@ public: static void init_type() { DataNode::init_type(); register_type(_type_handle, "Producer", - DataNode::get_class_type()); + DataNode::get_class_type()); DoubleDataTransition::init_type(); register_data_transition(_t_type, "t", - DoubleDataTransition::get_class_type()); + DoubleDataTransition::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "xyz", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); } private: @@ -89,7 +89,7 @@ transmit_data(NodeAttributes &data) { //////////////////////////////////////////////////////////////////// -// Class : Consumer +// Class : Consumer // Description : Simulates some data-consuming object, such as a mouse // Tformer. //////////////////////////////////////////////////////////////////// @@ -117,16 +117,16 @@ public: static void init_type() { DataNode::init_type(); register_type(_type_handle, "Consumer", - DataNode::get_class_type()); + DataNode::get_class_type()); DoubleDataTransition::init_type(); register_data_transition(_s_type, "s", - DoubleDataTransition::get_class_type()); + DoubleDataTransition::get_class_type()); register_data_transition(_t_type, "t", - DoubleDataTransition::get_class_type()); + DoubleDataTransition::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "xyz", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); } private: @@ -150,7 +150,7 @@ transmit_data(NodeAttributes &data) { get_attribute_into(t, data, _t_type) && get_attribute_into(xyz, data, _xyz_type)) { nout << get_name() << " got xyz " << *xyz << " s " << *s - << " t " << *t << "\n"; + << " t " << *t << "\n"; } else { nout << get_name() << " didn't get all data.\n"; } @@ -176,7 +176,7 @@ main() { producer->_xyz->set_value(LPoint3f(1.0, 2.0, 3.0)); arc1->set_transition(Producer::_xyz_type, - new Vec3DataTransition(LMatrix4f::scale_mat(2.0))); + new Vec3DataTransition(LMatrix4f::scale_mat(2.0))); producer->set_spam_mode(true); diff --git a/panda/src/dgraph/vec3DataAttribute.h b/panda/src/dgraph/vec3DataAttribute.h index 94ce2baf4d..559da91f3c 100644 --- a/panda/src/dgraph/vec3DataAttribute.h +++ b/panda/src/dgraph/vec3DataAttribute.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT3F); //////////////////////////////////////////////////////////////////// -// Class : Vec3DataAttribute +// Class : Vec3DataAttribute // Description : A VectorDataAttribute templated on LPoint3f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Vec3DataAttribute : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataAttribute::init_type(); register_type(_type_handle, "Vec3DataAttribute", - VectorDataAttribute::get_class_type()); + VectorDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/vec3DataTransition.h b/panda/src/dgraph/vec3DataTransition.h index 3c5b8c0fcf..c7e196e50b 100644 --- a/panda/src/dgraph/vec3DataTransition.h +++ b/panda/src/dgraph/vec3DataTransition.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT3F); //////////////////////////////////////////////////////////////////// -// Class : Vec3DataTransition +// Class : Vec3DataTransition // Description : A VectorDataTransition templated on LPoint3f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Vec3DataTransition : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataTransition::init_type(); register_type(_type_handle, "Vec3DataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/vec4DataAttribute.h b/panda/src/dgraph/vec4DataAttribute.h index e1cb807ff9..0d61bd9f6c 100644 --- a/panda/src/dgraph/vec4DataAttribute.h +++ b/panda/src/dgraph/vec4DataAttribute.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT4F); //////////////////////////////////////////////////////////////////// -// Class : Vec4DataAttribute +// Class : Vec4DataAttribute // Description : A VectorDataAttribute templated on LPoint4f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Vec4DataAttribute : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataAttribute::init_type(); register_type(_type_handle, "Vec4DataAttribute", - VectorDataAttribute::get_class_type()); + VectorDataAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/vec4DataTransition.h b/panda/src/dgraph/vec4DataTransition.h index 30bc0eb92b..17d7a822e5 100644 --- a/panda/src/dgraph/vec4DataTransition.h +++ b/panda/src/dgraph/vec4DataTransition.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT4F); //////////////////////////////////////////////////////////////////// -// Class : Vec4DataTransition +// Class : Vec4DataTransition // Description : A VectorDataTransition templated on LPoint4f. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Vec4DataTransition : @@ -41,7 +41,7 @@ public: static void init_type() { VectorDataTransition::init_type(); register_type(_type_handle, "Vec4DataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/vectorDataAttribute.h b/panda/src/dgraph/vectorDataAttribute.h index 121fbe9f8a..6071ed143e 100644 --- a/panda/src/dgraph/vectorDataAttribute.h +++ b/panda/src/dgraph/vectorDataAttribute.h @@ -15,7 +15,7 @@ template class VectorDataTransition; //////////////////////////////////////////////////////////////////// -// Class : VectorDataAttribute +// Class : VectorDataAttribute // Description : //////////////////////////////////////////////////////////////////// template @@ -52,10 +52,10 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, - string("VectorDataAttribute<") + - get_type_handle(VecType).get_name() + "," + - get_type_handle(MatType).get_name() + ">", - NodeAttribute::get_class_type()); + string("VectorDataAttribute<") + + get_type_handle(VecType).get_name() + "," + + get_type_handle(MatType).get_name() + ">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/dgraph/vectorDataTransition.h b/panda/src/dgraph/vectorDataTransition.h index 4ca2d83148..104c35d75b 100644 --- a/panda/src/dgraph/vectorDataTransition.h +++ b/panda/src/dgraph/vectorDataTransition.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : VectorDataTransition +// Class : VectorDataTransition // Description : A VectorDataAttribute is a special data graph // attribute that is used to pass around a complex // number like a vector or a matrix. The Transition @@ -65,10 +65,10 @@ public: do_init_type(VecType); do_init_type(MatType); register_type(_type_handle, - string("VectorDataTransition<") + - get_type_handle(VecType).get_name() + "," + - get_type_handle(MatType).get_name() + ">", - NodeTransition::get_class_type()); + string("VectorDataTransition<") + + get_type_handle(VecType).get_name() + "," + + get_type_handle(MatType).get_name() + ">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index bb93a59b50..98aea7b573 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -30,13 +30,13 @@ ConfigureFn(config_display) { const string pipe_spec_machine = config_display.GetString("pipe-machine", ""); const string pipe_spec_filename = config_display.GetString("pipe-filename", - "outfile-%03f.rib"); + "outfile-%03f.rib"); const int pipe_spec_pipe_number = config_display.GetInt("pipe-number", -1); const bool pipe_spec_is_file = config_display.Defined("pipe-filename") || config_display.GetBool("pipe-file", false); const bool pipe_spec_is_remote = config_display.Defined("pipe-machine") || config_display.GetBool("pipe-remote", - false); + false); const float gsg_clear_r = config_display.GetFloat("gsg-clear-r", 0.0); const float gsg_clear_g = config_display.GetFloat("gsg-clear-g", 0.0); diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index 2f29d90f98..7e82c25523 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -30,7 +30,7 @@ DisplayRegion(GraphicsLayer *layer) : //////////////////////////////////////////////////////////////////// DisplayRegion:: DisplayRegion(GraphicsLayer *layer, const float l, - const float r, const float b, const float t) + const float r, const float b, const float t) : _l(l), _r(r), _b(b), _t(t), _layer(layer), _active(true) diff --git a/panda/src/display/displayRegion.h b/panda/src/display/displayRegion.h index 5f62a149dd..82cffb42be 100644 --- a/panda/src/display/displayRegion.h +++ b/panda/src/display/displayRegion.h @@ -32,8 +32,8 @@ class EXPCL_PANDA DisplayRegion : public ReferenceCount { public: DisplayRegion(GraphicsLayer *); DisplayRegion(GraphicsLayer *, - const float l, const float r, - const float b, const float t); + const float l, const float r, + const float b, const float t); DisplayRegion(int xsize, int ysize); virtual ~DisplayRegion(); @@ -62,7 +62,7 @@ PUBLISHED: void output(ostream &out) const; protected: - + float _l; float _r; float _b; diff --git a/panda/src/display/displayRegionStack.h b/panda/src/display/displayRegionStack.h index 18cb334a8c..1240e07940 100644 --- a/panda/src/display/displayRegionStack.h +++ b/panda/src/display/displayRegionStack.h @@ -13,7 +13,7 @@ class GraphicsStateGuardian; //////////////////////////////////////////////////////////////////// -// Class : DisplayRegionStack +// Class : DisplayRegionStack // Description : An instance of this kind of object is returned by // GraphicsStateGuardian::push_display_region(). It // holds the information needed to restore the previous diff --git a/panda/src/display/frameBufferStack.h b/panda/src/display/frameBufferStack.h index 1b009f7646..7a5d79f1e1 100644 --- a/panda/src/display/frameBufferStack.h +++ b/panda/src/display/frameBufferStack.h @@ -13,7 +13,7 @@ class GraphicsStateGuardian; //////////////////////////////////////////////////////////////////// -// Class : FrameBufferStack +// Class : FrameBufferStack // Description : An instance of this kind of object is returned by // GraphicsStateGuardian::push_frame_buffer(). It // holds the information needed to restore the previous diff --git a/panda/src/display/graphicsChannel.h b/panda/src/display/graphicsChannel.h index 553d7cefba..5a298e4ab0 100644 --- a/panda/src/display/graphicsChannel.h +++ b/panda/src/display/graphicsChannel.h @@ -79,7 +79,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "GraphicsChannel", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/graphicsLayer.h b/panda/src/display/graphicsLayer.h index 80e51f2523..614fe1bbf5 100644 --- a/panda/src/display/graphicsLayer.h +++ b/panda/src/display/graphicsLayer.h @@ -47,7 +47,7 @@ public: PUBLISHED: DisplayRegion *make_display_region(); DisplayRegion *make_display_region(float l, float r, - float b, float t); + float b, float t); int get_num_drs() const; DisplayRegion *get_dr(int index) const; @@ -85,7 +85,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "GraphicsLayer", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/graphicsPipe.cxx b/panda/src/display/graphicsPipe.cxx index 0893a5dc0b..e4eea7d1d6 100644 --- a/panda/src/display/graphicsPipe.cxx +++ b/panda/src/display/graphicsPipe.cxx @@ -33,7 +33,7 @@ TypeHandle GraphicsPipe::PipeSpec::get_class_type(void) { void GraphicsPipe::PipeSpec::init_type(void) { PipeParam::init_type(); register_type(_type_handle, "GraphicsPipe::PipeSpec", - PipeParam::get_class_type()); + PipeParam::get_class_type()); } TypeHandle GraphicsPipe::PipeSpec::get_type(void) const { @@ -300,13 +300,13 @@ void GraphicsPipe::read_priorities(void) { ConfigString type_name = (*i).Val(); TypeHandle type = TypeRegistry::ptr()->find_type(type_name); if (type == TypeHandle::none()) { - display_cat.warning() - << "Unknown type requested for pipe preference: " << type_name - << "\n"; + display_cat.warning() + << "Unknown type requested for pipe preference: " << type_name + << "\n"; } else { - display_cat.debug() - << "Specifying type " << type << " for pipe preference.\n"; - factory.add_preferred(type); + display_cat.debug() + << "Specifying type " << type << " for pipe preference.\n"; + factory.add_preferred(type); } } } @@ -337,7 +337,7 @@ void GraphicsPipe::resolve_modules(void) { void *tmp = load_dso(dlname); if (tmp == (void*)0L) { display_cat.info() - << "Unable to load: " << load_dso_error() << endl; + << "Unable to load: " << load_dso_error() << endl; } } for (i=gsg_modules_begin(); i!=gsg_modules_end(); ++i) { @@ -347,7 +347,7 @@ void GraphicsPipe::resolve_modules(void) { void *tmp = load_dso(dlname); if (tmp == (void*)0L) { display_cat.info() - << "Unable to load: " << load_dso_error() << endl; + << "Unable to load: " << load_dso_error() << endl; } } diff --git a/panda/src/display/graphicsPipe.h b/panda/src/display/graphicsPipe.h index c4b8694606..496933c909 100644 --- a/panda/src/display/graphicsPipe.h +++ b/panda/src/display/graphicsPipe.h @@ -120,8 +120,8 @@ public: TypedReferenceCount::init_type(); Namable::init_type(); register_type(_type_handle, "GraphicsPipe", - TypedReferenceCount::get_class_type(), - Namable::get_class_type()); + TypedReferenceCount::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index 2b230cd992..f5613b9396 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -134,7 +134,7 @@ pop_display_region(DisplayRegionStack &node) { //////////////////////////////////////////////////////////////////// INLINE FrameBufferStack GraphicsStateGuardian:: push_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr) { + CPT(DisplayRegion) dr) { FrameBufferStack old; old._frame_buffer = save_frame_buffer(buffer, dr); old._stack_level = _frame_buffer_stack_level; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 50b8597951..98aa0d28fd 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -47,7 +47,7 @@ TypeHandle GraphicsStateGuardian::GsgWindow::get_class_type(void) { void GraphicsStateGuardian::GsgWindow::init_type(void) { GsgParam::init_type(); register_type(_type_handle, "GraphicsStateGuardian::GsgWindow", - GsgParam::get_class_type()); + GsgParam::get_class_type()); } TypeHandle GraphicsStateGuardian::GsgWindow::get_type(void) const { @@ -167,16 +167,16 @@ set_state(const NodeAttributes &new_state, bool complete) { // before. Issue the command. if ((*new_i).second != (NodeAttribute *)NULL) { - if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Issuing new attrib " << *(*new_i).second << "\n"; - } + if (gsg_cat.is_debug()) { + gsg_cat.debug() + << "Issuing new attrib " << *(*new_i).second << "\n"; + } record_state_change((*new_i).first); - (*new_i).second->issue(this); - - // And store the new value. - current_i = _state.insert(current_i, *new_i); - ++current_i; + (*new_i).second->issue(this); + + // And store the new value. + current_i = _state.insert(current_i, *new_i); + ++current_i; } ++new_i; @@ -186,81 +186,81 @@ set_state(const NodeAttributes &new_state, bool complete) { // didn't specify this time. if (complete) { - // If we're in the "complete state" model, that means this - // attribute should now get the default initial value. + // If we're in the "complete state" model, that means this + // attribute should now get the default initial value. - if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Unissuing attrib " << *(*current_i).second - << " (previously set, not now)\n"; - } + if (gsg_cat.is_debug()) { + gsg_cat.debug() + << "Unissuing attrib " << *(*current_i).second + << " (previously set, not now)\n"; + } record_state_change((*current_i).first); - PT(NodeAttribute) initial = (*current_i).second->make_initial(); - initial->issue(this); + PT(NodeAttribute) initial = (*current_i).second->make_initial(); + initial->issue(this); - NodeAttributes::iterator erase_i = current_i; - ++current_i; - - _state.erase(erase_i); + NodeAttributes::iterator erase_i = current_i; + ++current_i; + + _state.erase(erase_i); } else { - ++current_i; + ++current_i; } } else { // (*current_i).first == (*new_i).first) if ((*new_i).second == (NodeAttribute *)NULL) { - // Here's an attribute that we've set previously, which - // appears in the new list, but is NULL indicating it should - // be removed. + // Here's an attribute that we've set previously, which + // appears in the new list, but is NULL indicating it should + // be removed. - if (complete) { - // Only remove it if we're in the "complete state" model. + if (complete) { + // Only remove it if we're in the "complete state" model. - if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Unissuing attrib " << *(*current_i).second - << " (previously set, now NULL)\n"; - } + if (gsg_cat.is_debug()) { + gsg_cat.debug() + << "Unissuing attrib " << *(*current_i).second + << " (previously set, now NULL)\n"; + } record_state_change((*current_i).first); - // Issue the initial attribute before clearing the state. - PT(NodeAttribute) initial = (*current_i).second->make_initial(); - initial->issue(this); + // Issue the initial attribute before clearing the state. + PT(NodeAttribute) initial = (*current_i).second->make_initial(); + initial->issue(this); - NodeAttributes::iterator erase_i = current_i; - ++current_i; - - _state.erase(erase_i); + NodeAttributes::iterator erase_i = current_i; + ++current_i; - } else { - ++current_i; - } - ++new_i; + _state.erase(erase_i); + + } else { + ++current_i; + } + ++new_i; } else { - // Here's an attribute that we've set previously, and the user - // asked us to set it again. Issue the command only if the new - // attribute is different from that which we'd set before. - if ((*new_i).second->compare_to(*(*current_i).second) != 0) { - if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Reissuing attrib " << *(*new_i).second << "\n"; - } + // Here's an attribute that we've set previously, and the user + // asked us to set it again. Issue the command only if the new + // attribute is different from that which we'd set before. + if ((*new_i).second->compare_to(*(*current_i).second) != 0) { + if (gsg_cat.is_debug()) { + gsg_cat.debug() + << "Reissuing attrib " << *(*new_i).second << "\n"; + } record_state_change((*new_i).first); - (*new_i).second->issue(this); + (*new_i).second->issue(this); - // And store the new value. - (*current_i).second = (*new_i).second; + // And store the new value. + (*current_i).second = (*new_i).second; - } else if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Not reissuing unchanged attrib " << *(*new_i).second << "\n"; - } + } else if (gsg_cat.is_debug()) { + gsg_cat.debug() + << "Not reissuing unchanged attrib " << *(*new_i).second << "\n"; + } - ++current_i; - ++new_i; + ++current_i; + ++new_i; } } } @@ -271,8 +271,8 @@ set_state(const NodeAttributes &new_state, bool complete) { if ((*new_i).second != (NodeAttribute *)NULL) { if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Issuing new attrib " << *(*new_i).second << "\n"; + gsg_cat.debug() + << "Issuing new attrib " << *(*new_i).second << "\n"; } record_state_change((*new_i).first); @@ -290,9 +290,9 @@ set_state(const NodeAttributes &new_state, bool complete) { // didn't specify this time. if (gsg_cat.is_debug()) { - gsg_cat.debug() - << "Unissuing attrib " << *(*current_i).second - << " (previously set, end of list)\n"; + gsg_cat.debug() + << "Unissuing attrib " << *(*current_i).second + << " (previously set, end of list)\n"; } record_state_change((*current_i).first); @@ -326,7 +326,7 @@ get_render_buffer(int buffer_type) { // Function: GraphicsStateGuardian::set_color_clear_value // Access: Public // Description: Sets the color that the next clear() command will set -// the color buffer to +// the color buffer to //////////////////////////////////////////////////////////////////// void GraphicsStateGuardian:: set_color_clear_value(const Colorf& value) { @@ -582,13 +582,13 @@ read_priorities(void) { ConfigString type_name = (*i).Val(); TypeHandle type = TypeRegistry::ptr()->find_type(type_name); if (type == TypeHandle::none()) { - display_cat.warning() - << "Unknown type requested for GSG preference: " << type_name - << "\n"; + display_cat.warning() + << "Unknown type requested for GSG preference: " << type_name + << "\n"; } else { - display_cat.debug() - << "Specifying type " << type << " for GSG preference.\n"; - factory.add_preferred(type); + display_cat.debug() + << "Specifying type " << type << " for GSG preference.\n"; + factory.add_preferred(type); } } } diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index 27b4091de6..db9990c999 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -26,7 +26,7 @@ class AllAttributesWrapper; class AllTransitionsWrapper; //////////////////////////////////////////////////////////////////// -// Class : GraphicsStateGuardian +// Class : GraphicsStateGuardian // Description : Encapsulates all the communication with a particular // instance of a given rendering backend. Tries to // guarantee that redundant state-change requests are @@ -76,15 +76,15 @@ public: virtual void render_frame(const AllAttributesWrapper &initial_state)=0; virtual void render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state)=0; + const AllAttributesWrapper &initial_state)=0; virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans)=0; + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans)=0; virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans)=0; + Node *subgraph, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans)=0; INLINE void enable_normals(bool val) { _normals_enabled = val; } @@ -114,7 +114,7 @@ public: INLINE DisplayRegionStack push_display_region(CPT(DisplayRegion) dr); INLINE void pop_display_region(DisplayRegionStack &node); INLINE FrameBufferStack push_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); INLINE void pop_frame_buffer(FrameBufferStack &node); INLINE void set_coordinate_system(CoordinateSystem cs); @@ -129,7 +129,7 @@ public: protected: virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr)=0; + CPT(DisplayRegion) dr)=0; virtual void restore_frame_buffer(SavedFrameBuffer *frame_buffer)=0; bool mark_prepared_texture(TextureContext *tc); @@ -242,7 +242,7 @@ public: static void init_type() { GraphicsStateGuardianBase::init_type(); register_type(_type_handle, "GraphicsStateGuardian", - GraphicsStateGuardianBase::get_class_type()); + GraphicsStateGuardianBase::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/graphicsWindow.I b/panda/src/display/graphicsWindow.I index d1428e10cf..0f41715ec1 100644 --- a/panda/src/display/graphicsWindow.I +++ b/panda/src/display/graphicsWindow.I @@ -143,7 +143,7 @@ has_keyboard(int device) const { INLINE const MouseData &GraphicsWindow:: get_mouse_data(int device) const { nassertr(device >= 0 && device < (int)_input_devices.size(), - *(new MouseData)); + *(new MouseData)); return _input_devices[device].get_mouse_data(); } diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index c2d5b6572c..5f9960b64f 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -83,7 +83,7 @@ TypeHandle GraphicsWindow::WindowProps::get_class_type(void) { void GraphicsWindow::WindowProps::init_type(void) { WindowParam::init_type(); register_type(_type_handle, "GraphicsWindow::WindowProps", - WindowParam::get_class_type()); + WindowParam::get_class_type()); } TypeHandle GraphicsWindow::WindowProps::get_type(void) const { @@ -104,7 +104,7 @@ TypeHandle GraphicsWindow::WindowPipe::get_class_type(void) { void GraphicsWindow::WindowPipe::init_type(void) { WindowParam::init_type(); register_type(_type_handle, "GraphicsWindow::WindowPipe", - WindowParam::get_class_type()); + WindowParam::get_class_type()); } TypeHandle GraphicsWindow::WindowPipe::get_type(void) const { @@ -139,7 +139,7 @@ GraphicsWindow(GraphicsPipe *pipe) : Configurable() { //////////////////////////////////////////////////////////////////// GraphicsWindow:: GraphicsWindow(GraphicsPipe *pipe, - const GraphicsWindow::Properties& props) : Configurable() { + const GraphicsWindow::Properties& props) : Configurable() { MemoryUsage::update_type(this, this); _pipe = pipe; _props = props; @@ -231,10 +231,10 @@ get_channel(int index) { chan = _pipe->get_hw_channel(this, index); if (chan == NULL) { display_cat.error() - << "GraphicsWindow::get_channel() - got a NULL channel" << endl; + << "GraphicsWindow::get_channel() - got a NULL channel" << endl; } else { if (chan->get_window() != this) { - chan = NULL; + chan = NULL; } } } @@ -527,13 +527,13 @@ void GraphicsWindow::read_priorities(void) { ConfigString type_name = (*i).Val(); TypeHandle type = TypeRegistry::ptr()->find_type(type_name); if (type == TypeHandle::none()) { - display_cat.warning() - << "Unknown type requested for window preference: " << type_name - << "\n"; + display_cat.warning() + << "Unknown type requested for window preference: " << type_name + << "\n"; } else { - display_cat.debug() - << "Specifying type " << type << " for window preference.\n"; - factory.add_preferred(type); + display_cat.debug() + << "Specifying type " << type << " for window preference.\n"; + factory.add_preferred(type); } } } diff --git a/panda/src/display/graphicsWindow.h b/panda/src/display/graphicsWindow.h index 216a6c26af..d224b634a5 100644 --- a/panda/src/display/graphicsWindow.h +++ b/panda/src/display/graphicsWindow.h @@ -117,7 +117,7 @@ public: INLINE void call_idle_callback(); PT(DisplayRegion) make_scratch_display_region(int xsize, - int ysize) const; + int ysize) const; virtual TypeHandle get_gsg_type() const=0; @@ -257,8 +257,8 @@ public: Configurable::init_type(); ReferenceCount::init_type(); register_type(_type_handle, "GraphicsWindow", - Configurable::get_class_type(), - ReferenceCount::get_class_type()); + Configurable::get_class_type(), + ReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/hardwareChannel.cxx b/panda/src/display/hardwareChannel.cxx index f9a79bf40a..215ca2d1ac 100644 --- a/panda/src/display/hardwareChannel.cxx +++ b/panda/src/display/hardwareChannel.cxx @@ -21,7 +21,7 @@ TypeHandle HardwareChannel::_type_handle; //////////////////////////////////////////////////////////////////// HardwareChannel:: HardwareChannel( GraphicsWindow* window ) : - GraphicsChannel( window ) { + GraphicsChannel( window ) { _id = 0; _xorg = 0; _yorg = 0; diff --git a/panda/src/display/hardwareChannel.h b/panda/src/display/hardwareChannel.h index 3c428fb874..cc3ae80c2c 100644 --- a/panda/src/display/hardwareChannel.h +++ b/panda/src/display/hardwareChannel.h @@ -20,32 +20,32 @@ //////////////////////////////////////////////////////////////////// // Class : HardwareChannel // Description : Video output channels if available on the current -// platform -// NOTE: hardware channels belong to a pipe rather -// than to a particular window +// platform +// NOTE: hardware channels belong to a pipe rather +// than to a particular window //////////////////////////////////////////////////////////////////// class EXPCL_PANDA HardwareChannel : public GraphicsChannel { public: - HardwareChannel( GraphicsWindow* window ); - ~HardwareChannel( void ); + HardwareChannel( GraphicsWindow* window ); + ~HardwareChannel( void ); virtual void window_resized(int x, int y); - INLINE int get_id( void ) const; - INLINE int get_xorg( void ) const; - INLINE int get_yorg( void ) const; - INLINE int get_xsize( void ) const; - INLINE int get_ysize( void ) const; + INLINE int get_id( void ) const; + INLINE int get_xorg( void ) const; + INLINE int get_yorg( void ) const; + INLINE int get_xsize( void ) const; + INLINE int get_ysize( void ) const; protected: - int _id; - int _xorg; - int _yorg; - int _xsize; - int _ysize; + int _id; + int _xorg; + int _yorg; + int _xsize; + int _ysize; public: diff --git a/panda/src/display/interactiveGraphicsPipe.cxx b/panda/src/display/interactiveGraphicsPipe.cxx index 8ea23c3090..4e849ff317 100644 --- a/panda/src/display/interactiveGraphicsPipe.cxx +++ b/panda/src/display/interactiveGraphicsPipe.cxx @@ -39,7 +39,7 @@ TypeHandle InteractiveGraphicsPipe::get_class_type(void) { void InteractiveGraphicsPipe::init_type(void) { GraphicsPipe::init_type(); register_type(_type_handle, "InteractiveGraphicsPipe", - GraphicsPipe::get_class_type()); + GraphicsPipe::get_class_type()); } TypeHandle InteractiveGraphicsPipe::get_type(void) const { diff --git a/panda/src/display/noninteractiveGraphicsPipe.cxx b/panda/src/display/noninteractiveGraphicsPipe.cxx index 6260941419..b1a54202d3 100644 --- a/panda/src/display/noninteractiveGraphicsPipe.cxx +++ b/panda/src/display/noninteractiveGraphicsPipe.cxx @@ -39,7 +39,7 @@ TypeHandle NoninteractiveGraphicsPipe::get_class_type(void) { void NoninteractiveGraphicsPipe::init_type(void) { GraphicsPipe::init_type(); register_type(_type_handle, "NoninteractiveGraphicsPipe", - GraphicsPipe::get_class_type()); + GraphicsPipe::get_class_type()); } TypeHandle NoninteractiveGraphicsPipe::get_type(void) const { diff --git a/panda/src/display/renderBuffer.h b/panda/src/display/renderBuffer.h index 21d1859d58..84cbdb125c 100644 --- a/panda/src/display/renderBuffer.h +++ b/panda/src/display/renderBuffer.h @@ -10,7 +10,7 @@ class GraphicsStateGuardian; //////////////////////////////////////////////////////////////////// -// Class : RenderBuffer +// Class : RenderBuffer // Description : A RenderBuffer is an arbitrary subset of the various // layers (depth buffer, color buffer, etc.) of a // drawing region. It consists of a diff --git a/panda/src/display/savedFrameBuffer.h b/panda/src/display/savedFrameBuffer.h index bffc612e65..a17b6e6912 100644 --- a/panda/src/display/savedFrameBuffer.h +++ b/panda/src/display/savedFrameBuffer.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : SavedFrameBuffer +// Class : SavedFrameBuffer // Description : Occasionally we need to save the contents of the // frame buffer for restoring later, particularly when // we are doing multipass effects. The precise form in @@ -37,7 +37,7 @@ class EXPCL_PANDA SavedFrameBuffer : public TypedReferenceCount { public: INLINE SavedFrameBuffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); RenderBuffer _buffer; CPT(DisplayRegion) _display_region; @@ -50,7 +50,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "SavedFrameBuffer", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/display/textureContext.h b/panda/src/display/textureContext.h index a924186c19..005a09404b 100644 --- a/panda/src/display/textureContext.h +++ b/panda/src/display/textureContext.h @@ -13,7 +13,7 @@ class Texture; //////////////////////////////////////////////////////////////////// -// Class : TextureContext +// Class : TextureContext // Description : This is a special class object that holds all the // information returned by a particular GSG to indicate // the texture's internal context identifier. @@ -43,7 +43,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "TextureContext", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/doc/sampleClass.h b/panda/src/doc/sampleClass.h index 70af19379a..c3ea3d0a4b 100644 --- a/panda/src/doc/sampleClass.h +++ b/panda/src/doc/sampleClass.h @@ -22,7 +22,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : SampleClass +// Class : SampleClass // Description : A basic description of the function and purpose of // SampleClass. Note that class names are generally // mixed case, no underscore, beginning with a capital diff --git a/panda/src/downloader/asyncDecompressor.cxx b/panda/src/downloader/asyncDecompressor.cxx index 06e65f9aae..7cd546e7ad 100644 --- a/panda/src/downloader/asyncDecompressor.cxx +++ b/panda/src/downloader/asyncDecompressor.cxx @@ -29,7 +29,7 @@ class DecompressorToken : public ReferenceCount { public: INLINE DecompressorToken(uint id, const Filename &source_file, - const Filename &dest_file, const string &event_name) { + const Filename &dest_file, const string &event_name) { _id = id; _source_file = source_file; _dest_file = dest_file; @@ -120,7 +120,7 @@ request_decompress(const Filename &source_file, const string &event_name) { //////////////////////////////////////////////////////////////////// int Decompressor:: request_decompress(const Filename &source_file, const Filename &dest_file, - const string &event_name) { + const string &event_name) { PT(DecompressorToken) tok; if (_threads_enabled) { @@ -150,7 +150,7 @@ request_decompress(const Filename &source_file, const Filename &dest_file, } tok = new DecompressorToken(_next_token++, source_file, dest_file, - event_name); + event_name); _token_board->_waiting.insert(tok); #ifdef HAVE_IPC @@ -172,7 +172,7 @@ request_decompress(const Filename &source_file, const Filename &dest_file, } tok = new DecompressorToken(_next_token++, source_file, dest_file, - event_name); + event_name); _token_board->_waiting.insert(tok); process_request(); } @@ -211,7 +211,7 @@ process_request() { if (downloader_cat.is_debug()) { downloader_cat.debug() << "Decompressor::process_request() - decompress complete for " - << tok->_source_file << "\n"; + << tok->_source_file << "\n"; } } } @@ -295,8 +295,8 @@ decompress(Filename &source_file, Filename &dest_file) { source_buffer_length = read_stream.gcount(); total_bytes_read += source_buffer_length; if (read_stream.eof()) { - nassertr(total_bytes_read == source_file_length, false); - read_all_input = true; + nassertr(total_bytes_read == source_file_length, false); + read_all_input = true; } } @@ -310,13 +310,13 @@ decompress(Filename &source_file, Filename &dest_file) { while (avail_in > 0) { int ret = decompressor.decompress_to_stream(next_in, avail_in, - next_out, avail_out, dest_buffer, - dest_buffer_length, write_stream); + next_out, avail_out, dest_buffer, + dest_buffer_length, write_stream); if (ret == ZCompressorBase::S_error) - return false; + return false; if ((int)decompressor.get_total_in() == source_file_length && - avail_out == dest_buffer_length) - handled_all_input = true; + avail_out == dest_buffer_length) + handled_all_input = true; } nap(); diff --git a/panda/src/downloader/asyncDecompressor.h b/panda/src/downloader/asyncDecompressor.h index b20a62b39f..e1debc43c3 100644 --- a/panda/src/downloader/asyncDecompressor.h +++ b/panda/src/downloader/asyncDecompressor.h @@ -29,10 +29,10 @@ PUBLISHED: virtual ~Decompressor(void); int request_decompress(const Filename &source_file, - const string &event_name); + const string &event_name); int request_decompress(const Filename &source_file, - const Filename &dest_file, - const string &event_name); + const Filename &dest_file, + const string &event_name); bool decompress(Filename &source_file); bool decompress(Filename &source_file, Filename &dest_file); diff --git a/panda/src/downloader/asyncDownloader.I b/panda/src/downloader/asyncDownloader.I index 850c6dd292..67d1b7c4a9 100644 --- a/panda/src/downloader/asyncDownloader.I +++ b/panda/src/downloader/asyncDownloader.I @@ -9,7 +9,7 @@ // Function: Downloader::set_byte_rate // Access: Public // Description: Note: modem speeds are reported in bits, so you -// need to convert! +// need to convert! //////////////////////////////////////////////////////////////////// INLINE void Downloader:: set_byte_rate(float bytes) { diff --git a/panda/src/downloader/asyncDownloader.cxx b/panda/src/downloader/asyncDownloader.cxx index 5ebe7abdd8..7256edce61 100644 --- a/panda/src/downloader/asyncDownloader.cxx +++ b/panda/src/downloader/asyncDownloader.cxx @@ -50,10 +50,10 @@ enum receive_status { class DownloaderToken : public ReferenceCount { public: INLINE DownloaderToken(uint id, const string &file_name, - const Filename &file_dest, const string &event_name, - int first_byte, int last_byte, int total_bytes, - bool partial_content, bool sync) : _id(id), _first_byte(first_byte), - _last_byte(last_byte), _total_bytes(total_bytes) { + const Filename &file_dest, const string &event_name, + int first_byte, int last_byte, int total_bytes, + bool partial_content, bool sync) : _id(id), _first_byte(first_byte), + _last_byte(last_byte), _total_bytes(total_bytes) { _file_name = file_name; _event_name = event_name; _file_dest = file_dest; @@ -169,8 +169,8 @@ connect_to_server(const string &name, uint port) { (void)memcpy(&_sin.sin_addr, hp->h_addr, (uint)hp->h_length); else { downloader_cat.error() - << "Downloader::connect_to_server() - gethostbyname() failed: " - << strerror(errno) << endl; + << "Downloader::connect_to_server() - gethostbyname() failed: " + << strerror(errno) << endl; return false; } } else @@ -238,7 +238,7 @@ disconnect_from_server(void) { //////////////////////////////////////////////////////////////////// int Downloader:: request_sync_download(const string &file_name, const Filename &file_dest, - const string &event_name) { + const string &event_name) { return request_download(file_name, file_dest, event_name, true); } @@ -249,10 +249,10 @@ request_sync_download(const string &file_name, const Filename &file_dest, //////////////////////////////////////////////////////////////////// int Downloader:: request_sync_download(const string &file_name, const Filename &file_dest, - const string &event_name, int first_byte, - int last_byte, int total_bytes, bool partial_content) { + const string &event_name, int first_byte, + int last_byte, int total_bytes, bool partial_content) { return request_download(file_name, file_dest, event_name, first_byte, - last_byte, total_bytes, partial_content, true); + last_byte, total_bytes, partial_content, true); } //////////////////////////////////////////////////////////////////// @@ -262,9 +262,9 @@ request_sync_download(const string &file_name, const Filename &file_dest, //////////////////////////////////////////////////////////////////// int Downloader:: request_download(const string &file_name, const Filename &file_dest, - const string &event_name, bool sync) { + const string &event_name, bool sync) { return request_download(file_name, file_dest, event_name, 0, 0, 0, - false, sync); + false, sync); } //////////////////////////////////////////////////////////////////// @@ -280,13 +280,13 @@ request_download(const string &file_name, const Filename &file_dest, // identify this particular request later to // fetch_load(), or 0 if there has been an error. // -// Can be used to request a partial download of a file. +// Can be used to request a partial download of a file. //////////////////////////////////////////////////////////////////// int Downloader:: request_download(const string &file_name, const Filename &file_dest, - const string &event_name, int first_byte, - int last_byte, int total_bytes, - bool partial_content, bool sync) { + const string &event_name, int first_byte, + int last_byte, int total_bytes, + bool partial_content, bool sync) { nassertr(first_byte <= last_byte && last_byte <= total_bytes, 0); @@ -318,8 +318,8 @@ request_download(const string &file_name, const Filename &file_dest, } tok = new DownloaderToken(_next_token++, file_name, file_dest, - event_name, first_byte, last_byte, total_bytes, - partial_content, sync); + event_name, first_byte, last_byte, total_bytes, + partial_content, sync); _token_board->_waiting.insert(tok); #ifdef HAVE_IPC @@ -341,8 +341,8 @@ request_download(const string &file_name, const Filename &file_dest, } tok = new DownloaderToken(_next_token++, file_name, file_dest, - event_name, first_byte, last_byte, total_bytes, - partial_content, sync); + event_name, first_byte, last_byte, total_bytes, + partial_content, sync); _token_board->_waiting.insert(tok); process_request(); } @@ -369,8 +369,8 @@ process_request() { while (!_token_board->_waiting.is_empty()) { PT(DownloaderToken) tok = _token_board->_waiting.extract(); int ret = download(tok->_file_name, tok->_file_dest, tok->_event_name, - tok->_first_byte, tok->_last_byte, tok->_total_bytes, - tok->_partial_content, tok->_sync, tok->_id); + tok->_first_byte, tok->_last_byte, tok->_total_bytes, + tok->_partial_content, tok->_sync, tok->_id); nassertr(tok->_event_name.empty() == false, false); PT_Event return_event = new Event(tok->_event_name); return_event->add_parameter(EventParameter((int)tok->_id)); @@ -388,7 +388,7 @@ process_request() { if (downloader_cat.is_debug()) { downloader_cat.debug() << "Downloader::process_request() - downloading complete for " - << tok->_file_name << "\n"; + << tok->_file_name << "\n"; } } else { return_event->add_parameter(EventParameter(ret)); @@ -422,12 +422,12 @@ safe_send(int socket, const char *data, int length, long timeout) { int sret = select(socket + 1, NULL, &wset, NULL, &tv); if (sret == 0) { downloader_cat.error() - << "Downloader::safe_send() - select timed out after: " - << timeout << " seconds" << endl; + << "Downloader::safe_send() - select timed out after: " + << timeout << " seconds" << endl; return SS_timeout; } else if (sret == -1) { downloader_cat.error() - << "Downloader::safe_send() - error: " << strerror(errno) << endl; + << "Downloader::safe_send() - error: " << strerror(errno) << endl; return SS_error; } int ret = send(socket, data, length, 0); @@ -435,7 +435,7 @@ safe_send(int socket, const char *data, int length, long timeout) { bytes += ret; else { downloader_cat.error() - << "Downloader::safe_send() - error: " << strerror(errno) << endl; + << "Downloader::safe_send() - error: " << strerror(errno) << endl; return SS_error; } } @@ -449,7 +449,7 @@ safe_send(int socket, const char *data, int length, long timeout) { //////////////////////////////////////////////////////////////////// int Downloader:: safe_receive(int socket, DownloadStatus &status, int length, - long timeout, int &bytes) { + long timeout, int &bytes) { bytes = 0; if (length == 0) { downloader_cat.error() @@ -466,37 +466,37 @@ safe_receive(int socket, DownloadStatus &status, int length, int sret = select(socket + 1, &rset, NULL, NULL, &tv); if (sret == 0) { downloader_cat.warning() - << "Downloader::safe_receive() - select timed out after: " - << timeout << " seconds" << endl; + << "Downloader::safe_receive() - select timed out after: " + << timeout << " seconds" << endl; return RS_timeout; } else if (sret == -1) { downloader_cat.error() - << "Downloader::safe_receive() - error: " << strerror(errno) << endl; + << "Downloader::safe_receive() - error: " << strerror(errno) << endl; return RS_error; } int ret = recv(socket, status._next_in, length - bytes, 0); if (ret > 0) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::safe_receive() - recv() got: " << ret << " bytes" - << endl; + << "Downloader::safe_receive() - recv() got: " << ret << " bytes" + << endl; bytes += ret; status._next_in += ret; status._bytes_in_buffer += ret; if (bytes < length) { - if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::safe_receive() - Download stalled" << endl; + if (downloader_cat.is_debug()) + downloader_cat.debug() + << "Downloader::safe_receive() - Download stalled" << endl; _current_attempt_stalled = true; } } else if (ret == 0) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::safe_receive() - End of file" << endl; + << "Downloader::safe_receive() - End of file" << endl; return RS_eof; } else { downloader_cat.error() - << "Downloader::safe_receive() - error: " << strerror(errno) << endl; + << "Downloader::safe_receive() - error: " << strerror(errno) << endl; return RS_error; } } @@ -529,24 +529,24 @@ attempt_read(int length, DownloadStatus &status, int &bytes_read) { // Make the request for length bytes int bytes; int ans = safe_receive(_socket, status, length, - (long)downloader_timeout, bytes); + (long)downloader_timeout, bytes); bytes_read += bytes; switch (ans) { case RS_error: case RS_eof: - return ans; + return ans; case RS_timeout: - // Try again - break; + // Try again + break; case RS_success: - nassertr(bytes == length, RS_error); - return RS_success; + nassertr(bytes == length, RS_error); + return RS_success; default: - downloader_cat.error() - << "Downloader::attempt_read() - unknown return condition " - << "from safe_receive() : " << ans << endl; - return RS_error; + downloader_cat.error() + << "Downloader::attempt_read() - unknown return condition " + << "from safe_receive() : " << ans << endl; + return RS_error; } } @@ -562,13 +562,13 @@ attempt_read(int length, DownloadStatus &status, int &bytes_read) { //////////////////////////////////////////////////////////////////// int Downloader:: download(const string &file_name, Filename file_dest, - const string &event_name, int first_byte, int last_byte, - int total_bytes, bool partial_content, bool sync, uint id) { + const string &event_name, int first_byte, int last_byte, + int total_bytes, bool partial_content, bool sync, uint id) { if (_download_enabled == false) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::download() - downloading is disabled" << endl; + << "Downloader::download() - downloading is disabled" << endl; return DS_abort; } @@ -612,13 +612,13 @@ download(const string &file_name, Filename file_dest, downloader_cat.debug() << "Downloader::download() - Sending request:\n" << request << endl; int send_ret = safe_send(_socket, request.c_str(), outlen, - (long)downloader_timeout); + (long)downloader_timeout); // Handle timeouts on the send if (send_ret == SS_timeout) { for (int sr = 0; sr < downloader_timeout_retries; sr++) { send_ret = safe_send(_socket, request.c_str(), outlen, - (long)downloader_timeout); + (long)downloader_timeout); if (send_ret != SS_timeout) break; } @@ -636,7 +636,7 @@ download(const string &file_name, Filename file_dest, // Create a download status to maintain download progress information DownloadStatus status(_buffer->_buffer, event_name, first_byte, last_byte, - total_bytes, partial_content, id); + total_bytes, partial_content, id); bool got_any_data = false; // Loop at the requested frequency until the download completes @@ -667,16 +667,16 @@ download(const string &file_name, Filename file_dest, if (resize_buffer == true) { // Flush the write buffer before resizing it if (status._bytes_in_buffer > 0) { - if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::download() - Flushing buffer" << endl; - - if (write_to_disk(status) == false) { - downloader_cat.error() - << "Downloader::download() - failed to flush buffer during " - << "resize" << endl; - return DS_abort; - } + if (downloader_cat.is_debug()) + downloader_cat.debug() + << "Downloader::download() - Flushing buffer" << endl; + + if (write_to_disk(status) == false) { + downloader_cat.error() + << "Downloader::download() - failed to flush buffer during " + << "resize" << endl; + return DS_abort; + } } // Resize the buffer @@ -684,17 +684,17 @@ download(const string &file_name, Filename file_dest, if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::download() - resizing disk buffer to: " - << _disk_buffer_size << endl; + << "Downloader::download() - resizing disk buffer to: " + << _disk_buffer_size << endl; _buffer.clear(); downloader_cat.debug() - << "Downloader::download() - buffer cleared" << endl; + << "Downloader::download() - buffer cleared" << endl; _buffer = new Buffer(_disk_buffer_size); // Update the status with the new buffer status._buffer = _buffer->_buffer; status.reset(); downloader_cat.debug() - << "Downloader::download() - new buffer created" << endl; + << "Downloader::download() - new buffer created" << endl; } #ifdef HAVE_IPC @@ -707,8 +707,8 @@ download(const string &file_name, Filename file_dest, int ret = attempt_read(_read_size, status, bytes_read); if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::download() - stalled status: " << _current_attempt_stalled - << endl; + << "Downloader::download() - stalled status: " << _current_attempt_stalled + << endl; _last_attempt_stalled = _current_attempt_stalled; _current_attempt_stalled = false; @@ -721,69 +721,69 @@ download(const string &file_name, Filename file_dest, downloader_cat.error() << "Downloader::download() - Error reading from socket: " - << strerror(errno) << endl; - return DS_abort; + << strerror(errno) << endl; + return DS_abort; case RS_timeout: - { + { // We've really timed out - throw an event - downloader_cat.error() - << "Downloader::download() - receive timed out after: " - << downloader_timeout_retries << " retries" << endl; - if (bytes_read > 0) { - if (write_to_disk(status) == false) { - downloader_cat.error() - << "Downloader::download() - write to disk failed after " - << "timeout!" << endl; - return DS_abort; - } - } - return DS_timeout; - } + downloader_cat.error() + << "Downloader::download() - receive timed out after: " + << downloader_timeout_retries << " retries" << endl; + if (bytes_read > 0) { + if (write_to_disk(status) == false) { + downloader_cat.error() + << "Downloader::download() - write to disk failed after " + << "timeout!" << endl; + return DS_abort; + } + } + return DS_timeout; + } case RS_success: - if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::download() - Got: " << bytes_read << " bytes" - << endl; - break; + if (downloader_cat.is_debug()) + downloader_cat.debug() + << "Downloader::download() - Got: " << bytes_read << " bytes" + << endl; + break; case RS_eof: - { - // We occasionally will get 0 bytes on the first attempt - we - // don't want to treat this as end of file in any case - if (got_any_data == true) { - if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Download for: " << file_name << " completed" << endl; - bool ret = true; - if (bytes_read > 0) - ret = write_to_disk(status); - _dest_stream.close(); + { + // We occasionally will get 0 bytes on the first attempt - we + // don't want to treat this as end of file in any case + if (got_any_data == true) { + if (downloader_cat.is_debug()) + downloader_cat.debug() + << "Download for: " << file_name << " completed" << endl; + bool ret = true; + if (bytes_read > 0) + ret = write_to_disk(status); + _dest_stream.close(); - // The "Connection: close" line tells server to close connection - // when the download is complete - _connected = false; - if (ret == false) - return DS_abort; - return DS_success; - } else { - if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::download() - Received 0 bytes" << endl; - } - } - break; + // The "Connection: close" line tells server to close connection + // when the download is complete + _connected = false; + if (ret == false) + return DS_abort; + return DS_success; + } else { + if (downloader_cat.is_debug()) + downloader_cat.debug() + << "Downloader::download() - Received 0 bytes" << endl; + } + } + break; default: - downloader_cat.error() - << "Downloader::download() - Unknown return value from " - << "attempt_read() : " << ret << endl; - return DS_abort; + downloader_cat.error() + << "Downloader::download() - Unknown return value from " + << "attempt_read() : " << ret << endl; + return DS_abort; } // switch(ret) @@ -824,9 +824,9 @@ parse_http_response(const string &resp) { case 202: // Accepted - server may not honor request, though if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::parse_http_response() - got a 202 Accepted - " - << "server does not guarantee to honor this request" << endl; + downloader_cat.debug() + << "Downloader::parse_http_response() - got a 202 Accepted - " + << "server does not guarantee to honor this request" << endl; return true; case 201: case 203: @@ -846,9 +846,9 @@ parse_http_response(const string &resp) { // Function: Downloader::parse_header // Access: Private // Description: Looks for a valid header. If it finds one, it -// calculates the header length and strips it from -// the download status structure. Function returns false -// on an error condition, otherwise true. +// calculates the header length and strips it from +// the download status structure. Function returns false +// on an error condition, otherwise true. //////////////////////////////////////////////////////////////////// bool Downloader:: parse_header(DownloadStatus &status) { @@ -869,14 +869,14 @@ parse_header(DownloadStatus &status) { size_t nl = bufstr.find("\015\012", p); if (nl == string::npos) { downloader_cat.error() - << "Downloader::parse_header() - No newlines in buffer of " - << "length: " << status._bytes_in_buffer << endl; + << "Downloader::parse_header() - No newlines in buffer of " + << "length: " << status._bytes_in_buffer << endl; return false; } else if (p == 0 && nl == p) { downloader_cat.error() << "Downloader::parse_header() - Buffer begins with newline!" - << endl; - return false; + << endl; + return false; } string component = bufstr.substr(p, nl - p); @@ -886,13 +886,13 @@ parse_header(DownloadStatus &status) { if (status._first_line_complete == false) { status._first_line_complete = true; if (parse_http_response(component) == true) { - if (downloader_cat.is_debug()) + if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::parse_header() - Header is valid: " - << component << endl; - status._header_is_valid = true; + << "Downloader::parse_header() - Header is valid: " + << component << endl; + status._header_is_valid = true; } else { - return false; + return false; } } @@ -904,14 +904,14 @@ parse_header(DownloadStatus &status) { int server_download_bytes = atoi(tline.c_str()); int client_download_bytes = status._last_byte - status._first_byte; if (status._first_byte == 0) - client_download_bytes += 1; + client_download_bytes += 1; if (client_download_bytes != server_download_bytes) { - downloader_cat.error() - << "Downloader::parse_header() - server size = " - << server_download_bytes << ", client size = " - << client_download_bytes << " (" - << status._last_byte << "-" << status._first_byte << ")" << endl; - return false; + downloader_cat.error() + << "Downloader::parse_header() - server size = " + << server_download_bytes << ", client size = " + << client_download_bytes << " (" + << status._last_byte << "-" << status._first_byte << ")" << endl; + return false; } } @@ -919,7 +919,7 @@ parse_header(DownloadStatus &status) { if (nl == p) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::parse_header() - Header is complete" << endl; + << "Downloader::parse_header() - Header is complete" << endl; status._header_is_complete = true; // Strip the header out of the status buffer @@ -929,8 +929,8 @@ parse_header(DownloadStatus &status) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::parse_header() - Stripping out header of size: " - << header_length << endl; + << "Downloader::parse_header() - Stripping out header of size: " + << header_length << endl; return true; } @@ -942,8 +942,8 @@ parse_header(DownloadStatus &status) { if (downloader_cat.is_debug()) downloader_cat.debug() << "Downloader::parse_header() - Reached end of buffer without " - << "successfully parsing the header - buffer size: " - << status._bytes_in_buffer << endl; + << "successfully parsing the header - buffer size: " + << status._bytes_in_buffer << endl; } return true; @@ -953,9 +953,9 @@ parse_header(DownloadStatus &status) { // Function: Downloader::write_to_disk // Access: Private // Description: Writes a download to disk. If there is a header, -// the pointer and size are adjusted so the header -// is excluded. Function returns false on error -// condition. +// the pointer and size are adjusted so the header +// is excluded. Function returns false on error +// condition. //////////////////////////////////////////////////////////////////// bool Downloader:: write_to_disk(DownloadStatus &status) { @@ -1004,7 +1004,7 @@ write_to_disk(DownloadStatus &status) { //////////////////////////////////////////////////////////////////// Downloader::DownloadStatus:: DownloadStatus(char *buffer, const string &event_name, int first_byte, - int last_byte, int total_bytes, bool partial_content, uint id) { + int last_byte, int total_bytes, bool partial_content, uint id) { _first_line_complete = false; _header_is_complete = false; _header_is_valid = false; @@ -1022,7 +1022,7 @@ DownloadStatus(char *buffer, const string &event_name, int first_byte, // Function: Downloader::DownloadStatus::reset // Access: Public // Description: Resets the status buffer for more downloading after -// a write. +// a write. //////////////////////////////////////////////////////////////////// void Downloader::DownloadStatus:: reset(void) { diff --git a/panda/src/downloader/asyncDownloader.h b/panda/src/downloader/asyncDownloader.h index c8ea4f59ee..95d1bc0feb 100644 --- a/panda/src/downloader/asyncDownloader.h +++ b/panda/src/downloader/asyncDownloader.h @@ -47,17 +47,17 @@ PUBLISHED: void disconnect_from_server(void); int request_sync_download(const string &file_name, const Filename &file_dest, - const string &event_name); + const string &event_name); int request_sync_download(const string &file_name, const Filename &file_dest, - const string &event_name, int first_byte, - int last_byte, int total_bytes, - bool partial_content = true); + const string &event_name, int first_byte, + int last_byte, int total_bytes, + bool partial_content = true); int request_download(const string &file_name, const Filename &file_dest, - const string &event_name, bool sync = false); + const string &event_name, bool sync = false); int request_download(const string &file_name, const Filename &file_dest, - const string &event_name, int first_byte, - int last_byte, int total_bytes, - bool partial_content = true, bool sync = false); + const string &event_name, int first_byte, + int last_byte, int total_bytes, + bool partial_content = true, bool sync = false); INLINE void set_byte_rate(float bytes); INLINE float get_byte_rate(void) const; @@ -71,8 +71,8 @@ private: class DownloadStatus { public: DownloadStatus(char *buffer, const string &event_name, int first_byte, - int last_byte, int total_bytes, bool partial_content, - uint id); + int last_byte, int total_bytes, bool partial_content, + uint id); void reset(void); public: @@ -94,16 +94,16 @@ private: void init(); int download(const string &file_name, Filename file_dest, - const string &event_name, int first_byte, - int last_byte, int total_bytes, bool partial_content, - bool sync, uint id); + const string &event_name, int first_byte, + int last_byte, int total_bytes, bool partial_content, + bool sync, uint id); virtual bool process_request(void); bool parse_header(DownloadStatus &status); bool write_to_disk(DownloadStatus &status); bool connect_to_server(void); int safe_send(int socket, const char *data, int length, long timeout); int safe_receive(int socket, DownloadStatus &status, int length, - long timeout, int &bytes); + long timeout, int &bytes); bool parse_http_response(const string &resp); int attempt_read(int length, DownloadStatus &status, int &bytes_read); diff --git a/panda/src/downloader/asyncExtractor.cxx b/panda/src/downloader/asyncExtractor.cxx index 95a03ad764..43be0af828 100644 --- a/panda/src/downloader/asyncExtractor.cxx +++ b/panda/src/downloader/asyncExtractor.cxx @@ -26,8 +26,8 @@ class ExtractorToken : public ReferenceCount { public: INLINE ExtractorToken(uint id, const Filename &source_file, - const string &event_name, - const Filename &rel_path) { + const string &event_name, + const Filename &rel_path) { _id = id; _source_file = source_file; _event_name = event_name; @@ -92,7 +92,7 @@ Extractor:: //////////////////////////////////////////////////////////////////// int Extractor:: request_extract(const Filename &source_file, const string &event_name, - const Filename &rel_path) { + const Filename &rel_path) { PT(ExtractorToken) tok; if (_threads_enabled) { @@ -122,7 +122,7 @@ request_extract(const Filename &source_file, const string &event_name, } tok = new ExtractorToken(_next_token++, source_file, event_name, - rel_path); + rel_path); _token_board->_waiting.insert(tok); #ifdef HAVE_IPC @@ -144,7 +144,7 @@ request_extract(const Filename &source_file, const string &event_name, } tok = new ExtractorToken(_next_token++, source_file, event_name, - rel_path); + rel_path); _token_board->_waiting.insert(tok); process_request(); } @@ -183,7 +183,7 @@ process_request() { if (downloader_cat.is_debug()) { downloader_cat.debug() << "Extractor::process_request() - extract complete for " - << tok->_source_file << "\n"; + << tok->_source_file << "\n"; } } } @@ -230,8 +230,8 @@ extract(Filename &source_file, const Filename &rel_path) { source_buffer_length = read_stream.gcount(); total_bytes_read += source_buffer_length; if (read_stream.eof()) { - nassertr(total_bytes_read == source_file_length, false); - read_all_input = true; + nassertr(total_bytes_read == source_file_length, false); + read_all_input = true; } } diff --git a/panda/src/downloader/asyncExtractor.h b/panda/src/downloader/asyncExtractor.h index 5f630115e0..88b2946f23 100644 --- a/panda/src/downloader/asyncExtractor.h +++ b/panda/src/downloader/asyncExtractor.h @@ -29,7 +29,7 @@ PUBLISHED: virtual ~Extractor(void); int request_extract(const Filename &source_file, - const string &event_name, const Filename &rel_path = ""); + const string &event_name, const Filename &rel_path = ""); bool extract(Filename &source_file, const Filename &rel_path); diff --git a/panda/src/downloader/asyncUtility.cxx b/panda/src/downloader/asyncUtility.cxx index 63468f6d94..5cc4bd48a7 100644 --- a/panda/src/downloader/asyncUtility.cxx +++ b/panda/src/downloader/asyncUtility.cxx @@ -98,11 +98,11 @@ destroy_thread(void) { // Description: This is a static wrapper around the callback() // method, below. It's static just so we can pass it to // the thread-creation function. In addition, the -// function has a void* return type even though we -// don't actually return anything. This is necessary -// because ipc assumes a function that does not return -// anything indicates that the associated thread should -// be created as unjoinable (detached). +// function has a void* return type even though we +// don't actually return anything. This is necessary +// because ipc assumes a function that does not return +// anything indicates that the associated thread should +// be created as unjoinable (detached). //////////////////////////////////////////////////////////////////// void* AsyncUtility:: st_callback(void *arg) { diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index d06d010973..2c13d988d7 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -15,35 +15,35 @@ NotifyCategoryDef(downloader, ""); // relative to the downloader-byte-rate (e.g. if disk-write-ratio is 4, // we will write every 4 seconds if the frequency is 0.2) const int downloader_disk_write_frequency = - config_downloader.GetInt("downloader-disk-write-frequency", 4); + config_downloader.GetInt("downloader-disk-write-frequency", 4); // We'd like this to be about 1 second worth of download assuming a // 28.8Kb connection (28.8Kb / 8 = 3600 bytes per second). const int downloader_byte_rate = - config_downloader.GetInt("downloader-byte-rate", 3600); + config_downloader.GetInt("downloader-byte-rate", 3600); // Frequency of download chunk requests in seconds (or fractions of) // (Estimated 200 msec round-trip to server). const float downloader_frequency = - config_downloader.GetFloat("downloader-frequency", 0.2); + config_downloader.GetFloat("downloader-frequency", 0.2); const int downloader_timeout = - config_downloader.GetInt("downloader-timeout", 15); + config_downloader.GetInt("downloader-timeout", 15); const int downloader_timeout_retries = - config_downloader.GetInt("downloader-timeout-retries", 5); + config_downloader.GetInt("downloader-timeout-retries", 5); const int decompressor_buffer_size = - config_downloader.GetInt("decompressor-buffer-size", 4096); + config_downloader.GetInt("decompressor-buffer-size", 4096); const float decompressor_frequency = - config_downloader.GetFloat("decompressor-frequency", 0.2); + config_downloader.GetFloat("decompressor-frequency", 0.2); const int extractor_buffer_size = - config_downloader.GetInt("extractor-buffer-size", 4096); + config_downloader.GetInt("extractor-buffer-size", 4096); const float extractor_frequency = - config_downloader.GetFloat("extractor-frequency", 0.2); + config_downloader.GetFloat("extractor-frequency", 0.2); const int patcher_buffer_size = config_downloader.GetInt("patcher-buffer-size", 4096); diff --git a/panda/src/downloader/decompressor.cxx b/panda/src/downloader/decompressor.cxx index 9aa99d4ab5..8cccccc515 100644 --- a/panda/src/downloader/decompressor.cxx +++ b/panda/src/downloader/decompressor.cxx @@ -266,16 +266,16 @@ run(void) { int ret; if (_decompress_to_ram == false) ret = _decompressor->decompress_to_stream(next_in, avail_in, - next_out, avail_out, dest_buffer, - dest_buffer_length, _write_stream); + next_out, avail_out, dest_buffer, + dest_buffer_length, _write_stream); else ret = _decompressor->decompress_to_stream(next_in, avail_in, - next_out, avail_out, dest_buffer, - dest_buffer_length, *_write_string_stream); + next_out, avail_out, dest_buffer, + dest_buffer_length, *_write_string_stream); if (ret == ZCompressorBase::S_error) return EU_error_zlib; if ((int)_decompressor->get_total_in() == _source_file_length && - avail_out == dest_buffer_length) { + avail_out == dest_buffer_length) { cleanup(); return EU_success; } diff --git a/panda/src/downloader/downloadDb.cxx b/panda/src/downloader/downloadDb.cxx index 61331c2b75..121d99d91f 100644 --- a/panda/src/downloader/downloadDb.cxx +++ b/panda/src/downloader/downloadDb.cxx @@ -209,8 +209,8 @@ read_db(Filename &file, bool want_server_info) { if (want_server_info) { if (!read_version_map(read_stream)) { downloader_cat.error() - << "DownloadDb::read() - read_version_map() failed: " - << file << endl; + << "DownloadDb::read() - read_version_map() failed: " + << file << endl; } } @@ -236,7 +236,7 @@ read_db(Ramfile &file, bool want_server_info) { if (want_server_info) { if (!read_version_map(read_stream)) { downloader_cat.error() - << "DownloadDb::read() - read_version_map() failed" << endl; + << "DownloadDb::read() - read_version_map() failed" << endl; } } @@ -321,7 +321,7 @@ server_add_file(string mfname, string fname) { // Uh-oh, did not find it downloader_cat.error() << "Could not find record named " - << mfname << " in database " << endl; + << mfname << " in database " << endl; return; } @@ -433,7 +433,7 @@ get_file_record_named(string fname) const { } // Did not find it, just return an empty version downloader_cat.error() << "Could not find record named " - << fname << " in multifile " << _name << endl; + << fname << " in multifile " << _name << endl; PT(FileRecord) foo = new FileRecord; return foo; } @@ -535,7 +535,7 @@ get_multifile_record_named(string mfname) const { } // Did not find it, just return an empty version downloader_cat.error() << "Could not find record named " - << mfname << " in database " << endl; + << mfname << " in database " << endl; PT(MultifileRecord) foo = new MultifileRecord; return foo; } @@ -732,32 +732,32 @@ read(istream &read_stream, bool want_server_info) { // Read off all the file records this multifile has for (int j = 0; j_num_files; j++) { - // The file record header is just one int which - // represents the size of the record - int fr_header_length = sizeof(PN_int32); + // The file record header is just one int which + // represents the size of the record + int fr_header_length = sizeof(PN_int32); - // Make a little buffer to read the file record header into - header_buf = new uchar[fr_header_length]; + // Make a little buffer to read the file record header into + header_buf = new uchar[fr_header_length]; - // Read the header - read_stream.read((char *)header_buf, fr_header_length); + // Read the header + read_stream.read((char *)header_buf, fr_header_length); - // Parse the header - int fr_length = parse_record_header(header_buf, fr_header_length); - delete header_buf; + // Parse the header + int fr_length = parse_record_header(header_buf, fr_header_length); + delete header_buf; - // Ok, now that we know the size of the mfr, read it in - // Make a buffer to read the file record into - header_buf = new uchar[fr_length]; + // Ok, now that we know the size of the mfr, read it in + // Make a buffer to read the file record into + header_buf = new uchar[fr_length]; - // Read the file record -- do not count the header length twice - read_stream.read((char *)header_buf, (fr_length - fr_header_length)); + // Read the file record -- do not count the header length twice + read_stream.read((char *)header_buf, (fr_length - fr_header_length)); - // Parse the file recrod - PT(DownloadDb::FileRecord) fr = parse_fr(header_buf, fr_length); + // Parse the file recrod + PT(DownloadDb::FileRecord) fr = parse_fr(header_buf, fr_length); - // Add this file record to the current multifilerecord - mfr->add_file_record(fr); + // Add this file record to the current multifilerecord + mfr->add_file_record(fr); } } @@ -831,28 +831,28 @@ write(ofstream &write_stream, bool want_server_info) { // Iterate over the multifiles writing them to the stream vector< PT(FileRecord) >::const_iterator j = (*i)->_file_records.begin(); for(; j != (*i)->_file_records.end(); ++j) { - // Clear the datagram before we jam a bunch of stuff on it - _datagram.clear(); + // Clear the datagram before we jam a bunch of stuff on it + _datagram.clear(); - name_length = (*j)->_name.length(); + name_length = (*j)->_name.length(); - // Compute the length of this datagram - header_length = - sizeof(header_length) + // Size of this header length - sizeof(name_length) + // Size of the size of the name string - (*j)->_name.length(); // Size of the name string + // Compute the length of this datagram + header_length = + sizeof(header_length) + // Size of this header length + sizeof(name_length) + // Size of the size of the name string + (*j)->_name.length(); // Size of the name string - // Add the length of this entire datagram - _datagram.add_int32(header_length); + // Add the length of this entire datagram + _datagram.add_int32(header_length); - // Add the length of the name - _datagram.add_int32(name_length); - // Add the name - _datagram.append_data((*j)->_name.c_str(), (*j)->_name.length()); + // Add the length of the name + _datagram.add_int32(name_length); + // Add the name + _datagram.append_data((*j)->_name.c_str(), (*j)->_name.length()); - // Now put this datagram on the write stream - string msg = _datagram.get_message(); - write_stream.write(msg.data(), msg.length()); + // Now put this datagram on the write stream + string msg = _datagram.get_message(); + write_stream.write(msg.data(), msg.length()); } } } @@ -1144,10 +1144,10 @@ output_version_map(ostream &out) const { for (i = (*vmi).second.begin(); i != (*vmi).second.end(); ++i) { HashVal hash = *i; out << " [" << hash.get_value(0) - << " " << hash.get_value(1) - << " " << hash.get_value(2) - << " " << hash.get_value(3) - << "]" << endl; + << " " << hash.get_value(1) + << " " << hash.get_value(2) + << " " << hash.get_value(3) + << "]" << endl; } } out << endl; diff --git a/panda/src/downloader/downloader.I b/panda/src/downloader/downloader.I index 5a921f377e..ddf4646cbf 100644 --- a/panda/src/downloader/downloader.I +++ b/panda/src/downloader/downloader.I @@ -33,7 +33,7 @@ get_frequency(void) const { // Function: Downloader::set_byte_rate // Access: Public // Description: Note: modem speeds are reported in bits, so you -// need to convert! +// need to convert! //////////////////////////////////////////////////////////////////// INLINE void Downloader:: set_byte_rate(float bytes) { diff --git a/panda/src/downloader/downloader.cxx b/panda/src/downloader/downloader.cxx index 0dc0ffbe18..23977157eb 100644 --- a/panda/src/downloader/downloader.cxx +++ b/panda/src/downloader/downloader.cxx @@ -113,8 +113,8 @@ connect_to_server(const string &name, uint port) { else { downloader_cat.error() << "Downloader::connect_to_server() - gethostbyname() failed on: " - << name.c_str() << " with error: " - << handle_socket_error() << endl; + << name.c_str() << " with error: " + << handle_socket_error() << endl; return get_network_error(); } } else @@ -143,7 +143,7 @@ connect_to_server(void) { } if (connect(_socket, (struct sockaddr *)&_sin, sizeof(_sin)) == - SOCKET_ERROR) { + SOCKET_ERROR) { downloader_cat.error() << "Downloader::connect_to_server() - connect() failed: " << handle_socket_error() << endl; @@ -344,7 +344,7 @@ initiate(const string &file_name, Filename file_dest, // Create a download status to maintain download progress information _current_status = new DownloadStatus(_buffer->_buffer, first_byte, last_byte, total_bytes, - partial_content); + partial_content); _tfirst = 0.0; _tlast = 0.0; @@ -464,13 +464,13 @@ run(void) { if (_recompute_buffer == true) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run() - Recomputing the buffer" << endl; + << "Downloader::run() - Recomputing the buffer" << endl; // Flush the current buffer if it holds any data if (_current_status->_bytes_in_buffer > 0) { write_ret = write_to_disk(_current_status); if (write_ret < 0) - return write_ret; + return write_ret; ret = EU_write; } @@ -493,7 +493,7 @@ run(void) { // Flush the current buffer if the next request would overflow it if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run() - Flushing buffer" << endl; + << "Downloader::run() - Flushing buffer" << endl; write_ret = write_to_disk(_current_status); if (write_ret < 0) return write_ret; @@ -518,7 +518,7 @@ run(void) { else if (remain > 0) fret = fast_receive(_socket, _current_status, remain); if (fret == EU_eof || fret < 0) { - break; + break; } else if (fret == EU_success) { _got_any_data = true; } @@ -535,25 +535,25 @@ run(void) { if (fret == EU_eof) { if (_got_any_data == true) { if (_current_status->_bytes_in_buffer > 0) { - write_ret = write_to_disk(_current_status); - if (write_ret < 0) + write_ret = write_to_disk(_current_status); + if (write_ret < 0) return write_ret; } if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run() - Got eof" << endl; + << "Downloader::run() - Got eof" << endl; cleanup(); return EU_success; } else { if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::run() - Got 0 bytes" << endl; + downloader_cat.debug() + << "Downloader::run() - Got 0 bytes" << endl; return ret; } } else if (fret == EU_network_no_data) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run() - No data" << endl; + << "Downloader::run() - No data" << endl; return ret; } else if (fret < 0) { return fret; @@ -584,13 +584,13 @@ run_to_ram(void) { if (_recompute_buffer == true) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run_to_ram() - Recomputing the buffer" << endl; + << "Downloader::run_to_ram() - Recomputing the buffer" << endl; // Flush the current buffer if it holds any data if (_current_status->_bytes_in_buffer > 0) { write_ret = write_to_ram(_current_status); if (write_ret < 0) - return write_ret; + return write_ret; ret = EU_write_ram; } @@ -608,12 +608,12 @@ run_to_ram(void) { _current_status->_total_bytes = 0; } else if (_current_status->_bytes_in_buffer + _receive_size > - ((unsigned int)_disk_buffer_size)) { + ((unsigned int)_disk_buffer_size)) { // Flush the current buffer if the next request would overflow it if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run_to_ram() - Flushing buffer" << endl; + << "Downloader::run_to_ram() - Flushing buffer" << endl; write_ret = write_to_ram(_current_status); if (write_ret < 0) return write_ret; @@ -638,7 +638,7 @@ run_to_ram(void) { else if (remain > 0) fret = fast_receive(_socket, _current_status, remain); if (fret == EU_eof || fret < 0) { - break; + break; } else if (fret == EU_success) { _got_any_data = true; } @@ -655,25 +655,25 @@ run_to_ram(void) { if (fret == EU_eof) { if (_got_any_data == true) { if (_current_status->_bytes_in_buffer > 0) { - write_ret = write_to_ram(_current_status); - if (write_ret < 0) + write_ret = write_to_ram(_current_status); + if (write_ret < 0) return write_ret; } if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run_to_ram() - Got eof" << endl; + << "Downloader::run_to_ram() - Got eof" << endl; cleanup(); return EU_success; } else { if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::run_to_ram() - Got 0 bytes" << endl; + downloader_cat.debug() + << "Downloader::run_to_ram() - Got 0 bytes" << endl; return ret; } } else if (fret == EU_network_no_data) { if (downloader_cat.is_debug()) downloader_cat.debug() - << "Downloader::run_to_ram() - No data" << endl; + << "Downloader::run_to_ram() - No data" << endl; return ret; } else if (fret < 0) { return fret; @@ -722,9 +722,9 @@ parse_http_response(const string &resp) { break; case 302: if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::parse_http_response() - got a 302 redirect" - << endl; + downloader_cat.debug() + << "Downloader::parse_http_response() - got a 302 redirect" + << endl; return EU_http_redirect; break; case 408: @@ -796,8 +796,8 @@ parse_header(DownloadStatus *status) { << component << endl; status->_header_is_valid = true; } else if (parse_ret == EU_http_redirect) { - redirect = true; - status->_header_is_valid = true; + redirect = true; + status->_header_is_valid = true; } else { return parse_ret; } @@ -823,9 +823,9 @@ parse_header(DownloadStatus *status) { } else if (redirect == true && tline == "Location") { tline = component.substr(cpos + 2, string::npos); if (downloader_cat.is_debug()) - downloader_cat.debug() - << "Downloader::parse_header() - file redirected to: " - << tline << endl; + downloader_cat.debug() + << "Downloader::parse_header() - file redirected to: " + << tline << endl; return EU_error_abort; } @@ -833,10 +833,10 @@ parse_header(DownloadStatus *status) { if (nl == p) { // Make sure we didn't get a redirect if (redirect == true) { - downloader_cat.error() - << "Downloader::parse_header() - Got a 302 redirect but no " - << "Location directive" << endl; - return EU_error_abort; + downloader_cat.error() + << "Downloader::parse_header() - Got a 302 redirect but no " + << "Location directive" << endl; + return EU_error_abort; } if (downloader_cat.is_debug()) downloader_cat.debug() @@ -976,7 +976,7 @@ get_ramfile(Ramfile &rfile) { //////////////////////////////////////////////////////////////////// Downloader::DownloadStatus:: DownloadStatus(char *buffer, int first_byte, int last_byte, - int total_bytes, bool partial_content) { + int total_bytes, bool partial_content) { _first_line_complete = false; _header_is_complete = false; _header_is_valid = false; diff --git a/panda/src/downloader/downloader.h b/panda/src/downloader/downloader.h index 0609485244..9d86fb716b 100644 --- a/panda/src/downloader/downloader.h +++ b/panda/src/downloader/downloader.h @@ -39,8 +39,8 @@ PUBLISHED: int initiate(const string &file_name, Filename file_dest); int initiate(const string &file_name, Filename file_dest, - int first_byte, int last_byte, int total_bytes, - bool partial_content = true); + int first_byte, int last_byte, int total_bytes, + bool partial_content = true); int initiate(const string &file_name); int run(void); @@ -59,7 +59,7 @@ private: class DownloadStatus { public: DownloadStatus(char *buffer, int first_byte, int last_byte, - int total_bytes, bool partial_content); + int total_bytes, bool partial_content); void reset(void); public: diff --git a/panda/src/downloader/multiplexStream.I b/panda/src/downloader/multiplexStream.I index 0986a50507..1d8461d14b 100644 --- a/panda/src/downloader/multiplexStream.I +++ b/panda/src/downloader/multiplexStream.I @@ -23,8 +23,8 @@ MultiplexStream() : ostream(&_msb) { INLINE void MultiplexStream:: add_ostream(ostream *out, bool delete_later) { _msb.add_output(MultiplexStreamBuf::BT_none, - MultiplexStreamBuf::OT_ostream, - out, NULL, delete_later); + MultiplexStreamBuf::OT_ostream, + out, NULL, delete_later); } //////////////////////////////////////////////////////////////////// @@ -36,8 +36,8 @@ add_ostream(ostream *out, bool delete_later) { INLINE bool MultiplexStream:: add_stdio_file(FILE *fout, bool close_when_done) { _msb.add_output(MultiplexStreamBuf::BT_line, - MultiplexStreamBuf::OT_ostream, - NULL, fout, close_when_done); + MultiplexStreamBuf::OT_ostream, + NULL, fout, close_when_done); return true; } @@ -49,8 +49,8 @@ add_stdio_file(FILE *fout, bool close_when_done) { INLINE void MultiplexStream:: add_standard_output() { _msb.add_output(MultiplexStreamBuf::BT_none, - MultiplexStreamBuf::OT_ostream, - &cout, NULL, false); + MultiplexStreamBuf::OT_ostream, + &cout, NULL, false); } //////////////////////////////////////////////////////////////////// @@ -71,8 +71,8 @@ add_file(Filename file) { out->setf(ios::unitbuf); _msb.add_output(MultiplexStreamBuf::BT_line, - MultiplexStreamBuf::OT_ostream, - out, NULL, true); + MultiplexStreamBuf::OT_ostream, + out, NULL, true); return true; } @@ -90,7 +90,7 @@ add_file(Filename file) { INLINE void MultiplexStream:: add_system_debug() { _msb.add_output(MultiplexStreamBuf::BT_line, - MultiplexStreamBuf::OT_system_debug); + MultiplexStreamBuf::OT_system_debug); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/downloader/multiplexStreamBuf.cxx b/panda/src/downloader/multiplexStreamBuf.cxx index d1f46841f9..4da2f70c44 100644 --- a/panda/src/downloader/multiplexStreamBuf.cxx +++ b/panda/src/downloader/multiplexStreamBuf.cxx @@ -116,8 +116,8 @@ MultiplexStreamBuf:: //////////////////////////////////////////////////////////////////// void MultiplexStreamBuf:: add_output(MultiplexStreamBuf::BufferType buffer_type, - MultiplexStreamBuf::OutputType output_type, - ostream *out, FILE *fout, bool owns_obj) { + MultiplexStreamBuf::OutputType output_type, + ostream *out, FILE *fout, bool owns_obj) { #ifdef HAVE_IPC // Ensure that we have the mutex while we fiddle with the list of // outputs. @@ -243,7 +243,7 @@ write_chars(const char *start, int length, bool flush) { case BT_none: // No buffering: send all new characters directly to the ostream. if (!latest.empty()) { - out.write_string(latest); + out.write_string(latest); } break; @@ -251,7 +251,7 @@ write_chars(const char *start, int length, bool flush) { // Line buffering: send only when a complete line has been // received. if (!line.empty()) { - out.write_string(line); + out.write_string(line); } break; } diff --git a/panda/src/downloader/multiplexStreamBuf.h b/panda/src/downloader/multiplexStreamBuf.h index 371a9ce6cc..4ab2f76b70 100644 --- a/panda/src/downloader/multiplexStreamBuf.h +++ b/panda/src/downloader/multiplexStreamBuf.h @@ -38,9 +38,9 @@ public: }; void add_output(BufferType buffer_type, OutputType output_type, - ostream *out = (ostream *)NULL, - FILE *fout = (FILE *)NULL, - bool owns_obj = false); + ostream *out = (ostream *)NULL, + FILE *fout = (FILE *)NULL, + bool owns_obj = false); void flush(); diff --git a/panda/src/downloader/zcompressor.I b/panda/src/downloader/zcompressor.I index 5742dfc568..19d09c7feb 100644 --- a/panda/src/downloader/zcompressor.I +++ b/panda/src/downloader/zcompressor.I @@ -59,7 +59,7 @@ reset_stream(z_stream *strm) const { //////////////////////////////////////////////////////////////////// INLINE void ZCompressorBase:: put_stream(z_stream *strm, char *next_in, int avail_in, char *next_out, - int avail_out) const { + int avail_out) const { strm->next_in = (uchar *)next_in; strm->avail_in = (ulong)avail_in; strm->next_out = (uchar *)next_out; diff --git a/panda/src/downloader/zcompressor.cxx b/panda/src/downloader/zcompressor.cxx index fe3199df65..2dfc1aa5e4 100644 --- a/panda/src/downloader/zcompressor.cxx +++ b/panda/src/downloader/zcompressor.cxx @@ -70,9 +70,9 @@ compress(char *&next_in, int &avail_in, char *&next_out, int &avail_out, //////////////////////////////////////////////////////////////////// int ZCompressor:: compress_to_stream(char *&next_in, int &avail_in, char *&next_out, - int &avail_out, char *out_buffer, - int out_buffer_length, ofstream &write_stream, - bool finish) { + int &avail_out, char *out_buffer, + int out_buffer_length, ofstream &write_stream, + bool finish) { int ret = compress(next_in, avail_in, next_out, avail_out, finish); if (ret == S_error) return ret; @@ -119,11 +119,11 @@ ZDecompressor:: // Function: ZDecompressor::decompress // Access: Public // Description: Decompress from next_in into next_out until avail_in -// is 0 or avail_out is 0 or an error occurs. +// is 0 or avail_out is 0 or an error occurs. //////////////////////////////////////////////////////////////////// int ZDecompressor:: decompress(char *&next_in, int &avail_in, char *&next_out, int &avail_out, - bool finish) { + bool finish) { int fin_flag = (finish == true) ? Z_FINISH : Z_NO_FLUSH; diff --git a/panda/src/downloader/zcompressor.h b/panda/src/downloader/zcompressor.h index dd3ca7f525..a463fcd70d 100644 --- a/panda/src/downloader/zcompressor.h +++ b/panda/src/downloader/zcompressor.h @@ -31,9 +31,9 @@ public: INLINE void reset_stream(z_stream *strm) const; #ifndef CPPPARSER INLINE void put_stream(z_stream *strm, char *next_in, int avail_in, - char *next_out, int avail_out) const; + char *next_out, int avail_out) const; INLINE void get_stream(z_stream *strm, char *&next_in, int &avail_in, - char *&next_out, int &avail_out) const; + char *&next_out, int &avail_out) const; #endif int handle_zerror(int code, const z_stream *strm = NULL) const; @@ -51,10 +51,10 @@ public: ~ZCompressor(void); int compress(char *&next_in, int &avail_in, char *&next_out, - int &avail_out, bool finish = false); + int &avail_out, bool finish = false); int compress_to_stream(char *&next_in, int &avail_in, char *&next_out, - int &avail_out, char *out_buffer, int out_buffer_length, - ofstream &write_stream, bool finish = false); + int &avail_out, char *out_buffer, int out_buffer_length, + ofstream &write_stream, bool finish = false); }; //////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ public: ~ZDecompressor(void); int decompress(char *&next_in, int &avail_in, char *&next_out, - int &avail_out, bool finish = false); + int &avail_out, bool finish = false); int decompress_to_stream(char *&next_in, int &avail_in, char *&next_out, int &avail_out, char *out_buffer, int out_buffer_length, ostream &write_stream, bool finish = false); diff --git a/panda/src/downloadertools/multify.cxx b/panda/src/downloadertools/multify.cxx index 10539f22dc..86a2c27d7a 100644 --- a/panda/src/downloadertools/multify.cxx +++ b/panda/src/downloadertools/multify.cxx @@ -27,19 +27,19 @@ main(int argc, char *argv[]) { while (flag != EOF) { switch (flag) { case 'x': - extract = true; + extract = true; break; case 'c': break; case 'v': - verbose = true; - break; + verbose = true; + break; case 'r': - rel_path = optarg; - break; + rel_path = optarg; + break; default: - cerr << "Unhandled switch: " << flag << endl; - break; + cerr << "Unhandled switch: " << flag << endl; + break; } flag = getopt(argc, argv, "xcvr:"); } diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.I b/panda/src/dxgsg/dxGraphicsStateGuardian.I index 5630c50a90..0c2ea21950 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.I +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.I @@ -25,7 +25,7 @@ activate() { INLINE void DXGraphicsStateGuardian:: set_pack_alignment(int alignment) { #ifdef NDEBUG - dxgsg_cat.error() << "set_pack_alignment() unimplemented, has no meaning in DX\n"; + dxgsg_cat.error() << "set_pack_alignment() unimplemented, has no meaning in DX\n"; #endif } @@ -64,13 +64,13 @@ enable_line_smooth(bool val) { if(_line_smooth_enabled != val) { _line_smooth_enabled = val; #ifdef NDEBUG - { - if(val && (_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES)) + { + if(val && (_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES)) dxgsg_cat.error() << "no HW support for line smoothing!!\n"; - } + } #endif - _d3dDevice->SetRenderState(D3DRENDERSTATE_EDGEANTIALIAS, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_EDGEANTIALIAS, (DWORD)val); } } @@ -96,8 +96,8 @@ enable_point_smooth(bool val) { INLINE void DXGraphicsStateGuardian:: enable_lighting(bool val) { if (_lighting_enabled != val) { - _d3dDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, (DWORD)val); - if(_lighting_enabled = val) + _d3dDevice->SetRenderState(D3DRENDERSTATE_LIGHTING, (DWORD)val); + if(_lighting_enabled = val) _lighting_enabled_this_frame = true; } } @@ -113,13 +113,13 @@ enable_dither(bool val) { _dither_enabled = val; #ifdef NDEBUG - { - if(val && (_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_DITHER)) + { + if(val && (_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_DITHER)) dxgsg_cat.error() << "no HW support for color dithering!!\n"; - } + } #endif - _d3dDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, (DWORD)val); } } @@ -132,7 +132,7 @@ INLINE void DXGraphicsStateGuardian:: enable_stencil_test(bool val) { if (_stencil_test_enabled != val) { _stencil_test_enabled = val; - _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILENABLE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILENABLE, (DWORD)val); } } @@ -157,16 +157,16 @@ INLINE void DXGraphicsStateGuardian:: enable_clip_plane(int clip_plane, bool val) { if (_clip_plane_enabled[clip_plane] != val) - { + { _clip_plane_enabled[clip_plane] = val; - DWORD ClipPlaneBits; - _d3dDevice->GetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , &ClipPlaneBits); - if (val) - ClipPlaneBits |= 1 << clip_plane; + DWORD ClipPlaneBits; + _d3dDevice->GetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , &ClipPlaneBits); + if (val) + ClipPlaneBits |= 1 << clip_plane; else - ClipPlaneBits &= ~(1 << clip_plane); - _d3dDevice->SetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , ClipPlaneBits); - } + ClipPlaneBits &= ~(1 << clip_plane); + _d3dDevice->SetRenderState(D3DRENDERSTATE_CLIPPLANEENABLE , ClipPlaneBits); + } } @@ -204,7 +204,7 @@ INLINE void DXGraphicsStateGuardian:: enable_blend(bool val) { if (_blend_enabled != val) { _blend_enabled = val; - _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, (DWORD)val); } } @@ -217,7 +217,7 @@ INLINE void DXGraphicsStateGuardian:: set_shademode(D3DSHADEMODE val) { if (_CurShadeMode != val) { _CurShadeMode = val; - _d3dDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, (DWORD)val); } } @@ -230,7 +230,7 @@ INLINE void DXGraphicsStateGuardian:: enable_fog(bool val) { if (_fog_enabled != val) { _fog_enabled = val; - _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, (DWORD)val); } } @@ -244,7 +244,7 @@ enable_alpha_test(bool val ) { if (_alpha_test_enabled != val) { _alpha_test_enabled = val; - _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, (DWORD)val); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, (DWORD)val); } } @@ -263,7 +263,7 @@ call_dxLightModelAmbient( const Colorf& color) << "glLightModel(GL_LIGHT_MODEL_AMBIENT, " << color << ")" << endl; #endif _d3dDevice->SetRenderState( D3DRENDERSTATE_AMBIENT, - D3DRGBA(color[0], color[1], color[2], color[3])); + D3DRGBA(color[0], color[1], color[2], color[3])); } } @@ -309,8 +309,8 @@ call_dxAlphaFunc(D3DCMPFUNC func, DWORD ref) } dxgsg_cat.debug() << ref << ")" << endl; #endif - _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHAFUNC, func); - _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF, ref); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHAFUNC, func); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ALPHAREF, ref); } } @@ -319,85 +319,85 @@ INLINE void DXGraphicsStateGuardian:: call_dxBlendFunc(D3DBLEND sfunc, D3DBLEND dfunc ) { if (_blend_source_func != sfunc) - { + { _blend_source_func = sfunc; - _d3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, sfunc); + _d3dDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, sfunc); #ifdef GSG_VERBOSE dxgsg_cat.debug() << "dxSrcBlendFunc("; switch (sfunc) - { - case D3DBLEND_ZERO: - dxgsg_cat.debug(false) << "ZERO, "; - break; - case D3DBLEND_ONE: - dxgsg_cat.debug(false) << "ONE, "; - break; - case D3DBLEND_DESTCOLOR: - dxgsg_cat.debug(false) << "DESTCOLOR, "; - break; - case D3DBLEND_INVDESTCOLOR: - dxgsg_cat.debug(false) << "INVDESTCOLOR, "; - break; - case D3DBLEND_SRCALPHA: - dxgsg_cat.debug(false) << "SRCALPHA, "; - break; - case D3DBLEND_INVSRCALPHA: - dxgsg_cat.debug(false) << "INVSRCALPHA, "; - break; - case D3DBLEND_DESTALPHA: - dxgsg_cat.debug(false) << "DESTALPHA, "; - break; - case D3DBLEND_INVDESTALPHA: - dxgsg_cat.debug(false) << "INVDESTALPHA, "; - break; - case D3DBLEND_SRCALPHASAT: - dxgsg_cat.debug(false) << "SRCALPHASAT, "; - break; - default: - dxgsg_cat.debug(false) << "unknown, "; - break; - } + { + case D3DBLEND_ZERO: + dxgsg_cat.debug(false) << "ZERO, "; + break; + case D3DBLEND_ONE: + dxgsg_cat.debug(false) << "ONE, "; + break; + case D3DBLEND_DESTCOLOR: + dxgsg_cat.debug(false) << "DESTCOLOR, "; + break; + case D3DBLEND_INVDESTCOLOR: + dxgsg_cat.debug(false) << "INVDESTCOLOR, "; + break; + case D3DBLEND_SRCALPHA: + dxgsg_cat.debug(false) << "SRCALPHA, "; + break; + case D3DBLEND_INVSRCALPHA: + dxgsg_cat.debug(false) << "INVSRCALPHA, "; + break; + case D3DBLEND_DESTALPHA: + dxgsg_cat.debug(false) << "DESTALPHA, "; + break; + case D3DBLEND_INVDESTALPHA: + dxgsg_cat.debug(false) << "INVDESTALPHA, "; + break; + case D3DBLEND_SRCALPHASAT: + dxgsg_cat.debug(false) << "SRCALPHASAT, "; + break; + default: + dxgsg_cat.debug(false) << "unknown, "; + break; + } dxgsg_cat.debug(false) << endl; #endif - } + } if ( _blend_dest_func != dfunc) - { + { _blend_dest_func = dfunc; - _d3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, dfunc); + _d3dDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, dfunc); #ifdef GSG_VERBOSE dxgsg_cat.debug() << "dxDstBlendFunc("; switch (dfunc) - { - case D3DBLEND_ZERO: - dxgsg_cat.debug(false) << "ZERO, "; - break; - case D3DBLEND_ONE: - dxgsg_cat.debug(false) << "ONE, "; - break; - case D3DBLEND_DESTCOLOR: - dxgsg_cat.debug(false) << "DESTCOLOR, "; - break; - case D3DBLEND_INVDESTCOLOR: - dxgsg_cat.debug(false) << "INVDESTCOLOR, "; - break; - case D3DBLEND_SRCALPHA: - dxgsg_cat.debug(false) << "SRCALPHA, "; - break; - case D3DBLEND_INVSRCALPHA: - dxgsg_cat.debug(false) << "INVSRCALPHA, "; - break; - case D3DBLEND_DESTALPHA: - dxgsg_cat.debug(false) << "DESTALPHA, "; - break; - case D3DBLEND_INVDESTALPHA: - dxgsg_cat.debug(false) << "INVDESTALPHA, "; - break; - case D3DBLEND_SRCALPHASAT: - dxgsg_cat.debug(false) << "SRCALPHASAT, "; - break; - } + { + case D3DBLEND_ZERO: + dxgsg_cat.debug(false) << "ZERO, "; + break; + case D3DBLEND_ONE: + dxgsg_cat.debug(false) << "ONE, "; + break; + case D3DBLEND_DESTCOLOR: + dxgsg_cat.debug(false) << "DESTCOLOR, "; + break; + case D3DBLEND_INVDESTCOLOR: + dxgsg_cat.debug(false) << "INVDESTCOLOR, "; + break; + case D3DBLEND_SRCALPHA: + dxgsg_cat.debug(false) << "SRCALPHA, "; + break; + case D3DBLEND_INVSRCALPHA: + dxgsg_cat.debug(false) << "INVSRCALPHA, "; + break; + case D3DBLEND_DESTALPHA: + dxgsg_cat.debug(false) << "DESTALPHA, "; + break; + case D3DBLEND_INVDESTALPHA: + dxgsg_cat.debug(false) << "INVDESTALPHA, "; + break; + case D3DBLEND_SRCALPHASAT: + dxgsg_cat.debug(false) << "SRCALPHASAT, "; + break; + } dxgsg_cat.debug(false) << endl; #endif - } + } } diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx index cbb61f0685..5663e25e2b 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.cxx +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.cxx @@ -110,46 +110,46 @@ static D3DMATRIX matIdentity; //////////////////////////////////////////////////////////////////// DXGraphicsStateGuardian:: DXGraphicsStateGuardian(GraphicsWindow *win) : GraphicsStateGuardian(win) { - _light_enabled = (bool *)NULL; - _cur_light_enabled = (bool *)NULL; - _clip_plane_enabled = (bool *)NULL; - _cur_clip_plane_enabled = (bool *)NULL; - _pCurFvfBufPtr = NULL; - _pFvfBufBasePtr = new char[VERT_BUFFER_SIZE]; // allocate storage for vertex info. - _index_buf = new WORD[D3DMAXNUMVERTICES]; // allocate storage for vertex index info. + _light_enabled = (bool *)NULL; + _cur_light_enabled = (bool *)NULL; + _clip_plane_enabled = (bool *)NULL; + _cur_clip_plane_enabled = (bool *)NULL; + _pCurFvfBufPtr = NULL; + _pFvfBufBasePtr = new char[VERT_BUFFER_SIZE]; // allocate storage for vertex info. + _index_buf = new WORD[D3DMAXNUMVERTICES]; // allocate storage for vertex index info. - _dx_ready = false; + _dx_ready = false; - _CurShadeMode = D3DSHADE_FLAT; + _CurShadeMode = D3DSHADE_FLAT; - _pri = _zbuf = _back = NULL; - _pDD = NULL; - _d3dDevice = NULL; + _pri = _zbuf = _back = NULL; + _pDD = NULL; + _d3dDevice = NULL; - _cur_read_pixel_buffer=RenderBuffer::T_front; + _cur_read_pixel_buffer=RenderBuffer::T_front; - ZeroMemory(&matIdentity,sizeof(D3DMATRIX)); - matIdentity._11 = matIdentity._22 = matIdentity._33 = matIdentity._44 = 1.0f; + ZeroMemory(&matIdentity,sizeof(D3DMATRIX)); + matIdentity._11 = matIdentity._22 = matIdentity._33 = matIdentity._44 = 1.0f; - _cNumTexPixFmts = 0; - _pTexPixFmts = NULL; - _pCurTexContext = NULL; + _cNumTexPixFmts = 0; + _pTexPixFmts = NULL; + _pCurTexContext = NULL; - // Create a default RenderTraverser. - if (dx_cull_traversal) { - _render_traverser = new CullTraverser(this, RenderRelation::get_class_type()); - } else { - _render_traverser = new DirectRenderTraverser(this, RenderRelation::get_class_type()); - } + // Create a default RenderTraverser. + if (dx_cull_traversal) { + _render_traverser = new CullTraverser(this, RenderRelation::get_class_type()); + } else { + _render_traverser = new DirectRenderTraverser(this, RenderRelation::get_class_type()); + } - //Color and alpha transform variables - _color_transform_enabled = false; - _alpha_transform_enabled = false; - _current_color_mat = LMatrix4f::ident_mat(); - _current_alpha_offset = 0; - _current_alpha_scale = 1; + //Color and alpha transform variables + _color_transform_enabled = false; + _alpha_transform_enabled = false; + _current_color_mat = LMatrix4f::ident_mat(); + _current_alpha_offset = 0; + _current_alpha_scale = 1; - reset(); + reset(); } //////////////////////////////////////////////////////////////////// @@ -159,13 +159,13 @@ DXGraphicsStateGuardian(GraphicsWindow *win) : GraphicsStateGuardian(win) { //////////////////////////////////////////////////////////////////// DXGraphicsStateGuardian:: ~DXGraphicsStateGuardian() { - if (_d3dDevice != NULL) - _d3dDevice->SetTexture(0, NULL); // this frees reference to the old texture - _pCurTexContext = NULL; + if (_d3dDevice != NULL) + _d3dDevice->SetTexture(0, NULL); // this frees reference to the old texture + _pCurTexContext = NULL; - free_pointers(); - delete [] _pFvfBufBasePtr; - delete [] _index_buf; + free_pointers(); + delete [] _pFvfBufBasePtr; + delete [] _index_buf; } //////////////////////////////////////////////////////////////////// @@ -176,77 +176,77 @@ DXGraphicsStateGuardian:: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: reset() { - free_pointers(); - activate(); - GraphicsStateGuardian::reset(); - _buffer_mask = 0; + free_pointers(); + activate(); + GraphicsStateGuardian::reset(); + _buffer_mask = 0; - // All implementations have the following buffers. - _buffer_mask = (RenderBuffer::T_color | - RenderBuffer::T_depth | - RenderBuffer::T_back -// RenderBuffer::T_stencil | -// RenderBuffer::T_accum - ); + // All implementations have the following buffers. + _buffer_mask = (RenderBuffer::T_color | + RenderBuffer::T_depth | + RenderBuffer::T_back +// RenderBuffer::T_stencil | +// RenderBuffer::T_accum + ); - _current_projection_mat = LMatrix4f::ident_mat(); - _projection_mat_stack_count = 0; + _current_projection_mat = LMatrix4f::ident_mat(); + _projection_mat_stack_count = 0; - _issued_color_enabled = false; + _issued_color_enabled = false; - _buffer_mask &= ~RenderBuffer::T_right; // test for these later + _buffer_mask &= ~RenderBuffer::T_right; // test for these later - // Set up our clear values to invalid values, so the glClear* calls - // will be made initially. - _clear_color_red = -1.0f; - _clear_color_green = -1.0f; - _clear_color_blue = -1.0f; - _clear_color_alpha = -1.0f; - _clear_depth = -1.0f; - _clear_stencil = -1; - _clear_accum_red = -1.0f; - _clear_accum_green = -1.0f; - _clear_accum_blue = -1.0f; - _clear_accum_alpha = -1.0f; - _line_width = 1.0f; - _point_size = 1.0f; - _depth_mask = false; - _fog_mode = D3DFOG_EXP; - _alpha_func = D3DCMP_ALWAYS; - _alpha_func_ref = 0; + // Set up our clear values to invalid values, so the glClear* calls + // will be made initially. + _clear_color_red = -1.0f; + _clear_color_green = -1.0f; + _clear_color_blue = -1.0f; + _clear_color_alpha = -1.0f; + _clear_depth = -1.0f; + _clear_stencil = -1; + _clear_accum_red = -1.0f; + _clear_accum_green = -1.0f; + _clear_accum_blue = -1.0f; + _clear_accum_alpha = -1.0f; + _line_width = 1.0f; + _point_size = 1.0f; + _depth_mask = false; + _fog_mode = D3DFOG_EXP; + _alpha_func = D3DCMP_ALWAYS; + _alpha_func_ref = 0; // _polygon_mode = GL_FILL; -// _pack_alignment = 4; -// _unpack_alignment = 4; +// _pack_alignment = 4; +// _unpack_alignment = 4; - // Set up all the enabled/disabled flags to GL's known initial - // values: everything off. - _multisample_enabled = false; - _line_smooth_enabled = false; - _point_smooth_enabled = false; - _color_material_enabled = false; + // Set up all the enabled/disabled flags to GL's known initial + // values: everything off. + _multisample_enabled = false; + _line_smooth_enabled = false; + _point_smooth_enabled = false; + _color_material_enabled = false; // _scissor_enabled = false; - _lighting_enabled = false; - _normals_enabled = false; - _texturing_enabled = false; - _multisample_alpha_one_enabled = false; - _multisample_alpha_mask_enabled = false; - _blend_enabled = false; - _depth_test_enabled = false; - _fog_enabled = false; - _alpha_test_enabled = false; - _decal_level = 0; + _lighting_enabled = false; + _normals_enabled = false; + _texturing_enabled = false; + _multisample_alpha_one_enabled = false; + _multisample_alpha_mask_enabled = false; + _blend_enabled = false; + _depth_test_enabled = false; + _fog_enabled = false; + _alpha_test_enabled = false; + _decal_level = 0; - _dx_ready = false; + _dx_ready = false; } HRESULT CALLBACK EnumTexFmtsCallback( LPDDPIXELFORMAT pddpf, VOID* param ) { - // wont build if its a member fn, so had to do this stuff - DXGraphicsStateGuardian *mystate = (DXGraphicsStateGuardian *) param; - assert(mystate->_cNumTexPixFmts < MAX_DX_TEXPIXFMTS); - memcpy( &(mystate->_pTexPixFmts[mystate->_cNumTexPixFmts]), pddpf, sizeof(DDPIXELFORMAT) ); - mystate->_cNumTexPixFmts++; - return DDENUMRET_OK; + // wont build if its a member fn, so had to do this stuff + DXGraphicsStateGuardian *mystate = (DXGraphicsStateGuardian *) param; + assert(mystate->_cNumTexPixFmts < MAX_DX_TEXPIXFMTS); + memcpy( &(mystate->_pTexPixFmts[mystate->_cNumTexPixFmts]), pddpf, sizeof(DDPIXELFORMAT) ); + mystate->_cNumTexPixFmts++; + return DDENUMRET_OK; } //////////////////////////////////////////////////////////////////// @@ -257,87 +257,87 @@ HRESULT CALLBACK EnumTexFmtsCallback( LPDDPIXELFORMAT pddpf, VOID* param ) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: init_dx( LPDIRECTDRAW7 context, - LPDIRECTDRAWSURFACE7 pri, - LPDIRECTDRAWSURFACE7 back, - LPDIRECTDRAWSURFACE7 zbuf, - LPDIRECT3D7 pD3D, - LPDIRECT3DDEVICE7 pDevice, - RECT viewrect) { - _pDD = context; - _pri = pri; - _back = back; - _zbuf = zbuf; - _d3d = pD3D; - _d3dDevice = pDevice; - _view_rect = viewrect; - HRESULT hr; + LPDIRECTDRAWSURFACE7 pri, + LPDIRECTDRAWSURFACE7 back, + LPDIRECTDRAWSURFACE7 zbuf, + LPDIRECT3D7 pD3D, + LPDIRECT3DDEVICE7 pDevice, + RECT viewrect) { + _pDD = context; + _pri = pri; + _back = back; + _zbuf = zbuf; + _d3d = pD3D; + _d3dDevice = pDevice; + _view_rect = viewrect; + HRESULT hr; - if(dx_show_fps_meter) { - _start_time = timeGetTime(); - _current_fps = 0.0f; - _start_frame_count = _cur_frame_count = 0; - } + if(dx_show_fps_meter) { + _start_time = timeGetTime(); + _current_fps = 0.0f; + _start_frame_count = _cur_frame_count = 0; + } - _pTexPixFmts = new DDPIXELFORMAT[MAX_DX_TEXPIXFMTS]; + _pTexPixFmts = new DDPIXELFORMAT[MAX_DX_TEXPIXFMTS]; - assert(_pTexPixFmts!=NULL); + assert(_pTexPixFmts!=NULL); - if (pDevice->EnumTextureFormats(EnumTexFmtsCallback, this) != S_OK) { - dxgsg_cat.error() << "EnumTextureFormats failed!!\n"; - } + if (pDevice->EnumTextureFormats(EnumTexFmtsCallback, this) != S_OK) { + dxgsg_cat.error() << "EnumTextureFormats failed!!\n"; + } - if (FAILED(hr = pDevice->GetCaps(&_D3DDevDesc))) { - dxgsg_cat.fatal() << "GetCaps failed on D3D Device\n"; - exit(1); - } + if (FAILED(hr = pDevice->GetCaps(&_D3DDevDesc))) { + dxgsg_cat.fatal() << "GetCaps failed on D3D Device\n"; + exit(1); + } - DX_DECLARE_CLEAN(DDCAPS,ddCaps); - if (FAILED(hr = _pDD->GetCaps(&ddCaps,NULL))) { - dxgsg_cat.fatal() << "GetCaps failed on DDraw\n"; - exit(1); - } + DX_DECLARE_CLEAN(DDCAPS,ddCaps); + if (FAILED(hr = _pDD->GetCaps(&ddCaps,NULL))) { + dxgsg_cat.fatal() << "GetCaps failed on DDraw\n"; + exit(1); + } - _bIsTNLDevice = (IsEqualGUID(_D3DDevDesc.deviceGUID,IID_IDirect3DTnLHalDevice)!=0); + _bIsTNLDevice = (IsEqualGUID(_D3DDevDesc.deviceGUID,IID_IDirect3DTnLHalDevice)!=0); - if ((dx_decal_type==GDT_offset) && !(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ZBIAS)) { + if ((dx_decal_type==GDT_offset) && !(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ZBIAS)) { #ifdef _DEBUG - // dx7 doesnt support PLANEMASK renderstate + // dx7 doesnt support PLANEMASK renderstate #if(DIRECT3D_VERSION < 0x700) - dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal masking\n"; + dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal masking\n"; #else - dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal double-draw blend-based masking\n"; + dxgsg_cat.error() << "dx-decal-type 'offset' not supported by hardware, switching to decal double-draw blend-based masking\n"; #endif #endif #if(DIRECT3D_VERSION < 0x700) - dx_decal_type = GDT_mask; + dx_decal_type = GDT_mask; #else - dx_decal_type = GDT_blend; + dx_decal_type = GDT_blend; #endif - } + } #ifdef DISABLE_POLYGON_OFFSET_DECALING #ifdef _DEBUG - dxgsg_cat.spam() << "polygon-offset decaling disabled in dxgsg, switching to double-draw decaling\n"; + dxgsg_cat.spam() << "polygon-offset decaling disabled in dxgsg, switching to double-draw decaling\n"; #endif #if(DIRECT3D_VERSION < 0x700) - dx_decal_type = GDT_mask; + dx_decal_type = GDT_mask; #else - dx_decal_type = GDT_blend; + dx_decal_type = GDT_blend; #endif #endif - if ((dx_decal_type==GDT_mask) && !(_D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKPLANES)) { + if ((dx_decal_type==GDT_mask) && !(_D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKPLANES)) { #ifdef _DEBUG - dxgsg_cat.error() << "No hardware support for colorwrite disabling, switching to dx-decal-type 'mask' to 'blend'\n"; + dxgsg_cat.error() << "No hardware support for colorwrite disabling, switching to dx-decal-type 'mask' to 'blend'\n"; #endif - dx_decal_type = GDT_blend; - } + dx_decal_type = GDT_blend; + } - if (((dx_decal_type==GDT_blend)||(dx_decal_type==GDT_mask)) && !(_D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKZ)) { - dxgsg_cat.error() << "dx-decal-type mask impossible to implement, no hardware support for Z-masking, decals will not appear correctly\n"; - } + if (((dx_decal_type==GDT_blend)||(dx_decal_type==GDT_mask)) && !(_D3DDevDesc.dpcTriCaps.dwMiscCaps & D3DPMISCCAPS_MASKZ)) { + dxgsg_cat.error() << "dx-decal-type mask impossible to implement, no hardware support for Z-masking, decals will not appear correctly\n"; + } //#define REQUIRED_BLENDCAPS (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE|D3DPBLENDCAPS_SRCCOLOR|D3DPBLENDCAPS_INVSRCCOLOR| \ // D3DPBLENDCAPS_SRCALPHA|D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA|D3DPBLENDCAPS_INVDESTALPHA|D3DPBLENDCAPS_DESTCOLOR|D3DPBLENDCAPS_INVDESTCOLOR) @@ -346,131 +346,131 @@ init_dx( LPDIRECTDRAW7 context, #define REQUIRED_BLENDCAPS (D3DPBLENDCAPS_ZERO|D3DPBLENDCAPS_ONE| /*D3DPBLENDCAPS_SRCCOLOR|D3DPBLENDCAPS_INVSRCCOLOR| */ \ D3DPBLENDCAPS_SRCALPHA|D3DPBLENDCAPS_INVSRCALPHA /* | D3DPBLENDCAPS_DESTALPHA|D3DPBLENDCAPS_INVDESTALPHA|D3DPBLENDCAPS_DESTCOLOR|D3DPBLENDCAPS_INVDESTCOLOR*/) - if (((_D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) || - ((_D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) { - dxgsg_cat.error() << "device is missing alpha blending capabilities, blending may not work correctly: SrcBlendCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwSrcBlendCaps << " DestBlendCaps: "<< (void*) _D3DDevDesc.dpcTriCaps.dwDestBlendCaps << endl; - } + if (((_D3DDevDesc.dpcTriCaps.dwSrcBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS) || + ((_D3DDevDesc.dpcTriCaps.dwDestBlendCaps & REQUIRED_BLENDCAPS)!=REQUIRED_BLENDCAPS)) { + dxgsg_cat.error() << "device is missing alpha blending capabilities, blending may not work correctly: SrcBlendCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwSrcBlendCaps << " DestBlendCaps: "<< (void*) _D3DDevDesc.dpcTriCaps.dwDestBlendCaps << endl; + } - if (!(_D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) { - dxgsg_cat.error() << "device is missing texture transparency capability, transparency may not work correctly! TextureCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureCaps << endl; - } + if (!(_D3DDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_TRANSPARENCY)) { + dxgsg_cat.error() << "device is missing texture transparency capability, transparency may not work correctly! TextureCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureCaps << endl; + } - // just require trilinear. if it can do that, it can probably do all the lesser point-sampling variations too + // just require trilinear. if it can do that, it can probably do all the lesser point-sampling variations too #define REQUIRED_TEXFILTERCAPS (D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_LINEAR) - if ((_D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_TEXFILTERCAPS)!=REQUIRED_TEXFILTERCAPS) { - dxgsg_cat.error() << "device is missing texture bilinear filtering capability, textures may appear blocky! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; - } + if ((_D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_TEXFILTERCAPS)!=REQUIRED_TEXFILTERCAPS) { + dxgsg_cat.error() << "device is missing texture bilinear filtering capability, textures may appear blocky! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; + } #define REQUIRED_MIPMAP_TEXFILTERCAPS (D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_LINEARMIPLINEAR) - if (!(ddCaps.ddsCaps.dwCaps & DDSCAPS_MIPMAP)) { - dxgsg_cat.debug() << "device does not have mipmap texturing filtering capability! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; - dx_ignore_mipmaps = TRUE; - } else if ((_D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_MIPMAP_TEXFILTERCAPS)!=REQUIRED_MIPMAP_TEXFILTERCAPS) { - dxgsg_cat.debug() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; - } + if (!(ddCaps.ddsCaps.dwCaps & DDSCAPS_MIPMAP)) { + dxgsg_cat.debug() << "device does not have mipmap texturing filtering capability! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; + dx_ignore_mipmaps = TRUE; + } else if ((_D3DDevDesc.dpcTriCaps.dwTextureFilterCaps & REQUIRED_MIPMAP_TEXFILTERCAPS)!=REQUIRED_MIPMAP_TEXFILTERCAPS) { + dxgsg_cat.debug() << "device is missing tri-linear mipmap filtering capability, texture mipmaps may not supported! TextureFilterCaps: 0x"<< (void*) _D3DDevDesc.dpcTriCaps.dwTextureFilterCaps << endl; + } #define REQUIRED_TEXBLENDCAPS (D3DTEXOPCAPS_MODULATE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2) - if ((_D3DDevDesc.dwTextureOpCaps & REQUIRED_TEXBLENDCAPS)!=REQUIRED_TEXBLENDCAPS) { - dxgsg_cat.error() << "device is missing some required texture blending capabilities, texture blending may not work properly! TextureOpCaps: 0x"<< (void*) _D3DDevDesc.dwTextureOpCaps << endl; - } + if ((_D3DDevDesc.dwTextureOpCaps & REQUIRED_TEXBLENDCAPS)!=REQUIRED_TEXBLENDCAPS) { + dxgsg_cat.error() << "device is missing some required texture blending capabilities, texture blending may not work properly! TextureOpCaps: 0x"<< (void*) _D3DDevDesc.dwTextureOpCaps << endl; + } - SetRect(&clip_rect, 0,0,0,0); // no clip rect set + SetRect(&clip_rect, 0,0,0,0); // no clip rect set - _d3dDevice->SetRenderState(D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR1); + _d3dDevice->SetRenderState(D3DRENDERSTATE_AMBIENTMATERIALSOURCE, D3DMCS_COLOR1); - // Lighting, let's turn it off by default - _lighting_enabled = true; - enable_lighting(false); + // Lighting, let's turn it off by default + _lighting_enabled = true; + enable_lighting(false); - // Dither, let's turn it off - _dither_enabled = true; - enable_dither(false); + // Dither, let's turn it off + _dither_enabled = true; + enable_dither(false); - // Stencil test is off by default - _stencil_test_enabled = false; + // Stencil test is off by default + _stencil_test_enabled = false; // _stencil_func = D3DCMP_NOTEQUAL; // _stencil_op = D3DSTENCILOP_REPLACE; - // Antialiasing. - enable_line_smooth(false); -// enable_multisample(true); + // Antialiasing. + enable_line_smooth(false); +// enable_multisample(true); - // technically DX7's front-end has no limit on the number of lights, but it's simpler for - // this implementation to set a small GL-like limit to make the light array traversals short - // and so I dont have to write code that reallocs light arrays - assert((_D3DDevDesc.dwMaxActiveLights==0) || // 0 means infinite lights + // technically DX7's front-end has no limit on the number of lights, but it's simpler for + // this implementation to set a small GL-like limit to make the light array traversals short + // and so I dont have to write code that reallocs light arrays + assert((_D3DDevDesc.dwMaxActiveLights==0) || // 0 means infinite lights (DXGSG_MAX_LIGHTS <= _D3DDevDesc.dwMaxActiveLights)); - _max_lights = DXGSG_MAX_LIGHTS; + _max_lights = DXGSG_MAX_LIGHTS; - _available_light_ids = PTA(Light*)(_max_lights); - _light_enabled = new bool[_max_lights]; - _cur_light_enabled = new bool[_max_lights]; + _available_light_ids = PTA(Light*)(_max_lights); + _light_enabled = new bool[_max_lights]; + _cur_light_enabled = new bool[_max_lights]; - int i; - for (i = 0; i < _max_lights; i++) { - _available_light_ids[i] = NULL; - _light_enabled[i] = false; - } + int i; + for (i = 0; i < _max_lights; i++) { + _available_light_ids[i] = NULL; + _light_enabled[i] = false; + } - // Set up the clip plane id map - _max_clip_planes = D3DMAXUSERCLIPPLANES; - _available_clip_plane_ids = PTA(PlaneNode*)(_max_clip_planes); - _clip_plane_enabled = new bool[_max_clip_planes]; - _cur_clip_plane_enabled = new bool[_max_clip_planes]; - for (i = 0; i < _max_clip_planes; i++) { - _available_clip_plane_ids[i] = NULL; - _clip_plane_enabled[i] = false; - } + // Set up the clip plane id map + _max_clip_planes = D3DMAXUSERCLIPPLANES; + _available_clip_plane_ids = PTA(PlaneNode*)(_max_clip_planes); + _clip_plane_enabled = new bool[_max_clip_planes]; + _cur_clip_plane_enabled = new bool[_max_clip_planes]; + for (i = 0; i < _max_clip_planes; i++) { + _available_clip_plane_ids[i] = NULL; + _clip_plane_enabled[i] = false; + } - // initial clip rect - SetRect(&clip_rect, 0,0,0,0); // no clip rect set + // initial clip rect + SetRect(&clip_rect, 0,0,0,0); // no clip rect set - // Make sure the GL state matches all of our initial attribute - // states. - PT(DepthTestAttribute) dta = new DepthTestAttribute; - PT(DepthWriteAttribute) dwa = new DepthWriteAttribute; - PT(CullFaceAttribute) cfa = new CullFaceAttribute; - PT(LightAttribute) la = new LightAttribute; - PT(TextureAttribute) ta = new TextureAttribute; + // Make sure the GL state matches all of our initial attribute + // states. + PT(DepthTestAttribute) dta = new DepthTestAttribute; + PT(DepthWriteAttribute) dwa = new DepthWriteAttribute; + PT(CullFaceAttribute) cfa = new CullFaceAttribute; + PT(LightAttribute) la = new LightAttribute; + PT(TextureAttribute) ta = new TextureAttribute; - dta->issue(this); - dwa->issue(this); - cfa->issue(this); - la->issue(this); + dta->issue(this); + dwa->issue(this); + cfa->issue(this); + la->issue(this); - // must do SetTSS here because redundant states are filtered out by our code based on current values above, so - // initial conditions must be correct + // must do SetTSS here because redundant states are filtered out by our code based on current values above, so + // initial conditions must be correct - _CurTexBlendMode = TextureApplyProperty::M_modulate; - SetTextureBlendMode(_CurTexBlendMode,FALSE); - _d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); // disables texturing + _CurTexBlendMode = TextureApplyProperty::M_modulate; + SetTextureBlendMode(_CurTexBlendMode,FALSE); + _d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); // disables texturing - // Init more Texture State - _CurTexMagFilter=_CurTexMinFilter=Texture::FT_nearest; - _CurTexWrapModeU=_CurTexWrapModeV=Texture::WM_clamp; - _CurTexAnisoDegree=1; + // Init more Texture State + _CurTexMagFilter=_CurTexMinFilter=Texture::FT_nearest; + _CurTexWrapModeU=_CurTexWrapModeV=Texture::WM_clamp; + _CurTexAnisoDegree=1; - // this code must match apply_texture() code for states above - // so DX TSS renderstate matches dxgsg state + // this code must match apply_texture() code for states above + // so DX TSS renderstate matches dxgsg state - _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_POINT); - _d3dDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFP_POINT); - _d3dDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTFP_NONE); - _d3dDevice->SetTextureStageState(0, D3DTSS_MAXANISOTROPY,_CurTexAnisoDegree); - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,get_texture_wrap_mode(_CurTexWrapModeU)); - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,get_texture_wrap_mode(_CurTexWrapModeV)); + _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_POINT); + _d3dDevice->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFP_POINT); + _d3dDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTFP_NONE); + _d3dDevice->SetTextureStageState(0, D3DTSS_MAXANISOTROPY,_CurTexAnisoDegree); + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,get_texture_wrap_mode(_CurTexWrapModeU)); + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,get_texture_wrap_mode(_CurTexWrapModeV)); - ta->issue(this); // no curtextcontext, this does nothing. dx should already be properly inited above anyway + ta->issue(this); // no curtextcontext, this does nothing. dx should already be properly inited above anyway #ifdef _DEBUG - if ((_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_MIPMAPLODBIAS) && - (dx_global_miplevel_bias!=0.0f)) { - _d3dDevice->SetTextureStageState(0, D3DTSS_MIPMAPLODBIAS, *((LPDWORD) (&dx_global_miplevel_bias)) ); - } + if ((_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_MIPMAPLODBIAS) && + (dx_global_miplevel_bias!=0.0f)) { + _d3dDevice->SetTextureStageState(0, D3DTSS_MIPMAPLODBIAS, *((LPDWORD) (&dx_global_miplevel_bias)) ); + } #endif - _d3dDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, _CurShadeMode); + _d3dDevice->SetRenderState(D3DRENDERSTATE_SHADEMODE, _CurShadeMode); } //////////////////////////////////////////////////////////////////// @@ -481,35 +481,35 @@ init_dx( LPDIRECTDRAW7 context, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: clear(const RenderBuffer &buffer) { - // PStatTimer timer(_win->_clear_pcollector); + // PStatTimer timer(_win->_clear_pcollector); - activate(); + activate(); - nassertv(buffer._gsg == this); - int buffer_type = buffer._buffer_type; + nassertv(buffer._gsg == this); + int buffer_type = buffer._buffer_type; - int flags = 0; + int flags = 0; - if (buffer_type & RenderBuffer::T_depth) - flags |= D3DCLEAR_ZBUFFER; - if (buffer_type & RenderBuffer::T_back) //set appropriate flags - flags |= D3DCLEAR_TARGET; - if (buffer_type & RenderBuffer::T_stencil) - flags |= D3DCLEAR_STENCIL; + if (buffer_type & RenderBuffer::T_depth) + flags |= D3DCLEAR_ZBUFFER; + if (buffer_type & RenderBuffer::T_back) //set appropriate flags + flags |= D3DCLEAR_TARGET; + if (buffer_type & RenderBuffer::T_stencil) + flags |= D3DCLEAR_STENCIL; - D3DCOLOR clear_colr = Colorf_to_D3DCOLOR(_color_clear_value); + D3DCOLOR clear_colr = Colorf_to_D3DCOLOR(_color_clear_value); - HRESULT hr = _d3dDevice->Clear(0, NULL, flags, clear_colr, - (D3DVALUE) _depth_clear_value, (DWORD)_stencil_clear_value); - if (hr != DD_OK) - dxgsg_cat.error() - << "dxGSG::clear_buffer failed: Clear returned " << ConvD3DErrorToString(hr) << endl; - /* The following line will cause the background to always clear to a medium red - _color_clear_value[0] = .5; - /* The following lines will cause the background color to cycle from black to red. - _color_clear_value[0] += .001; - if (_color_clear_value[0] > 1.0f) _color_clear_value[0] = 0.0f; - */ + HRESULT hr = _d3dDevice->Clear(0, NULL, flags, clear_colr, + (D3DVALUE) _depth_clear_value, (DWORD)_stencil_clear_value); + if (hr != DD_OK) + dxgsg_cat.error() + << "dxGSG::clear_buffer failed: Clear returned " << ConvD3DErrorToString(hr) << endl; + /* The following line will cause the background to always clear to a medium red + _color_clear_value[0] = .5; + /* The following lines will cause the background color to cycle from black to red. + _color_clear_value[0] += .001; + if (_color_clear_value[0] > 1.0f) _color_clear_value[0] = 0.0f; + */ } //////////////////////////////////////////////////////////////////// @@ -520,10 +520,10 @@ clear(const RenderBuffer &buffer) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: clear(const RenderBuffer &buffer, const DisplayRegion *region) { - DisplayRegionStack old_dr = push_display_region(region); - prepare_display_region(); - clear(buffer); - pop_display_region(old_dr); + DisplayRegionStack old_dr = push_display_region(region); + prepare_display_region(); + clear(buffer); + pop_display_region(old_dr); } //////////////////////////////////////////////////////////////////// @@ -533,18 +533,18 @@ clear(const RenderBuffer &buffer, const DisplayRegion *region) { //////////////////////////////////////////////////////////////////// bool DXGraphicsStateGuardian:: enable_light(int light, bool val) { - if (_light_enabled[light] != val) { - _light_enabled[light] = val; - HRESULT res = _d3dDevice->LightEnable( light, val ); + if (_light_enabled[light] != val) { + _light_enabled[light] = val; + HRESULT res = _d3dDevice->LightEnable( light, val ); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "LightEnable(" << light << "=" << val << ")" << endl; + dxgsg_cat.debug() + << "LightEnable(" << light << "=" << val << ")" << endl; #endif - return(res == DD_OK); - } - return TRUE; + return(res == DD_OK); + } + return TRUE; } @@ -557,35 +557,35 @@ enable_light(int light, bool val) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: prepare_display_region() { - if (_current_display_region == (DisplayRegion*)0L) { - dxgsg_cat.error() - << "Invalid NULL display region in prepare_display_region()\n"; + if (_current_display_region == (DisplayRegion*)0L) { + dxgsg_cat.error() + << "Invalid NULL display region in prepare_display_region()\n"; - } else if (_current_display_region != _actual_display_region) { - _actual_display_region = _current_display_region; + } else if (_current_display_region != _actual_display_region) { + _actual_display_region = _current_display_region; /* - int l, b, w, h; - _actual_display_region->get_region_pixels(l, b, w, h); - GLint x = GLint(l); - GLint y = GLint(b); - GLsizei width = GLsizei(w); - GLsizei height = GLsizei(h); + int l, b, w, h; + _actual_display_region->get_region_pixels(l, b, w, h); + GLint x = GLint(l); + GLint y = GLint(b); + GLsizei width = GLsizei(w); + GLsizei height = GLsizei(h); #ifdef WBD_GL_MODE - call_glScissor( x, y, width, height ); - call_glViewport( x, y, width, height ); + call_glScissor( x, y, width, height ); + call_glViewport( x, y, width, height ); #else - if ( _scissor_x != x || _scissor_y != y || - _scissor_width != width || _scissor_height != height ) - { - _scissor_x = x; _scissor_y = y; - _scissor_width = width; _scissor_height = height; - RECT cliprect; - SetRect(&cliprect, x, y, x+width, y+height ); - set_clipper(cliprect); - } + if ( _scissor_x != x || _scissor_y != y || + _scissor_width != width || _scissor_height != height ) + { + _scissor_x = x; _scissor_y = y; + _scissor_width = width; _scissor_height = height; + RECT cliprect; + SetRect(&cliprect, x, y, x+width, y+height ); + set_clipper(cliprect); + } #endif //WBD_GL_MODE */ - } + } } @@ -597,43 +597,43 @@ prepare_display_region() { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::set_clipper(RECT cliprect) { #if 0 - LPDIRECTDRAWCLIPPER Clipper; - HRESULT result; + LPDIRECTDRAWCLIPPER Clipper; + HRESULT result; - // For windowed mode, the clip region is associated with the window, - // and DirectX does not allow you to create clip regions. - if (dx_full_screen) return; + // For windowed mode, the clip region is associated with the window, + // and DirectX does not allow you to create clip regions. + if (dx_full_screen) return; - /* The cliprect we receive is normalized so that (0,0) means the upper left of - the client portion of the window. - At least, I think that's true, and the following code assumes that. - So we must adjust the clip region by offsetting it to the origin of the - view rectangle. - */ - clip_rect = cliprect; // store the normalized clip rect - cliprect.left += _view_rect.left; - cliprect.right += _view_rect.left; - cliprect.top += _view_rect.top; - cliprect.bottom += _view_rect.top; - RGNDATA *rgn_data = (RGNDATA *)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT)); - HRGN hrgn = CreateRectRgn(cliprect.left, cliprect.top, cliprect.right, cliprect.bottom); - GetRegionData(hrgn, sizeof(RGNDATAHEADER) + sizeof(RECT), rgn_data); + /* The cliprect we receive is normalized so that (0,0) means the upper left of + the client portion of the window. + At least, I think that's true, and the following code assumes that. + So we must adjust the clip region by offsetting it to the origin of the + view rectangle. + */ + clip_rect = cliprect; // store the normalized clip rect + cliprect.left += _view_rect.left; + cliprect.right += _view_rect.left; + cliprect.top += _view_rect.top; + cliprect.bottom += _view_rect.top; + RGNDATA *rgn_data = (RGNDATA *)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT)); + HRGN hrgn = CreateRectRgn(cliprect.left, cliprect.top, cliprect.right, cliprect.bottom); + GetRegionData(hrgn, sizeof(RGNDATAHEADER) + sizeof(RECT), rgn_data); - if (_pri->GetClipper(&Clipper) != DD_OK) { - result = _pDD->CreateClipper(0, &Clipper, NULL); - result = Clipper->SetClipList(rgn_data, 0); - result = _pri->SetClipper(Clipper); - } else { - result = Clipper->SetClipList(rgn_data, 0 ); - if (result == DDERR_CLIPPERISUSINGHWND) { - result = _pri->SetClipper(NULL); - result = _pDD->CreateClipper(0, &Clipper, NULL); - result = Clipper->SetClipList(rgn_data, 0 ) ; - result = _pri->SetClipper(Clipper); - } - } - free(rgn_data); - DeleteObject(hrgn); + if (_pri->GetClipper(&Clipper) != DD_OK) { + result = _pDD->CreateClipper(0, &Clipper, NULL); + result = Clipper->SetClipList(rgn_data, 0); + result = _pri->SetClipper(Clipper); + } else { + result = Clipper->SetClipList(rgn_data, 0 ); + if (result == DDERR_CLIPPERISUSINGHWND) { + result = _pri->SetClipper(NULL); + result = _pDD->CreateClipper(0, &Clipper, NULL); + result = Clipper->SetClipList(rgn_data, 0 ) ; + result = _pri->SetClipper(Clipper); + } + } + free(rgn_data); + DeleteObject(hrgn); #endif } @@ -646,9 +646,9 @@ void DXGraphicsStateGuardian::set_clipper(RECT cliprect) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: render_frame(const AllAttributesWrapper &initial_state) { - if (!_dx_ready) return; + if (!_dx_ready) return; - _win->begin_frame(); + _win->begin_frame(); _lighting_enabled_this_frame = false; #ifdef DO_PSTATS @@ -665,118 +665,118 @@ render_frame(const AllAttributesWrapper &initial_state) { set_state(state, false); #endif - _d3dDevice->BeginScene(); + _d3dDevice->BeginScene(); /* _d3dDevice->SetTransform(D3DTRANSFORMSTATE_VIEW, &matIdentity); */ #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "begin frame --------------------------------------------" << endl; + dxgsg_cat.debug() + << "begin frame --------------------------------------------" << endl; #endif - _decal_level = 0; + _decal_level = 0; - if (_clear_buffer_type != 0) { - // First, clear the entire window. - PT(DisplayRegion) win_dr = - _win->make_scratch_display_region(_win->get_width(), _win->get_height()); - clear(get_render_buffer(_clear_buffer_type), win_dr); - } - - // Now render each of our layers in order. - int max_channel_index = _win->get_max_channel_index(); - for (int c = 0; c < max_channel_index; c++) { - if (_win->is_channel_defined(c)) { - GraphicsChannel *chan = _win->get_channel(c); - if (chan->is_active()) { - int num_layers = chan->get_num_layers(); - for (int l = 0; l < num_layers; l++) { - GraphicsLayer *layer = chan->get_layer(l); - if (layer->is_active()) { - int num_drs = layer->get_num_drs(); - for (int d = 0; d < num_drs; d++) { - DisplayRegion *dr = layer->get_dr(d); - Camera *cam = dr->get_camera(); + if (_clear_buffer_type != 0) { + // First, clear the entire window. + PT(DisplayRegion) win_dr = + _win->make_scratch_display_region(_win->get_width(), _win->get_height()); + clear(get_render_buffer(_clear_buffer_type), win_dr); + } - // For each display region, render from the camera's view. - if (dr->is_active() && cam != (Camera *)NULL && - cam->is_active() && cam->get_scene() != (Node *)NULL) { - DisplayRegionStack old_dr = push_display_region(dr); - prepare_display_region(); - render_scene(cam->get_scene(), cam, initial_state); - pop_display_region(old_dr); - } - } - } // if (layer->is_active()) - } - } // if (chan->is_active()) - } - } // for (int c = 0; c < max_channel_index; c++) + // Now render each of our layers in order. + int max_channel_index = _win->get_max_channel_index(); + for (int c = 0; c < max_channel_index; c++) { + if (_win->is_channel_defined(c)) { + GraphicsChannel *chan = _win->get_channel(c); + if (chan->is_active()) { + int num_layers = chan->get_num_layers(); + for (int l = 0; l < num_layers; l++) { + GraphicsLayer *layer = chan->get_layer(l); + if (layer->is_active()) { + int num_drs = layer->get_num_drs(); + for (int d = 0; d < num_drs; d++) { + DisplayRegion *dr = layer->get_dr(d); + Camera *cam = dr->get_camera(); - // Now we're done with the frame processing. Clean up. + // For each display region, render from the camera's view. + if (dr->is_active() && cam != (Camera *)NULL && + cam->is_active() && cam->get_scene() != (Node *)NULL) { + DisplayRegionStack old_dr = push_display_region(dr); + prepare_display_region(); + render_scene(cam->get_scene(), cam, initial_state); + pop_display_region(old_dr); + } + } + } // if (layer->is_active()) + } + } // if (chan->is_active()) + } + } // for (int c = 0; c < max_channel_index; c++) - _d3dDevice->EndScene(); // FPS meter drawing MUST occur after EndScene, since it uses GDI + // Now we're done with the frame processing. Clean up. - if (_lighting_enabled_this_frame) { - // Let's turn off all the lights we had on, and clear the light - // cache--to force the lights to be reissued next frame, in case - // their parameters or positions have changed between frames. - - for (int i = 0; i < _max_lights; i++) { - enable_light(i, false); - _available_light_ids[i] = NULL; - } - - // Also force the lighting state to unlit, so that issue_light() - // will be guaranteed to be called next frame even if we have the - // same set of light pointers we had this frame. - NodeAttributes state; - state.set_attribute(LightTransition::get_class_type(), new LightAttribute); - set_state(state, false); - - // All this work to undo the lighting state each frame doesn't seem - // ideal--there may be a better way. Maybe if the lights were just - // more aware of whether their parameters or positions have changed - // at all? - } + _d3dDevice->EndScene(); // FPS meter drawing MUST occur after EndScene, since it uses GDI - if(dx_show_fps_meter) { - PStatTimer timer(_win->_show_fps_pcollector); + if (_lighting_enabled_this_frame) { + // Let's turn off all the lights we had on, and clear the light + // cache--to force the lights to be reissued next frame, in case + // their parameters or positions have changed between frames. - DWORD now = timeGetTime(); // this is win32 fn + for (int i = 0; i < _max_lights; i++) { + enable_light(i, false); + _available_light_ids[i] = NULL; + } - float time_delta = (now - _start_time) * 0.001f; + // Also force the lighting state to unlit, so that issue_light() + // will be guaranteed to be called next frame even if we have the + // same set of light pointers we had this frame. + NodeAttributes state; + state.set_attribute(LightTransition::get_class_type(), new LightAttribute); + set_state(state, false); - if(time_delta > dx_fps_meter_update_interval) { - // didnt use global clock object, it wasnt working properly when I tried, - // its probably slower due to cache faults, and I can easily track all the - // info I need in dxgsg - DWORD num_frames = _cur_frame_count - _start_frame_count; + // All this work to undo the lighting state each frame doesn't seem + // ideal--there may be a better way. Maybe if the lights were just + // more aware of whether their parameters or positions have changed + // at all? + } - _current_fps = num_frames / time_delta; - _start_time = now; - _start_frame_count = _cur_frame_count; - } + if(dx_show_fps_meter) { + PStatTimer timer(_win->_show_fps_pcollector); - HDC hDC; + DWORD now = timeGetTime(); // this is win32 fn - if(SUCCEEDED(_back->GetDC(&hDC))) { - char fps_msg[15]; - sprintf(fps_msg, "%7.02f fps", _current_fps); - SetTextColor(hDC, RGB(255,255,0) ); - SetBkMode(hDC, TRANSPARENT ); + float time_delta = (now - _start_time) * 0.001f; - // 75,8 seem to work well w/default font + if(time_delta > dx_fps_meter_update_interval) { + // didnt use global clock object, it wasnt working properly when I tried, + // its probably slower due to cache faults, and I can easily track all the + // info I need in dxgsg + DWORD num_frames = _cur_frame_count - _start_frame_count; + + _current_fps = num_frames / time_delta; + _start_time = now; + _start_frame_count = _cur_frame_count; + } + + HDC hDC; + + if(SUCCEEDED(_back->GetDC(&hDC))) { + char fps_msg[15]; + sprintf(fps_msg, "%7.02f fps", _current_fps); + SetTextColor(hDC, RGB(255,255,0) ); + SetBkMode(hDC, TRANSPARENT ); + + // 75,8 seem to work well w/default font TextOutA(hDC, (_view_rect.right-_view_rect.left)-75, 8, fps_msg, strlen(fps_msg)); _back->ReleaseDC(hDC); - } + } - _cur_frame_count++; // only used by fps meter right now - } + _cur_frame_count++; // only used by fps meter right now + } - _win->end_frame(); + _win->end_frame(); - show_frame(); + show_frame(); #ifdef DO_PSTATS if (_texmgrmem_total_pcollector.is_active()) { @@ -785,65 +785,65 @@ render_frame(const AllAttributesWrapper &initial_state) { #endif #ifdef PRINT_TEXSTATS - { + { #define TICKSPERINFO (3*1000) - static DWORD LastTickCount=0; + static DWORD LastTickCount=0; - DWORD CurTickCount=GetTickCount(); + DWORD CurTickCount=GetTickCount(); - if (CurTickCount-LastTickCount > TICKSPERINFO) { - LastTickCount=CurTickCount; - HRESULT hr; + if (CurTickCount-LastTickCount > TICKSPERINFO) { + LastTickCount=CurTickCount; + HRESULT hr; - D3DDEVINFO_TEXTUREMANAGER tminfo; - ZeroMemory(&tminfo,sizeof( D3DDEVINFO_TEXTUREMANAGER)); - hr = _d3dDevice->GetInfo(D3DDEVINFOID_TEXTUREMANAGER,&tminfo,sizeof(D3DDEVINFO_TEXTUREMANAGER)); - if (hr!=D3D_OK) { - if (hr==S_FALSE) - dxgsg_cat.error() << "GetInfo requires debug DX7 DLLs to be installed!!\n"; - else dxgsg_cat.error() << "GetInfo appinfo failed : result = " << ConvD3DErrorToString(hr) << endl; - } else - dxgsg_cat.spam() - << "\n bThrashing:\t" << tminfo.bThrashing - << "\n NumEvicts:\t" << tminfo.dwNumEvicts - << "\n NumVidCreates:\t" << tminfo.dwNumVidCreates - << "\n NumTexturesUsed:\t" << tminfo.dwNumTexturesUsed - << "\n NumUsedTexInVid:\t" << tminfo.dwNumUsedTexInVid - << "\n WorkingSet:\t" << tminfo.dwWorkingSet - << "\n WorkingSetBytes:\t" << tminfo.dwWorkingSetBytes - << "\n TotalManaged:\t" << tminfo.dwTotalManaged - << "\n TotalBytes:\t" << tminfo.dwTotalBytes - << "\n LastPri:\t" << tminfo.dwLastPri << endl; + D3DDEVINFO_TEXTUREMANAGER tminfo; + ZeroMemory(&tminfo,sizeof( D3DDEVINFO_TEXTUREMANAGER)); + hr = _d3dDevice->GetInfo(D3DDEVINFOID_TEXTUREMANAGER,&tminfo,sizeof(D3DDEVINFO_TEXTUREMANAGER)); + if (hr!=D3D_OK) { + if (hr==S_FALSE) + dxgsg_cat.error() << "GetInfo requires debug DX7 DLLs to be installed!!\n"; + else dxgsg_cat.error() << "GetInfo appinfo failed : result = " << ConvD3DErrorToString(hr) << endl; + } else + dxgsg_cat.spam() + << "\n bThrashing:\t" << tminfo.bThrashing + << "\n NumEvicts:\t" << tminfo.dwNumEvicts + << "\n NumVidCreates:\t" << tminfo.dwNumVidCreates + << "\n NumTexturesUsed:\t" << tminfo.dwNumTexturesUsed + << "\n NumUsedTexInVid:\t" << tminfo.dwNumUsedTexInVid + << "\n WorkingSet:\t" << tminfo.dwWorkingSet + << "\n WorkingSetBytes:\t" << tminfo.dwWorkingSetBytes + << "\n TotalManaged:\t" << tminfo.dwTotalManaged + << "\n TotalBytes:\t" << tminfo.dwTotalBytes + << "\n LastPri:\t" << tminfo.dwLastPri << endl; - D3DDEVINFO_TEXTURING texappinfo; - ZeroMemory(&texappinfo,sizeof( D3DDEVINFO_TEXTURING)); - hr = _d3dDevice->GetInfo(D3DDEVINFOID_TEXTURING,&texappinfo,sizeof(D3DDEVINFO_TEXTURING)); - if (hr!=D3D_OK) { - if (hr==S_FALSE) - dxgsg_cat.error() << "GetInfo requires debug DX7 DLLs to be installed!!\n"; - else dxgsg_cat.error() << "GetInfo appinfo failed : result = " << ConvD3DErrorToString(hr) << endl; - } else - dxgsg_cat.spam() - << "\n NumLoads:\t" << texappinfo.dwNumLoads - << "\n ApproxBytesLoaded:\t" << texappinfo.dwApproxBytesLoaded - << "\n NumPreLoads:\t" << texappinfo.dwNumPreLoads - << "\n NumSet:\t" << texappinfo.dwNumSet - << "\n NumCreates:\t" << texappinfo.dwNumCreates - << "\n NumDestroys:\t" << texappinfo.dwNumDestroys - << "\n NumSetPriorities:\t" << texappinfo.dwNumSetPriorities - << "\n NumSetLODs:\t" << texappinfo.dwNumSetLODs - << "\n NumLocks:\t" << texappinfo.dwNumLocks - << "\n NumGetDCs:\t" << texappinfo.dwNumGetDCs << endl; - } + D3DDEVINFO_TEXTURING texappinfo; + ZeroMemory(&texappinfo,sizeof( D3DDEVINFO_TEXTURING)); + hr = _d3dDevice->GetInfo(D3DDEVINFOID_TEXTURING,&texappinfo,sizeof(D3DDEVINFO_TEXTURING)); + if (hr!=D3D_OK) { + if (hr==S_FALSE) + dxgsg_cat.error() << "GetInfo requires debug DX7 DLLs to be installed!!\n"; + else dxgsg_cat.error() << "GetInfo appinfo failed : result = " << ConvD3DErrorToString(hr) << endl; + } else + dxgsg_cat.spam() + << "\n NumLoads:\t" << texappinfo.dwNumLoads + << "\n ApproxBytesLoaded:\t" << texappinfo.dwApproxBytesLoaded + << "\n NumPreLoads:\t" << texappinfo.dwNumPreLoads + << "\n NumSet:\t" << texappinfo.dwNumSet + << "\n NumCreates:\t" << texappinfo.dwNumCreates + << "\n NumDestroys:\t" << texappinfo.dwNumDestroys + << "\n NumSetPriorities:\t" << texappinfo.dwNumSetPriorities + << "\n NumSetLODs:\t" << texappinfo.dwNumSetLODs + << "\n NumLocks:\t" << texappinfo.dwNumLocks + << "\n NumGetDCs:\t" << texappinfo.dwNumGetDCs << endl; + } - } + } #endif #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "end frame ----------------------------------------------" << endl; + dxgsg_cat.debug() + << "end frame ----------------------------------------------" << endl; #endif } @@ -880,22 +880,22 @@ report_texmgr_stats() { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state) { + const AllAttributesWrapper &initial_state) { #ifdef GSG_VERBOSE - _pass_number = 0; - dxgsg_cat.debug() - << "begin scene - - - - - - - - - - - - - - - - - - - - - - - - -" - << endl; + _pass_number = 0; + dxgsg_cat.debug() + << "begin scene - - - - - - - - - - - - - - - - - - - - - - - - -" + << endl; #endif - _current_root_node = root; + _current_root_node = root; - render_subgraph(_render_traverser, root, projnode, initial_state, - AllTransitionsWrapper()); + render_subgraph(_render_traverser, root, projnode, initial_state, + AllTransitionsWrapper()); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "done scene - - - - - - - - - - - - - - - - - - - - - - - - -" - << endl; + dxgsg_cat.debug() + << "done scene - - - - - - - - - - - - - - - - - - - - - - - - -" + << endl; #endif } @@ -909,77 +909,77 @@ render_scene(Node *root, ProjectionNode *projnode, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { // activate(); doesnt do anything right now - ProjectionNode *old_projection_node = _current_projection_node; - _current_projection_node = projnode; - LMatrix4f old_projection_mat = _current_projection_mat; + ProjectionNode *old_projection_node = _current_projection_node; + _current_projection_node = projnode; + LMatrix4f old_projection_mat = _current_projection_mat; - // d3d is left-handed coord system - LMatrix4f projection_mat = - projnode->get_projection()->get_projection_mat(CS_yup_left); + // d3d is left-handed coord system + LMatrix4f projection_mat = + projnode->get_projection()->get_projection_mat(CS_yup_left); #if 0 - dxgsg_cat.spam() << "cur projection matrix: " << projection_mat <<"\n"; + dxgsg_cat.spam() << "cur projection matrix: " << projection_mat <<"\n"; #endif - _current_projection_mat = projection_mat; - _projection_mat_stack_count++; + _current_projection_mat = projection_mat; + _projection_mat_stack_count++; #ifdef _DEBUG { - static bool bPrintedMsg=false; + static bool bPrintedMsg=false; - if((!bPrintedMsg) && !IS_NEARLY_EQUAL(projection_mat(2,3),1.0f)) { - bPrintedMsg=true; - dxgsg_cat.info() << "non w-compliant render_subgraph projection matrix [2][3]: " << projection_mat(2,3) << endl; - dxgsg_cat.info() << "cur projection matrix: " << projection_mat << endl; - } + if((!bPrintedMsg) && !IS_NEARLY_EQUAL(projection_mat(2,3),1.0f)) { + bPrintedMsg=true; + dxgsg_cat.info() << "non w-compliant render_subgraph projection matrix [2][3]: " << projection_mat(2,3) << endl; + dxgsg_cat.info() << "cur projection matrix: " << projection_mat << endl; + } - // note: a projection matrix that does not have a [3][4] value of 1.0f is - // not w-compliant and could cause problems with fog + // note: a projection matrix that does not have a [3][4] value of 1.0f is + // not w-compliant and could cause problems with fog - } + } #endif - // We load the projection matrix directly. - HRESULT res = - _d3dDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, - (LPD3DMATRIX) _current_projection_mat.get_data()); + // We load the projection matrix directly. + HRESULT res = + _d3dDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, + (LPD3DMATRIX) _current_projection_mat.get_data()); - // We infer the modelview matrix by doing a wrt on the projection - // node. - LMatrix4f modelview_mat; - get_rel_mat(subgraph, _current_projection_node, modelview_mat); // reversed from GL + // We infer the modelview matrix by doing a wrt on the projection + // node. + LMatrix4f modelview_mat; + get_rel_mat(subgraph, _current_projection_node, modelview_mat); // reversed from GL // get_rel_mat(_current_projection_node, subgraph, modelview_mat); - if (_coordinate_system != CS_yup_left) { - // Now we build the coordinate system conversion into the - // modelview matrix (as described in the paragraph above). - modelview_mat = modelview_mat * - LMatrix4f::convert_mat(_coordinate_system, CS_yup_left); - } + if (_coordinate_system != CS_yup_left) { + // Now we build the coordinate system conversion into the + // modelview matrix (as described in the paragraph above). + modelview_mat = modelview_mat * + LMatrix4f::convert_mat(_coordinate_system, CS_yup_left); + } - // The modelview matrix will be loaded as each geometry is - // encountered. So we set the supplied modelview matrix as an - // initial value instead of loading it now. - AllTransitionsWrapper sub_trans = net_trans; - sub_trans.set_transition(new TransformTransition(modelview_mat)); + // The modelview matrix will be loaded as each geometry is + // encountered. So we set the supplied modelview matrix as an + // initial value instead of loading it now. + AllTransitionsWrapper sub_trans = net_trans; + sub_trans.set_transition(new TransformTransition(modelview_mat)); - render_subgraph(traverser, subgraph, initial_state, sub_trans); + render_subgraph(traverser, subgraph, initial_state, sub_trans); - _current_projection_node = old_projection_node; - _current_projection_mat = old_projection_mat; - _projection_mat_stack_count--; + _current_projection_node = old_projection_node; + _current_projection_mat = old_projection_mat; + _projection_mat_stack_count--; - // We must now restore the projection matrix from before. We could - // do a push/pop matrix if we were using D3DX - if (_projection_mat_stack_count > 0) - _d3dDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, - (LPD3DMATRIX) _current_projection_mat.get_data()); + // We must now restore the projection matrix from before. We could + // do a push/pop matrix if we were using D3DX + if (_projection_mat_stack_count > 0) + _d3dDevice->SetTransform(D3DTRANSFORMSTATE_PROJECTION, + (LPD3DMATRIX) _current_projection_mat.get_data()); } @@ -993,23 +993,23 @@ render_subgraph(RenderTraverser *traverser, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "begin subgraph (pass " << ++_pass_number - << ") - - - - - - - - - - - - - - - - - - - - - - - - -" << endl; + dxgsg_cat.debug() + << "begin subgraph (pass " << ++_pass_number + << ") - - - - - - - - - - - - - - - - - - - - - - - - -" << endl; #endif - activate(); + activate(); - nassertv(traverser != (RenderTraverser *)NULL); - traverser->traverse(subgraph, initial_state, net_trans); + nassertv(traverser != (RenderTraverser *)NULL); + traverser->traverse(subgraph, initial_state, net_trans); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "end subgraph (pass " << _pass_number - << ") - - - - - - - - - - - - - - - - - - - - - - - - -" - << endl; + dxgsg_cat.debug() + << "end subgraph (pass " << _pass_number + << ") - - - - - - - - - - - - - - - - - - - - - - - - -" + << endl; #endif } @@ -1020,8 +1020,8 @@ render_subgraph(RenderTraverser *traverser, Node *subgraph, //////////////////////////////////////////////////////////////////// INLINE void DXGraphicsStateGuardian:: add_to_FVFBuf(void *data, size_t bytes) { - memcpy(_pCurFvfBufPtr, data, bytes); - _pCurFvfBufPtr += bytes; + memcpy(_pCurFvfBufPtr, data, bytes); + _pCurFvfBufPtr += bytes; } @@ -1029,21 +1029,21 @@ add_to_FVFBuf(void *data, size_t bytes) { #define add_DWORD_to_FVFBuf(data) { *((DWORD *)_pCurFvfBufPtr) = (DWORD) data; _pCurFvfBufPtr += sizeof(DWORD);} typedef enum { - FlatVerts,IndexedVerts,MixedFmtVerts + FlatVerts,IndexedVerts,MixedFmtVerts } GeomVertFormat; #ifdef _DEBUG typedef enum {DrawPrim,DrawPrimStrided} DP_Type; void INLINE TestDrawPrimFailure(DP_Type dptype,HRESULT hr,LPDIRECTDRAW7 pDD) { - if(FAILED(hr)) { - // loss of exclusive mode is not a real DrawPrim problem - HRESULT testcooplvl_hr = pDD->TestCooperativeLevel(); - if((testcooplvl_hr != DDERR_NOEXCLUSIVEMODE)||(testcooplvl_hr != DDERR_EXCLUSIVEMODEALREADYSET)) { - dxgsg_cat.fatal() << ((dptype==DrawPrimStrided) ? "DrawPrimStrided" : "DrawPrim") << "failed: result = " << ConvD3DErrorToString(hr) << endl; - } - exit(1); - } + if(FAILED(hr)) { + // loss of exclusive mode is not a real DrawPrim problem + HRESULT testcooplvl_hr = pDD->TestCooperativeLevel(); + if((testcooplvl_hr != DDERR_NOEXCLUSIVEMODE)||(testcooplvl_hr != DDERR_EXCLUSIVEMODEALREADYSET)) { + dxgsg_cat.fatal() << ((dptype==DrawPrimStrided) ? "DrawPrimStrided" : "DrawPrim") << "failed: result = " << ConvD3DErrorToString(hr) << endl; + } + exit(1); + } } #else #define TestDrawPrimFailure(a,b,c) @@ -1057,10 +1057,10 @@ transform_color(Colorf &InColor,D3DCOLOR &OutRGBAColor) { // the ordinary 4x4 matrix, and a separate alpha value, which can be // scaled and offsetted. - LPoint4f temp_pnt(InColor[0], InColor[1], InColor[2], 1.0f); - Colorf out_color = temp_pnt * _current_color_mat; // maybe expand this out for efficiency - out_color[3] = (InColor[3] * _current_alpha_scale) + _current_alpha_offset; - OutRGBAColor = Colorf_to_D3DCOLOR(out_color); + LPoint4f temp_pnt(InColor[0], InColor[1], InColor[2], 1.0f); + Colorf out_color = temp_pnt * _current_color_mat; // maybe expand this out for efficiency + out_color[3] = (InColor[3] * _current_alpha_scale) + _current_alpha_offset; + OutRGBAColor = Colorf_to_D3DCOLOR(out_color); } //////////////////////////////////////////////////////////////////// @@ -1070,70 +1070,70 @@ transform_color(Colorf &InColor,D3DCOLOR &OutRGBAColor) { //////////////////////////////////////////////////////////////////// size_t DXGraphicsStateGuardian:: draw_prim_setup(const Geom *geom) { - // Set the flags for the flexible vertex format and compute the bytes - // required to store a single vertex. + // Set the flags for the flexible vertex format and compute the bytes + // required to store a single vertex. + + #ifdef _DEBUG + assert(geom->get_binding(G_COORD) != G_OFF); + #endif - #ifdef _DEBUG - assert(geom->get_binding(G_COORD) != G_OFF); - #endif - #define GET_NEXT_VERTEX() { p_vertex = geom->get_next_vertex(vi); } #define GET_NEXT_NORMAL() { p_normal = geom->get_next_normal(ni); } #define GET_NEXT_TEXCOORD() { p_texcoord = geom->get_next_texcoord(ti); } #define GET_NEXT_COLOR() { \ - if(_color_transform_enabled || _alpha_transform_enabled) { \ - Colorf tempcolor = geom->get_next_color(ci); \ - transform_color(tempcolor,p_colr); \ - } else { \ - p_color = geom->get_next_color(ci); \ - p_colr = Colorf_to_D3DCOLOR(p_color); \ - }} + if(_color_transform_enabled || _alpha_transform_enabled) { \ + Colorf tempcolor = geom->get_next_color(ci); \ + transform_color(tempcolor,p_colr); \ + } else { \ + p_color = geom->get_next_color(ci); \ + p_colr = Colorf_to_D3DCOLOR(p_color); \ + }} //////// - vi = geom->make_vertex_iterator(); - p_flags = D3DFVF_XYZ; - size_t vertex_size = sizeof(D3DVALUE) * 3; + vi = geom->make_vertex_iterator(); + p_flags = D3DFVF_XYZ; + size_t vertex_size = sizeof(D3DVALUE) * 3; - if ((geom->get_binding(G_COLOR) != G_OFF) || _issued_color_enabled) { - ci = geom->make_color_iterator(); - p_flags |= D3DFVF_DIFFUSE; - vertex_size += sizeof(D3DCOLOR); + if ((geom->get_binding(G_COLOR) != G_OFF) || _issued_color_enabled) { + ci = geom->make_color_iterator(); + p_flags |= D3DFVF_DIFFUSE; + vertex_size += sizeof(D3DCOLOR); - if (geom->get_binding(G_COLOR) == G_OVERALL) { - GET_NEXT_COLOR(); - } + if (geom->get_binding(G_COLOR) == G_OVERALL) { + GET_NEXT_COLOR(); + } - if (_issued_color_enabled) { - p_colr = _issued_color; // set primitive color if there is one. - perVertex &= ~PER_COLOR; - perPrim &= ~PER_COLOR; - perComp &= ~PER_COLOR; - } - } + if (_issued_color_enabled) { + p_colr = _issued_color; // set primitive color if there is one. + perVertex &= ~PER_COLOR; + perPrim &= ~PER_COLOR; + perComp &= ~PER_COLOR; + } + } - if (geom->get_binding(G_NORMAL) != G_OFF) { - ni = geom->make_normal_iterator(); - p_flags |= D3DFVF_NORMAL; - vertex_size += sizeof(D3DVALUE) * 3; + if (geom->get_binding(G_NORMAL) != G_OFF) { + ni = geom->make_normal_iterator(); + p_flags |= D3DFVF_NORMAL; + vertex_size += sizeof(D3DVALUE) * 3; - if (geom->get_binding(G_NORMAL) == G_OVERALL) - p_normal = geom->get_next_normal(ni); // set overall normal if there is one - } + if (geom->get_binding(G_NORMAL) == G_OVERALL) + p_normal = geom->get_next_normal(ni); // set overall normal if there is one + } - if (geom->get_binding(G_TEXCOORD) != G_OFF) { - ti = geom->make_texcoord_iterator(); - p_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); - vertex_size += sizeof(float) * 2; - } + if (geom->get_binding(G_TEXCOORD) != G_OFF) { + ti = geom->make_texcoord_iterator(); + p_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); + vertex_size += sizeof(float) * 2; + } - // If we have per-vertex colors or normals, we need smooth shading. - // Otherwise we want flat shading for performance reasons. - if (perVertex & ((wants_colors() ? PER_COLOR : 0) | (wants_normals() ? PER_NORMAL : 0))) - set_shademode(D3DSHADE_GOURAUD); - else set_shademode(D3DSHADE_FLAT); + // If we have per-vertex colors or normals, we need smooth shading. + // Otherwise we want flat shading for performance reasons. + if (perVertex & ((wants_colors() ? PER_COLOR : 0) | (wants_normals() ? PER_NORMAL : 0))) + set_shademode(D3DSHADE_GOURAUD); + else set_shademode(D3DSHADE_FLAT); - return vertex_size; + return vertex_size; } //////////////////////////////////////////////////////////////////// @@ -1145,56 +1145,56 @@ draw_prim_setup(const Geom *geom) { void DXGraphicsStateGuardian:: draw_prim_inner_loop(int nVerts, const Geom *geom, DWORD perFlags) { - for(;nVerts > 0;nVerts--) { + for(;nVerts > 0;nVerts--) { - GET_NEXT_VERTEX(); // coord info will always be perVertex + GET_NEXT_VERTEX(); // coord info will always be perVertex - switch (perFlags) { - case 0x3: - GET_NEXT_NORMAL(); - case 0x1: - break; - case 0x5: - case 0x4: - GET_NEXT_COLOR(); - break; - case 0x7: - case 0x6: - GET_NEXT_COLOR(); - case 0x2: - GET_NEXT_NORMAL(); - break; - case 0x9: - case 0x8: - GET_NEXT_TEXCOORD(); - break; - case 0xB: - case 0xA: - GET_NEXT_NORMAL(); - GET_NEXT_TEXCOORD(); - break; - case 0xD: - case 0xC: - GET_NEXT_COLOR(); - GET_NEXT_TEXCOORD(); - break; - case 0xF: - case 0xE: - GET_NEXT_NORMAL(); - GET_NEXT_COLOR(); - GET_NEXT_TEXCOORD(); - break; - } + switch (perFlags) { + case 0x3: + GET_NEXT_NORMAL(); + case 0x1: + break; + case 0x5: + case 0x4: + GET_NEXT_COLOR(); + break; + case 0x7: + case 0x6: + GET_NEXT_COLOR(); + case 0x2: + GET_NEXT_NORMAL(); + break; + case 0x9: + case 0x8: + GET_NEXT_TEXCOORD(); + break; + case 0xB: + case 0xA: + GET_NEXT_NORMAL(); + GET_NEXT_TEXCOORD(); + break; + case 0xD: + case 0xC: + GET_NEXT_COLOR(); + GET_NEXT_TEXCOORD(); + break; + case 0xF: + case 0xE: + GET_NEXT_NORMAL(); + GET_NEXT_COLOR(); + GET_NEXT_TEXCOORD(); + break; + } - add_to_FVFBuf((void *)&p_vertex, sizeof(D3DVECTOR)); + add_to_FVFBuf((void *)&p_vertex, sizeof(D3DVECTOR)); - if (p_flags & D3DFVF_NORMAL) - add_to_FVFBuf((void *)&p_normal, sizeof(D3DVECTOR)); - if (p_flags & D3DFVF_DIFFUSE) - add_DWORD_to_FVFBuf(p_colr); - if (p_flags & D3DFVF_TEXCOUNT_MASK) - add_to_FVFBuf((void *)&p_texcoord, sizeof(TexCoordf)); - } + if (p_flags & D3DFVF_NORMAL) + add_to_FVFBuf((void *)&p_normal, sizeof(D3DVECTOR)); + if (p_flags & D3DFVF_DIFFUSE) + add_DWORD_to_FVFBuf(p_colr); + if (p_flags & D3DFVF_TEXCOUNT_MASK) + add_to_FVFBuf((void *)&p_texcoord, sizeof(TexCoordf)); + } } //////////////////////////////////////////////////////////////////// @@ -1204,141 +1204,141 @@ draw_prim_inner_loop(int nVerts, const Geom *geom, DWORD perFlags) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_point(const GeomPoint *geom) { - activate(); + activate(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_point()" << endl; + dxgsg_cat.debug() << "draw_point()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); - // The DX Way + // The DX Way - int nPrims = geom->get_num_prims(); + int nPrims = geom->get_num_prims(); - if (nPrims==0) { - dxgsg_cat.warning() << "draw_point() called with ZERO vertices!!" << endl; - return; - } + if (nPrims==0) { + dxgsg_cat.warning() << "draw_point() called with ZERO vertices!!" << endl; + return; + } #ifdef _DEBUG - static BOOL bPrintedMsg=FALSE; + static BOOL bPrintedMsg=FALSE; - if (!bPrintedMsg && (geom->get_size()!=1.0f)) { - bPrintedMsg=TRUE; - dxgsg_cat.warning() << "D3D does not support drawing points of non-unit size, setting point size to 1.0f!\n"; - } + if (!bPrintedMsg && (geom->get_size()!=1.0f)) { + bPrintedMsg=TRUE; + dxgsg_cat.warning() << "D3D does not support drawing points of non-unit size, setting point size to 1.0f!\n"; + } #endif - nassertv(nPrims < D3DMAXNUMVERTICES ); + nassertv(nPrims < D3DMAXNUMVERTICES ); - PTA_Vertexf coords; - PTA_Normalf norms; - PTA_Colorf colors; - PTA_TexCoordf texcoords; - GeomBindType bind; - PTA_ushort vindexes,nindexes,tindexes,cindexes; + PTA_Vertexf coords; + PTA_Normalf norms; + PTA_Colorf colors; + PTA_TexCoordf texcoords; + GeomBindType bind; + PTA_ushort vindexes,nindexes,tindexes,cindexes; - geom->get_coords(coords,bind,vindexes); - geom->get_normals(norms,bind,nindexes); - geom->get_colors(colors,bind,cindexes); - geom->get_texcoords(texcoords,bind,tindexes); + geom->get_coords(coords,bind,vindexes); + geom->get_normals(norms,bind,nindexes); + geom->get_colors(colors,bind,cindexes); + geom->get_texcoords(texcoords,bind,tindexes); - GeomVertFormat GeomVrtFmt=FlatVerts; + GeomVertFormat GeomVrtFmt=FlatVerts; - // first determine if we're indexed or non-indexed + // first determine if we're indexed or non-indexed - if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { - GeomVrtFmt=IndexedVerts; - } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) - GeomVrtFmt=MixedFmtVerts; + if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { + GeomVrtFmt=IndexedVerts; + } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) + GeomVrtFmt=MixedFmtVerts; #ifdef DONT_USE_DRAWPRIMSTRIDED - GeomVrtFmt=MixedFmtVerts; + GeomVrtFmt=MixedFmtVerts; #endif - // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline for now - // need to add code to handle fully indexed mode (and handle cases with index arrays of different lengths, - // values (may only be possible to handle certain cases without reverting to old pipeline) - if (GeomVrtFmt!=FlatVerts) { + // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline for now + // need to add code to handle fully indexed mode (and handle cases with index arrays of different lengths, + // values (may only be possible to handle certain cases without reverting to old pipeline) + if (GeomVrtFmt!=FlatVerts) { - perVertex = PER_COORD; - perPrim = 0; - if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; - if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; + perVertex = PER_COORD; + perPrim = 0; + if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; + if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. - nassertv(nPrims * vertex_size < VERT_BUFFER_SIZE); - _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + nassertv(nPrims * vertex_size < VERT_BUFFER_SIZE); + _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - // iterate through the point - draw_prim_inner_loop(nPrims, geom, perVertex | perPrim); + // iterate through the point + draw_prim_inner_loop(nPrims, geom, perVertex | perPrim); - HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_POINTLIST, p_flags, _pFvfBufBasePtr, nPrims, NULL); + HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_POINTLIST, p_flags, _pFvfBufBasePtr, nPrims, NULL); - #ifdef _DEBUG - if(FAILED(hr)) { - // loss of exclusive mode is not a real DrawPrim problem - HRESULT testcooplvl_hr = _pDD->TestCooperativeLevel(); - if((testcooplvl_hr != DDERR_NOEXCLUSIVEMODE)||(testcooplvl_hr != DDERR_EXCLUSIVEMODEALREADYSET)) { - dxgsg_cat.fatal() << "DrawPrim failed: result = " << ConvD3DErrorToString(hr) << endl; - } - exit(1); - } - #endif - } else { // setup for strided + #ifdef _DEBUG + if(FAILED(hr)) { + // loss of exclusive mode is not a real DrawPrim problem + HRESULT testcooplvl_hr = _pDD->TestCooperativeLevel(); + if((testcooplvl_hr != DDERR_NOEXCLUSIVEMODE)||(testcooplvl_hr != DDERR_EXCLUSIVEMODEALREADYSET)) { + dxgsg_cat.fatal() << "DrawPrim failed: result = " << ConvD3DErrorToString(hr) << endl; + } + exit(1); + } + #endif + } else { // setup for strided - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - // new code only handles non-indexed pointlists (is this enough?) - nassertv((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL)); + // new code only handles non-indexed pointlists (is this enough?) + nassertv((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL)); - D3DDRAWPRIMITIVESTRIDEDDATA dps_data; - memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); + D3DDRAWPRIMITIVESTRIDEDDATA dps_data; + memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); - dps_data.position.lpvData = (VOID*)coords; - dps_data.position.dwStride = sizeof(D3DVECTOR); + dps_data.position.lpvData = (VOID*)coords; + dps_data.position.dwStride = sizeof(D3DVECTOR); - if (p_flags & D3DFVF_NORMAL) { - dps_data.normal.lpvData = (VOID*)norms; - dps_data.normal.dwStride = sizeof(D3DVECTOR); - } + if (p_flags & D3DFVF_NORMAL) { + dps_data.normal.lpvData = (VOID*)norms; + dps_data.normal.dwStride = sizeof(D3DVECTOR); + } - if (p_flags & D3DFVF_DIFFUSE) { - _pCurFvfBufPtr=_pFvfBufBasePtr; + if (p_flags & D3DFVF_DIFFUSE) { + _pCurFvfBufPtr=_pFvfBufBasePtr; - dps_data.diffuse.lpvData = (VOID*)_pFvfBufBasePtr; - dps_data.diffuse.dwStride = sizeof(D3DCOLOR); + dps_data.diffuse.lpvData = (VOID*)_pFvfBufBasePtr; + dps_data.diffuse.dwStride = sizeof(D3DCOLOR); - // Geom nodes store floats for colors, drawprim requires ARGB dwords - // BUGBUG: eventually this hack every-frame all-colors conversion needs - // to be done only once as part of a vertex buffer - - if(_color_transform_enabled || _alpha_transform_enabled) { - for (int i=0;iDrawPrimitiveStrided(D3DPT_POINTLIST, p_flags, &dps_data, nPrims, NULL); - TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); - } + if (p_flags & D3DFVF_TEXCOUNT_MASK) { + dps_data.textureCoords[0].lpvData = (VOID*)texcoords; + dps_data.textureCoords[0].dwStride = sizeof(TexCoordf); + } - _pCurFvfBufPtr = NULL; + HRESULT hr = _d3dDevice->DrawPrimitiveStrided(D3DPT_POINTLIST, p_flags, &dps_data, nPrims, NULL); + TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); + } + + _pCurFvfBufPtr = NULL; } //////////////////////////////////////////////////////////////////// @@ -1348,106 +1348,106 @@ draw_point(const GeomPoint *geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_line(const GeomLine* geom) { - activate(); + activate(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_line()" << endl; + dxgsg_cat.debug() << "draw_line()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); #ifdef _DEBUG - static BOOL bPrintedMsg=FALSE; + static BOOL bPrintedMsg=FALSE; - if (!bPrintedMsg && (geom->get_width()!=1.0f)) { - bPrintedMsg=TRUE; - dxgsg_cat.warning() << "DX does not support drawing lines with a non-1.0f pixel width, setting width to 1.0f!\n"; - } + if (!bPrintedMsg && (geom->get_width()!=1.0f)) { + bPrintedMsg=TRUE; + dxgsg_cat.warning() << "DX does not support drawing lines with a non-1.0f pixel width, setting width to 1.0f!\n"; + } #endif #ifdef WBD_GL_MODE - call_glLineWidth(geom->get_width()); + call_glLineWidth(geom->get_width()); - int nprims = geom->get_num_prims(); - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::ColorIterator ci = geom->make_color_iterator(); + int nprims = geom->get_num_prims(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::ColorIterator ci = geom->make_color_iterator(); - GeomIssuer issuer(geom, this, - issue_vertex_gl, - issue_normal_gl, - issue_texcoord_gl, - issue_color_gl); + GeomIssuer issuer(geom, this, + issue_vertex_gl, + issue_normal_gl, + issue_texcoord_gl, + issue_color_gl); - if (geom->get_binding(G_COLOR) == G_PER_VERTEX) { - call_glShadeModel(GL_SMOOTH); - } else { - call_glShadeModel(GL_FLAT); - } + if (geom->get_binding(G_COLOR) == G_PER_VERTEX) { + call_glShadeModel(GL_SMOOTH); + } else { + call_glShadeModel(GL_FLAT); + } - // Draw overall - issuer.issue_color(G_OVERALL, ci); + // Draw overall + issuer.issue_color(G_OVERALL, ci); - glBegin(GL_LINES); + glBegin(GL_LINES); - for (int i = 0; i < nprims; i++) { - // Draw per primitive - issuer.issue_color(G_PER_PRIM, ci); + for (int i = 0; i < nprims; i++) { + // Draw per primitive + issuer.issue_color(G_PER_PRIM, ci); - for (int j = 0; j < 2; j++) { - // Draw per vertex - issuer.issue_color(G_PER_VERTEX, ci); - issuer.issue_vertex(G_PER_VERTEX, vi); - } - } + for (int j = 0; j < 2; j++) { + // Draw per vertex + issuer.issue_color(G_PER_VERTEX, ci); + issuer.issue_vertex(G_PER_VERTEX, vi); + } + } - glEnd(); + glEnd(); #else // the DX way - int nPrims = geom->get_num_prims(); + int nPrims = geom->get_num_prims(); - if (nPrims==0) { - dxgsg_cat.warning() << "draw_line() called with ZERO vertices!!" << endl; - return; - } + if (nPrims==0) { + dxgsg_cat.warning() << "draw_line() called with ZERO vertices!!" << endl; + return; + } - perVertex = 0; - if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; - if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; + perVertex = 0; + if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; + if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; - perPrim = 0; - if (geom->get_binding(G_NORMAL) == G_PER_PRIM) perPrim |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_PRIM) perPrim |= PER_COLOR; + perPrim = 0; + if (geom->get_binding(G_NORMAL) == G_PER_PRIM) perPrim |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_PRIM) perPrim |= PER_COLOR; - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - char *_tmp_fvf = NULL; - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + char *_tmp_fvf = NULL; + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. // nassertv(nPrims * 2 * vertex_size < VERT_BUFFER_SIZE); - if (nPrims * 2 * vertex_size > VERT_BUFFER_SIZE) { - _pCurFvfBufPtr = _tmp_fvf = new char[nPrims * 2 * vertex_size]; - } else _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + if (nPrims * 2 * vertex_size > VERT_BUFFER_SIZE) { + _pCurFvfBufPtr = _tmp_fvf = new char[nPrims * 2 * vertex_size]; + } else _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - for (int i = 0; i < nPrims; i++) { - if (perPrim & PER_COLOR) { - GET_NEXT_COLOR(); - } - if (perPrim & PER_NORMAL) - p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. - draw_prim_inner_loop(2, geom, perVertex); - } + for (int i = 0; i < nPrims; i++) { + if (perPrim & PER_COLOR) { + GET_NEXT_COLOR(); + } + if (perPrim & PER_NORMAL) + p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. + draw_prim_inner_loop(2, geom, perVertex); + } - HRESULT hr; + HRESULT hr; - if (_tmp_fvf == NULL) - hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, p_flags, _pFvfBufBasePtr, nPrims*2, NULL); - else { - hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, p_flags, _tmp_fvf, nPrims*2, NULL); - delete [] _tmp_fvf; - } - TestDrawPrimFailure(DrawPrim,hr,_pDD); + if (_tmp_fvf == NULL) + hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, p_flags, _pFvfBufBasePtr, nPrims*2, NULL); + else { + hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, p_flags, _tmp_fvf, nPrims*2, NULL); + delete [] _tmp_fvf; + } + TestDrawPrimFailure(DrawPrim,hr,_pDD); - _pCurFvfBufPtr = NULL; + _pCurFvfBufPtr = NULL; #endif // WBD_GL_MODE } @@ -1459,119 +1459,119 @@ draw_line(const GeomLine* geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_linestrip(const GeomLinestrip* geom) { - activate(); + activate(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_linestrip()" << endl; + dxgsg_cat.debug() << "draw_linestrip()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); #ifdef _DEBUG - static BOOL bPrintedMsg=FALSE; + static BOOL bPrintedMsg=FALSE; - if (!bPrintedMsg && (geom->get_width()!=1.0f)) { - bPrintedMsg=TRUE; - dxgsg_cat.warning() << "DX does not support drawing lines with a non-1.0f pixel width, setting width to 1.0f!\n"; - } + if (!bPrintedMsg && (geom->get_width()!=1.0f)) { + bPrintedMsg=TRUE; + dxgsg_cat.warning() << "DX does not support drawing lines with a non-1.0f pixel width, setting width to 1.0f!\n"; + } #endif #ifdef WBD_GL_MODE - call_glLineWidth(geom->get_width()); + call_glLineWidth(geom->get_width()); - int nprims = geom->get_num_prims(); - const int *plen = geom->get_lengths(); - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::ColorIterator ci = geom->make_color_iterator(); + int nprims = geom->get_num_prims(); + const int *plen = geom->get_lengths(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::ColorIterator ci = geom->make_color_iterator(); - GeomIssuer issuer(geom, this, - issue_vertex_gl, - issue_normal_gl, - issue_texcoord_gl, - issue_color_gl); + GeomIssuer issuer(geom, this, + issue_vertex_gl, + issue_normal_gl, + issue_texcoord_gl, + issue_color_gl); - if (geom->get_binding(G_COLOR) == G_PER_VERTEX) { - call_glShadeModel(GL_SMOOTH); - } else { - call_glShadeModel(GL_FLAT); - } + if (geom->get_binding(G_COLOR) == G_PER_VERTEX) { + call_glShadeModel(GL_SMOOTH); + } else { + call_glShadeModel(GL_FLAT); + } - // Draw overall - issuer.issue_color(G_OVERALL, ci); + // Draw overall + issuer.issue_color(G_OVERALL, ci); - for (int i = 0; i < nprims; i++) { - // Draw per primitive - issuer.issue_color(G_PER_PRIM, ci); + for (int i = 0; i < nprims; i++) { + // Draw per primitive + issuer.issue_color(G_PER_PRIM, ci); - int num_verts = *(plen++); - nassertv(num_verts >= 2); + int num_verts = *(plen++); + nassertv(num_verts >= 2); - glBegin(GL_LINE_STRIP); + glBegin(GL_LINE_STRIP); - // Per-component attributes for the first line segment? - issuer.issue_color(G_PER_COMPONENT, ci); + // Per-component attributes for the first line segment? + issuer.issue_color(G_PER_COMPONENT, ci); - // Draw the first 2 vertices - int v; - for (v = 0; v < 2; v++) { - issuer.issue_color(G_PER_VERTEX, ci); - issuer.issue_vertex(G_PER_VERTEX, vi); - } + // Draw the first 2 vertices + int v; + for (v = 0; v < 2; v++) { + issuer.issue_color(G_PER_VERTEX, ci); + issuer.issue_vertex(G_PER_VERTEX, vi); + } - // Now draw each of the remaining vertices. Each vertex from - // this point on defines a new line segment. - for (v = 2; v < num_verts; v++) { - // Per-component attributes? - issuer.issue_color(G_PER_COMPONENT, ci); + // Now draw each of the remaining vertices. Each vertex from + // this point on defines a new line segment. + for (v = 2; v < num_verts; v++) { + // Per-component attributes? + issuer.issue_color(G_PER_COMPONENT, ci); - // Per-vertex attributes - issuer.issue_color(G_PER_VERTEX, ci); - issuer.issue_vertex(G_PER_VERTEX, vi); - } - glEnd(); - } + // Per-vertex attributes + issuer.issue_color(G_PER_VERTEX, ci); + issuer.issue_vertex(G_PER_VERTEX, vi); + } + glEnd(); + } #else - int nPrims = geom->get_num_prims(); - const int *plen = geom->get_lengths(); + int nPrims = geom->get_num_prims(); + const int *plen = geom->get_lengths(); - if (nPrims==0) { - dxgsg_cat.warning() << "draw_linestrip() called with ZERO vertices!!" << endl; - return; - } + if (nPrims==0) { + dxgsg_cat.warning() << "draw_linestrip() called with ZERO vertices!!" << endl; + return; + } - perVertex = 0; - if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; - if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; + perVertex = 0; + if (geom->get_binding(G_COORD) == G_PER_VERTEX) perVertex |= PER_COORD; + if (geom->get_binding(G_NORMAL) == G_PER_VERTEX) perVertex |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_VERTEX) perVertex |= PER_COLOR; - perComp = 0; - if (geom->get_binding(G_NORMAL) == G_PER_COMPONENT) perComp |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_COMPONENT) perComp |= PER_COLOR; + perComp = 0; + if (geom->get_binding(G_NORMAL) == G_PER_COMPONENT) perComp |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_COMPONENT) perComp |= PER_COLOR; - perPrim = 0; - if (geom->get_binding(G_NORMAL) == G_PER_PRIM) perPrim |= PER_NORMAL; - if (geom->get_binding(G_COLOR) == G_PER_PRIM) perPrim |= PER_COLOR; + perPrim = 0; + if (geom->get_binding(G_NORMAL) == G_PER_PRIM) perPrim |= PER_NORMAL; + if (geom->get_binding(G_COLOR) == G_PER_PRIM) perPrim |= PER_COLOR; - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - for (int i = 0; i < nPrims; i++) { - if (perPrim & PER_COLOR) { - GET_NEXT_COLOR(); - } + for (int i = 0; i < nPrims; i++) { + if (perPrim & PER_COLOR) { + GET_NEXT_COLOR(); + } - int nVerts = *(plen++); - nassertv(nVerts >= 2); + int nVerts = *(plen++); + nassertv(nVerts >= 2); - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. - nassertv(nVerts * vertex_size < VERT_BUFFER_SIZE); - _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + nassertv(nVerts * vertex_size < VERT_BUFFER_SIZE); + _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - draw_prim_inner_loop(nVerts, geom, perVertex | perComp); + draw_prim_inner_loop(nVerts, geom, perVertex | perComp); - HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_LINESTRIP, p_flags, _pFvfBufBasePtr, nVerts, NULL); - TestDrawPrimFailure(DrawPrim,hr,_pDD); + HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_LINESTRIP, p_flags, _pFvfBufBasePtr, nVerts, NULL); + TestDrawPrimFailure(DrawPrim,hr,_pDD); - _pCurFvfBufPtr = NULL; - } + _pCurFvfBufPtr = NULL; + } #endif // WBD_GL_MODE @@ -1583,31 +1583,31 @@ draw_linestrip(const GeomLinestrip* geom) { // each vertex may or may not have corresponding information in the // x/y texel-world-ratio and rotation arrays. typedef struct { - Vertexf _v; - D3DCOLOR _c; - float _x_ratio; - float _y_ratio; - float _theta; + Vertexf _v; + D3DCOLOR _c; + float _x_ratio; + float _y_ratio; + float _theta; } WrappedSprite; class WrappedSpriteSortPtr { public: - float z; - WrappedSprite *pSpr; + float z; + WrappedSprite *pSpr; }; // this struct exists because the STL can sort faster than i can. struct draw_sprite_vertex_less { - INLINE bool operator ()(const WrappedSpriteSortPtr& v0, - const WrappedSpriteSortPtr& v1) const { - return v0.z > v1.z; // reversed from gl - } + INLINE bool operator ()(const WrappedSpriteSortPtr& v0, + const WrappedSpriteSortPtr& v1) const { + return v0.z > v1.z; // reversed from gl + } }; /* struct draw_sprite_vertex_less { INLINE bool operator ()(const WrappedSprite& v0, - const WrappedSprite& v1) const { - return v0._v[2] > v1._v[2]; // reversed from gl + const WrappedSprite& v1) const { + return v0._v[2] > v1._v[2]; // reversed from gl } }; */ @@ -1620,320 +1620,320 @@ struct draw_sprite_vertex_less { void DXGraphicsStateGuardian:: draw_sprite(const GeomSprite *geom) { - // this is a little bit of a mess, but it's ok. Here's the deal: - // we want to draw, and draw quickly, an arbitrarily large number - // of sprites all facing the screen. Performing the billboard math - // for ~1000 sprites is way too slow. Ideally, we want one - // matrix transformation that will handle everything, and this is - // just about what ends up happening. We're getting the front-facing - // effect by setting up a new frustum (of the same z-depth as the - // current one) that is very small in x and y. This way regularly - // rendered triangles that might not be EXACTLY facing the camera - // will certainly look close enough. Then, we transform to camera-space - // by hand and apply the inverse frustum to the transformed point. - // For some cracked out reason, this actually works. + // this is a little bit of a mess, but it's ok. Here's the deal: + // we want to draw, and draw quickly, an arbitrarily large number + // of sprites all facing the screen. Performing the billboard math + // for ~1000 sprites is way too slow. Ideally, we want one + // matrix transformation that will handle everything, and this is + // just about what ends up happening. We're getting the front-facing + // effect by setting up a new frustum (of the same z-depth as the + // current one) that is very small in x and y. This way regularly + // rendered triangles that might not be EXACTLY facing the camera + // will certainly look close enough. Then, we transform to camera-space + // by hand and apply the inverse frustum to the transformed point. + // For some cracked out reason, this actually works. - // Note: for DX8, try to use the PointSprite primitive instead of doing all the stuff below + // Note: for DX8, try to use the PointSprite primitive instead of doing all the stuff below #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_sprite()" << endl; + dxgsg_cat.debug() << "draw_sprite()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); - Texture *tex = geom->get_texture(); - nassertv(tex != (Texture *) NULL); + Texture *tex = geom->get_texture(); + nassertv(tex != (Texture *) NULL); - // get the array traversal set up. - int nprims = geom->get_num_prims(); + // get the array traversal set up. + int nprims = geom->get_num_prims(); - if (nprims==0) { - dxgsg_cat.warning() << "draw_sprite() called with ZERO vertices!!" << endl; - return; - } + if (nprims==0) { + dxgsg_cat.warning() << "draw_sprite() called with ZERO vertices!!" << endl; + return; + } - D3DMATRIX OldD3DWorldMatrix; - _d3dDevice->GetTransform(D3DTRANSFORMSTATE_WORLD, &OldD3DWorldMatrix); + D3DMATRIX OldD3DWorldMatrix; + _d3dDevice->GetTransform(D3DTRANSFORMSTATE_WORLD, &OldD3DWorldMatrix); - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::ColorIterator ci = geom->make_color_iterator(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::ColorIterator ci = geom->make_color_iterator(); - // save the modelview matrix - LMatrix4f modelview_mat; + // save the modelview matrix + LMatrix4f modelview_mat; - const TransformAttribute *ctatt; - if (!get_attribute_into(ctatt, _state, TransformTransition::get_class_type())) - modelview_mat = LMatrix4f::ident_mat(); - else - modelview_mat = ctatt->get_matrix(); + const TransformAttribute *ctatt; + if (!get_attribute_into(ctatt, _state, TransformTransition::get_class_type())) + modelview_mat = LMatrix4f::ident_mat(); + else + modelview_mat = ctatt->get_matrix(); - // get the camera information - float aspect_ratio; - aspect_ratio = _actual_display_region->get_camera()->get_aspect(); + // get the camera information + float aspect_ratio; + aspect_ratio = _actual_display_region->get_camera()->get_aspect(); - // null the world xform, so sprites are orthog to scrn (but not necessarily camera pntm unless they lie along z-axis) - _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &matIdentity); - // only need to change _WORLD xform, _VIEW xform is Identity + // null the world xform, so sprites are orthog to scrn (but not necessarily camera pntm unless they lie along z-axis) + _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &matIdentity); + // only need to change _WORLD xform, _VIEW xform is Identity - // precomputation stuff - float half_width = 0.5f * (float) tex->_pbuffer->get_xsize(); - float half_height = 0.5f * (float) tex->_pbuffer->get_ysize(); - float scaled_width, scaled_height; + // precomputation stuff + float half_width = 0.5f * (float) tex->_pbuffer->get_xsize(); + float half_height = 0.5f * (float) tex->_pbuffer->get_ysize(); + float scaled_width, scaled_height; - // set up the texture-rendering state - NodeAttributes state; + // set up the texture-rendering state + NodeAttributes state; - // this sets up texturing. Could just set the renderstates directly, but this is a little cleaner - TextureAttribute *ta = new TextureAttribute; - ta->set_on(tex); - state.set_attribute(TextureTransition::get_class_type(), ta); + // this sets up texturing. Could just set the renderstates directly, but this is a little cleaner + TextureAttribute *ta = new TextureAttribute; + ta->set_on(tex); + state.set_attribute(TextureTransition::get_class_type(), ta); - TextureApplyAttribute *taa = new TextureApplyAttribute; - taa->set_mode(TextureApplyProperty::M_modulate); - state.set_attribute(TextureApplyTransition::get_class_type(), taa); + TextureApplyAttribute *taa = new TextureApplyAttribute; + taa->set_mode(TextureApplyProperty::M_modulate); + state.set_attribute(TextureApplyTransition::get_class_type(), taa); - set_state(state, false); + set_state(state, false); - // the user can override alpha sorting if they want - bool alpha = false; + // the user can override alpha sorting if they want + bool alpha = false; - if (geom->get_alpha_disable() == false) { - // figure out if alpha's enabled (if not, no reason to sort) - const TransparencyAttribute *ctratt; - if (get_attribute_into(ctratt, _state, TransparencyTransition::get_class_type())) - alpha = true; - } + if (geom->get_alpha_disable() == false) { + // figure out if alpha's enabled (if not, no reason to sort) + const TransparencyAttribute *ctratt; + if (get_attribute_into(ctratt, _state, TransparencyTransition::get_class_type())) + alpha = true; + } - // inner loop vars - int i; - Vertexf source_vert, cameraspace_vert; - float *x_walk, *y_walk, *theta_walk; - float theta; + // inner loop vars + int i; + Vertexf source_vert, cameraspace_vert; + float *x_walk, *y_walk, *theta_walk; + float theta; - nassertv(geom->get_x_bind_type() != G_PER_VERTEX); - nassertv(geom->get_y_bind_type() != G_PER_VERTEX); + nassertv(geom->get_x_bind_type() != G_PER_VERTEX); + nassertv(geom->get_y_bind_type() != G_PER_VERTEX); - // set up the non-built-in bindings - bool x_overall = (geom->get_x_bind_type() == G_OVERALL); - bool y_overall = (geom->get_y_bind_type() == G_OVERALL); - bool theta_overall = (geom->get_theta_bind_type() == G_OVERALL); - bool color_overall = (geom->get_binding(G_COLOR) == G_OVERALL); - bool theta_on = !(geom->get_theta_bind_type() == G_OFF); + // set up the non-built-in bindings + bool x_overall = (geom->get_x_bind_type() == G_OVERALL); + bool y_overall = (geom->get_y_bind_type() == G_OVERALL); + bool theta_overall = (geom->get_theta_bind_type() == G_OVERALL); + bool color_overall = (geom->get_binding(G_COLOR) == G_OVERALL); + bool theta_on = !(geom->get_theta_bind_type() == G_OFF); - // x direction - if (x_overall == true) - scaled_width = geom->_x_texel_ratio[0] * half_width; - else { - nassertv(((int)geom->_x_texel_ratio.size() >= geom->get_num_prims())); - x_walk = &geom->_x_texel_ratio[0]; - } + // x direction + if (x_overall == true) + scaled_width = geom->_x_texel_ratio[0] * half_width; + else { + nassertv(((int)geom->_x_texel_ratio.size() >= geom->get_num_prims())); + x_walk = &geom->_x_texel_ratio[0]; + } - // y direction - if (y_overall == true) - scaled_height = geom->_y_texel_ratio[0] * half_height * aspect_ratio; - else { - nassertv(((int)geom->_y_texel_ratio.size() >= geom->get_num_prims())); - y_walk = &geom->_y_texel_ratio[0]; - } + // y direction + if (y_overall == true) + scaled_height = geom->_y_texel_ratio[0] * half_height * aspect_ratio; + else { + nassertv(((int)geom->_y_texel_ratio.size() >= geom->get_num_prims())); + y_walk = &geom->_y_texel_ratio[0]; + } - // theta - if (theta_on) { - if (theta_overall == true) - theta = geom->_theta[0]; - else { - nassertv(((int)geom->_theta.size() >= geom->get_num_prims())); - theta_walk = &geom->_theta[0]; - } - } + // theta + if (theta_on) { + if (theta_overall == true) + theta = geom->_theta[0]; + else { + nassertv(((int)geom->_theta.size() >= geom->get_num_prims())); + theta_walk = &geom->_theta[0]; + } + } - ///////////////////////////////////////////////////////////////////// - // INNER LOOP PART 1 STARTS HERE - // Here we transform each point to cameraspace and fill our sort - // vector with the final geometric information. - ///////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////// + // INNER LOOP PART 1 STARTS HERE + // Here we transform each point to cameraspace and fill our sort + // vector with the final geometric information. + ///////////////////////////////////////////////////////////////////// - Colorf v_color; + Colorf v_color; - // sort container and iterator - vector< WrappedSpriteSortPtr > sorted_sprite_vector; - vector< WrappedSpriteSortPtr >::iterator sorted_vec_iter; + // sort container and iterator + vector< WrappedSpriteSortPtr > sorted_sprite_vector; + vector< WrappedSpriteSortPtr >::iterator sorted_vec_iter; - WrappedSprite *SpriteArray = new WrappedSprite[nprims]; + WrappedSprite *SpriteArray = new WrappedSprite[nprims]; - //BUGBUG: could we use _fvfbuf for this to avoid perframe alloc? - // alternately, alloc once when retained mode becomes available + //BUGBUG: could we use _fvfbuf for this to avoid perframe alloc? + // alternately, alloc once when retained mode becomes available - if (SpriteArray==NULL) { - dxgsg_cat.fatal() << "draw_sprite() out of memory!!" << endl; - return; - } + if (SpriteArray==NULL) { + dxgsg_cat.fatal() << "draw_sprite() out of memory!!" << endl; + return; + } - // the state is set, start running the prims + // the state is set, start running the prims - WrappedSprite *pSpr; + WrappedSprite *pSpr; - for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { + for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { - source_vert = geom->get_next_vertex(vi); - cameraspace_vert = source_vert * modelview_mat; + source_vert = geom->get_next_vertex(vi); + cameraspace_vert = source_vert * modelview_mat; - pSpr->_v.set(cameraspace_vert[0],cameraspace_vert[1],cameraspace_vert[2]); + pSpr->_v.set(cameraspace_vert[0],cameraspace_vert[1],cameraspace_vert[2]); - if (color_overall == false) { - GET_NEXT_COLOR(); - pSpr->_c = p_colr; - } - if (x_overall == false) - pSpr->_x_ratio = *x_walk++; - if (y_overall == false) - pSpr->_y_ratio = *y_walk++; // go along array of ratio values stored in geom - if (theta_on && (theta_overall == false)) - pSpr->_theta = *theta_walk++; - } + if (color_overall == false) { + GET_NEXT_COLOR(); + pSpr->_c = p_colr; + } + if (x_overall == false) + pSpr->_x_ratio = *x_walk++; + if (y_overall == false) + pSpr->_y_ratio = *y_walk++; // go along array of ratio values stored in geom + if (theta_on && (theta_overall == false)) + pSpr->_theta = *theta_walk++; + } - if (alpha) { - sorted_sprite_vector.reserve(nprims); //pre-alloc space for nprims + if (alpha) { + sorted_sprite_vector.reserve(nprims); //pre-alloc space for nprims - for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { // build STL-sortable array - WrappedSpriteSortPtr ws_ptr; - ws_ptr.z=pSpr->_v[2]; - ws_ptr.pSpr=pSpr; - sorted_sprite_vector.push_back(ws_ptr); - } + for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { // build STL-sortable array + WrappedSpriteSortPtr ws_ptr; + ws_ptr.z=pSpr->_v[2]; + ws_ptr.pSpr=pSpr; + sorted_sprite_vector.push_back(ws_ptr); + } - // sort the verts properly by alpha (if necessary). Of course, - // the sort is only local, not scene-global, so if you look closely you'll - // notice that alphas may be screwy. It's ok though, because this is fast. - // if you want accuracy, use billboards and take the speed hit. + // sort the verts properly by alpha (if necessary). Of course, + // the sort is only local, not scene-global, so if you look closely you'll + // notice that alphas may be screwy. It's ok though, because this is fast. + // if you want accuracy, use billboards and take the speed hit. - sort(sorted_sprite_vector.begin(), sorted_sprite_vector.end(), draw_sprite_vertex_less()); + sort(sorted_sprite_vector.begin(), sorted_sprite_vector.end(), draw_sprite_vertex_less()); - sorted_vec_iter = sorted_sprite_vector.begin(); - } + sorted_vec_iter = sorted_sprite_vector.begin(); + } - Vertexf ul, ur, ll, lr; + Vertexf ul, ur, ll, lr; - //////////////////////////////////////////////////////////////////////////// - // INNER LOOP PART 2 STARTS HERE - // Now we run through the cameraspace vector and compute the geometry for each - // tristrip. This includes scaling as per the ratio arrays, as well as - // rotating in the z. - //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// + // INNER LOOP PART 2 STARTS HERE + // Now we run through the cameraspace vector and compute the geometry for each + // tristrip. This includes scaling as per the ratio arrays, as well as + // rotating in the z. + //////////////////////////////////////////////////////////////////////////// - p_flags = D3DFVF_XYZ | (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)) ; - DWORD vertex_size = sizeof(float) * 2 + sizeof(D3DVALUE) * 3; + p_flags = D3DFVF_XYZ | (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)) ; + DWORD vertex_size = sizeof(float) * 2 + sizeof(D3DVALUE) * 3; - D3DCOLOR CurColor; - bool bDoColor=TRUE; - if (color_overall == true) { - GET_NEXT_COLOR(); - CurColor = p_colr; - bDoColor = (p_colr != ~0); - } + D3DCOLOR CurColor; + bool bDoColor=TRUE; + if (color_overall == true) { + GET_NEXT_COLOR(); + CurColor = p_colr; + bDoColor = (p_colr != ~0); + } - if (bDoColor) { - p_flags |= D3DFVF_DIFFUSE; - vertex_size+=sizeof(D3DCOLOR); - } + if (bDoColor) { + p_flags |= D3DFVF_DIFFUSE; + vertex_size+=sizeof(D3DCOLOR); + } - #ifdef _DEBUG - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + #ifdef _DEBUG + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. nassertv(nprims * 4 * vertex_size < VERT_BUFFER_SIZE); - nassertv(nprims * 6 < D3DMAXNUMVERTICES ); - #endif + nassertv(nprims * 6 < D3DMAXNUMVERTICES ); + #endif - _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - const float TexCrdSets[4][2] = {{0.0f,0.0f},{1.0f,0.0f},{0.0f,1.0f},{1.0f,1.0f}}; + _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + const float TexCrdSets[4][2] = {{0.0f,0.0f},{1.0f,0.0f},{0.0f,1.0f},{1.0f,1.0f}}; #define QUADVERTLISTLEN 6 - DWORD QuadVertIndexList[QUADVERTLISTLEN] = { 0, 1, 2, 3, 2, 1}; - DWORD CurDPIndexArrLength=0,CurVertCount=0; + DWORD QuadVertIndexList[QUADVERTLISTLEN] = { 0, 1, 2, 3, 2, 1}; + DWORD CurDPIndexArrLength=0,CurVertCount=0; - for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { // build STL-sortable array + for (pSpr=SpriteArray,i = 0; i < nprims; i++,pSpr++) { // build STL-sortable array - if (alpha) { - pSpr = sorted_vec_iter->pSpr; - sorted_vec_iter++; - } + if (alpha) { + pSpr = sorted_vec_iter->pSpr; + sorted_vec_iter++; + } - // if not G_OVERALL, calculate the scale factors //huh?? - if (x_overall == false) - scaled_width = pSpr->_x_ratio * half_width; + // if not G_OVERALL, calculate the scale factors //huh?? + if (x_overall == false) + scaled_width = pSpr->_x_ratio * half_width; - if (y_overall == false) - scaled_height = pSpr->_y_ratio * half_height * aspect_ratio; + if (y_overall == false) + scaled_height = pSpr->_y_ratio * half_height * aspect_ratio; - // if not G_OVERALL, do some trig for this z rotate //what is the theta angle?? - if (theta_on) { - if (!theta_overall) - theta = pSpr->_theta; + // if not G_OVERALL, do some trig for this z rotate //what is the theta angle?? + if (theta_on) { + if (!theta_overall) + theta = pSpr->_theta; - // create the rotated points. BUGBUG: this matmult will be slow if we dont get inlining - // rotate_mat calls sin() on an unbounded val, possible to make it faster with lookup table (modulate to 0-360 range?) + // create the rotated points. BUGBUG: this matmult will be slow if we dont get inlining + // rotate_mat calls sin() on an unbounded val, possible to make it faster with lookup table (modulate to 0-360 range?) - LMatrix3f xform_mat = LMatrix3f::rotate_mat(theta) * - LMatrix3f::scale_mat(scaled_width, scaled_height); + LMatrix3f xform_mat = LMatrix3f::rotate_mat(theta) * + LMatrix3f::scale_mat(scaled_width, scaled_height); - ur = (LVector3f( 1.0f, 1.0f, 0.0f) * xform_mat) + pSpr->_v; - ul = (LVector3f(-1.0f, 1.0f, 0.0f) * xform_mat) + pSpr->_v; - lr = (LVector3f( 1.0f, -1.0f, 0.0f) * xform_mat) + pSpr->_v; - ll = (LVector3f(-1.0f, -1.0f, 0.0f) * xform_mat) + pSpr->_v; - } else { - // create points for unrotated rect sprites - float x,y,negx,negy,z; + ur = (LVector3f( 1.0f, 1.0f, 0.0f) * xform_mat) + pSpr->_v; + ul = (LVector3f(-1.0f, 1.0f, 0.0f) * xform_mat) + pSpr->_v; + lr = (LVector3f( 1.0f, -1.0f, 0.0f) * xform_mat) + pSpr->_v; + ll = (LVector3f(-1.0f, -1.0f, 0.0f) * xform_mat) + pSpr->_v; + } else { + // create points for unrotated rect sprites + float x,y,negx,negy,z; - x = pSpr->_v[0] + scaled_width; - y = pSpr->_v[1] + scaled_height; - negx = pSpr->_v[0] - scaled_width; - negy = pSpr->_v[1] - scaled_height; - z = pSpr->_v[2]; + x = pSpr->_v[0] + scaled_width; + y = pSpr->_v[1] + scaled_height; + negx = pSpr->_v[0] - scaled_width; + negy = pSpr->_v[1] - scaled_height; + z = pSpr->_v[2]; - ur.set(x, y, z); - ul.set(negx, y, z); - lr.set(x, negy, z); - ll.set(negx, negy, z); - } + ur.set(x, y, z); + ul.set(negx, y, z); + lr.set(x, negy, z); + ll.set(negx, negy, z); + } - add_to_FVFBuf((void *)ll.get_data(), sizeof(D3DVECTOR)); - if (bDoColor) { - if (!color_overall) // otherwise its already been set globally - CurColor = pSpr->_c; - add_DWORD_to_FVFBuf(CurColor); // only need to cpy color on 1st vert, others are just empty ignored space - } - add_to_FVFBuf((void *)TexCrdSets[0], sizeof(float)*2); + add_to_FVFBuf((void *)ll.get_data(), sizeof(D3DVECTOR)); + if (bDoColor) { + if (!color_overall) // otherwise its already been set globally + CurColor = pSpr->_c; + add_DWORD_to_FVFBuf(CurColor); // only need to cpy color on 1st vert, others are just empty ignored space + } + add_to_FVFBuf((void *)TexCrdSets[0], sizeof(float)*2); - add_to_FVFBuf((void *)lr.get_data(), sizeof(D3DVECTOR)); - if (bDoColor) - _pCurFvfBufPtr += sizeof(D3DCOLOR); // flat shading, dont need to write color, just incr ptr - add_to_FVFBuf((void *)TexCrdSets[1], sizeof(float)*2); + add_to_FVFBuf((void *)lr.get_data(), sizeof(D3DVECTOR)); + if (bDoColor) + _pCurFvfBufPtr += sizeof(D3DCOLOR); // flat shading, dont need to write color, just incr ptr + add_to_FVFBuf((void *)TexCrdSets[1], sizeof(float)*2); - add_to_FVFBuf((void *)ul.get_data(), sizeof(D3DVECTOR)); - if (bDoColor) - _pCurFvfBufPtr += sizeof(D3DCOLOR); // flat shading, dont need to write color, just incr ptr - add_to_FVFBuf((void *)TexCrdSets[2], sizeof(float)*2); + add_to_FVFBuf((void *)ul.get_data(), sizeof(D3DVECTOR)); + if (bDoColor) + _pCurFvfBufPtr += sizeof(D3DCOLOR); // flat shading, dont need to write color, just incr ptr + add_to_FVFBuf((void *)TexCrdSets[2], sizeof(float)*2); - add_to_FVFBuf((void *)ur.get_data(), sizeof(D3DVECTOR)); - if (bDoColor) - add_DWORD_to_FVFBuf(CurColor); - add_to_FVFBuf((void *)TexCrdSets[3], sizeof(float)*2); + add_to_FVFBuf((void *)ur.get_data(), sizeof(D3DVECTOR)); + if (bDoColor) + add_DWORD_to_FVFBuf(CurColor); + add_to_FVFBuf((void *)TexCrdSets[3], sizeof(float)*2); - for (int ii=0;iiDrawIndexedPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, 4*nprims, _index_buf,QUADVERTLISTLEN*nprims,NULL); + // cant do tristrip/fan since it would require 1 call want to make 1 call for multiple quads which arent connected + // best we can do is indexed primitive, which sends 2 redundant indices instead of sending 2 redundant full verts + _d3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, 4*nprims, _index_buf,QUADVERTLISTLEN*nprims,NULL); - _pCurFvfBufPtr = NULL; - delete [] SpriteArray; + _pCurFvfBufPtr = NULL; + delete [] SpriteArray; - // restore the matrices - _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &OldD3DWorldMatrix); + // restore the matrices + _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &OldD3DWorldMatrix); } //////////////////////////////////////////////////////////////////// @@ -1943,10 +1943,10 @@ draw_sprite(const GeomSprite *geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_polygon(const GeomPolygon *geom) { - activate(); + activate(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_polygon()" << endl; + dxgsg_cat.debug() << "draw_polygon()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); @@ -1954,64 +1954,64 @@ draw_polygon(const GeomPolygon *geom) { DWORD rstate; _d3dDevice->GetRenderState(D3DRENDERSTATE_FILLMODE, &rstate); if(rstate!=D3DFILL_WIREFRAME) { - draw_multitri(geom, D3DPT_TRIANGLEFAN); + draw_multitri(geom, D3DPT_TRIANGLEFAN); } else { - Geom *gp=dynamic_cast(geom); doesnt work - draw_linestrip(gp); + Geom *gp=dynamic_cast(geom); doesnt work + draw_linestrip(gp); } */ - draw_multitri(geom, D3DPT_TRIANGLEFAN); + draw_multitri(geom, D3DPT_TRIANGLEFAN); #ifdef WBD_GL_MODE - int nprims = geom->get_num_prims(); - const int *plen = geom->get_lengths(); - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::NormalIterator ni = geom->make_normal_iterator(); - Geom::TexCoordIterator ti = geom->make_texcoord_iterator(); - Geom::ColorIterator ci = geom->make_color_iterator(); + int nprims = geom->get_num_prims(); + const int *plen = geom->get_lengths(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::NormalIterator ni = geom->make_normal_iterator(); + Geom::TexCoordIterator ti = geom->make_texcoord_iterator(); + Geom::ColorIterator ci = geom->make_color_iterator(); - GeomIssuer issuer(geom, this, - issue_vertex_gl, - issue_normal_gl, - issue_texcoord_gl, - issue_color_gl); + GeomIssuer issuer(geom, this, + issue_vertex_gl, + issue_normal_gl, + issue_texcoord_gl, + issue_color_gl); - // If we have per-vertex colors or normals, we need smooth shading. - // Otherwise we want flat shading for performance reasons. - if (geom->get_binding(G_COLOR) == G_PER_VERTEX || - geom->get_binding(G_NORMAL) == G_PER_VERTEX) { - call_glShadeModel(GL_SMOOTH); - } else { - call_glShadeModel(GL_FLAT); - } + // If we have per-vertex colors or normals, we need smooth shading. + // Otherwise we want flat shading for performance reasons. + if (geom->get_binding(G_COLOR) == G_PER_VERTEX || + geom->get_binding(G_NORMAL) == G_PER_VERTEX) { + call_glShadeModel(GL_SMOOTH); + } else { + call_glShadeModel(GL_FLAT); + } - // Draw overall - issuer.issue_color(G_OVERALL, ci); - issuer.issue_normal(G_OVERALL, ni); + // Draw overall + issuer.issue_color(G_OVERALL, ci); + issuer.issue_normal(G_OVERALL, ni); - for (int i = 0; i < nprims; i++) { - // Draw per primitive - issuer.issue_color(G_PER_PRIM, ci); - issuer.issue_normal(G_PER_PRIM, ni); + for (int i = 0; i < nprims; i++) { + // Draw per primitive + issuer.issue_color(G_PER_PRIM, ci); + issuer.issue_normal(G_PER_PRIM, ni); - int num_verts = *(plen++); - nassertv(num_verts >= 3); + int num_verts = *(plen++); + nassertv(num_verts >= 3); - glBegin(GL_POLYGON); + glBegin(GL_POLYGON); - // Draw the vertices. - int v; - for (v = 0; v < num_verts; v++) { - // Per-vertex attributes. - issuer.issue_color(G_PER_VERTEX, ci); - issuer.issue_normal(G_PER_VERTEX, ni); - issuer.issue_texcoord(G_PER_VERTEX, ti); - issuer.issue_vertex(G_PER_VERTEX, vi); - } - glEnd(); - } + // Draw the vertices. + int v; + for (v = 0; v < num_verts; v++) { + // Per-vertex attributes. + issuer.issue_color(G_PER_VERTEX, ci); + issuer.issue_normal(G_PER_VERTEX, ni); + issuer.issue_texcoord(G_PER_VERTEX, ti); + issuer.issue_vertex(G_PER_VERTEX, vi); + } + glEnd(); + } #endif // WBD_GL_MODE } @@ -2024,295 +2024,295 @@ draw_polygon(const GeomPolygon *geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_tri(const GeomTri *geom) { - // activate(); + // activate(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_tri()" << endl; + dxgsg_cat.debug() << "draw_tri()" << endl; #endif _vertices_tri_pcollector.add_level(geom->get_num_vertices()); #ifdef _DEBUG - if (_pCurTexContext!=NULL) { + if (_pCurTexContext!=NULL) { // dxgsg_cat.spam() << "Cur active DX texture: " << _pCurTexContext->_tex->get_name() << "\n"; - } + } #endif - int nPrims = geom->get_num_prims(); - HRESULT hr; + int nPrims = geom->get_num_prims(); + HRESULT hr; - PTA_Vertexf coords; - PTA_Normalf norms; - PTA_Colorf colors; - PTA_TexCoordf texcoords; - GeomBindType TexCoordBinding,ColorBinding,NormalBinding,junk1; - PTA_ushort vindexes,nindexes,tindexes,cindexes; + PTA_Vertexf coords; + PTA_Normalf norms; + PTA_Colorf colors; + PTA_TexCoordf texcoords; + GeomBindType TexCoordBinding,ColorBinding,NormalBinding,junk1; + PTA_ushort vindexes,nindexes,tindexes,cindexes; - geom->get_coords(coords,junk1,vindexes); - geom->get_normals(norms,NormalBinding,nindexes); - geom->get_colors(colors,ColorBinding,cindexes); - geom->get_texcoords(texcoords,TexCoordBinding,tindexes); + geom->get_coords(coords,junk1,vindexes); + geom->get_normals(norms,NormalBinding,nindexes); + geom->get_colors(colors,ColorBinding,cindexes); + geom->get_texcoords(texcoords,TexCoordBinding,tindexes); - GeomVertFormat GeomVrtFmt=FlatVerts; + GeomVertFormat GeomVrtFmt=FlatVerts; - // first determine if we're indexed or non-indexed + // first determine if we're indexed or non-indexed - if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { - GeomVrtFmt=IndexedVerts; - //make sure array sizes are consistent, we can only pass 1 size to DrawIPrm + if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { + GeomVrtFmt=IndexedVerts; + //make sure array sizes are consistent, we can only pass 1 size to DrawIPrm // nassertv(coords.size==norms.size); nassertv(coords.size==colors.size); nassertv(coords.size==texcoords.size); need to assert only if we have this w/same binding - // indexed mode requires all used norms,colors,texcoords,coords array be the same - // length, or 0 or 1 (dwStride==0), also requires all elements to use the same index array - } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) - GeomVrtFmt=MixedFmtVerts; + // indexed mode requires all used norms,colors,texcoords,coords array be the same + // length, or 0 or 1 (dwStride==0), also requires all elements to use the same index array + } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) + GeomVrtFmt=MixedFmtVerts; #ifdef DONT_USE_DRAWPRIMSTRIDED - GeomVrtFmt=MixedFmtVerts; + GeomVrtFmt=MixedFmtVerts; #endif - // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline for now - // need to add code to handle fully indexed mode (and handle cases with index arrays of different lengths, - // values (may only be possible to handle certain cases without reverting to old pipeline) - if (GeomVrtFmt!=FlatVerts) { - // this is the old geom setup, it reformats every vtx into an output array passed to d3d + // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline for now + // need to add code to handle fully indexed mode (and handle cases with index arrays of different lengths, + // values (may only be possible to handle certain cases without reverting to old pipeline) + if (GeomVrtFmt!=FlatVerts) { + // this is the old geom setup, it reformats every vtx into an output array passed to d3d - perVertex = PER_COORD; + perVertex = PER_COORD; - if (NormalBinding == G_PER_VERTEX) perVertex |= PER_NORMAL; - if (ColorBinding == G_PER_VERTEX) perVertex |= PER_COLOR; - if (TexCoordBinding == G_PER_VERTEX) perVertex |= PER_TEXCOORD; + if (NormalBinding == G_PER_VERTEX) perVertex |= PER_NORMAL; + if (ColorBinding == G_PER_VERTEX) perVertex |= PER_COLOR; + if (TexCoordBinding == G_PER_VERTEX) perVertex |= PER_TEXCOORD; - perPrim = 0; - if (NormalBinding == G_PER_PRIM) perPrim |= PER_NORMAL; - if (ColorBinding == G_PER_PRIM) perPrim |= PER_COLOR; + perPrim = 0; + if (NormalBinding == G_PER_PRIM) perPrim |= PER_NORMAL; + if (ColorBinding == G_PER_PRIM) perPrim |= PER_COLOR; - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. - nassertv(nPrims * 3 * vertex_size < VERT_BUFFER_SIZE); - _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + nassertv(nPrims * 3 * vertex_size < VERT_BUFFER_SIZE); + _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - // iterate through the triangle primitive + // iterate through the triangle primitive - for (int i = 0; i < nPrims; i++) { - if (perPrim & PER_COLOR) { - GET_NEXT_COLOR(); - } + for (int i = 0; i < nPrims; i++) { + if (perPrim & PER_COLOR) { + GET_NEXT_COLOR(); + } - if (perPrim & PER_NORMAL) - p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. + if (perPrim & PER_NORMAL) + p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. - draw_prim_inner_loop(3, geom, perVertex); - } + draw_prim_inner_loop(3, geom, perVertex); + } - hr = _d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, nPrims*3, NULL); - TestDrawPrimFailure(DrawPrim,hr,_pDD); + hr = _d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, nPrims*3, NULL); + TestDrawPrimFailure(DrawPrim,hr,_pDD); - _pCurFvfBufPtr = NULL; - } else { + _pCurFvfBufPtr = NULL; + } else { - // new geom setup that uses strided DP calls to avoid making an extra pass over the data + // new geom setup that uses strided DP calls to avoid making an extra pass over the data - D3DDRAWPRIMITIVESTRIDEDDATA dps_data; - memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); + D3DDRAWPRIMITIVESTRIDEDDATA dps_data; + memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); #ifdef _DEBUG - nassertv(!geom->uses_components()); // code ignores lengths array - nassertv(geom->get_binding(G_COORD) == G_PER_VERTEX); + nassertv(!geom->uses_components()); // code ignores lengths array + nassertv(geom->get_binding(G_COORD) == G_PER_VERTEX); #endif - D3DPRIMITIVETYPE primtype=D3DPT_TRIANGLELIST; + D3DPRIMITIVETYPE primtype=D3DPT_TRIANGLELIST; - DWORD fvf_flags = D3DFVF_XYZ; - dps_data.position.lpvData = (VOID*)coords; - dps_data.position.dwStride = sizeof(D3DVECTOR); + DWORD fvf_flags = D3DFVF_XYZ; + dps_data.position.lpvData = (VOID*)coords; + dps_data.position.dwStride = sizeof(D3DVECTOR); - D3DSHADEMODE NeededShadeMode = D3DSHADE_FLAT; + D3DSHADEMODE NeededShadeMode = D3DSHADE_FLAT; - const DWORD dwVertsPerPrim=3; - - if ((NormalBinding != G_OFF) && wants_normals()) { + const DWORD dwVertsPerPrim=3; - dps_data.normal.lpvData = (VOID*)norms; - dps_data.normal.dwStride = sizeof(D3DVECTOR); + if ((NormalBinding != G_OFF) && wants_normals()) { + + dps_data.normal.lpvData = (VOID*)norms; + dps_data.normal.dwStride = sizeof(D3DVECTOR); #ifdef _DEBUG - nassertv(geom->get_num_vertices_per_prim()==3); - nassertv( nPrims*dwVertsPerPrim*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD)); - if (NormalBinding==G_PER_VERTEX) - nassertv(norms.size()>=nPrims*dwVertsPerPrim); + nassertv(geom->get_num_vertices_per_prim()==3); + nassertv( nPrims*dwVertsPerPrim*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD)); + if (NormalBinding==G_PER_VERTEX) + nassertv(norms.size()>=nPrims*dwVertsPerPrim); #endif - fvf_flags |= D3DFVF_NORMAL; + fvf_flags |= D3DFVF_NORMAL; - NeededShadeMode = D3DSHADE_GOURAUD; + NeededShadeMode = D3DSHADE_GOURAUD; - Normalf *pExpandedNormalArray = (Normalf *)_index_buf; // BUGBUG: need to use real permanent buffers for this conversion - if (NormalBinding==G_PER_PRIM) { - // must use tmp array to duplicate-expand per-prim norms to per-vert norms - Normalf *pOutVec = pExpandedNormalArray; - Normalf *pInVec=norms; + Normalf *pExpandedNormalArray = (Normalf *)_index_buf; // BUGBUG: need to use real permanent buffers for this conversion + if (NormalBinding==G_PER_PRIM) { + // must use tmp array to duplicate-expand per-prim norms to per-vert norms + Normalf *pOutVec = pExpandedNormalArray; + Normalf *pInVec=norms; - nassertv(norms.size()>=nPrims); + nassertv(norms.size()>=nPrims); - for (int i=0;iis_off()) { - if (!catt->is_real()) - bDoColor=FALSE; // this turns off any Geom colors - else { - ColorBinding=G_OVERALL; - bDoGlobalSceneGraphColor=TRUE; - } - } + // We should issue geometry colors only if the scene graph color is off. + if (get_attribute_into(catt, _state, ColorTransition::get_class_type()) && !catt->is_off()) { + if (!catt->is_real()) + bDoColor=FALSE; // this turns off any Geom colors + else { + ColorBinding=G_OVERALL; + bDoGlobalSceneGraphColor=TRUE; + } + } - if (bDoColor || bDoGlobalSceneGraphColor) { - D3DCOLOR *pOutColor,*pConvertedColorArray; - Colorf *pInColor=colors; - pOutColor = pConvertedColorArray = (D3DCOLOR *)_pFvfBufBasePtr; + if (bDoColor || bDoGlobalSceneGraphColor) { + D3DCOLOR *pOutColor,*pConvertedColorArray; + Colorf *pInColor=colors; + pOutColor = pConvertedColorArray = (D3DCOLOR *)_pFvfBufBasePtr; #ifdef _DEBUG - nassertv( nPrims*dwVertsPerPrim*sizeof(D3DCOLOR) <= VERT_BUFFER_SIZE); + nassertv( nPrims*dwVertsPerPrim*sizeof(D3DCOLOR) <= VERT_BUFFER_SIZE); #endif - fvf_flags |= D3DFVF_DIFFUSE; + fvf_flags |= D3DFVF_DIFFUSE; - dps_data.diffuse.lpvData = (VOID*)pConvertedColorArray; - dps_data.diffuse.dwStride = sizeof(D3DCOLOR); + dps_data.diffuse.lpvData = (VOID*)pConvertedColorArray; + dps_data.diffuse.dwStride = sizeof(D3DCOLOR); - if (ColorBinding==G_PER_PRIM) { - // must use tmp array to expand per-prim info to per-vert info + if (ColorBinding==G_PER_PRIM) { + // must use tmp array to expand per-prim info to per-vert info - // Geom nodes store floats for colors, drawprim requires ARGB dwords - // BUGBUG: eventually this hack every-frame all-colors conversion needs - // to be done only once as part of a vertex buffer + // Geom nodes store floats for colors, drawprim requires ARGB dwords + // BUGBUG: eventually this hack every-frame all-colors conversion needs + // to be done only once as part of a vertex buffer - if (NeededShadeMode!=D3DSHADE_FLAT) { - // but if lighting enabled, we need to color every vert since shading will be GOURAUD + if (NeededShadeMode!=D3DSHADE_FLAT) { + // but if lighting enabled, we need to color every vert since shading will be GOURAUD - if(!(_color_transform_enabled || _alpha_transform_enabled)) { - for (int i=0;iget_color(); - *pConvertedColorArray = Colorf_to_D3DCOLOR(colr); - } else { - *pConvertedColorArray = Colorf_to_D3DCOLOR(*pInColor); - } - } else { - if (bDoGlobalSceneGraphColor) { - Colorf colr = catt->get_color(); - transform_color(colr,*pConvertedColorArray); - } else { - transform_color(*pInColor,*pConvertedColorArray); - } - } - - dps_data.diffuse.dwStride = 0; - } - } + if(!(_color_transform_enabled || _alpha_transform_enabled)) { + if (bDoGlobalSceneGraphColor) { + Colorf colr = catt->get_color(); + *pConvertedColorArray = Colorf_to_D3DCOLOR(colr); + } else { + *pConvertedColorArray = Colorf_to_D3DCOLOR(*pInColor); + } + } else { + if (bDoGlobalSceneGraphColor) { + Colorf colr = catt->get_color(); + transform_color(colr,*pConvertedColorArray); + } else { + transform_color(*pInColor,*pConvertedColorArray); + } + } - if ((TexCoordBinding != G_OFF) && _texturing_enabled) { + dps_data.diffuse.dwStride = 0; + } + } + + if ((TexCoordBinding != G_OFF) && _texturing_enabled) { #ifdef _DEBUG - nassertv(TexCoordBinding == G_PER_VERTEX); // only sensible choice for a tri + nassertv(TexCoordBinding == G_PER_VERTEX); // only sensible choice for a tri #endif - dps_data.textureCoords[0].lpvData = (VOID*)texcoords; - dps_data.textureCoords[0].dwStride = sizeof(TexCoordf); - fvf_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); - } + dps_data.textureCoords[0].lpvData = (VOID*)texcoords; + dps_data.textureCoords[0].dwStride = sizeof(TexCoordf); + fvf_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); + } - set_shademode(NeededShadeMode); + set_shademode(NeededShadeMode); - hr = _d3dDevice->DrawPrimitiveStrided(primtype, fvf_flags, &dps_data, nPrims*dwVertsPerPrim, NULL); - TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); + hr = _d3dDevice->DrawPrimitiveStrided(primtype, fvf_flags, &dps_data, nPrims*dwVertsPerPrim, NULL); + TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); - _pCurFvfBufPtr = NULL; - } + _pCurFvfBufPtr = NULL; + } /////////////////////////// #if 0 - // test triangle for me to dbg experiments only - float vert_buf[15] = { - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 33.0, 0.0f, 0.0f, 0.0f, 2.0, - 0.0f, 0.0f, 33.0, 2.0, 0.0f - }; + // test triangle for me to dbg experiments only + float vert_buf[15] = { + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 33.0, 0.0f, 0.0f, 0.0f, 2.0, + 0.0f, 0.0f, 33.0, 2.0, 0.0f + }; - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,D3DTADDRESS_BORDER); - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,D3DTADDRESS_BORDER); - _d3dDevice->SetTextureStageState(0,D3DTSS_BORDERCOLOR,D3DRGBA(0,0,0,0)); + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,D3DTADDRESS_BORDER); + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,D3DTADDRESS_BORDER); + _d3dDevice->SetTextureStageState(0,D3DTSS_BORDERCOLOR,D3DRGBA(0,0,0,0)); - p_flags = D3DFVF_XYZ | (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)) ; - HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, p_flags, vert_buf, nPrims*3, NULL); + p_flags = D3DFVF_XYZ | (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)) ; + HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, p_flags, vert_buf, nPrims*3, NULL); TestDrawPrimFailure(DrawPrim,hr,_pDD); #endif } @@ -2324,65 +2324,65 @@ draw_tri(const GeomTri *geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_quad(const GeomQuad *geom) { - activate(); + activate(); #if 1 - static BOOL bPrintedMsg=FALSE; + static BOOL bPrintedMsg=FALSE; - if (!bPrintedMsg) { - bPrintedMsg=TRUE; - dxgsg_cat.error() << "dxgsg draw_quad drawing not implemented yet!\n"; - } + if (!bPrintedMsg) { + bPrintedMsg=TRUE; + dxgsg_cat.error() << "dxgsg draw_quad drawing not implemented yet!\n"; + } #endif #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_quad()" << endl; + dxgsg_cat.debug() << "draw_quad()" << endl; #endif _vertices_other_pcollector.add_level(geom->get_num_vertices()); #ifdef WBD_GL_MODE - int nprims = geom->get_num_prims(); - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::NormalIterator ni = geom->make_normal_iterator(); - Geom::TexCoordIterator ti = geom->make_texcoord_iterator(); - Geom::ColorIterator ci = geom->make_color_iterator(); + int nprims = geom->get_num_prims(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::NormalIterator ni = geom->make_normal_iterator(); + Geom::TexCoordIterator ti = geom->make_texcoord_iterator(); + Geom::ColorIterator ci = geom->make_color_iterator(); - GeomIssuer issuer(geom, this, - issue_vertex_gl, - issue_normal_gl, - issue_texcoord_gl, - issue_color_gl); + GeomIssuer issuer(geom, this, + issue_vertex_gl, + issue_normal_gl, + issue_texcoord_gl, + issue_color_gl); - // If we have per-vertex colors or normals, we need smooth shading. - // Otherwise we want flat shading for performance reasons. - if (geom->get_binding(G_COLOR) == G_PER_VERTEX || - geom->get_binding(G_NORMAL) == G_PER_VERTEX) { - call_glShadeModel(GL_SMOOTH); - } else { - call_glShadeModel(GL_FLAT); - } + // If we have per-vertex colors or normals, we need smooth shading. + // Otherwise we want flat shading for performance reasons. + if (geom->get_binding(G_COLOR) == G_PER_VERTEX || + geom->get_binding(G_NORMAL) == G_PER_VERTEX) { + call_glShadeModel(GL_SMOOTH); + } else { + call_glShadeModel(GL_FLAT); + } - // Draw overall - issuer.issue_color(G_OVERALL, ci); - issuer.issue_normal(G_OVERALL, ni); + // Draw overall + issuer.issue_color(G_OVERALL, ci); + issuer.issue_normal(G_OVERALL, ni); - glBegin(GL_QUADS); + glBegin(GL_QUADS); - for (int i = 0; i < nprims; i++) { - // Draw per primitive - issuer.issue_color(G_PER_PRIM, ci); - issuer.issue_normal(G_PER_PRIM, ni); + for (int i = 0; i < nprims; i++) { + // Draw per primitive + issuer.issue_color(G_PER_PRIM, ci); + issuer.issue_normal(G_PER_PRIM, ni); - for (int j = 0; j < 4; j++) { - // Draw per vertex - issuer.issue_color(G_PER_VERTEX, ci); - issuer.issue_normal(G_PER_VERTEX, ni); - issuer.issue_texcoord(G_PER_VERTEX, ti); - issuer.issue_vertex(G_PER_VERTEX, vi); - } - } + for (int j = 0; j < 4; j++) { + // Draw per vertex + issuer.issue_color(G_PER_VERTEX, ci); + issuer.issue_normal(G_PER_VERTEX, ni); + issuer.issue_texcoord(G_PER_VERTEX, ti); + issuer.issue_vertex(G_PER_VERTEX, vi); + } + } - glEnd(); + glEnd(); #endif // WBD_GL_MODE } @@ -2395,11 +2395,11 @@ void DXGraphicsStateGuardian:: draw_tristrip(const GeomTristrip *geom) { #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_tristrip()" << endl; + dxgsg_cat.debug() << "draw_tristrip()" << endl; #endif _vertices_tristrip_pcollector.add_level(geom->get_num_vertices()); - draw_multitri(geom, D3DPT_TRIANGLESTRIP); + draw_multitri(geom, D3DPT_TRIANGLESTRIP); } //////////////////////////////////////////////////////////////////// @@ -2411,11 +2411,11 @@ void DXGraphicsStateGuardian:: draw_trifan(const GeomTrifan *geom) { #ifdef GSG_VERBOSE - dxgsg_cat.debug() << "draw_trifan()" << endl; + dxgsg_cat.debug() << "draw_trifan()" << endl; #endif _vertices_trifan_pcollector.add_level(geom->get_num_vertices()); - draw_multitri(geom, D3DPT_TRIANGLEFAN); + draw_multitri(geom, D3DPT_TRIANGLEFAN); } //////////////////////////////////////////////////////////////////// @@ -2426,365 +2426,365 @@ draw_trifan(const GeomTrifan *geom) { void DXGraphicsStateGuardian:: draw_multitri(const Geom *geom, D3DPRIMITIVETYPE trilisttype) { - int nPrims = geom->get_num_prims(); - const int *pLengthArr = geom->get_lengths(); - HRESULT hr; + int nPrims = geom->get_num_prims(); + const int *pLengthArr = geom->get_lengths(); + HRESULT hr; - if (nPrims==0) { - #ifdef _DEBUG - dxgsg_cat.warning() << "draw_multitri() called with ZERO vertices!!" << endl; - #endif - return; - } + if (nPrims==0) { + #ifdef _DEBUG + dxgsg_cat.warning() << "draw_multitri() called with ZERO vertices!!" << endl; + #endif + return; + } - PTA_Vertexf coords; - PTA_Normalf norms; - PTA_Colorf colors; - PTA_TexCoordf texcoords; - GeomBindType TexCoordBinding,ColorBinding,NormalBinding,junk1; - PTA_ushort vindexes,nindexes,tindexes,cindexes; + PTA_Vertexf coords; + PTA_Normalf norms; + PTA_Colorf colors; + PTA_TexCoordf texcoords; + GeomBindType TexCoordBinding,ColorBinding,NormalBinding,junk1; + PTA_ushort vindexes,nindexes,tindexes,cindexes; - geom->get_coords(coords,junk1,vindexes); - geom->get_normals(norms,NormalBinding,nindexes); - geom->get_colors(colors,ColorBinding,cindexes); - geom->get_texcoords(texcoords,TexCoordBinding,tindexes); + geom->get_coords(coords,junk1,vindexes); + geom->get_normals(norms,NormalBinding,nindexes); + geom->get_colors(colors,ColorBinding,cindexes); + geom->get_texcoords(texcoords,TexCoordBinding,tindexes); - GeomVertFormat GeomVrtFmt=FlatVerts; + GeomVertFormat GeomVrtFmt=FlatVerts; - // first determine if we're indexed or non-indexed + // first determine if we're indexed or non-indexed - if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { - GeomVrtFmt=IndexedVerts; - //make sure array sizes are consistent, we can only pass 1 size to DrawIPrm - // nassertv(coords.size==norms.size); nassertv(coords.size==colors.size); nassertv(coords.size==texcoords.size); need to assert only if we have this w/same binding - // indexed mode requires all used norms,colors,texcoords,coords array be the same - // length, or 0 or 1 (dwStride==0), also requires all elements to use the same index array - } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) - GeomVrtFmt=MixedFmtVerts; + if ((vindexes!=NULL)&&(cindexes!=NULL)&&(tindexes!=NULL)&&(nindexes!=NULL)) { + GeomVrtFmt=IndexedVerts; + //make sure array sizes are consistent, we can only pass 1 size to DrawIPrm + // nassertv(coords.size==norms.size); nassertv(coords.size==colors.size); nassertv(coords.size==texcoords.size); need to assert only if we have this w/same binding + // indexed mode requires all used norms,colors,texcoords,coords array be the same + // length, or 0 or 1 (dwStride==0), also requires all elements to use the same index array + } else if (!((vindexes==NULL)&&(cindexes==NULL)&&(tindexes==NULL)&&(nindexes==NULL))) + GeomVrtFmt=MixedFmtVerts; #ifdef DONT_USE_DRAWPRIMSTRIDED - GeomVrtFmt=MixedFmtVerts; + GeomVrtFmt=MixedFmtVerts; #endif - // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline - // cant handle indexed prims because usually have different index arrays for different components, - // and DrIdxPrmStrd only accepts 1 index array for all components - if (GeomVrtFmt!=FlatVerts) { + // for Indexed Prims and mixed indexed/non-indexed prims, we will use old pipeline + // cant handle indexed prims because usually have different index arrays for different components, + // and DrIdxPrmStrd only accepts 1 index array for all components + if (GeomVrtFmt!=FlatVerts) { - // this is the old geom setup, it reformats every vtx into an output array passed to d3d - perVertex = PER_COORD; - perPrim = perComp = 0; + // this is the old geom setup, it reformats every vtx into an output array passed to d3d + perVertex = PER_COORD; + perPrim = perComp = 0; - switch (geom->get_binding(G_NORMAL)) { - case G_PER_VERTEX: - perVertex |= PER_NORMAL; - break; - case G_PER_PRIM: - perPrim |= PER_NORMAL; - break; - case G_PER_COMPONENT: - perComp |= PER_NORMAL; - break; - } + switch (geom->get_binding(G_NORMAL)) { + case G_PER_VERTEX: + perVertex |= PER_NORMAL; + break; + case G_PER_PRIM: + perPrim |= PER_NORMAL; + break; + case G_PER_COMPONENT: + perComp |= PER_NORMAL; + break; + } - switch (geom->get_binding(G_COLOR)) { - case G_PER_VERTEX: - perVertex |= PER_COLOR; - break; - case G_PER_PRIM: - perPrim |= PER_COLOR; - break; - case G_PER_COMPONENT: - perComp |= PER_COLOR; - break; - } + switch (geom->get_binding(G_COLOR)) { + case G_PER_VERTEX: + perVertex |= PER_COLOR; + break; + case G_PER_PRIM: + perPrim |= PER_COLOR; + break; + case G_PER_COMPONENT: + perComp |= PER_COLOR; + break; + } - if (geom->get_binding(G_TEXCOORD) == G_PER_VERTEX) - perVertex |= PER_TEXCOORD; + if (geom->get_binding(G_TEXCOORD) == G_PER_VERTEX) + perVertex |= PER_TEXCOORD; - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - // iterate through the triangle primitives + // iterate through the triangle primitives - for (int i = 0; i < nPrims; i++) { + for (int i = 0; i < nPrims; i++) { - if (perPrim & PER_COLOR) { - GET_NEXT_COLOR(); - } - if (perPrim & PER_NORMAL) - p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. + if (perPrim & PER_COLOR) { + GET_NEXT_COLOR(); + } + if (perPrim & PER_NORMAL) + p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. - int nVerts = *(pLengthArr++); + int nVerts = *(pLengthArr++); #ifdef _DEBUG - nassertv(nVerts >= 3); - nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. - nassertv(nVerts * vertex_size < VERT_BUFFER_SIZE); + nassertv(nVerts >= 3); + nassertv(_pCurFvfBufPtr == NULL); // make sure the storage pointer is clean. + nassertv(nVerts * vertex_size < VERT_BUFFER_SIZE); #endif - _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't + _pCurFvfBufPtr = _pFvfBufBasePtr; // _pCurFvfBufPtr changes, _pFvfBufBasePtr doesn't - // handles first triangle strip/fan - if (perComp & PER_COLOR) { - GET_NEXT_COLOR(); - } - if (perComp & PER_NORMAL) - p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. + // handles first triangle strip/fan + if (perComp & PER_COLOR) { + GET_NEXT_COLOR(); + } + if (perComp & PER_NORMAL) + p_normal = geom->get_next_normal(ni); // set primitive normal if there is one. - // Store first triangle - draw_prim_inner_loop(3, geom, perVertex); + // Store first triangle + draw_prim_inner_loop(3, geom, perVertex); - // Store remaining vertices - draw_prim_inner_loop(nVerts-3, geom, perVertex | perComp); + // Store remaining vertices + draw_prim_inner_loop(nVerts-3, geom, perVertex | perComp); - HRESULT hr = _d3dDevice->DrawPrimitive(trilisttype, p_flags, _pFvfBufBasePtr, nVerts, NULL); - TestDrawPrimFailure(DrawPrim,hr,_pDD); + HRESULT hr = _d3dDevice->DrawPrimitive(trilisttype, p_flags, _pFvfBufBasePtr, nVerts, NULL); + TestDrawPrimFailure(DrawPrim,hr,_pDD); - _pCurFvfBufPtr = NULL; - } - } else { + _pCurFvfBufPtr = NULL; + } + } else { - // new geom setup that uses strided DP calls to avoid making an extra pass over the data + // new geom setup that uses strided DP calls to avoid making an extra pass over the data - D3DDRAWPRIMITIVESTRIDEDDATA dps_data; - memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); + D3DDRAWPRIMITIVESTRIDEDDATA dps_data; + memset(&dps_data,0,sizeof(D3DDRAWPRIMITIVESTRIDEDDATA)); #ifdef _DEBUG - nassertv(geom->uses_components()); - nassertv(geom->get_binding(G_COORD) == G_PER_VERTEX); + nassertv(geom->uses_components()); + nassertv(geom->get_binding(G_COORD) == G_PER_VERTEX); #endif - DWORD fvf_flags = D3DFVF_XYZ; - dps_data.position.lpvData = (VOID*)coords; - dps_data.position.dwStride = sizeof(D3DVECTOR); + DWORD fvf_flags = D3DFVF_XYZ; + dps_data.position.lpvData = (VOID*)coords; + dps_data.position.dwStride = sizeof(D3DVECTOR); - D3DSHADEMODE NeededShadeMode = D3DSHADE_FLAT; + D3DSHADEMODE NeededShadeMode = D3DSHADE_FLAT; - DWORD cTotalVerts=0; + DWORD cTotalVerts=0; - for (int i=0;iget_num_more_vertices_than_components()==2); - nassertv(NormalBinding!=G_PER_COMPONENT); // makes no sense, unimplementable for strips since normals always shared across tris - nassertv( cTotalVerts*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD)); - if(NormalBinding==G_PER_VERTEX) - nassertv(norms.size()>=cTotalVerts); + nassertv(geom->get_num_more_vertices_than_components()==2); + nassertv(NormalBinding!=G_PER_COMPONENT); // makes no sense, unimplementable for strips since normals always shared across tris + nassertv( cTotalVerts*sizeof(D3DVECTOR) <= D3DMAXNUMVERTICES*sizeof(WORD)); + if(NormalBinding==G_PER_VERTEX) + nassertv(norms.size()>=cTotalVerts); #endif - fvf_flags |= D3DFVF_NORMAL; - NeededShadeMode = D3DSHADE_GOURAUD; + fvf_flags |= D3DFVF_NORMAL; + NeededShadeMode = D3DSHADE_GOURAUD; - Normalf *pExpandedNormalArray = (Normalf *)_index_buf; // BUGBUG: need to use real permanent buffers instead of _indexbuf hack + Normalf *pExpandedNormalArray = (Normalf *)_index_buf; // BUGBUG: need to use real permanent buffers instead of _indexbuf hack - if(NormalBinding==G_PER_PRIM) { - // we have 1 normal per strip - // must use tmp array to duplicate-expand per-prim norms to per-vert norms - Normalf *pOutVec = pExpandedNormalArray; - Normalf *pInVec=norms; - const int *pLengths=pLengthArr; + if(NormalBinding==G_PER_PRIM) { + // we have 1 normal per strip + // must use tmp array to duplicate-expand per-prim norms to per-vert norms + Normalf *pOutVec = pExpandedNormalArray; + Normalf *pInVec=norms; + const int *pLengths=pLengthArr; - nassertv(norms.size()>=nPrims); + nassertv(norms.size()>=nPrims); - for (int i=0;iis_off()) { - if (!catt->is_real()) - bDoColor=FALSE; // this turns off any Geom colors - else { - ColorBinding=G_OVERALL; - bDoGlobalSceneGraphColor=TRUE; - } - } + // We should issue geometry colors only if the scene graph color is off. + if (get_attribute_into(catt, _state, ColorTransition::get_class_type()) && !catt->is_off()) { + if (!catt->is_real()) + bDoColor=FALSE; // this turns off any Geom colors + else { + ColorBinding=G_OVERALL; + bDoGlobalSceneGraphColor=TRUE; + } + } - if (bDoColor || bDoGlobalSceneGraphColor) { - D3DCOLOR *pOutColor,*pConvertedColorArray; - Colorf *pInColor=colors; - pOutColor = pConvertedColorArray = (D3DCOLOR *)_pFvfBufBasePtr; + if (bDoColor || bDoGlobalSceneGraphColor) { + D3DCOLOR *pOutColor,*pConvertedColorArray; + Colorf *pInColor=colors; + pOutColor = pConvertedColorArray = (D3DCOLOR *)_pFvfBufBasePtr; #ifdef _DEBUG - nassertv( cTotalVerts*sizeof(D3DCOLOR) <= VERT_BUFFER_SIZE); + nassertv( cTotalVerts*sizeof(D3DCOLOR) <= VERT_BUFFER_SIZE); #endif - fvf_flags |= D3DFVF_DIFFUSE; + fvf_flags |= D3DFVF_DIFFUSE; - dps_data.diffuse.lpvData = (VOID*)pConvertedColorArray; - dps_data.diffuse.dwStride = sizeof(D3DCOLOR); + dps_data.diffuse.lpvData = (VOID*)pConvertedColorArray; + dps_data.diffuse.dwStride = sizeof(D3DCOLOR); - if (ColorBinding==G_PER_VERTEX) { - NeededShadeMode = D3DSHADE_GOURAUD; + if (ColorBinding==G_PER_VERTEX) { + NeededShadeMode = D3DSHADE_GOURAUD; - if(!(_color_transform_enabled || _alpha_transform_enabled)) { - for (int i=0;i= cTotalVerts-nPrims*cNumMoreVertsthanTris); + if(!(_color_transform_enabled || _alpha_transform_enabled)) { + for (int j=0;j= cTotalVerts-nPrims*cNumMoreVertsthanTris); - #define MULTITRI_COLORCOPY_LOOP \ - DWORD cCurStripColorCnt=pLengthArr[j]-cNumMoreVertsthanTris; \ - for (int i=0;iget_color(); - *pConvertedColorArray = Colorf_to_D3DCOLOR(colr); - } else { - *pConvertedColorArray = Colorf_to_D3DCOLOR(*pInColor); - } - } else { - if (bDoGlobalSceneGraphColor) { - Colorf colr = catt->get_color(); - transform_color(colr,*pConvertedColorArray); - } else { - transform_color(*pInColor,*pConvertedColorArray); - } - } + if(!(_color_transform_enabled || _alpha_transform_enabled)) { + if (bDoGlobalSceneGraphColor) { + Colorf colr = catt->get_color(); + *pConvertedColorArray = Colorf_to_D3DCOLOR(colr); + } else { + *pConvertedColorArray = Colorf_to_D3DCOLOR(*pInColor); + } + } else { + if (bDoGlobalSceneGraphColor) { + Colorf colr = catt->get_color(); + transform_color(colr,*pConvertedColorArray); + } else { + transform_color(*pInColor,*pConvertedColorArray); + } + } - dps_data.diffuse.dwStride = 0; - } - } + dps_data.diffuse.dwStride = 0; + } + } - if ((TexCoordBinding != G_OFF) && _texturing_enabled) { + if ((TexCoordBinding != G_OFF) && _texturing_enabled) { #ifdef _DEBUG - nassertv(TexCoordBinding == G_PER_VERTEX); // only sensible choice for a tri + nassertv(TexCoordBinding == G_PER_VERTEX); // only sensible choice for a tri #endif - dps_data.textureCoords[0].lpvData = (VOID*)texcoords; - dps_data.textureCoords[0].dwStride = sizeof(TexCoordf); - fvf_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); - } + dps_data.textureCoords[0].lpvData = (VOID*)texcoords; + dps_data.textureCoords[0].dwStride = sizeof(TexCoordf); + fvf_flags |= (D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); + } - set_shademode(NeededShadeMode); + set_shademode(NeededShadeMode); - for (int j=0;jDrawPrimitiveStrided(trilisttype, fvf_flags, &dps_data, cCurNumStripVerts, NULL); - TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); + hr = _d3dDevice->DrawPrimitiveStrided(trilisttype, fvf_flags, &dps_data, cCurNumStripVerts, NULL); + TestDrawPrimFailure(DrawPrimStrided,hr,_pDD); - dps_data.position.lpvData = (VOID*)(((char*) dps_data.position.lpvData) + cCurNumStripVerts*dps_data.position.dwStride); - dps_data.diffuse.lpvData = (VOID*)(((char*) dps_data.diffuse.lpvData) + cCurNumStripVerts*dps_data.diffuse.dwStride); - dps_data.normal.lpvData = (VOID*)(((char*) dps_data.normal.lpvData) + cCurNumStripVerts*dps_data.normal.dwStride); - dps_data.textureCoords[0].lpvData = (VOID*)(((char*) dps_data.textureCoords[0].lpvData) + cCurNumStripVerts*dps_data.textureCoords[0].dwStride); - } + dps_data.position.lpvData = (VOID*)(((char*) dps_data.position.lpvData) + cCurNumStripVerts*dps_data.position.dwStride); + dps_data.diffuse.lpvData = (VOID*)(((char*) dps_data.diffuse.lpvData) + cCurNumStripVerts*dps_data.diffuse.dwStride); + dps_data.normal.lpvData = (VOID*)(((char*) dps_data.normal.lpvData) + cCurNumStripVerts*dps_data.normal.dwStride); + dps_data.textureCoords[0].lpvData = (VOID*)(((char*) dps_data.textureCoords[0].lpvData) + cCurNumStripVerts*dps_data.textureCoords[0].dwStride); + } - _pCurFvfBufPtr = NULL; - } + _pCurFvfBufPtr = NULL; + } } //----------------------------------------------------------------------------- @@ -2795,234 +2795,234 @@ draw_multitri(const Geom *geom, D3DPRIMITIVETYPE trilisttype) { void DXGraphicsStateGuardian:: GenerateSphere(void *pVertexSpace,DWORD dwVertSpaceByteSize, - void *pIndexSpace,DWORD dwIndexSpaceByteSize, - D3DVECTOR *pCenter, float fRadius, - DWORD wNumRings, DWORD wNumSections, float sx, float sy, float sz, - DWORD *pNumVertices,DWORD *pNumIndices,DWORD fvfFlags,DWORD dwVertSize) { + void *pIndexSpace,DWORD dwIndexSpaceByteSize, + D3DVECTOR *pCenter, float fRadius, + DWORD wNumRings, DWORD wNumSections, float sx, float sy, float sz, + DWORD *pNumVertices,DWORD *pNumIndices,DWORD fvfFlags,DWORD dwVertSize) { - float x, y, z, rsintheta; - D3DVECTOR vPoint; + float x, y, z, rsintheta; + D3DVECTOR vPoint; //#define DBG_GENSPHERE #define M_PI 3.1415926f // probably should get this from mathNumbers.h instead - nassertv(wNumRings>=2 && wNumSections>=2); - wNumRings--; // wNumRings indicates number of vertex rings (not tri-rings). - // gluSphere 'stacks' arg for 1 vert ring is 2, so convert to our '1'. - wNumSections++; // to make us equiv to gluSphere + nassertv(wNumRings>=2 && wNumSections>=2); + wNumRings--; // wNumRings indicates number of vertex rings (not tri-rings). + // gluSphere 'stacks' arg for 1 vert ring is 2, so convert to our '1'. + wNumSections++; // to make us equiv to gluSphere - //Figure out needed space for the triangles and vertices. - DWORD dwNumVertices,dwNumIndices,dwNumTriangles; + //Figure out needed space for the triangles and vertices. + DWORD dwNumVertices,dwNumIndices,dwNumTriangles; #define DOTEXTURING (fvfFlags & D3DFVF_TEXCOUNT_MASK) #define DONORMAL (fvfFlags & D3DFVF_NORMAL) #define DOCOLOR (fvfFlags & D3DFVF_DIFFUSE) - if (DOTEXTURING) { - // if texturing, we need full rings of identical position verts at poles to hold diff texture coords - wNumRings+=2; - dwNumVertices = *pNumVertices = wNumRings * wNumSections; - dwNumTriangles = (wNumRings-1) * wNumSections * 2; - } else { - dwNumVertices = *pNumVertices = wNumRings * wNumSections + 2; - dwNumTriangles = wNumRings*wNumSections*2; - } + if (DOTEXTURING) { + // if texturing, we need full rings of identical position verts at poles to hold diff texture coords + wNumRings+=2; + dwNumVertices = *pNumVertices = wNumRings * wNumSections; + dwNumTriangles = (wNumRings-1) * wNumSections * 2; + } else { + dwNumVertices = *pNumVertices = wNumRings * wNumSections + 2; + dwNumTriangles = wNumRings*wNumSections*2; + } - dwNumIndices = *pNumIndices = dwNumTriangles*3; + dwNumIndices = *pNumIndices = dwNumTriangles*3; - D3DVERTEX* pvVertices = (D3DVERTEX*) pVertexSpace; - WORD *pwIndices = (WORD *) pIndexSpace; + D3DVERTEX* pvVertices = (D3DVERTEX*) pVertexSpace; + WORD *pwIndices = (WORD *) pIndexSpace; - nassertv(dwNumVertices*dwVertSize < VERT_BUFFER_SIZE); - nassertv(dwNumIndices < D3DMAXNUMVERTICES ); + nassertv(dwNumVertices*dwVertSize < VERT_BUFFER_SIZE); + nassertv(dwNumIndices < D3DMAXNUMVERTICES ); - // Generate vertex at the top point - D3DVECTOR vTopPoint = *pCenter + D3DVECTOR( 0.0f, +sy*fRadius, 0.0f); - D3DVECTOR vBotPoint = *pCenter + D3DVECTOR( 0.0f, -sy*fRadius, 0.0f); - D3DVECTOR vNormal = D3DVECTOR( 0.0f, 1.0f, 0.0f ); - float texCoords[2]; + // Generate vertex at the top point + D3DVECTOR vTopPoint = *pCenter + D3DVECTOR( 0.0f, +sy*fRadius, 0.0f); + D3DVECTOR vBotPoint = *pCenter + D3DVECTOR( 0.0f, -sy*fRadius, 0.0f); + D3DVECTOR vNormal = D3DVECTOR( 0.0f, 1.0f, 0.0f ); + float texCoords[2]; - nassertv(pVertexSpace==_pCurFvfBufPtr); // add_to_FVFBuf requires this + nassertv(pVertexSpace==_pCurFvfBufPtr); // add_to_FVFBuf requires this #define ADD_GENSPHERE_VERTEX_TO_BUFFER(VERT) \ add_to_FVFBuf((void *)&(VERT), sizeof(D3DVECTOR)); \ if(fvfFlags & D3DFVF_NORMAL) \ - add_to_FVFBuf((void *)&vNormal, sizeof(D3DVECTOR)); \ + add_to_FVFBuf((void *)&vNormal, sizeof(D3DVECTOR)); \ if(fvfFlags & D3DFVF_DIFFUSE) \ - add_DWORD_to_FVFBuf(p_colr); \ - if(fvfFlags & D3DFVF_TEXCOUNT_MASK) \ - add_to_FVFBuf((void *)texCoords, sizeof(TexCoordf)); + add_DWORD_to_FVFBuf(p_colr); \ + if(fvfFlags & D3DFVF_TEXCOUNT_MASK) \ + add_to_FVFBuf((void *)texCoords, sizeof(TexCoordf)); #ifdef DBG_GENSPHERE - int nvs_written=0; - memset(pVertexSpace,0xFF,dwNumVertices*dwVertSize); + int nvs_written=0; + memset(pVertexSpace,0xFF,dwNumVertices*dwVertSize); #endif - if (! DOTEXTURING) { - ADD_GENSPHERE_VERTEX_TO_BUFFER(vTopPoint); + if (! DOTEXTURING) { + ADD_GENSPHERE_VERTEX_TO_BUFFER(vTopPoint); #ifdef DBG_GENSPHERE - nvs_written++; + nvs_written++; #endif - } + } - // Generate vertex points for rings - float inv_radius = 1.0f/fRadius; - const float reciprocal_PI=1.0f/M_PI; - const float reciprocal_2PI=1.0f/(2.0*M_PI); - DWORD i; - float theta,dtheta; + // Generate vertex points for rings + float inv_radius = 1.0f/fRadius; + const float reciprocal_PI=1.0f/M_PI; + const float reciprocal_2PI=1.0f/(2.0*M_PI); + DWORD i; + float theta,dtheta; - if (DOTEXTURING) { - // numRings already includes 1st and last rings for this case - dtheta = (float)(M_PI / (wNumRings-1)); //Angle between each ring (ignore 2 fake rings) - theta = 0.0f; - } else { - dtheta = (float)(M_PI / (wNumRings + 1)); //Angle between each ring - theta = dtheta; - } - float phi,dphi = (float)(2*M_PI / (wNumSections-1)); //Angle between each section + if (DOTEXTURING) { + // numRings already includes 1st and last rings for this case + dtheta = (float)(M_PI / (wNumRings-1)); //Angle between each ring (ignore 2 fake rings) + theta = 0.0f; + } else { + dtheta = (float)(M_PI / (wNumRings + 1)); //Angle between each ring + theta = dtheta; + } + float phi,dphi = (float)(2*M_PI / (wNumSections-1)); //Angle between each section - for (i = 0; i < wNumRings; i++) { - float costheta,sintheta,cosphi,sinphi; - phi = 0.0f; + for (i = 0; i < wNumRings; i++) { + float costheta,sintheta,cosphi,sinphi; + phi = 0.0f; - if (DOTEXTURING) { - texCoords[1] = theta * reciprocal_PI; // v is the same for each ring - } + if (DOTEXTURING) { + texCoords[1] = theta * reciprocal_PI; // v is the same for each ring + } - // could optimize all this sin/cos stuff w/tables - csincos(theta,&sintheta,&costheta); - y = fRadius * costheta; // y is the same for each ring + // could optimize all this sin/cos stuff w/tables + csincos(theta,&sintheta,&costheta); + y = fRadius * costheta; // y is the same for each ring - rsintheta = fRadius * sintheta; + rsintheta = fRadius * sintheta; - for (DWORD j = 0; j < wNumSections; j++) { - csincos(phi,&sinphi,&cosphi); - x = rsintheta * sinphi; - z = rsintheta * cosphi; + for (DWORD j = 0; j < wNumSections; j++) { + csincos(phi,&sinphi,&cosphi); + x = rsintheta * sinphi; + z = rsintheta * cosphi; #ifdef DBG_GENSPHERE - nvs_written++; + nvs_written++; #endif - vPoint = *pCenter + D3DVECTOR( sx*x, sy*y, sz*z ); + vPoint = *pCenter + D3DVECTOR( sx*x, sy*y, sz*z ); - add_to_FVFBuf((void *)&vPoint, sizeof(D3DVECTOR)); + add_to_FVFBuf((void *)&vPoint, sizeof(D3DVECTOR)); - if (DONORMAL) { - // this is wrong normal for the non-spherical case (i think you need to multiply by 1/scale factor per component) - vNormal = Normalize(D3DVECTOR( x*inv_radius, y*inv_radius, z*inv_radius )); - add_to_FVFBuf((void *)&vNormal, sizeof(D3DVECTOR)); - } + if (DONORMAL) { + // this is wrong normal for the non-spherical case (i think you need to multiply by 1/scale factor per component) + vNormal = Normalize(D3DVECTOR( x*inv_radius, y*inv_radius, z*inv_radius )); + add_to_FVFBuf((void *)&vNormal, sizeof(D3DVECTOR)); + } - if (DOCOLOR) - add_DWORD_to_FVFBuf(p_colr); + if (DOCOLOR) + add_DWORD_to_FVFBuf(p_colr); - if (DOTEXTURING) { - texCoords[0] = 1.0f - phi*reciprocal_2PI; - add_to_FVFBuf((void *)texCoords, sizeof(TexCoordf)); - } + if (DOTEXTURING) { + texCoords[0] = 1.0f - phi*reciprocal_2PI; + add_to_FVFBuf((void *)texCoords, sizeof(TexCoordf)); + } - phi += dphi; - } - theta += dtheta; - } + phi += dphi; + } + theta += dtheta; + } - if (! DOTEXTURING) { - // Generate bottom vertex - vNormal = D3DVECTOR( 0.0f, -1.0f, 0.0f ); - ADD_GENSPHERE_VERTEX_TO_BUFFER(vBotPoint); + if (! DOTEXTURING) { + // Generate bottom vertex + vNormal = D3DVECTOR( 0.0f, -1.0f, 0.0f ); + ADD_GENSPHERE_VERTEX_TO_BUFFER(vBotPoint); #ifdef DBG_GENSPHERE - nvs_written++; + nvs_written++; #endif - } + } #ifdef DBG_GENSPHERE - assert(nvs_written == dwNumVertices); + assert(nvs_written == dwNumVertices); #endif #ifdef DBG_GENSPHERE - memset(pwIndices,0xFF,dwNumIndices*sizeof(WORD)); + memset(pwIndices,0xFF,dwNumIndices*sizeof(WORD)); #endif - // inited for textured case - DWORD cur_vertring_startidx=0; // first vertex in current ring - DWORD CurFinalTriIndex = 0; // index of next tri to be written + // inited for textured case + DWORD cur_vertring_startidx=0; // first vertex in current ring + DWORD CurFinalTriIndex = 0; // index of next tri to be written - if (! DOTEXTURING) { - // Generate caps using unique the bot/top vert - // for non-textured case, could render the caps as indexed trifans, - // but should be no perf difference b/w indexed trilists and indexed trifans - // and this has advantage of being aggregable into 1 big DPrim call for whole sphere + if (! DOTEXTURING) { + // Generate caps using unique the bot/top vert + // for non-textured case, could render the caps as indexed trifans, + // but should be no perf difference b/w indexed trilists and indexed trifans + // and this has advantage of being aggregable into 1 big DPrim call for whole sphere - for (i = 0; i < wNumSections; i++) { - DWORD TopCapTriIndex=3*i; - DWORD BotCapTriIndex=3*(dwNumTriangles - wNumSections + i); - DWORD i_incd = ((i + 1) % wNumSections); + for (i = 0; i < wNumSections; i++) { + DWORD TopCapTriIndex=3*i; + DWORD BotCapTriIndex=3*(dwNumTriangles - wNumSections + i); + DWORD i_incd = ((i + 1) % wNumSections); - pwIndices[TopCapTriIndex++] = 0; - pwIndices[TopCapTriIndex++] = i + 1; - pwIndices[TopCapTriIndex] = i_incd + 1; + pwIndices[TopCapTriIndex++] = 0; + pwIndices[TopCapTriIndex++] = i + 1; + pwIndices[TopCapTriIndex] = i_incd + 1; - pwIndices[BotCapTriIndex++] = (WORD)( dwNumVertices - 1 ); - pwIndices[BotCapTriIndex++] = (WORD)( dwNumVertices - 2 - i ); - pwIndices[BotCapTriIndex] = (WORD)( dwNumVertices - 2 - i_incd); - } + pwIndices[BotCapTriIndex++] = (WORD)( dwNumVertices - 1 ); + pwIndices[BotCapTriIndex++] = (WORD)( dwNumVertices - 2 - i ); + pwIndices[BotCapTriIndex] = (WORD)( dwNumVertices - 2 - i_incd); + } - cur_vertring_startidx = 1; // first vertex in current ring (skip top vert) - CurFinalTriIndex = wNumSections; // index of tri to be written, wNumSections to skip the top cap row - } + cur_vertring_startidx = 1; // first vertex in current ring (skip top vert) + CurFinalTriIndex = wNumSections; // index of tri to be written, wNumSections to skip the top cap row + } - DWORD j_incd,base_index; + DWORD j_incd,base_index; - // technically we could break into a strip for every row (or 1 big strip connected w/degenerate tris) - // but indexed trilists should actually be just as fast on HW + // technically we could break into a strip for every row (or 1 big strip connected w/degenerate tris) + // but indexed trilists should actually be just as fast on HW - // Generate triangles for the rings - for (i = 0; i < wNumRings-1; i++) { - for (DWORD j = 0; j < wNumSections; j++) { + // Generate triangles for the rings + for (i = 0; i < wNumRings-1; i++) { + for (DWORD j = 0; j < wNumSections; j++) { - base_index=3*CurFinalTriIndex; // final vert index is 3*finaltriindex - j_incd=(j+1) % wNumSections; + base_index=3*CurFinalTriIndex; // final vert index is 3*finaltriindex + j_incd=(j+1) % wNumSections; - DWORD v1_row1_idx,v2_row1_idx,v1_row2_idx,v2_row2_idx; + DWORD v1_row1_idx,v2_row1_idx,v1_row2_idx,v2_row2_idx; - v1_row1_idx = cur_vertring_startidx + j; - v2_row1_idx = cur_vertring_startidx + j_incd; - v1_row2_idx = v1_row1_idx + wNumSections; - v2_row2_idx = v2_row1_idx + wNumSections; + v1_row1_idx = cur_vertring_startidx + j; + v2_row1_idx = cur_vertring_startidx + j_incd; + v1_row2_idx = v1_row1_idx + wNumSections; + v2_row2_idx = v2_row1_idx + wNumSections; #ifdef DBG_GENSPHERE - assert(v2_row2_idxget_num_vertices()); - int nprims = geom->get_num_prims(); + int nprims = geom->get_num_prims(); - if (nprims==0) { - dxgsg_cat.warning() << "draw_sphere() called with ZERO vertices!!" << endl; - return; - } + if (nprims==0) { + dxgsg_cat.warning() << "draw_sphere() called with ZERO vertices!!" << endl; + return; + } - Geom::VertexIterator vi = geom->make_vertex_iterator(); - Geom::ColorIterator ci; - bool bPerPrimColor = (geom->get_binding(G_COLOR) == G_PER_PRIM); - if (bPerPrimColor) - ci = geom->make_color_iterator(); + Geom::VertexIterator vi = geom->make_vertex_iterator(); + Geom::ColorIterator ci; + bool bPerPrimColor = (geom->get_binding(G_COLOR) == G_PER_PRIM); + if (bPerPrimColor) + ci = geom->make_color_iterator(); - for (int i = 0; i < nprims; i++) { + for (int i = 0; i < nprims; i++) { - DWORD nVerts,nIndices; - Vertexf center = geom->get_next_vertex(vi); - Vertexf edge = geom->get_next_vertex(vi); - LVector3f v = edge - center; - float fRadius = sqrt(dot(v, v)); + DWORD nVerts,nIndices; + Vertexf center = geom->get_next_vertex(vi); + Vertexf edge = geom->get_next_vertex(vi); + LVector3f v = edge - center; + float fRadius = sqrt(dot(v, v)); - size_t vertex_size = draw_prim_setup(geom); + size_t vertex_size = draw_prim_setup(geom); - _pCurFvfBufPtr = _pFvfBufBasePtr; + _pCurFvfBufPtr = _pFvfBufBasePtr; - if (bPerPrimColor) { - GET_NEXT_COLOR(); - } + if (bPerPrimColor) { + GET_NEXT_COLOR(); + } - GenerateSphere(_pCurFvfBufPtr, VERT_BUFFER_SIZE, - _index_buf, D3DMAXNUMVERTICES, - (D3DVECTOR *)¢er, fRadius, - SPHERE_NUMSTACKS, SPHERE_NUMSLICES, - 1.0f, 1.0f, 1.0f, // no scaling factors, do a sphere not ellipsoid - &nVerts,&nIndices,p_flags,vertex_size); + GenerateSphere(_pCurFvfBufPtr, VERT_BUFFER_SIZE, + _index_buf, D3DMAXNUMVERTICES, + (D3DVECTOR *)¢er, fRadius, + SPHERE_NUMSTACKS, SPHERE_NUMSLICES, + 1.0f, 1.0f, 1.0f, // no scaling factors, do a sphere not ellipsoid + &nVerts,&nIndices,p_flags,vertex_size); - // possible optimization: make DP 1 for all spheres call here, since trilist is independent tris. - // indexes couldnt start w/0 tho, need to pass offset to gensph - _d3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, nVerts, _index_buf,nIndices,NULL); - } + // possible optimization: make DP 1 for all spheres call here, since trilist is independent tris. + // indexes couldnt start w/0 tho, need to pass offset to gensph + _d3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, p_flags, _pFvfBufBasePtr, nVerts, _index_buf,nIndices,NULL); + } - _pCurFvfBufPtr = NULL; + _pCurFvfBufPtr = NULL; } //////////////////////////////////////////////////////////////////// @@ -3094,13 +3094,13 @@ draw_sphere(const GeomSphere *geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_color_transform(const ColorMatrixAttribute *attrib) { - _current_color_mat = attrib->get_matrix(); + _current_color_mat = attrib->get_matrix(); - if (_current_color_mat == LMatrix4f::ident_mat()) { // couldnt we a single ptr instead of doing full comparison - _color_transform_enabled = false; - } else { - _color_transform_enabled = true; - } + if (_current_color_mat == LMatrix4f::ident_mat()) { // couldnt we a single ptr instead of doing full comparison + _color_transform_enabled = false; + } else { + _color_transform_enabled = true; + } } //////////////////////////////////////////////////////////////////// @@ -3110,14 +3110,14 @@ issue_color_transform(const ColorMatrixAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_alpha_transform(const AlphaTransformAttribute *attrib) { - _current_alpha_offset= attrib->get_offset(); - _current_alpha_scale = attrib->get_scale(); + _current_alpha_offset= attrib->get_offset(); + _current_alpha_scale = attrib->get_scale(); - if ((_current_alpha_offset == 0.0f) && (_current_alpha_scale == 1.0f)) { - _alpha_transform_enabled = false; - } else { - _alpha_transform_enabled = true; - } + if ((_current_alpha_offset == 0.0f) && (_current_alpha_scale == 1.0f)) { + _alpha_transform_enabled = false; + } else { + _alpha_transform_enabled = true; + } } //////////////////////////////////////////////////////////////////// @@ -3132,31 +3132,31 @@ issue_alpha_transform(const AlphaTransformAttribute *attrib) { //////////////////////////////////////////////////////////////////// TextureContext *DXGraphicsStateGuardian:: prepare_texture(Texture *tex) { - activate(); + activate(); - DXTextureContext *gtc = new DXTextureContext(tex); + DXTextureContext *gtc = new DXTextureContext(tex); #ifdef WBD_GL_MODE - glGenTextures(1, >c->_index); + glGenTextures(1, >c->_index); - bind_texture(gtc); - glPrioritizeTextures(1, >c->_index, >c->_priority); - specify_texture(tex); - apply_texture_immediate(tex); + bind_texture(gtc); + glPrioritizeTextures(1, >c->_index, >c->_priority); + specify_texture(tex); + apply_texture_immediate(tex); #else - if (gtc->CreateTexture(_d3dDevice,_cNumTexPixFmts,_pTexPixFmts) == NULL) { - delete gtc; - return NULL; - } + if (gtc->CreateTexture(_d3dDevice,_cNumTexPixFmts,_pTexPixFmts) == NULL) { + delete gtc; + return NULL; + } #endif // WBD_GL_MODE - bool inserted = mark_prepared_texture(gtc); + bool inserted = mark_prepared_texture(gtc); - // If this assertion fails, the same texture was prepared twice, - // which shouldn't be possible, since the texture itself should - // detect this. - nassertr(inserted, NULL); + // If this assertion fails, the same texture was prepared twice, + // which shouldn't be possible, since the texture itself should + // detect this. + nassertr(inserted, NULL); - return gtc; + return gtc; } //////////////////////////////////////////////////////////////////// @@ -3167,72 +3167,72 @@ prepare_texture(Texture *tex) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: apply_texture(TextureContext *tc) { - if (tc==NULL) { - return; // use enable_texturing to disable/enable - } + if (tc==NULL) { + return; // use enable_texturing to disable/enable + } add_to_texture_record(tc); // activate(); inactive -// bind_texture(tc); +// bind_texture(tc); // specify_texture(tc->_texture); - // Note: if this code changes, make sure to change initialization SetTSS code in init_dx as well - // so DX TSS renderstate matches dxgsg state + // Note: if this code changes, make sure to change initialization SetTSS code in init_dx as well + // so DX TSS renderstate matches dxgsg state - DXTextureContext *dtc = DCAST(DXTextureContext, tc); + DXTextureContext *dtc = DCAST(DXTextureContext, tc); - if( _pCurTexContext == dtc) { - return; // tex already set (and possible problem in state-sorting?) - } - - Texture *tex = tc->_texture; - Texture::WrapMode wrapU,wrapV; - wrapU=tex->get_wrapu(); - wrapV=tex->get_wrapv(); + if( _pCurTexContext == dtc) { + return; // tex already set (and possible problem in state-sorting?) + } - if (wrapU!=_CurTexWrapModeU) { - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,get_texture_wrap_mode(wrapU)); - _CurTexWrapModeU = wrapU; - } - if (wrapV!=_CurTexWrapModeV) { - _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,get_texture_wrap_mode(wrapV)); - _CurTexWrapModeV = wrapV; - } + Texture *tex = tc->_texture; + Texture::WrapMode wrapU,wrapV; + wrapU=tex->get_wrapu(); + wrapV=tex->get_wrapv(); + + if (wrapU!=_CurTexWrapModeU) { + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSU,get_texture_wrap_mode(wrapU)); + _CurTexWrapModeU = wrapU; + } + if (wrapV!=_CurTexWrapModeV) { + _d3dDevice->SetTextureStageState(0,D3DTSS_ADDRESSV,get_texture_wrap_mode(wrapV)); + _CurTexWrapModeV = wrapV; + } /* #ifdef _DEBUG Texture::WrapMode wrapval; - _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSU,(DWORD*)&wrapval); - assert(get_texture_wrap_mode(wrapU) == wrapval); - _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSV,(DWORD*)&wrapval); - assert(get_texture_wrap_mode(wrapV) == wrapval); + _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSU,(DWORD*)&wrapval); + assert(get_texture_wrap_mode(wrapU) == wrapval); + _d3dDevice->GetTextureStageState(0,D3DTSS_ADDRESSV,(DWORD*)&wrapval); + assert(get_texture_wrap_mode(wrapV) == wrapval); #endif */ - int aniso_degree=tex->get_anisotropic_degree(); - Texture::FilterType ft=tex->get_magfilter(); + int aniso_degree=tex->get_anisotropic_degree(); + Texture::FilterType ft=tex->get_magfilter(); - if (aniso_degree>1) { - if (aniso_degree!=_CurTexAnisoDegree) { - _CurTexAnisoDegree = aniso_degree; - _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_ANISOTROPIC ); - _d3dDevice->SetTextureStageState(0, D3DTSS_MAXANISOTROPY,aniso_degree); - } - } else { - if (_CurTexMagFilter!=ft) { + if (aniso_degree>1) { + if (aniso_degree!=_CurTexAnisoDegree) { + _CurTexAnisoDegree = aniso_degree; + _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_ANISOTROPIC ); + _d3dDevice->SetTextureStageState(0, D3DTSS_MAXANISOTROPY,aniso_degree); + } + } else { + if (_CurTexMagFilter!=ft) { - _CurTexMagFilter = ft; - _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER,(ft==Texture::FT_nearest)? D3DTFG_POINT : D3DTFG_LINEAR); + _CurTexMagFilter = ft; + _d3dDevice->SetTextureStageState(0, D3DTSS_MAGFILTER,(ft==Texture::FT_nearest)? D3DTFG_POINT : D3DTFG_LINEAR); #ifdef _DEBUG - if((ft!=Texture::FT_linear)&&(ft!=Texture::FT_nearest)) { - dxgsg_cat.error() << "MipMap filter type setting for texture magfilter makes no sense, texture: " << tex->get_name() << "\n"; - } + if((ft!=Texture::FT_linear)&&(ft!=Texture::FT_nearest)) { + dxgsg_cat.error() << "MipMap filter type setting for texture magfilter makes no sense, texture: " << tex->get_name() << "\n"; + } #endif - } - } + } + } #ifdef _DEBUG - assert(Texture::FT_linear_mipmap_linear < 8); + assert(Texture::FT_linear_mipmap_linear < 8); #endif /* enum FilterType { @@ -3240,84 +3240,84 @@ apply_texture(TextureContext *tc) { FT_nearest_mipmap_linear, FT_linear_mipmap_linear, }; */ static D3DTEXTUREMINFILTER PandaToD3DMinType[8] = - {D3DTFN_POINT,D3DTFN_LINEAR,D3DTFN_POINT,D3DTFN_LINEAR,D3DTFN_POINT,D3DTFN_LINEAR}; + {D3DTFN_POINT,D3DTFN_LINEAR,D3DTFN_POINT,D3DTFN_LINEAR,D3DTFN_POINT,D3DTFN_LINEAR}; static D3DTEXTUREMIPFILTER PandaToD3DMipType[8] = - {D3DTFP_NONE,D3DTFP_NONE,D3DTFP_POINT,D3DTFP_POINT,D3DTFP_LINEAR,D3DTFP_LINEAR}; + {D3DTFP_NONE,D3DTFP_NONE,D3DTFP_POINT,D3DTFP_POINT,D3DTFP_LINEAR,D3DTFP_LINEAR}; - ft=tex->get_minfilter(); + ft=tex->get_minfilter(); - if ((ft!=_CurTexMinFilter)||(aniso_degree!=_CurTexAnisoDegree)) { + if ((ft!=_CurTexMinFilter)||(aniso_degree!=_CurTexAnisoDegree)) { #ifdef _DEBUG - if(ft > Texture::FT_linear_mipmap_linear) { - dxgsg_cat.error() << "Unknown tex filter type for tex: " << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; - return; - } + if(ft > Texture::FT_linear_mipmap_linear) { + dxgsg_cat.error() << "Unknown tex filter type for tex: " << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; + return; + } #endif - D3DTEXTUREMINFILTER minfilter = PandaToD3DMinType[(DWORD)ft]; - D3DTEXTUREMIPFILTER mipfilter = PandaToD3DMipType[(DWORD)ft]; + D3DTEXTUREMINFILTER minfilter = PandaToD3DMinType[(DWORD)ft]; + D3DTEXTUREMIPFILTER mipfilter = PandaToD3DMipType[(DWORD)ft]; /* - switch (ft) { - case Texture::FT_nearest: - minfilter = D3DTFN_POINT; - mipfilter = D3DTFP_NONE; - break; - case Texture::FT_linear: - minfilter = D3DTFN_LINEAR; - mipfilter = D3DTFP_NONE; - break; - case Texture::FT_nearest_mipmap_nearest: - minfilter = D3DTFN_POINT; - mipfilter = D3DTFP_POINT; - break; - case Texture::FT_linear_mipmap_nearest: - minfilter = D3DTFN_LINEAR; - mipfilter = D3DTFP_POINT; - break; - case Texture::FT_nearest_mipmap_linear: - minfilter = D3DTFN_POINT; - mipfilter = D3DTFP_LINEAR; - break; - case Texture::FT_linear_mipmap_linear: - minfilter = D3DTFN_LINEAR; - mipfilter = D3DTFP_LINEAR; - break; - default: - dxgsg_cat.error() << "Unknown tex filter type for tex: " << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; - } -*/ + switch (ft) { + case Texture::FT_nearest: + minfilter = D3DTFN_POINT; + mipfilter = D3DTFP_NONE; + break; + case Texture::FT_linear: + minfilter = D3DTFN_LINEAR; + mipfilter = D3DTFP_NONE; + break; + case Texture::FT_nearest_mipmap_nearest: + minfilter = D3DTFN_POINT; + mipfilter = D3DTFP_POINT; + break; + case Texture::FT_linear_mipmap_nearest: + minfilter = D3DTFN_LINEAR; + mipfilter = D3DTFP_POINT; + break; + case Texture::FT_nearest_mipmap_linear: + minfilter = D3DTFN_POINT; + mipfilter = D3DTFP_LINEAR; + break; + case Texture::FT_linear_mipmap_linear: + minfilter = D3DTFN_LINEAR; + mipfilter = D3DTFP_LINEAR; + break; + default: + dxgsg_cat.error() << "Unknown tex filter type for tex: " << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; + } +*/ - #ifdef _DEBUG - if((!(dtc->_bHasMipMaps))&&(mipfilter!=D3DTFP_NONE)) { - dxgsg_cat.error() << "Trying to set mipmap filtering for texture with no generated mipmaps!! texname:" << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; - mipfilter=D3DTFP_NONE; - } - #endif + #ifdef _DEBUG + if((!(dtc->_bHasMipMaps))&&(mipfilter!=D3DTFP_NONE)) { + dxgsg_cat.error() << "Trying to set mipmap filtering for texture with no generated mipmaps!! texname:" << tex->get_name() << " filter: "<<(DWORD)ft<<"\n"; + mipfilter=D3DTFP_NONE; + } + #endif - if (aniso_degree>1) { - minfilter=D3DTFN_ANISOTROPIC; - } + if (aniso_degree>1) { + minfilter=D3DTFN_ANISOTROPIC; + } - _d3dDevice->SetTextureStageState(0, D3DTSS_MINFILTER, minfilter); - _d3dDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, mipfilter); + _d3dDevice->SetTextureStageState(0, D3DTSS_MINFILTER, minfilter); + _d3dDevice->SetTextureStageState(0, D3DTSS_MIPFILTER, mipfilter); - _CurTexMinFilter = ft; - _CurTexAnisoDegree = aniso_degree; - } + _CurTexMinFilter = ft; + _CurTexAnisoDegree = aniso_degree; + } - // bugbug: does this handle the case of untextured geometry? - // we dont see this bug cause we never mix textured/untextured + // bugbug: does this handle the case of untextured geometry? + // we dont see this bug cause we never mix textured/untextured - _d3dDevice->SetTexture(0, dtc->_surface ); + _d3dDevice->SetTexture(0, dtc->_surface ); #if 0 - if (dtc!=NULL) { - dxgsg_cat.spam() << "Setting active DX texture: " << dtc->_tex->get_name() << "\n"; - } + if (dtc!=NULL) { + dxgsg_cat.spam() << "Setting active DX texture: " << dtc->_tex->get_name() << "\n"; + } #endif - _pCurTexContext = dtc; // enable_texturing needs this + _pCurTexContext = dtc; // enable_texturing needs this } //////////////////////////////////////////////////////////////////// @@ -3328,40 +3328,40 @@ apply_texture(TextureContext *tc) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: release_texture(TextureContext *tc) { - DXTextureContext *gtc = DCAST(DXTextureContext, tc); - Texture *tex = tc->_texture; + DXTextureContext *gtc = DCAST(DXTextureContext, tc); + Texture *tex = tc->_texture; - gtc->DeleteTexture(); - bool erased = unmark_prepared_texture(gtc); + gtc->DeleteTexture(); + bool erased = unmark_prepared_texture(gtc); - // If this assertion fails, a texture was released that hadn't been - // prepared (or a texture was released twice). - nassertv(erased); + // If this assertion fails, a texture was released that hadn't been + // prepared (or a texture was released twice). + nassertv(erased); - tex->clear_gsg(this); + tex->clear_gsg(this); - delete gtc; + delete gtc; } #if 1 void DXGraphicsStateGuardian:: copy_texture(TextureContext *tc, const DisplayRegion *dr) { - dxgsg_cat.fatal() << "DX copy_texture unimplemented!!!"; + dxgsg_cat.fatal() << "DX copy_texture unimplemented!!!"; } #else static int logs[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, - 4096, 0}; + 4096, 0}; // This function returns the smallest power of two greater than or // equal to x. static int binary_log_cap(const int x) { - int i = 0; - for (; (x > logs[i]) && (logs[i] != 0); ++i); - if (logs[i] == 0) - return 4096; - return logs[i]; + int i = 0; + for (; (x > logs[i]) && (logs[i] != 0); ++i); + if (logs[i] == 0) + return 4096; + return logs[i]; } //////////////////////////////////////////////////////////////////// @@ -3373,37 +3373,37 @@ static int binary_log_cap(const int x) { void DXGraphicsStateGuardian:: copy_texture(TextureContext *tc, const DisplayRegion *dr) { - nassertv(tc != NULL && dr != NULL); - activate(); + nassertv(tc != NULL && dr != NULL); + activate(); - Texture *tex = tc->_texture; + Texture *tex = tc->_texture; - // Determine the size of the grab from the given display region - // If the requested region is not a power of two, grab a region that is - // a power of two that contains the requested region - int xo, yo, req_w, req_h; - dr->get_region_pixels(xo, yo, req_w, req_h); - int w = binary_log_cap(req_w); - int h = binary_log_cap(req_h); - if (w != req_w || h != req_h) { - tex->_requested_w = req_w; - tex->_requested_h = req_h; - tex->_has_requested_size = true; - } + // Determine the size of the grab from the given display region + // If the requested region is not a power of two, grab a region that is + // a power of two that contains the requested region + int xo, yo, req_w, req_h; + dr->get_region_pixels(xo, yo, req_w, req_h); + int w = binary_log_cap(req_w); + int h = binary_log_cap(req_h); + if (w != req_w || h != req_h) { + tex->_requested_w = req_w; + tex->_requested_h = req_h; + tex->_has_requested_size = true; + } - PixelBuffer *pb = tex->_pbuffer; + PixelBuffer *pb = tex->_pbuffer; - pb->set_xorg(xo); - pb->set_yorg(yo); - pb->set_xsize(w); - pb->set_ysize(h); + pb->set_xorg(xo); + pb->set_yorg(yo); + pb->set_xsize(w); + pb->set_ysize(h); - bind_texture(tc); - glCopyTexImage2D( GL_TEXTURE_2D, tex->get_level(), - get_internal_image_format(pb->get_format()), - pb->get_xorg(), pb->get_yorg(), - pb->get_xsize(), pb->get_ysize(), pb->get_border() ); + bind_texture(tc); + glCopyTexImage2D( GL_TEXTURE_2D, tex->get_level(), + get_internal_image_format(pb->get_format()), + pb->get_xorg(), pb->get_yorg(), + pb->get_xsize(), pb->get_ysize(), pb->get_border() ); } #endif @@ -3414,12 +3414,12 @@ copy_texture(TextureContext *tc, const DisplayRegion *dr) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: copy_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb) { - dxgsg_cat.fatal() << "DX copy_texture unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DX copy_texture unimplemented!!!"; + return; - activate(); - set_read_buffer(rb); - copy_texture(tc, dr); + activate(); + set_read_buffer(rb); + copy_texture(tc, dr); } //////////////////////////////////////////////////////////////////// @@ -3430,80 +3430,80 @@ copy_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb void DXGraphicsStateGuardian:: draw_texture(TextureContext *tc, const DisplayRegion *dr) { - dxgsg_cat.fatal() << "DXGSG draw_texture unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DXGSG draw_texture unimplemented!!!"; + return; - nassertv(tc != NULL && dr != NULL); - activate(); + nassertv(tc != NULL && dr != NULL); + activate(); #ifdef WBD_GL_MODE - Texture *tex = tc->_texture; + Texture *tex = tc->_texture; - DisplayRegionStack old_dr = push_display_region(dr); - prepare_display_region(); + DisplayRegionStack old_dr = push_display_region(dr); + prepare_display_region(); - NodeAttributes state; - CullFaceAttribute *cfa = new CullFaceAttribute; - cfa->set_mode(CullFaceProperty::M_cull_none); - DepthTestAttribute *dta = new DepthTestAttribute; - dta->set_mode(DepthTestProperty::M_none); - DepthWriteAttribute *dwa = new DepthWriteAttribute; - dwa->set_off(); - TextureAttribute *ta = new TextureAttribute; - ta->set_on(tex); - TextureApplyAttribute *taa = new TextureApplyAttribute; - taa->set_mode(TextureApplyProperty::M_decal); + NodeAttributes state; + CullFaceAttribute *cfa = new CullFaceAttribute; + cfa->set_mode(CullFaceProperty::M_cull_none); + DepthTestAttribute *dta = new DepthTestAttribute; + dta->set_mode(DepthTestProperty::M_none); + DepthWriteAttribute *dwa = new DepthWriteAttribute; + dwa->set_off(); + TextureAttribute *ta = new TextureAttribute; + ta->set_on(tex); + TextureApplyAttribute *taa = new TextureApplyAttribute; + taa->set_mode(TextureApplyProperty::M_decal); - state.set_attribute(LightTransition::get_class_type(), - new LightAttribute); - state.set_attribute(ColorMaskTransition::get_class_type(), - new ColorMaskAttribute); - state.set_attribute(RenderModeTransition::get_class_type(), - new RenderModeAttribute); - state.set_attribute(TexMatrixTransition::get_class_type(), - new TexMatrixAttribute); - state.set_attribute(TransformTransition::get_class_type(), - new TransformAttribute); - state.set_attribute(ColorBlendTransition::get_class_type(), - new ColorBlendAttribute); - state.set_attribute(CullFaceTransition::get_class_type(), cfa); - state.set_attribute(DepthTestTransition::get_class_type(), dta); - state.set_attribute(DepthWriteTransition::get_class_type(), dwa); - state.set_attribute(TextureTransition::get_class_type(), ta); - state.set_attribute(TextureApplyTransition::get_class_type(), taa); - set_state(state, false); + state.set_attribute(LightTransition::get_class_type(), + new LightAttribute); + state.set_attribute(ColorMaskTransition::get_class_type(), + new ColorMaskAttribute); + state.set_attribute(RenderModeTransition::get_class_type(), + new RenderModeAttribute); + state.set_attribute(TexMatrixTransition::get_class_type(), + new TexMatrixAttribute); + state.set_attribute(TransformTransition::get_class_type(), + new TransformAttribute); + state.set_attribute(ColorBlendTransition::get_class_type(), + new ColorBlendAttribute); + state.set_attribute(CullFaceTransition::get_class_type(), cfa); + state.set_attribute(DepthTestTransition::get_class_type(), dta); + state.set_attribute(DepthWriteTransition::get_class_type(), dwa); + state.set_attribute(TextureTransition::get_class_type(), ta); + state.set_attribute(TextureApplyTransition::get_class_type(), taa); + set_state(state, false); - // We set up an orthographic projection that defines our entire - // viewport to the range [0..1] in both dimensions. Then, when we - // create a unit square polygon below, it will exactly fill the - // viewport (and thus exactly fill the display region). - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, 1, 0, 1); + // We set up an orthographic projection that defines our entire + // viewport to the range [0..1] in both dimensions. Then, when we + // create a unit square polygon below, it will exactly fill the + // viewport (and thus exactly fill the display region). + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, 1, 0, 1); - float txl, txr, tyt, tyb; - txl = tyb = 0.; - if (tex->_has_requested_size) { - txr = ((float)(tex->_requested_w)) / ((float)(tex->_pbuffer->get_xsize())); - tyt = ((float)(tex->_requested_h)) / ((float)(tex->_pbuffer->get_ysize())); - } else { - txr = tyt = 1.; - } + float txl, txr, tyt, tyb; + txl = tyb = 0.; + if (tex->_has_requested_size) { + txr = ((float)(tex->_requested_w)) / ((float)(tex->_pbuffer->get_xsize())); + tyt = ((float)(tex->_requested_h)) / ((float)(tex->_pbuffer->get_ysize())); + } else { + txr = tyt = 1.; + } - // This two-triangle strip is actually a quad. But it's usually - // better to render quads as tristrips anyway. - glBegin(GL_TRIANGLE_STRIP); - glTexCoord2f(txl, tyb); glVertex2i(0, 0); - glTexCoord2f(txr, tyb); glVertex2i(1, 0); - glTexCoord2f(txl, tyt); glVertex2i(0, 1); - glTexCoord2f(txr, tyt); glVertex2i(1, 1); - glEnd(); + // This two-triangle strip is actually a quad. But it's usually + // better to render quads as tristrips anyway. + glBegin(GL_TRIANGLE_STRIP); + glTexCoord2f(txl, tyb); glVertex2i(0, 0); + glTexCoord2f(txr, tyb); glVertex2i(1, 0); + glTexCoord2f(txl, tyt); glVertex2i(0, 1); + glTexCoord2f(txr, tyt); glVertex2i(1, 1); + glEnd(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); - pop_display_region(old_dr); + pop_display_region(old_dr); #endif // WBD_GL_MODE } @@ -3515,12 +3515,12 @@ draw_texture(TextureContext *tc, const DisplayRegion *dr) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb) { - dxgsg_cat.fatal() << "DXGSG draw_texture unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DXGSG draw_texture unimplemented!!!"; + return; - activate(); - set_draw_buffer(rb); - draw_texture(tc, dr); + activate(); + set_draw_buffer(rb); + draw_texture(tc, dr); } //////////////////////////////////////////////////////////////////// @@ -3530,23 +3530,23 @@ draw_texture(TextureContext *tc, const DisplayRegion *dr, const RenderBuffer &rb //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb) { - nassertv(tc != NULL && pb != NULL); - activate(); + nassertv(tc != NULL && pb != NULL); + activate(); - Texture *tex = tc->_texture; + Texture *tex = tc->_texture; - int w = tex->_pbuffer->get_xsize(); - int h = tex->_pbuffer->get_ysize(); + int w = tex->_pbuffer->get_xsize(); + int h = tex->_pbuffer->get_ysize(); - PT(DisplayRegion) dr = _win->make_scratch_display_region(w, h); + PT(DisplayRegion) dr = _win->make_scratch_display_region(w, h); - FrameBufferStack old_fb = push_frame_buffer - (get_render_buffer(RenderBuffer::T_back | RenderBuffer::T_depth), - dr); + FrameBufferStack old_fb = push_frame_buffer + (get_render_buffer(RenderBuffer::T_back | RenderBuffer::T_depth), + dr); - texture_to_pixel_buffer(tc, pb, dr); + texture_to_pixel_buffer(tc, pb, dr); - pop_frame_buffer(old_fb); + pop_frame_buffer(old_fb); } //////////////////////////////////////////////////////////////////// @@ -3556,24 +3556,24 @@ texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb, - const DisplayRegion *dr) { - nassertv(tc != NULL && pb != NULL && dr != NULL); - activate(); + const DisplayRegion *dr) { + nassertv(tc != NULL && pb != NULL && dr != NULL); + activate(); - Texture *tex = tc->_texture; + Texture *tex = tc->_texture; - // Do a deep copy to initialize the pixel buffer - pb->copy(tex->_pbuffer); + // Do a deep copy to initialize the pixel buffer + pb->copy(tex->_pbuffer); - // If the image was empty, we need to render the texture into the frame - // buffer and then copy the results into the pixel buffer's image - if (pb->_image.empty()) { - int w = pb->get_xsize(); - int h = pb->get_ysize(); - draw_texture(tc, dr); - pb->_image = PTA_uchar(w * h * pb->get_num_components()); - copy_pixel_buffer(pb, dr); - } + // If the image was empty, we need to render the texture into the frame + // buffer and then copy the results into the pixel buffer's image + if (pb->_image.empty()) { + int w = pb->get_xsize(); + int h = pb->get_ysize(); + draw_texture(tc, dr); + pb->_image = PTA_uchar(w * h * pb->get_num_components()); + copy_pixel_buffer(pb, dr); + } } //////////////////////////////////////////////////////////////////// @@ -3586,30 +3586,30 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) { extern HRESULT ConvertDDSurftoPixBuf(PixelBuffer *pixbuf,LPDIRECTDRAWSURFACE7 pDDSurf); - nassertv(pb != NULL && dr != NULL); + nassertv(pb != NULL && dr != NULL); - int xo, yo, w, h; - dr->get_region_pixels(xo, yo, w, h); + int xo, yo, w, h; + dr->get_region_pixels(xo, yo, w, h); - // only handled simple case - nassertv(xo==0); - nassertv(yo==0); - nassertv(w==pb->get_xsize()); - nassertv(h==pb->get_ysize()); + // only handled simple case + nassertv(xo==0); + nassertv(yo==0); + nassertv(w==pb->get_xsize()); + nassertv(h==pb->get_ysize()); -/* - set_pack_alignment(1); - glReadPixels( pb->get_xorg() + xo, pb->get_yorg() + yo, - pb->get_xsize(), pb->get_ysize(), - get_external_image_format(pb->get_format()), - get_image_type(pb->get_image_type()), - pb->_image.p() ); -*/ +/* + set_pack_alignment(1); + glReadPixels( pb->get_xorg() + xo, pb->get_yorg() + yo, + pb->get_xsize(), pb->get_ysize(), + get_external_image_format(pb->get_format()), + get_image_type(pb->get_image_type()), + pb->_image.p() ); +*/ (void) ConvertDDSurftoPixBuf(pb,((_cur_read_pixel_buffer & RenderBuffer::T_back) ? _back : _pri)); - nassertv(!pb->_image.empty()); + nassertv(!pb->_image.empty()); } //////////////////////////////////////////////////////////////////// @@ -3619,9 +3619,9 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const RenderBuffer &rb) { - set_read_buffer(rb); - copy_pixel_buffer(pb, dr); + const RenderBuffer &rb) { + set_read_buffer(rb); + copy_pixel_buffer(pb, dr); } //////////////////////////////////////////////////////////////////// @@ -3631,126 +3631,126 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const NodeAttributes& na) { + const NodeAttributes& na) { - dxgsg_cat.fatal() << "DXGSG draw_pixel_buffer unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DXGSG draw_pixel_buffer unimplemented!!!"; + return; #ifdef WBD_GL_MODE - nassertv(pb != NULL && dr != NULL); - nassertv(!pb->_image.empty()); - activate(); + nassertv(pb != NULL && dr != NULL); + nassertv(!pb->_image.empty()); + activate(); - DisplayRegionStack old_dr = push_display_region(dr); - prepare_display_region(); + DisplayRegionStack old_dr = push_display_region(dr); + prepare_display_region(); - NodeAttributes state(na); - state.set_attribute(LightTransition::get_class_type(), - new LightAttribute); - state.set_attribute(TextureTransition::get_class_type(), - new TextureAttribute); - state.set_attribute(TransformTransition::get_class_type(), - new TransformAttribute); - state.set_attribute(ColorBlendTransition::get_class_type(), - new ColorBlendAttribute); - state.set_attribute(StencilTransition::get_class_type(), - new StencilAttribute); + NodeAttributes state(na); + state.set_attribute(LightTransition::get_class_type(), + new LightAttribute); + state.set_attribute(TextureTransition::get_class_type(), + new TextureAttribute); + state.set_attribute(TransformTransition::get_class_type(), + new TransformAttribute); + state.set_attribute(ColorBlendTransition::get_class_type(), + new ColorBlendAttribute); + state.set_attribute(StencilTransition::get_class_type(), + new StencilAttribute); - switch (pb->get_format()) { - case PixelBuffer::F_depth_component: - { - ColorMaskAttribute *cma = new ColorMaskAttribute; - cma->set_mask(0); - DepthTestAttribute *dta = new DepthTestAttribute; - dta->set_mode(DepthTestProperty::M_always); - DepthWriteAttribute *dwa = new DepthWriteAttribute; - dwa->set_off(); - state.set_attribute(ColorMaskTransition::get_class_type(), cma); - state.set_attribute(DepthTestTransition::get_class_type(), dta); - state.set_attribute(DepthWriteTransition::get_class_type(), dwa); - } - break; + switch (pb->get_format()) { + case PixelBuffer::F_depth_component: + { + ColorMaskAttribute *cma = new ColorMaskAttribute; + cma->set_mask(0); + DepthTestAttribute *dta = new DepthTestAttribute; + dta->set_mode(DepthTestProperty::M_always); + DepthWriteAttribute *dwa = new DepthWriteAttribute; + dwa->set_off(); + state.set_attribute(ColorMaskTransition::get_class_type(), cma); + state.set_attribute(DepthTestTransition::get_class_type(), dta); + state.set_attribute(DepthWriteTransition::get_class_type(), dwa); + } + break; - case PixelBuffer::F_rgb: - case PixelBuffer::F_rgb5: - case PixelBuffer::F_rgb8: - case PixelBuffer::F_rgb12: - case PixelBuffer::F_rgba: - case PixelBuffer::F_rgba4: - case PixelBuffer::F_rgba8: - case PixelBuffer::F_rgba12: - { - ColorMaskAttribute *cma = new ColorMaskAttribute; - DepthTestAttribute *dta = new DepthTestAttribute; - dta->set_mode(DepthTestProperty::M_none); - DepthWriteAttribute *dwa = new DepthWriteAttribute; - dwa->set_off(); - state.set_attribute(ColorMaskTransition::get_class_type(), cma); - state.set_attribute(DepthTestTransition::get_class_type(), dta); - state.set_attribute(DepthWriteTransition::get_class_type(), dwa); - } - break; - default: - dxgsg_cat.error() - << "draw_pixel_buffer(): unknown buffer format" << endl; - break; - } + case PixelBuffer::F_rgb: + case PixelBuffer::F_rgb5: + case PixelBuffer::F_rgb8: + case PixelBuffer::F_rgb12: + case PixelBuffer::F_rgba: + case PixelBuffer::F_rgba4: + case PixelBuffer::F_rgba8: + case PixelBuffer::F_rgba12: + { + ColorMaskAttribute *cma = new ColorMaskAttribute; + DepthTestAttribute *dta = new DepthTestAttribute; + dta->set_mode(DepthTestProperty::M_none); + DepthWriteAttribute *dwa = new DepthWriteAttribute; + dwa->set_off(); + state.set_attribute(ColorMaskTransition::get_class_type(), cma); + state.set_attribute(DepthTestTransition::get_class_type(), dta); + state.set_attribute(DepthWriteTransition::get_class_type(), dwa); + } + break; + default: + dxgsg_cat.error() + << "draw_pixel_buffer(): unknown buffer format" << endl; + break; + } - set_state(state, false); + set_state(state, false); - enable_color_material(false); - set_unpack_alignment(1); + enable_color_material(false); + set_unpack_alignment(1); - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D(0, _win->get_width(), - 0, _win->get_height()); + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0, _win->get_width(), + 0, _win->get_height()); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glDrawPixels(" << pb->get_xsize() << ", " << pb->get_ysize() - << ", "; - switch (get_external_image_format(pb->get_format())) { - case GL_DEPTH_COMPONENT: - dxgsg_cat.debug(false) << "GL_DEPTH_COMPONENT, "; - break; - case GL_RGB: - dxgsg_cat.debug(false) << "GL_RGB, "; - break; - case GL_RGBA: - dxgsg_cat.debug(false) << "GL_RGBA, "; - break; - default: - dxgsg_cat.debug(false) << "unknown, "; - break; - } - switch (get_image_type(pb->get_image_type())) { - case GL_UNSIGNED_BYTE: - dxgsg_cat.debug(false) << "GL_UNSIGNED_BYTE, "; - break; - case GL_float: - dxgsg_cat.debug(false) << "GL_float, "; - break; - default: - dxgsg_cat.debug(false) << "unknown, "; - break; - } - dxgsg_cat.debug(false) - << (void *)pb->_image.p() << ")" << endl; + dxgsg_cat.debug() + << "glDrawPixels(" << pb->get_xsize() << ", " << pb->get_ysize() + << ", "; + switch (get_external_image_format(pb->get_format())) { + case GL_DEPTH_COMPONENT: + dxgsg_cat.debug(false) << "GL_DEPTH_COMPONENT, "; + break; + case GL_RGB: + dxgsg_cat.debug(false) << "GL_RGB, "; + break; + case GL_RGBA: + dxgsg_cat.debug(false) << "GL_RGBA, "; + break; + default: + dxgsg_cat.debug(false) << "unknown, "; + break; + } + switch (get_image_type(pb->get_image_type())) { + case GL_UNSIGNED_BYTE: + dxgsg_cat.debug(false) << "GL_UNSIGNED_BYTE, "; + break; + case GL_float: + dxgsg_cat.debug(false) << "GL_float, "; + break; + default: + dxgsg_cat.debug(false) << "unknown, "; + break; + } + dxgsg_cat.debug(false) + << (void *)pb->_image.p() << ")" << endl; #endif - glRasterPos2i( pb->get_xorg(), pb->get_yorg() ); - glDrawPixels( pb->get_xsize(), pb->get_ysize(), - get_external_image_format(pb->get_format()), - get_image_type(pb->get_image_type()), - pb->_image.p() ); + glRasterPos2i( pb->get_xorg(), pb->get_yorg() ); + glDrawPixels( pb->get_xsize(), pb->get_ysize(), + get_external_image_format(pb->get_format()), + get_image_type(pb->get_image_type()), + pb->_image.p() ); - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); - pop_display_region(old_dr); + pop_display_region(old_dr); #endif // WBD_GL_MODE } @@ -3761,10 +3761,10 @@ draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const RenderBuffer &rb, const NodeAttributes& na) { - activate(); - set_read_buffer(rb); - draw_pixel_buffer(pb, dr, na); + const RenderBuffer &rb, const NodeAttributes& na) { + activate(); + set_read_buffer(rb); + draw_pixel_buffer(pb, dr, na); } //////////////////////////////////////////////////////////////////// @@ -3773,13 +3773,13 @@ draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::apply_material( const Material* material ) { - D3DMATERIAL7 cur_material; - cur_material.dcvDiffuse = *(D3DCOLORVALUE *)(material->get_diffuse().get_data()); - cur_material.dcvAmbient = *(D3DCOLORVALUE *)(material->get_ambient().get_data()); - cur_material.dcvSpecular = *(D3DCOLORVALUE *)(material->get_specular().get_data()); - cur_material.dcvEmissive = *(D3DCOLORVALUE *)(material->get_emission().get_data()); - cur_material.dvPower = material->get_shininess(); - _d3dDevice->SetMaterial(&cur_material); + D3DMATERIAL7 cur_material; + cur_material.dcvDiffuse = *(D3DCOLORVALUE *)(material->get_diffuse().get_data()); + cur_material.dcvAmbient = *(D3DCOLORVALUE *)(material->get_ambient().get_data()); + cur_material.dcvSpecular = *(D3DCOLORVALUE *)(material->get_specular().get_data()); + cur_material.dcvEmissive = *(D3DCOLORVALUE *)(material->get_emission().get_data()); + cur_material.dvPower = material->get_shininess(); + _d3dDevice->SetMaterial(&cur_material); } //////////////////////////////////////////////////////////////////// @@ -3790,48 +3790,48 @@ void DXGraphicsStateGuardian::apply_material( const Material* material ) { void DXGraphicsStateGuardian:: apply_fog(Fog *fog) { - Fog::Mode panda_fogmode = fog->get_mode(); - D3DFOGMODE d3dfogmode = get_fog_mode_type(panda_fogmode); + Fog::Mode panda_fogmode = fog->get_mode(); + D3DFOGMODE d3dfogmode = get_fog_mode_type(panda_fogmode); - if(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE ) { - _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, d3dfogmode); - } else { + if(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE ) { + _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, d3dfogmode); + } else { - // vtx fog looks crappy if you have large polygons in the foreground - if(dx_no_vertex_fog) - return; + // vtx fog looks crappy if you have large polygons in the foreground + if(dx_no_vertex_fog) + return; - //if(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGVERTEX ) - // every card is going to have vertex fog, since it's implemented in d3d runtime + //if(_D3DDevDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGVERTEX ) + // every card is going to have vertex fog, since it's implemented in d3d runtime _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE, d3dfogmode); - } + } - switch (panda_fogmode) { - case Fog::M_linear: - { - float fog_start,fog_end; - fog->get_range(fog_start,fog_end); + switch (panda_fogmode) { + case Fog::M_linear: + { + float fog_start,fog_end; + fog->get_range(fog_start,fog_end); - _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGSTART, - *((LPDWORD) (&fog_start)) ); - _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGEND, - *((LPDWORD) (&fog_end)) ); - } - break; - case Fog::M_exponential: - case Fog::M_exponential_squared: - { - float fog_density = fog->get_density(); - _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGDENSITY, - *((LPDWORD) (&fog_density)) ); - } - break; - } + _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGSTART, + *((LPDWORD) (&fog_start)) ); + _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGEND, + *((LPDWORD) (&fog_end)) ); + } + break; + case Fog::M_exponential: + case Fog::M_exponential_squared: + { + float fog_density = fog->get_density(); + _d3dDevice->SetRenderState( D3DRENDERSTATE_FOGDENSITY, + *((LPDWORD) (&fog_density)) ); + } + break; + } - Colorf fog_colr = fog->get_color(); - _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, - D3DRGBA(fog_colr[0], fog_colr[1], fog_colr[2], 0.0f)); + Colorf fog_colr = fog->get_color(); + _d3dDevice->SetRenderState(D3DRENDERSTATE_FOGCOLOR, + D3DRGBA(fog_colr[0], fog_colr[1], fog_colr[2], 0.0f)); } //////////////////////////////////////////////////////////////////// @@ -3840,79 +3840,79 @@ apply_fog(Fog *fog) { // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::apply_light( PointLight* light ) { - // The light position will be relative to the current matrix, so - // we have to know what the current matrix is. Find a better - // solution later. + // The light position will be relative to the current matrix, so + // we have to know what the current matrix is. Find a better + // solution later. #ifdef WBD_GL_MODE #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glMatrixMode(GL_MODELVIEW)" << endl; - dxgsg_cat.debug() - << "glPushMatrix()" << endl; - dxgsg_cat.debug() - << "glLoadIdentity()" << endl; + dxgsg_cat.debug() + << "glMatrixMode(GL_MODELVIEW)" << endl; + dxgsg_cat.debug() + << "glPushMatrix()" << endl; + dxgsg_cat.debug() + << "glLoadIdentity()" << endl; #endif - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); - glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) - .get_data()); + glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) + .get_data()); - GLenum id = get_light_id( _cur_light_id ); - Colorf black(0, 0, 0, 1); - glLightfv(id, GL_AMBIENT, black.get_data()); - glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); - glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); + GLenum id = get_light_id( _cur_light_id ); + Colorf black(0, 0, 0, 1); + glLightfv(id, GL_AMBIENT, black.get_data()); + glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); + glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); - // Position needs to specify x, y, z, and w - // w == 1 implies non-infinite position - LPoint3f pos = get_rel_pos( light, _current_projection_node ); - LPoint4f fpos( pos[0], pos[1], pos[2], 1 ); - glLightfv( id, GL_POSITION, fpos.get_data() ); + // Position needs to specify x, y, z, and w + // w == 1 implies non-infinite position + LPoint3f pos = get_rel_pos( light, _current_projection_node ); + LPoint4f fpos( pos[0], pos[1], pos[2], 1 ); + glLightfv( id, GL_POSITION, fpos.get_data() ); - // GL_SPOT_DIRECTION is not significant when cutoff == 180 + // GL_SPOT_DIRECTION is not significant when cutoff == 180 - // Exponent == 0 implies uniform light distribution - glLightf( id, GL_SPOT_EXPONENT, 0 ); + // Exponent == 0 implies uniform light distribution + glLightf( id, GL_SPOT_EXPONENT, 0 ); - // Cutoff == 180 means uniform point light source - glLightf( id, GL_SPOT_CUTOFF, 180.0 ); + // Cutoff == 180 means uniform point light source + glLightf( id, GL_SPOT_CUTOFF, 180.0 ); - glLightf( id, GL_CONSTANT_ATTENUATION, - light->get_constant_attenuation() ); - glLightf( id, GL_LINEAR_ATTENUATION, - light->get_linear_attenuation() ); - glLightf( id, GL_QUADRATIC_ATTENUATION, - light->get_quadratic_attenuation() ); + glLightf( id, GL_CONSTANT_ATTENUATION, + light->get_constant_attenuation() ); + glLightf( id, GL_LINEAR_ATTENUATION, + light->get_linear_attenuation() ); + glLightf( id, GL_QUADRATIC_ATTENUATION, + light->get_quadratic_attenuation() ); - glPopMatrix(); + glPopMatrix(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glPopMatrix()" << endl; + dxgsg_cat.debug() + << "glPopMatrix()" << endl; #endif #else - D3DCOLORVALUE black; - black.r = black.g = black.b = black.a = 0.0f; - D3DLIGHT7 alight; - alight.dltType = D3DLIGHT_POINT; - alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); - alight.dcvAmbient = black ; - alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); + D3DCOLORVALUE black; + black.r = black.g = black.b = black.a = 0.0f; + D3DLIGHT7 alight; + alight.dltType = D3DLIGHT_POINT; + alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); + alight.dcvAmbient = black ; + alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); - // Position needs to specify x, y, z, and w - // w == 1 implies non-infinite position - alight.dvPosition = *(D3DVECTOR *)(get_rel_pos( light, _current_root_node ).get_data()); + // Position needs to specify x, y, z, and w + // w == 1 implies non-infinite position + alight.dvPosition = *(D3DVECTOR *)(get_rel_pos( light, _current_root_node ).get_data()); - alight.dvRange = D3DLIGHT_RANGE_MAX; - alight.dvFalloff = 1.0f; + alight.dvRange = D3DLIGHT_RANGE_MAX; + alight.dvFalloff = 1.0f; - alight.dvAttenuation0 = (D3DVALUE)light->get_constant_attenuation(); - alight.dvAttenuation1 = (D3DVALUE)light->get_linear_attenuation(); - alight.dvAttenuation2 = (D3DVALUE)light->get_quadratic_attenuation(); + alight.dvAttenuation0 = (D3DVALUE)light->get_constant_attenuation(); + alight.dvAttenuation1 = (D3DVALUE)light->get_linear_attenuation(); + alight.dvAttenuation2 = (D3DVALUE)light->get_quadratic_attenuation(); - HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); + HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); #endif // WBD_GL_MODE } @@ -3923,78 +3923,78 @@ void DXGraphicsStateGuardian::apply_light( PointLight* light ) { // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::apply_light( DirectionalLight* light ) { - // The light position will be relative to the current matrix, so - // we have to know what the current matrix is. Find a better - // solution later. + // The light position will be relative to the current matrix, so + // we have to know what the current matrix is. Find a better + // solution later. #ifdef WBD_GL_MODE #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glMatrixMode(GL_MODELVIEW)" << endl; - dxgsg_cat.debug() - << "glPushMatrix()" << endl; - dxgsg_cat.debug() - << "glLoadIdentity()" << endl; + dxgsg_cat.debug() + << "glMatrixMode(GL_MODELVIEW)" << endl; + dxgsg_cat.debug() + << "glPushMatrix()" << endl; + dxgsg_cat.debug() + << "glLoadIdentity()" << endl; #endif - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) - .get_data()); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) + .get_data()); - GLenum id = get_light_id( _cur_light_id ); - Colorf black(0, 0, 0, 1); - glLightfv(id, GL_AMBIENT, black.get_data()); - glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); - glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); + GLenum id = get_light_id( _cur_light_id ); + Colorf black(0, 0, 0, 1); + glLightfv(id, GL_AMBIENT, black.get_data()); + glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); + glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); - // Position needs to specify x, y, z, and w - // w == 0 implies light is at infinity - LPoint3f dir = get_rel_forward( light, _current_root_node, - _coordinate_system ); - LPoint4f pos( -dir[0], -dir[1], -dir[2], 0 ); - glLightfv( id, GL_POSITION, pos.get_data() ); + // Position needs to specify x, y, z, and w + // w == 0 implies light is at infinity + LPoint3f dir = get_rel_forward( light, _current_root_node, + _coordinate_system ); + LPoint4f pos( -dir[0], -dir[1], -dir[2], 0 ); + glLightfv( id, GL_POSITION, pos.get_data() ); - // GL_SPOT_DIRECTION is not significant when cutoff == 180 - // In this case, position x, y, z specifies direction + // GL_SPOT_DIRECTION is not significant when cutoff == 180 + // In this case, position x, y, z specifies direction - // Exponent == 0 implies uniform light distribution - glLightf( id, GL_SPOT_EXPONENT, 0 ); + // Exponent == 0 implies uniform light distribution + glLightf( id, GL_SPOT_EXPONENT, 0 ); - // Cutoff == 180 means uniform point light source - glLightf( id, GL_SPOT_CUTOFF, 180.0 ); + // Cutoff == 180 means uniform point light source + glLightf( id, GL_SPOT_CUTOFF, 180.0 ); - // Default attenuation values (only spotlight can modify these) - glLightf( id, GL_CONSTANT_ATTENUATION, 1 ); - glLightf( id, GL_LINEAR_ATTENUATION, 0 ); - glLightf( id, GL_QUADRATIC_ATTENUATION, 0 ); + // Default attenuation values (only spotlight can modify these) + glLightf( id, GL_CONSTANT_ATTENUATION, 1 ); + glLightf( id, GL_LINEAR_ATTENUATION, 0 ); + glLightf( id, GL_QUADRATIC_ATTENUATION, 0 ); - glPopMatrix(); + glPopMatrix(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glPopMatrix()" << endl; + dxgsg_cat.debug() + << "glPopMatrix()" << endl; #endif #else // DX Directional light - D3DCOLORVALUE black; - black.r = black.g = black.b = black.a = 0.0f; + D3DCOLORVALUE black; + black.r = black.g = black.b = black.a = 0.0f; - D3DLIGHT7 alight; - ZeroMemory(&alight, sizeof(D3DLIGHT7)); + D3DLIGHT7 alight; + ZeroMemory(&alight, sizeof(D3DLIGHT7)); - alight.dltType = D3DLIGHT_DIRECTIONAL; - alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); - alight.dcvAmbient = black ; - alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); + alight.dltType = D3DLIGHT_DIRECTIONAL; + alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); + alight.dcvAmbient = black ; + alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); - alight.dvDirection = *(D3DVECTOR *) - (get_rel_forward( light, _current_projection_node, CS_yup_left).get_data()); + alight.dvDirection = *(D3DVECTOR *) + (get_rel_forward( light, _current_projection_node, CS_yup_left).get_data()); - alight.dvRange = D3DLIGHT_RANGE_MAX; - alight.dvFalloff = 1.0f; + alight.dvRange = D3DLIGHT_RANGE_MAX; + alight.dvFalloff = 1.0f; - alight.dvAttenuation0 = 1.0f; // constant - alight.dvAttenuation1 = 0.0f; // linear - alight.dvAttenuation2 = 0.0f; // quadratic + alight.dvAttenuation0 = 1.0f; // constant + alight.dvAttenuation1 = 0.0f; // linear + alight.dvAttenuation2 = 0.0f; // quadratic - HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); + HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); // _d3dDevice->LightEnable( _cur_light_id, TRUE ); // _d3dDevice->SetRenderState( D3DRENDERSTATE_LIGHTING, TRUE ); @@ -4007,81 +4007,81 @@ void DXGraphicsStateGuardian::apply_light( DirectionalLight* light ) { // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::apply_light( Spotlight* light ) { - // The light position will be relative to the current matrix, so - // we have to know what the current matrix is. Find a better - // solution later. + // The light position will be relative to the current matrix, so + // we have to know what the current matrix is. Find a better + // solution later. #ifdef WBD_GL_MODE #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glMatrixMode(GL_MODELVIEW)" << endl; - dxgsg_cat.debug() - << "glPushMatrix()" << endl; - dxgsg_cat.debug() - << "glLoadIdentity()" << endl; + dxgsg_cat.debug() + << "glMatrixMode(GL_MODELVIEW)" << endl; + dxgsg_cat.debug() + << "glPushMatrix()" << endl; + dxgsg_cat.debug() + << "glLoadIdentity()" << endl; #endif - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) - .get_data()); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadMatrixf(LMatrix4f::convert_mat(_coordinate_system, CS_yup_left) + .get_data()); - GLenum id = get_light_id( _cur_light_id ); - Colorf black(0, 0, 0, 1); - glLightfv(id, GL_AMBIENT, black.get_data()); - glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); - glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); + GLenum id = get_light_id( _cur_light_id ); + Colorf black(0, 0, 0, 1); + glLightfv(id, GL_AMBIENT, black.get_data()); + glLightfv(id, GL_DIFFUSE, light->get_color().get_data()); + glLightfv(id, GL_SPECULAR, light->get_specular().get_data()); - // Position needs to specify x, y, z, and w - // w == 1 implies non-infinite position - LPoint3f pos = get_rel_pos( light, _current_projection_node ); - LPoint4f fpos( pos[0], pos[1], pos[2], 1 ); - glLightfv( id, GL_POSITION, fpos.get_data() ); + // Position needs to specify x, y, z, and w + // w == 1 implies non-infinite position + LPoint3f pos = get_rel_pos( light, _current_projection_node ); + LPoint4f fpos( pos[0], pos[1], pos[2], 1 ); + glLightfv( id, GL_POSITION, fpos.get_data() ); - glLightfv( id, GL_SPOT_DIRECTION, - get_rel_forward( light, _current_projection_node, - _coordinate_system ).get_data() ); - glLightf( id, GL_SPOT_EXPONENT, light->get_exponent() ); - glLightf( id, GL_SPOT_CUTOFF, - light->get_cutoff_angle() ); - glLightf( id, GL_CONSTANT_ATTENUATION, - light->get_constant_attenuation() ); - glLightf( id, GL_LINEAR_ATTENUATION, - light->get_linear_attenuation() ); - glLightf( id, GL_QUADRATIC_ATTENUATION, - light->get_quadratic_attenuation() ); + glLightfv( id, GL_SPOT_DIRECTION, + get_rel_forward( light, _current_projection_node, + _coordinate_system ).get_data() ); + glLightf( id, GL_SPOT_EXPONENT, light->get_exponent() ); + glLightf( id, GL_SPOT_CUTOFF, + light->get_cutoff_angle() ); + glLightf( id, GL_CONSTANT_ATTENUATION, + light->get_constant_attenuation() ); + glLightf( id, GL_LINEAR_ATTENUATION, + light->get_linear_attenuation() ); + glLightf( id, GL_QUADRATIC_ATTENUATION, + light->get_quadratic_attenuation() ); - glPopMatrix(); + glPopMatrix(); #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glPopMatrix()" << endl; + dxgsg_cat.debug() + << "glPopMatrix()" << endl; #endif #else // DX Spotlight - D3DCOLORVALUE black; - black.r = black.g = black.b = black.a = 0.0f; + D3DCOLORVALUE black; + black.r = black.g = black.b = black.a = 0.0f; - D3DLIGHT7 alight; - ZeroMemory(&alight, sizeof(D3DLIGHT7)); + D3DLIGHT7 alight; + ZeroMemory(&alight, sizeof(D3DLIGHT7)); - alight.dltType = D3DLIGHT_SPOT; - alight.dcvAmbient = black ; - alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); - alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); + alight.dltType = D3DLIGHT_SPOT; + alight.dcvAmbient = black ; + alight.dcvDiffuse = *(D3DCOLORVALUE *)(light->get_color().get_data()); + alight.dcvSpecular = *(D3DCOLORVALUE *)(light->get_specular().get_data()); - alight.dvPosition = *(D3DVECTOR *) - (get_rel_pos( light, _current_root_node ).get_data()); + alight.dvPosition = *(D3DVECTOR *) + (get_rel_pos( light, _current_root_node ).get_data()); - alight.dvDirection = *(D3DVECTOR *) - (get_rel_forward( light, _current_root_node, _coordinate_system).get_data()); + alight.dvDirection = *(D3DVECTOR *) + (get_rel_forward( light, _current_root_node, _coordinate_system).get_data()); - alight.dvRange = D3DLIGHT_RANGE_MAX; - alight.dvFalloff = 1.0f; - alight.dvTheta = 0.0f; - alight.dvPhi = light->get_cutoff_angle(); + alight.dvRange = D3DLIGHT_RANGE_MAX; + alight.dvFalloff = 1.0f; + alight.dvTheta = 0.0f; + alight.dvPhi = light->get_cutoff_angle(); - alight.dvAttenuation0 = (D3DVALUE)light->get_constant_attenuation(); // constant - alight.dvAttenuation1 = (D3DVALUE)light->get_linear_attenuation(); // linear - alight.dvAttenuation2 = (D3DVALUE)light->get_quadratic_attenuation();// quadratic + alight.dvAttenuation0 = (D3DVALUE)light->get_constant_attenuation(); // constant + alight.dvAttenuation1 = (D3DVALUE)light->get_linear_attenuation(); // linear + alight.dvAttenuation2 = (D3DVALUE)light->get_quadratic_attenuation();// quadratic - HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); + HRESULT res = _d3dDevice->SetLight(_cur_light_id, &alight); #endif // WBD_GL_MODE } @@ -4092,7 +4092,7 @@ void DXGraphicsStateGuardian::apply_light( Spotlight* light ) { // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::apply_light( AmbientLight* light ) { - _cur_ambient_light = _cur_ambient_light + light->get_color(); + _cur_ambient_light = _cur_ambient_light + light->get_color(); } //////////////////////////////////////////////////////////////////// @@ -4102,41 +4102,41 @@ void DXGraphicsStateGuardian::apply_light( AmbientLight* light ) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_transform(const TransformAttribute *attrib) { - activate(); + activate(); #ifndef NDEBUG - if (dx_show_transforms) { + if (dx_show_transforms) { - bool lighting_was_enabled = _lighting_enabled; - bool texturing_was_enabled = _texturing_enabled; - enable_lighting(false); - enable_texturing(false); + bool lighting_was_enabled = _lighting_enabled; + bool texturing_was_enabled = _texturing_enabled; + enable_lighting(false); + enable_texturing(false); - typedef struct { - D3DVALUE x,y,z; // position - D3DVALUE nx,ny,nz; // normal - D3DCOLOR diff; // diffuse color - } VERTFORMAT; + typedef struct { + D3DVALUE x,y,z; // position + D3DVALUE nx,ny,nz; // normal + D3DCOLOR diff; // diffuse color + } VERTFORMAT; - VERTFORMAT vert_buf[] = { - {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(1.0f, 0.0f, 0.0f, 1.0f)}, // red - {3.0, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(1.0f, 0.0f, 0.0f, 1.0f)}, // red - {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 1.0f, 0.0f, 1.0f)}, // grn - {0.0f, 3.0, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 1.0f, 0.0f, 1.0f)}, // grn - {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 0.0f, 1.0f, 1.0f)}, // blu - {0.0f, 0.0f, 3.0, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 0.0f, 1.0f, 1.0f)}, // blu - }; + VERTFORMAT vert_buf[] = { + {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(1.0f, 0.0f, 0.0f, 1.0f)}, // red + {3.0, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(1.0f, 0.0f, 0.0f, 1.0f)}, // red + {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 1.0f, 0.0f, 1.0f)}, // grn + {0.0f, 3.0, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 1.0f, 0.0f, 1.0f)}, // grn + {0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 0.0f, 1.0f, 1.0f)}, // blu + {0.0f, 0.0f, 3.0, 0.0f, -1.0f, 0.0f, D3DRGBA(0.0f, 0.0f, 1.0f, 1.0f)}, // blu + }; - HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, D3DFVF_DIFFUSE | D3DFVF_XYZ | D3DFVF_NORMAL, - vert_buf, 6, NULL); - TestDrawPrimFailure(DrawPrim,hr,_pDD); + HRESULT hr = _d3dDevice->DrawPrimitive(D3DPT_LINELIST, D3DFVF_DIFFUSE | D3DFVF_XYZ | D3DFVF_NORMAL, + vert_buf, 6, NULL); + TestDrawPrimFailure(DrawPrim,hr,_pDD); - enable_lighting(lighting_was_enabled); - enable_texturing(texturing_was_enabled); - } + enable_lighting(lighting_was_enabled); + enable_texturing(texturing_was_enabled); + } #endif - _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD/*VIEW*/, - (LPD3DMATRIX) attrib->get_matrix().get_data()); + _d3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD/*VIEW*/, + (LPD3DMATRIX) attrib->get_matrix().get_data()); } //////////////////////////////////////////////////////////////////// @@ -4146,20 +4146,20 @@ issue_transform(const TransformAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_tex_matrix(const TexMatrixAttribute *attrib) { - dxgsg_cat.fatal() << "DXGSG issue_tex_matrix unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DXGSG issue_tex_matrix unimplemented!!!"; + return; - activate(); + activate(); #ifdef WBD_GL_MODE #ifdef GSG_VERBOSE - dxgsg_cat.debug() - << "glLoadMatrix(GL_TEXTURE): " << attrib->get_matrix() << endl; + dxgsg_cat.debug() + << "glLoadMatrix(GL_TEXTURE): " << attrib->get_matrix() << endl; #endif - glMatrixMode(GL_TEXTURE); - glLoadMatrixf(attrib->get_matrix().get_data()); + glMatrixMode(GL_TEXTURE); + glLoadMatrixf(attrib->get_matrix().get_data()); #else - _d3dDevice->SetTransform( D3DTRANSFORMSTATE_TEXTURE0, - (LPD3DMATRIX)attrib->get_matrix().get_data()); + _d3dDevice->SetTransform( D3DTRANSFORMSTATE_TEXTURE0, + (LPD3DMATRIX)attrib->get_matrix().get_data()); #endif // WBD_GL_MODE } @@ -4172,12 +4172,12 @@ issue_tex_matrix(const TexMatrixAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_color(const ColorAttribute *attrib) { - activate(); - if (attrib->is_on()&& attrib->is_real()) { - _issued_color_enabled = true; - Colorf c = attrib->get_color(); - _issued_color = Colorf_to_D3DCOLOR(c); - } else _issued_color_enabled = false; + activate(); + if (attrib->is_on()&& attrib->is_real()) { + _issued_color_enabled = true; + Colorf c = attrib->get_color(); + _issued_color = Colorf_to_D3DCOLOR(c); + } else _issued_color_enabled = false; } #endif @@ -4190,16 +4190,16 @@ issue_color(const ColorAttribute *attrib) { void DXGraphicsStateGuardian:: issue_texture(const TextureAttribute *attrib) { - activate(); + activate(); - if (attrib->is_on()) { - enable_texturing(true); - Texture *tex = attrib->get_texture(); - nassertv(tex != (Texture *)NULL); - tex->apply(this); - } else { - enable_texturing(false); - } + if (attrib->is_on()) { + enable_texturing(true); + Texture *tex = attrib->get_texture(); + nassertv(tex != (Texture *)NULL); + tex->apply(this); + } else { + enable_texturing(false); + } } //////////////////////////////////////////////////////////////////// @@ -4209,52 +4209,52 @@ issue_texture(const TextureAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_tex_gen(const TexGenAttribute *attrib) { - dxgsg_cat.fatal() << "DXGSG issue_tex_gen unimplemented!!!"; - return; - activate(); + dxgsg_cat.fatal() << "DXGSG issue_tex_gen unimplemented!!!"; + return; + activate(); #ifdef WBD_GL_MODE - TexGenProperty::Mode mode = attrib->get_mode(); + TexGenProperty::Mode mode = attrib->get_mode(); - switch (mode) { - case TexGenProperty::M_none: - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_GEN_T); - glDisable(GL_TEXTURE_GEN_Q); - glDisable(GL_TEXTURE_GEN_R); - break; + switch (mode) { + case TexGenProperty::M_none: + glDisable(GL_TEXTURE_GEN_S); + glDisable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_Q); + glDisable(GL_TEXTURE_GEN_R); + break; - case TexGenProperty::M_texture_projector: - { - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glEnable(GL_TEXTURE_GEN_Q); - glEnable(GL_TEXTURE_GEN_R); - const LMatrix4f &plane = attrib->get_plane(); - glTexGenfv(GL_S, GL_OBJECT_PLANE, plane.get_row(0).get_data()); - glTexGenfv(GL_T, GL_OBJECT_PLANE, plane.get_row(1).get_data()); - glTexGenfv(GL_R, GL_OBJECT_PLANE, plane.get_row(2).get_data()); - glTexGenfv(GL_Q, GL_OBJECT_PLANE, plane.get_row(3).get_data()); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - } - break; + case TexGenProperty::M_texture_projector: + { + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glEnable(GL_TEXTURE_GEN_Q); + glEnable(GL_TEXTURE_GEN_R); + const LMatrix4f &plane = attrib->get_plane(); + glTexGenfv(GL_S, GL_OBJECT_PLANE, plane.get_row(0).get_data()); + glTexGenfv(GL_T, GL_OBJECT_PLANE, plane.get_row(1).get_data()); + glTexGenfv(GL_R, GL_OBJECT_PLANE, plane.get_row(2).get_data()); + glTexGenfv(GL_Q, GL_OBJECT_PLANE, plane.get_row(3).get_data()); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + } + break; - case TexGenProperty::M_sphere_map: - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glDisable(GL_TEXTURE_GEN_Q); - glDisable(GL_TEXTURE_GEN_R); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); - break; + case TexGenProperty::M_sphere_map: + glEnable(GL_TEXTURE_GEN_S); + glEnable(GL_TEXTURE_GEN_T); + glDisable(GL_TEXTURE_GEN_Q); + glDisable(GL_TEXTURE_GEN_R); + glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + break; - default: - dxgsg_cat.error() - << "Unknown texgen mode " << (int)mode << endl; - break; - } + default: + dxgsg_cat.error() + << "Unknown texgen mode " << (int)mode << endl; + break; + } #endif // WBD_GL_MODE } @@ -4265,12 +4265,12 @@ issue_tex_gen(const TexGenAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_material(const MaterialAttribute *attrib) { - activate(); - if (attrib->is_on()) { - const Material *material = attrib->get_material(); - nassertv(material != (const Material *)NULL); - apply_material(material); - } + activate(); + if (attrib->is_on()) { + const Material *material = attrib->get_material(); + nassertv(material != (const Material *)NULL); + apply_material(material); + } } //////////////////////////////////////////////////////////////////// @@ -4280,16 +4280,16 @@ issue_material(const MaterialAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_fog(const FogAttribute *attrib) { - activate(); + activate(); - if (attrib->is_on()) { - enable_fog(true); - Fog *fog = attrib->get_fog(); - nassertv(fog != (Fog *)NULL); - fog->apply(this); - } else { - enable_fog(false); - } + if (attrib->is_on()) { + enable_fog(true); + Fog *fog = attrib->get_fog(); + nassertv(fog != (Fog *)NULL); + fog->apply(this); + } else { + enable_fog(false); + } } //////////////////////////////////////////////////////////////////// @@ -4299,25 +4299,25 @@ issue_fog(const FogAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_render_mode(const RenderModeAttribute *attrib) { - activate(); + activate(); - RenderModeProperty::Mode mode = attrib->get_mode(); + RenderModeProperty::Mode mode = attrib->get_mode(); - switch (mode) { - case RenderModeProperty::M_filled: - _d3dDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID); - break; + switch (mode) { + case RenderModeProperty::M_filled: + _d3dDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID); + break; - case RenderModeProperty::M_wireframe: - _d3dDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME); + case RenderModeProperty::M_wireframe: + _d3dDevice->SetRenderState(D3DRENDERSTATE_FILLMODE, D3DFILL_WIREFRAME); // call_glLineWidth(attrib->get_line_width()); - break; + break; - default: - dxgsg_cat.error() - << "Unknown render mode " << (int)mode << endl; - } + default: + dxgsg_cat.error() + << "Unknown render mode " << (int)mode << endl; + } } //////////////////////////////////////////////////////////////////// @@ -4326,93 +4326,93 @@ issue_render_mode(const RenderModeAttribute *attrib) { // Description: //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::issue_light(const LightAttribute *attrib ) { - nassertv(attrib->get_properties_is_on()); - activate(); + nassertv(attrib->get_properties_is_on()); + activate(); - // Initialize the current ambient light total and currently enabled - // light list - _cur_ambient_light.set(0, 0, 0, 1); - int i; - for (i = 0; i < _max_lights; i++) - _cur_light_enabled[i] = false; + // Initialize the current ambient light total and currently enabled + // light list + _cur_ambient_light.set(0, 0, 0, 1); + int i; + for (i = 0; i < _max_lights; i++) + _cur_light_enabled[i] = false; - int num_enabled = 0; - LightAttribute::const_iterator li; - for (li = attrib->begin(); li != attrib->end(); ++li) { - _cur_light_id = -1; - num_enabled++; - enable_lighting(true); - Light *light = (*li); - nassertv(light != (Light *)NULL); + int num_enabled = 0; + LightAttribute::const_iterator li; + for (li = attrib->begin(); li != attrib->end(); ++li) { + _cur_light_id = -1; + num_enabled++; + enable_lighting(true); + Light *light = (*li); + nassertv(light != (Light *)NULL); - // Ambient lights don't require specific light ids - // Simply add in the ambient contribution to the current total - if (light->get_light_type() == AmbientLight::get_class_type()) { - light->apply(this); - // We need to indicate that no light id is necessary because - // it's an ambient light - _cur_light_id = -2; - } + // Ambient lights don't require specific light ids + // Simply add in the ambient contribution to the current total + if (light->get_light_type() == AmbientLight::get_class_type()) { + light->apply(this); + // We need to indicate that no light id is necessary because + // it's an ambient light + _cur_light_id = -2; + } - // Check to see if this light has already been bound to an id - for (i = 0; i < _max_lights; i++) { - if (_available_light_ids[i] == light) { - // Light has already been bound to an id, we only need - // to enable the light, not apply it - _cur_light_id = -2; - if (enable_light(i, true)) _cur_light_enabled[i] = true; - break; - } - } + // Check to see if this light has already been bound to an id + for (i = 0; i < _max_lights; i++) { + if (_available_light_ids[i] == light) { + // Light has already been bound to an id, we only need + // to enable the light, not apply it + _cur_light_id = -2; + if (enable_light(i, true)) _cur_light_enabled[i] = true; + break; + } + } - // See if there are any unbound light ids - if (_cur_light_id == -1) { - for (i = 0; i < _max_lights; i++) { - if (_available_light_ids[i] == NULL) { - _available_light_ids[i] = light; - _cur_light_id = i; - break; - } - } - } + // See if there are any unbound light ids + if (_cur_light_id == -1) { + for (i = 0; i < _max_lights; i++) { + if (_available_light_ids[i] == NULL) { + _available_light_ids[i] = light; + _cur_light_id = i; + break; + } + } + } - // If there were no unbound light ids, see if we can replace - // a currently unused but previously bound id - if (_cur_light_id == -1) { - for (i = 0; i < _max_lights; i++) { - if (attrib->is_off(_available_light_ids[i])) { - _available_light_ids[i] = light; - _cur_light_id = i; - break; - } - } - } + // If there were no unbound light ids, see if we can replace + // a currently unused but previously bound id + if (_cur_light_id == -1) { + for (i = 0; i < _max_lights; i++) { + if (attrib->is_off(_available_light_ids[i])) { + _available_light_ids[i] = light; + _cur_light_id = i; + break; + } + } + } - if (_cur_light_id >= 0) { - if (enable_light(_cur_light_id, true)) _cur_light_enabled[_cur_light_id] = true; + if (_cur_light_id >= 0) { + if (enable_light(_cur_light_id, true)) _cur_light_enabled[_cur_light_id] = true; - // We need to do something different for each type of light - light->apply(this); - } else if (_cur_light_id == -1) { - dxgsg_cat.error() - << "issue_light() - failed to bind light to id" << endl; - } - } + // We need to do something different for each type of light + light->apply(this); + } else if (_cur_light_id == -1) { + dxgsg_cat.error() + << "issue_light() - failed to bind light to id" << endl; + } + } - // Disable all unused lights - for (i = 0; i < _max_lights; i++) { - if (_cur_light_enabled[i] == false) - enable_light(i, false); - } + // Disable all unused lights + for (i = 0; i < _max_lights; i++) { + if (_cur_light_enabled[i] == false) + enable_light(i, false); + } - // If no lights were enabled, disable lighting - if (num_enabled == 0) { - enable_lighting(false); - enable_color_material(false); - } else { - call_dxLightModelAmbient(_cur_ambient_light); - enable_color_material(true); - } + // If no lights were enabled, disable lighting + if (num_enabled == 0) { + enable_lighting(false); + enable_color_material(false); + } else { + call_dxLightModelAmbient(_cur_ambient_light); + enable_color_material(true); + } } @@ -4424,7 +4424,7 @@ void DXGraphicsStateGuardian::issue_light(const LightAttribute *attrib ) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: reset_ambient() { - _lmodel_ambient += 2.0f; + _lmodel_ambient += 2.0f; } @@ -4435,123 +4435,123 @@ reset_ambient() { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_color_blend(const ColorBlendAttribute *attrib) { - activate(); - ColorBlendProperty::Mode mode = attrib->get_mode(); + activate(); + ColorBlendProperty::Mode mode = attrib->get_mode(); - switch (mode) { - case ColorBlendProperty::M_none: - enable_blend(false); - break; - case ColorBlendProperty::M_multiply: - enable_blend(true); - call_dxBlendFunc(D3DBLEND_DESTCOLOR, D3DBLEND_ZERO); - break; - case ColorBlendProperty::M_add: - enable_blend(true); - call_dxBlendFunc(D3DBLEND_ONE, D3DBLEND_ONE); - break; - case ColorBlendProperty::M_multiply_add: - enable_blend(true); - call_dxBlendFunc(D3DBLEND_DESTCOLOR, D3DBLEND_ONE); - break; - case ColorBlendProperty::M_alpha: - enable_blend(true); - call_dxBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); - break; - default: - dxgsg_cat.error() - << "Unknown color blend mode " << (int)mode << endl; - break; - } + switch (mode) { + case ColorBlendProperty::M_none: + enable_blend(false); + break; + case ColorBlendProperty::M_multiply: + enable_blend(true); + call_dxBlendFunc(D3DBLEND_DESTCOLOR, D3DBLEND_ZERO); + break; + case ColorBlendProperty::M_add: + enable_blend(true); + call_dxBlendFunc(D3DBLEND_ONE, D3DBLEND_ONE); + break; + case ColorBlendProperty::M_multiply_add: + enable_blend(true); + call_dxBlendFunc(D3DBLEND_DESTCOLOR, D3DBLEND_ONE); + break; + case ColorBlendProperty::M_alpha: + enable_blend(true); + call_dxBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); + break; + default: + dxgsg_cat.error() + << "Unknown color blend mode " << (int)mode << endl; + break; + } } void DXGraphicsStateGuardian::SetTextureBlendMode(TextureApplyProperty::Mode TexBlendMode,bool bCanJustEnable) { /*class TextureApplyProperty { enum Mode { - M_modulate,M_decal,M_blend,M_replace,M_add}; + M_modulate,M_decal,M_blend,M_replace,M_add}; */ - static D3DTEXTUREOP TexBlendColorOp1[/* TextureApplyProperty::Mode maxval*/ 10] = - {D3DTOP_MODULATE,D3DTOP_BLENDTEXTUREALPHA,D3DTOP_MODULATE,D3DTOP_SELECTARG1,D3DTOP_ADD}; + static D3DTEXTUREOP TexBlendColorOp1[/* TextureApplyProperty::Mode maxval*/ 10] = + {D3DTOP_MODULATE,D3DTOP_BLENDTEXTUREALPHA,D3DTOP_MODULATE,D3DTOP_SELECTARG1,D3DTOP_ADD}; - //if bCanJustEnable, then we only need to make sure ColorOp is turned on and set properly - if (bCanJustEnable && (TexBlendMode==_CurTexBlendMode)) { - // just reset COLOROP 0 to enable pipeline, rest is already set properly - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, TexBlendColorOp1[TexBlendMode] ); - return; - } + //if bCanJustEnable, then we only need to make sure ColorOp is turned on and set properly + if (bCanJustEnable && (TexBlendMode==_CurTexBlendMode)) { + // just reset COLOROP 0 to enable pipeline, rest is already set properly + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, TexBlendColorOp1[TexBlendMode] ); + return; + } - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, TexBlendColorOp1[TexBlendMode] ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, TexBlendColorOp1[TexBlendMode] ); - switch (TexBlendMode) { - - case TextureApplyProperty::M_modulate: - // emulates GL_MODULATE glTexEnv mode - // want to multiply tex-color*pixel color to emulate GL modulate blend (see glTexEnv) - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + switch (TexBlendMode) { - break; - case TextureApplyProperty::M_decal: - // emulates GL_DECAL glTexEnv mode - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + case TextureApplyProperty::M_modulate: + // emulates GL_MODULATE glTexEnv mode + // want to multiply tex-color*pixel color to emulate GL modulate blend (see glTexEnv) + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE ); + break; + case TextureApplyProperty::M_decal: + // emulates GL_DECAL glTexEnv mode + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - break; - case TextureApplyProperty::M_replace: - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - break; - case TextureApplyProperty::M_add: - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + break; + case TextureApplyProperty::M_replace: + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - // since I'm making up 'add' mode, use modulate. "adding" alpha never makes sense right? - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + break; + case TextureApplyProperty::M_add: + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - break; - case TextureApplyProperty::M_blend: - dxgsg_cat.error() - << "Impossible to emulate GL_BLEND in DX exactly " << (int) TexBlendMode << endl; + // since I'm making up 'add' mode, use modulate. "adding" alpha never makes sense right? + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + + break; + case TextureApplyProperty::M_blend: + dxgsg_cat.error() + << "Impossible to emulate GL_BLEND in DX exactly " << (int) TexBlendMode << endl; /* - // emulate GL_BLEND glTexEnv - - GL requires 2 independent operations on 3 input vars for this mode - DX texture pipeline requires re-using input of last stage on each new op, so I dont think - exact emulation is possible - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); + // emulate GL_BLEND glTexEnv - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); + GL requires 2 independent operations on 3 input vars for this mode + DX texture pipeline requires re-using input of last stage on each new op, so I dont think + exact emulation is possible + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE | D3DTA_COMPLEMENT ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); - need to SetTexture(1,tex) also - _d3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE ); wrong - _d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE ); - _d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_TFACTOR ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); - _d3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); - _d3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_CURRENT ); + need to SetTexture(1,tex) also + _d3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE ); wrong + _d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE ); + _d3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_TFACTOR ); + + _d3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); + _d3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_CURRENT ); */ - break; - default: - dxgsg_cat.error() << "Unknown texture blend mode " << (int) TexBlendMode << endl; - break; - } + break; + default: + dxgsg_cat.error() << "Unknown texture blend mode " << (int) TexBlendMode << endl; + break; + } } @@ -4562,20 +4562,20 @@ void DXGraphicsStateGuardian::SetTextureBlendMode(TextureApplyProperty::Mode Tex //////////////////////////////////////////////////////////////////// INLINE void DXGraphicsStateGuardian:: enable_texturing(bool val) { -// if (_texturing_enabled == val) { // this check is mostly for internal gsg calls, panda already screens out redundant state changes +// if (_texturing_enabled == val) { // this check is mostly for internal gsg calls, panda already screens out redundant state changes // return; -// } +// } - _texturing_enabled = val; + _texturing_enabled = val; // assert(_pCurTexContext!=NULL); we're definitely called with it NULL for both true and false // I'm going to allow enabling texturing even if no tex has been set yet, seems to cause no probs - if (val == FALSE) { - _d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); - } else { - SetTextureBlendMode(_CurTexBlendMode,TRUE); - } + if (val == FALSE) { + _d3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE); + } else { + SetTextureBlendMode(_CurTexBlendMode,TRUE); + } } //////////////////////////////////////////////////////////////////// @@ -4586,13 +4586,13 @@ enable_texturing(bool val) { void DXGraphicsStateGuardian:: issue_texture_apply(const TextureApplyAttribute *attrib) { - _CurTexBlendMode = attrib->get_mode(); + _CurTexBlendMode = attrib->get_mode(); - if (!_texturing_enabled) { - return; - } + if (!_texturing_enabled) { + return; + } - SetTextureBlendMode(_CurTexBlendMode,FALSE); + SetTextureBlendMode(_CurTexBlendMode,FALSE); } //////////////////////////////////////////////////////////////////// @@ -4602,8 +4602,8 @@ issue_texture_apply(const TextureApplyAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_color_mask(const ColorMaskAttribute *attrib) { - dxgsg_cat.fatal() << "DXGSG issue_color_mask unimplemented (not implementable on DX7)!!!"; - return; + dxgsg_cat.fatal() << "DXGSG issue_color_mask unimplemented (not implementable on DX7)!!!"; + return; } //////////////////////////////////////////////////////////////////// @@ -4613,18 +4613,18 @@ issue_color_mask(const ColorMaskAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_depth_test(const DepthTestAttribute *attrib) { - activate(); + activate(); - DepthTestProperty::Mode mode = attrib->get_mode(); + DepthTestProperty::Mode mode = attrib->get_mode(); - if (mode == DepthTestProperty::M_none) { - _depth_test_enabled = false; - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); - } else { - _depth_test_enabled = true; - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, D3DZB_TRUE); - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, get_depth_func_type(mode)); - } + if (mode == DepthTestProperty::M_none) { + _depth_test_enabled = false; + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + } else { + _depth_test_enabled = true; + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE, D3DZB_TRUE); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, get_depth_func_type(mode)); + } } //////////////////////////////////////////////////////////////////// @@ -4634,7 +4634,7 @@ issue_depth_test(const DepthTestAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_depth_write(const DepthWriteAttribute *attrib) { - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, attrib->is_on()); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, attrib->is_on()); } //////////////////////////////////////////////////////////////////// @@ -4649,23 +4649,23 @@ issue_stencil(const StencilAttribute *attrib) { #if 1 if (mode != StencilProperty::M_none) { - dxgsg_cat.error() << "stencil buffering unimplemented for DX GSG renderer!!!\n"; - // to implement stenciling, need to change wdxGraphicsWindow to create a stencil - // z-buffer or maybe do a SetRenderTarget on a new zbuffer + dxgsg_cat.error() << "stencil buffering unimplemented for DX GSG renderer!!!\n"; + // to implement stenciling, need to change wdxGraphicsWindow to create a stencil + // z-buffer or maybe do a SetRenderTarget on a new zbuffer } - + #else - if (mode == StencilProperty::M_none) { - enable_stencil_test(false); + if (mode == StencilProperty::M_none) { + enable_stencil_test(false); - } else { - enable_stencil_test(true); - _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILFUNC, get_stencil_func_type(mode)); - _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILPASS, get_stencil_action_type(attrib->get_action())); - _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILFAIL, get_stencil_action_type(attrib->get_action())); - _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILZFAIL, get_stencil_action_type(attrib->get_action())); - } + } else { + enable_stencil_test(true); + _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILFUNC, get_stencil_func_type(mode)); + _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILPASS, get_stencil_action_type(attrib->get_action())); + _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILFAIL, get_stencil_action_type(attrib->get_action())); + _d3dDevice->SetRenderState(D3DRENDERSTATE_STENCILZFAIL, get_stencil_action_type(attrib->get_action())); + } #endif } @@ -4676,29 +4676,29 @@ issue_stencil(const StencilAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_cull_face(const CullFaceAttribute *attrib) { - activate(); + activate(); - CullFaceProperty::Mode mode = attrib->get_mode(); + CullFaceProperty::Mode mode = attrib->get_mode(); - switch (mode) { - case CullFaceProperty::M_cull_none: - _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); - break; - case CullFaceProperty::M_cull_clockwise: - _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW); - break; - case CullFaceProperty::M_cull_counter_clockwise: - _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); - break; - case CullFaceProperty::M_cull_all: - dxgsg_cat.warning() << "M_cull_all is invalid for DX GSG renderer, using CULL_CCW \n"; - _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); - break; - default: - dxgsg_cat.error() - << "invalid cull face mode " << (int)mode << endl; - break; - } + switch (mode) { + case CullFaceProperty::M_cull_none: + _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); + break; + case CullFaceProperty::M_cull_clockwise: + _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW); + break; + case CullFaceProperty::M_cull_counter_clockwise: + _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); + break; + case CullFaceProperty::M_cull_all: + dxgsg_cat.warning() << "M_cull_all is invalid for DX GSG renderer, using CULL_CCW \n"; + _d3dDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CCW); + break; + default: + dxgsg_cat.error() + << "invalid cull face mode " << (int)mode << endl; + break; + } } //////////////////////////////////////////////////////////////////// @@ -4708,81 +4708,81 @@ issue_cull_face(const CullFaceAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_clip_plane(const ClipPlaneAttribute *attrib) { - activate(); + activate(); - // Initialize the currently enabled clip plane list - int i; - for (i = 0; i < _max_clip_planes; i++) - _cur_clip_plane_enabled[i] = false; + // Initialize the currently enabled clip plane list + int i; + for (i = 0; i < _max_clip_planes; i++) + _cur_clip_plane_enabled[i] = false; - int num_enabled = 0; - ClipPlaneAttribute::const_iterator pi; - for (pi = attrib->begin(); pi != attrib->end(); ++pi) { - PlaneNode *plane_node; - DCAST_INTO_V(plane_node, (*pi)); - nassertv(plane_node != (PlaneNode *)NULL); + int num_enabled = 0; + ClipPlaneAttribute::const_iterator pi; + for (pi = attrib->begin(); pi != attrib->end(); ++pi) { + PlaneNode *plane_node; + DCAST_INTO_V(plane_node, (*pi)); + nassertv(plane_node != (PlaneNode *)NULL); - _cur_clip_plane_id = -1; - num_enabled++; + _cur_clip_plane_id = -1; + num_enabled++; - // Check to see if this clip plane has already been bound to an id - for (i = 0; i < _max_clip_planes; i++) { - if (_available_clip_plane_ids[i] == plane_node) { - // Clip plane has already been bound to an id, we only need - // to enable the clip plane, not apply it - _cur_clip_plane_id = -2; - enable_clip_plane(i, true); - _cur_clip_plane_enabled[i] = true; - break; - } - } + // Check to see if this clip plane has already been bound to an id + for (i = 0; i < _max_clip_planes; i++) { + if (_available_clip_plane_ids[i] == plane_node) { + // Clip plane has already been bound to an id, we only need + // to enable the clip plane, not apply it + _cur_clip_plane_id = -2; + enable_clip_plane(i, true); + _cur_clip_plane_enabled[i] = true; + break; + } + } - // See if there are any unbound clip plane ids - if (_cur_clip_plane_id == -1) { - for (i = 0; i < _max_clip_planes; i++) { - if (_available_clip_plane_ids[i] == NULL) { - _available_clip_plane_ids[i] = plane_node; - _cur_clip_plane_id = i; - break; - } - } - } + // See if there are any unbound clip plane ids + if (_cur_clip_plane_id == -1) { + for (i = 0; i < _max_clip_planes; i++) { + if (_available_clip_plane_ids[i] == NULL) { + _available_clip_plane_ids[i] = plane_node; + _cur_clip_plane_id = i; + break; + } + } + } - // If there were no unbound clip plane ids, see if we can replace - // a currently unused but previously bound id - if (_cur_clip_plane_id == -1) { - for (i = 0; i < _max_clip_planes; i++) { - if (attrib->is_off(_available_clip_plane_ids[i])) { - _available_clip_plane_ids[i] = plane_node; - _cur_clip_plane_id = i; - break; - } - } - } + // If there were no unbound clip plane ids, see if we can replace + // a currently unused but previously bound id + if (_cur_clip_plane_id == -1) { + for (i = 0; i < _max_clip_planes; i++) { + if (attrib->is_off(_available_clip_plane_ids[i])) { + _available_clip_plane_ids[i] = plane_node; + _cur_clip_plane_id = i; + break; + } + } + } - if (_cur_clip_plane_id >= 0) { - enable_clip_plane(_cur_clip_plane_id, true); - _cur_clip_plane_enabled[_cur_clip_plane_id] = true; - const Planef clip_plane = plane_node->get_plane(); + if (_cur_clip_plane_id >= 0) { + enable_clip_plane(_cur_clip_plane_id, true); + _cur_clip_plane_enabled[_cur_clip_plane_id] = true; + const Planef clip_plane = plane_node->get_plane(); - D3DVALUE equation[4]; - equation[0] = clip_plane._a; - equation[1] = clip_plane._b; - equation[2] = clip_plane._c; - equation[3] = clip_plane._d; - _d3dDevice->SetClipPlane(_cur_clip_plane_id, equation); + D3DVALUE equation[4]; + equation[0] = clip_plane._a; + equation[1] = clip_plane._b; + equation[2] = clip_plane._c; + equation[3] = clip_plane._d; + _d3dDevice->SetClipPlane(_cur_clip_plane_id, equation); - } else if (_cur_clip_plane_id == -1) { - dxgsg_cat.error() - << "issue_clip_plane() - failed to bind clip plane to id" << endl; - } - } + } else if (_cur_clip_plane_id == -1) { + dxgsg_cat.error() + << "issue_clip_plane() - failed to bind clip plane to id" << endl; + } + } - // Disable all unused clip planes - for (i = 0; i < _max_clip_planes; i++) { - if (_cur_clip_plane_enabled[i] == false) - enable_clip_plane(i, false); - } + // Disable all unused clip planes + for (i = 0; i < _max_clip_planes; i++) { + if (_cur_clip_plane_enabled[i] == false) + enable_clip_plane(i, false); + } } //////////////////////////////////////////////////////////////////// @@ -4792,56 +4792,56 @@ issue_clip_plane(const ClipPlaneAttribute *attrib) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_transparency(const TransparencyAttribute *attrib ) { - activate(); + activate(); - TransparencyProperty::Mode mode = attrib->get_mode(); + TransparencyProperty::Mode mode = attrib->get_mode(); - switch (mode) { - case TransparencyProperty::M_none: -// enable_multisample_alpha_one(false); -// enable_multisample_alpha_mask(false); - enable_blend(false); - enable_alpha_test(false); - break; - case TransparencyProperty::M_alpha: - case TransparencyProperty::M_alpha_sorted: - // Should we really have an "alpha" and an "alpha_sorted" mode, - // like Performer does? (The difference is that "alpha" is with - // the write to the depth buffer disabled.) Or should we just use - // the separate depth write transition to control this? Doing it - // implicitly requires a bit more logic here and in the state - // management; for now we require the user to explicitly turn off - // the depth write. -// enable_multisample_alpha_one(false); -// enable_multisample_alpha_mask(false); - enable_blend(true); - enable_alpha_test(false); - call_dxBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); - break; - case TransparencyProperty::M_multisample: -// enable_multisample_alpha_one(true); -// enable_multisample_alpha_mask(true); - enable_blend(false); - enable_alpha_test(false); - break; - case TransparencyProperty::M_multisample_mask: -// enable_multisample_alpha_one(false); -// enable_multisample_alpha_mask(true); - enable_blend(false); - enable_alpha_test(false); - break; - case TransparencyProperty::M_binary: -// enable_multisample_alpha_one(false); -// enable_multisample_alpha_mask(false); - enable_blend(false); - enable_alpha_test(true); - call_dxAlphaFunc(D3DCMP_EQUAL, 1); - break; - default: - dxgsg_cat.error() - << "invalid transparency mode " << (int)mode << endl; - break; - } + switch (mode) { + case TransparencyProperty::M_none: +// enable_multisample_alpha_one(false); +// enable_multisample_alpha_mask(false); + enable_blend(false); + enable_alpha_test(false); + break; + case TransparencyProperty::M_alpha: + case TransparencyProperty::M_alpha_sorted: + // Should we really have an "alpha" and an "alpha_sorted" mode, + // like Performer does? (The difference is that "alpha" is with + // the write to the depth buffer disabled.) Or should we just use + // the separate depth write transition to control this? Doing it + // implicitly requires a bit more logic here and in the state + // management; for now we require the user to explicitly turn off + // the depth write. +// enable_multisample_alpha_one(false); +// enable_multisample_alpha_mask(false); + enable_blend(true); + enable_alpha_test(false); + call_dxBlendFunc(D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA); + break; + case TransparencyProperty::M_multisample: +// enable_multisample_alpha_one(true); +// enable_multisample_alpha_mask(true); + enable_blend(false); + enable_alpha_test(false); + break; + case TransparencyProperty::M_multisample_mask: +// enable_multisample_alpha_one(false); +// enable_multisample_alpha_mask(true); + enable_blend(false); + enable_alpha_test(false); + break; + case TransparencyProperty::M_binary: +// enable_multisample_alpha_one(false); +// enable_multisample_alpha_mask(false); + enable_blend(false); + enable_alpha_test(true); + call_dxAlphaFunc(D3DCMP_EQUAL, 1); + break; + default: + dxgsg_cat.error() + << "invalid transparency mode " << (int)mode << endl; + break; + } } //////////////////////////////////////////////////////////////////// @@ -4851,7 +4851,7 @@ issue_transparency(const TransparencyAttribute *attrib ) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: issue_linesmooth(const LinesmoothAttribute *attrib) { - enable_line_smooth(attrib->is_on()); + enable_line_smooth(attrib->is_on()); } //////////////////////////////////////////////////////////////////// @@ -4861,7 +4861,7 @@ issue_linesmooth(const LinesmoothAttribute *attrib) { //////////////////////////////////////////////////////////////////// INLINE bool DXGraphicsStateGuardian:: wants_normals() const { - return(_lighting_enabled || _normals_enabled); + return(_lighting_enabled || _normals_enabled); } //////////////////////////////////////////////////////////////////// @@ -4871,7 +4871,7 @@ wants_normals() const { //////////////////////////////////////////////////////////////////// INLINE bool DXGraphicsStateGuardian:: wants_texcoords() const { - return _texturing_enabled; + return _texturing_enabled; } //////////////////////////////////////////////////////////////////// @@ -4882,20 +4882,20 @@ wants_texcoords() const { //////////////////////////////////////////////////////////////////// INLINE bool DXGraphicsStateGuardian:: wants_colors() const { - // If we have scene graph color enabled, return false to indicate we - // shouldn't bother issuing geometry color commands. + // If we have scene graph color enabled, return false to indicate we + // shouldn't bother issuing geometry color commands. - const ColorAttribute *catt; - if (!get_attribute_into(catt, _state, ColorTransition::get_class_type())) { - // No scene graph color at all. - return true; - } + const ColorAttribute *catt; + if (!get_attribute_into(catt, _state, ColorTransition::get_class_type())) { + // No scene graph color at all. + return true; + } - // We should issue geometry colors only if the scene graph color is off. - if (catt->is_off() || (!catt->is_real())) - return true; + // We should issue geometry colors only if the scene graph color is off. + if (catt->is_off() || (!catt->is_real())) + return true; - return false; + return false; } //////////////////////////////////////////////////////////////////// @@ -4910,36 +4910,36 @@ wants_colors() const { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: begin_decal(GeomNode *base_geom) { - nassertv(base_geom != (GeomNode *)NULL); + nassertv(base_geom != (GeomNode *)NULL); - _decal_level++; - nassertv(4*_decal_level < 16); + _decal_level++; + nassertv(4*_decal_level < 16); #ifndef DISABLE_POLYGON_OFFSET_DECALING - if (dx_decal_type == GDT_offset) { + if (dx_decal_type == GDT_offset) { #define POLYGON_OFFSET_MULTIPLIER 2 - // Just draw the base geometry normally. - base_geom->draw(this); - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8! - } else + // Just draw the base geometry normally. + base_geom->draw(this); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8! + } else #endif - { - if (_decal_level > 1) - base_geom->draw(this); // If we're already decaling, just draw the geometry. - else { - // First turn off writing the depth buffer to render the base geometry. - _d3dDevice->GetRenderState(D3DRENDERSTATE_ZWRITEENABLE, (unsigned long *)&_depth_write_enabled); //save cur val - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); + { + if (_decal_level > 1) + base_geom->draw(this); // If we're already decaling, just draw the geometry. + else { + // First turn off writing the depth buffer to render the base geometry. + _d3dDevice->GetRenderState(D3DRENDERSTATE_ZWRITEENABLE, (unsigned long *)&_depth_write_enabled); //save cur val + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); - // Now render the base geometry. - base_geom->draw(this); + // Now render the base geometry. + base_geom->draw(this); - // Render all of the decal geometry, too. We'll keep the depth - // buffer write off during this. - } - } + // Render all of the decal geometry, too. We'll keep the depth + // buffer write off during this. + } + } } //////////////////////////////////////////////////////////////////// @@ -4951,86 +4951,86 @@ begin_decal(GeomNode *base_geom) { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: end_decal(GeomNode *base_geom) { - nassertv(base_geom != (GeomNode *)NULL); + nassertv(base_geom != (GeomNode *)NULL); - _decal_level--; + _decal_level--; // nassertv(_decal_level >= 1); #ifndef DISABLE_POLYGON_OFFSET_DECALING - if (dx_decal_type == GDT_offset) { - // Restore the Zbias offset. - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8! - } else + if (dx_decal_type == GDT_offset) { + // Restore the Zbias offset. + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZBIAS, POLYGON_OFFSET_MULTIPLIER * _decal_level); // _decal_level better not be higher than 8! + } else #endif - { // for GDT_mask - if (_decal_level == 0) { - // Now we need to re-render the base geometry with the depth write - // on and the color mask off, so we update the depth buffer - // properly. - bool was_textured = _texturing_enabled; - bool was_blend = _blend_enabled; - D3DBLEND old_blend_source_func = _blend_source_func; - D3DBLEND old_blend_dest_func = _blend_dest_func; + { // for GDT_mask + if (_decal_level == 0) { + // Now we need to re-render the base geometry with the depth write + // on and the color mask off, so we update the depth buffer + // properly. + bool was_textured = _texturing_enabled; + bool was_blend = _blend_enabled; + D3DBLEND old_blend_source_func = _blend_source_func; + D3DBLEND old_blend_dest_func = _blend_dest_func; - // Enable the writing to the depth buffer. - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); + // Enable the writing to the depth buffer. + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); - // Disable the writing to the color buffer, however we have to - // do this. (I don't think this is possible in DX without blending.) - if (dx_decal_type == GDT_blend) { - // Expensive. - enable_blend(true); - call_dxBlendFunc(D3DBLEND_ZERO, D3DBLEND_ONE); - } + // Disable the writing to the color buffer, however we have to + // do this. (I don't think this is possible in DX without blending.) + if (dx_decal_type == GDT_blend) { + // Expensive. + enable_blend(true); + call_dxBlendFunc(D3DBLEND_ZERO, D3DBLEND_ONE); + } #if(DIRECT3D_VERSION < 0x700) - else { // dx7 doesn't support planemask rstate - // note: not saving current planemask val, assumes this is always all 1's. should be ok - _d3dDevice->SetRenderState(D3DRENDERSTATE_PLANEMASK,0x0); // note PLANEMASK is supposedly obsolete for DX7 - } + else { // dx7 doesn't support planemask rstate + // note: not saving current planemask val, assumes this is always all 1's. should be ok + _d3dDevice->SetRenderState(D3DRENDERSTATE_PLANEMASK,0x0); // note PLANEMASK is supposedly obsolete for DX7 + } #endif // Note: For DX8, use D3DRS_COLORWRITEENABLE (check D3DPMISCCAPS_COLORWRITEENABLE first) - // No need to have texturing on for this. - enable_texturing(false); + // No need to have texturing on for this. + enable_texturing(false); - base_geom->draw(this); + base_geom->draw(this); - // Finally, restore the depth write and color mask states to the - // way they're supposed to be. + // Finally, restore the depth write and color mask states to the + // way they're supposed to be. /* - DepthWriteAttribute *depth_write; - if (get_attribute_into(depth_write, _state, - DepthWriteTransition::get_class_type())) - issue_depth_write(depth_write); + DepthWriteAttribute *depth_write; + if (get_attribute_into(depth_write, _state, + DepthWriteTransition::get_class_type())) + issue_depth_write(depth_write); - ColorMaskAttribute *color_mask; - if (get_attribute_into(color_mask, _state, - ColorMaskTransition::get_class_type())) { - issue_color_mask(color_mask); - } else { + ColorMaskAttribute *color_mask; + if (get_attribute_into(color_mask, _state, + ColorMaskTransition::get_class_type())) { + issue_color_mask(color_mask); + } else { - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } */ - if (dx_decal_type == GDT_blend) { - enable_blend(was_blend); - if (was_blend) - call_dxBlendFunc(old_blend_source_func, old_blend_dest_func); - } + if (dx_decal_type == GDT_blend) { + enable_blend(was_blend); + if (was_blend) + call_dxBlendFunc(old_blend_source_func, old_blend_dest_func); + } #if(DIRECT3D_VERSION < 0x700) - else { - _d3dDevice->SetRenderState(D3DRENDERSTATE_PLANEMASK,0xFFFFFFFF); // this is unlikely to work due to poor driver support - } + else { + _d3dDevice->SetRenderState(D3DRENDERSTATE_PLANEMASK,0xFFFFFFFF); // this is unlikely to work due to poor driver support + } #endif - enable_texturing(was_textured); - _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, _depth_write_enabled); - } - } + enable_texturing(was_textured); + _d3dDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, _depth_write_enabled); + } + } } //////////////////////////////////////////////////////////////////// @@ -5043,13 +5043,13 @@ end_decal(GeomNode *base_geom) { //////////////////////////////////////////////////////////////////// INLINE float DXGraphicsStateGuardian:: compute_distance_to(const LPoint3f &point) const { - // In the case of a DXGraphicsStateGuardian, we know that the - // modelview matrix already includes the relative transform from the - // camera, as well as a to-y-up conversion. Thus, the distance to - // the camera plane is simply the +z distance. (negative of gl compute_distance_to, - // since d3d uses left-hand coords) + // In the case of a DXGraphicsStateGuardian, we know that the + // modelview matrix already includes the relative transform from the + // camera, as well as a to-y-up conversion. Thus, the distance to + // the camera plane is simply the +z distance. (negative of gl compute_distance_to, + // since d3d uses left-hand coords) - return point[2]; + return point[2]; } //////////////////////////////////////////////////////////////////// @@ -5062,46 +5062,46 @@ compute_distance_to(const LPoint3f &point) const { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: set_draw_buffer(const RenderBuffer &rb) { - dxgsg_cat.fatal() << "DX set_draw_buffer unimplemented!!!"; - return; + dxgsg_cat.fatal() << "DX set_draw_buffer unimplemented!!!"; + return; #ifdef WBD_GL_MODE - switch (rb._buffer_type & RenderBuffer::T_color) { - case RenderBuffer::T_front: - call_glDrawBuffer(GL_FRONT); - break; + switch (rb._buffer_type & RenderBuffer::T_color) { + case RenderBuffer::T_front: + call_glDrawBuffer(GL_FRONT); + break; - case RenderBuffer::T_back: - call_glDrawBuffer(GL_BACK); - break; + case RenderBuffer::T_back: + call_glDrawBuffer(GL_BACK); + break; - case RenderBuffer::T_right: - call_glDrawBuffer(GL_RIGHT); - break; + case RenderBuffer::T_right: + call_glDrawBuffer(GL_RIGHT); + break; - case RenderBuffer::T_left: - call_glDrawBuffer(GL_LEFT); - break; + case RenderBuffer::T_left: + call_glDrawBuffer(GL_LEFT); + break; - case RenderBuffer::T_front_right: - call_glDrawBuffer(GL_FRONT_RIGHT); - break; + case RenderBuffer::T_front_right: + call_glDrawBuffer(GL_FRONT_RIGHT); + break; - case RenderBuffer::T_front_left: - call_glDrawBuffer(GL_FRONT_LEFT); - break; + case RenderBuffer::T_front_left: + call_glDrawBuffer(GL_FRONT_LEFT); + break; - case RenderBuffer::T_back_right: - call_glDrawBuffer(GL_BACK_RIGHT); - break; + case RenderBuffer::T_back_right: + call_glDrawBuffer(GL_BACK_RIGHT); + break; - case RenderBuffer::T_back_left: - call_glDrawBuffer(GL_BACK_LEFT); - break; + case RenderBuffer::T_back_left: + call_glDrawBuffer(GL_BACK_LEFT); + break; - default: - call_glDrawBuffer(GL_FRONT_AND_BACK); - } + default: + call_glDrawBuffer(GL_FRONT_AND_BACK); + } #endif // WBD_GL_MODE } @@ -5113,14 +5113,14 @@ set_draw_buffer(const RenderBuffer &rb) { void DXGraphicsStateGuardian:: set_read_buffer(const RenderBuffer &rb) { - if(rb._buffer_type & RenderBuffer::T_front) { - _cur_read_pixel_buffer=RenderBuffer::T_front; - } else if(rb._buffer_type & RenderBuffer::T_back) { - _cur_read_pixel_buffer=RenderBuffer::T_back; - } else { - dxgsg_cat.error() << "Invalid or unimplemented Argument to set_read_buffer!\n"; - } - return; + if(rb._buffer_type & RenderBuffer::T_front) { + _cur_read_pixel_buffer=RenderBuffer::T_front; + } else if(rb._buffer_type & RenderBuffer::T_back) { + _cur_read_pixel_buffer=RenderBuffer::T_back; + } else { + dxgsg_cat.error() << "Invalid or unimplemented Argument to set_read_buffer!\n"; + } + return; } //////////////////////////////////////////////////////////////////// @@ -5132,15 +5132,15 @@ set_read_buffer(const RenderBuffer &rb) { INLINE D3DTEXTUREADDRESS DXGraphicsStateGuardian:: get_texture_wrap_mode(Texture::WrapMode wm) const { - if (wm == Texture::WM_clamp) - return D3DTADDRESS_CLAMP; - else if (wm != Texture::WM_repeat) { + if (wm == Texture::WM_clamp) + return D3DTADDRESS_CLAMP; + else if (wm != Texture::WM_repeat) { #ifdef _DEBUG - dxgsg_cat.error() << "Invalid or Unimplemented Texture::WrapMode value!\n"; + dxgsg_cat.error() << "Invalid or Unimplemented Texture::WrapMode value!\n"; #endif - } + } - return D3DTADDRESS_WRAP; + return D3DTADDRESS_WRAP; } //////////////////////////////////////////////////////////////////// @@ -5150,19 +5150,19 @@ get_texture_wrap_mode(Texture::WrapMode wm) const { //////////////////////////////////////////////////////////////////// INLINE D3DCMPFUNC DXGraphicsStateGuardian:: get_depth_func_type(DepthTestProperty::Mode m) const { - switch (m) { - case DepthTestProperty::M_never: return D3DCMP_NEVER; - case DepthTestProperty::M_less: return D3DCMP_LESS; - case DepthTestProperty::M_equal: return D3DCMP_EQUAL; - case DepthTestProperty::M_less_equal: return D3DCMP_LESSEQUAL; - case DepthTestProperty::M_greater: return D3DCMP_GREATER; - case DepthTestProperty::M_not_equal: return D3DCMP_NOTEQUAL; - case DepthTestProperty::M_greater_equal: return D3DCMP_GREATEREQUAL; - case DepthTestProperty::M_always: return D3DCMP_ALWAYS; - } - dxgsg_cat.error() - << "Invalid DepthTestProperty::Mode value" << endl; - return D3DCMP_LESS; + switch (m) { + case DepthTestProperty::M_never: return D3DCMP_NEVER; + case DepthTestProperty::M_less: return D3DCMP_LESS; + case DepthTestProperty::M_equal: return D3DCMP_EQUAL; + case DepthTestProperty::M_less_equal: return D3DCMP_LESSEQUAL; + case DepthTestProperty::M_greater: return D3DCMP_GREATER; + case DepthTestProperty::M_not_equal: return D3DCMP_NOTEQUAL; + case DepthTestProperty::M_greater_equal: return D3DCMP_GREATEREQUAL; + case DepthTestProperty::M_always: return D3DCMP_ALWAYS; + } + dxgsg_cat.error() + << "Invalid DepthTestProperty::Mode value" << endl; + return D3DCMP_LESS; } #if 0 @@ -5175,19 +5175,19 @@ get_depth_func_type(DepthTestProperty::Mode m) const { //////////////////////////////////////////////////////////////////// INLINE D3DCMPFUNC DXGraphicsStateGuardian:: get_stencil_func_type(StencilProperty::Mode m) const { - switch (m) { - case StencilProperty::M_never: return D3DCMP_NEVER; - case StencilProperty::M_less: return D3DCMP_LESS; - case StencilProperty::M_equal: return D3DCMP_EQUAL; - case StencilProperty::M_less_equal: return D3DCMP_LESSEQUAL; - case StencilProperty::M_greater: return D3DCMP_GREATER; - case StencilProperty::M_not_equal: return D3DCMP_NOTEQUAL; - case StencilProperty::M_greater_equal: return D3DCMP_GREATEREQUAL; - case StencilProperty::M_always: return D3DCMP_ALWAYS; - } - dxgsg_cat.error() - << "Invalid StencilProperty::Mode value" << endl; - return D3DCMP_LESS; + switch (m) { + case StencilProperty::M_never: return D3DCMP_NEVER; + case StencilProperty::M_less: return D3DCMP_LESS; + case StencilProperty::M_equal: return D3DCMP_EQUAL; + case StencilProperty::M_less_equal: return D3DCMP_LESSEQUAL; + case StencilProperty::M_greater: return D3DCMP_GREATER; + case StencilProperty::M_not_equal: return D3DCMP_NOTEQUAL; + case StencilProperty::M_greater_equal: return D3DCMP_GREATEREQUAL; + case StencilProperty::M_always: return D3DCMP_ALWAYS; + } + dxgsg_cat.error() + << "Invalid StencilProperty::Mode value" << endl; + return D3DCMP_LESS; } @@ -5198,17 +5198,17 @@ get_stencil_func_type(StencilProperty::Mode m) const { //////////////////////////////////////////////////////////////////// INLINE D3DSTENCILOP DXGraphicsStateGuardian:: get_stencil_action_type(StencilProperty::Action a) const { - switch (a) { - case StencilProperty::A_keep: return D3DSTENCILOP_KEEP; - case StencilProperty::A_zero: return D3DSTENCILOP_ZERO; - case StencilProperty::A_replace: return D3DSTENCILOP_REPLACE; - case StencilProperty::A_increment: return D3DSTENCILOP_INCR; - case StencilProperty::A_decrement: return D3DSTENCILOP_DECR; - case StencilProperty::A_invert: return D3DSTENCILOP_INVERT; - } - dxgsg_cat.error() - << "Invalid StencilProperty::Action value" << endl; - return D3DSTENCILOP_KEEP; + switch (a) { + case StencilProperty::A_keep: return D3DSTENCILOP_KEEP; + case StencilProperty::A_zero: return D3DSTENCILOP_ZERO; + case StencilProperty::A_replace: return D3DSTENCILOP_REPLACE; + case StencilProperty::A_increment: return D3DSTENCILOP_INCR; + case StencilProperty::A_decrement: return D3DSTENCILOP_DECR; + case StencilProperty::A_invert: return D3DSTENCILOP_INVERT; + } + dxgsg_cat.error() + << "Invalid StencilProperty::Action value" << endl; + return D3DSTENCILOP_KEEP; } #endif @@ -5220,13 +5220,13 @@ get_stencil_action_type(StencilProperty::Action a) const { //////////////////////////////////////////////////////////////////// INLINE D3DFOGMODE DXGraphicsStateGuardian:: get_fog_mode_type(Fog::Mode m) const { - switch (m) { - case Fog::M_linear: return D3DFOG_LINEAR; - case Fog::M_exponential: return D3DFOG_EXP; - case Fog::M_exponential_squared: return D3DFOG_EXP2; - } - dxgsg_cat.error() << "Invalid Fog::Mode value" << endl; - return D3DFOG_EXP; + switch (m) { + case Fog::M_linear: return D3DFOG_LINEAR; + case Fog::M_exponential: return D3DFOG_EXP; + case Fog::M_exponential_squared: return D3DFOG_EXP2; + } + dxgsg_cat.error() << "Invalid Fog::Mode value" << endl; + return D3DFOG_EXP; } //////////////////////////////////////////////////////////////////// @@ -5237,27 +5237,27 @@ get_fog_mode_type(Fog::Mode m) const { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: free_pointers() { - if (_light_enabled != (bool *)NULL) { - delete[] _light_enabled; - _light_enabled = (bool *)NULL; - } - if (_cur_light_enabled != (bool *)NULL) { - delete[] _cur_light_enabled; - _cur_light_enabled = (bool *)NULL; - } - if (_clip_plane_enabled != (bool *)NULL) { - delete[] _clip_plane_enabled; - _clip_plane_enabled = (bool *)NULL; - } - if (_cur_clip_plane_enabled != (bool *)NULL) { - delete[] _cur_clip_plane_enabled; - _cur_clip_plane_enabled = (bool *)NULL; - } + if (_light_enabled != (bool *)NULL) { + delete[] _light_enabled; + _light_enabled = (bool *)NULL; + } + if (_cur_light_enabled != (bool *)NULL) { + delete[] _cur_light_enabled; + _cur_light_enabled = (bool *)NULL; + } + if (_clip_plane_enabled != (bool *)NULL) { + delete[] _clip_plane_enabled; + _clip_plane_enabled = (bool *)NULL; + } + if (_cur_clip_plane_enabled != (bool *)NULL) { + delete[] _cur_clip_plane_enabled; + _cur_clip_plane_enabled = (bool *)NULL; + } - if (_pTexPixFmts != NULL) { - delete [] _pTexPixFmts; - _pTexPixFmts = NULL; - } + if (_pTexPixFmts != NULL) { + delete [] _pTexPixFmts; + _pTexPixFmts = NULL; + } } //////////////////////////////////////////////////////////////////// @@ -5272,29 +5272,29 @@ free_pointers() { //////////////////////////////////////////////////////////////////// PT(SavedFrameBuffer) DXGraphicsStateGuardian:: save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr) { + CPT(DisplayRegion) dr) { - dxgsg_cat.error() << "save_frame_buffer unimplemented!!\n"; - return NULL; + dxgsg_cat.error() << "save_frame_buffer unimplemented!!\n"; + return NULL; #if 0 - DXSavedFrameBuffer *sfb = new DXSavedFrameBuffer(buffer, dr); + DXSavedFrameBuffer *sfb = new DXSavedFrameBuffer(buffer, dr); - if (buffer._buffer_type & RenderBuffer::T_depth) { - // Save the depth buffer. - sfb->_depth = - new PixelBuffer(PixelBuffer::depth_buffer(dr->get_pixel_width(), - dr->get_pixel_height())); - copy_pixel_buffer(sfb->_depth, dr, buffer); - } + if (buffer._buffer_type & RenderBuffer::T_depth) { + // Save the depth buffer. + sfb->_depth = + new PixelBuffer(PixelBuffer::depth_buffer(dr->get_pixel_width(), + dr->get_pixel_height())); + copy_pixel_buffer(sfb->_depth, dr, buffer); + } - if (buffer._buffer_type & RenderBuffer::T_back) { - // Save the color buffer. - sfb->_back_rgba = new Texture; - copy_texture(sfb->_back_rgba->prepare(this), dr, buffer); - } + if (buffer._buffer_type & RenderBuffer::T_back) { + // Save the color buffer. + sfb->_back_rgba = new Texture; + copy_texture(sfb->_back_rgba->prepare(this), dr, buffer); + } - return sfb; + return sfb; #endif } @@ -5305,25 +5305,25 @@ save_frame_buffer(const RenderBuffer &buffer, //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: restore_frame_buffer(SavedFrameBuffer *frame_buffer) { - - dxgsg_cat.error() << "restore_frame_buffer unimplemented!!\n"; - return; + + dxgsg_cat.error() << "restore_frame_buffer unimplemented!!\n"; + return; #if 0 - DXSavedFrameBuffer *sfb = DCAST(DXSavedFrameBuffer, frame_buffer); + DXSavedFrameBuffer *sfb = DCAST(DXSavedFrameBuffer, frame_buffer); - if (sfb->_back_rgba != (Texture *)NULL && - (sfb->_buffer._buffer_type & RenderBuffer::T_back) != 0) { - // Restore the color buffer. - draw_texture(sfb->_back_rgba->prepare(this), - sfb->_display_region, sfb->_buffer); - } + if (sfb->_back_rgba != (Texture *)NULL && + (sfb->_buffer._buffer_type & RenderBuffer::T_back) != 0) { + // Restore the color buffer. + draw_texture(sfb->_back_rgba->prepare(this), + sfb->_display_region, sfb->_buffer); + } - if (sfb->_depth != (PixelBuffer *)NULL && - (sfb->_buffer._buffer_type & RenderBuffer::T_depth) != 0) { - // Restore the depth buffer. - draw_pixel_buffer(sfb->_depth, sfb->_display_region, sfb->_buffer); - } + if (sfb->_depth != (PixelBuffer *)NULL && + (sfb->_buffer._buffer_type & RenderBuffer::T_depth) != 0) { + // Restore the depth buffer. + draw_pixel_buffer(sfb->_depth, sfb->_display_region, sfb->_buffer); + } #endif } @@ -5331,29 +5331,29 @@ restore_frame_buffer(SavedFrameBuffer *frame_buffer) { GraphicsStateGuardian *DXGraphicsStateGuardian:: make_DXGraphicsStateGuardian(const FactoryParams ¶ms) { - GraphicsStateGuardian::GsgWindow *win_param; - if (!get_param_into(win_param, params)) { - dxgsg_cat.error() - << "No window specified for gsg creation!" << endl; - return NULL; - } + GraphicsStateGuardian::GsgWindow *win_param; + if (!get_param_into(win_param, params)) { + dxgsg_cat.error() + << "No window specified for gsg creation!" << endl; + return NULL; + } - GraphicsWindow *win = win_param->get_window(); - return new DXGraphicsStateGuardian(win); + GraphicsWindow *win = win_param->get_window(); + return new DXGraphicsStateGuardian(win); } TypeHandle DXGraphicsStateGuardian::get_type(void) const { - return get_class_type(); + return get_class_type(); } TypeHandle DXGraphicsStateGuardian::get_class_type(void) { - return _type_handle; + return _type_handle; } void DXGraphicsStateGuardian::init_type(void) { - GraphicsStateGuardian::init_type(); - register_type(_type_handle, "DXGraphicsStateGuardian", - GraphicsStateGuardian::get_class_type()); + GraphicsStateGuardian::init_type(); + register_type(_type_handle, "DXGraphicsStateGuardian", + GraphicsStateGuardian::get_class_type()); } //////////////////////////////////////////////////////////////////// @@ -5363,32 +5363,32 @@ void DXGraphicsStateGuardian::init_type(void) { void DXGraphicsStateGuardian:: dx_cleanup() { - release_all_textures(); + release_all_textures(); - // Do a safe check for releasing the D3DDEVICE. RefCount should be zero. - if (_d3dDevice!=NULL) { - if (0 < _d3dDevice->Release()) { - dxgsg_cat.error() << "DXGraphicsStateGuardian::destructor - d3dDevice reference count > 0" << endl; - } - _d3dDevice = NULL; // clear the pointer in the Gsg - } + // Do a safe check for releasing the D3DDEVICE. RefCount should be zero. + if (_d3dDevice!=NULL) { + if (0 < _d3dDevice->Release()) { + dxgsg_cat.error() << "DXGraphicsStateGuardian::destructor - d3dDevice reference count > 0" << endl; + } + _d3dDevice = NULL; // clear the pointer in the Gsg + } - // Release the DDraw and D3D objects used by the app - RELEASE(_zbuf); - RELEASE(_back); - RELEASE(_pri); + // Release the DDraw and D3D objects used by the app + RELEASE(_zbuf); + RELEASE(_back); + RELEASE(_pri); - RELEASE(_d3d); + RELEASE(_d3d); - // Do a safe check for releasing DDRAW. RefCount should be zero. - if (_pDD!=NULL) { - int val; - if (0 < (val = _pDD->Release())) { - dxgsg_cat.error() - << "DXGraphicsStateGuardian::destructor - IDDraw Obj reference count = " << val << ", should be zero!\n"; - } - _pDD = NULL; - } + // Do a safe check for releasing DDRAW. RefCount should be zero. + if (_pDD!=NULL) { + int val; + if (0 < (val = _pDD->Release())) { + dxgsg_cat.error() + << "DXGraphicsStateGuardian::destructor - IDDraw Obj reference count = " << val << ", should be zero!\n"; + } + _pDD = NULL; + } } //////////////////////////////////////////////////////////////////// @@ -5397,121 +5397,121 @@ dx_cleanup() { //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian:: dx_setup_after_resize(RECT viewrect, HWND mwindow) { - if (_back == NULL) // nothing created yet - return; + if (_back == NULL) // nothing created yet + return; - // for safety, need some better error-cleanup here - assert((_pri!=NULL) && (_back!=NULL) && (_zbuf!=NULL)); + // for safety, need some better error-cleanup here + assert((_pri!=NULL) && (_back!=NULL) && (_zbuf!=NULL)); - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_back); - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_zbuf); + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_back); + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_zbuf); - _back->GetSurfaceDesc(&ddsd_back); - _zbuf->GetSurfaceDesc(&ddsd_zbuf); + _back->GetSurfaceDesc(&ddsd_back); + _zbuf->GetSurfaceDesc(&ddsd_zbuf); #if 0 - DWORD refcnt; - refcnt = _zbuf->Release(); _zbuf = NULL; - dxgsg_cat.error() << "zbuf refcnt= "<Release(); _back = NULL; - dxgsg_cat.error() << "back refcnt= "<Release(); _pri = NULL; - dxgsg_cat.error() << "pri refcnt= "<Release(); _zbuf = NULL; + dxgsg_cat.error() << "zbuf refcnt= "<Release(); _back = NULL; + dxgsg_cat.error() << "back refcnt= "<Release(); _pri = NULL; + dxgsg_cat.error() << "pri refcnt= "<CreateSurface( &ddsd, &_pri, NULL ))) { - dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for primary : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if (FAILED(hr = _pDD->CreateSurface( &ddsd, &_pri, NULL ))) { + dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for primary : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Create a clipper object which handles all our clipping for cases when - // our window is partially obscured by other windows. - LPDIRECTDRAWCLIPPER Clipper; + // Create a clipper object which handles all our clipping for cases when + // our window is partially obscured by other windows. + LPDIRECTDRAWCLIPPER Clipper; - if (FAILED(hr = _pDD->CreateClipper( 0, &Clipper, NULL ))) { - dxgsg_cat.fatal() - << "dxgsg - CreateClipper after resize failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - // Associate the clipper with our window. Note that, afterwards, the - // clipper is internally referenced by the primary surface, so it is safe - // to release our local reference to it. - Clipper->SetHWnd( 0, mwindow ); - _pri->SetClipper( Clipper ); - Clipper->Release(); + if (FAILED(hr = _pDD->CreateClipper( 0, &Clipper, NULL ))) { + dxgsg_cat.fatal() + << "dxgsg - CreateClipper after resize failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + // Associate the clipper with our window. Note that, afterwards, the + // clipper is internally referenced by the primary surface, so it is safe + // to release our local reference to it. + Clipper->SetHWnd( 0, mwindow ); + _pri->SetClipper( Clipper ); + Clipper->Release(); - // Recreate the backbuffer. (might want to handle failure due to running out of video memory) + // Recreate the backbuffer. (might want to handle failure due to running out of video memory) - ddsd_back.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; // just to make sure - ddsd_back.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + ddsd_back.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; // just to make sure + ddsd_back.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; - PRINTVIDMEM(_pDD,&ddsd_back.ddsCaps,"resize backbuffer surf"); + PRINTVIDMEM(_pDD,&ddsd_back.ddsCaps,"resize backbuffer surf"); - if (FAILED(hr = _pDD->CreateSurface( &ddsd_back, &_back, NULL ))) { - dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for backbuffer : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if (FAILED(hr = _pDD->CreateSurface( &ddsd_back, &_back, NULL ))) { + dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for backbuffer : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - PRINTVIDMEM(_pDD,&ddsd_back.ddsCaps,"resize zbuffer surf"); + PRINTVIDMEM(_pDD,&ddsd_back.ddsCaps,"resize zbuffer surf"); - // Recreate and attach a z-buffer. - if (FAILED(hr = _pDD->CreateSurface( &ddsd_zbuf, &_zbuf, NULL ))) { - dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for Z buffer: result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Recreate and attach a z-buffer. + if (FAILED(hr = _pDD->CreateSurface( &ddsd_zbuf, &_zbuf, NULL ))) { + dxgsg_cat.fatal() << "DXGraphicsStateGuardian::resize() - CreateSurface failed for Z buffer: result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Attach the z-buffer to the back buffer. - if ((hr = _back->AddAttachedSurface( _zbuf ) ) != DD_OK) { - dxgsg_cat.fatal() - << "DXGraphicsStateGuardian::resize() - AddAttachedSurface failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Attach the z-buffer to the back buffer. + if ((hr = _back->AddAttachedSurface( _zbuf ) ) != DD_OK) { + dxgsg_cat.fatal() + << "DXGraphicsStateGuardian::resize() - AddAttachedSurface failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if ((hr = _d3dDevice->SetRenderTarget(_back,0x0) ) != DD_OK) { - dxgsg_cat.fatal() - << "DXGraphicsStateGuardian::resize() - SetRenderTarget failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if ((hr = _d3dDevice->SetRenderTarget(_back,0x0) ) != DD_OK) { + dxgsg_cat.fatal() + << "DXGraphicsStateGuardian::resize() - SetRenderTarget failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Create the viewport - D3DVIEWPORT7 vp = { 0, 0, renderWid, renderHt, 0.0f, 1.0f}; - hr = _d3dDevice->SetViewport( &vp ); - if (hr != DD_OK) { - dxgsg_cat.fatal() - << "DXGraphicsStateGuardian:: SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the viewport + D3DVIEWPORT7 vp = { 0, 0, renderWid, renderHt, 0.0f, 1.0f}; + hr = _d3dDevice->SetViewport( &vp ); + if (hr != DD_OK) { + dxgsg_cat.fatal() + << "DXGraphicsStateGuardian:: SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } } bool refill_tex_callback(TextureContext *tc,void *void_dxgsg_ptr) { - DXTextureContext *dtc = DCAST(DXTextureContext, tc); -// DXGraphicsStateGuardian *dxgsg = (DXGraphicsStateGuardian *)void_dxgsg_ptr; + DXTextureContext *dtc = DCAST(DXTextureContext, tc); +// DXGraphicsStateGuardian *dxgsg = (DXGraphicsStateGuardian *)void_dxgsg_ptr; - // Re-fill the contents of textures and vertex buffers - // which just got restored now. + // Re-fill the contents of textures and vertex buffers + // which just got restored now. HRESULT hr=dtc->FillDDSurfTexturePixels(); - return hr==S_OK; + return hr==S_OK; } HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void) { @@ -5524,9 +5524,9 @@ HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void) { // note: could go through and just restore surfs that return IsLost() true // apparently that isnt as reliable w/some drivers tho if (FAILED(hr = _pDD->RestoreAllSurfaces() )) { - dxgsg_cat.fatal() - << "DXGraphicsStateGuardian:: RestoreAllSurfs failed : result = " << ConvD3DErrorToString(hr) << endl; - return hr; + dxgsg_cat.fatal() + << "DXGraphicsStateGuardian:: RestoreAllSurfs failed : result = " << ConvD3DErrorToString(hr) << endl; + return hr; } // cant access template in libpanda.dll directly due to vc++ limitations, use traverser to get around it @@ -5543,10 +5543,10 @@ HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void) { void DXGraphicsStateGuardian::show_frame(void) { PStatTimer timer(_win->_swap_pcollector); // this times just the flip, so it must go here in dxgsg, instead of wdxdisplay, which would time the whole frame - if(_pri==NULL) - return; + if(_pri==NULL) + return; - if(dx_full_screen) { + if(dx_full_screen) { show_full_screen_frame(); } else { show_windowed_frame(); @@ -5580,7 +5580,7 @@ void DXGraphicsStateGuardian::show_full_screen_frame(void) { dxgsg_cat.spam() << "DXGraphicsStateGuardian:: no exclusive mode, waiting...\n"; #endif - Sleep( 500 ); // Dont consume CPU. + Sleep( 500 ); // Dont consume CPU. throw_event("PandaPaused"); // throw panda event to invoke network-only processing _win->process_events(); @@ -5599,12 +5599,12 @@ void DXGraphicsStateGuardian::show_full_screen_frame(void) { RestoreAllVideoSurfaces(); #ifdef _DEBUG - dxgsg_cat.debug() << "DXGraphicsStateGuardian:: refill done...\n"; + dxgsg_cat.debug() << "DXGraphicsStateGuardian:: refill done...\n"; #endif _dx_ready = TRUE; - return; // need to re-render scene before we can display it + return; // need to re-render scene before we can display it } if(hr != DD_OK) { @@ -5629,17 +5629,17 @@ void DXGraphicsStateGuardian::show_windowed_frame(void) { HRESULT hr; - // TestCooperativeLevel returns DD_OK: If the current mode is same as the one which the App set. - // The following two errors are returned to NORMALMODE (windowed)apps only. - // - // DDERR_WRONGMODE: If the App is a windowed app and the current mode is - // not the same as the one in which the app was created. - // DDERR_EXCLUSIVEMODEALREADYSET: If another app took exclusivemode access + // TestCooperativeLevel returns DD_OK: If the current mode is same as the one which the App set. + // The following two errors are returned to NORMALMODE (windowed)apps only. + // + // DDERR_WRONGMODE: If the App is a windowed app and the current mode is + // not the same as the one in which the app was created. + // DDERR_EXCLUSIVEMODEALREADYSET: If another app took exclusivemode access hr = _pDD->TestCooperativeLevel(); while(hr == DDERR_EXCLUSIVEMODEALREADYSET) { - // This means that mode changes had taken place, surfaces - // were lost but still we are in the original mode, so we - // simply restore all surfaces and keep going. + // This means that mode changes had taken place, surfaces + // were lost but still we are in the original mode, so we + // simply restore all surfaces and keep going. _dx_ready = FALSE; @@ -5647,15 +5647,15 @@ void DXGraphicsStateGuardian::show_windowed_frame(void) { dxgsg_cat.spam() << "DXGraphicsStateGuardian:: another app has exclusive mode, waiting...\n"; #endif - Sleep( 500 ); // Dont consume CPU. + Sleep( 500 ); // Dont consume CPU. throw_event("PandaPaused"); // throw panda event to invoke network-only processing hr = _pDD->TestCooperativeLevel(); } if(hr==DDERR_WRONGMODE) { - // This means that the desktop mode has changed - // need to destroy all of dx stuff and recreate everything back again, which is a big hit + // This means that the desktop mode has changed + // need to destroy all of dx stuff and recreate everything back again, which is a big hit dxgsg_cat.error() << "DXGraphicsStateGuardian:: detected display mode change in TestCoopLevel, must recreate all DDraw surfaces, D3D devices, this is not handled yet. " << ConvD3DErrorToString(hr) << endl; exit(1); return; @@ -5671,11 +5671,11 @@ void DXGraphicsStateGuardian::show_windowed_frame(void) { #endif RestoreAllVideoSurfaces(); #ifdef _DEBUG - dxgsg_cat.debug() << "DXGraphicsStateGuardian:: refill done...\n"; + dxgsg_cat.debug() << "DXGraphicsStateGuardian:: refill done...\n"; #endif _dx_ready = TRUE; - return; // need to re-render scene before we can display it + return; // need to re-render scene before we can display it } else { dxgsg_cat.error() << "DXGraphicsStateGuardian::show_frame() - Blt failed : " << ConvD3DErrorToString(hr) << endl; exit(1); @@ -5699,14 +5699,14 @@ void DXGraphicsStateGuardian::show_windowed_frame(void) { // Description: we receive the new x and y position of the client //////////////////////////////////////////////////////////////////// void DXGraphicsStateGuardian::adjust_view_rect(int x, int y) { - if (_view_rect.left != x || _view_rect.top != y) { - _view_rect.right = x + _view_rect.right - _view_rect.left; - _view_rect.left = x; - _view_rect.bottom = y + _view_rect.bottom - _view_rect.top; - _view_rect.top = y; + if (_view_rect.left != x || _view_rect.top != y) { + _view_rect.right = x + _view_rect.right - _view_rect.left; + _view_rect.left = x; + _view_rect.bottom = y + _view_rect.bottom - _view_rect.top; + _view_rect.top = y; // set_clipper(clip_rect); - } + } } #if 0 @@ -5716,58 +5716,58 @@ void DXGraphicsStateGuardian::adjust_view_rect(int x, int y) { // function builds a 4x4 view matrix. //----------------------------------------------------------------------------- HRESULT SetViewMatrix( D3DMATRIX& mat, D3DVECTOR& vFrom, D3DVECTOR& vAt, - D3DVECTOR& vWorldUp ) { - // Get the z basis vector, which points straight ahead. This is the - // difference from the eyepoint to the lookat point. - D3DVECTOR vView = vAt - vFrom; + D3DVECTOR& vWorldUp ) { + // Get the z basis vector, which points straight ahead. This is the + // difference from the eyepoint to the lookat point. + D3DVECTOR vView = vAt - vFrom; - float fLength = Magnitude( vView ); - if (fLength < 1e-6f) - return E_INVALIDARG; + float fLength = Magnitude( vView ); + if (fLength < 1e-6f) + return E_INVALIDARG; - // Normalize the z basis vector - vView /= fLength; + // Normalize the z basis vector + vView /= fLength; - // Get the dot product, and calculate the projection of the z basis - // vector onto the up vector. The projection is the y basis vector. - float fDotProduct = DotProduct( vWorldUp, vView ); + // Get the dot product, and calculate the projection of the z basis + // vector onto the up vector. The projection is the y basis vector. + float fDotProduct = DotProduct( vWorldUp, vView ); - D3DVECTOR vUp = vWorldUp - fDotProduct * vView; + D3DVECTOR vUp = vWorldUp - fDotProduct * vView; - // If this vector has near-zero length because the input specified a - // bogus up vector, let's try a default up vector - if (1e-6f > ( fLength = Magnitude( vUp ) )) { - vUp = D3DVECTOR( 0.0f, 1.0f, 0.0f ) - vView.y * vView; + // If this vector has near-zero length because the input specified a + // bogus up vector, let's try a default up vector + if (1e-6f > ( fLength = Magnitude( vUp ) )) { + vUp = D3DVECTOR( 0.0f, 1.0f, 0.0f ) - vView.y * vView; - // If we still have near-zero length, resort to a different axis. - if (1e-6f > ( fLength = Magnitude( vUp ) )) { - vUp = D3DVECTOR( 0.0f, 0.0f, 1.0f ) - vView.z * vView; + // If we still have near-zero length, resort to a different axis. + if (1e-6f > ( fLength = Magnitude( vUp ) )) { + vUp = D3DVECTOR( 0.0f, 0.0f, 1.0f ) - vView.z * vView; - if (1e-6f > ( fLength = Magnitude( vUp ) )) - return E_INVALIDARG; - } - } + if (1e-6f > ( fLength = Magnitude( vUp ) )) + return E_INVALIDARG; + } + } - // Normalize the y basis vector - vUp /= fLength; + // Normalize the y basis vector + vUp /= fLength; - // The x basis vector is found simply with the cross product of the y - // and z basis vectors - D3DVECTOR vRight = CrossProduct( vUp, vView ); + // The x basis vector is found simply with the cross product of the y + // and z basis vectors + D3DVECTOR vRight = CrossProduct( vUp, vView ); - // Start building the matrix. The first three rows contains the basis - // vectors used to rotate the view to point at the lookat point - mat._11 = vRight.x; mat._12 = vUp.x; mat._13 = vView.x; mat._14 = 0.0f; - mat._21 = vRight.y; mat._22 = vUp.y; mat._23 = vView.y; mat._24 = 0.0f; - mat._31 = vRight.z; mat._32 = vUp.z; mat._33 = vView.z; mat._34 = 0.0f; + // Start building the matrix. The first three rows contains the basis + // vectors used to rotate the view to point at the lookat point + mat._11 = vRight.x; mat._12 = vUp.x; mat._13 = vView.x; mat._14 = 0.0f; + mat._21 = vRight.y; mat._22 = vUp.y; mat._23 = vView.y; mat._24 = 0.0f; + mat._31 = vRight.z; mat._32 = vUp.z; mat._33 = vView.z; mat._34 = 0.0f; - // Do the translation values (rotations are still about the eyepoint) - mat._41 = - DotProduct( vFrom, vRight ); - mat._42 = - DotProduct( vFrom, vUp ); - mat._43 = - DotProduct( vFrom, vView ); - mat._44 = 1.0f; + // Do the translation values (rotations are still about the eyepoint) + mat._41 = - DotProduct( vFrom, vRight ); + mat._42 = - DotProduct( vFrom, vUp ); + mat._43 = - DotProduct( vFrom, vView ); + mat._44 = 1.0f; - return S_OK; + return S_OK; } #endif diff --git a/panda/src/dxgsg/dxGraphicsStateGuardian.h b/panda/src/dxgsg/dxGraphicsStateGuardian.h index 39999f030c..ba0d41e422 100644 --- a/panda/src/dxgsg/dxGraphicsStateGuardian.h +++ b/panda/src/dxgsg/dxGraphicsStateGuardian.h @@ -73,7 +73,7 @@ extern void dbgPrintVidMem(LPDIRECTDRAW7 pDD, LPDDSCAPS2 lpddsCaps,const char *p #endif //////////////////////////////////////////////////////////////////// -// Class : DXGraphicsStateGuardian +// Class : DXGraphicsStateGuardian // Description : A GraphicsStateGuardian specialized for rendering // into DX. There should be no DX calls // outside of this object. @@ -92,15 +92,15 @@ public: virtual void render_frame(const AllAttributesWrapper &initial_state); virtual void render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual void draw_point(const GeomPoint *geom); virtual void draw_line(const GeomLine *geom); @@ -126,16 +126,16 @@ public: virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb); virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb, - const DisplayRegion *dr); + const DisplayRegion *dr); virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr); virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void apply_material(const Material *material); virtual void apply_fog(Fog *fog); @@ -181,7 +181,7 @@ public: protected: void free_pointers(); virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); virtual void restore_frame_buffer(SavedFrameBuffer *frame_buffer); INLINE void activate(); @@ -196,18 +196,18 @@ protected: INLINE void add_to_FVFBuf(void *data, size_t bytes) ; WORD *_index_buf; // base of malloced array - bool _dx_ready; + bool _dx_ready; bool _bIsTNLDevice; LPDIRECTDRAWSURFACE7 _back; LPDIRECTDRAWSURFACE7 _zbuf; LPDIRECT3D7 _d3d; LPDIRECT3DDEVICE7 _d3dDevice; LPDIRECTDRAWSURFACE7 _pri; - LPDIRECTDRAW7 _pDD; + LPDIRECTDRAW7 _pDD; - RECT _view_rect; - RECT clip_rect; - HDC _hdc; + RECT _view_rect; + RECT clip_rect; + HDC _hdc; int _cNumTexPixFmts; LPDDPIXELFORMAT _pTexPixFmts; DXTextureContext *_pCurTexContext; @@ -218,10 +218,10 @@ protected: void set_clipper(RECT cliprect); void GenerateSphere(void *pVertexSpace,DWORD dwVertSpaceByteSize, - void *pIndexSpace,DWORD dwIndexSpaceByteSize, - D3DVECTOR *pCenter, float fRadius, - DWORD wNumRings, DWORD wNumSections, float sx, float sy, float sz, - DWORD *pNumVertices,DWORD *pNumIndices,DWORD fvfFlags,DWORD dwVertSize); + void *pIndexSpace,DWORD dwIndexSpaceByteSize, + D3DVECTOR *pCenter, float fRadius, + DWORD wNumRings, DWORD wNumSections, float sx, float sy, float sz, + DWORD *pNumVertices,DWORD *pNumIndices,DWORD fvfFlags,DWORD dwVertSize); HRESULT DXGraphicsStateGuardian::RestoreAllVideoSurfaces(void); INLINE void set_pack_alignment(int alignment); @@ -270,9 +270,9 @@ protected: #endif // for drawing primitives - Colorf p_color; - Normalf p_normal; - Vertexf p_vertex; + Colorf p_color; + Normalf p_normal; + Vertexf p_vertex; TexCoordf p_texcoord; D3DCOLOR p_colr; @@ -321,8 +321,8 @@ protected: // int _pack_alignment; // int _unpack_alignment; - bool _issued_color_enabled; // WBD ADDED - D3DCOLOR _issued_color; // WBD ADDED + bool _issued_color_enabled; // WBD ADDED + D3DCOLOR _issued_color; // WBD ADDED D3DSHADEMODE _CurShadeMode; @@ -408,13 +408,13 @@ public: void show_frame(); void show_full_screen_frame(); void show_windowed_frame(); - void init_dx( LPDIRECTDRAW7 context, - LPDIRECTDRAWSURFACE7 pri, - LPDIRECTDRAWSURFACE7 back, - LPDIRECTDRAWSURFACE7 zbuf, - LPDIRECT3D7 d3d, - LPDIRECT3DDEVICE7 d3dDevice, - RECT viewrect); + void init_dx( LPDIRECTDRAW7 context, + LPDIRECTDRAWSURFACE7 pri, + LPDIRECTDRAWSURFACE7 back, + LPDIRECTDRAWSURFACE7 zbuf, + LPDIRECT3D7 d3d, + LPDIRECT3DDEVICE7 d3dDevice, + RECT viewrect); friend HRESULT CALLBACK EnumTexFmtsCallback( LPDDPIXELFORMAT pddpf, VOID* param ); private: static TypeHandle _type_handle; diff --git a/panda/src/dxgsg/dxSavedFrameBuffer.h b/panda/src/dxgsg/dxSavedFrameBuffer.h index b69ab29f63..8e5831df25 100644 --- a/panda/src/dxgsg/dxSavedFrameBuffer.h +++ b/panda/src/dxgsg/dxSavedFrameBuffer.h @@ -15,13 +15,13 @@ //////////////////////////////////////////////////////////////////// -// Class : DXSavedFrameBuffer +// Class : DXSavedFrameBuffer // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDADX DXSavedFrameBuffer : public SavedFrameBuffer { public: INLINE DXSavedFrameBuffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); INLINE ~DXSavedFrameBuffer(); PT(Texture) _back_rgba; @@ -34,7 +34,7 @@ public: static void init_type() { SavedFrameBuffer::init_type(); register_type(_type_handle, "DXSavedFrameBuffer", - SavedFrameBuffer::get_class_type()); + SavedFrameBuffer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/dxgsg/dxTextureContext.cxx b/panda/src/dxgsg/dxTextureContext.cxx index 2af083c229..c625c14b9b 100644 --- a/panda/src/dxgsg/dxTextureContext.cxx +++ b/panda/src/dxgsg/dxTextureContext.cxx @@ -22,18 +22,18 @@ //#define FORCE_16bpp_1555 typedef enum { - None,Conv32to32,Conv32to32_NoAlpha,Conv32to24,Conv32to16_0555, - Conv32to16_1555,Conv32to16_0565,Conv32to16_4444,Conv24to32,Conv24to24, - Conv24to16_0555,Conv24to16_0565,ConvLum16to16_1555,ConvLum16to16_4444, - ConvLum16to32,ConvLum16to16,ConvLum8to8,ConvLum8to24,ConvLum8to32,ConvLum8to16_0555,ConvLum8to16_0565 + None,Conv32to32,Conv32to32_NoAlpha,Conv32to24,Conv32to16_0555, + Conv32to16_1555,Conv32to16_0565,Conv32to16_4444,Conv24to32,Conv24to24, + Conv24to16_0555,Conv24to16_0565,ConvLum16to16_1555,ConvLum16to16_4444, + ConvLum16to32,ConvLum16to16,ConvLum8to8,ConvLum8to24,ConvLum8to32,ConvLum8to16_0555,ConvLum8to16_0565 } ConversionType; #ifdef _DEBUG char *ConvNameStrs[] = {"None","Conv32to32","Conv32to32_NoAlpha","Conv32to24","Conv32to16_0555", - "Conv32to16_1555","Conv32to16_0565","Conv32to16_4444","Conv24to32","Conv24to24", - "Conv24to16_0555","Conv24to16_0565","ConvLum16to16_1555","ConvLum16to16_4444", - "ConvLum16to32","ConvLum16to16","ConvLum8to8","ConvLum8to24","ConvLum8to32", - "ConvLum8to16_0555","ConvLum8to16_0565" + "Conv32to16_1555","Conv32to16_0565","Conv32to16_4444","Conv24to32","Conv24to24", + "Conv24to16_0555","Conv24to16_0565","ConvLum16to16_1555","ConvLum16to16_4444", + "ConvLum16to32","ConvLum16to16","ConvLum8to8","ConvLum8to24","ConvLum8to32", + "ConvLum8to16_0555","ConvLum8to16_0565" }; #endif @@ -43,46 +43,46 @@ TypeHandle DXTextureContext::_type_handle; #ifdef _DEBUG static void DebugPrintPixFmt(DDPIXELFORMAT* pddpf) { - static int iddpfnum=0; - ostream *dbgout = &dxgsg_cat.debug(); + static int iddpfnum=0; + ostream *dbgout = &dxgsg_cat.debug(); - *dbgout << "DDPF[" << iddpfnum << "]: RGBBitCount:" << pddpf->dwRGBBitCount - << " Flags:" << (void *)pddpf->dwFlags ; + *dbgout << "DDPF[" << iddpfnum << "]: RGBBitCount:" << pddpf->dwRGBBitCount + << " Flags:" << (void *)pddpf->dwFlags ; - if(pddpf->dwFlags & DDPF_RGB) { - *dbgout << " RGBmask:" << (void *) (pddpf->dwRBitMask | pddpf->dwGBitMask | pddpf->dwBBitMask); - *dbgout << " Rmask:" << (void *) (pddpf->dwRBitMask); - } + if(pddpf->dwFlags & DDPF_RGB) { + *dbgout << " RGBmask:" << (void *) (pddpf->dwRBitMask | pddpf->dwGBitMask | pddpf->dwBBitMask); + *dbgout << " Rmask:" << (void *) (pddpf->dwRBitMask); + } - if(pddpf->dwFlags & DDPF_ALPHAPIXELS) { - *dbgout << " Amask:" << (void *) pddpf->dwRGBAlphaBitMask; - } + if(pddpf->dwFlags & DDPF_ALPHAPIXELS) { + *dbgout << " Amask:" << (void *) pddpf->dwRGBAlphaBitMask; + } - if(pddpf->dwFlags & DDPF_LUMINANCE) { - *dbgout << " Lummask:" << (void *) pddpf->dwLuminanceBitMask; - } + if(pddpf->dwFlags & DDPF_LUMINANCE) { + *dbgout << " Lummask:" << (void *) pddpf->dwLuminanceBitMask; + } - *dbgout << endl; + *dbgout << endl; - iddpfnum++; + iddpfnum++; } void PrintLastError(char *msgbuf) { - DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; + DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; - if(msgbuf==NULL) { - LPVOID lpMsgBuf; - dwFlags|=FORMAT_MESSAGE_ALLOCATE_BUFFER; - FormatMessage( dwFlags, - NULL,GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf,0,NULL ); - MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); - LocalFree(lpMsgBuf); - } else { - FormatMessage( dwFlags, - NULL,GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) msgbuf,500,NULL ); - } + if(msgbuf==NULL) { + LPVOID lpMsgBuf; + dwFlags|=FORMAT_MESSAGE_ALLOCATE_BUFFER; + FormatMessage( dwFlags, + NULL,GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf,0,NULL ); + MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION ); + LocalFree(lpMsgBuf); + } else { + FormatMessage( dwFlags, + NULL,GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) msgbuf,500,NULL ); + } } #endif @@ -113,10 +113,10 @@ enum Format { }; enum Type { - T_unsigned_byte, // 1 byte per channel - T_unsigned_short, // 2 byte per channel - T_unsigned_byte_332, // RGB in 1 byte - T_float, // 1 channel stored as float + T_unsigned_byte, // 1 byte per channel + T_unsigned_short, // 2 byte per channel + T_unsigned_byte_332, // RGB in 1 byte + T_float, // 1 channel stored as float }; */ @@ -131,785 +131,785 @@ enum Format { unsigned int DXTextureContext:: get_bits_per_pixel(PixelBuffer::Format format, int *alphbits) { - *alphbits = 0; // assume no alpha bits - switch(format) { - case PixelBuffer::F_alpha: - *alphbits = 8; - return 8; - case PixelBuffer::F_color_index: - case PixelBuffer::F_red: - case PixelBuffer::F_green: - case PixelBuffer::F_blue: - case PixelBuffer::F_rgb332: - case PixelBuffer::F_luminance_alphamask: - *alphbits = 1; - return 16; - case PixelBuffer::F_luminance_alpha: - *alphbits = 8; - return 16; - case PixelBuffer::F_luminance: - return 8; - case PixelBuffer::F_rgba4: - *alphbits = 4; - return 16; - case PixelBuffer::F_rgba5: - *alphbits = 1; - return 16; - case PixelBuffer::F_depth_component: - case PixelBuffer::F_rgb5: - return 16; - case PixelBuffer::F_rgb8: - case PixelBuffer::F_rgb: - return 24; - case PixelBuffer::F_rgba8: - case PixelBuffer::F_rgba: - *alphbits = 8; - return 32; - case PixelBuffer::F_rgbm: - *alphbits = 1; - return 32; - case PixelBuffer::F_rgb12: - return 36; - case PixelBuffer::F_rgba12: - *alphbits = 12; - return 48; - } - return 8; + *alphbits = 0; // assume no alpha bits + switch(format) { + case PixelBuffer::F_alpha: + *alphbits = 8; + return 8; + case PixelBuffer::F_color_index: + case PixelBuffer::F_red: + case PixelBuffer::F_green: + case PixelBuffer::F_blue: + case PixelBuffer::F_rgb332: + case PixelBuffer::F_luminance_alphamask: + *alphbits = 1; + return 16; + case PixelBuffer::F_luminance_alpha: + *alphbits = 8; + return 16; + case PixelBuffer::F_luminance: + return 8; + case PixelBuffer::F_rgba4: + *alphbits = 4; + return 16; + case PixelBuffer::F_rgba5: + *alphbits = 1; + return 16; + case PixelBuffer::F_depth_component: + case PixelBuffer::F_rgb5: + return 16; + case PixelBuffer::F_rgb8: + case PixelBuffer::F_rgb: + return 24; + case PixelBuffer::F_rgba8: + case PixelBuffer::F_rgba: + *alphbits = 8; + return 32; + case PixelBuffer::F_rgbm: + *alphbits = 1; + return 32; + case PixelBuffer::F_rgb12: + return 36; + case PixelBuffer::F_rgba12: + *alphbits = 12; + return 48; + } + return 8; } HRESULT ConvertPixBuftoDDSurf(ConversionType ConvNeeded,BYTE *pbuf,LPDIRECTDRAWSURFACE7 pDDSurf) { - HRESULT hr; - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); + HRESULT hr; + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); - if(FAILED( hr = pDDSurf->Lock( NULL, &ddsd, DDLOCK_NOSYSLOCK | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL ))) { - dxgsg_cat.error() << "CreateTexture failed: _surface->Lock() failed on texture! hr = " << ConvD3DErrorToString(hr) << "\n"; - return hr; - } + if(FAILED( hr = pDDSurf->Lock( NULL, &ddsd, DDLOCK_NOSYSLOCK | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL ))) { + dxgsg_cat.error() << "CreateTexture failed: _surface->Lock() failed on texture! hr = " << ConvD3DErrorToString(hr) << "\n"; + return hr; + } - //pbuf contains raw ARGB in PixelBuffer byteorder + //pbuf contains raw ARGB in PixelBuffer byteorder - DWORD lPitch = ddsd.lPitch; - BYTE* pDDSurfBytes = (BYTE*)ddsd.lpSurface; - DWORD dwOrigWidth=ddsd.dwWidth,dwOrigHeight=ddsd.dwHeight; + DWORD lPitch = ddsd.lPitch; + BYTE* pDDSurfBytes = (BYTE*)ddsd.lpSurface; + DWORD dwOrigWidth=ddsd.dwWidth,dwOrigHeight=ddsd.dwHeight; - switch(ConvNeeded) { - case Conv32to32: - case Conv32to32_NoAlpha: { + switch(ConvNeeded) { + case Conv32to32: + case Conv32to32_NoAlpha: { - DWORD *pSrcWord = (DWORD *) pbuf; - DWORD *pDstWord; - DWORD dwAlphaMaskOff = (ConvNeeded==Conv32to32_NoAlpha) ? 0x00FFFFFF : 0xFFFFFFFF; + DWORD *pSrcWord = (DWORD *) pbuf; + DWORD *pDstWord; + DWORD dwAlphaMaskOff = (ConvNeeded==Conv32to32_NoAlpha) ? 0x00FFFFFF : 0xFFFFFFFF; - for(DWORD y=0; y>24)); // unsigned >>, no need to & - b = (BYTE)((dwPixel>>16)&0x000000ff); - g = (BYTE)((dwPixel>> 8)&0x000000ff); - r = (BYTE)((dwPixel )&0x000000ff); + BYTE r,g,b,a; + a = (BYTE)((dwPixel>>24)); // unsigned >>, no need to & + b = (BYTE)((dwPixel>>16)&0x000000ff); + g = (BYTE)((dwPixel>> 8)&0x000000ff); + r = (BYTE)((dwPixel )&0x000000ff); - *pDstWord = (a << 24) | (r << 16)| (g << 8) | b; + *pDstWord = (a << 24) | (r << 16)| (g << 8) | b; #else - BYTE r,b; - // simpler: just swap r & b - b = (BYTE)((dwPixel>>16)&0x000000ff); - r = (BYTE)((dwPixel )&0x000000ff); - *pDstWord = ((dwPixel & 0xff00ff00) | (r<<16) | b) & dwAlphaMaskOff; + BYTE r,b; + // simpler: just swap r & b + b = (BYTE)((dwPixel>>16)&0x000000ff); + r = (BYTE)((dwPixel )&0x000000ff); + *pDstWord = ((dwPixel & 0xff00ff00) | (r<<16) | b) & dwAlphaMaskOff; #endif - } - } - break; - } + } + } + break; + } - case Conv32to16_1555: - case Conv32to16_0555: { - DWORD *pSrcWord = (DWORD *) pbuf; - WORD *pDstWord; - DWORD dwAlphaMaskOff = (ConvNeeded==Conv32to16_0555) ? 0x7FFF : 0xFFFF; + case Conv32to16_1555: + case Conv32to16_0555: { + DWORD *pSrcWord = (DWORD *) pbuf; + WORD *pDstWord; + DWORD dwAlphaMaskOff = (ConvNeeded==Conv32to16_0555) ? 0x7FFF : 0xFFFF; - assert(ddsd.ddpfPixelFormat.dwRBitMask==0x7C00); - // for some reason, bits are 'in-order' when converting to 16bit + assert(ddsd.ddpfPixelFormat.dwRBitMask==0x7C00); + // for some reason, bits are 'in-order' when converting to 16bit - // just handle 1/15 alpha/rgb - for(DWORD y=0; y>16) & 0x00008000); // just copy high bit + abit = ((dwPixel>>16) & 0x00008000); // just copy high bit - // just look at most-signf-bit for alpha. (alternately, could - // convert any non-zero alpha to full transparent) + // just look at most-signf-bit for alpha. (alternately, could + // convert any non-zero alpha to full transparent) - b = (BYTE)((dwPixel>>16) & 0x000000ff) >> 3; - g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 3; - r = (BYTE)((dwPixel ) & 0x000000ff) >> 3; + b = (BYTE)((dwPixel>>16) & 0x000000ff) >> 3; + g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 3; + r = (BYTE)((dwPixel ) & 0x000000ff) >> 3; - // code truncates 8 bit values to 5 bit (or 1 for alpha) + // code truncates 8 bit values to 5 bit (or 1 for alpha) - *pDstWord = (abit | (r << 10)| (g << 5) | b) & dwAlphaMaskOff; - } - } - break; - } + *pDstWord = (abit | (r << 10)| (g << 5) | b) & dwAlphaMaskOff; + } + } + break; + } - case Conv32to16_0565: { // could merge this w/above case, but whatever - DWORD *pSrcWord = (DWORD *) pbuf; - WORD *pDstWord; + case Conv32to16_0565: { // could merge this w/above case, but whatever + DWORD *pSrcWord = (DWORD *) pbuf; + WORD *pDstWord; - assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); - // for some reason, bits are 'in-order' when converting to 16bit + assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); + // for some reason, bits are 'in-order' when converting to 16bit - // just handle 1/15 alpha/rgb - for(DWORD y=0; y>16) & 0x000000ff) >> 3; - g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 2; - r = (BYTE)((dwPixel ) & 0x000000ff) >> 3; + b = (BYTE)((dwPixel>>16) & 0x000000ff) >> 3; + g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 2; + r = (BYTE)((dwPixel ) & 0x000000ff) >> 3; - // code truncates 8 bit values to 5 bit (or 1 for alpha) + // code truncates 8 bit values to 5 bit (or 1 for alpha) - *pDstWord = ((r << 11)| (g << 5) | b); - } - } - break; - } + *pDstWord = ((r << 11)| (g << 5) | b); + } + } + break; + } - case Conv32to24: { + case Conv32to24: { - DWORD *pSrcWord = (DWORD *) pbuf; - BYTE *pDstWord; + DWORD *pSrcWord = (DWORD *) pbuf; + BYTE *pDstWord; - for(DWORD y=0; y>16) & 0x000000ff); - g = (BYTE)((dwPixel>> 8) & 0x000000ff); - r = (BYTE)((dwPixel ) & 0x000000ff); + b = (BYTE)((dwPixel>>16) & 0x000000ff); + g = (BYTE)((dwPixel>> 8) & 0x000000ff); + r = (BYTE)((dwPixel ) & 0x000000ff); - *pDstWord = r; - *(pDstWord+1) = g; - *(pDstWord+2) = b; - } - } - break; - } + *pDstWord = r; + *(pDstWord+1) = g; + *(pDstWord+2) = b; + } + } + break; + } - case Conv32to16_4444: { - DWORD *pSrcWord = (DWORD *) pbuf; - WORD *pDstWord; + case Conv32to16_4444: { + DWORD *pSrcWord = (DWORD *) pbuf; + WORD *pDstWord; - assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000); // assumes ARGB - assert(ddsd.ddpfPixelFormat.dwRBitMask==0x0f00); // assumes ARGB + assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000); // assumes ARGB + assert(ddsd.ddpfPixelFormat.dwRBitMask==0x0f00); // assumes ARGB - for(DWORD y=0; y>24)) >> 4; - b = (BYTE)((dwPixel>>16) & 0x000000ff) >> 4; - g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 4; - r = (BYTE)((dwPixel ) & 0x000000ff) >> 4; + a = (BYTE)((dwPixel>>24)) >> 4; + b = (BYTE)((dwPixel>>16) & 0x000000ff) >> 4; + g = (BYTE)((dwPixel>> 8) & 0x000000ff) >> 4; + r = (BYTE)((dwPixel ) & 0x000000ff) >> 4; - *pDstWord = (a << 12) | (r << 8)| (g << 4) | b; - } - } - break; - } + *pDstWord = (a << 12) | (r << 8)| (g << 4) | b; + } + } + break; + } - case Conv24to24: { + case Conv24to24: { - BYTE *pSrcWord = (BYTE *) pbuf; - BYTE *pDstWord; + BYTE *pSrcWord = (BYTE *) pbuf; + BYTE *pDstWord; - for(DWORD y=0; y> 3; - g = *(pSrcWord+1) >> 3; - b = *(pSrcWord+2) >> 3; + // pixel buffer is in ABGR format (orig fmt designed for big-endian RGBA) + // need to change byte order to ARGB + r = *pSrcWord >> 3; + g = *(pSrcWord+1) >> 3; + b = *(pSrcWord+2) >> 3; - // code truncates 8 bit values to 5 bit, leaves high bit as 0 + // code truncates 8 bit values to 5 bit, leaves high bit as 0 - *pDstWord = (r << 10)| (g << 5) | b; - } - } - break; - } + *pDstWord = (r << 10)| (g << 5) | b; + } + } + break; + } - case Conv24to16_0565: { - BYTE *pSrcWord = (BYTE *) pbuf; - WORD *pDstWord; + case Conv24to16_0565: { + BYTE *pSrcWord = (BYTE *) pbuf; + WORD *pDstWord; - assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); - // for some reason, bits are 'in-order' when converting to 16bit + assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); + // for some reason, bits are 'in-order' when converting to 16bit - for(DWORD y=0; y> 3; - g = *(pSrcWord+1) >> 2; - b = *(pSrcWord+2) >> 3; + // pixel buffer is in ABGR format (orig fmt designed for big-endian RGBA) + // need to change byte order to ARGB + r = *pSrcWord >> 3; + g = *(pSrcWord+1) >> 2; + b = *(pSrcWord+2) >> 3; - // code truncates 8 bit values to 5 bit, leaves high bit as 0 + // code truncates 8 bit values to 5 bit, leaves high bit as 0 - *pDstWord = (r << 11)| (g << 5) | b; - } - } - break; - } + *pDstWord = (r << 11)| (g << 5) | b; + } + } + break; + } - case Conv24to32: { + case Conv24to32: { - BYTE *pSrcWord = (BYTE *) pbuf; - DWORD *pDstWord; + BYTE *pSrcWord = (BYTE *) pbuf; + DWORD *pDstWord; - for(DWORD y=0; y> 8; - r = dwPixel & 0xFF; + a = dwPixel >> 8; + r = dwPixel & 0xFF; - *pDstWord = (a<<24)| (r << 16)| (r << 8) | r; - } - } - break; - } + *pDstWord = (a<<24)| (r << 16)| (r << 8) | r; + } + } + break; + } - case ConvLum16to16_4444: { - WORD *pSrcWord = (WORD *) pbuf; - WORD *pDstWord; + case ConvLum16to16_4444: { + WORD *pSrcWord = (WORD *) pbuf; + WORD *pDstWord; - assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000); // assumes ARGB + assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0xf000); // assumes ARGB - for(DWORD y=0; y>8) >> 4; - r = (BYTE)(dwPixel & 0x000000ff) >> 4; + a = (BYTE)(dwPixel>>8) >> 4; + r = (BYTE)(dwPixel & 0x000000ff) >> 4; - *pDstWord = (a << 12) | (r << 8)| (r << 4) | r; - } - } - break; - } + *pDstWord = (a << 12) | (r << 8)| (r << 4) | r; + } + } + break; + } - case ConvLum16to16_1555: { - WORD *pSrcWord = (WORD *) pbuf; - WORD *pDstWord; + case ConvLum16to16_1555: { + WORD *pSrcWord = (WORD *) pbuf; + WORD *pDstWord; - assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0x8000); // assumes ARGB + assert(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask==0x8000); // assumes ARGB - for(DWORD y=0; y> 3; + r = (BYTE)(dwPixel & 0x000000ff) >> 3; - *pDstWord = (dwPixel & 0x8000) | (r << 10)| (r << 5) | r; - } - } - break; - } + *pDstWord = (dwPixel & 0x8000) | (r << 10)| (r << 5) | r; + } + } + break; + } - case ConvLum16to16: { - // AL bytes are in same order - CopyMemory(pDDSurfBytes,pbuf,dwOrigWidth*dwOrigHeight*2); - break; - } + case ConvLum16to16: { + // AL bytes are in same order + CopyMemory(pDDSurfBytes,pbuf,dwOrigWidth*dwOrigHeight*2); + break; + } - case ConvLum8to16_0565: - case ConvLum8to16_0555: { - BYTE *pSrcWord = (BYTE *) pbuf; - WORD *pDstWord; - DWORD FarShift,OrVal,MiddleRoundShift; - - if(ConvNeeded==ConvLum8to16_0555) { - FarShift=10; OrVal=0x8000; // turn on alpha bit, just in case - MiddleRoundShift = 3; - assert(ddsd.ddpfPixelFormat.dwRBitMask==0x7C00); - } else { - FarShift=11; OrVal=0x0; - MiddleRoundShift = 2; - assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); - } + case ConvLum8to16_0565: + case ConvLum8to16_0555: { + BYTE *pSrcWord = (BYTE *) pbuf; + WORD *pDstWord; + DWORD FarShift,OrVal,MiddleRoundShift; + + if(ConvNeeded==ConvLum8to16_0555) { + FarShift=10; OrVal=0x8000; // turn on alpha bit, just in case + MiddleRoundShift = 3; + assert(ddsd.ddpfPixelFormat.dwRBitMask==0x7C00); + } else { + FarShift=11; OrVal=0x0; + MiddleRoundShift = 2; + assert(ddsd.ddpfPixelFormat.dwRBitMask==0xF800); + } - for(DWORD y=0; y> 3; - GrnVal = (BYTE) dwPixel >> MiddleRoundShift; + for(DWORD y=0; y> 3; + GrnVal = (BYTE) dwPixel >> MiddleRoundShift; - // code truncates 8 bit values to 5 bit (set alpha=1 for opaque) + // code truncates 8 bit values to 5 bit (set alpha=1 for opaque) - *pDstWord = ((r << FarShift)| (GrnVal << 5) | r) | OrVal; - } - } - break; - } - - case ConvLum8to8: { - CopyMemory(pDDSurfBytes,pbuf,dwOrigWidth*dwOrigHeight); - break; - } - - case ConvLum8to32: { + *pDstWord = ((r << FarShift)| (GrnVal << 5) | r) | OrVal; + } + } + break; + } + + case ConvLum8to8: { + CopyMemory(pDDSurfBytes,pbuf,dwOrigWidth*dwOrigHeight); + break; + } + + case ConvLum8to32: { - // this is kind of a waste of space, but we trade it for lum resolution - BYTE *pSrcWord = (BYTE *) pbuf; - DWORD *pDstWord; - - for(DWORD y=0; yUnlock(NULL); - return E_INVALIDARG; - } - - pDDSurf->Unlock(NULL); - - return S_OK; + default: + dxgsg_cat.error() << "CreateTexture failed! unhandled texture conversion type: "<< ConvNeeded <<" \n"; + pDDSurf->Unlock(NULL); + return E_INVALIDARG; + } + + pDDSurf->Unlock(NULL); + + return S_OK; } HRESULT ConvertDDSurftoPixBuf(PixelBuffer *pixbuf,LPDIRECTDRAWSURFACE7 pDDSurf) { - HRESULT hr; - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); + HRESULT hr; + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); - DWORD dwNumComponents=pixbuf->get_num_components(); + DWORD dwNumComponents=pixbuf->get_num_components(); - assert(pixbuf->get_component_width()==sizeof(BYTE)); // cant handle anything else now - assert(pixbuf->get_image_type()==PixelBuffer::T_unsigned_byte); // cant handle anything else now - assert((dwNumComponents==3) || (dwNumComponents==4)); // cant handle anything else now + assert(pixbuf->get_component_width()==sizeof(BYTE)); // cant handle anything else now + assert(pixbuf->get_image_type()==PixelBuffer::T_unsigned_byte); // cant handle anything else now + assert((dwNumComponents==3) || (dwNumComponents==4)); // cant handle anything else now - BYTE *pbuf=pixbuf->_image.p(); + BYTE *pbuf=pixbuf->_image.p(); - if(FAILED( hr = pDDSurf->Lock( NULL, &ddsd, DDLOCK_NOSYSLOCK | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL ))) { - dxgsg_cat.error() << "ConvertDDSurftoPixBuf Lock() failed! hr = " << ConvD3DErrorToString(hr) << "\n"; - return hr; - } + if(FAILED( hr = pDDSurf->Lock( NULL, &ddsd, DDLOCK_NOSYSLOCK | DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL ))) { + dxgsg_cat.error() << "ConvertDDSurftoPixBuf Lock() failed! hr = " << ConvD3DErrorToString(hr) << "\n"; + return hr; + } - DWORD dwXWindowOffset=0,dwYWindowOffset=0; - DWORD dwCopyWidth=ddsd.dwWidth,dwCopyHeight=ddsd.dwHeight; + DWORD dwXWindowOffset=0,dwYWindowOffset=0; + DWORD dwCopyWidth=ddsd.dwWidth,dwCopyHeight=ddsd.dwHeight; // get window offset so we know where to start grabbing pixels - LPDIRECTDRAWCLIPPER pDDClipper; - hr = pDDSurf->GetClipper(&pDDClipper); + LPDIRECTDRAWCLIPPER pDDClipper; + hr = pDDSurf->GetClipper(&pDDClipper); #ifdef _DEBUG - if(FAILED(hr) && !((hr == DDERR_NOCLIPPERATTACHED) && dx_full_screen)) { - dxgsg_cat.error() << "ConvertDDSurftoPixBuf GetClipper failed! hr = " << ConvD3DErrorToString(hr) << "\n"; - return hr; - } + if(FAILED(hr) && !((hr == DDERR_NOCLIPPERATTACHED) && dx_full_screen)) { + dxgsg_cat.error() << "ConvertDDSurftoPixBuf GetClipper failed! hr = " << ConvD3DErrorToString(hr) << "\n"; + return hr; + } #endif - if(hr==S_OK) { - HWND hWin; + if(hr==S_OK) { + HWND hWin; - if(FAILED(hr = pDDClipper->GetHWnd(&hWin))) { - dxgsg_cat.error() << "ConvertDDSurftoPixBuf GetHwnd failed! hr = " << ConvD3DErrorToString(hr) << "\n"; - return hr; - } + if(FAILED(hr = pDDClipper->GetHWnd(&hWin))) { + dxgsg_cat.error() << "ConvertDDSurftoPixBuf GetHwnd failed! hr = " << ConvD3DErrorToString(hr) << "\n"; + return hr; + } - RECT view_rect; - GetClientRect( hWin, &view_rect ); - ClientToScreen( hWin, (POINT*)&view_rect.left ); - ClientToScreen( hWin, (POINT*)&view_rect.right ); + RECT view_rect; + GetClientRect( hWin, &view_rect ); + ClientToScreen( hWin, (POINT*)&view_rect.left ); + ClientToScreen( hWin, (POINT*)&view_rect.right ); - dwXWindowOffset=view_rect.left; - dwYWindowOffset=view_rect.top; - dwCopyWidth=view_rect.right-view_rect.left; - dwCopyHeight=view_rect.bottom-view_rect.top; + dwXWindowOffset=view_rect.left; + dwYWindowOffset=view_rect.top; + dwCopyWidth=view_rect.right-view_rect.left; + dwCopyHeight=view_rect.bottom-view_rect.top; - pDDClipper->Release(); // dec ref cnt - } + pDDClipper->Release(); // dec ref cnt + } - //make sure there's enough space in the pixbuf, its size must match (especially xsize) + //make sure there's enough space in the pixbuf, its size must match (especially xsize) // or scanlines will be too long - if(!((dwCopyWidth==pixbuf->get_xsize()) && (dwCopyHeight<=pixbuf->get_ysize()))) { - pDDSurf->Unlock(NULL); - assert(0); - dxgsg_cat.error() << "ConvertDDSurftoPixBuf, PixBuf incorrect size to hold display surface!\n"; - return E_FAIL; - } + if(!((dwCopyWidth==pixbuf->get_xsize()) && (dwCopyHeight<=pixbuf->get_ysize()))) { + pDDSurf->Unlock(NULL); + assert(0); + dxgsg_cat.error() << "ConvertDDSurftoPixBuf, PixBuf incorrect size to hold display surface!\n"; + return E_FAIL; + } - // others not handled yet - assert((ddsd.ddpfPixelFormat.dwRGBBitCount==32)||(ddsd.ddpfPixelFormat.dwRGBBitCount==16)||(ddsd.ddpfPixelFormat.dwRGBBitCount==24)); + // others not handled yet + assert((ddsd.ddpfPixelFormat.dwRGBBitCount==32)||(ddsd.ddpfPixelFormat.dwRGBBitCount==16)||(ddsd.ddpfPixelFormat.dwRGBBitCount==24)); - //pbuf contains raw ARGB in PixelBuffer byteorder + //pbuf contains raw ARGB in PixelBuffer byteorder - DWORD lPitch = ddsd.lPitch; - BYTE* pDDSurfBytes = (BYTE*)ddsd.lpSurface; + DWORD lPitch = ddsd.lPitch; + BYTE* pDDSurfBytes = (BYTE*)ddsd.lpSurface; - if(dwNumComponents==4) { - DWORD *pDstWord = (DWORD *) pbuf; - switch(ddsd.ddpfPixelFormat.dwRGBBitCount) { - - case 32: { - DWORD *pSrcWord; + if(dwNumComponents==4) { + DWORD *pDstWord = (DWORD *) pbuf; + switch(ddsd.ddpfPixelFormat.dwRGBBitCount) { - pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); - for(DWORD y=0; y>16)&0x000000ff); - g = (BYTE)((dwPixel>> 8)&0x000000ff); - b = (BYTE)((dwPixel )&0x000000ff); + // pixel buffer is in ABGR format(it stores big-endian RGBA) + // need to change byte order from ARGB - *pDstWord = (dwPixel & 0xff00ff00) | (r<<16) | b; - } - } - break; - } + // simpler: just swap r & b + r = (BYTE)((dwPixel>>16)&0x000000ff); + g = (BYTE)((dwPixel>> 8)&0x000000ff); + b = (BYTE)((dwPixel )&0x000000ff); - case 24: { - BYTE *pSrcByte; + *pDstWord = (dwPixel & 0xff00ff00) | (r<<16) | b; + } + } + break; + } - pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); - for(DWORD y=0; y> greenshift; - r = (dwPixel & redmask) >> redshift; + pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); + for(DWORD y=0; y> greenshift; + r = (dwPixel & redmask) >> redshift; - pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); - for(DWORD y=0; y>16)&0x000000ff); - g = (BYTE)((dwPixel>> 8)&0x000000ff); - b = (BYTE)((dwPixel )&0x000000ff); + for(DWORD x=0; x>16)&0x000000ff); + g = (BYTE)((dwPixel>> 8)&0x000000ff); + b = (BYTE)((dwPixel )&0x000000ff); - pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); - for(DWORD y=0; y> greenshift; - r = (dwPixel & redmask) >> redshift; + if(ddsd.ddpfPixelFormat.dwRBitMask==0xF800) { + redshift=(11-3); + redmask=0xF800; + greenmask=0x07E0; + greenshift=(5-2); + bluemask=0x001F; + blueshift=3; + } else if(ddsd.ddpfPixelFormat.dwRBitMask==0x7C00) { + redmask=0x7C00; + redshift=(10-3); + greenmask=0x03E0; + greenshift=(5-3); + bluemask=0x001F; + blueshift=3; + } else { + assert(ddsd.ddpfPixelFormat.dwRBitMask==0x0F00); + redmask=0x0F00; + redshift=4; + greenmask=0x00F0; + greenshift=0; + bluemask=0x000F; + blueshift=4; + } - *pDstByte++ = r; - *pDstByte++ = g; - *pDstByte++ = b; - } - } - } - break; - } - } + pDDSurfBytes+=ddsd.lPitch*(dwYWindowOffset+dwCopyHeight-1); + for(DWORD y=0; y> greenshift; + r = (dwPixel & redmask) >> redshift; + + *pDstByte++ = r; + *pDstByte++ = g; + *pDstByte++ = b; + } + } + } + break; + } + } - pDDSurf->Unlock(NULL); + pDDSurf->Unlock(NULL); - return S_OK; + return S_OK; } //----------------------------------------------------------------------------- @@ -920,850 +920,850 @@ HRESULT ConvertDDSurftoPixBuf(PixelBuffer *pixbuf,LPDIRECTDRAWSURFACE7 pDDSurf) //----------------------------------------------------------------------------- LPDIRECTDRAWSURFACE7 DXTextureContext:: CreateTexture(LPDIRECT3DDEVICE7 pd3dDevice, int cNumTexPixFmts, LPDDPIXELFORMAT pTexPixFmts) { - HRESULT hr; - int i; - PixelBuffer *pbuf = _texture->_pbuffer; - int cNumAlphaBits; // number of alpha bits in texture pixfmt + HRESULT hr; + int i; + PixelBuffer *pbuf = _texture->_pbuffer; + int cNumAlphaBits; // number of alpha bits in texture pixfmt - DDPIXELFORMAT *pDesiredPixFmt; - LPDIRECTDRAWSURFACE7 pddsRender; - LPDIRECTDRAW7 pDD = NULL; + DDPIXELFORMAT *pDesiredPixFmt; + LPDIRECTDRAWSURFACE7 pddsRender; + LPDIRECTDRAW7 pDD = NULL; - DDPIXELFORMAT TexFmtsArr[MAX_DX_TEXPIXFMTS]; + DDPIXELFORMAT TexFmtsArr[MAX_DX_TEXPIXFMTS]; - ConversionType ConvNeeded; + ConversionType ConvNeeded; - // make local copy of array so I can muck with it during searches for this texture fmt - memcpy(TexFmtsArr,pTexPixFmts,cNumTexPixFmts*sizeof(DDPIXELFORMAT)); - pTexPixFmts=TexFmtsArr; + // make local copy of array so I can muck with it during searches for this texture fmt + memcpy(TexFmtsArr,pTexPixFmts,cNumTexPixFmts*sizeof(DDPIXELFORMAT)); + pTexPixFmts=TexFmtsArr; - // bpp indicates requested fmt, not pixbuf fmt - DWORD bpp = get_bits_per_pixel(pbuf->get_format(), &cNumAlphaBits); - PixelBuffer::Type pixbuf_type = pbuf->get_image_type(); - DWORD cNumColorChannels = pbuf->get_num_components(); + // bpp indicates requested fmt, not pixbuf fmt + DWORD bpp = get_bits_per_pixel(pbuf->get_format(), &cNumAlphaBits); + PixelBuffer::Type pixbuf_type = pbuf->get_image_type(); + DWORD cNumColorChannels = pbuf->get_num_components(); - assert(pbuf->get_component_width()==sizeof(BYTE)); // cant handle anything else now - assert(pixbuf_type==PixelBuffer::T_unsigned_byte); // cant handle anything else now + assert(pbuf->get_component_width()==sizeof(BYTE)); // cant handle anything else now + assert(pixbuf_type==PixelBuffer::T_unsigned_byte); // cant handle anything else now - if((pixbuf_type != PixelBuffer::T_unsigned_byte) || (pbuf->get_component_width()!=1)) { - dxgsg_cat.error() << "CreateTexture failed, havent handled non 8-bit channel pixelbuffer types yet! \n"; - return NULL; - } + if((pixbuf_type != PixelBuffer::T_unsigned_byte) || (pbuf->get_component_width()!=1)) { + dxgsg_cat.error() << "CreateTexture failed, havent handled non 8-bit channel pixelbuffer types yet! \n"; + return NULL; + } - DWORD dwOrigWidth = (DWORD)pbuf->get_xsize(); - DWORD dwOrigHeight = (DWORD)pbuf->get_ysize(); + DWORD dwOrigWidth = (DWORD)pbuf->get_xsize(); + DWORD dwOrigHeight = (DWORD)pbuf->get_ysize(); - // Get the device caps so we can check if the device has any constraints - // when using textures - D3DDEVICEDESC7 devDesc; - if(FAILED( pd3dDevice->GetCaps( &devDesc ) )) { - goto error_exit; - } + // Get the device caps so we can check if the device has any constraints + // when using textures + D3DDEVICEDESC7 devDesc; + if(FAILED( pd3dDevice->GetCaps( &devDesc ) )) { + goto error_exit; + } - // Setup the new surface desc for the texture. Note how we are using the - // texture manage attribute, so Direct3D does alot of dirty work for us - DDSURFACEDESC2 ddsd; - ZeroMemory( &ddsd, sizeof(DDSURFACEDESC2) ); - ddsd.dwSize = sizeof(DDSURFACEDESC2); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH - | DDSD_PIXELFORMAT ; + // Setup the new surface desc for the texture. Note how we are using the + // texture manage attribute, so Direct3D does alot of dirty work for us + DDSURFACEDESC2 ddsd; + ZeroMemory( &ddsd, sizeof(DDSURFACEDESC2) ); + ddsd.dwSize = sizeof(DDSURFACEDESC2); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH + | DDSD_PIXELFORMAT ; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - // setup ddpf to match against avail fmts + // setup ddpf to match against avail fmts - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; + ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - if((pbuf->get_format() == PixelBuffer::F_luminance_alpha)|| - (pbuf->get_format() == PixelBuffer::F_luminance_alphamask) || - (pbuf->get_format() == PixelBuffer::F_luminance)) { - ddsd.ddpfPixelFormat.dwFlags = DDPF_LUMINANCE; - } + if((pbuf->get_format() == PixelBuffer::F_luminance_alpha)|| + (pbuf->get_format() == PixelBuffer::F_luminance_alphamask) || + (pbuf->get_format() == PixelBuffer::F_luminance)) { + ddsd.ddpfPixelFormat.dwFlags = DDPF_LUMINANCE; + } - ddsd.ddpfPixelFormat.dwRGBBitCount = bpp; + ddsd.ddpfPixelFormat.dwRGBBitCount = bpp; - if(cNumAlphaBits) { - if(bpp == 8 && cNumAlphaBits == 8) { // handle special case: Alpha only buffer - ddsd.dwFlags |= DDPF_ALPHA; - ddsd.dwAlphaBitDepth = 8; - ddsd.ddpfPixelFormat.dwAlphaBitDepth = 8; - ddsd.ddpfPixelFormat.dwFlags = DDPF_ALPHA; - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xff; - } else { - ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS; - if(cNumAlphaBits == 8) - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xff000000; - else if(cNumAlphaBits == 4) - ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xf000; - } - } + if(cNumAlphaBits) { + if(bpp == 8 && cNumAlphaBits == 8) { // handle special case: Alpha only buffer + ddsd.dwFlags |= DDPF_ALPHA; + ddsd.dwAlphaBitDepth = 8; + ddsd.ddpfPixelFormat.dwAlphaBitDepth = 8; + ddsd.ddpfPixelFormat.dwFlags = DDPF_ALPHA; + ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xff; + } else { + ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS; + if(cNumAlphaBits == 8) + ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xff000000; + else if(cNumAlphaBits == 4) + ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xf000; + } + } - ddsd.dwWidth = dwOrigWidth; - ddsd.dwHeight = dwOrigHeight; + ddsd.dwWidth = dwOrigWidth; + ddsd.dwHeight = dwOrigHeight; #define ISPOW2(X) (((X) & ((X)-1))==0) - if(!ISPOW2(ddsd.dwWidth) || !ISPOW2(ddsd.dwHeight)) { - dxgsg_cat.error() << "ERROR: texture dimensions are not a power of 2 for " << _tex->get_name() << "!!!!! \n"; + if(!ISPOW2(ddsd.dwWidth) || !ISPOW2(ddsd.dwHeight)) { + dxgsg_cat.error() << "ERROR: texture dimensions are not a power of 2 for " << _tex->get_name() << "!!!!! \n"; #ifdef _DEBUG - exit(1); // want to catch badtexsize errors + exit(1); // want to catch badtexsize errors #else - goto error_exit; + goto error_exit; #endif - } + } - BOOL bShrinkOriginal; + BOOL bShrinkOriginal; - bShrinkOriginal=FALSE; - if((dwOrigWidth>devDesc.dwMaxTextureWidth)||(dwOrigHeight>devDesc.dwMaxTextureHeight)) { + bShrinkOriginal=FALSE; + if((dwOrigWidth>devDesc.dwMaxTextureWidth)||(dwOrigHeight>devDesc.dwMaxTextureHeight)) { #ifdef _DEBUG - dxgsg_cat.error() << "WARNING: " <<_tex->get_name() << ": Image size exceeds max texture dimensions of (" << devDesc.dwMaxTextureWidth << "," << devDesc.dwMaxTextureHeight << ") !!\n" - << "Scaling "<< _tex->get_name() << " ("<< dwOrigWidth<<"," < ("<< devDesc.dwMaxTextureWidth << "," << devDesc.dwMaxTextureHeight << ") !\n"; + dxgsg_cat.error() << "WARNING: " <<_tex->get_name() << ": Image size exceeds max texture dimensions of (" << devDesc.dwMaxTextureWidth << "," << devDesc.dwMaxTextureHeight << ") !!\n" + << "Scaling "<< _tex->get_name() << " ("<< dwOrigWidth<<"," < ("<< devDesc.dwMaxTextureWidth << "," << devDesc.dwMaxTextureHeight << ") !\n"; #endif - if(dwOrigWidth>devDesc.dwMaxTextureWidth) - ddsd.dwWidth=devDesc.dwMaxTextureWidth; - if(dwOrigHeight>devDesc.dwMaxTextureHeight) - ddsd.dwHeight=devDesc.dwMaxTextureHeight; - bShrinkOriginal=TRUE; - } + if(dwOrigWidth>devDesc.dwMaxTextureWidth) + ddsd.dwWidth=devDesc.dwMaxTextureWidth; + if(dwOrigHeight>devDesc.dwMaxTextureHeight) + ddsd.dwHeight=devDesc.dwMaxTextureHeight; + bShrinkOriginal=TRUE; + } #if 0 - // checks for SQUARE reqmt - //riva128 seems to handle non-sq fine. is it wasting mem to do this? do I care or should I shrink to be sure we save mem? - if((ddsd.dwWidth != ddsd.dwHeight) && (devDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )) { + // checks for SQUARE reqmt + //riva128 seems to handle non-sq fine. is it wasting mem to do this? do I care or should I shrink to be sure we save mem? + if((ddsd.dwWidth != ddsd.dwHeight) && (devDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_SQUAREONLY )) { - // assume pow2 textures. sum exponents, divide by 2 rounding down to get sq size - int i,width_exp,height_exp; - for(i=ddsd.dwWidth,width_exp=0;i>1;width_exp++,i>>=1); - for(i=ddsd.dwHeight,height_exp=0;i>1;height_exp++,i>>=1); - ddsd.dwHeight = ddsd.dwWidth = 1<<((width_exp+height_exp)>>1); - bShrinkOriginal=TRUE; + // assume pow2 textures. sum exponents, divide by 2 rounding down to get sq size + int i,width_exp,height_exp; + for(i=ddsd.dwWidth,width_exp=0;i>1;width_exp++,i>>=1); + for(i=ddsd.dwHeight,height_exp=0;i>1;height_exp++,i>>=1); + ddsd.dwHeight = ddsd.dwWidth = 1<<((width_exp+height_exp)>>1); + bShrinkOriginal=TRUE; #ifdef _DEBUG - dxgsg_cat.debug() << "Scaling "<< _tex->get_name() << " ("<< dwOrigWidth<<"," < ("<< ddsd.dwWidth<<"," << ddsd.dwHeight << ") to meet HW square texture reqmt\n"; + dxgsg_cat.debug() << "Scaling "<< _tex->get_name() << " ("<< dwOrigWidth<<"," < ("<< ddsd.dwWidth<<"," << ddsd.dwHeight << ") to meet HW square texture reqmt\n"; #endif - } + } #endif - if(bShrinkOriginal) { - // need 2 add checks for errors - PNMImage pnmi_src; - PNMImage *pnmi = new PNMImage(ddsd.dwWidth, ddsd.dwHeight, cNumColorChannels); - pbuf->store(pnmi_src); - pnmi->quick_filter_from(pnmi_src,0,0); + if(bShrinkOriginal) { + // need 2 add checks for errors + PNMImage pnmi_src; + PNMImage *pnmi = new PNMImage(ddsd.dwWidth, ddsd.dwHeight, cNumColorChannels); + pbuf->store(pnmi_src); + pnmi->quick_filter_from(pnmi_src,0,0); - pbuf->load(*pnmi); // violates device independence of pixbufs + pbuf->load(*pnmi); // violates device independence of pixbufs - dwOrigWidth = (DWORD)pbuf->get_xsize(); - dwOrigHeight = (DWORD)pbuf->get_ysize(); - delete pnmi; - } + dwOrigWidth = (DWORD)pbuf->get_xsize(); + dwOrigHeight = (DWORD)pbuf->get_ysize(); + delete pnmi; + } #if 0 //#ifdef _DEBUG // use dxcapsviewer - { static BOOL bPrinted=FALSE; - if(!bPrinted) { - dxgsg_cat.debug() << "Gfx card supported TexFmts:\n"; - for(i=0;idwFlags & (DDPF_BUMPLUMINANCE|DDPF_BUMPDUDV) ) || - ( pCurPixFmt->dwFourCC != 0 ) || - ((cNumAlphaBits==0) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS))) { + // Mark formats I dont want to deal with + for(i=0,pCurPixFmt=pTexPixFmts;idwFlags & (DDPF_BUMPLUMINANCE|DDPF_BUMPDUDV) ) || + ( pCurPixFmt->dwFourCC != 0 ) || + ((cNumAlphaBits==0) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS))) { - // Make sure to skip any FourCC formats, bump formats - // they are not handled by this code yet + // Make sure to skip any FourCC formats, bump formats + // they are not handled by this code yet - // note: I'm screening out alpha if no alpha requested, so - // search fails if 32-rgba avail, but not 32-bit rgb - // I could recode for that case too, hopefully this case will not pop up + // note: I'm screening out alpha if no alpha requested, so + // search fails if 32-rgba avail, but not 32-bit rgb + // I could recode for that case too, hopefully this case will not pop up - pCurPixFmt->dwRGBBitCount+=1; // incr so it wont be an exact match anymore - } - } + pCurPixFmt->dwRGBBitCount+=1; // incr so it wont be an exact match anymore + } + } - assert(((cNumColorChannels==4)||(cNumColorChannels==2))==(cNumAlphaBits>0)); + assert(((cNumColorChannels==4)||(cNumColorChannels==2))==(cNumAlphaBits>0)); - // handle each bitdepth separately + // handle each bitdepth separately - switch(bpp) { // bpp is REQUESTED bpp, not what exists in the pixbuf array - - case 32: + switch(bpp) { // bpp is REQUESTED bpp, not what exists in the pixbuf array + + case 32: #ifdef _DEBUG - if(!dx_force_16bpptextures) + if(!dx_force_16bpptextures) #endif - for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==32) && - (((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)!=0)==(cNumAlphaBits!=0))) { - // we should have a match - assert(pCurPixFmt->dwRGBAlphaBitMask==0xFF000000); - ConvNeeded=((cNumColorChannels==3) ? Conv24to32 : Conv32to32); - goto found_matching_format; - break; - } - } + for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==32) && + (((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)!=0)==(cNumAlphaBits!=0))) { + // we should have a match + assert(pCurPixFmt->dwRGBAlphaBitMask==0xFF000000); + ConvNeeded=((cNumColorChannels==3) ? Conv24to32 : Conv32to32); + goto found_matching_format; + break; + } + } - if(cNumAlphaBits>0) { - // no 32-bit fmt, look for 16 bit w/alpha (1-15) + if(cNumAlphaBits>0) { + // no 32-bit fmt, look for 16 bit w/alpha (1-15) - // 32 bit RGBA was requested, but only 16 bit alpha fmts are avail - // by default, convert to 4-4-4-4 which has 4-bit alpha for blurry edges - // if we know tex only needs 1 bit alpha (i.e. for a mask), use 1555 instead + // 32 bit RGBA was requested, but only 16 bit alpha fmts are avail + // by default, convert to 4-4-4-4 which has 4-bit alpha for blurry edges + // if we know tex only needs 1 bit alpha (i.e. for a mask), use 1555 instead - ConversionType ConvTo1=Conv32to16_4444,ConvTo2=Conv32to16_1555; - DWORD dwAlphaMask1=0xF000,dwAlphaMask2=0x8000; - // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion - // this should be true on most cards. + ConversionType ConvTo1=Conv32to16_4444,ConvTo2=Conv32to16_1555; + DWORD dwAlphaMask1=0xF000,dwAlphaMask2=0x8000; + // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion + // this should be true on most cards. #ifndef FORCE_16bpp_1555 - if(cNumAlphaBits==1) + if(cNumAlphaBits==1) #endif - { - ConvTo1=Conv32to16_1555; - dwAlphaMask1=0x8000; - } + { + ConvTo1=Conv32to16_1555; + dwAlphaMask1=0x8000; + } - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) - && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask1)) { - ConvNeeded=ConvTo1; - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) + && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask1)) { + ConvNeeded=ConvTo1; + goto found_matching_format; + } + } #ifdef FORCE_16bpp_1555 - break; + break; #endif - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) - && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask2)) { - ConvNeeded=ConvTo2; - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) + && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask2)) { + ConvNeeded=ConvTo2; + goto found_matching_format; + } + } - // at this point, bail. dont worry about converting to non-alpha formats yet, - // I think this will be a very rare case - szErrorMsg = "CreateTexture failed: couldn't find compatible Tex DDPIXELFORMAT! no available 16 or 32-bit alpha formats!\n"; - } + // at this point, bail. dont worry about converting to non-alpha formats yet, + // I think this will be a very rare case + szErrorMsg = "CreateTexture failed: couldn't find compatible Tex DDPIXELFORMAT! no available 16 or 32-bit alpha formats!\n"; + } - break; + break; - case 24: + case 24: - assert(cNumAlphaBits==0); // dont know how to handle non-zero alpha for 24bit total + assert(cNumAlphaBits==0); // dont know how to handle non-zero alpha for 24bit total #ifdef _DEBUG - if(!dx_force_16bpptextures) + if(!dx_force_16bpptextures) #endif - for(i=0,pCurPixFmt=pTexPixFmts;idwFlags & DDPF_RGB)&&(pCurPixFmt->dwRGBBitCount==24)) { - ConvNeeded=((cNumColorChannels==3) ? Conv24to24 : Conv32to24); - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=pTexPixFmts;idwFlags & DDPF_RGB)&&(pCurPixFmt->dwRGBBitCount==24)) { + ConvNeeded=((cNumColorChannels==3) ? Conv24to24 : Conv32to24); + goto found_matching_format; + } + } #ifdef _DEBUG - if(!dx_force_16bpptextures) + if(!dx_force_16bpptextures) #endif - // no 24-bit fmt. look for 32 bit fmt (note: this is memory-hogging choice - // instead I could look for memory-conserving 16-bit fmt). - // check mask to ensure ARGB, not RGBA (which I am not handling here) - for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_RGB) - && ((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0xFFFFFF) - ) { - // I'm allowing alpha formats here. will set alpha to opaque - ConvNeeded=((cNumColorChannels==3) ? Conv24to32 : Conv32to32_NoAlpha); - goto found_matching_format; - } - } + // no 24-bit fmt. look for 32 bit fmt (note: this is memory-hogging choice + // instead I could look for memory-conserving 16-bit fmt). + // check mask to ensure ARGB, not RGBA (which I am not handling here) + for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_RGB) + && ((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0xFFFFFF) + ) { + // I'm allowing alpha formats here. will set alpha to opaque + ConvNeeded=((cNumColorChannels==3) ? Conv24to32 : Conv32to32_NoAlpha); + goto found_matching_format; + } + } - // no 24-bit or 32 fmt. look for 16 bit fmt - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];i16 conversion, should be true on most cards. - if((pCurPixFmt->dwFlags & DDPF_RGB) && (pCurPixFmt->dwRGBBitCount==16) - && !(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) { // no alpha fmts - // if numchan==4,this means user has requested we throw away the input alpha channel - if(pCurPixFmt->dwGBitMask==0x7E0) { - // assumes GBitMask is the biggest one, if we have 16 bit 3-channel - ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0565 : Conv32to16_0565); - } else { - assert((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0x7FFF); - ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0555 : Conv32to16_0555); - } - goto found_matching_format; - } - } + // no 24-bit or 32 fmt. look for 16 bit fmt + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];i16 conversion, should be true on most cards. + if((pCurPixFmt->dwFlags & DDPF_RGB) && (pCurPixFmt->dwRGBBitCount==16) + && !(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) { // no alpha fmts + // if numchan==4,this means user has requested we throw away the input alpha channel + if(pCurPixFmt->dwGBitMask==0x7E0) { + // assumes GBitMask is the biggest one, if we have 16 bit 3-channel + ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0565 : Conv32to16_0565); + } else { + assert((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0x7FFF); + ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0555 : Conv32to16_0555); + } + goto found_matching_format; + } + } - // at this point, bail. - break; + // at this point, bail. + break; - case 16: + case 16: - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) { - // look for native lum fmt + if(ddsd.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) { + // look for native lum fmt #ifdef _DEBUG - if(!dx_force_16bpptextures) + if(!dx_force_16bpptextures) #endif - { + { - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && - (pCurPixFmt->dwFlags & DDPF_LUMINANCE)) { - ConvNeeded=ConvLum16to16; - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && + (pCurPixFmt->dwFlags & DDPF_LUMINANCE)) { + ConvNeeded=ConvLum16to16; + goto found_matching_format; + } + } - // else look for 32bpp ARGB - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && - (pCurPixFmt->dwFlags & DDPF_RGB)) { - ConvNeeded=ConvLum16to32; - goto found_matching_format; - } - } - } + // else look for 32bpp ARGB + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) && + (pCurPixFmt->dwFlags & DDPF_RGB)) { + ConvNeeded=ConvLum16to32; + goto found_matching_format; + } + } + } - // find compatible 16bpp fmt - ConversionType ConvTo1=ConvLum16to16_4444,ConvTo2=ConvLum16to16_1555; - DWORD dwAlphaMask1=0xF000,dwAlphaMask2=0x8000; - // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion - // this should be true on most cards. + // find compatible 16bpp fmt + ConversionType ConvTo1=ConvLum16to16_4444,ConvTo2=ConvLum16to16_1555; + DWORD dwAlphaMask1=0xF000,dwAlphaMask2=0x8000; + // assume ALPHAMASK is x8000 and RGBMASK is x7fff to simplify 32->16 conversion + // this should be true on most cards. #ifndef FORCE_16bpp_1555 - if(cNumAlphaBits==1) + if(cNumAlphaBits==1) #endif - { - ConvTo1=ConvLum16to16_1555; - dwAlphaMask1=0x8000; - } + { + ConvTo1=ConvLum16to16_1555; + dwAlphaMask1=0x8000; + } - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) - && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask1)) { - ConvNeeded=ConvTo1; - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) + && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask1)) { + ConvNeeded=ConvTo1; + goto found_matching_format; + } + } #ifdef FORCE_16bpp_1555 - break; + break; #endif - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) - && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask2)) { - ConvNeeded=ConvTo2; - goto found_matching_format; - } - } + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS) + && (pCurPixFmt->dwRGBAlphaBitMask==dwAlphaMask2)) { + ConvNeeded=ConvTo2; + goto found_matching_format; + } + } - } else + } else - // look for compatible 16bit fmts, if none then give up - // (dont worry about other bitdepths for 16 bit) + // look for compatible 16bit fmts, if none then give up + // (dont worry about other bitdepths for 16 bit) - for(i=0,pCurPixFmt=pTexPixFmts;idwRGBBitCount==16)&&(pCurPixFmt->dwFlags & DDPF_RGB)) { - switch(cNumAlphaBits) { - case 0: - if(!(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) { - // if numchan==4,this means user has requested we throw away the input alpha channel - if(pCurPixFmt->dwGBitMask==0x7E0) { - // assumes GBitMask is the biggest one, if we have 16 bit 3-channel - ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0565 : Conv32to16_0565); - } else { - assert((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0x7FFF); - ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0555 : Conv32to16_0555); - } - goto found_matching_format; - } - break; - case 1: - if((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)&& - (pCurPixFmt->dwRGBAlphaBitMask==0x8000)) { - ConvNeeded=Conv32to16_1555; - goto found_matching_format; - } - break; - case 4: - if((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)&& - (pCurPixFmt->dwRGBAlphaBitMask==0xF000)) { - ConvNeeded=Conv32to16_4444; - goto found_matching_format; - } - break; - } - } - } + if((pCurPixFmt->dwRGBBitCount==16)&&(pCurPixFmt->dwFlags & DDPF_RGB)) { + switch(cNumAlphaBits) { + case 0: + if(!(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) { + // if numchan==4,this means user has requested we throw away the input alpha channel + if(pCurPixFmt->dwGBitMask==0x7E0) { + // assumes GBitMask is the biggest one, if we have 16 bit 3-channel + ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0565 : Conv32to16_0565); + } else { + assert((pCurPixFmt->dwRBitMask|pCurPixFmt->dwGBitMask|pCurPixFmt->dwBBitMask)==0x7FFF); + ConvNeeded=((cNumColorChannels==3) ? Conv24to16_0555 : Conv32to16_0555); + } + goto found_matching_format; + } + break; + case 1: + if((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)&& + (pCurPixFmt->dwRGBAlphaBitMask==0x8000)) { + ConvNeeded=Conv32to16_1555; + goto found_matching_format; + } + break; + case 4: + if((pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)&& + (pCurPixFmt->dwRGBAlphaBitMask==0xF000)) { + ConvNeeded=Conv32to16_4444; + goto found_matching_format; + } + break; + } + } + } - break; + break; - case 8: - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) { - // look for native lum fmt + case 8: + if(ddsd.ddpfPixelFormat.dwFlags & DDPF_LUMINANCE) { + // look for native lum fmt - assert(cNumAlphaBits==0); // dont handle those other 8bit lum fmts like 4-4, since 16 8-8 is usually supported too + assert(cNumAlphaBits==0); // dont handle those other 8bit lum fmts like 4-4, since 16 8-8 is usually supported too #ifdef _DEBUG - if(!dx_force_16bpptextures) + if(!dx_force_16bpptextures) #endif - { - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==8) && (pCurPixFmt->dwFlags & DDPF_LUMINANCE) && - (pCurPixFmt->dwLuminanceBitMask==0xFF)) { - ConvNeeded=ConvLum8to8; - goto found_matching_format; - } - } + { + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==8) && (pCurPixFmt->dwFlags & DDPF_LUMINANCE) && + (pCurPixFmt->dwLuminanceBitMask==0xFF)) { + ConvNeeded=ConvLum8to8; + goto found_matching_format; + } + } - // else look for 24bpp RGB - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==24) && (pCurPixFmt->dwFlags & DDPF_RGB)) { - ConvNeeded=ConvLum8to24; - goto found_matching_format; - } - } + // else look for 24bpp RGB + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==24) && (pCurPixFmt->dwFlags & DDPF_RGB)) { + ConvNeeded=ConvLum8to24; + goto found_matching_format; + } + } - // else look for 32bpp RGB - for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_RGB)) { - ConvNeeded=ConvLum8to32; - goto found_matching_format; - } - } - } + // else look for 32bpp RGB + for(i=0,pCurPixFmt=&pTexPixFmts[cNumTexPixFmts-1];idwRGBBitCount==32) && (pCurPixFmt->dwFlags & DDPF_RGB)) { + ConvNeeded=ConvLum8to32; + goto found_matching_format; + } + } + } - // find compatible 16bpp fmt, just look for any 565, then 0555 - DWORD dwMasks[2] = {0xF800, 0x7C00}; + // find compatible 16bpp fmt, just look for any 565, then 0555 + DWORD dwMasks[2] = {0xF800, 0x7C00}; - for(DWORD modenum=0;modenum<2;modenum++) - for(i=0,pCurPixFmt=&pTexPixFmts[0];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_RGB) - && (!(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) - && (pCurPixFmt->dwRBitMask==dwMasks[modenum])) { - ConvNeeded=ConvLum8to16_0565; - goto found_matching_format; - } - } - } - break; + for(DWORD modenum=0;modenum<2;modenum++) + for(i=0,pCurPixFmt=&pTexPixFmts[0];idwRGBBitCount==16) && (pCurPixFmt->dwFlags & DDPF_RGB) + && (!(pCurPixFmt->dwFlags & DDPF_ALPHAPIXELS)) + && (pCurPixFmt->dwRBitMask==dwMasks[modenum])) { + ConvNeeded=ConvLum8to16_0565; + goto found_matching_format; + } + } + } + break; - default: - szErrorMsg = "CreateTexture failed: unhandled pixel bitdepth in DX loader"; - } + default: + szErrorMsg = "CreateTexture failed: unhandled pixel bitdepth in DX loader"; + } - // if we've gotten here, haven't found a match + // if we've gotten here, haven't found a match - dxgsg_cat.error() << szErrorMsg << "; requested tex bitdepth: " << bpp << "\n"; - goto error_exit; + dxgsg_cat.error() << szErrorMsg << "; requested tex bitdepth: " << bpp << "\n"; + goto error_exit; - /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// - found_matching_format: + found_matching_format: - ddsd.ddpfPixelFormat = *pCurPixFmt; + ddsd.ddpfPixelFormat = *pCurPixFmt; - // Get the device's render target, so we can then use the render target to - // get a ptr to a DDraw object. We need the DirectDraw interface for - // creating surfaces. + // Get the device's render target, so we can then use the render target to + // get a ptr to a DDraw object. We need the DirectDraw interface for + // creating surfaces. - pd3dDevice->GetRenderTarget( &pddsRender ); - pddsRender->GetDDInterface( (VOID**)&pDD ); - pddsRender->Release(); + pd3dDevice->GetRenderTarget( &pddsRender ); + pddsRender->GetDDInterface( (VOID**)&pDD ); + pddsRender->Release(); - ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; + ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; - ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE // Turn on texture management - | DDSCAPS2_HINTSTATIC; // BUGBUG: is this ok for ALL textures? + ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE // Turn on texture management + | DDSCAPS2_HINTSTATIC; // BUGBUG: is this ok for ALL textures? - // validate magfilter setting - // degrade filtering if no HW support + // validate magfilter setting + // degrade filtering if no HW support - Texture::FilterType ft; + Texture::FilterType ft; - ft =_tex->get_magfilter(); - if((ft!=Texture::FT_linear) && ft!=Texture::FT_nearest) { - if(ft==Texture::FT_nearest_mipmap_nearest) - ft=Texture::FT_nearest; - else ft=Texture::FT_linear; - } + ft =_tex->get_magfilter(); + if((ft!=Texture::FT_linear) && ft!=Texture::FT_nearest) { + if(ft==Texture::FT_nearest_mipmap_nearest) + ft=Texture::FT_nearest; + else ft=Texture::FT_linear; + } - if((ft==Texture::FT_linear) && !(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)) - ft=Texture::FT_nearest; - _tex->set_magfilter(ft); + if((ft==Texture::FT_linear) && !(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)) + ft=Texture::FT_nearest; + _tex->set_magfilter(ft); - // figure out if we are mipmapping this texture - ft =_tex->get_minfilter(); - _bHasMipMaps=FALSE; + // figure out if we are mipmapping this texture + ft =_tex->get_minfilter(); + _bHasMipMaps=FALSE; - if(!dx_ignore_mipmaps) { // set if no HW mipmap capable + if(!dx_ignore_mipmaps) { // set if no HW mipmap capable #ifdef _DEBUG - _bHasMipMaps=dx_mipmap_everything; + _bHasMipMaps=dx_mipmap_everything; #endif - switch(ft) { - case Texture::FT_nearest_mipmap_nearest: - case Texture::FT_linear_mipmap_nearest: - case Texture::FT_nearest_mipmap_linear: // pick nearest in each, interpolate linearly b/w them - case Texture::FT_linear_mipmap_linear: - _bHasMipMaps=TRUE; - } - } else if((ft==Texture::FT_nearest_mipmap_nearest) || // cvt to no-mipmap filter types - (ft==Texture::FT_nearest_mipmap_linear)) { - ft=Texture::FT_nearest; - } else if((ft==Texture::FT_linear_mipmap_nearest) || - (ft==Texture::FT_linear_mipmap_linear)) { - ft=Texture::FT_linear; - } + switch(ft) { + case Texture::FT_nearest_mipmap_nearest: + case Texture::FT_linear_mipmap_nearest: + case Texture::FT_nearest_mipmap_linear: // pick nearest in each, interpolate linearly b/w them + case Texture::FT_linear_mipmap_linear: + _bHasMipMaps=TRUE; + } + } else if((ft==Texture::FT_nearest_mipmap_nearest) || // cvt to no-mipmap filter types + (ft==Texture::FT_nearest_mipmap_linear)) { + ft=Texture::FT_nearest; + } else if((ft==Texture::FT_linear_mipmap_nearest) || + (ft==Texture::FT_linear_mipmap_linear)) { + ft=Texture::FT_linear; + } - assert((devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_NEAREST)!=0); + assert((devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_NEAREST)!=0); - switch(ft) { - case Texture::FT_nearest_mipmap_linear: - if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPNEAREST)) - ft=Texture::FT_nearest_mipmap_nearest; - break; - case Texture::FT_linear_mipmap_nearest: - if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_MIPLINEAR)) - ft=Texture::FT_nearest_mipmap_nearest; - break; - case Texture::FT_linear_mipmap_linear: - if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPLINEAR)) { - if(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_MIPLINEAR) - ft=Texture::FT_linear_mipmap_nearest; - else ft=Texture::FT_nearest_mipmap_nearest; // if you cant do linear in a level, you probably cant do linear b/w levels, so just do nearest-all - } - break; - case Texture::FT_linear: - if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)) - ft=Texture::FT_nearest; - break; - } + switch(ft) { + case Texture::FT_nearest_mipmap_linear: + if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPNEAREST)) + ft=Texture::FT_nearest_mipmap_nearest; + break; + case Texture::FT_linear_mipmap_nearest: + if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_MIPLINEAR)) + ft=Texture::FT_nearest_mipmap_nearest; + break; + case Texture::FT_linear_mipmap_linear: + if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPLINEAR)) { + if(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_MIPLINEAR) + ft=Texture::FT_linear_mipmap_nearest; + else ft=Texture::FT_nearest_mipmap_nearest; // if you cant do linear in a level, you probably cant do linear b/w levels, so just do nearest-all + } + break; + case Texture::FT_linear: + if(!(devDesc.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)) + ft=Texture::FT_nearest; + break; + } - _tex->set_minfilter(ft); + _tex->set_minfilter(ft); - int aniso_degree; + int aniso_degree; - aniso_degree=1; - if(devDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANISOTROPY) { - aniso_degree=_tex->get_anisotropic_degree(); - if((aniso_degree>devDesc.dwMaxAnisotropy) + aniso_degree=1; + if(devDesc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANISOTROPY) { + aniso_degree=_tex->get_anisotropic_degree(); + if((aniso_degree>devDesc.dwMaxAnisotropy) #ifdef _DEBUG - || dx_force_anisotropic_filtering + || dx_force_anisotropic_filtering #endif - ) - aniso_degree=devDesc.dwMaxAnisotropy; - } - _tex->set_anisotropic_degree(aniso_degree); + ) + aniso_degree=devDesc.dwMaxAnisotropy; + } + _tex->set_anisotropic_degree(aniso_degree); #ifdef _DEBUG - dxgsg_cat.spam() << "CreateTexture: setting aniso degree for "<< _tex->get_name() << " to: " << aniso_degree << endl; + dxgsg_cat.spam() << "CreateTexture: setting aniso degree for "<< _tex->get_name() << " to: " << aniso_degree << endl; #endif - if(_bHasMipMaps) { - // We dont specify mipmapcount, so CreateSurface will auto-create surfs - // for all mipmaps down to 1x1 (if driver supports deep-mipmaps, otherwise Nx1) - ddsd.ddsCaps.dwCaps |= (DDSCAPS_MIPMAP | DDSCAPS_COMPLEX); - dxgsg_cat.debug() << "CreateTexture: generating mipmaps for "<< _tex->get_name() << endl; - } + if(_bHasMipMaps) { + // We dont specify mipmapcount, so CreateSurface will auto-create surfs + // for all mipmaps down to 1x1 (if driver supports deep-mipmaps, otherwise Nx1) + ddsd.ddsCaps.dwCaps |= (DDSCAPS_MIPMAP | DDSCAPS_COMPLEX); + dxgsg_cat.debug() << "CreateTexture: generating mipmaps for "<< _tex->get_name() << endl; + } - if(devDesc.dwDevCaps & D3DDEVCAPS_SEPARATETEXTUREMEMORIES) { - // must assign a texture to a specific stage - // for now I'm just going to use stage 0 for all - ddsd.dwTextureStage=0; - ddsd.dwFlags |= DDSD_TEXTURESTAGE; - } + if(devDesc.dwDevCaps & D3DDEVCAPS_SEPARATETEXTUREMEMORIES) { + // must assign a texture to a specific stage + // for now I'm just going to use stage 0 for all + ddsd.dwTextureStage=0; + ddsd.dwFlags |= DDSD_TEXTURESTAGE; + } - PRINTVIDMEM(pDD,&ddsd.ddsCaps,"texture surf (includes AGP mem)"); + PRINTVIDMEM(pDD,&ddsd.ddsCaps,"texture surf (includes AGP mem)"); - // Create a new surface for the texture - if(FAILED( hr = pDD->CreateSurface( &ddsd, &_surface, NULL ) )) { - dxgsg_cat.error() << "CreateTexture failed: pDD->CreateSurface() failed! hr = " << ConvD3DErrorToString(hr) << "\n"; - goto error_exit; - } + // Create a new surface for the texture + if(FAILED( hr = pDD->CreateSurface( &ddsd, &_surface, NULL ) )) { + dxgsg_cat.error() << "CreateTexture failed: pDD->CreateSurface() failed! hr = " << ConvD3DErrorToString(hr) << "\n"; + goto error_exit; + } #ifdef _DEBUG - dxgsg_cat.debug() << "CreateTexture: "<< _tex->get_name() <<" converted " << ConvNameStrs[ConvNeeded] << " \n"; + dxgsg_cat.debug() << "CreateTexture: "<< _tex->get_name() <<" converted " << ConvNameStrs[ConvNeeded] << " \n"; #endif - _PixBufConversionType=ConvNeeded; + _PixBufConversionType=ConvNeeded; - hr = FillDDSurfTexturePixels(); - if(FAILED(hr)) { - goto error_exit; - } + hr = FillDDSurfTexturePixels(); + if(FAILED(hr)) { + goto error_exit; + } - // Done with DDraw - pDD->Release(); + // Done with DDraw + pDD->Release(); - // Return the newly created texture - return _surface; + // Return the newly created texture + return _surface; error_exit: - if(pDD!=NULL) - pDD->Release(); - if(_surface!=NULL) { - _surface->Release(); - _surface = NULL; - } + if(pDD!=NULL) + pDD->Release(); + if(_surface!=NULL) { + _surface->Release(); + _surface = NULL; + } - return NULL; + return NULL; } HRESULT DXTextureContext:: FillDDSurfTexturePixels(void) { - PixelBuffer *pbuf = _texture->_pbuffer; - DWORD cNumColorChannels = pbuf->get_num_components(); + PixelBuffer *pbuf = _texture->_pbuffer; + DWORD cNumColorChannels = pbuf->get_num_components(); - HRESULT hr = ConvertPixBuftoDDSurf((ConversionType)_PixBufConversionType,pbuf->_image.p(),_surface); - if(FAILED(hr)) - return hr; + HRESULT hr = ConvertPixBuftoDDSurf((ConversionType)_PixBufConversionType,pbuf->_image.p(),_surface); + if(FAILED(hr)) + return hr; - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd); - _surface->GetSurfaceDesc(&ddsd); + _surface->GetSurfaceDesc(&ddsd); - if(_bHasMipMaps) { - DWORD i,oldcurxsize,oldcurysize,curxsize,curysize,cMipMapCount=ddsd.dwMipMapCount; - assert(ddsd.dwMipMapCount<20); + if(_bHasMipMaps) { + DWORD i,oldcurxsize,oldcurysize,curxsize,curysize,cMipMapCount=ddsd.dwMipMapCount; + assert(ddsd.dwMipMapCount<20); - curxsize=ddsd.dwWidth; curysize=ddsd.dwHeight; + curxsize=ddsd.dwWidth; curysize=ddsd.dwHeight; - assert(pbuf->get_image_type()==PixelBuffer::T_unsigned_byte); // cant handle anything else now + assert(pbuf->get_image_type()==PixelBuffer::T_unsigned_byte); // cant handle anything else now - // all mipmap sublevels require 1/3 of total original space. alloc 1/2 for safety - BYTE *pMipMapPixBufSpace = new BYTE[((curxsize*curysize*cNumColorChannels)/2)+1024]; + // all mipmap sublevels require 1/3 of total original space. alloc 1/2 for safety + BYTE *pMipMapPixBufSpace = new BYTE[((curxsize*curysize*cNumColorChannels)/2)+1024]; - LPDIRECTDRAWSURFACE7 pCurDDSurf=_surface; - pCurDDSurf->AddRef(); // so final release doesnt release the surface + LPDIRECTDRAWSURFACE7 pCurDDSurf=_surface; + pCurDDSurf->AddRef(); // so final release doesnt release the surface - BYTE *pDstWord = pMipMapPixBufSpace; - BYTE *pLastMipLevelStart = (BYTE *) pbuf->_image.p(); + BYTE *pDstWord = pMipMapPixBufSpace; + BYTE *pLastMipLevelStart = (BYTE *) pbuf->_image.p(); // clock_t start1,finish1; // start1=clock(); - for(i=1;i>1,1); - curxsize = max(curxsize>>1,1); + for(i=1;i>1,1); + curxsize = max(curxsize>>1,1); - assert(!((oldcurxsize==1)&&(oldcurysize==1))); + assert(!((oldcurxsize==1)&&(oldcurysize==1))); - BYTE *pSrcWord; - BYTE *pSrcLineStart=pLastMipLevelStart; + BYTE *pSrcWord; + BYTE *pSrcLineStart=pLastMipLevelStart; - // inc img start to DWORD boundary - while(((DWORD)pDstWord) & 0x11) - pDstWord++; + // inc img start to DWORD boundary + while(((DWORD)pDstWord) & 0x11) + pDstWord++; - pLastMipLevelStart = pDstWord; + pLastMipLevelStart = pDstWord; - DWORD x,y,cPixelSize=cNumColorChannels; - DWORD src_row_bytelength=oldcurxsize*cPixelSize; - DWORD two_src_row_bytelength=2*src_row_bytelength; + DWORD x,y,cPixelSize=cNumColorChannels; + DWORD src_row_bytelength=oldcurxsize*cPixelSize; + DWORD two_src_row_bytelength=2*src_row_bytelength; - DWORD DivShift=2; - if((oldcurxsize==1)||(oldcurysize==1)) - DivShift = 1; - DWORD x_srcptr_inc = ((oldcurxsize==1)? cPixelSize: (2*cPixelSize)); + DWORD DivShift=2; + if((oldcurxsize==1)||(oldcurysize==1)) + DivShift = 1; + DWORD x_srcptr_inc = ((oldcurxsize==1)? cPixelSize: (2*cPixelSize)); - // box-filter shrink down, avg 4 pixels at a time - for(y=0; y1) // handle 1x[X], [X]x1 cases - colr += *(pSrcWord+cPixelSize+c); - if(oldcurysize>1) { - colr += *(pSrcWord+src_row_bytelength+c); - if(oldcurxsize>1) - colr += *(pSrcWord+src_row_bytelength+cPixelSize+c); - } + for(int c=0;c1) // handle 1x[X], [X]x1 cases + colr += *(pSrcWord+cPixelSize+c); + if(oldcurysize>1) { + colr += *(pSrcWord+src_row_bytelength+c); + if(oldcurxsize>1) + colr += *(pSrcWord+src_row_bytelength+cPixelSize+c); + } - colr >>= DivShift; + colr >>= DivShift; - *(pDstWord+c)=(BYTE)colr; - } - } - } + *(pDstWord+c)=(BYTE)colr; + } + } + } - // now copy pixbuf to final DD surf + // now copy pixbuf to final DD surf - DDSCAPS2 ddsCaps; - LPDIRECTDRAWSURFACE7 pMipLevel_DDSurf; - ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); - ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; - ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; + DDSCAPS2 ddsCaps; + LPDIRECTDRAWSURFACE7 pMipLevel_DDSurf; + ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); + ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; + ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; - hr = pCurDDSurf->GetAttachedSurface(&ddsCaps, &pMipLevel_DDSurf); - if(FAILED(hr)) { - dxgsg_cat.error() << "CreateTexture failed creating mipmaps: GetAttachedSurf hr = " << ConvD3DErrorToString(hr) << "\n"; - delete [] pMipMapPixBufSpace; - pCurDDSurf->Release(); - return hr; - } + hr = pCurDDSurf->GetAttachedSurface(&ddsCaps, &pMipLevel_DDSurf); + if(FAILED(hr)) { + dxgsg_cat.error() << "CreateTexture failed creating mipmaps: GetAttachedSurf hr = " << ConvD3DErrorToString(hr) << "\n"; + delete [] pMipMapPixBufSpace; + pCurDDSurf->Release(); + return hr; + } - hr = ConvertPixBuftoDDSurf((ConversionType)_PixBufConversionType,pLastMipLevelStart,pMipLevel_DDSurf); - if(FAILED(hr)) { - delete [] pMipMapPixBufSpace; - pCurDDSurf->Release(); - return hr; - } + hr = ConvertPixBuftoDDSurf((ConversionType)_PixBufConversionType,pLastMipLevelStart,pMipLevel_DDSurf); + if(FAILED(hr)) { + delete [] pMipMapPixBufSpace; + pCurDDSurf->Release(); + return hr; + } - pCurDDSurf->Release(); - pCurDDSurf=pMipLevel_DDSurf; - } + pCurDDSurf->Release(); + pCurDDSurf=pMipLevel_DDSurf; + } - // finish1=clock(); - // double elapsed_time = (double)(finish1 - start1) / CLOCKS_PER_SEC; - // cerr << "mipmap gen takes " << elapsed_time << " secs for this texture\n"; + // finish1=clock(); + // double elapsed_time = (double)(finish1 - start1) / CLOCKS_PER_SEC; + // cerr << "mipmap gen takes " << elapsed_time << " secs for this texture\n"; - delete [] pMipMapPixBufSpace; - pCurDDSurf->Release(); + delete [] pMipMapPixBufSpace; + pCurDDSurf->Release(); #ifdef _DEBUG - if(dx_debug_view_mipmaps) { + if(dx_debug_view_mipmaps) { #if 0 - if(!(ddcaps.dwCaps & DDCAPS_BLTSTRETCH)) { - dxgsg_cat.error() << "CreateTexture failed debug-viewing mipmaps, BLT stretching not supported! ( we need to do SW stretch) \n"; - return hr; - } + if(!(ddcaps.dwCaps & DDCAPS_BLTSTRETCH)) { + dxgsg_cat.error() << "CreateTexture failed debug-viewing mipmaps, BLT stretching not supported! ( we need to do SW stretch) \n"; + return hr; + } #endif - // display mipmaps on primary surf - HDC hTexDC; - LPDIRECTDRAWSURFACE7 pTextureCurrent,pTexturePrev = _surface; - int cury,curx; - HDC hScreenDC; - RECT scrnrect; - hScreenDC=GetDC(NULL); + // display mipmaps on primary surf + HDC hTexDC; + LPDIRECTDRAWSURFACE7 pTextureCurrent,pTexturePrev = _surface; + int cury,curx; + HDC hScreenDC; + RECT scrnrect; + hScreenDC=GetDC(NULL); - scrnrect.left=scrnrect.top=0; - scrnrect.bottom=GetDeviceCaps(hScreenDC,VERTRES); - scrnrect.right=GetDeviceCaps(hScreenDC,HORZRES); - char msg[500]; + scrnrect.left=scrnrect.top=0; + scrnrect.bottom=GetDeviceCaps(hScreenDC,VERTRES); + scrnrect.right=GetDeviceCaps(hScreenDC,HORZRES); + char msg[500]; - pTexturePrev->AddRef(); + pTexturePrev->AddRef(); - for(i = 0,curx=scrnrect.left,cury=scrnrect.top; i < ddsd.dwMipMapCount; i++) { + for(i = 0,curx=scrnrect.left,cury=scrnrect.top; i < ddsd.dwMipMapCount; i++) { - DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_cur); - pTexturePrev->GetSurfaceDesc(&ddsd_cur); + DX_DECLARE_CLEAN(DDSURFACEDESC2, ddsd_cur); + pTexturePrev->GetSurfaceDesc(&ddsd_cur); - hr = pTexturePrev->GetDC(&hTexDC); - if(FAILED(hr)) { - dxgsg_cat.error() << "GetDC failed hr = " << ConvD3DErrorToString(hr) << "\n"; - break; - } + hr = pTexturePrev->GetDC(&hTexDC); + if(FAILED(hr)) { + dxgsg_cat.error() << "GetDC failed hr = " << ConvD3DErrorToString(hr) << "\n"; + break; + } - BOOL res; - // res = BitBlt(_dxgsg->_hdc,0,0,ddsd.dwWidth,ddsd.dwHeight, TexDC,0,0,SRCCOPY); - // loader inverts y, so use StretchBlt to re-invert it - // res = StretchBlt(_dxgsg->hdc,0,ddsd_cur.dwHeight+cury,ddsd_cur.dwWidth,-ddsd_cur.dwHeight, TexDC,0,0,ddsd_cur.dwWidth,ddsd_cur.dwHeight,SRCCOPY); + BOOL res; + // res = BitBlt(_dxgsg->_hdc,0,0,ddsd.dwWidth,ddsd.dwHeight, TexDC,0,0,SRCCOPY); + // loader inverts y, so use StretchBlt to re-invert it + // res = StretchBlt(_dxgsg->hdc,0,ddsd_cur.dwHeight+cury,ddsd_cur.dwWidth,-ddsd_cur.dwHeight, TexDC,0,0,ddsd_cur.dwWidth,ddsd_cur.dwHeight,SRCCOPY); #if 0 - if(cNumAlphaBits>0) { - BLENDFUNCTION bf; - bf.BlendOp = AC_SRC_OVER; bf.BlendFlags=0; - bf.SourceConstantAlpha=255; bf.AlphaFormat=AC_SRC_ALPHA; - res = AlphaBlend(hScreenDC,curx,cury,ddsd_cur.dwWidth,ddsd_cur.dwHeight, TexDC,0,0,ddsd_cur.dwWidth,ddsd_cur.dwHeight,bf); - if(!res) { - PrintLastError(msg); - dxgsg_cat.error() << "AlphaBlend BLT failed: "<0) { + BLENDFUNCTION bf; + bf.BlendOp = AC_SRC_OVER; bf.BlendFlags=0; + bf.SourceConstantAlpha=255; bf.AlphaFormat=AC_SRC_ALPHA; + res = AlphaBlend(hScreenDC,curx,cury,ddsd_cur.dwWidth,ddsd_cur.dwHeight, TexDC,0,0,ddsd_cur.dwWidth,ddsd_cur.dwHeight,bf); + if(!res) { + PrintLastError(msg); + dxgsg_cat.error() << "AlphaBlend BLT failed: "<scrnrect.right) { - curx=0; cury+=(scrnrect.bottom-scrnrect.top)/2; - } + if(curx>scrnrect.right) { + curx=0; cury+=(scrnrect.bottom-scrnrect.top)/2; + } - hr = pTexturePrev->ReleaseDC(hTexDC); + hr = pTexturePrev->ReleaseDC(hTexDC); - if(FAILED(hr)) { - dxgsg_cat.error() << "tex ReleaseDC failed for mip "<Release(); - continue; - } + if(i==ddsd.dwMipMapCount-1) { + pTexturePrev->Release(); + continue; + } - DDSCAPS2 ddsCaps; - ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); - ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; - ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; - hr = pTexturePrev->GetAttachedSurface(&ddsCaps, &pTextureCurrent); - if(FAILED(hr)) { - dxgsg_cat.error() << " failed displaying mipmaps: GetAttachedSurf hr = " << ConvD3DErrorToString(hr) << "\n"; - } - // done with the previous texture - pTexturePrev->Release(); - pTexturePrev = pTextureCurrent; - } + DDSCAPS2 ddsCaps; + ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); + ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; + ddsCaps.dwCaps2 = DDSCAPS2_MIPMAPSUBLEVEL; + hr = pTexturePrev->GetAttachedSurface(&ddsCaps, &pTextureCurrent); + if(FAILED(hr)) { + dxgsg_cat.error() << " failed displaying mipmaps: GetAttachedSurf hr = " << ConvD3DErrorToString(hr) << "\n"; + } + // done with the previous texture + pTexturePrev->Release(); + pTexturePrev = pTextureCurrent; + } - ReleaseDC(0,hScreenDC); + ReleaseDC(0,hScreenDC); - HANDLE hArr[1]; - MSG winmsg; - hArr[0]=GetStdHandle(STD_INPUT_HANDLE); - GetMessage(&winmsg,NULL,0,0); + HANDLE hArr[1]; + MSG winmsg; + hArr[0]=GetStdHandle(STD_INPUT_HANDLE); + GetMessage(&winmsg,NULL,0,0); - int val=MsgWaitForMultipleObjects(1,hArr,TRUE,INFINITE,QS_KEY); - if(val==-1) { - PrintLastError(msg); - dxgsg_cat.error() << " MsgWaitForMultipleObjects returns " << val << " " <Release(); - _surface = NULL; + if(_surface) _surface->Release(); + _surface = NULL; } @@ -1788,20 +1788,20 @@ DXTextureContext:: DXTextureContext(Texture *tex) : TextureContext(tex) { #ifdef _DEBUG - dxgsg_cat.spam() << "Making DX texture for " << tex->get_name() << "\n"; + dxgsg_cat.spam() << "Making DX texture for " << tex->get_name() << "\n"; #endif - _surface = NULL; - _bHasMipMaps = FALSE; - _tex = tex; + _surface = NULL; + _bHasMipMaps = FALSE; + _tex = tex; } DXTextureContext:: ~DXTextureContext() { #ifdef _DEBUG - dxgsg_cat.spam() << "Deleting DX texture for " << _tex->get_name() << "\n"; + dxgsg_cat.spam() << "Deleting DX texture for " << _tex->get_name() << "\n"; #endif - DeleteTexture(); - TextureContext::~TextureContext(); - _tex = NULL; + DeleteTexture(); + TextureContext::~TextureContext(); + _tex = NULL; } diff --git a/panda/src/effects/lensFlareNode.cxx b/panda/src/effects/lensFlareNode.cxx index cd064c9b6f..844e6dd7df 100644 --- a/panda/src/effects/lensFlareNode.cxx +++ b/panda/src/effects/lensFlareNode.cxx @@ -44,7 +44,7 @@ TypeHandle LensFlareNode::_type_handle; //////////////////////////////////////////////////////////////////// void LensFlareNode:: add_flare(PT(Texture) flare, PTA_float scales, PTA_float offsets, - PTA_float angle_scales, PTA_Colorf colors) + PTA_float angle_scales, PTA_Colorf colors) { nassertv(scales.size() == offsets.size()); nassertv(colors.size() == offsets.size()); @@ -98,9 +98,9 @@ add_blind(PT(Texture) blind) //////////////////////////////////////////////////////////////////// void LensFlareNode:: set_geometry(GeomSprite *sprite, const PTA_float &geom_scales, - const PTA_float &geom_offsets, const PTA_float &geom_angle_scales, - const PTA_Colorf &geom_colors, const LVector3f &delta, - const LPoint3f &light, const float &angle) + const PTA_float &geom_offsets, const PTA_float &geom_angle_scales, + const PTA_Colorf &geom_colors, const LVector3f &delta, + const LPoint3f &light, const float &angle) { PTA_Vertexf coords(0); PTA_float tex_scales(0); @@ -161,30 +161,30 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle { for(int i = _flare_arcs.size(); i < (int)_flares.size(); i++) { - GeomSprite *sprite = new GeomSprite(); - GeomNode *node = new GeomNode(); + GeomSprite *sprite = new GeomSprite(); + GeomNode *node = new GeomNode(); - //We don't want to set any geometry right now, as that will be - //taken care of later (and on each subsequent render), but - //Geoms requires a certain amount of info or else they crash, - //so simply give it the minimum it needs not to crash + //We don't want to set any geometry right now, as that will be + //taken care of later (and on each subsequent render), but + //Geoms requires a certain amount of info or else they crash, + //so simply give it the minimum it needs not to crash - //The lengths and number of prims will never change, so give - //it valid values for those, but pass it an empty array of - //vertices - PTA_Vertexf coords(0); + //The lengths and number of prims will never change, so give + //it valid values for those, but pass it an empty array of + //vertices + PTA_Vertexf coords(0); - //Sanity check - nassertv(_flare_offsets[i].size() == _flare_scales[i].size()); + //Sanity check + nassertv(_flare_offsets[i].size() == _flare_scales[i].size()); - sprite->set_coords(coords, G_PER_VERTEX); - sprite->set_num_prims(_flare_offsets[i].size()); + sprite->set_coords(coords, G_PER_VERTEX); + sprite->set_num_prims(_flare_offsets[i].size()); - node->add_geom(sprite); + node->add_geom(sprite); - RenderRelation *arc = new RenderRelation(this, node); - //arc->set_transition(new TransparencyTransition(TransparencyProperty::M_alpha)); - _flare_arcs.push_back(arc); + RenderRelation *arc = new RenderRelation(this, node); + //arc->set_transition(new TransparencyTransition(TransparencyProperty::M_alpha)); + _flare_arcs.push_back(arc); } } @@ -194,8 +194,8 @@ prepare_flares(const LVector3f &delta, const LPoint3f &light, const float &angle GeomSprite *sprite = DCAST(GeomSprite, node->get_geom(0)); set_geometry(sprite, _flare_scales[i], _flare_offsets[i], - _flare_angle_scales[i], _flare_colors[i], - delta, light, angle); + _flare_angle_scales[i], _flare_colors[i], + delta, light, angle); sprite->set_texture(_flares[i]); //Tell them to recompute their bounding volumes @@ -257,7 +257,7 @@ prepare_blind(const float &angle, const float &tnear) //////////////////////////////////////////////////////////////////// void LensFlareNode:: render_child(RenderRelation *arc, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg) + AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg) { AllAttributesWrapper new_attrib(attrib); @@ -271,7 +271,7 @@ render_child(RenderRelation *arc, const AllAttributesWrapper &attrib, // Now render everything from this node and below. gsg->render_subgraph(gsg->get_render_traverser(), - arc->get_child(), new_attrib, new_trans); + arc->get_child(), new_attrib, new_trans); } //////////////////////////////////////////////////////////////////// @@ -281,7 +281,7 @@ render_child(RenderRelation *arc, const AllAttributesWrapper &attrib, //////////////////////////////////////////////////////////////////// void LensFlareNode:: render_children(const vector_relation &arcs, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg) + AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg) { for(int i = 0; i < (int)arcs.size(); i++) { @@ -296,7 +296,7 @@ render_children(const vector_relation &arcs, const AllAttributesWrapper &attrib, //////////////////////////////////////////////////////////////////// bool LensFlareNode:: sub_render(const AllAttributesWrapper &attrib, AllTransitionsWrapper &trans, - RenderTraverser *trav) { + RenderTraverser *trav) { GraphicsStateGuardian *gsg = trav->get_gsg(); nassertr(_light_node != (Node*) NULL, false); @@ -619,7 +619,7 @@ add_sparkle(PT_Node source, PT(Texture) sparkle) //////////////////////////////////////////////////////////////////// void LensFlareNode:: set_sparkles_attributes(PT_Node source, vector_float scales, - vector_float offsets, vector_Colorf colors) + vector_float offsets, vector_Colorf colors) { nassertv(scales.size() == offsets.size()); @@ -652,9 +652,9 @@ set_light(PT_Node light) //////////////////////////////////////////////////////////////////// void LensFlareNode:: prepare_sparkles(vector_relation &arcs, const vector_texture &sparkles, - const vector_float &scales, const vector_float &offsets, - const vector_Colorf &colors, const LVector3f &delta, - const LPoint3f &light, const BoundingVolume &bound, int &old_sparkle) + const vector_float &scales, const vector_float &offsets, + const vector_Colorf &colors, const LVector3f &delta, + const LPoint3f &light, const BoundingVolume &bound, int &old_sparkle) { //Sanity check nassertv(scales.size() == offsets.size()); @@ -665,25 +665,25 @@ prepare_sparkles(vector_relation &arcs, const vector_texture &sparkles, { for(int i = 0; i < scales.size(); i++) { - GeomSprite *sprite = new GeomSprite(); - GeomNode *node = new GeomNode(); + GeomSprite *sprite = new GeomSprite(); + GeomNode *node = new GeomNode(); - //We don't want to set any geometry right now, as that will be - //taken care of later (and on each subsequent render), but - //Geoms requires a certain amount of info or else they crash, - //so simply give it the minimum it needs not to crash + //We don't want to set any geometry right now, as that will be + //taken care of later (and on each subsequent render), but + //Geoms requires a certain amount of info or else they crash, + //so simply give it the minimum it needs not to crash - //The lengths and number of prims will never change, so give - //it valid values for those, but pass it an empty array of - //vertices - PTA_Vertexf coords(0); - - sprite->set_coords(coords, G_PER_VERTEX); - sprite->set_num_prims(1); + //The lengths and number of prims will never change, so give + //it valid values for those, but pass it an empty array of + //vertices + PTA_Vertexf coords(0); - node->add_geom(sprite); + sprite->set_coords(coords, G_PER_VERTEX); + sprite->set_num_prims(1); - arcs.push_back(new RenderRelation(this, node)); + node->add_geom(sprite); + + arcs.push_back(new RenderRelation(this, node)); } } diff --git a/panda/src/effects/lensFlareNode.h b/panda/src/effects/lensFlareNode.h index 8cc1a264ae..bb051b3c16 100644 --- a/panda/src/effects/lensFlareNode.h +++ b/panda/src/effects/lensFlareNode.h @@ -25,7 +25,7 @@ PUBLISHED: INLINE LensFlareNode(void); void add_flare(PT(Texture) flare, PTA_float scales, PTA_float offsets, - PTA_float angle_scales, PTA_Colorf colors); + PTA_float angle_scales, PTA_Colorf colors); void add_blind(PT(Texture) blind); INLINE void set_angle_scale(float scale); @@ -39,8 +39,8 @@ PUBLISHED: public: virtual bool sub_render(const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; private: @@ -79,21 +79,21 @@ private: //the set of Sparkle textures to create an animation void set_geometry(GeomSprite *sprite, const PTA_float &geom_scales, - const PTA_float &geom_offsets, const PTA_float &geom_angle_scales, - const PTA_Colorf &geom_colors, const LVector3f &delta, - const LPoint3f &light, const float &angle); + const PTA_float &geom_offsets, const PTA_float &geom_angle_scales, + const PTA_Colorf &geom_colors, const LVector3f &delta, + const LPoint3f &light, const float &angle); void render_child(RenderRelation *arc, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg); + AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg); void render_children(const vector_relation &arcs, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg); + AllTransitionsWrapper &trans, GraphicsStateGuardian *gsg); public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_LensFlareNode(const FactoryParams ¶ms); @@ -118,7 +118,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #include "lensFlareNode.I" @@ -129,7 +129,7 @@ private: public: void add_sparkle(PT_Node source, PT(Texture) sparkle); void set_sparkles_attributes(PT_Node source, float angle_scale, vector_float scales, - vector_float offsets, vector_Colorf colors); + vector_float offsets, vector_Colorf colors); void set_sparkle_fps(float fps); private: @@ -154,9 +154,9 @@ private: map _current_sparkles; void prepare_sparkles(vector_relation &arcs, const vector_texture &sparkles, - const vector_float &scales, const vector_float &offsets, - const vector_Colorf &colors, const LVector3f &delta, - const LPoint3f &light, const BoundingVolume &bound, int &old_sparkle); + const vector_float &scales, const vector_float &offsets, + const vector_Colorf &colors, const LVector3f &delta, + const LPoint3f &light, const BoundingVolume &bound, int &old_sparkle); //Timing function to control sparkle animation int compute_current(int ¤t_sparkle, vector_texture sparkles); diff --git a/panda/src/egg/eggAnimData.h b/panda/src/egg/eggAnimData.h index 6ae8a2df4f..5bd58f7ac0 100644 --- a/panda/src/egg/eggAnimData.h +++ b/panda/src/egg/eggAnimData.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggAnimData +// Class : EggAnimData // Description : A base class for EggSAnimData and EggXfmAnimData, // which contain rows and columns of numbers. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggAttributes.cxx b/panda/src/egg/eggAttributes.cxx index 8a96397fc9..8c05924086 100644 --- a/panda/src/egg/eggAttributes.cxx +++ b/panda/src/egg/eggAttributes.cxx @@ -72,7 +72,7 @@ write(ostream &out, int indent_level) const { if (has_normal()) { if (_dnormals.empty()) { indent(out, indent_level) - << " { " << get_normal() << " }\n"; + << " { " << get_normal() << " }\n"; } else { indent(out, indent_level) << " {\n"; indent(out, indent_level+2) << get_normal() << "\n"; @@ -83,7 +83,7 @@ write(ostream &out, int indent_level) const { if (has_uv()) { if (_duvs.empty()) { indent(out, indent_level) - << " { " << get_uv() << " }\n"; + << " { " << get_uv() << " }\n"; } else { indent(out, indent_level) << " {\n"; indent(out, indent_level+2) << get_uv() << "\n"; @@ -94,7 +94,7 @@ write(ostream &out, int indent_level) const { if (has_color()) { if (_drgbas.empty()) { indent(out, indent_level) - << " { " << get_color() << " }\n"; + << " { " << get_color() << " }\n"; } else { indent(out, indent_level) << " {\n"; indent(out, indent_level+2) << get_color() << "\n"; diff --git a/panda/src/egg/eggAttributes.h b/panda/src/egg/eggAttributes.h index 15744695b8..915c68f8c3 100644 --- a/panda/src/egg/eggAttributes.h +++ b/panda/src/egg/eggAttributes.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggAttributes +// Class : EggAttributes // Description : The set of attributes that may be applied to vertices // as well as polygons, such as surface normal and // color. diff --git a/panda/src/egg/eggBin.h b/panda/src/egg/eggBin.h index d432854174..8fa37ad93b 100644 --- a/panda/src/egg/eggBin.h +++ b/panda/src/egg/eggBin.h @@ -11,7 +11,7 @@ #include "eggGroup.h" //////////////////////////////////////////////////////////////////// -// Class : EggBin +// Class : EggBin // Description : A type of group node that holds related subnodes. // This is a special kind of node that will never be // read in from an egg file, but can only exist in the diff --git a/panda/src/egg/eggBinMaker.cxx b/panda/src/egg/eggBinMaker.cxx index 67b896b574..3ec60b5e9f 100644 --- a/panda/src/egg/eggBinMaker.cxx +++ b/panda/src/egg/eggBinMaker.cxx @@ -125,17 +125,17 @@ collect_nodes(EggGroupNode *group) { // Ok, here's a node to be binned. Add it to the appropriate // bin. if (first_in_group) { - // If this is the first time this group has been encountered, - // we need to create a new entry in _group_nodes for it. + // If this is the first time this group has been encountered, + // we need to create a new entry in _group_nodes for it. - pair result; - result = _group_nodes.insert - (GroupNodes::value_type - (group, SortedNodes(EggBinMakerCompareNodes(this)))); + pair result; + result = _group_nodes.insert + (GroupNodes::value_type + (group, SortedNodes(EggBinMakerCompareNodes(this)))); - nassertv(result.second); - gni = result.first; - first_in_group = false; + nassertv(result.second); + gni = result.first; + first_in_group = false; } // Add this node to the set of all nodes being binned for the diff --git a/panda/src/egg/eggBinMaker.h b/panda/src/egg/eggBinMaker.h index dd366eeab1..fe7e69e6cb 100644 --- a/panda/src/egg/eggBinMaker.h +++ b/panda/src/egg/eggBinMaker.h @@ -134,7 +134,7 @@ // above get_bin_number() and sorts_less() working together: // // virtual bool sorts_less(int bin_number, -// const EggNode *a, const EggNode *b) { +// const EggNode *a, const EggNode *b) { // if (a->has_texture() != b->has_texture()) { // return ((int)a->has_texture() < (int)b->has_texture()); // } @@ -208,7 +208,7 @@ class EggBin; class EggBinMaker; //////////////////////////////////////////////////////////////////// -// Class : EggBinMakerCompareNodes +// Class : EggBinMakerCompareNodes // Description : This is just an STL function object, used to sort // nodes within EggBinMaker. It's part of the private // interface; ignore it. @@ -228,7 +228,7 @@ public: //////////////////////////////////////////////////////////////////// -// Class : EggBinMaker +// Class : EggBinMaker // Description : This is a handy class for collecting related nodes // together. It is an abstract class; to use it you // must subclass off of it. See the somewhat lengthy @@ -282,7 +282,7 @@ public: static void init_type() { EggObject::init_type(); register_type(_type_handle, "EggBinMaker", - EggObject::get_class_type()); + EggObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggComment.h b/panda/src/egg/eggComment.h index f93b8b4e62..e1318faae8 100644 --- a/panda/src/egg/eggComment.h +++ b/panda/src/egg/eggComment.h @@ -13,7 +13,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : EggComment +// Class : EggComment // Description : A comment that appears in an egg file within a // entry. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggCoordinateSystem.h b/panda/src/egg/eggCoordinateSystem.h index 77f84d0788..603997a342 100644 --- a/panda/src/egg/eggCoordinateSystem.h +++ b/panda/src/egg/eggCoordinateSystem.h @@ -14,7 +14,7 @@ /////////////////////////////////////////////////////////////////// -// Class : EggCoordinateSystem +// Class : EggCoordinateSystem // Description : The entry at the top of an egg // file. Don't confuse this with the enum // EggData::CoordinateSystem, which is the value diff --git a/panda/src/egg/eggCurve.h b/panda/src/egg/eggCurve.h index 5031520ede..4b1d40c6ff 100644 --- a/panda/src/egg/eggCurve.h +++ b/panda/src/egg/eggCurve.h @@ -11,7 +11,7 @@ #include "eggPrimitive.h" //////////////////////////////////////////////////////////////////// -// Class : EggCurve +// Class : EggCurve // Description : A parametric curve of some kind. See // EggNurbsCurve. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggData.cxx b/panda/src/egg/eggData.cxx index 708a6aa2ae..1c4756238e 100644 --- a/panda/src/egg/eggData.cxx +++ b/panda/src/egg/eggData.cxx @@ -217,8 +217,8 @@ set_coordinate_system(CoordinateSystem new_coordsys) { (_coordsys != CS_default && _coordsys != CS_invalid)) { // Time to convert the data. r_transform(LMatrix4d::convert_mat(_coordsys, new_coordsys), - LMatrix4d::convert_mat(new_coordsys, _coordsys), - new_coordsys); + LMatrix4d::convert_mat(new_coordsys, _coordsys), + new_coordsys); } _coordsys = new_coordsys; diff --git a/panda/src/egg/eggData.h b/panda/src/egg/eggData.h index ecebddf0dd..4cb38504d8 100644 --- a/panda/src/egg/eggData.h +++ b/panda/src/egg/eggData.h @@ -18,7 +18,7 @@ /////////////////////////////////////////////////////////////////// -// Class : EggData +// Class : EggData // Description : This is the primary interface into all the egg data, // and the root of the egg file structure. An EggData // structure corresponds exactly with an egg file on the @@ -37,7 +37,7 @@ public: INLINE EggData &operator = (const EggData ©); static bool resolve_egg_filename(Filename &egg_filename, - const DSearchPath &searchpath = DSearchPath()); + const DSearchPath &searchpath = DSearchPath()); bool read(Filename filename); bool read(istream &in); diff --git a/panda/src/egg/eggExternalReference.h b/panda/src/egg/eggExternalReference.h index 456a76cd1f..10fbf20143 100644 --- a/panda/src/egg/eggExternalReference.h +++ b/panda/src/egg/eggExternalReference.h @@ -11,7 +11,7 @@ #include "eggFilenameNode.h" //////////////////////////////////////////////////////////////////// -// Class : EggExternalReference +// Class : EggExternalReference // Description : Defines a reference to another egg file which should // be inserted at this point. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggFilenameNode.h b/panda/src/egg/eggFilenameNode.h index 4119f7c5a1..79d2f9d969 100644 --- a/panda/src/egg/eggFilenameNode.h +++ b/panda/src/egg/eggFilenameNode.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggFilenameNode +// Class : EggFilenameNode // Description : This is an egg node that contains a filename. It // references a physical file relative to the directory // the egg file was loaded in. It is a base class for diff --git a/panda/src/egg/eggGroup.I b/panda/src/egg/eggGroup.I index 992071aae2..0ea54c89a0 100644 --- a/panda/src/egg/eggGroup.I +++ b/panda/src/egg/eggGroup.I @@ -300,7 +300,7 @@ get_transform() const { INLINE bool EggGroup:: transform_is_identity() const { return (!has_transform() || - _transform.almost_equal(LMatrix4d::ident_mat(), 0.0001)); + _transform.almost_equal(LMatrix4d::ident_mat(), 0.0001)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggGroup.cxx b/panda/src/egg/eggGroup.cxx index 39d6b165ee..ecf0f28af3 100644 --- a/panda/src/egg/eggGroup.cxx +++ b/panda/src/egg/eggGroup.cxx @@ -226,7 +226,7 @@ write(ostream &out, int indent_level) const { indent(out, indent_level + 2) << " { 1 }\n"; if (get_switch_fps() != 0.0) { indent(out, indent_level + 2) - << " fps { " << get_switch_fps() << " }\n"; + << " fps { " << get_switch_fps() << " }\n"; } } @@ -643,25 +643,25 @@ write_vertex_ref(ostream &out, int indent_level) const { const Indices &indices = (*mi).second; indent(out, indent_level) - << " {\n"; + << " {\n"; write_long_list(out, indent_level+2, indices.begin(), indices.end(), - "", "", 72); + "", "", 72); // If all vrefs in this group have membership of 1, don't bother // to write out the membership scalar. if (!all_membership_one) { - indent(out, indent_level + 2) - << " membership { " << membership << " }\n"; + indent(out, indent_level + 2) + << " membership { " << membership << " }\n"; } if (pool == (EggVertexPool *)NULL) { - indent(out, indent_level + 2) - << "// Invalid NULL vertex pool.\n"; + indent(out, indent_level + 2) + << "// Invalid NULL vertex pool.\n"; } else { - indent(out, indent_level + 2) - << " { " << pool->get_name() << " }\n"; + indent(out, indent_level + 2) + << " { " << pool->get_name() << " }\n"; } indent(out, indent_level) - << "}\n"; + << "}\n"; } } } @@ -747,7 +747,7 @@ adjust_under() { //////////////////////////////////////////////////////////////////// void EggGroup:: r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs) { + CoordinateSystem to_cs) { if (has_transform()) { // Since we want to apply this transform to all matrices, // including nested matrices, we can't simply premult it in and diff --git a/panda/src/egg/eggGroup.h b/panda/src/egg/eggGroup.h index 42183b10a2..95aae96ae5 100644 --- a/panda/src/egg/eggGroup.h +++ b/panda/src/egg/eggGroup.h @@ -18,7 +18,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggGroup +// Class : EggGroup // Description : The main glue of the egg hierarchy, this corresponds // to the , , and type nodes. //////////////////////////////////////////////////////////////////// @@ -188,7 +188,7 @@ protected: virtual bool egg_start_parse_body(); virtual void adjust_under(); virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_flatten_transforms(); private: @@ -237,7 +237,7 @@ public: EggRenderMode::init_type(); register_type(_type_handle, "EggGroup", EggGroupNode::get_class_type(), - EggRenderMode::get_class_type()); + EggRenderMode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggGroupNode.cxx b/panda/src/egg/eggGroupNode.cxx index 09a6132d4a..b7c96fa565 100644 --- a/panda/src/egg/eggGroupNode.cxx +++ b/panda/src/egg/eggGroupNode.cxx @@ -172,7 +172,7 @@ erase(iterator first, iterator last) { prepare_remove_child(*i); } return _children.erase((Children::iterator &)first, - (Children::iterator &)last); + (Children::iterator &)last); } //////////////////////////////////////////////////////////////////// @@ -278,16 +278,16 @@ resolve_filenames(const DSearchPath &searchpath) { if (child->is_of_type(EggTexture::get_class_type())) { EggTexture *tex = DCAST(EggTexture, child); tex->update_filename(). - resolve_filename(searchpath, tex->get_default_extension()); + resolve_filename(searchpath, tex->get_default_extension()); if (tex->has_alpha_file()) { - tex->update_alpha_file(). - resolve_filename(searchpath, tex->get_default_extension()); + tex->update_alpha_file(). + resolve_filename(searchpath, tex->get_default_extension()); } } else if (child->is_of_type(EggFilenameNode::get_class_type())) { EggFilenameNode *fnode = DCAST(EggFilenameNode, child); fnode->update_filename(). - resolve_filename(searchpath, fnode->get_default_extension()); + resolve_filename(searchpath, fnode->get_default_extension()); } else if (child->is_of_type(EggGroupNode::get_class_type())) { DCAST(EggGroupNode, child)->resolve_filenames(searchpath); @@ -370,16 +370,16 @@ recompute_vertex_normals(double threshold, CoordinateSystem cs) { ++gi; while (gi != group.end()) { - const NVertexReference &ref = (*gi); - double dot = base_ref._normal.dot(ref._normal); - if (dot > cos_angle) { - // These polygons are close enough to the same angle. - new_group.push_back(ref); - } else { - // These polygons are not. - leftover_group.push_back(ref); - } - ++gi; + const NVertexReference &ref = (*gi); + double dot = base_ref._normal.dot(ref._normal); + if (dot > cos_angle) { + // These polygons are close enough to the same angle. + new_group.push_back(ref); + } else { + // These polygons are not. + leftover_group.push_back(ref); + } + ++gi; } // Now new_group is a collection of connected polygons and the @@ -425,26 +425,26 @@ recompute_polygon_normals(CoordinateSystem cs) { EggPolygon *polygon = DCAST(EggPolygon, child); if (!polygon->recompute_polygon_normal(cs)) { - // The polygon is degenerate. Remove it. - prepare_remove_child(child); - _children.erase(ci); + // The polygon is degenerate. Remove it. + prepare_remove_child(child); + _children.erase(ci); } else { - // Remove the normal from each polygon vertex. - size_t num_vertices = polygon->size(); - for (size_t i = 0; i < num_vertices; i++) { - EggVertex *vertex = polygon->get_vertex(i); - EggVertexPool *pool = vertex->get_pool(); + // Remove the normal from each polygon vertex. + size_t num_vertices = polygon->size(); + for (size_t i = 0; i < num_vertices; i++) { + EggVertex *vertex = polygon->get_vertex(i); + EggVertexPool *pool = vertex->get_pool(); - if (vertex->has_normal()) { - EggVertex new_vertex(*vertex); - new_vertex.clear_normal(); - EggVertex *unique = pool->create_unique_vertex(new_vertex); - unique->copy_grefs_from(*vertex); + if (vertex->has_normal()) { + EggVertex new_vertex(*vertex); + new_vertex.clear_normal(); + EggVertex *unique = pool->create_unique_vertex(new_vertex); + unique->copy_grefs_from(*vertex); - polygon->set_vertex(i, unique); - } - } + polygon->set_vertex(i, unique); + } + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -479,17 +479,17 @@ strip_normals() { // Remove the normal from each prim vertex. size_t num_vertices = prim->size(); for (size_t i = 0; i < num_vertices; i++) { - EggVertex *vertex = prim->get_vertex(i); - EggVertexPool *pool = vertex->get_pool(); - - if (vertex->has_normal()) { - EggVertex new_vertex(*vertex); - new_vertex.clear_normal(); - EggVertex *unique = pool->create_unique_vertex(new_vertex); - unique->copy_grefs_from(*vertex); - - prim->set_vertex(i, unique); - } + EggVertex *vertex = prim->get_vertex(i); + EggVertexPool *pool = vertex->get_pool(); + + if (vertex->has_normal()) { + EggVertex new_vertex(*vertex); + new_vertex.clear_normal(); + EggVertex *unique = pool->create_unique_vertex(new_vertex); + unique->copy_grefs_from(*vertex); + + prim->set_vertex(i, unique); + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -570,9 +570,9 @@ remove_unused_vertices() { num_removed += vpool->remove_unused_vertices(); if (vpool->empty()) { - // If, after removing all the vertices, there's nothing left - // in the vertex pool, then remove the whole vertex pool. - _children.erase(ci); + // If, after removing all the vertices, there's nothing left + // in the vertex pool, then remove the whole vertex pool. + _children.erase(ci); } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -607,8 +607,8 @@ remove_invalid_primitives() { if (child->is_of_type(EggPrimitive::get_class_type())) { EggPrimitive *prim = DCAST(EggPrimitive, child); if (!prim->cleanup()) { - _children.erase(ci); - num_removed++; + _children.erase(ci); + num_removed++; } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -662,7 +662,7 @@ update_under(int depth_offset) { //////////////////////////////////////////////////////////////////// void EggGroupNode:: r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs) { + CoordinateSystem to_cs) { Children::iterator ci; for (ci = _children.begin(); ci != _children.end(); @@ -765,29 +765,29 @@ find_coordsys_entry() { if (child->is_of_type(EggCoordinateSystem::get_class_type())) { CoordinateSystem new_cs = - DCAST(EggCoordinateSystem, child)->get_value(); + DCAST(EggCoordinateSystem, child)->get_value(); // Now remove the CoordinateSystem entry from our child list. prepare_remove_child(child); _children.erase(ci); if (new_cs != CS_default) { - if (coordsys != CS_default && coordsys != new_cs) { - coordsys = CS_invalid; - } else { - coordsys = new_cs; - } + if (coordsys != CS_default && coordsys != new_cs) { + coordsys = CS_invalid; + } else { + coordsys = new_cs; + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { CoordinateSystem new_cs = - DCAST(EggGroupNode, child)->find_coordsys_entry(); + DCAST(EggGroupNode, child)->find_coordsys_entry(); if (new_cs != CS_default) { - if (coordsys != CS_default && coordsys != new_cs) { - coordsys = CS_invalid; - } else { - coordsys = new_cs; - } + if (coordsys != CS_default && coordsys != new_cs) { + coordsys = CS_invalid; + } else { + coordsys = new_cs; + } } } @@ -834,7 +834,7 @@ find_textures(EggTextureCollection *collection) { } else if (child->is_of_type(EggGroupNode::get_class_type())) { num_found += - DCAST(EggGroupNode, child)->find_textures(collection); + DCAST(EggGroupNode, child)->find_textures(collection); } ci = cnext; @@ -880,7 +880,7 @@ find_materials(EggMaterialCollection *collection) { } else if (child->is_of_type(EggGroupNode::get_class_type())) { num_found += - DCAST(EggGroupNode, child)->find_materials(collection); + DCAST(EggGroupNode, child)->find_materials(collection); } ci = cnext; @@ -900,7 +900,7 @@ find_materials(EggMaterialCollection *collection) { //////////////////////////////////////////////////////////////////// bool EggGroupNode:: r_resolve_externals(const DSearchPath &searchpath, - CoordinateSystem coordsys) { + CoordinateSystem coordsys) { bool success = true; Children::iterator ci; @@ -915,33 +915,33 @@ r_resolve_externals(const DSearchPath &searchpath, // the external file successfully, we'll put its contents here. Filename filename = ref->get_filename(); EggGroupNode *new_node = - new EggGroupNode(filename.get_basename_wo_extension()); + new EggGroupNode(filename.get_basename_wo_extension()); replace(ci, new_node); if (!EggData::resolve_egg_filename(filename, searchpath)) { - egg_cat.error() - << "Could not locate " << filename << " in " - << searchpath << "\n"; + egg_cat.error() + << "Could not locate " << filename << " in " + << searchpath << "\n"; } else { - // Now define a new EggData structure to hold the external - // reference, and load it. - EggData ext_data; - ext_data.set_coordinate_system(coordsys); - if (ext_data.read(filename)) { - // The external file was read correctly. Add its contents - // into the tree at this point. - success = - ext_data.resolve_externals(searchpath) - && success; - new_node->steal_children(ext_data); - } + // Now define a new EggData structure to hold the external + // reference, and load it. + EggData ext_data; + ext_data.set_coordinate_system(coordsys); + if (ext_data.read(filename)) { + // The external file was read correctly. Add its contents + // into the tree at this point. + success = + ext_data.resolve_externals(searchpath) + && success; + new_node->steal_children(ext_data); + } } - + } else if (child->is_of_type(EggGroupNode::get_class_type())) { EggGroupNode *group_child = DCAST(EggGroupNode, child); success = - group_child->r_resolve_externals(searchpath, coordsys) - && success; + group_child->r_resolve_externals(searchpath, coordsys) + && success; } } return success; @@ -1005,7 +1005,7 @@ prepare_remove_child(EggNode *node) { //////////////////////////////////////////////////////////////////// void EggGroupNode:: r_collect_vertex_normals(EggGroupNode::NVertexCollection &collection, - double threshold, CoordinateSystem cs) { + double threshold, CoordinateSystem cs) { // We can do this ci/cnext iteration through the list as we modify // it, only because we know this works with an STL list type // container. If this were a vector or a set, this wouldn't @@ -1025,20 +1025,20 @@ r_collect_vertex_normals(EggGroupNode::NVertexCollection &collection, NVertexReference ref; ref._polygon = polygon; if (!polygon->calculate_normal(ref._normal, cs)) { - // The polygon is degenerate. Remove it. - - prepare_remove_child(child); - _children.erase(ci); + // The polygon is degenerate. Remove it. + + prepare_remove_child(child); + _children.erase(ci); } else { - // Now add each vertex from the polygon separately to our - // collection. - size_t num_vertices = polygon->size(); - for (size_t i = 0; i < num_vertices; i++) { - EggVertex *vertex = polygon->get_vertex(i); - ref._vertex = i; - collection[vertex->get_pos3()].push_back(ref); - } + // Now add each vertex from the polygon separately to our + // collection. + size_t num_vertices = polygon->size(); + for (size_t i = 0; i < num_vertices; i++) { + EggVertex *vertex = polygon->get_vertex(i); + ref._vertex = i; + collection[vertex->get_pos3()].push_back(ref); + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -1047,9 +1047,9 @@ r_collect_vertex_normals(EggGroupNode::NVertexCollection &collection, // We can't share vertices across an Instance node. Don't // even bother trying. Instead, just restart. if (group->is_under_instance()) { - group->recompute_vertex_normals(threshold, cs); + group->recompute_vertex_normals(threshold, cs); } else { - group->r_collect_vertex_normals(collection, threshold, cs); + group->r_collect_vertex_normals(collection, threshold, cs); } } diff --git a/panda/src/egg/eggGroupNode.h b/panda/src/egg/eggGroupNode.h index d25218619c..ce1f1ed0b2 100644 --- a/panda/src/egg/eggGroupNode.h +++ b/panda/src/egg/eggGroupNode.h @@ -24,7 +24,7 @@ class EggVertex; class DSearchPath; //////////////////////////////////////////////////////////////////// -// Class : EggGroupNode +// Class : EggGroupNode // Description : A base class for nodes in the hierarchy that are not // leaf nodes. (See also EggGroup, which is // specifically the "" node in egg.) @@ -112,7 +112,7 @@ protected: virtual void update_under(int depth_offset); virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_transform_vertices(const LMatrix4d &mat); virtual void r_mark_coordsys(CoordinateSystem cs); virtual void r_flatten_transforms(); @@ -123,7 +123,7 @@ protected: int find_textures(EggTextureCollection *collection); int find_materials(EggMaterialCollection *collection); bool r_resolve_externals(const DSearchPath &searchpath, - CoordinateSystem coordsys); + CoordinateSystem coordsys); private: Children _children; @@ -145,7 +145,7 @@ private: typedef map NVertexCollection; void r_collect_vertex_normals(NVertexCollection &collection, - double threshold, CoordinateSystem cs); + double threshold, CoordinateSystem cs); void do_compute_vertex_normals(const NVertexGroup &group); public: diff --git a/panda/src/egg/eggGroupUniquifier.h b/panda/src/egg/eggGroupUniquifier.h index 37a850bd12..fa82826625 100644 --- a/panda/src/egg/eggGroupUniquifier.h +++ b/panda/src/egg/eggGroupUniquifier.h @@ -11,7 +11,7 @@ #include "eggNameUniquifier.h" //////////////////////////////////////////////////////////////////// -// Class : EggGroupUniquifier +// Class : EggGroupUniquifier // Description : This is a specialization of EggNameUniquifier to // generate unique names for EggGroup nodes. It's not // called automatically; you must invoke it yourself if @@ -24,7 +24,7 @@ public: virtual string get_category(EggNode *node); virtual string filter_name(EggNode *node); virtual string generate_name(EggNode *node, - const string &category, int index); + const string &category, int index); public: static TypeHandle get_class_type() { @@ -33,7 +33,7 @@ public: static void init_type() { EggNameUniquifier::init_type(); register_type(_type_handle, "EggGroupUniquifier", - EggNameUniquifier::get_class_type()); + EggNameUniquifier::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggMaterial.cxx b/panda/src/egg/eggMaterial.cxx index f3707dcc13..c4a13a0338 100644 --- a/panda/src/egg/eggMaterial.cxx +++ b/panda/src/egg/eggMaterial.cxx @@ -55,7 +55,7 @@ write(ostream &out, int indent_level) const { << " diffb { " << get_diff()[2] << " }\n"; if (get_diff()[3] != 1.0) { indent(out, indent_level + 2) - << " diffa { " << get_diff()[3] << " }\n"; + << " diffa { " << get_diff()[3] << " }\n"; } } @@ -68,7 +68,7 @@ write(ostream &out, int indent_level) const { << " ambb { " << get_amb()[2] << " }\n"; if (get_amb()[3] != 1.0) { indent(out, indent_level + 2) - << " amba { " << get_amb()[3] << " }\n"; + << " amba { " << get_amb()[3] << " }\n"; } } @@ -81,7 +81,7 @@ write(ostream &out, int indent_level) const { << " emitb { " << get_emit()[2] << " }\n"; if (get_emit()[3] != 1.0) { indent(out, indent_level + 2) - << " emita { " << get_emit()[3] << " }\n"; + << " emita { " << get_emit()[3] << " }\n"; } } @@ -94,7 +94,7 @@ write(ostream &out, int indent_level) const { << " specb { " << get_spec()[2] << " }\n"; if (get_spec()[3] != 1.0) { indent(out, indent_level + 2) - << " speca { " << get_spec()[3] << " }\n"; + << " speca { " << get_spec()[3] << " }\n"; } } @@ -133,12 +133,12 @@ bool EggMaterial:: is_equivalent_to(const EggMaterial &other, int eq) const { if (eq & E_attributes) { if (_flags != other._flags || - (has_diff() && get_diff() != other.get_diff()) || - (has_amb() && get_amb() != other.get_amb()) || - (has_emit() && get_emit() != other.get_emit()) || - (has_spec() && get_spec() != other.get_spec()) || - (has_shininess() && get_shininess() != other.get_shininess()) || - (has_local() && get_local() != other.get_local())) { + (has_diff() && get_diff() != other.get_diff()) || + (has_amb() && get_amb() != other.get_amb()) || + (has_emit() && get_emit() != other.get_emit()) || + (has_spec() && get_spec() != other.get_spec()) || + (has_shininess() && get_shininess() != other.get_shininess()) || + (has_local() && get_local() != other.get_local())) { return false; } } diff --git a/panda/src/egg/eggMaterial.h b/panda/src/egg/eggMaterial.h index da1cc8cab9..8acc18a6d1 100644 --- a/panda/src/egg/eggMaterial.h +++ b/panda/src/egg/eggMaterial.h @@ -13,7 +13,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : EggMaterial +// Class : EggMaterial // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggMaterial : public EggNode { @@ -87,7 +87,7 @@ public: static void init_type() { EggNode::init_type(); register_type(_type_handle, "EggMaterial", - EggNode::get_class_type()); + EggNode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggMaterialCollection.I b/panda/src/egg/eggMaterialCollection.I index 8c91dd2ade..6d0a4cca96 100644 --- a/panda/src/egg/eggMaterialCollection.I +++ b/panda/src/egg/eggMaterialCollection.I @@ -6,7 +6,7 @@ INLINE EggMaterialCollection::iterator EggMaterialCollection:: begin() const { nassertr(_ordered_materials.size() == _materials.size(), - _ordered_materials.begin()); + _ordered_materials.begin()); return _ordered_materials.begin(); } diff --git a/panda/src/egg/eggMaterialCollection.cxx b/panda/src/egg/eggMaterialCollection.cxx index 8f7921ed31..705505fa71 100644 --- a/panda/src/egg/eggMaterialCollection.cxx +++ b/panda/src/egg/eggMaterialCollection.cxx @@ -150,14 +150,14 @@ find_used_materials(EggNode *node) { EggMaterial *tex = primitive->get_material(); Materials::iterator ti = _materials.find(tex); if (ti == _materials.end()) { - // Here's a new material! - num_found++; - _materials.insert(Materials::value_type(tex, 1)); - _ordered_materials.push_back(tex); + // Here's a new material! + num_found++; + _materials.insert(Materials::value_type(tex, 1)); + _ordered_materials.push_back(tex); } else { - // Here's a material we'd already known about. Increment its - // usage count. - (*ti).second++; + // Here's a material we'd already known about. Increment its + // usage count. + (*ti).second++; } } @@ -282,7 +282,7 @@ collapse_equivalent_materials(int eq, EggMaterialCollection::MaterialReplacement //////////////////////////////////////////////////////////////////// void EggMaterialCollection:: replace_materials(EggGroupNode *node, - const EggMaterialCollection::MaterialReplacement &replace) { + const EggMaterialCollection::MaterialReplacement &replace) { EggGroupNode::iterator ci; for (ci = node->begin(); ci != node->end(); @@ -291,13 +291,13 @@ replace_materials(EggGroupNode *node, if (child->is_of_type(EggPrimitive::get_class_type())) { EggPrimitive *primitive = DCAST(EggPrimitive, child); if (primitive->has_material()) { - PT(EggMaterial) tex = primitive->get_material(); - MaterialReplacement::const_iterator ri; - ri = replace.find(tex); - if (ri != replace.end()) { - // Here's a material we want to replace. - primitive->set_material((*ri).second); - } + PT(EggMaterial) tex = primitive->get_material(); + MaterialReplacement::const_iterator ri; + ri = replace.find(tex); + if (ri != replace.end()) { + // Here's a material we want to replace. + primitive->set_material((*ri).second); + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { diff --git a/panda/src/egg/eggMaterialCollection.h b/panda/src/egg/eggMaterialCollection.h index 842f6839c4..8426dc843c 100644 --- a/panda/src/egg/eggMaterialCollection.h +++ b/panda/src/egg/eggMaterialCollection.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggMaterialCollection +// Class : EggMaterialCollection // Description : This is a collection of materials by MRef name. It // can extract the materials from an egg file and sort // them all together; it can also manage the creation of @@ -60,7 +60,7 @@ public: int collapse_equivalent_materials(int eq, EggGroupNode *node); int collapse_equivalent_materials(int eq, MaterialReplacement &removed); static void replace_materials(EggGroupNode *node, - const MaterialReplacement &replace); + const MaterialReplacement &replace); void uniquify_mrefs(); void sort_by_mref(); diff --git a/panda/src/egg/eggMiscFuncs.cxx b/panda/src/egg/eggMiscFuncs.cxx index d14bf8bd10..f8a063ebc9 100644 --- a/panda/src/egg/eggMiscFuncs.cxx +++ b/panda/src/egg/eggMiscFuncs.cxx @@ -20,7 +20,7 @@ //////////////////////////////////////////////////////////////////// ostream & enquote_string(ostream &out, const string &str, int indent_level, - bool always_quote) { + bool always_quote) { indent(out, indent_level); // First, see if we need to enquote it. @@ -39,19 +39,19 @@ enquote_string(ostream &out, const string &str, int indent_level, for (p = str.begin(); p != str.end(); ++p) { switch (*p) { case '"': - // Can't output nested quote marks at all. - out << "'"; - break; - + // Can't output nested quote marks at all. + out << "'"; + break; + case '\n': - // A newline necessitates ending the quotes, newlining, and - // beginning again. - out << "\"\n"; - indent(out, indent_level) << '"'; - break; - + // A newline necessitates ending the quotes, newlining, and + // beginning again. + out << "\"\n"; + indent(out, indent_level) << '"'; + break; + default: - out << *p; + out << *p; } } out << '"'; @@ -102,19 +102,19 @@ write_transform(ostream &out, const LMatrix4d &mat, int indent_level) { pfVec3 s, r, t; if (ExtractMatrix(mat, s, r, t)) { if (!s.almostEqual(pfVec3(1.0, 1.0, 1.0), 0.0001)) { - Indent(out, indent+2) << " { " << s << " }\n"; + Indent(out, indent+2) << " { " << s << " }\n"; } if (fabs(r[0]) > 0.0001) { - Indent(out, indent+2) << " { " << r[0] << " }\n"; + Indent(out, indent+2) << " { " << r[0] << " }\n"; } if (fabs(r[1]) > 0.0001) { - Indent(out, indent+2) << " { " << r[1] << " }\n"; + Indent(out, indent+2) << " { " << r[1] << " }\n"; } if (fabs(r[2]) > 0.0001) { - Indent(out, indent+2) << " { " << r[2] << " }\n"; + Indent(out, indent+2) << " { " << r[2] << " }\n"; } if (!t.almostEqual(pfVec3(0.0, 0.0, 0.0), 0.0001)) { - Indent(out, indent+2) << " { " << t << " }\n"; + Indent(out, indent+2) << " { " << t << " }\n"; } written = true; } @@ -129,7 +129,7 @@ write_transform(ostream &out, const LMatrix4d &mat, int indent_level) { for (int r = 0; r < 4; r++) { indent(out, indent_level+3); for (int c = 0; c < 4; c++) { - out << " " << mat(r, c); + out << " " << mat(r, c); } out << "\n"; } diff --git a/panda/src/egg/eggMiscFuncs.h b/panda/src/egg/eggMiscFuncs.h index 56a7aef8ed..e3f326896a 100644 --- a/panda/src/egg/eggMiscFuncs.h +++ b/panda/src/egg/eggMiscFuncs.h @@ -37,8 +37,8 @@ class ostream; //////////////////////////////////////////////////////////////////// ostream & enquote_string(ostream &out, const string &str, - int indent_level = 0, - bool always_quote = false); + int indent_level = 0, + bool always_quote = false); diff --git a/panda/src/egg/eggMorph.h b/panda/src/egg/eggMorph.h index 67b2ca8938..47a68c5291 100644 --- a/panda/src/egg/eggMorph.h +++ b/panda/src/egg/eggMorph.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggMorph +// Class : EggMorph // Description : A single or or some such entry. This // simply contains the morph name and the offset value. // The class EggMorph is actually a template class on diff --git a/panda/src/egg/eggMorphList.h b/panda/src/egg/eggMorphList.h index 0becb02ba3..95766fc8af 100644 --- a/panda/src/egg/eggMorphList.h +++ b/panda/src/egg/eggMorphList.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggMorphList +// Class : EggMorphList // Description : A collection of 's or 's or some such. //////////////////////////////////////////////////////////////////// template diff --git a/panda/src/egg/eggNameUniquifier.cxx b/panda/src/egg/eggNameUniquifier.cxx index 6f751500ac..98f27ed283 100644 --- a/panda/src/egg/eggNameUniquifier.cxx +++ b/panda/src/egg/eggNameUniquifier.cxx @@ -60,9 +60,9 @@ uniquify(EggNode *node) { inserted = names.insert(UsedNames::value_type(name, node)).second; if (!inserted) { while (!inserted) { - _index++; - name = generate_name(node, category, _index); - inserted = names.insert(UsedNames::value_type(name, node)).second; + _index++; + name = generate_name(node, category, _index); + inserted = names.insert(UsedNames::value_type(name, node)).second; } } diff --git a/panda/src/egg/eggNameUniquifier.h b/panda/src/egg/eggNameUniquifier.h index 5bd1b8536c..564768b8e8 100644 --- a/panda/src/egg/eggNameUniquifier.h +++ b/panda/src/egg/eggNameUniquifier.h @@ -70,7 +70,7 @@ class EggNode; //////////////////////////////////////////////////////////////////// -// Class : EggNameUniquifier +// Class : EggNameUniquifier // Description : This is a handy class for guaranteeing unique node // names in an egg hierarchy. It is an abstract class; // to use it you must subclass off of it. See the @@ -88,12 +88,12 @@ public: EggNode *get_node(const string &category, const string &name) const; bool has_name(const string &category, const string &name) const; bool add_name(const string &category, const string &name, - EggNode *node = NULL); + EggNode *node = NULL); virtual string get_category(EggNode *node)=0; virtual string filter_name(EggNode *node); virtual string generate_name(EggNode *node, - const string &category, int index); + const string &category, int index); private: typedef map UsedNames; @@ -110,7 +110,7 @@ public: static void init_type() { EggObject::init_type(); register_type(_type_handle, "EggNameUniquifier", - EggObject::get_class_type()); + EggObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggNamedObject.h b/panda/src/egg/eggNamedObject.h index 0368d00858..456006c2a8 100644 --- a/panda/src/egg/eggNamedObject.h +++ b/panda/src/egg/eggNamedObject.h @@ -17,7 +17,7 @@ class ostream; #endif //////////////////////////////////////////////////////////////////// -// Class : EggNamedObject +// Class : EggNamedObject // Description : This is a fairly high-level base class--any egg // object that has a name. //////////////////////////////////////////////////////////////////// @@ -28,7 +28,7 @@ public: INLINE EggNamedObject &operator = (const EggNamedObject ©); void write_header(ostream &out, int indent_level, - const char *egg_keyword) const; + const char *egg_keyword) const; static TypeHandle get_class_type() { @@ -38,7 +38,7 @@ public: EggObject::init_type(); Namable::init_type(); register_type(_type_handle, "EggNamedObject", - EggObject::get_class_type(), + EggObject::get_class_type(), Namable::get_class_type()); } virtual TypeHandle get_type() const { diff --git a/panda/src/egg/eggNode.h b/panda/src/egg/eggNode.h index 9c93cd2866..4883a25a02 100644 --- a/panda/src/egg/eggNode.h +++ b/panda/src/egg/eggNode.h @@ -20,7 +20,7 @@ class EggRenderMode; class EggTextureCollection; //////////////////////////////////////////////////////////////////// -// Class : EggNode +// Class : EggNode // Description : A base class for things that may be directly added // into the egg hierarchy. This includes groups, // joints, polygons, vertex pools, etc., but does not @@ -78,7 +78,7 @@ protected: virtual void adjust_under(); virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_transform_vertices(const LMatrix4d &mat); virtual void r_mark_coordsys(CoordinateSystem cs); virtual void r_flatten_transforms(); @@ -109,7 +109,7 @@ public: static void init_type() { EggNamedObject::init_type(); register_type(_type_handle, "EggNode", - EggNamedObject::get_class_type()); + EggNamedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggNurbsCurve.cxx b/panda/src/egg/eggNurbsCurve.cxx index 3a43c7936e..6d485d6ae3 100644 --- a/panda/src/egg/eggNurbsCurve.cxx +++ b/panda/src/egg/eggNurbsCurve.cxx @@ -136,7 +136,7 @@ write(ostream &out, int indent_level) const { indent(out, indent_level + 2) << " {\n"; write_long_list(out, indent_level+4, _knots.begin(), _knots.end(), "", - "", 72); + "", 72); indent(out, indent_level + 2) << "}\n"; diff --git a/panda/src/egg/eggNurbsCurve.h b/panda/src/egg/eggNurbsCurve.h index df82d917d5..4a4b5d7c1b 100644 --- a/panda/src/egg/eggNurbsCurve.h +++ b/panda/src/egg/eggNurbsCurve.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggNurbsCurve +// Class : EggNurbsCurve // Description : A parametric NURBS curve. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggNurbsCurve : public EggCurve { diff --git a/panda/src/egg/eggNurbsSurface.cxx b/panda/src/egg/eggNurbsSurface.cxx index aab71f6d2c..a7e11e149a 100644 --- a/panda/src/egg/eggNurbsSurface.cxx +++ b/panda/src/egg/eggNurbsSurface.cxx @@ -190,7 +190,7 @@ write(ostream &out, int indent_level) const { indent(out, indent_level + 4) << " {\n"; Curves::const_iterator ci; for (ci = (*li).begin(); ci != (*li).end(); ++ci) { - (*ci)->write(out, indent_level + 6); + (*ci)->write(out, indent_level + 6); } indent(out, indent_level + 4) << "}\n"; } @@ -210,13 +210,13 @@ write(ostream &out, int indent_level) const { indent(out, indent_level + 2) << " {\n"; write_long_list(out, indent_level+4, _u_knots.begin(), _u_knots.end(), - "", "", 72); + "", "", 72); indent(out, indent_level + 2) << "}\n"; indent(out, indent_level + 2) << " {\n"; write_long_list(out, indent_level+4, _v_knots.begin(), _v_knots.end(), - "", "", 72); + "", "", 72); indent(out, indent_level + 2) << "}\n"; diff --git a/panda/src/egg/eggNurbsSurface.h b/panda/src/egg/eggNurbsSurface.h index 327e7d15e7..be8f9bc410 100644 --- a/panda/src/egg/eggNurbsSurface.h +++ b/panda/src/egg/eggNurbsSurface.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggNurbsSurface +// Class : EggNurbsSurface // Description : A parametric NURBS surface. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggNurbsSurface : public EggSurface { @@ -32,7 +32,7 @@ public: INLINE EggNurbsSurface &operator = (const EggNurbsSurface ©); void setup(int u_order, int v_order, - int num_u_knots, int num_v_knots); + int num_u_knots, int num_v_knots); INLINE void set_u_order(int u_order); INLINE void set_v_order(int v_order); diff --git a/panda/src/egg/eggObject.h b/panda/src/egg/eggObject.h index adae34f14d..4b127f4e53 100644 --- a/panda/src/egg/eggObject.h +++ b/panda/src/egg/eggObject.h @@ -15,7 +15,7 @@ class ostream; #endif //////////////////////////////////////////////////////////////////// -// Class : EggObject +// Class : EggObject // Description : The highest-level base class in the egg directory. // (Almost) all things egg inherit from this. //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "EggObject", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggParameters.h b/panda/src/egg/eggParameters.h index 56bcf8f303..1c21ddb262 100644 --- a/panda/src/egg/eggParameters.h +++ b/panda/src/egg/eggParameters.h @@ -9,7 +9,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : EggParameters +// Class : EggParameters // Description : The values stored in this structure are global // parameters that control some aspects of the egg // library. User code may adjust these parameters by diff --git a/panda/src/egg/eggPoint.h b/panda/src/egg/eggPoint.h index 1762aa4df6..27005d4d9d 100644 --- a/panda/src/egg/eggPoint.h +++ b/panda/src/egg/eggPoint.h @@ -11,7 +11,7 @@ #include "eggPrimitive.h" //////////////////////////////////////////////////////////////////// -// Class : EggPoint +// Class : EggPoint // Description : A single point, or a collection of points as defined // by a single entry. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index 91175cf6f0..82da1445f1 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/panda/src/egg/eggPolygon.cxx @@ -62,30 +62,30 @@ calculate_normal(Normald &result, CoordinateSystem cs) const { if (is_unique) { if (i < 2) { - i++; + i++; } else { - // Ok, we have three vertices. Do they determine a plane? - LVector3d a = v[1] - v[0]; - LVector3d b = v[2] - v[0]; - LVector3d normal = a.cross(b); + // Ok, we have three vertices. Do they determine a plane? + LVector3d a = v[1] - v[0]; + LVector3d b = v[2] - v[0]; + LVector3d normal = a.cross(b); - if (normal.normalize()) { - // If we are in a left-handed coordinate system, we must - // reverse the normal. - if (cs == CS_default) { - cs = default_coordinate_system; - } - if (cs == CS_zup_left || cs == CS_yup_left) { - normal = -normal; - } + if (normal.normalize()) { + // If we are in a left-handed coordinate system, we must + // reverse the normal. + if (cs == CS_default) { + cs = default_coordinate_system; + } + if (cs == CS_zup_left || cs == CS_yup_left) { + normal = -normal; + } - result = normal; - return true; - } + result = normal; + return true; + } - // No, the three vertices must have been collinear. Carry on - // and get another vertex. + // No, the three vertices must have been collinear. Carry on + // and get another vertex. } } ++vi; @@ -191,9 +191,9 @@ decomp_concave(EggGroupNode *container, int asum, int x, int y) const { while (p0 != p2->next) { /* Polygon is self-intersecting so punt */ if (chek && - m[0] == p0 && - m[1] == p1 && - m[2] == p2) { + m[0] == p0 && + m[1] == p1 && + m[2] == p2) { return false; } @@ -217,71 +217,71 @@ decomp_concave(EggGroupNode *container, int asum, int x, int y) const { /* current angle is convex */ xmin = (VX(p0, x) < VX(p1, x)) ? VX(p0, x) : VX(p1, x); if (xmin > VX(p2, x)) - xmin = VX(p2, x); + xmin = VX(p2, x); xmax = (VX(p0, x) > VX(p1, x)) ? VX(p0, x) : VX(p1, x); if (xmax < VX(p2, x)) - xmax = VX(p2, x); + xmax = VX(p2, x); ymin = (VX(p0, y) < VX(p1, y)) ? VX(p0, y) : VX(p1, y); if (ymin > VX(p2, y)) - ymin = VX(p2, y); + ymin = VX(p2, y); ymax = (VX(p0, y) > VX(p1, y)) ? VX(p0, y) : VX(p1, y); if (ymax < VX(p2, y)) - ymax = VX(p2, y); + ymax = VX(p2, y); for (init = 1, t0 = p2->next; t0 != p0; t0 = t0->next) { - if (VX(t0, x) >= xmin && VX(t0, x) <= xmax && - VX(t0, y) >= ymin && VX(t0, y) <= ymax) { - if (init) { - a[1] = VX(p2, y) - VX(p0, y); - b[1] = VX(p0, x) - VX(p2, x); - init = 0; - c[0] = VX(p1, x) * VX(p2, y) - VX(p2, x) * VX(p1, y); - c[1] = VX(p2, x) * VX(p0, y) - VX(p0, x) * VX(p2, y); - c[2] = VX(p0, x) * VX(p1, y) - VX(p1, x) * VX(p0, y); - } - - s[0] = a[0] * VX(t0, x) + b[0] * VX(t0, y) + c[0]; - s[1] = a[1] * VX(t0, x) + b[1] * VX(t0, y) + c[1]; - s[2] = a[2] * VX(t0, x) + b[2] * VX(t0, y) + c[2]; - - if (asum) { - if (s[0] >= 0.0 && s[1] >= 0.0 && s[2] >= 0.0) - break; - } else { - if (s[0] <= 0.0 && s[1] <= 0.0 && s[2] <= 0.0) - break; - } - } + if (VX(t0, x) >= xmin && VX(t0, x) <= xmax && + VX(t0, y) >= ymin && VX(t0, y) <= ymax) { + if (init) { + a[1] = VX(p2, y) - VX(p0, y); + b[1] = VX(p0, x) - VX(p2, x); + init = 0; + c[0] = VX(p1, x) * VX(p2, y) - VX(p2, x) * VX(p1, y); + c[1] = VX(p2, x) * VX(p0, y) - VX(p0, x) * VX(p2, y); + c[2] = VX(p0, x) * VX(p1, y) - VX(p1, x) * VX(p0, y); + } + + s[0] = a[0] * VX(t0, x) + b[0] * VX(t0, y) + c[0]; + s[1] = a[1] * VX(t0, x) + b[1] * VX(t0, y) + c[1]; + s[2] = a[2] * VX(t0, x) + b[2] * VX(t0, y) + c[2]; + + if (asum) { + if (s[0] >= 0.0 && s[1] >= 0.0 && s[2] >= 0.0) + break; + } else { + if (s[0] <= 0.0 && s[1] <= 0.0 && s[2] <= 0.0) + break; + } + } } if (t0 != p0) { - p0 = p1; - p1 = p2; - p2 = p2->next; + p0 = p1; + p1 = p2; + p2 = p2->next; } else { - // Here's a triangle to output. - PT(EggPolygon) triangle = new EggPolygon(*this); - triangle->clear(); - triangle->add_vertex(get_vertex(p0->index)); - triangle->add_vertex(get_vertex(p1->index)); - triangle->add_vertex(get_vertex(p2->index)); - - if (triangle->cleanup()) { - container->add_child(triangle.p()); - } - - p0->next = p1->next; - p1 = p2; - p2 = p2->next; - - m[0] = p0; - m[1] = p1; - m[2] = p2; - chek = 0; + // Here's a triangle to output. + PT(EggPolygon) triangle = new EggPolygon(*this); + triangle->clear(); + triangle->add_vertex(get_vertex(p0->index)); + triangle->add_vertex(get_vertex(p1->index)); + triangle->add_vertex(get_vertex(p2->index)); + + if (triangle->cleanup()) { + container->add_child(triangle.p()); + } + + p0->next = p1->next; + p1 = p2; + p2 = p2->next; + + m[0] = p0; + m[1] = p1; + m[2] = p2; + chek = 0; } } } @@ -361,16 +361,16 @@ triangulate_poly(EggGroupNode *container, bool convex_also) { for (i = 0; i < 3; i++) { if (as[i] >= 0.0) { if (as[i] > max) { - max = as[i]; - index = i; - flag = 1; + max = as[i]; + index = i; + flag = 1; } } else { as[i] = -as[i]; if (as[i] > max) { - max = as[i]; - index = i; - flag = 0; + max = as[i]; + index = i; + flag = 0; } } } @@ -447,7 +447,7 @@ triangulate_poly(EggGroupNode *container, bool convex_also) { triangle->add_vertex(get_vertex(v)); if (triangle->cleanup()) { - container->add_child(triangle.p()); + container->add_child(triangle.p()); } v0 = v1; @@ -461,7 +461,7 @@ triangulate_poly(EggGroupNode *container, bool convex_also) { triangle->add_vertex(get_vertex(v)); if (triangle->cleanup()) { - container->add_child(triangle.p()); + container->add_child(triangle.p()); } v0 = v1; diff --git a/panda/src/egg/eggPolygon.h b/panda/src/egg/eggPolygon.h index 3ef108186e..4835c22a4a 100644 --- a/panda/src/egg/eggPolygon.h +++ b/panda/src/egg/eggPolygon.h @@ -11,7 +11,7 @@ #include "eggPrimitive.h" //////////////////////////////////////////////////////////////////// -// Class : EggPolygon +// Class : EggPolygon // Description : A single polygon. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggPolygon : public EggPrimitive { diff --git a/panda/src/egg/eggPoolUniquifier.h b/panda/src/egg/eggPoolUniquifier.h index 382d3cb9d1..dd2759ec95 100644 --- a/panda/src/egg/eggPoolUniquifier.h +++ b/panda/src/egg/eggPoolUniquifier.h @@ -11,7 +11,7 @@ #include "eggNameUniquifier.h" //////////////////////////////////////////////////////////////////// -// Class : EggPoolUniquifier +// Class : EggPoolUniquifier // Description : This is a specialization of EggNameUniquifier to // generate unique names for textures, materials, and // vertex pools prior to writing out an egg file. It's @@ -31,7 +31,7 @@ public: static void init_type() { EggNameUniquifier::init_type(); register_type(_type_handle, "EggPoolUniquifier", - EggNameUniquifier::get_class_type()); + EggNameUniquifier::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggPrimitive.cxx b/panda/src/egg/eggPrimitive.cxx index ca269424cc..39396898be 100644 --- a/panda/src/egg/eggPrimitive.cxx +++ b/panda/src/egg/eggPrimitive.cxx @@ -176,9 +176,9 @@ remove_doubled_verts(bool closed) { ++vi; while (vi != _vertices.end()) { if ((*vi) != (*vlast)) { - new_vertices.push_back(*vi); + new_vertices.push_back(*vi); } else { - prepare_remove_vertex(*vi); + prepare_remove_vertex(*vi); } vlast = vi; ++vi; @@ -241,7 +241,7 @@ erase(iterator first, iterator last) { prepare_remove_vertex(*i); } iterator result = _vertices.erase((Vertices::iterator &)first, - (Vertices::iterator &)last); + (Vertices::iterator &)last); test_vref_integrity(); return result; } @@ -469,13 +469,13 @@ write_body(ostream &out, int indent_level) const { indent(out, indent_level) << " {"; const_iterator i; for (i = begin(); i != end(); ++i) { - EggVertex *vert = *i; - vert->test_pref_integrity(); - - // Make sure each vertex belongs to the same pool. - nassertv(vert->get_pool() == pool); - - out << " " << vert->get_index(); + EggVertex *vert = *i; + vert->test_pref_integrity(); + + // Make sure each vertex belongs to the same pool. + nassertv(vert->get_pool() == pool); + + out << " " << vert->get_index(); } out << " { "; enquote_string(out, pool->get_name()) << " } }\n"; @@ -487,18 +487,18 @@ write_body(ostream &out, int indent_level) const { vector_int indices; const_iterator i; for (i = begin(); i != end(); ++i) { - EggVertex *vert = *i; - vert->test_pref_integrity(); - - // Make sure each vertex belongs to the same pool. - nassertv(vert->get_pool() == pool); - - indices.push_back(vert->get_index()); + EggVertex *vert = *i; + vert->test_pref_integrity(); + + // Make sure each vertex belongs to the same pool. + nassertv(vert->get_pool() == pool); + + indices.push_back(vert->get_index()); } indent(out, indent_level) << " {\n"; write_long_list(out, indent_level+2, indices.begin(), indices.end(), - "", "", 72); + "", "", 72); indent(out, indent_level+2) << " { "; enquote_string(out, pool->get_name()) << " }\n"; indent(out, indent_level) << "}\n"; @@ -560,7 +560,7 @@ r_flatten_transforms() { new_vertex.transform(mat); EggVertex *unique = pool->create_unique_vertex(new_vertex); unique->copy_grefs_from(*vertex); - + set_vertex(i, unique); } } @@ -577,10 +577,10 @@ r_apply_texmats(EggTextureCollection &textures) { EggTexture *texture = get_texture(); if (texture->has_transform()) { if (texture->transform_is_identity()) { - // Now, what's the point of a texture with an identity - // transform? - texture->clear_transform(); - return; + // Now, what's the point of a texture with an identity + // transform? + texture->clear_transform(); + return; } // We've got a texture with a matrix applied. Save the matrix, @@ -596,18 +596,18 @@ r_apply_texmats(EggTextureCollection &textures) { // as necessary. size_t num_vertices = size(); for (size_t i = 0; i < num_vertices; i++) { - EggVertex *vertex = get_vertex(i); + EggVertex *vertex = get_vertex(i); - if (vertex->has_uv()) { - EggVertexPool *pool = vertex->get_pool(); + if (vertex->has_uv()) { + EggVertexPool *pool = vertex->get_pool(); - EggVertex new_vertex(*vertex); - new_vertex.set_uv(vertex->get_uv() * mat); - EggVertex *unique = pool->create_unique_vertex(new_vertex); - unique->copy_grefs_from(*vertex); - - set_vertex(i, unique); - } + EggVertex new_vertex(*vertex); + new_vertex.set_uv(vertex->get_uv() * mat); + EggVertex *unique = pool->create_unique_vertex(new_vertex); + unique->copy_grefs_from(*vertex); + + set_vertex(i, unique); + } } } } diff --git a/panda/src/egg/eggPrimitive.h b/panda/src/egg/eggPrimitive.h index a477675d36..6187e6fecf 100644 --- a/panda/src/egg/eggPrimitive.h +++ b/panda/src/egg/eggPrimitive.h @@ -24,7 +24,7 @@ class EggVertexPool; //////////////////////////////////////////////////////////////////// -// Class : EggPrimitive +// Class : EggPrimitive // Description : A base class for any of a number of kinds of geometry // primitives: polygons, point lights, nurbs patches, // parametrics curves, etc. Things with a set of @@ -37,7 +37,7 @@ class EggVertexPool; // the same vertex pool. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggPrimitive : public EggNode, public EggAttributes, - public EggRenderMode + public EggRenderMode { // This is a bit of private interface stuff that must be here as a @@ -148,7 +148,7 @@ protected: virtual bool egg_start_parse_body(); virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_flatten_transforms(); virtual void r_apply_texmats(EggTextureCollection &textures); @@ -170,7 +170,7 @@ public: register_type(_type_handle, "EggPrimitive", EggNode::get_class_type(), EggAttributes::get_class_type(), - EggRenderMode::get_class_type()); + EggRenderMode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggRenderMode.h b/panda/src/egg/eggRenderMode.h index f9c2e4c471..6b10bfe53a 100644 --- a/panda/src/egg/eggRenderMode.h +++ b/panda/src/egg/eggRenderMode.h @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// -// Class : EggRenderMode +// Class : EggRenderMode // Description : This class stores miscellaneous rendering properties // that is associated with geometry, and which may be // set on the geometry primitive level, on the group diff --git a/panda/src/egg/eggSAnimData.cxx b/panda/src/egg/eggSAnimData.cxx index 1ea16de0d9..b741b782a3 100644 --- a/panda/src/egg/eggSAnimData.cxx +++ b/panda/src/egg/eggSAnimData.cxx @@ -25,7 +25,7 @@ optimize() { double value = get_value(0); for (int row = 1; row < get_num_rows(); row++) { if (fabs(get_value(row) - value) > egg_parameters->_table_threshold) { - return; + return; } } @@ -75,11 +75,11 @@ write(ostream &out, int indent_level) const { if (has_fps()) { indent(out, indent_level + 2) - << " fps { " << get_fps() << " }\n"; + << " fps { " << get_fps() << " }\n"; } indent(out, indent_level + 2) << " {\n"; write_long_list(out, indent_level + 4, _data.begin(), _data.end(), - "", "", 72); + "", "", 72); indent(out, indent_level + 2) << "}\n"; indent(out, indent_level) << "}\n"; } diff --git a/panda/src/egg/eggSAnimData.h b/panda/src/egg/eggSAnimData.h index 567a7a50fe..6d0e49a9e4 100644 --- a/panda/src/egg/eggSAnimData.h +++ b/panda/src/egg/eggSAnimData.h @@ -11,7 +11,7 @@ #include "eggAnimData.h" //////////////////////////////////////////////////////////////////// -// Class : EggSAnimData +// Class : EggSAnimData // Description : Corresponding to an entry, this stores a // single column of numbers, for instance for a morph // target, or as one column in an EggXfmSAnim. diff --git a/panda/src/egg/eggSurface.h b/panda/src/egg/eggSurface.h index df86e718c5..be07b22fb3 100644 --- a/panda/src/egg/eggSurface.h +++ b/panda/src/egg/eggSurface.h @@ -11,7 +11,7 @@ #include "eggPrimitive.h" //////////////////////////////////////////////////////////////////// -// Class : EggSurface +// Class : EggSurface // Description : A parametric surface of some kind. See // EggNurbsSurface. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggSwitchCondition.cxx b/panda/src/egg/eggSwitchCondition.cxx index 687767929c..b2cec552d1 100644 --- a/panda/src/egg/eggSwitchCondition.cxx +++ b/panda/src/egg/eggSwitchCondition.cxx @@ -18,7 +18,7 @@ TypeHandle EggSwitchConditionDistance::_type_handle; //////////////////////////////////////////////////////////////////// EggSwitchConditionDistance:: EggSwitchConditionDistance(double switch_in, double switch_out, - const LPoint3d ¢er, double fade) { + const LPoint3d ¢er, double fade) { _switch_in = switch_in; _switch_out = switch_out; _center = center; diff --git a/panda/src/egg/eggSwitchCondition.h b/panda/src/egg/eggSwitchCondition.h index 60b894a134..782e3c4355 100644 --- a/panda/src/egg/eggSwitchCondition.h +++ b/panda/src/egg/eggSwitchCondition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggSwitchCondition +// Class : EggSwitchCondition // Description : This corresponds to a entry within // a group. It indicates the condition at which a // level-of-detail is switched in or out. This is @@ -37,7 +37,7 @@ public: static void init_type() { EggObject::init_type(); register_type(_type_handle, "EggSwitchCondition", - EggObject::get_class_type()); + EggObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -50,14 +50,14 @@ private: //////////////////////////////////////////////////////////////////// -// Class : EggSwitchConditionDistance +// Class : EggSwitchConditionDistance // Description : A SwitchCondition that switches the levels-of-detail // based on distance from the camera's eyepoint. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggSwitchConditionDistance : public EggSwitchCondition { public: EggSwitchConditionDistance(double switch_in, double switch_out, - const LPoint3d ¢er, double fade = 0.0); + const LPoint3d ¢er, double fade = 0.0); virtual EggSwitchCondition *make_copy() const; virtual void write(ostream &out, int indent_level) const; @@ -75,7 +75,7 @@ public: static void init_type() { EggSwitchCondition::init_type(); register_type(_type_handle, "EggSwitchConditionDistance", - EggSwitchCondition::get_class_type()); + EggSwitchCondition::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/egg/eggTable.h b/panda/src/egg/eggTable.h index 69d6b186ef..b7ce85e1eb 100644 --- a/panda/src/egg/eggTable.h +++ b/panda/src/egg/eggTable.h @@ -11,7 +11,7 @@ #include "eggGroupNode.h" //////////////////////////////////////////////////////////////////// -// Class : EggTable +// Class : EggTable // Description : This corresponds to a or a entry. // As such, it doesn't actually contain a table of // numbers, but it may be a parent to an EggSAnimData or diff --git a/panda/src/egg/eggTexture.I b/panda/src/egg/eggTexture.I index 67110721ac..0cfbc556b7 100644 --- a/panda/src/egg/eggTexture.I +++ b/panda/src/egg/eggTexture.I @@ -320,7 +320,7 @@ get_transform() const { INLINE bool EggTexture:: transform_is_identity() const { return (!has_transform() || - _transform.almost_equal(LMatrix3d::ident_mat(), 0.0001)); + _transform.almost_equal(LMatrix3d::ident_mat(), 0.0001)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index 04a87a1282..3003d4dd1d 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/panda/src/egg/eggTexture.cxx @@ -196,17 +196,17 @@ is_equivalent_to(const EggTexture &other, int eq) const { if (eq & E_basename) { if (a.get_basename_wo_extension() != b.get_basename_wo_extension()) { - return false; + return false; } } if (eq & E_extension) { if (a.get_extension() != b.get_extension()) { - return false; + return false; } } if (eq & E_dirname) { if (a.get_dirname() != b.get_dirname()) { - return false; + return false; } } } @@ -218,21 +218,21 @@ is_equivalent_to(const EggTexture &other, int eq) const { if (has_transform() && other.has_transform()) { if (!_transform.almost_equal(other._transform, 0.0001)) { - return false; + return false; } } } if (eq & E_attributes) { if (_format != other._format || - _wrap_mode != other._wrap_mode || - _wrap_u != other._wrap_u || - _wrap_v != other._wrap_v || - _minfilter != other._minfilter || - _magfilter != other._magfilter || - _magfilteralpha != other._magfilteralpha || - _magfiltercolor != other._magfiltercolor || - _env_type != other._env_type) { + _wrap_mode != other._wrap_mode || + _wrap_u != other._wrap_u || + _wrap_v != other._wrap_v || + _minfilter != other._minfilter || + _magfilter != other._magfilter || + _magfilteralpha != other._magfilteralpha || + _magfiltercolor != other._magfiltercolor || + _env_type != other._env_type) { return false; } if (EggRenderMode::operator != (other)) { @@ -270,17 +270,17 @@ sorts_less_than(const EggTexture &other, int eq) const { if (eq & E_basename) { if (a.get_basename_wo_extension() != b.get_basename_wo_extension()) { - return a.get_basename_wo_extension() < b.get_basename_wo_extension(); + return a.get_basename_wo_extension() < b.get_basename_wo_extension(); } } if (eq & E_extension) { if (a.get_extension() != b.get_extension()) { - return a.get_extension() < b.get_extension(); + return a.get_extension() < b.get_extension(); } } if (eq & E_dirname) { if (a.get_dirname() != b.get_dirname()) { - return a.get_dirname() < b.get_dirname(); + return a.get_dirname() < b.get_dirname(); } } } diff --git a/panda/src/egg/eggTextureCollection.I b/panda/src/egg/eggTextureCollection.I index 3391de1493..3cf6a7eb50 100644 --- a/panda/src/egg/eggTextureCollection.I +++ b/panda/src/egg/eggTextureCollection.I @@ -6,7 +6,7 @@ INLINE EggTextureCollection::iterator EggTextureCollection:: begin() const { nassertr(_ordered_textures.size() == _textures.size(), - _ordered_textures.begin()); + _ordered_textures.begin()); return _ordered_textures.begin(); } diff --git a/panda/src/egg/eggTextureCollection.cxx b/panda/src/egg/eggTextureCollection.cxx index 1d73bde388..6d28be334b 100644 --- a/panda/src/egg/eggTextureCollection.cxx +++ b/panda/src/egg/eggTextureCollection.cxx @@ -150,14 +150,14 @@ find_used_textures(EggNode *node) { EggTexture *tex = primitive->get_texture(); Textures::iterator ti = _textures.find(tex); if (ti == _textures.end()) { - // Here's a new texture! - num_found++; - _textures.insert(Textures::value_type(tex, 1)); - _ordered_textures.push_back(tex); + // Here's a new texture! + num_found++; + _textures.insert(Textures::value_type(tex, 1)); + _ordered_textures.push_back(tex); } else { - // Here's a texture we'd already known about. Increment its - // usage count. - (*ti).second++; + // Here's a texture we'd already known about. Increment its + // usage count. + (*ti).second++; } } @@ -282,7 +282,7 @@ collapse_equivalent_textures(int eq, EggTextureCollection::TextureReplacement &r //////////////////////////////////////////////////////////////////// void EggTextureCollection:: replace_textures(EggGroupNode *node, - const EggTextureCollection::TextureReplacement &replace) { + const EggTextureCollection::TextureReplacement &replace) { EggGroupNode::iterator ci; for (ci = node->begin(); ci != node->end(); @@ -291,13 +291,13 @@ replace_textures(EggGroupNode *node, if (child->is_of_type(EggPrimitive::get_class_type())) { EggPrimitive *primitive = DCAST(EggPrimitive, child); if (primitive->has_texture()) { - PT(EggTexture) tex = primitive->get_texture(); - TextureReplacement::const_iterator ri; - ri = replace.find(tex); - if (ri != replace.end()) { - // Here's a texture we want to replace. - primitive->set_texture((*ri).second); - } + PT(EggTexture) tex = primitive->get_texture(); + TextureReplacement::const_iterator ri; + ri = replace.find(tex); + if (ri != replace.end()) { + // Here's a texture we want to replace. + primitive->set_texture((*ri).second); + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { diff --git a/panda/src/egg/eggTextureCollection.h b/panda/src/egg/eggTextureCollection.h index 2f13c17c57..8b1b0b8dce 100644 --- a/panda/src/egg/eggTextureCollection.h +++ b/panda/src/egg/eggTextureCollection.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggTextureCollection +// Class : EggTextureCollection // Description : This is a collection of textures by TRef name. It // can extract the textures from an egg file and sort // them all together; it can also manage the creation of @@ -60,7 +60,7 @@ public: int collapse_equivalent_textures(int eq, EggGroupNode *node); int collapse_equivalent_textures(int eq, TextureReplacement &removed); static void replace_textures(EggGroupNode *node, - const TextureReplacement &replace); + const TextureReplacement &replace); void uniquify_trefs(); void sort_by_tref(); diff --git a/panda/src/egg/eggUtilities.I b/panda/src/egg/eggUtilities.I index c9aae85245..b8c94697e7 100644 --- a/panda/src/egg/eggUtilities.I +++ b/panda/src/egg/eggUtilities.I @@ -73,32 +73,32 @@ split_vertex(EggVertex *vert, const FunctionObject &sequence) { Sequences::const_iterator si = _sequences.find(seq); if (si != _sequences.end()) { - // Yes, we've seen this sequence number before. Use the same - // vertex. - new_vert = (*si).second; + // Yes, we've seen this sequence number before. Use the same + // vertex. + new_vert = (*si).second; } else { - // No, this is the first time we've encountered this sequence. - // Split the vertex. - new_vert = new EggVertex(*vert); - pool->add_vertex(new_vert); - _sequences[seq] = new_vert; + // No, this is the first time we've encountered this sequence. + // Split the vertex. + new_vert = new EggVertex(*vert); + pool->add_vertex(new_vert); + _sequences[seq] = new_vert; - // The new vertex gets all the same group memberships as the - // old one. - EggVertex::GroupRef::const_iterator gri; - for (gri = vert->gref_begin(); gri != vert->gref_end(); ++gri) { - EggGroup *group = *gri; - group->ref_vertex(new_vert, group->get_vertex_membership(vert)); - } + // The new vertex gets all the same group memberships as the + // old one. + EggVertex::GroupRef::const_iterator gri; + for (gri = vert->gref_begin(); gri != vert->gref_end(); ++gri) { + EggGroup *group = *gri; + group->ref_vertex(new_vert, group->get_vertex_membership(vert)); + } } // Now replace the vertex in the primitive. EggPrimitive::iterator pi; for (pi = prim->begin(); pi != prim->end(); ++pi) { - if (*pi == vert) { - prim->replace(pi, new_vert); - } + if (*pi == vert) { + prim->replace(pi, new_vert); + } } } } diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index 63c42ba179..9e356df252 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -96,7 +96,7 @@ EggVertex:: /////////////////////////////////////////////////////////////////// -// Class : GroupRefEntry +// Class : GroupRefEntry // Description : A temporary class used in EggVertex::write(), below, // to hold the groups that reference each vertex prior // to outputting them as a formatted list. @@ -161,7 +161,7 @@ write(ostream &out, int indent_level) const { // Now output the list. write_long_list(out, indent_level + 2, gre.begin(), gre.end(), "// ", - "", 72); + "", 72); } indent(out, indent_level) diff --git a/panda/src/egg/eggVertex.h b/panda/src/egg/eggVertex.h index 96f3fc384c..3720add717 100644 --- a/panda/src/egg/eggVertex.h +++ b/panda/src/egg/eggVertex.h @@ -22,7 +22,7 @@ class EggPrimitive; //////////////////////////////////////////////////////////////////// -// Class : EggVertex +// Class : EggVertex // Description : Any one-, two-, three-, or four-component vertex, // possibly with attributes such as a normal. //////////////////////////////////////////////////////////////////// @@ -109,7 +109,7 @@ public: EggObject::init_type(); EggAttributes::init_type(); register_type(_type_handle, "EggVertex", - EggObject::get_class_type(), + EggObject::get_class_type(), EggAttributes::get_class_type()); } virtual TypeHandle get_type() const { @@ -131,7 +131,7 @@ INLINE ostream &operator << (ostream &out, const EggVertex &vert) { } /////////////////////////////////////////////////////////////////// -// Class : UniqueEggVertices +// Class : UniqueEggVertices // Description : An STL function object for sorting vertices into // order by properties. Returns true if the two // referenced EggVertex pointers are in sorted order, diff --git a/panda/src/egg/eggVertexPool.cxx b/panda/src/egg/eggVertexPool.cxx index deed4238f9..aed8c96501 100644 --- a/panda/src/egg/eggVertexPool.cxx +++ b/panda/src/egg/eggVertexPool.cxx @@ -107,7 +107,7 @@ get_highest_index() const { EggVertexPool::iterator EggVertexPool:: begin() const { nassertr(_index_vertices.size() == _unique_vertices.size(), - iterator(_index_vertices.begin())); + iterator(_index_vertices.begin())); return iterator(_index_vertices.begin()); } @@ -337,13 +337,13 @@ transform(const LMatrix4d &mat) { int num_global_coord = vert->get_num_global_coord(); if (num_global_coord != 0) { - // This vertex will be transformed. - if (num_local_coord != 0) { - // It also needs to be split! Yuck. - split_vertex(vert, IsLocalVertexSplitter()); - } - - vert->transform(mat); + // This vertex will be transformed. + if (num_local_coord != 0) { + // It also needs to be split! Yuck. + split_vertex(vert, IsLocalVertexSplitter()); + } + + vert->transform(mat); } } @@ -357,10 +357,10 @@ transform(const LMatrix4d &mat) { EggVertex *vert = *i; if (vert->get_num_local_coord() != 0) { - // This should be guaranteed by the vertex-splitting logic - // above. - nassertv(vert->get_num_global_coord() == 0); - vert->transform(local_mat); + // This should be guaranteed by the vertex-splitting logic + // above. + nassertv(vert->get_num_global_coord() == 0); + vert->transform(local_mat); } } } diff --git a/panda/src/egg/eggVertexPool.h b/panda/src/egg/eggVertexPool.h index 7247732156..901c56538e 100644 --- a/panda/src/egg/eggVertexPool.h +++ b/panda/src/egg/eggVertexPool.h @@ -19,7 +19,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggVertexPool +// Class : EggVertexPool // Description : A collection of vertices. There may be any number of // vertex pools in a single egg structure. The vertices // in a single pool need not necessarily have any @@ -103,7 +103,7 @@ public: protected: virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_transform_vertices(const LMatrix4d &mat); private: diff --git a/panda/src/egg/eggXfmAnimData.cxx b/panda/src/egg/eggXfmAnimData.cxx index bcbbead631..7915d9e8ee 100644 --- a/panda/src/egg/eggXfmAnimData.cxx +++ b/panda/src/egg/eggXfmAnimData.cxx @@ -48,8 +48,8 @@ EggXfmAnimData(const EggXfmSAnim &convert_from) nassertv(sanim->get_name().length() == 1); if (sanim->get_num_rows() > 0) { - subtables.push_back(sanim); - _contents += sanim->get_name()[0]; + subtables.push_back(sanim); + _contents += sanim->get_name()[0]; } } } @@ -60,10 +60,10 @@ EggXfmAnimData(const EggXfmSAnim &convert_from) for (int col = 0; col < (int)subtables.size(); col++) { EggSAnimData *sanim = subtables[col]; if (sanim->get_num_rows() == 1) { - add_data(sanim->get_value(0)); + add_data(sanim->get_value(0)); } else { - nassertv(row < sanim->get_num_rows()); - add_data(sanim->get_value(row)); + nassertv(row < sanim->get_num_rows()); + add_data(sanim->get_value(row)); } } } @@ -132,7 +132,7 @@ get_value(int row, LMatrix4d &mat) const { // So now we've got the nine components; build a matrix. EggXfmSAnim::compose_with_order(mat, scale, hpr, translate, get_order(), - _coordsys); + _coordsys); } //////////////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ write(ostream &out, int indent_level) const { indent(out, indent_level + 2) << " {\n"; write_long_list(out, indent_level + 4, _data.begin(), _data.end(), - "", "", 72); + "", "", 72); indent(out, indent_level + 2) << "}\n"; indent(out, indent_level) << "}\n"; } @@ -176,7 +176,7 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void EggXfmAnimData:: r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs) { + CoordinateSystem to_cs) { // We need to build an inverse matrix that doesn't reflect the // translation component. LMatrix4d inv1 = inv; @@ -206,25 +206,25 @@ r_transform(const LMatrix4d &mat, const LMatrix4d &inv, if (!result) { egg_cat.error() - << "Transform from " << _coordsys << " to " << to_cs - << " failed!\n"; + << "Transform from " << _coordsys << " to " << to_cs + << " failed!\n"; LVector3d scale, hpr, trans; bool d = decompose_matrix(orig_mat, scale, hpr, trans, _coordsys); egg_cat.error(false) - << "orig:\n" << orig_mat - << "d = " << d - << "\n scale: " << scale - << "\n hpr: " << hpr - << "\n trans: " << trans << "\n"; + << "orig:\n" << orig_mat + << "d = " << d + << "\n scale: " << scale + << "\n hpr: " << hpr + << "\n trans: " << trans << "\n"; LMatrix4d new_mat = inv1 * orig_mat * mat; d = decompose_matrix(new_mat, scale, hpr, trans, to_cs); egg_cat.error(false) - << "new:\n" << new_mat - << "d = " << d - << "\n scale: " << scale - << "\n hpr: " << hpr - << "\n trans: " << trans << "\n"; + << "new:\n" << new_mat + << "d = " << d + << "\n scale: " << scale + << "\n hpr: " << hpr + << "\n trans: " << trans << "\n"; } // If this assertion fails, we attempted to transform by a skew diff --git a/panda/src/egg/eggXfmAnimData.h b/panda/src/egg/eggXfmAnimData.h index ef186d1747..fb5a0dcf14 100644 --- a/panda/src/egg/eggXfmAnimData.h +++ b/panda/src/egg/eggXfmAnimData.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////// -// Class : EggXfmAnimData +// Class : EggXfmAnimData // Description : Corresponding to an entry, this stores a // two-dimensional table with up to nine columns, one // for each component of a transformation. This is an @@ -23,7 +23,7 @@ class EXPCL_PANDAEGG EggXfmAnimData : public EggAnimData { public: INLINE EggXfmAnimData(const string &name = "", - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); EggXfmAnimData(const EggXfmSAnim &convert_from); INLINE EggXfmAnimData(const EggXfmAnimData ©); @@ -52,7 +52,7 @@ public: protected: virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_mark_coordsys(CoordinateSystem cs); private: diff --git a/panda/src/egg/eggXfmSAnim.cxx b/panda/src/egg/eggXfmSAnim.cxx index 5416cab003..dfdb5c3c71 100644 --- a/panda/src/egg/eggXfmSAnim.cxx +++ b/panda/src/egg/eggXfmSAnim.cxx @@ -73,21 +73,21 @@ optimize() { sanim->optimize(); if (sanim->get_num_rows() == 1) { - // If we've optimized down to one value, check to see if it is - // a default value. - double value = sanim->get_value(0); - double default_value; - if (sanim->has_name() && strchr("ijk", sanim->get_name()[0]) != NULL) { - default_value = 1.0; - } else { - default_value = 0.0; - } + // If we've optimized down to one value, check to see if it is + // a default value. + double value = sanim->get_value(0); + double default_value; + if (sanim->has_name() && strchr("ijk", sanim->get_name()[0]) != NULL) { + default_value = 1.0; + } else { + default_value = 0.0; + } - if (fabs(value - default_value) < egg_parameters->_table_threshold) { - // It's a default-valued table, and therefore redundant: - // remove it. - erase(ci); - } + if (fabs(value - default_value) < egg_parameters->_table_threshold) { + // It's a default-valued table, and therefore redundant: + // remove it. + erase(ci); + } } } @@ -173,11 +173,11 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void EggXfmSAnim:: compose_with_order(LMatrix4d &mat, - const LVecBase3d &scale, - const LVecBase3d &hpr, - const LVecBase3d &trans, - const string &order, - CoordinateSystem cs) { + const LVecBase3d &scale, + const LVecBase3d &hpr, + const LVecBase3d &trans, + const string &order, + CoordinateSystem cs) { mat = LMatrix4d::ident_mat(); @@ -207,9 +207,9 @@ compose_with_order(LMatrix4d &mat, case 'r': if (reverse_roll) { - mat = mat * LMatrix4d::rotate_mat_normaxis(-hpr[2], LVector3d::forward(cs), cs); + mat = mat * LMatrix4d::rotate_mat_normaxis(-hpr[2], LVector3d::forward(cs), cs); } else { - mat = mat * LMatrix4d::rotate_mat_normaxis(hpr[2], LVector3d::forward(cs), cs); + mat = mat * LMatrix4d::rotate_mat_normaxis(hpr[2], LVector3d::forward(cs), cs); } break; @@ -219,7 +219,7 @@ compose_with_order(LMatrix4d &mat, default: egg_cat.warning() - << "Invalid letter in order string: " << *pi << "\n"; + << "Invalid letter in order string: " << *pi << "\n"; } } } @@ -243,12 +243,12 @@ get_num_rows() const { if ((*ci)->is_of_type(EggSAnimData::get_class_type())) { EggSAnimData *sanim = DCAST(EggSAnimData, *ci); if (sanim->get_num_rows() > 1) { - if (!found_any) { - min_rows = sanim->get_num_rows(); + if (!found_any) { + min_rows = sanim->get_num_rows(); - } else { - min_rows = min(min_rows, sanim->get_num_rows()); - } + } else { + min_rows = min(min_rows, sanim->get_num_rows()); + } } } } @@ -279,17 +279,17 @@ get_value(int row, LMatrix4d &mat) const { EggSAnimData *sanim = DCAST(EggSAnimData, *ci); if (sanim->get_num_rows() == 0) { - // If the table is totally empty, let's keep the default - // value. - break; + // If the table is totally empty, let's keep the default + // value. + break; } double value; if (sanim->get_num_rows() == 1) { - value = sanim->get_value(0); + value = sanim->get_value(0); } else { - nassertv(row < sanim->get_num_rows()); - value = sanim->get_value(row); + nassertv(row < sanim->get_num_rows()); + value = sanim->get_value(row); } // Each child SAnimData table should have a one-letter name. @@ -297,44 +297,44 @@ get_value(int row, LMatrix4d &mat) const { switch (sanim->get_name()[0]) { case 'i': - scale[0] = value; - break; + scale[0] = value; + break; case 'j': - scale[1] = value; - break; + scale[1] = value; + break; case 'k': - scale[2] = value; - break; + scale[2] = value; + break; case 'h': - hpr[0] = value; - break; + hpr[0] = value; + break; case 'p': - hpr[1] = value; - break; + hpr[1] = value; + break; case 'r': - hpr[2] = value; - break; + hpr[2] = value; + break; case 'x': - translate[0] = value; - break; + translate[0] = value; + break; case 'y': - translate[1] = value; - break; + translate[1] = value; + break; case 'z': - translate[2] = value; - break; + translate[2] = value; + break; default: - // One of the child tables had an invalid name. - nassertv(false); + // One of the child tables had an invalid name. + nassertv(false); } } } @@ -383,9 +383,9 @@ set_value(int row, const LMatrix4d &mat) { // Each table must have the same length. if (table_length < 0) { - table_length = sanim->get_num_rows(); + table_length = sanim->get_num_rows(); } else { - nassertr(sanim->get_num_rows() == table_length, false); + nassertr(sanim->get_num_rows() == table_length, false); } #endif @@ -394,44 +394,44 @@ set_value(int row, const LMatrix4d &mat) { switch (sanim->get_name()[0]) { case 'i': - sanim->set_value(row, scale[0]); - break; + sanim->set_value(row, scale[0]); + break; case 'j': - sanim->set_value(row, scale[1]); - break; + sanim->set_value(row, scale[1]); + break; case 'k': - sanim->set_value(row, scale[2]); - break; + sanim->set_value(row, scale[2]); + break; case 'h': - sanim->set_value(row, hpr[0]); - break; + sanim->set_value(row, hpr[0]); + break; case 'p': - sanim->set_value(row, hpr[1]); - break; + sanim->set_value(row, hpr[1]); + break; case 'r': - sanim->set_value(row, hpr[2]); - break; + sanim->set_value(row, hpr[2]); + break; case 'x': - sanim->set_value(row, translate[0]); - break; + sanim->set_value(row, translate[0]); + break; case 'y': - sanim->set_value(row, translate[1]); - break; + sanim->set_value(row, translate[1]); + break; case 'z': - sanim->set_value(row, translate[2]); - break; + sanim->set_value(row, translate[2]); + break; default: - // One of the child tables had an invalid name. - nassertr(false, false); + // One of the child tables had an invalid name. + nassertr(false, false); } } } @@ -509,9 +509,9 @@ add_data(const LMatrix4d &mat) { // Each table must have the same length. if (table_length < 0) { - table_length = sanim->get_num_rows(); + table_length = sanim->get_num_rows(); } else { - nassertr(sanim->get_num_rows() == table_length, false); + nassertr(sanim->get_num_rows() == table_length, false); } #endif @@ -520,44 +520,44 @@ add_data(const LMatrix4d &mat) { switch (sanim->get_name()[0]) { case 'i': - sanim->add_data(scale[0]); - break; + sanim->add_data(scale[0]); + break; case 'j': - sanim->add_data(scale[1]); - break; + sanim->add_data(scale[1]); + break; case 'k': - sanim->add_data(scale[2]); - break; + sanim->add_data(scale[2]); + break; case 'h': - sanim->add_data(hpr[0]); - break; + sanim->add_data(hpr[0]); + break; case 'p': - sanim->add_data(hpr[1]); - break; + sanim->add_data(hpr[1]); + break; case 'r': - sanim->add_data(hpr[2]); - break; + sanim->add_data(hpr[2]); + break; case 'x': - sanim->add_data(translate[0]); - break; + sanim->add_data(translate[0]); + break; case 'y': - sanim->add_data(translate[1]); - break; + sanim->add_data(translate[1]); + break; case 'z': - sanim->add_data(translate[2]); - break; + sanim->add_data(translate[2]); + break; default: - // One of the child tables had an invalid name. - nassertr(false, false); + // One of the child tables had an invalid name. + nassertr(false, false); } } } @@ -576,7 +576,7 @@ add_data(const LMatrix4d &mat) { //////////////////////////////////////////////////////////////////// void EggXfmSAnim:: r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs) { + CoordinateSystem to_cs) { // We need to build an inverse matrix that doesn't reflect the // translation component. LMatrix4d inv1 = inv; @@ -685,11 +685,11 @@ normalize_by_expanding() { num_tables++; if (sanim->get_num_rows() > 1) { - if (table_length == 1) { - table_length = sanim->get_num_rows(); - } else { - nassertv(sanim->get_num_rows() == table_length); - } + if (table_length == 1) { + table_length = sanim->get_num_rows(); + } else { + nassertv(sanim->get_num_rows() == table_length); + } } } } @@ -698,22 +698,22 @@ normalize_by_expanding() { // Create new, default, children for each table we lack. for (size_t p = 0; p < remaining_tables.length(); p++) { if (remaining_tables[p] != ' ') { - double default_value; - switch (remaining_tables[p]) { - case 'i': - case 'j': - case 'k': - default_value = 1.0; - break; - - default: - default_value = 0.0; - } - - string name(1, remaining_tables[p]); - EggSAnimData *sanim = new EggSAnimData(name); - add_child(sanim); - sanim->add_data(default_value); + double default_value; + switch (remaining_tables[p]) { + case 'i': + case 'j': + case 'k': + default_value = 1.0; + break; + + default: + default_value = 0.0; + } + + string name(1, remaining_tables[p]); + EggSAnimData *sanim = new EggSAnimData(name); + add_child(sanim); + sanim->add_data(default_value); } } } @@ -723,10 +723,10 @@ normalize_by_expanding() { if ((*ci)->is_of_type(EggSAnimData::get_class_type())) { EggSAnimData *sanim = DCAST(EggSAnimData, *ci); if (sanim->get_num_rows() == 1) { - double value = sanim->get_value(0); - for (int i = 1; i < table_length; i++) { - sanim->add_data(value); - } + double value = sanim->get_value(0); + for (int i = 1; i < table_length; i++) { + sanim->add_data(value); + } } nassertv(sanim->get_num_rows() == table_length); } diff --git a/panda/src/egg/eggXfmSAnim.h b/panda/src/egg/eggXfmSAnim.h index a5fa1cc29c..082dc7227e 100644 --- a/panda/src/egg/eggXfmSAnim.h +++ b/panda/src/egg/eggXfmSAnim.h @@ -14,7 +14,7 @@ class EggXfmAnimData; //////////////////////////////////////////////////////////////////// -// Class : EggXfmSAnim +// Class : EggXfmSAnim // Description : This corresponds to an entry, which is // a collection of up to nine entries that // specify the nine components of a transformation. @@ -24,7 +24,7 @@ class EggXfmAnimData; class EXPCL_PANDAEGG EggXfmSAnim : public EggGroupNode { public: INLINE EggXfmSAnim(const string &name = "", - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); EggXfmSAnim(const EggXfmAnimData &convert_from); INLINE EggXfmSAnim(const EggXfmSAnim ©); @@ -57,15 +57,15 @@ public: virtual void write(ostream &out, int indent_level) const; static void compose_with_order(LMatrix4d &mat, - const LVecBase3d &scale, - const LVecBase3d &hpr, - const LVecBase3d &trans, - const string &order, - CoordinateSystem cs); + const LVecBase3d &scale, + const LVecBase3d &hpr, + const LVecBase3d &trans, + const string &order, + CoordinateSystem cs); protected: virtual void r_transform(const LMatrix4d &mat, const LMatrix4d &inv, - CoordinateSystem to_cs); + CoordinateSystem to_cs); virtual void r_mark_coordsys(CoordinateSystem cs); private: diff --git a/panda/src/egg/lexer.lxx b/panda/src/egg/lexer.lxx index 5349af76ba..f547cdaafd 100644 --- a/panda/src/egg/lexer.lxx +++ b/panda/src/egg/lexer.lxx @@ -178,7 +178,7 @@ input_chars(char *buffer, int &result, int max_size) { // Truncate it at the newline. char *end = strchr(current_line, '\n'); if (end != NULL) { - *end = '\0'; + *end = '\0'; } } @@ -258,8 +258,8 @@ eat_c_comment() { if (last_c == '/' && c == '*') { ostringstream errmsg; errmsg << "This comment contains a nested /* symbol at line " - << line << ", column " << col-1 << "--possibly unclosed?" - << ends; + << line << ", column " << col-1 << "--possibly unclosed?" + << ends; eggyywarning(errmsg); } last_c = c; diff --git a/panda/src/egg/parser.yxx b/panda/src/egg/parser.yxx index f6a7627e26..4bbf2b22d7 100644 --- a/panda/src/egg/parser.yxx +++ b/panda/src/egg/parser.yxx @@ -87,7 +87,7 @@ static LMatrix3d matrix_2d; void egg_init_parser(istream &in, const string &filename, - EggObject *tos, EggGroupNode *top_node) { + EggObject *tos, EggGroupNode *top_node) { egg_init_lexer(in, filename); egg_stack.clear(); @@ -177,11 +177,11 @@ egg_cleanup_parser() { grammar: - START_EGG egg - | START_GROUP_BODY group_body - | START_TEXTURE_BODY texture_body - | START_PRIMITIVE_BODY primitive_body - ; + START_EGG egg + | START_GROUP_BODY group_body + | START_TEXTURE_BODY texture_body + | START_PRIMITIVE_BODY primitive_body + ; /* * egg @@ -191,12 +191,12 @@ grammar: * */ egg: - empty - | egg node + empty + | egg node { DCAST(EggData, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - ; + ; /* @@ -207,21 +207,21 @@ egg: * */ node: - coordsystem - | comment - | texture - | material - | external_reference - | vertex_pool - | group - | joint - | instance - | polygon - | point_light - | nurbs_surface - | nurbs_curve - | table - ; + coordsystem + | comment + | texture + | material + | external_reference + | vertex_pool + | group + | joint + | instance + | polygon + | point_light + | nurbs_surface + | nurbs_curve + | table + ; /* * coordsystem @@ -231,7 +231,7 @@ node: * */ coordsystem: - COORDSYSTEM '{' required_string '}' + COORDSYSTEM '{' required_string '}' { string strval = $3; EggCoordinateSystem *cs = new EggCoordinateSystem; @@ -244,7 +244,7 @@ coordsystem: } $$ = cs; } - ; + ; /* * comment @@ -254,11 +254,11 @@ coordsystem: * */ comment: - COMMENT optional_name '{' repeated_string '}' + COMMENT optional_name '{' repeated_string '}' { $$ = new EggComment($2, $4); } - ; + ; /* * texture @@ -268,7 +268,7 @@ comment: * */ texture: - TEXTURE required_name '{' required_string + TEXTURE required_name '{' required_string { string tref_name = $2; Filename filename = $4; @@ -281,12 +281,12 @@ texture: egg_stack.push_back(texture); } - texture_body '}' + texture_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * texture_body @@ -296,8 +296,8 @@ texture: * */ texture_body: - empty - | texture_body SCALAR required_name '{' real_or_string '}' + empty + | texture_body SCALAR required_name '{' real_or_string '}' { EggTexture *texture = DCAST(EggTexture, egg_stack.back()); string name = $3; @@ -418,8 +418,8 @@ texture_body: eggyywarning("Unsupported texture scalar: " + name); } } - | texture_body transform_2d - ; + | texture_body transform_2d + ; /* * material @@ -429,7 +429,7 @@ texture_body: * */ material: - MATERIAL required_name '{' + MATERIAL required_name '{' { string mref_name = $2; EggMaterial *material = new EggMaterial(mref_name); @@ -441,12 +441,12 @@ material: egg_stack.push_back(material); } - material_body '}' + material_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * material_body @@ -456,8 +456,8 @@ material: * */ material_body: - empty - | material_body SCALAR required_name '{' real_or_string '}' + empty + | material_body SCALAR required_name '{' real_or_string '}' { EggMaterial *material = DCAST(EggMaterial, egg_stack.back()); string name = $3; @@ -541,7 +541,7 @@ material_body: eggyywarning("Unsupported material scalar: " + name); } } - ; + ; /* @@ -552,14 +552,14 @@ material_body: * */ external_reference: - EXTERNAL_FILE optional_name '{' required_string '}' + EXTERNAL_FILE optional_name '{' required_string '}' { string node_name = $2; Filename filename = $4; EggExternalReference *ref = new EggExternalReference(node_name, filename); $$ = ref; } - | string EXTERNAL_FILE optional_name '{' required_string '}' + | string EXTERNAL_FILE optional_name '{' required_string '}' { if (cmp_nocase_uh($1, "group") != 0) { eggyyerror("keyword 'group' expected"); @@ -569,7 +569,7 @@ external_reference: EggExternalReference *ref = new EggExternalReference(node_name, filename); $$ = ref; } - ; + ; /* * vertex_pool @@ -579,7 +579,7 @@ external_reference: * */ vertex_pool: - VERTEXPOOL required_name + VERTEXPOOL required_name { string name = $2; EggVertexPool *pool = new EggVertexPool(name); @@ -591,12 +591,12 @@ vertex_pool: egg_stack.push_back(pool); } - '{' vertex_pool_body '}' + '{' vertex_pool_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -607,9 +607,9 @@ vertex_pool: * */ vertex_pool_body: - empty - | vertex_pool_body vertex - ; + empty + | vertex_pool_body vertex + ; /* * vertex @@ -619,18 +619,18 @@ vertex_pool_body: * */ vertex: - VERTEX + VERTEX { egg_stack.push_back(new EggVertex); } - '{' vertex_body '}' + '{' vertex_body '}' { PT(EggVertex) vtx = DCAST(EggVertex, egg_stack.back()); egg_stack.pop_back(); DCAST(EggVertexPool, egg_stack.back())->add_vertex(vtx); } - | VERTEX integer + | VERTEX integer { vertex_index = (int)$2; EggVertexPool *pool = DCAST(EggVertexPool, egg_stack.back()); @@ -638,14 +638,14 @@ vertex: if (vertex_index < 0) { ostringstream errmsg; errmsg << "Ignoring invalid vertex index " << vertex_index - << " in vertex pool " << pool->get_name() << ends; + << " in vertex pool " << pool->get_name() << ends; eggyywarning(errmsg); vertex_index = -1; } else if (pool->get_vertex(vertex_index) != NULL) { ostringstream errmsg; errmsg << "Ignoring duplicate vertex index " << vertex_index - << " in vertex pool " << pool->get_name() << ends; + << " in vertex pool " << pool->get_name() << ends; eggyywarning(errmsg); vertex_index = -1; } @@ -655,7 +655,7 @@ vertex: egg_stack.push_back(new EggVertex); } - '{' vertex_body '}' + '{' vertex_body '}' { PT(EggVertex) vtx = DCAST(EggVertex, egg_stack.back()); egg_stack.pop_back(); @@ -665,7 +665,7 @@ vertex: pool->add_vertex(vtx, vertex_index); } } - ; + ; /* @@ -676,26 +676,26 @@ vertex: * */ vertex_body: - real + real { DCAST(EggVertex, egg_stack.back())->set_pos($1); } - | real real + | real real { DCAST(EggVertex, egg_stack.back())->set_pos(LPoint2d($1, $2)); } - | real real real + | real real real { DCAST(EggVertex, egg_stack.back())->set_pos(LPoint3d($1, $2, $3)); } - | real real real real + | real real real real { DCAST(EggVertex, egg_stack.back())->set_pos(LPoint4d($1, $2, $3, $4)); } - | vertex_body UV '{' vertex_uv_body '}' - | vertex_body NORMAL '{' vertex_normal_body '}' - | vertex_body RGBA '{' vertex_color_body '}' - | vertex_body DXYZ string '{' real real real '}' + | vertex_body UV '{' vertex_uv_body '}' + | vertex_body NORMAL '{' vertex_normal_body '}' + | vertex_body RGBA '{' vertex_color_body '}' + | vertex_body DXYZ string '{' real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_dxyzs. insert(EggMorphVertex($3, LVector3d($5, $6, $7))).second; @@ -703,7 +703,7 @@ vertex_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | vertex_body DXYZ '{' string real real real '}' + | vertex_body DXYZ '{' string real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_dxyzs. insert(EggMorphVertex($4, LVector3d($5, $6, $7))).second; @@ -711,7 +711,7 @@ vertex_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* @@ -722,11 +722,11 @@ vertex_body: * */ vertex_uv_body: - real real + real real { DCAST(EggVertex, egg_stack.back())->set_uv(TexCoordd($1, $2)); } - | vertex_uv_body DUV string '{' real real '}' + | vertex_uv_body DUV string '{' real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_duvs. insert(EggMorphTexCoord($3, LVector2d($5, $6))).second; @@ -734,7 +734,7 @@ vertex_uv_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | vertex_uv_body DUV '{' string real real '}' + | vertex_uv_body DUV '{' string real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_duvs. insert(EggMorphTexCoord($4, LVector2d($5, $6))).second; @@ -742,7 +742,7 @@ vertex_uv_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* * vertex_normal_body @@ -752,11 +752,11 @@ vertex_uv_body: * */ vertex_normal_body: - real real real + real real real { DCAST(EggVertex, egg_stack.back())->set_normal(Normald($1, $2, $3)); } - | vertex_normal_body DNORMAL string '{' real real real '}' + | vertex_normal_body DNORMAL string '{' real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_dnormals. insert(EggMorphNormal($3, LVector3d($5, $6, $7))).second; @@ -764,7 +764,7 @@ vertex_normal_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | vertex_normal_body DNORMAL '{' string real real real '}' + | vertex_normal_body DNORMAL '{' string real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_dnormals. insert(EggMorphNormal($4, LVector3d($5, $6, $7))).second; @@ -772,7 +772,7 @@ vertex_normal_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* * vertex_color_body @@ -782,11 +782,11 @@ vertex_normal_body: * */ vertex_color_body: - real real real real + real real real real { DCAST(EggVertex, egg_stack.back())->set_color(Colorf($1, $2, $3, $4)); } - | vertex_color_body DRGBA string '{' real real real real '}' + | vertex_color_body DRGBA string '{' real real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_drgbas. insert(EggMorphColor($3, LVector4f($5, $6, $7, $8))).second; @@ -794,7 +794,7 @@ vertex_color_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | vertex_color_body DRGBA '{' string real real real real '}' + | vertex_color_body DRGBA '{' string real real real real '}' { bool inserted = DCAST(EggVertex, egg_stack.back())->_drgbas. insert(EggMorphColor($4, LVector4f($5, $6, $7, $8))).second; @@ -802,7 +802,7 @@ vertex_color_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* * group @@ -812,17 +812,17 @@ vertex_color_body: * */ group: - GROUP optional_name + GROUP optional_name { EggGroup *group = new EggGroup($2); egg_stack.push_back(group); } - '{' group_body '}' + '{' group_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * joint @@ -832,18 +832,18 @@ group: * */ joint: - JOINT optional_name + JOINT optional_name { EggGroup *group = new EggGroup($2); group->set_group_type(EggGroup::GT_joint); egg_stack.push_back(group); } - '{' group_body '}' + '{' group_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * instance @@ -853,18 +853,18 @@ joint: * */ instance: - INSTANCE optional_name + INSTANCE optional_name { EggGroup *group = new EggGroup($2); group->set_group_type(EggGroup::GT_instance); egg_stack.push_back(group); } - '{' group_body '}' + '{' group_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * group_body @@ -874,8 +874,8 @@ instance: * */ group_body: - empty - | group_body SCALAR required_name '{' real_or_string '}' + empty + | group_body SCALAR required_name '{' real_or_string '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string name = $3; @@ -928,7 +928,7 @@ group_body: eggyywarning("Unknown group scalar " + name); } } - | group_body BILLBOARD '{' string '}' + | group_body BILLBOARD '{' string '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string strval = $4; @@ -940,32 +940,32 @@ group_body: group->set_billboard_type(f); } } - | group_body BILLBOARDCENTER '{' real real real '}' + | group_body BILLBOARDCENTER '{' real real real '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); group->set_billboard_center(LPoint3d($4, $5, $6)); } - | group_body COLLIDE optional_name '{' cs_type collide_flags '}' + | group_body COLLIDE optional_name '{' cs_type collide_flags '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string name = $3; group->set_collision_name(name); } - | group_body DCS '{' integer '}' + | group_body DCS '{' integer '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); int value = (int)$4; group->set_dcs_flag(value!=0); } - | group_body DART '{' integer '}' + | group_body DART '{' integer '}' { // The traditional flavor of DART, with { 0 } or { 1 }. EggGroup *group = DCAST(EggGroup, egg_stack.back()); int value = (int)$4; group->set_dart_type(value!=0 ? EggGroup::DT_default : EggGroup::DT_none); } - | group_body DART '{' STRING '}' + | group_body DART '{' STRING '}' { // The special flavor of DART, with { sync } or { nosync }. EggGroup *group = DCAST(EggGroup, egg_stack.back()); @@ -978,38 +978,38 @@ group_body: group->set_dart_type(f); } } - | group_body SWITCH '{' integer '}' + | group_body SWITCH '{' integer '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); int value = (int)$4; group->set_switch_flag(value!=0); } - | group_body OBJECTTYPE '{' required_string '}' + | group_body OBJECTTYPE '{' required_string '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string type = $4; group->set_objecttype(type); } - | group_body MODEL '{' integer '}' + | group_body MODEL '{' integer '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); int value = (int)$4; group->set_model_flag(value!=0); } - | group_body TEXLIST '{' integer '}' + | group_body TEXLIST '{' integer '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); int value = (int)$4; group->set_texlist_flag(value!=0); } - | group_body transform_3d - | group_body group_vertex_ref - | group_body switchcondition - | group_body node + | group_body transform_3d + | group_body group_vertex_ref + | group_body switchcondition + | group_body node { DCAST(EggGroup, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - ; + ; /* * cs_type @@ -1019,7 +1019,7 @@ group_body: * */ cs_type: - string + string { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string strval = $1; @@ -1031,7 +1031,7 @@ cs_type: group->set_cs_type(f); } } - ; + ; /* * collide_flags @@ -1041,8 +1041,8 @@ cs_type: * */ collide_flags: - empty - | collide_flags string + empty + | collide_flags string { EggGroup *group = DCAST(EggGroup, egg_stack.back()); string strval = $2; @@ -1054,7 +1054,7 @@ collide_flags: group->set_collide_flags(group->get_collide_flags() | f); } } - ; + ; /* * transform_3d @@ -1064,15 +1064,15 @@ collide_flags: * */ transform_3d: - TRANSFORM + TRANSFORM { matrix_3d = LMatrix4d::ident_mat(); } - '{' transform_3d_body '}' + '{' transform_3d_body '}' { DCAST(EggGroup, egg_stack.back())->set_transform(matrix_3d); } - ; + ; /* @@ -1083,85 +1083,85 @@ transform_3d: * */ transform_3d_body: - empty - | transform_3d_body matrix3_3d - | transform_3d_body matrix4_3d - | transform_3d_body translate_3d - | transform_3d_body rotx_3d - | transform_3d_body roty_3d - | transform_3d_body rotz_3d - | transform_3d_body rotate_3d - | transform_3d_body scale_3d - ; + empty + | transform_3d_body matrix3_3d + | transform_3d_body matrix4_3d + | transform_3d_body translate_3d + | transform_3d_body rotx_3d + | transform_3d_body roty_3d + | transform_3d_body rotz_3d + | transform_3d_body rotate_3d + | transform_3d_body scale_3d + ; translate_3d: TRANSLATE '{' real real real '}' { matrix_3d *= LMatrix4d::translate_mat($3, $4, $5); } - ; + ; rotx_3d: ROTX '{' real '}' { matrix_3d *= LMatrix4d::rotate_mat_normaxis($3, LVector3d(1.0, 0.0, 0.0)); } - ; + ; roty_3d: ROTY '{' real '}' { matrix_3d *= LMatrix4d::rotate_mat_normaxis($3, LVector3d(0.0, 1.0, 0.0)); } - ; + ; rotz_3d: ROTZ '{' real '}' { matrix_3d *= LMatrix4d::rotate_mat_normaxis($3, LVector3d(0.0, 0.0, 1.0)); } - ; + ; rotate_3d: ROTATE '{' real real real real '}' { matrix_3d *= LMatrix4d::rotate_mat($3, LVector3d($4, $5, $6)); } - ; + ; scale_3d: SCALE '{' real real real '}' { matrix_3d *= LMatrix4d::scale_mat($3, $4, $5); } - ; + ; matrix4_3d: - MATRIX4 '{' matrix4_3d_body '}' - ; + MATRIX4 '{' matrix4_3d_body '}' + ; matrix4_3d_body: - empty - | real real real real - real real real real - real real real real - real real real real + empty + | real real real real + real real real real + real real real real + real real real real { matrix_3d *= LMatrix4d($1, $2, $3, $4, - $5, $6, $7, $8, - $9, $10, $11, $12, - $13, $14, $15, $16); + $5, $6, $7, $8, + $9, $10, $11, $12, + $13, $14, $15, $16); } - ; + ; matrix3_3d: MATRIX3 '{' matrix3_3d_body '}' - ; + ; matrix3_3d_body: - empty - | real real real - real real real - real real real + empty + | real real real + real real real + real real real { matrix_3d *= LMatrix4d(LMatrix3d($1, $2, $3, - $4, $5, $6, - $7, $8, $9)); + $4, $5, $6, + $7, $8, $9)); } - ; + ; /* @@ -1172,15 +1172,15 @@ matrix3_3d_body: * */ transform_2d: - TRANSFORM + TRANSFORM { matrix_2d = LMatrix3d::ident_mat(); } - '{' transform_2d_body '}' + '{' transform_2d_body '}' { DCAST(EggTexture, egg_stack.back())->set_transform(matrix_2d); } - ; + ; /* @@ -1191,45 +1191,45 @@ transform_2d: * */ transform_2d_body: - empty - | transform_2d_body matrix3_2d - | transform_2d_body translate_2d - | transform_2d_body rotate_2d - | transform_2d_body scale_2d - ; + empty + | transform_2d_body matrix3_2d + | transform_2d_body translate_2d + | transform_2d_body rotate_2d + | transform_2d_body scale_2d + ; translate_2d: TRANSLATE '{' real real '}' { matrix_2d *= LMatrix3d::translate_mat($3, $4); } - ; + ; rotate_2d: ROTATE '{' real '}' { matrix_2d *= LMatrix3d::rotate_mat($3); } - ; + ; scale_2d: SCALE '{' real real '}' { matrix_2d *= LMatrix3d::scale_mat($3, $4); } - ; + ; matrix3_2d: MATRIX3 '{' matrix3_2d_body '}' - ; + ; matrix3_2d_body: - empty - | real real real - real real real - real real real + empty + | real real real + real real real + real real real { matrix_2d *= LMatrix3d($1, $2, $3, - $4, $5, $6, - $7, $8, $9); + $4, $5, $6, + $7, $8, $9); } - ; + ; /* @@ -1240,7 +1240,7 @@ matrix3_2d_body: * */ group_vertex_ref: - VERTEXREF '{' integer_list group_vertex_membership REF '{' vertex_pool_name '}' '}' + VERTEXREF '{' integer_list group_vertex_membership REF '{' vertex_pool_name '}' '}' { if ($7 != (EggVertexPool *)NULL) { EggVertexPool *pool = DCAST(EggVertexPool, $7); @@ -1252,17 +1252,17 @@ group_vertex_ref: int index = (int)nums[i]; EggVertex *vertex = pool->get_vertex(index); if (vertex == NULL) { - ostringstream errmsg; - errmsg << "No vertex " << index << " in pool " << pool->get_name() - << ends; - eggyyerror(errmsg); + ostringstream errmsg; + errmsg << "No vertex " << index << " in pool " << pool->get_name() + << ends; + eggyyerror(errmsg); } else { - group->ref_vertex(vertex, membership); + group->ref_vertex(vertex, membership); } } } } - ; + ; /* @@ -1273,11 +1273,11 @@ group_vertex_ref: * */ group_vertex_membership: - empty + empty { $$ = 1.0; } - | group_vertex_membership SCALAR required_name '{' real_or_string '}' + | group_vertex_membership SCALAR required_name '{' real_or_string '}' { string name = $3; double value = $<_number>5; @@ -1291,7 +1291,7 @@ group_vertex_membership: $$ = result; } - ; + ; /* @@ -1302,8 +1302,8 @@ group_vertex_membership: * */ switchcondition: - SWITCHCONDITION '{' switchcondition_body '}' - ; + SWITCHCONDITION '{' switchcondition_body '}' + ; /* @@ -1314,17 +1314,17 @@ switchcondition: * */ switchcondition_body: - DISTANCE '{' real real VERTEX '{' real real real '}' '}' + DISTANCE '{' real real VERTEX '{' real real real '}' '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); group->set_lod(EggSwitchConditionDistance($3, $4, LPoint3d($7, $8, $9))); } - | DISTANCE '{' real real real VERTEX '{' real real real '}' '}' + | DISTANCE '{' real real real VERTEX '{' real real real '}' '}' { EggGroup *group = DCAST(EggGroup, egg_stack.back()); group->set_lod(EggSwitchConditionDistance($3, $4, LPoint3d($8, $9, $10), $5)); } - ; + ; @@ -1336,16 +1336,16 @@ switchcondition_body: * */ polygon: - POLYGON optional_name + POLYGON optional_name { egg_stack.push_back(new EggPolygon($2)); } - '{' primitive_body '}' + '{' primitive_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * point_light @@ -1355,16 +1355,16 @@ polygon: * */ point_light: - POINTLIGHT optional_name + POINTLIGHT optional_name { egg_stack.push_back(new EggPoint($2)); } - '{' primitive_body '}' + '{' primitive_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * nurbs_surface @@ -1374,16 +1374,16 @@ point_light: * */ nurbs_surface: - NURBSSURFACE optional_name + NURBSSURFACE optional_name { egg_stack.push_back(new EggNurbsSurface($2)); } - '{' nurbs_surface_body '}' + '{' nurbs_surface_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* * nurbs_curve @@ -1393,16 +1393,16 @@ nurbs_surface: * */ nurbs_curve: - NURBSCURVE optional_name + NURBSCURVE optional_name { egg_stack.push_back(new EggNurbsCurve($2)); } - '{' nurbs_curve_body '}' + '{' nurbs_curve_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -1413,15 +1413,15 @@ nurbs_curve: * */ primitive_body: - empty - | primitive_body TREF '{' primitive_tref_body '}' - | primitive_body TEXTURE '{' primitive_texture_body '}' - | primitive_body MREF '{' primitive_material_body '}' - | primitive_body primitive_vertex_ref - | primitive_body NORMAL '{' primitive_normal_body '}' - | primitive_body RGBA '{' primitive_color_body '}' - | primitive_body BFACE '{' primitive_bface_body '}' - | primitive_body SCALAR required_name '{' real_or_string '}' + empty + | primitive_body TREF '{' primitive_tref_body '}' + | primitive_body TEXTURE '{' primitive_texture_body '}' + | primitive_body MREF '{' primitive_material_body '}' + | primitive_body primitive_vertex_ref + | primitive_body NORMAL '{' primitive_normal_body '}' + | primitive_body RGBA '{' primitive_color_body '}' + | primitive_body BFACE '{' primitive_bface_body '}' + | primitive_body SCALAR required_name '{' real_or_string '}' { EggPrimitive *primitive = DCAST(EggPrimitive, egg_stack.back()); string name = $3; @@ -1460,7 +1460,7 @@ primitive_body: eggyywarning("Unknown scalar " + name); } } - ; + ; /* * nurbs_surface_body @@ -1470,25 +1470,25 @@ primitive_body: * */ nurbs_surface_body: - empty - | nurbs_surface_body TREF '{' primitive_tref_body '}' - | nurbs_surface_body TEXTURE '{' primitive_texture_body '}' - | nurbs_surface_body MREF '{' primitive_material_body '}' - | nurbs_surface_body primitive_vertex_ref - | nurbs_surface_body NORMAL '{' primitive_normal_body '}' - | nurbs_surface_body RGBA '{' primitive_color_body '}' - | nurbs_surface_body BFACE '{' primitive_bface_body '}' - | nurbs_surface_body ORDER '{' nurbs_surface_order_body '}' - | nurbs_surface_body UKNOTS '{' nurbs_surface_uknots_body '}' - | nurbs_surface_body VKNOTS '{' nurbs_surface_vknots_body '}' - | nurbs_surface_body nurbs_curve + empty + | nurbs_surface_body TREF '{' primitive_tref_body '}' + | nurbs_surface_body TEXTURE '{' primitive_texture_body '}' + | nurbs_surface_body MREF '{' primitive_material_body '}' + | nurbs_surface_body primitive_vertex_ref + | nurbs_surface_body NORMAL '{' primitive_normal_body '}' + | nurbs_surface_body RGBA '{' primitive_color_body '}' + | nurbs_surface_body BFACE '{' primitive_bface_body '}' + | nurbs_surface_body ORDER '{' nurbs_surface_order_body '}' + | nurbs_surface_body UKNOTS '{' nurbs_surface_uknots_body '}' + | nurbs_surface_body VKNOTS '{' nurbs_surface_vknots_body '}' + | nurbs_surface_body nurbs_curve { EggNurbsCurve *curve = DCAST(EggNurbsCurve, $2); EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); nurbs->_curves_on_surface.push_back(curve); } - | nurbs_surface_body TRIM '{' nurbs_surface_trim_body '}' - | nurbs_surface_body SCALAR required_name '{' real_or_string '}' + | nurbs_surface_body TRIM '{' nurbs_surface_trim_body '}' + | nurbs_surface_body SCALAR required_name '{' real_or_string '}' { EggNurbsSurface *primitive = DCAST(EggNurbsSurface, egg_stack.back()); string name = $3; @@ -1531,7 +1531,7 @@ nurbs_surface_body: eggyywarning("Unknown scalar " + name); } } - ; + ; /* @@ -1542,17 +1542,17 @@ nurbs_surface_body: * */ nurbs_curve_body: - empty - | nurbs_curve_body TREF '{' primitive_tref_body '}' - | nurbs_curve_body TEXTURE '{' primitive_texture_body '}' - | nurbs_curve_body MREF '{' primitive_material_body '}' - | nurbs_curve_body primitive_vertex_ref - | nurbs_curve_body NORMAL '{' primitive_normal_body '}' - | nurbs_curve_body RGBA '{' primitive_color_body '}' - | nurbs_curve_body BFACE '{' primitive_bface_body '}' - | nurbs_curve_body ORDER '{' nurbs_curve_order_body '}' - | nurbs_curve_body KNOTS '{' nurbs_curve_knots_body '}' - | nurbs_curve_body SCALAR required_name '{' real_or_string '}' + empty + | nurbs_curve_body TREF '{' primitive_tref_body '}' + | nurbs_curve_body TEXTURE '{' primitive_texture_body '}' + | nurbs_curve_body MREF '{' primitive_material_body '}' + | nurbs_curve_body primitive_vertex_ref + | nurbs_curve_body NORMAL '{' primitive_normal_body '}' + | nurbs_curve_body RGBA '{' primitive_color_body '}' + | nurbs_curve_body BFACE '{' primitive_bface_body '}' + | nurbs_curve_body ORDER '{' nurbs_curve_order_body '}' + | nurbs_curve_body KNOTS '{' nurbs_curve_knots_body '}' + | nurbs_curve_body SCALAR required_name '{' real_or_string '}' { EggNurbsCurve *primitive = DCAST(EggNurbsCurve, egg_stack.back()); string name = $3; @@ -1601,7 +1601,7 @@ nurbs_curve_body: eggyywarning("Unknown scalar " + name); } } - ; + ; /* * primitive_tref_body @@ -1611,14 +1611,14 @@ nurbs_curve_body: * */ primitive_tref_body: - texture_name + texture_name { if ($1 != (EggTexture *)NULL) { EggTexture *texture = DCAST(EggTexture, $1); DCAST(EggPrimitive, egg_stack.back())->set_texture(texture); } } - ; + ; /* * primitive_texture_body @@ -1628,7 +1628,7 @@ primitive_tref_body: * */ primitive_texture_body: - required_name + required_name { EggTexture *texture = NULL; @@ -1651,14 +1651,14 @@ primitive_texture_body: texture = (*vpi).second; if (filename != texture->get_filename()) { eggyywarning(string("Using previous path: ") + - texture->get_filename().get_fullpath()); + texture->get_filename().get_fullpath()); } } nassertr(texture != NULL, 0); DCAST(EggPrimitive, egg_stack.back())->set_texture(texture); } - ; + ; /* * primitive_material_body @@ -1668,14 +1668,14 @@ primitive_texture_body: * */ primitive_material_body: - material_name + material_name { if ($1 != (EggMaterial *)NULL) { EggMaterial *material = DCAST(EggMaterial, $1); DCAST(EggPrimitive, egg_stack.back())->set_material(material); } } - ; + ; /* * primitive_normal_body @@ -1685,11 +1685,11 @@ primitive_material_body: * */ primitive_normal_body: - real real real + real real real { DCAST(EggPrimitive, egg_stack.back())->set_normal(Normald($1, $2, $3)); } - | primitive_normal_body DNORMAL string '{' real real real '}' + | primitive_normal_body DNORMAL string '{' real real real '}' { bool inserted = DCAST(EggPrimitive, egg_stack.back())->_dnormals. insert(EggMorphNormal($3, LVector3d($5, $6, $7))).second; @@ -1697,7 +1697,7 @@ primitive_normal_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | primitive_normal_body DNORMAL '{' string real real real '}' + | primitive_normal_body DNORMAL '{' string real real real '}' { bool inserted = DCAST(EggPrimitive, egg_stack.back())->_dnormals. insert(EggMorphNormal($4, LVector3d($5, $6, $7))).second; @@ -1705,7 +1705,7 @@ primitive_normal_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* * primitive_color_body @@ -1715,11 +1715,11 @@ primitive_normal_body: * */ primitive_color_body: - real real real real + real real real real { DCAST(EggPrimitive, egg_stack.back())->set_color(Colorf($1, $2, $3, $4)); } - | primitive_color_body DRGBA string '{' real real real real '}' + | primitive_color_body DRGBA string '{' real real real real '}' { bool inserted = DCAST(EggPrimitive, egg_stack.back())->_drgbas. insert(EggMorphColor($3, LVector4f($5, $6, $7, $8))).second; @@ -1727,7 +1727,7 @@ primitive_color_body: eggyywarning("Ignoring repeated morph name " + $3); } } - | primitive_color_body DRGBA '{' string real real real real '}' + | primitive_color_body DRGBA '{' string real real real real '}' { bool inserted = DCAST(EggPrimitive, egg_stack.back())->_drgbas. insert(EggMorphColor($4, LVector4f($5, $6, $7, $8))).second; @@ -1735,7 +1735,7 @@ primitive_color_body: eggyywarning("Ignoring repeated morph name " + $4); } } - ; + ; /* * primitive_bface_body @@ -1745,13 +1745,13 @@ primitive_color_body: * */ primitive_bface_body: - integer + integer { EggPrimitive *primitive = DCAST(EggPrimitive, egg_stack.back()); int value = (int)$1; primitive->set_bface_flag(value!=0); } - ; + ; /* * primitive_vertex_ref @@ -1761,7 +1761,7 @@ primitive_bface_body: * */ primitive_vertex_ref: - VERTEXREF '{' integer_list REF '{' vertex_pool_name '}' '}' + VERTEXREF '{' integer_list REF '{' vertex_pool_name '}' '}' { if ($6 != (EggVertexPool *)NULL) { EggVertexPool *pool = DCAST(EggVertexPool, $6); @@ -1772,17 +1772,17 @@ primitive_vertex_ref: int index = (int)nums[i]; EggVertex *vertex = pool->get_vertex(index); if (vertex == NULL) { - ostringstream errmsg; - errmsg << "No vertex " << index << " in pool " << pool->get_name() - << ends; - eggyyerror(errmsg); + ostringstream errmsg; + errmsg << "No vertex " << index << " in pool " << pool->get_name() + << ends; + eggyyerror(errmsg); } else { - prim->add_vertex(vertex); + prim->add_vertex(vertex); } } } } - ; + ; /* * nurbs_surface_order_body @@ -1792,7 +1792,7 @@ primitive_vertex_ref: * */ nurbs_surface_order_body: - integer integer + integer integer { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); int u_order = (int)$1; @@ -1800,7 +1800,7 @@ nurbs_surface_order_body: nurbs->set_u_order(u_order); nurbs->set_v_order(v_order); } - ; + ; /* * nurbs_surface_uknots_body @@ -1810,7 +1810,7 @@ nurbs_surface_order_body: * */ nurbs_surface_uknots_body: - real_list + real_list { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); PTA_double nums = $1; @@ -1820,7 +1820,7 @@ nurbs_surface_uknots_body: nurbs->set_u_knot(i, nums[i]); } } - ; + ; /* * nurbs_surface_vknots_body @@ -1830,7 +1830,7 @@ nurbs_surface_uknots_body: * */ nurbs_surface_vknots_body: - real_list + real_list { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); PTA_double nums = $1; @@ -1840,7 +1840,7 @@ nurbs_surface_vknots_body: nurbs->set_v_knot(i, nums[i]); } } - ; + ; /* * nurbs_surface_trim_body @@ -1850,13 +1850,13 @@ nurbs_surface_vknots_body: * */ nurbs_surface_trim_body: - empty + empty { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); nurbs->_trims.push_back(EggNurbsSurface::Trim()); } - | nurbs_surface_trim_body LOOP '{' nurbs_surface_trim_loop_body '}' - ; + | nurbs_surface_trim_body LOOP '{' nurbs_surface_trim_loop_body '}' + ; /* * nurbs_surface_trim_loop_body @@ -1866,13 +1866,13 @@ nurbs_surface_trim_body: * */ nurbs_surface_trim_loop_body: - empty + empty { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); nassertr(!nurbs->_trims.empty(), 0); nurbs->_trims.back().push_back(EggNurbsSurface::Loop()); } - | nurbs_surface_trim_loop_body nurbs_curve + | nurbs_surface_trim_loop_body nurbs_curve { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, egg_stack.back()); nassertr(!nurbs->_trims.empty(), 0); @@ -1880,7 +1880,7 @@ nurbs_surface_trim_loop_body: EggNurbsCurve *curve = DCAST(EggNurbsCurve, $2); nurbs->_trims.back().back().push_back(curve); } - ; + ; /* @@ -1891,13 +1891,13 @@ nurbs_surface_trim_loop_body: * */ nurbs_curve_order_body: - integer + integer { EggNurbsCurve *nurbs = DCAST(EggNurbsCurve, egg_stack.back()); int order = (int)$1; nurbs->set_order(order); } - ; + ; /* * nurbs_curve_knots_body @@ -1907,7 +1907,7 @@ nurbs_curve_order_body: * */ nurbs_curve_knots_body: - real_list + real_list { EggNurbsCurve *nurbs = DCAST(EggNurbsCurve, egg_stack.back()); PTA_double nums = $1; @@ -1917,7 +1917,7 @@ nurbs_curve_knots_body: nurbs->set_knot(i, nums[i]); } } - ; + ; /* @@ -1928,18 +1928,18 @@ nurbs_curve_knots_body: * */ table: - TABLE optional_name + TABLE optional_name { EggTable *table = new EggTable($2); table->set_table_type(EggTable::TT_table); egg_stack.push_back(table); } - '{' table_body '}' + '{' table_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -1950,18 +1950,18 @@ table: * */ bundle: - BUNDLE optional_name + BUNDLE optional_name { EggTable *table = new EggTable($2); table->set_table_type(EggTable::TT_bundle); egg_stack.push_back(table); } - '{' table_body '}' + '{' table_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -1972,28 +1972,28 @@ bundle: * */ table_body: - empty - | table_body table + empty + | table_body table { DCAST(EggTable, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - | table_body bundle + | table_body bundle { DCAST(EggTable, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - | table_body sanim + | table_body sanim { DCAST(EggTable, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - | table_body xfmanim + | table_body xfmanim { DCAST(EggTable, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - | table_body xfm_s_anim + | table_body xfm_s_anim { DCAST(EggTable, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - ; + ; /* @@ -2004,17 +2004,17 @@ table_body: * */ sanim: - SANIM optional_name + SANIM optional_name { EggSAnimData *anim_data = new EggSAnimData($2); egg_stack.push_back(anim_data); } - '{' sanim_body '}' + '{' sanim_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -2025,8 +2025,8 @@ sanim: * */ sanim_body: - empty - | sanim_body SCALAR required_name '{' real_or_string '}' + empty + | sanim_body SCALAR required_name '{' real_or_string '}' { EggSAnimData *anim_data = DCAST(EggSAnimData, egg_stack.back()); string name = $3; @@ -2038,11 +2038,11 @@ sanim_body: eggyywarning("Unsupported S$Anim scalar: " + name); } } - | sanim_body TABLE_V '{' real_list '}' + | sanim_body TABLE_V '{' real_list '}' { DCAST(EggSAnimData, egg_stack.back())->set_data($4); } - ; + ; /* * xfmanim @@ -2052,17 +2052,17 @@ sanim_body: * */ xfmanim: - XFMANIM optional_name + XFMANIM optional_name { EggXfmAnimData *anim_data = new EggXfmAnimData($2); egg_stack.push_back(anim_data); } - '{' xfmanim_body '}' + '{' xfmanim_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -2073,8 +2073,8 @@ xfmanim: * */ xfmanim_body: - empty - | xfmanim_body SCALAR required_name '{' real_or_string '}' + empty + | xfmanim_body SCALAR required_name '{' real_or_string '}' { EggXfmAnimData *anim_data = DCAST(EggXfmAnimData, egg_stack.back()); string name = $3; @@ -2091,11 +2091,11 @@ xfmanim_body: eggyywarning("Unsupported Xfm$Anim scalar: " + name); } } - | xfmanim_body TABLE_V '{' real_list '}' + | xfmanim_body TABLE_V '{' real_list '}' { DCAST(EggXfmAnimData, egg_stack.back())->set_data($4); } - ; + ; /* * xfm_s_anim @@ -2105,17 +2105,17 @@ xfmanim_body: * */ xfm_s_anim: - XFMSANIM optional_name + XFMSANIM optional_name { EggXfmSAnim *anim_group = new EggXfmSAnim($2); egg_stack.push_back(anim_group); } - '{' xfm_s_anim_body '}' + '{' xfm_s_anim_body '}' { $$ = egg_stack.back(); egg_stack.pop_back(); } - ; + ; /* @@ -2126,8 +2126,8 @@ xfm_s_anim: * */ xfm_s_anim_body: - empty - | xfm_s_anim_body SCALAR required_name '{' real_or_string '}' + empty + | xfm_s_anim_body SCALAR required_name '{' real_or_string '}' { EggXfmSAnim *anim_group = DCAST(EggXfmSAnim, egg_stack.back()); string name = $3; @@ -2142,11 +2142,11 @@ xfm_s_anim_body: eggyywarning("Unsupported Xfm$Anim_S$ scalar: " + name); } } - | xfm_s_anim_body sanim + | xfm_s_anim_body sanim { DCAST(EggXfmSAnim, egg_stack.back())->add_child(DCAST(EggNode, $2)); } - ; + ; /* @@ -2157,15 +2157,15 @@ xfm_s_anim_body: * */ integer_list: - empty + empty { $$ = PTA_double(0); } - | integer_list integer + | integer_list integer { $$.push_back((double)$2); } - ; + ; /* * real_list @@ -2175,15 +2175,15 @@ integer_list: * */ real_list: - empty + empty { $$ = PTA_double(0); } - | real_list real + | real_list real { $$.push_back($2); } - ; + ; /* * texture_name @@ -2193,7 +2193,7 @@ real_list: * */ texture_name: - required_name + required_name { string name = $1; Textures::iterator vpi = textures.find(name); @@ -2204,7 +2204,7 @@ texture_name: $$ = (*vpi).second; } } - ; + ; /* * material_name @@ -2214,7 +2214,7 @@ texture_name: * */ material_name: - required_name + required_name { string name = $1; Materials::iterator vpi = materials.find(name); @@ -2225,7 +2225,7 @@ material_name: $$ = (*vpi).second; } } - ; + ; /* * vertex_pool_name @@ -2235,7 +2235,7 @@ material_name: * */ vertex_pool_name: - required_name + required_name { string name = $1; VertexPools::iterator vpi = vertex_pools.find(name); @@ -2246,7 +2246,7 @@ vertex_pool_name: $$ = (*vpi).second; } } - ; + ; /* @@ -2257,13 +2257,13 @@ vertex_pool_name: * */ required_name: - empty + empty { eggyyerror("Name required."); $$ = ""; } - | string - ; + | string + ; /* @@ -2274,8 +2274,8 @@ required_name: * */ optional_name: - optional_string - ; + optional_string + ; /* @@ -2286,13 +2286,13 @@ optional_name: * */ required_string: - empty + empty { eggyyerror("String required."); $$ = ""; } - | string - ; + | string + ; /* * optional_string @@ -2302,12 +2302,12 @@ required_string: * */ optional_string: - empty + empty { $$ = ""; } - | string - ; + | string + ; /* * string @@ -2320,12 +2320,12 @@ optional_string: * */ string: - NUMBER + NUMBER { $$ = $<_string>1; } - | STRING - ; + | STRING + ; /* * repeated_string @@ -2337,15 +2337,15 @@ string: * */ repeated_string: - empty + empty { $$ = ""; } - | repeated_string_body + | repeated_string_body { $$ = $1; } - ; + ; /* * repeated_string_body @@ -2357,15 +2357,15 @@ repeated_string: * */ repeated_string_body: - string + string { $$ = $1; } - | repeated_string_body string + | repeated_string_body string { $$ = $1 + "\n" + $2; } - ; + ; /* * real @@ -2375,8 +2375,8 @@ repeated_string_body: * */ real: - NUMBER - ; + NUMBER + ; /* * real_or_string @@ -2386,17 +2386,17 @@ real: * */ real_or_string: - NUMBER + NUMBER { $<_number>$ = $1; $<_string>$ = $<_string>1; } - | STRING + | STRING { $<_number>$ = 0.0; $<_string>$ = $1; } - ; + ; /* @@ -2407,7 +2407,7 @@ real_or_string: * */ integer: - NUMBER + NUMBER { int i = (int)$1; if ((double)i != $1) { @@ -2415,7 +2415,7 @@ integer: $$ = (double)i; } } - ; + ; empty: - ; + ; diff --git a/panda/src/egg/parserDefs.h b/panda/src/egg/parserDefs.h index b4b8312afb..3a1da83658 100644 --- a/panda/src/egg/parserDefs.h +++ b/panda/src/egg/parserDefs.h @@ -19,7 +19,7 @@ class EggGroupNode; void egg_init_parser(istream &in, const string &filename, - EggObject *tos, EggGroupNode *egg_top_node); + EggObject *tos, EggGroupNode *egg_top_node); void egg_cleanup_parser(); diff --git a/panda/src/egg2sg/animBundleMaker.cxx b/panda/src/egg2sg/animBundleMaker.cxx index 81690edb7d..6b0076c8fc 100644 --- a/panda/src/egg2sg/animBundleMaker.cxx +++ b/panda/src/egg2sg/animBundleMaker.cxx @@ -97,11 +97,11 @@ inspect_tree(EggNode *egg_node) { EggAnimData *egg_anim = DCAST(EggAnimData, egg_node); if (egg_anim->has_fps()) { if (_fps == 0.0) { - _fps = egg_anim->get_fps(); + _fps = egg_anim->get_fps(); } else if (_fps != egg_anim->get_fps()) { - // Whoops! This table differs in opinion from the other tables. - _fps = min(_fps, (float)egg_anim->get_fps()); - _ok_fps = false; + // Whoops! This table differs in opinion from the other tables. + _fps = min(_fps, (float)egg_anim->get_fps()); + _ok_fps = false; } } } @@ -111,11 +111,11 @@ inspect_tree(EggNode *egg_node) { EggXfmSAnim *egg_anim = DCAST(EggXfmSAnim, egg_node); if (egg_anim->has_fps()) { if (_fps == 0.0) { - _fps = egg_anim->get_fps(); + _fps = egg_anim->get_fps(); } else if (_fps != egg_anim->get_fps()) { - // Whoops! This table differs in opinion from the other tables. - _fps = min(_fps, (float)egg_anim->get_fps()); - _ok_fps = false; + // Whoops! This table differs in opinion from the other tables. + _fps = min(_fps, (float)egg_anim->get_fps()); + _ok_fps = false; } } } @@ -127,11 +127,11 @@ inspect_tree(EggNode *egg_node) { if (num_frames > 1) { if (_num_frames == 1) { - _num_frames = num_frames; + _num_frames = num_frames; } else if (_num_frames != num_frames) { - // Whoops! Another disagreement. - _num_frames = min(_num_frames, num_frames); - _ok_num_frames = false; + // Whoops! Another disagreement. + _num_frames = min(_num_frames, num_frames); + _ok_num_frames = false; } } } @@ -143,11 +143,11 @@ inspect_tree(EggNode *egg_node) { if (num_frames > 1) { if (_num_frames == 1) { - _num_frames = num_frames; + _num_frames = num_frames; } else if (_num_frames != num_frames) { - // Whoops! Another disagreement. - _num_frames = min(_num_frames, num_frames); - _ok_num_frames = false; + // Whoops! Another disagreement. + _num_frames = min(_num_frames, num_frames); + _ok_num_frames = false; } } } @@ -181,11 +181,11 @@ build_hierarchy(EggTable *egg_table, AnimGroup *parent) { for (ci = egg_table->begin(); ci != egg_table->end(); ++ci) { if ((*ci)->get_name() == "xform") { if (this_node == NULL) { - this_node = create_xfm_channel((*ci), egg_table->get_name(), parent); + this_node = create_xfm_channel((*ci), egg_table->get_name(), parent); } else { - egg2sg_cat.warning() - << "Duplicate xform table under node " - << egg_table->get_name() << "\n"; + egg2sg_cat.warning() + << "Duplicate xform table under node " + << egg_table->get_name() << "\n"; } } } @@ -221,7 +221,7 @@ build_hierarchy(EggTable *egg_table, AnimGroup *parent) { //////////////////////////////////////////////////////////////////// AnimChannelScalarTable *AnimBundleMaker:: create_s_channel(EggSAnimData *egg_anim, const string &name, - AnimGroup *parent) { + AnimGroup *parent) { AnimChannelScalarTable *table = new AnimChannelScalarTable(parent, name); @@ -247,7 +247,7 @@ create_s_channel(EggSAnimData *egg_anim, const string &name, //////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable *AnimBundleMaker:: create_xfm_channel(EggNode *egg_node, const string &name, - AnimGroup *parent) { + AnimGroup *parent) { if (egg_node->is_of_type(EggXfmAnimData::get_class_type())) { EggXfmAnimData *egg_anim = DCAST(EggXfmAnimData, egg_node); EggXfmSAnim new_anim(*egg_anim); @@ -273,7 +273,7 @@ create_xfm_channel(EggNode *egg_node, const string &name, //////////////////////////////////////////////////////////////////// AnimChannelMatrixXfmTable *AnimBundleMaker:: create_xfm_channel(EggXfmSAnim *egg_anim, const string &name, - AnimGroup *parent) { + AnimGroup *parent) { // Ensure that the anim table is optimal and that it is standard // order. egg_anim->optimize_to_standard_order(); @@ -291,35 +291,35 @@ create_xfm_channel(EggXfmSAnim *egg_anim, const string &name, EggSAnimData *child = DCAST(EggSAnimData, *ci); if (child->get_name().empty()) { - egg2sg_cat.warning() - << "Unnamed subtable of " << name - << "\n"; + egg2sg_cat.warning() + << "Unnamed subtable of " << name + << "\n"; } else { - char table_id = child->get_name()[0]; + char table_id = child->get_name()[0]; - if (child->get_name().length() > 1 || - !table->is_valid_id(table_id)) { - egg2sg_cat.warning() - << "Unexpected table name " << child->get_name() - << ", child of " << name << "\n"; + if (child->get_name().length() > 1 || + !table->is_valid_id(table_id)) { + egg2sg_cat.warning() + << "Unexpected table name " << child->get_name() + << ", child of " << name << "\n"; - } else if (table->has_table(table_id)) { - egg2sg_cat.warning() - << "Duplicate table definition for " << table_id - << " under " << name << "\n"; + } else if (table->has_table(table_id)) { + egg2sg_cat.warning() + << "Duplicate table definition for " << table_id + << " under " << name << "\n"; - } else { - - // Now we have to copy the table data from PTA_double to - // PTA_float. - PTA_float new_data(child->get_num_rows()); - for (int i = 0; i < child->get_num_rows(); i++) { - new_data[i] = (float)child->get_value(i); - } - - // Now we can assign the table. - table->set_table(table_id, new_data); - } + } else { + + // Now we have to copy the table data from PTA_double to + // PTA_float. + PTA_float new_data(child->get_num_rows()); + for (int i = 0; i < child->get_num_rows(); i++) { + new_data[i] = (float)child->get_value(i); + } + + // Now we can assign the table. + table->set_table(table_id, new_data); + } } } } diff --git a/panda/src/egg2sg/animBundleMaker.h b/panda/src/egg2sg/animBundleMaker.h index 3877e10663..3e83281724 100644 --- a/panda/src/egg2sg/animBundleMaker.h +++ b/panda/src/egg2sg/animBundleMaker.h @@ -24,7 +24,7 @@ class AnimChannelScalarTable; class AnimChannelMatrixXfmTable; /////////////////////////////////////////////////////////////////// -// Class : AnimBundleMaker +// Class : AnimBundleMaker // Description : Converts an EggTable hierarchy, beginning with a // entry, into an AnimBundle hierarchy. //////////////////////////////////////////////////////////////////// @@ -42,13 +42,13 @@ private: AnimChannelScalarTable * create_s_channel(EggSAnimData *egg_anim, const string &name, - AnimGroup *parent); + AnimGroup *parent); AnimChannelMatrixXfmTable * create_xfm_channel(EggNode *egg_node, const string &name, - AnimGroup *parent); + AnimGroup *parent); AnimChannelMatrixXfmTable * create_xfm_channel(EggXfmSAnim *egg_anim, const string &name, - AnimGroup *parent); + AnimGroup *parent); float _fps; int _num_frames; diff --git a/panda/src/egg2sg/characterMaker.cxx b/panda/src/egg2sg/characterMaker.cxx index ef109b1f13..02ba91b1de 100644 --- a/panda/src/egg2sg/characterMaker.cxx +++ b/panda/src/egg2sg/characterMaker.cxx @@ -161,22 +161,22 @@ build_joint_hierarchy(EggNode *egg_node, PartGroup *part) { // it to single-precision. LMatrix4d matd; if (egg_group->has_transform()) { - matd = egg_group->get_transform(); + matd = egg_group->get_transform(); } else { - matd = LMatrix4d::ident_mat(); + matd = LMatrix4d::ident_mat(); } LMatrix4f matf = LCAST(float, matd); CharacterJoint *joint = - new CharacterJoint(part, egg_group->get_name(), matf); + new CharacterJoint(part, egg_group->get_name(), matf); index = _parts.size(); _parts.push_back(joint); if (egg_group->get_dcs_flag()) { - // If the joint requested an explicit DCS, create a node for - // it. - joint->_geom_node = new NamedNode(egg_group->get_name()); + // If the joint requested an explicit DCS, create a node for + // it. + joint->_geom_node = new NamedNode(egg_group->get_name()); } part = joint; @@ -228,14 +228,14 @@ make_geometry(EggNode *egg_node) { EggGroupNode *prim_home = determine_primitive_home(egg_primitive); if (prim_home == NULL) { - // This is a totally dynamic primitive that lives under the - // character's node. - make_dynamic_primitive(egg_primitive, _egg_root); + // This is a totally dynamic primitive that lives under the + // character's node. + make_dynamic_primitive(egg_primitive, _egg_root); } else { - // This is a static primitive that lives under a particular - // node. - make_static_primitive(egg_primitive, prim_home); + // This is a static primitive that lives under a particular + // node. + make_static_primitive(egg_primitive, prim_home); } } } @@ -282,7 +282,7 @@ make_dynamic_primitive(EggPrimitive *egg_primitive, EggGroupNode *prim_home) { prim_home->get_node_frame_inv(); _loader.make_indexed_primitive(egg_primitive, node, &transform, - _comp_verts_maker); + _comp_verts_maker); } //////////////////////////////////////////////////////////////////// @@ -351,8 +351,8 @@ determine_primitive_home(EggPrimitive *egg_primitive) { egg_group = DCAST(EggGroup, home); } while (egg_group != (EggGroup *)NULL && - egg_group->get_group_type() != EggGroup::GT_joint && - egg_group->get_dart_type() == EggGroup::DT_none) { + egg_group->get_group_type() != EggGroup::GT_joint && + egg_group->get_dart_type() == EggGroup::DT_none) { nassertr(egg_group->get_parent() != (EggGroupNode *)NULL, NULL); home = egg_group->get_parent(); egg_group = (EggGroup *)NULL; diff --git a/panda/src/egg2sg/characterMaker.h b/panda/src/egg2sg/characterMaker.h index 5ec08c543f..7de51516d6 100644 --- a/panda/src/egg2sg/characterMaker.h +++ b/panda/src/egg2sg/characterMaker.h @@ -29,7 +29,7 @@ class NamedNode; class EggLoader; /////////////////////////////////////////////////////////////////// -// Class : CharacterMaker +// Class : CharacterMaker // Description : Converts an EggGroup hierarchy, beginning with a // group with set, to a character node with // joints. @@ -54,9 +54,9 @@ private: void make_geometry(EggNode *egg_node); void make_static_primitive(EggPrimitive *egg_primitive, - EggGroupNode *prim_home); + EggGroupNode *prim_home); void make_dynamic_primitive(EggPrimitive *egg_primitive, - EggGroupNode *prim_home); + EggGroupNode *prim_home); EggGroupNode *determine_primitive_home(EggPrimitive *egg_primitive); typedef map NodeMap; diff --git a/panda/src/egg2sg/computedVerticesMaker.cxx b/panda/src/egg2sg/computedVerticesMaker.cxx index 9675eb2f78..fb40715943 100644 --- a/panda/src/egg2sg/computedVerticesMaker.cxx +++ b/panda/src/egg2sg/computedVerticesMaker.cxx @@ -93,13 +93,13 @@ add_vertex_joints(EggVertex *vertex, EggNode *object) { egg_group = DCAST(EggGroup, egg_joint); } while (egg_group != (EggGroup *)NULL && - egg_group->get_group_type() != EggGroup::GT_joint && - egg_group->get_dart_type() == EggGroup::DT_none) { + egg_group->get_group_type() != EggGroup::GT_joint && + egg_group->get_dart_type() == EggGroup::DT_none) { nassertv(egg_group->get_parent() != (EggGroupNode *)NULL); egg_joint = egg_group->get_parent(); egg_group = (EggGroup *)NULL; if (egg_joint->is_of_type(EggGroup::get_class_type())) { - egg_group = DCAST(EggGroup, egg_joint); + egg_group = DCAST(EggGroup, egg_joint); } } @@ -149,7 +149,7 @@ mark_space() { //////////////////////////////////////////////////////////////////// int ComputedVerticesMaker:: add_vertex(const Vertexd &vertex, const EggMorphVertexList &morphs, - const LMatrix4d &transform) { + const LMatrix4d &transform) { // This must be called after a call to mark_space(), and before a // call to begin_new_space(). assert(_current_vc != NULL); @@ -169,11 +169,11 @@ add_vertex(const Vertexd &vertex, const EggMorphVertexList &morphs, // Have we already morphed this vertex? VertexMorphList::iterator vmi = mlist._vmorphs.find(index); if (vmi != mlist._vmorphs.end()) { - // Yes, we have. - assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); + // Yes, we have. + assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); } else { - // No, we haven't yet; morph it now. - mlist._vmorphs[index] = LCAST(float, offset); + // No, we haven't yet; morph it now. + mlist._vmorphs[index] = LCAST(float, offset); } } } @@ -190,7 +190,7 @@ add_vertex(const Vertexd &vertex, const EggMorphVertexList &morphs, //////////////////////////////////////////////////////////////////// int ComputedVerticesMaker:: add_normal(const Normald &normal, const EggMorphNormalList &morphs, - const LMatrix4d &transform) { + const LMatrix4d &transform) { // This must be called after a call to mark_space(), and before a // call to begin_new_space(). assert(_current_vc != NULL); @@ -211,11 +211,11 @@ add_normal(const Normald &normal, const EggMorphNormalList &morphs, // Have we already morphed this normal? NormalMorphList::iterator vmi = mlist._nmorphs.find(index); if (vmi != mlist._nmorphs.end()) { - // Yes, we have. - assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); + // Yes, we have. + assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); } else { - // No, we haven't yet; morph it now. - mlist._nmorphs[index] = LCAST(float, offset); + // No, we haven't yet; morph it now. + mlist._nmorphs[index] = LCAST(float, offset); } } } @@ -233,7 +233,7 @@ add_normal(const Normald &normal, const EggMorphNormalList &morphs, //////////////////////////////////////////////////////////////////// int ComputedVerticesMaker:: add_texcoord(const TexCoordd &texcoord, const EggMorphTexCoordList &morphs, - const LMatrix3d &transform) { + const LMatrix3d &transform) { TexCoordf ttc = LCAST(float, texcoord * transform); int index = _tmap.add_value(ttc, morphs, _texcoords); _tindex.insert(index); @@ -249,11 +249,11 @@ add_texcoord(const TexCoordd &texcoord, const EggMorphTexCoordList &morphs, // Have we already morphed this texcoord? TexCoordMorphList::iterator vmi = mlist._tmorphs.find(index); if (vmi != mlist._tmorphs.end()) { - // Yes, we have. - assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); + // Yes, we have. + assert(offset.almost_equal(LCAST(double, (*vmi).second), 0.0001)); } else { - // No, we haven't yet; morph it now. - mlist._tmorphs[index] = LCAST(float, offset); + // No, we haven't yet; morph it now. + mlist._tmorphs[index] = LCAST(float, offset); } } } @@ -284,11 +284,11 @@ add_color(const Colorf &color, const EggMorphColorList &morphs) { // Have we already morphed this color? ColorMorphList::iterator vmi = mlist._cmorphs.find(index); if (vmi != mlist._cmorphs.end()) { - // Yes, we have. - assert(offset.almost_equal((*vmi).second, 0.0001)); + // Yes, we have. + assert(offset.almost_equal((*vmi).second, 0.0001)); } else { - // No, we haven't yet; morph it now. - mlist._cmorphs[index] = offset; + // No, we haven't yet; morph it now. + mlist._cmorphs[index] = offset; } } } @@ -338,13 +338,13 @@ make_computed_vertices(Character *character, CharacterMaker &char_maker) { // we will only be changing a part of the VertexTransform that // doesn't affect its sort order within the set. ComputedVertices::VertexTransform &insert_vt = - (ComputedVertices::VertexTransform &)*vti; + (ComputedVertices::VertexTransform &)*vti; // Now add in all the vertices and normals. copy(vc._vindex.begin(), vc._vindex.end(), - back_inserter(insert_vt._vindex)); + back_inserter(insert_vt._vindex)); copy(vc._nindex.begin(), vc._nindex.end(), - back_inserter(insert_vt._nindex)); + back_inserter(insert_vt._nindex)); } } @@ -377,10 +377,10 @@ make_computed_vertices(Character *character, CharacterMaker &char_maker) { VertexMorphList::const_iterator vmi; for (vmi = mlist._vmorphs.begin(); - vmi != mlist._vmorphs.end(); - ++vmi) { - mv._morphs.push_back(ComputedVerticesMorphValue3((*vmi).first, - (*vmi).second)); + vmi != mlist._vmorphs.end(); + ++vmi) { + mv._morphs.push_back(ComputedVerticesMorphValue3((*vmi).first, + (*vmi).second)); } } @@ -391,10 +391,10 @@ make_computed_vertices(Character *character, CharacterMaker &char_maker) { NormalMorphList::const_iterator vmi; for (vmi = mlist._nmorphs.begin(); - vmi != mlist._nmorphs.end(); - ++vmi) { - mv._morphs.push_back(ComputedVerticesMorphValue3((*vmi).first, - (*vmi).second)); + vmi != mlist._nmorphs.end(); + ++vmi) { + mv._morphs.push_back(ComputedVerticesMorphValue3((*vmi).first, + (*vmi).second)); } } @@ -405,10 +405,10 @@ make_computed_vertices(Character *character, CharacterMaker &char_maker) { TexCoordMorphList::const_iterator vmi; for (vmi = mlist._tmorphs.begin(); - vmi != mlist._tmorphs.end(); - ++vmi) { - mv._morphs.push_back(ComputedVerticesMorphValue2((*vmi).first, - (*vmi).second)); + vmi != mlist._tmorphs.end(); + ++vmi) { + mv._morphs.push_back(ComputedVerticesMorphValue2((*vmi).first, + (*vmi).second)); } } @@ -419,10 +419,10 @@ make_computed_vertices(Character *character, CharacterMaker &char_maker) { ColorMorphList::const_iterator vmi; for (vmi = mlist._cmorphs.begin(); - vmi != mlist._cmorphs.end(); - ++vmi) { - mv._morphs.push_back(ComputedVerticesMorphValue4((*vmi).first, - (*vmi).second)); + vmi != mlist._cmorphs.end(); + ++vmi) { + mv._morphs.push_back(ComputedVerticesMorphValue4((*vmi).first, + (*vmi).second)); } } } @@ -450,8 +450,8 @@ write(ostream &out) const { const JointWeights &jw = (*tsi).first; const VertexCollection &vc = (*tsi).second; out << " " << jw << " has " - << vc._vindex.size() << " vertices and " - << vc._nindex.size() << " normals\n"; + << vc._vindex.size() << " vertices and " + << vc._nindex.size() << " normals\n"; } Morphs::const_iterator mi; @@ -459,10 +459,10 @@ write(ostream &out) const { const string &name = (*mi).first; const MorphList &mlist = (*mi).second; out << name << " morphs " - << mlist._vmorphs.size() << " vertices, " - << mlist._nmorphs.size() << " normals, " - << mlist._tmorphs.size() << " uvs, and " - << mlist._cmorphs.size() << " colors.\n"; + << mlist._vmorphs.size() << " vertices, " + << mlist._nmorphs.size() << " normals, " + << mlist._tmorphs.size() << " uvs, and " + << mlist._cmorphs.size() << " colors.\n"; } } diff --git a/panda/src/egg2sg/computedVerticesMaker.h b/panda/src/egg2sg/computedVerticesMaker.h index f0f7f7c846..556b12910a 100644 --- a/panda/src/egg2sg/computedVerticesMaker.h +++ b/panda/src/egg2sg/computedVerticesMaker.h @@ -29,7 +29,7 @@ class EggNode; class EggVertex; /////////////////////////////////////////////////////////////////// -// Class : ComputedVerticesMaker +// Class : ComputedVerticesMaker // Description : An object to collect together all the vertices of a // character, indicate what the transform space of each // vertex is (which may be a soft-skinned combination of @@ -57,16 +57,16 @@ public: void mark_space(); int add_vertex(const Vertexd &vertex, const EggMorphVertexList &morphs, - const LMatrix4d &transform); + const LMatrix4d &transform); int add_normal(const Normald &normal, const EggMorphNormalList &morphs, - const LMatrix4d &transform); + const LMatrix4d &transform); int add_texcoord(const TexCoordd &texcoord, - const EggMorphTexCoordList &morphs, - const LMatrix3d &transform); + const EggMorphTexCoordList &morphs, + const LMatrix3d &transform); int add_color(const Colorf &color, const EggMorphColorList &morphs); ComputedVertices *make_computed_vertices(Character *character, - CharacterMaker &char_maker); + CharacterMaker &char_maker); void write(ostream &out) const; diff --git a/panda/src/egg2sg/computedVerticesMakerEntity.I b/panda/src/egg2sg/computedVerticesMakerEntity.I index 2790294a65..93edac83cc 100644 --- a/panda/src/egg2sg/computedVerticesMakerEntity.I +++ b/panda/src/egg2sg/computedVerticesMakerEntity.I @@ -51,7 +51,7 @@ operator < (const ComputedVerticesMakerEntity &other) cons template int ComputedVerticesMakerEntityMap:: add_value(const ValueType &value, const MorphType &morphs, - PTA(ValueType) &table) { + PTA(ValueType) &table) { // First, see if we have such an entity already. ComputedVerticesMakerEntity entity(value, morphs); MapType::const_iterator mi = _map.find(entity); diff --git a/panda/src/egg2sg/computedVerticesMakerEntity.h b/panda/src/egg2sg/computedVerticesMakerEntity.h index 90b6d05e1a..d664a7da03 100644 --- a/panda/src/egg2sg/computedVerticesMakerEntity.h +++ b/panda/src/egg2sg/computedVerticesMakerEntity.h @@ -16,7 +16,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : ComputedVerticesMakerEntity +// Class : ComputedVerticesMakerEntity // Description : This represents a single vertex value, or color // value, or normal value, or some such thing, added to // the ComputedVerticesMaker. This supports @@ -28,7 +28,7 @@ template class EXPCL_PANDAEGG ComputedVerticesMakerEntity { public: INLINE ComputedVerticesMakerEntity(const ValueType &value, - const MorphType &morphs); + const MorphType &morphs); bool operator < (const ComputedVerticesMakerEntity &other) const; @@ -38,7 +38,7 @@ public: /////////////////////////////////////////////////////////////////// -// Class : ComputedVerticesMakerEntityMap +// Class : ComputedVerticesMakerEntityMap // Description : A map of some kind of entity, above, to an integer // index number. This collects together identical // vertices into a common index number. @@ -47,7 +47,7 @@ template class EXPCL_PANDAEGG ComputedVerticesMakerEntityMap { public: int add_value(const ValueType &value, const MorphType &morphs, - PTA(ValueType) &table); + PTA(ValueType) &table); typedef map, int> MapType; MapType _map; diff --git a/panda/src/egg2sg/deferredArcProperty.h b/panda/src/egg2sg/deferredArcProperty.h index 4792464982..e60ff38480 100644 --- a/panda/src/egg2sg/deferredArcProperty.h +++ b/panda/src/egg2sg/deferredArcProperty.h @@ -14,7 +14,7 @@ class Node; /////////////////////////////////////////////////////////////////// -// Class : DeferredArcProperty +// Class : DeferredArcProperty // Description : This class keeps track of all the state we must make // note of during the graph traversal, but cannot apply // immediately. An instance of this class may be diff --git a/panda/src/egg2sg/deferredArcTraverser.cxx b/panda/src/egg2sg/deferredArcTraverser.cxx index b0bd1490a4..80d132dd9c 100644 --- a/panda/src/egg2sg/deferredArcTraverser.cxx +++ b/panda/src/egg2sg/deferredArcTraverser.cxx @@ -23,8 +23,8 @@ DeferredArcTraverser(const DeferredArcs &deferred_arcs) : //////////////////////////////////////////////////////////////////// bool DeferredArcTraverser:: forward_arc(NodeRelation *arc, NullTransitionWrapper &, - NullAttributeWrapper &, NullAttributeWrapper &, - DeferredArcProperty &level_state) { + NullAttributeWrapper &, NullAttributeWrapper &, + DeferredArcProperty &level_state) { // Do we have a DeferredArcProperty associated with this arc? DeferredArcs::const_iterator dai; diff --git a/panda/src/egg2sg/deferredArcTraverser.h b/panda/src/egg2sg/deferredArcTraverser.h index b893bc6423..8abfc104d7 100644 --- a/panda/src/egg2sg/deferredArcTraverser.h +++ b/panda/src/egg2sg/deferredArcTraverser.h @@ -19,7 +19,7 @@ class NodeRelation; /////////////////////////////////////////////////////////////////// -// Class : DeferredArcTraverser +// Class : DeferredArcTraverser // Description : This class is used after all of the nodes have been // built to go back and apply down all of the // DeferredArcProperties that might have been built of @@ -34,8 +34,8 @@ public: DeferredArcTraverser(const DeferredArcs &deferred_arcs); bool forward_arc(NodeRelation *arc, NullTransitionWrapper &, - NullAttributeWrapper &, NullAttributeWrapper &, - DeferredArcProperty &level_state); + NullAttributeWrapper &, NullAttributeWrapper &, + DeferredArcProperty &level_state); const DeferredArcs &_deferred_arcs; }; diff --git a/panda/src/egg2sg/eggBinner.h b/panda/src/egg2sg/eggBinner.h index 7d05d41a6a..18aa2710f7 100644 --- a/panda/src/egg2sg/eggBinner.h +++ b/panda/src/egg2sg/eggBinner.h @@ -11,7 +11,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : EggBinner +// Class : EggBinner // Description : A special binner used only within this package to // pre-process the egg tree for the loader and group // things together as appropriate. diff --git a/panda/src/egg2sg/eggLoader.cxx b/panda/src/egg2sg/eggLoader.cxx index eec9755534..652d930915 100644 --- a/panda/src/egg2sg/eggLoader.cxx +++ b/panda/src/egg2sg/eggLoader.cxx @@ -170,28 +170,28 @@ reparent_decals() { node->get_num_children(RenderRelation::get_class_type()); for (int i = 0; i < num_children; i++) { NodeRelation *child_arc = - node->get_child(RenderRelation::get_class_type(), i); + node->get_child(RenderRelation::get_class_type(), i); nassertv(child_arc != (NodeRelation *)NULL); Node *child = child_arc->get_child(); nassertv(child != (Node *)NULL); if (child->is_of_type(GeomNode::get_class_type())) { - if (geom != (GeomNode *)NULL) { - // Oops, too many GeomNodes. - egg2sg_cat.error() - << "Decal onto " << node->get_name() - << " uses base geometry with multiple states.\n"; - _error = true; - } - DCAST_INTO_V(geom, child); + if (geom != (GeomNode *)NULL) { + // Oops, too many GeomNodes. + egg2sg_cat.error() + << "Decal onto " << node->get_name() + << " uses base geometry with multiple states.\n"; + _error = true; + } + DCAST_INTO_V(geom, child); } } if (geom == (GeomNode *)NULL) { // No children were GeomNodes. egg2sg_cat.error() - << "Ignoring decal onto " << node->get_name() - << "; no geometry within group.\n"; + << "Ignoring decal onto " << node->get_name() + << "; no geometry within group.\n"; _error = true; } else { // Now reparent all of the non-GeomNodes to this node. We have @@ -199,18 +199,18 @@ reparent_decals() { // list. int i = 0; while (i < num_children) { - NodeRelation *child_arc = - node->get_child(RenderRelation::get_class_type(), i); - nassertv(child_arc != (NodeRelation *)NULL); - Node *child = child_arc->get_child(); - nassertv(child != (Node *)NULL); + NodeRelation *child_arc = + node->get_child(RenderRelation::get_class_type(), i); + nassertv(child_arc != (NodeRelation *)NULL); + Node *child = child_arc->get_child(); + nassertv(child != (Node *)NULL); - if (child->is_of_type(GeomNode::get_class_type())) { - i++; - } else { - child_arc->change_parent(geom); - num_children--; - } + if (child->is_of_type(GeomNode::get_class_type())) { + i++; + } else { + child_arc->change_parent(geom); + num_children--; + } } } } @@ -250,7 +250,7 @@ reset_directs() { nassertv(child != (Node *)NULL); if (child->is_of_type(GeomNode::get_class_type())) { - DCAST_INTO_V(geom, child); + DCAST_INTO_V(geom, child); } } @@ -270,7 +270,7 @@ reset_directs() { //////////////////////////////////////////////////////////////////// void EggLoader:: make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, - const LMatrix4d *transform) { + const LMatrix4d *transform) { BuilderBucket bucket; setup_bucket(bucket, parent, egg_prim); @@ -318,9 +318,9 @@ make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, if (egg_vert->has_uv()) { TexCoordd uv = egg_vert->get_uv(); if (egg_prim->has_texture() && - egg_prim->get_texture()->has_transform()) { - // If we have a texture matrix, apply it. - uv = uv * egg_prim->get_texture()->get_transform(); + egg_prim->get_texture()->has_transform()) { + // If we have a texture matrix, apply it. + uv = uv * egg_prim->get_texture()->get_transform(); } bvert.set_texcoord(LCAST(float, uv)); } @@ -344,8 +344,8 @@ make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, //////////////////////////////////////////////////////////////////// void EggLoader:: make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, - const LMatrix4d *transform, - ComputedVerticesMaker &_comp_verts_maker) { + const LMatrix4d *transform, + ComputedVerticesMaker &_comp_verts_maker) { BuilderBucket bucket; setup_bucket(bucket, parent, egg_prim); @@ -381,7 +381,7 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, int nindex = _comp_verts_maker.add_normal(egg_prim->get_normal(), - egg_prim->_dnormals, mat); + egg_prim->_dnormals, mat); bprim.set_normal(nindex); } @@ -389,7 +389,7 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, if (egg_prim->has_color() && !egg_false_color) { int cindex = _comp_verts_maker.add_color(egg_prim->get_color(), - egg_prim->_drgbas); + egg_prim->_drgbas); bprim.set_color(cindex); } @@ -406,21 +406,21 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, int vindex = _comp_verts_maker.add_vertex(egg_vert->get_pos3(), - egg_vert->_dxyzs, mat); + egg_vert->_dxyzs, mat); BuilderVertexI bvert(vindex); if (egg_vert->has_normal()) { int nindex = - _comp_verts_maker.add_normal(egg_vert->get_normal(), - egg_vert->_dnormals, - mat); + _comp_verts_maker.add_normal(egg_vert->get_normal(), + egg_vert->_dnormals, + mat); bvert.set_normal(nindex); } if (egg_vert->has_color() && !egg_false_color) { int cindex = - _comp_verts_maker.add_color(egg_vert->get_color(), - egg_vert->_drgbas); + _comp_verts_maker.add_color(egg_vert->get_color(), + egg_vert->_drgbas); bvert.set_color(cindex); } else { // If any vertex doesn't have a color, we can't use any of the @@ -433,15 +433,15 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, LMatrix3d mat; if (egg_prim->has_texture() && - egg_prim->get_texture()->has_transform()) { - // If we have a texture matrix, apply it. - mat = egg_prim->get_texture()->get_transform(); + egg_prim->get_texture()->has_transform()) { + // If we have a texture matrix, apply it. + mat = egg_prim->get_texture()->get_transform(); } else { - mat = LMatrix3d::ident_mat(); + mat = LMatrix3d::ident_mat(); } int tindex = - _comp_verts_maker.add_texcoord(uv, egg_vert->_duvs, mat); + _comp_verts_maker.add_texcoord(uv, egg_vert->_duvs, mat); bvert.set_texcoord(tindex); } @@ -453,7 +453,7 @@ make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, if (!egg_prim->has_color() && !has_vert_color && !egg_false_color) { int cindex = _comp_verts_maker.add_color(Colorf(1.0, 1.0, 1.0, 1.0), - EggMorphColorList()); + EggMorphColorList()); bprim.set_color(cindex); } @@ -475,7 +475,7 @@ load_textures() { // differentiate by attributes? Maybe. EggTextureCollection::TextureReplacement replace; tc.collapse_equivalent_textures(EggTexture::E_complete_filename, - replace); + replace); EggTextureCollection::iterator ti; for (ti = tc.begin(); ti != tc.end(); ++ti) { @@ -511,7 +511,7 @@ load_texture(TextureDef &def, const EggTexture *egg_tex) { Texture *tex; if (egg_tex->has_alpha_file()) { tex = TexturePool::load_texture(egg_tex->get_filename(), - egg_tex->get_alpha_file()); + egg_tex->get_alpha_file()); } else { tex = TexturePool::load_texture(egg_tex->get_filename()); } @@ -558,7 +558,7 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::WM_clamp: if (egg_ignore_clamp) { egg2sg_cat.warning() - << "Ignoring clamp request\n"; + << "Ignoring clamp request\n"; tex->set_wrapu(Texture::WM_repeat); } else { tex->set_wrapu(Texture::WM_clamp); @@ -582,7 +582,7 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::WM_clamp: if (egg_ignore_clamp) { egg2sg_cat.warning() - << "Ignoring clamp request\n"; + << "Ignoring clamp request\n"; tex->set_wrapv(Texture::WM_repeat); } else { tex->set_wrapv(Texture::WM_clamp); @@ -606,7 +606,7 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_linear: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring minfilter request\n"; + << "Ignoring minfilter request\n"; tex->set_minfilter(Texture::FT_nearest); } else { tex->set_minfilter(Texture::FT_linear); @@ -616,11 +616,11 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_nearest_mipmap_nearest: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring minfilter request\n"; + << "Ignoring minfilter request\n"; tex->set_minfilter(Texture::FT_nearest); } else if (egg_ignore_mipmaps) { egg2sg_cat.warning() - << "Ignoring mipmap request\n"; + << "Ignoring mipmap request\n"; tex->set_minfilter(Texture::FT_nearest); } else { tex->set_minfilter(Texture::FT_nearest_mipmap_nearest); @@ -630,11 +630,11 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_linear_mipmap_nearest: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring minfilter request\n"; + << "Ignoring minfilter request\n"; tex->set_minfilter(Texture::FT_nearest); } else if (egg_ignore_mipmaps) { egg2sg_cat.warning() - << "Ignoring mipmap request\n"; + << "Ignoring mipmap request\n"; tex->set_minfilter(Texture::FT_linear); } else { tex->set_minfilter(Texture::FT_linear_mipmap_nearest); @@ -644,11 +644,11 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_nearest_mipmap_linear: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring minfilter request\n"; + << "Ignoring minfilter request\n"; tex->set_minfilter(Texture::FT_nearest); } else if (egg_ignore_mipmaps) { egg2sg_cat.warning() - << "Ignoring mipmap request\n"; + << "Ignoring mipmap request\n"; tex->set_minfilter(Texture::FT_nearest); } else { tex->set_minfilter(Texture::FT_nearest_mipmap_linear); @@ -658,11 +658,11 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_linear_mipmap_linear: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring minfilter request\n"; + << "Ignoring minfilter request\n"; tex->set_minfilter(Texture::FT_nearest); } else if (egg_ignore_mipmaps) { egg2sg_cat.warning() - << "Ignoring mipmap request\n"; + << "Ignoring mipmap request\n"; tex->set_minfilter(Texture::FT_linear); } else { tex->set_minfilter(Texture::FT_linear_mipmap_linear); @@ -690,7 +690,7 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { case EggTexture::FT_linear_mipmap_linear: if (egg_ignore_filters) { egg2sg_cat.warning() - << "Ignoring magfilter request\n"; + << "Ignoring magfilter request\n"; tex->set_magfilter(Texture::FT_nearest); } else { tex->set_magfilter(Texture::FT_linear); @@ -733,8 +733,8 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { default: egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 1-component texture " << egg_tex->get_name() << "\n"; + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 1-component texture " << egg_tex->get_name() << "\n"; } } else if (tex->_pbuffer->get_num_components() == 2) { @@ -752,8 +752,8 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { default: egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 2-component texture " << egg_tex->get_name() << "\n"; + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 2-component texture " << egg_tex->get_name() << "\n"; } } else if (tex->_pbuffer->get_num_components() == 3) { @@ -763,12 +763,12 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { break; case EggTexture::F_rgb12: if (tex->_pbuffer->get_component_width() >= 2) { - // Only do this if the component width supports it. - tex->_pbuffer->set_format(PixelBuffer::F_rgb12); + // Only do this if the component width supports it. + tex->_pbuffer->set_format(PixelBuffer::F_rgb12); } else { - egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 8-bit texture " << egg_tex->get_name() << "\n"; + egg2sg_cat.warning() + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 8-bit texture " << egg_tex->get_name() << "\n"; } break; case EggTexture::F_rgb8: @@ -790,8 +790,8 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { default: egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 3-component texture " << egg_tex->get_name() << "\n"; + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 3-component texture " << egg_tex->get_name() << "\n"; } } else if (tex->_pbuffer->get_num_components() == 4) { @@ -804,12 +804,12 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { break; case EggTexture::F_rgba12: if (tex->_pbuffer->get_component_width() >= 2) { - // Only do this if the component width supports it. - tex->_pbuffer->set_format(PixelBuffer::F_rgba12); + // Only do this if the component width supports it. + tex->_pbuffer->set_format(PixelBuffer::F_rgba12); } else { - egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 8-bit texture " << egg_tex->get_name() << "\n"; + egg2sg_cat.warning() + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 8-bit texture " << egg_tex->get_name() << "\n"; } break; case EggTexture::F_rgba8: @@ -827,8 +827,8 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { default: egg2sg_cat.warning() - << "Ignoring inappropriate format " << egg_tex->get_format() - << " for 4-component texture " << egg_tex->get_name() << "\n"; + << "Ignoring inappropriate format " << egg_tex->get_format() + << " for 4-component texture " << egg_tex->get_name() << "\n"; } } } @@ -840,7 +840,7 @@ apply_texture_attributes(Texture *tex, const EggTexture *egg_tex) { //////////////////////////////////////////////////////////////////// void EggLoader:: apply_texture_apply_attributes(TextureApplyTransition *apply, - const EggTexture *egg_tex) { + const EggTexture *egg_tex) { if (egg_always_decal_textures) { apply->set_mode(TextureApplyProperty::M_decal); @@ -859,8 +859,8 @@ apply_texture_apply_attributes(TextureApplyTransition *apply, default: egg2sg_cat.warning() - << "Invalid texture environment " - << (int)egg_tex->get_env_type() << "\n"; + << "Invalid texture environment " + << (int)egg_tex->get_env_type() << "\n"; } } } @@ -928,7 +928,7 @@ get_material_transition(const EggMaterial *egg_mat, bool bface) { //////////////////////////////////////////////////////////////////// void EggLoader:: setup_bucket(BuilderBucket &bucket, NamedNode *parent, - EggPrimitive *egg_prim) { + EggPrimitive *egg_prim) { bucket._node = parent; bucket._mesh = egg_mesh; bucket._retesselate_coplanar = egg_retesselate_coplanar; @@ -1005,19 +1005,19 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent, // mode, assume it should be alpha'ed if the texture has an // alpha channel. if (am == EggRenderMode::AM_unspecified) { - Texture *tex = def._texture->get_texture(); - nassertv(tex != (Texture *)NULL); - int num_components = tex->_pbuffer->get_num_components(); - if (egg_tex->has_alpha_channel(num_components)) { - implicit_alpha = true; - } + Texture *tex = def._texture->get_texture(); + nassertv(tex != (Texture *)NULL); + int num_components = tex->_pbuffer->get_num_components(); + if (egg_tex->has_alpha_channel(num_components)) { + implicit_alpha = true; + } } } } if (egg_prim->has_material()) { MaterialTransition *mt = get_material_transition(egg_prim->get_material(), - egg_prim->get_bface_flag()); + egg_prim->get_bface_flag()); bucket._trans.set_transition(mt); } @@ -1027,17 +1027,17 @@ setup_bucket(BuilderBucket &bucket, NamedNode *parent, if (am == EggRenderMode::AM_unspecified) { if (egg_prim->has_color()) { if (egg_prim->get_color()[3] != 1.0) { - implicit_alpha = true; + implicit_alpha = true; } } EggPrimitive::const_iterator vi; for (vi = egg_prim->begin(); - !implicit_alpha && vi != egg_prim->end(); - ++vi) { + !implicit_alpha && vi != egg_prim->end(); + ++vi) { if ((*vi)->has_color()) { - if ((*vi)->get_color()[3] != 1.0) { - implicit_alpha = true; - } + if ((*vi)->get_color()[3] != 1.0) { + implicit_alpha = true; + } } } @@ -1278,7 +1278,7 @@ make_node(EggBin *egg_bin, NamedNode *parent) { // All of the children should have the same center, because that's // how we binned them. assert(lod_node->_lod._center.almost_equal - (LCAST(float, instance._d->_center), 0.01)); + (LCAST(float, instance._d->_center), 0.01)); instance._arc->set_sort(i); @@ -1309,13 +1309,13 @@ make_node(EggGroup *egg_group, NamedNode *parent) { while (egg_group->has_objecttype()) { string objecttype = egg_group->get_objecttype(); if (!expanded.insert(objecttype).second) { - egg2sg_cat.error() - << "Cycle in ObjectType expansions:\n"; - copy(expanded_history.begin(), expanded_history.end(), - ostream_iterator(egg2sg_cat.error(false), " -> ")); - egg2sg_cat.error(false) << objecttype << "\n"; - _error = true; - break; + egg2sg_cat.error() + << "Cycle in ObjectType expansions:\n"; + copy(expanded_history.begin(), expanded_history.end(), + ostream_iterator(egg2sg_cat.error(false), " -> ")); + egg2sg_cat.error(false) << objecttype << "\n"; + _error = true; + break; } expanded_history.push_back(objecttype); @@ -1329,57 +1329,57 @@ make_node(EggGroup *egg_group, NamedNode *parent) { // shorthand for. First, look in the config file. string egg_syntax = - config_egg2sg.GetString("egg-object-type-" + objecttype, "none"); + config_egg2sg.GetString("egg-object-type-" + objecttype, "none"); if (egg_syntax == "none") { - // It wasn't defined in a config file. Maybe it's built in? - - if (cmp_nocase_uh(objecttype, "barrier") == 0) { - egg_syntax = " { Polyset descend }"; - - } else if (cmp_nocase_uh(objecttype, "solidpoly") == 0) { - egg_syntax = " { Polyset descend solid }"; - - } else if (cmp_nocase_uh(objecttype, "turnstile") == 0) { - egg_syntax = " { Polyset descend turnstile }"; - - } else if (cmp_nocase_uh(objecttype, "sphere") == 0) { - egg_syntax = " { Sphere descend }"; - - } else if (cmp_nocase_uh(objecttype, "trigger") == 0) { - egg_syntax = " { Polyset descend intangible }"; - - } else if (cmp_nocase_uh(objecttype, "trigger_sphere") == 0) { - egg_syntax = " { Sphere descend intangible }"; - - } else if (cmp_nocase_uh(objecttype, "eye_trigger") == 0) { - egg_syntax = " { Polyset descend intangible center }"; - - } else if (cmp_nocase_uh(objecttype, "bubble") == 0) { - egg_syntax = " { Sphere keep descend }"; - - } else if (cmp_nocase_uh(objecttype, "ghost") == 0) { - egg_syntax = " collide-mask { 0 }"; - - } else if (cmp_nocase_uh(objecttype, "backstage") == 0) { - // Ignore "backstage" geometry. - return NULL; - - } else { - egg2sg_cat.error() - << "Unknown ObjectType " << objecttype << "\n"; - _error = true; - break; - } + // It wasn't defined in a config file. Maybe it's built in? + + if (cmp_nocase_uh(objecttype, "barrier") == 0) { + egg_syntax = " { Polyset descend }"; + + } else if (cmp_nocase_uh(objecttype, "solidpoly") == 0) { + egg_syntax = " { Polyset descend solid }"; + + } else if (cmp_nocase_uh(objecttype, "turnstile") == 0) { + egg_syntax = " { Polyset descend turnstile }"; + + } else if (cmp_nocase_uh(objecttype, "sphere") == 0) { + egg_syntax = " { Sphere descend }"; + + } else if (cmp_nocase_uh(objecttype, "trigger") == 0) { + egg_syntax = " { Polyset descend intangible }"; + + } else if (cmp_nocase_uh(objecttype, "trigger_sphere") == 0) { + egg_syntax = " { Sphere descend intangible }"; + + } else if (cmp_nocase_uh(objecttype, "eye_trigger") == 0) { + egg_syntax = " { Polyset descend intangible center }"; + + } else if (cmp_nocase_uh(objecttype, "bubble") == 0) { + egg_syntax = " { Sphere keep descend }"; + + } else if (cmp_nocase_uh(objecttype, "ghost") == 0) { + egg_syntax = " collide-mask { 0 }"; + + } else if (cmp_nocase_uh(objecttype, "backstage") == 0) { + // Ignore "backstage" geometry. + return NULL; + + } else { + egg2sg_cat.error() + << "Unknown ObjectType " << objecttype << "\n"; + _error = true; + break; + } } if (!egg_syntax.empty()) { - if (!egg_group->parse_egg(egg_syntax)) { - egg2sg_cat.error() - << "Error while parsing definition for ObjectType " - << objecttype << "\n"; - _error = true; - } + if (!egg_group->parse_egg(egg_syntax)) { + egg2sg_cat.error() + << "Error while parsing definition for ObjectType " + << objecttype << "\n"; + _error = true; + } } } } @@ -1390,7 +1390,7 @@ make_node(EggGroup *egg_group, NamedNode *parent) { node = char_maker.make_node(); } else if (egg_group->get_cs_type() != EggGroup::CST_none && - egg_group->get_cs_type() != EggGroup::CST_geode) { + egg_group->get_cs_type() != EggGroup::CST_geode) { // A collision group: create collision geometry. node = new CollisionNode; node->set_name(egg_group->get_name()); @@ -1401,7 +1401,7 @@ make_node(EggGroup *egg_group, NamedNode *parent) { // traversal. EggGroup::const_iterator ci; for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { - make_node(*ci, parent); + make_node(*ci, parent); } } @@ -1413,7 +1413,7 @@ make_node(EggGroup *egg_group, NamedNode *parent) { return arc; } else if (egg_group->get_switch_flag() && - egg_group->get_switch_fps() != 0.0) { + egg_group->get_switch_fps() != 0.0) { // Create a sequence node. node = new SequenceNode(1.0 / egg_group->get_switch_fps()); node->set_name(egg_group->get_name()); @@ -1491,7 +1491,7 @@ create_group_arc(EggGroup *egg_group, NamedNode *parent, NamedNode *node) { if (egg_group->get_decal_flag()) { if (egg_ignore_decals) { egg2sg_cat.error() - << "Ignoring decal flag on " << egg_group->get_name() << "\n"; + << "Ignoring decal flag on " << egg_group->get_name() << "\n"; _error = true; } @@ -1596,7 +1596,7 @@ make_node(EggGroupNode *egg_group, NamedNode *parent) { //////////////////////////////////////////////////////////////////// void EggLoader:: make_collision_solids(EggGroup *start_group, EggGroup *egg_group, - CollisionNode *cnode) { + CollisionNode *cnode) { if (egg_group->get_cs_type() != EggGroup::CST_none) { start_group = egg_group; } @@ -1637,7 +1637,7 @@ make_collision_solids(EggGroup *start_group, EggGroup *egg_group, EggGroup::const_iterator ci; for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) { if ((*ci)->is_of_type(EggGroup::get_class_type())) { - make_collision_solids(start_group, DCAST(EggGroup, *ci), cnode); + make_collision_solids(start_group, DCAST(EggGroup, *ci), cnode); } } } @@ -1651,19 +1651,19 @@ make_collision_solids(EggGroup *start_group, EggGroup *egg_group, //////////////////////////////////////////////////////////////////// void EggLoader:: make_collision_plane(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags) { + EggGroup::CollideFlags flags) { EggGroup *geom_group = find_collision_geometry(egg_group); if (geom_group != (EggGroup *)NULL) { EggGroup::const_iterator ci; for (ci = geom_group->begin(); ci != geom_group->end(); ++ci) { if ((*ci)->is_of_type(EggPolygon::get_class_type())) { - CollisionPlane *csplane = - create_collision_plane(DCAST(EggPolygon, *ci), egg_group); - if (csplane != (CollisionPlane *)NULL) { - apply_collision_flags(csplane, flags); - cnode->add_solid(csplane); - return; - } + CollisionPlane *csplane = + create_collision_plane(DCAST(EggPolygon, *ci), egg_group); + if (csplane != (CollisionPlane *)NULL) { + apply_collision_flags(csplane, flags); + cnode->add_solid(csplane); + return; + } } } } @@ -1677,15 +1677,15 @@ make_collision_plane(EggGroup *egg_group, CollisionNode *cnode, //////////////////////////////////////////////////////////////////// void EggLoader:: make_collision_polygon(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags) { + EggGroup::CollideFlags flags) { EggGroup *geom_group = find_collision_geometry(egg_group); if (geom_group != (EggGroup *)NULL) { EggGroup::const_iterator ci; for (ci = geom_group->begin(); ci != geom_group->end(); ++ci) { if ((*ci)->is_of_type(EggPolygon::get_class_type())) { - create_collision_polygons(cnode, DCAST(EggPolygon, *ci), - egg_group, flags); + create_collision_polygons(cnode, DCAST(EggPolygon, *ci), + egg_group, flags); } } } @@ -1699,14 +1699,14 @@ make_collision_polygon(EggGroup *egg_group, CollisionNode *cnode, //////////////////////////////////////////////////////////////////// void EggLoader:: make_collision_polyset(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags) { + EggGroup::CollideFlags flags) { EggGroup *geom_group = find_collision_geometry(egg_group); if (geom_group != (EggGroup *)NULL) { EggGroup::const_iterator ci; for (ci = geom_group->begin(); ci != geom_group->end(); ++ci) { if ((*ci)->is_of_type(EggPolygon::get_class_type())) { - create_collision_polygons(cnode, DCAST(EggPolygon, *ci), - egg_group, flags); + create_collision_polygons(cnode, DCAST(EggPolygon, *ci), + egg_group, flags); } } } @@ -1720,7 +1720,7 @@ make_collision_polyset(EggGroup *egg_group, CollisionNode *cnode, //////////////////////////////////////////////////////////////////// void EggLoader:: make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags) { + EggGroup::CollideFlags flags) { EggGroup *geom_group = find_collision_geometry(egg_group); if (geom_group != (EggGroup *)NULL) { // Collect all of the vertices. @@ -1729,11 +1729,11 @@ make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, EggGroup::const_iterator ci; for (ci = geom_group->begin(); ci != geom_group->end(); ++ci) { if ((*ci)->is_of_type(EggPrimitive::get_class_type())) { - EggPrimitive *prim = DCAST(EggPrimitive, *ci); - EggPrimitive::const_iterator pi; - for (pi = prim->begin(); pi != prim->end(); ++pi) { - vertices.insert(*pi); - } + EggPrimitive *prim = DCAST(EggPrimitive, *ci); + EggPrimitive::const_iterator pi; + for (pi = prim->begin(); pi != prim->end(); ++pi) { + vertices.insert(*pi); + } } } @@ -1745,15 +1745,15 @@ make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, for (vi = vertices.begin(); vi != vertices.end(); ++vi) { EggVertex *vtx = (*vi); if (vtx->get_num_dimensions() == 3) { - center += vtx->get_pos3(); - num_vertices++; + center += vtx->get_pos3(); + num_vertices++; } else if (vtx->get_num_dimensions() == 4) { - LPoint4d p4 = vtx->get_pos4(); - if (p4[3] != 0.0) { - center += LPoint3d(p4[0], p4[1], p4[2]) / p4[3]; - num_vertices++; - } + LPoint4d p4 = vtx->get_pos4(); + if (p4[3] != 0.0) { + center += LPoint3d(p4[0], p4[1], p4[2]) / p4[3]; + num_vertices++; + } } } @@ -1763,23 +1763,23 @@ make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, // And the furthest vertex determines the radius. double radius2 = 0.0; for (vi = vertices.begin(); vi != vertices.end(); ++vi) { - EggVertex *vtx = (*vi); - if (vtx->get_num_dimensions() == 3) { - LVector3d v = vtx->get_pos3() - center; - radius2 = max(radius2, v.length_squared()); - - } else if (vtx->get_num_dimensions() == 4) { - LPoint4d p = vtx->get_pos4(); - if (p[3] != 0.0) { - LVector3d v = LPoint3d(p[0], p[1], p[2]) / p[3] - center; - radius2 = max(radius2, v.length_squared()); - } - } + EggVertex *vtx = (*vi); + if (vtx->get_num_dimensions() == 3) { + LVector3d v = vtx->get_pos3() - center; + radius2 = max(radius2, v.length_squared()); + + } else if (vtx->get_num_dimensions() == 4) { + LPoint4d p = vtx->get_pos4(); + if (p[3] != 0.0) { + LVector3d v = LPoint3d(p[0], p[1], p[2]) / p[3] - center; + radius2 = max(radius2, v.length_squared()); + } + } } float radius = sqrtf(radius2); CollisionSphere *cssphere = - new CollisionSphere(LCAST(float, center), radius); + new CollisionSphere(LCAST(float, center), radius); apply_collision_flags(cssphere, flags); cnode->add_solid(cssphere); } @@ -1795,7 +1795,7 @@ make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, //////////////////////////////////////////////////////////////////// void EggLoader:: apply_collision_flags(CollisionSolid *solid, - EggGroup::CollideFlags flags) { + EggGroup::CollideFlags flags) { if ((flags & EggGroup::CF_intangible) != 0) { solid->set_tangible(false); } @@ -1830,7 +1830,7 @@ find_collision_geometry(EggGroup *egg_group) { if ((*ci)->is_of_type(EggGroup::get_class_type())) { EggGroup *child_group = DCAST(EggGroup, *ci); if (child_group->get_cs_type() == egg_group->get_cs_type()) { - return child_group; + return child_group; } } } @@ -1868,7 +1868,7 @@ create_collision_plane(EggPolygon *egg_poly, EggGroup *parent_group) { while (vi != egg_poly->end()) { vert = (*vi)->get_pos3(); if (!vert.almost_equal(last_vert)) { - vertices.push_back(LCAST(float, vert)); + vertices.push_back(LCAST(float, vert)); } last_vert = vert; @@ -1892,8 +1892,8 @@ create_collision_plane(EggPolygon *egg_poly, EggGroup *parent_group) { //////////////////////////////////////////////////////////////////// void EggLoader:: create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, - EggGroup *parent_group, - EggGroup::CollideFlags flags) { + EggGroup *parent_group, + EggGroup::CollideFlags flags) { PT(EggGroup) group = new EggGroup; @@ -1927,13 +1927,13 @@ create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, Vertexd last_vert = vert; ++vi; while (vi != poly->end()) { - vert = (*vi)->get_pos3(); - if (!vert.almost_equal(last_vert)) { - vertices.push_back(LCAST(float, vert)); - } - - last_vert = vert; - ++vi; + vert = (*vi)->get_pos3(); + if (!vert.almost_equal(last_vert)) { + vertices.push_back(LCAST(float, vert)); + } + + last_vert = vert; + ++vi; } } @@ -1941,7 +1941,7 @@ create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, const Vertexf *vertices_begin = &vertices[0]; const Vertexf *vertices_end = vertices_begin + vertices.size(); CollisionPolygon *cspoly = - new CollisionPolygon(vertices_begin, vertices_end); + new CollisionPolygon(vertices_begin, vertices_end); apply_collision_flags(cspoly, flags); cnode->add_solid(cspoly); } @@ -1961,5 +1961,5 @@ apply_deferred_arcs(Node *root) { DeferredArcTraverser trav(_deferred_arcs); df_traverse(root, trav, NullAttributeWrapper(), DeferredArcProperty(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); } diff --git a/panda/src/egg2sg/eggLoader.h b/panda/src/egg2sg/eggLoader.h index 49f08ea653..a04b68fe27 100644 --- a/panda/src/egg2sg/eggLoader.h +++ b/panda/src/egg2sg/eggLoader.h @@ -42,7 +42,7 @@ class CollisionPlane; class CollisionPolygon; /////////////////////////////////////////////////////////////////// -// Class : EggLoader +// Class : EggLoader // Description : Converts an egg data structure, possibly read from an // egg file but not necessarily, into a scene graph // suitable for rendering. @@ -59,11 +59,11 @@ public: void reset_directs(); void make_nonindexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, - const LMatrix4d *transform = NULL); + const LMatrix4d *transform = NULL); void make_indexed_primitive(EggPrimitive *egg_prim, NamedNode *parent, - const LMatrix4d *transform, - ComputedVerticesMaker &_comp_verts_maker); + const LMatrix4d *transform, + ComputedVerticesMaker &_comp_verts_maker); private: class TextureDef { @@ -76,13 +76,13 @@ private: bool load_texture(TextureDef &def, const EggTexture *egg_tex); void apply_texture_attributes(Texture *tex, const EggTexture *egg_tex); void apply_texture_apply_attributes(TextureApplyTransition *apply, - const EggTexture *egg_tex); + const EggTexture *egg_tex); MaterialTransition *get_material_transition(const EggMaterial *egg_mat, - bool bface); + bool bface); void setup_bucket(BuilderBucket &bucket, NamedNode *parent, - EggPrimitive *egg_prim); + EggPrimitive *egg_prim); RenderRelation *make_node(EggNode *egg_node, NamedNode *parent); RenderRelation *make_node(EggNurbsCurve *egg_curve, NamedNode *parent); @@ -90,28 +90,28 @@ private: RenderRelation *make_node(EggBin *egg_bin, NamedNode *parent); RenderRelation *make_node(EggGroup *egg_group, NamedNode *parent); RenderRelation *create_group_arc(EggGroup *egg_group, NamedNode *parent, - NamedNode *node); + NamedNode *node); RenderRelation *make_node(EggTable *egg_table, NamedNode *parent); RenderRelation *make_node(EggGroupNode *egg_group, NamedNode *parent); void make_collision_solids(EggGroup *start_group, EggGroup *egg_group, - CollisionNode *cnode); + CollisionNode *cnode); void make_collision_plane(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags); + EggGroup::CollideFlags flags); void make_collision_polygon(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags); + EggGroup::CollideFlags flags); void make_collision_polyset(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags); + EggGroup::CollideFlags flags); void make_collision_sphere(EggGroup *egg_group, CollisionNode *cnode, - EggGroup::CollideFlags flags); + EggGroup::CollideFlags flags); void apply_collision_flags(CollisionSolid *solid, - EggGroup::CollideFlags flags); + EggGroup::CollideFlags flags); EggGroup *find_collision_geometry(EggGroup *egg_group); CollisionPlane *create_collision_plane(EggPolygon *egg_poly, - EggGroup *parent_group); + EggGroup *parent_group); void create_collision_polygons(CollisionNode *cnode, EggPolygon *egg_poly, - EggGroup *parent_group, - EggGroup::CollideFlags flags); + EggGroup *parent_group, + EggGroup::CollideFlags flags); void apply_deferred_arcs(Node *root); diff --git a/panda/src/egg2sg/loaderFileTypeEgg.h b/panda/src/egg2sg/loaderFileTypeEgg.h index e88cf39b0c..6cabea48d3 100644 --- a/panda/src/egg2sg/loaderFileTypeEgg.h +++ b/panda/src/egg2sg/loaderFileTypeEgg.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LoaderFileTypeEgg +// Class : LoaderFileTypeEgg // Description : This defines the Loader interface to read Egg files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG LoaderFileTypeEgg : public LoaderFileType { diff --git a/panda/src/egg2sg/test_loader.cxx b/panda/src/egg2sg/test_loader.cxx index f8d5c93204..493920d886 100644 --- a/panda/src/egg2sg/test_loader.cxx +++ b/panda/src/egg2sg/test_loader.cxx @@ -38,33 +38,33 @@ public: if (node->is_of_type(GeomNode::get_class_type())) { GeomNode *geomNode = (GeomNode *)node; indent(nout, _indent_level) - << *geomNode << ", " << geomNode->get_num_geoms() - << " geoms:\n"; + << *geomNode << ", " << geomNode->get_num_geoms() + << " geoms:\n"; int num_geoms = geomNode->get_num_geoms(); for (int i = 0; i < num_geoms; i++) { - dDrawable *draw = geomNode->get_geom(i); - if (draw->is_of_type(Geom::get_class_type())) { - Geom *geom = DCAST(Geom, draw); - // geom->output_verbose(nout); - indent(nout, _indent_level + 2) << *geom << "\n"; - } else { - indent(nout, _indent_level + 2) << draw->get_type() << "\n"; - } + dDrawable *draw = geomNode->get_geom(i); + if (draw->is_of_type(Geom::get_class_type())) { + Geom *geom = DCAST(Geom, draw); + // geom->output_verbose(nout); + indent(nout, _indent_level + 2) << *geom << "\n"; + } else { + indent(nout, _indent_level + 2) << draw->get_type() << "\n"; + } } } return true; } bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + NullLevelState &) { indent(nout, _indent_level) << *arc << " has:\n"; trans.write(nout, _indent_level + 4); _indent_level += 2; return true; } void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - const NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + const NullLevelState &) { _indent_level -= 2; } int _indent_level; @@ -93,7 +93,7 @@ main(int argc, char *argv[]) { PrintNodes pn; df_traverse(root, pn, AllAttributesWrapper(), NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); return(0); } diff --git a/panda/src/event/event.h b/panda/src/event/event.h index 24f54cbc01..b4b801514a 100644 --- a/panda/src/event/event.h +++ b/panda/src/event/event.h @@ -15,7 +15,7 @@ class EventReceiver; //////////////////////////////////////////////////////////////////// -// Class : Event +// Class : Event // Description : A named event, possibly with parameters. Anyone in // any thread may throw an event at any time; there will // be one process responsible for reading and dispacting @@ -64,7 +64,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "Event", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/event/eventHandler.h b/panda/src/event/eventHandler.h index cd46f31f75..2cf550d40d 100644 --- a/panda/src/event/eventHandler.h +++ b/panda/src/event/eventHandler.h @@ -17,7 +17,7 @@ class EventQueue; //////////////////////////////////////////////////////////////////// -// Class : EventHandler +// Class : EventHandler // Description : A class to monitor events from the C++ side of // things. It maintains a set of "hooks", function // pointers assigned to event names, and calls the @@ -46,10 +46,10 @@ PUBLISHED: public: bool add_hook(const string &event_name, EventFunction *function); bool add_hook(const string &event_name, EventCallbackFunction *function, - void*); + void*); bool remove_hook(const string &event_name, EventFunction *function); bool remove_hook(const string &event_name, EventCallbackFunction *function, - void*); + void*); void remove_all_hooks(); @@ -77,7 +77,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "EventHandler", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/event/eventParameter.h b/panda/src/event/eventParameter.h index 5b44f43098..3f0c69ded1 100644 --- a/panda/src/event/eventParameter.h +++ b/panda/src/event/eventParameter.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EventParameter +// Class : EventParameter // Description : An optional parameter associated with an event. Each // event may have zero or more of these. Each parameter // stores a pointer to a TypedReferenceCount object, @@ -58,7 +58,7 @@ private: //////////////////////////////////////////////////////////////////// -// Class : EventStoreValue +// Class : EventStoreValue // Description : A handy class object for storing simple values (like // integers or strings) passed along with an Event. // This is essentially just a wrapper around whatever @@ -83,7 +83,7 @@ public: static void init_type(const string &type_name) { TypedReferenceCount::init_type(); register_type(_type_handle, type_name, - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/event/eventQueue.cxx b/panda/src/event/eventQueue.cxx index 66ca7a744c..ec495eac78 100644 --- a/panda/src/event/eventQueue.cxx +++ b/panda/src/event/eventQueue.cxx @@ -44,12 +44,12 @@ queue_event(CPT_Event event) { _queue.insert(event); if (event_cat.is_spam() || event_cat.is_debug()) { if (event->get_name() == "NewFrame") { - // Don't bother us with this particularly spammy event. - event_cat.spam() - << "Throwing event " << *event << "\n"; + // Don't bother us with this particularly spammy event. + event_cat.spam() + << "Throwing event " << *event << "\n"; } else { - event_cat.debug() - << "Throwing event " << *event << "\n"; + event_cat.debug() + << "Throwing event " << *event << "\n"; } } } diff --git a/panda/src/event/eventQueue.h b/panda/src/event/eventQueue.h index 1481774ce6..0bbdc62c45 100644 --- a/panda/src/event/eventQueue.h +++ b/panda/src/event/eventQueue.h @@ -18,7 +18,7 @@ #endif //////////////////////////////////////////////////////////////////// -// Class : EventQueue +// Class : EventQueue // Description : A queue of pending events. As events are thrown, // they are added to this queue; eventually, they will // be extracted out again by an EventHandler and diff --git a/panda/src/event/eventReceiver.h b/panda/src/event/eventReceiver.h index 7ddc6a662e..712da6561c 100644 --- a/panda/src/event/eventReceiver.h +++ b/panda/src/event/eventReceiver.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EventReceiver +// Class : EventReceiver // Description : An abstract base class for anything that might care // about receiving events. An object that might receive // an event should inherit from this class; each event diff --git a/panda/src/event/throw_event.I b/panda/src/event/throw_event.I index 18efd11620..b8cda3d077 100644 --- a/panda/src/event/throw_event.I +++ b/panda/src/event/throw_event.I @@ -16,7 +16,7 @@ throw_event(const string &event_name) { INLINE void throw_event(const string &event_name, - const EventParameter &p1) { + const EventParameter &p1) { Event *event = new Event(event_name); event->add_parameter(p1); EventQueue::get_global_event_queue()->queue_event(event); @@ -24,8 +24,8 @@ throw_event(const string &event_name, INLINE void throw_event(const string &event_name, - const EventParameter &p1, - const EventParameter &p2) { + const EventParameter &p1, + const EventParameter &p2) { Event *event = new Event(event_name); event->add_parameter(p1); event->add_parameter(p2); @@ -34,9 +34,9 @@ throw_event(const string &event_name, INLINE void throw_event(const string &event_name, - const EventParameter &p1, - const EventParameter &p2, - const EventParameter &p3) { + const EventParameter &p1, + const EventParameter &p2, + const EventParameter &p3) { Event *event = new Event(event_name); event->add_parameter(p1); event->add_parameter(p2); @@ -48,20 +48,20 @@ throw_event(const string &event_name, INLINE void throw_event_directly(EventHandler& handler, - const CPT_Event &event) { + const CPT_Event &event) { handler.dispatch_event(event); } INLINE void throw_event_directly(EventHandler& handler, - const string &event_name) { + const string &event_name) { handler.dispatch_event(new Event(event_name)); } INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1) { + const string &event_name, + const EventParameter &p1) { Event *event = new Event(event_name); event->add_parameter(p1); handler.dispatch_event(event); @@ -69,9 +69,9 @@ throw_event_directly(EventHandler& handler, INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1, - const EventParameter &p2) { + const string &event_name, + const EventParameter &p1, + const EventParameter &p2) { Event *event = new Event(event_name); event->add_parameter(p1); event->add_parameter(p2); @@ -80,10 +80,10 @@ throw_event_directly(EventHandler& handler, INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1, - const EventParameter &p2, - const EventParameter &p3) { + const string &event_name, + const EventParameter &p1, + const EventParameter &p2, + const EventParameter &p3) { Event *event = new Event(event_name); event->add_parameter(p1); event->add_parameter(p2); diff --git a/panda/src/event/throw_event.h b/panda/src/event/throw_event.h index 40000edcf2..181b9c0263 100644 --- a/panda/src/event/throw_event.h +++ b/panda/src/event/throw_event.h @@ -15,33 +15,33 @@ INLINE void throw_event(const CPT_Event &event); INLINE void throw_event(const string &event_name); INLINE void throw_event(const string &event_name, - const EventParameter &p1); + const EventParameter &p1); INLINE void throw_event(const string &event_name, - const EventParameter &p1, - const EventParameter &p2); + const EventParameter &p1, + const EventParameter &p2); INLINE void throw_event(const string &event_name, - const EventParameter &p1, - const EventParameter &p2, - const EventParameter &p3); + const EventParameter &p1, + const EventParameter &p2, + const EventParameter &p3); #include "eventHandler.h" INLINE void throw_event_directly(EventHandler& handler, - const CPT_Event &event); + const CPT_Event &event); INLINE void throw_event_directly(EventHandler& handler, - const string &event_name); + const string &event_name); INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1); + const string &event_name, + const EventParameter &p1); INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1, - const EventParameter &p2); + const string &event_name, + const EventParameter &p1, + const EventParameter &p2); INLINE void throw_event_directly(EventHandler& handler, - const string &event_name, - const EventParameter &p1, - const EventParameter &p2, - const EventParameter &p3); + const string &event_name, + const EventParameter &p1, + const EventParameter &p2, + const EventParameter &p3); #include "throw_event.I" diff --git a/panda/src/express/bigEndian.h b/panda/src/express/bigEndian.h index f7f6887365..d0ed6ea269 100644 --- a/panda/src/express/bigEndian.h +++ b/panda/src/express/bigEndian.h @@ -13,7 +13,7 @@ #include "reversedNumericData.h" //////////////////////////////////////////////////////////////////// -// Class : BigEndian +// Class : BigEndian // Description : BigEndian is a special class that automatically // reverses the byte-order of numeric values for // little-endian machines, and passes them through diff --git a/panda/src/express/checksumHashGenerator.h b/panda/src/express/checksumHashGenerator.h index 53946f67e3..91d5b858c6 100644 --- a/panda/src/express/checksumHashGenerator.h +++ b/panda/src/express/checksumHashGenerator.h @@ -11,7 +11,7 @@ #include "hashGeneratorBase.h" //////////////////////////////////////////////////////////////////// -// Class : ChecksumHashGenerator +// Class : ChecksumHashGenerator // Description : This is a specific kind of HashGenerator that simply // adds up all of the ints. Nothing fancy, and pretty // quick. diff --git a/panda/src/express/config_express.cxx b/panda/src/express/config_express.cxx index 5307fd3287..59b7dda54d 100644 --- a/panda/src/express/config_express.cxx +++ b/panda/src/express/config_express.cxx @@ -86,13 +86,13 @@ get_use_high_res_clock() { } const int patchfile_window_size = - config_express.GetInt("patchfile-window-size", 16); + config_express.GetInt("patchfile-window-size", 16); const int patchfile_increment_size = - config_express.GetInt("patchfile-increment-size", 8); + config_express.GetInt("patchfile-increment-size", 8); const int patchfile_buffer_size = - config_express.GetInt("patchfile-buffer-size", 4096); + config_express.GetInt("patchfile-buffer-size", 4096); const int patchfile_zone_size = - config_express.GetInt("patchfile-zone-size", 10000); + config_express.GetInt("patchfile-zone-size", 10000); diff --git a/panda/src/express/crypto_utils.cxx b/panda/src/express/crypto_utils.cxx index 83f2ee9537..c1463f8448 100644 --- a/panda/src/express/crypto_utils.cxx +++ b/panda/src/express/crypto_utils.cxx @@ -68,7 +68,7 @@ md5_a_file(const Filename &name, HashVal &ret) { string fs = name.to_os_specific(); FileSource f(fs.c_str(), true, - new HashFilter(md5, new HexEncoder(new FileSink(os)))); + new HashFilter(md5, new HexEncoder(new FileSink(os)))); istringstream is(os.str()); diff --git a/panda/src/express/datagram.cxx b/panda/src/express/datagram.cxx index 79a3baab7f..9508a074d3 100644 --- a/panda/src/express/datagram.cxx +++ b/panda/src/express/datagram.cxx @@ -47,19 +47,19 @@ dump_hex(ostream &out) const { size_t p; for (p = line; p < line + 16; p++) { if (p < _message.length()) { - char hex[12]; - sprintf(hex, " %02x", ((unsigned int)_message[p]) & 0xff); - out << hex; + char hex[12]; + sprintf(hex, " %02x", ((unsigned int)_message[p]) & 0xff); + out << hex; } else { - out << " "; + out << " "; } } out << " "; for (p = line; p < line + 16 && p < _message.length(); p++) { if (isgraph(_message[p]) || _message[p] == ' ') { - out << (char)_message[p]; + out << (char)_message[p]; } else { - out << "."; + out << "."; } } out << "\n"; diff --git a/panda/src/express/datagram.h b/panda/src/express/datagram.h index 75cac9360f..3c5f184108 100644 --- a/panda/src/express/datagram.h +++ b/panda/src/express/datagram.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : Datagram +// Class : Datagram // Description : An ordered list of data elements, formatted in memory // for transmission over a socket or writing to a data // file. @@ -95,7 +95,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "Datagram", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/express/datagramGenerator.h b/panda/src/express/datagramGenerator.h index ecac48fd9e..2d724b1cfb 100644 --- a/panda/src/express/datagramGenerator.h +++ b/panda/src/express/datagramGenerator.h @@ -10,7 +10,7 @@ #include "datagram.h" //////////////////////////////////////////////////////////////////// -// Class : DatagramGenerator +// Class : DatagramGenerator // Description : This class defines the abstract interace to any // source of datagrams, whether it be from a file or // from the net diff --git a/panda/src/express/datagramInputFile.h b/panda/src/express/datagramInputFile.h index a3a659203f..de556233c7 100644 --- a/panda/src/express/datagramInputFile.h +++ b/panda/src/express/datagramInputFile.h @@ -12,7 +12,7 @@ #include "filename.h" //////////////////////////////////////////////////////////////////// -// Class : DatagramInputFile +// Class : DatagramInputFile // Description : This class can be used to read a binary file that // consists of an arbitrary header followed by a number // of datagrams. diff --git a/panda/src/express/datagramIterator.I b/panda/src/express/datagramIterator.I index f8818ec9a8..ab1ee91005 100644 --- a/panda/src/express/datagramIterator.I +++ b/panda/src/express/datagramIterator.I @@ -82,7 +82,7 @@ get_bool() { INLINE PN_int8 DatagramIterator:: get_int8() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int8 tempvar = (PN_int8)_datagram->get_message()[_current_index]; _current_index++; @@ -98,7 +98,7 @@ get_int8() { INLINE PN_uint8 DatagramIterator:: get_uint8() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint8 tempvar = (PN_uint8)_datagram->get_message()[_current_index]; _current_index++; @@ -114,7 +114,7 @@ get_uint8() { INLINE PN_int16 DatagramIterator:: get_int16() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int16 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -132,7 +132,7 @@ get_int16() { INLINE PN_int32 DatagramIterator:: get_int32() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int32 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -150,7 +150,7 @@ get_int32() { INLINE PN_int64 DatagramIterator:: get_int64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int64 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -168,7 +168,7 @@ get_int64() { INLINE PN_uint16 DatagramIterator:: get_uint16() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint16 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -186,7 +186,7 @@ get_uint16() { INLINE PN_uint32 DatagramIterator:: get_uint32() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint32 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -204,7 +204,7 @@ get_uint32() { INLINE PN_uint64 DatagramIterator:: get_uint64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint64 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -229,7 +229,7 @@ get_float32() { // is different, we will have to convert. nassertr(sizeof(float) == 4, 0.0); nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0.0); + _current_index < _datagram->get_length(), 0.0); float tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -247,7 +247,7 @@ get_float32() { INLINE PN_float64 DatagramIterator:: get_float64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0.0); + _current_index < _datagram->get_length(), 0.0); PN_float64 tempvar; LittleEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -265,7 +265,7 @@ get_float64() { INLINE PN_int16 DatagramIterator:: get_be_int16() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int16 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -283,7 +283,7 @@ get_be_int16() { INLINE PN_int32 DatagramIterator:: get_be_int32() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int32 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -301,7 +301,7 @@ get_be_int32() { INLINE PN_int64 DatagramIterator:: get_be_int64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_int64 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -319,7 +319,7 @@ get_be_int64() { INLINE PN_uint16 DatagramIterator:: get_be_uint16() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint16 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -337,7 +337,7 @@ get_be_uint16() { INLINE PN_uint32 DatagramIterator:: get_be_uint32() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint32 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -355,7 +355,7 @@ get_be_uint32() { INLINE PN_uint64 DatagramIterator:: get_be_uint64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0); + _current_index < _datagram->get_length(), 0); PN_uint64 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -380,7 +380,7 @@ get_be_float32() { // is different, we will have to convert. nassertr(sizeof(float) == 4, 0.0); nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0.0); + _current_index < _datagram->get_length(), 0.0); float tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -398,7 +398,7 @@ get_be_float32() { INLINE PN_float64 DatagramIterator:: get_be_float64() { nassertr(_datagram != (const Datagram *)NULL && - _current_index < _datagram->get_length(), 0.0); + _current_index < _datagram->get_length(), 0.0); PN_float64 tempvar; BigEndian s(_datagram->get_message(), _current_index, sizeof(tempvar)); @@ -430,7 +430,7 @@ skip_bytes(size_t size) { INLINE string DatagramIterator:: get_remaining_bytes() const { nassertr(_datagram != (const Datagram *)NULL && - _current_index <= _datagram->get_length(), ""); + _current_index <= _datagram->get_length(), ""); return _datagram->get_message().substr(_current_index); } diff --git a/panda/src/express/datagramIterator.cxx b/panda/src/express/datagramIterator.cxx index 0bd4f071bf..0a6c671451 100644 --- a/panda/src/express/datagramIterator.cxx +++ b/panda/src/express/datagramIterator.cxx @@ -19,7 +19,7 @@ get_string() { PN_uint16 s_len = get_uint16(); nassertr(_datagram != (const Datagram *)NULL && - _current_index + s_len <= _datagram->get_length(), ""); + _current_index + s_len <= _datagram->get_length(), ""); string s = _datagram->get_message().substr(_current_index, s_len); @@ -40,7 +40,7 @@ get_string() { string DatagramIterator:: get_fixed_string(size_t size) { nassertr(_datagram != (const Datagram *)NULL && - _current_index + size <= _datagram->get_length(), ""); + _current_index + size <= _datagram->get_length(), ""); string s = _datagram->get_message().substr(_current_index, size); @@ -60,7 +60,7 @@ string DatagramIterator:: extract_bytes(size_t size) { nassertr((int)size >= 0, ""); nassertr(_datagram != (const Datagram *)NULL && - _current_index + size <= _datagram->get_length(), ""); + _current_index + size <= _datagram->get_length(), ""); int start = _current_index; _current_index += size; diff --git a/panda/src/express/datagramIterator.h b/panda/src/express/datagramIterator.h index f5e9780f8b..5535305db8 100644 --- a/panda/src/express/datagramIterator.h +++ b/panda/src/express/datagramIterator.h @@ -11,7 +11,7 @@ #include "numeric_types.h" //////////////////////////////////////////////////////////////////// -// Class : DatagramIterator +// Class : DatagramIterator // Description : A class to retrieve the individual data elements // previously stored in a Datagram. Elements may be // retrieved one at a time; it is up to the caller to diff --git a/panda/src/express/datagramOutputFile.h b/panda/src/express/datagramOutputFile.h index 0ea37b34d2..f318b5835c 100644 --- a/panda/src/express/datagramOutputFile.h +++ b/panda/src/express/datagramOutputFile.h @@ -12,7 +12,7 @@ #include "filename.h" //////////////////////////////////////////////////////////////////// -// Class : DatagramOutputFile +// Class : DatagramOutputFile // Description : This class can be used to write a binary file that // consists of an arbitrary header followed by a number // of datagrams. diff --git a/panda/src/express/datagramSink.h b/panda/src/express/datagramSink.h index 6ea3b9929f..70dc38f083 100644 --- a/panda/src/express/datagramSink.h +++ b/panda/src/express/datagramSink.h @@ -10,7 +10,7 @@ #include "datagram.h" //////////////////////////////////////////////////////////////////// -// Class : DatagramSink +// Class : DatagramSink // Description : This class defines the abstract interface to sending // datagrams to any target, whether it be into a file // or across the net diff --git a/panda/src/express/error_utils.cxx b/panda/src/express/error_utils.cxx index 57f31a24bc..85361923ad 100644 --- a/panda/src/express/error_utils.cxx +++ b/panda/src/express/error_utils.cxx @@ -178,7 +178,7 @@ handle_socket_error(void) { default: if (express_cat.is_debug()) express_cat.debug() - << "handle_socket_error - unknown error: " << err << endl; + << "handle_socket_error - unknown error: " << err << endl; return "Unknown WSA error"; } #endif @@ -226,14 +226,14 @@ get_network_error(void) { return EU_error_network_remote_host_no_response; case 0: if (express_cat.is_debug()) - express_cat.debug() - << "get_network_error() - WSA error = 0 - error : " - << strerror(errno) << endl; + express_cat.debug() + << "get_network_error() - WSA error = 0 - error : " + << strerror(errno) << endl; return EU_error_abort; default: if (express_cat.is_debug()) - express_cat.debug() - << "get_network_error() - unknown error: " << err << endl; + express_cat.debug() + << "get_network_error() - unknown error: " << err << endl; return EU_error_abort; } #endif diff --git a/panda/src/express/get_config_path.cxx b/panda/src/express/get_config_path.cxx index 2feeec7298..2022bbc44c 100644 --- a/panda/src/express/get_config_path.cxx +++ b/panda/src/express/get_config_path.cxx @@ -36,17 +36,17 @@ get_config_path(const string &config_var_name, DSearchPath *&static_ptr) { config_express.GetAll(config_var_name, all_defs); if (!all_defs.empty()) { Config::ConfigTable::Symbol::reverse_iterator si = - all_defs.rbegin(); + all_defs.rbegin(); (*static_ptr).append_path(ExecutionEnvironment::expand_string((*si).Val())); ++si; while (si != all_defs.rend()) { - (*static_ptr).append_path(ExecutionEnvironment::expand_string((*si).Val())); - ++si; + (*static_ptr).append_path(ExecutionEnvironment::expand_string((*si).Val())); + ++si; } } if (express_cat.is_debug()) { express_cat.debug() - << config_var_name << " is " << *static_ptr << "\n"; + << config_var_name << " is " << *static_ptr << "\n"; } } diff --git a/panda/src/express/hashGeneratorBase.h b/panda/src/express/hashGeneratorBase.h index ad08c399ee..b0c3b0cb93 100644 --- a/panda/src/express/hashGeneratorBase.h +++ b/panda/src/express/hashGeneratorBase.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : HashGeneratorBase +// Class : HashGeneratorBase // Description : This is the base class for a number of classes that // generate arbitrary hash numbers for complex objects, // based fundamentally on a sequence of integers. diff --git a/panda/src/express/hashVal.I b/panda/src/express/hashVal.I index 4a94143a92..f33c1a7b1c 100644 --- a/panda/src/express/hashVal.I +++ b/panda/src/express/hashVal.I @@ -22,9 +22,9 @@ HashVal(void) { INLINE bool HashVal:: operator == (const HashVal &other) const { return (hv[0] == other.hv[0] && - hv[1] == other.hv[1] && - hv[2] == other.hv[2] && - hv[3] == other.hv[3]); + hv[1] == other.hv[1] && + hv[2] == other.hv[2] && + hv[3] == other.hv[3]); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/express/hashVal.h b/panda/src/express/hashVal.h index 6e66dbad5b..f4069d69c1 100644 --- a/panda/src/express/hashVal.h +++ b/panda/src/express/hashVal.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : HashVal +// Class : HashVal // Description : A sixteen-byte hash value sent to the crypt library. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEXPRESS HashVal { diff --git a/panda/src/express/indent.I b/panda/src/express/indent.I index ec28bc1fde..28bede4630 100644 --- a/panda/src/express/indent.I +++ b/panda/src/express/indent.I @@ -14,9 +14,9 @@ template void write_long_list(ostream &out, int indent_level, - InputIterator first, InputIterator last, - string first_prefix, string later_prefix, - int max_col) { + InputIterator first, InputIterator last, + string first_prefix, string later_prefix, + int max_col) { if (later_prefix.empty()) { later_prefix = first_prefix; } @@ -41,12 +41,12 @@ write_long_list(ostream &out, int indent_level, col += 1 + str.length(); if (col > max_col) { - out << "\n"; - indent(out, indent_level) << later_prefix << str; - col = indent_level + later_prefix.length() + str.length(); + out << "\n"; + indent(out, indent_level) << later_prefix << str; + col = indent_level + later_prefix.length() + str.length(); } else { - out << " " << str; + out << " " << str; } ++first; diff --git a/panda/src/express/indent.h b/panda/src/express/indent.h index da1c6a6a35..146aebfceb 100644 --- a/panda/src/express/indent.h +++ b/panda/src/express/indent.h @@ -30,10 +30,10 @@ indent(ostream &out, int indent_level); template void write_long_list(ostream &out, int indent_level, - InputIterator ifirst, InputIterator ilast, - string first_prefix = "", - string later_prefix = "", - int max_col = 72); + InputIterator ifirst, InputIterator ilast, + string first_prefix = "", + string later_prefix = "", + int max_col = 72); #include "indent.I" diff --git a/panda/src/express/littleEndian.h b/panda/src/express/littleEndian.h index b9aa0614f1..653c413fc4 100644 --- a/panda/src/express/littleEndian.h +++ b/panda/src/express/littleEndian.h @@ -13,7 +13,7 @@ #include "reversedNumericData.h" //////////////////////////////////////////////////////////////////// -// Class : LittleEndian +// Class : LittleEndian // Description : LittleEndian is a special class that automatically // reverses the byte-order of numeric values for // big-endian machines, and passes them through diff --git a/panda/src/express/memoryUsage.cxx b/panda/src/express/memoryUsage.cxx index 2a51f66b8b..41bccfc401 100644 --- a/panda/src/express/memoryUsage.cxx +++ b/panda/src/express/memoryUsage.cxx @@ -75,7 +75,7 @@ determine_dynamic_type() { // TypedReferenceCount, then we can directly downcast to get the // TypedObject pointer. if (_static_type.is_derived_from(TypedReferenceCount::get_class_type())) { - _typed_ptr = (TypedReferenceCount *)_ptr; + _typed_ptr = (TypedReferenceCount *)_ptr; } } @@ -87,14 +87,14 @@ determine_dynamic_type() { TypeHandle got_type = _typed_ptr->get_type(); if (got_type == TypeHandle::none()) { - express_cat.warning() - << "Found an unregistered type in a " << _static_type - << " pointer:\n" - << "Check derived types of " << _static_type - << " and make sure that all are being initialized.\n"; - _dynamic_type = _static_type; - _reconsider_dynamic_type = false; - return; + express_cat.warning() + << "Found an unregistered type in a " << _static_type + << " pointer:\n" + << "Check derived types of " << _static_type + << " and make sure that all are being initialized.\n"; + _dynamic_type = _static_type; + _reconsider_dynamic_type = false; + return; } update_type_handle(_dynamic_type, got_type); @@ -228,7 +228,7 @@ void MemoryUsage::AgeHistogram:: show() const { for (int i = 0; i < num_buckets - 1; i++) { nout << _cutoff[i] << " to " << _cutoff[i + 1] << " seconds old : " - << _counts[i] << " pointers.\n"; + << _counts[i] << " pointers.\n"; } nout << _cutoff[num_buckets - 1] << " seconds old and up : " << _counts[num_buckets - 1] << " pointers.\n"; @@ -396,8 +396,8 @@ ns_update_type(ReferenceCount *ptr, TypeHandle type) { ti = _table.find(ptr); if (ti == _table.end()) { express_cat.error() - << "Attempt to update type to " << type << " for unrecorded pointer " - << (void *)ptr << "!\n"; + << "Attempt to update type to " << type << " for unrecorded pointer " + << (void *)ptr << "!\n"; return; } @@ -424,9 +424,9 @@ ns_update_type(ReferenceCount *ptr, TypedObject *typed_ptr) { ti = _table.find(ptr); if (ti == _table.end()) { express_cat.error() - << "Attempt to update type to " << typed_ptr->get_type() - << " for unrecorded pointer " - << (void *)ptr << "!\n"; + << "Attempt to update type to " << typed_ptr->get_type() + << " for unrecorded pointer " + << (void *)ptr << "!\n"; return; } @@ -449,9 +449,9 @@ ns_remove_pointer(ReferenceCount *ptr) { ti = _table.find(ptr); if (ti == _table.end()) { express_cat.error() - << "Attempt to remove pointer " << (void *)ptr - << ", not in table.\n" - << "Possibly a double-destruction.\n"; + << "Attempt to remove pointer " << (void *)ptr + << ", not in table.\n" + << "Possibly a double-destruction.\n"; nassertv(false); return; } @@ -502,7 +502,7 @@ ns_get_pointers(MemoryUsagePointers &result) { MemoryInfo &info = (*ti).second; if (info._freeze_index == _freeze_index) { result.add_entry(info._ptr, info._typed_ptr, info.get_type(), - now - info._time); + now - info._time); } } } @@ -526,9 +526,9 @@ ns_get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type) { if (info._freeze_index == _freeze_index) { TypeHandle info_type = info.get_type(); if (info_type != TypeHandle::none() && - info_type.is_derived_from(type)) { - result.add_entry(info._ptr, info._typed_ptr, info_type, - now - info._time); + info_type.is_derived_from(type)) { + result.add_entry(info._ptr, info._typed_ptr, info_type, + now - info._time); } } } @@ -543,7 +543,7 @@ ns_get_pointers_of_type(MemoryUsagePointers &result, TypeHandle type) { //////////////////////////////////////////////////////////////////// void MemoryUsage:: ns_get_pointers_of_age(MemoryUsagePointers &result, - double from, double to) { + double from, double to) { nassertv(_track_memory_usage); result.clear(); @@ -554,8 +554,8 @@ ns_get_pointers_of_age(MemoryUsagePointers &result, if (info._freeze_index == _freeze_index) { double age = now - info._time; if ((age >= from && age <= to) || - (age >= to && age <= from)) { - result.add_entry(info._ptr, info._typed_ptr, info.get_type(), age); + (age >= to && age <= from)) { + result.add_entry(info._ptr, info._typed_ptr, info.get_type(), age); } } } @@ -595,9 +595,9 @@ ns_get_pointers_with_zero_count(MemoryUsagePointers &result) { MemoryInfo &info = (*ti).second; if (info._freeze_index == _freeze_index) { if ((*ti).first->get_ref_count() == 0) { - (*ti).first->ref(); - result.add_entry(info._ptr, info._typed_ptr, info.get_type(), - now - info._time); + (*ti).first->ref(); + result.add_entry(info._ptr, info._typed_ptr, info.get_type(), + now - info._time); } } } diff --git a/panda/src/express/memoryUsage.h b/panda/src/express/memoryUsage.h index ff1dbf1895..f5e1c171f8 100644 --- a/panda/src/express/memoryUsage.h +++ b/panda/src/express/memoryUsage.h @@ -16,7 +16,7 @@ class ReferenceCount; class MemoryUsagePointers; //////////////////////////////////////////////////////////////////// -// Class : MemoryUsage +// Class : MemoryUsage // Description : This class is used strictly for debugging purposes, // specifically for tracking memory leaks of // reference-counted objects: it keeps a record of every @@ -53,9 +53,9 @@ PUBLISHED: INLINE static int get_num_pointers(); INLINE static void get_pointers(MemoryUsagePointers &result); INLINE static void get_pointers_of_type(MemoryUsagePointers &result, - TypeHandle type); + TypeHandle type); INLINE static void get_pointers_of_age(MemoryUsagePointers &result, - double from, double to); + double from, double to); INLINE static void get_pointers_with_zero_count(MemoryUsagePointers &result); INLINE static void freeze(); @@ -77,9 +77,9 @@ private: int ns_get_num_pointers(); void ns_get_pointers(MemoryUsagePointers &result); void ns_get_pointers_of_type(MemoryUsagePointers &result, - TypeHandle type); + TypeHandle type); void ns_get_pointers_of_age(MemoryUsagePointers &result, - double from, double to); + double from, double to); void ns_get_pointers_with_zero_count(MemoryUsagePointers &result); void ns_freeze(); diff --git a/panda/src/express/memoryUsagePointers.cxx b/panda/src/express/memoryUsagePointers.cxx index 2bd3385cd0..fd51e8158f 100644 --- a/panda/src/express/memoryUsagePointers.cxx +++ b/panda/src/express/memoryUsagePointers.cxx @@ -148,7 +148,7 @@ clear() { //////////////////////////////////////////////////////////////////// void MemoryUsagePointers:: add_entry(ReferenceCount *ptr, TypedObject *typed_ptr, - TypeHandle type, double age) { + TypeHandle type, double age) { // We can't safly add pointers with a zero reference count. They // might be statically-allocated or something, and if we try to add // them they'll try to destruct when the PointerTo later goes away. diff --git a/panda/src/express/memoryUsagePointers.h b/panda/src/express/memoryUsagePointers.h index b76689f90d..aa6c7f835a 100644 --- a/panda/src/express/memoryUsagePointers.h +++ b/panda/src/express/memoryUsagePointers.h @@ -16,7 +16,7 @@ #ifndef NDEBUG //////////////////////////////////////////////////////////////////// -// Class : MemoryUsagePointers +// Class : MemoryUsagePointers // Description : This is a list of pointers returned by a MemoryUsage // object in response to some query. // @@ -52,12 +52,12 @@ PUBLISHED: private: void add_entry(ReferenceCount *ptr, TypedObject *typed_ptr, - TypeHandle type, double age); + TypeHandle type, double age); class Entry { public: INLINE Entry(ReferenceCount *ptr, TypedObject *typed_ptr, - TypeHandle type, double age); + TypeHandle type, double age); INLINE Entry(const Entry ©); INLINE void operator = (const Entry ©); INLINE ~Entry(); diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index a5c2ab5de9..1dce7f51a0 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -77,9 +77,9 @@ reset(void) { // Function: Multifile::Memfile::parse_header_length // Access: Public // Description: Fills up _datagram until it has sizeof(_header_length) -// bytes and then extracts _header_length from _datagram. -// Returns true when this has been accomplished. -// Advances start to end of header_length. +// bytes and then extracts _header_length from _datagram. +// Returns true when this has been accomplished. +// Advances start to end of header_length. //////////////////////////////////////////////////////////////////// bool Multifile::Memfile:: parse_header_length(char *&start, int &size) { @@ -121,7 +121,7 @@ parse_header_length(char *&start, int &size) { // Function: Multifile::Memfile::parse_header // Access: Public // Description: Returns true when a complete header has been parsed. -// Advances the start pointer to the end of the header. +// Advances the start pointer to the end of the header. //////////////////////////////////////////////////////////////////// bool Multifile::Memfile:: parse_header(char *&start, int& size) { @@ -152,7 +152,7 @@ parse_header(char *&start, int& size) { PN_int32 header_length = di.get_int32(); nassertr(header_length == _header_length, false); _name = di.extract_bytes(_header_length - _header_length_buf_length - - sizeof(_buffer_length)); + sizeof(_buffer_length)); _buffer_length = di.get_int32(); nassertr(_buffer_length >= 0, false); @@ -191,7 +191,7 @@ read(const Filename &name) { << "Multifile::Memfile::read() - Reading file: " << name << endl; _header_length = name.length() + sizeof(_header_length) + - sizeof(_buffer_length); + sizeof(_buffer_length); _name = name; // Determine the length of the file @@ -298,8 +298,8 @@ write_to_multifile(ofstream &write_stream) { // Function: Multifile::Memfile::write // Access: Public // Description: Returns true when the memfile has been parsed and -// written to disk. -// Advances the start pointer as it writes. +// written to disk. +// Advances the start pointer as it writes. //////////////////////////////////////////////////////////////////// int Multifile::Memfile:: write(char *&start, int &size, const Filename &rel_path) { @@ -380,7 +380,7 @@ Multifile:: // Function: Multifile::evaluate // Access: Public // Description: Checks for a valid compressed or uncompressed -// Multifile. +// Multifile. //////////////////////////////////////////////////////////////////// int Multifile:: evaluate(const char *start, int size) { @@ -434,15 +434,15 @@ parse_header(char *&start, int &size) { PN_uint32 magic_number = di.get_uint32(); if (magic_number != _magic_number) { express_cat.error() - << "Multifile::parse_header() - Invalid magic number: " - << magic_number << " (" << _magic_number << ")" << endl; + << "Multifile::parse_header() - Invalid magic number: " + << magic_number << " (" << _magic_number << ")" << endl; return EU_error_abort; } _num_mfiles = di.get_int32(); if (_num_mfiles <= 0) { express_cat.debug() - << "Multifile::parse_header() - No memfiles in multifile" - << endl; + << "Multifile::parse_header() - No memfiles in multifile" + << endl; return EU_error_file_empty; } @@ -588,8 +588,8 @@ write(Filename name) { // Function: Multifile::write // Access: Public // Description: Returns true when all the memfiles have been -// written. -// Advances the start pointer as it writes. +// written. +// Advances the start pointer as it writes. //////////////////////////////////////////////////////////////////// int Multifile:: write(char *&start, int &size, const Filename &rel_path) { @@ -612,8 +612,8 @@ write(char *&start, int &size, const Filename &rel_path) { _current_mfile = NULL; } else { if (write_ret < 0) { - express_cat.error() - << "Multifile::write() - bad write: " << write_ret << endl; + express_cat.error() + << "Multifile::write() - bad write: " << write_ret << endl; } return write_ret; } @@ -626,7 +626,7 @@ write(char *&start, int &size, const Filename &rel_path) { // Function: Multifile::write_extract // Access: Public // Description: Returns true when entire Multifile has been -// extracted to disk files. +// extracted to disk files. //////////////////////////////////////////////////////////////////// bool Multifile:: write_extract(char *&start, int &size, const Filename &rel_path) { diff --git a/panda/src/express/namable.h b/panda/src/express/namable.h index 8095fac017..6a3ede4f6b 100644 --- a/panda/src/express/namable.h +++ b/panda/src/express/namable.h @@ -11,7 +11,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : Namable +// Class : Namable // Description : A base class for all things which can have a name. // The name is either empty or nonempty, but it is never // NULL. @@ -49,7 +49,7 @@ private: INLINE ostream &operator << (ostream &out, const Namable &n); /////////////////////////////////////////////////////////////////// -// Class : NamableOrderByName +// Class : NamableOrderByName // Description : An STL function object for sorting an array of // pointers to Namables into order by name. Returns // true if the objects are in sorted order, false diff --git a/panda/src/express/nativeNumericData.h b/panda/src/express/nativeNumericData.h index f372485913..a3f91cfb6b 100644 --- a/panda/src/express/nativeNumericData.h +++ b/panda/src/express/nativeNumericData.h @@ -11,7 +11,7 @@ #include // for memcpy() //////////////////////////////////////////////////////////////////// -// Class : NativeNumericData +// Class : NativeNumericData // Description : NativeNumericData and ReversedNumericData work // together to provide a sneaky interface for // automatically byte-swapping numbers, when necessary, diff --git a/panda/src/express/pointerTo.I b/panda/src/express/pointerTo.I index 1ba12071e4..63862c105a 100644 --- a/panda/src/express/pointerTo.I +++ b/panda/src/express/pointerTo.I @@ -62,16 +62,16 @@ reassign(To *ptr) { _ptr->ref(); #ifndef NDEBUG if (MemoryUsage::get_track_memory_usage()) { - // Make sure the MemoryUsage record knows what the TypeHandle - // is, if we know it ourselves. - TypeHandle type = get_type_handle(To); - if (type == TypeHandle::none()) { - do_init_type(To); - type = get_type_handle(To); - } - if (type != TypeHandle::none()) { - MemoryUsage::update_type(_ptr, type); - } + // Make sure the MemoryUsage record knows what the TypeHandle + // is, if we know it ourselves. + TypeHandle type = get_type_handle(To); + if (type == TypeHandle::none()) { + do_init_type(To); + type = get_type_handle(To); + } + if (type != TypeHandle::none()) { + MemoryUsage::update_type(_ptr, type); + } } #endif } diff --git a/panda/src/express/pointerTo.h b/panda/src/express/pointerTo.h index b548735cdc..a0e60c8550 100644 --- a/panda/src/express/pointerTo.h +++ b/panda/src/express/pointerTo.h @@ -65,7 +65,7 @@ //////////////////////////////////////////////////////////////////// -// Class : PointerToBase +// Class : PointerToBase // Description : This is the base class for PointerTo and // ConstPointerTo. Don't try to use it directly; use // either derived class instead. @@ -125,7 +125,7 @@ INLINE ostream &operator <<(ostream &out, const PointerToBase &pointer) { } //////////////////////////////////////////////////////////////////// -// Class : PointerTo +// Class : PointerTo // Description : PointerTo is a template class which implements a // smart pointer to an object derived from // ReferenceCount. @@ -170,7 +170,7 @@ PUBLISHED: //////////////////////////////////////////////////////////////////// -// Class : ConstPointerTo +// Class : ConstPointerTo // Description : A ConstPointerTo is similar to a PointerTo, except it // keeps a const pointer to the thing. // diff --git a/panda/src/express/referenceCount.I b/panda/src/express/referenceCount.I index 69c3dc9975..56f64620f1 100644 --- a/panda/src/express/referenceCount.I +++ b/panda/src/express/referenceCount.I @@ -301,9 +301,9 @@ unref_delete(RefCountType *ptr) { // freeing up the memory it uses. if (!get_never_destruct()) { - // Furthermore, if we have never-destruct set, we don't even - // call the destructor. - ptr->~RefCountType(); + // Furthermore, if we have never-destruct set, we don't even + // call the destructor. + ptr->~RefCountType(); } return; } @@ -365,8 +365,8 @@ void RefCountProxy:: init_type() { do_init_type(Base); register_type(_type_handle, - "RefCountProxy<" + get_type_handle(Base).get_name() + ">", - get_type_handle(Base)); + "RefCountProxy<" + get_type_handle(Base).get_name() + ">", + get_type_handle(Base)); } @@ -411,5 +411,5 @@ init_type() { ReferenceCount::init_type(); _type_handle = register_dynamic_type("RefCountObj<" + base_name + ">", - base_type, ReferenceCount::get_class_type()); + base_type, ReferenceCount::get_class_type()); } diff --git a/panda/src/express/referenceCount.h b/panda/src/express/referenceCount.h index 9263f1f8eb..cf775bb918 100644 --- a/panda/src/express/referenceCount.h +++ b/panda/src/express/referenceCount.h @@ -28,7 +28,7 @@ #endif /////////////////////////////////////////////////////////////////// -// Class : ReferenceCount +// Class : ReferenceCount // Description : A base class for all things that want to be // reference-counted. ReferenceCount works in // conjunction with PointerTo to automatically delete @@ -71,7 +71,7 @@ template INLINE void unref_delete(RefCountType *ptr); /////////////////////////////////////////////////////////////////// -// Class : RefCountProxy +// Class : RefCountProxy // Description : A "proxy" to use to make a reference-countable object // whenever the object cannot inherit from // ReferenceCount for some reason. RefCountPr @@ -106,7 +106,7 @@ private: /////////////////////////////////////////////////////////////////// -// Class : RefCountObj +// Class : RefCountObj // Description : Another kind of proxy, similar to RefCountProxy. // This one works by inheriting from the indicated base // type, giving it an is-a relation instead of a has-a diff --git a/panda/src/express/reversedNumericData.h b/panda/src/express/reversedNumericData.h index ce74ad3062..91da440dd3 100644 --- a/panda/src/express/reversedNumericData.h +++ b/panda/src/express/reversedNumericData.h @@ -15,7 +15,7 @@ static const int max_numeric_size = 8; //////////////////////////////////////////////////////////////////// -// Class : ReversedNumericData +// Class : ReversedNumericData // Description : NativeNumericData and ReversedNumericData work // together to provide a sneaky interface for // automatically byte-swapping numbers, when necessary, diff --git a/panda/src/express/tokenBoard.I b/panda/src/express/tokenBoard.I index cb1570252b..721aae3a8a 100644 --- a/panda/src/express/tokenBoard.I +++ b/panda/src/express/tokenBoard.I @@ -17,7 +17,7 @@ // Function: TokenBoard::is_done_token() // Access: Public // Description: Returns true if the indicated token id is on the -// done queue, false otherwise. +// done queue, false otherwise. //////////////////////////////////////////////////////////////////// template bool TokenBoard:: diff --git a/panda/src/express/trueClock.cxx b/panda/src/express/trueClock.cxx index 7275777ed9..45273dc1a3 100644 --- a/panda/src/express/trueClock.cxx +++ b/panda/src/express/trueClock.cxx @@ -66,7 +66,7 @@ TrueClock() { if (_frequency <= 0) { express_cat.error() - << "TrueClock::get_real_time() - frequency is negative!" << endl; + << "TrueClock::get_real_time() - frequency is negative!" << endl; _has_high_res = false; } diff --git a/panda/src/express/typeHandle.I b/panda/src/express/typeHandle.I index 3ea5156f11..39ae443ecc 100644 --- a/panda/src/express/typeHandle.I +++ b/panda/src/express/typeHandle.I @@ -229,14 +229,14 @@ register_type(TypeHandle &type_handle, const string &name) { } INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1) { + TypeHandle parent1) { if (TypeRegistry::ptr()->register_type(type_handle, name)) { TypeRegistry::ptr()->record_derivation(type_handle, parent1); } } INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2) { + TypeHandle parent1, TypeHandle parent2) { if (TypeRegistry::ptr()->register_type(type_handle, name)) { TypeRegistry::ptr()->record_derivation(type_handle, parent1); TypeRegistry::ptr()->record_derivation(type_handle, parent2); @@ -244,8 +244,8 @@ register_type(TypeHandle &type_handle, const string &name, } INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3) { + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3) { if (TypeRegistry::ptr()->register_type(type_handle, name)) { TypeRegistry::ptr()->record_derivation(type_handle, parent1); TypeRegistry::ptr()->record_derivation(type_handle, parent2); @@ -254,8 +254,8 @@ register_type(TypeHandle &type_handle, const string &name, } INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3, TypeHandle parent4) { + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3, TypeHandle parent4) { if (TypeRegistry::ptr()->register_type(type_handle, name)) { TypeRegistry::ptr()->record_derivation(type_handle, parent1); TypeRegistry::ptr()->record_derivation(type_handle, parent2); @@ -285,7 +285,7 @@ register_dynamic_type(const string &name, TypeHandle parent1) { } INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2) { + TypeHandle parent1, TypeHandle parent2) { TypeHandle type_handle = TypeRegistry::ptr()->register_dynamic_type(name); TypeRegistry::ptr()->record_derivation(type_handle, parent1); @@ -294,8 +294,8 @@ register_dynamic_type(const string &name, } INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3) { + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3) { TypeHandle type_handle = TypeRegistry::ptr()->register_dynamic_type(name); TypeRegistry::ptr()->record_derivation(type_handle, parent1); @@ -305,8 +305,8 @@ register_dynamic_type(const string &name, } INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3, TypeHandle parent4) { + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3, TypeHandle parent4) { TypeHandle type_handle = TypeRegistry::ptr()->register_dynamic_type(name); TypeRegistry::ptr()->record_derivation(type_handle, parent1); @@ -367,7 +367,7 @@ _dcast(WantType *, TypedObject *ptr) { << " to " << want_handle << "\n"; if (ptr->get_type() == TypedObject::get_class_type()) { express_cat->error(false) - << "Perhaps pointer was inadvertently deleted?\n"; + << "Perhaps pointer was inadvertently deleted?\n"; } return (WantType *)NULL; } @@ -400,7 +400,7 @@ _dcast(WantType *, const TypedObject *ptr) { << " to " << want_handle << "\n"; if (ptr->get_type() == TypedObject::get_class_type()) { express_cat->error(false) - << "Perhaps pointer was inadvertently deleted?\n"; + << "Perhaps pointer was inadvertently deleted?\n"; } return (const WantType *)NULL; } diff --git a/panda/src/express/typeHandle.h b/panda/src/express/typeHandle.h index 5ca4b36657..934d00e42e 100644 --- a/panda/src/express/typeHandle.h +++ b/panda/src/express/typeHandle.h @@ -62,7 +62,7 @@ class TypedObject; //////////////////////////////////////////////////////////////////// -// Class : TypeHandle +// Class : TypeHandle // Description : TypeHandle is the identifier used to differentiate // C++ class types. Any C++ classes that inherit from // some base class, and must be differentiated at run @@ -90,7 +90,7 @@ PUBLISHED: INLINE string get_name(TypedObject *object = (TypedObject *)NULL) const; INLINE bool is_derived_from(TypeHandle parent, - TypedObject *object = (TypedObject *)NULL) const; + TypedObject *object = (TypedObject *)NULL) const; INLINE int get_num_parent_classes(TypedObject *object = (TypedObject *)NULL) const; INLINE TypeHandle get_parent_class(int index) const; @@ -99,7 +99,7 @@ PUBLISHED: INLINE TypeHandle get_child_class(int index) const; INLINE TypeHandle get_parent_towards(TypeHandle ancestor, - TypedObject *object = (TypedObject *)NULL) const; + TypedObject *object = (TypedObject *)NULL) const; INLINE int get_index() const; @@ -120,7 +120,7 @@ INLINE ostream &operator << (ostream &out, TypeHandle type) { } //////////////////////////////////////////////////////////////////// -// Class : TypeRegistry +// Class : TypeRegistry // Description : The TypeRegistry class maintains all the assigned // TypeHandles in a given system. There should be only // one TypeRegistry class during the lifetime of the @@ -160,21 +160,21 @@ PUBLISHED: string get_name(TypeHandle type, TypedObject *object) const; bool is_derived_from(TypeHandle child, TypeHandle parent, - TypedObject *child_object) const; + TypedObject *child_object) const; int get_num_root_classes(); TypeHandle get_root_class(int n); int get_num_parent_classes(TypeHandle child, - TypedObject *child_object) const; + TypedObject *child_object) const; TypeHandle get_parent_class(TypeHandle child, int index) const; int get_num_child_classes(TypeHandle child, - TypedObject *child_object) const; + TypedObject *child_object) const; TypeHandle get_child_class(TypeHandle child, int index) const; TypeHandle get_parent_towards(TypeHandle child, TypeHandle ancestor, - TypedObject *child_object) const; + TypedObject *child_object) const; static void reregister_types(); @@ -194,7 +194,7 @@ private: void freshen_root_classes(); void write_node(ostream &out, int indent_level, - const RegistryNode *node) const; + const RegistryNode *node) const; typedef vector HandleRegistry; HandleRegistry _handle_registry; @@ -224,21 +224,21 @@ register_type(TypeHandle &type_handle, const string &name); INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1); + TypeHandle parent1); INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2); + TypeHandle parent1, TypeHandle parent2); INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3); + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3); INLINE void register_type(TypeHandle &type_handle, const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3, TypeHandle parent4); + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3, TypeHandle parent4); //////////////////////////////////////////////////////////////////// @@ -257,17 +257,17 @@ register_dynamic_type(const string &name, TypeHandle parent1); INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2); + TypeHandle parent1, TypeHandle parent2); INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3); + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3); INLINE TypeHandle register_dynamic_type(const string &name, - TypeHandle parent1, TypeHandle parent2, - TypeHandle parent3, TypeHandle parent4); + TypeHandle parent1, TypeHandle parent2, + TypeHandle parent3, TypeHandle parent4); // A few system-wide TypeHandles are defined for some basic types. diff --git a/panda/src/express/typedObject.h b/panda/src/express/typedObject.h index 8714dc9620..3566d8e900 100644 --- a/panda/src/express/typedObject.h +++ b/panda/src/express/typedObject.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : TypedObject +// Class : TypedObject // Description : This is an abstract class that all classes which // use TypeHandle, and also provide virtual functions to // support polymorphism, should inherit from. Each diff --git a/panda/src/express/typedReferenceCount.h b/panda/src/express/typedReferenceCount.h index bc6f9dd36d..a7f48116cb 100644 --- a/panda/src/express/typedReferenceCount.h +++ b/panda/src/express/typedReferenceCount.h @@ -11,7 +11,7 @@ #include "referenceCount.h" //////////////////////////////////////////////////////////////////// -// Class : TypedReferenceCount +// Class : TypedReferenceCount // Description : A base class for things which need to inherit from // both TypedObject and from ReferenceCount. It's // convenient to define this intermediate base class @@ -42,8 +42,8 @@ public: TypedObject::init_type(); ReferenceCount::init_type(); register_type(_type_handle, "TypedReferenceCount", - TypedObject::get_class_type(), - ReferenceCount::get_class_type()); + TypedObject::get_class_type(), + ReferenceCount::get_class_type()); } private: diff --git a/panda/src/framework/framework.cxx b/panda/src/framework/framework.cxx index 0f776c7262..f1acc5b648 100644 --- a/panda/src/framework/framework.cxx +++ b/panda/src/framework/framework.cxx @@ -185,7 +185,7 @@ public: static void init_type(void) { GeomLine::init_type(); register_type(_type_handle, "GeomNorms", - GeomLine::get_class_type()); + GeomLine::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -222,43 +222,43 @@ reached_node(Node *node, NullAttributeWrapper &, NullLevelState &) { for (i = 0; i < geom->get_num_geoms(); i++) { dDrawable *d = geom->get_geom(i); if (d->is_of_type(Geom::get_class_type())) { - Geom *g = DCAST(Geom, d); - for (int j=0; jget_num_prims(); ++j) - vert_count += g->get_length(j); + Geom *g = DCAST(Geom, d); + for (int j=0; jget_num_prims(); ++j) + vert_count += g->get_length(j); } } if (vert_count > 0) { PTA_Vertexf verts(2 * vert_count); for (i = 0; i < geom->get_num_geoms(); i++) { - dDrawable *d = geom->get_geom(i); - if (d->is_of_type(Geom::get_class_type())) { - PTA_Vertexf lverts; - PTA_ushort iverts; - GeomBindType vbond; - Geom *g = DCAST(Geom, d); - g->get_coords(lverts, vbond, iverts); - int vert_idx = 0; - if (g->get_binding(G_NORMAL) == G_OFF) { - for (int j=0; jget_num_prims(); ++j) { - for (int k=0; kget_length(j); ++k, ++vert_idx) { - verts[2 * vert_idx] = lverts[vert_idx]; - verts[(2 * vert_idx) + 1] = lverts[vert_idx]; - } - } - } else { - PTA_Normalf lnorms; - PTA_ushort inorms; - GeomBindType nbond; - g->get_normals(lnorms, nbond, inorms); - for (int j=0; jget_num_prims(); ++j) { - for (int k=0; kget_length(j); ++k, ++vert_idx) { - verts[2 * vert_idx] = lverts[vert_idx]; - verts[(2 * vert_idx) + 1] = lverts[vert_idx] - + lnorms[vert_idx]; - } - } - } - } + dDrawable *d = geom->get_geom(i); + if (d->is_of_type(Geom::get_class_type())) { + PTA_Vertexf lverts; + PTA_ushort iverts; + GeomBindType vbond; + Geom *g = DCAST(Geom, d); + g->get_coords(lverts, vbond, iverts); + int vert_idx = 0; + if (g->get_binding(G_NORMAL) == G_OFF) { + for (int j=0; jget_num_prims(); ++j) { + for (int k=0; kget_length(j); ++k, ++vert_idx) { + verts[2 * vert_idx] = lverts[vert_idx]; + verts[(2 * vert_idx) + 1] = lverts[vert_idx]; + } + } + } else { + PTA_Normalf lnorms; + PTA_ushort inorms; + GeomBindType nbond; + g->get_normals(lnorms, nbond, inorms); + for (int j=0; jget_num_prims(); ++j) { + for (int k=0; kget_length(j); ++k, ++vert_idx) { + verts[2 * vert_idx] = lverts[vert_idx]; + verts[(2 * vert_idx) + 1] = lverts[vert_idx] + + lnorms[vert_idx]; + } + } + } + } } gn->set_num_prims(vert_count); gn->set_coords(verts, G_PER_VERTEX); @@ -284,14 +284,14 @@ reached_node(Node *node, NullAttributeWrapper &, NullLevelState &) { int i, j; do { for (i = 0, j = -1; - i < geom->get_num_geoms(); - ++i) { - if (geom->get_geom(i)->is_of_type(GeomNorms::get_class_type())) { - j = i; - } + i < geom->get_num_geoms(); + ++i) { + if (geom->get_geom(i)->is_of_type(GeomNorms::get_class_type())) { + j = i; + } } if (j != -1) { - geom->remove_geom(j); + geom->remove_geom(j); } } while (j != -1); } @@ -354,14 +354,14 @@ class IdleCallback : public GraphicsWindow::Callback { // Perform the collision traversal, if we have a collision // traverser standing by. if (col_trans != (CollisionTraverser *)NULL) { - col_trans->traverse(render); + col_trans->traverse(render); } // Throw any events generated recently. event_handler.process_events(); if (additional_idle != NULL) { - (*additional_idle)(); + (*additional_idle)(); } } }; @@ -692,7 +692,7 @@ void event_grave(CPT_Event) { int height = dr->get_pixel_height(); PixelBuffer p(width, height, 3, 1, PixelBuffer::T_unsigned_byte, - PixelBuffer::F_rgb); + PixelBuffer::F_rgb); nout << "Capturing frame.\n"; @@ -712,11 +712,11 @@ void event_n(CPT_Event) { if (normals_on) { NormalAddTraverser trav(main_win->get_gsg()); df_traverse(render, trav, NullAttributeWrapper(), NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); } else { NormalDelTraverser trav(main_win->get_gsg()); df_traverse(render, trav, NullAttributeWrapper(), NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); } } @@ -751,7 +751,7 @@ static void switch_trackball(Node *trackball) { if (current_trackball != NULL) { remove_child(mouse_watcher, current_trackball, - DataRelation::get_class_type()); + DataRelation::get_class_type()); } current_trackball = trackball; if (current_trackball != NULL) { @@ -797,7 +797,7 @@ start_drive() { NodeRelation *arc = new RenderRelation(cameras, ray_node); ray_node->add_solid(new CollisionRay(LPoint3f(0.0, 0.0, 0.0), - LVector3f::down())); + LVector3f::down())); arc->set_transition(new PruneTransition); col_trans = new CollisionTraverser; @@ -854,11 +854,11 @@ void event_p(CPT_Event) { LPoint3f hpr; if (current_trackball == trackball) { - xyz = trackball->get_pos(); - hpr = trackball->get_hpr(); + xyz = trackball->get_pos(); + hpr = trackball->get_hpr(); } else if (current_trackball == drive_interface) { - xyz = drive_interface->get_pos(); - hpr = drive_interface->get_hpr(); + xyz = drive_interface->get_pos(); + hpr = drive_interface->get_hpr(); } printf("current pos, hpr: %f %f %f %f %f %f\n",xyz[0],xyz[1],xyz[2],hpr[0],hpr[1],hpr[2]); @@ -873,11 +873,11 @@ void event_P(CPT_Event) { scanf("%f %f %f %f %f %f",&xyz[0],&xyz[1],&xyz[2],&hpr[0],&hpr[1],&hpr[2]); if (current_trackball == trackball) { - trackball->set_pos(xyz); - trackball->set_hpr(hpr); + trackball->set_pos(xyz); + trackball->set_hpr(hpr); } else if (current_trackball == drive_interface) { - drive_interface->set_pos(xyz); - drive_interface->set_hpr(hpr); + drive_interface->set_pos(xyz); + drive_interface->set_hpr(hpr); } } @@ -937,21 +937,21 @@ void event_x(CPT_Event) { #define RANDFRAC (rand()/(float)(RAND_MAX)) typedef struct { - // for rot moving - float xcenter,ycenter; - float xoffset,yoffset; - float ang1,ang1_vel; - float ang2,ang2_vel; - - float radius; + // for rot moving + float xcenter,ycenter; + float xoffset,yoffset; + float ang1,ang1_vel; + float ang2,ang2_vel; - // for moving - float xstart,ystart; - float xend,yend; - float xdel,ydel,timedel; - double starttime,endtime; + float radius; + + // for moving + float xstart,ystart; + float xend,yend; + float xdel,ydel,timedel; + double starttime,endtime; double vel; - LMatrix4f rotmat; + LMatrix4f rotmat; } gridded_file_info; typedef enum {None,Rotation,LinearMotion} GriddedMotionType; @@ -972,70 +972,70 @@ static void move_gridded_stuff(GriddedMotionType gridmotiontype,gridded_file_inf LMatrix4f tmat1,tmat2,xfm_mat; for(int i = 0; i < size; i++) { - double time_delta = (now-InfoArr[i].starttime); + double time_delta = (now-InfoArr[i].starttime); - #define DO_FP_MODULUS(VAL,MAXVAL) \ - {if(VAL > MAXVAL) {int idivresult = VAL / (float)MAXVAL; VAL=VAL-idivresult*MAXVAL;} else \ - if(VAL < -MAXVAL) {int idivresult = VAL / (float)MAXVAL; VAL=VAL+idivresult*MAXVAL;}} - - // probably should use panda lerps for this stuff, but I dont understand how + #define DO_FP_MODULUS(VAL,MAXVAL) \ + {if(VAL > MAXVAL) {int idivresult = VAL / (float)MAXVAL; VAL=VAL-idivresult*MAXVAL;} else \ + if(VAL < -MAXVAL) {int idivresult = VAL / (float)MAXVAL; VAL=VAL+idivresult*MAXVAL;}} + + // probably should use panda lerps for this stuff, but I dont understand how if(gridmotiontype==Rotation) { - - InfoArr[i].ang1=time_delta*InfoArr[i].ang1_vel; - DO_FP_MODULUS(InfoArr[i].ang1,360.0); - InfoArr[i].ang2=time_delta*InfoArr[i].ang2_vel; - DO_FP_MODULUS(InfoArr[i].ang2,360.0); - - // xforms happen left to right - LVector2f new_center = LVector2f(InfoArr[i].radius,0.0) * - LMatrix3f::rotate_mat(InfoArr[i].ang1); - - LVector3f translate_vec(InfoArr[i].xcenter+new_center._v.v._0, - InfoArr[i].ycenter+new_center._v.v._1, - 0.0); - - const LVector3f rotation_axis(0.0, 0.0, 1.0); - - tmat1 = LMatrix4f::rotate_mat_normaxis(InfoArr[i].ang2,rotation_axis); - tmat2 = LMatrix4f::translate_mat(translate_vec); - xfm_mat = tmat1 * tmat2; - } else { - - float xpos,ypos; - if(now>InfoArr[i].endtime) { - InfoArr[i].starttime = now; + InfoArr[i].ang1=time_delta*InfoArr[i].ang1_vel; + DO_FP_MODULUS(InfoArr[i].ang1,360.0); + InfoArr[i].ang2=time_delta*InfoArr[i].ang2_vel; + DO_FP_MODULUS(InfoArr[i].ang2,360.0); - xpos = InfoArr[i].xstart = InfoArr[i].xend; - ypos = InfoArr[i].ystart = InfoArr[i].yend; + // xforms happen left to right + LVector2f new_center = LVector2f(InfoArr[i].radius,0.0) * + LMatrix3f::rotate_mat(InfoArr[i].ang1); - InfoArr[i].xend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; - InfoArr[i].yend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + LVector3f translate_vec(InfoArr[i].xcenter+new_center._v.v._0, + InfoArr[i].ycenter+new_center._v.v._1, + 0.0); - float xdel = InfoArr[i].xdel = InfoArr[i].xend-InfoArr[i].xstart; - float ydel = InfoArr[i].ydel = InfoArr[i].yend-InfoArr[i].ystart; + const LVector3f rotation_axis(0.0, 0.0, 1.0); - InfoArr[i].endtime = now + csqrt(xdel*xdel+ydel*ydel)/InfoArr[i].vel; - InfoArr[i].timedel = InfoArr[i].endtime - InfoArr[i].starttime; + tmat1 = LMatrix4f::rotate_mat_normaxis(InfoArr[i].ang2,rotation_axis); + tmat2 = LMatrix4f::translate_mat(translate_vec); + xfm_mat = tmat1 * tmat2; + } else { - const LVector3f rotate_axis(0.0, 0.0, 1.0); + float xpos,ypos; - float ang = rad_2_deg(atan2(-xdel,ydel)); + if(now>InfoArr[i].endtime) { + InfoArr[i].starttime = now; + + xpos = InfoArr[i].xstart = InfoArr[i].xend; + ypos = InfoArr[i].ystart = InfoArr[i].yend; + + InfoArr[i].xend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + InfoArr[i].yend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + + float xdel = InfoArr[i].xdel = InfoArr[i].xend-InfoArr[i].xstart; + float ydel = InfoArr[i].ydel = InfoArr[i].yend-InfoArr[i].ystart; + + InfoArr[i].endtime = now + csqrt(xdel*xdel+ydel*ydel)/InfoArr[i].vel; + InfoArr[i].timedel = InfoArr[i].endtime - InfoArr[i].starttime; + + const LVector3f rotate_axis(0.0, 0.0, 1.0); + + float ang = rad_2_deg(atan2(-xdel,ydel)); InfoArr[i].rotmat= LMatrix4f::rotate_mat_normaxis(ang,rotate_axis); - } else { - float timefrac= time_delta/InfoArr[i].timedel; + } else { + float timefrac= time_delta/InfoArr[i].timedel; - xpos = InfoArr[i].xdel*timefrac+InfoArr[i].xstart; - ypos = InfoArr[i].ydel*timefrac+InfoArr[i].ystart; - } + xpos = InfoArr[i].xdel*timefrac+InfoArr[i].xstart; + ypos = InfoArr[i].ydel*timefrac+InfoArr[i].ystart; + } - LVector3f translate_vec(xpos, ypos, 0.0); - LMatrix4f tmat2 = LMatrix4f::translate_mat(translate_vec); + LVector3f translate_vec(xpos, ypos, 0.0); + LMatrix4f tmat2 = LMatrix4f::translate_mat(translate_vec); - xfm_mat = InfoArr[i].rotmat * tmat2; - } + xfm_mat = InfoArr[i].rotmat * tmat2; + } pRRptrArr[i]->set_transition(new TransformTransition(xfm_mat)); } } @@ -1054,10 +1054,10 @@ int framework_main(int argc, char *argv[]) { if (!framework_notify_output.empty()) { if (!mstream->add_file(framework_notify_output)) { framework_cat.error() - << "Unable to open " << framework_notify_output << " for output.\n"; + << "Unable to open " << framework_notify_output << " for output.\n"; } else { framework_cat.info() - << "Sending Notify output to " << framework_notify_output << "\n"; + << "Sending Notify output to " << framework_notify_output << "\n"; } } */ @@ -1095,30 +1095,30 @@ int framework_main(int argc, char *argv[]) { for (int a = 1; a < argc; a++) { if ((argv[a] != (char*)0L) && ((argv[a])[0] != '-') && - ((argv[a])[0] != '+') && ((argv[a])[0] != '#')) + ((argv[a])[0] != '+') && ((argv[a])[0] != '#')) pFileCollection->push_back(Filename::from_os_specific(argv[a])); - else switch((argv[a])[1]) { - case 'r': - gridmotiontype = Rotation; - break; + else switch((argv[a])[1]) { + case 'r': + gridmotiontype = Rotation; + break; - case 'm': - gridmotiontype = LinearMotion; - break; + case 'm': + gridmotiontype = LinearMotion; + break; - case 'g': { - pFileCollection = &gridded_files; - - char *pStr=(argv[a])+2; - if (*pStr != '\0') { - gridrepeats=atoi(pStr); - if(gridrepeats<1) - gridrepeats=1; - - } - break; - } - } + case 'g': { + pFileCollection = &gridded_files; + + char *pStr=(argv[a])+2; + if (*pStr != '\0') { + gridrepeats=atoi(pStr); + if(gridrepeats<1) + gridrepeats=1; + + } + break; + } + } } // load display modules @@ -1157,7 +1157,7 @@ int framework_main(int argc, char *argv[]) { // need to find a better way to differentiate unsigned int from regular override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE))); + ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE))); override.setField(ChanCfgOverrides::Title, "Demo"); std::string conf = framework.GetString("chan-config", chan_config); @@ -1324,162 +1324,162 @@ int framework_main(int argc, char *argv[]) { PT_Node node = loader.load_sync(filename); if (node == (Node *)NULL) { - framework_cat.error() << "Unable to load file " << filename << "\n"; - continue; - } + framework_cat.error() << "Unable to load file " << filename << "\n"; + continue; + } - RenderRelation *pArc = new RenderRelation(root, node); - } + RenderRelation *pArc = new RenderRelation(root, node); + } - if(!gridded_files.empty()) { + if(!gridded_files.empty()) { - typedef RenderRelation *RenderRelationPtr; + typedef RenderRelation *RenderRelationPtr; - gridded_files_size= gridded_files.size(); - pNodeArr = new PT_Node[gridded_files.size()*gridrepeats]; - pRRptrArr = new RenderRelationPtr[gridded_files.size()*gridrepeats]; - InfoArr = new gridded_file_info[gridded_files.size()*gridrepeats]; + gridded_files_size= gridded_files.size(); + pNodeArr = new PT_Node[gridded_files.size()*gridrepeats]; + pRRptrArr = new RenderRelationPtr[gridded_files.size()*gridrepeats]; + InfoArr = new gridded_file_info[gridded_files.size()*gridrepeats]; - int j=0; + int j=0; - for (fi = gridded_files.begin(); fi != gridded_files.end(); (++fi),j++) { - Filename filename = (*fi); - - filename.resolve_filename(local_path); - - pNodeArr[j] = loader.load_sync(filename); - - if (pNodeArr[j] == (Node *)NULL) { - framework_cat.error() << "Unable to load file " << filename << "\n"; - j--; - gridded_files_size--; - continue; - } - } - - gridwidth=1; - while(gridwidth*gridwidth < gridded_files_size*gridrepeats) { - gridwidth++; - } + for (fi = gridded_files.begin(); fi != gridded_files.end(); (++fi),j++) { + Filename filename = (*fi); - grid_pos_offset = -gridwidth*GRIDCELLSIZE/2.0; - wander_area_pos_offset = -max(fabs(grid_pos_offset),MIN_WANDERAREA_DIMENSION/2.0); + filename.resolve_filename(local_path); - float xpos = grid_pos_offset; - float ypos = grid_pos_offset; - int filenum=0; + pNodeArr[j] = loader.load_sync(filename); - srand( (unsigned)time( NULL ) ); + if (pNodeArr[j] == (Node *)NULL) { + framework_cat.error() << "Unable to load file " << filename << "\n"; + j--; + gridded_files_size--; + continue; + } + } - double now = ClockObject::get_global_clock()->get_frame_time(); - - for(int passnum=0;passnum0) { - // cant directly instance characters due to LOD problems, - // must copy using copy_subgraph for now + grid_pos_offset = -gridwidth*GRIDCELLSIZE/2.0; + wander_area_pos_offset = -max(fabs(grid_pos_offset),MIN_WANDERAREA_DIMENSION/2.0); - pNodeArr[filenum] = pNodeArr[j]->copy_subgraph(RenderRelation::get_class_type()); - } + float xpos = grid_pos_offset; + float ypos = grid_pos_offset; + int filenum=0; - pRRptrArr[filenum] = new RenderRelation(root, pNodeArr[filenum]); + srand( (unsigned)time( NULL ) ); - LMatrix4f xfm_mat,tmat1,tmat2; + double now = ClockObject::get_global_clock()->get_frame_time(); - if(gridmotiontype==Rotation) { + for(int passnum=0;passnum0) { + // cant directly instance characters due to LOD problems, + // must copy using copy_subgraph for now - #define MIN_ROTATION_ANGVEL 30 - #define MAX_ROTATION_ANGVEL 600 + pNodeArr[filenum] = pNodeArr[j]->copy_subgraph(RenderRelation::get_class_type()); + } - #define MAX_RADIUS 4.0*GRIDCELLSIZE - #define MIN_RADIUS 0.1*GRIDCELLSIZE - - InfoArr[filenum].starttime = now; + pRRptrArr[filenum] = new RenderRelation(root, pNodeArr[filenum]); - InfoArr[filenum].xcenter=xpos; - InfoArr[filenum].ycenter=ypos; - InfoArr[filenum].ang1=RANDFRAC * 360.0; - InfoArr[filenum].ang1_vel=((MAX_REVOLUTION_ANGVEL-MIN_REVOLUTION_ANGVEL) * RANDFRAC) + MIN_REVOLUTION_ANGVEL; - - InfoArr[filenum].ang2=RANDFRAC * 360.0; - InfoArr[filenum].ang2_vel=((MAX_ROTATION_ANGVEL-MIN_ROTATION_ANGVEL) * RANDFRAC) + MIN_ROTATION_ANGVEL; - - InfoArr[filenum].radius = (RANDFRAC * (MAX_RADIUS-MIN_RADIUS)) + MIN_RADIUS; - - if(RANDFRAC>0.5) { - InfoArr[filenum].ang1_vel=-InfoArr[filenum].ang1_vel; - } + LMatrix4f xfm_mat,tmat1,tmat2; - if(RANDFRAC>0.5) { - InfoArr[filenum].ang2_vel=-InfoArr[filenum].ang2_vel; - } - - // xforms happen left to right - LVector2f new_center = LVector2f(InfoArr[filenum].radius,0.0) * - LMatrix3f::rotate_mat(InfoArr[filenum].ang1); + if(gridmotiontype==Rotation) { - const LVector3f rotate_axis(0.0, 0.0, 1.0); + #define MIN_REVOLUTION_ANGVEL 30 + #define MAX_REVOLUTION_ANGVEL 60 - LVector3f translate_vec(xpos+new_center._v.v._0, - ypos+new_center._v.v._1, - 0.0); + #define MIN_ROTATION_ANGVEL 30 + #define MAX_ROTATION_ANGVEL 600 - LMatrix4f::rotate_mat_normaxis(InfoArr[filenum].ang2,rotate_axis,tmat1); - tmat2 = LMatrix4f::translate_mat(translate_vec); - xfm_mat = tmat1 * tmat2; - } else if(gridmotiontype==LinearMotion) { + #define MAX_RADIUS 4.0*GRIDCELLSIZE + #define MIN_RADIUS 0.1*GRIDCELLSIZE - #define MIN_VEL 2.0 - #define MAX_VEL (fabs(wander_area_pos_offset)) - - InfoArr[filenum].vel=((MAX_VEL-MIN_VEL) * RANDFRAC) + MIN_VEL; - - InfoArr[filenum].xstart=xpos; - InfoArr[filenum].ystart=ypos; + InfoArr[filenum].starttime = now; - InfoArr[filenum].xend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; - InfoArr[filenum].yend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + InfoArr[filenum].xcenter=xpos; + InfoArr[filenum].ycenter=ypos; + InfoArr[filenum].ang1=RANDFRAC * 360.0; + InfoArr[filenum].ang1_vel=((MAX_REVOLUTION_ANGVEL-MIN_REVOLUTION_ANGVEL) * RANDFRAC) + MIN_REVOLUTION_ANGVEL; - InfoArr[filenum].starttime = now; - - float xdel = InfoArr[filenum].xdel = InfoArr[filenum].xend-InfoArr[filenum].xstart; - float ydel = InfoArr[filenum].ydel = InfoArr[filenum].yend-InfoArr[filenum].ystart; + InfoArr[filenum].ang2=RANDFRAC * 360.0; + InfoArr[filenum].ang2_vel=((MAX_ROTATION_ANGVEL-MIN_ROTATION_ANGVEL) * RANDFRAC) + MIN_ROTATION_ANGVEL; - InfoArr[filenum].endtime = csqrt(xdel*xdel+ydel*ydel)/InfoArr[filenum].vel; - - InfoArr[filenum].timedel = InfoArr[filenum].endtime - InfoArr[filenum].starttime; + InfoArr[filenum].radius = (RANDFRAC * (MAX_RADIUS-MIN_RADIUS)) + MIN_RADIUS; - const LVector3f rotate_axis(0.0, 0.0, 1.0); - float ang = rad_2_deg(atan2(-xdel,ydel)); + if(RANDFRAC>0.5) { + InfoArr[filenum].ang1_vel=-InfoArr[filenum].ang1_vel; + } - LMatrix4f::rotate_mat_normaxis(ang,rotate_axis,InfoArr[filenum].rotmat); + if(RANDFRAC>0.5) { + InfoArr[filenum].ang2_vel=-InfoArr[filenum].ang2_vel; + } - LVector3f translate_vec(xpos, ypos, 0.0); - LMatrix4f tmat2 = LMatrix4f::translate_mat(translate_vec); + // xforms happen left to right + LVector2f new_center = LVector2f(InfoArr[filenum].radius,0.0) * + LMatrix3f::rotate_mat(InfoArr[filenum].ang1); - xfm_mat = InfoArr[filenum].rotmat * tmat2; - } else { - LVector3f translate_vec(xpos, ypos, 0.0); - xfm_mat = LMatrix4f::translate_mat(translate_vec); - } + const LVector3f rotate_axis(0.0, 0.0, 1.0); - pRRptrArr[filenum]->set_transition(new TransformTransition(xfm_mat)); - - if(((filenum+1) % gridwidth) == 0) { - xpos= -gridwidth*GRIDCELLSIZE/2.0; - ypos+=GRIDCELLSIZE; - } else { - xpos+=GRIDCELLSIZE; - } - } - } + LVector3f translate_vec(xpos+new_center._v.v._0, + ypos+new_center._v.v._1, + 0.0); - } + LMatrix4f::rotate_mat_normaxis(InfoArr[filenum].ang2,rotate_axis,tmat1); + tmat2 = LMatrix4f::translate_mat(translate_vec); + xfm_mat = tmat1 * tmat2; + } else if(gridmotiontype==LinearMotion) { + + #define MIN_VEL 2.0 + #define MAX_VEL (fabs(wander_area_pos_offset)) + + InfoArr[filenum].vel=((MAX_VEL-MIN_VEL) * RANDFRAC) + MIN_VEL; + + InfoArr[filenum].xstart=xpos; + InfoArr[filenum].ystart=ypos; + + InfoArr[filenum].xend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + InfoArr[filenum].yend = RANDFRAC*fabs(2.0*wander_area_pos_offset) + wander_area_pos_offset; + + InfoArr[filenum].starttime = now; + + float xdel = InfoArr[filenum].xdel = InfoArr[filenum].xend-InfoArr[filenum].xstart; + float ydel = InfoArr[filenum].ydel = InfoArr[filenum].yend-InfoArr[filenum].ystart; + + InfoArr[filenum].endtime = csqrt(xdel*xdel+ydel*ydel)/InfoArr[filenum].vel; + + InfoArr[filenum].timedel = InfoArr[filenum].endtime - InfoArr[filenum].starttime; + + const LVector3f rotate_axis(0.0, 0.0, 1.0); + float ang = rad_2_deg(atan2(-xdel,ydel)); + + LMatrix4f::rotate_mat_normaxis(ang,rotate_axis,InfoArr[filenum].rotmat); + + LVector3f translate_vec(xpos, ypos, 0.0); + LMatrix4f tmat2 = LMatrix4f::translate_mat(translate_vec); + + xfm_mat = InfoArr[filenum].rotmat * tmat2; + } else { + LVector3f translate_vec(xpos, ypos, 0.0); + xfm_mat = LMatrix4f::translate_mat(translate_vec); + } + + pRRptrArr[filenum]->set_transition(new TransformTransition(xfm_mat)); + + if(((filenum+1) % gridwidth) == 0) { + xpos= -gridwidth*GRIDCELLSIZE/2.0; + ypos+=GRIDCELLSIZE; + } else { + xpos+=GRIDCELLSIZE; + } + } + } + + } // If we happened to load up both a character file and its // matching animation file, attempt to bind them together now. @@ -1557,7 +1557,7 @@ int framework_main(int argc, char *argv[]) { framework_cat.info() << "forking draw thread" << endl; draw_thread = thread::create(draw_loop); for (;;) - icb.idle(); + icb.idle(); } else #endif { diff --git a/panda/src/glgsg/glGraphicsStateGuardian.I b/panda/src/glgsg/glGraphicsStateGuardian.I index 8f17b8207a..6bea793dfa 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.I +++ b/panda/src/glgsg/glGraphicsStateGuardian.I @@ -43,7 +43,7 @@ activate() { //////////////////////////////////////////////////////////////////// INLINE void GLGraphicsStateGuardian:: call_glClearColor(GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha) { + GLclampf alpha) { if (red != _clear_color_red || green != _clear_color_green || blue != _clear_color_blue || @@ -94,7 +94,7 @@ call_glClearStencil(GLint s) { //////////////////////////////////////////////////////////////////// INLINE void GLGraphicsStateGuardian:: call_glClearAccum(GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha) { + GLclampf alpha) { if (red != _clear_accum_red || green != _clear_accum_green || blue != _clear_accum_blue || @@ -189,11 +189,11 @@ INLINE void GLGraphicsStateGuardian:: call_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) { if ( _scissor_x != x || _scissor_y != y || - _scissor_width != width || _scissor_height != height ) + _scissor_width != width || _scissor_height != height ) { - _scissor_x = x; _scissor_y = y; - _scissor_width = width; _scissor_height = height; - glScissor( x, y, width, height ); + _scissor_x = x; _scissor_y = y; + _scissor_width = width; _scissor_height = height; + glScissor( x, y, width, height ); } } @@ -242,8 +242,8 @@ call_glLightModelLocal(GLboolean local) { if ( _lmodel_local != local ) { - _lmodel_local = local; - glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, local ); + _lmodel_local = local; + glLightModeli( GL_LIGHT_MODEL_LOCAL_VIEWER, local ); } } @@ -754,14 +754,14 @@ enable_lighting(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_LIGHTING)" << endl; + << "glEnable(GL_LIGHTING)" << endl; #endif glEnable(GL_LIGHTING); _lighting_enabled_this_frame = true; } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_LIGHTING)" << endl; + << "glDisable(GL_LIGHTING)" << endl; #endif glDisable(GL_LIGHTING); } @@ -780,13 +780,13 @@ enable_dither(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_DITHER)" << endl; + << "glEnable(GL_DITHER)" << endl; #endif glEnable(GL_DITHER); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_DITHER)" << endl; + << "glDisable(GL_DITHER)" << endl; #endif glDisable(GL_DITHER); } @@ -805,13 +805,13 @@ enable_stencil_test(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_STENCIL_TEST)" << endl; + << "glEnable(GL_STENCIL_TEST)" << endl; #endif glEnable(GL_STENCIL_TEST); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_STENCIL_TEST)" << endl; + << "glDisable(GL_STENCIL_TEST)" << endl; #endif glDisable(GL_STENCIL_TEST); } @@ -837,8 +837,8 @@ INLINE GLenum GLGraphicsStateGuardian::get_light_id(int index) const case 7: return GL_LIGHT7; default: glgsg_cat.error() - << "get_light_id() - we don't currently support ids " - << "> 8" << endl; + << "get_light_id() - we don't currently support ids " + << "> 8" << endl; break; } return GL_LIGHT0; @@ -860,8 +860,8 @@ get_clip_plane_id(int index) const { case 5: return GL_CLIP_PLANE5; default: glgsg_cat.error() - << "get_clip_plane_id() - we don't currently support ids " - << "> 5" << endl; + << "get_clip_plane_id() - we don't currently support ids " + << "> 5" << endl; break; } return GL_CLIP_PLANE0; @@ -876,23 +876,23 @@ INLINE void GLGraphicsStateGuardian::enable_light(int light, bool val) { if ( _light_info[light]._enabled != val ) { - _light_info[light]._enabled = val; - if ( val ) + _light_info[light]._enabled = val; + if ( val ) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_LIGHT" << light << ")" << endl; + << "glEnable(GL_LIGHT" << light << ")" << endl; #endif - glEnable( get_light_id( light ) ); + glEnable( get_light_id( light ) ); } - else - { + else + { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_LIGHT" << light << ")" << endl; + << "glDisable(GL_LIGHT" << light << ")" << endl; #endif - glDisable( get_light_id( light ) ); - } + glDisable( get_light_id( light ) ); + } } } @@ -908,13 +908,13 @@ enable_texturing(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_TEXTURE_2D)" << endl; + << "glEnable(GL_TEXTURE_2D)" << endl; #endif glEnable(GL_TEXTURE_2D); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_TEXTURE_2D)" << endl; + << "glDisable(GL_TEXTURE_2D)" << endl; #endif glDisable(GL_TEXTURE_2D); } @@ -930,11 +930,11 @@ INLINE void GLGraphicsStateGuardian:: enable_scissor(bool val) { if ( _scissor_enabled != val ) { - _scissor_enabled = val; + _scissor_enabled = val; if ( val ) - glEnable( GL_SCISSOR_TEST ); - else - glDisable( GL_SCISSOR_TEST ); + glEnable( GL_SCISSOR_TEST ); + else + glDisable( GL_SCISSOR_TEST ); } } @@ -950,13 +950,13 @@ enable_clip_plane(int clip_plane, bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_CLIP_PLANE_" << clip_plane << ")" << endl; + << "glEnable(GL_CLIP_PLANE_" << clip_plane << ")" << endl; #endif glEnable(get_clip_plane_id(clip_plane)); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_CLIP_PLANE_" << clip_plane << ")" << endl; + << "glDisable(GL_CLIP_PLANE_" << clip_plane << ")" << endl; #endif glDisable(get_clip_plane_id(clip_plane)); } @@ -976,13 +976,13 @@ enable_multisample_alpha_one(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl; + << "glEnable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl; #endif glEnable(GL_SAMPLE_ALPHA_TO_ONE_SGIS); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl; + << "glDisable(GL_SAMPLE_ALPHA_TO_ONE_SGIS)" << endl; #endif glDisable(GL_SAMPLE_ALPHA_TO_ONE_SGIS); } @@ -1003,13 +1003,13 @@ enable_multisample_alpha_mask(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl; + << "glEnable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl; #endif glEnable(GL_SAMPLE_ALPHA_TO_MASK_SGIS); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl; + << "glDisable(GL_SAMPLE_ALPHA_TO_MASK_SGIS)" << endl; #endif glDisable(GL_SAMPLE_ALPHA_TO_MASK_SGIS); } @@ -1029,13 +1029,13 @@ enable_blend(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_BLEND)" << endl; + << "glEnable(GL_BLEND)" << endl; #endif glEnable(GL_BLEND); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_BLEND)" << endl; + << "glDisable(GL_BLEND)" << endl; #endif glDisable(GL_BLEND); } @@ -1054,13 +1054,13 @@ enable_depth_test(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_DEPTH_TEST)" << endl; + << "glEnable(GL_DEPTH_TEST)" << endl; #endif glEnable(GL_DEPTH_TEST); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_DEPTH_TEST)" << endl; + << "glDisable(GL_DEPTH_TEST)" << endl; #endif glDisable(GL_DEPTH_TEST); } @@ -1079,13 +1079,13 @@ enable_fog(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_FOG)" << endl; + << "glEnable(GL_FOG)" << endl; #endif glEnable(GL_FOG); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_FOG)" << endl; + << "glDisable(GL_FOG)" << endl; #endif glDisable(GL_FOG); } @@ -1104,13 +1104,13 @@ enable_alpha_test(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_ALPHA_TEST)" << endl; + << "glEnable(GL_ALPHA_TEST)" << endl; #endif glEnable(GL_ALPHA_TEST); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_ALPHA_TEST)" << endl; + << "glDisable(GL_ALPHA_TEST)" << endl; #endif glDisable(GL_ALPHA_TEST); } @@ -1130,13 +1130,13 @@ enable_polygon_offset(bool val) { if (val) { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glEnable(GL_POLYGON_OFFSET_*)" << endl; + << "glEnable(GL_POLYGON_OFFSET_*)" << endl; #endif glEnable(GL_POLYGON_OFFSET_FILL); } else { #ifdef GSG_VERBOSE glgsg_cat.debug() - << "glDisable(GL_POLYGON_OFFSET_*)" << endl; + << "glDisable(GL_POLYGON_OFFSET_*)" << endl; #endif glDisable(GL_POLYGON_OFFSET_FILL); } diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index 63904ac275..541857b560 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -352,11 +352,11 @@ clear(const RenderBuffer &buffer) { if (buffer_type & RenderBuffer::T_color) { call_glClearColor(_color_clear_value[0], - _color_clear_value[1], - _color_clear_value[2], - _color_clear_value[3]); + _color_clear_value[1], + _color_clear_value[2], + _color_clear_value[3]); state.set_attribute(ColorMaskTransition::get_class_type(), - new ColorMaskAttribute); + new ColorMaskAttribute); mask |= GL_COLOR_BUFFER_BIT; set_draw_buffer(buffer); @@ -370,7 +370,7 @@ clear(const RenderBuffer &buffer) { // writing to the depth buffer. if (!_depth_mask) { state.set_attribute(DepthWriteTransition::get_class_type(), - new DepthWriteAttribute); + new DepthWriteAttribute); } } @@ -381,9 +381,9 @@ clear(const RenderBuffer &buffer) { if (buffer_type & RenderBuffer::T_accum) { call_glClearAccum(_accum_clear_value[0], - _accum_clear_value[1], - _accum_clear_value[2], - _accum_clear_value[3]); + _accum_clear_value[1], + _accum_clear_value[2], + _accum_clear_value[3]); mask |= GL_ACCUM_BUFFER_BIT; } @@ -504,27 +504,27 @@ render_frame(const AllAttributesWrapper &initial_state) { if (_win->is_channel_defined(c)) { GraphicsChannel *chan = _win->get_channel(c); if (chan->is_active()) { - int num_layers = chan->get_num_layers(); - for (int l = 0; l < num_layers; l++) { - GraphicsLayer *layer = chan->get_layer(l); - if (layer->is_active()) { - int num_drs = layer->get_num_drs(); - for (int d = 0; d < num_drs; d++) { - DisplayRegion *dr = layer->get_dr(d); - nassertv(dr != (DisplayRegion *)NULL); - Camera *cam = dr->get_camera(); - - // For each display region, render from the camera's view. - if (dr->is_active() && cam != (Camera *)NULL && - cam->is_active() && cam->get_scene() != (Node *)NULL) { - DisplayRegionStack old_dr = push_display_region(dr); - prepare_display_region(); - render_scene(cam->get_scene(), cam, initial_state); - pop_display_region(old_dr); - } - } - } - } + int num_layers = chan->get_num_layers(); + for (int l = 0; l < num_layers; l++) { + GraphicsLayer *layer = chan->get_layer(l); + if (layer->is_active()) { + int num_drs = layer->get_num_drs(); + for (int d = 0; d < num_drs; d++) { + DisplayRegion *dr = layer->get_dr(d); + nassertv(dr != (DisplayRegion *)NULL); + Camera *cam = dr->get_camera(); + + // For each display region, render from the camera's view. + if (dr->is_active() && cam != (Camera *)NULL && + cam->is_active() && cam->get_scene() != (Node *)NULL) { + DisplayRegionStack old_dr = push_display_region(dr); + prepare_display_region(); + render_scene(cam->get_scene(), cam, initial_state); + pop_display_region(old_dr); + } + } + } + } } } } @@ -578,7 +578,7 @@ render_frame(const AllAttributesWrapper &initial_state) { //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state) { + const AllAttributesWrapper &initial_state) { #ifdef GSG_VERBOSE _pass_number = 0; glgsg_cat.debug() @@ -607,9 +607,9 @@ render_scene(Node *root, ProjectionNode *projnode, //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { // Calling activate() frequently seems to be intolerably expensive // on some platforms. We'll limit ourselves for now to calling it // only during the clear(). @@ -685,8 +685,8 @@ render_subgraph(RenderTraverser *traverser, //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { #ifdef GSG_VERBOSE glgsg_cat.debug() << "begin subgraph (pass " << ++_pass_number @@ -977,31 +977,31 @@ draw_sprite(const GeomSprite *geom) { // will be apparent, which is what this special projection was supposed to correct #ifdef DO_CHARLES_PROJECTION_MAT - // to assure that the scale between the two frustra stays the same - // (if they are different, sprites move at different speeds than the world), - // we have to apply the frustum inverse to the point, then render it in our - // own frustum. Since the z values are identical and 1:1, we only need - // concern ourselves with the x and y mappings, which are conveniently linear. - - float x_frustum_scale, y_frustum_scale; - float recip_x_frustum_scale, recip_y_frustum_scale; - float tnear, tfar, hfov; + // to assure that the scale between the two frustra stays the same + // (if they are different, sprites move at different speeds than the world), + // we have to apply the frustum inverse to the point, then render it in our + // own frustum. Since the z values are identical and 1:1, we only need + // concern ourselves with the x and y mappings, which are conveniently linear. - // get the camera information - tnear = _actual_display_region->get_camera()->get_near(); - tfar = _actual_display_region->get_camera()->get_far(); - hfov = _actual_display_region->get_camera()->get_hfov(); - - // extract the left and top bounds of the current camera - x_frustum_scale = tanf(hfov * 0.5f * (3.1415926f / 180.0f)) * tnear; - recip_x_frustum_scale = 1.0f / x_frustum_scale; - y_frustum_scale = x_frustum_scale / aspect_ratio; - recip_y_frustum_scale = 1.0f / y_frustum_scale; + float x_frustum_scale, y_frustum_scale; + float recip_x_frustum_scale, recip_y_frustum_scale; + float tnear, tfar, hfov; - // load up our own matrices - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, tnear, tfar); + // get the camera information + tnear = _actual_display_region->get_camera()->get_near(); + tfar = _actual_display_region->get_camera()->get_far(); + hfov = _actual_display_region->get_camera()->get_hfov(); + + // extract the left and top bounds of the current camera + x_frustum_scale = tanf(hfov * 0.5f * (3.1415926f / 180.0f)) * tnear; + recip_x_frustum_scale = 1.0f / x_frustum_scale; + y_frustum_scale = x_frustum_scale / aspect_ratio; + recip_y_frustum_scale = 1.0f / y_frustum_scale; + + // load up our own matrices + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0f, 1.0f, -1.0f, 1.0f, tnear, tfar); #endif // load up our own matrices @@ -1169,10 +1169,10 @@ draw_sprite(const GeomSprite *geom) { // create the rotated points LMatrix3f xform_mat = LMatrix3f::rotate_mat(theta) * LMatrix3f::scale_mat(scaled_width, scaled_height); - ur = (LVector3f( 1, 1, 0) * xform_mat) + cur_image._v; - ul = (LVector3f(-1, 1, 0) * xform_mat) + cur_image._v; - lr = (LVector3f( 1, -1, 0) * xform_mat) + cur_image._v; - ll = (LVector3f(-1, -1, 0) * xform_mat) + cur_image._v; + ur = (LVector3f( 1, 1, 0) * xform_mat) + cur_image._v; + ul = (LVector3f(-1, 1, 0) * xform_mat) + cur_image._v; + lr = (LVector3f( 1, -1, 0) * xform_mat) + cur_image._v; + ll = (LVector3f(-1, -1, 0) * xform_mat) + cur_image._v; } else { // create the normal points @@ -2034,10 +2034,10 @@ copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr) { // pixelbuffer "origin" represents upper left screen point at which // pixelbuffer should be drawn using draw_pixel_buffer glReadPixels(pb->get_xorg() + xo, pb->get_yorg() + yo, - pb->get_xsize(), pb->get_ysize(), - get_external_image_format(pb->get_format()), - get_image_type(pb->get_image_type()), - pb->_image.p() ); + pb->get_xsize(), pb->get_ysize(), + get_external_image_format(pb->get_format()), + get_image_type(pb->get_image_type()), + pb->_image.p() ); nassertv(!pb->_image.empty()); report_errors(); @@ -2250,10 +2250,10 @@ apply_fog(Fog *fog) { call_glFogMode(get_fog_mode_type(fmode)); switch(fmode) { case Fog::M_linear: - float fog_start,fog_end; - fog->get_range(fog_start,fog_end); - call_glFogStart(fog_start); - call_glFogEnd(fog_end); + float fog_start,fog_end; + fog->get_range(fog_start,fog_end); + call_glFogStart(fog_start); + call_glFogEnd(fog_end); break; case Fog::M_exponential: case Fog::M_exponential_squared: @@ -2735,48 +2735,48 @@ void GLGraphicsStateGuardian::issue_light(const LightAttribute *attrib ) // Check to see if this light has already been bound to an id _cur_light_id = -1; for (i = 0; i < _max_lights; i++) { - if (_light_info[i]._light == light) { - // Light has already been bound to an id, we only need - // to enable the light, not apply it - _cur_light_id = -2; - enable_light(i, true); - _light_info[i]._next_enabled = true; - break; - } + if (_light_info[i]._light == light) { + // Light has already been bound to an id, we only need + // to enable the light, not apply it + _cur_light_id = -2; + enable_light(i, true); + _light_info[i]._next_enabled = true; + break; + } } // See if there are any unbound light ids if (_cur_light_id == -1) { - for (i = 0; i < _max_lights; i++) { - if (_light_info[i]._light == (Light *)NULL) { - _light_info[i]._light = light; - _cur_light_id = i; - break; - } - } + for (i = 0; i < _max_lights; i++) { + if (_light_info[i]._light == (Light *)NULL) { + _light_info[i]._light = light; + _cur_light_id = i; + break; + } + } } // If there were no unbound light ids, see if we can replace // a currently unused but previously bound id if (_cur_light_id == -1) { - for (i = 0; i < _max_lights; i++) { - if (attrib->is_off(_light_info[i]._light)) { - _light_info[i]._light = light; - _cur_light_id = i; - break; - } - } + for (i = 0; i < _max_lights; i++) { + if (attrib->is_off(_light_info[i]._light)) { + _light_info[i]._light = light; + _cur_light_id = i; + break; + } + } } if (_cur_light_id >= 0) { - enable_light(_cur_light_id, true); - _light_info[i]._next_enabled = true; - - // We need to do something different for each type of light - light->apply(this); + enable_light(_cur_light_id, true); + _light_info[i]._next_enabled = true; + + // We need to do something different for each type of light + light->apply(this); } else if (_cur_light_id == -1) { - glgsg_cat.error() - << "issue_light() - failed to bind light to id" << endl; + glgsg_cat.error() + << "issue_light() - failed to bind light to id" << endl; } } } @@ -2856,9 +2856,9 @@ void GLGraphicsStateGuardian:: issue_color_mask(const ColorMaskAttribute *attrib) { // activate(); glColorMask(attrib->is_write_r(), - attrib->is_write_g(), - attrib->is_write_b(), - attrib->is_write_a()); + attrib->is_write_g(), + attrib->is_write_b(), + attrib->is_write_a()); report_errors(); } diff --git a/panda/src/glgsg/glGraphicsStateGuardian.h b/panda/src/glgsg/glGraphicsStateGuardian.h index b49688b75e..c1ae157843 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.h +++ b/panda/src/glgsg/glGraphicsStateGuardian.h @@ -45,7 +45,7 @@ INLINE ostream &operator << (ostream &out, GLenum v) { //////////////////////////////////////////////////////////////////// -// Class : GLGraphicsStateGuardian +// Class : GLGraphicsStateGuardian // Description : A GraphicsStateGuardian specialized for rendering // into OpenGL contexts. There should be no GL calls // outside of this object. @@ -64,15 +64,15 @@ public: virtual void render_frame(const AllAttributesWrapper &initial_state); virtual void render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual void draw_point(const GeomPoint *geom); virtual void draw_line(const GeomLine *geom); @@ -98,16 +98,16 @@ public: virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb); virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb, - const DisplayRegion *dr); + const DisplayRegion *dr); virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr); virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void apply_material(const Material *material); virtual void apply_fog(Fog *fog); @@ -164,17 +164,17 @@ public: protected: void free_pointers(); virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); virtual void restore_frame_buffer(SavedFrameBuffer *frame_buffer); INLINE void activate(); INLINE void call_glClearColor(GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha); + GLclampf alpha); INLINE void call_glClearDepth(GLclampd depth); INLINE void call_glClearStencil(GLint s); INLINE void call_glClearAccum(GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha); + GLclampf alpha); INLINE void call_glDrawBuffer(GLenum mode); INLINE void call_glReadBuffer(GLenum mode); INLINE void call_glShadeModel(GLenum mode); diff --git a/panda/src/glgsg/glSavedFrameBuffer.h b/panda/src/glgsg/glSavedFrameBuffer.h index c686feb52c..3682a84fc3 100644 --- a/panda/src/glgsg/glSavedFrameBuffer.h +++ b/panda/src/glgsg/glSavedFrameBuffer.h @@ -15,13 +15,13 @@ //////////////////////////////////////////////////////////////////// -// Class : GLSavedFrameBuffer +// Class : GLSavedFrameBuffer // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDAGL GLSavedFrameBuffer : public SavedFrameBuffer { public: INLINE GLSavedFrameBuffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); INLINE ~GLSavedFrameBuffer(); PT(Texture) _back_rgba; @@ -34,7 +34,7 @@ public: static void init_type() { SavedFrameBuffer::init_type(); register_type(_type_handle, "GLSavedFrameBuffer", - SavedFrameBuffer::get_class_type()); + SavedFrameBuffer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/glgsg/glTextureContext.h b/panda/src/glgsg/glTextureContext.h index 5169191d97..b2f02d4e09 100644 --- a/panda/src/glgsg/glTextureContext.h +++ b/panda/src/glgsg/glTextureContext.h @@ -19,7 +19,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GLTextureContext +// Class : GLTextureContext // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDAGL GLTextureContext : public TextureContext { @@ -39,7 +39,7 @@ public: static void init_type() { TextureContext::init_type(); register_type(_type_handle, "GLTextureContext", - TextureContext::get_class_type()); + TextureContext::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/glutdisplay/config_glutdisplay.cxx b/panda/src/glutdisplay/config_glutdisplay.cxx index eaed87b746..15b0d96c94 100644 --- a/panda/src/glutdisplay/config_glutdisplay.cxx +++ b/panda/src/glutdisplay/config_glutdisplay.cxx @@ -15,8 +15,8 @@ NotifyCategoryDef(glutdisplay, "display"); ConfigureFn(config_glutdisplay) { glutGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory(glutGraphicsPipe::get_class_type(), - glutGraphicsPipe::make_glutGraphicsPipe); + glutGraphicsPipe::make_glutGraphicsPipe); glutGraphicsWindow::init_type(); GraphicsWindow::get_factory().register_factory(glutGraphicsWindow::get_class_type(), - glutGraphicsWindow::make_GlutGraphicsWindow); + glutGraphicsWindow::make_GlutGraphicsWindow); } diff --git a/panda/src/glutdisplay/glutGraphicsPipe.cxx b/panda/src/glutdisplay/glutGraphicsPipe.cxx index 4975d03c4f..fc936e822f 100644 --- a/panda/src/glutdisplay/glutGraphicsPipe.cxx +++ b/panda/src/glutdisplay/glutGraphicsPipe.cxx @@ -45,7 +45,7 @@ TypeHandle glutGraphicsPipe::get_class_type(void) { void glutGraphicsPipe::init_type(void) { InteractiveGraphicsPipe::init_type(); register_type(_type_handle, "glutGraphicsPipe", - InteractiveGraphicsPipe::get_class_type()); + InteractiveGraphicsPipe::get_class_type()); } TypeHandle glutGraphicsPipe::get_type(void) const { diff --git a/panda/src/glutdisplay/glutGraphicsWindow.cxx b/panda/src/glutdisplay/glutGraphicsWindow.cxx index 9b74434265..c62690c68f 100644 --- a/panda/src/glutdisplay/glutGraphicsWindow.cxx +++ b/panda/src/glutdisplay/glutGraphicsWindow.cxx @@ -35,7 +35,7 @@ glutGraphicsWindow* glutGraphicsWindow::_global_window; // Description: //////////////////////////////////////////////////////////////////// glutGraphicsWindow::glutGraphicsWindow( GraphicsPipe* pipe ) : - GraphicsWindow( pipe ) + GraphicsWindow( pipe ) { _global_window = this; config(); @@ -47,7 +47,7 @@ glutGraphicsWindow::glutGraphicsWindow( GraphicsPipe* pipe ) : // Description: //////////////////////////////////////////////////////////////////// glutGraphicsWindow::glutGraphicsWindow( GraphicsPipe* pipe, const - GraphicsWindow::Properties& props ) : GraphicsWindow( pipe, props ) + GraphicsWindow::Properties& props ) : GraphicsWindow( pipe, props ) { _global_window = this; config(); @@ -124,7 +124,7 @@ void glutGraphicsWindow::handle_reshape( int w, int h ) // Description: //////////////////////////////////////////////////////////////////// void glutGraphicsWindow::handle_mouse_input( int button, int state, - int x, int y ) + int x, int y ) { _input_devices[0].set_pointer_in_window(x, y); @@ -300,7 +300,7 @@ TypeHandle glutGraphicsWindow::get_class_type(void) { void glutGraphicsWindow::init_type(void) { GraphicsWindow::init_type(); register_type(_type_handle, "glutGraphicsWindow", - GraphicsWindow::get_class_type()); + GraphicsWindow::get_class_type()); } TypeHandle glutGraphicsWindow::get_type(void) const { diff --git a/panda/src/glutdisplay/glutGraphicsWindow.h b/panda/src/glutdisplay/glutGraphicsWindow.h index 797e88dd9e..55831ad0cd 100644 --- a/panda/src/glutdisplay/glutGraphicsWindow.h +++ b/panda/src/glutdisplay/glutGraphicsWindow.h @@ -27,7 +27,7 @@ class EXPCL_PANDAGLUT glutGraphicsWindow : public GraphicsWindow public: glutGraphicsWindow( GraphicsPipe* pipe ); glutGraphicsWindow( GraphicsPipe* pipe, - const GraphicsWindow::Properties& props ); + const GraphicsWindow::Properties& props ); virtual ~glutGraphicsWindow( void ); virtual void config( void ); @@ -47,7 +47,7 @@ protected: // Mouse routines static void glut_handle_mouse_input( int button, int state, int x, - int y ) { + int y ) { _global_window->handle_mouse_input( button, state, x, y ); } void handle_mouse_input( int button, int state, int x, int y ); @@ -71,7 +71,7 @@ protected: void handle_special_keyboard_input( int key, int, int ); protected: - static glutGraphicsWindow* _global_window; + static glutGraphicsWindow* _global_window; int _handle; public: diff --git a/panda/src/glxdisplay/config_glxdisplay.cxx b/panda/src/glxdisplay/config_glxdisplay.cxx index 13a3245875..e59bed5cfb 100644 --- a/panda/src/glxdisplay/config_glxdisplay.cxx +++ b/panda/src/glxdisplay/config_glxdisplay.cxx @@ -16,10 +16,10 @@ NotifyCategoryDef(glxdisplay, "display"); ConfigureFn(config_glxdisplay) { glxGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory(glxGraphicsPipe::get_class_type(), - glxGraphicsPipe::make_glxGraphicsPipe); + glxGraphicsPipe::make_glxGraphicsPipe); glxGraphicsWindow::init_type(); GraphicsWindow::get_factory().register_factory(glxGraphicsWindow::get_class_type(), - glxGraphicsWindow::make_GlxGraphicsWindow); + glxGraphicsWindow::make_GlxGraphicsWindow); glxDisplay::init_type(); } diff --git a/panda/src/glxdisplay/glxDisplay.cxx b/panda/src/glxdisplay/glxDisplay.cxx index 323be51af4..9bf8c5391e 100644 --- a/panda/src/glxdisplay/glxDisplay.cxx +++ b/panda/src/glxdisplay/glxDisplay.cxx @@ -46,7 +46,7 @@ glxDisplay(GraphicsPipe *pipe, const string &x_specifier) { // Function: glxDisplay::find_window // Access: Public // Description: Find the window that has the xwindow "win" in the -// window list for the pipe (if it exists) +// window list for the pipe (if it exists) //////////////////////////////////////////////////////////////////// glxGraphicsWindow *glxDisplay:: find_window(Window win) const { diff --git a/panda/src/glxdisplay/glxDisplay.h b/panda/src/glxdisplay/glxDisplay.h index c16cf213a4..9a9ea97695 100644 --- a/panda/src/glxdisplay/glxDisplay.h +++ b/panda/src/glxdisplay/glxDisplay.h @@ -49,7 +49,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "glxDisplay", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/glxdisplay/glxGraphicsPipe.cxx b/panda/src/glxdisplay/glxGraphicsPipe.cxx index b89d82b68a..ef81931d0b 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.cxx +++ b/panda/src/glxdisplay/glxGraphicsPipe.cxx @@ -62,8 +62,8 @@ void glxGraphicsPipe::init_type(void) { InteractiveGraphicsPipe::init_type(); glxDisplay::init_type(); register_type(_type_handle, "glxGraphicsPipe", - InteractiveGraphicsPipe::get_class_type(), - glxDisplay::get_class_type()); + InteractiveGraphicsPipe::get_class_type(), + glxDisplay::get_class_type()); } TypeHandle glxGraphicsPipe::get_type(void) const { diff --git a/panda/src/glxdisplay/glxGraphicsPipe.h b/panda/src/glxdisplay/glxGraphicsPipe.h index 8830ea0a5c..c27d433db7 100644 --- a/panda/src/glxdisplay/glxGraphicsPipe.h +++ b/panda/src/glxdisplay/glxGraphicsPipe.h @@ -23,8 +23,8 @@ class glxGraphicsPipe : public InteractiveGraphicsPipe, public glxDisplay { public: - - glxGraphicsPipe( const PipeSpecifier& ); + + glxGraphicsPipe( const PipeSpecifier& ); virtual TypeHandle get_window_type() const; diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index c8dc119a98..07dd5290d6 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -40,7 +40,7 @@ const char* glxGraphicsWindow::_glx_extensions = NULL; // Description: //////////////////////////////////////////////////////////////////// glxGraphicsWindow::glxGraphicsWindow( GraphicsPipe* pipe ) : - GraphicsWindow( pipe ) + GraphicsWindow( pipe ) { config(); } @@ -51,7 +51,7 @@ glxGraphicsWindow::glxGraphicsWindow( GraphicsPipe* pipe ) : // Description: //////////////////////////////////////////////////////////////////// glxGraphicsWindow::glxGraphicsWindow( GraphicsPipe* pipe, const - GraphicsWindow::Properties& props ) : GraphicsWindow( pipe, props ) + GraphicsWindow::Properties& props ) : GraphicsWindow( pipe, props ) { config(); } @@ -96,7 +96,7 @@ bool glxGraphicsWindow::glx_supports(const char* extension) if ((major == 1 && minor >= 1) || (major > 1)) { if (!_glx_extensions) { _glx_extensions = - glXQueryExtensionsString(_display, glx->get_screen()); + glXQueryExtensionsString(_display, glx->get_screen()); } start = _glx_extensions; for (;;) { @@ -105,10 +105,10 @@ bool glxGraphicsWindow::glx_supports(const char* extension) return false; terminator = where + strlen(extension); if (where == start || *(where - 1) == ' ') { - if (*terminator == ' ' || *terminator == '\0') { - return true; - } - } + if (*terminator == ' ' || *terminator == '\0') { + return true; + } + } start = terminator; } } @@ -127,7 +127,7 @@ bool glxGraphicsWindow::glx_supports(const char* extension) //////////////////////////////////////////////////////////////////// static XVisualInfo * try_for_visual(glxDisplay *glx, int mask, - int want_depth_bits = 1, int want_color_bits = 1) { + int want_depth_bits = 1, int want_color_bits = 1) { static const int max_attrib_list = 32; int attrib_list[max_attrib_list]; int n=0; @@ -232,8 +232,8 @@ void glxGraphicsWindow::choose_visual(void) if (mask & W_MULTISAMPLE) { if (!glx_supports("GLX_SGIS_multisample")) { glxdisplay_cat.info() - << "glxGraphicsWindow::config() - multisample not supported" - << endl; + << "glxGraphicsWindow::config() - multisample not supported" + << endl; mask &= ~W_MULTISAMPLE; } } @@ -280,32 +280,32 @@ void glxGraphicsWindow::choose_visual(void) // the requested mask, in order. static const int strip_properties[] = { - // One esoteric option removed. - W_MULTISAMPLE, - W_STENCIL, - W_ACCUM, - W_ALPHA, - W_STEREO, - - // Two esoteric options removed. - W_STENCIL | W_MULTISAMPLE, - W_ACCUM | W_MULTISAMPLE, - W_ALPHA | W_MULTISAMPLE, - W_STEREO | W_MULTISAMPLE, - W_STENCIL | W_ACCUM, - W_ALPHA | W_STEREO, - W_STENCIL | W_ACCUM | W_MULTISAMPLE, - W_ALPHA | W_STEREO | W_MULTISAMPLE, - - // All esoteric options removed. - W_STENCIL | W_ACCUM | W_ALPHA | W_STEREO | W_MULTISAMPLE, + // One esoteric option removed. + W_MULTISAMPLE, + W_STENCIL, + W_ACCUM, + W_ALPHA, + W_STEREO, - // All esoteric options, plus some we'd really really prefer, - // removed. - W_STENCIL | W_ACCUM | W_ALPHA | W_STEREO | W_MULTISAMPLE | W_DOUBLE, - - // A zero marks the end of the array. - 0 + // Two esoteric options removed. + W_STENCIL | W_MULTISAMPLE, + W_ACCUM | W_MULTISAMPLE, + W_ALPHA | W_MULTISAMPLE, + W_STEREO | W_MULTISAMPLE, + W_STENCIL | W_ACCUM, + W_ALPHA | W_STEREO, + W_STENCIL | W_ACCUM | W_MULTISAMPLE, + W_ALPHA | W_STEREO | W_MULTISAMPLE, + + // All esoteric options removed. + W_STENCIL | W_ACCUM | W_ALPHA | W_STEREO | W_MULTISAMPLE, + + // All esoteric options, plus some we'd really really prefer, + // removed. + W_STENCIL | W_ACCUM | W_ALPHA | W_STEREO | W_MULTISAMPLE | W_DOUBLE, + + // A zero marks the end of the array. + 0 }; set tried_masks; @@ -313,40 +313,40 @@ void glxGraphicsWindow::choose_visual(void) int i; for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { - int new_mask = mask & ~strip_properties[i]; - if (tried_masks.insert(new_mask).second) { - _visual = try_for_visual(glx, new_mask, want_depth_bits, - want_color_bits); - } + int new_mask = mask & ~strip_properties[i]; + if (tried_masks.insert(new_mask).second) { + _visual = try_for_visual(glx, new_mask, want_depth_bits, + want_color_bits); + } } if (special_size_request) { - tried_masks.clear(); - tried_masks.insert(mask); - - if (_visual == NULL) { - // Try once more, this time eliminating all of the size - // requests. - for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { - int new_mask = mask & ~strip_properties[i]; - if (tried_masks.insert(new_mask).second) { - _visual = try_for_visual(glx, new_mask); - } - } - } + tried_masks.clear(); + tried_masks.insert(mask); + + if (_visual == NULL) { + // Try once more, this time eliminating all of the size + // requests. + for (i = 0; _visual == NULL && strip_properties[i] != 0; i++) { + int new_mask = mask & ~strip_properties[i]; + if (tried_masks.insert(new_mask).second) { + _visual = try_for_visual(glx, new_mask); + } + } + } } - + if (_visual == NULL) { - // Here's our last-ditch desparation attempt: give us any GLX - // visual at all! - _visual = try_for_visual(glx, 0); + // Here's our last-ditch desparation attempt: give us any GLX + // visual at all! + _visual = try_for_visual(glx, 0); } - + if (_visual == NULL) { - glxdisplay_cat.fatal() - << "glxGraphicsWindow::choose_visual() - could not get any " - "GLX visual." << endl; - exit(1); + glxdisplay_cat.fatal() + << "glxGraphicsWindow::choose_visual() - could not get any " + "GLX visual." << endl; + exit(1); } } } @@ -421,8 +421,8 @@ void glxGraphicsWindow::config( void ) wa.do_not_propagate_mask = 0; _xwindow = XCreateWindow(_display, glx->get_root(), - _props._xorg, _props._yorg, _props._xsize, _props._ysize, 0, - _visual->depth, InputOutput, _visual->visual, attrib_mask, &wa); + _props._xorg, _props._yorg, _props._xsize, _props._ysize, 0, + _visual->depth, InputOutput, _visual->visual, attrib_mask, &wa); if (!_xwindow) { glxdisplay_cat.fatal() << "glxGraphicsWindow::config() - failed to create Xwindow" << endl; @@ -517,30 +517,30 @@ void glxGraphicsWindow::setup_colormap(void) rc = glXGetConfig(_display, _visual, GLX_RGBA, &is_rgb); if (rc == 0 && is_rgb) { glxdisplay_cat.info() - << "glxGraphicsWindow::setup_colormap() - mesa pseudocolor " - << "not supported" << endl; - // this is a terrible terrible hack, that seems to work + << "glxGraphicsWindow::setup_colormap() - mesa pseudocolor " + << "not supported" << endl; + // this is a terrible terrible hack, that seems to work _colormap = (Colormap)0; } else { _colormap = XCreateColormap(_display, glx->get_root(), - _visual->visual, AllocAll); + _visual->visual, AllocAll); } break; case TrueColor: case DirectColor: _colormap = XCreateColormap(_display, glx->get_root(), - _visual->visual, AllocNone); + _visual->visual, AllocNone); break; case StaticColor: case StaticGray: case GrayScale: _colormap = XCreateColormap(_display, glx->get_root(), - _visual->visual, AllocNone); + _visual->visual, AllocNone); break; default: glxdisplay_cat.error() - << "glxGraphicsWindow::setup_colormap() - could not allocate a " - << "colormap for visual type: " << visual_class << endl; + << "glxGraphicsWindow::setup_colormap() - could not allocate a " + << "colormap for visual type: " << visual_class << endl; break; } } @@ -558,8 +558,8 @@ void glxGraphicsWindow::setup_properties(void) char *name = (char *)_props._title.c_str(); if (XStringListToTextProperty(&name, 1, &window_name) == 0) { glxdisplay_cat.error() - << "glxGraphicsWindow::config() - failed to allocate window name " - << "structure" << endl; + << "glxGraphicsWindow::config() - failed to allocate window name " + << "structure" << endl; } } @@ -640,8 +640,8 @@ void glxGraphicsWindow::end_frame( void ) glLoadMatrixf(LMatrix4f::ident_mat().get_data()); glOrtho(_props._xorg,_props._xorg+_props._xsize, - _props._yorg,_props._yorg+_props._ysize,-1.0,1.0); - + _props._yorg,_props._yorg+_props._ysize,-1.0,1.0); + // these seem to be good for default font glRasterPos2f(_props._xsize-75,_props._ysize-20); @@ -1072,7 +1072,7 @@ void glxGraphicsWindow::process_event(XEvent event) break; case ConfigureNotify: if (_props._xsize != event.xconfigure.width || - _props._ysize != event.xconfigure.height) { + _props._ysize != event.xconfigure.height) { _props._xsize = event.xconfigure.width; _props._ysize = event.xconfigure.height; make_current(); @@ -1089,23 +1089,23 @@ void glxGraphicsWindow::process_event(XEvent event) case ButtonPress: make_current(); handle_keypress(MouseButton::button(event.xbutton.button - 1), - event.xkey.x, event.xkey.y); + event.xkey.x, event.xkey.y); break; case ButtonRelease: make_current(); handle_keyrelease(MouseButton::button(event.xbutton.button - 1), - event.xkey.x, event.xkey.y); + event.xkey.x, event.xkey.y); break; case MotionNotify: if (_mouse_motion_enabled && event.xmotion.state & - (Button1Mask | Button2Mask | Button3Mask)) { + (Button1Mask | Button2Mask | Button3Mask)) { make_current(); handle_mouse_motion(event.xmotion.x, event.xmotion.y); } else if (_mouse_passive_motion_enabled && - ((event.xmotion.state & - (Button1Mask | Button2Mask | Button3Mask)) == 0)) { + ((event.xmotion.state & + (Button1Mask | Button2Mask | Button3Mask)) == 0)) { make_current(); handle_mouse_motion(event.xmotion.x, event.xmotion.y); } @@ -1125,21 +1125,21 @@ void glxGraphicsWindow::process_event(XEvent event) case LeaveNotify: if (_mouse_entry_enabled) { if (event.type == EnterNotify) { - // Overlays can generate multiple enter events - if (_entry_state != EnterNotify) { - _entry_state = EnterNotify; - make_current(); - handle_mouse_entry(MOUSE_ENTERED); - if (_mouse_passive_motion_enabled) { - handle_mouse_motion(event.xcrossing.x, event.xcrossing.y); - } - } + // Overlays can generate multiple enter events + if (_entry_state != EnterNotify) { + _entry_state = EnterNotify; + make_current(); + handle_mouse_entry(MOUSE_ENTERED); + if (_mouse_passive_motion_enabled) { + handle_mouse_motion(event.xcrossing.x, event.xcrossing.y); + } + } } else { // event.type == LeaveNotify - if (_entry_state != LeaveNotify) { - _entry_state = LeaveNotify; - make_current(); - handle_mouse_entry(MOUSE_EXITED); - } + if (_entry_state != LeaveNotify) { + _entry_state = LeaveNotify; + make_current(); + handle_mouse_entry(MOUSE_EXITED); + } } } else if (_mouse_passive_motion_enabled) { make_current(); @@ -1179,61 +1179,61 @@ void glxGraphicsWindow::process_events(void) if (got_event) { switch (event.type) { case MappingNotify: - XRefreshKeyboardMapping((XMappingEvent *) &event); - break; + XRefreshKeyboardMapping((XMappingEvent *) &event); + break; case ConfigureNotify: - if ((window = glx->find_window(event.xconfigure.window)) != NULL) - window->process_event(event); - break; + if ((window = glx->find_window(event.xconfigure.window)) != NULL) + window->process_event(event); + break; case Expose: - XEvent ahead; - while (XEventsQueued(_display, QueuedAfterReading) > 0) { - XPeekEvent(_display, &ahead); - if (ahead.type != Expose || - ahead.xexpose.window != event.xexpose.window) { - break; - } - XNextEvent(_display, &event); - } + XEvent ahead; + while (XEventsQueued(_display, QueuedAfterReading) > 0) { + XPeekEvent(_display, &ahead); + if (ahead.type != Expose || + ahead.xexpose.window != event.xexpose.window) { + break; + } + XNextEvent(_display, &event); + } break; case ButtonPress: case ButtonRelease: - if ((window = glx->find_window(event.xbutton.window)) != NULL) - window->process_event(event); - break; + if ((window = glx->find_window(event.xbutton.window)) != NULL) + window->process_event(event); + break; case MotionNotify: - if ((window = glx->find_window(event.xmotion.window)) != NULL) - window->process_event(event); + if ((window = glx->find_window(event.xmotion.window)) != NULL) + window->process_event(event); break; case KeyPress: case KeyRelease: - if ((window = glx->find_window(event.xmotion.window)) != NULL) - window->process_event(event); - break; + if ((window = glx->find_window(event.xmotion.window)) != NULL) + window->process_event(event); + break; case EnterNotify: case LeaveNotify: - if (event.xcrossing.mode != NotifyNormal || - event.xcrossing.mode == NotifyNonlinearVirtual || - event.xcrossing.mode == NotifyVirtual) { - // Ignore "virtual" window enter/leave events - break; - } - if ((window = glx->find_window(event.xcrossing.window)) != NULL) - window->process_event(event); - break; + if (event.xcrossing.mode != NotifyNormal || + event.xcrossing.mode == NotifyNonlinearVirtual || + event.xcrossing.mode == NotifyVirtual) { + // Ignore "virtual" window enter/leave events + break; + } + if ((window = glx->find_window(event.xcrossing.window)) != NULL) + window->process_event(event); + break; case UnmapNotify: case VisibilityNotify: - break; + break; case ClientMessage: - break; + break; case DestroyNotify: case CirculateNotify: case CreateNotify: case GravityNotify: case ReparentNotify: - break; + break; default: - break; + break; } } } @@ -1431,7 +1431,7 @@ TypeHandle glxGraphicsWindow::get_class_type(void) { void glxGraphicsWindow::init_type(void) { GraphicsWindow::init_type(); register_type(_type_handle, "glxGraphicsWindow", - GraphicsWindow::get_class_type()); + GraphicsWindow::get_class_type()); } TypeHandle glxGraphicsWindow::get_type(void) const { diff --git a/panda/src/glxdisplay/glxGraphicsWindow.h b/panda/src/glxdisplay/glxGraphicsWindow.h index f9d0c5f1b1..e884f33538 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.h +++ b/panda/src/glxdisplay/glxGraphicsWindow.h @@ -22,10 +22,10 @@ //////////////////////////////////////////////////////////////////// class glxGraphicsPipe; -const int GLXWIN_PROCESSING = 1; -const int GLXWIN_REDISPLAY = 2; -const int GLXWIN_CONFIGURE = 4; -const int GLXWIN_EVENT = 8; +const int GLXWIN_PROCESSING = 1; +const int GLXWIN_REDISPLAY = 2; +const int GLXWIN_CONFIGURE = 4; +const int GLXWIN_EVENT = 8; //////////////////////////////////////////////////////////////////// // Class : glxGraphicsWindow @@ -36,7 +36,7 @@ class glxGraphicsWindow : public GraphicsWindow public: glxGraphicsWindow( GraphicsPipe* pipe ); glxGraphicsWindow( GraphicsPipe* pipe, - const GraphicsWindow::Properties& props ); + const GraphicsWindow::Properties& props ); virtual ~glxGraphicsWindow( void ); virtual bool supports_update() const; @@ -82,23 +82,23 @@ protected: INLINE void remove_event_mask(long event_mask); private: - Display* _display; - Window _xwindow; - GLXContext _context; - XVisualInfo* _visual; - Colormap _colormap; - int _connection_fd; - uint _change_mask; - int _configure_mask; - long _event_mask; + Display* _display; + Window _xwindow; + GLXContext _context; + XVisualInfo* _visual; + Colormap _colormap; + int _connection_fd; + uint _change_mask; + int _configure_mask; + long _event_mask; - static const char* _glx_extensions; - bool _mouse_input_enabled; - bool _mouse_motion_enabled; - bool _mouse_passive_motion_enabled; - bool _mouse_entry_enabled; - int _entry_state; - bool _ignore_key_repeat; + static const char* _glx_extensions; + bool _mouse_input_enabled; + bool _mouse_motion_enabled; + bool _mouse_passive_motion_enabled; + bool _mouse_entry_enabled; + int _entry_state; + bool _ignore_key_repeat; // fps meter stuff double _start_time; diff --git a/panda/src/gobj/LOD.cxx b/panda/src/gobj/LOD.cxx index 2fded53081..454981b561 100644 --- a/panda/src/gobj/LOD.cxx +++ b/panda/src/gobj/LOD.cxx @@ -81,7 +81,7 @@ xform(const LMatrix4f &mat) { // Access: Public // Description: Computes the distance between two points and returns // the index for the child of the LOD by testing against -// the corresponding list of switching distances. +// the corresponding list of switching distances. //////////////////////////////////////////////////////////////////// int LOD:: compute_child(const LPoint3f &cam_pos, const LPoint3f ¢er) const { diff --git a/panda/src/gobj/LOD.h b/panda/src/gobj/LOD.h index b329899cba..4cb5c50fd7 100644 --- a/panda/src/gobj/LOD.h +++ b/panda/src/gobj/LOD.h @@ -68,7 +68,7 @@ protected: //////////////////////////////////////////////////////////////////// // Class : LOD // Description : Computes whether a level-of-detail should be rendered -// or not based on distance from the rendering camera. +// or not based on distance from the rendering camera. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA LOD : public TypedReferenceCount { public: @@ -79,7 +79,7 @@ public: void xform(const LMatrix4f &mat); int compute_child(const LPoint3f &cam_pos, - const LPoint3f ¢er) const; + const LPoint3f ¢er) const; void write_datagram(Datagram &destination) const; void read_datagram(DatagramIterator &source); @@ -88,8 +88,8 @@ public: void write(ostream &out, int indent_level = 0) const; public: - LPoint3f _center; - LODSwitchVector _switch_vector; + LPoint3f _center; + LODSwitchVector _switch_vector; public: static TypeHandle get_class_type() { @@ -98,7 +98,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "LOD", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/drawable.h b/panda/src/gobj/drawable.h index 0018005ca5..d561a9e805 100644 --- a/panda/src/gobj/drawable.h +++ b/panda/src/gobj/drawable.h @@ -28,12 +28,12 @@ class BamWriter; // Class : Drawable // Description : Object that can be drawn (i.e. issues graphics // commands). -// NOTE: We had to change the name to dDrawable because -// the stupid bastards who wrote X didn't add a prefix -// to their variable names +// NOTE: We had to change the name to dDrawable because +// the stupid bastards who wrote X didn't add a prefix +// to their variable names //////////////////////////////////////////////////////////////////// class EXPCL_PANDA dDrawable : public ReferenceCount, public WritableConfigurable, - public BoundedObject { + public BoundedObject { public: dDrawable() : WritableConfigurable() { @@ -63,9 +63,9 @@ public: WritableConfigurable::init_type(); BoundedObject::init_type(); register_type(_type_handle, "dDrawable", - ReferenceCount::get_class_type(), - WritableConfigurable::get_class_type(), - BoundedObject::get_class_type()); + ReferenceCount::get_class_type(), + WritableConfigurable::get_class_type(), + BoundedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/fog.cxx b/panda/src/gobj/fog.cxx index 47d4387abb..65e298411c 100644 --- a/panda/src/gobj/fog.cxx +++ b/panda/src/gobj/fog.cxx @@ -69,7 +69,7 @@ void Fog::compute_density(void) { break; case M_exponential: // Multiplier = ln(2^bits) - // attempt to compute density based on full + // attempt to compute density based on full opaque_multiplier = MathNumbers::ln2 * _bits_per_color_channel; _density = opaque_multiplier / _opaque_distance; break; @@ -93,12 +93,12 @@ void Fog:: output(ostream &out) const { out << "fog:" << _mode; switch (_mode) { - case M_linear: + case M_linear: break; case M_exponential: case M_exponential_squared: out << "(" << _bits_per_color_channel << "," << _density - << "," << _opaque_distance << ")"; + << "," << _opaque_distance << ")"; break; }; } diff --git a/panda/src/gobj/fog.h b/panda/src/gobj/fog.h index 32eaea6f68..908df473b9 100644 --- a/panda/src/gobj/fog.h +++ b/panda/src/gobj/fog.h @@ -57,12 +57,12 @@ protected: void compute_density(void); protected: - Mode _mode; - int _bits_per_color_channel; - Colorf _color; - float _onset_distance; - float _opaque_distance; - float _density; + Mode _mode; + int _bits_per_color_channel; + Colorf _color; + float _onset_distance; + float _opaque_distance; + float _density; public: @@ -72,7 +72,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "Fog", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 2644c24fec..deb90e89e5 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -190,11 +190,11 @@ operator = (const Geom ©) { //////////////////////////////////////////////////////////////////// void Geom:: set_coords(const PTA_Vertexf &coords, GeomBindType bind, - const PTA_ushort &vindex) { + const PTA_ushort &vindex) { _coords = coords; assert(bind == G_PER_VERTEX); _bind[G_COORD] = bind; - + if ( vindex ) _vindex = vindex; @@ -209,7 +209,7 @@ set_coords(const PTA_Vertexf &coords, GeomBindType bind, //////////////////////////////////////////////////////////////////// void Geom:: set_normals(const PTA_Normalf &norms, GeomBindType bind, - const PTA_ushort &nindex) { + const PTA_ushort &nindex) { _norms = norms; _bind[G_NORMAL] = bind; @@ -226,7 +226,7 @@ set_normals(const PTA_Normalf &norms, GeomBindType bind, //////////////////////////////////////////////////////////////////// void Geom:: set_colors(const PTA_Colorf &colors, GeomBindType bind, - const PTA_ushort &cindex) { + const PTA_ushort &cindex) { _colors = colors; _bind[G_COLOR] = bind; @@ -243,7 +243,7 @@ set_colors(const PTA_Colorf &colors, GeomBindType bind, //////////////////////////////////////////////////////////////////// void Geom:: set_texcoords(const PTA_TexCoordf &texcoords, GeomBindType bind, - const PTA_ushort &tindex) { + const PTA_ushort &tindex) { _texcoords = texcoords; assert(bind == G_PER_VERTEX || bind == G_OFF); _bind[G_TEXCOORD] = bind; @@ -261,7 +261,7 @@ set_texcoords(const PTA_TexCoordf &texcoords, GeomBindType bind, //////////////////////////////////////////////////////////////////// void Geom:: get_coords(PTA_Vertexf &coords, GeomBindType &bind, - PTA_ushort &vindex) const { + PTA_ushort &vindex) const { coords = _coords; bind = _bind[G_COORD]; vindex = _vindex; @@ -274,7 +274,7 @@ get_coords(PTA_Vertexf &coords, GeomBindType &bind, //////////////////////////////////////////////////////////////////// void Geom:: get_normals(PTA_Normalf &norms, GeomBindType &bind, - PTA_ushort &nindex) const { + PTA_ushort &nindex) const { norms = _norms; bind = _bind[G_NORMAL]; nindex = _nindex; @@ -287,7 +287,7 @@ get_normals(PTA_Normalf &norms, GeomBindType &bind, //////////////////////////////////////////////////////////////////// void Geom:: get_colors(PTA_Colorf &colors, GeomBindType &bind, - PTA_ushort &cindex) const { + PTA_ushort &cindex) const { colors = _colors; bind = _bind[G_COLOR]; cindex = _cindex; @@ -300,7 +300,7 @@ get_colors(PTA_Colorf &colors, GeomBindType &bind, //////////////////////////////////////////////////////////////////// void Geom:: get_texcoords(PTA_TexCoordf &texcoords, GeomBindType &bind, - PTA_ushort &tindex) const { + PTA_ushort &tindex) const { texcoords = _texcoords; bind = _bind[G_TEXCOORD]; tindex = _tindex; @@ -576,8 +576,8 @@ fillin(DatagramIterator& scan, BamReader* manager) { template static void describe_attr(ostream &out, const Geom *geom, - GeomBindType bind, const PTA(VecType) &array, - bool newline, int indent_level) { + GeomBindType bind, const PTA(VecType) &array, + bool newline, int indent_level) { PTA_int lengths = geom->get_lengths(); int num_prims = geom->get_num_prims(); bool components = geom->uses_components(); @@ -592,21 +592,21 @@ describe_attr(ostream &out, const Geom *geom, num_verts = geom->get_num_vertices_per_prim(); for (i = 0; i < num_prims; i++) { if (components) { - num_verts = lengths[i]; + num_verts = lengths[i]; } out << "\n"; indent(out, indent_level) << "[ "; if (num_verts > 0) { - out << array[vi++]; - for (j = 1; j < num_verts; j++) { - if (newline) { - out << "\n"; - indent(out, indent_level + 2); - } else { - out << " "; - } - out << array[vi++]; - } + out << array[vi++]; + for (j = 1; j < num_verts; j++) { + if (newline) { + out << "\n"; + indent(out, indent_level + 2); + } else { + out << " "; + } + out << array[vi++]; + } } out << " ]"; } @@ -615,28 +615,28 @@ describe_attr(ostream &out, const Geom *geom, case G_PER_COMPONENT: if (!components) { indent(out, indent_level) - << "Invalid per-component attribute specified!"; + << "Invalid per-component attribute specified!"; } else { indent(out, indent_level) - << "Per component:"; + << "Per component:"; vi = 0; for (i = 0; i < num_prims; i++) { - num_verts = lengths[i] - geom->get_num_more_vertices_than_components(); - out << "\n"; - indent(out, indent_level) << "[ "; - if (num_verts > 0) { - out << array[vi++]; - for (j = 1; j < num_verts; j++) { - if (newline) { - out << "\n"; - indent(out, indent_level + 2); - } else { - out << " "; - } - out << array[vi++]; - } - out << " ]"; - } + num_verts = lengths[i] - geom->get_num_more_vertices_than_components(); + out << "\n"; + indent(out, indent_level) << "[ "; + if (num_verts > 0) { + out << array[vi++]; + for (j = 1; j < num_verts; j++) { + if (newline) { + out << "\n"; + indent(out, indent_level + 2); + } else { + out << " "; + } + out << array[vi++]; + } + out << " ]"; + } } } break; @@ -646,10 +646,10 @@ describe_attr(ostream &out, const Geom *geom, << "Per prim:"; for (i = 0; i < num_prims; i++) { if (newline) { - out << "\n"; - indent(out, indent_level + 2); + out << "\n"; + indent(out, indent_level + 2); } else { - out << " "; + out << " "; } out << array[i]; } @@ -779,12 +779,12 @@ get_min_max(Vertexf& min, Vertexf& max) const { max[0] = _coords[i][0]; if (_coords[i][1] < min[1]) - min[1] = _coords[i][1]; + min[1] = _coords[i][1]; else if (_coords[i][1] > max[1]) max[1] = _coords[i][1]; if (_coords[i][2] < min[2]) - min[2] = _coords[i][2]; + min[2] = _coords[i][2]; else if (_coords[i][2] > max[2]) max[2] = _coords[i][2]; } diff --git a/panda/src/gobj/geom.h b/panda/src/gobj/geom.h index 2566d0124b..afb1ffe395 100644 --- a/panda/src/gobj/geom.h +++ b/panda/src/gobj/geom.h @@ -99,7 +99,7 @@ public: typedef const TexCoordf &GetNextTexCoord(TexCoordIterator &); typedef const Colorf &GetNextColor(ColorIterator &); - + Geom( void ); Geom( const Geom& copy ); ~Geom( void ); @@ -131,34 +131,34 @@ public: void set_coords( const PTA_Vertexf &coords, - GeomBindType bind, - const PTA_ushort &vindex = - PTA_ushort() ); + GeomBindType bind, + const PTA_ushort &vindex = + PTA_ushort() ); void set_normals( const PTA_Normalf &norms, - GeomBindType bind, - const PTA_ushort &nindex = - PTA_ushort() ); + GeomBindType bind, + const PTA_ushort &nindex = + PTA_ushort() ); void set_colors( const PTA_Colorf &colors, - GeomBindType bind, - const PTA_ushort &cindex = - PTA_ushort() ); + GeomBindType bind, + const PTA_ushort &cindex = + PTA_ushort() ); void set_texcoords( const PTA_TexCoordf &texcoords, - GeomBindType bind, - const PTA_ushort &tindex = - PTA_ushort() ); + GeomBindType bind, + const PTA_ushort &tindex = + PTA_ushort() ); void get_coords( PTA_Vertexf &coords, - GeomBindType &bind, - PTA_ushort &vindex) const; + GeomBindType &bind, + PTA_ushort &vindex) const; void get_normals( PTA_Normalf &norms, - GeomBindType &bind, - PTA_ushort &nindex) const; + GeomBindType &bind, + PTA_ushort &nindex) const; void get_colors( PTA_Colorf &colors, - GeomBindType &bind, - PTA_ushort &cindex) const; + GeomBindType &bind, + PTA_ushort &cindex) const; void get_texcoords( PTA_TexCoordf &texcoords, - GeomBindType &bind, - PTA_ushort &tindex) const; + GeomBindType &bind, + PTA_ushort &tindex) const; PUBLISHED: INLINE GeomBindType get_binding(int attr) const; @@ -250,7 +250,7 @@ public: static void init_type() { dDrawable::init_type(); register_type(_type_handle, "Geom", - dDrawable::get_class_type()); + dDrawable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomPoint.h b/panda/src/gobj/geomPoint.h index 7b690f80bb..d7dd6e510e 100644 --- a/panda/src/gobj/geomPoint.h +++ b/panda/src/gobj/geomPoint.h @@ -61,7 +61,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomPoint", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomPolygon.h b/panda/src/gobj/geomPolygon.h index 77b18d002d..4920d2b766 100644 --- a/panda/src/gobj/geomPolygon.h +++ b/panda/src/gobj/geomPolygon.h @@ -49,7 +49,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomPolygon", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomQuad.cxx b/panda/src/gobj/geomQuad.cxx index 3a2e486334..b5175362b3 100644 --- a/panda/src/gobj/geomQuad.cxx +++ b/panda/src/gobj/geomQuad.cxx @@ -76,11 +76,11 @@ get_tris() const { ushort indices[4]; if (_vindex.empty()) { for (int j = 0; j < 4; j++) { - indices[j] = k++; + indices[j] = k++; } } else { for (int j = 0; j < 4; j++) { - indices[j] = _vindex[k++]; + indices[j] = _vindex[k++]; } } diff --git a/panda/src/gobj/geomQuad.h b/panda/src/gobj/geomQuad.h index 60e5608984..58f46fa7b8 100644 --- a/panda/src/gobj/geomQuad.h +++ b/panda/src/gobj/geomQuad.h @@ -47,7 +47,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomQuad", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomSprite.h b/panda/src/gobj/geomSprite.h index 49913709fb..42572577c4 100644 --- a/panda/src/gobj/geomSprite.h +++ b/panda/src/gobj/geomSprite.h @@ -16,7 +16,7 @@ class EXPCL_PANDA GeomSprite : public Geom { public: GeomSprite(Texture *tex = (Texture *) NULL, - bool alpha_disable = false); + bool alpha_disable = false); virtual Geom *make_copy() const; virtual void print_draw_immediate() const; @@ -81,7 +81,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomSprite", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomTri.cxx b/panda/src/gobj/geomTri.cxx index 0f1b3eb778..6b2538fea1 100644 --- a/panda/src/gobj/geomTri.cxx +++ b/panda/src/gobj/geomTri.cxx @@ -53,15 +53,15 @@ print_draw_immediate(void) const // Draw overall if ( _color_command[G_OVERALL] != _issue_color_noop ) { - nout << "Color (Overall): "; - if ( tcindex ) - { - nout << "idx: " << *tcindex << " "; - nout << tcolors[*(tcindex++)]; - } - else - nout << *(tcolors++); - nout << endl; + nout << "Color (Overall): "; + if ( tcindex ) + { + nout << "idx: " << *tcindex << " "; + nout << tcolors[*(tcindex++)]; + } + else + nout << *(tcolors++); + nout << endl; } if ( _normal_command[G_OVERALL] != _issue_normal_noop ) { @@ -69,10 +69,10 @@ print_draw_immediate(void) const if ( tnindex ) { nout << "idx: " << *tnindex << " "; - nout << tnorms[*(tnindex++)]; + nout << tnorms[*(tnindex++)]; } else - nout << *(tnorms++); + nout << *(tnorms++); nout << endl; } @@ -81,45 +81,45 @@ print_draw_immediate(void) const for ( i = nprims; i > 0; i-- ) { // Draw per primitive - if ( _color_command[G_PER_PRIM] != _issue_color_noop ) - { + if ( _color_command[G_PER_PRIM] != _issue_color_noop ) + { nout << "Color (Per Prim): "; if ( tcindex ) { - nout << "idx: " << *tcindex << " "; - nout << tcolors[*(tcindex++)]; + nout << "idx: " << *tcindex << " "; + nout << tcolors[*(tcindex++)]; } else - nout << *(tcolors++); + nout << *(tcolors++); nout << endl; - } - if ( _normal_command[G_PER_PRIM] != _issue_normal_noop ) - { + } + if ( _normal_command[G_PER_PRIM] != _issue_normal_noop ) + { nout << "Normal (Per Prim): "; if ( tnindex ) { - nout << "idx: " << *tnindex << " "; - nout << tnorms[*(tnindex++)]; + nout << "idx: " << *tnindex << " "; + nout << tnorms[*(tnindex++)]; } else - nout << *(tnorms++); + nout << *(tnorms++); nout << endl; - } + } for ( j = 0; j < 3; j++ ) { // Draw per vertex if ( _color_command[G_PER_VERTEX] != _issue_color_noop ) { - nout << "Color (Per Vertex): "; - if ( tcindex ) - { + nout << "Color (Per Vertex): "; + if ( tcindex ) + { nout << "idx: " << *tcindex << " "; nout << tcolors[*(tcindex++)]; } - else + else nout << *(tcolors++); - nout << endl; + nout << endl; } if ( _normal_command[G_PER_VERTEX] != _issue_normal_noop ) { @@ -200,11 +200,11 @@ get_tris() const { for (int i = 0; i < _numprims; i++) { if (_vindex.empty()) { for (int j = 0; j < 3; j++) { - tris.push_back(k++); + tris.push_back(k++); } } else { for (int j = 0; j < 3; j++) { - tris.push_back(_vindex[k++]); + tris.push_back(_vindex[k++]); } } } diff --git a/panda/src/gobj/geomTri.h b/panda/src/gobj/geomTri.h index 230e82aa7c..f8348e18f6 100644 --- a/panda/src/gobj/geomTri.h +++ b/panda/src/gobj/geomTri.h @@ -47,7 +47,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTri", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomTrifan.cxx b/panda/src/gobj/geomTrifan.cxx index 85efe04bff..bb5c1ae083 100644 --- a/panda/src/gobj/geomTrifan.cxx +++ b/panda/src/gobj/geomTrifan.cxx @@ -246,16 +246,16 @@ explode() const { int v; for (v = 0; v <= 2; v += 2) { if (get_binding(G_COORD) == G_PER_VERTEX) { - f3vertex[v] = get_next_vertex(vi); + f3vertex[v] = get_next_vertex(vi); } if (get_binding(G_NORMAL) == G_PER_VERTEX) { - f3normal[v] = get_next_normal(ni); + f3normal[v] = get_next_normal(ni); } if (get_binding(G_TEXCOORD) == G_PER_VERTEX) { - f3texcoord[v] = get_next_texcoord(ti); + f3texcoord[v] = get_next_texcoord(ti); } if (get_binding(G_COLOR) == G_PER_VERTEX) { - f3color[v] = get_next_color(ci); + f3color[v] = get_next_color(ci); } } @@ -270,41 +270,41 @@ explode() const { f3color[1] = f3color[2]; if (get_binding(G_COLOR) == G_PER_PRIM) { - colors.push_back(per_trifan_color); + colors.push_back(per_trifan_color); } else if (get_binding(G_COLOR) == G_PER_COMPONENT) { - colors.push_back(get_next_color(ci)); + colors.push_back(get_next_color(ci)); } if (get_binding(G_NORMAL) == G_PER_PRIM) { - normals.push_back(per_trifan_normal); + normals.push_back(per_trifan_normal); } else if (get_binding(G_NORMAL) == G_PER_COMPONENT) { - normals.push_back(get_next_normal(ni)); + normals.push_back(get_next_normal(ni)); } // Per-vertex attributes. if (get_binding(G_COORD) == G_PER_VERTEX) { - f3vertex[2] = get_next_vertex(vi); - coords.push_back(f3vertex[0]); - coords.push_back(f3vertex[1]); - coords.push_back(f3vertex[2]); + f3vertex[2] = get_next_vertex(vi); + coords.push_back(f3vertex[0]); + coords.push_back(f3vertex[1]); + coords.push_back(f3vertex[2]); } if (get_binding(G_NORMAL) == G_PER_VERTEX) { - f3normal[2] = get_next_normal(ni); - normals.push_back(f3normal[0]); - normals.push_back(f3normal[1]); - normals.push_back(f3normal[2]); + f3normal[2] = get_next_normal(ni); + normals.push_back(f3normal[0]); + normals.push_back(f3normal[1]); + normals.push_back(f3normal[2]); } if (get_binding(G_TEXCOORD) == G_PER_VERTEX) { - f3texcoord[2] = get_next_texcoord(ti); - texcoords.push_back(f3texcoord[0]); - texcoords.push_back(f3texcoord[1]); - texcoords.push_back(f3texcoord[2]); + f3texcoord[2] = get_next_texcoord(ti); + texcoords.push_back(f3texcoord[0]); + texcoords.push_back(f3texcoord[1]); + texcoords.push_back(f3texcoord[2]); } if (get_binding(G_COLOR) == G_PER_VERTEX) { - f3color[2] = get_next_color(ci); - colors.push_back(f3color[0]); - colors.push_back(f3color[1]); - colors.push_back(f3color[2]); + f3color[2] = get_next_color(ci); + colors.push_back(f3color[0]); + colors.push_back(f3color[1]); + colors.push_back(f3color[2]); } } } @@ -312,12 +312,12 @@ explode() const { Geom *tris = new GeomTri; tris->set_coords(coords, get_binding(G_COORD)); tris->set_normals(normals, - get_binding(G_NORMAL) == G_PER_COMPONENT ? - G_PER_PRIM : get_binding(G_NORMAL)); + get_binding(G_NORMAL) == G_PER_COMPONENT ? + G_PER_PRIM : get_binding(G_NORMAL)); tris->set_texcoords(texcoords, get_binding(G_TEXCOORD)); tris->set_colors(colors, - get_binding(G_COLOR) == G_PER_COMPONENT ? - G_PER_PRIM : get_binding(G_COLOR)); + get_binding(G_COLOR) == G_PER_COMPONENT ? + G_PER_PRIM : get_binding(G_COLOR)); tris->set_num_prims(num_tris); return tris; @@ -360,9 +360,9 @@ get_tris() const { for (int j = 0; j < len; j++) { if (_vindex.empty()) { - v2 = k++; + v2 = k++; } else { - v2 = _vindex[k++]; + v2 = _vindex[k++]; } tris.push_back(v0); diff --git a/panda/src/gobj/geomTrifan.h b/panda/src/gobj/geomTrifan.h index 376d566afd..681e1765c1 100644 --- a/panda/src/gobj/geomTrifan.h +++ b/panda/src/gobj/geomTrifan.h @@ -50,7 +50,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTrifan", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/geomTristrip.cxx b/panda/src/gobj/geomTristrip.cxx index 3de1ba4bb0..271d251bce 100644 --- a/panda/src/gobj/geomTristrip.cxx +++ b/panda/src/gobj/geomTristrip.cxx @@ -114,15 +114,15 @@ void GeomTristrip::print_draw_immediate( void ) const // Draw per component if ( _color_command[G_PER_COMPONENT] != _issue_color_noop ) { - nout << "Color (Per Component): "; - if ( tcindex ) - { + nout << "Color (Per Component): "; + if ( tcindex ) + { nout << "idx: " << *tcindex << " "; nout << tcolors[*(tcindex++)]; - } - else + } + else nout << *(tcolors++); - nout << endl; + nout << endl; } if ( _normal_command[G_PER_COMPONENT] != _issue_normal_noop ) { @@ -192,7 +192,7 @@ void GeomTristrip::print_draw_immediate( void ) const } if ( !j ) { - nout << "EndGfx()" << endl; + nout << "EndGfx()" << endl; continue; } else @@ -247,7 +247,7 @@ void GeomTristrip::print_draw_immediate( void ) const nout << endl; } - nout << "EndGfx()" << endl; + nout << "EndGfx()" << endl; continue; } } @@ -334,16 +334,16 @@ explode() const { int v; for (v = 0; v <= 2; v += 2) { if (get_binding(G_COORD) == G_PER_VERTEX) { - f3vertex[v] = get_next_vertex(vi); + f3vertex[v] = get_next_vertex(vi); } if (get_binding(G_NORMAL) == G_PER_VERTEX) { - f3normal[v] = get_next_normal(ni); + f3normal[v] = get_next_normal(ni); } if (get_binding(G_TEXCOORD) == G_PER_VERTEX) { - f3texcoord[v] = get_next_texcoord(ti); + f3texcoord[v] = get_next_texcoord(ti); } if (get_binding(G_COLOR) == G_PER_VERTEX) { - f3color[v] = get_next_color(ci); + f3color[v] = get_next_color(ci); } } @@ -353,55 +353,55 @@ explode() const { num_tris++; if (get_binding(G_COLOR) == G_PER_PRIM) { - colors.push_back(per_tristrip_color); + colors.push_back(per_tristrip_color); } else if (get_binding(G_COLOR) == G_PER_COMPONENT) { - colors.push_back(get_next_color(ci)); + colors.push_back(get_next_color(ci)); } if (get_binding(G_NORMAL) == G_PER_PRIM) { - normals.push_back(per_tristrip_normal); + normals.push_back(per_tristrip_normal); } else if (get_binding(G_NORMAL) == G_PER_COMPONENT) { - normals.push_back(get_next_normal(ni)); + normals.push_back(get_next_normal(ni)); } if ((v & 1) == 0) { - // Even. The triangle is counter-clockwise. - f3vertex[1] = f3vertex[2]; - f3normal[1] = f3normal[2]; - f3texcoord[1] = f3texcoord[2]; - f3color[1] = f3color[2]; + // Even. The triangle is counter-clockwise. + f3vertex[1] = f3vertex[2]; + f3normal[1] = f3normal[2]; + f3texcoord[1] = f3texcoord[2]; + f3color[1] = f3color[2]; } else { - // Odd. The triangle is clockwise. - f3vertex[0] = f3vertex[2]; - f3normal[0] = f3normal[2]; - f3texcoord[0] = f3texcoord[2]; - f3color[0] = f3color[2]; + // Odd. The triangle is clockwise. + f3vertex[0] = f3vertex[2]; + f3normal[0] = f3normal[2]; + f3texcoord[0] = f3texcoord[2]; + f3color[0] = f3color[2]; } // Per-vertex attributes. if (get_binding(G_COORD) == G_PER_VERTEX) { - f3vertex[2] = get_next_vertex(vi); - coords.push_back(f3vertex[0]); - coords.push_back(f3vertex[1]); - coords.push_back(f3vertex[2]); + f3vertex[2] = get_next_vertex(vi); + coords.push_back(f3vertex[0]); + coords.push_back(f3vertex[1]); + coords.push_back(f3vertex[2]); } if (get_binding(G_NORMAL) == G_PER_VERTEX) { - f3normal[2] = get_next_normal(ni); - normals.push_back(f3normal[0]); - normals.push_back(f3normal[1]); - normals.push_back(f3normal[2]); + f3normal[2] = get_next_normal(ni); + normals.push_back(f3normal[0]); + normals.push_back(f3normal[1]); + normals.push_back(f3normal[2]); } if (get_binding(G_TEXCOORD) == G_PER_VERTEX) { - f3texcoord[2] = get_next_texcoord(ti); - texcoords.push_back(f3texcoord[0]); - texcoords.push_back(f3texcoord[1]); - texcoords.push_back(f3texcoord[2]); + f3texcoord[2] = get_next_texcoord(ti); + texcoords.push_back(f3texcoord[0]); + texcoords.push_back(f3texcoord[1]); + texcoords.push_back(f3texcoord[2]); } if (get_binding(G_COLOR) == G_PER_VERTEX) { - f3color[2] = get_next_color(ci); - colors.push_back(f3color[0]); - colors.push_back(f3color[1]); - colors.push_back(f3color[2]); + f3color[2] = get_next_color(ci); + colors.push_back(f3color[0]); + colors.push_back(f3color[1]); + colors.push_back(f3color[2]); } } } @@ -409,12 +409,12 @@ explode() const { Geom *tris = new GeomTri; tris->set_coords(coords, get_binding(G_COORD)); tris->set_normals(normals, - get_binding(G_NORMAL) == G_PER_COMPONENT ? - G_PER_PRIM : get_binding(G_NORMAL)); + get_binding(G_NORMAL) == G_PER_COMPONENT ? + G_PER_PRIM : get_binding(G_NORMAL)); tris->set_texcoords(texcoords, get_binding(G_TEXCOORD)); tris->set_colors(colors, - get_binding(G_COLOR) == G_PER_COMPONENT ? - G_PER_PRIM : get_binding(G_COLOR)); + get_binding(G_COLOR) == G_PER_COMPONENT ? + G_PER_PRIM : get_binding(G_COLOR)); tris->set_num_prims(num_tris); return tris; @@ -458,17 +458,17 @@ get_tris() const { for (int j = 2; j < len; j++) { if (_vindex.empty()) { - v2 = k++; + v2 = k++; } else { - v2 = _vindex[k++]; + v2 = _vindex[k++]; } even = !even; if (even) { - ushort vtmp = v1; - v1 = v2; - v2 = vtmp; + ushort vtmp = v1; + v1 = v2; + v2 = vtmp; } tris.push_back(v0); @@ -476,10 +476,10 @@ get_tris() const { tris.push_back(v2); if (even) { - v0 = v2; + v0 = v2; } else { - v0 = v1; - v1 = v2; + v0 = v1; + v1 = v2; } } } diff --git a/panda/src/gobj/geomTristrip.h b/panda/src/gobj/geomTristrip.h index 18c2b277d1..81820e3eec 100644 --- a/panda/src/gobj/geomTristrip.h +++ b/panda/src/gobj/geomTristrip.h @@ -49,7 +49,7 @@ public: static void init_type() { Geom::init_type(); register_type(_type_handle, "GeomTristrip", - Geom::get_class_type()); + Geom::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/imageBuffer.cxx b/panda/src/gobj/imageBuffer.cxx index 97e2cdd3f3..3584fd5175 100644 --- a/panda/src/gobj/imageBuffer.cxx +++ b/panda/src/gobj/imageBuffer.cxx @@ -42,13 +42,13 @@ write_datagram(BamWriter *, Datagram &me) filename.find_on_searchpath(get_model_path()); if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Texture file " << get_name() << " found as " << filename << "\n"; + << "Texture file " << get_name() << " found as " << filename << "\n"; } alpha_filename.find_on_searchpath(get_texture_path()); alpha_filename.find_on_searchpath(get_model_path()); if (gobj_cat.is_debug()) { gobj_cat.debug() - << "Alpha image " << get_alpha_name() << " found as " << alpha_filename << "\n"; + << "Alpha image " << get_alpha_name() << " found as " << alpha_filename << "\n"; } break; diff --git a/panda/src/gobj/imageBuffer.h b/panda/src/gobj/imageBuffer.h index 29e9122a80..e91dace97e 100644 --- a/panda/src/gobj/imageBuffer.h +++ b/panda/src/gobj/imageBuffer.h @@ -41,11 +41,11 @@ public: virtual void copy(GraphicsStateGuardianBase *, const DisplayRegion *)=0; virtual void copy(GraphicsStateGuardianBase *, const DisplayRegion *, - const RenderBuffer &rb)=0; + const RenderBuffer &rb)=0; virtual void draw(GraphicsStateGuardianBase *)=0; virtual void draw(GraphicsStateGuardianBase *, const DisplayRegion *)=0; virtual void draw(GraphicsStateGuardianBase *, const DisplayRegion *, - const RenderBuffer &rb)=0; + const RenderBuffer &rb)=0; INLINE void set_alpha_name(const string &alpha_name); INLINE void clear_alpha_name(); @@ -71,8 +71,8 @@ public: dDrawable::init_type(); Namable::init_type(); register_type(_type_handle, "ImageBuffer", - dDrawable::get_class_type(), - Namable::get_class_type()); + dDrawable::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/material.h b/panda/src/gobj/material.h index e635b1846a..76e0ba6eef 100644 --- a/panda/src/gobj/material.h +++ b/panda/src/gobj/material.h @@ -96,7 +96,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "Material", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gobj/materialPool.cxx b/panda/src/gobj/materialPool.cxx index 38b55646cd..13c4c3a09d 100644 --- a/panda/src/gobj/materialPool.cxx +++ b/panda/src/gobj/materialPool.cxx @@ -36,8 +36,8 @@ ns_garbage_collect() { const Material *mat = (*mi); if (mat->get_ref_count() == 1) { if (gobj_cat.is_debug()) { - gobj_cat.debug() - << "Releasing " << *mat << "\n"; + gobj_cat.debug() + << "Releasing " << *mat << "\n"; } num_released++; } else { @@ -61,7 +61,7 @@ ns_list_contents(ostream &out) { for (mi = _materials.begin(); mi != _materials.end(); ++mi) { const Material *mat = (*mi); out << " " << *mat - << " (count = " << mat->get_ref_count() << ")\n"; + << " (count = " << mat->get_ref_count() << ")\n"; } } diff --git a/panda/src/gobj/orthoProjection.cxx b/panda/src/gobj/orthoProjection.cxx index e1aea6cdd5..5c808480a4 100644 --- a/panda/src/gobj/orthoProjection.cxx +++ b/panda/src/gobj/orthoProjection.cxx @@ -37,11 +37,11 @@ get_projection_mat(CoordinateSystem cs) const { // Function: OrthoProjection::make_geometry // Access: Public, Virtual // Description: Creates a GeomLine that describes the shape of the -// frustum for this projection +// frustum for this projection //////////////////////////////////////////////////////////////////// Geom *OrthoProjection:: make_geometry(const Colorf &color, - CoordinateSystem cs) const { + CoordinateSystem cs) const { Vertexf rtn, ltn, lbn, rbn; Vertexf rtf, ltf, lbf, rbf; diff --git a/panda/src/gobj/orthoProjection.h b/panda/src/gobj/orthoProjection.h index 7a187300f5..16707eeed7 100644 --- a/panda/src/gobj/orthoProjection.h +++ b/panda/src/gobj/orthoProjection.h @@ -25,7 +25,7 @@ public: virtual LMatrix4f get_projection_mat(CoordinateSystem cs = CS_default) const; virtual Geom* make_geometry(const Colorf &color = Colorf(0.0, 1.0, 0.0, 1.0), - CoordinateSystem cs = CS_default) const; + CoordinateSystem cs = CS_default) const; virtual BoundingVolume *make_bounds(CoordinateSystem cs = CS_default) const; @@ -46,7 +46,7 @@ public: static void init_type() { Projection::init_type(); register_type(_type_handle, "OrthoProjection", - Projection::get_class_type()); + Projection::get_class_type()); } private: diff --git a/panda/src/gobj/perspectiveProjection.cxx b/panda/src/gobj/perspectiveProjection.cxx index 6c3eb6d086..99f58c7c7c 100644 --- a/panda/src/gobj/perspectiveProjection.cxx +++ b/panda/src/gobj/perspectiveProjection.cxx @@ -38,11 +38,11 @@ get_projection_mat(CoordinateSystem cs) const { // Function: PerspectiveProjection::make_geometry // Access: Public, Virtual // Description: Creates a GeomLine that describes the shape of the -// frustum for this projection +// frustum for this projection //////////////////////////////////////////////////////////////////// Geom *PerspectiveProjection:: make_geometry(const Colorf &color, - CoordinateSystem cs) const { + CoordinateSystem cs) const { Vertexf rtn, ltn, lbn, rbn; Vertexf rtf, ltf, lbf, rbf; @@ -143,7 +143,7 @@ make_bounds(CoordinateSystem cs) const { //////////////////////////////////////////////////////////////////// bool PerspectiveProjection:: extrude(const LPoint2f &point2d, LPoint3f &origin, LVector3f &direction, - CoordinateSystem cs) const { + CoordinateSystem cs) const { if (point2d[0] < -1 || point2d[0] > 1 || point2d[1] < -1 || point2d[1] > 1) { // The point is off the near plane. @@ -153,9 +153,9 @@ extrude(const LPoint2f &point2d, LPoint3f &origin, LVector3f &direction, // Scale the point from (-1,1) to the range of the frustum. LPoint2f scaled(_frustum._l + 0.5 * (point2d[0] + 1.0) * - (_frustum._r - _frustum._l), - _frustum._b + 0.5 * (point2d[1] + 1.0) * - (_frustum._t - _frustum._b)); + (_frustum._r - _frustum._l), + _frustum._b + 0.5 * (point2d[1] + 1.0) * + (_frustum._t - _frustum._b)); LVector3f near_vector = LVector3f::rfu(scaled[0], _frustum._fnear, scaled[1], cs); @@ -180,7 +180,7 @@ extrude(const LPoint2f &point2d, LPoint3f &origin, LVector3f &direction, //////////////////////////////////////////////////////////////////// bool PerspectiveProjection:: project(const LPoint3f &point3d, LPoint2f &point2d, - CoordinateSystem cs) const { + CoordinateSystem cs) const { float f = point3d.dot(LVector3f::forward(cs)); if (f < _frustum._fnear || f > _frustum._ffar) { // The point is outside the near or far clipping planes. @@ -199,8 +199,8 @@ project(const LPoint3f &point3d, LPoint2f &point2d, } point2d.set((scaled[0] - _frustum._l) * 2.0 / - (_frustum._r - _frustum._l) - 1.0, - (scaled[1] - _frustum._b) * 2.0 / - (_frustum._t - _frustum._b) - 1.0); + (_frustum._r - _frustum._l) - 1.0, + (scaled[1] - _frustum._b) * 2.0 / + (_frustum._t - _frustum._b) - 1.0); return true; } diff --git a/panda/src/gobj/perspectiveProjection.h b/panda/src/gobj/perspectiveProjection.h index 10655c4e65..685eaea6a3 100644 --- a/panda/src/gobj/perspectiveProjection.h +++ b/panda/src/gobj/perspectiveProjection.h @@ -25,15 +25,15 @@ public: virtual LMatrix4f get_projection_mat(CoordinateSystem cs = CS_default) const; virtual Geom* make_geometry(const Colorf &color = Colorf(0.0, 1.0, 0.0, 1.0), - CoordinateSystem cs = CS_default) const; + CoordinateSystem cs = CS_default) const; virtual BoundingVolume *make_bounds(CoordinateSystem cs = CS_default) const; virtual bool extrude(const LPoint2f &point2d, - LPoint3f &origin, LVector3f &direction, - CoordinateSystem cs = CS_default) const; + LPoint3f &origin, LVector3f &direction, + CoordinateSystem cs = CS_default) const; virtual bool project(const LPoint3f &point3d, LPoint2f &point2d, - CoordinateSystem cs) const; + CoordinateSystem cs) const; INLINE const Frustumf &get_frustum() const; INLINE void set_frustum(const Frustumf &frust); @@ -52,7 +52,7 @@ public: static void init_type() { Projection::init_type(); register_type(_type_handle, "PerspectiveProjection", - Projection::get_class_type()); + Projection::get_class_type()); } private: diff --git a/panda/src/gobj/pixelBuffer.I b/panda/src/gobj/pixelBuffer.I index 57cb468916..d95507b368 100644 --- a/panda/src/gobj/pixelBuffer.I +++ b/panda/src/gobj/pixelBuffer.I @@ -31,7 +31,7 @@ PixelBuffer(void) : ImageBuffer() //////////////////////////////////////////////////////////////////// INLINE PixelBuffer:: PixelBuffer(int xsize, int ysize, int components, int component_width, - Type type, Format format) : + Type type, Format format) : ImageBuffer() { _xsize = xsize; @@ -93,7 +93,7 @@ operator = (const PixelBuffer ©) { INLINE PixelBuffer PixelBuffer:: rgb_buffer(int xsize, int ysize) { return PixelBuffer(xsize, ysize, 3, sizeof(uchar), T_unsigned_byte, - F_rgb); + F_rgb); } //////////////////////////////////////////////////////////////////// @@ -104,7 +104,7 @@ rgb_buffer(int xsize, int ysize) { INLINE PixelBuffer PixelBuffer:: rgba_buffer(int xsize, int ysize) { return PixelBuffer(xsize, ysize, 4, sizeof(uchar), T_unsigned_byte, - F_rgba); + F_rgba); } //////////////////////////////////////////////////////////////////// @@ -115,7 +115,7 @@ rgba_buffer(int xsize, int ysize) { INLINE PixelBuffer PixelBuffer:: depth_buffer(int xsize, int ysize) { return PixelBuffer(xsize, ysize, 1, sizeof(float), T_float, - F_depth_component); + F_depth_component); } //////////////////////////////////////////////////////////////////// @@ -126,7 +126,7 @@ depth_buffer(int xsize, int ysize) { INLINE PixelBuffer PixelBuffer:: stencil_buffer(int xsize, int ysize) { return PixelBuffer(xsize, ysize, 1, sizeof(uchar), T_unsigned_byte, - F_stencil_index); + F_stencil_index); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/pixelBuffer.cxx b/panda/src/gobj/pixelBuffer.cxx index dd77b13616..6196fa8a8c 100644 --- a/panda/src/gobj/pixelBuffer.cxx +++ b/panda/src/gobj/pixelBuffer.cxx @@ -120,16 +120,16 @@ bool PixelBuffer::load(const PNMImage& pnmimage) for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - store_unscaled_byte(idx, pnmimage.get_gray_val(i, j)); - } else { - store_unscaled_byte(idx, pnmimage.get_red_val(i, j)); - store_unscaled_byte(idx, pnmimage.get_green_val(i, j)); - store_unscaled_byte(idx, pnmimage.get_blue_val(i, j)); - } - if (has_alpha) { - store_unscaled_byte(idx, pnmimage.get_alpha_val(i, j)); - } + if (is_grayscale) { + store_unscaled_byte(idx, pnmimage.get_gray_val(i, j)); + } else { + store_unscaled_byte(idx, pnmimage.get_red_val(i, j)); + store_unscaled_byte(idx, pnmimage.get_green_val(i, j)); + store_unscaled_byte(idx, pnmimage.get_blue_val(i, j)); + } + if (has_alpha) { + store_unscaled_byte(idx, pnmimage.get_alpha_val(i, j)); + } } } @@ -142,16 +142,16 @@ bool PixelBuffer::load(const PNMImage& pnmimage) for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - store_unscaled_short(idx, pnmimage.get_gray_val(i, j)); - } else { - store_unscaled_short(idx, pnmimage.get_red_val(i, j)); - store_unscaled_short(idx, pnmimage.get_green_val(i, j)); - store_unscaled_short(idx, pnmimage.get_blue_val(i, j)); - } - if (has_alpha) { - store_unscaled_short(idx, pnmimage.get_alpha_val(i, j)); - } + if (is_grayscale) { + store_unscaled_short(idx, pnmimage.get_gray_val(i, j)); + } else { + store_unscaled_short(idx, pnmimage.get_red_val(i, j)); + store_unscaled_short(idx, pnmimage.get_green_val(i, j)); + store_unscaled_short(idx, pnmimage.get_blue_val(i, j)); + } + if (has_alpha) { + store_unscaled_short(idx, pnmimage.get_alpha_val(i, j)); + } } } @@ -166,16 +166,16 @@ bool PixelBuffer::load(const PNMImage& pnmimage) for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - store_scaled_byte(idx, pnmimage.get_gray_val(i, j), scale); - } else { - store_scaled_byte(idx, pnmimage.get_red_val(i, j), scale); - store_scaled_byte(idx, pnmimage.get_green_val(i, j), scale); - store_scaled_byte(idx, pnmimage.get_blue_val(i, j), scale); - } - if (has_alpha) { - store_scaled_byte(idx, pnmimage.get_alpha_val(i, j), scale); - } + if (is_grayscale) { + store_scaled_byte(idx, pnmimage.get_gray_val(i, j), scale); + } else { + store_scaled_byte(idx, pnmimage.get_red_val(i, j), scale); + store_scaled_byte(idx, pnmimage.get_green_val(i, j), scale); + store_scaled_byte(idx, pnmimage.get_blue_val(i, j), scale); + } + if (has_alpha) { + store_scaled_byte(idx, pnmimage.get_alpha_val(i, j), scale); + } } } @@ -190,16 +190,16 @@ bool PixelBuffer::load(const PNMImage& pnmimage) for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - store_scaled_short(idx, pnmimage.get_gray_val(i, j), scale); - } else { - store_scaled_short(idx, pnmimage.get_red_val(i, j), scale); - store_scaled_short(idx, pnmimage.get_green_val(i, j), scale); - store_scaled_short(idx, pnmimage.get_blue_val(i, j), scale); - } - if (has_alpha) { - store_scaled_short(idx, pnmimage.get_alpha_val(i, j), scale); - } + if (is_grayscale) { + store_scaled_short(idx, pnmimage.get_gray_val(i, j), scale); + } else { + store_scaled_short(idx, pnmimage.get_red_val(i, j), scale); + store_scaled_short(idx, pnmimage.get_green_val(i, j), scale); + store_scaled_short(idx, pnmimage.get_blue_val(i, j), scale); + } + if (has_alpha) { + store_scaled_short(idx, pnmimage.get_alpha_val(i, j), scale); + } } } } @@ -224,15 +224,15 @@ store(PNMImage &pnmimage) const { int idx = 0; for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - pnmimage.set_gray(i, j, get_unsigned_byte(idx)); - } else { - pnmimage.set_red(i, j, get_unsigned_byte(idx)); - pnmimage.set_green(i, j, get_unsigned_byte(idx)); - pnmimage.set_blue(i, j, get_unsigned_byte(idx)); - } - if (has_alpha) - pnmimage.set_alpha(i, j, get_unsigned_byte(idx)); + if (is_grayscale) { + pnmimage.set_gray(i, j, get_unsigned_byte(idx)); + } else { + pnmimage.set_red(i, j, get_unsigned_byte(idx)); + pnmimage.set_green(i, j, get_unsigned_byte(idx)); + pnmimage.set_blue(i, j, get_unsigned_byte(idx)); + } + if (has_alpha) + pnmimage.set_alpha(i, j, get_unsigned_byte(idx)); } } return true; @@ -245,15 +245,15 @@ store(PNMImage &pnmimage) const { int idx = 0; for (int j = _ysize-1; j >= 0; j--) { for (int i = 0; i < _xsize; i++) { - if (is_grayscale) { - pnmimage.set_gray(i, j, get_unsigned_short(idx)); - } else { - pnmimage.set_red(i, j, get_unsigned_short(idx)); - pnmimage.set_green(i, j, get_unsigned_short(idx)); - pnmimage.set_blue(i, j, get_unsigned_short(idx)); - } - if (has_alpha) - pnmimage.set_alpha(i, j, get_unsigned_short(idx)); + if (is_grayscale) { + pnmimage.set_gray(i, j, get_unsigned_short(idx)); + } else { + pnmimage.set_red(i, j, get_unsigned_short(idx)); + pnmimage.set_green(i, j, get_unsigned_short(idx)); + pnmimage.set_blue(i, j, get_unsigned_short(idx)); + } + if (has_alpha) + pnmimage.set_alpha(i, j, get_unsigned_short(idx)); } } return true; @@ -290,7 +290,7 @@ void PixelBuffer::copy(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr) } void PixelBuffer::copy(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, - const RenderBuffer &rb) { + const RenderBuffer &rb) { gsg->copy_pixel_buffer(this, dr, rb); } @@ -304,7 +304,7 @@ void PixelBuffer::draw(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr) } void PixelBuffer::draw(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, - const RenderBuffer &rb) { + const RenderBuffer &rb) { gsg->draw_pixel_buffer(this, dr, rb); } diff --git a/panda/src/gobj/projection.h b/panda/src/gobj/projection.h index c787be4b80..26d9773b4a 100644 --- a/panda/src/gobj/projection.h +++ b/panda/src/gobj/projection.h @@ -25,15 +25,15 @@ PUBLISHED: virtual Projection *make_copy() const=0; virtual bool extrude(const LPoint2f &point2d, - LPoint3f &origin, LVector3f &direction, - CoordinateSystem cs = CS_default) const; + LPoint3f &origin, LVector3f &direction, + CoordinateSystem cs = CS_default) const; virtual bool project(const LPoint3f &point3d, LPoint2f &point2d, - CoordinateSystem cs = CS_default) const; + CoordinateSystem cs = CS_default) const; public: virtual LMatrix4f get_projection_mat(CoordinateSystem cs = CS_default) const=0; virtual Geom* make_geometry(const Colorf &color = Colorf(0.0, 1.0, 0.0, 1.0), - CoordinateSystem cs = CS_default) const; + CoordinateSystem cs = CS_default) const; virtual BoundingVolume *make_bounds(CoordinateSystem cs = CS_default) const; @@ -48,7 +48,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "Projection", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } private: diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index a44b0b96c4..aa9d2bd842 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -57,7 +57,7 @@ PUBLISHED: WM_clamp, WM_repeat, }; - + PUBLISHED: Texture(); ~Texture(); @@ -79,11 +79,11 @@ public: virtual void copy(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr); virtual void copy(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, - const RenderBuffer &rb); + const RenderBuffer &rb); virtual void draw(GraphicsStateGuardianBase *gsg); virtual void draw(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr); virtual void draw(GraphicsStateGuardianBase *gsg, const DisplayRegion *dr, - const RenderBuffer &rb); + const RenderBuffer &rb); INLINE bool has_ram_image(void) const { return !_pbuffer->_image.empty(); @@ -121,7 +121,7 @@ public: static void init_type() { ImageBuffer::init_type(); register_type(_type_handle, "Texture", - ImageBuffer::get_class_type()); + ImageBuffer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -133,7 +133,7 @@ private: static TypeHandle _type_handle; //////////////////////////////////////////////////////////////////// - + protected: int _level; diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 431f70aaeb..867049a076 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -163,8 +163,8 @@ ns_garbage_collect() { Texture *tex = (*ti).second; if (tex->get_ref_count() == 1) { if (gobj_cat.is_debug()) { - gobj_cat.debug() - << "Releasing " << (*ti).first << "\n"; + gobj_cat.debug() + << "Releasing " << (*ti).first << "\n"; } num_released++; } else { @@ -187,7 +187,7 @@ ns_list_contents(ostream &out) { Textures::iterator ti; for (ti = _textures.begin(); ti != _textures.end(); ++ti) { out << " " << (*ti).first - << " (count = " << (*ti).second->get_ref_count() << ")\n"; + << " (count = " << (*ti).second->get_ref_count() << ")\n"; } } diff --git a/panda/src/gobj/texturePool.h b/panda/src/gobj/texturePool.h index d315252cc1..f065c49282 100644 --- a/panda/src/gobj/texturePool.h +++ b/panda/src/gobj/texturePool.h @@ -31,7 +31,7 @@ PUBLISHED: INLINE static bool verify_texture(const string &filename); INLINE static Texture *load_texture(const string &filename); INLINE static Texture *load_texture(const string &filename, - const string &grayfilename); + const string &grayfilename); INLINE static void add_texture(Texture *texture); INLINE static void release_texture(Texture *texture); INLINE static void release_all_textures(); diff --git a/panda/src/graph/allAttributesWrapper.T b/panda/src/graph/allAttributesWrapper.T index fa82821737..bd18bf3878 100644 --- a/panda/src/graph/allAttributesWrapper.T +++ b/panda/src/graph/allAttributesWrapper.T @@ -17,7 +17,7 @@ template INLINE_GRAPH bool get_attribute_into(Attribute *&ptr, const AllAttributesWrapper &attrib, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeAttribute *nt = attrib.get_attribute(transition_type); if (nt == (NodeAttribute *)NULL) { ptr = (Attribute *)NULL; diff --git a/panda/src/graph/allAttributesWrapper.cxx b/panda/src/graph/allAttributesWrapper.cxx index decc95c0c2..fad2d975bc 100644 --- a/panda/src/graph/allAttributesWrapper.cxx +++ b/panda/src/graph/allAttributesWrapper.cxx @@ -28,7 +28,7 @@ apply_in_place(const AllTransitionsWrapper &trans) { //////////////////////////////////////////////////////////////////// void AllAttributesWrapper:: apply_from(const AllAttributesWrapper &other, - const AllTransitionsWrapper &trans) { + const AllTransitionsWrapper &trans) { if (trans._cache != (NodeTransitionCache *)NULL) { _attrib.apply_from(other._attrib, *trans._cache); } else { diff --git a/panda/src/graph/allAttributesWrapper.h b/panda/src/graph/allAttributesWrapper.h index df15013466..c774469d80 100644 --- a/panda/src/graph/allAttributesWrapper.h +++ b/panda/src/graph/allAttributesWrapper.h @@ -16,7 +16,7 @@ class AllTransitionsWrapper; //////////////////////////////////////////////////////////////////// -// Class : AllAttributesWrapper +// Class : AllAttributesWrapper // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA AllAttributesWrapper { @@ -34,7 +34,7 @@ public: INLINE_GRAPH bool is_empty() const; INLINE_GRAPH PT(NodeAttribute) set_attribute(TypeHandle handle, - NodeAttribute *trans); + NodeAttribute *trans); INLINE_GRAPH PT(NodeAttribute) set_attribute(NodeAttribute *trans); INLINE_GRAPH PT(NodeAttribute) clear_attribute(TypeHandle handle); INLINE_GRAPH bool has_attribute(TypeHandle handle) const; @@ -49,7 +49,7 @@ public: INLINE_GRAPH void make_initial(); void apply_in_place(const AllTransitionsWrapper &trans); void apply_from(const AllAttributesWrapper &other, - const AllTransitionsWrapper &trans); + const AllTransitionsWrapper &trans); NodeAttributes *apply(const AllTransitionsWrapper &trans) const; void output(ostream &out) const; diff --git a/panda/src/graph/allTransitionsWrapper.I b/panda/src/graph/allTransitionsWrapper.I index 28ee9a5660..b695e0a60d 100644 --- a/panda/src/graph/allTransitionsWrapper.I +++ b/panda/src/graph/allTransitionsWrapper.I @@ -414,10 +414,10 @@ set_computed_verified(UpdateSeq now) { //////////////////////////////////////////////////////////////////// INLINE_GRAPH void AllTransitionsWrapper:: cached_compose(const AllTransitionsWrapper &cache, - const AllTransitionsWrapper &value, - UpdateSeq now) { + const AllTransitionsWrapper &value, + UpdateSeq now) { _cache = NodeTransitionCache::cached_compose(_cache, cache._cache, - value._cache, now); + value._cache, now); _all_verified = now; } diff --git a/panda/src/graph/allTransitionsWrapper.T b/panda/src/graph/allTransitionsWrapper.T index 02b1928bd3..bc893ebf02 100644 --- a/panda/src/graph/allTransitionsWrapper.T +++ b/panda/src/graph/allTransitionsWrapper.T @@ -17,7 +17,7 @@ template INLINE_GRAPH bool get_transition_into(Transition *&ptr, const AllTransitionsWrapper &trans, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeTransition *nt = trans.get_transition(transition_type); if (nt == (NodeTransition *)NULL) { ptr = (Transition *)NULL; diff --git a/panda/src/graph/allTransitionsWrapper.h b/panda/src/graph/allTransitionsWrapper.h index 0b208e9c25..8c024b00fe 100644 --- a/panda/src/graph/allTransitionsWrapper.h +++ b/panda/src/graph/allTransitionsWrapper.h @@ -34,7 +34,7 @@ class NodeAttribute; class AllAttributesWrapper; //////////////////////////////////////////////////////////////////// -// Class : AllTransitionsWrapper +// Class : AllTransitionsWrapper // Description : This wrapper represents all transitions that might be // stored on arcs. It is especially useful when // performing a traversal or computing a wrt() and you @@ -58,7 +58,7 @@ public: INLINE_GRAPH bool is_empty() const; INLINE_GRAPH PT(NodeTransition) set_transition(TypeHandle handle, - NodeTransition *trans); + NodeTransition *trans); INLINE_GRAPH PT(NodeTransition) set_transition(NodeTransition *trans); INLINE_GRAPH PT(NodeTransition) clear_transition(TypeHandle handle); INLINE_GRAPH bool has_transition(TypeHandle handle) const; @@ -85,8 +85,8 @@ public: INLINE_GRAPH void set_computed_verified(UpdateSeq now); INLINE_GRAPH void cached_compose(const AllTransitionsWrapper &cache, - const AllTransitionsWrapper &value, - UpdateSeq now); + const AllTransitionsWrapper &value, + UpdateSeq now); public: // STL-like definitions to allow read-only traversal of the diff --git a/panda/src/graph/arcChain.h b/panda/src/graph/arcChain.h index 282420d2d6..44f908652f 100644 --- a/panda/src/graph/arcChain.h +++ b/panda/src/graph/arcChain.h @@ -96,7 +96,7 @@ protected: static void init_type() { ReferenceCount::init_type(); register_type(_type_handle, "ArcChain::ArcComponent", - ReferenceCount::get_class_type()); + ReferenceCount::get_class_type()); } private: diff --git a/panda/src/graph/bitMask32Transition.h b/panda/src/graph/bitMask32Transition.h index 6aa73b488e..412a8fbd0a 100644 --- a/panda/src/graph/bitMask32Transition.h +++ b/panda/src/graph/bitMask32Transition.h @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// -// Class : BitMask32Transition +// Class : BitMask32Transition // Description : This is just an instantation of BitMaskTransition // using BitMask32, the most common bitmask type. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/graph/bitMaskAttribute.h b/panda/src/graph/bitMaskAttribute.h index 4618763eca..045a9a3de3 100644 --- a/panda/src/graph/bitMaskAttribute.h +++ b/panda/src/graph/bitMaskAttribute.h @@ -14,7 +14,7 @@ template class BitMaskTransition; //////////////////////////////////////////////////////////////////// -// Class : BitMaskAttribute +// Class : BitMaskAttribute // Description : //////////////////////////////////////////////////////////////////// template @@ -49,9 +49,9 @@ public: NodeAttribute::init_type(); MaskType::init_type(); register_type(_type_handle, - string("BitMaskAttribute<") + - MaskType::get_class_type().get_name() + ">", - NodeAttribute::get_class_type()); + string("BitMaskAttribute<") + + MaskType::get_class_type().get_name() + ">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/bitMaskTransition.h b/panda/src/graph/bitMaskTransition.h index c6299b148c..1a7e888223 100644 --- a/panda/src/graph/bitMaskTransition.h +++ b/panda/src/graph/bitMaskTransition.h @@ -14,7 +14,7 @@ class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : BitMaskTransition +// Class : BitMaskTransition // Description : This is an abstract template class that encapsulates // transitions on a bitmask. Each transition may add // and/or remove bits from the accumulated bitmask. @@ -66,9 +66,9 @@ public: NodeTransition::init_type(); MaskType::init_type(); register_type(_type_handle, - string("BitMaskTransition<") + - MaskType::get_class_type().get_name() + ">", - NodeTransition::get_class_type()); + string("BitMaskTransition<") + + MaskType::get_class_type().get_name() + ">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/boundedObject.h b/panda/src/graph/boundedObject.h index 33a47f3e5d..48021fb8ba 100644 --- a/panda/src/graph/boundedObject.h +++ b/panda/src/graph/boundedObject.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : BoundedObject +// Class : BoundedObject // Description : This is any object (particularly in a scene graph) // that may have a bounding volume established for it. // The user may set a fixed bounding volume, or s/he may diff --git a/panda/src/graph/dftraverser.T b/panda/src/graph/dftraverser.T index 32f662c2ac..169b246cd1 100644 --- a/panda/src/graph/dftraverser.T +++ b/panda/src/graph/dftraverser.T @@ -15,8 +15,8 @@ template INLINE_GRAPH DFTraverser:: DFTraverser(Visitor &visitor, - const AttributeWrapper &initial_render_state, - TypeHandle graph_type) : + const AttributeWrapper &initial_render_state, + TypeHandle graph_type) : _visitor(visitor), _initial_render_state(initial_render_state), _graph_type(graph_type) @@ -99,9 +99,9 @@ traverse(Node *node, AttributeWrapper &state, LevelState &level_state) { template INLINE void df_traverse(NodeRelation *arc, Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - TypeHandle graph_type) { + const AttributeWrapper &initial_render_state, + const LevelState &initial_level_state, + TypeHandle graph_type) { DFTraverser dft(visitor, initial_render_state, graph_type); dft.start(arc, initial_level_state); @@ -110,9 +110,9 @@ df_traverse(NodeRelation *arc, Visitor &visitor, template INLINE void df_traverse(Node *root, Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - TypeHandle graph_type) { + const AttributeWrapper &initial_render_state, + const LevelState &initial_level_state, + TypeHandle graph_type) { DFTraverser dft(visitor, initial_render_state, graph_type); dft.start(root, initial_level_state); diff --git a/panda/src/graph/dftraverser.h b/panda/src/graph/dftraverser.h index cf1fa3fa3f..5d549fb4e3 100644 --- a/panda/src/graph/dftraverser.h +++ b/panda/src/graph/dftraverser.h @@ -14,7 +14,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : DFTraverser +// Class : DFTraverser // Description : Implements a depth-first traversal of the graph // beginning at the indicated node or arc. DFTraverser // will also call visitor.forward_arc() and @@ -28,19 +28,19 @@ public: typedef TYPENAME Visitor::AttributeWrapper AttributeWrapper; INLINE_GRAPH DFTraverser(Visitor &visitor, - const AttributeWrapper &initial_render_state, - TypeHandle graph_type); + const AttributeWrapper &initial_render_state, + TypeHandle graph_type); INLINE_GRAPH void start(NodeRelation *arc, const LevelState &initial_level_state); INLINE_GRAPH void start(Node *root, const LevelState &initial_level_state); protected: void traverse(NodeRelation *arc, - AttributeWrapper render_state, - LevelState level_state); + AttributeWrapper render_state, + LevelState level_state); void traverse(Node *node, - AttributeWrapper &render_state, - LevelState &level_state); + AttributeWrapper &render_state, + LevelState &level_state); Visitor &_visitor; AttributeWrapper _initial_render_state; diff --git a/panda/src/graph/graphReducer.cxx b/panda/src/graph/graphReducer.cxx index da64320dc8..70e554912d 100644 --- a/panda/src/graph/graphReducer.cxx +++ b/panda/src/graph/graphReducer.cxx @@ -120,7 +120,7 @@ r_flatten(Node *root, bool combine_siblings) { NodeRelation *arc = *drp.begin(); if (consider_arc(arc)) { if (flatten_arc(arc)) { - num_nodes++; + num_nodes++; } } } @@ -176,22 +176,22 @@ flatten_siblings(Node *root) { ++ai1; list::iterator ai2 = ai1; while (ai2 != arcs.end()) { - list::iterator ai2_hold = ai2; - NodeRelation *arc2 = (*ai2); - ++ai2; - - if (consider_siblings(root, arc1, arc2)) { - NodeRelation *new_arc = collapse_siblings(root, arc1, arc2); - if (new_arc != (NodeRelation *)NULL) { - // We successfully collapsed an arc. - arcs.erase(ai2_hold); - arcs.erase(ai1_hold); - arcs.push_back(new_arc); - ai1 = arcs.begin(); - ai2 = arcs.end(); - num_nodes++; - } - } + list::iterator ai2_hold = ai2; + NodeRelation *arc2 = (*ai2); + ++ai2; + + if (consider_siblings(root, arc1, arc2)) { + NodeRelation *new_arc = collapse_siblings(root, arc1, arc2); + if (new_arc != (NodeRelation *)NULL) { + // We successfully collapsed an arc. + arcs.erase(ai2_hold); + arcs.erase(ai1_hold); + arcs.push_back(new_arc); + ai1 = arcs.begin(); + ai2 = arcs.end(); + num_nodes++; + } + } } } } @@ -213,8 +213,8 @@ consider_arc(NodeRelation *arc) { if (arc->has_sub_render_trans()) { if (graph_cat.is_debug()) { graph_cat.debug() - << "Not removing " << *arc - << " because it contains a sub_render transition.\n"; + << "Not removing " << *arc + << " because it contains a sub_render transition.\n"; } return false; } @@ -261,7 +261,7 @@ flatten_arc(NodeRelation *arc) { if (new_parent == (Node *)NULL) { if (graph_cat.is_debug()) { graph_cat.debug() - << "Decided not to remove " << *arc << "\n"; + << "Decided not to remove " << *arc << "\n"; } return false; } @@ -343,7 +343,7 @@ collapse_nodes(Node *node1, Node *node2, bool) { return node1; } else if (node1->is_exact_type(Node::get_class_type()) || - node1->is_exact_type(NamedNode::get_class_type())) { + node1->is_exact_type(NamedNode::get_class_type())) { // Node1 isn't anything special, so preserve node2. return node2; @@ -404,7 +404,7 @@ move_children(Node *to, Node *from) { int num_children = from->get_num_children(_graph_type); while (num_children > 0) { NodeRelation *arc = - from->get_child(_graph_type, 0); + from->get_child(_graph_type, 0); arc->change_parent(to); num_children--; nassertv(num_children == from->get_num_children(_graph_type)); @@ -426,7 +426,7 @@ copy_children(Node *to, Node *from) { for (int i = 0; i < num_children; i++) { NodeRelation *arc = from->get_child(_graph_type, i); NodeRelation *new_arc = NodeRelation::create_typed_arc - (_graph_type, to, arc->get_child()); + (_graph_type, to, arc->get_child()); nassertv(new_arc != (NodeRelation *)NULL); nassertv(new_arc->is_exact_type(_graph_type)); new_arc->copy_transitions_from(arc); diff --git a/panda/src/graph/graphReducer.h b/panda/src/graph/graphReducer.h index a1a38b9f5a..ae2e86c632 100644 --- a/panda/src/graph/graphReducer.h +++ b/panda/src/graph/graphReducer.h @@ -13,7 +13,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : GraphReducer +// Class : GraphReducer // Description : A generic interface to simplify a graph in various // ways, generally as a performance optimization. This // class is designed for generic graphs; also see the @@ -34,11 +34,11 @@ protected: virtual bool consider_arc(NodeRelation *arc); virtual bool consider_siblings(Node *parent, - NodeRelation *arc1, NodeRelation *arc2); + NodeRelation *arc1, NodeRelation *arc2); virtual bool flatten_arc(NodeRelation *arc); virtual NodeRelation *collapse_siblings(Node *parent, NodeRelation *arc1, - NodeRelation *arc2); + NodeRelation *arc2); virtual Node *collapse_nodes(Node *node1, Node *node2, bool siblings); virtual void choose_name(Node *preserve, Node *source1, Node *source2); diff --git a/panda/src/graph/immediateAttribute.h b/panda/src/graph/immediateAttribute.h index d88ff86b60..4d7ebf3a9e 100644 --- a/panda/src/graph/immediateAttribute.h +++ b/panda/src/graph/immediateAttribute.h @@ -13,7 +13,7 @@ class ImmediateTransition; //////////////////////////////////////////////////////////////////// -// Class : ImmediateAttribute +// Class : ImmediateAttribute // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ImmediateAttribute : public NodeAttribute { @@ -21,7 +21,7 @@ public: INLINE_GRAPH ImmediateAttribute() {}; INLINE_GRAPH ImmediateAttribute(const ImmediateAttribute ©) : - NodeAttribute(copy){}; + NodeAttribute(copy){}; INLINE_GRAPH void operator = (const ImmediateAttribute ©) {NodeAttribute::operator = (copy);} public: @@ -43,7 +43,7 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, "ImmediateAttribute", - NodeAttribute::get_class_type()); + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/immediateTransition.h b/panda/src/graph/immediateTransition.h index 3221a46ccb..330a7988f6 100644 --- a/panda/src/graph/immediateTransition.h +++ b/panda/src/graph/immediateTransition.h @@ -14,7 +14,7 @@ class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : ImmediateTransition +// Class : ImmediateTransition // Description : This is a special kind of transition that doesn't // accumulate state, but instead has some immediate // effect when it is encountered in the scene graph. @@ -68,7 +68,7 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, "ImmediateTransition", - NodeTransition::get_class_type()); + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/lmatrix4fTransition.h b/panda/src/graph/lmatrix4fTransition.h index a6ebf9fdbe..1d637e7303 100644 --- a/panda/src/graph/lmatrix4fTransition.h +++ b/panda/src/graph/lmatrix4fTransition.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LMatrix4fTransition +// Class : LMatrix4fTransition // Description : This is just an instantation of MatrixTransition // using LMatrix4f, the most common transform matrix // type. diff --git a/panda/src/graph/matrixAttribute.h b/panda/src/graph/matrixAttribute.h index 0761bd0386..504c52638c 100644 --- a/panda/src/graph/matrixAttribute.h +++ b/panda/src/graph/matrixAttribute.h @@ -14,7 +14,7 @@ template class MatrixTransition; //////////////////////////////////////////////////////////////////// -// Class : MatrixAttribute +// Class : MatrixAttribute // Description : //////////////////////////////////////////////////////////////////// template @@ -49,9 +49,9 @@ public: NodeAttribute::init_type(); Matrix::init_type(); register_type(_type_handle, - string("MatrixAttribute<") + - Matrix::get_class_type().get_name() + ">", - NodeAttribute::get_class_type()); + string("MatrixAttribute<") + + Matrix::get_class_type().get_name() + ">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/matrixTransition.h b/panda/src/graph/matrixTransition.h index 8ab1e98640..6689b39828 100644 --- a/panda/src/graph/matrixTransition.h +++ b/panda/src/graph/matrixTransition.h @@ -14,7 +14,7 @@ class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : MatrixTransition +// Class : MatrixTransition // Description : This is an abstract template class that encapsulates // all transitions that involve some kind of matrix, // either a 4x4 or a 3x3, either float or double. It @@ -74,9 +74,9 @@ public: NodeTransition::init_type(); Matrix::init_type(); register_type(_type_handle, - string("MatrixTransition<") + - Matrix::get_class_type().get_name() + ">", - NodeTransition::get_class_type()); + string("MatrixTransition<") + + Matrix::get_class_type().get_name() + ">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/multiAttribute.T b/panda/src/graph/multiAttribute.T index af65d42ca0..95f912ca63 100644 --- a/panda/src/graph/multiAttribute.T +++ b/panda/src/graph/multiAttribute.T @@ -167,7 +167,7 @@ internal_compare_to(const NodeAttribute *other) const { DCAST_INTO_R(ot, other, false); return bmap_compare(_properties.begin(), _properties.end(), - ot->_properties.begin(), ot->_properties.end()); + ot->_properties.begin(), ot->_properties.end()); } //////////////////////////////////////////////////////////////////// @@ -255,7 +255,7 @@ template INLINE_GRAPH MultiAttribute::Properties::iterator MultiAttribute:: find_property(const Property &prop, bool &found_flag) { return binary_search_property(_properties.begin(), _properties.end(), - prop, found_flag); + prop, found_flag); } //////////////////////////////////////////////////////////////////// @@ -271,7 +271,7 @@ find_property(const Property &prop, bool &found_flag) { template MultiAttribute::Properties::iterator MultiAttribute:: binary_search_property(Properties::iterator begin, Properties::iterator end, - const Property &prop, bool &found_flag) { + const Property &prop, bool &found_flag) { if (begin == end) { return begin; } diff --git a/panda/src/graph/multiAttribute.h b/panda/src/graph/multiAttribute.h index 0837154fcb..23e622f870 100644 --- a/panda/src/graph/multiAttribute.h +++ b/panda/src/graph/multiAttribute.h @@ -18,7 +18,7 @@ template class MultiTransition; //////////////////////////////////////////////////////////////////// -// Class : MultiAttribute +// Class : MultiAttribute // Description : //////////////////////////////////////////////////////////////////// template @@ -49,7 +49,7 @@ protected: virtual void output_property(ostream &out, const Property &prop) const=0; virtual void write_property(ostream &out, const Property &prop, - int indent_level) const=0; + int indent_level) const=0; private: INLINE_GRAPH void set_property(const Property &prop); @@ -61,7 +61,7 @@ private: Properties::iterator binary_search_property(Properties::iterator begin, Properties::iterator end, - const Property &prop, bool &found_flag); + const Property &prop, bool &found_flag); public: // These functions and typedefs allow one to peruse all of the @@ -96,8 +96,8 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, - string("MultiAttribute<")+NameClass::get_class_name()+">", - NodeAttribute::get_class_type()); + string("MultiAttribute<")+NameClass::get_class_name()+">", + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/multiNodeAttribute.h b/panda/src/graph/multiNodeAttribute.h index 43aaa50b18..aa63ae6277 100644 --- a/panda/src/graph/multiNodeAttribute.h +++ b/panda/src/graph/multiNodeAttribute.h @@ -24,7 +24,7 @@ class MultiNodeTransition; EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_NODE); //////////////////////////////////////////////////////////////////// -// Class : MultiNodeAttribute +// Class : MultiNodeAttribute // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA MultiNodeAttribute : @@ -32,7 +32,7 @@ class EXPCL_PANDA MultiNodeAttribute : protected: INLINE_GRAPH MultiNodeAttribute() {}; INLINE_GRAPH MultiNodeAttribute(const MultiNodeAttribute ©) : - MultiAttribute(copy) {}; + MultiAttribute(copy) {}; INLINE_GRAPH void operator = (const MultiNodeAttribute ©) {MultiAttribute::operator = (copy);} @@ -48,8 +48,8 @@ public: static void init_type() { MultiAttribute::init_type(); register_type(_type_handle, "MultiNodeAttribute", - MultiAttribute:: - get_class_type()); + MultiAttribute:: + get_class_type()); } private: diff --git a/panda/src/graph/multiNodeTransition.h b/panda/src/graph/multiNodeTransition.h index 4209253bc7..93c46b6f63 100644 --- a/panda/src/graph/multiNodeTransition.h +++ b/panda/src/graph/multiNodeTransition.h @@ -24,7 +24,7 @@ class NodeRelation; EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTITRANSITION_NODE); //////////////////////////////////////////////////////////////////// -// Class : MultiNodeTransition +// Class : MultiNodeTransition // Description : This is a particular instantiation of MultiTransition // on PT_Node. It is its own class in an attempt to // cut down on code bloat; if a particular transition @@ -38,7 +38,7 @@ class EXPCL_PANDA MultiNodeTransition : protected: INLINE_GRAPH MultiNodeTransition() {}; INLINE_GRAPH MultiNodeTransition(const MultiNodeTransition ©) : - MultiTransition(copy) {}; + MultiTransition(copy) {}; INLINE_GRAPH void operator = (const MultiNodeTransition ©) {MultiTransition::operator = (copy);}; @@ -54,8 +54,8 @@ public: static void init_type() { MultiTransition::init_type(); register_type(_type_handle, "MultiNodeTransition", - MultiTransition:: - get_class_type()); + MultiTransition:: + get_class_type()); } private: diff --git a/panda/src/graph/multiTransition.T b/panda/src/graph/multiTransition.T index 61f439a3ff..8f39807db7 100644 --- a/panda/src/graph/multiTransition.T +++ b/panda/src/graph/multiTransition.T @@ -277,8 +277,8 @@ compose(const NodeTransition *other) const { result->_default_dir = _default_dir; dmap_compose(_properties.begin(), _properties.end(), - ot->_properties.begin(), ot->_properties.end(), - inserter(result->_properties, result->_properties.begin())); + ot->_properties.begin(), ot->_properties.end(), + inserter(result->_properties, result->_properties.begin())); return result; } @@ -302,7 +302,7 @@ invert() const { result->_default_dir = TD_identity; dmap_invert(_properties.begin(), _properties.end(), - inserter(result->_properties, result->_properties.begin())); + inserter(result->_properties, result->_properties.begin())); return result; } @@ -345,9 +345,9 @@ apply(const NodeAttribute *attrib) const { // In this case, the normal case, the transition does not specify // completely what the attributes should be. bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - false, TD_on, - inserter(temp, temp.begin())); + _properties.begin(), _properties.end(), + false, TD_on, + inserter(temp, temp.begin())); result->_properties_is_on = true; } else if (_default_dir == TD_off) { @@ -355,9 +355,9 @@ apply(const NodeAttribute *attrib) const { // attributes should be; any property not explicitly mentioned by // the transition should be turned off. bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - true, TD_on, - inserter(temp, temp.begin())); + _properties.begin(), _properties.end(), + true, TD_on, + inserter(temp, temp.begin())); result->_properties_is_on = true; } else { // _default_dir == TD_on @@ -365,9 +365,9 @@ apply(const NodeAttribute *attrib) const { // attributes should be; any property not explicitly mentioned by // the transition should be turned on. bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - true, TD_off, - inserter(temp, temp.begin())); + _properties.begin(), _properties.end(), + true, TD_off, + inserter(temp, temp.begin())); result->_properties_is_on = false; } @@ -390,10 +390,10 @@ output(ostream &out) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_identity) { if (!any_identity) { - out << " identity("; - any_identity = true; + out << " identity("; + any_identity = true; } else { - out << ", "; + out << ", "; } output_property(out, (*pi).first); } @@ -406,10 +406,10 @@ output(ostream &out) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_on) { if (!any_on) { - out << " on("; - any_on = true; + out << " on("; + any_on = true; } else { - out << ", "; + out << ", "; } output_property(out, (*pi).first); } @@ -422,10 +422,10 @@ output(ostream &out) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_off) { if (!any_off) { - out << " off("; - any_off = true; + out << " off("; + any_off = true; } else { - out << ", "; + out << ", "; } output_property(out, (*pi).first); } @@ -449,8 +449,8 @@ write(ostream &out, int indent_level) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_identity) { if (!any_identity) { - indent(out, indent_level) << "identity:\n"; - any_identity = true; + indent(out, indent_level) << "identity:\n"; + any_identity = true; } write_property(out, (*pi).first, indent_level + 2); } @@ -460,8 +460,8 @@ write(ostream &out, int indent_level) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_on) { if (!any_on) { - indent(out, indent_level) << "on:\n"; - any_on = true; + indent(out, indent_level) << "on:\n"; + any_on = true; } write_property(out, (*pi).first, indent_level + 2); } @@ -471,8 +471,8 @@ write(ostream &out, int indent_level) const { for (pi = _properties.begin(); pi != _properties.end(); ++pi) { if ((*pi).second == TD_off) { if (!any_off) { - indent(out, indent_level) << "off:\n"; - any_off = true; + indent(out, indent_level) << "off:\n"; + any_off = true; } write_property(out, (*pi).first, indent_level + 2); } @@ -495,7 +495,7 @@ internal_compare_to(const NodeTransition *other) const { } return dmap_compare(_properties.begin(), _properties.end(), - ot->_properties.begin(), ot->_properties.end()); + ot->_properties.begin(), ot->_properties.end()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/graph/multiTransition.h b/panda/src/graph/multiTransition.h index 9159826a69..cc303779e1 100644 --- a/panda/src/graph/multiTransition.h +++ b/panda/src/graph/multiTransition.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : MultiTransition +// Class : MultiTransition // Description : This is an abstract template class that encapsulates // states that may have any number of subcomponents, in // no particular order, any of which may be on or off at @@ -89,7 +89,7 @@ protected: virtual void output_property(ostream &out, const Property &prop) const=0; virtual void write_property(ostream &out, const Property &prop, - int indent_level) const=0; + int indent_level) const=0; public: // These functions and typedefs allow one to peruse all of the @@ -119,8 +119,8 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, - string("MultiTransition<")+NameClass::get_class_name()+">", - NodeTransition::get_class_type()); + string("MultiTransition<")+NameClass::get_class_name()+">", + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/multiTransitionHelpers.I b/panda/src/graph/multiTransitionHelpers.I index 96dfff6fb7..6bd0d2401f 100644 --- a/panda/src/graph/multiTransitionHelpers.I +++ b/panda/src/graph/multiTransitionHelpers.I @@ -13,8 +13,8 @@ template OutputIterator dmap_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -28,9 +28,9 @@ dmap_compose(InputIterator1 first1, InputIterator1 last1, // If the second Transition is identity, it has no effect. // Otherwise, it replaces us. if ((*first2).second != TD_identity) { - *result = *first2; + *result = *first2; } else { - *result = *first1; + *result = *first1; } ++first1; ++first2; @@ -61,8 +61,8 @@ dmap_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator dmap_invert_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { typedef TYPENAME InputIterator1::value_type OutputType; while (first1 != last1 && first2 != last2) { @@ -79,17 +79,17 @@ dmap_invert_compose(InputIterator1 first1, InputIterator1 last1, TransitionDirection dir2 = (*first2).second; if (dir1 == dir2 && - (dir1 != TD_normal || (*first1).first == (*first2).first)) { - // The two transitions are equivalent, so the invert_compose - // will be identity. Don't bother to store it. + (dir1 != TD_normal || (*first1).first == (*first2).first)) { + // The two transitions are equivalent, so the invert_compose + // will be identity. Don't bother to store it. } else { - if ((*first2).second != TD_identity) { - *result = *first2; - } else { - (*result) = OutputType((*first1).first, TD_inverse); - } - ++result; + if ((*first2).second != TD_identity) { + *result = *first2; + } else { + (*result) = OutputType((*first1).first, TD_inverse); + } + ++result; } ++first1; ++first2; @@ -121,7 +121,7 @@ dmap_invert_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator dmap_invert(InputIterator first, InputIterator last, - OutputIterator result) { + OutputIterator result) { typedef TYPENAME InputIterator::value_type OutputType; while (first != last) { @@ -158,16 +158,16 @@ dmap_invert(InputIterator first, InputIterator last, template bool dmap_equiv(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if ((*first1).second != TD_identity) { - return false; + return false; } ++first1; } else if ((*first2).first < (*first1).first) { if ((*first2).second != TD_identity) { - return false; + return false; } ++first2; } else { @@ -175,7 +175,7 @@ dmap_equiv(InputIterator1 first1, InputIterator1 last1, TransitionDirection dir2 = (*first2).second; if (dir1 != dir2) { - return false; + return false; } ++first1; ++first2; @@ -209,18 +209,18 @@ dmap_equiv(InputIterator1 first1, InputIterator1 last1, template int dmap_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if ((*first1).second != TD_identity) { - // list1 has the first value that does not appear in list2. - return 1; + // list1 has the first value that does not appear in list2. + return 1; } ++first1; } else if ((*first2).first < (*first1).first) { if ((*first2).second != TD_identity) { - // list2 has the first value that does not appear in list1. - return -1; + // list2 has the first value that does not appear in list1. + return -1; } ++first2; } else { @@ -228,17 +228,17 @@ dmap_compare(InputIterator1 first1, InputIterator1 last1, TransitionDirection dir2 = (*first2).second; if (dir1 != dir2) { - if (dir1 == TD_identity) { - // list1 has the first value that does not appear in list2. - return 1; - } else if (dir2 == TD_identity) { - // list2 has the first value that does not appear in list1. - return -1; - } - - // This value appears in both lists, but it is TD_normal in - // one and TD_inverse in the other. - return (dir1 < dir2) ? -1 : 1; + if (dir1 == TD_identity) { + // list1 has the first value that does not appear in list2. + return 1; + } else if (dir2 == TD_identity) { + // list2 has the first value that does not appear in list1. + return -1; + } + + // This value appears in both lists, but it is TD_normal in + // one and TD_inverse in the other. + return (dir1 < dir2) ? -1 : 1; } ++first1; @@ -297,7 +297,7 @@ dmap_is_identity(InputIterator first, InputIterator last) { template bool bmap_equiv(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1) < (*first2)) { return false; @@ -324,7 +324,7 @@ bmap_equiv(InputIterator1 first1, InputIterator1 last1, template int bmap_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1) < (*first2)) { return -1; @@ -358,16 +358,16 @@ bmap_compare(InputIterator1 first1, InputIterator1 last1, template OutputIterator bmap_apply(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - bool complete_transition, TransitionDirection want_dirs, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + bool complete_transition, TransitionDirection want_dirs, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1) < (*first2).first) { // Here's an attribute property that wasn't mentioned by the // transition. It stays, unless the transition is "complete". if (!complete_transition) { - *result = *first1; - ++result; + *result = *first1; + ++result; } ++first1; @@ -377,9 +377,9 @@ bmap_apply(InputIterator1 first1, InputIterator1 last1, // if the transition explicitly turned it on. if ((*first2).second == want_dirs) { - *result = (*first2).first; - ++result; - break; + *result = (*first2).first; + ++result; + break; } ++first2; @@ -391,17 +391,17 @@ bmap_apply(InputIterator1 first1, InputIterator1 last1, // the attribute? if ((*first2).second == TD_identity) { - // Preserve. - *result = *first1; - ++result; + // Preserve. + *result = *first1; + ++result; } else if ((*first2).second == want_dirs) { - // Replace. - *result = (*first2).first; - ++result; + // Replace. + *result = (*first2).first; + ++result; } else { - // Omit. + // Omit. } ++first1; diff --git a/panda/src/graph/multiTransitionHelpers.h b/panda/src/graph/multiTransitionHelpers.h index a3860807ae..8c23be785e 100644 --- a/panda/src/graph/multiTransitionHelpers.h +++ b/panda/src/graph/multiTransitionHelpers.h @@ -19,8 +19,8 @@ template OutputIterator dmap_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); //////////////////////////////////////////////////////////////////// @@ -32,8 +32,8 @@ dmap_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator dmap_invert_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); //////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ dmap_invert_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator dmap_invert(InputIterator first, InputIterator last, - OutputIterator result); + OutputIterator result); //////////////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ dmap_invert(InputIterator first, InputIterator last, template bool dmap_equiv(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); //////////////////////////////////////////////////////////////////// // Function: dmap_compare @@ -72,7 +72,7 @@ dmap_equiv(InputIterator1 first1, InputIterator1 last1, template int dmap_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); //////////////////////////////////////////////////////////////////// @@ -97,7 +97,7 @@ dmap_is_identity(InputIterator first, InputIterator last); template bool bmap_equiv(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); //////////////////////////////////////////////////////////////////// // Function: bmap_compare @@ -108,7 +108,7 @@ bmap_equiv(InputIterator1 first1, InputIterator1 last1, template int bmap_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); //////////////////////////////////////////////////////////////////// @@ -120,9 +120,9 @@ bmap_compare(InputIterator1 first1, InputIterator1 last1, template OutputIterator bmap_apply(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - bool complete_transition, TransitionDirection want_dirs, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + bool complete_transition, TransitionDirection want_dirs, + OutputIterator result); #ifndef DONT_INLINE_GRAPH #include "multiTransitionHelpers.I" diff --git a/panda/src/graph/namedNode.h b/panda/src/graph/namedNode.h index f33aead0e4..418147947e 100644 --- a/panda/src/graph/namedNode.h +++ b/panda/src/graph/namedNode.h @@ -11,7 +11,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : NamedNode +// Class : NamedNode // Description : A base class for all nodes which have names. This // will be (almost?) all of them. //////////////////////////////////////////////////////////////////// @@ -46,8 +46,8 @@ public: Node::init_type(); Namable::init_type(); register_type(_type_handle, "NamedNode", - Node::get_class_type(), - Namable::get_class_type()); + Node::get_class_type(), + Namable::get_class_type()); } private: diff --git a/panda/src/graph/node.cxx b/panda/src/graph/node.cxx index 85bcc374d8..a74316668b 100644 --- a/panda/src/graph/node.cxx +++ b/panda/src/graph/node.cxx @@ -193,7 +193,7 @@ NodeRelation *Node:: get_parent(TypeHandle type, int index) const { const UpRelationPointers &urp = find_connection(type).get_up(); nassertr(index >= 0 && index < (int)urp.size(), - (NodeRelation *)NULL); + (NodeRelation *)NULL); return urp[index]; } @@ -221,7 +221,7 @@ NodeRelation *Node:: get_child(TypeHandle type, int index) const { const DownRelationPointers &drp = find_connection(type).get_down(); nassertr(index >= 0 && index < (int)drp.size(), - (NodeRelation *)NULL); + (NodeRelation *)NULL); return drp[index]; } @@ -232,7 +232,7 @@ get_child(TypeHandle type, int index) const { //////////////////////////////////////////////////////////////////// bool Node:: sub_render(const AllAttributesWrapper &, AllTransitionsWrapper &, - RenderTraverser *) { + RenderTraverser *) { return true; } @@ -377,7 +377,7 @@ r_copy_subgraph(TypeHandle graph_type, Node::InstanceMap &inst_map) const { //////////////////////////////////////////////////////////////////// void Node:: r_copy_children(const Node *from, TypeHandle graph_type, - Node::InstanceMap &inst_map) { + Node::InstanceMap &inst_map) { const DownRelationPointers &drp = from->find_connection(graph_type).get_down(); DownRelationPointers::const_iterator drpi; @@ -444,8 +444,8 @@ write_datagram(BamWriter *manager, Datagram &me) { me.add_uint16(drp.size()); DownRelationPointers::const_iterator drpi; for (drpi = drp.begin(); drpi != drp.end(); ++drpi) { - NodeRelation *relation = (*drpi); - manager->write_pointer(me, relation); + NodeRelation *relation = (*drpi); + manager->write_pointer(me, relation); } } } @@ -490,8 +490,8 @@ complete_pointers(vector_typedWritable &plist, BamReader *manager) { DownRelationPointers::iterator drpi; for (drpi = drp.begin(); drpi != drp.end(); ++drpi) { - (*drpi) = DCAST(NodeRelation, plist[count]); - count++; + (*drpi) = DCAST(NodeRelation, plist[count]); + count++; } } } @@ -534,8 +534,8 @@ fillin(DatagramIterator &scan, BamReader *manager) { while (num_types > 0) { int num_arcs = scan.get_uint16(); while (num_arcs > 0) { - manager->read_pointer(scan, this); - num_arcs--; + manager->read_pointer(scan, this); + num_arcs--; } num_types--; } @@ -551,30 +551,30 @@ fillin(DatagramIterator &scan, BamReader *manager) { // Oops, too many graph types in this bam file. We'll have to // discard some. graph_cat.error() - << "Bam file specifies " << num_connections << " graph types for " - << *this << "; this version of Panda can only support " - << max_node_graphs << " simultaneous graph types.\n"; + << "Bam file specifies " << num_connections << " graph types for " + << *this << "; this version of Panda can only support " + << max_node_graphs << " simultaneous graph types.\n"; } for (int i = 0; i < num_connections; i++) { TypeHandle type = manager->read_handle(scan); if (i < max_node_graphs) { - _connections[i].set_graph_type(type); + _connections[i].set_graph_type(type); - DownRelationPointers &drp = _connections[i].get_down(); - int num_arcs = scan.get_uint16(); - while (num_arcs > 0) { - manager->read_pointer(scan, this); - drp.push_back((NodeRelation *)NULL); - num_arcs--; - } + DownRelationPointers &drp = _connections[i].get_down(); + int num_arcs = scan.get_uint16(); + while (num_arcs > 0) { + manager->read_pointer(scan, this); + drp.push_back((NodeRelation *)NULL); + num_arcs--; + } } else { - // Read and discard. - int num_arcs = scan.get_uint16(); - while (num_arcs > 0) { - manager->skip_pointer(scan); - num_arcs--; - } + // Read and discard. + int num_arcs = scan.get_uint16(); + while (num_arcs > 0) { + manager->skip_pointer(scan); + num_arcs--; + } } } } diff --git a/panda/src/graph/node.h b/panda/src/graph/node.h index 8cf2674a14..1730fe18fe 100644 --- a/panda/src/graph/node.h +++ b/panda/src/graph/node.h @@ -29,13 +29,13 @@ class DatagramIterator; static const int max_node_graphs = 2; //////////////////////////////////////////////////////////////////// -// Class : Node +// Class : Node // Description : The base class for all scene graph nodes. A Node may // be joined to any number of other nodes, as a parent // or as a child, with any kind of relation arcs. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Node : public TypedWritable, public BoundedObject, - virtual public ReferenceCount { + virtual public ReferenceCount { // We can't simply inherit from TypedWritableReferenceCount, because we need // to inherit virtually from ReferenceCount. public: @@ -74,8 +74,8 @@ public: // This function is similar to another function in NodeTransition. // It may or may not intercept the render traversal. virtual bool sub_render(const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; PUBLISHED: @@ -103,15 +103,15 @@ protected: typedef map InstanceMap; virtual Node *r_copy_subgraph(TypeHandle graph_type, - InstanceMap &inst_map) const; + InstanceMap &inst_map) const; virtual void r_copy_children(const Node *from, TypeHandle graph_type, - InstanceMap &inst_map); + InstanceMap &inst_map); public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_Node(const FactoryParams ¶ms); @@ -127,9 +127,9 @@ public: BoundedObject::init_type(); ReferenceCount::init_type(); register_type(_type_handle, "Node", - TypedWritable::get_class_type(), - BoundedObject::get_class_type(), - ReferenceCount::get_class_type()); + TypedWritable::get_class_type(), + BoundedObject::get_class_type(), + ReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/graph/nodeAttribute.h b/panda/src/graph/nodeAttribute.h index 9140d629f4..7217bb2f73 100644 --- a/panda/src/graph/nodeAttribute.h +++ b/panda/src/graph/nodeAttribute.h @@ -14,7 +14,7 @@ class NodeTransition; class GraphicsStateGuardianBase; //////////////////////////////////////////////////////////////////// -// Class : NodeAttribute +// Class : NodeAttribute // Description : This is an abstract class defining a single // Attribute, a state property such as color or texture // that may be in effect when rendering nodes of the @@ -92,7 +92,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "NodeAttribute", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } private: diff --git a/panda/src/graph/nodeAttributeWrapper.h b/panda/src/graph/nodeAttributeWrapper.h index da93cb6e11..ea2377f330 100644 --- a/panda/src/graph/nodeAttributeWrapper.h +++ b/panda/src/graph/nodeAttributeWrapper.h @@ -16,7 +16,7 @@ class NodeTransitionWrapper; //////////////////////////////////////////////////////////////////// -// Class : NodeAttributeWrapper +// Class : NodeAttributeWrapper // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA NodeAttributeWrapper { diff --git a/panda/src/graph/nodeAttributes.T b/panda/src/graph/nodeAttributes.T index d104e9390c..25821ae8ca 100644 --- a/panda/src/graph/nodeAttributes.T +++ b/panda/src/graph/nodeAttributes.T @@ -17,7 +17,7 @@ template INLINE_GRAPH bool get_attribute_into(Attribute *&ptr, const NodeAttributes &attrib, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeAttribute *nt = attrib.get_attribute(transition_type); if (nt == (NodeAttribute *)NULL) { ptr = (Attribute *)NULL; diff --git a/panda/src/graph/nodeAttributes.cxx b/panda/src/graph/nodeAttributes.cxx index 576e33f723..467ac49c3c 100644 --- a/panda/src/graph/nodeAttributes.cxx +++ b/panda/src/graph/nodeAttributes.cxx @@ -191,7 +191,7 @@ is_initial() const { int NodeAttributes:: compare_to(const NodeAttributes &other) const { return tmap_compare_attr(_attributes.begin(), _attributes.end(), - other._attributes.begin(), other._attributes.end()); + other._attributes.begin(), other._attributes.end()); } //////////////////////////////////////////////////////////////////// @@ -214,8 +214,8 @@ apply_from(const NodeAttributes &other, const NodeTransitionCache &trans) { Attributes temp; tmap_apply(other._attributes.begin(), other._attributes.end(), - trans._cache.begin(), trans._cache.end(), - inserter(temp, temp.begin())); + trans._cache.begin(), trans._cache.end(), + inserter(temp, temp.begin())); _attributes.swap(temp); } @@ -243,8 +243,8 @@ merge_from(const NodeAttributes &a, const NodeAttributes &b) { Attributes temp; tmap_merge_union(a._attributes.begin(), a._attributes.end(), - b._attributes.begin(), b._attributes.end(), - inserter(temp, temp.begin())); + b._attributes.begin(), b._attributes.end(), + inserter(temp, temp.begin())); _attributes.swap(temp); } @@ -264,7 +264,7 @@ output(ostream &out) const { for (ai = _attributes.begin(); ai != _attributes.end(); ++ai) { if ((*ai).second != (NodeAttribute *)NULL) { if (written_any) { - out << " "; + out << " "; } out << *(*ai).second; written_any = true; diff --git a/panda/src/graph/nodeAttributes.h b/panda/src/graph/nodeAttributes.h index 8edc2e7072..a231d93140 100644 --- a/panda/src/graph/nodeAttributes.h +++ b/panda/src/graph/nodeAttributes.h @@ -17,7 +17,7 @@ class NodeTransitionCache; //////////////////////////////////////////////////////////////////// -// Class : NodeAttributes +// Class : NodeAttributes // Description : This represents a set of zero or more NodeAttribute // pointers, organized by the attributes' get_handle() // value. @@ -66,7 +66,7 @@ public: INLINE_GRAPH void apply_in_place(const NodeTransitionCache &trans); INLINE_GRAPH NodeAttributes *apply(const NodeTransitionCache &trans) const; void apply_from(const NodeAttributes &other, - const NodeTransitionCache &trans); + const NodeTransitionCache &trans); void merge_from(const NodeAttributes &a, const NodeAttributes &b); diff --git a/panda/src/graph/nodeConnection.h b/panda/src/graph/nodeConnection.h index 442169a34c..36c759918b 100644 --- a/panda/src/graph/nodeConnection.h +++ b/panda/src/graph/nodeConnection.h @@ -18,7 +18,7 @@ typedef vector_NodeRelation_star UpRelationPointers; /////////////////////////////////////////////////////////////////// -// Class : NodeConnection +// Class : NodeConnection // Description : This class represents the table, stored within each // Node, of all the connected NodeRelations (arcs) of a // particular graph type. diff --git a/panda/src/graph/nodeRelation.T b/panda/src/graph/nodeRelation.T index acb64a44b4..641839d1fb 100644 --- a/panda/src/graph/nodeRelation.T +++ b/panda/src/graph/nodeRelation.T @@ -17,7 +17,7 @@ template INLINE_GRAPH bool get_transition_into(Transition *&ptr, const NodeRelation *arc, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeTransition *nt = arc->get_transition(transition_type); if (nt == (NodeTransition *)NULL) { ptr = (Transition *)NULL; diff --git a/panda/src/graph/nodeRelation.cxx b/panda/src/graph/nodeRelation.cxx index 3a54fc0189..f4883541b8 100644 --- a/panda/src/graph/nodeRelation.cxx +++ b/panda/src/graph/nodeRelation.cxx @@ -75,9 +75,9 @@ verify_arc_list(Iterator begin, Iterator end) { int sort = (*i)->get_sort(); ++i; while (i < end) { - nassertv(sort <= (*i)->get_sort()); - sort = (*i)->get_sort(); - ++i; + nassertv(sort <= (*i)->get_sort()); + sort = (*i)->get_sort(); + ++i; } } } @@ -171,7 +171,7 @@ find_arc(Iterator begin, Iterator end, NodeRelation *arc) { Iterator i = center; while (i < end && (*i)->get_sort() == arc->get_sort()) { if ((*i) == arc) { - return i; + return i; } ++i; } @@ -181,7 +181,7 @@ find_arc(Iterator begin, Iterator end, NodeRelation *arc) { --i; while (i >= begin && (*i)->get_sort() == arc->get_sort()) { if ((*i) == arc) { - return i; + return i; } --i; } @@ -210,10 +210,10 @@ internal_insert_arc(ArcList &alist, NodeRelation *arc) { if (graph_cat.is_debug()) { if (position == alist.end()) { graph_cat.debug() - << "Inserting " << *arc << " at end\n"; + << "Inserting " << *arc << " at end\n"; } else { graph_cat.debug() - << "Inserting " << *arc << " before " << *(*position) << "\n"; + << "Inserting " << *arc << " before " << *(*position) << "\n"; } } */ @@ -245,10 +245,10 @@ internal_remove_arc(ArcList &alist, NodeRelation *arc) { TYPENAME ArcList::iterator next = position + 1; if (next == list.end()) { graph_cat.debug() - << "Removing " << *arc << " from end\n"; + << "Removing " << *arc << " from end\n"; } else { graph_cat.debug() - << "Removing " << *arc << " from before " << *(*next) << "\n"; + << "Removing " << *arc << " from before " << *(*next) << "\n"; } } */ @@ -529,8 +529,8 @@ adjust_all_priorities(int adjustment) { //////////////////////////////////////////////////////////////////// bool NodeRelation:: sub_render_trans(const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav) { + AllTransitionsWrapper &trans, + RenderTraverser *trav) { bool all_true = true; NodeTransitions::const_iterator ti; for (ti = _transitions.begin(); ti != _transitions.end(); ++ti) { @@ -691,7 +691,7 @@ detach() { // These should never be NULL, because we're already attached, after // all. nassertr(parent_connection != (NodeConnection *)NULL && - child_connection != (NodeConnection *)NULL, result); + child_connection != (NodeConnection *)NULL, result); DownRelationPointers &parent_list = parent_connection->get_down(); UpRelationPointers &child_list = child_connection->get_up(); @@ -838,7 +838,7 @@ recompute_bound() { << "Cannot put " << _bound->get_type() << " around:\n"; for (int i = 0; i < (int)child_volumes.size(); i++) { graph_cat.error(false) - << " " << *child_volumes[i] << "\n"; + << " " << *child_volumes[i] << "\n"; } } #endif @@ -888,7 +888,7 @@ write_datagram(BamWriter *manager, Datagram &me) int NodeRelation:: complete_pointers(vector_typedWritable &plist, BamReader *manager) { nassertr(plist[0] != TypedWritable::Null && - plist[1] != TypedWritable::Null, 0); + plist[1] != TypedWritable::Null, 0); _parent = DCAST(Node, plist[0]); _child = DCAST(Node, plist[1]); @@ -924,8 +924,8 @@ complete_pointers(vector_typedWritable &plist, BamReader *manager) { if (plist[i] == TypedWritable::Null) { graph_cat->warning() - << get_type().get_name() - << ": Ignoring null Transition" << endl; + << get_type().get_name() + << ": Ignoring null Transition" << endl; } else { @@ -1004,10 +1004,10 @@ init_type() { TypedWritableReferenceCount::init_type(); BoundedObject::init_type(); register_type(_type_handle, "NodeRelation", - TypedWritableReferenceCount::get_class_type(), - BoundedObject::get_class_type()); + TypedWritableReferenceCount::get_class_type(), + BoundedObject::get_class_type()); register_type(_stashed_type_handle, "StashedNodeRelation", - get_class_type()); + get_class_type()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/graph/nodeRelation.h b/panda/src/graph/nodeRelation.h index 73d4a3fa02..cdb40f4589 100644 --- a/panda/src/graph/nodeRelation.h +++ b/panda/src/graph/nodeRelation.h @@ -35,7 +35,7 @@ extern EXPCL_PANDA UpdateSeq &last_graph_update(TypeHandle graph_type); EXPCL_PANDA INLINE_GRAPH void remove_arc(NodeRelation *arc); /////////////////////////////////////////////////////////////////// -// Class : NodeRelation +// Class : NodeRelation // Description : The base class for all scene graph arcs. This is the // glue between Nodes that defines the scene graph. // There are no arcs of type NodeRelation per se, but @@ -112,8 +112,8 @@ PUBLISHED: public: bool sub_render_trans(const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + AllTransitionsWrapper &trans, + RenderTraverser *trav); bool has_sub_render_trans() const; int get_num_sub_render_trans() const; @@ -179,7 +179,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_NodeRelation(const FactoryParams ¶ms); diff --git a/panda/src/graph/nodeTransition.cxx b/panda/src/graph/nodeTransition.cxx index cabc8a3a99..201b20cefe 100644 --- a/panda/src/graph/nodeTransition.cxx +++ b/panda/src/graph/nodeTransition.cxx @@ -36,7 +36,7 @@ get_handle() const { //////////////////////////////////////////////////////////////////// bool NodeTransition:: sub_render(NodeRelation *, const AllAttributesWrapper &, - AllTransitionsWrapper &, RenderTraverser *) { + AllTransitionsWrapper &, RenderTraverser *) { return true; } diff --git a/panda/src/graph/nodeTransition.h b/panda/src/graph/nodeTransition.h index 049dfcfb17..21bc1ec629 100644 --- a/panda/src/graph/nodeTransition.h +++ b/panda/src/graph/nodeTransition.h @@ -26,7 +26,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : NodeTransition +// Class : NodeTransition // Description : This is an abstract class defining the basic // interface to a Transition--the type of state change // request that is stored on the arcs of the scene @@ -70,9 +70,9 @@ public: virtual NodeAttribute *apply(const NodeAttribute *attrib) const=0; virtual bool sub_render(NodeRelation *arc, - const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + const AllAttributesWrapper &attrib, + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; virtual void output(ostream &out) const; @@ -120,7 +120,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "NodeTransition", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } private: diff --git a/panda/src/graph/nodeTransitionCache.cxx b/panda/src/graph/nodeTransitionCache.cxx index d3ffa595cb..abac626707 100644 --- a/panda/src/graph/nodeTransitionCache.cxx +++ b/panda/src/graph/nodeTransitionCache.cxx @@ -81,7 +81,7 @@ is_identity() const { int NodeTransitionCache:: compare_to(const NodeTransitionCache &other) const { return tmap_compare_cache(_cache.begin(), _cache.end(), - other._cache.begin(), other._cache.end()); + other._cache.begin(), other._cache.end()); } //////////////////////////////////////////////////////////////////// @@ -256,7 +256,7 @@ store_entry(TypeHandle handle, const NodeTransitionCacheEntry &entry) { //////////////////////////////////////////////////////////////////// void NodeTransitionCache:: store_to(const NodeTransitionCache *a, NodeRelation *arc, - NodeTransitions &nt) { + NodeTransitions &nt) { if (a == (NodeTransitionCache *)NULL || a->_cache.empty()) { // a is empty: no change. return; @@ -273,8 +273,8 @@ store_to(const NodeTransitionCache *a, NodeRelation *arc, // And now actually add them. NodeTransitions temp; tmap_override_union(nt._transitions.begin(), nt._transitions.end(), - a->_cache.begin(), a->_cache.end(), - inserter(temp._transitions, temp._transitions.begin())); + a->_cache.begin(), a->_cache.end(), + inserter(temp._transitions, temp._transitions.begin())); nt._transitions.swap(temp._transitions); } @@ -302,8 +302,8 @@ c_union(const NodeTransitionCache *a, const NodeTransitionCache *b) { NodeTransitionCache *result = new NodeTransitionCache; tmap_override_union(a->_cache.begin(), a->_cache.end(), - b->_cache.begin(), b->_cache.end(), - inserter(result->_cache, result->_cache.begin())); + b->_cache.begin(), b->_cache.end(), + inserter(result->_cache, result->_cache.begin())); return result; } @@ -338,8 +338,8 @@ compose(const NodeTransitionCache *a, const NodeTransitionCache *b) { NodeTransitionCache *result = new NodeTransitionCache; tmap_compose(a->_cache.begin(), a->_cache.end(), - b->_cache.begin(), b->_cache.end(), - inserter(result->_cache, result->_cache.begin())); + b->_cache.begin(), b->_cache.end(), + inserter(result->_cache, result->_cache.begin())); return result; } @@ -365,7 +365,7 @@ invert(const NodeTransitionCache *a) { NodeTransitionCache *result = new NodeTransitionCache; tmap_invert(a->_cache.begin(), a->_cache.end(), - inserter(result->_cache, result->_cache.begin())); + inserter(result->_cache, result->_cache.begin())); return result; } @@ -399,8 +399,8 @@ invert_compose(const NodeTransitionCache *a, const NodeTransitionCache *b) { NodeTransitionCache *result = new NodeTransitionCache; tmap_invert_compose(a->_cache.begin(), a->_cache.end(), - b->_cache.begin(), b->_cache.end(), - inserter(result->_cache, result->_cache.begin())); + b->_cache.begin(), b->_cache.end(), + inserter(result->_cache, result->_cache.begin())); return result; } @@ -418,9 +418,9 @@ invert_compose(const NodeTransitionCache *a, const NodeTransitionCache *b) { //////////////////////////////////////////////////////////////////// NodeTransitionCache *NodeTransitionCache:: cached_compose(const NodeTransitionCache *a, - const NodeTransitionCache *cache, - const NodeTransitionCache *b, - UpdateSeq now) { + const NodeTransitionCache *cache, + const NodeTransitionCache *b, + UpdateSeq now) { // Since the absence of a transition from the object implies the // identity transition, we can make a quick special case for either // object being empty: @@ -441,17 +441,17 @@ cached_compose(const NodeTransitionCache *a, // If the cache is NULL, we must send in an empty list for the // cache list. We'll use [a.begin .. a.begin). tmap_cached_compose(a->_cache.begin(), a->_cache.end(), - a->_cache.begin(), a->_cache.begin(), - b->_cache.begin(), b->_cache.end(), - now, - inserter(result->_cache, result->_cache.begin())); + a->_cache.begin(), a->_cache.begin(), + b->_cache.begin(), b->_cache.end(), + now, + inserter(result->_cache, result->_cache.begin())); } else { tmap_cached_compose(a->_cache.begin(), a->_cache.end(), - cache->_cache.begin(), cache->_cache.end(), - b->_cache.begin(), b->_cache.end(), - now, - inserter(result->_cache, result->_cache.begin())); + cache->_cache.begin(), cache->_cache.end(), + b->_cache.begin(), b->_cache.end(), + now, + inserter(result->_cache, result->_cache.begin())); } return result; @@ -498,7 +498,7 @@ output(ostream &out) const { for (ci = _cache.begin(); ci != _cache.end(); ++ci) { if (!(*ci).second.is_identity()) { if (written_any) { - out << " "; + out << " "; } out << (*ci).second; written_any = true; diff --git a/panda/src/graph/nodeTransitionCache.h b/panda/src/graph/nodeTransitionCache.h index c7f0ddb24d..3f7e433bb3 100644 --- a/panda/src/graph/nodeTransitionCache.h +++ b/panda/src/graph/nodeTransitionCache.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NodeTransitionCache +// Class : NodeTransitionCache // Description : This represents the cached values of accumulated // NodeTransitions values, associated with a particular // arc. @@ -71,7 +71,7 @@ public: static void store_to(const NodeTransitionCache *a, NodeRelation *arc, - NodeTransitions &nt); + NodeTransitions &nt); static NodeTransitionCache * c_union(const NodeTransitionCache *a, const NodeTransitionCache *b); @@ -87,9 +87,9 @@ public: static NodeTransitionCache * cached_compose(const NodeTransitionCache *a, - const NodeTransitionCache *cache, - const NodeTransitionCache *b, - UpdateSeq now); + const NodeTransitionCache *cache, + const NodeTransitionCache *b, + UpdateSeq now); static NodeTransitionCache * set_computed_verified(const NodeTransitionCache *a, UpdateSeq now); @@ -109,7 +109,7 @@ public: static void init_type() { ReferenceCount::init_type(); register_type(_type_handle, "NodeTransitionCache", - ReferenceCount::get_class_type()); + ReferenceCount::get_class_type()); } private: diff --git a/panda/src/graph/nodeTransitionCacheEntry.I b/panda/src/graph/nodeTransitionCacheEntry.I index fe39c09458..2a6156048d 100644 --- a/panda/src/graph/nodeTransitionCacheEntry.I +++ b/panda/src/graph/nodeTransitionCacheEntry.I @@ -71,7 +71,7 @@ compare_to(const NodeTransitionCacheEntry &other) const { // This should be guaranteed by the above logic. nassertr(_trans != (NodeTransition *)NULL && - other._trans != (NodeTransition *)NULL, false); + other._trans != (NodeTransition *)NULL, false); return _trans->compare_to(*other._trans); } @@ -244,7 +244,7 @@ invert(const NodeTransitionCacheEntry &a) { //////////////////////////////////////////////////////////////////// INLINE_GRAPH NodeTransitionCacheEntry NodeTransitionCacheEntry:: compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &b) { + const NodeTransitionCacheEntry &b) { if (a.is_identity()) { return b; } @@ -262,7 +262,7 @@ compose(const NodeTransitionCacheEntry &a, //////////////////////////////////////////////////////////////////// INLINE_GRAPH NodeTransitionCacheEntry NodeTransitionCacheEntry:: invert_compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &b) { + const NodeTransitionCacheEntry &b) { if (a.is_identity()) { return b; } @@ -298,9 +298,9 @@ invert_compose(const NodeTransitionCacheEntry &a, //////////////////////////////////////////////////////////////////// INLINE_GRAPH NodeTransitionCacheEntry NodeTransitionCacheEntry:: cached_compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &cache, - const NodeTransitionCacheEntry &b, - UpdateSeq now) { + const NodeTransitionCacheEntry &cache, + const NodeTransitionCacheEntry &b, + UpdateSeq now) { if (wrt_cat.is_spam()) { wrt_cat.spam() << "Composing:\n" diff --git a/panda/src/graph/nodeTransitionCacheEntry.h b/panda/src/graph/nodeTransitionCacheEntry.h index 1745dd2da1..c5594f70c7 100644 --- a/panda/src/graph/nodeTransitionCacheEntry.h +++ b/panda/src/graph/nodeTransitionCacheEntry.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NodeTransitionCacheEntry +// Class : NodeTransitionCacheEntry // Description : This is a single cached accumulated NodeTransition // value, representing the net Transition for one // particular transition type on an arc. @@ -60,17 +60,17 @@ public: INLINE_GRAPH static NodeTransitionCacheEntry compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &b); + const NodeTransitionCacheEntry &b); INLINE_GRAPH static NodeTransitionCacheEntry invert_compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &b); + const NodeTransitionCacheEntry &b); INLINE_GRAPH static NodeTransitionCacheEntry cached_compose(const NodeTransitionCacheEntry &a, - const NodeTransitionCacheEntry &cache, - const NodeTransitionCacheEntry &b, - UpdateSeq now); + const NodeTransitionCacheEntry &cache, + const NodeTransitionCacheEntry &b, + UpdateSeq now); INLINE_GRAPH static NodeAttribute * apply(const NodeAttribute *a, const NodeTransitionCacheEntry &b); diff --git a/panda/src/graph/nodeTransitionWrapper.I b/panda/src/graph/nodeTransitionWrapper.I index 685644ada0..dc2ccf35f8 100644 --- a/panda/src/graph/nodeTransitionWrapper.I +++ b/panda/src/graph/nodeTransitionWrapper.I @@ -237,11 +237,11 @@ set_computed_verified(UpdateSeq now) { //////////////////////////////////////////////////////////////////// INLINE_GRAPH void NodeTransitionWrapper:: cached_compose(const NodeTransitionWrapper &cache, - const NodeTransitionWrapper &value, - UpdateSeq now) { + const NodeTransitionWrapper &value, + UpdateSeq now) { _entry = NodeTransitionCacheEntry::cached_compose(_entry, cache._entry, - value._entry, now); + value._entry, now); } INLINE_GRAPH ostream &operator << (ostream &out, const NodeTransitionWrapper &ntw) { diff --git a/panda/src/graph/nodeTransitionWrapper.h b/panda/src/graph/nodeTransitionWrapper.h index e2c997c654..624c3f0047 100644 --- a/panda/src/graph/nodeTransitionWrapper.h +++ b/panda/src/graph/nodeTransitionWrapper.h @@ -30,7 +30,7 @@ class NodeAttribute; class NodeAttributeWrapper; //////////////////////////////////////////////////////////////////// -// Class : NodeTransitionWrapper +// Class : NodeTransitionWrapper // Description : This is a wrapper around a single transition type, // selected at runtime by its handle. It is useful when // computing a wrt() based on one transition type only @@ -70,8 +70,8 @@ public: INLINE_GRAPH void set_computed_verified(UpdateSeq now); INLINE_GRAPH void cached_compose(const NodeTransitionWrapper &cache, - const NodeTransitionWrapper &value, - UpdateSeq now); + const NodeTransitionWrapper &value, + UpdateSeq now); void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/graph/nodeTransitions.I b/panda/src/graph/nodeTransitions.I index 5e3048e011..9529bbc258 100644 --- a/panda/src/graph/nodeTransitions.I +++ b/panda/src/graph/nodeTransitions.I @@ -64,7 +64,7 @@ end() const { template INLINE_GRAPH bool get_transition_into(Transition *&ptr, const NodeTransitions &trans, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeTransition *nt = trans.get_transition(transition_type); if (nt == (NodeTransition *)NULL) { ptr = (Transition *)NULL; diff --git a/panda/src/graph/nodeTransitions.T b/panda/src/graph/nodeTransitions.T index fe45a25dae..3225c3fb57 100644 --- a/panda/src/graph/nodeTransitions.T +++ b/panda/src/graph/nodeTransitions.T @@ -17,7 +17,7 @@ template INLINE_GRAPH bool get_transition_into(Transition *&ptr, const NodeTransitions &trans, - TypeHandle transition_type) { + TypeHandle transition_type) { NodeTransition *nt = trans.get_transition(transition_type); if (nt == (NodeTransition *)NULL) { ptr = (Transition *)NULL; diff --git a/panda/src/graph/nodeTransitions.cxx b/panda/src/graph/nodeTransitions.cxx index 1b3332c02b..02d9d983e7 100644 --- a/panda/src/graph/nodeTransitions.cxx +++ b/panda/src/graph/nodeTransitions.cxx @@ -171,8 +171,8 @@ void NodeTransitions:: copy_transitions_from(const NodeTransitions &other) { Transitions temp; tmap_override_union(_transitions.begin(), _transitions.end(), - other._transitions.begin(), other._transitions.end(), - inserter(temp, temp.begin())); + other._transitions.begin(), other._transitions.end(), + inserter(temp, temp.begin())); _transitions.swap(temp); } @@ -187,11 +187,11 @@ copy_transitions_from(const NodeTransitions &other) { //////////////////////////////////////////////////////////////////// void NodeTransitions:: copy_transitions_from(const NodeTransitions &other, - NodeRelation *to_arc) { + NodeRelation *to_arc) { Transitions temp; tmap_arc_union(_transitions.begin(), _transitions.end(), - other._transitions.begin(), other._transitions.end(), - to_arc, inserter(temp, temp.begin())); + other._transitions.begin(), other._transitions.end(), + to_arc, inserter(temp, temp.begin())); _transitions.swap(temp); } @@ -207,11 +207,11 @@ copy_transitions_from(const NodeTransitions &other, //////////////////////////////////////////////////////////////////// void NodeTransitions:: compose_transitions_from(const NodeTransitions &other, - NodeRelation *to_arc) { + NodeRelation *to_arc) { Transitions temp; tmap_arc_compose(_transitions.begin(), _transitions.end(), - other._transitions.begin(), other._transitions.end(), - to_arc, inserter(temp, temp.begin())); + other._transitions.begin(), other._transitions.end(), + to_arc, inserter(temp, temp.begin())); _transitions.swap(temp); } @@ -223,7 +223,7 @@ compose_transitions_from(const NodeTransitions &other, int NodeTransitions:: compare_to(const NodeTransitions &other) const { return tmap_compare_trans(_transitions.begin(), _transitions.end(), - other._transitions.begin(), other._transitions.end()); + other._transitions.begin(), other._transitions.end()); } //////////////////////////////////////////////////////////////////// @@ -244,10 +244,10 @@ adjust_all_priorities(int adjustment, NodeRelation *arc) { if (trans->_priority != new_priority) { if (trans->get_ref_count() > 1) { - // Copy-on-write. - trans->removed_from_arc(arc); - trans = trans->make_copy(); - trans->added_to_arc(arc); + // Copy-on-write. + trans->removed_from_arc(arc); + trans = trans->make_copy(); + trans->added_to_arc(arc); } trans->_priority = new_priority; arc->changed_transition((*ti).first); @@ -283,7 +283,7 @@ output(ostream &out) const { for (ti = _transitions.begin(); ti != _transitions.end(); ++ti) { if ((*ti).second != (NodeTransition *)NULL) { if (written_any) { - out << " "; + out << " "; } out << *(*ti).second; written_any = true; @@ -302,7 +302,7 @@ write(ostream &out, int indent_level) const { for (ti = _transitions.begin(); ti != _transitions.end(); ++ti) { if ((*ti).second != (NodeTransition *)NULL) { indent(out, indent_level) - << (*ti).first << " = " << *(*ti).second << "\n"; + << (*ti).first << " = " << *(*ti).second << "\n"; // (*ti).second->write(out, indent_level + 2); } } diff --git a/panda/src/graph/nodeTransitions.h b/panda/src/graph/nodeTransitions.h index 63c0a4f0b2..a66f16747e 100644 --- a/panda/src/graph/nodeTransitions.h +++ b/panda/src/graph/nodeTransitions.h @@ -17,7 +17,7 @@ class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : NodeTransitions +// Class : NodeTransitions // Description : This represents a set of zero or more NodeTransition // pointers, organized by the transitions' get_handle() // value. @@ -37,9 +37,9 @@ public: NodeTransition *get_transition(TypeHandle handle) const; void copy_transitions_from(const NodeTransitions &other); void copy_transitions_from(const NodeTransitions &other, - NodeRelation *to_arc); + NodeRelation *to_arc); void compose_transitions_from(const NodeTransitions &other, - NodeRelation *to_arc); + NodeRelation *to_arc); void adjust_all_priorities(int adjustment, NodeRelation *arc); void clear(); diff --git a/panda/src/graph/nullAttributeWrapper.h b/panda/src/graph/nullAttributeWrapper.h index c423f34ce1..c83c5a7a21 100644 --- a/panda/src/graph/nullAttributeWrapper.h +++ b/panda/src/graph/nullAttributeWrapper.h @@ -16,7 +16,7 @@ class NullTransitionWrapper; //////////////////////////////////////////////////////////////////// -// Class : NullAttributeWrapper +// Class : NullAttributeWrapper // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA NullAttributeWrapper { diff --git a/panda/src/graph/nullLevelState.h b/panda/src/graph/nullLevelState.h index 01e63ba372..1c3f136d29 100644 --- a/panda/src/graph/nullLevelState.h +++ b/panda/src/graph/nullLevelState.h @@ -9,7 +9,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : NullLevelState +// Class : NullLevelState // Description : This is an empty class designed to be passed to a // traverser that doesn't care about tracking states // between levels. diff --git a/panda/src/graph/nullTransitionWrapper.I b/panda/src/graph/nullTransitionWrapper.I index 83a39e7f1b..17d7f593fe 100644 --- a/panda/src/graph/nullTransitionWrapper.I +++ b/panda/src/graph/nullTransitionWrapper.I @@ -175,8 +175,8 @@ set_computed_verified(UpdateSeq) { //////////////////////////////////////////////////////////////////// INLINE_GRAPH void NullTransitionWrapper:: cached_compose(const NullTransitionWrapper &, - const NullTransitionWrapper &, - UpdateSeq) { + const NullTransitionWrapper &, + UpdateSeq) { } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/graph/nullTransitionWrapper.h b/panda/src/graph/nullTransitionWrapper.h index 5cd8878646..37de13dd48 100644 --- a/panda/src/graph/nullTransitionWrapper.h +++ b/panda/src/graph/nullTransitionWrapper.h @@ -30,7 +30,7 @@ class NodeAttribute; class NullAttributeWrapper; //////////////////////////////////////////////////////////////////// -// Class : NullTransitionWrapper +// Class : NullTransitionWrapper // Description : This is a wrapper around *no* transitions at all. It // does absolutely nothing. It's pointless to pass to // wrt(), but it's useful for passing to df_traverse() @@ -68,8 +68,8 @@ public: INLINE_GRAPH void set_computed_verified(UpdateSeq now); INLINE_GRAPH void cached_compose(const NullTransitionWrapper &cache, - const NullTransitionWrapper &value, - UpdateSeq now); + const NullTransitionWrapper &value, + UpdateSeq now); INLINE_GRAPH void output(ostream &out) const; INLINE_GRAPH void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/graph/onAttribute.h b/panda/src/graph/onAttribute.h index be79b83770..e83188050e 100644 --- a/panda/src/graph/onAttribute.h +++ b/panda/src/graph/onAttribute.h @@ -13,7 +13,7 @@ class OnTransition; //////////////////////////////////////////////////////////////////// -// Class : OnAttribute +// Class : OnAttribute // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA OnAttribute : public NodeAttribute { @@ -45,7 +45,7 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, "OnAttribute", - NodeAttribute::get_class_type()); + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/onOffAttribute.h b/panda/src/graph/onOffAttribute.h index 227a3f14c4..312ee7d459 100644 --- a/panda/src/graph/onOffAttribute.h +++ b/panda/src/graph/onOffAttribute.h @@ -13,7 +13,7 @@ class OnOffTransition; //////////////////////////////////////////////////////////////////// -// Class : OnOffAttribute +// Class : OnOffAttribute // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA OnOffAttribute : public NodeAttribute { @@ -55,7 +55,7 @@ public: static void init_type() { NodeAttribute::init_type(); register_type(_type_handle, "OnOffAttribute", - NodeAttribute::get_class_type()); + NodeAttribute::get_class_type()); } private: diff --git a/panda/src/graph/onOffTransition.h b/panda/src/graph/onOffTransition.h index ecd4f64200..eff4f83061 100644 --- a/panda/src/graph/onOffTransition.h +++ b/panda/src/graph/onOffTransition.h @@ -15,7 +15,7 @@ class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : OnOffTransition +// Class : OnOffTransition // Description : This is an abstract class that encapsulates a family // of transitions for states that are either on or off // (and, when on, may or may not have some particular @@ -87,7 +87,7 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, "OnOffTransition", - NodeTransition::get_class_type()); + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/onTransition.h b/panda/src/graph/onTransition.h index f455d18b7a..0ae35ad3f5 100644 --- a/panda/src/graph/onTransition.h +++ b/panda/src/graph/onTransition.h @@ -14,7 +14,7 @@ class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// -// Class : OnTransition +// Class : OnTransition // Description : This is an abstract class that encapsulates a family // of transitions for states that are always on, in one // state or another. It's similar to OnOffTransition, @@ -67,7 +67,7 @@ public: static void init_type() { NodeTransition::init_type(); register_type(_type_handle, "OnTransition", - NodeTransition::get_class_type()); + NodeTransition::get_class_type()); } private: diff --git a/panda/src/graph/pointerNameClass.h b/panda/src/graph/pointerNameClass.h index cb3333807b..5f684ac9eb 100644 --- a/panda/src/graph/pointerNameClass.h +++ b/panda/src/graph/pointerNameClass.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PointerNameClass +// Class : PointerNameClass // Description : This is a stupid little class that's used by // MultiNodeTransition to define the name of its // PT(Node) class, so the MultiTransition it diff --git a/panda/src/graph/setTransitionHelpers.T b/panda/src/graph/setTransitionHelpers.T index 44016d1928..356670a7c0 100644 --- a/panda/src/graph/setTransitionHelpers.T +++ b/panda/src/graph/setTransitionHelpers.T @@ -17,8 +17,8 @@ template OutputIterator tmap_get_interest(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < *first2) { ++first1; @@ -46,8 +46,8 @@ tmap_get_interest(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_override_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -89,8 +89,8 @@ tmap_override_union(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_merge_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -132,8 +132,8 @@ tmap_merge_union(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_arc_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - NodeRelation *to_arc, OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + NodeRelation *to_arc, OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -176,8 +176,8 @@ tmap_arc_union(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - NodeRelation *to_arc, OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + NodeRelation *to_arc, OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -193,9 +193,9 @@ tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, PT(NodeTransition) c = (*first1).second->compose((*first2).second); if (c != (NodeTransition *)NULL) { - c->added_to_arc(to_arc); - *result = pair((*first1).first, c); - ++result; + c->added_to_arc(to_arc); + *result = pair((*first1).first, c); + ++result; } ++first1; ++first2; @@ -224,8 +224,8 @@ tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -238,9 +238,9 @@ tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, } else { NodeTransition *c = (*first1).second->compose((*first2).second); if (c != (NodeTransition *)NULL) { - *result = pair - ((*first1).first, c); - ++result; + *result = pair + ((*first1).first, c); + ++result; } ++first1; ++first2; @@ -271,8 +271,8 @@ tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -284,8 +284,8 @@ tmap_compose(InputIterator1 first1, InputIterator1 last1, ++result; } else { *result = pair - ((*first1).first, - NodeTransitionCacheEntry::compose((*first1).second, (*first2).second)); + ((*first1).first, + NodeTransitionCacheEntry::compose((*first1).second, (*first2).second)); ++first1; ++first2; ++result; @@ -316,12 +316,12 @@ tmap_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_invert_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = pair - ((*first1).first, NodeTransitionCacheEntry::invert((*first1).second)); + ((*first1).first, NodeTransitionCacheEntry::invert((*first1).second)); ++first1; ++result; } else if ((*first2).first < (*first1).first) { @@ -330,12 +330,12 @@ tmap_invert_compose(InputIterator1 first1, InputIterator1 last1, ++result; } else { NodeTransitionCacheEntry ic = - NodeTransitionCacheEntry::invert_compose((*first1).second, - (*first2).second); + NodeTransitionCacheEntry::invert_compose((*first1).second, + (*first2).second); if (!ic.is_identity()) { - // Only bother to store the result if it's not identity. - *result = pair((*first1).first, ic); - ++result; + // Only bother to store the result if it's not identity. + *result = pair((*first1).first, ic); + ++result; } ++first1; ++first2; @@ -383,7 +383,7 @@ tmap_invert_compose(InputIterator1 first1, InputIterator1 last1, template void tmap_cached_compose_not_1(InputIterator2 &first2, InputIterator3 &first3, - UpdateSeq now, OutputIterator &result) { + UpdateSeq now, OutputIterator &result) { if ((*first2).first < (*first3).first) { // Here's an element in list 2 that is not in lists 1 or 3. OUTPUT_CC_ELEM("2", (*first2).first); @@ -392,9 +392,9 @@ tmap_cached_compose_not_1(InputIterator2 &first2, InputIterator3 &first3, ((*first2).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - (*first2).second, - NodeTransitionCacheEntry(), - now)); + (*first2).second, + NodeTransitionCacheEntry(), + now)); ++first2; ++result; @@ -406,9 +406,9 @@ tmap_cached_compose_not_1(InputIterator2 &first2, InputIterator3 &first3, ((*first3).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - (*first3).second, - now)); + NodeTransitionCacheEntry(), + (*first3).second, + now)); ++first3; ++result; @@ -420,9 +420,9 @@ tmap_cached_compose_not_1(InputIterator2 &first2, InputIterator3 &first3, ((*first2).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - (*first2).second, - (*first3).second, - now)); + (*first2).second, + (*first3).second, + now)); ++first2; ++first3; ++result; @@ -441,7 +441,7 @@ tmap_cached_compose_not_1(InputIterator2 &first2, InputIterator3 &first3, template void tmap_cached_compose_not_2(InputIterator1 &first1, InputIterator3 &first3, - UpdateSeq now, OutputIterator &result) { + UpdateSeq now, OutputIterator &result) { if ((*first1).first < (*first3).first) { // Here's an element in list 1 that is not in lists 2 or 3. OUTPUT_CC_ELEM("1", (*first1).first); @@ -450,9 +450,9 @@ tmap_cached_compose_not_2(InputIterator1 &first1, InputIterator3 &first3, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - now)); + NodeTransitionCacheEntry(), + NodeTransitionCacheEntry(), + now)); ++first1; ++result; @@ -464,9 +464,9 @@ tmap_cached_compose_not_2(InputIterator1 &first1, InputIterator3 &first3, ((*first3).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - (*first3).second, - now)); + NodeTransitionCacheEntry(), + (*first3).second, + now)); ++first3; ++result; @@ -478,9 +478,9 @@ tmap_cached_compose_not_2(InputIterator1 &first1, InputIterator3 &first3, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - NodeTransitionCacheEntry(), - (*first3).second, - now)); + NodeTransitionCacheEntry(), + (*first3).second, + now)); ++first1; ++first3; ++result; @@ -498,7 +498,7 @@ tmap_cached_compose_not_2(InputIterator1 &first1, InputIterator3 &first3, template void tmap_cached_compose_not_3(InputIterator1 &first1, InputIterator2 &first2, - UpdateSeq now, OutputIterator &result) { + UpdateSeq now, OutputIterator &result) { if ((*first1).first < (*first2).first) { // Here's an element in list 1 that is not in lists 2 or 3. OUTPUT_CC_ELEM("1", (*first1).first); @@ -507,9 +507,9 @@ tmap_cached_compose_not_3(InputIterator1 &first1, InputIterator2 &first2, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - now)); + NodeTransitionCacheEntry(), + NodeTransitionCacheEntry(), + now)); ++first1; ++result; @@ -521,9 +521,9 @@ tmap_cached_compose_not_3(InputIterator1 &first1, InputIterator2 &first2, ((*first2).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - (*first2).second, - NodeTransitionCacheEntry(), - now)); + (*first2).second, + NodeTransitionCacheEntry(), + now)); ++first2; ++result; @@ -535,9 +535,9 @@ tmap_cached_compose_not_3(InputIterator1 &first1, InputIterator2 &first2, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - (*first2).second, - NodeTransitionCacheEntry(), - now)); + (*first2).second, + NodeTransitionCacheEntry(), + now)); ++first1; ++first2; ++result; @@ -556,8 +556,8 @@ template void tmap_cached_compose_12(InputIterator1 &first1, InputIterator2 &first2, - InputIterator3 &first3, - UpdateSeq now, OutputIterator &result) { + InputIterator3 &first3, + UpdateSeq now, OutputIterator &result) { if ((*first1).first < (*first3).first) { // Here's an element in lists 1 and 2 that is not in list 3. OUTPUT_CC_ELEM("1, 2", (*first1).first); @@ -566,9 +566,9 @@ tmap_cached_compose_12(InputIterator1 &first1, InputIterator2 &first2, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - (*first2).second, - NodeTransitionCacheEntry(), - now)); + (*first2).second, + NodeTransitionCacheEntry(), + now)); ++first1; ++first2; ++result; @@ -581,9 +581,9 @@ tmap_cached_compose_12(InputIterator1 &first1, InputIterator2 &first2, ((*first3).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - (*first3).second, - now)); + NodeTransitionCacheEntry(), + (*first3).second, + now)); ++first3; ++result; @@ -595,9 +595,9 @@ tmap_cached_compose_12(InputIterator1 &first1, InputIterator2 &first2, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - (*first2).second, - (*first3).second, - now)); + (*first2).second, + (*first3).second, + now)); ++first1; ++first2; ++first3; @@ -622,9 +622,9 @@ template OutputIterator tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - InputIterator3 first3, InputIterator3 last3, - UpdateSeq now, OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + InputIterator3 first3, InputIterator3 last3, + UpdateSeq now, OutputIterator result) { while (first1 != last1 && first2 != last2 && first3 != last3) { if ((*first1).first < (*first2).first) { tmap_cached_compose_not_2(first1, first3, now, result); @@ -662,9 +662,9 @@ tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, ((*first1).first, NodeTransitionCacheEntry::cached_compose ((*first1).second, - NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - now)); + NodeTransitionCacheEntry(), + NodeTransitionCacheEntry(), + now)); ++first1; ++result; } @@ -677,9 +677,9 @@ tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, ((*first2).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - (*first2).second, - NodeTransitionCacheEntry(), - now)); + (*first2).second, + NodeTransitionCacheEntry(), + now)); ++first2; ++result; } @@ -692,9 +692,9 @@ tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, ((*first3).first, NodeTransitionCacheEntry::cached_compose (NodeTransitionCacheEntry(), - NodeTransitionCacheEntry(), - (*first3).second, - now)); + NodeTransitionCacheEntry(), + (*first3).second, + now)); ++first3; ++result; } @@ -713,8 +713,8 @@ tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_apply(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { + InputIterator2 first2, InputIterator2 last2, + OutputIterator result) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { *result = *first1; @@ -722,14 +722,14 @@ tmap_apply(InputIterator1 first1, InputIterator1 last1, ++result; } else if ((*first2).first < (*first1).first) { *result = pair - ((*first2).first, - NodeTransitionCacheEntry::apply(NULL, (*first2).second)); + ((*first2).first, + NodeTransitionCacheEntry::apply(NULL, (*first2).second)); ++first2; ++result; } else { *result = pair - ((*first1).first, - NodeTransitionCacheEntry::apply((*first1).second, (*first2).second)); + ((*first1).first, + NodeTransitionCacheEntry::apply((*first1).second, (*first2).second)); ++first1; ++first2; ++result; @@ -763,7 +763,7 @@ tmap_apply(InputIterator1 first1, InputIterator1 last1, template OutputIterator tmap_invert(InputIterator first, InputIterator last, - OutputIterator result) { + OutputIterator result) { while (first != last) { *result = pair ((*first).first, NodeTransitionCacheEntry::invert((*first).second)); @@ -785,21 +785,21 @@ tmap_invert(InputIterator first, InputIterator last, template bool tmap_equiv_trans(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if (!(*first1).second.is_identity()) { - return false; + return false; } ++first1; } else if ((*first2).first < (*first1).first) { if (!(*first2).second.is_identity()) { - return false; + return false; } ++first2; } else { if (!(*first1).second.compare_to((*first2).second) == 0) { - return false; + return false; } ++first1; ++first2; @@ -834,25 +834,25 @@ tmap_equiv_trans(InputIterator1 first1, InputIterator1 last1, template bool tmap_equiv_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if ((*first1).second != (NodeAttribute *)NULL) { - return false; + return false; } ++first1; } else if ((*first2).first < (*first1).first) { if ((*first2).second != (NodeAttribute *)NULL) { - return false; + return false; } ++first2; } else { if ((*first1).second != (*first2).second) { - if ((*first1).second == (NodeAttribute *)NULL || - (*first2).second == (NodeAttribute *)NULL || - (*first1).second->compare_to((*first2).second) != 0) { - return false; - } + if ((*first1).second == (NodeAttribute *)NULL || + (*first2).second == (NodeAttribute *)NULL || + (*first1).second->compare_to((*first2).second) != 0) { + return false; + } } ++first1; ++first2; @@ -884,23 +884,23 @@ tmap_equiv_attr(InputIterator1 first1, InputIterator1 last1, template int tmap_compare_cache(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if (!(*first1).second.is_identity()) { - return 1; + return 1; } ++first1; } else if ((*first2).first < (*first1).first) { if (!(*first2).second.is_identity()) { - return -1; + return -1; } ++first2; } else { int result; result = (*first1).second.compare_to((*first2).second); if (result != 0) { - return result; + return result; } ++first1; ++first2; @@ -935,31 +935,31 @@ tmap_compare_cache(InputIterator1 first1, InputIterator1 last1, template int tmap_compare_trans(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if ((*first1).second != (NodeTransition *)NULL) { - return 1; + return 1; } ++first1; } else if ((*first2).first < (*first1).first) { if ((*first2).second != (NodeTransition *)NULL) { - return -1; + return -1; } ++first2; } else { if ((*first1).second != (*first2).second) { - if ((*first1).second == (NodeTransition *)NULL) { - return -1; - } else if ((*first2).second == (NodeTransition *)NULL) { - return 1; - } else { - int result; - result = (*first1).second->compare_to(*(*first2).second); - if (result != 0) { - return result; - } - } + if ((*first1).second == (NodeTransition *)NULL) { + return -1; + } else if ((*first2).second == (NodeTransition *)NULL) { + return 1; + } else { + int result; + result = (*first1).second->compare_to(*(*first2).second); + if (result != 0) { + return result; + } + } } ++first1; ++first2; @@ -994,31 +994,31 @@ tmap_compare_trans(InputIterator1 first1, InputIterator1 last1, template int tmap_compare_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { + InputIterator2 first2, InputIterator2 last2) { while (first1 != last1 && first2 != last2) { if ((*first1).first < (*first2).first) { if ((*first1).second != (NodeAttribute *)NULL) { - return 1; + return 1; } ++first1; } else if ((*first2).first < (*first1).first) { if ((*first2).second != (NodeAttribute *)NULL) { - return -1; + return -1; } ++first2; } else { if ((*first1).second != (*first2).second) { - if ((*first1).second == (NodeAttribute *)NULL) { - return -1; - } else if ((*first2).second == (NodeAttribute *)NULL) { - return 1; - } else { - int result; - result = (*first1).second->compare_to(*(*first2).second); - if (result != 0) { - return result; - } - } + if ((*first1).second == (NodeAttribute *)NULL) { + return -1; + } else if ((*first2).second == (NodeAttribute *)NULL) { + return 1; + } else { + int result; + result = (*first1).second->compare_to(*(*first2).second); + if (result != 0) { + return result; + } + } } ++first1; ++first2; diff --git a/panda/src/graph/setTransitionHelpers.h b/panda/src/graph/setTransitionHelpers.h index 0252f3a0c1..591f516ef8 100644 --- a/panda/src/graph/setTransitionHelpers.h +++ b/panda/src/graph/setTransitionHelpers.h @@ -31,82 +31,82 @@ template OutputIterator tmap_get_interest(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); template OutputIterator tmap_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); template OutputIterator tmap_arc_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - NodeRelation *to_arc, OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + NodeRelation *to_arc, OutputIterator result); template OutputIterator tmap_arc_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - NodeRelation *to_arc, OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + NodeRelation *to_arc, OutputIterator result); template OutputIterator tmap_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); template OutputIterator tmap_invert_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); template OutputIterator tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, - InputIterator2 cached_first, InputIterator2 cached_last, - InputIterator3 value_first, InputIterator3 value_last, - UpdateSeq now, OutputIterator result); + InputIterator2 cached_first, InputIterator2 cached_last, + InputIterator3 value_first, InputIterator3 value_last, + UpdateSeq now, OutputIterator result); template OutputIterator tmap_apply(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); template OutputIterator tmap_invert(InputIterator first, InputIterator last, - OutputIterator result); + OutputIterator result); template bool tmap_equiv_trans(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); template bool tmap_equiv_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); template int tmap_compare_cache(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); template int tmap_compare_trans(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); template int tmap_compare_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); + InputIterator2 first2, InputIterator2 last2); template bool diff --git a/panda/src/graph/test_graph.cxx b/panda/src/graph/test_graph.cxx index f7781c6dc0..9f6a2bfc44 100644 --- a/panda/src/graph/test_graph.cxx +++ b/panda/src/graph/test_graph.cxx @@ -68,7 +68,7 @@ public: static void init_type() { BaseTransition::init_type(); register_type(_type_handle, "TestTransition", - BaseTransition::get_class_type()); + BaseTransition::get_class_type()); } private: @@ -101,7 +101,7 @@ public: static void init_type() { BaseAttribute::init_type(); register_type(_type_handle, "TestAttribute", - BaseAttribute::get_class_type()); + BaseAttribute::get_class_type()); } private: @@ -130,7 +130,7 @@ public: static void init_type() { TestTransition::init_type(); register_type(_type_handle, "Test2Transition", - TestTransition::get_class_type()); + TestTransition::get_class_type()); } private: @@ -155,7 +155,7 @@ public: static void init_type() { TestAttribute::init_type(); register_type(_type_handle, "Test2Attribute", - TestAttribute::get_class_type()); + TestAttribute::get_class_type()); } private: @@ -184,7 +184,7 @@ protected: out << prop; } virtual void write_property(ostream &out, const TestType &prop, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << prop << "\n"; } @@ -199,7 +199,7 @@ public: static void init_type() { MultiAttribute::init_type(); register_type(_type_handle, "TestMAttribute", - MultiAttribute::get_class_type()); + MultiAttribute::get_class_type()); } private: @@ -222,7 +222,7 @@ protected: out << prop; } virtual void write_property(ostream &out, const TestType &prop, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << prop << "\n"; } @@ -237,7 +237,7 @@ public: static void init_type() { MultiTransition::init_type(); register_type(_type_handle, "TestMTransition", - MultiTransition::get_class_type()); + MultiTransition::get_class_type()); } private: @@ -260,16 +260,16 @@ public: return true; } bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + NullLevelState &) { // indent(nout, _indent_level + 1) // << "Passing " << *arc << ", trans is " << trans << "\n"; _indent_level += 2; return true; } void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - const NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + const NullLevelState &) { _indent_level -= 2; } int _indent_level; @@ -496,9 +496,9 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NullAttributeWrapper(), - NullLevelState(), - NodeRelation::get_class_type()); + NullAttributeWrapper(), + NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; NullTransitionWrapper result; @@ -544,9 +544,9 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(TestTransition::get_class_type()), - NullLevelState(), - NodeRelation::get_class_type()); + NodeAttributeWrapper(TestTransition::get_class_type()), + NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; NodeTransitionWrapper result(TestTransition::get_class_type()); @@ -592,9 +592,9 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(Test2Transition::get_class_type()), - NullLevelState(), - NodeRelation::get_class_type()); + NodeAttributeWrapper(Test2Transition::get_class_type()), + NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; NodeTransitionWrapper result(Test2Transition::get_class_type()); @@ -640,9 +640,9 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(TestMTransition::get_class_type()), - NullLevelState(), - NodeRelation::get_class_type()); + NodeAttributeWrapper(TestMTransition::get_class_type()), + NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; NodeTransitionWrapper result(TestMTransition::get_class_type()); @@ -688,9 +688,9 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - AllAttributesWrapper(), - NullLevelState(), - NodeRelation::get_class_type()); + AllAttributesWrapper(), + NullLevelState(), + NodeRelation::get_class_type()); nout << "\n"; AllTransitionsWrapper result; diff --git a/panda/src/graph/traverserVisitor.T b/panda/src/graph/traverserVisitor.T index 868d0b1842..c88443f7b2 100644 --- a/panda/src/graph/traverserVisitor.T +++ b/panda/src/graph/traverserVisitor.T @@ -14,8 +14,8 @@ template INLINE_GRAPH bool TraverserVisitor:: reached_node(Node *, - TraverserVisitor::AttributeWrapper &, - LevelState &) { + TraverserVisitor::AttributeWrapper &, + LevelState &) { return true; } @@ -30,10 +30,10 @@ reached_node(Node *, template INLINE_GRAPH bool TraverserVisitor:: forward_arc(NodeRelation *, - TraverserVisitor::TransitionWrapper &, - TraverserVisitor::AttributeWrapper &, - TraverserVisitor::AttributeWrapper &, - LevelState &) { + TraverserVisitor::TransitionWrapper &, + TraverserVisitor::AttributeWrapper &, + TraverserVisitor::AttributeWrapper &, + LevelState &) { return true; } @@ -50,8 +50,8 @@ forward_arc(NodeRelation *, template INLINE_GRAPH void TraverserVisitor:: backward_arc(NodeRelation *, - TraverserVisitor::TransitionWrapper &, - TraverserVisitor::AttributeWrapper &, - TraverserVisitor::AttributeWrapper &, - const LevelState &) { + TraverserVisitor::TransitionWrapper &, + TraverserVisitor::AttributeWrapper &, + TraverserVisitor::AttributeWrapper &, + const LevelState &) { } diff --git a/panda/src/graph/traverserVisitor.h b/panda/src/graph/traverserVisitor.h index f09b57b2b5..a67eb97236 100644 --- a/panda/src/graph/traverserVisitor.h +++ b/panda/src/graph/traverserVisitor.h @@ -18,19 +18,19 @@ public: typedef TYPENAME TransitionWrapper::AttributeWrapper AttributeWrapper; INLINE_GRAPH bool reached_node(Node *node, - AttributeWrapper &render_state, - LevelState &level_state); + AttributeWrapper &render_state, + LevelState &level_state); // Some traversers (notably DFTraverser) will also call the // following two functions to mark the crossing of arcs. This will // allow the Visitor to maintain its own internal state as needed. INLINE_GRAPH bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - LevelState &level_state); + AttributeWrapper &pre, AttributeWrapper &post, + LevelState &level_state); INLINE_GRAPH void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - const LevelState &level_state); + AttributeWrapper &pre, AttributeWrapper &post, + const LevelState &level_state); }; #include "traverserVisitor.T" diff --git a/panda/src/graph/wrt.I b/panda/src/graph/wrt.I index 2337276700..89dde308e7 100644 --- a/panda/src/graph/wrt.I +++ b/panda/src/graph/wrt.I @@ -13,9 +13,9 @@ template void describe_ambiguous_wrt(const Node *node, - InputIterator arc_list_begin, - InputIterator arc_list_end, - TypeHandle graph_type) { + InputIterator arc_list_begin, + InputIterator arc_list_end, + TypeHandle graph_type) { if (wrt_cat.is_warning()) { const UpRelationPointers &urp = node->find_connection(graph_type).get_up(); int num_parents = urp.size(); @@ -29,35 +29,35 @@ describe_ambiguous_wrt(const Node *node, for (int i = 1; i < num_parents; i++) { parent_arc = urp[i]; wrt_cat.warning(false) - << ", " << *parent_arc->get_parent(); + << ", " << *parent_arc->get_parent(); } wrt_cat.warning(false) << "\n"; // Show the chain of arcs specified. if (arc_list_begin == arc_list_end) { wrt_cat.warning(false) - << " no arcs specified.\n"; + << " no arcs specified.\n"; } else { wrt_cat.warning(false) - << " arcs specified:\n"; + << " arcs specified:\n"; InputIterator ri = arc_list_begin; wrt_cat.warning(false) - << " " << *(*ri)->get_parent() << "/" - << *(*ri)->get_child(); + << " " << *(*ri)->get_parent() << "/" + << *(*ri)->get_child(); InputIterator ri_last = ri; ++ri; while (ri != arc_list_end) { - if ((*ri)->get_parent() == (*ri_last)->get_child()) { - wrt_cat.warning(false) - << "/" << *(*ri)->get_child(); - } else { - wrt_cat.warning(false) - << "\n " << *(*ri)->get_parent() << "/" - << *(*ri)->get_child(); - } - ri_last = ri; - ++ri; + if ((*ri)->get_parent() == (*ri_last)->get_child()) { + wrt_cat.warning(false) + << "/" << *(*ri)->get_child(); + } else { + wrt_cat.warning(false) + << "\n " << *(*ri)->get_parent() << "/" + << *(*ri)->get_child(); + } + ri_last = ri; + ++ri; } wrt_cat.warning(false) << "\n"; } @@ -95,8 +95,8 @@ describe_ambiguous_wrt(const Node *node, template void get_cached_net_transition(NodeRelation *arc, Node *&root, - UpdateSeq as_of, UpdateSeq now, - TransitionWrapper &net, TypeHandle graph_type) { + UpdateSeq as_of, UpdateSeq now, + TransitionWrapper &net, TypeHandle graph_type) { TransitionWrapper cur_cache = TransitionWrapper::init_from(net); Node *top_subtree = cur_cache.extract_from_cache(arc); @@ -108,18 +108,18 @@ get_cached_net_transition(NodeRelation *arc, Node *&root, if (wrt_cat.is_debug()) { wrt_cat.debug() - << "get_cached_net_transition(" << *arc->get_child() << ", "; + << "get_cached_net_transition(" << *arc->get_child() << ", "; if (root == (Node *)NULL) { - wrt_cat.debug(false) << "(top)"; + wrt_cat.debug(false) << "(top)"; } else { - wrt_cat.debug(false) << *root; + wrt_cat.debug(false) << *root; } wrt_cat.debug(false) - << ") is current as of " << as_of << " (now is " - << now << ")\n"; + << ") is current as of " << as_of << " (now is " + << now << ")\n"; if (wrt_cat.is_spam()) { - wrt_cat.spam() << "result of " << *arc << " is " << net << "\n"; - } + wrt_cat.spam() << "result of " << *arc << " is " << net << "\n"; + } } } else { @@ -140,11 +140,11 @@ get_cached_net_transition(NodeRelation *arc, Node *&root, // the caching. Stop here. if (num_parents == 0) { - // The node is the very top of the scene graph. We'll treat - // this as a special case by setting the node to NULL. This - // will tell our calling function that there's no need to look - // further. - node = NULL; + // The node is the very top of the scene graph. We'll treat + // this as a special case by setting the node to NULL. This + // will tell our calling function that there's no need to look + // further. + node = NULL; } root = node; @@ -168,18 +168,18 @@ get_cached_net_transition(NodeRelation *arc, Node *&root, if (wrt_cat.is_debug()) { wrt_cat.debug() - << "get_cached_net_transition(" << *arc->get_child() << ", "; + << "get_cached_net_transition(" << *arc->get_child() << ", "; if (root == (Node *)NULL) { - wrt_cat.debug(false) << "(top)"; + wrt_cat.debug(false) << "(top)"; } else { - wrt_cat.debug(false) << *root; + wrt_cat.debug(false) << *root; } wrt_cat.debug(false) - << ") is recomputed as of " << as_of << " (now is " - << now << ")\n"; + << ") is recomputed as of " << as_of << " (now is " + << now << ")\n"; if (wrt_cat.is_spam()) { - wrt_cat.spam() << "result of " << *arc << " is " << net << "\n"; - } + wrt_cat.spam() << "result of " << *arc << " is " << net << "\n"; + } } } } @@ -203,18 +203,18 @@ get_cached_net_transition(NodeRelation *arc, Node *&root, template void get_cached_net_transition(const Node *node, - InputIterator arc_list_begin, - InputIterator arc_list_end, - UpdateSeq as_of, UpdateSeq now, - TransitionWrapper &result, - TypeHandle graph_type) { + InputIterator arc_list_begin, + InputIterator arc_list_end, + UpdateSeq as_of, UpdateSeq now, + TransitionWrapper &result, + TypeHandle graph_type) { if (node == NULL) { // the NULL node is by convention equivalent to the root. result.make_identity(); if (wrt_cat.is_debug()) { wrt_cat.debug() - << "get_cached_net_transition((top))\n"; + << "get_cached_net_transition((top))\n"; } return; } @@ -235,7 +235,7 @@ get_cached_net_transition(const Node *node, if (wrt_cat.is_debug()) { wrt_cat.debug() - << "get_cached_net_transition(" << *node << ") has no parents.\n"; + << "get_cached_net_transition(" << *node << ") has no parents.\n"; } return; @@ -244,10 +244,10 @@ get_cached_net_transition(const Node *node, // arc_list_begin .. arc_list_end. If any of the parents is // mentioned in the list, we must choose that parent. for (InputIterator ri = arc_list_begin; - parent_arc == (NodeRelation *)NULL && ri != arc_list_end; - ++ri) { + parent_arc == (NodeRelation *)NULL && ri != arc_list_end; + ++ri) { if ((*ri)->get_child() == node) { - parent_arc = (*ri); + parent_arc = (*ri); } } @@ -264,14 +264,14 @@ get_cached_net_transition(const Node *node, // Get the net transition leading into this node. Node *root; get_cached_net_transition((NodeRelation *)parent_arc, root, - as_of, now, result, graph_type); + as_of, now, result, graph_type); if (root != NULL) { // There's more to get. The above function call was forced to // stop at a node with multiple parents. TransitionWrapper more = TransitionWrapper::init_from(result); get_cached_net_transition(root, arc_list_begin, arc_list_end, - as_of, now, more, graph_type); + as_of, now, more, graph_type); more.compose_in_place(result); result = more; } @@ -298,15 +298,15 @@ get_cached_net_transition(const Node *node, template void get_uncached_net_transition(const Node *node, - InputIterator arc_list_begin, - InputIterator arc_list_end, - TransitionWrapper &result, - TypeHandle graph_type) { + InputIterator arc_list_begin, + InputIterator arc_list_end, + TransitionWrapper &result, + TypeHandle graph_type) { if (node == NULL) { // the NULL node is by convention equivalent to the root. if (wrt_cat.is_spam()) { wrt_cat.spam() - << "get_uncached_net_transition(top)" << *node; + << "get_uncached_net_transition(top)" << *node; } result.make_identity(); return; @@ -326,7 +326,7 @@ get_uncached_net_transition(const Node *node, // This node has no parents. Stop here. if (wrt_cat.is_spam()) { wrt_cat.spam() - << "get_uncached_net_transition(" << *node << ") has no parents.\n"; + << "get_uncached_net_transition(" << *node << ") has no parents.\n"; } result.make_identity(); return; @@ -336,10 +336,10 @@ get_uncached_net_transition(const Node *node, // arc_list_begin .. arc_list_end. If any of the parents is // mentioned in the list, we must choose that parent. for (InputIterator ri = arc_list_begin; - parent_arc == (NodeRelation *)NULL && ri != arc_list_end; - ++ri) { + parent_arc == (NodeRelation *)NULL && ri != arc_list_end; + ++ri) { if ((*ri)->get_child() == node) { - parent_arc = (*ri); + parent_arc = (*ri); } } @@ -354,9 +354,9 @@ get_uncached_net_transition(const Node *node, } get_uncached_net_transition(parent_arc->get_parent(), - arc_list_begin, arc_list_end, - result, - graph_type); + arc_list_begin, arc_list_end, + result, + graph_type); TransitionWrapper next = TransitionWrapper::init_from(result); next.extract_from(parent_arc); @@ -387,11 +387,11 @@ get_uncached_net_transition(const Node *node, template void cached_wrt_base(const Node *from, - InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, - const Node *to, - InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, - TransitionWrapper &result, - TypeHandle graph_type) { + InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, + const Node *to, + InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, + TransitionWrapper &result, + TypeHandle graph_type) { UpdateSeq now = last_graph_update(graph_type); TransitionWrapper net_from_trans = TransitionWrapper::init_from(result); @@ -415,9 +415,9 @@ cached_wrt_base(const Node *from, } get_cached_net_transition(from, from_arcs_begin, from_arcs_end, - now, now, net_from_trans, graph_type); + now, now, net_from_trans, graph_type); get_cached_net_transition(to, to_arcs_begin, to_arcs_end, - now, now, result, graph_type); + now, now, result, graph_type); #ifndef NDEBUG if (paranoid_wrt) { @@ -428,27 +428,27 @@ cached_wrt_base(const Node *from, TransitionWrapper check_to_trans = TransitionWrapper::init_from(result); get_uncached_net_transition(from, from_arcs_begin, from_arcs_end, - check_from_trans, graph_type); + check_from_trans, graph_type); if (check_from_trans.compare_to(net_from_trans) != 0) { wrt_cat.warning() - << "WRT cache from " << *from << " is invalid!\n" - << " cached value is:\n"; + << "WRT cache from " << *from << " is invalid!\n" + << " cached value is:\n"; net_from_trans.write(wrt_cat.warning(false), 4); wrt_cat.warning(false) - << " should be:\n"; + << " should be:\n"; check_from_trans.write(wrt_cat.warning(false), 4); net_from_trans = check_from_trans; } get_uncached_net_transition(to, to_arcs_begin, to_arcs_end, - check_to_trans, graph_type); + check_to_trans, graph_type); if (check_to_trans.compare_to(result) != 0) { wrt_cat.warning() - << "WRT cache to " << *to << " is invalid!\n" - << " cached value is:\n"; + << "WRT cache to " << *to << " is invalid!\n" + << " cached value is:\n"; result.write(wrt_cat.warning(false), 4); wrt_cat.warning(false) - << " should be:\n"; + << " should be:\n"; check_to_trans.write(wrt_cat.warning(false), 4); result = check_to_trans; } @@ -467,16 +467,16 @@ cached_wrt_base(const Node *from, template void uncached_wrt_base(const Node *from, - InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, - const Node *to, - InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, - TransitionWrapper &result, - TypeHandle graph_type) { + InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, + const Node *to, + InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, + TransitionWrapper &result, + TypeHandle graph_type) { TransitionWrapper net_from_trans = TransitionWrapper::init_from(result); get_uncached_net_transition(from, from_arcs_begin, from_arcs_end, - net_from_trans, graph_type); + net_from_trans, graph_type); get_uncached_net_transition(to, to_arcs_begin, to_arcs_end, - result, graph_type); + result, graph_type); result.invert_compose_in_place(net_from_trans); } #endif @@ -500,24 +500,24 @@ uncached_wrt_base(const Node *from, template INLINE_GRAPH void wrt_base(const Node *from, - InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, - const Node *to, - InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, - TransitionWrapper &result, - TypeHandle graph_type) { + InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, + const Node *to, + InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, + TransitionWrapper &result, + TypeHandle graph_type) { PStatTimer timer(_wrt_pcollector); #ifndef NDEBUG if (!cache_wrt) { uncached_wrt_base(from, from_arcs_begin, from_arcs_end, - to, to_arcs_begin, to_arcs_end, - result, graph_type); + to, to_arcs_begin, to_arcs_end, + result, graph_type); return; } #endif cached_wrt_base(from, from_arcs_begin, from_arcs_end, - to, to_arcs_begin, to_arcs_end, - result, graph_type); + to, to_arcs_begin, to_arcs_end, + result, graph_type); } template @@ -538,7 +538,7 @@ wrt(const Node *from, TransitionWrapper &result, TypeHandle graph_type) { const NodeRelation *arc = NULL; wrt_base(from, from_arcs_begin, from_arcs_end, to, &arc, &arc, - result, graph_type); + result, graph_type); } template @@ -549,7 +549,7 @@ wrt(const Node *from, TransitionWrapper &result, TypeHandle graph_type) { const NodeRelation *arc = NULL; wrt_base(from, &arc, &arc, to, to_arcs_begin, to_arcs_end, - result, graph_type); + result, graph_type); } template @@ -560,15 +560,15 @@ wrt(const Node *from, InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, TransitionWrapper &result, TypeHandle graph_type) { wrt_base(from, from_arcs_begin, from_arcs_end, - to, to_arcs_begin, to_arcs_end, - result, graph_type); + to, to_arcs_begin, to_arcs_end, + result, graph_type); } #ifndef NDEBUG template INLINE_GRAPH void uncached_wrt(const Node *from, const Node *to, - TransitionWrapper &result, TypeHandle graph_type) { + TransitionWrapper &result, TypeHandle graph_type) { const NodeRelation *arc = NULL; uncached_wrt_base(from, &arc, &arc, to, &arc, &arc, result, graph_type); } @@ -576,35 +576,35 @@ uncached_wrt(const Node *from, const Node *to, template INLINE_GRAPH void uncached_wrt(const Node *from, - InputIterator from_arcs_begin, InputIterator from_arcs_end, - const Node *to, - TransitionWrapper &result, TypeHandle graph_type) { + InputIterator from_arcs_begin, InputIterator from_arcs_end, + const Node *to, + TransitionWrapper &result, TypeHandle graph_type) { const NodeRelation *arc = NULL; uncached_wrt_base(from, from_arcs_begin, from_arcs_end, to, &arc, &arc, - result, graph_type); + result, graph_type); } template INLINE_GRAPH void uncached_wrt(const Node *from, - const Node *to, - InputIterator to_arcs_begin, InputIterator to_arcs_end, - TransitionWrapper &result, TypeHandle graph_type) { + const Node *to, + InputIterator to_arcs_begin, InputIterator to_arcs_end, + TransitionWrapper &result, TypeHandle graph_type) { const NodeRelation *arc = NULL; uncached_wrt_base(from, &arc, &arc, to, to_arcs_begin, to_arcs_end, - result, graph_type); + result, graph_type); } template INLINE_GRAPH void uncached_wrt(const Node *from, - InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, - const Node *to, - InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, - TransitionWrapper &result, TypeHandle graph_type) { + InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, + const Node *to, + InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, + TransitionWrapper &result, TypeHandle graph_type) { uncached_wrt_base(from, from_arcs_begin, from_arcs_end, - to, to_arcs_begin, to_arcs_end, - result, graph_type); + to, to_arcs_begin, to_arcs_end, + result, graph_type); } #endif @@ -612,7 +612,7 @@ uncached_wrt(const Node *from, template Node * get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, - TypeHandle graph_type) { + TypeHandle graph_type) { nassertr(node != (Node *)NULL, to); const UpRelationPointers &urp = node->find_connection(graph_type).get_up(); @@ -622,7 +622,7 @@ get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, // This node has no parents. Stop here. if (wrt_cat.is_spam()) { wrt_cat.spam() - << "get_uncached_wrt_subtree(" << *node << ") has no parents.\n"; + << "get_uncached_wrt_subtree(" << *node << ") has no parents.\n"; } result.make_identity(); return (Node *)NULL; @@ -632,8 +632,8 @@ get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, // There are multiple parents, so stop here. if (wrt_cat.is_spam()) { wrt_cat.spam() - << "get_uncached_wrt_subtree(" << *node << ") has " << num_parents - << " parents.\n"; + << "get_uncached_wrt_subtree(" << *node << ") has " << num_parents + << " parents.\n"; } result.make_identity(); return node; @@ -643,7 +643,7 @@ get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, // We've reached our stopping point. Stop here. if (wrt_cat.is_spam()) { wrt_cat.spam() - << "get_uncached_wrt_subtree(" << *node << ") is at stopping point.\n"; + << "get_uncached_wrt_subtree(" << *node << ") is at stopping point.\n"; } result.make_identity(); @@ -667,7 +667,7 @@ get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, Node *stop = get_uncached_wrt_subtree(parent_arc->get_parent(), to, - result, graph_type); + result, graph_type); TransitionWrapper next = TransitionWrapper::init_from(result); next.extract_from(parent_arc); @@ -693,10 +693,10 @@ get_uncached_wrt_subtree(Node *node, Node *to, TransitionWrapper &result, template INLINE_GRAPH Node * uncached_wrt_subtree(NodeRelation *arc, Node *to, - TransitionWrapper &result, TypeHandle graph_type) { + TransitionWrapper &result, TypeHandle graph_type) { Node *stop = get_uncached_wrt_subtree(arc->get_parent(), to, - result, graph_type); + result, graph_type); TransitionWrapper next = TransitionWrapper::init_from(result); next.extract_from(arc); @@ -724,7 +724,7 @@ uncached_wrt_subtree(NodeRelation *arc, Node *to, template Node * cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, - TransitionWrapper &result, TypeHandle graph_type) { + TransitionWrapper &result, TypeHandle graph_type) { // First, determine the net transition up to the top of the current // subtree. Node *top_subtree; @@ -736,11 +736,11 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, if (wrt_cat.is_spam()) { wrt_cat.spam() - << "cached_wrt_subtree(" << *arc << ", "; + << "cached_wrt_subtree(" << *arc << ", "; if (to == (Node *)NULL) { - wrt_cat.spam(false) << "(top)"; + wrt_cat.spam(false) << "(top)"; } else { - wrt_cat.spam(false) << *to; + wrt_cat.spam(false) << *to; } wrt_cat.spam(false) << ") stops at top, result is:\n"; result.write(wrt_cat.spam(false), 2); @@ -754,11 +754,11 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, if (wrt_cat.is_spam()) { wrt_cat.spam() - << "cached_wrt_subtree(" << *arc << ", " << *to << ") stops at "; + << "cached_wrt_subtree(" << *arc << ", " << *to << ") stops at "; if (top_subtree == (Node *)NULL) { - wrt_cat.spam(false) << "(top)"; + wrt_cat.spam(false) << "(top)"; } else { - wrt_cat.spam(false) << *top_subtree; + wrt_cat.spam(false) << *top_subtree; } wrt_cat.spam(false) << ", first result is:\n"; result.write(wrt_cat.spam(false), 2); @@ -773,13 +773,13 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, // This, of course, assumes we haven't just asked for the wrt() // from the very latest timestamp. if (wrt_cat.is_warning()) { - wrt_cat.warning() - << "Recovering from stale cache.\n"; + wrt_cat.warning() + << "Recovering from stale cache.\n"; } nassertr(as_of != UpdateSeq::fresh(), NULL); return cached_wrt_subtree(arc, to, UpdateSeq::fresh(), now, - result, graph_type); + result, graph_type); } nassertr(to->get_num_parents(graph_type) == 1, NULL); @@ -792,7 +792,7 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, // this arc. It had better be the same subtree! Node *top_subtree_2; get_cached_net_transition(to_arc, top_subtree_2, as_of, now, - result, graph_type); + result, graph_type); nassertr(top_subtree == top_subtree_2, NULL); // And now compute the actual wrt. @@ -800,11 +800,11 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, if (wrt_cat.is_spam()) { wrt_cat.spam() - << "cached_wrt_subtree(" << *arc << ", " << *to << ") stops at "; + << "cached_wrt_subtree(" << *arc << ", " << *to << ") stops at "; if (top_subtree == (Node *)NULL) { - wrt_cat.spam(false) << "(top)"; + wrt_cat.spam(false) << "(top)"; } else { - wrt_cat.spam(false) << *top_subtree; + wrt_cat.spam(false) << *top_subtree; } wrt_cat.spam() << ", second result is:\n"; net_from_trans.write(wrt_cat.spam(false), 2); @@ -823,26 +823,26 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, if (top_subtree_3 != top_subtree) { wrt_cat.warning() - << "WRT subtree cache from " << *arc->get_child() << " to "; + << "WRT subtree cache from " << *arc->get_child() << " to "; if (to == (Node *)NULL) { - wrt_cat.warning(false) << "(top)"; + wrt_cat.warning(false) << "(top)"; } else { - wrt_cat.warning(false) << *to; + wrt_cat.warning(false) << *to; } wrt_cat.warning(false) - << " computes incorrect top_subtree!\n" - << " computed "; + << " computes incorrect top_subtree!\n" + << " computed "; if (top_subtree == (Node *)NULL) { - wrt_cat.warning(false) << "(top)\n"; + wrt_cat.warning(false) << "(top)\n"; } else { - wrt_cat.warning(false) << *top_subtree << "\n"; + wrt_cat.warning(false) << *top_subtree << "\n"; } wrt_cat.warning(false) - << " should be "; + << " should be "; if (top_subtree_3 == (Node *)NULL) { - wrt_cat.warning(false) << "(top)\n"; + wrt_cat.warning(false) << "(top)\n"; } else { - wrt_cat.warning(false) << *top_subtree_3 << "\n"; + wrt_cat.warning(false) << *top_subtree_3 << "\n"; } top_subtree = top_subtree_3; } @@ -850,18 +850,18 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, int compare = check_trans.compare_to(result); if (compare != 0) { wrt_cat.warning() - << "WRT subtree cache from " << *arc->get_child() << " to "; + << "WRT subtree cache from " << *arc->get_child() << " to "; if (to == (Node *)NULL) { - wrt_cat.warning(false) << "(top)"; + wrt_cat.warning(false) << "(top)"; } else { - wrt_cat.warning(false) << *to; + wrt_cat.warning(false) << *to; } wrt_cat.warning(false) - << " is invalid!\n" - << " cached value is:\n"; + << " is invalid!\n" + << " cached value is:\n"; result.write(wrt_cat.warning(false), 4); wrt_cat.warning(false) - << " should be:\n"; + << " should be:\n"; check_trans.write(wrt_cat.warning(false), 4); result = check_trans; } @@ -874,7 +874,7 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, template INLINE_GRAPH Node * wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, - TransitionWrapper &result, TypeHandle graph_type) { + TransitionWrapper &result, TypeHandle graph_type) { PStatTimer timer(_wrt_subtree_pcollector); #ifndef NDEBUG diff --git a/panda/src/graph/wrt.h b/panda/src/graph/wrt.h index 83ea406ca6..c21c32c596 100644 --- a/panda/src/graph/wrt.h +++ b/panda/src/graph/wrt.h @@ -71,29 +71,29 @@ wrt(const Node *from, template INLINE_GRAPH void uncached_wrt(const Node *from, const Node *to, - TransitionWrapper &result, TypeHandle graph_type); + TransitionWrapper &result, TypeHandle graph_type); template INLINE_GRAPH void uncached_wrt(const Node *from, - InputIterator from_arcs_begin, InputIterator from_arcs_end, - const Node *to, - TransitionWrapper &result, TypeHandle graph_type); + InputIterator from_arcs_begin, InputIterator from_arcs_end, + const Node *to, + TransitionWrapper &result, TypeHandle graph_type); template INLINE_GRAPH void uncached_wrt(const Node *from, - const Node *to, - InputIterator to_arcs_begin, InputIterator to_arcs_end, - TransitionWrapper &result, TypeHandle graph_type); + const Node *to, + InputIterator to_arcs_begin, InputIterator to_arcs_end, + TransitionWrapper &result, TypeHandle graph_type); template INLINE_GRAPH void uncached_wrt(const Node *from, - InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, - const Node *to, - InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, - TransitionWrapper &result, TypeHandle graph_type); + InputIterator1 from_arcs_begin, InputIterator1 from_arcs_end, + const Node *to, + InputIterator2 to_arcs_begin, InputIterator2 to_arcs_end, + TransitionWrapper &result, TypeHandle graph_type); #endif @@ -127,7 +127,7 @@ uncached_wrt(const Node *from, template INLINE_GRAPH Node * wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now, - TransitionWrapper &result, TypeHandle graph_type); + TransitionWrapper &result, TypeHandle graph_type); // This is used to count the amount of time spend in calls to wrt(). extern EXPCL_PANDA PStatCollector _wrt_pcollector; diff --git a/panda/src/grutil/lineSegs.I b/panda/src/grutil/lineSegs.I index 406f6c6b88..79d1ce3f17 100644 --- a/panda/src/grutil/lineSegs.I +++ b/panda/src/grutil/lineSegs.I @@ -156,7 +156,7 @@ get_num_vertices() const { INLINE Vertexf LineSegs:: get_vertex(int vertex) const { nassertr(vertex >= 0 && vertex < (int)_created_verts.size(), - Vertexf(0.0, 0.0, 0.0)); + Vertexf(0.0, 0.0, 0.0)); return _created_verts[vertex]; } @@ -197,7 +197,7 @@ set_vertex(int vertex, float x, float y, float z) { INLINE Colorf LineSegs:: get_vertex_color(int vertex) const { nassertr(vertex >= 0 && vertex < (int)_created_colors.size(), - Colorf(0.0, 0.0, 0.0, 0.0)); + Colorf(0.0, 0.0, 0.0, 0.0)); return _created_colors[vertex]; } diff --git a/panda/src/grutil/lineSegs.cxx b/panda/src/grutil/lineSegs.cxx index d85efa13f5..1464aa4600 100644 --- a/panda/src/grutil/lineSegs.cxx +++ b/panda/src/grutil/lineSegs.cxx @@ -151,19 +151,19 @@ create(GeomNode *previous, bool) { const SegmentList &segs = (*ll); if (segs.size() < 2) { - point_index.push_back(v); + point_index.push_back(v); } else { - lengths.push_back(segs.size()); + lengths.push_back(segs.size()); } for (sl = segs.begin(); sl != segs.end(); sl++) { - if (segs.size() >= 2) { - line_index.push_back(v); - } - _created_verts.push_back((*sl)._point); - _created_colors.push_back((*sl)._color); - v++; - nassertr(v == (int)_created_verts.size(), previous); + if (segs.size() >= 2) { + line_index.push_back(v); + } + _created_verts.push_back((*sl)._point); + _created_colors.push_back((*sl)._color); + v++; + nassertr(v == (int)_created_verts.size(), previous); } } @@ -172,20 +172,20 @@ create(GeomNode *previous, bool) { // Create a new Geom and add the line segments. Geom *geom; if (line_index.size() <= 2) { - // Here's a special case: just one line segment. - GeomLine *geom_line = new GeomLine; - geom_line->set_num_prims(1); - geom_line->set_width(_thick); - geom = geom_line; - + // Here's a special case: just one line segment. + GeomLine *geom_line = new GeomLine; + geom_line->set_num_prims(1); + geom_line->set_width(_thick); + geom = geom_line; + } else { - // The more normal case: multiple line segments, connected - // end-to-end like a series of linestrips. - GeomLinestrip *geom_linestrip = new GeomLinestrip; - geom_linestrip->set_num_prims(lengths.size()); - geom_linestrip->set_lengths(lengths); - geom_linestrip->set_width(_thick); - geom = geom_linestrip; + // The more normal case: multiple line segments, connected + // end-to-end like a series of linestrips. + GeomLinestrip *geom_linestrip = new GeomLinestrip; + geom_linestrip->set_num_prims(lengths.size()); + geom_linestrip->set_lengths(lengths); + geom_linestrip->set_width(_thick); + geom = geom_linestrip; } geom->set_colors(_created_colors, G_PER_VERTEX, line_index); @@ -198,12 +198,12 @@ create(GeomNode *previous, bool) { if (point_index.size() > 0) { // Create a new Geom and add the points. GeomPoint *geom = new GeomPoint; - + geom->set_num_prims(point_index.size()); geom->set_size(_thick); geom->set_colors(_created_colors, G_PER_VERTEX, point_index); geom->set_coords(_created_verts, G_PER_VERTEX, point_index); - + previous->add_geom(geom); } diff --git a/panda/src/grutil/lineSegs.h b/panda/src/grutil/lineSegs.h index a71b4fe537..a1b715a0e2 100644 --- a/panda/src/grutil/lineSegs.h +++ b/panda/src/grutil/lineSegs.h @@ -18,7 +18,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LineSegs +// Class : LineSegs // Description : Encapsulates creation of a series of connected or // disconnected line segments or points, for drawing // paths or rays. This class doesn't attempt to be the diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index 9228d35c24..a43dc8f86d 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -71,7 +71,7 @@ class Projection; class ProjectionNode; //////////////////////////////////////////////////////////////////// -// Class : GraphicsStateGuardianBase +// Class : GraphicsStateGuardianBase // Description : This is a base class for the GraphicsStateGuardian // class, which is itself a base class for the various // GSG's for different platforms. This class contains @@ -115,10 +115,10 @@ public: virtual void copy_texture(TextureContext *tc, const DisplayRegion *dr)=0; virtual void copy_texture(TextureContext *tc, const DisplayRegion *dr, - const RenderBuffer &rb)=0; + const RenderBuffer &rb)=0; virtual void draw_texture(TextureContext *tc, const DisplayRegion *dr)=0; virtual void draw_texture(TextureContext *tc, const DisplayRegion *dr, - const RenderBuffer &rb)=0; + const RenderBuffer &rb)=0; virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb)=0; virtual void texture_to_pixel_buffer(TextureContext *tc, PixelBuffer *pb, @@ -126,12 +126,12 @@ public: virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr)=0; virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const RenderBuffer &rb)=0; + const RenderBuffer &rb)=0; virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const NodeAttributes& na=NodeAttributes())=0; + const NodeAttributes& na=NodeAttributes())=0; virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const RenderBuffer &rb, - const NodeAttributes& na=NodeAttributes())=0; + const RenderBuffer &rb, + const NodeAttributes& na=NodeAttributes())=0; virtual void apply_material(const Material *material)=0; virtual void apply_fog(Fog *fog)=0; @@ -177,7 +177,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "GraphicsStateGuardianBase", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/gsgmisc/geomIssuer.cxx b/panda/src/gsgmisc/geomIssuer.cxx index c7436d028e..93fc332858 100644 --- a/panda/src/gsgmisc/geomIssuer.cxx +++ b/panda/src/gsgmisc/geomIssuer.cxx @@ -60,11 +60,11 @@ GeomIssuer() { //////////////////////////////////////////////////////////////////// GeomIssuer:: GeomIssuer(const Geom *geom, - const GraphicsStateGuardianBase *gsg, - IssueVertex *vertex, - IssueNormal *normal, - IssueTexCoord *texcoord, - IssueColor *color) { + const GraphicsStateGuardianBase *gsg, + IssueVertex *vertex, + IssueNormal *normal, + IssueTexCoord *texcoord, + IssueColor *color) { memcpy(this, &noop_issuer, sizeof(GeomIssuer)); _geom = geom; _gsg = gsg; diff --git a/panda/src/gsgmisc/geomIssuer.h b/panda/src/gsgmisc/geomIssuer.h index a19738ecb0..071769c581 100644 --- a/panda/src/gsgmisc/geomIssuer.h +++ b/panda/src/gsgmisc/geomIssuer.h @@ -16,7 +16,7 @@ class GraphicsStateGuardianBase; //////////////////////////////////////////////////////////////////// -// Class : GeomIssuer +// Class : GeomIssuer // Description : This is a utility class used by the various // GraphicsStateGuardians to issue the vertex/normal/etc // commands to the rendering engine. Given a geom and a @@ -45,20 +45,20 @@ public: GeomIssuer(); GeomIssuer(const Geom *geom, - const GraphicsStateGuardianBase *gsg, - IssueVertex *vertex, - IssueNormal *normal, - IssueTexCoord *texcoord, - IssueColor *color); + const GraphicsStateGuardianBase *gsg, + IssueVertex *vertex, + IssueNormal *normal, + IssueTexCoord *texcoord, + IssueColor *color); INLINE void issue_vertex(GeomBindType bind, - Geom::VertexIterator &i); + Geom::VertexIterator &i); INLINE void issue_normal(GeomBindType bind, - Geom::NormalIterator &i); + Geom::NormalIterator &i); INLINE void issue_texcoord(GeomBindType bind, - Geom::TexCoordIterator &i); + Geom::TexCoordIterator &i); INLINE void issue_color(GeomBindType bind, - Geom::ColorIterator &i); + Geom::ColorIterator &i); protected: const Geom *_geom; diff --git a/panda/src/gui/guiBackground.cxx b/panda/src/gui/guiBackground.cxx index 0e6754770f..b6f32bd319 100644 --- a/panda/src/gui/guiBackground.cxx +++ b/panda/src/gui/guiBackground.cxx @@ -13,7 +13,7 @@ void GuiBackground::recompute_frame(void) { _bg->set_width(_item->get_width()); _bg->set_height(_item->get_height()); _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0., - (_item->get_bottom() + _item->get_top())*0.5)); + (_item->get_bottom() + _item->get_top())*0.5)); _bg->recompute(); GuiItem::recompute_frame(); this->adjust_region(); @@ -29,7 +29,7 @@ GuiBackground::GuiBackground(const string& name, GuiItem* item) _bg->set_width(_item->get_width()); _bg->set_height(_item->get_height()); _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0., - (_item->get_bottom() + _item->get_top())*0.5)); + (_item->get_bottom() + _item->get_top())*0.5)); item->set_priority(_bg, P_High); } @@ -39,7 +39,7 @@ GuiBackground::GuiBackground(const string& name, GuiItem* item, Texture* tex) _bg->set_width(_item->get_width()); _bg->set_height(_item->get_height()); _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0., - (_item->get_bottom() + _item->get_top())*0.5)); + (_item->get_bottom() + _item->get_top())*0.5)); item->set_priority(_bg, P_High); } @@ -48,7 +48,7 @@ GuiBackground::GuiBackground(const string& name, GuiItem* item, GuiLabel* l) _bg->set_width(_item->get_width()); _bg->set_height(_item->get_height()); _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0., - (_item->get_bottom() + _item->get_top())*0.5)); + (_item->get_bottom() + _item->get_top())*0.5)); item->set_priority(_bg, P_High); } @@ -63,7 +63,7 @@ void GuiBackground::manage(GuiManager* mgr, EventHandler& eh) { GuiItem::manage(mgr, eh); } else gui_cat->warning() << "tried to manage background (0x" << (void*)this - << ") thta is already managed" << endl; + << ") thta is already managed" << endl; } void GuiBackground::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -73,7 +73,7 @@ void GuiBackground::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiItem::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage background (0x" << (void*)this - << ") thta is already managed" << endl; + << ") thta is already managed" << endl; } void GuiBackground::unmanage(void) { diff --git a/panda/src/gui/guiBackground.h b/panda/src/gui/guiBackground.h index c34c8fd280..446dee9ac3 100644 --- a/panda/src/gui/guiBackground.h +++ b/panda/src/gui/guiBackground.h @@ -53,7 +53,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiBackground", - GuiItem::get_class_type()); + GuiItem::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiBehavior.cxx b/panda/src/gui/guiBehavior.cxx index f8ac3ce1a4..fd055610bb 100644 --- a/panda/src/gui/guiBehavior.cxx +++ b/panda/src/gui/guiBehavior.cxx @@ -18,7 +18,7 @@ void GuiBehavior::BehaviorFunctor::doit(GuiBehavior*) { } GuiBehavior::GuiBehavior(const string& name) : GuiItem(name), - _eh((EventHandler*)0L), + _eh((EventHandler*)0L), _behavior_running(false) { } diff --git a/panda/src/gui/guiBehavior.h b/panda/src/gui/guiBehavior.h index 2692b23162..b82317ecd0 100644 --- a/panda/src/gui/guiBehavior.h +++ b/panda/src/gui/guiBehavior.h @@ -29,7 +29,7 @@ PUBLISHED: static void init_type(void) { TypedReferenceCount::init_type(); register_type(_type_handle, "GuiBehavior::BehaviorFunctor", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -62,7 +62,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiBehavior", - GuiItem::get_class_type()); + GuiItem::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiButton.I b/panda/src/gui/guiButton.I index 6d52ac840a..9226cbd913 100644 --- a/panda/src/gui/guiButton.I +++ b/panda/src/gui/guiButton.I @@ -58,7 +58,7 @@ INLINE void GuiButton::up(void) { break; default: gui_cat->warning() << "got up from invalid state (" << (int)_state << ")," - << " button '" << this->get_name() << "'" << endl; + << " button '" << this->get_name() << "'" << endl; } } @@ -78,7 +78,7 @@ INLINE void GuiButton::down(void) { break; default: gui_cat->warning() << "got down from invalid state (" << (int)_state - << "), button '" << this->get_name() << "'" << endl; + << "), button '" << this->get_name() << "'" << endl; } } @@ -98,7 +98,7 @@ INLINE void GuiButton::inactive(void) { break; default: gui_cat->warning() << "got inactive from invalid state (" << (int)_state - << "), button '" << this->get_name() << "'" << endl; + << "), button '" << this->get_name() << "'" << endl; } this->stop_behavior(); } @@ -119,7 +119,7 @@ INLINE void GuiButton::click(void) { break; default: gui_cat->warning() << "got click from invalid state (" << (int)_state - << "), button '" << this->get_name() << "'" << endl; + << "), button '" << this->get_name() << "'" << endl; } } diff --git a/panda/src/gui/guiButton.h b/panda/src/gui/guiButton.h index 1e44747a4d..2fe7a020b7 100644 --- a/panda/src/gui/guiButton.h +++ b/panda/src/gui/guiButton.h @@ -30,7 +30,7 @@ private: float _inactive_scale; enum States { NONE, UP, UP_ROLLOVER, DOWN, DOWN_ROLLOVER, INACTIVE, - INACTIVE_ROLLOVER }; + INACTIVE_ROLLOVER }; States _state; string _behavior_event; @@ -52,7 +52,7 @@ PUBLISHED: GuiButton(const string&, GuiLabel*, GuiLabel*); GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*); GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*, GuiLabel*, - GuiLabel*); + GuiLabel*); virtual ~GuiButton(void); public: @@ -137,7 +137,7 @@ public: static void init_type(void) { GuiBehavior::init_type(); register_type(_type_handle, "GuiButton", - GuiBehavior::get_class_type()); + GuiBehavior::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiChooser.cxx b/panda/src/gui/guiChooser.cxx index b48e0b3256..545684dc1a 100644 --- a/panda/src/gui/guiChooser.cxx +++ b/panda/src/gui/guiChooser.cxx @@ -9,7 +9,7 @@ TypeHandle GuiChooser::_type_handle; TypeHandle GuiChooser::ChooseFunctor::_type_handle; GuiChooser::ChooseFunctor::ChooseFunctor(GuiChooser* ch, - GuiBehavior::BehaviorFunctor* func) + GuiBehavior::BehaviorFunctor* func) : GuiBehavior::BehaviorFunctor(), _prev(func), _ch(ch) { } @@ -195,10 +195,10 @@ void GuiChooser::manage(GuiManager* mgr, EventHandler& eh) { if (_curr != -1) { _items[_curr]->manage(mgr, eh); if (_curr == 0) - _prev_button->inactive(); + _prev_button->inactive(); int foo = _items.size() - 1; if (_curr == foo) - _next_button->inactive(); + _next_button->inactive(); } else { _prev_button->inactive(); _next_button->inactive(); @@ -206,7 +206,7 @@ void GuiChooser::manage(GuiManager* mgr, EventHandler& eh) { GuiBehavior::manage(mgr, eh); } else gui_cat->warning() << "tried to manage chooser (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiChooser::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -216,10 +216,10 @@ void GuiChooser::manage(GuiManager* mgr, EventHandler& eh, Node* n) { if (_curr != -1) { _items[_curr]->manage(mgr, eh, n); if (_curr == 0) - _prev_button->inactive(); + _prev_button->inactive(); int foo = _items.size() - 1; if (_curr == foo) - _next_button->inactive(); + _next_button->inactive(); } else { _prev_button->inactive(); _next_button->inactive(); @@ -227,7 +227,7 @@ void GuiChooser::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiBehavior::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage chooser (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiChooser::unmanage(void) { diff --git a/panda/src/gui/guiChooser.h b/panda/src/gui/guiChooser.h index b10356b372..a385f41080 100644 --- a/panda/src/gui/guiChooser.h +++ b/panda/src/gui/guiChooser.h @@ -34,7 +34,7 @@ private: static void init_type(void) { GuiBehavior::BehaviorFunctor::init_type(); register_type(_type_handle, "ChooseFunctor", - GuiBehavior::BehaviorFunctor::get_class_type()); + GuiBehavior::BehaviorFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -103,7 +103,7 @@ public: static void init_type(void) { GuiBehavior::init_type(); register_type(_type_handle, "GuiChooser", - GuiBehavior::get_class_type()); + GuiBehavior::get_class_type()); ChooseFunctor::init_type(); } virtual TypeHandle get_type(void) const { diff --git a/panda/src/gui/guiCollection.cxx b/panda/src/gui/guiCollection.cxx index a700654e1f..6f29af52b6 100644 --- a/panda/src/gui/guiCollection.cxx +++ b/panda/src/gui/guiCollection.cxx @@ -80,7 +80,7 @@ void GuiCollection::manage(GuiManager* mgr, EventHandler& eh) { GuiItem::manage(mgr, eh); } else gui_cat->warning() << "tried to manage collection (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiCollection::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -90,7 +90,7 @@ void GuiCollection::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiItem::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage collection (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiCollection::unmanage(void) { @@ -109,8 +109,8 @@ void GuiCollection::set_scale(float f) { void GuiCollection::set_scale(float x, float y, float z) { for (Items::iterator i=_items.begin(); i!=_items.end(); ++i) (*i)->set_scale(x * (*i)->get_scale_x(), - y * (*i)->get_scale_y(), - z * (*i)->get_scale_z()); + y * (*i)->get_scale_y(), + z * (*i)->get_scale_z()); GuiItem::set_scale(x, y, z); this->recompute_frame(); } diff --git a/panda/src/gui/guiCollection.h b/panda/src/gui/guiCollection.h index 786cc7eacb..3a0b906a08 100644 --- a/panda/src/gui/guiCollection.h +++ b/panda/src/gui/guiCollection.h @@ -49,7 +49,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiCollection", - GuiItem::get_class_type()); + GuiItem::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiFrame.cxx b/panda/src/gui/guiFrame.cxx index c99e95b627..c377319d05 100644 --- a/panda/src/gui/guiFrame.cxx +++ b/panda/src/gui/guiFrame.cxx @@ -78,97 +78,97 @@ void GuiFrame::recompute_frame(void) { LVector4f ext_h = (*ui).second.get_frame(); LVector3f pos_h = (*ui).second.get_pos(); for (int j=0; jwarning() << "unknown packing type (" << (int)pack << ")" - << endl; - } + Packing pack = (*i).get_nth_packing(j); + if (pack == NONE) + continue; + GuiItem* to = (*i).get_nth_to(j); + LVector4f ext_t = _map[to].get_frame(); + float gap = (*i).get_nth_gap(j); + switch (pack) { + case ABOVE: + { + // to(top) - here(bottom) + float diff = ext_t[3] - ext_h[2] + gap; + LVector3f move = LVector3f::rfu(0., 0., diff); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case UNDER: + { + // to(bottom) - here(top) + float diff = ext_t[2] - ext_h[3] - gap; + LVector3f move = LVector3f::rfu(0., 0., diff); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case LEFT: + { + // to(left) - here(right) + float diff = ext_t[0] - ext_h[1] - gap; + LVector3f move = LVector3f::rfu(diff, 0., 0.); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case RIGHT: + { + // to(right) - here(left) + float diff = ext_t[1] - ext_h[0] + gap; + LVector3f move = LVector3f::rfu(diff, 0., 0.); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case ALIGN_ABOVE: + { + // to(top) - here(top) + float diff = ext_t[3] - ext_h[3]; + LVector3f move = LVector3f::rfu(0., 0., diff); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case ALIGN_UNDER: + { + // to(bottom) - here(bottom) + float diff = ext_t[2] - ext_h[2]; + LVector3f move = LVector3f::rfu(0., 0., diff); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case ALIGN_LEFT: + { + // to(left) - here(left) + float diff = ext_t[0] - ext_h[0]; + LVector3f move = LVector3f::rfu(diff, 0., 0.); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + case ALIGN_RIGHT: + { + // to(right) - here(right) + float diff = ext_t[1] - ext_h[1]; + LVector3f move = LVector3f::rfu(diff, 0., 0.); + (*ui).second.set_pos(pos_h + move); + ext_h = (*ui).second.get_frame(); + pos_h = (*ui).second.get_pos(); + } + break; + default: + gui_cat->warning() << "unknown packing type (" << (int)pack << ")" + << endl; + } } } } @@ -268,9 +268,9 @@ void GuiFrame::set_priority(GuiLabel* l, const GuiItem::Priority p) { } GuiFrame::GuiFrame(const string& name) : GuiItem(name), _align_to_left(false), - _align_to_right(false), - _align_to_top(false), - _align_to_bottom(false) { + _align_to_right(false), + _align_to_top(false), + _align_to_bottom(false) { } GuiFrame::~GuiFrame(void) { @@ -327,11 +327,11 @@ void GuiFrame::remove_item(GuiItem* item) { do { done = true; for (int k=0; k<(*j).get_num_links(); ++k) - if ((*j).get_nth_to(k) == item) { - done = false; - (*j).erase_nth_link(k); - break; - } + if ((*j).get_nth_to(k) == item) { + done = false; + (*j).erase_nth_link(k); + break; + } } while (!done); } // now get rid of the thing itself @@ -374,7 +374,7 @@ void GuiFrame::manage(GuiManager* mgr, EventHandler& eh) { GuiItem::manage(mgr, eh); } else gui_cat->warning() << "tried to manage frame (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiFrame::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -384,7 +384,7 @@ void GuiFrame::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiItem::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage frame (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiFrame::unmanage(void) { @@ -403,8 +403,8 @@ void GuiFrame::set_scale(float f) { void GuiFrame::set_scale(float x, float y, float z) { for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i) (*i).get_item()->set_scale(x * (*i).get_item()->get_scale_x(), - y * (*i).get_item()->get_scale_y(), - z * (*i).get_item()->get_scale_z()); + y * (*i).get_item()->get_scale_y(), + z * (*i).get_item()->get_scale_z()); GuiItem::set_scale(x, y, z); } @@ -445,8 +445,8 @@ void GuiFrame::output(ostream& os) const { int n = (*i).get_num_links(); if (n > 0) { for (int j=0; jget_scale()) {} inline Box(const Box& c) : _thing(c._thing), _scale(c._scale), - _links(c._links) {} + _links(c._links) {} ~Box(void) {} inline void set_item(GuiItem* i) { _thing = i; } @@ -135,7 +135,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiFrame", - GuiItem::get_class_type()); + GuiItem::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiItem.I b/panda/src/gui/guiItem.I index bfb09e38f8..ba5699a202 100644 --- a/panda/src/gui/guiItem.I +++ b/panda/src/gui/guiItem.I @@ -4,9 +4,9 @@ //////////////////////////////////////////////////////////////////// INLINE GuiItem::GuiItem(void) : Namable("fubar"), _scale(1.), _scale_x(1.), - _scale_y(1.), _scale_z(1.), _left(-1.), - _right(1.), _bottom(-1.), _top(1.), - _pri(P_Normal) {} + _scale_y(1.), _scale_z(1.), _left(-1.), + _right(1.), _bottom(-1.), _top(1.), + _pri(P_Normal) {} #include diff --git a/panda/src/gui/guiItem.h b/panda/src/gui/guiItem.h index 68a1a0da0a..b737287c09 100644 --- a/panda/src/gui/guiItem.h +++ b/panda/src/gui/guiItem.h @@ -71,7 +71,7 @@ public: static void init_type(void) { TypedReferenceCount::init_type(); register_type(_type_handle, "GuiItem", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiLabel.I b/panda/src/gui/guiLabel.I index c7dba52879..6d47dcf36d 100644 --- a/panda/src/gui/guiLabel.I +++ b/panda/src/gui/guiLabel.I @@ -4,23 +4,23 @@ //////////////////////////////////////////////////////////////////// INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE), - _arc((RenderRelation*)0L), - _tex((Texture*)0L), - _internal((RenderRelation*)0L), - _gset((Geom*)0L), _model_width(1.), - _model_height(1.), _scale(1.), - _scale_x(1.), _scale_y(1.), _scale_z(1.), - _pos(0., 0., 0.), - _model_pos(0., 0., 0.), - _have_foreground(false), - _foreground(1., 1., 1., 1.), - _have_background(false), - _background(0., 0., 0., 0.), - _have_width(false), _width(0.), - _have_height(false), _height(0.), - _mirror_x(false), _mirror_y(false), - _hard_pri(0), _highest_pri(false), - _lowest_pri(false), _has_hard_pri(false) { + _arc((RenderRelation*)0L), + _tex((Texture*)0L), + _internal((RenderRelation*)0L), + _gset((Geom*)0L), _model_width(1.), + _model_height(1.), _scale(1.), + _scale_x(1.), _scale_y(1.), _scale_z(1.), + _pos(0., 0., 0.), + _model_pos(0., 0., 0.), + _have_foreground(false), + _foreground(1., 1., 1., 1.), + _have_background(false), + _background(0., 0., 0., 0.), + _have_width(false), _width(0.), + _have_height(false), _height(0.), + _mirror_x(false), _mirror_y(false), + _hard_pri(0), _highest_pri(false), + _lowest_pri(false), _has_hard_pri(false) { } INLINE Node* GuiLabel::get_geometry(void) const { @@ -109,13 +109,13 @@ INLINE LVector3f GuiLabel::get_pos(void) const { } INLINE void GuiLabel::set_foreground_color(float r, float g, float b, - float a) { + float a) { this->_have_foreground = true; this->set_foreground_color(Colorf(r, g, b, a)); } INLINE void GuiLabel::set_background_color(float r, float g, float b, - float a) { + float a) { this->set_background_color(Colorf(r, g, b, a)); } diff --git a/panda/src/gui/guiLabel.h b/panda/src/gui/guiLabel.h index 8dfd1a8da2..12e7f5aa28 100644 --- a/panda/src/gui/guiLabel.h +++ b/panda/src/gui/guiLabel.h @@ -72,7 +72,7 @@ PUBLISHED: static GuiLabel* make_simple_texture_label(Texture*); static GuiLabel* make_simple_text_label(const string&, TextFont*, - Texture* = (Texture*)0L); + Texture* = (Texture*)0L); static GuiLabel* make_simple_card_label(void); static GuiLabel* make_null_label(void); static GuiLabel* make_model_label(Node*, float, float); @@ -134,7 +134,7 @@ public: static void init_type(void) { TypedReferenceCount::init_type(); register_type(_type_handle, "GuiLabel", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiListBox.cxx b/panda/src/gui/guiListBox.cxx index 5d2d949d80..31aa0307c1 100644 --- a/panda/src/gui/guiListBox.cxx +++ b/panda/src/gui/guiListBox.cxx @@ -9,7 +9,7 @@ TypeHandle GuiListBox::_type_handle; TypeHandle GuiListBox::ListFunctor::_type_handle; GuiListBox::ListFunctor::ListFunctor(GuiListBox* box, - GuiBehavior::BehaviorFunctor* func) + GuiBehavior::BehaviorFunctor* func) : GuiBehavior::BehaviorFunctor(), _prev(func), _lb(box) { } @@ -50,7 +50,7 @@ void GuiListBox::recompute_frame(void) { int lvl = (*i)->thaw(); #ifdef _DEBUG gui_cat->debug() << "in recompute: freeze lvl (" << (*i)->get_name() - << ") = " << lvl << endl; + << ") = " << lvl << endl; #endif } _left = lft; @@ -102,13 +102,13 @@ void GuiListBox::set_priority(GuiLabel* l, const GuiItem::Priority p) { } GuiListBox::GuiListBox(const string& name, int N, GuiButton* up, - GuiButton* down) + GuiButton* down) : GuiBehavior(name), _up_arrow(up), _down_arrow(down), _n_visible(N), _up_functor((GuiListBox::ListFunctor*)0L), _down_functor((GuiListBox::ListFunctor*)0L) { if (N < 4) { gui_cat->warning() << "ListBoxes should have at least 4 visible slots" - << endl; + << endl; _n_visible = 4; } } @@ -182,10 +182,10 @@ void GuiListBox::add_item(GuiItem* item) { if (_visible.size() < _n_visible) { _visible.push_back(item); if (_mgr != (GuiManager*)0L) { - if (_alt_root.is_null()) - item->manage(_mgr, *_eh); - else - item->manage(_mgr, *_eh, _alt_root); + if (_alt_root.is_null()) + item->manage(_mgr, *_eh); + else + item->manage(_mgr, *_eh, _alt_root); } } else _bottom_stack.push_back(item); @@ -250,7 +250,7 @@ void GuiListBox::manage(GuiManager* mgr, EventHandler& eh) { GuiBehavior::manage(mgr, eh); } else gui_cat->warning() << "tried to manage listbox (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiListBox::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -264,7 +264,7 @@ void GuiListBox::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiBehavior::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage listbox (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiListBox::unmanage(void) { diff --git a/panda/src/gui/guiListBox.h b/panda/src/gui/guiListBox.h index f55e56d970..d21acb1fcb 100644 --- a/panda/src/gui/guiListBox.h +++ b/panda/src/gui/guiListBox.h @@ -34,7 +34,7 @@ private: static void init_type(void) { GuiBehavior::BehaviorFunctor::init_type(); register_type(_type_handle, "ListFunctor", - GuiBehavior::BehaviorFunctor::get_class_type()); + GuiBehavior::BehaviorFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -98,7 +98,7 @@ public: static void init_type(void) { GuiBehavior::init_type(); register_type(_type_handle, "GuiListBox", - GuiBehavior::get_class_type()); + GuiBehavior::get_class_type()); ListFunctor::init_type(); } virtual TypeHandle get_type(void) const { diff --git a/panda/src/gui/guiManager.I b/panda/src/gui/guiManager.I index 3203df2515..43c7b7be09 100644 --- a/panda/src/gui/guiManager.I +++ b/panda/src/gui/guiManager.I @@ -16,8 +16,8 @@ INLINE void GuiManager::set_next_draw_order(int v) { #ifndef NDEBUG if (v < _next_draw_order) gui_cat->warning() << "GuiManager::set_next_draw_order(" << v - << ") is < existing (" << _next_draw_order << ")" - << endl; + << ") is < existing (" << _next_draw_order << ")" + << endl; #endif /* NDEBUG */ this->_next_draw_order = v; } diff --git a/panda/src/gui/guiRollover.cxx b/panda/src/gui/guiRollover.cxx index 7542b89eb0..32c4131520 100644 --- a/panda/src/gui/guiRollover.cxx +++ b/panda/src/gui/guiRollover.cxx @@ -23,7 +23,7 @@ find_in_rollovers_map(const MouseWatcherRegion* rgn) { } inline void GetExtents(GuiLabel* x, GuiLabel* y, float& l, float& r, float& b, - float& t) { + float& t) { float l1, l2, r1, r2, b1, b2, t1, t2; x->get_extents(l1, r1, b1, t1); y->get_extents(l2, r2, b2, t2); @@ -73,7 +73,7 @@ GuiRollover::GuiRollover(const string& name, GuiLabel* off, GuiLabel* on) _on_scale(on->get_scale()), _state(false) { GetExtents(off, on, _left, _right, _bottom, _top); _rgn = new MouseWatcherRegion("rollover-" + name, _left, _right, _bottom, - _top); + _top); _rgn->set_suppress_below(false); rollovers[this->_rgn.p()] = this; } @@ -107,7 +107,7 @@ void GuiRollover::manage(GuiManager* mgr, EventHandler& eh) { GuiBehavior::manage(mgr, eh); } else gui_cat->warning() << "tried to manage rollover (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiRollover::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -123,7 +123,7 @@ void GuiRollover::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiBehavior::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage rollover (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiRollover::unmanage(void) { diff --git a/panda/src/gui/guiRollover.h b/panda/src/gui/guiRollover.h index 8494f55897..51374c928f 100644 --- a/panda/src/gui/guiRollover.h +++ b/panda/src/gui/guiRollover.h @@ -68,7 +68,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiRollover", - GuiBehavior::get_class_type()); + GuiBehavior::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/gui/guiSign.cxx b/panda/src/gui/guiSign.cxx index 7feba956ec..c8037297de 100644 --- a/panda/src/gui/guiSign.cxx +++ b/panda/src/gui/guiSign.cxx @@ -35,7 +35,7 @@ void GuiSign::manage(GuiManager* mgr, EventHandler& eh) { GuiItem::manage(mgr, eh); } else gui_cat->warning() << "tried to manage sign (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiSign::manage(GuiManager* mgr, EventHandler& eh, Node* n) { @@ -44,7 +44,7 @@ void GuiSign::manage(GuiManager* mgr, EventHandler& eh, Node* n) { GuiItem::manage(mgr, eh, n); } else gui_cat->warning() << "tried to manage sign (0x" << (void*)this - << ") that is already managed" << endl; + << ") that is already managed" << endl; } void GuiSign::unmanage(void) { diff --git a/panda/src/gui/guiSign.h b/panda/src/gui/guiSign.h index af9fc70e17..09ff85afde 100644 --- a/panda/src/gui/guiSign.h +++ b/panda/src/gui/guiSign.h @@ -47,7 +47,7 @@ public: static void init_type(void) { GuiItem::init_type(); register_type(_type_handle, "GuiSign", - GuiItem::get_class_type()); + GuiItem::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/ipc/ipc_condition.h b/panda/src/ipc/ipc_condition.h index e0a00cb5fc..b3b602da6f 100644 --- a/panda/src/ipc/ipc_condition.h +++ b/panda/src/ipc/ipc_condition.h @@ -19,12 +19,12 @@ class EXPCL_PANDAEXPRESS base_condition_variable { static base_condition_variable* const Null; INLINE base_condition_variable(mutex& m) : _mutex(m), - _condition(traits::make_condition(m.get_mutex())) {} + _condition(traits::make_condition(m.get_mutex())) {} INLINE ~base_condition_variable(void) { delete _condition; } INLINE void wait(void) { _condition->wait(); } INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs = 0) { - return _condition->timedwait(secs, nsecs); + const unsigned long nsecs = 0) { + return _condition->timedwait(secs, nsecs); } INLINE void signal(void) { _condition->signal(); } INLINE void broadcast(void) { _condition->broadcast(); } diff --git a/panda/src/ipc/ipc_mach_traits.h b/panda/src/ipc/ipc_mach_traits.h index 11a7f74bdb..63345f040f 100644 --- a/panda/src/ipc/ipc_mach_traits.h +++ b/panda/src/ipc/ipc_mach_traits.h @@ -22,258 +22,258 @@ class EXPCL_PANDAEXPRESS ipc_traits { class library_class; class mutex_class { private: - struct mutex _mutex; + struct mutex _mutex; public: - // interface to mutex - static const mutex_class* Null; - INLINE mutex_class(void) { mutex_init(&_mutex); } - INLINE ~mutex_class(void) { mutex_clear(&_mutex); } - INLINE void lock(void) { mutex_lock(&_mutex); } - INLINE void unlock(void) { mutex_unlock(&_mutex); } - INLINE struct mutex* get_mutex(void) { return &_mutex; } + // interface to mutex + static const mutex_class* Null; + INLINE mutex_class(void) { mutex_init(&_mutex); } + INLINE ~mutex_class(void) { mutex_clear(&_mutex); } + INLINE void lock(void) { mutex_lock(&_mutex); } + INLINE void unlock(void) { mutex_unlock(&_mutex); } + INLINE struct mutex* get_mutex(void) { return &_mutex; } }; class condition_class { private: - struct condition _condition; - mutex_class *_mutex; - typedef struct alarmclock_args { - unsigned long secs; - unsigned long nsecs; - bool wakeup; - condition_class* condition; - mutex_class* mutex; - }; - INLINE any_t alarmclock(any_t arg) { - alarmclock_args* alarm = (alarmclock_args*)arg; - thread_ipc_traits::sleep(alarm->secs, alarm->nsecs); - alarm->mutex->lock(); - alarm->wakeup = TRUE; - alarm->condition->signal(); - alarm->mutex->unlock(); - return (any_t)TRUE; - } + struct condition _condition; + mutex_class *_mutex; + typedef struct alarmclock_args { + unsigned long secs; + unsigned long nsecs; + bool wakeup; + condition_class* condition; + mutex_class* mutex; + }; + INLINE any_t alarmclock(any_t arg) { + alarmclock_args* alarm = (alarmclock_args*)arg; + thread_ipc_traits::sleep(alarm->secs, alarm->nsecs); + alarm->mutex->lock(); + alarm->wakeup = TRUE; + alarm->condition->signal(); + alarm->mutex->unlock(); + return (any_t)TRUE; + } public: - // interface to condition variables - static const condition_class* Null; - INLINE condition_class(mutex_class* m) : _mutex(m) { - condition_init(&_condition); - } - INLINE ~condition_class(void) { condition_clear(&_condition); } - INLINE void wait(void) { - condition_wait(&_condition, _mutex->get_mutex()); - } - INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs) { - alarmclock_args alarm; + // interface to condition variables + static const condition_class* Null; + INLINE condition_class(mutex_class* m) : _mutex(m) { + condition_init(&_condition); + } + INLINE ~condition_class(void) { condition_clear(&_condition); } + INLINE void wait(void) { + condition_wait(&_condition, _mutex->get_mutex()); + } + INLINE int timedwait(const unsigned long secs, + const unsigned long nsecs) { + alarmclock_args alarm; - thread_ipc_traits::get_time(&alarm.secs, &alarm.nsecs, 0, 0); - if (secs < alarm.secs || (secs == alarm.secs && - nsecs <= alarm.nsecs)) - return ETIMEDOUT; - alarm.secs = secs - alarm.secs; - if (nsecs <= alarm.nsecs) { - alarm.nsecs = 1000000 - alarm.nsecs + nsecs; - --alarm.secs; - } else - alarm.nsecs = nsecs - alarm.nsecs; - alarm.mutex = _mutex; - alarm.condition = this; - alarm.wakeup = FALSE; - cthread_t ct = cthread_fork((cthread_fn_t)alarmclock, - (any_t)&alarm); - cthread_detach(ct); + thread_ipc_traits::get_time(&alarm.secs, &alarm.nsecs, 0, 0); + if (secs < alarm.secs || (secs == alarm.secs && + nsecs <= alarm.nsecs)) + return ETIMEDOUT; + alarm.secs = secs - alarm.secs; + if (nsecs <= alarm.nsecs) { + alarm.nsecs = 1000000 - alarm.nsecs + nsecs; + --alarm.secs; + } else + alarm.nsecs = nsecs - alarm.nsecs; + alarm.mutex = _mutex; + alarm.condition = this; + alarm.wakeup = FALSE; + cthread_t ct = cthread_fork((cthread_fn_t)alarmclock, + (any_t)&alarm); + cthread_detach(ct); - condition_wait(&_condition, _mutex->get_mutex()); + condition_wait(&_condition, _mutex->get_mutex()); - if (alarm.wakeup) - return 0; + if (alarm.wakeup) + return 0; - // interrupt the alarmclock thread sleep - cthread_abort(ct); + // interrupt the alarmclock thread sleep + cthread_abort(ct); - // wait until it has signalled the condition - condition_wait(&_condition, _mutex->get_mutex()); - return 1; - } - INLINE void signal(void) { condition_signal(&_condition); } - INLINE void broadcast(void) { condition_signal(&_condition); } + // wait until it has signalled the condition + condition_wait(&_condition, _mutex->get_mutex()); + return 1; + } + INLINE void signal(void) { condition_signal(&_condition); } + INLINE void broadcast(void) { condition_signal(&_condition); } }; class semaphore_class { private: - mutex_class _mutex; - condition_class _condition; - int _value; + mutex_class _mutex; + condition_class _condition; + int _value; public: - // interface to semaphores - static const semaphore_class* Null; - INLINE semaphore_class(const unsigned int initial) : _mutex(), - _condition(&_mutex), _value(initial) {} - INLINE ~semaphore_class(void) {} - INLINE void wait(void) { - _mutex->lock(); - while (_value == 0) - _condition.wait(&_mutex); - --_value; - _mutex->unlock(); - } - INLINE int trywait(void) { - _mutex->lock(); - if (_value == 0) { - _mutex->unlock(); - return 0; - } - --_value; - _mutex->unlock(); - return 1; - } - INLINE void post(void) { - _mutex->lock(); - if (_value == 0) - _condition.signal(); - ++_value; - _mutex->unlock(); - } + // interface to semaphores + static const semaphore_class* Null; + INLINE semaphore_class(const unsigned int initial) : _mutex(), + _condition(&_mutex), _value(initial) {} + INLINE ~semaphore_class(void) {} + INLINE void wait(void) { + _mutex->lock(); + while (_value == 0) + _condition.wait(&_mutex); + --_value; + _mutex->unlock(); + } + INLINE int trywait(void) { + _mutex->lock(); + if (_value == 0) { + _mutex->unlock(); + return 0; + } + --_value; + _mutex->unlock(); + return 1; + } + INLINE void post(void) { + _mutex->lock(); + if (_value == 0) + _condition.signal(); + ++_value; + _mutex->unlock(); + } }; class thread_class { private: - chread_d _thread; - void* _b_ptr; // a handle to hang a pointer back to the high-level - // thread class on. Gross, but I couldn't think of - // a better way to do this reverse lookup. - void* (*_fn)(void*); - INLINE int priority_map(const int pri) { - switch (pri) { - case 0: - return 0; - case 1: - return normal_priority; - case 2: - return high_priority; - default: - return -1; - } - } - static void* thread_wrapper(void*); + chread_d _thread; + void* _b_ptr; // a handle to hang a pointer back to the high-level + // thread class on. Gross, but I couldn't think of + // a better way to do this reverse lookup. + void* (*_fn)(void*); + INLINE int priority_map(const int pri) { + switch (pri) { + case 0: + return 0; + case 1: + return normal_priority; + case 2: + return high_priority; + default: + return -1; + } + } + static void* thread_wrapper(void*); public: - // interface to threads - static const thread_class* Null; - INLINE thread_class(void* data) : _b_ptr(data) {} - INLINE ~thread_class(void) {} - INLINE void manual_init(void) { - _thread = cthread_self(); - } - INLINE void start_pre(void* (*fn)(void*), const bool, const int) { - _fn = fn; - _thread = cthread_fork(thread_wrapper, (any_t)this); - } - INLINE void start_in(void) { - cthread_set_data(cthread_self(), (any_t)this); - } - INLINE void start_post(const bool det, const int) { - if (det) - cthread_detach(_thread); - } - INLINE void join(void** status) { - *status = cthread_join(_thread); - } - INLINE void set_priority(const int pri) { - kern_return_t rc = cthread_priority(_thread, priority_map(pri), - FALSE); - if (rc != KERN_SUCCESS) - throw thread_fatal(errno); - } - INLINE void* back_ptr(void) { return _b_ptr; } - static INLINE void exit(void* return_value) { - cthread_exit(return_value); - } - static INLINE thread_class* self(void) { - thread_class* me = (thread_class*)cthread_data(cthread_self()); - // if (me == thread_class::Null) not one of ours - return me; - } - static INLINE void yield(void) { - cthread_yield(); - } + // interface to threads + static const thread_class* Null; + INLINE thread_class(void* data) : _b_ptr(data) {} + INLINE ~thread_class(void) {} + INLINE void manual_init(void) { + _thread = cthread_self(); + } + INLINE void start_pre(void* (*fn)(void*), const bool, const int) { + _fn = fn; + _thread = cthread_fork(thread_wrapper, (any_t)this); + } + INLINE void start_in(void) { + cthread_set_data(cthread_self(), (any_t)this); + } + INLINE void start_post(const bool det, const int) { + if (det) + cthread_detach(_thread); + } + INLINE void join(void** status) { + *status = cthread_join(_thread); + } + INLINE void set_priority(const int pri) { + kern_return_t rc = cthread_priority(_thread, priority_map(pri), + FALSE); + if (rc != KERN_SUCCESS) + throw thread_fatal(errno); + } + INLINE void* back_ptr(void) { return _b_ptr; } + static INLINE void exit(void* return_value) { + cthread_exit(return_value); + } + static INLINE thread_class* self(void) { + thread_class* me = (thread_class*)cthread_data(cthread_self()); + // if (me == thread_class::Null) not one of ours + return me; + } + static INLINE void yield(void) { + cthread_yield(); + } }; class library_class { public: - static library_class* const Null; - INLINE library_class(str&) { - throw lib_load_invalid(); - } - INLINE ~library_class(void) { - throw lib_load_invalid(); - } - INLINE void* get_symbol(str&) { - throw lib_load_invalid(); - } + static library_class* const Null; + INLINE library_class(str&) { + throw lib_load_invalid(); + } + INLINE ~library_class(void) { + throw lib_load_invalid(); + } + INLINE void* get_symbol(str&) { + throw lib_load_invalid(); + } }; static INLINE mutex_class *make_mutex(void) { - return new mutex_class; + return new mutex_class; } static INLINE condition_class *make_condition(mutex_class* m) { - return new condition_class(m); + return new condition_class(m); } static INLINE semaphore_class *make_semaphore(const unsigned int initial) { - return new semaphore_class(initial); + return new semaphore_class(initial); } static INLINE thread_class *make_thread(void* data) { - return new thread_class(data); + return new thread_class(data); } static INLINE library_class *make_library(str&) { - throw lib_load_invalid(); + throw lib_load_invalid(); } static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { - const unsigned MAX_SLEEP_SECONDS=(unsigned)4294966; // (2**32-2)/1000 - if (secs <= MAX_SLEEP_SECONDS) { - thread_switch(THREAD_NULL, SWITCH_OPTION_WAIT, - secs * 1000 + nsecs / 1000000); - return; - } - unsigned no_of_max_sleeps = secs / MAX_SLEEP_SECONDS; - for (unsigned i=0; i_return_value = return_value; + me->_return_value = return_value; // This gives us a seg fault upon exit - NSPR wants us to return from // the callback function rather than exit() //exit(0); // assuming that this is really a kernel thread. NSPR offers @@ -185,20 +185,20 @@ public: INLINE library_class(const std::string& lib) { _lib = PR_LoadLibrary(lib.c_str()); if (_lib == (PRLibrary*)0L) { - nout << "failed to load library '" << lib << "'" << endl; + nout << "failed to load library '" << lib << "'" << endl; } } INLINE ~library_class(void) { if (_lib != (PRLibrary*)0L) { - PRStatus stat = PR_UnloadLibrary(_lib); - if (stat == PR_FAILURE) - nout << "failed to unload library" << endl; + PRStatus stat = PR_UnloadLibrary(_lib); + if (stat == PR_FAILURE) + nout << "failed to unload library" << endl; } } INLINE void* get_symbol(const std::string& sym) { if (_lib == (PRLibrary*)0L) { - nout << "library not correctly loaded" << endl; - return (void *)0L; + nout << "library not correctly loaded" << endl; + return (void *)0L; } return PR_FindSymbol(_lib, sym.c_str()); } @@ -211,20 +211,20 @@ public: INLINE void setFile(const std::string& file) { _filename = file; close(); } INLINE bool open(const int mode) { close(); - switch(mode){ - case 0: _fhandle = PR_Open(_filename.c_str(), PR_RDONLY, 00666); break; - case 1: _fhandle = PR_Open(_filename.c_str(), - PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00666); break; - case 2: _fhandle = PR_Open(_filename.c_str(), - PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 00666); break; - case 3: _fhandle = PR_Open(_filename.c_str(), PR_APPEND | PR_CREATE_FILE, 00666); break; - default: _fhandle = PR_Open(_filename.c_str(), PR_RDONLY, 00666); break; - } - return (_fhandle != (PRFileDesc *)NULL); - } - INLINE void close(void) { - if (_fhandle != (PRFileDesc *)NULL) { PR_Close(_fhandle); _fhandle = (PRFileDesc *)NULL; } - } + switch(mode){ + case 0: _fhandle = PR_Open(_filename.c_str(), PR_RDONLY, 00666); break; + case 1: _fhandle = PR_Open(_filename.c_str(), + PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00666); break; + case 2: _fhandle = PR_Open(_filename.c_str(), + PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 00666); break; + case 3: _fhandle = PR_Open(_filename.c_str(), PR_APPEND | PR_CREATE_FILE, 00666); break; + default: _fhandle = PR_Open(_filename.c_str(), PR_RDONLY, 00666); break; + } + return (_fhandle != (PRFileDesc *)NULL); + } + INLINE void close(void) { + if (_fhandle != (PRFileDesc *)NULL) { PR_Close(_fhandle); _fhandle = (PRFileDesc *)NULL; } + } INLINE bool empty(void){ return (PR_Available(_fhandle) <= 0); } INLINE int readin(string &block, int numBytes) { @@ -246,18 +246,18 @@ public: return numRead; } - INLINE int writeout(const string &block) { + INLINE int writeout(const string &block) { nassertr(block.size() > 0, 0); //Make sure there is something to write out nassertr(block.data() != NULL, 0); if (_fhandle == (PRFileDesc *)NULL) return 0; - return PR_Write(_fhandle, (void*)block.data(), block.size()); - } + return PR_Write(_fhandle, (void*)block.data(), block.size()); + } private: string _filename; - PRFileDesc* _fhandle; + PRFileDesc* _fhandle; }; static INLINE mutex_class* make_mutex(void) { @@ -279,15 +279,15 @@ public: return new file_class(file); } static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { + const unsigned long nsecs = 0) { PRIntervalTime i = PR_SecondsToInterval(secs) + PR_MicrosecondsToInterval(nsecs / 1000); PR_Sleep(i); } static INLINE void get_time(unsigned long& abs_secs, - unsigned long& abs_nsecs, - const unsigned long rel_secs = 0, - const unsigned long rel_nsecs = 0) { + unsigned long& abs_nsecs, + const unsigned long rel_secs = 0, + const unsigned long rel_nsecs = 0) { PRTime t = PR_Now(); PRTime t_offset; PRTime usec_convert; diff --git a/panda/src/ipc/ipc_nt_traits.cxx b/panda/src/ipc/ipc_nt_traits.cxx index bb1f3d0219..f2d5e0cdfd 100644 --- a/panda/src/ipc/ipc_nt_traits.cxx +++ b/panda/src/ipc/ipc_nt_traits.cxx @@ -8,10 +8,10 @@ #include "ipc_nt_traits.h" const int ipc_traits::days_in_preceeding_months[12] = { 0, 31, 59, 90, - 120, 151, 181, 212, - 243, 273, 304, 334 }; + 120, 151, 181, 212, + 243, 273, 304, 334 }; const int ipc_traits::days_in_preceeding_months_leap[12] = { 0, 31, 60, - 91, 121, 152, 182, 213, - 244, 274, 305, 335 }; + 91, 121, 152, 182, 213, + 244, 274, 305, 335 }; #endif diff --git a/panda/src/ipc/ipc_nt_traits.h b/panda/src/ipc/ipc_nt_traits.h index fea61fe7c3..8d49d24553 100644 --- a/panda/src/ipc/ipc_nt_traits.h +++ b/panda/src/ipc/ipc_nt_traits.h @@ -31,130 +31,130 @@ class EXPCL_PANDAEXPRESS ipc_traits { class file_class; class mutex_class { private: - CRITICAL_SECTION _mutex; + CRITICAL_SECTION _mutex; public: - // interface to mutex - static const mutex_class* Null; - INLINE mutex_class(void) { InitializeCriticalSection(&_mutex); } - INLINE ~mutex_class(void) { DeleteCriticalSection(&_mutex); } - INLINE void lock(void) { EnterCriticalSection(&_mutex); } - INLINE void unlock(void) { LeaveCriticalSection(&_mutex); } + // interface to mutex + static const mutex_class* Null; + INLINE mutex_class(void) { InitializeCriticalSection(&_mutex); } + INLINE ~mutex_class(void) { DeleteCriticalSection(&_mutex); } + INLINE void lock(void) { EnterCriticalSection(&_mutex); } + INLINE void unlock(void) { LeaveCriticalSection(&_mutex); } }; class thread_class { private: - HANDLE _handle; - DWORD _id; - void* _return_value; - HANDLE _condition; - thread* _tnext; - thread* _tprev; - BOOL _waiting; - void* _b_ptr; // a handle to hang a pointer back to the high-level - // thread class on. Gross, but I couldn't think of - // a better way to do this reverse lookup. - void* (*_fn)(void*); - INLINE int priority_map(const int pri) { - switch (pri) { - case 0: - return THREAD_PRIORITY_LOWEST; - case 1: - return THREAD_PRIORITY_NORMAL; - case 2: - return THREAD_PRIORITY_HIGHEST; - } - throw thread_invalid(); - // never gets here, but keeps the compiler happy - return 0; - } + HANDLE _handle; + DWORD _id; + void* _return_value; + HANDLE _condition; + thread* _tnext; + thread* _tprev; + BOOL _waiting; + void* _b_ptr; // a handle to hang a pointer back to the high-level + // thread class on. Gross, but I couldn't think of + // a better way to do this reverse lookup. + void* (*_fn)(void*); + INLINE int priority_map(const int pri) { + switch (pri) { + case 0: + return THREAD_PRIORITY_LOWEST; + case 1: + return THREAD_PRIORITY_NORMAL; + case 2: + return THREAD_PRIORITY_HIGHEST; + } + throw thread_invalid(); + // never gets here, but keeps the compiler happy + return 0; + } #ifndef __BCPLUSPLUS__ - static unsigned _stdcall thread_wrapper(void*); + static unsigned _stdcall thread_wrapper(void*); #else - static void _USERENTRY thread_wrapper(void*); + static void _USERENTRY thread_wrapper(void*); #endif public: - // interface to threads - static const thread_class* Null; - INLINE thread_class(void* data) : _b_ptr(data), - _tnext(thread_class::Null), _tprev(thread_class::Null), - _waiting(FALSE), _handle(NULL) { - _condition = CreateSemaphore(NULL, 0, SEMAPHORE_MAX, NULL); - if (_condition == NULL) - throw thread_fatal(GetLastError()); - } - INLINE ~thread_class(void) { - if (!CloseHandle(_handle)) - throw thread_fatal(GetLastError()); - if (!CloseHandle(_condition)) - throw thread_fatal(GetLastError()); - } - INLINE void manual_init(void) { - if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), - GetCurrentProcess(), &_handle, 0, FALSE, - DUPLICATE_SAME_ACCESS)) - throw thread_fatal(GetLastError()); - _id = GetCurrentThreadId(); - if (!SetThreadPriority(_handle, priority_map(PRIORITY_NORMAL))) - throw thread_fatal(GetLastError()); - } - INLINE void start_pre(void* (*fn)(void*), const bool, const int) { - _fn = fn; + // interface to threads + static const thread_class* Null; + INLINE thread_class(void* data) : _b_ptr(data), + _tnext(thread_class::Null), _tprev(thread_class::Null), + _waiting(FALSE), _handle(NULL) { + _condition = CreateSemaphore(NULL, 0, SEMAPHORE_MAX, NULL); + if (_condition == NULL) + throw thread_fatal(GetLastError()); + } + INLINE ~thread_class(void) { + if (!CloseHandle(_handle)) + throw thread_fatal(GetLastError()); + if (!CloseHandle(_condition)) + throw thread_fatal(GetLastError()); + } + INLINE void manual_init(void) { + if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), + GetCurrentProcess(), &_handle, 0, FALSE, + DUPLICATE_SAME_ACCESS)) + throw thread_fatal(GetLastError()); + _id = GetCurrentThreadId(); + if (!SetThreadPriority(_handle, priority_map(PRIORITY_NORMAL))) + throw thread_fatal(GetLastError()); + } + INLINE void start_pre(void* (*fn)(void*), const bool, const int) { + _fn = fn; #ifndef __BCPLUSPLUS__ - // MSVC++ or compatable - unsigned int t; - _handle = (HANDLE)_beginthreadex(NULL, 0, thread_wrapper, - (LPVOID)this, CREATE_SUSPENDED, - &t); - _id = t; - if (_handle == NULL) - throw thread_fatal(GetLastError()); + // MSVC++ or compatable + unsigned int t; + _handle = (HANDLE)_beginthreadex(NULL, 0, thread_wrapper, + (LPVOID)this, CREATE_SUSPENDED, + &t); + _id = t; + if (_handle == NULL) + throw thread_fatal(GetLastError()); #else - // Borland C++ - _handle = (HANDLE)_beginthreadNT(thread_wrapper, 0, (void*)this, - NULL, CREATE_SUSPENDED, &_id); - if (_handle == INVALID_HANDLE_VALUE) - throw thread_fatal(errno); + // Borland C++ + _handle = (HANDLE)_beginthreadNT(thread_wrapper, 0, (void*)this, + NULL, CREATE_SUSPENDED, &_id); + if (_handle == INVALID_HANDLE_VALUE) + throw thread_fatal(errno); #endif - } - INLINE void start_in(void) { - if (!TlsSetValue(self_tls_index, (LPVOID)this)) - throw thread_fatal(GetLastError()); - } - INLINE void start_post(const bool, const int pri) { - if (!SetThreadPriority(_handle, pri)) - throw thread_fatal(GetLastError()); - if (ResumeThread(_handle) == 0xffffffff) - throw thread_fatal(GetLastError()); - } - INLINE void join(void** status) { - if (WaitForSingleObject(_handle, INFINITE) != WAIT_OBJECT_0) - throw thread_fatal(GetLastError()); - if (status) - *status = _return_value; - } - INLINE void set_priority(const int pri) { - if (!SetThreadPriority(_handle, priority_map(pri))) - throw thread_fatal(GetLastError()); - } - INLINE void* back_ptr(void) { return _b_ptr; } - static INLINE void exit(void* return_value) { - thread_class* me = self(); - if (me != thread_class::Null) - me->_return_val = return_value; + } + INLINE void start_in(void) { + if (!TlsSetValue(self_tls_index, (LPVOID)this)) + throw thread_fatal(GetLastError()); + } + INLINE void start_post(const bool, const int pri) { + if (!SetThreadPriority(_handle, pri)) + throw thread_fatal(GetLastError()); + if (ResumeThread(_handle) == 0xffffffff) + throw thread_fatal(GetLastError()); + } + INLINE void join(void** status) { + if (WaitForSingleObject(_handle, INFINITE) != WAIT_OBJECT_0) + throw thread_fatal(GetLastError()); + if (status) + *status = _return_value; + } + INLINE void set_priority(const int pri) { + if (!SetThreadPriority(_handle, priority_map(pri))) + throw thread_fatal(GetLastError()); + } + INLINE void* back_ptr(void) { return _b_ptr; } + static INLINE void exit(void* return_value) { + thread_class* me = self(); + if (me != thread_class::Null) + me->_return_val = return_value; #ifndef __BCPLUSPLUS__ - _endthreadex(0); + _endthreadex(0); #else - _endthread(); + _endthread(); #endif - } - static INLINE thread_class* self(void) { - LPVOID me = TlsGetValue(self_tls_index); - if (me == NULL) - return thread_class::Null; - return (thread_class*)me; - } - static INLINE void yield(void) { - Sleep(0); - } + } + static INLINE thread_class* self(void) { + LPVOID me = TlsGetValue(self_tls_index); + if (me == NULL) + return thread_class::Null; + return (thread_class*)me; + } + static INLINE void yield(void) { + Sleep(0); + } }; // Condition variables are rather annoying to implement using NT // synchronisation primitives, since none of them have the atomic @@ -192,229 +192,229 @@ class EXPCL_PANDAEXPRESS ipc_traits { // heavy weight. class condition_class { private: - CRITICAL_SECTION _condition; - thread_class* waiting_head; - thread_class* waiting_tail; - mutex_class* _mutex; - class _internal_thread_helper; - class _internal_thread_dummy : public thread_class { - public: - INLINE _internal_thread_dummy(void) : - next((_internal_thread_dummy*)0L) {} - INLINE ~_internal_thread_dummy(void) {} - friend class _internal_thread_helper; - private: - _internal_thread_dummy* next; - }; - class _internal_thread_helper { - public: - INLINE _internal_thread_helper(void) : - d((_internal_thread_dummy*)0L), - t(thread_class::self()) { - if (cachelock == mutex_class::Null) - cachelock = new mutex_class; - if (t == thread_class::Null) { - cachelock->lock(); - if (cache) { - d = cache; - cache = cache->next; - } else - d = new _internal_tread_dummy; - t = d; - cachelock->unlock(); - } - } - INLINE ~_internal_thread_helper(void) { - if (d != (_internal_thread_dummy*)0L) { - cachelock->lock(); - d->next = cache; - cache = d; - cachelock->unlock(); - } - } - INLINE operator thread_class*(void) { return t; } - INLINE thread_class* operator->(void) { return t; } - static _internal_thread_dummy* cache; - static mutex_class* cachelock; - private: - _internal_thread_dummy* d; - thread_class* t; - }; + CRITICAL_SECTION _condition; + thread_class* waiting_head; + thread_class* waiting_tail; + mutex_class* _mutex; + class _internal_thread_helper; + class _internal_thread_dummy : public thread_class { + public: + INLINE _internal_thread_dummy(void) : + next((_internal_thread_dummy*)0L) {} + INLINE ~_internal_thread_dummy(void) {} + friend class _internal_thread_helper; + private: + _internal_thread_dummy* next; + }; + class _internal_thread_helper { + public: + INLINE _internal_thread_helper(void) : + d((_internal_thread_dummy*)0L), + t(thread_class::self()) { + if (cachelock == mutex_class::Null) + cachelock = new mutex_class; + if (t == thread_class::Null) { + cachelock->lock(); + if (cache) { + d = cache; + cache = cache->next; + } else + d = new _internal_tread_dummy; + t = d; + cachelock->unlock(); + } + } + INLINE ~_internal_thread_helper(void) { + if (d != (_internal_thread_dummy*)0L) { + cachelock->lock(); + d->next = cache; + cache = d; + cachelock->unlock(); + } + } + INLINE operator thread_class*(void) { return t; } + INLINE thread_class* operator->(void) { return t; } + static _internal_thread_dummy* cache; + static mutex_class* cachelock; + private: + _internal_thread_dummy* d; + thread_class* t; + }; public: - // interface to condition variables - static const condition_class* Null; - INLINE condition_class(mutex_class*) : _mutex(m) { - InitializeCriticalSection(&_condition); - waiting_head = waiting_tail = thread_class::Null; - } - INLINE ~condition_class(void) { - DeleteCriticalSection(&_condition); - if (waiting_head != thread_class::Null) - DEBUG() << "thread_ipc_traits<\"nt\">::condition_class::~condition_class : list of waiting threads is not empty" << nend; - } - INLINE void wait(void) { - _internal_thread_helper me; - EnterCriticalSection(&_condition); + // interface to condition variables + static const condition_class* Null; + INLINE condition_class(mutex_class*) : _mutex(m) { + InitializeCriticalSection(&_condition); + waiting_head = waiting_tail = thread_class::Null; + } + INLINE ~condition_class(void) { + DeleteCriticalSection(&_condition); + if (waiting_head != thread_class::Null) + DEBUG() << "thread_ipc_traits<\"nt\">::condition_class::~condition_class : list of waiting threads is not empty" << nend; + } + INLINE void wait(void) { + _internal_thread_helper me; + EnterCriticalSection(&_condition); - me->cond_next = thread_class::Null; - me->cond_prev = waiting_tail; - if (waiting_head == thread_class::Null) - waiting_head = me; - else - waiting_tail->cond_next = me; - waiting_tail = me; - me->cond_waiting = TRUE; + me->cond_next = thread_class::Null; + me->cond_prev = waiting_tail; + if (waiting_head == thread_class::Null) + waiting_head = me; + else + waiting_tail->cond_next = me; + waiting_tail = me; + me->cond_waiting = TRUE; - LeaveCriticalSection(&_condition); - _mutex->unlock(); - DWORD result = WaitForSingleObject(me->cond_semaphore, INFINITE); - _mutex->lock(); - if (result != WAIT_OBJECT_0) - throw condition_fatal(GetLastError()); - } - INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs) { - _internal_thread_helper me; - EnterCriticalSection(&_condition); + LeaveCriticalSection(&_condition); + _mutex->unlock(); + DWORD result = WaitForSingleObject(me->cond_semaphore, INFINITE); + _mutex->lock(); + if (result != WAIT_OBJECT_0) + throw condition_fatal(GetLastError()); + } + INLINE int timedwait(const unsigned long secs, + const unsigned long nsecs) { + _internal_thread_helper me; + EnterCriticalSection(&_condition); - me->cond_next = thread_class::Null; - me->cond_pref = waiting_tail; - if (waiting_tail == thread_class::Null) - waiting_head = me; - else - waiting_tail->cond_next = me; - waiting_tail = me; - me->cond_waiting = TRUE; + me->cond_next = thread_class::Null; + me->cond_pref = waiting_tail; + if (waiting_tail == thread_class::Null) + waiting_head = me; + else + waiting_tail->cond_next = me; + waiting_tail = me; + me->cond_waiting = TRUE; - LeaveCriticalSection(&_condition); - _mutex->unlock(); - unsigned long now_sec, now_nsec; - thread_ipc_traits::get_time_now(now_sec, now_nsec); - DWORD timeout = (secs - now_sec) * 1000 + - (nsecs - now_nsecs) / 1000000; - if ((secs <= new_sec) && ((secs < now_sec) || - (nsecs < now_nsecs))) - timeout = 0; - DWORD result = WaitForSingleObject(me->cond_semaphore, timeout); - if (result == WAIT_TIMEOUT) { - EnterCriticalSection(&_condition); - if (me->cond_waiting) { - if (me->cond_prev != thread_class::Null) - me->cond_prev->cond_next = me->cond_next; - else - waiting_head = me->cond_next; - if (me->cond_next != thread_class::Null) - me->cond_next->cond_prev = me->cond_prev; - else - waiting_tail = me->cond_prev; - me->cond_waiting = FALSE; - LeaveCriticalSection(&_condition); - _mutex->lock(); - return 0; - } - // We timed out but another thread still signalled us. Wait - // for the semaphore (it _must_ have been signalled) to - // decrement it again. Return that we were signalled, not - // that we timed out. - LeaveCriticalSection(&_condition); - result = WaitForSingleObject(me->cond_semaphore, INFINITE); - } - if (result != WAIT_OBJECT_0) - throw condition_fatal(GetLastError()); - _mutex->lock(); - return 1; - } - INLINE void signal(void) { - EnterCriticalSection(&_condition); - if (waiting_head != thread_class::Null) { - thread_class* t = waiting_head; - waiting_head = t->cond_next; - if (waiting_head == thread_class::Null) - waiting_tail = thread_class::Null; - else - waiting_head->cond_prev = thread_class::Null; - t->cond_waiting = FALSE; - if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) { - int rc = GetLastError(); - LeaveCriticalSection(&_condition); - throw condition_fatal(rc); - } - } - LeaveCriticalSection(&_condition); - } - INLINE void broadcast(void) { - EnterCriticalSection(&_condition); - while (waiting_head != thread_class::Null) { - thread_class* t = waiting_head; - waiting_head = t->cond_next; - if (waiting_head == thread_class::Null) - waiting_tail = thread_class::Null; - else - waiting_head->cond_prev = thread_class::Null; - t->cond_waiting = FALSE; - if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) { - int rc = GetLastError(); - LeaveCriticalSection(&_condition); - throw condition_fatal(rc); - } - } - LeaveCriticalSection(&_condition); - } + LeaveCriticalSection(&_condition); + _mutex->unlock(); + unsigned long now_sec, now_nsec; + thread_ipc_traits::get_time_now(now_sec, now_nsec); + DWORD timeout = (secs - now_sec) * 1000 + + (nsecs - now_nsecs) / 1000000; + if ((secs <= new_sec) && ((secs < now_sec) || + (nsecs < now_nsecs))) + timeout = 0; + DWORD result = WaitForSingleObject(me->cond_semaphore, timeout); + if (result == WAIT_TIMEOUT) { + EnterCriticalSection(&_condition); + if (me->cond_waiting) { + if (me->cond_prev != thread_class::Null) + me->cond_prev->cond_next = me->cond_next; + else + waiting_head = me->cond_next; + if (me->cond_next != thread_class::Null) + me->cond_next->cond_prev = me->cond_prev; + else + waiting_tail = me->cond_prev; + me->cond_waiting = FALSE; + LeaveCriticalSection(&_condition); + _mutex->lock(); + return 0; + } + // We timed out but another thread still signalled us. Wait + // for the semaphore (it _must_ have been signalled) to + // decrement it again. Return that we were signalled, not + // that we timed out. + LeaveCriticalSection(&_condition); + result = WaitForSingleObject(me->cond_semaphore, INFINITE); + } + if (result != WAIT_OBJECT_0) + throw condition_fatal(GetLastError()); + _mutex->lock(); + return 1; + } + INLINE void signal(void) { + EnterCriticalSection(&_condition); + if (waiting_head != thread_class::Null) { + thread_class* t = waiting_head; + waiting_head = t->cond_next; + if (waiting_head == thread_class::Null) + waiting_tail = thread_class::Null; + else + waiting_head->cond_prev = thread_class::Null; + t->cond_waiting = FALSE; + if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) { + int rc = GetLastError(); + LeaveCriticalSection(&_condition); + throw condition_fatal(rc); + } + } + LeaveCriticalSection(&_condition); + } + INLINE void broadcast(void) { + EnterCriticalSection(&_condition); + while (waiting_head != thread_class::Null) { + thread_class* t = waiting_head; + waiting_head = t->cond_next; + if (waiting_head == thread_class::Null) + waiting_tail = thread_class::Null; + else + waiting_head->cond_prev = thread_class::Null; + t->cond_waiting = FALSE; + if (!ReleaseSemaphore(t->cond_semaphore, 1, NULL)) { + int rc = GetLastError(); + LeaveCriticalSection(&_condition); + throw condition_fatal(rc); + } + } + LeaveCriticalSection(&_condition); + } }; class semaphore_class { private: - HANDLE _semaphore; + HANDLE _semaphore; #ifndef WIN32_VC - const unsigned long SEMAPHORE_MAX = 0x7fffffff; + const unsigned long SEMAPHORE_MAX = 0x7fffffff; #endif public: - // interface to semaphores - static const semaphore_class* Null; - INLINE semaphore_class(const unsigned int initial) : - _semaphore(CreateSemaphore(NULL, initial, SEMAPHORE_MAX, NULL)) { - if (_semaphore == NULL) { - DEBUG() << "thread_ipc_traits<\"nt\">::semaphore_class::semaphore_class : CreateSemaphore error " - << GetLastError() << nend; - throw semaphore_fatal(GetLastError()); - } - } - INLINE ~semaphore_class(void) { - if (!CloseHandle(_semaphore)) { - DEBUG() << "thread_ipc_traits<\"nt\">::semaphore_class::~semaphore_class : CloseHandle error " - << GetLastError() << nend; - throw semaphore_fatal(GetLastError()); - } - } - INLINE void wait(void) { - if (WaitForSingleObject(_semaphore, INFINITE) != WAIT_OBJECT_0) - throw semaphore_fatal(GetLastError()); - } - INLINE int trywait(void) { - switch (WaitForSingleObject(_semaphore, 0)) { - case WAIT_OBJECT_0: return 1; - case WAIT_TIMEOUT: return 0; - } - throw semaphore_fatal(GetLastError()); - return 0; // never really gets here, but the compilers like it - } - INLINE void post(void) { - if (!ReleaseSemaphore(_semaphore, 1, NULL)) - throw semaphore_fatal(GetLastError()); - } + // interface to semaphores + static const semaphore_class* Null; + INLINE semaphore_class(const unsigned int initial) : + _semaphore(CreateSemaphore(NULL, initial, SEMAPHORE_MAX, NULL)) { + if (_semaphore == NULL) { + DEBUG() << "thread_ipc_traits<\"nt\">::semaphore_class::semaphore_class : CreateSemaphore error " + << GetLastError() << nend; + throw semaphore_fatal(GetLastError()); + } + } + INLINE ~semaphore_class(void) { + if (!CloseHandle(_semaphore)) { + DEBUG() << "thread_ipc_traits<\"nt\">::semaphore_class::~semaphore_class : CloseHandle error " + << GetLastError() << nend; + throw semaphore_fatal(GetLastError()); + } + } + INLINE void wait(void) { + if (WaitForSingleObject(_semaphore, INFINITE) != WAIT_OBJECT_0) + throw semaphore_fatal(GetLastError()); + } + INLINE int trywait(void) { + switch (WaitForSingleObject(_semaphore, 0)) { + case WAIT_OBJECT_0: return 1; + case WAIT_TIMEOUT: return 0; + } + throw semaphore_fatal(GetLastError()); + return 0; // never really gets here, but the compilers like it + } + INLINE void post(void) { + if (!ReleaseSemaphore(_semaphore, 1, NULL)) + throw semaphore_fatal(GetLastError()); + } }; class library_class { public: - // interface to dynamically loaded libraries - static library_class* const Null; - INLINE library_class(std::string&) { - throw lib_load_invalid(); - } - INLINE ~library_class(void) { - throw lib_load_invalid(); - } - INLINE void* get_symbol(std::string&) { - throw lib_load_invalid(); - } + // interface to dynamically loaded libraries + static library_class* const Null; + INLINE library_class(std::string&) { + throw lib_load_invalid(); + } + INLINE ~library_class(void) { + throw lib_load_invalid(); + } + INLINE void* get_symbol(std::string&) { + throw lib_load_invalid(); + } }; // BROKEN!! NOT FINISHED class file_class { @@ -426,110 +426,110 @@ class EXPCL_PANDAEXPRESS ipc_traits { INLINE void setFile(std::string& file) { _filename = file; close(); } INLINE bool open(const int mode) { close(); - if (_filename.data() != NULL) { + if (_filename.data() != NULL) { switch(mode){ - case 0: _fhandle = fopen(_filename.data(), "rb"); break; - case 1: _fhandle = fopen(_filename.data(), "wb"); break; - case 2: _fhandle = fopen(_filename.data(), "rwb"); break; - default: _fhandle = fopen(_filename.data(), "rb"); break; - } + case 0: _fhandle = fopen(_filename.data(), "rb"); break; + case 1: _fhandle = fopen(_filename.data(), "wb"); break; + case 2: _fhandle = fopen(_filename.data(), "rwb"); break; + default: _fhandle = fopen(_filename.data(), "rb"); break; + } if (_fhandle != NULL) return true; - } + } return false; - } - INLINE void close(void) { - if (_fhandle != NULL) { fclose(_fhandle); _fhandle = NULL; } - } - /* + } + INLINE void close(void) { + if (_fhandle != NULL) { fclose(_fhandle); _fhandle = NULL; } + } + /* INLINE bool readin(MemBuf& buffer, int numBytes) { - BYTE* block = new BYTE[numBytes]; + BYTE* block = new BYTE[numBytes]; if (_fhandle != NULL){ - fread(block, sizeof(BYTE), numBytes, _fhandle); + fread(block, sizeof(BYTE), numBytes, _fhandle); if (!ferror(_fhandle)){ buffer.addBack(block); delete [] block; return true; } - } - delete [] block; + } + delete [] block; return false; - } - INLINE bool writeout(MemBuf& buffer, int numBytes) { - BYTE* block = buffer.getBlock(0, numBytes); + } + INLINE bool writeout(MemBuf& buffer, int numBytes) { + BYTE* block = buffer.getBlock(0, numBytes); if (_fhandle != NULL) { - fwrite(block, sizeof(BYTE), numBytes, _fhandle); - if (!ferror(_fhandle)) { delete [] block; return true; } - } - delete [] block; - return false; - } + fwrite(block, sizeof(BYTE), numBytes, _fhandle); + if (!ferror(_fhandle)) { delete [] block; return true; } + } + delete [] block; + return false; + } INLINE bool readin(BYTE* block, int numBytes) { if (_fhandle != NULL){ - fread(block, sizeof(BYTE), numBytes, _fhandle); + fread(block, sizeof(BYTE), numBytes, _fhandle); if (!ferror(_fhandle)){ return true; } - } + } return false; - } - INLINE bool writeout(BYTE* block, int numBytes) { + } + INLINE bool writeout(BYTE* block, int numBytes) { if (_fhandle != NULL) { - fwrite(block, sizeof(BYTE), numBytes, _fhandle); - if (!ferror(_fhandle)) { return true; } - } - return false; - } - */ + fwrite(block, sizeof(BYTE), numBytes, _fhandle); + if (!ferror(_fhandle)) { return true; } + } + return false; + } + */ private: string _filename; - FILE* fhandle; + FILE* fhandle; }; static INLINE mutex_class *make_mutex(void) { - return new mutex_class; + return new mutex_class; } static INLINE condition_class *make_condition(mutex_class* m) { - return new condition_class(m); + return new condition_class(m); } static INLINE semaphore_class *make_semaphore(const unsigned int initial) { - return new semaphore_class(initial); + return new semaphore_class(initial); } static INLINE thread_class *make_thread(void* data) { - return new thread_class(data); + return new thread_class(data); } static INLINE library_class *make_thread(std::string&) { - throw lib_load_invalid(); + throw lib_load_invalid(); } static INLINE file_class *make_file(std::string& file) { - return new file_class(file); + return new file_class(file); } static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { - const DWORD MAX_SLEEP_SECONDS = (DWORD)4294966; // (2**32-2)/1000 - if (secs <= MAX_SLEEP_SECONDS) { - Sleep(secs * 1000 + nsecs / 1000000); - return; - } - DWORD no_of_max_sleeps = secs / MAX_SLEEP_SECONDS; - for (DWORD i=0; iget_mutex())); - } - INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs) { - timespec rqts = { (long)secs, (long)nsecs }; - int rc = ERRNO(pthread_cond_timedwait(&_condition, - _mutex->get_mutex(), - &rqts)); - if (rc == 0) - return 1; + } + INLINE ~condition_class(void) { + THROW_ERRORS_C(pthread_cond_destroy(&_condition)); + } + INLINE void wait(void) { + THROW_ERRORS_C(pthread_cond_wait(&_condition, + _mutex->get_mutex())); + } + INLINE int timedwait(const unsigned long secs, + const unsigned long nsecs) { + timespec rqts = { (long)secs, (long)nsecs }; + int rc = ERRNO(pthread_cond_timedwait(&_condition, + _mutex->get_mutex(), + &rqts)); + if (rc == 0) + return 1; #if (PthreadsDraftVersion <= 6) - if (rc == EAGAIN) - return 0; + if (rc == EAGAIN) + return 0; #endif - if (rc == ETIMEDOUT) - return 0; - throw condition_fatal(rc); - } - INLINE void signal(void) { - THROW_ERRORS_C(pthread_cond_signal(&_condition)); - } - INLINE void broadcast(void) { - THROW_ERRORS_C(pthread_cond_broadcast(&_condition)); - } + if (rc == ETIMEDOUT) + return 0; + throw condition_fatal(rc); + } + INLINE void signal(void) { + THROW_ERRORS_C(pthread_cond_signal(&_condition)); + } + INLINE void broadcast(void) { + THROW_ERRORS_C(pthread_cond_broadcast(&_condition)); + } }; class semaphore_class { private: - mutex_class _mutex; - condition_class _condition; - int _value; - class mutex_class_lock { - public: - INLINE mutex_class_lock(mutex_class& m) : _mutex(m) { - _mutex.lock(); - } - INLINE ~mutex_class_lock(void) { _mutex.unlock(); } - private: - mutex_class& _mutex; - }; + mutex_class _mutex; + condition_class _condition; + int _value; + class mutex_class_lock { + public: + INLINE mutex_class_lock(mutex_class& m) : _mutex(m) { + _mutex.lock(); + } + INLINE ~mutex_class_lock(void) { _mutex.unlock(); } + private: + mutex_class& _mutex; + }; public: - // interface to semaphores - static semaphore_class* const Null; - INLINE semaphore_class(const unsigned int initial) : _mutex(), - _condition(&_mutex), _value(initial) {} - INLINE ~semaphore_class(void) {} - INLINE void wait(void) { - mutex_class_lock l(_mutex); - while (_value == 0) - _condition.wait(&_mutex); - --_value; - } - INLINE int trywait(void) { - mutex_class_lock l(_mutex); - if (_value == 0) { - return 0; - } - --_value; - return 1; - } - INLINE void post(void) { - mutex_class_lock l(_mutex); - if (_value == 0) - _condition.signal(); - ++_value; - } + // interface to semaphores + static semaphore_class* const Null; + INLINE semaphore_class(const unsigned int initial) : _mutex(), + _condition(&_mutex), _value(initial) {} + INLINE ~semaphore_class(void) {} + INLINE void wait(void) { + mutex_class_lock l(_mutex); + while (_value == 0) + _condition.wait(&_mutex); + --_value; + } + INLINE int trywait(void) { + mutex_class_lock l(_mutex); + if (_value == 0) { + return 0; + } + --_value; + return 1; + } + INLINE void post(void) { + mutex_class_lock l(_mutex); + if (_value == 0) + _condition.signal(); + ++_value; + } }; class thread_class { private: - pthread_t _thread; - void* _b_ptr; // a handle to hang a pointer back to the high-level - // thread class on. Gross, but I couldn't think of - // a better way to do this reverse lookup. - void* (*_fn)(void*); - INLINE int priority_map(const int pri) { + pthread_t _thread; + void* _b_ptr; // a handle to hang a pointer back to the high-level + // thread class on. Gross, but I couldn't think of + // a better way to do this reverse lookup. + void* (*_fn)(void*); + INLINE int priority_map(const int pri) { #ifdef PthreadSupportThreadPriority - switch (pri) { - case 0: - return lowest_priority; - case 1: - return normal_priority; - case 2: - return highest_priority; - } + switch (pri) { + case 0: + return lowest_priority; + case 1: + return normal_priority; + case 2: + return highest_priority; + } #endif /* PthreadSupportThreadPriority */ throw thread_invalid(); - } - static void* thread_wrapper(void*); + } + static void* thread_wrapper(void*); public: - // interface to threads - static thread_class* const Null; - INLINE thread_class(void* data) : _b_ptr(data) {} - INLINE ~thread_class(void) {} - INLINE void manual_init(void) { - _thread = pthread_self(); + // interface to threads + static thread_class* const Null; + INLINE thread_class(void* data) : _b_ptr(data) {} + INLINE ~thread_class(void) {} + INLINE void manual_init(void) { + _thread = pthread_self(); #ifdef PthreadSupportPriority #if (PthreadDraftVersion == 4) - THROW_ERRORS_T(pthread_setprio(_thread, - priority_map(PRIORITY_NORMAL))); + THROW_ERRORS_T(pthread_setprio(_thread, + priority_map(PRIORITY_NORMAL))); #elif (PthreadDraftVersion == 6) - pthread_attr_t attr; - pthread_attr_init(&attr); - THROW_ERRORS_T(pthread_attr_setprio(&attr, - priority_map(PRIORITY_NORMAL))); - THROW_ERRORS_T(pthread_setschedattr(_thread, attr)); + pthread_attr_t attr; + pthread_attr_init(&attr); + THROW_ERRORS_T(pthread_attr_setprio(&attr, + priority_map(PRIORITY_NORMAL))); + THROW_ERRORS_T(pthread_setschedattr(_thread, attr)); #else - struct sched_param sparam; - sparam.sched_priority = priority_map(PRIORITY_NORMAL); - THROW_ERRORS_T(pthread_setschedparam(_thread, SCHED_OTHER, - ¶m)); + struct sched_param sparam; + sparam.sched_priority = priority_map(PRIORITY_NORMAL); + THROW_ERRORS_T(pthread_setschedparam(_thread, SCHED_OTHER, + ¶m)); #endif /* PthreadDraftVersion */ #endif /* PthreadSupportPriority */ - } - INLINE void start_pre(void* (*fn)(void*), const bool, - const int pri) { - _fn = fn; - pthread_attr_t attr; + } + INLINE void start_pre(void* (*fn)(void*), const bool, + const int pri) { + _fn = fn; + pthread_attr_t attr; #if (PthreadDraftVersion == 4) - pthread_attr_create(&attr); + pthread_attr_create(&attr); #else - pthread_attr_init(&attr); + pthread_attr_init(&attr); #endif #if (PthreadDraftVersion == 8) - pthread_attr_setdetachedstate(&attr, PTHREAD_CREATE_UNDETACHED); + pthread_attr_setdetachedstate(&attr, PTHREAD_CREATE_UNDETACHED); #endif #ifdef PthreadSupportThreadPriority #if (PthreadDraftVersion <= 6) - THROW_ERRORS_T(pthread_attr_setprio(&attr, priority_map(pri))); + THROW_ERRORS_T(pthread_attr_setprio(&attr, priority_map(pri))); #else - struct sched_param sparam; - sparam.sched_priority = priority_map(pri); - THROW_ERRORS_T(pthread_attr_setschedparam(&attr, &sparam)); + struct sched_param sparam; + sparam.sched_priority = priority_map(pri); + THROW_ERRORS_T(pthread_attr_setschedparam(&attr, &sparam)); #endif #endif /* PthreadSupportThreadPriority */ #if defined(__osf1__) && defined(__alpha__) || defined(__VMS) - // we're going to require a larger stack size then the default - // (21120) on OSF/1 - THROW_ERRORS_T(pthread_attr_setstacksize(&attr, 32768)); + // we're going to require a larger stack size then the default + // (21120) on OSF/1 + THROW_ERRORS_T(pthread_attr_setstacksize(&attr, 32768)); #endif #if (PthreadDraftVersion == 4) - THROW_ERRORS_T(pthread_create(&_thread, attr, thread_wrapper, - (void*)this)); - pthread_attr_delete(&attr); + THROW_ERRORS_T(pthread_create(&_thread, attr, thread_wrapper, + (void*)this)); + pthread_attr_delete(&attr); #else - THROW_ERRORS_T(pthread_create(&_thread, &attr, thread_wrapper, - (void*)this)); - pthread_attr_destroy(&attr); + THROW_ERRORS_T(pthread_create(&_thread, &attr, thread_wrapper, + (void*)this)); + pthread_attr_destroy(&attr); #endif - } - INLINE void start_in(void) { - THROW_ERRORS_T(pthread_setspecific(self_key, this)); - } - INLINE void start_post(const bool det, const int) { - if (det) { + } + INLINE void start_in(void) { + THROW_ERRORS_T(pthread_setspecific(self_key, this)); + } + INLINE void start_post(const bool det, const int) { + if (det) { #if (PthreadDraftVersion <= 6) - THROW_ERRORS_T(pthread_detach(&_thread)); + THROW_ERRORS_T(pthread_detach(&_thread)); #else - THROW_ERRORS_T(pthread_detach(_thread)); + THROW_ERRORS_T(pthread_detach(_thread)); #endif - } - } - INLINE void join(void** status) { - THROW_ERRORS_T(pthread_join(_thread, status)); + } + } + INLINE void join(void** status) { + THROW_ERRORS_T(pthread_join(_thread, status)); #if (PthreadDraftVersion == 4) - // With draft 4 pthreads implementations (HPUS 10.x and Digital - // Unix 3.2), you have to detach the thread after join. If not, - // the storage for the thread will not be reclaimed. - THROW_ERRORS_T(pthread_detach(&_thread)); + // With draft 4 pthreads implementations (HPUS 10.x and Digital + // Unix 3.2), you have to detach the thread after join. If not, + // the storage for the thread will not be reclaimed. + THROW_ERRORS_T(pthread_detach(&_thread)); #endif - } - INLINE void set_priority(const int pri) { + } + INLINE void set_priority(const int pri) { #ifdef PthreadSupportThreadPriority #if (PthreadDraftVersion == 4) - THROW_ERRORS_T(pthread_setprio(_thread, priority_map(pri))); + THROW_ERRORS_T(pthread_setprio(_thread, priority_map(pri))); #elif (PthreadDraftVersion == 6) - pthread_attr_t attr; - pthread_attr_init(&attr); - THROW_ERRORS_T(pthread_attr_setprio(&attr, priority_map(pri))); - THROW_ERRORS_T(pthread_setschedattr(_thread, attr)); + pthread_attr_t attr; + pthread_attr_init(&attr); + THROW_ERRORS_T(pthread_attr_setprio(&attr, priority_map(pri))); + THROW_ERRORS_T(pthread_setschedattr(_thread, attr)); #else - struct sched_param sparam; - sparam.sched_priority = priority_map(pri); - THROW_ERRORS_T(pthread_setschedparam(_thread, SCHED_OTHER, - &sparam)); + struct sched_param sparam; + sparam.sched_priority = priority_map(pri); + THROW_ERRORS_T(pthread_setschedparam(_thread, SCHED_OTHER, + &sparam)); #endif #endif /* PthreadSupportThreadPriority */ - } - INLINE void* back_ptr(void) { return _b_ptr; } - static INLINE void exit(void* return_value) { - pthread_exit(return_value); - } - static INLINE thread_class* self(void) { - thread_class* me(thread_class::Null); + } + INLINE void* back_ptr(void) { return _b_ptr; } + static INLINE void exit(void* return_value) { + pthread_exit(return_value); + } + static INLINE thread_class* self(void) { + thread_class* me(thread_class::Null); #if (PthreadDraftVersion <= 6) - THROW_ERRORS_T(pthread_getspecific(self_key, (void**)&me)); + THROW_ERRORS_T(pthread_getspecific(self_key, (void**)&me)); #else - me = (thread_class*)pthread_getspecific(self_key); + me = (thread_class*)pthread_getspecific(self_key); #endif - return me; - } - static INLINE void yield(void) { + return me; + } + static INLINE void yield(void) { #if (PthreadDraftVersion == 6) - pthread_yield(NULL); + pthread_yield(NULL); #elif (PthreadDraftVersion < 9) - pthread_yield(); + pthread_yield(); #else - THROW_ERRORS_T(sched_yield()); + THROW_ERRORS_T(sched_yield()); #endif - } + } }; class library_class { public: - static library_class* const Null; - INLINE library_class(ConfigString&) { - throw lib_load_invalid(); - } - INLINE ~library_class(void) { - throw lib_load_invalid(); - } - INLINE void* get_symbol(ConfigString&) { - throw lib_load_invalid(); - } + static library_class* const Null; + INLINE library_class(ConfigString&) { + throw lib_load_invalid(); + } + INLINE ~library_class(void) { + throw lib_load_invalid(); + } + INLINE void* get_symbol(ConfigString&) { + throw lib_load_invalid(); + } }; static INLINE mutex_class *make_mutex(void) { - return new mutex_class; + return new mutex_class; } static INLINE condition_class *make_condition(mutex_class* m) { - return new condition_class(m); + return new condition_class(m); } static INLINE semaphore_class *make_semaphore(const unsigned int initial) { - return new semaphore_class(initial); + return new semaphore_class(initial); } static INLINE thread_class *make_thread(void* data) { - return new thread_class(data); + return new thread_class(data); } static INLINE library_class *make_library(ConfigString&) { - throw lib_load_invalid(); + throw lib_load_invalid(); } static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { - timespec rqts = { (long)secs, (long)nsecs}; + const unsigned long nsecs = 0) { + timespec rqts = { (long)secs, (long)nsecs}; #ifndef NoNanoSleep - if (nanosleep(&rqts, (timespec*)NULL) != 0) { - throw ipc_fatal(errno); - } + if (nanosleep(&rqts, (timespec*)NULL) != 0) { + throw ipc_fatal(errno); + } #else #if defined(__osf1__) && defined(__alpha__) || defined(__hpux__) && (__OSVERSION__ == 10) || defined(__VMS) || defined(__SINIX__) - if (pthread_delay_np(&rqts) != 0) { - throw ipc_fatal(errno); - } + if (pthread_delay_np(&rqts) != 0) { + throw ipc_fatal(errno); + } #elif defined(__linux__) || defined(__aix__) - // this seems terribly inaccurate, and should be re-examined - if (secs > 2000) - sleep(secs); - else - usleep(secs * 1000000 + (nsecs / 1000)); + // this seems terribly inaccurate, and should be re-examined + if (secs > 2000) + sleep(secs); + else + usleep(secs * 1000000 + (nsecs / 1000)); #else - throw ipc_invalid(); + throw ipc_invalid(); #endif #endif /* NoNanoSleep */ } static INLINE void get_time(unsigned long& abs_secs, - unsigned long& abs_nsecs, - const unsigned long rel_secs = 0, - const unsigned long rel_nsecs = 0) { - timespec abs; + unsigned long& abs_nsecs, + const unsigned long rel_secs = 0, + const unsigned long rel_nsecs = 0) { + timespec abs; #if defined(__osf1__) && defined(__alpha__) || defined(__hpux__) && (__OSVERSION__ == 10) || defined(__VMS) || defined(__SINIX__) - timespec rel; - rel.tv_sec = rel_secs; - rel.tv_nsec = rel_nsecs; - THROW_ERRORS_G(pthread_get_expiration_np(&rel, &abs)); + timespec rel; + rel.tv_sec = rel_secs; + rel.tv_nsec = rel_nsecs; + THROW_ERRORS_G(pthread_get_expiration_np(&rel, &abs)); #else #if defined(__linux__) || defined(__aix__) - struct timeval tv; - gettimeofday(&tv, NULL); - abs.tv_sec = tv.tv_sec; - abs.tv_nsec = tv.tv_usec * 1000; + struct timeval tv; + gettimeofday(&tv, NULL); + abs.tv_sec = tv.tv_sec; + abs.tv_nsec = tv.tv_usec * 1000; #else - clock_gettime(CLOCK_REALTIME, &abs); + clock_gettime(CLOCK_REALTIME, &abs); #endif /* __linux__, __aix__, ... */ - abs.tv_nsec += rel_nsecs; - abs.tv_sec += rel_secs + abs.tv_nsec / 1000000000; - abs.tv_nsec = abs.tv_nsec & 1000000000; + abs.tv_nsec += rel_nsecs; + abs.tv_sec += rel_secs + abs.tv_nsec / 1000000000; + abs.tv_nsec = abs.tv_nsec & 1000000000; #endif /* __osf1__, __alpha__, ... */ - abs_secs = abs.tv_sec; - abs_nsecs = abs.tv_nsec; + abs_secs = abs.tv_sec; + abs_nsecs = abs.tv_nsec; } static INLINE int set_atomic(int&, int) { - throw set_atomic_invalid(); + throw set_atomic_invalid(); } static INLINE int inc_atomic(int&) { - throw inc_atomic_invalid(); + throw inc_atomic_invalid(); } static INLINE int dec_atomic(int&) { - throw dec_atomic_invalid(); + throw dec_atomic_invalid(); } // These should be private, but is annoying to make config a // friend static INLINE void __set_self_key(pthread_key_t k) { - self_key = k; + self_key = k; } static INLINE void __set_lowest_priority(int p) { - lowest_priority = p; + lowest_priority = p; } static INLINE void __set_normal_priority(int p) { - normal_priority = p; + normal_priority = p; } static INLINE void __set_highest_priority(int p) { - highest_priority = p; + highest_priority = p; } private: // other data specific to this implementation diff --git a/panda/src/ipc/ipc_ps2_traits.h b/panda/src/ipc/ipc_ps2_traits.h index 5672dbd89e..3dd593e895 100644 --- a/panda/src/ipc/ipc_ps2_traits.h +++ b/panda/src/ipc/ipc_ps2_traits.h @@ -42,59 +42,59 @@ class EXPCL_PANDAEXPRESS ipc_traits { private: - SemaParam m_sema_param; - int m_sema_id; + SemaParam m_sema_param; + int m_sema_id; static const int sema_max_size = 32; public: - static semaphore_class* const Null; + static semaphore_class* const Null; - INLINE semaphore_class(const unsigned int initial = 1) { - m_sema_param.initCount = initial; - m_sema_param.maxCount = sema_max_size; - m_sema_param.option = 0; + INLINE semaphore_class(const unsigned int initial = 1) { + m_sema_param.initCount = initial; + m_sema_param.maxCount = sema_max_size; + m_sema_param.option = 0; - m_sema_id = CreateSema(&m_sema_param); + m_sema_id = CreateSema(&m_sema_param); - if (m_sema_id < 0) - throw semaphore_fatal(-1); - } + if (m_sema_id < 0) + throw semaphore_fatal(-1); + } - INLINE ~semaphore_class(void) { - DeleteSema(m_sema_id); - } + INLINE ~semaphore_class(void) { + DeleteSema(m_sema_id); + } - INLINE void wait(void) { - int result; + INLINE void wait(void) { + int result; - result = WaitSema(m_sema_id); + result = WaitSema(m_sema_id); - // see if we overflowed the semaphore's queue + // see if we overflowed the semaphore's queue - if (result != m_sema_id) - throw semaphore_fatal(-1); - } + if (result != m_sema_id) + throw semaphore_fatal(-1); + } - INLINE int trywait(void) { - SemaParam sema_param; + INLINE int trywait(void) { + SemaParam sema_param; - // query the semaphor in question directly - // we can't use poll here, because if the semaphor is - // grabbable, poll will grab it. + // query the semaphor in question directly + // we can't use poll here, because if the semaphor is + // grabbable, poll will grab it. - ReferSemaStatus(m_sema_id, &sema_param); + ReferSemaStatus(m_sema_id, &sema_param); - if (sema_param.currentCount == 0) - return 1; + if (sema_param.currentCount == 0) + return 1; - return 0; - } + return 0; + } - INLINE void post(void) { - SignalSema(m_sema_id); - } + INLINE void post(void) { + SignalSema(m_sema_id); + } }; //// mutex_class definition @@ -103,22 +103,22 @@ class EXPCL_PANDAEXPRESS ipc_traits { private: - semaphore_class m_semaphore; + semaphore_class m_semaphore; public: - static mutex_class* const Null; + static mutex_class* const Null; - inline mutex_class(void) {} - inline ~mutex_class(void) {} + inline mutex_class(void) {} + inline ~mutex_class(void) {} - inline void lock(void) { - m_semaphore.wait(); - } + inline void lock(void) { + m_semaphore.wait(); + } - inline void unlock(void) { - m_semaphore.post(); - } + inline void unlock(void) { + m_semaphore.post(); + } }; //// condition_class definition @@ -131,96 +131,96 @@ class EXPCL_PANDAEXPRESS ipc_traits // cary's rant is more than sufficient. class WaitingThread - { - public: - - // note that the semaphor is being initialized to 0, - // meaning that a wait() on it will fail until someone - // else posts to it. + { + public: - int semaphore_id; - int thread_id; - }; + // note that the semaphor is being initialized to 0, + // meaning that a wait() on it will fail until someone + // else posts to it. - list waiting_thread_list; + int semaphore_id; + int thread_id; + }; + + list waiting_thread_list; mutex_class list_access_lock; mutex_class* _mutex; public: - static condition_class* const Null; + static condition_class* const Null; - INLINE condition_class(mutex_class *m) : _mutex(m) {} - INLINE ~condition_class(void) {} + INLINE condition_class(mutex_class *m) : _mutex(m) {} + INLINE ~condition_class(void) {} - INLINE void wait(void) - { - WaitingThread waiting_thread; - SemaParam sp; + INLINE void wait(void) + { + WaitingThread waiting_thread; + SemaParam sp; - sp.initCount = 0; - sp.maxCount = 1; + sp.initCount = 0; + sp.maxCount = 1; - waiting_thread.semaphore_id = CreateSema(&sp); - waiting_thread.thread_id = GetThreadId(); + waiting_thread.semaphore_id = CreateSema(&sp); + waiting_thread.thread_id = GetThreadId(); - // get the lock and add the current thread to the list. + // get the lock and add the current thread to the list. - list_access_lock.lock(); - waiting_thread_list.push_back(waiting_thread); - list_access_lock.unlock(); + list_access_lock.lock(); + waiting_thread_list.push_back(waiting_thread); + list_access_lock.unlock(); - // lock this thread away + // lock this thread away - _mutex->unlock(); - WaitSema(waiting_thread.semaphore_id); - _mutex->lock(); + _mutex->unlock(); + WaitSema(waiting_thread.semaphore_id); + _mutex->lock(); - // the thread is now sitting. - // - // - // when it gets here, it will have been released by signal/broadcast + // the thread is now sitting. + // + // + // when it gets here, it will have been released by signal/broadcast - DeleteSema(waiting_thread.semaphore_id); - } + DeleteSema(waiting_thread.semaphore_id); + } - INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs) { - return -1; - } + INLINE int timedwait(const unsigned long secs, + const unsigned long nsecs) { + return -1; + } - INLINE void signal(void) - { - WaitingThread first_in_line = waiting_thread_list.front(); - waiting_thread_list.pop_front(); + INLINE void signal(void) + { + WaitingThread first_in_line = waiting_thread_list.front(); + waiting_thread_list.pop_front(); - // release this node. + // release this node. - SignalSema(first_in_line.semaphore_id); - } + SignalSema(first_in_line.semaphore_id); + } - INLINE void broadcast(void) - { - list::iterator begin = waiting_thread_list.begin(); - list::iterator end = waiting_thread_list.end(); - list::iterator cur = begin; + INLINE void broadcast(void) + { + list::iterator begin = waiting_thread_list.begin(); + list::iterator end = waiting_thread_list.end(); + list::iterator cur = begin; - int s_id; + int s_id; - while (cur != end) - { - // touch/release this node + while (cur != end) + { + // touch/release this node - s_id = (*cur).semaphore_id; - SignalSema(s_id); + s_id = (*cur).semaphore_id; + SignalSema(s_id); - cur++; - } + cur++; + } - // and now clear the list out. + // and now clear the list out. - waiting_thread_list.erase(begin, end); - } + waiting_thread_list.erase(begin, end); + } }; //// thread_class definition @@ -229,190 +229,190 @@ class EXPCL_PANDAEXPRESS ipc_traits { private: - void *_b_ptr; // for reverse lookup - void *(*_fn)(void *); + void *_b_ptr; // for reverse lookup + void *(*_fn)(void *); - struct ThreadParam m_thread_param; - int m_thread_id; - int m_priority; + struct ThreadParam m_thread_param; + int m_thread_id; + int m_priority; - static const int m_thread_stacksize = 16384; - char m_thread_stack[m_thread_stacksize] __attribute__ ((aligned(16))); + static const int m_thread_stacksize = 16384; + char m_thread_stack[m_thread_stacksize] __attribute__ ((aligned(16))); - INLINE int priority_map(const int pri) { - switch (pri) { - case 2: - return 0; + INLINE int priority_map(const int pri) { + switch (pri) { + case 2: + return 0; - case 0: - return 2; + case 0: + return 2; - case 1: - default: - return 1; - } - } + case 1: + default: + return 1; + } + } class pointer_lookup - { - public: + { + public: - int thread_id; - thread_class *thread_ptr; - }; + int thread_id; + thread_class *thread_ptr; + }; static vector thread_addr_vector; - static void thread_wrapper(void *); + static void thread_wrapper(void *); public: static thread_class *m_root_thread; static void BuildRootThread(void) - { - static bool initialized = false; + { + static bool initialized = false; - // this will run once, and only once. Config calls it. + // this will run once, and only once. Config calls it. - if (initialized == true) - return; + if (initialized == true) + return; - // create the new root_thread placeholder - - m_root_thread = new thread_class(NULL); + // create the new root_thread placeholder - m_root_thread->_fn = NULL; - m_root_thread->m_thread_id = 1; - m_root_thread->m_priority = 0; + m_root_thread = new thread_class(NULL); - // now add it to the pointer lookup table + m_root_thread->_fn = NULL; + m_root_thread->m_thread_id = 1; + m_root_thread->m_priority = 0; - pointer_lookup root_pl; - root_pl.thread_id = 1; - root_pl.thread_ptr = m_root_thread; + // now add it to the pointer lookup table - thread_addr_vector.push_back(root_pl); - initialized = true; - } + pointer_lookup root_pl; + root_pl.thread_id = 1; + root_pl.thread_ptr = m_root_thread; + + thread_addr_vector.push_back(root_pl); + initialized = true; + } static thread_class* const Null; - INLINE thread_class(void *data) : _b_ptr(data) {} + INLINE thread_class(void *data) : _b_ptr(data) {} - INLINE ~thread_class(void) { - cout.flush(); - DeleteThread(GetThreadId()); - } + INLINE ~thread_class(void) { + cout.flush(); + DeleteThread(GetThreadId()); + } - INLINE void manual_init(void) - { - m_thread_id = GetThreadId(); - set_priority(1); - } + INLINE void manual_init(void) + { + m_thread_id = GetThreadId(); + set_priority(1); + } - INLINE void start_pre(void *(*fn)(void *), const bool, const int pri) - { - _fn = fn; - m_priority = priority_map(pri); + INLINE void start_pre(void *(*fn)(void *), const bool, const int pri) + { + _fn = fn; + m_priority = priority_map(pri); - // set up the thread_param structure + // set up the thread_param structure - m_thread_param.entry = thread_wrapper; - m_thread_param.stack = m_thread_stack; - m_thread_param.stackSize = m_thread_stacksize; - m_thread_param.initPriority = m_priority; - m_thread_param.gpReg = &_gp; + m_thread_param.entry = thread_wrapper; + m_thread_param.stack = m_thread_stack; + m_thread_param.stackSize = m_thread_stacksize; + m_thread_param.initPriority = m_priority; + m_thread_param.gpReg = &_gp; - // write this info back to the cache. + // write this info back to the cache. - FlushCache(0); + FlushCache(0); - // create and register the thread + // create and register the thread - m_thread_id = CreateThread(&m_thread_param); + m_thread_id = CreateThread(&m_thread_param); - if (m_thread_id < 0) - throw thread_fatal(-1); + if (m_thread_id < 0) + throw thread_fatal(-1); - pointer_lookup pl; - pl.thread_id = m_thread_id; - pl.thread_ptr = this; + pointer_lookup pl; + pl.thread_id = m_thread_id; + pl.thread_ptr = this; - thread_addr_vector.push_back(pl); + thread_addr_vector.push_back(pl); - // start the thread + // start the thread - StartThread(m_thread_id, (void *) this); - } + StartThread(m_thread_id, (void *) this); + } - INLINE void start_in(void) {} - INLINE void start_post(const bool det, const int) {} - INLINE void *back_ptr(void) { return _b_ptr; } + INLINE void start_in(void) {} + INLINE void start_post(const bool det, const int) {} + INLINE void *back_ptr(void) { return _b_ptr; } static INLINE void exit(void *) - { - int id = GetThreadId(); + { + int id = GetThreadId(); - vector::iterator cur; + vector::iterator cur; - for (cur = thread_addr_vector.begin(); cur != thread_addr_vector.end(); - cur++) - { - if ((*cur).thread_id == id) - { - thread_addr_vector.erase(cur); - break; - } - } + for (cur = thread_addr_vector.begin(); cur != thread_addr_vector.end(); + cur++) + { + if ((*cur).thread_id == id) + { + thread_addr_vector.erase(cur); + break; + } + } - ExitThread(); - } + ExitThread(); + } // WRITE ME (or maybe ... don't?) - INLINE void join(void **status) {} + INLINE void join(void **status) {} - INLINE void set_priority(const int pri) - { - m_priority = priority_map(pri); - ChangeThreadPriority(m_thread_id, m_priority); - } + INLINE void set_priority(const int pri) + { + m_priority = priority_map(pri); + ChangeThreadPriority(m_thread_id, m_priority); + } - static INLINE thread_class *self(void) - { - int id, result; + static INLINE thread_class *self(void) + { + int id, result; - struct ThreadParam thread_param; - vector::iterator cur; + struct ThreadParam thread_param; + vector::iterator cur; - id = GetThreadId(); + id = GetThreadId(); - for (cur = thread_addr_vector.begin(); cur != thread_addr_vector.end(); - cur++) - { - if ((*cur).thread_id == id) - return (*cur).thread_ptr; - } + for (cur = thread_addr_vector.begin(); cur != thread_addr_vector.end(); + cur++) + { + if ((*cur).thread_id == id) + return (*cur).thread_ptr; + } - return NULL; - } + return NULL; + } - static INLINE void yield(void) - { - int id, result, priority; - struct ThreadParam thread_param; + static INLINE void yield(void) + { + int id, result, priority; + struct ThreadParam thread_param; - id = GetThreadId(); - result = ReferThreadStatus(id, &thread_param); + id = GetThreadId(); + result = ReferThreadStatus(id, &thread_param); - // make sure this thread isn't thrashed. + // make sure this thread isn't thrashed. - if (result != id) + if (result != id) throw thread_fatal(-1); - priority = thread_param.currentPriority; - RotateThreadReadyQueue(priority); - } + priority = thread_param.currentPriority; + RotateThreadReadyQueue(priority); + } }; //// library_class definition @@ -421,31 +421,31 @@ class EXPCL_PANDAEXPRESS ipc_traits { public: - static library_class* const Null; + static library_class* const Null; - INLINE library_class(ConfigString&) { - throw lib_load_invalid(); - } + INLINE library_class(ConfigString&) { + throw lib_load_invalid(); + } - INLINE ~library_class(void) { - throw lib_load_invalid(); - } + INLINE ~library_class(void) { + throw lib_load_invalid(); + } - INLINE void* get_symbol(ConfigString&) { - throw lib_load_invalid(); - } + INLINE void* get_symbol(ConfigString&) { + throw lib_load_invalid(); + } }; //// timing stuff static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs) { + const unsigned long nsecs) { } static INLINE void get_time(unsigned long& abs_secs, - unsigned long& abs_nsecs, - const unsigned long rel_secs = 0, - const unsigned long rel_nsecs = 0) { + unsigned long& abs_nsecs, + const unsigned long rel_secs = 0, + const unsigned long rel_nsecs = 0) { } //// generator stuff diff --git a/panda/src/ipc/ipc_semaphore.h b/panda/src/ipc/ipc_semaphore.h index d685d2e754..324e6ff28c 100644 --- a/panda/src/ipc/ipc_semaphore.h +++ b/panda/src/ipc/ipc_semaphore.h @@ -17,7 +17,7 @@ class EXPCL_PANDAEXPRESS base_semaphore { static base_semaphore* const Null; INLINE base_semaphore(const unsigned int initial = 1) : - _semaphore(traits::make_semaphore(initial)) {} + _semaphore(traits::make_semaphore(initial)) {} INLINE ~base_semaphore(void) { delete _semaphore; } INLINE void wait(void) { _semaphore->wait(); } INLINE int trywait(void) { return _semaphore->trywait(); } @@ -31,7 +31,7 @@ class base_semaphore_lock { public: typedef base_semaphore semaphore; INLINE base_semaphore_lock(semaphore& s) : _semaphore(s) { - _semaphore.wait(); + _semaphore.wait(); } INLINE ~base_semaphore_lock(void) { _semaphore.post(); } private: diff --git a/panda/src/ipc/ipc_solaris_traits.h b/panda/src/ipc/ipc_solaris_traits.h index ef674cff33..065fc3eb1e 100644 --- a/panda/src/ipc/ipc_solaris_traits.h +++ b/panda/src/ipc/ipc_solaris_traits.h @@ -30,203 +30,203 @@ class EXPCL_PANDAEXPRESS ipc_traits { class library_class; class mutex_class { private: - mutex_t _mutex; + mutex_t _mutex; public: - // interface to mutex - static const mutex_class* Null; - INLINE mutex_class(void) { - THROW_ERRORS_M(mutex_init(&_mutex, USYNC_THREAD, 0)); - } - INLINE ~mutex_class(void) { - THROW_ERRORS_M(mutex_destroy(&_mutex)); - } - INLINE void lock(void) { - THROW_ERRORS_M(mutex_lock(&_mutex)); - } - INLINE void unlock(void) { - THROW_ERRORS_M(mutex_unlock(&_mutex)); - } + // interface to mutex + static const mutex_class* Null; + INLINE mutex_class(void) { + THROW_ERRORS_M(mutex_init(&_mutex, USYNC_THREAD, 0)); + } + INLINE ~mutex_class(void) { + THROW_ERRORS_M(mutex_destroy(&_mutex)); + } + INLINE void lock(void) { + THROW_ERRORS_M(mutex_lock(&_mutex)); + } + INLINE void unlock(void) { + THROW_ERRORS_M(mutex_unlock(&_mutex)); + } }; class condition_class { private: - cond_t _condition; - mutex_class *_mutex; + cond_t _condition; + mutex_class *_mutex; public: - // interface to condition variables - static const condition_class* Null; - INLINE condition_class(mutex_class* m) : _mutex(m) { - THROW_ERRORS_C(cond_init(&_condition, USYNC_THREAD, 0)); - } - INLINE ~condition_class(void) { - THROW_ERRORS_C(cond_destroy(&_condition)); - } - INLINE void wait(void) { - THROW_ERRORS_C(cond_wait(&_condition, _mutex->get_mutex())); - } - INLINE int timedwait(const unsigned long secs, - const unsigned long nsecs) { - timespec rqts = { secs, nsecs }; - int rc = cond_timedwait(&_condition, _mutexm->get_mutex(), - &rqts); - if (rc == 0) - return 1; - if (rc == ETIME) - return 0; - throw condition_fatal(rc); - } - INLINE void signal(void) { - THROW_ERRORS_C(cond_signal(&_condition)); - } - INLINE void broadcast(void) { - THROW_ERRORS_C(cond_broadcast(&_condition)); - } + // interface to condition variables + static const condition_class* Null; + INLINE condition_class(mutex_class* m) : _mutex(m) { + THROW_ERRORS_C(cond_init(&_condition, USYNC_THREAD, 0)); + } + INLINE ~condition_class(void) { + THROW_ERRORS_C(cond_destroy(&_condition)); + } + INLINE void wait(void) { + THROW_ERRORS_C(cond_wait(&_condition, _mutex->get_mutex())); + } + INLINE int timedwait(const unsigned long secs, + const unsigned long nsecs) { + timespec rqts = { secs, nsecs }; + int rc = cond_timedwait(&_condition, _mutexm->get_mutex(), + &rqts); + if (rc == 0) + return 1; + if (rc == ETIME) + return 0; + throw condition_fatal(rc); + } + INLINE void signal(void) { + THROW_ERRORS_C(cond_signal(&_condition)); + } + INLINE void broadcast(void) { + THROW_ERRORS_C(cond_broadcast(&_condition)); + } }; class semaphore_class { private: - sema_t _semaphore; + sema_t _semaphore; public: - // interface to semaphores - static const semaphore_class* Null; - INLINE semaphore_class(const unsigned int initial) { - THROW_ERRORS_S(sema_init(&_semaphore, initial, USYNC_THREAD - NULL)); - } - INLINE ~semaphore_class(void) { - THROW_ERRORS_S(sema_destroy(&_semaphore)); - } - INLINE void wait(void) { - THROW_ERRORS_S(sema_wait(&_semaphore)); - } - INLINE int trywait(void) { - // this is way not right, but I need access to a solaris box to - // see what it really should be. - THROW_ERRORS_S(sema_trywait(&_semaphore)); - } - INLINE void post(void) { - THROW_ERRORS_S(sema_post(&_semaphore)); - } + // interface to semaphores + static const semaphore_class* Null; + INLINE semaphore_class(const unsigned int initial) { + THROW_ERRORS_S(sema_init(&_semaphore, initial, USYNC_THREAD + NULL)); + } + INLINE ~semaphore_class(void) { + THROW_ERRORS_S(sema_destroy(&_semaphore)); + } + INLINE void wait(void) { + THROW_ERRORS_S(sema_wait(&_semaphore)); + } + INLINE int trywait(void) { + // this is way not right, but I need access to a solaris box to + // see what it really should be. + THROW_ERRORS_S(sema_trywait(&_semaphore)); + } + INLINE void post(void) { + THROW_ERRORS_S(sema_post(&_semaphore)); + } }; class thread_class { private: - thread_t _thread; - void* _b_ptr; // a handle to hang a pointer back to the high-level - // thread class on. Gross, but I couldn't think of - // a better way to do this reverse lookup. - void* (*_fn)(void*); - INLINE int priority_map(const int pri) { - switch (pri) { - case 0: - case 1: - case 2: - return pri; - } - throw thread_invalid(); - // shouldn't get here, but keeps the compiler happy - return 0; - } - static void* thread_wrapper(void*); + thread_t _thread; + void* _b_ptr; // a handle to hang a pointer back to the high-level + // thread class on. Gross, but I couldn't think of + // a better way to do this reverse lookup. + void* (*_fn)(void*); + INLINE int priority_map(const int pri) { + switch (pri) { + case 0: + case 1: + case 2: + return pri; + } + throw thread_invalid(); + // shouldn't get here, but keeps the compiler happy + return 0; + } + static void* thread_wrapper(void*); public: - // interface to threads - static const thread_class* Null; - INLINE thread_class(void* data) : _b_ptr(data) {} - INLINE ~thread_class(void) {} - INLINE void manual_init(void) { - _thread = thr_self(); - THROW_ERRORS_T(thr_setprio(_thread, priority_map(PRIORITY_NORMAL))); - } - INLINE void start_pre(void* (*fn)(void*), const bool det, - const int) { - _fn = fn; - long flags = 0; - if (det) - flags |= THR_DETACHED; - THROW_ERRORS_T(thr_create(0, 0, thread_wrapper, (void*)this, - flags, &_thread)); - } - INLINE void start_in(void) { - THROW_ERRORS_T(thr_setspecific(self_key, this)); - } - INLINE void start_post(const bool, const int pri) { - THROW_ERRORS_T(thr_setprio(_thread, priority_map(pri))); - } - INLINE void join(void** status) { - THROW_ERRORS_T(thr_join(_thread, (thraed_t*)NULL, status)); - } - INLINE void set_priority(const int pri) { - THROW_ERRORS_T(thr_setprio(_thread, priority_map(pri))); - } - INLINE void* back_ptr(void) { return _b_ptr; } - static INLINE void exit(void* return_value) { - thr_exit(return_value); - } - static INLINE thread_class* self(void) { - thread_class* me = thread_class::Null; - THROW_ERRORS_T(thr_getspecific(self_key, (void**)&me)); - return me; - } - static INLINE void yield(void) { - thr_yield(); - } + // interface to threads + static const thread_class* Null; + INLINE thread_class(void* data) : _b_ptr(data) {} + INLINE ~thread_class(void) {} + INLINE void manual_init(void) { + _thread = thr_self(); + THROW_ERRORS_T(thr_setprio(_thread, priority_map(PRIORITY_NORMAL))); + } + INLINE void start_pre(void* (*fn)(void*), const bool det, + const int) { + _fn = fn; + long flags = 0; + if (det) + flags |= THR_DETACHED; + THROW_ERRORS_T(thr_create(0, 0, thread_wrapper, (void*)this, + flags, &_thread)); + } + INLINE void start_in(void) { + THROW_ERRORS_T(thr_setspecific(self_key, this)); + } + INLINE void start_post(const bool, const int pri) { + THROW_ERRORS_T(thr_setprio(_thread, priority_map(pri))); + } + INLINE void join(void** status) { + THROW_ERRORS_T(thr_join(_thread, (thraed_t*)NULL, status)); + } + INLINE void set_priority(const int pri) { + THROW_ERRORS_T(thr_setprio(_thread, priority_map(pri))); + } + INLINE void* back_ptr(void) { return _b_ptr; } + static INLINE void exit(void* return_value) { + thr_exit(return_value); + } + static INLINE thread_class* self(void) { + thread_class* me = thread_class::Null; + THROW_ERRORS_T(thr_getspecific(self_key, (void**)&me)); + return me; + } + static INLINE void yield(void) { + thr_yield(); + } }; class library_class { public: - static library_class* const Null; - INLINE library_class(str&) { - throw lib_load_invalid(); - } - INLINE ~library_class(void) { - throw lib_load_invalid(); - } - INLINE void* get_symbol(str&) { - throw lib_load_invalid(); - } + static library_class* const Null; + INLINE library_class(str&) { + throw lib_load_invalid(); + } + INLINE ~library_class(void) { + throw lib_load_invalid(); + } + INLINE void* get_symbol(str&) { + throw lib_load_invalid(); + } }; static INLINE mutex_class *make_mutex(void) { - return new mutex_class; + return new mutex_class; } static INLINE condition_class *make_condition(mutex_class* m) { - return new condition_class(m); + return new condition_class(m); } static INLINE semaphore_class *make_semaphore(const unsigned int initial) { - return new semaphore_class(initial); + return new semaphore_class(initial); } static INLINE thread_class *make_thread(void* data) { - return new thread_class(data); + return new thread_class(data); } static INLINE library_class *make_library(str&) { - throw lib_load_invalid(); + throw lib_load_invalid(); } static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { - timespec rqts = { secs, nsecs }; - if (nanosleep(&rqts, (timespec*)NULL) != 0) - throw ipc_fatal(errno); + const unsigned long nsecs = 0) { + timespec rqts = { secs, nsecs }; + if (nanosleep(&rqts, (timespec*)NULL) != 0) + throw ipc_fatal(errno); } static INLINE void get_time(unsigned long& abs_secs, - unsigned long& abs_nsecs, - const unsigned long rel_secs = 0, - const unsigned long rel_nsecs = 0) { - timespec abs; - clock_gettime(CLOCK_REALTIME, &abs); - abs.tv_nsec += rel_nsecs; - abs.tv_sec += rel_secs + abs.tv_nsec / 1000000000; - abs.tv_nsec = abs.tv_nsec & 1000000000; - abs_secs = abs.tv_sec; - abs_nsecs = abs.tv_nsec; + unsigned long& abs_nsecs, + const unsigned long rel_secs = 0, + const unsigned long rel_nsecs = 0) { + timespec abs; + clock_gettime(CLOCK_REALTIME, &abs); + abs.tv_nsec += rel_nsecs; + abs.tv_sec += rel_secs + abs.tv_nsec / 1000000000; + abs.tv_nsec = abs.tv_nsec & 1000000000; + abs_secs = abs.tv_sec; + abs_nsecs = abs.tv_nsec; } static INLINE int set_atomic(int&, int) { - throw set_atomic_invalid(); + throw set_atomic_invalid(); } static INLINE int inc_atomic(int&) { - throw inc_atomic_invalid(); + throw inc_atomic_invalid(); } static INLINE int dec_atomic(int&) { - throw dec_atomic_invalid(); + throw dec_atomic_invalid(); } // This should probably be private, but it is annoying to make config a // friend static INLINE void __set_self_key(thread_key_t k) { - self_key = k; + self_key = k; } private: // other data specific to this implementation diff --git a/panda/src/ipc/ipc_thread.h b/panda/src/ipc/ipc_thread.h index 4604e7a8d4..5d95e59140 100644 --- a/panda/src/ipc/ipc_thread.h +++ b/panda/src/ipc/ipc_thread.h @@ -23,15 +23,15 @@ class EXPCL_PANDAEXPRESS base_thread { // priority limits based on the scheduling. If scheduling is not // allowed, silently ignore those requests. enum priority_t { - PRIORITY_LOW, - PRIORITY_NORMAL, - PRIORITY_HIGH + PRIORITY_LOW, + PRIORITY_NORMAL, + PRIORITY_HIGH }; enum state_t { - STATE_NEW, // thread exists, but hasn't started yet. - STATE_RUNNING, // thread is running - STATE_TERMINATED // thread is done, but storage hasn't been reclaimed + STATE_NEW, // thread exists, but hasn't started yet. + STATE_RUNNING, // thread is running + STATE_TERMINATED // thread is done, but storage hasn't been reclaimed }; static base_thread* const Null; @@ -41,32 +41,32 @@ class EXPCL_PANDAEXPRESS base_thread { // // should be able to get rid of the voids here with clever templating. INLINE base_thread(void (*fn)(void*), void* arg = (void*)0L, - const priority_t pri = PRIORITY_NORMAL) : - _thread(thread_class::Null), _fn_void(fn), _fn_ret(0L), _mutex(), - _state(STATE_NEW), _priority(pri), _thread_arg(arg), _detached(true) { - common_constructor(); + const priority_t pri = PRIORITY_NORMAL) : + _thread(thread_class::Null), _fn_void(fn), _fn_ret(0L), _mutex(), + _state(STATE_NEW), _priority(pri), _thread_arg(arg), _detached(true) { + common_constructor(); } INLINE base_thread(void* (*fn)(void*), void* arg = (void*)0L, - const priority_t pri = PRIORITY_NORMAL) : - _thread(thread_class::Null), _fn_void(0L), _fn_ret(fn), _mutex(), + const priority_t pri = PRIORITY_NORMAL) : + _thread(thread_class::Null), _fn_void(0L), _fn_ret(fn), _mutex(), _state(STATE_NEW), _priority(pri), _thread_arg(arg), _detached(false) { - common_constructor(); + common_constructor(); } // causes this thread to start executing INLINE void start(void) { - mutex_lock l(_mutex); - if (_state != STATE_NEW) { - cerr << "base_thread::start throwing thread_invalid()" << endl; + mutex_lock l(_mutex); + if (_state != STATE_NEW) { + cerr << "base_thread::start throwing thread_invalid()" << endl; #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - } - _thread = traits::make_thread(this); - _thread->start_pre(thread_wrapper, _detached, _priority); - _state = STATE_RUNNING; - _thread->start_post(_detached, _priority); + } + _thread = traits::make_thread(this); + _thread->start_pre(thread_wrapper, _detached, _priority); + _state = STATE_RUNNING; + _thread->start_post(_detached, _priority); } // causes the calling thread to wait for this thread's completion, // putting the return value in the space passed by the parameter. Only @@ -75,116 +75,116 @@ class EXPCL_PANDAEXPRESS base_thread { // Again, clever templating should be able to eliminate this void // nonsense. It's gross! INLINE void join(void** status) { - _mutex.lock(); - if ((_state != STATE_RUNNING) && (_state != STATE_TERMINATED)) { - _mutex.unlock(); + _mutex.lock(); + if ((_state != STATE_RUNNING) && (_state != STATE_TERMINATED)) { + _mutex.unlock(); #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - } - _mutex.unlock(); - if (this == self()) + } + _mutex.unlock(); + if (this == self()) #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - if (_detached) + if (_detached) #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - _thread->join(status); - delete this; + _thread->join(status); + delete this; } // set the priority of this thread INLINE void set_priority(const priority_t pri) { - mutex_lock l(_mutex); - if (_state != STATE_RUNNING) + mutex_lock l(_mutex); + if (_state != STATE_RUNNING) #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - _thread->set_priority(pri); - _priority = pri; + _thread->set_priority(pri); + _priority = pri; } // return this thread's priority INLINE priority_t get_priority(void) { - mutex_lock l(_mutex); - // in a more general priority system, we should check that the thread - // is running at the priority we think it is. - return _priority; + mutex_lock l(_mutex); + // in a more general priority system, we should check that the thread + // is running at the priority we think it is. + return _priority; } // return this thread's state INLINE state_t get_state(void) { - mutex_lock l(_mutex); - return _state; + mutex_lock l(_mutex); + return _state; } // return this thread's id within the current process INLINE int get_id(void) { - return _id; // presumably this doesn't change + return _id; // presumably this doesn't change } // causes the calling thread to exit, again the void action here is // unhappy. static INLINE void exit(void* return_value = (void*)0L) { - cout.flush(); - base_thread* me = self(); - if (me != (base_thread*)0L) { - me->_mutex.lock(); - // if (me->_state != STATE_RUNNING) non-fatal error - me->_state = STATE_TERMINATED; - me->_mutex.unlock(); - if (me->_detached) - delete me; - } - thread_class::exit(return_value); + cout.flush(); + base_thread* me = self(); + if (me != (base_thread*)0L) { + me->_mutex.lock(); + // if (me->_state != STATE_RUNNING) non-fatal error + me->_state = STATE_TERMINATED; + me->_mutex.unlock(); + if (me->_detached) + delete me; + } + thread_class::exit(return_value); } // returns the caller's thread object. If the calling thread is not the // main thread or created by us, thread_class::Null is returned static INLINE base_thread* self(void) { - cout.flush(); - thread_class* tclass=thread_class::self(); - base_thread* ret=(base_thread*)0L; - if (tclass != thread_class::Null) - ret = (base_thread*)(tclass->back_ptr()); - return ret; + cout.flush(); + thread_class* tclass=thread_class::self(); + base_thread* ret=(base_thread*)0L; + if (tclass != thread_class::Null) + ret = (base_thread*)(tclass->back_ptr()); + return ret; } // calling task releasing control to the scheduler static INLINE void yield(void) { - thread_class::yield(); + thread_class::yield(); } // sleep for the specified amount of time static INLINE void sleep(const unsigned long secs, - const unsigned long nsecs = 0) { - traits::sleep(secs, nsecs); + const unsigned long nsecs = 0) { + traits::sleep(secs, nsecs); } // calculates an absolute time in seconds and nanoseconds, suitable for // use in timed_waits on condition variables, which is the current time // plus the given relative offset. static INLINE void get_time(unsigned long& abs_secs, - unsigned long& abs_nsecs, - const unsigned long rel_secs = 0, - const unsigned long rel_nsecs = 0) { - traits::get_time(abs_secs, abs_nsecs, rel_secs, rel_nsecs); + unsigned long& abs_nsecs, + const unsigned long rel_secs = 0, + const unsigned long rel_nsecs = 0) { + traits::get_time(abs_secs, abs_nsecs, rel_secs, rel_nsecs); } // shortcut function to create and start a thread in one call static INLINE base_thread* create(void (*fn)(void*), - void* arg = (void*)0L, - const priority_t pri=PRIORITY_NORMAL) { - base_thread* t = new base_thread(fn, arg, pri); - t->start(); - return t; + void* arg = (void*)0L, + const priority_t pri=PRIORITY_NORMAL) { + base_thread* t = new base_thread(fn, arg, pri); + t->start(); + return t; } static INLINE base_thread* create(void* (*fn)(void*), - void* arg = (void*)0L, - const priority_t pri=PRIORITY_NORMAL) { - base_thread* t = new base_thread(fn, arg, pri); - t->start(); - return t; + void* arg = (void*)0L, + const priority_t pri=PRIORITY_NORMAL) { + base_thread* t = new base_thread(fn, arg, pri); + t->start(); + return t; } // a handle to the implementation specific thread, this really should // NEVER be called from user code. @@ -194,23 +194,23 @@ class EXPCL_PANDAEXPRESS base_thread { // the run() or run_undetached() member functions depending on whether // start() or start_undetached() is called, respectively. INLINE base_thread(void* arg = (void*)0L, - const priority_t pri = PRIORITY_NORMAL) : + const priority_t pri = PRIORITY_NORMAL) : _thread(thread_class::Null), _fn_void(0L), _fn_ret(0L), _mutex(), _state(STATE_NEW), _priority(pri), _thread_arg(arg), _detached(true) { - common_constructor(); + common_constructor(); } // can be used with the above constructor in a derived class to cause the // thread to be undetached. In this case the thread executes the // run_undetached member function. INLINE void start_undetached(void) { - if ((_fn_void != NULL) || (_fn_ret != NULL)) + if ((_fn_void != NULL) || (_fn_ret != NULL)) #ifdef BROKEN_EXCEPTIONS - return; + return; #else - throw thread_invalid(); + throw thread_invalid(); #endif /* BROKEN_EXCEPTIONS */ - _detached = false; - start(); + _detached = false; + start(); } // destructor cannot be called by user (except via a derived class). // Use exit() instead. This also means a thread object must be allocated @@ -243,22 +243,22 @@ class EXPCL_PANDAEXPRESS base_thread { virtual void* run_undetached(void*); // implements the common parts of the constructors INLINE void common_constructor(void) { - if (_next_id_mutex == (mutex *)0L) { - // ok, we're the first in here. - _next_id_mutex = new mutex; - base_thread* t = new base_thread; - if (t->_state != STATE_NEW) { - // FATAL() << "thread initialization: problem creating initial thread object" << nend; - ::exit(1); - } - t->_state = STATE_RUNNING; - t->_thread = traits::make_thread(t); - t->_thread->manual_init(); - t->_thread->start_in(); - } - - mutex_lock l(*_next_id_mutex); - _id = _next_id++; + if (_next_id_mutex == (mutex *)0L) { + // ok, we're the first in here. + _next_id_mutex = new mutex; + base_thread* t = new base_thread; + if (t->_state != STATE_NEW) { + // FATAL() << "thread initialization: problem creating initial thread object" << nend; + ::exit(1); + } + t->_state = STATE_RUNNING; + t->_thread = traits::make_thread(t); + t->_thread->manual_init(); + t->_thread->start_in(); + } + + mutex_lock l(*_next_id_mutex); + _id = _next_id++; } static void *thread_wrapper(void*); }; diff --git a/panda/src/ipc/ipc_traits.cxx b/panda/src/ipc/ipc_traits.cxx index 6f9e37d3a5..a9a2ff1d95 100644 --- a/panda/src/ipc/ipc_traits.cxx +++ b/panda/src/ipc/ipc_traits.cxx @@ -33,10 +33,10 @@ ConfigureFn(ipc_trait) { unsigned int info_count = THREAD_SCHED_INFO_COUNT; error = thread_info(thread_self(), THREAD_SCHED_INFO, (thread_info_t)&info, - &info_count); + &info_count); if (error != KERN_SUCCESS) { FATAL() << "ipc_traits(mach) initialization: error determining thread_info" - << nend; + << nend; ::exit(1); } else { ipc_traits::__set_normal_priority(info.base_priority); diff --git a/panda/src/ipc/loom.cxx b/panda/src/ipc/loom.cxx index 8d52008d4d..263ccd0847 100644 --- a/panda/src/ipc/loom.cxx +++ b/panda/src/ipc/loom.cxx @@ -19,18 +19,18 @@ void app_service::DoIt(void* data) while ((ret = (*me->_service)(s, n, c)) != DONE) { switch (ret) { case RESERVICE: - break; // we're about to do this anyway + break; // we're about to do this anyway case YIELD: - thread::yield(); - break; + thread::yield(); + break; case SLEEP: - thread::sleep(s, n); - s = n = 0; - break; + thread::sleep(s, n); + s = n = 0; + break; case WAIT: - c->wait(); - c = condition_variable::Null; - break; + c->wait(); + c = condition_variable::Null; + break; } } if (me->_cleanup != NULL) @@ -40,14 +40,14 @@ void app_service::DoIt(void* data) me->_thread = thread::Null; service_list::iterator i=find(task_list->begin(), task_list->end(), me); if (i == task_list->end()) - throw thread_fatal(-1); + throw thread_fatal(-1); task_list->erase(i); } thread::exit(NULL); } void RegisterAppService(vv_func init, av_func service, vv_func cleanup, - vv_func info) + vv_func info) { app_service* app = new app_service(init, service, cleanup, info); if (task_list == (service_list *)0L) { @@ -64,7 +64,7 @@ void SendMainThreadMessage(main_thread_message& m) { mutex_lock l(*message_mutex); while (!main_thread_empty_flag) - main_thread_empty->wait(); + main_thread_empty->wait(); message_to_main_thread = mess; main_thread_empty_flag = false; main_thread_full->signal(); diff --git a/panda/src/ipc/loom.h b/panda/src/ipc/loom.h index 4dbc63b387..0577a02212 100644 --- a/panda/src/ipc/loom.h +++ b/panda/src/ipc/loom.h @@ -35,7 +35,7 @@ typedef Action (*av_func)(unsigned long&, unsigned long&, condition_variable*&); // expected that it will output something usefull about what // the task is and what it's doing. extern void RegisterAppService(vv_func, av_func, vv_func = (vv_func)0L, - vv_func = (vv_func)0L); + vv_func = (vv_func)0L); template @@ -43,9 +43,9 @@ class main_thread_message_base { public: enum message_t { LOAD, RESCAN, INFO }; INLINE main_thread_message_base(const message_t message, str s = "") : - _m(message), _lib(s) {} + _m(message), _lib(s) {} INLINE main_thread_message_base(const main_thread_message_base& m) : - _m(m._m), _lib(m._lib) {} + _m(m._m), _lib(m._lib) {} INLINE ~main_thread_message_base(void) {} INLINE message_t get_message(void) const { return _m; } INLINE str get_lib(void) const { return _lib; } diff --git a/panda/src/ipc/loom_internal.h b/panda/src/ipc/loom_internal.h index 7faec75206..69f8acc751 100644 --- a/panda/src/ipc/loom_internal.h +++ b/panda/src/ipc/loom_internal.h @@ -32,37 +32,37 @@ class app_service { static void DoIt(void*); public: INLINE app_service(vv_func init, av_func service, vv_func cleanup, - vv_func info) : _init(init), _service(service), - _cleanup(cleanup), _info(info), _thread(thread::Null) + vv_func info) : _init(init), _service(service), + _cleanup(cleanup), _info(info), _thread(thread::Null) {} INLINE bool started() { - return (_thread != thread::Null); + return (_thread != thread::Null); } INLINE void start(void) { - if (!this->started()) - thread::create(DoIt, (void*)this); + if (!this->started()) + thread::create(DoIt, (void*)this); } INLINE void info(void) { - // this probably should mutex lock the task_list while checking things - if (_info != (vv_func)0L) - (*_info)(); - if (_thread != thread::Null) { - cerr << "thread is currently running. Id = " << _thread->get_id() - << ". Current state = "; - switch (_thread->get_state()) { - case thread::STATE_NEW: - cerr << "New."; - break; - case thread::STATE_RUNNING: - cerr << "Running."; - break; - case thread::STATE_TERMINATED: - cerr << "Terminated"; - break; - } - cerr << endl; - } else - cerr << "thread not started or created yet." << endl; + // this probably should mutex lock the task_list while checking things + if (_info != (vv_func)0L) + (*_info)(); + if (_thread != thread::Null) { + cerr << "thread is currently running. Id = " << _thread->get_id() + << ". Current state = "; + switch (_thread->get_state()) { + case thread::STATE_NEW: + cerr << "New."; + break; + case thread::STATE_RUNNING: + cerr << "Running."; + break; + case thread::STATE_TERMINATED: + cerr << "Terminated"; + break; + } + cerr << endl; + } else + cerr << "thread not started or created yet." << endl; } }; diff --git a/panda/src/ipc/loom_main.cxx b/panda/src/ipc/loom_main.cxx index 4148970d17..64a12b3259 100644 --- a/panda/src/ipc/loom_main.cxx +++ b/panda/src/ipc/loom_main.cxx @@ -24,11 +24,11 @@ int main(int argc, char** argv) { for (int i=0; itimedwait(s, n); if (!main_thread_empty_flag) { - switch (message_to_main_thread->get_message()) { - case main_thread_message::LOAD: - { - Filename filename = message_to_main_thread->get_lib(); - filename.set_type(Filename::F_dso); - load_dso(filename); - } - case main_thread_message::RESCAN: - for (j=task_list->begin(); j!=task_list->end(); ++j) - (*j)->start(); - break; - case main_thread_message::INFO: - for (j=task_list->begin(); j!=task_list->end(); ++j) - (*j)->info(); - break; - default: - // really should never be here - break; - } - delete message_to_main_thread; - message_to_main_thread = (main_thread_message*)0L; - main_thread_empty_flag = true; - main_thread_empty->signal(); + switch (message_to_main_thread->get_message()) { + case main_thread_message::LOAD: + { + Filename filename = message_to_main_thread->get_lib(); + filename.set_type(Filename::F_dso); + load_dso(filename); + } + case main_thread_message::RESCAN: + for (j=task_list->begin(); j!=task_list->end(); ++j) + (*j)->start(); + break; + case main_thread_message::INFO: + for (j=task_list->begin(); j!=task_list->end(); ++j) + (*j)->info(); + break; + default: + // really should never be here + break; + } + delete message_to_main_thread; + message_to_main_thread = (main_thread_message*)0L; + main_thread_empty_flag = true; + main_thread_empty->signal(); } } thread::sleep(0, 500000000); // give some time for cleanup (1/2 sec) diff --git a/panda/src/ipc/loom_test1.cxx b/panda/src/ipc/loom_test1.cxx index ee0193fb3c..7db6676afb 100644 --- a/panda/src/ipc/loom_test1.cxx +++ b/panda/src/ipc/loom_test1.cxx @@ -20,7 +20,7 @@ void loom_test1_init2(void) } Action loom_test1_service2(unsigned long& s, unsigned long& n, - condition_variable*&) + condition_variable*&) { if (test1_phase2 == 0) { test1_phase2 = 1; @@ -43,16 +43,16 @@ Action loom_test1_service2(unsigned long& s, unsigned long& n, return RESERVICE; } else if (test1_phase2 == 3) { if (test1_phase < 19) { - PRINT(cerr << "loom_test1_service2: returning RESERVICE" << endl); - return RESERVICE; + PRINT(cerr << "loom_test1_service2: returning RESERVICE" << endl); + return RESERVICE; } else { - test1_phase2 = 4; - PRINT(cerr << "loom_test1_service2: sending INFO message to main thread" << endl); + test1_phase2 = 4; + PRINT(cerr << "loom_test1_service2: sending INFO message to main thread" << endl); main_thread_message m(main_thread_message::INFO); - SendMainThreadMessage(m); - PRINT(cerr << "loom_test1_service2: sleeping for 3/4 second" << endl); - n = 750000000; - return SLEEP; + SendMainThreadMessage(m); + PRINT(cerr << "loom_test1_service2: sleeping for 3/4 second" << endl); + n = 750000000; + return SLEEP; } } else { PRINT(cerr << "loom_test1_service2: returning DONE" << endl); @@ -72,7 +72,7 @@ void loom_test1_init(void) } Action loom_test1_service(unsigned long& s, unsigned long& n, - condition_variable*& c) + condition_variable*& c) { ++test1_phase; switch (test1_phase) { @@ -89,10 +89,10 @@ Action loom_test1_service(unsigned long& s, unsigned long& n, return YIELD; case 11: { - PRINT(cerr << "loom_test1_service: sending RESCAN message to main thread, returning YIELD" << endl); - main_thread_message m(main_thread_message::RESCAN); - SendMainThreadMessage(m); - return YIELD; + PRINT(cerr << "loom_test1_service: sending RESCAN message to main thread, returning YIELD" << endl); + main_thread_message m(main_thread_message::RESCAN); + SendMainThreadMessage(m); + return YIELD; } case 13: PRINT(cerr << "loom_test1_service: returning WAIT to service manager" << endl); @@ -105,21 +105,21 @@ Action loom_test1_service(unsigned long& s, unsigned long& n, return SLEEP; case 17: { - PRINT(cerr << "loom_test1_service: sending LOAD message to main thread (libloom_test2.so)" << endl); - main_thread_message m(main_thread_message::LOAD, "libloom_test2.so"); - SendMainThreadMessage(m); - s = 3; - PRINT(cerr << "loom_test1_service: returning SLEEP (s=3)" << endl); - return SLEEP; + PRINT(cerr << "loom_test1_service: sending LOAD message to main thread (libloom_test2.so)" << endl); + main_thread_message m(main_thread_message::LOAD, "libloom_test2.so"); + SendMainThreadMessage(m); + s = 3; + PRINT(cerr << "loom_test1_service: returning SLEEP (s=3)" << endl); + return SLEEP; } case 19: { - PRINT(cerr << "loom_test1_service: sending INFO message to main thread" << endl); - main_thread_message m(main_thread_message::INFO); - SendMainThreadMessage(m); - n = 500000000; - PRINT(cerr << "loom_test1_service: returning SLEEP (s=3)" << endl); - return SLEEP; + PRINT(cerr << "loom_test1_service: sending INFO message to main thread" << endl); + main_thread_message m(main_thread_message::INFO); + SendMainThreadMessage(m); + n = 500000000; + PRINT(cerr << "loom_test1_service: returning SLEEP (s=3)" << endl); + return SLEEP; } case 23: PRINT(cerr << "loom_test1_service: returning DONE to service manager" << endl); @@ -146,5 +146,5 @@ Configure(loom_test1); ConfigureFn(loom_test1) { RegisterAppService(loom_test1_init, loom_test1_service, loom_test1_cleanup, - loom_test1_info); + loom_test1_info); } diff --git a/panda/src/ipc/loom_test2.cxx b/panda/src/ipc/loom_test2.cxx index 88671dbf33..b84df5b1a5 100644 --- a/panda/src/ipc/loom_test2.cxx +++ b/panda/src/ipc/loom_test2.cxx @@ -17,7 +17,7 @@ void loom_test2_init(void) } Action loom_test2_service(unsigned long& s, unsigned long&, - condition_variable*&) + condition_variable*&) { ++test2_phase; switch (test2_phase) { diff --git a/panda/src/ipc/test_diners.cxx b/panda/src/ipc/test_diners.cxx index 8504e80467..7600384eb5 100644 --- a/panda/src/ipc/test_diners.cxx +++ b/panda/src/ipc/test_diners.cxx @@ -52,44 +52,44 @@ static class philosopher* phils[N_DINERS]; class philosopher : public thread { private: void run(void* arg) { - int id = *(int*)arg; - delete (int*)arg; + int id = *(int*)arg; + delete (int*)arg; #ifdef WIN32_VC - rand_mutex.lock(); - srand(last_rand); - rand_mutex.unlock(); + rand_mutex.lock(); + srand(last_rand); + rand_mutex.unlock(); #endif /* __WIN32__ */ - int l = id; - int r = l+1; - if (r == N_DINERS) - r = 0; - if (l & 1) { - int t = l; - l = r; - r = t; - } - PRINTMSG(cerr << "Philosopher #" << id << " has entered the room." - << endl); - int count = random_l() % 10 + 1; - while (--count) { - chopsticks[l].lock(); - chopsticks[r].lock(); - PRINTMSG(cerr << "Philosopher #" << id - << " is eating spaghetti now." << endl); - thread::sleep(random_l()%2, random_l()%1000000000); - chopsticks[l].unlock(); - chopsticks[r].unlock(); - PRINTMSG(cerr << "Philosopher #" << id - << " is pondering about life." << endl); - thread::sleep(random_l()%2, random_l()%1000000000); - } - room_mutex.lock(); - --room_occupancy; - phils[id] = (philosopher*)0L; - room_mutex.unlock(); - room_condition.signal(); - PRINTMSG(cerr << "Philosopher #" << id << " has left the room (" - << room_occupancy << " left)." << endl); + int l = id; + int r = l+1; + if (r == N_DINERS) + r = 0; + if (l & 1) { + int t = l; + l = r; + r = t; + } + PRINTMSG(cerr << "Philosopher #" << id << " has entered the room." + << endl); + int count = random_l() % 10 + 1; + while (--count) { + chopsticks[l].lock(); + chopsticks[r].lock(); + PRINTMSG(cerr << "Philosopher #" << id + << " is eating spaghetti now." << endl); + thread::sleep(random_l()%2, random_l()%1000000000); + chopsticks[l].unlock(); + chopsticks[r].unlock(); + PRINTMSG(cerr << "Philosopher #" << id + << " is pondering about life." << endl); + thread::sleep(random_l()%2, random_l()%1000000000); + } + room_mutex.lock(); + --room_occupancy; + phils[id] = (philosopher*)0L; + room_mutex.unlock(); + room_condition.signal(); + PRINTMSG(cerr << "Philosopher #" << id << " has left the room (" + << room_occupancy << " left)." << endl); } // the destructor of a class that inherits from thread should never be @@ -99,7 +99,7 @@ class philosopher : public thread { inline void* make_arg(const int i) { return (void*)new int(i); } public: philosopher(const int id) : thread(make_arg(id)) { - start(); + start(); } }; @@ -112,9 +112,9 @@ int main(int, char**) room_occupancy = N_DINERS; while (1) { while (room_occupancy == N_DINERS) { - PRINTMSG(cerr << "main thread about to block " << room_occupancy - << endl); - room_condition.wait(); + PRINTMSG(cerr << "main thread about to block " << room_occupancy + << endl); + room_condition.wait(); } // hmm.. someone left the room. room_mutex.unlock(); @@ -124,14 +124,14 @@ int main(int, char**) PRINTMSG(cerr << "main thread wake up" << endl); room_mutex.lock(); for (i=0; i diff --git a/panda/src/ipc/test_priority.cxx b/panda/src/ipc/test_priority.cxx index 39d1566146..0fb752e474 100644 --- a/panda/src/ipc/test_priority.cxx +++ b/panda/src/ipc/test_priority.cxx @@ -43,8 +43,8 @@ int main(int argc, char** argv) } sprintf(buf, "%d.%03d", s2, n2/1000000); cout << argv[0] << ": doing " << loop_iterations - << " loop itterations (approx " << buf << " seconds per loop)" - << endl; + << " loop itterations (approx " << buf << " seconds per loop)" + << endl; PRINTMSG(cout << "main: creating h1" << endl); thread::create(func, (void*)"h1", thread::PRIORITY_HIGH); PRINTMSG(cout << "main: creating m1" << endl); @@ -75,7 +75,7 @@ static void func(void* arg) PRINTMSG(cout << name << ": entering 2nd compute-bound loop" << endl); for (i=0; i&); public: @@ -110,7 +110,7 @@ public: os << "SimpleQueryLerpFunctor<" << get_type_handle(value).get_name() << ">"; register_type(_type_handle, os.str(), - SimpleLerpFunctor::get_class_type()); + SimpleLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -201,7 +201,7 @@ public: static void init_type(void) { LerpFunctor::init_type(); register_type(_type_handle, "MultiLerpFunctor", - LerpFunctor::get_class_type()); + LerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/light/ambientLight.h b/panda/src/light/ambientLight.h index c3f52f1fcb..21d185795a 100644 --- a/panda/src/light/ambientLight.h +++ b/panda/src/light/ambientLight.h @@ -51,7 +51,7 @@ class EXPCL_PANDA AmbientLight : public Light, public NamedNode NamedNode::init_type(); register_type( _type_handle, "AmbientLight", Light::get_class_type(), - NamedNode::get_class_type() ); + NamedNode::get_class_type() ); } virtual TypeHandle get_type( void ) const { return get_class_type(); diff --git a/panda/src/light/directionalLight.h b/panda/src/light/directionalLight.h index b0371cc976..28ecd107b6 100644 --- a/panda/src/light/directionalLight.h +++ b/panda/src/light/directionalLight.h @@ -45,7 +45,7 @@ class EXPCL_PANDA DirectionalLight : public Light, public NamedNode } protected: - + Colorf _specular; public: @@ -58,7 +58,7 @@ class EXPCL_PANDA DirectionalLight : public Light, public NamedNode NamedNode::init_type(); register_type( _type_handle, "DirectionalLight", Light::get_class_type(), - NamedNode::get_class_type() ); + NamedNode::get_class_type() ); } virtual TypeHandle get_type( void ) const { return get_class_type(); diff --git a/panda/src/light/light.h b/panda/src/light/light.h index 417d69993d..0fdade7573 100644 --- a/panda/src/light/light.h +++ b/panda/src/light/light.h @@ -26,22 +26,22 @@ class EXPCL_PANDA Light : virtual public ReferenceCount { PUBLISHED: - - Light( void ) { _color.set(0.0, 0.0, 0.0, 1.0); } - virtual ~Light( void ) { } - INLINE Colorf get_color(void) const { return _color; } - INLINE void set_color(const Colorf& color) { _color = color; } + Light( void ) { _color.set(0.0, 0.0, 0.0, 1.0); } + virtual ~Light( void ) { } - virtual void output(ostream &out) const=0; - virtual void write(ostream &out, int indent_level = 0) const=0; + INLINE Colorf get_color(void) const { return _color; } + INLINE void set_color(const Colorf& color) { _color = color; } + + virtual void output(ostream &out) const=0; + virtual void write(ostream &out, int indent_level = 0) const=0; public: - virtual void apply( GraphicsStateGuardian* gsg ) = 0; + virtual void apply( GraphicsStateGuardian* gsg ) = 0; protected: - Colorf _color; + Colorf _color; public: @@ -49,9 +49,9 @@ class EXPCL_PANDA Light : virtual public ReferenceCount return _type_handle; } static void init_type( void ) { - ReferenceCount::init_type(); + ReferenceCount::init_type(); register_type( _type_handle, "Light", - ReferenceCount::get_class_type() ); + ReferenceCount::get_class_type() ); } virtual TypeHandle get_light_type( void ) const { return get_class_type(); diff --git a/panda/src/light/lightAttribute.cxx b/panda/src/light/lightAttribute.cxx index 07b13740f4..43d7143919 100644 --- a/panda/src/light/lightAttribute.cxx +++ b/panda/src/light/lightAttribute.cxx @@ -74,6 +74,6 @@ output_property(ostream &out, const PT_Light &prop) const { //////////////////////////////////////////////////////////////////// void LightAttribute:: write_property(ostream &out, const PT_Light &prop, - int indent_level) const { + int indent_level) const { prop->write(out, indent_level); } diff --git a/panda/src/light/lightAttribute.h b/panda/src/light/lightAttribute.h index de98546454..63dc91c372 100644 --- a/panda/src/light/lightAttribute.h +++ b/panda/src/light/lightAttribute.h @@ -22,7 +22,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_LIGHT); //////////////////////////////////////////////////////////////////// -// Class : LightAttribute +// Class : LightAttribute // Description : See LightTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA LightAttribute : public MultiAttribute { @@ -39,7 +39,7 @@ public: protected: virtual void output_property(ostream &out, const PT_Light &prop) const; virtual void write_property(ostream &out, const PT_Light &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -52,7 +52,7 @@ public: static void init_type() { MultiAttribute::init_type(); register_type(_type_handle, "LightAttribute", - MultiAttribute::get_class_type()); + MultiAttribute::get_class_type()); } private: diff --git a/panda/src/light/lightNameClass.h b/panda/src/light/lightNameClass.h index a5a9c9d7f3..af42d0b342 100644 --- a/panda/src/light/lightNameClass.h +++ b/panda/src/light/lightNameClass.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LightNameClass +// Class : LightNameClass // Description : This is a stupid little class that's used by // LightTransition to define the name of its // PT(Light) class, so the MultiTransition it diff --git a/panda/src/light/lightTransition.cxx b/panda/src/light/lightTransition.cxx index 5dbab56c9d..3060f41f82 100644 --- a/panda/src/light/lightTransition.cxx +++ b/panda/src/light/lightTransition.cxx @@ -60,6 +60,6 @@ output_property(ostream &out, const PT_Light &prop) const { //////////////////////////////////////////////////////////////////// void LightTransition:: write_property(ostream &out, const PT_Light &prop, - int indent_level) const { + int indent_level) const { prop->write(out, indent_level); } diff --git a/panda/src/light/lightTransition.h b/panda/src/light/lightTransition.h index f62651cb27..0587c4a6af 100644 --- a/panda/src/light/lightTransition.h +++ b/panda/src/light/lightTransition.h @@ -21,7 +21,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTITRANSITION_LIGHT); //////////////////////////////////////////////////////////////////// -// Class : LightTransition +// Class : LightTransition // Description : The LightTransition allows specifying the set of // lights that affect the geometry in the scene graph. // If the set of lights is empty (e.g. under a @@ -42,7 +42,7 @@ public: protected: virtual void output_property(ostream &out, const PT_Light &prop) const; virtual void write_property(ostream &out, const PT_Light &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -55,7 +55,7 @@ public: static void init_type() { MultiTransition::init_type(); register_type(_type_handle, "LightTransition", - MultiTransition::get_class_type()); + MultiTransition::get_class_type()); } private: diff --git a/panda/src/light/pointLight.h b/panda/src/light/pointLight.h index f316faf616..e3fccfff9c 100644 --- a/panda/src/light/pointLight.h +++ b/panda/src/light/pointLight.h @@ -55,7 +55,7 @@ class EXPCL_PANDA PointLight : public Light, public NamedNode protected: - Colorf _specular; + Colorf _specular; float _constant_attenuation; float _linear_attenuation; float _quadratic_attenuation; @@ -70,7 +70,7 @@ class EXPCL_PANDA PointLight : public Light, public NamedNode NamedNode::init_type(); register_type( _type_handle, "PointLight", Light::get_class_type(), - NamedNode::get_class_type() ); + NamedNode::get_class_type() ); } virtual TypeHandle get_type( void ) const { return get_class_type(); diff --git a/panda/src/light/spotlight.cxx b/panda/src/light/spotlight.cxx index 1902af4506..f1e0376cc6 100644 --- a/panda/src/light/spotlight.cxx +++ b/panda/src/light/spotlight.cxx @@ -79,7 +79,7 @@ float Spotlight::get_cutoff_angle(void) const Frustumf frustum; float cutoff = 0; if (proj->get_type() == PerspectiveProjection::get_class_type()) { - frustum = ((PerspectiveProjection *)proj)->get_frustum(); + frustum = ((PerspectiveProjection *)proj)->get_frustum(); cutoff = rad_2_deg(atan(frustum._t / frustum._fnear)); } else @@ -134,9 +134,9 @@ bool Spotlight::make_image(Texture* texture, float radius) float D = dist_from_center; if (D <= radius) intensity = 1.0f; - else if (D < 1.0f) + else if (D < 1.0f) intensity = pow(cos((D-radius) / - (1.0f-radius) * (MathNumbers::pi_f*0.5f)), _exponent); + (1.0f-radius) * (MathNumbers::pi_f*0.5f)), _exponent); else intensity = 0; @@ -205,8 +205,8 @@ make_geometry(float intensity, float length, int num_facets) int i; for (i = 2; i < num_indices-1; i++) { - float sine,cosine; - csincos(ang,&sine,&cosine); + float sine,cosine; + csincos(ang,&sine,&cosine); t = cosine * radius; dx = x_axis * t; t = sine * radius; diff --git a/panda/src/light/spotlight.h b/panda/src/light/spotlight.h index f6f9fcedd8..64af098896 100644 --- a/panda/src/light/spotlight.h +++ b/panda/src/light/spotlight.h @@ -62,15 +62,15 @@ class EXPCL_PANDA Spotlight : public Light, public ProjectionNode bool make_image(Texture* texture, float radius = 0.7); NamedNode* make_geometry(float intensity = 0.05, float length = 20.0, - int num_facets = 36); + int num_facets = 36); protected: float _exponent; Colorf _specular; - float _constant_attenuation; - float _linear_attenuation; - float _quadratic_attenuation; + float _constant_attenuation; + float _linear_attenuation; + float _quadratic_attenuation; public: @@ -81,8 +81,8 @@ class EXPCL_PANDA Spotlight : public Light, public ProjectionNode Light::init_type(); ProjectionNode::init_type(); register_type( _type_handle, "Spotlight", - Light::get_class_type(), - ProjectionNode::get_class_type() ); + Light::get_class_type(), + ProjectionNode::get_class_type() ); } virtual TypeHandle get_type( void ) const { return get_class_type(); diff --git a/panda/src/linmath/compose_matrix_src.I b/panda/src/linmath/compose_matrix_src.I index 42c58aad57..030db962be 100644 --- a/panda/src/linmath/compose_matrix_src.I +++ b/panda/src/linmath/compose_matrix_src.I @@ -12,10 +12,10 @@ //////////////////////////////////////////////////////////////////// INLINE_LINMATH void compose_matrix(FLOATNAME(LMatrix4) &mat, - const FLOATNAME(LVecBase3) &scale, - const FLOATNAME(LVecBase3) &hpr, - const FLOATNAME(LVecBase3) &translate, - CoordinateSystem cs) { + const FLOATNAME(LVecBase3) &scale, + const FLOATNAME(LVecBase3) &hpr, + const FLOATNAME(LVecBase3) &translate, + CoordinateSystem cs) { FLOATNAME(LMatrix3) upper3; compose_matrix(upper3, scale, hpr, cs); mat = FLOATNAME(LMatrix4)(upper3, translate); @@ -23,17 +23,17 @@ compose_matrix(FLOATNAME(LMatrix4) &mat, INLINE_LINMATH void compose_matrix(FLOATNAME(LMatrix4) &mat, - const FLOATTYPE components[9], - CoordinateSystem cs) { + const FLOATTYPE components[9], + CoordinateSystem cs) { FLOATNAME(LVector3) scale(components[0], - components[1], - components[2]); + components[1], + components[2]); FLOATNAME(LVector3) hpr(components[3], - components[4], - components[5]); + components[4], + components[5]); FLOATNAME(LVector3) translate(components[6], - components[7], - components[8]); + components[7], + components[8]); compose_matrix(mat, scale, hpr, translate, cs); } @@ -48,10 +48,10 @@ compose_matrix(FLOATNAME(LMatrix4) &mat, //////////////////////////////////////////////////////////////////// INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATNAME(LVecBase3) &translate, - CoordinateSystem cs) { + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATNAME(LVecBase3) &translate, + CoordinateSystem cs) { // Get the translation first. mat.get_row3(translate,3); return decompose_matrix(mat.get_upper_3(), scale, hpr, cs); @@ -73,11 +73,11 @@ decompose_matrix(const FLOATNAME(LMatrix4) &mat, //////////////////////////////////////////////////////////////////// INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATNAME(LVecBase3) &translate, - FLOATTYPE roll, - CoordinateSystem cs) { + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATNAME(LVecBase3) &translate, + FLOATTYPE roll, + CoordinateSystem cs) { // Get the translation first. mat.get_row3(translate,3); return decompose_matrix(mat.get_upper_3(), scale, hpr, roll, cs); @@ -85,8 +85,8 @@ decompose_matrix(const FLOATNAME(LMatrix4) &mat, INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, - FLOATTYPE components[9], - CoordinateSystem cs) { + FLOATTYPE components[9], + CoordinateSystem cs) { FLOATNAME(LVector3) scale, hpr, translate; if (!decompose_matrix(mat, scale, hpr, translate, cs)) { return false; diff --git a/panda/src/linmath/compose_matrix_src.cxx b/panda/src/linmath/compose_matrix_src.cxx index 6338744fb9..88affadbb0 100644 --- a/panda/src/linmath/compose_matrix_src.cxx +++ b/panda/src/linmath/compose_matrix_src.cxx @@ -10,9 +10,9 @@ //////////////////////////////////////////////////////////////////// void compose_matrix(FLOATNAME(LMatrix3) &mat, - const FLOATNAME(LVecBase3) &scale, - const FLOATNAME(LVecBase3) &hpr, - CoordinateSystem cs) { + const FLOATNAME(LVecBase3) &scale, + const FLOATNAME(LVecBase3) &hpr, + CoordinateSystem cs) { // temp_hpr_fix blocks use the correct way. need to keep other way as default until // legacy tools are fixed to work with correct way @@ -62,7 +62,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the heading, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_y; y = y * rot_y; @@ -78,7 +78,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_x; y = y * rot_x; @@ -94,7 +94,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the roll from the axes, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-roll, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_yup_right); + CS_yup_right); x = x * rot_z; y = y * rot_z; @@ -127,7 +127,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the roll from the axes, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-roll, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_yup_right); + CS_yup_right); x = x * rot_z; y = y * rot_z; @@ -144,7 +144,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the heading, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_y; y = y * rot_y; @@ -160,7 +160,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_x; y = y * rot_x; @@ -190,7 +190,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { //////////////////////////////////////////////////////////////////// static void unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, - FLOATTYPE roll) { + FLOATTYPE roll) { if (temp_hpr_fix) { unwind_yup_rotation(mat, hpr); return; @@ -207,7 +207,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the roll from the axes, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-roll, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_yup_right); + CS_yup_right); x = x * rot_z; y = y * rot_z; @@ -224,7 +224,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the heading, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_y; y = y * rot_y; @@ -240,7 +240,7 @@ unwind_yup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_yup_right); + CS_yup_right); x = x * rot_x; y = y * rot_x; @@ -288,7 +288,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the heading, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_zup_right); + CS_zup_right); x = x * rot_z; y = y * rot_z; @@ -304,7 +304,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_x; y = y * rot_x; @@ -320,7 +320,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the roll from the axes, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(-roll, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_y; y = y * rot_y; @@ -355,16 +355,16 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { if (y[1] < 0.0f) { if (roll < 0.0f) { - roll += 180.0; + roll += 180.0; } else { - roll -= 180.0; + roll -= 180.0; } } // Unwind the roll from the axes, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(roll, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_y; y = y * rot_y; @@ -381,7 +381,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the heading, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_zup_right); + CS_zup_right); x = x * rot_z; y = y * rot_z; @@ -397,7 +397,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_x; y = y * rot_x; @@ -427,7 +427,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr) { //////////////////////////////////////////////////////////////////// static void unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, - FLOATTYPE roll) { + FLOATTYPE roll) { if (temp_hpr_fix) { unwind_zup_rotation(mat, hpr); return; @@ -444,7 +444,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the roll from the axes, and continue. Matrix rot_y; rot_y = Matrix::rotate_mat_normaxis(roll, FLOATNAME(LVector3)(0.0f, 1.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_y; y = y * rot_y; @@ -461,7 +461,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the heading, and continue. Matrix rot_z; rot_z = Matrix::rotate_mat_normaxis(-heading, FLOATNAME(LVector3)(0.0f, 0.0f, 1.0f), - CS_zup_right); + CS_zup_right); x = x * rot_z; y = y * rot_z; @@ -477,7 +477,7 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, // Unwind the pitch. Matrix rot_x; rot_x = Matrix::rotate_mat_normaxis(-pitch, FLOATNAME(LVector3)(1.0f, 0.0f, 0.0f), - CS_zup_right); + CS_zup_right); x = x * rot_x; y = y * rot_x; @@ -503,9 +503,9 @@ unwind_zup_rotation(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVecBase3) &hpr, //////////////////////////////////////////////////////////////////// bool decompose_matrix(const FLOATNAME(LMatrix3) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - CoordinateSystem cs) { + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; } @@ -520,46 +520,46 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, case CS_zup_right: { unwind_zup_rotation(new_mat, hpr); - bIsLeftHandedMat = false; + bIsLeftHandedMat = false; } break; case CS_yup_right: { unwind_yup_rotation(new_mat, hpr); - bIsLeftHandedMat = false; - } + bIsLeftHandedMat = false; + } break; case CS_zup_left: { - new_mat._m.m._02 = -new_mat._m.m._02; - new_mat._m.m._12 = -new_mat._m.m._12; - new_mat._m.m._20 = -new_mat._m.m._20; - new_mat._m.m._21 = -new_mat._m.m._21; + new_mat._m.m._02 = -new_mat._m.m._02; + new_mat._m.m._12 = -new_mat._m.m._12; + new_mat._m.m._20 = -new_mat._m.m._20; + new_mat._m.m._21 = -new_mat._m.m._21; /* FLOATNAME(LMatrix3) lm(mat(0, 0), mat(0, 1), -mat(0, 2), - mat(1, 0), mat(1, 1), -mat(1, 2), - -mat(2, 0), -mat(2, 1), mat(2, 2)); -*/ + mat(1, 0), mat(1, 1), -mat(1, 2), + -mat(2, 0), -mat(2, 1), mat(2, 2)); +*/ unwind_zup_rotation(new_mat, hpr); - bIsLeftHandedMat = true; + bIsLeftHandedMat = true; } break; case CS_yup_left: { - new_mat._m.m._02 = -new_mat._m.m._02; - new_mat._m.m._12 = -new_mat._m.m._12; - new_mat._m.m._20 = -new_mat._m.m._20; - new_mat._m.m._21 = -new_mat._m.m._21; + new_mat._m.m._02 = -new_mat._m.m._02; + new_mat._m.m._12 = -new_mat._m.m._12; + new_mat._m.m._20 = -new_mat._m.m._20; + new_mat._m.m._21 = -new_mat._m.m._21; /* FLOATNAME(LMatrix3) lm(mat(0, 0), mat(0, 1), -mat(0, 2), - mat(1, 0), mat(1, 1), -mat(1, 2), - -mat(2, 0), -mat(2, 1), mat(2, 2)); -*/ + mat(1, 0), mat(1, 1), -mat(1, 2), + -mat(2, 0), -mat(2, 1), mat(2, 2)); +*/ unwind_yup_rotation(new_mat, hpr); - bIsLeftHandedMat = true; + bIsLeftHandedMat = true; } break; @@ -571,17 +571,17 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, scale[2] = new_mat._m.m._22; if(bIsLeftHandedMat) { - scale[0] = -new_mat._m.m._00; - scale[1] = -new_mat._m.m._11; + scale[0] = -new_mat._m.m._00; + scale[1] = -new_mat._m.m._11; } else { - scale[0] = new_mat._m.m._00; - scale[1] = new_mat._m.m._11; + scale[0] = new_mat._m.m._00; + scale[1] = new_mat._m.m._11; } bMatHasNoShear = - (fabs(new_mat(0, 1)) + fabs(new_mat(0, 2)) + - fabs(new_mat(1, 0)) + fabs(new_mat(1, 2)) + - fabs(new_mat(2, 0)) + fabs(new_mat(2, 1))) < 0.0001; + (fabs(new_mat(0, 1)) + fabs(new_mat(0, 2)) + + fabs(new_mat(1, 0)) + fabs(new_mat(1, 2)) + + fabs(new_mat(2, 0)) + fabs(new_mat(2, 1))) < 0.0001; return bMatHasNoShear; } @@ -601,10 +601,10 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, //////////////////////////////////////////////////////////////////// bool decompose_matrix(const FLOATNAME(LMatrix3) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATTYPE roll, - CoordinateSystem cs) { + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATTYPE roll, + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; } @@ -619,46 +619,46 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, case CS_zup_right: { unwind_zup_rotation(new_mat, hpr, roll); - bIsLeftHandedMat = false; + bIsLeftHandedMat = false; } break; case CS_yup_right: { unwind_yup_rotation(new_mat, hpr, roll); - bIsLeftHandedMat = false; - } + bIsLeftHandedMat = false; + } break; case CS_zup_left: { - new_mat._m.m._02 = -new_mat._m.m._02; - new_mat._m.m._12 = -new_mat._m.m._12; - new_mat._m.m._20 = -new_mat._m.m._20; - new_mat._m.m._21 = -new_mat._m.m._21; + new_mat._m.m._02 = -new_mat._m.m._02; + new_mat._m.m._12 = -new_mat._m.m._12; + new_mat._m.m._20 = -new_mat._m.m._20; + new_mat._m.m._21 = -new_mat._m.m._21; /* FLOATNAME(LMatrix3) lm(mat(0, 0), mat(0, 1), -mat(0, 2), - mat(1, 0), mat(1, 1), -mat(1, 2), - -mat(2, 0), -mat(2, 1), mat(2, 2)); -*/ + mat(1, 0), mat(1, 1), -mat(1, 2), + -mat(2, 0), -mat(2, 1), mat(2, 2)); +*/ unwind_zup_rotation(new_mat, hpr, roll); - bIsLeftHandedMat = true; + bIsLeftHandedMat = true; } break; case CS_yup_left: { - new_mat._m.m._02 = -new_mat._m.m._02; - new_mat._m.m._12 = -new_mat._m.m._12; - new_mat._m.m._20 = -new_mat._m.m._20; - new_mat._m.m._21 = -new_mat._m.m._21; + new_mat._m.m._02 = -new_mat._m.m._02; + new_mat._m.m._12 = -new_mat._m.m._12; + new_mat._m.m._20 = -new_mat._m.m._20; + new_mat._m.m._21 = -new_mat._m.m._21; /* FLOATNAME(LMatrix3) lm(mat(0, 0), mat(0, 1), -mat(0, 2), - mat(1, 0), mat(1, 1), -mat(1, 2), - -mat(2, 0), -mat(2, 1), mat(2, 2)); -*/ + mat(1, 0), mat(1, 1), -mat(1, 2), + -mat(2, 0), -mat(2, 1), mat(2, 2)); +*/ unwind_yup_rotation(new_mat, hpr, roll); - bIsLeftHandedMat = true; + bIsLeftHandedMat = true; } break; @@ -670,17 +670,17 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat, scale[2] = new_mat._m.m._22; if(bIsLeftHandedMat) { - scale[0] = -new_mat._m.m._00; - scale[1] = -new_mat._m.m._11; + scale[0] = -new_mat._m.m._00; + scale[1] = -new_mat._m.m._11; } else { - scale[0] = new_mat._m.m._00; - scale[1] = new_mat._m.m._11; + scale[0] = new_mat._m.m._00; + scale[1] = new_mat._m.m._11; } bMatHasNoShear = - (fabs(new_mat(0, 1)) + fabs(new_mat(0, 2)) + - fabs(new_mat(1, 0)) + fabs(new_mat(1, 2)) + - fabs(new_mat(2, 0)) + fabs(new_mat(2, 1))) < 0.0001; + (fabs(new_mat(0, 1)) + fabs(new_mat(0, 2)) + + fabs(new_mat(1, 0)) + fabs(new_mat(1, 2)) + + fabs(new_mat(2, 0)) + fabs(new_mat(2, 1))) < 0.0001; return bMatHasNoShear; } diff --git a/panda/src/linmath/compose_matrix_src.h b/panda/src/linmath/compose_matrix_src.h index 140fd84f3f..abbec450f0 100644 --- a/panda/src/linmath/compose_matrix_src.h +++ b/panda/src/linmath/compose_matrix_src.h @@ -8,52 +8,52 @@ BEGIN_PUBLISH EXPCL_PANDA void compose_matrix(FLOATNAME(LMatrix3) &mat, - const FLOATNAME(LVecBase3) &scale, - const FLOATNAME(LVecBase3) &hpr, - CoordinateSystem cs = CS_default); + const FLOATNAME(LVecBase3) &scale, + const FLOATNAME(LVecBase3) &hpr, + CoordinateSystem cs = CS_default); INLINE_LINMATH void compose_matrix(FLOATNAME(LMatrix4) &mat, - const FLOATNAME(LVecBase3) &scale, - const FLOATNAME(LVecBase3) &hpr, - const FLOATNAME(LVecBase3) &translate, - CoordinateSystem cs = CS_default); + const FLOATNAME(LVecBase3) &scale, + const FLOATNAME(LVecBase3) &hpr, + const FLOATNAME(LVecBase3) &translate, + CoordinateSystem cs = CS_default); INLINE_LINMATH void compose_matrix(FLOATNAME(LMatrix4) &mat, const FLOATTYPE components[9], - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); EXPCL_PANDA bool decompose_matrix(const FLOATNAME(LMatrix3) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + CoordinateSystem cs = CS_default); EXPCL_PANDA bool decompose_matrix(const FLOATNAME(LMatrix3) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATTYPE roll, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATTYPE roll, + CoordinateSystem cs = CS_default); INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATNAME(LVecBase3) &translate, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATNAME(LVecBase3) &translate, + CoordinateSystem cs = CS_default); INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, - FLOATNAME(LVecBase3) &scale, - FLOATNAME(LVecBase3) &hpr, - FLOATNAME(LVecBase3) &translate, - FLOATTYPE roll, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) &scale, + FLOATNAME(LVecBase3) &hpr, + FLOATNAME(LVecBase3) &translate, + FLOATTYPE roll, + CoordinateSystem cs = CS_default); INLINE_LINMATH bool decompose_matrix(const FLOATNAME(LMatrix4) &mat, FLOATTYPE components[9], - CoordinateSystem CS = CS_default); + CoordinateSystem CS = CS_default); END_PUBLISH diff --git a/panda/src/linmath/ioPtaDatagramLinMath.h b/panda/src/linmath/ioPtaDatagramLinMath.h index 7076e53464..f49f819f93 100644 --- a/panda/src/linmath/ioPtaDatagramLinMath.h +++ b/panda/src/linmath/ioPtaDatagramLinMath.h @@ -20,7 +20,7 @@ class Datagram; class DatagramIterator; /////////////////////////////////////////////////////////////////// -// Class : IoPtaDatagramLinMath +// Class : IoPtaDatagramLinMath // Description : This class is used to read and write a PTA_something // (where something is some kind of LinMath object like // LMatrix4f or LVector3f) from a Datagram, in support diff --git a/panda/src/linmath/lmatrix3_src.I b/panda/src/linmath/lmatrix3_src.I index 3c6f5096ec..54a67bfe40 100644 --- a/panda/src/linmath/lmatrix3_src.I +++ b/panda/src/linmath/lmatrix3_src.I @@ -32,7 +32,7 @@ FLOATNAME(LMatrix3)() { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3):: FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) ©) { - memcpy(_m.data,copy._m.data,sizeof(_m.data)); + memcpy(_m.data,copy._m.data,sizeof(_m.data)); // (*this) = copy; } @@ -68,8 +68,8 @@ operator = (FLOATTYPE fill_value) { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3):: FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) { + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) { _m.m._00 = e00; _m.m._01 = e01; _m.m._02 = e02; @@ -408,17 +408,17 @@ INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3):: xform(const FLOATNAME(LVecBase3) &v) const { FLOATNAME(LVecBase3) v_res; - - - VECTOR3_MATRIX3_PRODUCT(v_res, v,(*this)); + + + VECTOR3_MATRIX3_PRODUCT(v_res, v,(*this)); - return v_res; + return v_res; // return FLOATNAME(LVecBase3)(v.dot(get_col(0)), -// v.dot(get_col(1)), -// v.dot(get_col(2))); +// v.dot(get_col(1)), +// v.dot(get_col(2))); } //////////////////////////////////////////////////////////////////// @@ -431,17 +431,17 @@ xform(const FLOATNAME(LVecBase3) &v) const { INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LMatrix3):: xform_point(const FLOATNAME(LVecBase2) &v) const { - FLOATNAME(LVecBase2) v_res; + FLOATNAME(LVecBase2) v_res; - // v._v.v._2 == 1.0f for this case + // v._v.v._2 == 1.0f for this case - v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + _m.m._20; - v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + _m.m._21; + v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + _m.m._20; + v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + _m.m._21; - return v_res; + return v_res; // return FLOATNAME(LVecBase2)(v.dot(get_col2(0)) + _m.m._20, -// v.dot(get_col2(1)) + _m.m._21); +// v.dot(get_col2(1)) + _m.m._21); } //////////////////////////////////////////////////////////////////// @@ -454,17 +454,17 @@ xform_point(const FLOATNAME(LVecBase2) &v) const { INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LMatrix3):: xform_vec(const FLOATNAME(LVecBase2) &v) const { - FLOATNAME(LVecBase2) v_res; + FLOATNAME(LVecBase2) v_res; - // v._v.v._2 == 0.0f for this case + // v._v.v._2 == 0.0f for this case - v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10; - v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11; + v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10; + v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11; - return v_res; + return v_res; // return FLOATNAME(LVecBase2)(v.dot(get_col2(0)), -// v.dot(get_col2(1))); +// v.dot(get_col2(1))); } //////////////////////////////////////////////////////////////////// @@ -498,9 +498,9 @@ res._m.m._22 = a._m.m._20*b._m.m._02 + a._m.m._21*b._m.m._12 + a._m.m._22*b._m.m //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: operator * (const FLOATNAME(LMatrix3) &other) const { - FLOATNAME(LMatrix3) t; + FLOATNAME(LMatrix3) t; - MATRIX3_PRODUCT(t,(*this),other); + MATRIX3_PRODUCT(t,(*this),other); /* typedef union { struct { @@ -509,16 +509,16 @@ typedef union { FLOATTYPE _m.m._31, _m.m._32, _m.m._33; }; - FLOATTYPE m[3][3]; + FLOATTYPE m[3][3]; } MYMATRIX3; - FLOATNAME(LMatrix3) t; + FLOATNAME(LMatrix3) t; - MYMATRIX3 *result_ptr=(MYMATRIX3 *)t.get_m.data(); - MYMATRIX3 *mat1_ptr=(MYMATRIX3 *)this->get_m.data(); - MYMATRIX3 *mat2_ptr=(MYMATRIX3 *)other.get_m.data(); + MYMATRIX3 *result_ptr=(MYMATRIX3 *)t.get_m.data(); + MYMATRIX3 *mat1_ptr=(MYMATRIX3 *)this->get_m.data(); + MYMATRIX3 *mat2_ptr=(MYMATRIX3 *)other.get_m.data(); - MATRIX3_PRODUCT(result_ptr,mat1_ptr,mat2_ptr); + MATRIX3_PRODUCT(result_ptr,mat1_ptr,mat2_ptr); */ /* t(0, 0) = mult_cel(other, 0, 0); @@ -764,7 +764,7 @@ transpose_in_place() { INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3):: det2(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e10, FLOATTYPE e11) const { // return (e00 * e11 - e10 * e01); - return DET2(e00,e01,e10,e11); + return DET2(e00,e01,e10,e11); } //////////////////////////////////////////////////////////////////// @@ -851,8 +851,8 @@ invert_in_place() { INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: translate_mat(const FLOATNAME(LVecBase2) &trans) { return FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - trans._v.v._0, trans._v.v._1, 1.0f); + 0.0f, 1.0f, 0.0f, + trans._v.v._0, trans._v.v._1, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -864,8 +864,8 @@ translate_mat(const FLOATNAME(LVecBase2) &trans) { INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: translate_mat(FLOATTYPE tx, FLOATTYPE ty) { return FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - tx, ty, 1.0f); + 0.0f, 1.0f, 0.0f, + tx, ty, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -880,8 +880,8 @@ rotate_mat(FLOATTYPE angle) { FLOATTYPE s,c; csincos(angle_rad,&s,&c); return FLOATNAME(LMatrix3)( c, s, 0.0f, - -s, c, 0.0f, - 0.0f, 0.0f, 1.0f); + -s, c, 0.0f, + 0.0f, 0.0f, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -893,8 +893,8 @@ rotate_mat(FLOATTYPE angle) { INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: scale_mat(const FLOATNAME(LVecBase2) &scale) { return FLOATNAME(LMatrix3)(scale._v.v._0, 0.0f, 0.0f, - 0.0f, scale._v.v._1, 0.0f, - 0.0f, 0.0f, 1.0f); + 0.0f, scale._v.v._1, 0.0f, + 0.0f, 0.0f, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -906,8 +906,8 @@ scale_mat(const FLOATNAME(LVecBase2) &scale) { INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: scale_mat(FLOATTYPE sx, FLOATTYPE sy) { return FLOATNAME(LMatrix3)(sx, 0.0f, 0.0f, - 0.0f, sy, 0.0f, - 0.0f, 0.0f, 1.0f); + 0.0f, sy, 0.0f, + 0.0f, 0.0f, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -918,7 +918,7 @@ scale_mat(FLOATTYPE sx, FLOATTYPE sy) { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis, - CoordinateSystem cs) { + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; } @@ -997,7 +997,7 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis, //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, - CoordinateSystem cs) { + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; } @@ -1065,8 +1065,8 @@ rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: scale_mat(const FLOATNAME(LVecBase3) &scale) { return FLOATNAME(LMatrix3)(scale[0], 0.0f, 0.0f, - 0.0f, scale._v.v._1, 0.0f, - 0.0f, 0.0f, scale._v.v._2); + 0.0f, scale._v.v._1, 0.0f, + 0.0f, 0.0f, scale._v.v._2); } //////////////////////////////////////////////////////////////////// @@ -1078,8 +1078,8 @@ scale_mat(const FLOATNAME(LVecBase3) &scale) { INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3):: scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz) { return FLOATNAME(LMatrix3)(sx, 0.0f, 0.0f, - 0.0f, sy, 0.0f, - 0.0f, 0.0f, sz); + 0.0f, sy, 0.0f, + 0.0f, 0.0f, sz); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lmatrix3_src.cxx b/panda/src/linmath/lmatrix3_src.cxx index f4035ec53b..41de8e835f 100644 --- a/panda/src/linmath/lmatrix3_src.cxx +++ b/panda/src/linmath/lmatrix3_src.cxx @@ -7,8 +7,8 @@ TypeHandle FLOATNAME(LMatrix3)::_type_handle; FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::_ident_mat = FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 1.0f); + 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 1.0f); //////////////////////////////////////////////////////////////////// // Function: LMatrix3::fill @@ -52,14 +52,14 @@ compare_to(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const { bool FLOATNAME(LMatrix3):: almost_equal(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL((*this)(0, 0), other(0, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(0, 1), other(0, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(0, 2), other(0, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 0), other(1, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 1), other(1, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 2), other(1, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 0), other(2, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 1), other(2, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 2), other(2, 2), threshold)); + IS_THRESHOLD_EQUAL((*this)(0, 1), other(0, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(0, 2), other(0, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 0), other(1, 0), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 1), other(1, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 2), other(1, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 0), other(2, 0), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 1), other(2, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 2), other(2, 2), threshold)); } diff --git a/panda/src/linmath/lmatrix3_src.h b/panda/src/linmath/lmatrix3_src.h index 165758cf48..9c257ff6ae 100644 --- a/panda/src/linmath/lmatrix3_src.h +++ b/panda/src/linmath/lmatrix3_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LMatrix3 +// Class : LMatrix3 // Description : This is a 3-by-3 transform matrix. It typically will // represent either a rotation-and-scale (no // translation) matrix in 3-d, or a full affine matrix @@ -21,13 +21,13 @@ PUBLISHED: INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (const FLOATNAME(LMatrix3) &other); INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (FLOATTYPE fill_value); INLINE_LINMATH FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); void fill(FLOATTYPE fill_value); INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase3) &v); INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase3) &v); @@ -132,12 +132,12 @@ PUBLISHED: // scale/rotate transforms in 3-d coordinate space. static INLINE_LINMATH FLOATNAME(LMatrix3) rotate_mat(FLOATTYPE angle, - FLOATNAME(LVecBase3) axis, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) axis, + CoordinateSystem cs = CS_default); static INLINE_LINMATH FLOATNAME(LMatrix3) rotate_mat_normaxis(FLOATTYPE angle, - const FLOATNAME(LVecBase3) &axis, - CoordinateSystem cs = CS_default); + const FLOATNAME(LVecBase3) &axis, + CoordinateSystem cs = CS_default); static INLINE_LINMATH FLOATNAME(LMatrix3) scale_mat(const FLOATNAME(LVecBase3) &scale); @@ -149,7 +149,7 @@ PUBLISHED: // a 3-d scale. bool almost_equal(const FLOATNAME(LMatrix3) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH bool almost_equal(const FLOATNAME(LMatrix3) &other) const; @@ -163,12 +163,12 @@ public: public: union { struct { - FLOATTYPE _00, _01, _02; + FLOATTYPE _00, _01, _02; FLOATTYPE _10, _11, _12; FLOATTYPE _20, _21, _22; } m; - FLOATTYPE data[3 * 3]; + FLOATTYPE data[3 * 3]; } _m; private: diff --git a/panda/src/linmath/lmatrix4_src.I b/panda/src/linmath/lmatrix4_src.I index 91ffae1810..048bb3c7d4 100644 --- a/panda/src/linmath/lmatrix4_src.I +++ b/panda/src/linmath/lmatrix4_src.I @@ -71,9 +71,9 @@ operator = (FLOATTYPE fill_value) { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4):: FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, - FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33) { + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, + FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33) { _m.m._00 = e00; _m.m._01 = e01; @@ -137,7 +137,7 @@ FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3) { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4):: FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3, - const FLOATNAME(LVecBase3) &trans) { + const FLOATNAME(LVecBase3) &trans) { _m.m._00 = upper3._m.m._00; _m.m._01 = upper3._m.m._01; @@ -308,9 +308,9 @@ set_col(int col, const FLOATNAME(LVecBase3) &v) { INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LMatrix4):: get_row(int row) const { return FLOATNAME(LVecBase4)((*this)(row, 0), - (*this)(row, 1), - (*this)(row, 2), - (*this)(row, 3)); + (*this)(row, 1), + (*this)(row, 2), + (*this)(row, 3)); } INLINE_LINMATH void FLOATNAME(LMatrix4):: @@ -330,9 +330,9 @@ get_row(FLOATNAME(LVecBase4) &result_vec,int row) const { INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LMatrix4):: get_col(int col) const { return FLOATNAME(LVecBase4)((*this)(0, col), - (*this)(1, col), - (*this)(2, col), - (*this)(3, col)); + (*this)(1, col), + (*this)(2, col), + (*this)(3, col)); } //////////////////////////////////////////////////////////////////// @@ -344,8 +344,8 @@ get_col(int col) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix4):: get_row3(int row) const { return FLOATNAME(LVecBase3)((*this)(row, 0), - (*this)(row, 1), - (*this)(row, 2)); + (*this)(row, 1), + (*this)(row, 2)); } INLINE_LINMATH void FLOATNAME(LMatrix4):: @@ -364,8 +364,8 @@ get_row3(FLOATNAME(LVecBase3) &result_vec,int row) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix4):: get_col3(int col) const { return FLOATNAME(LVecBase3)((*this)(0, col), - (*this)(1, col), - (*this)(2, col)); + (*this)(1, col), + (*this)(2, col)); } //////////////////////////////////////////////////////////////////// @@ -558,14 +558,14 @@ INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LMatrix4):: xform(const FLOATNAME(LVecBase4) &v) const { FLOATNAME(LVecBase4) v_res; - VECTOR4_MATRIX4_PRODUCT(v_res, v,(*this)); - return v_res; + VECTOR4_MATRIX4_PRODUCT(v_res, v,(*this)); + return v_res; /* return FLOATNAME(LVecBase4)(v.dot(get_col(0)), - v.dot(get_col(1)), - v.dot(get_col(2)), - v.dot(get_col(3))); -*/ + v.dot(get_col(1)), + v.dot(get_col(2)), + v.dot(get_col(3))); +*/ } //////////////////////////////////////////////////////////////////// @@ -578,21 +578,21 @@ xform(const FLOATNAME(LVecBase4) &v) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix4):: xform_point(const FLOATNAME(LVecBase3) &v) const { - FLOATNAME(LVecBase3) v_res; + FLOATNAME(LVecBase3) v_res; - // v._v.v._3 == 1.0f for this case + // v._v.v._3 == 1.0f for this case - v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + v._v.v._2*_m.m._20 + _m.m._30; - v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + v._v.v._2*_m.m._21 + _m.m._31; - v_res._v.v._2 = v._v.v._0*_m.m._02 + v._v.v._1*_m.m._12 + v._v.v._2*_m.m._22 + _m.m._32; + v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + v._v.v._2*_m.m._20 + _m.m._30; + v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + v._v.v._2*_m.m._21 + _m.m._31; + v_res._v.v._2 = v._v.v._0*_m.m._02 + v._v.v._1*_m.m._12 + v._v.v._2*_m.m._22 + _m.m._32; - return v_res; + return v_res; /* return FLOATNAME(LVecBase3)(v.dot(get_col3(0)) + _m.m._30, - v.dot(get_col3(1)) + _m.m._31, - v.dot(get_col3(2)) + _m.m._32); -*/ + v.dot(get_col3(1)) + _m.m._31, + v.dot(get_col3(2)) + _m.m._32); +*/ } //////////////////////////////////////////////////////////////////// @@ -604,20 +604,20 @@ xform_point(const FLOATNAME(LVecBase3) &v) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix4):: xform_vec(const FLOATNAME(LVecBase3) &v) const { - FLOATNAME(LVecBase3) v_res; + FLOATNAME(LVecBase3) v_res; - // v._v.v._3 == 0.0f for this case + // v._v.v._3 == 0.0f for this case - v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + v._v.v._2*_m.m._20; - v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + v._v.v._2*_m.m._21; - v_res._v.v._2 = v._v.v._0*_m.m._02 + v._v.v._1*_m.m._12 + v._v.v._2*_m.m._22; + v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + v._v.v._2*_m.m._20; + v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + v._v.v._2*_m.m._21; + v_res._v.v._2 = v._v.v._0*_m.m._02 + v._v.v._1*_m.m._12 + v._v.v._2*_m.m._22; - return v_res; + return v_res; /* return FLOATNAME(LVecBase3)(v.dot(get_col3(0)), - v.dot(get_col3(1)), - v.dot(get_col3(2))); -*/ + v.dot(get_col3(1)), + v.dot(get_col3(2))); +*/ } //////////////////////////////////////////////////////////////////// @@ -659,9 +659,9 @@ res._m.m._33 = a._m.m._30*b._m.m._03 + a._m.m._31*b._m.m._13 + a._m.m._32*b._m.m //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: operator * (const FLOATNAME(LMatrix4) &other) const { - FLOATNAME(LMatrix4) t; + FLOATNAME(LMatrix4) t; - MATRIX4_PRODUCT(t,(*this),other); + MATRIX4_PRODUCT(t,(*this),other); /* typedef union { struct { @@ -671,16 +671,16 @@ typedef union { FLOATTYPE _m.m._41, _m.m._42, _m.m._43, _m.m._44; }; - FLOATTYPE m[4][4]; + FLOATTYPE m[4][4]; } MYMATRIX4; - FLOATNAME(LMatrix4) t; + FLOATNAME(LMatrix4) t; - MYMATRIX4 *result_ptr=(MYMATRIX4 *)t.get_m.data(); - MYMATRIX4 *mat1_ptr=(MYMATRIX4 *)this->get_m.data(); - MYMATRIX4 *mat2_ptr=(MYMATRIX4 *)other.get_m.data(); + MYMATRIX4 *result_ptr=(MYMATRIX4 *)t.get_m.data(); + MYMATRIX4 *mat1_ptr=(MYMATRIX4 *)this->get_m.data(); + MYMATRIX4 *mat2_ptr=(MYMATRIX4 *)other.get_m.data(); - MATRIX4_PRODUCT(result_ptr,mat1_ptr,mat2_ptr); + MATRIX4_PRODUCT(result_ptr,mat1_ptr,mat2_ptr); */ /* @@ -1090,11 +1090,11 @@ invert_affine_from(const FLOATNAME(LMatrix4) &other) { other._m.m._32 * _m.m._20); _m.m._31 = -(other._m.m._30 * _m.m._01 + - other._m.m._31 * _m.m._11 + + other._m.m._31 * _m.m._11 + other._m.m._32 * _m.m._21); _m.m._32 = -(other._m.m._30 * _m.m._02 + - other._m.m._31 * _m.m._12 + + other._m.m._31 * _m.m._12 + other._m.m._32 * _m.m._22); return true; @@ -1122,9 +1122,9 @@ invert_in_place() { INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: translate_mat(const FLOATNAME(LVecBase3) &trans) { return FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - trans._v.v._0, trans._v.v._1, trans._v.v._2, 1.0f); + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + trans._v.v._0, trans._v.v._1, trans._v.v._2, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -1136,9 +1136,9 @@ translate_mat(const FLOATNAME(LVecBase3) &trans) { INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: translate_mat(FLOATTYPE tx, FLOATTYPE ty, FLOATTYPE tz) { return FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - tx, ty, tz, 1.0f); + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + tx, ty, tz, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -1149,7 +1149,7 @@ translate_mat(FLOATTYPE tx, FLOATTYPE ty, FLOATTYPE tz) { //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis, - CoordinateSystem cs) { + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; @@ -1177,15 +1177,15 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis, if((cabs(axis_0)+cabs(axis_1)+cabs(axis_2)) != 1.0f) { */ - FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2; - #ifdef _DEBUG - nassertr(length_sq != 0.0f, ident_mat()); - #endif - FLOATTYPE recip_length = 1.0f/csqrt(length_sq); + FLOATTYPE length_sq = axis_0 * axis_0 + axis_1 * axis_1 + axis_2 * axis_2; + #ifdef _DEBUG + nassertr(length_sq != 0.0f, ident_mat()); + #endif + FLOATTYPE recip_length = 1.0f/csqrt(length_sq); - axis_0 *= recip_length; - axis_1 *= recip_length; - axis_2 *= recip_length; + axis_0 *= recip_length; + axis_1 *= recip_length; + axis_2 *= recip_length; // } FLOATTYPE angle_rad=deg_2_rad(angle); @@ -1236,7 +1236,7 @@ rotate_mat(FLOATTYPE angle, FLOATNAME(LVecBase3) axis, //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, - CoordinateSystem cs) { + CoordinateSystem cs) { FLOATNAME(LMatrix4) mat; rotate_mat_normaxis(angle,axis,mat,cs); @@ -1245,7 +1245,7 @@ rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, INLINE_LINMATH void FLOATNAME(LMatrix4):: rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, - FLOATNAME(LMatrix4) &result_mat, CoordinateSystem cs) { + FLOATNAME(LMatrix4) &result_mat, CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; @@ -1306,9 +1306,9 @@ rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis, INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: scale_mat(const FLOATNAME(LVecBase3) &scale) { return FLOATNAME(LMatrix4)(scale._v.v._0, 0.0f, 0.0f, 0.0f, - 0.0f, scale._v.v._1, 0.0f, 0.0f, - 0.0f, 0.0f, scale._v.v._2, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + 0.0f, scale._v.v._1, 0.0f, 0.0f, + 0.0f, 0.0f, scale._v.v._2, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); } @@ -1321,10 +1321,10 @@ scale_mat(const FLOATNAME(LVecBase3) &scale) { INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz) { return FLOATNAME(LMatrix4)( - sx, 0.0f, 0.0f, 0.0f, - 0.0f, sy, 0.0f, 0.0f, - 0.0f, 0.0f, sz, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + sx, 0.0f, 0.0f, 0.0f, + 0.0f, sy, 0.0f, 0.0f, + 0.0f, 0.0f, sz, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); } //////////////////////////////////////////////////////////////////// @@ -1336,10 +1336,10 @@ scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz) { INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LMatrix4):: scale_mat(FLOATTYPE scale) { return FLOATNAME(LMatrix4)( - scale, 0.0f, 0.0f, 0.0f, - 0.0f, scale, 0.0f, 0.0f, - 0.0f, 0.0f, scale, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + scale, 0.0f, 0.0f, 0.0f, + 0.0f, scale, 0.0f, 0.0f, + 0.0f, 0.0f, scale, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lmatrix4_src.cxx b/panda/src/linmath/lmatrix4_src.cxx index 298c2d0730..200add732b 100644 --- a/panda/src/linmath/lmatrix4_src.cxx +++ b/panda/src/linmath/lmatrix4_src.cxx @@ -7,21 +7,21 @@ TypeHandle FLOATNAME(LMatrix4)::_type_handle; const FLOATNAME(LMatrix4) FLOATNAME(LMatrix4)::_ident_mat = FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); const FLOATNAME(LMatrix4) FLOATNAME(LMatrix4)::_y_to_z_up_mat = FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f,-1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f,-1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); const FLOATNAME(LMatrix4) FLOATNAME(LMatrix4)::_z_to_y_up_mat = FLOATNAME(LMatrix4)(1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f,-1.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + 0.0f, 0.0f,-1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); //////////////////////////////////////////////////////////////////// // Function: LMatrix::convert_mat @@ -115,21 +115,21 @@ compare_to(const FLOATNAME(LMatrix4) &other, FLOATTYPE threshold) const { bool FLOATNAME(LMatrix4):: almost_equal(const FLOATNAME(LMatrix4) &other, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL((*this)(0, 0), other(0, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(0, 1), other(0, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(0, 2), other(0, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(0, 3), other(0, 3), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 0), other(1, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 1), other(1, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 2), other(1, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(1, 3), other(1, 3), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 0), other(2, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 1), other(2, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 2), other(2, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(2, 3), other(2, 3), threshold) && - IS_THRESHOLD_EQUAL((*this)(3, 0), other(3, 0), threshold) && - IS_THRESHOLD_EQUAL((*this)(3, 1), other(3, 1), threshold) && - IS_THRESHOLD_EQUAL((*this)(3, 2), other(3, 2), threshold) && - IS_THRESHOLD_EQUAL((*this)(3, 3), other(3, 3), threshold)); + IS_THRESHOLD_EQUAL((*this)(0, 1), other(0, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(0, 2), other(0, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(0, 3), other(0, 3), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 0), other(1, 0), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 1), other(1, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 2), other(1, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(1, 3), other(1, 3), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 0), other(2, 0), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 1), other(2, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 2), other(2, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(2, 3), other(2, 3), threshold) && + IS_THRESHOLD_EQUAL((*this)(3, 0), other(3, 0), threshold) && + IS_THRESHOLD_EQUAL((*this)(3, 1), other(3, 1), threshold) && + IS_THRESHOLD_EQUAL((*this)(3, 2), other(3, 2), threshold) && + IS_THRESHOLD_EQUAL((*this)(3, 3), other(3, 3), threshold)); } @@ -225,7 +225,7 @@ decompose_mat(int index[4]) { for (j = 0; j < 4; j++) { FLOATTYPE temp = fabs((*this)(i,j)); if (temp > big) { - big = temp; + big = temp; } } @@ -239,7 +239,7 @@ decompose_mat(int index[4]) { for (i = 0; i < j; i++) { FLOATTYPE sum = (*this)(i,j); for (k = 0; k < i; k++) { - sum -= (*this)(i,k) * (*this)(k,j); + sum -= (*this)(i,k) * (*this)(k,j); } (*this)(i,j) = sum; } @@ -249,22 +249,22 @@ decompose_mat(int index[4]) { for (i = j; i < 4; i++) { FLOATTYPE sum = (*this)(i,j); for (k = 0; k < j; k++) { - sum -= (*this)(i,k) * (*this)(k,j); + sum -= (*this)(i,k) * (*this)(k,j); } (*this)(i,j) = sum; FLOATTYPE dum = vv[i] * fabs(sum); if (dum >= big) { - big = dum; - imax = i; + big = dum; + imax = i; } } nassertr(imax >= 0, false); if (j != imax) { for (k = 0; k < 4; k++) { - FLOATTYPE dum = (*this)(imax,k); - (*this)(imax,k) = (*this)(j,k); - (*this)(j,k) = dum; + FLOATTYPE dum = (*this)(imax,k); + (*this)(imax,k) = (*this)(j,k); + (*this)(j,k) = dum; } vv[imax] = vv[j]; } @@ -277,7 +277,7 @@ decompose_mat(int index[4]) { if (j != 4 - 1) { FLOATTYPE dum = 1.0f / (*this)(j,j); for (i = j + 1; i < 4; i++) { - (*this)(i,j) *= dum; + (*this)(i,j) *= dum; } } } @@ -299,7 +299,7 @@ back_sub_mat(int index[4], FLOATNAME(LMatrix4) &inv, int row) const { inv(row, ip) = inv(row, i); if (ii >= 0) { for (j = ii; j <= i - 1; j++) { - sum -= (*this)(i,j) * inv(row, j); + sum -= (*this)(i,j) * inv(row, j); } } else if (sum) { ii = i; diff --git a/panda/src/linmath/lmatrix4_src.h b/panda/src/linmath/lmatrix4_src.h index 3ce3d061bf..307c0e0f95 100644 --- a/panda/src/linmath/lmatrix4_src.h +++ b/panda/src/linmath/lmatrix4_src.h @@ -5,7 +5,7 @@ //////////////////////////////////////////////////////////////////// -// Class : LMatrix4 +// Class : LMatrix4 // Description : This is a 4-by-4 transform matrix. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FLOATNAME(LMatrix4) { @@ -19,9 +19,9 @@ PUBLISHED: INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (FLOATTYPE fill_value); INLINE_LINMATH FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, - FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33); + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, + FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33); // Construct a 4x4 matrix given a 3x3 rotation matrix and an optional // translation component. @@ -30,9 +30,9 @@ PUBLISHED: INLINE_LINMATH void fill(FLOATTYPE fill_value); INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, - FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33); + FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, + FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, + FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33); // Get and set the upper 3x3 rotation matrix. INLINE_LINMATH void set_upper_3(const FLOATNAME(LMatrix3) &upper3); @@ -91,7 +91,7 @@ PUBLISHED: // this = other1 * other2 INLINE_LINMATH void multiply(const FLOATNAME(LMatrix4) &other1, const FLOATNAME(LMatrix4) &other2); - // this = scale_mat(scale_vector) * other_mat, efficiently + // this = scale_mat(scale_vector) * other_mat, efficiently INLINE_LINMATH void scale_multiply(const FLOATNAME(LVecBase3) &scale_vector,const FLOATNAME(LMatrix4) &other_mat); INLINE_LINMATH FLOATNAME(LMatrix4) operator * (const FLOATNAME(LMatrix4) &other) const; @@ -121,17 +121,17 @@ PUBLISHED: translate_mat(FLOATTYPE tx, FLOATTYPE ty, FLOATTYPE tz); INLINE_LINMATH static FLOATNAME(LMatrix4) rotate_mat(FLOATTYPE angle, - FLOATNAME(LVecBase3) axis, - CoordinateSystem cs = CS_default); + FLOATNAME(LVecBase3) axis, + CoordinateSystem cs = CS_default); INLINE_LINMATH static FLOATNAME(LMatrix4) rotate_mat_normaxis(FLOATTYPE angle, - const FLOATNAME(LVecBase3) &axis, - CoordinateSystem cs = CS_default); + const FLOATNAME(LVecBase3) &axis, + CoordinateSystem cs = CS_default); INLINE_LINMATH static void rotate_mat_normaxis(FLOATTYPE angle, - const FLOATNAME(LVecBase3) &axis, - FLOATNAME(LMatrix4) &result_mat, - CoordinateSystem cs = CS_default); + const FLOATNAME(LVecBase3) &axis, + FLOATNAME(LMatrix4) &result_mat, + CoordinateSystem cs = CS_default); INLINE_LINMATH static FLOATNAME(LMatrix4) scale_mat(const FLOATNAME(LVecBase3) &scale); INLINE_LINMATH static FLOATNAME(LMatrix4) @@ -143,10 +143,10 @@ PUBLISHED: INLINE_LINMATH static const FLOATNAME(LMatrix4) &z_to_y_up_mat(); static FLOATNAME(LMatrix4) convert_mat(CoordinateSystem from, - CoordinateSystem to); + CoordinateSystem to); bool almost_equal(const FLOATNAME(LMatrix4) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH bool almost_equal(const FLOATNAME(LMatrix4) &other) const; void output(ostream &out) const; @@ -159,13 +159,13 @@ public: public: union { struct { - FLOATTYPE _00, _01, _02, _03; + FLOATTYPE _00, _01, _02, _03; FLOATTYPE _10, _11, _12, _13; FLOATTYPE _20, _21, _22, _23; FLOATTYPE _30, _31, _32, _33; } m; - FLOATTYPE data[4 * 4]; + FLOATTYPE data[4 * 4]; } _m; private: diff --git a/panda/src/linmath/lorientation_src.cxx b/panda/src/linmath/lorientation_src.cxx index 77abe68bd1..5549ea86f7 100644 --- a/panda/src/linmath/lorientation_src.cxx +++ b/panda/src/linmath/lorientation_src.cxx @@ -17,6 +17,6 @@ init_type() { string name = "LOrientation"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LQuaternion)::get_class_type()); + FLOATNAME(LQuaternion)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint2_src.cxx b/panda/src/linmath/lpoint2_src.cxx index 45a19d84d7..0ea190dc4b 100644 --- a/panda/src/linmath/lpoint2_src.cxx +++ b/panda/src/linmath/lpoint2_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LPoint2"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase2)::get_class_type()); + FLOATNAME(LVecBase2)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint2_src.h b/panda/src/linmath/lpoint2_src.h index 01e8dc2a8e..ec4e62b166 100644 --- a/panda/src/linmath/lpoint2_src.h +++ b/panda/src/linmath/lpoint2_src.h @@ -5,7 +5,7 @@ //////////////////////////////////////////////////////////////////// -// Class : LPoint2 +// Class : LPoint2 // Description : This is a two-component point in space. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FLOATNAME(LPoint2) : public FLOATNAME(LVecBase2) { diff --git a/panda/src/linmath/lpoint3_src.cxx b/panda/src/linmath/lpoint3_src.cxx index 83fba2c687..7577dc9502 100644 --- a/panda/src/linmath/lpoint3_src.cxx +++ b/panda/src/linmath/lpoint3_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LPoint3"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase3)::get_class_type()); + FLOATNAME(LVecBase3)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint3_src.h b/panda/src/linmath/lpoint3_src.h index 0b17938546..6ac924b4f8 100644 --- a/panda/src/linmath/lpoint3_src.h +++ b/panda/src/linmath/lpoint3_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LPoint3 +// Class : LPoint3 // Description : This is a three-component point in space (as opposed // to a three-component vector, which represents a // direction and a distance). Some of the methods are @@ -49,9 +49,9 @@ PUBLISHED: INLINE_LINMATH static FLOATNAME(LPoint3) origin(CoordinateSystem cs = CS_default); INLINE_LINMATH static FLOATNAME(LPoint3) rfu(FLOATTYPE right, - FLOATTYPE fwd, - FLOATTYPE up, - CoordinateSystem cs = CS_default); + FLOATTYPE fwd, + FLOATTYPE up, + CoordinateSystem cs = CS_default); public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/linmath/lpoint4_src.cxx b/panda/src/linmath/lpoint4_src.cxx index 4c385038fc..55e50cc8c3 100644 --- a/panda/src/linmath/lpoint4_src.cxx +++ b/panda/src/linmath/lpoint4_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LPoint4"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase4)::get_class_type()); + FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint4_src.h b/panda/src/linmath/lpoint4_src.h index 00de0ee02d..597e58d910 100644 --- a/panda/src/linmath/lpoint4_src.h +++ b/panda/src/linmath/lpoint4_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LPoint4 +// Class : LPoint4 // Description : This is a four-component point in space. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FLOATNAME(LPoint4) : public FLOATNAME(LVecBase4) { diff --git a/panda/src/linmath/lquaternion_src.I b/panda/src/linmath/lquaternion_src.I index 4bfcacc5a0..a1af91ffdf 100644 --- a/panda/src/linmath/lquaternion_src.I +++ b/panda/src/linmath/lquaternion_src.I @@ -109,9 +109,9 @@ operator *(const FLOATNAME(LMatrix4) &m) { INLINE_LINMATH bool FLOATNAME(LQuaternion):: almost_equal(const FLOATNAME(LQuaternion)& c, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL(_v.data[0], c._v.data[0], threshold) && - IS_THRESHOLD_EQUAL(_v.data[1], c._v.data[1], threshold) && - IS_THRESHOLD_EQUAL(_v.data[2], c._v.data[2], threshold) && - IS_THRESHOLD_EQUAL(_v.data[3], c._v.data[3], threshold)); + IS_THRESHOLD_EQUAL(_v.data[1], c._v.data[1], threshold) && + IS_THRESHOLD_EQUAL(_v.data[2], c._v.data[2], threshold) && + IS_THRESHOLD_EQUAL(_v.data[3], c._v.data[3], threshold)); } //////////////////////////////////////////////////////////////////// @@ -253,7 +253,7 @@ set_from_matrix(const FLOATNAME(LMatrix4) &m) { // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m, - const FLOATNAME(LQuaternion) &q) { + const FLOATNAME(LQuaternion) &q) { FLOATNAME(LMatrix3) q_matrix; q.extract_to_matrix(q_matrix); @@ -266,7 +266,7 @@ INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m, // Description: //////////////////////////////////////////////////////////////////// INLINE_LINMATH FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &m, - const FLOATNAME(LQuaternion) &q) { + const FLOATNAME(LQuaternion) &q) { FLOATNAME(LMatrix4) q_matrix; q.extract_to_matrix(q_matrix); diff --git a/panda/src/linmath/lquaternion_src.cxx b/panda/src/linmath/lquaternion_src.cxx index 2a00dd90ff..207428ad40 100644 --- a/panda/src/linmath/lquaternion_src.cxx +++ b/panda/src/linmath/lquaternion_src.cxx @@ -232,6 +232,6 @@ init_type() { string name = "LQuaternion"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase4)::get_class_type()); + FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/linmath/lrotation_src.cxx b/panda/src/linmath/lrotation_src.cxx index 0c5cfedf2e..0504372cfe 100644 --- a/panda/src/linmath/lrotation_src.cxx +++ b/panda/src/linmath/lrotation_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LRotation"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LQuaternion)::get_class_type()); + FLOATNAME(LQuaternion)::get_class_type()); } } diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index 1a41d6b25e..2f3cafeb9c 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -327,7 +327,7 @@ operator < (const FLOATNAME(LVecBase2) &other) const { INLINE_LINMATH bool FLOATNAME(LVecBase2):: operator == (const FLOATNAME(LVecBase2) &other) const { return (_v.v._0 == other._v.v._0 && - _v.v._1 == other._v.v._1); + _v.v._1 == other._v.v._1); } //////////////////////////////////////////////////////////////////// @@ -389,7 +389,7 @@ operator - () const { INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2):: operator + (const FLOATNAME(LVecBase2) &other) const { return FLOATNAME(LVecBase2)(_v.v._0 + other._v.v._0, - _v.v._1 + other._v.v._1); + _v.v._1 + other._v.v._1); } //////////////////////////////////////////////////////////////////// @@ -400,7 +400,7 @@ operator + (const FLOATNAME(LVecBase2) &other) const { INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2):: operator - (const FLOATNAME(LVecBase2) &other) const { return FLOATNAME(LVecBase2)(_v.v._0 - other._v.v._0, - _v.v._1 - other._v.v._1); + _v.v._1 - other._v.v._1); } //////////////////////////////////////////////////////////////////// @@ -411,7 +411,7 @@ operator - (const FLOATNAME(LVecBase2) &other) const { INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2):: operator * (FLOATTYPE scalar) const { return FLOATNAME(LVecBase2)(_v.v._0 * scalar, - _v.v._1 * scalar); + _v.v._1 * scalar); } //////////////////////////////////////////////////////////////////// @@ -423,7 +423,7 @@ INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2):: operator / (FLOATTYPE scalar) const { FLOATTYPE recip_scalar = 1.0f/scalar; return FLOATNAME(LVecBase2)(_v.v._0 * recip_scalar, - _v.v._1 * recip_scalar); + _v.v._1 * recip_scalar); } //////////////////////////////////////////////////////////////////// @@ -480,7 +480,7 @@ operator /= (FLOATTYPE scalar) { INLINE_LINMATH bool FLOATNAME(LVecBase2):: almost_equal(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) && - IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)); + IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase2_src.h b/panda/src/linmath/lvecBase2_src.h index e3abd69d18..c35a122f11 100644 --- a/panda/src/linmath/lvecBase2_src.h +++ b/panda/src/linmath/lvecBase2_src.h @@ -7,7 +7,7 @@ //////////////////////////////////////////////////////////////////// -// Class : LVecBase2 +// Class : LVecBase2 // Description : This is the base class for all two-component // vectors and points. //////////////////////////////////////////////////////////////////// @@ -63,7 +63,7 @@ PUBLISHED: INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase2) &other) const; INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase2) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH FLOATNAME(LVecBase2) operator - () const; @@ -83,7 +83,7 @@ PUBLISHED: INLINE_LINMATH void operator /= (FLOATTYPE scalar); INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other) const; INLINE_LINMATH void output(ostream &out) const; @@ -91,12 +91,12 @@ PUBLISHED: public: INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash) const; INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; public: union { - FLOATTYPE data[2]; - struct {FLOATTYPE _0, _1;} v; + FLOATTYPE data[2]; + struct {FLOATTYPE _0, _1;} v; } _v; private: diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index 2747faf415..487a02077d 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -347,8 +347,8 @@ dot(const FLOATNAME(LVecBase3) &other) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3):: cross(const FLOATNAME(LVecBase3) &other) const { return FLOATNAME(LVecBase3)(_v.v._1 * other._v.v._2 - other._v.v._1 * _v.v._2, - other._v.v._0 * _v.v._2 - _v.v._0 * other._v.v._2, - _v.v._0 * other._v.v._1 - other._v.v._0 * _v.v._1); + other._v.v._0 * _v.v._2 - _v.v._0 * other._v.v._2, + _v.v._0 * other._v.v._1 - other._v.v._0 * _v.v._1); } //////////////////////////////////////////////////////////////////// @@ -373,8 +373,8 @@ operator < (const FLOATNAME(LVecBase3) &other) const { INLINE_LINMATH bool FLOATNAME(LVecBase3):: operator == (const FLOATNAME(LVecBase3) &other) const { return (_v.v._0 == other._v.v._0 && - _v.v._1 == other._v.v._1 && - _v.v._2 == other._v.v._2); + _v.v._1 == other._v.v._1 && + _v.v._2 == other._v.v._2); } //////////////////////////////////////////////////////////////////// @@ -439,8 +439,8 @@ operator - () const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3):: operator + (const FLOATNAME(LVecBase3) &other) const { return FLOATNAME(LVecBase3)(_v.v._0 + other._v.v._0, - _v.v._1 + other._v.v._1, - _v.v._2 + other._v.v._2); + _v.v._1 + other._v.v._1, + _v.v._2 + other._v.v._2); } //////////////////////////////////////////////////////////////////// @@ -451,8 +451,8 @@ operator + (const FLOATNAME(LVecBase3) &other) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3):: operator - (const FLOATNAME(LVecBase3) &other) const { return FLOATNAME(LVecBase3)(_v.v._0 - other._v.v._0, - _v.v._1 - other._v.v._1, - _v.v._2 - other._v.v._2); + _v.v._1 - other._v.v._1, + _v.v._2 - other._v.v._2); } //////////////////////////////////////////////////////////////////// @@ -463,8 +463,8 @@ operator - (const FLOATNAME(LVecBase3) &other) const { INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3):: operator * (FLOATTYPE scalar) const { return FLOATNAME(LVecBase3)(_v.v._0 * scalar, - _v.v._1 * scalar, - _v.v._2 * scalar); + _v.v._1 * scalar, + _v.v._2 * scalar); } //////////////////////////////////////////////////////////////////// @@ -476,8 +476,8 @@ INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3):: operator / (FLOATTYPE scalar) const { FLOATTYPE recip_scalar = 1.0f/scalar; return FLOATNAME(LVecBase3)(_v.v._0 * recip_scalar, - _v.v._1 * recip_scalar, - _v.v._2 * recip_scalar); + _v.v._1 * recip_scalar, + _v.v._2 * recip_scalar); } //////////////////////////////////////////////////////////////////// @@ -548,8 +548,8 @@ cross_into(const FLOATNAME(LVecBase3) &other) { INLINE_LINMATH bool FLOATNAME(LVecBase3):: almost_equal(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) && - IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) && - IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold)); + IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) && + IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase3_src.h b/panda/src/linmath/lvecBase3_src.h index 47665cfb2e..466b5adfb5 100644 --- a/panda/src/linmath/lvecBase3_src.h +++ b/panda/src/linmath/lvecBase3_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LVecBase3 +// Class : LVecBase3 // Description : This is the base class for all three-component // vectors and points. //////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ PUBLISHED: INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other) const; INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH FLOATNAME(LVecBase3) operator - () const; @@ -85,7 +85,7 @@ PUBLISHED: INLINE_LINMATH void cross_into(const FLOATNAME(LVecBase3) &other); INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other) const; INLINE_LINMATH void output(ostream &out) const; @@ -93,12 +93,12 @@ PUBLISHED: public: INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash) const; INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; public: union { - FLOATTYPE data[3]; - struct {FLOATTYPE _0, _1, _2;} v; + FLOATTYPE data[3]; + struct {FLOATTYPE _0, _1, _2;} v; } _v; private: diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index 6ff2a18b33..a4d6798cfa 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -399,9 +399,9 @@ operator < (const FLOATNAME(LVecBase4) &other) const { INLINE_LINMATH bool FLOATNAME(LVecBase4):: operator == (const FLOATNAME(LVecBase4) &other) const { return (_v.v._0 == other._v.v._0 && - _v.v._1 == other._v.v._1 && - _v.v._2 == other._v.v._2 && - _v.v._3 == other._v.v._3); + _v.v._1 == other._v.v._1 && + _v.v._2 == other._v.v._2 && + _v.v._3 == other._v.v._3); } //////////////////////////////////////////////////////////////////// @@ -469,9 +469,9 @@ operator - () const { INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4):: operator + (const FLOATNAME(LVecBase4) &other) const { return FLOATNAME(LVecBase4)(_v.v._0 + other._v.v._0, - _v.v._1 + other._v.v._1, - _v.v._2 + other._v.v._2, - _v.v._3 + other._v.v._3); + _v.v._1 + other._v.v._1, + _v.v._2 + other._v.v._2, + _v.v._3 + other._v.v._3); } //////////////////////////////////////////////////////////////////// @@ -482,9 +482,9 @@ operator + (const FLOATNAME(LVecBase4) &other) const { INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4):: operator - (const FLOATNAME(LVecBase4) &other) const { return FLOATNAME(LVecBase4)(_v.v._0 - other._v.v._0, - _v.v._1 - other._v.v._1, - _v.v._2 - other._v.v._2, - _v.v._3 - other._v.v._3); + _v.v._1 - other._v.v._1, + _v.v._2 - other._v.v._2, + _v.v._3 - other._v.v._3); } //////////////////////////////////////////////////////////////////// @@ -495,9 +495,9 @@ operator - (const FLOATNAME(LVecBase4) &other) const { INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4):: operator * (FLOATTYPE scalar) const { return FLOATNAME(LVecBase4)(_v.v._0 * scalar, - _v.v._1 * scalar, - _v.v._2 * scalar, - _v.v._3 * scalar); + _v.v._1 * scalar, + _v.v._2 * scalar, + _v.v._3 * scalar); } //////////////////////////////////////////////////////////////////// @@ -509,9 +509,9 @@ INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4):: operator / (FLOATTYPE scalar) const { FLOATTYPE recip_scalar = 1.0f/scalar; return FLOATNAME(LVecBase4)(_v.v._0 * recip_scalar, - _v.v._1 * recip_scalar, - _v.v._2 * recip_scalar, - _v.v._3 * recip_scalar); + _v.v._1 * recip_scalar, + _v.v._2 * recip_scalar, + _v.v._3 * recip_scalar); } //////////////////////////////////////////////////////////////////// @@ -576,9 +576,9 @@ operator /= (FLOATTYPE scalar) { INLINE_LINMATH bool FLOATNAME(LVecBase4):: almost_equal(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const { return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) && - IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) && - IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold) && - IS_THRESHOLD_EQUAL(_v.v._3, other._v.v._3, threshold)); + IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) && + IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold) && + IS_THRESHOLD_EQUAL(_v.v._3, other._v.v._3, threshold)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/linmath/lvecBase4_src.h b/panda/src/linmath/lvecBase4_src.h index a912923966..6174c89088 100644 --- a/panda/src/linmath/lvecBase4_src.h +++ b/panda/src/linmath/lvecBase4_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LVecBase4 +// Class : LVecBase4 // Description : This is the base class for all three-component // vectors and points. //////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ PUBLISHED: INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other) const; INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH FLOATNAME(LVecBase4) operator - () const; @@ -85,7 +85,7 @@ PUBLISHED: INLINE_LINMATH void operator /= (FLOATTYPE scalar); INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const; INLINE_LINMATH void output(ostream &out) const; @@ -93,12 +93,12 @@ PUBLISHED: public: INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash) const; INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hash, - FLOATTYPE threshold) const; + FLOATTYPE threshold) const; public: union { - FLOATTYPE data[4]; - struct {FLOATTYPE _0, _1, _2, _3;} v; + FLOATTYPE data[4]; + struct {FLOATTYPE _0, _1, _2, _3;} v; } _v; private: diff --git a/panda/src/linmath/lvector2_src.cxx b/panda/src/linmath/lvector2_src.cxx index 71b61292ef..5211af215a 100644 --- a/panda/src/linmath/lvector2_src.cxx +++ b/panda/src/linmath/lvector2_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LVector2"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase2)::get_class_type()); + FLOATNAME(LVecBase2)::get_class_type()); } } diff --git a/panda/src/linmath/lvector2_src.h b/panda/src/linmath/lvector2_src.h index f35713e2ee..a7acefe841 100644 --- a/panda/src/linmath/lvector2_src.h +++ b/panda/src/linmath/lvector2_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LVector2 +// Class : LVector2 // Description : This is a two-component vector offset. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FLOATNAME(LVector2) : public FLOATNAME(LVecBase2) { diff --git a/panda/src/linmath/lvector3_src.cxx b/panda/src/linmath/lvector3_src.cxx index c8101a2454..6a4159a9ad 100644 --- a/panda/src/linmath/lvector3_src.cxx +++ b/panda/src/linmath/lvector3_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LVector3"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase3)::get_class_type()); + FLOATNAME(LVecBase3)::get_class_type()); } } diff --git a/panda/src/linmath/lvector3_src.h b/panda/src/linmath/lvector3_src.h index 79e4f27a8f..b0630703c8 100644 --- a/panda/src/linmath/lvector3_src.h +++ b/panda/src/linmath/lvector3_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LVector3 +// Class : LVector3 // Description : This is a three-component vector distance (as opposed // to a three-component point, which represents a // particular point in space). Some of the methods are @@ -54,7 +54,7 @@ PUBLISHED: // INLINE_LINMATH static FLOATNAME(LVector3) & rfu(FLOATTYPE right, INLINE_LINMATH static FLOATNAME(LVector3) rfu(FLOATTYPE right, - FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default); + FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default); public: static TypeHandle get_class_type() { diff --git a/panda/src/linmath/lvector4_src.cxx b/panda/src/linmath/lvector4_src.cxx index 0db8689019..4aec4f5aed 100644 --- a/panda/src/linmath/lvector4_src.cxx +++ b/panda/src/linmath/lvector4_src.cxx @@ -18,7 +18,7 @@ init_type() { string name = "LVector4"; name += FLOATTOKEN; register_type(_type_handle, name, - FLOATNAME(LVecBase4)::get_class_type()); + FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/linmath/lvector4_src.h b/panda/src/linmath/lvector4_src.h index f9d6addce7..8d175b3b45 100644 --- a/panda/src/linmath/lvector4_src.h +++ b/panda/src/linmath/lvector4_src.h @@ -4,7 +4,7 @@ //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -// Class : LVector4 +// Class : LVector4 // Description : This is a four-component vector distance. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FLOATNAME(LVector4) : public FLOATNAME(LVecBase4) { diff --git a/panda/src/linmath/test_math.cxx b/panda/src/linmath/test_math.cxx index c026131395..402c7b9761 100644 --- a/panda/src/linmath/test_math.cxx +++ b/panda/src/linmath/test_math.cxx @@ -134,9 +134,9 @@ int main(int argc, char *argv[]) { LMatrix4f mat; compose_matrix(mat, scale, hpr, xyz); if (decompose_matrix(mat, scale, hpr, xyz)) { - nout << "> hpr = " << hpr << " xyz = " << xyz << "\n"; + nout << "> hpr = " << hpr << " xyz = " << xyz << "\n"; } else { - nout << "Cannot decompose\n"; + nout << "Cannot decompose\n"; } } } diff --git a/panda/src/loader/bamFile.h b/panda/src/loader/bamFile.h index 1682e53c83..157809f231 100644 --- a/panda/src/loader/bamFile.h +++ b/panda/src/loader/bamFile.h @@ -17,7 +17,7 @@ class TypedWritable; class Filename; //////////////////////////////////////////////////////////////////// -// Class : BamFile +// Class : BamFile // Description : The principle public interface to reading and writing // Bam disk files. See also BamReader and BamWriter, // the more general implementation of this class. diff --git a/panda/src/loader/loader.cxx b/panda/src/loader/loader.cxx index 6caa6c559c..6e3e8cf441 100644 --- a/panda/src/loader/loader.cxx +++ b/panda/src/loader/loader.cxx @@ -38,7 +38,7 @@ bool Loader::_file_types_loaded = false; class LoaderToken : public ReferenceCount { public: INLINE LoaderToken(uint id, Filename path, const string &event_name, - PT_Node node=NULL) : _id(id), _node(node) { + PT_Node node=NULL) : _id(id), _node(node) { _path = path; _event_name = event_name; } @@ -130,8 +130,8 @@ request_load(const Filename &filename, const string &event_name) { // Make sure we actually are threaded if (!_threaded) { loader_cat.info() - << "Loader::request_load() - create_thread() was " - << "never called! Calling it now..." << endl; + << "Loader::request_load() - create_thread() was " + << "never called! Calling it now..." << endl; create_thread(); } @@ -228,11 +228,11 @@ load_file_types() { for (ti = load_file_type->begin(); ti != load_file_type->end(); ++ti) { Filename dlname = Filename::dso_filename("lib" + (*ti).Val() + ".so"); loader_cat.info() - << "loading file type module: " << dlname.to_os_specific() << endl; + << "loading file type module: " << dlname.to_os_specific() << endl; void *tmp = load_dso(dlname); if (tmp == (void *)NULL) { - loader_cat.info() - << "Unable to load: " << load_dso_error() << endl; + loader_cat.info() + << "Unable to load: " << load_dso_error() << endl; } } _file_types_loaded = true; @@ -250,7 +250,7 @@ process_request() { if (_shutdown) { if (loader_cat.is_debug()) loader_cat.debug() - << "Loader shutting down...\n"; + << "Loader shutting down...\n"; return false; } @@ -260,8 +260,8 @@ process_request() { tok->_node = load_file(tok->_path); if (tok->_node == NULL) { loader_cat.error() - << "Loader::callback() - couldn't find file: " - << tok->_path << "\n"; + << "Loader::callback() - couldn't find file: " + << tok->_path << "\n"; } else { _token_board->_done.insert(tok); @@ -275,7 +275,7 @@ process_request() { if (loader_cat.is_debug()) { loader_cat.debug() - << "loading complete for " << tok->_path << "\n"; + << "loading complete for " << tok->_path << "\n"; } } @@ -386,7 +386,7 @@ load_unknown_file_type(const Filename &filename) const { Filename p = filename; p.set_extension(reg->get_type(i)->get_extension()); loader_cat.error(false) - << " " << p << "\n"; + << " " << p << "\n"; } return (Node *)NULL; } @@ -403,7 +403,7 @@ load_unknown_file_type(const Filename &filename) const { << " possible types:\n"; for (fi = files.begin(); fi != files.end(); ++fi) { loader_cat.debug(false) - << " " << (*fi)._path << "\n"; + << " " << (*fi)._path << "\n"; } } @@ -415,8 +415,8 @@ load_unknown_file_type(const Filename &filename) const { } if (loader_cat.is_debug()) { loader_cat.debug() - << "Couldn't read " << consider._type->get_name() - << " file " << consider._path << "\n"; + << "Couldn't read " << consider._type->get_name() + << " file " << consider._path << "\n"; } } diff --git a/panda/src/loader/loader.h b/panda/src/loader/loader.h index b3bfdcabc6..74ba8fb661 100644 --- a/panda/src/loader/loader.h +++ b/panda/src/loader/loader.h @@ -23,7 +23,7 @@ class LoaderToken; //////////////////////////////////////////////////////////////////// // Class : Loader // Description : Handles database loading through asynchronous -// threading +// threading //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Loader : public AsyncUtility { PUBLISHED: diff --git a/panda/src/loader/loaderFileType.h b/panda/src/loader/loaderFileType.h index 7811764e6c..e90aabee71 100644 --- a/panda/src/loader/loaderFileType.h +++ b/panda/src/loader/loaderFileType.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LoaderFileType +// Class : LoaderFileType // Description : This is the base class for a family of scene-graph // file types that the Loader supports. Each kind of // loader that's available should define a corresponding diff --git a/panda/src/loader/loaderFileTypeBam.cxx b/panda/src/loader/loaderFileTypeBam.cxx index 7d0ca3c256..1a91369953 100644 --- a/panda/src/loader/loaderFileTypeBam.cxx +++ b/panda/src/loader/loaderFileTypeBam.cxx @@ -81,8 +81,8 @@ load_file(const Filename &path, bool report_errors) const } else if (!object->is_of_type(Node::get_class_type())) { if (report_errors) { loader_cat.error() - << "Bam file " << path - << " contains a " << object->get_type() << ", not a Node.\n"; + << "Bam file " << path + << " contains a " << object->get_type() << ", not a Node.\n"; } } else { @@ -91,8 +91,8 @@ load_file(const Filename &path, bool report_errors) const if (report_errors) { bam_file.read_object(); if (!bam_file.is_eof()) { - loader_cat.warning() - << "Ignoring extra objects in " << path << "\n"; + loader_cat.warning() + << "Ignoring extra objects in " << path << "\n"; } } } @@ -100,7 +100,7 @@ load_file(const Filename &path, bool report_errors) const if (!bam_file.resolve()) { if (report_errors) { loader_cat.error() - << "Unable to resolve Bam file.\n"; + << "Unable to resolve Bam file.\n"; result = (Node *)NULL; } } diff --git a/panda/src/loader/loaderFileTypeBam.h b/panda/src/loader/loaderFileTypeBam.h index f3704b49ce..755f4cd448 100644 --- a/panda/src/loader/loaderFileTypeBam.h +++ b/panda/src/loader/loaderFileTypeBam.h @@ -11,7 +11,7 @@ #include "loaderFileType.h" //////////////////////////////////////////////////////////////////// -// Class : LoaderFileTypeEgg +// Class : LoaderFileTypeEgg // Description : This defines the Loader interface to read Egg files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA LoaderFileTypeBam : public LoaderFileType { diff --git a/panda/src/loader/loaderFileTypeRegistry.cxx b/panda/src/loader/loaderFileTypeRegistry.cxx index b6c1c7986d..fb0d571122 100644 --- a/panda/src/loader/loaderFileTypeRegistry.cxx +++ b/panda/src/loader/loaderFileTypeRegistry.cxx @@ -103,7 +103,7 @@ write_types(ostream &out, int indent_level) const { string name = type->get_name(); indent(out, indent_level) << name; indent(out, max(30 - (int)name.length(), 0)) - << " ." << type->get_extension() << "\n"; + << " ." << type->get_extension() << "\n"; } } } diff --git a/panda/src/loader/loaderFileTypeRegistry.h b/panda/src/loader/loaderFileTypeRegistry.h index 0dce007152..25c327c2f8 100644 --- a/panda/src/loader/loaderFileTypeRegistry.h +++ b/panda/src/loader/loaderFileTypeRegistry.h @@ -15,7 +15,7 @@ class LoaderFileType; class Filename; //////////////////////////////////////////////////////////////////// -// Class : LoaderFileTypeRegistry +// Class : LoaderFileTypeRegistry // Description : This class maintains the set of all known // LoaderFileTypes in the universe. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/loader/modelPool.cxx b/panda/src/loader/modelPool.cxx index a9fa0b9b10..1ba00343f3 100644 --- a/panda/src/loader/modelPool.cxx +++ b/panda/src/loader/modelPool.cxx @@ -105,8 +105,8 @@ ns_garbage_collect() { Node *node = (*ti).second; if (node->get_ref_count() == 1) { if (loader_cat.is_debug()) { - loader_cat.debug() - << "Releasing " << (*ti).first << "\n"; + loader_cat.debug() + << "Releasing " << (*ti).first << "\n"; } num_released++; } else { @@ -129,7 +129,7 @@ ns_list_contents(ostream &out) { Models::iterator ti; for (ti = _models.begin(); ti != _models.end(); ++ti) { out << " " << (*ti).first - << " (count = " << (*ti).second->get_ref_count() << ")\n"; + << " (count = " << (*ti).second->get_ref_count() << ")\n"; } } diff --git a/panda/src/mathutil/boundingHexahedron.cxx b/panda/src/mathutil/boundingHexahedron.cxx index 76423f4d71..32cf0b1e57 100644 --- a/panda/src/mathutil/boundingHexahedron.cxx +++ b/panda/src/mathutil/boundingHexahedron.cxx @@ -14,7 +14,7 @@ TypeHandle BoundingHexahedron::_type_handle; BoundingHexahedron:: BoundingHexahedron(const Frustumf &frustum, bool is_ortho, - CoordinateSystem cs) { + CoordinateSystem cs) { if (cs == CS_default) { cs = default_coordinate_system; } @@ -60,8 +60,8 @@ get_min() const { LPoint3f m = _points[0]; for (i = 1; i < num_points; i++) { m.set(min(m[0], _points[i][0]), - min(m[1], _points[i][1]), - min(m[2], _points[i][2])); + min(m[1], _points[i][1]), + min(m[2], _points[i][2])); } return m; } @@ -74,8 +74,8 @@ get_max() const { LPoint3f m = _points[0]; for (i = 1; i < num_points; i++) { m.set(max(m[0], _points[i][0]), - max(m[1], _points[i][1]), - max(m[2], _points[i][2])); + max(m[1], _points[i][1]), + max(m[2], _points[i][2])); } return m; } @@ -133,8 +133,8 @@ extend_other(BoundingVolume *other) const { bool BoundingHexahedron:: around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const { + const BoundingVolume **first, + const BoundingVolume **last) const { return other->around_hexahedrons(first, last); } @@ -174,7 +174,7 @@ around_points(const LPoint3f *, const LPoint3f *) { bool BoundingHexahedron:: around_spheres(const BoundingVolume **, - const BoundingVolume **) { + const BoundingVolume **) { mathutil_cat.error() << "BoundingHexahedron::around_spheres() called\n"; return false; @@ -182,7 +182,7 @@ around_spheres(const BoundingVolume **, bool BoundingHexahedron:: around_hexahedrons(const BoundingVolume **, - const BoundingVolume **) { + const BoundingVolume **) { mathutil_cat.error() << "BoundingHexahedron::around_hexahedrons() called\n"; return false; @@ -202,7 +202,7 @@ contains_point(const LPoint3f &point) const { for (int i = 0; i < num_planes; i++) { const Planef &p = _planes[i]; if (p.dist_to_plane(point) > 0.0f) { - return IF_no_intersection; + return IF_no_intersection; } } return IF_possible | IF_some | IF_all; @@ -223,8 +223,8 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const { for (int i = 0; i < num_planes; i++) { const Planef &p = _planes[i]; if (p.dist_to_plane(a) > 0.0f || - p.dist_to_plane(b) > 0.0f) { - return IF_no_intersection; + p.dist_to_plane(b) > 0.0f) { + return IF_no_intersection; } } diff --git a/panda/src/mathutil/boundingHexahedron.h b/panda/src/mathutil/boundingHexahedron.h index 0a2a7faaec..4d4dd4b120 100644 --- a/panda/src/mathutil/boundingHexahedron.h +++ b/panda/src/mathutil/boundingHexahedron.h @@ -16,7 +16,7 @@ /////////////////////////////////////////////////////////////////// -// Class : BoundingHexahedron +// Class : BoundingHexahedron // Description : This defines a bounding convex hexahedron. It is // typically used to represent a frustum, but may // represent any enclosing convex hexahedron. @@ -29,7 +29,7 @@ class EXPCL_PANDA BoundingHexahedron : public FiniteBoundingVolume { public: INLINE_MATHUTIL BoundingHexahedron(); BoundingHexahedron(const Frustumf &frustum, bool is_ortho, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); virtual BoundingVolume *make_copy() const; virtual LPoint3f get_min() const; @@ -49,8 +49,8 @@ public: protected: virtual bool extend_other(BoundingVolume *other) const; virtual bool around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const; + const BoundingVolume **first, + const BoundingVolume **last) const; virtual int contains_other(const BoundingVolume *other) const; @@ -59,11 +59,11 @@ protected: virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron); virtual bool around_points(const LPoint3f *first, - const LPoint3f *last); + const LPoint3f *last); virtual bool around_spheres(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual bool around_hexahedrons(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual int contains_point(const LPoint3f &point) const; virtual int contains_lineseg(const LPoint3f &a, const LPoint3f &b) const; @@ -91,7 +91,7 @@ public: static void init_type() { FiniteBoundingVolume::init_type(); register_type(_type_handle, "BoundingHexahedron", - FiniteBoundingVolume::get_class_type()); + FiniteBoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/boundingLine.cxx b/panda/src/mathutil/boundingLine.cxx index e3160f9b9f..22191b6cc4 100644 --- a/panda/src/mathutil/boundingLine.cxx +++ b/panda/src/mathutil/boundingLine.cxx @@ -52,8 +52,8 @@ extend_other(BoundingVolume *other) const { bool BoundingLine:: around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const { + const BoundingVolume **first, + const BoundingVolume **last) const { return other->around_lines(first, last); } diff --git a/panda/src/mathutil/boundingLine.h b/panda/src/mathutil/boundingLine.h index ab848fff6c..88ff442296 100644 --- a/panda/src/mathutil/boundingLine.h +++ b/panda/src/mathutil/boundingLine.h @@ -11,7 +11,7 @@ #include "geometricBoundingVolume.h" /////////////////////////////////////////////////////////////////// -// Class : BoundingLine +// Class : BoundingLine // Description : This funny bounding volume is an infinite line with // no thickness and extending to infinity in both // directions. @@ -41,8 +41,8 @@ PUBLISHED: protected: virtual bool extend_other(BoundingVolume *other) const; virtual bool around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const; + const BoundingVolume **first, + const BoundingVolume **last) const; virtual int contains_other(const BoundingVolume *other) const; virtual bool extend_by_line(const BoundingLine *line); @@ -63,7 +63,7 @@ public: static void init_type() { GeometricBoundingVolume::init_type(); register_type(_type_handle, "BoundingLine", - GeometricBoundingVolume::get_class_type()); + GeometricBoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/boundingSphere.cxx b/panda/src/mathutil/boundingSphere.cxx index 6e85ef387e..444dca3e2f 100644 --- a/panda/src/mathutil/boundingSphere.cxx +++ b/panda/src/mathutil/boundingSphere.cxx @@ -23,8 +23,8 @@ get_min() const { nassertr(!is_empty(), LPoint3f(0.0f, 0.0f, 0.0f)); nassertr(!is_infinite(), LPoint3f(0.0f, 0.0f, 0.0f)); return LPoint3f(_center[0] - _radius, - _center[1] - _radius, - _center[2] - _radius); + _center[1] - _radius, + _center[2] - _radius); } LPoint3f BoundingSphere:: @@ -32,8 +32,8 @@ get_max() const { nassertr(!is_empty(), LPoint3f(0.0f, 0.0f, 0.0f)); nassertr(!is_infinite(), LPoint3f(0.0f, 0.0f, 0.0f)); return LPoint3f(_center[0] + _radius, - _center[1] + _radius, - _center[2] + _radius); + _center[1] + _radius, + _center[2] + _radius); } LPoint3f BoundingSphere:: @@ -53,28 +53,28 @@ xform(const LMatrix4f &mat) { /* LVector3f x,y,z; - mat.get_row3(x,0); - mat.get_row3(y,1); - mat.get_row3(z,2); + mat.get_row3(x,0); + mat.get_row3(y,1); + mat.get_row3(z,2); float xd = dot(x, x); float yd = dot(y, y); float zd = dot(z, z); -*/ +*/ float xd,yd,zd,scale; - #define ROW_DOTTED(mat,ROWNUM) \ - (mat._m.m._##ROWNUM##0*mat._m.m._##ROWNUM##0 + \ - mat._m.m._##ROWNUM##1*mat._m.m._##ROWNUM##1 + \ - mat._m.m._##ROWNUM##2*mat._m.m._##ROWNUM##2) + #define ROW_DOTTED(mat,ROWNUM) \ + (mat._m.m._##ROWNUM##0*mat._m.m._##ROWNUM##0 + \ + mat._m.m._##ROWNUM##1*mat._m.m._##ROWNUM##1 + \ + mat._m.m._##ROWNUM##2*mat._m.m._##ROWNUM##2) xd = ROW_DOTTED(mat,0); yd = ROW_DOTTED(mat,1); zd = ROW_DOTTED(mat,2); - scale = max(xd,yd); - scale = max(scale,zd); - scale = sqrtf(scale); + scale = max(xd,yd); + scale = max(scale,zd); + scale = sqrtf(scale); // Transform the radius _radius *= scale; @@ -102,8 +102,8 @@ extend_other(BoundingVolume *other) const { bool BoundingSphere:: around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const { + const BoundingVolume **first, + const BoundingVolume **last) const { return other->around_spheres(first, last); } @@ -223,17 +223,17 @@ around_points(const LPoint3f *first, const LPoint3f *last) { #ifndef NDEBUG // Skip more NaN points. if ((*p).is_nan()) { - ++skipped_nan; + ++skipped_nan; } else #endif - { - min_box.set(min(min_box[0], (*p)[0]), - min(min_box[1], (*p)[1]), - min(min_box[2], (*p)[2])); - max_box.set(max(max_box[0], (*p)[0]), - max(max_box[1], (*p)[1]), - max(max_box[2], (*p)[2])); - } + { + min_box.set(min(min_box[0], (*p)[0]), + min(min_box[1], (*p)[1]), + min(min_box[2], (*p)[2])); + max_box.set(max(max_box[0], (*p)[0]), + max(max_box[1], (*p)[1]), + max(max_box[2], (*p)[2])); + } ++p; } @@ -266,19 +266,19 @@ around_points(const LPoint3f *first, const LPoint3f *last) { bool BoundingSphere:: around_spheres(const BoundingVolume **first, - const BoundingVolume **last) { + const BoundingVolume **last) { return around_finite(first, last); } bool BoundingSphere:: around_hexahedrons(const BoundingVolume **first, - const BoundingVolume **last) { + const BoundingVolume **last) { return around_finite(first, last); } bool BoundingSphere:: around_finite(const BoundingVolume **first, - const BoundingVolume **last) { + const BoundingVolume **last) { nassertr(first != last, false); // We're given a set of bounding volumes, at least the first one of @@ -299,19 +299,19 @@ around_finite(const BoundingVolume **first, for (++p; p != last; ++p) { nassertr(!(*p)->is_infinite(), false); if (!(*p)->is_empty() && - (*p)->is_of_type(FiniteBoundingVolume::get_class_type())) { + (*p)->is_of_type(FiniteBoundingVolume::get_class_type())) { const FiniteBoundingVolume *vol = DCAST(FiniteBoundingVolume, *p); LPoint3f min1 = vol->get_min(); LPoint3f max1 = vol->get_max(); min_box.set(min(min_box[0], min1[0]), - min(min_box[1], min1[1]), - min(min_box[2], min1[2])); + min(min_box[1], min1[1]), + min(min_box[2], min1[2])); max_box.set(max(max_box[0], max1[0]), - max(max_box[1], max1[1]), - max(max_box[2], max1[2])); + max(max_box[1], max1[1]), + max(max_box[2], max1[2])); if (!(*p)->is_of_type(BoundingSphere::get_class_type())) { - any_unknown = true; + any_unknown = true; } } } @@ -331,16 +331,16 @@ around_finite(const BoundingVolume **first, _radius = 0.0f; for (p = first; p != last; ++p) { if (!(*p)->is_empty()) { - if ((*p)->is_of_type(BoundingSphere::get_class_type())) { - const BoundingSphere *sphere = DCAST(BoundingSphere, *p); - float dist = length(sphere->_center - _center); - _radius = max(_radius, dist + sphere->_radius); - } else { - // Shouldn't get here, unless we missed a type from above. - mathutil_cat.error() - << "Unexpected type in BoundingSphere::around_finite()\n"; - nassertr(false, false); - } + if ((*p)->is_of_type(BoundingSphere::get_class_type())) { + const BoundingSphere *sphere = DCAST(BoundingSphere, *p); + float dist = length(sphere->_center - _center); + _radius = max(_radius, dist + sphere->_radius); + } else { + // Shouldn't get here, unless we missed a type from above. + mathutil_cat.error() + << "Unexpected type in BoundingSphere::around_finite()\n"; + nassertr(false, false); + } } } } @@ -401,7 +401,7 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const { // Tangent. t1 = t2 = -B / (2.0f*A); return (t1 >= 0.0f && t1 <= 1.0f) ? - IF_possible | IF_some : IF_no_intersection; + IF_possible | IF_some : IF_no_intersection; } if (radical < 0.0f) { @@ -409,7 +409,7 @@ contains_lineseg(const LPoint3f &a, const LPoint3f &b) const { return IF_no_intersection; } - float reciprocal_2A = 1.0f/(2.0f*A); + float reciprocal_2A = 1.0f/(2.0f*A); float sqrt_radical = sqrtf(radical); t1 = ( -B - sqrt_radical ) * reciprocal_2A; diff --git a/panda/src/mathutil/boundingSphere.h b/panda/src/mathutil/boundingSphere.h index c400aa59f1..28667cd4c6 100644 --- a/panda/src/mathutil/boundingSphere.h +++ b/panda/src/mathutil/boundingSphere.h @@ -11,7 +11,7 @@ #include "finiteBoundingVolume.h" /////////////////////////////////////////////////////////////////// -// Class : BoundingSphere +// Class : BoundingSphere // Description : This defines a bounding sphere, consisting of a // center and a radius. It is always a sphere, and // never an ellipsoid or other quadric. @@ -39,8 +39,8 @@ PUBLISHED: protected: virtual bool extend_other(BoundingVolume *other) const; virtual bool around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const; + const BoundingVolume **first, + const BoundingVolume **last) const; virtual int contains_other(const BoundingVolume *other) const; @@ -50,13 +50,13 @@ protected: bool extend_by_finite(const FiniteBoundingVolume *volume); virtual bool around_points(const LPoint3f *first, - const LPoint3f *last); + const LPoint3f *last); virtual bool around_spheres(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual bool around_hexahedrons(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); bool around_finite(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual int contains_point(const LPoint3f &point) const; virtual int contains_lineseg(const LPoint3f &a, const LPoint3f &b) const; @@ -76,7 +76,7 @@ public: static void init_type() { FiniteBoundingVolume::init_type(); register_type(_type_handle, "BoundingSphere", - FiniteBoundingVolume::get_class_type()); + FiniteBoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/boundingVolume.cxx b/panda/src/mathutil/boundingVolume.cxx index a32f14acda..da8ac610b8 100644 --- a/panda/src/mathutil/boundingVolume.cxx +++ b/panda/src/mathutil/boundingVolume.cxx @@ -40,8 +40,8 @@ around(const BoundingVolume **first, const BoundingVolume **last) { const BoundingVolume **bvi; for (bvi = first; bvi != last; ++bvi) { if ((*bvi)->is_infinite()) { - _flags = F_infinite; - return true; + _flags = F_infinite; + return true; } } diff --git a/panda/src/mathutil/boundingVolume.h b/panda/src/mathutil/boundingVolume.h index a79719055f..bc1b6f4da6 100644 --- a/panda/src/mathutil/boundingVolume.h +++ b/panda/src/mathutil/boundingVolume.h @@ -17,7 +17,7 @@ class BoundingLine; /////////////////////////////////////////////////////////////////// -// Class : BoundingVolume +// Class : BoundingVolume // Description : This is an abstract class for any volume in any sense // which can be said to define the locality of reference // of a node in a graph, along with all of its @@ -42,7 +42,7 @@ PUBLISHED: // could have true STL-style first/last iterators, but that's // impossible for virtual functions. bool around(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); // The contains() functions return the union of one or more of these // bits. @@ -96,8 +96,8 @@ protected: // These functions are the first dispatch point. virtual bool extend_other(BoundingVolume *other) const=0; virtual bool around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const=0; + const BoundingVolume **first, + const BoundingVolume **last) const=0; virtual int contains_other(const BoundingVolume *other) const=0; // These functions are the second dispatch point. They actually do @@ -107,11 +107,11 @@ protected: virtual bool extend_by_line(const BoundingLine *line); virtual bool around_spheres(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual bool around_hexahedrons(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual bool around_lines(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual int contains_sphere(const BoundingSphere *sphere) const; virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const; @@ -125,7 +125,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "BoundingVolume", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/fftCompressor.cxx b/panda/src/mathutil/fftCompressor.cxx index c0c783069a..24d65d4053 100644 --- a/panda/src/mathutil/fftCompressor.cxx +++ b/panda/src/mathutil/fftCompressor.cxx @@ -253,7 +253,7 @@ write_reals(Datagram &datagram, const float *array, int length) { // just for that. if (run_width == RW_8 && num_width == RW_0) { if (i + 1 >= length || half_complex[i + 1] != 0.0) { - num_width = RW_8; + num_width = RW_8; } } @@ -380,9 +380,9 @@ write_hprs(Datagram &datagram, const LVecBase3f *array, int length) { LVecBase3f scale; bool d1 = decompose_matrix(mat, scale, hpr1); bool d2 = decompose_matrix(mat2, scale, hpr2); - mathutil_cat.warning() - << "Converted hpr to quaternion incorrectly!\n" - << " Source hpr: " << array[i]; + mathutil_cat.warning() + << "Converted hpr to quaternion incorrectly!\n" + << " Source hpr: " << array[i]; if (d1) { mathutil_cat.warning(false) << ", or " << hpr1 << "\n"; @@ -557,7 +557,7 @@ read_hprs(DatagramIterator &di, vector_LVecBase3f &array) { if (okflag) { nassertr(h.size() == p.size() && p.size() == r.size(), false); for (int i = 0; i < (int)h.size(); i++) { - array.push_back(LVecBase3f(h[i], p[i], r[i])); + array.push_back(LVecBase3f(h[i], p[i], r[i])); } } @@ -635,8 +635,8 @@ read_hprs(DatagramIterator &di, vector_LVecBase3f &array) { #ifndef NDEBUG if (_quality >= 102) { - // If we have written out all four components, use them. - rot[0] = qr[i]; + // If we have written out all four components, use them. + rot[0] = qr[i]; if (!IS_THRESHOLD_EQUAL(qr[i], qr1, 0.001)) { mathutil_cat.warning() @@ -700,7 +700,7 @@ free_storage() { //////////////////////////////////////////////////////////////////// int FFTCompressor:: write_run(Datagram &datagram, FFTCompressor::RunWidth run_width, - const vector_double &run) { + const vector_double &run) { if (run.empty()) { return 0; } @@ -712,7 +712,7 @@ write_run(Datagram &datagram, FFTCompressor::RunWidth run_width, // run. if (run.size() <= RW_length_mask && - ((int)run_width | run.size()) != RW_double) { + ((int)run_width | run.size()) != RW_double) { // If there are enough bits remaining in the byte, use them to // indicate the length of the run. We have to be a little // careful, however, not to accidentally write a byte that looks diff --git a/panda/src/mathutil/fftCompressor.h b/panda/src/mathutil/fftCompressor.h index e5e51f46ca..15ab9bd0c6 100644 --- a/panda/src/mathutil/fftCompressor.h +++ b/panda/src/mathutil/fftCompressor.h @@ -17,7 +17,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : FFTCompressor +// Class : FFTCompressor // Description : This class manages a lossy compression and // decompression of a stream of floating-point numbers // to a datagram, based a fourier transform algorithm @@ -68,7 +68,7 @@ private: }; int write_run(Datagram &datagram, RunWidth run_width, - const vector_double &run); + const vector_double &run); int read_run(DatagramIterator &di, vector_double &run); double get_scale_factor(int i, int length) const; static double interpolate(double t, double a, double b); diff --git a/panda/src/mathutil/finiteBoundingVolume.h b/panda/src/mathutil/finiteBoundingVolume.h index 90c6ca8812..836141c4a4 100644 --- a/panda/src/mathutil/finiteBoundingVolume.h +++ b/panda/src/mathutil/finiteBoundingVolume.h @@ -12,7 +12,7 @@ /////////////////////////////////////////////////////////////////// -// Class : FiniteBoundingVolume +// Class : FiniteBoundingVolume // Description : A special kind of GeometricBoundingVolume that is // known to be finite. It is possible to query this // kind of volume for its minimum and maximum extents. @@ -30,7 +30,7 @@ public: static void init_type() { GeometricBoundingVolume::init_type(); register_type(_type_handle, "FiniteBoundingVolume", - GeometricBoundingVolume::get_class_type()); + GeometricBoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/frustum_src.I b/panda/src/mathutil/frustum_src.I index 009be85cd1..7119921165 100644 --- a/panda/src/mathutil/frustum_src.I +++ b/panda/src/mathutil/frustum_src.I @@ -58,7 +58,7 @@ INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE f //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL void FLOATNAME(Frustum):: make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r, - FLOATTYPE t, FLOATTYPE b) { + FLOATTYPE t, FLOATTYPE b) { _fnear = fnear; _ffar = ffar; _l = l; @@ -71,27 +71,27 @@ make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r, // Function: make_perspective // Access: // Description: Behaves like gluPerspective (Aspect = width/height, -// Yfov in degrees) +// Yfov in degrees) // aspect // +------------+ -// | | +// | | // 1 | | yfov // | | // +------------+ // // -------+------ // \ | / -// \ | / -// \ | / -// \ | / -// \ | / -// \|/ -// W yfov +// \ | / +// \ | / +// \ | / +// \ | / +// \|/ +// W yfov // //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL void FLOATNAME(Frustum):: make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear, - FLOATTYPE ffar) { + FLOATTYPE ffar) { _fnear = fnear; _ffar = ffar; _r = tan(deg_2_rad(hfov) * FLOATCONST(0.5)) * _fnear; @@ -103,7 +103,7 @@ make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear, INLINE_MATHUTIL void FLOATNAME(Frustum):: make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear, - FLOATTYPE ffar) { + FLOATTYPE ffar) { _fnear = fnear; _ffar = ffar; _t = tan(deg_2_rad(yfov) * 0.5f) * _fnear; @@ -115,7 +115,7 @@ make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear, INLINE_MATHUTIL void FLOATNAME(Frustum):: make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear, - FLOATTYPE ffar) { + FLOATTYPE ffar) { _fnear = fnear; _ffar = ffar; _t = tan(deg_2_rad(yfov) * 0.5f) * _fnear; @@ -131,7 +131,7 @@ make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear, //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL void FLOATNAME(Frustum):: get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect, - FLOATTYPE& fnear, FLOATTYPE& ffar) const { + FLOATTYPE& fnear, FLOATTYPE& ffar) const { yfov = rad_2_deg(atan(_t / _fnear)) * 2.0f; aspect = _r / _t; fnear = _fnear; @@ -145,7 +145,7 @@ get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect, //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL void FLOATNAME(Frustum):: get_perspective_params(FLOATTYPE& xfov, FLOATTYPE& yfov, FLOATTYPE& aspect, - FLOATTYPE& fnear, FLOATTYPE& ffar) const { + FLOATTYPE& fnear, FLOATTYPE& ffar) const { xfov = rad_2_deg(atan(_r / _fnear)) * 2.0f; get_perspective_params(yfov, aspect, fnear, ffar); } @@ -187,15 +187,15 @@ get_perspective_projection_mat(CoordinateSystem cs) const { switch (cs) { case CS_zup_right: return FLOATNAME(LMatrix4)( a, 0.0f, 0.0f, 0.0f, - 0.0f, -b, c, 1.0f, - d, e, 0.0f, 0.0f, - 0.0f, 0.0f, f, 0.0f); + 0.0f, -b, c, 1.0f, + d, e, 0.0f, 0.0f, + 0.0f, 0.0f, f, 0.0f); case CS_yup_right: return FLOATNAME(LMatrix4)( a, 0.0f, 0.0f, 0.0f, - 0.0f, e, 0.0f, 0.0f, - d, b, -c,-1.0f, - 0.0f, 0.0f, f, 0.0f); + 0.0f, e, 0.0f, 0.0f, + d, b, -c,-1.0f, + 0.0f, 0.0f, f, 0.0f); case CS_zup_left: return FLOATNAME(LMatrix4)::convert_mat(CS_zup_right, CS_zup_left) * diff --git a/panda/src/mathutil/frustum_src.h b/panda/src/mathutil/frustum_src.h index a929badd0e..e647d55c31 100644 --- a/panda/src/mathutil/frustum_src.h +++ b/panda/src/mathutil/frustum_src.h @@ -16,19 +16,19 @@ PUBLISHED: INLINE_MATHUTIL void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar); INLINE_MATHUTIL void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, - FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b); + FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b); INLINE_MATHUTIL void make_perspective_hfov(FLOATTYPE xfov, FLOATTYPE aspect, - FLOATTYPE fnear, FLOATTYPE ffar); + FLOATTYPE fnear, FLOATTYPE ffar); INLINE_MATHUTIL void make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, - FLOATTYPE fnear, FLOATTYPE ffar); + FLOATTYPE fnear, FLOATTYPE ffar); INLINE_MATHUTIL void make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear, - FLOATTYPE ffar); + FLOATTYPE ffar); INLINE_MATHUTIL void get_perspective_params(FLOATTYPE &yfov, FLOATTYPE &aspect, - FLOATTYPE &fnear, FLOATTYPE &ffar) const; + FLOATTYPE &fnear, FLOATTYPE &ffar) const; INLINE_MATHUTIL void get_perspective_params(FLOATTYPE &xfov, FLOATTYPE &yfov, - FLOATTYPE &aspect, FLOATTYPE &fnear, - FLOATTYPE &ffar) const; + FLOATTYPE &aspect, FLOATTYPE &fnear, + FLOATTYPE &ffar) const; public: INLINE_MATHUTIL FLOATNAME(LMatrix4) diff --git a/panda/src/mathutil/geometricBoundingVolume.I b/panda/src/mathutil/geometricBoundingVolume.I index 729552330e..7a30b80025 100644 --- a/panda/src/mathutil/geometricBoundingVolume.I +++ b/panda/src/mathutil/geometricBoundingVolume.I @@ -44,7 +44,7 @@ INLINE_MATHUTIL bool GeometricBoundingVolume:: around(const GeometricBoundingVolume **first, const GeometricBoundingVolume **last) { return BoundingVolume::around((const BoundingVolume **)first, - (const BoundingVolume **)last); + (const BoundingVolume **)last); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/mathutil/geometricBoundingVolume.h b/panda/src/mathutil/geometricBoundingVolume.h index b37a7fe864..8ce156d7a1 100644 --- a/panda/src/mathutil/geometricBoundingVolume.h +++ b/panda/src/mathutil/geometricBoundingVolume.h @@ -14,7 +14,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : GeometricBoundingVolume +// Class : GeometricBoundingVolume // Description : This is another abstract class, for a general class // of bounding volumes that actually enclose points in // 3-d space, such as BSP's and bounding spheres. @@ -31,9 +31,9 @@ PUBLISHED: // could have true STL-style first/last iterators, but that's // impossible for virtual functions. INLINE_MATHUTIL bool around(const GeometricBoundingVolume **first, - const GeometricBoundingVolume **last); + const GeometricBoundingVolume **last); INLINE_MATHUTIL bool around(const LPoint3f *first, - const LPoint3f *last); + const LPoint3f *last); INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const; INLINE_MATHUTIL int contains(const LPoint3f &point) const; @@ -48,7 +48,7 @@ protected: virtual bool extend_by_point(const LPoint3f &point); virtual bool around_points(const LPoint3f *first, - const LPoint3f *last); + const LPoint3f *last); virtual int contains_point(const LPoint3f &point) const; virtual int contains_lineseg(const LPoint3f &a, const LPoint3f &b) const; @@ -60,7 +60,7 @@ public: static void init_type() { BoundingVolume::init_type(); register_type(_type_handle, "GeometricBoundingVolume", - BoundingVolume::get_class_type()); + BoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/omniBoundingVolume.cxx b/panda/src/mathutil/omniBoundingVolume.cxx index 4ae67114e6..9d50d323b6 100644 --- a/panda/src/mathutil/omniBoundingVolume.cxx +++ b/panda/src/mathutil/omniBoundingVolume.cxx @@ -68,8 +68,8 @@ extend_other(BoundingVolume *other) const { //////////////////////////////////////////////////////////////////// bool OmniBoundingVolume:: around_other(BoundingVolume *other, - const BoundingVolume **, - const BoundingVolume **) const { + const BoundingVolume **, + const BoundingVolume **) const { other->set_infinite(); return true; } @@ -131,7 +131,7 @@ around_points(const LPoint3f *, const LPoint3f *) { //////////////////////////////////////////////////////////////////// bool OmniBoundingVolume:: around_spheres(const BoundingVolume **, - const BoundingVolume **) { + const BoundingVolume **) { return true; } @@ -142,7 +142,7 @@ around_spheres(const BoundingVolume **, //////////////////////////////////////////////////////////////////// bool OmniBoundingVolume:: around_hexahedrons(const BoundingVolume **, - const BoundingVolume **) { + const BoundingVolume **) { return true; } diff --git a/panda/src/mathutil/omniBoundingVolume.h b/panda/src/mathutil/omniBoundingVolume.h index 4666197c45..249ece36c7 100644 --- a/panda/src/mathutil/omniBoundingVolume.h +++ b/panda/src/mathutil/omniBoundingVolume.h @@ -11,7 +11,7 @@ #include "geometricBoundingVolume.h" /////////////////////////////////////////////////////////////////// -// Class : OmniBoundingVolume +// Class : OmniBoundingVolume // Description : This is a special kind of GeometricBoundingVolume // that fills all of space. //////////////////////////////////////////////////////////////////// @@ -30,8 +30,8 @@ public: protected: virtual bool extend_other(BoundingVolume *other) const; virtual bool around_other(BoundingVolume *other, - const BoundingVolume **first, - const BoundingVolume **last) const; + const BoundingVolume **first, + const BoundingVolume **last) const; virtual int contains_other(const BoundingVolume *other) const; @@ -40,11 +40,11 @@ protected: virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron); virtual bool around_points(const LPoint3f *first, - const LPoint3f *last); + const LPoint3f *last); virtual bool around_spheres(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual bool around_hexahedrons(const BoundingVolume **first, - const BoundingVolume **last); + const BoundingVolume **last); virtual int contains_point(const LPoint3f &point) const; virtual int contains_lineseg(const LPoint3f &a, const LPoint3f &b) const; @@ -58,7 +58,7 @@ public: static void init_type() { GeometricBoundingVolume::init_type(); register_type(_type_handle, "OmniBoundingVolume", - GeometricBoundingVolume::get_class_type()); + GeometricBoundingVolume::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/mathutil/plane_src.I b/panda/src/mathutil/plane_src.I index 07697eba69..b94cd94c60 100644 --- a/panda/src/mathutil/plane_src.I +++ b/panda/src/mathutil/plane_src.I @@ -42,7 +42,7 @@ FLOATNAME(Plane)(const FLOATNAME(Plane) ©) : //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL FLOATNAME(Plane):: FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, - const FLOATNAME(LPoint3) &c) { + const FLOATNAME(LPoint3) &c) { FLOATNAME(LVector3) u = b - a; FLOATNAME(LVector3) v = c - a; FLOATNAME(LVector3) p = normalize(cross(u, v)); @@ -144,8 +144,8 @@ dist_to_plane(const FLOATNAME(LPoint3) &point) const { //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL bool FLOATNAME(Plane):: intersects_line(FLOATNAME(LPoint3) &intersection_point, - const FLOATNAME(LPoint3) &p1, - const FLOATNAME(LPoint3) &p2) const { + const FLOATNAME(LPoint3) &p1, + const FLOATNAME(LPoint3) &p2) const { FLOATTYPE t; if (!intersects_line(t, p1, p2 - p1)) { return false; @@ -173,8 +173,8 @@ intersects_line(FLOATNAME(LPoint3) &intersection_point, //////////////////////////////////////////////////////////////////// INLINE_MATHUTIL bool FLOATNAME(Plane):: intersects_line(FLOATTYPE &t, - const FLOATNAME(LPoint3) &from, - const FLOATNAME(LVector3) &delta) const { + const FLOATNAME(LPoint3) &from, + const FLOATNAME(LVector3) &delta) const { FLOATTYPE denom = dot(get_normal(), delta); if (IS_NEARLY_ZERO(denom)) { return false; diff --git a/panda/src/mathutil/plane_src.h b/panda/src/mathutil/plane_src.h index 5a7809958e..02e4e1a874 100644 --- a/panda/src/mathutil/plane_src.h +++ b/panda/src/mathutil/plane_src.h @@ -12,9 +12,9 @@ PUBLISHED: INLINE_MATHUTIL FLOATNAME(Plane)(void); INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(Plane) ©); INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b, - const FLOATNAME(LPoint3) &c); + const FLOATNAME(LPoint3) &c); INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, - const FLOATNAME(LPoint3) &point); + const FLOATNAME(LPoint3) &point); INLINE_MATHUTIL FLOATNAME(Plane)& operator = (const FLOATNAME(Plane)& copy); @@ -28,11 +28,11 @@ PUBLISHED: INLINE_MATHUTIL FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const; INLINE_MATHUTIL bool intersects_line(FLOATNAME(LPoint3) &intersection_point, - const FLOATNAME(LPoint3) &p1, - const FLOATNAME(LPoint3) &p2) const; + const FLOATNAME(LPoint3) &p1, + const FLOATNAME(LPoint3) &p2) const; INLINE_MATHUTIL bool intersects_line(FLOATTYPE &t, - const FLOATNAME(LPoint3) &from, - const FLOATNAME(LVector3) &delta) const; + const FLOATNAME(LPoint3) &from, + const FLOATNAME(LVector3) &delta) const; INLINE_MATHUTIL void output(ostream &out) const; INLINE_MATHUTIL void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/mathutil/rotate_to_src.cxx b/panda/src/mathutil/rotate_to_src.cxx index 31c2ff33b8..9e22f4be07 100644 --- a/panda/src/mathutil/rotate_to_src.cxx +++ b/panda/src/mathutil/rotate_to_src.cxx @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////// static void _rotate_to(FLOATNAME(LMatrix3) &mat, - const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b) { + const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b) { FLOATTYPE cos_theta = a.dot(b); FLOATNAME(LVector3) axis = a.cross(b); @@ -27,7 +27,7 @@ _rotate_to(FLOATNAME(LMatrix3) &mat, FLOATNAME(LVector3) absa(fabs(a[0]), fabs(a[1]), fabs(a[2])); FLOATNAME(LVector3) lca(0., 0., 0.); lca[absa[0]<=absa[1] ? absa[0]<=absa[2] ? 0 : 2 - : absa[1]<=absa[2] ? 1 : 2] = 1.0f; + : absa[1]<=absa[2] ? 1 : 2] = 1.0f; axis = normalize(a.cross(lca)); } else { diff --git a/panda/src/mpg123/genre.h b/panda/src/mpg123/genre.h index 3a6c5ba397..02dba93c4a 100644 --- a/panda/src/mpg123/genre.h +++ b/panda/src/mpg123/genre.h @@ -1,262 +1,262 @@ char *genre_table[] = { - "Blues", - "Classic Rock", - "Country", - "Dance", - "Disco", - "Funk", - "Grunge", - "Hip-Hop", - "Jazz", - "Metal", - "New Age", - "Oldies", - "Other", - "Pop", - "R&B", - "Rap", - "Reggae", - "Rock", - "Techno", - "Industrial", - "Alternative", - "Ska", - "Death Metal", - "Pranks", - "Soundtrack", - "Euro-Techno", - "Ambient", - "Trip-Hop", - "Vocal", - "Jazz+Funk", - "Fusion", - "Trance", - "Classical", - "Instrumental", - "Acid", - "House", - "Game", - "Sound Clip", - "Gospel", - "Noise", - "AlternRock", - "Bass", - "Soul", - "Punk", - "Space", - "Meditative", - "Instrumental Pop", - "Instrumental Rock", - "Ethnic", - "Gothic", - "Darkwave", - "Techno-Industrial", - "Electronic", - "Pop-Folk", - "Eurodance", - "Dream", - "Southern Rock", - "Comedy", - "Cult", - "Gangsta", - "Top 40", - "Christian Rap", - "Pop/Funk", - "Jungle", - "Native American", - "Cabaret", - "New Wave", - "Psychadelic", - "Rave", - "Showtunes", - "Trailer", - "Lo-Fi", - "Tribal", - "Acid Punk", - "Acid Jazz", - "Polka", - "Retro", - "Musical", - "Rock & Roll", - "Hard Rock", - "Folk", - "Folk/Rock", - "National folk", - "Swing", - "Fast-fusion", - "Bebob", - "Latin", - "Revival", - "Celtic", - "Bluegrass", - "Avantgarde", - "Gothic Rock", - "Progressive Rock", - "Psychedelic Rock", - "Symphonic Rock", - "Slow Rock", - "Big Band", - "Chorus", - "Easy Listening", - "Acoustic", - "Humour", - "Speech", - "Chanson", - "Opera", - "Chamber Music", - "Sonata", - "Symphony", - "Booty Bass", - "Primus", - "Porn Groove", - "Satire", - "Slow Jam", - "Club", - "Tango", - "Samba", - "Folklore", - "Ballad", - "Powder Ballad", - "Rhythmic Soul", - "Freestyle", - "Duet", - "Punk Rock", - "Drum Solo", - "A Capella", - "Euro-House", - "Dance Hall", - "Goa", - "Drum & Bass", - "Club House", - "Hardcore", - "Terror", - "Indie", - "BritPop", - "NegerPunk", - "Polsk Punk", - "Beat", - "Christian Gangsta", - "Heavy Metal", - "Black Metal", - "Crossover", - "Contemporary C", - "Christian Rock", - "Merengue", - "Salsa", - "Thrash Metal", - "Anime", - "JPop", - "SynthPop" -/* , - "Unknown", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" + "Blues", + "Classic Rock", + "Country", + "Dance", + "Disco", + "Funk", + "Grunge", + "Hip-Hop", + "Jazz", + "Metal", + "New Age", + "Oldies", + "Other", + "Pop", + "R&B", + "Rap", + "Reggae", + "Rock", + "Techno", + "Industrial", + "Alternative", + "Ska", + "Death Metal", + "Pranks", + "Soundtrack", + "Euro-Techno", + "Ambient", + "Trip-Hop", + "Vocal", + "Jazz+Funk", + "Fusion", + "Trance", + "Classical", + "Instrumental", + "Acid", + "House", + "Game", + "Sound Clip", + "Gospel", + "Noise", + "AlternRock", + "Bass", + "Soul", + "Punk", + "Space", + "Meditative", + "Instrumental Pop", + "Instrumental Rock", + "Ethnic", + "Gothic", + "Darkwave", + "Techno-Industrial", + "Electronic", + "Pop-Folk", + "Eurodance", + "Dream", + "Southern Rock", + "Comedy", + "Cult", + "Gangsta", + "Top 40", + "Christian Rap", + "Pop/Funk", + "Jungle", + "Native American", + "Cabaret", + "New Wave", + "Psychadelic", + "Rave", + "Showtunes", + "Trailer", + "Lo-Fi", + "Tribal", + "Acid Punk", + "Acid Jazz", + "Polka", + "Retro", + "Musical", + "Rock & Roll", + "Hard Rock", + "Folk", + "Folk/Rock", + "National folk", + "Swing", + "Fast-fusion", + "Bebob", + "Latin", + "Revival", + "Celtic", + "Bluegrass", + "Avantgarde", + "Gothic Rock", + "Progressive Rock", + "Psychedelic Rock", + "Symphonic Rock", + "Slow Rock", + "Big Band", + "Chorus", + "Easy Listening", + "Acoustic", + "Humour", + "Speech", + "Chanson", + "Opera", + "Chamber Music", + "Sonata", + "Symphony", + "Booty Bass", + "Primus", + "Porn Groove", + "Satire", + "Slow Jam", + "Club", + "Tango", + "Samba", + "Folklore", + "Ballad", + "Powder Ballad", + "Rhythmic Soul", + "Freestyle", + "Duet", + "Punk Rock", + "Drum Solo", + "A Capella", + "Euro-House", + "Dance Hall", + "Goa", + "Drum & Bass", + "Club House", + "Hardcore", + "Terror", + "Indie", + "BritPop", + "NegerPunk", + "Polsk Punk", + "Beat", + "Christian Gangsta", + "Heavy Metal", + "Black Metal", + "Crossover", + "Contemporary C", + "Christian Rock", + "Merengue", + "Salsa", + "Thrash Metal", + "Anime", + "JPop", + "SynthPop" +/* , + "Unknown", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" */ }; diff --git a/panda/src/mpg123/l2tables.h b/panda/src/mpg123/l2tables.h index 643201ef23..980897d01e 100644 --- a/panda/src/mpg123/l2tables.h +++ b/panda/src/mpg123/l2tables.h @@ -6,143 +6,143 @@ */ struct al_table alloc_0[] = { - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767} }; + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767} }; struct al_table alloc_1[] = { - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, - {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767}, - {2,0},{5,3},{7,5},{16,-32767} }; + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767} }; struct al_table alloc_2[] = { - {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, - {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, - {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, - {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; struct al_table alloc_3[] = { - {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, - {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, - {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, - {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; struct al_table alloc_4[] = { - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, - {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, - {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, - {2,0},{5,3},{7,5},{10,9}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, {2,0},{5,3},{7,5},{10,9}, diff --git a/panda/src/mpg123/mpg123.h b/panda/src/mpg123/mpg123.h index 3a3ac5a805..955de61401 100644 --- a/panda/src/mpg123/mpg123.h +++ b/panda/src/mpg123/mpg123.h @@ -33,12 +33,12 @@ typedef unsigned char byte; #define SKIP_JUNK 1 -#ifdef _WIN32 /* Win32 Additions By Tony Million */ +#ifdef _WIN32 /* Win32 Additions By Tony Million */ # undef WIN32 # define WIN32 # define M_PI 3.14159265358979323846 -# define M_SQRT2 1.41421356237309504880 +# define M_SQRT2 1.41421356237309504880 # define REAL_IS_FLOAT # define NEW_DCT9 @@ -75,7 +75,7 @@ typedef unsigned char byte; #include "mpgaudio.h" /* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */ -#define AUDIOBUFSIZE 16384 +#define AUDIOBUFSIZE 16384 #define FALSE 0 #define TRUE 1 @@ -143,21 +143,21 @@ struct frame { #define VBR_SCALE_FLAG 0x0008 struct vbrHeader { - unsigned long flags; - unsigned long frames; - unsigned long bytes; - unsigned long scale; - unsigned char toc[100]; + unsigned long flags; + unsigned long frames; + unsigned long bytes; + unsigned long scale; + unsigned char toc[100]; }; struct parameter { int aggressive; /* renice to max. priority */ - int shuffle; /* shuffle/random play */ - int remote; /* remote operation */ - int outmode; /* where to out the decoded sampels */ - int quiet; /* shut up! */ + int shuffle; /* shuffle/random play */ + int remote; /* remote operation */ + int outmode; /* where to out the decoded sampels */ + int quiet; /* shut up! */ int xterm_title; /* print filename in xterm title */ - long usebuffer; /* second level buffer size */ + long usebuffer; /* second level buffer size */ int tryresync; /* resync stream after error */ int verbose; /* verbose level */ #ifdef TERM_CONTROL @@ -382,7 +382,7 @@ extern int cdr_open(struct audio_info_struct *ai, char *cdrfilename); extern int cdr_close(void); extern int getVBRHeader(struct vbrHeader *head,unsigned char *buf, - struct frame *fr); + struct frame *fr); extern unsigned char *conv16to8; diff --git a/panda/src/mpg123/mpgaudio.h b/panda/src/mpg123/mpgaudio.h index aa304d9812..b5b294e5d3 100644 --- a/panda/src/mpg123/mpgaudio.h +++ b/panda/src/mpg123/mpgaudio.h @@ -7,11 +7,11 @@ #define AUDIO_OUT_LINE_OUT 0x04 enum { DECODE_TEST, DECODE_AUDIO, DECODE_FILE, DECODE_BUFFER, DECODE_WAV, - DECODE_AU,DECODE_CDR,DECODE_AUDIOFILE }; + DECODE_AU,DECODE_CDR,DECODE_AUDIOFILE }; -#define AUDIO_FORMAT_MASK 0x100 -#define AUDIO_FORMAT_16 0x100 -#define AUDIO_FORMAT_8 0x000 +#define AUDIO_FORMAT_MASK 0x100 +#define AUDIO_FORMAT_16 0x100 +#define AUDIO_FORMAT_8 0x000 #define AUDIO_FORMAT_SIGNED_16 0x110 #define AUDIO_FORMAT_UNSIGNED_16 0x120 @@ -21,7 +21,7 @@ enum { DECODE_TEST, DECODE_AUDIO, DECODE_FILE, DECODE_BUFFER, DECODE_WAV, #define AUDIO_FORMAT_ALAW_8 0x8 /* 3% rate tolerance */ -#define AUDIO_RATE_TOLERANCE 3 +#define AUDIO_RATE_TOLERANCE 3 #if 0 #if defined(HPUX) || defined(SUNOS) || defined(SOLARIS) || defined(OSS) || defined(__NetBSD__) || defined(SPARCLINUX) || defined(__FreeBSD__) diff --git a/panda/src/mpg123/xfermem.h b/panda/src/mpg123/xfermem.h index ae7e5afd80..c78402d710 100644 --- a/panda/src/mpg123/xfermem.h +++ b/panda/src/mpg123/xfermem.h @@ -19,15 +19,15 @@ #endif typedef struct { - int freeindex; /* [W] next free index */ - int readindex; /* [R] next index to read */ - int fd[2]; - int wakeme[2]; - byte *data; - byte *metadata; - int size; - int metasize; - int buf[3]; + int freeindex; /* [W] next free index */ + int readindex; /* [R] next index to read */ + int fd[2]; + int wakeme[2]; + byte *data; + byte *metadata; + int size; + int metasize; + int buf[3]; } txfermem; /* * [W] -- May be written to by the writing process only! diff --git a/panda/src/net/connection.cxx b/panda/src/net/connection.cxx index 17ca4211ca..666b49ec12 100644 --- a/panda/src/net/connection.cxx +++ b/panda/src/net/connection.cxx @@ -109,10 +109,10 @@ send_datagram(const NetDatagram &datagram) { string data = header.get_header() + datagram.get_message(); bytes_sent = data.length(); result = PR_SendTo(_socket, - data.data(), bytes_sent, - 0, - datagram.get_address().get_addr(), - PR_INTERVAL_NO_TIMEOUT); + data.data(), bytes_sent, + 0, + datagram.get_address().get_addr(), + PR_INTERVAL_NO_TIMEOUT); if (net_cat.is_debug()) { header.verify_datagram(datagram); @@ -122,9 +122,9 @@ send_datagram(const NetDatagram &datagram) { string data = header.get_header() + datagram.get_message(); bytes_sent = data.length(); result = PR_Send(_socket, - data.data(), bytes_sent, - 0, - PR_INTERVAL_NO_TIMEOUT); + data.data(), bytes_sent, + 0, + PR_INTERVAL_NO_TIMEOUT); if (net_cat.is_debug()) { header.verify_datagram(datagram); @@ -138,14 +138,14 @@ send_datagram(const NetDatagram &datagram) { if (result < 0) { if (errcode == PR_CONNECT_RESET_ERROR #ifdef PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_CONNECT_ABORTED_ERROR + || errcode == PR_SOCKET_SHUTDOWN_ERROR + || errcode == PR_CONNECT_ABORTED_ERROR #endif - ) { + ) { // The connection has been reset; tell our manager about it // and ignore it. if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(this); + _manager->connection_reset(this); } } else if (errcode != PR_PENDING_INTERRUPT_ERROR) { diff --git a/panda/src/net/connection.h b/panda/src/net/connection.h index b2f5f89f93..7cb59b26a1 100644 --- a/panda/src/net/connection.h +++ b/panda/src/net/connection.h @@ -19,7 +19,7 @@ class ConnectionManager; class NetDatagram; //////////////////////////////////////////////////////////////////// -// Class : Connection +// Class : Connection // Description : Represents a single TCP or UDP socket for input or // output. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/net/connectionListener.h b/panda/src/net/connectionListener.h index 890a9a1aaa..f85427bdfc 100644 --- a/panda/src/net/connectionListener.h +++ b/panda/src/net/connectionListener.h @@ -13,7 +13,7 @@ class NetAddress; //////////////////////////////////////////////////////////////////// -// Class : ConnectionListener +// Class : ConnectionListener // Description : This is a special kind of ConnectionReader that waits // for activity on a rendezvous port and accepts a TCP // connection (instead of attempting to read a datagram @@ -30,8 +30,8 @@ PUBLISHED: protected: virtual void receive_datagram(const NetDatagram &datagram); virtual void connection_opened(const PT(Connection) &rendezvous, - const NetAddress &address, - const PT(Connection) &new_connection)=0; + const NetAddress &address, + const PT(Connection) &new_connection)=0; virtual void process_incoming_data(SocketInfo *sinfo); diff --git a/panda/src/net/connectionManager.cxx b/panda/src/net/connectionManager.cxx index b16f948576..e3945fefc1 100644 --- a/panda/src/net/connectionManager.cxx +++ b/panda/src/net/connectionManager.cxx @@ -161,7 +161,7 @@ open_TCP_client_connection(const NetAddress &address, int timeout_ms) { } PRStatus result = PR_Connect(socket, address.get_addr(), - PR_MillisecondsToInterval(timeout_ms)); + PR_MillisecondsToInterval(timeout_ms)); if (result != PR_SUCCESS) { if (PR_GetError() != PR_CONNECT_RESET_ERROR) { pprerror("PR_Connect"); @@ -191,7 +191,7 @@ open_TCP_client_connection(const NetAddress &address, int timeout_ms) { //////////////////////////////////////////////////////////////////// PT(Connection) ConnectionManager:: open_TCP_client_connection(const string &hostname, int port, - int timeout_ms) { + int timeout_ms) { NetAddress address; if (!address.set_host(hostname, port)) { return PT(Connection)(); @@ -248,7 +248,7 @@ close_connection(const PT(Connection) &connection) { if (result != PR_SUCCESS) { PRErrorCode errcode = PR_GetError(); if (errcode != PR_NOT_CONNECTED_ERROR) { - pprerror("PR_Shutdown"); + pprerror("PR_Shutdown"); } } } diff --git a/panda/src/net/connectionManager.h b/panda/src/net/connectionManager.h index 6bef5c5a1f..7a1458f9f8 100644 --- a/panda/src/net/connectionManager.h +++ b/panda/src/net/connectionManager.h @@ -21,7 +21,7 @@ class ConnectionReader; class ConnectionWriter; //////////////////////////////////////////////////////////////////// -// Class : ConnectionManager +// Class : ConnectionManager // Description : The primary interface to the low-level networking // layer in this package. A ConnectionManager is used // to establish and destroy TCP and UDP connections. @@ -44,9 +44,9 @@ PUBLISHED: PT(Connection) open_TCP_server_rendezvous(int port, int backlog); PT(Connection) open_TCP_client_connection(const NetAddress &address, - int timeout_ms); + int timeout_ms); PT(Connection) open_TCP_client_connection(const string &hostname, int port, - int timeout_ms); + int timeout_ms); bool close_connection(const PT(Connection) &connection); diff --git a/panda/src/net/connectionReader.cxx b/panda/src/net/connectionReader.cxx index 47ffd17050..23ea79e9cf 100644 --- a/panda/src/net/connectionReader.cxx +++ b/panda/src/net/connectionReader.cxx @@ -90,11 +90,11 @@ ConnectionReader(ConnectionManager *manager, int num_threads) : for (int i = 0; i < num_threads; i++) { PRThread *thread = PR_CreateThread(PR_USER_THREAD, - thread_start, (void *)this, - PR_PRIORITY_NORMAL, - PR_GLOBAL_THREAD, // Since thread will mostly do I/O. - PR_JOINABLE_THREAD, - 0); // Select a suitable stack size. + thread_start, (void *)this, + PR_PRIORITY_NORMAL, + PR_GLOBAL_THREAD, // Since thread will mostly do I/O. + PR_JOINABLE_THREAD, + 0); // Select a suitable stack size. nassertv(thread != (PRThread *)NULL); _threads.push_back(thread); @@ -129,8 +129,8 @@ ConnectionReader:: delete sinfo; } else { net_cat.error() - << "Reentrant deletion of ConnectionReader--don't delete these\n" - << "in response to connection_reset().\n"; + << "Reentrant deletion of ConnectionReader--don't delete these\n" + << "in response to connection_reset().\n"; // We'll have to do the best we can to recover. sinfo->_connection.clear(); @@ -421,7 +421,7 @@ process_incoming_udp_data(SocketInfo *sinfo) { PRInt32 bytes_read; bytes_read = PR_RecvFrom(socket, buffer, read_buffer_size, 0, - &addr, PR_INTERVAL_NO_TIMEOUT); + &addr, PR_INTERVAL_NO_TIMEOUT); if (bytes_read < 0) { PRErrorCode errcode = PR_GetError(); @@ -499,24 +499,24 @@ process_incoming_tcp_data(SocketInfo *sinfo) { while (header_bytes_read < datagram_tcp_header_size) { PRInt32 bytes_read = PR_Recv(socket, buffer + header_bytes_read, - datagram_tcp_header_size - header_bytes_read, 0, - PR_INTERVAL_NO_TIMEOUT); + datagram_tcp_header_size - header_bytes_read, 0, + PR_INTERVAL_NO_TIMEOUT); if (bytes_read < 0) { PRErrorCode errcode = PR_GetError(); if (errcode == PR_CONNECT_RESET_ERROR #ifdef PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_CONNECT_ABORTED_ERROR + || errcode == PR_SOCKET_SHUTDOWN_ERROR + || errcode == PR_CONNECT_ABORTED_ERROR #endif - ) { - // The socket was closed. - if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(sinfo->_connection); - } - + ) { + // The socket was closed. + if (_manager != (ConnectionManager *)NULL) { + _manager->connection_reset(sinfo->_connection); + } + } else if (errcode != PR_PENDING_INTERRUPT_ERROR) { - pprerror("PR_Recv"); + pprerror("PR_Recv"); } finish_socket(sinfo); return; @@ -524,7 +524,7 @@ process_incoming_tcp_data(SocketInfo *sinfo) { } else if (bytes_read == 0) { // The socket was closed. Report that and return. if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(sinfo->_connection); + _manager->connection_reset(sinfo->_connection); } finish_socket(sinfo); return; @@ -555,26 +555,26 @@ process_incoming_tcp_data(SocketInfo *sinfo) { bytes_read = PR_Recv(socket, buffer, - min((PRInt32)read_buffer_size, - (PRInt32)(size - datagram.get_length())), - 0, PR_INTERVAL_NO_TIMEOUT); + min((PRInt32)read_buffer_size, + (PRInt32)(size - datagram.get_length())), + 0, PR_INTERVAL_NO_TIMEOUT); PRInt8 *dp = buffer; if (bytes_read < 0) { PRErrorCode errcode = PR_GetError(); if (errcode == PR_CONNECT_RESET_ERROR #ifdef PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_SOCKET_SHUTDOWN_ERROR - || errcode == PR_CONNECT_ABORTED_ERROR + || errcode == PR_SOCKET_SHUTDOWN_ERROR + || errcode == PR_CONNECT_ABORTED_ERROR #endif - ) { - // The socket was closed. - if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(sinfo->_connection); - } - + ) { + // The socket was closed. + if (_manager != (ConnectionManager *)NULL) { + _manager->connection_reset(sinfo->_connection); + } + } else if (errcode != PR_PENDING_INTERRUPT_ERROR) { - pprerror("PR_Recv"); + pprerror("PR_Recv"); } finish_socket(sinfo); return; @@ -582,7 +582,7 @@ process_incoming_tcp_data(SocketInfo *sinfo) { } else if (bytes_read == 0) { // The socket was closed. Report that and return. if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(sinfo->_connection); + _manager->connection_reset(sinfo->_connection); } finish_socket(sinfo); return; @@ -596,8 +596,8 @@ process_incoming_tcp_data(SocketInfo *sinfo) { // There were some extra bytes at the end of the datagram. Maybe // the beginning of the next datagram? Huh. net_cat.error() - << "Discarding " << bytes_read - datagram_bytes - << " bytes following TCP datagram.\n"; + << "Discarding " << bytes_read - datagram_bytes + << " bytes following TCP datagram.\n"; } } @@ -659,7 +659,7 @@ thread_run() { while (!_shutdown) { SocketInfo *sinfo = get_next_available_socket(PR_INTERVAL_NO_TIMEOUT, - current_thread_index); + current_thread_index); if (sinfo != (SocketInfo *)NULL) { process_incoming_data(sinfo); } @@ -681,7 +681,7 @@ thread_run() { //////////////////////////////////////////////////////////////////// ConnectionReader::SocketInfo *ConnectionReader:: get_next_available_socket(PRIntervalTime timeout, - PRInt32 current_thread_index) { + PRInt32 current_thread_index) { // Go to sleep on the select() mutex. This guarantees that only one // thread is in this function at a time. PR_Lock(_select_mutex); @@ -698,27 +698,27 @@ get_next_available_socket(PRIntervalTime timeout, _next_index++; if (_poll[i].out_flags != 0) { - _num_results--; - SocketInfo *sinfo = _polled_sockets[i]; - - if ((_poll[i].out_flags & PR_POLL_READ) != 0) { - // Some genuine noise on the port. - sinfo->_busy = true; - _reexamine_sockets = true; - PR_Unlock(_select_mutex); - PR_Sleep(PR_INTERVAL_NO_WAIT); - return sinfo; + _num_results--; + SocketInfo *sinfo = _polled_sockets[i]; - } else if ((_poll[i].out_flags & - (PR_POLL_ERR | PR_POLL_NVAL | PR_POLL_HUP)) != 0) { - // Something bad happened to this socket. Tell the - // ConnectionManager to drop it. - if (_manager != (ConnectionManager *)NULL) { - _manager->connection_reset(sinfo->_connection); - } - sinfo->_error = true; - _reexamine_sockets = true; - } + if ((_poll[i].out_flags & PR_POLL_READ) != 0) { + // Some genuine noise on the port. + sinfo->_busy = true; + _reexamine_sockets = true; + PR_Unlock(_select_mutex); + PR_Sleep(PR_INTERVAL_NO_WAIT); + return sinfo; + + } else if ((_poll[i].out_flags & + (PR_POLL_ERR | PR_POLL_NVAL | PR_POLL_HUP)) != 0) { + // Something bad happened to this socket. Tell the + // ConnectionManager to drop it. + if (_manager != (ConnectionManager *)NULL) { + _manager->connection_reset(sinfo->_connection); + } + sinfo->_error = true; + _reexamine_sockets = true; + } } } @@ -735,10 +735,10 @@ get_next_available_socket(PRIntervalTime timeout, PR_AtomicSet(&_currently_polling_thread, current_thread_index); if (_reexamine_sockets) { - _reexamine_sockets = false; - rebuild_poll_list(); - num_sockets = _polled_sockets.size(); - nassertr(num_sockets == (int)_poll.size(), NULL); + _reexamine_sockets = false; + rebuild_poll_list(); + num_sockets = _polled_sockets.size(); + nassertr(num_sockets == (int)_poll.size(), NULL); } // Now we can execute PR_Poll(). This basically maps to a Unix @@ -747,31 +747,31 @@ get_next_available_socket(PRIntervalTime timeout, _next_index = 0; if (!_shutdown) { - PRIntervalTime poll_timeout = - PR_MillisecondsToInterval(max_timeout_ms); - if (timeout != PR_INTERVAL_NO_TIMEOUT) { - poll_timeout = min(timeout, poll_timeout); - } + PRIntervalTime poll_timeout = + PR_MillisecondsToInterval(max_timeout_ms); + if (timeout != PR_INTERVAL_NO_TIMEOUT) { + poll_timeout = min(timeout, poll_timeout); + } - _num_results = PR_Poll(&_poll[0], num_sockets, poll_timeout); + _num_results = PR_Poll(&_poll[0], num_sockets, poll_timeout); } if (_num_results == 0 && timeout == PR_INTERVAL_NO_TIMEOUT) { - // If we reached max_timeout_ms, but the caller didn't request - // a timeout, consider that an interrupt: go back and - // reconsider. (This is a kludge around the fact that - // PR_Poll() appears to be non-interruptible.) - interrupted = true; + // If we reached max_timeout_ms, but the caller didn't request + // a timeout, consider that an interrupt: go back and + // reconsider. (This is a kludge around the fact that + // PR_Poll() appears to be non-interruptible.) + interrupted = true; } else if (_num_results < 0) { - // If our poll was interrupted by another thread, rebuild the - // list and poll again. - PRErrorCode errcode = PR_GetError(); - if (errcode == PR_PENDING_INTERRUPT_ERROR) { - interrupted = true; - } else { - pprerror("PR_Poll"); - } + // If our poll was interrupted by another thread, rebuild the + // list and poll again. + PRErrorCode errcode = PR_GetError(); + if (errcode == PR_PENDING_INTERRUPT_ERROR) { + interrupted = true; + } else { + pprerror("PR_Poll"); + } } } while (!_shutdown && interrupted); @@ -823,9 +823,9 @@ rebuild_poll_list() { for (si = _removed_sockets.begin(); si != _removed_sockets.end(); ++si) { SocketInfo *sinfo = (*si); if (sinfo->_busy) { - still_busy_sockets.push_back(sinfo); + still_busy_sockets.push_back(sinfo); } else { - delete sinfo; + delete sinfo; } } _removed_sockets.swap(still_busy_sockets); diff --git a/panda/src/net/connectionReader.h b/panda/src/net/connectionReader.h index 12267432b7..8c11c08296 100644 --- a/panda/src/net/connectionReader.h +++ b/panda/src/net/connectionReader.h @@ -22,7 +22,7 @@ class NetDatagram; class ConnectionManager; //////////////////////////////////////////////////////////////////// -// Class : ConnectionReader +// Class : ConnectionReader // Description : This is an abstract base class for a family of // classes that listen for activity on a socket and // respond to it, for instance by reading a datagram and @@ -96,7 +96,7 @@ private: void thread_run(); SocketInfo *get_next_available_socket(PRIntervalTime timeout, - PRInt32 current_thread_index); + PRInt32 current_thread_index); void rebuild_poll_list(); diff --git a/panda/src/net/connectionWriter.cxx b/panda/src/net/connectionWriter.cxx index 2a3a98b166..68be4dcec9 100644 --- a/panda/src/net/connectionWriter.cxx +++ b/panda/src/net/connectionWriter.cxx @@ -30,11 +30,11 @@ ConnectionWriter(ConnectionManager *manager, int num_threads) : for (int i = 0; i < num_threads; i++) { PRThread *thread = PR_CreateThread(PR_USER_THREAD, - thread_start, (void *)this, - PR_PRIORITY_NORMAL, - PR_GLOBAL_THREAD, // Since thread will mostly do I/O. - PR_JOINABLE_THREAD, - 0); // Select a suitable stack size. + thread_start, (void *)this, + PR_PRIORITY_NORMAL, + PR_GLOBAL_THREAD, // Since thread will mostly do I/O. + PR_JOINABLE_THREAD, + 0); // Select a suitable stack size. nassertv(thread != (PRThread *)NULL); _threads.push_back(thread); diff --git a/panda/src/net/connectionWriter.h b/panda/src/net/connectionWriter.h index 5f162c7e47..0e05058295 100644 --- a/panda/src/net/connectionWriter.h +++ b/panda/src/net/connectionWriter.h @@ -20,7 +20,7 @@ class ConnectionManager; class NetAddress; //////////////////////////////////////////////////////////////////// -// Class : ConnectionWriter +// Class : ConnectionWriter // Description : This class handles threaded delivery of datagrams to // various TCP or UDP sockets. // @@ -35,11 +35,11 @@ PUBLISHED: ~ConnectionWriter(); bool send(const Datagram &datagram, - const PT(Connection) &connection); + const PT(Connection) &connection); bool send(const Datagram &datagram, - const PT(Connection) &connection, - const NetAddress &address); + const PT(Connection) &connection, + const NetAddress &address); bool is_valid_for_udp(const Datagram &datagram) const; diff --git a/panda/src/net/datagramQueue.h b/panda/src/net/datagramQueue.h index bc7e42716b..8ccc2862a1 100644 --- a/panda/src/net/datagramQueue.h +++ b/panda/src/net/datagramQueue.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DatagramQueue +// Class : DatagramQueue // Description : A thread-safe, FIFO queue of NetDatagrams. This is used // by ConnectionWriter for queuing up datagrams for // its various threads to write to sockets. diff --git a/panda/src/net/datagramTCPHeader.cxx b/panda/src/net/datagramTCPHeader.cxx index 2560a4cce6..c666dd9c74 100644 --- a/panda/src/net/datagramTCPHeader.cxx +++ b/panda/src/net/datagramTCPHeader.cxx @@ -84,8 +84,8 @@ verify_datagram(const NetDatagram &datagram) const { << "Invalid datagram!\n"; if (size != get_datagram_size()) { net_cat.debug() - << " size is " << size << " bytes, header reports " - << get_datagram_size() << "\n"; + << " size is " << size << " bytes, header reports " + << get_datagram_size() << "\n"; } // We write the hex dump into a ostringstream first, to guarantee diff --git a/panda/src/net/datagramTCPHeader.h b/panda/src/net/datagramTCPHeader.h index 03b6adf5ed..cd57157104 100644 --- a/panda/src/net/datagramTCPHeader.h +++ b/panda/src/net/datagramTCPHeader.h @@ -17,7 +17,7 @@ static const int datagram_tcp_header_size = sizeof(PRUint16); class NetDatagram; //////////////////////////////////////////////////////////////////// -// Class : DatagramTCPHeader +// Class : DatagramTCPHeader // Description : A class that encapsulates the extra bytes that are // sent in front of each datagram to identify it when it // is sent on TCP. This is similar to diff --git a/panda/src/net/datagramUDPHeader.cxx b/panda/src/net/datagramUDPHeader.cxx index 5f03a30d5e..42785f0447 100644 --- a/panda/src/net/datagramUDPHeader.cxx +++ b/panda/src/net/datagramUDPHeader.cxx @@ -89,8 +89,8 @@ verify_datagram(const NetDatagram &datagram) const { << "Invalid datagram!\n"; if (checksum != get_datagram_checksum()) { net_cat.debug() - << " checksum is " << checksum << ", header reports " - << get_datagram_checksum() << "\n"; + << " checksum is " << checksum << ", header reports " + << get_datagram_checksum() << "\n"; } // We write the hex dump into a ostringstream first, to guarantee diff --git a/panda/src/net/datagramUDPHeader.h b/panda/src/net/datagramUDPHeader.h index e9a7e6d699..a214260aa1 100644 --- a/panda/src/net/datagramUDPHeader.h +++ b/panda/src/net/datagramUDPHeader.h @@ -17,7 +17,7 @@ static const int datagram_udp_header_size = sizeof(PRUint16); class NetDatagram; //////////////////////////////////////////////////////////////////// -// Class : DatagramUDPHeader +// Class : DatagramUDPHeader // Description : A class that encapsulates the extra bytes that are // sent in front of each datagram to identify it when it // is sent on UDP. Like NetDatagram, this class diff --git a/panda/src/net/datagram_ui.cxx b/panda/src/net/datagram_ui.cxx index bba10e63ba..a8a7497da4 100644 --- a/panda/src/net/datagram_ui.cxx +++ b/panda/src/net/datagram_ui.cxx @@ -36,49 +36,49 @@ operator >> (istream &in, NetDatagram &datagram) { // What have we got? if (p < line.length()) { if (isdigit(line[p]) || line[p] == '-') { - // A number. - size_t start = p; - p++; - while (p < line.length() && isdigit(line[p])) { - p++; - } - if (p < line.length() && line[p] == '.') { - // A floating-point number. - p++; - while (p < line.length() && isdigit(line[p])) { - p++; - } - double num = atof(line.substr(start, p - start).c_str()); - datagram.add_int8(DE_float64); - datagram.add_float64(num); - } else { - // An integer. - int num = atoi(line.substr(start, p - start).c_str()); - datagram.add_int8(DE_int32); - datagram.add_int32(num); - } + // A number. + size_t start = p; + p++; + while (p < line.length() && isdigit(line[p])) { + p++; + } + if (p < line.length() && line[p] == '.') { + // A floating-point number. + p++; + while (p < line.length() && isdigit(line[p])) { + p++; + } + double num = atof(line.substr(start, p - start).c_str()); + datagram.add_int8(DE_float64); + datagram.add_float64(num); + } else { + // An integer. + int num = atoi(line.substr(start, p - start).c_str()); + datagram.add_int8(DE_int32); + datagram.add_int32(num); + } } else if (line[p] == '"') { - // A quoted string. - p++; - size_t start = p; - while (p < line.length() && line[p] != '"') { - p++; - } - string str = line.substr(start, p - start); - datagram.add_int8(DE_string); - datagram.add_string(str); - p++; + // A quoted string. + p++; + size_t start = p; + while (p < line.length() && line[p] != '"') { + p++; + } + string str = line.substr(start, p - start); + datagram.add_int8(DE_string); + datagram.add_string(str); + p++; } else { - // An unquoted string. - size_t start = p; - while (p < line.length() && !isspace(line[p])) { - p++; - } - string str = line.substr(start, p - start); - datagram.add_int8(DE_string); - datagram.add_string(str); + // An unquoted string. + size_t start = p; + while (p < line.length() && !isspace(line[p])) { + p++; + } + string str = line.substr(start, p - start); + datagram.add_int8(DE_string); + datagram.add_string(str); } } } diff --git a/panda/src/net/netAddress.cxx b/panda/src/net/netAddress.cxx index c8543adb3c..35559bf058 100644 --- a/panda/src/net/netAddress.cxx +++ b/panda/src/net/netAddress.cxx @@ -94,14 +94,14 @@ set_host(const string &hostname, int port) { ni++; if (num >= 256 || ni >= 4) { - is_ip = false; + is_ip = false; } } else if (isdigit(hostname[p])) { num = 10 * num + (unsigned int)(hostname[p] - '0'); p++; if (num >= 256) { - is_ip = false; + is_ip = false; } } else { is_ip = false; @@ -138,7 +138,7 @@ set_host(const string &hostname, int port) { if (result != PR_SUCCESS) { pprerror("PR_GetHostByName"); net_cat.error() - << "Unable to look up hostname " << hostname << ".\n"; + << "Unable to look up hostname " << hostname << ".\n"; return false; } @@ -149,7 +149,7 @@ set_host(const string &hostname, int port) { return false; } else if (next == 0) { net_cat.error() - << "No addresses available for " << hostname << ".\n"; + << "No addresses available for " << hostname << ".\n"; return false; } } diff --git a/panda/src/net/netAddress.h b/panda/src/net/netAddress.h index 0655c7d55d..50b93b6173 100644 --- a/panda/src/net/netAddress.h +++ b/panda/src/net/netAddress.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NetAddress +// Class : NetAddress // Description : Represents a network address to which UDP packets may // be sent or to which a TCP socket may be bound. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/net/netDatagram.h b/panda/src/net/netDatagram.h index bcfde25633..fac7c5a262 100644 --- a/panda/src/net/netDatagram.h +++ b/panda/src/net/netDatagram.h @@ -25,7 +25,7 @@ static const int maximum_udp_datagram = 1024; //////////////////////////////////////////////////////////////////// -// Class : NetDatagram +// Class : NetDatagram // Description : A specific kind of Datagram, especially for sending // across or receiving from a network. It's different // only in that it knows which Connection and/or @@ -68,7 +68,7 @@ public: static void init_type() { Datagram::init_type(); register_type(_type_handle, "NetDatagram", - Datagram::get_class_type()); + Datagram::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/net/pprerror.cxx b/panda/src/net/pprerror.cxx index c0a4ae9e92..c278900944 100644 --- a/panda/src/net/pprerror.cxx +++ b/panda/src/net/pprerror.cxx @@ -45,7 +45,7 @@ pprerror(const char *format, ...) { } net_cat.error() << str; - + PR_Free(str); if (get_net_error_abort()) { abort(); diff --git a/panda/src/net/queuedConnectionListener.cxx b/panda/src/net/queuedConnectionListener.cxx index 88efd18c7d..b0710e2b02 100644 --- a/panda/src/net/queuedConnectionListener.cxx +++ b/panda/src/net/queuedConnectionListener.cxx @@ -65,8 +65,8 @@ new_connection_available() { //////////////////////////////////////////////////////////////////// bool QueuedConnectionListener:: get_new_connection(PT(Connection) &rendezvous, - NetAddress &address, - PT(Connection) &new_connection) { + NetAddress &address, + PT(Connection) &new_connection) { ConnectionListenerData result; if (!get_thing(result)) { return false; @@ -104,8 +104,8 @@ get_new_connection(PT(Connection) &new_connection) { //////////////////////////////////////////////////////////////////// void QueuedConnectionListener:: connection_opened(const PT(Connection) &rendezvous, - const NetAddress &address, - const PT(Connection) &new_connection) { + const NetAddress &address, + const PT(Connection) &new_connection) { ConnectionListenerData nc; nc._rendezvous = rendezvous; nc._address = address; diff --git a/panda/src/net/queuedConnectionListener.h b/panda/src/net/queuedConnectionListener.h index e50673f23e..efdde759d8 100644 --- a/panda/src/net/queuedConnectionListener.h +++ b/panda/src/net/queuedConnectionListener.h @@ -33,27 +33,27 @@ public: EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn); //////////////////////////////////////////////////////////////////// -// Class : QueuedConnectionListener +// Class : QueuedConnectionListener // Description : This flavor of ConnectionListener will queue up all // of the TCP connections it established for later // detection by the client code. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA QueuedConnectionListener : public ConnectionListener, - public QueuedReturn { + public QueuedReturn { PUBLISHED: QueuedConnectionListener(ConnectionManager *manager, int num_threads); virtual ~QueuedConnectionListener(); bool new_connection_available(); bool get_new_connection(PT(Connection) &rendezvous, - NetAddress &address, - PT(Connection) &new_connection); + NetAddress &address, + PT(Connection) &new_connection); bool get_new_connection(PT(Connection) &new_connection); protected: virtual void connection_opened(const PT(Connection) &rendezvous, - const NetAddress &address, - const PT(Connection) &new_connection); + const NetAddress &address, + const PT(Connection) &new_connection); }; #include "queuedConnectionListener.I" diff --git a/panda/src/net/queuedConnectionManager.h b/panda/src/net/queuedConnectionManager.h index 4b478f93cd..5e61505919 100644 --- a/panda/src/net/queuedConnectionManager.h +++ b/panda/src/net/queuedConnectionManager.h @@ -17,7 +17,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn< PT(Connection) >); //////////////////////////////////////////////////////////////////// -// Class : QueuedConnectionManager +// Class : QueuedConnectionManager // Description : This flavor of ConnectionManager will queue up all of // the reset-connection messages from the // ConnectionReaders and ConnectionWriters and report @@ -30,7 +30,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn< PT(Connection) >); // resources. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA QueuedConnectionManager : public ConnectionManager, - public QueuedReturn< PT(Connection) > { + public QueuedReturn< PT(Connection) > { PUBLISHED: QueuedConnectionManager(); ~QueuedConnectionManager(); diff --git a/panda/src/net/queuedConnectionReader.h b/panda/src/net/queuedConnectionReader.h index 2c91665833..a0ea7f99b7 100644 --- a/panda/src/net/queuedConnectionReader.h +++ b/panda/src/net/queuedConnectionReader.h @@ -18,7 +18,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn); //////////////////////////////////////////////////////////////////// -// Class : QueuedConnectionReader +// Class : QueuedConnectionReader // Description : This flavor of ConnectionReader will read from its // sockets and queue up all of the datagrams read for // later receipt by the client code. This class is @@ -27,7 +27,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, QueuedReturn); // convenience. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA QueuedConnectionReader : public ConnectionReader, - public QueuedReturn { + public QueuedReturn { PUBLISHED: QueuedConnectionReader(ConnectionManager *manager, int num_threads); virtual ~QueuedConnectionReader(); diff --git a/panda/src/net/queuedReturn.h b/panda/src/net/queuedReturn.h index f61486a37b..391dc03320 100644 --- a/panda/src/net/queuedReturn.h +++ b/panda/src/net/queuedReturn.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : QueuedReturn +// Class : QueuedReturn // Description : This is the implementation of a family of things that // queue up their return values for later retrieval by // client code, like QueuedConnectionReader, diff --git a/panda/src/net/recentConnectionReader.h b/panda/src/net/recentConnectionReader.h index c983be4c64..5828d36c84 100644 --- a/panda/src/net/recentConnectionReader.h +++ b/panda/src/net/recentConnectionReader.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : RecentConnectionReader +// Class : RecentConnectionReader // Description : This flavor of ConnectionReader will read from its // sockets and retain only the single most recent // datagram for inspection by client code. It's useful diff --git a/panda/src/net/test_spam_client.cxx b/panda/src/net/test_spam_client.cxx index ae5f5df658..47bb1ed528 100644 --- a/panda/src/net/test_spam_client.cxx +++ b/panda/src/net/test_spam_client.cxx @@ -69,12 +69,12 @@ main(int argc, char *argv[]) { while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - nout << "Lost connection from " - << connection->get_address() << "\n"; - cm.close_connection(connection); - if (connection == c) { - lost_connection = true; - } + nout << "Lost connection from " + << connection->get_address() << "\n"; + cm.close_connection(connection); + if (connection == c) { + lost_connection = true; + } } } @@ -82,14 +82,14 @@ main(int argc, char *argv[]) { if (reader.data_available()) { NetDatagram new_datagram; if (reader.get_data(new_datagram)) { - num_received++; + num_received++; } } PRIntervalTime now = PR_IntervalNow(); if ((PRIntervalTime)(now - last_reported_time) > report_interval) { nout << "Sent " << num_sent << ", received " - << num_received << " datagrams.\n"; + << num_received << " datagrams.\n"; last_reported_time = now; } diff --git a/panda/src/net/test_spam_server.cxx b/panda/src/net/test_spam_server.cxx index fc48661f6e..5243f80d7f 100644 --- a/panda/src/net/test_spam_server.cxx +++ b/panda/src/net/test_spam_server.cxx @@ -63,9 +63,9 @@ main(int argc, char *argv[]) { NetAddress address; PT(Connection) new_connection; if (listener.get_new_connection(rv, address, new_connection)) { - nout << "Got connection from " << address << "\n"; - reader.add_connection(new_connection); - clients.insert(new_connection); + nout << "Got connection from " << address << "\n"; + reader.add_connection(new_connection); + clients.insert(new_connection); } } @@ -73,10 +73,10 @@ main(int argc, char *argv[]) { while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - nout << "Lost connection from " - << connection->get_address() << "\n"; - clients.erase(connection); - cm.close_connection(connection); + nout << "Lost connection from " + << connection->get_address() << "\n"; + clients.erase(connection); + cm.close_connection(connection); } } @@ -84,20 +84,20 @@ main(int argc, char *argv[]) { while (reader.data_available()) { NetDatagram datagram; if (reader.get_data(datagram)) { - num_received++; - Clients::iterator ci; - for (ci = clients.begin(); ci != clients.end(); ++ci) { - if (writer.send(datagram, (*ci))) { - num_sent++; - } - } + num_received++; + Clients::iterator ci; + for (ci = clients.begin(); ci != clients.end(); ++ci) { + if (writer.send(datagram, (*ci))) { + num_sent++; + } + } } } PRIntervalTime now = PR_IntervalNow(); if ((PRIntervalTime)(now - last_reported_time) > report_interval) { nout << "Sent " << num_sent << ", received " - << num_received << " datagrams.\n"; + << num_received << " datagrams.\n"; last_reported_time = now; } diff --git a/panda/src/net/test_tcp_client.cxx b/panda/src/net/test_tcp_client.cxx index e7c7e296e1..b6aff15b35 100644 --- a/panda/src/net/test_tcp_client.cxx +++ b/panda/src/net/test_tcp_client.cxx @@ -58,20 +58,20 @@ main(int argc, char *argv[]) { while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - nout << "Lost connection from " - << connection->get_address() << "\n"; - cm.close_connection(connection); - if (connection == c) { - lost_connection = true; - } + nout << "Lost connection from " + << connection->get_address() << "\n"; + cm.close_connection(connection); + if (connection == c) { + lost_connection = true; + } } } // Now poll for new datagrams on the socket. while (reader.data_available()) { if (reader.get_data(datagram)) { - nout << "Got datagram " << datagram << "from " - << datagram.get_address() << "\n"; + nout << "Got datagram " << datagram << "from " + << datagram.get_address() << "\n"; } } diff --git a/panda/src/net/test_tcp_server.cxx b/panda/src/net/test_tcp_server.cxx index 60bc573ed7..8e3a85b0d8 100644 --- a/panda/src/net/test_tcp_server.cxx +++ b/panda/src/net/test_tcp_server.cxx @@ -53,9 +53,9 @@ main(int argc, char *argv[]) { NetAddress address; PT(Connection) new_connection; if (listener.get_new_connection(rv, address, new_connection)) { - nout << "Got connection from " << address << "\n"; - reader.add_connection(new_connection); - clients.insert(new_connection); + nout << "Got connection from " << address << "\n"; + reader.add_connection(new_connection); + clients.insert(new_connection); } } @@ -63,10 +63,10 @@ main(int argc, char *argv[]) { while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - nout << "Lost connection from " - << connection->get_address() << "\n"; - clients.erase(connection); - cm.close_connection(connection); + nout << "Lost connection from " + << connection->get_address() << "\n"; + clients.erase(connection); + cm.close_connection(connection); } } @@ -74,33 +74,33 @@ main(int argc, char *argv[]) { while (reader.data_available()) { NetDatagram datagram; if (reader.get_data(datagram)) { - nout << "Got datagram " << datagram << "from " - << datagram.get_address() << ", sending to " - << clients.size() << " clients.\n"; - - Clients::iterator ci; - for (ci = clients.begin(); ci != clients.end(); ++ci) { - writer.send(datagram, (*ci)); - } + nout << "Got datagram " << datagram << "from " + << datagram.get_address() << ", sending to " + << clients.size() << " clients.\n"; - if (datagram.get_length() <= 1) { - /* - // An empty datagram means to close the connection. - PT(Connection) connection = datagram.get_connection(); - if (connection.is_null()) { - nout << "Empty datagram from a null connection.\n"; - } else { - nout << "Closing connection from " - << connection->get_address() << "\n"; - clients.erase(connection); - cm.close_connection(connection); - nout << "Closed " << connection << "\n"; - } - */ - - // No, an empty datagram means to shut down the server. - shutdown = true; - } + Clients::iterator ci; + for (ci = clients.begin(); ci != clients.end(); ++ci) { + writer.send(datagram, (*ci)); + } + + if (datagram.get_length() <= 1) { + /* + // An empty datagram means to close the connection. + PT(Connection) connection = datagram.get_connection(); + if (connection.is_null()) { + nout << "Empty datagram from a null connection.\n"; + } else { + nout << "Closing connection from " + << connection->get_address() << "\n"; + clients.erase(connection); + cm.close_connection(connection); + nout << "Closed " << connection << "\n"; + } + */ + + // No, an empty datagram means to shut down the server. + shutdown = true; + } } } diff --git a/panda/src/net/test_udp.cxx b/panda/src/net/test_udp.cxx index 033f6243cb..0181e14d7a 100644 --- a/panda/src/net/test_udp.cxx +++ b/panda/src/net/test_udp.cxx @@ -57,20 +57,20 @@ main(int argc, char *argv[]) { while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - nout << "Lost connection from " - << connection->get_address() << "\n"; - cm.close_connection(connection); - if (connection == c) { - lost_connection = true; - } + nout << "Lost connection from " + << connection->get_address() << "\n"; + cm.close_connection(connection); + if (connection == c) { + lost_connection = true; + } } } // Now poll for new datagrams on the socket. while (reader.data_available()) { if (reader.get_data(datagram)) { - nout << "Got datagram " << datagram << "from " - << datagram.get_address() << "\n"; + nout << "Got datagram " << datagram << "from " + << datagram.get_address() << "\n"; } } diff --git a/panda/src/parametrics/classicNurbsCurve.cxx b/panda/src/parametrics/classicNurbsCurve.cxx index c2a2f3ef2d..7a34bc3793 100644 --- a/panda/src/parametrics/classicNurbsCurve.cxx +++ b/panda/src/parametrics/classicNurbsCurve.cxx @@ -58,7 +58,7 @@ ClassicNurbsCurve(const ParametricCurve &pc) { //////////////////////////////////////////////////////////////////// ClassicNurbsCurve:: ClassicNurbsCurve(int order, int num_cvs, - const float knots[], const LVecBase4f cvs[]) { + const float knots[], const LVecBase4f cvs[]) { _order = order; int i; @@ -305,19 +305,19 @@ recompute() { if ((int)_cvs.size() > _order-1) { for (int cv = 0; cv < (int)_cvs.size()-(_order-1); cv++) { if (get_knot(cv+_order-1) < get_knot(cv+_order)) { - // There are _order consecutive CV's that define each segment, - // beginning at cv. Collect the CV's and knot values that define - // this segment. - int c; - for (c = 0; c < _order; c++) { - cvs[c] = _cvs[c+cv]._p; - } - for (c = 0; c < _order+_order; c++) { - knots[c] = get_knot(c+cv); - } - - insert_curveseg(_segs.size(), new CubicCurveseg(_order, knots, cvs), - knots[_order] - knots[_order-1]); + // There are _order consecutive CV's that define each segment, + // beginning at cv. Collect the CV's and knot values that define + // this segment. + int c; + for (c = 0; c < _order; c++) { + cvs[c] = _cvs[c+cv]._p; + } + for (c = 0; c < _order+_order; c++) { + knots[c] = get_knot(c+cv); + } + + insert_curveseg(_segs.size(), new CubicCurveseg(_order, knots, cvs), + knots[_order] - knots[_order-1]); } } } @@ -336,9 +336,9 @@ recompute() { //////////////////////////////////////////////////////////////////// bool ClassicNurbsCurve:: rebuild_curveseg(int rtype0, float t0, const LVecBase4f &v0, - int rtype1, float t1, const LVecBase4f &v1, - int rtype2, float t2, const LVecBase4f &v2, - int rtype3, float t3, const LVecBase4f &v3) { + int rtype1, float t1, const LVecBase4f &v1, + int rtype2, float t2, const LVecBase4f &v2, + int rtype3, float t3, const LVecBase4f &v3) { // Figure out which CV's contributed to this segment. int seg = 0; @@ -348,7 +348,7 @@ rebuild_curveseg(int rtype0, float t0, const LVecBase4f &v0, for (cv = 0; cv < (int)_cvs.size()-(_order-1); cv++) { if (get_knot(cv+_order-1) < get_knot(cv+_order)) { if (seg == _last_ti) { - break; + break; } seg++; } @@ -383,10 +383,10 @@ rebuild_curveseg(int rtype0, float t0, const LVecBase4f &v0, Bi = invert(B); if (!CubicCurveseg::compute_seg(rtype0, t0, v0, - rtype1, t1, v1, - rtype2, t2, v2, - rtype3, t3, v3, - B, Bi, G)) { + rtype1, t1, v1, + rtype2, t2, v2, + rtype3, t3, v3, + B, Bi, G)) { return false; } @@ -514,7 +514,7 @@ append_cv_impl(const LVecBase4f &v) { //////////////////////////////////////////////////////////////////// bool ClassicNurbsCurve:: format_egg(ostream &out, const string &name, const string &curve_type, - int indent_level) const { + int indent_level) const { return NurbsCurveInterface::format_egg(out, name, curve_type, indent_level); } diff --git a/panda/src/parametrics/classicNurbsCurve.h b/panda/src/parametrics/classicNurbsCurve.h index 3db1c341dd..db79d176ad 100644 --- a/panda/src/parametrics/classicNurbsCurve.h +++ b/panda/src/parametrics/classicNurbsCurve.h @@ -13,7 +13,7 @@ #include "cubicCurveseg.h" //////////////////////////////////////////////////////////////////// -// Class : ClassicNurbsCurve +// Class : ClassicNurbsCurve // Description : A Nonuniform Rational B-Spline. // // This class is actually implemented as a @@ -40,7 +40,7 @@ PUBLISHED: ClassicNurbsCurve(); ClassicNurbsCurve(const ParametricCurve &pc); ClassicNurbsCurve(int order, int num_cvs, - const float knots[], const LVecBase4f cvs[]); + const float knots[], const LVecBase4f cvs[]); virtual ~ClassicNurbsCurve(); public: @@ -68,9 +68,9 @@ public: public: virtual bool rebuild_curveseg(int rtype0, float t0, const LVecBase4f &v0, - int rtype1, float t1, const LVecBase4f &v1, - int rtype2, float t2, const LVecBase4f &v2, - int rtype3, float t3, const LVecBase4f &v3); + int rtype1, float t1, const LVecBase4f &v1, + int rtype2, float t2, const LVecBase4f &v2, + int rtype3, float t3, const LVecBase4f &v3); virtual bool stitch(const ParametricCurve *a, const ParametricCurve *b); @@ -83,7 +83,7 @@ public: protected: virtual int append_cv_impl(const LVecBase4f &v); virtual bool format_egg(ostream &out, const string &name, - const string &curve_type, int indent_level) const; + const string &curve_type, int indent_level) const; int find_cv(float t); @@ -118,10 +118,10 @@ public: NurbsCurveInterface::init_type(); register_type(_type_handle, "ClassicNurbsCurve", PiecewiseCurve::get_class_type(), - NurbsCurveInterface::get_class_type()); + NurbsCurveInterface::get_class_type()); register_type(_orig_type_handle, "NurbsCurve", PiecewiseCurve::get_class_type(), - NurbsCurveInterface::get_class_type()); + NurbsCurveInterface::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/parametrics/cubicCurveseg.cxx b/panda/src/parametrics/cubicCurveseg.cxx index ebfbe6fee8..422649db78 100644 --- a/panda/src/parametrics/cubicCurveseg.cxx +++ b/panda/src/parametrics/cubicCurveseg.cxx @@ -141,11 +141,11 @@ hermite_basis(const HermiteCurveCV &cv0, 1, -1, 0, 0); LVecBase4f Gx(cv0._p[0], cv1._p[0], - cv0._out[0]*tlength, cv1._in[0]*tlength); + cv0._out[0]*tlength, cv1._in[0]*tlength); LVecBase4f Gy(cv0._p[1], cv1._p[1], - cv0._out[1]*tlength, cv1._in[1]*tlength); + cv0._out[1]*tlength, cv1._in[1]*tlength); LVecBase4f Gz(cv0._p[2], cv1._p[2], - cv0._out[2]*tlength, cv1._in[2]*tlength); + cv0._out[2]*tlength, cv1._in[2]*tlength); Bx = Gx * Mh; By = Gy * Mh; @@ -383,8 +383,8 @@ compute_seg_col(int c, LVecBase4f vec(t*t*t, t*t, t, 1.0); LVecBase4f ov = col_mult(GB, vec); if (parametrics_cat.is_debug()) { - parametrics_cat.debug() - << "orig point = " << ov << "\n"; + parametrics_cat.debug() + << "orig point = " << ov << "\n"; } P.set_col(c, ov); } else { @@ -400,12 +400,12 @@ compute_seg_col(int c, LVecBase4f vec(3.0*t*t, 2.0*t, 1.0, 0.0); LVecBase4f ov = col_mult(GB, vec); if (parametrics_cat.is_debug()) { - parametrics_cat.debug() - << "Matrix is:\n"; - GB.write(parametrics_cat.debug(false), 2); - parametrics_cat.debug(false) - << "vector is " << vec << "\n" - << "orig tangent = " << ov << "\n"; + parametrics_cat.debug() + << "Matrix is:\n"; + GB.write(parametrics_cat.debug(false), 2); + parametrics_cat.debug(false) + << "vector is " << vec << "\n" + << "orig tangent = " << ov << "\n"; } P.set_col(c, ov); } else { @@ -419,8 +419,8 @@ compute_seg_col(int c, T.set_col(c, Bi.get_col(c)); if (keep_orig) { if (parametrics_cat.is_debug()) { - parametrics_cat.debug() - << "orig CV = " << G.get_col(c) << "\n"; + parametrics_cat.debug() + << "orig CV = " << G.get_col(c) << "\n"; } P.set_col(c, G.get_col(c)); } else { diff --git a/panda/src/parametrics/cubicCurveseg.h b/panda/src/parametrics/cubicCurveseg.h index 1fa6e95eaa..4079f3f1bc 100644 --- a/panda/src/parametrics/cubicCurveseg.h +++ b/panda/src/parametrics/cubicCurveseg.h @@ -62,8 +62,8 @@ public: virtual ~CubicCurveseg(); void hermite_basis(const HermiteCurveCV &cv0, - const HermiteCurveCV &cv1, - float tlength = 1.0); + const HermiteCurveCV &cv1, + float tlength = 1.0); void bezier_basis(const BezierSeg &seg); void nurbs_basis(int order, const float knots[], const LVecBase4f cvs[]); @@ -94,12 +94,12 @@ public: virtual bool get_bezier_seg(BezierSeg &seg) const; static bool compute_seg(int rtype0, float t0, const LVecBase4f &v0, - int rtype1, float t1, const LVecBase4f &v1, - int rtype2, float t2, const LVecBase4f &v2, - int rtype3, float t3, const LVecBase4f &v3, - const LMatrix4f &B, - const LMatrix4f &Bi, - LMatrix4f &G); + int rtype1, float t1, const LVecBase4f &v1, + int rtype2, float t2, const LVecBase4f &v2, + int rtype3, float t3, const LVecBase4f &v3, + const LMatrix4f &B, + const LMatrix4f &Bi, + LMatrix4f &G); LVecBase4f Bx, By, Bz, Bw; bool rational; diff --git a/panda/src/parametrics/curveFitter.cxx b/panda/src/parametrics/curveFitter.cxx index b5ccb70483..361d32ba1d 100644 --- a/panda/src/parametrics/curveFitter.cxx +++ b/panda/src/parametrics/curveFitter.cxx @@ -304,15 +304,15 @@ compute_tangents(float scale) { if (_got_xyz) { for (i = 1; i < len-1; i++) { _data[i]._tangent = - (_data[i+1]._xyz - _data[i-1]._xyz) * scale / - (_data[i+1]._t - _data[i-1]._t); + (_data[i+1]._xyz - _data[i-1]._xyz) * scale / + (_data[i+1]._t - _data[i-1]._t); } } if (_got_hpr) { for (i = 1; i < len-1; i++) { _data[i]._hpr_tangent = - (_data[i+1]._hpr - _data[i-1]._hpr) * scale / - (_data[i+1]._t - _data[i-1]._t); + (_data[i+1]._hpr - _data[i-1]._hpr) * scale / + (_data[i+1]._t - _data[i-1]._t); } } @@ -320,31 +320,31 @@ compute_tangents(float scale) { if (closed) { if (_got_xyz) { _data[0]._tangent = _data[len-1]._tangent = - (_data[1]._xyz - _data[len-2]._xyz) * scale / - ((_data[1]._t - _data[0]._t) + (_data[len-1]._t - _data[len-2]._t)); + (_data[1]._xyz - _data[len-2]._xyz) * scale / + ((_data[1]._t - _data[0]._t) + (_data[len-1]._t - _data[len-2]._t)); } if (_got_hpr) { _data[0]._tangent = _data[len-1]._tangent = - (_data[1]._hpr - _data[len-2]._hpr) * scale / - ((_data[1]._t - _data[0]._t) + (_data[len-1]._t - _data[len-2]._t)); + (_data[1]._hpr - _data[len-2]._hpr) * scale / + ((_data[1]._t - _data[0]._t) + (_data[len-1]._t - _data[len-2]._t)); } } else { if (_got_xyz) { _data[0]._tangent = - (_data[1]._xyz - _data[0]._xyz) * scale / - ((_data[1]._t - _data[0]._t) * 2.0); + (_data[1]._xyz - _data[0]._xyz) * scale / + ((_data[1]._t - _data[0]._t) * 2.0); _data[len-1]._tangent = - (_data[len-1]._xyz - _data[len-2]._xyz) * scale / - ((_data[len-1]._t - _data[len-2]._t) * 2.0); + (_data[len-1]._xyz - _data[len-2]._xyz) * scale / + ((_data[len-1]._t - _data[len-2]._t) * 2.0); } if (_got_hpr) { _data[0]._tangent = - (_data[1]._hpr - _data[0]._hpr) * scale / - ((_data[1]._t - _data[0]._t) * 2.0); + (_data[1]._hpr - _data[0]._hpr) * scale / + ((_data[1]._t - _data[0]._t) * 2.0); _data[len-1]._tangent = - (_data[len-1]._hpr - _data[len-2]._hpr) * scale / - ((_data[len-1]._t - _data[len-2]._t) * 2.0); + (_data[len-1]._hpr - _data[len-2]._hpr) * scale / + ((_data[len-1]._t - _data[len-2]._t) * 2.0); } } } diff --git a/panda/src/parametrics/hermiteCurve.cxx b/panda/src/parametrics/hermiteCurve.cxx index 5acfce0a91..79393a260a 100644 --- a/panda/src/parametrics/hermiteCurve.cxx +++ b/panda/src/parametrics/hermiteCurve.cxx @@ -30,7 +30,7 @@ static const LVecBase3f zero = LVecBase3f(0.0, 0.0, 0.0); //////////////////////////////////////////////////////////////////// static ostream & show_vec3(ostream &out, int indent_level, const LVecBase3f &v, - int num_dimensions) { + int num_dimensions) { indent(out, indent_level) << v[0]; for (int i = 1; i {\n"; show_vec3(out, indent_level + 2, _p - scale_in * _in / 3.0, - num_dimensions) << "\n"; + num_dimensions) << "\n"; indent(out, indent_level) << "}\n"; } @@ -209,7 +209,7 @@ format_egg(ostream &out, int indent_level, int num_dimensions, if (show_out) { indent(out, indent_level) << " {\n"; show_vec3(out, indent_level + 2, _p + scale_out * _out / 3.0, - num_dimensions) << "\n"; + num_dimensions) << "\n"; indent(out, indent_level) << "}\n"; } } @@ -720,9 +720,9 @@ write_cv(ostream &out, int n) const { //////////////////////////////////////////////////////////////////// bool HermiteCurve:: rebuild_curveseg(int, float, const LVecBase4f &, - int, float, const LVecBase4f &, - int, float, const LVecBase4f &, - int, float, const LVecBase4f &) { + int, float, const LVecBase4f &, + int, float, const LVecBase4f &, + int, float, const LVecBase4f &) { cerr << "rebuild_curveseg not implemented for this curve type.\n"; return false; } @@ -734,7 +734,7 @@ rebuild_curveseg(int, float, const LVecBase4f &, //////////////////////////////////////////////////////////////////// bool HermiteCurve:: format_egg(ostream &out, const string &name, const string &curve_type, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << " " << name << ".pool {\n"; @@ -743,9 +743,9 @@ format_egg(ostream &out, const string &name, const string &curve_type, bool show_in = (i != 0); bool show_out = (i != (int)_points.size()-1); _points[i].format_egg(out, indent_level + 2, _num_dimensions, - show_in, show_out, - show_in ? get_tlength(i-1) : 0.0, - show_out ? get_tlength(i) : 0.0); + show_in, show_out, + show_in ? get_tlength(i-1) : 0.0, + show_out ? get_tlength(i) : 0.0); } indent(out, indent_level) << "}\n"; @@ -760,8 +760,8 @@ format_egg(ostream &out, const string &name, const string &curve_type, if (_points.size() > 1) { for (i = 0; i < (int)_segs.size(); i++) { if (i%10 == 1) { - out << "\n"; - indent(out, indent_level+3); + out << "\n"; + indent(out, indent_level+3); } out << " " << get_tlength(i); } @@ -828,7 +828,7 @@ invalidate_cv(int n, bool redo_all) { const HermiteCurveCV &p1 = _points[n]; HermiteCurveCV p2(_points[n+1]); if (_curve_type == PCT_HPR) { - wrap_hpr(p1._p, p2._p); + wrap_hpr(p1._p, p2._p); } get_curveseg(n)->hermite_basis(p1, p2, get_tlength(n)); t2 = get_cv_tstart(n+2); @@ -887,7 +887,7 @@ recompute_basis() { const HermiteCurveCV &p1 = _points[n]; HermiteCurveCV p2(_points[n+1]); if (_curve_type == PCT_HPR) { - wrap_hpr(p1._p, p2._p); + wrap_hpr(p1._p, p2._p); } get_curveseg(n)->hermite_basis(p1, p2, get_tlength(n)); } diff --git a/panda/src/parametrics/hermiteCurve.h b/panda/src/parametrics/hermiteCurve.h index 02e7b9c7aa..01b577644a 100644 --- a/panda/src/parametrics/hermiteCurve.h +++ b/panda/src/parametrics/hermiteCurve.h @@ -36,7 +36,7 @@ BEGIN_PUBLISH //[ END_PUBLISH //] //////////////////////////////////////////////////////////////////// -// Class : HermiteCurveCV +// Class : HermiteCurveCV // Description : A single CV of a Hermite curve. Hermite curve CV's // include an in and out tangent, as well as a position. //////////////////////////////////////////////////////////////////// @@ -53,8 +53,8 @@ public: void set_name(const string &name); void format_egg(ostream &out, int indent, int num_dimensions, - bool show_in, bool show_out, - float scale_in, float scale_out) const; + bool show_in, bool show_out, + float scale_in, float scale_out) const; void write_datagram(BamWriter *manager, Datagram &me) const; void fillin(DatagramIterator &scan, BamReader *manager); @@ -65,7 +65,7 @@ public: }; //////////////////////////////////////////////////////////////////// -// Class : HermiteCurve +// Class : HermiteCurve // Description : A parametric curve defined by a sequence of control // vertices, each with an in and out tangent. // @@ -131,13 +131,13 @@ public: virtual bool rebuild_curveseg(int rtype0, float t0, const LVecBase4f &v0, - int rtype1, float t1, const LVecBase4f &v1, - int rtype2, float t2, const LVecBase4f &v2, - int rtype3, float t3, const LVecBase4f &v3); + int rtype1, float t1, const LVecBase4f &v1, + int rtype2, float t2, const LVecBase4f &v2, + int rtype3, float t3, const LVecBase4f &v3); protected: virtual bool format_egg(ostream &out, const string &name, - const string &curve_type, int indent_level) const; + const string &curve_type, int indent_level) const; void invalidate_cv(int n, bool redo_all); int find_cv(float t); diff --git a/panda/src/parametrics/nurbsCurveDrawer.cxx b/panda/src/parametrics/nurbsCurveDrawer.cxx index 2e533e6633..431ece7c72 100644 --- a/panda/src/parametrics/nurbsCurveDrawer.cxx +++ b/panda/src/parametrics/nurbsCurveDrawer.cxx @@ -122,11 +122,11 @@ draw() { for (i = 0; i < _num_cvs; i++) { float t = nurbs->get_knot(i); if (t != lt) { - lt = t; - LVecBase3f knot_pos; - curve->get_point(nurbs->get_knot(i), knot_pos); - _knots.move_to(knot_pos); - ki++; + lt = t; + LVecBase3f knot_pos; + curve->get_point(nurbs->get_knot(i), knot_pos); + _knots.move_to(knot_pos); + ki++; } _knotnums.push_back(ki); } @@ -275,7 +275,7 @@ unhilight(int n) { if (_show_knots) { nassertr(_knotnums[n] >= 0 && _knotnums[n] < _knots.get_num_vertices(), false); _knots.set_vertex_color(_knotnums[n], - _knot_color[0], _knot_color[1], _knot_color[2]); + _knot_color[0], _knot_color[1], _knot_color[2]); } return true; diff --git a/panda/src/parametrics/nurbsCurveDrawer.h b/panda/src/parametrics/nurbsCurveDrawer.h index 884a1addcd..300a4da095 100644 --- a/panda/src/parametrics/nurbsCurveDrawer.h +++ b/panda/src/parametrics/nurbsCurveDrawer.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////// -// Class : NurbsCurveDrawer +// Class : NurbsCurveDrawer // Description : Draws a Nurbs curve, also drawing in the control // vertices and tangent vectors. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/parametrics/nurbsCurveInterface.cxx b/panda/src/parametrics/nurbsCurveInterface.cxx index 963fc44349..aeed6e1d5f 100644 --- a/panda/src/parametrics/nurbsCurveInterface.cxx +++ b/panda/src/parametrics/nurbsCurveInterface.cxx @@ -87,7 +87,7 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// bool NurbsCurveInterface:: format_egg(ostream &out, const string &name, const string &curve_type, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << " " << name << ".pool {\n"; diff --git a/panda/src/parametrics/nurbsCurveInterface.h b/panda/src/parametrics/nurbsCurveInterface.h index 3aa42e379e..47fe651591 100644 --- a/panda/src/parametrics/nurbsCurveInterface.h +++ b/panda/src/parametrics/nurbsCurveInterface.h @@ -14,7 +14,7 @@ class ParametricCurve; //////////////////////////////////////////////////////////////////// -// Class : NurbsCurveInterface +// Class : NurbsCurveInterface // Description : This abstract class defines the interface only for a // Nurbs-style curve, with knots and coordinates in // homogeneous space. @@ -60,7 +60,7 @@ protected: void write(ostream &out, int indent_level) const; bool format_egg(ostream &out, const string &name, - const string &curve_type, int indent_level) const; + const string &curve_type, int indent_level) const; bool convert_to_nurbs(ParametricCurve *nc) const; diff --git a/panda/src/parametrics/nurbsPPCurve.cxx b/panda/src/parametrics/nurbsPPCurve.cxx index fa13261006..3eda8cb83e 100644 --- a/panda/src/parametrics/nurbsPPCurve.cxx +++ b/panda/src/parametrics/nurbsPPCurve.cxx @@ -48,7 +48,7 @@ NurbsPPCurve(const ParametricCurve &pc) { //////////////////////////////////////////////////////////////////// NurbsPPCurve:: NurbsPPCurve(int order, int num_cvs, - const float knots[], const LVecBase4f cvs[]) { + const float knots[], const LVecBase4f cvs[]) { _nurbs_valid = false; _order = order; @@ -545,7 +545,7 @@ append_cv_impl(const LVecBase4f &cv) { //////////////////////////////////////////////////////////////////// bool NurbsPPCurve:: format_egg(ostream &out, const string &name, const string &curve_type, - int indent_level) const { + int indent_level) const { return NurbsCurveInterface::format_egg(out, name, curve_type, indent_level); } @@ -613,7 +613,7 @@ copy_nurbs(PLib::NurbsCurvef &nurbs) const { //////////////////////////////////////////////////////////////////// void NurbsPPCurve:: copy_arrays(NurbsPPCurve::Points &points, NurbsPPCurve::Knots &knots, - int &order) const { + int &order) const { if (_nurbs_valid) { make_arrays_from(_nurbs, points, knots, order); } else { @@ -631,8 +631,8 @@ copy_arrays(NurbsPPCurve::Points &points, NurbsPPCurve::Knots &knots, //////////////////////////////////////////////////////////////////// bool NurbsPPCurve:: make_nurbs_from(PLib::NurbsCurvef &nurbs, - const NurbsPPCurve::Points &points, - const NurbsPPCurve::Knots &knots, int order) { + const NurbsPPCurve::Points &points, + const NurbsPPCurve::Knots &knots, int order) { if (order < 1 || knots.size() != points.size() + order) { parametrics_cat.error() << "Invalid NURBS curve: order " << order << " with " @@ -666,8 +666,8 @@ make_nurbs_from(PLib::NurbsCurvef &nurbs, //////////////////////////////////////////////////////////////////// void NurbsPPCurve:: make_arrays_from(const PLib::NurbsCurvef &nurbs, - NurbsPPCurve::Points &points, - NurbsPPCurve::Knots &knots, int &order) { + NurbsPPCurve::Points &points, + NurbsPPCurve::Knots &knots, int &order) { const Vector_HPoint3Df &v_points = nurbs.ctrlPnts(); const Vector_FLOAT &v_knots = nurbs.knot(); diff --git a/panda/src/parametrics/nurbsPPCurve.h b/panda/src/parametrics/nurbsPPCurve.h index b4c2579589..89a8cb3751 100644 --- a/panda/src/parametrics/nurbsPPCurve.h +++ b/panda/src/parametrics/nurbsPPCurve.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NurbsPPCurve +// Class : NurbsPPCurve // Description : A Nonuniform Rational B-Spline. // // This class is an extension to Panda NURBS curves, @@ -30,7 +30,7 @@ PUBLISHED: NurbsPPCurve(); NurbsPPCurve(const ParametricCurve &pc); NurbsPPCurve(int order, int num_cvs, - const float knots[], const LVecBase4f cvs[]); + const float knots[], const LVecBase4f cvs[]); virtual ~NurbsPPCurve(); public: @@ -72,7 +72,7 @@ public: protected: virtual int append_cv_impl(const LVecBase4f &v); virtual bool format_egg(ostream &out, const string &name, - const string &curve_type, int indent_level) const; + const string &curve_type, int indent_level) const; private: typedef vector Points; @@ -84,10 +84,10 @@ private: void copy_arrays(Points &points, Knots &knots, int &order) const; static bool make_nurbs_from(PLib::NurbsCurvef &nurbs, - const Points &points, const Knots &knots, - int order); + const Points &points, const Knots &knots, + int order); static void make_arrays_from(const PLib::NurbsCurvef &nurbs, - Points &points, Knots &knots, int &order); + Points &points, Knots &knots, int &order); PLib::NurbsCurvef _nurbs; @@ -105,7 +105,7 @@ public: NurbsCurveInterface::init_type(); register_type(_type_handle, "NurbsPPCurve", ParametricCurve::get_class_type(), - NurbsCurveInterface::get_class_type()); + NurbsCurveInterface::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/parametrics/parametricCurve.cxx b/panda/src/parametrics/parametricCurve.cxx index d53029e817..81916dd6ce 100644 --- a/panda/src/parametrics/parametricCurve.cxx +++ b/panda/src/parametrics/parametricCurve.cxx @@ -251,7 +251,7 @@ find_length(float start_t, float length_offset) const { float result; if (r_find_length(length_offset - net, result, - t1, t2, p1, p2, seglength)) { + t1, t2, p1, p2, seglength)) { // Found it! return result; } @@ -776,9 +776,9 @@ r_calc_length(float t1, float t2, const LPoint3f &p1, const LPoint3f &p2, //////////////////////////////////////////////////////////////////// bool ParametricCurve:: r_find_length(float target_length, float &found_t, - float t1, float t2, - const LPoint3f &p1, const LPoint3f &p2, - float &seglength) const { + float t1, float t2, + const LPoint3f &p1, const LPoint3f &p2, + float &seglength) const { static const float length_tolerance = 0.0000001; static const float t_tolerance = 0.000001; @@ -805,8 +805,8 @@ r_find_length(float target_length, float &found_t, if ((left + right) - seglength < length_tolerance) { // No. We're done. if (target_length <= seglength) { - found_t = t1 + (target_length / seglength) * (t2 - t1); - return true; + found_t = t1 + (target_length / seglength) * (t2 - t1); + return true; } return false; @@ -815,12 +815,12 @@ r_find_length(float target_length, float &found_t, // Maybe the point is in the left half of the segment? if (r_find_length(target_length, found_t, t1, tmid, p1, pmid, left)) { - return true; + return true; } // Maybe it's on the right half? if (r_find_length(target_length - left, found_t, tmid, t2, pmid, p2, right)) { - return true; + return true; } // Neither. Keep going. diff --git a/panda/src/parametrics/parametricCurve.h b/panda/src/parametrics/parametricCurve.h index 91c88674f7..29eada1390 100644 --- a/panda/src/parametrics/parametricCurve.h +++ b/panda/src/parametrics/parametricCurve.h @@ -76,8 +76,8 @@ PUBLISHED: virtual bool adjust_point(float t, float px, float py, float pz); virtual bool adjust_tangent(float t, float tx, float ty, float tz); virtual bool adjust_pt(float t, - float px, float py, float pz, - float tx, float ty, float tz); + float px, float py, float pz, + float tx, float ty, float tz); virtual bool recompute(); @@ -111,16 +111,16 @@ protected: void invalidate_all(); virtual bool format_egg(ostream &out, const string &name, - const string &curve_type, int indent_level) const; + const string &curve_type, int indent_level) const; private: float r_calc_length(float t1, float t2, const LPoint3f &p1, const LPoint3f &p2, float seglength) const; bool r_find_length(float target_length, float &found_t, - float t1, float t2, - const LPoint3f &p1, const LPoint3f &p2, - float &seglength) const; + float t1, float t2, + const LPoint3f &p1, const LPoint3f &p2, + float &seglength) const; protected: int _curve_type; @@ -144,7 +144,7 @@ public: static void init_type() { NamedNode::init_type(); register_type(_type_handle, "ParametricCurve", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/parametrics/parametricCurveCollection.cxx b/panda/src/parametrics/parametricCurveCollection.cxx index 7f17621cc3..658b63e69b 100644 --- a/panda/src/parametrics/parametricCurveCollection.cxx +++ b/panda/src/parametrics/parametricCurveCollection.cxx @@ -160,17 +160,17 @@ clear_timewarps() { switch (curve->get_curve_type()) { case PCT_XYZ: if (xyz_curve == (ParametricCurve *)NULL) { - xyz_curve = curve; + xyz_curve = curve; } else { - prepare_remove_curve(curve); + prepare_remove_curve(curve); } break; case PCT_HPR: if (hpr_curve == (ParametricCurve *)NULL) { - hpr_curve = curve; + hpr_curve = curve; } else { - prepare_remove_curve(curve); + prepare_remove_curve(curve); } break; @@ -283,7 +283,7 @@ get_timewarp_curve(int n) const { ParametricCurve *curve = (*ci); if (curve->get_curve_type() == PCT_T) { if (n == 0) { - return curve; + return curve; } n--; } @@ -346,11 +346,11 @@ make_even(float max_t, float segments_per_unit) { for (int i = 0; i < num_segments; i++) { float next_t = xyz_curve->find_length(last_t, segment_length); fitter.add_xyz((float)(i + 1) / num_segments * max_t, - LVecBase3f(next_t, 0.0, 0.0)); + LVecBase3f(next_t, 0.0, 0.0)); if (parametrics_cat.is_spam()) { parametrics_cat.spam() - << "Point " << i << " is at " << next_t << "\n"; + << "Point " << i << " is at " << next_t << "\n"; } last_t = next_t; @@ -398,7 +398,7 @@ face_forward(float segments_per_unit) { prepare_remove_curve(curve); } else { if (curve->get_curve_type() == PCT_XYZ && xyz_index == -1) { - xyz_index = (ci - _curves.begin()); + xyz_index = (ci - _curves.begin()); } new_curves.push_back(curve); } @@ -503,7 +503,7 @@ evaluate(float t, LVecBase3f &xyz, LVecBase3f &hpr) const { case PCT_T: if (!curve->get_point(t0, point)) { - return false; + return false; } t0 = point[0]; } @@ -577,7 +577,7 @@ evaluate_t(float t) const { if (curve->get_curve_type() == PCT_T) { if (!curve->get_point(t0, point)) { - return -1.0; + return -1.0; } t0 = point[0]; } @@ -796,28 +796,28 @@ write_egg(ostream &out, const Filename &filename, CoordinateSystem cs) { switch (curve->get_curve_type()) { case PCT_XYZ: - name += "_xyz"; - if (xyz_count > 0) { - name += format_string(xyz_count); - } - xyz_count++; - break; + name += "_xyz"; + if (xyz_count > 0) { + name += format_string(xyz_count); + } + xyz_count++; + break; case PCT_HPR: - name += "_hpr"; - if (hpr_count > 0) { - name += format_string(hpr_count); - } - hpr_count++; - break; + name += "_hpr"; + if (hpr_count > 0) { + name += format_string(hpr_count); + } + hpr_count++; + break; case PCT_T: - name += "_t"; - if (t_count > 0) { - name += format_string(t_count); - } - t_count++; - break; + name += "_t"; + if (t_count > 0) { + name += format_string(t_count); + } + t_count++; + break; } curve->set_name(name); diff --git a/panda/src/parametrics/parametricCurveCollection.h b/panda/src/parametrics/parametricCurveCollection.h index a83b6a9a09..a935c14b19 100644 --- a/panda/src/parametrics/parametricCurveCollection.h +++ b/panda/src/parametrics/parametricCurveCollection.h @@ -73,7 +73,7 @@ PUBLISHED: bool recompute(); bool stitch(const ParametricCurveCollection *a, - const ParametricCurveCollection *b); + const ParametricCurveCollection *b); void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/parametrics/parametricCurveDrawer.cxx b/panda/src/parametrics/parametricCurveDrawer.cxx index 67fe683d74..9bb8480ba7 100644 --- a/panda/src/parametrics/parametricCurveDrawer.cxx +++ b/panda/src/parametrics/parametricCurveDrawer.cxx @@ -356,30 +356,30 @@ draw() { LVecBase3f tangent; if (xyz_curve->get_pt(t0, point, tangent)) { - if (_tick_geometry == (Node *)NULL) { - // Draw crosses. - LVecBase3f t1, t2; - get_tick_marks(tangent, t1, t2); - - _ticks.move_to(point - t1 * _tick_scale); - _ticks.draw_to(point + t1 * _tick_scale); - _ticks.move_to(point - t2 * _tick_scale); - _ticks.draw_to(point + t2 * _tick_scale); + if (_tick_geometry == (Node *)NULL) { + // Draw crosses. + LVecBase3f t1, t2; + get_tick_marks(tangent, t1, t2); - } else { - // Instance the tick geometry. - NodeRelation *arc = new RenderRelation(_geom_node, _tick_geometry); - _tick_arcs.push_back(arc); + _ticks.move_to(point - t1 * _tick_scale); + _ticks.draw_to(point + t1 * _tick_scale); + _ticks.move_to(point - t2 * _tick_scale); + _ticks.draw_to(point + t2 * _tick_scale); - LVecBase3f hpr(0.0, 0.0, 0.0); - if (hpr_curve != (ParametricCurve *)NULL) { - hpr_curve->get_point(t0, hpr); - } - LMatrix4f mat; - compose_matrix(mat, LVecBase3f(_tick_scale, _tick_scale, _tick_scale), - hpr, point); - arc->set_transition(new TransformTransition(mat)); - } + } else { + // Instance the tick geometry. + NodeRelation *arc = new RenderRelation(_geom_node, _tick_geometry); + _tick_arcs.push_back(arc); + + LVecBase3f hpr(0.0, 0.0, 0.0); + if (hpr_curve != (ParametricCurve *)NULL) { + hpr_curve->get_point(t0, hpr); + } + LMatrix4f mat; + compose_matrix(mat, LVecBase3f(_tick_scale, _tick_scale, _tick_scale), + hpr, point); + arc->set_transition(new TransformTransition(mat)); + } } } _ticks.create(_geom_node, _frame_accurate); diff --git a/panda/src/parametrics/parametricCurveDrawer.h b/panda/src/parametrics/parametricCurveDrawer.h index 6b4a9633b0..cd7473bfc4 100644 --- a/panda/src/parametrics/parametricCurveDrawer.h +++ b/panda/src/parametrics/parametricCurveDrawer.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ParametricCurveDrawer +// Class : ParametricCurveDrawer // Description : Draws a 3-d parametric curve in the scene by creating // a series of line segments to approximate the curve. //////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ public: } static void init_type() { register_type(_type_handle, "ParametricCurveDrawer", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/parametrics/piecewiseCurve.h b/panda/src/parametrics/piecewiseCurve.h index 2cfba421e3..fed1b7d242 100644 --- a/panda/src/parametrics/piecewiseCurve.h +++ b/panda/src/parametrics/piecewiseCurve.h @@ -36,8 +36,8 @@ public: virtual bool adjust_point(float t, float px, float py, float pz); virtual bool adjust_tangent(float t, float tx, float ty, float tz); virtual bool adjust_pt(float t, - float px, float py, float pz, - float tx, float ty, float tz); + float px, float py, float pz, + float tx, float ty, float tz); public: int get_num_segs() const; @@ -86,7 +86,7 @@ protected: virtual void write_datagram(BamWriter *manager, Datagram &me); void fillin(DatagramIterator &scan, BamReader *manager); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); public: static TypeHandle get_class_type() { diff --git a/panda/src/parametrics/test_parametrics.cxx b/panda/src/parametrics/test_parametrics.cxx index c85a2232f7..2522a76fce 100644 --- a/panda/src/parametrics/test_parametrics.cxx +++ b/panda/src/parametrics/test_parametrics.cxx @@ -1,4 +1,4 @@ /* - Currently, there is not any test code for parametrics. - Feel free to create some. + Currently, there is not any test code for parametrics. + Feel free to create some. */ \ No newline at end of file diff --git a/panda/src/particlesystem/geomParticleRenderer.cxx b/panda/src/particlesystem/geomParticleRenderer.cxx index c3475897f8..0aa62e7c19 100644 --- a/panda/src/particlesystem/geomParticleRenderer.cxx +++ b/panda/src/particlesystem/geomParticleRenderer.cxx @@ -151,12 +151,12 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if ((_alpha_mode != PR_ALPHA_NONE)) { float alpha_scalar; - if(_alpha_mode == PR_ALPHA_USER) { - alpha_scalar=get_user_alpha(); - } else { - alpha_scalar = cur_particle->get_parameterized_age(); - if (_alpha_mode == PR_ALPHA_OUT) - alpha_scalar = 1.0f - alpha_scalar; + if(_alpha_mode == PR_ALPHA_USER) { + alpha_scalar=get_user_alpha(); + } else { + alpha_scalar = cur_particle->get_parameterized_age(); + if (_alpha_mode == PR_ALPHA_OUT) + alpha_scalar = 1.0f - alpha_scalar; } alpha = new ColorTransition(1.0f, 1.0f, 1.0f, alpha_scalar); diff --git a/panda/src/particlesystem/geomParticleRenderer.h b/panda/src/particlesystem/geomParticleRenderer.h index bc743856b9..cbe6ce9c80 100644 --- a/panda/src/particlesystem/geomParticleRenderer.h +++ b/panda/src/particlesystem/geomParticleRenderer.h @@ -35,13 +35,13 @@ private: virtual void init_geoms(void); virtual void render(vector< PT(PhysicsObject) >& po_vector, - int ttl_particles); + int ttl_particles); virtual void resize_pool(int new_size); PUBLISHED: GeomParticleRenderer(ParticleRendererAlphaMode am = PR_ALPHA_NONE, - Node *geom_node = (Node *) NULL); + Node *geom_node = (Node *) NULL); GeomParticleRenderer(const GeomParticleRenderer& copy); virtual ~GeomParticleRenderer(void); diff --git a/panda/src/particlesystem/lineParticleRenderer.cxx b/panda/src/particlesystem/lineParticleRenderer.cxx index 560329a971..caf7ff5cc8 100644 --- a/panda/src/particlesystem/lineParticleRenderer.cxx +++ b/panda/src/particlesystem/lineParticleRenderer.cxx @@ -190,15 +190,15 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { if (_alpha_mode != PR_ALPHA_NONE) { - float alpha; + float alpha; if (_alpha_mode == PR_ALPHA_USER) { - alpha = get_user_alpha(); - } else { - alpha = cur_particle->get_parameterized_age(); - if (_alpha_mode == PR_ALPHA_OUT) - alpha = 1.0f - alpha; - } + alpha = get_user_alpha(); + } else { + alpha = cur_particle->get_parameterized_age(); + if (_alpha_mode == PR_ALPHA_OUT) + alpha = 1.0f - alpha; + } head_color[3] = alpha; tail_color[3] = alpha; diff --git a/panda/src/particlesystem/particleSystem.I b/panda/src/particlesystem/particleSystem.I index 197204cd94..cac98b00e3 100644 --- a/panda/src/particlesystem/particleSystem.I +++ b/panda/src/particlesystem/particleSystem.I @@ -184,7 +184,7 @@ set_render_parent(Node *node) { _render_parent = node; _render_arc = new RenderRelation(_render_parent, - _renderer->get_render_node()); + _renderer->get_render_node()); } //////////////////////////////////////////////////////////////////// @@ -213,7 +213,7 @@ add_spawn_template(ParticleSystem *ps) { INLINE void ParticleSystem:: clear_spawn_templates(void) { _spawn_templates.erase(_spawn_templates.begin(), - _spawn_templates.end()); + _spawn_templates.end()); } //// ///////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 77b56d7bea..f897945927 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -222,15 +222,15 @@ spawn_child_system(BaseParticle *bp) { PhysicalNode *this_pn = get_physical_node(); if (!this_pn) { physics_cat.error() << "ParticleSystem::spawn_child_system: " - << "Spawning system is not in the scene graph," - << " aborting." << endl; + << "Spawning system is not in the scene graph," + << " aborting." << endl; return; } if (this_pn->get_num_parents(RenderRelation::get_class_type()) == 0) { physics_cat.error() << "ParticleSystem::spawn_child_system: " - << "PhysicalNode this system is contained in " - << "has no parent, aborting." << endl; + << "PhysicalNode this system is contained in " + << "has no parent, aborting." << endl; return; } @@ -250,7 +250,7 @@ spawn_child_system(BaseParticle *bp) { // first, set up the render node info. new_ps->_render_parent = _spawn_render_node; new_ps->_render_arc = new RenderRelation(new_ps->_render_parent, - new_ps->_renderer->get_render_node()); + new_ps->_renderer->get_render_node()); // now set up the new system's PhysicalNode. PT(PhysicalNode) new_pn = new PhysicalNode; @@ -323,13 +323,13 @@ resize_pool(int size) { if (_factory.is_null()) { particlesystem_cat.error() << "ParticleSystem::resize_pool" - << " called with null _factory." << endl; + << " called with null _factory." << endl; return; } if (_renderer.is_null()) { particlesystem_cat.error() << "ParticleSystem::resize_pool" - << " called with null _renderer." << endl; + << " called with null _renderer." << endl; return; } @@ -340,7 +340,7 @@ resize_pool(int size) { if (po_delta > 0) { for (i = 0; i < po_delta; i++) { - // int free_index = _physics_objects.size(); + // int free_index = _physics_objects.size(); BaseParticle *new_particle = _factory->alloc_particle(); if (new_particle) { diff --git a/panda/src/particlesystem/pointParticleRenderer.cxx b/panda/src/particlesystem/pointParticleRenderer.cxx index a104e68423..f887330428 100644 --- a/panda/src/particlesystem/pointParticleRenderer.cxx +++ b/panda/src/particlesystem/pointParticleRenderer.cxx @@ -14,10 +14,10 @@ PointParticleRenderer:: PointParticleRenderer(ParticleRendererAlphaMode am, - float point_size, - PointParticleBlendType bt, - ParticleRendererBlendMethod bm, - const Colorf& sc, const Colorf& ec) : + float point_size, + PointParticleBlendType bt, + ParticleRendererBlendMethod bm, + const Colorf& sc, const Colorf& ec) : BaseParticleRenderer(am), _start_color(sc), _end_color(ec), _point_size(point_size), @@ -150,7 +150,7 @@ create_color(const BaseParticle *p) { case PP_BLEND_LIFE: parameterized_age = p->get_parameterized_age(); - life_t = parameterized_age; + life_t = parameterized_age; have_alpha_t = true; if (_blend_method == PP_BLEND_CUBIC) @@ -176,17 +176,17 @@ create_color(const BaseParticle *p) { // handle alpha channel if(_alpha_mode != PR_ALPHA_NONE) { - if(_alpha_mode == PR_ALPHA_USER) { - parameterized_age = get_user_alpha(); - } else { - if(!have_alpha_t) - parameterized_age = p->get_parameterized_age(); + if(_alpha_mode == PR_ALPHA_USER) { + parameterized_age = get_user_alpha(); + } else { + if(!have_alpha_t) + parameterized_age = p->get_parameterized_age(); - if(_alpha_mode==PR_ALPHA_OUT) { - parameterized_age=1.0f-parameterized_age; - } - } - color[3] = parameterized_age; + if(_alpha_mode==PR_ALPHA_OUT) { + parameterized_age=1.0f-parameterized_age; + } + } + color[3] = parameterized_age; } return color; diff --git a/panda/src/particlesystem/pointParticleRenderer.h b/panda/src/particlesystem/pointParticleRenderer.h index 479c4a36d9..eadaf2986d 100644 --- a/panda/src/particlesystem/pointParticleRenderer.h +++ b/panda/src/particlesystem/pointParticleRenderer.h @@ -32,11 +32,11 @@ PUBLISHED: PointParticleRenderer(const PointParticleRenderer& copy); PointParticleRenderer(ParticleRendererAlphaMode ad = PR_ALPHA_NONE, - float point_size = 1.0f, - PointParticleBlendType bt = PP_ONE_COLOR, - ParticleRendererBlendMethod bm = PP_NO_BLEND, - const Colorf& sc = Colorf(1.0f, 1.0f, 1.0f, 1.0f), - const Colorf& ec = Colorf(1.0f, 1.0f, 1.0f, 1.0f)); + float point_size = 1.0f, + PointParticleBlendType bt = PP_ONE_COLOR, + ParticleRendererBlendMethod bm = PP_NO_BLEND, + const Colorf& sc = Colorf(1.0f, 1.0f, 1.0f, 1.0f), + const Colorf& ec = Colorf(1.0f, 1.0f, 1.0f, 1.0f)); virtual ~PointParticleRenderer(void); @@ -76,7 +76,7 @@ private: virtual void kill_particle(int index); virtual void init_geoms(void); virtual void render(vector< PT(PhysicsObject) >& po_vector, - int ttl_particles); + int ttl_particles); virtual void resize_pool(int new_size); }; diff --git a/panda/src/particlesystem/sparkleParticleRenderer.cxx b/panda/src/particlesystem/sparkleParticleRenderer.cxx index 25e4013914..b2f71c831a 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.cxx +++ b/panda/src/particlesystem/sparkleParticleRenderer.cxx @@ -32,9 +32,9 @@ SparkleParticleRenderer(void) : SparkleParticleRenderer:: SparkleParticleRenderer(const Colorf& center, const Colorf& edge, - float birth_radius, float death_radius, - SparkleParticleLifeScale life_scale, - ParticleRendererAlphaMode alpha_mode) : + float birth_radius, float death_radius, + SparkleParticleLifeScale life_scale, + ParticleRendererAlphaMode alpha_mode) : BaseParticleRenderer(alpha_mode), _center_color(center), _edge_color(edge), _birth_radius(birth_radius), _death_radius(death_radius), _life_scale(life_scale) @@ -200,14 +200,14 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // handle alpha if (_alpha_mode != PR_ALPHA_NONE) { - if(_alpha_mode == PR_ALPHA_USER) { - alpha=get_user_alpha(); - } else { - alpha = cur_particle->get_parameterized_age(); + if(_alpha_mode == PR_ALPHA_USER) { + alpha=get_user_alpha(); + } else { + alpha = cur_particle->get_parameterized_age(); - if (_alpha_mode == PR_ALPHA_OUT) - alpha = 1.0f - alpha; - } + if (_alpha_mode == PR_ALPHA_OUT) + alpha = 1.0f - alpha; + } center_color[3] = alpha; edge_color[3] = alpha; diff --git a/panda/src/particlesystem/sparkleParticleRenderer.h b/panda/src/particlesystem/sparkleParticleRenderer.h index 70e104e509..1314cf98a5 100644 --- a/panda/src/particlesystem/sparkleParticleRenderer.h +++ b/panda/src/particlesystem/sparkleParticleRenderer.h @@ -34,11 +34,11 @@ PUBLISHED: SparkleParticleRenderer(void); SparkleParticleRenderer(const SparkleParticleRenderer& copy); SparkleParticleRenderer(const Colorf& center, - const Colorf& edge, - float birth_radius, - float death_radius, - SparkleParticleLifeScale life_scale, - ParticleRendererAlphaMode alpha_mode); + const Colorf& edge, + float birth_radius, + float death_radius, + SparkleParticleLifeScale life_scale, + ParticleRendererAlphaMode alpha_mode); virtual ~SparkleParticleRenderer(void); @@ -80,7 +80,7 @@ private: virtual void kill_particle(int index); virtual void init_geoms(void); virtual void render(vector< PT(PhysicsObject) >& po_vector, - int ttl_particles); + int ttl_particles); virtual void resize_pool(int new_size); }; diff --git a/panda/src/particlesystem/spriteParticleRenderer.cxx b/panda/src/particlesystem/spriteParticleRenderer.cxx index f4078e1a5a..598a014150 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.cxx +++ b/panda/src/particlesystem/spriteParticleRenderer.cxx @@ -226,7 +226,7 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { // put the current color into the array Colorf c = _color; - int alphamode=get_alpha_mode(); + int alphamode=get_alpha_mode(); if (alphamode != PR_ALPHA_NONE) { float t = cur_particle->get_parameterized_age(); @@ -234,10 +234,10 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) { c[3] = 1.0f - t; else if (alphamode == PR_ALPHA_IN) c[3] = t; - else { - assert(alphamode == PR_ALPHA_USER); - c[3] = get_user_alpha(); - } + else { + assert(alphamode == PR_ALPHA_USER); + c[3] = get_user_alpha(); + } } *cur_color++ = c; diff --git a/panda/src/particlesystem/spriteParticleRenderer.h b/panda/src/particlesystem/spriteParticleRenderer.h index e527e3b63a..60dc2c6ecf 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.h +++ b/panda/src/particlesystem/spriteParticleRenderer.h @@ -50,7 +50,7 @@ private: virtual void kill_particle(int index); virtual void init_geoms(void); virtual void render(vector< PT(PhysicsObject) > &po_vector, - int ttl_particles); + int ttl_particles); virtual void resize_pool(int new_size); PUBLISHED: diff --git a/panda/src/physics/actorNode.cxx b/panda/src/physics/actorNode.cxx index ff768f289d..fa91dea975 100644 --- a/panda/src/physics/actorNode.cxx +++ b/panda/src/physics/actorNode.cxx @@ -89,7 +89,7 @@ transform_changed(NodeRelation *arc) { // extract the position LPoint3f pos; - + tt->get_matrix().get_row3(pos,3); // extract the orientation diff --git a/panda/src/physics/actorNode.h b/panda/src/physics/actorNode.h index c5a1d5c478..a4c4cdc31e 100644 --- a/panda/src/physics/actorNode.h +++ b/panda/src/physics/actorNode.h @@ -48,7 +48,7 @@ public: static void init_type(void) { PhysicalNode::init_type(); register_type(_type_handle, "ActorNode", - PhysicalNode::get_class_type()); + PhysicalNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/angularEulerIntegrator.cxx b/panda/src/physics/angularEulerIntegrator.cxx index 4d4ff104cc..b7bf9b760a 100644 --- a/panda/src/physics/angularEulerIntegrator.cxx +++ b/panda/src/physics/angularEulerIntegrator.cxx @@ -37,8 +37,8 @@ AngularEulerIntegrator:: //////////////////////////////////////////////////////////////////// void AngularEulerIntegrator:: child_integrate(Physical *physical, - vector< PT(AngularForce) >& forces, - float dt) { + vector< PT(AngularForce) >& forces, + float dt) { // perform the precomputation. Note that the vector returned by // get_precomputed_matrices() has the matrices loaded in order of force // type: first global, then local. If you're using this as a guide to write @@ -86,7 +86,7 @@ child_integrate(Physical *physical, // make sure the force is turned on. if (cur_force->get_active() == false) - continue; + continue; force_node = cur_force->get_force_node(); @@ -104,14 +104,14 @@ child_integrate(Physical *physical, // make sure the force is turned on. if (cur_force->get_active() == false) - continue; + continue; force_node = cur_force->get_force_node(); // go from force space to object space f = cur_force->get_vector(current_object) * matrices[index++]; - // tally it into the accum vectors + // tally it into the accum vectors accum_vec += f; } diff --git a/panda/src/physics/angularEulerIntegrator.h b/panda/src/physics/angularEulerIntegrator.h index a4e250dc16..7a677150c5 100644 --- a/panda/src/physics/angularEulerIntegrator.h +++ b/panda/src/physics/angularEulerIntegrator.h @@ -16,8 +16,8 @@ class EXPCL_PANDAPHYSICS AngularEulerIntegrator : public AngularIntegrator { private: virtual void child_integrate(Physical *physical, - vector< PT(AngularForce) >& forces, - float dt); + vector< PT(AngularForce) >& forces, + float dt); PUBLISHED: AngularEulerIntegrator(void); diff --git a/panda/src/physics/angularForce.h b/panda/src/physics/angularForce.h index 1d16bae489..c1a507c66f 100644 --- a/panda/src/physics/angularForce.h +++ b/panda/src/physics/angularForce.h @@ -34,7 +34,7 @@ public: static void init_type(void) { BaseForce::init_type(); register_type(_type_handle, "AngularForce", - BaseForce::get_class_type()); + BaseForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/angularIntegrator.cxx b/panda/src/physics/angularIntegrator.cxx index 8ca5622513..8833f10441 100644 --- a/panda/src/physics/angularIntegrator.cxx +++ b/panda/src/physics/angularIntegrator.cxx @@ -30,7 +30,7 @@ AngularIntegrator:: //////////////////////////////////////////////////////////////////// void AngularIntegrator:: integrate(Physical *physical, vector< PT(AngularForce) >& forces, - float dt) { + float dt) { // intercept in case we want to censor/adjust values if (dt > _max_angular_dt) dt = _max_angular_dt; diff --git a/panda/src/physics/angularIntegrator.h b/panda/src/physics/angularIntegrator.h index b46fabb9c8..bdd3fb68aa 100644 --- a/panda/src/physics/angularIntegrator.h +++ b/panda/src/physics/angularIntegrator.h @@ -22,7 +22,7 @@ private: // this allows baseAngularIntegrator to censor/modify data that the // actual integration function receives. virtual void child_integrate(Physical *physical, vector< PT(AngularForce) > &forces, - float dt) = 0; + float dt) = 0; protected: AngularIntegrator(void); @@ -31,7 +31,7 @@ public: virtual ~AngularIntegrator(void); void integrate(Physical *physical, vector< PT(AngularForce) > &forces, - float dt); + float dt); }; #endif // ANGULARINTEGRATOR_H diff --git a/panda/src/physics/angularVectorForce.h b/panda/src/physics/angularVectorForce.h index c23cd37321..ab369ba8ae 100644 --- a/panda/src/physics/angularVectorForce.h +++ b/panda/src/physics/angularVectorForce.h @@ -37,7 +37,7 @@ public: static void init_type(void) { AngularForce::init_type(); register_type(_type_handle, "AngularVectorForce", - AngularForce::get_class_type()); + AngularForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/baseForce.h b/panda/src/physics/baseForce.h index 3cf2f46c46..b48454f49b 100644 --- a/panda/src/physics/baseForce.h +++ b/panda/src/physics/baseForce.h @@ -48,7 +48,7 @@ public: static void init_type(void) { TypedReferenceCount::init_type(); register_type(_type_handle, "BaseForce", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/baseIntegrator.cxx b/panda/src/physics/baseIntegrator.cxx index 58b6ffd469..e6b01744b6 100644 --- a/panda/src/physics/baseIntegrator.cxx +++ b/panda/src/physics/baseIntegrator.cxx @@ -37,7 +37,7 @@ BaseIntegrator:: //////////////////////////////////////////////////////////////////// void BaseIntegrator:: precompute_linear_matrices(Physical *physical, - const vector< PT(LinearForce) > &forces) { + const vector< PT(LinearForce) > &forces) { // make sure the physical's in the scene graph, somewhere. PhysicalNode *physical_node = physical->get_physical_node(); nassertv(physical_node != NULL); @@ -88,7 +88,7 @@ precompute_linear_matrices(Physical *physical, //////////////////////////////////////////////////////////////////// void BaseIntegrator:: precompute_angular_matrices(Physical *physical, - const vector< PT(AngularForce) > &forces) { + const vector< PT(AngularForce) > &forces) { // make sure the physical's in the scene graph, somewhere. PhysicalNode *physical_node = physical->get_physical_node(); nassertv(physical_node != NULL); diff --git a/panda/src/physics/baseIntegrator.h b/panda/src/physics/baseIntegrator.h index 71725c0623..dfcc9c9c7c 100644 --- a/panda/src/physics/baseIntegrator.h +++ b/panda/src/physics/baseIntegrator.h @@ -40,9 +40,9 @@ protected: INLINE const vector< LMatrix4f > &get_precomputed_angular_matrices(void) const; void precompute_linear_matrices(Physical *physical, - const vector< PT(LinearForce) > &forces); + const vector< PT(LinearForce) > &forces); void precompute_angular_matrices(Physical *physical, - const vector< PT(AngularForce) > &forces); + const vector< PT(AngularForce) > &forces); public: virtual ~BaseIntegrator(void); diff --git a/panda/src/physics/forceNode.I b/panda/src/physics/forceNode.I index c739f18e03..52aa319e34 100644 --- a/panda/src/physics/forceNode.I +++ b/panda/src/physics/forceNode.I @@ -19,7 +19,7 @@ clear(void) { INLINE BaseForce *ForceNode:: get_force(int index) const { nassertr(index >= 0 && index < (int)_forces.size(), - (BaseForce *) NULL); + (BaseForce *) NULL); return _forces[index]; } diff --git a/panda/src/physics/forceNode.cxx b/panda/src/physics/forceNode.cxx index fde40b6ee0..182498c5a5 100644 --- a/panda/src/physics/forceNode.cxx +++ b/panda/src/physics/forceNode.cxx @@ -69,7 +69,7 @@ add_forces_from(const ForceNode &other) { vector< PT(BaseForce) >::iterator last = _forces.end() - 1; _forces.insert(_forces.end(), - other._forces.begin(), other._forces.end()); + other._forces.begin(), other._forces.end()); for (; last != _forces.end(); last++) (*last)->_force_node = this; diff --git a/panda/src/physics/forceNode.h b/panda/src/physics/forceNode.h index e9ba07ad26..b7ab201590 100644 --- a/panda/src/physics/forceNode.h +++ b/panda/src/physics/forceNode.h @@ -48,7 +48,7 @@ public: static void init_type(void) { NamedNode::init_type(); register_type(_type_handle, "ForceNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearCylinderVortexForce.cxx b/panda/src/physics/linearCylinderVortexForce.cxx index 5ffabc27a7..0abed31b5e 100644 --- a/panda/src/physics/linearCylinderVortexForce.cxx +++ b/panda/src/physics/linearCylinderVortexForce.cxx @@ -15,7 +15,7 @@ TypeHandle LinearCylinderVortexForce::_type_handle; //////////////////////////////////////////////////////////////////// LinearCylinderVortexForce:: LinearCylinderVortexForce(float radius, float length, float coef, - float a, bool md) : + float a, bool md) : LinearForce(a, md), _radius(radius), _length(length), _coef(coef) { diff --git a/panda/src/physics/linearCylinderVortexForce.h b/panda/src/physics/linearCylinderVortexForce.h index 3162f80dc1..c513875dd3 100644 --- a/panda/src/physics/linearCylinderVortexForce.h +++ b/panda/src/physics/linearCylinderVortexForce.h @@ -29,10 +29,10 @@ private: PUBLISHED: LinearCylinderVortexForce(float radius = 1.0f, - float length = 0.0f, - float coef = 1.0f, - float a = 1.0f, - bool md = false); + float length = 0.0f, + float coef = 1.0f, + float a = 1.0f, + bool md = false); LinearCylinderVortexForce(const LinearCylinderVortexForce ©); virtual ~LinearCylinderVortexForce(void); @@ -52,7 +52,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearCylinderVortexForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearDistanceForce.h b/panda/src/physics/linearDistanceForce.h index 39b3e25212..1e63c71227 100644 --- a/panda/src/physics/linearDistanceForce.h +++ b/panda/src/physics/linearDistanceForce.h @@ -43,7 +43,7 @@ private: protected: LinearDistanceForce(const LPoint3f& p, FalloffType ft, float r, float a, - bool m); + bool m); LinearDistanceForce(const LinearDistanceForce ©); virtual ~LinearDistanceForce(void); @@ -54,7 +54,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearDistanceForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearEulerIntegrator.cxx b/panda/src/physics/linearEulerIntegrator.cxx index d59220f73a..94455c9753 100644 --- a/panda/src/physics/linearEulerIntegrator.cxx +++ b/panda/src/physics/linearEulerIntegrator.cxx @@ -37,8 +37,8 @@ LinearEulerIntegrator:: //////////////////////////////////////////////////////////////////// void LinearEulerIntegrator:: child_integrate(Physical *physical, - vector< PT(LinearForce) >& forces, - float dt) { + vector< PT(LinearForce) >& forces, + float dt) { vector< PT(PhysicsObject) >::const_iterator current_object_iter; // perform the precomputation. Note that the vector returned by @@ -93,7 +93,7 @@ child_integrate(Physical *physical, // make sure the force is turned on. if (cur_force->get_active() == false) - continue; + continue; force_node = cur_force->get_force_node(); @@ -102,9 +102,9 @@ child_integrate(Physical *physical, // tally it into the accum vectors. if (cur_force->get_mass_dependent() == true) - md_accum_vec += f; + md_accum_vec += f; else - non_md_accum_vec += f; + non_md_accum_vec += f; } // local forces @@ -114,7 +114,7 @@ child_integrate(Physical *physical, // make sure the force is turned on. if (cur_force->get_active() == false) - continue; + continue; force_node = cur_force->get_force_node(); @@ -123,9 +123,9 @@ child_integrate(Physical *physical, // tally it into the accum vectors if (cur_force->get_mass_dependent() == true) - md_accum_vec += f; + md_accum_vec += f; else - non_md_accum_vec += f; + non_md_accum_vec += f; } // get this object's physical info diff --git a/panda/src/physics/linearEulerIntegrator.h b/panda/src/physics/linearEulerIntegrator.h index ac39f233a1..f86478610e 100644 --- a/panda/src/physics/linearEulerIntegrator.h +++ b/panda/src/physics/linearEulerIntegrator.h @@ -16,8 +16,8 @@ class EXPCL_PANDAPHYSICS LinearEulerIntegrator : public LinearIntegrator { private: virtual void child_integrate(Physical *physical, - vector< PT(LinearForce) >& forces, - float dt); + vector< PT(LinearForce) >& forces, + float dt); PUBLISHED: LinearEulerIntegrator(void); diff --git a/panda/src/physics/linearForce.h b/panda/src/physics/linearForce.h index 000bc1d9ac..63e4a85ec9 100644 --- a/panda/src/physics/linearForce.h +++ b/panda/src/physics/linearForce.h @@ -52,7 +52,7 @@ public: static void init_type(void) { BaseForce::init_type(); register_type(_type_handle, "LinearForce", - BaseForce::get_class_type()); + BaseForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearFrictionForce.h b/panda/src/physics/linearFrictionForce.h index 60a8897498..1715808b85 100644 --- a/panda/src/physics/linearFrictionForce.h +++ b/panda/src/physics/linearFrictionForce.h @@ -34,7 +34,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearFrictionForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearIntegrator.cxx b/panda/src/physics/linearIntegrator.cxx index c22f33084f..bf5756c73c 100644 --- a/panda/src/physics/linearIntegrator.cxx +++ b/panda/src/physics/linearIntegrator.cxx @@ -36,7 +36,7 @@ LinearIntegrator:: //////////////////////////////////////////////////////////////////// void LinearIntegrator:: integrate(Physical *physical, vector< PT(LinearForce) > &forces, - float dt) { + float dt) { /* <-- darren, 2000.10.06 // cap dt so physics don't go flying off on lags if (dt > _max_linear_dt) diff --git a/panda/src/physics/linearIntegrator.h b/panda/src/physics/linearIntegrator.h index 604b736bb9..e26ab5f071 100644 --- a/panda/src/physics/linearIntegrator.h +++ b/panda/src/physics/linearIntegrator.h @@ -23,7 +23,7 @@ private: // this allows baseLinearIntegrator to censor/modify data that the // actual integration function receives. virtual void child_integrate(Physical *physical, vector< PT(LinearForce) > &forces, - float dt) = 0; + float dt) = 0; protected: LinearIntegrator(void); @@ -32,7 +32,7 @@ public: virtual ~LinearIntegrator(void); void integrate(Physical *physical, vector< PT(LinearForce) > &forces, - float dt); + float dt); }; #endif // LINEARINTEGRATOR_H diff --git a/panda/src/physics/linearJitterForce.h b/panda/src/physics/linearJitterForce.h index 106f9732e4..21bf36f920 100644 --- a/panda/src/physics/linearJitterForce.h +++ b/panda/src/physics/linearJitterForce.h @@ -30,7 +30,7 @@ public: static void init_type(void) { LinearRandomForce::init_type(); register_type(_type_handle, "LinearJitterForce", - LinearRandomForce::get_class_type()); + LinearRandomForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearNoiseForce.cxx b/panda/src/physics/linearNoiseForce.cxx index 4cafd51b37..d2be8273ea 100644 --- a/panda/src/physics/linearNoiseForce.cxx +++ b/panda/src/physics/linearNoiseForce.cxx @@ -118,16 +118,16 @@ get_child_vector(const PhysicsObject *po) { // x direction temp0 = vlerp(cubic_x, get_lattice_entry(p), - get_lattice_entry(p[0] + 1.0f, p[1], p[2])); + get_lattice_entry(p[0] + 1.0f, p[1], p[2])); temp1 = vlerp(cubic_x, get_lattice_entry(p[0], p[1], p[2] + 1.0f), - get_lattice_entry(p[0] + 1.0f, p[1], p[2] + 1.0f)); + get_lattice_entry(p[0] + 1.0f, p[1], p[2] + 1.0f)); temp2 = vlerp(cubic_x, get_lattice_entry(p[0], p[1] + 1.0f, p[2]), - get_lattice_entry(p[0] + 1.0f, p[1] + 1.0f, p[2])); + get_lattice_entry(p[0] + 1.0f, p[1] + 1.0f, p[2])); temp3 = vlerp(cubic_x, get_lattice_entry(p[0], p[1] + 1.0f, p[2] + 1.0f), - get_lattice_entry(p[0] + 1.0f, p[1] + 1.0f, p[2] + 1.0f)); + get_lattice_entry(p[0] + 1.0f, p[1] + 1.0f, p[2] + 1.0f)); // y direction temp0 = vlerp(cubic_z, temp0, temp1); diff --git a/panda/src/physics/linearNoiseForce.h b/panda/src/physics/linearNoiseForce.h index 3fd5658b0e..e0382d4b86 100644 --- a/panda/src/physics/linearNoiseForce.h +++ b/panda/src/physics/linearNoiseForce.h @@ -48,7 +48,7 @@ public: static void init_type(void) { LinearRandomForce::init_type(); register_type(_type_handle, "LinearNoiseForce", - LinearRandomForce::get_class_type()); + LinearRandomForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearRandomForce.h b/panda/src/physics/linearRandomForce.h index c26b189342..bc562b713a 100644 --- a/panda/src/physics/linearRandomForce.h +++ b/panda/src/physics/linearRandomForce.h @@ -36,7 +36,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearRandomForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearSinkForce.cxx b/panda/src/physics/linearSinkForce.cxx index 517975a81c..736f50adc3 100644 --- a/panda/src/physics/linearSinkForce.cxx +++ b/panda/src/physics/linearSinkForce.cxx @@ -14,7 +14,7 @@ TypeHandle LinearSinkForce::_type_handle; //////////////////////////////////////////////////////////////////// LinearSinkForce:: LinearSinkForce(const LPoint3f& p, FalloffType f, float r, float a, - bool mass) : + bool mass) : LinearDistanceForce(p, f, r, a, mass) { } @@ -26,7 +26,7 @@ LinearSinkForce(const LPoint3f& p, FalloffType f, float r, float a, LinearSinkForce:: LinearSinkForce(void) : LinearDistanceForce(LPoint3f(0.0f, 0.0f, 0.0f), FT_ONE_OVER_R_SQUARED, - 1.0f, 1.0f, true) { + 1.0f, 1.0f, true) { } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physics/linearSinkForce.h b/panda/src/physics/linearSinkForce.h index d059497309..71edcbb83b 100644 --- a/panda/src/physics/linearSinkForce.h +++ b/panda/src/physics/linearSinkForce.h @@ -19,7 +19,7 @@ private: PUBLISHED: LinearSinkForce(const LPoint3f& p, FalloffType f, float r, float a = 1.0f, - bool m = true); + bool m = true); LinearSinkForce(void); LinearSinkForce(const LinearSinkForce ©); virtual ~LinearSinkForce(void); @@ -31,7 +31,7 @@ public: static void init_type(void) { LinearDistanceForce::init_type(); register_type(_type_handle, "LinearSinkForce", - LinearDistanceForce::get_class_type()); + LinearDistanceForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearSourceForce.cxx b/panda/src/physics/linearSourceForce.cxx index 8b9455ec44..60c2bb8613 100644 --- a/panda/src/physics/linearSourceForce.cxx +++ b/panda/src/physics/linearSourceForce.cxx @@ -14,7 +14,7 @@ TypeHandle LinearSourceForce::_type_handle; //////////////////////////////////////////////////////////////////// LinearSourceForce:: LinearSourceForce(const LPoint3f& p, FalloffType f, float r, float a, - bool mass) : + bool mass) : LinearDistanceForce(p, f, r, a, mass) { } @@ -26,7 +26,7 @@ LinearSourceForce(const LPoint3f& p, FalloffType f, float r, float a, LinearSourceForce:: LinearSourceForce(void) : LinearDistanceForce(LPoint3f(0.0f, 0.0f, 0.0f), FT_ONE_OVER_R_SQUARED, - 1.0f, 1.0f, true) { + 1.0f, 1.0f, true) { } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physics/linearSourceForce.h b/panda/src/physics/linearSourceForce.h index 3d553d2a06..adf09c206f 100644 --- a/panda/src/physics/linearSourceForce.h +++ b/panda/src/physics/linearSourceForce.h @@ -19,7 +19,7 @@ private: PUBLISHED: LinearSourceForce(const LPoint3f& p, FalloffType f, float r, float a = 1.0f, - bool mass = true); + bool mass = true); LinearSourceForce(void); LinearSourceForce(const LinearSourceForce ©); virtual ~LinearSourceForce(void); @@ -31,7 +31,7 @@ public: static void init_type(void) { LinearDistanceForce::init_type(); register_type(_type_handle, "LinearSourceForce", - LinearDistanceForce::get_class_type()); + LinearDistanceForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearUserDefinedForce.cxx b/panda/src/physics/linearUserDefinedForce.cxx index d853fc8b77..f8c97709c6 100644 --- a/panda/src/physics/linearUserDefinedForce.cxx +++ b/panda/src/physics/linearUserDefinedForce.cxx @@ -14,7 +14,7 @@ TypeHandle LinearUserDefinedForce::_type_handle; //////////////////////////////////////////////////////////////////// LinearUserDefinedForce:: LinearUserDefinedForce(LVector3f (*proc)(const PhysicsObject *), - float a, bool md) : + float a, bool md) : LinearForce(a, md), _proc(proc) { diff --git a/panda/src/physics/linearUserDefinedForce.h b/panda/src/physics/linearUserDefinedForce.h index ff3fc7abba..13332d65dc 100644 --- a/panda/src/physics/linearUserDefinedForce.h +++ b/panda/src/physics/linearUserDefinedForce.h @@ -27,8 +27,8 @@ private: PUBLISHED: LinearUserDefinedForce(LVector3f (*proc)(const PhysicsObject *) = NULL, - float a = 1.0f, - bool md = false); + float a = 1.0f, + bool md = false); LinearUserDefinedForce(const LinearUserDefinedForce ©); virtual ~LinearUserDefinedForce(void); @@ -41,7 +41,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearUserDefinedForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/linearVectorForce.h b/panda/src/physics/linearVectorForce.h index 3ac17cafa3..3f1c468f5a 100644 --- a/panda/src/physics/linearVectorForce.h +++ b/panda/src/physics/linearVectorForce.h @@ -24,7 +24,7 @@ PUBLISHED: LinearVectorForce(const LVector3f& vec, float a = 1.0f, bool mass = false); LinearVectorForce(const LinearVectorForce ©); LinearVectorForce(float x = 0.0f, float y = 0.0f, float z = 0.0f, - float a = 1.0f, bool mass = false); + float a = 1.0f, bool mass = false); virtual ~LinearVectorForce(void); INLINE void set_vector(const LVector3f& v); @@ -39,7 +39,7 @@ public: static void init_type(void) { LinearForce::init_type(); register_type(_type_handle, "LinearVectorForce", - LinearForce::get_class_type()); + LinearForce::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/physical.I b/panda/src/physics/physical.I index 69a6376213..bd49b923dd 100644 --- a/panda/src/physics/physical.I +++ b/panda/src/physics/physical.I @@ -13,7 +13,7 @@ INLINE void Physical:: clear_linear_forces(void) { _linear_forces.erase(_linear_forces.begin(), - _linear_forces.end()); + _linear_forces.end()); } //////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ clear_linear_forces(void) { INLINE void Physical:: clear_angular_forces(void) { _angular_forces.erase(_angular_forces.begin(), - _angular_forces.end()); + _angular_forces.end()); } //////////////////////////////////////////////////////////////////// @@ -35,7 +35,7 @@ clear_angular_forces(void) { INLINE void Physical:: clear_physics_objects(void) { _physics_objects.erase(_physics_objects.begin(), - _physics_objects.end()); + _physics_objects.end()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/physics/physical.cxx b/panda/src/physics/physical.cxx index fad8b68cef..68c3cea71a 100644 --- a/panda/src/physics/physical.cxx +++ b/panda/src/physics/physical.cxx @@ -43,8 +43,8 @@ Physical(int ttl_objects, bool pre_alloc) { PhysicsObject *po; for (i = 0; i < ttl_objects; i++) { - po = new PhysicsObject; - add_physics_object(po); + po = new PhysicsObject; + add_physics_object(po); } } } diff --git a/panda/src/physics/physical.h b/panda/src/physics/physical.h index 2cdc41b076..7c98580257 100644 --- a/panda/src/physics/physical.h +++ b/panda/src/physics/physical.h @@ -84,7 +84,7 @@ public: static void init_type(void) { TypedReferenceCount::init_type(); register_type(_type_handle, "Physical", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/physicalNode.I b/panda/src/physics/physicalNode.I index 3b74c5e058..98e04a2810 100644 --- a/panda/src/physics/physicalNode.I +++ b/panda/src/physics/physicalNode.I @@ -19,7 +19,7 @@ clear(void) { INLINE Physical *PhysicalNode:: get_physical(int index) const { nassertr(index >= 0 && index < (int)_physicals.size(), - (Physical *) NULL); + (Physical *) NULL); return _physicals[index]; } diff --git a/panda/src/physics/physicalNode.cxx b/panda/src/physics/physicalNode.cxx index 81dcb2bff9..4a9ca4b3a1 100644 --- a/panda/src/physics/physicalNode.cxx +++ b/panda/src/physics/physicalNode.cxx @@ -69,7 +69,7 @@ add_physicals_from(const PhysicalNode &other) { vector< PT(Physical) >::iterator last = _physicals.end() - 1; _physicals.insert(_physicals.end(), - other._physicals.begin(), other._physicals.end()); + other._physicals.begin(), other._physicals.end()); for (; last != _physicals.end(); last++) (*last)->_physical_node = this; diff --git a/panda/src/physics/physicalNode.h b/panda/src/physics/physicalNode.h index c9f7fb17b8..82d4c0b0fd 100644 --- a/panda/src/physics/physicalNode.h +++ b/panda/src/physics/physicalNode.h @@ -49,7 +49,7 @@ public: static void init_type(void) { NamedNode::init_type(); register_type(_type_handle, "PhysicalNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/physics/physicsObject.h b/panda/src/physics/physicsObject.h index 64b7e1456e..44ce1308dc 100644 --- a/panda/src/physics/physicsObject.h +++ b/panda/src/physics/physicsObject.h @@ -83,7 +83,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "PhysicsObject", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/pnm/bitio.h b/panda/src/pnm/bitio.h index 4137fe2d67..5674c439ed 100644 --- a/panda/src/pnm/bitio.h +++ b/panda/src/pnm/bitio.h @@ -15,8 +15,11 @@ * without express or implied warranty. * * $Log$ - * Revision 1.1 2000/10/04 01:14:42 drose - * Initial revision + * Revision 1.2 2001/05/25 15:59:19 drose + * remove tab characters + * + * Revision 1.1.1.1 2000/10/04 01:14:42 drose + * * * Revision 1.4 1992/11/24 19:37:02 dws * Added copyright @@ -39,7 +42,7 @@ #include "pbmplus.h" -typedef struct bitstream *BITSTREAM; +typedef struct bitstream *BITSTREAM; /* * pm_bitinit() - allocate and return a BITSTREAM for the given FILE*. diff --git a/panda/src/pnm/pbmfont.h b/panda/src/pnm/pbmfont.h index 0ecb0462b0..d3fd311030 100644 --- a/panda/src/pnm/pbmfont.h +++ b/panda/src/pnm/pbmfont.h @@ -2,20 +2,20 @@ */ struct glyph { - int width, height; - int x, y; - int xadd; - char* bmap; + int width, height; + int x, y; + int xadd; + char* bmap; }; struct font { - int maxwidth, maxheight; - int x, y; - struct glyph* glyph[256]; - /* for compatibility with old pbmtext routines */ - /* oldfont is 0 if the font is BDF derived */ - bit** oldfont; - int fcols, frows; + int maxwidth, maxheight; + int x, y; + struct glyph* glyph[256]; + /* for compatibility with old pbmtext routines */ + /* oldfont is 0 if the font is BDF derived */ + bit** oldfont; + int fcols, frows; }; struct font* pbm_defaultfont ARGS(( char* which )); diff --git a/panda/src/pnm/pbmplus.h b/panda/src/pnm/pbmplus.h index 3878893a40..96eb952a26 100644 --- a/panda/src/pnm/pbmplus.h +++ b/panda/src/pnm/pbmplus.h @@ -244,9 +244,9 @@ EXPCL_PANDA int pm_bitstomaxval( int bits ); /* Error handling definitions. */ EXPCL_PANDA void pm_message( char*, ... ); -EXPCL_PANDA void pm_error( char*, ... ); /* doesn't return */ -void pm_perror ARGS(( char* reason )); /* doesn't return */ -void pm_usage ARGS(( char* usage )); /* doesn't return */ +EXPCL_PANDA void pm_error( char*, ... ); /* doesn't return */ +void pm_perror ARGS(( char* reason )); /* doesn't return */ +void pm_usage ARGS(( char* usage )); /* doesn't return */ /* File open/close that handles "-" as stdin and checks errors. */ diff --git a/panda/src/pnm/ppm.h b/panda/src/pnm/ppm.h index 2b8064009f..9a0bce1422 100644 --- a/panda/src/pnm/ppm.h +++ b/panda/src/pnm/ppm.h @@ -95,9 +95,9 @@ extern pixval ppm_pbmmaxval; #define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \ PPM_ASSIGN( (newp), \ - ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ - ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ - ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) ) + ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ + ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ + ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) ) /* Luminance macro. */ diff --git a/panda/src/pnm/rast.h b/panda/src/pnm/rast.h index 85567ffe23..a4f99d681a 100644 --- a/panda/src/pnm/rast.h +++ b/panda/src/pnm/rast.h @@ -27,44 +27,44 @@ #ifndef _RAST_H_ #define _RAST_H_ -#define PIX_ERR -1 +#define PIX_ERR -1 struct rasterfile { long ras_magic; -#define RAS_MAGIC 0x59a66a95 +#define RAS_MAGIC 0x59a66a95 long ras_width; long ras_height; long ras_depth; long ras_length; long ras_type; -#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */ -#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */ -#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */ -#define RT_FORMAT_RGB 3 /* XRGB or RGB instead of XBGR or BGR */ -#define RT_FORMAT_TIFF 4 /* tiff <-> standard rasterfile */ -#define RT_FORMAT_IFF 5 /* iff (TAAC format) <-> standard rasterfile */ -#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */ +#define RT_OLD 0 /* Raw pixrect image in 68000 byte order */ +#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */ +#define RT_BYTE_ENCODED 2 /* Run-length compression of bytes */ +#define RT_FORMAT_RGB 3 /* XRGB or RGB instead of XBGR or BGR */ +#define RT_FORMAT_TIFF 4 /* tiff <-> standard rasterfile */ +#define RT_FORMAT_IFF 5 /* iff (TAAC format) <-> standard rasterfile */ +#define RT_EXPERIMENTAL 0xffff /* Reserved for testing */ long ras_maptype; -#define RMT_NONE 0 -#define RMT_EQUAL_RGB 1 -#define RMT_RAW 2 +#define RMT_NONE 0 +#define RMT_EQUAL_RGB 1 +#define RMT_RAW 2 long ras_maplength; }; struct pixrectops { - int (*pro_rop)(); - int (*pro_stencil)(); - int (*pro_batchrop)(); - int (*pro_nop)(); - int (*pro_destroy)(); - int (*pro_get)(); - int (*pro_put)(); - int (*pro_vector)(); + int (*pro_rop)(); + int (*pro_stencil)(); + int (*pro_batchrop)(); + int (*pro_nop)(); + int (*pro_destroy)(); + int (*pro_get)(); + int (*pro_put)(); + int (*pro_vector)(); struct pixrect* (*pro_region)(); - int (*pro_putcolormap)(); - int (*pro_getcolormap)(); - int (*pro_putattributes)(); - int (*pro_getattributes)(); + int (*pro_putcolormap)(); + int (*pro_getcolormap)(); + int (*pro_putattributes)(); + int (*pro_getattributes)(); }; struct pr_size { @@ -78,12 +78,12 @@ struct pixrect { struct pixrectops* pr_ops; struct pr_size pr_size; int pr_depth; - struct mpr_data* pr_data; /* work-alike only handles memory pixrects */ + struct mpr_data* pr_data; /* work-alike only handles memory pixrects */ }; struct mpr_data { int md_linebytes; - unsigned char* md_image; /* note, byte not short -- avoid pr_flip() */ + unsigned char* md_image; /* note, byte not short -- avoid pr_flip() */ struct pr_pos md_offset; short md_primary; short md_flags; diff --git a/panda/src/pnmimage/pnm-image-filter-core.cxx b/panda/src/pnmimage/pnm-image-filter-core.cxx index 96fe642d96..407061a7e3 100644 --- a/panda/src/pnmimage/pnm-image-filter-core.cxx +++ b/panda/src/pnmimage/pnm-image-filter-core.cxx @@ -10,7 +10,7 @@ static void FUNCTION_NAME(PNMImage &dest, const PNMImage &source, - double width, FilterFunction *make_filter) { + double width, FilterFunction *make_filter) { if (!dest.is_valid() || !source.is_valid()) { return; } @@ -45,9 +45,9 @@ FUNCTION_NAME(PNMImage &dest, const PNMImage &source, } filter_row(temp_dest, dest.ASIZE(), - temp_source, source.ASIZE(), - scale, - filter, filter_width); + temp_source, source.ASIZE(), + scale, + filter, filter_width); for (a=0; a1.0), we need to look at a fractional // granularity. Hence, we scale our filter index by scale. If we are // compressing (scale<1.0), we don't need to fiddle with the filter index, so @@ -164,11 +164,11 @@ filter_row(StoreType dest[], int dest_len, // corresponding to values in the range -filter_width to filter_width. typedef void FilterFunction(double scale, double width, - WorkType *&filter, double &filter_width); + WorkType *&filter, double &filter_width); static void box_filter_impl(double scale, double width, - WorkType *&filter, double &filter_width) { + WorkType *&filter, double &filter_width) { double fscale; if (scale < 1.0) { // If we are compressing the image, we want to expand the range of @@ -194,7 +194,7 @@ box_filter_impl(double scale, double width, static void gaussian_filter_impl(double scale, double width, - WorkType *&filter, double &filter_width) { + WorkType *&filter, double &filter_width) { double fscale; if (scale < 1.0) { // If we are compressing the image, we want to expand the range of @@ -383,7 +383,7 @@ gaussian_filter_impl(double scale, double width, // another. Both images can be the same with no ill effects. static void filter_image(PNMImage &dest, const PNMImage &source, - double width, FilterFunction *make_filter) { + double width, FilterFunction *make_filter) { // We want to scale by the smallest destination axis first, for a // slight performance gain. @@ -453,9 +453,9 @@ gaussian_filter_from(double width, const PNMImage ©) { INLINE void box_filter_xel(const PNMImage &image, - int x, int y, double x_contrib, double y_contrib, - double &red, double &grn, double &blu, double &alpha, - double &pixel_count) { + int x, int y, double x_contrib, double y_contrib, + double &red, double &grn, double &blu, double &alpha, + double &pixel_count) { double contrib = x_contrib * y_contrib; red += image.get_red_val(x, y) * contrib; grn += image.get_green_val(x, y) * contrib; @@ -470,13 +470,13 @@ box_filter_xel(const PNMImage &image, INLINE void box_filter_line(const PNMImage &image, - double x0, int y, double x1, double y_contrib, - double &red, double &grn, double &blu, double &alpha, - double &pixel_count) { + double x0, int y, double x1, double y_contrib, + double &red, double &grn, double &blu, double &alpha, + double &pixel_count) { int x = (int)floor(x0); // Get the first (partial) xel box_filter_xel(image, x, y, (double)(x+1)-x0, y_contrib, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); int x_last = (int)floor(x1); if (x < x_last) { @@ -484,7 +484,7 @@ box_filter_line(const PNMImage &image, while (x < x_last) { // Get each consecutive (complete) xel box_filter_xel(image, x, y, 1.0, y_contrib, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); x++; } @@ -492,22 +492,22 @@ box_filter_line(const PNMImage &image, double x_contrib = x1 - (double)x_last; if (x_contrib > 0.0001) { box_filter_xel(image, x, y, x_contrib, y_contrib, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); } } } static void box_filter_region(const PNMImage &image, - double x0, double y0, double x1, double y1, - xel &result, xelval &alpha_result) { + double x0, double y0, double x1, double y1, + xel &result, xelval &alpha_result) { double red = 0.0, grn = 0.0, blu = 0.0, alpha = 0.0; double pixel_count = 0.0; int y = (int)floor(y0); // Get the first (partial) row box_filter_line(image, x0, y, x1, (double)(y+1)-y0, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); int y_last = (int)floor(y1); if (y < y_last) { @@ -515,7 +515,7 @@ box_filter_region(const PNMImage &image, while (y < y_last) { // Get each consecutive (complete) row box_filter_line(image, x0, y, x1, 1.0, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); y++; } @@ -523,14 +523,14 @@ box_filter_region(const PNMImage &image, double y_contrib = y1 - (double)y_last; if (y_contrib > 0.0001) { box_filter_line(image, x0, y, x1, y_contrib, - red, grn, blu, alpha, pixel_count); + red, grn, blu, alpha, pixel_count); } } PPM_ASSIGN(result, - (xelval)(red / pixel_count), - (xelval)(grn / pixel_count), - (xelval)(blu / pixel_count)); + (xelval)(red / pixel_count), + (xelval)(grn / pixel_count), + (xelval)(blu / pixel_count)); alpha_result = (xelval)(alpha / pixel_count); } @@ -572,19 +572,19 @@ quick_filter_from(const PNMImage &from, int xborder, int yborder) { from_x0 = max(0, -to_xoff) * x_scale; for (to_x = max(0, -to_xoff); - to_x < min(to_xs, get_x_size()-to_xoff); - to_x++) { + to_x < min(to_xs, get_x_size()-to_xoff); + to_x++) { from_x1 = (to_x+1) * x_scale; // Now the box from (from_x0, from_y0) - (from_x1, from_y1) // but not including (from_x1, from_y1) maps to the pixel (to_x, to_y). xelval alpha_result; box_filter_region(from, - from_x0, from_y0, from_x1, from_y1, - (*this)[to_yoff + to_y][to_xoff + to_x], - alpha_result); + from_x0, from_y0, from_x1, from_y1, + (*this)[to_yoff + to_y][to_xoff + to_x], + alpha_result); if (has_alpha()) { - set_alpha_val(to_xoff+to_x, to_yoff+to_y, alpha_result); + set_alpha_val(to_xoff+to_x, to_yoff+to_y, alpha_result); } from_x0 = from_x1; diff --git a/panda/src/pnmimage/pnmFileType.h b/panda/src/pnmimage/pnmFileType.h index 9566020808..937b472bc9 100644 --- a/panda/src/pnmimage/pnmFileType.h +++ b/panda/src/pnmimage/pnmFileType.h @@ -17,7 +17,7 @@ class PNMReader; class PNMWriter; //////////////////////////////////////////////////////////////////// -// Class : PNMFileType +// Class : PNMFileType // Description : This is the base class of a family of classes that // represent particular image file types that PNMImage // supports. @@ -39,7 +39,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); protected: diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.cxx b/panda/src/pnmimage/pnmFileTypeRegistry.cxx index 2b434d15b5..e30b40d0cf 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.cxx +++ b/panda/src/pnmimage/pnmFileTypeRegistry.cxx @@ -135,7 +135,7 @@ get_type_from_magic_number(const string &magic_number) const { for (ti = _types.begin(); ti != _types.end(); ++ti) { PNMFileType *type = (*ti); if (type->has_magic_number() && - type->matches_magic_number(magic_number)) { + type->matches_magic_number(magic_number)) { return type; } } @@ -182,12 +182,12 @@ write_types(ostream &out, int indent_level) const { int num_extensions = type->get_num_extensions(); if (num_extensions == 1) { - out << "." << type->get_extension(0); + out << "." << type->get_extension(0); } else if (num_extensions > 1) { - out << "." << type->get_extension(0); - for (int i = 1; i < num_extensions; i++) { - out << ", ." << type->get_extension(i); - } + out << "." << type->get_extension(0); + for (int i = 1; i < num_extensions; i++) { + out << ", ." << type->get_extension(i); + } } out << "\n"; } @@ -221,9 +221,9 @@ register_type(PNMFileType *type) { if (!unique_extensions.insert(extension).second) { pnmimage_cat.warning() - << "PNMFileType " << type->get_name() - << " (" << type->get_type() << ") defined extension " - << extension << " more than once.\n"; + << "PNMFileType " << type->get_name() + << " (" << type->get_type() << ") defined extension " + << extension << " more than once.\n"; } } diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.h b/panda/src/pnmimage/pnmFileTypeRegistry.h index b45cd76f9b..1ce1cbfc4f 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.h +++ b/panda/src/pnmimage/pnmFileTypeRegistry.h @@ -13,7 +13,7 @@ class PNMFileType; //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeRegistry +// Class : PNMFileTypeRegistry // Description : This class maintains the set of all known // PNMFileTypes in the universe. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimage/pnmImage.I b/panda/src/pnmimage/pnmImage.I index 9280e0487c..0d57c37479 100644 --- a/panda/src/pnmimage/pnmImage.I +++ b/panda/src/pnmimage/pnmImage.I @@ -34,7 +34,7 @@ PNMImage(const Filename &filename, PNMFileType *type) { //////////////////////////////////////////////////////////////////// INLINE PNMImage:: PNMImage(int x_size, int y_size, int num_channels, xelval maxval, - PNMFileType *type) { + PNMFileType *type) { _array = NULL; _alpha = NULL; @@ -119,8 +119,8 @@ from_val(xelval input_value) const { INLINE void PNMImage:: fill(double red, double green, double blue) { fill_val((xelval)(red * get_maxval()), - (xelval)(green * get_maxval()), - (xelval)(blue * get_maxval())); + (xelval)(green * get_maxval()), + (xelval)(blue * get_maxval())); } //////////////////////////////////////////////////////////////////// @@ -407,8 +407,8 @@ set_alpha_val(int x, int y, xelval a) { INLINE RGBColord PNMImage:: get_xel(int x, int y) const { return RGBColord(from_val(get_red_val(x, y)), - from_val(get_green_val(x, y)), - from_val(get_blue_val(x, y))); + from_val(get_green_val(x, y)), + from_val(get_blue_val(x, y))); } //////////////////////////////////////////////////////////////////// @@ -631,8 +631,8 @@ get_bright(int x, int y) const { INLINE double PNMImage:: get_bright(int x, int y, double rc, double gc, double bc) const { return from_val(rc * get_red_val(x, y) + - gc * get_green_val(x, y) + - bc * get_blue_val(x, y)); + gc * get_green_val(x, y) + + bc * get_blue_val(x, y)); } //////////////////////////////////////////////////////////////////// @@ -646,9 +646,9 @@ get_bright(int x, int y, double rc, double gc, double bc) const { INLINE double PNMImage:: get_bright(int x, int y, double rc, double gc, double bc, double ac) const { return from_val(rc * get_red_val(x, y) + - gc * get_green_val(x, y) + - bc * get_blue_val(x, y) + - ac * get_alpha_val(x, y)); + gc * get_green_val(x, y) + + bc * get_blue_val(x, y) + + ac * get_alpha_val(x, y)); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index 4757ccb47e..3f1b809e13 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -120,7 +120,7 @@ fill_val(xelval red, xelval green, xelval blue) { if (is_valid()) { for (int y = 0; y < get_y_size(); y++) { for (int x = 0; x < get_x_size(); x++) { - set_xel_val(x, y, red, green, blue); + set_xel_val(x, y, red, green, blue); } } } @@ -140,7 +140,7 @@ alpha_fill_val(xelval alpha) { for (int y = 0; y < get_y_size(); y++) { for (int x = 0; x < get_x_size(); x++) { - set_alpha_val(x, y, alpha); + set_alpha_val(x, y, alpha); } } } @@ -278,7 +278,7 @@ set_color_type(PNMImage::ColorType color_type) { // convert to grayscale from color for (int y = 0; y < get_y_size(); y++) { for (int x = 0; x < get_x_size(); x++) { - set_gray(x, y, get_bright(x, y)); + set_gray(x, y, get_bright(x, y)); } } @@ -286,7 +286,7 @@ set_color_type(PNMImage::ColorType color_type) { // convert to color from grayscale for (int y = 0; y < get_y_size(); y++) { for (int x = 0; xget_name() << ".\n"; + pnmimage_cat.debug() + << "By magic number, image file appears to be type " + << type->get_name() << ".\n"; } else { - pnmimage_cat.debug() - << "Unable to determine image file type from magic number.\n"; + pnmimage_cat.debug() + << "Unable to determine image file type from magic number.\n"; } } } @@ -156,12 +156,12 @@ make_reader(FILE *file, bool owns_file, const Filename &filename, if (pnmimage_cat.is_debug()) { if (type != (PNMFileType *)NULL) { - pnmimage_cat.debug() - << "From its extension, image file is probably type " - << type->get_name() << ".\n"; + pnmimage_cat.debug() + << "From its extension, image file is probably type " + << type->get_name() << ".\n"; } else { - pnmimage_cat.debug() - << "Unable to guess image file type from its extension.\n"; + pnmimage_cat.debug() + << "Unable to guess image file type from its extension.\n"; } } } @@ -172,7 +172,7 @@ make_reader(FILE *file, bool owns_file, const Filename &filename, if (pnmimage_cat.is_debug() && type != (PNMFileType *)NULL) { pnmimage_cat.debug() - << "Assuming image file type is " << type->get_name() << ".\n"; + << "Assuming image file type is " << type->get_name() << ".\n"; } } @@ -180,10 +180,10 @@ make_reader(FILE *file, bool owns_file, const Filename &filename, // We can't figure out what type the file is; give up. if (pnmimage_cat.is_error()) { pnmimage_cat.error() - << "Cannot determine type of image file " << filename << ".\n" - << "Currently supported image types:\n"; + << "Cannot determine type of image file " << filename << ".\n" + << "Currently supported image types:\n"; PNMFileTypeRegistry::get_ptr()-> - write_types(pnmimage_cat.error(false), 2); + write_types(pnmimage_cat.error(false), 2); } if (owns_file) { pm_close(file); @@ -233,7 +233,7 @@ make_writer(const Filename &filename, PNMFileType *type) const { if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() - << "(writing to standard output)\n"; + << "(writing to standard output)\n"; } } else { @@ -244,7 +244,7 @@ make_writer(const Filename &filename, PNMFileType *type) const { if (file == (FILE *)NULL) { if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() - << "Unable to write to file.\n"; + << "Unable to write to file.\n"; } return NULL; } @@ -278,7 +278,7 @@ make_writer(const Filename &filename, PNMFileType *type) const { //////////////////////////////////////////////////////////////////// PNMWriter *PNMImageHeader:: make_writer(FILE *file, bool owns_file, const Filename &filename, - PNMFileType *type) const { + PNMFileType *type) const { if (type == (PNMFileType *)NULL && !filename.empty()) { // We don't know the type; attempt to guess it from the filename // extension. @@ -286,12 +286,12 @@ make_writer(FILE *file, bool owns_file, const Filename &filename, if (pnmimage_cat.is_debug()) { if (type != (PNMFileType *)NULL) { - pnmimage_cat.debug() - << "From its extension, image file is intended to be type " - << type->get_name() << ".\n"; + pnmimage_cat.debug() + << "From its extension, image file is intended to be type " + << type->get_name() << ".\n"; } else { - pnmimage_cat.debug() - << "Unable to guess image file type from its extension.\n"; + pnmimage_cat.debug() + << "Unable to guess image file type from its extension.\n"; } } } @@ -302,7 +302,7 @@ make_writer(FILE *file, bool owns_file, const Filename &filename, if (pnmimage_cat.is_debug() && type != (PNMFileType *)NULL) { pnmimage_cat.debug() - << "Assuming image file type is " << type->get_name() << ".\n"; + << "Assuming image file type is " << type->get_name() << ".\n"; } } @@ -310,7 +310,7 @@ make_writer(FILE *file, bool owns_file, const Filename &filename, // We can't figure out what type the file is; give up. if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() - << "Cannot determine type of image file " << filename << ".\n"; + << "Cannot determine type of image file " << filename << ".\n"; } if (owns_file) { pm_close(file); diff --git a/panda/src/pnmimage/pnmImageHeader.h b/panda/src/pnmimage/pnmImageHeader.h index 3b65458bb1..bf03d7f21f 100644 --- a/panda/src/pnmimage/pnmImageHeader.h +++ b/panda/src/pnmimage/pnmImageHeader.h @@ -18,7 +18,7 @@ class PNMReader; class PNMWriter; //////////////////////////////////////////////////////////////////// -// Class : PNMImageHeader +// Class : PNMImageHeader // Description : This is the base class of PNMImage, PNMReader, and // PNMWriter. It encapsulates all the information // associated with an image that describes its size, @@ -66,20 +66,20 @@ public: bool read_header(const Filename &filename, PNMFileType *type = NULL); PNMReader *make_reader(const Filename &filename, - PNMFileType *type = NULL) const; + PNMFileType *type = NULL) const; PNMReader *make_reader(FILE *file, bool owns_file = true, - const Filename &filename = Filename(), - string magic_number = string(), - PNMFileType *type = NULL) const; + const Filename &filename = Filename(), + string magic_number = string(), + PNMFileType *type = NULL) const; PNMWriter *make_writer(const Filename &filename, - PNMFileType *type = NULL) const; + PNMFileType *type = NULL) const; PNMWriter *make_writer(FILE *file, bool owns_file = true, - const Filename &filename = Filename(), - PNMFileType *type = NULL) const; + const Filename &filename = Filename(), + PNMFileType *type = NULL) const; static bool read_magic_number(FILE *file, string &magic_number, - int num_bytes); + int num_bytes); void output(ostream &out) const; diff --git a/panda/src/pnmimage/pnmReader.h b/panda/src/pnmimage/pnmReader.h index 69d5e30263..60882c4ef9 100644 --- a/panda/src/pnmimage/pnmReader.h +++ b/panda/src/pnmimage/pnmReader.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : PNMReader +// Class : PNMReader // Description : This is an abstract base class that defines the // interface for reading image files of various types. // Any particular image file type that can be read must diff --git a/panda/src/pnmimage/pnmReaderTypes.h b/panda/src/pnmimage/pnmReaderTypes.h index 241bcb53c9..2c94db05ab 100644 --- a/panda/src/pnmimage/pnmReaderTypes.h +++ b/panda/src/pnmimage/pnmReaderTypes.h @@ -141,7 +141,7 @@ public: return false; } - unsigned long pos; + unsigned long pos; unsigned long offBits; @@ -149,9 +149,9 @@ public: int indexed; int classv; - pixval R[256]; /* reds */ - pixval G[256]; /* greens */ - pixval B[256]; /* blues */ + pixval R[256]; /* reds */ + pixval G[256]; /* greens */ + pixval B[256]; /* blues */ }; #endif diff --git a/panda/src/pnmimage/pnmWriter.h b/panda/src/pnmimage/pnmWriter.h index 930d04891a..de3ca68d0a 100644 --- a/panda/src/pnmimage/pnmWriter.h +++ b/panda/src/pnmimage/pnmWriter.h @@ -11,7 +11,7 @@ #include "pnmImageHeader.h" //////////////////////////////////////////////////////////////////// -// Class : PNMWriter +// Class : PNMWriter // Description : This is an abstract base class that defines the // interface for writing image files of various types. // Any particular image file type that can be written diff --git a/panda/src/pnmimagetypes/bmp.h b/panda/src/pnmimagetypes/bmp.h index 53bc3e13b8..80c03b1a63 100644 --- a/panda/src/pnmimagetypes/bmp.h +++ b/panda/src/pnmimagetypes/bmp.h @@ -18,8 +18,11 @@ * without express or implied warranty. * * $Log$ - * Revision 1.1 2000/10/04 01:14:42 drose - * Initial revision + * Revision 1.2 2001/05/25 15:59:19 drose + * remove tab characters + * + * Revision 1.1.1.1 2000/10/04 01:14:42 drose + * * * Revision 1.3 1992/11/24 19:39:56 dws * Added copyright. @@ -37,7 +40,7 @@ #include -#include "pbmplus.h" +#include "pbmplus.h" /* prototypes */ static unsigned long BMPlenfileheader(int classv); @@ -51,69 +54,69 @@ static unsigned long BMPoffbits(int classv, unsigned long bitcount); * Classves of BMP files */ -#define C_WIN 1 -#define C_OS2 2 +#define C_WIN 1 +#define C_OS2 2 static char er_internal[] = "%s: internal error!"; static unsigned long BMPlenfileheader(int classv) { - switch (classv) - { - case C_WIN: - return 14; - case C_OS2: - return 14; - default: - pm_error(er_internal, "BMPlenfileheader"); - return 0; - } + switch (classv) + { + case C_WIN: + return 14; + case C_OS2: + return 14; + default: + pm_error(er_internal, "BMPlenfileheader"); + return 0; + } } static unsigned long BMPleninfoheader(int classv) { - switch (classv) - { - case C_WIN: - return 40; - case C_OS2: - return 12; - default: - pm_error(er_internal, "BMPleninfoheader"); - return 0; - } + switch (classv) + { + case C_WIN: + return 40; + case C_OS2: + return 12; + default: + pm_error(er_internal, "BMPleninfoheader"); + return 0; + } } static unsigned long BMPlenrgbtable(int classv, unsigned long bitcount) { - unsigned long lenrgb; + unsigned long lenrgb; - if (bitcount > 8) { - return 0; - } + if (bitcount > 8) { + return 0; + } - if (bitcount < 1) - { - pm_error(er_internal, "BMPlenrgbtable"); - return 0; - } - switch (classv) - { - case C_WIN: - lenrgb = 4; - break; - case C_OS2: - lenrgb = 3; - break; - default: - pm_error(er_internal, "BMPlenrgbtable"); - return 0; - } + if (bitcount < 1) + { + pm_error(er_internal, "BMPlenrgbtable"); + return 0; + } + switch (classv) + { + case C_WIN: + lenrgb = 4; + break; + case C_OS2: + lenrgb = 3; + break; + default: + pm_error(er_internal, "BMPlenrgbtable"); + return 0; + } - return (1 << bitcount) * lenrgb; + return (1 << bitcount) * lenrgb; } /* @@ -126,72 +129,72 @@ BMPlenrgbtable(int classv, unsigned long bitcount) static unsigned long BMPlenline(int classv, unsigned long bitcount, unsigned long x) { - unsigned long bitsperline; + unsigned long bitsperline; - switch (classv) - { - case C_WIN: - break; - case C_OS2: - break; - default: - pm_error(er_internal, "BMPlenline"); - return 0; - } + switch (classv) + { + case C_WIN: + break; + case C_OS2: + break; + default: + pm_error(er_internal, "BMPlenline"); + return 0; + } - bitsperline = x * bitcount; + bitsperline = x * bitcount; - /* - * if bitsperline is not a multiple of 32, then round - * bitsperline up to the next multiple of 32. - */ - if ((bitsperline % 32) != 0) - { - bitsperline += (32 - (bitsperline % 32)); - } + /* + * if bitsperline is not a multiple of 32, then round + * bitsperline up to the next multiple of 32. + */ + if ((bitsperline % 32) != 0) + { + bitsperline += (32 - (bitsperline % 32)); + } - if ((bitsperline % 32) != 0) - { - pm_error(er_internal, "BMPlenline"); - return 0; - } + if ((bitsperline % 32) != 0) + { + pm_error(er_internal, "BMPlenline"); + return 0; + } - /* number of bytes per line == bitsperline/8 */ - return bitsperline >> 3; + /* number of bytes per line == bitsperline/8 */ + return bitsperline >> 3; } /* return the number of bytes used to store the image bits */ static unsigned long BMPlenbits( - int classv, - unsigned long bitcount, - unsigned long x, - unsigned long y) + int classv, + unsigned long bitcount, + unsigned long x, + unsigned long y) { - return y * BMPlenline(classv, bitcount, x); + return y * BMPlenline(classv, bitcount, x); } /* return the offset to the BMP image bits */ static unsigned long BMPoffbits( - int classv, - unsigned long bitcount) + int classv, + unsigned long bitcount) { - return BMPlenfileheader(classv) - + BMPleninfoheader(classv) - + BMPlenrgbtable(classv, bitcount); + return BMPlenfileheader(classv) + + BMPleninfoheader(classv) + + BMPlenrgbtable(classv, bitcount); } /* return the size of the BMP file in bytes */ static unsigned long BMPlenfile( - int classv, - unsigned long bitcount, - unsigned long x, - unsigned long y) + int classv, + unsigned long bitcount, + unsigned long x, + unsigned long y) { - return BMPoffbits(classv, bitcount) - + BMPlenbits(classv, bitcount, x, y); + return BMPoffbits(classv, bitcount) + + BMPlenbits(classv, bitcount, x, y); } #endif /* _BMP_H_ */ diff --git a/panda/src/pnmimagetypes/color.h b/panda/src/pnmimagetypes/color.h index e69f956754..5677bf9f21 100644 --- a/panda/src/pnmimagetypes/color.h +++ b/panda/src/pnmimagetypes/color.h @@ -13,129 +13,129 @@ * three single byte mantissas and a common exponent. */ -#define RED 0 -#define GRN 1 -#define BLU 2 -#define EXP 3 -#define COLXS 128 /* excess used for exponent */ +#define RED 0 +#define GRN 1 +#define BLU 2 +#define EXP 3 +#define COLXS 128 /* excess used for exponent */ -typedef unsigned char BYTE; /* 8-bit unsigned integer */ +typedef unsigned char BYTE; /* 8-bit unsigned integer */ -typedef BYTE COLR[4]; /* red, green, blue, exponent */ +typedef BYTE COLR[4]; /* red, green, blue, exponent */ -#define copycolr(c1,c2) (c1[0]=c2[0],c1[1]=c2[1], \ - c1[2]=c2[2],c1[3]=c2[3]) +#define copycolr(c1,c2) (c1[0]=c2[0],c1[1]=c2[1], \ + c1[2]=c2[2],c1[3]=c2[3]) -typedef float COLOR[3]; /* red, green, blue */ +typedef float COLOR[3]; /* red, green, blue */ -#define colval(col,pri) ((col)[pri]) +#define colval(col,pri) ((col)[pri]) -#define setcolor(col,r,g,b) ((col)[RED]=(r),(col)[GRN]=(g),(col)[BLU]=(b)) +#define setcolor(col,r,g,b) ((col)[RED]=(r),(col)[GRN]=(g),(col)[BLU]=(b)) -#define copycolor(c1,c2) ((c1)[0]=(c2)[0],(c1)[1]=(c2)[1],(c1)[2]=(c2)[2]) +#define copycolor(c1,c2) ((c1)[0]=(c2)[0],(c1)[1]=(c2)[1],(c1)[2]=(c2)[2]) -#define scalecolor(col,sf) ((col)[0]*=(sf),(col)[1]*=(sf),(col)[2]*=(sf)) +#define scalecolor(col,sf) ((col)[0]*=(sf),(col)[1]*=(sf),(col)[2]*=(sf)) -#define addcolor(c1,c2) ((c1)[0]+=(c2)[0],(c1)[1]+=(c2)[1],(c1)[2]+=(c2)[2]) +#define addcolor(c1,c2) ((c1)[0]+=(c2)[0],(c1)[1]+=(c2)[1],(c1)[2]+=(c2)[2]) -#define multcolor(c1,c2) ((c1)[0]*=(c2)[0],(c1)[1]*=(c2)[1],(c1)[2]*=(c2)[2]) +#define multcolor(c1,c2) ((c1)[0]*=(c2)[0],(c1)[1]*=(c2)[1],(c1)[2]*=(c2)[2]) #ifdef NTSC -#define CIE_x_r 0.670 /* standard NTSC primaries */ -#define CIE_y_r 0.330 -#define CIE_x_g 0.210 -#define CIE_y_g 0.710 -#define CIE_x_b 0.140 -#define CIE_y_b 0.080 -#define CIE_x_w 0.3333 /* use true white */ -#define CIE_y_w 0.3333 +#define CIE_x_r 0.670 /* standard NTSC primaries */ +#define CIE_y_r 0.330 +#define CIE_x_g 0.210 +#define CIE_y_g 0.710 +#define CIE_x_b 0.140 +#define CIE_y_b 0.080 +#define CIE_x_w 0.3333 /* use true white */ +#define CIE_y_w 0.3333 #else -#define CIE_x_r 0.640 /* nominal CRT primaries */ -#define CIE_y_r 0.330 -#define CIE_x_g 0.290 -#define CIE_y_g 0.600 -#define CIE_x_b 0.150 -#define CIE_y_b 0.060 -#define CIE_x_w 0.3333 /* use true white */ -#define CIE_y_w 0.3333 +#define CIE_x_r 0.640 /* nominal CRT primaries */ +#define CIE_y_r 0.330 +#define CIE_x_g 0.290 +#define CIE_y_g 0.600 +#define CIE_x_b 0.150 +#define CIE_y_b 0.060 +#define CIE_x_w 0.3333 /* use true white */ +#define CIE_y_w 0.3333 #endif -#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \ - CIE_x_g*(CIE_y_b - CIE_y_r) + \ - CIE_x_b*(CIE_y_r - CIE_y_g) ) -#define CIE_C_rD ( (1./CIE_y_w) * \ - ( CIE_x_w*(CIE_y_g - CIE_y_b) - \ - CIE_y_w*(CIE_x_g - CIE_x_b) + \ - CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g ) ) -#define CIE_C_gD ( (1./CIE_y_w) * \ - ( CIE_x_w*(CIE_y_b - CIE_y_r) - \ - CIE_y_w*(CIE_x_b - CIE_x_r) - \ - CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r ) ) -#define CIE_C_bD ( (1./CIE_y_w) * \ - ( CIE_x_w*(CIE_y_r - CIE_y_g) - \ - CIE_y_w*(CIE_x_r - CIE_x_g) + \ - CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r ) ) +#define CIE_D ( CIE_x_r*(CIE_y_g - CIE_y_b) + \ + CIE_x_g*(CIE_y_b - CIE_y_r) + \ + CIE_x_b*(CIE_y_r - CIE_y_g) ) +#define CIE_C_rD ( (1./CIE_y_w) * \ + ( CIE_x_w*(CIE_y_g - CIE_y_b) - \ + CIE_y_w*(CIE_x_g - CIE_x_b) + \ + CIE_x_g*CIE_y_b - CIE_x_b*CIE_y_g ) ) +#define CIE_C_gD ( (1./CIE_y_w) * \ + ( CIE_x_w*(CIE_y_b - CIE_y_r) - \ + CIE_y_w*(CIE_x_b - CIE_x_r) - \ + CIE_x_r*CIE_y_b + CIE_x_b*CIE_y_r ) ) +#define CIE_C_bD ( (1./CIE_y_w) * \ + ( CIE_x_w*(CIE_y_r - CIE_y_g) - \ + CIE_y_w*(CIE_x_r - CIE_x_g) + \ + CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r ) ) -#define CIE_rf (CIE_y_r*CIE_C_rD/CIE_D) -#define CIE_gf (CIE_y_g*CIE_C_gD/CIE_D) -#define CIE_bf (CIE_y_b*CIE_C_bD/CIE_D) +#define CIE_rf (CIE_y_r*CIE_C_rD/CIE_D) +#define CIE_gf (CIE_y_g*CIE_C_gD/CIE_D) +#define CIE_bf (CIE_y_b*CIE_C_bD/CIE_D) /* As of 9-94, CIE_rf=.265074126, CIE_gf=.670114631 and CIE_bf=.064811243 */ -#define bright(col) (CIE_rf*(col)[RED]+CIE_gf*(col)[GRN]+CIE_bf*(col)[BLU]) -#define normbright(c) ( ( (long)(CIE_rf*256.+.5)*(c)[RED] + \ - (long)(CIE_gf*256.+.5)*(c)[GRN] + \ - (long)(CIE_bf*256.+.5)*(c)[BLU] ) >> 8 ) +#define bright(col) (CIE_rf*(col)[RED]+CIE_gf*(col)[GRN]+CIE_bf*(col)[BLU]) +#define normbright(c) ( ( (long)(CIE_rf*256.+.5)*(c)[RED] + \ + (long)(CIE_gf*256.+.5)*(c)[GRN] + \ + (long)(CIE_bf*256.+.5)*(c)[BLU] ) >> 8 ) - /* luminous efficacies over visible spectrum */ -#define MAXEFFICACY 683. /* defined maximum at 550 nm */ -#define WHTEFFICACY 179. /* uniform white light */ -#define D65EFFICACY 203. /* standard illuminant D65 */ -#define INCEFFICACY 160. /* illuminant A (incand.) */ -#define SUNEFFICACY 208. /* illuminant B (solar dir.) */ -#define SKYEFFICACY D65EFFICACY /* skylight */ -#define DAYEFFICACY D65EFFICACY /* combined sky and solar */ + /* luminous efficacies over visible spectrum */ +#define MAXEFFICACY 683. /* defined maximum at 550 nm */ +#define WHTEFFICACY 179. /* uniform white light */ +#define D65EFFICACY 203. /* standard illuminant D65 */ +#define INCEFFICACY 160. /* illuminant A (incand.) */ +#define SUNEFFICACY 208. /* illuminant B (solar dir.) */ +#define SKYEFFICACY D65EFFICACY /* skylight */ +#define DAYEFFICACY D65EFFICACY /* combined sky and solar */ -#define luminance(col) (WHTEFFICACY * bright(col)) +#define luminance(col) (WHTEFFICACY * bright(col)) -#define intens(col) ( (col)[0] > (col)[1] \ - ? (col)[0] > (col)[2] ? (col)[0] : (col)[2] \ - : (col)[1] > (col)[2] ? (col)[1] : (col)[2] ) +#define intens(col) ( (col)[0] > (col)[1] \ + ? (col)[0] > (col)[2] ? (col)[0] : (col)[2] \ + : (col)[1] > (col)[2] ? (col)[1] : (col)[2] ) -#define colrval(c,p) ( (c)[EXP] ? \ - ldexp((c)[p]+.5,(int)(c)[EXP]-(COLXS+8)) : \ - 0. ) +#define colrval(c,p) ( (c)[EXP] ? \ + ldexp((c)[p]+.5,(int)(c)[EXP]-(COLXS+8)) : \ + 0. ) -#define WHTCOLOR {1.0,1.0,1.0} -#define BLKCOLOR {0.0,0.0,0.0} -#define WHTCOLR {128,128,128,COLXS+1} -#define BLKCOLR {0,0,0,0} +#define WHTCOLOR {1.0,1.0,1.0} +#define BLKCOLOR {0.0,0.0,0.0} +#define WHTCOLR {128,128,128,COLXS+1} +#define BLKCOLR {0,0,0,0} - /* picture format identifier */ -#define COLRFMT "32-bit_rle_rgbe" + /* picture format identifier */ +#define COLRFMT "32-bit_rle_rgbe" - /* macros for exposures */ -#define EXPOSSTR "EXPOSURE=" -#define LEXPOSSTR 9 -#define isexpos(hl) (!strncmp(hl,EXPOSSTR,LEXPOSSTR)) -#define exposval(hl) atof((hl)+LEXPOSSTR) -#define fputexpos(ex,fp) fprintf(fp,"%s%e\n",EXPOSSTR,ex) + /* macros for exposures */ +#define EXPOSSTR "EXPOSURE=" +#define LEXPOSSTR 9 +#define isexpos(hl) (!strncmp(hl,EXPOSSTR,LEXPOSSTR)) +#define exposval(hl) atof((hl)+LEXPOSSTR) +#define fputexpos(ex,fp) fprintf(fp,"%s%e\n",EXPOSSTR,ex) - /* macros for pixel aspect ratios */ -#define ASPECTSTR "PIXASPECT=" -#define LASPECTSTR 10 -#define isaspect(hl) (!strncmp(hl,ASPECTSTR,LASPECTSTR)) -#define aspectval(hl) atof((hl)+LASPECTSTR) -#define fputaspect(pa,fp) fprintf(fp,"%s%f\n",ASPECTSTR,pa) + /* macros for pixel aspect ratios */ +#define ASPECTSTR "PIXASPECT=" +#define LASPECTSTR 10 +#define isaspect(hl) (!strncmp(hl,ASPECTSTR,LASPECTSTR)) +#define aspectval(hl) atof((hl)+LASPECTSTR) +#define fputaspect(pa,fp) fprintf(fp,"%s%f\n",ASPECTSTR,pa) - /* macros for color correction */ -#define COLCORSTR "COLORCORR=" -#define LCOLCORSTR 10 -#define iscolcor(hl) (!strncmp(hl,COLCORSTR,LCOLCORSTR)) -#define colcorval(cc,hl) sscanf(hl+LCOLCORSTR,"%f %f %f", \ - &(cc)[RED],&(cc)[GRN],&(cc)[BLU]) -#define fputcolcor(cc,fp) fprintf(fp,"%s %f %f %f\n",COLCORSTR, \ - (cc)[RED],(cc)[GRN],(cc)[BLU]) + /* macros for color correction */ +#define COLCORSTR "COLORCORR=" +#define LCOLCORSTR 10 +#define iscolcor(hl) (!strncmp(hl,COLCORSTR,LCOLCORSTR)) +#define colcorval(cc,hl) sscanf(hl+LCOLCORSTR,"%f %f %f", \ + &(cc)[RED],&(cc)[GRN],&(cc)[BLU]) +#define fputcolcor(cc,fp) fprintf(fp,"%s %f %f %f\n",COLCORSTR, \ + (cc)[RED],(cc)[GRN],(cc)[BLU]) #ifdef DCL_ATOF extern double atof(), ldexp(), frexp(); diff --git a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx index f84ae280d0..e94e72c309 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx @@ -142,7 +142,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // we have a problem. if (pnmimage_alias_cat.is_debug()) { pnmimage_alias_cat.debug() - << "Alias image file appears to be empty.\n"; + << "Alias image file appears to be empty.\n"; } _is_valid = false; return; @@ -237,15 +237,15 @@ read_row(xel *row_data, xelval *) { grn = read_uchar(_file); red = read_uchar(_file); while (num>0) { - PPM_ASSIGN(row_data[x], red, grn, blu); - x++; - num--; + PPM_ASSIGN(row_data[x], red, grn, blu); + x++; + num--; } } else { while (num>0) { - PPM_PUTB(row_data[x], blu); - x++; - num--; + PPM_PUTB(row_data[x], blu); + x++; + num--; } } } @@ -269,7 +269,7 @@ flush_color(FILE *file) { static void write_color(FILE *file, - unsigned char red, unsigned char blu, unsigned char grn) { + unsigned char red, unsigned char blu, unsigned char grn) { if (red==last_red && blu==last_blu && grn==last_grn && num_count<0377) { num_count++; } else { diff --git a/panda/src/pnmimagetypes/pnmFileTypeAlias.h b/panda/src/pnmimagetypes/pnmFileTypeAlias.h index b3b53dd0c2..b6d94bc054 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeAlias.h +++ b/panda/src/pnmimagetypes/pnmFileTypeAlias.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeAlias +// Class : PNMFileTypeAlias // Description : For reading and Alias native image files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeAlias : public PNMFileType { @@ -27,7 +27,7 @@ public: virtual string get_suggested_extension() const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMP.h b/panda/src/pnmimagetypes/pnmFileTypeBMP.h index 74d6440fc8..4dacc2f08a 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMP.h +++ b/panda/src/pnmimagetypes/pnmFileTypeBMP.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeBMP +// Class : PNMFileTypeBMP // Description : For reading and writing Windows BMP files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeBMP : public PNMFileType { @@ -30,7 +30,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: @@ -41,7 +41,7 @@ public: virtual int read_data(xel *array, xelval *alpha); private: - unsigned long pos; + unsigned long pos; unsigned long offBits; @@ -49,9 +49,9 @@ public: int indexed; int classv; - pixval R[256]; /* reds */ - pixval G[256]; /* greens */ - pixval B[256]; /* blues */ + pixval R[256]; /* reds */ + pixval G[256]; /* greens */ + pixval B[256]; /* blues */ }; class Writer : public PNMWriter { diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx index ff3dcf7d61..609a54ddae 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx @@ -31,6 +31,9 @@ extern "C" { * without express or implied warranty. * * $Log$ + * Revision 1.3 2001/05/25 15:59:19 drose + * remove tab characters + * * Revision 1.2 2000/11/09 21:14:02 drose * *** empty log message *** * @@ -94,40 +97,40 @@ static char er_read[] = "%s: read error"; static int GetByte(FILE *fp) { - int v; + int v; - if ((v = getc(fp)) == EOF) - { - pm_error(er_read, ifname); - } + if ((v = getc(fp)) == EOF) + { + pm_error(er_read, ifname); + } - return v; + return v; } static short GetShort(FILE *fp) { - short v; + short v; - if (pm_readlittleshort(fp, &v) == -1) - { - pm_error(er_read, ifname); - } + if (pm_readlittleshort(fp, &v) == -1) + { + pm_error(er_read, ifname); + } - return v; + return v; } static long GetLong(FILE *fp) { - long v; + long v; - if (pm_readlittlelong(fp, &v) == -1) - { - pm_error(er_read, ifname); - } + if (pm_readlittlelong(fp, &v) == -1) + { + pm_error(er_read, ifname); + } - return v; + return v; } /* @@ -137,28 +140,28 @@ GetLong(FILE *fp) static void readto(FILE *fp, - unsigned long *ppos, /* pointer to number of bytes read from fp */ - unsigned long dst) + unsigned long *ppos, /* pointer to number of bytes read from fp */ + unsigned long dst) { - unsigned long pos; + unsigned long pos; - if(!fp || !ppos) - return; + if(!fp || !ppos) + return; - pos = *ppos; + pos = *ppos; - if(pos > dst) - pm_error("%s: internal error in readto()", ifname); + if(pos > dst) + pm_error("%s: internal error in readto()", ifname); - for(; pos < dst; pos++) - { - if (getc(fp) == EOF) - { - pm_error(er_read, ifname); - } - } + for(; pos < dst; pos++) + { + if (getc(fp) == EOF) + { + pm_error(er_read, ifname); + } + } - *ppos = pos; + *ppos = pos; } @@ -168,132 +171,132 @@ readto(FILE *fp, static void BMPreadfileheader( - FILE *fp, - unsigned long *ppos, /* number of bytes read from fp */ - unsigned long *poffBits) + FILE *fp, + unsigned long *ppos, /* number of bytes read from fp */ + unsigned long *poffBits) { /* unsigned long cbSize; - unsigned short xHotSpot; - unsigned short yHotSpot; - */ - unsigned long offBits; + unsigned short xHotSpot; + unsigned short yHotSpot; + */ + unsigned long offBits; - /* - We've already read the magic number. - if (GetByte(fp) != 'B') - { - pm_error("%s is not a BMP file", ifname); - } - if (GetByte(fp) != 'M') - { - pm_error("%s is not a BMP file", ifname); - } - */ + /* + We've already read the magic number. + if (GetByte(fp) != 'B') + { + pm_error("%s is not a BMP file", ifname); + } + if (GetByte(fp) != 'M') + { + pm_error("%s is not a BMP file", ifname); + } + */ - /* cbSize = */ GetLong(fp); - /* xHotSpot = */ GetShort(fp); - /* yHotSpot = */ GetShort(fp); - offBits = GetLong(fp); + /* cbSize = */ GetLong(fp); + /* xHotSpot = */ GetShort(fp); + /* yHotSpot = */ GetShort(fp); + offBits = GetLong(fp); - *poffBits = offBits; + *poffBits = offBits; - *ppos += 14; + *ppos += 14; } static void BMPreadinfoheader( - FILE *fp, - unsigned long *ppos, /* number of bytes read from fp */ - unsigned long *pcx, - unsigned long *pcy, - unsigned short *pcBitCount, - int *pclassv) + FILE *fp, + unsigned long *ppos, /* number of bytes read from fp */ + unsigned long *pcx, + unsigned long *pcy, + unsigned short *pcBitCount, + int *pclassv) { - unsigned long cbFix; - unsigned short cPlanes; + unsigned long cbFix; + unsigned short cPlanes; - unsigned long cx; - unsigned long cy; - unsigned short cBitCount; - int classv; + unsigned long cx; + unsigned long cy; + unsigned short cBitCount; + int classv; - cbFix = GetLong(fp); + cbFix = GetLong(fp); - switch (cbFix) - { - case 12: - classv = C_OS2; + switch (cbFix) + { + case 12: + classv = C_OS2; - cx = GetShort(fp); - cy = GetShort(fp); - cPlanes = GetShort(fp); - cBitCount = GetShort(fp); + cx = GetShort(fp); + cy = GetShort(fp); + cPlanes = GetShort(fp); + cBitCount = GetShort(fp); - break; - case 40: - classv = C_WIN; + break; + case 40: + classv = C_WIN; - cx = GetLong(fp); - cy = GetLong(fp); - cPlanes = GetShort(fp); - cBitCount = GetShort(fp); + cx = GetLong(fp); + cy = GetLong(fp); + cPlanes = GetShort(fp); + cBitCount = GetShort(fp); - /* - * We've read 16 bytes so far, need to read 24 more - * for the required total of 40. - */ + /* + * We've read 16 bytes so far, need to read 24 more + * for the required total of 40. + */ - GetLong(fp); - GetLong(fp); - GetLong(fp); - GetLong(fp); - GetLong(fp); - GetLong(fp); + GetLong(fp); + GetLong(fp); + GetLong(fp); + GetLong(fp); + GetLong(fp); + GetLong(fp); - break; - default: - pm_error("%s: unknown cbFix: %d", ifname, cbFix); - break; - } + break; + default: + pm_error("%s: unknown cbFix: %d", ifname, cbFix); + break; + } - if (cPlanes != 1) - { - pm_error("%s: don't know how to handle cPlanes = %d" - ,ifname - ,cPlanes); - } + if (cPlanes != 1) + { + pm_error("%s: don't know how to handle cPlanes = %d" + ,ifname + ,cPlanes); + } - switch (classv) - { - case C_WIN: - pm_message("Windows BMP, %dx%dx%d" - ,cx - ,cy - ,cBitCount); - break; - case C_OS2: - pm_message("OS/2 BMP, %dx%dx%d" - ,cx - ,cy - ,cBitCount); - break; - } + switch (classv) + { + case C_WIN: + pm_message("Windows BMP, %dx%dx%d" + ,cx + ,cy + ,cBitCount); + break; + case C_OS2: + pm_message("OS/2 BMP, %dx%dx%d" + ,cx + ,cy + ,cBitCount); + break; + } #ifdef DEBUG - pm_message("cbFix: %d", cbFix); - pm_message("cx: %d", cx); - pm_message("cy: %d", cy); - pm_message("cPlanes: %d", cPlanes); - pm_message("cBitCount: %d", cBitCount); + pm_message("cbFix: %d", cbFix); + pm_message("cx: %d", cx); + pm_message("cy: %d", cy); + pm_message("cPlanes: %d", cPlanes); + pm_message("cBitCount: %d", cBitCount); #endif - *pcx = cx; - *pcy = cy; - *pcBitCount = cBitCount; - *pclassv = classv; + *pcx = cx; + *pcy = cy; + *pcBitCount = cBitCount; + *pclassv = classv; - *ppos += cbFix; + *ppos += cbFix; } /* @@ -301,35 +304,35 @@ BMPreadinfoheader( */ static int BMPreadrgbtable( - FILE *fp, - unsigned long *ppos, /* number of bytes read from fp */ - unsigned short cBitCount, - int classv, - pixval *R, - pixval *G, - pixval *B) + FILE *fp, + unsigned long *ppos, /* number of bytes read from fp */ + unsigned short cBitCount, + int classv, + pixval *R, + pixval *G, + pixval *B) { - int i; - int nbyte = 0; + int i; + int nbyte = 0; - long ncolors = (1 << cBitCount); + long ncolors = (1 << cBitCount); - for (i = 0; i < ncolors; i++) - { - B[i] = (pixval) GetByte(fp); - G[i] = (pixval) GetByte(fp); - R[i] = (pixval) GetByte(fp); - nbyte += 3; + for (i = 0; i < ncolors; i++) + { + B[i] = (pixval) GetByte(fp); + G[i] = (pixval) GetByte(fp); + R[i] = (pixval) GetByte(fp); + nbyte += 3; - if (classv == C_WIN) - { - (void) GetByte(fp); - nbyte++; - } - } + if (classv == C_WIN) + { + (void) GetByte(fp); + nbyte++; + } + } - *ppos += nbyte; - return nbyte; + *ppos += nbyte; + return nbyte; } /* @@ -337,116 +340,116 @@ BMPreadrgbtable( */ static int BMPreadrow( - FILE *fp, - unsigned long *ppos, /* number of bytes read from fp */ - pixel *row, - unsigned long cx, - unsigned short cBitCount, - int indexed, - pixval *R, - pixval *G, - pixval *B) + FILE *fp, + unsigned long *ppos, /* number of bytes read from fp */ + pixel *row, + unsigned long cx, + unsigned short cBitCount, + int indexed, + pixval *R, + pixval *G, + pixval *B) { - BITSTREAM b; - unsigned nbyte = 0; - int rc; - unsigned x; + BITSTREAM b; + unsigned nbyte = 0; + int rc; + unsigned x; - if (indexed) { - if ((b = pm_bitinit(fp, "r")) == (BITSTREAM) 0) - { - return -1; - } - } + if (indexed) { + if ((b = pm_bitinit(fp, "r")) == (BITSTREAM) 0) + { + return -1; + } + } - for (x = 0; x < cx; x++, row++) - { - unsigned long v; + for (x = 0; x < cx; x++, row++) + { + unsigned long v; - if (!indexed) { - int r, g, b; - b = GetByte(fp); - g = GetByte(fp); - r = GetByte(fp); - nbyte += 3; - PPM_ASSIGN(*row, r, g, b); - } else { - if ((rc = pm_bitread(b, cBitCount, &v)) == -1) - { - return -1; - } - nbyte += rc; - - PPM_ASSIGN(*row, R[v], G[v], B[v]); - } - } + if (!indexed) { + int r, g, b; + b = GetByte(fp); + g = GetByte(fp); + r = GetByte(fp); + nbyte += 3; + PPM_ASSIGN(*row, r, g, b); + } else { + if ((rc = pm_bitread(b, cBitCount, &v)) == -1) + { + return -1; + } + nbyte += rc; - if (indexed) { - if ((rc = pm_bitfini(b)) != 0) - { - return -1; - } - } + PPM_ASSIGN(*row, R[v], G[v], B[v]); + } + } - /* - * Make sure we read a multiple of 4 bytes. - */ - while (nbyte % 4) - { - GetByte(fp); - nbyte++; - } + if (indexed) { + if ((rc = pm_bitfini(b)) != 0) + { + return -1; + } + } - *ppos += nbyte; - return nbyte; + /* + * Make sure we read a multiple of 4 bytes. + */ + while (nbyte % 4) + { + GetByte(fp); + nbyte++; + } + + *ppos += nbyte; + return nbyte; } static void BMPreadbits(xel *array, - FILE *fp, - unsigned long *ppos, /* number of bytes read from fp */ - unsigned long offBits, - unsigned long cx, - unsigned long cy, - unsigned short cBitCount, - int /* classv */, - int indexed, - pixval *R, - pixval *G, - pixval *B) + FILE *fp, + unsigned long *ppos, /* number of bytes read from fp */ + unsigned long offBits, + unsigned long cx, + unsigned long cy, + unsigned short cBitCount, + int /* classv */, + int indexed, + pixval *R, + pixval *G, + pixval *B) { - long y; + long y; - readto(fp, ppos, offBits); + readto(fp, ppos, offBits); - if(cBitCount > 24) - { - pm_error("%s: cannot handle cBitCount: %d" - ,ifname - ,cBitCount); - } + if(cBitCount > 24) + { + pm_error("%s: cannot handle cBitCount: %d" + ,ifname + ,cBitCount); + } - /* - * The picture is stored bottom line first, top line last - */ + /* + * The picture is stored bottom line first, top line last + */ - for (y = (long)cy - 1; y >= 0; y--) - { - int rc; - rc = BMPreadrow(fp, ppos, array + y*cx, cx, cBitCount, indexed, R, G, B); - if(rc == -1) - { - pm_error("%s: couldn't read row %d" - ,ifname - ,y); - } - if(rc%4) - { - pm_error("%s: row had bad number of bytes: %d" - ,ifname - ,rc); - } - } + for (y = (long)cy - 1; y >= 0; y--) + { + int rc; + rc = BMPreadrow(fp, ppos, array + y*cx, cx, cBitCount, indexed, R, G, B); + if(rc == -1) + { + pm_error("%s: couldn't read row %d" + ,ifname + ,y); + } + if(rc%4) + { + pm_error("%s: row had bad number of bytes: %d" + ,ifname + ,rc); + } + } } @@ -463,7 +466,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // No magic number, no image. if (pnmimage_bmp_cat.is_debug()) { pnmimage_bmp_cat.debug() - << "BMP image file appears to be empty.\n"; + << "BMP image file appears to be empty.\n"; } _is_valid = false; return; @@ -500,8 +503,8 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if (rc != (int)BMPlenrgbtable(classv, cBitCount)) { pnmimage_bmp_cat.warning() - << rc << "-byte RGB table, expected " - << BMPlenrgbtable(classv, cBitCount) << " bytes\n"; + << rc << "-byte RGB table, expected " + << BMPlenrgbtable(classv, cBitCount) << " bytes\n"; } } @@ -533,7 +536,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : int PNMFileTypeBMP::Reader:: read_data(xel *array, xelval *) { BMPreadbits(array, _file, &pos, offBits, _x_size, _y_size, - cBitCount, classv, indexed, R, G, B); + cBitCount, classv, indexed, R, G, B); if (pos != BMPlenfile(classv, cBitCount, _x_size, _y_size)) { pnmimage_bmp_cat.warning() diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx index 87026f2a7b..ce3f896762 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMPWriter.cxx @@ -35,6 +35,9 @@ extern "C" { * without express or implied warranty. * * $Log$ + * Revision 1.3 2001/05/25 15:59:19 drose + * remove tab characters + * * Revision 1.2 2000/11/09 21:14:02 drose * *** empty log message *** * @@ -292,7 +295,7 @@ BMPwriterow( pixel *row, unsigned long cx, unsigned short bpp, - int indexed, + int indexed, colorhash_table cht) { BITSTREAM b; @@ -300,36 +303,36 @@ BMPwriterow( int rc; unsigned x; - if (indexed) { - if ((b = pm_bitinit(fp, "w")) == (BITSTREAM) 0) - { - return -1; - } + if (indexed) { + if ((b = pm_bitinit(fp, "w")) == (BITSTREAM) 0) + { + return -1; + } - for (x = 0; x < cx; x++, row++) - { - if ((rc = pm_bitwrite(b, bpp, ppm_lookupcolor(cht, row))) == -1) + for (x = 0; x < cx; x++, row++) + { + if ((rc = pm_bitwrite(b, bpp, ppm_lookupcolor(cht, row))) == -1) { - return -1; + return -1; } - nbyte += rc; - } - - if ((rc = pm_bitfini(b)) == -1) - { - return -1; - } - nbyte += rc; - } else { + nbyte += rc; + } - for (x = 0; x < cx; x++, row++) - { - PutByte(fp, PPM_GETB(*row)); - PutByte(fp, PPM_GETG(*row)); - PutByte(fp, PPM_GETR(*row)); - nbyte += 3; - } - } + if ((rc = pm_bitfini(b)) == -1) + { + return -1; + } + nbyte += rc; + } else { + + for (x = 0; x < cx; x++, row++) + { + PutByte(fp, PPM_GETB(*row)); + PutByte(fp, PPM_GETG(*row)); + PutByte(fp, PPM_GETR(*row)); + nbyte += 3; + } + } /* * Make sure we write a multiple of 4 bytes. @@ -353,7 +356,7 @@ BMPwritebits( unsigned long cy, unsigned short cBitCount, pixel **pixels, - int indexed, + int indexed, colorhash_table cht) { int nbyte = 0; @@ -572,14 +575,14 @@ write_data(xel *array, xelval *) { switch (classv) { case C_WIN: - name = "a Windows"; - break; + name = "a Windows"; + break; case C_OS2: - name = "an OS/2"; - break; + name = "an OS/2"; + break; default: - pm_error(er_internal, "report"); - break; + pm_error(er_internal, "report"); + break; } pm_message("generating %s BMP file", name); } @@ -608,18 +611,18 @@ write_data(xel *array, xelval *) { */ if (_maxval > 255) { pnmimage_bmp_cat.debug() - << "maxval is not 255 - automatically rescaling colors\n"; + << "maxval is not 255 - automatically rescaling colors\n"; } for (i = 0; i < colors; ++i) { if (_maxval == 255) { - Red[i] = PPM_GETR(chv[i].color); - Green[i] = PPM_GETG(chv[i].color); - Blue[i] = PPM_GETB(chv[i].color); + Red[i] = PPM_GETR(chv[i].color); + Green[i] = PPM_GETG(chv[i].color); + Blue[i] = PPM_GETB(chv[i].color); } else { - Red[i] = (pixval) PPM_GETR(chv[i].color) * 255 / _maxval; - Green[i] = (pixval) PPM_GETG(chv[i].color) * 255 / _maxval; - Blue[i] = (pixval) PPM_GETB(chv[i].color) * 255 / _maxval; + Red[i] = (pixval) PPM_GETR(chv[i].color) * 255 / _maxval; + Green[i] = (pixval) PPM_GETG(chv[i].color) * 255 / _maxval; + Blue[i] = (pixval) PPM_GETB(chv[i].color) * 255 / _maxval; } } @@ -628,7 +631,7 @@ write_data(xel *array, xelval *) { ppm_freecolorhist(chv); BMPEncode(_file, classv, _x_size, _y_size, pixels, colors, cht, - Red, Green, Blue); + Red, Green, Blue); } return _y_size; diff --git a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx index 2e63ebe1b3..5b205a8d96 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx @@ -152,8 +152,8 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // pair of ushorts or ulongs at the beginning to indicate the file // size. if (pnmimage_img_cat.is_debug()) { - pnmimage_img_cat.debug() - << "IMG image file appears to be empty.\n"; + pnmimage_img_cat.debug() + << "IMG image file appears to be empty.\n"; } _is_valid = false; return; @@ -174,8 +174,8 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : } else if (img_header_type == IHT_short) { if (!read_magic_number(_file, magic_number, 4)) { if (pnmimage_img_cat.is_debug()) { - pnmimage_img_cat.debug() - << "IMG image file appears to be empty.\n"; + pnmimage_img_cat.debug() + << "IMG image file appears to be empty.\n"; } _is_valid = false; return; @@ -199,10 +199,10 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : _is_valid = false; if (img_header_type == IHT_none) { pnmimage_img_cat.error() - << "Must specify img-xsize and img-ysize to load headerless raw files.\n"; + << "Must specify img-xsize and img-ysize to load headerless raw files.\n"; } else { pnmimage_img_cat.debug() - << "IMG file does not have a valid xsize,ysize header.\n"; + << "IMG file does not have a valid xsize,ysize header.\n"; } return; } diff --git a/panda/src/pnmimagetypes/pnmFileTypeIMG.h b/panda/src/pnmimagetypes/pnmFileTypeIMG.h index f8e7900825..1b56bf2fa4 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeIMG.h +++ b/panda/src/pnmimagetypes/pnmFileTypeIMG.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeIMG +// Class : PNMFileTypeIMG // Description : For reading and writing headerless R,G,B files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeIMG : public PNMFileType { @@ -27,7 +27,7 @@ public: virtual string get_suggested_extension() const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx index 6af366ce24..f811256a1c 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx @@ -93,7 +93,7 @@ bool PNMFileTypeJPG:: matches_magic_number(const string &magic_number) const { nassertr(magic_number.size() >= 2, false); return ((char)magic_number[0] == (char)0xff && - (char)magic_number[1] == (char)0xd8); + (char)magic_number[1] == (char)0xd8); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.h b/panda/src/pnmimagetypes/pnmFileTypeJPG.h index a00dbdf111..3596ea2a42 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.h +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.h @@ -18,7 +18,7 @@ extern "C" { } //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeJPG +// Class : PNMFileTypeJPG // Description : For reading and writing Jpeg files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeJPG : public PNMFileType { @@ -35,7 +35,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: @@ -54,7 +54,7 @@ public: }; typedef struct my_error_mgr *_my_error_ptr; struct my_error_mgr _jerr; - unsigned long pos; + unsigned long pos; unsigned long offBits; @@ -62,9 +62,9 @@ public: int indexed; int classv; - pixval R[256]; /* reds */ - pixval G[256]; /* greens */ - pixval B[256]; /* blues */ + pixval R[256]; /* reds */ + pixval G[256]; /* greens */ + pixval B[256]; /* blues */ }; class Writer : public PNMWriter { diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx index 6230b784a3..7d99da76b8 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPGReader.cxx @@ -118,15 +118,15 @@ read_data(xel *array, xelval *) { JSAMPROW bufptr = buffer[0]; for (int i = 0; i < row_stride; i += _cinfo.output_components) { if (_cinfo.output_components == 1) { - xelval val = (xelval)bufptr[i]; - nassertr(x < _x_size * _y_size, 0); - PNM_ASSIGN1(array[x], val); + xelval val = (xelval)bufptr[i]; + nassertr(x < _x_size * _y_size, 0); + PNM_ASSIGN1(array[x], val); } else { xelval red, grn, blu; red = (xelval)bufptr[i]; grn = (xelval)bufptr[i+1]; blu = (xelval)bufptr[i+2]; - nassertr(x < _x_size * _y_size, 0); + nassertr(x < _x_size * _y_size, 0); PPM_ASSIGN(array[x], red, grn, blu); } x++; diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx index 3a2c4d15f8..61d160f579 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx @@ -146,7 +146,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // No magic number. No image. if (pnmimage_pnm_cat.is_debug()) { pnmimage_pnm_cat.debug() - << "PNM file appears to be empty.\n"; + << "PNM file appears to be empty.\n"; } _is_valid = false; return; @@ -182,23 +182,23 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if (pnmimage_pnm_cat.is_debug()) { if (is_valid()) { pnmimage_pnm_cat.debug() - << "Reading "; + << "Reading "; switch (PNM_FORMAT_TYPE(_ftype)) { case PPM_TYPE: - pnmimage_pnm_cat.debug(false) << "PPM"; - break; + pnmimage_pnm_cat.debug(false) << "PPM"; + break; case PGM_TYPE: - pnmimage_pnm_cat.debug(false) << "PGM"; - break; + pnmimage_pnm_cat.debug(false) << "PGM"; + break; case PBM_TYPE: - pnmimage_pnm_cat.debug(false) << "PBM"; - break; + pnmimage_pnm_cat.debug(false) << "PBM"; + break; } pnmimage_pnm_cat.debug(false) - << " " << *this << "\n"; + << " " << *this << "\n"; } else { pnmimage_pnm_cat.debug() - << "File is not a valid PNM image.\n"; + << "File is not a valid PNM image.\n"; } } } diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.h b/panda/src/pnmimagetypes/pnmFileTypePNM.h index b6fbd85b07..49baba9775 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.h +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypePNM +// Class : PNMFileTypePNM // Description : For reading and writing basic PNM files--*.pbm, // *.ppm, *.pnm. //////////////////////////////////////////////////////////////////// @@ -31,7 +31,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx b/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx index 0d9fa0c99b..a3d3b57f00 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeRadiance.cxx @@ -320,8 +320,8 @@ write_row(xel *row_data, xelval *) { for (x = 0; x < _x_size; x++) { if (grayscale) { scanout[x][RED] = - scanout[x][GRN] = - scanout[x][BLU] = (BYTE)((int)COLR_MAX * PPM_GETB(row_data[x]) / _maxval); + scanout[x][GRN] = + scanout[x][BLU] = (BYTE)((int)COLR_MAX * PPM_GETB(row_data[x]) / _maxval); } else { scanout[x][RED] = (BYTE)((int)COLR_MAX * PPM_GETR(row_data[x]) / _maxval); scanout[x][GRN] = (BYTE)((int)COLR_MAX * PPM_GETG(row_data[x]) / _maxval); diff --git a/panda/src/pnmimagetypes/pnmFileTypeRadiance.h b/panda/src/pnmimagetypes/pnmFileTypeRadiance.h index ee9dddfe95..09cdd2b30f 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeRadiance.h +++ b/panda/src/pnmimagetypes/pnmFileTypeRadiance.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeRadiance +// Class : PNMFileTypeRadiance // Description : For reading and Radiance native image files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeRadiance : public PNMFileType { @@ -30,7 +30,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGI.h b/panda/src/pnmimagetypes/pnmFileTypeSGI.h index e494191655..0efcd85086 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGI.h +++ b/panda/src/pnmimagetypes/pnmFileTypeSGI.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeSGI +// Class : PNMFileTypeSGI // Description : For reading and writing SGI RGB files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeSGI : public PNMFileType { @@ -30,7 +30,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx index fb0aaab0f2..b64fb85a2b 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGIReader.cxx @@ -51,9 +51,9 @@ static void read_bytes (FILE *ifp, int n, char *buf); static bool read_header(FILE *ifp, Header *head, const string &magic_number); static TabEntry * read_table (FILE *ifp, int tablen); static void read_channel (FILE *ifp, int xsize, int ysize, - int zsize, int bpc, TabEntry *table, - ScanElem *channel_data, long table_start, - int channel, int row); + int zsize, int bpc, TabEntry *table, + ScanElem *channel_data, long table_start, + int channel, int row); static void rle_decompress (ScanElem *src, long srclen, ScanElem *dest, long destlen); #define WORSTCOMPR(x) (2*(x) + 2) @@ -83,7 +83,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // No magic number. No image. if (pnmimage_sgi_cat.is_debug()) { pnmimage_sgi_cat.debug() - << "RGB file appears to be empty.\n"; + << "RGB file appears to be empty.\n"; } _is_valid = false; return; @@ -181,18 +181,18 @@ read_row(xel *row_data, xelval *alpha_data) { ScanElem *alpha = (ScanElem *)alloca(_x_size * sizeof(ScanElem)); read_channel(_file, _x_size, _y_size, _num_channels, bpc, table, red, - table_start, 0, current_row); + table_start, 0, current_row); if (!is_grayscale()) { read_channel(_file, _x_size, _y_size, _num_channels, bpc, table, grn, - table_start, 1, current_row); + table_start, 1, current_row); read_channel(_file, _x_size, _y_size, _num_channels, bpc, table, blu, - table_start, 2, current_row); + table_start, 2, current_row); } if (has_alpha()) { read_channel(_file, _x_size, _y_size, _num_channels, bpc, table, alpha, - table_start, _num_channels - 1, current_row); + table_start, _num_channels - 1, current_row); } for (int x = 0; x < _x_size; x++) { @@ -237,25 +237,25 @@ read_header(FILE *ifp, Header *head, const string &magic_number) { if (head->magic != SGI_MAGIC) { pnmimage_sgi_cat.error() - << "Invalid magic number: not an SGI image file.\n"; + << "Invalid magic number: not an SGI image file.\n"; return false; } if (head->storage != 0 && head->storage != 1) { pnmimage_sgi_cat.error() - << "Unknown compression type.\n"; + << "Unknown compression type.\n"; return false; } if (head->bpc < 1 || head->bpc > 2) { pnmimage_sgi_cat.error() - << "Illegal precision value " << head->bpc << " (only 1-2 allowed)\n"; + << "Illegal precision value " << head->bpc << " (only 1-2 allowed)\n"; return false; } if (head->colormap != CMAP_NORMAL) { pnmimage_sgi_cat.error() - << "Unsupported non-normal pixel data (" << head->colormap << ")\n"; + << "Unsupported non-normal pixel data (" << head->colormap << ")\n"; return false; } @@ -278,24 +278,24 @@ read_header(FILE *ifp, Header *head, const string &magic_number) { switch( head->zsize ) { case 1: case 2: - head->dimension = 2; - break; + head->dimension = 2; + break; case 3: case 4: - break; - + break; + default: - pnmimage_sgi_cat.warning() - << "Using only first 4 channels of " << head->zsize - << "-channel image.\n"; - head->zsize = 4; - break; + pnmimage_sgi_cat.warning() + << "Using only first 4 channels of " << head->zsize + << "-channel image.\n"; + head->zsize = 4; + break; } break; default: pnmimage_sgi_cat.error() - << "Illegal dimension value " << head->dimension - << " (only 1-3 allowed)\n"; + << "Illegal dimension value " << head->dimension + << " (only 1-3 allowed)\n"; return false; } */ @@ -325,10 +325,10 @@ read_table(FILE *ifp, int tablen) { static void read_channel(FILE *ifp, - int xsize, int ysize, int, int bpc, - TabEntry *table, - ScanElem *channel_data, long table_start, - int channel, int row) { + int xsize, int ysize, int, int bpc, + TabEntry *table, + ScanElem *channel_data, long table_start, + int channel, int row) { ScanElem *temp; int sgi_index, i; long offset, length; @@ -345,22 +345,22 @@ read_channel(FILE *ifp, offset = table[sgi_index].start; length = table[sgi_index].length; if( bpc == 2 ) - length /= 2; /* doc says length is in bytes, we are reading words */ + length /= 2; /* doc says length is in bytes, we are reading words */ if( fseek(ifp, offset, SEEK_SET) != 0 ) - pm_error("seek error for offset %ld", offset); + pm_error("seek error for offset %ld", offset); nassertv(length <= WORSTCOMPR(xsize)); for( i = 0; i < length; i++ ) - temp[i] = (*func)(ifp); + temp[i] = (*func)(ifp); rle_decompress(temp, length, channel_data, xsize); } else { offset = sgi_index * xsize + table_start; if( fseek(ifp, offset, SEEK_SET) != 0 ) - pm_error("seek error for offset %ld", offset); + pm_error("seek error for offset %ld", offset); for( i = 0; i < xsize; i++ ) - channel_data[i] = (*func)(ifp); + channel_data[i] = (*func)(ifp); } } @@ -368,9 +368,9 @@ read_channel(FILE *ifp, static void rle_decompress(ScanElem *src, - long srcleft, - ScanElem *dest, - long destleft) { + long srcleft, + ScanElem *dest, + long destleft) { int count; unsigned char el; @@ -455,8 +455,8 @@ readerr(FILE *f) { static void read_bytes(FILE *ifp, - int n, - char *buf) { + int n, + char *buf) { int r; r = fread((void *)buf, 1, n, ifp); diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx index 49222272ea..49b2f2831e 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGIWriter.cxx @@ -271,33 +271,33 @@ build_scanline(ScanLine output[], xel *row_data, xelval *alpha_data) { if( _num_channels <= 2 ) { for( col = 0; col < _x_size; col++ ) temp[col] = (ScanElem) - (new_maxval * PPM_GETB(row_data[col]) / _maxval); + (new_maxval * PPM_GETB(row_data[col]) / _maxval); temp = compress(temp, output[0]); if (_num_channels == 2) { for( col = 0; col < _x_size; col++ ) - temp[col] = (ScanElem) - (new_maxval * alpha_data[col] / _maxval); + temp[col] = (ScanElem) + (new_maxval * alpha_data[col] / _maxval); temp = compress(temp, output[1]); } } else { for( col = 0; col < _x_size; col++ ) temp[col] = (ScanElem) - (new_maxval * PPM_GETR(row_data[col]) / _maxval); + (new_maxval * PPM_GETR(row_data[col]) / _maxval); temp = compress(temp, output[0]); for( col = 0; col < _x_size; col++ ) temp[col] = (ScanElem) - (new_maxval * PPM_GETG(row_data[col]) / _maxval); + (new_maxval * PPM_GETG(row_data[col]) / _maxval); temp = compress(temp, output[1]); for( col = 0; col < _x_size; col++ ) temp[col] = (ScanElem) - (new_maxval * PPM_GETB(row_data[col]) / _maxval); + (new_maxval * PPM_GETB(row_data[col]) / _maxval); temp = compress(temp, output[2]); if (_num_channels == 4) { for( col = 0; col < _x_size; col++ ) - temp[col] = (ScanElem) - (new_maxval * alpha_data[col] / _maxval); + temp[col] = (ScanElem) + (new_maxval * alpha_data[col] / _maxval); temp = compress(temp, output[3]); } } @@ -320,7 +320,7 @@ compress(ScanElem *temp, ScanLine &output) { len = rle_compress(temp, _x_size); /* writes result into rletemp */ output.length = len; output.data = new ScanElem[len]; - memcpy(output.data, rletemp, len * sizeof(ScanElem)); + memcpy(output.data, rletemp, len * sizeof(ScanElem)); break; default: pm_error("unknown storage type - can\'t happen"); diff --git a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx index 5cdf705566..2992703219 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx @@ -74,7 +74,7 @@ write_float(FILE *file, float x) { static int read_channel_pkt(FILE *file, - int &chained, int &size, int &type, int &channel) { + int &chained, int &size, int &type, int &channel) { chained = read_uchar(file); size = read_uchar(file); type = read_uchar(file); @@ -137,9 +137,9 @@ read_rgba(xel *row_data, xelval *alpha_data, FILE *file, int x, int repeat) { static int read_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, - void (*read_data)(xel *row_data, xelval *alpha_data, FILE *file, - int x, int repeat), - int ctype) { + void (*read_data)(xel *row_data, xelval *alpha_data, FILE *file, + int x, int repeat), + int ctype) { if (ctype==UNCOMPRESSED) { for (int x = 0; x cols) { - return false; - } - while (num>0) { - read_data(row_data, alpha_data, file, x, 1); - if (feof(file)) { - return false; - } - x++; - num--; - } + // Sequence of non-repeated values. + num++; + if (x+num > cols) { + return false; + } + while (num>0) { + read_data(row_data, alpha_data, file, x, 1); + if (feof(file)) { + return false; + } + x++; + num--; + } } else { - // Sequence of repeated values. - if (num==128) { - num = read_ushort(file); - } else { - num -= 127; - } - if (x+num > cols) { - return false; - } - read_data(row_data, alpha_data, file, x, num); - if (feof(file)) { - return false; - } - x += num; + // Sequence of repeated values. + if (num==128) { + num = read_ushort(file); + } else { + num -= 127; + } + if (x+num > cols) { + return false; + } + read_data(row_data, alpha_data, file, x, num); + if (feof(file)) { + return false; + } + x += num; } } @@ -311,7 +311,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : // No magic number, no image. if (pnmimage_soft_cat.is_debug()) { pnmimage_soft_cat.debug() - << "SoftImage image file appears to be empty.\n"; + << "SoftImage image file appears to be empty.\n"; } _is_valid = false; return; @@ -371,13 +371,13 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if (chained) { if (!read_channel_pkt(_file, chained, size, alpha_ctype, channel)) { - _is_valid = false; - return; + _is_valid = false; + return; } if (channel == ALPHA_CHANNEL) { - // Alpha component in the second part: RGBA. - soft_color = rgb_a; + // Alpha component in the second part: RGBA. + soft_color = rgb_a; } } } @@ -447,25 +447,25 @@ read_row(xel *row_data, xelval *alpha_data) { switch (soft_color) { case rgb: if (!read_scanline(row_data, alpha_data, _x_size, _file, - read_rgb, rgb_ctype)) { + read_rgb, rgb_ctype)) { return false; } break; case rgba: if (!read_scanline(row_data, alpha_data, _x_size, _file, - read_rgba, rgb_ctype)) { + read_rgba, rgb_ctype)) { return false; } break; case rgb_a: if (!read_scanline(row_data, alpha_data, _x_size, _file, - read_rgb, rgb_ctype)) { + read_rgb, rgb_ctype)) { return false; } if (!read_scanline(row_data, alpha_data, _x_size, _file, - read_alpha, alpha_ctype)) { + read_alpha, alpha_ctype)) { return false; } break; @@ -480,7 +480,7 @@ read_row(xel *row_data, xelval *alpha_data) { static void write_channel_pkt(FILE *file, - int chained, int size, int type, int channel) { + int chained, int size, int type, int channel) { write_uchar(file, chained); write_uchar(file, size); write_uchar(file, type); @@ -523,9 +523,9 @@ compare_alpha(xel *, xelval *alpha_data, int x1, int x2) { static void write_diff(xel *row_data, xelval *alpha_data, FILE *file, - void (*write_data)(xel *row_data, xelval *alpha_data, FILE *file, - int x), - int tox, int length) { + void (*write_data)(xel *row_data, xelval *alpha_data, FILE *file, + int x), + int tox, int length) { if (length>0) { nassertv(length<=128); @@ -539,9 +539,9 @@ write_diff(xel *row_data, xelval *alpha_data, FILE *file, static void write_same(xel *row_data, xelval *alpha_data, FILE *file, - void (*write_data)(xel *row_data, xelval *alpha_data, FILE *file, - int x), - int tox, int length) { + void (*write_data)(xel *row_data, xelval *alpha_data, FILE *file, + int x), + int tox, int length) { if (length==1) { write_diff(row_data, alpha_data, file, write_data, tox, length); @@ -559,10 +559,10 @@ write_same(xel *row_data, xelval *alpha_data, FILE *file, static void write_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, - int (*compare_data)(xel *row_data, xelval *alpha_data, - int x1, int x2), - void (*write_data)(xel *row_data, xelval *alpha_data, - FILE *file, int x)) { + int (*compare_data)(xel *row_data, xelval *alpha_data, + int x1, int x2), + void (*write_data)(xel *row_data, xelval *alpha_data, + FILE *file, int x)) { int run_length = 0; int x = 0; @@ -578,23 +578,23 @@ write_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, // the run is the sequence of values from x-run_length to x-1. if (!compare_data(row_data, alpha_data, x, x-run_length)) { - // Oops, the end of a run. + // Oops, the end of a run. - if (run_length <= 1) { - // If run_length is only 1, no big deal--this is actually the - // beginning of a different-valued run. - - same = false; - - } else { - // Write out the old run and begin a new one. We'll be optimistic - // and hope the new run will also represent a sequence of identical - // values (until we find otherwise). - - write_same(row_data, alpha_data, file, write_data, x-1, run_length); - same = true; - run_length = 0; - } + if (run_length <= 1) { + // If run_length is only 1, no big deal--this is actually the + // beginning of a different-valued run. + + same = false; + + } else { + // Write out the old run and begin a new one. We'll be optimistic + // and hope the new run will also represent a sequence of identical + // values (until we find otherwise). + + write_same(row_data, alpha_data, file, write_data, x-1, run_length); + same = true; + run_length = 0; + } } } else { // !same @@ -603,23 +603,23 @@ write_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, // the run is the sequence of values from x-run_length to x-1. if (run_length>128) { - // We can't have different runs of more than 128 characters. Close - // off the old run. - - int excess = run_length - 128; - write_diff(row_data, alpha_data, file, write_data, x-excess-1, 128); - run_length = excess; + // We can't have different runs of more than 128 characters. Close + // off the old run. + + int excess = run_length - 128; + write_diff(row_data, alpha_data, file, write_data, x-excess-1, 128); + run_length = excess; } else if (run_length > 2 && - compare_data(row_data, alpha_data, x, x-1) && - compare_data(row_data, alpha_data, x, x-2)) { + compare_data(row_data, alpha_data, x, x-1) && + compare_data(row_data, alpha_data, x, x-2)) { - // If the last three values have been the same, then it's time to - // begin a new run of similar values. Close off the old run. - - write_diff(row_data, alpha_data, file, write_data, x-3, run_length-2); - same = true; - run_length = 2; + // If the last three values have been the same, then it's time to + // begin a new run of similar values. Close off the old run. + + write_diff(row_data, alpha_data, file, write_data, x-3, run_length-2); + same = true; + run_length = 2; } } @@ -637,9 +637,9 @@ write_scanline(xel *row_data, xelval *alpha_data, int cols, FILE *file, // Mighty unlikely, but we might have just run over the // 128-pixel limit. if (run_length>128) { - int excess = run_length - 128; - write_diff(row_data, alpha_data, file, write_data, cols-excess-1, 128); - run_length = excess; + int excess = run_length - 128; + write_diff(row_data, alpha_data, file, write_data, cols-excess-1, 128); + run_length = excess; } write_diff(row_data, alpha_data, file, write_data, cols-1, run_length); diff --git a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.h b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.h index 3c35b3957c..eb76da6d2a 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.h +++ b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeSoftImage +// Class : PNMFileTypeSoftImage // Description : For reading and SoftImage native image files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeSoftImage : public PNMFileType { @@ -30,7 +30,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx index 703d39fd1b..af7619694d 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx @@ -52,21 +52,21 @@ TypeHandle PNMFileTypeTGA::_type_handle; /* Header definition. */ struct ImageHeader { - unsigned char IDLength; /* length of Identifier String */ - unsigned char CoMapType; /* 0 = no map */ - unsigned char ImgType; /* image type (see below for values) */ - unsigned char Index_lo, Index_hi; /* index of first color map entry */ - unsigned char Length_lo, Length_hi; /* number of entries in color map */ - unsigned char CoSize; /* size of color map entry (15,16,24,32) */ - unsigned char X_org_lo, X_org_hi; /* x origin of image */ - unsigned char Y_org_lo, Y_org_hi; /* y origin of image */ - unsigned char Width_lo, Width_hi; /* width of image */ - unsigned char Height_lo, Height_hi; /* height of image */ - unsigned char PixelSize; /* pixel size (8,16,24,32) */ - unsigned char AttBits; /* 4 bits, number of attribute bits per pixel */ - unsigned char Rsrvd; /* 1 bit, reserved */ - unsigned char OrgBit; /* 1 bit, origin: 0=lower left, 1=upper left */ - unsigned char IntrLve; /* 2 bits, interleaving flag */ + unsigned char IDLength; /* length of Identifier String */ + unsigned char CoMapType; /* 0 = no map */ + unsigned char ImgType; /* image type (see below for values) */ + unsigned char Index_lo, Index_hi; /* index of first color map entry */ + unsigned char Length_lo, Length_hi; /* number of entries in color map */ + unsigned char CoSize; /* size of color map entry (15,16,24,32) */ + unsigned char X_org_lo, X_org_hi; /* x origin of image */ + unsigned char Y_org_lo, Y_org_hi; /* y origin of image */ + unsigned char Width_lo, Width_hi; /* width of image */ + unsigned char Height_lo, Height_hi; /* height of image */ + unsigned char PixelSize; /* pixel size (8,16,24,32) */ + unsigned char AttBits; /* 4 bits, number of attribute bits per pixel */ + unsigned char Rsrvd; /* 1 bit, reserved */ + unsigned char OrgBit; /* 1 bit, origin: 0=lower left, 1=upper left */ + unsigned char IntrLve; /* 2 bits, interleaving flag */ }; typedef char ImageIDField[256]; @@ -185,67 +185,67 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : /* Read the Targa file header. */ readtga( file, tga_head, magic_number ); /* - { - pm_message( "IDLength = %d", (int) tga_head->IDLength ); - pm_message( "CoMapType = %d", (int) tga_head->CoMapType ); - pm_message( "ImgType = %d", (int) tga_head->ImgType ); - pm_message( "Index_lo = %d", (int) tga_head->Index_lo ); - pm_message( "Index_hi = %d", (int) tga_head->Index_hi ); - pm_message( "Length_lo = %d", (int) tga_head->Length_lo ); - pm_message( "Length_hi = %d", (int) tga_head->Length_hi ); - pm_message( "CoSize = %d", (int) tga_head->CoSize ); - pm_message( "X_org_lo = %d", (int) tga_head->X_org_lo ); - pm_message( "X_org_hi = %d", (int) tga_head->X_org_hi ); - pm_message( "Y_org_lo = %d", (int) tga_head->Y_org_lo ); - pm_message( "Y_org_hi = %d", (int) tga_head->Y_org_hi ); - pm_message( "Width_lo = %d", (int) tga_head->Width_lo ); - pm_message( "Width_hi = %d", (int) tga_head->Width_hi ); - pm_message( "Height_lo = %d", (int) tga_head->Height_lo ); - pm_message( "Height_hi = %d", (int) tga_head->Height_hi ); - pm_message( "PixelSize = %d", (int) tga_head->PixelSize ); - pm_message( "AttBits = %d", (int) tga_head->AttBits ); - pm_message( "Rsrvd = %d", (int) tga_head->Rsrvd ); - pm_message( "OrgBit = %d", (int) tga_head->OrgBit ); - pm_message( "IntrLve = %d", (int) tga_head->IntrLve ); - } + { + pm_message( "IDLength = %d", (int) tga_head->IDLength ); + pm_message( "CoMapType = %d", (int) tga_head->CoMapType ); + pm_message( "ImgType = %d", (int) tga_head->ImgType ); + pm_message( "Index_lo = %d", (int) tga_head->Index_lo ); + pm_message( "Index_hi = %d", (int) tga_head->Index_hi ); + pm_message( "Length_lo = %d", (int) tga_head->Length_lo ); + pm_message( "Length_hi = %d", (int) tga_head->Length_hi ); + pm_message( "CoSize = %d", (int) tga_head->CoSize ); + pm_message( "X_org_lo = %d", (int) tga_head->X_org_lo ); + pm_message( "X_org_hi = %d", (int) tga_head->X_org_hi ); + pm_message( "Y_org_lo = %d", (int) tga_head->Y_org_lo ); + pm_message( "Y_org_hi = %d", (int) tga_head->Y_org_hi ); + pm_message( "Width_lo = %d", (int) tga_head->Width_lo ); + pm_message( "Width_hi = %d", (int) tga_head->Width_hi ); + pm_message( "Height_lo = %d", (int) tga_head->Height_lo ); + pm_message( "Height_hi = %d", (int) tga_head->Height_hi ); + pm_message( "PixelSize = %d", (int) tga_head->PixelSize ); + pm_message( "AttBits = %d", (int) tga_head->AttBits ); + pm_message( "Rsrvd = %d", (int) tga_head->Rsrvd ); + pm_message( "OrgBit = %d", (int) tga_head->OrgBit ); + pm_message( "IntrLve = %d", (int) tga_head->IntrLve ); + } */ rows = ( (int) tga_head->Height_lo ) + ( (int) tga_head->Height_hi ) * 256; cols = ( (int) tga_head->Width_lo ) + ( (int) tga_head->Width_hi ) * 256; switch ( tga_head->ImgType ) - { - case TGA_Map: - case TGA_RGB: - case TGA_Mono: - case TGA_RLEMap: - case TGA_RLERGB: - case TGA_RLEMono: - break; + { + case TGA_Map: + case TGA_RGB: + case TGA_Mono: + case TGA_RLEMap: + case TGA_RLERGB: + case TGA_RLEMono: + break; - default: - pm_error( "unknown Targa image type %d", tga_head->ImgType ); - } + default: + pm_error( "unknown Targa image type %d", tga_head->ImgType ); + } int size; if ( tga_head->ImgType == TGA_Map || - tga_head->ImgType == TGA_RLEMap || - tga_head->ImgType == TGA_CompMap || - tga_head->ImgType == TGA_CompMap4 ) - { /* Color-mapped image */ - if ( tga_head->CoMapType != 1 ) - pm_error( - "mapped image (type %d) with color map type != 1", - tga_head->ImgType ); - mapped = 1; - /* Figure maxval from CoSize. */ - size = tga_head->CoSize; - } + tga_head->ImgType == TGA_RLEMap || + tga_head->ImgType == TGA_CompMap || + tga_head->ImgType == TGA_CompMap4 ) + { /* Color-mapped image */ + if ( tga_head->CoMapType != 1 ) + pm_error( + "mapped image (type %d) with color map type != 1", + tga_head->ImgType ); + mapped = 1; + /* Figure maxval from CoSize. */ + size = tga_head->CoSize; + } else - { /* Not colormap, so figure maxval from PixelSize. */ - mapped = 0; - size = tga_head->PixelSize; - } + { /* Not colormap, so figure maxval from PixelSize. */ + mapped = 0; + size = tga_head->PixelSize; + } switch ( size ) { case 8: @@ -275,24 +275,24 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : /* If required, read the color map information. */ if ( tga_head->CoMapType != 0 ) - { - unsigned int temp1, temp2; - temp1 = tga_head->Index_lo + tga_head->Index_hi * 256; - temp2 = tga_head->Length_lo + tga_head->Length_hi * 256; - if ( ( temp1 + temp2 + 1 ) >= TGA_MAXCOLORS ) - pm_error( "too many colors - %d", ( temp1 + temp2 + 1 ) ); - for ( unsigned int i = temp1; i < ( temp1 + temp2 ); ++i ) - get_map_entry( file, &ColorMap[i], (int) tga_head->CoSize, + { + unsigned int temp1, temp2; + temp1 = tga_head->Index_lo + tga_head->Index_hi * 256; + temp2 = tga_head->Length_lo + tga_head->Length_hi * 256; + if ( ( temp1 + temp2 + 1 ) >= TGA_MAXCOLORS ) + pm_error( "too many colors - %d", ( temp1 + temp2 + 1 ) ); + for ( unsigned int i = temp1; i < ( temp1 + temp2 ); ++i ) + get_map_entry( file, &ColorMap[i], (int) tga_head->CoSize, &AlphaMap[i]); - } + } /* Check run-length encoding. */ if ( tga_head->ImgType == TGA_RLEMap || - tga_head->ImgType == TGA_RLERGB || - tga_head->ImgType == TGA_RLEMono ) - rlencoded = 1; + tga_head->ImgType == TGA_RLERGB || + tga_head->ImgType == TGA_RLEMono ) + rlencoded = 1; else - rlencoded = 0; + rlencoded = 0; _x_size = cols; _y_size = rows; @@ -328,24 +328,24 @@ read_data(xel *array, xelval *alpha) { int truerow = 0; int baserow = 0; for ( int row = 0; row < rows; ++row ) - { - int realrow = truerow; - if ( tga_head->OrgBit == 0 ) - realrow = rows - realrow - 1; + { + int realrow = truerow; + if ( tga_head->OrgBit == 0 ) + realrow = rows - realrow - 1; - for ( int col = 0; col < cols; ++col ) - get_pixel( _file, &(array[realrow * cols + col]), - (int) tga_head->PixelSize, - &(alpha[realrow * cols + col]) ); - if ( tga_head->IntrLve == TGA_IL_Four ) - truerow += 4; - else if ( tga_head->IntrLve == TGA_IL_Two ) - truerow += 2; - else - ++truerow; - if ( truerow >= rows ) - truerow = ++baserow; - } + for ( int col = 0; col < cols; ++col ) + get_pixel( _file, &(array[realrow * cols + col]), + (int) tga_head->PixelSize, + &(alpha[realrow * cols + col]) ); + if ( tga_head->IntrLve == TGA_IL_Four ) + truerow += 4; + else if ( tga_head->IntrLve == TGA_IL_Two ) + truerow += 2; + else + ++truerow; + if ( truerow >= rows ) + truerow = ++baserow; + } return rows; } @@ -435,15 +435,15 @@ write_data(xel *array, xelval *) { if (tga_colormap) { // It may even be colormapped if there are few enough colors. pnmimage_tga_cat.info() - << "computing colormap...\n"; + << "computing colormap...\n"; chv = ppm_computecolorhist(&array, cols * rows, 1, TGA_MAXCOLORS, &ncolors ); if ( chv == (colorhist_vector) 0 ) { - pnmimage_tga_cat.info() - << "too many colors, writing RGB.\n"; + pnmimage_tga_cat.info() + << "too many colors, writing RGB.\n"; } else { - pnmimage_tga_cat.info() - << ncolors << " colors found.\n"; - tgaHeader->ImgType = TGA_Map; + pnmimage_tga_cat.info() + << ncolors << " colors found.\n"; + tgaHeader->ImgType = TGA_Map; } } } @@ -451,19 +451,19 @@ write_data(xel *array, xelval *) { if ( rle_flag ) { switch ( tgaHeader->ImgType ) - { - case TGA_Mono: - tgaHeader->ImgType = TGA_RLEMono; - break; - case TGA_Map: - tgaHeader->ImgType = TGA_RLEMap; - break; - case TGA_RGB: - tgaHeader->ImgType = TGA_RLERGB; - break; - default: - pm_error( "can't happen" ); - } + { + case TGA_Mono: + tgaHeader->ImgType = TGA_RLEMono; + break; + case TGA_Map: + tgaHeader->ImgType = TGA_RLEMap; + break; + case TGA_RGB: + tgaHeader->ImgType = TGA_RLERGB; + break; + default: + pm_error( "can't happen" ); + } runlength = (int*) pm_allocrow( cols, sizeof(int) ); } @@ -509,7 +509,7 @@ write_data(xel *array, xelval *) { { /* Write out the Targa colormap. */ for ( i = 0; i < ncolors; ++i ) - put_map_entry( &chv[i].color, tgaHeader->CoSize, _maxval ); + put_map_entry( &chv[i].color, tgaHeader->CoSize, _maxval ); } /* Write out the pixels */ @@ -517,36 +517,36 @@ write_data(xel *array, xelval *) { { int realrow = row; if ( tgaHeader->OrgBit == 0 ) - realrow = rows - realrow - 1; + realrow = rows - realrow - 1; if ( rle_flag ) - { - compute_runlengths( cols, &array[realrow * cols], runlength ); - for ( col = 0; col < cols; ) - { - if ( runlength[col] > 0 ) - { - fputc( 0x80 + runlength[col] - 1, _file ); - put_pixel(&(array[realrow * cols + col]), - tgaHeader->ImgType, _maxval, cht ); - col += runlength[col]; - } - else if ( runlength[col] < 0 ) - { - fputc( -runlength[col] - 1, _file ); - for ( i = 0; i < -runlength[col]; ++i ) - put_pixel(&(array[realrow * cols + (col + i)]), - tgaHeader->ImgType, _maxval, cht ); - col += -runlength[col]; - } - else - pm_error( "can't happen" ); - } - } + { + compute_runlengths( cols, &array[realrow * cols], runlength ); + for ( col = 0; col < cols; ) + { + if ( runlength[col] > 0 ) + { + fputc( 0x80 + runlength[col] - 1, _file ); + put_pixel(&(array[realrow * cols + col]), + tgaHeader->ImgType, _maxval, cht ); + col += runlength[col]; + } + else if ( runlength[col] < 0 ) + { + fputc( -runlength[col] - 1, _file ); + for ( i = 0; i < -runlength[col]; ++i ) + put_pixel(&(array[realrow * cols + (col + i)]), + tgaHeader->ImgType, _maxval, cht ); + col += -runlength[col]; + } + else + pm_error( "can't happen" ); + } + } else - { - for ( col = 0, pP = &array[realrow * cols]; col < cols; ++col, ++pP ) - put_pixel( pP, tgaHeader->ImgType, _maxval, cht ); - } + { + for ( col = 0, pP = &array[realrow * cols]; col < cols; ++col, ++pP ) + put_pixel( pP, tgaHeader->ImgType, _maxval, cht ); + } } return rows; @@ -628,7 +628,7 @@ readtga( FILE *ifp, struct ImageHeader *tgaP, const string &magic_number ) { tgaP->IntrLve = ( flags & 0xc0 ) >> 6; if ( tgaP->IDLength != 0 ) - fread( junk, 1, (int) tgaP->IDLength, ifp ); + fread( junk, 1, (int) tgaP->IDLength, ifp ); } void PNMFileTypeTGA::Reader:: @@ -637,36 +637,36 @@ get_map_entry( FILE *ifp, pixel *Value, int Size, gray *Alpha ) { /* Read appropriate number of bytes, break into rgb & put in map. */ switch ( Size ) - { - case 8: /* Grey scale, read and triplicate. */ - r = g = b = getbyte( ifp ); + { + case 8: /* Grey scale, read and triplicate. */ + r = g = b = getbyte( ifp ); a = 0; - break; + break; - case 16: /* 5 bits each of red green and blue. */ - case 15: /* Watch for byte order. */ - j = getbyte( ifp ); - k = getbyte( ifp ); - r = ( k & 0x7C ) >> 2; - g = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 ); - b = j & 0x1F; + case 16: /* 5 bits each of red green and blue. */ + case 15: /* Watch for byte order. */ + j = getbyte( ifp ); + k = getbyte( ifp ); + r = ( k & 0x7C ) >> 2; + g = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 ); + b = j & 0x1F; a = 0; - break; + break; - case 32: /* 8 bits each of blue, green, red, and alpha */ - case 24: /* 8 bits each of blue green and red. */ - b = getbyte( ifp ); - g = getbyte( ifp ); - r = getbyte( ifp ); - if ( Size == 32 ) - a = getbyte( ifp ); + case 32: /* 8 bits each of blue, green, red, and alpha */ + case 24: /* 8 bits each of blue green and red. */ + b = getbyte( ifp ); + g = getbyte( ifp ); + r = getbyte( ifp ); + if ( Size == 32 ) + a = getbyte( ifp ); else a = 0; - break; + break; - default: - pm_error( "unknown colormap pixel size (#2) - %d", Size ); - } + default: + pm_error( "unknown colormap pixel size (#2) - %d", Size ); + } PPM_ASSIGN( *Value, r, g, b ); *Alpha = a; } @@ -682,75 +682,75 @@ get_pixel( FILE *ifp, pixel *dest, int Size, gray *alpha_p) { /* Check if run length encoded. */ if ( rlencoded ) - { - if ( RLE_count == 0 ) - { /* Have to restart run. */ - unsigned char i; - i = getbyte( ifp ); - RLE_flag = ( i & 0x80 ); - if ( RLE_flag == 0 ) - /* Stream of unencoded pixels. */ - RLE_count = i + 1; - else - /* Single pixel replicated. */ - RLE_count = i - 127; - /* Decrement count & get pixel. */ - --RLE_count; - } - else - { /* Have already read count & (at least) first pixel. */ - --RLE_count; - if ( RLE_flag != 0 ) - /* Replicated pixels. */ - goto PixEncode; - } - } + { + if ( RLE_count == 0 ) + { /* Have to restart run. */ + unsigned char i; + i = getbyte( ifp ); + RLE_flag = ( i & 0x80 ); + if ( RLE_flag == 0 ) + /* Stream of unencoded pixels. */ + RLE_count = i + 1; + else + /* Single pixel replicated. */ + RLE_count = i - 127; + /* Decrement count & get pixel. */ + --RLE_count; + } + else + { /* Have already read count & (at least) first pixel. */ + --RLE_count; + if ( RLE_flag != 0 ) + /* Replicated pixels. */ + goto PixEncode; + } + } /* Read appropriate number of bytes, break into RGB. */ switch ( Size ) - { - case 8: /* Grey scale, read and triplicate. */ - Red = Grn = Blu = l = getbyte( ifp ); + { + case 8: /* Grey scale, read and triplicate. */ + Red = Grn = Blu = l = getbyte( ifp ); Alpha = 0; - break; + break; - case 16: /* 5 bits each of red green and blue. */ - case 15: /* Watch byte order. */ - j = getbyte( ifp ); - k = getbyte( ifp ); - l = ( (unsigned int) k << 8 ) + j; - Red = ( k & 0x7C ) >> 2; - Grn = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 ); - Blu = j & 0x1F; + case 16: /* 5 bits each of red green and blue. */ + case 15: /* Watch byte order. */ + j = getbyte( ifp ); + k = getbyte( ifp ); + l = ( (unsigned int) k << 8 ) + j; + Red = ( k & 0x7C ) >> 2; + Grn = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 ); + Blu = j & 0x1F; Alpha = 0; - break; + break; - case 32: /* 8 bits each of blue, green, red, and alpha */ - case 24: /* 8 bits each of blue, green, and red. */ - Blu = getbyte( ifp ); - Grn = getbyte( ifp ); - Red = getbyte( ifp ); - if ( Size == 32 ) - Alpha = getbyte( ifp ); + case 32: /* 8 bits each of blue, green, red, and alpha */ + case 24: /* 8 bits each of blue, green, and red. */ + Blu = getbyte( ifp ); + Grn = getbyte( ifp ); + Red = getbyte( ifp ); + if ( Size == 32 ) + Alpha = getbyte( ifp ); else Alpha = 0; - l = 0; - break; + l = 0; + break; - default: - pm_error( "unknown pixel size (#2) - %d", Size ); - } + default: + pm_error( "unknown pixel size (#2) - %d", Size ); + } PixEncode: if ( mapped ) { *dest = ColorMap[l]; - if (has_alpha()) { - *alpha_p = AlphaMap[l]; - } + if (has_alpha()) { + *alpha_p = AlphaMap[l]; + } } else { PPM_ASSIGN( *dest, Red, Grn, Blu ); - if (has_alpha()) { - *alpha_p = Alpha; - } + if (has_alpha()) { + *alpha_p = Alpha; + } } } @@ -760,7 +760,7 @@ getbyte( FILE *ifp ) { unsigned char c; if ( fread( (char*) &c, 1, 1, ifp ) != 1 ) - pm_error( "EOF / read error" ); + pm_error( "EOF / read error" ); return c; } @@ -788,7 +788,7 @@ writetga( struct ImageHeader *tgaP, char *id ) fputc( tgaP->Height_hi, _file ); fputc( tgaP->PixelSize, _file ); flags = ( tgaP->AttBits & 0xf ) | ( ( tgaP->Rsrvd & 0x1 ) << 4 ) | - ( ( tgaP->OrgBit & 0x1 ) << 5 ) | ( ( tgaP->OrgBit & 0x3 ) << 6 ); + ( ( tgaP->OrgBit & 0x1 ) << 5 ) | ( ( tgaP->OrgBit & 0x3 ) << 6 ); fputc( flags, _file ); if ( tgaP->IDLength ) fwrite( id, 1, (int) tgaP->IDLength, _file ); @@ -801,28 +801,28 @@ put_map_entry( pixel* valueP, int size, pixval maxval ) pixel p; switch ( size ) - { - case 8: /* Grey scale. */ - put_mono( valueP, maxval ); - break; + { + case 8: /* Grey scale. */ + put_mono( valueP, maxval ); + break; - case 16: /* 5 bits each of red green and blue. */ - case 15: /* Watch for byte order. */ - PPM_DEPTH( p, *valueP, maxval, 31 ); - j = (int) PPM_GETB( p ) | ( (int) PPM_GETG( p ) << 5 ) | - ( (int) PPM_GETR( p ) << 10 ); - fputc( j % 256, _file ); - fputc( j / 256, _file ); - break; + case 16: /* 5 bits each of red green and blue. */ + case 15: /* Watch for byte order. */ + PPM_DEPTH( p, *valueP, maxval, 31 ); + j = (int) PPM_GETB( p ) | ( (int) PPM_GETG( p ) << 5 ) | + ( (int) PPM_GETR( p ) << 10 ); + fputc( j % 256, _file ); + fputc( j / 256, _file ); + break; - case 32: - case 24: /* 8 bits each of blue green and red. */ - put_rgb( valueP, maxval ); - break; + case 32: + case 24: /* 8 bits each of blue green and red. */ + put_rgb( valueP, maxval ); + break; - default: - pm_error( "unknown colormap pixel size (#2) - %d", size ); - } + default: + pm_error( "unknown colormap pixel size (#2) - %d", size ); + } } void PNMFileTypeTGA::Writer:: @@ -832,61 +832,61 @@ compute_runlengths( int cols, pixel *pixelrow, int *runlength ) /* Initialize all run lengths to 0. (This is just an error check.) */ for ( col = 0; col < cols; ++col ) - runlength[col] = 0; + runlength[col] = 0; /* Find runs of identical pixels. */ for ( col = 0; col < cols; ) - { - start = col; - do { - ++col; - } - while ( col < cols && - col - start < 128 && - PPM_EQUAL( pixelrow[col], pixelrow[start] ) ); - runlength[start] = col - start; - } + { + start = col; + do { + ++col; + } + while ( col < cols && + col - start < 128 && + PPM_EQUAL( pixelrow[col], pixelrow[start] ) ); + runlength[start] = col - start; + } /* Now look for runs of length-1 runs, and turn them into negative runs. */ for ( col = 0; col < cols; ) - { - if ( runlength[col] == 1 ) - { - start = col; - while ( col < cols && - col - start < 128 && - runlength[col] == 1 ) - { - runlength[col] = 0; - ++col; - } - runlength[start] = - ( col - start ); - } - else - col += runlength[col]; - } + { + if ( runlength[col] == 1 ) + { + start = col; + while ( col < cols && + col - start < 128 && + runlength[col] == 1 ) + { + runlength[col] = 0; + ++col; + } + runlength[start] = - ( col - start ); + } + else + col += runlength[col]; + } } void PNMFileTypeTGA::Writer:: put_pixel( pixel* pP, int imgtype, pixval maxval, colorhash_table cht ) { switch ( imgtype ) - { - case TGA_Mono: - case TGA_RLEMono: - put_mono( pP, maxval ); - break; - case TGA_Map: - case TGA_RLEMap: - put_map( pP, cht ); - break; - case TGA_RGB: - case TGA_RLERGB: - put_rgb( pP, maxval ); - break; - default: - pm_error( "can't happen" ); - } + { + case TGA_Mono: + case TGA_RLEMono: + put_mono( pP, maxval ); + break; + case TGA_Map: + case TGA_RLEMap: + put_map( pP, cht ); + break; + case TGA_RGB: + case TGA_RLERGB: + put_rgb( pP, maxval ); + break; + default: + pm_error( "can't happen" ); + } } void PNMFileTypeTGA::Writer:: diff --git a/panda/src/pnmimagetypes/pnmFileTypeTGA.h b/panda/src/pnmimagetypes/pnmFileTypeTGA.h index 8f991c0b5f..1df86eaf7e 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTGA.h +++ b/panda/src/pnmimagetypes/pnmFileTypeTGA.h @@ -23,7 +23,7 @@ struct ImageHeader; #define TGA_MAXCOLORS 256 //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeTGA +// Class : PNMFileTypeTGA // Description : For reading and writing Targa image files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeTGA : public PNMFileType { @@ -37,7 +37,7 @@ public: virtual string get_suggested_extension() const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: @@ -51,7 +51,7 @@ public: private: void readtga ( FILE* ifp, struct ImageHeader* tgaP, const string &magic_number ); void get_map_entry ( FILE* ifp, pixel* Value, int Size, - gray* Alpha); + gray* Alpha); void get_pixel ( FILE* ifp, pixel* dest, int Size, gray* alpha_p); unsigned char getbyte ( FILE* ifp ); diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index 6313cc7e0e..05bfb2e24c 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -34,12 +34,12 @@ unsigned short tiff_compression = COMPRESSION_LZW; COMPRESSION_CCITTRLE COMPRESSION_CCITTFAX3 COMPRESSION_CCITTFAX4 - COMPRESSION_LZW - COMPRESSION_JPEG - COMPRESSION_NEXT - COMPRESSION_CCITTRLEW - COMPRESSION_PACKBITS - COMPRESSION_THUNDERSCAN + COMPRESSION_LZW + COMPRESSION_JPEG + COMPRESSION_NEXT + COMPRESSION_CCITTRLEW + COMPRESSION_PACKBITS + COMPRESSION_THUNDERSCAN */ long tiff_g3options = 0; @@ -248,11 +248,11 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : } tif = TIFFClientOpen("TIFF file", "r", - (thandle_t) _file, - StdioReadProc, StdioWriteProc, - (TIFFSeekProc)StdioSeekProc, - StdioCloseProc, StdioSizeProc, - StdioMapProc, StdioUnmapProc); + (thandle_t) _file, + StdioReadProc, StdioWriteProc, + (TIFFSeekProc)StdioSeekProc, + StdioCloseProc, StdioSizeProc, + StdioMapProc, StdioUnmapProc); if ( tif == NULL ) { _is_valid = false; @@ -266,7 +266,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if ( ! TIFFGetField( tif, TIFFTAG_PHOTOMETRIC, &photomet ) ) { pnmimage_tiff_cat.error() - << "Error getting photometric from TIFF file.\n"; + << "Error getting photometric from TIFF file.\n"; _is_valid = false; } } @@ -276,7 +276,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : _num_channels = spp; } else { pnmimage_tiff_cat.error() - << "Cannot handle " << spp << "-channel image.\n"; + << "Cannot handle " << spp << "-channel image.\n"; _is_valid = false; } } @@ -287,90 +287,90 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if (pnmimage_tiff_cat.is_debug()) { pnmimage_tiff_cat.debug() - << "Reading TIFF image: " << _x_size << " x " << _y_size << "\n" - << bps << " bits/sample, " << spp << " samples/pixel\n"; + << "Reading TIFF image: " << _x_size << " x " << _y_size << "\n" + << bps << " bits/sample, " << spp << " samples/pixel\n"; } _maxval = ( 1 << bps ) - 1; if ( _maxval == 1 && spp == 1 ) { - if (pnmimage_tiff_cat.is_debug()) { - pnmimage_tiff_cat.debug(false) - << "monochrome\n"; - } - grayscale = true; + if (pnmimage_tiff_cat.is_debug()) { + pnmimage_tiff_cat.debug(false) + << "monochrome\n"; + } + grayscale = true; } else { switch ( photomet ) { case PHOTOMETRIC_MINISBLACK: - if (pnmimage_tiff_cat.is_debug()) { - pnmimage_tiff_cat.debug(false) - << _maxval + 1 << " graylevels (min is black)\n"; - } - grayscale = true; - break; - + if (pnmimage_tiff_cat.is_debug()) { + pnmimage_tiff_cat.debug(false) + << _maxval + 1 << " graylevels (min is black)\n"; + } + grayscale = true; + break; + case PHOTOMETRIC_MINISWHITE: - if (pnmimage_tiff_cat.is_debug()) { - pnmimage_tiff_cat.debug(false) - << _maxval + 1 << " graylevels (min is white)\n"; - } - grayscale = true; - break; - + if (pnmimage_tiff_cat.is_debug()) { + pnmimage_tiff_cat.debug(false) + << _maxval + 1 << " graylevels (min is white)\n"; + } + grayscale = true; + break; + case PHOTOMETRIC_PALETTE: - if (pnmimage_tiff_cat.is_debug()) { - pnmimage_tiff_cat.debug(false) - << " colormapped\n"; - } - if ( ! TIFFGetField( tif, TIFFTAG_COLORMAP, &redcolormap, &greencolormap, &bluecolormap ) ) { - pnmimage_tiff_cat.error() - << "Error getting colormap from TIFF file.\n"; - _is_valid = false; - } else { - numcolors = _maxval + 1; - if ( numcolors > TIFF_COLORMAP_MAXCOLORS ) { - pnmimage_tiff_cat.error() - << "Cannot read TIFF file with " << numcolors - << " in colormap; max supported is " << TIFF_COLORMAP_MAXCOLORS << "\n"; - _is_valid = false; - } else { - _maxval = PNM_MAXMAXVAL; - grayscale = false; - for ( i = 0; i < numcolors; ++i ) { - xelval r, g, b; - r = (xelval)(_maxval * (double)(redcolormap[i] / 65535.0)); - g = (xelval)(_maxval * (double)(greencolormap[i] / 65535.0)); - b = (xelval)(_maxval * (double)(bluecolormap[i] / 65535.0)); - PPM_ASSIGN( colormap[i], r, g, b ); - } - } - } - break; - + if (pnmimage_tiff_cat.is_debug()) { + pnmimage_tiff_cat.debug(false) + << " colormapped\n"; + } + if ( ! TIFFGetField( tif, TIFFTAG_COLORMAP, &redcolormap, &greencolormap, &bluecolormap ) ) { + pnmimage_tiff_cat.error() + << "Error getting colormap from TIFF file.\n"; + _is_valid = false; + } else { + numcolors = _maxval + 1; + if ( numcolors > TIFF_COLORMAP_MAXCOLORS ) { + pnmimage_tiff_cat.error() + << "Cannot read TIFF file with " << numcolors + << " in colormap; max supported is " << TIFF_COLORMAP_MAXCOLORS << "\n"; + _is_valid = false; + } else { + _maxval = PNM_MAXMAXVAL; + grayscale = false; + for ( i = 0; i < numcolors; ++i ) { + xelval r, g, b; + r = (xelval)(_maxval * (double)(redcolormap[i] / 65535.0)); + g = (xelval)(_maxval * (double)(greencolormap[i] / 65535.0)); + b = (xelval)(_maxval * (double)(bluecolormap[i] / 65535.0)); + PPM_ASSIGN( colormap[i], r, g, b ); + } + } + } + break; + case PHOTOMETRIC_RGB: - if (pnmimage_tiff_cat.is_debug()) { - pnmimage_tiff_cat.debug(false) - << "truecolor\n"; - } - grayscale = false; - break; - + if (pnmimage_tiff_cat.is_debug()) { + pnmimage_tiff_cat.debug(false) + << "truecolor\n"; + } + grayscale = false; + break; + case PHOTOMETRIC_MASK: - pnmimage_tiff_cat.error() - << "Don't know how to handle TIFF image with PHOTOMETRIC_MASK.\n"; - _is_valid = false; - break; - + pnmimage_tiff_cat.error() + << "Don't know how to handle TIFF image with PHOTOMETRIC_MASK.\n"; + _is_valid = false; + break; + case PHOTOMETRIC_DEPTH: - pnmimage_tiff_cat.error() - << "Don't know how to handle TIFF image with PHOTOMETRIC_DEPTH.\n"; - _is_valid = false; - break; - + pnmimage_tiff_cat.error() + << "Don't know how to handle TIFF image with PHOTOMETRIC_DEPTH.\n"; + _is_valid = false; + break; + default: - pnmimage_tiff_cat.error() - << "Unknown photometric " << photomet << " in TIFF image.\n"; - _is_valid = false; - break; + pnmimage_tiff_cat.error() + << "Unknown photometric " << photomet << " in TIFF image.\n"; + _is_valid = false; + break; } } } @@ -378,7 +378,7 @@ Reader(PNMFileType *type, FILE *file, bool owns_file, string magic_number) : if (_is_valid ) { if ( _maxval > PNM_MAXMAXVAL ) { pnmimage_tiff_cat.error() - << "Cannot read TIFF file with maxval of " << _maxval << "\n"; + << "Cannot read TIFF file with maxval of " << _maxval << "\n"; _is_valid = false; } } @@ -462,37 +462,37 @@ read_row(xel *row_data, xelval *alpha_data) { case PHOTOMETRIC_MINISBLACK: for ( col = 0; col < _x_size; ++col ) { - NEXTSAMPLE; - PPM_PUTB(row_data[col], sample); - if ( spp == 2 ) { - NEXTSAMPLE; // Alpha channel - alpha_data[col] = sample; - } + NEXTSAMPLE; + PPM_PUTB(row_data[col], sample); + if ( spp == 2 ) { + NEXTSAMPLE; // Alpha channel + alpha_data[col] = sample; + } } break; case PHOTOMETRIC_MINISWHITE: for ( col = 0; col < _x_size; ++col ) { - NEXTSAMPLE; - sample = _maxval - sample; - PPM_PUTB(row_data[col], sample); - if ( spp == 2 ) { - NEXTSAMPLE; // Alpha channel - alpha_data[col] = sample; - } + NEXTSAMPLE; + sample = _maxval - sample; + PPM_PUTB(row_data[col], sample); + if ( spp == 2 ) { + NEXTSAMPLE; // Alpha channel + alpha_data[col] = sample; + } } break; case PHOTOMETRIC_PALETTE: for ( col = 0; col < _x_size; ++col ) { - NEXTSAMPLE; - row_data[col] = colormap[sample]; - if ( spp == 2 ) { - NEXTSAMPLE; // Alpha channel - alpha_data[col] = sample; - } + NEXTSAMPLE; + row_data[col] = colormap[sample]; + if ( spp == 2 ) { + NEXTSAMPLE; // Alpha channel + alpha_data[col] = sample; + } } break; @@ -508,8 +508,8 @@ read_row(xel *row_data, xelval *alpha_data) { b = sample; PPM_ASSIGN(row_data[col], r, g, b); if ( spp == 4 ) { - NEXTSAMPLE; // Alpha channel - alpha_data[col] = sample; + NEXTSAMPLE; // Alpha channel + alpha_data[col] = sample; } } break; @@ -583,26 +583,26 @@ write_data(xel *array, xelval *alpha) { // xels to an indirect 2-d array of pixels. We make it look like a // single row of _x_size * _y_size pixels. chv = ppm_computecolorhist( (pixel **)&array, _x_size * _y_size, 1, - TIFF_COLORMAP_MAXCOLORS, &colors ); + TIFF_COLORMAP_MAXCOLORS, &colors ); if ( chv == (colorhist_vector) 0 ) { pnmimage_tiff_cat.debug() - << colors << " colors found; too many for a palette.\n" - << "Writing a 24-bit RGB file.\n"; + << colors << " colors found; too many for a palette.\n" + << "Writing a 24-bit RGB file.\n"; grayscale = false; } else { pnmimage_tiff_cat.debug() - << colors << " colors found; writing an 8-bit palette file.\n"; + << colors << " colors found; writing an 8-bit palette file.\n"; grayscale = true; for ( i = 0; i < colors; ++i ) { - register xelval r, g, b; - - r = PPM_GETR( chv[i].color ); - g = PPM_GETG( chv[i].color ); - b = PPM_GETB( chv[i].color ); - if ( r != g || g != b ) { - grayscale = false; - break; - } + register xelval r, g, b; + + r = PPM_GETR( chv[i].color ); + g = PPM_GETG( chv[i].color ); + b = PPM_GETB( chv[i].color ); + if ( r != g || g != b ) { + grayscale = false; + break; + } } } break; @@ -624,11 +624,11 @@ write_data(xel *array, xelval *alpha) { /* Open output file. */ tif = TIFFClientOpen("TIFF file", "w", - (thandle_t) _file, - StdioReadProc, StdioWriteProc, - (TIFFSeekProc)StdioSeekProc, - StdioCloseProc, StdioSizeProc, - StdioMapProc, StdioUnmapProc); + (thandle_t) _file, + StdioReadProc, StdioWriteProc, + (TIFFSeekProc)StdioSeekProc, + StdioCloseProc, StdioSizeProc, + StdioMapProc, StdioUnmapProc); if ( tif == NULL ) { return false; } @@ -691,7 +691,7 @@ write_data(xel *array, xelval *alpha) { TIFFSetField( tif, TIFFTAG_FILLORDER, tiff_fillorder ); //TIFFSetField( tif, TIFFTAG_DOCUMENTNAME, "TIFF Image File"); TIFFSetField( tif, TIFFTAG_IMAGEDESCRIPTION, - "Generated via pnmimage.\n" ); + "Generated via pnmimage.\n" ); TIFFSetField( tif, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel ); TIFFSetField( tif, TIFFTAG_ROWSPERSTRIP, tiff_rowsperstrip ); /* TIFFSetField( tif, TIFFTAG_STRIPBYTECOUNTS, _y_size / tiff_rowsperstrip ); */ @@ -720,32 +720,32 @@ write_data(xel *array, xelval *alpha) { if ( !is_grayscale() && ! grayscale ) { if ( cht == (colorhash_table) 0 ) { - tP = buf; - for ( col = 0; col < _x_size; ++col ) { - *tP++ = (unsigned char)(255 * PPM_GETR(row_data[col]) / _maxval); - *tP++ = (unsigned char)(255 * PPM_GETG(row_data[col]) / _maxval); - *tP++ = (unsigned char)(255 * PPM_GETB(row_data[col]) / _maxval); - if (samplesperpixel==4) { - *tP++ = (unsigned char)(255 * alpha_data[col] / _maxval); - } - } + tP = buf; + for ( col = 0; col < _x_size; ++col ) { + *tP++ = (unsigned char)(255 * PPM_GETR(row_data[col]) / _maxval); + *tP++ = (unsigned char)(255 * PPM_GETG(row_data[col]) / _maxval); + *tP++ = (unsigned char)(255 * PPM_GETB(row_data[col]) / _maxval); + if (samplesperpixel==4) { + *tP++ = (unsigned char)(255 * alpha_data[col] / _maxval); + } + } } else { - tP = buf; - for ( col = 0; col < _x_size; ++col ) { - register int s; - - s = ppm_lookupcolor( cht, (pixel *)(&row_data[col]) ); - if ( s == -1 ) { - pnmimage_tiff_cat.error() - << "Internal error: color not found?!? row=" << row - << " col=" << col << "\n"; - return 0; - } - *tP++ = (unsigned char) s; - if (samplesperpixel==2) { - *tP++ = (unsigned char)(255 * alpha_data[col] / _maxval); - } - } + tP = buf; + for ( col = 0; col < _x_size; ++col ) { + register int s; + + s = ppm_lookupcolor( cht, (pixel *)(&row_data[col]) ); + if ( s == -1 ) { + pnmimage_tiff_cat.error() + << "Internal error: color not found?!? row=" << row + << " col=" << col << "\n"; + return 0; + } + *tP++ = (unsigned char) s; + if (samplesperpixel==2) { + *tP++ = (unsigned char)(255 * alpha_data[col] / _maxval); + } + } } } else { register xelval bigger_maxval; @@ -758,24 +758,24 @@ write_data(xel *array, xelval *alpha) { byte = 0; tP = buf; for ( col = 0; col < _x_size; ++col ) { - s = PPM_GETB(row_data[col]); - if ( _maxval != bigger_maxval ) - s = (xelval)((long) s * bigger_maxval / _maxval); - byte |= s << bitshift; - bitshift -= bitspersample; - if ( bitshift < 0 ) { - *tP++ = byte; - bitshift = 8 - bitspersample; - byte = 0; - } + s = PPM_GETB(row_data[col]); + if ( _maxval != bigger_maxval ) + s = (xelval)((long) s * bigger_maxval / _maxval); + byte |= s << bitshift; + bitshift -= bitspersample; + if ( bitshift < 0 ) { + *tP++ = byte; + bitshift = 8 - bitspersample; + byte = 0; + } } if ( bitshift != 8 - bitspersample ) - *tP++ = byte; + *tP++ = byte; } if ( TIFFWriteScanline( tif, buf, row, 0 ) < 0 ) { pnmimage_tiff_cat.error() - << "failed a scanline write on row " << row << "\n"; + << "failed a scanline write on row " << row << "\n"; return row; } } diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.h b/panda/src/pnmimagetypes/pnmFileTypeTIFF.h index 8564623ba0..f44d465420 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.h +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.h @@ -15,7 +15,7 @@ #define TIFF_COLORMAP_MAXCOLORS 1024 //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeTIFF +// Class : PNMFileTypeTIFF // Description : For reading and writing TIFF files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeTIFF : public PNMFileType { @@ -32,7 +32,7 @@ public: virtual bool matches_magic_number(const string &magic_number) const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/pnmFileTypeYUV.h b/panda/src/pnmimagetypes/pnmFileTypeYUV.h index 24f9eb1c50..f4353504f1 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeYUV.h +++ b/panda/src/pnmimagetypes/pnmFileTypeYUV.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PNMFileTypeYUV +// Class : PNMFileTypeYUV // Description : For reading and writing Abekas YUV files. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PNMFileTypeYUV : public PNMFileType { @@ -27,7 +27,7 @@ public: virtual string get_suggested_extension() const; virtual PNMReader *make_reader(FILE *file, bool owns_file = true, - const string &magic_number = string()); + const string &magic_number = string()); virtual PNMWriter *make_writer(FILE *file, bool owns_file = true); public: diff --git a/panda/src/pnmimagetypes/resolu.h b/panda/src/pnmimagetypes/resolu.h index f06e7425de..2af5c2278b 100644 --- a/panda/src/pnmimagetypes/resolu.h +++ b/panda/src/pnmimagetypes/resolu.h @@ -15,36 +15,36 @@ * indicating that the scanlines are in English text order (PIXSTANDARD). */ - /* flags for scanline ordering */ -#define XDECR 1 -#define YDECR 2 -#define YMAJOR 4 + /* flags for scanline ordering */ +#define XDECR 1 +#define YDECR 2 +#define YMAJOR 4 - /* standard scanline ordering */ -#define PIXSTANDARD (YMAJOR|YDECR) -#define PIXSTDFMT "-Y %d +X %d\n" + /* standard scanline ordering */ +#define PIXSTANDARD (YMAJOR|YDECR) +#define PIXSTDFMT "-Y %d +X %d\n" - /* structure for image dimensions */ + /* structure for image dimensions */ typedef struct { - int or; /* orientation (from flags above) */ - int xr, yr; /* x and y resolution */ + int or; /* orientation (from flags above) */ + int xr, yr; /* x and y resolution */ } RESOLU; - /* macros to get scanline length and number */ -#define scanlen(rs) ((rs)->or & YMAJOR ? (rs)->xr : (rs)->yr) -#define numscans(rs) ((rs)->or & YMAJOR ? (rs)->yr : (rs)->xr) + /* macros to get scanline length and number */ +#define scanlen(rs) ((rs)->or & YMAJOR ? (rs)->xr : (rs)->yr) +#define numscans(rs) ((rs)->or & YMAJOR ? (rs)->yr : (rs)->xr) - /* resolution string buffer and its size */ -#define RESOLU_BUFLEN 32 + /* resolution string buffer and its size */ +#define RESOLU_BUFLEN 32 extern char resolu_buf[RESOLU_BUFLEN]; - /* macros for reading/writing resolution struct */ -#define fputsresolu(rs,fp) fputs(resolu2str(resolu_buf,rs),fp) -#define fgetsresolu(rs,fp) str2resolu(rs, \ - fgets(resolu_buf,RESOLU_BUFLEN,fp)) + /* macros for reading/writing resolution struct */ +#define fputsresolu(rs,fp) fputs(resolu2str(resolu_buf,rs),fp) +#define fgetsresolu(rs,fp) str2resolu(rs, \ + fgets(resolu_buf,RESOLU_BUFLEN,fp)) - /* reading/writing of standard ordering */ -#define fprtresolu(sl,ns,fp) fprintf(fp,PIXSTDFMT,ns,sl) -#define fscnresolu(sl,ns,fp) (fscanf(fp,PIXSTDFMT,ns,sl)==2) + /* reading/writing of standard ordering */ +#define fprtresolu(sl,ns,fp) fprintf(fp,PIXSTDFMT,ns,sl) +#define fscnresolu(sl,ns,fp) (fscanf(fp,PIXSTDFMT,ns,sl)==2) extern char *resolu2str(); diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index 2563bb4796..ca24580b9c 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/panda/src/pstatclient/pStatClient.cxx @@ -259,7 +259,7 @@ make_collector_with_relname(int parent_index, string relname) { PStatCollector PStatClient:: make_collector_with_name(int parent_index, const string &name) { nassertr(parent_index >= 0 && parent_index < (int)_collectors.size(), - PStatCollector()); + PStatCollector()); Collector &parent = _collectors[parent_index]; @@ -444,7 +444,7 @@ client_disconnect() { PerThread::iterator ii; for (ii = (*ci)._per_thread.begin(); ii != (*ci)._per_thread.end(); - ++ii) { + ++ii) { (*ii)._nested_count = 0; } } @@ -519,9 +519,9 @@ stop(int collector_index, int thread_index, float as_of) { _threads[thread_index]._is_active) { if (_collectors[collector_index]._per_thread[thread_index]._nested_count == 0) { pstats_cat.warning() - << "Collector " << get_collector_fullname(collector_index) - << " was already stopped in thread " << get_thread_name(thread_index) - << "!\n"; + << "Collector " << get_collector_fullname(collector_index) + << " was already stopped in thread " << get_thread_name(thread_index) + << "!\n"; return; } @@ -712,11 +712,11 @@ transmit_control_data() { if (_reader.get_data(datagram)) { PStatServerControlMessage message; if (message.decode(datagram)) { - handle_server_control_message(message); + handle_server_control_message(message); } else { - pstats_cat.error() - << "Got unexpected message from server.\n"; + pstats_cat.error() + << "Got unexpected message from server.\n"; } } } diff --git a/panda/src/pstatclient/pStatClient.h b/panda/src/pstatclient/pStatClient.h index c1dc203d49..470fbcb457 100644 --- a/panda/src/pstatclient/pStatClient.h +++ b/panda/src/pstatclient/pStatClient.h @@ -27,7 +27,7 @@ class PStatCollectorDef; class PStatThread; //////////////////////////////////////////////////////////////////// -// Class : PStatClient +// Class : PStatClient // Description : Manages the communications to report statistics via a // network connection to a remote PStatServer. // diff --git a/panda/src/pstatclient/pStatClientControlMessage.cxx b/panda/src/pstatclient/pStatClientControlMessage.cxx index a687206295..13151d2a47 100644 --- a/panda/src/pstatclient/pStatClientControlMessage.cxx +++ b/panda/src/pstatclient/pStatClientControlMessage.cxx @@ -41,7 +41,7 @@ encode(Datagram &datagram) const { { datagram.add_uint16(_collectors.size()); for (int i = 0; i < (int)_collectors.size(); i++) { - _collectors[i]->write_datagram(datagram); + _collectors[i]->write_datagram(datagram); } } break; @@ -51,7 +51,7 @@ encode(Datagram &datagram) const { datagram.add_uint16(_first_thread_index); datagram.add_uint16(_names.size()); for (int i = 0; i < (int)_names.size(); i++) { - datagram.add_string(_names[i]); + datagram.add_string(_names[i]); } } break; @@ -91,9 +91,9 @@ decode(const Datagram &datagram, PStatClientVersion *version) { int num = source.get_uint16(); _collectors.clear(); for (int i = 0; i < num; i++) { - PStatCollectorDef *def = new PStatCollectorDef; - def->read_datagram(source, version); - _collectors.push_back(def); + PStatCollectorDef *def = new PStatCollectorDef; + def->read_datagram(source, version); + _collectors.push_back(def); } } break; @@ -104,7 +104,7 @@ decode(const Datagram &datagram, PStatClientVersion *version) { int num = source.get_uint16(); _names.clear(); for (int i = 0; i < num; i++) { - _names.push_back(source.get_string()); + _names.push_back(source.get_string()); } } break; diff --git a/panda/src/pstatclient/pStatClientControlMessage.h b/panda/src/pstatclient/pStatClientControlMessage.h index b52e63d110..273f9f979d 100644 --- a/panda/src/pstatclient/pStatClientControlMessage.h +++ b/panda/src/pstatclient/pStatClientControlMessage.h @@ -16,7 +16,7 @@ class Datagram; class PStatClientVersion; //////////////////////////////////////////////////////////////////// -// Class : PStatClientControlMessage +// Class : PStatClientControlMessage // Description : This kind of message is sent from the client to the // server on the TCP socket to establish critical // control information. diff --git a/panda/src/pstatclient/pStatClientVersion.h b/panda/src/pstatclient/pStatClientVersion.h index a86668abbb..1743750447 100644 --- a/panda/src/pstatclient/pStatClientVersion.h +++ b/panda/src/pstatclient/pStatClientVersion.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PStatClientVersion +// Class : PStatClientVersion // Description : Records the version number of a particular client. // Normally this will be the same as // get_current_pstat_major/minor_version(). diff --git a/panda/src/pstatclient/pStatCollector.h b/panda/src/pstatclient/pStatCollector.h index 998d7da03e..84f8efe03a 100644 --- a/panda/src/pstatclient/pStatCollector.h +++ b/panda/src/pstatclient/pStatCollector.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PStatCollector +// Class : PStatCollector // Description : A lightweight class that represents a single element // that may be timed and/or counted via stats. // @@ -46,9 +46,9 @@ private: public: INLINE PStatCollector(const string &name, - PStatClient *client = NULL); + PStatClient *client = NULL); INLINE PStatCollector(const PStatCollector &parent, - const string &name); + const string &name); INLINE PStatCollector(const PStatCollector ©); INLINE void operator = (const PStatCollector ©); @@ -82,13 +82,13 @@ friend class PStatClient; #else // DO_PSTATS public: INLINE PStatCollector(const string &, - const RGBColorf & = RGBColorf::zero(), - int = -1, - PStatClient * = NULL) { } + const RGBColorf & = RGBColorf::zero(), + int = -1, + PStatClient * = NULL) { } INLINE PStatCollector(const PStatCollector &, - const string &, - const RGBColorf & = RGBColorf::zero(), - int = -1) { } + const string &, + const RGBColorf & = RGBColorf::zero(), + int = -1) { } INLINE bool is_active() { return false; } INLINE bool is_active(const PStatThread &) { return false; } diff --git a/panda/src/pstatclient/pStatCollectorDef.h b/panda/src/pstatclient/pStatCollectorDef.h index 2fa1770d36..d28fdff078 100644 --- a/panda/src/pstatclient/pStatCollectorDef.h +++ b/panda/src/pstatclient/pStatCollectorDef.h @@ -16,7 +16,7 @@ class PStatClient; class PStatClientVersion; //////////////////////////////////////////////////////////////////// -// Class : PStatCollectorDef +// Class : PStatCollectorDef // Description : Defines the details about the Collectors: the name, // the suggested color, etc. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pstatclient/pStatFrameData.h b/panda/src/pstatclient/pStatFrameData.h index 9f4aedaf05..b3dd94e290 100644 --- a/panda/src/pstatclient/pStatFrameData.h +++ b/panda/src/pstatclient/pStatFrameData.h @@ -17,7 +17,7 @@ class DatagramIterator; class PStatClientVersion; //////////////////////////////////////////////////////////////////// -// Class : PStatFrameData +// Class : PStatFrameData // Description : Contains the raw timing and level data for a single // frame. This is a sequence of start/stop events, as // well as a table of level values, associated with a diff --git a/panda/src/pstatclient/pStatServerControlMessage.h b/panda/src/pstatclient/pStatServerControlMessage.h index 8ca0291974..0c8aae2fc0 100644 --- a/panda/src/pstatclient/pStatServerControlMessage.h +++ b/panda/src/pstatclient/pStatServerControlMessage.h @@ -13,7 +13,7 @@ class Datagram; //////////////////////////////////////////////////////////////////// -// Class : PStatServerControlMessage +// Class : PStatServerControlMessage // Description : This kind of message is sent from the server to the // client on the TCP socket to establish critical // control information. diff --git a/panda/src/pstatclient/pStatThread.h b/panda/src/pstatclient/pStatThread.h index 0e26b37daf..8e050e7906 100644 --- a/panda/src/pstatclient/pStatThread.h +++ b/panda/src/pstatclient/pStatThread.h @@ -11,7 +11,7 @@ #include "pStatClient.h" //////////////////////////////////////////////////////////////////// -// Class : PStatThread +// Class : PStatThread // Description : A lightweight class that represents a single thread // of execution to PStats. It doesn't have any real // connection to any actual threads, but it's used to diff --git a/panda/src/pstatclient/pStatTimer.h b/panda/src/pstatclient/pStatTimer.h index 113749f832..61a815b913 100644 --- a/panda/src/pstatclient/pStatTimer.h +++ b/panda/src/pstatclient/pStatTimer.h @@ -11,7 +11,7 @@ #include "pStatCollector.h" //////////////////////////////////////////////////////////////////// -// Class : PStatTimer +// Class : PStatTimer // Description : A lightweight class that can be used to automatically // start and stop a PStatCollector around a section of // code. It's intended to be used in the following way: diff --git a/panda/src/pstatclient/test_client.cxx b/panda/src/pstatclient/test_client.cxx index 66c340f9e1..c9ac434bf2 100644 --- a/panda/src/pstatclient/test_client.cxx +++ b/panda/src/pstatclient/test_client.cxx @@ -116,7 +116,7 @@ main(int argc, char *argv[]) { } if (ds_index < 0 || ds_index >= NUM_DATASETS) { nout << "Invalid dataset; choose a number in the range 0 to " - << NUM_DATASETS - 1 << "\n"; + << NUM_DATASETS - 1 << "\n"; exit(1); } @@ -177,9 +177,9 @@ main(int argc, char *argv[]) { for (wi = wait.begin(); wi != wait.end(); ++wi) { const WaitRequest &wr = (*wi); if (wr._start) { - _collectors[wr._index].start(client->get_main_thread(), wr._time); + _collectors[wr._index].start(client->get_main_thread(), wr._time); } else { - _collectors[wr._index].stop(client->get_main_thread(), wr._time); + _collectors[wr._index].stop(client->get_main_thread(), wr._time); } } diff --git a/panda/src/putil/bamReader.I b/panda/src/putil/bamReader.I index f8f9ac2139..27918226c1 100644 --- a/panda/src/putil/bamReader.I +++ b/panda/src/putil/bamReader.I @@ -97,8 +97,8 @@ create_factory() { // managing BamReader object //////////////////////////////////////////////////////////////////// INLINE void -parse_params(const FactoryParams ¶ms, - DatagramIterator &scan, BamReader *&manager) { +parse_params(const FactoryParams ¶ms, + DatagramIterator &scan, BamReader *&manager) { BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0)); scan = param->get_iterator(); diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index 5b8ab9d338..702e2b6ce2 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -79,13 +79,13 @@ init() { if (_bam_minor_ver == 0) { bam_cat.error() - << "This program can only load version " - << _bam_major_ver << ".0 bams.\n"; + << "This program can only load version " + << _bam_major_ver << ".0 bams.\n"; } else { bam_cat.error() - << "This program can only load version " - << _bam_major_ver << ".0 through " - << _bam_major_ver << "." << _bam_minor_ver << " bams.\n"; + << "This program can only load version " + << _bam_major_ver << ".0 through " + << _bam_major_ver << "." << _bam_minor_ver << " bams.\n"; } return false; @@ -97,8 +97,8 @@ init() { << ".\n"; if (_file_minor != _bam_minor_ver) { bam_cat.debug() - << "(Current version is " << _bam_major_ver << "." << _bam_minor_ver - << ".)\n"; + << "(Current version is " << _bam_major_ver << "." << _bam_minor_ver + << ".)\n"; } } @@ -150,7 +150,7 @@ read_object() { if (object_id == 0) { if (bam_cat.is_spam()) { bam_cat.spam() - << "Returning NULL\n"; + << "Returning NULL\n"; } return (TypedWritable *)NULL; } @@ -167,8 +167,8 @@ read_object() { if (bam_cat.is_spam()) { if (object != (TypedWritable *)NULL) { - bam_cat.spam() - << "Returning object of type " << object->get_type() << "\n"; + bam_cat.spam() + << "Returning object of type " << object->get_type() << "\n"; } } @@ -219,20 +219,20 @@ resolve() { int object_id = (*pi); if (object_id == 0) { - // A NULL pointer is a NULL pointer. - references.push_back((TypedWritable *)NULL); + // A NULL pointer is a NULL pointer. + references.push_back((TypedWritable *)NULL); } else { - // See if we have the pointer available now. - CreatedObjs::const_iterator oi = _created_objs.find(object_id); - if (oi == _created_objs.end()) { - // No, too bad. - is_complete = false; + // See if we have the pointer available now. + CreatedObjs::const_iterator oi = _created_objs.find(object_id); + if (oi == _created_objs.end()) { + // No, too bad. + is_complete = false; - } else { - // Yes, it's ready. - references.push_back((*oi).second); - } + } else { + // Yes, it's ready. + references.push_back((*oi).second); + } } } @@ -250,7 +250,7 @@ resolve() { } else { // Couldn't complete this object yet; it'll wait for next time. bam_cat.warning() - << "Unable to complete " << whom->get_type() << "\n"; + << "Unable to complete " << whom->get_type() << "\n"; ++ri; all_completed = false; } @@ -326,9 +326,9 @@ read_handle(DatagramIterator &scan) { TypeRegistry::ptr()->record_derivation(type, parent_type); } else { if (type.get_parent_towards(parent_type) != parent_type) { - bam_cat.warning() - << "Bam file indicates a derivation of " << type - << " from " << parent_type << " which is no longer true.\n"; + bam_cat.warning() + << "Bam file indicates a derivation of " << type + << " from " << parent_type << " which is no longer true.\n"; } } } @@ -543,7 +543,7 @@ p_read_object() { if (bam_cat.is_debug()) { bam_cat.debug() - << "Reached end of bam source.\n"; + << "Reached end of bam source.\n"; } return 0; } @@ -597,18 +597,18 @@ p_read_object() { //Just some sanity checks if (object == (TypedWritable *)NULL) { bam_cat.error() - << "Unable to create an object of type " << type << endl; + << "Unable to create an object of type " << type << endl; } else if (object->get_type() != type) { bam_cat.warning() - << "Attempted to create a " << type.get_name() \ - << " but a " << object->get_type() \ - << " was created instead." << endl; + << "Attempted to create a " << type.get_name() \ + << " but a " << object->get_type() \ + << " was created instead." << endl; } else { if (bam_cat.is_spam()) { - bam_cat.spam() - << "Read a " << object->get_type() << "\n"; + bam_cat.spam() + << "Read a " << object->get_type() << "\n"; } } } diff --git a/panda/src/putil/bamReader.h b/panda/src/putil/bamReader.h index 98f9ebe2d9..ae55b78c1c 100644 --- a/panda/src/putil/bamReader.h +++ b/panda/src/putil/bamReader.h @@ -34,7 +34,7 @@ } //////////////////////////////////////////////////////////////////// -// Class : BamReader +// Class : BamReader // Description : This is the fundamental interface for extracting // binary objects from a Bam file, as generated by a // BamWriter. @@ -165,7 +165,7 @@ typedef BamReader::WritableFactory WritableFactory; // BamReader pointers. INLINE void parse_params(const FactoryParams ¶ms, - DatagramIterator &scan, BamReader *&manager); + DatagramIterator &scan, BamReader *&manager); #include "bamReader.I" diff --git a/panda/src/putil/bamReaderParam.h b/panda/src/putil/bamReaderParam.h index da1da6304b..c7bd0db483 100644 --- a/panda/src/putil/bamReaderParam.h +++ b/panda/src/putil/bamReaderParam.h @@ -14,7 +14,7 @@ class BamReader; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : BamReaderParam +// Class : BamReaderParam // Description : The parameters that are passed through the Factory to // any object constructing itself from a Bam file. //////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "BamReaderParam", - FactoryParam::get_class_type()); + FactoryParam::get_class_type()); } private: diff --git a/panda/src/putil/bamWriter.cxx b/panda/src/putil/bamWriter.cxx index 904c276040..800885cb60 100644 --- a/panda/src/putil/bamWriter.cxx +++ b/panda/src/putil/bamWriter.cxx @@ -133,7 +133,7 @@ write_object(TypedWritable *object) { if (!_target->put_datagram(dg)) { util_cat.error() - << "Unable to write datagram to file.\n"; + << "Unable to write datagram to file.\n"; return false; } } @@ -283,7 +283,7 @@ write_handle(Datagram &packet, TypeHandle type) { nassertv(num_parent_classes <= 255); // Good grief! packet.add_uint8(num_parent_classes); for (int i = 0; i < num_parent_classes; i++) { - write_handle(packet, type.get_parent_class(i)); + write_handle(packet, type.get_parent_class(i)); } } } diff --git a/panda/src/putil/bamWriter.h b/panda/src/putil/bamWriter.h index bca4910326..e8da72eef6 100644 --- a/panda/src/putil/bamWriter.h +++ b/panda/src/putil/bamWriter.h @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////// -// Class : BamWriter +// Class : BamWriter // Description : This is the fundamental interface for writing binary // objects to a Bam file, to be extracted later by a // BamReader. diff --git a/panda/src/putil/buttonEvent.I b/panda/src/putil/buttonEvent.I index c574d7dfd0..8b5423bceb 100644 --- a/panda/src/putil/buttonEvent.I +++ b/panda/src/putil/buttonEvent.I @@ -59,7 +59,7 @@ operator = (const ButtonEvent ©) { INLINE bool ButtonEvent:: operator == (const ButtonEvent &other) const { return (_button == other._button && - _down == other._down); + _down == other._down); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/buttonEvent.h b/panda/src/putil/buttonEvent.h index 76098751c5..59a070d7b1 100644 --- a/panda/src/putil/buttonEvent.h +++ b/panda/src/putil/buttonEvent.h @@ -11,7 +11,7 @@ #include "buttonHandle.h" //////////////////////////////////////////////////////////////////// -// Class : ButtonEvent +// Class : ButtonEvent // Description : Records a transition of one button from up to down or // vice-versa. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/buttonHandle.h b/panda/src/putil/buttonHandle.h index 4da440c46c..6da876ec50 100644 --- a/panda/src/putil/buttonHandle.h +++ b/panda/src/putil/buttonHandle.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ButtonHandle +// Class : ButtonHandle // Description : A ButtonHandle represents a single button from any // device, including keyboard buttons and mouse buttons // (but see KeyboardButton and MouseButton). diff --git a/panda/src/putil/buttonRegistry.h b/panda/src/putil/buttonRegistry.h index aa68c3295f..b793201aee 100644 --- a/panda/src/putil/buttonRegistry.h +++ b/panda/src/putil/buttonRegistry.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ButtonRegistry +// Class : ButtonRegistry // Description : The ButtonRegistry class maintains all the assigned // ButtonHandles in a given system. There should be only // one ButtonRegistry class during the lifetime of the @@ -33,7 +33,7 @@ protected: public: bool register_button(ButtonHandle &button_handle, const string &name, - char ascii_equivalent = '\0'); + char ascii_equivalent = '\0'); PUBLISHED: ButtonHandle get_button(const string &name); diff --git a/panda/src/putil/configurable.h b/panda/src/putil/configurable.h index e007cf7e3e..db98d277b0 100644 --- a/panda/src/putil/configurable.h +++ b/panda/src/putil/configurable.h @@ -21,9 +21,9 @@ //////////////////////////////////////////////////////////////////// // Class : Configurable // Description : An object that has data or parameters that are set -// less frequently (at least occasionally) than every -// frame. We can cache the configuration info by -// by using the "dirty" flag. +// less frequently (at least occasionally) than every +// frame. We can cache the configuration info by +// by using the "dirty" flag. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Configurable : public TypedObject { public: @@ -57,7 +57,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "Configurable", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/putil/factory.I b/panda/src/putil/factory.I index 52ee44beda..81232072e1 100644 --- a/panda/src/putil/factory.I +++ b/panda/src/putil/factory.I @@ -66,7 +66,7 @@ make_instance_more_general(TypeHandle handle, const FactoryParams ¶ms) { template INLINE Type *Factory:: make_instance_more_general(const string &type_name, - const FactoryParams ¶ms) { + const FactoryParams ¶ms) { return (Type *)FactoryBase::make_instance_more_general(type_name, params); } diff --git a/panda/src/putil/factory.h b/panda/src/putil/factory.h index ea22316339..a5ada22113 100644 --- a/panda/src/putil/factory.h +++ b/panda/src/putil/factory.h @@ -11,7 +11,7 @@ #include "factoryBase.h" //////////////////////////////////////////////////////////////////// -// Class : Factory +// Class : Factory // Description : A Factory can be used to create an instance of a // particular subclass of some general base class. Each // subclass registers itself with the Factory, supplying @@ -34,18 +34,18 @@ public: typedef Type *CreateFunc(const FactoryParams ¶ms); INLINE Type *make_instance(TypeHandle handle, - const FactoryParams ¶ms = FactoryParams()); + const FactoryParams ¶ms = FactoryParams()); INLINE Type *make_instance(const string &type_name, - const FactoryParams ¶ms = FactoryParams()); + const FactoryParams ¶ms = FactoryParams()); INLINE Type * make_instance_more_general(TypeHandle handle, - const FactoryParams ¶ms = FactoryParams()); + const FactoryParams ¶ms = FactoryParams()); INLINE Type * make_instance_more_general(const string &type_name, - const FactoryParams ¶ms = FactoryParams()); + const FactoryParams ¶ms = FactoryParams()); INLINE void register_factory(TypeHandle handle, CreateFunc *func); }; diff --git a/panda/src/putil/factoryBase.I b/panda/src/putil/factoryBase.I index f603c5e9e8..260fa44d3e 100644 --- a/panda/src/putil/factoryBase.I +++ b/panda/src/putil/factoryBase.I @@ -40,7 +40,7 @@ make_instance(const string &type_name, const FactoryParams ¶ms) { //////////////////////////////////////////////////////////////////// INLINE TypedObject *FactoryBase:: make_instance_more_general(const string &type_name, - const FactoryParams ¶ms) { + const FactoryParams ¶ms) { TypeHandle handle = TypeRegistry::ptr()->find_type(type_name); nassertr(handle != TypeHandle::none(), NULL); diff --git a/panda/src/putil/factoryBase.cxx b/panda/src/putil/factoryBase.cxx index 1d5cca4d2a..dce6dc795c 100644 --- a/panda/src/putil/factoryBase.cxx +++ b/panda/src/putil/factoryBase.cxx @@ -50,7 +50,7 @@ make_instance(TypeHandle handle, const FactoryParams ¶ms) { << (void *)instance; if (instance != (TypedObject *)NULL) { util_cat.debug(false) - << ", of type " << instance->get_type(); + << ", of type " << instance->get_type(); } util_cat.debug(false) << "\n"; } @@ -84,7 +84,7 @@ make_instance_more_general(TypeHandle handle, const FactoryParams ¶ms) { << (void *)object; if (object != (TypedObject *)NULL) { util_cat.debug(false) - << ", of type " << object->get_type(); + << ", of type " << object->get_type(); } util_cat.debug(false) << "\n"; } @@ -262,7 +262,7 @@ make_instance_more_specific(TypeHandle handle, const FactoryParams ¶ms) { if (ptype.is_derived_from(handle)) { TypedObject *object = make_instance_exact(ptype, params); if (object != (TypedObject *)NULL) { - return object; + return object; } } } @@ -278,7 +278,7 @@ make_instance_more_specific(TypeHandle handle, const FactoryParams ¶ms) { nassertr(func != (BaseCreateFunc *)NULL, NULL); TypedObject *object = (*func)(params); if (object != (TypedObject *)NULL) { - return object; + return object; } } } diff --git a/panda/src/putil/factoryBase.h b/panda/src/putil/factoryBase.h index 6e05941f6c..5e09a10eeb 100644 --- a/panda/src/putil/factoryBase.h +++ b/panda/src/putil/factoryBase.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FactoryBase +// Class : FactoryBase // Description : A Factory can be used to create an instance of a // particular subclass of some general base class. Each // subclass registers itself with the Factory, supplying @@ -39,16 +39,16 @@ public: ~FactoryBase(); TypedObject *make_instance(TypeHandle handle, - const FactoryParams ¶ms); + const FactoryParams ¶ms); INLINE TypedObject *make_instance(const string &type_name, - const FactoryParams ¶ms); + const FactoryParams ¶ms); TypedObject *make_instance_more_general(TypeHandle handle, - const FactoryParams ¶ms); + const FactoryParams ¶ms); INLINE TypedObject *make_instance_more_general(const string &type_name, - const FactoryParams ¶ms); + const FactoryParams ¶ms); void register_factory(TypeHandle handle, BaseCreateFunc *func); @@ -69,9 +69,9 @@ private: // internal utility functions TypedObject *make_instance_exact(TypeHandle handle, - const FactoryParams ¶ms); + const FactoryParams ¶ms); TypedObject *make_instance_more_specific(TypeHandle handle, - const FactoryParams ¶ms); + const FactoryParams ¶ms); private: // internal mechanics and bookkeeping diff --git a/panda/src/putil/factoryParam.h b/panda/src/putil/factoryParam.h index 3cd223c4bd..5c854416a2 100644 --- a/panda/src/putil/factoryParam.h +++ b/panda/src/putil/factoryParam.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FactoryParam +// Class : FactoryParam // Description : The base class of any number of specific pieces of // parameter information that might be passed to a // Factory's CreateFunc to control what kind of instance @@ -40,7 +40,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "FactoryParam", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } private: diff --git a/panda/src/putil/factoryParams.h b/panda/src/putil/factoryParams.h index a0bdb464e1..c4a8136589 100644 --- a/panda/src/putil/factoryParams.h +++ b/panda/src/putil/factoryParams.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FactoryParams +// Class : FactoryParams // Description : An instance of this class is passed to the Factory // when requesting it to do its business and construct a // new something. It can be filled with optional diff --git a/panda/src/putil/globPattern.I b/panda/src/putil/globPattern.I index 43383bbcd5..4969c6da54 100644 --- a/panda/src/putil/globPattern.I +++ b/panda/src/putil/globPattern.I @@ -63,7 +63,7 @@ get_pattern() const { INLINE bool GlobPattern:: matches(const string &candidate) const { return matches_substr(_pattern.begin(), _pattern.end(), - candidate.begin(), candidate.end()); + candidate.begin(), candidate.end()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/globPattern.cxx b/panda/src/putil/globPattern.cxx index c593ca0ee3..f7c499c020 100644 --- a/panda/src/putil/globPattern.cxx +++ b/panda/src/putil/globPattern.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// bool GlobPattern:: matches_substr(string::const_iterator pi, string::const_iterator pend, - string::const_iterator ci, string::const_iterator cend) const { + string::const_iterator ci, string::const_iterator cend) const { // If we run out of pattern or candidate string, it's a match only // if they both ran out at the same time. if (pi == pend || ci == cend) { @@ -51,11 +51,11 @@ matches_substr(string::const_iterator pi, string::const_iterator pend, if ((*pi) == '!') { ++pi; if (matches_set(pi, pend, *ci)) { - return false; + return false; } } else { if (!matches_set(pi, pend, *ci)) { - return false; + return false; } } if (pi == pend) { @@ -94,7 +94,7 @@ matches_substr(string::const_iterator pi, string::const_iterator pend, //////////////////////////////////////////////////////////////////// bool GlobPattern:: matches_set(string::const_iterator &pi, string::const_iterator pend, - char ch) const { + char ch) const { bool matched = false; while (pi != pend && (*pi) != ']') { @@ -102,7 +102,7 @@ matches_set(string::const_iterator &pi, string::const_iterator pend, // Backslash escapes the next character. ++pi; if (pi == pend) { - return false; + return false; } } @@ -116,33 +116,33 @@ matches_set(string::const_iterator &pi, string::const_iterator pend, if (pi != pend && (*pi) == '-') { ++pi; if (pi != pend && (*pi) != ']') { - // Yes, we have a range: start-end. + // Yes, we have a range: start-end. - if ((*pi) == '\\') { - // Backslash escapes. - ++pi; - if (pi == pend) { - return false; - } - } + if ((*pi) == '\\') { + // Backslash escapes. + ++pi; + if (pi == pend) { + return false; + } + } - char end = (*pi); - ++pi; + char end = (*pi); + ++pi; - if (ch >= start && ch <= end) { - matched = true; - } + if (ch >= start && ch <= end) { + matched = true; + } } else { - // This was a - at the end of the string. - if (ch == '-') { - matched = true; - } + // This was a - at the end of the string. + if (ch == '-') { + matched = true; + } } } } return matched; } - + diff --git a/panda/src/putil/globPattern.h b/panda/src/putil/globPattern.h index 725d010033..14fd180050 100644 --- a/panda/src/putil/globPattern.h +++ b/panda/src/putil/globPattern.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GlobPattern +// Class : GlobPattern // Description : This class can be used to test for string matches // against standard Unix-shell filename globbing // conventions. It serves as a portable standin for the @@ -38,13 +38,13 @@ public: private: bool matches_substr(string::const_iterator pi, - string::const_iterator pend, - string::const_iterator ci, - string::const_iterator cend) const; + string::const_iterator pend, + string::const_iterator ci, + string::const_iterator cend) const; bool matches_set(string::const_iterator &pi, - string::const_iterator pend, - char ch) const; + string::const_iterator pend, + char ch) const; string _pattern; }; diff --git a/panda/src/putil/globalPointerRegistry.cxx b/panda/src/putil/globalPointerRegistry.cxx index 6fa1761fb2..dbc79e1e02 100644 --- a/panda/src/putil/globalPointerRegistry.cxx +++ b/panda/src/putil/globalPointerRegistry.cxx @@ -63,13 +63,13 @@ ns_store_pointer(TypeHandle type, void *ptr) { // There was already a pointer in the map. if ((*result.first).second == ptr) { util_cat->error() - << "Invalid attempt to store pointer " << ptr - << " twice for " << type << "\n"; + << "Invalid attempt to store pointer " << ptr + << " twice for " << type << "\n"; } else { util_cat->error() - << "Invalid attempt to store additional pointer " << ptr - << " for " << type << "; " << (*result.first).second - << " stored previously.\n"; + << "Invalid attempt to store additional pointer " << ptr + << " for " << type << "; " << (*result.first).second + << " stored previously.\n"; } } } diff --git a/panda/src/putil/globalPointerRegistry.h b/panda/src/putil/globalPointerRegistry.h index a8208f58cb..fe35d1e746 100644 --- a/panda/src/putil/globalPointerRegistry.h +++ b/panda/src/putil/globalPointerRegistry.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GlobalPointerRegistry +// Class : GlobalPointerRegistry // Description : This class maintains a one-to-one mapping from // TypeHandle to a void * pointer. Its purpose is to // store a pointer to some class data for a given class. diff --git a/panda/src/putil/indirectCompareNames.h b/panda/src/putil/indirectCompareNames.h index ac98adf0a0..2458727a10 100644 --- a/panda/src/putil/indirectCompareNames.h +++ b/panda/src/putil/indirectCompareNames.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : IndirectCompareNames +// Class : IndirectCompareNames // Description : An STL function object class, this is intended to be // used on any ordered collection of pointers to classes // that define a get_name() method, particularly for diff --git a/panda/src/putil/indirectCompareTo.h b/panda/src/putil/indirectCompareTo.h index dae79765ab..151f718dbe 100644 --- a/panda/src/putil/indirectCompareTo.h +++ b/panda/src/putil/indirectCompareTo.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : IndirectCompareTo +// Class : IndirectCompareTo // Description : An STL function object class, this is intended to be // used on any ordered collection of pointers to classes // that contain a compare_to() method. It defines the diff --git a/panda/src/putil/ioPtaDatagramFloat.h b/panda/src/putil/ioPtaDatagramFloat.h index 677ee6f02f..b7a6b945b3 100644 --- a/panda/src/putil/ioPtaDatagramFloat.h +++ b/panda/src/putil/ioPtaDatagramFloat.h @@ -15,7 +15,7 @@ class Datagram; class DatagramIterator; /////////////////////////////////////////////////////////////////// -// Class : IoPtaDatagramFloat +// Class : IoPtaDatagramFloat // Description : This class is used to read and write a PTA_float // from a Datagram, in support of Bam. It's not // intended to be constructed; it's just a convenient diff --git a/panda/src/putil/ioPtaDatagramInt.h b/panda/src/putil/ioPtaDatagramInt.h index d509adcaba..5fa549f895 100644 --- a/panda/src/putil/ioPtaDatagramInt.h +++ b/panda/src/putil/ioPtaDatagramInt.h @@ -15,7 +15,7 @@ class Datagram; class DatagramIterator; /////////////////////////////////////////////////////////////////// -// Class : IoPtaDatagramInt +// Class : IoPtaDatagramInt // Description : This class is used to read and write a PTA_int from a // Datagram, in support of Bam. It's not intended to be // constructed; it's just a convenient place to scope diff --git a/panda/src/putil/ioPtaDatagramShort.h b/panda/src/putil/ioPtaDatagramShort.h index f378e6384d..b0264b078e 100644 --- a/panda/src/putil/ioPtaDatagramShort.h +++ b/panda/src/putil/ioPtaDatagramShort.h @@ -15,7 +15,7 @@ class Datagram; class DatagramIterator; /////////////////////////////////////////////////////////////////// -// Class : IoPtaDatagramShort +// Class : IoPtaDatagramShort // Description : This class is used to read and write a PTA_ushort // from a Datagram, in support of Bam. It's not // intended to be constructed; it's just a convenient diff --git a/panda/src/putil/iterator_types.h b/panda/src/putil/iterator_types.h index 833492c842..9e3da77e3d 100644 --- a/panda/src/putil/iterator_types.h +++ b/panda/src/putil/iterator_types.h @@ -8,7 +8,7 @@ //////////////////////////////////////////////////////////////////// -// Class : first_of_pair_iterator +// Class : first_of_pair_iterator // Description : This is an iterator adaptor that converts any // iterator that returns a pair (e.g. a map iterator) // into one that returns just the first component of @@ -29,7 +29,7 @@ public: }; //////////////////////////////////////////////////////////////////// -// Class : second_of_pair_iterator +// Class : second_of_pair_iterator // Description : This is an iterator adaptor that converts any // iterator that returns a pair (e.g. a map iterator) // into one that returns just the second component of @@ -50,7 +50,7 @@ public: }; //////////////////////////////////////////////////////////////////// -// Class : typecast_iterator +// Class : typecast_iterator // Description : This is an iterator adaptor that explicitly typecasts // each value returned by the base iterator to the // indicated type. diff --git a/panda/src/putil/keyboardButton.h b/panda/src/putil/keyboardButton.h index 9244b1fea7..9e8c28474e 100644 --- a/panda/src/putil/keyboardButton.h +++ b/panda/src/putil/keyboardButton.h @@ -11,7 +11,7 @@ #include "buttonHandle.h" //////////////////////////////////////////////////////////////////// -// Class : KeyboardButton +// Class : KeyboardButton // Description : This class is just used as a convenient namespace for // grouping all of these handy functions that return // buttons which map to standard keyboard keys. diff --git a/panda/src/putil/modifierButtons.I b/panda/src/putil/modifierButtons.I index 4c8a6ee2d0..22168b9b2b 100644 --- a/panda/src/putil/modifierButtons.I +++ b/panda/src/putil/modifierButtons.I @@ -23,7 +23,7 @@ operator = (const ModifierButtons ©) { INLINE bool ModifierButtons:: operator == (const ModifierButtons &other) const { return (_button_list == other._button_list && - _state == other._state); + _state == other._state); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/modifierButtons.h b/panda/src/putil/modifierButtons.h index 718311fa1a..26e67a7ad7 100644 --- a/panda/src/putil/modifierButtons.h +++ b/panda/src/putil/modifierButtons.h @@ -13,7 +13,7 @@ #include "buttonEvent.h" //////////////////////////////////////////////////////////////////// -// Class : ModifierButtons +// Class : ModifierButtons // Description : This class monitors the state of a number of // individual buttons and tracks whether each button is // known to be down or up. diff --git a/panda/src/putil/mouseButton.h b/panda/src/putil/mouseButton.h index a7f1573598..e26a1a34da 100644 --- a/panda/src/putil/mouseButton.h +++ b/panda/src/putil/mouseButton.h @@ -11,7 +11,7 @@ #include "buttonHandle.h" //////////////////////////////////////////////////////////////////// -// Class : MouseButton +// Class : MouseButton // Description : This class is just used as a convenient namespace for // grouping all of these handy functions that return // buttons which map to standard mouse buttons. diff --git a/panda/src/putil/nameUniquifier.cxx b/panda/src/putil/nameUniquifier.cxx index 946345983b..f299001cb0 100644 --- a/panda/src/putil/nameUniquifier.cxx +++ b/panda/src/putil/nameUniquifier.cxx @@ -24,7 +24,7 @@ //////////////////////////////////////////////////////////////////// NameUniquifier:: NameUniquifier(const string &separator, - const string &empty) : + const string &empty) : _separator(separator), _empty(empty) { diff --git a/panda/src/putil/nameUniquifier.h b/panda/src/putil/nameUniquifier.h index f1e8ae4fed..2ccd6bcd77 100644 --- a/panda/src/putil/nameUniquifier.h +++ b/panda/src/putil/nameUniquifier.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : NameUniquifier +// Class : NameUniquifier // Description : A handy class for converting a list of arbitrary // names (strings) so that each name is guaranteed to be // unique in the list. Useful for writing egg files @@ -22,7 +22,7 @@ class EXPCL_PANDA NameUniquifier { public: NameUniquifier(const string &separator = string(), - const string &empty = string()); + const string &empty = string()); ~NameUniquifier(); INLINE string add_name(const string &name); diff --git a/panda/src/putil/pointerToArray.I b/panda/src/putil/pointerToArray.I index 4a5956b477..4711bbeb34 100644 --- a/panda/src/putil/pointerToArray.I +++ b/panda/src/putil/pointerToArray.I @@ -221,7 +221,7 @@ INLINE PointerToArray::iterator PointerToArray:: insert(iterator position, const Element &x) const { nassertr(_ptr != NULL, position); nassertr(position >= _ptr->begin() && - position <= _ptr->end(), position); + position <= _ptr->end(), position); return _ptr->insert(position, x); } @@ -235,7 +235,7 @@ INLINE void PointerToArray:: insert(iterator position, size_type n, const Element &x) const { nassertv(_ptr != NULL); nassertv(position >= _ptr->begin() && - position <= _ptr->end()); + position <= _ptr->end()); _ptr->insert(position, n, x); } @@ -251,7 +251,7 @@ erase(iterator position) const { ((PointerToArray *)this)->reassign(new RefCountObj >); } nassertv(position >= _ptr->begin() && - position <= _ptr->end()); + position <= _ptr->end()); _ptr->erase(position); } diff --git a/panda/src/putil/pointerToArray.h b/panda/src/putil/pointerToArray.h index 98febcef5b..b75ee62a57 100644 --- a/panda/src/putil/pointerToArray.h +++ b/panda/src/putil/pointerToArray.h @@ -63,7 +63,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PointerToArray +// Class : PointerToArray // Description : A special kind of PointerTo that stores an array of // the indicated element type, instead of a single // element. This is actually implemented as an STL @@ -170,7 +170,7 @@ private: }; //////////////////////////////////////////////////////////////////// -// Class : ConstPointerToArray +// Class : ConstPointerToArray // Description : Similar to PointerToArray, except that its contents // may not be modified. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/string_utils.h b/panda/src/putil/string_utils.h index ce149ce351..7435010b85 100644 --- a/panda/src/putil/string_utils.h +++ b/panda/src/putil/string_utils.h @@ -29,7 +29,7 @@ EXPCL_PANDA int extract_words(const string &str, vector_string &words); // Separates the string into words according to the indicated delimiters. EXPCL_PANDA void tokenize(const string &str, vector_string &words, - const string &delimiters); + const string &delimiters); // Trims leading and/or trailing whitespace from the string. EXPCL_PANDA string trim_left(const string &str); diff --git a/panda/src/putil/test_bam.h b/panda/src/putil/test_bam.h index c3bf97161a..0cd3620565 100644 --- a/panda/src/putil/test_bam.h +++ b/panda/src/putil/test_bam.h @@ -25,7 +25,7 @@ public: static TypedWritable *make_person(const FactoryParams ¶ms); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: void fillin(Person*,DatagramIterator&,BamReader*); public: @@ -60,7 +60,7 @@ public: static void init_type() { TypedWritableReferenceCount::init_type(); register_type(_type_handle, "Person", - TypedWritableReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -80,7 +80,7 @@ public: static TypedWritable *make_parent(const FactoryParams ¶ms); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: void fillin(Parent*,DatagramIterator&,BamReader*); public: @@ -106,7 +106,7 @@ public: static void init_type() { Person::init_type(); register_type(_type_handle, "Parent", - Person::get_class_type()); + Person::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -126,7 +126,7 @@ public: static TypedWritable *make_child(const FactoryParams ¶ms); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: void fillin(Child*,DatagramIterator&,BamReader*); public: diff --git a/panda/src/putil/test_filename.cxx b/panda/src/putil/test_filename.cxx index 61778decef..00bd246aa9 100644 --- a/panda/src/putil/test_filename.cxx +++ b/panda/src/putil/test_filename.cxx @@ -44,16 +44,16 @@ main(int argc, char *argv[]) { if (argc >= 3) { Filename t(argv[2]); nout << "f is " << f << " exists = " << f.exists() << "\n" - << "t is " << t << " exists = " << t.exists() << "\n"; + << "t is " << t << " exists = " << t.exists() << "\n"; nout << "f.compare_timestamps(t, true, true) = " - << f.compare_timestamps(t, true, true) << "\n" - << "f.compare_timestamps(t, true, false) = " - << f.compare_timestamps(t, true, false) << "\n" - << "f.compare_timestamps(t, false, true) = " - << f.compare_timestamps(t, false, true) << "\n" - << "f.compare_timestamps(t, false, false) = " - << f.compare_timestamps(t, false, false) << "\n"; + << f.compare_timestamps(t, true, true) << "\n" + << "f.compare_timestamps(t, true, false) = " + << f.compare_timestamps(t, true, false) << "\n" + << "f.compare_timestamps(t, false, true) = " + << f.compare_timestamps(t, false, true) << "\n" + << "f.compare_timestamps(t, false, false) = " + << f.compare_timestamps(t, false, false) << "\n"; } /* if (argc >= 3) { diff --git a/panda/src/putil/test_glob.cxx b/panda/src/putil/test_glob.cxx index 26be65b123..d9a47d4b6f 100644 --- a/panda/src/putil/test_glob.cxx +++ b/panda/src/putil/test_glob.cxx @@ -34,9 +34,9 @@ main(int argc, char *argv[]) { if (dp != 0) { do { if (pattern.matches(fd.name)) { - cout << "Matches: " << fd.name << "\n"; + cout << "Matches: " << fd.name << "\n"; } else { - cout << "Fails: " << fd.name << "\n"; + cout << "Fails: " << fd.name << "\n"; } } while (_findnext(dp, &fd) == 0); } diff --git a/panda/src/putil/test_linestream.cxx b/panda/src/putil/test_linestream.cxx index 0995ce952e..927ace5bc5 100644 --- a/panda/src/putil/test_linestream.cxx +++ b/panda/src/putil/test_linestream.cxx @@ -15,11 +15,11 @@ main(int argc, char *argv[]) { while (ls) { if ((i % 5) == 0) { if (ls.is_text_available()) { - nout << "Got line: '" << ls.get_line() << "'"; - if (ls.has_newline()) { - nout << " (nl)"; - } - nout << "\n"; + nout << "Got line: '" << ls.get_line() << "'"; + if (ls.has_newline()) { + nout << " (nl)"; + } + nout << "\n"; } } diff --git a/panda/src/putil/test_types.cxx b/panda/src/putil/test_types.cxx index 45b79088d8..e503a1bf98 100644 --- a/panda/src/putil/test_types.cxx +++ b/panda/src/putil/test_types.cxx @@ -25,7 +25,7 @@ public: TypedObject::init_type(); ReferenceCount::init_type(); register_type(_type_handle, "ThatThingie", - ReferenceCount::get_class_type()); + ReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -116,8 +116,8 @@ public: ThatThingie::init_type(); TheOtherThingie::init_type(); register_type(_type_handle, "WhatAThingie", - ThatThingie::get_class_type(), - TheOtherThingie::get_class_type()); + ThatThingie::get_class_type(), + TheOtherThingie::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -214,7 +214,7 @@ main() { { ConstPointerTo dup_thing_1 = thing_1; nout << "thing_1 is " << thing_1 << " and dup_thing_1 is " - << dup_thing_1 << "\n"; + << dup_thing_1 << "\n"; } nout << "thing_1 is now " << thing_1 << "\n"; diff --git a/panda/src/putil/timedCycle.I b/panda/src/putil/timedCycle.I index 90897444a8..85921e4c6f 100644 --- a/panda/src/putil/timedCycle.I +++ b/panda/src/putil/timedCycle.I @@ -79,7 +79,7 @@ next_element() { double current_time = _global_clock->get_real_time(); unsigned int increment = (unsigned int) ((current_time - _next_switch) - * _inv_cycle_time); + * _inv_cycle_time); _next_switch += _cycle_time * increment; _current_child = (_current_child + increment) % _element_count; diff --git a/panda/src/putil/typedWritable.h b/panda/src/putil/typedWritable.h index 60a4c4adee..5d48bb3020 100644 --- a/panda/src/putil/typedWritable.h +++ b/panda/src/putil/typedWritable.h @@ -12,7 +12,7 @@ class BamReader; //////////////////////////////////////////////////////////////////// -// Class : TypedWritable +// Class : TypedWritable // Description : Convience class to not have to derive from TypedObject // and writable all the time // @@ -51,7 +51,7 @@ public: //a parent reads in a variable number of pointers, so the child //knows where to start reading from. virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: @@ -71,8 +71,8 @@ public: TypedObject::init_type(); Writable::init_type(); register_type(_type_handle, "TypedWritable", - TypedObject::get_class_type(), - Writable::get_class_type()); + TypedObject::get_class_type(), + Writable::get_class_type()); TypeRegistry::ptr()->record_alternate_name(_type_handle, "TypedWriteable"); } virtual TypeHandle get_type() const { diff --git a/panda/src/putil/typedWritableReferenceCount.h b/panda/src/putil/typedWritableReferenceCount.h index 7d566c7e8b..d8ef2a1fb3 100644 --- a/panda/src/putil/typedWritableReferenceCount.h +++ b/panda/src/putil/typedWritableReferenceCount.h @@ -11,7 +11,7 @@ #include "referenceCount.h" //////////////////////////////////////////////////////////////////// -// Class : TypedWritableReferenceCount +// Class : TypedWritableReferenceCount // Description : A base class for things which need to inherit from // both TypedWritable and from ReferenceCount. It's // convenient to define this intermediate base class @@ -45,10 +45,10 @@ public: TypedWritable::init_type(); ReferenceCount::init_type(); register_type(_type_handle, "TypedWritableReferenceCount", - TypedWritable::get_class_type(), - ReferenceCount::get_class_type()); + TypedWritable::get_class_type(), + ReferenceCount::get_class_type()); TypeRegistry::ptr()->record_alternate_name(_type_handle, - "TypedWriteableReferenceCount"); + "TypedWriteableReferenceCount"); } private: diff --git a/panda/src/putil/updateSeq.h b/panda/src/putil/updateSeq.h index f9957dc5a4..a0e78c227a 100644 --- a/panda/src/putil/updateSeq.h +++ b/panda/src/putil/updateSeq.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : UpdateSeq +// Class : UpdateSeq // Description : This is a sequence number that increments // monotonically. It can be used to track cache // updates, or serve as a kind of timestamp for any diff --git a/panda/src/putil/writable.h b/panda/src/putil/writable.h index 307dfab2eb..8d3a576141 100644 --- a/panda/src/putil/writable.h +++ b/panda/src/putil/writable.h @@ -14,7 +14,7 @@ class DatagramIterator; class FactoryParams; //////////////////////////////////////////////////////////////////// -// Class : Writable +// Class : Writable // Description : This is an abstract class that all classes which // need to write themselves in binary form to some // media should inherit from diff --git a/panda/src/putil/writableConfigurable.h b/panda/src/putil/writableConfigurable.h index 98a5ae994d..ada737f301 100644 --- a/panda/src/putil/writableConfigurable.h +++ b/panda/src/putil/writableConfigurable.h @@ -26,9 +26,9 @@ // inherit from TypedObject. // // An object that has data or parameters that are set -// less frequently (at least occasionally) than every -// frame. We can cache the configuration info by -// by using the "dirty" flag. +// less frequently (at least occasionally) than every +// frame. We can cache the configuration info by +// by using the "dirty" flag. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA WritableConfigurable : public TypedWritable { @@ -65,9 +65,9 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "WritableConfigurable", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); TypeRegistry::ptr()->record_alternate_name(_type_handle, - "WriteableConfigurable"); + "WriteableConfigurable"); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/putil/writableParam.h b/panda/src/putil/writableParam.h index a02a8b78f9..bf74e4b781 100644 --- a/panda/src/putil/writableParam.h +++ b/panda/src/putil/writableParam.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : WritableParam +// Class : WritableParam // Description : The specific derivation of FactoryParam that // contains the information needed by a TypedWritable // object. Simply contains a Datagram for the object @@ -47,7 +47,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "WritableParam", - FactoryParam::get_class_type()); + FactoryParam::get_class_type()); } private: diff --git a/panda/src/ribdisplay/config_ribdisplay.cxx b/panda/src/ribdisplay/config_ribdisplay.cxx index 47583a4097..21ab0c9f0a 100644 --- a/panda/src/ribdisplay/config_ribdisplay.cxx +++ b/panda/src/ribdisplay/config_ribdisplay.cxx @@ -15,8 +15,8 @@ NotifyCategoryDef(ribdisplay, "display"); ConfigureFn(config_ribdisplay) { RIBGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory(RIBGraphicsPipe::get_class_type(), - RIBGraphicsPipe::make_RIBGraphicsPipe); + RIBGraphicsPipe::make_RIBGraphicsPipe); RIBGraphicsWindow::init_type(); GraphicsWindow::get_factory().register_factory(RIBGraphicsWindow::get_class_type(), - RIBGraphicsWindow::make_RibGraphicsWindow); + RIBGraphicsWindow::make_RibGraphicsWindow); } diff --git a/panda/src/ribdisplay/ribGraphicsPipe.cxx b/panda/src/ribdisplay/ribGraphicsPipe.cxx index f3919d3318..6337df426b 100644 --- a/panda/src/ribdisplay/ribGraphicsPipe.cxx +++ b/panda/src/ribdisplay/ribGraphicsPipe.cxx @@ -38,7 +38,7 @@ TypeHandle RIBGraphicsPipe::get_class_type(void) { void RIBGraphicsPipe::init_type(void) { NoninteractiveGraphicsPipe::init_type(); register_type(_type_handle, "RIBGraphicsPipe", - NoninteractiveGraphicsPipe::get_class_type()); + NoninteractiveGraphicsPipe::get_class_type()); } TypeHandle RIBGraphicsPipe::get_type(void) const { diff --git a/panda/src/ribdisplay/ribGraphicsPipe.h b/panda/src/ribdisplay/ribGraphicsPipe.h index 4949eba416..8cbd581e9e 100644 --- a/panda/src/ribdisplay/ribGraphicsPipe.h +++ b/panda/src/ribdisplay/ribGraphicsPipe.h @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////// class RIBGraphicsPipe : public NoninteractiveGraphicsPipe { public: - + INLINE RIBGraphicsPipe(const PipeSpecifier&); virtual TypeHandle get_window_type() const; diff --git a/panda/src/ribdisplay/ribGraphicsWindow.cxx b/panda/src/ribdisplay/ribGraphicsWindow.cxx index 85c7fcdd59..51db781a45 100644 --- a/panda/src/ribdisplay/ribGraphicsWindow.cxx +++ b/panda/src/ribdisplay/ribGraphicsWindow.cxx @@ -29,7 +29,7 @@ RIBGraphicsWindow(GraphicsPipe *pipe) : GraphicsWindow(pipe) { //////////////////////////////////////////////////////////////////// RIBGraphicsWindow:: RIBGraphicsWindow(GraphicsPipe *pipe, - const GraphicsWindow::Properties &props) : + const GraphicsWindow::Properties &props) : GraphicsWindow(pipe, props) { setup_window(pipe); @@ -79,7 +79,7 @@ begin_frame() { // If we're writing out an image file for each frame, specify it // here, inside the Frame control group. _file << " Display \"" << get_image_filename() - << "\" \"file\" \"rgba\"\n"; + << "\" \"file\" \"rgba\"\n"; } } @@ -166,7 +166,7 @@ begin_file() { // renderer will be able to generate a multi-frame output file // somehow. _file << "Display \"" << get_image_filename() - << "\" \"file\" \"rgb\"\n"; + << "\" \"file\" \"rgb\"\n"; } } @@ -208,35 +208,35 @@ format_name(const string &name_template) const { ++ci; string::const_iterator pi = ci; while (ci != name_template.end() && isdigit(*ci)) { - ++ci; + ++ci; } string format_spec(pi, ci); if (ci != name_template.end()) { - switch (*ci) { - case 'f': - // %f : insert frame number - name += format_integer(format_spec, _frame_number); - break; + switch (*ci) { + case 'f': + // %f : insert frame number + name += format_integer(format_spec, _frame_number); + break; - case 't': - // %t : insert window title - name += format_string(format_spec, _props._title); - break; + case 't': + // %t : insert window title + name += format_string(format_spec, _props._title); + break; - case '%': - // %% : insert percent sign - name += '%'; - break; + case '%': + // %% : insert percent sign + name += '%'; + break; - default: - cerr << "Invalid filename template specification: %" - << format_spec << *ci << "\n"; - } - ++ci; + default: + cerr << "Invalid filename template specification: %" + << format_spec << *ci << "\n"; + } + ++ci; } else { - cerr << "Incomplete filename template specification: %" - << format_spec << "\n"; + cerr << "Incomplete filename template specification: %" + << format_spec << "\n"; } } else { name += *ci; @@ -330,14 +330,14 @@ check_per_frame(const string &name_template) { ++ci; string::const_iterator pi = ci; while (ci != name_template.end() && isdigit(*ci)) { - ++ci; + ++ci; } if (ci != name_template.end()) { - if ((*ci) == 'f') { - return true; - } - ++ci; + if ((*ci) == 'f') { + return true; + } + ++ci; } } else { ++ci; @@ -390,7 +390,7 @@ TypeHandle RIBGraphicsWindow::get_class_type(void) { void RIBGraphicsWindow::init_type(void) { GraphicsWindow::init_type(); register_type(_type_handle, "RIBGraphicsWindow", - GraphicsWindow::get_class_type()); + GraphicsWindow::get_class_type()); } TypeHandle RIBGraphicsWindow::get_type(void) const { diff --git a/panda/src/ribdisplay/ribGraphicsWindow.h b/panda/src/ribdisplay/ribGraphicsWindow.h index 6c7ead2934..3c1cdb1503 100644 --- a/panda/src/ribdisplay/ribGraphicsWindow.h +++ b/panda/src/ribdisplay/ribGraphicsWindow.h @@ -67,7 +67,7 @@ class RIBGraphicsWindow : public GraphicsWindow { RIBGraphicsWindow(GraphicsPipe *pipe); RIBGraphicsWindow(GraphicsPipe *pipe, - const GraphicsWindow::Properties &props); + const GraphicsWindow::Properties &props); virtual ~RIBGraphicsWindow(void); INLINE void set_rib_filename_template(const string &str); diff --git a/panda/src/ribgsg/config_ribgsg.cxx b/panda/src/ribgsg/config_ribgsg.cxx index 0459b05a4b..a2802178c3 100644 --- a/panda/src/ribgsg/config_ribgsg.cxx +++ b/panda/src/ribgsg/config_ribgsg.cxx @@ -15,5 +15,5 @@ ConfigureFn(config_ribgsg) { RIBGraphicsStateGuardian::init_type(); GraphicsStateGuardian::get_factory(). register_factory(RIBGraphicsStateGuardian::get_class_type(), - RIBGraphicsStateGuardian::make_RIBGraphicsStateGuardian); + RIBGraphicsStateGuardian::make_RIBGraphicsStateGuardian); } diff --git a/panda/src/ribgsg/ribGraphicsStateGuardian.cxx b/panda/src/ribgsg/ribGraphicsStateGuardian.cxx index c08ad827be..f7e0a302eb 100644 --- a/panda/src/ribgsg/ribGraphicsStateGuardian.cxx +++ b/panda/src/ribgsg/ribGraphicsStateGuardian.cxx @@ -70,14 +70,14 @@ issue_texcoord_rib(const Geom *geom, Geom::TexCoordIterator &ti) { // We need to reverse the V coordinate for RIB. static LMatrix3f texmat(1.0, 0.0, 0.0, - 0.0, -1.0, 0.0, - 0.0, 1.0, 1.0); + 0.0, -1.0, 0.0, + 0.0, 1.0, 1.0); rib_texcoords.push_back(geom->get_next_texcoord(ti) * texmat); } static void issue_color_rib(const Geom *geom, Geom::ColorIterator &ci, - const GraphicsStateGuardianBase *) { + const GraphicsStateGuardianBase *) { // RIB only cares about three-component color, so we have to convert // the four-component color attribute to three-component color here. rib_colors.push_back((const RGBColorf &)geom->get_next_color(ci)); @@ -177,7 +177,7 @@ clear(const RenderBuffer &, const DisplayRegion* ) { // Function: RIBGraphicsStateGuardian::prepare_display_region // Access: Public // Description: Prepare a display region for rendering (set up -// scissor region and viewport) +// scissor region and viewport) //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: prepare_display_region() { @@ -202,26 +202,26 @@ render_frame(const AllAttributesWrapper &initial_state) { if (_win->is_channel_defined(c)) { GraphicsChannel *chan = _win->get_channel(c); if (chan->is_active()) { - int num_layers = chan->get_num_layers(); - for (int l = 0; l < num_layers; l++) { - GraphicsLayer *layer = chan->get_layer(l); - if (layer->is_active()) { - int num_drs = layer->get_num_drs(); - for (int d = 0; d < num_drs; d++) { - DisplayRegion *dr = layer->get_dr(d); - Camera *cam = dr->get_camera(); - - // For each display region, render from the camera's view. - if (dr->is_active() && cam != (Camera *)NULL && - cam->is_active() && cam->get_scene() != (Node *)NULL) { - DisplayRegionStack old_dr = push_display_region(dr); - prepare_display_region(); - render_scene(cam->get_scene(), cam, initial_state); - pop_display_region(old_dr); - } - } - } - } + int num_layers = chan->get_num_layers(); + for (int l = 0; l < num_layers; l++) { + GraphicsLayer *layer = chan->get_layer(l); + if (layer->is_active()) { + int num_drs = layer->get_num_drs(); + for (int d = 0; d < num_drs; d++) { + DisplayRegion *dr = layer->get_dr(d); + Camera *cam = dr->get_camera(); + + // For each display region, render from the camera's view. + if (dr->is_active() && cam != (Camera *)NULL && + cam->is_active() && cam->get_scene() != (Node *)NULL) { + DisplayRegionStack old_dr = push_display_region(dr); + prepare_display_region(); + render_scene(cam->get_scene(), cam, initial_state); + pop_display_region(old_dr); + } + } + } + } } } } @@ -243,11 +243,11 @@ render_frame(const AllAttributesWrapper &initial_state) { //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state) { + const AllAttributesWrapper &initial_state) { _current_root_node = root; render_subgraph(_render_traverser, root, projnode, - initial_state, AllTransitionsWrapper()); + initial_state, AllTransitionsWrapper()); } @@ -261,9 +261,9 @@ render_scene(Node *root, ProjectionNode *projnode, //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { ProjectionNode *old_projection_node = _current_projection_node; _current_projection_node = projnode; @@ -320,7 +320,7 @@ render_subgraph(RenderTraverser *traverser, } new_line() << "Format " << width << " " << height << " " - << (float)height * frame_aspect / (float)width << "\n"; + << (float)height * frame_aspect / (float)width << "\n"; new_line() << "FrameAspectRatio " << frame_aspect << "\n"; new_line() << "Sides 1\n"; @@ -361,9 +361,9 @@ render_subgraph(RenderTraverser *traverser, //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, - Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + Node *subgraph, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { nassertv(traverser != (RenderTraverser *)NULL); traverser->traverse(subgraph, initial_state, net_trans); } @@ -628,7 +628,7 @@ copy_pixel_buffer(PixelBuffer *, const DisplayRegion *, const RenderBuffer &) { //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, - const NodeAttributes &) { + const NodeAttributes &) { } //////////////////////////////////////////////////////////////////// @@ -638,7 +638,7 @@ draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, const RenderBuffer &, - const NodeAttributes &) { + const NodeAttributes &) { } //////////////////////////////////////////////////////////////////// @@ -713,10 +713,10 @@ issue_light(const LightAttribute *attrib) { // else is already off and won't bother to run the list.) if (!_enabled_lights[0]) { for (int i = 1; i < _enabled_lights.size(); i++) { - if (_enabled_lights[i]) { - new_line() << "Illuminate " << i << " 0\n"; - _enabled_lights[i] = false; - } + if (_enabled_lights[i]) { + new_line() << "Illuminate " << i << " 0\n"; + _enabled_lights[i] = false; + } } // And turn on the default light, which illuminates the scene in @@ -737,7 +737,7 @@ issue_light(const LightAttribute *attrib) { int id = (*ii).second; if (!_enabled_lights[id]) { - new_line() << "Illuminate " << id << " 1\n"; + new_line() << "Illuminate " << id << " 1\n"; } // We'll temporarily set the enabled flag to false, even @@ -749,8 +749,8 @@ issue_light(const LightAttribute *attrib) { // Now turn off all the lights that are still marked "on". for (int i = 0; i < _enabled_lights.size(); i++) { if (_enabled_lights[i]) { - new_line() << "Illuminate " << i << " 0\n"; - _enabled_lights[i] = false; + new_line() << "Illuminate " << i << " 0\n"; + _enabled_lights[i] = false; } } @@ -824,7 +824,7 @@ get_texture_extension() const { //////////////////////////////////////////////////////////////////// PT(SavedFrameBuffer) RIBGraphicsStateGuardian:: save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr) { + CPT(DisplayRegion) dr) { return new SavedFrameBuffer(buffer, dr); } @@ -863,7 +863,7 @@ void RIBGraphicsStateGuardian:: get_rib_stuff(Node *root, const AllAttributesWrapper &initial_state) { RibStuffTraverser trav(this); df_traverse(root, trav, initial_state, NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); } @@ -948,8 +948,8 @@ define_light(const Light *light) { write_light_from(slight); write_light_to(slight); (*_output) - << " \"coneangle\" " << deg_2_rad(slight->get_cutoff_angle()) - << "\n"; + << " \"coneangle\" " << deg_2_rad(slight->get_cutoff_angle()) + << "\n"; } else if (light->get_light_type() == AmbientLight::get_class_type()) { const AmbientLight *alight = (const AmbientLight *)light; @@ -976,7 +976,7 @@ write_light_color(const Colorf &color) const { get_color_and_intensity((const RGBColorf &)color, output_color, intensity); (*_output) << " \"lightcolor\" [ " << output_color << " ] \"intensity\" " - << intensity; + << intensity; } //////////////////////////////////////////////////////////////////// @@ -1029,13 +1029,13 @@ new_line(int extra_indent) const { void RIBGraphicsStateGuardian:: reset_transform(const LMatrix4f &mat) const { new_line() << "Transform [ " << mat(0,0) << " " << mat(0,1) << " " - << mat(0,2) << " " << mat(0,3) << "\n"; + << mat(0,2) << " " << mat(0,3) << "\n"; new_line(12) << mat(1,0) << " " << mat(1,1) << " " - << mat(1,2) << " " << mat(1,3) << "\n"; + << mat(1,2) << " " << mat(1,3) << "\n"; new_line(12) << mat(2,0) << " " << mat(2,1) << " " - << mat(2,2) << " " << mat(2,3) << "\n"; + << mat(2,2) << " " << mat(2,3) << "\n"; new_line(12) << mat(3,0) << " " << mat(3,1) << " " - << mat(3,2) << " " << mat(3,3) << " ]\n"; + << mat(3,2) << " " << mat(3,3) << " ]\n"; } //////////////////////////////////////////////////////////////////// @@ -1048,13 +1048,13 @@ reset_transform(const LMatrix4f &mat) const { void RIBGraphicsStateGuardian:: concat_transform(const LMatrix4f &mat) const { new_line() << "ConcatTransform [ " << mat(0,0) << " " << mat(0,1) << " " - << mat(0,2) << " " << mat(0,3) << "\n"; + << mat(0,2) << " " << mat(0,3) << "\n"; new_line(18) << mat(1,0) << " " << mat(1,1) << " " - << mat(1,2) << " " << mat(1,3) << "\n"; + << mat(1,2) << " " << mat(1,3) << "\n"; new_line(18) << mat(2,0) << " " << mat(2,1) << " " - << mat(2,2) << " " << mat(2,3) << "\n"; + << mat(2,2) << " " << mat(2,3) << "\n"; new_line(18) << mat(3,0) << " " << mat(3,1) << " " - << mat(3,2) << " " << mat(3,3) << " ]\n"; + << mat(3,2) << " " << mat(3,3) << " ]\n"; } @@ -1077,10 +1077,10 @@ draw_simple_poly(const Geom *geom) { Geom::ColorIterator ci = geom->make_color_iterator(); GeomIssuer issuer(geom, this, - issue_vertex_rib, - issue_normal_rib, - issue_texcoord_rib, - issue_color_rib); + issue_vertex_rib, + issue_normal_rib, + issue_texcoord_rib, + issue_color_rib); for (int i = 0; i < nprims; i++) { // First, for each primitive, we build up the various polygon @@ -1143,36 +1143,36 @@ write_polygon(int num_verts) { // Vertices are always per-vertex. write_long_list(*_output, _indent_level, - rib_vertices.rbegin(), rib_vertices.rend(), - "Polygon \"P\" ", " ", 72); + rib_vertices.rbegin(), rib_vertices.rend(), + "Polygon \"P\" ", " ", 72); if (rib_normals.size() == 1) { // A single polygon normal. write_long_list(*_output, _indent_level, - rib_normals.rbegin(), rib_normals.rend(), - " \"Np\" ", " ", 72); + rib_normals.rbegin(), rib_normals.rend(), + " \"Np\" ", " ", 72); } else if (!rib_normals.empty()) { // Multiple per-vertex normals. assert(rib_normals.size() == num_verts); write_long_list(*_output, _indent_level, - rib_normals.rbegin(), rib_normals.rend(), - " \"N\" ", " ", 72); + rib_normals.rbegin(), rib_normals.rend(), + " \"N\" ", " ", 72); } if (!rib_texcoords.empty()) { // Per-vertex texcoords. assert(rib_texcoords.size() == num_verts); write_long_list(*_output, _indent_level, - rib_texcoords.rbegin(), rib_texcoords.rend(), - " \"st\" ", " ", 72); + rib_texcoords.rbegin(), rib_texcoords.rend(), + " \"st\" ", " ", 72); } if (!rib_colors.empty()) { assert(rib_colors.size() == num_verts); write_long_list(*_output, _indent_level, - rib_colors.rbegin(), rib_colors.rend(), - " \"Cs\" ", " ", 72); + rib_colors.rbegin(), rib_colors.rend(), + " \"Cs\" ", " ", 72); } // Clear the arrays for the next primitive. @@ -1193,8 +1193,8 @@ write_polygon(int num_verts) { //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: get_color_and_intensity(const RGBColorf &input, - RGBColorf &output, - float &intensity) { + RGBColorf &output, + float &intensity) { intensity = max(max(input[0], input[1]), input[2]); if (intensity == 0.0) { output.set(1.0, 1.0, 1.0); @@ -1229,5 +1229,5 @@ TypeHandle RIBGraphicsStateGuardian::get_class_type(void) { void RIBGraphicsStateGuardian::init_type(void) { GraphicsStateGuardian::init_type(); register_type(_type_handle, "RIBGraphicsStateGuardian", - GraphicsStateGuardian::get_class_type()); + GraphicsStateGuardian::get_class_type()); } diff --git a/panda/src/ribgsg/ribGraphicsStateGuardian.h b/panda/src/ribgsg/ribGraphicsStateGuardian.h index c87a2268df..ee8747af52 100644 --- a/panda/src/ribgsg/ribGraphicsStateGuardian.h +++ b/panda/src/ribgsg/ribGraphicsStateGuardian.h @@ -21,7 +21,7 @@ class PixelBuffer; class Fog; //////////////////////////////////////////////////////////////////// -// Class : RIBGraphicsStateGuardian +// Class : RIBGraphicsStateGuardian // Description : A GraphicsStateGuardian specialized for creating RIB // files, suitable for shipping off to a // Renderman-friendly non-real-time renderer. @@ -41,15 +41,15 @@ public: virtual void render_frame(const AllAttributesWrapper &initial_state); virtual void render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state); + const AllAttributesWrapper &initial_state); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, ProjectionNode *projnode, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual void render_subgraph(RenderTraverser *traverser, - Node *subgraph, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + Node *subgraph, + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); virtual bool wants_normals(void) const; virtual bool wants_texcoords(void) const; @@ -81,16 +81,16 @@ public: virtual void texture_to_pixel_buffer(TextureContext *, PixelBuffer *) { } virtual void texture_to_pixel_buffer(TextureContext *, PixelBuffer *, - const DisplayRegion *) { } + const DisplayRegion *) { } virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr); virtual void copy_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void draw_pixel_buffer(PixelBuffer *pb, const DisplayRegion *dr, const RenderBuffer &rb, - const NodeAttributes& na=NodeAttributes()); + const NodeAttributes& na=NodeAttributes()); virtual void apply_material(Material*) { } virtual void apply_fog(Fog*) { } @@ -113,7 +113,7 @@ public: protected: virtual PT(SavedFrameBuffer) save_frame_buffer(const RenderBuffer &buffer, - CPT(DisplayRegion) dr); + CPT(DisplayRegion) dr); virtual void restore_frame_buffer(SavedFrameBuffer *frame_buffer); void set_color(const RGBColorf &color); @@ -133,8 +133,8 @@ protected: void write_polygon(int num_verts); static void get_color_and_intensity(const RGBColorf &input, - RGBColorf &output, - float &intensity); + RGBColorf &output, + float &intensity); RGBColorf _current_color; diff --git a/panda/src/ribgsg/ribStuffTraverser.cxx b/panda/src/ribgsg/ribStuffTraverser.cxx index 306d90fa42..2456fc630e 100644 --- a/panda/src/ribgsg/ribStuffTraverser.cxx +++ b/panda/src/ribgsg/ribStuffTraverser.cxx @@ -24,18 +24,18 @@ reached_node(Node *node, AllAttributesWrapper &state, NullLevelState &) { if (node->is_of_type(GeomNode::get_class_type())) { const TextureAttribute *tex_attrib; if (!get_attribute_into(tex_attrib, state, - TextureTransition::get_class_type())) { + TextureTransition::get_class_type())) { if (tex_attrib->is_on()) { - _gsg->define_texture(tex_attrib->get_texture()); + _gsg->define_texture(tex_attrib->get_texture()); } } const LightAttribute *light_attrib; if (!get_attribute_into(light_attrib, state, - LightTransition::get_class_type())) { + LightTransition::get_class_type())) { LightAttribute::const_iterator li; for (li = light_attrib->begin(); li != light_attrib->end(); ++li) { - _gsg->define_light(*li); + _gsg->define_light(*li); } } } diff --git a/panda/src/ribgsg/ribStuffTraverser.h b/panda/src/ribgsg/ribStuffTraverser.h index 1680f260e9..ea27e412c1 100644 --- a/panda/src/ribgsg/ribStuffTraverser.h +++ b/panda/src/ribgsg/ribStuffTraverser.h @@ -25,7 +25,7 @@ class RibStuffTraverser : public: RibStuffTraverser(RIBGraphicsStateGuardian *gsg) : _gsg(gsg) { } bool reached_node(Node *node, AllAttributesWrapper &state, - NullLevelState &); + NullLevelState &); public: RIBGraphicsStateGuardian *_gsg; diff --git a/panda/src/sgattrib/alphaTransformAttribute.h b/panda/src/sgattrib/alphaTransformAttribute.h index 20eb4f722e..e98b660c76 100644 --- a/panda/src/sgattrib/alphaTransformAttribute.h +++ b/panda/src/sgattrib/alphaTransformAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : AlphaTransformAttribute +// Class : AlphaTransformAttribute // Description : See AlphaTransformTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA AlphaTransformAttribute : public OnAttribute { @@ -50,7 +50,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "AlphaTransformAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/alphaTransformProperty.h b/panda/src/sgattrib/alphaTransformProperty.h index f74af135c2..cca6689af1 100644 --- a/panda/src/sgattrib/alphaTransformProperty.h +++ b/panda/src/sgattrib/alphaTransformProperty.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : AlphaTransformProperty +// Class : AlphaTransformProperty // Description : This class defines the set state for polygon offseting //////////////////////////////////////////////////////////////////// class EXPCL_PANDA AlphaTransformProperty { diff --git a/panda/src/sgattrib/alphaTransformTransition.h b/panda/src/sgattrib/alphaTransformTransition.h index f047742c2e..80aa2fd9d6 100644 --- a/panda/src/sgattrib/alphaTransformTransition.h +++ b/panda/src/sgattrib/alphaTransformTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : AlphaTransformTransition +// Class : AlphaTransformTransition // Description : This allows for scaling and offseting of current // alpha values //////////////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "AlphaTransformTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/attribTraverser.cxx b/panda/src/sgattrib/attribTraverser.cxx index a728a60d6b..045e750bb0 100644 --- a/panda/src/sgattrib/attribTraverser.cxx +++ b/panda/src/sgattrib/attribTraverser.cxx @@ -53,14 +53,14 @@ reached_node(Node *node, NodeAttributeWrapper &state, NullLevelState &) { if (attrib->is_of_type(OnOffAttribute::get_class_type())) { - if(DCAST(OnOffAttribute, attrib)->is_on()) - { - _has_attrib = true; - } + if(DCAST(OnOffAttribute, attrib)->is_on()) + { + _has_attrib = true; + } } else { - _has_attrib = true; + _has_attrib = true; } } @@ -78,8 +78,8 @@ reached_node(Node *node, NodeAttributeWrapper &state, NullLevelState &) { //////////////////////////////////////////////////////////////////// bool AttribTraverser:: forward_arc(NodeRelation *, TransitionWrapper &trans, - NodeAttributeWrapper &, NodeAttributeWrapper &, - NullLevelState &) + NodeAttributeWrapper &, NodeAttributeWrapper &, + NullLevelState &) { //Short circuit if we aren't looking for a transition if (_transition_type == TypeHandle::none()) @@ -124,7 +124,7 @@ set_transition_type(TypeHandle type) //////////////////////////////////////////////////////////////////// // Function: is_textured // Description: Recursively checks the tree of nodes from root to -// see if any geometry is textured +// see if any geometry is textured //////////////////////////////////////////////////////////////////// bool is_textured(Node* root) { @@ -133,8 +133,8 @@ is_textured(Node* root) { trav.set_attrib_type(TextureAttribute::get_class_type()); df_traverse(root, trav, - NodeAttributeWrapper(TextureTransition::get_class_type()), - NullLevelState(), RenderRelation::get_class_type()); + NodeAttributeWrapper(TextureTransition::get_class_type()), + NullLevelState(), RenderRelation::get_class_type()); return trav._has_attrib; } @@ -142,7 +142,7 @@ is_textured(Node* root) { //////////////////////////////////////////////////////////////////// // Function: is_textured // Description: Recursively checks the tree of nodes from root to -// see if any geometry is textured +// see if any geometry is textured //////////////////////////////////////////////////////////////////// bool is_textured(Node* root, const AllAttributesWrapper &init_state) @@ -162,7 +162,7 @@ is_textured(Node* root, const AllAttributesWrapper &init_state) //////////////////////////////////////////////////////////////////// // Function: is_shaded // Description: Recursively checks the tree of nodes from root to -// see if any geometry is shaded +// see if any geometry is shaded //////////////////////////////////////////////////////////////////// bool is_shaded(Node* root) { @@ -176,8 +176,8 @@ is_shaded(Node* root) { trav.set_transition_type(TypeRegistry::ptr()->find_type("ShaderTransition")); df_traverse(root, trav, - NodeAttributeWrapper(TypeRegistry::ptr()->find_type("ShaderTransition")), - NullLevelState(), RenderRelation::get_class_type()); + NodeAttributeWrapper(TypeRegistry::ptr()->find_type("ShaderTransition")), + NullLevelState(), RenderRelation::get_class_type()); return trav._has_attrib; } diff --git a/panda/src/sgattrib/attribTraverser.h b/panda/src/sgattrib/attribTraverser.h index 2674c673c0..60d237ea65 100644 --- a/panda/src/sgattrib/attribTraverser.h +++ b/panda/src/sgattrib/attribTraverser.h @@ -25,8 +25,8 @@ public: AttribTraverser(); bool reached_node(Node *node, NodeAttributeWrapper &state, NullLevelState &); bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - NodeAttributeWrapper &, NodeAttributeWrapper &, - NullLevelState &); + NodeAttributeWrapper &, NodeAttributeWrapper &, + NullLevelState &); void set_attrib_type(TypeHandle type); diff --git a/panda/src/sgattrib/billboardTransition.h b/panda/src/sgattrib/billboardTransition.h index 0549ac9f82..7caee51249 100644 --- a/panda/src/sgattrib/billboardTransition.h +++ b/panda/src/sgattrib/billboardTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : BillboardTransition +// Class : BillboardTransition // Description : This transition, when applied to an arc, causes that // arc and everything below it to be rendered so that it // always faces the camera. There are all kinds of ways @@ -46,9 +46,9 @@ public: virtual NodeTransition *make_copy() const; virtual bool sub_render(NodeRelation *arc, - const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + const AllAttributesWrapper &attrib, + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; virtual void output(ostream &out) const; @@ -83,7 +83,7 @@ public: static void init_type() { ImmediateTransition::init_type(); register_type(_type_handle, "BillboardTransition", - ImmediateTransition::get_class_type()); + ImmediateTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/clipPlaneAttribute.cxx b/panda/src/sgattrib/clipPlaneAttribute.cxx index 8063240638..40c0e9506d 100644 --- a/panda/src/sgattrib/clipPlaneAttribute.cxx +++ b/panda/src/sgattrib/clipPlaneAttribute.cxx @@ -76,7 +76,7 @@ output_property(ostream &out, const PT_Node &prop) const { //////////////////////////////////////////////////////////////////// void ClipPlaneAttribute:: write_property(ostream &out, const PT_Node &prop, - int indent_level) const { + int indent_level) const { const PlaneNode *node; DCAST_INTO_V(node, prop); indent(out, indent_level) diff --git a/panda/src/sgattrib/clipPlaneAttribute.h b/panda/src/sgattrib/clipPlaneAttribute.h index 128b132fe9..3af0a5a751 100644 --- a/panda/src/sgattrib/clipPlaneAttribute.h +++ b/panda/src/sgattrib/clipPlaneAttribute.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ClipPlaneAttribute +// Class : ClipPlaneAttribute // Description : See ClipPlaneTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ClipPlaneAttribute : public MultiNodeAttribute { @@ -36,7 +36,7 @@ public: protected: virtual void output_property(ostream &out, const PT_Node &prop) const; virtual void write_property(ostream &out, const PT_Node &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -49,7 +49,7 @@ public: static void init_type() { MultiNodeAttribute::init_type(); register_type(_type_handle, "ClipPlaneAttribute", - MultiNodeAttribute::get_class_type()); + MultiNodeAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/clipPlaneTransition.cxx b/panda/src/sgattrib/clipPlaneTransition.cxx index 6b77017293..4d551da557 100644 --- a/panda/src/sgattrib/clipPlaneTransition.cxx +++ b/panda/src/sgattrib/clipPlaneTransition.cxx @@ -62,7 +62,7 @@ output_property(ostream &out, const PT_Node &prop) const { //////////////////////////////////////////////////////////////////// void ClipPlaneTransition:: write_property(ostream &out, const PT_Node &prop, - int indent_level) const { + int indent_level) const { const PlaneNode *node; DCAST_INTO_V(node, prop); indent(out, indent_level) diff --git a/panda/src/sgattrib/clipPlaneTransition.h b/panda/src/sgattrib/clipPlaneTransition.h index e31a679202..b6cc0638a7 100644 --- a/panda/src/sgattrib/clipPlaneTransition.h +++ b/panda/src/sgattrib/clipPlaneTransition.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ClipPlaneTransition +// Class : ClipPlaneTransition // Description : This allows the definition of zero or more arbitrary // clipping planes. //////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ public: protected: virtual void output_property(ostream &out, const PT_Node &prop) const; virtual void write_property(ostream &out, const PT_Node &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -51,7 +51,7 @@ public: static void init_type() { MultiNodeTransition::init_type(); register_type(_type_handle, "ClipPlaneTransition", - MultiNodeTransition::get_class_type()); + MultiNodeTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorAttribute.h b/panda/src/sgattrib/colorAttribute.h index 0b3679c09b..2cf5dc094e 100644 --- a/panda/src/sgattrib/colorAttribute.h +++ b/panda/src/sgattrib/colorAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorAttribute +// Class : ColorAttribute // Description : See ColorTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ColorAttribute : public OnOffAttribute { @@ -53,7 +53,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "ColorAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorBlendAttribute.h b/panda/src/sgattrib/colorBlendAttribute.h index a804359bac..cf7e106632 100644 --- a/panda/src/sgattrib/colorBlendAttribute.h +++ b/panda/src/sgattrib/colorBlendAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorBlendAttribute +// Class : ColorBlendAttribute // Description : See ColorBlendTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ColorBlendAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "ColorBlendAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorBlendProperty.h b/panda/src/sgattrib/colorBlendProperty.h index a021a9ac41..3fbb8a8ae5 100644 --- a/panda/src/sgattrib/colorBlendProperty.h +++ b/panda/src/sgattrib/colorBlendProperty.h @@ -9,19 +9,19 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorBlendProperty +// Class : ColorBlendProperty // Description : This defines the types of color blending we can // perform. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ColorBlendProperty { public: enum Mode { - M_none, // Blending is disabled - M_multiply, // color already in fbuffer * incoming color - M_add, // color already in fbuffer + incoming color - M_multiply_add, // color already in fbuffer * incoming color + - // color already in fbuffer - M_alpha, // ???? + M_none, // Blending is disabled + M_multiply, // color already in fbuffer * incoming color + M_add, // color already in fbuffer + incoming color + M_multiply_add, // color already in fbuffer * incoming color + + // color already in fbuffer + M_alpha, // ???? }; public: diff --git a/panda/src/sgattrib/colorBlendTransition.h b/panda/src/sgattrib/colorBlendTransition.h index 9bb8f6d15f..f63e4e625c 100644 --- a/panda/src/sgattrib/colorBlendTransition.h +++ b/panda/src/sgattrib/colorBlendTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorBlendTransition +// Class : ColorBlendTransition // Description : This controls the kinds of blending between colors // being rendered and the existing frame buffer. //////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "ColorBlendTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorMaskAttribute.h b/panda/src/sgattrib/colorMaskAttribute.h index 6675b8854c..6247fb6766 100644 --- a/panda/src/sgattrib/colorMaskAttribute.h +++ b/panda/src/sgattrib/colorMaskAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorMaskAttribute +// Class : ColorMaskAttribute // Description : See ColorMaskTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ColorMaskAttribute : public OnAttribute { @@ -53,7 +53,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "ColorMaskAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorMaskProperty.h b/panda/src/sgattrib/colorMaskProperty.h index c9eedb67a0..a0b18aaa1b 100644 --- a/panda/src/sgattrib/colorMaskProperty.h +++ b/panda/src/sgattrib/colorMaskProperty.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorMaskProperty +// Class : ColorMaskProperty // Description : This defines the set of color planes that may be // active for writing to the color buffer. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgattrib/colorMaskTransition.h b/panda/src/sgattrib/colorMaskTransition.h index e6f2fdba10..e9668deaa8 100644 --- a/panda/src/sgattrib/colorMaskTransition.h +++ b/panda/src/sgattrib/colorMaskTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorMaskTransition +// Class : ColorMaskTransition // Description : This is scene graph colorMask (which is not to be // confused with geometry colorMask). By setting a // ColorMaskTransition on the scene graph, you can override @@ -52,7 +52,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "ColorMaskTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorMatrixAttribute.h b/panda/src/sgattrib/colorMatrixAttribute.h index 7cb8d2a210..1de250b99f 100644 --- a/panda/src/sgattrib/colorMatrixAttribute.h +++ b/panda/src/sgattrib/colorMatrixAttribute.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorMatrixAttribute +// Class : ColorMatrixAttribute // Description : See ColorMatrixTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ColorMatrixAttribute : public LMatrix4fAttribute { @@ -36,7 +36,7 @@ public: static void init_type() { LMatrix4fAttribute::init_type(); register_type(_type_handle, "ColorMatrixAttribute", - LMatrix4fAttribute::get_class_type()); + LMatrix4fAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorMatrixTransition.h b/panda/src/sgattrib/colorMatrixTransition.h index bd24159b96..f34ca66772 100644 --- a/panda/src/sgattrib/colorMatrixTransition.h +++ b/panda/src/sgattrib/colorMatrixTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorMatrixTransition +// Class : ColorMatrixTransition // Description : This defines a transformation for color. I.E. to // make something blue, or rotate the colors, or whatever //////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public: static void init_type() { LMatrix4fTransition::init_type(); register_type(_type_handle, "ColorMatrixTransition", - LMatrix4fTransition::get_class_type()); + LMatrix4fTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/colorProperty.h b/panda/src/sgattrib/colorProperty.h index a3ff17ddbe..7a60649e29 100644 --- a/panda/src/sgattrib/colorProperty.h +++ b/panda/src/sgattrib/colorProperty.h @@ -14,7 +14,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : ColorProperty +// Class : ColorProperty // Description : This class defines the scene graph color property // that we may set on a transition. It makes a // distinction between a real color and the uncolor. diff --git a/panda/src/sgattrib/colorTransition.h b/panda/src/sgattrib/colorTransition.h index 3cc8eba136..70335eae7e 100644 --- a/panda/src/sgattrib/colorTransition.h +++ b/panda/src/sgattrib/colorTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ColorTransition +// Class : ColorTransition // Description : This is scene graph color (which is not to be // confused with geometry color). By setting a // ColorTransition on the scene graph, you can override @@ -68,7 +68,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "ColorTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/cullFaceAttribute.h b/panda/src/sgattrib/cullFaceAttribute.h index e60b042155..7595f63577 100644 --- a/panda/src/sgattrib/cullFaceAttribute.h +++ b/panda/src/sgattrib/cullFaceAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : CullFaceAttribute +// Class : CullFaceAttribute // Description : See CullFaceTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA CullFaceAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "CullFaceAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/cullFaceProperty.h b/panda/src/sgattrib/cullFaceProperty.h index 9f8f2302a8..8c2905dca4 100644 --- a/panda/src/sgattrib/cullFaceProperty.h +++ b/panda/src/sgattrib/cullFaceProperty.h @@ -12,7 +12,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : CullFaceProperty +// Class : CullFaceProperty // Description : This defines the ways we can cull faces according to // their vertex ordering (and hence orientation relative // to the camera). @@ -21,9 +21,9 @@ class EXPCL_PANDA CullFaceProperty { public: enum Mode { M_cull_none, // Cull no polygons - M_cull_clockwise, // Cull clockwise-oriented polygons - M_cull_counter_clockwise, // Cull counter-clockwise-oriented polygons - M_cull_all, // Cull all polygons (other primitives are still drawn) + M_cull_clockwise, // Cull clockwise-oriented polygons + M_cull_counter_clockwise, // Cull counter-clockwise-oriented polygons + M_cull_all, // Cull all polygons (other primitives are still drawn) }; public: diff --git a/panda/src/sgattrib/cullFaceTransition.h b/panda/src/sgattrib/cullFaceTransition.h index 2322c04ca6..4b78a3d4d5 100644 --- a/panda/src/sgattrib/cullFaceTransition.h +++ b/panda/src/sgattrib/cullFaceTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : CullFaceTransition +// Class : CullFaceTransition // Description : This controls how polygons are culled according to // the ordering of their vertices after projection (and, // hence, according to their facing relative to the @@ -58,7 +58,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "CullFaceTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/decalAttribute.h b/panda/src/sgattrib/decalAttribute.h index 0471b45174..4e0447dc69 100644 --- a/panda/src/sgattrib/decalAttribute.h +++ b/panda/src/sgattrib/decalAttribute.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DecalAttribute +// Class : DecalAttribute // Description : See DecalTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DecalAttribute : public OnOffAttribute { @@ -33,7 +33,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "DecalAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/decalTransition.h b/panda/src/sgattrib/decalTransition.h index 1c697c6849..9f76218dc2 100644 --- a/panda/src/sgattrib/decalTransition.h +++ b/panda/src/sgattrib/decalTransition.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DecalTransition +// Class : DecalTransition // Description : When this transition is in effect, the first GeomNode // encountered is rendered in a special mode, such that // all of its *children* (indeed, the whole subtree @@ -53,7 +53,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "DecalTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/depthTestAttribute.h b/panda/src/sgattrib/depthTestAttribute.h index e38bf7f6a6..e62a844c3c 100644 --- a/panda/src/sgattrib/depthTestAttribute.h +++ b/panda/src/sgattrib/depthTestAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DepthTestAttribute +// Class : DepthTestAttribute // Description : See DepthTestTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DepthTestAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "DepthTestAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/depthTestProperty.cxx b/panda/src/sgattrib/depthTestProperty.cxx index 51231c99e3..c45fa7c80b 100644 --- a/panda/src/sgattrib/depthTestProperty.cxx +++ b/panda/src/sgattrib/depthTestProperty.cxx @@ -30,10 +30,10 @@ operator << (ostream &out, DepthTestProperty::Mode mode) { case DepthTestProperty::M_not_equal: return out << "not_equal"; - + case DepthTestProperty::M_greater_equal: return out << "greater_equal"; - + case DepthTestProperty::M_always: return out << "always"; } diff --git a/panda/src/sgattrib/depthTestProperty.h b/panda/src/sgattrib/depthTestProperty.h index 3c3c1ad3aa..43e11bae95 100644 --- a/panda/src/sgattrib/depthTestProperty.h +++ b/panda/src/sgattrib/depthTestProperty.h @@ -12,7 +12,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : DepthTestProperty +// Class : DepthTestProperty // Description : This defines the types of depth testing we can // enable. //////////////////////////////////////////////////////////////////// @@ -21,12 +21,12 @@ PUBLISHED: enum Mode { M_none, // No depth test; may still write to depth buffer. M_never, // Never draw. - M_less, // incoming < stored - M_equal, // incoming == stored - M_less_equal, // incoming <= stored - M_greater, // incoming > stored - M_not_equal, // incoming != stored - M_greater_equal, // incoming >= stored + M_less, // incoming < stored + M_equal, // incoming == stored + M_less_equal, // incoming <= stored + M_greater, // incoming > stored + M_not_equal, // incoming != stored + M_greater_equal, // incoming >= stored M_always // Always draw. Same effect as none, more expensive. }; diff --git a/panda/src/sgattrib/depthTestTransition.h b/panda/src/sgattrib/depthTestTransition.h index 38042699d0..e5e3e643cf 100644 --- a/panda/src/sgattrib/depthTestTransition.h +++ b/panda/src/sgattrib/depthTestTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DepthTestTransition +// Class : DepthTestTransition // Description : This transition controls the nature of the test // against the depth buffer. It does not affect whether // the depth buffer will be written to or not; that is @@ -60,7 +60,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "DepthTestTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/depthWriteAttribute.h b/panda/src/sgattrib/depthWriteAttribute.h index 1c699c263e..9719fb4662 100644 --- a/panda/src/sgattrib/depthWriteAttribute.h +++ b/panda/src/sgattrib/depthWriteAttribute.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DepthWriteAttribute +// Class : DepthWriteAttribute // Description : See DepthWriteTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA DepthWriteAttribute : public OnOffAttribute { @@ -35,7 +35,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "DepthWriteAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/depthWriteTransition.h b/panda/src/sgattrib/depthWriteTransition.h index a5d56e9fe6..007d4b38b1 100644 --- a/panda/src/sgattrib/depthWriteTransition.h +++ b/panda/src/sgattrib/depthWriteTransition.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DepthWriteTransition +// Class : DepthWriteTransition // Description : This enables or disables the writing to the depth // buffer. //////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "DepthWriteTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/drawBoundsTransition.cxx b/panda/src/sgattrib/drawBoundsTransition.cxx index d6527448ad..b36a8b393e 100644 --- a/panda/src/sgattrib/drawBoundsTransition.cxx +++ b/panda/src/sgattrib/drawBoundsTransition.cxx @@ -71,7 +71,7 @@ make_copy() const { //////////////////////////////////////////////////////////////////// bool DrawBoundsTransition:: sub_render(NodeRelation *arc, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &, RenderTraverser *trav) { + AllTransitionsWrapper &, RenderTraverser *trav) { GraphicsStateGuardian *gsg = trav->get_gsg(); const BoundingVolume &vol = arc->get_bound(); @@ -117,8 +117,8 @@ sub_render(NodeRelation *arc, const AllAttributesWrapper &attrib, } else { sgattrib_cat.warning() - << "Don't know how to draw a representation of " - << vol.get_class_type() << "\n"; + << "Don't know how to draw a representation of " + << vol.get_class_type() << "\n"; } } diff --git a/panda/src/sgattrib/drawBoundsTransition.h b/panda/src/sgattrib/drawBoundsTransition.h index c0f2efecf4..4670d7823a 100644 --- a/panda/src/sgattrib/drawBoundsTransition.h +++ b/panda/src/sgattrib/drawBoundsTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : DrawBoundsTransition +// Class : DrawBoundsTransition // Description : This is a special transition that does not change // rendering state, but instead causes a representation // of the arc's bounding volume to be rendered @@ -27,9 +27,9 @@ public: virtual NodeTransition *make_copy() const; virtual bool sub_render(NodeRelation *arc, - const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + const AllAttributesWrapper &attrib, + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; NodeAttributes _outside_attrib; @@ -46,7 +46,7 @@ public: static void init_type() { ImmediateTransition::init_type(); register_type(_type_handle, "DrawBoundsTransition", - ImmediateTransition::get_class_type()); + ImmediateTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/fogAttribute.h b/panda/src/sgattrib/fogAttribute.h index 4d3f9b1b6b..113433e58e 100644 --- a/panda/src/sgattrib/fogAttribute.h +++ b/panda/src/sgattrib/fogAttribute.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FogAttribute +// Class : FogAttribute // Description : See FogTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA FogAttribute : public OnOffAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "FogAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/fogTransition.h b/panda/src/sgattrib/fogTransition.h index 0fc04e1060..143e050c59 100644 --- a/panda/src/sgattrib/fogTransition.h +++ b/panda/src/sgattrib/fogTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FogTransition +// Class : FogTransition // Description : This controls the enabling of fog. This typically // attenuates the colors based on the distance from the // observer (e.g. the z depth). @@ -49,7 +49,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "FogTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/linesmoothAttribute.h b/panda/src/sgattrib/linesmoothAttribute.h index b857864108..41cdcb59d2 100644 --- a/panda/src/sgattrib/linesmoothAttribute.h +++ b/panda/src/sgattrib/linesmoothAttribute.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LinesmoothAttribute +// Class : LinesmoothAttribute // Description : See LinesmoothTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA LinesmoothAttribute : public OnOffAttribute { @@ -35,7 +35,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "LinesmoothAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/linesmoothTransition.h b/panda/src/sgattrib/linesmoothTransition.h index 03281d2f83..abcd78ae53 100644 --- a/panda/src/sgattrib/linesmoothTransition.h +++ b/panda/src/sgattrib/linesmoothTransition.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LinesmoothTransition +// Class : LinesmoothTransition // Description : This enables or disables the antialiasing of lines. // It has no additional properties; it's simply an // on-or-off thing. @@ -35,7 +35,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "LinesmoothTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/materialAttribute.h b/panda/src/sgattrib/materialAttribute.h index 440be3a248..12b8ba9198 100644 --- a/panda/src/sgattrib/materialAttribute.h +++ b/panda/src/sgattrib/materialAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : MaterialAttribute +// Class : MaterialAttribute // Description : See MaterialTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA MaterialAttribute : public OnOffAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "MaterialAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/materialTransition.h b/panda/src/sgattrib/materialTransition.h index 5872685bba..cba2e178cc 100644 --- a/panda/src/sgattrib/materialTransition.h +++ b/panda/src/sgattrib/materialTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : MaterialTransition +// Class : MaterialTransition // Description : Applies a material, controlling subtle lighting // parameters, to geometry. //////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_MaterialTransition(const FactoryParams ¶ms); @@ -59,7 +59,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "MaterialTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/pointShapeAttribute.h b/panda/src/sgattrib/pointShapeAttribute.h index 4f15eb0e16..f8f837731c 100644 --- a/panda/src/sgattrib/pointShapeAttribute.h +++ b/panda/src/sgattrib/pointShapeAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PointShapeAttribute +// Class : PointShapeAttribute // Description : See PointShapeTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PointShapeAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "PointShapeAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/pointShapeTransition.h b/panda/src/sgattrib/pointShapeTransition.h index d27cdffdff..33e9857e39 100644 --- a/panda/src/sgattrib/pointShapeTransition.h +++ b/panda/src/sgattrib/pointShapeTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PointShapeTransition +// Class : PointShapeTransition // Description : An arc that determines the shape of point primitives // drawn beneath. //////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "PointShapeTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/polygonOffsetAttribute.h b/panda/src/sgattrib/polygonOffsetAttribute.h index 8d2c8657cb..75b42ea84c 100644 --- a/panda/src/sgattrib/polygonOffsetAttribute.h +++ b/panda/src/sgattrib/polygonOffsetAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PolygonOffsetAttribute +// Class : PolygonOffsetAttribute // Description : See PolygonOffsetTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PolygonOffsetAttribute : public OnAttribute { @@ -50,7 +50,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "PolygonOffsetAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/polygonOffsetProperty.h b/panda/src/sgattrib/polygonOffsetProperty.h index 678e0b3656..7e34edbd71 100644 --- a/panda/src/sgattrib/polygonOffsetProperty.h +++ b/panda/src/sgattrib/polygonOffsetProperty.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PolygonOffsetProperty +// Class : PolygonOffsetProperty // Description : This class defines the set state for polygon offseting //////////////////////////////////////////////////////////////////// class EXPCL_PANDA PolygonOffsetProperty { diff --git a/panda/src/sgattrib/polygonOffsetTransition.h b/panda/src/sgattrib/polygonOffsetTransition.h index 2ed5f464c5..75c557c904 100644 --- a/panda/src/sgattrib/polygonOffsetTransition.h +++ b/panda/src/sgattrib/polygonOffsetTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PolygonOffsetTransition +// Class : PolygonOffsetTransition // Description : This controls the amount of offseting done for depth // tests. The first value is the units, this is the // fixed offseting to be used, and the second value @@ -51,7 +51,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "PolygonOffsetTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/pruneTransition.cxx b/panda/src/sgattrib/pruneTransition.cxx index 3762532856..97edd6cdfb 100644 --- a/panda/src/sgattrib/pruneTransition.cxx +++ b/panda/src/sgattrib/pruneTransition.cxx @@ -29,7 +29,7 @@ make_copy() const { //////////////////////////////////////////////////////////////////// bool PruneTransition:: sub_render(NodeRelation *, const AllAttributesWrapper &, - AllTransitionsWrapper &, RenderTraverser *) { + AllTransitionsWrapper &, RenderTraverser *) { return false; } diff --git a/panda/src/sgattrib/pruneTransition.h b/panda/src/sgattrib/pruneTransition.h index 56c6d300a4..82b4f5c77e 100644 --- a/panda/src/sgattrib/pruneTransition.h +++ b/panda/src/sgattrib/pruneTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PruneTransition +// Class : PruneTransition // Description : This transition, when encountered in the scene graph, // causes rendering to stop at this point and not // traverse anything below. In effect, it causes all @@ -27,9 +27,9 @@ public: virtual NodeTransition *make_copy() const; virtual bool sub_render(NodeRelation *arc, - const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + const AllAttributesWrapper &attrib, + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; public: @@ -47,7 +47,7 @@ public: static void init_type() { ImmediateTransition::init_type(); register_type(_type_handle, "PruneTransition", - ImmediateTransition::get_class_type()); + ImmediateTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/renderModeAttribute.h b/panda/src/sgattrib/renderModeAttribute.h index f06106e9aa..68db4a62d0 100644 --- a/panda/src/sgattrib/renderModeAttribute.h +++ b/panda/src/sgattrib/renderModeAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : RenderModeAttribute +// Class : RenderModeAttribute // Description : See RenderModeTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA RenderModeAttribute : public OnAttribute { @@ -51,7 +51,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "RenderModeAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/renderModeProperty.h b/panda/src/sgattrib/renderModeProperty.h index a41523e7d1..2ae653812d 100644 --- a/panda/src/sgattrib/renderModeProperty.h +++ b/panda/src/sgattrib/renderModeProperty.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : RenderModeProperty +// Class : RenderModeProperty // Description : This defines the types of renderMode testing we can // enable. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgattrib/renderModeTransition.h b/panda/src/sgattrib/renderModeTransition.h index 1c329822c8..0b23e07c4f 100644 --- a/panda/src/sgattrib/renderModeTransition.h +++ b/panda/src/sgattrib/renderModeTransition.h @@ -13,13 +13,13 @@ #include //////////////////////////////////////////////////////////////////// -// Class : RenderModeTransition +// Class : RenderModeTransition // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDA RenderModeTransition : public OnTransition { public: INLINE RenderModeTransition(RenderModeProperty::Mode mode, - double line_width = 1.0); + double line_width = 1.0); INLINE void set_mode(RenderModeProperty::Mode mode); INLINE RenderModeProperty::Mode get_mode() const; @@ -49,7 +49,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "RenderModeTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/renderRelation.cxx b/panda/src/sgattrib/renderRelation.cxx index 196fe929ae..d4f6254de0 100644 --- a/panda/src/sgattrib/renderRelation.cxx +++ b/panda/src/sgattrib/renderRelation.cxx @@ -108,7 +108,7 @@ void RenderRelation:: init_type() { NodeRelation::init_type(); register_type(_type_handle, "RenderRelation", - NodeRelation::get_class_type()); + NodeRelation::get_class_type()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgattrib/renderRelation.h b/panda/src/sgattrib/renderRelation.h index 110a1f3cdc..746848c1d1 100644 --- a/panda/src/sgattrib/renderRelation.h +++ b/panda/src/sgattrib/renderRelation.h @@ -11,7 +11,7 @@ #include /////////////////////////////////////////////////////////////////// -// Class : RenderRelation +// Class : RenderRelation // Description : The arc type specific to renderable scene graphs. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA RenderRelation : public NodeRelation { diff --git a/panda/src/sgattrib/showHideAttribute.cxx b/panda/src/sgattrib/showHideAttribute.cxx index ec2a8df8f1..dca7595de8 100644 --- a/panda/src/sgattrib/showHideAttribute.cxx +++ b/panda/src/sgattrib/showHideAttribute.cxx @@ -61,6 +61,6 @@ output_property(ostream &out, const PT(Camera) &prop) const { //////////////////////////////////////////////////////////////////// void ShowHideAttribute:: write_property(ostream &out, const PT(Camera) &prop, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << *prop << "\n"; } diff --git a/panda/src/sgattrib/showHideAttribute.h b/panda/src/sgattrib/showHideAttribute.h index 06f67e1dee..e0bb2c19c0 100644 --- a/panda/src/sgattrib/showHideAttribute.h +++ b/panda/src/sgattrib/showHideAttribute.h @@ -20,7 +20,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_CAMERA); //////////////////////////////////////////////////////////////////// -// Class : ShowHideAttribute +// Class : ShowHideAttribute // Description : See ShowHideTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ShowHideAttribute : public MultiAttribute { @@ -34,7 +34,7 @@ public: protected: virtual void output_property(ostream &out, const PT(Camera) &prop) const; virtual void write_property(ostream &out, const PT(Camera) &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -47,7 +47,7 @@ public: static void init_type() { MultiAttribute::init_type(); register_type(_type_handle, "ShowHideAttribute", - MultiAttribute::get_class_type()); + MultiAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/showHideNameClass.h b/panda/src/sgattrib/showHideNameClass.h index 2577a6ab21..88e91fbfa7 100644 --- a/panda/src/sgattrib/showHideNameClass.h +++ b/panda/src/sgattrib/showHideNameClass.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ShowHideNameClass +// Class : ShowHideNameClass // Description : This is a stupid little class that's used by // ShowHideTransition to define the name of its // PT(Camera) class, so the MultiTransition it diff --git a/panda/src/sgattrib/showHideTransition.cxx b/panda/src/sgattrib/showHideTransition.cxx index a53579fdab..31d57027a4 100644 --- a/panda/src/sgattrib/showHideTransition.cxx +++ b/panda/src/sgattrib/showHideTransition.cxx @@ -60,6 +60,6 @@ output_property(ostream &out, const PT(Camera) &prop) const { //////////////////////////////////////////////////////////////////// void ShowHideTransition:: write_property(ostream &out, const PT(Camera) &prop, - int indent_level) const { + int indent_level) const { indent(out, indent_level) << *prop << "\n"; } diff --git a/panda/src/sgattrib/showHideTransition.h b/panda/src/sgattrib/showHideTransition.h index 8525086369..2709780148 100644 --- a/panda/src/sgattrib/showHideTransition.h +++ b/panda/src/sgattrib/showHideTransition.h @@ -20,7 +20,7 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTITRANSITION_CAMERA); //////////////////////////////////////////////////////////////////// -// Class : ShowHideTransition +// Class : ShowHideTransition // Description : This transition controls which cameras can view the // geometry. By default, all cameras see everything; // you can restrict the visibility of a particular @@ -40,7 +40,7 @@ public: protected: virtual void output_property(ostream &out, const PT(Camera) &prop) const; virtual void write_property(ostream &out, const PT(Camera) &prop, - int indent_level) const; + int indent_level) const; public: virtual TypeHandle get_type() const { @@ -53,7 +53,7 @@ public: static void init_type() { MultiTransition::init_type(); register_type(_type_handle, "ShowHideTransition", - MultiTransition::get_class_type()); + MultiTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/stencilAttribute.h b/panda/src/sgattrib/stencilAttribute.h index b8e958044a..71992831d7 100644 --- a/panda/src/sgattrib/stencilAttribute.h +++ b/panda/src/sgattrib/stencilAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : StencilAttribute +// Class : StencilAttribute // Description : See StencilTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA StencilAttribute : public OnAttribute { @@ -51,7 +51,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "StencilAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/stencilProperty.cxx b/panda/src/sgattrib/stencilProperty.cxx index e0ec09662f..37645d7dc8 100644 --- a/panda/src/sgattrib/stencilProperty.cxx +++ b/panda/src/sgattrib/stencilProperty.cxx @@ -28,10 +28,10 @@ operator << (ostream &out, StencilProperty::Mode mode) { case StencilProperty::M_not_equal: return out << "not_equal"; - + case StencilProperty::M_greater_equal: return out << "greater_equal"; - + case StencilProperty::M_always: return out << "always"; } diff --git a/panda/src/sgattrib/stencilProperty.h b/panda/src/sgattrib/stencilProperty.h index 8316d6311d..218b0ce2dd 100644 --- a/panda/src/sgattrib/stencilProperty.h +++ b/panda/src/sgattrib/stencilProperty.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : StencilProperty +// Class : StencilProperty // Description : Defines how we can write to and stencil via the // stencil buffer. //////////////////////////////////////////////////////////////////// @@ -18,12 +18,12 @@ public: enum Mode { M_none, // No stencil test, and no write to stencil buffer. M_never, // Never draw. - M_less, // incoming < stored - M_equal, // incoming == stored - M_less_equal, // incoming <= stored - M_greater, // incoming > stored - M_not_equal, // incoming != stored - M_greater_equal, // incoming >= stored + M_less, // incoming < stored + M_equal, // incoming == stored + M_less_equal, // incoming <= stored + M_greater, // incoming > stored + M_not_equal, // incoming != stored + M_greater_equal, // incoming >= stored M_always // Always draw. }; diff --git a/panda/src/sgattrib/stencilTransition.I b/panda/src/sgattrib/stencilTransition.I index b2a60c0155..2d6eaf133d 100644 --- a/panda/src/sgattrib/stencilTransition.I +++ b/panda/src/sgattrib/stencilTransition.I @@ -10,7 +10,7 @@ //////////////////////////////////////////////////////////////////// INLINE StencilTransition:: StencilTransition(StencilProperty::Mode mode, - StencilProperty::Action action) : + StencilProperty::Action action) : _value(mode, action) { } diff --git a/panda/src/sgattrib/stencilTransition.h b/panda/src/sgattrib/stencilTransition.h index 357f699154..68aef49f74 100644 --- a/panda/src/sgattrib/stencilTransition.h +++ b/panda/src/sgattrib/stencilTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : StencilTransition +// Class : StencilTransition // Description : This is scene graph stencil (which is not to be // confused with geometry stencil). By setting a // StencilTransition on the scene graph, you can override @@ -25,7 +25,7 @@ class EXPCL_PANDA StencilTransition : public OnTransition { public: INLINE StencilTransition(StencilProperty::Mode mode, - StencilProperty::Action action = StencilProperty::A_keep); + StencilProperty::Action action = StencilProperty::A_keep); INLINE void set_mode(StencilProperty::Mode mode); INLINE StencilProperty::Mode get_mode() const; @@ -55,7 +55,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "StencilTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/test_attrib.cxx b/panda/src/sgattrib/test_attrib.cxx index 5975632376..a7befddbc4 100644 --- a/panda/src/sgattrib/test_attrib.cxx +++ b/panda/src/sgattrib/test_attrib.cxx @@ -23,21 +23,21 @@ public: _indent_level = 0; } bool reached_node(Node *node, AttributeWrapper &state, - NullLevelState &) { + NullLevelState &) { indent(cerr, _indent_level) << "\nReached " << *node << ", state is:\n"; state.write(cerr, _indent_level); return true; } bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + NullLevelState &) { _indent_level += 2; return true; } void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, - const NullLevelState &) { + AttributeWrapper &pre, AttributeWrapper &post, + const NullLevelState &) { _indent_level -= 2; } int _indent_level; @@ -93,9 +93,9 @@ main(int argc, char *argv[]) { cerr << "\n"; PrintNodes pn; df_traverse(r, pn, - AllAttributesWrapper(), - NullLevelState(), - NodeRelation::get_class_type()); + AllAttributesWrapper(), + NullLevelState(), + NodeRelation::get_class_type()); cerr << "\n"; AllTransitionsWrapper result; diff --git a/panda/src/sgattrib/texGenAttribute.h b/panda/src/sgattrib/texGenAttribute.h index 1465afab5c..2dcbd1f785 100644 --- a/panda/src/sgattrib/texGenAttribute.h +++ b/panda/src/sgattrib/texGenAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexGenAttribute +// Class : TexGenAttribute // Description : See TexGenTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TexGenAttribute : public OnAttribute { @@ -52,7 +52,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "TexGenAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/texGenProperty.h b/panda/src/sgattrib/texGenProperty.h index e2b8db270e..c486f347eb 100644 --- a/panda/src/sgattrib/texGenProperty.h +++ b/panda/src/sgattrib/texGenProperty.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexGenProperty +// Class : TexGenProperty // Description : This defines the kinds of texture coordinates that // may be automatically generated at render time. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgattrib/texGenTransition.h b/panda/src/sgattrib/texGenTransition.h index 1e2a50add6..cc9f36fdbf 100644 --- a/panda/src/sgattrib/texGenTransition.h +++ b/panda/src/sgattrib/texGenTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexGenTransition +// Class : TexGenTransition // Description : This controls the kinds of blending between colors // being rendered and the existing frame buffer. //////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "TexGenTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/texMatrixAttribute.h b/panda/src/sgattrib/texMatrixAttribute.h index 842daa177f..6430ac14b1 100644 --- a/panda/src/sgattrib/texMatrixAttribute.h +++ b/panda/src/sgattrib/texMatrixAttribute.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexMatrixAttribute +// Class : TexMatrixAttribute // Description : See TexMatrixTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TexMatrixAttribute : public LMatrix4fAttribute { @@ -36,7 +36,7 @@ public: static void init_type() { LMatrix4fAttribute::init_type(); register_type(_type_handle, "TexMatrixAttribute", - LMatrix4fAttribute::get_class_type()); + LMatrix4fAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/texMatrixTransition.h b/panda/src/sgattrib/texMatrixTransition.h index c6a24ced56..4b833c4990 100644 --- a/panda/src/sgattrib/texMatrixTransition.h +++ b/panda/src/sgattrib/texMatrixTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexMatrixTransition +// Class : TexMatrixTransition // Description : If present, this modifies the texture coordinates on // geometry as it is rendered. //////////////////////////////////////////////////////////////////// @@ -39,7 +39,7 @@ public: static void init_type() { LMatrix4fTransition::init_type(); register_type(_type_handle, "TexMatrixTransition", - LMatrix4fTransition::get_class_type()); + LMatrix4fTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/textureApplyAttribute.h b/panda/src/sgattrib/textureApplyAttribute.h index d402a1db5c..1c2665ae9b 100644 --- a/panda/src/sgattrib/textureApplyAttribute.h +++ b/panda/src/sgattrib/textureApplyAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextureApplyAttribute +// Class : TextureApplyAttribute // Description : See TextureApplyTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TextureApplyAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "TextureApplyAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/textureApplyProperty.h b/panda/src/sgattrib/textureApplyProperty.h index 1056bade14..dd3366d9ae 100644 --- a/panda/src/sgattrib/textureApplyProperty.h +++ b/panda/src/sgattrib/textureApplyProperty.h @@ -12,7 +12,7 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : TextureApplyProperty +// Class : TextureApplyProperty // Description : Defines the way texture colors modify existing // geometry colors. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgattrib/textureApplyTransition.h b/panda/src/sgattrib/textureApplyTransition.h index c5fa704a64..790b2c2a0d 100644 --- a/panda/src/sgattrib/textureApplyTransition.h +++ b/panda/src/sgattrib/textureApplyTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextureApplyTransition +// Class : TextureApplyTransition // Description : This controls the way textures modify the colors // assigned to geometry. //////////////////////////////////////////////////////////////////// @@ -56,7 +56,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "TextureApplyTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/textureAttribute.h b/panda/src/sgattrib/textureAttribute.h index f162368af7..c371aa8216 100644 --- a/panda/src/sgattrib/textureAttribute.h +++ b/panda/src/sgattrib/textureAttribute.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextureAttribute +// Class : TextureAttribute // Description : See TextureTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TextureAttribute : public OnOffAttribute { @@ -47,7 +47,7 @@ public: static void init_type() { OnOffAttribute::init_type(); register_type(_type_handle, "TextureAttribute", - OnOffAttribute::get_class_type()); + OnOffAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/textureTransition.h b/panda/src/sgattrib/textureTransition.h index cf3b41e91e..0ab8433965 100644 --- a/panda/src/sgattrib/textureTransition.h +++ b/panda/src/sgattrib/textureTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextureTransition +// Class : TextureTransition // Description : This controls the assignment of the primary texture // to a piece of geometry. If there is no // TextureTransition or the transition is off, the @@ -54,7 +54,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_TextureTransition(const FactoryParams ¶ms); @@ -71,7 +71,7 @@ public: static void init_type() { OnOffTransition::init_type(); register_type(_type_handle, "TextureTransition", - OnOffTransition::get_class_type()); + OnOffTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/transformAttribute.h b/panda/src/sgattrib/transformAttribute.h index 34f5069559..b636694e79 100644 --- a/panda/src/sgattrib/transformAttribute.h +++ b/panda/src/sgattrib/transformAttribute.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TransformAttribute +// Class : TransformAttribute // Description : See TransformTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TransformAttribute : public LMatrix4fAttribute { @@ -36,7 +36,7 @@ public: static void init_type() { LMatrix4fAttribute::init_type(); register_type(_type_handle, "TransformAttribute", - LMatrix4fAttribute::get_class_type()); + LMatrix4fAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/transformTransition.h b/panda/src/sgattrib/transformTransition.h index 3b08f48da2..ab0829da49 100644 --- a/panda/src/sgattrib/transformTransition.h +++ b/panda/src/sgattrib/transformTransition.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TransformTransition +// Class : TransformTransition // Description : This defines a new coordinate system. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TransformTransition : public LMatrix4fTransition { @@ -45,7 +45,7 @@ public: static void init_type() { LMatrix4fTransition::init_type(); register_type(_type_handle, "TransformTransition", - LMatrix4fTransition::get_class_type()); + LMatrix4fTransition::get_class_type()); } private: diff --git a/panda/src/sgattrib/transparencyAttribute.h b/panda/src/sgattrib/transparencyAttribute.h index fc1dbd9248..ccbf3f3baf 100644 --- a/panda/src/sgattrib/transparencyAttribute.h +++ b/panda/src/sgattrib/transparencyAttribute.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TransparencyAttribute +// Class : TransparencyAttribute // Description : See TransparencyTransition. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TransparencyAttribute : public OnAttribute { @@ -48,7 +48,7 @@ public: static void init_type() { OnAttribute::init_type(); register_type(_type_handle, "TransparencyAttribute", - OnAttribute::get_class_type()); + OnAttribute::get_class_type()); } private: diff --git a/panda/src/sgattrib/transparencyProperty.h b/panda/src/sgattrib/transparencyProperty.h index 17457adb8d..67b511ddba 100644 --- a/panda/src/sgattrib/transparencyProperty.h +++ b/panda/src/sgattrib/transparencyProperty.h @@ -12,19 +12,19 @@ class Datagram; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : TransparencyProperty +// Class : TransparencyProperty // Description : This defines the types of transparency that can be // enabled. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA TransparencyProperty { public: enum Mode { - M_none, // No transparency in effect. - M_alpha, // Writes to depth buffer of transp objects disabled - M_alpha_sorted, // Assumes transp objects are depth sorted - M_multisample, // Source alpha values modified to 1.0 before writing - M_multisample_mask, // Source alpha values not modified - M_binary, // Only writes pixels with alpha = 1.0 + M_none, // No transparency in effect. + M_alpha, // Writes to depth buffer of transp objects disabled + M_alpha_sorted, // Assumes transp objects are depth sorted + M_multisample, // Source alpha values modified to 1.0 before writing + M_multisample_mask, // Source alpha values not modified + M_binary, // Only writes pixels with alpha = 1.0 }; public: diff --git a/panda/src/sgattrib/transparencyTransition.h b/panda/src/sgattrib/transparencyTransition.h index ab3435b377..6cf6ab6d87 100644 --- a/panda/src/sgattrib/transparencyTransition.h +++ b/panda/src/sgattrib/transparencyTransition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TransparencyTransition +// Class : TransparencyTransition // Description : This controls the enabling of transparency. Simply // setting an alpha component to non-1 does not in // itself make an object transparent; you must also @@ -64,7 +64,7 @@ public: static void init_type() { OnTransition::init_type(); register_type(_type_handle, "TransparencyTransition", - OnTransition::get_class_type()); + OnTransition::get_class_type()); } private: diff --git a/panda/src/sgidisplay/sgiGraphicsPipe.cxx b/panda/src/sgidisplay/sgiGraphicsPipe.cxx index 4fff7673d6..4fe23deee7 100644 --- a/panda/src/sgidisplay/sgiGraphicsPipe.cxx +++ b/panda/src/sgidisplay/sgiGraphicsPipe.cxx @@ -35,18 +35,18 @@ int sgiGraphicsPipe::get_num_hw_channels( void ) { if ( _num_channels == -1 ) { - Display* display = (Display *)_display; - // Is there a better way to get the display??? (I hope so) - display = glXGetCurrentDisplayEXT(); - - // For now, screen is the same as display - _screen = DefaultScreen( display ); + Display* display = (Display *)_display; + // Is there a better way to get the display??? (I hope so) + display = glXGetCurrentDisplayEXT(); - XSGIvcScreenInfo server; - XSGIvcQueryVideoScreenInfo( display, _screen, &server ); + // For now, screen is the same as display + _screen = DefaultScreen( display ); - // Not all of these will be active necessarily - _num_channels = server.numChannels; + XSGIvcScreenInfo server; + XSGIvcQueryVideoScreenInfo( display, _screen, &server ); + + // Not all of these will be active necessarily + _num_channels = server.numChannels; } return _num_channels; @@ -60,13 +60,13 @@ int sgiGraphicsPipe::get_num_hw_channels( void ) HardwareChannel *sgiGraphicsPipe:: get_hw_channel( GraphicsWindow* window, int index ) { if ( _num_channels == -1 ) - get_num_hw_channels(); + get_num_hw_channels(); if ( index >= _num_channels ) { - cerr << "sgiGraphicsPipe::get_hw_channel() - invalid index: " - << index << endl; - return NULL; + cerr << "sgiGraphicsPipe::get_hw_channel() - invalid index: " + << index << endl; + return NULL; } Channels::iterator i; @@ -89,7 +89,7 @@ TypeHandle sgiGraphicsPipe::get_class_type(void) { void sgiGraphicsPipe::init_type(void) { InteractiveGraphicsPipe::init_type(); register_type(_type_handle, "sgiGraphicsPipe", - InteractiveGraphicsPipe::get_class_type()); + InteractiveGraphicsPipe::get_class_type()); } TypeHandle sgiGraphicsPipe::get_type(void) const { diff --git a/panda/src/sgidisplay/sgiGraphicsPipe.h b/panda/src/sgidisplay/sgiGraphicsPipe.h index 160ae5e1d3..eb4f629d07 100644 --- a/panda/src/sgidisplay/sgiGraphicsPipe.h +++ b/panda/src/sgidisplay/sgiGraphicsPipe.h @@ -26,7 +26,7 @@ //////////////////////////////////////////////////////////////////// class sgiGraphicsPipe : public InteractiveGraphicsPipe { public: - + sgiGraphicsPipe(const PipeSpecifier&); virtual ~sgiGraphicsPipe() = 0; @@ -40,7 +40,7 @@ protected: virtual int get_num_hw_channels(); virtual HardwareChannel *get_hw_channel(GraphicsWindow* window, - int index); + int index); public: @@ -50,7 +50,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} protected: - + void *_display; int _screen; int _num_channels; diff --git a/panda/src/sgidisplay/sgiHardwareChannel.cxx b/panda/src/sgidisplay/sgiHardwareChannel.cxx index e4c17ce8d6..e02ee36a15 100644 --- a/panda/src/sgidisplay/sgiHardwareChannel.cxx +++ b/panda/src/sgidisplay/sgiHardwareChannel.cxx @@ -22,27 +22,27 @@ TypeHandle sgiHardwareChannel::_type_handle; // Description: //////////////////////////////////////////////////////////////////// sgiHardwareChannel::sgiHardwareChannel( GraphicsWindow* window, int id ) : - HardwareChannel( window ) + HardwareChannel( window ) { _id = id; const GraphicsPipe* pipe = window->get_pipe(); const sgiGraphicsPipe* sgipipe; if ( pipe->get_class_type() == sgiGraphicsPipe::get_class_type() ) - sgipipe = (sgiGraphicsPipe *)pipe; + sgipipe = (sgiGraphicsPipe *)pipe; else { - cerr << "sgiHardwareChannel::Constructor() - window does not have " - << "an sgiGraphicsPipe!!!" << endl; - return; + cerr << "sgiHardwareChannel::Constructor() - window does not have " + << "an sgiGraphicsPipe!!!" << endl; + return; } XSGIvcChannelInfo* channel_info = (XSGIvcChannelInfo *)_channel_info; XSGIvcQueryChannelInfo( (Display *)sgipipe->get_display(), - sgipipe->get_screen(), _id, &channel_info ); + sgipipe->get_screen(), _id, &channel_info ); if ( channel_info->active ) { int screeny = DisplayHeight( (Display *)sgipipe->get_display(), - sgipipe->get_screen() ); + sgipipe->get_screen() ); _xsize = channel_info->source.width; _ysize = channel_info->source.height; _xorg = channel_info->source.x; diff --git a/panda/src/sgidisplay/sgiHardwareChannel.h b/panda/src/sgidisplay/sgiHardwareChannel.h index 33eb348d43..9c78c2421f 100644 --- a/panda/src/sgidisplay/sgiHardwareChannel.h +++ b/panda/src/sgidisplay/sgiHardwareChannel.h @@ -25,11 +25,11 @@ class sgiHardwareChannel : public HardwareChannel { public: - sgiHardwareChannel( GraphicsWindow* window, int id ); + sgiHardwareChannel( GraphicsWindow* window, int id ); protected: - void *_channel_info; + void *_channel_info; public: diff --git a/panda/src/sgiglutdisplay/config_sgiglutdisplay.cxx b/panda/src/sgiglutdisplay/config_sgiglutdisplay.cxx index fa855b2b6d..c10a833c43 100644 --- a/panda/src/sgiglutdisplay/config_sgiglutdisplay.cxx +++ b/panda/src/sgiglutdisplay/config_sgiglutdisplay.cxx @@ -14,5 +14,5 @@ NotifyCategoryDef(sgiglutdisplay, "display"); ConfigureFn(config_sgiglutdisplay) { sgiglutGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory(sgiglutGraphicsPipe::get_class_type(), - sgiglutGraphicsPipe::make_sgiglutGraphicsPipe); + sgiglutGraphicsPipe::make_sgiglutGraphicsPipe); } diff --git a/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.cxx b/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.cxx index a77abc9303..8d34ad75c6 100644 --- a/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.cxx +++ b/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.cxx @@ -45,7 +45,7 @@ TypeHandle sgiglutGraphicsPipe::get_class_type(void) { void sgiglutGraphicsPipe::init_type(void) { sgiGraphicsPipe::init_type(); register_type(_type_handle, "sgiglutGraphicsPipe", - sgiGraphicsPipe::get_class_type()); + sgiGraphicsPipe::get_class_type()); } TypeHandle sgiglutGraphicsPipe::get_type(void) const { diff --git a/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.h b/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.h index 63b9ca3fd1..20bb8935bb 100644 --- a/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.h +++ b/panda/src/sgiglutdisplay/sgiglutGraphicsPipe.h @@ -22,8 +22,8 @@ //////////////////////////////////////////////////////////////////// // Class : sgiglutGraphicsPipe // Description : This kind of pipe can create glut windows but -// supports the functionality of an sgi pipe with -// hardware channels +// supports the functionality of an sgi pipe with +// hardware channels //////////////////////////////////////////////////////////////////// class sgiglutGraphicsPipe : public sgiGraphicsPipe { diff --git a/panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx b/panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx index d6a4b80fa2..f0184b0d57 100644 --- a/panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx +++ b/panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx @@ -14,5 +14,5 @@ NotifyCategoryDef(sgiglxdisplay, "display"); ConfigureFn(config_sgiglxdisplay) { SgiGlxGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory(SgiGlxGraphicsPipe::get_class_type(), - SgiGlxGraphicsPipe::make_sgiglxgraphicspipe); + SgiGlxGraphicsPipe::make_sgiglxgraphicspipe); } diff --git a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx index 8817cc65d6..ab2be698ca 100644 --- a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx +++ b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.cxx @@ -60,8 +60,8 @@ void SgiGlxGraphicsPipe::init_type(void) { sgiGraphicsPipe::init_type(); glxDisplay::init_type(); register_type(_type_handle, "SgiGlxGraphicsPipe", - sgiGraphicsPipe::get_class_type(), - glxDisplay::get_class_type()); + sgiGraphicsPipe::get_class_type(), + glxDisplay::get_class_type()); } TypeHandle SgiGlxGraphicsPipe::get_type(void) const { diff --git a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h index bd10b956b2..92615b155c 100644 --- a/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h +++ b/panda/src/sgiglxdisplay/sgiglxGraphicsPipe.h @@ -17,8 +17,8 @@ //////////////////////////////////////////////////////////////////// // Class : SgiGlxGraphicsPipe // Description : This kind of pipe can create glx windows but -// supports the functionality of an sgi pipe with -// hardware channels +// supports the functionality of an sgi pipe with +// hardware channels //////////////////////////////////////////////////////////////////// class SgiGlxGraphicsPipe : public sgiGraphicsPipe, public glxDisplay { public: diff --git a/panda/src/sgmanip/findApproxLevel.cxx b/panda/src/sgmanip/findApproxLevel.cxx index a035384903..f82b52e257 100644 --- a/panda/src/sgmanip/findApproxLevel.cxx +++ b/panda/src/sgmanip/findApproxLevel.cxx @@ -37,7 +37,7 @@ output(ostream &out) const { //////////////////////////////////////////////////////////////////// void FindApproxLevelEntry:: consider_node(NodePathCollection &result, FindApproxLevel &next_level, - int max_matches, TypeHandle graph_type) const { + int max_matches, TypeHandle graph_type) const { nassertv(_i < _approx_path.get_num_components()); if (_approx_path.is_component_match_many(_i)) { @@ -54,7 +54,7 @@ consider_node(NodePathCollection &result, FindApproxLevel &next_level, // Does this now represent a solution? result.add_path(reconsider._node_path); if (max_matches > 0 && result.get_num_paths() >= max_matches) { - return; + return; } } else { reconsider.consider_node(result, next_level, max_matches, graph_type); @@ -112,8 +112,8 @@ consider_node(NodePathCollection &result, FindApproxLevel &next_level, //////////////////////////////////////////////////////////////////// void FindApproxLevelEntry:: consider_next_step(NodePathCollection &result, - NodeRelation *arc, FindApproxLevel &next_level, - int max_matches, TypeHandle graph_type) const { + NodeRelation *arc, FindApproxLevel &next_level, + int max_matches, TypeHandle graph_type) const { if (!_approx_path.return_hidden() && arc->has_transition(PruneTransition::get_class_type())) { // If the approx path does not allow us to return hidden nodes, diff --git a/panda/src/sgmanip/findApproxLevel.h b/panda/src/sgmanip/findApproxLevel.h index 2d19fe6ddf..9c2ff67de8 100644 --- a/panda/src/sgmanip/findApproxLevel.h +++ b/panda/src/sgmanip/findApproxLevel.h @@ -28,17 +28,17 @@ class NodePathCollection; class FindApproxLevelEntry { public: INLINE FindApproxLevelEntry(const NodePath &node_path, - FindApproxPath &approx_path); + FindApproxPath &approx_path); INLINE FindApproxLevelEntry(const FindApproxLevelEntry ©); INLINE void operator = (const FindApproxLevelEntry ©); INLINE bool next_is_stashed() const; void consider_node(NodePathCollection &result, FindApproxLevel &next_level, - int max_matches, TypeHandle graph_type) const; + int max_matches, TypeHandle graph_type) const; void consider_next_step(NodePathCollection &result, - NodeRelation *arc, FindApproxLevel &next_level, - int max_matches, TypeHandle graph_type) const; + NodeRelation *arc, FindApproxLevel &next_level, + int max_matches, TypeHandle graph_type) const; INLINE bool is_solution() const; void output(ostream &out) const; diff --git a/panda/src/sgmanip/findApproxPath.cxx b/panda/src/sgmanip/findApproxPath.cxx index 46e2b3c44f..0bbd2fe0bd 100644 --- a/panda/src/sgmanip/findApproxPath.cxx +++ b/panda/src/sgmanip/findApproxPath.cxx @@ -202,7 +202,7 @@ add_component(string str_component) { } else if (str_component == "**") { if ((flags & CF_stashed) != 0) { sgmanip_cat.error() - << "@@** is undefined; use @@*/** or **/@@* instead.\n"; + << "@@** is undefined; use @@*/** or **/@@* instead.\n"; return false; } add_match_many(flags); @@ -213,7 +213,7 @@ add_component(string str_component) { if (handle == TypeHandle::none()) { sgmanip_cat.error() - << "Invalid type name: " + type_name; + << "Invalid type name: " + type_name; return false; } else { @@ -226,7 +226,7 @@ add_component(string str_component) { if (handle == TypeHandle::none()) { sgmanip_cat.error() - << "Invalid type name: " + type_name; + << "Invalid type name: " + type_name; return false; } else { diff --git a/panda/src/sgmanip/nodePath.I b/panda/src/sgmanip/nodePath.I index c25e78993f..cc7ff46bf3 100644 --- a/panda/src/sgmanip/nodePath.I +++ b/panda/src/sgmanip/nodePath.I @@ -664,9 +664,9 @@ set_pos_hpr(float x, float y, float z, float h, float p, float r) { //////////////////////////////////////////////////////////////////// INLINE void NodePath:: set_pos_hpr_scale(float x, float y, float z, float h, float p, float r, - float sx, float sy, float sz) { + float sx, float sy, float sz) { set_pos_hpr_scale(LVecBase3f(x, y, z), LVecBase3f(h, p, r), - LVecBase3f(sx, sy, sz)); + LVecBase3f(sx, sy, sz)); } //////////////////////////////////////////////////////////////////// @@ -960,8 +960,8 @@ get_sz(const NodePath &other) const { //////////////////////////////////////////////////////////////////// INLINE void NodePath:: set_pos_hpr(const NodePath &other, - float x, float y, float z, - float h, float p, float r) { + float x, float y, float z, + float h, float p, float r) { set_pos_hpr(other, LVecBase3f(x, y, z), LVecBase3f(h, p, r)); } @@ -974,11 +974,11 @@ set_pos_hpr(const NodePath &other, //////////////////////////////////////////////////////////////////// INLINE void NodePath:: set_pos_hpr_scale(const NodePath &other, - float x, float y, float z, - float h, float p, float r, - float sx, float sy, float sz) { + float x, float y, float z, + float h, float p, float r, + float sx, float sy, float sz) { set_pos_hpr_scale(other, LVecBase3f(x, y, z), LVecBase3f(h, p, r), - LVecBase3f(sx, sy, sz)); + LVecBase3f(sx, sy, sz)); } //////////////////////////////////////////////////////////////////// @@ -1119,7 +1119,7 @@ get_distance(const NodePath &other) const { //////////////////////////////////////////////////////////////////// INLINE void NodePath:: set_color(float r, float g, float b, float a, - int priority) { + int priority) { set_color(Colorf(r, g, b, a), priority); } diff --git a/panda/src/sgmanip/nodePath.cxx b/panda/src/sgmanip/nodePath.cxx index d0583bfc8a..4f261ff54f 100644 --- a/panda/src/sgmanip/nodePath.cxx +++ b/panda/src/sgmanip/nodePath.cxx @@ -38,12 +38,12 @@ TypeHandle NodePath::_type_handle; class ScenePrepareVisitor : public TraverserVisitor { public: bool forward_arc(NodeRelation *, NodeTransitionWrapper &trans, - NodeAttributeWrapper &, NodeAttributeWrapper &, - NullLevelState &) { + NodeAttributeWrapper &, NodeAttributeWrapper &, + NullLevelState &) { TextureTransition *tt; if (get_transition_into(tt, trans)) { if (tt->is_on()) { - tt->get_texture()->prepare(_gsg); + tt->get_texture()->prepare(_gsg); } } return true; @@ -84,8 +84,8 @@ extend_by(Node *dnode) { if (arc == (NodeRelation *)NULL) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() - << "Cannot extend " << *this << " by " - << *dnode << "; no connection.\n"; + << "Cannot extend " << *this << " by " + << *dnode << "; no connection.\n"; } return false; } @@ -117,8 +117,8 @@ extend_by(NodeRelation *darc) { if (darc->get_parent() != node()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() - << "Cannot extend " << *this << " by arc " << *darc - << "; no connection.\n"; + << "Cannot extend " << *this << " by arc " << *darc + << "; no connection.\n"; } return false; } @@ -127,8 +127,8 @@ extend_by(NodeRelation *darc) { darc->get_type() != NodeRelation::get_stashed_type()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() - << "Cannot extend " << *this << " by arc " << *darc - << "; wrong graph type.\n"; + << "Cannot extend " << *this << " by arc " << *darc + << "; wrong graph type.\n"; } return false; } @@ -178,8 +178,8 @@ extend_by(const string &path) { if (col.is_empty()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() - << "Could not extend " << *this << " by " - << path << "; no match found.\n"; + << "Could not extend " << *this << " by " + << path << "; no match found.\n"; } return false; } @@ -214,8 +214,8 @@ extend_down_to(Node *dnode) { if (col.is_empty()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() - << "Could not extend " << *this << " down to " - << *dnode << "; no connection found.\n"; + << "Could not extend " << *this << " down to " + << *dnode << "; no connection found.\n"; } return false; } @@ -270,15 +270,15 @@ get_mat(const NodePath &other) const { } else if (is_empty()) { wrt(NULL, other.node(), other.begin(), other.end(), - ntw, _graph_type); + ntw, _graph_type); } else if (other.is_empty()) { wrt(node(), begin(), end(), (Node *)NULL, ntw, _graph_type); } else { wrt(node(), begin(), end(), - other.node(), other.begin(), other.end(), - ntw, _graph_type); + other.node(), other.begin(), other.end(), + ntw, _graph_type); } const TransformTransition *tt; @@ -321,8 +321,8 @@ set_mat(const NodePath &other, const LMatrix4f &mat) { wrt(NULL, darc->get_parent(), from, end(), ntw, _graph_type); } else { wrt(other.node(), other.begin(), other.end(), - darc->get_parent(), from, end(), - ntw, _graph_type); + darc->get_parent(), from, end(), + ntw, _graph_type); } LMatrix4f new_mat,*new_mat_ptr; @@ -330,10 +330,10 @@ set_mat(const NodePath &other, const LMatrix4f &mat) { if (!get_transition_into(tt, ntw)) { // No relative transform. - new_mat_ptr = (LMatrix4f*)&mat; + new_mat_ptr = (LMatrix4f*)&mat; } else { - new_mat.multiply(mat,tt->get_matrix()); - new_mat_ptr = &new_mat; + new_mat.multiply(mat,tt->get_matrix()); + new_mat_ptr = &new_mat; } darc->set_transition(new TransformTransition(*new_mat_ptr)); @@ -614,8 +614,8 @@ share_with(const NodePath &other) { } // The remaining components are arcs. while (oi != other_comps.end() && - ti != this_comps.end() && - (*oi)->get_arc() == (*ti)->get_arc()) { + ti != this_comps.end() && + (*oi)->get_arc() == (*ti)->get_arc()) { ++oi; ++ti; ++in_common; @@ -868,7 +868,7 @@ instance_to(const NodePath &other, int sort) const { Node *bottom_node = node(); NodeRelation *darc = NodeRelation::create_typed_arc(_graph_type, other.node(), - bottom_node, sort); + bottom_node, sort); nassertr(darc != (NodeRelation *)NULL, NodePath()); nassertr(darc->is_exact_type(_graph_type), NodePath()); @@ -910,7 +910,7 @@ copy_to(const NodePath &other, int sort) const { NodeRelation *darc = NodeRelation::create_typed_arc(_graph_type, other.node(), - copy_node, sort); + copy_node, sort); nassertr(darc != (NodeRelation *)NULL, NodePath()); nassertr(darc->is_exact_type(_graph_type), NodePath()); @@ -1488,7 +1488,7 @@ set_pos_hpr(const LVecBase3f &pos, const LVecBase3f &hpr) { //////////////////////////////////////////////////////////////////// void NodePath:: set_pos_hpr_scale(const LVecBase3f &pos, const LVecBase3f &hpr, - const LVecBase3f &scale) { + const LVecBase3f &scale) { nassertv(has_arcs()); LMatrix4f mat; compose_matrix(mat, scale, hpr, pos); @@ -1820,7 +1820,7 @@ get_scale(const NodePath &other) const { //////////////////////////////////////////////////////////////////// void NodePath:: set_pos_hpr(const NodePath &other, const LVecBase3f &pos, - const LVecBase3f &hpr) { + const LVecBase3f &hpr) { nassertv(has_arcs()); LMatrix4f mat = get_mat(other); LVecBase3f scale, old_hpr, old_pos; @@ -1838,8 +1838,8 @@ set_pos_hpr(const NodePath &other, const LVecBase3f &pos, //////////////////////////////////////////////////////////////////// void NodePath:: set_pos_hpr_scale(const NodePath &other, - const LVecBase3f &pos, const LVecBase3f &hpr, - const LVecBase3f &scale) { + const LVecBase3f &pos, const LVecBase3f &hpr, + const LVecBase3f &scale) { nassertv(has_arcs()); LMatrix4f mat; compose_matrix(mat, scale, hpr, pos); @@ -1905,7 +1905,7 @@ heads_up(const NodePath &other, const LPoint3f &point, const LVector3f &up) { //////////////////////////////////////////////////////////////////// void NodePath:: look_at_preserve_scale(const NodePath &other, const LPoint3f &point, - const LVector3f &up) { + const LVector3f &up) { nassertv(has_arcs()); LMatrix4f mat = get_mat(); @@ -1958,7 +1958,7 @@ look_at_preserve_scale(const NodePath &other, const LPoint3f &point, //////////////////////////////////////////////////////////////////// void NodePath:: heads_up_preserve_scale(const NodePath &other, const LPoint3f &point, - const LVector3f &up) { + const LVector3f &up) { nassertv(has_arcs()); LMatrix4f mat = get_mat(); @@ -2701,7 +2701,7 @@ prepare_scene(GraphicsStateGuardianBase *gsg) { NodeAttributeWrapper initial(TextureTransition::get_class_type()); df_traverse(node(), visitor, initial, NullLevelState(), - RenderRelation::get_class_type()); + RenderRelation::get_class_type()); } //////////////////////////////////////////////////////////////////// @@ -2817,23 +2817,23 @@ r_as_string(const ArcComponent *comp, string &result, int skip_nodes) const { int nodes_before = r_as_string(comp->get_next(), result, skip_nodes); if (skip_nodes <= nodes_before) { if (skip_nodes != nodes_before) { - // This is not the first node, so format a slash between the - // previous node and this node. + // This is not the first node, so format a slash between the + // previous node and this node. - NodeRelation *darc = comp->get_arc(); - if (darc->get_child() == (Node *)NULL && - darc->get_parent() == (Node *)NULL) { - // Here's a deleted arc. Indicate this. - result += "/(...deleted...)"; - } else { - if (darc->get_parent() != comp->get_next()->get_node() && - comp->get_next()->get_node() != (Node *)NULL) { - // It's not a deleted arc, but something's broken. - result += "/.../" + format_node_name(darc->get_parent()); - } - result += format_arc_name(darc); - result += format_node_name(darc->get_child()); - } + NodeRelation *darc = comp->get_arc(); + if (darc->get_child() == (Node *)NULL && + darc->get_parent() == (Node *)NULL) { + // Here's a deleted arc. Indicate this. + result += "/(...deleted...)"; + } else { + if (darc->get_parent() != comp->get_next()->get_node() && + comp->get_next()->get_node() != (Node *)NULL) { + // It's not a deleted arc, but something's broken. + result += "/.../" + format_node_name(darc->get_parent()); + } + result += format_arc_name(darc); + result += format_node_name(darc->get_child()); + } } } return nodes_before + 1; @@ -2847,7 +2847,7 @@ r_as_string(const ArcComponent *comp, string &result, int skip_nodes) const { //////////////////////////////////////////////////////////////////// void NodePath:: r_write_transitions(const ArcComponent *comp, - ostream &out, int indent_level) const { + ostream &out, int indent_level) const { nassertv(comp != (const ArcComponent *)NULL); nassertv(comp->has_arc()); @@ -2867,7 +2867,7 @@ r_write_transitions(const ArcComponent *comp, //////////////////////////////////////////////////////////////////// void NodePath:: r_get_net_transitions(const ArcComponent *comp, - AllTransitionsWrapper &trans) const { + AllTransitionsWrapper &trans) const { nassertv(comp != (const ArcComponent *)NULL); nassertv(comp->has_arc()); @@ -2901,7 +2901,7 @@ format_node_name(Node *dnode) const { // NamedNode), use the type name instead, since it's likely to be // more unique. if (!dnode->is_of_type(Node::get_class_type()) && - !dnode->is_of_type(NamedNode::get_class_type())) { + !dnode->is_of_type(NamedNode::get_class_type())) { return "-" + dnode->get_type().get_name(); } } @@ -2943,7 +2943,7 @@ format_arc_name(NodeRelation *arc) const { //////////////////////////////////////////////////////////////////// void NodePath:: find_matches(NodePathCollection &result, const string &path, - int max_matches) const { + int max_matches) const { if (is_empty()) { sgmanip_cat.warning() << "Attempt to extend an empty NodePath by '" << path @@ -2967,7 +2967,7 @@ find_matches(NodePathCollection &result, const string &path, //////////////////////////////////////////////////////////////////// void NodePath:: find_matches(NodePathCollection &result, FindApproxPath &approx_path, - int max_matches) const { + int max_matches) const { if (is_empty()) { sgmanip_cat.warning() << "Attempt to extend an empty NodePath by: " << approx_path << ".\n"; @@ -2986,8 +2986,8 @@ find_matches(NodePathCollection &result, FindApproxPath &approx_path, //////////////////////////////////////////////////////////////////// void NodePath:: r_find_matches(NodePathCollection &result, - const FindApproxLevel &level, - int max_matches, int num_levels_remaining) const { + const FindApproxLevel &level, + int max_matches, int num_levels_remaining) const { // Go on to the next level. If we exceeded the requested maximum // depth, stop. if (num_levels_remaining <= 0) { diff --git a/panda/src/sgmanip/nodePath.h b/panda/src/sgmanip/nodePath.h index ed19be31c3..d217630382 100644 --- a/panda/src/sgmanip/nodePath.h +++ b/panda/src/sgmanip/nodePath.h @@ -289,15 +289,15 @@ PUBLISHED: INLINE float get_sz() const; INLINE void set_pos_hpr(float x, float y, float z, - float h, float p, float r); + float h, float p, float r); void set_pos_hpr(const LVecBase3f &pos, - const LVecBase3f &hpr); + const LVecBase3f &hpr); INLINE void set_pos_hpr_scale(float x, float y, float z, - float h, float p, float r, - float sx, float sy, float sz); + float h, float p, float r, + float sx, float sy, float sz); void set_pos_hpr_scale(const LVecBase3f &pos, - const LVecBase3f &hpr, - const LVecBase3f &scale); + const LVecBase3f &hpr, + const LVecBase3f &scale); void set_mat(const LMatrix4f &mat); INLINE void clear_mat(); @@ -372,44 +372,44 @@ PUBLISHED: INLINE float get_sz(const NodePath &other) const; INLINE void set_pos_hpr(const NodePath &other, - float x, float y, float z, - float h, float p, float r); + float x, float y, float z, + float h, float p, float r); void set_pos_hpr(const NodePath &other, - const LVecBase3f &pos, - const LVecBase3f &hpr); + const LVecBase3f &pos, + const LVecBase3f &hpr); INLINE void set_pos_hpr_scale(const NodePath &other, - float x, float y, float z, - float h, float p, float r, - float sx, float sy, float sz); + float x, float y, float z, + float h, float p, float r, + float sx, float sy, float sz); void set_pos_hpr_scale(const NodePath &other, - const LVecBase3f &pos, - const LVecBase3f &hpr, - const LVecBase3f &scale); + const LVecBase3f &pos, + const LVecBase3f &hpr, + const LVecBase3f &scale); void set_mat(const NodePath &other, const LMatrix4f &mat); LMatrix4f get_mat(const NodePath &other) const; INLINE void look_at(const NodePath &other, - float x, float y, float z); + float x, float y, float z); void look_at(const NodePath &other, - const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), - const LVector3f &up = LVector3f::up()); + const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), + const LVector3f &up = LVector3f::up()); INLINE void heads_up(const NodePath &other, - float x, float y, float z); + float x, float y, float z); void heads_up(const NodePath &other, - const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), - const LVector3f &up = LVector3f::up()); + const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), + const LVector3f &up = LVector3f::up()); INLINE void look_at_preserve_scale(const NodePath &other, - float x, float y, float z); + float x, float y, float z); void look_at_preserve_scale(const NodePath &other, - const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), - const LVector3f &up = LVector3f::up()); + const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), + const LVector3f &up = LVector3f::up()); INLINE void heads_up_preserve_scale(const NodePath &other, - float x, float y, float z); + float x, float y, float z); void heads_up_preserve_scale(const NodePath &other, - const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), - const LVector3f &up = LVector3f::up()); + const LPoint3f &point = LPoint3f(0.0, 0.0, 0.0), + const LVector3f &up = LVector3f::up()); INLINE void print_pos(const NodePath &other) const; INLINE void print_hpr(const NodePath &other) const; @@ -425,7 +425,7 @@ PUBLISHED: // These affect the state at the bottom level only. INLINE void set_color(float r, float g, float b, float a = 1.0, - int priority = 0); + int priority = 0); void set_color(const Colorf &color, int priority = 0); void set_color_off(int priority = 0); INLINE void clear_color(); @@ -506,23 +506,23 @@ PUBLISHED: private: bool r_extend_by(const ArcComponent *other); int r_as_string(const ArcComponent *comp, string &result, - int skip_nodes) const; + int skip_nodes) const; void r_write_transitions(const ArcComponent *comp, - ostream &out, int indent_level) const; + ostream &out, int indent_level) const; void r_get_net_transitions(const ArcComponent *comp, - AllTransitionsWrapper &trans) const; + AllTransitionsWrapper &trans) const; string format_node_name(Node *dnode) const; string format_arc_name(NodeRelation *arc) const; void find_matches(NodePathCollection &result, - const string &approx_path_str, - int max_matches) const; + const string &approx_path_str, + int max_matches) const; void find_matches(NodePathCollection &result, - FindApproxPath &approx_path, - int max_matches) const; + FindApproxPath &approx_path, + int max_matches) const; void r_find_matches(NodePathCollection &result, - const FindApproxLevel &level, - int max_matches, int num_levels_remaining) const; + const FindApproxLevel &level, + int max_matches, int num_levels_remaining) const; void r_list_descendants(ostream &out, int indent_level) const; void r_list_transitions(ostream &out, int indent_level) const; @@ -539,7 +539,7 @@ public: static void init_type() { NodePathBase::init_type(); register_type(_type_handle, "NodePath", - NodePathBase::get_class_type()); + NodePathBase::get_class_type()); } private: diff --git a/panda/src/sgmanip/nodePathBase.h b/panda/src/sgmanip/nodePathBase.h index 702d58e06e..fc9f118a0a 100644 --- a/panda/src/sgmanip/nodePathBase.h +++ b/panda/src/sgmanip/nodePathBase.h @@ -44,7 +44,7 @@ public: static void init_type() { ArcChain::init_type(); register_type(_type_handle, "NodePathBase", - ArcChain::get_class_type()); + ArcChain::get_class_type()); } private: diff --git a/panda/src/sgmanip/nodePathCollection.cxx b/panda/src/sgmanip/nodePathCollection.cxx index 36f8d1ae98..7c3d5726c2 100644 --- a/panda/src/sgmanip/nodePathCollection.cxx +++ b/panda/src/sgmanip/nodePathCollection.cxx @@ -268,11 +268,11 @@ find_all_matches(const string &path) const { if (!is_empty()) { FindApproxLevel level; for (int i = 0; i < get_num_paths(); i++) { - FindApproxLevelEntry start(get_path(i), approx_path); - level.add_entry(start); + FindApproxLevelEntry start(get_path(i), approx_path); + level.add_entry(start); } get_path(0).r_find_matches(result, level, -1, - NodePath::get_max_search_depth()); + NodePath::get_max_search_depth()); } } diff --git a/panda/src/sgmanip/nodePathLerps.cxx b/panda/src/sgmanip/nodePathLerps.cxx index ad2760cfe9..4c129e9817 100644 --- a/panda/src/sgmanip/nodePathLerps.cxx +++ b/panda/src/sgmanip/nodePathLerps.cxx @@ -108,7 +108,7 @@ ColorLerpFunctor& ColorLerpFunctor::operator=(const ColorLerpFunctor& c) { } void ColorLerpFunctor::operator()(float t) { - _node_path.set_color(interpolate(t)); + _node_path.set_color(interpolate(t)); } diff --git a/panda/src/sgmanip/nodePathLerps.h b/panda/src/sgmanip/nodePathLerps.h index 5b5cb9dc89..2b0eb99971 100644 --- a/panda/src/sgmanip/nodePathLerps.h +++ b/panda/src/sgmanip/nodePathLerps.h @@ -23,14 +23,14 @@ PUBLISHED: PosLerpFunctor(NodePath np, LPoint3f start, LPoint3f end) : LPoint3fLerpFunctor(start, end), _node_path(np), _is_wrt(false) {} PosLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, float ey, - float ez) : LPoint3fLerpFunctor(LPoint3f(sx, sy, sz), - LPoint3f(ex, ey, ez)), + float ez) : LPoint3fLerpFunctor(LPoint3f(sx, sy, sz), + LPoint3f(ex, ey, ez)), _node_path(np), _is_wrt(false) {} PosLerpFunctor(NodePath np, LPoint3f start, LPoint3f end, NodePath wrt) : LPoint3fLerpFunctor(start, end), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} PosLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, float ey, - float ez, NodePath wrt) + float ez, NodePath wrt) : LPoint3fLerpFunctor(LPoint3f(sx, sy, sz), LPoint3f(ex, ey, ez)), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} @@ -48,7 +48,7 @@ public: static void init_type(void) { LPoint3fLerpFunctor::init_type(); register_type(_type_handle, "PosLerpFunctor", - LPoint3fLerpFunctor::get_class_type()); + LPoint3fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -77,14 +77,14 @@ PUBLISHED: HprLerpFunctor(NodePath np, LVecBase3f start, LVecBase3f end) : LVecBase3fLerpFunctor(start, end), _node_path(np), _is_wrt(false) {} HprLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, float ey, - float ez) : LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), - LVecBase3f(ex, ey, ez)), + float ez) : LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), + LVecBase3f(ex, ey, ez)), _node_path(np), _is_wrt(false) {} HprLerpFunctor(NodePath np, LVecBase3f start, LVecBase3f end, NodePath wrt) : LVecBase3fLerpFunctor(start, end), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} HprLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, float ey, - float ez, NodePath wrt) + float ez, NodePath wrt) : LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), LVecBase3f(ex, ey, ez)), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} void take_shortest(void); @@ -104,7 +104,7 @@ public: static void init_type(void) { LVecBase3fLerpFunctor::init_type(); register_type(_type_handle, "HprLerpFunctor", - LVecBase3fLerpFunctor::get_class_type()); + LVecBase3fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -131,14 +131,14 @@ PUBLISHED: ScaleLerpFunctor(NodePath np, LVecBase3f start, LVecBase3f end) : LVecBase3fLerpFunctor(start, end), _node_path(np), _is_wrt(false) {} ScaleLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, - float ey, float ez) + float ey, float ez) : LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), LVecBase3f(ex, ey, ez)), _node_path(np), _is_wrt(false) {} ScaleLerpFunctor(NodePath np, LVecBase3f start, LVecBase3f end, NodePath wrt) : LVecBase3fLerpFunctor(start, end), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} ScaleLerpFunctor(NodePath np, float sx, float sy, float sz, float ex, - float ey, float ez, NodePath wrt) + float ey, float ez, NodePath wrt) : LVecBase3fLerpFunctor(LVecBase3f(sx, sy, sz), LVecBase3f(ex, ey, ez)), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} @@ -156,7 +156,7 @@ public: static void init_type(void) { LVecBase3fLerpFunctor::init_type(); register_type(_type_handle, "ScaleLerpFunctor", - LVecBase3fLerpFunctor::get_class_type()); + LVecBase3fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -183,13 +183,13 @@ PUBLISHED: ColorLerpFunctor(NodePath np, LVecBase4f start, LVecBase4f end) : LVecBase4fLerpFunctor(start, end), _node_path(np), _is_wrt(false) {} ColorLerpFunctor(NodePath np, float sr, float sg, float sb, float sa, - float er, float eg, float eb, float ea) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), - LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(false) {} + float er, float eg, float eb, float ea) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), + LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(false) {} ColorLerpFunctor(NodePath np, LVecBase4f start, LVecBase4f end, NodePath wrt) : LVecBase4fLerpFunctor(start, end), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} ColorLerpFunctor(NodePath np, float sr, float sg, float sb, float sa, float er, float eg, - float eb, float ea, NodePath wrt) + float eb, float ea, NodePath wrt) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} @@ -207,7 +207,7 @@ public: static void init_type(void) { LVecBase4fLerpFunctor::init_type(); register_type(_type_handle, "ColorLerpFunctor", - LVecBase4fLerpFunctor::get_class_type()); + LVecBase4fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -239,25 +239,25 @@ private: PUBLISHED: PosHprLerpFunctor(NodePath np, LPoint3f pstart, LPoint3f pend, - LVecBase3f hstart, LVecBase3f hend) + LVecBase3f hstart, LVecBase3f hend) : LerpFunctor(), _node_path(np), _pstart(pstart), _pend(pend), _pdiff_cache(pend-pstart), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _is_wrt(false) {} PosHprLerpFunctor(NodePath np, float psx, float psy, float psz, float pex, - float pey, float pez, float hsx, float hsy, float hsz, - float hex, float hey, float hez) + float pey, float pez, float hsx, float hsy, float hsz, + float hex, float hey, float hez) : LerpFunctor(), _node_path(np), _pstart(psx, psy, psz), _pend(pex, pey, pez), _pdiff_cache(_pend-_pstart), _hstart(hsx, hsy, hsz), _hend(hex, hey, hez), _hdiff_cache(_hend - _hstart), _is_wrt(false) {} PosHprLerpFunctor(NodePath np, LPoint3f pstart, LPoint3f pend, - LVecBase3f hstart, LVecBase3f hend, NodePath wrt) + LVecBase3f hstart, LVecBase3f hend, NodePath wrt) : LerpFunctor(), _node_path(np), _pstart(pstart), _pend(pend), _pdiff_cache(pend-pstart), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _is_wrt(true), _wrt_path(wrt) {} PosHprLerpFunctor(NodePath np, float psx, float psy, float psz, float pex, - float pey, float pez, float hsx, float hsy, float hsz, - float hex, float hey, float hez, NodePath wrt) + float pey, float pez, float hsx, float hsy, float hsz, + float hex, float hey, float hez, NodePath wrt) : LerpFunctor(), _node_path(np), _pstart(psx, psy, psz), _pend(pex, pey, pez), _pdiff_cache(_pend-_pstart), _hstart(hsx, hsy, hsz), _hend(hex, hey, hez), @@ -279,7 +279,7 @@ public: static void init_type(void) { LerpFunctor::init_type(); register_type(_type_handle, "PosHprLerpFunctor", - LerpFunctor::get_class_type()); + LerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -314,33 +314,33 @@ private: PUBLISHED: PosHprScaleLerpFunctor(NodePath np, LPoint3f pstart, LPoint3f pend, - LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, - LVecBase3f send) + LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, + LVecBase3f send) : LerpFunctor(), _node_path(np), _pstart(pstart), _pend(pend), _pdiff_cache(pend-pstart), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _sstart(sstart), _send(send), _sdiff_cache(send-sstart), _is_wrt(false) {} PosHprScaleLerpFunctor(NodePath np, float psx, float psy, float psz, - float pex, float pey, float pez, float hsx, float hsy, - float hsz, float hex, float hey, float hez, float ssx, - float ssy, float ssz, float sex, float sey, float sez) + float pex, float pey, float pez, float hsx, float hsy, + float hsz, float hex, float hey, float hez, float ssx, + float ssy, float ssz, float sex, float sey, float sez) : LerpFunctor(), _node_path(np), _pstart(psx, psy, psz), _pend(pex, pey, pez), _pdiff_cache(_pend-_pstart), _hstart(hsx, hsy, hsz), _hend(hex, hey, hez), _hdiff_cache(_hend-_hstart), _sstart(ssx, ssy, ssz), _send(sex, sey, sez), _sdiff_cache(_send-_sstart), _is_wrt(false) {} PosHprScaleLerpFunctor(NodePath np, LPoint3f pstart, LPoint3f pend, - LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, - LVecBase3f send, NodePath wrt) + LVecBase3f hstart, LVecBase3f hend, LVecBase3f sstart, + LVecBase3f send, NodePath wrt) : LerpFunctor(), _node_path(np), _pstart(pstart), _pend(pend), _pdiff_cache(pend-pstart), _hstart(hstart), _hend(hend), _hdiff_cache(hend-hstart), _sstart(sstart), _send(send), _sdiff_cache(send-sstart), _is_wrt(true), _wrt_path(wrt) {} PosHprScaleLerpFunctor(NodePath np, float psx, float psy, float psz, - float pex, float pey, float pez, 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 pex, float pey, float pez, 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) : LerpFunctor(), _node_path(np), _pstart(psx, psy, psz), _pend(pex, pey, pez), _pdiff_cache(_pend-_pstart), _hstart(hsx, hsy, hsz), _hend(hex, hey, hez), @@ -364,7 +364,7 @@ public: static void init_type(void) { LerpFunctor::init_type(); register_type(_type_handle, "PosHprScaleLerpFunctor", - LerpFunctor::get_class_type()); + LerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); @@ -391,13 +391,13 @@ PUBLISHED: ColorScaleLerpFunctor(NodePath np, LVecBase4f start, LVecBase4f end) : LVecBase4fLerpFunctor(start, end), _node_path(np), _is_wrt(false) {} ColorScaleLerpFunctor(NodePath np, float sr, float sg, float sb, float sa, - float er, float eg, float eb, float ea) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), - LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(false) {} + float er, float eg, float eb, float ea) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), + LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(false) {} ColorScaleLerpFunctor(NodePath np, LVecBase4f start, LVecBase4f end, NodePath wrt) : LVecBase4fLerpFunctor(start, end), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} ColorScaleLerpFunctor(NodePath np, float sr, float sg, float sb, float sa, float er, float eg, - float eb, float ea, NodePath wrt) + float eb, float ea, NodePath wrt) : LVecBase4fLerpFunctor(LVecBase4f(sr, sg, sb, sa), LVecBase4f(er, eg, eb, ea)), _node_path(np), _is_wrt(true), _wrt_path(wrt) {} @@ -415,7 +415,7 @@ public: static void init_type(void) { LVecBase4fLerpFunctor::init_type(); register_type(_type_handle, "ColorScaleLerpFunctor", - LVecBase4fLerpFunctor::get_class_type()); + LVecBase4fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/sgraph/camera.h b/panda/src/sgraph/camera.h index f4164233f0..08066d9729 100644 --- a/panda/src/sgraph/camera.h +++ b/panda/src/sgraph/camera.h @@ -69,7 +69,7 @@ public: static void init_type() { ProjectionNode::init_type(); register_type(_type_handle, "Camera", - ProjectionNode::get_class_type()); + ProjectionNode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/sgraph/geomNode.h b/panda/src/sgraph/geomNode.h index fbe058c0f5..68d153f85d 100644 --- a/panda/src/sgraph/geomNode.h +++ b/panda/src/sgraph/geomNode.h @@ -63,7 +63,7 @@ public: static void register_with_read_factory(void); virtual void write_datagram(BamWriter* manager, Datagram &me); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); static TypedWritable *make_GeomNode(const FactoryParams ¶ms); @@ -83,7 +83,7 @@ public: static void init_type(void) { NamedNode::init_type(); register_type(_type_handle, "GeomNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); diff --git a/panda/src/sgraph/geomTransformer.cxx b/panda/src/sgraph/geomTransformer.cxx index 6efc4c350a..c50da205c5 100644 --- a/panda/src/sgraph/geomTransformer.cxx +++ b/panda/src/sgraph/geomTransformer.cxx @@ -58,7 +58,7 @@ transform_vertices(Geom *geom, const LMatrix4f &mat) { new_coords.reserve(coords.size()); PTA_Vertexf::const_iterator vi; for (vi = coords.begin(); vi != coords.end(); ++vi) { - new_coords.push_back((*vi) * mat); + new_coords.push_back((*vi) * mat); } nassertr(new_coords.size() == coords.size(), false); } @@ -84,9 +84,9 @@ transform_vertices(Geom *geom, const LMatrix4f &mat) { new_norms.reserve(norms.size()); PTA_Normalf::const_iterator ni; for (ni = norms.begin(); ni != norms.end(); ++ni) { - Normalf new_norm = (*ni) * mat; - new_norm.normalize(); - new_norms.push_back(new_norm); + Normalf new_norm = (*ni) * mat; + new_norm.normalize(); + new_norms.push_back(new_norm); } nassertr(new_norms.size() == norms.size(), false); } @@ -123,10 +123,10 @@ transform_vertices(GeomNode *node, const LMatrix4f &mat) { Geom *geom = DCAST(Geom, drawable); PT(Geom) new_geom = geom->make_copy(); if (transform_vertices(new_geom, mat)) { - new_geoms.push_back(new_geom.p()); - any_changed = true; + new_geoms.push_back(new_geom.p()); + any_changed = true; } else { - new_geoms.push_back(geom); + new_geoms.push_back(geom); } } else { new_geoms.push_back(drawable); @@ -176,10 +176,10 @@ transform_texcoords(Geom *geom, const LMatrix4f &mat) { new_texcoords.reserve(texcoords.size()); PTA_TexCoordf::const_iterator tci; for (tci = texcoords.begin(); tci != texcoords.end(); ++tci) { - const TexCoordf &tc = (*tci); - LVecBase4f v4(tc[0], tc[1], 0.0, 1.0); - v4 = v4 * mat; - new_texcoords.push_back(TexCoordf(v4[0] / v4[3], v4[1] / v4[3])); + const TexCoordf &tc = (*tci); + LVecBase4f v4(tc[0], tc[1], 0.0, 1.0); + v4 = v4 * mat; + new_texcoords.push_back(TexCoordf(v4[0] / v4[3], v4[1] / v4[3])); } nassertr(new_texcoords.size() == texcoords.size(), false); } @@ -216,10 +216,10 @@ transform_texcoords(GeomNode *node, const LMatrix4f &mat) { Geom *geom = DCAST(Geom, drawable); PT(Geom) new_geom = geom->make_copy(); if (transform_texcoords(new_geom, mat)) { - new_geoms.push_back(new_geom.p()); - any_changed = true; + new_geoms.push_back(new_geom.p()); + any_changed = true; } else { - new_geoms.push_back(geom); + new_geoms.push_back(geom); } } else { new_geoms.push_back(drawable); @@ -281,10 +281,10 @@ set_color(GeomNode *node, const Colorf &color) { Geom *geom = DCAST(Geom, drawable); PT(Geom) new_geom = geom->make_copy(); if (set_color(new_geom, color)) { - new_geoms.push_back(new_geom.p()); - any_changed = true; + new_geoms.push_back(new_geom.p()); + any_changed = true; } else { - new_geoms.push_back(geom); + new_geoms.push_back(geom); } } else { new_geoms.push_back(drawable); diff --git a/panda/src/sgraph/geomTransformer.h b/panda/src/sgraph/geomTransformer.h index 7bf51a6c1f..0ce9ce184e 100644 --- a/panda/src/sgraph/geomTransformer.h +++ b/panda/src/sgraph/geomTransformer.h @@ -14,7 +14,7 @@ class GeomNode; /////////////////////////////////////////////////////////////////// -// Class : GeomTransformer +// Class : GeomTransformer // Description : An object specifically designed to transform the // vertices of a Geom without disturbing indexing or // affecting any other Geoms that may share the same diff --git a/panda/src/sgraph/planeNode.h b/panda/src/sgraph/planeNode.h index 19b7c621c5..56146cc445 100644 --- a/panda/src/sgraph/planeNode.h +++ b/panda/src/sgraph/planeNode.h @@ -39,7 +39,7 @@ PUBLISHED: protected: - Planef _plane; + Planef _plane; public: diff --git a/panda/src/sgraph/projectionNode.cxx b/panda/src/sgraph/projectionNode.cxx index 7c4df57179..7cda5bb077 100644 --- a/panda/src/sgraph/projectionNode.cxx +++ b/panda/src/sgraph/projectionNode.cxx @@ -78,8 +78,8 @@ get_projection() { // Function: ProjectionNode::is_in_view // Access: Public // Description: Returns true if the given point is within the bounds -// of the projection of the ProjectionNode (i.e. if the -// camera can see the point). +// of the projection of the ProjectionNode (i.e. if the +// camera can see the point). //////////////////////////////////////////////////////////////////// bool ProjectionNode:: is_in_view(const LPoint3f &pos) { @@ -100,7 +100,7 @@ is_in_view(const LPoint3f &pos) { //////////////////////////////////////////////////////////////////// void ProjectionNode:: get_perspective_params(float &yfov, float &aspect, float &cnear, - float &cfar) const { + float &cfar) const { if (_projection->get_type() == PerspectiveProjection::get_class_type()) { PerspectiveProjection *proj = DCAST(PerspectiveProjection, _projection); proj->get_frustum().get_perspective_params(yfov, aspect, cnear, cfar); @@ -115,11 +115,11 @@ get_perspective_params(float &yfov, float &aspect, float &cnear, //////////////////////////////////////////////////////////////////// void ProjectionNode:: get_perspective_params(float &xfov, float &yfov, float &aspect, float &cnear, - float &cfar) const { + float &cfar) const { if (_projection->get_type() == PerspectiveProjection::get_class_type()) { PerspectiveProjection *proj = DCAST(PerspectiveProjection, _projection); proj->get_frustum().get_perspective_params(xfov, yfov, aspect, cnear, - cfar); + cfar); } } diff --git a/panda/src/sgraph/projectionNode.h b/panda/src/sgraph/projectionNode.h index 5ff7dbe72d..d0705304b7 100644 --- a/panda/src/sgraph/projectionNode.h +++ b/panda/src/sgraph/projectionNode.h @@ -29,7 +29,7 @@ PUBLISHED: public: INLINE ProjectionNode(const ProjectionNode ©); INLINE void operator = (const ProjectionNode ©); - + virtual Node *make_copy() const; PUBLISHED: @@ -40,9 +40,9 @@ PUBLISHED: bool is_in_view(const LPoint3f &pos); void get_perspective_params(float &yfov, float &aspect, float &cnear, - float &cfar) const; + float &cfar) const; void get_perspective_params(float &xfov, float &yfov, float &aspect, - float &cnear, float &cfar) const; + float &cnear, float &cfar) const; float get_hfov(void) const; float get_vfov(void) const; void set_fov(float hfov); @@ -69,7 +69,7 @@ public: static void init_type( void ) { NamedNode::init_type(); register_type( _type_handle, "ProjectionNode", - NamedNode::get_class_type() ); + NamedNode::get_class_type() ); } virtual TypeHandle get_type( void ) const { return get_class_type(); diff --git a/panda/src/sgraph/renderTraverser.I b/panda/src/sgraph/renderTraverser.I index 8be61ef020..d57be08a14 100644 --- a/panda/src/sgraph/renderTraverser.I +++ b/panda/src/sgraph/renderTraverser.I @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// INLINE RenderTraverser:: RenderTraverser(GraphicsStateGuardian *gsg, TypeHandle graph_type, - const ArcChain &arc_chain) : + const ArcChain &arc_chain) : _gsg(gsg), _graph_type(graph_type), _arc_chain(arc_chain) diff --git a/panda/src/sgraph/renderTraverser.h b/panda/src/sgraph/renderTraverser.h index 45ad5d66d2..371a5383d2 100644 --- a/panda/src/sgraph/renderTraverser.h +++ b/panda/src/sgraph/renderTraverser.h @@ -30,8 +30,8 @@ class AllTransitionsWrapper; class EXPCL_PANDA RenderTraverser : public TypedReferenceCount { public: INLINE RenderTraverser(GraphicsStateGuardian *gsg, - TypeHandle graph_type, - const ArcChain &arc_chain); + TypeHandle graph_type, + const ArcChain &arc_chain); INLINE ~RenderTraverser(); typedef ArcChain::iterator iterator; @@ -48,8 +48,8 @@ PUBLISHED: public: virtual void traverse(Node *root, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans)=0; + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans)=0; PUBLISHED: virtual void output(ostream &out) const; diff --git a/panda/src/sgraph/switchNode.h b/panda/src/sgraph/switchNode.h index ddb6eb9190..4e456d2d45 100644 --- a/panda/src/sgraph/switchNode.h +++ b/panda/src/sgraph/switchNode.h @@ -50,7 +50,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #include "switchNode.I" diff --git a/panda/src/sgraphutil/appTraverser.cxx b/panda/src/sgraphutil/appTraverser.cxx index d620aaf8a9..e45b62c56c 100644 --- a/panda/src/sgraphutil/appTraverser.cxx +++ b/panda/src/sgraphutil/appTraverser.cxx @@ -17,7 +17,7 @@ void AppTraverser:: traverse(Node *root) { if (!implicit_app_traversal) { df_traverse(root, *this, NullAttributeWrapper(), NullLevelState(), - _graph_type); + _graph_type); } } diff --git a/panda/src/sgraphutil/appTraverser.h b/panda/src/sgraphutil/appTraverser.h index 754459700d..6bb135b16b 100644 --- a/panda/src/sgraphutil/appTraverser.h +++ b/panda/src/sgraphutil/appTraverser.h @@ -35,7 +35,7 @@ public: // behavior of the AppTraverser as it traverses the graph. // Normally you would never call these directly. bool reached_node(Node *node, NullAttributeWrapper &render_state, - NullLevelState &level_state); + NullLevelState &level_state); private: TypeHandle _graph_type; diff --git a/panda/src/sgraphutil/directRenderTraverser.cxx b/panda/src/sgraphutil/directRenderTraverser.cxx index 80e03fcf1f..ee249eb5f9 100644 --- a/panda/src/sgraphutil/directRenderTraverser.cxx +++ b/panda/src/sgraphutil/directRenderTraverser.cxx @@ -40,7 +40,7 @@ PStatCollector DirectRenderTraverser::_draw_pcollector("Draw"); //////////////////////////////////////////////////////////////////// DirectRenderTraverser:: DirectRenderTraverser(GraphicsStateGuardian *gsg, TypeHandle graph_type, - const ArcChain &arc_chain) : + const ArcChain &arc_chain) : RenderTraverser(gsg, graph_type, arc_chain) { } @@ -64,8 +64,8 @@ DirectRenderTraverser:: //////////////////////////////////////////////////////////////////// void DirectRenderTraverser:: traverse(Node *root, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans) { + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans) { // Statistics PStatTimer timer(_draw_pcollector); @@ -80,8 +80,8 @@ traverse(Node *root, { DecalAttribute *decal_attrib; if (get_attribute_into(decal_attrib, render_state, - DecalTransition::get_class_type())) { - level_state._decal_mode = decal_attrib->is_on(); + DecalTransition::get_class_type())) { + level_state._decal_mode = decal_attrib->is_on(); } } @@ -101,7 +101,7 @@ traverse(Node *root, } fc_traverse(_arc_chain, root, rel_from_camera, *this, - render_state, level_state, _gsg, _graph_type); + render_state, level_state, _gsg, _graph_type); if (level_state._decal_mode && root->is_of_type(GeomNode::get_class_type())) { @@ -123,7 +123,7 @@ traverse(Node *root, //////////////////////////////////////////////////////////////////// bool DirectRenderTraverser:: reached_node(Node *node, AllAttributesWrapper &render_state, - DirectRenderLevelState &level_state) { + DirectRenderLevelState &level_state) { if (implicit_app_traversal) { node->app_traverse(); } @@ -140,7 +140,7 @@ reached_node(Node *node, AllAttributesWrapper &render_state, #endif { if (!node->sub_render(render_state, new_trans, this)) { - return false; + return false; } render_state.apply_in_place(new_trans); } @@ -158,19 +158,19 @@ reached_node(Node *node, AllAttributesWrapper &render_state, if (support_decals != SD_off) #endif { - DecalAttribute *decal_attrib; - if (get_attribute_into(decal_attrib, render_state, - DecalTransition::get_class_type())) { - level_state._decal_mode = decal_attrib->is_on(); - } + DecalAttribute *decal_attrib; + if (get_attribute_into(decal_attrib, render_state, + DecalTransition::get_class_type())) { + level_state._decal_mode = decal_attrib->is_on(); + } } if (level_state._decal_mode) { #ifndef NDEBUG if (support_decals == SD_hide) { - level_state._decal_mode = false; - geom->draw(_gsg); - return false; + level_state._decal_mode = false; + geom->draw(_gsg); + return false; } #endif _gsg->begin_decal(geom); @@ -194,8 +194,8 @@ reached_node(Node *node, AllAttributesWrapper &render_state, //////////////////////////////////////////////////////////////////// bool DirectRenderTraverser:: forward_arc(NodeRelation *arc, AllTransitionsWrapper &trans, - AllAttributesWrapper &, AllAttributesWrapper &post, - DirectRenderLevelState &) { + AllAttributesWrapper &, AllAttributesWrapper &post, + DirectRenderLevelState &) { bool carry_on = true; // Go through all the transitions on the arc and sub_render() on @@ -211,12 +211,12 @@ forward_arc(NodeRelation *arc, AllTransitionsWrapper &trans, { AllTransitionsWrapper::const_iterator nti; for (nti = trans.begin(); nti != trans.end(); ++nti) { - NodeTransition *t = (*nti).second.get_trans(); - AllTransitionsWrapper new_trans; - if (!t->sub_render(arc, post, new_trans, this)) { - carry_on = false; - } - post.apply_in_place(new_trans); + NodeTransition *t = (*nti).second.get_trans(); + AllTransitionsWrapper new_trans; + if (!t->sub_render(arc, post, new_trans, this)) { + carry_on = false; + } + post.apply_in_place(new_trans); } } @@ -235,8 +235,8 @@ forward_arc(NodeRelation *arc, AllTransitionsWrapper &trans, //////////////////////////////////////////////////////////////////// void DirectRenderTraverser:: backward_arc(NodeRelation *arc, AllTransitionsWrapper &, - AllAttributesWrapper &, AllAttributesWrapper &post, - const DirectRenderLevelState &level_state) { + AllAttributesWrapper &, AllAttributesWrapper &post, + const DirectRenderLevelState &level_state) { mark_backward_arc(arc); if (level_state._decal_mode) { // Reset the state to redraw the base geometry. diff --git a/panda/src/sgraphutil/directRenderTraverser.h b/panda/src/sgraphutil/directRenderTraverser.h index c851b86a46..f48346fc59 100644 --- a/panda/src/sgraphutil/directRenderTraverser.h +++ b/panda/src/sgraphutil/directRenderTraverser.h @@ -37,27 +37,27 @@ class EXPCL_PANDA DirectRenderTraverser : public TraverserVisitor { public: DirectRenderTraverser(GraphicsStateGuardian *gsg, TypeHandle graph_type, - const ArcChain &arc_chain = ArcChain()); + const ArcChain &arc_chain = ArcChain()); virtual ~DirectRenderTraverser(); virtual void traverse(Node *root, - const AllAttributesWrapper &initial_state, - const AllTransitionsWrapper &net_trans); + const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &net_trans); public: // These methods, from parent class TraverserVisitor, define the // behavior of the DirectRenderTraverser as it traverses the graph. // Normally you would never call these directly. bool reached_node(Node *node, AllAttributesWrapper &render_state, - DirectRenderLevelState &level_state); + DirectRenderLevelState &level_state); bool forward_arc(NodeRelation *arc, AllTransitionsWrapper &trans, - AllAttributesWrapper &pre, AllAttributesWrapper &post, - DirectRenderLevelState &level_state); + AllAttributesWrapper &pre, AllAttributesWrapper &post, + DirectRenderLevelState &level_state); void backward_arc(NodeRelation *arc, AllTransitionsWrapper &trans, - AllAttributesWrapper &pre, AllAttributesWrapper &post, - const DirectRenderLevelState &level_state); + AllAttributesWrapper &pre, AllAttributesWrapper &post, + const DirectRenderLevelState &level_state); private: // Statistics diff --git a/panda/src/sgraphutil/frustumCullTraverser.I b/panda/src/sgraphutil/frustumCullTraverser.I index 04cac2fc84..d86a64af9c 100644 --- a/panda/src/sgraphutil/frustumCullTraverser.I +++ b/panda/src/sgraphutil/frustumCullTraverser.I @@ -12,11 +12,11 @@ template FrustumCullTraverser:: FrustumCullTraverser(ArcChain &arc_chain, Node *root, - const LMatrix4f &rel_from_camera, Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - GraphicsStateGuardian *gsg, - TypeHandle graph_type) : + const LMatrix4f &rel_from_camera, Visitor &visitor, + const AttributeWrapper &initial_render_state, + const LevelState &initial_level_state, + GraphicsStateGuardian *gsg, + TypeHandle graph_type) : _arc_chain(arc_chain), _visitor(visitor), _initial_render_state(initial_render_state), @@ -37,9 +37,9 @@ FrustumCullTraverser(ArcChain &arc_chain, Node *root, BoundingVolume *bv = proj->make_bounds(); if (bv->is_of_type(GeometricBoundingVolume::get_class_type())) { - _view_frustum = DCAST(GeometricBoundingVolume, bv); + _view_frustum = DCAST(GeometricBoundingVolume, bv); } else { - delete bv; + delete bv; } } @@ -48,8 +48,8 @@ FrustumCullTraverser(ArcChain &arc_chain, Node *root, if (sgraphutil_cat.is_spam()) { sgraphutil_cat.spam() - << "Beginning frustum cull, frustum is: " << *local_frustum << "\n" - << "Transform is:\n"; + << "Beginning frustum cull, frustum is: " << *local_frustum << "\n" + << "Transform is:\n"; rel_from_camera.write(sgraphutil_cat.spam(false), 2); } } @@ -82,8 +82,8 @@ FrustumCullTraverser(ArcChain &arc_chain, Node *root, template void FrustumCullTraverser:: traverse(NodeRelation *arc, AttributeWrapper render_state, - LevelState level_state, PT(GeometricBoundingVolume) local_frustum, - bool all_in) { + LevelState level_state, PT(GeometricBoundingVolume) local_frustum, + bool all_in) { // local_frustum, above, is a PT(GeometricBoundingVolume), instead // of just an ordinary GeometricBoundingVolume*, because we might // reassign it within this function to a locally-allocated volume @@ -107,94 +107,94 @@ traverse(NodeRelation *arc, AttributeWrapper render_state, // Now test for intersection with the bounding volume. const BoundingVolume &arc_volume = arc->get_bound(); if (arc_volume.is_of_type(GeometricBoundingVolume::get_class_type())) { - const GeometricBoundingVolume *arc_gbv = - DCAST(GeometricBoundingVolume, &arc_volume); + const GeometricBoundingVolume *arc_gbv = + DCAST(GeometricBoundingVolume, &arc_volume); - nassertv(local_frustum != (GeometricBoundingVolume *)NULL); - int result = local_frustum->contains(arc_gbv); - if (result == BoundingVolume::IF_no_intersection) { - // No intersection at all. Cull. - if (sgraphutil_cat.is_spam()) { - if (!arc_volume.is_empty()) { - sgraphutil_cat.spam() - << "Culling " << *arc->get_child() << " with volume " - << arc_volume << "\n"; - } - } + nassertv(local_frustum != (GeometricBoundingVolume *)NULL); + int result = local_frustum->contains(arc_gbv); + if (result == BoundingVolume::IF_no_intersection) { + // No intersection at all. Cull. + if (sgraphutil_cat.is_spam()) { + if (!arc_volume.is_empty()) { + sgraphutil_cat.spam() + << "Culling " << *arc->get_child() << " with volume " + << arc_volume << "\n"; + } + } - /* - if (fake_view_frustum_cull) { - // In fake mode, we just render everything in red - // wireframe instead of actually culling it. + /* + if (fake_view_frustum_cull) { + // In fake mode, we just render everything in red + // wireframe instead of actually culling it. - ColorTransition *c = - new ColorTransition(1.0, 0.0, 0.0, 1.0); - RenderModeTransition *w = - new RenderModeTransition(RenderModeProperty::M_wireframe); - TextureTransition *t = - new TextureTransition(TextureTransition::off()); + ColorTransition *c = + new ColorTransition(1.0, 0.0, 0.0, 1.0); + RenderModeTransition *w = + new RenderModeTransition(RenderModeProperty::M_wireframe); + TextureTransition *t = + new TextureTransition(TextureTransition::off()); - c->set_priority(100); - w->set_priority(100); - t->set_priority(100); - AllTransitionsWrapper trans; - trans.set_transition(c); - trans.set_transition(w); - trans.set_transition(t); + c->set_priority(100); + w->set_priority(100); + t->set_priority(100); + AllTransitionsWrapper trans; + trans.set_transition(c); + trans.set_transition(w); + trans.set_transition(t); - post.apply_in_place(trans); - all_in = true; - - } else */ { - carry_on = false; - } - - } else if ((result & BoundingVolume::IF_all) != 0) { - // The arc and its descendants are completely enclosed within - // the frustum. No need to cull further. - all_in = true; - } + post.apply_in_place(trans); + all_in = true; + + } else */ { + carry_on = false; + } + + } else if ((result & BoundingVolume::IF_all) != 0) { + // The arc and its descendants are completely enclosed within + // the frustum. No need to cull further. + all_in = true; + } } if (carry_on) { - if (arc->has_transition(BillboardTransition::get_class_type())) { - // We can't reliably cull within a billboard, because the - // geometry might get rotated out of its bounding volume. - // So once we get within a billboard, we consider it all - // visible. - all_in = true; - } + if (arc->has_transition(BillboardTransition::get_class_type())) { + // We can't reliably cull within a billboard, because the + // geometry might get rotated out of its bounding volume. + // So once we get within a billboard, we consider it all + // visible. + all_in = true; + } - if (!all_in && - arc->has_transition(TransformTransition::get_class_type())) { - // Now apply the transform associated with this arc. We do - // this after the bounding volume test, because the bounding - // volume has already been transformed. + if (!all_in && + arc->has_transition(TransformTransition::get_class_type())) { + // Now apply the transform associated with this arc. We do + // this after the bounding volume test, because the bounding + // volume has already been transformed. - local_frustum = - DCAST(GeometricBoundingVolume, _view_frustum->make_copy()); + local_frustum = + DCAST(GeometricBoundingVolume, _view_frustum->make_copy()); - NodeTransitionWrapper ntw(TransformTransition::get_class_type()); - wrt(_gsg->get_current_projection_node(), - arc->get_child(), _arc_chain.begin(), _arc_chain.end(), - ntw, _graph_type); - - const TransformTransition *tt; - if (get_transition_into(tt, ntw)) { - // This frustum is transformed from the camera. Most will - // be. - nassertv(local_frustum != (GeometricBoundingVolume *)NULL); - local_frustum->xform(tt->get_matrix()); + NodeTransitionWrapper ntw(TransformTransition::get_class_type()); + wrt(_gsg->get_current_projection_node(), + arc->get_child(), _arc_chain.begin(), _arc_chain.end(), + ntw, _graph_type); - if (sgraphutil_cat.is_spam()) { - sgraphutil_cat.spam() - << "Transforming frustum into local space of " << *arc - << ": " << *local_frustum << "\n" - << "Transform is:\n"; - tt->get_matrix().write(sgraphutil_cat.spam(false), 2); - } - } - } + const TransformTransition *tt; + if (get_transition_into(tt, ntw)) { + // This frustum is transformed from the camera. Most will + // be. + nassertv(local_frustum != (GeometricBoundingVolume *)NULL); + local_frustum->xform(tt->get_matrix()); + + if (sgraphutil_cat.is_spam()) { + sgraphutil_cat.spam() + << "Transforming frustum into local space of " << *arc + << ": " << *local_frustum << "\n" + << "Transform is:\n"; + tt->get_matrix().write(sgraphutil_cat.spam(false), 2); + } + } + } } } } @@ -208,12 +208,12 @@ traverse(NodeRelation *arc, AttributeWrapper render_state, AttributeWrapper post_state(render_state); post_state.apply_in_place(trans); if (_visitor.forward_arc(arc, trans, render_state, post_state, - level_state)) { + level_state)) { traverse(arc->get_child(), post_state, level_state, - local_frustum, all_in); + local_frustum, all_in); _visitor.backward_arc(arc, trans, render_state, post_state, - level_state); + level_state); } } @@ -230,7 +230,7 @@ traverse(NodeRelation *arc, AttributeWrapper render_state, template void FrustumCullTraverser:: traverse(Node *node, AttributeWrapper &render_state, LevelState &level_state, - GeometricBoundingVolume *local_frustum, bool all_in) { + GeometricBoundingVolume *local_frustum, bool all_in) { // Tell the visitor we reached the node, and give it a chance to // veto our further progress. if (_visitor.reached_node(node, render_state, level_state)) { @@ -247,14 +247,14 @@ traverse(Node *node, AttributeWrapper &render_state, LevelState &level_state, // call it directly since we don't have enough information. size_t i = 0; for (i = 0; i < drp.size(); i++) { - if (swnode->is_child_visible(_graph_type, i)) { - traverse(drp[i], render_state, level_state, local_frustum, all_in); - } + if (swnode->is_child_visible(_graph_type, i)) { + traverse(drp[i], render_state, level_state, local_frustum, all_in); + } } } else { DownRelationPointers::const_iterator drpi; for (drpi = drp.begin(); drpi != drp.end(); ++drpi) { - traverse(*drpi, render_state, level_state, local_frustum, all_in); + traverse(*drpi, render_state, level_state, local_frustum, all_in); } } } diff --git a/panda/src/sgraphutil/frustumCullTraverser.h b/panda/src/sgraphutil/frustumCullTraverser.h index c22861a382..516bc4b80a 100644 --- a/panda/src/sgraphutil/frustumCullTraverser.h +++ b/panda/src/sgraphutil/frustumCullTraverser.h @@ -25,7 +25,7 @@ /////////////////////////////////////////////////////////////////// -// Class : FrustumCullTraverser +// Class : FrustumCullTraverser // Description : A special kind of depth-first traverser that can // prune the graph based on a lack of intersection with // a given bounding volume; i.e. it performs @@ -38,23 +38,23 @@ public: typedef TYPENAME Visitor::AttributeWrapper AttributeWrapper; FrustumCullTraverser(ArcChain &arc_chain, Node *root, - const LMatrix4f &rel_from_camera, Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - GraphicsStateGuardian *gsg, - TypeHandle graph_type); + const LMatrix4f &rel_from_camera, Visitor &visitor, + const AttributeWrapper &initial_render_state, + const LevelState &initial_level_state, + GraphicsStateGuardian *gsg, + TypeHandle graph_type); protected: void traverse(NodeRelation *arc, - AttributeWrapper render_state, - LevelState level_state, - PT(GeometricBoundingVolume) local_frustum, - bool all_in); + AttributeWrapper render_state, + LevelState level_state, + PT(GeometricBoundingVolume) local_frustum, + bool all_in); void traverse(Node *node, - AttributeWrapper &render_state, - LevelState &level_state, - GeometricBoundingVolume *local_frustum, - bool all_in); + AttributeWrapper &render_state, + LevelState &level_state, + GeometricBoundingVolume *local_frustum, + bool all_in); ArcChain &_arc_chain; Visitor &_visitor; @@ -73,13 +73,13 @@ protected: template INLINE void fc_traverse(ArcChain &arc_chain, Node *root, - const LMatrix4f &rel_from_camera, Visitor &visitor, - const AttributeWrapper &initial_render_state, - const LevelState &initial_level_state, - GraphicsStateGuardian *gsg, TypeHandle graph_type) { + const LMatrix4f &rel_from_camera, Visitor &visitor, + const AttributeWrapper &initial_render_state, + const LevelState &initial_level_state, + GraphicsStateGuardian *gsg, TypeHandle graph_type) { FrustumCullTraverser fct(arc_chain, root, rel_from_camera, visitor, initial_render_state, - initial_level_state, gsg, graph_type); + initial_level_state, gsg, graph_type); } #include "frustumCullTraverser.I" diff --git a/panda/src/sgraphutil/get_rel_pos.I b/panda/src/sgraphutil/get_rel_pos.I index e18b5e8969..2e5110053b 100644 --- a/panda/src/sgraphutil/get_rel_pos.I +++ b/panda/src/sgraphutil/get_rel_pos.I @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// INLINE LPoint3f get_rel_pos(const Node *node, const Node *relative_to, - TypeHandle graph_type) { + TypeHandle graph_type) { NodeTransitionWrapper ntw(TransformTransition::get_class_type()); wrt(node, relative_to, ntw, graph_type); const TransformTransition *tt; @@ -36,7 +36,7 @@ get_rel_pos(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE void get_rel_mat(const Node *node, const Node *relative_to, - LMatrix4f &mat, TypeHandle graph_type) { + LMatrix4f &mat, TypeHandle graph_type) { NodeTransitionWrapper ntw(TransformTransition::get_class_type()); wrt(node, relative_to, ntw, graph_type); const TransformTransition *tt; @@ -59,7 +59,7 @@ get_rel_mat(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_up(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::up(cs) * mat; @@ -74,7 +74,7 @@ get_rel_up(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_right(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::right(cs) * mat; @@ -89,7 +89,7 @@ get_rel_right(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_forward(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::forward(cs) * mat; @@ -104,7 +104,7 @@ get_rel_forward(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_down(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::down(cs) * mat; @@ -119,7 +119,7 @@ get_rel_down(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_left(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::left(cs) * mat; @@ -134,7 +134,7 @@ get_rel_left(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// INLINE LVector3f get_rel_back(const Node *node, const Node *relative_to, - CoordinateSystem cs) { + CoordinateSystem cs) { LMatrix4f mat; get_rel_rot_mat(node, relative_to, mat); return LVector3f::back(cs) * mat; diff --git a/panda/src/sgraphutil/get_rel_pos.cxx b/panda/src/sgraphutil/get_rel_pos.cxx index 5052130fe5..8b5b198e99 100644 --- a/panda/src/sgraphutil/get_rel_pos.cxx +++ b/panda/src/sgraphutil/get_rel_pos.cxx @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////// void get_rel_rot_mat(const Node *node, const Node *relative_to, - LMatrix4f &mat, TypeHandle graph_type) { + LMatrix4f &mat, TypeHandle graph_type) { NodeTransitionWrapper ntw(TransformTransition::get_class_type()); wrt(node, relative_to, ntw, graph_type); const TransformTransition *tt; @@ -41,9 +41,9 @@ get_rel_rot_mat(const Node *node, const Node *relative_to, // Now build a new matrix which just represents these axes. mat.set(x[0], x[1], x[2], 0.0f, - y[0], y[1], y[2], 0.0f, - z[0], z[1], z[2], 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + y[0], y[1], y[2], 0.0f, + z[0], z[1], z[2], 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f); } @@ -54,7 +54,7 @@ get_rel_rot_mat(const Node *node, const Node *relative_to, //////////////////////////////////////////////////////////////////// LVecBase3f get_rel_scale(const Node *node, const Node *relative_to, - TypeHandle graph_type) { + TypeHandle graph_type) { NodeTransitionWrapper ntw(TransformTransition::get_class_type()); wrt(node, relative_to, ntw, graph_type); const TransformTransition *tt; diff --git a/panda/src/sgraphutil/get_rel_pos.h b/panda/src/sgraphutil/get_rel_pos.h index 640a7ed12a..cd64e345c9 100644 --- a/panda/src/sgraphutil/get_rel_pos.h +++ b/panda/src/sgraphutil/get_rel_pos.h @@ -17,39 +17,39 @@ class Node; INLINE LPoint3f EXPCL_PANDA get_rel_pos(const Node *node, const Node *relative_to, - TypeHandle graph_type = RenderRelation::get_class_type()); + TypeHandle graph_type = RenderRelation::get_class_type()); INLINE void EXPCL_PANDA get_rel_mat(const Node *node, const Node *relative_to, - LMatrix4f &mat, - TypeHandle graph_type = RenderRelation::get_class_type()); + LMatrix4f &mat, + TypeHandle graph_type = RenderRelation::get_class_type()); void EXPCL_PANDA get_rel_rot_mat(const Node *node, const Node *relative_to, - LMatrix4f &mat, - TypeHandle graph_type = RenderRelation::get_class_type()); + LMatrix4f &mat, + TypeHandle graph_type = RenderRelation::get_class_type()); LVecBase3f EXPCL_PANDA get_rel_scale(const Node *node, const Node *relative_to, - TypeHandle graph_type = RenderRelation::get_class_type()); + TypeHandle graph_type = RenderRelation::get_class_type()); INLINE LVector3f EXPCL_PANDA get_rel_up(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); INLINE LVector3f EXPCL_PANDA get_rel_right(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); INLINE LVector3f EXPCL_PANDA get_rel_forward(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); INLINE LVector3f EXPCL_PANDA get_rel_down(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); INLINE LVector3f EXPCL_PANDA get_rel_left(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); INLINE LVector3f EXPCL_PANDA get_rel_back(const Node *node, const Node *relative_to, - CoordinateSystem cs = CS_default); + CoordinateSystem cs = CS_default); #include "get_rel_pos.I" diff --git a/panda/src/sgraphutil/sceneGraphAnalyzer.cxx b/panda/src/sgraphutil/sceneGraphAnalyzer.cxx index 5259288768..74f66b16cb 100644 --- a/panda/src/sgraphutil/sceneGraphAnalyzer.cxx +++ b/panda/src/sgraphutil/sceneGraphAnalyzer.cxx @@ -107,7 +107,7 @@ write(ostream &out, int indent_level) const { if (_num_arcs != 0) { out << "; " << 100 * _num_arcs_with_transitions / _num_arcs - << "% of arcs have some transition."; + << "% of arcs have some transition."; } out << "\n"; @@ -136,8 +136,8 @@ write(ostream &out, int indent_level) const { << " of these are on " << _num_tristrips << " tristrips"; if (_num_tristrips != 0) { out << " (" - << (double)_num_triangles_in_strips / (double)_num_tristrips - << " average tris per strip)"; + << (double)_num_triangles_in_strips / (double)_num_tristrips + << " average tris per strip)"; } out << ".\n"; @@ -146,8 +146,8 @@ write(ostream &out, int indent_level) const { << " of these are on " << _num_trifans << " trifans"; if (_num_trifans != 0) { out << " (" - << (double)_num_triangles_in_fans / (double)_num_trifans - << " average tris per fan)"; + << (double)_num_triangles_in_fans / (double)_num_trifans + << " average tris per fan)"; } out << ".\n"; @@ -368,8 +368,8 @@ collect_statistics(Texture *texture) { PixelBuffer *pb = texture->_pbuffer; if (pb != (PixelBuffer *)NULL) { int bytes = - pb->get_xsize() * pb->get_ysize() * pb->get_num_components() * - pb->get_component_width(); + pb->get_xsize() * pb->get_ysize() * pb->get_num_components() * + pb->get_component_width(); bool is_mipmapped = false; switch (texture->get_minfilter()) { @@ -377,15 +377,15 @@ collect_statistics(Texture *texture) { case Texture::FT_linear_mipmap_nearest: case Texture::FT_nearest_mipmap_linear: case Texture::FT_linear_mipmap_linear: - is_mipmapped = true; - break; + is_mipmapped = true; + break; default: - break; + break; } if (is_mipmapped) { - bytes *= 4/3; + bytes *= 4/3; } _texture_bytes += bytes; @@ -412,11 +412,11 @@ consider_normals(const Normalf *norms, const ushort *nindex, int num) { const Normalf &norm = norms[nindex[i]]; float l = norm.length(); if (IS_THRESHOLD_EQUAL(l, 1.0, 0.01)) { - // This normal is close enough to unit length to be ok. + // This normal is close enough to unit length to be ok. } else if (l > 1.0) { - _num_long_normals++; + _num_long_normals++; } else { // l < 1.0 - _num_short_normals++; + _num_short_normals++; } _total_normal_length += l; } @@ -426,11 +426,11 @@ consider_normals(const Normalf *norms, const ushort *nindex, int num) { const Normalf &norm = norms[i]; float l = norm.length(); if (IS_THRESHOLD_EQUAL(l, 1.0, 0.01)) { - // This normal is close enough to unit length to be ok. + // This normal is close enough to unit length to be ok. } else if (l > 1.0) { - _num_long_normals++; + _num_long_normals++; } else { // l < 1.0 - _num_short_normals++; + _num_short_normals++; } _total_normal_length += l; } diff --git a/panda/src/sgraphutil/sceneGraphAnalyzer.h b/panda/src/sgraphutil/sceneGraphAnalyzer.h index 6923a98427..158ebe1bad 100644 --- a/panda/src/sgraphutil/sceneGraphAnalyzer.h +++ b/panda/src/sgraphutil/sceneGraphAnalyzer.h @@ -19,7 +19,7 @@ class Geom; class Texture; /////////////////////////////////////////////////////////////////// -// Class : SceneGraphAnalyzer +// Class : SceneGraphAnalyzer // Description : A handy class that can scrub over a scene graph and // collect interesting statistics on it. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgraphutil/sceneGraphReducer.cxx b/panda/src/sgraphutil/sceneGraphReducer.cxx index dea0a40c33..03a7b476f8 100644 --- a/panda/src/sgraphutil/sceneGraphReducer.cxx +++ b/panda/src/sgraphutil/sceneGraphReducer.cxx @@ -111,8 +111,8 @@ apply_transitions(NodeRelation *arc, int transition_types) { //////////////////////////////////////////////////////////////////// void SceneGraphReducer:: r_apply_transitions(NodeRelation *arc, int transition_types, - SceneGraphReducer::AccumulatedTransitions trans, - bool duplicate) { + SceneGraphReducer::AccumulatedTransitions trans, + bool duplicate) { if (sgraphutil_cat.is_debug()) { sgraphutil_cat.debug() << "r_apply_transitions(" << *arc << "), arc's transitions are:\n"; @@ -124,7 +124,7 @@ r_apply_transitions(NodeRelation *arc, int transition_types, TransformTransition *tt; if (get_transition_into(tt, arc)) { trans._transform = - DCAST(TransformTransition, trans._transform->compose(tt)); + DCAST(TransformTransition, trans._transform->compose(tt)); arc->clear_transition(TransformTransition::get_class_type()); } } @@ -134,7 +134,7 @@ r_apply_transitions(NodeRelation *arc, int transition_types, ColorTransition *ct; if (get_transition_into(ct, arc)) { trans._color = - DCAST(ColorTransition, trans._color->compose(ct)); + DCAST(ColorTransition, trans._color->compose(ct)); arc->clear_transition(ColorTransition::get_class_type()); } } @@ -144,7 +144,7 @@ r_apply_transitions(NodeRelation *arc, int transition_types, TexMatrixTransition *tmt; if (get_transition_into(tmt, arc)) { trans._texture_matrix = - DCAST(TexMatrixTransition, trans._texture_matrix->compose(tmt)); + DCAST(TexMatrixTransition, trans._texture_matrix->compose(tmt)); arc->clear_transition(TexMatrixTransition::get_class_type()); } } @@ -174,9 +174,9 @@ r_apply_transitions(NodeRelation *arc, int transition_types, // here. Drop transitions onto this arc to reflect what's been // accumulated so far. if (sgraphutil_cat.is_debug()) { - sgraphutil_cat.debug() - << "Cannot duplicate nodes of type " << node->get_type() - << "; dropping transitions here and stopping.\n"; + sgraphutil_cat.debug() + << "Cannot duplicate nodes of type " << node->get_type() + << "; dropping transitions here and stopping.\n"; } trans.apply_to_arc(arc, transition_types); @@ -186,8 +186,8 @@ r_apply_transitions(NodeRelation *arc, int transition_types, PT(Node) new_node = node->make_copy(); if (new_node->get_type() != node->get_type()) { sgraphutil_cat.error() - << "Cannot apply transitions to " << *node - << "; don't know how to copy nodes of this type.\n"; + << "Cannot apply transitions to " << *node + << "; don't know how to copy nodes of this type.\n"; trans.apply_to_arc(arc, transition_types); return; @@ -195,7 +195,7 @@ r_apply_transitions(NodeRelation *arc, int transition_types, if (sgraphutil_cat.is_debug()) { sgraphutil_cat.debug() - << "Duplicated " << *node << "\n"; + << "Duplicated " << *node << "\n"; } copy_children(new_node, node); @@ -211,16 +211,16 @@ r_apply_transitions(NodeRelation *arc, int transition_types, if (arc->has_transition(BillboardTransition::get_class_type())) { if (sgraphutil_cat.is_debug()) { sgraphutil_cat.debug() - << "Arc " << *arc - << " contains a BillboardTransition; leaving transform here.\n"; + << "Arc " << *arc + << " contains a BillboardTransition; leaving transform here.\n"; } apply_types |= TT_transform; } if (!node->safe_to_transform()) { if (sgraphutil_cat.is_debug()) { sgraphutil_cat.debug() - << "Cannot safely transform nodes of type " << node->get_type() - << "; leaving a transform here but carrying on otherwise.\n"; + << "Cannot safely transform nodes of type " << node->get_type() + << "; leaving a transform here but carrying on otherwise.\n"; } apply_types |= TT_transform; } @@ -230,7 +230,7 @@ r_apply_transitions(NodeRelation *arc, int transition_types, if (node->is_of_type(GeomNode::get_class_type())) { if (sgraphutil_cat.is_debug()) { sgraphutil_cat.debug() - << "Transforming geometry.\n"; + << "Transforming geometry.\n"; } // We treat GeomNodes as a special case, since we can apply more @@ -239,18 +239,18 @@ r_apply_transitions(NodeRelation *arc, int transition_types, GeomNode *gnode = DCAST(GeomNode, node); if ((transition_types & TT_transform) != 0) { if (trans._transform->get_matrix() != LMatrix4f::ident_mat()) { - _transformer.transform_vertices(gnode, trans._transform->get_matrix()); + _transformer.transform_vertices(gnode, trans._transform->get_matrix()); } } if ((transition_types & TT_color) != 0) { if (trans._color->is_on() && trans._color->is_real()) { - _transformer.set_color(gnode, trans._color->get_color()); + _transformer.set_color(gnode, trans._color->get_color()); } } if ((transition_types & TT_texture_matrix) != 0) { if (trans._texture_matrix->get_matrix() != LMatrix4f::ident_mat()) { - _transformer.transform_texcoords(gnode, - trans._texture_matrix->get_matrix()); + _transformer.transform_texcoords(gnode, + trans._texture_matrix->get_matrix()); } } diff --git a/panda/src/sgraphutil/sceneGraphReducer.h b/panda/src/sgraphutil/sceneGraphReducer.h index 977f15b4b3..a91d925091 100644 --- a/panda/src/sgraphutil/sceneGraphReducer.h +++ b/panda/src/sgraphutil/sceneGraphReducer.h @@ -20,7 +20,7 @@ class Geom; /////////////////////////////////////////////////////////////////// -// Class : SceneGraphReducer +// Class : SceneGraphReducer // Description : A specialization on GraphReducer for reducing scene // graphs. This GraphReducer knows about special kinds // of nodes like GeomNodes and can combine them @@ -54,8 +54,8 @@ protected: }; void r_apply_transitions(NodeRelation *arc, int transition_types, - AccumulatedTransitions trans, - bool duplicate); + AccumulatedTransitions trans, + bool duplicate); virtual Node *collapse_nodes(Node *node1, Node *node2, bool siblings); diff --git a/panda/src/shader/casterShader.h b/panda/src/shader/casterShader.h index d21cad7992..84be543fb4 100644 --- a/panda/src/shader/casterShader.h +++ b/panda/src/shader/casterShader.h @@ -20,7 +20,7 @@ //////////////////////////////////////////////////////////////////// // Class : CasterShader // Description : Frustum Shader that computes effect based on a list -// of "casting" objects +// of "casting" objects //////////////////////////////////////////////////////////////////// class EXPCL_SHADER CasterShader : public FrustumShader { @@ -40,7 +40,7 @@ class EXPCL_SHADER CasterShader : public FrustumShader protected: - NamedNodeVector _casters; + NamedNodeVector _casters; public: diff --git a/panda/src/shader/outlineShader.h b/panda/src/shader/outlineShader.h index 00b083e2cf..38ba52c87d 100644 --- a/panda/src/shader/outlineShader.h +++ b/panda/src/shader/outlineShader.h @@ -29,13 +29,13 @@ public: virtual void config(void); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); INLINE void set_color(const Colorf &color) { _color = color; } protected: - Colorf _color; + Colorf _color; public: static TypeHandle get_class_type() { diff --git a/panda/src/shader/planarReflector.cxx b/panda/src/shader/planarReflector.cxx index 21ac30566a..dba2fd71fe 100644 --- a/panda/src/shader/planarReflector.cxx +++ b/panda/src/shader/planarReflector.cxx @@ -113,7 +113,7 @@ void PlanarReflector::init(PlaneNode *plane_node, const Colorf& c) //////////////////////////////////////////////////////////////////// void PlanarReflector:: pre_apply(Node *, const AllAttributesWrapper &, - const AllTransitionsWrapper &, GraphicsStateGuardian *gsg) + const AllTransitionsWrapper &, GraphicsStateGuardian *gsg) { int xo, yo, w, h; gsg->get_current_display_region()->get_region_pixels(xo, yo, w, h); @@ -165,24 +165,24 @@ apply(Node *node, const AllAttributesWrapper &init_state, int buffer_mask = RenderBuffer::T_stencil; if (_save_color_buffer) { gsg->copy_pixel_buffer(_color_buffer, - gsg->get_current_display_region(), - gsg->get_render_buffer(RenderBuffer::T_back)); + gsg->get_current_display_region(), + gsg->get_render_buffer(RenderBuffer::T_back)); buffer_mask |= RenderBuffer::T_back; ColorMaskTransition *cm = new ColorMaskTransition(0); trans.set_transition(cm); } else { ColorMaskTransition *cm = - new ColorMaskTransition(ColorMaskProperty::M_a); + new ColorMaskTransition(ColorMaskProperty::M_a); trans.set_transition(cm); } if (_save_depth_buffer) { gsg->copy_pixel_buffer(_depth_buffer, - gsg->get_current_display_region(), - gsg->get_render_buffer(RenderBuffer::T_depth)); - // gsg->get_render_buffer(RenderBuffer::T_back)); + gsg->get_current_display_region(), + gsg->get_render_buffer(RenderBuffer::T_depth)); + // gsg->get_render_buffer(RenderBuffer::T_back)); } // The scene has already been rendered so we need to stencil in an area @@ -204,7 +204,7 @@ apply(Node *node, const AllAttributesWrapper &init_state, // Enable the stencil buffer StencilTransition *sa = new StencilTransition(StencilProperty::M_not_equal, - StencilProperty::A_replace); + StencilProperty::A_replace); trans.set_transition(sa); // Disable texturing @@ -231,7 +231,7 @@ apply(Node *node, const AllAttributesWrapper &init_state, // Adjust the stencil buffer properties StencilTransition *sa = new StencilTransition(StencilProperty::M_equal, - StencilProperty::A_keep); + StencilProperty::A_keep); trans.set_transition(sa); @@ -309,7 +309,7 @@ apply(Node *node, const AllAttributesWrapper &init_state, na.set_attribute(ColorBlendTransition::get_class_type(), cb); gsg->draw_pixel_buffer(_color_buffer, gsg->get_current_display_region(), - gsg->get_render_buffer(RenderBuffer::T_back), na); + gsg->get_render_buffer(RenderBuffer::T_back), na); } else { // One more pass to redraw the reflecting object (additive blending) // Final color is reflecting obj color + (ref. obj. color * reflectivity) @@ -317,7 +317,7 @@ apply(Node *node, const AllAttributesWrapper &init_state, StencilTransition *sa = new StencilTransition(StencilProperty::M_equal, - StencilProperty::A_keep); + StencilProperty::A_keep); trans.set_transition(sa); DepthTestTransition *dta = @@ -338,8 +338,8 @@ apply(Node *node, const AllAttributesWrapper &init_state, if (_save_depth_buffer) { gsg->draw_pixel_buffer(_depth_buffer, gsg->get_current_display_region(), - gsg->get_render_buffer(RenderBuffer::T_depth)); - // gsg->get_render_buffer(RenderBuffer::T_back)); + gsg->get_render_buffer(RenderBuffer::T_depth)); + // gsg->get_render_buffer(RenderBuffer::T_back)); } diff --git a/panda/src/shader/planarReflector.h b/panda/src/shader/planarReflector.h index e8b251c88c..63165d925c 100644 --- a/panda/src/shader/planarReflector.h +++ b/panda/src/shader/planarReflector.h @@ -31,13 +31,13 @@ class EXPCL_SHADER PlanarReflector : public CasterShader PlanarReflector(PlaneNode* plane_node); PlanarReflector(const Colorf& c); PlanarReflector(PlaneNode* plane_node, const Colorf& c); - + virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); INLINE void set_save_color_buffer(bool val) { _save_color_buffer = val; } INLINE void set_save_depth_buffer(bool val) { _save_depth_buffer = val; } @@ -51,13 +51,13 @@ class EXPCL_SHADER PlanarReflector : public CasterShader protected: - bool _save_color_buffer; - bool _save_depth_buffer; - bool _clip_to_plane; - PT(PixelBuffer) _color_buffer; - PT(PixelBuffer) _depth_buffer; - PT(PlaneNode) _plane_node; - Colorf _color; + bool _save_color_buffer; + bool _save_depth_buffer; + bool _clip_to_plane; + PT(PixelBuffer) _color_buffer; + PT(PixelBuffer) _depth_buffer; + PT(PlaneNode) _plane_node; + Colorf _color; public: diff --git a/panda/src/shader/projtexShader.cxx b/panda/src/shader/projtexShader.cxx index ca17c12532..273973be54 100644 --- a/panda/src/shader/projtexShader.cxx +++ b/panda/src/shader/projtexShader.cxx @@ -34,7 +34,7 @@ TypeHandle ProjtexShader::_type_handle; // Description: //////////////////////////////////////////////////////////////////// ProjtexShader::ProjtexShader(Texture* texture, - ColorBlendProperty::Mode mode) + ColorBlendProperty::Mode mode) : FrustumShader(), _blend(mode) { set_texture(texture); diff --git a/panda/src/shader/projtexShader.h b/panda/src/shader/projtexShader.h index 1c2e3b9fea..2949cf84da 100644 --- a/panda/src/shader/projtexShader.h +++ b/panda/src/shader/projtexShader.h @@ -28,13 +28,13 @@ class EXPCL_SHADER ProjtexShader : public FrustumShader public: ProjtexShader(Texture* texture = NULL, - ColorBlendProperty::Mode mode = ColorBlendProperty::M_multiply); + ColorBlendProperty::Mode mode = ColorBlendProperty::M_multiply); ~ProjtexShader() { } virtual void config(void); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); INLINE void set_texture(Texture* texture) { _texture = texture; @@ -56,7 +56,7 @@ public: static void init_type() { FrustumShader::init_type(); register_type(_type_handle, "ProjtexShader", - FrustumShader::get_class_type()); + FrustumShader::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/shader/projtexShadower.cxx b/panda/src/shader/projtexShadower.cxx index dad085f46e..20752bf3d9 100644 --- a/panda/src/shader/projtexShadower.cxx +++ b/panda/src/shader/projtexShadower.cxx @@ -131,7 +131,7 @@ pre_apply(Node *node, const AllAttributesWrapper &init_state, // Make a display region of the proper size and clear it to prepare for // rendering the shadow map PT(DisplayRegion) disp_region = - gsg->get_window()->make_scratch_display_region(_size, _size); + gsg->get_window()->make_scratch_display_region(_size, _size); DisplayRegionStack old_dr = gsg->push_display_region(disp_region); // Save scratch region before clearing it to be non-destructive @@ -141,7 +141,7 @@ pre_apply(Node *node, const AllAttributesWrapper &init_state, gsg->set_color_clear_value(Colorf(1., 1., 1., 1.)); gsg->clear(gsg->get_render_buffer(RenderBuffer::T_back | - RenderBuffer::T_depth), disp_region); + RenderBuffer::T_depth), disp_region); // Copy the transition wrapper so we can modify it freely. AllTransitionsWrapper trans(net_trans); diff --git a/panda/src/shader/projtexShadower.h b/panda/src/shader/projtexShadower.h index 8b201522d7..0fce7b3318 100644 --- a/panda/src/shader/projtexShadower.h +++ b/panda/src/shader/projtexShadower.h @@ -23,8 +23,8 @@ //////////////////////////////////////////////////////////////////// // Class : ProjtexShadower // Description : Creates the shadow of a casting object(s) and projects -// it onto a receiving object(s) from a given light -// frustum +// it onto a receiving object(s) from a given light +// frustum //////////////////////////////////////////////////////////////////// class EXPCL_SHADER ProjtexShadower : public CasterShader { @@ -33,11 +33,11 @@ public: ProjtexShadower(int size = 256); virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); // MPG - should we make this check for powers of 2? INLINE void set_size(int size) { _size = size; } @@ -51,8 +51,8 @@ public: protected: - PT(ProjtexShader) _projtex_shader; - int _size; + PT(ProjtexShader) _projtex_shader; + int _size; public: @@ -62,7 +62,7 @@ public: static void init_type() { CasterShader::init_type(); register_type(_type_handle, "ProjtexShadower", - CasterShader::get_class_type()); + CasterShader::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/shader/shader.h b/panda/src/shader/shader.h index 62d4df5f76..b03ef5ab34 100644 --- a/panda/src/shader/shader.h +++ b/panda/src/shader/shader.h @@ -42,13 +42,13 @@ public: virtual ~Shader(void) { } virtual void pre_apply(Node *, const AllAttributesWrapper &, - const AllTransitionsWrapper &, - GraphicsStateGuardian *); + const AllTransitionsWrapper &, + GraphicsStateGuardian *); virtual void apply(Node *, const AllAttributesWrapper &, - const AllTransitionsWrapper &, - GraphicsStateGuardian *); + const AllTransitionsWrapper &, + GraphicsStateGuardian *); virtual void set_priority(int priority); virtual int get_priority(void) const; @@ -76,8 +76,8 @@ public: ReferenceCount::init_type(); Configurable::init_type(); register_type(_type_handle, "Shader", - ReferenceCount::get_class_type(), - Configurable::get_class_type()); + ReferenceCount::get_class_type(), + Configurable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); @@ -94,8 +94,8 @@ private: //////////////////////////////////////////////////////////////////// // Class : FrustumShader // Description : Shader that computes effect based on a frustum -// (most often a light or a camera) for a list of -// receiving objects +// (most often a light or a camera) for a list of +// receiving objects //////////////////////////////////////////////////////////////////// class EXPCL_SHADER FrustumShader : public Shader { @@ -115,7 +115,7 @@ public: protected: - ProjectionVector _frusta; + ProjectionVector _frusta; public: @@ -125,7 +125,7 @@ public: static void init_type() { Shader::init_type(); register_type(_type_handle, "FrustumShader", - Shader::get_class_type()); + Shader::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/shader/shaderTransition.cxx b/panda/src/shader/shaderTransition.cxx index fb050ce746..8f7e64a108 100644 --- a/panda/src/shader/shaderTransition.cxx +++ b/panda/src/shader/shaderTransition.cxx @@ -122,7 +122,7 @@ insert(Shader *shader) { { if (order < _overrides[(*si)]) { - break; + break; } } else if (order < (*_shader_order)[(*si)->get_type()]) @@ -245,7 +245,7 @@ must_blend() //////////////////////////////////////////////////////////////////// bool ShaderTransition:: sub_render(NodeRelation *arc, const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, RenderTraverser *trav) { + AllTransitionsWrapper &trans, RenderTraverser *trav) { Node *node = arc->get_child(); GraphicsStateGuardian *gsg = trav->get_gsg(); bool multipass_on = false; diff --git a/panda/src/shader/shaderTransition.h b/panda/src/shader/shaderTransition.h index 4250c0e509..fb28190f24 100644 --- a/panda/src/shader/shaderTransition.h +++ b/panda/src/shader/shaderTransition.h @@ -19,7 +19,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ShaderTransition +// Class : ShaderTransition // Description : A ShaderTransition holds the set of shaders that // might be in effect to render a particular part of the // subgraph. These shaders can range from lightweight @@ -68,9 +68,9 @@ public: virtual NodeTransition *make_copy() const; virtual bool sub_render(NodeRelation *arc, - const AllAttributesWrapper &attrib, - AllTransitionsWrapper &trans, - RenderTraverser *trav); + const AllAttributesWrapper &attrib, + AllTransitionsWrapper &trans, + RenderTraverser *trav); virtual bool has_sub_render() const; private: @@ -90,7 +90,7 @@ public: static void init_type() { ImmediateTransition::init_type(); register_type(_type_handle, "ShaderTransition", - ImmediateTransition::get_class_type()); + ImmediateTransition::get_class_type()); } private: diff --git a/panda/src/shader/spheretexHighlighter.cxx b/panda/src/shader/spheretexHighlighter.cxx index c2b098e75d..256f5d7e07 100644 --- a/panda/src/shader/spheretexHighlighter.cxx +++ b/panda/src/shader/spheretexHighlighter.cxx @@ -75,7 +75,7 @@ set_priority(int priority) /////////////////////////////////////////////////////////////////// void SpheretexHighlighter:: pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &, GraphicsStateGuardian *gsg) + const AllTransitionsWrapper &, GraphicsStateGuardian *gsg) { if (get_num_frusta() == 0) { shader_cat.error() @@ -140,20 +140,20 @@ pre_apply(Node *node, const AllAttributesWrapper &init_state, color[0] = color[1] = color[2] = 0; if (XX_ZZ <= 1.) { // Are we on the unit sphere? - norm[1] = -(float)sqrt(1. - XX_ZZ); // This yields a unit vector - grazing = dot(norm, light_vec); - if (grazing > 0.) { // Does any light actually reflect off this point? + norm[1] = -(float)sqrt(1. - XX_ZZ); // This yields a unit vector + grazing = dot(norm, light_vec); + if (grazing > 0.) { // Does any light actually reflect off this point? S = norm; S *= 2. * grazing; S = S - light_vec; // the reflection vector intensity = -dot(S, norm_model_pos); // approximate R . V - // If, relative to the viewer, the normal doesn't point towards the - // light (even slightly), no reflection will be seen - if (intensity > 0.) { - intensity = pow(intensity, shininess); - color[0] = color[1] = color[2] = (uchar)(intensity * 255.); - } - } + // If, relative to the viewer, the normal doesn't point towards the + // light (even slightly), no reflection will be seen + if (intensity > 0.) { + intensity = pow(intensity, shininess); + color[0] = color[1] = color[2] = (uchar)(intensity * 255.); + } + } } texture->_pbuffer->set_uchar_rgb_texel(color, x, y, _size); texture->unprepare(); diff --git a/panda/src/shader/spheretexHighlighter.h b/panda/src/shader/spheretexHighlighter.h index aacad5c5ca..523c187b48 100644 --- a/panda/src/shader/spheretexHighlighter.h +++ b/panda/src/shader/spheretexHighlighter.h @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////// // Class : SpheretexHighlighter // Description : Creates a highlight texture from a given light and -// projects this onto the receiving object +// projects this onto the receiving object //////////////////////////////////////////////////////////////////// class EXPCL_SHADER SpheretexHighlighter : public FrustumShader { @@ -32,11 +32,11 @@ public: SpheretexHighlighter(int size = 128); virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); // MPG - should we make this check for powers of 2? INLINE void set_size(int size) { _size = size; } @@ -49,8 +49,8 @@ public: protected: - SpheretexShader _spheretex_shader; - int _size; + SpheretexShader _spheretex_shader; + int _size; public: @@ -60,7 +60,7 @@ public: static void init_type() { FrustumShader::init_type(); register_type(_type_handle, "SpheretexHighlighter", - FrustumShader::get_class_type()); + FrustumShader::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/shader/spheretexReflector.cxx b/panda/src/shader/spheretexReflector.cxx index e56a127b6a..098289b15c 100644 --- a/panda/src/shader/spheretexReflector.cxx +++ b/panda/src/shader/spheretexReflector.cxx @@ -93,7 +93,7 @@ set_multipass(bool on) //////////////////////////////////////////////////////////////////// void SpheretexReflector:: pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, GraphicsStateGuardian *gsg) + const AllTransitionsWrapper &net_trans, GraphicsStateGuardian *gsg) { if (get_num_casters() == 0) { shader_cat.error() diff --git a/panda/src/shader/spheretexReflector.h b/panda/src/shader/spheretexReflector.h index c743b3d4f1..8375b3a0c6 100644 --- a/panda/src/shader/spheretexReflector.h +++ b/panda/src/shader/spheretexReflector.h @@ -31,11 +31,11 @@ public: ~SpheretexReflector(void); virtual void pre_apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); // MPG - should we make this check for powers of 2? INLINE void set_size(int size) { _size = size; } @@ -58,11 +58,11 @@ public: protected: - SpheretexShader _spheretex_shader; - int _size; - bool _is_reflector; - float _fnear; - float _ffar; + SpheretexShader _spheretex_shader; + int _size; + bool _is_reflector; + float _fnear; + float _ffar; public: @@ -72,7 +72,7 @@ public: static void init_type() { CasterShader::init_type(); register_type(_type_handle, "SpheretexReflector", - CasterShader::get_class_type()); + CasterShader::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/shader/spheretexShader.h b/panda/src/shader/spheretexShader.h index f05c2a251c..869166437f 100644 --- a/panda/src/shader/spheretexShader.h +++ b/panda/src/shader/spheretexShader.h @@ -26,14 +26,14 @@ class EXPCL_SHADER SpheretexShader : public Shader { public: - + SpheretexShader(Texture* texture = NULL); ~SpheretexShader() { } virtual void config(void); virtual void apply(Node *node, const AllAttributesWrapper &init_state, - const AllTransitionsWrapper &net_trans, - GraphicsStateGuardian *gsg); + const AllTransitionsWrapper &net_trans, + GraphicsStateGuardian *gsg); INLINE void set_texture(Texture* texture) { _texture = texture; @@ -45,9 +45,9 @@ class EXPCL_SHADER SpheretexShader : public Shader } protected: - - PT(Texture) _texture; - ColorBlendProperty::Mode _blend_mode; + + PT(Texture) _texture; + ColorBlendProperty::Mode _blend_mode; public: diff --git a/panda/src/shader/spotlightShader.h b/panda/src/shader/spotlightShader.h index 3f64063975..74e9f86344 100644 --- a/panda/src/shader/spotlightShader.h +++ b/panda/src/shader/spotlightShader.h @@ -30,7 +30,7 @@ public: // SpotlightShader uses ProjtexShader::apply() protected: - float _radius; + float _radius; public: diff --git a/panda/src/switchnode/LODNode.I b/panda/src/switchnode/LODNode.I index 4399fcf1e2..51b8495293 100644 --- a/panda/src/switchnode/LODNode.I +++ b/panda/src/switchnode/LODNode.I @@ -72,7 +72,7 @@ set_switch(int index, float in, float out) { INLINE void LODNode:: clear_switches(void) { _lod._switch_vector.erase(_lod._switch_vector.begin(), - _lod._switch_vector.end()); + _lod._switch_vector.end()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/switchnode/LODNode.h b/panda/src/switchnode/LODNode.h index 288f585d47..848c5d306f 100644 --- a/panda/src/switchnode/LODNode.h +++ b/panda/src/switchnode/LODNode.h @@ -71,7 +71,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #include "LODNode.I" diff --git a/panda/src/switchnode/sequenceNode.h b/panda/src/switchnode/sequenceNode.h index 0d78fdd73a..7cda0b3aa3 100644 --- a/panda/src/switchnode/sequenceNode.h +++ b/panda/src/switchnode/sequenceNode.h @@ -55,7 +55,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #endif diff --git a/panda/src/switchnode/switchNodeOne.I b/panda/src/switchnode/switchNodeOne.I index 634a503e42..f08d83c018 100644 --- a/panda/src/switchnode/switchNodeOne.I +++ b/panda/src/switchnode/switchNodeOne.I @@ -50,7 +50,7 @@ select_child(int index) { if (switchnode_cat.is_debug()) { if (_selected_child_index != index) { switchnode_cat.debug() - << *this << " selecting child " << index << "\n"; + << *this << " selecting child " << index << "\n"; } } diff --git a/panda/src/switchnode/switchNodeOne.h b/panda/src/switchnode/switchNodeOne.h index 88897f88b8..35d9d973bf 100644 --- a/panda/src/switchnode/switchNodeOne.h +++ b/panda/src/switchnode/switchNodeOne.h @@ -50,7 +50,7 @@ public: virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: - static TypeHandle _type_handle; + static TypeHandle _type_handle; }; #include "switchNodeOne.I" diff --git a/panda/src/testbed/deadrec_rec.cxx b/panda/src/testbed/deadrec_rec.cxx index 97d51e5535..cf51b0f3a6 100644 --- a/panda/src/testbed/deadrec_rec.cxx +++ b/panda/src/testbed/deadrec_rec.cxx @@ -93,72 +93,72 @@ static void* internal_monitor(void*) { NetAddress address; PT(Connection) new_connection; if (listener->get_new_connection(rv, address, new_connection)) { - if (deadrec_cat->is_debug()) - deadrec_cat->debug() << "Got connection from " << address << endl; - reader->add_connection(new_connection); - clients.insert(new_connection); + if (deadrec_cat->is_debug()) + deadrec_cat->debug() << "Got connection from " << address << endl; + reader->add_connection(new_connection); + clients.insert(new_connection); } } // check for reset clients while (cm.reset_connection_available()) { PT(Connection) connection; if (cm.get_reset_connection(connection)) { - if (deadrec_cat->is_debug()) - deadrec_cat->debug() << "Lost connection from " - << connection->get_address() << endl; - clients.erase(connection); - cm.close_connection(connection); + if (deadrec_cat->is_debug()) + deadrec_cat->debug() << "Lost connection from " + << connection->get_address() << endl; + clients.erase(connection); + cm.close_connection(connection); } } // process all available datagrams while (reader->data_available()) { NetDatagram datagram; if (reader->get_data(datagram)) { - unsigned char* buff = (unsigned char*)(datagram.get_data()); - unsigned char byte; - TelemetryToken t; - buff = get_uint8(buff, byte); - t = (TelemetryToken)byte; - while (t != T_End) { - switch (t) { - case T_Pos: - { - float x, y, z; - buff = get_float64(get_float64(get_float64(buff, x), y), z); - telemetry_pos = LPoint3f(x, y, z); - } - break; - case T_Vel: - if (deadrec_cat->is_debug()) - deadrec_cat->debug() << "got T_Num" << endl; - break; - case T_Num: - if (deadrec_cat->is_debug()) - deadrec_cat->debug() << "got T_Num" << endl; - break; - case T_Time: - { - float x; - buff = get_float64(buff, x); - if (doing_sync) { - clock_skew = ClockObject::get_global_clock()->get_frame_time() - x; - doing_sync = false; - cerr << "setting clock skew to: " << clock_skew << endl; - } else - telemetry_time = x + clock_skew; - } - break; - case T_Sync: - doing_sync = true; - break; - default: - deadrec_cat->warning() << "got bad token in datagram (" << (int)t - << ")" << endl; - } - buff = get_uint8(buff, byte); - t = (TelemetryToken)byte; - } - new_telemetry = true; + unsigned char* buff = (unsigned char*)(datagram.get_data()); + unsigned char byte; + TelemetryToken t; + buff = get_uint8(buff, byte); + t = (TelemetryToken)byte; + while (t != T_End) { + switch (t) { + case T_Pos: + { + float x, y, z; + buff = get_float64(get_float64(get_float64(buff, x), y), z); + telemetry_pos = LPoint3f(x, y, z); + } + break; + case T_Vel: + if (deadrec_cat->is_debug()) + deadrec_cat->debug() << "got T_Num" << endl; + break; + case T_Num: + if (deadrec_cat->is_debug()) + deadrec_cat->debug() << "got T_Num" << endl; + break; + case T_Time: + { + float x; + buff = get_float64(buff, x); + if (doing_sync) { + clock_skew = ClockObject::get_global_clock()->get_frame_time() - x; + doing_sync = false; + cerr << "setting clock skew to: " << clock_skew << endl; + } else + telemetry_time = x + clock_skew; + } + break; + case T_Sync: + doing_sync = true; + break; + default: + deadrec_cat->warning() << "got bad token in datagram (" << (int)t + << ")" << endl; + } + buff = get_uint8(buff, byte); + t = (TelemetryToken)byte; + } + new_telemetry = true; } } // sleep for about 100 milliseconds @@ -192,7 +192,7 @@ static void predict_event_up(CPT_Event e) { break; default: deadrec_cat->error() << "switching predictor to invalid type (" - << (int)curr_pred << ")" << endl; + << (int)curr_pred << ")" << endl; } reinit_prediction = true; } @@ -246,7 +246,7 @@ static void correct_event_up(CPT_Event e) { break; default: deadrec_cat->error() << "switching corrector to invalid type (" - << (int)curr_corr << ")" << endl; + << (int)curr_corr << ")" << endl; } reinit_correction = true; } @@ -280,7 +280,7 @@ static void correct_event(CPT_Event e) { typedef void (*event_func)(CPT_Event); static inline GuiButton* make_button(const string& name, Node* font, - EventHandler& eh, event_func func) { + EventHandler& eh, event_func func) { GuiLabel* l1 = GuiLabel::make_simple_text_label(name, font); GuiLabel* l2 = GuiLabel::make_simple_text_label(name, font); GuiLabel* l3 = GuiLabel::make_simple_text_label(name, font); @@ -318,13 +318,13 @@ static void deadrec_setup(EventHandler& eh) { } if (deadrec_cat->is_debug()) deadrec_cat->debug() << "Listening for connections on port " << hostport - << endl; + << endl; listener = new QueuedConnectionListener(&cm, 0); listener->add_connection(rendezvous); reader = new QueuedConnectionReader(&cm, 1); stop_monitoring = false; monitor = thread::create(internal_monitor, (void*)0L, - thread::PRIORITY_NORMAL); + thread::PRIORITY_NORMAL); // create an interface GuiManager* mgr = GuiManager::get_ptr(main_win, mak); PT_Node font = ModelPool::load_model("ttf-comic"); @@ -434,23 +434,23 @@ inline static void predict_linear(void) { case 2: if (new_telemetry) { if (telemetry_time < A_time) { - // before our two samples, ignore it + // before our two samples, ignore it } else if (telemetry_time > B_time) { - // a sample in brave new territory - A = B; - A_time = B_time; - B = telemetry_pos; - B_time = telemetry_time; - V = B - A; - V *= 1. / (B_time - A_time); - time = 0.; + // a sample in brave new territory + A = B; + A_time = B_time; + B = telemetry_pos; + B_time = telemetry_time; + V = B - A; + V *= 1. / (B_time - A_time); + time = 0.; } else { - // is between our two samples - A = telemetry_pos; - A_time = telemetry_time; - V = B - A; - V *= 1. / (B_time - A_time); - time = 0.; + // is between our two samples + A = telemetry_pos; + A_time = telemetry_time; + V = B - A; + V *= 1. / (B_time - A_time); + time = 0.; } } if (time <= 0.) { @@ -463,7 +463,7 @@ inline static void predict_linear(void) { break; default: deadrec_cat->error() << "got in invalid state in linear predictor (" - << state << ")" << endl; + << state << ")" << endl; } } @@ -477,7 +477,7 @@ inline static void run_predict(void) { break; default: deadrec_cat->error() << "bad prediction type (" << (int)curr_pred << ")" - << endl; + << endl; } } @@ -500,24 +500,24 @@ inline static void correction_lerp(void) { } else { if (have_both) { if (save_pos != target_pos) { - time = 0.; - prev_pos = my_pos; - save_pos = target_pos; + time = 0.; + prev_pos = my_pos; + save_pos = target_pos; } else { - if (time < 0.5) { - // half second lerp - float tmp = time * 2.; - LVector3f vtmp = save_pos - prev_pos; - my_pos = (tmp * vtmp) + prev_pos; - time += ClockObject::get_global_clock()->get_dt(); - } + if (time < 0.5) { + // half second lerp + float tmp = time * 2.; + LVector3f vtmp = save_pos - prev_pos; + my_pos = (tmp * vtmp) + prev_pos; + time += ClockObject::get_global_clock()->get_dt(); + } } } else { if (save_pos != target_pos) { - save_pos = target_pos; - my_pos = prev_pos; - time = 0.; - have_both = true; + save_pos = target_pos; + my_pos = prev_pos; + time = 0.; + have_both = true; } } } @@ -540,36 +540,36 @@ inline static void correction_spline(void) { } else { if (have_both) { if (save_pos != target_pos) { - time = 0.; - prev_pos = my_pos; - prev_vel = my_vel; - save_pos = target_pos; - save_vel = target_vel; - A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel; - B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel; - C = prev_vel; - D = prev_pos; + time = 0.; + prev_pos = my_pos; + prev_vel = my_vel; + save_pos = target_pos; + save_vel = target_vel; + A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel; + B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel; + C = prev_vel; + D = prev_pos; } else { - if (time < 0.5) { - // half second lerp - float tmp = time * 2.; - my_pos = (tmp * tmp * tmp * A) + (tmp * tmp * B) + (tmp * C) + D; - my_vel = (3. * tmp * tmp * A) + (2. * tmp * B) + C; - time += ClockObject::get_global_clock()->get_dt(); - } + if (time < 0.5) { + // half second lerp + float tmp = time * 2.; + my_pos = (tmp * tmp * tmp * A) + (tmp * tmp * B) + (tmp * C) + D; + my_vel = (3. * tmp * tmp * A) + (2. * tmp * B) + C; + time += ClockObject::get_global_clock()->get_dt(); + } } } else { if (save_pos != target_pos) { - save_pos = target_pos; - save_vel = target_vel; - my_pos = prev_pos; - my_vel = prev_vel; - time = 0.; - A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel; - B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel; - C = prev_vel; - D = prev_pos; - have_both = true; + save_pos = target_pos; + save_vel = target_vel; + my_pos = prev_pos; + my_vel = prev_vel; + time = 0.; + A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel; + B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel; + C = prev_vel; + D = prev_pos; + have_both = true; } } } @@ -588,7 +588,7 @@ inline static void run_correct(void) { break; default: deadrec_cat->error() << "bad correction type (" << (int)curr_corr << ")" - << endl; + << endl; } } diff --git a/panda/src/testbed/deadrec_send.cxx b/panda/src/testbed/deadrec_send.cxx index f5a5a46ad8..60e1a1e3d3 100644 --- a/panda/src/testbed/deadrec_send.cxx +++ b/panda/src/testbed/deadrec_send.cxx @@ -77,15 +77,15 @@ static bool verify_connection(void) { if (time <= 0.) { NetAddress host; if (!host.set_host(hostname, hostport)) { - deadrec_cat->warning() << "unknown host: " << hostname << endl; - time = 100.; - return false; + deadrec_cat->warning() << "unknown host: " << hostname << endl; + time = 100.; + return false; } PT(Connection) local_conn = cm.open_TCP_client_connection(host, 5000); if (local_conn.is_null()) { - deadrec_cat->warning() << "no connection" << endl; - time = 5.; - return false; + deadrec_cat->warning() << "no connection" << endl; + time = 5.; + return false; } conn = local_conn; // sync clock @@ -99,17 +99,17 @@ static bool verify_connection(void) { PT(Connection) local_conn; if (cm.get_reset_connection(local_conn)) { if (local_conn == conn) { - cm.close_connection(conn); - conn = (Connection*)0L; - time = 5.; - return false; + cm.close_connection(conn); + conn = (Connection*)0L; + time = 5.; + return false; } else - deadrec_cat->error() - << "got a report of a closed connection that I've never heard of" - << endl; + deadrec_cat->error() + << "got a report of a closed connection that I've never heard of" + << endl; } else deadrec_cat->error() - << "a closed connection was reported, but none was listed" << endl; + << "a closed connection was reported, but none was listed" << endl; } return true; } @@ -145,7 +145,7 @@ void update_smiley(void) { class MyPosFunctor : public LPoint3fLerpFunctor { public: MyPosFunctor(LPoint3f start, LPoint3f end) : LPoint3fLerpFunctor(start, - end) {} + end) {} MyPosFunctor(const MyPosFunctor& p) : LPoint3fLerpFunctor(p) {} virtual ~MyPosFunctor(void) {} virtual void operator()(float t) { @@ -160,7 +160,7 @@ public: static void init_type(void) { LPoint3fLerpFunctor::init_type(); register_type(_type_handle, "MyPosFunctor", - LPoint3fLerpFunctor::get_class_type()); + LPoint3fLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); } virtual TypeHandle force_init_type(void) { @@ -193,7 +193,7 @@ public: static void init_type(void) { FloatLerpFunctor::init_type(); register_type(_type_handle, "MyRotFunctor", - FloatLerpFunctor::get_class_type()); + FloatLerpFunctor::get_class_type()); } virtual TypeHandle get_type(void) const { return get_class_type(); } virtual TypeHandle force_init_type(void) { @@ -230,13 +230,13 @@ static void run_line(bool smooth) { if (where) { curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(10., 0., 0.)), - 5., blend, &event_handler); + 5., blend, &event_handler); curr_lerp->set_end_event("lerp_done"); curr_lerp->start(); } else { curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(-10., 0., 0.)), - 5., blend, &event_handler); + 5., blend, &event_handler); curr_lerp->set_end_event("lerp_done"); curr_lerp->start(); } @@ -256,33 +256,33 @@ static void run_box(bool smooth) { case 0: curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, - LPoint3f::rfu(-10., 0., 10.)), - 5., blend, &event_handler); + LPoint3f::rfu(-10., 0., 10.)), + 5., blend, &event_handler); where = 1; break; case 1: curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(10., 0., 10.)), - 5., blend, &event_handler); + 5., blend, &event_handler); where = 2; break; case 2: curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, - LPoint3f::rfu(10., 0., -10.)), - 5., blend, &event_handler); + LPoint3f::rfu(10., 0., -10.)), + 5., blend, &event_handler); where = 3; break; case 3: curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, - LPoint3f::rfu(-10., 0., -10.)), - 5., blend, &event_handler); + LPoint3f::rfu(-10., 0., -10.)), + 5., blend, &event_handler); where = 0; break; default: deadrec_cat->error() << "I'm a tard and box::where got out of range (" - << where << ")" << endl; + << where << ")" << endl; where = 0; run_box(smooth); } @@ -299,7 +299,7 @@ static void run_circle(bool smooth) { else blend = new NoBlendType(); curr_lerp = new AutonomousLerp(new MyRotFunctor(0., 6.283185), 5., blend, - &event_handler); + &event_handler); curr_lerp->set_end_event("lerp_done"); curr_lerp->start(); } @@ -316,7 +316,7 @@ static void run_random(bool smooth) { float y = (20. * unit_rand()) - 10.; LVector3f p = LVector3f::rfu(x, 0., y); curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, p), 5., blend, - &event_handler); + &event_handler); curr_lerp->set_end_event("lerp_done"); curr_lerp->start(); } @@ -354,7 +354,7 @@ static void handle_lerp(void) { break; default: deadrec_cat->error() << "unknown motion type (" << (int)curr_type << ")" - << endl; + << endl; } } @@ -388,7 +388,7 @@ static void make_active(void) { break; default: deadrec_cat->error() <<" unknown motion type (" << (int)curr_type << ")" - << endl; + << endl; } } @@ -425,7 +425,7 @@ static void event_button_up(CPT_Event e) { break; default: deadrec_cat->error() << "switching to invalid motion type (" - << (int)switching_to << ")" << endl; + << (int)switching_to << ")" << endl; } curr_type = switching_to; handle_lerp(); @@ -488,7 +488,7 @@ static void event_button_down(CPT_Event e) { } static inline GuiButton* make_button(const string& name, Node* font, - EventHandler& eh) { + EventHandler& eh) { GuiLabel* l1 = GuiLabel::make_simple_text_label(name, font); GuiLabel* l2 = GuiLabel::make_simple_text_label(name, font); GuiLabel* l3 = GuiLabel::make_simple_text_label(name, font); diff --git a/panda/src/testbed/demo.cxx b/panda/src/testbed/demo.cxx index d9d40cfc54..845af40797 100644 --- a/panda/src/testbed/demo.cxx +++ b/panda/src/testbed/demo.cxx @@ -262,13 +262,13 @@ event_left(CPT_Event) { for (int i = 0; i < num_children; i++) { if (parent.get_child(i) == selected_node) { - // We've currently got child i; now select child i-1. - if (i - 1 >= 0) { - clear_highlight(); - selected_node = parent.get_child(i - 1); - set_highlight(); - } - return; + // We've currently got child i; now select child i-1. + if (i - 1 >= 0) { + clear_highlight(); + selected_node = parent.get_child(i - 1); + set_highlight(); + } + return; } } } @@ -284,13 +284,13 @@ event_right(CPT_Event) { for (int i = 0; i < num_children; i++) { if (parent.get_child(i) == selected_node) { - // We've currently got child i; now select child i + 11. - if (i + 1 < num_children) { - clear_highlight(); - selected_node = parent.get_child(i + 1); - set_highlight(); - } - return; + // We've currently got child i; now select child i + 11. + if (i + 1 < num_children) { + clear_highlight(); + selected_node = parent.get_child(i + 1); + set_highlight(); + } + return; } } } @@ -311,21 +311,21 @@ event_fkey(CPT_Event event) { } else { Colorf color; if (event->get_name() == "f1") { - color.set(0.0, 0.0, 1.0, 1.0); + color.set(0.0, 0.0, 1.0, 1.0); } else if (event->get_name() == "f2") { - color.set(0.0, 1.0, 0.0, 1.0); + color.set(0.0, 1.0, 0.0, 1.0); } else if (event->get_name() == "f3") { - color.set(0.0, 1.0, 1.0, 1.0); + color.set(0.0, 1.0, 1.0, 1.0); } else if (event->get_name() == "f4") { - color.set(1.0, 0.0, 0.0, 1.0); + color.set(1.0, 0.0, 0.0, 1.0); } else if (event->get_name() == "f5") { - color.set(1.0, 0.0, 1.0, 1.0); + color.set(1.0, 0.0, 1.0, 1.0); } else if (event->get_name() == "f6") { - color.set(1.0, 1.0, 0.0, 1.0); + color.set(1.0, 1.0, 0.0, 1.0); } else if (event->get_name() == "f7") { - color.set(1.0, 1.0, 1.0, 1.0); + color.set(1.0, 1.0, 1.0, 1.0); } else if (event->get_name() == "f8") { - color.set(0.0, 0.0, 0.0, 1.0); + color.set(0.0, 0.0, 0.0, 1.0); } arc->set_transition(new ColorTransition(color)); cerr << "Setting color on " << *arc << " to " << color << "\n"; diff --git a/panda/src/testbed/gui_demo.cxx b/panda/src/testbed/gui_demo.cxx index aa8d221edf..d1cdec870c 100644 --- a/panda/src/testbed/gui_demo.cxx +++ b/panda/src/testbed/gui_demo.cxx @@ -105,55 +105,55 @@ static void test3(GuiManager* mgr, Node* font) { static void test4(GuiManager* mgr, Node* font) { GuiRollover* r1 = new GuiRollover("r1", - GuiLabel::make_simple_text_label("1", - font), - GuiLabel::make_simple_text_label("!", - font)); + GuiLabel::make_simple_text_label("1", + font), + GuiLabel::make_simple_text_label("!", + font)); GuiRollover* r2 = new GuiRollover("r2", - GuiLabel::make_simple_text_label("2", - font), - GuiLabel::make_simple_text_label("@", - font)); + GuiLabel::make_simple_text_label("2", + font), + GuiLabel::make_simple_text_label("@", + font)); GuiRollover* r3 = new GuiRollover("r3", - GuiLabel::make_simple_text_label("3", - font), - GuiLabel::make_simple_text_label("#", - font)); + GuiLabel::make_simple_text_label("3", + font), + GuiLabel::make_simple_text_label("#", + font)); GuiRollover* r4 = new GuiRollover("r4", - GuiLabel::make_simple_text_label("4", - font), - GuiLabel::make_simple_text_label("$", - font)); + GuiLabel::make_simple_text_label("4", + font), + GuiLabel::make_simple_text_label("$", + font)); GuiRollover* r5 = new GuiRollover("r5", - GuiLabel::make_simple_text_label("5", - font), - GuiLabel::make_simple_text_label("%", - font)); + GuiLabel::make_simple_text_label("5", + font), + GuiLabel::make_simple_text_label("%", + font)); GuiRollover* r6 = new GuiRollover("r6", - GuiLabel::make_simple_text_label("6", - font), - GuiLabel::make_simple_text_label("^", - font)); + GuiLabel::make_simple_text_label("6", + font), + GuiLabel::make_simple_text_label("^", + font)); GuiRollover* r7 = new GuiRollover("r7", - GuiLabel::make_simple_text_label("7", - font), - GuiLabel::make_simple_text_label("&", - font)); + GuiLabel::make_simple_text_label("7", + font), + GuiLabel::make_simple_text_label("&", + font)); GuiRollover* r8 = new GuiRollover("r8", - GuiLabel::make_simple_text_label("8", - font), - GuiLabel::make_simple_text_label("*", - font)); + GuiLabel::make_simple_text_label("8", + font), + GuiLabel::make_simple_text_label("*", + font)); GuiRollover* r9 = new GuiRollover("r9", - GuiLabel::make_simple_text_label("9", - font), - GuiLabel::make_simple_text_label("(", - font)); + GuiLabel::make_simple_text_label("9", + font), + GuiLabel::make_simple_text_label("(", + font)); GuiRollover* r0 = new GuiRollover("r0", - GuiLabel::make_simple_text_label("0", - font), - GuiLabel::make_simple_text_label(")", - font)); + GuiLabel::make_simple_text_label("0", + font), + GuiLabel::make_simple_text_label(")", + font)); GuiFrame* f1 = new GuiFrame("test4"); f1->add_item(r1); f1->add_item(r2); diff --git a/panda/src/testbed/herc.cxx b/panda/src/testbed/herc.cxx index 97a415ab18..cf18090bdf 100644 --- a/panda/src/testbed/herc.cxx +++ b/panda/src/testbed/herc.cxx @@ -105,7 +105,7 @@ void herc_display_func(void) { void herc_overrides_func(ChanCfgOverrides &override, std::string&) { override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); + ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); override.setField(ChanCfgOverrides::Title, "Lighting Demo"); } @@ -124,19 +124,19 @@ void herc_idle() { float stride = walk_speed * ClockObject::get_global_clock()->get_dt(); if (dist > stride) { - LVector2f step = bv2 / dist * stride; + LVector2f step = bv2 / dist * stride; - const TransformTransition *tt; - if (!get_transition_into(tt, herc_arc)) { - herc_arc->set_transition - (new TransformTransition - (LMatrix4f::translate_mat(step[0], step[1], 0.0))); - } else { - LMatrix4f mat = tt->get_matrix(); - mat(3, 0) += step[0]; - mat(3, 1) += step[1]; - herc_arc->set_transition(new TransformTransition(mat)); - } + const TransformTransition *tt; + if (!get_transition_into(tt, herc_arc)) { + herc_arc->set_transition + (new TransformTransition + (LMatrix4f::translate_mat(step[0], step[1], 0.0))); + } else { + LMatrix4f mat = tt->get_matrix(); + mat(3, 0) += step[0]; + mat(3, 1) += step[1]; + herc_arc->set_transition(new TransformTransition(mat)); + } } } } @@ -321,7 +321,7 @@ void herc_keys(EventHandler &eh) { PT_NamedNode herc_model = loader.load_sync("herc-6000.egg"); PT_NamedNode herc_anim = loader.load_sync("HB_1_HE1.egg"); assert(herc_model != (NamedNode *)NULL && - herc_anim != (NamedNode *)NULL); + herc_anim != (NamedNode *)NULL); PT_NamedNode herc_parent = new NamedNode("herc_parent"); new RenderRelation(herc_parent, herc_model); new RenderRelation(herc_parent, herc_anim); @@ -354,7 +354,7 @@ void herc_keys(EventHandler &eh) { // Control the ball using a PlanarSlider tform. ball_slider = new PlanarSlider("ball_slider"); ball_slider->set_transform(LMatrix4f::translate_mat(0.0, 0.0, 1.0) * - LMatrix4f::scale_mat(7.0, -7.0, 1.0)); + LMatrix4f::scale_mat(7.0, -7.0, 1.0)); ball_slider->set_mouse_pos(LPoint2f(4.0 / 7.0, 2.0 / -7.0)); Transform2SG *slider2ball = new Transform2SG("slider2ball"); slider2ball->set_arc(ball_arc); @@ -413,7 +413,7 @@ void herc_keys(EventHandler &eh) { // Create a wireframe representation of the texture projector frustum GeomLine* proj_geom = - (GeomLine *)tex_proj->get_projection()->make_geometry(); + (GeomLine *)tex_proj->get_projection()->make_geometry(); proj_geom_node = new GeomNode("proj_geometry"); proj_geom_node->add_geom(proj_geom); diff --git a/panda/src/testbed/indirect.cxx b/panda/src/testbed/indirect.cxx index f0ca0994a1..3b0b648410 100644 --- a/panda/src/testbed/indirect.cxx +++ b/panda/src/testbed/indirect.cxx @@ -52,83 +52,83 @@ void indirect_display_func( void ) { if (t == (Texture*)0L) { t = new Texture; if (use_canned_texture) - t->read( "smiley.rgba" ); + t->read( "smiley.rgba" ); else if (full_region) { - int a, b, w, h; - dr1->get_region_pixels(a, b, w, h); - t->_pbuffer->set_xsize(binary_log_cap(w)); - t->_pbuffer->set_ysize(binary_log_cap(h)); + int a, b, w, h; + dr1->get_region_pixels(a, b, w, h); + t->_pbuffer->set_xsize(binary_log_cap(w)); + t->_pbuffer->set_ysize(binary_log_cap(h)); } else { - t->_pbuffer->set_xsize( 512 ); - t->_pbuffer->set_ysize( 512 ); + t->_pbuffer->set_xsize( 512 ); + t->_pbuffer->set_ysize( 512 ); } } if (side_by_side) { if (right_to_left) - g->prepare_display_region(dr2); + g->prepare_display_region(dr2); else - g->prepare_display_region(dr1); + g->prepare_display_region(dr1); } if (!use_canned_texture) { if (full_region) { - if (side_by_side) { - if (right_to_left) - t->copy_from( rb, dr2 ); - else - t->copy_from( rb, dr1 ); - } else - t->copy_from( rb, dr1 ); + if (side_by_side) { + if (right_to_left) + t->copy_from( rb, dr2 ); + else + t->copy_from( rb, dr1 ); + } else + t->copy_from( rb, dr1 ); } else - t->copy_from( rb ); + t->copy_from( rb ); } if (side_by_side) { if (right_to_left) - g->prepare_display_region(dr1); + g->prepare_display_region(dr1); else - g->prepare_display_region(dr2); + g->prepare_display_region(dr2); } if (full_region) { if (side_by_side) { - if (right_to_left) - t->draw_to( rf, dr1 ); - else - t->draw_to( rf, dr2 ); + if (right_to_left) + t->draw_to( rf, dr1 ); + else + t->draw_to( rf, dr2 ); } else - t->draw_to( rf, dr1 ); + t->draw_to( rf, dr1 ); } else t->draw_to( rf ); } else { if (pb == (PixelBuffer*)0L) { pb = new PixelBuffer; if (use_canned_texture) - pb->read( "smiley.rgba" ); + pb->read( "smiley.rgba" ); else if (full_region) { - int a, b, w, h; - dr1->get_region_pixels(a, b, w, h); - w = binary_log_cap(w); - h = binary_log_cap(h); - pb->set_xsize(w); - pb->set_ysize(h); - pb->_image = PTA_uchar(w * h * 3); + int a, b, w, h; + dr1->get_region_pixels(a, b, w, h); + w = binary_log_cap(w); + h = binary_log_cap(h); + pb->set_xsize(w); + pb->set_ysize(h); + pb->_image = PTA_uchar(w * h * 3); } else { - pb->set_xsize(512); - pb->set_ysize(512); - pb->_image = PTA_uchar(512 * 512 * 3); + pb->set_xsize(512); + pb->set_ysize(512); + pb->_image = PTA_uchar(512 * 512 * 3); } } if (side_by_side) { if (right_to_left) - g->prepare_display_region(dr2); + g->prepare_display_region(dr2); else - g->prepare_display_region(dr1); + g->prepare_display_region(dr1); } if (!use_canned_texture) pb->copy_from( rf ); if (side_by_side) { if (right_to_left) - g->prepare_display_region(dr1); + g->prepare_display_region(dr1); else - g->prepare_display_region(dr2); + g->prepare_display_region(dr2); } pb->draw_to( rf ); } diff --git a/panda/src/testbed/min_herc.cxx b/panda/src/testbed/min_herc.cxx index a61c744495..42eee77a43 100644 --- a/panda/src/testbed/min_herc.cxx +++ b/panda/src/testbed/min_herc.cxx @@ -111,7 +111,7 @@ extern void (*additional_idle)(); void herc_overrides_func(ChanCfgOverrides &override, std::string&) { override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); + ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); override.setField(ChanCfgOverrides::Title, "Lighting Demo"); } @@ -130,19 +130,19 @@ void herc_idle() { float stride = walk_speed * ClockObject::get_global_clock()->get_dt(); if (dist > stride) { - LVector2f step = bv2 / dist * stride; + LVector2f step = bv2 / dist * stride; - const TransformTransition *tt; - if (!get_transition_into(tt, herc_arc)) { - herc_arc->set_transition - (new TransformTransition - (LMatrix4f::translate_mat(step[0], step[1], 0.0))); - } else { - LMatrix4f mat = tt->get_matrix(); - mat(3, 0) += step[0]; - mat(3, 1) += step[1]; - herc_arc->set_transition(new TransformTransition(mat)); - } + const TransformTransition *tt; + if (!get_transition_into(tt, herc_arc)) { + herc_arc->set_transition + (new TransformTransition + (LMatrix4f::translate_mat(step[0], step[1], 0.0))); + } else { + LMatrix4f mat = tt->get_matrix(); + mat(3, 0) += step[0]; + mat(3, 1) += step[1]; + herc_arc->set_transition(new TransformTransition(mat)); + } } } } @@ -266,7 +266,7 @@ void herc_keys(EventHandler &eh) { PT_NamedNode herc_model = DCAST(NamedNode, loader.load_sync("herc-6000.egg")); PT_NamedNode herc_anim = DCAST(NamedNode, loader.load_sync("HB_1_HE1.egg")); assert(herc_model != (NamedNode *)NULL && - herc_anim != (NamedNode *)NULL); + herc_anim != (NamedNode *)NULL); PT_NamedNode herc_parent = new NamedNode("herc_parent"); new RenderRelation(herc_parent, herc_model); new RenderRelation(herc_parent, herc_anim); @@ -302,7 +302,7 @@ void herc_keys(EventHandler &eh) { // Control the ball using a PlanarSlider tform. ball_slider = new PlanarSlider("ball_slider"); ball_slider->set_transform(LMatrix4f::translate_mat(0.0, 0.0, 1.0) * - LMatrix4f::scale_mat(7.0, -7.0, 1.0)); + LMatrix4f::scale_mat(7.0, -7.0, 1.0)); ball_slider->set_mouse_pos(LPoint2f(4.0 / 7.0, 2.0 / -7.0)); Transform2SG *slider2ball = new Transform2SG("slider2ball"); slider2ball->set_arc(ball_arc); @@ -363,7 +363,7 @@ void herc_keys(EventHandler &eh) { // Create a wireframe representation of the texture projector frustum GeomLine* proj_geom = - (GeomLine *)tex_proj->get_projection()->make_geometry(); + (GeomLine *)tex_proj->get_projection()->make_geometry(); proj_geom_node = new GeomNode("proj_geometry"); proj_geom_node->add_geom(proj_geom); diff --git a/panda/src/testbed/min_shader.cxx b/panda/src/testbed/min_shader.cxx index df4ad63147..4990e3164b 100644 --- a/panda/src/testbed/min_shader.cxx +++ b/panda/src/testbed/min_shader.cxx @@ -199,7 +199,7 @@ void Viztex::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 256); override.setField(ChanCfgOverrides::SizeY, 256); @@ -215,7 +215,7 @@ void Viztex::Flush(void) { GraphicsStateGuardian* g = w->get_gsg(); const RenderBuffer& r = g->get_render_buffer(RenderBuffer::T_front); PT(DisplayRegion) d(w->make_scratch_display_region(w->get_width(), - w->get_height())); + w->get_height())); // g->prepare_display_region(d); (*i)->draw(g, d, r); } @@ -226,7 +226,7 @@ void Viztex::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 256); override.setField(ChanCfgOverrides::SizeY, 256); @@ -240,7 +240,7 @@ void Viztex::Flush(void) { GraphicsStateGuardian* g = w->get_gsg(); const RenderBuffer& r = g->get_render_buffer(RenderBuffer::T_front); PT(DisplayRegion) d(w->make_scratch_display_region(w->get_width(), - w->get_height())); + w->get_height())); // g->prepare_display_region(d); (*j)->draw(g, d, r); } @@ -272,7 +272,7 @@ void Tiledviz::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, main_win->get_width()); override.setField(ChanCfgOverrides::SizeY, main_win->get_height()); @@ -313,7 +313,7 @@ void Tiledviz::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, main_win->get_width()); override.setField(ChanCfgOverrides::SizeY, main_win->get_height()); @@ -567,7 +567,7 @@ void setup_projtex(void) #ifdef DISPLAY_TEXPROJFRUST // Display a wireframe representation of the texture projector frustum GeomLine* proj_geom = - (GeomLine *)tex_proj->get_projection()->make_geometry(); + (GeomLine *)tex_proj->get_projection()->make_geometry(); GeomNode* proj_geom_node = new GeomNode("proj_geometry"); proj_geom_node->add_geom(proj_geom); RenderRelation *prr = new RenderRelation(tex_proj, proj_geom_node); @@ -620,7 +620,7 @@ void setup_spotlight(void) // Display a wireframe representation of the spotlight frustum Colorf color_red(1., 0., 0., 1.); GeomLine* frust_geom = - (GeomLine *)tex_proj_spot->get_projection()->make_geometry(color_red); + (GeomLine *)tex_proj_spot->get_projection()->make_geometry(color_red); GeomNode* frust_geom_node = new GeomNode("frustum_geometry"); frust_geom_node->add_geom(frust_geom); RenderRelation *rr = new RenderRelation(tex_proj_spot, frust_geom_node); diff --git a/panda/src/testbed/panda.cxx b/panda/src/testbed/panda.cxx index ea8a5d7bf2..f94671c16e 100644 --- a/panda/src/testbed/panda.cxx +++ b/panda/src/testbed/panda.cxx @@ -71,7 +71,7 @@ PT(OutlineShader) outline_shader; void panda_overrides_func(ChanCfgOverrides& override, std::string&) { override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); + ((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE|W_STENCIL))); override.setField(ChanCfgOverrides::Title, "Panda Demo"); } @@ -88,18 +88,18 @@ void panda_idle(void) { float stride = walk_speed * ClockObject::get_global_clock()->get_dt(); if (dist > stride) { - LVector2f step = bv2 / dist * stride; - const TransformTransition *tt; - if (!get_transition_into(tt, panda_arc)) { - panda_arc->set_transition - (new TransformTransition - (LMatrix4f::translate_mat(step[0], step[1], 0.))); - } else { - LMatrix4f mat = tt->get_matrix(); - mat(3, 0) += step[0]; - mat(3, 1) += step[1]; - panda_arc->set_transition(new TransformTransition(mat)); - } + LVector2f step = bv2 / dist * stride; + const TransformTransition *tt; + if (!get_transition_into(tt, panda_arc)) { + panda_arc->set_transition + (new TransformTransition + (LMatrix4f::translate_mat(step[0], step[1], 0.))); + } else { + LMatrix4f mat = tt->get_matrix(); + mat(3, 0) += step[0]; + mat(3, 1) += step[1]; + panda_arc->set_transition(new TransformTransition(mat)); + } } } } @@ -299,7 +299,7 @@ void load_our_models(void) { // control the ball using a PlanarSlider tform ball_slider = new PlanarSlider("ball_slider"); ball_slider->set_transform(LMatrix4f::translate_mat(0., 0., 1.) * - LMatrix4f::scale_mat(7., -7., 1.)); + LMatrix4f::scale_mat(7., -7., 1.)); ball_slider->set_mouse_pos(LPoint2f(4. / 7., 2. / -7.)); Transform2SG* slider2ball = new Transform2SG("slider2ball"); slider2ball->set_arc(ball_arc); diff --git a/panda/src/testbed/shader_test.cxx b/panda/src/testbed/shader_test.cxx index dc9160ca8c..79d1582509 100644 --- a/panda/src/testbed/shader_test.cxx +++ b/panda/src/testbed/shader_test.cxx @@ -172,7 +172,7 @@ void Viztex::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 256); override.setField(ChanCfgOverrides::SizeY, 256); @@ -188,7 +188,7 @@ void Viztex::Flush(void) { GraphicsStateGuardian* g = w->get_gsg(); const RenderBuffer& r = g->get_render_buffer(RenderBuffer::T_front); PT(DisplayRegion) d(w->make_scratch_display_region(w->get_width(), - w->get_height())); + w->get_height())); // g->prepare_display_region(d); (*i)->draw(g, d, r); } @@ -199,7 +199,7 @@ void Viztex::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 256); override.setField(ChanCfgOverrides::SizeY, 256); @@ -215,7 +215,7 @@ void Viztex::Flush(void) { GraphicsStateGuardian* g = w->get_gsg(); const RenderBuffer& r = g->get_render_buffer(RenderBuffer::T_front); PT(DisplayRegion) d(w->make_scratch_display_region(w->get_width(), - w->get_height())); + w->get_height())); // g->prepare_display_region(d); (*j)->draw(g, d, r); } @@ -263,7 +263,7 @@ void Tiledviz::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 512); override.setField(ChanCfgOverrides::SizeY, 512); @@ -287,7 +287,7 @@ void Tiledviz::Flush(void) { //JMC: Added call to get_dr #ifdef SHADER_VERBOSE indent(nout, _level) << "Getting display region " << count - << " from graphics layer" << endl; + << " from graphics layer" << endl; #endif d = layer->get_dr(count); (*texi)->draw(g, d, r); @@ -314,7 +314,7 @@ void Tiledviz::Flush(void) { ChanCfgOverrides override; override.setField(ChanCfgOverrides::Mask, - ((unsigned int)(W_SINGLE))); + ((unsigned int)(W_SINGLE))); override.setField(ChanCfgOverrides::Title, "Multipass partial"); override.setField(ChanCfgOverrides::SizeX, 512); override.setField(ChanCfgOverrides::SizeY, 512); @@ -546,7 +546,7 @@ void shader_keys(EventHandler &eh) { #ifdef DISPLAY_TEXPROJFRUST // Display a wireframe representation of the texture projector frustum GeomLine* proj_geom = - (GeomLine *)tex_proj->get_projection()->make_geometry(); + (GeomLine *)tex_proj->get_projection()->make_geometry(); GeomNode* proj_geom_node = new GeomNode("proj_geometry"); //JMC: Removed _drawable_vector.push_back call and added add_geom //call @@ -586,7 +586,7 @@ void shader_keys(EventHandler &eh) { // Display a wireframe representation of the spotlight frustum Colorf color_red(1., 0., 0., 1.); GeomLine* frust_geom = - (GeomLine *)tex_proj_spot->get_projection()->make_geometry(color_red); + (GeomLine *)tex_proj_spot->get_projection()->make_geometry(color_red); GeomNode* frust_geom_node = new GeomNode("frustum_geometry"); //JMC: Removed _drawable_vector.push_back call and added add_geom //call diff --git a/panda/src/testbed/test_eggWrite.cxx b/panda/src/testbed/test_eggWrite.cxx index 29e2f2b5af..f38e04bb78 100644 --- a/panda/src/testbed/test_eggWrite.cxx +++ b/panda/src/testbed/test_eggWrite.cxx @@ -41,10 +41,10 @@ public: // int num_geoms = geomNode->get_num_geoms(); // for (int i = 0; i < num_geoms; i++) // { -// dDrawable *draw = geomNode->get_geom(i); -// Geom *geom = DCAST(Geom, draw); -// indent(nout, _indent_level+1) << *geom << ":\n"; -// geom->output_verbose(nout); +// dDrawable *draw = geomNode->get_geom(i); +// Geom *geom = DCAST(Geom, draw); +// indent(nout, _indent_level+1) << *geom << ":\n"; +// geom->output_verbose(nout); // } // } return true; @@ -83,9 +83,9 @@ int main(int argc, char* argv[]) { nout << "\n"; PrintNodes pn; df_traverse(smiley, pn, - NodeAttributeWrapper(TransformTransition::get_class_type()), - NullLevelState(), - RenderRelation::get_class_type()); + NodeAttributeWrapper(TransformTransition::get_class_type()), + NullLevelState(), + RenderRelation::get_class_type()); nout << "\n"; stream.open(file::FILE_WRITE, _bam_header); diff --git a/panda/src/testbed/test_recparticles.cxx b/panda/src/testbed/test_recparticles.cxx index 689b7dc34a..57f8145642 100644 --- a/panda/src/testbed/test_recparticles.cxx +++ b/panda/src/testbed/test_recparticles.cxx @@ -69,7 +69,7 @@ event_add_particles(CPT_Event) { fireworks_factory->set_lifespan_base(1.5f); fireworks_factory->set_lifespan_delta(0.5f); fireworks_emitter->set_endpoints(LPoint3f(-2.0f, 0.0f, 0.0f), - LPoint3f(2.0f, 0.0f, 0.0f)); + LPoint3f(2.0f, 0.0f, 0.0f)); fireworks_emitter->set_launch_vec(LVector3f(0.0f, 0.0f, 1.0f)); fireworks_renderer->set_point_size(4.0f); fireworks_renderer->set_color1(Colorf(1, 1, 1, 1)); diff --git a/panda/src/testbed/text_test.cxx b/panda/src/testbed/text_test.cxx index 085101b4a0..5ddf72e540 100644 --- a/panda/src/testbed/text_test.cxx +++ b/panda/src/testbed/text_test.cxx @@ -59,9 +59,9 @@ void text_keys(EventHandler& eh) { int main(int argc, char *argv[]) { define_keys = &text_keys; - if (argc > 1) - textStr = argv[1]; - else - textStr = argv[0]; + if (argc > 1) + textStr = argv[1]; + else + textStr = argv[0]; return framework_main(argc, argv); } diff --git a/panda/src/text/textFont.cxx b/panda/src/text/textFont.cxx index 27fe3ae627..36acecc73a 100644 --- a/panda/src/text/textFont.cxx +++ b/panda/src/text/textFont.cxx @@ -139,7 +139,7 @@ wordwrap_to(const string &text, float wordwrap_width) const { float width = 0.0; while (q < text.length() && text[q] != '\n' && width <= wordwrap_width) { if (isspace(text[q])) { - any_spaces = true; + any_spaces = true; } width += calc_width(text[q]); @@ -151,7 +151,7 @@ wordwrap_to(const string &text, float wordwrap_width) const { // back up to the end of the last complete word. while (q > p && !isspace(text[q])) { - q--; + q--; } } @@ -172,7 +172,7 @@ wordwrap_to(const string &text, float wordwrap_width) const { q++; next_start++; while (next_start < text.length() && isblank(text[next_start])) { - next_start++; + next_start++; } } @@ -224,7 +224,7 @@ write(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// bool TextFont:: find_character_gsets(Node *root, Geom *&ch, GeomPoint *&dot, - AllTransitionsWrapper &trans) { + AllTransitionsWrapper &trans) { if (root->is_of_type(GeomNode::get_class_type())) { GeomNode *geode = (GeomNode *)root; @@ -232,11 +232,11 @@ find_character_gsets(Node *root, Geom *&ch, GeomPoint *&dot, for (int i = 0; i < geode->get_num_geoms(); i++) { dDrawable *geom = geode->get_geom(i); if (geom->is_of_type(GeomPoint::get_class_type())) { - dot = DCAST(GeomPoint, geom); - + dot = DCAST(GeomPoint, geom); + } else if (geom->is_of_type(Geom::get_class_type())) { - ch = DCAST(Geom, geom); - found = true; + ch = DCAST(Geom, geom); + found = true; } } return found; @@ -247,7 +247,7 @@ find_character_gsets(Node *root, Geom *&ch, GeomPoint *&dot, for (int i = 0; i < num_children; i++) { NodeRelation *child_arc = root->get_child(graph_type, i); if (find_character_gsets(child_arc->get_child(), ch, dot, trans)) { - trans.extract_from(child_arc); + trans.extract_from(child_arc); } } return false; @@ -294,9 +294,9 @@ find_characters(Node *root) { float width; dot->get_coords(alist, bind, ilist); if (ilist.empty()) { - width = alist[0][0]; + width = alist[0][0]; } else { - width = alist[ilist[0]][0]; + width = alist[ilist[0]][0]; } _defs[character] = CharDef(ch, width, trans); @@ -318,9 +318,9 @@ find_characters(Node *root) { GeomBindType bind; dot->get_coords(alist, bind, ilist); if (ilist.empty()) { - _font_height = alist[0][2]; + _font_height = alist[0][2]; } else { - _font_height = alist[ilist[0]][2]; + _font_height = alist[ilist[0]][2]; } } diff --git a/panda/src/text/textFont.h b/panda/src/text/textFont.h index b96e508335..ae562e7781 100644 --- a/panda/src/text/textFont.h +++ b/panda/src/text/textFont.h @@ -53,7 +53,7 @@ private: private: bool find_character_gsets(Node *root, Geom *&ch, GeomPoint *&dot, - AllTransitionsWrapper &trans); + AllTransitionsWrapper &trans); void find_characters(Node *root); typedef map CharDefs; @@ -68,7 +68,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "TextFont", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/text/textNode.I b/panda/src/text/textNode.I index 4aa16a1beb..83872dc51b 100644 --- a/panda/src/text/textNode.I +++ b/panda/src/text/textNode.I @@ -556,9 +556,9 @@ get_frame_actual() const { nassertr(has_frame(), LVecBase4f(0.0, 0.0, 0.0, 0.0)); if (is_frame_as_margin()) { return LVecBase4f(get_left() - _frame_ul[0], - get_right() + _frame_lr[0], - get_bottom() - _frame_lr[1], - get_top() + _frame_ul[1]); + get_right() + _frame_lr[0], + get_bottom() - _frame_lr[1], + get_top() + _frame_ul[1]); } else { return get_frame_as_set(); } @@ -725,9 +725,9 @@ get_card_actual() const { } else if (is_card_as_margin()) { return LVecBase4f(get_left() - _card_ul[0], - get_right() + _card_lr[0], - get_bottom() - _card_lr[1], - get_top() + _card_ul[1]); + get_right() + _card_lr[0], + get_bottom() - _card_lr[1], + get_top() + _card_ul[1]); } else { return get_card_as_set(); } diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index ed40ac1531..ed7af0f908 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -126,15 +126,15 @@ write(ostream &out, int indent_level) const { << get_frame_as_set() << " line width " << _frame_width << "\n"; if (get_frame_corners()) { indent(out, indent_level + 2) - << "frame corners are enabled\n"; + << "frame corners are enabled\n"; } if (is_frame_as_margin()) { indent(out, indent_level + 2) - << "frame coordinates are specified as margin; actual frame is:\n" - << get_frame_actual() << "\n"; + << "frame coordinates are specified as margin; actual frame is:\n" + << get_frame_actual() << "\n"; } else { indent(out, indent_level + 2) - << "frame coordinates are actual\n"; + << "frame coordinates are actual\n"; } } if (has_card()) { @@ -143,11 +143,11 @@ write(ostream &out, int indent_level) const { << get_card_as_set() << "\n"; if (is_card_as_margin()) { indent(out, indent_level + 2) - << "card coordinates are specified as margin; actual card is:\n" - << get_card_actual() << "\n"; + << "card coordinates are specified as margin; actual card is:\n" + << get_card_actual() << "\n"; } else { indent(out, indent_level + 2) - << "card coordinates are actual\n"; + << "card coordinates are actual\n"; } } if (has_shadow()) { @@ -246,7 +246,7 @@ generate() { text_arc->set_transition(new ColorTransition(_text_color)); if (_text_color[3] != 1.0) { text_arc->set_transition - (new TransparencyTransition(TransparencyProperty::M_alpha)); + (new TransparencyTransition(TransparencyProperty::M_alpha)); } } @@ -285,12 +285,12 @@ generate() { if (_shadow_color[3] != 1.0) { shadow_arc->set_transition - (new TransparencyTransition(TransparencyProperty::M_alpha)); + (new TransparencyTransition(TransparencyProperty::M_alpha)); } if (has_bin()) { shadow_arc->set_transition - (new GeomBinTransition(_bin, _draw_order + 1)); + (new GeomBinTransition(_bin, _draw_order + 1)); } } @@ -301,12 +301,12 @@ generate() { frame_arc->set_transition(new ColorTransition(_frame_color)); if (_frame_color[3] != 1.0) { frame_arc->set_transition - (new TransparencyTransition(TransparencyProperty::M_alpha)); + (new TransparencyTransition(TransparencyProperty::M_alpha)); } if (has_bin()) { frame_arc->set_transition - (new GeomBinTransition(_bin, _draw_order + 1)); + (new GeomBinTransition(_bin, _draw_order + 1)); } } @@ -321,7 +321,7 @@ generate() { card_arc->set_transition(new ColorTransition(_card_color)); if (_card_color[3] != 1.0) { card_arc->set_transition - (new TransparencyTransition(TransparencyProperty::M_alpha)); + (new TransparencyTransition(TransparencyProperty::M_alpha)); } if (has_card_texture()) { card_arc->set_transition(new TextureTransition(_card_texture)); @@ -329,7 +329,7 @@ generate() { if (has_bin()) { card_arc->set_transition - (new GeomBinTransition(_bin, _draw_order)); + (new GeomBinTransition(_bin, _draw_order)); } } @@ -440,26 +440,26 @@ assemble_row(const char *&source, Node *dest) { const TextFont::CharDef *def = _font->get_char(character); if (def == (const TextFont::CharDef *)NULL) { - text_cat.warning() - << "No definition for character " << character << endl; + text_cat.warning() + << "No definition for character " << character << endl; } else { - Geom *char_geom = def->_geom; - float char_width = def->_width; - const AllTransitionsWrapper &trans = def->_trans; - - LMatrix4f mat = LMatrix4f::ident_mat(); + Geom *char_geom = def->_geom; + float char_width = def->_width; + const AllTransitionsWrapper &trans = def->_trans; + + LMatrix4f mat = LMatrix4f::ident_mat(); mat.set_row(3, LVector3f(xpos, 0, 0)); - if (char_geom != NULL) { - string ch(1, (char)character); - GeomNode *geode = new GeomNode(ch); - geode->add_geom(char_geom); - RenderRelation* rel = new RenderRelation(dest, geode); - rel->set_transition(new TransformTransition(mat)); - trans.store_to(rel); - } - - xpos += char_width; + if (char_geom != NULL) { + string ch(1, (char)character); + GeomNode *geode = new GeomNode(ch); + geode->add_geom(char_geom); + RenderRelation* rel = new RenderRelation(dest, geode); + rel->set_transition(new TransformTransition(mat)); + trans.store_to(rel); + } + + xpos += char_width; } } source++; @@ -477,7 +477,7 @@ assemble_row(const char *&source, Node *dest) { //////////////////////////////////////////////////////////////////// Node *TextNode:: assemble_text(const char *source, LVector2f &ul, LVector2f &lr, - int &num_rows) { + int &num_rows) { nassertr(_font != (TextFont *)NULL, (Node *)NULL); float line_height = get_line_height(); @@ -520,9 +520,9 @@ assemble_text(const char *source, LVector2f &ul, LVector2f &lr, // row. This is an X shear. if (_slant != 0.0) { LMatrix4f shear(1, 0, 0, 0, - 0, 1, 0, 0, - _slant, 0, 1, 0, - 0, 0, 0, 1); + 0, 1, 0, 0, + _slant, 0, 1, 0, + 0, 0, 0, 1); mat = shear * mat; } @@ -560,12 +560,12 @@ measure_row(const char *&source) { const TextFont::CharDef *def = _font->get_char(character); if (def == (const TextFont::CharDef *)NULL) { - text_cat.warning() - << "No definition for character " << character << endl; + text_cat.warning() + << "No definition for character " << character << endl; } else { - float char_width = def->_width; - xpos += char_width; + float char_width = def->_width; + xpos += char_width; } } source++; @@ -582,7 +582,7 @@ measure_row(const char *&source) { //////////////////////////////////////////////////////////////////// void TextNode:: measure_text(const char *source, LVector2f &ul, LVector2f &lr, - int &num_rows) { + int &num_rows) { nassertv(_font != (TextFont *)NULL); float line_height = get_line_height(); @@ -741,22 +741,22 @@ make_card_with_border() { verts.push_back(Vertexf::rfu(left, 0.02, top - _card_border_size)); verts.push_back(Vertexf::rfu(left + _card_border_size, 0.02, top)); verts.push_back(Vertexf::rfu(left + _card_border_size, 0.02, - top - _card_border_size)); + top - _card_border_size)); // verts 5,6,7,8 verts.push_back(Vertexf::rfu(right - _card_border_size, 0.02, top)); verts.push_back(Vertexf::rfu(right - _card_border_size, 0.02, - top - _card_border_size)); + top - _card_border_size)); verts.push_back(Vertexf::rfu(right, 0.02, top)); verts.push_back(Vertexf::rfu(right, 0.02, top - _card_border_size)); // verts 9,10,11,12 verts.push_back(Vertexf::rfu(left, 0.02, bottom + _card_border_size)); verts.push_back(Vertexf::rfu(left, 0.02, bottom)); verts.push_back(Vertexf::rfu(left + _card_border_size, 0.02, - bottom + _card_border_size)); + bottom + _card_border_size)); verts.push_back(Vertexf::rfu(left + _card_border_size, 0.02, bottom)); // verts 13,14,15,16 verts.push_back(Vertexf::rfu(right - _card_border_size, 0.02, - bottom + _card_border_size)); + bottom + _card_border_size)); verts.push_back(Vertexf::rfu(right - _card_border_size, 0.02, bottom)); verts.push_back(Vertexf::rfu(right, 0.02, bottom + _card_border_size)); verts.push_back(Vertexf::rfu(right, 0.02, bottom)); diff --git a/panda/src/text/textNode.h b/panda/src/text/textNode.h index 452fabc502..3e0d3ae88d 100644 --- a/panda/src/text/textNode.h +++ b/panda/src/text/textNode.h @@ -93,9 +93,9 @@ PUBLISHED: INLINE Colorf get_shadow_color() const; INLINE void set_frame_as_margin(float left, float right, - float bottom, float top); + float bottom, float top); INLINE void set_frame_actual(float left, float right, - float bottom, float top); + float bottom, float top); INLINE void clear_frame(); INLINE bool has_frame() const; INLINE bool is_frame_as_margin() const; @@ -108,9 +108,9 @@ PUBLISHED: INLINE bool get_frame_corners() const; INLINE void set_card_as_margin(float left, float right, - float bottom, float top); + float bottom, float top); INLINE void set_card_actual(float left, float right, - float bottom, float top); + float bottom, float top); INLINE void clear_card(); INLINE bool has_card() const; INLINE bool is_card_as_margin() const; @@ -173,10 +173,10 @@ private: float assemble_row(const char *&source, Node *dest); Node *assemble_text(const char *source, LVector2f &ul, LVector2f &lr, - int &num_rows); + int &num_rows); float measure_row(const char *&source); void measure_text(const char *source, LVector2f &ul, LVector2f &lr, - int &num_rows); + int &num_rows); Node *make_frame(); Node *make_card(); @@ -238,7 +238,7 @@ public: static void init_type() { NamedNode::init_type(); register_type(_type_handle, "TextNode", - NamedNode::get_class_type()); + NamedNode::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/tform/buttonThrower.cxx b/panda/src/tform/buttonThrower.cxx index 4c78650721..e6dc36ac95 100644 --- a/panda/src/tform/buttonThrower.cxx +++ b/panda/src/tform/buttonThrower.cxx @@ -116,23 +116,23 @@ transmit_data(NodeAttributes &data) { const ButtonEvent &be = (*bi); string event_name = _prefix + be._button.get_name(); if (be._down) { - if (!_mods.button_down(be._button)) { - // We only prepend modifier names on the button-down events, - // and only for buttons which are not themselves modifiers. - string prepend; - - for (int i = 0; i < _mods.get_num_buttons(); i++) { - ButtonHandle modifier = _mods.get_button(i); - if (_mods.is_down(modifier)) { - prepend += modifier.get_name() + "-"; - } - } - event_name = prepend + event_name; - } + if (!_mods.button_down(be._button)) { + // We only prepend modifier names on the button-down events, + // and only for buttons which are not themselves modifiers. + string prepend; + + for (int i = 0; i < _mods.get_num_buttons(); i++) { + ButtonHandle modifier = _mods.get_button(i); + if (_mods.is_down(modifier)) { + prepend += modifier.get_name() + "-"; + } + } + event_name = prepend + event_name; + } } else { - _mods.button_up(be._button); - event_name += "-up"; + _mods.button_up(be._button); + event_name += "-up"; } throw_event(event_name); @@ -152,9 +152,9 @@ void ButtonThrower:: init_type() { DataNode::init_type(); register_type(_type_handle, "ButtonThrower", - DataNode::get_class_type()); + DataNode::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/tform/dataValve.cxx b/panda/src/tform/dataValve.cxx index 4e2a9df49d..b2c9845534 100644 --- a/panda/src/tform/dataValve.cxx +++ b/panda/src/tform/dataValve.cxx @@ -243,21 +243,21 @@ write(ostream &out, int indent_level) const { if (has_control(i)) { const Child &child = _controls[i]; indent(out, indent_level + 2) - << "Child " << i << ": "; + << "Child " << i << ": "; if (child._control.is_null()) { - out << "(default)"; + out << "(default)"; } else { - out << *child._control; + out << *child._control; } out << "\n"; FineControls::const_iterator fci; for (fci = child._fine_controls.begin(); - fci != child._fine_controls.end(); - ++fci) { - indent(out, indent_level + 4) - << (*fci).first << " " << *(*fci).second; + fci != child._fine_controls.end(); + ++fci) { + indent(out, indent_level + 4) + << (*fci).first << " " << *(*fci).second; } } } @@ -333,12 +333,12 @@ transmit_data_per_child(NodeAttributes &data, int child_index) { // type explicitly "off" should be yanked. FineControls::const_iterator fci; for (fci = fine_controls->begin(); fci != fine_controls->end(); ++fci) { - TypeHandle data_type = (*fci).first; - Control *fcontrol = (*fci).second; + TypeHandle data_type = (*fci).first; + Control *fcontrol = (*fci).second; - if (!fcontrol->is_on(*this)) { - data.clear_attribute(data_type); - } + if (!fcontrol->is_on(*this)) { + data.clear_attribute(data_type); + } } } @@ -355,15 +355,15 @@ transmit_data_per_child(NodeAttributes &data, int child_index) { FineControls::const_iterator fci; for (fci = fine_controls->begin(); fci != fine_controls->end(); ++fci) { - TypeHandle data_type = (*fci).first; - Control *fcontrol = (*fci).second; + TypeHandle data_type = (*fci).first; + Control *fcontrol = (*fci).second; - if (fcontrol->is_on(*this)) { - NodeAttribute *attrib = data.get_attribute(data_type); - if (attrib != (NodeAttribute *)NULL) { - temp.set_attribute(data_type, attrib); - } - } + if (fcontrol->is_on(*this)) { + NodeAttribute *attrib = data.get_attribute(data_type); + if (attrib != (NodeAttribute *)NULL) { + temp.set_attribute(data_type, attrib); + } + } } data = temp; @@ -381,9 +381,9 @@ void DataValve:: init_type() { DataNode::init_type(); register_type(_type_handle, "DataValve", - DataNode::get_class_type()); + DataNode::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index 5ed6662792..bf1ba3597a 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -238,15 +238,15 @@ apply(double x, double y, bool any_button) { // Motion is forward. Compute the throttle value: the ratio of // the mouse pointer within the range of vertical movement. float throttle = - (min(y, 1.0) - dead_zone_top) / - (1.0 - dead_zone_top); + (min(y, 1.0) - dead_zone_top) / + (1.0 - dead_zone_top); _speed = throttle * _forward_speed; } else if (y <= dead_zone_bottom) { // Motion is backward. float throttle = - (max(y, -1.0) - dead_zone_bottom) / - (-1.0 - dead_zone_bottom); + (max(y, -1.0) - dead_zone_bottom) / + (-1.0 - dead_zone_bottom); _speed = -throttle * _reverse_speed; } @@ -261,15 +261,15 @@ apply(double x, double y, bool any_button) { // ratio of the mouse pointer within the range of horizontal // movement. float throttle = - (min(x, 1.0) - dead_zone_right) / - (1.0 - dead_zone_right); + (min(x, 1.0) - dead_zone_right) / + (1.0 - dead_zone_right); _rot_speed = throttle * _rotate_speed; } else if (x <= dead_zone_left) { // Rotation is to the left. float throttle = - (max(x, -1.0) - dead_zone_left) / - (-1.0 - dead_zone_left); + (max(x, -1.0) - dead_zone_left) / + (-1.0 - dead_zone_left); _rot_speed = -throttle * _rotate_speed; } @@ -282,13 +282,13 @@ apply(double x, double y, bool any_button) { if (_up_arrow < _down_arrow) { throttle = _up_arrow.get_effect(_vertical_ramp_up_time, - _vertical_ramp_down_time); + _vertical_ramp_down_time); _speed = throttle * _forward_speed; _down_arrow._effect = 0.0; } else { throttle = _down_arrow.get_effect(_vertical_ramp_up_time, - _vertical_ramp_down_time); + _vertical_ramp_down_time); _speed = -throttle * _reverse_speed; _up_arrow._effect = 0.0; } @@ -296,13 +296,13 @@ apply(double x, double y, bool any_button) { // Which horizontal arrow key changed state more recently? if (_right_arrow < _left_arrow) { throttle = _right_arrow.get_effect(_horizontal_ramp_up_time, - _horizontal_ramp_down_time); + _horizontal_ramp_down_time); _rot_speed = throttle * _rotate_speed; _left_arrow._effect = 0.0; } else { throttle = _left_arrow.get_effect(_horizontal_ramp_up_time, - _horizontal_ramp_down_time); + _horizontal_ramp_down_time); _rot_speed = -throttle * _rotate_speed; _right_arrow._effect = 0.0; } @@ -419,26 +419,26 @@ transmit_data(NodeAttributes &data) { for (bi = b->begin(); bi != b->end(); ++bi) { const ButtonEvent &be = (*bi); if (be._down) { - // We only trap button down events if (a) the mouse is in the - // window, and (b) we aren't set to ignore the mouse. - if (got_mouse && !_ignore_mouse) { - _mods.add_event(be); - } + // We only trap button down events if (a) the mouse is in the + // window, and (b) we aren't set to ignore the mouse. + if (got_mouse && !_ignore_mouse) { + _mods.add_event(be); + } } else { - // However, we always trap button up events, so we don't get - // confused and believe a button is still being held down when - // it is not. - _mods.add_event(be); + // However, we always trap button up events, so we don't get + // confused and believe a button is still being held down when + // it is not. + _mods.add_event(be); } if (be._button == KeyboardButton::up()) { - _up_arrow.set_key(be._down); + _up_arrow.set_key(be._down); } else if (be._button == KeyboardButton::down()) { - _down_arrow.set_key(be._down); + _down_arrow.set_key(be._down); } else if (be._button == KeyboardButton::left()) { - _left_arrow.set_key(be._down); + _left_arrow.set_key(be._down); } else if (be._button == KeyboardButton::right()) { - _right_arrow.set_key(be._down); + _right_arrow.set_key(be._down); } } } @@ -460,15 +460,15 @@ void DriveInterface:: init_type() { DataNode::init_type(); register_type(_type_handle, "DriveInterface", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "XYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); MatrixDataTransition::init_type(); register_data_transition(_transform_type, "Transform", - MatrixDataTransition::get_class_type()); + MatrixDataTransition::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 30608f502f..8aca59d355 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -127,13 +127,13 @@ get_over_region(const LPoint2f &pos) const { const LVecBase4f &frame = region->get_frame(); if (region->get_active() && - pos[0] >= frame[0] && pos[0] <= frame[1] && - pos[1] >= frame[2] && pos[1] <= frame[3]) { + pos[0] >= frame[0] && pos[0] <= frame[1] && + pos[1] >= frame[2] && pos[1] <= frame[3]) { // We're over this region. Is it preferred to the other one? if (over_region == (MouseWatcherRegion *)NULL || - *region < *over_region) { - over_region = region; + *region < *over_region) { + over_region = region; } } } @@ -202,7 +202,7 @@ set_current_region(MouseWatcherRegion *region) { //////////////////////////////////////////////////////////////////// void MouseWatcher:: throw_event_pattern(const string &pattern, const MouseWatcherRegion *region, - const string &button_name) { + const string &button_name) { if (pattern.empty()) { return; } @@ -216,16 +216,16 @@ throw_event_pattern(const string &pattern, const MouseWatcherRegion *region, string cmd = pattern.substr(p + 1, 1); p++; if (cmd == "r") { - if (region != (MouseWatcherRegion *)NULL) { - event += region->get_name(); - } + if (region != (MouseWatcherRegion *)NULL) { + event += region->get_name(); + } } else if (cmd == "b") { - event += button_name; + event += button_name; } else { - tform_cat.error() - << "Invalid symbol in event_pattern: %" << cmd << "\n"; + tform_cat.error() + << "Invalid symbol in event_pattern: %" << cmd << "\n"; } } else { event += pattern[p]; @@ -236,7 +236,7 @@ throw_event_pattern(const string &pattern, const MouseWatcherRegion *region, throw_event(event, EventParameter(region), EventParameter(button_name)); if (_eh != (EventHandler*)0L) throw_event_directly(*_eh, event, EventParameter(region), - EventParameter(button_name)); + EventParameter(button_name)); } } @@ -253,7 +253,7 @@ transmit_data(NodeAttributes &data) { if (_has_mouse) { // Hide the mouse pointer. if (!_geometry.is_null()) { - _geometry->set_transition(new PruneTransition); + _geometry->set_transition(new PruneTransition); } } @@ -304,35 +304,35 @@ transmit_data(NodeAttributes &data) { const ButtonEvent &be = (*bi); if (!be._down) { - // Button up. Send the up event associated with the region we - // were over when the button went down. + // Button up. Send the up event associated with the region we + // were over when the button went down. - // There is some danger of losing button-up events here. If - // more than one button goes down together, we won't detect - // both of the button-up events properly. + // There is some danger of losing button-up events here. If + // more than one button goes down together, we won't detect + // both of the button-up events properly. + + // We should probably throw a different button_up event based + // on whether the _current_region is NULL or not, so the + // calling code can differentiate between button_up within the + // starting region, and button_up outside the region. + // Presently, changing this will break the GUI code. + if (_button_down_region != (MouseWatcherRegion *)NULL) { + throw_event_pattern(_button_up_pattern, _button_down_region, + be._button.get_name()); + } + _button_down = false; - // We should probably throw a different button_up event based - // on whether the _current_region is NULL or not, so the - // calling code can differentiate between button_up within the - // starting region, and button_up outside the region. - // Presently, changing this will break the GUI code. - if (_button_down_region != (MouseWatcherRegion *)NULL) { - throw_event_pattern(_button_up_pattern, _button_down_region, - be._button.get_name()); - } - _button_down = false; - } else { - // Button down. + // Button down. - if (!_button_down) { - _button_down_region = _current_region; - } - _button_down = true; - if (_button_down_region != (MouseWatcherRegion *)NULL) { - throw_event_pattern(_button_down_pattern, _button_down_region, - be._button.get_name()); - } + if (!_button_down) { + _button_down_region = _current_region; + } + _button_down = true; + if (_button_down_region != (MouseWatcherRegion *)NULL) { + throw_event_pattern(_button_down_pattern, _button_down_region, + be._button.get_name()); + } } } } @@ -362,14 +362,14 @@ void MouseWatcher:: init_type() { DataNode::init_type(); register_type(_type_handle, "MouseWatcher", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "XYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); register_data_transition(_pixel_xyz_type, "PixelXYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/tform/mouseWatcher.h b/panda/src/tform/mouseWatcher.h index c2e7a20c42..461ac6c540 100644 --- a/panda/src/tform/mouseWatcher.h +++ b/panda/src/tform/mouseWatcher.h @@ -89,8 +89,8 @@ public: private: void set_current_region(MouseWatcherRegion *region); void throw_event_pattern(const string &pattern, - const MouseWatcherRegion *region, - const string &button_name = string()); + const MouseWatcherRegion *region, + const string &button_name = string()); typedef set< PT(MouseWatcherRegion) > Regions; Regions _regions; diff --git a/panda/src/tform/mouseWatcherRegion.I b/panda/src/tform/mouseWatcherRegion.I index 48ee449aa6..226a01c549 100644 --- a/panda/src/tform/mouseWatcherRegion.I +++ b/panda/src/tform/mouseWatcherRegion.I @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////// INLINE MouseWatcherRegion:: MouseWatcherRegion(const string &name, float left, float right, - float bottom, float top) : + float bottom, float top) : Namable(name), _frame(left, right, bottom, top) { diff --git a/panda/src/tform/mouseWatcherRegion.h b/panda/src/tform/mouseWatcherRegion.h index 41391718a5..23f12906a3 100644 --- a/panda/src/tform/mouseWatcherRegion.h +++ b/panda/src/tform/mouseWatcherRegion.h @@ -20,7 +20,7 @@ class EXPCL_PANDA MouseWatcherRegion : public TypedReferenceCount, public Namable { PUBLISHED: INLINE MouseWatcherRegion(const string &name, float left, float right, - float bottom, float top); + float bottom, float top); INLINE MouseWatcherRegion(const string &name, const LVecBase4f &frame); INLINE void set_frame(float left, float right, float bottom, float top); @@ -59,8 +59,8 @@ public: TypedReferenceCount::init_type(); Namable::init_type(); register_type(_type_handle, "MouseWatcherRegion", - TypedReferenceCount::get_class_type(), - Namable::get_class_type()); + TypedReferenceCount::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/tform/planarSlider.cxx b/panda/src/tform/planarSlider.cxx index 66cfe717be..5ac8b78a5a 100644 --- a/panda/src/tform/planarSlider.cxx +++ b/panda/src/tform/planarSlider.cxx @@ -118,14 +118,14 @@ get_transform() const { void PlanarSlider:: set_mouse_pos(const LPoint2f &mouse_pos) { _mouse_pos.set(max(min(mouse_pos[0], 1.0f), -1.0f), - max(min(mouse_pos[1], 1.0f), -1.0f)); + max(min(mouse_pos[1], 1.0f), -1.0f)); LMatrix4f mat = _inverse_mat * LMatrix4f::translate_mat(LVector3f::rfu(_mouse_pos[0], - _mouse_pos[1], - 0.0, - _cs)) * + _mouse_pos[1], + 0.0, + _cs)) * _transform_mat; _transform->set_value(mat); @@ -179,15 +179,15 @@ void PlanarSlider:: init_type() { DataNode::init_type(); register_type(_type_handle, "PlanarSlider", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_xyz_type, "XYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); MatrixDataTransition::init_type(); register_data_transition(_transform_type, "Transform", - MatrixDataTransition::get_class_type()); + MatrixDataTransition::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); } diff --git a/panda/src/tform/trackball.cxx b/panda/src/tform/trackball.cxx index 555fbede23..cffd82d942 100644 --- a/panda/src/tform/trackball.cxx +++ b/panda/src/tform/trackball.cxx @@ -395,7 +395,7 @@ apply(double x, double y, int button) { _rotation *= LMatrix4f::rotate_mat_normaxis((x - y) * _rotscale, - LVector3f::forward(_cs), _cs); + LVector3f::forward(_cs), _cs); } else if ((button == B2_MASK) || (button == (B1_MASK | B3_MASK))) { // Button 2, or buttons 1 + 3: rotate about the right and up @@ -519,15 +519,15 @@ void Trackball:: init_type() { DataNode::init_type(); register_type(_type_handle, "Trackball", - DataNode::get_class_type()); + DataNode::get_class_type()); Vec3DataTransition::init_type(); register_data_transition(_pixel_xyz_type, "PixelXYZ", - Vec3DataTransition::get_class_type()); + Vec3DataTransition::get_class_type()); ButtonEventDataTransition::init_type(); register_data_transition(_button_events_type, "ButtonEvents", - ButtonEventDataTransition::get_class_type()); + ButtonEventDataTransition::get_class_type()); MatrixDataTransition::init_type(); register_data_transition(_transform_type, "Transform", - MatrixDataTransition::get_class_type()); + MatrixDataTransition::get_class_type()); } diff --git a/panda/src/tform/transform2sg.cxx b/panda/src/tform/transform2sg.cxx index ca9be3e576..7ece0045a1 100644 --- a/panda/src/tform/transform2sg.cxx +++ b/panda/src/tform/transform2sg.cxx @@ -77,9 +77,9 @@ void Transform2SG:: init_type() { DataNode::init_type(); register_type(_type_handle, "Transform2SG", - DataNode::get_class_type()); + DataNode::get_class_type()); MatrixDataTransition::init_type(); register_data_transition(_transform_type, "Transform", - MatrixDataTransition::get_class_type()); + MatrixDataTransition::get_class_type()); } diff --git a/panda/src/tiff/g3states.h b/panda/src/tiff/g3states.h index 269b14d791..840867453e 100644 --- a/panda/src/tiff/g3states.h +++ b/panda/src/tiff/g3states.h @@ -1,53 +1,53 @@ /* DO NOT EDIT THIS FILE, IT WAS AUTOMATICALLY CREATED BY mkg3state */ -#define ACT_INCOMP 0 -#define ACT_INVALID 1 -#define ACT_WRUNT 2 -#define ACT_WRUN 65 -#define ACT_BRUNT 106 -#define ACT_BRUN 169 -#define ACT_EOL 210 +#define ACT_INCOMP 0 +#define ACT_INVALID 1 +#define ACT_WRUNT 2 +#define ACT_WRUN 65 +#define ACT_BRUNT 106 +#define ACT_BRUN 169 +#define ACT_EOL 210 /* modes that the decoder can be in */ -#define MODE_NULL 0 -#define MODE_PASS 1 -#define MODE_HORIZ 2 -#define MODE_VERT_V0 6 -#define MODE_VERT_VR1 7 -#define MODE_VERT_VR2 8 -#define MODE_VERT_VR3 9 -#define MODE_VERT_VL1 5 -#define MODE_VERT_VL2 4 -#define MODE_VERT_VL3 3 -#define MODE_UNCOMP 10 -#define MODE_ERROR 11 -#define MODE_ERROR_1 12 +#define MODE_NULL 0 +#define MODE_PASS 1 +#define MODE_HORIZ 2 +#define MODE_VERT_V0 6 +#define MODE_VERT_VR1 7 +#define MODE_VERT_VR2 8 +#define MODE_VERT_VR3 9 +#define MODE_VERT_VL1 5 +#define MODE_VERT_VL2 4 +#define MODE_VERT_VL3 3 +#define MODE_UNCOMP 10 +#define MODE_ERROR 11 +#define MODE_ERROR_1 12 -#define RUNLENGTH(ix) (TIFFFaxWhiteCodes[ix].runlen) +#define RUNLENGTH(ix) (TIFFFaxWhiteCodes[ix].runlen) -#define UNCOMP_INCOMP 0 +#define UNCOMP_INCOMP 0 /* runs of [0]*1 */ -#define UNCOMP_RUN0 1 -#define UNCOMP_RUN1 2 -#define UNCOMP_RUN2 3 -#define UNCOMP_RUN3 4 -#define UNCOMP_RUN4 5 -#define UNCOMP_RUN5 6 -#define UNCOMP_RUN6 7 +#define UNCOMP_RUN0 1 +#define UNCOMP_RUN1 2 +#define UNCOMP_RUN2 3 +#define UNCOMP_RUN3 4 +#define UNCOMP_RUN4 5 +#define UNCOMP_RUN5 6 +#define UNCOMP_RUN6 7 /* runs of [0]* w/ terminating color */ -#define UNCOMP_TRUN0 8 -#define UNCOMP_TRUN1 9 -#define UNCOMP_TRUN2 10 -#define UNCOMP_TRUN3 11 -#define UNCOMP_TRUN4 12 +#define UNCOMP_TRUN0 8 +#define UNCOMP_TRUN1 9 +#define UNCOMP_TRUN2 10 +#define UNCOMP_TRUN3 11 +#define UNCOMP_TRUN4 12 /* special code for unexpected EOF */ -#define UNCOMP_EOF 13 +#define UNCOMP_EOF 13 /* invalid code encountered */ -#define UNCOMP_INVALID 14 +#define UNCOMP_INVALID 14 /* codes >= terminate uncompress mode */ -#define UNCOMP_EXIT UNCOMP_TRUN0 +#define UNCOMP_EXIT UNCOMP_TRUN0 #ifdef G3STATES -const u_char TIFFFax2DMode[20][256] = {{ +const u_char TIFFFax2DMode[20][256] = {{ 12,12,11,0,3,3,9,9,4,4,4,4,8,8,8,8,1,1,1,1,1,1,1,1 ,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,5,5,5,5,5,5,5,5 @@ -269,7 +269,7 @@ const u_char TIFFFax2DMode[20][256] = {{ ,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10 ,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10} }; -const u_char TIFFFax2DNextState[20][256] = {{ +const u_char TIFFFax2DNextState[20][256] = {{ 7,7,0,8,7,7,7,7,6,6,6,6,6,6,6,6,4,4,4,4,4,4,4,4 ,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 @@ -491,7 +491,7 @@ const u_char TIFFFax2DNextState[20][256] = {{ ,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} }; -const u_char TIFFFaxUncompAction[20][256] = {{ +const u_char TIFFFaxUncompAction[20][256] = {{ 0,9,8,8,7,7,7,7,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5 ,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 ,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3 @@ -693,7 +693,7 @@ const u_char TIFFFaxUncompAction[20][256] = {{ 0},{ 0} }; -const u_char TIFFFaxUncompNextState[20][256] = {{ +const u_char TIFFFaxUncompNextState[20][256] = {{ 8,0,7,7,6,6,6,6,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4 ,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2 @@ -895,7 +895,7 @@ const u_char TIFFFaxUncompNextState[20][256] = {{ 0},{ 0} }; -const u_char TIFFFax1DAction[230][256] = {{ +const u_char TIFFFax1DAction[230][256] = {{ 0,0,31,32,47,48,24,24,25,25,49,50,15,15,15,15,22,22,35,36,37,38,39,40 ,21,21,33,34,3,3,3,3,14,14,14,14,55,56,28,28,41,42,43,44,45,46,23,23 ,30,30,63,64,65,2,70,71,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13 @@ -3387,7 +3387,7 @@ const u_char TIFFFax1DAction[230][256] = {{ ,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106 ,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106} }; -const u_char TIFFFax1DNextState[230][256] = {{ +const u_char TIFFFax1DNextState[230][256] = {{ 16,17,0,0,0,0,7,7,7,7,0,0,6,6,6,6,7,7,0,0,0,0,0,0 ,7,7,0,0,6,6,6,6,6,6,6,6,0,0,7,7,0,0,0,0,0,0,7,7 ,7,7,0,0,0,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 @@ -5905,10 +5905,10 @@ const u_char TIFFFax1DNextState[230][256] = {{ ,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} }; #else -extern const u_char TIFFFax2DMode[][256]; -extern const u_char TIFFFax2DNextState[][256]; -extern const u_char TIFFFaxUncompAction[][256]; -extern const u_char TIFFFaxUncompNextState[][256]; -extern const u_char TIFFFax1DAction[][256]; -extern const u_char TIFFFax1DNextState[][256]; +extern const u_char TIFFFax2DMode[][256]; +extern const u_char TIFFFax2DNextState[][256]; +extern const u_char TIFFFaxUncompAction[][256]; +extern const u_char TIFFFaxUncompNextState[][256]; +extern const u_char TIFFFax1DAction[][256]; +extern const u_char TIFFFax1DNextState[][256]; #endif diff --git a/panda/src/tiff/t4.h b/panda/src/tiff/t4.h index 22df8a120b..8ed4ed7d8d 100644 --- a/panda/src/tiff/t4.h +++ b/panda/src/tiff/t4.h @@ -25,7 +25,7 @@ */ #ifndef _T4_ -#define _T4_ +#define _T4_ /* * CCITT T.4 1D Huffman runlength codes and * related definitions. Given the small sizes @@ -33,18 +33,18 @@ * worthwhile to make code & length 8 bits. */ typedef struct tableentry { - unsigned short length; /* bit length of g3 code */ - unsigned short code; /* g3 code */ - short runlen; /* run length in bits */ + unsigned short length; /* bit length of g3 code */ + unsigned short code; /* g3 code */ + short runlen; /* run length in bits */ } tableentry; -#define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */ +#define EOL 0x001 /* EOL code value - 0000 0000 0000 1 */ /* status values returned instead of a run length */ -#define G3CODE_INVALID -1 -#define G3CODE_INCOMP -2 -#define G3CODE_EOL -3 -#define G3CODE_EOF -4 +#define G3CODE_INVALID -1 +#define G3CODE_INCOMP -2 +#define G3CODE_EOL -3 +#define G3CODE_EOF -4 /* * Note that these tables are ordered such that the @@ -56,230 +56,230 @@ typedef struct tableentry { */ #ifdef G3CODES const tableentry TIFFFaxWhiteCodes[] = { - { 8, 0x35, 0 }, /* 0011 0101 */ - { 6, 0x7, 1 }, /* 0001 11 */ - { 4, 0x7, 2 }, /* 0111 */ - { 4, 0x8, 3 }, /* 1000 */ - { 4, 0xB, 4 }, /* 1011 */ - { 4, 0xC, 5 }, /* 1100 */ - { 4, 0xE, 6 }, /* 1110 */ - { 4, 0xF, 7 }, /* 1111 */ - { 5, 0x13, 8 }, /* 1001 1 */ - { 5, 0x14, 9 }, /* 1010 0 */ - { 5, 0x7, 10 }, /* 0011 1 */ - { 5, 0x8, 11 }, /* 0100 0 */ - { 6, 0x8, 12 }, /* 0010 00 */ - { 6, 0x3, 13 }, /* 0000 11 */ - { 6, 0x34, 14 }, /* 1101 00 */ - { 6, 0x35, 15 }, /* 1101 01 */ - { 6, 0x2A, 16 }, /* 1010 10 */ - { 6, 0x2B, 17 }, /* 1010 11 */ - { 7, 0x27, 18 }, /* 0100 111 */ - { 7, 0xC, 19 }, /* 0001 100 */ - { 7, 0x8, 20 }, /* 0001 000 */ - { 7, 0x17, 21 }, /* 0010 111 */ - { 7, 0x3, 22 }, /* 0000 011 */ - { 7, 0x4, 23 }, /* 0000 100 */ - { 7, 0x28, 24 }, /* 0101 000 */ - { 7, 0x2B, 25 }, /* 0101 011 */ - { 7, 0x13, 26 }, /* 0010 011 */ - { 7, 0x24, 27 }, /* 0100 100 */ - { 7, 0x18, 28 }, /* 0011 000 */ - { 8, 0x2, 29 }, /* 0000 0010 */ - { 8, 0x3, 30 }, /* 0000 0011 */ - { 8, 0x1A, 31 }, /* 0001 1010 */ - { 8, 0x1B, 32 }, /* 0001 1011 */ - { 8, 0x12, 33 }, /* 0001 0010 */ - { 8, 0x13, 34 }, /* 0001 0011 */ - { 8, 0x14, 35 }, /* 0001 0100 */ - { 8, 0x15, 36 }, /* 0001 0101 */ - { 8, 0x16, 37 }, /* 0001 0110 */ - { 8, 0x17, 38 }, /* 0001 0111 */ - { 8, 0x28, 39 }, /* 0010 1000 */ - { 8, 0x29, 40 }, /* 0010 1001 */ - { 8, 0x2A, 41 }, /* 0010 1010 */ - { 8, 0x2B, 42 }, /* 0010 1011 */ - { 8, 0x2C, 43 }, /* 0010 1100 */ - { 8, 0x2D, 44 }, /* 0010 1101 */ - { 8, 0x4, 45 }, /* 0000 0100 */ - { 8, 0x5, 46 }, /* 0000 0101 */ - { 8, 0xA, 47 }, /* 0000 1010 */ - { 8, 0xB, 48 }, /* 0000 1011 */ - { 8, 0x52, 49 }, /* 0101 0010 */ - { 8, 0x53, 50 }, /* 0101 0011 */ - { 8, 0x54, 51 }, /* 0101 0100 */ - { 8, 0x55, 52 }, /* 0101 0101 */ - { 8, 0x24, 53 }, /* 0010 0100 */ - { 8, 0x25, 54 }, /* 0010 0101 */ - { 8, 0x58, 55 }, /* 0101 1000 */ - { 8, 0x59, 56 }, /* 0101 1001 */ - { 8, 0x5A, 57 }, /* 0101 1010 */ - { 8, 0x5B, 58 }, /* 0101 1011 */ - { 8, 0x4A, 59 }, /* 0100 1010 */ - { 8, 0x4B, 60 }, /* 0100 1011 */ - { 8, 0x32, 61 }, /* 0011 0010 */ - { 8, 0x33, 62 }, /* 0011 0011 */ - { 8, 0x34, 63 }, /* 0011 0100 */ - { 5, 0x1B, 64 }, /* 1101 1 */ - { 5, 0x12, 128 }, /* 1001 0 */ - { 6, 0x17, 192 }, /* 0101 11 */ - { 7, 0x37, 256 }, /* 0110 111 */ - { 8, 0x36, 320 }, /* 0011 0110 */ - { 8, 0x37, 384 }, /* 0011 0111 */ - { 8, 0x64, 448 }, /* 0110 0100 */ - { 8, 0x65, 512 }, /* 0110 0101 */ - { 8, 0x68, 576 }, /* 0110 1000 */ - { 8, 0x67, 640 }, /* 0110 0111 */ - { 9, 0xCC, 704 }, /* 0110 0110 0 */ - { 9, 0xCD, 768 }, /* 0110 0110 1 */ - { 9, 0xD2, 832 }, /* 0110 1001 0 */ - { 9, 0xD3, 896 }, /* 0110 1001 1 */ - { 9, 0xD4, 960 }, /* 0110 1010 0 */ - { 9, 0xD5, 1024 }, /* 0110 1010 1 */ - { 9, 0xD6, 1088 }, /* 0110 1011 0 */ - { 9, 0xD7, 1152 }, /* 0110 1011 1 */ - { 9, 0xD8, 1216 }, /* 0110 1100 0 */ - { 9, 0xD9, 1280 }, /* 0110 1100 1 */ - { 9, 0xDA, 1344 }, /* 0110 1101 0 */ - { 9, 0xDB, 1408 }, /* 0110 1101 1 */ - { 9, 0x98, 1472 }, /* 0100 1100 0 */ - { 9, 0x99, 1536 }, /* 0100 1100 1 */ - { 9, 0x9A, 1600 }, /* 0100 1101 0 */ - { 6, 0x18, 1664 }, /* 0110 00 */ - { 9, 0x9B, 1728 }, /* 0100 1101 1 */ - { 11, 0x8, 1792 }, /* 0000 0001 000 */ - { 11, 0xC, 1856 }, /* 0000 0001 100 */ - { 11, 0xD, 1920 }, /* 0000 0001 101 */ - { 12, 0x12, 1984 }, /* 0000 0001 0010 */ - { 12, 0x13, 2048 }, /* 0000 0001 0011 */ - { 12, 0x14, 2112 }, /* 0000 0001 0100 */ - { 12, 0x15, 2176 }, /* 0000 0001 0101 */ - { 12, 0x16, 2240 }, /* 0000 0001 0110 */ - { 12, 0x17, 2304 }, /* 0000 0001 0111 */ - { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ - { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ - { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ - { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ - { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ - { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ - { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ - { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ - { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ + { 8, 0x35, 0 }, /* 0011 0101 */ + { 6, 0x7, 1 }, /* 0001 11 */ + { 4, 0x7, 2 }, /* 0111 */ + { 4, 0x8, 3 }, /* 1000 */ + { 4, 0xB, 4 }, /* 1011 */ + { 4, 0xC, 5 }, /* 1100 */ + { 4, 0xE, 6 }, /* 1110 */ + { 4, 0xF, 7 }, /* 1111 */ + { 5, 0x13, 8 }, /* 1001 1 */ + { 5, 0x14, 9 }, /* 1010 0 */ + { 5, 0x7, 10 }, /* 0011 1 */ + { 5, 0x8, 11 }, /* 0100 0 */ + { 6, 0x8, 12 }, /* 0010 00 */ + { 6, 0x3, 13 }, /* 0000 11 */ + { 6, 0x34, 14 }, /* 1101 00 */ + { 6, 0x35, 15 }, /* 1101 01 */ + { 6, 0x2A, 16 }, /* 1010 10 */ + { 6, 0x2B, 17 }, /* 1010 11 */ + { 7, 0x27, 18 }, /* 0100 111 */ + { 7, 0xC, 19 }, /* 0001 100 */ + { 7, 0x8, 20 }, /* 0001 000 */ + { 7, 0x17, 21 }, /* 0010 111 */ + { 7, 0x3, 22 }, /* 0000 011 */ + { 7, 0x4, 23 }, /* 0000 100 */ + { 7, 0x28, 24 }, /* 0101 000 */ + { 7, 0x2B, 25 }, /* 0101 011 */ + { 7, 0x13, 26 }, /* 0010 011 */ + { 7, 0x24, 27 }, /* 0100 100 */ + { 7, 0x18, 28 }, /* 0011 000 */ + { 8, 0x2, 29 }, /* 0000 0010 */ + { 8, 0x3, 30 }, /* 0000 0011 */ + { 8, 0x1A, 31 }, /* 0001 1010 */ + { 8, 0x1B, 32 }, /* 0001 1011 */ + { 8, 0x12, 33 }, /* 0001 0010 */ + { 8, 0x13, 34 }, /* 0001 0011 */ + { 8, 0x14, 35 }, /* 0001 0100 */ + { 8, 0x15, 36 }, /* 0001 0101 */ + { 8, 0x16, 37 }, /* 0001 0110 */ + { 8, 0x17, 38 }, /* 0001 0111 */ + { 8, 0x28, 39 }, /* 0010 1000 */ + { 8, 0x29, 40 }, /* 0010 1001 */ + { 8, 0x2A, 41 }, /* 0010 1010 */ + { 8, 0x2B, 42 }, /* 0010 1011 */ + { 8, 0x2C, 43 }, /* 0010 1100 */ + { 8, 0x2D, 44 }, /* 0010 1101 */ + { 8, 0x4, 45 }, /* 0000 0100 */ + { 8, 0x5, 46 }, /* 0000 0101 */ + { 8, 0xA, 47 }, /* 0000 1010 */ + { 8, 0xB, 48 }, /* 0000 1011 */ + { 8, 0x52, 49 }, /* 0101 0010 */ + { 8, 0x53, 50 }, /* 0101 0011 */ + { 8, 0x54, 51 }, /* 0101 0100 */ + { 8, 0x55, 52 }, /* 0101 0101 */ + { 8, 0x24, 53 }, /* 0010 0100 */ + { 8, 0x25, 54 }, /* 0010 0101 */ + { 8, 0x58, 55 }, /* 0101 1000 */ + { 8, 0x59, 56 }, /* 0101 1001 */ + { 8, 0x5A, 57 }, /* 0101 1010 */ + { 8, 0x5B, 58 }, /* 0101 1011 */ + { 8, 0x4A, 59 }, /* 0100 1010 */ + { 8, 0x4B, 60 }, /* 0100 1011 */ + { 8, 0x32, 61 }, /* 0011 0010 */ + { 8, 0x33, 62 }, /* 0011 0011 */ + { 8, 0x34, 63 }, /* 0011 0100 */ + { 5, 0x1B, 64 }, /* 1101 1 */ + { 5, 0x12, 128 }, /* 1001 0 */ + { 6, 0x17, 192 }, /* 0101 11 */ + { 7, 0x37, 256 }, /* 0110 111 */ + { 8, 0x36, 320 }, /* 0011 0110 */ + { 8, 0x37, 384 }, /* 0011 0111 */ + { 8, 0x64, 448 }, /* 0110 0100 */ + { 8, 0x65, 512 }, /* 0110 0101 */ + { 8, 0x68, 576 }, /* 0110 1000 */ + { 8, 0x67, 640 }, /* 0110 0111 */ + { 9, 0xCC, 704 }, /* 0110 0110 0 */ + { 9, 0xCD, 768 }, /* 0110 0110 1 */ + { 9, 0xD2, 832 }, /* 0110 1001 0 */ + { 9, 0xD3, 896 }, /* 0110 1001 1 */ + { 9, 0xD4, 960 }, /* 0110 1010 0 */ + { 9, 0xD5, 1024 }, /* 0110 1010 1 */ + { 9, 0xD6, 1088 }, /* 0110 1011 0 */ + { 9, 0xD7, 1152 }, /* 0110 1011 1 */ + { 9, 0xD8, 1216 }, /* 0110 1100 0 */ + { 9, 0xD9, 1280 }, /* 0110 1100 1 */ + { 9, 0xDA, 1344 }, /* 0110 1101 0 */ + { 9, 0xDB, 1408 }, /* 0110 1101 1 */ + { 9, 0x98, 1472 }, /* 0100 1100 0 */ + { 9, 0x99, 1536 }, /* 0100 1100 1 */ + { 9, 0x9A, 1600 }, /* 0100 1101 0 */ + { 6, 0x18, 1664 }, /* 0110 00 */ + { 9, 0x9B, 1728 }, /* 0100 1101 1 */ + { 11, 0x8, 1792 }, /* 0000 0001 000 */ + { 11, 0xC, 1856 }, /* 0000 0001 100 */ + { 11, 0xD, 1920 }, /* 0000 0001 101 */ + { 12, 0x12, 1984 }, /* 0000 0001 0010 */ + { 12, 0x13, 2048 }, /* 0000 0001 0011 */ + { 12, 0x14, 2112 }, /* 0000 0001 0100 */ + { 12, 0x15, 2176 }, /* 0000 0001 0101 */ + { 12, 0x16, 2240 }, /* 0000 0001 0110 */ + { 12, 0x17, 2304 }, /* 0000 0001 0111 */ + { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ + { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ + { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ + { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ + { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ + { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ + { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ + { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ + { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; const tableentry TIFFFaxBlackCodes[] = { - { 10, 0x37, 0 }, /* 0000 1101 11 */ - { 3, 0x2, 1 }, /* 010 */ - { 2, 0x3, 2 }, /* 11 */ - { 2, 0x2, 3 }, /* 10 */ - { 3, 0x3, 4 }, /* 011 */ - { 4, 0x3, 5 }, /* 0011 */ - { 4, 0x2, 6 }, /* 0010 */ - { 5, 0x3, 7 }, /* 0001 1 */ - { 6, 0x5, 8 }, /* 0001 01 */ - { 6, 0x4, 9 }, /* 0001 00 */ - { 7, 0x4, 10 }, /* 0000 100 */ - { 7, 0x5, 11 }, /* 0000 101 */ - { 7, 0x7, 12 }, /* 0000 111 */ - { 8, 0x4, 13 }, /* 0000 0100 */ - { 8, 0x7, 14 }, /* 0000 0111 */ - { 9, 0x18, 15 }, /* 0000 1100 0 */ - { 10, 0x17, 16 }, /* 0000 0101 11 */ - { 10, 0x18, 17 }, /* 0000 0110 00 */ - { 10, 0x8, 18 }, /* 0000 0010 00 */ - { 11, 0x67, 19 }, /* 0000 1100 111 */ - { 11, 0x68, 20 }, /* 0000 1101 000 */ - { 11, 0x6C, 21 }, /* 0000 1101 100 */ - { 11, 0x37, 22 }, /* 0000 0110 111 */ - { 11, 0x28, 23 }, /* 0000 0101 000 */ - { 11, 0x17, 24 }, /* 0000 0010 111 */ - { 11, 0x18, 25 }, /* 0000 0011 000 */ - { 12, 0xCA, 26 }, /* 0000 1100 1010 */ - { 12, 0xCB, 27 }, /* 0000 1100 1011 */ - { 12, 0xCC, 28 }, /* 0000 1100 1100 */ - { 12, 0xCD, 29 }, /* 0000 1100 1101 */ - { 12, 0x68, 30 }, /* 0000 0110 1000 */ - { 12, 0x69, 31 }, /* 0000 0110 1001 */ - { 12, 0x6A, 32 }, /* 0000 0110 1010 */ - { 12, 0x6B, 33 }, /* 0000 0110 1011 */ - { 12, 0xD2, 34 }, /* 0000 1101 0010 */ - { 12, 0xD3, 35 }, /* 0000 1101 0011 */ - { 12, 0xD4, 36 }, /* 0000 1101 0100 */ - { 12, 0xD5, 37 }, /* 0000 1101 0101 */ - { 12, 0xD6, 38 }, /* 0000 1101 0110 */ - { 12, 0xD7, 39 }, /* 0000 1101 0111 */ - { 12, 0x6C, 40 }, /* 0000 0110 1100 */ - { 12, 0x6D, 41 }, /* 0000 0110 1101 */ - { 12, 0xDA, 42 }, /* 0000 1101 1010 */ - { 12, 0xDB, 43 }, /* 0000 1101 1011 */ - { 12, 0x54, 44 }, /* 0000 0101 0100 */ - { 12, 0x55, 45 }, /* 0000 0101 0101 */ - { 12, 0x56, 46 }, /* 0000 0101 0110 */ - { 12, 0x57, 47 }, /* 0000 0101 0111 */ - { 12, 0x64, 48 }, /* 0000 0110 0100 */ - { 12, 0x65, 49 }, /* 0000 0110 0101 */ - { 12, 0x52, 50 }, /* 0000 0101 0010 */ - { 12, 0x53, 51 }, /* 0000 0101 0011 */ - { 12, 0x24, 52 }, /* 0000 0010 0100 */ - { 12, 0x37, 53 }, /* 0000 0011 0111 */ - { 12, 0x38, 54 }, /* 0000 0011 1000 */ - { 12, 0x27, 55 }, /* 0000 0010 0111 */ - { 12, 0x28, 56 }, /* 0000 0010 1000 */ - { 12, 0x58, 57 }, /* 0000 0101 1000 */ - { 12, 0x59, 58 }, /* 0000 0101 1001 */ - { 12, 0x2B, 59 }, /* 0000 0010 1011 */ - { 12, 0x2C, 60 }, /* 0000 0010 1100 */ - { 12, 0x5A, 61 }, /* 0000 0101 1010 */ - { 12, 0x66, 62 }, /* 0000 0110 0110 */ - { 12, 0x67, 63 }, /* 0000 0110 0111 */ - { 10, 0xF, 64 }, /* 0000 0011 11 */ - { 12, 0xC8, 128 }, /* 0000 1100 1000 */ - { 12, 0xC9, 192 }, /* 0000 1100 1001 */ - { 12, 0x5B, 256 }, /* 0000 0101 1011 */ - { 12, 0x33, 320 }, /* 0000 0011 0011 */ - { 12, 0x34, 384 }, /* 0000 0011 0100 */ - { 12, 0x35, 448 }, /* 0000 0011 0101 */ - { 13, 0x6C, 512 }, /* 0000 0011 0110 0 */ - { 13, 0x6D, 576 }, /* 0000 0011 0110 1 */ - { 13, 0x4A, 640 }, /* 0000 0010 0101 0 */ - { 13, 0x4B, 704 }, /* 0000 0010 0101 1 */ - { 13, 0x4C, 768 }, /* 0000 0010 0110 0 */ - { 13, 0x4D, 832 }, /* 0000 0010 0110 1 */ - { 13, 0x72, 896 }, /* 0000 0011 1001 0 */ - { 13, 0x73, 960 }, /* 0000 0011 1001 1 */ - { 13, 0x74, 1024 }, /* 0000 0011 1010 0 */ - { 13, 0x75, 1088 }, /* 0000 0011 1010 1 */ - { 13, 0x76, 1152 }, /* 0000 0011 1011 0 */ - { 13, 0x77, 1216 }, /* 0000 0011 1011 1 */ - { 13, 0x52, 1280 }, /* 0000 0010 1001 0 */ - { 13, 0x53, 1344 }, /* 0000 0010 1001 1 */ - { 13, 0x54, 1408 }, /* 0000 0010 1010 0 */ - { 13, 0x55, 1472 }, /* 0000 0010 1010 1 */ - { 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */ - { 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */ - { 13, 0x64, 1664 }, /* 0000 0011 0010 0 */ - { 13, 0x65, 1728 }, /* 0000 0011 0010 1 */ - { 11, 0x8, 1792 }, /* 0000 0001 000 */ - { 11, 0xC, 1856 }, /* 0000 0001 100 */ - { 11, 0xD, 1920 }, /* 0000 0001 101 */ - { 12, 0x12, 1984 }, /* 0000 0001 0010 */ - { 12, 0x13, 2048 }, /* 0000 0001 0011 */ - { 12, 0x14, 2112 }, /* 0000 0001 0100 */ - { 12, 0x15, 2176 }, /* 0000 0001 0101 */ - { 12, 0x16, 2240 }, /* 0000 0001 0110 */ - { 12, 0x17, 2304 }, /* 0000 0001 0111 */ - { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ - { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ - { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ - { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ - { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ - { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ - { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ - { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ - { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ + { 10, 0x37, 0 }, /* 0000 1101 11 */ + { 3, 0x2, 1 }, /* 010 */ + { 2, 0x3, 2 }, /* 11 */ + { 2, 0x2, 3 }, /* 10 */ + { 3, 0x3, 4 }, /* 011 */ + { 4, 0x3, 5 }, /* 0011 */ + { 4, 0x2, 6 }, /* 0010 */ + { 5, 0x3, 7 }, /* 0001 1 */ + { 6, 0x5, 8 }, /* 0001 01 */ + { 6, 0x4, 9 }, /* 0001 00 */ + { 7, 0x4, 10 }, /* 0000 100 */ + { 7, 0x5, 11 }, /* 0000 101 */ + { 7, 0x7, 12 }, /* 0000 111 */ + { 8, 0x4, 13 }, /* 0000 0100 */ + { 8, 0x7, 14 }, /* 0000 0111 */ + { 9, 0x18, 15 }, /* 0000 1100 0 */ + { 10, 0x17, 16 }, /* 0000 0101 11 */ + { 10, 0x18, 17 }, /* 0000 0110 00 */ + { 10, 0x8, 18 }, /* 0000 0010 00 */ + { 11, 0x67, 19 }, /* 0000 1100 111 */ + { 11, 0x68, 20 }, /* 0000 1101 000 */ + { 11, 0x6C, 21 }, /* 0000 1101 100 */ + { 11, 0x37, 22 }, /* 0000 0110 111 */ + { 11, 0x28, 23 }, /* 0000 0101 000 */ + { 11, 0x17, 24 }, /* 0000 0010 111 */ + { 11, 0x18, 25 }, /* 0000 0011 000 */ + { 12, 0xCA, 26 }, /* 0000 1100 1010 */ + { 12, 0xCB, 27 }, /* 0000 1100 1011 */ + { 12, 0xCC, 28 }, /* 0000 1100 1100 */ + { 12, 0xCD, 29 }, /* 0000 1100 1101 */ + { 12, 0x68, 30 }, /* 0000 0110 1000 */ + { 12, 0x69, 31 }, /* 0000 0110 1001 */ + { 12, 0x6A, 32 }, /* 0000 0110 1010 */ + { 12, 0x6B, 33 }, /* 0000 0110 1011 */ + { 12, 0xD2, 34 }, /* 0000 1101 0010 */ + { 12, 0xD3, 35 }, /* 0000 1101 0011 */ + { 12, 0xD4, 36 }, /* 0000 1101 0100 */ + { 12, 0xD5, 37 }, /* 0000 1101 0101 */ + { 12, 0xD6, 38 }, /* 0000 1101 0110 */ + { 12, 0xD7, 39 }, /* 0000 1101 0111 */ + { 12, 0x6C, 40 }, /* 0000 0110 1100 */ + { 12, 0x6D, 41 }, /* 0000 0110 1101 */ + { 12, 0xDA, 42 }, /* 0000 1101 1010 */ + { 12, 0xDB, 43 }, /* 0000 1101 1011 */ + { 12, 0x54, 44 }, /* 0000 0101 0100 */ + { 12, 0x55, 45 }, /* 0000 0101 0101 */ + { 12, 0x56, 46 }, /* 0000 0101 0110 */ + { 12, 0x57, 47 }, /* 0000 0101 0111 */ + { 12, 0x64, 48 }, /* 0000 0110 0100 */ + { 12, 0x65, 49 }, /* 0000 0110 0101 */ + { 12, 0x52, 50 }, /* 0000 0101 0010 */ + { 12, 0x53, 51 }, /* 0000 0101 0011 */ + { 12, 0x24, 52 }, /* 0000 0010 0100 */ + { 12, 0x37, 53 }, /* 0000 0011 0111 */ + { 12, 0x38, 54 }, /* 0000 0011 1000 */ + { 12, 0x27, 55 }, /* 0000 0010 0111 */ + { 12, 0x28, 56 }, /* 0000 0010 1000 */ + { 12, 0x58, 57 }, /* 0000 0101 1000 */ + { 12, 0x59, 58 }, /* 0000 0101 1001 */ + { 12, 0x2B, 59 }, /* 0000 0010 1011 */ + { 12, 0x2C, 60 }, /* 0000 0010 1100 */ + { 12, 0x5A, 61 }, /* 0000 0101 1010 */ + { 12, 0x66, 62 }, /* 0000 0110 0110 */ + { 12, 0x67, 63 }, /* 0000 0110 0111 */ + { 10, 0xF, 64 }, /* 0000 0011 11 */ + { 12, 0xC8, 128 }, /* 0000 1100 1000 */ + { 12, 0xC9, 192 }, /* 0000 1100 1001 */ + { 12, 0x5B, 256 }, /* 0000 0101 1011 */ + { 12, 0x33, 320 }, /* 0000 0011 0011 */ + { 12, 0x34, 384 }, /* 0000 0011 0100 */ + { 12, 0x35, 448 }, /* 0000 0011 0101 */ + { 13, 0x6C, 512 }, /* 0000 0011 0110 0 */ + { 13, 0x6D, 576 }, /* 0000 0011 0110 1 */ + { 13, 0x4A, 640 }, /* 0000 0010 0101 0 */ + { 13, 0x4B, 704 }, /* 0000 0010 0101 1 */ + { 13, 0x4C, 768 }, /* 0000 0010 0110 0 */ + { 13, 0x4D, 832 }, /* 0000 0010 0110 1 */ + { 13, 0x72, 896 }, /* 0000 0011 1001 0 */ + { 13, 0x73, 960 }, /* 0000 0011 1001 1 */ + { 13, 0x74, 1024 }, /* 0000 0011 1010 0 */ + { 13, 0x75, 1088 }, /* 0000 0011 1010 1 */ + { 13, 0x76, 1152 }, /* 0000 0011 1011 0 */ + { 13, 0x77, 1216 }, /* 0000 0011 1011 1 */ + { 13, 0x52, 1280 }, /* 0000 0010 1001 0 */ + { 13, 0x53, 1344 }, /* 0000 0010 1001 1 */ + { 13, 0x54, 1408 }, /* 0000 0010 1010 0 */ + { 13, 0x55, 1472 }, /* 0000 0010 1010 1 */ + { 13, 0x5A, 1536 }, /* 0000 0010 1101 0 */ + { 13, 0x5B, 1600 }, /* 0000 0010 1101 1 */ + { 13, 0x64, 1664 }, /* 0000 0011 0010 0 */ + { 13, 0x65, 1728 }, /* 0000 0011 0010 1 */ + { 11, 0x8, 1792 }, /* 0000 0001 000 */ + { 11, 0xC, 1856 }, /* 0000 0001 100 */ + { 11, 0xD, 1920 }, /* 0000 0001 101 */ + { 12, 0x12, 1984 }, /* 0000 0001 0010 */ + { 12, 0x13, 2048 }, /* 0000 0001 0011 */ + { 12, 0x14, 2112 }, /* 0000 0001 0100 */ + { 12, 0x15, 2176 }, /* 0000 0001 0101 */ + { 12, 0x16, 2240 }, /* 0000 0001 0110 */ + { 12, 0x17, 2304 }, /* 0000 0001 0111 */ + { 12, 0x1C, 2368 }, /* 0000 0001 1100 */ + { 12, 0x1D, 2432 }, /* 0000 0001 1101 */ + { 12, 0x1E, 2496 }, /* 0000 0001 1110 */ + { 12, 0x1F, 2560 }, /* 0000 0001 1111 */ + { 12, 0x1, G3CODE_EOL }, /* 0000 0000 0001 */ + { 9, 0x1, G3CODE_INVALID }, /* 0000 0000 1 */ + { 10, 0x1, G3CODE_INVALID }, /* 0000 0000 01 */ + { 11, 0x1, G3CODE_INVALID }, /* 0000 0000 001 */ + { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; #else -extern const tableentry TIFFFaxWhiteCodes[]; -extern const tableentry TIFFFaxBlackCodes[]; +extern const tableentry TIFFFaxWhiteCodes[]; +extern const tableentry TIFFFaxBlackCodes[]; #endif #endif /* _T4_ */ diff --git a/panda/src/tiff/tif_fax3.h b/panda/src/tiff/tif_fax3.h index 1641103ad7..7cf4873d5b 100644 --- a/panda/src/tiff/tif_fax3.h +++ b/panda/src/tiff/tif_fax3.h @@ -25,47 +25,47 @@ */ #ifndef _FAX3_ -#define _FAX3_ +#define _FAX3_ /* * CCITT Group 3 compression/decompression definitions. */ -#define FAX3_CLASSF TIFF_OPT0 /* use Class F protocol */ +#define FAX3_CLASSF TIFF_OPT0 /* use Class F protocol */ /* the following are for use by Compression=2, 32771, and 4 (T.6) algorithms */ -#define FAX3_NOEOL TIFF_OPT1 /* no EOL code at end of row */ -#define FAX3_BYTEALIGN TIFF_OPT2 /* force byte alignment at end of row */ -#define FAX3_WORDALIGN TIFF_OPT3 /* force word alignment at end of row */ +#define FAX3_NOEOL TIFF_OPT1 /* no EOL code at end of row */ +#define FAX3_BYTEALIGN TIFF_OPT2 /* force byte alignment at end of row */ +#define FAX3_WORDALIGN TIFF_OPT3 /* force word alignment at end of row */ /* * Compression+decompression state blocks are * derived from this ``base state'' block. */ typedef struct { - short data; /* current i/o byte */ - short bit; /* current i/o bit in byte */ - short white; /* value of the color ``white'' */ - u_long rowbytes; /* XXX maybe should be a long? */ - u_long rowpixels; /* XXX maybe should be a long? */ - enum { /* decoding/encoding mode */ - G3_1D, /* basic 1-d mode */ - G3_2D /* optional 2-d mode */ - } tag; - const u_char *bitmap; /* bit reversal table */ - u_char *refline; /* reference line for 2d decoding */ + short data; /* current i/o byte */ + short bit; /* current i/o bit in byte */ + short white; /* value of the color ``white'' */ + u_long rowbytes; /* XXX maybe should be a long? */ + u_long rowpixels; /* XXX maybe should be a long? */ + enum { /* decoding/encoding mode */ + G3_1D, /* basic 1-d mode */ + G3_2D /* optional 2-d mode */ + } tag; + const u_char *bitmap; /* bit reversal table */ + u_char *refline; /* reference line for 2d decoding */ } Fax3BaseState; /* these routines are used by Group 4 (T.6) */ -extern int Fax3Decode2DRow(TIFF*, u_char*, int); -extern int Fax3Encode2DRow(TIFF*, u_char*, u_char*, int); -extern void Fax3PutBits(TIFF*, u_int, u_int); -extern void Fax3PutEOL(TIFF*); -extern int TIFFInitCCITTFax3(TIFF*); +extern int Fax3Decode2DRow(TIFF*, u_char*, int); +extern int Fax3Encode2DRow(TIFF*, u_char*, u_char*, int); +extern void Fax3PutBits(TIFF*, u_int, u_int); +extern void Fax3PutEOL(TIFF*); +extern int TIFFInitCCITTFax3(TIFF*); -#define Fax3FlushBits(tif, sp) { \ - if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \ - (void) TIFFFlushData1(tif); \ - *(tif)->tif_rawcp++ = (sp)->bitmap[(sp)->data]; \ - (tif)->tif_rawcc++; \ - (sp)->data = 0; \ - (sp)->bit = 8; \ +#define Fax3FlushBits(tif, sp) { \ + if ((tif)->tif_rawcc >= (tif)->tif_rawdatasize) \ + (void) TIFFFlushData1(tif); \ + *(tif)->tif_rawcp++ = (sp)->bitmap[(sp)->data]; \ + (tif)->tif_rawcc++; \ + (sp)->data = 0; \ + (sp)->bit = 8; \ } #endif /* _FAX3_ */ diff --git a/panda/src/tiff/tiff.h b/panda/src/tiff/tiff.h index 56c24855e1..36a5fa7f90 100644 --- a/panda/src/tiff/tiff.h +++ b/panda/src/tiff/tiff.h @@ -25,7 +25,7 @@ */ #ifndef _TIFF_ -#define _TIFF_ +#define _TIFF_ /* * Tag Image File Format (TIFF) * @@ -37,33 +37,33 @@ * Seattle, WA 98104 * 206-622-5500 */ -#define TIFF_VERSION 42 +#define TIFF_VERSION 42 -#define TIFF_BIGENDIAN 0x4d4d -#define TIFF_LITTLEENDIAN 0x4949 +#define TIFF_BIGENDIAN 0x4d4d +#define TIFF_LITTLEENDIAN 0x4949 /* * Intrinsic data types required by the file format: * - * 8-bit quantities char/unsigned char - * 16-bit quantities int16/uint16 - * 32-bit quantities int32/uint32 - * strings unsigned char* + * 8-bit quantities char/unsigned char + * 16-bit quantities int16/uint16 + * 32-bit quantities int32/uint32 + * strings unsigned char* */ -typedef short int16; -typedef unsigned short uint16; /* sizeof (uint16) must == 2 */ +typedef short int16; +typedef unsigned short uint16; /* sizeof (uint16) must == 2 */ #if defined(__alpha) -typedef int int32; -typedef unsigned int uint32; /* sizeof (uint32) must == 4 */ +typedef int int32; +typedef unsigned int uint32; /* sizeof (uint32) must == 4 */ #else -typedef long int32; -typedef unsigned long uint32; /* sizeof (uint32) must == 4 */ +typedef long int32; +typedef unsigned long uint32; /* sizeof (uint32) must == 4 */ #endif -typedef struct { - uint16 tiff_magic; /* magic number (defines byte order) */ - uint16 tiff_version; /* TIFF version number */ - uint32 tiff_diroff; /* byte offset to first directory */ +typedef struct { + uint16 tiff_magic; /* magic number (defines byte order) */ + uint16 tiff_version; /* TIFF version number */ + uint32 tiff_diroff; /* byte offset to first directory */ } TIFFHeader; /* @@ -79,11 +79,11 @@ typedef struct { * is less than 4 bytes, it is left-justified in the * offset field. */ -typedef struct { - uint16 tdir_tag; /* see below */ - uint16 tdir_type; /* data type; see below */ - uint32 tdir_count; /* number of items; length in spec */ - uint32 tdir_offset; /* byte offset to field data */ +typedef struct { + uint16 tdir_tag; /* see below */ + uint16 tdir_type; /* data type; see below */ + uint32 tdir_count; /* number of items; length in spec */ + uint32 tdir_offset; /* byte offset to field data */ } TIFFDirEntry; /* @@ -98,179 +98,179 @@ typedef struct { * * Note: RATIONALs are the ratio of two 32-bit integer values. */ -typedef enum { - TIFF_NOTYPE = 0, /* placeholder */ - TIFF_BYTE = 1, /* 8-bit unsigned integer */ - TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ - TIFF_SHORT = 3, /* 16-bit unsigned integer */ - TIFF_LONG = 4, /* 32-bit unsigned integer */ - TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ - TIFF_SBYTE = 6, /* !8-bit signed integer */ - TIFF_UNDEFINED = 7, /* !8-bit untyped data */ - TIFF_SSHORT = 8, /* !16-bit signed integer */ - TIFF_SLONG = 9, /* !32-bit signed integer */ - TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ - TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ - TIFF_DOUBLE = 12 /* !64-bit IEEE floating point */ +typedef enum { + TIFF_NOTYPE = 0, /* placeholder */ + TIFF_BYTE = 1, /* 8-bit unsigned integer */ + TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ + TIFF_SHORT = 3, /* 16-bit unsigned integer */ + TIFF_LONG = 4, /* 32-bit unsigned integer */ + TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ + TIFF_SBYTE = 6, /* !8-bit signed integer */ + TIFF_UNDEFINED = 7, /* !8-bit untyped data */ + TIFF_SSHORT = 8, /* !16-bit signed integer */ + TIFF_SLONG = 9, /* !32-bit signed integer */ + TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ + TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ + TIFF_DOUBLE = 12 /* !64-bit IEEE floating point */ } TIFFDataType; /* * TIFF Tag Definitions. */ -#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ -#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ -#define FILETYPE_PAGE 0x2 /* one page of many */ -#define FILETYPE_MASK 0x4 /* transparency mask */ -#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ -#define OFILETYPE_IMAGE 1 /* full resolution image data */ -#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ -#define OFILETYPE_PAGE 3 /* one page of many */ -#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ -#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ -#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ -#define TIFFTAG_COMPRESSION 259 /* data compression technique */ -#define COMPRESSION_NONE 1 /* dump mode */ -#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ -#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ -#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ -#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ -#define COMPRESSION_JPEG 6 /* !JPEG compression */ -#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ -#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ -#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ -#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ -#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ -#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ -#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ -#define PHOTOMETRIC_RGB 2 /* RGB color model */ -#define PHOTOMETRIC_PALETTE 3 /* color map indexed */ -#define PHOTOMETRIC_MASK 4 /* $holdout mask */ -#define PHOTOMETRIC_SEPARATED 5 /* !color separations */ -#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ -#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ -#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ -#define THRESHHOLD_BILEVEL 1 /* b&w art scan */ -#define THRESHHOLD_HALFTONE 2 /* or dithered scan */ -#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ -#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ -#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ -#define TIFFTAG_FILLORDER 266 /* data order within a byte */ -#define FILLORDER_MSB2LSB 1 /* most significant -> least */ -#define FILLORDER_LSB2MSB 2 /* least significant -> most */ -#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ -#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ -#define TIFFTAG_MAKE 271 /* scanner manufacturer name */ -#define TIFFTAG_MODEL 272 /* scanner model name/number */ -#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ -#define TIFFTAG_ORIENTATION 274 /* +image orientation */ -#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ -#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ -#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ -#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ -#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ -#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ -#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ -#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ -#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ -#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ -#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ -#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ -#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ -#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ -#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ -#define TIFFTAG_PLANARCONFIG 284 /* storage organization */ -#define PLANARCONFIG_CONTIG 1 /* single image plane */ -#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ -#define TIFFTAG_PAGENAME 285 /* page name image is from */ -#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ -#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ -#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ -#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ -#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ -#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ -#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ -#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ -#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ -#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ -#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ -#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ -#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ -#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ -#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ -#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ -#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ -#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ -#define RESUNIT_NONE 1 /* no meaningful units */ -#define RESUNIT_INCH 2 /* english */ -#define RESUNIT_CENTIMETER 3 /* metric */ -#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ -#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ -#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ -#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ -#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ -#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ -#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ -#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ -#define TIFFTAG_SOFTWARE 305 /* name & release */ -#define TIFFTAG_DATETIME 306 /* creation date and time */ -#define TIFFTAG_ARTIST 315 /* creator of image */ -#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ -#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ -#define TIFFTAG_WHITEPOINT 318 /* image white point */ -#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ -#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ -#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ -#define TIFFTAG_TILEWIDTH 322 /* !rows/data tile */ -#define TIFFTAG_TILELENGTH 323 /* !cols/data tile */ -#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ -#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ -#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ -#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ -#define CLEANFAXDATA_CLEAN 0 /* no errors detected */ -#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ -#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ -#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ -#define TIFFTAG_INKSET 332 /* !inks in separated image */ -#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black */ -#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ -#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ -#define TIFFTAG_TARGETPRINTER 337 /* !separation target */ -#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ -#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ -#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ -#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ -#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ -#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ -#define SAMPLEFORMAT_INT 2 /* !signed integer data */ -#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ -#define SAMPLEFORMAT_VOID 4 /* !untyped data */ -#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ -#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ -#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ -#define JPEGPROC_BASELINE 1 /* !baseline sequential */ -#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ -#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ -#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ -#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ -#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ -#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ -#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ -#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ -#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ -#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ -#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ -#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ -#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ -#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ -#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ +#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ +#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ +#define FILETYPE_PAGE 0x2 /* one page of many */ +#define FILETYPE_MASK 0x4 /* transparency mask */ +#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ +#define OFILETYPE_IMAGE 1 /* full resolution image data */ +#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ +#define OFILETYPE_PAGE 3 /* one page of many */ +#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ +#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ +#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ +#define TIFFTAG_COMPRESSION 259 /* data compression technique */ +#define COMPRESSION_NONE 1 /* dump mode */ +#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ +#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ +#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ +#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ +#define COMPRESSION_JPEG 6 /* !JPEG compression */ +#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ +#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ +#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ +#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ +#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ +#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ +#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ +#define PHOTOMETRIC_RGB 2 /* RGB color model */ +#define PHOTOMETRIC_PALETTE 3 /* color map indexed */ +#define PHOTOMETRIC_MASK 4 /* $holdout mask */ +#define PHOTOMETRIC_SEPARATED 5 /* !color separations */ +#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ +#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ +#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ +#define THRESHHOLD_BILEVEL 1 /* b&w art scan */ +#define THRESHHOLD_HALFTONE 2 /* or dithered scan */ +#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ +#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ +#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ +#define TIFFTAG_FILLORDER 266 /* data order within a byte */ +#define FILLORDER_MSB2LSB 1 /* most significant -> least */ +#define FILLORDER_LSB2MSB 2 /* least significant -> most */ +#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ +#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ +#define TIFFTAG_MAKE 271 /* scanner manufacturer name */ +#define TIFFTAG_MODEL 272 /* scanner model name/number */ +#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ +#define TIFFTAG_ORIENTATION 274 /* +image orientation */ +#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ +#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ +#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ +#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ +#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ +#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ +#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ +#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ +#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ +#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ +#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ +#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ +#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ +#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ +#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ +#define TIFFTAG_PLANARCONFIG 284 /* storage organization */ +#define PLANARCONFIG_CONTIG 1 /* single image plane */ +#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ +#define TIFFTAG_PAGENAME 285 /* page name image is from */ +#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ +#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ +#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ +#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ +#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ +#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ +#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ +#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ +#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ +#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ +#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ +#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ +#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ +#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ +#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ +#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ +#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ +#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ +#define RESUNIT_NONE 1 /* no meaningful units */ +#define RESUNIT_INCH 2 /* english */ +#define RESUNIT_CENTIMETER 3 /* metric */ +#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ +#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ +#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ +#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ +#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ +#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ +#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ +#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ +#define TIFFTAG_SOFTWARE 305 /* name & release */ +#define TIFFTAG_DATETIME 306 /* creation date and time */ +#define TIFFTAG_ARTIST 315 /* creator of image */ +#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ +#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ +#define TIFFTAG_WHITEPOINT 318 /* image white point */ +#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ +#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ +#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ +#define TIFFTAG_TILEWIDTH 322 /* !rows/data tile */ +#define TIFFTAG_TILELENGTH 323 /* !cols/data tile */ +#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ +#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ +#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ +#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ +#define CLEANFAXDATA_CLEAN 0 /* no errors detected */ +#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ +#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ +#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ +#define TIFFTAG_INKSET 332 /* !inks in separated image */ +#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black */ +#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ +#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ +#define TIFFTAG_TARGETPRINTER 337 /* !separation target */ +#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ +#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ +#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ +#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ +#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ +#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ +#define SAMPLEFORMAT_INT 2 /* !signed integer data */ +#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ +#define SAMPLEFORMAT_VOID 4 /* !untyped data */ +#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ +#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ +#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ +#define JPEGPROC_BASELINE 1 /* !baseline sequential */ +#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ +#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ +#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ +#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ +#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ +#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ +#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ +#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ +#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ +#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ +#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ +#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ +#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ +#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ +#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ /* tags 32952-32956 are private tags registered to Island Graphics */ -#define TIFFTAG_REFPTS 32953 /* image reference points */ -#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ -#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ -#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ +#define TIFFTAG_REFPTS 32953 /* image reference points */ +#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ +#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ +#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ /* tags 32995-32999 are private tags registered to SGI */ -#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ -#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ -#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ -#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ +#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ +#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ +#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ +#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ #endif /* _TIFF_ */ diff --git a/panda/src/tiff/tiffcomp.h b/panda/src/tiff/tiffcomp.h index bafa6cd39b..fa78c0a41d 100644 --- a/panda/src/tiff/tiffcomp.h +++ b/panda/src/tiff/tiffcomp.h @@ -25,7 +25,7 @@ */ #ifndef _COMPAT_ -#define _COMPAT_ +#define _COMPAT_ /* * This file contains a hodgepodge of definitions and * declarations that are needed to provide compatibility @@ -60,7 +60,7 @@ #endif #if defined(THINK_C) || defined(applec) #include -#define BSDTYPES +#define BSDTYPES #endif /* @@ -70,14 +70,14 @@ #if defined(SYSV) #include #endif -#define L_SET SEEK_SET -#define L_INCR SEEK_CUR -#define L_XTND SEEK_END +#define L_SET SEEK_SET +#define L_INCR SEEK_CUR +#define L_XTND SEEK_END #endif /* defined(SYSV) || defined(VMS) */ #ifndef L_SET -#define L_SET 0 -#define L_INCR 1 -#define L_XTND 2 +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 #endif /* @@ -92,10 +92,10 @@ * then define BSDTYPES in your Makefile. */ #ifdef BSDTYPES -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; #endif /* diff --git a/panda/src/tiff/tiffconf.h b/panda/src/tiff/tiffconf.h index d911dbe2dd..984a30c7c1 100644 --- a/panda/src/tiff/tiffconf.h +++ b/panda/src/tiff/tiffconf.h @@ -24,7 +24,7 @@ */ #ifndef _TIFFCONF_ -#define _TIFFCONF_ +#define _TIFFCONF_ /* * Library Configuration Definitions. * @@ -39,56 +39,56 @@ /* * General portability-related defines: * - * HAVE_IEEEFP define as 0 or 1 according to the floating point - * format suported by the machine - * BSDTYPES define this if your system does NOT define the - * usual 4BSD typedefs + * HAVE_IEEEFP define as 0 or 1 according to the floating point + * format suported by the machine + * BSDTYPES define this if your system does NOT define the + * usual 4BSD typedefs */ #ifndef HAVE_IEEEFP -#define HAVE_IEEEFP 1 +#define HAVE_IEEEFP 1 #endif #ifndef FEATURE_SUPPORT /* * Feature support definitions: * - * MMAP_SUPPORT enable support for memory mapping read-only files + * MMAP_SUPPORT enable support for memory mapping read-only files * COLORIMETRY_SUPPORT enable support for 6.0 colorimetry tags - * JPEG_SUPPORT enable support for 6.0 JPEG tags & JPEG algorithms - * YCBCR_SUPPORT enable support for 6.0 YCbCr tags - * CMYK_SUPPORT enable support for 6.0 CMYK tags + * JPEG_SUPPORT enable support for 6.0 JPEG tags & JPEG algorithms + * YCBCR_SUPPORT enable support for 6.0 YCbCr tags + * CMYK_SUPPORT enable support for 6.0 CMYK tags */ -#define COLORIMETRY_SUPPORT -#define JPEG_SUPPORT -#define YCBCR_SUPPORT -#define CMYK_SUPPORT +#define COLORIMETRY_SUPPORT +#define JPEG_SUPPORT +#define YCBCR_SUPPORT +#define CMYK_SUPPORT #endif #ifndef COMPRESSION_SUPPORT /* * Compression support defines: * - * CCITT_SUPPORT enable support for CCITT Group 3 & 4 algorithms - * PACKBITS_SUPPORT enable support for Macintosh PackBits algorithm - * LZW_SUPPORT enable support for LZW algorithm - * THUNDER_SUPPORT enable support for ThunderScan 4-bit RLE algorithm - * NEXT_SUPPORT enable support for NeXT 2-bit RLE algorithm - * JPEG_SUPPORT enable support for JPEG DCT algorithm + * CCITT_SUPPORT enable support for CCITT Group 3 & 4 algorithms + * PACKBITS_SUPPORT enable support for Macintosh PackBits algorithm + * LZW_SUPPORT enable support for LZW algorithm + * THUNDER_SUPPORT enable support for ThunderScan 4-bit RLE algorithm + * NEXT_SUPPORT enable support for NeXT 2-bit RLE algorithm + * JPEG_SUPPORT enable support for JPEG DCT algorithm */ -#define CCITT_SUPPORT -#define PACKBITS_SUPPORT -#define LZW_SUPPORT -#define THUNDER_SUPPORT -#define NEXT_SUPPORT +#define CCITT_SUPPORT +#define PACKBITS_SUPPORT +#define LZW_SUPPORT +#define THUNDER_SUPPORT +#define NEXT_SUPPORT #endif /* * ``Orthogonal Features'' * - * STRIPCHOP_SUPPORT automatically convert single-strip uncompressed images - * to mutiple strips of ~8Kb (for reducing memory use) + * STRIPCHOP_SUPPORT automatically convert single-strip uncompressed images + * to mutiple strips of ~8Kb (for reducing memory use) */ #ifndef STRIPCHOP_SUPPORT -#define STRIPCHOP_SUPPORT /* enable strip chopping */ +#define STRIPCHOP_SUPPORT /* enable strip chopping */ #endif #endif /* _TIFFCONF_ */ diff --git a/panda/src/tiff/tiffio.h b/panda/src/tiff/tiffio.h index e4ef5adc90..8ca68b4e60 100644 --- a/panda/src/tiff/tiffio.h +++ b/panda/src/tiff/tiffio.h @@ -25,7 +25,7 @@ */ #ifndef _TIFFIO_ -#define _TIFFIO_ +#define _TIFFIO_ /* * TIFF I/O Library Definitions. @@ -38,7 +38,7 @@ * TIFF is defined as an incomplete type to hide the * library's internal data structures from clients. */ -typedef struct tiff TIFF; +typedef struct tiff TIFF; /* * The following typedefs define the intrinsic size of @@ -57,18 +57,18 @@ typedef struct tiff TIFF; * NB: toff_t is not off_t for many reasons; TIFFs max out at * 32-bit file offsets being the most important */ -typedef unsigned int ttag_t; /* directory tag */ -typedef uint16 tdir_t; /* directory index */ -typedef uint16 tsample_t; /* sample number */ -typedef uint32 tstrip_t; /* strip number */ -typedef uint32 ttile_t; /* tile number */ -typedef int32 tsize_t; /* i/o size in bytes */ -typedef void* tdata_t; /* image data ref */ -typedef void* thandle_t; /* client data handle */ -typedef int32 toff_t; /* file offset */ +typedef unsigned int ttag_t; /* directory tag */ +typedef uint16 tdir_t; /* directory index */ +typedef uint16 tsample_t; /* sample number */ +typedef uint32 tstrip_t; /* strip number */ +typedef uint32 ttile_t; /* tile number */ +typedef int32 tsize_t; /* i/o size in bytes */ +typedef void* tdata_t; /* image data ref */ +typedef void* thandle_t; /* client data handle */ +typedef int32 toff_t; /* file offset */ #ifndef NULL -#define NULL 0 +#define NULL 0 #endif /* @@ -77,22 +77,22 @@ typedef int32 toff_t; /* file offset */ * very large. Bit-or these flags to enable printing * multiple items. */ -#define TIFFPRINT_NONE 0x0 /* no extra info */ -#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ -#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ -#define TIFFPRINT_COLORMAP 0x4 /* colormap */ -#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ -#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ -#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ +#define TIFFPRINT_NONE 0x0 /* no extra info */ +#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ +#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ +#define TIFFPRINT_COLORMAP 0x4 /* colormap */ +#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ +#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ +#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ /* * Macros for extracting components from the * packed ABGR form returned by TIFFReadRGBAImage. */ -#define TIFFGetR(abgr) ((abgr) & 0xff) -#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) -#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) -#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) +#define TIFFGetR(abgr) ((abgr) & 0xff) +#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) +#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) +#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) #include #include @@ -100,96 +100,96 @@ typedef int32 toff_t; /* file offset */ #if defined(__cplusplus) extern "C" { #endif -typedef void (*TIFFErrorHandler)(const char* module, const char* fmt, va_list); -typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t); -typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); -typedef int (*TIFFCloseProc)(thandle_t); -typedef toff_t (*TIFFSizeProc)(thandle_t); -typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*); -typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t); +typedef void (*TIFFErrorHandler)(const char* module, const char* fmt, va_list); +typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t); +typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); +typedef int (*TIFFCloseProc)(thandle_t); +typedef toff_t (*TIFFSizeProc)(thandle_t); +typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*); +typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t); -extern const char* TIFFGetVersion(void); +extern const char* TIFFGetVersion(void); -extern void TIFFClose(TIFF*); -extern int TIFFFlush(TIFF*); -extern int TIFFFlushData(TIFF*); -extern int TIFFGetField(TIFF*, ttag_t, ...); -extern int TIFFVGetField(TIFF*, ttag_t, va_list); -extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...); -extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list); -extern int TIFFReadDirectory(TIFF*); -extern tsize_t TIFFScanlineSize(TIFF*); -extern tsize_t TIFFStripSize(TIFF*); -extern tsize_t TIFFVStripSize(TIFF*, uint32); -extern tsize_t TIFFTileRowSize(TIFF*); -extern tsize_t TIFFTileSize(TIFF*); -extern tsize_t TIFFVTileSize(TIFF*, uint32); -extern int TIFFFileno(TIFF*); -extern int TIFFGetMode(TIFF*); -extern int TIFFIsTiled(TIFF*); -extern int TIFFIsByteSwapped(TIFF*); -extern uint32 TIFFCurrentRow(TIFF*); -extern tdir_t TIFFCurrentDirectory(TIFF*); -extern tstrip_t TIFFCurrentStrip(TIFF*); -extern ttile_t TIFFCurrentTile(TIFF*); -extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t); -extern int TIFFLastDirectory(TIFF*); -extern int TIFFSetDirectory(TIFF*, tdir_t); -extern int TIFFSetField(TIFF*, ttag_t, ...); -extern int TIFFVSetField(TIFF*, ttag_t, va_list); -extern int TIFFWriteDirectory(TIFF *); +extern void TIFFClose(TIFF*); +extern int TIFFFlush(TIFF*); +extern int TIFFFlushData(TIFF*); +extern int TIFFGetField(TIFF*, ttag_t, ...); +extern int TIFFVGetField(TIFF*, ttag_t, va_list); +extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...); +extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list); +extern int TIFFReadDirectory(TIFF*); +extern tsize_t TIFFScanlineSize(TIFF*); +extern tsize_t TIFFStripSize(TIFF*); +extern tsize_t TIFFVStripSize(TIFF*, uint32); +extern tsize_t TIFFTileRowSize(TIFF*); +extern tsize_t TIFFTileSize(TIFF*); +extern tsize_t TIFFVTileSize(TIFF*, uint32); +extern int TIFFFileno(TIFF*); +extern int TIFFGetMode(TIFF*); +extern int TIFFIsTiled(TIFF*); +extern int TIFFIsByteSwapped(TIFF*); +extern uint32 TIFFCurrentRow(TIFF*); +extern tdir_t TIFFCurrentDirectory(TIFF*); +extern tstrip_t TIFFCurrentStrip(TIFF*); +extern ttile_t TIFFCurrentTile(TIFF*); +extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t); +extern int TIFFLastDirectory(TIFF*); +extern int TIFFSetDirectory(TIFF*, tdir_t); +extern int TIFFSetField(TIFF*, ttag_t, ...); +extern int TIFFVSetField(TIFF*, ttag_t, va_list); +extern int TIFFWriteDirectory(TIFF *); #if defined(c_plusplus) || defined(__cplusplus) -extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); -extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0); -extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0); -extern int TIFFReadRGBAImage(TIFF*, - unsigned long, unsigned long, unsigned long*, int stop = 0); +extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); +extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0); +extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0); +extern int TIFFReadRGBAImage(TIFF*, + unsigned long, unsigned long, unsigned long*, int stop = 0); #else -extern void TIFFPrintDirectory(TIFF*, FILE*, long); -extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t); -extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t); -extern int TIFFReadRGBAImage(TIFF*, - unsigned long, unsigned long, unsigned long*, int stop); +extern void TIFFPrintDirectory(TIFF*, FILE*, long); +extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t); +extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t); +extern int TIFFReadRGBAImage(TIFF*, + unsigned long, unsigned long, unsigned long*, int stop); #endif -extern TIFF* TIFFOpen(const char*, const char*); -extern TIFF* TIFFFdOpen(int, const char*, const char*); -extern TIFF* TIFFClientOpen(const char* name, const char* mode, - thandle_t clientdata, - TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, - TIFFSeekProc seekproc, TIFFCloseProc closeproc, - TIFFSizeProc sizeproc, - TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc); -extern const char* TIFFFileName(TIFF*); -extern void TIFFError(const char*, const char*, ...); -extern void TIFFWarning(const char*, const char*, ...); -extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler); -extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler); -extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t); -extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t); -extern ttile_t TIFFNumberOfTiles(TIFF*); -extern tsize_t TIFFReadTile(TIFF*, - tdata_t, uint32, uint32, uint32, tsample_t); -extern tsize_t TIFFWriteTile(TIFF*, - tdata_t, uint32, uint32, uint32, tsample_t); -extern tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t); -extern tstrip_t TIFFNumberOfStrips(TIFF*); -extern tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); -extern tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); -extern tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); -extern tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t); -extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); -extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); -extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); -extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t); -extern void TIFFSetWriteOffset(TIFF*, toff_t); -extern void TIFFSwabShort(uint16 *); -extern void TIFFSwabLong(uint32 *); -extern void TIFFSwabArrayOfShort(uint16 *, unsigned long); -extern void TIFFSwabArrayOfLong(uint32 *, unsigned long); -extern void TIFFReverseBits(unsigned char *, unsigned long); -extern const unsigned char* TIFFGetBitRevTable(int); +extern TIFF* TIFFOpen(const char*, const char*); +extern TIFF* TIFFFdOpen(int, const char*, const char*); +extern TIFF* TIFFClientOpen(const char* name, const char* mode, + thandle_t clientdata, + TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, + TIFFSeekProc seekproc, TIFFCloseProc closeproc, + TIFFSizeProc sizeproc, + TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc); +extern const char* TIFFFileName(TIFF*); +extern void TIFFError(const char*, const char*, ...); +extern void TIFFWarning(const char*, const char*, ...); +extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler); +extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler); +extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t); +extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t); +extern ttile_t TIFFNumberOfTiles(TIFF*); +extern tsize_t TIFFReadTile(TIFF*, + tdata_t, uint32, uint32, uint32, tsample_t); +extern tsize_t TIFFWriteTile(TIFF*, + tdata_t, uint32, uint32, uint32, tsample_t); +extern tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t); +extern tstrip_t TIFFNumberOfStrips(TIFF*); +extern tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); +extern tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); +extern tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); +extern tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t); +extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t); +extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t); +extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t); +extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t); +extern void TIFFSetWriteOffset(TIFF*, toff_t); +extern void TIFFSwabShort(uint16 *); +extern void TIFFSwabLong(uint32 *); +extern void TIFFSwabArrayOfShort(uint16 *, unsigned long); +extern void TIFFSwabArrayOfLong(uint32 *, unsigned long); +extern void TIFFReverseBits(unsigned char *, unsigned long); +extern const unsigned char* TIFFGetBitRevTable(int); -extern void TIFFModeCCITTFax3(TIFF* tif, int isClassF); /* XXX */ +extern void TIFFModeCCITTFax3(TIFF* tif, int isClassF); /* XXX */ #if defined(__cplusplus) } #endif diff --git a/panda/src/tiff/tiffiop.h b/panda/src/tiff/tiffiop.h index f49054a4a7..da73c0cd60 100644 --- a/panda/src/tiff/tiffiop.h +++ b/panda/src/tiff/tiffiop.h @@ -25,7 +25,7 @@ */ #ifndef _TIFFIOP_ -#define _TIFFIOP_ +#define _TIFFIOP_ /* * ``Library-private'' definitions. */ @@ -38,74 +38,74 @@ /* * Internal format of a TIFF directory entry. */ -typedef struct { -#define FIELD_SETLONGS 2 - /* bit vector of fields that are set */ - u_long td_fieldsset[FIELD_SETLONGS]; +typedef struct { +#define FIELD_SETLONGS 2 + /* bit vector of fields that are set */ + u_long td_fieldsset[FIELD_SETLONGS]; - uint32 td_imagewidth, td_imagelength, td_imagedepth; - uint32 td_tilewidth, td_tilelength, td_tiledepth; - uint16 td_subfiletype; - uint16 td_bitspersample; - uint16 td_sampleformat; - uint16 td_compression; - uint16 td_photometric; - uint16 td_threshholding; - uint16 td_fillorder; - uint16 td_orientation; - uint16 td_samplesperpixel; - uint16 td_predictor; - uint32 td_rowsperstrip; - u_long td_minsamplevalue, td_maxsamplevalue; /* XXX */ - float td_xresolution, td_yresolution; - uint16 td_resolutionunit; - uint16 td_planarconfig; - float td_xposition, td_yposition; - uint32 td_group3options; - uint32 td_group4options; - uint16 td_pagenumber[2]; - uint16 td_cleanfaxdata; - uint16 td_badfaxrun; - uint32 td_badfaxlines; - uint16 *td_colormap[3]; - uint16 td_halftonehints[2]; - uint16 td_extrasamples, *td_sampleinfo; - char *td_documentname; - char *td_artist; - char *td_datetime; - char *td_hostcomputer; - char *td_imagedescription; - char *td_make; - char *td_model; - char *td_software; - char *td_pagename; - tstrip_t td_stripsperimage; - tstrip_t td_nstrips; /* size of offset & bytecount arrays */ - uint32 *td_stripoffset; - uint32 *td_stripbytecount; + uint32 td_imagewidth, td_imagelength, td_imagedepth; + uint32 td_tilewidth, td_tilelength, td_tiledepth; + uint16 td_subfiletype; + uint16 td_bitspersample; + uint16 td_sampleformat; + uint16 td_compression; + uint16 td_photometric; + uint16 td_threshholding; + uint16 td_fillorder; + uint16 td_orientation; + uint16 td_samplesperpixel; + uint16 td_predictor; + uint32 td_rowsperstrip; + u_long td_minsamplevalue, td_maxsamplevalue; /* XXX */ + float td_xresolution, td_yresolution; + uint16 td_resolutionunit; + uint16 td_planarconfig; + float td_xposition, td_yposition; + uint32 td_group3options; + uint32 td_group4options; + uint16 td_pagenumber[2]; + uint16 td_cleanfaxdata; + uint16 td_badfaxrun; + uint32 td_badfaxlines; + uint16 *td_colormap[3]; + uint16 td_halftonehints[2]; + uint16 td_extrasamples, *td_sampleinfo; + char *td_documentname; + char *td_artist; + char *td_datetime; + char *td_hostcomputer; + char *td_imagedescription; + char *td_make; + char *td_model; + char *td_software; + char *td_pagename; + tstrip_t td_stripsperimage; + tstrip_t td_nstrips; /* size of offset & bytecount arrays */ + uint32 *td_stripoffset; + uint32 *td_stripbytecount; #ifdef YCBCR_SUPPORT - float *td_ycbcrcoeffs; - uint16 td_ycbcrsubsampling[2]; - uint16 td_ycbcrpositioning; + float *td_ycbcrcoeffs; + uint16 td_ycbcrsubsampling[2]; + uint16 td_ycbcrpositioning; #endif #ifdef JPEG_SUPPORT - uint16 td_jpegproc; - uint16 td_jpegrestartinterval; - u_char **td_qtab; - u_char **td_dctab; - u_char **td_actab; + uint16 td_jpegproc; + uint16 td_jpegrestartinterval; + u_char **td_qtab; + u_char **td_dctab; + u_char **td_actab; #endif #ifdef COLORIMETRY_SUPPORT - float *td_whitepoint; - float *td_primarychromas; - float *td_refblackwhite; - uint16 *td_transferfunction[3]; + float *td_whitepoint; + float *td_primarychromas; + float *td_refblackwhite; + uint16 *td_transferfunction[3]; #endif #ifdef CMYK_SUPPORT - uint16 td_inkset; - uint16 td_dotrange[2]; - char *td_inknames; - char *td_targetprinter; + uint16 td_inkset; + uint16 td_dotrange[2]; + char *td_inknames; + char *td_targetprinter; #endif } TIFFDirectory; @@ -115,290 +115,290 @@ typedef struct { * when manipulating a directory. */ /* multi-entry fields */ -#define FIELD_IMAGEDIMENSIONS 0 -#define FIELD_TILEDIMENSIONS 1 -#define FIELD_CELLDIMENSIONS 2 /* XXX */ -#define FIELD_RESOLUTION 3 -#define FIELD_POSITION 4 +#define FIELD_IMAGEDIMENSIONS 0 +#define FIELD_TILEDIMENSIONS 1 +#define FIELD_CELLDIMENSIONS 2 /* XXX */ +#define FIELD_RESOLUTION 3 +#define FIELD_POSITION 4 /* single-entry fields */ -#define FIELD_SUBFILETYPE 5 -#define FIELD_BITSPERSAMPLE 6 -#define FIELD_COMPRESSION 7 -#define FIELD_PHOTOMETRIC 8 -#define FIELD_THRESHHOLDING 9 -#define FIELD_FILLORDER 10 -#define FIELD_DOCUMENTNAME 11 -#define FIELD_IMAGEDESCRIPTION 12 -#define FIELD_MAKE 13 -#define FIELD_MODEL 14 -#define FIELD_ORIENTATION 15 -#define FIELD_SAMPLESPERPIXEL 16 -#define FIELD_ROWSPERSTRIP 17 -#define FIELD_MINSAMPLEVALUE 18 -#define FIELD_MAXSAMPLEVALUE 19 -#define FIELD_PLANARCONFIG 20 -#define FIELD_PAGENAME 21 -#define FIELD_GROUP3OPTIONS 22 -#define FIELD_GROUP4OPTIONS 23 -#define FIELD_RESOLUTIONUNIT 24 -#define FIELD_PAGENUMBER 25 -#define FIELD_STRIPBYTECOUNTS 26 -#define FIELD_STRIPOFFSETS 27 -#define FIELD_COLORMAP 28 -#define FIELD_PREDICTOR 29 -#define FIELD_ARTIST 30 -#define FIELD_DATETIME 31 -#define FIELD_HOSTCOMPUTER 32 -#define FIELD_SOFTWARE 33 -#define FIELD_EXTRASAMPLES 34 -#define FIELD_BADFAXLINES 35 -#define FIELD_CLEANFAXDATA 36 -#define FIELD_BADFAXRUN 37 -#define FIELD_SAMPLEFORMAT 38 -#define FIELD_SMINSAMPLEVALUE 39 -#define FIELD_SMAXSAMPLEVALUE 40 -#define FIELD_IMAGEDEPTH 41 -#define FIELD_TILEDEPTH 42 -#define FIELD_HALFTONEHINTS 43 +#define FIELD_SUBFILETYPE 5 +#define FIELD_BITSPERSAMPLE 6 +#define FIELD_COMPRESSION 7 +#define FIELD_PHOTOMETRIC 8 +#define FIELD_THRESHHOLDING 9 +#define FIELD_FILLORDER 10 +#define FIELD_DOCUMENTNAME 11 +#define FIELD_IMAGEDESCRIPTION 12 +#define FIELD_MAKE 13 +#define FIELD_MODEL 14 +#define FIELD_ORIENTATION 15 +#define FIELD_SAMPLESPERPIXEL 16 +#define FIELD_ROWSPERSTRIP 17 +#define FIELD_MINSAMPLEVALUE 18 +#define FIELD_MAXSAMPLEVALUE 19 +#define FIELD_PLANARCONFIG 20 +#define FIELD_PAGENAME 21 +#define FIELD_GROUP3OPTIONS 22 +#define FIELD_GROUP4OPTIONS 23 +#define FIELD_RESOLUTIONUNIT 24 +#define FIELD_PAGENUMBER 25 +#define FIELD_STRIPBYTECOUNTS 26 +#define FIELD_STRIPOFFSETS 27 +#define FIELD_COLORMAP 28 +#define FIELD_PREDICTOR 29 +#define FIELD_ARTIST 30 +#define FIELD_DATETIME 31 +#define FIELD_HOSTCOMPUTER 32 +#define FIELD_SOFTWARE 33 +#define FIELD_EXTRASAMPLES 34 +#define FIELD_BADFAXLINES 35 +#define FIELD_CLEANFAXDATA 36 +#define FIELD_BADFAXRUN 37 +#define FIELD_SAMPLEFORMAT 38 +#define FIELD_SMINSAMPLEVALUE 39 +#define FIELD_SMAXSAMPLEVALUE 40 +#define FIELD_IMAGEDEPTH 41 +#define FIELD_TILEDEPTH 42 +#define FIELD_HALFTONEHINTS 43 #ifdef YCBCR_SUPPORT -#define FIELD_YCBCRCOEFFICIENTS 44 -#define FIELD_YCBCRSUBSAMPLING 45 -#define FIELD_YCBCRPOSITIONING 46 +#define FIELD_YCBCRCOEFFICIENTS 44 +#define FIELD_YCBCRSUBSAMPLING 45 +#define FIELD_YCBCRPOSITIONING 46 #endif #ifdef JPEG_SUPPORT -#define FIELD_JPEGPROC 47 -#define FIELD_JPEGRESTARTINTERVAL 48 -#define FIELD_JPEGQTABLES 49 -#define FIELD_JPEGDCTABLES 50 -#define FIELD_JPEGACTABLES 51 +#define FIELD_JPEGPROC 47 +#define FIELD_JPEGRESTARTINTERVAL 48 +#define FIELD_JPEGQTABLES 49 +#define FIELD_JPEGDCTABLES 50 +#define FIELD_JPEGACTABLES 51 #endif #ifdef COLORIMETRY_SUPPORT -#define FIELD_REFBLACKWHITE 52 -#define FIELD_WHITEPOINT 53 -#define FIELD_PRIMARYCHROMAS 54 -#define FIELD_TRANSFERFUNCTION 55 +#define FIELD_REFBLACKWHITE 52 +#define FIELD_WHITEPOINT 53 +#define FIELD_PRIMARYCHROMAS 54 +#define FIELD_TRANSFERFUNCTION 55 #endif #ifdef CMYK_SUPPORT -#define FIELD_INKSET 56 -#define FIELD_INKNAMES 57 -#define FIELD_DOTRANGE 58 -#define FIELD_TARGETPRINTER 59 +#define FIELD_INKSET 56 +#define FIELD_INKNAMES 57 +#define FIELD_DOTRANGE 58 +#define FIELD_TARGETPRINTER 59 #endif -#define FIELD_LAST 59 +#define FIELD_LAST 59 -#define TIFFExtractData(tif, type, v) \ +#define TIFFExtractData(tif, type, v) \ ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \ - (v) & (tif)->tif_typemask[type]) -#define TIFFInsertData(tif, type, v) \ + (v) & (tif)->tif_typemask[type]) +#define TIFFInsertData(tif, type, v) \ ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \ ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \ - (v) & (tif)->tif_typemask[type]) + (v) & (tif)->tif_typemask[type]) -typedef struct { - ttag_t field_tag; /* field's tag */ - short field_readcount; /* read count (-1 for unknown) */ - short field_writecount; /* write count (-1 for unknown) */ - TIFFDataType field_type; /* type of associated data */ - u_short field_bit; /* bit in fieldsset bit vector */ - u_short field_oktochange; /* if true, can change while writing */ - char *field_name; /* ASCII name */ +typedef struct { + ttag_t field_tag; /* field's tag */ + short field_readcount; /* read count (-1 for unknown) */ + short field_writecount; /* write count (-1 for unknown) */ + TIFFDataType field_type; /* type of associated data */ + u_short field_bit; /* bit in fieldsset bit vector */ + u_short field_oktochange; /* if true, can change while writing */ + char *field_name; /* ASCII name */ } TIFFFieldInfo; -#define FIELD_IGNORE ((u_short)-1) /* tags processed but ignored */ +#define FIELD_IGNORE ((u_short)-1) /* tags processed but ignored */ -#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ -#define TIFF_VARIABLE -1 /* marker for variable length tags */ -#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ +#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ +#define TIFF_VARIABLE -1 /* marker for variable length tags */ +#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ -extern const TIFFFieldInfo tiffFieldInfo[];/* table of field descriptors */ -extern const int tiffDataWidth[]; /* table of tag datatype widths */ +extern const TIFFFieldInfo tiffFieldInfo[];/* table of field descriptors */ +extern const int tiffDataWidth[]; /* table of tag datatype widths */ -#define BITn(n) (((u_long)1L)<<((n)&0x1f)) -#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32]) -#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field)) -#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field)) -#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field)) +#define BITn(n) (((u_long)1L)<<((n)&0x1f)) +#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32]) +#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field)) +#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field)) +#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field)) -#define FieldSet(fields, f) (fields[(f)/32] & BITn(f)) -#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f)) +#define FieldSet(fields, f) (fields[(f)/32] & BITn(f)) +#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f)) /* * Typedefs for ``method pointers'' used internally. */ -typedef unsigned char* tidata_t; /* internal image data type */ +typedef unsigned char* tidata_t; /* internal image data type */ -typedef void (*TIFFVoidMethod)(TIFF*); -typedef int (*TIFFBoolMethod)(TIFF*); -typedef int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t); -typedef int (*TIFFSeekMethod)(TIFF*, uint32); -typedef void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t); +typedef void (*TIFFVoidMethod)(TIFF*); +typedef int (*TIFFBoolMethod)(TIFF*); +typedef int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t); +typedef int (*TIFFSeekMethod)(TIFF*, uint32); +typedef void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t); struct tiff { - char* tif_name; /* name of open file */ - short tif_fd; /* open file descriptor */ - short tif_mode; /* open mode (O_*) */ - char tif_fillorder; /* natural bit fill order for machine */ - char tif_options; /* compression-specific options */ - short tif_flags; -#define TIFF_DIRTYHEADER 0x1 /* header must be written on close */ -#define TIFF_DIRTYDIRECT 0x2 /* current directory must be written */ -#define TIFF_BUFFERSETUP 0x4 /* data buffers setup */ -#define TIFF_BEENWRITING 0x8 /* written 1+ scanlines to file */ -#define TIFF_SWAB 0x10 /* byte swap file information */ -#define TIFF_NOBITREV 0x20 /* inhibit bit reversal logic */ -#define TIFF_MYBUFFER 0x40 /* my raw data buffer; free on close */ -#define TIFF_ISTILED 0x80 /* file is tile, not strip- based */ -#define TIFF_MAPPED 0x100 /* file is mapped into memory */ -#define TIFF_POSTENCODE 0x200 /* need call to postencode routine */ - toff_t tif_diroff; /* file offset of current directory */ - toff_t tif_nextdiroff; /* file offset of following directory */ - TIFFDirectory tif_dir; /* internal rep of current directory */ - TIFFHeader tif_header; /* file's header block */ - const int* tif_typeshift; /* data type shift counts */ - const long* tif_typemask; /* data type masks */ - uint32 tif_row; /* current scanline */ - tdir_t tif_curdir; /* current directory (index) */ - tstrip_t tif_curstrip; /* current strip for read/write */ - toff_t tif_curoff; /* current offset for read/write */ - toff_t tif_dataoff; /* current offset for writing dir */ + char* tif_name; /* name of open file */ + short tif_fd; /* open file descriptor */ + short tif_mode; /* open mode (O_*) */ + char tif_fillorder; /* natural bit fill order for machine */ + char tif_options; /* compression-specific options */ + short tif_flags; +#define TIFF_DIRTYHEADER 0x1 /* header must be written on close */ +#define TIFF_DIRTYDIRECT 0x2 /* current directory must be written */ +#define TIFF_BUFFERSETUP 0x4 /* data buffers setup */ +#define TIFF_BEENWRITING 0x8 /* written 1+ scanlines to file */ +#define TIFF_SWAB 0x10 /* byte swap file information */ +#define TIFF_NOBITREV 0x20 /* inhibit bit reversal logic */ +#define TIFF_MYBUFFER 0x40 /* my raw data buffer; free on close */ +#define TIFF_ISTILED 0x80 /* file is tile, not strip- based */ +#define TIFF_MAPPED 0x100 /* file is mapped into memory */ +#define TIFF_POSTENCODE 0x200 /* need call to postencode routine */ + toff_t tif_diroff; /* file offset of current directory */ + toff_t tif_nextdiroff; /* file offset of following directory */ + TIFFDirectory tif_dir; /* internal rep of current directory */ + TIFFHeader tif_header; /* file's header block */ + const int* tif_typeshift; /* data type shift counts */ + const long* tif_typemask; /* data type masks */ + uint32 tif_row; /* current scanline */ + tdir_t tif_curdir; /* current directory (index) */ + tstrip_t tif_curstrip; /* current strip for read/write */ + toff_t tif_curoff; /* current offset for read/write */ + toff_t tif_dataoff; /* current offset for writing dir */ /* tiling support */ - uint32 tif_col; /* current column (offset by row too) */ - ttile_t tif_curtile; /* current tile for read/write */ - tsize_t tif_tilesize; /* # of bytes in a tile */ + uint32 tif_col; /* current column (offset by row too) */ + ttile_t tif_curtile; /* current tile for read/write */ + tsize_t tif_tilesize; /* # of bytes in a tile */ /* compression scheme hooks */ - TIFFBoolMethod tif_predecode; /* pre row/strip/tile decoding */ - TIFFBoolMethod tif_preencode; /* pre row/strip/tile encoding */ - TIFFBoolMethod tif_postencode; /* post row/strip/tile encoding */ - TIFFCodeMethod tif_decoderow; /* scanline decoding routine */ - TIFFCodeMethod tif_encoderow; /* scanline encoding routine */ - TIFFCodeMethod tif_decodestrip;/* strip decoding routine */ - TIFFCodeMethod tif_encodestrip;/* strip encoding routine */ - TIFFCodeMethod tif_decodetile; /* tile decoding routine */ - TIFFCodeMethod tif_encodetile; /* tile encoding routine */ - TIFFVoidMethod tif_close; /* cleanup-on-close routine */ - TIFFSeekMethod tif_seek; /* position within a strip routine */ - TIFFVoidMethod tif_cleanup; /* routine called to cleanup state */ - tidata_t tif_data; /* compression scheme private data */ + TIFFBoolMethod tif_predecode; /* pre row/strip/tile decoding */ + TIFFBoolMethod tif_preencode; /* pre row/strip/tile encoding */ + TIFFBoolMethod tif_postencode; /* post row/strip/tile encoding */ + TIFFCodeMethod tif_decoderow; /* scanline decoding routine */ + TIFFCodeMethod tif_encoderow; /* scanline encoding routine */ + TIFFCodeMethod tif_decodestrip;/* strip decoding routine */ + TIFFCodeMethod tif_encodestrip;/* strip encoding routine */ + TIFFCodeMethod tif_decodetile; /* tile decoding routine */ + TIFFCodeMethod tif_encodetile; /* tile encoding routine */ + TIFFVoidMethod tif_close; /* cleanup-on-close routine */ + TIFFSeekMethod tif_seek; /* position within a strip routine */ + TIFFVoidMethod tif_cleanup; /* routine called to cleanup state */ + tidata_t tif_data; /* compression scheme private data */ /* input/output buffering */ - tsize_t tif_scanlinesize;/* # of bytes in a scanline */ - tsize_t tif_scanlineskew;/* scanline skew for reading strips */ - tidata_t tif_rawdata; /* raw data buffer */ - tsize_t tif_rawdatasize;/* # of bytes in raw data buffer */ - tidata_t tif_rawcp; /* current spot in raw buffer */ - tsize_t tif_rawcc; /* bytes unread from raw buffer */ + tsize_t tif_scanlinesize;/* # of bytes in a scanline */ + tsize_t tif_scanlineskew;/* scanline skew for reading strips */ + tidata_t tif_rawdata; /* raw data buffer */ + tsize_t tif_rawdatasize;/* # of bytes in raw data buffer */ + tidata_t tif_rawcp; /* current spot in raw buffer */ + tsize_t tif_rawcc; /* bytes unread from raw buffer */ /* memory-mapped file support */ - tidata_t tif_base; /* base of mapped file */ - toff_t tif_size; /* size of mapped file region (bytes) */ - TIFFMapFileProc tif_mapproc; /* map file method */ - TIFFUnmapFileProc tif_unmapproc;/* unmap file method */ + tidata_t tif_base; /* base of mapped file */ + toff_t tif_size; /* size of mapped file region (bytes) */ + TIFFMapFileProc tif_mapproc; /* map file method */ + TIFFUnmapFileProc tif_unmapproc;/* unmap file method */ /* input/output callback methods */ - thandle_t tif_clientdata; /* callback parameter */ - TIFFReadWriteProc tif_readproc; /* read method */ - TIFFReadWriteProc tif_writeproc;/* write method */ - TIFFSeekProc tif_seekproc; /* lseek method */ - TIFFCloseProc tif_closeproc; /* close method */ - TIFFSizeProc tif_sizeproc; /* filesize method */ + thandle_t tif_clientdata; /* callback parameter */ + TIFFReadWriteProc tif_readproc; /* read method */ + TIFFReadWriteProc tif_writeproc;/* write method */ + TIFFSeekProc tif_seekproc; /* lseek method */ + TIFFCloseProc tif_closeproc; /* close method */ + TIFFSizeProc tif_sizeproc; /* filesize method */ /* post-decoding support */ - TIFFPostMethod tif_postdecode;/* post decoding routine */ + TIFFPostMethod tif_postdecode;/* post decoding routine */ }; -#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0) -#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0) -#define TIFFReadFile(tif, buf, size) \ - ((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size)) -#define TIFFWriteFile(tif, buf, size) \ - ((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size)) -#define TIFFSeekFile(tif, off, whence) \ - ((*(tif)->tif_seekproc)((tif)->tif_clientdata,off,whence)) -#define TIFFCloseFile(tif) \ - ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) -#define TIFFGetFileSize(tif) \ - ((*(tif)->tif_sizeproc)((tif)->tif_clientdata)) -#define TIFFMapFileContents(tif, paddr, psize) \ - ((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize)) -#define TIFFUnmapFileContents(tif, addr, size) \ - ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size)) +#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0) +#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0) +#define TIFFReadFile(tif, buf, size) \ + ((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size)) +#define TIFFWriteFile(tif, buf, size) \ + ((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size)) +#define TIFFSeekFile(tif, off, whence) \ + ((*(tif)->tif_seekproc)((tif)->tif_clientdata,off,whence)) +#define TIFFCloseFile(tif) \ + ((*(tif)->tif_closeproc)((tif)->tif_clientdata)) +#define TIFFGetFileSize(tif) \ + ((*(tif)->tif_sizeproc)((tif)->tif_clientdata)) +#define TIFFMapFileContents(tif, paddr, psize) \ + ((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize)) +#define TIFFUnmapFileContents(tif, addr, size) \ + ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size)) /* * Default Read/Seek/Write definitions. */ #ifndef ReadOK -#define ReadOK(tif, buf, size) \ - (TIFFReadFile(tif, (tdata_t) buf, (tsize_t) size) == size) +#define ReadOK(tif, buf, size) \ + (TIFFReadFile(tif, (tdata_t) buf, (tsize_t) size) == size) #endif #ifndef SeekOK -#define SeekOK(tif, off) \ - (TIFFSeekFile(tif, (toff_t) off, L_SET) == (toff_t) off) +#define SeekOK(tif, off) \ + (TIFFSeekFile(tif, (toff_t) off, L_SET) == (toff_t) off) #endif #ifndef WriteOK -#define WriteOK(tif, buf, size) \ - (TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size) +#define WriteOK(tif, buf, size) \ + (TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size) #endif /* generic option bit names */ -#define TIFF_OPT0 0x1 -#define TIFF_OPT1 0x2 -#define TIFF_OPT2 0x4 -#define TIFF_OPT3 0x8 -#define TIFF_OPT4 0x10 -#define TIFF_OPT5 0x20 -#define TIFF_OPT6 0x40 -#define TIFF_OPT7 0x80 +#define TIFF_OPT0 0x1 +#define TIFF_OPT1 0x2 +#define TIFF_OPT2 0x4 +#define TIFF_OPT3 0x8 +#define TIFF_OPT4 0x10 +#define TIFF_OPT5 0x20 +#define TIFF_OPT6 0x40 +#define TIFF_OPT7 0x80 /* NB: the u_long casts are to silence certain ANSI-C compilers */ #ifdef howmany #undef howmany #endif -#define howmany(x, y) ((((u_long)(x))+(((u_long)(y))-1))/((u_long)(y))) +#define howmany(x, y) ((((u_long)(x))+(((u_long)(y))-1))/((u_long)(y))) #ifdef roundup #undef roundup #endif -#define roundup(x, y) (howmany(x,y)*((u_long)(y))) +#define roundup(x, y) (howmany(x,y)*((u_long)(y))) #if defined(__cplusplus) extern "C" { #endif -extern void* _TIFFmalloc(size_t); -extern void* _TIFFrealloc(void*, size_t); -extern void _TIFFfree(void*); -extern int _TIFFgetMode(const char* mode, const char* module); -extern const TIFFFieldInfo *TIFFFindFieldInfo(ttag_t, TIFFDataType); -extern const TIFFFieldInfo *TIFFFieldWithTag(ttag_t); -extern void _TIFFgetfield(TIFFDirectory*, ttag_t, ...); -extern int TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t); -extern int TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t); -extern int TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t); -extern int TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t); -extern int TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t); -extern int TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t); -extern void TIFFNoPostDecode(TIFF*, tidata_t, tsize_t); -extern void TIFFSwab16BitData(TIFF*, tidata_t, tsize_t); -extern void TIFFSwab32BitData(TIFF*, tidata_t, tsize_t); -extern int TIFFFlushData1(TIFF*); -extern void TIFFFreeDirectory(TIFF*); -extern int TIFFDefaultDirectory(TIFF*); -extern int TIFFSetCompressionScheme(TIFF *, int); +extern void* _TIFFmalloc(size_t); +extern void* _TIFFrealloc(void*, size_t); +extern void _TIFFfree(void*); +extern int _TIFFgetMode(const char* mode, const char* module); +extern const TIFFFieldInfo *TIFFFindFieldInfo(ttag_t, TIFFDataType); +extern const TIFFFieldInfo *TIFFFieldWithTag(ttag_t); +extern void _TIFFgetfield(TIFFDirectory*, ttag_t, ...); +extern int TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t); +extern int TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t); +extern int TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t); +extern int TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t); +extern int TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t); +extern int TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t); +extern void TIFFNoPostDecode(TIFF*, tidata_t, tsize_t); +extern void TIFFSwab16BitData(TIFF*, tidata_t, tsize_t); +extern void TIFFSwab32BitData(TIFF*, tidata_t, tsize_t); +extern int TIFFFlushData1(TIFF*); +extern void TIFFFreeDirectory(TIFF*); +extern int TIFFDefaultDirectory(TIFF*); +extern int TIFFSetCompressionScheme(TIFF *, int); -extern int TIFFInitDumpMode(TIFF*); +extern int TIFFInitDumpMode(TIFF*); #ifdef PACKBITS_SUPPORT -extern int TIFFInitPackBits(TIFF*); +extern int TIFFInitPackBits(TIFF*); #endif #ifdef CCITT_SUPPORT -extern int TIFFInitCCITTRLE(TIFF*), TIFFInitCCITTRLEW(TIFF*); -extern int TIFFInitCCITTFax3(TIFF*), TIFFInitCCITTFax4(TIFF*); +extern int TIFFInitCCITTRLE(TIFF*), TIFFInitCCITTRLEW(TIFF*); +extern int TIFFInitCCITTFax3(TIFF*), TIFFInitCCITTFax4(TIFF*); #endif #ifdef THUNDER_SUPPORT -extern int TIFFInitThunderScan(TIFF*); +extern int TIFFInitThunderScan(TIFF*); #endif #ifdef NEXT_SUPPORT -extern int TIFFInitNeXT(TIFF*); +extern int TIFFInitNeXT(TIFF*); #endif #ifdef LZW_SUPPORT -extern int TIFFInitLZW(TIFF*); +extern int TIFFInitLZW(TIFF*); #endif #ifdef JPEG_SUPPORT -extern int TIFFInitJPEG(TIFF*); +extern int TIFFInitJPEG(TIFF*); #endif #if defined(__cplusplus) } diff --git a/panda/src/vrpn/vrpnAnalog.cxx b/panda/src/vrpn/vrpnAnalog.cxx index 2f001f533e..a900fcad46 100644 --- a/panda/src/vrpn/vrpnAnalog.cxx +++ b/panda/src/vrpn/vrpnAnalog.cxx @@ -109,10 +109,10 @@ vrpn_analog_callback(void *userdata, const vrpn_ANALOGCB info) { device->lock(); for (int i = 0; i < info.num_channel; i++) { if (vrpn_cat.is_debug()) { - if (device->get_control_state(i) != info.channel[i]) { - vrpn_cat.debug() - << *self << " got analog " << i << " = " << info.channel[i] << "\n"; - } + if (device->get_control_state(i) != info.channel[i]) { + vrpn_cat.debug() + << *self << " got analog " << i << " = " << info.channel[i] << "\n"; + } } device->set_control_state(i, info.channel[i]); } diff --git a/panda/src/vrpn/vrpnAnalogDevice.cxx b/panda/src/vrpn/vrpnAnalogDevice.cxx index 85d3fb426d..214a932f8b 100644 --- a/panda/src/vrpn/vrpnAnalogDevice.cxx +++ b/panda/src/vrpn/vrpnAnalogDevice.cxx @@ -15,7 +15,7 @@ TypeHandle VrpnAnalogDevice::_type_handle; //////////////////////////////////////////////////////////////////// VrpnAnalogDevice:: VrpnAnalogDevice(VrpnClient *client, const string &device_name, - VrpnAnalog *vrpn_analog) : + VrpnAnalog *vrpn_analog) : ClientAnalogDevice(client, device_name), _vrpn_analog(vrpn_analog) { diff --git a/panda/src/vrpn/vrpnAnalogDevice.h b/panda/src/vrpn/vrpnAnalogDevice.h index f2608509b9..31ef76dbe3 100644 --- a/panda/src/vrpn/vrpnAnalogDevice.h +++ b/panda/src/vrpn/vrpnAnalogDevice.h @@ -24,7 +24,7 @@ class VrpnAnalog; class VrpnAnalogDevice : public ClientAnalogDevice { public: VrpnAnalogDevice(VrpnClient *client, const string &device_name, - VrpnAnalog *vrpn_analog); + VrpnAnalog *vrpn_analog); virtual ~VrpnAnalogDevice(); INLINE VrpnAnalog *get_vrpn_analog() const; diff --git a/panda/src/vrpn/vrpnButtonDevice.cxx b/panda/src/vrpn/vrpnButtonDevice.cxx index 3a1f09a88c..9b3d25c8e4 100644 --- a/panda/src/vrpn/vrpnButtonDevice.cxx +++ b/panda/src/vrpn/vrpnButtonDevice.cxx @@ -15,7 +15,7 @@ TypeHandle VrpnButtonDevice::_type_handle; //////////////////////////////////////////////////////////////////// VrpnButtonDevice:: VrpnButtonDevice(VrpnClient *client, const string &device_name, - VrpnButton *vrpn_button) : + VrpnButton *vrpn_button) : ClientButtonDevice(client, device_name), _vrpn_button(vrpn_button) { diff --git a/panda/src/vrpn/vrpnButtonDevice.h b/panda/src/vrpn/vrpnButtonDevice.h index e5d3b608e4..fa200d4f56 100644 --- a/panda/src/vrpn/vrpnButtonDevice.h +++ b/panda/src/vrpn/vrpnButtonDevice.h @@ -24,7 +24,7 @@ class VrpnButton; class VrpnButtonDevice : public ClientButtonDevice { public: VrpnButtonDevice(VrpnClient *client, const string &device_name, - VrpnButton *vrpn_button); + VrpnButton *vrpn_button); virtual ~VrpnButtonDevice(); INLINE VrpnButton *get_vrpn_button() const; diff --git a/panda/src/vrpn/vrpnClient.I b/panda/src/vrpn/vrpnClient.I index a0b22dae8d..8cbca3500c 100644 --- a/panda/src/vrpn/vrpnClient.I +++ b/panda/src/vrpn/vrpnClient.I @@ -96,7 +96,7 @@ tracker_velocity(const string &tracker, const vrpn_TRACKERVELCB info) { double vtime = convert_to_secs(info.msg_time); LPoint3f vel(info.vel[0], info.vel[1], info.vel[2]); LVector4f vquat(info.vel_quat[0], info.vel_quat[1], - info.vel_quat[2], info.vel_quat[3]); + info.vel_quat[2], info.vel_quat[3]); float dt = info.vel_quat_dt; push_tracker_velocity(tracker, info.sensor, vtime, vel, vquat, dt); @@ -113,7 +113,7 @@ tracker_acceleration(const string &tracker, const vrpn_TRACKERACCCB info) { double atime = convert_to_secs(info.msg_time); LPoint3f acc(info.acc[0], info.acc[1], info.acc[2]); LVector4f aquat(info.acc_quat[0], info.acc_quat[1], - info.acc_quat[2], info.acc_quat[3]); + info.acc_quat[2], info.acc_quat[3]); float dt = info.acc_quat_dt; push_tracker_acceleration(tracker, info.sensor, atime, acc, aquat, dt); diff --git a/panda/src/vrpn/vrpnClient.cxx b/panda/src/vrpn/vrpnClient.cxx index ed0b6729c2..3837ade375 100644 --- a/panda/src/vrpn/vrpnClient.cxx +++ b/panda/src/vrpn/vrpnClient.cxx @@ -160,7 +160,7 @@ make_device(TypeHandle device_type, const string &device_name) { //////////////////////////////////////////////////////////////////// bool VrpnClient:: disconnect_device(TypeHandle device_type, const string &device_name, - ClientDevice *device) { + ClientDevice *device) { if (vrpn_cat.is_debug()) { vrpn_cat.debug() << "Disconnecting device " << *device << "\n"; diff --git a/panda/src/vrpn/vrpnClient.h b/panda/src/vrpn/vrpnClient.h index 055cb698ba..64cf83065a 100644 --- a/panda/src/vrpn/vrpnClient.h +++ b/panda/src/vrpn/vrpnClient.h @@ -42,11 +42,11 @@ public: protected: virtual PT(ClientDevice) make_device(TypeHandle device_type, - const string &device_name); + const string &device_name); virtual bool disconnect_device(TypeHandle device_type, - const string &device_name, - ClientDevice *device); + const string &device_name, + ClientDevice *device); virtual void do_poll(); diff --git a/panda/src/vrpn/vrpnDialDevice.cxx b/panda/src/vrpn/vrpnDialDevice.cxx index f12e3fb769..5d7f82f0de 100644 --- a/panda/src/vrpn/vrpnDialDevice.cxx +++ b/panda/src/vrpn/vrpnDialDevice.cxx @@ -15,7 +15,7 @@ TypeHandle VrpnDialDevice::_type_handle; //////////////////////////////////////////////////////////////////// VrpnDialDevice:: VrpnDialDevice(VrpnClient *client, const string &device_name, - VrpnDial *vrpn_dial) : + VrpnDial *vrpn_dial) : ClientDialDevice(client, device_name), _vrpn_dial(vrpn_dial) { diff --git a/panda/src/vrpn/vrpnDialDevice.h b/panda/src/vrpn/vrpnDialDevice.h index 281419ab37..31478fb847 100644 --- a/panda/src/vrpn/vrpnDialDevice.h +++ b/panda/src/vrpn/vrpnDialDevice.h @@ -24,7 +24,7 @@ class VrpnDial; class VrpnDialDevice : public ClientDialDevice { public: VrpnDialDevice(VrpnClient *client, const string &device_name, - VrpnDial *vrpn_dial); + VrpnDial *vrpn_dial); virtual ~VrpnDialDevice(); INLINE VrpnDial *get_vrpn_dial() const; diff --git a/panda/src/vrpn/vrpnTracker.cxx b/panda/src/vrpn/vrpnTracker.cxx index 558a8da1b9..e4f12c59bb 100644 --- a/panda/src/vrpn/vrpnTracker.cxx +++ b/panda/src/vrpn/vrpnTracker.cxx @@ -113,7 +113,7 @@ vrpn_position_callback(void *userdata, const vrpn_TRACKERCB info) { for (di = self->_devices.begin(); di != self->_devices.end(); ++di) { VrpnTrackerDevice *device = (*di); if (device->get_sensor() == info.sensor && - device->get_data_type() == VrpnTrackerDevice::DT_position) { + device->get_data_type() == VrpnTrackerDevice::DT_position) { device->lock(); device->_data.set_time(VrpnClient::convert_to_secs(info.msg_time)); device->_data.set_pos(LPoint3f(info.pos[0], info.pos[1], info.pos[2])); @@ -142,12 +142,12 @@ vrpn_velocity_callback(void *userdata, const vrpn_TRACKERVELCB info) { for (di = self->_devices.begin(); di != self->_devices.end(); ++di) { VrpnTrackerDevice *device = (*di); if (device->get_sensor() == info.sensor && - device->get_data_type() == VrpnTrackerDevice::DT_velocity) { + device->get_data_type() == VrpnTrackerDevice::DT_velocity) { device->lock(); device->_data.set_time(VrpnClient::convert_to_secs(info.msg_time)); device->_data.set_pos(LPoint3f(info.vel[0], info.vel[1], info.vel[2])); device->_data.set_orient(LOrientationf(info.vel_quat[0], info.vel_quat[1], - info.vel_quat[2], info.vel_quat[3])); + info.vel_quat[2], info.vel_quat[3])); device->_data.set_dt(info.vel_quat_dt); device->unlock(); } @@ -173,12 +173,12 @@ vrpn_acceleration_callback(void *userdata, const vrpn_TRACKERACCCB info) { for (di = self->_devices.begin(); di != self->_devices.end(); ++di) { VrpnTrackerDevice *device = (*di); if (device->get_sensor() == info.sensor && - device->get_data_type() == VrpnTrackerDevice::DT_acceleration) { + device->get_data_type() == VrpnTrackerDevice::DT_acceleration) { device->lock(); device->_data.set_time(VrpnClient::convert_to_secs(info.msg_time)); device->_data.set_pos(LPoint3f(info.acc[0], info.acc[1], info.acc[2])); device->_data.set_orient(LOrientationf(info.acc_quat[0], info.acc_quat[1], - info.acc_quat[2], info.acc_quat[3])); + info.acc_quat[2], info.acc_quat[3])); device->_data.set_dt(info.acc_quat_dt); device->unlock(); } diff --git a/panda/src/vrpn/vrpnTrackerDevice.cxx b/panda/src/vrpn/vrpnTrackerDevice.cxx index cf10f1c48c..57bfb493c4 100644 --- a/panda/src/vrpn/vrpnTrackerDevice.cxx +++ b/panda/src/vrpn/vrpnTrackerDevice.cxx @@ -15,8 +15,8 @@ TypeHandle VrpnTrackerDevice::_type_handle; //////////////////////////////////////////////////////////////////// VrpnTrackerDevice:: VrpnTrackerDevice(VrpnClient *client, const string &device_name, - int sensor, VrpnTrackerDevice::DataType data_type, - VrpnTracker *vrpn_tracker) : + int sensor, VrpnTrackerDevice::DataType data_type, + VrpnTracker *vrpn_tracker) : ClientTrackerDevice(client, device_name), _sensor(sensor), _data_type(data_type), diff --git a/panda/src/vrpn/vrpnTrackerDevice.h b/panda/src/vrpn/vrpnTrackerDevice.h index 8418991273..89e67eb0ea 100644 --- a/panda/src/vrpn/vrpnTrackerDevice.h +++ b/panda/src/vrpn/vrpnTrackerDevice.h @@ -35,8 +35,8 @@ public: }; VrpnTrackerDevice(VrpnClient *client, const string &device_name, - int sensor, DataType data_type, - VrpnTracker *vrpn_tracker); + int sensor, DataType data_type, + VrpnTracker *vrpn_tracker); virtual ~VrpnTrackerDevice(); INLINE int get_sensor() const; diff --git a/panda/src/wdxdisplay/config_wdxdisplay.cxx b/panda/src/wdxdisplay/config_wdxdisplay.cxx index 76a81c7233..8f9a04a5c1 100644 --- a/panda/src/wdxdisplay/config_wdxdisplay.cxx +++ b/panda/src/wdxdisplay/config_wdxdisplay.cxx @@ -34,12 +34,12 @@ init_libwdxdisplay() { wdxGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory( - wdxGraphicsPipe::get_class_type(), - wdxGraphicsPipe::make_wdxGraphicsPipe); + wdxGraphicsPipe::get_class_type(), + wdxGraphicsPipe::make_wdxGraphicsPipe); wdxGraphicsWindow::init_type(); GraphicsWindow::get_factory().register_factory( - wdxGraphicsWindow::get_class_type(), - wdxGraphicsWindow::make_wdxGraphicsWindow); + wdxGraphicsWindow::get_class_type(), + wdxGraphicsWindow::make_wdxGraphicsWindow); } // cant use global var cleanly because global var static init executed after init_libwgl(), incorrectly reiniting var diff --git a/panda/src/wdxdisplay/wdxGraphicsPipe.cxx b/panda/src/wdxdisplay/wdxGraphicsPipe.cxx index 22609b52d9..c40e06adcc 100644 --- a/panda/src/wdxdisplay/wdxGraphicsPipe.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsPipe.cxx @@ -21,9 +21,9 @@ TypeHandle wdxGraphicsPipe::_type_handle; wdxGraphicsPipe::wdxGraphicsPipe(const PipeSpecifier& spec) : InteractiveGraphicsPipe(spec) { - _width = GetSystemMetrics(SM_CXSCREEN); - _height = GetSystemMetrics(SM_CYSCREEN); - _shift = false; + _width = GetSystemMetrics(SM_CXSCREEN); + _height = GetSystemMetrics(SM_CYSCREEN); + _shift = false; // global_pipe = this; } @@ -35,1558 +35,1558 @@ wdxGraphicsPipe::wdxGraphicsPipe(const PipeSpecifier& spec) //////////////////////////////////////////////////////////////////// TypeHandle wdxGraphicsPipe:: get_window_type() const { - return wdxGraphicsWindow::get_class_type(); + return wdxGraphicsWindow::get_class_type(); } GraphicsPipe *wdxGraphicsPipe:: make_wdxGraphicsPipe(const FactoryParams ¶ms) { - GraphicsPipe::PipeSpec *pipe_param; - if(!get_param_into(pipe_param, params)) { - return new wdxGraphicsPipe(PipeSpecifier()); - } else { - return new wdxGraphicsPipe(pipe_param->get_specifier()); - } + GraphicsPipe::PipeSpec *pipe_param; + if(!get_param_into(pipe_param, params)) { + return new wdxGraphicsPipe(PipeSpecifier()); + } else { + return new wdxGraphicsPipe(pipe_param->get_specifier()); + } } TypeHandle wdxGraphicsPipe::get_class_type(void) { - return _type_handle; + return _type_handle; } void wdxGraphicsPipe::init_type(void) { - InteractiveGraphicsPipe::init_type(); - register_type(_type_handle, "wdxGraphicsPipe", - InteractiveGraphicsPipe::get_class_type()); + InteractiveGraphicsPipe::init_type(); + register_type(_type_handle, "wdxGraphicsPipe", + InteractiveGraphicsPipe::get_class_type()); } TypeHandle wdxGraphicsPipe::get_type(void) const { - return get_class_type(); + return get_class_type(); } wdxGraphicsPipe::wdxGraphicsPipe(void) { - wdxdisplay_cat.error() - << "wdxGraphicsPipes should not be created with the default constructor" - << endl; + wdxdisplay_cat.error() + << "wdxGraphicsPipes should not be created with the default constructor" + << endl; } wdxGraphicsPipe::wdxGraphicsPipe(const wdxGraphicsPipe&) { - wdxdisplay_cat.error() - << "wdxGraphicsPipes should not be copied" << endl; + wdxdisplay_cat.error() + << "wdxGraphicsPipes should not be copied" << endl; } wdxGraphicsPipe& wdxGraphicsPipe::operator=(const wdxGraphicsPipe&) { - wdxdisplay_cat.error() - << "wdxGraphicsPipes should not be assigned" << endl; - return *this; + wdxdisplay_cat.error() + << "wdxGraphicsPipes should not be assigned" << endl; + return *this; } //////////////////////////////////////////////////////////////////// // Function: find_window // Access: // Description: Find the window that has the xwindow "win" in the -// window list for the pipe (if it exists) +// window list for the pipe (if it exists) //////////////////////////////////////////////////////////////////// wdxGraphicsWindow *wdxGraphicsPipe:: find_window(HWND win) { - int num_windows = get_num_windows(); - for(int w = 0; w < num_windows; w++) { - wdxGraphicsWindow *window = DCAST(wdxGraphicsWindow, get_window(w)); - if(window->_mwindow == win) - return window; - } - return NULL; + int num_windows = get_num_windows(); + for(int w = 0; w < num_windows; w++) { + wdxGraphicsWindow *window = DCAST(wdxGraphicsWindow, get_window(w)); + if(window->_mwindow == win) + return window; + } + return NULL; } extern char * ConvD3DErrorToString(const HRESULT &error) { - switch(error) { - case E_FAIL: - return "Unspecified error E_FAIL"; + switch(error) { + case E_FAIL: + return "Unspecified error E_FAIL"; - case DD_OK: - return "No error.\0"; - case D3DERR_BADMAJORVERSION : // (700) - return "D3DERR_BADMAJORVERSION";//: // (700) - case D3DERR_BADMINORVERSION : // (701) - return "D3DERR_BADMINORVERSION";//: // (701) - case D3DERR_INVALID_DEVICE : // (705) - return "D3DERR_INVALID_DEVICE";//: // (705) - case D3DERR_INITFAILED : // (706) - return "D3DERR_INITFAILED";//: // (706) - case D3DERR_DEVICEAGGREGATED : // (707) - return "D3DERR_DEVICEAGGREGATED";//: // (707) - case D3DERR_EXECUTE_CREATE_FAILED : // (710) - return "D3DERR_EXECUTE_CREATE_FAILED";//: // (710) - case D3DERR_EXECUTE_DESTROY_FAILED : // (711) - return "D3DERR_EXECUTE_DESTROY_FAILED";//: // (711) - case D3DERR_EXECUTE_LOCK_FAILED : // (712) - return "D3DERR_EXECUTE_LOCK_FAILED";//: // (712) - case D3DERR_EXECUTE_UNLOCK_FAILED : // (713) - return "D3DERR_EXECUTE_UNLOCK_FAILED";//: // (713) - case D3DERR_EXECUTE_LOCKED : // (714) - return "D3DERR_EXECUTE_LOCKED";//: // (714) - case D3DERR_EXECUTE_NOT_LOCKED : // (715) - return "D3DERR_EXECUTE_NOT_LOCKED";//: // (715) - case D3DERR_EXECUTE_FAILED : // (716) - return "D3DERR_EXECUTE_FAILED";//: // (716) - case D3DERR_EXECUTE_CLIPPED_FAILED : // (717) - return "D3DERR_EXECUTE_CLIPPED_FAILED";//: // (717) - case D3DERR_TEXTURE_NO_SUPPORT : // (720) - return "D3DERR_TEXTURE_NO_SUPPORT";//: // (720) - case D3DERR_TEXTURE_CREATE_FAILED : // (721) - return "D3DERR_TEXTURE_CREATE_FAILED";//: // (721) - case D3DERR_TEXTURE_DESTROY_FAILED : // (722) - return "D3DERR_TEXTURE_DESTROY_FAILED";//: // (722) - case D3DERR_TEXTURE_LOCK_FAILED : // (723) - return "D3DERR_TEXTURE_LOCK_FAILED";//: // (723) - case D3DERR_TEXTURE_UNLOCK_FAILED : // (724) - return "D3DERR_TEXTURE_UNLOCK_FAILED";//: // (724) - case D3DERR_TEXTURE_LOAD_FAILED : // (725) - return "D3DERR_TEXTURE_LOAD_FAILED";//: // (725) - case D3DERR_TEXTURE_SWAP_FAILED : // (726) - return "D3DERR_TEXTURE_SWAP_FAILED";//: // (726) - case D3DERR_TEXTURE_LOCKED : // (727) - return "D3DERR_TEXTURE_LOCKED";//: // (727) - case D3DERR_TEXTURE_NOT_LOCKED : // (728) - return "D3DERR_TEXTURE_NOT_LOCKED";//: // (728) - case D3DERR_TEXTURE_GETSURF_FAILED : // (729) - return "D3DERR_TEXTURE_GETSURF_FAILED";//: // (729) - case D3DERR_MATRIX_CREATE_FAILED : // (730) - return "D3DERR_MATRIX_CREATE_FAILED";//: // (730) - case D3DERR_MATRIX_DESTROY_FAILED : // (731) - return "D3DERR_MATRIX_DESTROY_FAILED";//: // (731) - case D3DERR_MATRIX_SETDATA_FAILED : // (732) - return "D3DERR_MATRIX_SETDATA_FAILED";//: // (732) - case D3DERR_MATRIX_GETDATA_FAILED : // (733) - return "D3DERR_MATRIX_GETDATA_FAILED";//: // (733) - case D3DERR_SETVIEWPORTDATA_FAILED : // (734) - return "D3DERR_SETVIEWPORTDATA_FAILED";//: // (734) - case D3DERR_INVALIDCURRENTVIEWPORT : // (735) - return "D3DERR_INVALIDCURRENTVIEWPORT";//: // (735) - case D3DERR_INVALIDPRIMITIVETYPE : // (736) - return "D3DERR_INVALIDPRIMITIVETYPE";//: // (736) - case D3DERR_INVALIDVERTEXTYPE : // (737) - return "D3DERR_INVALIDVERTEXTYPE";//: // (737) - case D3DERR_TEXTURE_BADSIZE : // (738) - return "D3DERR_TEXTURE_BADSIZE";//: // (738) - case D3DERR_INVALIDRAMPTEXTURE : // (739) - return "D3DERR_INVALIDRAMPTEXTURE";//: // (739) - case D3DERR_MATERIAL_CREATE_FAILED : // (740) - return "D3DERR_MATERIAL_CREATE_FAILED";//: // (740) - case D3DERR_MATERIAL_DESTROY_FAILED : // (741) - return "D3DERR_MATERIAL_DESTROY_FAILED";//: // (741) - case D3DERR_MATERIAL_SETDATA_FAILED : // (742) - return "D3DERR_MATERIAL_SETDATA_FAILED";//: // (742) - case D3DERR_MATERIAL_GETDATA_FAILED : // (743) - return "D3DERR_MATERIAL_GETDATA_FAILED";//: // (743) - case D3DERR_INVALIDPALETTE : // (744) - return "D3DERR_INVALIDPALETTE";//: // (744) - case D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY : // (745) - return "D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY";//: // (745) - case D3DERR_ZBUFF_NEEDS_VIDEOMEMORY : // (746) - return "D3DERR_ZBUFF_NEEDS_VIDEOMEMORY";//: // (746) - case D3DERR_SURFACENOTINVIDMEM : // (747) - return "D3DERR_SURFACENOTINVIDMEM";//: // (747) - case D3DERR_LIGHT_SET_FAILED : // (750) - return "D3DERR_LIGHT_SET_FAILED";//: // (750) - case D3DERR_LIGHTHASVIEWPORT : // (751) - return "D3DERR_LIGHTHASVIEWPORT";//: // (751) - case D3DERR_LIGHTNOTINTHISVIEWPORT : // (752) - return "D3DERR_LIGHTNOTINTHISVIEWPORT";//: // (752) - case D3DERR_SCENE_IN_SCENE : // (760) - return "D3DERR_SCENE_IN_SCENE";//: // (760) - case D3DERR_SCENE_NOT_IN_SCENE : // (761) - return "D3DERR_SCENE_NOT_IN_SCENE";//: // (761) - case D3DERR_SCENE_BEGIN_FAILED : // (762) - return "D3DERR_SCENE_BEGIN_FAILED";//: // (762) - case D3DERR_SCENE_END_FAILED : // (763) - return "D3DERR_SCENE_END_FAILED";//: // (763) - case D3DERR_INBEGIN : // (770) - return "D3DERR_INBEGIN";//: // (770) - case D3DERR_NOTINBEGIN : // (771) - return "D3DERR_NOTINBEGIN";//: // (771) - case D3DERR_NOVIEWPORTS : // (772) - return "D3DERR_NOVIEWPORTS";//: // (772) - case D3DERR_VIEWPORTDATANOTSET : // (773) - return "D3DERR_VIEWPORTDATANOTSET";//: // (773) - case D3DERR_VIEWPORTHASNODEVICE : // (774) - return "D3DERR_VIEWPORTHASNODEVICE";//: // (774) - case D3DERR_NOCURRENTVIEWPORT : // (775) - return "D3DERR_NOCURRENTVIEWPORT";//: // (775) - case D3DERR_INVALIDVERTEXFORMAT : // (2048) - return "D3DERR_INVALIDVERTEXFORMAT";//: // (2048) - case D3DERR_COLORKEYATTACHED : // (2050) - return "D3DERR_COLORKEYATTACHED";//: // (2050) - case D3DERR_VERTEXBUFFEROPTIMIZED : // (2060) - return "D3DERR_VERTEXBUFFEROPTIMIZED";//: // (2060) - case D3DERR_VBUF_CREATE_FAILED : // (2061) - return "D3DERR_VBUF_CREATE_FAILED";//: // (2061) - case D3DERR_VERTEXBUFFERLOCKED : // (2062) - return "D3DERR_VERTEXBUFFERLOCKED";//: // (2062) - case D3DERR_ZBUFFER_NOTPRESENT : // (2070) - return "D3DERR_ZBUFFER_NOTPRESENT";//: // (2070) - case D3DERR_STENCILBUFFER_NOTPRESENT : // (2071) - return "D3DERR_STENCILBUFFER_NOTPRESENT";//: // (2071) - case D3DERR_WRONGTEXTUREFORMAT : // (2072) - return "D3DERR_WRONGTEXTUREFORMAT";//: // (2072) - case D3DERR_UNSUPPORTEDCOLOROPERATION : // (2073) - return "D3DERR_UNSUPPORTEDCOLOROPERATION";//: // (2073) - case D3DERR_UNSUPPORTEDCOLORARG : // (2074) - return "D3DERR_UNSUPPORTEDCOLORARG";//: // (2074) - case D3DERR_UNSUPPORTEDALPHAOPERATION : // (2075) - return "D3DERR_UNSUPPORTEDALPHAOPERATION";//: // (2075) - case D3DERR_UNSUPPORTEDALPHAARG : // (2076) - return "D3DERR_UNSUPPORTEDALPHAARG";//: // (2076) - case D3DERR_TOOMANYOPERATIONS : // (2077) - return "D3DERR_TOOMANYOPERATIONS";//: // (2077) - case D3DERR_CONFLICTINGTEXTUREFILTER : // (2078) - return "D3DERR_CONFLICTINGTEXTUREFILTER";//: // (2078) - case D3DERR_UNSUPPORTEDFACTORVALUE : // (2079) - return "D3DERR_UNSUPPORTEDFACTORVALUE";//: // (2079) - case D3DERR_CONFLICTINGRENDERSTATE : // (2081) - return "D3DERR_CONFLICTINGRENDERSTATE";//: // (2081) - case D3DERR_UNSUPPORTEDTEXTUREFILTER : // (2082) - return "D3DERR_UNSUPPORTEDTEXTUREFILTER";//: // (2082) - case D3DERR_TOOMANYPRIMITIVES : // (2083) - return "D3DERR_TOOMANYPRIMITIVES";//: // (2083) - case D3DERR_INVALIDMATRIX : // (2084) - return "D3DERR_INVALIDMATRIX";//: // (2084) - case D3DERR_TOOMANYVERTICES : // (2085) - return "D3DERR_TOOMANYVERTICES";//: // (2085) - case D3DERR_CONFLICTINGTEXTUREPALETTE : // (2086) - return "D3DERR_CONFLICTINGTEXTUREPALETTE";//: // (2086) + case DD_OK: + return "No error.\0"; + case D3DERR_BADMAJORVERSION : // (700) + return "D3DERR_BADMAJORVERSION";//: // (700) + case D3DERR_BADMINORVERSION : // (701) + return "D3DERR_BADMINORVERSION";//: // (701) + case D3DERR_INVALID_DEVICE : // (705) + return "D3DERR_INVALID_DEVICE";//: // (705) + case D3DERR_INITFAILED : // (706) + return "D3DERR_INITFAILED";//: // (706) + case D3DERR_DEVICEAGGREGATED : // (707) + return "D3DERR_DEVICEAGGREGATED";//: // (707) + case D3DERR_EXECUTE_CREATE_FAILED : // (710) + return "D3DERR_EXECUTE_CREATE_FAILED";//: // (710) + case D3DERR_EXECUTE_DESTROY_FAILED : // (711) + return "D3DERR_EXECUTE_DESTROY_FAILED";//: // (711) + case D3DERR_EXECUTE_LOCK_FAILED : // (712) + return "D3DERR_EXECUTE_LOCK_FAILED";//: // (712) + case D3DERR_EXECUTE_UNLOCK_FAILED : // (713) + return "D3DERR_EXECUTE_UNLOCK_FAILED";//: // (713) + case D3DERR_EXECUTE_LOCKED : // (714) + return "D3DERR_EXECUTE_LOCKED";//: // (714) + case D3DERR_EXECUTE_NOT_LOCKED : // (715) + return "D3DERR_EXECUTE_NOT_LOCKED";//: // (715) + case D3DERR_EXECUTE_FAILED : // (716) + return "D3DERR_EXECUTE_FAILED";//: // (716) + case D3DERR_EXECUTE_CLIPPED_FAILED : // (717) + return "D3DERR_EXECUTE_CLIPPED_FAILED";//: // (717) + case D3DERR_TEXTURE_NO_SUPPORT : // (720) + return "D3DERR_TEXTURE_NO_SUPPORT";//: // (720) + case D3DERR_TEXTURE_CREATE_FAILED : // (721) + return "D3DERR_TEXTURE_CREATE_FAILED";//: // (721) + case D3DERR_TEXTURE_DESTROY_FAILED : // (722) + return "D3DERR_TEXTURE_DESTROY_FAILED";//: // (722) + case D3DERR_TEXTURE_LOCK_FAILED : // (723) + return "D3DERR_TEXTURE_LOCK_FAILED";//: // (723) + case D3DERR_TEXTURE_UNLOCK_FAILED : // (724) + return "D3DERR_TEXTURE_UNLOCK_FAILED";//: // (724) + case D3DERR_TEXTURE_LOAD_FAILED : // (725) + return "D3DERR_TEXTURE_LOAD_FAILED";//: // (725) + case D3DERR_TEXTURE_SWAP_FAILED : // (726) + return "D3DERR_TEXTURE_SWAP_FAILED";//: // (726) + case D3DERR_TEXTURE_LOCKED : // (727) + return "D3DERR_TEXTURE_LOCKED";//: // (727) + case D3DERR_TEXTURE_NOT_LOCKED : // (728) + return "D3DERR_TEXTURE_NOT_LOCKED";//: // (728) + case D3DERR_TEXTURE_GETSURF_FAILED : // (729) + return "D3DERR_TEXTURE_GETSURF_FAILED";//: // (729) + case D3DERR_MATRIX_CREATE_FAILED : // (730) + return "D3DERR_MATRIX_CREATE_FAILED";//: // (730) + case D3DERR_MATRIX_DESTROY_FAILED : // (731) + return "D3DERR_MATRIX_DESTROY_FAILED";//: // (731) + case D3DERR_MATRIX_SETDATA_FAILED : // (732) + return "D3DERR_MATRIX_SETDATA_FAILED";//: // (732) + case D3DERR_MATRIX_GETDATA_FAILED : // (733) + return "D3DERR_MATRIX_GETDATA_FAILED";//: // (733) + case D3DERR_SETVIEWPORTDATA_FAILED : // (734) + return "D3DERR_SETVIEWPORTDATA_FAILED";//: // (734) + case D3DERR_INVALIDCURRENTVIEWPORT : // (735) + return "D3DERR_INVALIDCURRENTVIEWPORT";//: // (735) + case D3DERR_INVALIDPRIMITIVETYPE : // (736) + return "D3DERR_INVALIDPRIMITIVETYPE";//: // (736) + case D3DERR_INVALIDVERTEXTYPE : // (737) + return "D3DERR_INVALIDVERTEXTYPE";//: // (737) + case D3DERR_TEXTURE_BADSIZE : // (738) + return "D3DERR_TEXTURE_BADSIZE";//: // (738) + case D3DERR_INVALIDRAMPTEXTURE : // (739) + return "D3DERR_INVALIDRAMPTEXTURE";//: // (739) + case D3DERR_MATERIAL_CREATE_FAILED : // (740) + return "D3DERR_MATERIAL_CREATE_FAILED";//: // (740) + case D3DERR_MATERIAL_DESTROY_FAILED : // (741) + return "D3DERR_MATERIAL_DESTROY_FAILED";//: // (741) + case D3DERR_MATERIAL_SETDATA_FAILED : // (742) + return "D3DERR_MATERIAL_SETDATA_FAILED";//: // (742) + case D3DERR_MATERIAL_GETDATA_FAILED : // (743) + return "D3DERR_MATERIAL_GETDATA_FAILED";//: // (743) + case D3DERR_INVALIDPALETTE : // (744) + return "D3DERR_INVALIDPALETTE";//: // (744) + case D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY : // (745) + return "D3DERR_ZBUFF_NEEDS_SYSTEMMEMORY";//: // (745) + case D3DERR_ZBUFF_NEEDS_VIDEOMEMORY : // (746) + return "D3DERR_ZBUFF_NEEDS_VIDEOMEMORY";//: // (746) + case D3DERR_SURFACENOTINVIDMEM : // (747) + return "D3DERR_SURFACENOTINVIDMEM";//: // (747) + case D3DERR_LIGHT_SET_FAILED : // (750) + return "D3DERR_LIGHT_SET_FAILED";//: // (750) + case D3DERR_LIGHTHASVIEWPORT : // (751) + return "D3DERR_LIGHTHASVIEWPORT";//: // (751) + case D3DERR_LIGHTNOTINTHISVIEWPORT : // (752) + return "D3DERR_LIGHTNOTINTHISVIEWPORT";//: // (752) + case D3DERR_SCENE_IN_SCENE : // (760) + return "D3DERR_SCENE_IN_SCENE";//: // (760) + case D3DERR_SCENE_NOT_IN_SCENE : // (761) + return "D3DERR_SCENE_NOT_IN_SCENE";//: // (761) + case D3DERR_SCENE_BEGIN_FAILED : // (762) + return "D3DERR_SCENE_BEGIN_FAILED";//: // (762) + case D3DERR_SCENE_END_FAILED : // (763) + return "D3DERR_SCENE_END_FAILED";//: // (763) + case D3DERR_INBEGIN : // (770) + return "D3DERR_INBEGIN";//: // (770) + case D3DERR_NOTINBEGIN : // (771) + return "D3DERR_NOTINBEGIN";//: // (771) + case D3DERR_NOVIEWPORTS : // (772) + return "D3DERR_NOVIEWPORTS";//: // (772) + case D3DERR_VIEWPORTDATANOTSET : // (773) + return "D3DERR_VIEWPORTDATANOTSET";//: // (773) + case D3DERR_VIEWPORTHASNODEVICE : // (774) + return "D3DERR_VIEWPORTHASNODEVICE";//: // (774) + case D3DERR_NOCURRENTVIEWPORT : // (775) + return "D3DERR_NOCURRENTVIEWPORT";//: // (775) + case D3DERR_INVALIDVERTEXFORMAT : // (2048) + return "D3DERR_INVALIDVERTEXFORMAT";//: // (2048) + case D3DERR_COLORKEYATTACHED : // (2050) + return "D3DERR_COLORKEYATTACHED";//: // (2050) + case D3DERR_VERTEXBUFFEROPTIMIZED : // (2060) + return "D3DERR_VERTEXBUFFEROPTIMIZED";//: // (2060) + case D3DERR_VBUF_CREATE_FAILED : // (2061) + return "D3DERR_VBUF_CREATE_FAILED";//: // (2061) + case D3DERR_VERTEXBUFFERLOCKED : // (2062) + return "D3DERR_VERTEXBUFFERLOCKED";//: // (2062) + case D3DERR_ZBUFFER_NOTPRESENT : // (2070) + return "D3DERR_ZBUFFER_NOTPRESENT";//: // (2070) + case D3DERR_STENCILBUFFER_NOTPRESENT : // (2071) + return "D3DERR_STENCILBUFFER_NOTPRESENT";//: // (2071) + case D3DERR_WRONGTEXTUREFORMAT : // (2072) + return "D3DERR_WRONGTEXTUREFORMAT";//: // (2072) + case D3DERR_UNSUPPORTEDCOLOROPERATION : // (2073) + return "D3DERR_UNSUPPORTEDCOLOROPERATION";//: // (2073) + case D3DERR_UNSUPPORTEDCOLORARG : // (2074) + return "D3DERR_UNSUPPORTEDCOLORARG";//: // (2074) + case D3DERR_UNSUPPORTEDALPHAOPERATION : // (2075) + return "D3DERR_UNSUPPORTEDALPHAOPERATION";//: // (2075) + case D3DERR_UNSUPPORTEDALPHAARG : // (2076) + return "D3DERR_UNSUPPORTEDALPHAARG";//: // (2076) + case D3DERR_TOOMANYOPERATIONS : // (2077) + return "D3DERR_TOOMANYOPERATIONS";//: // (2077) + case D3DERR_CONFLICTINGTEXTUREFILTER : // (2078) + return "D3DERR_CONFLICTINGTEXTUREFILTER";//: // (2078) + case D3DERR_UNSUPPORTEDFACTORVALUE : // (2079) + return "D3DERR_UNSUPPORTEDFACTORVALUE";//: // (2079) + case D3DERR_CONFLICTINGRENDERSTATE : // (2081) + return "D3DERR_CONFLICTINGRENDERSTATE";//: // (2081) + case D3DERR_UNSUPPORTEDTEXTUREFILTER : // (2082) + return "D3DERR_UNSUPPORTEDTEXTUREFILTER";//: // (2082) + case D3DERR_TOOMANYPRIMITIVES : // (2083) + return "D3DERR_TOOMANYPRIMITIVES";//: // (2083) + case D3DERR_INVALIDMATRIX : // (2084) + return "D3DERR_INVALIDMATRIX";//: // (2084) + case D3DERR_TOOMANYVERTICES : // (2085) + return "D3DERR_TOOMANYVERTICES";//: // (2085) + case D3DERR_CONFLICTINGTEXTUREPALETTE : // (2086) + return "D3DERR_CONFLICTINGTEXTUREPALETTE";//: // (2086) //#if DX7 - case D3DERR_VERTEXBUFFERUNLOCKFAILED : // (2063) - return "D3DERR_VERTEXBUFFERUNLOCKFAILED";//: // (2063) - case D3DERR_INVALIDSTATEBLOCK : // (2100) - return "D3DERR_INVALIDSTATEBLOCK";//: // (2100) - case D3DERR_INBEGINSTATEBLOCK : // (2101) - return "D3DERR_INBEGINSTATEBLOCK";//: // (2101) - case D3DERR_NOTINBEGINSTATEBLOCK : // (2102) - return "D3DERR_NOTINBEGINSTATEBLOCK";//: // (2102) + case D3DERR_VERTEXBUFFERUNLOCKFAILED : // (2063) + return "D3DERR_VERTEXBUFFERUNLOCKFAILED";//: // (2063) + case D3DERR_INVALIDSTATEBLOCK : // (2100) + return "D3DERR_INVALIDSTATEBLOCK";//: // (2100) + case D3DERR_INBEGINSTATEBLOCK : // (2101) + return "D3DERR_INBEGINSTATEBLOCK";//: // (2101) + case D3DERR_NOTINBEGINSTATEBLOCK : // (2102) + return "D3DERR_NOTINBEGINSTATEBLOCK";//: // (2102) //case D3DERR_INOVERLAYSTATEBLOCK : // (2103) // return "D3DERR_INOVERLAYSTATEBLOCK";//: // (2103) - case DDERR_NOSTEREOHARDWARE : // ( 181 ) - return "DDERR_NOSTEREOHARDWARE ";//: // ( 181 ) - case DDERR_NOSURFACELEFT : // ( 182 ) - return "DDERR_NOSURFACELEFT ";//: // ( 182 ) - case DDERR_DDSCAPSCOMPLEXREQUIRED : // ( 542 ) - return "DDERR_DDSCAPSCOMPLEXREQUIRED";//: // ( 542 ) - case DDERR_NOTONMIPMAPSUBLEVEL : // ( 603 ) - return "DDERR_NOTONMIPMAPSUBLEVEL";//: // ( 603 ) - case DDERR_TESTFINISHED : // ( 692 ) - return "DDERR_TESTFINISHED";//: // ( 692 ) - case DDERR_NEWMODE : // ( 693 ) - return "DDERR_NEWMODE";//: // ( 693 ) + case DDERR_NOSTEREOHARDWARE : // ( 181 ) + return "DDERR_NOSTEREOHARDWARE ";//: // ( 181 ) + case DDERR_NOSURFACELEFT : // ( 182 ) + return "DDERR_NOSURFACELEFT ";//: // ( 182 ) + case DDERR_DDSCAPSCOMPLEXREQUIRED : // ( 542 ) + return "DDERR_DDSCAPSCOMPLEXREQUIRED";//: // ( 542 ) + case DDERR_NOTONMIPMAPSUBLEVEL : // ( 603 ) + return "DDERR_NOTONMIPMAPSUBLEVEL";//: // ( 603 ) + case DDERR_TESTFINISHED : // ( 692 ) + return "DDERR_TESTFINISHED";//: // ( 692 ) + case DDERR_NEWMODE : // ( 693 ) + return "DDERR_NEWMODE";//: // ( 693 ) //#endif - //case D3DERR_COMMAND_UNPARSED : // (3000) - /// return "case";//D3DERR_COMMAND_UNPARSED : // (3000) + //case D3DERR_COMMAND_UNPARSED : // (3000) + /// return "case";//D3DERR_COMMAND_UNPARSED : // (3000) - case DDERR_ALREADYINITIALIZED : // ( 5 ) - return "DDERR_ALREADYINITIALIZED ";//: // ( 5 ) - case DDERR_CANNOTATTACHSURFACE : // ( 10 ) - return "DDERR_CANNOTATTACHSURFACE ";//: // ( 10 ) - case DDERR_CANNOTDETACHSURFACE : // ( 20 ) - return "DDERR_CANNOTDETACHSURFACE ";//: // ( 20 ) - case DDERR_CURRENTLYNOTAVAIL : // ( 40 ) - return "DDERR_CURRENTLYNOTAVAIL ";//: // ( 40 ) - case DDERR_EXCEPTION : // ( 55 ) - return "DDERR_EXCEPTION ";//: // ( 55 ) - case DDERR_HEIGHTALIGN : // ( 90 ) - return "DDERR_HEIGHTALIGN ";//: // ( 90 ) - case DDERR_INCOMPATIBLEPRIMARY : // ( 95 ) - return "DDERR_INCOMPATIBLEPRIMARY ";//: // ( 95 ) - case DDERR_INVALIDCAPS : // ( 100 ) - return "DDERR_INVALIDCAPS ";//: // ( 100 ) - case DDERR_INVALIDCLIPLIST : // ( 110 ) - return "DDERR_INVALIDCLIPLIST ";//: // ( 110 ) - case DDERR_INVALIDMODE : // ( 120 ) - return "DDERR_INVALIDMODE ";//: // ( 120 ) - case DDERR_INVALIDOBJECT : // ( 130 ) - return "DDERR_INVALIDOBJECT ";//: // ( 130 ) - case DDERR_INVALIDPIXELFORMAT : // ( 145 ) - return "DDERR_INVALIDPIXELFORMAT ";//: // ( 145 ) - case DDERR_INVALIDRECT : // ( 150 ) - return "DDERR_INVALIDRECT ";//: // ( 150 ) - case DDERR_LOCKEDSURFACES : // ( 160 ) - return "DDERR_LOCKEDSURFACES ";//: // ( 160 ) - case DDERR_NO3D : // ( 170 ) - return "DDERR_NO3D ";//: // ( 170 ) - case DDERR_NOALPHAHW : // ( 180 ) - return "DDERR_NOALPHAHW ";//: // ( 180 ) - case DDERR_NOCLIPLIST : // ( 205 ) - return "DDERR_NOCLIPLIST ";//: // ( 205 ) - case DDERR_NOCOLORCONVHW : // ( 210 ) - return "DDERR_NOCOLORCONVHW ";//: // ( 210 ) - case DDERR_NOCOOPERATIVELEVELSET : // ( 212 ) - return "DDERR_NOCOOPERATIVELEVELSET ";//: // ( 212 ) - case DDERR_NOCOLORKEY : // ( 215 ) - return "DDERR_NOCOLORKEY ";//: // ( 215 ) - case DDERR_NOCOLORKEYHW : // ( 220 ) - return "DDERR_NOCOLORKEYHW ";//: // ( 220 ) - case DDERR_NODIRECTDRAWSUPPORT : // ( 222 ) - return "DDERR_NODIRECTDRAWSUPPORT ";//: // ( 222 ) - case DDERR_NOEXCLUSIVEMODE : // ( 225 ) - return "DDERR_NOEXCLUSIVEMODE ";//: // ( 225 ) - case DDERR_NOFLIPHW : // ( 230 ) - return "DDERR_NOFLIPHW ";//: // ( 230 ) - case DDERR_NOGDI : // ( 240 ) - return "DDERR_NOGDI ";//: // ( 240 ) - case DDERR_NOMIRRORHW : // ( 250 ) - return "DDERR_NOMIRRORHW ";//: // ( 250 ) - case DDERR_NOTFOUND : // ( 255 ) - return "DDERR_NOTFOUND ";//: // ( 255 ) - case DDERR_NOOVERLAYHW : // ( 260 ) - return "DDERR_NOOVERLAYHW ";//: // ( 260 ) - case DDERR_OVERLAPPINGRECTS : // ( 270 ) - return "DDERR_OVERLAPPINGRECTS ";//: // ( 270 ) - case DDERR_NORASTEROPHW : // ( 280 ) - return "DDERR_NORASTEROPHW ";//: // ( 280 ) - case DDERR_NOROTATIONHW : // ( 290 ) - return "DDERR_NOROTATIONHW ";//: // ( 290 ) - case DDERR_NOSTRETCHHW : // ( 310 ) - return "DDERR_NOSTRETCHHW ";//: // ( 310 ) - case DDERR_NOT4BITCOLOR : // ( 316 ) - return "DDERR_NOT4BITCOLOR ";//: // ( 316 ) - case DDERR_NOT4BITCOLORINDEX : // ( 317 ) - return "DDERR_NOT4BITCOLORINDEX ";//: // ( 317 ) - case DDERR_NOT8BITCOLOR : // ( 320 ) - return "DDERR_NOT8BITCOLOR ";//: // ( 320 ) - case DDERR_NOTEXTUREHW : // ( 330 ) - return "DDERR_NOTEXTUREHW ";//: // ( 330 ) - case DDERR_NOVSYNCHW : // ( 335 ) - return "DDERR_NOVSYNCHW ";//: // ( 335 ) - case DDERR_NOZBUFFERHW : // ( 340 ) - return "DDERR_NOZBUFFERHW ";//: // ( 340 ) - case DDERR_NOZOVERLAYHW : // ( 350 ) - return "DDERR_NOZOVERLAYHW ";//: // ( 350 ) - case DDERR_OUTOFCAPS : // ( 360 ) - return "DDERR_OUTOFCAPS ";//: // ( 360 ) - case DDERR_OUTOFVIDEOMEMORY : // ( 380 ) - return "DDERR_OUTOFVIDEOMEMORY ";//: // ( 380 ) - case DDERR_OVERLAYCANTCLIP : // ( 382 ) - return "DDERR_OVERLAYCANTCLIP ";//: // ( 382 ) - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : // ( 384 ) - return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE ";//: // ( 384 ) - case DDERR_PALETTEBUSY : // ( 387 ) - return "DDERR_PALETTEBUSY ";//: // ( 387 ) - case DDERR_COLORKEYNOTSET : // ( 400 ) - return "DDERR_COLORKEYNOTSET ";//: // ( 400 ) - case DDERR_SURFACEALREADYATTACHED : // ( 410 ) - return "DDERR_SURFACEALREADYATTACHED ";//: // ( 410 ) - case DDERR_SURFACEALREADYDEPENDENT : // ( 420 ) - return "DDERR_SURFACEALREADYDEPENDENT ";//: // ( 420 ) - case DDERR_SURFACEBUSY : // ( 430 ) - return "DDERR_SURFACEBUSY ";//: // ( 430 ) - case DDERR_CANTLOCKSURFACE : // ( 435 ) - return "DDERR_CANTLOCKSURFACE";//: // ( 435 ) - case DDERR_SURFACEISOBSCURED : // ( 440 ) - return "DDERR_SURFACEISOBSCURED ";//: // ( 440 ) - case DDERR_SURFACELOST : // ( 450 ) - return "DDERR_SURFACELOST ";//: // ( 450 ) - case DDERR_SURFACENOTATTACHED : // ( 460 ) - return "DDERR_SURFACENOTATTACHED ";//: // ( 460 ) - case DDERR_TOOBIGHEIGHT : // ( 470 ) - return "DDERR_TOOBIGHEIGHT ";//: // ( 470 ) - case DDERR_TOOBIGSIZE : // ( 480 ) - return "DDERR_TOOBIGSIZE ";//: // ( 480 ) - case DDERR_TOOBIGWIDTH : // ( 490 ) - return "DDERR_TOOBIGWIDTH ";//: // ( 490 ) - case DDERR_UNSUPPORTEDFORMAT : // ( 510 ) - return "DDERR_UNSUPPORTEDFORMAT ";//: // ( 510 ) - case DDERR_UNSUPPORTEDMASK : // ( 520 ) - return "DDERR_UNSUPPORTEDMASK ";//: // ( 520 ) - case DDERR_INVALIDSTREAM : // ( 521 ) - return "DDERR_INVALIDSTREAM";//: // ( 521 ) - case DDERR_VERTICALBLANKINPROGRESS : // ( 537 ) - return "DDERR_VERTICALBLANKINPROGRESS ";//: // ( 537 ) - case DDERR_WASSTILLDRAWING : // ( 540 ) - return "DDERR_WASSTILLDRAWING ";//: // ( 540 ) - case DDERR_XALIGN : // ( 560 ) - return "DDERR_XALIGN ";//: // ( 560 ) - case DDERR_INVALIDDIRECTDRAWGUID : // ( 561 ) - return "DDERR_INVALIDDIRECTDRAWGUID ";//: // ( 561 ) - case DDERR_DIRECTDRAWALREADYCREATED : // ( 562 ) - return "DDERR_DIRECTDRAWALREADYCREATED ";//: // ( 562 ) - case DDERR_NODIRECTDRAWHW : // ( 563 ) - return "DDERR_NODIRECTDRAWHW ";//: // ( 563 ) - case DDERR_PRIMARYSURFACEALREADYEXISTS : // ( 564 ) - return "DDERR_PRIMARYSURFACEALREADYEXISTS ";//: // ( 564 ) - case DDERR_NOEMULATION : // ( 565 ) - return "DDERR_NOEMULATION ";//: // ( 565 ) - case DDERR_REGIONTOOSMALL : // ( 566 ) - return "DDERR_REGIONTOOSMALL ";//: // ( 566 ) - case DDERR_CLIPPERISUSINGHWND : // ( 567 ) - return "DDERR_CLIPPERISUSINGHWND ";//: // ( 567 ) - case DDERR_NOCLIPPERATTACHED : // ( 568 ) - return "DDERR_NOCLIPPERATTACHED ";//: // ( 568 ) - case DDERR_NOHWND : // ( 569 ) - return "DDERR_NOHWND ";//: // ( 569 ) - case DDERR_HWNDSUBCLASSED : // ( 570 ) - return "DDERR_HWNDSUBCLASSED ";//: // ( 570 ) - case DDERR_HWNDALREADYSET : // ( 571 ) - return "DDERR_HWNDALREADYSET ";//: // ( 571 ) - case DDERR_NOPALETTEATTACHED : // ( 572 ) - return "DDERR_NOPALETTEATTACHED ";//: // ( 572 ) - case DDERR_NOPALETTEHW : // ( 573 ) - return "DDERR_NOPALETTEHW ";//: // ( 573 ) - case DDERR_BLTFASTCANTCLIP : // ( 574 ) - return "DDERR_BLTFASTCANTCLIP ";//: // ( 574 ) - case DDERR_NOBLTHW : // ( 575 ) - return "DDERR_NOBLTHW ";//: // ( 575 ) - case DDERR_NODDROPSHW : // ( 576 ) - return "DDERR_NODDROPSHW ";//: // ( 576 ) - case DDERR_OVERLAYNOTVISIBLE : // ( 577 ) - return "DDERR_OVERLAYNOTVISIBLE ";//: // ( 577 ) - case DDERR_NOOVERLAYDEST : // ( 578 ) - return "DDERR_NOOVERLAYDEST ";//: // ( 578 ) - case DDERR_INVALIDPOSITION : // ( 579 ) - return "DDERR_INVALIDPOSITION ";//: // ( 579 ) - case DDERR_NOTAOVERLAYSURFACE : // ( 580 ) - return "DDERR_NOTAOVERLAYSURFACE ";//: // ( 580 ) - case DDERR_EXCLUSIVEMODEALREADYSET : // ( 581 ) - return "DDERR_EXCLUSIVEMODEALREADYSET ";//: // ( 581 ) - case DDERR_NOTFLIPPABLE : // ( 582 ) - return "DDERR_NOTFLIPPABLE ";//: // ( 582 ) - case DDERR_CANTDUPLICATE : // ( 583 ) - return "DDERR_CANTDUPLICATE ";//: // ( 583 ) - case DDERR_NOTLOCKED : // ( 584 ) - return "DDERR_NOTLOCKED ";//: // ( 584 ) - case DDERR_CANTCREATEDC : // ( 585 ) - return "DDERR_CANTCREATEDC ";//: // ( 585 ) - case DDERR_NODC : // ( 586 ) - return "DDERR_NODC ";//: // ( 586 ) - case DDERR_WRONGMODE : // ( 587 ) - return "DDERR_WRONGMODE ";//: // ( 587 ) - case DDERR_IMPLICITLYCREATED : // ( 588 ) - return "DDERR_IMPLICITLYCREATED ";//: // ( 588 ) - case DDERR_NOTPALETTIZED : // ( 589 ) - return "DDERR_NOTPALETTIZED ";//: // ( 589 ) - case DDERR_UNSUPPORTEDMODE : // ( 590 ) - return "DDERR_UNSUPPORTEDMODE ";//: // ( 590 ) - case DDERR_NOMIPMAPHW : // ( 591 ) - return "DDERR_NOMIPMAPHW ";//: // ( 591 ) - case DDERR_INVALIDSURFACETYPE : // ( 592 ) - return "DDERR_INVALIDSURFACETYPE";//: // ( 592 ) - case DDERR_NOOPTIMIZEHW : // ( 600 ) - return "DDERR_NOOPTIMIZEHW";//: // ( 600 ) - case DDERR_NOTLOADED : // ( 601 ) - return "DDERR_NOTLOADED";//: // ( 601 ) - case DDERR_NOFOCUSWINDOW : // ( 602 ) - return "DDERR_NOFOCUSWINDOW";//: // ( 602 ) - case DDERR_DCALREADYCREATED : // ( 620 ) - return "DDERR_DCALREADYCREATED ";//: // ( 620 ) - case DDERR_NONONLOCALVIDMEM : // ( 630 ) - return "DDERR_NONONLOCALVIDMEM";//: // ( 630 ) - case DDERR_CANTPAGELOCK : // ( 640 ) - return "DDERR_CANTPAGELOCK ";//: // ( 640 ) - case DDERR_CANTPAGEUNLOCK : // ( 660 ) - return "DDERR_CANTPAGEUNLOCK ";//: // ( 660 ) - case DDERR_NOTPAGELOCKED : // ( 680 ) - return "DDERR_NOTPAGELOCKED ";//: // ( 680 ) - case DDERR_MOREDATA : // ( 690 ) - return "DDERR_MOREDATA ";//: // ( 690 ) - case DDERR_EXPIRED : // ( 691 ) - return "DDERR_EXPIRED";//: // ( 691 ) - case DDERR_VIDEONOTACTIVE : // ( 695 ) - return "DDERR_VIDEONOTACTIVE ";//: // ( 695 ) - case DDERR_DEVICEDOESNTOWNSURFACE : // ( 699 ) - return "DDERR_DEVICEDOESNTOWNSURFACE ";//: // ( 699 ) - case DXFILEERR_BADOBJECT : // (850) - return "DXFILEERR_BADOBJECT";//: // (850) - case DXFILEERR_BADVALUE : // (851) - return "DXFILEERR_BADVALUE";//: // (851) - case DXFILEERR_BADTYPE : // (852) - return "DXFILEERR_BADTYPE";//: // (852) - case DXFILEERR_BADSTREAMHANDLE : // (853) - return "DXFILEERR_BADSTREAMHANDLE";//: // (853) - case DXFILEERR_BADALLOC : // (854) - return "DXFILEERR_BADALLOC";//: // (854) - case DXFILEERR_NOTFOUND : // (855) - return "DXFILEERR_NOTFOUND";//: // (855) - case DXFILEERR_NOTDONEYET : // (856) - return "DXFILEERR_NOTDONEYET";//: // (856) - case DXFILEERR_FILENOTFOUND : // (857) - return "DXFILEERR_FILENOTFOUND";//: // (857) - case DXFILEERR_RESOURCENOTFOUND : // (858) - return "DXFILEERR_RESOURCENOTFOUND";//: // (858) - case DXFILEERR_URLNOTFOUND : // (859) - return "DXFILEERR_URLNOTFOUND";//: // (859) - case DXFILEERR_BADRESOURCE : // (860) - return "DXFILEERR_BADRESOURCE";//: // (860) - case DXFILEERR_BADFILETYPE : // (861) - return "DXFILEERR_BADFILETYPE";//: // (861) - case DXFILEERR_BADFILEVERSION : // (862) - return "DXFILEERR_BADFILEVERSION";//: // (862) - case DXFILEERR_BADFILEFLOATSIZE : // (863) - return "DXFILEERR_BADFILEFLOATSIZE";//: // (863) - case DXFILEERR_BADFILECOMPRESSIONTYPE : // (864) - return "DXFILEERR_BADFILECOMPRESSIONTYPE";//: // (864) - case DXFILEERR_BADFILE : // (865) - return "DXFILEERR_BADFILE";//: // (865) - case DXFILEERR_PARSEERROR : // (866) - return "DXFILEERR_PARSEERROR";//: // (866) - case DXFILEERR_NOTEMPLATE : // (867) - return "DXFILEERR_NOTEMPLATE";//: // (867) - case DXFILEERR_BADARRAYSIZE : // (868) - return "DXFILEERR_BADARRAYSIZE";//: // (868) - case DXFILEERR_BADDATAREFERENCE : // (869) - return "DXFILEERR_BADDATAREFERENCE";//: // (869) - case DXFILEERR_INTERNALERROR : // (870) - return "DXFILEERR_INTERNALERROR";//: // (870) - case DXFILEERR_NOMOREOBJECTS : // (871) - return "DXFILEERR_NOMOREOBJECTS";//: // (871) - case DXFILEERR_BADINTRINSICS : // (872) - return "DXFILEERR_BADINTRINSICS";//: // (872) - case DXFILEERR_NOMORESTREAMHANDLES : // (873) - return "DXFILEERR_NOMORESTREAMHANDLES";//: // (873) - case DXFILEERR_NOMOREDATA : // (874) - return "DXFILEERR_NOMOREDATA";//: // (874) - case DXFILEERR_BADCACHEFILE : // (875) - return "DXFILEERR_BADCACHEFILE";//: // (875) - case DXFILEERR_NOINTERNET : // (876) - return "DXFILEERR_NOINTERNET";//: // (876) + case DDERR_ALREADYINITIALIZED : // ( 5 ) + return "DDERR_ALREADYINITIALIZED ";//: // ( 5 ) + case DDERR_CANNOTATTACHSURFACE : // ( 10 ) + return "DDERR_CANNOTATTACHSURFACE ";//: // ( 10 ) + case DDERR_CANNOTDETACHSURFACE : // ( 20 ) + return "DDERR_CANNOTDETACHSURFACE ";//: // ( 20 ) + case DDERR_CURRENTLYNOTAVAIL : // ( 40 ) + return "DDERR_CURRENTLYNOTAVAIL ";//: // ( 40 ) + case DDERR_EXCEPTION : // ( 55 ) + return "DDERR_EXCEPTION ";//: // ( 55 ) + case DDERR_HEIGHTALIGN : // ( 90 ) + return "DDERR_HEIGHTALIGN ";//: // ( 90 ) + case DDERR_INCOMPATIBLEPRIMARY : // ( 95 ) + return "DDERR_INCOMPATIBLEPRIMARY ";//: // ( 95 ) + case DDERR_INVALIDCAPS : // ( 100 ) + return "DDERR_INVALIDCAPS ";//: // ( 100 ) + case DDERR_INVALIDCLIPLIST : // ( 110 ) + return "DDERR_INVALIDCLIPLIST ";//: // ( 110 ) + case DDERR_INVALIDMODE : // ( 120 ) + return "DDERR_INVALIDMODE ";//: // ( 120 ) + case DDERR_INVALIDOBJECT : // ( 130 ) + return "DDERR_INVALIDOBJECT ";//: // ( 130 ) + case DDERR_INVALIDPIXELFORMAT : // ( 145 ) + return "DDERR_INVALIDPIXELFORMAT ";//: // ( 145 ) + case DDERR_INVALIDRECT : // ( 150 ) + return "DDERR_INVALIDRECT ";//: // ( 150 ) + case DDERR_LOCKEDSURFACES : // ( 160 ) + return "DDERR_LOCKEDSURFACES ";//: // ( 160 ) + case DDERR_NO3D : // ( 170 ) + return "DDERR_NO3D ";//: // ( 170 ) + case DDERR_NOALPHAHW : // ( 180 ) + return "DDERR_NOALPHAHW ";//: // ( 180 ) + case DDERR_NOCLIPLIST : // ( 205 ) + return "DDERR_NOCLIPLIST ";//: // ( 205 ) + case DDERR_NOCOLORCONVHW : // ( 210 ) + return "DDERR_NOCOLORCONVHW ";//: // ( 210 ) + case DDERR_NOCOOPERATIVELEVELSET : // ( 212 ) + return "DDERR_NOCOOPERATIVELEVELSET ";//: // ( 212 ) + case DDERR_NOCOLORKEY : // ( 215 ) + return "DDERR_NOCOLORKEY ";//: // ( 215 ) + case DDERR_NOCOLORKEYHW : // ( 220 ) + return "DDERR_NOCOLORKEYHW ";//: // ( 220 ) + case DDERR_NODIRECTDRAWSUPPORT : // ( 222 ) + return "DDERR_NODIRECTDRAWSUPPORT ";//: // ( 222 ) + case DDERR_NOEXCLUSIVEMODE : // ( 225 ) + return "DDERR_NOEXCLUSIVEMODE ";//: // ( 225 ) + case DDERR_NOFLIPHW : // ( 230 ) + return "DDERR_NOFLIPHW ";//: // ( 230 ) + case DDERR_NOGDI : // ( 240 ) + return "DDERR_NOGDI ";//: // ( 240 ) + case DDERR_NOMIRRORHW : // ( 250 ) + return "DDERR_NOMIRRORHW ";//: // ( 250 ) + case DDERR_NOTFOUND : // ( 255 ) + return "DDERR_NOTFOUND ";//: // ( 255 ) + case DDERR_NOOVERLAYHW : // ( 260 ) + return "DDERR_NOOVERLAYHW ";//: // ( 260 ) + case DDERR_OVERLAPPINGRECTS : // ( 270 ) + return "DDERR_OVERLAPPINGRECTS ";//: // ( 270 ) + case DDERR_NORASTEROPHW : // ( 280 ) + return "DDERR_NORASTEROPHW ";//: // ( 280 ) + case DDERR_NOROTATIONHW : // ( 290 ) + return "DDERR_NOROTATIONHW ";//: // ( 290 ) + case DDERR_NOSTRETCHHW : // ( 310 ) + return "DDERR_NOSTRETCHHW ";//: // ( 310 ) + case DDERR_NOT4BITCOLOR : // ( 316 ) + return "DDERR_NOT4BITCOLOR ";//: // ( 316 ) + case DDERR_NOT4BITCOLORINDEX : // ( 317 ) + return "DDERR_NOT4BITCOLORINDEX ";//: // ( 317 ) + case DDERR_NOT8BITCOLOR : // ( 320 ) + return "DDERR_NOT8BITCOLOR ";//: // ( 320 ) + case DDERR_NOTEXTUREHW : // ( 330 ) + return "DDERR_NOTEXTUREHW ";//: // ( 330 ) + case DDERR_NOVSYNCHW : // ( 335 ) + return "DDERR_NOVSYNCHW ";//: // ( 335 ) + case DDERR_NOZBUFFERHW : // ( 340 ) + return "DDERR_NOZBUFFERHW ";//: // ( 340 ) + case DDERR_NOZOVERLAYHW : // ( 350 ) + return "DDERR_NOZOVERLAYHW ";//: // ( 350 ) + case DDERR_OUTOFCAPS : // ( 360 ) + return "DDERR_OUTOFCAPS ";//: // ( 360 ) + case DDERR_OUTOFVIDEOMEMORY : // ( 380 ) + return "DDERR_OUTOFVIDEOMEMORY ";//: // ( 380 ) + case DDERR_OVERLAYCANTCLIP : // ( 382 ) + return "DDERR_OVERLAYCANTCLIP ";//: // ( 382 ) + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE : // ( 384 ) + return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE ";//: // ( 384 ) + case DDERR_PALETTEBUSY : // ( 387 ) + return "DDERR_PALETTEBUSY ";//: // ( 387 ) + case DDERR_COLORKEYNOTSET : // ( 400 ) + return "DDERR_COLORKEYNOTSET ";//: // ( 400 ) + case DDERR_SURFACEALREADYATTACHED : // ( 410 ) + return "DDERR_SURFACEALREADYATTACHED ";//: // ( 410 ) + case DDERR_SURFACEALREADYDEPENDENT : // ( 420 ) + return "DDERR_SURFACEALREADYDEPENDENT ";//: // ( 420 ) + case DDERR_SURFACEBUSY : // ( 430 ) + return "DDERR_SURFACEBUSY ";//: // ( 430 ) + case DDERR_CANTLOCKSURFACE : // ( 435 ) + return "DDERR_CANTLOCKSURFACE";//: // ( 435 ) + case DDERR_SURFACEISOBSCURED : // ( 440 ) + return "DDERR_SURFACEISOBSCURED ";//: // ( 440 ) + case DDERR_SURFACELOST : // ( 450 ) + return "DDERR_SURFACELOST ";//: // ( 450 ) + case DDERR_SURFACENOTATTACHED : // ( 460 ) + return "DDERR_SURFACENOTATTACHED ";//: // ( 460 ) + case DDERR_TOOBIGHEIGHT : // ( 470 ) + return "DDERR_TOOBIGHEIGHT ";//: // ( 470 ) + case DDERR_TOOBIGSIZE : // ( 480 ) + return "DDERR_TOOBIGSIZE ";//: // ( 480 ) + case DDERR_TOOBIGWIDTH : // ( 490 ) + return "DDERR_TOOBIGWIDTH ";//: // ( 490 ) + case DDERR_UNSUPPORTEDFORMAT : // ( 510 ) + return "DDERR_UNSUPPORTEDFORMAT ";//: // ( 510 ) + case DDERR_UNSUPPORTEDMASK : // ( 520 ) + return "DDERR_UNSUPPORTEDMASK ";//: // ( 520 ) + case DDERR_INVALIDSTREAM : // ( 521 ) + return "DDERR_INVALIDSTREAM";//: // ( 521 ) + case DDERR_VERTICALBLANKINPROGRESS : // ( 537 ) + return "DDERR_VERTICALBLANKINPROGRESS ";//: // ( 537 ) + case DDERR_WASSTILLDRAWING : // ( 540 ) + return "DDERR_WASSTILLDRAWING ";//: // ( 540 ) + case DDERR_XALIGN : // ( 560 ) + return "DDERR_XALIGN ";//: // ( 560 ) + case DDERR_INVALIDDIRECTDRAWGUID : // ( 561 ) + return "DDERR_INVALIDDIRECTDRAWGUID ";//: // ( 561 ) + case DDERR_DIRECTDRAWALREADYCREATED : // ( 562 ) + return "DDERR_DIRECTDRAWALREADYCREATED ";//: // ( 562 ) + case DDERR_NODIRECTDRAWHW : // ( 563 ) + return "DDERR_NODIRECTDRAWHW ";//: // ( 563 ) + case DDERR_PRIMARYSURFACEALREADYEXISTS : // ( 564 ) + return "DDERR_PRIMARYSURFACEALREADYEXISTS ";//: // ( 564 ) + case DDERR_NOEMULATION : // ( 565 ) + return "DDERR_NOEMULATION ";//: // ( 565 ) + case DDERR_REGIONTOOSMALL : // ( 566 ) + return "DDERR_REGIONTOOSMALL ";//: // ( 566 ) + case DDERR_CLIPPERISUSINGHWND : // ( 567 ) + return "DDERR_CLIPPERISUSINGHWND ";//: // ( 567 ) + case DDERR_NOCLIPPERATTACHED : // ( 568 ) + return "DDERR_NOCLIPPERATTACHED ";//: // ( 568 ) + case DDERR_NOHWND : // ( 569 ) + return "DDERR_NOHWND ";//: // ( 569 ) + case DDERR_HWNDSUBCLASSED : // ( 570 ) + return "DDERR_HWNDSUBCLASSED ";//: // ( 570 ) + case DDERR_HWNDALREADYSET : // ( 571 ) + return "DDERR_HWNDALREADYSET ";//: // ( 571 ) + case DDERR_NOPALETTEATTACHED : // ( 572 ) + return "DDERR_NOPALETTEATTACHED ";//: // ( 572 ) + case DDERR_NOPALETTEHW : // ( 573 ) + return "DDERR_NOPALETTEHW ";//: // ( 573 ) + case DDERR_BLTFASTCANTCLIP : // ( 574 ) + return "DDERR_BLTFASTCANTCLIP ";//: // ( 574 ) + case DDERR_NOBLTHW : // ( 575 ) + return "DDERR_NOBLTHW ";//: // ( 575 ) + case DDERR_NODDROPSHW : // ( 576 ) + return "DDERR_NODDROPSHW ";//: // ( 576 ) + case DDERR_OVERLAYNOTVISIBLE : // ( 577 ) + return "DDERR_OVERLAYNOTVISIBLE ";//: // ( 577 ) + case DDERR_NOOVERLAYDEST : // ( 578 ) + return "DDERR_NOOVERLAYDEST ";//: // ( 578 ) + case DDERR_INVALIDPOSITION : // ( 579 ) + return "DDERR_INVALIDPOSITION ";//: // ( 579 ) + case DDERR_NOTAOVERLAYSURFACE : // ( 580 ) + return "DDERR_NOTAOVERLAYSURFACE ";//: // ( 580 ) + case DDERR_EXCLUSIVEMODEALREADYSET : // ( 581 ) + return "DDERR_EXCLUSIVEMODEALREADYSET ";//: // ( 581 ) + case DDERR_NOTFLIPPABLE : // ( 582 ) + return "DDERR_NOTFLIPPABLE ";//: // ( 582 ) + case DDERR_CANTDUPLICATE : // ( 583 ) + return "DDERR_CANTDUPLICATE ";//: // ( 583 ) + case DDERR_NOTLOCKED : // ( 584 ) + return "DDERR_NOTLOCKED ";//: // ( 584 ) + case DDERR_CANTCREATEDC : // ( 585 ) + return "DDERR_CANTCREATEDC ";//: // ( 585 ) + case DDERR_NODC : // ( 586 ) + return "DDERR_NODC ";//: // ( 586 ) + case DDERR_WRONGMODE : // ( 587 ) + return "DDERR_WRONGMODE ";//: // ( 587 ) + case DDERR_IMPLICITLYCREATED : // ( 588 ) + return "DDERR_IMPLICITLYCREATED ";//: // ( 588 ) + case DDERR_NOTPALETTIZED : // ( 589 ) + return "DDERR_NOTPALETTIZED ";//: // ( 589 ) + case DDERR_UNSUPPORTEDMODE : // ( 590 ) + return "DDERR_UNSUPPORTEDMODE ";//: // ( 590 ) + case DDERR_NOMIPMAPHW : // ( 591 ) + return "DDERR_NOMIPMAPHW ";//: // ( 591 ) + case DDERR_INVALIDSURFACETYPE : // ( 592 ) + return "DDERR_INVALIDSURFACETYPE";//: // ( 592 ) + case DDERR_NOOPTIMIZEHW : // ( 600 ) + return "DDERR_NOOPTIMIZEHW";//: // ( 600 ) + case DDERR_NOTLOADED : // ( 601 ) + return "DDERR_NOTLOADED";//: // ( 601 ) + case DDERR_NOFOCUSWINDOW : // ( 602 ) + return "DDERR_NOFOCUSWINDOW";//: // ( 602 ) + case DDERR_DCALREADYCREATED : // ( 620 ) + return "DDERR_DCALREADYCREATED ";//: // ( 620 ) + case DDERR_NONONLOCALVIDMEM : // ( 630 ) + return "DDERR_NONONLOCALVIDMEM";//: // ( 630 ) + case DDERR_CANTPAGELOCK : // ( 640 ) + return "DDERR_CANTPAGELOCK ";//: // ( 640 ) + case DDERR_CANTPAGEUNLOCK : // ( 660 ) + return "DDERR_CANTPAGEUNLOCK ";//: // ( 660 ) + case DDERR_NOTPAGELOCKED : // ( 680 ) + return "DDERR_NOTPAGELOCKED ";//: // ( 680 ) + case DDERR_MOREDATA : // ( 690 ) + return "DDERR_MOREDATA ";//: // ( 690 ) + case DDERR_EXPIRED : // ( 691 ) + return "DDERR_EXPIRED";//: // ( 691 ) + case DDERR_VIDEONOTACTIVE : // ( 695 ) + return "DDERR_VIDEONOTACTIVE ";//: // ( 695 ) + case DDERR_DEVICEDOESNTOWNSURFACE : // ( 699 ) + return "DDERR_DEVICEDOESNTOWNSURFACE ";//: // ( 699 ) + case DXFILEERR_BADOBJECT : // (850) + return "DXFILEERR_BADOBJECT";//: // (850) + case DXFILEERR_BADVALUE : // (851) + return "DXFILEERR_BADVALUE";//: // (851) + case DXFILEERR_BADTYPE : // (852) + return "DXFILEERR_BADTYPE";//: // (852) + case DXFILEERR_BADSTREAMHANDLE : // (853) + return "DXFILEERR_BADSTREAMHANDLE";//: // (853) + case DXFILEERR_BADALLOC : // (854) + return "DXFILEERR_BADALLOC";//: // (854) + case DXFILEERR_NOTFOUND : // (855) + return "DXFILEERR_NOTFOUND";//: // (855) + case DXFILEERR_NOTDONEYET : // (856) + return "DXFILEERR_NOTDONEYET";//: // (856) + case DXFILEERR_FILENOTFOUND : // (857) + return "DXFILEERR_FILENOTFOUND";//: // (857) + case DXFILEERR_RESOURCENOTFOUND : // (858) + return "DXFILEERR_RESOURCENOTFOUND";//: // (858) + case DXFILEERR_URLNOTFOUND : // (859) + return "DXFILEERR_URLNOTFOUND";//: // (859) + case DXFILEERR_BADRESOURCE : // (860) + return "DXFILEERR_BADRESOURCE";//: // (860) + case DXFILEERR_BADFILETYPE : // (861) + return "DXFILEERR_BADFILETYPE";//: // (861) + case DXFILEERR_BADFILEVERSION : // (862) + return "DXFILEERR_BADFILEVERSION";//: // (862) + case DXFILEERR_BADFILEFLOATSIZE : // (863) + return "DXFILEERR_BADFILEFLOATSIZE";//: // (863) + case DXFILEERR_BADFILECOMPRESSIONTYPE : // (864) + return "DXFILEERR_BADFILECOMPRESSIONTYPE";//: // (864) + case DXFILEERR_BADFILE : // (865) + return "DXFILEERR_BADFILE";//: // (865) + case DXFILEERR_PARSEERROR : // (866) + return "DXFILEERR_PARSEERROR";//: // (866) + case DXFILEERR_NOTEMPLATE : // (867) + return "DXFILEERR_NOTEMPLATE";//: // (867) + case DXFILEERR_BADARRAYSIZE : // (868) + return "DXFILEERR_BADARRAYSIZE";//: // (868) + case DXFILEERR_BADDATAREFERENCE : // (869) + return "DXFILEERR_BADDATAREFERENCE";//: // (869) + case DXFILEERR_INTERNALERROR : // (870) + return "DXFILEERR_INTERNALERROR";//: // (870) + case DXFILEERR_NOMOREOBJECTS : // (871) + return "DXFILEERR_NOMOREOBJECTS";//: // (871) + case DXFILEERR_BADINTRINSICS : // (872) + return "DXFILEERR_BADINTRINSICS";//: // (872) + case DXFILEERR_NOMORESTREAMHANDLES : // (873) + return "DXFILEERR_NOMORESTREAMHANDLES";//: // (873) + case DXFILEERR_NOMOREDATA : // (874) + return "DXFILEERR_NOMOREDATA";//: // (874) + case DXFILEERR_BADCACHEFILE : // (875) + return "DXFILEERR_BADCACHEFILE";//: // (875) + case DXFILEERR_NOINTERNET : // (876) + return "DXFILEERR_NOINTERNET";//: // (876) - case E_UNEXPECTED : - return "E_UNEXPECTED "; - case E_NOTIMPL : - return "E_NOTIMPL "; - case E_OUTOFMEMORY : - return "E_OUTOFMEMORY "; - case E_INVALIDARG : - return "E_INVALIDARG or DDERR_INVALIDPARAMS"; - case E_NOINTERFACE : - return "E_NOINTERFACE "; - case E_POINTER : - return "E_POINTER "; - case E_HANDLE : - return "E_HANDLE "; - case E_ABORT : - return "E_ABORT "; + case E_UNEXPECTED : + return "E_UNEXPECTED "; + case E_NOTIMPL : + return "E_NOTIMPL "; + case E_OUTOFMEMORY : + return "E_OUTOFMEMORY "; + case E_INVALIDARG : + return "E_INVALIDARG or DDERR_INVALIDPARAMS"; + case E_NOINTERFACE : + return "E_NOINTERFACE "; + case E_POINTER : + return "E_POINTER "; + case E_HANDLE : + return "E_HANDLE "; + case E_ABORT : + return "E_ABORT "; // case E_FAIL : // return "E_FAIL "; - case E_ACCESSDENIED : - return "E_ACCESSDENIED "; - case E_PENDING : - return "E_PENDING "; - case CO_E_INIT_TLS : - return "CO_E_INIT_TLS "; - case CO_E_INIT_SHARED_ALLOCATOR : - return "CO_E_INIT_SHARED_ALLOCATOR "; - case CO_E_INIT_MEMORY_ALLOCATOR : - return "CO_E_INIT_MEMORY_ALLOCATOR "; - case CO_E_INIT_CLASS_CACHE : - return "CO_E_INIT_CLASS_CACHE "; - case CO_E_INIT_RPC_CHANNEL : - return "CO_E_INIT_RPC_CHANNEL "; - case CO_E_INIT_TLS_SET_CHANNEL_CONTROL : - return "CO_E_INIT_TLS_SET_CHANNEL_CONTROL "; - case CO_E_INIT_TLS_CHANNEL_CONTROL : - return "CO_E_INIT_TLS_CHANNEL_CONTROL "; - case CO_E_INIT_UNACCEPTED_USER_ALLOCATOR : - return "CO_E_INIT_UNACCEPTED_USER_ALLOCATOR "; - case CO_E_INIT_SCM_MUTEX_EXISTS : - return "CO_E_INIT_SCM_MUTEX_EXISTS "; - case CO_E_INIT_SCM_FILE_MAPPING_EXISTS : - return "CO_E_INIT_SCM_FILE_MAPPING_EXISTS "; - case CO_E_INIT_SCM_MAP_VIEW_OF_FILE : - return "CO_E_INIT_SCM_MAP_VIEW_OF_FILE "; - case CO_E_INIT_SCM_EXEC_FAILURE : - return "CO_E_INIT_SCM_EXEC_FAILURE "; - case CO_E_INIT_ONLY_SINGLE_THREADED : - return "CO_E_INIT_ONLY_SINGLE_THREADED "; - case CO_E_CANT_REMOTE : - return "CO_E_CANT_REMOTE "; - case CO_E_BAD_SERVER_NAME : - return "CO_E_BAD_SERVER_NAME "; - case CO_E_WRONG_SERVER_IDENTITY : - return "CO_E_WRONG_SERVER_IDENTITY "; - case CO_E_OLE1DDE_DISABLED : - return "CO_E_OLE1DDE_DISABLED "; - case CO_E_RUNAS_SYNTAX : - return "CO_E_RUNAS_SYNTAX "; - case CO_E_CREATEPROCESS_FAILURE : - return "CO_E_CREATEPROCESS_FAILURE "; - case CO_E_RUNAS_CREATEPROCESS_FAILURE : - return "CO_E_RUNAS_CREATEPROCESS_FAILURE "; - case CO_E_RUNAS_LOGON_FAILURE : - return "CO_E_RUNAS_LOGON_FAILURE "; - case CO_E_LAUNCH_PERMSSION_DENIED : - return "CO_E_LAUNCH_PERMSSION_DENIED "; - case CO_E_START_SERVICE_FAILURE : - return "CO_E_START_SERVICE_FAILURE "; - case CO_E_REMOTE_COMMUNICATION_FAILURE : - return "CO_E_REMOTE_COMMUNICATION_FAILURE "; - case CO_E_SERVER_START_TIMEOUT : - return "CO_E_SERVER_START_TIMEOUT "; - case CO_E_CLSREG_INCONSISTENT : - return "CO_E_CLSREG_INCONSISTENT "; - case CO_E_IIDREG_INCONSISTENT : - return "CO_E_IIDREG_INCONSISTENT "; - case CO_E_NOT_SUPPORTED : - return "CO_E_NOT_SUPPORTED "; - case CO_E_RELOAD_DLL : - return "CO_E_RELOAD_DLL "; - case CO_E_MSI_ERROR : - return "CO_E_MSI_ERROR "; - case OLE_E_OLEVERB : - return "OLE_E_OLEVERB "; - case OLE_E_ADVF : - return "OLE_E_ADVF "; - case OLE_E_ENUM_NOMORE : - return "OLE_E_ENUM_NOMORE "; - case OLE_E_ADVISENOTSUPPORTED : - return "OLE_E_ADVISENOTSUPPORTED "; - case OLE_E_NOCONNECTION : - return "OLE_E_NOCONNECTION "; - case OLE_E_NOTRUNNING : - return "OLE_E_NOTRUNNING "; - case OLE_E_NOCACHE : - return "OLE_E_NOCACHE "; - case OLE_E_BLANK : - return "OLE_E_BLANK "; - case OLE_E_CLASSDIFF : - return "OLE_E_CLASSDIFF "; - case OLE_E_CANT_GETMONIKER : - return "OLE_E_CANT_GETMONIKER "; - case OLE_E_CANT_BINDTOSOURCE : - return "OLE_E_CANT_BINDTOSOURCE "; - case OLE_E_STATIC : - return "OLE_E_STATIC "; - case OLE_E_PROMPTSAVECANCELLED : - return "OLE_E_PROMPTSAVECANCELLED "; - case OLE_E_INVALIDRECT : - return "OLE_E_INVALIDRECT "; - case OLE_E_WRONGCOMPOBJ : - return "OLE_E_WRONGCOMPOBJ "; - case OLE_E_INVALIDHWND : - return "OLE_E_INVALIDHWND "; - case OLE_E_NOT_INPLACEACTIVE : - return "OLE_E_NOT_INPLACEACTIVE "; - case OLE_E_CANTCONVERT : - return "OLE_E_CANTCONVERT "; - case OLE_E_NOSTORAGE : - return "OLE_E_NOSTORAGE "; - case DV_E_FORMATETC : - return "DV_E_FORMATETC "; - case DV_E_DVTARGETDEVICE : - return "DV_E_DVTARGETDEVICE "; - case DV_E_STGMEDIUM : - return "DV_E_STGMEDIUM "; - case DV_E_STATDATA : - return "DV_E_STATDATA "; - case DV_E_LINDEX : - return "DV_E_LINDEX "; - case DV_E_TYMED : - return "DV_E_TYMED "; - case DV_E_CLIPFORMAT : - return "DV_E_CLIPFORMAT "; - case DV_E_DVASPECT : - return "DV_E_DVASPECT "; - case DV_E_DVTARGETDEVICE_SIZE : - return "DV_E_DVTARGETDEVICE_SIZE "; - case DV_E_NOIVIEWOBJECT : - return "DV_E_NOIVIEWOBJECT "; - case DRAGDROP_E_NOTREGISTERED : - return "DRAGDROP_E_NOTREGISTERED "; - case DRAGDROP_E_ALREADYREGISTERED : - return "DRAGDROP_E_ALREADYREGISTERED "; - case DRAGDROP_E_INVALIDHWND : - return "DRAGDROP_E_INVALIDHWND "; - case CLASS_E_NOAGGREGATION : - return "CLASS_E_NOAGGREGATION "; - case CLASS_E_CLASSNOTAVAILABLE : - return "CLASS_E_CLASSNOTAVAILABLE "; - case CLASS_E_NOTLICENSED : - return "CLASS_E_NOTLICENSED "; - case VIEW_E_DRAW : - return "VIEW_E_DRAW "; - case REGDB_E_READREGDB : - return "REGDB_E_READREGDB "; - case REGDB_E_WRITEREGDB : - return "REGDB_E_WRITEREGDB "; - case REGDB_E_KEYMISSING : - return "REGDB_E_KEYMISSING "; - case REGDB_E_INVALIDVALUE : - return "REGDB_E_INVALIDVALUE "; - case REGDB_E_CLASSNOTREG : - return "REGDB_E_CLASSNOTREG "; - case REGDB_E_IIDNOTREG : - return "REGDB_E_IIDNOTREG "; - case CAT_E_CATIDNOEXIST : - return "CAT_E_CATIDNOEXIST "; - case CAT_E_NODESCRIPTION : - return "CAT_E_NODESCRIPTION "; - case CS_E_PACKAGE_NOTFOUND : - return "CS_E_PACKAGE_NOTFOUND "; - case CS_E_NOT_DELETABLE : - return "CS_E_NOT_DELETABLE "; - case CS_E_CLASS_NOTFOUND : - return "CS_E_CLASS_NOTFOUND "; - case CS_E_INVALID_VERSION : - return "CS_E_INVALID_VERSION "; - case CS_E_NO_CLASSSTORE : - return "CS_E_NO_CLASSSTORE "; - case CACHE_E_NOCACHE_UPDATED : - return "CACHE_E_NOCACHE_UPDATED "; - case OLEOBJ_E_NOVERBS : - return "OLEOBJ_E_NOVERBS "; - case OLEOBJ_E_INVALIDVERB : - return "OLEOBJ_E_INVALIDVERB "; - case INPLACE_E_NOTUNDOABLE : - return "INPLACE_E_NOTUNDOABLE "; - case INPLACE_E_NOTOOLSPACE : - return "INPLACE_E_NOTOOLSPACE "; - case CONVERT10_E_OLESTREAM_GET : - return "CONVERT10_E_OLESTREAM_GET "; - case CONVERT10_E_OLESTREAM_PUT : - return "CONVERT10_E_OLESTREAM_PUT "; - case CONVERT10_E_OLESTREAM_FMT : - return "CONVERT10_E_OLESTREAM_FMT "; - case CONVERT10_E_OLESTREAM_BITMAP_TO_DIB : - return "CONVERT10_E_OLESTREAM_BITMAP_TO_DIB "; - case CONVERT10_E_STG_FMT : - return "CONVERT10_E_STG_FMT "; - case CONVERT10_E_STG_NO_STD_STREAM : - return "CONVERT10_E_STG_NO_STD_STREAM "; - case CONVERT10_E_STG_DIB_TO_BITMAP : - return "CONVERT10_E_STG_DIB_TO_BITMAP "; - case CLIPBRD_E_CANT_OPEN : - return "CLIPBRD_E_CANT_OPEN "; - case CLIPBRD_E_CANT_EMPTY : - return "CLIPBRD_E_CANT_EMPTY "; - case CLIPBRD_E_CANT_SET : - return "CLIPBRD_E_CANT_SET "; - case CLIPBRD_E_BAD_DATA : - return "CLIPBRD_E_BAD_DATA "; - case CLIPBRD_E_CANT_CLOSE : - return "CLIPBRD_E_CANT_CLOSE "; - case MK_E_CONNECTMANUALLY : - return "MK_E_CONNECTMANUALLY "; - case MK_E_EXCEEDEDDEADLINE : - return "MK_E_EXCEEDEDDEADLINE "; - case MK_E_NEEDGENERIC : - return "MK_E_NEEDGENERIC "; - case MK_E_UNAVAILABLE : - return "MK_E_UNAVAILABLE "; - case MK_E_SYNTAX : - return "MK_E_SYNTAX "; - case MK_E_NOOBJECT : - return "MK_E_NOOBJECT "; - case MK_E_INVALIDEXTENSION : - return "MK_E_INVALIDEXTENSION "; - case MK_E_INTERMEDIATEINTERFACENOTSUPPORTED : - return "MK_E_INTERMEDIATEINTERFACENOTSUPPORTED "; - case MK_E_NOTBINDABLE : - return "MK_E_NOTBINDABLE "; - case MK_E_NOTBOUND : - return "MK_E_NOTBOUND "; - case MK_E_CANTOPENFILE : - return "MK_E_CANTOPENFILE "; - case MK_E_MUSTBOTHERUSER : - return "MK_E_MUSTBOTHERUSER "; - case MK_E_NOINVERSE : - return "MK_E_NOINVERSE "; - case MK_E_NOSTORAGE : - return "MK_E_NOSTORAGE "; - case MK_E_NOPREFIX : - return "MK_E_NOPREFIX "; - case MK_E_ENUMERATION_FAILED : - return "MK_E_ENUMERATION_FAILED "; - case CO_E_NOTINITIALIZED : - return "CO_E_NOTINITIALIZED "; - case CO_E_ALREADYINITIALIZED : - return "CO_E_ALREADYINITIALIZED "; - case CO_E_CANTDETERMINECLASS : - return "CO_E_CANTDETERMINECLASS "; - case CO_E_CLASSSTRING : - return "CO_E_CLASSSTRING "; - case CO_E_IIDSTRING : - return "CO_E_IIDSTRING "; - case CO_E_APPNOTFOUND : - return "CO_E_APPNOTFOUND "; - case CO_E_APPSINGLEUSE : - return "CO_E_APPSINGLEUSE "; - case CO_E_ERRORINAPP : - return "CO_E_ERRORINAPP "; - case CO_E_DLLNOTFOUND : - return "CO_E_DLLNOTFOUND "; - case CO_E_ERRORINDLL : - return "CO_E_ERRORINDLL "; - case CO_E_WRONGOSFORAPP : - return "CO_E_WRONGOSFORAPP "; - case CO_E_OBJNOTREG : - return "CO_E_OBJNOTREG "; - case CO_E_OBJISREG : - return "CO_E_OBJISREG "; - case CO_E_OBJNOTCONNECTED : - return "CO_E_OBJNOTCONNECTED "; - case CO_E_APPDIDNTREG : - return "CO_E_APPDIDNTREG "; - case CO_E_RELEASED : - return "CO_E_RELEASED "; - case CO_E_FAILEDTOIMPERSONATE : - return "CO_E_FAILEDTOIMPERSONATE "; - case CO_E_FAILEDTOGETSECCTX : - return "CO_E_FAILEDTOGETSECCTX "; - case CO_E_FAILEDTOOPENTHREADTOKEN : - return "CO_E_FAILEDTOOPENTHREADTOKEN "; - case CO_E_FAILEDTOGETTOKENINFO : - return "CO_E_FAILEDTOGETTOKENINFO "; - case CO_E_TRUSTEEDOESNTMATCHCLIENT : - return "CO_E_TRUSTEEDOESNTMATCHCLIENT "; - case CO_E_FAILEDTOQUERYCLIENTBLANKET : - return "CO_E_FAILEDTOQUERYCLIENTBLANKET "; - case CO_E_FAILEDTOSETDACL : - return "CO_E_FAILEDTOSETDACL "; - case CO_E_ACCESSCHECKFAILED : - return "CO_E_ACCESSCHECKFAILED "; - case CO_E_NETACCESSAPIFAILED : - return "CO_E_NETACCESSAPIFAILED "; - case CO_E_WRONGTRUSTEENAMESYNTAX : - return "CO_E_WRONGTRUSTEENAMESYNTAX "; - case CO_E_INVALIDSID : - return "CO_E_INVALIDSID "; - case CO_E_CONVERSIONFAILED : - return "CO_E_CONVERSIONFAILED "; - case CO_E_NOMATCHINGSIDFOUND : - return "CO_E_NOMATCHINGSIDFOUND "; - case CO_E_LOOKUPACCSIDFAILED : - return "CO_E_LOOKUPACCSIDFAILED "; - case CO_E_NOMATCHINGNAMEFOUND : - return "CO_E_NOMATCHINGNAMEFOUND "; - case CO_E_LOOKUPACCNAMEFAILED : - return "CO_E_LOOKUPACCNAMEFAILED "; - case CO_E_SETSERLHNDLFAILED : - return "CO_E_SETSERLHNDLFAILED "; - case CO_E_FAILEDTOGETWINDIR : - return "CO_E_FAILEDTOGETWINDIR "; - case CO_E_PATHTOOLONG : - return "CO_E_PATHTOOLONG "; - case CO_E_FAILEDTOGENUUID : - return "CO_E_FAILEDTOGENUUID "; - case CO_E_FAILEDTOCREATEFILE : - return "CO_E_FAILEDTOCREATEFILE "; - case CO_E_FAILEDTOCLOSEHANDLE : - return "CO_E_FAILEDTOCLOSEHANDLE "; - case CO_E_EXCEEDSYSACLLIMIT : - return "CO_E_EXCEEDSYSACLLIMIT "; - case CO_E_ACESINWRONGORDER : - return "CO_E_ACESINWRONGORDER "; - case CO_E_INCOMPATIBLESTREAMVERSION : - return "CO_E_INCOMPATIBLESTREAMVERSION "; - case CO_E_FAILEDTOOPENPROCESSTOKEN : - return "CO_E_FAILEDTOOPENPROCESSTOKEN "; - case CO_E_DECODEFAILED : - return "CO_E_DECODEFAILED "; - case CO_E_ACNOTINITIALIZED : - return "CO_E_ACNOTINITIALIZED "; - case OLE_S_USEREG : - return "OLE_S_USEREG "; - case OLE_S_STATIC : - return "OLE_S_STATIC "; - case OLE_S_MAC_CLIPFORMAT : - return "OLE_S_MAC_CLIPFORMAT "; - case DRAGDROP_S_DROP : - return "DRAGDROP_S_DROP "; - case DRAGDROP_S_CANCEL : - return "DRAGDROP_S_CANCEL "; - case DRAGDROP_S_USEDEFAULTCURSORS : - return "DRAGDROP_S_USEDEFAULTCURSORS "; - case DATA_S_SAMEFORMATETC : - return "DATA_S_SAMEFORMATETC "; - case VIEW_S_ALREADY_FROZEN : - return "VIEW_S_ALREADY_FROZEN "; - case CACHE_S_FORMATETC_NOTSUPPORTED : - return "CACHE_S_FORMATETC_NOTSUPPORTED "; - case CACHE_S_SAMECACHE : - return "CACHE_S_SAMECACHE "; - case CACHE_S_SOMECACHES_NOTUPDATED : - return "CACHE_S_SOMECACHES_NOTUPDATED "; - case OLEOBJ_S_INVALIDVERB : - return "OLEOBJ_S_INVALIDVERB "; - case OLEOBJ_S_CANNOT_DOVERB_NOW : - return "OLEOBJ_S_CANNOT_DOVERB_NOW "; - case OLEOBJ_S_INVALIDHWND : - return "OLEOBJ_S_INVALIDHWND "; - case INPLACE_S_TRUNCATED : - return "INPLACE_S_TRUNCATED "; - case CONVERT10_S_NO_PRESENTATION : - return "CONVERT10_S_NO_PRESENTATION "; - case MK_S_REDUCED_TO_SELF : - return "MK_S_REDUCED_TO_SELF "; - case MK_S_ME : - return "MK_S_ME "; - case MK_S_HIM : - return "MK_S_HIM "; - case MK_S_US : - return "MK_S_US "; - case MK_S_MONIKERALREADYREGISTERED : - return "MK_S_MONIKERALREADYREGISTERED "; - case CO_E_CLASS_CREATE_FAILED : - return "CO_E_CLASS_CREATE_FAILED "; - case CO_E_SCM_ERROR : - return "CO_E_SCM_ERROR "; - case CO_E_SCM_RPC_FAILURE : - return "CO_E_SCM_RPC_FAILURE "; - case CO_E_BAD_PATH : - return "CO_E_BAD_PATH "; - case CO_E_SERVER_EXEC_FAILURE : - return "CO_E_SERVER_EXEC_FAILURE "; - case CO_E_OBJSRV_RPC_FAILURE : - return "CO_E_OBJSRV_RPC_FAILURE "; - case MK_E_NO_NORMALIZED : - return "MK_E_NO_NORMALIZED "; - case CO_E_SERVER_STOPPING : - return "CO_E_SERVER_STOPPING "; - case MEM_E_INVALID_ROOT : - return "MEM_E_INVALID_ROOT "; - case MEM_E_INVALID_LINK : - return "MEM_E_INVALID_LINK "; - case MEM_E_INVALID_SIZE : - return "MEM_E_INVALID_SIZE "; - case CO_S_NOTALLINTERFACES : - return "CO_S_NOTALLINTERFACES "; - case DISP_E_UNKNOWNINTERFACE : - return "DISP_E_UNKNOWNINTERFACE "; - case DISP_E_MEMBERNOTFOUND : - return "DISP_E_MEMBERNOTFOUND "; - case DISP_E_PARAMNOTFOUND : - return "DISP_E_PARAMNOTFOUND "; - case DISP_E_TYPEMISMATCH : - return "DISP_E_TYPEMISMATCH "; - case DISP_E_UNKNOWNNAME : - return "DISP_E_UNKNOWNNAME "; - case DISP_E_NONAMEDARGS : - return "DISP_E_NONAMEDARGS "; - case DISP_E_BADVARTYPE : - return "DISP_E_BADVARTYPE "; - case DISP_E_EXCEPTION : - return "DISP_E_EXCEPTION "; - case DISP_E_OVERFLOW : - return "DISP_E_OVERFLOW "; - case DISP_E_BADINDEX : - return "DISP_E_BADINDEX "; - case DISP_E_UNKNOWNLCID : - return "DISP_E_UNKNOWNLCID "; - case DISP_E_ARRAYISLOCKED : - return "DISP_E_ARRAYISLOCKED "; - case DISP_E_BADPARAMCOUNT : - return "DISP_E_BADPARAMCOUNT "; - case DISP_E_PARAMNOTOPTIONAL : - return "DISP_E_PARAMNOTOPTIONAL "; - case DISP_E_BADCALLEE : - return "DISP_E_BADCALLEE "; - case DISP_E_NOTACOLLECTION : - return "DISP_E_NOTACOLLECTION "; - case DISP_E_DIVBYZERO : - return "DISP_E_DIVBYZERO "; - case TYPE_E_BUFFERTOOSMALL : - return "TYPE_E_BUFFERTOOSMALL "; - case TYPE_E_FIELDNOTFOUND : - return "TYPE_E_FIELDNOTFOUND "; - case TYPE_E_INVDATAREAD : - return "TYPE_E_INVDATAREAD "; - case TYPE_E_UNSUPFORMAT : - return "TYPE_E_UNSUPFORMAT "; - case TYPE_E_REGISTRYACCESS : - return "TYPE_E_REGISTRYACCESS "; - case TYPE_E_LIBNOTREGISTERED : - return "TYPE_E_LIBNOTREGISTERED "; - case TYPE_E_UNDEFINEDTYPE : - return "TYPE_E_UNDEFINEDTYPE "; - case TYPE_E_QUALIFIEDNAMEDISALLOWED : - return "TYPE_E_QUALIFIEDNAMEDISALLOWED "; - case TYPE_E_INVALIDSTATE : - return "TYPE_E_INVALIDSTATE "; - case TYPE_E_WRONGTYPEKIND : - return "TYPE_E_WRONGTYPEKIND "; - case TYPE_E_ELEMENTNOTFOUND : - return "TYPE_E_ELEMENTNOTFOUND "; - case TYPE_E_AMBIGUOUSNAME : - return "TYPE_E_AMBIGUOUSNAME "; - case TYPE_E_NAMECONFLICT : - return "TYPE_E_NAMECONFLICT "; - case TYPE_E_UNKNOWNLCID : - return "TYPE_E_UNKNOWNLCID "; - case TYPE_E_DLLFUNCTIONNOTFOUND : - return "TYPE_E_DLLFUNCTIONNOTFOUND "; - case TYPE_E_BADMODULEKIND : - return "TYPE_E_BADMODULEKIND "; - case TYPE_E_SIZETOOBIG : - return "TYPE_E_SIZETOOBIG "; - case TYPE_E_DUPLICATEID : - return "TYPE_E_DUPLICATEID "; - case TYPE_E_INVALIDID : - return "TYPE_E_INVALIDID "; - case TYPE_E_TYPEMISMATCH : - return "TYPE_E_TYPEMISMATCH "; - case TYPE_E_OUTOFBOUNDS : - return "TYPE_E_OUTOFBOUNDS "; - case TYPE_E_IOERROR : - return "TYPE_E_IOERROR "; - case TYPE_E_CANTCREATETMPFILE : - return "TYPE_E_CANTCREATETMPFILE "; - case TYPE_E_CANTLOADLIBRARY : - return "TYPE_E_CANTLOADLIBRARY "; - case TYPE_E_INCONSISTENTPROPFUNCS : - return "TYPE_E_INCONSISTENTPROPFUNCS "; - case TYPE_E_CIRCULARTYPE : - return "TYPE_E_CIRCULARTYPE "; - case STG_E_INVALIDFUNCTION : - return "STG_E_INVALIDFUNCTION "; - case STG_E_FILENOTFOUND : - return "STG_E_FILENOTFOUND "; - case STG_E_PATHNOTFOUND : - return "STG_E_PATHNOTFOUND "; - case STG_E_TOOMANYOPENFILES : - return "STG_E_TOOMANYOPENFILES "; - case STG_E_ACCESSDENIED : - return "STG_E_ACCESSDENIED "; - case STG_E_INVALIDHANDLE : - return "STG_E_INVALIDHANDLE "; - case STG_E_INSUFFICIENTMEMORY : - return "STG_E_INSUFFICIENTMEMORY "; - case STG_E_INVALIDPOINTER : - return "STG_E_INVALIDPOINTER "; - case STG_E_NOMOREFILES : - return "STG_E_NOMOREFILES "; - case STG_E_DISKISWRITEPROTECTED : - return "STG_E_DISKISWRITEPROTECTED "; - case STG_E_SEEKERROR : - return "STG_E_SEEKERROR "; - case STG_E_WRITEFAULT : - return "STG_E_WRITEFAULT "; - case STG_E_READFAULT : - return "STG_E_READFAULT "; - case STG_E_SHAREVIOLATION : - return "STG_E_SHAREVIOLATION "; - case STG_E_LOCKVIOLATION : - return "STG_E_LOCKVIOLATION "; - case STG_E_FILEALREADYEXISTS : - return "STG_E_FILEALREADYEXISTS "; - case STG_E_INVALIDPARAMETER : - return "STG_E_INVALIDPARAMETER "; - case STG_E_MEDIUMFULL : - return "STG_E_MEDIUMFULL "; - case STG_E_PROPSETMISMATCHED : - return "STG_E_PROPSETMISMATCHED "; - case STG_E_ABNORMALAPIEXIT : - return "STG_E_ABNORMALAPIEXIT "; - case STG_E_INVALIDHEADER : - return "STG_E_INVALIDHEADER "; - case STG_E_INVALIDNAME : - return "STG_E_INVALIDNAME "; - case STG_E_UNKNOWN : - return "STG_E_UNKNOWN "; - case STG_E_UNIMPLEMENTEDFUNCTION : - return "STG_E_UNIMPLEMENTEDFUNCTION "; - case STG_E_INVALIDFLAG : - return "STG_E_INVALIDFLAG "; - case STG_E_INUSE : - return "STG_E_INUSE "; - case STG_E_NOTCURRENT : - return "STG_E_NOTCURRENT "; - case STG_E_REVERTED : - return "STG_E_REVERTED "; - case STG_E_CANTSAVE : - return "STG_E_CANTSAVE "; - case STG_E_OLDFORMAT : - return "STG_E_OLDFORMAT "; - case STG_E_OLDDLL : - return "STG_E_OLDDLL "; - case STG_E_SHAREREQUIRED : - return "STG_E_SHAREREQUIRED "; - case STG_E_NOTFILEBASEDSTORAGE : - return "STG_E_NOTFILEBASEDSTORAGE "; - case STG_E_EXTANTMARSHALLINGS : - return "STG_E_EXTANTMARSHALLINGS "; - case STG_E_DOCFILECORRUPT : - return "STG_E_DOCFILECORRUPT "; - case STG_E_BADBASEADDRESS : - return "STG_E_BADBASEADDRESS "; - case STG_E_INCOMPLETE : - return "STG_E_INCOMPLETE "; - case STG_E_TERMINATED : - return "STG_E_TERMINATED "; - case STG_S_CONVERTED : - return "STG_S_CONVERTED "; - case STG_S_BLOCK : - return "STG_S_BLOCK "; - case STG_S_RETRYNOW : - return "STG_S_RETRYNOW "; - case STG_S_MONITORING : - return "STG_S_MONITORING "; - case STG_S_MULTIPLEOPENS : - return "STG_S_MULTIPLEOPENS "; - case STG_S_CONSOLIDATIONFAILED : - return "STG_S_CONSOLIDATIONFAILED "; - case STG_S_CANNOTCONSOLIDATE : - return "STG_S_CANNOTCONSOLIDATE "; - case RPC_E_CALL_REJECTED : - return "RPC_E_CALL_REJECTED "; - case RPC_E_CALL_CANCELED : - return "RPC_E_CALL_CANCELED "; - case RPC_E_CANTPOST_INSENDCALL : - return "RPC_E_CANTPOST_INSENDCALL "; - case RPC_E_CANTCALLOUT_INASYNCCALL : - return "RPC_E_CANTCALLOUT_INASYNCCALL "; - case RPC_E_CANTCALLOUT_INEXTERNALCALL : - return "RPC_E_CANTCALLOUT_INEXTERNALCALL "; - case RPC_E_CONNECTION_TERMINATED : - return "RPC_E_CONNECTION_TERMINATED "; - case RPC_E_SERVER_DIED : - return "RPC_E_SERVER_DIED "; - case RPC_E_CLIENT_DIED : - return "RPC_E_CLIENT_DIED "; - case RPC_E_INVALID_DATAPACKET : - return "RPC_E_INVALID_DATAPACKET "; - case RPC_E_CANTTRANSMIT_CALL : - return "RPC_E_CANTTRANSMIT_CALL "; - case RPC_E_CLIENT_CANTMARSHAL_DATA : - return "RPC_E_CLIENT_CANTMARSHAL_DATA "; - case RPC_E_CLIENT_CANTUNMARSHAL_DATA : - return "RPC_E_CLIENT_CANTUNMARSHAL_DATA "; - case RPC_E_SERVER_CANTMARSHAL_DATA : - return "RPC_E_SERVER_CANTMARSHAL_DATA "; - case RPC_E_SERVER_CANTUNMARSHAL_DATA : - return "RPC_E_SERVER_CANTUNMARSHAL_DATA "; - case RPC_E_INVALID_DATA : - return "RPC_E_INVALID_DATA "; - case RPC_E_INVALID_PARAMETER : - return "RPC_E_INVALID_PARAMETER "; - case RPC_E_CANTCALLOUT_AGAIN : - return "RPC_E_CANTCALLOUT_AGAIN "; - case RPC_E_SERVER_DIED_DNE : - return "RPC_E_SERVER_DIED_DNE "; - case RPC_E_SYS_CALL_FAILED : - return "RPC_E_SYS_CALL_FAILED "; - case RPC_E_OUT_OF_RESOURCES : - return "RPC_E_OUT_OF_RESOURCES "; - case RPC_E_ATTEMPTED_MULTITHREAD : - return "RPC_E_ATTEMPTED_MULTITHREAD "; - case RPC_E_NOT_REGISTERED : - return "RPC_E_NOT_REGISTERED "; - case RPC_E_FAULT : - return "RPC_E_FAULT "; - case RPC_E_SERVERFAULT : - return "RPC_E_SERVERFAULT "; - case RPC_E_CHANGED_MODE : - return "RPC_E_CHANGED_MODE "; - case RPC_E_INVALIDMETHOD : - return "RPC_E_INVALIDMETHOD "; - case RPC_E_DISCONNECTED : - return "RPC_E_DISCONNECTED "; - case RPC_E_RETRY : - return "RPC_E_RETRY "; - case RPC_E_SERVERCALL_RETRYLATER : - return "RPC_E_SERVERCALL_RETRYLATER "; - case RPC_E_SERVERCALL_REJECTED : - return "RPC_E_SERVERCALL_REJECTED "; - case RPC_E_INVALID_CALLDATA : - return "RPC_E_INVALID_CALLDATA "; - case RPC_E_CANTCALLOUT_ININPUTSYNCCALL : - return "RPC_E_CANTCALLOUT_ININPUTSYNCCALL "; - case RPC_E_WRONG_THREAD : - return "RPC_E_WRONG_THREAD "; - case RPC_E_THREAD_NOT_INIT : - return "RPC_E_THREAD_NOT_INIT "; - case RPC_E_VERSION_MISMATCH : - return "RPC_E_VERSION_MISMATCH "; - case RPC_E_INVALID_HEADER : - return "RPC_E_INVALID_HEADER "; - case RPC_E_INVALID_EXTENSION : - return "RPC_E_INVALID_EXTENSION "; - case RPC_E_INVALID_IPID : - return "RPC_E_INVALID_IPID "; - case RPC_E_INVALID_OBJECT : - return "RPC_E_INVALID_OBJECT "; - case RPC_S_CALLPENDING : - return "RPC_S_CALLPENDING "; - case RPC_S_WAITONTIMER : - return "RPC_S_WAITONTIMER "; - case RPC_E_CALL_COMPLETE : - return "RPC_E_CALL_COMPLETE "; - case RPC_E_UNSECURE_CALL : - return "RPC_E_UNSECURE_CALL "; - case RPC_E_TOO_LATE : - return "RPC_E_TOO_LATE "; - case RPC_E_NO_GOOD_SECURITY_PACKAGES : - return "RPC_E_NO_GOOD_SECURITY_PACKAGES "; - case RPC_E_ACCESS_DENIED : - return "RPC_E_ACCESS_DENIED "; - case RPC_E_REMOTE_DISABLED : - return "RPC_E_REMOTE_DISABLED "; - case RPC_E_INVALID_OBJREF : - return "RPC_E_INVALID_OBJREF "; - case RPC_E_NO_CONTEXT : - return "RPC_E_NO_CONTEXT "; - case RPC_E_TIMEOUT : - return "RPC_E_TIMEOUT "; - case RPC_E_NO_SYNC : - return "RPC_E_NO_SYNC "; - case RPC_E_UNEXPECTED : - return "RPC_E_UNEXPECTED "; - case NTE_BAD_UID : - return "NTE_BAD_UID "; - case NTE_BAD_HASH : - return "NTE_BAD_HASH "; - //case NTE_BAD_HASH : - //return "NTE_BAD_HASH "; - case NTE_BAD_KEY : - return "NTE_BAD_KEY "; - case NTE_BAD_LEN : - return "NTE_BAD_LEN "; - case NTE_BAD_DATA : - return "NTE_BAD_DATA "; - case NTE_BAD_SIGNATURE : - return "NTE_BAD_SIGNATURE "; - case NTE_BAD_VER : - return "NTE_BAD_VER "; - case NTE_BAD_ALGID : - return "NTE_BAD_ALGID "; - case NTE_BAD_FLAGS : - return "NTE_BAD_FLAGS "; - case NTE_BAD_TYPE : - return "NTE_BAD_TYPE "; - case NTE_BAD_KEY_STATE : - return "NTE_BAD_KEY_STATE "; - case NTE_BAD_HASH_STATE : - return "NTE_BAD_HASH_STATE "; - case NTE_NO_KEY : - return "NTE_NO_KEY "; - case NTE_NO_MEMORY : - return "NTE_NO_MEMORY "; - case NTE_EXISTS : - return "NTE_EXISTS "; - case NTE_PERM : - return "NTE_PERM "; - case NTE_NOT_FOUND : - return "NTE_NOT_FOUND "; - case NTE_DOUBLE_ENCRYPT : - return "NTE_DOUBLE_ENCRYPT "; - case NTE_BAD_PROVIDER : - return "NTE_BAD_PROVIDER "; - case NTE_BAD_PROV_TYPE : - return "NTE_BAD_PROV_TYPE "; - case NTE_BAD_PUBLIC_KEY : - return "NTE_BAD_PUBLIC_KEY "; - case NTE_BAD_KEYSET : - return "NTE_BAD_KEYSET "; - case NTE_PROV_TYPE_NOT_DEF : - return "NTE_PROV_TYPE_NOT_DEF "; - case NTE_PROV_TYPE_ENTRY_BAD : - return "NTE_PROV_TYPE_ENTRY_BAD "; - case NTE_KEYSET_NOT_DEF : - return "NTE_KEYSET_NOT_DEF "; - case NTE_KEYSET_ENTRY_BAD : - return "NTE_KEYSET_ENTRY_BAD "; - case NTE_PROV_TYPE_NO_MATCH : - return "NTE_PROV_TYPE_NO_MATCH "; - case NTE_SIGNATURE_FILE_BAD : - return "NTE_SIGNATURE_FILE_BAD "; - case NTE_PROVIDER_DLL_FAIL : - return "NTE_PROVIDER_DLL_FAIL "; - case NTE_PROV_DLL_NOT_FOUND : - return "NTE_PROV_DLL_NOT_FOUND "; - case NTE_BAD_KEYSET_PARAM : - return "NTE_BAD_KEYSET_PARAM "; - case NTE_FAIL : - return "NTE_FAIL "; - case NTE_SYS_ERR : - return "NTE_SYS_ERR "; - case CRYPT_E_MSG_ERROR : - return "CRYPT_E_MSG_ERROR "; - case CRYPT_E_UNKNOWN_ALGO : - return "CRYPT_E_UNKNOWN_ALGO "; - case CRYPT_E_OID_FORMAT : - return "CRYPT_E_OID_FORMAT "; - case CRYPT_E_INVALID_MSG_TYPE : - return "CRYPT_E_INVALID_MSG_TYPE "; - case CRYPT_E_UNEXPECTED_ENCODING : - return "CRYPT_E_UNEXPECTED_ENCODING "; - case CRYPT_E_AUTH_ATTR_MISSING : - return "CRYPT_E_AUTH_ATTR_MISSING "; - case CRYPT_E_HASH_VALUE : - return "CRYPT_E_HASH_VALUE "; - case CRYPT_E_INVALID_INDEX : - return "CRYPT_E_INVALID_INDEX "; - case CRYPT_E_ALREADY_DECRYPTED : - return "CRYPT_E_ALREADY_DECRYPTED "; - case CRYPT_E_NOT_DECRYPTED : - return "CRYPT_E_NOT_DECRYPTED "; - case CRYPT_E_RECIPIENT_NOT_FOUND : - return "CRYPT_E_RECIPIENT_NOT_FOUND "; - case CRYPT_E_CONTROL_TYPE : - return "CRYPT_E_CONTROL_TYPE "; - case CRYPT_E_ISSUER_SERIALNUMBER : - return "CRYPT_E_ISSUER_SERIALNUMBER "; - case CRYPT_E_SIGNER_NOT_FOUND : - return "CRYPT_E_SIGNER_NOT_FOUND "; - case CRYPT_E_ATTRIBUTES_MISSING : - return "CRYPT_E_ATTRIBUTES_MISSING "; - case CRYPT_E_STREAM_MSG_NOT_READY : - return "CRYPT_E_STREAM_MSG_NOT_READY "; - case CRYPT_E_STREAM_INSUFFICIENT_DATA : - return "CRYPT_E_STREAM_INSUFFICIENT_DATA "; - case CRYPT_E_BAD_LEN : - return "CRYPT_E_BAD_LEN "; - case CRYPT_E_BAD_ENCODE : - return "CRYPT_E_BAD_ENCODE "; - case CRYPT_E_FILE_ERROR : - return "CRYPT_E_FILE_ERROR "; - case CRYPT_E_NOT_FOUND : - return "CRYPT_E_NOT_FOUND "; - case CRYPT_E_EXISTS : - return "CRYPT_E_EXISTS "; - case CRYPT_E_NO_PROVIDER : - return "CRYPT_E_NO_PROVIDER "; - case CRYPT_E_SELF_SIGNED : - return "CRYPT_E_SELF_SIGNED "; - case CRYPT_E_DELETED_PREV : - return "CRYPT_E_DELETED_PREV "; - case CRYPT_E_NO_MATCH : - return "CRYPT_E_NO_MATCH "; - case CRYPT_E_UNEXPECTED_MSG_TYPE : - return "CRYPT_E_UNEXPECTED_MSG_TYPE "; - case CRYPT_E_NO_KEY_PROPERTY : - return "CRYPT_E_NO_KEY_PROPERTY "; - case CRYPT_E_NO_DECRYPT_CERT : - return "CRYPT_E_NO_DECRYPT_CERT "; - case CRYPT_E_BAD_MSG : - return "CRYPT_E_BAD_MSG "; - case CRYPT_E_NO_SIGNER : - return "CRYPT_E_NO_SIGNER "; - case CRYPT_E_PENDING_CLOSE : - return "CRYPT_E_PENDING_CLOSE "; - case CRYPT_E_REVOKED : - return "CRYPT_E_REVOKED "; - case CRYPT_E_NO_REVOCATION_DLL : - return "CRYPT_E_NO_REVOCATION_DLL "; - case CRYPT_E_NO_REVOCATION_CHECK : - return "CRYPT_E_NO_REVOCATION_CHECK "; - case CRYPT_E_REVOCATION_OFFLINE : - return "CRYPT_E_REVOCATION_OFFLINE "; - case CRYPT_E_NOT_IN_REVOCATION_DATABASE : - return "CRYPT_E_NOT_IN_REVOCATION_DATABASE "; - case CRYPT_E_INVALID_NUMERIC_STRING : - return "CRYPT_E_INVALID_NUMERIC_STRING "; - case CRYPT_E_INVALID_PRINTABLE_STRING : - return "CRYPT_E_INVALID_PRINTABLE_STRING "; - case CRYPT_E_INVALID_IA5_STRING : - return "CRYPT_E_INVALID_IA5_STRING "; - case CRYPT_E_INVALID_X500_STRING : - return "CRYPT_E_INVALID_X500_STRING "; - case CRYPT_E_NOT_CHAR_STRING : - return "CRYPT_E_NOT_CHAR_STRING "; - case CRYPT_E_FILERESIZED : - return "CRYPT_E_FILERESIZED "; - case CRYPT_E_SECURITY_SETTINGS : - return "CRYPT_E_SECURITY_SETTINGS "; - case CRYPT_E_NO_VERIFY_USAGE_DLL : - return "CRYPT_E_NO_VERIFY_USAGE_DLL "; - case CRYPT_E_NO_VERIFY_USAGE_CHECK : - return "CRYPT_E_NO_VERIFY_USAGE_CHECK "; - case CRYPT_E_VERIFY_USAGE_OFFLINE : - return "CRYPT_E_VERIFY_USAGE_OFFLINE "; - case CRYPT_E_NOT_IN_CTL : - return "CRYPT_E_NOT_IN_CTL "; - case CRYPT_E_NO_TRUSTED_SIGNER : - return "CRYPT_E_NO_TRUSTED_SIGNER "; - case CRYPT_E_OSS_ERROR : - return "CRYPT_E_OSS_ERROR "; - case CERTSRV_E_BAD_REQUESTSUBJECT : - return "CERTSRV_E_BAD_REQUESTSUBJECT "; - case CERTSRV_E_NO_REQUEST : - return "CERTSRV_E_NO_REQUEST "; - case CERTSRV_E_BAD_REQUESTSTATUS : - return "CERTSRV_E_BAD_REQUESTSTATUS "; - case CERTSRV_E_PROPERTY_EMPTY : - return "CERTSRV_E_PROPERTY_EMPTY "; - //case CERTDB_E_JET_ERROR : - //return "CERTDB_E_JET_ERROR "; - case TRUST_E_SYSTEM_ERROR : - return "TRUST_E_SYSTEM_ERROR "; - case TRUST_E_NO_SIGNER_CERT : - return "TRUST_E_NO_SIGNER_CERT "; - case TRUST_E_COUNTER_SIGNER : - return "TRUST_E_COUNTER_SIGNER "; - case TRUST_E_CERT_SIGNATURE : - return "TRUST_E_CERT_SIGNATURE "; - case TRUST_E_TIME_STAMP : - return "TRUST_E_TIME_STAMP "; - case TRUST_E_BAD_DIGEST : - return "TRUST_E_BAD_DIGEST "; - case TRUST_E_BASIC_CONSTRAINTS : - return "TRUST_E_BASIC_CONSTRAINTS "; - case TRUST_E_FINANCIAL_CRITERIA : - return "TRUST_E_FINANCIAL_CRITERIA "; - case TRUST_E_PROVIDER_UNKNOWN : - return "TRUST_E_PROVIDER_UNKNOWN "; - case TRUST_E_ACTION_UNKNOWN : - return "TRUST_E_ACTION_UNKNOWN "; - case TRUST_E_SUBJECT_FORM_UNKNOWN : - return "TRUST_E_SUBJECT_FORM_UNKNOWN "; - case TRUST_E_SUBJECT_NOT_TRUSTED : - return "TRUST_E_SUBJECT_NOT_TRUSTED "; - case DIGSIG_E_ENCODE : - return "DIGSIG_E_ENCODE "; - case DIGSIG_E_DECODE : - return "DIGSIG_E_DECODE "; - case DIGSIG_E_EXTENSIBILITY : - return "DIGSIG_E_EXTENSIBILITY "; - case DIGSIG_E_CRYPTO : - return "DIGSIG_E_CRYPTO "; - case PERSIST_E_SIZEDEFINITE : - return "PERSIST_E_SIZEDEFINITE "; - case PERSIST_E_SIZEINDEFINITE : - return "PERSIST_E_SIZEINDEFINITE "; - case PERSIST_E_NOTSELFSIZING : - return "PERSIST_E_NOTSELFSIZING "; - case TRUST_E_NOSIGNATURE : - return "TRUST_E_NOSIGNATURE "; - case CERT_E_EXPIRED : - return "CERT_E_EXPIRED "; - case CERT_E_VALIDITYPERIODNESTING : - return "CERT_E_VALIDITYPERIODNESTING "; - case CERT_E_ROLE : - return "CERT_E_ROLE "; - case CERT_E_PATHLENCONST : - return "CERT_E_PATHLENCONST "; - case CERT_E_CRITICAL : - return "CERT_E_CRITICAL "; - case CERT_E_PURPOSE : - return "CERT_E_PURPOSE "; - case CERT_E_ISSUERCHAINING : - return "CERT_E_ISSUERCHAINING "; - case CERT_E_MALFORMED : - return "CERT_E_MALFORMED "; - case CERT_E_UNTRUSTEDROOT : - return "CERT_E_UNTRUSTEDROOT "; - case CERT_E_CHAINING : - return "CERT_E_CHAINING "; - case TRUST_E_FAIL : - return "TRUST_E_FAIL "; - case CERT_E_REVOKED : - return "CERT_E_REVOKED "; - case CERT_E_UNTRUSTEDTESTROOT : - return "CERT_E_UNTRUSTEDTESTROOT "; - case CERT_E_REVOCATION_FAILURE : - return "CERT_E_REVOCATION_FAILURE "; - case CERT_E_CN_NO_MATCH : - return "CERT_E_CN_NO_MATCH "; - case CERT_E_WRONG_USAGE : - return "CERT_E_WRONG_USAGE "; - case SPAPI_E_EXPECTED_SECTION_NAME : - return "SPAPI_E_EXPECTED_SECTION_NAME "; - case SPAPI_E_BAD_SECTION_NAME_LINE : - return "SPAPI_E_BAD_SECTION_NAME_LINE "; - case SPAPI_E_SECTION_NAME_TOO_LONG : - return "SPAPI_E_SECTION_NAME_TOO_LONG "; - case SPAPI_E_GENERAL_SYNTAX : - return "SPAPI_E_GENERAL_SYNTAX "; - case SPAPI_E_WRONG_INF_STYLE : - return "SPAPI_E_WRONG_INF_STYLE "; - case SPAPI_E_SECTION_NOT_FOUND : - return "SPAPI_E_SECTION_NOT_FOUND "; - case SPAPI_E_LINE_NOT_FOUND : - return "SPAPI_E_LINE_NOT_FOUND "; - case SPAPI_E_NO_ASSOCIATED_CLASS : - return "SPAPI_E_NO_ASSOCIATED_CLASS "; - case SPAPI_E_CLASS_MISMATCH : - return "SPAPI_E_CLASS_MISMATCH "; - case SPAPI_E_DUPLICATE_FOUND : - return "SPAPI_E_DUPLICATE_FOUND "; - case SPAPI_E_NO_DRIVER_SELECTED : - return "SPAPI_E_NO_DRIVER_SELECTED "; - case SPAPI_E_KEY_DOES_NOT_EXIST : - return "SPAPI_E_KEY_DOES_NOT_EXIST "; - case SPAPI_E_INVALID_DEVINST_NAME : - return "SPAPI_E_INVALID_DEVINST_NAME "; - case SPAPI_E_INVALID_CLASS : - return "SPAPI_E_INVALID_CLASS "; - case SPAPI_E_DEVINST_ALREADY_EXISTS : - return "SPAPI_E_DEVINST_ALREADY_EXISTS "; - case SPAPI_E_DEVINFO_NOT_REGISTERED : - return "SPAPI_E_DEVINFO_NOT_REGISTERED "; - case SPAPI_E_INVALID_REG_PROPERTY : - return "SPAPI_E_INVALID_REG_PROPERTY "; - case SPAPI_E_NO_INF : - return "SPAPI_E_NO_INF "; - case SPAPI_E_NO_SUCH_DEVINST : - return "SPAPI_E_NO_SUCH_DEVINST "; - case SPAPI_E_CANT_LOAD_CLASS_ICON : - return "SPAPI_E_CANT_LOAD_CLASS_ICON "; - case SPAPI_E_INVALID_CLASS_INSTALLER : - return "SPAPI_E_INVALID_CLASS_INSTALLER "; - case SPAPI_E_DI_DO_DEFAULT : - return "SPAPI_E_DI_DO_DEFAULT "; - case SPAPI_E_DI_NOFILECOPY : - return "SPAPI_E_DI_NOFILECOPY "; - case SPAPI_E_INVALID_HWPROFILE : - return "SPAPI_E_INVALID_HWPROFILE "; - case SPAPI_E_NO_DEVICE_SELECTED : - return "SPAPI_E_NO_DEVICE_SELECTED "; - case SPAPI_E_DEVINFO_LIST_LOCKED : - return "SPAPI_E_DEVINFO_LIST_LOCKED "; - case SPAPI_E_DEVINFO_DATA_LOCKED : - return "SPAPI_E_DEVINFO_DATA_LOCKED "; - case SPAPI_E_DI_BAD_PATH : - return "SPAPI_E_DI_BAD_PATH "; - case SPAPI_E_NO_CLASSINSTALL_PARAMS : - return "SPAPI_E_NO_CLASSINSTALL_PARAMS "; - case SPAPI_E_FILEQUEUE_LOCKED : - return "SPAPI_E_FILEQUEUE_LOCKED "; - case SPAPI_E_BAD_SERVICE_INSTALLSECT : - return "SPAPI_E_BAD_SERVICE_INSTALLSECT "; - case SPAPI_E_NO_CLASS_DRIVER_LIST : - return "SPAPI_E_NO_CLASS_DRIVER_LIST "; - case SPAPI_E_NO_ASSOCIATED_SERVICE : - return "SPAPI_E_NO_ASSOCIATED_SERVICE "; - case SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE : - return "SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE "; - case SPAPI_E_DEVICE_INTERFACE_ACTIVE : - return "SPAPI_E_DEVICE_INTERFACE_ACTIVE "; - case SPAPI_E_DEVICE_INTERFACE_REMOVED : - return "SPAPI_E_DEVICE_INTERFACE_REMOVED "; - case SPAPI_E_BAD_INTERFACE_INSTALLSECT : - return "SPAPI_E_BAD_INTERFACE_INSTALLSECT "; - case SPAPI_E_NO_SUCH_INTERFACE_CLASS : - return "SPAPI_E_NO_SUCH_INTERFACE_CLASS "; - case SPAPI_E_INVALID_REFERENCE_STRING : - return "SPAPI_E_INVALID_REFERENCE_STRING "; - case SPAPI_E_INVALID_MACHINENAME : - return "SPAPI_E_INVALID_MACHINENAME "; - case SPAPI_E_REMOTE_COMM_FAILURE : - return "SPAPI_E_REMOTE_COMM_FAILURE "; - case SPAPI_E_MACHINE_UNAVAILABLE : - return "SPAPI_E_MACHINE_UNAVAILABLE "; - case SPAPI_E_NO_CONFIGMGR_SERVICES : - return "SPAPI_E_NO_CONFIGMGR_SERVICES "; - case SPAPI_E_INVALID_PROPPAGE_PROVIDER : - return "SPAPI_E_INVALID_PROPPAGE_PROVIDER "; - case SPAPI_E_NO_SUCH_DEVICE_INTERFACE : - return "SPAPI_E_NO_SUCH_DEVICE_INTERFACE "; - case SPAPI_E_DI_POSTPROCESSING_REQUIRED : - return "SPAPI_E_DI_POSTPROCESSING_REQUIRED "; - case SPAPI_E_INVALID_COINSTALLER : - return "SPAPI_E_INVALID_COINSTALLER "; - case SPAPI_E_NO_COMPAT_DRIVERS : - return "SPAPI_E_NO_COMPAT_DRIVERS "; - case SPAPI_E_NO_DEVICE_ICON : - return "SPAPI_E_NO_DEVICE_ICON "; - case SPAPI_E_INVALID_INF_LOGCONFIG : - return "SPAPI_E_INVALID_INF_LOGCONFIG "; - case SPAPI_E_DI_DONT_INSTALL : - return "SPAPI_E_DI_DONT_INSTALL "; - case SPAPI_E_INVALID_FILTER_DRIVER : - return "SPAPI_E_INVALID_FILTER_DRIVER "; - case SPAPI_E_ERROR_NOT_INSTALLED : - return "SPAPI_E_ERROR_NOT_INSTALLED "; + case E_ACCESSDENIED : + return "E_ACCESSDENIED "; + case E_PENDING : + return "E_PENDING "; + case CO_E_INIT_TLS : + return "CO_E_INIT_TLS "; + case CO_E_INIT_SHARED_ALLOCATOR : + return "CO_E_INIT_SHARED_ALLOCATOR "; + case CO_E_INIT_MEMORY_ALLOCATOR : + return "CO_E_INIT_MEMORY_ALLOCATOR "; + case CO_E_INIT_CLASS_CACHE : + return "CO_E_INIT_CLASS_CACHE "; + case CO_E_INIT_RPC_CHANNEL : + return "CO_E_INIT_RPC_CHANNEL "; + case CO_E_INIT_TLS_SET_CHANNEL_CONTROL : + return "CO_E_INIT_TLS_SET_CHANNEL_CONTROL "; + case CO_E_INIT_TLS_CHANNEL_CONTROL : + return "CO_E_INIT_TLS_CHANNEL_CONTROL "; + case CO_E_INIT_UNACCEPTED_USER_ALLOCATOR : + return "CO_E_INIT_UNACCEPTED_USER_ALLOCATOR "; + case CO_E_INIT_SCM_MUTEX_EXISTS : + return "CO_E_INIT_SCM_MUTEX_EXISTS "; + case CO_E_INIT_SCM_FILE_MAPPING_EXISTS : + return "CO_E_INIT_SCM_FILE_MAPPING_EXISTS "; + case CO_E_INIT_SCM_MAP_VIEW_OF_FILE : + return "CO_E_INIT_SCM_MAP_VIEW_OF_FILE "; + case CO_E_INIT_SCM_EXEC_FAILURE : + return "CO_E_INIT_SCM_EXEC_FAILURE "; + case CO_E_INIT_ONLY_SINGLE_THREADED : + return "CO_E_INIT_ONLY_SINGLE_THREADED "; + case CO_E_CANT_REMOTE : + return "CO_E_CANT_REMOTE "; + case CO_E_BAD_SERVER_NAME : + return "CO_E_BAD_SERVER_NAME "; + case CO_E_WRONG_SERVER_IDENTITY : + return "CO_E_WRONG_SERVER_IDENTITY "; + case CO_E_OLE1DDE_DISABLED : + return "CO_E_OLE1DDE_DISABLED "; + case CO_E_RUNAS_SYNTAX : + return "CO_E_RUNAS_SYNTAX "; + case CO_E_CREATEPROCESS_FAILURE : + return "CO_E_CREATEPROCESS_FAILURE "; + case CO_E_RUNAS_CREATEPROCESS_FAILURE : + return "CO_E_RUNAS_CREATEPROCESS_FAILURE "; + case CO_E_RUNAS_LOGON_FAILURE : + return "CO_E_RUNAS_LOGON_FAILURE "; + case CO_E_LAUNCH_PERMSSION_DENIED : + return "CO_E_LAUNCH_PERMSSION_DENIED "; + case CO_E_START_SERVICE_FAILURE : + return "CO_E_START_SERVICE_FAILURE "; + case CO_E_REMOTE_COMMUNICATION_FAILURE : + return "CO_E_REMOTE_COMMUNICATION_FAILURE "; + case CO_E_SERVER_START_TIMEOUT : + return "CO_E_SERVER_START_TIMEOUT "; + case CO_E_CLSREG_INCONSISTENT : + return "CO_E_CLSREG_INCONSISTENT "; + case CO_E_IIDREG_INCONSISTENT : + return "CO_E_IIDREG_INCONSISTENT "; + case CO_E_NOT_SUPPORTED : + return "CO_E_NOT_SUPPORTED "; + case CO_E_RELOAD_DLL : + return "CO_E_RELOAD_DLL "; + case CO_E_MSI_ERROR : + return "CO_E_MSI_ERROR "; + case OLE_E_OLEVERB : + return "OLE_E_OLEVERB "; + case OLE_E_ADVF : + return "OLE_E_ADVF "; + case OLE_E_ENUM_NOMORE : + return "OLE_E_ENUM_NOMORE "; + case OLE_E_ADVISENOTSUPPORTED : + return "OLE_E_ADVISENOTSUPPORTED "; + case OLE_E_NOCONNECTION : + return "OLE_E_NOCONNECTION "; + case OLE_E_NOTRUNNING : + return "OLE_E_NOTRUNNING "; + case OLE_E_NOCACHE : + return "OLE_E_NOCACHE "; + case OLE_E_BLANK : + return "OLE_E_BLANK "; + case OLE_E_CLASSDIFF : + return "OLE_E_CLASSDIFF "; + case OLE_E_CANT_GETMONIKER : + return "OLE_E_CANT_GETMONIKER "; + case OLE_E_CANT_BINDTOSOURCE : + return "OLE_E_CANT_BINDTOSOURCE "; + case OLE_E_STATIC : + return "OLE_E_STATIC "; + case OLE_E_PROMPTSAVECANCELLED : + return "OLE_E_PROMPTSAVECANCELLED "; + case OLE_E_INVALIDRECT : + return "OLE_E_INVALIDRECT "; + case OLE_E_WRONGCOMPOBJ : + return "OLE_E_WRONGCOMPOBJ "; + case OLE_E_INVALIDHWND : + return "OLE_E_INVALIDHWND "; + case OLE_E_NOT_INPLACEACTIVE : + return "OLE_E_NOT_INPLACEACTIVE "; + case OLE_E_CANTCONVERT : + return "OLE_E_CANTCONVERT "; + case OLE_E_NOSTORAGE : + return "OLE_E_NOSTORAGE "; + case DV_E_FORMATETC : + return "DV_E_FORMATETC "; + case DV_E_DVTARGETDEVICE : + return "DV_E_DVTARGETDEVICE "; + case DV_E_STGMEDIUM : + return "DV_E_STGMEDIUM "; + case DV_E_STATDATA : + return "DV_E_STATDATA "; + case DV_E_LINDEX : + return "DV_E_LINDEX "; + case DV_E_TYMED : + return "DV_E_TYMED "; + case DV_E_CLIPFORMAT : + return "DV_E_CLIPFORMAT "; + case DV_E_DVASPECT : + return "DV_E_DVASPECT "; + case DV_E_DVTARGETDEVICE_SIZE : + return "DV_E_DVTARGETDEVICE_SIZE "; + case DV_E_NOIVIEWOBJECT : + return "DV_E_NOIVIEWOBJECT "; + case DRAGDROP_E_NOTREGISTERED : + return "DRAGDROP_E_NOTREGISTERED "; + case DRAGDROP_E_ALREADYREGISTERED : + return "DRAGDROP_E_ALREADYREGISTERED "; + case DRAGDROP_E_INVALIDHWND : + return "DRAGDROP_E_INVALIDHWND "; + case CLASS_E_NOAGGREGATION : + return "CLASS_E_NOAGGREGATION "; + case CLASS_E_CLASSNOTAVAILABLE : + return "CLASS_E_CLASSNOTAVAILABLE "; + case CLASS_E_NOTLICENSED : + return "CLASS_E_NOTLICENSED "; + case VIEW_E_DRAW : + return "VIEW_E_DRAW "; + case REGDB_E_READREGDB : + return "REGDB_E_READREGDB "; + case REGDB_E_WRITEREGDB : + return "REGDB_E_WRITEREGDB "; + case REGDB_E_KEYMISSING : + return "REGDB_E_KEYMISSING "; + case REGDB_E_INVALIDVALUE : + return "REGDB_E_INVALIDVALUE "; + case REGDB_E_CLASSNOTREG : + return "REGDB_E_CLASSNOTREG "; + case REGDB_E_IIDNOTREG : + return "REGDB_E_IIDNOTREG "; + case CAT_E_CATIDNOEXIST : + return "CAT_E_CATIDNOEXIST "; + case CAT_E_NODESCRIPTION : + return "CAT_E_NODESCRIPTION "; + case CS_E_PACKAGE_NOTFOUND : + return "CS_E_PACKAGE_NOTFOUND "; + case CS_E_NOT_DELETABLE : + return "CS_E_NOT_DELETABLE "; + case CS_E_CLASS_NOTFOUND : + return "CS_E_CLASS_NOTFOUND "; + case CS_E_INVALID_VERSION : + return "CS_E_INVALID_VERSION "; + case CS_E_NO_CLASSSTORE : + return "CS_E_NO_CLASSSTORE "; + case CACHE_E_NOCACHE_UPDATED : + return "CACHE_E_NOCACHE_UPDATED "; + case OLEOBJ_E_NOVERBS : + return "OLEOBJ_E_NOVERBS "; + case OLEOBJ_E_INVALIDVERB : + return "OLEOBJ_E_INVALIDVERB "; + case INPLACE_E_NOTUNDOABLE : + return "INPLACE_E_NOTUNDOABLE "; + case INPLACE_E_NOTOOLSPACE : + return "INPLACE_E_NOTOOLSPACE "; + case CONVERT10_E_OLESTREAM_GET : + return "CONVERT10_E_OLESTREAM_GET "; + case CONVERT10_E_OLESTREAM_PUT : + return "CONVERT10_E_OLESTREAM_PUT "; + case CONVERT10_E_OLESTREAM_FMT : + return "CONVERT10_E_OLESTREAM_FMT "; + case CONVERT10_E_OLESTREAM_BITMAP_TO_DIB : + return "CONVERT10_E_OLESTREAM_BITMAP_TO_DIB "; + case CONVERT10_E_STG_FMT : + return "CONVERT10_E_STG_FMT "; + case CONVERT10_E_STG_NO_STD_STREAM : + return "CONVERT10_E_STG_NO_STD_STREAM "; + case CONVERT10_E_STG_DIB_TO_BITMAP : + return "CONVERT10_E_STG_DIB_TO_BITMAP "; + case CLIPBRD_E_CANT_OPEN : + return "CLIPBRD_E_CANT_OPEN "; + case CLIPBRD_E_CANT_EMPTY : + return "CLIPBRD_E_CANT_EMPTY "; + case CLIPBRD_E_CANT_SET : + return "CLIPBRD_E_CANT_SET "; + case CLIPBRD_E_BAD_DATA : + return "CLIPBRD_E_BAD_DATA "; + case CLIPBRD_E_CANT_CLOSE : + return "CLIPBRD_E_CANT_CLOSE "; + case MK_E_CONNECTMANUALLY : + return "MK_E_CONNECTMANUALLY "; + case MK_E_EXCEEDEDDEADLINE : + return "MK_E_EXCEEDEDDEADLINE "; + case MK_E_NEEDGENERIC : + return "MK_E_NEEDGENERIC "; + case MK_E_UNAVAILABLE : + return "MK_E_UNAVAILABLE "; + case MK_E_SYNTAX : + return "MK_E_SYNTAX "; + case MK_E_NOOBJECT : + return "MK_E_NOOBJECT "; + case MK_E_INVALIDEXTENSION : + return "MK_E_INVALIDEXTENSION "; + case MK_E_INTERMEDIATEINTERFACENOTSUPPORTED : + return "MK_E_INTERMEDIATEINTERFACENOTSUPPORTED "; + case MK_E_NOTBINDABLE : + return "MK_E_NOTBINDABLE "; + case MK_E_NOTBOUND : + return "MK_E_NOTBOUND "; + case MK_E_CANTOPENFILE : + return "MK_E_CANTOPENFILE "; + case MK_E_MUSTBOTHERUSER : + return "MK_E_MUSTBOTHERUSER "; + case MK_E_NOINVERSE : + return "MK_E_NOINVERSE "; + case MK_E_NOSTORAGE : + return "MK_E_NOSTORAGE "; + case MK_E_NOPREFIX : + return "MK_E_NOPREFIX "; + case MK_E_ENUMERATION_FAILED : + return "MK_E_ENUMERATION_FAILED "; + case CO_E_NOTINITIALIZED : + return "CO_E_NOTINITIALIZED "; + case CO_E_ALREADYINITIALIZED : + return "CO_E_ALREADYINITIALIZED "; + case CO_E_CANTDETERMINECLASS : + return "CO_E_CANTDETERMINECLASS "; + case CO_E_CLASSSTRING : + return "CO_E_CLASSSTRING "; + case CO_E_IIDSTRING : + return "CO_E_IIDSTRING "; + case CO_E_APPNOTFOUND : + return "CO_E_APPNOTFOUND "; + case CO_E_APPSINGLEUSE : + return "CO_E_APPSINGLEUSE "; + case CO_E_ERRORINAPP : + return "CO_E_ERRORINAPP "; + case CO_E_DLLNOTFOUND : + return "CO_E_DLLNOTFOUND "; + case CO_E_ERRORINDLL : + return "CO_E_ERRORINDLL "; + case CO_E_WRONGOSFORAPP : + return "CO_E_WRONGOSFORAPP "; + case CO_E_OBJNOTREG : + return "CO_E_OBJNOTREG "; + case CO_E_OBJISREG : + return "CO_E_OBJISREG "; + case CO_E_OBJNOTCONNECTED : + return "CO_E_OBJNOTCONNECTED "; + case CO_E_APPDIDNTREG : + return "CO_E_APPDIDNTREG "; + case CO_E_RELEASED : + return "CO_E_RELEASED "; + case CO_E_FAILEDTOIMPERSONATE : + return "CO_E_FAILEDTOIMPERSONATE "; + case CO_E_FAILEDTOGETSECCTX : + return "CO_E_FAILEDTOGETSECCTX "; + case CO_E_FAILEDTOOPENTHREADTOKEN : + return "CO_E_FAILEDTOOPENTHREADTOKEN "; + case CO_E_FAILEDTOGETTOKENINFO : + return "CO_E_FAILEDTOGETTOKENINFO "; + case CO_E_TRUSTEEDOESNTMATCHCLIENT : + return "CO_E_TRUSTEEDOESNTMATCHCLIENT "; + case CO_E_FAILEDTOQUERYCLIENTBLANKET : + return "CO_E_FAILEDTOQUERYCLIENTBLANKET "; + case CO_E_FAILEDTOSETDACL : + return "CO_E_FAILEDTOSETDACL "; + case CO_E_ACCESSCHECKFAILED : + return "CO_E_ACCESSCHECKFAILED "; + case CO_E_NETACCESSAPIFAILED : + return "CO_E_NETACCESSAPIFAILED "; + case CO_E_WRONGTRUSTEENAMESYNTAX : + return "CO_E_WRONGTRUSTEENAMESYNTAX "; + case CO_E_INVALIDSID : + return "CO_E_INVALIDSID "; + case CO_E_CONVERSIONFAILED : + return "CO_E_CONVERSIONFAILED "; + case CO_E_NOMATCHINGSIDFOUND : + return "CO_E_NOMATCHINGSIDFOUND "; + case CO_E_LOOKUPACCSIDFAILED : + return "CO_E_LOOKUPACCSIDFAILED "; + case CO_E_NOMATCHINGNAMEFOUND : + return "CO_E_NOMATCHINGNAMEFOUND "; + case CO_E_LOOKUPACCNAMEFAILED : + return "CO_E_LOOKUPACCNAMEFAILED "; + case CO_E_SETSERLHNDLFAILED : + return "CO_E_SETSERLHNDLFAILED "; + case CO_E_FAILEDTOGETWINDIR : + return "CO_E_FAILEDTOGETWINDIR "; + case CO_E_PATHTOOLONG : + return "CO_E_PATHTOOLONG "; + case CO_E_FAILEDTOGENUUID : + return "CO_E_FAILEDTOGENUUID "; + case CO_E_FAILEDTOCREATEFILE : + return "CO_E_FAILEDTOCREATEFILE "; + case CO_E_FAILEDTOCLOSEHANDLE : + return "CO_E_FAILEDTOCLOSEHANDLE "; + case CO_E_EXCEEDSYSACLLIMIT : + return "CO_E_EXCEEDSYSACLLIMIT "; + case CO_E_ACESINWRONGORDER : + return "CO_E_ACESINWRONGORDER "; + case CO_E_INCOMPATIBLESTREAMVERSION : + return "CO_E_INCOMPATIBLESTREAMVERSION "; + case CO_E_FAILEDTOOPENPROCESSTOKEN : + return "CO_E_FAILEDTOOPENPROCESSTOKEN "; + case CO_E_DECODEFAILED : + return "CO_E_DECODEFAILED "; + case CO_E_ACNOTINITIALIZED : + return "CO_E_ACNOTINITIALIZED "; + case OLE_S_USEREG : + return "OLE_S_USEREG "; + case OLE_S_STATIC : + return "OLE_S_STATIC "; + case OLE_S_MAC_CLIPFORMAT : + return "OLE_S_MAC_CLIPFORMAT "; + case DRAGDROP_S_DROP : + return "DRAGDROP_S_DROP "; + case DRAGDROP_S_CANCEL : + return "DRAGDROP_S_CANCEL "; + case DRAGDROP_S_USEDEFAULTCURSORS : + return "DRAGDROP_S_USEDEFAULTCURSORS "; + case DATA_S_SAMEFORMATETC : + return "DATA_S_SAMEFORMATETC "; + case VIEW_S_ALREADY_FROZEN : + return "VIEW_S_ALREADY_FROZEN "; + case CACHE_S_FORMATETC_NOTSUPPORTED : + return "CACHE_S_FORMATETC_NOTSUPPORTED "; + case CACHE_S_SAMECACHE : + return "CACHE_S_SAMECACHE "; + case CACHE_S_SOMECACHES_NOTUPDATED : + return "CACHE_S_SOMECACHES_NOTUPDATED "; + case OLEOBJ_S_INVALIDVERB : + return "OLEOBJ_S_INVALIDVERB "; + case OLEOBJ_S_CANNOT_DOVERB_NOW : + return "OLEOBJ_S_CANNOT_DOVERB_NOW "; + case OLEOBJ_S_INVALIDHWND : + return "OLEOBJ_S_INVALIDHWND "; + case INPLACE_S_TRUNCATED : + return "INPLACE_S_TRUNCATED "; + case CONVERT10_S_NO_PRESENTATION : + return "CONVERT10_S_NO_PRESENTATION "; + case MK_S_REDUCED_TO_SELF : + return "MK_S_REDUCED_TO_SELF "; + case MK_S_ME : + return "MK_S_ME "; + case MK_S_HIM : + return "MK_S_HIM "; + case MK_S_US : + return "MK_S_US "; + case MK_S_MONIKERALREADYREGISTERED : + return "MK_S_MONIKERALREADYREGISTERED "; + case CO_E_CLASS_CREATE_FAILED : + return "CO_E_CLASS_CREATE_FAILED "; + case CO_E_SCM_ERROR : + return "CO_E_SCM_ERROR "; + case CO_E_SCM_RPC_FAILURE : + return "CO_E_SCM_RPC_FAILURE "; + case CO_E_BAD_PATH : + return "CO_E_BAD_PATH "; + case CO_E_SERVER_EXEC_FAILURE : + return "CO_E_SERVER_EXEC_FAILURE "; + case CO_E_OBJSRV_RPC_FAILURE : + return "CO_E_OBJSRV_RPC_FAILURE "; + case MK_E_NO_NORMALIZED : + return "MK_E_NO_NORMALIZED "; + case CO_E_SERVER_STOPPING : + return "CO_E_SERVER_STOPPING "; + case MEM_E_INVALID_ROOT : + return "MEM_E_INVALID_ROOT "; + case MEM_E_INVALID_LINK : + return "MEM_E_INVALID_LINK "; + case MEM_E_INVALID_SIZE : + return "MEM_E_INVALID_SIZE "; + case CO_S_NOTALLINTERFACES : + return "CO_S_NOTALLINTERFACES "; + case DISP_E_UNKNOWNINTERFACE : + return "DISP_E_UNKNOWNINTERFACE "; + case DISP_E_MEMBERNOTFOUND : + return "DISP_E_MEMBERNOTFOUND "; + case DISP_E_PARAMNOTFOUND : + return "DISP_E_PARAMNOTFOUND "; + case DISP_E_TYPEMISMATCH : + return "DISP_E_TYPEMISMATCH "; + case DISP_E_UNKNOWNNAME : + return "DISP_E_UNKNOWNNAME "; + case DISP_E_NONAMEDARGS : + return "DISP_E_NONAMEDARGS "; + case DISP_E_BADVARTYPE : + return "DISP_E_BADVARTYPE "; + case DISP_E_EXCEPTION : + return "DISP_E_EXCEPTION "; + case DISP_E_OVERFLOW : + return "DISP_E_OVERFLOW "; + case DISP_E_BADINDEX : + return "DISP_E_BADINDEX "; + case DISP_E_UNKNOWNLCID : + return "DISP_E_UNKNOWNLCID "; + case DISP_E_ARRAYISLOCKED : + return "DISP_E_ARRAYISLOCKED "; + case DISP_E_BADPARAMCOUNT : + return "DISP_E_BADPARAMCOUNT "; + case DISP_E_PARAMNOTOPTIONAL : + return "DISP_E_PARAMNOTOPTIONAL "; + case DISP_E_BADCALLEE : + return "DISP_E_BADCALLEE "; + case DISP_E_NOTACOLLECTION : + return "DISP_E_NOTACOLLECTION "; + case DISP_E_DIVBYZERO : + return "DISP_E_DIVBYZERO "; + case TYPE_E_BUFFERTOOSMALL : + return "TYPE_E_BUFFERTOOSMALL "; + case TYPE_E_FIELDNOTFOUND : + return "TYPE_E_FIELDNOTFOUND "; + case TYPE_E_INVDATAREAD : + return "TYPE_E_INVDATAREAD "; + case TYPE_E_UNSUPFORMAT : + return "TYPE_E_UNSUPFORMAT "; + case TYPE_E_REGISTRYACCESS : + return "TYPE_E_REGISTRYACCESS "; + case TYPE_E_LIBNOTREGISTERED : + return "TYPE_E_LIBNOTREGISTERED "; + case TYPE_E_UNDEFINEDTYPE : + return "TYPE_E_UNDEFINEDTYPE "; + case TYPE_E_QUALIFIEDNAMEDISALLOWED : + return "TYPE_E_QUALIFIEDNAMEDISALLOWED "; + case TYPE_E_INVALIDSTATE : + return "TYPE_E_INVALIDSTATE "; + case TYPE_E_WRONGTYPEKIND : + return "TYPE_E_WRONGTYPEKIND "; + case TYPE_E_ELEMENTNOTFOUND : + return "TYPE_E_ELEMENTNOTFOUND "; + case TYPE_E_AMBIGUOUSNAME : + return "TYPE_E_AMBIGUOUSNAME "; + case TYPE_E_NAMECONFLICT : + return "TYPE_E_NAMECONFLICT "; + case TYPE_E_UNKNOWNLCID : + return "TYPE_E_UNKNOWNLCID "; + case TYPE_E_DLLFUNCTIONNOTFOUND : + return "TYPE_E_DLLFUNCTIONNOTFOUND "; + case TYPE_E_BADMODULEKIND : + return "TYPE_E_BADMODULEKIND "; + case TYPE_E_SIZETOOBIG : + return "TYPE_E_SIZETOOBIG "; + case TYPE_E_DUPLICATEID : + return "TYPE_E_DUPLICATEID "; + case TYPE_E_INVALIDID : + return "TYPE_E_INVALIDID "; + case TYPE_E_TYPEMISMATCH : + return "TYPE_E_TYPEMISMATCH "; + case TYPE_E_OUTOFBOUNDS : + return "TYPE_E_OUTOFBOUNDS "; + case TYPE_E_IOERROR : + return "TYPE_E_IOERROR "; + case TYPE_E_CANTCREATETMPFILE : + return "TYPE_E_CANTCREATETMPFILE "; + case TYPE_E_CANTLOADLIBRARY : + return "TYPE_E_CANTLOADLIBRARY "; + case TYPE_E_INCONSISTENTPROPFUNCS : + return "TYPE_E_INCONSISTENTPROPFUNCS "; + case TYPE_E_CIRCULARTYPE : + return "TYPE_E_CIRCULARTYPE "; + case STG_E_INVALIDFUNCTION : + return "STG_E_INVALIDFUNCTION "; + case STG_E_FILENOTFOUND : + return "STG_E_FILENOTFOUND "; + case STG_E_PATHNOTFOUND : + return "STG_E_PATHNOTFOUND "; + case STG_E_TOOMANYOPENFILES : + return "STG_E_TOOMANYOPENFILES "; + case STG_E_ACCESSDENIED : + return "STG_E_ACCESSDENIED "; + case STG_E_INVALIDHANDLE : + return "STG_E_INVALIDHANDLE "; + case STG_E_INSUFFICIENTMEMORY : + return "STG_E_INSUFFICIENTMEMORY "; + case STG_E_INVALIDPOINTER : + return "STG_E_INVALIDPOINTER "; + case STG_E_NOMOREFILES : + return "STG_E_NOMOREFILES "; + case STG_E_DISKISWRITEPROTECTED : + return "STG_E_DISKISWRITEPROTECTED "; + case STG_E_SEEKERROR : + return "STG_E_SEEKERROR "; + case STG_E_WRITEFAULT : + return "STG_E_WRITEFAULT "; + case STG_E_READFAULT : + return "STG_E_READFAULT "; + case STG_E_SHAREVIOLATION : + return "STG_E_SHAREVIOLATION "; + case STG_E_LOCKVIOLATION : + return "STG_E_LOCKVIOLATION "; + case STG_E_FILEALREADYEXISTS : + return "STG_E_FILEALREADYEXISTS "; + case STG_E_INVALIDPARAMETER : + return "STG_E_INVALIDPARAMETER "; + case STG_E_MEDIUMFULL : + return "STG_E_MEDIUMFULL "; + case STG_E_PROPSETMISMATCHED : + return "STG_E_PROPSETMISMATCHED "; + case STG_E_ABNORMALAPIEXIT : + return "STG_E_ABNORMALAPIEXIT "; + case STG_E_INVALIDHEADER : + return "STG_E_INVALIDHEADER "; + case STG_E_INVALIDNAME : + return "STG_E_INVALIDNAME "; + case STG_E_UNKNOWN : + return "STG_E_UNKNOWN "; + case STG_E_UNIMPLEMENTEDFUNCTION : + return "STG_E_UNIMPLEMENTEDFUNCTION "; + case STG_E_INVALIDFLAG : + return "STG_E_INVALIDFLAG "; + case STG_E_INUSE : + return "STG_E_INUSE "; + case STG_E_NOTCURRENT : + return "STG_E_NOTCURRENT "; + case STG_E_REVERTED : + return "STG_E_REVERTED "; + case STG_E_CANTSAVE : + return "STG_E_CANTSAVE "; + case STG_E_OLDFORMAT : + return "STG_E_OLDFORMAT "; + case STG_E_OLDDLL : + return "STG_E_OLDDLL "; + case STG_E_SHAREREQUIRED : + return "STG_E_SHAREREQUIRED "; + case STG_E_NOTFILEBASEDSTORAGE : + return "STG_E_NOTFILEBASEDSTORAGE "; + case STG_E_EXTANTMARSHALLINGS : + return "STG_E_EXTANTMARSHALLINGS "; + case STG_E_DOCFILECORRUPT : + return "STG_E_DOCFILECORRUPT "; + case STG_E_BADBASEADDRESS : + return "STG_E_BADBASEADDRESS "; + case STG_E_INCOMPLETE : + return "STG_E_INCOMPLETE "; + case STG_E_TERMINATED : + return "STG_E_TERMINATED "; + case STG_S_CONVERTED : + return "STG_S_CONVERTED "; + case STG_S_BLOCK : + return "STG_S_BLOCK "; + case STG_S_RETRYNOW : + return "STG_S_RETRYNOW "; + case STG_S_MONITORING : + return "STG_S_MONITORING "; + case STG_S_MULTIPLEOPENS : + return "STG_S_MULTIPLEOPENS "; + case STG_S_CONSOLIDATIONFAILED : + return "STG_S_CONSOLIDATIONFAILED "; + case STG_S_CANNOTCONSOLIDATE : + return "STG_S_CANNOTCONSOLIDATE "; + case RPC_E_CALL_REJECTED : + return "RPC_E_CALL_REJECTED "; + case RPC_E_CALL_CANCELED : + return "RPC_E_CALL_CANCELED "; + case RPC_E_CANTPOST_INSENDCALL : + return "RPC_E_CANTPOST_INSENDCALL "; + case RPC_E_CANTCALLOUT_INASYNCCALL : + return "RPC_E_CANTCALLOUT_INASYNCCALL "; + case RPC_E_CANTCALLOUT_INEXTERNALCALL : + return "RPC_E_CANTCALLOUT_INEXTERNALCALL "; + case RPC_E_CONNECTION_TERMINATED : + return "RPC_E_CONNECTION_TERMINATED "; + case RPC_E_SERVER_DIED : + return "RPC_E_SERVER_DIED "; + case RPC_E_CLIENT_DIED : + return "RPC_E_CLIENT_DIED "; + case RPC_E_INVALID_DATAPACKET : + return "RPC_E_INVALID_DATAPACKET "; + case RPC_E_CANTTRANSMIT_CALL : + return "RPC_E_CANTTRANSMIT_CALL "; + case RPC_E_CLIENT_CANTMARSHAL_DATA : + return "RPC_E_CLIENT_CANTMARSHAL_DATA "; + case RPC_E_CLIENT_CANTUNMARSHAL_DATA : + return "RPC_E_CLIENT_CANTUNMARSHAL_DATA "; + case RPC_E_SERVER_CANTMARSHAL_DATA : + return "RPC_E_SERVER_CANTMARSHAL_DATA "; + case RPC_E_SERVER_CANTUNMARSHAL_DATA : + return "RPC_E_SERVER_CANTUNMARSHAL_DATA "; + case RPC_E_INVALID_DATA : + return "RPC_E_INVALID_DATA "; + case RPC_E_INVALID_PARAMETER : + return "RPC_E_INVALID_PARAMETER "; + case RPC_E_CANTCALLOUT_AGAIN : + return "RPC_E_CANTCALLOUT_AGAIN "; + case RPC_E_SERVER_DIED_DNE : + return "RPC_E_SERVER_DIED_DNE "; + case RPC_E_SYS_CALL_FAILED : + return "RPC_E_SYS_CALL_FAILED "; + case RPC_E_OUT_OF_RESOURCES : + return "RPC_E_OUT_OF_RESOURCES "; + case RPC_E_ATTEMPTED_MULTITHREAD : + return "RPC_E_ATTEMPTED_MULTITHREAD "; + case RPC_E_NOT_REGISTERED : + return "RPC_E_NOT_REGISTERED "; + case RPC_E_FAULT : + return "RPC_E_FAULT "; + case RPC_E_SERVERFAULT : + return "RPC_E_SERVERFAULT "; + case RPC_E_CHANGED_MODE : + return "RPC_E_CHANGED_MODE "; + case RPC_E_INVALIDMETHOD : + return "RPC_E_INVALIDMETHOD "; + case RPC_E_DISCONNECTED : + return "RPC_E_DISCONNECTED "; + case RPC_E_RETRY : + return "RPC_E_RETRY "; + case RPC_E_SERVERCALL_RETRYLATER : + return "RPC_E_SERVERCALL_RETRYLATER "; + case RPC_E_SERVERCALL_REJECTED : + return "RPC_E_SERVERCALL_REJECTED "; + case RPC_E_INVALID_CALLDATA : + return "RPC_E_INVALID_CALLDATA "; + case RPC_E_CANTCALLOUT_ININPUTSYNCCALL : + return "RPC_E_CANTCALLOUT_ININPUTSYNCCALL "; + case RPC_E_WRONG_THREAD : + return "RPC_E_WRONG_THREAD "; + case RPC_E_THREAD_NOT_INIT : + return "RPC_E_THREAD_NOT_INIT "; + case RPC_E_VERSION_MISMATCH : + return "RPC_E_VERSION_MISMATCH "; + case RPC_E_INVALID_HEADER : + return "RPC_E_INVALID_HEADER "; + case RPC_E_INVALID_EXTENSION : + return "RPC_E_INVALID_EXTENSION "; + case RPC_E_INVALID_IPID : + return "RPC_E_INVALID_IPID "; + case RPC_E_INVALID_OBJECT : + return "RPC_E_INVALID_OBJECT "; + case RPC_S_CALLPENDING : + return "RPC_S_CALLPENDING "; + case RPC_S_WAITONTIMER : + return "RPC_S_WAITONTIMER "; + case RPC_E_CALL_COMPLETE : + return "RPC_E_CALL_COMPLETE "; + case RPC_E_UNSECURE_CALL : + return "RPC_E_UNSECURE_CALL "; + case RPC_E_TOO_LATE : + return "RPC_E_TOO_LATE "; + case RPC_E_NO_GOOD_SECURITY_PACKAGES : + return "RPC_E_NO_GOOD_SECURITY_PACKAGES "; + case RPC_E_ACCESS_DENIED : + return "RPC_E_ACCESS_DENIED "; + case RPC_E_REMOTE_DISABLED : + return "RPC_E_REMOTE_DISABLED "; + case RPC_E_INVALID_OBJREF : + return "RPC_E_INVALID_OBJREF "; + case RPC_E_NO_CONTEXT : + return "RPC_E_NO_CONTEXT "; + case RPC_E_TIMEOUT : + return "RPC_E_TIMEOUT "; + case RPC_E_NO_SYNC : + return "RPC_E_NO_SYNC "; + case RPC_E_UNEXPECTED : + return "RPC_E_UNEXPECTED "; + case NTE_BAD_UID : + return "NTE_BAD_UID "; + case NTE_BAD_HASH : + return "NTE_BAD_HASH "; + //case NTE_BAD_HASH : + //return "NTE_BAD_HASH "; + case NTE_BAD_KEY : + return "NTE_BAD_KEY "; + case NTE_BAD_LEN : + return "NTE_BAD_LEN "; + case NTE_BAD_DATA : + return "NTE_BAD_DATA "; + case NTE_BAD_SIGNATURE : + return "NTE_BAD_SIGNATURE "; + case NTE_BAD_VER : + return "NTE_BAD_VER "; + case NTE_BAD_ALGID : + return "NTE_BAD_ALGID "; + case NTE_BAD_FLAGS : + return "NTE_BAD_FLAGS "; + case NTE_BAD_TYPE : + return "NTE_BAD_TYPE "; + case NTE_BAD_KEY_STATE : + return "NTE_BAD_KEY_STATE "; + case NTE_BAD_HASH_STATE : + return "NTE_BAD_HASH_STATE "; + case NTE_NO_KEY : + return "NTE_NO_KEY "; + case NTE_NO_MEMORY : + return "NTE_NO_MEMORY "; + case NTE_EXISTS : + return "NTE_EXISTS "; + case NTE_PERM : + return "NTE_PERM "; + case NTE_NOT_FOUND : + return "NTE_NOT_FOUND "; + case NTE_DOUBLE_ENCRYPT : + return "NTE_DOUBLE_ENCRYPT "; + case NTE_BAD_PROVIDER : + return "NTE_BAD_PROVIDER "; + case NTE_BAD_PROV_TYPE : + return "NTE_BAD_PROV_TYPE "; + case NTE_BAD_PUBLIC_KEY : + return "NTE_BAD_PUBLIC_KEY "; + case NTE_BAD_KEYSET : + return "NTE_BAD_KEYSET "; + case NTE_PROV_TYPE_NOT_DEF : + return "NTE_PROV_TYPE_NOT_DEF "; + case NTE_PROV_TYPE_ENTRY_BAD : + return "NTE_PROV_TYPE_ENTRY_BAD "; + case NTE_KEYSET_NOT_DEF : + return "NTE_KEYSET_NOT_DEF "; + case NTE_KEYSET_ENTRY_BAD : + return "NTE_KEYSET_ENTRY_BAD "; + case NTE_PROV_TYPE_NO_MATCH : + return "NTE_PROV_TYPE_NO_MATCH "; + case NTE_SIGNATURE_FILE_BAD : + return "NTE_SIGNATURE_FILE_BAD "; + case NTE_PROVIDER_DLL_FAIL : + return "NTE_PROVIDER_DLL_FAIL "; + case NTE_PROV_DLL_NOT_FOUND : + return "NTE_PROV_DLL_NOT_FOUND "; + case NTE_BAD_KEYSET_PARAM : + return "NTE_BAD_KEYSET_PARAM "; + case NTE_FAIL : + return "NTE_FAIL "; + case NTE_SYS_ERR : + return "NTE_SYS_ERR "; + case CRYPT_E_MSG_ERROR : + return "CRYPT_E_MSG_ERROR "; + case CRYPT_E_UNKNOWN_ALGO : + return "CRYPT_E_UNKNOWN_ALGO "; + case CRYPT_E_OID_FORMAT : + return "CRYPT_E_OID_FORMAT "; + case CRYPT_E_INVALID_MSG_TYPE : + return "CRYPT_E_INVALID_MSG_TYPE "; + case CRYPT_E_UNEXPECTED_ENCODING : + return "CRYPT_E_UNEXPECTED_ENCODING "; + case CRYPT_E_AUTH_ATTR_MISSING : + return "CRYPT_E_AUTH_ATTR_MISSING "; + case CRYPT_E_HASH_VALUE : + return "CRYPT_E_HASH_VALUE "; + case CRYPT_E_INVALID_INDEX : + return "CRYPT_E_INVALID_INDEX "; + case CRYPT_E_ALREADY_DECRYPTED : + return "CRYPT_E_ALREADY_DECRYPTED "; + case CRYPT_E_NOT_DECRYPTED : + return "CRYPT_E_NOT_DECRYPTED "; + case CRYPT_E_RECIPIENT_NOT_FOUND : + return "CRYPT_E_RECIPIENT_NOT_FOUND "; + case CRYPT_E_CONTROL_TYPE : + return "CRYPT_E_CONTROL_TYPE "; + case CRYPT_E_ISSUER_SERIALNUMBER : + return "CRYPT_E_ISSUER_SERIALNUMBER "; + case CRYPT_E_SIGNER_NOT_FOUND : + return "CRYPT_E_SIGNER_NOT_FOUND "; + case CRYPT_E_ATTRIBUTES_MISSING : + return "CRYPT_E_ATTRIBUTES_MISSING "; + case CRYPT_E_STREAM_MSG_NOT_READY : + return "CRYPT_E_STREAM_MSG_NOT_READY "; + case CRYPT_E_STREAM_INSUFFICIENT_DATA : + return "CRYPT_E_STREAM_INSUFFICIENT_DATA "; + case CRYPT_E_BAD_LEN : + return "CRYPT_E_BAD_LEN "; + case CRYPT_E_BAD_ENCODE : + return "CRYPT_E_BAD_ENCODE "; + case CRYPT_E_FILE_ERROR : + return "CRYPT_E_FILE_ERROR "; + case CRYPT_E_NOT_FOUND : + return "CRYPT_E_NOT_FOUND "; + case CRYPT_E_EXISTS : + return "CRYPT_E_EXISTS "; + case CRYPT_E_NO_PROVIDER : + return "CRYPT_E_NO_PROVIDER "; + case CRYPT_E_SELF_SIGNED : + return "CRYPT_E_SELF_SIGNED "; + case CRYPT_E_DELETED_PREV : + return "CRYPT_E_DELETED_PREV "; + case CRYPT_E_NO_MATCH : + return "CRYPT_E_NO_MATCH "; + case CRYPT_E_UNEXPECTED_MSG_TYPE : + return "CRYPT_E_UNEXPECTED_MSG_TYPE "; + case CRYPT_E_NO_KEY_PROPERTY : + return "CRYPT_E_NO_KEY_PROPERTY "; + case CRYPT_E_NO_DECRYPT_CERT : + return "CRYPT_E_NO_DECRYPT_CERT "; + case CRYPT_E_BAD_MSG : + return "CRYPT_E_BAD_MSG "; + case CRYPT_E_NO_SIGNER : + return "CRYPT_E_NO_SIGNER "; + case CRYPT_E_PENDING_CLOSE : + return "CRYPT_E_PENDING_CLOSE "; + case CRYPT_E_REVOKED : + return "CRYPT_E_REVOKED "; + case CRYPT_E_NO_REVOCATION_DLL : + return "CRYPT_E_NO_REVOCATION_DLL "; + case CRYPT_E_NO_REVOCATION_CHECK : + return "CRYPT_E_NO_REVOCATION_CHECK "; + case CRYPT_E_REVOCATION_OFFLINE : + return "CRYPT_E_REVOCATION_OFFLINE "; + case CRYPT_E_NOT_IN_REVOCATION_DATABASE : + return "CRYPT_E_NOT_IN_REVOCATION_DATABASE "; + case CRYPT_E_INVALID_NUMERIC_STRING : + return "CRYPT_E_INVALID_NUMERIC_STRING "; + case CRYPT_E_INVALID_PRINTABLE_STRING : + return "CRYPT_E_INVALID_PRINTABLE_STRING "; + case CRYPT_E_INVALID_IA5_STRING : + return "CRYPT_E_INVALID_IA5_STRING "; + case CRYPT_E_INVALID_X500_STRING : + return "CRYPT_E_INVALID_X500_STRING "; + case CRYPT_E_NOT_CHAR_STRING : + return "CRYPT_E_NOT_CHAR_STRING "; + case CRYPT_E_FILERESIZED : + return "CRYPT_E_FILERESIZED "; + case CRYPT_E_SECURITY_SETTINGS : + return "CRYPT_E_SECURITY_SETTINGS "; + case CRYPT_E_NO_VERIFY_USAGE_DLL : + return "CRYPT_E_NO_VERIFY_USAGE_DLL "; + case CRYPT_E_NO_VERIFY_USAGE_CHECK : + return "CRYPT_E_NO_VERIFY_USAGE_CHECK "; + case CRYPT_E_VERIFY_USAGE_OFFLINE : + return "CRYPT_E_VERIFY_USAGE_OFFLINE "; + case CRYPT_E_NOT_IN_CTL : + return "CRYPT_E_NOT_IN_CTL "; + case CRYPT_E_NO_TRUSTED_SIGNER : + return "CRYPT_E_NO_TRUSTED_SIGNER "; + case CRYPT_E_OSS_ERROR : + return "CRYPT_E_OSS_ERROR "; + case CERTSRV_E_BAD_REQUESTSUBJECT : + return "CERTSRV_E_BAD_REQUESTSUBJECT "; + case CERTSRV_E_NO_REQUEST : + return "CERTSRV_E_NO_REQUEST "; + case CERTSRV_E_BAD_REQUESTSTATUS : + return "CERTSRV_E_BAD_REQUESTSTATUS "; + case CERTSRV_E_PROPERTY_EMPTY : + return "CERTSRV_E_PROPERTY_EMPTY "; + //case CERTDB_E_JET_ERROR : + //return "CERTDB_E_JET_ERROR "; + case TRUST_E_SYSTEM_ERROR : + return "TRUST_E_SYSTEM_ERROR "; + case TRUST_E_NO_SIGNER_CERT : + return "TRUST_E_NO_SIGNER_CERT "; + case TRUST_E_COUNTER_SIGNER : + return "TRUST_E_COUNTER_SIGNER "; + case TRUST_E_CERT_SIGNATURE : + return "TRUST_E_CERT_SIGNATURE "; + case TRUST_E_TIME_STAMP : + return "TRUST_E_TIME_STAMP "; + case TRUST_E_BAD_DIGEST : + return "TRUST_E_BAD_DIGEST "; + case TRUST_E_BASIC_CONSTRAINTS : + return "TRUST_E_BASIC_CONSTRAINTS "; + case TRUST_E_FINANCIAL_CRITERIA : + return "TRUST_E_FINANCIAL_CRITERIA "; + case TRUST_E_PROVIDER_UNKNOWN : + return "TRUST_E_PROVIDER_UNKNOWN "; + case TRUST_E_ACTION_UNKNOWN : + return "TRUST_E_ACTION_UNKNOWN "; + case TRUST_E_SUBJECT_FORM_UNKNOWN : + return "TRUST_E_SUBJECT_FORM_UNKNOWN "; + case TRUST_E_SUBJECT_NOT_TRUSTED : + return "TRUST_E_SUBJECT_NOT_TRUSTED "; + case DIGSIG_E_ENCODE : + return "DIGSIG_E_ENCODE "; + case DIGSIG_E_DECODE : + return "DIGSIG_E_DECODE "; + case DIGSIG_E_EXTENSIBILITY : + return "DIGSIG_E_EXTENSIBILITY "; + case DIGSIG_E_CRYPTO : + return "DIGSIG_E_CRYPTO "; + case PERSIST_E_SIZEDEFINITE : + return "PERSIST_E_SIZEDEFINITE "; + case PERSIST_E_SIZEINDEFINITE : + return "PERSIST_E_SIZEINDEFINITE "; + case PERSIST_E_NOTSELFSIZING : + return "PERSIST_E_NOTSELFSIZING "; + case TRUST_E_NOSIGNATURE : + return "TRUST_E_NOSIGNATURE "; + case CERT_E_EXPIRED : + return "CERT_E_EXPIRED "; + case CERT_E_VALIDITYPERIODNESTING : + return "CERT_E_VALIDITYPERIODNESTING "; + case CERT_E_ROLE : + return "CERT_E_ROLE "; + case CERT_E_PATHLENCONST : + return "CERT_E_PATHLENCONST "; + case CERT_E_CRITICAL : + return "CERT_E_CRITICAL "; + case CERT_E_PURPOSE : + return "CERT_E_PURPOSE "; + case CERT_E_ISSUERCHAINING : + return "CERT_E_ISSUERCHAINING "; + case CERT_E_MALFORMED : + return "CERT_E_MALFORMED "; + case CERT_E_UNTRUSTEDROOT : + return "CERT_E_UNTRUSTEDROOT "; + case CERT_E_CHAINING : + return "CERT_E_CHAINING "; + case TRUST_E_FAIL : + return "TRUST_E_FAIL "; + case CERT_E_REVOKED : + return "CERT_E_REVOKED "; + case CERT_E_UNTRUSTEDTESTROOT : + return "CERT_E_UNTRUSTEDTESTROOT "; + case CERT_E_REVOCATION_FAILURE : + return "CERT_E_REVOCATION_FAILURE "; + case CERT_E_CN_NO_MATCH : + return "CERT_E_CN_NO_MATCH "; + case CERT_E_WRONG_USAGE : + return "CERT_E_WRONG_USAGE "; + case SPAPI_E_EXPECTED_SECTION_NAME : + return "SPAPI_E_EXPECTED_SECTION_NAME "; + case SPAPI_E_BAD_SECTION_NAME_LINE : + return "SPAPI_E_BAD_SECTION_NAME_LINE "; + case SPAPI_E_SECTION_NAME_TOO_LONG : + return "SPAPI_E_SECTION_NAME_TOO_LONG "; + case SPAPI_E_GENERAL_SYNTAX : + return "SPAPI_E_GENERAL_SYNTAX "; + case SPAPI_E_WRONG_INF_STYLE : + return "SPAPI_E_WRONG_INF_STYLE "; + case SPAPI_E_SECTION_NOT_FOUND : + return "SPAPI_E_SECTION_NOT_FOUND "; + case SPAPI_E_LINE_NOT_FOUND : + return "SPAPI_E_LINE_NOT_FOUND "; + case SPAPI_E_NO_ASSOCIATED_CLASS : + return "SPAPI_E_NO_ASSOCIATED_CLASS "; + case SPAPI_E_CLASS_MISMATCH : + return "SPAPI_E_CLASS_MISMATCH "; + case SPAPI_E_DUPLICATE_FOUND : + return "SPAPI_E_DUPLICATE_FOUND "; + case SPAPI_E_NO_DRIVER_SELECTED : + return "SPAPI_E_NO_DRIVER_SELECTED "; + case SPAPI_E_KEY_DOES_NOT_EXIST : + return "SPAPI_E_KEY_DOES_NOT_EXIST "; + case SPAPI_E_INVALID_DEVINST_NAME : + return "SPAPI_E_INVALID_DEVINST_NAME "; + case SPAPI_E_INVALID_CLASS : + return "SPAPI_E_INVALID_CLASS "; + case SPAPI_E_DEVINST_ALREADY_EXISTS : + return "SPAPI_E_DEVINST_ALREADY_EXISTS "; + case SPAPI_E_DEVINFO_NOT_REGISTERED : + return "SPAPI_E_DEVINFO_NOT_REGISTERED "; + case SPAPI_E_INVALID_REG_PROPERTY : + return "SPAPI_E_INVALID_REG_PROPERTY "; + case SPAPI_E_NO_INF : + return "SPAPI_E_NO_INF "; + case SPAPI_E_NO_SUCH_DEVINST : + return "SPAPI_E_NO_SUCH_DEVINST "; + case SPAPI_E_CANT_LOAD_CLASS_ICON : + return "SPAPI_E_CANT_LOAD_CLASS_ICON "; + case SPAPI_E_INVALID_CLASS_INSTALLER : + return "SPAPI_E_INVALID_CLASS_INSTALLER "; + case SPAPI_E_DI_DO_DEFAULT : + return "SPAPI_E_DI_DO_DEFAULT "; + case SPAPI_E_DI_NOFILECOPY : + return "SPAPI_E_DI_NOFILECOPY "; + case SPAPI_E_INVALID_HWPROFILE : + return "SPAPI_E_INVALID_HWPROFILE "; + case SPAPI_E_NO_DEVICE_SELECTED : + return "SPAPI_E_NO_DEVICE_SELECTED "; + case SPAPI_E_DEVINFO_LIST_LOCKED : + return "SPAPI_E_DEVINFO_LIST_LOCKED "; + case SPAPI_E_DEVINFO_DATA_LOCKED : + return "SPAPI_E_DEVINFO_DATA_LOCKED "; + case SPAPI_E_DI_BAD_PATH : + return "SPAPI_E_DI_BAD_PATH "; + case SPAPI_E_NO_CLASSINSTALL_PARAMS : + return "SPAPI_E_NO_CLASSINSTALL_PARAMS "; + case SPAPI_E_FILEQUEUE_LOCKED : + return "SPAPI_E_FILEQUEUE_LOCKED "; + case SPAPI_E_BAD_SERVICE_INSTALLSECT : + return "SPAPI_E_BAD_SERVICE_INSTALLSECT "; + case SPAPI_E_NO_CLASS_DRIVER_LIST : + return "SPAPI_E_NO_CLASS_DRIVER_LIST "; + case SPAPI_E_NO_ASSOCIATED_SERVICE : + return "SPAPI_E_NO_ASSOCIATED_SERVICE "; + case SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE : + return "SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE "; + case SPAPI_E_DEVICE_INTERFACE_ACTIVE : + return "SPAPI_E_DEVICE_INTERFACE_ACTIVE "; + case SPAPI_E_DEVICE_INTERFACE_REMOVED : + return "SPAPI_E_DEVICE_INTERFACE_REMOVED "; + case SPAPI_E_BAD_INTERFACE_INSTALLSECT : + return "SPAPI_E_BAD_INTERFACE_INSTALLSECT "; + case SPAPI_E_NO_SUCH_INTERFACE_CLASS : + return "SPAPI_E_NO_SUCH_INTERFACE_CLASS "; + case SPAPI_E_INVALID_REFERENCE_STRING : + return "SPAPI_E_INVALID_REFERENCE_STRING "; + case SPAPI_E_INVALID_MACHINENAME : + return "SPAPI_E_INVALID_MACHINENAME "; + case SPAPI_E_REMOTE_COMM_FAILURE : + return "SPAPI_E_REMOTE_COMM_FAILURE "; + case SPAPI_E_MACHINE_UNAVAILABLE : + return "SPAPI_E_MACHINE_UNAVAILABLE "; + case SPAPI_E_NO_CONFIGMGR_SERVICES : + return "SPAPI_E_NO_CONFIGMGR_SERVICES "; + case SPAPI_E_INVALID_PROPPAGE_PROVIDER : + return "SPAPI_E_INVALID_PROPPAGE_PROVIDER "; + case SPAPI_E_NO_SUCH_DEVICE_INTERFACE : + return "SPAPI_E_NO_SUCH_DEVICE_INTERFACE "; + case SPAPI_E_DI_POSTPROCESSING_REQUIRED : + return "SPAPI_E_DI_POSTPROCESSING_REQUIRED "; + case SPAPI_E_INVALID_COINSTALLER : + return "SPAPI_E_INVALID_COINSTALLER "; + case SPAPI_E_NO_COMPAT_DRIVERS : + return "SPAPI_E_NO_COMPAT_DRIVERS "; + case SPAPI_E_NO_DEVICE_ICON : + return "SPAPI_E_NO_DEVICE_ICON "; + case SPAPI_E_INVALID_INF_LOGCONFIG : + return "SPAPI_E_INVALID_INF_LOGCONFIG "; + case SPAPI_E_DI_DONT_INSTALL : + return "SPAPI_E_DI_DONT_INSTALL "; + case SPAPI_E_INVALID_FILTER_DRIVER : + return "SPAPI_E_INVALID_FILTER_DRIVER "; + case SPAPI_E_ERROR_NOT_INSTALLED : + return "SPAPI_E_ERROR_NOT_INSTALLED "; - default: - static char buff[1000]; - sprintf(buff, "Unrecognized error value: %08X\0", error); + default: + static char buff[1000]; + sprintf(buff, "Unrecognized error value: %08X\0", error); - return buff; - } + return buff; + } } diff --git a/panda/src/wdxdisplay/wdxGraphicsPipe.h b/panda/src/wdxdisplay/wdxGraphicsPipe.h index b295be36c1..5661571d6d 100644 --- a/panda/src/wdxdisplay/wdxGraphicsPipe.h +++ b/panda/src/wdxdisplay/wdxGraphicsPipe.h @@ -51,9 +51,9 @@ private: static TypeHandle _type_handle; - int _width; - int _height; - bool _shift; + int _width; + int _height; + bool _shift; protected: diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx index aef17be5bb..723544823f 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.cxx +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.cxx @@ -31,40 +31,40 @@ TypeHandle wdxGraphicsWindow::_type_handle; // BUGBUG: kluge to make up for lack of panda exit fn. prevents multiple DX windows -// need to replace this with global hwnd->wdx classptr STL map obj +// need to replace this with global hwnd->wdx classptr STL map obj wdxGraphicsWindow* global_dxwin = NULL; #define MOUSE_ENTERED 0 #define MOUSE_EXITED 1 static DWORD BitDepth_2_DDBDMask(DWORD iBitDepth) { - switch(iBitDepth) { - case 16: return DDBD_16; - case 32: return DDBD_32; - case 24: return DDBD_24; - case 8: return DDBD_8; - case 1: return DDBD_1; - case 2: return DDBD_2; - case 4: return DDBD_4; - } - return 0x0; + switch(iBitDepth) { + case 16: return DDBD_16; + case 32: return DDBD_32; + case 24: return DDBD_24; + case 8: return DDBD_8; + case 1: return DDBD_1; + case 2: return DDBD_2; + case 4: return DDBD_4; + } + return 0x0; } #ifdef _DEBUG static void DebugPrintPixFmt(DDPIXELFORMAT* pddpf) { - static int iddpfnum=0; - ostream *dbgout = &dxgsg_cat.debug(); + static int iddpfnum=0; + ostream *dbgout = &dxgsg_cat.debug(); - *dbgout << "ZBuf DDPF[" << iddpfnum << "]: RGBBitCount:" << pddpf->dwRGBBitCount - << " Flags:" << (void *)pddpf->dwFlags ; + *dbgout << "ZBuf DDPF[" << iddpfnum << "]: RGBBitCount:" << pddpf->dwRGBBitCount + << " Flags:" << (void *)pddpf->dwFlags ; - if(pddpf->dwFlags & DDPF_STENCILBUFFER) { - *dbgout << " StencilBits:" << (void *) pddpf->dwStencilBitDepth; - } + if(pddpf->dwFlags & DDPF_STENCILBUFFER) { + *dbgout << " StencilBits:" << (void *) pddpf->dwStencilBitDepth; + } - *dbgout << endl; + *dbgout << endl; - iddpfnum++; + iddpfnum++; } #endif @@ -73,11 +73,11 @@ static void DebugPrintPixFmt(DDPIXELFORMAT* pddpf) { static int cNumZBufFmts=0; HRESULT CALLBACK EnumZBufFmtsCallback( LPDDPIXELFORMAT pddpf, VOID* param ) { - DDPIXELFORMAT *ZBufFmtsArr = (DDPIXELFORMAT *) param; - assert(cNumZBufFmts < MAX_DX_ZBUF_FMTS); - memcpy( &(ZBufFmtsArr[cNumZBufFmts]), pddpf, sizeof(DDPIXELFORMAT) ); - cNumZBufFmts++; - return DDENUMRET_OK; + DDPIXELFORMAT *ZBufFmtsArr = (DDPIXELFORMAT *) param; + assert(cNumZBufFmts < MAX_DX_ZBUF_FMTS); + memcpy( &(ZBufFmtsArr[cNumZBufFmts]), pddpf, sizeof(DDPIXELFORMAT) ); + cNumZBufFmts++; + return DDENUMRET_OK; } //////////////////////////////////////////////////////////////////// @@ -87,100 +87,100 @@ HRESULT CALLBACK EnumZBufFmtsCallback( LPDDPIXELFORMAT pddpf, VOID* param ) { //////////////////////////////////////////////////////////////////// ButtonHandle wdxGraphicsWindow:: lookup_key(WPARAM wparam) const { - switch(wparam) { - case VK_BACK: return KeyboardButton::backspace(); - case VK_TAB: return KeyboardButton::tab(); - case VK_ESCAPE: return KeyboardButton::escape(); - case VK_SPACE: return KeyboardButton::space(); - case VK_UP: return KeyboardButton::up(); - case VK_DOWN: return KeyboardButton::down(); - case VK_LEFT: return KeyboardButton::left(); - case VK_RIGHT: return KeyboardButton::right(); - case VK_PRIOR: return KeyboardButton::page_up(); - case VK_NEXT: return KeyboardButton::page_down(); - case VK_HOME: return KeyboardButton::home(); - case VK_END: return KeyboardButton::end(); - case VK_F1: return KeyboardButton::f1(); - case VK_F2: return KeyboardButton::f2(); - case VK_F3: return KeyboardButton::f3(); - case VK_F4: return KeyboardButton::f4(); - case VK_F5: return KeyboardButton::f5(); - case VK_F6: return KeyboardButton::f6(); - case VK_F7: return KeyboardButton::f7(); - case VK_F8: return KeyboardButton::f8(); - case VK_F9: return KeyboardButton::f9(); - case VK_F10: return KeyboardButton::f10(); - case VK_F11: return KeyboardButton::f11(); - case VK_F12: return KeyboardButton::f12(); - case VK_INSERT: return KeyboardButton::insert(); - case VK_DELETE: return KeyboardButton::del(); + switch(wparam) { + case VK_BACK: return KeyboardButton::backspace(); + case VK_TAB: return KeyboardButton::tab(); + case VK_ESCAPE: return KeyboardButton::escape(); + case VK_SPACE: return KeyboardButton::space(); + case VK_UP: return KeyboardButton::up(); + case VK_DOWN: return KeyboardButton::down(); + case VK_LEFT: return KeyboardButton::left(); + case VK_RIGHT: return KeyboardButton::right(); + case VK_PRIOR: return KeyboardButton::page_up(); + case VK_NEXT: return KeyboardButton::page_down(); + case VK_HOME: return KeyboardButton::home(); + case VK_END: return KeyboardButton::end(); + case VK_F1: return KeyboardButton::f1(); + case VK_F2: return KeyboardButton::f2(); + case VK_F3: return KeyboardButton::f3(); + case VK_F4: return KeyboardButton::f4(); + case VK_F5: return KeyboardButton::f5(); + case VK_F6: return KeyboardButton::f6(); + case VK_F7: return KeyboardButton::f7(); + case VK_F8: return KeyboardButton::f8(); + case VK_F9: return KeyboardButton::f9(); + case VK_F10: return KeyboardButton::f10(); + case VK_F11: return KeyboardButton::f11(); + case VK_F12: return KeyboardButton::f12(); + case VK_INSERT: return KeyboardButton::insert(); + case VK_DELETE: return KeyboardButton::del(); - case VK_SHIFT: - case VK_LSHIFT: - case VK_RSHIFT: - return KeyboardButton::shift(); + case VK_SHIFT: + case VK_LSHIFT: + case VK_RSHIFT: + return KeyboardButton::shift(); - case VK_CONTROL: - case VK_LCONTROL: - case VK_RCONTROL: - return KeyboardButton::control(); + case VK_CONTROL: + case VK_LCONTROL: + case VK_RCONTROL: + return KeyboardButton::control(); - case VK_MENU: - case VK_LMENU: - case VK_RMENU: - return KeyboardButton::alt(); + case VK_MENU: + case VK_LMENU: + case VK_RMENU: + return KeyboardButton::alt(); - default: - int key = MapVirtualKey(wparam, 2); - if(isascii(key) && key != 0) { - if(GetKeyState(VK_SHIFT) >= 0) - key = tolower(key); - else { - switch(key) { - case '1': key = '!'; break; - case '2': key = '@'; break; - case '3': key = '#'; break; - case '4': key = '$'; break; - case '5': key = '%'; break; - case '6': key = '^'; break; - case '7': key = '&'; break; - case '8': key = '*'; break; - case '9': key = '('; break; - case '0': key = ')'; break; - case '-': key = '_'; break; - case '=': key = '+'; break; - case ',': key = '<'; break; - case '.': key = '>'; break; - case '/': key = '?'; break; - case ';': key = ':'; break; - case '\'': key = '"'; break; - case '[': key = '{'; break; - case ']': key = '}'; break; - case '\\': key = '|'; break; - case '`': key = '~'; break; - } - } - return KeyboardButton::ascii_key((uchar)key); - } - break; - } - return ButtonHandle::none(); + default: + int key = MapVirtualKey(wparam, 2); + if(isascii(key) && key != 0) { + if(GetKeyState(VK_SHIFT) >= 0) + key = tolower(key); + else { + switch(key) { + case '1': key = '!'; break; + case '2': key = '@'; break; + case '3': key = '#'; break; + case '4': key = '$'; break; + case '5': key = '%'; break; + case '6': key = '^'; break; + case '7': key = '&'; break; + case '8': key = '*'; break; + case '9': key = '('; break; + case '0': key = ')'; break; + case '-': key = '_'; break; + case '=': key = '+'; break; + case ',': key = '<'; break; + case '.': key = '>'; break; + case '/': key = '?'; break; + case ';': key = ':'; break; + case '\'': key = '"'; break; + case '[': key = '{'; break; + case ']': key = '}'; break; + case '\\': key = '|'; break; + case '`': key = '~'; break; + } + } + return KeyboardButton::ascii_key((uchar)key); + } + break; + } + return ButtonHandle::none(); } void AtExitFn() { #ifdef _DEBUG - wdxdisplay_cat.debug() << "AtExitFn called\n"; - OutputDebugString("AtExitFn called\n"); + wdxdisplay_cat.debug() << "AtExitFn called\n"; + OutputDebugString("AtExitFn called\n"); #endif - if(global_dxwin==NULL) - return; - if(global_dxwin->_hParentWindow!=NULL) { - SetForegroundWindow(global_dxwin->_hParentWindow); - } - if(global_dxwin->_dxgsg!=NULL) { - (global_dxwin->_dxgsg)->dx_cleanup(); - global_dxwin->_dxgsg=NULL; - } + if(global_dxwin==NULL) + return; + if(global_dxwin->_hParentWindow!=NULL) { + SetForegroundWindow(global_dxwin->_hParentWindow); + } + if(global_dxwin->_dxgsg!=NULL) { + (global_dxwin->_dxgsg)->dx_cleanup(); + global_dxwin->_dxgsg=NULL; + } // global_dxwin->dxgsg->GetDXReady() = false; // delete dxgsg; does panda do this itself? @@ -193,15 +193,15 @@ void AtExitFn() { // Description: //////////////////////////////////////////////////////////////////// LONG WINAPI wdxGraphicsWindow::static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - // BUGBUG: cant do this if we want multiple windows (but then how does window_proc access wdxwin class members? - // need global mapping of hwnd->wdxwin class ptrs (use STL map object?) - return global_dxwin->window_proc(hwnd, msg, wparam, lparam); + // BUGBUG: cant do this if we want multiple windows (but then how does window_proc access wdxwin class members? + // need global mapping of hwnd->wdxwin class ptrs (use STL map object?) + return global_dxwin->window_proc(hwnd, msg, wparam, lparam); } #if defined(NOTIFY_DEBUG) || defined(DO_PSTATS) extern void dbgPrintVidMem(LPDIRECTDRAW7 pDD, LPDDSCAPS2 lpddsCaps,const char *pMsg) { - DWORD dwTotal,dwFree; - HRESULT hr; + DWORD dwTotal,dwFree; + HRESULT hr; /* * These Caps bits arent allowed to be specified when calling GetAvailVidMem. @@ -218,21 +218,21 @@ extern void dbgPrintVidMem(LPDIRECTDRAW7 pDD, LPDDSCAPS2 lpddsCaps,const char *p DDSCAPS_VISIBLE | \ DDSCAPS_WRITEONLY) - DDSCAPS2 ddsCaps = *lpddsCaps; - ddsCaps.dwCaps &= ~(AVAILVIDMEM_BADCAPS); // turn off the bad caps + DDSCAPS2 ddsCaps = *lpddsCaps; + ddsCaps.dwCaps &= ~(AVAILVIDMEM_BADCAPS); // turn off the bad caps // ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; done internally by DX anyway - if(FAILED( hr = pDD->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { - wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pDD->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { + wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } #ifdef NOTIFY_DEBUG // Write a debug message to the console reporting the texture memory. - char tmpstr[100],tmpstr2[100]; - sprintf(tmpstr,"%.4g",dwTotal/1000000.0); - sprintf(tmpstr2,"%.4g",dwFree/1000000.0); - wdxdisplay_cat.debug() << "AvailableVidMem before creating "<< pMsg << ",(megs) total: " << tmpstr << " free:" << tmpstr2 <GetDXReady()) - show_frame(); - EndPaint(hwnd, &ps); - return 0; + if(_dxgsg->GetDXReady()) + show_frame(); + EndPaint(hwnd, &ps); + return 0; - case WM_SYSCHAR: - case WM_CHAR: - return 0; - case WM_SYSKEYDOWN: - case WM_KEYDOWN: - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - handle_keypress(lookup_key(wparam), point.x, point.y); - return 0; - case WM_SYSKEYUP: - case WM_KEYUP: - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - handle_keyrelease(lookup_key(wparam), point.x, point.y); - return 0; + case WM_SYSCHAR: + case WM_CHAR: + return 0; + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + handle_keypress(lookup_key(wparam), point.x, point.y); + return 0; + case WM_SYSKEYUP: + case WM_KEYUP: + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + handle_keyrelease(lookup_key(wparam), point.x, point.y); + return 0; - case WM_LBUTTONDOWN: - button = 0; - case WM_MBUTTONDOWN: - if(button < 0) - button = 1; - case WM_RBUTTONDOWN: - if(button < 0) - button = 2; - SetCapture(hwnd); - // Win32 doesn't return the same numbers as X does when the mouse - // goes beyond the upper or left side of the window - x = LOWORD(lparam); - y = HIWORD(lparam); - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - if(_dxgsg->GetDXReady()) - handle_keypress(MouseButton::button(button), x, y); - return 0; + case WM_LBUTTONDOWN: + button = 0; + case WM_MBUTTONDOWN: + if(button < 0) + button = 1; + case WM_RBUTTONDOWN: + if(button < 0) + button = 2; + SetCapture(hwnd); + // Win32 doesn't return the same numbers as X does when the mouse + // goes beyond the upper or left side of the window + x = LOWORD(lparam); + y = HIWORD(lparam); + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + if(_dxgsg->GetDXReady()) + handle_keypress(MouseButton::button(button), x, y); + return 0; - case WM_LBUTTONUP: - button = 0; - case WM_MBUTTONUP: - if(button < 0) - button = 1; - case WM_RBUTTONUP: - if(button < 0) - button = 2; - ReleaseCapture(); - x = LOWORD(lparam); - y = HIWORD(lparam); - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - if(_dxgsg->GetDXReady()) - handle_keyrelease(MouseButton::button(button), x, y); - return 0; + case WM_LBUTTONUP: + button = 0; + case WM_MBUTTONUP: + if(button < 0) + button = 1; + case WM_RBUTTONUP: + if(button < 0) + button = 2; + ReleaseCapture(); + x = LOWORD(lparam); + y = HIWORD(lparam); + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + if(_dxgsg->GetDXReady()) + handle_keyrelease(MouseButton::button(button), x, y); + return 0; - case WM_MOUSEMOVE: - if(_dxgsg->GetDXReady()) { - x = LOWORD(lparam); - y = HIWORD(lparam); - if(x & 1 << 15) x -= (1 << 16); - if(y & 1 << 15) y -= (1 << 16); - if(mouse_motion_enabled() - && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { - handle_mouse_motion(x, y); - } else if(mouse_passive_motion_enabled() && - ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { - handle_mouse_motion(x, y); - } - } - return 0; + case WM_MOUSEMOVE: + if(_dxgsg->GetDXReady()) { + x = LOWORD(lparam); + y = HIWORD(lparam); + if(x & 1 << 15) x -= (1 << 16); + if(y & 1 << 15) y -= (1 << 16); + if(mouse_motion_enabled() + && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { + handle_mouse_motion(x, y); + } else if(mouse_passive_motion_enabled() && + ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { + handle_mouse_motion(x, y); + } + } + return 0; - case WM_MOVE: - if(_dxgsg->GetDXReady()) - handle_window_move(LOWORD(lparam), HIWORD(lparam) ); - return 0; + case WM_MOVE: + if(_dxgsg->GetDXReady()) + handle_window_move(LOWORD(lparam), HIWORD(lparam) ); + return 0; - case WM_EXITSIZEMOVE: + case WM_EXITSIZEMOVE: #ifdef _DEBUG - wdxdisplay_cat.spam() << "WM_EXITSIZEMOVE received" << endl; + wdxdisplay_cat.spam() << "WM_EXITSIZEMOVE received" << endl; #endif - if(_WindowAdjustingType==Resizing) { - _dxgsg->SetDXReady(false); // disable rendering whilst we mess with surfs + if(_WindowAdjustingType==Resizing) { + _dxgsg->SetDXReady(false); // disable rendering whilst we mess with surfs - // Want to change rendertarget size without destroying d3d device. To save vid memory - // (and make resizing work on memory-starved 4MB cards), we need to construct - // a temporary mini-sized render target for the d3d device (it cannot point to a - // NULL rendertarget) before creating the fully resized buffers. The old - // rendertargets will be freed when these temp targets are set, and that will give - // us the memory to create the resized target + // Want to change rendertarget size without destroying d3d device. To save vid memory + // (and make resizing work on memory-starved 4MB cards), we need to construct + // a temporary mini-sized render target for the d3d device (it cannot point to a + // NULL rendertarget) before creating the fully resized buffers. The old + // rendertargets will be freed when these temp targets are set, and that will give + // us the memory to create the resized target - LPDIRECTDRAWSURFACE7 pddsDummy = NULL,pddsDummyZ = NULL; - HRESULT hr; + LPDIRECTDRAWSURFACE7 pddsDummy = NULL,pddsDummyZ = NULL; + HRESULT hr; - DX_DECLARE_CLEAN( DDSURFACEDESC2, ddsd ); + DX_DECLARE_CLEAN( DDSURFACEDESC2, ddsd ); - if(_dxgsg->GetBackBuffer()==NULL) // bugbug why is this ever true?? - return DefWindowProc(hwnd, msg, wparam, lparam); + if(_dxgsg->GetBackBuffer()==NULL) // bugbug why is this ever true?? + return DefWindowProc(hwnd, msg, wparam, lparam); - _dxgsg->GetBackBuffer()->GetSurfaceDesc(&ddsd); - LPDIRECTDRAW7 pDD = _dxgsg->GetDDInterface(); + _dxgsg->GetBackBuffer()->GetSurfaceDesc(&ddsd); + LPDIRECTDRAW7 pDD = _dxgsg->GetDDInterface(); - ddsd.dwFlags &= ~DDSD_PITCH; - ddsd.dwWidth = 1; ddsd.dwHeight = 1; - ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER); + ddsd.dwFlags &= ~DDSD_PITCH; + ddsd.dwWidth = 1; ddsd.dwHeight = 1; + ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER); - PRINTVIDMEM(pDD,&ddsd.ddsCaps,"dummy backbuf"); + PRINTVIDMEM(pDD,&ddsd.ddsCaps,"dummy backbuf"); - if(FAILED( hr = pDD->CreateSurface( &ddsd, &pddsDummy, NULL ) )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::Resize CreateSurface for temp backbuf failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pDD->CreateSurface( &ddsd, &pddsDummy, NULL ) )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::Resize CreateSurface for temp backbuf failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - DX_DECLARE_CLEAN( DDSURFACEDESC2, ddsdZ ); - _dxgsg->GetZBuffer()->GetSurfaceDesc(&ddsdZ); - ddsdZ.dwFlags &= ~DDSD_PITCH; - ddsdZ.dwWidth = 1; ddsdZ.dwHeight = 1; + DX_DECLARE_CLEAN( DDSURFACEDESC2, ddsdZ ); + _dxgsg->GetZBuffer()->GetSurfaceDesc(&ddsdZ); + ddsdZ.dwFlags &= ~DDSD_PITCH; + ddsdZ.dwWidth = 1; ddsdZ.dwHeight = 1; - PRINTVIDMEM(pDD,&ddsdZ.ddsCaps,"dummy zbuf"); + PRINTVIDMEM(pDD,&ddsdZ.ddsCaps,"dummy zbuf"); - if(FAILED( hr = pDD->CreateSurface( &ddsdZ, &pddsDummyZ, NULL ) )) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::Resize CreateSurface for temp zbuf failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pDD->CreateSurface( &ddsdZ, &pddsDummyZ, NULL ) )) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::Resize CreateSurface for temp zbuf failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED( hr = pddsDummy->AddAttachedSurface( pddsDummyZ ) )) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::Resize AddAttachedSurf for temp zbuf failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pddsDummy->AddAttachedSurface( pddsDummyZ ) )) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::Resize AddAttachedSurf for temp zbuf failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED( hr = _dxgsg->GetD3DDevice()->SetRenderTarget( pddsDummy, 0x0 ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::Resize failed to set render target to temporary surface, result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - RELEASE(pddsDummyZ); - RELEASE(pddsDummy); + if(FAILED( hr = _dxgsg->GetD3DDevice()->SetRenderTarget( pddsDummy, 0x0 ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::Resize failed to set render target to temporary surface, result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + RELEASE(pddsDummyZ); + RELEASE(pddsDummy); - RECT view_rect; - GetClientRect( _mwindow, &view_rect ); - ClientToScreen( _mwindow, (POINT*)&view_rect.left ); - ClientToScreen( _mwindow, (POINT*)&view_rect.right ); + RECT view_rect; + GetClientRect( _mwindow, &view_rect ); + ClientToScreen( _mwindow, (POINT*)&view_rect.left ); + ClientToScreen( _mwindow, (POINT*)&view_rect.right ); - _dxgsg->dx_setup_after_resize(view_rect,_mwindow); // create the new resized rendertargets + _dxgsg->dx_setup_after_resize(view_rect,_mwindow); // create the new resized rendertargets - // change _props xsize,ysize - resized((view_rect.right - view_rect.left),(view_rect.bottom - view_rect.top)); - _props._xorg = view_rect.left; // _props origin should reflect view rectangle - _props._yorg = view_rect.top; + // change _props xsize,ysize + resized((view_rect.right - view_rect.left),(view_rect.bottom - view_rect.top)); + _props._xorg = view_rect.left; // _props origin should reflect view rectangle + _props._yorg = view_rect.top; - _dxgsg->SetDXReady(true); - } - _WindowAdjustingType = NotAdjusting; - return 0; + _dxgsg->SetDXReady(true); + } + _WindowAdjustingType = NotAdjusting; + return 0; - case WM_ENTERSIZEMOVE: { - _dxgsg->SetDXReady(true); // dont disable here because I want to see pic as I resize - _WindowAdjustingType = MovingOrResizing; - } - return DefWindowProc(hwnd, msg, wparam, lparam); + case WM_ENTERSIZEMOVE: { + _dxgsg->SetDXReady(true); // dont disable here because I want to see pic as I resize + _WindowAdjustingType = MovingOrResizing; + } + return DefWindowProc(hwnd, msg, wparam, lparam); - case WM_DISPLAYCHANGE: { + case WM_DISPLAYCHANGE: { #ifdef _DEBUG - width = LOWORD(lparam); height = HIWORD(lparam); - DWORD newbitdepth=wparam; - wdxdisplay_cat.spam() <<"WM_DISPLAYCHANGE received with width:" << width << " height: " << height << " bpp: " << wparam<< endl; + width = LOWORD(lparam); height = HIWORD(lparam); + DWORD newbitdepth=wparam; + wdxdisplay_cat.spam() <<"WM_DISPLAYCHANGE received with width:" << width << " height: " << height << " bpp: " << wparam<< endl; #endif - // Note: TestCoopLevel in dxgsg will return WRONGMODE if there is a problem after a displaymode change - // so we dont need to abort here + // Note: TestCoopLevel in dxgsg will return WRONGMODE if there is a problem after a displaymode change + // so we dont need to abort here - } - return DefWindowProc(hwnd, msg, wparam, lparam); + } + return DefWindowProc(hwnd, msg, wparam, lparam); - case WM_SIZE: { + case WM_SIZE: { #ifdef _DEBUG - { - width = LOWORD(lparam); height = HIWORD(lparam); - wdxdisplay_cat.spam() << "WM_SIZE received with width:" << width << " height: " << height << " flags: " << - ((wparam == SIZE_MAXHIDE)? "SIZE_MAXHIDE " : "") << ((wparam == SIZE_MAXSHOW)? "SIZE_MAXSHOW " : "") << - ((wparam == SIZE_MINIMIZED)? "SIZE_MINIMIZED " : "") << ((wparam == SIZE_RESTORED)? "SIZE_RESTORED " : "") << - ((wparam == SIZE_MAXIMIZED)? "SIZE_MAXIMIZED " : "") << endl; - } + { + width = LOWORD(lparam); height = HIWORD(lparam); + wdxdisplay_cat.spam() << "WM_SIZE received with width:" << width << " height: " << height << " flags: " << + ((wparam == SIZE_MAXHIDE)? "SIZE_MAXHIDE " : "") << ((wparam == SIZE_MAXSHOW)? "SIZE_MAXSHOW " : "") << + ((wparam == SIZE_MINIMIZED)? "SIZE_MINIMIZED " : "") << ((wparam == SIZE_RESTORED)? "SIZE_RESTORED " : "") << + ((wparam == SIZE_MAXIMIZED)? "SIZE_MAXIMIZED " : "") << endl; + } #endif - // old comment -- added SIZE_RESTORED to handle 3dfx case - if((_mwindow==NULL) || ((wparam != SIZE_RESTORED) && (wparam != SIZE_MAXIMIZED))) - return DefWindowProc(hwnd, msg, wparam, lparam); + // old comment -- added SIZE_RESTORED to handle 3dfx case + if((_mwindow==NULL) || ((wparam != SIZE_RESTORED) && (wparam != SIZE_MAXIMIZED))) + return DefWindowProc(hwnd, msg, wparam, lparam); - width = LOWORD(lparam); height = HIWORD(lparam); + width = LOWORD(lparam); height = HIWORD(lparam); - if(_props._xsize != width || _props._ysize != height) { - _WindowAdjustingType = Resizing; + if(_props._xsize != width || _props._ysize != height) { + _WindowAdjustingType = Resizing; - // for maximized,unmaximize, need to call resize code artificially - // since no WM_EXITSIZEMOVE is generated - if(wparam==SIZE_MAXIMIZED) { - _bSizeIsMaximized=TRUE; - window_proc(hwnd, WM_EXITSIZEMOVE, 0x0,0x0); - } else if((wparam==SIZE_RESTORED)&& _bSizeIsMaximized) { - _bSizeIsMaximized=FALSE; - window_proc(hwnd, WM_EXITSIZEMOVE, 0x0,0x0); - } - } + // for maximized,unmaximize, need to call resize code artificially + // since no WM_EXITSIZEMOVE is generated + if(wparam==SIZE_MAXIMIZED) { + _bSizeIsMaximized=TRUE; + window_proc(hwnd, WM_EXITSIZEMOVE, 0x0,0x0); + } else if((wparam==SIZE_RESTORED)&& _bSizeIsMaximized) { + _bSizeIsMaximized=FALSE; + window_proc(hwnd, WM_EXITSIZEMOVE, 0x0,0x0); + } + } - return DefWindowProc(hwnd, msg, wparam, lparam); - } + return DefWindowProc(hwnd, msg, wparam, lparam); + } - case WM_SETFOCUS: - if(_dxgsg->GetDXReady() && _mouse_entry_enabled) - handle_mouse_entry(MOUSE_ENTERED,_hMouseCrossIcon); - return 0; + case WM_SETFOCUS: + if(_dxgsg->GetDXReady() && _mouse_entry_enabled) + handle_mouse_entry(MOUSE_ENTERED,_hMouseCrossIcon); + return 0; #if 0 - case WM_WINDOWPOSCHANGING: { - LPWINDOWPOS pWindPos = (LPWINDOWPOS) lparam; - wdxdisplay_cat.spam() << "WM_WINDOWPOSCHANGING received, flags 0x" << pWindPos->flags << endl; - return DefWindowProc(hwnd, msg, wparam, lparam); - } + case WM_WINDOWPOSCHANGING: { + LPWINDOWPOS pWindPos = (LPWINDOWPOS) lparam; + wdxdisplay_cat.spam() << "WM_WINDOWPOSCHANGING received, flags 0x" << pWindPos->flags << endl; + return DefWindowProc(hwnd, msg, wparam, lparam); + } - case WM_GETMINMAXINFO: - wdxdisplay_cat.spam() << "WM_GETMINMAXINFO received\n" << endl; - return DefWindowProc(hwnd, msg, wparam, lparam); + case WM_GETMINMAXINFO: + wdxdisplay_cat.spam() << "WM_GETMINMAXINFO received\n" << endl; + return DefWindowProc(hwnd, msg, wparam, lparam); #endif - case WM_ERASEBKGND: - if(_WindowAdjustingType) - return DefWindowProc(hwnd, msg, wparam, lparam); - else return 0; // dont let GDI waste time redrawing the deflt background + case WM_ERASEBKGND: + if(_WindowAdjustingType) + return DefWindowProc(hwnd, msg, wparam, lparam); + else return 0; // dont let GDI waste time redrawing the deflt background - case WM_KILLFOCUS: - if(_dxgsg->GetDXReady() && _mouse_entry_enabled) - handle_mouse_entry(MOUSE_EXITED,_hMouseCrossIcon); - return 0; + case WM_KILLFOCUS: + if(_dxgsg->GetDXReady() && _mouse_entry_enabled) + handle_mouse_entry(MOUSE_EXITED,_hMouseCrossIcon); + return 0; - default: - return DefWindowProc(hwnd, msg, wparam, lparam); - } + default: + return DefWindowProc(hwnd, msg, wparam, lparam); + } } @@ -522,7 +522,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { //////////////////////////////////////////////////////////////////// wdxGraphicsWindow:: wdxGraphicsWindow(GraphicsPipe* pipe) : GraphicsWindow(pipe) { - config(); + config(); } //////////////////////////////////////////////////////////////////// @@ -532,8 +532,8 @@ wdxGraphicsWindow(GraphicsPipe* pipe) : GraphicsWindow(pipe) { //////////////////////////////////////////////////////////////////// wdxGraphicsWindow:: wdxGraphicsWindow(GraphicsPipe* pipe, const - GraphicsWindow::Properties& props) : GraphicsWindow(pipe, props) { - config(); + GraphicsWindow::Properties& props) : GraphicsWindow(pipe, props) { + config(); } //////////////////////////////////////////////////////////////////// @@ -542,7 +542,7 @@ wdxGraphicsWindow(GraphicsPipe* pipe, const // Description: //////////////////////////////////////////////////////////////////// wdxGraphicsWindow::~wdxGraphicsWindow(void) { - AtExitFn(); + AtExitFn(); } //////////////////////////////////////////////////////////////////// @@ -551,695 +551,695 @@ wdxGraphicsWindow::~wdxGraphicsWindow(void) { // Description: Set up win32 window //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::config(void) { - GraphicsWindow::config(); + GraphicsWindow::config(); - global_dxwin = this; // kludge to get window proc working + global_dxwin = this; // kludge to get window proc working - _mwindow = NULL; - _gsg = _dxgsg = NULL; - _hParentWindow = NULL; + _mwindow = NULL; + _gsg = _dxgsg = NULL; + _hParentWindow = NULL; - _WindowAdjustingType = NotAdjusting; - _hMouseCrossIcon = NULL; - _bSizeIsMaximized=FALSE; + _WindowAdjustingType = NotAdjusting; + _hMouseCrossIcon = NULL; + _bSizeIsMaximized=FALSE; - // Create a GSG to manage the graphics - make_gsg(); - if(_gsg==NULL) { - wdxdisplay_cat.error() << "DXGSG creation failed!\n"; - exit(1); - } - _dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); + // Create a GSG to manage the graphics + make_gsg(); + if(_gsg==NULL) { + wdxdisplay_cat.error() << "DXGSG creation failed!\n"; + exit(1); + } + _dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); - HINSTANCE hinstance = GetModuleHandle(NULL); + HINSTANCE hinstance = GetModuleHandle(NULL); - WNDCLASS wc; + WNDCLASS wc; - // Clear before filling in window structure! - ZeroMemory(&wc, sizeof(WNDCLASS)); - wc.style = CS_HREDRAW | CS_VREDRAW; //CS_OWNDC; - wc.lpfnWndProc = (WNDPROC) static_window_proc; - wc.hInstance = hinstance; + // Clear before filling in window structure! + ZeroMemory(&wc, sizeof(WNDCLASS)); + wc.style = CS_HREDRAW | CS_VREDRAW; //CS_OWNDC; + wc.lpfnWndProc = (WNDPROC) static_window_proc; + wc.hInstance = hinstance; - string windows_icon_filename = get_icon_filename().to_os_specific(); + string windows_icon_filename = get_icon_filename().to_os_specific(); - if(!windows_icon_filename.empty()) { - // Note: LoadImage seems to cause win2k internal heap corruption (outputdbgstr warnings) - // if icon is more than 8bpp - wc.hIcon = (HICON) LoadImage(NULL, windows_icon_filename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); - } else { - wc.hIcon = NULL; // use default app icon - } + if(!windows_icon_filename.empty()) { + // Note: LoadImage seems to cause win2k internal heap corruption (outputdbgstr warnings) + // if icon is more than 8bpp + wc.hIcon = (HICON) LoadImage(NULL, windows_icon_filename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); + } else { + wc.hIcon = NULL; // use default app icon + } - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = "wdxDisplay"; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = "wdxDisplay"; - if(!RegisterClass(&wc)) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: could not register window class" << endl; - exit(1); - } + if(!RegisterClass(&wc)) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: could not register window class" << endl; + exit(1); + } - wdxGraphicsPipe* pipe = DCAST(wdxGraphicsPipe, _pipe); + wdxGraphicsPipe* pipe = DCAST(wdxGraphicsPipe, _pipe); - int style; - RECT win_rect; - SetRect(&win_rect, _props._xorg, _props._yorg, _props._xorg + _props._xsize, - _props._yorg + _props._ysize); + int style; + RECT win_rect; + SetRect(&win_rect, _props._xorg, _props._yorg, _props._xorg + _props._xsize, + _props._yorg + _props._ysize); // rect now contains the coords for the entire window, not the client - if(dx_full_screen) { - _mwindow = CreateWindow("wdxDisplay", _props._title.c_str(), - WS_POPUP, 0, 0, _props._xsize,_props._ysize, - NULL, NULL, hinstance, 0); - } else { - if(_props._border) - style = WS_OVERLAPPEDWINDOW; - else - style = WS_POPUP | WS_MAXIMIZE; + if(dx_full_screen) { + _mwindow = CreateWindow("wdxDisplay", _props._title.c_str(), + WS_POPUP, 0, 0, _props._xsize,_props._ysize, + NULL, NULL, hinstance, 0); + } else { + if(_props._border) + style = WS_OVERLAPPEDWINDOW; + else + style = WS_POPUP | WS_MAXIMIZE; - AdjustWindowRect(&win_rect, style, FALSE); //compute window size based on desired client area size + AdjustWindowRect(&win_rect, style, FALSE); //compute window size based on desired client area size - // make sure origin is on screen - if(win_rect.left < 0) { - win_rect.right -= win_rect.left; win_rect.left = 0; - } - if(win_rect.top < 0) { - win_rect.bottom -= win_rect.top; win_rect.top = 0; - } + // make sure origin is on screen + if(win_rect.left < 0) { + win_rect.right -= win_rect.left; win_rect.left = 0; + } + if(win_rect.top < 0) { + win_rect.bottom -= win_rect.top; win_rect.top = 0; + } - _mwindow = CreateWindow("wdxDisplay", _props._title.c_str(), - style, win_rect.left, win_rect.top, win_rect.right-win_rect.left, - win_rect.bottom-win_rect.top, - NULL, NULL, hinstance, 0); - } + _mwindow = CreateWindow("wdxDisplay", _props._title.c_str(), + style, win_rect.left, win_rect.top, win_rect.right-win_rect.left, + win_rect.bottom-win_rect.top, + NULL, NULL, hinstance, 0); + } - if(!_mwindow) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - failed to create Mwindow" << endl; - exit(1); - } + if(!_mwindow) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - failed to create Mwindow" << endl; + exit(1); + } - _hParentWindow=GetForegroundWindow(); + _hParentWindow=GetForegroundWindow(); // move window to top of zorder - SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE); + SetWindowPos(_mwindow, HWND_TOP, 0,0,0,0, SWP_NOMOVE | SWP_NOSENDCHANGING | SWP_NOSIZE); - _hdc = GetDC(_mwindow); + _hdc = GetDC(_mwindow); - dx_setup(); + dx_setup(); - _mouse_input_enabled = false; - _mouse_motion_enabled = false; - _mouse_passive_motion_enabled = false; - _mouse_entry_enabled = false; - _entry_state = -1; + _mouse_input_enabled = false; + _mouse_motion_enabled = false; + _mouse_passive_motion_enabled = false; + _mouse_entry_enabled = false; + _entry_state = -1; // Enable detection of mouse input - enable_mouse_input(true); - enable_mouse_motion(true); - enable_mouse_passive_motion(true); + enable_mouse_input(true); + enable_mouse_motion(true); + enable_mouse_passive_motion(true); // Now indicate that we have our keyboard/mouse device ready. - GraphicsWindowInputDevice device = - GraphicsWindowInputDevice::pointer_and_keyboard("keyboard/mouse"); - _input_devices.push_back(device); + GraphicsWindowInputDevice device = + GraphicsWindowInputDevice::pointer_and_keyboard("keyboard/mouse"); + _input_devices.push_back(device); - ShowWindow(_mwindow, SW_SHOWNORMAL); - ShowWindow(_mwindow, SW_SHOWNORMAL); // call twice to override STARTUPINFO value, which may be set to hidden initially by emacs + ShowWindow(_mwindow, SW_SHOWNORMAL); + ShowWindow(_mwindow, SW_SHOWNORMAL); // call twice to override STARTUPINFO value, which may be set to hidden initially by emacs // UpdateWindow( _mwindow ); } HRESULT CALLBACK EnumDevicesCallback(LPSTR pDeviceDescription, LPSTR pDeviceName, - LPD3DDEVICEDESC7 pD3DDeviceDesc,LPVOID pContext) { - D3DDEVICEDESC7 *pd3ddevs = (D3DDEVICEDESC7 *)pContext; + LPD3DDEVICEDESC7 pD3DDeviceDesc,LPVOID pContext) { + D3DDEVICEDESC7 *pd3ddevs = (D3DDEVICEDESC7 *)pContext; #ifdef _DEBUG - wdxdisplay_cat.spam() << "wdxGraphicsWindow: Enumerating Device " << pDeviceName << " : " << pDeviceDescription << endl; + wdxdisplay_cat.spam() << "wdxGraphicsWindow: Enumerating Device " << pDeviceName << " : " << pDeviceDescription << endl; #endif - // only saves hal and tnl devs + // only saves hal and tnl devs - if(IsEqualGUID(pD3DDeviceDesc->deviceGUID,IID_IDirect3DHALDevice)) { - CopyMemory(pd3ddevs,pD3DDeviceDesc,sizeof(D3DDEVICEDESC7)); - } else if(IsEqualGUID(pD3DDeviceDesc->deviceGUID,IID_IDirect3DTnLHalDevice)) { - CopyMemory(&pd3ddevs[1],pD3DDeviceDesc,sizeof(D3DDEVICEDESC7)); - } - return DDENUMRET_OK; + if(IsEqualGUID(pD3DDeviceDesc->deviceGUID,IID_IDirect3DHALDevice)) { + CopyMemory(pd3ddevs,pD3DDeviceDesc,sizeof(D3DDEVICEDESC7)); + } else if(IsEqualGUID(pD3DDeviceDesc->deviceGUID,IID_IDirect3DTnLHalDevice)) { + CopyMemory(&pd3ddevs[1],pD3DDeviceDesc,sizeof(D3DDEVICEDESC7)); + } + return DDENUMRET_OK; } HRESULT WINAPI EnumDisplayModesCallBack(LPDDSURFACEDESC2 lpDDSurfaceDesc,LPVOID lpContext) { - DWORD *pDDBDMask = (DWORD*)lpContext; + DWORD *pDDBDMask = (DWORD*)lpContext; - *pDDBDMask |= BitDepth_2_DDBDMask(lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount); - return DDENUMRET_OK; + *pDDBDMask |= BitDepth_2_DDBDMask(lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount); + return DDENUMRET_OK; } BOOL WINAPI DriverEnumCallback( GUID* pGUID, TCHAR* strDesc,TCHAR* strName, - VOID *argptr, HMONITOR hm) { - if(hm!=NULL) // skip over non-primary display devices - return DDENUMRET_OK; + VOID *argptr, HMONITOR hm) { + if(hm!=NULL) // skip over non-primary display devices + return DDENUMRET_OK; - // primary display driver will have NULL guid - // ignore that and save any non-null value, whic - // indicates a secondary driver, which is usually voodoo1/2 - if(pGUID!=NULL) { - memcpy(argptr,pGUID,sizeof(GUID)); - } + // primary display driver will have NULL guid + // ignore that and save any non-null value, whic + // indicates a secondary driver, which is usually voodoo1/2 + if(pGUID!=NULL) { + memcpy(argptr,pGUID,sizeof(GUID)); + } - return DDENUMRET_OK; + return DDENUMRET_OK; } //////////////////////////////////////////////////////////////////// // Function: dx_setup // Description: Set up the DirectX environment. The size of the -// rendered area will be computed from the Client area -// of the window (if in windowed mode) and the _props -// structure will be set accordingly. +// rendered area will be computed from the Client area +// of the window (if in windowed mode) and the _props +// structure will be set accordingly. //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow:: dx_setup() { - LPDIRECTDRAWSURFACE7 pBackDDSurf; - LPDIRECTDRAWSURFACE7 pZDDSurf; - LPDIRECT3D7 pD3DI; - LPDIRECT3DDEVICE7 pD3DDevice; - LPDIRECTDRAWSURFACE7 pPrimaryDDSurf; - LPDIRECTDRAW7 pDD; - RECT view_rect; - int i; - HRESULT hr; - DX_DECLARE_CLEAN( DDSURFACEDESC2, SurfaceDesc ); + LPDIRECTDRAWSURFACE7 pBackDDSurf; + LPDIRECTDRAWSURFACE7 pZDDSurf; + LPDIRECT3D7 pD3DI; + LPDIRECT3DDEVICE7 pD3DDevice; + LPDIRECTDRAWSURFACE7 pPrimaryDDSurf; + LPDIRECTDRAW7 pDD; + RECT view_rect; + int i; + HRESULT hr; + DX_DECLARE_CLEAN( DDSURFACEDESC2, SurfaceDesc ); - // Check for DirectX 7 by looking for DirectDrawCreateEx + // Check for DirectX 7 by looking for DirectDrawCreateEx - HINSTANCE DDHinst = LoadLibrary( "DDRAW.DLL" ); - if(DDHinst == 0) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - DDRAW.DLL doesn't exist!" << endl; - exit(1); - } + HINSTANCE DDHinst = LoadLibrary( "DDRAW.DLL" ); + if(DDHinst == 0) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - DDRAW.DLL doesn't exist!" << endl; + exit(1); + } - if(NULL == GetProcAddress( DDHinst, "DirectDrawCreateEx" )) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - Panda currently requires at least DirectX 7.0!" << endl; - exit(1); - } + if(NULL == GetProcAddress( DDHinst, "DirectDrawCreateEx" )) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - Panda currently requires at least DirectX 7.0!" << endl; + exit(1); + } - GUID DriverGUID; - ZeroMemory(&DriverGUID,sizeof(GUID)); + GUID DriverGUID; + ZeroMemory(&DriverGUID,sizeof(GUID)); - // search for early voodoo-type non-primary display drivers - // if they exist, use them for 3D (could examine 3D devices on all - // drivers and pick the best one, but I'll assume the computer setuper knows what he's doing) - if(hr = DirectDrawEnumerateEx( DriverEnumCallback, &DriverGUID, DDENUM_NONDISPLAYDEVICES )) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - DirectDrawEnumerateEx failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // search for early voodoo-type non-primary display drivers + // if they exist, use them for 3D (could examine 3D devices on all + // drivers and pick the best one, but I'll assume the computer setuper knows what he's doing) + if(hr = DirectDrawEnumerateEx( DriverEnumCallback, &DriverGUID, DDENUM_NONDISPLAYDEVICES )) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - DirectDrawEnumerateEx failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - GUID *pOurDriverGUID=NULL; - if(DriverGUID.Data1 != 0x0) { // assumes no driver guid ever starts with 0, so 0 means Enum found no voodoo-type device - pOurDriverGUID=&DriverGUID; - } + GUID *pOurDriverGUID=NULL; + if(DriverGUID.Data1 != 0x0) { // assumes no driver guid ever starts with 0, so 0 means Enum found no voodoo-type device + pOurDriverGUID=&DriverGUID; + } - // Create the Direct Draw Object - hr = DirectDrawCreateEx(pOurDriverGUID, (void **)&pDD, IID_IDirectDraw7, NULL); - if(hr != DD_OK) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - DirectDrawCreateEx failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the Direct Draw Object + hr = DirectDrawCreateEx(pOurDriverGUID, (void **)&pDD, IID_IDirectDraw7, NULL); + if(hr != DD_OK) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - DirectDrawCreateEx failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - FreeLibrary(DDHinst); //undo LoadLib above, decrement ddrawl.dll refcnt (after DDrawCreate, since dont want to unload/reload) + FreeLibrary(DDHinst); //undo LoadLib above, decrement ddrawl.dll refcnt (after DDrawCreate, since dont want to unload/reload) - DDDEVICEIDENTIFIER2 dddi; - pDD->GetDeviceIdentifier(&dddi,0x0); + DDDEVICEIDENTIFIER2 dddi; + pDD->GetDeviceIdentifier(&dddi,0x0); #ifdef _DEBUG - wdxdisplay_cat.debug() - << " GfxCard: " << dddi.szDescription << "; VendorID: " <QueryInterface( IID_IDirect3D7, (VOID**)&pD3DI ); - if(hr != DD_OK) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - QI for D3D failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + hr = pDD->QueryInterface( IID_IDirect3D7, (VOID**)&pD3DI ); + if(hr != DD_OK) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - QI for D3D failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // just look for HAL and TnL devices right now. I dont think - // we have any interest in the sw rasts at this point + // just look for HAL and TnL devices right now. I dont think + // we have any interest in the sw rasts at this point - D3DDEVICEDESC7 d3ddevs[2]; // put HAL in 0, TnL in 1 - ZeroMemory(d3ddevs,2*sizeof(D3DDEVICEDESC7)); + D3DDEVICEDESC7 d3ddevs[2]; // put HAL in 0, TnL in 1 + ZeroMemory(d3ddevs,2*sizeof(D3DDEVICEDESC7)); - hr = pD3DI->EnumDevices(EnumDevicesCallback,d3ddevs); - if(hr != DD_OK) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - EnumDevices failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + hr = pD3DI->EnumDevices(EnumDevicesCallback,d3ddevs); + if(hr != DD_OK) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - EnumDevices failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(!(d3ddevs[0].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION )) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: No 3D HW present, exiting..." << endl; - exit(1); - } + if(!(d3ddevs[0].dwDevCaps & D3DDEVCAPS_HWRASTERIZATION )) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: No 3D HW present, exiting..." << endl; + exit(1); + } - DX_DECLARE_CLEAN(DDCAPS,DDCaps); - pDD->GetCaps(&DDCaps,NULL); + DX_DECLARE_CLEAN(DDCAPS,DDCaps); + pDD->GetCaps(&DDCaps,NULL); - DWORD dwRenderWidth,dwRenderHeight; + DWORD dwRenderWidth,dwRenderHeight; - if(dx_full_screen) { - dwRenderWidth = _props._xsize; - dwRenderHeight = _props._ysize; - _props._xorg = _props._yorg = 0; - SetRect(&view_rect, _props._xorg, _props._yorg, _props._xsize, _props._ysize); + if(dx_full_screen) { + dwRenderWidth = _props._xsize; + dwRenderHeight = _props._ysize; + _props._xorg = _props._yorg = 0; + SetRect(&view_rect, _props._xorg, _props._yorg, _props._xsize, _props._ysize); - // CREATE FULL SCREEN BUFFERS - // Store the rectangle which contains the renderer + // CREATE FULL SCREEN BUFFERS + // Store the rectangle which contains the renderer - DWORD dwSupportedBitDepthMask=0x0; // uses DDBD_... - DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_search); - ddsd_search.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; - ddsd_search.dwWidth=dwRenderWidth; ddsd_search.dwHeight=dwRenderHeight; + DWORD dwSupportedBitDepthMask=0x0; // uses DDBD_... + DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_search); + ddsd_search.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; + ddsd_search.dwWidth=dwRenderWidth; ddsd_search.dwHeight=dwRenderHeight; - if(FAILED(hr= pDD->EnumDisplayModes(0x0,&ddsd_search,&dwSupportedBitDepthMask,EnumDisplayModesCallBack))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::EnumDisplayModes failed, result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED(hr= pDD->EnumDisplayModes(0x0,&ddsd_search,&dwSupportedBitDepthMask,EnumDisplayModesCallBack))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::EnumDisplayModes failed, result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - DWORD dwFullScreenBitDepth; + DWORD dwFullScreenBitDepth; - // Now we try to figure out if we can use requested screen resolution and best - // rendertarget bpp and still have at least 2 meg of texture vidmem + // Now we try to figure out if we can use requested screen resolution and best + // rendertarget bpp and still have at least 2 meg of texture vidmem - // Get Current VidMem avail. Note this is only an estimate, when we switch to fullscreen - // mode from desktop, more vidmem will be available (typically 1.2 meg). I dont want - // to switch to fullscreen more than once due to the annoying monitor flicker, so try - // to figure out optimal mode using this estimate - DDSCAPS2 ddsCaps; - DWORD dwTotal,dwFree; - ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); - ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; //set internally by DX anyway, dont think this any different than 0x0 + // Get Current VidMem avail. Note this is only an estimate, when we switch to fullscreen + // mode from desktop, more vidmem will be available (typically 1.2 meg). I dont want + // to switch to fullscreen more than once due to the annoying monitor flicker, so try + // to figure out optimal mode using this estimate + DDSCAPS2 ddsCaps; + DWORD dwTotal,dwFree; + ZeroMemory(&ddsCaps,sizeof(DDSCAPS2)); + ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY; //set internally by DX anyway, dont think this any different than 0x0 - if(FAILED( hr = pDD->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { - wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pDD->GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { + wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } #ifdef _DEBUG - wdxdisplay_cat.debug() << "before FullScreen switch: GetAvailableVidMem returns Total: " << dwTotal/1000000.0 << " Free: " << dwFree/1000000.0 << endl; + wdxdisplay_cat.debug() << "before FullScreen switch: GetAvailableVidMem returns Total: " << dwTotal/1000000.0 << " Free: " << dwFree/1000000.0 << endl; #endif - // note: this chooses 32bpp, which may not be preferred over 16 for memory & speed reasons - if((dwSupportedBitDepthMask & DDBD_32) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_32)) { - dwFullScreenBitDepth=32; // go for 32bpp if its avail - } else if((dwSupportedBitDepthMask & DDBD_24) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_24)) { - dwFullScreenBitDepth=24; // go for 24bpp if its avail - } else if((dwSupportedBitDepthMask & DDBD_16) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_16)) { - dwFullScreenBitDepth=16; // do 16bpp - } else { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - No Supported FullScreen resolutions at " << dwRenderWidth << "x" << dwRenderHeight << endl; - exit(1); - } + // note: this chooses 32bpp, which may not be preferred over 16 for memory & speed reasons + if((dwSupportedBitDepthMask & DDBD_32) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_32)) { + dwFullScreenBitDepth=32; // go for 32bpp if its avail + } else if((dwSupportedBitDepthMask & DDBD_24) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_24)) { + dwFullScreenBitDepth=24; // go for 24bpp if its avail + } else if((dwSupportedBitDepthMask & DDBD_16) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_16)) { + dwFullScreenBitDepth=16; // do 16bpp + } else { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - No Supported FullScreen resolutions at " << dwRenderWidth << "x" << dwRenderHeight << endl; + exit(1); + } - // hack: figuring out exactly what res to use is tricky, instead I will - // just use 640x480 if we have < 3 meg avail + // hack: figuring out exactly what res to use is tricky, instead I will + // just use 640x480 if we have < 3 meg avail #define LOWVIDMEMTHRESHOLD 3500000 - if(dwFree< LOWVIDMEMTHRESHOLD) { - // we're going to need 800x600 or 640x480 at 16 bit to save enough tex vidmem - dwFullScreenBitDepth=16; // do 16bpp - dwRenderWidth=640; - dwRenderHeight=480; - wdxdisplay_cat.debug() << "wdxGraphicsWindow:: "<>3); - int memleft = dwFree-rendertargetmem*2; //*2 to handle backbuf/zbuf + int rendertargetmem=dwRenderWidth*dwRenderHeight*(dwFullScreenBitDepth>>3); + int memleft = dwFree-rendertargetmem*2; //*2 to handle backbuf/zbuf - if(memleft < RESERVEDTEXVIDMEM) { - dwFullScreenBitDepth=16; - wdxdisplay_cat.debug() << "wdxGraphicsWindow:: using 16bpp rendertargets to save tex vidmem\n"; - assert((dwSupportedBitDepthMask & DDBD_16) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_16)); // probably a safe assumption - rendertargetmem=dwRenderWidth*dwRenderHeight*(dwFullScreenBitDepth>>3); - memleft = dwFree-rendertargetmem*2; + if(memleft < RESERVEDTEXVIDMEM) { + dwFullScreenBitDepth=16; + wdxdisplay_cat.debug() << "wdxGraphicsWindow:: using 16bpp rendertargets to save tex vidmem\n"; + assert((dwSupportedBitDepthMask & DDBD_16) && (d3ddevs[0].dwDeviceRenderBitDepth & DDBD_16)); // probably a safe assumption + rendertargetmem=dwRenderWidth*dwRenderHeight*(dwFullScreenBitDepth>>3); + memleft = dwFree-rendertargetmem*2; - // BUGBUG: if we still cant reserve 2 megs of vidmem, need to auto-reduce the scrn res - if(memleft < RESERVEDTEXVIDMEM) - wdxdisplay_cat.debug() << "wdxGraphicsWindow:: XXXXXX WARNING: cant reserve 2MB of tex vidmem. only " << memleft << " bytes available. Need to rewrite wdxdisplay to try lower resolutions XXXXXXXXXXXXXXXXXXXX\n"; - } + // BUGBUG: if we still cant reserve 2 megs of vidmem, need to auto-reduce the scrn res + if(memleft < RESERVEDTEXVIDMEM) + wdxdisplay_cat.debug() << "wdxGraphicsWindow:: XXXXXX WARNING: cant reserve 2MB of tex vidmem. only " << memleft << " bytes available. Need to rewrite wdxdisplay to try lower resolutions XXXXXXXXXXXXXXXXXXXX\n"; + } #endif -// extern bool dx_preserve_fpu_state; - DWORD SCL_FPUFlag = DDSCL_FPUSETUP; +// extern bool dx_preserve_fpu_state; + DWORD SCL_FPUFlag = DDSCL_FPUSETUP; -// if(dx_preserve_fpu_state) -// SCL_FPUFlag = DDSCL_FPUPRESERVE; // tell d3d to preserve the fpu state across calls. this hurts perf, but is good for dbgging +// if(dx_preserve_fpu_state) +// SCL_FPUFlag = DDSCL_FPUPRESERVE; // tell d3d to preserve the fpu state across calls. this hurts perf, but is good for dbgging - DWORD SCL_FLAGS = SCL_FPUFlag | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT; + DWORD SCL_FLAGS = SCL_FPUFlag | DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT; - if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FLAGS))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FLAGS))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // s3 savage2000 on w95 seems to set EXCLUSIVE_MODE only if you call SetCoopLevel twice. - // so we do it, it really shouldnt be necessary if drivers werent buggy - if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FLAGS))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // s3 savage2000 on w95 seems to set EXCLUSIVE_MODE only if you call SetCoopLevel twice. + // so we do it, it really shouldnt be necessary if drivers werent buggy + if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FLAGS))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED(hr = pDD->TestCooperativeLevel())) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - TestCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - Full screen app failed to get exclusive mode on init, exiting..\n"; - exit(1); - } + if(FAILED(hr = pDD->TestCooperativeLevel())) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - TestCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - Full screen app failed to get exclusive mode on init, exiting..\n"; + exit(1); + } - if(FAILED( hr = pDD->SetDisplayMode( dwRenderWidth, dwRenderHeight, - dwFullScreenBitDepth, 0L, 0L ))) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::CreateFullscreenBuffers() - Can't set display mode : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pDD->SetDisplayMode( dwRenderWidth, dwRenderHeight, + dwFullScreenBitDepth, 0L, 0L ))) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::CreateFullscreenBuffers() - Can't set display mode : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } #ifdef _DEBUG - wdxdisplay_cat.debug() << "wdxGraphicsWindow::setting displaymode to " << dwRenderWidth << "x" << dwRenderHeight << " at "<< dwFullScreenBitDepth << "bpp" <GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { - wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - wdxdisplay_cat.debug() << "after FullScreen switch: GetAvailableVidMem returns Total: " << dwTotal/1000000.0 << " Free: " << dwFree/1000000.0 << endl; + wdxdisplay_cat.debug() << "wdxGraphicsWindow::setting displaymode to " << dwRenderWidth << "x" << dwRenderHeight << " at "<< dwFullScreenBitDepth << "bpp" <GetAvailableVidMem(&ddsCaps,&dwTotal,&dwFree))) { + wdxdisplay_cat.debug() << "wdxGraphicsWindow::GetAvailableVidMem failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + wdxdisplay_cat.debug() << "after FullScreen switch: GetAvailableVidMem returns Total: " << dwTotal/1000000.0 << " Free: " << dwFree/1000000.0 << endl; #endif - // Setup to create the primary surface w/backbuffer - DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd) - ddsd.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | - DDSCAPS_FLIP | DDSCAPS_COMPLEX; - ddsd.dwBackBufferCount = 1; + // Setup to create the primary surface w/backbuffer + DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd) + ddsd.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | + DDSCAPS_FLIP | DDSCAPS_COMPLEX; + ddsd.dwBackBufferCount = 1; - PRINTVIDMEM(pDD,&ddsd.ddsCaps,"initial primary & backbuf"); + PRINTVIDMEM(pDD,&ddsd.ddsCaps,"initial primary & backbuf"); - // Create the primary surface - if(FAILED( hr = pDD->CreateSurface( &ddsd, &pPrimaryDDSurf, NULL ) )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::CreateFullscreenBuffers() - CreateSurface failed for primary surface: result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the primary surface + if(FAILED( hr = pDD->CreateSurface( &ddsd, &pPrimaryDDSurf, NULL ) )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::CreateFullscreenBuffers() - CreateSurface failed for primary surface: result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Clear the primary surface to black + // Clear the primary surface to black - DX_DECLARE_CLEAN(DDBLTFX, bltfx) - bltfx.dwDDFX |= DDBLTFX_NOTEARING; - hr = pPrimaryDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx); + DX_DECLARE_CLEAN(DDBLTFX, bltfx) + bltfx.dwDDFX |= DDBLTFX_NOTEARING; + hr = pPrimaryDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx); - if(FAILED( hr )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: Blt to Black of Primary Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: Blt to Black of Primary Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Get the backbuffer, which was created along with the primary. - DDSCAPS2 ddscaps = { DDSCAPS_BACKBUFFER, 0, 0, 0}; - if(FAILED( hr = pPrimaryDDSurf->GetAttachedSurface( &ddscaps, &pBackDDSurf ) )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::CreateFullscreenBuffers() - Can't get the backbuffer: result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Get the backbuffer, which was created along with the primary. + DDSCAPS2 ddscaps = { DDSCAPS_BACKBUFFER, 0, 0, 0}; + if(FAILED( hr = pPrimaryDDSurf->GetAttachedSurface( &ddscaps, &pBackDDSurf ) )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::CreateFullscreenBuffers() - Can't get the backbuffer: result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED( hr = pBackDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: Blt to Black of Back Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - } // end create full screen buffers + if(FAILED( hr = pBackDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: Blt to Black of Back Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + } // end create full screen buffers - else { // CREATE WINDOWED BUFFERS + else { // CREATE WINDOWED BUFFERS - if(!(DDCaps.dwCaps2 & DDCAPS2_CANRENDERWINDOWED)) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: 3D HW cannot render windowed, exiting..." << endl; - exit(1); - } + if(!(DDCaps.dwCaps2 & DDCAPS2_CANRENDERWINDOWED)) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: 3D HW cannot render windowed, exiting..." << endl; + exit(1); + } - if(FAILED(hr = pDD->GetDisplayMode( &SurfaceDesc ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::GetDisplayMode failed result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - if(SurfaceDesc.ddpfPixelFormat.dwRGBBitCount <= 8) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - Can't run windowed in an 8-bit or less display mode" << endl; - exit(1); - } + if(FAILED(hr = pDD->GetDisplayMode( &SurfaceDesc ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::GetDisplayMode failed result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + if(SurfaceDesc.ddpfPixelFormat.dwRGBBitCount <= 8) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - Can't run windowed in an 8-bit or less display mode" << endl; + exit(1); + } - if(!(BitDepth_2_DDBDMask(SurfaceDesc.ddpfPixelFormat.dwRGBBitCount) & d3ddevs[0].dwDeviceRenderBitDepth)) { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: - 3D Device doesnt support rendering at " << SurfaceDesc.ddpfPixelFormat.dwRGBBitCount << "bpp (current desktop bitdepth)" << endl; - exit(1); - } + if(!(BitDepth_2_DDBDMask(SurfaceDesc.ddpfPixelFormat.dwRGBBitCount) & d3ddevs[0].dwDeviceRenderBitDepth)) { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow:: - 3D Device doesnt support rendering at " << SurfaceDesc.ddpfPixelFormat.dwRGBBitCount << "bpp (current desktop bitdepth)" << endl; + exit(1); + } -// extern bool dx_preserve_fpu_state; - DWORD SCL_FPUFlag = DDSCL_FPUSETUP; +// extern bool dx_preserve_fpu_state; + DWORD SCL_FPUFlag = DDSCL_FPUSETUP; -// if(dx_preserve_fpu_state) -// SCL_FPUFlag = DDSCL_FPUPRESERVE; // tell d3d to preserve the fpu state across calls. this hurts perf, but is good for dbgging +// if(dx_preserve_fpu_state) +// SCL_FPUFlag = DDSCL_FPUPRESERVE; // tell d3d to preserve the fpu state across calls. this hurts perf, but is good for dbgging - if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FPUFlag | DDSCL_NORMAL))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } - // Get the dimensions of the viewport and screen bounds + if(FAILED(hr = pDD->SetCooperativeLevel(_mwindow, SCL_FPUFlag | DDSCL_NORMAL))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - SetCooperativeLevel failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } + // Get the dimensions of the viewport and screen bounds - GetClientRect( _mwindow, &view_rect ); - POINT ul,lr; - ul.x=view_rect.left; ul.y=view_rect.top; - lr.x=view_rect.right; lr.y=view_rect.bottom; - ClientToScreen( _mwindow, &ul ); - ClientToScreen( _mwindow, &lr ); - view_rect.left=ul.x; view_rect.top=ul.y; - view_rect.right=lr.x; view_rect.bottom=lr.y; + GetClientRect( _mwindow, &view_rect ); + POINT ul,lr; + ul.x=view_rect.left; ul.y=view_rect.top; + lr.x=view_rect.right; lr.y=view_rect.bottom; + ClientToScreen( _mwindow, &ul ); + ClientToScreen( _mwindow, &lr ); + view_rect.left=ul.x; view_rect.top=ul.y; + view_rect.right=lr.x; view_rect.bottom=lr.y; - dwRenderWidth = view_rect.right - view_rect.left; - dwRenderHeight = view_rect.bottom - view_rect.top; - _props._xorg = view_rect.left; // _props should reflect view rectangle - _props._yorg = view_rect.top; - _props._xsize = dwRenderWidth; - _props._ysize = dwRenderHeight; + dwRenderWidth = view_rect.right - view_rect.left; + dwRenderHeight = view_rect.bottom - view_rect.top; + _props._xorg = view_rect.left; // _props should reflect view rectangle + _props._yorg = view_rect.top; + _props._xsize = dwRenderWidth; + _props._ysize = dwRenderHeight; - // Initialize the description of the primary surface - ZeroMemory( &SurfaceDesc, sizeof(DDSURFACEDESC2) ); - SurfaceDesc.dwSize = sizeof(DDSURFACEDESC2); - SurfaceDesc.dwFlags = DDSD_CAPS ; - SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + // Initialize the description of the primary surface + ZeroMemory( &SurfaceDesc, sizeof(DDSURFACEDESC2) ); + SurfaceDesc.dwSize = sizeof(DDSURFACEDESC2); + SurfaceDesc.dwFlags = DDSD_CAPS ; + SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - PRINTVIDMEM(pDD,&SurfaceDesc.ddsCaps,"initial primary surface"); + PRINTVIDMEM(pDD,&SurfaceDesc.ddsCaps,"initial primary surface"); - // Create the primary surface. This includes all of the visible - // window, so no need to specify height/width - if(FAILED(hr = pDD->CreateSurface( &SurfaceDesc, &pPrimaryDDSurf, NULL ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: CreateSurface failed for primary surface: result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the primary surface. This includes all of the visible + // window, so no need to specify height/width + if(FAILED(hr = pDD->CreateSurface( &SurfaceDesc, &pPrimaryDDSurf, NULL ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: CreateSurface failed for primary surface: result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Create a clipper object which handles all our clipping for cases when - // our window is partially obscured by other windows. - LPDIRECTDRAWCLIPPER Clipper; - if(FAILED(hr = pDD->CreateClipper( 0, &Clipper, NULL ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: CreateClipper failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create a clipper object which handles all our clipping for cases when + // our window is partially obscured by other windows. + LPDIRECTDRAWCLIPPER Clipper; + if(FAILED(hr = pDD->CreateClipper( 0, &Clipper, NULL ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: CreateClipper failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Associate the clipper with our window. Note that, afterwards, the - // clipper is internally referenced by the primary surface, so it is safe - // to release our local reference to it. - Clipper->SetHWnd( 0, _mwindow ); - pPrimaryDDSurf->SetClipper( Clipper ); - Clipper->Release(); + // Associate the clipper with our window. Note that, afterwards, the + // clipper is internally referenced by the primary surface, so it is safe + // to release our local reference to it. + Clipper->SetHWnd( 0, _mwindow ); + pPrimaryDDSurf->SetClipper( Clipper ); + Clipper->Release(); - // Clear the primary surface to black - DX_DECLARE_CLEAN(DDBLTFX, bltfx) + // Clear the primary surface to black + DX_DECLARE_CLEAN(DDBLTFX, bltfx) - if(FAILED( hr = pPrimaryDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: Blt to Black of Primary Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pPrimaryDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: Blt to Black of Primary Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Setup a surface description to create a backbuffer. - SurfaceDesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; - SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY; - SurfaceDesc.dwWidth = dwRenderWidth; - SurfaceDesc.dwHeight = dwRenderHeight; + // Setup a surface description to create a backbuffer. + SurfaceDesc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; + SurfaceDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY; + SurfaceDesc.dwWidth = dwRenderWidth; + SurfaceDesc.dwHeight = dwRenderHeight; - PRINTVIDMEM(pDD,&SurfaceDesc.ddsCaps,"initial backbuf"); + PRINTVIDMEM(pDD,&SurfaceDesc.ddsCaps,"initial backbuf"); - // Create the backbuffer. (might want to handle failure due to running out of video memory. - if(FAILED(hr = pDD->CreateSurface( &SurfaceDesc, &pBackDDSurf, NULL ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: CreateSurface failed for backbuffer : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the backbuffer. (might want to handle failure due to running out of video memory. + if(FAILED(hr = pDD->CreateSurface( &SurfaceDesc, &pBackDDSurf, NULL ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: CreateSurface failed for backbuffer : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED( hr = pBackDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow:: Blt to Black of Back Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pBackDDSurf->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&bltfx))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow:: Blt to Black of Back Surf failed! : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - } // end create windowed buffers + } // end create windowed buffers -// ======================================================== +// ======================================================== - resized(dwRenderWidth,dwRenderHeight); // update panda channel/display rgn info + resized(dwRenderWidth,dwRenderHeight); // update panda channel/display rgn info - // Check if the device supports z-bufferless hidden surface removal. If so, - // we don't really need a z-buffer - if(!(d3ddevs[0].dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ZBUFFERLESSHSR )) { + // Check if the device supports z-bufferless hidden surface removal. If so, + // we don't really need a z-buffer + if(!(d3ddevs[0].dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ZBUFFERLESSHSR )) { - // Get z-buffer dimensions from the render target - DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd); - pBackDDSurf->GetSurfaceDesc( &ddsd ); + // Get z-buffer dimensions from the render target + DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd); + pBackDDSurf->GetSurfaceDesc( &ddsd ); - // Setup the surface desc for the z-buffer. - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY; + // Setup the surface desc for the z-buffer. + ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY; - DDPIXELFORMAT ZBufPixFmts[MAX_DX_ZBUF_FMTS]; + DDPIXELFORMAT ZBufPixFmts[MAX_DX_ZBUF_FMTS]; - // Get an appropiate pixel format from enumeration of the formats. On the - // first pass, we look for a zbuffer dpeth which is equal to the frame - // buffer depth (as some cards unfornately require this). - if(FAILED(pD3DI->EnumZBufferFormats( IID_IDirect3DHALDevice, EnumZBufFmtsCallback, - (VOID*)&ZBufPixFmts ))) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - EnumZBufferFormats failed " << endl; - exit(1); - } + // Get an appropiate pixel format from enumeration of the formats. On the + // first pass, we look for a zbuffer dpeth which is equal to the frame + // buffer depth (as some cards unfornately require this). + if(FAILED(pD3DI->EnumZBufferFormats( IID_IDirect3DHALDevice, EnumZBufFmtsCallback, + (VOID*)&ZBufPixFmts ))) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - EnumZBufferFormats failed " << endl; + exit(1); + } #ifdef _DEBUG - { static BOOL bPrinted=FALSE; - if(!bPrinted) { - for(i=0;idwRGBBitCount) { - case 16: - if(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)) - pz16=pCurPixFmt; - break; - case 24: - assert(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)); // shouldnt be stencil at 24bpp - pz24=pCurPixFmt; - break; - case 32: - if(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)) - pz32=pCurPixFmt; - break; - } - } + LPDDPIXELFORMAT pCurPixFmt,pz16=NULL,pz24=NULL,pz32=NULL; + for(i=0,pCurPixFmt=ZBufPixFmts;idwRGBBitCount) { + case 16: + if(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)) + pz16=pCurPixFmt; + break; + case 24: + assert(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)); // shouldnt be stencil at 24bpp + pz24=pCurPixFmt; + break; + case 32: + if(!(pCurPixFmt->dwFlags & DDPF_STENCILBUFFER)) + pz32=pCurPixFmt; + break; + } + } - if(bIsNvidia) { - DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_pri) - pPrimaryDDSurf->GetSurfaceDesc(&ddsd_pri); + if(bIsNvidia) { + DX_DECLARE_CLEAN(DDSURFACEDESC2,ddsd_pri) + pPrimaryDDSurf->GetSurfaceDesc(&ddsd_pri); - // must pick zbuf depth to match primary surface depth for nvidia - if(ddsd_pri.ddpfPixelFormat.dwRGBBitCount==16) { - assert(pz16!=NULL); - ddsd.ddpfPixelFormat = *pz16; - } else { - assert(pz24!=NULL); - ddsd.ddpfPixelFormat = *pz24; //take the no-stencil version of the 32-bit Zbuf - } - } else { - // pick the largest non-stencil zbuffer format avail (wont support stenciling - // until we definitely need it). Note: this is choosing to waste memory - // and possibly perf for more accuracy at long distance (std 16bpp would be smaller/ - // maybe faster) + // must pick zbuf depth to match primary surface depth for nvidia + if(ddsd_pri.ddpfPixelFormat.dwRGBBitCount==16) { + assert(pz16!=NULL); + ddsd.ddpfPixelFormat = *pz16; + } else { + assert(pz24!=NULL); + ddsd.ddpfPixelFormat = *pz24; //take the no-stencil version of the 32-bit Zbuf + } + } else { + // pick the largest non-stencil zbuffer format avail (wont support stenciling + // until we definitely need it). Note: this is choosing to waste memory + // and possibly perf for more accuracy at long distance (std 16bpp would be smaller/ + // maybe faster) - if(pz32!=NULL) { - ddsd.ddpfPixelFormat = *pz32; - } else if(pz24!=NULL) { - ddsd.ddpfPixelFormat = *pz24; - } else if(pz16!=NULL) { - ddsd.ddpfPixelFormat = *pz16; - } else { - wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - could find a valid zbuffer format!\n"; - exit(1); - } - } + if(pz32!=NULL) { + ddsd.ddpfPixelFormat = *pz32; + } else if(pz24!=NULL) { + ddsd.ddpfPixelFormat = *pz24; + } else if(pz16!=NULL) { + ddsd.ddpfPixelFormat = *pz16; + } else { + wdxdisplay_cat.fatal() << "wdxGraphicsWindow::config() - could find a valid zbuffer format!\n"; + exit(1); + } + } - PRINTVIDMEM(pDD,&ddsd.ddsCaps,"initial zbuf"); + PRINTVIDMEM(pDD,&ddsd.ddsCaps,"initial zbuf"); - // Create and attach a z-buffer - if(FAILED( hr = pDD->CreateSurface( &ddsd, &pZDDSurf, NULL ) )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - CreateSurface failed for Z buffer: result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create and attach a z-buffer + if(FAILED( hr = pDD->CreateSurface( &ddsd, &pZDDSurf, NULL ) )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - CreateSurface failed for Z buffer: result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - if(FAILED( hr = pBackDDSurf->AddAttachedSurface( pZDDSurf ) )) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - AddAttachedSurface failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + if(FAILED( hr = pBackDDSurf->AddAttachedSurface( pZDDSurf ) )) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - AddAttachedSurface failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } #ifdef _DEBUG - wdxdisplay_cat.debug() << "Creating " << ddsd.ddpfPixelFormat.dwRGBBitCount << "bpp zbuffer\n"; + wdxdisplay_cat.debug() << "Creating " << ddsd.ddpfPixelFormat.dwRGBBitCount << "bpp zbuffer\n"; #endif - } + } - // Create the device. The device is created off of our back buffer, which - // becomes the render target for the newly created device. - hr = pD3DI->CreateDevice( IID_IDirect3DHALDevice, pBackDDSurf, &pD3DDevice ); - if(hr != DD_OK) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - CreateDevice failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the device. The device is created off of our back buffer, which + // becomes the render target for the newly created device. + hr = pD3DI->CreateDevice( IID_IDirect3DHALDevice, pBackDDSurf, &pD3DDevice ); + if(hr != DD_OK) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - CreateDevice failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - // Create the viewport - D3DVIEWPORT7 vp = { 0, 0, _props._xsize, _props._ysize, 0.0f, 1.0f}; - hr = pD3DDevice->SetViewport( &vp ); - if(hr != DD_OK) { - wdxdisplay_cat.fatal() - << "wdxGraphicsWindow::config() - SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl; - exit(1); - } + // Create the viewport + D3DVIEWPORT7 vp = { 0, 0, _props._xsize, _props._ysize, 0.0f, 1.0f}; + hr = pD3DDevice->SetViewport( &vp ); + if(hr != DD_OK) { + wdxdisplay_cat.fatal() + << "wdxGraphicsWindow::config() - SetViewport failed : result = " << ConvD3DErrorToString(hr) << endl; + exit(1); + } - _dxgsg->Set_HDC(_hdc); - _dxgsg->init_dx(pDD, pPrimaryDDSurf, pBackDDSurf, pZDDSurf, pD3DI, pD3DDevice, view_rect); + _dxgsg->Set_HDC(_hdc); + _dxgsg->init_dx(pDD, pPrimaryDDSurf, pBackDDSurf, pZDDSurf, pD3DI, pD3DDevice, view_rect); - _dxgsg->SetDXReady(true); + _dxgsg->SetDXReady(true); } //////////////////////////////////////////////////////////////////// @@ -1248,59 +1248,59 @@ dx_setup() { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::setup_colormap(void) { - wdxGraphicsPipe* pipe = DCAST(wdxGraphicsPipe, _pipe); + wdxGraphicsPipe* pipe = DCAST(wdxGraphicsPipe, _pipe); - PIXELFORMATDESCRIPTOR pfd; - LOGPALETTE *logical; - int n; + PIXELFORMATDESCRIPTOR pfd; + LOGPALETTE *logical; + int n; /* grab the pixel format */ - memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - DescribePixelFormat(_hdc, GetPixelFormat(_hdc), - sizeof(PIXELFORMATDESCRIPTOR), &pfd); + memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); + DescribePixelFormat(_hdc, GetPixelFormat(_hdc), + sizeof(PIXELFORMATDESCRIPTOR), &pfd); - if(!(pfd.dwFlags & PFD_NEED_PALETTE || - pfd.iPixelType == PFD_TYPE_COLORINDEX)) - return; + if(!(pfd.dwFlags & PFD_NEED_PALETTE || + pfd.iPixelType == PFD_TYPE_COLORINDEX)) + return; - n = 1 << pfd.cColorBits; + n = 1 << pfd.cColorBits; /* allocate a bunch of memory for the logical palette (assume 256 - colors in a Win32 palette */ - logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + - sizeof(PALETTEENTRY) * n); - memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); + colors in a Win32 palette */ + logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) + + sizeof(PALETTEENTRY) * n); + memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n); /* set the entries in the logical palette */ - logical->palVersion = 0x300; - logical->palNumEntries = n; + logical->palVersion = 0x300; + logical->palNumEntries = n; /* start with a copy of the current system palette */ - GetSystemPaletteEntries(_hdc, 0, 256, &logical->palPalEntry[0]); + GetSystemPaletteEntries(_hdc, 0, 256, &logical->palPalEntry[0]); - if(pfd.iPixelType == PFD_TYPE_RGBA) { - int redMask = (1 << pfd.cRedBits) - 1; - int greenMask = (1 << pfd.cGreenBits) - 1; - int blueMask = (1 << pfd.cBlueBits) - 1; - int i; + if(pfd.iPixelType == PFD_TYPE_RGBA) { + int redMask = (1 << pfd.cRedBits) - 1; + int greenMask = (1 << pfd.cGreenBits) - 1; + int blueMask = (1 << pfd.cBlueBits) - 1; + int i; - /* fill in an RGBA color palette */ - for(i = 0; i < n; ++i) { - logical->palPalEntry[i].peRed = - (((i >> pfd.cRedShift) & redMask) * 255) / redMask; - logical->palPalEntry[i].peGreen = - (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; - logical->palPalEntry[i].peBlue = - (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; - logical->palPalEntry[i].peFlags = 0; - } - } + /* fill in an RGBA color palette */ + for(i = 0; i < n; ++i) { + logical->palPalEntry[i].peRed = + (((i >> pfd.cRedShift) & redMask) * 255) / redMask; + logical->palPalEntry[i].peGreen = + (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; + logical->palPalEntry[i].peBlue = + (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; + logical->palPalEntry[i].peFlags = 0; + } + } - _colormap = CreatePalette(logical); - free(logical); + _colormap = CreatePalette(logical); + free(logical); - SelectPalette(_hdc, _colormap, FALSE); - RealizePalette(_hdc); + SelectPalette(_hdc, _colormap, FALSE); + RealizePalette(_hdc); } @@ -1309,12 +1309,12 @@ void wdxGraphicsWindow::setup_colormap(void) { // Access: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::begin_frame(void) { - GraphicsWindow::begin_frame(); + GraphicsWindow::begin_frame(); } void wdxGraphicsWindow::show_frame(void) { -// DXGraphicsStateGuardian* dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); - _dxgsg->show_frame(); +// DXGraphicsStateGuardian* dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); + _dxgsg->show_frame(); } @@ -1325,7 +1325,7 @@ void wdxGraphicsWindow::show_frame(void) { // Description: timer info, incs frame # //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::end_frame(void) { - GraphicsWindow::end_frame(); + GraphicsWindow::end_frame(); } @@ -1336,10 +1336,10 @@ void wdxGraphicsWindow::end_frame(void) { // Description: we receive the new x and y position of the client //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::handle_window_move(int x, int y) { -// DXGraphicsStateGuardian* dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); - _dxgsg->adjust_view_rect(x,y); - _props._xorg = x; - _props._yorg = y; +// DXGraphicsStateGuardian* dxgsg = DCAST(DXGraphicsStateGuardian, _gsg); + _dxgsg->adjust_view_rect(x,y); + _props._xorg = x; + _props._yorg = y; } //////////////////////////////////////////////////////////////////// @@ -1348,7 +1348,7 @@ void wdxGraphicsWindow::handle_window_move(int x, int y) { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::handle_mouse_motion(int x, int y) { - _input_devices[0].set_pointer_in_window(x, y); + _input_devices[0].set_pointer_in_window(x, y); } //////////////////////////////////////////////////////////////////// @@ -1357,11 +1357,11 @@ void wdxGraphicsWindow::handle_mouse_motion(int x, int y) { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::handle_mouse_entry(int state,HCURSOR hCrossIcon) { - if(state == MOUSE_EXITED) { - _input_devices[0].set_pointer_out_of_window(); - } else { - SetCursor(hCrossIcon); - } + if(state == MOUSE_EXITED) { + _input_devices[0].set_pointer_out_of_window(); + } else { + SetCursor(hCrossIcon); + } } //////////////////////////////////////////////////////////////////// @@ -1371,10 +1371,10 @@ void wdxGraphicsWindow::handle_mouse_entry(int state,HCURSOR hCrossIcon) { //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow:: handle_keypress(ButtonHandle key, int x, int y) { - _input_devices[0].set_pointer_in_window(x, y); - if(key != ButtonHandle::none()) { - _input_devices[0].button_down(key); - } + _input_devices[0].set_pointer_in_window(x, y); + if(key != ButtonHandle::none()) { + _input_devices[0].button_down(key); + } } //////////////////////////////////////////////////////////////////// @@ -1384,9 +1384,9 @@ handle_keypress(ButtonHandle key, int x, int y) { //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow:: handle_keyrelease(ButtonHandle key, int, int) { - if(key != ButtonHandle::none()) { - _input_devices[0].button_up(key); - } + if(key != ButtonHandle::none()) { + _input_devices[0].button_up(key); + } } #if 0 @@ -1398,24 +1398,24 @@ handle_keyrelease(ButtonHandle key, int, int) { void wdxGraphicsWindow::handle_changes(void) { // As an optimization, check to see if change is anything other than a // redisplay - if(_change_mask & WDXWIN_CONFIGURE) { - RECT changes; - POINT point; - GetClientRect(_mwindow, &changes); - point.x = 0; - point.y = 0; - ClientToScreen(_mwindow, &point); - changes.left = point.x; - changes.top = point.y; - // Don't do this in full-screen mode - AdjustWindowRect(&changes, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | - WS_CLIPCHILDREN, FALSE); - SetWindowPos(_mwindow, HWND_TOP, changes.left, changes.top, - changes.right - changes.left, changes.bottom - changes.top, - SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | - SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER); - } - _change_mask = 0; + if(_change_mask & WDXWIN_CONFIGURE) { + RECT changes; + POINT point; + GetClientRect(_mwindow, &changes); + point.x = 0; + point.y = 0; + ClientToScreen(_mwindow, &point); + changes.left = point.x; + changes.top = point.y; + // Don't do this in full-screen mode + AdjustWindowRect(&changes, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | + WS_CLIPCHILDREN, FALSE); + SetWindowPos(_mwindow, HWND_TOP, changes.left, changes.top, + changes.right - changes.left, changes.bottom - changes.top, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | + SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_NOZORDER); + } + _change_mask = 0; } #endif @@ -1428,7 +1428,7 @@ void wdxGraphicsWindow::handle_changes(void) { void wdxGraphicsWindow::idle_wait(void) { MSG msg; if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - process_events(); + process_events(); call_idle_callback(); } @@ -1446,7 +1446,7 @@ void wdxGraphicsWindow::idle_wait(void) { //////////////////////////////////////////////////////////////////// bool wdxGraphicsWindow:: supports_update() const { - return true; + return true; } #if 0 @@ -1475,16 +1475,16 @@ void INLINE wdxGraphicsWindow::process_events(void) { MSG msg; while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if(!GetMessage(&msg, NULL, 0, 0)) { - // WM_QUIT received - AtExitFn(); - exit(0); - } + if(!GetMessage(&msg, NULL, 0, 0)) { + // WM_QUIT received + AtExitFn(); + exit(0); + } // Translate virtual key messages - TranslateMessage(&msg); + TranslateMessage(&msg); // Call window_proc - DispatchMessage(&msg); + DispatchMessage(&msg); } } @@ -1495,32 +1495,32 @@ void INLINE wdxGraphicsWindow::process_events(void) { //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::update(void) { #ifdef DO_PSTATS - _show_code_pcollector.stop(); - PStatClient::main_tick(); + _show_code_pcollector.stop(); + PStatClient::main_tick(); #endif // Always ask for a redisplay for now #if 0 - if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - process_events(); - else call_draw_callback(true); + if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) + process_events(); + else call_draw_callback(true); #else - process_events(); + process_events(); - call_draw_callback(true); + call_draw_callback(true); #endif - call_idle_callback(); + call_idle_callback(); /* if (_idle_callback) - idle_wait(); + idle_wait(); else if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - process_events(); + process_events(); */ #ifdef DO_PSTATS - _show_code_pcollector.start(); + _show_code_pcollector.start(); #endif } @@ -1530,7 +1530,7 @@ void wdxGraphicsWindow::update(void) { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::enable_mouse_input(bool val) { - _mouse_input_enabled = val; + _mouse_input_enabled = val; } //////////////////////////////////////////////////////////////////// @@ -1539,7 +1539,7 @@ void wdxGraphicsWindow::enable_mouse_input(bool val) { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::enable_mouse_motion(bool val) { - _mouse_motion_enabled = val; + _mouse_motion_enabled = val; } //////////////////////////////////////////////////////////////////// @@ -1548,7 +1548,7 @@ void wdxGraphicsWindow::enable_mouse_motion(bool val) { // Description: //////////////////////////////////////////////////////////////////// void wdxGraphicsWindow::enable_mouse_passive_motion(bool val) { - _mouse_passive_motion_enabled = val; + _mouse_passive_motion_enabled = val; } @@ -1560,40 +1560,40 @@ void wdxGraphicsWindow::enable_mouse_passive_motion(bool val) { //////////////////////////////////////////////////////////////////// TypeHandle wdxGraphicsWindow:: get_gsg_type() const { - return DXGraphicsStateGuardian::get_class_type(); + return DXGraphicsStateGuardian::get_class_type(); } GraphicsWindow *wdxGraphicsWindow:: make_wdxGraphicsWindow(const FactoryParams ¶ms) { - GraphicsWindow::WindowPipe *pipe_param; - if(!get_param_into(pipe_param, params)) { - wdxdisplay_cat.error() - << "No pipe specified for window creation!" << endl; - return NULL; - } + GraphicsWindow::WindowPipe *pipe_param; + if(!get_param_into(pipe_param, params)) { + wdxdisplay_cat.error() + << "No pipe specified for window creation!" << endl; + return NULL; + } - GraphicsPipe *pipe = pipe_param->get_pipe(); + GraphicsPipe *pipe = pipe_param->get_pipe(); - GraphicsWindow::WindowProps *props_param; - if(!get_param_into(props_param, params)) { - return new wdxGraphicsWindow(pipe); - } else { - return new wdxGraphicsWindow(pipe, props_param->get_properties()); - } + GraphicsWindow::WindowProps *props_param; + if(!get_param_into(props_param, params)) { + return new wdxGraphicsWindow(pipe); + } else { + return new wdxGraphicsWindow(pipe, props_param->get_properties()); + } } TypeHandle wdxGraphicsWindow::get_class_type(void) { - return _type_handle; + return _type_handle; } void wdxGraphicsWindow::init_type(void) { - GraphicsWindow::init_type(); - register_type(_type_handle, "wdxGraphicsWindow", - GraphicsWindow::get_class_type()); + GraphicsWindow::init_type(); + register_type(_type_handle, "wdxGraphicsWindow", + GraphicsWindow::get_class_type()); } TypeHandle wdxGraphicsWindow::get_type(void) const { - return get_class_type(); + return get_class_type(); } diff --git a/panda/src/wdxdisplay/wdxGraphicsWindow.h b/panda/src/wdxdisplay/wdxGraphicsWindow.h index 6a8693d818..d0340b17bd 100644 --- a/panda/src/wdxdisplay/wdxGraphicsWindow.h +++ b/panda/src/wdxdisplay/wdxGraphicsWindow.h @@ -24,8 +24,8 @@ //////////////////////////////////////////////////////////////////// class wdxGraphicsPipe; -const int WDXWIN_CONFIGURE = 4; -const int WDXWIN_EVENT = 8; +const int WDXWIN_CONFIGURE = 4; +const int WDXWIN_EVENT = 8; //////////////////////////////////////////////////////////////////// // Class : wdxGraphicsWindow @@ -38,7 +38,7 @@ friend class DXGraphicsStateGuardian; public: wdxGraphicsWindow(GraphicsPipe* pipe); wdxGraphicsWindow(GraphicsPipe* pipe, - const GraphicsWindow::Properties& props); + const GraphicsWindow::Properties& props); virtual ~wdxGraphicsWindow(void); virtual bool supports_update() const; @@ -49,7 +49,7 @@ public: static GraphicsWindow* make_wdxGraphicsWindow(const FactoryParams ¶ms); static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, - LPARAM lparam); + LPARAM lparam); LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); void process_events(void); @@ -79,22 +79,22 @@ protected: void enable_mouse_entry(bool val); public: - HWND _mwindow; + HWND _mwindow; HWND _hParentWindow; private: - HDC _hdc; - HPALETTE _colormap; + HDC _hdc; + HPALETTE _colormap; typedef enum { NotAdjusting,MovingOrResizing,Resizing } WindowAdjustType; WindowAdjustType _WindowAdjustingType; HCURSOR _hMouseCrossIcon; bool _bSizeIsMaximized; - bool _mouse_input_enabled; - bool _mouse_motion_enabled; - bool _mouse_passive_motion_enabled; - bool _mouse_entry_enabled; - int _entry_state; - bool _ignore_key_repeat; + bool _mouse_input_enabled; + bool _mouse_motion_enabled; + bool _mouse_passive_motion_enabled; + bool _mouse_entry_enabled; + int _entry_state; + bool _ignore_key_repeat; public: static TypeHandle get_class_type(void); diff --git a/panda/src/wgldisplay/config_wgldisplay.cxx b/panda/src/wgldisplay/config_wgldisplay.cxx index 0dbce436c5..a4baffeced 100644 --- a/panda/src/wgldisplay/config_wgldisplay.cxx +++ b/panda/src/wgldisplay/config_wgldisplay.cxx @@ -37,12 +37,12 @@ init_libwgldisplay() { wglGraphicsPipe::init_type(); GraphicsPipe::get_factory().register_factory( - wglGraphicsPipe::get_class_type(), - wglGraphicsPipe::make_wglGraphicsPipe); + wglGraphicsPipe::get_class_type(), + wglGraphicsPipe::make_wglGraphicsPipe); wglGraphicsWindow::init_type(); GraphicsWindow::get_factory().register_factory( - wglGraphicsWindow::get_class_type(), - wglGraphicsWindow::make_wglGraphicsWindow); + wglGraphicsWindow::get_class_type(), + wglGraphicsWindow::make_wglGraphicsWindow); } // cant use global var cleanly because global var static init executed after init_libwgl(), incorrectly reiniting var diff --git a/panda/src/wgldisplay/wglGraphicsPipe.cxx b/panda/src/wgldisplay/wglGraphicsPipe.cxx index d9b00d40fd..fcac93db87 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.cxx +++ b/panda/src/wgldisplay/wglGraphicsPipe.cxx @@ -30,28 +30,28 @@ wglGraphicsPipe::wglGraphicsPipe(const PipeSpecifier& spec) // Clear before filling in window structure! memset(&wc, 0, sizeof(WNDCLASS)); - wc.style = CS_OWNDC; - wc.lpfnWndProc = (WNDPROC)static_window_proc; - wc.hInstance = hinstance; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = NULL; - wc.lpszMenuName = NULL; - wc.lpszClassName = "wglStandard"; + wc.style = CS_OWNDC; + wc.lpfnWndProc = (WNDPROC)static_window_proc; + wc.hInstance = hinstance; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = NULL; + wc.lpszMenuName = NULL; + wc.lpszClassName = "wglStandard"; string windows_icon_filename = get_icon_filename_().to_os_specific(); if(!windows_icon_filename.empty()) { // Note: LoadImage seems to cause win2k internal heap corruption (outputdbgstr warnings) - // if icon is more than 8bpp - wc.hIcon = (HICON) LoadImage(NULL, windows_icon_filename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); + // if icon is more than 8bpp + wc.hIcon = (HICON) LoadImage(NULL, windows_icon_filename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); } else { - wc.hIcon = NULL; // use default app icon + wc.hIcon = NULL; // use default app icon } if (!RegisterClass(&wc)) { wgldisplay_cat.fatal() << "wglGraphicsPipe::construct(): could not register standard window " - << "class" << endl; + << "class" << endl; exit(0); } @@ -101,7 +101,7 @@ TypeHandle wglGraphicsPipe::get_class_type(void) { void wglGraphicsPipe::init_type(void) { InteractiveGraphicsPipe::init_type(); register_type(_type_handle, "wglGraphicsPipe", - InteractiveGraphicsPipe::get_class_type()); + InteractiveGraphicsPipe::get_class_type()); } TypeHandle wglGraphicsPipe::get_type(void) const { @@ -129,7 +129,7 @@ wglGraphicsPipe& wglGraphicsPipe::operator=(const wglGraphicsPipe&) { // Function: find_window // Access: // Description: Find the window that has the xwindow "win" in the -// window list for the pipe (if it exists) +// window list for the pipe (if it exists) //////////////////////////////////////////////////////////////////// wglGraphicsWindow *wglGraphicsPipe:: find_window(HWND win) { @@ -187,22 +187,22 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { case WM_KEYDOWN: window = find_window(hwnd); if (window) { - POINT point; - window->make_current(); - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - window->handle_keypress(lookup_key(wparam), point.x, point.y); + POINT point; + window->make_current(); + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + window->handle_keypress(lookup_key(wparam), point.x, point.y); } return 0; case WM_SYSKEYUP: case WM_KEYUP: window = find_window(hwnd); if (window) { - POINT point; - window->make_current(); - GetCursorPos(&point); - ScreenToClient(hwnd, &point); - window->handle_keyrelease(lookup_key(wparam), point.x, point.y); + POINT point; + window->make_current(); + GetCursorPos(&point); + ScreenToClient(hwnd, &point); + window->handle_keyrelease(lookup_key(wparam), point.x, point.y); } return 0; case WM_LBUTTONDOWN: @@ -212,7 +212,7 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { button = 1; case WM_RBUTTONDOWN: if (button < 0) - button = 2; + button = 2; SetCapture(hwnd); // Win32 doesn't return the same numbers as X does when the mouse // goes beyond the upper or left side of the window @@ -222,53 +222,53 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { if (y & 1 << 15) y -= (1 << 16); window = find_window(hwnd); if (window) { - window->make_current(); - window->handle_keypress(MouseButton::button(button), x, y); + window->make_current(); + window->handle_keypress(MouseButton::button(button), x, y); } return 0; case WM_LBUTTONUP: button = 0; case WM_MBUTTONUP: if (button < 0) - button = 1; + button = 1; case WM_RBUTTONUP: if (button < 0) - button = 2; + button = 2; ReleaseCapture(); window = find_window(hwnd); if (window) { - x = LOWORD(lparam); - y = HIWORD(lparam); - if (x & 1 << 15) x -= (1 << 16); - if (y & 1 << 15) y -= (1 << 16); - window->make_current(); - window->handle_keyrelease(MouseButton::button(button), x, y); + x = LOWORD(lparam); + y = HIWORD(lparam); + if (x & 1 << 15) x -= (1 << 16); + if (y & 1 << 15) y -= (1 << 16); + window->make_current(); + window->handle_keyrelease(MouseButton::button(button), x, y); } return 0; case WM_MOUSEMOVE: window = find_window(hwnd); if (window) { - x = LOWORD(lparam); - y = HIWORD(lparam); - if (x & 1 << 15) x -= (1 << 16); - if (y & 1 << 15) y -= (1 << 16); - if (window->mouse_motion_enabled() - && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { - window->make_current(); - window->handle_mouse_motion(x, y); - } else if (window->mouse_passive_motion_enabled() && - ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { - window->make_current(); - window->handle_mouse_motion(x, y); - } + x = LOWORD(lparam); + y = HIWORD(lparam); + if (x & 1 << 15) x -= (1 << 16); + if (y & 1 << 15) y -= (1 << 16); + if (window->mouse_motion_enabled() + && wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) { + window->make_current(); + window->handle_mouse_motion(x, y); + } else if (window->mouse_passive_motion_enabled() && + ((wparam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) == 0)) { + window->make_current(); + window->handle_mouse_motion(x, y); + } } return 0; case WM_SIZE: window = find_window(hwnd); if (window) { - width = LOWORD(lparam); - height = HIWORD(lparam); - window->handle_reshape(width, height); + width = LOWORD(lparam); + height = HIWORD(lparam); + window->handle_reshape(width, height); } return 0; @@ -288,19 +288,19 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { SetCursor(hMouseCrossIcon); window = find_window(hwnd); if (window) { - if (window->mouse_entry_enabled()) { - window->make_current(); - window->handle_mouse_entry(MOUSE_ENTERED); - } + if (window->mouse_entry_enabled()) { + window->make_current(); + window->handle_mouse_entry(MOUSE_ENTERED); + } } return 0; case WM_KILLFOCUS: window = find_window(hwnd); if (window) { - if (window->mouse_entry_enabled()) { - window->make_current(); - window->handle_mouse_entry(MOUSE_EXITED); - } + if (window->mouse_entry_enabled()) { + window->make_current(); + window->handle_mouse_entry(MOUSE_EXITED); + } } return 0; default: @@ -362,31 +362,31 @@ wglGraphicsPipe::lookup_key(WPARAM wparam) const { int key = MapVirtualKey(wparam, 2); if (isascii(key) && key != 0) { if (GetKeyState(VK_SHIFT) >= 0) - key = tolower(key); + key = tolower(key); else { - switch (key) { - case '1': key = '!'; break; - case '2': key = '@'; break; - case '3': key = '#'; break; - case '4': key = '$'; break; - case '5': key = '%'; break; - case '6': key = '^'; break; - case '7': key = '&'; break; - case '8': key = '*'; break; - case '9': key = '('; break; - case '0': key = ')'; break; - case '-': key = '_'; break; - case '=': key = '+'; break; - case ',': key = '<'; break; - case '.': key = '>'; break; - case '/': key = '?'; break; - case ';': key = ':'; break; - case '\'': key = '"'; break; - case '[': key = '{'; break; - case ']': key = '}'; break; - case '\\': key = '|'; break; - case '`': key = '~'; break; - } + switch (key) { + case '1': key = '!'; break; + case '2': key = '@'; break; + case '3': key = '#'; break; + case '4': key = '$'; break; + case '5': key = '%'; break; + case '6': key = '^'; break; + case '7': key = '&'; break; + case '8': key = '*'; break; + case '9': key = '('; break; + case '0': key = ')'; break; + case '-': key = '_'; break; + case '=': key = '+'; break; + case ',': key = '<'; break; + case '.': key = '>'; break; + case '/': key = '?'; break; + case ';': key = ':'; break; + case '\'': key = '"'; break; + case '[': key = '{'; break; + case ']': key = '}'; break; + case '\\': key = '|'; break; + case '`': key = '~'; break; + } } return KeyboardButton::ascii_key((uchar)key); } diff --git a/panda/src/wgldisplay/wglGraphicsPipe.h b/panda/src/wgldisplay/wglGraphicsPipe.h index be9f51f180..0a9730f126 100644 --- a/panda/src/wgldisplay/wglGraphicsPipe.h +++ b/panda/src/wgldisplay/wglGraphicsPipe.h @@ -49,9 +49,9 @@ private: static TypeHandle _type_handle; - int _width; - int _height; - bool _shift; + int _width; + int _height; + bool _shift; protected: @@ -60,7 +60,7 @@ protected: wglGraphicsPipe& operator=(const wglGraphicsPipe&); static LONG WINAPI static_window_proc(HWND hwnd, UINT msg, WPARAM wparam, - LPARAM lparam); + LPARAM lparam); LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); }; diff --git a/panda/src/wgldisplay/wglGraphicsWindow.cxx b/panda/src/wgldisplay/wglGraphicsWindow.cxx index de9dd72efd..24004f3e74 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.cxx +++ b/panda/src/wgldisplay/wglGraphicsWindow.cxx @@ -760,9 +760,9 @@ void wglGraphicsWindow::config(void) { enable_mouse_motion(true); enable_mouse_passive_motion(true); - // Now indicate that we have our keyboard/mouse device ready. - GraphicsWindowInputDevice device = - GraphicsWindowInputDevice::pointer_and_keyboard("keyboard/mouse"); + // Now indicate that we have our keyboard/mouse device ready. + GraphicsWindowInputDevice device = + GraphicsWindowInputDevice::pointer_and_keyboard("keyboard/mouse"); _input_devices.push_back(device); // Create a GSG to manage the graphics @@ -956,7 +956,7 @@ void wglGraphicsWindow::handle_reshape(int w, int h) { // Description: //////////////////////////////////////////////////////////////////// void wglGraphicsWindow::handle_mouse_motion(int x, int y) { - _input_devices[0].set_pointer_in_window(x, y); + _input_devices[0].set_pointer_in_window(x, y); } //////////////////////////////////////////////////////////////////// @@ -965,9 +965,9 @@ void wglGraphicsWindow::handle_mouse_motion(int x, int y) { // Description: //////////////////////////////////////////////////////////////////// void wglGraphicsWindow::handle_mouse_entry(int state) { - if (state == MOUSE_EXITED) { - _input_devices[0].set_pointer_out_of_window(); - } + if (state == MOUSE_EXITED) { + _input_devices[0].set_pointer_out_of_window(); + } } //////////////////////////////////////////////////////////////////// @@ -977,10 +977,10 @@ void wglGraphicsWindow::handle_mouse_entry(int state) { //////////////////////////////////////////////////////////////////// void wglGraphicsWindow:: handle_keypress(ButtonHandle key, int x, int y) { - _input_devices[0].set_pointer_in_window(x, y); - if (key != ButtonHandle::none()) { - _input_devices[0].button_down(key); - } + _input_devices[0].set_pointer_in_window(x, y); + if (key != ButtonHandle::none()) { + _input_devices[0].button_down(key); + } } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/wgldisplay/wglGraphicsWindow.h b/panda/src/wgldisplay/wglGraphicsWindow.h index fc0a43cb6e..fea2371276 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.h +++ b/panda/src/wgldisplay/wglGraphicsWindow.h @@ -21,8 +21,8 @@ //////////////////////////////////////////////////////////////////// class wglGraphicsPipe; -const int WGLWIN_CONFIGURE = 4; -const int WGLWIN_EVENT = 8; +const int WGLWIN_CONFIGURE = 4; +const int WGLWIN_EVENT = 8; #define GLX_USE_GL 1 /* support GLX rendering */ #define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ @@ -51,7 +51,7 @@ class EXPCL_PANDAGL wglGraphicsWindow : public GraphicsWindow { public: wglGraphicsWindow(GraphicsPipe* pipe); wglGraphicsWindow(GraphicsPipe* pipe, - const GraphicsWindow::Properties& props); + const GraphicsWindow::Properties& props); virtual ~wglGraphicsWindow(void); virtual bool supports_update() const; @@ -78,7 +78,7 @@ public: protected: PIXELFORMATDESCRIPTOR* try_for_visual(wglGraphicsPipe *pipe, - int mask, int want_depth_bits = 1, int want_color_bits = 1); + int mask, int want_depth_bits = 1, int want_color_bits = 1); int choose_visual(void); static void get_config(PIXELFORMATDESCRIPTOR* visual, int attrib, int *value); virtual void config( void ); @@ -96,21 +96,21 @@ protected: void adjust_coords(int &xorg, int &yorg, int &xsize, int &ysize); public: - uint _change_mask; - HWND _mwindow; + uint _change_mask; + HWND _mwindow; private: - HGLRC _context; - HDC _hdc; - PIXELFORMATDESCRIPTOR* _visual; - HPALETTE _colormap; + HGLRC _context; + HDC _hdc; + PIXELFORMATDESCRIPTOR* _visual; + HPALETTE _colormap; - bool _mouse_input_enabled; - bool _mouse_motion_enabled; - bool _mouse_passive_motion_enabled; - bool _mouse_entry_enabled; - int _entry_state; - bool _ignore_key_repeat; + bool _mouse_input_enabled; + bool _mouse_motion_enabled; + bool _mouse_passive_motion_enabled; + bool _mouse_entry_enabled; + int _entry_state; + bool _ignore_key_repeat; int _full_height, _full_width; // vars for frames/sec meter diff --git a/pandatool/src/bam/bamInfo.h b/pandatool/src/bam/bamInfo.h index 61f28fa0c5..564ada5993 100644 --- a/pandatool/src/bam/bamInfo.h +++ b/pandatool/src/bam/bamInfo.h @@ -18,7 +18,7 @@ class TypedWritable; //////////////////////////////////////////////////////////////////// -// Class : BamInfo +// Class : BamInfo // Description : //////////////////////////////////////////////////////////////////// class BamInfo : public ProgramBase { diff --git a/pandatool/src/bam/eggToBam.h b/pandatool/src/bam/eggToBam.h index ea542c1ddb..6a92bd08d2 100644 --- a/pandatool/src/bam/eggToBam.h +++ b/pandatool/src/bam/eggToBam.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggToBam +// Class : EggToBam // Description : //////////////////////////////////////////////////////////////////// class EggToBam : public EggToSomething { diff --git a/pandatool/src/converter/distanceUnit.cxx b/pandatool/src/converter/distanceUnit.cxx index b84da70ad5..b820163f35 100644 --- a/pandatool/src/converter/distanceUnit.cxx +++ b/pandatool/src/converter/distanceUnit.cxx @@ -131,13 +131,13 @@ string_distance_unit(const string &str) { return DU_inches; } else if (cmp_nocase(str, "nmi") == 0 || - cmp_nocase(str, "nm") == 0 || - cmp_nocase_uh(str, "nautical_miles") == 0) { + cmp_nocase(str, "nm") == 0 || + cmp_nocase_uh(str, "nautical_miles") == 0) { return DU_nautical_miles; } else if (cmp_nocase(str, "mi") == 0 || - cmp_nocase(str, "miles") == 0 || - cmp_nocase_uh(str, "statute_miles") == 0) { + cmp_nocase(str, "miles") == 0 || + cmp_nocase_uh(str, "statute_miles") == 0) { return DU_statute_miles; } else { diff --git a/pandatool/src/converter/distanceUnit.h b/pandatool/src/converter/distanceUnit.h index fd7aea4551..d1afaa21f7 100644 --- a/pandatool/src/converter/distanceUnit.h +++ b/pandatool/src/converter/distanceUnit.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Enum : DistanceUnit +// Enum : DistanceUnit // Description : This enumerated type lists all the kinds of units // we're likely to come across in model conversion // programs. diff --git a/pandatool/src/converter/somethingToEggConverter.I b/pandatool/src/converter/somethingToEggConverter.I index 2c5d63e71a..fbd83cdfd1 100644 --- a/pandatool/src/converter/somethingToEggConverter.I +++ b/pandatool/src/converter/somethingToEggConverter.I @@ -31,7 +31,7 @@ //////////////////////////////////////////////////////////////////// INLINE void SomethingToEggConverter:: set_texture_path_convert(PathConvert tpc, - const Filename &tpc_directory) { + const Filename &tpc_directory) { _tpc = tpc; _tpc_directory = tpc_directory; } @@ -47,7 +47,7 @@ set_texture_path_convert(PathConvert tpc, //////////////////////////////////////////////////////////////////// INLINE void SomethingToEggConverter:: set_model_path_convert(PathConvert mpc, - const Filename &mpc_directory) { + const Filename &mpc_directory) { _mpc = mpc; _mpc_directory = mpc_directory; } @@ -115,7 +115,7 @@ get_egg_data() { //////////////////////////////////////////////////////////////////// bool SomethingToEggConverter:: handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename) { + const Filename &orig_filename) { return handle_external_reference(egg_parent, orig_filename, get_model_path()); } @@ -141,7 +141,7 @@ convert_texture_path(const Filename &orig_filename) { //////////////////////////////////////////////////////////////////// INLINE Filename SomethingToEggConverter:: convert_texture_path(const Filename &orig_filename, - const DSearchPath &searchpath) { + const DSearchPath &searchpath) { return convert_path(orig_filename, searchpath, _tpc_directory, _tpc); } @@ -166,6 +166,6 @@ convert_model_path(const Filename &orig_filename) { //////////////////////////////////////////////////////////////////// INLINE Filename SomethingToEggConverter:: convert_model_path(const Filename &orig_filename, - const DSearchPath &searchpath) { + const DSearchPath &searchpath) { return convert_path(orig_filename, searchpath, _mpc_directory, _mpc); } diff --git a/pandatool/src/converter/somethingToEggConverter.cxx b/pandatool/src/converter/somethingToEggConverter.cxx index 7e2a9859fc..78bd9d1ba3 100644 --- a/pandatool/src/converter/somethingToEggConverter.cxx +++ b/pandatool/src/converter/somethingToEggConverter.cxx @@ -88,8 +88,8 @@ set_egg_data(EggData *egg_data, bool owns_egg_data) { //////////////////////////////////////////////////////////////////// bool SomethingToEggConverter:: handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename, - const DSearchPath &searchpath) { + const Filename &orig_filename, + const DSearchPath &searchpath) { if (_merge_externals) { SomethingToEggConverter *ext = make_copy(); EggData egg_data; @@ -104,7 +104,7 @@ handle_external_reference(EggGroupNode *egg_parent, // filename. Filename truncated = orig_filename.get_basename(); if (truncated.resolve_filename(searchpath)) { - as_found = truncated; + as_found = truncated; } } @@ -148,7 +148,7 @@ handle_external_reference(EggGroupNode *egg_parent, //////////////////////////////////////////////////////////////////// Filename SomethingToEggConverter:: convert_path(const Filename &orig_filename, const DSearchPath &searchpath, - const Filename &rel_dir, PathConvert path_convert) { + const Filename &rel_dir, PathConvert path_convert) { // Try to look up the filename along the search path. Filename as_found = orig_filename; if (!as_found.resolve_filename(searchpath)) { diff --git a/pandatool/src/converter/somethingToEggConverter.h b/pandatool/src/converter/somethingToEggConverter.h index c8467c3513..18af614d9a 100644 --- a/pandatool/src/converter/somethingToEggConverter.h +++ b/pandatool/src/converter/somethingToEggConverter.h @@ -15,7 +15,7 @@ class EggData; class EggGroupNode; //////////////////////////////////////////////////////////////////// -// Class : SomethingToEggConverter +// Class : SomethingToEggConverter // Description : This is a base class for a family of converter // classes that manage a conversion from some file type // to egg format. @@ -40,9 +40,9 @@ public: PC_unchanged }; INLINE void set_texture_path_convert(PathConvert tpc, - const Filename &tpc_directory = Filename()); + const Filename &tpc_directory = Filename()); INLINE void set_model_path_convert(PathConvert mpc, - const Filename &mpc_directory = Filename()); + const Filename &mpc_directory = Filename()); INLINE void set_merge_externals(bool merge_externals); INLINE bool get_merge_externals() const; @@ -57,24 +57,24 @@ public: virtual bool convert_file(const Filename &filename)=0; bool handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename, - const DSearchPath &searchpath); + const Filename &orig_filename, + const DSearchPath &searchpath); INLINE bool handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename); + const Filename &orig_filename); INLINE Filename convert_texture_path(const Filename &orig_filename); INLINE Filename convert_texture_path(const Filename &orig_filename, - const DSearchPath &searchpath); + const DSearchPath &searchpath); INLINE Filename convert_model_path(const Filename &orig_filename); INLINE Filename convert_model_path(const Filename &orig_filename, - const DSearchPath &searchpath); + const DSearchPath &searchpath); protected: static Filename convert_path(const Filename &orig_filename, - const DSearchPath &searchpath, - const Filename &rel_dir, - PathConvert path_convert); + const DSearchPath &searchpath, + const Filename &rel_dir, + PathConvert path_convert); protected: diff --git a/pandatool/src/cvscopy/cvsCopy.cxx b/pandatool/src/cvscopy/cvsCopy.cxx index 485b43eb69..9c53b4c3a9 100644 --- a/pandatool/src/cvscopy/cvsCopy.cxx +++ b/pandatool/src/cvscopy/cvsCopy.cxx @@ -183,7 +183,7 @@ post_command_line() { if (_model_dir == (CVSSourceDirectory *)NULL) { if (_got_model_dirname) { nout << "Warning: model directory " << _model_dirname - << " is not within the source hierarchy.\n"; + << " is not within the source hierarchy.\n"; } } @@ -192,7 +192,7 @@ post_command_line() { if (_map_dir == (CVSSourceDirectory *)NULL) { nout << "Warning: map directory " << _map_dirname - << " is not within the source hierarchy.\n"; + << " is not within the source hierarchy.\n"; } } else { @@ -200,7 +200,7 @@ post_command_line() { if (_map_dir == (CVSSourceDirectory *)NULL) { nout << "Warning: no directory " << _tree.get_root_dirname() - << "/src/maps.\n"; + << "/src/maps.\n"; _map_dir = _model_dir; } } @@ -218,7 +218,7 @@ post_command_line() { //////////////////////////////////////////////////////////////////// bool CVSCopy:: verify_file(const Filename &, const Filename &, - CVSSourceDirectory *, void *) { + CVSSourceDirectory *, void *) { return false; } diff --git a/pandatool/src/cvscopy/cvsCopy.h b/pandatool/src/cvscopy/cvsCopy.h index 876a271fe0..0a6986b822 100644 --- a/pandatool/src/cvscopy/cvsCopy.h +++ b/pandatool/src/cvscopy/cvsCopy.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : CVSCopy +// Class : CVSCopy // Description : This is the base class for a family of programs that // copy files, typically model files like .flt files and // their associated textures, into a CVS-controlled @@ -26,18 +26,18 @@ public: CVSSourceDirectory * import(const Filename &source, void *extra_data, - CVSSourceDirectory *suggested_dir); + CVSSourceDirectory *suggested_dir); protected: virtual bool handle_args(Args &args); virtual bool post_command_line(); virtual bool verify_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dest_dir, - void *extra_data); + CVSSourceDirectory *dest_dir, + void *extra_data); virtual bool copy_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dest_dir, - void *extra_data, bool new_file)=0; + CVSSourceDirectory *dest_dir, + void *extra_data, bool new_file)=0; bool verify_binary_file(Filename source, Filename dest); bool copy_binary_file(Filename source, Filename dest); diff --git a/pandatool/src/cvscopy/cvsSourceDirectory.cxx b/pandatool/src/cvscopy/cvsSourceDirectory.cxx index eb9aaa8fc9..9a11593b5d 100644 --- a/pandatool/src/cvscopy/cvsSourceDirectory.cxx +++ b/pandatool/src/cvscopy/cvsSourceDirectory.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// CVSSourceDirectory:: CVSSourceDirectory(CVSSourceTree *tree, CVSSourceDirectory *parent, - const string &dirname) : + const string &dirname) : _tree(tree), _parent(parent), _dirname(dirname) @@ -236,11 +236,11 @@ scan(const Filename &directory, const string &key_filename) { Filename key(next_path, key_filename); if (key.exists()) { CVSSourceDirectory *subdir = - new CVSSourceDirectory(_tree, this, filename); + new CVSSourceDirectory(_tree, this, filename); _children.push_back(subdir); if (!subdir->scan(next_path, key_filename)) { - return false; + return false; } } else { diff --git a/pandatool/src/cvscopy/cvsSourceDirectory.h b/pandatool/src/cvscopy/cvsSourceDirectory.h index c4cd765d31..b96a8ada34 100644 --- a/pandatool/src/cvscopy/cvsSourceDirectory.h +++ b/pandatool/src/cvscopy/cvsSourceDirectory.h @@ -14,7 +14,7 @@ class CVSSourceTree; //////////////////////////////////////////////////////////////////// -// Class : CVSSourceDirectory +// Class : CVSSourceDirectory // Description : This represents one particular directory in the // hierarchy of source directory files. We must scan // the source directory to identify where the related @@ -23,7 +23,7 @@ class CVSSourceTree; class CVSSourceDirectory { public: CVSSourceDirectory(CVSSourceTree *tree, CVSSourceDirectory *parent, - const string &dirname); + const string &dirname); ~CVSSourceDirectory(); string get_dirname() const; diff --git a/pandatool/src/cvscopy/cvsSourceTree.cxx b/pandatool/src/cvscopy/cvsSourceTree.cxx index 7ff2108a6c..95100653e4 100644 --- a/pandatool/src/cvscopy/cvsSourceTree.cxx +++ b/pandatool/src/cvscopy/cvsSourceTree.cxx @@ -165,7 +165,7 @@ find_dirname(const string &dirname) { //////////////////////////////////////////////////////////////////// CVSSourceDirectory *CVSSourceTree:: choose_directory(const string &filename, CVSSourceDirectory *suggested_dir, - bool force, bool interactive) { + bool force, bool interactive) { static Directories empty_dirs; Filenames::const_iterator fi; @@ -175,12 +175,12 @@ choose_directory(const string &filename, CVSSourceDirectory *suggested_dir, const Directories &dirs = (*fi).second; return prompt_user(filename, suggested_dir, dirs, - force, interactive); + force, interactive); } // Now we have to prompt the user for a suitable place to put it. return prompt_user(filename, suggested_dir, empty_dirs, - force, interactive); + force, interactive); } //////////////////////////////////////////////////////////////////// @@ -270,8 +270,8 @@ restore_cwd() { //////////////////////////////////////////////////////////////////// CVSSourceDirectory *CVSSourceTree:: prompt_user(const string &filename, CVSSourceDirectory *suggested_dir, - const CVSSourceTree::Directories &dirs, - bool force, bool interactive) { + const CVSSourceTree::Directories &dirs, + bool force, bool interactive) { if (dirs.size() == 1) { // The file already exists in exactly one place. if (!interactive) { @@ -320,14 +320,14 @@ CVSSourceDirectory *CVSSourceTree:: ask_existing(const string &filename, CVSSourceDirectory *dir) { while (true) { nout << filename << " found in tree at " - << dir->get_path() + "/" + filename << ".\n"; + << dir->get_path() + "/" + filename << ".\n"; string result = prompt("Overwrite this file (y/n)? "); nassertr(!result.empty(), (CVSSourceDirectory *)NULL); if (result.size() == 1) { if (tolower(result[0]) == 'y') { - return dir; + return dir; } else if (tolower(result[0]) == 'n') { - return NULL; + return NULL; } } @@ -343,16 +343,16 @@ ask_existing(const string &filename, CVSSourceDirectory *dir) { //////////////////////////////////////////////////////////////////// CVSSourceDirectory *CVSSourceTree:: ask_existing(const string &filename, const CVSSourceTree::Directories &dirs, - CVSSourceDirectory *suggested_dir) { + CVSSourceDirectory *suggested_dir) { while (true) { nout << filename << " found in tree at more than one place:\n"; bool any_suggested = false; for (int i = 0; i < (int)dirs.size(); i++) { nout << " " << (i + 1) << ". " - << dirs[i]->get_path() + "/" + filename << "\n"; + << dirs[i]->get_path() + "/" + filename << "\n"; if (dirs[i] == suggested_dir) { - any_suggested = true; + any_suggested = true; } } @@ -363,9 +363,9 @@ ask_existing(const string &filename, const CVSSourceTree::Directories &dirs, suggested_option = next_option; next_option++; nout << "\n" << suggested_option - << ". create " - << suggested_dir->get_path() + "/" + filename - << "\n"; + << ". create " + << suggested_dir->get_path() + "/" + filename + << "\n"; } int other_option = next_option; @@ -378,13 +378,13 @@ ask_existing(const string &filename, const CVSSourceTree::Directories &dirs, int option = strtol(nptr, &endptr, 10); if (*endptr == '\0') { if (option >= 1 && option <= (int)dirs.size()) { - return dirs[option - 1]; + return dirs[option - 1]; } else if (option == suggested_option) { - return suggested_dir; + return suggested_dir; } else if (option == other_option) { - return NULL; + return NULL; } } @@ -402,14 +402,14 @@ CVSSourceDirectory *CVSSourceTree:: ask_new(const string &filename, CVSSourceDirectory *dir) { while (true) { nout << filename << " will be created in " - << dir->get_path() << ".\n"; + << dir->get_path() << ".\n"; string result = prompt("Create this file (y/n)? "); nassertr(!result.empty(), (CVSSourceDirectory *)NULL); if (result.size() == 1) { if (tolower(result[0]) == 'y') { - return dir; + return dir; } else if (tolower(result[0]) == 'n') { - return NULL; + return NULL; } } diff --git a/pandatool/src/cvscopy/cvsSourceTree.h b/pandatool/src/cvscopy/cvsSourceTree.h index 24f9e797c2..5193316c83 100644 --- a/pandatool/src/cvscopy/cvsSourceTree.h +++ b/pandatool/src/cvscopy/cvsSourceTree.h @@ -14,7 +14,7 @@ class CVSSourceDirectory; //////////////////////////////////////////////////////////////////// -// Class : CVSSourceTree +// Class : CVSSourceTree // Description : This represents the root of the tree of source // directory files. //////////////////////////////////////////////////////////////////// @@ -32,8 +32,8 @@ public: CVSSourceDirectory *find_dirname(const string &dirname); CVSSourceDirectory *choose_directory(const string &filename, - CVSSourceDirectory *suggested_dir, - bool force, bool interactive); + CVSSourceDirectory *suggested_dir, + bool force, bool interactive); string get_root_fullpath(); string get_root_dirname() const; @@ -49,13 +49,13 @@ private: CVSSourceDirectory * prompt_user(const string &filename, CVSSourceDirectory *suggested_dir, - const Directories &dirs, bool force, bool interactive); + const Directories &dirs, bool force, bool interactive); CVSSourceDirectory *ask_existing(const string &filename, - CVSSourceDirectory *dir); + CVSSourceDirectory *dir); CVSSourceDirectory *ask_existing(const string &filename, - const Directories &dirs, - CVSSourceDirectory *suggested_dir); + const Directories &dirs, + CVSSourceDirectory *suggested_dir); CVSSourceDirectory *ask_new(const string &filename, CVSSourceDirectory *dir); CVSSourceDirectory *ask_any(const string &filename); diff --git a/pandatool/src/cvscopy/testCopy.cxx b/pandatool/src/cvscopy/testCopy.cxx index 4a62f34998..ad5afd765a 100644 --- a/pandatool/src/cvscopy/testCopy.cxx +++ b/pandatool/src/cvscopy/testCopy.cxx @@ -50,7 +50,7 @@ run() { //////////////////////////////////////////////////////////////////// bool TestCopy:: copy_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *, void *, bool) { + CVSSourceDirectory *, void *, bool) { return copy_binary_file(source, dest); } diff --git a/pandatool/src/cvscopy/testCopy.h b/pandatool/src/cvscopy/testCopy.h index d0b9727e29..6301c10d41 100644 --- a/pandatool/src/cvscopy/testCopy.h +++ b/pandatool/src/cvscopy/testCopy.h @@ -11,7 +11,7 @@ #include "cvsCopy.h" //////////////////////////////////////////////////////////////////// -// Class : TestCopy +// Class : TestCopy // Description : A program to copy ordinary files into the cvs tree. // Mainly to test CVSCopy. //////////////////////////////////////////////////////////////////// @@ -23,8 +23,8 @@ public: protected: virtual bool copy_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir, void *extra_data, - bool new_file); + CVSSourceDirectory *dir, void *extra_data, + bool new_file); }; #endif diff --git a/pandatool/src/egg-mkfont/charBitmap.cxx b/pandatool/src/egg-mkfont/charBitmap.cxx index d15e528bd7..51d0effd71 100644 --- a/pandatool/src/egg-mkfont/charBitmap.cxx +++ b/pandatool/src/egg-mkfont/charBitmap.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// CharBitmap:: CharBitmap(int character, int width, int height, - int hoff, int voff, double dx, double dy) { + int hoff, int voff, double dx, double dy) { _character = character; _hoff = hoff; _voff = voff; @@ -46,14 +46,14 @@ paint(bool black, int num_pixels, int &repeat) { _block[_y][_x] = black; _x++; if (_x >= _block[_y].size()) { - // End of a row. - _x = 0; - _y++; - while (repeat > 0 && _y < _block.size()) { - _block[_y] = _block[_y-1]; - _y++; - repeat--; - } + // End of a row. + _x = 0; + _y++; + while (repeat > 0 && _y < _block.size()) { + _block[_y] = _block[_y-1]; + _y++; + repeat--; + } } num_pixels--; } diff --git a/pandatool/src/egg-mkfont/charBitmap.h b/pandatool/src/egg-mkfont/charBitmap.h index 8e1426ab19..586abeafac 100644 --- a/pandatool/src/egg-mkfont/charBitmap.h +++ b/pandatool/src/egg-mkfont/charBitmap.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : CharBitmap +// Class : CharBitmap // Description : This defines a single character read from the PK // file. It stores the kerning information as well as // the character's decoded bitmap. @@ -23,8 +23,8 @@ public: typedef vector Block; CharBitmap(int character, int width, int height, - int hoff, int voff, double dx, double dy); - + int hoff, int voff, double dx, double dy); + bool paint(bool black, int num_pixels, int &repeat); INLINE int get_width() const; diff --git a/pandatool/src/egg-mkfont/charLayout.cxx b/pandatool/src/egg-mkfont/charLayout.cxx index ba85cacc63..d4006f39b4 100644 --- a/pandatool/src/egg-mkfont/charLayout.cxx +++ b/pandatool/src/egg-mkfont/charLayout.cxx @@ -71,8 +71,8 @@ find_hole(int &x, int &y, int x_size, int y_size) const { const CharPlacement *overlap = find_overlap(x, y, x_size, y_size); if (overlap == (const CharPlacement *)NULL) { - // Hooray! - return true; + // Hooray! + return true; } next_x = overlap->_x + overlap->_width; diff --git a/pandatool/src/egg-mkfont/charLayout.h b/pandatool/src/egg-mkfont/charLayout.h index 0679b1033e..1f82a6ddfc 100644 --- a/pandatool/src/egg-mkfont/charLayout.h +++ b/pandatool/src/egg-mkfont/charLayout.h @@ -15,7 +15,7 @@ class CharPlacement; //////////////////////////////////////////////////////////////////// -// Class : CharLayout +// Class : CharLayout // Description : This represents the arrangement of all characters on // a working bitmap of a given size. Either all // characters fit or they don't. @@ -23,7 +23,7 @@ class CharPlacement; class CharLayout { public: void reset(int working_xsize, int working_ysize, - int working_buffer_pixels); + int working_buffer_pixels); bool place_character(const CharBitmap *bm); diff --git a/pandatool/src/egg-mkfont/charPlacement.I b/pandatool/src/egg-mkfont/charPlacement.I index d1dcf04f55..3edc755827 100644 --- a/pandatool/src/egg-mkfont/charPlacement.I +++ b/pandatool/src/egg-mkfont/charPlacement.I @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////// INLINE CharPlacement:: CharPlacement(const CharBitmap *bm, int x, int y, - int width, int height) : + int width, int height) : _bm(bm), _x(x), _y(y), diff --git a/pandatool/src/egg-mkfont/charPlacement.cxx b/pandatool/src/egg-mkfont/charPlacement.cxx index 768b96ee3b..006a9938eb 100644 --- a/pandatool/src/egg-mkfont/charPlacement.cxx +++ b/pandatool/src/egg-mkfont/charPlacement.cxx @@ -24,5 +24,5 @@ intersects(int x, int y, int x_size, int y_size) const { int mbot = _y + _height; return !(x >= mright || hright <= _x || - y >= mbot || hbot <= _y); + y >= mbot || hbot <= _y); } diff --git a/pandatool/src/egg-mkfont/charPlacement.h b/pandatool/src/egg-mkfont/charPlacement.h index 24fc92f009..636132db6f 100644 --- a/pandatool/src/egg-mkfont/charPlacement.h +++ b/pandatool/src/egg-mkfont/charPlacement.h @@ -11,7 +11,7 @@ #include "charBitmap.h" //////////////////////////////////////////////////////////////////// -// Class : CharPlacement +// Class : CharPlacement // Description : This specifies where a particular character will be // placed on the working bitmap. An array of these is // built up to lay out all the characters in the bitmap, @@ -21,7 +21,7 @@ class CharPlacement { public: INLINE CharPlacement(const CharBitmap *bm, int x, int y, - int width, int height); + int width, int height); bool intersects(int x, int y, int x_size, int y_size) const; diff --git a/pandatool/src/egg-mkfont/eggMakeFont.cxx b/pandatool/src/egg-mkfont/eggMakeFont.cxx index ed2c69623e..e50998bf2f 100644 --- a/pandatool/src/egg-mkfont/eggMakeFont.cxx +++ b/pandatool/src/egg-mkfont/eggMakeFont.cxx @@ -238,7 +238,7 @@ ns_dispatch_dimensions(const string &opt, const string &arg) { if (!okflag) { nout << "-" << opt - << " requires two or three integers separated by commas.\n"; + << " requires two or three integers separated by commas.\n"; return false; } @@ -254,7 +254,7 @@ ns_dispatch_dimensions(const string &opt, const string &arg) { TexCoordd EggMakeFont:: get_uv(double x, double y) { return TexCoordd(x / (double)_working_xsize, - ((double)_working_ysize - y) / (double)_working_ysize); + ((double)_working_ysize - y) / (double)_working_ysize); } @@ -279,7 +279,7 @@ EggVertex *EggMakeFont:: make_vertex(const LPoint2d &xy) { return _vpool->make_new_vertex(LPoint3d::origin(_coordinate_system) + - LVector3d::rfu(xy[0], 0.0, xy[1], _coordinate_system)); + LVector3d::rfu(xy[0], 0.0, xy[1], _coordinate_system)); } //////////////////////////////////////////////////////////////////// @@ -306,18 +306,18 @@ copy_character(const CharPlacement &pl) { if (_output_image.has_alpha()) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - if (bm->_block[y][x]) { - _output_image.set_xel(xp + x, yp + y, _fg[0], _fg[1], _fg[2]); - _output_image.set_alpha(xp + x, yp + y, _fg[3]); - } + if (bm->_block[y][x]) { + _output_image.set_xel(xp + x, yp + y, _fg[0], _fg[1], _fg[2]); + _output_image.set_alpha(xp + x, yp + y, _fg[3]); + } } } } else { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - if (bm->_block[y][x]) { - _output_image.set_xel(xp + x, yp + y, _fg[0], _fg[1], _fg[2]); - } + if (bm->_block[y][x]) { + _output_image.set_xel(xp + x, yp + y, _fg[0], _fg[1], _fg[2]); + } } } } @@ -438,8 +438,8 @@ consider_scale_factor(double scale_factor) { if (!(_small_caps && islower(bm->_character))) { ok = _layout.place_character(bm); if (!ok) { - // Out of room. - return false; + // Out of room. + return false; } } } @@ -498,7 +498,7 @@ choose_scale_factor() { too_large = guess; guess = guess / 2.0; if (sanity_count++ > 20) { - return false; + return false; } } while (consider_scale_factor(guess)); too_small = guess; @@ -509,7 +509,7 @@ choose_scale_factor() { too_small = guess; guess = guess * 2.0; if (sanity_count++ > 20) { - return false; + return false; } } while (!consider_scale_factor(guess)); too_large = guess; @@ -539,9 +539,9 @@ choose_image_size() { // and we don't need so much image space. do { if (_output_ysize < _output_xsize) { - _output_xsize /= 2; + _output_xsize /= 2; } else { - _output_ysize /= 2; + _output_ysize /= 2; } sane = choose_scale_factor(); } while (sane && _scale_factor <= 2.5); @@ -557,9 +557,9 @@ choose_image_size() { // reduced and may be blurry. We need a larger image. do { if (_output_ysize < _output_xsize) { - _output_ysize *= 2; + _output_ysize *= 2; } else { - _output_xsize *= 2; + _output_xsize *= 2; } sane = choose_scale_factor(); } while (!sane || _scale_factor > 4.0); @@ -581,7 +581,7 @@ unsmooth_rgb(PNMImage &image) { for (int x = 0; x < image.get_x_size(); x++) { double alpha = image.get_alpha(x, y); if (alpha != 0.0) { - image.set_xel(x, y, image.get_xel(x, y) / alpha); + image.set_xel(x, y, image.get_xel(x, y) / alpha); } } } @@ -664,7 +664,7 @@ run() { // The user specified both; we accept the scale factor. if (!consider_scale_factor(_scale_factor)) { nout << "Ran out of room on font image; try increasing the image " - "size or the scale factor.\n"; + "size or the scale factor.\n"; exit(1); } @@ -788,20 +788,20 @@ run() { if (_no_reduce) { // Scaling of the final image forbidden by the user. nout << "Image destination size is " << _output_xsize - << " by " << _output_ysize << " by " << _output_zsize - << "; not reducing.\n"; + << " by " << _output_ysize << " by " << _output_zsize + << "; not reducing.\n"; nout << "Generating " << _working_xsize << " by " << _working_ysize - << " by " << _output_zsize << " image: " - << _output_image_filename << "\n"; + << " by " << _output_zsize << " image: " + << _output_image_filename << "\n"; _output_image.write(_output_image_filename); } else if (_output_xsize == _working_xsize && - _output_ysize == _working_ysize) { + _output_ysize == _working_ysize) { // Scaling unnecessary, because the scale factor is 1.0. nout << "Generating " << _output_xsize << " by " << _output_ysize - << " by " << _output_zsize << " image: " - << _output_image_filename << "\n"; + << " by " << _output_zsize << " image: " + << _output_image_filename << "\n"; _output_image.write(_output_image_filename); } else { @@ -819,8 +819,8 @@ run() { nout << "Generating " << _output_xsize << " by " << _output_ysize - << " by " << _output_zsize << " image: " - << _output_image_filename << "\n"; + << " by " << _output_zsize << " image: " + << _output_image_filename << "\n"; small_image.write(_output_image_filename); } diff --git a/pandatool/src/egg-mkfont/eggMakeFont.h b/pandatool/src/egg-mkfont/eggMakeFont.h index d02a3bba98..7f8030cc8f 100644 --- a/pandatool/src/egg-mkfont/eggMakeFont.h +++ b/pandatool/src/egg-mkfont/eggMakeFont.h @@ -23,7 +23,7 @@ class EggVertex; class FontFile; //////////////////////////////////////////////////////////////////// -// Class : EggMakeFont +// Class : EggMakeFont // Description : This program reads a rasterized font stored in a // Metafont/TeX pk file format, and generates an egg // file and texture map that can be used with TextNode diff --git a/pandatool/src/egg-mkfont/fontFile.h b/pandatool/src/egg-mkfont/fontFile.h index c1e23de02e..e109d974e0 100644 --- a/pandatool/src/egg-mkfont/fontFile.h +++ b/pandatool/src/egg-mkfont/fontFile.h @@ -16,7 +16,7 @@ class CharBitmap; //////////////////////////////////////////////////////////////////// -// Class : FontFile +// Class : FontFile // Description : This is an abstract base class that provides the // interface to reading and/or rasterizing a particular // font file. @@ -27,7 +27,7 @@ public: virtual ~FontFile(); virtual bool read(const Filename &filename, - bool extract_all, const string &extract_only)=0; + bool extract_all, const string &extract_only)=0; INLINE double get_ds() const; INLINE double get_dpi() const; diff --git a/pandatool/src/egg-mkfont/pkFontFile.cxx b/pandatool/src/egg-mkfont/pkFontFile.cxx index 6ffa87ce06..fbc0c47cc5 100644 --- a/pandatool/src/egg-mkfont/pkFontFile.cxx +++ b/pandatool/src/egg-mkfont/pkFontFile.cxx @@ -697,23 +697,23 @@ do_character(int flag_byte) { // bits stored directly in the pk file. This kind of character // is quite rare, and the code is therefore untested. if (h > 0 && w > 0) { - nout - << "\nA rare bitmapped character encountered! You are now running\n" - << "untested code. If this works, change this line in the program\n" - << "to indicate that the code is actually tested!\n\n"; + nout + << "\nA rare bitmapped character encountered! You are now running\n" + << "untested code. If this works, change this line in the program\n" + << "to indicate that the code is actually tested!\n\n"; } unsigned int bit = 0; unsigned int byte = 0; for (unsigned int y = 0; y < h; y++) { - for (unsigned int x = 0; x < w; x++) { - if (bit == 0) { - bit = 0x80; - byte = fetch_byte(); - } - bm->_block[y][x] = ((byte & bit)!=0); - bit >>= 1; - } + for (unsigned int x = 0; x < w; x++) { + if (bit == 0) { + bit = 0x80; + byte = fetch_byte(); + } + bm->_block[y][x] = ((byte & bit)!=0); + bit >>= 1; + } } } else { @@ -725,15 +725,15 @@ do_character(int flag_byte) { int count = fetch_packed_int(); while (bm->paint(black, count, _repeat_count)) { - /* - if (black) { - nout << count; - } else { - nout << "(" << count << ")"; - } - */ - black = !black; - count = fetch_packed_int(); + /* + if (black) { + nout << count; + } else { + nout << "(" << count << ")"; + } + */ + black = !black; + count = fetch_packed_int(); } // nout << "\n"; } @@ -743,7 +743,7 @@ do_character(int flag_byte) { /* for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - nout << (bm->_block[y][x] ? ' ' : '*'); + nout << (bm->_block[y][x] ? ' ' : '*'); } nout << "\n"; } @@ -862,40 +862,40 @@ read_pk() { } if (cmd < 240) { if (!do_character(cmd)) { - return true; + return true; } } else { switch (cmd) { case PK_XXX1: - do_xxx(1); - break; - + do_xxx(1); + break; + case PK_XXX2: - do_xxx(2); - break; - + do_xxx(2); + break; + case PK_XXX3: - do_xxx(3); - break; - + do_xxx(3); + break; + case PK_XXX4: - do_xxx(4); - break; - + do_xxx(4); + break; + case PK_YYY: - do_yyy(); - break; - + do_yyy(); + break; + case PK_POST: - do_post(); - break; - + do_post(); + break; + case PK_NO_OP: - break; - + break; + default: - nout << "\nUnexpected command " << cmd << " encountered in PK file\n"; - return false; + nout << "\nUnexpected command " << cmd << " encountered in PK file\n"; + return false; } } } diff --git a/pandatool/src/egg-mkfont/pkFontFile.h b/pandatool/src/egg-mkfont/pkFontFile.h index 2be1f45abd..4dc4772a1a 100644 --- a/pandatool/src/egg-mkfont/pkFontFile.h +++ b/pandatool/src/egg-mkfont/pkFontFile.h @@ -11,7 +11,7 @@ #include "fontFile.h" //////////////////////////////////////////////////////////////////// -// Class : PkFontFile +// Class : PkFontFile // Description : A specialization on FontFile for reading TeX-style // .pk fonts. //////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ public: PkFontFile(); virtual bool read(const Filename &filename, - bool extract_all, const string &extract_only); + bool extract_all, const string &extract_only); private: unsigned int fetch_nibble(); diff --git a/pandatool/src/egg-palettize/destTextureImage.cxx b/pandatool/src/egg-palettize/destTextureImage.cxx index cd3f4cafbb..48ed7b7c1c 100644 --- a/pandatool/src/egg-palettize/destTextureImage.cxx +++ b/pandatool/src/egg-palettize/destTextureImage.cxx @@ -58,7 +58,7 @@ void DestTextureImage:: copy(TextureImage *texture) { const PNMImage &source_image = texture->read_source_image(); PNMImage dest_image(_x_size, _y_size, texture->get_num_channels(), - source_image.get_maxval()); + source_image.get_maxval()); dest_image.quick_filter_from(source_image); write(dest_image); } @@ -83,7 +83,7 @@ copy_if_stale(const DestTextureImage *other, TextureImage *texture) { SourceTextureImage *source = texture->get_preferred_source(); if (source != (SourceTextureImage *)NULL && - source->get_filename().compare_timestamps(get_filename()) > 0) { + source->get_filename().compare_timestamps(get_filename()) > 0) { copy(texture); } } diff --git a/pandatool/src/egg-palettize/destTextureImage.h b/pandatool/src/egg-palettize/destTextureImage.h index 5a562d791c..cf61403792 100644 --- a/pandatool/src/egg-palettize/destTextureImage.h +++ b/pandatool/src/egg-palettize/destTextureImage.h @@ -14,7 +14,7 @@ class TexturePlacement; class TextureImage; //////////////////////////////////////////////////////////////////// -// Class : DestTextureImage +// Class : DestTextureImage // Description : This represents a texture filename as it has been // resized and copied to the map directory (e.g. for an // unplaced texture). @@ -49,7 +49,7 @@ public: static void init_type() { ImageFile::init_type(); register_type(_type_handle, "DestTextureImage", - ImageFile::get_class_type()); + ImageFile::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/eggFile.cxx b/pandatool/src/egg-palettize/eggFile.cxx index 86e7b8ad64..7e9bf4d73d 100644 --- a/pandatool/src/egg-palettize/eggFile.cxx +++ b/pandatool/src/egg-palettize/eggFile.cxx @@ -45,8 +45,8 @@ EggFile() { //////////////////////////////////////////////////////////////////// void EggFile:: from_command_line(EggData *data, - const Filename &source_filename, - const Filename &dest_filename) { + const Filename &source_filename, + const Filename &dest_filename) { _data = data; // We save the current directory at the time the egg file appeared @@ -315,7 +315,7 @@ choose_placements() { TextureImage *texture = reference->get_texture(); if (reference->get_placement() != (TexturePlacement *)NULL && - texture->get_groups().count(reference->get_placement()->get_group()) != 0) { + texture->get_groups().count(reference->get_placement()->get_group()) != 0) { // The egg file is already using a TexturePlacement that is // suitable. Don't bother changing it. @@ -328,24 +328,24 @@ choose_placements() { // which also happen to include the texture. It better not be // empty. if (groups.empty()) { - nout << "Warning! Egg file " << get_name() << " and texture " - << *reference << " do not have any groups in common.\n" - << "Egg groups:\n"; - get_complete_groups().write(nout, 2); - nout << "Texture groups:\n"; - texture->get_groups().write(nout, 2); + nout << "Warning! Egg file " << get_name() << " and texture " + << *reference << " do not have any groups in common.\n" + << "Egg groups:\n"; + get_complete_groups().write(nout, 2); + nout << "Texture groups:\n"; + texture->get_groups().write(nout, 2); } else { - // It doesn't really matter which group in the set we choose, so - // we arbitrarily choose the first one. - PaletteGroup *group = (*groups.begin()); + // It doesn't really matter which group in the set we choose, so + // we arbitrarily choose the first one. + PaletteGroup *group = (*groups.begin()); - // Now get the TexturePlacement object that corresponds to the - // placement of this texture into this group. - TexturePlacement *placement = texture->get_placement(group); - nassertv(placement != (TexturePlacement *)NULL); - - reference->set_placement(placement); + // Now get the TexturePlacement object that corresponds to the + // placement of this texture into this group. + TexturePlacement *placement = texture->get_placement(group); + nassertv(placement != (TexturePlacement *)NULL); + + reference->set_placement(placement); } } } diff --git a/pandatool/src/egg-palettize/eggFile.h b/pandatool/src/egg-palettize/eggFile.h index 0108a276e5..026c21ea87 100644 --- a/pandatool/src/egg-palettize/eggFile.h +++ b/pandatool/src/egg-palettize/eggFile.h @@ -22,7 +22,7 @@ class EggData; class TextureImage; //////////////////////////////////////////////////////////////////// -// Class : EggFile +// Class : EggFile // Description : This represents a single egg file known to the // palettizer. It may reference a number of textures, // and may also be assigned to a number of groups. All @@ -34,8 +34,8 @@ public: EggFile(); void from_command_line(EggData *data, - const Filename &source_filename, - const Filename &dest_filename); + const Filename &source_filename, + const Filename &dest_filename); void scan_textures(); void get_textures(set &result) const; @@ -88,7 +88,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_EggFile(const FactoryParams ¶ms); @@ -107,8 +107,8 @@ public: TypedWritable::init_type(); Namable::init_type(); register_type(_type_handle, "EggFile", - TypedWritable::get_class_type(), - Namable::get_class_type()); + TypedWritable::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/eggPalettize.cxx b/pandatool/src/egg-palettize/eggPalettize.cxx index 35ccabbf6f..98781fb71b 100644 --- a/pandatool/src/egg-palettize/eggPalettize.cxx +++ b/pandatool/src/egg-palettize/eggPalettize.cxx @@ -229,70 +229,70 @@ describe_input_file() { "texture are:\n\n"; show_text(" omit", 10, - "This indicates that the texture should not be placed on any " - "palette image. It may still be resized, and it will in any " - "case be copied into the install directory.\n\n"); + "This indicates that the texture should not be placed on any " + "palette image. It may still be resized, and it will in any " + "case be copied into the install directory.\n\n"); show_text(" margin i", 10, - "This specifies the number of pixels that should be written " - "around the border of the texture when it is placed in a " - "palette image; i is the integer number of pixels. The " - "use of a margin helps cut down on color bleed " - "from neighboring images. If the texture does " - "not end up placed in a palette image, the " - "margin is not used. If not specified, the default margin is " - "used, which is specified by the :margin command (see below).\n\n"); + "This specifies the number of pixels that should be written " + "around the border of the texture when it is placed in a " + "palette image; i is the integer number of pixels. The " + "use of a margin helps cut down on color bleed " + "from neighboring images. If the texture does " + "not end up placed in a palette image, the " + "margin is not used. If not specified, the default margin is " + "used, which is specified by the :margin command (see below).\n\n"); show_text(" coverage f", 10, - "This parameter specifies the maximum coverage to allow for this " - "particular texture before rejecting it " - "from the palette. If not specified, the default is " - "specified by the :coverage command (see below).\n\n"); + "This parameter specifies the maximum coverage to allow for this " + "particular texture before rejecting it " + "from the palette. If not specified, the default is " + "specified by the :coverage command (see below).\n\n"); nout << " nearest\n" << " linear\n"; show_text(" mipmap", 10, - "One of these options may be used to force the texture to use " - "a particular minfilter/magfilter sampling mode. If this is not " - "specified, the sampling mode specified in the egg file is " - "used. Textures that use different sampling modes cannot " - "be placed together on the same palette images.\n\n"); + "One of these options may be used to force the texture to use " + "a particular minfilter/magfilter sampling mode. If this is not " + "specified, the sampling mode specified in the egg file is " + "used. Textures that use different sampling modes cannot " + "be placed together on the same palette images.\n\n"); show_text(" rgba", 10, - "This specifies format 'rgba' should be in effect for this " - "particular texture. Any valid egg texture format, such as " - "rgba, rgba12, rgba8, rgb5, luminance, etc. may be specified. " - "If nothing is specified, the format specified in the egg file " - "is used. The format will automatically be downgraded to match " - "the number of channels in the texture image; e.g. rgba will " - "automatically be converted to rgb for a three-channel image. " - "As with the filter modes above, textures that use different " - "formats cannot be placed together on the same palette " - "images.\n\n"); + "This specifies format 'rgba' should be in effect for this " + "particular texture. Any valid egg texture format, such as " + "rgba, rgba12, rgba8, rgb5, luminance, etc. may be specified. " + "If nothing is specified, the format specified in the egg file " + "is used. The format will automatically be downgraded to match " + "the number of channels in the texture image; e.g. rgba will " + "automatically be converted to rgb for a three-channel image. " + "As with the filter modes above, textures that use different " + "formats cannot be placed together on the same palette " + "images.\n\n"); show_text(" (image type)", 10, - "A texture may be converted to a particular image type, for " - "instance jpg or rgb, by naming the type. If present, this " - "overrides the :imagetype command, described below. As with " - ":imagetype, you may also specify two type names separated " - "by a comma, to indicate that a different file should be written " - "for the color and alpha components.\n\n"); + "A texture may be converted to a particular image type, for " + "instance jpg or rgb, by naming the type. If present, this " + "overrides the :imagetype command, described below. As with " + ":imagetype, you may also specify two type names separated " + "by a comma, to indicate that a different file should be written " + "for the color and alpha components.\n\n"); show_text(" (group name)", 10, - "A texture may also be assigned to a specific group by naming " - "the group. The groups are defined using the :group command " - "(see below). Normally, textures are not assigned directly " - "to groups; instead, it is more useful to assign the egg files " - "they are referenced in to groups; see below.\n\n"); + "A texture may also be assigned to a specific group by naming " + "the group. The groups are defined using the :group command " + "(see below). Normally, textures are not assigned directly " + "to groups; instead, it is more useful to assign the egg files " + "they are referenced in to groups; see below.\n\n"); show_text(" cont", 10, - "Normally, a texture file (or egg file) scans the lines in the " - "attributes file from the top, and stops on the first line that " - "matches its name. If the keyword 'cont' is included on the " - "line, however, the texture will apply the properties given " - "on the line, and then continue scanning. This trick may be " - "used to specify general parameters for all files while still " - "allowing the texture to match a more specific line below.\n\n"); + "Normally, a texture file (or egg file) scans the lines in the " + "attributes file from the top, and stops on the first line that " + "matches its name. If the keyword 'cont' is included on the " + "line, however, the texture will apply the properties given " + "on the line, and then continue scanning. This trick may be " + "used to specify general parameters for all files while still " + "allowing the texture to match a more specific line below.\n\n"); nout << "The attributes file may also assign egg files to various " @@ -318,139 +318,139 @@ describe_input_file() { "appear on a line by itself. The commands are:\n\n"; show_text(" :palette xsize ysize", 10, - "This specifies the size of the palette images to be " - "created. The default is 512 by 512.\n\n"); + "This specifies the size of the palette images to be " + "created. The default is 512 by 512.\n\n"); show_text(" :margin msize", 10, - "This specifies the amount of default margin to apply to all " - "textures that are placed within a palette image. The margin " - "is a number of additional pixels that are written around the " - "texture image to help prevent color bleeding between " - "neighboring images within the same palette. The default " - "is 2.\n\n"); + "This specifies the amount of default margin to apply to all " + "textures that are placed within a palette image. The margin " + "is a number of additional pixels that are written around the " + "texture image to help prevent color bleeding between " + "neighboring images within the same palette. The default " + "is 2.\n\n"); show_text(" :coverage area", 10, - "The 'coverage' of a texture refers to the fraction of " - "the area in the texture image that is actually used, according " - "to the UV's that appear in the various egg files. If a texture's " - "coverage is less than 1, only some of the texture image is used " - "(and only this part will be written to the palette). If the " - "coverage is greater than 1, the texture repeats that number of " - "times. A repeating texture may still be palettized by writing " - "the required number of copies into the palette image, according " - "to the coverage area.\n\n" - - "This command specifies the maximum coverage to allow for any " - "texture before rejecting it from the palette. It may be any " - "floating-point number greater than zero. Set this to 1 " - "to avoid palettizing repeating textures altogether. This may " - "also be overridden for a particular texture using the 'coverage' " - "keyword on the texture line.\n\n"); + "The 'coverage' of a texture refers to the fraction of " + "the area in the texture image that is actually used, according " + "to the UV's that appear in the various egg files. If a texture's " + "coverage is less than 1, only some of the texture image is used " + "(and only this part will be written to the palette). If the " + "coverage is greater than 1, the texture repeats that number of " + "times. A repeating texture may still be palettized by writing " + "the required number of copies into the palette image, according " + "to the coverage area.\n\n" + + "This command specifies the maximum coverage to allow for any " + "texture before rejecting it from the palette. It may be any " + "floating-point number greater than zero. Set this to 1 " + "to avoid palettizing repeating textures altogether. This may " + "also be overridden for a particular texture using the 'coverage' " + "keyword on the texture line.\n\n"); show_text(" :round fraction fuzz", 10, - "When the coverage area is computed, it may optionally be " - "rounded up to the next sizeable unit before placing the " - "texture within the palette. This helps reduce constant " - "repalettization caused by slight differences in coverage " - "between egg files. For instance, say file a.egg references a " - "texture with a coverage of 0.91, and then later file b.egg " - "is discovered to reference the same texture with a coverage of " - "0.92. If the texture was already palettized with the original " - "coverage of 0.91, it must now be moved in the palette.\n\n" + "When the coverage area is computed, it may optionally be " + "rounded up to the next sizeable unit before placing the " + "texture within the palette. This helps reduce constant " + "repalettization caused by slight differences in coverage " + "between egg files. For instance, say file a.egg references a " + "texture with a coverage of 0.91, and then later file b.egg " + "is discovered to reference the same texture with a coverage of " + "0.92. If the texture was already palettized with the original " + "coverage of 0.91, it must now be moved in the palette.\n\n" - "Rounding the coverage area up to some fixed unit reduces this " - "problem. For instance, if you specified a value 0.5 for " - "fraction in the above command, it would round both of these " - "values up to the next half-unit, or 1.0.\n\n" + "Rounding the coverage area up to some fixed unit reduces this " + "problem. For instance, if you specified a value 0.5 for " + "fraction in the above command, it would round both of these " + "values up to the next half-unit, or 1.0.\n\n" - "The second number is a fuzz factor, and should be a small " - "number; if the coverage area is just slightly larger than " - "the last unit (within the fuzz factor), it is rounded down " - "instead of up. This is intended to prevent UV coordinates " - "that are just slightly out of the range [0, 1] (which happens " - "fairly often) from forcing the palettization area all the " - "way up to the next stop.\n\n" + "The second number is a fuzz factor, and should be a small " + "number; if the coverage area is just slightly larger than " + "the last unit (within the fuzz factor), it is rounded down " + "instead of up. This is intended to prevent UV coordinates " + "that are just slightly out of the range [0, 1] (which happens " + "fairly often) from forcing the palettization area all the " + "way up to the next stop.\n\n" - "The default if this is unspecified is 0.1 0.01. That is, " - "round up to the next tenth, unless within a hundredth of the " - "last tenth. To disable rounding, specify ':round no'. " - "Rounding is implicitly disabled when you run with the -opt " - "command line option.\n\n"); + "The default if this is unspecified is 0.1 0.01. That is, " + "round up to the next tenth, unless within a hundredth of the " + "last tenth. To disable rounding, specify ':round no'. " + "Rounding is implicitly disabled when you run with the -opt " + "command line option.\n\n"); show_text(" :remap (never | group | poly)", 10, - "Sometimes two different parts of an egg file may reference " - "different regions of a repeating texture. For instance, " - "group A may reference UV coordinate values ranging from (0,5) " - "to (1,6), for a coverage of 1.0, while group B references " - "values ranging from (0,2) to (1,4), for a coverage of 2.0. " - "The maximum coverage used is only 2.0, and thus the texture " - "only needs to appear in the palette twice, but the total range " - "of UV's is from (0,2) to (1,6), causing an apparent coverage " - "of 4.0.\n\n" + "Sometimes two different parts of an egg file may reference " + "different regions of a repeating texture. For instance, " + "group A may reference UV coordinate values ranging from (0,5) " + "to (1,6), for a coverage of 1.0, while group B references " + "values ranging from (0,2) to (1,4), for a coverage of 2.0. " + "The maximum coverage used is only 2.0, and thus the texture " + "only needs to appear in the palette twice, but the total range " + "of UV's is from (0,2) to (1,6), causing an apparent coverage " + "of 4.0.\n\n" - "It's possible for egg-palettize to reduce this kind of mistake " - "by remapping both groups of UV's so that they overlap. This " - "parameter specifies how this operation should be done. If " - "the option is 'never', remapping will not be performed; if " - "'group', entire groups will be remapped as a unit, if 'poly', " - "individual polygons within a group may be remapped. This last " - "option provides the greatest minimization of UV coverage, " - "but possibly at the expense of triangle strips in the resulting " - "model (since some vertices can no longer be shared).\n\n" + "It's possible for egg-palettize to reduce this kind of mistake " + "by remapping both groups of UV's so that they overlap. This " + "parameter specifies how this operation should be done. If " + "the option is 'never', remapping will not be performed; if " + "'group', entire groups will be remapped as a unit, if 'poly', " + "individual polygons within a group may be remapped. This last " + "option provides the greatest minimization of UV coverage, " + "but possibly at the expense of triangle strips in the resulting " + "model (since some vertices can no longer be shared).\n\n" - "Sometimes, it may be necessary to be more restrictive on " - "character geometry than on non-character geometry, because " - "the cost of adding additional vertices on characters is " - "greater. You can specify a different kind of remapping for " - "characters only, by using the keyword 'char' on the same line, " - "e.g. ':remap group char never'.\n\n" + "Sometimes, it may be necessary to be more restrictive on " + "character geometry than on non-character geometry, because " + "the cost of adding additional vertices on characters is " + "greater. You can specify a different kind of remapping for " + "characters only, by using the keyword 'char' on the same line, " + "e.g. ':remap group char never'.\n\n" - "The default remap mode for all geometry, character or otherwise, " - "if no remap mode is specified is 'poly'.\n\n"); + "The default remap mode for all geometry, character or otherwise, " + "if no remap mode is specified is 'poly'.\n\n"); show_text(" :imagetype type[,alpha_type]", 10, - "This specifies the default type of image file that should be " - "generated for each palette image and for each unplaced texture " - "copied into the install directory. This may be overridden for " - "a particular texture by specifying the image type on the " - "texture line.\n\n" + "This specifies the default type of image file that should be " + "generated for each palette image and for each unplaced texture " + "copied into the install directory. This may be overridden for " + "a particular texture by specifying the image type on the " + "texture line.\n\n" - "If two image type names separate by a comma are given, it means " - "to generate a second file of the second type for the alpha " - "channel, for images that require an alpha channel. This allows " - "support for image file formats that do not support alpha " - "(for instance, JPEG).\n\n"); + "If two image type names separate by a comma are given, it means " + "to generate a second file of the second type for the alpha " + "channel, for images that require an alpha channel. This allows " + "support for image file formats that do not support alpha " + "(for instance, JPEG).\n\n"); show_text(" :shadowtype type[,alpha_type]", 10, - "When generating palette images, egg-palettize sometimes has to " - "read and write the same palette image repeatedly. If the " - "palette image is stored in a lossy file format (like JPEG, see " - ":imagetype), this can eventually lead to degradation of the " - "palette images. As a workaround, egg-palettize can store " - "its working copies of the palette images in lossless shadow " - "images. Specify this to enable this feature; give it the " - "name of a lossless image file format. The shadow images will " - "be written to the directory specified by -ds on the command " - "line.\n\n"); + "When generating palette images, egg-palettize sometimes has to " + "read and write the same palette image repeatedly. If the " + "palette image is stored in a lossy file format (like JPEG, see " + ":imagetype), this can eventually lead to degradation of the " + "palette images. As a workaround, egg-palettize can store " + "its working copies of the palette images in lossless shadow " + "images. Specify this to enable this feature; give it the " + "name of a lossless image file format. The shadow images will " + "be written to the directory specified by -ds on the command " + "line.\n\n"); show_text(" :group groupname [dir dirname] [with group1 group2 ...]", 10, - "This defines a palette group, a logical division of textures. " - "Each texture is assigned to one or more palette groups before " - "being placed in any palette image; the palette images are " - "tied to the groups.\n\n" + "This defines a palette group, a logical division of textures. " + "Each texture is assigned to one or more palette groups before " + "being placed in any palette image; the palette images are " + "tied to the groups.\n\n" - "The optional parameter 'dir' specifies a directory name to " - "associate with this group. This name is substituted in for " - "the string '%g' when it appears in the map directory name " - "specified on the command line with -dm; this may be used to " - "install textures and palettes into different directories based " - "on the groups they are assigned to.\n\n" + "The optional parameter 'dir' specifies a directory name to " + "associate with this group. This name is substituted in for " + "the string '%g' when it appears in the map directory name " + "specified on the command line with -dm; this may be used to " + "install textures and palettes into different directories based " + "on the groups they are assigned to.\n\n" - "Palette groups can also be hierarchically related. The " - "keyword 'with' specifies any number of groups that this " - "palette group depends on; if a texture has already been " - "assigned to one of this group's dependent groups, it will " - "not need to be assigned to this group.\n\n"); + "Palette groups can also be hierarchically related. The " + "keyword 'with' specifies any number of groups that this " + "palette group depends on; if a texture has already been " + "assigned to one of this group's dependent groups, it will " + "not need to be assigned to this group.\n\n"); nout << @@ -490,7 +490,7 @@ run() { if (!_txa_filename.exists()) { nout << FilenameUnifier::make_user_filename(_txa_filename) - << " does not exist; cannot run.\n"; + << " does not exist; cannot run.\n"; exit(1); } @@ -503,7 +503,7 @@ run() { if (!state_filename.exists()) { nout << FilenameUnifier::make_user_filename(state_filename) - << " does not exist; starting palettization from scratch.\n"; + << " does not exist; starting palettization from scratch.\n"; pal = new Palettizer; } else { @@ -511,28 +511,28 @@ run() { // previously. This will recover all of the state saved from the // past session. nout << "Reading " << FilenameUnifier::make_user_filename(state_filename) - << "\n"; + << "\n"; if (!state_file.open_read(state_filename)) { nout << FilenameUnifier::make_user_filename(state_filename) - << " exists, but cannot be read. Perhaps you should " - << "remove it so a new one can be created.\n"; + << " exists, but cannot be read. Perhaps you should " + << "remove it so a new one can be created.\n"; exit(1); } TypedWritable *obj = state_file.read_object(); if (obj == (TypedWritable *)NULL || !state_file.resolve()) { nout << FilenameUnifier::make_user_filename(state_filename) - << " exists, but appears to be corrupt. Perhaps you " - << "should remove it so a new one can be created.\n"; + << " exists, but appears to be corrupt. Perhaps you " + << "should remove it so a new one can be created.\n"; exit(1); } if (!obj->is_of_type(Palettizer::get_class_type())) { nout << FilenameUnifier::make_user_filename(state_filename) - << " exists, but does not appear to be " - << "an egg-palettize output file. Perhaps you " - << "should remove it so a new one can be created.\n"; + << " exists, but does not appear to be " + << "an egg-palettize output file. Perhaps you " + << "should remove it so a new one can be created.\n"; exit(1); } @@ -652,8 +652,8 @@ run() { if (!state_file.open_write(temp_filename) || !state_file.write_object(pal)) { nout << "Unable to write palettization information to " - << FilenameUnifier::make_user_filename(temp_filename) - << "\n"; + << FilenameUnifier::make_user_filename(temp_filename) + << "\n"; exit(1); } @@ -661,8 +661,8 @@ run() { state_filename.unlink(); if (!temp_filename.rename_to(state_filename)) { nout << "Unable to rename temporary file " - << FilenameUnifier::make_user_filename(temp_filename) << " to " - << FilenameUnifier::make_user_filename(state_filename) << "\n"; + << FilenameUnifier::make_user_filename(temp_filename) << " to " + << FilenameUnifier::make_user_filename(state_filename) << "\n"; exit(1); } diff --git a/pandatool/src/egg-palettize/eggPalettize.h b/pandatool/src/egg-palettize/eggPalettize.h index b65c6d0cfb..f74237a776 100644 --- a/pandatool/src/egg-palettize/eggPalettize.h +++ b/pandatool/src/egg-palettize/eggPalettize.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggPalettize +// Class : EggPalettize // Description : This is the program wrapper for egg-palettize, but it // mainly serves to read in all the command-line // parameters and then invoke the Palettizer. diff --git a/pandatool/src/egg-palettize/filenameUnifier.h b/pandatool/src/egg-palettize/filenameUnifier.h index a7db57aafd..200cc61a64 100644 --- a/pandatool/src/egg-palettize/filenameUnifier.h +++ b/pandatool/src/egg-palettize/filenameUnifier.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FilenameUnifier +// Class : FilenameUnifier // Description : This static class does the job of converting // filenames from relative to absolute to canonical or // whatever is appropriate. Its main purpose is to diff --git a/pandatool/src/egg-palettize/imageFile.cxx b/pandatool/src/egg-palettize/imageFile.cxx index 4d552f15d3..db4f855caa 100644 --- a/pandatool/src/egg-palettize/imageFile.cxx +++ b/pandatool/src/egg-palettize/imageFile.cxx @@ -149,14 +149,14 @@ set_filename(PaletteGroup *group, const string &basename) { ++pi; switch (*pi) { case '%': - dirname += '%'; - break; + dirname += '%'; + break; case 'g': - if (group != (PaletteGroup *)NULL) { - dirname += group->get_dirname(); - } - break; + if (group != (PaletteGroup *)NULL) { + dirname += group->get_dirname(); + } + break; } } else { dirname += *pi; @@ -265,14 +265,14 @@ read(PNMImage &image) const { return false; } if (image.get_x_size() != alpha_image.get_x_size() || - image.get_y_size() != alpha_image.get_y_size()) { + image.get_y_size() != alpha_image.get_y_size()) { return false; } image.add_alpha(); for (int y = 0; y < image.get_y_size(); y++) { for (int x = 0; x < image.get_x_size(); x++) { - image.set_alpha(x, y, alpha_image.get_gray(x, y)); + image.set_alpha(x, y, alpha_image.get_gray(x, y)); } } } @@ -308,7 +308,7 @@ write(const PNMImage &image) const { // Write out a separate color image and an alpha channel image. PNMImage alpha_image(image.get_x_size(), image.get_y_size(), 1, - image.get_maxval()); + image.get_maxval()); for (int y = 0; y < image.get_y_size(); y++) { for (int x = 0; x < image.get_x_size(); x++) { alpha_image.set_gray_val(x, y, image.get_alpha_val(x, y)); diff --git a/pandatool/src/egg-palettize/imageFile.h b/pandatool/src/egg-palettize/imageFile.h index b772781569..3ec783d2c5 100644 --- a/pandatool/src/egg-palettize/imageFile.h +++ b/pandatool/src/egg-palettize/imageFile.h @@ -18,7 +18,7 @@ class EggTexture; class PaletteGroup; //////////////////////////////////////////////////////////////////// -// Class : ImageFile +// Class : ImageFile // Description : This is the base class of both TextureImage and // PaletteImage. It encapsulates all the information // specific to an image file that can be assigned as a @@ -75,7 +75,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "ImageFile", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/omitReason.h b/pandatool/src/egg-palettize/omitReason.h index a0e14629c9..4f52a5afea 100644 --- a/pandatool/src/egg-palettize/omitReason.h +++ b/pandatool/src/egg-palettize/omitReason.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Enum : OmitReason +// Enum : OmitReason // Description : This enumerates the reasons why a texture may not // have been placed in a palette image. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/egg-palettize/pal_string_utils.cxx b/pandatool/src/egg-palettize/pal_string_utils.cxx index c5c832f647..0691acab75 100644 --- a/pandatool/src/egg-palettize/pal_string_utils.cxx +++ b/pandatool/src/egg-palettize/pal_string_utils.cxx @@ -41,7 +41,7 @@ extract_param_value(const string &str, string ¶m, string &value) { bool parse_image_type_request(const string &word, PNMFileType *&color_type, - PNMFileType *&alpha_type) { + PNMFileType *&alpha_type) { PNMFileTypeRegistry *registry = PNMFileTypeRegistry::get_ptr(); color_type = (PNMFileType *)NULL; alpha_type = (PNMFileType *)NULL; diff --git a/pandatool/src/egg-palettize/pal_string_utils.h b/pandatool/src/egg-palettize/pal_string_utils.h index 97f04128b6..f3215a0871 100644 --- a/pandatool/src/egg-palettize/pal_string_utils.h +++ b/pandatool/src/egg-palettize/pal_string_utils.h @@ -14,7 +14,7 @@ class PNMFileType; void extract_param_value(const string &str, string ¶m, string &value); bool parse_image_type_request(const string &word, PNMFileType *&color_type, - PNMFileType *&alpha_type); + PNMFileType *&alpha_type); #endif diff --git a/pandatool/src/egg-palettize/paletteGroup.cxx b/pandatool/src/egg-palettize/paletteGroup.cxx index b833ab2e86..cadece78cb 100644 --- a/pandatool/src/egg-palettize/paletteGroup.cxx +++ b/pandatool/src/egg-palettize/paletteGroup.cxx @@ -216,14 +216,14 @@ set_dependency_order() { if (_dirname == group->get_dirname()) { // The dirname orders should be equal. if (_dirname_order < group->get_dirname_order()) { - _dirname_order = group->get_dirname_order(); - any_changed = true; + _dirname_order = group->get_dirname_order(); + any_changed = true; } } else { // The dirname orders should be different. if (_dirname_order <= group->get_dirname_order()) { - _dirname_order = group->get_dirname_order() + 1; - any_changed = true; + _dirname_order = group->get_dirname_order() + 1; + any_changed = true; } } } @@ -451,20 +451,20 @@ write_image_info(ostream &out, int indent_level) const { TexturePlacement *placement = (*pli); if (placement->get_omit_reason() != OR_none) { indent(out, indent_level) - << placement->get_texture()->get_name() - << " unplaced because "; + << placement->get_texture()->get_name() + << " unplaced because "; switch (placement->get_omit_reason()) { case OR_coverage: - out << "coverage (" << placement->get_uv_area() << ")"; - break; + out << "coverage (" << placement->get_uv_area() << ")"; + break; case OR_size: - out << "size (" << placement->get_x_size() << " " - << placement->get_y_size() << ")"; - break; + out << "size (" << placement->get_x_size() << " " + << placement->get_y_size() << ")"; + break; default: - out << placement->get_omit_reason(); + out << placement->get_omit_reason(); } out << "\n"; } diff --git a/pandatool/src/egg-palettize/paletteGroup.h b/pandatool/src/egg-palettize/paletteGroup.h index 1e760bbbb0..2847933ff3 100644 --- a/pandatool/src/egg-palettize/paletteGroup.h +++ b/pandatool/src/egg-palettize/paletteGroup.h @@ -23,7 +23,7 @@ class PalettePage; class TextureImage; //////////////////////////////////////////////////////////////////// -// Class : PaletteGroup +// Class : PaletteGroup // Description : This is the highest level of grouping for // TextureImages. Textures are assigned to one or // several PaletteGroups based on the information in the @@ -94,7 +94,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); virtual void finalize(); protected: @@ -116,8 +116,8 @@ public: TypedWritable::init_type(); Namable::init_type(); register_type(_type_handle, "PaletteGroup", - TypedWritable::get_class_type(), - Namable::get_class_type()); + TypedWritable::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/paletteGroups.cxx b/pandatool/src/egg-palettize/paletteGroups.cxx index b30988f667..10b58ec95c 100644 --- a/pandatool/src/egg-palettize/paletteGroups.cxx +++ b/pandatool/src/egg-palettize/paletteGroups.cxx @@ -238,8 +238,8 @@ r_make_complete(PaletteGroups::Groups &result, PaletteGroup *group) { if (inserted) { Groups::const_iterator gi; for (gi = group->_dependent._groups.begin(); - gi != group->_dependent._groups.end(); - ++gi) { + gi != group->_dependent._groups.end(); + ++gi) { r_make_complete(result, *gi); } } diff --git a/pandatool/src/egg-palettize/paletteGroups.h b/pandatool/src/egg-palettize/paletteGroups.h index 5def482d98..58646f45cd 100644 --- a/pandatool/src/egg-palettize/paletteGroups.h +++ b/pandatool/src/egg-palettize/paletteGroups.h @@ -15,7 +15,7 @@ class PaletteGroup; //////////////////////////////////////////////////////////////////// -// Class : PaletteGroups +// Class : PaletteGroups // Description : A set of PaletteGroups. This presents an interface // very like an STL set, with a few additional // functions. @@ -65,7 +65,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_PaletteGroups(const FactoryParams ¶ms); @@ -85,7 +85,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "PaletteGroups", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/paletteImage.cxx b/pandatool/src/egg-palettize/paletteImage.cxx index 709fdb3595..b80ce54b07 100644 --- a/pandatool/src/egg-palettize/paletteImage.cxx +++ b/pandatool/src/egg-palettize/paletteImage.cxx @@ -91,7 +91,7 @@ clear(PNMImage &image) { if (image.has_alpha()) { for (int y = _y; y < _y + _y_size; y++) { for (int x = _x; x < _x + _x_size; x++) { - image.set_alpha_val(x, y, 0); + image.set_alpha_val(x, y, 0); } } } @@ -326,7 +326,7 @@ check_solitary() { // How sad, only one. TexturePlacement *placement = *_placements.begin(); nassertv(placement->get_omit_reason() == OR_none || - placement->get_omit_reason() == OR_solitary); + placement->get_omit_reason() == OR_solitary); if (pal->_omit_solitary || placement->get_omit_reason() == OR_solitary) { // We only omit the solitary texture if (a) we have @@ -342,7 +342,7 @@ check_solitary() { for (pi = _placements.begin(); pi != _placements.end(); ++pi) { TexturePlacement *placement = (*pi); nassertv(placement->get_omit_reason() == OR_none || - placement->get_omit_reason() == OR_solitary); + placement->get_omit_reason() == OR_solitary); placement->not_solitary(); } } @@ -379,8 +379,8 @@ optimal_resize() { if (resized_any) { nout << "Resizing " - << FilenameUnifier::make_user_filename(get_filename()) << " to " - << _x_size << " " << _y_size << "\n"; + << FilenameUnifier::make_user_filename(get_filename()) << " to " + << _x_size << " " << _y_size << "\n"; } } @@ -445,7 +445,7 @@ resize_image(int x_size, int y_size) { bool all_packed = true; for (pi = saved.begin(); pi != saved.end(); ++pi) { if (!place(*pi)) { - all_packed = false; + all_packed = false; } } nassertr(all_packed, false); @@ -542,14 +542,14 @@ update_image(bool redo_all) { } else { SourceTextureImage *source = - placement->get_texture()->get_preferred_source(); + placement->get_texture()->get_preferred_source(); if (source != (SourceTextureImage *)NULL && - source->get_filename().compare_timestamps(get_filename()) > 0) { - // The source image is newer than the palette image; we need to - // regenerate. - placement->mark_unfilled(); - needs_update = true; + source->get_filename().compare_timestamps(get_filename()) > 0) { + // The source image is newer than the palette image; we need to + // regenerate. + placement->mark_unfilled(); + needs_update = true; } } } @@ -607,8 +607,8 @@ find_hole(int &x, int &y, int x_size, int y_size) const { TexturePlacement *overlap = find_overlap(x, y, x_size, y_size); if (overlap == (TexturePlacement *)NULL) { - // Hooray! - return true; + // Hooray! + return true; } next_x = overlap->get_placed_x() + overlap->get_placed_x_size(); @@ -642,7 +642,7 @@ find_overlap(int x, int y, int x_size, int y_size) const { for (pi = _placements.begin(); pi != _placements.end(); ++pi) { TexturePlacement *placement = (*pi); if (placement->is_placed() && - placement->intersects(x, y, x_size, y_size)) { + placement->intersects(x, y, x_size, y_size)) { return placement; } } @@ -665,13 +665,13 @@ get_image() { if (!_new_image) { if (pal->_shadow_color_type != (PNMFileType *)NULL) { if (_shadow_image.read(_image)) { - _got_image = true; - return; + _got_image = true; + return; } } else { if (read(_image)) { - _got_image = true; - return; + _got_image = true; + return; } } } diff --git a/pandatool/src/egg-palettize/paletteImage.h b/pandatool/src/egg-palettize/paletteImage.h index a28aa346ad..62728f985e 100644 --- a/pandatool/src/egg-palettize/paletteImage.h +++ b/pandatool/src/egg-palettize/paletteImage.h @@ -16,7 +16,7 @@ class PalettePage; class TexturePlacement; //////////////////////////////////////////////////////////////////// -// Class : PaletteImage +// Class : PaletteImage // Description : This is a single palette image, one of several within // a PalettePage, which is in turn one of several pages // within a PaletteGroup. Each palette image is a @@ -94,7 +94,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_PaletteImage(const FactoryParams ¶ms); @@ -112,7 +112,7 @@ public: static void init_type() { ImageFile::init_type(); register_type(_type_handle, "PaletteImage", - ImageFile::get_class_type()); + ImageFile::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/palettePage.h b/pandatool/src/egg-palettize/palettePage.h index 098046b548..fdf0af3776 100644 --- a/pandatool/src/egg-palettize/palettePage.h +++ b/pandatool/src/egg-palettize/palettePage.h @@ -18,7 +18,7 @@ class PaletteImage; class TexturePlacement; //////////////////////////////////////////////////////////////////// -// Class : PalettePage +// Class : PalettePage // Description : This is a particular collection of textures, within a // PaletteGroup, that all share the same // TextureProperties. The textures on the same page may @@ -61,7 +61,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_PalettePage(const FactoryParams ¶ms); @@ -80,8 +80,8 @@ public: TypedWritable::init_type(); Namable::init_type(); register_type(_type_handle, "PalettePage", - TypedWritable::get_class_type(), - Namable::get_class_type()); + TypedWritable::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/palettizer.cxx b/pandatool/src/egg-palettize/palettizer.cxx index dd3c404803..df5ee5a2a6 100644 --- a/pandatool/src/egg-palettize/palettizer.cxx +++ b/pandatool/src/egg-palettize/palettizer.cxx @@ -135,14 +135,14 @@ report_pi() const { << " round UV area: " << yesno(_round_uvs) << "\n"; if (_round_uvs) { cout << " round UV area to nearest " << _round_unit << " with fuzz " - << _round_fuzz << "\n"; + << _round_fuzz << "\n"; } cout << " remap UV's: " << _remap_uv << "\n" << " remap UV's for characters: " << _remap_char_uv << "\n"; if (_color_type != (PNMFileType *)NULL) { cout << " generate image files of type: " - << _color_type->get_suggested_extension(); + << _color_type->get_suggested_extension(); if (_alpha_type != (PNMFileType *)NULL) { cout << "," << _alpha_type->get_suggested_extension(); } @@ -151,7 +151,7 @@ report_pi() const { if (_shadow_color_type != (PNMFileType *)NULL) { cout << " generate shadow palette files of type: " - << _shadow_color_type->get_suggested_extension(); + << _shadow_color_type->get_suggested_extension(); if (_shadow_alpha_type != (PNMFileType *)NULL) { cout << "," << _shadow_alpha_type->get_suggested_extension(); } @@ -194,9 +194,9 @@ report_pi() const { cout << "\n"; } cout << " " << group->get_name() << " (" - << group->get_dirname_order() << "," - << group->get_dependency_order() << "): " - << group->get_groups() << "\n"; + << group->get_dirname_order() << "," + << group->get_dependency_order() << "): " + << group->get_groups() << "\n"; group->write_image_info(cout, 4); } @@ -263,13 +263,13 @@ report_statistics() const { complete.make_complete(group->get_groups()); if (complete.size() > 1) { - Placements complete_placements; - group->get_complete_placements(complete_placements); - if (complete_placements.size() != placements.size()) { - cout << "\n" << group->get_name() - << ", with dependents (" << complete << "):\n"; - compute_statistics(cout, 2, complete_placements); - } + Placements complete_placements; + group->get_complete_placements(complete_placements); + if (complete_placements.size() != placements.size()) { + cout << "\n" << group->get_name() + << ", with dependents (" << complete << "):\n"; + compute_statistics(cout, 2, complete_placements); + } } } } @@ -307,7 +307,7 @@ read_txa_file(const Filename &txa_filename) { if (_color_type == (PNMFileType *)NULL) { nout << "No valid output image file type available; cannot run.\n" - << "Use :imagetype command in .txa file.\n"; + << "Use :imagetype command in .txa file.\n"; exit(1); } @@ -329,7 +329,7 @@ read_txa_file(const Filename &txa_filename) { for (gi = _groups.begin(); gi != _groups.end(); ++gi) { PaletteGroup *group = (*gi).second; if (group->set_dependency_order()) { - any_changed = true; + any_changed = true; } } } while (any_changed); @@ -604,13 +604,13 @@ read_stale_eggs(bool redo_all) { for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) { EggFile *egg_file = (*ei).second; if (!egg_file->has_data() && - (egg_file->is_stale() || redo_all)) { + (egg_file->is_stale() || redo_all)) { if (!egg_file->read_egg()) { - okflag = false; + okflag = false; } else { - egg_file->scan_textures(); - egg_file->choose_placements(); + egg_file->scan_textures(); + egg_file->choose_placements(); } } } @@ -635,7 +635,7 @@ write_eggs() { if (egg_file->has_data()) { egg_file->update_egg(); if (!egg_file->write_egg()) { - okflag = false; + okflag = false; } } } @@ -802,7 +802,7 @@ string_remap(const string &str) { //////////////////////////////////////////////////////////////////// void Palettizer:: compute_statistics(ostream &out, int indent_level, - const Palettizer::Placements &placements) const { + const Palettizer::Placements &placements) const { TextureMemoryCounter counter; Placements::const_iterator pi; diff --git a/pandatool/src/egg-palettize/palettizer.h b/pandatool/src/egg-palettize/palettizer.h index 47e86eb153..12763609ce 100644 --- a/pandatool/src/egg-palettize/palettizer.h +++ b/pandatool/src/egg-palettize/palettizer.h @@ -23,7 +23,7 @@ class TextureImage; class TexturePlacement; //////////////////////////////////////////////////////////////////// -// Class : Palettizer +// Class : Palettizer // Description : This is the main engine behind egg-palettize. It // contains all of the program parameters, from the // command line or saved from a previous session, and @@ -101,7 +101,7 @@ public: private: typedef vector Placements; void compute_statistics(ostream &out, int indent_level, - const Placements &placements) const; + const Placements &placements) const; typedef map EggFiles; EggFiles _egg_files; @@ -124,7 +124,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_Palettizer(const FactoryParams ¶ms); @@ -144,7 +144,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "Palettizer", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/sourceTextureImage.cxx b/pandatool/src/egg-palettize/sourceTextureImage.cxx index 71cf5ef168..dac4139177 100644 --- a/pandatool/src/egg-palettize/sourceTextureImage.cxx +++ b/pandatool/src/egg-palettize/sourceTextureImage.cxx @@ -37,7 +37,7 @@ SourceTextureImage() { //////////////////////////////////////////////////////////////////// SourceTextureImage:: SourceTextureImage(TextureImage *texture, const Filename &filename, - const Filename &alpha_filename) : + const Filename &alpha_filename) : _texture(texture) { _filename = filename; diff --git a/pandatool/src/egg-palettize/sourceTextureImage.h b/pandatool/src/egg-palettize/sourceTextureImage.h index 63f048496c..800bf086c6 100644 --- a/pandatool/src/egg-palettize/sourceTextureImage.h +++ b/pandatool/src/egg-palettize/sourceTextureImage.h @@ -13,7 +13,7 @@ class TextureImage; //////////////////////////////////////////////////////////////////// -// Class : SourceTextureImage +// Class : SourceTextureImage // Description : This is a texture image reference as it appears in an // egg file: the source image of the texture. //////////////////////////////////////////////////////////////////// @@ -23,7 +23,7 @@ private: public: SourceTextureImage(TextureImage *texture, const Filename &filename, - const Filename &alpha_filename); + const Filename &alpha_filename); TextureImage *get_texture() const; @@ -44,7 +44,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_SourceTextureImage(const FactoryParams ¶ms); @@ -57,7 +57,7 @@ public: static void init_type() { ImageFile::init_type(); register_type(_type_handle, "SourceTextureImage", - ImageFile::get_class_type()); + ImageFile::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/textureImage.cxx b/pandatool/src/egg-palettize/textureImage.cxx index 24ab1f0e9a..db224994cf 100644 --- a/pandatool/src/egg-palettize/textureImage.cxx +++ b/pandatool/src/egg-palettize/textureImage.cxx @@ -89,20 +89,20 @@ assign_groups() { PaletteGroups intersect; intersect.make_intersection(_explicitly_assigned_groups, (*ei)->get_complete_groups()); if (!intersect.empty()) { - // This egg file is satisfied by one of the texture's explicit - // assignments. + // This egg file is satisfied by one of the texture's explicit + // assignments. - // We must use at least one of the explicitly-assigned groups - // that satisfied the egg file. We don't need to use all of - // them, however, and we choose the first one arbitrarily. - definitely_in.insert(*intersect.begin()); + // We must use at least one of the explicitly-assigned groups + // that satisfied the egg file. We don't need to use all of + // them, however, and we choose the first one arbitrarily. + definitely_in.insert(*intersect.begin()); } else { - // This egg file was not satisfied by any of the texture's - // explicit assignments. Therefore, we'll need to choose some - // additional group to assign the texture to, to make the egg - // file happy. Defer this a bit. - needed_eggs.push_back(*ei); + // This egg file was not satisfied by any of the texture's + // explicit assignments. Therefore, we'll need to choose some + // additional group to assign the texture to, to make the egg + // file happy. Defer this a bit. + needed_eggs.push_back(*ei); } } } @@ -134,15 +134,15 @@ assign_groups() { bool prefer_group = false; int group_egg_count = compute_egg_count(group, needed_eggs); if (group_egg_count != best_egg_count) { - prefer_group = (group_egg_count > best_egg_count); + prefer_group = (group_egg_count > best_egg_count); } else { - prefer_group = group->is_preferred_over(*best); + prefer_group = group->is_preferred_over(*best); } if (prefer_group) { - best = group; - best_egg_count = group_egg_count; + best = group; + best_egg_count = group_egg_count; } ++gi; } @@ -154,8 +154,8 @@ assign_groups() { WorkingEggs next_needed_eggs; for (ei = needed_eggs.begin(); ei != needed_eggs.end(); ++ei) { if ((*ei)->get_complete_groups().count(best) == 0) { - // This one wasn't eliminated. - next_needed_eggs.push_back(*ei); + // This one wasn't eliminated. + next_needed_eggs.push_back(*ei); } } needed_eggs.swap(next_needed_eggs); @@ -474,22 +474,22 @@ get_preferred_source() { // Rule (1) passes. if (source->exists() && source->get_size()) { - int source_size = source->get_x_size() * source->get_y_size(); - if (best == (SourceTextureImage *)NULL) { - best = source; - best_size = source_size; + int source_size = source->get_x_size() * source->get_y_size(); + if (best == (SourceTextureImage *)NULL) { + best = source; + best_size = source_size; - } else if (source_size > best_size) { - // Rule (2) passes. - best = source; - best_size = source_size; + } else if (source_size > best_size) { + // Rule (2) passes. + best = source; + best_size = source_size; - } else if (source_size == best_size && - source->get_filename().compare_timestamps(best->get_filename()) > 0) { - // Rule (3) passes. - best = source; - best_size = source_size; - } + } else if (source_size == best_size && + source->get_filename().compare_timestamps(best->get_filename()) > 0) { + // Rule (3) passes. + best = source; + best_size = source_size; + } } } } @@ -536,12 +536,12 @@ copy_unplaced(bool redo_all) { filename.make_canonical(); pair insert_result = generate.insert - (Dests::value_type(filename, dest)); + (Dests::value_type(filename, dest)); if (!insert_result.second) { - // At least two DestTextureImages map to the same filename, no - // sweat. - delete dest; - dest = (*insert_result.first).second; + // At least two DestTextureImages map to the same filename, no + // sweat. + delete dest; + dest = (*insert_result.first).second; } placement->set_dest(dest); @@ -628,15 +628,15 @@ write_source_pathnames(ostream &out, int indent_level) const { indent(out, indent_level); source->output_filename(out); if (!source->is_size_known()) { - out << " (unknown size)"; - + out << " (unknown size)"; + } else { - out << " " << source->get_x_size() << " " - << source->get_y_size(); - - if (source->get_properties().has_num_channels()) { - out << " " << source->get_properties().get_num_channels(); - } + out << " " << source->get_x_size() << " " + << source->get_y_size(); + + if (source->get_properties().has_num_channels()) { + out << " " << source->get_properties().get_num_channels(); + } } out << "\n"; } @@ -650,7 +650,7 @@ write_source_pathnames(ostream &out, int indent_level) const { for (ei = _egg_files.begin(); ei != _egg_files.end(); ++ei) { EggFile *egg = (*ei); indent(out, indent_level + 2) - << egg->get_name() << " ("; + << egg->get_name() << " ("; if (egg->get_explicit_groups().empty()) { out << *egg->get_default_group(); } else { @@ -707,18 +707,18 @@ write_scale_info(ostream &out, int indent_level) { out << "unknown"; } else { out << source->get_x_size() << " " << source->get_y_size() - << " " << source->get_num_channels(); + << " " << source->get_num_channels(); } if (!_placement.empty()) { out << " new " << get_x_size() << " " << get_y_size() - << " " << get_num_channels(); + << " " << get_num_channels(); if (source != (SourceTextureImage *)NULL && - source->is_size_known()) { + source->is_size_known()) { double scale = - 100.0 * (((double)get_x_size() / (double)source->get_x_size()) + - ((double)get_y_size() / (double)source->get_y_size())) / 2.0; + 100.0 * (((double)get_x_size() / (double)source->get_x_size()) + + ((double)get_y_size() / (double)source->get_y_size())) / 2.0; out << " scale " << scale << "%"; } } @@ -732,26 +732,26 @@ write_scale_info(ostream &out, int indent_level) { PaletteImage *image = placement->get_image(); nassertv(image != (PaletteImage *)NULL); indent(out, indent_level + 2) - << "placed on " - << FilenameUnifier::make_user_filename(image->get_filename()) - << "\n"; + << "placed on " + << FilenameUnifier::make_user_filename(image->get_filename()) + << "\n"; } else { DestTextureImage *image = placement->get_dest(); nassertv(image != (DestTextureImage *)NULL); indent(out, indent_level + 2) - << "copied to " - << FilenameUnifier::make_user_filename(image->get_filename()); + << "copied to " + << FilenameUnifier::make_user_filename(image->get_filename()); if (image->get_x_size() != get_x_size() || - image->get_y_size() != get_y_size()) { - out << " at size " << image->get_x_size() << " " - << image->get_y_size(); - if (source != (SourceTextureImage *)NULL && - source->is_size_known()) { - double scale = - 100.0 * (((double)image->get_x_size() / (double)source->get_x_size()) + - ((double)image->get_y_size() / (double)source->get_y_size())) / 2.0; - out << " scale " << scale << "%"; - } + image->get_y_size() != get_y_size()) { + out << " at size " << image->get_x_size() << " " + << image->get_y_size(); + if (source != (SourceTextureImage *)NULL && + source->is_size_known()) { + double scale = + 100.0 * (((double)image->get_x_size() / (double)source->get_x_size()) + + ((double)image->get_y_size() / (double)source->get_y_size())) / 2.0; + out << " scale " << scale << "%"; + } } out << "\n"; } @@ -767,7 +767,7 @@ write_scale_info(ostream &out, int indent_level) { //////////////////////////////////////////////////////////////////// int TextureImage:: compute_egg_count(PaletteGroup *group, - const TextureImage::WorkingEggs &egg_files) { + const TextureImage::WorkingEggs &egg_files) { int count = 0; WorkingEggs::const_iterator ei; @@ -809,7 +809,7 @@ assign_to_groups(const PaletteGroups &groups) { // to previously. TexturePlacement *place = a->prepare(this); new_placement.insert - (new_placement.end(), Placement::value_type(a, place)); + (new_placement.end(), Placement::value_type(a, place)); ++gi; } else if (b < a) { @@ -822,7 +822,7 @@ assign_to_groups(const PaletteGroups &groups) { // Here's a group we're still assigned to. TexturePlacement *place = (*pi).second; new_placement.insert - (new_placement.end(), Placement::value_type(a, place)); + (new_placement.end(), Placement::value_type(a, place)); ++gi; ++pi; } @@ -881,9 +881,9 @@ consider_grayscale() { for (int x = 0; x < source.get_x_size(); x++) { const xel &v = source.get_xel_val(x, y); if (PPM_GETR(v) != PPM_GETG(v) || PPM_GETR(v) != PPM_GETB(v)) { - // Here's a colored pixel. We can't go grayscale. - _forced_grayscale = false; - return; + // Here's a colored pixel. We can't go grayscale. + _forced_grayscale = false; + return; } } } @@ -924,9 +924,9 @@ consider_unalpha() { for (int y = 0; y < source.get_y_size(); y++) { for (int x = 0; x < source.get_x_size(); x++) { if (source.get_alpha_val(x, y) != source.get_maxval()) { - // Here's a non-white pixel; the alpha channel is meaningful. - _forced_unalpha = false; - return; + // Here's a non-white pixel; the alpha channel is meaningful. + _forced_unalpha = false; + return; } } } @@ -1125,7 +1125,7 @@ complete_pointers(vector_typedWritable &plist, BamReader *manager) { SourceTextureImage *source; DCAST_INTO_R(source, plist[index], index); string key = get_source_key(source->get_filename(), - source->get_alpha_filename()); + source->get_alpha_filename()); bool inserted = _sources.insert(Sources::value_type(key, source)).second; index++; diff --git a/pandatool/src/egg-palettize/textureImage.h b/pandatool/src/egg-palettize/textureImage.h index 3c01284f74..7eaa6e4e49 100644 --- a/pandatool/src/egg-palettize/textureImage.h +++ b/pandatool/src/egg-palettize/textureImage.h @@ -25,7 +25,7 @@ class TexturePlacement; class EggFile; //////////////////////////////////////////////////////////////////// -// Class : TextureImage +// Class : TextureImage // Description : This represents a single source texture that is // referenced by one or more egg files. It may be // assigned to multiple PaletteGroups, and thus placed @@ -60,7 +60,7 @@ public: bool is_used() const; SourceTextureImage *get_source(const Filename &filename, - const Filename &alpha_filename); + const Filename &alpha_filename); SourceTextureImage *get_preferred_source(); @@ -79,7 +79,7 @@ private: typedef map Dests; static int compute_egg_count(PaletteGroup *group, - const WorkingEggs &egg_files); + const WorkingEggs &egg_files); void assign_to_groups(const PaletteGroups &groups); void consider_grayscale(); @@ -89,7 +89,7 @@ private: void copy_new_dests(const Dests &a, const Dests &b); string get_source_key(const Filename &filename, - const Filename &alpha_filename); + const Filename &alpha_filename); private: TextureRequest _request; @@ -121,7 +121,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_TextureImage(const FactoryParams ¶ms); @@ -142,8 +142,8 @@ public: ImageFile::init_type(); Namable::init_type(); register_type(_type_handle, "TextureImage", - ImageFile::get_class_type(), - Namable::get_class_type()); + ImageFile::get_class_type(), + Namable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/textureMemoryCounter.cxx b/pandatool/src/egg-palettize/textureMemoryCounter.cxx index 5b392ae4d5..494fe80155 100644 --- a/pandatool/src/egg-palettize/textureMemoryCounter.cxx +++ b/pandatool/src/egg-palettize/textureMemoryCounter.cxx @@ -59,7 +59,7 @@ add_placement(TexturePlacement *placement) { add_palette(image); int bytes = count_bytes(image, placement->get_placed_x_size(), - placement->get_placed_y_size()); + placement->get_placed_y_size()); add_texture(texture, bytes); _num_placed++; @@ -94,24 +94,24 @@ report(ostream &out, int indent_level) { if (_unused_bytes != 0) { indent(out, indent_level + 2); format_memory_fraction(out, _unused_bytes, _bytes) - << " is wasted because of unused palette space.\n"; + << " is wasted because of unused palette space.\n"; } if (_coverage_bytes > 0) { indent(out, indent_level + 2); format_memory_fraction(out, _coverage_bytes, _bytes) - << " is wasted for repeating textures and margins.\n"; + << " is wasted for repeating textures and margins.\n"; } else if (_coverage_bytes < 0) { indent(out, indent_level + 2); format_memory_fraction(out, -_coverage_bytes, _bytes) - << " is *saved* for palettizing partial textures.\n"; + << " is *saved* for palettizing partial textures.\n"; } if (_duplicate_bytes != 0) { indent(out, indent_level + 2); format_memory_fraction(out, _duplicate_bytes, _bytes) - << " is wasted because of a texture appearing in multiple groups.\n"; + << " is wasted because of a texture appearing in multiple groups.\n"; } } } diff --git a/pandatool/src/egg-palettize/textureMemoryCounter.h b/pandatool/src/egg-palettize/textureMemoryCounter.h index b6769f446d..bc2fde4a1b 100644 --- a/pandatool/src/egg-palettize/textureMemoryCounter.h +++ b/pandatool/src/egg-palettize/textureMemoryCounter.h @@ -18,7 +18,7 @@ class TexturePlacement; #include //////////////////////////////////////////////////////////////////// -// Class : TextureMemoryCounter +// Class : TextureMemoryCounter // Description : This class is used to gather statistics on texture // memory usage, etc. It adds up the total texture // memory required by a number of image files, and @@ -35,7 +35,7 @@ public: private: static ostream &format_memory_fraction(ostream &out, int fraction_bytes, - int palette_bytes); + int palette_bytes); void add_palette(PaletteImage *image); void add_texture(TextureImage *texture, int bytes); int count_bytes(ImageFile *image); diff --git a/pandatool/src/egg-palettize/texturePlacement.cxx b/pandatool/src/egg-palettize/texturePlacement.cxx index 4f02f38fde..df15eb03be 100644 --- a/pandatool/src/egg-palettize/texturePlacement.cxx +++ b/pandatool/src/egg-palettize/texturePlacement.cxx @@ -239,12 +239,12 @@ determine_size() { const TexCoordd &x = reference->get_max_uv(); if (_has_uvs) { - min_uv.set(min(min_uv[0], n[0]), min(min_uv[1], n[1])); - max_uv.set(max(max_uv[0], x[0]), max(max_uv[1], x[1])); + min_uv.set(min(min_uv[0], n[0]), min(min_uv[1], n[1])); + max_uv.set(max(max_uv[0], x[0]), max(max_uv[1], x[1])); } else { - min_uv = n; - max_uv = x; - _has_uvs = true; + min_uv = n; + max_uv = x; + _has_uvs = true; } } @@ -297,9 +297,9 @@ determine_size() { _omit_reason = OR_coverage; } else if ((_position._x_size > pal->_pal_x_size || - _position._y_size > pal->_pal_y_size) || - (_position._x_size == pal->_pal_x_size && - _position._y_size == pal->_pal_y_size)) { + _position._y_size > pal->_pal_y_size) || + (_position._x_size == pal->_pal_x_size && + _position._y_size == pal->_pal_y_size)) { // If the texture exceeds the size of an empty palette image in // either dimension, or if it exactly equals the size of an empty // palette image in both dimensions, we can't place it because @@ -308,9 +308,9 @@ determine_size() { _omit_reason = OR_size; } else if (_omit_reason == OR_omitted || - _omit_reason == OR_size || - _omit_reason == OR_coverage || - _omit_reason == OR_unknown) { + _omit_reason == OR_size || + _omit_reason == OR_coverage || + _omit_reason == OR_unknown) { // On the other hand, if the texture was previously omitted // explicitly, or because of its size or coverage, now it seems to // fit. @@ -322,11 +322,11 @@ determine_size() { // we leave it where it is? if (_position._x_size != _placed._x_size || - _position._y_size != _placed._y_size || - _position._min_uv[0] < _placed._min_uv[0] || - _position._min_uv[1] < _placed._min_uv[1] || - _position._max_uv[0] > _placed._max_uv[0] || - _position._max_uv[1] > _placed._max_uv[1]) { + _position._y_size != _placed._y_size || + _position._min_uv[0] < _placed._min_uv[0] || + _position._min_uv[1] < _placed._min_uv[1] || + _position._max_uv[0] > _placed._max_uv[0] || + _position._max_uv[1] > _placed._max_uv[1]) { // If the texture was previously placed but is now the wrong // size, or if the area we need to cover is different, we need // to re-place it. @@ -335,26 +335,26 @@ determine_size() { // without rounding up the UV's, then screw rounding it up and // just leave it alone. if (pal->_round_uvs) { - compute_size_from_uvs(min_uv, max_uv); - if (_position._x_size <= _placed._x_size && - _position._y_size <= _placed._y_size && - _position._min_uv[0] >= _placed._min_uv[0] && - _position._min_uv[1] >= _placed._min_uv[1] && - _position._max_uv[0] <= _placed._max_uv[0] && - _position._max_uv[1] <= _placed._max_uv[1]) { - // No problem! It fits here, so leave well enough alone. - } else { - // That's not good enough either, so go back to rounding. - compute_size_from_uvs(rounded_min_uv, rounded_max_uv); - force_replace(); - } + compute_size_from_uvs(min_uv, max_uv); + if (_position._x_size <= _placed._x_size && + _position._y_size <= _placed._y_size && + _position._min_uv[0] >= _placed._min_uv[0] && + _position._min_uv[1] >= _placed._min_uv[1] && + _position._max_uv[0] <= _placed._max_uv[0] && + _position._max_uv[1] <= _placed._max_uv[1]) { + // No problem! It fits here, so leave well enough alone. + } else { + // That's not good enough either, so go back to rounding. + compute_size_from_uvs(rounded_min_uv, rounded_max_uv); + force_replace(); + } } else { - force_replace(); + force_replace(); } } if (_position._wrap_u != _placed._wrap_u || - _position._wrap_v != _placed._wrap_v) { + _position._wrap_v != _placed._wrap_v) { // The wrap mode properties have changed slightly. We may or // may not need to re-place it, but we will need to update it. _is_filled = false; @@ -620,7 +620,7 @@ intersects(int x, int y, int x_size, int y_size) { int mbot = _placed._y + _placed._y_size; return !(x >= mright || hright <= _placed._x || - y >= mbot || hbot <= _placed._y); + y >= mbot || hbot <= _placed._y); } //////////////////////////////////////////////////////////////////// @@ -653,9 +653,9 @@ compute_tex_matrix(LMatrix3d &transform) { int pal_y_size = _image->get_y_size(); LVecBase2d t((double)left / (double)pal_x_size, - (double)(pal_y_size - bottom) / (double)pal_y_size); + (double)(pal_y_size - bottom) / (double)pal_y_size); LVecBase2d s((double)x_size / (double)pal_x_size, - (double)y_size / (double)pal_y_size); + (double)y_size / (double)pal_y_size); LMatrix3d dest_uvs (s[0], 0.0, 0.0, @@ -678,10 +678,10 @@ write_placed(ostream &out, int indent_level) { if (is_placed()) { out << " at " - << get_placed_x() << " " << get_placed_y() << " to " - << get_placed_x() + get_placed_x_size() << " " - << get_placed_y() + get_placed_y_size() << " (coverage " - << get_placed_uv_area() << ")"; + << get_placed_x() << " " << get_placed_y() << " to " + << get_placed_x() + get_placed_x_size() << " " + << get_placed_y() + get_placed_y_size() << " (coverage " + << get_placed_uv_area() << ")"; if (_placed._wrap_u != EggTexture::WM_unspecified || _placed._wrap_v != EggTexture::WM_unspecified) { @@ -769,7 +769,7 @@ fill_image(PNMImage &image) { } PNMImage source(x_size, y_size, source_full.get_num_channels(), - source_full.get_maxval()); + source_full.get_maxval()); source.quick_filter_from(source_full); bool alpha = image.has_alpha(); @@ -797,21 +797,21 @@ fill_image(PNMImage &image) { int sx = x - left; if (_placed._wrap_u == EggTexture::WM_clamp) { - // Clamp at [0, x_size). - sx = max(min(sx, x_size - 1), 0); - + // Clamp at [0, x_size). + sx = max(min(sx, x_size - 1), 0); + } else { - // Wrap: sign-independent modulo. - sx = (sx < 0) ? x_size - 1 - ((-sx - 1) % x_size) : sx % x_size; + // Wrap: sign-independent modulo. + sx = (sx < 0) ? x_size - 1 - ((-sx - 1) % x_size) : sx % x_size; } image.set_xel(x, y, source.get_xel(sx, sy)); if (alpha) { - if (source_alpha) { - image.set_alpha(x, y, source.get_alpha(sx, sy)); - } else { - image.set_alpha(x, y, 1.0); - } + if (source_alpha) { + image.set_alpha(x, y, source.get_alpha(sx, sy)); + } else { + image.set_alpha(x, y, 1.0); + } } } } @@ -835,7 +835,7 @@ flag_error_image(PNMImage &image) { if (image.has_alpha()) { for (int y = _placed._y; y < _placed._y + _placed._y_size; y++) { for (int x = _placed._x; x < _placed._x + _placed._x_size; x++) { - image.set_alpha_val(x, y, 1); + image.set_alpha_val(x, y, 1); } } } diff --git a/pandatool/src/egg-palettize/texturePlacement.h b/pandatool/src/egg-palettize/texturePlacement.h index 1b86c11e41..87d9244041 100644 --- a/pandatool/src/egg-palettize/texturePlacement.h +++ b/pandatool/src/egg-palettize/texturePlacement.h @@ -26,7 +26,7 @@ class TextureReference; class PNMImage; //////////////////////////////////////////////////////////////////// -// Class : TexturePlacement +// Class : TexturePlacement // Description : This corresponds to a particular assignment of a // TextureImage with a PaletteGroup, and specifically // describes which PaletteImage (if any), and where on @@ -106,7 +106,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_TexturePlacement(const FactoryParams ¶ms); @@ -124,7 +124,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "TexturePlacement", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/texturePosition.h b/pandatool/src/egg-palettize/texturePosition.h index 11532b6508..5f8627e1ae 100644 --- a/pandatool/src/egg-palettize/texturePosition.h +++ b/pandatool/src/egg-palettize/texturePosition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TexturePosition +// Class : TexturePosition // Description : This represents a particular position of a texture // within a PaletteImage. There is only one of these // per TexturePlacement, but it exists as a separate @@ -54,7 +54,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "TexturePosition", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/textureProperties.cxx b/pandatool/src/egg-palettize/textureProperties.cxx index 2fc41364f1..6ed5ee479b 100644 --- a/pandatool/src/egg-palettize/textureProperties.cxx +++ b/pandatool/src/egg-palettize/textureProperties.cxx @@ -95,7 +95,7 @@ get_num_channels() const { bool TextureProperties:: uses_alpha() const { return (_num_channels == 2 || _num_channels == 4 || - _format == EggTexture::F_alpha); + _format == EggTexture::F_alpha); } //////////////////////////////////////////////////////////////////// @@ -330,11 +330,11 @@ operator < (const TextureProperties &other) const { bool TextureProperties:: operator == (const TextureProperties &other) const { return (_format == other._format && - _minfilter == other._minfilter && - _magfilter == other._magfilter && - _color_type == other._color_type && - (_color_type == (PNMFileType *)NULL || - _alpha_type == other._alpha_type)); + _minfilter == other._minfilter && + _magfilter == other._magfilter && + _color_type == other._color_type && + (_color_type == (PNMFileType *)NULL || + _alpha_type == other._alpha_type)); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/egg-palettize/textureProperties.h b/pandatool/src/egg-palettize/textureProperties.h index 25bb0945bf..e3d3f7c872 100644 --- a/pandatool/src/egg-palettize/textureProperties.h +++ b/pandatool/src/egg-palettize/textureProperties.h @@ -14,7 +14,7 @@ class PNMFileType; //////////////////////////////////////////////////////////////////// -// Class : TextureProperties +// Class : TextureProperties // Description : This is the set of characteristics of a texture that, // if different from another texture, prevent the two // textures from sharing a PaletteImage. It includes @@ -52,18 +52,18 @@ private: static string get_format_string(EggTexture::Format format); static string get_filter_string(EggTexture::FilterType filter_type); static string get_type_string(PNMFileType *color_type, - PNMFileType *alpha_type); + PNMFileType *alpha_type); static EggTexture::Format union_format(EggTexture::Format a, - EggTexture::Format b); + EggTexture::Format b); static EggTexture::FilterType union_filter(EggTexture::FilterType a, - EggTexture::FilterType b); + EggTexture::FilterType b); // The TypedWritable interface follows. public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_TextureProperties(const FactoryParams ¶ms); @@ -78,7 +78,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "TextureProperties", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/textureReference.cxx b/pandatool/src/egg-palettize/textureReference.cxx index daf654a743..06e2ce0149 100644 --- a/pandatool/src/egg-palettize/textureReference.cxx +++ b/pandatool/src/egg-palettize/textureReference.cxx @@ -102,7 +102,7 @@ from_egg(EggFile *egg_file, EggData *data, EggTexture *egg_tex) { if (alpha_mode == EggRenderMode::AM_unspecified) { if (_source_texture->get_size()) { _uses_alpha = - _egg_tex->has_alpha_channel(_source_texture->get_num_channels()); + _egg_tex->has_alpha_channel(_source_texture->get_num_channels()); } } else if (alpha_mode == EggRenderMode::AM_off) { @@ -408,7 +408,7 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { EggGroup *egg_group; DCAST_INTO_V(egg_group, group); if (egg_group->has_objecttype() && - cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) { + cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) { // If we reach a node with the "backstage" flag set, // ignore it and everything under it. return; @@ -430,49 +430,49 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { if (child->is_of_type(EggNurbsSurface::get_class_type())) { EggNurbsSurface *nurbs = DCAST(EggNurbsSurface, child); if (nurbs->has_texture() && nurbs->get_texture() == _egg_tex) { - // Here's a NURBS surface that references the texture. Unlike - // other kinds of geometries, NURBS don't store UV's; they're - // implicit in the surface. NURBS UV's will always run in the - // range (0,0) - (1,1). However, we do need to apply the - // texture matrix. + // Here's a NURBS surface that references the texture. Unlike + // other kinds of geometries, NURBS don't store UV's; they're + // implicit in the surface. NURBS UV's will always run in the + // range (0,0) - (1,1). However, we do need to apply the + // texture matrix. - // We also don't count the NURBS surfaces in with the group's - // UV's, because we can't adjust the UV's on a NURBS, so - // counting them up would be misleading (the reason we count - // up the group UV's is so we can consider adjusting them - // later). Instead, we just accumulate the NURBS UV's - // directly into our total. + // We also don't count the NURBS surfaces in with the group's + // UV's, because we can't adjust the UV's on a NURBS, so + // counting them up would be misleading (the reason we count + // up the group UV's is so we can consider adjusting them + // later). Instead, we just accumulate the NURBS UV's + // directly into our total. - static const int num_nurbs_uvs = 4; - static TexCoordd nurbs_uvs[num_nurbs_uvs] = { - TexCoordd(0.0, 0.0), - TexCoordd(0.0, 1.0), - TexCoordd(1.0, 1.0), - TexCoordd(1.0, 0.0) - }; + static const int num_nurbs_uvs = 4; + static TexCoordd nurbs_uvs[num_nurbs_uvs] = { + TexCoordd(0.0, 0.0), + TexCoordd(0.0, 1.0), + TexCoordd(1.0, 1.0), + TexCoordd(1.0, 0.0) + }; - for (int i = 0; i < num_nurbs_uvs; i++) { - TexCoordd uv = nurbs_uvs[i] * _tex_mat; - collect_uv(_any_uvs, _min_uv, _max_uv, uv, uv); - } + for (int i = 0; i < num_nurbs_uvs; i++) { + TexCoordd uv = nurbs_uvs[i] * _tex_mat; + collect_uv(_any_uvs, _min_uv, _max_uv, uv, uv); + } } } else if (child->is_of_type(EggPrimitive::get_class_type())) { EggPrimitive *geom = DCAST(EggPrimitive, child); if (geom->has_texture() && geom->get_texture() == _egg_tex) { - // Here's a piece of geometry that references this texture. - // Walk through its vertices and get its UV's. - TexCoordd geom_min_uv, geom_max_uv; + // Here's a piece of geometry that references this texture. + // Walk through its vertices and get its UV's. + TexCoordd geom_min_uv, geom_max_uv; - if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { - if (remap == Palettizer::RU_poly) { - LVector2d trans = translate_uv(geom_min_uv, geom_max_uv); - geom_min_uv += trans; - geom_max_uv += trans; - } - collect_uv(group_any_uvs, group_min_uv, group_max_uv, - geom_min_uv, geom_max_uv); - } + if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { + if (remap == Palettizer::RU_poly) { + LVector2d trans = translate_uv(geom_min_uv, geom_max_uv); + geom_min_uv += trans; + geom_max_uv += trans; + } + collect_uv(group_any_uvs, group_min_uv, group_max_uv, + geom_min_uv, geom_max_uv); + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -489,7 +489,7 @@ get_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { } collect_uv(_any_uvs, _min_uv, _max_uv, group_min_uv, group_max_uv); } -} +} //////////////////////////////////////////////////////////////////// // Function: TextureReference::update_uv_range @@ -503,7 +503,7 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { EggGroup *egg_group; DCAST_INTO_V(egg_group, group); if (egg_group->has_objecttype() && - cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) { + cmp_nocase_uh(egg_group->get_objecttype(), "backstage") == 0) { // If we reach a node with the "backstage" flag set, // ignore it and everything under it. return; @@ -528,23 +528,23 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { } else if (child->is_of_type(EggPrimitive::get_class_type())) { if (remap != Palettizer::RU_never) { - EggPrimitive *geom = DCAST(EggPrimitive, child); - if (geom->has_texture() && geom->get_texture() == _egg_tex) { - TexCoordd geom_min_uv, geom_max_uv; - - if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { - if (remap == Palettizer::RU_poly) { - LVector2d trans = translate_uv(geom_min_uv, geom_max_uv); - trans = trans * _inv_tex_mat; - if (!trans.almost_equal(LVector2d::zero())) { - translate_geom_uvs(geom, trans); - } - } else { - collect_uv(group_any_uvs, group_min_uv, group_max_uv, - geom_min_uv, geom_max_uv); - } - } - } + EggPrimitive *geom = DCAST(EggPrimitive, child); + if (geom->has_texture() && geom->get_texture() == _egg_tex) { + TexCoordd geom_min_uv, geom_max_uv; + + if (get_geom_uvs(geom, geom_min_uv, geom_max_uv)) { + if (remap == Palettizer::RU_poly) { + LVector2d trans = translate_uv(geom_min_uv, geom_max_uv); + trans = trans * _inv_tex_mat; + if (!trans.almost_equal(LVector2d::zero())) { + translate_geom_uvs(geom, trans); + } + } else { + collect_uv(group_any_uvs, group_min_uv, group_max_uv, + geom_min_uv, geom_max_uv); + } + } + } } } else if (child->is_of_type(EggGroupNode::get_class_type())) { @@ -558,17 +558,17 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { trans = trans * _inv_tex_mat; if (!trans.almost_equal(LVector2d::zero())) { for (ci = group->begin(); ci != group->end(); ci++) { - EggNode *child = (*ci); - if (child->is_of_type(EggPrimitive::get_class_type())) { - EggPrimitive *geom = DCAST(EggPrimitive, child); - if (geom->has_texture() && geom->get_texture() == _egg_tex) { - translate_geom_uvs(geom, trans); - } - } + EggNode *child = (*ci); + if (child->is_of_type(EggPrimitive::get_class_type())) { + EggPrimitive *geom = DCAST(EggPrimitive, child); + if (geom->has_texture() && geom->get_texture() == _egg_tex) { + translate_geom_uvs(geom, trans); + } + } } } } -} +} //////////////////////////////////////////////////////////////////// // Function: TextureReference::get_geom_uvs @@ -579,7 +579,7 @@ update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap) { //////////////////////////////////////////////////////////////////// bool TextureReference:: get_geom_uvs(EggPrimitive *geom, - TexCoordd &geom_min_uv, TexCoordd &geom_max_uv) { + TexCoordd &geom_min_uv, TexCoordd &geom_max_uv) { bool geom_any_uvs = false; EggPrimitive::iterator pi; @@ -611,7 +611,7 @@ translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const { EggVertex *new_vtx = vtx->get_pool()->create_unique_vertex(vtx_copy); if (new_vtx->gref_size() != vtx->gref_size()) { - new_vtx->copy_grefs_from(*vtx); + new_vtx->copy_grefs_from(*vtx); } geom->replace(pi, new_vtx); @@ -627,12 +627,12 @@ translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const { //////////////////////////////////////////////////////////////////// void TextureReference:: collect_uv(bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, - const TexCoordd &got_min_uv, const TexCoordd &got_max_uv) { + const TexCoordd &got_min_uv, const TexCoordd &got_max_uv) { if (any_uvs) { min_uv.set(min(min_uv[0], got_min_uv[0]), - min(min_uv[1], got_min_uv[1])); + min(min_uv[1], got_min_uv[1])); max_uv.set(max(max_uv[0], got_max_uv[0]), - max(max_uv[1], got_max_uv[1])); + max(max_uv[1], got_max_uv[1])); } else { // The first UV. min_uv = got_min_uv; diff --git a/pandatool/src/egg-palettize/textureReference.h b/pandatool/src/egg-palettize/textureReference.h index e9458ab9d3..4d4df10b23 100644 --- a/pandatool/src/egg-palettize/textureReference.h +++ b/pandatool/src/egg-palettize/textureReference.h @@ -25,7 +25,7 @@ class EggPrimitive; class TexturePlacement; //////////////////////////////////////////////////////////////////// -// Class : TextureReference +// Class : TextureReference // Description : This is the particular reference of a texture // filename by an egg file. It also includes // information about the way in which the egg file uses @@ -64,13 +64,13 @@ private: void update_uv_range(EggGroupNode *group, Palettizer::RemapUV remap); bool get_geom_uvs(EggPrimitive *geom, - TexCoordd &geom_min_uv, TexCoordd &geom_max_uv); + TexCoordd &geom_min_uv, TexCoordd &geom_max_uv); void translate_geom_uvs(EggPrimitive *geom, const TexCoordd &trans) const; static void collect_uv(bool &any_uvs, TexCoordd &min_uv, TexCoordd &max_uv, - const TexCoordd &got_min_uv, - const TexCoordd &got_max_uv); + const TexCoordd &got_min_uv, + const TexCoordd &got_max_uv); static LVector2d translate_uv(const TexCoordd &min_uv, - const TexCoordd &max_uv); + const TexCoordd &max_uv); EggFile *_egg_file; EggTexture *_egg_tex; @@ -93,7 +93,7 @@ public: static void register_with_read_factory(); virtual void write_datagram(BamWriter *writer, Datagram &datagram); virtual int complete_pointers(vector_typedWritable &plist, - BamReader *manager); + BamReader *manager); protected: static TypedWritable *make_TextureReference(const FactoryParams ¶ms); @@ -106,7 +106,7 @@ public: static void init_type() { TypedWritable::init_type(); register_type(_type_handle, "TextureReference", - TypedWritable::get_class_type()); + TypedWritable::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/egg-palettize/textureRequest.h b/pandatool/src/egg-palettize/textureRequest.h index 759f8517af..4656ccb637 100644 --- a/pandatool/src/egg-palettize/textureRequest.h +++ b/pandatool/src/egg-palettize/textureRequest.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextureRequest +// Class : TextureRequest // Description : These are the things that a user might explicitly // request to adjust on a texture via a line in the .txa // file. diff --git a/pandatool/src/egg-palettize/txaFile.cxx b/pandatool/src/egg-palettize/txaFile.cxx index 0c6cd1e4b7..6323f0a5c8 100644 --- a/pandatool/src/egg-palettize/txaFile.cxx +++ b/pandatool/src/egg-palettize/txaFile.cxx @@ -57,32 +57,32 @@ read(Filename filename) { vector_string words; extract_words(line, words); if (words[0] == ":group") { - okflag = parse_group_line(words); + okflag = parse_group_line(words); } else if (words[0] == ":palette") { - okflag = parse_palette_line(words); + okflag = parse_palette_line(words); } else if (words[0] == ":margin") { - okflag = parse_margin_line(words); + okflag = parse_margin_line(words); } else if (words[0] == ":coverage") { - okflag = parse_coverage_line(words); + okflag = parse_coverage_line(words); } else if (words[0] == ":imagetype") { - okflag = parse_imagetype_line(words); + okflag = parse_imagetype_line(words); } else if (words[0] == ":shadowtype") { - okflag = parse_shadowtype_line(words); + okflag = parse_shadowtype_line(words); } else if (words[0] == ":round") { - okflag = parse_round_line(words); + okflag = parse_round_line(words); } else if (words[0] == ":remap") { - okflag = parse_remap_line(words); + okflag = parse_remap_line(words); } else { - nout << "Invalid keyword " << words[0] << "\n"; - okflag = false; + nout << "Invalid keyword " << words[0] << "\n"; + okflag = false; } } else { @@ -203,17 +203,17 @@ parse_group_line(const vector_string &words) { } else { switch (state) { case S_none: - nout << "Invalid keyword: " << word << "\n"; - return false; + nout << "Invalid keyword: " << word << "\n"; + return false; case S_with: - group->group_with(pal->get_palette_group(word)); - break; + group->group_with(pal->get_palette_group(word)); + break; case S_dir: - group->set_dirname(word); - state = S_none; - break; + group->set_dirname(word); + state = S_none; + break; } } @@ -234,7 +234,7 @@ bool TxaFile:: parse_palette_line(const vector_string &words) { if (words.size() != 3) { nout << "Exactly two parameters required for :palette, the x and y " - << "size of the palette images to generate.\n"; + << "size of the palette images to generate.\n"; return false; } @@ -246,7 +246,7 @@ parse_palette_line(const vector_string &words) { if (pal->_pal_x_size <= 0 || pal->_pal_y_size <= 0) { nout << "Invalid palette size: " << pal->_pal_x_size - << " " << pal->_pal_y_size << "\n"; + << " " << pal->_pal_y_size << "\n"; return false; } @@ -264,7 +264,7 @@ bool TxaFile:: parse_margin_line(const vector_string &words) { if (words.size() != 2) { nout << "Exactly one parameter required for :margin, the " - << "size of the default margin to apply.\n"; + << "size of the default margin to apply.\n"; return false; } @@ -292,7 +292,7 @@ bool TxaFile:: parse_coverage_line(const vector_string &words) { if (words.size() != 2) { nout << "Exactly one parameter required for :coverage, the " - << "value for the default coverage threshold.\n"; + << "value for the default coverage threshold.\n"; return false; } @@ -350,7 +350,7 @@ parse_shadowtype_line(const vector_string &words) { } const string &shadowtype = words[1]; if (!parse_image_type_request(shadowtype, pal->_shadow_color_type, - pal->_shadow_alpha_type)) { + pal->_shadow_alpha_type)) { nout << "\nKnown image types are:\n"; PNMFileTypeRegistry::get_ptr()->write_types(nout, 2); nout << "\n"; @@ -375,14 +375,14 @@ parse_round_line(const vector_string &words) { return true; } else { nout << "Invalid round keyword: " << words[1] << ".\n" - << "Expected 'no', or a round fraction and fuzz factor.\n"; + << "Expected 'no', or a round fraction and fuzz factor.\n"; return false; } } if (words.size() != 3) { nout << "Exactly two parameters required for :round, the fraction " - << "to round to, and the fuzz factor.\n"; + << "to round to, and the fuzz factor.\n"; return false; } @@ -394,7 +394,7 @@ parse_round_line(const vector_string &words) { if (pal->_round_unit <= 0.0 || pal->_round_fuzz < 0.0) { nout << "Invalid rounding: " << pal->_round_unit - << " " << pal->_round_fuzz << "\n"; + << " " << pal->_round_fuzz << "\n"; return false; } @@ -418,21 +418,21 @@ parse_remap_line(const vector_string &words) { // Defining how to remap UV's for characters. i++; if (i == (int)words.size()) { - nout << "Keyword expected following 'char'\n"; - return false; + nout << "Keyword expected following 'char'\n"; + return false; } pal->_remap_char_uv = Palettizer::string_remap(words[i]); if (pal->_remap_char_uv == Palettizer::RU_invalid) { - nout << "Invalid remap keyword: " << words[i] << "\n"; - return false; + nout << "Invalid remap keyword: " << words[i] << "\n"; + return false; } } else { // Defining how to remap UV's in general. pal->_remap_uv = Palettizer::string_remap(words[i]); if (pal->_remap_uv == Palettizer::RU_invalid) { - nout << "Invalid remap keyword: " << words[i] << "\n"; - return false; + nout << "Invalid remap keyword: " << words[i] << "\n"; + return false; } pal->_remap_char_uv = pal->_remap_uv; diff --git a/pandatool/src/egg-palettize/txaFile.h b/pandatool/src/egg-palettize/txaFile.h index ce4925adfb..2a9e38cfcf 100644 --- a/pandatool/src/egg-palettize/txaFile.h +++ b/pandatool/src/egg-palettize/txaFile.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TxaFile +// Class : TxaFile // Description : This represents the .txa file (usually textures.txa) // that contains the user instructions for resizing, // grouping, etc. the various textures. diff --git a/pandatool/src/egg-palettize/txaLine.cxx b/pandatool/src/egg-palettize/txaLine.cxx index a2304bf495..3f8cd578ad 100644 --- a/pandatool/src/egg-palettize/txaLine.cxx +++ b/pandatool/src/egg-palettize/txaLine.cxx @@ -89,127 +89,127 @@ parse(const string &line) { if (isdigit(word[0])) { // This is either a new size or a scale percentage. if (_size_type != ST_none) { - nout << "Invalid repeated size request: " << word << "\n"; - return false; + nout << "Invalid repeated size request: " << word << "\n"; + return false; } if (word[word.length() - 1] == '%') { - // It's a scale percentage! - _size_type = ST_scale; + // It's a scale percentage! + _size_type = ST_scale; - string tail; - _scale = string_to_double(word, tail); - if (!(tail == "%")) { - // This is an invalid number. - return false; - } - ++wi; + string tail; + _scale = string_to_double(word, tail); + if (!(tail == "%")) { + // This is an invalid number. + return false; + } + ++wi; } else { - // Collect a number of consecutive numeric fields. - vector numbers; - while (wi != words.end() && isdigit((*wi)[0])) { - const string &word = *wi; - int num; - if (!string_to_int(word, num)) { - nout << "Invalid size: " << word << "\n"; - return false; - } - numbers.push_back(num); - ++wi; - } - if (numbers.size() < 2) { - nout << "At least two size numbers must be given, or a percent sign used to indicate scaling.\n"; - return false; + // Collect a number of consecutive numeric fields. + vector numbers; + while (wi != words.end() && isdigit((*wi)[0])) { + const string &word = *wi; + int num; + if (!string_to_int(word, num)) { + nout << "Invalid size: " << word << "\n"; + return false; + } + numbers.push_back(num); + ++wi; + } + if (numbers.size() < 2) { + nout << "At least two size numbers must be given, or a percent sign used to indicate scaling.\n"; + return false; - } else if (numbers.size() == 2) { - _size_type = ST_explicit_2; - _x_size = numbers[0]; - _y_size = numbers[1]; + } else if (numbers.size() == 2) { + _size_type = ST_explicit_2; + _x_size = numbers[0]; + _y_size = numbers[1]; - } else if (numbers.size() == 3) { - _size_type = ST_explicit_3; - _x_size = numbers[0]; - _y_size = numbers[1]; - _num_channels = numbers[2]; + } else if (numbers.size() == 3) { + _size_type = ST_explicit_3; + _x_size = numbers[0]; + _y_size = numbers[1]; + _num_channels = numbers[2]; - } else { - nout << "Too many size numbers given.\n"; - return false; - } + } else { + nout << "Too many size numbers given.\n"; + return false; + } } } else { // The word does not begin with a digit; therefore it's either a // keyword or an image file type request. if (word == "omit") { - _keywords.push_back(KW_omit); + _keywords.push_back(KW_omit); } else if (word == "nearest") { - _keywords.push_back(KW_nearest); + _keywords.push_back(KW_nearest); } else if (word == "linear") { - _keywords.push_back(KW_linear); + _keywords.push_back(KW_linear); } else if (word == "mipmap") { - _keywords.push_back(KW_mipmap); + _keywords.push_back(KW_mipmap); } else if (word == "cont") { - _keywords.push_back(KW_cont); + _keywords.push_back(KW_cont); } else if (word == "margin") { - ++wi; - if (wi == words.end()) { - nout << "Argument required for 'margin'.\n"; - return false; - } - - const string &arg = (*wi); - if (!string_to_int(arg, _margin)) { - nout << "Not an integer: " << arg << "\n"; - return false; - } - if (_margin < 0) { - nout << "Invalid margin: " << _margin << "\n"; - return false; - } - _got_margin = true; + ++wi; + if (wi == words.end()) { + nout << "Argument required for 'margin'.\n"; + return false; + } + + const string &arg = (*wi); + if (!string_to_int(arg, _margin)) { + nout << "Not an integer: " << arg << "\n"; + return false; + } + if (_margin < 0) { + nout << "Invalid margin: " << _margin << "\n"; + return false; + } + _got_margin = true; } else if (word == "coverage") { - ++wi; - if (wi == words.end()) { - nout << "Argument required for 'coverage'.\n"; - return false; - } - - const string &arg = (*wi); - if (!string_to_double(arg, _coverage_threshold)) { - nout << "Not a number: " << arg << "\n"; - return false; - } - if (_coverage_threshold <= 0.0) { - nout << "Invalid coverage threshold: " << _coverage_threshold << "\n"; - return false; - } - _got_coverage_threshold = true; + ++wi; + if (wi == words.end()) { + nout << "Argument required for 'coverage'.\n"; + return false; + } + + const string &arg = (*wi); + if (!string_to_double(arg, _coverage_threshold)) { + nout << "Not a number: " << arg << "\n"; + return false; + } + if (_coverage_threshold <= 0.0) { + nout << "Invalid coverage threshold: " << _coverage_threshold << "\n"; + return false; + } + _got_coverage_threshold = true; } else { - // Maybe it's a format name. - EggTexture::Format format = EggTexture::string_format(word); - if (format != EggTexture::F_unspecified) { - _format = format; - } else { - // Maybe it's a group name. - PaletteGroup *group = pal->test_palette_group(word); - if (group != (PaletteGroup *)NULL) { - _palette_groups.insert(group); - - } else { - // Maybe it's an image file request. - if (!parse_image_type_request(word, _color_type, _alpha_type)) { - return false; - } - } - } + // Maybe it's a format name. + EggTexture::Format format = EggTexture::string_format(word); + if (format != EggTexture::F_unspecified) { + _format = format; + } else { + // Maybe it's a group name. + PaletteGroup *group = pal->test_palette_group(word); + if (group != (PaletteGroup *)NULL) { + _palette_groups.insert(group); + + } else { + // Maybe it's an image file request. + if (!parse_image_type_request(word, _color_type, _alpha_type)) { + return false; + } + } + } } ++wi; } @@ -318,9 +318,9 @@ match_texture(TextureImage *texture) const { case ST_scale: if (source != (SourceTextureImage *)NULL && source->get_size()) { - request._got_size = true; - request._x_size = (int)(source->get_x_size() * _scale / 100.0); - request._y_size = (int)(source->get_y_size() * _scale / 100.0); + request._got_size = true; + request._x_size = (int)(source->get_x_size() * _scale / 100.0); + request._y_size = (int)(source->get_y_size() * _scale / 100.0); } break; diff --git a/pandatool/src/egg-palettize/txaLine.h b/pandatool/src/egg-palettize/txaLine.h index 7bc1ce7dbe..fc3d772f0f 100644 --- a/pandatool/src/egg-palettize/txaLine.h +++ b/pandatool/src/egg-palettize/txaLine.h @@ -20,7 +20,7 @@ class EggFile; class TextureImage; //////////////////////////////////////////////////////////////////// -// Class : TxaLine +// Class : TxaLine // Description : This is a single matching line in the .txa file. It // consists of a list of names (texture names or egg // file names), followed by a colon and an optional size diff --git a/pandatool/src/eggbase/eggBase.cxx b/pandatool/src/eggbase/eggBase.cxx index 80c1f0a3b3..2d98e673f0 100644 --- a/pandatool/src/eggbase/eggBase.cxx +++ b/pandatool/src/eggbase/eggBase.cxx @@ -113,7 +113,7 @@ append_command_comment(EggData &data) { case '"': case ';': case '$': - legal = false; + legal = false; } } diff --git a/pandatool/src/eggbase/eggBase.h b/pandatool/src/eggbase/eggBase.h index d7776e10dd..635dbd84c0 100644 --- a/pandatool/src/eggbase/eggBase.h +++ b/pandatool/src/eggbase/eggBase.h @@ -16,7 +16,7 @@ class EggReader; class EggWriter; //////////////////////////////////////////////////////////////////// -// Class : EggBase +// Class : EggBase // Description : This specialization of ProgramBase is intended for // programs that read and/or write a single egg file. // (See EggMultiBase for programs that operate on diff --git a/pandatool/src/eggbase/eggConverter.cxx b/pandatool/src/eggbase/eggConverter.cxx index 4e706e3c86..ee390a559b 100644 --- a/pandatool/src/eggbase/eggConverter.cxx +++ b/pandatool/src/eggbase/eggConverter.cxx @@ -18,9 +18,9 @@ //////////////////////////////////////////////////////////////////// EggConverter:: EggConverter(const string &format_name, - const string &preferred_extension, - bool allow_last_param, - bool allow_stdout) : + const string &preferred_extension, + bool allow_last_param, + bool allow_stdout) : EggFilter(allow_last_param, allow_stdout), _format_name(format_name) { diff --git a/pandatool/src/eggbase/eggConverter.h b/pandatool/src/eggbase/eggConverter.h index f6565f5746..9afb359bf1 100644 --- a/pandatool/src/eggbase/eggConverter.h +++ b/pandatool/src/eggbase/eggConverter.h @@ -11,7 +11,7 @@ #include "eggFilter.h" //////////////////////////////////////////////////////////////////// -// Class : EggConverter +// Class : EggConverter // Description : This is a general base class for programs that // convert between egg files and some other format. See // EggToSomething and SomethingToEgg. @@ -19,9 +19,9 @@ class EggConverter : public EggFilter { public: EggConverter(const string &format_name, - const string &preferred_extension = string(), - bool allow_last_param = true, - bool allow_stdout = true); + const string &preferred_extension = string(), + bool allow_last_param = true, + bool allow_stdout = true); protected: string _format_name; diff --git a/pandatool/src/eggbase/eggFilter.h b/pandatool/src/eggbase/eggFilter.h index 539d2c29ea..04779b01b9 100644 --- a/pandatool/src/eggbase/eggFilter.h +++ b/pandatool/src/eggbase/eggFilter.h @@ -12,7 +12,7 @@ #include "eggWriter.h" //////////////////////////////////////////////////////////////////// -// Class : EggFilter +// Class : EggFilter // Description : This is the base class for a program that reads an // egg file, operates on it, and writes another egg file // out. diff --git a/pandatool/src/eggbase/eggMultiBase.cxx b/pandatool/src/eggbase/eggMultiBase.cxx index 5f8662857d..fe977553cd 100644 --- a/pandatool/src/eggbase/eggMultiBase.cxx +++ b/pandatool/src/eggbase/eggMultiBase.cxx @@ -73,7 +73,7 @@ append_command_comment(EggData &data) { case '"': case ';': case '$': - legal = false; + legal = false; } } diff --git a/pandatool/src/eggbase/eggMultiBase.h b/pandatool/src/eggbase/eggMultiBase.h index 326cbeae69..4eeaece609 100644 --- a/pandatool/src/eggbase/eggMultiBase.h +++ b/pandatool/src/eggbase/eggMultiBase.h @@ -16,7 +16,7 @@ class Filename; //////////////////////////////////////////////////////////////////// -// Class : EggMultiBase +// Class : EggMultiBase // Description : This specialization of ProgramBase is intended for // programs that read and/or write multiple egg files. // diff --git a/pandatool/src/eggbase/eggMultiFilter.cxx b/pandatool/src/eggbase/eggMultiFilter.cxx index 3b126c6fad..02a77eb1d4 100644 --- a/pandatool/src/eggbase/eggMultiFilter.cxx +++ b/pandatool/src/eggbase/eggMultiFilter.cxx @@ -66,26 +66,26 @@ handle_args(ProgramBase::Args &args) { if (_got_output_filename && args.size() == 1) { if (_got_output_dirname) { - nout << "Cannot specify both -o and -d.\n"; - return false; + nout << "Cannot specify both -o and -d.\n"; + return false; } else if (_inplace) { - nout << "Cannot specify both -o and -inplace.\n"; - return false; + nout << "Cannot specify both -o and -inplace.\n"; + return false; } } else { if (_got_output_filename) { - nout << "Cannot use -o when multiple egg files are specified.\n"; - return false; + nout << "Cannot use -o when multiple egg files are specified.\n"; + return false; } if (_got_output_dirname && _inplace) { - nout << "Cannot specify both -inplace and -d.\n"; - return false; - + nout << "Cannot specify both -inplace and -d.\n"; + return false; + } else if (!_got_output_dirname && !_inplace) { - nout << "You must specify either -inplace or -d.\n"; - return false; + nout << "You must specify either -inplace or -d.\n"; + return false; } } } diff --git a/pandatool/src/eggbase/eggMultiFilter.h b/pandatool/src/eggbase/eggMultiFilter.h index c43fbd86e5..167808b454 100644 --- a/pandatool/src/eggbase/eggMultiFilter.h +++ b/pandatool/src/eggbase/eggMultiFilter.h @@ -11,7 +11,7 @@ #include "eggMultiBase.h" //////////////////////////////////////////////////////////////////// -// Class : EggMultiFilter +// Class : EggMultiFilter // Description : This is a base class for a program that reads in a // number of egg files, operates on them, and writes // them out again (presumably to a different directory). diff --git a/pandatool/src/eggbase/eggReader.cxx b/pandatool/src/eggbase/eggReader.cxx index 5e9c0e5b70..d7994cef1f 100644 --- a/pandatool/src/eggbase/eggReader.cxx +++ b/pandatool/src/eggbase/eggReader.cxx @@ -79,7 +79,7 @@ handle_args(ProgramBase::Args &args) { if (_force_complete) { if (!_data.resolve_externals()) { - exit(1); + exit(1); } } } diff --git a/pandatool/src/eggbase/eggReader.h b/pandatool/src/eggbase/eggReader.h index 3b76b5a286..dd37b57622 100644 --- a/pandatool/src/eggbase/eggReader.h +++ b/pandatool/src/eggbase/eggReader.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : EggReader +// Class : EggReader // Description : This is the base class for a program that reads egg // files, but doesn't write an egg file. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/eggbase/eggToSomething.cxx b/pandatool/src/eggbase/eggToSomething.cxx index 4512d3f95f..db1870c358 100644 --- a/pandatool/src/eggbase/eggToSomething.cxx +++ b/pandatool/src/eggbase/eggToSomething.cxx @@ -15,10 +15,10 @@ //////////////////////////////////////////////////////////////////// EggToSomething:: EggToSomething(const string &format_name, - const string &preferred_extension, - bool allow_last_param, bool allow_stdout) : + const string &preferred_extension, + bool allow_last_param, bool allow_stdout) : EggConverter(format_name, preferred_extension, allow_last_param, - allow_stdout) + allow_stdout) { clear_runlines(); if (_allow_last_param) { @@ -34,29 +34,29 @@ EggToSomething(const string &format_name, if (_allow_stdout) { if (_allow_last_param) { o_description = - "Specify the filename to which the resulting " + format_name + - " file will be written. " - "If this option is omitted, the last parameter name is taken to be the " - "name of the output file, or standard output is used if there are no " - "other parameters."; + "Specify the filename to which the resulting " + format_name + + " file will be written. " + "If this option is omitted, the last parameter name is taken to be the " + "name of the output file, or standard output is used if there are no " + "other parameters."; } else { o_description = - "Specify the filename to which the resulting " + format_name + - " file will be written. " - "If this option is omitted, the " + format_name + - " file is written to standard output."; + "Specify the filename to which the resulting " + format_name + + " file will be written. " + "If this option is omitted, the " + format_name + + " file is written to standard output."; } } else { if (_allow_last_param) { o_description = - "Specify the filename to which the resulting " + format_name + - " file will be written. " - "If this option is omitted, the last parameter name is taken to be the " - "name of the output file."; + "Specify the filename to which the resulting " + format_name + + " file will be written. " + "If this option is omitted, the last parameter name is taken to be the " + "name of the output file."; } else { o_description = - "Specify the filename to which the resulting " + format_name + - " file will be written."; + "Specify the filename to which the resulting " + format_name + + " file will be written."; } } diff --git a/pandatool/src/eggbase/eggToSomething.h b/pandatool/src/eggbase/eggToSomething.h index 815a76c15f..50db4c1eda 100644 --- a/pandatool/src/eggbase/eggToSomething.h +++ b/pandatool/src/eggbase/eggToSomething.h @@ -11,7 +11,7 @@ #include "eggConverter.h" //////////////////////////////////////////////////////////////////// -// Class : EggToSomething +// Class : EggToSomething // Description : This is the general base class for a file-converter // program that reads some model file format and // generates an egg file. @@ -19,9 +19,9 @@ class EggToSomething : public EggConverter { public: EggToSomething(const string &format_name, - const string &preferred_extension = string(), - bool allow_last_param = true, - bool allow_stdout = true); + const string &preferred_extension = string(), + bool allow_last_param = true, + bool allow_stdout = true); protected: virtual bool handle_args(Args &args); diff --git a/pandatool/src/eggbase/eggWriter.cxx b/pandatool/src/eggbase/eggWriter.cxx index fe1a10af04..c41a65eacd 100644 --- a/pandatool/src/eggbase/eggWriter.cxx +++ b/pandatool/src/eggbase/eggWriter.cxx @@ -49,24 +49,24 @@ EggWriter(bool allow_last_param, bool allow_stdout) : if (_allow_stdout) { if (_allow_last_param) { o_description = - "Specify the filename to which the resulting egg file will be written. " - "If this option is omitted, the last parameter name is taken to be the " - "name of the output file, or standard output is used if there are no " - "other parameters."; + "Specify the filename to which the resulting egg file will be written. " + "If this option is omitted, the last parameter name is taken to be the " + "name of the output file, or standard output is used if there are no " + "other parameters."; } else { o_description = - "Specify the filename to which the resulting egg file will be written. " - "If this option is omitted, the egg file is written to standard output."; + "Specify the filename to which the resulting egg file will be written. " + "If this option is omitted, the egg file is written to standard output."; } } else { if (_allow_last_param) { o_description = - "Specify the filename to which the resulting egg file will be written. " - "If this option is omitted, the last parameter name is taken to be the " - "name of the output file."; + "Specify the filename to which the resulting egg file will be written. " + "If this option is omitted, the last parameter name is taken to be the " + "name of the output file."; } else { o_description = - "Specify the filename to which the resulting egg file will be written."; + "Specify the filename to which the resulting egg file will be written."; } } @@ -198,9 +198,9 @@ post_process_egg_file() { _transform.write(nout, 2); LVecBase3d scale, hpr, translate; if (decompose_matrix(_transform, scale, hpr, translate, - _data.get_coordinate_system())) { + _data.get_coordinate_system())) { nout << "(scale " << scale << ", hpr " << hpr << ", translate " - << translate << ")\n"; + << translate << ")\n"; } _data.transform(_transform); } @@ -316,7 +316,7 @@ ns_dispatch_normals(const string &opt, const string &arg, void *mode) { if (_normals_mode == NM_vertex) { if (!string_to_double(arg, _normals_threshold)) { nout << "Invalid numeric parameter for -" << opt << ": " - << arg << "\n"; + << arg << "\n"; return false; } } @@ -354,7 +354,7 @@ dispatch_scale(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires one or three numbers separated by commas.\n"; + << " requires one or three numbers separated by commas.\n"; return false; } @@ -401,7 +401,7 @@ ns_dispatch_rotate_xyz(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires three numbers separated by commas.\n"; + << " requires three numbers separated by commas.\n"; return false; } @@ -455,7 +455,7 @@ ns_dispatch_rotate_axis(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires four numbers separated by commas.\n"; + << " requires four numbers separated by commas.\n"; return false; } @@ -489,7 +489,7 @@ dispatch_translate(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires three numbers separated by commas.\n"; + << " requires three numbers separated by commas.\n"; return false; } diff --git a/pandatool/src/eggbase/eggWriter.h b/pandatool/src/eggbase/eggWriter.h index 59e3d210e1..d0e1d56f72 100644 --- a/pandatool/src/eggbase/eggWriter.h +++ b/pandatool/src/eggbase/eggWriter.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggWriter +// Class : EggWriter // Description : This is the base class for a program that generates // an egg file output, but doesn't read any for input. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/eggbase/somethingToEgg.cxx b/pandatool/src/eggbase/somethingToEgg.cxx index e7b303580b..90cd652286 100644 --- a/pandatool/src/eggbase/somethingToEgg.cxx +++ b/pandatool/src/eggbase/somethingToEgg.cxx @@ -17,8 +17,8 @@ //////////////////////////////////////////////////////////////////// SomethingToEgg:: SomethingToEgg(const string &format_name, - const string &preferred_extension, - bool allow_last_param, bool allow_stdout) : + const string &preferred_extension, + bool allow_last_param, bool allow_stdout) : EggConverter(format_name, preferred_extension, allow_last_param, allow_stdout) { clear_runlines(); @@ -222,7 +222,7 @@ apply_units_scale(EggData &data) { if (_output_units != DU_invalid && _input_units != DU_invalid && _input_units != _output_units) { nout << "Converting from " << format_long_unit(_input_units) - << " to " << format_long_unit(_output_units) << "\n"; + << " to " << format_long_unit(_output_units) << "\n"; double scale = convert_units(_input_units, _output_units); data.transform(LMatrix4d::scale_mat(scale)); } @@ -242,8 +242,8 @@ handle_args(Args &args) { if (!(_output_filename.get_extension() == "egg")) { nout << "Output filename " << _output_filename - << " does not end in .egg. If this is really what you intended, " - "use the -o output_file syntax.\n"; + << " does not end in .egg. If this is really what you intended, " + "use the -o output_file syntax.\n"; return false; } @@ -254,14 +254,14 @@ handle_args(Args &args) { if (args.empty()) { nout << "You must specify the " << _format_name - << " file to read on the command line.\n"; + << " file to read on the command line.\n"; return false; } if (args.size() != 1) { nout << "You may only specify one " << _format_name - << " file to read on the command line. " - << "You specified: "; + << " file to read on the command line. " + << "You specified: "; copy(args.begin(), args.end(), ostream_iterator(nout, " ")); nout << "\n"; return false; diff --git a/pandatool/src/eggbase/somethingToEgg.h b/pandatool/src/eggbase/somethingToEgg.h index a67bedd101..0fd027c9eb 100644 --- a/pandatool/src/eggbase/somethingToEgg.h +++ b/pandatool/src/eggbase/somethingToEgg.h @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// -// Class : SomethingToEgg +// Class : SomethingToEgg // Description : This is the general base class for a file-converter // program that reads some model file format and // generates an egg file. @@ -23,9 +23,9 @@ class SomethingToEgg : public EggConverter { public: SomethingToEgg(const string &format_name, - const string &preferred_extension = string(), - bool allow_last_param = true, - bool allow_stdout = true); + const string &preferred_extension = string(), + bool allow_last_param = true, + bool allow_stdout = true); void add_units_options(); void add_texture_path_options(); diff --git a/pandatool/src/eggcharbase/eggBackPointer.h b/pandatool/src/eggcharbase/eggBackPointer.h index 2cc76a93f0..ec6aad76fc 100644 --- a/pandatool/src/eggcharbase/eggBackPointer.h +++ b/pandatool/src/eggcharbase/eggBackPointer.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggBackPointer +// Class : EggBackPointer // Description : This stores a pointer from an EggJointData or // EggSlider object back to the referencing data in an // egg file. One of these objects corresponds to each @@ -35,7 +35,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "EggBackPointer", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/eggcharbase/eggCharacterCollection.I b/pandatool/src/eggcharbase/eggCharacterCollection.I index fd290a6da1..857c5ac1ac 100644 --- a/pandatool/src/eggcharbase/eggCharacterCollection.I +++ b/pandatool/src/eggcharbase/eggCharacterCollection.I @@ -96,6 +96,6 @@ get_character(int i) const { INLINE EggCharacterData *EggCharacterCollection:: get_character_by_model_index(int model_index) const { nassertr(model_index >= 0 && model_index < (int)_characters_by_model_index.size(), - (EggCharacterData *)NULL); + (EggCharacterData *)NULL); return _characters_by_model_index[model_index]; } diff --git a/pandatool/src/eggcharbase/eggCharacterCollection.cxx b/pandatool/src/eggcharbase/eggCharacterCollection.cxx index d00f936709..a455a4e0fc 100644 --- a/pandatool/src/eggcharbase/eggCharacterCollection.cxx +++ b/pandatool/src/eggcharbase/eggCharacterCollection.cxx @@ -88,7 +88,7 @@ add_egg(EggData *egg) { int model_index = _next_model_index++; if (egg_info._models.empty()) { - egg_info._first_model_index = model_index; + egg_info._first_model_index = model_index; } egg_info._models.push_back(model_root); @@ -97,7 +97,7 @@ add_egg(EggData *egg) { _characters_by_model_index.push_back(char_data); match_egg_nodes(char_data, root_joint, egg_nodes, - egg_index, model_index); + egg_index, model_index); scan_for_morphs(model_root, model_index, char_data); scan_for_sliders(model_root, model_index, char_data); @@ -232,7 +232,7 @@ scan_hierarchy(EggNode *egg_node) { EggGroupNode::iterator gi; for (gi = group->begin(); gi != group->end(); ++gi) { if (scan_hierarchy(*gi)) { - character_found = true; + character_found = true; } } } @@ -249,7 +249,7 @@ scan_hierarchy(EggNode *egg_node) { //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: scan_for_top_joints(EggNode *egg_node, EggNode *model_root, - const string &character_name) { + const string &character_name) { if (egg_node->is_of_type(EggGroup::get_class_type())) { EggGroup *group = DCAST(EggGroup, egg_node); @@ -282,7 +282,7 @@ scan_for_top_joints(EggNode *egg_node, EggNode *model_root, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: scan_for_top_tables(EggTable *bundle, EggNode *model_root, - const string &character_name) { + const string &character_name) { // We really only need to check the immediate children of the bundle // for a table node called "". EggGroupNode::iterator gi; @@ -291,16 +291,16 @@ scan_for_top_tables(EggTable *bundle, EggNode *model_root, if (child->is_of_type(EggTable::get_class_type())) { EggTable *table = DCAST(EggTable, child); if (table->get_name() == "") { - // Here it is! Now the immediate children of this node are - // the top tables. + // Here it is! Now the immediate children of this node are + // the top tables. - EggGroupNode::iterator cgi; - for (cgi = table->begin(); cgi != table->end(); ++cgi) { - EggNode *grandchild = (*cgi); - if (grandchild->is_of_type(EggTable::get_class_type())) { - _top_egg_nodes[character_name][model_root].push_back(grandchild); - } - } + EggGroupNode::iterator cgi; + for (cgi = table->begin(); cgi != table->end(); ++cgi) { + EggNode *grandchild = (*cgi); + if (grandchild->is_of_type(EggTable::get_class_type())) { + _top_egg_nodes[character_name][model_root].push_back(grandchild); + } + } } } } @@ -314,7 +314,7 @@ scan_for_top_tables(EggTable *bundle, EggNode *model_root, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: scan_for_morphs(EggNode *egg_node, int model_index, - EggCharacterData *char_data) { + EggCharacterData *char_data) { if (egg_node->is_of_type(EggPrimitive::get_class_type())) { EggPrimitive *prim = DCAST(EggPrimitive, egg_node); // Check for morphs on the primitive. @@ -329,10 +329,10 @@ scan_for_morphs(EggNode *egg_node, int model_index, EggMorphVertexList::const_iterator mvi; for (mvi = vertex->_dxyzs.begin(); - mvi != vertex->_dxyzs.end(); - ++mvi) { - const EggMorphVertex &morph = (*mvi); - char_data->make_slider(morph.get_name())->add_back_pointer(model_index, vertex); + mvi != vertex->_dxyzs.end(); + ++mvi) { + const EggMorphVertex &morph = (*mvi); + char_data->make_slider(morph.get_name())->add_back_pointer(model_index, vertex); } } } @@ -354,7 +354,7 @@ scan_for_morphs(EggNode *egg_node, int model_index, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: scan_for_sliders(EggNode *egg_node, int model_index, - EggCharacterData *char_data) { + EggCharacterData *char_data) { if (egg_node->is_of_type(EggTable::get_class_type())) { EggTable *bundle = DCAST(EggTable, egg_node); @@ -368,19 +368,19 @@ scan_for_sliders(EggNode *egg_node, int model_index, for (gi = bundle->begin(); gi != bundle->end(); ++gi) { EggNode *child = (*gi); if (child->is_of_type(EggTable::get_class_type())) { - EggTable *table = DCAST(EggTable, child); - if (table->get_name() == "morph") { - // Here it is! Now the immediate children of this node are - // all the slider channels. + EggTable *table = DCAST(EggTable, child); + if (table->get_name() == "morph") { + // Here it is! Now the immediate children of this node are + // all the slider channels. - EggGroupNode::iterator cgi; - for (cgi = table->begin(); cgi != table->end(); ++cgi) { - EggNode *grandchild = (*cgi); - if (grandchild->is_of_type(EggSAnimData::get_class_type())) { - char_data->make_slider(grandchild->get_name())->add_back_pointer(model_index, grandchild); - } - } - } + EggGroupNode::iterator cgi; + for (cgi = table->begin(); cgi != table->end(); ++cgi) { + EggNode *grandchild = (*cgi); + if (grandchild->is_of_type(EggSAnimData::get_class_type())) { + char_data->make_slider(grandchild->get_name())->add_back_pointer(model_index, grandchild); + } + } + } } } } @@ -394,7 +394,7 @@ scan_for_sliders(EggNode *egg_node, int model_index, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: add_morph_back_pointers(EggAttributes *attrib, EggObject *egg_object, - int model_index, EggCharacterData *char_data) { + int model_index, EggCharacterData *char_data) { EggMorphNormalList::const_iterator mni; for (mni = attrib->_dnormals.begin(); mni != attrib->_dnormals.end(); @@ -432,7 +432,7 @@ add_morph_back_pointers(EggAttributes *attrib, EggObject *egg_object, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: match_egg_nodes(EggCharacterData *char_data, EggJointData *joint_data, - EggNodeList &egg_nodes, int egg_index, int model_index) { + EggNodeList &egg_nodes, int egg_index, int model_index) { // Sort the list of egg_nodes in order by name. This will make the // matching up by names easier and more reliable. sort(egg_nodes.begin(), egg_nodes.end(), IndirectCompareNames()); @@ -467,21 +467,21 @@ match_egg_nodes(EggCharacterData *char_data, EggJointData *joint_data, EggJointData *data = (*di); if (egg_node->get_name() < data->get_name()) { - // Here's a joint in the egg file, unmatched in the data. - extra_egg_nodes.push_back(egg_node); - ++ei; + // Here's a joint in the egg file, unmatched in the data. + extra_egg_nodes.push_back(egg_node); + ++ei; } else if (data->get_name() < egg_node->get_name()) { - // Here's a joint in the data, umatched by the egg file. - extra_data.push_back(data); - ++di; + // Here's a joint in the data, umatched by the egg file. + extra_data.push_back(data); + ++di; } else { - // Hey, these two match! Hooray! - found_egg_match(char_data, data, egg_node, egg_index, model_index); - ++ei; - ++di; - } + // Hey, these two match! Hooray! + found_egg_match(char_data, data, egg_node, egg_index, model_index); + ++ei; + ++di; + } } while (ei != egg_nodes.end()) { @@ -510,23 +510,23 @@ match_egg_nodes(EggCharacterData *char_data, EggJointData *joint_data, EggNodeList more_egg_nodes; for (ei = extra_egg_nodes.begin(); ei != extra_egg_nodes.end(); ++ei) { - EggNode *egg_node = (*ei); - bool matched = false; - for (di = extra_data.begin(); - di != extra_data.end() && !matched; - ++di) { - EggJointData *data = (*di); - if (data->matches_name(egg_node->get_name())) { - matched = true; - found_egg_match(char_data, data, egg_node, egg_index, model_index); - extra_data.erase(di); - } - } + EggNode *egg_node = (*ei); + bool matched = false; + for (di = extra_data.begin(); + di != extra_data.end() && !matched; + ++di) { + EggJointData *data = (*di); + if (data->matches_name(egg_node->get_name())) { + matched = true; + found_egg_match(char_data, data, egg_node, egg_index, model_index); + extra_data.erase(di); + } + } - if (!matched) { - // This joint name was never seen before. - more_egg_nodes.push_back(egg_node); - } + if (!matched) { + // This joint name was never seen before. + more_egg_nodes.push_back(egg_node); + } } extra_egg_nodes.swap(more_egg_nodes); } @@ -535,24 +535,24 @@ match_egg_nodes(EggCharacterData *char_data, EggJointData *joint_data, // Ok, we've still got to find a home for these remaining // egg_nodes. if (extra_egg_nodes.size() == extra_data.size()) { - // Match 'em up one-for-one. - size_t i; - for (i = 0; i < extra_egg_nodes.size(); i++) { - EggNode *egg_node = extra_egg_nodes[i]; - EggJointData *data = extra_data[i]; - found_egg_match(char_data, data, egg_node, egg_index, model_index); - } + // Match 'em up one-for-one. + size_t i; + for (i = 0; i < extra_egg_nodes.size(); i++) { + EggNode *egg_node = extra_egg_nodes[i]; + EggJointData *data = extra_data[i]; + found_egg_match(char_data, data, egg_node, egg_index, model_index); + } } else { - // Just tack 'em on the end. - EggNodeList::iterator ei; - for (ei = extra_egg_nodes.begin(); ei != extra_egg_nodes.end(); ++ei) { - EggNode *egg_node = (*ei); - EggJointData *data = make_joint_data(char_data); - joint_data->_children.push_back(data); - data->_parent = joint_data; - found_egg_match(char_data, data, egg_node, egg_index, model_index); - } + // Just tack 'em on the end. + EggNodeList::iterator ei; + for (ei = extra_egg_nodes.begin(); ei != extra_egg_nodes.end(); ++ei) { + EggNode *egg_node = (*ei); + EggJointData *data = make_joint_data(char_data); + joint_data->_children.push_back(data); + data->_parent = joint_data; + found_egg_match(char_data, data, egg_node, egg_index, model_index); + } } } } @@ -572,7 +572,7 @@ match_egg_nodes(EggCharacterData *char_data, EggJointData *joint_data, //////////////////////////////////////////////////////////////////// void EggCharacterCollection:: found_egg_match(EggCharacterData *char_data, EggJointData *joint_data, - EggNode *egg_node, int egg_index, int model_index) { + EggNode *egg_node, int egg_index, int model_index) { if (egg_node->has_name()) { joint_data->add_name(egg_node->get_name()); } @@ -592,32 +592,32 @@ found_egg_match(EggCharacterData *char_data, EggJointData *joint_data, // A model with joints. EggGroupNode::iterator gi; for (gi = group_node->begin(); gi != group_node->end(); ++gi) { - EggNode *child = (*gi); - if (child->is_of_type(EggGroup::get_class_type())) { - EggGroup *group = DCAST(EggGroup, child); - if (group->get_group_type() == EggGroup::GT_joint) { - egg_nodes.push_back(group); - } - } + EggNode *child = (*gi); + if (child->is_of_type(EggGroup::get_class_type())) { + EggGroup *group = DCAST(EggGroup, child); + if (group->get_group_type() == EggGroup::GT_joint) { + egg_nodes.push_back(group); + } + } } } else { // An animation bundle with tables. EggGroupNode::iterator gi; for (gi = group_node->begin(); gi != group_node->end(); ++gi) { - EggNode *child = (*gi); - if (child->is_of_type(EggTable::get_class_type())) { - EggTable *table = DCAST(EggTable, child); - if (!(table->get_name() == "xform")) { - egg_nodes.push_back(table); - } - } + EggNode *child = (*gi); + if (child->is_of_type(EggTable::get_class_type())) { + EggTable *table = DCAST(EggTable, child); + if (!(table->get_name() == "xform")) { + egg_nodes.push_back(table); + } + } } } if (!egg_nodes.empty()) { match_egg_nodes(char_data, joint_data, egg_nodes, - egg_index, model_index); + egg_index, model_index); } } } diff --git a/pandatool/src/eggcharbase/eggCharacterCollection.h b/pandatool/src/eggcharbase/eggCharacterCollection.h index fe96428632..275432baf9 100644 --- a/pandatool/src/eggcharbase/eggCharacterCollection.h +++ b/pandatool/src/eggcharbase/eggCharacterCollection.h @@ -18,7 +18,7 @@ class EggTable; class EggAttributes; //////////////////////////////////////////////////////////////////// -// Class : EggCharacterCollection +// Class : EggCharacterCollection // Description : Represents a set of characters, as read and collected // from possibly several model and/or animation egg // files. @@ -68,16 +68,16 @@ public: private: bool scan_hierarchy(EggNode *egg_node); void scan_for_top_joints(EggNode *egg_node, EggNode *model_root, - const string &character_name); + const string &character_name); void scan_for_top_tables(EggTable *bundle, EggNode *model_root, - const string &character_name); + const string &character_name); void scan_for_morphs(EggNode *egg_node, int model_index, - EggCharacterData *char_data); + EggCharacterData *char_data); void scan_for_sliders(EggNode *egg_node, int model_index, - EggCharacterData *char_data); + EggCharacterData *char_data); void add_morph_back_pointers(EggAttributes *attrib, EggObject *egg_object, - int model_index, EggCharacterData *char_data); + int model_index, EggCharacterData *char_data); typedef vector EggNodeList; typedef map TopEggNodes; @@ -87,9 +87,9 @@ private: int _next_model_index; void match_egg_nodes(EggCharacterData *char_Data, EggJointData *joint_data, - EggNodeList &egg_nodes, int egg_index, int model_index); + EggNodeList &egg_nodes, int egg_index, int model_index); void found_egg_match(EggCharacterData *char_data, EggJointData *joint_data, - EggNode *egg_node, int egg_index, int model_index); + EggNode *egg_node, int egg_index, int model_index); }; #include "eggCharacterCollection.I" diff --git a/pandatool/src/eggcharbase/eggCharacterData.I b/pandatool/src/eggcharbase/eggCharacterData.I index 92d06f52d0..8d66a79fc6 100644 --- a/pandatool/src/eggcharbase/eggCharacterData.I +++ b/pandatool/src/eggcharbase/eggCharacterData.I @@ -10,6 +10,10 @@ // Access: Public // Description: Returns the total number of models associated with // this character. +// +// A "model" here is either a character model (or one +// LOD of a character model), or a character animation +// file: in either case, a hierarchy of joints. //////////////////////////////////////////////////////////////////// INLINE int EggCharacterData:: get_num_models() const { @@ -24,6 +28,10 @@ get_num_models() const { // ask questions about the particular model from the // EggCharacterCollection object, or from the individual // EggJointData and EggSliderData objects. +// +// A "model" here is either a character model (or one +// LOD of a character model), or a character animation +// file: in either case, a hierarchy of joints. //////////////////////////////////////////////////////////////////// INLINE int EggCharacterData:: get_model_index(int n) const { diff --git a/pandatool/src/eggcharbase/eggCharacterData.cxx b/pandatool/src/eggcharbase/eggCharacterData.cxx index 24601e93f5..de59556586 100644 --- a/pandatool/src/eggcharbase/eggCharacterData.cxx +++ b/pandatool/src/eggcharbase/eggCharacterData.cxx @@ -42,7 +42,13 @@ EggCharacterData:: // Access: Public // Description: Indicates that the given model_index (with the // indicated model_root) is associated with this -// character. +// character. This is normally called by the +// EggCharacterCollection class as new models are +// discovered. +// +// A "model" here is either a character model (or one +// LOD of a character model), or a character animation +// file: in either case, a hierarchy of joints. //////////////////////////////////////////////////////////////////// void EggCharacterData:: add_model(int model_index, EggNode *model_root) { diff --git a/pandatool/src/eggcharbase/eggCharacterData.h b/pandatool/src/eggcharbase/eggCharacterData.h index 62076932f1..4aaa265f20 100644 --- a/pandatool/src/eggcharbase/eggCharacterData.h +++ b/pandatool/src/eggcharbase/eggCharacterData.h @@ -20,7 +20,7 @@ class EggCharacterCollection; class EggSliderData; //////////////////////////////////////////////////////////////////// -// Class : EggCharacterData +// Class : EggCharacterData // Description : Represents a single character, as read and collected // from several models and animation files. This // contains a hierarchy of EggJointData nodes @@ -42,6 +42,9 @@ class EggSliderData; // of single precision, (b) capable of generating // modified Egg files, and (c) about a hundred times // slower than the Panda Character class. +// +// The data in this structure is normally filled in by +// the EggCharacterCollection class. //////////////////////////////////////////////////////////////////// class EggCharacterData : public Namable { public: diff --git a/pandatool/src/eggcharbase/eggCharacterFilter.cxx b/pandatool/src/eggcharbase/eggCharacterFilter.cxx index 70e2948d85..953288b9f5 100644 --- a/pandatool/src/eggcharbase/eggCharacterFilter.cxx +++ b/pandatool/src/eggcharbase/eggCharacterFilter.cxx @@ -52,7 +52,7 @@ post_command_line() { if (_collection->add_egg(data) < 0) { nout << data->get_egg_filename().get_basename() - << " does not contain a character model or animation channel.\n"; + << " does not contain a character model or animation channel.\n"; return false; } } diff --git a/pandatool/src/eggcharbase/eggCharacterFilter.h b/pandatool/src/eggcharbase/eggCharacterFilter.h index d3afec04b7..6f4829c6f1 100644 --- a/pandatool/src/eggcharbase/eggCharacterFilter.h +++ b/pandatool/src/eggcharbase/eggCharacterFilter.h @@ -14,7 +14,7 @@ class EggCharacterData; class EggCharacterCollection; //////////////////////////////////////////////////////////////////// -// Class : EggCharacterFilter +// Class : EggCharacterFilter // Description : This is the base class for a family of programs that // operate on a number of character models and their // associated animation files together. It reads in a diff --git a/pandatool/src/eggcharbase/eggComponentData.cxx b/pandatool/src/eggcharbase/eggComponentData.cxx index 52becefe41..a0328584e2 100644 --- a/pandatool/src/eggcharbase/eggComponentData.cxx +++ b/pandatool/src/eggcharbase/eggComponentData.cxx @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// EggComponentData:: EggComponentData(EggCharacterCollection *collection, - EggCharacterData *char_data) : + EggCharacterData *char_data) : _collection(collection), _char_data(char_data) { diff --git a/pandatool/src/eggcharbase/eggComponentData.h b/pandatool/src/eggcharbase/eggComponentData.h index 8fb9349d0e..899f4b545a 100644 --- a/pandatool/src/eggcharbase/eggComponentData.h +++ b/pandatool/src/eggcharbase/eggComponentData.h @@ -16,7 +16,7 @@ class EggBackPointer; class EggObject; //////////////////////////////////////////////////////////////////// -// Class : EggComponentData +// Class : EggComponentData // Description : This is the base class of both EggJointData and // EggSliderData. It represents a single component of a // character, either a joint or a slider, along with @@ -26,7 +26,7 @@ class EggObject; class EggComponentData : public Namable { public: EggComponentData(EggCharacterCollection *collection, - EggCharacterData *char_data); + EggCharacterData *char_data); virtual ~EggComponentData(); void add_name(const string &name); diff --git a/pandatool/src/eggcharbase/eggJointData.cxx b/pandatool/src/eggcharbase/eggJointData.cxx index 0fde05cb27..8de5d175c3 100644 --- a/pandatool/src/eggcharbase/eggJointData.cxx +++ b/pandatool/src/eggcharbase/eggJointData.cxx @@ -19,7 +19,7 @@ //////////////////////////////////////////////////////////////////// EggJointData:: EggJointData(EggCharacterCollection *collection, - EggCharacterData *char_data) : + EggCharacterData *char_data) : EggComponentData(collection, char_data) { _parent = (EggJointData *)NULL; @@ -121,7 +121,7 @@ do_rebuild() { EggJointPointer *joint; DCAST_INTO_R(joint, back, false); if (!joint->do_rebuild()) { - all_ok = false; + all_ok = false; } } } diff --git a/pandatool/src/eggcharbase/eggJointData.h b/pandatool/src/eggcharbase/eggJointData.h index fcfa5b5f46..ceec44e839 100644 --- a/pandatool/src/eggcharbase/eggJointData.h +++ b/pandatool/src/eggcharbase/eggJointData.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggJointData +// Class : EggJointData // Description : This is one node of a hierarchy of EggJointData // nodes, each of which represents a single joint of the // character hierarchy across all loaded files: the @@ -23,7 +23,7 @@ class EggJointData : public EggComponentData { public: EggJointData(EggCharacterCollection *collection, - EggCharacterData *char_data); + EggCharacterData *char_data); INLINE int get_num_children() const; INLINE EggJointData *get_child(int n) const; diff --git a/pandatool/src/eggcharbase/eggJointNodePointer.h b/pandatool/src/eggcharbase/eggJointNodePointer.h index e743f6e46b..9c875238c2 100644 --- a/pandatool/src/eggcharbase/eggJointNodePointer.h +++ b/pandatool/src/eggcharbase/eggJointNodePointer.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggJointNodePointer +// Class : EggJointNodePointer // Description : This stores a pointer back to a node. //////////////////////////////////////////////////////////////////// class EggJointNodePointer : public EggJointPointer { @@ -38,7 +38,7 @@ public: static void init_type() { EggJointPointer::init_type(); register_type(_type_handle, "EggJointNodePointer", - EggJointPointer::get_class_type()); + EggJointPointer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/eggcharbase/eggJointPointer.h b/pandatool/src/eggcharbase/eggJointPointer.h index b0a05a56a0..7c1d91d9ee 100644 --- a/pandatool/src/eggcharbase/eggJointPointer.h +++ b/pandatool/src/eggcharbase/eggJointPointer.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggJointPointer +// Class : EggJointPointer // Description : This is a base class for EggJointNodePointer and // EggMatrixTablePointer. It stores a back pointer to // either a entry or an xform
data, and @@ -45,7 +45,7 @@ public: static void init_type() { EggBackPointer::init_type(); register_type(_type_handle, "EggJointPointer", - EggBackPointer::get_class_type()); + EggBackPointer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx b/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx index d0bb034f57..78b08fe8ac 100644 --- a/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx +++ b/pandatool/src/eggcharbase/eggMatrixTablePointer.cxx @@ -27,19 +27,19 @@ EggMatrixTablePointer(EggObject *object) { for (ci = _table->begin(); ci != _table->end() && !found; ++ci) { EggNode *child = (*ci); if (child->get_name() == "xform") { - if (child->is_of_type(EggXfmSAnim::get_class_type())) { - _xform = DCAST(EggXfmSAnim, child); - _xform->normalize(); - found = true; + if (child->is_of_type(EggXfmSAnim::get_class_type())) { + _xform = DCAST(EggXfmSAnim, child); + _xform->normalize(); + found = true; - } else if (child->is_of_type(EggXfmAnimData::get_class_type())) { - // Quietly replace old-style XfmAnim tables with new-style - // XfmSAnim tables. - PT(EggXfmAnimData) anim = DCAST(EggXfmAnimData, child); - _xform = new EggXfmSAnim(*anim); - _table->replace(ci, _xform.p()); - found = true; - } + } else if (child->is_of_type(EggXfmAnimData::get_class_type())) { + // Quietly replace old-style XfmAnim tables with new-style + // XfmSAnim tables. + PT(EggXfmAnimData) anim = DCAST(EggXfmAnimData, child); + _xform = new EggXfmSAnim(*anim); + _table->replace(ci, _xform.p()); + found = true; + } } } } diff --git a/pandatool/src/eggcharbase/eggMatrixTablePointer.h b/pandatool/src/eggcharbase/eggMatrixTablePointer.h index 7d621b5f33..52f1379cab 100644 --- a/pandatool/src/eggcharbase/eggMatrixTablePointer.h +++ b/pandatool/src/eggcharbase/eggMatrixTablePointer.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggMatrixTablePointer +// Class : EggMatrixTablePointer // Description : This stores a pointer back to an EggXfmSAnim table // (i.e. an entry in an egg file), // corresponding to the animation data from a single @@ -45,7 +45,7 @@ public: static void init_type() { EggJointPointer::init_type(); register_type(_type_handle, "EggMatrixTablePointer", - EggJointPointer::get_class_type()); + EggJointPointer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/eggcharbase/eggSliderData.cxx b/pandatool/src/eggcharbase/eggSliderData.cxx index 317eb6291f..22a7786d47 100644 --- a/pandatool/src/eggcharbase/eggSliderData.cxx +++ b/pandatool/src/eggcharbase/eggSliderData.cxx @@ -18,7 +18,7 @@ //////////////////////////////////////////////////////////////////// EggSliderData:: EggSliderData(EggCharacterCollection *collection, - EggCharacterData *char_data) : + EggCharacterData *char_data) : EggComponentData(collection, char_data) { } diff --git a/pandatool/src/eggcharbase/eggSliderData.h b/pandatool/src/eggcharbase/eggSliderData.h index acab2726f6..f31a5b2edf 100644 --- a/pandatool/src/eggcharbase/eggSliderData.h +++ b/pandatool/src/eggcharbase/eggSliderData.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : EggSliderData +// Class : EggSliderData // Description : This corresponds to a single morph slider control. // It contains back pointers to all the vertices and // primitives that reference this slider across all @@ -22,7 +22,7 @@ class EggSliderData : public EggComponentData { public: EggSliderData(EggCharacterCollection *collection, - EggCharacterData *char_data); + EggCharacterData *char_data); virtual void add_back_pointer(int model_index, EggObject *egg_object); virtual void write(ostream &out, int indent_level = 0) const; diff --git a/pandatool/src/eggcharbase/eggVertexPointer.h b/pandatool/src/eggcharbase/eggVertexPointer.h index ceded40e3c..af917f4a06 100644 --- a/pandatool/src/eggcharbase/eggVertexPointer.h +++ b/pandatool/src/eggcharbase/eggVertexPointer.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggVertexPointer +// Class : EggVertexPointer // Description : This stores a pointer back to a , or to a // particular pritimive like a , representing a // morph offset. @@ -30,7 +30,7 @@ public: static void init_type() { EggBackPointer::init_type(); register_type(_type_handle, "EggVertexPointer", - EggBackPointer::get_class_type()); + EggBackPointer::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/pandatool/src/eggprogs/eggTextureCards.h b/pandatool/src/eggprogs/eggTextureCards.h index 34598d9f79..bf6964f0c2 100644 --- a/pandatool/src/eggprogs/eggTextureCards.h +++ b/pandatool/src/eggprogs/eggTextureCards.h @@ -16,7 +16,7 @@ class EggVertexPool; class EggVertex; //////////////////////////////////////////////////////////////////// -// Class : EggTextureCards +// Class : EggTextureCards // Description : Generates an egg file featuring a number of polygons, // one for each named texture. This is a support // program for getting textures through egg-palettize. diff --git a/pandatool/src/eggprogs/eggTopstrip.cxx b/pandatool/src/eggprogs/eggTopstrip.cxx index 4c33dfc581..bb06f4c301 100644 --- a/pandatool/src/eggprogs/eggTopstrip.cxx +++ b/pandatool/src/eggprogs/eggTopstrip.cxx @@ -96,7 +96,7 @@ run() { int channel_egg_index = _collection->add_egg(channel_egg); if (channel_egg_index < 0) { nout << _channel_filename - << " does not contain a character model or animation channel.\n"; + << " does not contain a character model or animation channel.\n"; exit(1); } @@ -130,16 +130,16 @@ run() { // The default top joint name is the alphabetically first joint // in the top level. if (root_joint->get_num_children() == 0) { - nout << "Character " << from_char->get_name() << " has no joints.\n"; - exit(1); + nout << "Character " << from_char->get_name() << " has no joints.\n"; + exit(1); } top_joint = root_joint->get_child(0); } else { top_joint = from_char->find_joint(_top_joint_name); if (top_joint == (EggJointData *)NULL) { - nout << "Character " << from_char->get_name() - << " has no joint named " << _top_joint_name << "\n"; - exit(1); + nout << "Character " << from_char->get_name() + << " has no joint named " << _top_joint_name << "\n"; + exit(1); } } @@ -156,8 +156,8 @@ run() { for (int m = 0; m < num_models; m++) { EggNode *node = char_data->get_model_root(m); if (!node->is_of_type(EggTable::get_class_type())) { - strip_anim_vertices(node, char_data->get_model_index(m), - from_model, top_joint); + strip_anim_vertices(node, char_data->get_model_index(m), + from_model, top_joint); } } } @@ -224,9 +224,9 @@ strip_anim(EggJointData *joint_data, int from_model, EggJointData *top_joint) { if (joint_data->has_model(i)) { if (!top_joint->has_model(model)) { - nout << "Warning: Joint " << top_joint->get_name() - << " is not defined in all models.\n"; - return; + nout << "Warning: Joint " << top_joint->get_name() + << " is not defined in all models.\n"; + return; } int num_into_frames = joint_data->get_num_frames(i); @@ -244,19 +244,19 @@ strip_anim(EggJointData *joint_data, int from_model, EggJointData *top_joint) { int f; for (f = 0; f < num_frames; f++) { - LMatrix4d into = joint_data->get_frame(i, f % num_into_frames); - LMatrix4d from = top_joint->get_net_frame(model, f % num_from_frames); - - adjust_transform(from); - - if (!joint->add_rebuild_frame(into * from)) { - nout << - "Cannot apply multiple frames of animation to a model file.\n" - "In general, -r cannot be used when a model file is being " - "adjusted, unless the named source is a one-frame animation " - "file, or another model file.\n"; - exit(1); - } + LMatrix4d into = joint_data->get_frame(i, f % num_into_frames); + LMatrix4d from = top_joint->get_net_frame(model, f % num_from_frames); + + adjust_transform(from); + + if (!joint->add_rebuild_frame(into * from)) { + nout << + "Cannot apply multiple frames of animation to a model file.\n" + "In general, -r cannot be used when a model file is being " + "adjusted, unless the named source is a one-frame animation " + "file, or another model file.\n"; + exit(1); + } } } } @@ -270,11 +270,11 @@ strip_anim(EggJointData *joint_data, int from_model, EggJointData *top_joint) { //////////////////////////////////////////////////////////////////// void EggTopstrip:: strip_anim_vertices(EggNode *egg_node, int into_model, int from_model, - EggJointData *top_joint) { + EggJointData *top_joint) { int model = (from_model < 0) ? into_model : from_model; if (!top_joint->has_model(model)) { nout << "Warning: Joint " << top_joint->get_name() - << " is not defined in all models.\n"; + << " is not defined in all models.\n"; return; } @@ -308,37 +308,37 @@ adjust_transform(LMatrix4d &mat) const { LVecBase3d new_translate(0.0, 0.0, 0.0); for (size_t i = 0; i < _transform_channels.size(); i++) { - switch (_transform_channels[i]) { - case 'i': - new_scale[0] = scale[0]; - break; - case 'j': - new_scale[1] = scale[1]; - break; - case 'k': - new_scale[2] = scale[2]; - break; + switch (_transform_channels[i]) { + case 'i': + new_scale[0] = scale[0]; + break; + case 'j': + new_scale[1] = scale[1]; + break; + case 'k': + new_scale[2] = scale[2]; + break; - case 'h': - new_hpr[0] = hpr[0]; - break; - case 'p': - new_hpr[1] = hpr[1]; - break; - case 'r': - new_hpr[2] = hpr[2]; - break; + case 'h': + new_hpr[0] = hpr[0]; + break; + case 'p': + new_hpr[1] = hpr[1]; + break; + case 'r': + new_hpr[2] = hpr[2]; + break; - case 'x': - new_translate[0] = translate[0]; - break; - case 'y': - new_translate[1] = translate[1]; - break; - case 'z': - new_translate[2] = translate[2]; - break; - } + case 'x': + new_translate[0] = translate[0]; + break; + case 'y': + new_translate[1] = translate[1]; + break; + case 'z': + new_translate[2] = translate[2]; + break; + } } compose_matrix(mat, new_scale, new_hpr, new_translate, _coordinate_system); diff --git a/pandatool/src/eggprogs/eggTopstrip.h b/pandatool/src/eggprogs/eggTopstrip.h index 2350e84620..080e73795f 100644 --- a/pandatool/src/eggprogs/eggTopstrip.h +++ b/pandatool/src/eggprogs/eggTopstrip.h @@ -17,7 +17,7 @@ class EggJointData; class EggJointPointer; //////////////////////////////////////////////////////////////////// -// Class : EggTopstrip +// Class : EggTopstrip // Description : Reads a character model and/or animations and strips // out the animation from one of the top joints from the // entire character. Particularly useful for generating @@ -32,9 +32,9 @@ public: void check_transform_channels(); void strip_anim(EggJointData *joint_data, int from_model, - EggJointData *top_joint); + EggJointData *top_joint); void strip_anim_vertices(EggNode *egg_node, int into_model, - int from_model, EggJointData *top_joint); + int from_model, EggJointData *top_joint); void adjust_transform(LMatrix4d &mat) const; diff --git a/pandatool/src/eggprogs/eggTrans.h b/pandatool/src/eggprogs/eggTrans.h index e5c55d2415..f9bee313ad 100644 --- a/pandatool/src/eggprogs/eggTrans.h +++ b/pandatool/src/eggprogs/eggTrans.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : EggTrans +// Class : EggTrans // Description : A program to read an egg file and write an equivalent // egg file, possibly performing some minor operations // along the way. diff --git a/pandatool/src/flt/fltBead.cxx b/pandatool/src/flt/fltBead.cxx index e5bc8a57dd..99644f75e5 100644 --- a/pandatool/src/flt/fltBead.cxx +++ b/pandatool/src/flt/fltBead.cxx @@ -110,7 +110,7 @@ get_num_transform_steps() const { FltTransformRecord *FltBead:: get_transform_step(int n) { nassertr(n >= 0 && n < (int)_transform_steps.size(), - (FltTransformRecord *)NULL); + (FltTransformRecord *)NULL); return _transform_steps[n]; } diff --git a/pandatool/src/flt/fltBead.h b/pandatool/src/flt/fltBead.h index 16dc13dd71..a3aa56d382 100644 --- a/pandatool/src/flt/fltBead.h +++ b/pandatool/src/flt/fltBead.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltBead +// Class : FltBead // Description : A base class for any of a broad family of flt records // that represent particular beads in the hierarchy. // These are things like group beads and object beads, @@ -71,7 +71,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltBead", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltBeadID.h b/pandatool/src/flt/fltBeadID.h index b3741daf81..400dc77945 100644 --- a/pandatool/src/flt/fltBeadID.h +++ b/pandatool/src/flt/fltBeadID.h @@ -11,7 +11,7 @@ #include "fltBead.h" //////////////////////////////////////////////////////////////////// -// Class : FltBeadID +// Class : FltBeadID // Description : A base class for any of a broad family of flt beads // that include an ID. //////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ public: static void init_type() { FltBead::init_type(); register_type(_type_handle, "FltBeadID", - FltBead::get_class_type()); + FltBead::get_class_type()); } private: diff --git a/pandatool/src/flt/fltCurve.h b/pandatool/src/flt/fltCurve.h index fffd1c8d28..71b108d591 100644 --- a/pandatool/src/flt/fltCurve.h +++ b/pandatool/src/flt/fltCurve.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltCurve +// Class : FltCurve // Description : A single curve, like a Bezier or B-Spline. //////////////////////////////////////////////////////////////////// class FltCurve : public FltBeadID { @@ -52,7 +52,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltCurve", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltExternalReference.h b/pandatool/src/flt/fltExternalReference.h index 0bbcc60f6b..534504ef1c 100644 --- a/pandatool/src/flt/fltExternalReference.h +++ b/pandatool/src/flt/fltExternalReference.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltExternalReference +// Class : FltExternalReference // Description : An external reference to another flt file (possibly // to a specific bead within the flt file). //////////////////////////////////////////////////////////////////// @@ -53,7 +53,7 @@ public: static void init_type() { FltBead::init_type(); register_type(_type_handle, "FltExternalReference", - FltBead::get_class_type()); + FltBead::get_class_type()); } private: diff --git a/pandatool/src/flt/fltEyepoint.h b/pandatool/src/flt/fltEyepoint.h index 2d9328627a..7386a7e012 100644 --- a/pandatool/src/flt/fltEyepoint.h +++ b/pandatool/src/flt/fltEyepoint.h @@ -14,7 +14,7 @@ class FltRecordReader; class FltRecordWriter; //////////////////////////////////////////////////////////////////// -// Class : FltEyepoint +// Class : FltEyepoint // Description : A single eyepoint entry in the eyepoint/trackplane // palette. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/flt/fltFace.h b/pandatool/src/flt/fltFace.h index c43f708afc..6004fc2cc2 100644 --- a/pandatool/src/flt/fltFace.h +++ b/pandatool/src/flt/fltFace.h @@ -11,7 +11,7 @@ #include "fltGeometry.h" //////////////////////////////////////////////////////////////////// -// Class : FltFace +// Class : FltFace // Description : A single face bead, e.g. a polygon. //////////////////////////////////////////////////////////////////// class FltFace : public FltGeometry { @@ -34,7 +34,7 @@ public: static void init_type() { FltGeometry::init_type(); register_type(_type_handle, "FltFace", - FltGeometry::get_class_type()); + FltGeometry::get_class_type()); } private: diff --git a/pandatool/src/flt/fltGeometry.I b/pandatool/src/flt/fltGeometry.I index 0ef893e9c7..c04ee0ef18 100644 --- a/pandatool/src/flt/fltGeometry.I +++ b/pandatool/src/flt/fltGeometry.I @@ -61,6 +61,6 @@ has_color() const { // On the other hand, if we have a material than we always have // color. return ((_flags & F_no_color) == 0 && - (_color_index != -1 || ((_flags & F_packed_color) != 0))) + (_color_index != -1 || ((_flags & F_packed_color) != 0))) || has_material(); } diff --git a/pandatool/src/flt/fltGeometry.cxx b/pandatool/src/flt/fltGeometry.cxx index 425533258a..6c16be07cc 100644 --- a/pandatool/src/flt/fltGeometry.cxx +++ b/pandatool/src/flt/fltGeometry.cxx @@ -64,13 +64,13 @@ get_color() const { // If we have a material, that replaces the color. FltMaterial *material = get_material(); color.set(material->_diffuse[0], - material->_diffuse[1], - material->_diffuse[2], - material->_alpha); + material->_diffuse[1], + material->_diffuse[2], + material->_alpha); } else { RGBColorf rgb = _header->get_rgb(_color_index, (_flags & F_packed_color) != 0, - _packed_color); + _packed_color); color.set(rgb[0], rgb[1], rgb[2], 1.0); } @@ -101,7 +101,7 @@ get_rgb() const { } return _header->get_rgb(_color_index, (_flags & F_packed_color) != 0, - _packed_color); + _packed_color); } //////////////////////////////////////////////////////////////////// @@ -127,7 +127,7 @@ get_alt_color() const { nassertr(has_alt_color(), Colorf(0.0, 0.0, 0.0, 0.0)); return _header->get_color(_alt_color_index, (_flags & F_packed_color) != 0, - _alt_packed_color, _transparency); + _alt_packed_color, _transparency); } //////////////////////////////////////////////////////////////////// @@ -142,7 +142,7 @@ get_alt_rgb() const { nassertr(has_alt_color(), RGBColorf(0.0, 0.0, 0.0)); return _header->get_rgb(_alt_color_index, (_flags & F_packed_color) != 0, - _alt_packed_color); + _alt_packed_color); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/flt/fltGeometry.h b/pandatool/src/flt/fltGeometry.h index 653fd8f700..e3a4196dca 100644 --- a/pandatool/src/flt/fltGeometry.h +++ b/pandatool/src/flt/fltGeometry.h @@ -18,7 +18,7 @@ class FltTexture; class FltMaterial; //////////////////////////////////////////////////////////////////// -// Class : FltGeometry +// Class : FltGeometry // Description : This is a base class for both FltFace and FltMesh, // which are two different kinds of geometric primitives // that might be encountered in a MultiGen file. They @@ -117,7 +117,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltGeometry", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltGroup.h b/pandatool/src/flt/fltGroup.h index 64f422fd58..6e421f7db8 100644 --- a/pandatool/src/flt/fltGroup.h +++ b/pandatool/src/flt/fltGroup.h @@ -11,7 +11,7 @@ #include "fltBeadID.h" //////////////////////////////////////////////////////////////////// -// Class : FltGroup +// Class : FltGroup // Description : The main grouping bead of the flt file. //////////////////////////////////////////////////////////////////// class FltGroup : public FltBeadID { @@ -47,7 +47,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltGroup", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltHeader.cxx b/pandatool/src/flt/fltHeader.cxx index 56e3116d65..c3555f1a67 100644 --- a/pandatool/src/flt/fltHeader.cxx +++ b/pandatool/src/flt/fltHeader.cxx @@ -290,8 +290,8 @@ check_version() const { if (version < min_flt_version()) { nout << "Warning! The version number of this file appears to be " - << version << ", which is older than " << min_flt_version() / 100.0 - << ", the oldest OpenFlight version understood by this program. " + << version << ", which is older than " << min_flt_version() / 100.0 + << ", the oldest OpenFlight version understood by this program. " "It is unlikely that this program will be able to read the file " "correctly.\n"; return false; @@ -299,8 +299,8 @@ check_version() const { if (version > max_flt_version()) { nout << "Warning! The version number of this file appears to be " - << version << ", which is newer than " << max_flt_version() / 100.0 - << ", the newest OpenFlight version understood by this program. " + << version << ", which is newer than " << max_flt_version() / 100.0 + << ", the newest OpenFlight version understood by this program. " "Chances are good that the program will still be able to read it " "correctly, but any features in the file that are specific to " "the latest version of OpenFlight will not be understood.\n"; @@ -528,13 +528,13 @@ get_num_colors() const { Colorf FltHeader:: get_color(int color_index) const { nassertr(color_index >= 0 && color_index < get_num_colors(), - Colorf(0.0, 0.0, 0.0, 0.0)); + Colorf(0.0, 0.0, 0.0, 0.0)); int num_color_shades = get_num_color_shades(); int index = (color_index / num_color_shades); int level = (color_index % num_color_shades); nassertr(index >= 0 && index < (int)_colors.size(), - Colorf(0.0, 0.0, 0.0, 0.0)); + Colorf(0.0, 0.0, 0.0, 0.0)); Colorf color = _colors[index].get_color(); return color * ((double)level / (double)(num_color_shades - 1)); @@ -550,13 +550,13 @@ get_color(int color_index) const { RGBColorf FltHeader:: get_rgb(int color_index) const { nassertr(color_index >= 0 && color_index < get_num_colors(), - RGBColorf(0.0, 0.0, 0.0)); + RGBColorf(0.0, 0.0, 0.0)); int num_color_shades = get_num_color_shades(); int index = (color_index / num_color_shades); int level = (color_index % num_color_shades); nassertr(index >= 0 && index < (int)_colors.size(), - RGBColorf(0.0, 0.0, 0.0)); + RGBColorf(0.0, 0.0, 0.0)); RGBColorf color = _colors[index].get_rgb(); return color * ((double)level / (double)(num_color_shades - 1)); @@ -751,8 +751,8 @@ get_num_color_shades() const { //////////////////////////////////////////////////////////////////// Colorf FltHeader:: get_color(int color_index, bool use_packed_color, - const FltPackedColor &packed_color, - int transparency) { + const FltPackedColor &packed_color, + int transparency) { if (!use_packed_color) { return get_color(color_index); } @@ -778,7 +778,7 @@ get_color(int color_index, bool use_packed_color, //////////////////////////////////////////////////////////////////// RGBColorf FltHeader:: get_rgb(int color_index, bool use_packed_color, - const FltPackedColor &packed_color) { + const FltPackedColor &packed_color) { if (!use_packed_color) { return get_rgb(color_index); } @@ -1217,13 +1217,13 @@ extract_record(FltRecordReader &reader) { iterator.skip_bytes(4); if (get_flt_version() >= 1570 && iterator.get_remaining_size() > 0) { - _delta_z = iterator.get_be_float64(); - _radius = iterator.get_be_float64(); - _next_mesh_id = iterator.get_be_int16(); - iterator.skip_bytes(2); - - // Undocumented padding. - iterator.skip_bytes(4); + _delta_z = iterator.get_be_float64(); + _radius = iterator.get_be_float64(); + _next_mesh_id = iterator.get_be_int16(); + iterator.skip_bytes(2); + + // Undocumented padding. + iterator.skip_bytes(4); } } } @@ -1356,12 +1356,12 @@ build_record(FltRecordWriter &writer) const { datagram.pad_bytes(4); if (get_flt_version() >= 1570) { - // New with 15.7 - datagram.add_be_float64(_delta_z); - datagram.add_be_float64(_radius); - datagram.add_be_int16(_next_mesh_id); - datagram.pad_bytes(2); - datagram.pad_bytes(4); + // New with 15.7 + datagram.add_be_float64(_delta_z); + datagram.add_be_float64(_radius); + datagram.add_be_int16(_next_mesh_id); + datagram.pad_bytes(2); + datagram.pad_bytes(4); } } } @@ -1685,8 +1685,8 @@ write_color_palette(FltRecordWriter &writer) const { FltPackedColor empty; while (num_colors > 0) { if (!empty.build_record(writer)) { - assert(!flt_error_abort); - return FE_invalid_record; + assert(!flt_error_abort); + return FE_invalid_record; } num_colors--; } @@ -1725,7 +1725,7 @@ write_material_palette(FltRecordWriter &writer) const { result = writer.advance(); if (result != FE_ok) { - return result; + return result; } } @@ -1745,12 +1745,12 @@ write_material_palette(FltRecordWriter &writer) const { static const int expected_material_entries = 64; for (index = 0; index < expected_material_entries; index++) { if (mi == _materials.end() || index < (*mi).first) { - dummy_material->build_14_record(datagram); + dummy_material->build_14_record(datagram); } else { - nassertr(index == (*mi).first, FE_internal); - FltMaterial *material = (*mi).second; - material->build_14_record(datagram); - ++mi; + nassertr(index == (*mi).first, FE_internal); + FltMaterial *material = (*mi).second; + material->build_14_record(datagram); + ++mi; } } diff --git a/pandatool/src/flt/fltHeader.h b/pandatool/src/flt/fltHeader.h index 2fc8156f85..ae11720393 100644 --- a/pandatool/src/flt/fltHeader.h +++ b/pandatool/src/flt/fltHeader.h @@ -22,7 +22,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltHeader +// Class : FltHeader // Description : This is the first bead in the file, the top of the // bead hierarchy, and the primary interface to reading // and writing a Flt file. You always read a Flt file @@ -171,10 +171,10 @@ public: // These functions are mainly used behind-the-scenes to decode the // strange forest of color options defined for faces and vertices. Colorf get_color(int color_index, bool use_packed_color, - const FltPackedColor &packed_color, - int transparency); + const FltPackedColor &packed_color, + int transparency); RGBColorf get_rgb(int color_index, bool use_packed_color, - const FltPackedColor &packed_color); + const FltPackedColor &packed_color); // Accessors into the material palette. bool has_material(int material_index) const; @@ -318,7 +318,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltHeader", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltInstanceDefinition.h b/pandatool/src/flt/fltInstanceDefinition.h index 2b6f21370f..110c59f2fc 100644 --- a/pandatool/src/flt/fltInstanceDefinition.h +++ b/pandatool/src/flt/fltInstanceDefinition.h @@ -11,7 +11,7 @@ #include "fltBead.h" //////////////////////////////////////////////////////////////////// -// Class : FltInstanceDefinition +// Class : FltInstanceDefinition // Description : This special kind of record marks the top node of an // instance subtree. This subtree lives outside of the // normal hierarchy, and is MultiGen's way of supporting @@ -41,7 +41,7 @@ public: static void init_type() { FltBead::init_type(); register_type(_type_handle, "FltInstanceDefinition", - FltBead::get_class_type()); + FltBead::get_class_type()); } private: diff --git a/pandatool/src/flt/fltInstanceRef.h b/pandatool/src/flt/fltInstanceRef.h index fdd45a66f7..7b7bac432c 100644 --- a/pandatool/src/flt/fltInstanceRef.h +++ b/pandatool/src/flt/fltInstanceRef.h @@ -13,7 +13,7 @@ class FltInstanceDefinition; //////////////////////////////////////////////////////////////////// -// Class : FltInstanceRef +// Class : FltInstanceRef // Description : This bead appears in the hierarchy to refer to a // FltInstanceDefinition node defined elsewhere. It // indicates that the subtree beginning at the @@ -46,7 +46,7 @@ public: static void init_type() { FltBead::init_type(); register_type(_type_handle, "FltInstanceRef", - FltBead::get_class_type()); + FltBead::get_class_type()); } private: diff --git a/pandatool/src/flt/fltLOD.h b/pandatool/src/flt/fltLOD.h index 64b1fe5e77..bc54987a69 100644 --- a/pandatool/src/flt/fltLOD.h +++ b/pandatool/src/flt/fltLOD.h @@ -11,7 +11,7 @@ #include "fltBeadID.h" //////////////////////////////////////////////////////////////////// -// Class : FltLOD +// Class : FltLOD // Description : A Level-of-Detail record. //////////////////////////////////////////////////////////////////// class FltLOD : public FltBeadID { @@ -47,7 +47,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltLOD", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltLightSourceDefinition.h b/pandatool/src/flt/fltLightSourceDefinition.h index 0eeba9ae83..c37a410919 100644 --- a/pandatool/src/flt/fltLightSourceDefinition.h +++ b/pandatool/src/flt/fltLightSourceDefinition.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltLightSourceDefinition +// Class : FltLightSourceDefinition // Description : Represents a single entry in the light source // palette. This completely defines the color, etc. of // a single light source, which may be referenced later @@ -63,7 +63,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltLightSourceDefinition", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltLocalVertexPool.cxx b/pandatool/src/flt/fltLocalVertexPool.cxx index 75a758103b..e482682d6c 100644 --- a/pandatool/src/flt/fltLocalVertexPool.cxx +++ b/pandatool/src/flt/fltLocalVertexPool.cxx @@ -55,7 +55,7 @@ extract_record(FltRecordReader &reader) { } else if ((attributes & AM_has_packed_color) != 0) { if (!vertex->_packed_color.extract_record(reader)) { - return false; + return false; } vertex->_flags |= FltVertex::F_packed_color; @@ -182,11 +182,11 @@ build_record(FltRecordWriter &writer) const { if ((attributes & AM_has_color_index) != 0) { if ((vertex->_flags & (FltVertex::F_no_color | FltVertex::F_packed_color)) != 0) { - // This particular vertex does not have a color index. - // Make it white. - datagram.add_be_int32(_header->get_closest_rgb(RGBColorf(1.0, 1.0, 1.0))); + // This particular vertex does not have a color index. + // Make it white. + datagram.add_be_int32(_header->get_closest_rgb(RGBColorf(1.0, 1.0, 1.0))); } else { - datagram.add_be_int32(vertex->_color_index); + datagram.add_be_int32(vertex->_color_index); } } else if ((attributes & AM_has_packed_color) != 0) { @@ -197,36 +197,36 @@ build_record(FltRecordWriter &writer) const { FltPackedColor color; if (vertex->has_color()) { - color.set_color(vertex->get_color()); + color.set_color(vertex->get_color()); } else { - // An uncolored vertex. Make it white. - color.set_color(Colorf(1.0, 1.0, 1.0, 1.0)); + // An uncolored vertex. Make it white. + color.set_color(Colorf(1.0, 1.0, 1.0, 1.0)); } if (!color.build_record(writer)) { - return false; + return false; } } if ((attributes & AM_has_normal) != 0) { if (!vertex->_has_normal) { - datagram.add_be_float32(0.0); - datagram.add_be_float32(0.0); - datagram.add_be_float32(0.0); + datagram.add_be_float32(0.0); + datagram.add_be_float32(0.0); + datagram.add_be_float32(0.0); } else { - datagram.add_be_float32(vertex->_normal[0]); - datagram.add_be_float32(vertex->_normal[1]); - datagram.add_be_float32(vertex->_normal[2]); + datagram.add_be_float32(vertex->_normal[0]); + datagram.add_be_float32(vertex->_normal[1]); + datagram.add_be_float32(vertex->_normal[2]); } } if ((attributes & AM_has_base_uv) != 0) { if (!vertex->_has_uv) { - datagram.add_be_float32(0.0); - datagram.add_be_float32(0.0); + datagram.add_be_float32(0.0); + datagram.add_be_float32(0.0); } else { - datagram.add_be_float32(vertex->_uv[0]); - datagram.add_be_float32(vertex->_uv[1]); + datagram.add_be_float32(vertex->_uv[0]); + datagram.add_be_float32(vertex->_uv[1]); } } } diff --git a/pandatool/src/flt/fltLocalVertexPool.h b/pandatool/src/flt/fltLocalVertexPool.h index aa4ea86940..24ca55c8e4 100644 --- a/pandatool/src/flt/fltLocalVertexPool.h +++ b/pandatool/src/flt/fltLocalVertexPool.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltLocalVertexPool +// Class : FltLocalVertexPool // Description : A local vertex pool, as might appear in the middle of // the hierarchy, for instance for a mesh. //////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltLocalVertexPool", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltMaterial.h b/pandatool/src/flt/fltMaterial.h index c5526e9256..be404e3517 100644 --- a/pandatool/src/flt/fltMaterial.h +++ b/pandatool/src/flt/fltMaterial.h @@ -15,7 +15,7 @@ class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : FltMaterial +// Class : FltMaterial // Description : Represents a single material in the material palette. //////////////////////////////////////////////////////////////////// class FltMaterial : public FltRecord { @@ -55,7 +55,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltMaterial", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltMesh.h b/pandatool/src/flt/fltMesh.h index 2ee9886951..45c75bc224 100644 --- a/pandatool/src/flt/fltMesh.h +++ b/pandatool/src/flt/fltMesh.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltMesh +// Class : FltMesh // Description : A mesh of connected polygons and tristrips, etc., // with a local vertex pool. //////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ public: static void init_type() { FltGeometry::init_type(); register_type(_type_handle, "FltMesh", - FltGeometry::get_class_type()); + FltGeometry::get_class_type()); } private: diff --git a/pandatool/src/flt/fltMeshPrimitive.cxx b/pandatool/src/flt/fltMeshPrimitive.cxx index 5409138045..5f6d4a4e96 100644 --- a/pandatool/src/flt/fltMeshPrimitive.cxx +++ b/pandatool/src/flt/fltMeshPrimitive.cxx @@ -60,7 +60,7 @@ extract_record(FltRecordReader &reader) { } else { nout << "Invalid vertex width in mesh primitive: " << vertex_width - << "\n"; + << "\n"; return false; } diff --git a/pandatool/src/flt/fltMeshPrimitive.h b/pandatool/src/flt/fltMeshPrimitive.h index bece76d44f..46509093bb 100644 --- a/pandatool/src/flt/fltMeshPrimitive.h +++ b/pandatool/src/flt/fltMeshPrimitive.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltMeshPrimitive +// Class : FltMeshPrimitive // Description : A single primitive of a mesh, like a triangle strip // or fan. //////////////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ public: static void init_type() { FltBead::init_type(); register_type(_type_handle, "FltMeshPrimitive", - FltBead::get_class_type()); + FltBead::get_class_type()); } private: diff --git a/pandatool/src/flt/fltObject.h b/pandatool/src/flt/fltObject.h index 1f19d3d281..a0eeef912d 100644 --- a/pandatool/src/flt/fltObject.h +++ b/pandatool/src/flt/fltObject.h @@ -11,7 +11,7 @@ #include "fltBeadID.h" //////////////////////////////////////////////////////////////////// -// Class : FltObject +// Class : FltObject // Description : The main objecting bead of the flt file. //////////////////////////////////////////////////////////////////// class FltObject : public FltBeadID { @@ -48,7 +48,7 @@ public: static void init_type() { FltBeadID::init_type(); register_type(_type_handle, "FltObject", - FltBeadID::get_class_type()); + FltBeadID::get_class_type()); } private: diff --git a/pandatool/src/flt/fltPackedColor.h b/pandatool/src/flt/fltPackedColor.h index 63e7543cd5..1a2800b1cf 100644 --- a/pandatool/src/flt/fltPackedColor.h +++ b/pandatool/src/flt/fltPackedColor.h @@ -15,7 +15,7 @@ class FltRecordReader; class FltRecordWriter; //////////////////////////////////////////////////////////////////// -// Class : FltPackedColor +// Class : FltPackedColor // Description : A packed color record, A, B, G, R. This appears, for // instance, within a face bead. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/flt/fltRecord.cxx b/pandatool/src/flt/fltRecord.cxx index 3b9e0d82a5..5f75b091db 100644 --- a/pandatool/src/flt/fltRecord.cxx +++ b/pandatool/src/flt/fltRecord.cxx @@ -306,7 +306,7 @@ check_remaining_size(const DatagramIterator &di) const { if (_header->get_flt_version() <= _header->max_flt_version()) { nout << "Warning! Ignoring extra " << di.get_remaining_size() - << " bytes at the end of a " << get_type() << " record.\n"; + << " bytes at the end of a " << get_type() << " record.\n"; } } @@ -558,70 +558,70 @@ read_record_and_children(FltRecordReader &reader) { // A push begins a new list of children. result = reader.advance(); if (result != FE_ok) { - return result; + return result; } while (reader.get_opcode() != FO_pop) { - PT(FltRecord) child = create_new_record(reader.get_opcode()); - FltError result = child->read_record_and_children(reader); - if (result != FE_ok) { - return result; - } + PT(FltRecord) child = create_new_record(reader.get_opcode()); + FltError result = child->read_record_and_children(reader); + if (result != FE_ok) { + return result; + } - if (child->is_of_type(FltInstanceDefinition::get_class_type())) { - // A special case for an instance definition. These - // shouldn't appear in the hierarchy, but should instead be - // added directly to the header. - _header->add_instance(DCAST(FltInstanceDefinition, child)); + if (child->is_of_type(FltInstanceDefinition::get_class_type())) { + // A special case for an instance definition. These + // shouldn't appear in the hierarchy, but should instead be + // added directly to the header. + _header->add_instance(DCAST(FltInstanceDefinition, child)); - } else { - add_child(child); - } + } else { + add_child(child); + } - if (reader.eof() || reader.error()) { - assert(!flt_error_abort); - return FE_end_of_file; - } + if (reader.eof() || reader.error()) { + assert(!flt_error_abort); + return FE_end_of_file; + } } } else if (reader.get_opcode() == FO_push_face) { // A push subface begins a new list of subfaces. result = reader.advance(); if (result != FE_ok) { - return result; + return result; } while (reader.get_opcode() != FO_pop_face) { - PT(FltRecord) subface = create_new_record(reader.get_opcode()); - FltError result = subface->read_record_and_children(reader); - if (result != FE_ok) { - return result; - } - add_subface(subface); - if (reader.eof() || reader.error()) { - assert(!flt_error_abort); - return FE_end_of_file; - } + PT(FltRecord) subface = create_new_record(reader.get_opcode()); + FltError result = subface->read_record_and_children(reader); + if (result != FE_ok) { + return result; + } + add_subface(subface); + if (reader.eof() || reader.error()) { + assert(!flt_error_abort); + return FE_end_of_file; + } } } else if (reader.get_opcode() == FO_push_extension) { // A push extension begins a new list of extensions. result = reader.advance(); if (result != FE_ok) { - return result; + return result; } while (reader.get_opcode() != FO_pop_extension) { - PT(FltRecord) extension = create_new_record(reader.get_opcode()); - FltError result = extension->read_record_and_children(reader); - if (result != FE_ok) { - return result; - } - add_extension(extension); - if (reader.eof() || reader.error()) { - assert(!flt_error_abort); - return FE_end_of_file; - } + PT(FltRecord) extension = create_new_record(reader.get_opcode()); + FltError result = extension->read_record_and_children(reader); + if (result != FE_ok) { + return result; + } + add_extension(extension); + if (reader.eof() || reader.error()) { + assert(!flt_error_abort); + return FE_end_of_file; + } } } else if (is_ancillary(reader.get_opcode())) { diff --git a/pandatool/src/flt/fltRecord.h b/pandatool/src/flt/fltRecord.h index cb8c555738..5eb6cec7eb 100644 --- a/pandatool/src/flt/fltRecord.h +++ b/pandatool/src/flt/fltRecord.h @@ -21,7 +21,7 @@ class FltRecordWriter; class DatagramIterator; //////////////////////////////////////////////////////////////////// -// Class : FltRecord +// Class : FltRecord // Description : The base class for all kinds of records in a MultiGen // OpenFlight file. A flt file consists of a hierarchy // of "beads" of various kinds, each of which may be @@ -101,7 +101,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "FltRecord", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } private: diff --git a/pandatool/src/flt/fltRecordReader.cxx b/pandatool/src/flt/fltRecordReader.cxx index 83d75a6ac1..62ccbaea7f 100644 --- a/pandatool/src/flt/fltRecordReader.cxx +++ b/pandatool/src/flt/fltRecordReader.cxx @@ -167,7 +167,7 @@ advance(bool ok_eof) { while (_next_error == FE_ok && _next_opcode == FO_continuation) { if (flt_cat.is_debug()) { flt_cat.debug() - << "Reading continuation of length " << _next_record_length << "\n"; + << "Reading continuation of length " << _next_record_length << "\n"; } // Read the continuation and tack it on. diff --git a/pandatool/src/flt/fltRecordReader.h b/pandatool/src/flt/fltRecordReader.h index 4bf8174e7a..672ebb34b5 100644 --- a/pandatool/src/flt/fltRecordReader.h +++ b/pandatool/src/flt/fltRecordReader.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltRecordReader +// Class : FltRecordReader // Description : This class turns an istream into a sequence of // FltRecords by reading a sequence of Datagrams and // extracting the opcode from each one. It remembers diff --git a/pandatool/src/flt/fltRecordWriter.cxx b/pandatool/src/flt/fltRecordWriter.cxx index 2161960d5b..4b93d0d656 100644 --- a/pandatool/src/flt/fltRecordWriter.cxx +++ b/pandatool/src/flt/fltRecordWriter.cxx @@ -91,8 +91,8 @@ advance() { do { if (flt_cat.is_debug()) { flt_cat.debug() - << "Writing " << opcode << " of length " - << write_length + header_size << "\n"; + << "Writing " << opcode << " of length " + << write_length + header_size << "\n"; } // Build a mini-datagram to write the header. diff --git a/pandatool/src/flt/fltRecordWriter.h b/pandatool/src/flt/fltRecordWriter.h index 4c26d7cc37..b8268cada0 100644 --- a/pandatool/src/flt/fltRecordWriter.h +++ b/pandatool/src/flt/fltRecordWriter.h @@ -16,7 +16,7 @@ class FltHeader; //////////////////////////////////////////////////////////////////// -// Class : FltRecordWriter +// Class : FltRecordWriter // Description : This class writes a sequence of FltRecords to an // ostream, handling opcode and size counts properly. //////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ public: FltError advance(); FltError write_record(FltOpcode opcode, - const Datagram &datagram = Datagram()); + const Datagram &datagram = Datagram()); FltError write_instance_def(FltHeader *header, int instance_index); diff --git a/pandatool/src/flt/fltTexture.cxx b/pandatool/src/flt/fltTexture.cxx index 97a85e86eb..006a5b3e1e 100644 --- a/pandatool/src/flt/fltTexture.cxx +++ b/pandatool/src/flt/fltTexture.cxx @@ -337,23 +337,23 @@ unpack_attr(const Datagram &datagram) { iterator.skip_bytes(4); while (num_points > 0) { - GeospecificControlPoint gcp; - gcp._uv[0] = iterator.get_be_float64(); - gcp._uv[1] = iterator.get_be_float64(); - gcp._real_earth[0] = iterator.get_be_float64(); - gcp._real_earth[1] = iterator.get_be_float64(); + GeospecificControlPoint gcp; + gcp._uv[0] = iterator.get_be_float64(); + gcp._uv[1] = iterator.get_be_float64(); + gcp._real_earth[0] = iterator.get_be_float64(); + gcp._real_earth[1] = iterator.get_be_float64(); } } if (iterator.get_remaining_size() != 0) { int num_defs = iterator.get_be_int32(); while (num_defs > 0) { - SubtextureDef def; - def._name = iterator.get_fixed_string(32); - def._left = iterator.get_be_int32(); - def._bottom = iterator.get_be_int32(); - def._right = iterator.get_be_int32(); - def._top = iterator.get_be_int32(); + SubtextureDef def; + def._name = iterator.get_fixed_string(32); + def._left = iterator.get_be_int32(); + def._bottom = iterator.get_be_int32(); + def._right = iterator.get_be_int32(); + def._top = iterator.get_be_int32(); } } } @@ -443,8 +443,8 @@ pack_attr(Datagram &datagram) const { datagram.pad_bytes(4); GeospecificControlPoints::const_iterator pi; for (pi = _geospecific_control_points.begin(); - pi != _geospecific_control_points.end(); - ++pi) { + pi != _geospecific_control_points.end(); + ++pi) { const GeospecificControlPoint &gcp = (*pi); datagram.add_be_float64(gcp._uv[0]); datagram.add_be_float64(gcp._uv[1]); diff --git a/pandatool/src/flt/fltTexture.h b/pandatool/src/flt/fltTexture.h index ba3ded122b..46aa2ee719 100644 --- a/pandatool/src/flt/fltTexture.h +++ b/pandatool/src/flt/fltTexture.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltTexture +// Class : FltTexture // Description : Represents a single texture in the texture palette. //////////////////////////////////////////////////////////////////// class FltTexture : public FltRecord { @@ -229,7 +229,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltTexture", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTrackplane.h b/pandatool/src/flt/fltTrackplane.h index c81fc29b50..594ef9d169 100644 --- a/pandatool/src/flt/fltTrackplane.h +++ b/pandatool/src/flt/fltTrackplane.h @@ -14,7 +14,7 @@ class FltRecordReader; class FltRecordWriter; //////////////////////////////////////////////////////////////////// -// Class : FltTrackplane +// Class : FltTrackplane // Description : A single trackplane entry in the eyepoint/trackplane // palette. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/flt/fltTransformGeneralMatrix.h b/pandatool/src/flt/fltTransformGeneralMatrix.h index 40db71c99e..85cec2451b 100644 --- a/pandatool/src/flt/fltTransformGeneralMatrix.h +++ b/pandatool/src/flt/fltTransformGeneralMatrix.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformGeneralMatrix +// Class : FltTransformGeneralMatrix // Description : A general 4x4 matrix. This appears in the flt file // when there is no record of the composition of the // transform. @@ -38,7 +38,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformGeneralMatrix", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformPut.h b/pandatool/src/flt/fltTransformPut.h index 88a56d05ce..60fd8ca8d6 100644 --- a/pandatool/src/flt/fltTransformPut.h +++ b/pandatool/src/flt/fltTransformPut.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformPut +// Class : FltTransformPut // Description : A "put", which is a MultiGen concept of defining a // transformation by mapping three arbitrary points to // three new arbitrary points. @@ -21,11 +21,11 @@ public: FltTransformPut(FltHeader *header); void set(const LPoint3d &from_origin, - const LPoint3d &from_align, - const LPoint3d &from_track, - const LPoint3d &to_origin, - const LPoint3d &to_align, - const LPoint3d &to_track); + const LPoint3d &from_align, + const LPoint3d &from_track, + const LPoint3d &to_origin, + const LPoint3d &to_align, + const LPoint3d &to_track); const LPoint3d &get_from_origin() const; const LPoint3d &get_from_align() const; @@ -59,7 +59,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformPut", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformRecord.h b/pandatool/src/flt/fltTransformRecord.h index 65cbc88e43..196c48c458 100644 --- a/pandatool/src/flt/fltTransformRecord.h +++ b/pandatool/src/flt/fltTransformRecord.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltTransformRecord +// Class : FltTransformRecord // Description : A base class for a number of types of ancillary // records that follow beads and indicate some kind of a // transformation. Pointers of this type are collected @@ -39,7 +39,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltTransformRecord", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformRotateAboutEdge.h b/pandatool/src/flt/fltTransformRotateAboutEdge.h index 6ce466033a..ab2d39bcf5 100644 --- a/pandatool/src/flt/fltTransformRotateAboutEdge.h +++ b/pandatool/src/flt/fltTransformRotateAboutEdge.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformRotateAboutEdge +// Class : FltTransformRotateAboutEdge // Description : A transformation that rotates about a particular axis // in space, defined by two endpoints. //////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformRotateAboutEdge", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformRotateAboutPoint.h b/pandatool/src/flt/fltTransformRotateAboutPoint.h index 91cda0bad4..57cb82e5bd 100644 --- a/pandatool/src/flt/fltTransformRotateAboutPoint.h +++ b/pandatool/src/flt/fltTransformRotateAboutPoint.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformRotateAboutPoint +// Class : FltTransformRotateAboutPoint // Description : A transformation that rotates about a particular axis // in space, defined by a point and vector. //////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformRotateAboutPoint", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformRotateScale.h b/pandatool/src/flt/fltTransformRotateScale.h index 5d11d2a63f..219106f952 100644 --- a/pandatool/src/flt/fltTransformRotateScale.h +++ b/pandatool/src/flt/fltTransformRotateScale.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformRotateScale +// Class : FltTransformRotateScale // Description : A combination rotation and scale. This is sometimes // called "Rotate To Point" within MultiGen. //////////////////////////////////////////////////////////////////// @@ -20,7 +20,7 @@ public: FltTransformRotateScale(FltHeader *header); void set(const LPoint3d ¢er, const LPoint3d &reference_point, - const LPoint3d &to_point, bool axis_scale); + const LPoint3d &to_point, bool axis_scale); const LPoint3d &get_center() const; const LPoint3d &get_reference_point() const; @@ -54,7 +54,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformRotateScale", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformScale.h b/pandatool/src/flt/fltTransformScale.h index da7aef9f91..8bdfca913a 100644 --- a/pandatool/src/flt/fltTransformScale.h +++ b/pandatool/src/flt/fltTransformScale.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformScale +// Class : FltTransformScale // Description : A transformation that applies a (possibly nonuniform) // scale. //////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformScale", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltTransformTranslate.h b/pandatool/src/flt/fltTransformTranslate.h index d3d46f1bb5..716c43fc5e 100644 --- a/pandatool/src/flt/fltTransformTranslate.h +++ b/pandatool/src/flt/fltTransformTranslate.h @@ -11,7 +11,7 @@ #include "fltTransformRecord.h" //////////////////////////////////////////////////////////////////// -// Class : FltTransformTranslate +// Class : FltTransformTranslate // Description : A transformation that applies a (possibly nonuniform) // scale. //////////////////////////////////////////////////////////////////// @@ -45,7 +45,7 @@ public: static void init_type() { FltTransformRecord::init_type(); register_type(_type_handle, "FltTransformTranslate", - FltTransformRecord::get_class_type()); + FltTransformRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltUnsupportedRecord.h b/pandatool/src/flt/fltUnsupportedRecord.h index 3995d36271..2faa209b4c 100644 --- a/pandatool/src/flt/fltUnsupportedRecord.h +++ b/pandatool/src/flt/fltUnsupportedRecord.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltUnsupportedRecord +// Class : FltUnsupportedRecord // Description : //////////////////////////////////////////////////////////////////// class FltUnsupportedRecord : public FltRecord { @@ -41,7 +41,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltUnsupportedRecord", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltVertex.I b/pandatool/src/flt/fltVertex.I index d022e3dd3c..8f0fa2cac8 100644 --- a/pandatool/src/flt/fltVertex.I +++ b/pandatool/src/flt/fltVertex.I @@ -15,5 +15,5 @@ has_color() const { // Even if the no_color bit is not set, if the color_index is -1, // the vertex doesn't have a color (unless we've got packed color). return ((_flags & F_no_color) == 0 && - (_color_index != -1 || ((_flags & F_packed_color) != 0))); + (_color_index != -1 || ((_flags & F_packed_color) != 0))); } diff --git a/pandatool/src/flt/fltVertex.cxx b/pandatool/src/flt/fltVertex.cxx index 738e8cec95..6c11e10eae 100644 --- a/pandatool/src/flt/fltVertex.cxx +++ b/pandatool/src/flt/fltVertex.cxx @@ -115,7 +115,7 @@ get_color() const { nassertr(has_color(), Colorf(0.0, 0.0, 0.0, 0.0)); return _header->get_color(_color_index, (_flags & F_packed_color) != 0, - _packed_color, 0); + _packed_color, 0); } //////////////////////////////////////////////////////////////////// @@ -130,7 +130,7 @@ get_rgb() const { nassertr(has_color(), RGBColorf(0.0, 0.0, 0.0)); return _header->get_rgb(_color_index, (_flags & F_packed_color) != 0, - _packed_color); + _packed_color); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/flt/fltVertex.h b/pandatool/src/flt/fltVertex.h index fefbf5fe6c..e1ab457acb 100644 --- a/pandatool/src/flt/fltVertex.h +++ b/pandatool/src/flt/fltVertex.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltVertex +// Class : FltVertex // Description : Represents a single vertex in the vertex palette. // Flt files index vertices by their byte offset in the // vertex palette; within this library, we map those @@ -69,7 +69,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltVertex", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/flt/fltVertexList.h b/pandatool/src/flt/fltVertexList.h index 33ef07747f..5d05f5af2d 100644 --- a/pandatool/src/flt/fltVertexList.h +++ b/pandatool/src/flt/fltVertexList.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltVertexList +// Class : FltVertexList // Description : A list of vertices, typically added as a child of a // face bead. //////////////////////////////////////////////////////////////////// @@ -49,7 +49,7 @@ public: static void init_type() { FltRecord::init_type(); register_type(_type_handle, "FltVertexList", - FltRecord::get_class_type()); + FltRecord::get_class_type()); } private: diff --git a/pandatool/src/fltegg/fltToEggConverter.cxx b/pandatool/src/fltegg/fltToEggConverter.cxx index e2462746ba..2ba6b9b542 100644 --- a/pandatool/src/fltegg/fltToEggConverter.cxx +++ b/pandatool/src/fltegg/fltToEggConverter.cxx @@ -393,7 +393,7 @@ convert_ext_ref(const FltExternalReference *flt_ext, FltToEggLevelState &state) state.get_synthetic_group("", flt_ext->get_transform()); handle_external_reference(egg_parent, - flt_ext->_filename, _flt_header->get_model_path()); + flt_ext->_filename, _flt_header->get_model_path()); } //////////////////////////////////////////////////////////////////// @@ -407,13 +407,13 @@ convert_ext_ref(const FltExternalReference *flt_ext, FltToEggLevelState &state) //////////////////////////////////////////////////////////////////// void FltToEggConverter:: setup_geometry(const FltGeometry *flt_geom, FltToEggLevelState &state, - EggPrimitive *egg_prim, EggVertexPool *egg_vpool, - const FltToEggConverter::EggVertices &vertices) { + EggPrimitive *egg_prim, EggVertexPool *egg_vpool, + const FltToEggConverter::EggVertices &vertices) { // Determine what the appropriate parent will be. EggGroupNode *egg_parent = state.get_synthetic_group(flt_geom->get_id(), flt_geom->get_transform(), - flt_geom->_billboard_type); + flt_geom->_billboard_type); // Create a new state to reflect the new parent. FltToEggLevelState next_state(state); @@ -484,15 +484,15 @@ setup_geometry(const FltGeometry *flt_geom, FltToEggLevelState &state, for (vi = vertices.begin(); vi != vertices.end(); ++vi) { EggVertex *vertex = (*vi); if (vertex->has_color()) { - Colorf vertex_color = vertex->get_color(); - vertex_color[3] = face_color[3]; - vertex->set_color(vertex_color); + Colorf vertex_color = vertex->get_color(); + vertex_color[3] = face_color[3]; + vertex->set_color(vertex_color); } else { - if (flt_geom->has_color()) { - // If a vertex doesn't have a color but the face does, set - // the vertex to use the face color. - vertex->set_color(face_color); - } + if (flt_geom->has_color()) { + // If a vertex doesn't have a color but the face does, set + // the vertex to use the face color. + vertex->set_color(face_color); + } } } @@ -632,7 +632,7 @@ parse_comment(const FltTexture *flt_texture, EggNode *egg_node) { //////////////////////////////////////////////////////////////////// bool FltToEggConverter:: parse_comment(const string &comment, const string &name, - EggNode *egg_node) { + EggNode *egg_node) { if (comment.empty()) { // No comment. return true; @@ -644,7 +644,7 @@ parse_comment(const string &comment, const string &name, size_t p; p = 0; while (p < comment.length() && - cmp_nocase(comment.substr(p, 5), egg_str) != 0) { + cmp_nocase(comment.substr(p, 5), egg_str) != 0) { p++; } @@ -660,7 +660,7 @@ parse_comment(const string &comment, const string &name, } if (p >= comment.length() || comment[p] != '{') { nout << "No opening brace in comment for " - << name << "\n\n"; + << name << "\n\n"; _error = true; return false; } @@ -674,7 +674,7 @@ parse_comment(const string &comment, const string &name, } if (q == p) { nout << "No closing brace in comment for " - << name << "\n\n"; + << name << "\n\n"; _error = true; return false; } @@ -683,7 +683,7 @@ parse_comment(const string &comment, const string &name, if (!egg_node->parse_egg(egg_syntax)) { nout << "Syntax error in comment for " - << name << "\n\n"; + << name << "\n\n"; _error = true; return false; } @@ -739,8 +739,8 @@ make_egg_texture(const FltTexture *flt_texture) { string tref_name = format_string(flt_texture->_pattern_index); Filename filename = convert_texture_path(flt_texture->_filename, - _flt_header->get_texture_path()); - + _flt_header->get_texture_path()); + PT(EggTexture) egg_texture = new EggTexture(tref_name, filename); _textures.insert(Textures::value_type(flt_texture, egg_texture)); diff --git a/pandatool/src/fltegg/fltToEggConverter.h b/pandatool/src/fltegg/fltToEggConverter.h index 20b0185037..50bb0a6bbf 100644 --- a/pandatool/src/fltegg/fltToEggConverter.h +++ b/pandatool/src/fltegg/fltToEggConverter.h @@ -32,7 +32,7 @@ class EggGroupNode; class EggPrimitive; //////////////////////////////////////////////////////////////////// -// Class : FltToEggConverter +// Class : FltToEggConverter // Description : This class supervises the construction of an EggData // structure from the data represented by the FltHeader. // Reading and writing the egg and flt structures is @@ -66,10 +66,10 @@ private: void convert_bead(const FltBead *flt_bead, FltToEggLevelState &state); void convert_face(const FltFace *flt_face, FltToEggLevelState &state); void convert_ext_ref(const FltExternalReference *flt_ext, FltToEggLevelState &state); - + void setup_geometry(const FltGeometry *flt_geom, FltToEggLevelState &state, - EggPrimitive *egg_prim, EggVertexPool *egg_vpool, - const EggVertices &vertices); + EggPrimitive *egg_prim, EggVertexPool *egg_vpool, + const EggVertices &vertices); void convert_subfaces(const FltRecord *flt_record, FltToEggLevelState &state); @@ -78,7 +78,7 @@ private: bool parse_comment(const FltBead *flt_bead, EggNode *egg_node); bool parse_comment(const FltTexture *flt_texture, EggNode *egg_node); bool parse_comment(const string &comment, const string &name, - EggNode *egg_node); + EggNode *egg_node); PT(EggVertex) make_egg_vertex(const FltVertex *flt_vertex); PT(EggTexture) make_egg_texture(const FltTexture *flt_texture); diff --git a/pandatool/src/fltegg/fltToEggLevelState.cxx b/pandatool/src/fltegg/fltToEggLevelState.cxx index b1a8ae9015..66cbc48f81 100644 --- a/pandatool/src/fltegg/fltToEggLevelState.cxx +++ b/pandatool/src/fltegg/fltToEggLevelState.cxx @@ -50,8 +50,8 @@ ParentNodes() { //////////////////////////////////////////////////////////////////// EggGroupNode *FltToEggLevelState:: get_synthetic_group(const string &name, - const LMatrix4d &transform, - FltGeometry::BillboardType type) { + const LMatrix4d &transform, + FltGeometry::BillboardType type) { bool is_identity = transform.almost_equal(LMatrix4d::ident_mat()); if (is_identity && type == FltGeometry::BT_none) { @@ -79,8 +79,8 @@ get_synthetic_group(const string &name, _egg_parent->add_child(nodes->_axial_billboard); nodes->_axial_billboard->set_billboard_type(EggGroup::BT_axis); if (!is_identity) { - nodes->_axial_billboard->set_transform(transform); - nodes->_axial_billboard->set_group_type(EggGroup::GT_instance); + nodes->_axial_billboard->set_transform(transform); + nodes->_axial_billboard->set_group_type(EggGroup::GT_instance); } } return nodes->_axial_billboard; @@ -91,8 +91,8 @@ get_synthetic_group(const string &name, _egg_parent->add_child(nodes->_point_billboard); nodes->_point_billboard->set_billboard_type(EggGroup::BT_point_world_relative); if (!is_identity) { - nodes->_point_billboard->set_transform(transform); - nodes->_point_billboard->set_group_type(EggGroup::GT_instance); + nodes->_point_billboard->set_transform(transform); + nodes->_point_billboard->set_group_type(EggGroup::GT_instance); } } return nodes->_point_billboard; @@ -102,8 +102,8 @@ get_synthetic_group(const string &name, nodes->_plain = new EggGroup(name); _egg_parent->add_child(nodes->_plain); if (!is_identity) { - nodes->_plain->set_transform(transform); - nodes->_plain->set_group_type(EggGroup::GT_instance); + nodes->_plain->set_transform(transform); + nodes->_plain->set_group_type(EggGroup::GT_instance); } } return nodes->_plain; diff --git a/pandatool/src/fltegg/fltToEggLevelState.h b/pandatool/src/fltegg/fltToEggLevelState.h index e01d8f8b1b..ab83dd20f0 100644 --- a/pandatool/src/fltegg/fltToEggLevelState.h +++ b/pandatool/src/fltegg/fltToEggLevelState.h @@ -15,7 +15,7 @@ class EggGroupNode; class EggGroup; //////////////////////////////////////////////////////////////////// -// Class : FltToEggLevelState +// Class : FltToEggLevelState // Description : This keeps track of relevant things about the // traversal as we walk through the flt hierarchy. //////////////////////////////////////////////////////////////////// @@ -27,8 +27,8 @@ public: ~FltToEggLevelState(); EggGroupNode *get_synthetic_group(const string &name, - const LMatrix4d &transform, - FltGeometry::BillboardType type = FltGeometry::BT_none); + const LMatrix4d &transform, + FltGeometry::BillboardType type = FltGeometry::BT_none); const FltObject *_flt_object; EggGroupNode *_egg_parent; diff --git a/pandatool/src/fltprogs/fltCopy.cxx b/pandatool/src/fltprogs/fltCopy.cxx index 9af7a3b23b..62a55b620f 100644 --- a/pandatool/src/fltprogs/fltCopy.cxx +++ b/pandatool/src/fltprogs/fltCopy.cxx @@ -72,7 +72,7 @@ run() { //////////////////////////////////////////////////////////////////// bool FltCopy:: copy_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir, void *extra_data, bool new_file) { + CVSSourceDirectory *dir, void *extra_data, bool new_file) { ExtraData *ed = (ExtraData *)extra_data; switch (ed->_type) { case FT_flt: @@ -93,7 +93,7 @@ copy_file(const Filename &source, const Filename &dest, //////////////////////////////////////////////////////////////////// bool FltCopy:: copy_flt_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir) { + CVSSourceDirectory *dir) { PT(FltHeader) header = new FltHeader; header->set_texture_path(_search_path); header->set_model_path(_search_path); @@ -122,21 +122,21 @@ copy_flt_file(const Filename &source, const Filename &dest, if (!ref_filename.exists()) { nout << "*** Warning: external reference " << ref_filename - << " does not exist.\n"; + << " does not exist.\n"; } else { ExtraData ed; ed._type = FT_flt; CVSSourceDirectory *ref_dir = - import(ref_filename, &ed, _model_dir); + import(ref_filename, &ed, _model_dir); if (ref_dir == (CVSSourceDirectory *)NULL) { - return false; + return false; } // Update the reference to point to the new flt filename, relative // to the base flt file. ref->_filename = dir->get_rel_to(ref_dir) + "/" + - ref_filename.get_basename(); + ref_filename.get_basename(); } } @@ -152,22 +152,22 @@ copy_flt_file(const Filename &source, const Filename &dest, if (!texture_filename.exists()) { nout << "*** Warning: texture " << texture_filename - << " does not exist.\n"; + << " does not exist.\n"; } else { ExtraData ed; ed._type = FT_texture; ed._texture = tex; CVSSourceDirectory *texture_dir = - import(texture_filename, &ed, _map_dir); + import(texture_filename, &ed, _map_dir); if (texture_dir == (CVSSourceDirectory *)NULL) { - return false; + return false; } // Update the texture reference to point to the new texture // filename, relative to the flt file. tex->_filename = dir->get_rel_to(texture_dir) + "/" + - texture_filename.get_basename(); + texture_filename.get_basename(); header->add_texture(tex); } } @@ -189,7 +189,7 @@ copy_flt_file(const Filename &source, const Filename &dest, //////////////////////////////////////////////////////////////////// bool FltCopy:: copy_texture(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir, FltTexture *tex, bool new_file) { + CVSSourceDirectory *dir, FltTexture *tex, bool new_file) { if (!copy_binary_file(source, dest)) { return false; } diff --git a/pandatool/src/fltprogs/fltCopy.h b/pandatool/src/fltprogs/fltCopy.h index efa2cf4cdf..26d99dded8 100644 --- a/pandatool/src/fltprogs/fltCopy.h +++ b/pandatool/src/fltprogs/fltCopy.h @@ -20,7 +20,7 @@ class FltTexture; class FltExternalReference; //////////////////////////////////////////////////////////////////// -// Class : FltCopy +// Class : FltCopy // Description : A program to copy Multigen .flt files into the cvs // tree. It copies the base file plus all externally // referenced files as well as all textures. @@ -33,8 +33,8 @@ public: protected: virtual bool copy_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir, void *extra_data, - bool new_file); + CVSSourceDirectory *dir, void *extra_data, + bool new_file); private: enum FileType { @@ -49,10 +49,10 @@ private: }; bool copy_flt_file(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir); + CVSSourceDirectory *dir); bool copy_texture(const Filename &source, const Filename &dest, - CVSSourceDirectory *dir, FltTexture *tex, - bool new_file); + CVSSourceDirectory *dir, FltTexture *tex, + bool new_file); typedef set Refs; diff --git a/pandatool/src/fltprogs/fltToEgg.h b/pandatool/src/fltprogs/fltToEgg.h index 0ccd16c2f9..fd3308ff3e 100644 --- a/pandatool/src/fltprogs/fltToEgg.h +++ b/pandatool/src/fltprogs/fltToEgg.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltToEgg +// Class : FltToEgg // Description : A program to read a flt file and generate an egg // file. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/fltprogs/fltTrans.cxx b/pandatool/src/fltprogs/fltTrans.cxx index 614d0d1c60..64b981bc17 100644 --- a/pandatool/src/fltprogs/fltTrans.cxx +++ b/pandatool/src/fltprogs/fltTrans.cxx @@ -61,11 +61,11 @@ run() { if (_got_new_version) { int new_version = (int)floor(_new_version * 100.0 + 0.5); if (new_version < FltHeader::min_flt_version() || - new_version > FltHeader::max_flt_version()) { + new_version > FltHeader::max_flt_version()) { nout << "Cannot write flt files of version " << new_version / 100.0 - << ". This program only understands how to write flt files between version " - << FltHeader::min_flt_version() / 100.0 << " and " - << FltHeader::max_flt_version() / 100.0 << ".\n"; + << ". This program only understands how to write flt files between version " + << FltHeader::min_flt_version() / 100.0 << " and " + << FltHeader::max_flt_version() / 100.0 << ".\n"; exit(1); } } diff --git a/pandatool/src/fltprogs/fltTrans.h b/pandatool/src/fltprogs/fltTrans.h index 34e987ab80..304f09c9db 100644 --- a/pandatool/src/fltprogs/fltTrans.h +++ b/pandatool/src/fltprogs/fltTrans.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : FltTrans +// Class : FltTrans // Description : A program to read a flt file and write an equivalent // flt file, possibly performing some minor operations // along the way. diff --git a/pandatool/src/gtk-stats/gtkStats.h b/pandatool/src/gtk-stats/gtkStats.h index ea7d661667..8347e4a8b9 100644 --- a/pandatool/src/gtk-stats/gtkStats.h +++ b/pandatool/src/gtk-stats/gtkStats.h @@ -13,7 +13,7 @@ class GtkStatsMainWindow; //////////////////////////////////////////////////////////////////// -// Class : GtkStats +// Class : GtkStats // Description : A fancy graphical pstats server written using gtk+ // (actually, Gtk--, the C++ layer over gtk+). //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/gtk-stats/gtkStatsBadVersionWindow.h b/pandatool/src/gtk-stats/gtkStatsBadVersionWindow.h index bbca193106..643aa1c585 100644 --- a/pandatool/src/gtk-stats/gtkStatsBadVersionWindow.h +++ b/pandatool/src/gtk-stats/gtkStatsBadVersionWindow.h @@ -13,7 +13,7 @@ class GtkStatsMonitor; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsBadVersionWindow +// Class : GtkStatsBadVersionWindow // Description : This window is popped up to indicated an attempted // connection from an invalid client. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/gtk-stats/gtkStatsGuide.cxx b/pandatool/src/gtk-stats/gtkStatsGuide.cxx index d0a2ad8541..ae012761ce 100644 --- a/pandatool/src/gtk-stats/gtkStatsGuide.cxx +++ b/pandatool/src/gtk-stats/gtkStatsGuide.cxx @@ -68,7 +68,7 @@ expose_event_impl(GdkEventExpose *event) { if (y >= 5) { // Only draw it if it's not too close to the top. window.draw_string(font, fg_gc, 0, y + text_ascent / 2, - bar._label); + bar._label); } } diff --git a/pandatool/src/gtk-stats/gtkStatsGuide.h b/pandatool/src/gtk-stats/gtkStatsGuide.h index cca31f6182..c63c193809 100644 --- a/pandatool/src/gtk-stats/gtkStatsGuide.h +++ b/pandatool/src/gtk-stats/gtkStatsGuide.h @@ -13,7 +13,7 @@ class PStatStripChart; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsGuide +// Class : GtkStatsGuide // Description : A widget designed to be drawn next to a // GtkStatsStripChart that shows the labels associated // with the strip chart's guide bars. diff --git a/pandatool/src/gtk-stats/gtkStatsLabel.cxx b/pandatool/src/gtk-stats/gtkStatsLabel.cxx index 290867b40f..733cb78204 100644 --- a/pandatool/src/gtk-stats/gtkStatsLabel.cxx +++ b/pandatool/src/gtk-stats/gtkStatsLabel.cxx @@ -17,7 +17,7 @@ //////////////////////////////////////////////////////////////////// GtkStatsLabel:: GtkStatsLabel(PStatMonitor *monitor, int collector_index, - Gdk_Font font) : + Gdk_Font font) : _collector_index(collector_index), _font(font) { @@ -109,8 +109,8 @@ expose_event_impl(GdkEventExpose *event) { window.draw_rectangle(_reverse_gc, true, 0, 0, width(), height()); window.draw_string(_font, _gc, width() - text_width - 2, - height() - (height() - text_height) / 2 - _font.descent(), - _text); + height() - (height() - text_height) / 2 - _font.descent(), + _text); return false; } diff --git a/pandatool/src/gtk-stats/gtkStatsLabel.h b/pandatool/src/gtk-stats/gtkStatsLabel.h index 5c117df222..f52439107d 100644 --- a/pandatool/src/gtk-stats/gtkStatsLabel.h +++ b/pandatool/src/gtk-stats/gtkStatsLabel.h @@ -13,7 +13,7 @@ class PStatMonitor; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsLabel +// Class : GtkStatsLabel // Description : A text label that will draw in color appropriate for // a particular collector, instead of referring to some // dumb Gtk::Style. It also throws a signal when the @@ -24,7 +24,7 @@ class PStatMonitor; class GtkStatsLabel : public Gtk::DrawingArea { public: GtkStatsLabel(PStatMonitor *monitor, int collector_index, - Gdk_Font font); + Gdk_Font font); int get_width() const; int get_height() const; diff --git a/pandatool/src/gtk-stats/gtkStatsMainWindow.h b/pandatool/src/gtk-stats/gtkStatsMainWindow.h index 8a3bfaf2a6..dd039d123f 100644 --- a/pandatool/src/gtk-stats/gtkStatsMainWindow.h +++ b/pandatool/src/gtk-stats/gtkStatsMainWindow.h @@ -13,7 +13,7 @@ class GtkStatsServer; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsMainWindow +// Class : GtkStatsMainWindow // Description : This is the main window that's opened up and stays up // all the time when you run gtk-stats. It just shows // that it's running. diff --git a/pandatool/src/gtk-stats/gtkStatsMonitor.h b/pandatool/src/gtk-stats/gtkStatsMonitor.h index d65e70dd30..d279eba543 100644 --- a/pandatool/src/gtk-stats/gtkStatsMonitor.h +++ b/pandatool/src/gtk-stats/gtkStatsMonitor.h @@ -18,7 +18,7 @@ class GtkStatsWindow; class Gdk_Color; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsMonitor +// Class : GtkStatsMonitor // Description : //////////////////////////////////////////////////////////////////// class GtkStatsMonitor : public PStatMonitor { diff --git a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx index 8224167c19..d10cc416eb 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx +++ b/pandatool/src/gtk-stats/gtkStatsPianoRoll.cxx @@ -22,7 +22,7 @@ //////////////////////////////////////////////////////////////////// GtkStatsPianoRoll:: GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index, - int xsize, int ysize) : + int xsize, int ysize) : PStatPianoRoll(monitor, thread_index, xsize, ysize) { _is_dead = false; @@ -120,9 +120,9 @@ begin_draw() { if (x >= 5 && x <= get_xsize() - 5) { // Only draw it if it's not too close to either edge. if (bar._is_target) { - _pixmap.draw_line(_light_gc, x, text_height + 4, x, get_ysize()); + _pixmap.draw_line(_light_gc, x, text_height + 4, x, get_ysize()); } else { - _pixmap.draw_line(_dark_gc, x, text_height + 4, x, get_ysize()); + _pixmap.draw_line(_dark_gc, x, text_height + 4, x, get_ysize()); } } } @@ -139,7 +139,7 @@ draw_bar(int row, int from_x, int to_x) { if (row >= 0 && row < (int)_y_positions.size()) { int y = height() - _y_positions[row]; _pixmap.draw_rectangle(get_collector_gc(get_label_collector(row)), - true, from_x, y - 6, to_x - from_x, 12); + true, from_x, y - 6, to_x - from_x, 12); } } @@ -168,7 +168,7 @@ end_draw() { // Only draw it if it's not too close to either edge. int width = font.string_measure(bar._label); _pixmap.draw_string(font, _black_gc, x - width / 2, text_ascent + 2, - bar._label); + bar._label); } } @@ -242,9 +242,9 @@ configure_event_impl(GdkEventConfigure *) { gint GtkStatsPianoRoll:: expose_event_impl(GdkEventExpose *event) { get_window().draw_pixmap(_white_gc, _pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + event->area.x, event->area.y, + event->area.x, event->area.y, + event->area.width, event->area.height); return false; } diff --git a/pandatool/src/gtk-stats/gtkStatsPianoRoll.h b/pandatool/src/gtk-stats/gtkStatsPianoRoll.h index d9b508e8c8..af56f3380f 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoRoll.h +++ b/pandatool/src/gtk-stats/gtkStatsPianoRoll.h @@ -20,7 +20,7 @@ class PStatView; class GtkStatsGuide; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsPianoRoll +// Class : GtkStatsPianoRoll // Description : A special widget that draws a piano-roll style chart, // which shows the collectors explicitly stopping and // starting, one frame at a time. @@ -28,7 +28,7 @@ class GtkStatsGuide; class GtkStatsPianoRoll : public Gtk::DrawingArea, public PStatPianoRoll { public: GtkStatsPianoRoll(GtkStatsMonitor *monitor, int thread_index, - int xsize, int ysize); + int xsize, int ysize); void mark_dead(); diff --git a/pandatool/src/gtk-stats/gtkStatsPianoWindow.cxx b/pandatool/src/gtk-stats/gtkStatsPianoWindow.cxx index e0ad296392..99281bda1b 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoWindow.cxx +++ b/pandatool/src/gtk-stats/gtkStatsPianoWindow.cxx @@ -16,7 +16,7 @@ using Gtk::Menu_Helpers::SeparatorElem; //////////////////////////////////////////////////////////////////// GtkStatsPianoWindow:: GtkStatsPianoWindow(GtkStatsMonitor *monitor, int thread_index, - int chart_xsize, int chart_ysize) : + int chart_xsize, int chart_ysize) : GtkStatsWindow(monitor), _thread_index(thread_index) { @@ -63,28 +63,28 @@ setup_menu() { scale_menu->items().push_back (MenuElem("0.1 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 0.1f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 0.1f))); scale_menu->items().push_back (MenuElem("1 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 1.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 1.0f))); scale_menu->items().push_back (MenuElem("5 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 5.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 5.0f))); scale_menu->items().push_back (MenuElem("10 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 10.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 10.0f))); scale_menu->items().push_back (MenuElem("20 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 20.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 20.0f))); scale_menu->items().push_back (MenuElem("30 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 30.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 30.0f))); scale_menu->items().push_back (MenuElem("60 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 60.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 60.0f))); scale_menu->items().push_back (MenuElem("120 Hz", - bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 120.0f))); + bind(slot(this, &GtkStatsPianoWindow::menu_hscale), 120.0f))); _menu->items().push_back(MenuElem("Scale", *manage(scale_menu))); } @@ -97,7 +97,7 @@ setup_menu() { void GtkStatsPianoWindow:: menu_new_window() { new GtkStatsPianoWindow(_monitor, _thread_index, - _chart->get_xsize(), _chart->get_ysize()); + _chart->get_xsize(), _chart->get_ysize()); } //////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ layout_window(int chart_xsize, int chart_ysize) { chart_table->attach(*manage(frame), 1, 2, 0, 1); _chart = new GtkStatsPianoRoll(_monitor, _thread_index, - chart_xsize, chart_ysize); + chart_xsize, chart_ysize); frame->add(*manage(_chart)); // We put the labels in a frame, too, so they'll line up vertically. @@ -145,7 +145,7 @@ layout_window(int chart_xsize, int chart_ysize) { label_frame->add(*manage(_chart->get_labels())); chart_table->attach(*manage(label_frame), 0, 1, 0, 1, - 0, (GTK_FILL|GTK_EXPAND), 4, 0); + 0, (GTK_FILL|GTK_EXPAND), 4, 0); _chart->show(); } diff --git a/pandatool/src/gtk-stats/gtkStatsPianoWindow.h b/pandatool/src/gtk-stats/gtkStatsPianoWindow.h index e5d5c136bd..271528d2e2 100644 --- a/pandatool/src/gtk-stats/gtkStatsPianoWindow.h +++ b/pandatool/src/gtk-stats/gtkStatsPianoWindow.h @@ -14,13 +14,13 @@ class GtkStatsPianoRoll; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsPianoWindow +// Class : GtkStatsPianoWindow // Description : A window that contains a GtkStatsPianoRoll. //////////////////////////////////////////////////////////////////// class GtkStatsPianoWindow : public GtkStatsWindow { public: GtkStatsPianoWindow(GtkStatsMonitor *monitor, int thread_index, - int chart_xsize, int chart_ysize); + int chart_xsize, int chart_ysize); virtual void mark_dead(); virtual void idle(); diff --git a/pandatool/src/gtk-stats/gtkStatsServer.h b/pandatool/src/gtk-stats/gtkStatsServer.h index 9899bd1b72..160ae53caa 100644 --- a/pandatool/src/gtk-stats/gtkStatsServer.h +++ b/pandatool/src/gtk-stats/gtkStatsServer.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : GtkStatsServer +// Class : GtkStatsServer // Description : //////////////////////////////////////////////////////////////////// class GtkStatsServer : public PStatServer { diff --git a/pandatool/src/gtk-stats/gtkStatsStripChart.cxx b/pandatool/src/gtk-stats/gtkStatsStripChart.cxx index 6486a33309..500f6a4f45 100644 --- a/pandatool/src/gtk-stats/gtkStatsStripChart.cxx +++ b/pandatool/src/gtk-stats/gtkStatsStripChart.cxx @@ -22,7 +22,7 @@ //////////////////////////////////////////////////////////////////// GtkStatsStripChart:: GtkStatsStripChart(GtkStatsMonitor *monitor, PStatView &view, - int collector_index, int xsize, int ysize) : + int collector_index, int xsize, int ysize) : PStatStripChart(monitor, view, collector_index, xsize, ysize) { _is_dead = false; @@ -137,8 +137,8 @@ clear_region() { void GtkStatsStripChart:: copy_region(int start_x, int end_x, int dest_x) { _pixmap.copy_area(_white_gc, 0, 0, - _pixmap, start_x, 0, - end_x - start_x + 1, get_ysize()); + _pixmap, start_x, 0, + end_x - start_x + 1, get_ysize()); // We could make a window-to-window copy to implement scrolling in // the window. But this leads to trouble if the scrolling window @@ -148,8 +148,8 @@ copy_region(int start_x, int end_x, int dest_x) { /* Gdk_Window window = get_window(); window.copy_area(_white_gc, 0, 0, - window, start_x, 0, - end_x - start_x + 1, get_ysize()); + window, start_x, 0, + end_x - start_x + 1, get_ysize()); */ GdkRectangle update_rect; @@ -235,9 +235,9 @@ end_draw(int from_x, int to_x) { if (y >= 5) { // Only draw it if it's not too close to the top. if (bar._is_target) { - _pixmap.draw_line(_light_gc, from_x, y, to_x, y); + _pixmap.draw_line(_light_gc, from_x, y, to_x, y); } else { - _pixmap.draw_line(_dark_gc, from_x, y, to_x, y); + _pixmap.draw_line(_dark_gc, from_x, y, to_x, y); } } } @@ -323,9 +323,9 @@ configure_event_impl(GdkEventConfigure *) { gint GtkStatsStripChart:: expose_event_impl(GdkEventExpose *event) { get_window().draw_pixmap(_white_gc, _pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + event->area.x, event->area.y, + event->area.x, event->area.y, + event->area.width, event->area.height); return false; } diff --git a/pandatool/src/gtk-stats/gtkStatsStripChart.h b/pandatool/src/gtk-stats/gtkStatsStripChart.h index 0cb13584f3..524f13b95d 100644 --- a/pandatool/src/gtk-stats/gtkStatsStripChart.h +++ b/pandatool/src/gtk-stats/gtkStatsStripChart.h @@ -20,15 +20,15 @@ class PStatView; class GtkStatsGuide; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsStripChart +// Class : GtkStatsStripChart // Description : A special widget that draws a strip chart, given a // view. //////////////////////////////////////////////////////////////////// class GtkStatsStripChart : public Gtk::DrawingArea, public PStatStripChart { public: GtkStatsStripChart(GtkStatsMonitor *monitor, - PStatView &view, int collector_index, - int xsize, int ysize); + PStatView &view, int collector_index, + int xsize, int ysize); void mark_dead(); diff --git a/pandatool/src/gtk-stats/gtkStatsStripWindow.cxx b/pandatool/src/gtk-stats/gtkStatsStripWindow.cxx index d1a64c4b0d..31f80f138c 100644 --- a/pandatool/src/gtk-stats/gtkStatsStripWindow.cxx +++ b/pandatool/src/gtk-stats/gtkStatsStripWindow.cxx @@ -23,7 +23,7 @@ using Gtk::Menu_Helpers::SeparatorElem; //////////////////////////////////////////////////////////////////// GtkStatsStripWindow:: GtkStatsStripWindow(GtkStatsMonitor *monitor, int thread_index, - int collector_index, bool show_level, + int collector_index, bool show_level, int chart_xsize, int chart_ysize) : GtkStatsWindow(monitor), _thread_index(thread_index), @@ -144,19 +144,19 @@ setup_menu() { speed_menu->items().push_back (MenuElem("1", // 1 chart width scrolls by per minute. - bind(slot(this, &GtkStatsStripWindow::menu_hscale), 1.0f))); + bind(slot(this, &GtkStatsStripWindow::menu_hscale), 1.0f))); speed_menu->items().push_back (MenuElem("2", // 2 chart widths scroll by per minute. - bind(slot(this, &GtkStatsStripWindow::menu_hscale), 2.0f))); + bind(slot(this, &GtkStatsStripWindow::menu_hscale), 2.0f))); speed_menu->items().push_back (MenuElem("3", - bind(slot(this, &GtkStatsStripWindow::menu_hscale), 3.0f))); + bind(slot(this, &GtkStatsStripWindow::menu_hscale), 3.0f))); speed_menu->items().push_back (MenuElem("6", - bind(slot(this, &GtkStatsStripWindow::menu_hscale), 6.0f))); + bind(slot(this, &GtkStatsStripWindow::menu_hscale), 6.0f))); speed_menu->items().push_back (MenuElem("12", - bind(slot(this, &GtkStatsStripWindow::menu_hscale), 12.0f))); + bind(slot(this, &GtkStatsStripWindow::menu_hscale), 12.0f))); _menu->items().push_back(MenuElem("Speed", *manage(speed_menu))); @@ -164,7 +164,7 @@ setup_menu() { _scale_menu = new Gtk::Menu; _scale_menu->items().push_back (MenuElem("Auto scale", - slot(this, &GtkStatsStripWindow::menu_auto_vscale))); + slot(this, &GtkStatsStripWindow::menu_auto_vscale))); _menu->items().push_back(MenuElem("Scale", *manage(_scale_menu))); @@ -304,7 +304,7 @@ void GtkStatsStripWindow:: menu_show_levels(int collector_index) { new GtkStatsStripWindow(_monitor, _thread_index, collector_index, true, - _chart->get_xsize(), _chart->get_ysize()); + _chart->get_xsize(), _chart->get_ysize()); } //////////////////////////////////////////////////////////////////// @@ -321,7 +321,7 @@ void GtkStatsStripWindow:: open_subchart(int collector_index) { new GtkStatsStripWindow(_monitor, _thread_index, collector_index, _show_level, - _chart->get_xsize(), _chart->get_ysize()); + _chart->get_xsize(), _chart->get_ysize()); } //////////////////////////////////////////////////////////////////// @@ -343,7 +343,7 @@ layout_window(int chart_xsize, int chart_ysize) { Gtk::HBox *title_hbox = new Gtk::HBox; title_hbox->show(); chart_table->attach(*manage(title_hbox), 1, 2, 0, 1, - (GTK_FILL|GTK_EXPAND), 0); + (GTK_FILL|GTK_EXPAND), 0); _title_label = new Gtk::Label(get_title_text()); if (_collector_index != 0 || _thread_index != 0) { @@ -381,9 +381,9 @@ layout_window(int chart_xsize, int chart_ysize) { frame->add(*manage(_chart)); chart_table->attach(*_chart->get_labels(), 0, 1, 1, 2, - 0, (GTK_FILL|GTK_EXPAND), 4, 0); + 0, (GTK_FILL|GTK_EXPAND), 4, 0); chart_table->attach(*_chart->get_guide(), 2, 3, 1, 2, - 0, (GTK_FILL|GTK_EXPAND), 4, 0); + 0, (GTK_FILL|GTK_EXPAND), 4, 0); _chart->show(); } diff --git a/pandatool/src/gtk-stats/gtkStatsStripWindow.h b/pandatool/src/gtk-stats/gtkStatsStripWindow.h index 71455913b4..f00b45afbe 100644 --- a/pandatool/src/gtk-stats/gtkStatsStripWindow.h +++ b/pandatool/src/gtk-stats/gtkStatsStripWindow.h @@ -14,14 +14,14 @@ class GtkStatsStripChart; //////////////////////////////////////////////////////////////////// -// Class : GtkStatsStripWindow +// Class : GtkStatsStripWindow // Description : A window that contains your basic one-thread, // one-level strip chart. //////////////////////////////////////////////////////////////////// class GtkStatsStripWindow : public GtkStatsWindow { public: GtkStatsStripWindow(GtkStatsMonitor *monitor, int thread_index, - int collector_index, bool show_level, + int collector_index, bool show_level, int chart_xsize, int chart_ysize); virtual void mark_dead(); diff --git a/pandatool/src/gtk-stats/gtkStatsWindow.cxx b/pandatool/src/gtk-stats/gtkStatsWindow.cxx index 5ec9eef36d..d976aab015 100644 --- a/pandatool/src/gtk-stats/gtkStatsWindow.cxx +++ b/pandatool/src/gtk-stats/gtkStatsWindow.cxx @@ -107,28 +107,28 @@ setup_menu() { _file_menu->items().push_back (MenuElem("New strip chart", - slot(this, &GtkStatsWindow::menu_open_strip_chart))); + slot(this, &GtkStatsWindow::menu_open_strip_chart))); _file_menu->items().push_back (MenuElem("New piano roll", - slot(this, &GtkStatsWindow::menu_open_piano_roll))); + slot(this, &GtkStatsWindow::menu_open_piano_roll))); /* _file_menu->items().push_back (MenuElem("New window", - slot(this, &GtkStatsWindow::menu_new_window))); + slot(this, &GtkStatsWindow::menu_new_window))); */ _file_menu->items().push_back(SeparatorElem()); _file_menu->items().push_back (MenuElem("Disconnect from client", - slot(this, &GtkStatsWindow::menu_disconnect))); + slot(this, &GtkStatsWindow::menu_disconnect))); _file_menu->items().push_back (MenuElem("Close window", - slot(this, &GtkStatsWindow::menu_close_window))); + slot(this, &GtkStatsWindow::menu_close_window))); _file_menu->items().push_back (MenuElem("Close all windows this client", - slot(this, &GtkStatsWindow::menu_close_all_windows))); + slot(this, &GtkStatsWindow::menu_close_all_windows))); _menu->items().push_back(MenuElem("File", *manage(_file_menu))); _menu->show(); diff --git a/pandatool/src/gtk-stats/gtkStatsWindow.h b/pandatool/src/gtk-stats/gtkStatsWindow.h index 7ffd830b1b..a9f64ee41a 100644 --- a/pandatool/src/gtk-stats/gtkStatsWindow.h +++ b/pandatool/src/gtk-stats/gtkStatsWindow.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GtkStatsWindow +// Class : GtkStatsWindow // Description : This is the base class for a family of windows that // are associated with one particular stats client. // Each window keeps a pointer back to the diff --git a/pandatool/src/gtkbase/basicGtkDialog.h b/pandatool/src/gtkbase/basicGtkDialog.h index 0976645553..822ff9798d 100644 --- a/pandatool/src/gtkbase/basicGtkDialog.h +++ b/pandatool/src/gtkbase/basicGtkDialog.h @@ -12,7 +12,7 @@ //////////////////////////////////////////////////////////////////// -// Class : BasicGtkDialog +// Class : BasicGtkDialog // Description : This looks like a wrapper around Gtk::Dialog. // Actually, it doesn't inherit from Gtk::Dialog at all, // but instead (indirectly) from Gtk::Window; it just diff --git a/pandatool/src/gtkbase/basicGtkWindow.cxx b/pandatool/src/gtkbase/basicGtkWindow.cxx index a04a7fcdc1..1152bf6cd9 100644 --- a/pandatool/src/gtkbase/basicGtkWindow.cxx +++ b/pandatool/src/gtkbase/basicGtkWindow.cxx @@ -73,11 +73,11 @@ destruct() { // Now, in case the window was never completely shown, we must // wait for that to happen before we can hide it. while (!_destroyed && _state == S_setup) { - GtkBase::_gtk->iteration(); + GtkBase::_gtk->iteration(); } if (!_destroyed) { - hide(); + hide(); } } _state = S_gone; diff --git a/pandatool/src/gtkbase/basicGtkWindow.h b/pandatool/src/gtkbase/basicGtkWindow.h index 5a3652e63c..b0d64622a1 100644 --- a/pandatool/src/gtkbase/basicGtkWindow.h +++ b/pandatool/src/gtkbase/basicGtkWindow.h @@ -10,7 +10,7 @@ //////////////////////////////////////////////////////////////////// -// Class : BasicGtkWindow +// Class : BasicGtkWindow // Description : This is just a handy wrapper around Gtk::Window that // provides some convenient setup functions. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/gtkbase/gtkBase.h b/pandatool/src/gtkbase/gtkBase.h index 1aae9fda63..f6a77b63ad 100644 --- a/pandatool/src/gtkbase/gtkBase.h +++ b/pandatool/src/gtkbase/gtkBase.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : GtkBase +// Class : GtkBase // Description : This is a specialization of ProgramBase for programs // that use the Gtk-- GUI toolkit. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/imagebase/imageBase.h b/pandatool/src/imagebase/imageBase.h index 493a98b198..f243c7302d 100644 --- a/pandatool/src/imagebase/imageBase.h +++ b/pandatool/src/imagebase/imageBase.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ImageBase +// Class : ImageBase // Description : This specialization of ProgramBase is intended for // programs that read and/or write a single image file. // (See ImageMultiBase for programs that operate on diff --git a/pandatool/src/imagebase/imageFilter.cxx b/pandatool/src/imagebase/imageFilter.cxx index 5a40855058..d0a9fc8c4e 100644 --- a/pandatool/src/imagebase/imageFilter.cxx +++ b/pandatool/src/imagebase/imageFilter.cxx @@ -30,7 +30,7 @@ handle_args(ProgramBase::Args &args) { if (!_got_output_filename) { if (args.size() != 2) { nout << "You must specify the input and output filenames on the " - << "command line, or use -o to specify the output filename.\n"; + << "command line, or use -o to specify the output filename.\n"; return false; } diff --git a/pandatool/src/imagebase/imageFilter.h b/pandatool/src/imagebase/imageFilter.h index 37bb6d0451..ad45f80e7c 100644 --- a/pandatool/src/imagebase/imageFilter.h +++ b/pandatool/src/imagebase/imageFilter.h @@ -12,7 +12,7 @@ #include "imageWriter.h" //////////////////////////////////////////////////////////////////// -// Class : ImageFilter +// Class : ImageFilter // Description : This is the base class for a program that reads an // image file, operates on it, and writes another image // file out. diff --git a/pandatool/src/imagebase/imageReader.h b/pandatool/src/imagebase/imageReader.h index 5f0d97da8e..fa693f6498 100644 --- a/pandatool/src/imagebase/imageReader.h +++ b/pandatool/src/imagebase/imageReader.h @@ -11,7 +11,7 @@ #include "imageBase.h" //////////////////////////////////////////////////////////////////// -// Class : ImageReader +// Class : ImageReader // Description : This is the base class for a program that reads an // image file, but doesn't write an image file. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/imagebase/imageWriter.cxx b/pandatool/src/imagebase/imageWriter.cxx index b9edeaae92..69be968bbf 100644 --- a/pandatool/src/imagebase/imageWriter.cxx +++ b/pandatool/src/imagebase/imageWriter.cxx @@ -53,7 +53,7 @@ handle_args(ProgramBase::Args &args) { if (!_got_output_filename) { if (args.size() != 1) { nout << "You must specify the filename to write with -o, or as " - << "the last parameter on the command line.\n"; + << "the last parameter on the command line.\n"; return false; } _output_filename = args[0]; diff --git a/pandatool/src/imagebase/imageWriter.h b/pandatool/src/imagebase/imageWriter.h index aa70ffa289..dfde04ce97 100644 --- a/pandatool/src/imagebase/imageWriter.h +++ b/pandatool/src/imagebase/imageWriter.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ImageWriter +// Class : ImageWriter // Description : This is the base class for a program that generates // an image file output, but doesn't read any for input. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/imageprogs/imageTrans.h b/pandatool/src/imageprogs/imageTrans.h index c22bb704c9..518a8609b3 100644 --- a/pandatool/src/imageprogs/imageTrans.h +++ b/pandatool/src/imageprogs/imageTrans.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ImageTrans +// Class : ImageTrans // Description : A program to read an image file and write an // equivalent image file, possibly performing some minor // operations along the way. diff --git a/pandatool/src/lwo/iffChunk.h b/pandatool/src/lwo/iffChunk.h index be48d04b9e..9aeac65173 100644 --- a/pandatool/src/lwo/iffChunk.h +++ b/pandatool/src/lwo/iffChunk.h @@ -16,7 +16,7 @@ class IffInputFile; //////////////////////////////////////////////////////////////////// -// Class : IffChunk +// Class : IffChunk // Description : The basic kind of record in an EA "IFF" file, which // the LightWave object file is based on. //////////////////////////////////////////////////////////////////// @@ -48,7 +48,7 @@ public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "IffChunk", - TypedReferenceCount::get_class_type()); + TypedReferenceCount::get_class_type()); } private: diff --git a/pandatool/src/lwo/iffGenericChunk.h b/pandatool/src/lwo/iffGenericChunk.h index 2bdc675981..375a5ca301 100644 --- a/pandatool/src/lwo/iffGenericChunk.h +++ b/pandatool/src/lwo/iffGenericChunk.h @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// -// Class : IffGenericChunk +// Class : IffGenericChunk // Description : A class for a generic kind of IffChunk that is not // understood by a particular IffReader. It remembers // its entire contents. @@ -43,7 +43,7 @@ public: static void init_type() { IffChunk::init_type(); register_type(_type_handle, "IffGenericChunk", - IffChunk::get_class_type()); + IffChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/iffId.cxx b/pandatool/src/lwo/iffId.cxx index 2342fc3391..c3a2c23275 100644 --- a/pandatool/src/lwo/iffId.cxx +++ b/pandatool/src/lwo/iffId.cxx @@ -20,7 +20,7 @@ output(ostream &out) const { out << _id._c[0] << _id._c[1] << _id._c[2] << _id._c[3]; } else if (isprint(_id._c[0]) && isprint(_id._c[1]) && - isprint(_id._c[2]) && _id._c[3] == '\0') { + isprint(_id._c[2]) && _id._c[3] == '\0') { // If the last character is 0, output a 3-letter ID. out << _id._c[0] << _id._c[1] << _id._c[2]; diff --git a/pandatool/src/lwo/iffId.h b/pandatool/src/lwo/iffId.h index 207e97c9e4..abbaf2a289 100644 --- a/pandatool/src/lwo/iffId.h +++ b/pandatool/src/lwo/iffId.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : IffId +// Class : IffId // Description : A four-byte chunk ID appearing in an "IFF" file. // This is used to identify the meaning of each chunk, // and can be treated either as a concrete object or as diff --git a/pandatool/src/lwo/iffInputFile.cxx b/pandatool/src/lwo/iffInputFile.cxx index 36c592e9fc..427ff47cf7 100644 --- a/pandatool/src/lwo/iffInputFile.cxx +++ b/pandatool/src/lwo/iffInputFile.cxx @@ -243,25 +243,25 @@ get_chunk() { if (chunk->read_iff(this, end_point)) { if (is_eof()) { - if (!_unexpected_eof) { - nout << "Unexpected EOF on file reading " << *chunk << "\n"; - _unexpected_eof = true; - } - return (IffChunk *)NULL; + if (!_unexpected_eof) { + nout << "Unexpected EOF on file reading " << *chunk << "\n"; + _unexpected_eof = true; + } + return (IffChunk *)NULL; } size_t num_bytes_read = get_bytes_read() - start_point; if (num_bytes_read > length) { - nout << *chunk << " read " << num_bytes_read - << " instead of " << length << " bytes.\n"; - return (IffChunk *)NULL; + nout << *chunk << " read " << num_bytes_read + << " instead of " << length << " bytes.\n"; + return (IffChunk *)NULL; } else if (num_bytes_read < length) { - size_t skip_count = length - num_bytes_read; - nout << "Ignoring " << skip_count << " bytes at the end of " - << *chunk << "\n"; - skip_bytes(skip_count); - } + size_t skip_count = length - num_bytes_read; + nout << "Ignoring " << skip_count << " bytes at the end of " + << *chunk << "\n"; + skip_bytes(skip_count); + } return chunk; } } @@ -297,25 +297,25 @@ get_subchunk(IffChunk *context) { if (chunk->read_iff(this, end_point)) { if (is_eof()) { - if (!_unexpected_eof) { - nout << "Unexpected EOF on file reading " << *chunk << "\n"; - _unexpected_eof = true; - } - return (IffChunk *)NULL; + if (!_unexpected_eof) { + nout << "Unexpected EOF on file reading " << *chunk << "\n"; + _unexpected_eof = true; + } + return (IffChunk *)NULL; } size_t num_bytes_read = get_bytes_read() - start_point; if (num_bytes_read > length) { - nout << *chunk << " read " << num_bytes_read - << " instead of " << length << " bytes.\n"; - return (IffChunk *)NULL; + nout << *chunk << " read " << num_bytes_read + << " instead of " << length << " bytes.\n"; + return (IffChunk *)NULL; } else if (num_bytes_read < length) { - size_t skip_count = length - num_bytes_read; - nout << "Ignoring " << skip_count << " bytes at the end of " - << *chunk << "\n"; - skip_bytes(skip_count); - } + size_t skip_count = length - num_bytes_read; + nout << "Ignoring " << skip_count << " bytes at the end of " + << *chunk << "\n"; + skip_bytes(skip_count); + } return chunk; } } diff --git a/pandatool/src/lwo/iffInputFile.h b/pandatool/src/lwo/iffInputFile.h index 068c06d6f5..a4b53c677e 100644 --- a/pandatool/src/lwo/iffInputFile.h +++ b/pandatool/src/lwo/iffInputFile.h @@ -17,7 +17,7 @@ class Datagram; //////////////////////////////////////////////////////////////////// -// Class : IffInputFile +// Class : IffInputFile // Description : A wrapper around an istream used for reading an IFF // file. //////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ public: static void init_type() { TypedObject::init_type(); register_type(_type_handle, "IffInputFile", - TypedObject::get_class_type()); + TypedObject::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoBoundingBox.h b/pandatool/src/lwo/lwoBoundingBox.h index d5a37f6690..127b34793e 100644 --- a/pandatool/src/lwo/lwoBoundingBox.h +++ b/pandatool/src/lwo/lwoBoundingBox.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoBoundingBox +// Class : LwoBoundingBox // Description : Stores the bounding box for the vertex data in a // layer. Optional. //////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoBoundingBox", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoChunk.h b/pandatool/src/lwo/lwoChunk.h index 10fd77656f..b0167bf872 100644 --- a/pandatool/src/lwo/lwoChunk.h +++ b/pandatool/src/lwo/lwoChunk.h @@ -11,7 +11,7 @@ #include "iffChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoChunk +// Class : LwoChunk // Description : A specialization of IffChunk for Lightwave Object // files. Each kind of chunk that is specific to a // Lightwave file should inherit directly or indirectly @@ -32,7 +32,7 @@ public: static void init_type() { IffChunk::init_type(); register_type(_type_handle, "LwoChunk", - IffChunk::get_class_type()); + IffChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoClip.h b/pandatool/src/lwo/lwoClip.h index 653ab7f8b3..751d184c14 100644 --- a/pandatool/src/lwo/lwoClip.h +++ b/pandatool/src/lwo/lwoClip.h @@ -11,7 +11,7 @@ #include "lwoGroupChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoClip +// Class : LwoClip // Description : A single image file, or a numbered sequence of images // (e.g. a texture-flip animation). //////////////////////////////////////////////////////////////////// @@ -36,7 +36,7 @@ public: static void init_type() { LwoGroupChunk::init_type(); register_type(_type_handle, "LwoClip", - LwoGroupChunk::get_class_type()); + LwoGroupChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx index 94b01cad50..ae10b2f78e 100644 --- a/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx +++ b/pandatool/src/lwo/lwoDiscontinuousVertexMap.cxx @@ -89,16 +89,16 @@ read_iff(IffInputFile *in, size_t stop_at) { PTA_float orig_value = (*ir.first).second; if (value.v() != orig_value.v()) { - nout << "Multiple UV values for vertex " << vertex_index - << " of polygon " << polygon_index - << " specified by discontinuous vertex map.\n" - << "Original value = "; - copy(orig_value.begin(), orig_value.end(), - ostream_iterator(nout, " ")); - nout << " new value = "; - copy(value.begin(), value.end(), - ostream_iterator(nout, " ")); - nout << "\n"; + nout << "Multiple UV values for vertex " << vertex_index + << " of polygon " << polygon_index + << " specified by discontinuous vertex map.\n" + << "Original value = "; + copy(orig_value.begin(), orig_value.end(), + ostream_iterator(nout, " ")); + nout << " new value = "; + copy(value.begin(), value.end(), + ostream_iterator(nout, " ")); + nout << "\n"; } } } diff --git a/pandatool/src/lwo/lwoDiscontinuousVertexMap.h b/pandatool/src/lwo/lwoDiscontinuousVertexMap.h index f6c16249ca..e12fe5dbd5 100644 --- a/pandatool/src/lwo/lwoDiscontinuousVertexMap.h +++ b/pandatool/src/lwo/lwoDiscontinuousVertexMap.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoDiscontinuousVertexMap +// Class : LwoDiscontinuousVertexMap // Description : A mapping of floating-point values per integer index. // The meaning of these values is determined by the // mapping type code and/or its name. @@ -47,7 +47,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoDiscontinuousVertexMap", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoGroupChunk.h b/pandatool/src/lwo/lwoGroupChunk.h index e75945e785..187991a54f 100644 --- a/pandatool/src/lwo/lwoGroupChunk.h +++ b/pandatool/src/lwo/lwoGroupChunk.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoGroupChunk +// Class : LwoGroupChunk // Description : A particular kind of LwoChunk that is expected to // contain an arbitrary number of child chunks. //////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoGroupChunk", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoHeader.h b/pandatool/src/lwo/lwoHeader.h index 0d825adac1..2ebb01aea2 100644 --- a/pandatool/src/lwo/lwoHeader.h +++ b/pandatool/src/lwo/lwoHeader.h @@ -11,7 +11,7 @@ #include "lwoGroupChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoHeader +// Class : LwoHeader // Description : The first chunk in a Lightwave Object file. //////////////////////////////////////////////////////////////////// class LwoHeader : public LwoGroupChunk { @@ -42,7 +42,7 @@ public: static void init_type() { LwoGroupChunk::init_type(); register_type(_type_handle, "LwoHeader", - LwoGroupChunk::get_class_type()); + LwoGroupChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoInputFile.cxx b/pandatool/src/lwo/lwoInputFile.cxx index 27d1b998cc..b41a400ffd 100644 --- a/pandatool/src/lwo/lwoInputFile.cxx +++ b/pandatool/src/lwo/lwoInputFile.cxx @@ -121,7 +121,7 @@ make_new_chunk(IffId id) { return new LwoPolygons; } else if (id == IffId("TAGS") || - id == IffId("SRFS")) { + id == IffId("SRFS")) { return new LwoTags; } else if (id == IffId("PTAG")) { diff --git a/pandatool/src/lwo/lwoInputFile.h b/pandatool/src/lwo/lwoInputFile.h index 1c172fc5c2..c86a0f1183 100644 --- a/pandatool/src/lwo/lwoInputFile.h +++ b/pandatool/src/lwo/lwoInputFile.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoInputFile +// Class : LwoInputFile // Description : A specialization of IffInputFile to handle reading a // Lightwave Object file. //////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ public: static void init_type() { IffInputFile::init_type(); register_type(_type_handle, "LwoInputFile", - IffInputFile::get_class_type()); + IffInputFile::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoLayer.h b/pandatool/src/lwo/lwoLayer.h index 6ce5beb0bf..1e263b7d79 100644 --- a/pandatool/src/lwo/lwoLayer.h +++ b/pandatool/src/lwo/lwoLayer.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoLayer +// Class : LwoLayer // Description : Signals the start of a new layer. All the data // chunks which follow will be included in this layer // until another layer chunk is encountered. If data is @@ -49,7 +49,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoLayer", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoPoints.h b/pandatool/src/lwo/lwoPoints.h index 42a07ab51a..b355585476 100644 --- a/pandatool/src/lwo/lwoPoints.h +++ b/pandatool/src/lwo/lwoPoints.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoPoints +// Class : LwoPoints // Description : An array of points that will be referenced by later // chunks. //////////////////////////////////////////////////////////////////// @@ -41,7 +41,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoPoints", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoPolygonTags.h b/pandatool/src/lwo/lwoPolygonTags.h index a8601b1850..58638a78f4 100644 --- a/pandatool/src/lwo/lwoPolygonTags.h +++ b/pandatool/src/lwo/lwoPolygonTags.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoPolygonTags +// Class : LwoPolygonTags // Description : An association of polygons defined in the most recent // LwoPolygons chunk to tag ids defined in the most // recent LwoTags chunk. This associated properties @@ -43,7 +43,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoPolygonTags", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoPolygons.cxx b/pandatool/src/lwo/lwoPolygons.cxx index 60a0dcec1d..2036dae49c 100644 --- a/pandatool/src/lwo/lwoPolygons.cxx +++ b/pandatool/src/lwo/lwoPolygons.cxx @@ -54,16 +54,16 @@ read_iff(IffInputFile *in, size_t stop_at) { while (lin->get_bytes_read() < stop_at && !lin->is_eof()) { int nf = lin->get_be_uint16(); int num_vertices = nf & PF_numverts_mask; - + PT(Polygon) poly = new Polygon; poly->_flags = nf & ~PF_numverts_mask; poly->_surface_index = -1; - + for (int i = 0; i < num_vertices; i++) { - int vindex = lin->get_vx(); - poly->_vertices.push_back(vindex); + int vindex = lin->get_vx(); + poly->_vertices.push_back(vindex); } - + _polygons.push_back(poly); } @@ -75,27 +75,27 @@ read_iff(IffInputFile *in, size_t stop_at) { int num_decals = 0; while (lin->get_bytes_read() < stop_at && !lin->is_eof()) { int num_vertices = lin->get_be_uint16(); - + PT(Polygon) poly = new Polygon; poly->_flags = 0; - + for (int i = 0; i < num_vertices; i++) { - int vindex = lin->get_vx(); - poly->_vertices.push_back(vindex); + int vindex = lin->get_vx(); + poly->_vertices.push_back(vindex); } int surface = lin->get_be_int16(); if (num_decals > 0) { - // This is a decal polygon of a previous polygon. - num_decals--; - poly->_flags |= PF_decal; + // This is a decal polygon of a previous polygon. + num_decals--; + poly->_flags |= PF_decal; } else { - if (surface < 0) { - num_decals = lin->get_be_int16(); - surface = -surface; - } + if (surface < 0) { + num_decals = lin->get_be_int16(); + surface = -surface; + } } // The surface index is stored +1 to allow signedness to be diff --git a/pandatool/src/lwo/lwoPolygons.h b/pandatool/src/lwo/lwoPolygons.h index 04cf3a7f06..5666238099 100644 --- a/pandatool/src/lwo/lwoPolygons.h +++ b/pandatool/src/lwo/lwoPolygons.h @@ -16,7 +16,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoPolygons +// Class : LwoPolygons // Description : An array of polygons that will be referenced by later // chunks. //////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoPolygons", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoStillImage.h b/pandatool/src/lwo/lwoStillImage.h index 32a0e68caa..4bbe66db78 100644 --- a/pandatool/src/lwo/lwoStillImage.h +++ b/pandatool/src/lwo/lwoStillImage.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoStillImage +// Class : LwoStillImage // Description : A single still image associated with a LwoClip chunk. //////////////////////////////////////////////////////////////////// class LwoStillImage : public LwoChunk { @@ -35,7 +35,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoStillImage", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurface.cxx b/pandatool/src/lwo/lwoSurface.cxx index 254dac16d2..1b488cfb99 100644 --- a/pandatool/src/lwo/lwoSurface.cxx +++ b/pandatool/src/lwo/lwoSurface.cxx @@ -62,16 +62,16 @@ make_new_chunk(IffInputFile *in, IffId id) { return new LwoSurfaceColor; } else if (id == IffId("DIFF") || - id == IffId("LUMI") || - id == IffId("SPEC") || - id == IffId("REFL") || - id == IffId("TRAN") || - id == IffId("TRNL") || - id == IffId("GLOS") || - id == IffId("SHRP") || - id == IffId("BUMP") || - id == IffId("RSAN") || - id == IffId("RIND")) { + id == IffId("LUMI") || + id == IffId("SPEC") || + id == IffId("REFL") || + id == IffId("TRAN") || + id == IffId("TRNL") || + id == IffId("GLOS") || + id == IffId("SHRP") || + id == IffId("BUMP") || + id == IffId("RSAN") || + id == IffId("RIND")) { return new LwoSurfaceParameter; } else if (id == IffId("SIDE")) { diff --git a/pandatool/src/lwo/lwoSurface.h b/pandatool/src/lwo/lwoSurface.h index 852e8fee65..e27e90f0d2 100644 --- a/pandatool/src/lwo/lwoSurface.h +++ b/pandatool/src/lwo/lwoSurface.h @@ -11,7 +11,7 @@ #include "lwoGroupChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurface +// Class : LwoSurface // Description : Describes the shading attributes of a surface. This // is similar to the concept usually called a "material" // or "shader" in other file formats. @@ -38,7 +38,7 @@ public: static void init_type() { LwoGroupChunk::init_type(); register_type(_type_handle, "LwoSurface", - LwoGroupChunk::get_class_type()); + LwoGroupChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlock.cxx b/pandatool/src/lwo/lwoSurfaceBlock.cxx index 7da61ad177..0bae10768d 100644 --- a/pandatool/src/lwo/lwoSurfaceBlock.cxx +++ b/pandatool/src/lwo/lwoSurfaceBlock.cxx @@ -92,7 +92,7 @@ make_new_chunk(IffInputFile *in, IffId id) { return new LwoSurfaceBlockWrap; } else if (id == IffId("WRPH") || - id == IffId("WRPW")) { + id == IffId("WRPW")) { return new LwoSurfaceBlockRepeat; } else if (id == IffId("VMAP")) { diff --git a/pandatool/src/lwo/lwoSurfaceBlock.h b/pandatool/src/lwo/lwoSurfaceBlock.h index f405e41735..ef22df48ea 100644 --- a/pandatool/src/lwo/lwoSurfaceBlock.h +++ b/pandatool/src/lwo/lwoSurfaceBlock.h @@ -12,7 +12,7 @@ #include "lwoSurfaceBlockHeader.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlock +// Class : LwoSurfaceBlock // Description : A texture layer or shader, part of a LwoSurface // chunk. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/lwo/lwoSurfaceBlockAxis.h b/pandatool/src/lwo/lwoSurfaceBlockAxis.h index 18b37b557f..9705ecef27 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockAxis.h +++ b/pandatool/src/lwo/lwoSurfaceBlockAxis.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockAxis +// Class : LwoSurfaceBlockAxis // Description : Indicates the axis for this particular shader's // projection. This works in conjunction with // LwoSurfaceBlockProjection. This is a subchunk of @@ -41,7 +41,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockAxis", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockChannel.h b/pandatool/src/lwo/lwoSurfaceBlockChannel.h index 8e54108190..cba2a341a2 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockChannel.h +++ b/pandatool/src/lwo/lwoSurfaceBlockChannel.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockChannel +// Class : LwoSurfaceBlockChannel // Description : Indicates which channel the texture in this // LwoSurfaceBlock is applied to. This is a subchunk of // LwoSurfaceBlockHeader. @@ -35,7 +35,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockChannel", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockCoordSys.h b/pandatool/src/lwo/lwoSurfaceBlockCoordSys.h index 412bb08c43..2f8132036d 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockCoordSys.h +++ b/pandatool/src/lwo/lwoSurfaceBlockCoordSys.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockCoordSys +// Class : LwoSurfaceBlockCoordSys // Description : Specifies whether texture coordinates are computed // based on the vertices' world coordinates or local // coordinates. @@ -40,7 +40,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockCoordSys", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockEnabled.h b/pandatool/src/lwo/lwoSurfaceBlockEnabled.h index 0ee76416cb..2be1173279 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockEnabled.h +++ b/pandatool/src/lwo/lwoSurfaceBlockEnabled.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockEnabled +// Class : LwoSurfaceBlockEnabled // Description : Indicates whether this particular layer or shader // should be rendered or not. This is a subchunk of // LwoSurfaceBlockHeader. @@ -35,7 +35,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockEnabled", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockHeader.h b/pandatool/src/lwo/lwoSurfaceBlockHeader.h index 8f5034162a..931aae2d62 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockHeader.h +++ b/pandatool/src/lwo/lwoSurfaceBlockHeader.h @@ -11,7 +11,7 @@ #include "lwoGroupChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockHeader +// Class : LwoSurfaceBlockHeader // Description : The header chunk within a LwoSurfaceBlock chunk. //////////////////////////////////////////////////////////////////// class LwoSurfaceBlockHeader : public LwoGroupChunk { @@ -35,7 +35,7 @@ public: static void init_type() { LwoGroupChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockHeader", - LwoGroupChunk::get_class_type()); + LwoGroupChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockImage.h b/pandatool/src/lwo/lwoSurfaceBlockImage.h index 5c4e499898..51670191d1 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockImage.h +++ b/pandatool/src/lwo/lwoSurfaceBlockImage.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockImage +// Class : LwoSurfaceBlockImage // Description : Specifies the particular image that is being applied // as a texture. This references a recently-defined // CLIP image by index number. @@ -35,7 +35,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockImage", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockOpacity.h b/pandatool/src/lwo/lwoSurfaceBlockOpacity.h index 355d11348b..fa552f106e 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockOpacity.h +++ b/pandatool/src/lwo/lwoSurfaceBlockOpacity.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockOpacity +// Class : LwoSurfaceBlockOpacity // Description : Indicates how transparent or opaque this particular // layer is in relation to the layers beneath it. This // is a subchunk of LwoSurfaceBlockHeader. @@ -47,7 +47,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockOpacity", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockProjection.h b/pandatool/src/lwo/lwoSurfaceBlockProjection.h index 157bf2bf96..89c7135ca6 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockProjection.h +++ b/pandatool/src/lwo/lwoSurfaceBlockProjection.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockProjection +// Class : LwoSurfaceBlockProjection // Description : Indicates the projection mode for this particular // shader. This determines how UV coordinates should be // computed based on the vertex positions. This is a @@ -44,7 +44,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockProjection", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockRefObj.h b/pandatool/src/lwo/lwoSurfaceBlockRefObj.h index 844ff4c14d..9200d885d9 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockRefObj.h +++ b/pandatool/src/lwo/lwoSurfaceBlockRefObj.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockRefObj +// Class : LwoSurfaceBlockRefObj // Description : Specifies a reference object that the texture UV's // are to be computed relative to. //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockRefObj", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockRepeat.h b/pandatool/src/lwo/lwoSurfaceBlockRepeat.h index 1192a16572..bbf4e8ba11 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockRepeat.h +++ b/pandatool/src/lwo/lwoSurfaceBlockRepeat.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockRepeat +// Class : LwoSurfaceBlockRepeat // Description : For cylindrical and spherical projections, this // parameter controls how many times the image repeats // over each full interval, in either dimension. The @@ -38,7 +38,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockRepeat", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockTMap.h b/pandatool/src/lwo/lwoSurfaceBlockTMap.h index 8802a891fc..094b554f9b 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockTMap.h +++ b/pandatool/src/lwo/lwoSurfaceBlockTMap.h @@ -11,7 +11,7 @@ #include "lwoGroupChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockTMap +// Class : LwoSurfaceBlockTMap // Description : The tMap chunk within a LwoSurfaceBlock chunk. //////////////////////////////////////////////////////////////////// class LwoSurfaceBlockTMap : public LwoGroupChunk { @@ -32,7 +32,7 @@ public: static void init_type() { LwoGroupChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockTMap", - LwoGroupChunk::get_class_type()); + LwoGroupChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockTransform.h b/pandatool/src/lwo/lwoSurfaceBlockTransform.h index d04b125085..ce1fa2b58f 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockTransform.h +++ b/pandatool/src/lwo/lwoSurfaceBlockTransform.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockTransform +// Class : LwoSurfaceBlockTransform // Description : Specifies a center point, scale, or rotation for the // texture coordinates in this shader's texture mapping. // The type of transform is specified by the ID of the @@ -40,7 +40,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockTransform", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockVMapName.h b/pandatool/src/lwo/lwoSurfaceBlockVMapName.h index 1dce1a5738..453873b5e7 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockVMapName.h +++ b/pandatool/src/lwo/lwoSurfaceBlockVMapName.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockVMapName +// Class : LwoSurfaceBlockVMapName // Description : Specifies the name of a set of UV's defined on the // polygons that use this model. //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockVMapName", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceBlockWrap.h b/pandatool/src/lwo/lwoSurfaceBlockWrap.h index 15e83ea1b3..ab02c1f49b 100644 --- a/pandatool/src/lwo/lwoSurfaceBlockWrap.h +++ b/pandatool/src/lwo/lwoSurfaceBlockWrap.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceBlockWrap +// Class : LwoSurfaceBlockWrap // Description : Specifies how the texture image appears for areas // outside the image. //////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceBlockWrap", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceColor.h b/pandatool/src/lwo/lwoSurfaceColor.h index f4db2647d8..ab47d23556 100644 --- a/pandatool/src/lwo/lwoSurfaceColor.h +++ b/pandatool/src/lwo/lwoSurfaceColor.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceColor +// Class : LwoSurfaceColor // Description : Records the base color of a surface, as an entry // within a LwoSurface chunk. //////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceColor", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceParameter.h b/pandatool/src/lwo/lwoSurfaceParameter.h index ea2675be4a..950086c2c0 100644 --- a/pandatool/src/lwo/lwoSurfaceParameter.h +++ b/pandatool/src/lwo/lwoSurfaceParameter.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceParameter +// Class : LwoSurfaceParameter // Description : Records some parameter value of a surface material, // as an entry within a LwoSurface chunk. The meaning // of the value is determined by the id of this chunk. @@ -36,7 +36,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceParameter", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceSidedness.h b/pandatool/src/lwo/lwoSurfaceSidedness.h index 7c001261e1..e192d076d2 100644 --- a/pandatool/src/lwo/lwoSurfaceSidedness.h +++ b/pandatool/src/lwo/lwoSurfaceSidedness.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceSidedness +// Class : LwoSurfaceSidedness // Description : Records whether polygons are frontfacing only or // backfacing also. This is associated with the // LwoSurface chunk. @@ -40,7 +40,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceSidedness", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoSurfaceSmoothingAngle.h b/pandatool/src/lwo/lwoSurfaceSmoothingAngle.h index 49221a4fc0..4edee0c28f 100644 --- a/pandatool/src/lwo/lwoSurfaceSmoothingAngle.h +++ b/pandatool/src/lwo/lwoSurfaceSmoothingAngle.h @@ -11,7 +11,7 @@ #include "lwoChunk.h" //////////////////////////////////////////////////////////////////// -// Class : LwoSurfaceSmoothingAngle +// Class : LwoSurfaceSmoothingAngle // Description : Indicates the maximum angle (in radians) between // adjacent polygons that should be smooth-shaded. //////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoSurfaceSmoothingAngle", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoTags.h b/pandatool/src/lwo/lwoTags.h index 616a82764d..fbdc989ff8 100644 --- a/pandatool/src/lwo/lwoTags.h +++ b/pandatool/src/lwo/lwoTags.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoTags +// Class : LwoTags // Description : An array of tag strings that will be referenced by // later chunks. // @@ -47,7 +47,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoTags", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwo/lwoVertexMap.h b/pandatool/src/lwo/lwoVertexMap.h index 338dc8cfb0..bd0f47286f 100644 --- a/pandatool/src/lwo/lwoVertexMap.h +++ b/pandatool/src/lwo/lwoVertexMap.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoVertexMap +// Class : LwoVertexMap // Description : A mapping of floating-point values per integer index. // The meaning of these values is determined by the // mapping type code and/or its name. @@ -46,7 +46,7 @@ public: static void init_type() { LwoChunk::init_type(); register_type(_type_handle, "LwoVertexMap", - LwoChunk::get_class_type()); + LwoChunk::get_class_type()); } private: diff --git a/pandatool/src/lwoegg/cLwoClip.h b/pandatool/src/lwoegg/cLwoClip.h index 87d5f75051..0901808c43 100644 --- a/pandatool/src/lwoegg/cLwoClip.h +++ b/pandatool/src/lwoegg/cLwoClip.h @@ -15,7 +15,7 @@ class LwoToEggConverter; //////////////////////////////////////////////////////////////////// -// Class : CLwoClip +// Class : CLwoClip // Description : This class is a wrapper around LwoClip and stores // additional information useful during the // conversion-to-egg process. diff --git a/pandatool/src/lwoegg/cLwoLayer.cxx b/pandatool/src/lwoegg/cLwoLayer.cxx index 6d53f1284f..582c8f6370 100644 --- a/pandatool/src/lwoegg/cLwoLayer.cxx +++ b/pandatool/src/lwoegg/cLwoLayer.cxx @@ -43,7 +43,7 @@ connect_egg() { } nout << "No layer found with number " << _layer->_parent - << "; cannot parent layer " << _layer->_number << " properly.\n"; + << "; cannot parent layer " << _layer->_number << " properly.\n"; } _converter->get_egg_data().add_child(_egg_group.p()); diff --git a/pandatool/src/lwoegg/cLwoLayer.h b/pandatool/src/lwoegg/cLwoLayer.h index 6892742e86..1343776a60 100644 --- a/pandatool/src/lwoegg/cLwoLayer.h +++ b/pandatool/src/lwoegg/cLwoLayer.h @@ -15,7 +15,7 @@ class LwoToEggConverter; //////////////////////////////////////////////////////////////////// -// Class : CLwoLayer +// Class : CLwoLayer // Description : This class is a wrapper around LwoLayer and stores // additional information useful during the // conversion-to-egg process. diff --git a/pandatool/src/lwoegg/cLwoPoints.I b/pandatool/src/lwoegg/cLwoPoints.I index 79e9ef441a..41945a8850 100644 --- a/pandatool/src/lwoegg/cLwoPoints.I +++ b/pandatool/src/lwoegg/cLwoPoints.I @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////// INLINE CLwoPoints:: CLwoPoints(LwoToEggConverter *converter, const LwoPoints *points, - CLwoLayer *layer) : + CLwoLayer *layer) : _converter(converter), _points(points), _layer(layer) diff --git a/pandatool/src/lwoegg/cLwoPoints.cxx b/pandatool/src/lwoegg/cLwoPoints.cxx index 764cc38a00..11f2d94628 100644 --- a/pandatool/src/lwoegg/cLwoPoints.cxx +++ b/pandatool/src/lwoegg/cLwoPoints.cxx @@ -37,7 +37,7 @@ add_vmap(const LwoVertexMap *lwo_vmap) { if (!inserted) { nout << "Multiple vertex maps on the same points of type " - << map_type << " named " << name << "\n"; + << map_type << " named " << name << "\n"; } } @@ -58,7 +58,7 @@ get_uv(const string &uv_name, int n, LPoint2f &uv) const { const LwoVertexMap *vmap = (*ni).second; if (vmap->_dimension != 2) { nout << "Unexpected dimension of " << vmap->_dimension - << " for UV map " << uv_name << "\n"; + << " for UV map " << uv_name << "\n"; return false; } diff --git a/pandatool/src/lwoegg/cLwoPoints.h b/pandatool/src/lwoegg/cLwoPoints.h index 67d1997d82..20670c8ef9 100644 --- a/pandatool/src/lwoegg/cLwoPoints.h +++ b/pandatool/src/lwoegg/cLwoPoints.h @@ -19,7 +19,7 @@ class LwoVertexMap; class CLwoLayer; //////////////////////////////////////////////////////////////////// -// Class : CLwoPoints +// Class : CLwoPoints // Description : This class is a wrapper around LwoPoints and stores // additional information useful during the // conversion-to-egg process. @@ -27,7 +27,7 @@ class CLwoLayer; class CLwoPoints { public: INLINE CLwoPoints(LwoToEggConverter *converter, const LwoPoints *points, - CLwoLayer *layer); + CLwoLayer *layer); void add_vmap(const LwoVertexMap *lwo_vmap); bool get_uv(const string &uv_name, int n, LPoint2f &uv) const; diff --git a/pandatool/src/lwoegg/cLwoPolygons.I b/pandatool/src/lwoegg/cLwoPolygons.I index 1eaef6b9e4..5595845621 100644 --- a/pandatool/src/lwoegg/cLwoPolygons.I +++ b/pandatool/src/lwoegg/cLwoPolygons.I @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////// INLINE CLwoPolygons:: CLwoPolygons(LwoToEggConverter *converter, const LwoPolygons *polygons, - CLwoPoints *points) : + CLwoPoints *points) : _converter(converter), _polygons(polygons), _points(points) diff --git a/pandatool/src/lwoegg/cLwoPolygons.cxx b/pandatool/src/lwoegg/cLwoPolygons.cxx index 17c6e3a812..c2a5f1a7ee 100644 --- a/pandatool/src/lwoegg/cLwoPolygons.cxx +++ b/pandatool/src/lwoegg/cLwoPolygons.cxx @@ -37,7 +37,7 @@ add_ptags(const LwoPolygonTags *lwo_ptags, const LwoTags *tags) { bool inserted = _ptags.insert(PTags::value_type(type, lwo_ptags)).second; if (!inserted) { nout << "Multiple polygon tags on the same polygons of type " - << type << "\n"; + << type << "\n"; } else { if (type == IffId("SURF")) { @@ -70,7 +70,7 @@ add_vmad(const LwoDiscontinuousVertexMap *lwo_vmad) { if (!inserted) { nout << "Multiple discontinous vertex maps on the same polygons of type " - << map_type << " named " << name << "\n"; + << map_type << " named " << name << "\n"; } } @@ -137,7 +137,7 @@ get_uv(const string &uv_name, int pi, int vi, LPoint2f &uv) const { const LwoDiscontinuousVertexMap *vmad = (*ni).second; if (vmad->_dimension != 2) { nout << "Unexpected dimension of " << vmad->_dimension - << " for discontinuous UV map " << uv_name << "\n"; + << " for discontinuous UV map " << uv_name << "\n"; return false; } @@ -180,7 +180,7 @@ make_egg() { } else { nout << "Ignoring unknown geometry type " << _polygons->_polygon_type - << ".\n"; + << ".\n"; } } @@ -239,44 +239,44 @@ make_faces() { for (int vi = num_vertices; vi > 0; vi--) { int vindex = poly->_vertices[vi % num_vertices]; if (vindex < 0 || vindex >= num_points) { - nout << "Invalid vertex index " << vindex << " in polygon.\n"; - is_valid = false; + nout << "Invalid vertex index " << vindex << " in polygon.\n"; + is_valid = false; } else { - PT(EggVertex) egg_vertex = new EggVertex; - LPoint3d pos = LCAST(double, points->get_point(vindex)); - egg_vertex->set_pos(pos); + PT(EggVertex) egg_vertex = new EggVertex; + LPoint3d pos = LCAST(double, points->get_point(vindex)); + egg_vertex->set_pos(pos); - // Does the vertex used named UV's? - if (surface != (CLwoSurface *)NULL && surface->has_named_uvs()) { - string uv_name = surface->get_uv_name(); - LPoint2f uv; - if (get_uv(uv_name, pindex, vindex, uv)) { - // This UV is defined in a "discontinuous" map, that - // associated a particular UV per each polygon. - egg_vertex->set_uv(LCAST(double, uv)); + // Does the vertex used named UV's? + if (surface != (CLwoSurface *)NULL && surface->has_named_uvs()) { + string uv_name = surface->get_uv_name(); + LPoint2f uv; + if (get_uv(uv_name, pindex, vindex, uv)) { + // This UV is defined in a "discontinuous" map, that + // associated a particular UV per each polygon. + egg_vertex->set_uv(LCAST(double, uv)); - } else if (_points->get_uv(uv_name, vindex, uv)) { - // The UV does not appear in a discontinuous map, but it - // is defined in the points set. - egg_vertex->set_uv(LCAST(double, uv)); - } - } + } else if (_points->get_uv(uv_name, vindex, uv)) { + // The UV does not appear in a discontinuous map, but it + // is defined in the points set. + egg_vertex->set_uv(LCAST(double, uv)); + } + } - egg_vertices.push_back(egg_vertex); + egg_vertices.push_back(egg_vertex); } } if (is_valid) { if (surface != (CLwoSurface *)NULL) { - surface->apply_properties(egg_prim, egg_vertices, smooth_angle); + surface->apply_properties(egg_prim, egg_vertices, smooth_angle); } // Now add all the vertices officially to the primitive. vector_PT_EggVertex::const_iterator evi; for (evi = egg_vertices.begin(); evi != egg_vertices.end(); ++evi) { - EggVertex *egg_vertex = (*evi); - EggVertex *new_vertex = egg_vpool->create_unique_vertex(*egg_vertex); - egg_prim->add_vertex(new_vertex); + EggVertex *egg_vertex = (*evi); + EggVertex *new_vertex = egg_vpool->create_unique_vertex(*egg_vertex); + egg_prim->add_vertex(new_vertex); } // And add the primitive to its parent. diff --git a/pandatool/src/lwoegg/cLwoPolygons.h b/pandatool/src/lwoegg/cLwoPolygons.h index 10d02270d9..dbc63b67c9 100644 --- a/pandatool/src/lwoegg/cLwoPolygons.h +++ b/pandatool/src/lwoegg/cLwoPolygons.h @@ -22,7 +22,7 @@ class LwoPolygonTags; class LwoDiscontinuousVertexMap; //////////////////////////////////////////////////////////////////// -// Class : CLwoPolygons +// Class : CLwoPolygons // Description : This class is a wrapper around LwoPolygons and stores // additional information useful during the // conversion-to-egg process. @@ -30,8 +30,8 @@ class LwoDiscontinuousVertexMap; class CLwoPolygons { public: INLINE CLwoPolygons(LwoToEggConverter *converter, - const LwoPolygons *polygons, - CLwoPoints *points); + const LwoPolygons *polygons, + CLwoPoints *points); void add_ptags(const LwoPolygonTags *lwo_ptags, const LwoTags *tags); void add_vmad(const LwoDiscontinuousVertexMap *lwo_vmad); diff --git a/pandatool/src/lwoegg/cLwoSurface.I b/pandatool/src/lwoegg/cLwoSurface.I index d15599ee3e..61a4341000 100644 --- a/pandatool/src/lwoegg/cLwoSurface.I +++ b/pandatool/src/lwoegg/cLwoSurface.I @@ -27,7 +27,7 @@ get_name() const { INLINE bool CLwoSurface:: has_named_uvs() const { return (_block != (CLwoSurfaceBlock *)NULL && - _block->_projection_mode == LwoSurfaceBlockProjection::M_uv); + _block->_projection_mode == LwoSurfaceBlockProjection::M_uv); } //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/lwoegg/cLwoSurface.cxx b/pandatool/src/lwoegg/cLwoSurface.cxx index 50a0189b08..c01b9c8cac 100644 --- a/pandatool/src/lwoegg/cLwoSurface.cxx +++ b/pandatool/src/lwoegg/cLwoSurface.cxx @@ -50,32 +50,32 @@ CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface) : IffId type = param->get_id(); if (type == IffId("DIFF")) { - _flags |= F_diffuse; - _diffuse = param->_value; + _flags |= F_diffuse; + _diffuse = param->_value; } else if (type == IffId("LUMI")) { - _flags |= F_luminosity; - _luminosity = param->_value; + _flags |= F_luminosity; + _luminosity = param->_value; } else if (type == IffId("SPEC")) { - _flags |= F_specular; - _specular = param->_value; + _flags |= F_specular; + _specular = param->_value; } else if (type == IffId("REFL")) { - _flags |= F_reflection; - _reflection = param->_value; + _flags |= F_reflection; + _reflection = param->_value; } else if (type == IffId("TRAN")) { - _flags |= F_transparency; - _transparency = param->_value; + _flags |= F_transparency; + _transparency = param->_value; } else if (type == IffId("GLOS")) { - _flags |= F_gloss; - _gloss = param->_value; + _flags |= F_gloss; + _gloss = param->_value; } else if (type == IffId("TRNL")) { - _flags |= F_translucency; - _translucency = param->_value; + _flags |= F_translucency; + _translucency = param->_value; } } else if (chunk->is_of_type(LwoSurfaceSmoothingAngle::get_class_type())) { @@ -97,22 +97,22 @@ CLwoSurface(LwoToEggConverter *converter, const LwoSurface *surface) : // We only consider enabled "IMAP" type blocks that affect "COLR". if (block->_block_type == IffId("IMAP") && - block->_channel_id == IffId("COLR") && - block->_enabled) { - // Now save the block with the lowest ordinal. - if (_block == (CLwoSurfaceBlock *)NULL) { - _block = block; + block->_channel_id == IffId("COLR") && + block->_enabled) { + // Now save the block with the lowest ordinal. + if (_block == (CLwoSurfaceBlock *)NULL) { + _block = block; - } else if (block->_ordinal < _block->_ordinal) { - delete _block; - _block = block; + } else if (block->_ordinal < _block->_ordinal) { + delete _block; + _block = block; - } else { - delete block; - } + } else { + delete block; + } } else { - delete block; + delete block; } } } @@ -158,7 +158,7 @@ CLwoSurface:: //////////////////////////////////////////////////////////////////// void CLwoSurface:: apply_properties(EggPrimitive *egg_prim, vector_PT_EggVertex &egg_vertices, - float &smooth_angle) { + float &smooth_angle) { if (!_surface->_source.empty()) { // This surface is derived from another surface; apply that one // first. @@ -300,9 +300,9 @@ check_material() { if ((_flags & F_diffuse) != 0) { _diffuse_color.set(_color[0] * _diffuse, - _color[1] * _diffuse, - _color[2] * _diffuse, - _color[3]); + _color[1] * _diffuse, + _color[2] * _diffuse, + _color[3]); // We want to avoid setting the diffuse color on the material. // We're already setting the color explicitly on the object, so // there's no need to also set a diffuse color on the material, @@ -314,17 +314,17 @@ check_material() { if ((_flags & F_luminosity) != 0) { Colorf luminosity(_color[0] * _luminosity, - _color[1] * _luminosity, - _color[2] * _luminosity, - 1.0); + _color[1] * _luminosity, + _color[2] * _luminosity, + 1.0); _egg_material->set_emit(luminosity); } if ((_flags & F_specular) != 0) { Colorf specular(_color[0] * _specular, - _color[1] * _specular, - _color[2] * _specular, - 1.0); + _color[1] * _specular, + _color[2] * _specular, + 1.0); _egg_material->set_spec(specular); } diff --git a/pandatool/src/lwoegg/cLwoSurface.h b/pandatool/src/lwoegg/cLwoSurface.h index 0646c977b1..99da31639c 100644 --- a/pandatool/src/lwoegg/cLwoSurface.h +++ b/pandatool/src/lwoegg/cLwoSurface.h @@ -23,7 +23,7 @@ class LwoSurfaceBlock; class EggPrimitive; //////////////////////////////////////////////////////////////////// -// Class : CLwoSurface +// Class : CLwoSurface // Description : This class is a wrapper around LwoSurface and stores // additional information useful during the // conversion-to-egg process. @@ -36,8 +36,8 @@ public: INLINE const string &get_name() const; void apply_properties(EggPrimitive *egg_prim, - vector_PT_EggVertex &egg_vertices, - float &smooth_angle); + vector_PT_EggVertex &egg_vertices, + float &smooth_angle); bool check_texture(); bool check_material(); diff --git a/pandatool/src/lwoegg/cLwoSurfaceBlock.cxx b/pandatool/src/lwoegg/cLwoSurfaceBlock.cxx index a4905dc705..3fdfa43e20 100644 --- a/pandatool/src/lwoegg/cLwoSurfaceBlock.cxx +++ b/pandatool/src/lwoegg/cLwoSurfaceBlock.cxx @@ -47,12 +47,12 @@ CLwoSurfaceBlock(LwoToEggConverter *converter, const LwoSurfaceBlock *block) : if (hchunk->is_of_type(LwoSurfaceBlockChannel::get_class_type())) { const LwoSurfaceBlockChannel *bc = - DCAST(LwoSurfaceBlockChannel, hchunk); + DCAST(LwoSurfaceBlockChannel, hchunk); _channel_id = bc->_channel_id; } else if (hchunk->is_of_type(LwoSurfaceBlockEnabled::get_class_type())) { const LwoSurfaceBlockEnabled *ec = - DCAST(LwoSurfaceBlockEnabled, hchunk); + DCAST(LwoSurfaceBlockEnabled, hchunk); _enabled = ec->_enabled; } } @@ -65,8 +65,8 @@ CLwoSurfaceBlock(LwoToEggConverter *converter, const LwoSurfaceBlock *block) : if (chunk->is_of_type(LwoSurfaceBlockTMap::get_class_type())) { const LwoSurfaceBlockTMap *lwo_tmap = DCAST(LwoSurfaceBlockTMap, chunk); if (_tmap != (CLwoSurfaceBlockTMap *)NULL) { - nout << "Two TMAP chunks encountered within surface block.\n"; - delete _tmap; + nout << "Two TMAP chunks encountered within surface block.\n"; + delete _tmap; } _tmap = new CLwoSurfaceBlockTMap(_converter, lwo_tmap); @@ -99,9 +99,9 @@ CLwoSurfaceBlock(LwoToEggConverter *converter, const LwoSurfaceBlock *block) : } else if (chunk->is_of_type(LwoSurfaceBlockRepeat::get_class_type())) { const LwoSurfaceBlockRepeat *repeat = DCAST(LwoSurfaceBlockRepeat, chunk); if (repeat->get_id() == IffId("WRPW")) { - _w_repeat = repeat->_cycles; + _w_repeat = repeat->_cycles; } else if (repeat->get_id() == IffId("WRPH")) { - _h_repeat = repeat->_cycles; + _h_repeat = repeat->_cycles; } } } @@ -116,8 +116,8 @@ CLwoSurfaceBlock(LwoToEggConverter *converter, const LwoSurfaceBlock *block) : switch (_axis) { case LwoSurfaceBlockAxis::A_x: _transform = LMatrix4d::rotate_mat(90.0, - LVecBase3d::unit_z(), - CS_yup_left) * _transform; + LVecBase3d::unit_z(), + CS_yup_left) * _transform; break; case LwoSurfaceBlockAxis::A_y: @@ -125,8 +125,8 @@ CLwoSurfaceBlock(LwoToEggConverter *converter, const LwoSurfaceBlock *block) : case LwoSurfaceBlockAxis::A_z: _transform = LMatrix4d::rotate_mat(-90.0, - LVecBase3d::unit_x(), - CS_yup_left) * _transform; + LVecBase3d::unit_x(), + CS_yup_left) * _transform; break; } diff --git a/pandatool/src/lwoegg/cLwoSurfaceBlock.h b/pandatool/src/lwoegg/cLwoSurfaceBlock.h index 130eda5197..1dacdd6162 100644 --- a/pandatool/src/lwoegg/cLwoSurfaceBlock.h +++ b/pandatool/src/lwoegg/cLwoSurfaceBlock.h @@ -20,7 +20,7 @@ class LwoToEggConverter; class CLwoSurfaceBlockTMap; //////////////////////////////////////////////////////////////////// -// Class : CLwoSurfaceBlock +// Class : CLwoSurfaceBlock // Description : This class is a wrapper around LwoSurfaceBlock and stores // additional information useful during the // conversion-to-egg process. diff --git a/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.cxx b/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.cxx index a0824af4cd..c02d157209 100644 --- a/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.cxx +++ b/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.cxx @@ -34,11 +34,11 @@ CLwoSurfaceBlockTMap(LwoToEggConverter *converter, const LwoSurfaceBlockTMap *tm if (chunk->is_of_type(LwoSurfaceBlockTransform::get_class_type())) { const LwoSurfaceBlockTransform *trans = DCAST(LwoSurfaceBlockTransform, chunk); if (trans->get_id() == IffId("CNTR")) { - _center = trans->_vec; + _center = trans->_vec; } else if (trans->get_id() == IffId("SIZE")) { - _size = trans->_vec; + _size = trans->_vec; } else if (trans->get_id() == IffId("ROTA")) { - _rotation = trans->_vec; + _rotation = trans->_vec; } } else if (chunk->is_of_type(LwoSurfaceBlockRefObj::get_class_type())) { @@ -62,8 +62,8 @@ CLwoSurfaceBlockTMap(LwoToEggConverter *converter, const LwoSurfaceBlockTMap *tm void CLwoSurfaceBlockTMap:: get_transform(LMatrix4d &mat) const { LPoint3d hpr(rad_2_deg(_rotation[0]), - rad_2_deg(-_rotation[1]), - rad_2_deg(-_rotation[2])); + rad_2_deg(-_rotation[1]), + rad_2_deg(-_rotation[2])); compose_matrix(mat, LCAST(double, _size), hpr, - LCAST(double, _center), CS_yup_left); + LCAST(double, _center), CS_yup_left); } diff --git a/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.h b/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.h index 242a4c9e5d..e17c06220d 100644 --- a/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.h +++ b/pandatool/src/lwoegg/cLwoSurfaceBlockTMap.h @@ -16,7 +16,7 @@ class LwoToEggConverter; //////////////////////////////////////////////////////////////////// -// Class : CLwoSurfaceBlockTMap +// Class : CLwoSurfaceBlockTMap // Description : This class is a wrapper around LwoSurfaceBlockTMap // and stores additional information useful during the // conversion-to-egg process. diff --git a/pandatool/src/lwoegg/lwoToEggConverter.cxx b/pandatool/src/lwoegg/lwoToEggConverter.cxx index 483c4a1762..fba73c9047 100644 --- a/pandatool/src/lwoegg/lwoToEggConverter.cxx +++ b/pandatool/src/lwoegg/lwoToEggConverter.cxx @@ -123,8 +123,8 @@ convert_file(const Filename &filename) { LwoHeader *header = DCAST(LwoHeader, chunk); if (!header->is_valid()) { nout << "File " << filename - << " is not recognized as a Lightwave Object file. " - << "Perhaps the version is too recent.\n"; + << " is not recognized as a Lightwave Object file. " + << "Perhaps the version is too recent.\n"; return false; } @@ -281,7 +281,7 @@ collect_lwo() { slot_layer(number); if (_layers[number] != (CLwoLayer *)NULL) { - nout << "Warning: multiple layers with number " << number << "\n"; + nout << "Warning: multiple layers with number " << number << "\n"; } _layers[number] = layer; last_layer = layer; @@ -296,13 +296,13 @@ collect_lwo() { slot_clip(index); if (_clips[index] != (CLwoClip *)NULL) { - nout << "Warning: multiple clips with index " << index << "\n"; + nout << "Warning: multiple clips with index " << index << "\n"; } _clips[index] = clip; } else if (chunk->is_of_type(LwoPoints::get_class_type())) { if (last_layer == (CLwoLayer *)NULL) { - last_layer = make_generic_layer(); + last_layer = make_generic_layer(); } const LwoPoints *lwo_points = DCAST(LwoPoints, chunk); @@ -312,18 +312,18 @@ collect_lwo() { } else if (chunk->is_of_type(LwoVertexMap::get_class_type())) { if (last_points == (CLwoPoints *)NULL) { - nout << "Vertex map chunk encountered without a preceding points chunk.\n"; + nout << "Vertex map chunk encountered without a preceding points chunk.\n"; } else { - const LwoVertexMap *lwo_vmap = DCAST(LwoVertexMap, chunk); - last_points->add_vmap(lwo_vmap); + const LwoVertexMap *lwo_vmap = DCAST(LwoVertexMap, chunk); + last_points->add_vmap(lwo_vmap); } } else if (chunk->is_of_type(LwoDiscontinuousVertexMap::get_class_type())) { if (last_polygons == (CLwoPolygons *)NULL) { - nout << "Discontinous vertex map chunk encountered without a preceding polygons chunk.\n"; + nout << "Discontinous vertex map chunk encountered without a preceding polygons chunk.\n"; } else { - const LwoDiscontinuousVertexMap *lwo_vmad = DCAST(LwoDiscontinuousVertexMap, chunk); - last_polygons->add_vmad(lwo_vmad); + const LwoDiscontinuousVertexMap *lwo_vmad = DCAST(LwoDiscontinuousVertexMap, chunk); + last_polygons->add_vmad(lwo_vmad); } } else if (chunk->is_of_type(LwoTags::get_class_type())) { @@ -331,28 +331,28 @@ collect_lwo() { } else if (chunk->is_of_type(LwoPolygons::get_class_type())) { if (last_points == (CLwoPoints *)NULL) { - nout << "Polygon chunk encountered without a preceding points chunk.\n"; + nout << "Polygon chunk encountered without a preceding points chunk.\n"; } else { - const LwoPolygons *lwo_polygons = DCAST(LwoPolygons, chunk); - CLwoPolygons *polygons = - new CLwoPolygons(this, lwo_polygons, last_points); - _polygons.push_back(polygons); - last_polygons = polygons; + const LwoPolygons *lwo_polygons = DCAST(LwoPolygons, chunk); + CLwoPolygons *polygons = + new CLwoPolygons(this, lwo_polygons, last_points); + _polygons.push_back(polygons); + last_polygons = polygons; } } else if (chunk->is_of_type(LwoPolygonTags::get_class_type())) { if (last_polygons == (CLwoPolygons *)NULL) { - nout << "Polygon tags chunk encountered without a preceding polygons chunk.\n"; + nout << "Polygon tags chunk encountered without a preceding polygons chunk.\n"; } else if (tags == (LwoTags *)NULL) { - nout << "Polygon tags chunk encountered without a preceding tags chunk.\n"; + nout << "Polygon tags chunk encountered without a preceding tags chunk.\n"; } else { - const LwoPolygonTags *lwo_ptags = DCAST(LwoPolygonTags, chunk); - last_polygons->add_ptags(lwo_ptags, tags); + const LwoPolygonTags *lwo_ptags = DCAST(LwoPolygonTags, chunk); + last_polygons->add_ptags(lwo_ptags, tags); } } else if (chunk->is_of_type(LwoSurface::get_class_type())) { if (last_layer == (CLwoLayer *)NULL) { - last_layer = make_generic_layer(); + last_layer = make_generic_layer(); } const LwoSurface *lwo_surface = DCAST(LwoSurface, chunk); @@ -360,8 +360,8 @@ collect_lwo() { bool inserted = _surfaces.insert(Surfaces::value_type(surface->get_name(), surface)).second; if (!inserted) { - nout << "Multiple surface definitions named " << surface->get_name() << "\n"; - delete surface; + nout << "Multiple surface definitions named " << surface->get_name() << "\n"; + delete surface; } } } diff --git a/pandatool/src/lwoegg/lwoToEggConverter.h b/pandatool/src/lwoegg/lwoToEggConverter.h index 4dbc0aed9a..fb5208acaf 100644 --- a/pandatool/src/lwoegg/lwoToEggConverter.h +++ b/pandatool/src/lwoegg/lwoToEggConverter.h @@ -23,7 +23,7 @@ class CLwoSurface; class LwoClip; //////////////////////////////////////////////////////////////////// -// Class : LwoToEggConverter +// Class : LwoToEggConverter // Description : This class supervises the construction of an EggData // structure from the data represented by the LwoHeader. // Reading and writing the egg and lwo structures is diff --git a/pandatool/src/lwoprogs/lwoScan.h b/pandatool/src/lwoprogs/lwoScan.h index e48edcc0aa..2859e0f944 100644 --- a/pandatool/src/lwoprogs/lwoScan.h +++ b/pandatool/src/lwoprogs/lwoScan.h @@ -10,7 +10,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoScan +// Class : LwoScan // Description : A program to read a Lightwave file and report its // structure and contents. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/lwoprogs/lwoToEgg.h b/pandatool/src/lwoprogs/lwoToEgg.h index fb6c1a4734..05cca8adb6 100644 --- a/pandatool/src/lwoprogs/lwoToEgg.h +++ b/pandatool/src/lwoprogs/lwoToEgg.h @@ -14,7 +14,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : LwoToEgg +// Class : LwoToEgg // Description : A program to read a Lightwave file and generate an egg // file. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/maya/mayaFile.cxx b/pandatool/src/maya/mayaFile.cxx index 5d40c0ac8d..dc92c94acd 100644 --- a/pandatool/src/maya/mayaFile.cxx +++ b/pandatool/src/maya/mayaFile.cxx @@ -101,7 +101,7 @@ traverse(EggData &data) { nout << "Traversing scene graph.\n"; } - // Scan the entire DAG and output the name and depth of each node + // Scan the entire DAG and output the name and depth of each node while (!dag_iterator.isDone()) { MDagPath dag_path; status = dag_iterator.getPath(dag_path); @@ -135,7 +135,7 @@ process_node(const MDagPath &dag_path, EggData &data) { nout << "." << flush; } else if (verbose >= 2) { nout << dag_node.name() << ": " << dag_node.typeName() << "\n" - << " dag_path: " << dag_path.fullPathName() << "\n"; + << " dag_path: " << dag_path.fullPathName() << "\n"; } if (dag_path.hasFn(MFn::kCamera)) { @@ -160,12 +160,12 @@ process_node(const MDagPath &dag_path, EggData &data) { MFnNurbsSurface surface(dag_path, &status); if (!status) { - if (verbose >= 2) { - nout << "Error in node " << dag_path.fullPathName() << ":\n" - << " it appears to have a NURBS surface, but does not.\n"; - } + if (verbose >= 2) { + nout << "Error in node " << dag_path.fullPathName() << ":\n" + << " it appears to have a NURBS surface, but does not.\n"; + } } else { - make_nurbs_surface(dag_path, surface, egg_group); + make_nurbs_surface(dag_path, surface, egg_group); } } @@ -181,12 +181,12 @@ process_node(const MDagPath &dag_path, EggData &data) { MFnNurbsCurve curve(dag_path, &status); if (!status) { - if (verbose >= 2) { - nout << "Error in node " << dag_path.fullPathName() << ":\n" - << " it appears to have a NURBS curve, but does not.\n"; - } + if (verbose >= 2) { + nout << "Error in node " << dag_path.fullPathName() << ":\n" + << " it appears to have a NURBS curve, but does not.\n"; + } } else { - make_nurbs_curve(dag_path, curve, egg_group); + make_nurbs_curve(dag_path, curve, egg_group); } } @@ -202,12 +202,12 @@ process_node(const MDagPath &dag_path, EggData &data) { MFnMesh mesh(dag_path, &status); if (!status) { - if (verbose >= 2) { - nout << "Error in node " << dag_path.fullPathName() << ":\n" - << " it appears to have a polygon mesh, but does not.\n"; - } + if (verbose >= 2) { + nout << "Error in node " << dag_path.fullPathName() << ":\n" + << " it appears to have a polygon mesh, but does not.\n"; + } } else { - make_polyset(dag_path, mesh, egg_group); + make_polyset(dag_path, mesh, egg_group); } } @@ -242,24 +242,24 @@ get_transform(const MDagPath &dag_path, EggGroup *egg_group) { return; } - MTransformationMatrix matrix(transform.transformationMatrix()); + MTransformationMatrix matrix(transform.transformationMatrix()); if (verbose >= 3) { nout << " translation: " << matrix.translation(MSpace::kWorld) - << "\n"; + << "\n"; double d[3]; MTransformationMatrix::RotationOrder rOrder; matrix.getRotation(d, rOrder, MSpace::kWorld); nout << " rotation: [" - << d[0] << ", " - << d[1] << ", " - << d[2] << "]\n"; + << d[0] << ", " + << d[1] << ", " + << d[2] << "]\n"; matrix.getScale(d, MSpace::kWorld); nout << " scale: [" - << d[0] << ", " - << d[1] << ", " - << d[2] << "]\n"; + << d[0] << ", " + << d[1] << ", " + << d[2] << "]\n"; } MMatrix mat = matrix.asMatrix(); @@ -269,34 +269,34 @@ get_transform(const MDagPath &dag_path, EggGroup *egg_group) { if (!mat.isEquivalent(ident_mat, 0.0001)) { egg_group->set_transform (LMatrix4d(mat[0][0], mat[0][1], mat[0][2], mat[0][3], - mat[1][0], mat[1][1], mat[1][2], mat[1][3], - mat[2][0], mat[2][1], mat[2][2], mat[2][3], - mat[3][0], mat[3][1], mat[3][2], mat[3][3])); + mat[1][0], mat[1][1], mat[1][2], mat[1][3], + mat[2][0], mat[2][1], mat[2][2], mat[2][3], + mat[3][0], mat[3][1], mat[3][2], mat[3][3])); } } void MayaFile:: make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, - EggGroup *egg_group) { + EggGroup *egg_group) { MStatus status; string name = surface.name().asChar(); if (verbose >= 3) { nout << " numCVs: " - << surface.numCVsInU() - << " * " - << surface.numCVsInV() - << "\n"; + << surface.numCVsInU() + << " * " + << surface.numCVsInV() + << "\n"; nout << " numKnots: " - << surface.numKnotsInU() - << " * " - << surface.numKnotsInV() - << "\n"; + << surface.numKnotsInU() + << " * " + << surface.numKnotsInV() + << "\n"; nout << " numSpans: " - << surface.numSpansInU() - << " * " - << surface.numSpansInV() - << "\n"; + << surface.numSpansInU() + << " * " + << surface.numSpansInV() + << "\n"; } MayaShader *shader = _shaders.find_shader_for_node(surface.object()); @@ -374,7 +374,7 @@ make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, EggNurbsSurface *egg_nurbs = new EggNurbsSurface(name); egg_nurbs->setup(u_degree + 1, v_degree + 1, - u_knots + 2, v_knots + 2); + u_knots + 2, v_knots + 2); int i; @@ -418,45 +418,45 @@ make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, EggNurbsSurface::Loop &egg_loop = egg_trim.back(); MFnNurbsSurface::BoundaryType type = - surface.boundaryType(ti, li, &status); + surface.boundaryType(ti, li, &status); bool keep_loop = false; if (!status) { - status.perror("MFnNurbsSurface::BoundaryType"); + status.perror("MFnNurbsSurface::BoundaryType"); } else { - keep_loop = (type == MFnNurbsSurface::kInner || - type == MFnNurbsSurface::kOuter); + keep_loop = (type == MFnNurbsSurface::kInner || + type == MFnNurbsSurface::kOuter); } if (keep_loop) { - unsigned num_edges = surface.numEdges(ti, li); - for (unsigned ei = 0; ei < num_edges; ei++) { - MObjectArray edge = surface.edge(ti, li, ei, true, &status); - if (!status) { - status.perror("MFnNurbsSurface::edge"); - } else { - unsigned num_segs = edge.length(); - for (unsigned si = 0; si < num_segs; si++) { - MObject segment = edge[si]; - if (segment.hasFn(MFn::kNurbsCurve)) { - MFnNurbsCurve curve(segment, &status); - if (!status) { - nout << "Trim curve appears to be a nurbs curve, but isn't.\n"; - } else { - // Finally, we have a valid curve! - EggNurbsCurve *egg_curve = - make_trim_curve(curve, name, egg_group, trim_curve_index); - trim_curve_index++; - if (egg_curve != (EggNurbsCurve *)NULL) { - egg_loop.push_back(egg_curve); - } - } - } else { - nout << "Trim curve segment is not a nurbs curve.\n"; - } - } - } - } + unsigned num_edges = surface.numEdges(ti, li); + for (unsigned ei = 0; ei < num_edges; ei++) { + MObjectArray edge = surface.edge(ti, li, ei, true, &status); + if (!status) { + status.perror("MFnNurbsSurface::edge"); + } else { + unsigned num_segs = edge.length(); + for (unsigned si = 0; si < num_segs; si++) { + MObject segment = edge[si]; + if (segment.hasFn(MFn::kNurbsCurve)) { + MFnNurbsCurve curve(segment, &status); + if (!status) { + nout << "Trim curve appears to be a nurbs curve, but isn't.\n"; + } else { + // Finally, we have a valid curve! + EggNurbsCurve *egg_curve = + make_trim_curve(curve, name, egg_group, trim_curve_index); + trim_curve_index++; + if (egg_curve != (EggNurbsCurve *)NULL) { + egg_loop.push_back(egg_curve); + } + } + } else { + nout << "Trim curve segment is not a nurbs curve.\n"; + } + } + } + } } } } @@ -472,18 +472,18 @@ make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, EggNurbsCurve *MayaFile:: make_trim_curve(MFnNurbsCurve curve, const string &nurbs_name, - EggGroupNode *egg_group, int trim_curve_index) { + EggGroupNode *egg_group, int trim_curve_index) { if (verbose >= 3) { nout << "Trim curve:\n"; nout << " numCVs: " - << curve.numCVs() - << "\n"; + << curve.numCVs() + << "\n"; nout << " numKnots: " - << curve.numKnots() - << "\n"; + << curve.numKnots() + << "\n"; nout << " numSpans: " - << curve.numSpans() - << "\n"; + << curve.numSpans() + << "\n"; } MStatus status; @@ -546,20 +546,20 @@ make_trim_curve(MFnNurbsCurve curve, const string &nurbs_name, void MayaFile:: make_nurbs_curve(const MDagPath &, MFnNurbsCurve curve, - EggGroup *egg_group) { + EggGroup *egg_group) { MStatus status; string name = curve.name().asChar(); if (verbose >= 3) { nout << " numCVs: " - << curve.numCVs() - << "\n"; + << curve.numCVs() + << "\n"; nout << " numKnots: " - << curve.numKnots() - << "\n"; + << curve.numKnots() + << "\n"; nout << " numSpans: " - << curve.numSpans() - << "\n"; + << curve.numSpans() + << "\n"; } MPointArray cv_array; @@ -619,17 +619,17 @@ make_nurbs_curve(const MDagPath &, MFnNurbsCurve curve, void MayaFile:: make_polyset(const MDagPath &dag_path, MFnMesh mesh, - EggGroup *egg_group, MayaShader *default_shader) { + EggGroup *egg_group, MayaShader *default_shader) { MStatus status; string name = mesh.name().asChar(); if (verbose >= 3) { nout << " numPolygons: " - << mesh.numPolygons() - << "\n"; + << mesh.numPolygons() + << "\n"; nout << " numVertices: " - << mesh.numVertices() - << "\n"; + << mesh.numVertices() + << "\n"; } if (mesh.numPolygons() == 0) { @@ -662,7 +662,7 @@ make_polyset(const MDagPath &dag_path, MFnMesh mesh, MIntArray poly_shader_indices; status = mesh.getConnectedShaders(dag_path.instanceNumber(), - shaders, poly_shader_indices); + shaders, poly_shader_indices); if (!status) { status.perror("MFnMesh::getConnectedShaders"); } @@ -681,29 +681,29 @@ make_polyset(const MDagPath &dag_path, MFnMesh mesh, MVector n; status = pi.getNormal(i, n, MSpace::kWorld); if (!status) { - status.perror("MItMeshPolygon::getNormal"); + status.perror("MItMeshPolygon::getNormal"); } else { - vert.set_normal(LVector3d(n[0], n[1], n[2])); + vert.set_normal(LVector3d(n[0], n[1], n[2])); } if (pi.hasUVs()) { - float2 uvs; - status = pi.getUV(i, uvs); - if (!status) { - status.perror("MItMeshPolygon::getUV"); - } else { - vert.set_uv(TexCoordd(uvs[0], uvs[1])); - } + float2 uvs; + status = pi.getUV(i, uvs); + if (!status) { + status.perror("MItMeshPolygon::getUV"); + } else { + vert.set_uv(TexCoordd(uvs[0], uvs[1])); + } } if (pi.hasColor()) { - MColor c; - status = pi.getColor(c, i); - if (!status) { - status.perror("MItMeshPolygon::getColor"); - } else { - vert.set_color(Colorf(c.r, c.g, c.b, 1.0)); - } + MColor c; + status = pi.getColor(c, i); + if (!status) { + status.perror("MItMeshPolygon::getColor"); + } else { + vert.set_color(Colorf(c.r, c.g, c.b, 1.0)); + } } egg_poly->add_vertex(vpool->create_unique_vertex(vert)); @@ -717,9 +717,9 @@ make_polyset(const MDagPath &dag_path, MFnMesh mesh, assert(shader_index >= 0 && shader_index < shaders.length()); MObject engine = shaders[shader_index]; MayaShader *shader = - _shaders.find_shader_for_shading_engine(engine); + _shaders.find_shader_for_shading_engine(engine); if (shader != (MayaShader *)NULL) { - shader->set_attributes(*egg_poly, *this); + shader->set_attributes(*egg_poly, *this); } } else if (default_shader != (MayaShader *)NULL) { diff --git a/pandatool/src/maya/mayaFile.h b/pandatool/src/maya/mayaFile.h index 8fde42dcf0..e198a22f31 100644 --- a/pandatool/src/maya/mayaFile.h +++ b/pandatool/src/maya/mayaFile.h @@ -37,16 +37,16 @@ private: bool process_node(const MDagPath &dag_path, EggData &data); void get_transform(const MDagPath &dag_path, EggGroup *egg_group); void make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, - EggGroup *group); + EggGroup *group); EggNurbsCurve *make_trim_curve(MFnNurbsCurve curve, - const string &nurbs_name, - EggGroupNode *egg_group, - int trim_curve_index); + const string &nurbs_name, + EggGroupNode *egg_group, + int trim_curve_index); void make_nurbs_curve(const MDagPath &dag_path, MFnNurbsCurve curve, - EggGroup *group); + EggGroup *group); void make_polyset(const MDagPath &dag_path, MFnMesh mesh, - EggGroup *egg_group, - MayaShader *default_shader = NULL); + EggGroup *egg_group, + MayaShader *default_shader = NULL); EggGroup *get_egg_group(const string &name, EggData &data); diff --git a/pandatool/src/maya/mayaShader.cxx b/pandatool/src/maya/mayaShader.cxx index 22d18736fd..ee3b4d6590 100644 --- a/pandatool/src/maya/mayaShader.cxx +++ b/pandatool/src/maya/mayaShader.cxx @@ -87,9 +87,9 @@ set_attributes(EggPrimitive &primitive, MayaFile &file) { LMatrix3d MayaShader:: compute_texture_matrix() { LVector2d scale(_repeat_uv[0] / _coverage[0], - _repeat_uv[1] / _coverage[1]); + _repeat_uv[1] / _coverage[1]); LVector2d trans(_offset[0] - _translate_frame[0] / _coverage[0], - _offset[1] - _translate_frame[1] / _coverage[1]); + _offset[1] - _translate_frame[1] / _coverage[1]); return (LMatrix3d::translate_mat(LVector2d(-0.5, -0.5)) * @@ -105,16 +105,16 @@ output(ostream &out) const { out << "Shader " << _name << ":\n"; if (_has_texture) { out << " texture is " << _texture << "\n" - << " coverage is " << _coverage << "\n" - << " translate_frame is " << _translate_frame << "\n" - << " rotate_frame is " << _rotate_frame << "\n" - << " mirror is " << _mirror << "\n" - << " stagger is " << _stagger << "\n" - << " wrap_u is " << _wrap_u << "\n" - << " wrap_v is " << _wrap_v << "\n" - << " repeat_uv is " << _repeat_uv << "\n" - << " offset is " << _offset << "\n" - << " rotate_uv is " << _rotate_uv << "\n"; + << " coverage is " << _coverage << "\n" + << " translate_frame is " << _translate_frame << "\n" + << " rotate_frame is " << _rotate_frame << "\n" + << " mirror is " << _mirror << "\n" + << " stagger is " << _stagger << "\n" + << " wrap_u is " << _wrap_u << "\n" + << " wrap_v is " << _wrap_v << "\n" + << " repeat_uv is " << _repeat_uv << "\n" + << " offset is " << _offset << "\n" + << " rotate_uv is " << _rotate_uv << "\n"; } else if (_has_color) { out << " color is " << _color << "\n"; @@ -184,17 +184,17 @@ read_surface_color(MObject color) { // This shader wasn't understood. if (verbose >= 2) { nout << "**Don't know how to interpret color attribute type " - << color.apiTypeStr() << "\n"; + << color.apiTypeStr() << "\n"; } else { // If we don't have a heavy verbose count, only report each type // of unsupportted shader once. static set bad_types; if (bad_types.insert(color.apiType()).second) { - if (verbose == 1) { - nout << "\n"; - } - nout << "Don't know how to interpret color attribute type " - << color.apiTypeStr() << "\n"; + if (verbose == 1) { + nout << "\n"; + } + nout << "Don't know how to interpret color attribute type " + << color.apiTypeStr() << "\n"; } } } diff --git a/pandatool/src/maya/mayaToEgg.h b/pandatool/src/maya/mayaToEgg.h index 6cdb023278..5c86a7df7c 100644 --- a/pandatool/src/maya/mayaToEgg.h +++ b/pandatool/src/maya/mayaToEgg.h @@ -13,7 +13,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : MayaToEgg +// Class : MayaToEgg // Description : //////////////////////////////////////////////////////////////////// class MayaToEgg : public SomethingToEgg { diff --git a/pandatool/src/maya/maya_funcs.I b/pandatool/src/maya/maya_funcs.I index 05e19e02fc..bd136f0cf3 100644 --- a/pandatool/src/maya/maya_funcs.I +++ b/pandatool/src/maya/maya_funcs.I @@ -12,7 +12,7 @@ template bool get_maya_attribute(MObject &node, const string &attribute_name, - ValueType &value) { + ValueType &value) { MStatus status; MFnDependencyNode node_fn(node, &status); if (!status) { @@ -23,14 +23,14 @@ get_maya_attribute(MObject &node, const string &attribute_name, MObject attr = node_fn.attribute(attribute_name.c_str(), &status); if (!status) { nout << "Object " << node_fn.name() << " does not support attribute " - << attribute_name << "\n"; + << attribute_name << "\n"; return false; } MFnAttribute attr_fn(attr, &status); if (!status) { nout << "Attribute " << attribute_name << " on " << node_fn.name() - << " is a " << attr.apiTypeStr() << ", not an Attribute.\n"; + << " is a " << attr.apiTypeStr() << ", not an Attribute.\n"; return false; } diff --git a/pandatool/src/maya/maya_funcs.cxx b/pandatool/src/maya/maya_funcs.cxx index 8a80e5ae53..08fd9dec98 100644 --- a/pandatool/src/maya/maya_funcs.cxx +++ b/pandatool/src/maya/maya_funcs.cxx @@ -14,10 +14,10 @@ bool get_bool_attribute(MObject &node, const string &attribute_name, - bool &value) { + bool &value) { if (!get_maya_attribute(node, attribute_name, value)) { nout << "Attribute " << attribute_name - << " does not have an bool value.\n"; + << " does not have an bool value.\n"; describe_maya_attribute(node, attribute_name); return false; } @@ -26,11 +26,11 @@ get_bool_attribute(MObject &node, const string &attribute_name, bool get_angle_attribute(MObject &node, const string &attribute_name, - double &value) { + double &value) { MAngle maya_value; if (!get_maya_attribute(node, attribute_name, maya_value)) { nout << "Attribute " << attribute_name - << " does not have an angle value.\n"; + << " does not have an angle value.\n"; describe_maya_attribute(node, attribute_name); return false; } @@ -40,13 +40,13 @@ get_angle_attribute(MObject &node, const string &attribute_name, bool get_vec2f_attribute(MObject &node, const string &attribute_name, - LVecBase2f &value) { + LVecBase2f &value) { MStatus status; MObject vec2f_object; if (!get_maya_attribute(node, attribute_name, vec2f_object)) { nout << "Attribute " << attribute_name - << " does not have a vec2f object value.\n"; + << " does not have a vec2f object value.\n"; describe_maya_attribute(node, attribute_name); return false; } @@ -54,14 +54,14 @@ get_vec2f_attribute(MObject &node, const string &attribute_name, MFnNumericData data(vec2f_object, &status); if (!status) { nout << "Attribute " << attribute_name << " is of type " - << vec2f_object.apiTypeStr() << ", not a NumericData.\n"; + << vec2f_object.apiTypeStr() << ", not a NumericData.\n"; return false; } status = data.getData(value[0], value[1]); if (!status) { nout << "Unable to extract 2 floats from " << attribute_name - << ", of type " << vec2f_object.apiTypeStr() << "\n"; + << ", of type " << vec2f_object.apiTypeStr() << "\n"; } return true; @@ -69,13 +69,13 @@ get_vec2f_attribute(MObject &node, const string &attribute_name, bool get_vec2d_attribute(MObject &node, const string &attribute_name, - LVecBase2d &value) { + LVecBase2d &value) { MStatus status; MObject vec2d_object; if (!get_maya_attribute(node, attribute_name, vec2d_object)) { nout << "Attribute " << attribute_name - << " does not have a vec2d object value.\n"; + << " does not have a vec2d object value.\n"; describe_maya_attribute(node, attribute_name); return false; } @@ -83,14 +83,14 @@ get_vec2d_attribute(MObject &node, const string &attribute_name, MFnNumericData data(vec2d_object, &status); if (!status) { nout << "Attribute " << attribute_name << " is of type " - << vec2d_object.apiTypeStr() << ", not a NumericData.\n"; + << vec2d_object.apiTypeStr() << ", not a NumericData.\n"; return false; } status = data.getData(value[0], value[1]); if (!status) { nout << "Unable to extract 2 doubles from " << attribute_name - << ", of type " << vec2d_object.apiTypeStr() << "\n"; + << ", of type " << vec2d_object.apiTypeStr() << "\n"; } return true; @@ -98,13 +98,13 @@ get_vec2d_attribute(MObject &node, const string &attribute_name, bool get_string_attribute(MObject &node, const string &attribute_name, - string &value) { + string &value) { MStatus status; MObject string_object; if (!get_maya_attribute(node, attribute_name, string_object)) { nout << "Attribute " << attribute_name - << " does not have an string object value.\n"; + << " does not have an string object value.\n"; describe_maya_attribute(node, attribute_name); return false; } @@ -112,7 +112,7 @@ get_string_attribute(MObject &node, const string &attribute_name, MFnStringData data(string_object, &status); if (!status) { nout << "Attribute " << attribute_name << " is of type " - << string_object.apiTypeStr() << ", not a StringData.\n"; + << string_object.apiTypeStr() << ", not a StringData.\n"; return false; } @@ -132,7 +132,7 @@ describe_maya_attribute(MObject &node, const string &attribute_name) { MObject attr = node_fn.attribute(attribute_name.c_str(), &status); if (!status) { nout << "Object " << node_fn.name() << " does not support attribute " - << attribute_name << "\n"; + << attribute_name << "\n"; return; } diff --git a/pandatool/src/maya/maya_funcs.h b/pandatool/src/maya/maya_funcs.h index 1c39d50ebe..b855a3cc74 100644 --- a/pandatool/src/maya/maya_funcs.h +++ b/pandatool/src/maya/maya_funcs.h @@ -17,27 +17,27 @@ class MObject; template bool get_maya_attribute(MObject &node, const string &attribute_name, - ValueType &value); + ValueType &value); bool get_bool_attribute(MObject &node, const string &attribute_name, - bool &value); + bool &value); bool get_angle_attribute(MObject &node, const string &attribute_name, - double &value); + double &value); bool get_vec2f_attribute(MObject &node, const string &attribute_name, - LVecBase2f &value); + LVecBase2f &value); bool get_vec2d_attribute(MObject &node, const string &attribute_name, - LVecBase2d &value); + LVecBase2d &value); bool get_string_attribute(MObject &node, const string &attribute_name, - string &value); + string &value); void describe_maya_attribute(MObject &node, const string &attribute_name); diff --git a/pandatool/src/progbase/programBase.cxx b/pandatool/src/progbase/programBase.cxx index db95f5f0ad..ea1dfe43ad 100644 --- a/pandatool/src/progbase/programBase.cxx +++ b/pandatool/src/progbase/programBase.cxx @@ -80,8 +80,8 @@ ProgramBase() { _got_option_indent = false; add_option("h", "", 100, - "Display this help page.", - &ProgramBase::handle_help_option, NULL, (void *)this); + "Display this help page.", + &ProgramBase::handle_help_option, NULL, (void *)this); // Should we report DConfig's debugging information? if (dconfig_cat.is_debug()) { @@ -175,7 +175,7 @@ show_text(const string &prefix, int indent_width, string text) { // nout would be cyclic, since nout is redefined to map back through // this function. format_text(cerr, _last_newline, - prefix, indent_width, text, _terminal_width); + prefix, indent_width, text, _terminal_width); } //////////////////////////////////////////////////////////////////// @@ -226,8 +226,8 @@ parse_command_line(int argc, char *argv[]) { short_options += opt._option; if (!opt._parm_name.empty()) { - // This option takes an argument. - short_options += ':'; + // This option takes an argument. + short_options += ':'; } } else { // This is a "long" option; we'll assign it the next available @@ -288,30 +288,30 @@ parse_command_line(int argc, char *argv[]) { default: { - // A normal option. Figure out which one it is. - Options::const_iterator ii; - ii = options.find(flag); - if (ii == options.end()) { - nout << "Internal error! Invalid option index returned.\n"; - abort(); - } - - const Option &opt = *(*ii).second; - bool okflag = true; - if (opt._option_function != (OptionDispatchFunction)NULL) { - okflag = (*opt._option_function)(opt._option, arg, opt._option_data); - } - if (opt._option_method != (OptionDispatchMethod)NULL) { - okflag = (*opt._option_method)(this, opt._option, arg, opt._option_data); - } - if (opt._bool_var != (bool *)NULL) { - (*opt._bool_var) = true; - } - - if (!okflag) { - show_usage(); - exit(1); - } + // A normal option. Figure out which one it is. + Options::const_iterator ii; + ii = options.find(flag); + if (ii == options.end()) { + nout << "Internal error! Invalid option index returned.\n"; + abort(); + } + + const Option &opt = *(*ii).second; + bool okflag = true; + if (opt._option_function != (OptionDispatchFunction)NULL) { + okflag = (*opt._option_function)(opt._option, arg, opt._option_data); + } + if (opt._option_method != (OptionDispatchMethod)NULL) { + okflag = (*opt._option_method)(this, opt._option, arg, opt._option_data); + } + if (opt._bool_var != (bool *)NULL) { + (*opt._bool_var) = true; + } + + if (!okflag) { + show_usage(); + exit(1); + } } } @@ -454,9 +454,9 @@ clear_options() { //////////////////////////////////////////////////////////////////// void ProgramBase:: add_option(const string &option, const string &parm_name, - int index_group, const string &description, - OptionDispatchFunction option_function, - bool *bool_var, void *option_data) { + int index_group, const string &description, + OptionDispatchFunction option_function, + bool *bool_var, void *option_data) { Option opt; opt._option = option; opt._parm_name = parm_name; @@ -495,9 +495,9 @@ add_option(const string &option, const string &parm_name, //////////////////////////////////////////////////////////////////// void ProgramBase:: add_option(const string &option, const string &parm_name, - int index_group, const string &description, - OptionDispatchMethod option_method, - bool *bool_var, void *option_data) { + int index_group, const string &description, + OptionDispatchMethod option_method, + bool *bool_var, void *option_data) { Option opt; opt._option = option; opt._parm_name = parm_name; @@ -633,7 +633,7 @@ dispatch_int(const string &opt, const string &arg, void *var) { if (!string_to_int(arg, *ip)) { nout << "Invalid integer parameter for -" << opt << ": " - << arg << "\n"; + << arg << "\n"; return false; } @@ -663,7 +663,7 @@ dispatch_int_pair(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires a pair of integers separated by a comma.\n"; + << " requires a pair of integers separated by a comma.\n"; return false; } @@ -683,7 +683,7 @@ dispatch_double(const string &opt, const string &arg, void *var) { if (!string_to_double(arg, *ip)) { nout << "Invalid numeric parameter for -" << opt << ": " - << arg << "\n"; + << arg << "\n"; return false; } @@ -713,7 +713,7 @@ dispatch_double_pair(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires a pair of numbers separated by a comma.\n"; + << " requires a pair of numbers separated by a comma.\n"; return false; } @@ -744,7 +744,7 @@ dispatch_double_triple(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires three numbers separated by commas.\n"; + << " requires three numbers separated by commas.\n"; return false; } @@ -776,7 +776,7 @@ dispatch_double_quad(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires four numbers separated by commas.\n"; + << " requires four numbers separated by commas.\n"; return false; } @@ -816,7 +816,7 @@ dispatch_color(const string &opt, const string &arg, void *var) { if (!okflag) { nout << "-" << opt - << " requires three or four numbers separated by commas.\n"; + << " requires three or four numbers separated by commas.\n"; return false; } @@ -896,7 +896,7 @@ dispatch_coordinate_system(const string &opt, const string &arg, void *var) { if ((*ip) == CS_invalid) { nout << "Invalid coordinate system for -" << opt << ": " << arg << "\n" - << "Valid coordinate system strings are any of 'y-up', 'z-up', " + << "Valid coordinate system strings are any of 'y-up', 'z-up', " "'y-up-left', or 'z-up-left'.\n"; return false; } @@ -919,7 +919,7 @@ dispatch_units(const string &opt, const string &arg, void *var) { if ((*ip) == DU_invalid) { nout << "Invalid units for -" << opt << ": " << arg << "\n" - << "Valid units are mm, cm, m, km, yd, ft, in, nmi, and mi.\n"; + << "Valid units are mm, cm, m, km, yd, ft, in, nmi, and mi.\n"; return false; } @@ -969,8 +969,8 @@ handle_help_option(const string &, const string &, void *data) { //////////////////////////////////////////////////////////////////// void ProgramBase:: format_text(ostream &out, bool &last_newline, - const string &prefix, int indent_width, - const string &text, int line_width) { + const string &prefix, int indent_width, + const string &text, int line_width) { indent_width = min(indent_width, line_width - 20); int indent_amount = indent_width; bool initial_break = false; @@ -990,12 +990,12 @@ format_text(ostream &out, bool &last_newline, // Skip any initial whitespace and newlines. while (p < text.length() && isspace(text[p])) { if (text[p] == '\r' || - (p > 0 && text[p] == '\n' && text[p - 1] == '\n') || - (p == 0 && text[p] == '\n' && last_newline)) { + (p > 0 && text[p] == '\n' && text[p - 1] == '\n') || + (p == 0 && text[p] == '\n' && last_newline)) { if (!initial_break) { - // Here's an initial paragraph break, however. - out << "\n"; - initial_break = true; + // Here's an initial paragraph break, however. + out << "\n"; + initial_break = true; } indent_amount = indent_width; @@ -1020,7 +1020,7 @@ format_text(ostream &out, bool &last_newline, if (par == string::npos) { par = text.length(); /* - This shouldn't be necessary. + This shouldn't be necessary. } else { is_paragraph_break = (text[par] == '\r'); */ @@ -1040,21 +1040,21 @@ format_text(ostream &out, bool &last_newline, size_t min_eol = max((int)p, (int)eol - 25); size_t q = eol; while (q > min_eol && !isspace(text[q])) { - q--; + q--; } // Now roll back to the last non-space before this one. while (q > min_eol && isspace(text[q])) { - q--; + q--; } if (q != min_eol) { - // Here's a good place to stop! - eol = q + 1; + // Here's a good place to stop! + eol = q + 1; } else { - // The line cannot be broken cleanly. Just let it keep going; - // don't try to wrap it. - eol = par; + // The line cannot be broken cleanly. Just let it keep going; + // don't try to wrap it. + eol = par; } } out << text.substr(p, eol - p) << "\n"; @@ -1063,8 +1063,8 @@ format_text(ostream &out, bool &last_newline, // Skip additional whitespace between the lines. while (p < text.length() && isspace(text[p])) { if (text[p] == '\r' || - (p > 0 && text[p] == '\n' && text[p - 1] == '\n')) { - is_paragraph_break = true; + (p > 0 && text[p] == '\n' && text[p - 1] == '\n')) { + is_paragraph_break = true; } p++; } @@ -1073,9 +1073,9 @@ format_text(ostream &out, bool &last_newline, // Print the paragraph break as a blank line. out << "\n"; if (p >= text.length()) { - // If we end on a paragraph break, don't try to insert a new - // one in the next pass. - last_newline = false; + // If we end on a paragraph break, don't try to insert a new + // one in the next pass. + last_newline = false; } } @@ -1102,7 +1102,7 @@ sort_options() { } sort(_options_by_index.begin(), _options_by_index.end(), - SortOptionsByIndex()); + SortOptionsByIndex()); _sorted_options = true; } } diff --git a/pandatool/src/progbase/programBase.h b/pandatool/src/progbase/programBase.h index 3958276907..599485cad0 100644 --- a/pandatool/src/progbase/programBase.h +++ b/pandatool/src/progbase/programBase.h @@ -18,7 +18,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : ProgramBase +// Class : ProgramBase // Description : This is intended to be the base class for most // general-purpose utility programs in the PANDATOOL // tree. It automatically handles things like @@ -54,15 +54,15 @@ protected: void add_runline(const string &runline); void clear_options(); void add_option(const string &option, const string &parm_name, - int index_group, const string &description, - OptionDispatchFunction option_function, - bool *bool_var = (bool *)NULL, - void *option_data = (void *)NULL); + int index_group, const string &description, + OptionDispatchFunction option_function, + bool *bool_var = (bool *)NULL, + void *option_data = (void *)NULL); void add_option(const string &option, const string &parm_name, - int index_group, const string &description, - OptionDispatchMethod option_method, - bool *bool_var = (bool *)NULL, - void *option_data = (void *)NULL); + int index_group, const string &description, + OptionDispatchMethod option_method, + bool *bool_var = (bool *)NULL, + void *option_data = (void *)NULL); bool redescribe_option(const string &option, const string &description); bool remove_option(const string &option); @@ -86,8 +86,8 @@ protected: static bool handle_help_option(const string &opt, const string &arg, void *); static void format_text(ostream &out, bool &last_newline, - const string &prefix, int indent_width, - const string &text, int line_width); + const string &prefix, int indent_width, + const string &text, int line_width); private: void sort_options(); diff --git a/pandatool/src/progbase/withOutputFile.cxx b/pandatool/src/progbase/withOutputFile.cxx index 623802a71d..558502dbdf 100644 --- a/pandatool/src/progbase/withOutputFile.cxx +++ b/pandatool/src/progbase/withOutputFile.cxx @@ -14,7 +14,7 @@ //////////////////////////////////////////////////////////////////// WithOutputFile:: WithOutputFile(bool allow_last_param, bool allow_stdout, - bool binary_output) { + bool binary_output) { _allow_last_param = allow_last_param; _allow_stdout = allow_stdout; _binary_output = binary_output; @@ -52,14 +52,14 @@ get_output() { _output_filename.make_dir(); if (_binary_output) { - _output_filename.set_binary(); + _output_filename.set_binary(); } else { - _output_filename.set_text(); + _output_filename.set_text(); } if (!_output_filename.open_write(_output_stream)) { - nout << "Unable to write to " << _output_filename << "\n"; - exit(1); + nout << "Unable to write to " << _output_filename << "\n"; + exit(1); } nout << "Writing " << _output_filename << "\n"; _output_ptr = &_output_stream; @@ -115,14 +115,14 @@ check_last_arg(ProgramBase::Args &args, int minimum_args) { Filename filename = args.back(); if (!_preferred_extension.empty() && - ("." + filename.get_extension()) != _preferred_extension) { + ("." + filename.get_extension()) != _preferred_extension) { // This argument must not be an output filename. if (!_allow_stdout) { - nout << "Output filename " << filename - << " does not end in " << _preferred_extension - << ". If this is really what you intended, " - "use the -o output_file syntax.\n"; - return false; + nout << "Output filename " << filename + << " does not end in " << _preferred_extension + << ". If this is really what you intended, " + "use the -o output_file syntax.\n"; + return false; } } else { @@ -132,7 +132,7 @@ check_last_arg(ProgramBase::Args &args, int minimum_args) { args.pop_back(); if (!verify_output_file_safe()) { - return false; + return false; } } } diff --git a/pandatool/src/progbase/withOutputFile.h b/pandatool/src/progbase/withOutputFile.h index 2d328ec686..f5b4843eb2 100644 --- a/pandatool/src/progbase/withOutputFile.h +++ b/pandatool/src/progbase/withOutputFile.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : WithOutputFile +// Class : WithOutputFile // Description : This is the bare functionality (intended to be // inherited from along with ProgramBase or some // derivative) for a program that might generate an @@ -24,7 +24,7 @@ class WithOutputFile { public: WithOutputFile(bool allow_last_param, bool allow_stdout, - bool binary_output); + bool binary_output); virtual ~WithOutputFile(); ostream &get_output(); diff --git a/pandatool/src/pstatserver/pStatClientData.cxx b/pandatool/src/pstatserver/pStatClientData.cxx index 6bed0fcbca..caf91ba519 100644 --- a/pandatool/src/pstatserver/pStatClientData.cxx +++ b/pandatool/src/pstatserver/pStatClientData.cxx @@ -85,7 +85,7 @@ get_num_collectors() const { bool PStatClientData:: has_collector(int index) const { return (index >= 0 && index < (int)_collectors.size() && - _collectors[index]._def != (PStatCollectorDef *)NULL); + _collectors[index]._def != (PStatCollectorDef *)NULL); } //////////////////////////////////////////////////////////////////// @@ -162,7 +162,7 @@ set_collector_has_level(int index, bool flag) { bool PStatClientData:: get_collector_has_level(int index) const { return (index >= 0 && index < (int)_collectors.size() && - _collectors[index]._is_level); + _collectors[index]._is_level); } //////////////////////////////////////////////////////////////////// @@ -187,7 +187,7 @@ get_num_threads() const { bool PStatClientData:: has_thread(int index) const { return (index >= 0 && index < (int)_threads.size() && - !_threads[index]._name.empty()); + !_threads[index]._name.empty()); } //////////////////////////////////////////////////////////////////// @@ -306,7 +306,7 @@ define_thread(int thread_index, const string &name) { //////////////////////////////////////////////////////////////////// void PStatClientData:: record_new_frame(int thread_index, int frame_number, - PStatFrameData *frame_data) { + PStatFrameData *frame_data) { define_thread(thread_index); nassertv(thread_index >= 0 && thread_index < (int)_threads.size()); _threads[thread_index]._data->record_new_frame(frame_number, frame_data); diff --git a/pandatool/src/pstatserver/pStatClientData.h b/pandatool/src/pstatserver/pStatClientData.h index f567445711..008bd4fc72 100644 --- a/pandatool/src/pstatserver/pStatClientData.h +++ b/pandatool/src/pstatserver/pStatClientData.h @@ -19,7 +19,7 @@ class PStatReader; //////////////////////////////////////////////////////////////////// -// Class : PStatClientData +// Class : PStatClientData // Description : The data associated with a particular client, but not // with any one particular frame or thread: the list of // collectors and threads, for instance. @@ -52,7 +52,7 @@ public: void define_thread(int thread_index, const string &name = string()); void record_new_frame(int thread_index, int frame_number, - PStatFrameData *frame_data); + PStatFrameData *frame_data); private: void slot_collector(int collector_index); diff --git a/pandatool/src/pstatserver/pStatGraph.h b/pandatool/src/pstatserver/pStatGraph.h index 1fa07ca440..89e744f978 100644 --- a/pandatool/src/pstatserver/pStatGraph.h +++ b/pandatool/src/pstatserver/pStatGraph.h @@ -19,7 +19,7 @@ class PStatView; //////////////////////////////////////////////////////////////////// -// Class : PStatGraph +// Class : PStatGraph // Description : This is an abstract base class for several different // kinds of graphs that have a few things in common, // like labels and guide bars. diff --git a/pandatool/src/pstatserver/pStatListener.cxx b/pandatool/src/pstatserver/pStatListener.cxx index 643d6c2789..2451316058 100644 --- a/pandatool/src/pstatserver/pStatListener.cxx +++ b/pandatool/src/pstatserver/pStatListener.cxx @@ -27,8 +27,8 @@ PStatListener(PStatServer *manager) : //////////////////////////////////////////////////////////////////// void PStatListener:: connection_opened(const PT(Connection) &, - const NetAddress &address, - const PT(Connection) &new_connection) { + const NetAddress &address, + const PT(Connection) &new_connection) { PStatMonitor *monitor = _manager->make_monitor(); if (monitor == (PStatMonitor *)NULL) { nout << "Couldn't create monitor!\n"; diff --git a/pandatool/src/pstatserver/pStatListener.h b/pandatool/src/pstatserver/pStatListener.h index 22b2a92bcb..ec0111c5e3 100644 --- a/pandatool/src/pstatserver/pStatListener.h +++ b/pandatool/src/pstatserver/pStatListener.h @@ -15,7 +15,7 @@ class PStatServer; class PStatMonitor; //////////////////////////////////////////////////////////////////// -// Class : PStatListener +// Class : PStatListener // Description : This is the TCP rendezvous socket listener. We need // one of these to listen for new connections on the // socket(s) added to the PStatServer. @@ -26,8 +26,8 @@ public: protected: virtual void connection_opened(const PT(Connection) &rendezvous, - const NetAddress &address, - const PT(Connection) &new_connection); + const NetAddress &address, + const PT(Connection) &new_connection); private: PStatServer *_manager; diff --git a/pandatool/src/pstatserver/pStatMonitor.h b/pandatool/src/pstatserver/pStatMonitor.h index 9610ce200a..6deed7c50c 100644 --- a/pandatool/src/pstatserver/pStatMonitor.h +++ b/pandatool/src/pstatserver/pStatMonitor.h @@ -20,7 +20,7 @@ class PStatCollectorDef; //////////////////////////////////////////////////////////////////// -// Class : PStatMonitor +// Class : PStatMonitor // Description : This is an abstract class that presents the interface // to any number of different front-ends for the stats // monitor. One of these will be created by the diff --git a/pandatool/src/pstatserver/pStatPianoRoll.cxx b/pandatool/src/pstatserver/pStatPianoRoll.cxx index 5d288c1b49..e51c9525c8 100644 --- a/pandatool/src/pstatserver/pStatPianoRoll.cxx +++ b/pandatool/src/pstatserver/pStatPianoRoll.cxx @@ -115,9 +115,9 @@ update() { if (!thread_data->is_empty()) { int frame_number = thread_data->get_latest_frame_number(); if (frame_number != _current_frame) { - compute_page(thread_data->get_frame(frame_number)); - _current_frame = frame_number; - force_redraw(); + compute_page(thread_data->get_frame(frame_number)); + _current_frame = frame_number; + force_redraw(); } } } @@ -161,8 +161,8 @@ force_redraw() { begin_row(i); ColorBars::const_iterator bi; for (bi = bars.begin(); bi != bars.end(); ++bi) { - const ColorBar &bar = (*bi); - draw_bar(i, timestamp_to_pixel(bar._start), timestamp_to_pixel(bar._end)); + const ColorBar &bar = (*bi); + draw_bar(i, timestamp_to_pixel(bar._start), timestamp_to_pixel(bar._end)); } end_row(i); } @@ -298,7 +298,7 @@ compute_page(const PStatFrameData &frame_data) { for (pi = _page_data.begin(); pi != _page_data.end(); ++pi) { int collector_index = (*pi).first; if (client_data->has_collector(collector_index)) { - _labels.push_back(collector_index); + _labels.push_back(collector_index); } } diff --git a/pandatool/src/pstatserver/pStatPianoRoll.h b/pandatool/src/pstatserver/pStatPianoRoll.h index 1111c66e3d..68eed3394f 100644 --- a/pandatool/src/pstatserver/pStatPianoRoll.h +++ b/pandatool/src/pstatserver/pStatPianoRoll.h @@ -20,7 +20,7 @@ class PStatFrameData; //////////////////////////////////////////////////////////////////// -// Class : PStatPianoRoll +// Class : PStatPianoRoll // Description : This is an abstract class that presents the interface // for drawing a piano-roll type chart: it shows the // time spent in each of a number of collectors as a @@ -34,7 +34,7 @@ class PStatFrameData; class PStatPianoRoll : public PStatGraph { public: PStatPianoRoll(PStatMonitor *monitor, int thread_index, - int xsize, int ysize); + int xsize, int ysize); virtual ~PStatPianoRoll(); void update(); diff --git a/pandatool/src/pstatserver/pStatReader.cxx b/pandatool/src/pstatserver/pStatReader.cxx index 12cc8ae3ec..ebc2223106 100644 --- a/pandatool/src/pstatserver/pStatReader.cxx +++ b/pandatool/src/pstatserver/pStatReader.cxx @@ -207,8 +207,8 @@ handle_client_control_message(const PStatClientControlMessage &message) { case PStatClientControlMessage::T_define_collectors: { for (int i = 0; i < (int)message._collectors.size(); i++) { - _client_data->add_collector(message._collectors[i]); - _monitor->new_collector(message._collectors[i]->_index); + _client_data->add_collector(message._collectors[i]); + _monitor->new_collector(message._collectors[i]->_index); } } break; @@ -216,10 +216,10 @@ handle_client_control_message(const PStatClientControlMessage &message) { case PStatClientControlMessage::T_define_threads: { for (int i = 0; i < (int)message._names.size(); i++) { - int thread_index = message._first_thread_index + i; - string name = message._names[i]; - _client_data->define_thread(thread_index, name); - _monitor->new_thread(thread_index); + int thread_index = message._first_thread_index + i; + string name = message._names[i]; + _client_data->define_thread(thread_index, name); + _monitor->new_thread(thread_index); } } break; diff --git a/pandatool/src/pstatserver/pStatReader.h b/pandatool/src/pstatserver/pStatReader.h index 938118e8a2..db3af2b3f4 100644 --- a/pandatool/src/pstatserver/pStatReader.h +++ b/pandatool/src/pstatserver/pStatReader.h @@ -20,7 +20,7 @@ class PStatMonitor; class PStatClientControlMessage; //////////////////////////////////////////////////////////////////// -// Class : PStatReader +// Class : PStatReader // Description : This is the class that does all the work for handling // communications from a single Panda client. It reads // sockets received from the client and boils them down diff --git a/pandatool/src/pstatserver/pStatServer.h b/pandatool/src/pstatserver/pStatServer.h index b5a3734d7d..87dd52952b 100644 --- a/pandatool/src/pstatserver/pStatServer.h +++ b/pandatool/src/pstatserver/pStatServer.h @@ -18,7 +18,7 @@ class PStatReader; //////////////////////////////////////////////////////////////////// -// Class : PStatServer +// Class : PStatServer // Description : The overall manager of the network connections. This // class gets the ball rolling; to use this package, you // need to derive from this and define make_monitor() to diff --git a/pandatool/src/pstatserver/pStatStripChart.cxx b/pandatool/src/pstatserver/pStatStripChart.cxx index d8d2706a0e..9ba069d761 100644 --- a/pandatool/src/pstatserver/pStatStripChart.cxx +++ b/pandatool/src/pstatserver/pStatStripChart.cxx @@ -21,7 +21,7 @@ //////////////////////////////////////////////////////////////////// PStatStripChart:: PStatStripChart(PStatMonitor *monitor, PStatView &view, - int collector_index, int xsize, int ysize) : + int collector_index, int xsize, int ysize) : PStatGraph(monitor, xsize, ysize), _view(view), _collector_index(collector_index) @@ -90,20 +90,20 @@ update() { int latest = thread_data->get_latest_frame_number(); if (latest > _next_frame) { - draw_frames(_next_frame, latest); + draw_frames(_next_frame, latest); } _next_frame = latest; // Clean out the old data. float oldest_time = - thread_data->get_frame(latest).get_start() - _time_width; + thread_data->get_frame(latest).get_start() - _time_width; Data::iterator di; di = _data.begin(); while (di != _data.end() && - thread_data->get_frame((*di).first).get_start() < oldest_time) { - _data.erase(di); - di = _data.begin(); + thread_data->get_frame((*di).first).get_start() < oldest_time) { + _data.erase(di); + di = _data.begin(); } } } @@ -284,19 +284,19 @@ changed_size(int xsize, int ysize) { if (!_first_data) { if (_scroll_mode) { - draw_pixels(0, _xsize); - + draw_pixels(0, _xsize); + } else { - // Redraw the stats that were there before. - float old_start_time = _start_time; - - // Back up a bit to draw the stuff to the right of the cursor. - _start_time -= _time_width; - draw_pixels(_cursor_pixel, _xsize); - - // Now draw the stuff to the left of the cursor. - _start_time = old_start_time; - draw_pixels(0, _cursor_pixel); + // Redraw the stats that were there before. + float old_start_time = _start_time; + + // Back up a bit to draw the stuff to the right of the cursor. + _start_time -= _time_width; + draw_pixels(_cursor_pixel, _xsize); + + // Now draw the stuff to the left of the cursor. + _start_time = old_start_time; + draw_pixels(0, _cursor_pixel); } } } @@ -492,7 +492,7 @@ draw_frames(int first_frame, int last_frame) { if (_first_data) { if (_scroll_mode) { _start_time = - thread_data->get_frame(last_frame).get_start() - _time_width; + thread_data->get_frame(last_frame).get_start() - _time_width; } else { _start_time = thread_data->get_frame(first_frame).get_start(); _cursor_pixel = 0; @@ -570,9 +570,9 @@ draw_pixels(int first_pixel, int last_pixel) { frame_number = thread_data->get_frame_number_at_time(time, frame_number); if (thread_data->has_frame(frame_number)) { - draw_slice(x, frame_number); + draw_slice(x, frame_number); } else { - draw_empty(x); + draw_empty(x); } } } diff --git a/pandatool/src/pstatserver/pStatStripChart.h b/pandatool/src/pstatserver/pStatStripChart.h index c6d1a263c1..c7543fdc9e 100644 --- a/pandatool/src/pstatserver/pStatStripChart.h +++ b/pandatool/src/pstatserver/pStatStripChart.h @@ -20,7 +20,7 @@ class PStatView; //////////////////////////////////////////////////////////////////// -// Class : PStatStripChart +// Class : PStatStripChart // Description : This is an abstract class that presents the interface // for drawing a basic strip-chart, showing the relative // value over an interval of time for several different @@ -33,7 +33,7 @@ class PStatView; class PStatStripChart : public PStatGraph { public: PStatStripChart(PStatMonitor *monitor, PStatView &view, - int collector_index, int xsize, int ysize); + int collector_index, int xsize, int ysize); virtual ~PStatStripChart(); void new_data(int frame_number); diff --git a/pandatool/src/pstatserver/pStatThreadData.cxx b/pandatool/src/pstatserver/pStatThreadData.cxx index 627d202bfd..a7ac461e65 100644 --- a/pandatool/src/pstatserver/pStatThreadData.cxx +++ b/pandatool/src/pstatserver/pStatThreadData.cxx @@ -82,7 +82,7 @@ has_frame(int frame_number) const { int rel_frame = frame_number - _first_frame_number; return (rel_frame >= 0 && rel_frame < (int)_frames.size() && - _frames[rel_frame] != (PStatFrameData *)NULL); + _frames[rel_frame] != (PStatFrameData *)NULL); } //////////////////////////////////////////////////////////////////// @@ -109,7 +109,7 @@ get_frame(int frame_number) const { // No frame data that old. Return the oldest frame we've got. rel_frame = 0; while (rel_frame < (int)_frames.size() && - _frames[rel_frame] == (PStatFrameData *)NULL) { + _frames[rel_frame] == (PStatFrameData *)NULL) { rel_frame++; } return (rel_frame < (int)_frames.size()) ? *_frames[rel_frame] : _null_frame; @@ -166,16 +166,16 @@ get_frame_number_at_time(float time, int hint) const { hint -= _first_frame_number; if (hint >= 0 && hint < (int)_frames.size()) { if (_frames[hint] != (PStatFrameData *)NULL && - _frames[hint]->get_start() <= time) { + _frames[hint]->get_start() <= time) { // The hint might be right. Scan forward from there. int i = hint + 1; while (i < (int)_frames.size() && - (_frames[i] == (PStatFrameData *)NULL || - _frames[i]->get_start() <= time)) { - if (_frames[i] != (PStatFrameData *)NULL) { - hint = i; - } - ++i; + (_frames[i] == (PStatFrameData *)NULL || + _frames[i]->get_start() <= time)) { + if (_frames[i] != (PStatFrameData *)NULL) { + hint = i; + } + ++i; } return _first_frame_number + hint; } @@ -186,7 +186,7 @@ get_frame_number_at_time(float time, int hint) const { int i = _frames.size() - 1; while (i >= 0 && (_frames[i] == (PStatFrameData *)NULL || - _frames[i]->get_start() > time)) { + _frames[i]->get_start() > time)) { --i; } return _first_frame_number + i; @@ -298,9 +298,9 @@ record_new_frame(int frame_number, PStatFrameData *frame_data) { // history window. float oldest_allowable_time = time - _history; while (!_frames.empty() && - (_frames.front() == (PStatFrameData *)NULL || - _frames.front()->is_empty() || - _frames.front()->get_start() < oldest_allowable_time)) { + (_frames.front() == (PStatFrameData *)NULL || + _frames.front()->is_empty() || + _frames.front()->get_start() < oldest_allowable_time)) { if (_frames.front() != (PStatFrameData *)NULL) { delete _frames.front(); } diff --git a/pandatool/src/pstatserver/pStatThreadData.h b/pandatool/src/pstatserver/pStatThreadData.h index 4deaccb971..5edadf852f 100644 --- a/pandatool/src/pstatserver/pStatThreadData.h +++ b/pandatool/src/pstatserver/pStatThreadData.h @@ -17,7 +17,7 @@ class PStatFrameData; class PStatClientData; //////////////////////////////////////////////////////////////////// -// Class : PStatThreadData +// Class : PStatThreadData // Description : A collection of FrameData structures for // recently-received frames within a particular thread. // This holds the raw data as reported by the client, diff --git a/pandatool/src/pstatserver/pStatView.cxx b/pandatool/src/pstatserver/pStatView.cxx index 19b7400884..b901b9c8d3 100644 --- a/pandatool/src/pstatserver/pStatView.cxx +++ b/pandatool/src/pstatserver/pStatView.cxx @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////// -// Class : FrameSample +// Class : FrameSample // Description : This class is used within this module only--in fact, // within PStatView::set_to_frame() only--to help // collect event data out of the PStatFrameData object @@ -74,7 +74,7 @@ public: if (!_pushed) { _pushed = true; if (_is_started) { - _net_time += time; + _net_time += time; } } } @@ -82,7 +82,7 @@ public: if (_pushed) { _pushed = false; if (_is_started) { - _net_time -= time; + _net_time -= time; } } } @@ -98,8 +98,8 @@ public: Started::reverse_iterator si; for (si = started.rbegin(); si != started.rend(); ++si) { if ((*si)->_pushed) { - (*si)->pop(time); - return; + (*si)->pop(time); + return; } } } @@ -334,10 +334,10 @@ update_time_data(const PStatFrameData &frame_data) { nassertv(collector_index >= 0 && collector_index < (int)samples.size()); if (_client_data->get_child_distance(_constraint, collector_index) >= 0) { - // Here's a data point we care about: anything at constraint - // level or below. - samples[collector_index].data_point(frame_data.get_time(i), is_start, started); - got_samples.insert(collector_index); + // Here's a data point we care about: anything at constraint + // level or below. + samples[collector_index].data_point(frame_data.get_time(i), is_start, started); + got_samples.insert(collector_index); } } } @@ -348,7 +348,7 @@ update_time_data(const PStatFrameData &frame_data) { for (i = 0, si = samples.begin(); si != samples.end(); ++i, ++si) { if ((*si)._is_started) { nout << _client_data->get_collector_fullname(i) - << " was not stopped at frame end!\n"; + << " was not stopped at frame end!\n"; (*si).data_point(frame_data.get_end(), false, started); } } @@ -562,19 +562,19 @@ reset_level(PStatViewLevel *level) { nassertr(old_parent_level != level, true); if (parent_index != 0) { - PStatViewLevel *new_parent_level = get_level(parent_index); - nassertr(new_parent_level != level, true); - level->_parent = new_parent_level; - new_parent_level->_children.push_back(level); - new_parent_level->sort_children(_client_data); + PStatViewLevel *new_parent_level = get_level(parent_index); + nassertr(new_parent_level != level, true); + level->_parent = new_parent_level; + new_parent_level->_children.push_back(level); + new_parent_level->sort_children(_client_data); } else { - level->_parent = NULL; + level->_parent = NULL; } PStatViewLevel::Children::iterator ci = - find(old_parent_level->_children.begin(), - old_parent_level->_children.end(), - level); + find(old_parent_level->_children.begin(), + old_parent_level->_children.end(), + level); nassertr(ci != old_parent_level->_children.end(), true); old_parent_level->_children.erase(ci); diff --git a/pandatool/src/pstatserver/pStatView.h b/pandatool/src/pstatserver/pStatView.h index 4e79e33415..6cb361cddc 100644 --- a/pandatool/src/pstatserver/pStatView.h +++ b/pandatool/src/pstatserver/pStatView.h @@ -15,7 +15,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : PStatView +// Class : PStatView // Description : A View boils down the frame data to a linear list of // times spent in a number of different Collectors, // within a particular thread. This automatically diff --git a/pandatool/src/pstatserver/pStatViewLevel.h b/pandatool/src/pstatserver/pStatViewLevel.h index 014f60f17e..38119993bb 100644 --- a/pandatool/src/pstatserver/pStatViewLevel.h +++ b/pandatool/src/pstatserver/pStatViewLevel.h @@ -13,7 +13,7 @@ class PStatClientData; //////////////////////////////////////////////////////////////////// -// Class : PStatViewLevel +// Class : PStatViewLevel // Description : This is a single level value, or band of color, // within a View. // diff --git a/pandatool/src/ptloader/loaderFileTypePandatool.h b/pandatool/src/ptloader/loaderFileTypePandatool.h index fe2dbf49b4..c6787d7593 100644 --- a/pandatool/src/ptloader/loaderFileTypePandatool.h +++ b/pandatool/src/ptloader/loaderFileTypePandatool.h @@ -13,7 +13,7 @@ class SomethingToEggConverter; //////////////////////////////////////////////////////////////////// -// Class : LoaderFileTypePandatool +// Class : LoaderFileTypePandatool // Description : This defines the Loader interface to files whose // converters are defined within the Pandatool package // and inherit from SomethingToEggConverter, like diff --git a/pandatool/src/softprogs/softCVS.cxx b/pandatool/src/softprogs/softCVS.cxx index 2153d8fbbf..b589885bb3 100644 --- a/pandatool/src/softprogs/softCVS.cxx +++ b/pandatool/src/softprogs/softCVS.cxx @@ -171,25 +171,25 @@ traverse_subdir(const Filename &directory) { // This special filename should not be considered, except to add // it to CVS. if (in_cvs && cvs_elements.count(filename) == 0) { - _cvs_add.push_back(Filename(directory, filename)); + _cvs_add.push_back(Filename(directory, filename)); } } else { SoftFilename soft(directory, filename); if (in_cvs && cvs_elements.count(filename) != 0) { - // This file is known to be in CVS. - soft.set_in_cvs(true); + // This file is known to be in CVS. + soft.set_in_cvs(true); } if (keep_all) { - soft.increment_use_count(); + soft.increment_use_count(); } if (is_scenes && soft.has_version() && soft.get_extension() == ".dsc") { - _scene_files.push_back(soft); + _scene_files.push_back(soft); } else { - _element_files.insert(soft); + _element_files.insert(soft); } } } @@ -225,7 +225,7 @@ collapse_scene_files() { SceneFiles::iterator start_vi; start_vi = vi; while (vi != versions.end() && (*vi).is_same_file(file)) { - ++vi; + ++vi; } rename_file(start_vi, vi); @@ -286,10 +286,10 @@ remove_unused_elements() { nout << file << " is unused.\n"; if (!file.unlink()) { - nout << "Unable to remove " << file << ".\n"; + nout << "Unable to remove " << file << ".\n"; } else if (sf.get_in_cvs()) { - _cvs_remove.push_back(file); + _cvs_remove.push_back(file); } } else if (!sf.get_in_cvs()) { @@ -309,7 +309,7 @@ remove_unused_elements() { //////////////////////////////////////////////////////////////////// bool SoftCVS:: rename_file(SoftCVS::SceneFiles::iterator begin, - SoftCVS::SceneFiles::iterator end) { + SoftCVS::SceneFiles::iterator end) { int length = end - begin; nassertr(length > 0, false); @@ -328,7 +328,7 @@ rename_file(SoftCVS::SceneFiles::iterator begin, } else if (length == 2) { nout << source_filename << " supercedes " - << (*(begin + 1)).get_filename() << ".\n"; + << (*(begin + 1)).get_filename() << ".\n"; } else { nout << source_filename << " renamed.\n"; @@ -345,12 +345,12 @@ rename_file(SoftCVS::SceneFiles::iterator begin, nout << "Unable to remove " << file << ".\n"; } else { if ((*p).get_in_cvs()) { - if ((*p).is_1_0()) { - // We don't cvs remove the 1.0 version. - cvs_has_1_0 = true; - } else { - _cvs_remove.push_back(file); - } + if ((*p).is_1_0()) { + // We don't cvs remove the 1.0 version. + cvs_has_1_0 = true; + } else { + _cvs_remove.push_back(file); + } } } } @@ -410,15 +410,15 @@ scan_cvs(const string &dirname, set &cvs_elements) { if (!line.empty() && line[0] == '/') { size_t slash = line.find('/', 1); if (slash != string::npos) { - string filename = line.substr(1, slash - 1); + string filename = line.substr(1, slash - 1); - if (line.substr(slash + 1, 2) == "-1") { - // If the first number after the slash is -1, the file used - // to be here but was recently cvs removed. It counts as no - // longer being an element. - } else { - cvs_elements.insert(filename); - } + if (line.substr(slash + 1, 2) == "-1") { + // If the first number after the slash is -1, the file used + // to be here but was recently cvs removed. It counts as no + // longer being an element. + } else { + cvs_elements.insert(filename); + } } } @@ -461,11 +461,11 @@ scan_scene_file(istream &in) { ElementFiles::iterator ei; for (ei = range.first; ei != range.second; ++ei) { - // We cheat and get a non-const reference to the filename out - // of the set. We can safely do this because incrementing the - // use count won't change its position in the set. - SoftFilename &file = (SoftFilename &)(*ei); - file.increment_use_count(); + // We cheat and get a non-const reference to the filename out + // of the set. We can safely do this because incrementing the + // use count won't change its position in the set. + SoftFilename &file = (SoftFilename &)(*ei); + file.increment_use_count(); } } } @@ -510,16 +510,16 @@ cvs_add_or_remove(const string &cvs_command, const vector_string &paths) { const string &path = (*pi); if ((int)command.length() + 1 + (int)path.length() >= max_command) { - // Fire off the command now. - nout << command << "\n"; - int result = system(command.c_str()); + // Fire off the command now. + nout << command << "\n"; + int result = system(command.c_str()); - if (result != 0) { - nout << "Failure invoking cvs.\n"; - return false; - } + if (result != 0) { + nout << "Failure invoking cvs.\n"; + return false; + } - command = _cvs_binary + " " + cvs_command; + command = _cvs_binary + " " + cvs_command; } command += ' '; diff --git a/pandatool/src/softprogs/softCVS.h b/pandatool/src/softprogs/softCVS.h index f03f6e520f..c9fb3f9b1b 100644 --- a/pandatool/src/softprogs/softCVS.h +++ b/pandatool/src/softprogs/softCVS.h @@ -18,7 +18,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : SoftCVS +// Class : SoftCVS // Description : This program prepares a SoftImage database for CVS by // renaming everything to version 1-0, and adding new // files to CVS. @@ -47,7 +47,7 @@ private: bool cvs_add(const string &path); bool cvs_add_or_remove(const string &cvs_command, - const vector_string &paths); + const vector_string &paths); SceneFiles _scene_files; ElementFiles _element_files; diff --git a/pandatool/src/softprogs/softFilename.cxx b/pandatool/src/softprogs/softFilename.cxx index bc1a75d05a..f5969f27a8 100644 --- a/pandatool/src/softprogs/softFilename.cxx +++ b/pandatool/src/softprogs/softFilename.cxx @@ -39,13 +39,13 @@ SoftFilename(const string &dirname, const string &filename) : m = (endptr - fstr) + 1; int minor = strtol(fstr + m, &endptr, 10); if (endptr != fstr + m && (*endptr == '.' || *endptr == '\0')) { - // We got a minor number too! - _has_version = true; - _base = _filename.substr(0, dot + 1); - _major = major; - _minor = minor; - _ext = endptr; - return; + // We got a minor number too! + _has_version = true; + _base = _filename.substr(0, dot + 1); + _major = major; + _minor = minor; + _ext = endptr; + return; } } diff --git a/pandatool/src/softprogs/softFilename.h b/pandatool/src/softprogs/softFilename.h index 3d21c95842..9f6653613e 100644 --- a/pandatool/src/softprogs/softFilename.h +++ b/pandatool/src/softprogs/softFilename.h @@ -9,7 +9,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : SoftFilename +// Class : SoftFilename // Description : This encapsulates a SoftImage versioned filename, of // the form base.v-v.ext: it consists of a directory // name, a base, a major and minor version number, and diff --git a/pandatool/src/text-stats/textMonitor.cxx b/pandatool/src/text-stats/textMonitor.cxx index 24ac330f3a..91da6fdf0f 100644 --- a/pandatool/src/text-stats/textMonitor.cxx +++ b/pandatool/src/text-stats/textMonitor.cxx @@ -82,14 +82,14 @@ new_data(int thread_index, int frame_number) { if (view.all_collectors_known()) { nout << "\rThread " - << get_client_data()->get_thread_name(thread_index) - << " frame " << frame_number << ", " - << view.get_net_value() * 1000.0 << " ms (" - << thread_data->get_frame_rate() << " Hz):\n"; + << get_client_data()->get_thread_name(thread_index) + << " frame " << frame_number << ", " + << view.get_net_value() * 1000.0 << " ms (" + << thread_data->get_frame_rate() << " Hz):\n"; const PStatViewLevel *level = view.get_top_level(); int num_children = level->get_num_children(); for (int i = 0; i < num_children; i++) { - show_level(level->get_child(i), 2); + show_level(level->get_child(i), 2); } } } diff --git a/pandatool/src/text-stats/textMonitor.h b/pandatool/src/text-stats/textMonitor.h index 60a0c7061b..108113da97 100644 --- a/pandatool/src/text-stats/textMonitor.h +++ b/pandatool/src/text-stats/textMonitor.h @@ -11,7 +11,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextMonitor +// Class : TextMonitor // Description : A simple, scrolling-text stats monitor. Guaranteed // to compile on every platform. //////////////////////////////////////////////////////////////////// diff --git a/pandatool/src/text-stats/textStats.h b/pandatool/src/text-stats/textStats.h index 58fe0ca680..6f3eeb613f 100644 --- a/pandatool/src/text-stats/textStats.h +++ b/pandatool/src/text-stats/textStats.h @@ -12,7 +12,7 @@ #include //////////////////////////////////////////////////////////////////// -// Class : TextStats +// Class : TextStats // Description : A simple, scrolling-text stats server. Guaranteed to // compile on every platform. ////////////////////////////////////////////////////////////////////