From c1fcb803f8c25116a7c6e770bb19eaa42e6e1f3a Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Sat, 24 Aug 2024 17:51:59 +0200 Subject: [PATCH] NULL to nullptr Use nullptr instead of the NULL macro. Adds some level of type safety and doesn't require a header to be included. Also change documentation to use the term null-terminated instead of NULL-terminated. Signed-off-by: Ralph Sennhauser --- FCollada/DLLEntry.cpp | 2 +- FCollada/FCDocument/FCDAnimated.cpp | 28 ++-- FCollada/FCDocument/FCDAnimated.h | 34 ++-- FCollada/FCDocument/FCDAnimation.cpp | 16 +- FCollada/FCDocument/FCDAnimation.h | 24 +-- FCollada/FCDocument/FCDAnimationChannel.cpp | 4 +- FCollada/FCDocument/FCDAnimationChannel.h | 10 +- FCollada/FCDocument/FCDAnimationClip.cpp | 12 +- FCollada/FCDocument/FCDAnimationClip.h | 6 +- FCollada/FCDocument/FCDAnimationCurve.cpp | 44 ++--- FCollada/FCDocument/FCDAnimationCurve.h | 16 +- .../FCDocument/FCDAnimationCurveTools.cpp | 18 +-- FCollada/FCDocument/FCDAnimationCurveTools.h | 12 +- FCollada/FCDocument/FCDAnimationMultiCurve.h | 4 +- FCollada/FCDocument/FCDAsset.cpp | 4 +- FCollada/FCDocument/FCDAsset.h | 16 +- FCollada/FCDocument/FCDController.cpp | 28 ++-- FCollada/FCDocument/FCDController.h | 14 +- FCollada/FCDocument/FCDControllerInstance.cpp | 16 +- FCollada/FCDocument/FCDControllerInstance.h | 10 +- FCollada/FCDocument/FCDEffect.cpp | 12 +- FCollada/FCDocument/FCDEffect.h | 20 +-- FCollada/FCDocument/FCDEffectCode.cpp | 2 +- FCollada/FCDocument/FCDEffectCode.h | 6 +- FCollada/FCDocument/FCDEffectParameter.cpp | 6 +- FCollada/FCDocument/FCDEffectParameter.h | 18 +-- FCollada/FCDocument/FCDEffectParameter.hpp | 16 +- .../FCDocument/FCDEffectParameterFactory.cpp | 2 +- .../FCDocument/FCDEffectParameterSampler.cpp | 12 +- .../FCDocument/FCDEffectParameterSampler.h | 8 +- .../FCDocument/FCDEffectParameterSurface.cpp | 78 ++++----- .../FCDocument/FCDEffectParameterSurface.h | 26 +-- FCollada/FCDocument/FCDEffectPass.cpp | 14 +- FCollada/FCDocument/FCDEffectPass.h | 20 +-- FCollada/FCDocument/FCDEffectPassShader.cpp | 14 +- FCollada/FCDocument/FCDEffectPassShader.h | 16 +- FCollada/FCDocument/FCDEffectPassState.cpp | 6 +- FCollada/FCDocument/FCDEffectPassState.h | 4 +- FCollada/FCDocument/FCDEffectProfile.cpp | 4 +- FCollada/FCDocument/FCDEffectProfile.h | 12 +- FCollada/FCDocument/FCDEffectProfileFX.cpp | 10 +- FCollada/FCDocument/FCDEffectProfileFX.h | 20 +-- FCollada/FCDocument/FCDEffectStandard.cpp | 22 +-- FCollada/FCDocument/FCDEffectStandard.h | 12 +- FCollada/FCDocument/FCDEffectTechnique.cpp | 6 +- FCollada/FCDocument/FCDEffectTechnique.h | 24 +-- FCollada/FCDocument/FCDEffectTools.cpp | 150 +++++++++--------- FCollada/FCDocument/FCDEffectTools.h | 4 +- FCollada/FCDocument/FCDEmitter.cpp | 6 +- FCollada/FCDocument/FCDEmitter.h | 4 +- FCollada/FCDocument/FCDEntity.cpp | 10 +- FCollada/FCDocument/FCDEntity.h | 6 +- FCollada/FCDocument/FCDEntityInstance.cpp | 24 +-- FCollada/FCDocument/FCDEntityInstance.h | 14 +- FCollada/FCDocument/FCDEntityReference.cpp | 46 +++--- FCollada/FCDocument/FCDEntityReference.h | 6 +- .../FCDExternalReferenceManager.cpp | 4 +- .../FCDocument/FCDExternalReferenceManager.h | 8 +- FCollada/FCDocument/FCDExtra.cpp | 38 ++--- FCollada/FCDocument/FCDExtra.h | 50 +++--- FCollada/FCDocument/FCDForceField.cpp | 8 +- FCollada/FCDocument/FCDForceField.h | 4 +- FCollada/FCDocument/FCDGeometry.cpp | 10 +- FCollada/FCDocument/FCDGeometry.h | 12 +- FCollada/FCDocument/FCDGeometryInstance.cpp | 8 +- FCollada/FCDocument/FCDGeometryInstance.h | 16 +- FCollada/FCDocument/FCDGeometryMesh.cpp | 22 +-- FCollada/FCDocument/FCDGeometryMesh.h | 38 ++--- FCollada/FCDocument/FCDGeometryPolygons.cpp | 16 +- FCollada/FCDocument/FCDGeometryPolygons.h | 12 +- .../FCDocument/FCDGeometryPolygonsInput.cpp | 12 +- .../FCDocument/FCDGeometryPolygonsTools.cpp | 88 +++++----- .../FCDocument/FCDGeometryPolygonsTools.h | 8 +- FCollada/FCDocument/FCDGeometrySource.cpp | 6 +- FCollada/FCDocument/FCDGeometrySource.h | 12 +- FCollada/FCDocument/FCDGeometrySpline.cpp | 18 +-- FCollada/FCDocument/FCDGeometrySpline.h | 34 ++-- FCollada/FCDocument/FCDImage.cpp | 6 +- FCollada/FCDocument/FCDImage.h | 4 +- FCollada/FCDocument/FCDLibrary.h | 6 +- FCollada/FCDocument/FCDLibrary.hpp | 6 +- FCollada/FCDocument/FCDLightTools.cpp | 28 ++-- FCollada/FCDocument/FCDMaterial.cpp | 14 +- FCollada/FCDocument/FCDMaterial.h | 10 +- FCollada/FCDocument/FCDMaterialInstance.cpp | 14 +- FCollada/FCDocument/FCDMaterialInstance.h | 18 +-- FCollada/FCDocument/FCDMorphController.cpp | 32 ++-- FCollada/FCDocument/FCDMorphController.h | 10 +- FCollada/FCDocument/FCDObject.cpp | 2 +- .../FCDocument/FCDParameterAnimatable.cpp | 14 +- .../FCDPhysicsAnalyticalGeometry.cpp | 46 +++--- .../FCDocument/FCDPhysicsAnalyticalGeometry.h | 32 ++-- .../FCDPhysicsForceFieldInstance.cpp | 4 +- .../FCDocument/FCDPhysicsForceFieldInstance.h | 6 +- FCollada/FCDocument/FCDPhysicsMaterial.cpp | 6 +- FCollada/FCDocument/FCDPhysicsMaterial.h | 4 +- FCollada/FCDocument/FCDPhysicsModel.cpp | 12 +- FCollada/FCDocument/FCDPhysicsModel.h | 20 +-- .../FCDocument/FCDPhysicsModelInstance.cpp | 14 +- FCollada/FCDocument/FCDPhysicsModelInstance.h | 20 +-- FCollada/FCDocument/FCDPhysicsRigidBody.cpp | 6 +- FCollada/FCDocument/FCDPhysicsRigidBody.h | 4 +- .../FCDPhysicsRigidBodyInstance.cpp | 18 +-- .../FCDocument/FCDPhysicsRigidBodyInstance.h | 6 +- .../FCDPhysicsRigidBodyParameters.cpp | 6 +- .../FCDPhysicsRigidBodyParameters.h | 6 +- .../FCDocument/FCDPhysicsRigidConstraint.cpp | 18 +-- .../FCDocument/FCDPhysicsRigidConstraint.h | 24 +-- .../FCDPhysicsRigidConstraintInstance.cpp | 14 +- .../FCDPhysicsRigidConstraintInstance.h | 6 +- FCollada/FCDocument/FCDPhysicsScene.cpp | 2 +- FCollada/FCDocument/FCDPhysicsScene.h | 18 +-- FCollada/FCDocument/FCDPhysicsShape.cpp | 44 ++--- FCollada/FCDocument/FCDPhysicsShape.h | 12 +- FCollada/FCDocument/FCDPlaceHolder.cpp | 20 +-- FCollada/FCDocument/FCDPlaceHolder.h | 14 +- FCollada/FCDocument/FCDSceneNode.cpp | 32 ++-- FCollada/FCDocument/FCDSceneNode.h | 38 ++--- FCollada/FCDocument/FCDSceneNodeIterator.hpp | 8 +- FCollada/FCDocument/FCDSceneNodeTools.cpp | 2 +- FCollada/FCDocument/FCDSkinController.cpp | 8 +- FCollada/FCDocument/FCDSkinController.h | 20 +-- FCollada/FCDocument/FCDTargetedEntity.cpp | 6 +- FCollada/FCDocument/FCDTargetedEntity.h | 6 +- FCollada/FCDocument/FCDTexture.cpp | 22 +-- FCollada/FCDocument/FCDTexture.h | 14 +- FCollada/FCDocument/FCDTransform.cpp | 32 ++-- FCollada/FCDocument/FCDTransform.h | 38 ++--- FCollada/FCDocument/FCDocument.cpp | 82 +++++----- FCollada/FCDocument/FCDocument.h | 56 +++---- FCollada/FCDocument/FCDocumentTools.cpp | 24 +-- FCollada/FCollada.cpp | 20 +-- FCollada/FCollada.h | 2 +- FCollada/FColladaPlugin.cpp | 22 +-- FCollada/FColladaPlugin.h | 12 +- FCollada/FColladaTest/FCTestAnimation.cpp | 4 +- .../FCTAMCrossCloning.cpp | 4 +- .../FCTestExportImport/FCTEIAnimation.cpp | 26 +-- .../FCTestExportImport/FCTEICamera.cpp | 8 +- .../FCTestExportImport/FCTEIEmitter.cpp | 10 +- .../FCTestExportImport/FCTEIExtra.cpp | 30 ++-- .../FCTestExportImport/FCTEIGeometry.cpp | 110 ++++++------- .../FCTestExportImport/FCTEILight.cpp | 12 +- .../FCTestExportImport/FCTEIMaterial.cpp | 106 ++++++------- .../FCTestExportImport/FCTEIPhysics.cpp | 36 ++--- .../FCTestExportImport/FCTEIVisualScene.cpp | 94 +++++------ .../FCTestExportImport/FCTestExportImport.cpp | 16 +- .../FCTestGeometryPolygonsTools.cpp | 12 +- FCollada/FColladaTest/FCTestParameters.cpp | 26 +-- .../FCTestXRef/FCTestXRefAcyclic.cpp | 8 +- .../FCTestXRef/FCTestXRefSimple.cpp | 28 ++-- .../FCTestXRef/FCTestXRefTree.cpp | 24 +-- FCollada/FColladaTest/FUtils/FUEventTest.cpp | 2 +- FCollada/FColladaTest/FUtils/FUObjectTest.cpp | 22 +-- .../FUtils/FUStringBuilderTest.cpp | 2 +- FCollada/FColladaTest/FUtils/FUStringTest.cpp | 2 +- FCollada/FColladaTest/FUtils/FUTestBed.cpp | 4 +- FCollada/FMath/FMAllocator.h | 4 +- FCollada/FMath/FMArray.h | 16 +- FCollada/FMath/FMArrayPointer.h | 20 +-- FCollada/FMath/FMQuaternion.cpp | 6 +- FCollada/FMath/FMQuaternion.h | 4 +- FCollada/FMath/FMSort.h | 2 +- FCollada/FMath/FMTree.h | 106 ++++++------- FCollada/FUtils/FUAssert.cpp | 6 +- FCollada/FUtils/FUBoundingBox.cpp | 2 +- FCollada/FUtils/FUBoundingBox.h | 4 +- FCollada/FUtils/FUBoundingSphere.cpp | 4 +- FCollada/FUtils/FUBoundingSphere.h | 4 +- FCollada/FUtils/FUDaeEnum.h | 2 +- FCollada/FUtils/FUError.cpp | 2 +- FCollada/FUtils/FUErrorLog.cpp | 4 +- FCollada/FUtils/FUEvent.h | 2 +- FCollada/FUtils/FUFile.cpp | 14 +- FCollada/FUtils/FUFile.h | 2 +- FCollada/FUtils/FUFileManager.cpp | 38 ++--- FCollada/FUtils/FUFileManager.h | 2 +- FCollada/FUtils/FUObject.cpp | 8 +- FCollada/FUtils/FUObject.h | 34 ++-- FCollada/FUtils/FUObjectType.cpp | 4 +- FCollada/FUtils/FUObjectType.h | 2 +- FCollada/FUtils/FUPluginManager.cpp | 30 ++-- FCollada/FUtils/FUPluginManager.h | 4 +- FCollada/FUtils/FUSingleton.h | 6 +- FCollada/FUtils/FUString.h | 40 ++--- FCollada/FUtils/FUStringBuilder.hpp | 20 +-- FCollada/FUtils/FUStringConversion.cpp | 4 +- FCollada/FUtils/FUStringConversion.hpp | 54 +++---- FCollada/FUtils/FUTracker.h | 24 +-- FCollada/FUtils/FUXmlDocument.cpp | 24 +-- FCollada/FUtils/FUXmlDocument.h | 4 +- FCollada/FUtils/FUXmlParser.cpp | 42 ++--- FCollada/FUtils/FUXmlWriter.cpp | 26 +-- FCollada/FUtils/FUXmlWriter.h | 6 +- FCollada/FUtils/FUtils.h | 8 +- .../FArchiveXML/FAXAnimationExport.cpp | 32 ++-- .../FArchiveXML/FAXAnimationImport.cpp | 22 +-- .../FArchiveXML/FAXCameraExport.cpp | 4 +- .../FArchiveXML/FAXCameraImport.cpp | 14 +- .../FArchiveXML/FAXColladaParser.cpp | 68 ++++---- .../FArchiveXML/FAXColladaWriter.cpp | 40 ++--- .../FArchiveXML/FAXColladaWriter.h | 20 +-- .../FArchiveXML/FAXControllerExport.cpp | 8 +- .../FArchiveXML/FAXControllerImport.cpp | 34 ++-- .../FArchiveXML/FAXEntityExport.cpp | 16 +- .../FArchiveXML/FAXEntityImport.cpp | 14 +- .../FArchiveXML/FAXForceFieldExport.cpp | 2 +- .../FArchiveXML/FAXGeometryExport.cpp | 32 ++-- .../FArchiveXML/FAXGeometryImport.cpp | 80 +++++----- .../FArchiveXML/FAXImportLinking.cpp | 32 ++-- .../FArchiveXML/FAXInstanceExport.cpp | 4 +- .../FArchiveXML/FAXInstanceImport.cpp | 48 +++--- .../FArchiveXML/FAXLightExport.cpp | 2 +- .../FArchiveXML/FAXLightImport.cpp | 14 +- .../FArchiveXML/FAXMaterialExport.cpp | 38 ++--- .../FArchiveXML/FAXMaterialImport.cpp | 88 +++++----- .../FArchiveXML/FAXPhysicsExport.cpp | 12 +- .../FArchiveXML/FAXPhysicsImport.cpp | 104 ++++++------ .../FArchiveXML/FAXSceneExport.cpp | 34 ++-- .../FArchiveXML/FAXSceneImport.cpp | 22 +-- FColladaPlugins/FArchiveXML/FAXStructures.h | 2 +- FColladaPlugins/FArchiveXML/FArchiveXML.cpp | 58 +++---- FColladaPlugins/FArchiveXML/FArchiveXML.h | 4 +- .../FCProcessImages/FCProcessImages.cpp | 4 +- .../FCProcessMeshes/FCProcessMeshes.cpp | 6 +- 225 files changed, 2210 insertions(+), 2210 deletions(-) diff --git a/FCollada/DLLEntry.cpp b/FCollada/DLLEntry.cpp index b4b41f4..2fba817 100644 --- a/FCollada/DLLEntry.cpp +++ b/FCollada/DLLEntry.cpp @@ -10,7 +10,7 @@ #ifdef FCOLLADA_DLL #ifdef WIN32 -HINSTANCE hInstance = NULL; +HINSTANCE hInstance = nullptr; BOOL WINAPI DllMain(HINSTANCE _hInstance, ULONG fdwReason, LPVOID UNUSED(lpvReserved)) { diff --git a/FCollada/FCDocument/FCDAnimated.cpp b/FCollada/FCDocument/FCDAnimated.cpp index 20f4ad5..bb6b1c9 100644 --- a/FCollada/FCDocument/FCDAnimated.cpp +++ b/FCollada/FCDocument/FCDAnimated.cpp @@ -28,7 +28,7 @@ ImplementObjectType(FCDAnimated) FCDAnimated::FCDAnimated(FCDocument* document, size_t valueCount, const char** _qualifiers, float** _values) : FCDObject(document) -, target(NULL) +, target(nullptr) { arrayElement = -1; @@ -120,7 +120,7 @@ float* FCDAnimated::FindValue(const fm::string& qualifier) { if (qualifiers[i] == qualifier) return values[i]; } - return NULL; + return nullptr; } const float* FCDAnimated::FindValue(const fm::string& qualifier) const { @@ -128,7 +128,7 @@ const float* FCDAnimated::FindValue(const fm::string& qualifier) const { if (qualifiers[i] == qualifier) return values[i]; } - return NULL; + return nullptr; } // Retrieve the index of a given qualifier @@ -163,7 +163,7 @@ void FCDAnimated::SetTargetObject(FCDObject* _target) TrackObject(target); } -// Returns whether any of the contained curves are non-NULL +// Returns whether any of the contained curves are non-nullptr bool FCDAnimated::HasCurve() const { FCDAnimationCurveListList::const_iterator cit; @@ -181,7 +181,7 @@ FCDAnimationMultiCurve* FCDAnimated::CreateMultiCurve() const fm::pvector toMerge; toMerge.resize(count); - for (size_t i = 0; i < count; ++i) toMerge[i] = (!curves[i].empty()) ? curves[i][0] : NULL; + for (size_t i = 0; i < count; ++i) toMerge[i] = (!curves[i].empty()) ? curves[i][0] : nullptr; return FCDAnimationCurveTools::MergeCurves(toMerge, defaultValues); } @@ -225,13 +225,13 @@ void FCDAnimated::Evaluate(float time) { // Retrieve the curve and the corresponding value FCDAnimationCurve* curve = curves[i][0]; - if (curve == NULL) continue; + if (curve == nullptr) continue; float* value = values[i]; - if (value == NULL) continue; + if (value == nullptr) continue; // Evaluate the curve at this time (*value) = curve->Evaluate(time); - if (target != NULL) target->SetValueChange(); + if (target != nullptr) target->SetValueChange(); } } } @@ -270,7 +270,7 @@ FCDAnimated* FCDAnimated::Clone(FCDocument* document) const FCDAnimated* FCDAnimated::Clone(FCDAnimated* clone) const { - if (clone != NULL) + if (clone != nullptr) { // Clone the miscellaneous parameters. clone->arrayElement = arrayElement; @@ -289,7 +289,7 @@ FCDAnimated* FCDAnimated::Clone(FCDAnimated* clone) const void FCDAnimated::OnObjectReleased(FUTrackable* object) { FUAssert(object == target, return); - target = NULL; + target = nullptr; // Delete ourselves. We have no job left, if something // wants us they can reconstruct from FCDAnimationChannel @@ -303,7 +303,7 @@ void FCDAnimated::OnObjectReleased(FUTrackable* object) ImplementObjectType(FCDAnimatedCustom) static const char* customAnimatedTemporaryQualifier = ""; -static float* customAnimatedTemporaryValue = NULL; +static float* customAnimatedTemporaryValue = nullptr; FCDAnimatedCustom::FCDAnimatedCustom(FCDObject* object) : FCDAnimated(object, 1, &customAnimatedTemporaryQualifier, &customAnimatedTemporaryValue) @@ -317,9 +317,9 @@ FCDAnimatedCustom::FCDAnimatedCustom(FCDObject* object) void FCDAnimatedCustom::Copy(const FCDAnimated* copy) { - if (copy != NULL) + if (copy != nullptr) { - Resize(copy->GetValueCount(), NULL, false); + Resize(copy->GetValueCount(), nullptr, false); copy->Clone(this); } } @@ -331,7 +331,7 @@ void FCDAnimatedCustom::Resize(size_t count, const char** _qualifiers, bool prep qualifiers.resize(count); curves.resize(count); - for (size_t i = 0; i < count && _qualifiers != NULL && *_qualifiers != 0; ++i) + for (size_t i = 0; i < count && _qualifiers != nullptr && *_qualifiers != 0; ++i) { qualifiers[i] = (prependDot ? fm::string(".") : fm::string("")) + *(_qualifiers++); } diff --git a/FCollada/FCDocument/FCDAnimated.h b/FCollada/FCDocument/FCDAnimated.h index 37c5957..52ac18b 100644 --- a/FCollada/FCDocument/FCDAnimated.h +++ b/FCollada/FCDocument/FCDAnimated.h @@ -69,7 +69,7 @@ class FCOLLADA_EXPORT FCDAnimated : public FCDObject, FUTracker /** The list of animation curves. There is always one curve for one value pointer, although - that curve may be the NULL pointer to indicate a non-animated value. */ + that curve may be the nullptr to indicate a non-animated value. */ FCDAnimationCurveListList curves; /** The target object who contain the float values.*/ @@ -119,12 +119,12 @@ class FCOLLADA_EXPORT FCDAnimated : public FCDObject, FUTracker @param curveIndex The index of the curve within the list of curves affecting the value at the given index. @return The curve affecting the value at the given index. This pointer will - be NULL if one of the index is out-of-bounds or if the value is not animated. */ - inline FCDAnimationCurve* GetCurve(size_t index, size_t curveIndex = 0) { FUAssert(index < GetValueCount(), return NULL); return curveIndex < curves.at(index).size() ? curves.at(index).at(curveIndex) : NULL; } - inline const FCDAnimationCurve* GetCurve(size_t index, size_t curveIndex = 0) const { FUAssert(index < GetValueCount(), return NULL); return curveIndex < curves.at(index).size() ? curves.at(index).at(curveIndex) : NULL; } /**< See above. */ + be nullptr if one of the index is out-of-bounds or if the value is not animated. */ + inline FCDAnimationCurve* GetCurve(size_t index, size_t curveIndex = 0) { FUAssert(index < GetValueCount(), return nullptr); return curveIndex < curves.at(index).size() ? curves.at(index).at(curveIndex) : nullptr; } + inline const FCDAnimationCurve* GetCurve(size_t index, size_t curveIndex = 0) const { FUAssert(index < GetValueCount(), return nullptr); return curveIndex < curves.at(index).size() ? curves.at(index).at(curveIndex) : nullptr; } /**< See above. */ /** Retrieves the list of the curves affecting the values of an animated element. - This list may contain the NULL pointer, where a value is not animated. + This list may contain the nullptr, where a value is not animated. @return The list of animation curves. */ inline FCDAnimationCurveListList& GetCurves() { return curves; } inline const FCDAnimationCurveListList& GetCurves() const { return curves; } /**< See above. */ @@ -147,9 +147,9 @@ class FCOLLADA_EXPORT FCDAnimated : public FCDObject, FUTracker /** Retrieves the value of an animated element. @param index The value index. @return The value at the given index. This pointer will - be NULL if the index is out-of-boudns. */ - inline float* GetValue(size_t index) { FUAssert(index < GetValueCount(), return NULL); return values.at(index); } - inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return values.at(index); } /**< See above. */ + be nullptr if the index is out-of-boudns. */ + inline float* GetValue(size_t index) { FUAssert(index < GetValueCount(), return nullptr); return values.at(index); } + inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return nullptr); return values.at(index); } /**< See above. */ /** [INTERNAL] Overwrites the value pointer of an animated element. Used when changing the list size within FCDParameterAnimatableList. @@ -171,27 +171,27 @@ class FCOLLADA_EXPORT FCDAnimated : public FCDObject, FUTracker /** Retrieves an animated value given a valid qualifier. @param qualifier A valid qualifier. @return The animated value for this qualifier. This pointer will be - NULL if the given qualifier is not used within this animated element. */ + nullptr if the given qualifier is not used within this animated element. */ float* FindValue(const fm::string& qualifier); const float* FindValue(const fm::string& qualifier) const; /**< See above. */ /** Retrieves an animation curve given a valid qualifier. @param qualifier A valid qualifier. @return The animation curve for this qualifier. This pointer will be - NULL if the given qualifier is not used within this animated element + nullptr if the given qualifier is not used within this animated element or if the value for the given qualifier is not animated. */ - inline FCDAnimationCurve* FindCurve(const char* qualifier) { size_t index = FindQualifier(qualifier); return index < GetValueCount() ? GetCurve(index) : NULL; } + inline FCDAnimationCurve* FindCurve(const char* qualifier) { size_t index = FindQualifier(qualifier); return index < GetValueCount() ? GetCurve(index) : nullptr; } inline FCDAnimationCurve* FindCurve(const fm::string& qualifier) { return FindCurve(qualifier.c_str()); } /**< See above. */ - inline const FCDAnimationCurve* FindCurve(const char* qualifier) const { size_t index = FindQualifier(qualifier); return index < GetValueCount() ? GetCurve(index) : NULL; } /**< See above. */ + inline const FCDAnimationCurve* FindCurve(const char* qualifier) const { size_t index = FindQualifier(qualifier); return index < GetValueCount() ? GetCurve(index) : nullptr; } /**< See above. */ inline const FCDAnimationCurve* FindCurve(const fm::string& qualifier) const { return FindCurve(qualifier.c_str()); } /**< See above. */ /** Retrieves an animation curve given a value pointer. @param value A value pointer contained within the animated element. @return The animation curve for this qualifier. This pointer will be - NULL if the value pointer is not contained by this animated element + nullptr if the value pointer is not contained by this animated element or if the value is not animated. */ - inline FCDAnimationCurve* FindCurve(const float* value) { size_t index = FindValue(value); return index < GetValueCount() ? GetCurve(index) : NULL; } - inline const FCDAnimationCurve* FindCurve(const float* value) const { size_t index = FindValue(value); return index < GetValueCount() ? GetCurve(index) : NULL; } /**< See above. */ + inline FCDAnimationCurve* FindCurve(const float* value) { size_t index = FindValue(value); return index < GetValueCount() ? GetCurve(index) : nullptr; } + inline const FCDAnimationCurve* FindCurve(const float* value) const { size_t index = FindValue(value); return index < GetValueCount() ? GetCurve(index) : nullptr; } /**< See above. */ /** Retrieves the value index for a given qualifier. @param qualifier A valid qualifier. @@ -303,7 +303,7 @@ class FCOLLADA_EXPORT FCDAnimatedCustom : public FCDAnimated @param count The new size of the animated element. @param qualifiers The new qualifiers for the animated element. @param prependDot Whether to prepend the '.' character for all the qualifiers of the animated element. */ - void Resize(size_t count, const char** qualifiers = NULL, bool prependDot = true); + void Resize(size_t count, const char** qualifiers = nullptr, bool prependDot = true); /** Resizes the wanted qualifiers. @param qualifiers The new qualifiers for the animated element. @@ -315,7 +315,7 @@ class FCOLLADA_EXPORT FCDAnimatedCustom : public FCDAnimated namespace FCDAnimatedStandardQualifiers { /** Common accessor type string arrays. - These are NULL-terminated and can be used with the AddAccessor function. */ + These are null-terminated and can be used with the AddAccessor function. */ FCOLLADA_EXPORT extern const char* EMPTY[1]; /**< Used for qualifying single values. */ FCOLLADA_EXPORT extern const char* XYZW[4]; /**< Used for position and vector values. */ FCOLLADA_EXPORT extern const char* RGBA[4]; /**< Used for color value. */ diff --git a/FCollada/FCDocument/FCDAnimation.cpp b/FCollada/FCDocument/FCDAnimation.cpp index d6bfc5f..64acf70 100644 --- a/FCollada/FCDocument/FCDAnimation.cpp +++ b/FCollada/FCDocument/FCDAnimation.cpp @@ -37,18 +37,18 @@ FCDAnimation::FCDAnimation(FCDocument* document, FCDAnimation* _parent) FCDAnimation::~FCDAnimation() { // childNodes.clear(); - parent = NULL; + parent = nullptr; } FCDEntity* FCDAnimation::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDAnimation* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDAnimation(const_cast(GetDocument()), NULL); + FCDAnimation* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDAnimation(const_cast(GetDocument()), nullptr); else if (_clone->HasType(FCDAnimation::GetClassType())) clone = (FCDAnimation*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the channels for (const FCDAnimationChannel** it = channels.begin(); it != channels.end(); ++it) @@ -97,18 +97,18 @@ const FCDEntity* FCDAnimation::FindDaeId(const fm::string& daeId) const for (const FCDAnimation** it = children.begin(); it != children.end(); ++it) { const FCDEntity* found = (*it)->FindDaeId(daeId); - if (found != NULL) return found; + if (found != nullptr) return found; } - return NULL; + return nullptr; } void FCDAnimation::GetHierarchicalAssets(FCDAssetConstList& assets) const { - for (const FCDAnimation* animation = this; animation != NULL; animation = animation->GetParent()) + for (const FCDAnimation* animation = this; animation != nullptr; animation = animation->GetParent()) { // Retrieve the asset information structure for this node. const FCDAsset* asset = animation->GetAsset(); - if (asset != NULL) assets.push_back(asset); + if (asset != nullptr) assets.push_back(asset); } assets.push_back(GetDocument()->GetAsset()); } diff --git a/FCollada/FCDocument/FCDAnimation.h b/FCollada/FCDocument/FCDAnimation.h index af8e963..1e0665d 100644 --- a/FCollada/FCDocument/FCDAnimation.h +++ b/FCollada/FCDocument/FCDAnimation.h @@ -63,8 +63,8 @@ class FCOLLADA_EXPORT FCDAnimation : public FCDEntity or the AddChild function, depending on the hierarchical level of the animation entity. @param document The FCollada document that owns the animation entity. - @param parent The parent animation entity. This pointer will be NULL for root animation entities. */ - FCDAnimation(FCDocument* document, FCDAnimation* parent = NULL); + @param parent The parent animation entity. This pointer will be nullptr for root animation entities. */ + FCDAnimation(FCDocument* document, FCDAnimation* parent = nullptr); /** Destructor .*/ virtual ~FCDAnimation(); @@ -75,7 +75,7 @@ class FCOLLADA_EXPORT FCDAnimation : public FCDEntity virtual Type GetType() const { return ANIMATION; } /** Retrieves the parent of the animation structure. - @return The animation parent. This pointer will be NULL + @return The animation parent. This pointer will be nullptr to indicate a root-level animation structure that is contained within the animation library. */ inline FCDAnimation* GetParent() { return parent; } @@ -83,18 +83,18 @@ class FCOLLADA_EXPORT FCDAnimation : public FCDEntity /** Copies the animation tree into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new animation tree + @param clone The empty clone. If this pointer is nullptr, a new animation tree will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** Retrieves the entity with the given COLLADA id. This function will look through the local sub-tree of animations for the given COLLADA id. @param daeId A COLLADA id. @return The animation entity that matches the COLLADA id. This pointer - will be NULL if there are no animation entities that matches the COLLADA id. */ + will be nullptr if there are no animation entities that matches the COLLADA id. */ virtual FCDEntity* FindDaeId(const fm::string& daeId) { return const_cast(const_cast(this)->FindDaeId(daeId)); } virtual const FCDEntity* FindDaeId(const fm::string& daeId) const; /**< See above. */ @@ -107,9 +107,9 @@ class FCOLLADA_EXPORT FCDAnimation : public FCDEntity animation entity tree. @param index The index of the sub-tree. @return The animation entity sub-tree at the given index. This pointer will - be NULL if the index is out-of-bounds. */ - inline FCDAnimation* GetChild(size_t index) { FUAssert(index < children.size(), return NULL); return children.at(index); } - inline const FCDAnimation* GetChild(size_t index) const { FUAssert(index < children.size(), return NULL); return children.at(index); } /**< See above. */ + be nullptr if the index is out-of-bounds. */ + inline FCDAnimation* GetChild(size_t index) { FUAssert(index < children.size(), return nullptr); return children.at(index); } + inline const FCDAnimation* GetChild(size_t index) const { FUAssert(index < children.size(), return nullptr); return children.at(index); } /**< See above. */ /** Creates a new animation entity sub-tree contained within this animation entity tree. @return The new animation sub-tree. */ @@ -133,10 +133,10 @@ class FCOLLADA_EXPORT FCDAnimation : public FCDEntity /** Retrieves an animation channel contained by this animation entity. @param index The index of the channel. - @return The channel at the given index. This pointer will be NULL + @return The channel at the given index. This pointer will be nullptr if the index is out-of-bounds. */ - FCDAnimationChannel* GetChannel(size_t index) { FUAssert(index < GetChannelCount(), return NULL); return channels.at(index); } - const FCDAnimationChannel* GetChannel(size_t index) const { FUAssert(index < GetChannelCount(), return NULL); return channels.at(index); } /**< See above. */ + FCDAnimationChannel* GetChannel(size_t index) { FUAssert(index < GetChannelCount(), return nullptr); return channels.at(index); } + const FCDAnimationChannel* GetChannel(size_t index) const { FUAssert(index < GetChannelCount(), return nullptr); return channels.at(index); } /**< See above. */ /** [INTERNAL] Retrieves the channels' list @deprecated diff --git a/FCollada/FCDocument/FCDAnimationChannel.cpp b/FCollada/FCDocument/FCDAnimationChannel.cpp index d80b911..13b4bf2 100644 --- a/FCollada/FCDocument/FCDAnimationChannel.cpp +++ b/FCollada/FCDocument/FCDAnimationChannel.cpp @@ -31,12 +31,12 @@ FCDAnimationChannel::FCDAnimationChannel(FCDocument* document, FCDAnimation* _pa FCDAnimationChannel::~FCDAnimationChannel() { - parent = NULL; + parent = nullptr; } FCDAnimationChannel* FCDAnimationChannel::Clone(FCDAnimationChannel* clone) const { - if (clone == NULL) clone = new FCDAnimationChannel(const_cast(GetDocument()), NULL); + if (clone == nullptr) clone = new FCDAnimationChannel(const_cast(GetDocument()), nullptr); // Clone the curves for (const FCDAnimationCurve** it = curves.begin(); it != curves.end(); ++it) diff --git a/FCollada/FCDocument/FCDAnimationChannel.h b/FCollada/FCDocument/FCDAnimationChannel.h index 0504694..02bd405 100644 --- a/FCollada/FCDocument/FCDAnimationChannel.h +++ b/FCollada/FCDocument/FCDAnimationChannel.h @@ -61,10 +61,10 @@ class FCOLLADA_EXPORT FCDAnimationChannel : public FCDObject /** Copies the animation channel into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new animation channel + @param clone The empty clone. If this pointer is nullptr, a new animation channel will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDAnimationChannel* Clone(FCDAnimationChannel* clone = NULL) const; + FCDAnimationChannel* Clone(FCDAnimationChannel* clone = nullptr) const; /** Retrieves the animation sub-tree that contains the animation channel. @return The parent animation sub-tree. */ @@ -83,10 +83,10 @@ class FCOLLADA_EXPORT FCDAnimationChannel : public FCDObject /** Retrieves an animation curve contained within the channel. @param index The index of the animation curve. - @return The animation curve at the given index. This pointer will be NULL + @return The animation curve at the given index. This pointer will be nullptr if the index is out-of-bounds. */ - FCDAnimationCurve* GetCurve(size_t index) { FUAssert(index < GetCurveCount(), return NULL); return curves.at(index); } - const FCDAnimationCurve* GetCurve(size_t index) const { FUAssert(index < GetCurveCount(), return NULL); return curves.at(index); } /**< See above. */ + FCDAnimationCurve* GetCurve(size_t index) { FUAssert(index < GetCurveCount(), return nullptr); return curves.at(index); } + const FCDAnimationCurve* GetCurve(size_t index) const { FUAssert(index < GetCurveCount(), return nullptr); return curves.at(index); } /**< See above. */ /** Adds a new animation curve to this animation channel. @return The new animation curve. */ diff --git a/FCollada/FCDocument/FCDAnimationClip.cpp b/FCollada/FCDocument/FCDAnimationClip.cpp index 0fe71a6..d676fb4 100644 --- a/FCollada/FCDocument/FCDAnimationClip.cpp +++ b/FCollada/FCDocument/FCDAnimationClip.cpp @@ -43,13 +43,13 @@ void FCDAnimationClip::AddClipCurve(FCDAnimationCurve* curve) FCDEntity* FCDAnimationClip::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDAnimationClip* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDAnimationClip(const_cast(GetDocument())); + FCDAnimationClip* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDAnimationClip(const_cast(GetDocument())); else if (_clone->HasType(FCDAnimationClip::GetClassType())) clone = (FCDAnimationClip*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Copy the generic animation clip parameters clone->start = start; @@ -60,7 +60,7 @@ FCDEntity* FCDAnimationClip::Clone(FCDEntity* _clone, bool cloneChildren) const { if (cloneChildren) { - FCDAnimationCurve* clonedCurve = (*it)->Clone(NULL, false); + FCDAnimationCurve* clonedCurve = (*it)->Clone(nullptr, false); clonedCurve->AddClip(clone); clone->AddClipCurve(clonedCurve); } @@ -72,14 +72,14 @@ FCDEntity* FCDAnimationClip::Clone(FCDEntity* _clone, bool cloneChildren) const FCDEntityInstance* FCDAnimationClip::AddInstanceAnimation() { - FCDEntityInstance* newInstance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), NULL, FCDEntity::ANIMATION); + FCDEntityInstance* newInstance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), nullptr, FCDEntity::ANIMATION); animations.push_back(newInstance); return newInstance; } FCDEntityInstance* FCDAnimationClip::AddInstanceAnimation(FCDAnimation* animation) { - FCDEntityInstance* newInstance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), NULL, animation); + FCDEntityInstance* newInstance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), nullptr, animation); animations.push_back(newInstance); return newInstance; } diff --git a/FCollada/FCDocument/FCDAnimationClip.h b/FCollada/FCDocument/FCDAnimationClip.h index 8910592..687fbe8 100644 --- a/FCollada/FCDocument/FCDAnimationClip.h +++ b/FCollada/FCDocument/FCDAnimationClip.h @@ -60,11 +60,11 @@ class FCOLLADA_EXPORT FCDAnimationClip : public FCDEntity /** Copies the animation clip entity into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new animation clip + @param clone The empty clone. If this pointer is nullptr, a new animation clip will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** Retrieves the entity type for this class. This function is part of the FCDEntity class interface. @@ -107,7 +107,7 @@ class FCOLLADA_EXPORT FCDAnimationClip : public FCDEntity /** Retrieves a given animation instanced by this clip. @param index The index of the animation to retrieve. @return The animation object at the given index. */ - inline FCDAnimation* GetAnimation(size_t index) const { FUAssert(GetAnimationCount() > index, return NULL); return (FCDAnimation*) animations[index]->GetEntity(); } + inline FCDAnimation* GetAnimation(size_t index) const { FUAssert(GetAnimationCount() > index, return nullptr); return (FCDAnimation*) animations[index]->GetEntity(); } /** Sets the name of the animation at a given index. @param name The name to give the animation at the given index. diff --git a/FCollada/FCDocument/FCDAnimationCurve.cpp b/FCollada/FCDocument/FCDAnimationCurve.cpp index ad8c072..ebf6bad 100644 --- a/FCollada/FCDocument/FCDAnimationCurve.cpp +++ b/FCollada/FCDocument/FCDAnimationCurve.cpp @@ -57,13 +57,13 @@ float FindT(float cp0x, float cp1x, float cp2x, float cp3x, float input, float i static void ComputeTCBTangent(const FCDAnimationKey* previousKey, const FCDAnimationKey* currentKey, const FCDAnimationKey* nextKey, float tens, float cont, float bias, FMVector2& leftTangent, FMVector2& rightTangent) { - FUAssert(currentKey != NULL, return;); + FUAssert(currentKey != nullptr, return;); // Calculate the intervals and allow for time differences of both sides. FMVector2 pCurrentMinusPrevious; FMVector2 pNextMinusCurrent; - //If the previous key or the last key is NULL, do make one up... + //If the previous key or the last key is nullptr, do make one up... if (!previousKey) { if (nextKey) pCurrentMinusPrevious.x = nextKey->input - currentKey->input; else pCurrentMinusPrevious.x = 0.5f; //Case where there is only one TCB key.. should not happen. @@ -106,9 +106,9 @@ FCDAnimationCurve::FCDAnimationCurve(FCDocument* document, FCDAnimationChannel* : FCDObject(document), parent(_parent), targetElement(-1), preInfinity(FUDaeInfinity::CONSTANT), postInfinity(FUDaeInfinity::CONSTANT), - inputDriver(NULL), inputDriverIndex(0) + inputDriver(nullptr), inputDriverIndex(0) { - currentClip = NULL; + currentClip = nullptr; currentOffset = 0; } @@ -116,8 +116,8 @@ FCDAnimationCurve::~FCDAnimationCurve() { CLEAR_POINTER_VECTOR(keys); - inputDriver = NULL; - parent = NULL; + inputDriver = nullptr; + parent = nullptr; clips.clear(); clipOffsets.clear(); } @@ -166,7 +166,7 @@ FCDAnimationKey* FCDAnimationCurve::AddKey(FUDaeInterpolation::Interpolation int case FUDaeInterpolation::LINEAR: key = new FCDAnimationKey; break; case FUDaeInterpolation::BEZIER: key = new FCDAnimationKeyBezier; break; case FUDaeInterpolation::TCB: key = new FCDAnimationKeyTCB; break; - default: FUFail(return NULL); + default: FUFail(return nullptr); } key->interpolation = (uint32) interpolation; key->input = input; @@ -201,7 +201,7 @@ void FCDAnimationCurve::AddClip(FCDAnimationClip* clip) bool FCDAnimationCurve::HasDriver() const { - return inputDriver != NULL; + return inputDriver != nullptr; } void FCDAnimationCurve::GetDriver(FCDAnimated*& driver, int32& index) @@ -221,7 +221,7 @@ void FCDAnimationCurve::SetDriver(FCDAnimated* driver, int32 index) FCDAnimationCurve* FCDAnimationCurve::Clone(FCDAnimationCurve* clone, bool includeClips) const { - if (clone == NULL) clone = new FCDAnimationCurve(const_cast(GetDocument()), parent); + if (clone == nullptr) clone = new FCDAnimationCurve(const_cast(GetDocument()), parent); clone->SetTargetElement(targetElement); clone->SetTargetQualifier(targetQualifier); @@ -281,7 +281,7 @@ void FCDAnimationCurve::SetCurrentAnimationClip(FCDAnimationClip* clip) { if (currentClip == clip) return; - currentClip = NULL; + currentClip = nullptr; float clipOffset = 0.0f; for (size_t i = 0; i < clips.size(); ++i) { @@ -293,7 +293,7 @@ void FCDAnimationCurve::SetCurrentAnimationClip(FCDAnimationClip* clip) } } - if (currentClip != NULL) + if (currentClip != nullptr) { float offset = clipOffset - currentOffset; currentOffset = clipOffset; @@ -404,7 +404,7 @@ float FCDAnimationCurve::Evaluate(float input) const FCDAnimationKeyTCB* tkey2 = (FCDAnimationKeyTCB*) endKey; FMVector2 tempTangent; tempTangent.x = tempTangent.y = 0.0f; - const FCDAnimationKey* nextKey = (it + 1) < keys.end() ? (*(it + 1)) : NULL; + const FCDAnimationKey* nextKey = (it + 1) < keys.end() ? (*(it + 1)) : nullptr; ComputeTCBTangent(startKey, endKey, nextKey, tkey2->tension, tkey2->continuity, tkey2->bias, inTangent, tempTangent); //Change this when we've figured out the values of the vectors from TCB... inTangent.x = endKey->input + inTangent.x; @@ -443,7 +443,7 @@ float FCDAnimationCurve::Evaluate(float input) const FCDAnimationKeyTCB* tkey1 = (FCDAnimationKeyTCB*) startKey; FMVector2 startTangent, tempTangent, endTangent; startTangent.x = startTangent.y = tempTangent.x = tempTangent.y = endTangent.x = endTangent.y = 0.0f; - const FCDAnimationKey* previousKey = (it - 1) > keys.begin() ? (*(it - 2)) : NULL; + const FCDAnimationKey* previousKey = (it - 1) > keys.begin() ? (*(it - 2)) : nullptr; ComputeTCBTangent(previousKey, startKey, endKey, tkey1->tension, tkey1->continuity, tkey1->bias, tempTangent, startTangent); // Calculate the end key's in-tangent. @@ -451,7 +451,7 @@ float FCDAnimationCurve::Evaluate(float input) const float bx = 0.0f, cx = 0.0f; //will be used in FindT.. x equivalent of the point at b and c if (endKey->interpolation == FUDaeInterpolation::TCB) { FCDAnimationKeyTCB* tkey2 = (FCDAnimationKeyTCB*) endKey; - const FCDAnimationKey* nextKey = (it + 1) < keys.end() ? (*(it + 1)) : NULL; + const FCDAnimationKey* nextKey = (it + 1) < keys.end() ? (*(it + 1)) : nullptr; ComputeTCBTangent(startKey, endKey, nextKey, tkey2->tension, tkey2->continuity, tkey2->bias, endTangent, tempTangent); cy = endKey->output + endTangent.y; //Assuming the tangent is GOING from the point. cx = endKey->output + endTangent.x; @@ -489,14 +489,14 @@ float FCDAnimationCurve::Evaluate(float input) const // Apply a conversion function on the key values and tangents void FCDAnimationCurve::ConvertValues(FCDConversionFunction valueConversion, FCDConversionFunction tangentConversion) { - if (valueConversion != NULL) + if (valueConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { (*it)->output = (*valueConversion)((*it)->output); } } - if (tangentConversion != NULL) + if (tangentConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { @@ -512,14 +512,14 @@ void FCDAnimationCurve::ConvertValues(FCDConversionFunction valueConversion, FCD } void FCDAnimationCurve::ConvertValues(FCDConversionFunctor* valueConversion, FCDConversionFunctor* tangentConversion) { - if (valueConversion != NULL) + if (valueConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { (*it)->output = (*valueConversion)((*it)->output); } } - if (tangentConversion != NULL) + if (tangentConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { @@ -537,14 +537,14 @@ void FCDAnimationCurve::ConvertValues(FCDConversionFunctor* valueConversion, FCD // Apply a conversion function on the key times and tangent weights void FCDAnimationCurve::ConvertInputs(FCDConversionFunction timeConversion, FCDConversionFunction tangentWeightConversion) { - if (timeConversion != NULL) + if (timeConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { (*it)->input = (*timeConversion)((*it)->input); } } - if (tangentWeightConversion != NULL) + if (tangentWeightConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { @@ -560,14 +560,14 @@ void FCDAnimationCurve::ConvertInputs(FCDConversionFunction timeConversion, FCDC } void FCDAnimationCurve::ConvertInputs(FCDConversionFunctor* timeConversion, FCDConversionFunctor* tangentWeightConversion) { - if (timeConversion != NULL) + if (timeConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { (*it)->input = (*timeConversion)((*it)->input); } } - if (tangentWeightConversion != NULL) + if (tangentWeightConversion != nullptr) { for (FCDAnimationKeyList::iterator it = keys.begin(); it != keys.end(); ++it) { diff --git a/FCollada/FCDocument/FCDAnimationCurve.h b/FCollada/FCDocument/FCDAnimationCurve.h index 1c2253f..07034c7 100644 --- a/FCollada/FCDocument/FCDAnimationCurve.h +++ b/FCollada/FCDocument/FCDAnimationCurve.h @@ -109,8 +109,8 @@ class FCOLLADA_EXPORT FCDAnimationCurve : public FCDObject /** Retrieves one key in the animation curve. @param index The index of the key to retrieve. @return The key. */ - inline FCDAnimationKey* GetKey(size_t index) { FUAssert(index < keys.size(), return NULL); return keys.at(index); } - inline const FCDAnimationKey* GetKey(size_t index) const { FUAssert(index < keys.size(), return NULL); return keys.at(index); } /**< See above. */ + inline FCDAnimationKey* GetKey(size_t index) { FUAssert(index < keys.size(), return nullptr); return keys.at(index); } + inline const FCDAnimationKey* GetKey(size_t index) const { FUAssert(index < keys.size(), return nullptr); return keys.at(index); } /**< See above. */ /** Appends a key to the animation curve. @param interpolation The interpolation type for the new key. @@ -165,7 +165,7 @@ class FCOLLADA_EXPORT FCDAnimationCurve : public FCDObject /** Retrieves the value pointer that drives this animation curve. @param driver A reference to receive the animated input driver. This pointer will - be set to NULL when there is no input driver. + be set to nullptr when there is no input driver. @param index A reference to receive the animated input driver element index. */ void GetDriver(FCDAnimated*& driver, int32& index); void GetDriver(const FCDAnimated*& driver, int32& index) const; /**< See above. */ @@ -177,7 +177,7 @@ class FCOLLADA_EXPORT FCDAnimationCurve : public FCDObject int32 GetDriverIndex(){ return inputDriverIndex; } /** Sets the value pointer that drives the animation curve. - @param driver The driver animated value. Set this pointer to NULL + @param driver The driver animated value. Set this pointer to nullptr to indicate that time drives the animation curve. @param index The driver animated value index. */ void SetDriver(FCDAnimated* driver, int32 index); @@ -194,8 +194,8 @@ class FCOLLADA_EXPORT FCDAnimationCurve : public FCDObject /** Retrieves an animation clips that use this animation curve. @param index The index of the animation clip. @return The animation clip at the given index in the list of clips that use this curve. */ - inline FCDAnimationClip* GetClip(size_t index) { FUAssert(index < clips.size(), return NULL); return clips[index]; } - inline const FCDAnimationClip* GetClip(size_t index) const { FUAssert(index < clips.size(), return NULL); return clips[index]; } /**< See above. */ + inline FCDAnimationClip* GetClip(size_t index) { FUAssert(index < clips.size(), return nullptr); return clips[index]; } + inline const FCDAnimationClip* GetClip(size_t index) const { FUAssert(index < clips.size(), return nullptr); return clips[index]; } /**< See above. */ /** Adds an animation clip to the list of animation clips that use this curve. @param clip An animation clip that uses this curve. */ @@ -216,12 +216,12 @@ class FCOLLADA_EXPORT FCDAnimationCurve : public FCDObject /** Clones the animation curve. The animation clips can be cloned as well, but this may lead to an infinite recursion because cloning the clips will also clone its curves. - @param clone The cloned animation curve. If this pointer is NULL, a new + @param clone The cloned animation curve. If this pointer is nullptr, a new animation curve will be created for you. You will then need to release the pointer. @param includeClips True if want to also clone the animation clips. @return The cloned animation curve. */ - FCDAnimationCurve* Clone(FCDAnimationCurve* clone = NULL, bool includeClips = true) const; + FCDAnimationCurve* Clone(FCDAnimationCurve* clone = nullptr, bool includeClips = true) const; /** Applies a conversion function to the key output values of the animation curve. @param valueConversion The conversion function to use on the key outputs. diff --git a/FCollada/FCDocument/FCDAnimationCurveTools.cpp b/FCollada/FCDocument/FCDAnimationCurveTools.cpp index 3a5a08d..bee1c4a 100644 --- a/FCollada/FCDocument/FCDAnimationCurveTools.cpp +++ b/FCollada/FCDocument/FCDAnimationCurveTools.cpp @@ -21,15 +21,15 @@ namespace FCDAnimationCurveTools FCDAnimationMultiCurve* MergeCurves(const FCDAnimationCurveConstList& toMerge, const FloatList& defaultValues) { size_t dimension = toMerge.size(); - if (dimension == 0) return NULL; + if (dimension == 0) return nullptr; // Look for the document pointer and select the parent curve. - FCDocument* document = NULL; + FCDocument* document = nullptr; int32 targetElement = -1; FUDaeInfinity::Infinity preInfinity = FUDaeInfinity::CONSTANT, postInfinity = FUDaeInfinity::CONSTANT; for (size_t i = 0; i < dimension; ++i) { - if (toMerge[i] != NULL) + if (toMerge[i] != nullptr) { document = const_cast(toMerge[i]->GetDocument()); targetElement = toMerge[i]->GetTargetElement(); @@ -38,7 +38,7 @@ namespace FCDAnimationCurveTools break; } } - if (document == NULL) return NULL; + if (document == nullptr) return nullptr; // Allocate the output multiCurve. FCDAnimationMultiCurve* multiCurve = new FCDAnimationMultiCurve(document, (uint32) dimension); @@ -52,7 +52,7 @@ namespace FCDAnimationCurveTools for (size_t i = 0; i < dimension; ++i) { const FCDAnimationCurve* curve = toMerge[i]; - if (curve == NULL) continue; + if (curve == nullptr) continue; const FCDAnimationKey** curveKeys = curve->GetKeys(); // Merge each curve's keys, which should already be sorted, into the multi-curve's @@ -97,7 +97,7 @@ namespace FCDAnimationCurveTools for (size_t i = 0; i < dimension; ++i) { const FCDAnimationCurve* curve = toMerge[i]; - if (curve == NULL || curve->GetKeyCount() == 0) + if (curve == nullptr || curve->GetKeyCount() == 0) { // No curve, or an empty curve, set the default value on all the keys float defaultValue = (i < defaultValues.size()) ? defaultValues[i] : 0.0f; @@ -209,12 +209,12 @@ namespace FCDAnimationCurveTools { size_t keyCount = curve->GetKeyCount(); size_t dimension = curve->GetDimension(); - if (keyCount == 0 || dimension== 0) return NULL; - if (collapse == NULL) collapse = Average; + if (keyCount == 0 || dimension== 0) return nullptr; + if (collapse == nullptr) collapse = Average; const FCDAnimationMKey** inKeys = curve->GetKeys(); // Create the output one-dimensional curve and create the keys. - FCDAnimationCurve* out = new FCDAnimationCurve(const_cast(curve->GetDocument()), NULL); + FCDAnimationCurve* out = new FCDAnimationCurve(const_cast(curve->GetDocument()), nullptr); for (size_t i = 0; i < keyCount; ++i) { out->AddKey((FUDaeInterpolation::Interpolation) inKeys[i]->interpolation); diff --git a/FCollada/FCDocument/FCDAnimationCurveTools.h b/FCollada/FCDocument/FCDAnimationCurveTools.h index 8db9a8b..8a1f921 100644 --- a/FCollada/FCDocument/FCDAnimationCurveTools.h +++ b/FCollada/FCDocument/FCDAnimationCurveTools.h @@ -26,13 +26,13 @@ namespace FCDAnimationCurveTools { /** Merges multiple single-dimensional animation curves into one multi-dimensional animation curve. - For each NULL element found within the 'toMerge' list, the corresponding + For each nullptr element found within the 'toMerge' list, the corresponding default value is used. If there are not enough default values provided, zero is assumed. The number of dimensions for the output animation curve is taken as the size of the 'toMerge' list. @param toMerge The list of single-dimensional animation curves to merge. This list may - contain NULL elements, as explained above. - @param defaultValues The list of default values to use when a NULL element is encountered. - Default values should be provided even for the elements that are not NULL. */ + contain nullptr elements, as explained above. + @param defaultValues The list of default values to use when a nullptr element is encountered. + Default values should be provided even for the elements that are not nullptr. */ FCOLLADA_EXPORT FCDAnimationMultiCurve* MergeCurves(const FCDAnimationCurveConstList& toMerge, const FloatList& defaultValues); inline FCDAnimationMultiCurve* MergeCurves(const FCDAnimationCurveList& toMerge, const FloatList& defaultValues) { return MergeCurves(*(const FCDAnimationCurveConstList*) &toMerge, defaultValues); } /**< See above. */ @@ -40,9 +40,9 @@ namespace FCDAnimationCurveTools @see Average TakeFirst @param curve The multi-dimensional curve to collapse. @param collapse The function to use to collapse multiple floating-point - values into one. Set this to NULL to use the default collapsing + values into one. Set this to nullptr to use the default collapsing function, which averages all the values. */ - FCOLLADA_EXPORT FCDAnimationCurve* Collapse(const FCDAnimationMultiCurve* curve, FCDCollapsingFunction collapse = NULL); + FCOLLADA_EXPORT FCDAnimationCurve* Collapse(const FCDAnimationMultiCurve* curve, FCDCollapsingFunction collapse = nullptr); /** Retrieves the first floating-point value of a list of floating-point values. This is a typical conversion function. diff --git a/FCollada/FCDocument/FCDAnimationMultiCurve.h b/FCollada/FCDocument/FCDAnimationMultiCurve.h index fb45b0b..74a00ea 100644 --- a/FCollada/FCDocument/FCDAnimationMultiCurve.h +++ b/FCollada/FCDocument/FCDAnimationMultiCurve.h @@ -95,8 +95,8 @@ class FCOLLADA_EXPORT FCDAnimationMultiCurve : public FCDObject /** Retrieve one key of the animation curve. @param index The index of the key to retrieve. @return The indexed key. */ - inline FCDAnimationMKey* GetKey(size_t index) { FUAssert(index < keys.size(), return NULL); return keys.at(index); } - inline const FCDAnimationMKey* GetKey(size_t index) const { FUAssert(index < keys.size(), return NULL); return keys.at(index); } /**< See above. */ + inline FCDAnimationMKey* GetKey(size_t index) { FUAssert(index < keys.size(), return nullptr); return keys.at(index); } + inline const FCDAnimationMKey* GetKey(size_t index) const { FUAssert(index < keys.size(), return nullptr); return keys.at(index); } /**< See above. */ /** Appends a key to the animation curve. @param interpolation The interpolation type for the new key. diff --git a/FCollada/FCDocument/FCDAsset.cpp b/FCollada/FCDocument/FCDAsset.cpp index 3a06ae4..7a98677 100644 --- a/FCollada/FCDocument/FCDAsset.cpp +++ b/FCollada/FCDocument/FCDAsset.cpp @@ -48,7 +48,7 @@ FCDAssetContributor* FCDAsset::AddContributor() // Clone another asset element. FCDAsset* FCDAsset::Clone(FCDAsset* clone, bool cloneAllContributors) const { - if (clone == NULL) clone = new FCDAsset(const_cast(GetDocument())); + if (clone == nullptr) clone = new FCDAsset(const_cast(GetDocument())); // Clone all the asset-level parameters. clone->creationDateTime = creationDateTime; @@ -97,7 +97,7 @@ FCDAssetContributor::~FCDAssetContributor() FCDAssetContributor* FCDAssetContributor::Clone(FCDAssetContributor* clone) const { - if (clone == NULL) clone = new FCDAssetContributor(const_cast(GetDocument())); + if (clone == nullptr) clone = new FCDAssetContributor(const_cast(GetDocument())); clone->author = author; clone->authoringTool = authoringTool; diff --git a/FCollada/FCDocument/FCDAsset.h b/FCollada/FCDocument/FCDAsset.h index 2c1ace5..17beba0 100644 --- a/FCollada/FCDocument/FCDAsset.h +++ b/FCollada/FCDocument/FCDAsset.h @@ -96,8 +96,8 @@ class FCOLLADA_EXPORT FCDAsset : public FCDObject /** Retrieves a contributor tied to this asset. @param index The index of the contributor. @return The contributor at the given index. */ - inline FCDAssetContributor* GetContributor(size_t index) { FUAssert(index < GetContributorCount(), return NULL); return contributors.at(index); } - inline const FCDAssetContributor* GetContributor(size_t index) const { FUAssert(index < GetContributorCount(), return NULL); return contributors.at(index); } /**< See above. */ + inline FCDAssetContributor* GetContributor(size_t index) { FUAssert(index < GetContributorCount(), return nullptr); return contributors.at(index); } + inline const FCDAssetContributor* GetContributor(size_t index) const { FUAssert(index < GetContributorCount(), return nullptr); return contributors.at(index); } /**< See above. */ /** Inserts a new contributor to this asset. @return An empty contributor structure. */ @@ -220,11 +220,11 @@ class FCOLLADA_EXPORT FCDAsset : public FCDObject /** Clones the asset structure into another asset structure. @param clone The asset structure that will become the copy of this asset. - When this pointer is NULL, a new asset structure will be created. + When this pointer is nullptr, a new asset structure will be created. @param cloneAllContributors Whether all the contributors of this asset should be copied into the clone. @return The clone. */ - FCDAsset* Clone(FCDAsset* clone = NULL, bool cloneAllContributors = true) const; + FCDAsset* Clone(FCDAsset* clone = nullptr, bool cloneAllContributors = true) const; }; @@ -268,8 +268,8 @@ class FCOLLADA_EXPORT FCDAssetContributor : public FCDObject /** Sets the name of the user that applies the current contributor. It is suggested to use the following code snippet: const char* userName = getenv("USER"); - if (userName == NULL) userName = getenv("USERNAME"); - if (userName != NULL) contributor->SetAuthor(TO_FSTRING(userName)); + if (userName == nullptr) userName = getenv("USERNAME"); + if (userName != nullptr) contributor->SetAuthor(TO_FSTRING(userName)); @param _author The name of the user. */ inline void SetAuthor(const fstring& _author) { author = _author; SetDirtyFlag(); } @@ -319,10 +319,10 @@ class FCOLLADA_EXPORT FCDAssetContributor : public FCDObject /** Clones a contributor structure. @param clone The contributor structure that will become the copy - of this contributor structure. When this pointer is NULL, + of this contributor structure. When this pointer is nullptr, a new contributor structure is created. @return The clone. */ - FCDAssetContributor* Clone(FCDAssetContributor* clone = NULL) const; + FCDAssetContributor* Clone(FCDAssetContributor* clone = nullptr) const; }; #endif // _FCD_ASSET_H_ diff --git a/FCollada/FCDocument/FCDController.cpp b/FCollada/FCDocument/FCDController.cpp index 6c39545..cb24e2f 100644 --- a/FCollada/FCDocument/FCDController.cpp +++ b/FCollada/FCDocument/FCDController.cpp @@ -41,7 +41,7 @@ FCDController::~FCDController() // Sets the type of this controller to a skin controller. FCDSkinController* FCDController::CreateSkinController() { - morphController = NULL; + morphController = nullptr; skinController = new FCDSkinController(GetDocument(), this); SetNewChildFlag(); return skinController; @@ -50,7 +50,7 @@ FCDSkinController* FCDController::CreateSkinController() // Sets the type of this controller to a morph controller. FCDMorphController* FCDController::CreateMorphController() { - skinController = NULL; + skinController = nullptr; morphController = new FCDMorphController(GetDocument(), this); SetNewChildFlag(); return morphController; @@ -58,31 +58,31 @@ FCDMorphController* FCDController::CreateMorphController() FCDEntity* FCDController::GetBaseTarget() { - if (skinController != NULL) return skinController->GetTarget(); - else if (morphController != NULL) return morphController->GetBaseTarget(); - else return NULL; + if (skinController != nullptr) return skinController->GetTarget(); + else if (morphController != nullptr) return morphController->GetBaseTarget(); + else return nullptr; } const FCDEntity* FCDController::GetBaseTarget() const { - if (skinController != NULL) return skinController->GetTarget(); - else if (morphController != NULL) return morphController->GetBaseTarget(); - else return NULL; + if (skinController != nullptr) return skinController->GetTarget(); + else if (morphController != nullptr) return morphController->GetBaseTarget(); + else return nullptr; } // Retrieves the base target geometry for this controller. const FCDGeometry* FCDController::GetBaseGeometry() const { const FCDEntity* base = GetBaseTarget(); - while (base != NULL && base->GetType() == FCDEntity::CONTROLLER) + while (base != nullptr && base->GetType() == FCDEntity::CONTROLLER) { base = ((const FCDController*) base)->GetBaseTarget(); } - if (base != NULL && base->GetType() == FCDEntity::GEOMETRY) + if (base != nullptr && base->GetType() == FCDEntity::GEOMETRY) { return (const FCDGeometry*) base; } - return NULL; + return nullptr; } // Returns the first FCDController directly above the base of this controller @@ -90,16 +90,16 @@ const FCDController* FCDController::GetBaseGeometryController() const { const FCDEntity* parentBase = this; const FCDEntity* base = GetBaseTarget(); - while (base != NULL && base->GetType() == FCDEntity::CONTROLLER) + while (base != nullptr && base->GetType() == FCDEntity::CONTROLLER) { parentBase = base; base = ((const FCDController*) base)->GetBaseTarget(); } - if (base != NULL && base->GetType() == FCDEntity::GEOMETRY) + if (base != nullptr && base->GetType() == FCDEntity::GEOMETRY) { return (const FCDController*) parentBase; } - return NULL; + return nullptr; } diff --git a/FCollada/FCDocument/FCDController.h b/FCollada/FCDocument/FCDController.h index 25a166c..3e073fc 100644 --- a/FCollada/FCDocument/FCDController.h +++ b/FCollada/FCDocument/FCDController.h @@ -61,11 +61,11 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity /** Retrieves whether this controller is a skin controller. @return Whether this controller is a skin controller. */ - bool IsSkin() const { return skinController != NULL; } + bool IsSkin() const { return skinController != nullptr; } /** Retrieves whether this controller is a morph controller. @return Whether this controller is a morph controller. */ - bool IsMorph() const { return morphController != NULL; } + bool IsMorph() const { return morphController != nullptr; } /** Sets the type of this controller to a skin controller. This function will release any previously created morpher or skin. @@ -80,7 +80,7 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity /** Retrieves the skin controller. This pointer is only valid for skins. To verify that this is a skin, check the HasSkinController function. - @return The skin controller. This pointer will be NULL, if the controller + @return The skin controller. This pointer will be nullptr, if the controller is not a skin. */ inline FCDSkinController* GetSkinController() { return skinController; } inline const FCDSkinController* GetSkinController() const { return skinController; } /**< See above. */ @@ -88,7 +88,7 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity /** Retrieves the morph controller. This pointer is only valid for skins. To verify that this is a morpher, check the HasMorphController function. - @return The morph controller. This pointer will be NULL, if the controller + @return The morph controller. This pointer will be nullptr, if the controller is not a morpher. */ inline FCDMorphController* GetMorphController() { return morphController; } inline const FCDMorphController* GetMorphController() const { return morphController; } /**< See above. */ @@ -97,7 +97,7 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity The base target entity may be another controller or a geometry entity. To change the base target, use the FCDMorphController::SetBaseTarget or the FCDSkinController::SetTarget functions. - @return The base target entity. This pointer will be NULL + @return The base target entity. This pointer will be nullptr if no base target is defined. */ FCDEntity* GetBaseTarget(); const FCDEntity* GetBaseTarget() const; /**< See above. */ @@ -105,7 +105,7 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity /** Retrieves the base target geometry for this controller. Controllers can be chained together. This function allows you to retrieve the base target geometry, if there is one. - @return The base target geometry. This pointer will be NULL + @return The base target geometry. This pointer will be nullptr if no base target is defined or if the base target entity is not a geometry. */ inline FCDGeometry* GetBaseGeometry() { return const_cast(const_cast(this)->GetBaseGeometry()); } @@ -114,7 +114,7 @@ class FCOLLADA_EXPORT FCDController : public FCDEntity /** Retrieves the lowest controller on this stack. Controllers can be chained together. This function allows you to retrieve the controller assigned to the base target geometry. - @return The base controller. This pointer will be NULL + @return The base controller. This pointer will be nullptr if no base target is defined or if the base target entity is not a geometry. */ inline FCDController* GetBaseGeometryController() { return const_cast(const_cast(this)->GetBaseGeometryController()); } diff --git a/FCollada/FCDocument/FCDControllerInstance.cpp b/FCollada/FCDocument/FCDControllerInstance.cpp index f217ef8..3ae8113 100644 --- a/FCollada/FCDocument/FCDControllerInstance.cpp +++ b/FCollada/FCDocument/FCDControllerInstance.cpp @@ -32,13 +32,13 @@ FCDControllerInstance::~FCDControllerInstance() FCDEntityInstance* FCDControllerInstance::Clone(FCDEntityInstance* _clone) const { - FCDControllerInstance* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDControllerInstance(const_cast(GetDocument()), NULL, GetEntityType()); + FCDControllerInstance* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDControllerInstance(const_cast(GetDocument()), nullptr, GetEntityType()); else if (_clone->HasType(FCDControllerInstance::GetClassType())) clone = (FCDControllerInstance*) _clone; Parent::Clone(_clone); - if (clone != NULL) + if (clone != nullptr) { // Clone the URI list. clone->skeletonRoots = skeletonRoots; @@ -57,7 +57,7 @@ void FCDControllerInstance::CalculateRootIds() for (const FCDSceneNode* const* itJ = joints.begin(); itJ != joints.end(); ++itJ) { const FCDSceneNode* joint = (*itJ); - if (joint == NULL) continue; + if (joint == nullptr) continue; bool addToList = true; size_t parentCount = joint->GetParentCount(); @@ -82,7 +82,7 @@ void FCDControllerInstance::CalculateRootIds() bool FCDControllerInstance::AddJoint(FCDSceneNode* j) { - if (j != NULL) + if (j != nullptr) { j->SetJointFlag(true); AppendJoint(j); @@ -115,7 +115,7 @@ void FCDControllerInstance::AppendJoint(FCDSceneNode* j) const FCDSkinController* FCDControllerInstance::FindSkin(const FCDEntity* entity) const { - if (entity != NULL && entity->GetType() == FCDEntity::CONTROLLER) + if (entity != nullptr && entity->GetType() == FCDEntity::CONTROLLER) { const FCDController* controller = (const FCDController*) entity; @@ -125,7 +125,7 @@ const FCDSkinController* FCDControllerInstance::FindSkin(const FCDEntity* entity } else return FindSkin(controller->GetBaseTarget()); } - return NULL; + return nullptr; } void FCDControllerInstance::FindSkeletonNodes(FCDSceneNodeList& skeletonNodes) const @@ -136,7 +136,7 @@ void FCDControllerInstance::FindSkeletonNodes(FCDSceneNodeList& skeletonNodes) c for (size_t i = 0; i < numRoots; ++i) { const FCDSceneNode* aRoot = document->FindSceneNode(TO_STRING(skeletonRoots[i].GetFragment()).c_str()); - if (aRoot == NULL) + if (aRoot == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_UNKNOWN_JOINT, 0); } diff --git a/FCollada/FCDocument/FCDControllerInstance.h b/FCollada/FCDocument/FCDControllerInstance.h index c35449c..7126e50 100644 --- a/FCollada/FCDocument/FCDControllerInstance.h +++ b/FCollada/FCDocument/FCDControllerInstance.h @@ -75,10 +75,10 @@ class FCOLLADA_EXPORT FCDControllerInstance : public FCDGeometryInstance /** Clones the controller instance. @param clone The controller instance to become the clone. - If this pointer is NULL, a new controller instance will be created + If this pointer is nullptr, a new controller instance will be created and you will need to release the returned pointer. @return The clone. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; /** Retrieves a list of all the root joint ids for the controller. @return List of parent Ids */ @@ -105,9 +105,9 @@ class FCOLLADA_EXPORT FCDControllerInstance : public FCDGeometryInstance /** Retrieves a specific joint. @param index The index of the joint. - @return The joint. This pointer will be NULL, if the index is out-of-bounds. */ - inline FCDSceneNode* GetJoint(size_t index) { FUAssert(index < GetJointCount(), return NULL); return joints.at(index); } - inline const FCDSceneNode* GetJoint(size_t index) const { FUAssert(index < GetJointCount(), return NULL); return joints.at(index); } /**< See above. */ + @return The joint. This pointer will be nullptr, if the index is out-of-bounds. */ + inline FCDSceneNode* GetJoint(size_t index) { FUAssert(index < GetJointCount(), return nullptr); return joints.at(index); } + inline const FCDSceneNode* GetJoint(size_t index) const { FUAssert(index < GetJointCount(), return nullptr); return joints.at(index); } /**< See above. */ /** Adds an existing joint to the list of controller joints. @param j A joint-typed scene node. */ diff --git a/FCollada/FCDocument/FCDEffect.cpp b/FCollada/FCDocument/FCDEffect.cpp index 9fe3c65..1d22140 100644 --- a/FCollada/FCDocument/FCDEffect.cpp +++ b/FCollada/FCDocument/FCDEffect.cpp @@ -56,7 +56,7 @@ const FCDEffectProfile* FCDEffect::FindProfile(FUDaeProfileType::Type type) cons { if ((*itR)->GetType() == type) return (*itR); } - return NULL; + return nullptr; } // Search for a profile of a given type and platform @@ -69,13 +69,13 @@ const FCDEffectProfile* FCDEffect::FindProfileByTypeAndPlatform(FUDaeProfileType if (((FCDEffectProfileFX*)(*itR))->GetPlatform() == TO_FSTRING(platform)) return (*itR); } } - return NULL; + return nullptr; } // Create a new effect profile. FCDEffectProfile* FCDEffect::AddProfile(FUDaeProfileType::Type type) { - FCDEffectProfile* profile = NULL; + FCDEffectProfile* profile = nullptr; // Create the correct profile for this type. if (type == FUDaeProfileType::COMMON) profile = new FCDEffectStandard(GetDocument(), this); @@ -93,13 +93,13 @@ FCDEffectProfile* FCDEffect::AddProfile(FUDaeProfileType::Type type) // Returns a copy of the effect, with all the animations/textures attached FCDEntity* FCDEffect::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDEffect* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffect(const_cast(GetDocument())); + FCDEffect* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffect(const_cast(GetDocument())); else if (_clone->HasType(FCDEffect::GetClassType())) clone = (FCDEffect*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the effect profiles for (const FCDEffectProfile** itR = profiles.begin(); itR != profiles.end(); ++itR) diff --git a/FCollada/FCDocument/FCDEffect.h b/FCollada/FCDocument/FCDEffect.h index 384db48..75bdd9c 100644 --- a/FCollada/FCDocument/FCDEffect.h +++ b/FCollada/FCDocument/FCDEffect.h @@ -77,9 +77,9 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity /** Retrieves a profile contained within the effect. @param index The index of the profile. - @return The profile. This pointer will be NULL, if the given index is out-of-bounds. */ - FCDEffectProfile* GetProfile(size_t index) { FUAssert(index < GetProfileCount(), return NULL); return profiles.at(index); } - const FCDEffectProfile* GetProfile(size_t index) const { FUAssert(index < GetProfileCount(), return NULL); return profiles.at(index); } /**< See above. */ + @return The profile. This pointer will be nullptr, if the given index is out-of-bounds. */ + FCDEffectProfile* GetProfile(size_t index) { FUAssert(index < GetProfileCount(), return nullptr); return profiles.at(index); } + const FCDEffectProfile* GetProfile(size_t index) const { FUAssert(index < GetProfileCount(), return nullptr); return profiles.at(index); } /**< See above. */ /** Retrieves the list of the profiles contained within the effect. @return The list of effect profiles. */ @@ -89,7 +89,7 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity There should only be one profile of each type within an effect. This function allows you to retrieve the profile for a given type. @param type The profile type. - @return The first profile of this type. This pointer will be NULL if the effect + @return The first profile of this type. This pointer will be nullptr if the effect does not have any profile of this type. */ const FCDEffectProfile* FindProfile(FUDaeProfileType::Type type) const; inline FCDEffectProfile* FindProfile(FUDaeProfileType::Type type) { return const_cast(const_cast(this)->FindProfile(type)); } /**< See above. */ @@ -99,7 +99,7 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity function allows you to retrieve the profile for a given type. @param type The profile type. @param platform The profile platform. - @return The profile of this type. This pointer will be NULL if the effect + @return The profile of this type. This pointer will be nullptr if the effect does not have any profile of this type. */ inline FCDEffectProfile* FindProfileByTypeAndPlatform(FUDaeProfileType::Type type, const fm::string& platform) { return const_cast(const_cast(this)->FindProfileByTypeAndPlatform(type, platform)); } const FCDEffectProfile* FindProfileByTypeAndPlatform(FUDaeProfileType::Type type, const fm::string& platform) const; /**< See above. */ @@ -107,7 +107,7 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity /** Retrieves whether the effect contains a profile of the given type. @param type The profile type. @return Whether the effect has a profile of this type. */ - inline bool HasProfile(FUDaeProfileType::Type type) const { return FindProfile(type) != NULL; } + inline bool HasProfile(FUDaeProfileType::Type type) const { return FindProfile(type) != nullptr; } /** Creates a profile of the given type. If a profile of this type already exists, it will be released, as @@ -123,8 +123,8 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity /** Retrieves a given local effect parameter. @param index An index. @return The local effect parameter at the given index. */ - inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } - inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } + inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } + inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } /** Adds a local effect parameter to the local list. @see FCDEffectParameter::Type @@ -134,11 +134,11 @@ class FCOLLADA_EXPORT FCDEffect : public FCDEntity /** Clones the effect object. @param clone The clone object into which to copy the effect information. - If this pointer is NULL, a new effect will be created and your will + If this pointer is nullptr, a new effect will be created and your will need to release the returned pointer. @param cloneChildren Whether to recursively clone this entity's children. @return The cloned effect object. You will must delete this pointer. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** [INTERNAL] Flattens the effect, pushing all the common effect parameters into to the effect technique level of abstraction. To correctly flatten a diff --git a/FCollada/FCDocument/FCDEffectCode.cpp b/FCollada/FCDocument/FCDEffectCode.cpp index 96d0793..496092b 100644 --- a/FCollada/FCDocument/FCDEffectCode.cpp +++ b/FCollada/FCDocument/FCDEffectCode.cpp @@ -40,7 +40,7 @@ void FCDEffectCode::SetFilename(const fstring& _filename) // Clone FCDEffectCode* FCDEffectCode::Clone(FCDEffectCode* clone) const { - if (clone == NULL) clone = new FCDEffectCode(const_cast(GetDocument())); + if (clone == nullptr) clone = new FCDEffectCode(const_cast(GetDocument())); clone->type = type; clone->sid = sid; clone->filename = filename; diff --git a/FCollada/FCDocument/FCDEffectCode.h b/FCollada/FCDocument/FCDEffectCode.h index e01d00f..cdc3e93 100644 --- a/FCollada/FCDocument/FCDEffectCode.h +++ b/FCollada/FCDocument/FCDEffectCode.h @@ -105,10 +105,10 @@ class FCOLLADA_EXPORT FCDEffectCode : public FCDObject /** Clones the code inclusion. @param clone The cloned code inclusion. - If this pointer is NULL, a new code inclusion is created and + If this pointer is nullptr, a new code inclusion is created and you will need to release this new code inclusion. - @return The cloned effect object. This pointer will never be NULL. */ - FCDEffectCode* Clone(FCDEffectCode* clone = NULL) const; + @return The cloned effect object. This pointer will never be nullptr. */ + FCDEffectCode* Clone(FCDEffectCode* clone = nullptr) const; }; #endif // _FCD_EFFECT_CODE_H_ diff --git a/FCollada/FCDocument/FCDEffectParameter.cpp b/FCollada/FCDocument/FCDEffectParameter.cpp index ab014f3..24a404d 100644 --- a/FCollada/FCDocument/FCDEffectParameter.cpp +++ b/FCollada/FCDocument/FCDEffectParameter.cpp @@ -63,17 +63,17 @@ void FCDEffectParameter::AddAnnotation(const fchar* name, FCDEffectParameter::Ty bool FCDEffectParameter::IsValueEqual(FCDEffectParameter* parameter) { - return (parameter != NULL && this->GetType() == parameter->GetType()); + return (parameter != nullptr && this->GetType() == parameter->GetType()); } // Clones the base parameter values FCDEffectParameter* FCDEffectParameter::Clone(FCDEffectParameter* clone) const { - if (clone == NULL) + if (clone == nullptr) { // Recursively call the cloning function in an attempt to clone the up-class parameters clone = FCDEffectParameterFactory::Create(const_cast(GetDocument()), GetType()); - return clone != NULL ? Clone(clone) : NULL; + return clone != nullptr ? Clone(clone) : nullptr; } else { diff --git a/FCollada/FCDocument/FCDEffectParameter.h b/FCollada/FCDocument/FCDEffectParameter.h index 54c4fd7..31c610f 100644 --- a/FCollada/FCDocument/FCDEffectParameter.h +++ b/FCollada/FCDocument/FCDEffectParameter.h @@ -173,10 +173,10 @@ class FCOLLADA_EXPORT FCDEffectParameter : public FCDObject /** Retrieves an annotation of this parameter. @param index The index of the annotation. - @return The annotation for the given index. This pointer will be NULL + @return The annotation for the given index. This pointer will be nullptr if the index is out-of-bounds. */ - inline FCDEffectParameterAnnotation* GetAnnotation(size_t index) { FUAssert(index < GetAnnotationCount(), return NULL); return annotations.at(index); } - inline const FCDEffectParameterAnnotation* GetAnnotation(size_t index) const { FUAssert(index < GetAnnotationCount(), return NULL); return annotations.at(index); } /**< See above. */ + inline FCDEffectParameterAnnotation* GetAnnotation(size_t index) { FUAssert(index < GetAnnotationCount(), return nullptr); return annotations.at(index); } + inline const FCDEffectParameterAnnotation* GetAnnotation(size_t index) const { FUAssert(index < GetAnnotationCount(), return nullptr); return annotations.at(index); } /**< See above. */ /** Adds a blank annotation to this parameter. @return The blank annotation. */ @@ -203,11 +203,11 @@ class FCOLLADA_EXPORT FCDEffectParameter : public FCDObject virtual bool IsValueEqual(FCDEffectParameter *parameter) = 0; /** Creates a full copy of the effect parameter. - @param clone The cloned effect parameter. If this pointer is NULL, + @param clone The cloned effect parameter. If this pointer is nullptr, a new effect parameter will be created and you will need to delete this pointer. @return The cloned effect parameter. */ - virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const; + virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = nullptr) const; /** [INTERNAL] Overwrites the target parameter with this parameter. This function is used during the flattening of materials. @@ -253,11 +253,11 @@ class FCOLLADA_EXPORT FCDEffectParameterT : public FCDEffectParameter virtual bool IsValueEqual(FCDEffectParameter *parameter); /** Creates a full copy of the effect parameter. - @param clone The cloned effect parameter. If this pointer is NULL, + @param clone The cloned effect parameter. If this pointer is nullptr, a new effect parameter will be created and you will need to delete this pointer. @return The cloned effect parameter. */ - virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const; + virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = nullptr) const; /** [INTERNAL] Overwrites the target parameter with this parameter. This function is used during the flattening of materials. @@ -325,11 +325,11 @@ class FCOLLADA_EXPORT FCDEffectParameterAnimatableT : public FCDEffectParameter virtual bool IsValueEqual(FCDEffectParameter *parameter); /** Creates a full copy of the effect parameter. - @param clone The cloned effect parameter. If this pointer is NULL, + @param clone The cloned effect parameter. If this pointer is nullptr, a new effect parameter will be created and you will need to delete this pointer. @return The cloned effect parameter. */ - virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const; + virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = nullptr) const; /** [INTERNAL] Overwrites the target parameter with this parameter. This function is used during the flattening of materials. diff --git a/FCollada/FCDocument/FCDEffectParameter.hpp b/FCollada/FCDocument/FCDEffectParameter.hpp index e0c284b..d78ca5c 100644 --- a/FCollada/FCDocument/FCDEffectParameter.hpp +++ b/FCollada/FCDocument/FCDEffectParameter.hpp @@ -26,12 +26,12 @@ bool FCDEffectParameterT::IsValueEqual(FCDEffectParameter* parame template FCDEffectParameter* FCDEffectParameterT::Clone(FCDEffectParameter* _clone) const { - FCDEffectParameterT* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffectParameterT(const_cast(GetDocument())); + FCDEffectParameterT* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffectParameterT(const_cast(GetDocument())); else if (_clone->HasType(FCDEffectParameterT::GetClassType())) clone = (FCDEffectParameterT*) _clone; - if (_clone != NULL) FCDEffectParameter::Clone(_clone); - if (clone != NULL) clone->value = *value; + if (_clone != nullptr) FCDEffectParameter::Clone(_clone); + if (clone != nullptr) clone->value = *value; return _clone; } @@ -68,12 +68,12 @@ bool FCDEffectParameterAnimatableT::IsValueEqual(FCDE template FCDEffectParameter* FCDEffectParameterAnimatableT::Clone(FCDEffectParameter* _clone) const { - FCDEffectParameterAnimatableT* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffectParameterAnimatableT(const_cast(GetDocument())); + FCDEffectParameterAnimatableT* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffectParameterAnimatableT(const_cast(GetDocument())); else if (_clone->HasType(FCDEffectParameterAnimatableT::GetClassType())) clone = (FCDEffectParameterAnimatableT*) _clone; - if (_clone != NULL) FCDEffectParameter::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameter::Clone(_clone); + if (clone != nullptr) { clone->floatType = floatType; clone->value = *value; diff --git a/FCollada/FCDocument/FCDEffectParameterFactory.cpp b/FCollada/FCDocument/FCDEffectParameterFactory.cpp index a8de813..1f5940a 100644 --- a/FCollada/FCDocument/FCDEffectParameterFactory.cpp +++ b/FCollada/FCDocument/FCDEffectParameterFactory.cpp @@ -15,7 +15,7 @@ // Creates a new effect parameter, given a type. FCDEffectParameter* FCDEffectParameterFactory::Create(FCDocument* document, uint32 type) { - FCDEffectParameter* parameter = NULL; + FCDEffectParameter* parameter = nullptr; switch (type) { diff --git a/FCollada/FCDocument/FCDEffectParameterSampler.cpp b/FCollada/FCDocument/FCDEffectParameterSampler.cpp index c6f07ce..ea035b3 100644 --- a/FCollada/FCDocument/FCDEffectParameterSampler.cpp +++ b/FCollada/FCDocument/FCDEffectParameterSampler.cpp @@ -55,8 +55,8 @@ bool FCDEffectParameterSampler::IsValueEqual(FCDEffectParameter* parameter) FCDEffectParameterSampler *param = (FCDEffectParameterSampler*)parameter; if (GetSamplerType() != param->GetSamplerType()) return false; - if (param->GetSurface() == NULL && surface == NULL) {} - else if (param->GetSurface() == NULL || surface == NULL) return false; + if (param->GetSurface() == nullptr && surface == nullptr) {} + else if (param->GetSurface() == nullptr || surface == nullptr) return false; else if (!IsEquivalent(param->GetSurface()->GetReference(), surface->GetReference())) return false; return true; @@ -65,12 +65,12 @@ bool FCDEffectParameterSampler::IsValueEqual(FCDEffectParameter* parameter) // Clone FCDEffectParameter* FCDEffectParameterSampler::Clone(FCDEffectParameter* _clone) const { - FCDEffectParameterSampler* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffectParameterSampler(const_cast(GetDocument())); + FCDEffectParameterSampler* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffectParameterSampler(const_cast(GetDocument())); else if (_clone->GetObjectType() == FCDEffectParameterSampler::GetClassType()) clone = (FCDEffectParameterSampler*) _clone; - if (_clone != NULL) FCDEffectParameter::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameter::Clone(_clone); + if (clone != nullptr) { clone->surface = const_cast((const FCDEffectParameterSurface*)(surface)); clone->samplerType = samplerType; diff --git a/FCollada/FCDocument/FCDEffectParameterSampler.h b/FCollada/FCDocument/FCDEffectParameterSampler.h index b982c96..f995a0d 100644 --- a/FCollada/FCDocument/FCDEffectParameterSampler.h +++ b/FCollada/FCDocument/FCDEffectParameterSampler.h @@ -72,13 +72,13 @@ class FCOLLADA_EXPORT FCDEffectParameterSampler : public FCDEffectParameter virtual Type GetType() const { return SAMPLER; } /** Retrieves the parameter for the surface to sample. - @return The surface parameter. This pointer will be NULL if the sampler is + @return The surface parameter. This pointer will be nullptr if the sampler is not yet linked to any surface.. */ FCDEffectParameterSurface* GetSurface() { return surface; } const FCDEffectParameterSurface* GetSurface() const { return surface; } /**< See above. */ /** Sets the surface parameter for the surface to sample. - @param surface The surface parameter. This pointer may be NULL + @param surface The surface parameter. This pointer may be nullptr to unlink the sampler. */ void SetSurface(FCDEffectParameterSurface* surface); @@ -122,11 +122,11 @@ class FCOLLADA_EXPORT FCDEffectParameterSampler : public FCDEffectParameter virtual bool IsValueEqual(FCDEffectParameter *parameter); /** Creates a full copy of the effect parameter. - @param clone The cloned effect parameter. If this pointer is NULL, + @param clone The cloned effect parameter. If this pointer is nullptr, a new effect parameter will be created and you will need to delete this pointer. @return The cloned effect parameter. */ - virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const; + virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = nullptr) const; /** [INTERNAL] Overwrites the target parameter with this parameter. This function is used during the flattening of materials. diff --git a/FCollada/FCDocument/FCDEffectParameterSurface.cpp b/FCollada/FCDocument/FCDEffectParameterSurface.cpp index 11d201c..85694e0 100644 --- a/FCollada/FCDocument/FCDEffectParameterSurface.cpp +++ b/FCollada/FCDocument/FCDEffectParameterSurface.cpp @@ -26,9 +26,9 @@ ImplementParameterObjectNoCtr(FCDEffectParameterSurface, FCDImage, images) FCDEffectParameterSurface::FCDEffectParameterSurface(FCDocument* document) : FCDEffectParameter(document) , InitializeParameterNoArg(images) -, initMethod(NULL) +, initMethod(nullptr) , format("A8R8G8B8") -, formatHint(NULL) +, formatHint(nullptr) , size(FMVector3::Zero) , viewportRatio(1.0f) , mipLevelCount(0) @@ -88,7 +88,7 @@ void FCDEffectParameterSurface::RemoveImage(FCDImage* image) { images.erase(index); - if (initMethod != NULL && initMethod->GetInitType() == FCDEffectParameterSurfaceInitFactory::CUBE) + if (initMethod != nullptr && initMethod->GetInitType() == FCDEffectParameterSurfaceInitFactory::CUBE) { // Shift down all the indexes found within the cube map initialization. FCDEffectParameterSurfaceInitCube* cube = (FCDEffectParameterSurfaceInitCube*) initMethod; @@ -119,7 +119,7 @@ bool FCDEffectParameterSurface::IsValueEqual(FCDEffectParameter *parameter) } // compare initialisation methods - if (initMethod != NULL && param->GetInitMethod() != NULL) + if (initMethod != nullptr && param->GetInitMethod() != nullptr) { if (initMethod->GetInitType() != param->GetInitMethod()->GetInitType()) return false; } @@ -141,12 +141,12 @@ bool FCDEffectParameterSurface::IsValueEqual(FCDEffectParameter *parameter) // Clone FCDEffectParameter* FCDEffectParameterSurface::Clone(FCDEffectParameter* _clone) const { - FCDEffectParameterSurface* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffectParameterSurface(const_cast(GetDocument())); + FCDEffectParameterSurface* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffectParameterSurface(const_cast(GetDocument())); else if (_clone->GetObjectType() == FCDEffectParameterSurface::GetClassType()) clone = (FCDEffectParameterSurface*) _clone; - if (_clone != NULL) FCDEffectParameter::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameter::Clone(_clone); + if (clone != nullptr) { clone->images.reserve(images.size()); for (const FCDImage** itI = images.begin(); itI != images.end(); ++itI) @@ -154,7 +154,7 @@ FCDEffectParameter* FCDEffectParameterSurface::Clone(FCDEffectParameter* _clone) clone->AddImage(const_cast(*itI)); } - if (initMethod != NULL) + if (initMethod != nullptr) { clone->initMethod = FCDEffectParameterSurfaceInitFactory::Create(initMethod->GetInitType()); initMethod->Clone(clone->initMethod); @@ -166,7 +166,7 @@ FCDEffectParameter* FCDEffectParameterSurface::Clone(FCDEffectParameter* _clone) clone->generateMipmaps = generateMipmaps; clone->format = format; - if (formatHint != NULL) + if (formatHint != nullptr) { FCDFormatHint* cloneHint = clone->AddFormatHint(); cloneHint->channels = formatHint->channels; @@ -199,16 +199,16 @@ void FCDEffectParameterSurface::Overwrite(FCDEffectParameter* target) FCDFormatHint* FCDEffectParameterSurface::AddFormatHint() { - if (formatHint == NULL) formatHint = new FCDFormatHint(); + if (formatHint == nullptr) formatHint = new FCDFormatHint(); return formatHint; } FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInit::Clone(FCDEffectParameterSurfaceInit* clone) const { - if (clone == NULL) + if (clone == nullptr) { clone = FCDEffectParameterSurfaceInitFactory::Create(GetInitType()); - return clone != NULL ? Clone(clone) : NULL; + return clone != nullptr ? Clone(clone) : nullptr; } else { @@ -228,12 +228,12 @@ FCDEffectParameterSurfaceInitCube::FCDEffectParameterSurfaceInitCube() FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitCube::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitCube* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitCube(); + FCDEffectParameterSurfaceInitCube* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitCube(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitCube*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { clone->cubeType = cubeType; } @@ -246,12 +246,12 @@ FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitCube::Clone(FCDEffec FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitFrom::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitFrom* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitFrom(); + FCDEffectParameterSurfaceInitFrom* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitFrom(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitFrom*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { clone->face = face; clone->mip = mip; @@ -271,12 +271,12 @@ FCDEffectParameterSurfaceInitVolume::FCDEffectParameterSurfaceInitVolume() FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitVolume::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitVolume* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitVolume(); + FCDEffectParameterSurfaceInitVolume* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitVolume(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitVolume*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { clone->volumeType = volumeType; } @@ -289,12 +289,12 @@ FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitVolume::Clone(FCDEff FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitAsNull::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitAsNull* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitAsNull(); + FCDEffectParameterSurfaceInitAsNull* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitAsNull(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitAsNull*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { // Nothing to clone. } @@ -307,12 +307,12 @@ FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitAsNull::Clone(FCDEff FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitAsTarget::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitAsTarget* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitAsTarget(); + FCDEffectParameterSurfaceInitAsTarget* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitAsTarget(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitAsTarget*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { // Nothing to clone. } @@ -325,12 +325,12 @@ FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitAsTarget::Clone(FCDE FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitPlanar::Clone(FCDEffectParameterSurfaceInit* _clone) const { - FCDEffectParameterSurfaceInitPlanar* clone = NULL; - if (_clone == NULL) clone = new FCDEffectParameterSurfaceInitPlanar(); + FCDEffectParameterSurfaceInitPlanar* clone = nullptr; + if (_clone == nullptr) clone = new FCDEffectParameterSurfaceInitPlanar(); else if (_clone->GetInitType() == GetInitType()) clone = (FCDEffectParameterSurfaceInitPlanar*) _clone; - if (_clone != NULL) FCDEffectParameterSurfaceInit::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectParameterSurfaceInit::Clone(_clone); + if (clone != nullptr) { // Nothing to clone. } @@ -343,12 +343,12 @@ FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitPlanar::Clone(FCDEff FCDEffectParameterSurfaceInit* FCDEffectParameterSurfaceInitFactory::Create(InitType type) { - FCDEffectParameterSurfaceInit* parameter = NULL; + FCDEffectParameterSurfaceInit* parameter = nullptr; switch (type) { case FCDEffectParameterSurfaceInitFactory::AS_NULL: parameter = new FCDEffectParameterSurfaceInitAsNull(); break; - case FCDEffectParameterSurfaceInitFactory::AS_TARGET: parameter = new FCDEffectParameterSurfaceInitAsTarget(); break; + case FCDEffectParameterSurfaceInitFactory::AS_TARGET: parameter = new FCDEffectParameterSurfaceInitAsTarget(); break; case FCDEffectParameterSurfaceInitFactory::CUBE: parameter = new FCDEffectParameterSurfaceInitCube(); break; case FCDEffectParameterSurfaceInitFactory::FROM: parameter = new FCDEffectParameterSurfaceInitFrom(); break; case FCDEffectParameterSurfaceInitFactory::PLANAR: parameter = new FCDEffectParameterSurfaceInitPlanar(); break; diff --git a/FCollada/FCDocument/FCDEffectParameterSurface.h b/FCollada/FCDocument/FCDEffectParameterSurface.h index bc88ce7..8583926 100644 --- a/FCollada/FCDocument/FCDEffectParameterSurface.h +++ b/FCollada/FCDocument/FCDEffectParameterSurface.h @@ -86,7 +86,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurface : public FCDEffectParameter The initialization method is a powerful method of describing how to build complex textures, such as cube maps, from one or multiple image files. - @return The surface initialization method. This pointer will be NULL, + @return The surface initialization method. This pointer will be nullptr, if no initialization method is provided. */ FCDEffectParameterSurfaceInit* GetInitMethod() { return initMethod; } const FCDEffectParameterSurfaceInit* GetInitMethod() const { return initMethod; } /**< See above. */ @@ -115,9 +115,9 @@ class FCOLLADA_EXPORT FCDEffectParameterSurface : public FCDEffectParameter /** Retrieves a specific image. @param index The index of the image. - @return The image. This pointer will be NULL if the index is out-of-bounds. */ - FCDImage* GetImage(size_t index = 0) { return index < images.size() ? images.at(index) : NULL; } - const FCDImage* GetImage(size_t index = 0) const { return index < images.size() ? images.at(index) : NULL; } /**< See above. */ + @return The image. This pointer will be nullptr if the index is out-of-bounds. */ + FCDImage* GetImage(size_t index = 0) { return index < images.size() ? images.at(index) : nullptr; } + const FCDImage* GetImage(size_t index = 0) const { return index < images.size() ? images.at(index) : nullptr; } /**< See above. */ /** Retrieves the index that matches the given image. @param image The image to match. @@ -203,11 +203,11 @@ class FCOLLADA_EXPORT FCDEffectParameterSurface : public FCDEffectParameter virtual bool IsValueEqual(FCDEffectParameter *parameter); /** Creates a full copy of the effect parameter. - @param clone The cloned effect parameter. If this pointer is NULL, + @param clone The cloned effect parameter. If this pointer is nullptr, a new effect parameter will be created and you will need to delete this pointer. @return The cloned effect parameter. */ - virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const; + virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = nullptr) const; /** [INTERNAL] Overwrites the target parameter with this parameter. This function is used during the flattening of materials. @@ -223,7 +223,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurface : public FCDEffectParameter FCDFormatHint* AddFormatHint(); /** Retrieves the format hint of the surface parameter. - @return The format hint of the parameter. If this pointer is NULL, + @return The format hint of the parameter. If this pointer is nullptr, no format hint is provided. */ inline FCDFormatHint* GetFormatHint() { return formatHint; } inline const FCDFormatHint* GetFormatHint() const { return formatHint; } @@ -316,7 +316,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitCube : public FCDEffectParame virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::CUBE;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The cloned surface initialization. */ @@ -359,7 +359,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitVolume : public FCDEffectPara virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::VOLUME;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The cloned surface initialization. */ @@ -389,7 +389,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitFrom : public FCDEffectParame virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::FROM;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The cloned surface initialization. */ @@ -424,7 +424,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitAsNull : public FCDEffectPara virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::AS_NULL;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The cloned surface initialization. */ @@ -450,7 +450,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitAsTarget : public FCDEffectPa virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::AS_TARGET;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The surface initialization parameter. You will need to delete this pointer. */ @@ -476,7 +476,7 @@ class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitPlanar : public FCDEffectPara virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::PLANAR;} /** Creates a full copy of the surface initialization parameter. - @param clone The cloned surface initialization. If this pointer is NULL, + @param clone The cloned surface initialization. If this pointer is nullptr, a new surface initialization parameter will be created and you will need to delete this pointer. @return The cloned surface initialization. */ diff --git a/FCollada/FCDocument/FCDEffectPass.cpp b/FCollada/FCDocument/FCDEffectPass.cpp index 85f5a74..85988c1 100644 --- a/FCollada/FCDocument/FCDEffectPass.cpp +++ b/FCollada/FCDocument/FCDEffectPass.cpp @@ -32,7 +32,7 @@ FCDEffectPass::FCDEffectPass(FCDocument* document, FCDEffectTechnique *_parent) FCDEffectPass::~FCDEffectPass() { - parent = NULL; + parent = nullptr; } // Adds a new shader to the pass. @@ -49,7 +49,7 @@ FCDEffectPassShader* FCDEffectPass::AddShader() FCDEffectPassShader* FCDEffectPass::AddVertexShader() { FCDEffectPassShader* vertexShader; - for (vertexShader = GetVertexShader(); vertexShader != NULL; vertexShader = GetVertexShader()) + for (vertexShader = GetVertexShader(); vertexShader != nullptr; vertexShader = GetVertexShader()) { SAFE_RELEASE(vertexShader); } @@ -65,7 +65,7 @@ FCDEffectPassShader* FCDEffectPass::AddVertexShader() FCDEffectPassShader* FCDEffectPass::AddFragmentShader() { FCDEffectPassShader* fragmentShader; - for (fragmentShader = GetFragmentShader(); fragmentShader != NULL; fragmentShader = GetFragmentShader()) + for (fragmentShader = GetFragmentShader(); fragmentShader != nullptr; fragmentShader = GetFragmentShader()) { SAFE_RELEASE(fragmentShader); } @@ -78,7 +78,7 @@ FCDEffectPassShader* FCDEffectPass::AddFragmentShader() FCDEffectPass* FCDEffectPass::Clone(FCDEffectPass* clone) const { - if (clone == NULL) clone = new FCDEffectPass(const_cast(GetDocument()), parent); + if (clone == nullptr) clone = new FCDEffectPass(const_cast(GetDocument()), parent); clone->name = name; @@ -108,7 +108,7 @@ const FCDEffectPassShader* FCDEffectPass::GetVertexShader() const { if ((*itS)->IsVertexShader()) return (*itS); } - return NULL; + return nullptr; } const FCDEffectPassShader* FCDEffectPass::GetFragmentShader() const @@ -117,7 +117,7 @@ const FCDEffectPassShader* FCDEffectPass::GetFragmentShader() const { if ((*itS)->IsFragmentShader()) return (*itS); } - return NULL; + return nullptr; } FCDEffectPassState* FCDEffectPass::AddRenderState(FUDaePassState::State type) @@ -143,5 +143,5 @@ const FCDEffectPassState* FCDEffectPass::FindRenderState(FUDaePassState::State t { if ((*itS)->GetType() == type) return (*itS); } - return NULL; + return nullptr; } diff --git a/FCollada/FCDocument/FCDEffectPass.h b/FCollada/FCDocument/FCDEffectPass.h index 9b55ae1..6513f58 100644 --- a/FCollada/FCDocument/FCDEffectPass.h +++ b/FCollada/FCDocument/FCDEffectPass.h @@ -85,9 +85,9 @@ class FCOLLADA_EXPORT FCDEffectPass : public FCDObject /** Retrieves a specific shader. @param index The index of the shader. - @return The shader. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDEffectPassShader* GetShader(size_t index) { FUAssert(index < GetShaderCount(), return NULL); return shaders.at(index); } - inline const FCDEffectPassShader* GetShader(size_t index) const { FUAssert(index < GetShaderCount(), return NULL); return shaders.at(index); } /**< See above. */ + @return The shader. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDEffectPassShader* GetShader(size_t index) { FUAssert(index < GetShaderCount(), return nullptr); return shaders.at(index); } + inline const FCDEffectPassShader* GetShader(size_t index) const { FUAssert(index < GetShaderCount(), return nullptr); return shaders.at(index); } /**< See above. */ /** Adds a new shader to the pass. @return The new shader. */ @@ -98,13 +98,13 @@ class FCOLLADA_EXPORT FCDEffectPass : public FCDObject DEPRECATED(3.05A, shader->Release()) void ReleaseShader(FCDEffectPassShader* shader) { ((FCDObject*)shader)->Release(); } /** Retrieves the vertex shader for this effect pass. - @return The vertex shader. This pointer will be NULL if no + @return The vertex shader. This pointer will be nullptr if no shader within the pass affects vertices. */ inline FCDEffectPassShader* GetVertexShader() { return const_cast(const_cast(this)->GetVertexShader()); } const FCDEffectPassShader* GetVertexShader() const; /**< See above. */ /** Retrieves the fragment shader for this effect pass. - @return The fragment shader. This pointer will be NULL if no + @return The fragment shader. This pointer will be nullptr if no shader within the pass affects pixels/fragments. */ inline FCDEffectPassShader* GetFragmentShader() { return const_cast(const_cast(this)->GetFragmentShader()); } const FCDEffectPassShader* GetFragmentShader() const; /**< See above. */ @@ -130,8 +130,8 @@ class FCOLLADA_EXPORT FCDEffectPass : public FCDObject /** Retrieves a specific render state defined for the pass. @param index The index of the render state. @return The render state at the given index. */ - inline FCDEffectPassState* GetRenderState(size_t index) { FUAssert(index < states.size(), return NULL); return states.at(index); } - inline const FCDEffectPassState* GetRenderState(size_t index) const { FUAssert(index < states.size(), return NULL); return states.at(index); } /**< See above. */ + inline FCDEffectPassState* GetRenderState(size_t index) { FUAssert(index < states.size(), return nullptr); return states.at(index); } + inline const FCDEffectPassState* GetRenderState(size_t index) const { FUAssert(index < states.size(), return nullptr); return states.at(index); } /**< See above. */ /** Adds a new render state to the effect pass. Render states automatically get sorted by type. @@ -143,17 +143,17 @@ class FCOLLADA_EXPORT FCDEffectPass : public FCDObject /** Retrieves a specific render state defined for the pass. @param type The type of the render state to retrieve. - @return The render state with the given type. This pointer will be NULL + @return The render state with the given type. This pointer will be nullptr if no render state has been defined for the given type. */ inline FCDEffectPassState* FindRenderState(FUDaePassState::State type) { return const_cast(const_cast(this)->FindRenderState(type)); } const FCDEffectPassState* FindRenderState(FUDaePassState::State type) const; /**< See above. */ /** Clones the effect pass and shaders. @param clone The cloned pass. - If this pointer is NULL, a new pass is created and + If this pointer is nullptr, a new pass is created and you will need to release this new pass. @return The cloned pass. */ - FCDEffectPass* Clone(FCDEffectPass* clone = NULL) const; + FCDEffectPass* Clone(FCDEffectPass* clone = nullptr) const; }; #endif diff --git a/FCollada/FCDocument/FCDEffectPassShader.cpp b/FCollada/FCDocument/FCDEffectPassShader.cpp index 7f0e87b..a974528 100644 --- a/FCollada/FCDocument/FCDEffectPassShader.cpp +++ b/FCollada/FCDocument/FCDEffectPassShader.cpp @@ -48,8 +48,8 @@ FCDEffectPassShader::FCDEffectPassShader(FCDocument* document, FCDEffectPass* _p FCDEffectPassShader::~FCDEffectPassShader() { - parent = NULL; - code = NULL; + parent = nullptr; + code = nullptr; } // Retrieve the shader binding, given a COLLADA parameter reference. @@ -59,7 +59,7 @@ const FCDEffectPassBind* FCDEffectPassShader::FindBindingReference(const char* r { if (IsEquivalent((*it)->reference, reference)) return (*it); } - return NULL; + return nullptr; } const FCDEffectPassBind* FCDEffectPassShader::FindBindingSymbol(const char* symbol) const @@ -68,7 +68,7 @@ const FCDEffectPassBind* FCDEffectPassShader::FindBindingSymbol(const char* symb { if (IsEquivalent((*it)->symbol, symbol)) return (*it); } - return NULL; + return nullptr; } // Adds a new binding to this shader. @@ -82,7 +82,7 @@ FCDEffectPassBind* FCDEffectPassShader::AddBinding() // Cloning FCDEffectPassShader* FCDEffectPassShader::Clone(FCDEffectPassShader* clone) const { - if (clone == NULL) clone = new FCDEffectPassShader(const_cast(GetDocument()), parent); + if (clone == nullptr) clone = new FCDEffectPassShader(const_cast(GetDocument()), parent); clone->isFragment = isFragment; size_t bindingCount = bindings.size(); @@ -97,10 +97,10 @@ FCDEffectPassShader* FCDEffectPassShader::Clone(FCDEffectPassShader* clone) cons clone->name = name; // Look for the new code within the parent. - if (code != NULL) + if (code != nullptr) { clone->code = clone->parent->GetParent()->FindCode(code->GetSubId()); - if (clone->code == NULL) clone->code = clone->parent->GetParent()->GetParent()->FindCode(code->GetSubId()); + if (clone->code == nullptr) clone->code = clone->parent->GetParent()->GetParent()->FindCode(code->GetSubId()); } return clone; } diff --git a/FCollada/FCDocument/FCDEffectPassShader.h b/FCollada/FCDocument/FCDEffectPassShader.h index c7c68ef..3ae1f12 100644 --- a/FCollada/FCDocument/FCDEffectPassShader.h +++ b/FCollada/FCDocument/FCDEffectPassShader.h @@ -106,20 +106,20 @@ class FCOLLADA_EXPORT FCDEffectPassShader : public FCDObject /** Retrieves a binding contained in this shader. @param index The index of the binding. - @return The binding. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDEffectPassBind* GetBinding(size_t index) { FUAssert(index < GetBindingCount(), return NULL); return bindings.at(index); } - inline const FCDEffectPassBind* GetBinding(size_t index) const { FUAssert(index < GetBindingCount(), return NULL); return bindings.at(index); } /**< See above. */ + @return The binding. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDEffectPassBind* GetBinding(size_t index) { FUAssert(index < GetBindingCount(), return nullptr); return bindings.at(index); } + inline const FCDEffectPassBind* GetBinding(size_t index) const { FUAssert(index < GetBindingCount(), return nullptr); return bindings.at(index); } /**< See above. */ /** Retrieves a binding for a given COLLADA reference. @param reference The reference of the parameter binding. - @return The binding. This pointer will be NULL if + @return The binding. This pointer will be nullptr if the parameter is not bound in this shader. */ const FCDEffectPassBind* FindBindingReference(const char* reference) const; inline FCDEffectPassBind* FindBindingReference(const char* reference) { return const_cast(const_cast(this)->FindBindingReference(reference)); } /**< See above. */ /** Retrieves a binding for a given FX symbol. @param symbol The symbol of the parameter binding. - @return The binding. This pointer will be NULL if + @return The binding. This pointer will be nullptr if the parameter is not bound in this shader. */ const FCDEffectPassBind* FindBindingSymbol(const char* symbol) const; inline FCDEffectPassBind* FindBindingSymbol(const char* symbol) { return const_cast(const_cast(this)->FindBindingSymbol(symbol)); } /**< See above. */ @@ -161,18 +161,18 @@ class FCOLLADA_EXPORT FCDEffectPassShader : public FCDObject inline void SetName(const char* _name) { name = _name; SetDirtyFlag(); } /** Retrieves the code inclusion that contains the code for this shader. - @return The code inclusion. This pointer will be NULL if this shader + @return The code inclusion. This pointer will be nullptr if this shader is not yet attached to any code. */ inline FCDEffectCode* GetCode() { return code; } inline const FCDEffectCode* GetCode() const { return code; } /**< See above. */ /** Sets the code inclusion that contains the code for this shader. - @param _code The code inclusion. This pointer will be NULL to detach + @param _code The code inclusion. This pointer will be nullptr to detach a shader from its code. */ inline void SetCode(FCDEffectCode* _code) { code = _code; SetDirtyFlag(); } /** Clones this shader. - @param clone The cloned shader. If this pointer is NULL, + @param clone The cloned shader. If this pointer is nullptr, a new shader is created and you will need to release this new shader. @return The cloned shader. */ FCDEffectPassShader* Clone(FCDEffectPassShader* clone) const; diff --git a/FCollada/FCDocument/FCDEffectPassState.cpp b/FCollada/FCDocument/FCDEffectPassState.cpp index c8fa080..96a8571 100644 --- a/FCollada/FCDocument/FCDEffectPassState.cpp +++ b/FCollada/FCDocument/FCDEffectPassState.cpp @@ -38,7 +38,7 @@ ImplementObjectType(FCDEffectPassState) FCDEffectPassState::FCDEffectPassState(FCDocument* document, FUDaePassState::State renderState) : FCDObject(document) , InitializeParameter(type, renderState) -, data(NULL), dataSize(0) +, data(nullptr), dataSize(0) { // Use the translation table to figure out the necessary memory to hold the data. if (renderState >= 0 && renderState < FUDaePassState::COUNT) dataSize = dataSizeTable[type]; @@ -371,13 +371,13 @@ FCDEffectPassState::~FCDEffectPassState() FCDEffectPassState* FCDEffectPassState::Clone(FCDEffectPassState* clone) const { - if (clone == NULL) + if (clone == nullptr) { clone = new FCDEffectPassState(const_cast(GetDocument()), GetType()); } // The clone's data array should have been allocated properly. - FUAssert(dataSize == clone->dataSize, return NULL); + FUAssert(dataSize == clone->dataSize, return nullptr); memcpy(clone->data, data, dataSize); return clone; } diff --git a/FCollada/FCDocument/FCDEffectPassState.h b/FCollada/FCDocument/FCDEffectPassState.h index 81e1cf1..54599e9 100644 --- a/FCollada/FCDocument/FCDEffectPassState.h +++ b/FCollada/FCDocument/FCDEffectPassState.h @@ -75,10 +75,10 @@ class FCOLLADA_EXPORT FCDEffectPassState : public FCDObject /** Clones the effect pass and shaders. @param clone The cloned pass. - If this pointer is NULL, a new pass is created and + If this pointer is nullptr, a new pass is created and you will need to release this new pass. @return The cloned pass. */ - FCDEffectPassState* Clone(FCDEffectPassState* clone = NULL) const; + FCDEffectPassState* Clone(FCDEffectPassState* clone = nullptr) const; }; #endif // _FCD_EFFECT_PASS_STATE_H_ diff --git a/FCollada/FCDocument/FCDEffectProfile.cpp b/FCollada/FCDocument/FCDEffectProfile.cpp index ee9389d..02efab4 100644 --- a/FCollada/FCDocument/FCDEffectProfile.cpp +++ b/FCollada/FCDocument/FCDEffectProfile.cpp @@ -34,12 +34,12 @@ FCDEffectProfile::FCDEffectProfile(FCDocument* document, FCDEffect* _parent) FCDEffectProfile::~FCDEffectProfile() { - parent = NULL; + parent = nullptr; } FCDEffectProfile* FCDEffectProfile::Clone(FCDEffectProfile* clone) const { - if (clone == NULL) return NULL; + if (clone == nullptr) return nullptr; size_t parameterCount = parameters.size(); for (size_t p = 0; p < parameterCount; ++p) { diff --git a/FCollada/FCDocument/FCDEffectProfile.h b/FCollada/FCDocument/FCDEffectProfile.h index f620908..7079dfc 100644 --- a/FCollada/FCDocument/FCDEffectProfile.h +++ b/FCollada/FCDocument/FCDEffectProfile.h @@ -64,7 +64,7 @@ class FCOLLADA_EXPORT FCDEffectProfile : public FCDObject /** Retrieves the parent effect. This is the effect which contains this profile. - @return The parent effect. This pointer will never be NULL. */ + @return The parent effect. This pointer will never be nullptr. */ FCDEffect* GetParent() { return parent; } const FCDEffect* GetParent() const { return parent; } /**< See above. */ @@ -82,11 +82,11 @@ class FCOLLADA_EXPORT FCDEffectProfile : public FCDObject /** Clones the profile effect and its parameters. @param clone The cloned profile. - If this pointer is NULL, a new profile is created and + If this pointer is nullptr, a new profile is created and you will need to release this new profile. - @return The cloned profile. This pointer will be NULL if the + @return The cloned profile. This pointer will be nullptr if the abstract class' cloning function is used without a given clone. */ - virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = NULL) const; + virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = nullptr) const; /** Retrieves the number of local effect parameters @return The number of local effect parameters. */ @@ -95,8 +95,8 @@ class FCOLLADA_EXPORT FCDEffectProfile : public FCDObject /** Retrieves a given local effect parameter. @param index An index. @return The local effect parameter at the given index. */ - inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } - inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } + inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } + inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } /** Adds a local effect parameter to the local list. @see FCDEffectParameter::Type diff --git a/FCollada/FCDocument/FCDEffectProfileFX.cpp b/FCollada/FCDocument/FCDEffectProfileFX.cpp index c474bfe..bbc0b5f 100644 --- a/FCollada/FCDocument/FCDEffectProfileFX.cpp +++ b/FCollada/FCDocument/FCDEffectProfileFX.cpp @@ -59,7 +59,7 @@ const FCDEffectCode* FCDEffectProfileFX::FindCode(const char* sid) const { if ((*itC)->GetSubId() == sid) return (*itC); } - return NULL; + return nullptr; } // Adds a new code inclusion to this effect profile. @@ -74,12 +74,12 @@ FCDEffectCode* FCDEffectProfileFX::AddCode() // Clone the profile effect and its parameters FCDEffectProfile* FCDEffectProfileFX::Clone(FCDEffectProfile* _clone) const { - FCDEffectProfileFX* clone = NULL; - if (_clone == NULL) { _clone = clone = new FCDEffectProfileFX(const_cast(GetDocument()), const_cast(GetParent())); } + FCDEffectProfileFX* clone = nullptr; + if (_clone == nullptr) { _clone = clone = new FCDEffectProfileFX(const_cast(GetDocument()), const_cast(GetParent())); } else if (_clone->GetObjectType() == FCDEffectProfileFX::GetClassType()) clone = (FCDEffectProfileFX*) _clone; - if (_clone != NULL) FCDEffectProfile::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectProfile::Clone(_clone); + if (clone != nullptr) { clone->type = type; diff --git a/FCollada/FCDocument/FCDEffectProfileFX.h b/FCollada/FCDocument/FCDEffectProfileFX.h index d8b6103..ab62fee 100644 --- a/FCollada/FCDocument/FCDEffectProfileFX.h +++ b/FCollada/FCDocument/FCDEffectProfileFX.h @@ -106,9 +106,9 @@ class FCOLLADA_EXPORT FCDEffectProfileFX : public FCDEffectProfile You may want to check the FCDEffectMaterialTechniqueHint objects at the FCDMaterial level, in order to determine which technique(s) to use for your platform. @param index The index of the technique. - @return The inner technique. This pointer will be NULL if the index is out-of-bounds. */ - FCDEffectTechnique* GetTechnique(size_t index) { FUAssert(index < GetTechniqueCount(), return NULL); return techniques.at(index); } - const FCDEffectTechnique* GetTechnique(size_t index) const { FUAssert(index < GetTechniqueCount(), return NULL); return techniques.at(index); } /**< See above. */ + @return The inner technique. This pointer will be nullptr if the index is out-of-bounds. */ + FCDEffectTechnique* GetTechnique(size_t index) { FUAssert(index < GetTechniqueCount(), return nullptr); return techniques.at(index); } + const FCDEffectTechnique* GetTechnique(size_t index) const { FUAssert(index < GetTechniqueCount(), return nullptr); return techniques.at(index); } /**< See above. */ /** Adds a new technique to this effect profile. @return The new technique object. */ @@ -124,13 +124,13 @@ class FCOLLADA_EXPORT FCDEffectProfileFX : public FCDEffectProfile /** Retrieves a code inclusion contained within the effect profile. @param index The index of the code inclusion. - @return The code inclusion. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDEffectCode* GetCode(size_t index) { FUAssert(index < GetCodeCount(), return NULL); return codes.at(index); } - inline const FCDEffectCode* GetCode(size_t index) const { FUAssert(index < GetCodeCount(), return NULL); return codes.at(index); } /**< See above. */ + @return The code inclusion. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDEffectCode* GetCode(size_t index) { FUAssert(index < GetCodeCount(), return nullptr); return codes.at(index); } + inline const FCDEffectCode* GetCode(size_t index) const { FUAssert(index < GetCodeCount(), return nullptr); return codes.at(index); } /**< See above. */ /** Retrieves the code inclusion with the given sub-id. @param sid A COLLADA sub-id. - @return The code inclusion with the given sub-id. This pointer will be NULL, + @return The code inclusion with the given sub-id. This pointer will be nullptr, if there are no code inclusions that match the given sub-id. */ inline FCDEffectCode* FindCode(const char* sid) { return const_cast(const_cast(this)->FindCode(sid)); } const FCDEffectCode* FindCode(const char* sid) const; /**< See above. */ @@ -141,10 +141,10 @@ class FCOLLADA_EXPORT FCDEffectProfileFX : public FCDEffectProfile /** Clones the full effect profile. @param clone The cloned profile. - If this pointer is NULL, a new profile is created and + If this pointer is nullptr, a new profile is created and you will need to release this new profile. - @return The cloned profile. This pointer will never be NULL. */ - virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = NULL) const; + @return The cloned profile. This pointer will never be nullptr. */ + virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = nullptr) const; /** [INTERNAL] Flattens this effect profile. Pushes all the effect parameter overrides into the effect parameter generators and moves all the parameters to the diff --git a/FCollada/FCDocument/FCDEffectStandard.cpp b/FCollada/FCDocument/FCDEffectStandard.cpp index 1d497c4..3eea75f 100644 --- a/FCollada/FCDocument/FCDEffectStandard.cpp +++ b/FCollada/FCDocument/FCDEffectStandard.cpp @@ -217,7 +217,7 @@ FCDTexture* FCDEffectStandard::AddTexture(uint32 bucket) case FUDaeTextureChannel::UNKNOWN: default: - FUFail(texture->Release(); return NULL); + FUFail(texture->Release(); return nullptr); } SetNewChildFlag(); return texture; @@ -241,12 +241,12 @@ float FCDEffectStandard::GetReflectivity() const // Clone the standard effect FCDEffectProfile* FCDEffectStandard::Clone(FCDEffectProfile* _clone) const { - FCDEffectStandard* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEffectStandard(const_cast(GetDocument()), const_cast(GetParent())); + FCDEffectStandard* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEffectStandard(const_cast(GetDocument()), const_cast(GetParent())); else if (_clone->GetObjectType() == FCDEffectStandard::GetClassType()) clone = (FCDEffectStandard*) _clone; - if (_clone != NULL) FCDEffectProfile::Clone(_clone); - if (clone != NULL) + if (_clone != nullptr) FCDEffectProfile::Clone(_clone); + if (clone != nullptr) { clone->type = type; for (uint32 i = 0; i < FUDaeTextureChannel::COUNT; ++i) @@ -276,9 +276,9 @@ FCDEffectProfile* FCDEffectStandard::Clone(FCDEffectProfile* _clone) const void FCDEffectStandard::AddExtraAttribute(const char* profile, const char* key, const fchar* value) { - FUAssert(GetParent() != NULL, return); + FUAssert(GetParent() != nullptr, return); FCDETechnique* extraTech = GetParent()->GetExtra()->GetDefaultType()->FindTechnique(profile); - if (extraTech == NULL) extraTech = GetParent()->GetExtra()->GetDefaultType()->AddTechnique(profile); + if (extraTech == nullptr) extraTech = GetParent()->GetExtra()->GetDefaultType()->AddTechnique(profile); FCDENode *enode= extraTech->AddParameter(key, value); enode->SetName(key); enode->SetContent(value); @@ -287,11 +287,11 @@ void FCDEffectStandard::AddExtraAttribute(const char* profile, const char* key, const fchar* FCDEffectStandard::GetExtraAttribute(const char* profile, const char* key) const { - FUAssert(GetParent() != NULL, return NULL); + FUAssert(GetParent() != nullptr, return nullptr); const FCDETechnique * extraTech = GetParent()->GetExtra()->GetDefaultType()->FindTechnique(profile); - if (extraTech == NULL) return NULL; + if (extraTech == nullptr) return nullptr; const FCDENode * enode = extraTech->FindParameter(key); - if (enode == NULL) return NULL; + if (enode == nullptr) return nullptr; return enode->GetContent(); } @@ -360,7 +360,7 @@ FCDEffectParameter* FCDEffectStandard::GetParam(const fm::string& semantic, bool else { *isFloat = true; - return NULL; + return nullptr; } } diff --git a/FCollada/FCDocument/FCDEffectStandard.h b/FCollada/FCDocument/FCDEffectStandard.h index 222ac61..39986be 100644 --- a/FCollada/FCDocument/FCDEffectStandard.h +++ b/FCollada/FCDocument/FCDEffectStandard.h @@ -192,14 +192,14 @@ class FCOLLADA_EXPORT FCDEffectStandard : public FCDEffectProfile @param bucket A texture channel index. This index should match one of the values in the FUDaeTextureChannel enum. @param index The index of a texture within this channel. - @return The texture. This pointer will be NULL if either the bucket or the index is out-of-bounds. */ - inline FCDTexture* GetTexture(uint32 bucket, size_t index) { FUAssert(index < GetTextureCount(bucket), return NULL); return GetTextureBucket(bucket)[index]; } - inline const FCDTexture* GetTexture(uint32 bucket, size_t index) const { FUAssert(index < GetTextureCount(bucket), return NULL); return GetTextureBucket(bucket)[index]; } /**< See above. */ + @return The texture. This pointer will be nullptr if either the bucket or the index is out-of-bounds. */ + inline FCDTexture* GetTexture(uint32 bucket, size_t index) { FUAssert(index < GetTextureCount(bucket), return nullptr); return GetTextureBucket(bucket)[index]; } + inline const FCDTexture* GetTexture(uint32 bucket, size_t index) const { FUAssert(index < GetTextureCount(bucket), return nullptr); return GetTextureBucket(bucket)[index]; } /**< See above. */ /** Adds a texture to a specific channel. @param bucket A texture channel index. This index should match one of the values in the FUDaeTextureChannel enum. - @return The new texture. This pointer will be NULL if the bucket is out-of-bounds. */ + @return The new texture. This pointer will be nullptr if the bucket is out-of-bounds. */ FCDTexture* AddTexture(uint32 bucket); /** Releases a texture contained within this effect profile. @@ -570,10 +570,10 @@ class FCOLLADA_EXPORT FCDEffectStandard : public FCDEffectProfile /** Clones the COMMON profile effect and its parameters. @param clone The cloned profile. - If this pointer is NULL, a new COMMON profile is created and + If this pointer is nullptr, a new COMMON profile is created and you will need to release this pointer. @return The cloned COMMON profile. */ - virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = NULL) const; + virtual FCDEffectProfile* Clone(FCDEffectProfile* clone = nullptr) const; /** [INTERNAL] Flattens the profile. Does nothing on the common profile. */ diff --git a/FCollada/FCDocument/FCDEffectTechnique.cpp b/FCollada/FCDocument/FCDEffectTechnique.cpp index f434391..fcb6716 100644 --- a/FCollada/FCDocument/FCDEffectTechnique.cpp +++ b/FCollada/FCDocument/FCDEffectTechnique.cpp @@ -38,7 +38,7 @@ FCDEffectTechnique::FCDEffectTechnique(FCDocument* document, FCDEffectProfileFX FCDEffectTechnique::~FCDEffectTechnique() { - parent = NULL; + parent = nullptr; } // Adds a new pass to this effect technique. @@ -61,7 +61,7 @@ FCDEffectCode* FCDEffectTechnique::AddCode() FCDEffectTechnique* FCDEffectTechnique::Clone(FCDEffectTechnique* clone) const { - if (clone == NULL) clone = new FCDEffectTechnique(const_cast(GetDocument()), NULL); + if (clone == nullptr) clone = new FCDEffectTechnique(const_cast(GetDocument()), nullptr); clone->name = name; size_t parameterCount = parameters.size(); @@ -102,5 +102,5 @@ const FCDEffectCode* FCDEffectTechnique::FindCode(const char* sid) const { if ((*itC)->GetSubId() == sid) return (*itC); } - return NULL; + return nullptr; } diff --git a/FCollada/FCDocument/FCDEffectTechnique.h b/FCollada/FCDocument/FCDEffectTechnique.h index 5383cfa..02fc09e 100644 --- a/FCollada/FCDocument/FCDEffectTechnique.h +++ b/FCollada/FCDocument/FCDEffectTechnique.h @@ -94,9 +94,9 @@ class FCOLLADA_EXPORT FCDEffectTechnique : public FCDObject /** Retrieves a specific pass contained within this effect technique. @param index The index of the pass. - @return The pass. This pointer will be NULL if the index is out-of-bounds. */ - FCDEffectPass* GetPass(size_t index) { FUAssert(index < GetPassCount(), return NULL); return passes.at(index); } - const FCDEffectPass* GetPass(size_t index) const { FUAssert(index < GetPassCount(), return NULL); return passes.at(index); } /**< See above. */ + @return The pass. This pointer will be nullptr if the index is out-of-bounds. */ + FCDEffectPass* GetPass(size_t index) { FUAssert(index < GetPassCount(), return nullptr); return passes.at(index); } + const FCDEffectPass* GetPass(size_t index) const { FUAssert(index < GetPassCount(), return nullptr); return passes.at(index); } /**< See above. */ /** Adds a new pass to this effect technique. @return The new pass. */ @@ -112,13 +112,13 @@ class FCOLLADA_EXPORT FCDEffectTechnique : public FCDObject /** Retrieves a code inclusion contained within the effect profile. @param index The index of the code inclusion. - @return The code inclusion. This pointer will be NULL if the index is out-of-bounds. */ - FCDEffectCode* GetCode(size_t index) { FUAssert(index < GetCodeCount(), return NULL); return codes.at(index); } - const FCDEffectCode* GetCode(size_t index) const { FUAssert(index < GetCodeCount(), return NULL); return codes.at(index); } /**< See above. */ + @return The code inclusion. This pointer will be nullptr if the index is out-of-bounds. */ + FCDEffectCode* GetCode(size_t index) { FUAssert(index < GetCodeCount(), return nullptr); return codes.at(index); } + const FCDEffectCode* GetCode(size_t index) const { FUAssert(index < GetCodeCount(), return nullptr); return codes.at(index); } /**< See above. */ /** Retrieves the code inclusion with the given sub-id. @param sid A COLLADA sub-id. - @return The code inclusion with the given sub-id. This pointer will be NULL, + @return The code inclusion with the given sub-id. This pointer will be nullptr, if there are no code inclusions that match the given sub-id. */ inline FCDEffectCode* FindCode(const char* sid) { return const_cast(const_cast(this)->FindCode(sid)); } const FCDEffectCode* FindCode(const char* sid) const; /**< See above. */ @@ -134,8 +134,8 @@ class FCOLLADA_EXPORT FCDEffectTechnique : public FCDObject /** Retrieves a given local effect parameter. @param index An index. @return The local effect parameter at the given index. */ - inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } - inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } + inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } + inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } /** Adds a local effect parameter to the local list. @see FCDEffectParameter::Type @@ -145,10 +145,10 @@ class FCOLLADA_EXPORT FCDEffectTechnique : public FCDObject /** [INTERNAL] Clones the full effect technique. @param clone The cloned technique. - If this pointer is NULL, a new technique is created and + If this pointer is nullptr, a new technique is created and you will need to release this new techniquetechnique. - @return The cloned technique. This pointer will never be NULL. */ - FCDEffectTechnique* Clone(FCDEffectTechnique* clone = NULL) const; + @return The cloned technique. This pointer will never be nullptr. */ + FCDEffectTechnique* Clone(FCDEffectTechnique* clone = nullptr) const; /** [INTERNAL] Flattens this effect technique. Merges the parameter overrides into the parameter generators. */ diff --git a/FCollada/FCDocument/FCDEffectTools.cpp b/FCollada/FCDocument/FCDEffectTools.cpp index 8fd48cc..711406b 100644 --- a/FCollada/FCDocument/FCDEffectTools.cpp +++ b/FCollada/FCDocument/FCDEffectTools.cpp @@ -29,11 +29,11 @@ namespace FCDEffectTools void SynchronizeAnimatedParams(FCDGeometryInstance* geometryInstance, FCDMaterialInstance* materialInstance) { //Find the different classes that are needed. - FUAssert(geometryInstance != NULL && materialInstance != NULL, return); + FUAssert(geometryInstance != nullptr && materialInstance != nullptr, return); FCDMaterial* material = materialInstance->GetMaterial(); - FUAssert(material != NULL, return); + FUAssert(material != nullptr, return); FCDEffect* effect = material->GetEffect(); - FUAssert(effect != NULL, return); + FUAssert(effect != nullptr, return); FCDEffectProfile* effectProfile = effect->FindProfile(FUDaeProfileType::COMMON); if (!effectProfile) return; FCDEffectStandard* effectStandard = (FCDEffectStandard*) effectProfile; @@ -193,30 +193,30 @@ namespace FCDEffectTools { //Find the different classes that are needed. //FCDMaterial* material = materialInstance->GetMaterial(); - if (material == NULL) return NULL; + if (material == nullptr) return nullptr; FCDEffect* effect = material->GetEffect(); - if (effect == NULL) return NULL; + if (effect == nullptr) return nullptr; FCDEffectProfile* effectProfile = effect->FindProfile(FUDaeProfileType::COMMON); - if (effectProfile == NULL) return NULL; + if (effectProfile == nullptr) return nullptr; FCDEffectStandard* effectStandard = (FCDEffectStandard*) effectProfile; bool isFloat = true; //Find out if the parameter is animated FCDEffectParameter* effectStandardParam = effectStandard->GetParam(semantic, &isFloat); - if (effectStandardParam == NULL) return NULL; + if (effectStandardParam == nullptr) return nullptr; const fm::string& reference = effectStandardParam->GetReference(); if (reference.empty()) { - if (isFloat) return NULL; + if (isFloat) return nullptr; else return &(((FCDEffectParameterColor4*)effectStandardParam)->GetValue()); } - FCDEffectParameter* geometryParam = geometryInstance != NULL ? FindEffectParameterBySemantic(geometryInstance, semantic) : NULL; + FCDEffectParameter* geometryParam = geometryInstance != nullptr ? FindEffectParameterBySemantic(geometryInstance, semantic) : nullptr; FCDEffectParameter* materialParam = FindEffectParameterByReference(material, reference, true); FCDEffectParameter* effectParam = FindEffectParameterByReference(effect, reference, true); FCDEffectParameter* effectProfileParam = FindEffectParameterByReference(effectProfile, reference, false); //Do the figuring out .. ;) - if (isFloat) return NULL; + if (isFloat) return nullptr; else { if (geometryParam) @@ -232,7 +232,7 @@ namespace FCDEffectTools *isFloat3 = false; return &((FCDEffectParameterColor4*)geometryParam)->GetValue(); } - else return NULL; + else return nullptr; } //Could call GetDefaultColor from here on out... else if (materialParam) @@ -248,7 +248,7 @@ namespace FCDEffectTools *isFloat3 = false; return &((FCDEffectParameterColor4*)materialParam)->GetValue(); } - else return NULL; + else return nullptr; } else if (effectParam) { @@ -263,7 +263,7 @@ namespace FCDEffectTools *isFloat3 = false; return &((FCDEffectParameterColor4*)effectParam)->GetValue(); } - else return NULL; + else return nullptr; } else if (effectProfileParam) { @@ -278,7 +278,7 @@ namespace FCDEffectTools *isFloat3 = false; return &((FCDEffectParameterColor4*)effectProfileParam)->GetValue(); } - else return NULL; + else return nullptr; } else { @@ -292,24 +292,24 @@ namespace FCDEffectTools { //Find the different classes that are needed. //FCDMaterial* material = materialInstance->GetMaterial(); - if (material == NULL) return NULL; + if (material == nullptr) return nullptr; FCDEffect* effect = material->GetEffect(); - if (effect == NULL) return NULL; + if (effect == nullptr) return nullptr; FCDEffectProfile* effectProfile = effect->FindProfile(FUDaeProfileType::COMMON); - if (effectProfile == NULL) return NULL; + if (effectProfile == nullptr) return nullptr; FCDEffectStandard* effectStandard = (FCDEffectStandard*) effectProfile; bool isFloat = true; //Find out if the parameter is animated FCDEffectParameter* effectStandardParam = effectStandard->GetParam(semantic, &isFloat); - if (!effectStandardParam) return NULL; + if (!effectStandardParam) return nullptr; const fm::string& reference = effectStandardParam->GetReference(); if (reference.empty()) { if (isFloat) return &(((FCDEffectParameterFloat*)effectStandardParam)->GetValue()); - else return NULL; + else return nullptr; } - FCDEffectParameter* geometryParam = geometryInstance != NULL ? FindEffectParameterBySemantic(geometryInstance, semantic) : NULL; + FCDEffectParameter* geometryParam = geometryInstance != nullptr ? FindEffectParameterBySemantic(geometryInstance, semantic) : nullptr; FCDEffectParameter* materialParam = FindEffectParameterByReference(material, reference, true); FCDEffectParameter* effectParam = FindEffectParameterByReference(effect, reference, true); FCDEffectParameter* effectProfileParam = FindEffectParameterByReference(effectProfile, reference, false); @@ -318,28 +318,28 @@ namespace FCDEffectTools { if (geometryParam) { - if (geometryParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (geometryParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &((FCDEffectParameterFloat*)geometryParam)->GetValue(); } //From this on out, could call GetDefaultFloat... and return that? else if (materialParam) { - if (materialParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (materialParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &((FCDEffectParameterFloat*)materialParam)->GetValue(); } else if (effectParam) { - if (effectParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (effectParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &((FCDEffectParameterFloat*)effectParam)->GetValue(); } else if (effectProfileParam) { - if (effectProfileParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (effectProfileParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &((FCDEffectParameterFloat*)effectProfileParam)->GetValue(); } else return &((FCDEffectParameterFloat*)effectStandardParam)->GetValue(); } - else return NULL; + else return nullptr; } FMVector4* GetDefaultColor(FCDMaterial* material, const fm::string& semantic, bool* isFloat3) @@ -352,11 +352,11 @@ namespace FCDEffectTools //Find out if the parameter is animated FCDEffectParameter* effectStandardParam = effectStandard->GetParam(semantic, &isFloat); - if (!effectStandardParam) return NULL; + if (!effectStandardParam) return nullptr; const fm::string& reference = effectStandardParam->GetReference(); if (reference.empty()) { - if (isFloat) return NULL; + if (isFloat) return nullptr; else return &(FMVector4&)(((FCDEffectParameterColor4*)effectStandardParam)->GetValue()); } FCDEffectParameter* materialParam = FindEffectParameterByReference(material, reference, true); @@ -364,7 +364,7 @@ namespace FCDEffectTools FCDEffectParameter* effectProfileParam = FindEffectParameterByReference(effectProfile, reference, false); //Do the figuring out .. ;) - if (isFloat) return NULL; + if (isFloat) return nullptr; else { // Don't look at the geometry instance parameters: these are only used for animations! @@ -381,7 +381,7 @@ namespace FCDEffectTools *isFloat3 = false; return &(FMVector4&) ((FCDEffectParameterColor4*)materialParam)->GetValue(); } - else return NULL; + else return nullptr; } else if (effectParam) { @@ -396,7 +396,7 @@ namespace FCDEffectTools *isFloat3 = false; return &(FMVector4&) ((FCDEffectParameterColor4*)effectParam)->GetValue(); } - else return NULL; + else return nullptr; } else if (effectProfileParam) { @@ -411,7 +411,7 @@ namespace FCDEffectTools *isFloat3 = false; return &(FMVector4&) ((FCDEffectParameterColor4*)effectProfileParam)->GetValue(); } - else return NULL; + else return nullptr; } else { @@ -431,12 +431,12 @@ namespace FCDEffectTools //Find out if the parameter is animated FCDEffectParameter* effectStandardParam = effectStandard->GetParam(semantic, &isFloat); - if (!effectStandardParam) return NULL; + if (!effectStandardParam) return nullptr; const fm::string& reference = effectStandardParam->GetReference(); if (reference.empty()) { if (isFloat) return &(float&) ((FCDEffectParameterFloat*)effectStandardParam)->GetValue(); - else return NULL; + else return nullptr; } FCDEffectParameter* materialParam = FindEffectParameterByReference(material, reference, true); FCDEffectParameter* effectParam = FindEffectParameterByReference(effect, reference, true); @@ -446,22 +446,22 @@ namespace FCDEffectTools { if (materialParam) { - if (materialParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (materialParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &(float&) ((FCDEffectParameterFloat*)materialParam)->GetValue(); } else if (effectParam) { - if (effectParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (effectParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &(float&) ((FCDEffectParameterFloat*)effectParam)->GetValue(); } else if (effectProfileParam) { - if (effectProfileParam->GetType() != FCDEffectParameter::FLOAT) return NULL; + if (effectProfileParam->GetType() != FCDEffectParameter::FLOAT) return nullptr; else return &(float&) ((FCDEffectParameterFloat*)effectProfileParam)->GetValue(); } else return &(float&) ((FCDEffectParameterFloat*)effectStandardParam)->GetValue(); } - else return NULL; + else return nullptr; } // @@ -470,19 +470,19 @@ namespace FCDEffectTools const FCDEffectParameter* FindEffectParameterBySemantic(const FCDGeometryInstance* geometryInstance, const char* semantic) { - if (geometryInstance == NULL || semantic == NULL || *semantic == 0) return NULL; + if (geometryInstance == nullptr || semantic == nullptr || *semantic == 0) return nullptr; size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = geometryInstance->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetSemantic(), semantic)) return effectParameter; } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterBySemantic(const FCDMaterialInstance* materialInstance, const char* semantic, bool localOnly) { - if (materialInstance == NULL || semantic == NULL || *semantic == 0) return NULL; + if (materialInstance == nullptr || semantic == nullptr || *semantic == 0) return nullptr; const FCDGeometryInstance* geometryInstance = (FCDGeometryInstance*) materialInstance->GetParent(); size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) @@ -490,24 +490,24 @@ namespace FCDEffectTools const FCDEffectParameter* effectParameter = geometryInstance->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetSemantic(), semantic)) return effectParameter; } - return !localOnly ? FindEffectParameterBySemantic(materialInstance->GetMaterial(), semantic) : NULL; + return !localOnly ? FindEffectParameterBySemantic(materialInstance->GetMaterial(), semantic) : nullptr; } const FCDEffectParameter* FindEffectParameterBySemantic(const FCDMaterial* material, const char* semantic, bool localOnly) { - if (material == NULL || semantic == NULL || *semantic == 0) return NULL; + if (material == nullptr || semantic == nullptr || *semantic == 0) return nullptr; size_t count = material->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = material->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetSemantic(), semantic)) return effectParameter; } - return !localOnly ? FindEffectParameterBySemantic(material->GetEffect(), semantic) : NULL; + return !localOnly ? FindEffectParameterBySemantic(material->GetEffect(), semantic) : nullptr; } const FCDEffectParameter* FindEffectParameterBySemantic(const FCDEffect* effect, const char* semantic, bool localOnly) { - if (effect == NULL || semantic == NULL || *semantic == 0) return NULL; + if (effect == nullptr || semantic == nullptr || *semantic == 0) return nullptr; size_t count = effect->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -520,16 +520,16 @@ namespace FCDEffectTools for (size_t p = 0; p < profileCount; ++p) { const FCDEffectParameter* effectParameter = FindEffectParameterBySemantic(effect->GetProfile(p), semantic); - if (effectParameter != NULL) return effectParameter; + if (effectParameter != nullptr) return effectParameter; } } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterBySemantic(const FCDEffectProfile* profile, const char* semantic, bool localOnly) { // Look within the local parameters. - if (profile == NULL || semantic == NULL || *semantic == 0) return NULL; + if (profile == nullptr || semantic == nullptr || *semantic == 0) return nullptr; size_t count = profile->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -545,7 +545,7 @@ namespace FCDEffectTools for (size_t t = 0; t < techniqueCount; ++t) { const FCDEffectParameter* effectParameter = FindEffectParameterBySemantic(fx->GetTechnique(t), semantic); - if (effectParameter != NULL) return effectParameter; + if (effectParameter != nullptr) return effectParameter; } } else if (profile->HasType(FCDEffectStandard::GetClassType())) @@ -562,19 +562,19 @@ namespace FCDEffectTools } } } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterBySemantic(const FCDEffectTechnique* technique, const char* semantic, bool UNUSED(localOnly)) { - if (technique == NULL || semantic == NULL || *semantic == 0) return NULL; + if (technique == nullptr || semantic == nullptr || *semantic == 0) return nullptr; size_t count = technique->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = technique->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetSemantic(), semantic)) return effectParameter; } - return NULL; + return nullptr; } // @@ -583,19 +583,19 @@ namespace FCDEffectTools const FCDEffectParameter* FindEffectParameterByReference(const FCDGeometryInstance* geometryInstance, const char* reference) { - if (geometryInstance == NULL || reference == NULL || *reference == 0) return NULL; + if (geometryInstance == nullptr || reference == nullptr || *reference == 0) return nullptr; size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = geometryInstance->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetReference(), reference)) return effectParameter; } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterByReference(const FCDMaterialInstance* materialInstance, const char* reference, bool localOnly) { - if (materialInstance == NULL || reference == NULL || *reference == 0) return NULL; + if (materialInstance == nullptr || reference == nullptr || *reference == 0) return nullptr; const FCDGeometryInstance* geometryInstance = (FCDGeometryInstance*) materialInstance->GetParent(); size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) @@ -603,24 +603,24 @@ namespace FCDEffectTools const FCDEffectParameter* effectParameter = geometryInstance->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetReference(), reference)) return effectParameter; } - return !localOnly ? FindEffectParameterByReference(materialInstance->GetMaterial(), reference) : NULL; + return !localOnly ? FindEffectParameterByReference(materialInstance->GetMaterial(), reference) : nullptr; } const FCDEffectParameter* FindEffectParameterByReference(const FCDMaterial* material, const char* reference, bool localOnly) { - if (material == NULL || reference == NULL || *reference == 0) return NULL; + if (material == nullptr || reference == nullptr || *reference == 0) return nullptr; size_t count = material->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = material->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetReference(), reference)) return effectParameter; } - return !localOnly ? FindEffectParameterByReference(material->GetEffect(), reference) : NULL; + return !localOnly ? FindEffectParameterByReference(material->GetEffect(), reference) : nullptr; } const FCDEffectParameter* FindEffectParameterByReference(const FCDEffect* effect, const char* reference, bool localOnly) { - if (effect == NULL || reference == NULL || *reference == 0) return NULL; + if (effect == nullptr || reference == nullptr || *reference == 0) return nullptr; size_t count = effect->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -633,16 +633,16 @@ namespace FCDEffectTools for (size_t p = 0; p < profileCount; ++p) { const FCDEffectParameter* effectParameter = FindEffectParameterByReference(effect->GetProfile(p), reference); - if (effectParameter != NULL) return effectParameter; + if (effectParameter != nullptr) return effectParameter; } } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterByReference(const FCDEffectProfile* profile, const char* reference, bool localOnly) { // Look within the local parameters. - if (profile == NULL || reference == NULL || *reference == 0) return NULL; + if (profile == nullptr || reference == nullptr || *reference == 0) return nullptr; size_t count = profile->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -658,7 +658,7 @@ namespace FCDEffectTools for (size_t t = 0; t < techniqueCount; ++t) { const FCDEffectParameter* effectParameter = FindEffectParameterByReference(fx->GetTechnique(t), reference); - if (effectParameter != NULL) return effectParameter; + if (effectParameter != nullptr) return effectParameter; } } else if (profile->HasType(FCDEffectStandard::GetClassType())) @@ -675,19 +675,19 @@ namespace FCDEffectTools } } } - return NULL; + return nullptr; } const FCDEffectParameter* FindEffectParameterByReference(const FCDEffectTechnique* technique, const char* reference, bool UNUSED(localOnly)) { - if (technique == NULL || reference == NULL || *reference == 0) return NULL; + if (technique == nullptr || reference == nullptr || *reference == 0) return nullptr; size_t count = technique->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { const FCDEffectParameter* effectParameter = technique->GetEffectParameter(p); if (IsEquivalent(effectParameter->GetReference(), reference)) return effectParameter; } - return NULL; + return nullptr; } // @@ -696,7 +696,7 @@ namespace FCDEffectTools void FindEffectParametersBySemantic(const FCDMaterialInstance* materialInstance, const char* semantic, FCDEffectParameterList& parameters, bool localOnly) { - if (materialInstance == NULL || semantic == NULL || *semantic == 0) return; + if (materialInstance == nullptr || semantic == nullptr || *semantic == 0) return; const FCDGeometryInstance* geometryInstance = (FCDGeometryInstance*) materialInstance->GetParent(); size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) @@ -712,7 +712,7 @@ namespace FCDEffectTools void FindEffectParametersBySemantic(const FCDMaterial* material, const char* semantic, FCDEffectParameterList& parameters, bool localOnly) { - if (material == NULL || semantic == NULL || *semantic == 0) return; + if (material == nullptr || semantic == nullptr || *semantic == 0) return; size_t count = material->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -727,7 +727,7 @@ namespace FCDEffectTools void FindEffectParametersBySemantic(const FCDEffect* effect, const char* semantic, FCDEffectParameterList& parameters, bool localOnly) { - if (effect == NULL || semantic == NULL || *semantic == 0) return; + if (effect == nullptr || semantic == nullptr || *semantic == 0) return; size_t count = effect->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -747,7 +747,7 @@ namespace FCDEffectTools void FindEffectParametersBySemantic(const FCDEffectProfile* profile, const char* semantic, FCDEffectParameterList& parameters, bool localOnly) { // Look within the local parameters. - if (profile == NULL || semantic == NULL || *semantic == 0) return; + if (profile == nullptr || semantic == nullptr || *semantic == 0) return; size_t count = profile->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -783,7 +783,7 @@ namespace FCDEffectTools void FindEffectParametersBySemantic(const FCDEffectTechnique* technique, const char* semantic, FCDEffectParameterList& parameters, bool UNUSED(localOnly)) { - if (technique == NULL || semantic == NULL || *semantic == 0) return; + if (technique == nullptr || semantic == nullptr || *semantic == 0) return; size_t count = technique->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -798,7 +798,7 @@ namespace FCDEffectTools void FindEffectParametersByReference(const FCDMaterialInstance* materialInstance, const char* reference, FCDEffectParameterList& parameters, bool localOnly) { - if (materialInstance == NULL || reference == NULL || *reference == 0) return; + if (materialInstance == nullptr || reference == nullptr || *reference == 0) return; const FCDGeometryInstance* geometryInstance = (FCDGeometryInstance*) materialInstance->GetParent(); size_t count = geometryInstance->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) @@ -814,7 +814,7 @@ namespace FCDEffectTools void FindEffectParametersByReference(const FCDMaterial* material, const char* reference, FCDEffectParameterList& parameters, bool localOnly) { - if (material == NULL || reference == NULL || *reference == 0) return; + if (material == nullptr || reference == nullptr || *reference == 0) return; size_t count = material->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -829,7 +829,7 @@ namespace FCDEffectTools void FindEffectParametersByReference(const FCDEffect* effect, const char* reference, FCDEffectParameterList& parameters, bool localOnly) { - if (effect == NULL || reference == NULL || *reference == 0) return; + if (effect == nullptr || reference == nullptr || *reference == 0) return; size_t count = effect->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -849,7 +849,7 @@ namespace FCDEffectTools void FindEffectParametersByReference(const FCDEffectProfile* profile, const char* reference, FCDEffectParameterList& parameters, bool localOnly) { // Look within the local parameters. - if (profile == NULL || reference == NULL || *reference == 0) return; + if (profile == nullptr || reference == nullptr || *reference == 0) return; size_t count = profile->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { @@ -885,7 +885,7 @@ namespace FCDEffectTools void FindEffectParametersByReference(const FCDEffectTechnique* technique, const char* reference, FCDEffectParameterList& parameters, bool UNUSED(localOnly)) { - if (technique == NULL || reference == NULL || *reference == 0) return; + if (technique == nullptr || reference == nullptr || *reference == 0) return; size_t count = technique->GetEffectParameterCount(); for (size_t p = 0; p < count; ++p) { diff --git a/FCollada/FCDocument/FCDEffectTools.h b/FCollada/FCDocument/FCDEffectTools.h index e4eaa11..7f5c1f7 100644 --- a/FCollada/FCDocument/FCDEffectTools.h +++ b/FCollada/FCDocument/FCDEffectTools.h @@ -82,7 +82,7 @@ namespace FCDEffectTools @param semantic The effect parameter semantic to match. @param localOnly Whether to search below this level of abstraction. @return The first effect parameter that matches the semantic. - This pointer will be NULL if no effect parameter matches the given semantic. */ + This pointer will be nullptr if no effect parameter matches the given semantic. */ FCOLLADA_EXPORT const FCDEffectParameter* FindEffectParameterBySemantic(const FCDMaterialInstance* materialInstance, const char* semantic, bool localOnly = false); FCOLLADA_EXPORT inline FCDEffectParameter* FindEffectParameterBySemantic(FCDMaterialInstance* materialInstance, const char* semantic, bool localOnly = false) { return const_cast(FindEffectParameterBySemantic(const_cast(materialInstance), semantic, localOnly)); } /**< See above. */ FCOLLADA_EXPORT const FCDEffectParameter* FindEffectParameterBySemantic(const FCDGeometryInstance* geometryInstance, const char* semantic); /**< See above. */ @@ -103,7 +103,7 @@ namespace FCDEffectTools @param materialInstance The material instance being considered. @param reference The effect parameter reference to match. @return The first effect parameter that matches the reference. - This pointer will be NULL if no effect parameter matches the given reference. */ + This pointer will be nullptr if no effect parameter matches the given reference. */ FCOLLADA_EXPORT const FCDEffectParameter* FindEffectParameterByReference(const FCDMaterialInstance* materialInstance, const char* reference, bool localOnly = false); FCOLLADA_EXPORT inline FCDEffectParameter* FindEffectParameterByReference(FCDMaterialInstance* materialInstance, const char* reference, bool localOnly = false) { return const_cast(FindEffectParameterByReference(const_cast(materialInstance), reference, localOnly)); } /**< See above. */ FCOLLADA_EXPORT const FCDEffectParameter* FindEffectParameterByReference(const FCDGeometryInstance* geometryInstance, const char* reference); /**< See above. */ diff --git a/FCollada/FCDocument/FCDEmitter.cpp b/FCollada/FCDocument/FCDEmitter.cpp index 161e542..414adb0 100644 --- a/FCollada/FCDocument/FCDEmitter.cpp +++ b/FCollada/FCDocument/FCDEmitter.cpp @@ -30,13 +30,13 @@ FCDEmitter::~FCDEmitter() FCDEntity* FCDEmitter::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDEmitter* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDEmitter(const_cast(GetDocument())); + FCDEmitter* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDEmitter(const_cast(GetDocument())); else if (_clone->HasType(FCDEmitter::GetClassType())) clone = (FCDEmitter*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { } return _clone; diff --git a/FCollada/FCDocument/FCDEmitter.h b/FCollada/FCDocument/FCDEmitter.h index 60b79e1..26238db 100644 --- a/FCollada/FCDocument/FCDEmitter.h +++ b/FCollada/FCDocument/FCDEmitter.h @@ -56,11 +56,11 @@ class FCOLLADA_EXPORT FCDEmitter : public FCDEntity /** Clones the emitter information. @param clone The cloned emitter. - If this pointer is NULL, a new emitter is created and + If this pointer is nullptr, a new emitter is created and you will need to release it manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif //_FCD_EMITTER_H diff --git a/FCollada/FCDocument/FCDEntity.cpp b/FCollada/FCDocument/FCDEntity.cpp index 3b974ea..9f22126 100644 --- a/FCollada/FCDocument/FCDEntity.cpp +++ b/FCollada/FCDocument/FCDEntity.cpp @@ -49,7 +49,7 @@ FCDEntity::~FCDEntity() // Structure cloning FCDEntity* FCDEntity::Clone(FCDEntity* clone, bool UNUSED(cloneChildren)) const { - if (clone == NULL) + if (clone == nullptr) { clone = new FCDEntity(const_cast(GetDocument())); } @@ -57,7 +57,7 @@ FCDEntity* FCDEntity::Clone(FCDEntity* clone, bool UNUSED(cloneChildren)) const FCDObjectWithId::Clone(clone); clone->name = name; clone->note = note; - if (extra != NULL) + if (extra != nullptr) { extra->Clone(clone->extra); } @@ -98,12 +98,12 @@ void FCDEntity::SetName(const fstring& _name) FCDAsset* FCDEntity::GetAsset() { - return (asset != NULL) ? asset : (asset = new FCDAsset(GetDocument())); + return (asset != nullptr) ? asset : (asset = new FCDAsset(GetDocument())); } void FCDEntity::GetHierarchicalAssets(FCDAssetConstList& assets) const { - if (asset != NULL) assets.push_back(asset); + if (asset != nullptr) assets.push_back(asset); else assets.push_back(GetDocument()->GetAsset()); } @@ -111,7 +111,7 @@ void FCDEntity::GetHierarchicalAssets(FCDAssetConstList& assets) const const FCDEntity* FCDEntity::FindDaeId(const fm::string& _daeId) const { if (GetDaeId() == _daeId) return this; - return NULL; + return nullptr; } bool FCDEntity::HasNote() const diff --git a/FCollada/FCDocument/FCDEntity.h b/FCollada/FCDocument/FCDEntity.h index 234bf23..006ed38 100644 --- a/FCollada/FCDocument/FCDEntity.h +++ b/FCollada/FCDocument/FCDEntity.h @@ -162,7 +162,7 @@ class FCOLLADA_EXPORT FCDEntity : public FCDObjectWithId This function is only useful for entities that are hierarchical: visual/physics scene nodes and animations. @param daeId A COLLADA id. - @return The child entity with the given id. This pointer will be NULL + @return The child entity with the given id. This pointer will be nullptr if no child entity matches the given id. */ virtual FCDEntity* FindDaeId(const fm::string& daeId) { return const_cast(const_cast(this)->FindDaeId(daeId)); } virtual const FCDEntity* FindDaeId(const fm::string& daeId) const; /**< See above. */ @@ -172,11 +172,11 @@ class FCOLLADA_EXPORT FCDEntity : public FCDObjectWithId to copy the COLLADA id and the other entity-level information. All the up-classes of this class should implement this function. The cloned entity may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new entity + @param clone The empty clone. If this pointer is nullptr, a new entity will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** Cleans illegal characters in from the input char string @param c The string to clean diff --git a/FCollada/FCDocument/FCDEntityInstance.cpp b/FCollada/FCDocument/FCDEntityInstance.cpp index d884bac..8bbc373 100644 --- a/FCollada/FCDocument/FCDEntityInstance.cpp +++ b/FCollada/FCDocument/FCDEntityInstance.cpp @@ -43,7 +43,7 @@ FCDEntityInstance::FCDEntityInstance(FCDocument* document, FCDSceneNode* _parent FCDEntityInstance::~FCDEntityInstance() { - if (entityReference != NULL) + if (entityReference != nullptr) { UntrackObject(entityReference); SAFE_RELEASE(entityReference); @@ -78,20 +78,20 @@ void FCDEntityInstance::SetName(const fstring& _name) FCDExtra* FCDEntityInstance::GetExtra() { - return (extra != NULL) ? extra : (extra = new FCDExtra(GetDocument(), this)); + return (extra != nullptr) ? extra : (extra = new FCDExtra(GetDocument(), this)); } bool FCDEntityInstance::IsExternalReference() const { - return entityReference->GetPlaceHolder() != NULL; + return entityReference->GetPlaceHolder() != nullptr; } /* void FCDEntityInstance::LoadExternalEntity(FCDocument* externalDocument, const fm::string& daeId) { - if (externalDocument == NULL || entity != NULL) return; + if (externalDocument == nullptr || entity != nullptr) return; - FCDEntity* instancedEntity = NULL; + FCDEntity* instancedEntity = nullptr; switch (entityType) { case FCDEntity::ANIMATION: instancedEntity = (FCDEntity*) externalDocument->FindAnimation(daeId); break; @@ -109,7 +109,7 @@ void FCDEntityInstance::LoadExternalEntity(FCDocument* externalDocument, const f default: break; } - if (instancedEntity != NULL) + if (instancedEntity != nullptr) { SetEntity(instancedEntity); } @@ -117,8 +117,8 @@ void FCDEntityInstance::LoadExternalEntity(FCDocument* externalDocument, const f */ bool FCDEntityInstance::HasForParent(FCDSceneNode* node) const { - if (node == NULL) return false; - if (parent == NULL) return false; + if (node == nullptr) return false; + if (parent == nullptr) return false; FCDSceneNodeList parentStack; parentStack.push_back(parent); while (!parentStack.empty()) @@ -136,7 +136,7 @@ bool FCDEntityInstance::HasForParent(FCDSceneNode* node) const void FCDEntityInstance::CleanSubId(FUSUniqueStringMap* parentStringMap) { - if (!wantedSubId->empty() && (parentStringMap != NULL)) + if (!wantedSubId->empty() && (parentStringMap != nullptr)) { parentStringMap->insert(wantedSubId); } @@ -144,7 +144,7 @@ void FCDEntityInstance::CleanSubId(FUSUniqueStringMap* parentStringMap) FCDEntityInstance* FCDEntityInstance::Clone(FCDEntityInstance* clone) const { - if (clone == NULL) + if (clone == nullptr) { clone = new FCDEntityInstance(const_cast(GetDocument()), const_cast(parent), entityType); } @@ -156,7 +156,7 @@ FCDEntityInstance* FCDEntityInstance::Clone(FCDEntityInstance* clone) const void FCDEntityInstance::OnObjectReleased(FUTrackable* object) { FUAssert(object == entityReference, return); - entityReference = NULL; + entityReference = nullptr; Release(); } @@ -188,7 +188,7 @@ FCDEntityInstance* FCDEntityInstanceFactory::CreateInstance(FCDocument* document FCDEntityInstance* FCDEntityInstanceFactory::CreateInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity* entity) { - FUAssert(entity != NULL, return NULL); + FUAssert(entity != nullptr, return nullptr); FCDEntityInstance* instance = CreateInstance(document, parent, entity->GetType()); instance->SetEntity(entity); diff --git a/FCollada/FCDocument/FCDEntityInstance.h b/FCollada/FCDocument/FCDEntityInstance.h index f6e2531..90e1824 100644 --- a/FCollada/FCDocument/FCDEntityInstance.h +++ b/FCollada/FCDocument/FCDEntityInstance.h @@ -69,7 +69,7 @@ class FCOLLADA_EXPORT FCDEntityInstance : public FCDObject, FUTracker DeclareObjectType(FCDObject, FCDEntityInstance) friend class FCDEntityInstanceFactory; - FCDSceneNode* parent; // May be NULL for non-scene graph instances. + FCDSceneNode* parent; // May be nullptr for non-scene graph instances. FCDEntity::Type entityType; DeclareParameterPtr(FCDEntityReference, entityReference, FC("Entity Reference")) @@ -85,7 +85,7 @@ class FCOLLADA_EXPORT FCDEntityInstance : public FCDObject, FUTracker Instead, use the appropriate allocation function. For scene node instance: FCDSceneNode::AddInstance. @param document The COLLADA document that owns the entity instance. - @param parent The visual scene node that contains the entity instance. This pointer will be NULL for + @param parent The visual scene node that contains the entity instance. This pointer will be nullptr for instances that are not directly under a visual scene node. @param type The type of entity to instantiate. */ FCDEntityInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type type); @@ -170,7 +170,7 @@ class FCOLLADA_EXPORT FCDEntityInstance : public FCDObject, FUTracker bool IsExternalReference() const; /** Retrieves the parent of the entity instance. - @return the parent visual scene node. This pointer will be NULL + @return the parent visual scene node. This pointer will be nullptr when the instance is not created in the visual scene graph. */ inline FCDSceneNode* GetParent() { return parent; } inline const FCDSceneNode* GetParent() const { return parent; } /**< See above. */ @@ -184,12 +184,12 @@ class FCOLLADA_EXPORT FCDEntityInstance : public FCDObject, FUTracker /** [INTERNAL] Cleans up the sub identifiers. The sub identifiers must be unique with respect to its parent. This method corrects the sub ids if there are conflicts. @param parentStringMap The string map from the parent of this instance in which the sub ids must be unique. */ - virtual void CleanSubId(FUSUniqueStringMap* parentStringMap = NULL); + virtual void CleanSubId(FUSUniqueStringMap* parentStringMap = nullptr); /** Clones the entity instance. @param clone The entity instance to become the clone. @return The cloned entity instance. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; protected: /** [INTERNAL] Retrieves the COLLADA name for the instantiation of a given entity type. @@ -218,7 +218,7 @@ class FCOLLADA_EXPORT FCDEntityInstanceFactory @param document The COLLADA document that will own the new instance. @param parent The visual scene node that will contain the instance. @param type The type of instance object to create. - @return The new COLLADA instance. This pointer will be NULL + @return The new COLLADA instance. This pointer will be nullptr if the given type is invalid. */ static FCDEntityInstance* CreateInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type type); @@ -226,7 +226,7 @@ class FCOLLADA_EXPORT FCDEntityInstanceFactory @param document The COLLADA document that will own the new instance. @param parent The visual scene node that will contain the instance. @param entity The entity to create an instance of. - @return The new COLLADA instance. This pointer will be NULL + @return The new COLLADA instance. This pointer will be nullptr if the given type is invalid. */ static FCDEntityInstance* CreateInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity *entity); }; diff --git a/FCollada/FCDocument/FCDEntityReference.cpp b/FCollada/FCDocument/FCDEntityReference.cpp index 3582ad2..15f2dad 100644 --- a/FCollada/FCDocument/FCDEntityReference.cpp +++ b/FCollada/FCDocument/FCDEntityReference.cpp @@ -22,8 +22,8 @@ ImplementObjectType(FCDEntityReference) FCDEntityReference::FCDEntityReference(FCDocument* document, FCDObjectWithId* _parent) : FCDObject(document) -, entity(NULL) -, placeHolder(NULL) +, entity(nullptr) +, placeHolder(nullptr) , baseObject(_parent) { // No need to track base object - it must track us! @@ -33,29 +33,29 @@ FCDEntityReference::FCDEntityReference(FCDocument* document, FCDObjectWithId* _p FCDEntityReference::~FCDEntityReference() { - SetPlaceHolder(NULL); + SetPlaceHolder(nullptr); UntrackObject(entity); - entity = NULL; + entity = nullptr; } FUUri FCDEntityReference::GetUri() const { fstring path; - if (placeHolder != NULL) + if (placeHolder != nullptr) { FUUri uri(placeHolder->GetFileUrl()); path = uri.GetAbsoluteUri(); } path.append(FC("#")); - if (entity != NULL) path.append(TO_FSTRING(entity->GetDaeId())); + if (entity != nullptr) path.append(TO_FSTRING(entity->GetDaeId())); else path.append(TO_FSTRING(entityId)); return FUUri(path); } const FCDEntity* FCDEntityReference::GetEntity() const { - if (entity == NULL) + if (entity == nullptr) { // This is the part Stephen doesn't like.. const_cast(this)->LoadEntity(); @@ -67,14 +67,14 @@ void FCDEntityReference::SetUri(const FUUri& uri) { entityId = TO_STRING(uri.GetFragment()); entityId = FCDObjectWithId::CleanId(entityId); - FCDPlaceHolder* documentPlaceHolder = NULL; + FCDPlaceHolder* documentPlaceHolder = nullptr; if (uri.IsFile()) { fstring fileUrl = GetDocument()->GetFileManager()->GetCurrentUri().MakeAbsolute(uri.GetAbsolutePath()); documentPlaceHolder = GetDocument()->GetExternalReferenceManager()->FindPlaceHolder(fileUrl); - if (documentPlaceHolder == NULL) + if (documentPlaceHolder == nullptr) { documentPlaceHolder = GetDocument()->GetExternalReferenceManager()->AddPlaceHolder(fileUrl); } @@ -88,12 +88,12 @@ void FCDEntityReference::SetUri(const FUUri& uri) void FCDEntityReference::SetEntity(FCDEntity* _entity) { // Stop tracking the old entity - if (entity != NULL) UntrackObject(entity); + if (entity != nullptr) UntrackObject(entity); // Track the new entity entity = _entity; - if (_entity != NULL) + if (_entity != nullptr) { TrackObject(_entity); entityId = _entity->GetDaeId(); @@ -102,7 +102,7 @@ void FCDEntityReference::SetEntity(FCDEntity* _entity) } else { - SetEntityDocument(NULL); + SetEntityDocument(nullptr); } SetNewChildFlag(); @@ -113,7 +113,7 @@ void FCDEntityReference::SetPlaceHolder(FCDPlaceHolder* _placeHolder) { if (_placeHolder != placeHolder) { - if (placeHolder != NULL) + if (placeHolder != nullptr) { placeHolder->RemoveExternalReference(this); UntrackObject(placeHolder); @@ -123,7 +123,7 @@ void FCDEntityReference::SetPlaceHolder(FCDPlaceHolder* _placeHolder) } } placeHolder = _placeHolder; - if (placeHolder != NULL) + if (placeHolder != nullptr) { placeHolder->AddExternalReference(this); TrackObject(placeHolder); @@ -135,13 +135,13 @@ void FCDEntityReference::SetPlaceHolder(FCDPlaceHolder* _placeHolder) void FCDEntityReference::LoadEntity() { FCDocument* entityDocument; - if (placeHolder == NULL) entityDocument = GetDocument(); + if (placeHolder == nullptr) entityDocument = GetDocument(); else { entityDocument = placeHolder->GetTarget(FCollada::GetDereferenceFlag()); } - if (entityDocument == NULL) + if (entityDocument == nullptr) { if (FCollada::GetDereferenceFlag()) { @@ -154,7 +154,7 @@ void FCDEntityReference::LoadEntity() if (!entityId.empty()) { entity = entityDocument->FindEntity(entityId); - if (entity != NULL) TrackObject(entity); + if (entity != nullptr) TrackObject(entity); else { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_INVALID_URI); @@ -165,11 +165,11 @@ void FCDEntityReference::LoadEntity() void FCDEntityReference::SetEntityDocument(FCDocument* document) { - FCDPlaceHolder* documentPlaceHolder = NULL; - if (document != NULL && document != GetDocument()) + FCDPlaceHolder* documentPlaceHolder = nullptr; + if (document != nullptr && document != GetDocument()) { documentPlaceHolder = GetDocument()->GetExternalReferenceManager()->FindPlaceHolder(document); - if (documentPlaceHolder == NULL) + if (documentPlaceHolder == nullptr) { documentPlaceHolder = GetDocument()->GetExternalReferenceManager()->AddPlaceHolder(document); } @@ -181,13 +181,13 @@ void FCDEntityReference::OnObjectReleased(FUTrackable* object) { if (placeHolder == object) { - placeHolder = NULL; + placeHolder = nullptr; } else if (entity == object) { - if (placeHolder == NULL) entityId.clear(); + if (placeHolder == nullptr) entityId.clear(); else entityId = ((FCDObjectWithId*) object)->GetDaeId(); - entity = NULL; + entity = nullptr; } else { FUBreak; } } diff --git a/FCollada/FCDocument/FCDEntityReference.h b/FCollada/FCDocument/FCDEntityReference.h index c63963b..0996cc9 100644 --- a/FCollada/FCDocument/FCDEntityReference.h +++ b/FCollada/FCDocument/FCDEntityReference.h @@ -88,12 +88,12 @@ class FCOLLADA_EXPORT FCDEntityReference : public FCDObject, FUTracker /** Retrieves whether this entity reference is an external entity reference. This function intentionally hides the FCDObject::IsExternal function. @return Whether the entity reference is an external entity reference. */ - inline bool IsExternal() const { return placeHolder != NULL; } + inline bool IsExternal() const { return placeHolder != nullptr; } /** Retrieves whether this entity reference is a local entity reference. This function intentionally hides the FCDObject::IsLocal function. @return Whether the entity reference is a local entity reference. */ - inline bool IsLocal() const { return placeHolder == NULL; } + inline bool IsLocal() const { return placeHolder == nullptr; } /** Sets the COLLADA id of the referenced entity. @param id The COLLADA id of the referenced entity. */ @@ -127,7 +127,7 @@ class FCOLLADA_EXPORT FCDEntityReference : public FCDObject, FUTracker /** Set the pointer to the closest entity upstream that contains this reference. @param obj An object with Id that either directly or indirectly exclusively contains this reference */ - inline void SetClosestObjectWithId(FCDObjectWithId* obj) { FUAssert(baseObject == NULL,); baseObject = obj; } + inline void SetClosestObjectWithId(FCDObjectWithId* obj) { FUAssert(baseObject == nullptr,); baseObject = obj; } /** Set the entity we are referencing. If this is from an external document, it will create the appropriate FCDPlaceholder etc. diff --git a/FCollada/FCDocument/FCDExternalReferenceManager.cpp b/FCollada/FCDocument/FCDExternalReferenceManager.cpp index 5452031..31900fc 100644 --- a/FCollada/FCDocument/FCDExternalReferenceManager.cpp +++ b/FCollada/FCDocument/FCDExternalReferenceManager.cpp @@ -44,7 +44,7 @@ const FCDPlaceHolder* FCDExternalReferenceManager::FindPlaceHolder(const fstring { if ((*it)->GetFileUrl() == fileUrl) return *it; } - return NULL; + return nullptr; } FCDPlaceHolder* FCDExternalReferenceManager::AddPlaceHolder(FCDocument* document) @@ -60,7 +60,7 @@ const FCDPlaceHolder* FCDExternalReferenceManager::FindPlaceHolder(const FCDocum { if ((*it)->GetTarget() == document) return *it; } - return NULL; + return nullptr; } void FCDExternalReferenceManager::RegisterLoadedDocument(FCDocument* document) diff --git a/FCollada/FCDocument/FCDExternalReferenceManager.h b/FCollada/FCDocument/FCDExternalReferenceManager.h index c9a0422..6d40338 100644 --- a/FCollada/FCDocument/FCDExternalReferenceManager.h +++ b/FCollada/FCDocument/FCDExternalReferenceManager.h @@ -66,12 +66,12 @@ class FCOLLADA_EXPORT FCDExternalReferenceManager : public FCDObject /** Retrieves a FCollada document placeholder. @param index The index of the placeholder. @return The placeholder at the given index. */ - inline FCDPlaceHolder* GetPlaceHolder(size_t index) { FUAssert(index < placeHolders.size(), return NULL); return placeHolders.at(index); } - inline const FCDPlaceHolder* GetPlaceHolder(size_t index) const { FUAssert(index < placeHolders.size(), return NULL); return placeHolders.at(index); } /**< See above. */ + inline FCDPlaceHolder* GetPlaceHolder(size_t index) { FUAssert(index < placeHolders.size(), return nullptr); return placeHolders.at(index); } + inline const FCDPlaceHolder* GetPlaceHolder(size_t index) const { FUAssert(index < placeHolders.size(), return nullptr); return placeHolders.at(index); } /**< See above. */ /** Retrieves the placeholder that references the FCollada document at the given URI. @param fileUrl The URI of the FCollada document. - @return The placeholder for the FCollada document. This pointer will be NULL + @return The placeholder for the FCollada document. This pointer will be nullptr if no local entity instances reference entities within the document at the given URI. */ const FCDPlaceHolder* FindPlaceHolder(const fstring& fileUrl) const; @@ -79,7 +79,7 @@ class FCOLLADA_EXPORT FCDExternalReferenceManager : public FCDObject /** Retrieves the placeholder that references the given FCollada document. @param document A FCollada document. - @return The placeholder for the given FCollada document. This pointer will be NULL + @return The placeholder for the given FCollada document. This pointer will be nullptr if no local entity instances reference entities within the given document. */ const FCDPlaceHolder* FindPlaceHolder(const FCDocument* document) const; inline FCDPlaceHolder* FindPlaceHolder(FCDocument* document) { return const_cast(const_cast(this)->FindPlaceHolder(document)); } /**< See above. */ diff --git a/FCollada/FCDocument/FCDExtra.cpp b/FCollada/FCDocument/FCDExtra.cpp index 6e48491..18e45be 100644 --- a/FCollada/FCDocument/FCDExtra.cpp +++ b/FCollada/FCDocument/FCDExtra.cpp @@ -41,7 +41,7 @@ FCDExtra::~FCDExtra() FCDEType* FCDExtra::AddType(const char* name) { FCDEType* type = FindType(name); - if (type == NULL) + if (type == nullptr) { type = new FCDEType(GetDocument(), this, emptyCharString); types.push_back(type); @@ -58,7 +58,7 @@ const FCDEType* FCDExtra::FindType(const char* name) const { if (IsEquivalent((*itT)->GetName(), name)) return *itT; } - return NULL; + return nullptr; } bool FCDExtra::HasContent() const @@ -78,7 +78,7 @@ bool FCDExtra::HasContent() const FCDExtra* FCDExtra::Clone(FCDExtra* clone) const { - if (clone == NULL) clone = new FCDExtra(const_cast(GetDocument()), NULL); + if (clone == nullptr) clone = new FCDExtra(const_cast(GetDocument()), nullptr); // Create all the types clone->types.reserve(types.size()); @@ -113,7 +113,7 @@ FCDEType::~FCDEType() FCDETechnique* FCDEType::AddTechnique(const char* profile) { FCDETechnique* technique = FindTechnique(profile); - if (technique == NULL) + if (technique == nullptr) { technique = new FCDETechnique(GetDocument(), this, profile); techniques.push_back(technique); @@ -129,17 +129,17 @@ const FCDETechnique* FCDEType::FindTechnique(const char* profile) const { if (IsEquivalent((*itT)->GetProfile(), profile)) return *itT; } - return NULL; + return nullptr; } // Search for a root node with a specific element name const FCDENode* FCDEType::FindRootNode(const char* name) const { - const FCDENode* rootNode = NULL; + const FCDENode* rootNode = nullptr; for (const FCDETechnique** itT = techniques.begin(); itT != techniques.end(); ++itT) { rootNode = (*itT)->FindChildNode(name); - if (rootNode != NULL) break; + if (rootNode != nullptr) break; } return rootNode; } @@ -147,9 +147,9 @@ const FCDENode* FCDEType::FindRootNode(const char* name) const FCDEType* FCDEType::Clone(FCDEType* clone) const { // If no clone is given: create one - if (clone == NULL) + if (clone == nullptr) { - clone = new FCDEType(const_cast(GetDocument()), NULL, name->c_str()); + clone = new FCDEType(const_cast(GetDocument()), nullptr, name->c_str()); } clone->techniques.reserve(techniques.size()); @@ -183,7 +183,7 @@ FCDENode::FCDENode(FCDocument* document, FCDENode* _parent) FCDENode::~FCDENode() { - parent = NULL; + parent = nullptr; } void FCDENode::SetContent(const fchar* _content) @@ -211,7 +211,7 @@ const FCDENode* FCDENode::FindChildNode(const char* name) const { if (IsEquivalent((*itN)->GetName(), name)) return (*itN); } - return NULL; + return nullptr; } void FCDENode::FindChildrenNodes(const char* name, FCDENodeList& nodes) const @@ -229,7 +229,7 @@ const FCDENode* FCDENode::FindParameter(const char* name) const const FCDENode* node = (*itN); if (IsEquivalent(node->GetName(), name)) return node; } - return NULL; + return nullptr; } void FCDENode::FindParameters(FCDENodeList& nodes, StringList& names) @@ -284,7 +284,7 @@ FCDEAttribute* FCDENode::AddAttribute(fm::string& _name, const fchar* _value) { CleanName(_name); FCDEAttribute* attribute = FindAttribute(_name.c_str()); - if (attribute == NULL) + if (attribute == nullptr) { attribute = new FCDEAttribute(); attributes.push_back(attribute); @@ -303,13 +303,13 @@ const FCDEAttribute* FCDENode::FindAttribute(const char* name) const { if (IsEquivalent((*itA)->GetName(), name)) return (*itA); } - return NULL; + return nullptr; } const fstring& FCDENode::ReadAttribute(const char* name) const { const FCDEAttribute* attribute = FindAttribute(name); - return (attribute != NULL) ? attribute->GetValue() : emptyFString; + return (attribute != nullptr) ? attribute->GetValue() : emptyFString; } FCDENode* FCDENode::AddParameter(const char* name, const fchar* value) @@ -323,7 +323,7 @@ FCDENode* FCDENode::AddParameter(const char* name, const fchar* value) FCDENode* FCDENode::Clone(FCDENode* clone) const { - if (clone == NULL) return NULL; + if (clone == nullptr) return nullptr; clone->name = name; clone->content = content; @@ -371,7 +371,7 @@ ImplementObjectType(FCDETechnique) ImplementParameterObjectNoCtr(FCDETechnique, FUObject, pluginOverride) FCDETechnique::FCDETechnique(FCDocument* document, FCDEType* /*parent*/, const char* _profile) -: FCDENode(document, NULL) +: FCDENode(document, nullptr) , InitializeParameterNoArg(pluginOverride) , InitializeParameter(profile, _profile) { @@ -381,9 +381,9 @@ FCDETechnique::~FCDETechnique() {} FCDENode* FCDETechnique::Clone(FCDENode* clone) const { - if (clone == NULL) + if (clone == nullptr) { - clone = new FCDETechnique(const_cast(GetDocument()), NULL, profile->c_str()); + clone = new FCDETechnique(const_cast(GetDocument()), nullptr, profile->c_str()); } else if (clone->GetObjectType().Includes(FCDETechnique::GetClassType())) { diff --git a/FCollada/FCDocument/FCDExtra.h b/FCollada/FCDocument/FCDExtra.h index cfe671a..6774b1b 100644 --- a/FCollada/FCDocument/FCDExtra.h +++ b/FCollada/FCDocument/FCDExtra.h @@ -80,9 +80,9 @@ class FCOLLADA_EXPORT FCDExtra : public FCDObject /** Retrieves a specific type contained by this extra tree. @param index The index of the type. - @return The type. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDEType* GetType(size_t index) { FUAssert(index < types.size(), return NULL); return types.at(index); } - inline const FCDEType* GetType(size_t index) const { FUAssert(index < types.size(), return NULL); return types.at(index); } /**< See above. */ + @return The type. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDEType* GetType(size_t index) { FUAssert(index < types.size(), return nullptr); return types.at(index); } + inline const FCDEType* GetType(size_t index) const { FUAssert(index < types.size(), return nullptr); return types.at(index); } /**< See above. */ /** Adds a new application-specific type to the extra tree. If the given application-specific type already exists @@ -95,7 +95,7 @@ class FCOLLADA_EXPORT FCDExtra : public FCDObject /** Retrieves a specific type contained by this extra tree. @param name The application-specific name of the type. @return The type that matches the name. This pointer may - be NULL if no type matches the name. */ + be nullptr if no type matches the name. */ inline FCDEType* FindType(const char* name) { return const_cast(const_cast(this)->FindType(name)); } const FCDEType* FindType(const char* name) const; /**< See above. */ inline FCDEType* FindType(const fm::string& name) { return FindType(name.c_str()); } /**< See above. */ @@ -109,10 +109,10 @@ class FCOLLADA_EXPORT FCDExtra : public FCDObject /** [INTERNAL] Clones the extra tree information. @param clone The extra tree that will take in this extra tree's information. - If this pointer is NULL, a new extra tree will be created and you will + If this pointer is nullptr, a new extra tree will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDExtra* Clone(FCDExtra* clone = NULL) const; + FCDExtra* Clone(FCDExtra* clone = nullptr) const; }; /** @@ -168,10 +168,10 @@ class FCOLLADA_EXPORT FCDEType : public FCDObject /** Retrieves a specific technique contained by this extra tree. @param index The index of the technique. - @return The technique. This pointer will be NULL if the + @return The technique. This pointer will be nullptr if the index is out-of-bounds. */ - inline FCDETechnique* GetTechnique(size_t index) { FUAssert(index < techniques.size(), return NULL); return techniques.at(index); } - inline const FCDETechnique* GetTechnique(size_t index) const { FUAssert(index < techniques.size(), return NULL); return techniques.at(index); } /**< See above. */ + inline FCDETechnique* GetTechnique(size_t index) { FUAssert(index < techniques.size(), return nullptr); return techniques.at(index); } + inline const FCDETechnique* GetTechnique(size_t index) const { FUAssert(index < techniques.size(), return nullptr); return techniques.at(index); } /**< See above. */ /** Adds a new application-specific profile technique to the extra tree. If the given application-specific profile already exists @@ -184,7 +184,7 @@ class FCOLLADA_EXPORT FCDEType : public FCDObject /** Retrieves a specific technique contained by this extra tree. @param profile The application-specific profile name of the technique. @return The technique that matches the profile name. This pointer may - be NULL if no technique matches the profile name. */ + be nullptr if no technique matches the profile name. */ FCDETechnique* FindTechnique(const char* profile) { return const_cast(const_cast(this)->FindTechnique(profile)); } const FCDETechnique* FindTechnique(const char* profile) const; /**< See above. */ inline FCDETechnique* FindTechnique(const fm::string& profile) { return FindTechnique(profile.c_str()); } /**< See above. */ @@ -195,7 +195,7 @@ class FCOLLADA_EXPORT FCDEType : public FCDObject techniques. @param name An element name. @return The extra tree node that matches the element name. This pointer - will be NULL if no extra tree node matches the element name. */ + will be nullptr if no extra tree node matches the element name. */ inline FCDENode* FindRootNode(const char* name) { return const_cast(const_cast(this)->FindRootNode(name)); } const FCDENode* FindRootNode(const char* name) const; /**< See above. */ inline FCDENode* FindRootNode(const fm::string& name) { return FindRootNode(name.c_str()); } /**< See above. */ @@ -203,10 +203,10 @@ class FCOLLADA_EXPORT FCDEType : public FCDObject /** [INTERNAL] Clones the extra tree information. @param clone The extra tree that will take in this extra tree's information. - If this pointer is NULL, a new extra tree will be created and you will + If this pointer is nullptr, a new extra tree will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDEType* Clone(FCDEType* clone = NULL) const; + FCDEType* Clone(FCDEType* clone = nullptr) const; }; /** @@ -294,7 +294,7 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject The hierarchy cannot be changed dynamically. If you to move an extra tree node, you will need to clone it manually and release the old extra tree node. @return The parent extra tree node within the hierarchy. This pointer - will be NULL if the extra tree node is a extra tree technique. */ + will be nullptr if the extra tree node is a extra tree technique. */ FCDENode* GetParent() { return parent; } const FCDENode* GetParent() const { return parent; } /**< See above. */ @@ -308,10 +308,10 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject /** Retrieves a specific child extra tree node. @param index The index of the child extra tree node. - @return The child extra tree node. This pointer will be NULL if the index + @return The child extra tree node. This pointer will be nullptr if the index is out-of-bounds. */ - FCDENode* GetChildNode(size_t index) { FUAssert(index < children.size(), return NULL); return children.at(index); } - const FCDENode* GetChildNode(size_t index) const { FUAssert(index < children.size(), return NULL); return children.at(index); } /**< See above. */ + FCDENode* GetChildNode(size_t index) { FUAssert(index < children.size(), return nullptr); return children.at(index); } + const FCDENode* GetChildNode(size_t index) const { FUAssert(index < children.size(), return nullptr); return children.at(index); } /**< See above. */ /** Adds a new child extra tree to this extra tree node. @see AddParameter @@ -328,7 +328,7 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject /** Retrieves the child extra tree node with the given name. @param name A name. @return The child extra tree node that matches the given name. - This pointer will be NULL if no child extra tree node matches + This pointer will be nullptr if no child extra tree node matches the given name. */ inline FCDENode* FindChildNode(const char* name) { return const_cast(const_cast(this)->FindChildNode(name)); } const FCDENode* FindChildNode(const char* name) const; /**< See above. */ @@ -347,7 +347,7 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject The first child extra tree node where the name matches 'X' will be returned. @param name The parameter name. @return The first child extra tree node holding the wanted parameter within the hierarchy. - This pointer will be NULL to indicate that no parameter matches the given name. */ + This pointer will be nullptr to indicate that no parameter matches the given name. */ const FCDENode* FindParameter(const char* name) const; inline FCDENode* FindParameter(const char* name) { return const_cast(const_cast(this)->FindParameter(name)); } /**< See above. */ @@ -368,10 +368,10 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject /** Retrieves a specific attribute of this extra tree node. @param index The index. - @return The attribute at this index. This pointer will be NULL + @return The attribute at this index. This pointer will be nullptr if the index is out-of-bounds. */ - FCDEAttribute* GetAttribute(size_t index) { FUAssert(index < attributes.size(), return NULL); return attributes.at(index); } - const FCDEAttribute* GetAttribute(size_t index) const { FUAssert(index < attributes.size(), return NULL); return attributes.at(index); } /**< See above. */ + FCDEAttribute* GetAttribute(size_t index) { FUAssert(index < attributes.size(), return nullptr); return attributes.at(index); } + const FCDEAttribute* GetAttribute(size_t index) const { FUAssert(index < attributes.size(), return nullptr); return attributes.at(index); } /**< See above. */ /** Adds a new attribute to this extra tree node. If an attribute with the same name already exists, this function simply @@ -393,7 +393,7 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject /** Retrieve the attribute of this extra tree node with the given name. Attribute names are unique within an extra tree node. @param name The attribute name. - @return The attribute that matches the name. This pointer will be NULL if + @return The attribute that matches the name. This pointer will be nullptr if there is no attribute with the given name. */ inline FCDEAttribute* FindAttribute(const char* name) { return const_cast(const_cast(this)->FindAttribute(name)); } const FCDEAttribute* FindAttribute(const char* name) const; /**< See above. */ @@ -422,7 +422,7 @@ class FCOLLADA_EXPORT FCDENode : public FCDObject /** Clones the extra tree node. @param clone The extra tree node that will receive the clone information. - This pointer cannot be NULL. + This pointer cannot be nullptr. @return The clone. You will need to release the returned pointer manually. */ virtual FCDENode* Clone(FCDENode* clone) const; }; @@ -478,7 +478,7 @@ class FCOLLADA_EXPORT FCDETechnique : public FCDENode /** Clones the extra tree node. @param clone The extra tree node that will receive the clone information. - If this pointer is NULL, a new extra tree technique will be created and you will + If this pointer is nullptr, a new extra tree technique will be created and you will need to release the returned pointer manually. @return The clone. */ virtual FCDENode* Clone(FCDENode* clone) const; diff --git a/FCollada/FCDocument/FCDForceField.cpp b/FCollada/FCDocument/FCDForceField.cpp index 680b799..ba81420 100644 --- a/FCollada/FCDocument/FCDForceField.cpp +++ b/FCollada/FCDocument/FCDForceField.cpp @@ -36,7 +36,7 @@ FCDForceField::~FCDForceField() const FCDExtra* FCDForceField::GetInformation() const { - if (information == NULL) + if (information == nullptr) { const_cast(this)->information = new FCDExtra(const_cast(GetDocument()), const_cast(this)); } @@ -45,13 +45,13 @@ const FCDExtra* FCDForceField::GetInformation() const FCDEntity* FCDForceField::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDForceField* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDForceField(const_cast(GetDocument())); + FCDForceField* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDForceField(const_cast(GetDocument())); else if (_clone->HasType(FCDForceField::GetClassType())) clone = (FCDForceField*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the extra information. diff --git a/FCollada/FCDocument/FCDForceField.h b/FCollada/FCDocument/FCDForceField.h index cdfac3b..57f8227 100644 --- a/FCollada/FCDocument/FCDForceField.h +++ b/FCollada/FCDocument/FCDForceField.h @@ -59,11 +59,11 @@ class FCOLLADA_EXPORT FCDForceField : public FCDEntity /** Clones the force field information. @param clone The cloned force field. - If this pointer is NULL, a new force field is created and + If this pointer is nullptr, a new force field is created and you will need to release it manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_FORCE_FIELD_H_ diff --git a/FCollada/FCDocument/FCDGeometry.cpp b/FCollada/FCDocument/FCDGeometry.cpp index f2ce9c5..10b6ca1 100644 --- a/FCollada/FCDocument/FCDGeometry.cpp +++ b/FCollada/FCDocument/FCDGeometry.cpp @@ -37,7 +37,7 @@ FCDGeometry::~FCDGeometry() // Sets the type of this geometry to mesh and creates an empty mesh structure. FCDGeometryMesh* FCDGeometry::CreateMesh() { - spline = NULL; + spline = nullptr; mesh = new FCDGeometryMesh(GetDocument(), this); SetNewChildFlag(); return mesh; @@ -46,7 +46,7 @@ FCDGeometryMesh* FCDGeometry::CreateMesh() // Sets the type of this geometry to spline and creates an empty spline structure. FCDGeometrySpline* FCDGeometry::CreateSpline() { - mesh = NULL; + mesh = nullptr; spline = new FCDGeometrySpline(GetDocument(), this); SetNewChildFlag(); return spline; @@ -55,13 +55,13 @@ FCDGeometrySpline* FCDGeometry::CreateSpline() FCDEntity* FCDGeometry::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDGeometry* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDGeometry(const_cast(GetDocument())); + FCDGeometry* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDGeometry(const_cast(GetDocument())); else if (_clone->HasType(FCDGeometry::GetClassType())) clone = (FCDGeometry*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the geometric object if (IsMesh()) diff --git a/FCollada/FCDocument/FCDGeometry.h b/FCollada/FCDocument/FCDGeometry.h index 606a4fd..6d13bd6 100644 --- a/FCollada/FCDocument/FCDGeometry.h +++ b/FCollada/FCDocument/FCDGeometry.h @@ -81,11 +81,11 @@ class FCOLLADA_EXPORT FCDGeometry : public FCDEntity /** Retrieves whether the type of this geometry is a mesh. @return Whether this geometry is a mesh. */ - bool IsMesh() const { return mesh != NULL; } + bool IsMesh() const { return mesh != nullptr; } /** Retrieves the mesh information structure for this geometry. Verify that this geometry is a mesh using the IsMesh function prior to calling this function. - @return The mesh information structure. This pointer will be NULL when the geometry is a spline or is undefined. */ + @return The mesh information structure. This pointer will be nullptr when the geometry is a spline or is undefined. */ FCDGeometryMesh* GetMesh() { return mesh; } const FCDGeometryMesh* GetMesh() const { return mesh; } /**< See above. */ @@ -96,11 +96,11 @@ class FCOLLADA_EXPORT FCDGeometry : public FCDEntity /** Retrieves whether the type of this geometry is a spline. @return Whether this geometry is a spline. */ - bool IsSpline() const { return spline != NULL; } + bool IsSpline() const { return spline != nullptr; } /** Retrieves the spline information structure for this geometry. Verify that this geometry is a spline using the IsSpline function prior to calling this function. - @return The spline information structure. This pointer will be NULL when the geometry is a mesh or is undefined. */ + @return The spline information structure. This pointer will be nullptr when the geometry is a mesh or is undefined. */ FCDGeometrySpline* GetSpline() { return spline; } const FCDGeometrySpline* GetSpline() const { return spline; } /**< See above. */ @@ -116,11 +116,11 @@ class FCOLLADA_EXPORT FCDGeometry : public FCDEntity /** Copies the geometry entity into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new geometry entity + @param clone The empty clone. If this pointer is nullptr, a new geometry entity will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_GEOMETRY_H_ diff --git a/FCollada/FCDocument/FCDGeometryInstance.cpp b/FCollada/FCDocument/FCDGeometryInstance.cpp index 9c2ee74..3df1876 100644 --- a/FCollada/FCDocument/FCDGeometryInstance.cpp +++ b/FCollada/FCDocument/FCDGeometryInstance.cpp @@ -62,7 +62,7 @@ const FCDMaterialInstance* FCDGeometryInstance::FindMaterialInstance(const fchar { if ((*itB)->GetSemantic() == semantic) return (*itB); } - return NULL; + return nullptr; } FCDMaterialInstance* FCDGeometryInstance::AddMaterialInstance() @@ -77,7 +77,7 @@ FCDMaterialInstance* FCDGeometryInstance::AddMaterialInstance(FCDMaterial* mater { FCDMaterialInstance* instance = AddMaterialInstance(); instance->SetMaterial(material); - if (polygons != NULL) + if (polygons != nullptr) { const fstring& semantic = polygons->GetMaterialSemantic(); if (!semantic.empty()) @@ -106,8 +106,8 @@ FCDMaterialInstance* FCDGeometryInstance::AddMaterialInstance(FCDMaterial* mater FCDEntityInstance* FCDGeometryInstance::Clone(FCDEntityInstance* _clone) const { - FCDGeometryInstance* clone = NULL; - if (_clone == NULL) clone = new FCDGeometryInstance(const_cast(GetDocument()), const_cast(GetParent()), GetEntityType()); + FCDGeometryInstance* clone = nullptr; + if (_clone == nullptr) clone = new FCDGeometryInstance(const_cast(GetDocument()), const_cast(GetParent()), GetEntityType()); else if (!_clone->HasType(FCDGeometryInstance::GetClassType())) return Parent::Clone(_clone); else clone = (FCDGeometryInstance*) _clone; diff --git a/FCollada/FCDocument/FCDGeometryInstance.h b/FCollada/FCDocument/FCDGeometryInstance.h index 8f7c6af..0e80310 100644 --- a/FCollada/FCDocument/FCDGeometryInstance.h +++ b/FCollada/FCDocument/FCDGeometryInstance.h @@ -46,7 +46,7 @@ class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance protected: /** Constructor. @param document The FCollada document that owns this instance. - @param parent The visual scene node that contains this instance. This pointer will be NULL for + @param parent The visual scene node that contains this instance. This pointer will be nullptr for instances that are not directly under a visual scene node. @param entityType The type of entity to instantiate. */ FCDGeometryInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type entityType = FCDEntity::GEOMETRY); @@ -68,8 +68,8 @@ class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance /** Retrieves a given local effect parameter. @param index An index. @return The local effect parameter at the given index. */ - inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } - inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } + inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } + inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } /** Adds a local effect parameter to the local list. @see FCDEffectParameter::Type @@ -80,7 +80,7 @@ class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance /** Retrieves a material instance bound to the given material semantic. @param semantic A material semantic. @return The material instance bound to the given material semantic. - This pointer will be NULL if the material semantic has no material + This pointer will be nullptr if the material semantic has no material instance binding to it. */ inline FCDMaterialInstance* FindMaterialInstance(const fchar* semantic) { return const_cast(const_cast(this)->FindMaterialInstance(semantic)); } inline FCDMaterialInstance* FindMaterialInstance(const fstring& semantic) { return FindMaterialInstance(semantic.c_str()); } /**< See above. */ @@ -94,8 +94,8 @@ class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance /** Retrieves a material instance. @param index The index of the material instance. @return The material instance at the given index. */ - inline FCDMaterialInstance* GetMaterialInstance(size_t index) { FUAssert(index < materials.size(), return NULL); return materials.at(index); } - inline const FCDMaterialInstance* GetMaterialInstance(size_t index) const { FUAssert(index < materials.size(), return NULL); return materials.at(index); } /**< See above. */ + inline FCDMaterialInstance* GetMaterialInstance(size_t index) { FUAssert(index < materials.size(), return nullptr); return materials.at(index); } + inline const FCDMaterialInstance* GetMaterialInstance(size_t index) const { FUAssert(index < materials.size(), return nullptr); return materials.at(index); } /**< See above. */ /** Retrieves the material instances. @return The list of material instances. */ @@ -128,9 +128,9 @@ class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance /** Clones the geometry instance. @param clone The geometry instance to become the clone. If this pointer - is NULL, a new geometry instance will be created. + is nullptr, a new geometry instance will be created. @return The cloned geometry instance. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; /** [INTERNAL] Cleans up the sub identifiers. The sub identifiers must be unique with respect to its parent. This method corrects the sub ids if there are conflicts. diff --git a/FCollada/FCDocument/FCDGeometryMesh.cpp b/FCollada/FCDocument/FCDGeometryMesh.cpp index c5d84ea..a916915 100644 --- a/FCollada/FCDocument/FCDGeometryMesh.cpp +++ b/FCollada/FCDocument/FCDGeometryMesh.cpp @@ -47,7 +47,7 @@ FCDGeometryMesh::~FCDGeometryMesh() polygons.clear(); sources.clear(); faceVertexCount = faceCount = holeCount = 0; - parent = NULL; + parent = nullptr; } // Retrieve the parent's id @@ -65,12 +65,12 @@ void FCDGeometryMesh::SetConvexHullOf(FCDGeometry* _geom) const FCDGeometryMesh* FCDGeometryMesh::FindConvexHullOfMesh() const { const FCDGeometryMesh* mesh = this; - while ((mesh != NULL) && !mesh->GetConvexHullOf().empty()) + while ((mesh != nullptr) && !mesh->GetConvexHullOf().empty()) { const FCDocument* document = mesh->GetDocument(); const FCDGeometry* geometry = document->GetGeometryLibrary()-> FindDaeId(mesh->GetConvexHullOf()); - if (geometry == NULL) return NULL; + if (geometry == nullptr) return nullptr; mesh = geometry->GetMesh(); } return mesh; @@ -85,7 +85,7 @@ const FCDGeometrySource* FCDGeometryMesh::FindSourceById(const fm::string& id) c { if ((*it)->GetDaeId() == localId) return (*it); } - return NULL; + return nullptr; } // Retrieve the source for the given type @@ -95,7 +95,7 @@ const FCDGeometrySource* FCDGeometryMesh::FindSourceByType(FUDaeGeometryInput::S { if ((*itS)->GetType() == type) return (*itS); } - return NULL; + return nullptr; } void FCDGeometryMesh::FindSourcesByType(FUDaeGeometryInput::Semantic type, FCDGeometrySourceConstList& _sources) const @@ -112,7 +112,7 @@ const FCDGeometrySource* FCDGeometryMesh::FindSourceByName(const fstring& name) { if ((*itS)->GetName() == name) return (*itS); } - return NULL; + return nullptr; } // Creates a new polygon group. @@ -129,7 +129,7 @@ FCDGeometryPolygons* FCDGeometryMesh::AddPolygons() } SetNewChildFlag(); - if (parent != NULL) parent->SetNewChildFlag(); + if (parent != nullptr) parent->SetNewChildFlag(); return polys; } @@ -173,7 +173,7 @@ FCDGeometrySource* FCDGeometryMesh::AddVertexSource(FUDaeGeometryInput::Semantic // Sets a source as per-vertex data. void FCDGeometryMesh::AddVertexSource(FCDGeometrySource* source) { - FUAssert(source != NULL, return); + FUAssert(source != nullptr, return); FUAssert(!vertexSources.contains(source), return); // Add the source to the list of per-vertex sources. @@ -184,7 +184,7 @@ void FCDGeometryMesh::AddVertexSource(FCDGeometrySource* source) for (size_t p = 0; p < polygonsCount; ++p) { FCDGeometryPolygonsInput* input = polygons[p]->FindInput(source); - int32 set = (input != NULL) ? input->GetSet() : -1; + int32 set = (input != nullptr) ? input->GetSet() : -1; SAFE_RELEASE(input); input = polygons[p]->AddInput(source, 0); if (set > -1) input->SetSet(set); @@ -195,7 +195,7 @@ void FCDGeometryMesh::AddVertexSource(FCDGeometrySource* source) void FCDGeometryMesh::RemoveVertexSource(FCDGeometrySource* source) { - FUAssert(source != NULL, return); + FUAssert(source != nullptr, return); if (!vertexSources.contains(source)) return; // Add the source to the list of per-vertex sources. @@ -235,7 +235,7 @@ void FCDGeometryMesh::Recalculate() FCDGeometryMesh* FCDGeometryMesh::Clone(FCDGeometryMesh* clone) const { - if (clone == NULL) clone = new FCDGeometryMesh(const_cast(GetDocument()), NULL); + if (clone == nullptr) clone = new FCDGeometryMesh(const_cast(GetDocument()), nullptr); // Copy the miscellaneous information clone->convexHullOf = convexHullOf; diff --git a/FCollada/FCDocument/FCDGeometryMesh.h b/FCollada/FCDocument/FCDGeometryMesh.h index 34094d8..f958c10 100644 --- a/FCollada/FCDocument/FCDGeometryMesh.h +++ b/FCollada/FCDocument/FCDGeometryMesh.h @@ -129,7 +129,7 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject /** Retrieves the convex hull of this mesh. @return The convex hull geometry created using this mesh. This pointer will be - NULL if no convex hull was created using this mesh. */ + nullptr if no convex hull was created using this mesh. */ inline FCDGeometryMesh* FindConvexHullOfMesh() { return const_cast(const_cast(this)->FindConvexHullOfMesh()); } const FCDGeometryMesh* FindConvexHullOfMesh() const; /**< See above. */ @@ -160,15 +160,15 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject or to assign partial texture coordinates and texture tangents to different parts of the mesh. @param index The index of the polygon group. This index should be less than the number of independent polygon groups returned by the GetPolygonsCount function. - @return The polygon group. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDGeometryPolygons* GetPolygons(size_t index) { FUAssert(index < GetPolygonsCount(), return NULL); return polygons.at(index); } - inline const FCDGeometryPolygons* GetPolygons(size_t index) const { FUAssert(index < GetPolygonsCount(), return NULL); return polygons.at(index); } /**< See above. */ + @return The polygon group. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDGeometryPolygons* GetPolygons(size_t index) { FUAssert(index < GetPolygonsCount(), return nullptr); return polygons.at(index); } + inline const FCDGeometryPolygons* GetPolygons(size_t index) const { FUAssert(index < GetPolygonsCount(), return nullptr); return polygons.at(index); } /**< See above. */ /** Creates a new polygon group. Each polygon group is represented within a FCDGeometryPolygons object. The new polygon group will be assigned all the existing per-vertex data sources. No material will be assigned to the new polygon group. - @return The new polygon group. This pointer should never be NULL. */ + @return The new polygon group. This pointer should never be nullptr. */ FCDGeometryPolygons* AddPolygons(); /** Retrieves if the mesh consists of only triangles. @@ -198,16 +198,16 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject All the per-vertex data sources are also included in the list of data sources. @param index The index of the per-vertex data source. This index should be less than the number of per-vertex data sources returns by the GetVertexSourceCount function. - @return The per-vertex data source. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDGeometrySource* GetVertexSource(size_t index) { FUAssert(index < GetVertexSourceCount(), return NULL); return vertexSources.at(index); } - inline const FCDGeometrySource* GetVertexSource(size_t index) const { FUAssert(index < GetVertexSourceCount(), return NULL); return vertexSources.at(index); } /**< See above. */ + @return The per-vertex data source. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDGeometrySource* GetVertexSource(size_t index) { FUAssert(index < GetVertexSourceCount(), return nullptr); return vertexSources.at(index); } + inline const FCDGeometrySource* GetVertexSource(size_t index) const { FUAssert(index < GetVertexSourceCount(), return nullptr); return vertexSources.at(index); } /**< See above. */ /** Creates a new per-vertex data source for this geometric mesh. The per-vertex data source will be added to both the per-vertex data source list and the data source list. The new per-vertex data source will automatically be added to all the existing polygon groups. @param type The type of data that will be contained within the source. Defaults to UNKNOWN, so that you may provide the source type later. - @return The new per-vertex data source. This pointer should never be NULL. */ + @return The new per-vertex data source. This pointer should never be nullptr. */ FCDGeometrySource* AddVertexSource(FUDaeGeometryInput::Semantic type = FUDaeGeometryInput::UNKNOWN); /** Sets a source as per-vertex data. @@ -226,20 +226,20 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject /** [INTERNAL] Retrieves the data source that matches the given COLLADA id. @param id A valid COLLADA id. - @return The data source. This pointer will be NULL if no matching data source was found. */ + @return The data source. This pointer will be nullptr if no matching data source was found. */ FCDGeometrySource* FindSourceById(const fm::string& id) { return const_cast(const_cast(this)->FindSourceById(id)); } const FCDGeometrySource* FindSourceById(const fm::string& id) const; /**< See above. */ /** Retrieves the first data source that matches the given geometry data type. @param type A geometry data type. - @return The first data source that matches the data type. This pointer will be NULL + @return The first data source that matches the data type. This pointer will be nullptr if no matching data source was found. */ FCDGeometrySource* FindSourceByType(FUDaeGeometryInput::Semantic type) { return const_cast(const_cast(this)->FindSourceByType(type)); } const FCDGeometrySource* FindSourceByType(FUDaeGeometryInput::Semantic type) const; /**< See above. */ /** Retrieves the first data source that matches the given name. @param name A valid COLLADA name. - @return The first data source that matches the name. This pointer will be NULL + @return The first data source that matches the name. This pointer will be nullptr if no matching data source was found. */ FCDGeometrySource* FindSourceByName(const fstring& name) { return const_cast(const_cast(this)->FindSourceByName(name)); } const FCDGeometrySource* FindSourceByName(const fstring& name) const; /**< See above. */ @@ -254,7 +254,7 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject /** Retrieves the per-vertex data that specifically contains the vertex positions. If there are more than one per-vertex data source that contains vertex positions, the first one is returned. @deprecated Use FindSourceByType instead. - @return A per-vertex data source that contains vertex positions. This pointer will be NULL + @return A per-vertex data source that contains vertex positions. This pointer will be nullptr in the unlikely possibility that there are no per-vertex data source that contains vertex positions. */ FCDGeometrySource* GetPositionSource() { return FindSourceByType(FUDaeGeometryInput::POSITION); } const FCDGeometrySource* GetPositionSource() const { return FindSourceByType(FUDaeGeometryInput::POSITION); } /**< See above. */ @@ -271,23 +271,23 @@ class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject /** Retrieves a specific data source. @param index The index of the data source. This index should be less than the number of data sources returns by the GetSourceCount function. - @return The data source. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDGeometrySource* GetSource(size_t index) { FUAssert(index < GetSourceCount(), return NULL); return sources.at(index); } - inline const FCDGeometrySource* GetSource(size_t index) const { FUAssert(index < GetSourceCount(), return NULL); return sources.at(index); } /**< See above. */ + @return The data source. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDGeometrySource* GetSource(size_t index) { FUAssert(index < GetSourceCount(), return nullptr); return sources.at(index); } + inline const FCDGeometrySource* GetSource(size_t index) const { FUAssert(index < GetSourceCount(), return nullptr); return sources.at(index); } /**< See above. */ /** Creates a new data source for this geometric mesh. The new data source will not be added to any of the existing polygon groups. @param type The type of data that will be contained within the source. Defaults to UNKNOWN, so that you may provide the source type later. - @return The new per-vertex data source. This pointer should never be NULL. */ + @return The new per-vertex data source. This pointer should never be nullptr. */ FCDGeometrySource* AddSource(FUDaeGeometryInput::Semantic type = FUDaeGeometryInput::UNKNOWN); /** Copies the mesh into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new mesh + @param clone The empty clone. If this pointer is nullptr, a new mesh will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDGeometryMesh* Clone(FCDGeometryMesh* clone = NULL) const; + FCDGeometryMesh* Clone(FCDGeometryMesh* clone = nullptr) const; /** [INTERNAL] Forces the recalculation of the hole count, vertex count, face-vertex counts and their offsets. Since the counts and offsets are buffered at the geometric mesh object level, this function allows the polygon diff --git a/FCollada/FCDocument/FCDGeometryPolygons.cpp b/FCollada/FCDocument/FCDGeometryPolygons.cpp index 5e411a4..7b36373 100644 --- a/FCollada/FCDocument/FCDGeometryPolygons.cpp +++ b/FCollada/FCDocument/FCDGeometryPolygons.cpp @@ -46,12 +46,12 @@ FCDGeometryPolygons::FCDGeometryPolygons(FCDocument* document, FCDGeometryMesh* FCDGeometryPolygons::~FCDGeometryPolygons() { holeFaces.clear(); - parent = NULL; + parent = nullptr; } FCDExtra* FCDGeometryPolygons::GetExtra() { - return (extra != NULL) ? extra : (extra = new FCDExtra(GetDocument(), this)); + return (extra != nullptr) ? extra : (extra = new FCDExtra(GetDocument(), this)); } // Creates a new face. @@ -220,7 +220,7 @@ const FCDGeometryPolygonsInput* FCDGeometryPolygons::FindInput(FUDaeGeometryInpu { if ((*it)->GetSemantic() == semantic) return (*it); } - return NULL; + return nullptr; } const FCDGeometryPolygonsInput* FCDGeometryPolygons::FindInput(const FCDGeometrySource* source) const @@ -229,7 +229,7 @@ const FCDGeometryPolygonsInput* FCDGeometryPolygons::FindInput(const FCDGeometry { if ((*it)->GetSource() == source) return (*it); } - return NULL; + return nullptr; } FCDGeometryPolygonsInput* FCDGeometryPolygons::FindInput(const fm::string& sourceId) @@ -242,7 +242,7 @@ FCDGeometryPolygonsInput* FCDGeometryPolygons::FindInput(const fm::string& sourc FCDGeometryPolygonsInput* input = inputs[i]; if (input->GetSource()->GetDaeId() == s) return input; } - return NULL; + return nullptr; } void FCDGeometryPolygons::FindInputs(FUDaeGeometryInput::Semantic semantic, FCDGeometryPolygonsInputConstList& _inputs) const @@ -287,7 +287,7 @@ int32 FCDGeometryPolygons::TestPolyType() const // Clone this list of polygons FCDGeometryPolygons* FCDGeometryPolygons::Clone(FCDGeometryPolygons* clone, const FCDGeometrySourceCloneMap& cloneMap) const { - if (clone == NULL) return NULL; + if (clone == nullptr) return nullptr; // Clone the miscellaneous information. clone->materialSemantic = materialSemantic; @@ -305,7 +305,7 @@ FCDGeometryPolygons* FCDGeometryPolygons::Clone(FCDGeometryPolygons* clone, cons for (size_t i = 0; i < inputCount; ++i) { // Find the cloned source that correspond to the original input. - FCDGeometrySource* cloneSource = NULL; + FCDGeometrySource* cloneSource = nullptr; FCDGeometrySourceCloneMap::const_iterator it = cloneMap.find(inputs[i]->GetSource()); if (it == cloneMap.end()) { @@ -320,7 +320,7 @@ FCDGeometryPolygons* FCDGeometryPolygons::Clone(FCDGeometryPolygons* clone, cons // Retrieve or create the input to clone. FCDGeometryPolygonsInput* input = clone->FindInput(cloneSource); - if (input == NULL) + if (input == nullptr) { input = clone->AddInput(cloneSource, inputs[i]->GetOffset()); } diff --git a/FCollada/FCDocument/FCDGeometryPolygons.h b/FCollada/FCDocument/FCDGeometryPolygons.h index 761f30e..37c901e 100644 --- a/FCollada/FCDocument/FCDGeometryPolygons.h +++ b/FCollada/FCDocument/FCDGeometryPolygons.h @@ -254,9 +254,9 @@ class FCOLLADA_EXPORT FCDGeometryPolygons : public FCDObject /** Retrieves a specific polygon set input. @param index The index of the polygon set input. This index should not be greater than or equal to the number of polygon set inputs. - @return The specific polygon set input. This pointer will be NULL if the index is out-of-bounds. */ - inline FCDGeometryPolygonsInput* GetInput(size_t index) { FUAssert(index < GetInputCount(), return NULL); return inputs.at(index); } - inline const FCDGeometryPolygonsInput* GetInput(size_t index) const { FUAssert(index < GetInputCount(), return NULL); return inputs.at(index); } /**< See above. */ + @return The specific polygon set input. This pointer will be nullptr if the index is out-of-bounds. */ + inline FCDGeometryPolygonsInput* GetInput(size_t index) { FUAssert(index < GetInputCount(), return nullptr); return inputs.at(index); } + inline const FCDGeometryPolygonsInput* GetInput(size_t index) const { FUAssert(index < GetInputCount(), return nullptr); return inputs.at(index); } /**< See above. */ /** Creates a new polygon set input. @param source The data source for the polygon set input. @@ -312,21 +312,21 @@ class FCOLLADA_EXPORT FCDGeometryPolygons : public FCDObject /** Retrieves the first polygon set input found that has the given data type. @param semantic A type of geometry data. - @return The polygon set input. This pointer will be NULL if + @return The polygon set input. This pointer will be nullptr if no polygon set input matches the data type. */ FCDGeometryPolygonsInput* FindInput(FUDaeGeometryInput::Semantic semantic) { return const_cast(const_cast(this)->FindInput(semantic)); } const FCDGeometryPolygonsInput* FindInput(FUDaeGeometryInput::Semantic semantic) const; /**< See above. */ /** Retrieves the polygon set input that points towards a given data source. @param source A geometry data source. - @return The polygon set input. This pointer will be NULL if + @return The polygon set input. This pointer will be nullptr if no polygon set input matches the data source. */ FCDGeometryPolygonsInput* FindInput(const FCDGeometrySource* source) { return const_cast(const_cast(this)->FindInput(source)); } const FCDGeometryPolygonsInput* FindInput(const FCDGeometrySource* source) const; /**< See above. */ /** [INTERNAL] Retrieves the polygon set input that points towards a given data source. @param sourceId The COLLADA id of a geometry data source. - @return The polygon set input. This pointer will be NULL if + @return The polygon set input. This pointer will be nullptr if no polygon set input matches the COLLADA id. */ FCDGeometryPolygonsInput* FindInput(const fm::string& sourceId); diff --git a/FCollada/FCDocument/FCDGeometryPolygonsInput.cpp b/FCollada/FCDocument/FCDGeometryPolygonsInput.cpp index 2e32322..6a8aa6f 100644 --- a/FCollada/FCDocument/FCDGeometryPolygonsInput.cpp +++ b/FCollada/FCDocument/FCDGeometryPolygonsInput.cpp @@ -30,16 +30,16 @@ FCDGeometryPolygonsInput::FCDGeometryPolygonsInput(FCDocument* document, FCDGeom FCDGeometryPolygonsInput::~FCDGeometryPolygonsInput() { - if (source != NULL) + if (source != nullptr) { UntrackObject(source); - source = NULL; + source = nullptr; } } FUDaeGeometryInput::Semantic FCDGeometryPolygonsInput::GetSemantic() const { - FUAssert(source != NULL, return FUDaeGeometryInput::UNKNOWN); + FUAssert(source != nullptr, return FUDaeGeometryInput::UNKNOWN); return source->GetType(); } @@ -47,9 +47,9 @@ FUDaeGeometryInput::Semantic FCDGeometryPolygonsInput::GetSemantic() const void FCDGeometryPolygonsInput::SetSource(FCDGeometrySource* _source) { // Untrack the old source and track the new source - if (source != NULL) UntrackObject(source); + if (source != nullptr) UntrackObject(source); source = _source; - if (source != NULL) TrackObject(source); + if (source != nullptr) TrackObject(source); } // Callback when the tracked source is released. @@ -57,7 +57,7 @@ void FCDGeometryPolygonsInput::OnObjectReleased(FUTrackable* object) { if (source == object) { - source = NULL; + source = nullptr; // Verify whether we own/share the index list. if (!indices.empty()) diff --git a/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp b/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp index 1e62a0c..e5d77d3 100644 --- a/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp +++ b/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp @@ -20,7 +20,7 @@ namespace FCDGeometryPolygonsTools // Triangulates a mesh. void Triangulate(FCDGeometryMesh* mesh) { - if (mesh == NULL) return; + if (mesh == nullptr) return; size_t polygonsCount = mesh->GetPolygonsCount(); for (size_t i = 0; i < polygonsCount; ++i) @@ -35,7 +35,7 @@ namespace FCDGeometryPolygonsTools // Triangulates a polygons set. void Triangulate(FCDGeometryPolygons* polygons, bool recalculate) { - if (polygons == NULL) return; + if (polygons == nullptr) return; if (polygons->GetPrimitiveType() == FCDGeometryPolygons::LINE_STRIPS || polygons->GetPrimitiveType() == FCDGeometryPolygons::LINES || polygons->GetPrimitiveType() == FCDGeometryPolygons::POINTS) return; // Pre-allocate and ready the end index/count buffers @@ -177,11 +177,11 @@ namespace FCDGeometryPolygonsTools // Generates the texture tangents and binormals for a given source of texture coordinates. void GenerateTextureTangentBasis(FCDGeometryMesh* mesh, FCDGeometrySource* texcoordSource, bool generateBinormals) { - if (texcoordSource == NULL || mesh == NULL) return; + if (texcoordSource == nullptr || mesh == nullptr) return; // First count the positions. FCDGeometrySource* positionSource = mesh->FindSourceByType(FUDaeGeometryInput::POSITION); - if (positionSource == NULL) return; + if (positionSource == nullptr) return; size_t globalVertexCount = positionSource->GetValueCount(); // Allocate the tangential vertices. @@ -198,16 +198,16 @@ namespace FCDGeometryPolygonsTools // Verify that this polygons set uses the given texture coordinate source. FCDGeometryPolygonsInput* texcoordInput = polygons->FindInput(texcoordSource); - if (texcoordInput == NULL) continue; + if (texcoordInput == nullptr) continue; // Retrieve the data and index buffer of positions/normals/texcoords for this polygons set. FCDGeometryPolygonsInput* positionInput = polygons->FindInput(FUDaeGeometryInput::POSITION); FCDGeometryPolygonsInput* normalsInput = polygons->FindInput(FUDaeGeometryInput::NORMAL); - if (positionInput == NULL || normalsInput == NULL) continue; + if (positionInput == nullptr || normalsInput == nullptr) continue; FCDGeometrySource* positionSource = positionInput->GetSource(); FCDGeometrySource* normalsSource = normalsInput->GetSource(); FCDGeometrySource* texcoordSource = texcoordInput->GetSource(); - if (positionSource == NULL || normalsSource == NULL || texcoordSource == NULL) continue; + if (positionSource == nullptr || normalsSource == nullptr || texcoordSource == nullptr) continue; uint32 positionStride = positionSource->GetStride(); uint32 normalsStride = normalsSource->GetStride(); uint32 texcoordStride = texcoordSource->GetStride(); @@ -216,7 +216,7 @@ namespace FCDGeometryPolygonsTools uint32* normalsIndices = normalsInput->GetIndices(); uint32* texcoordIndices = texcoordInput->GetIndices(); size_t indexCount = positionInput->GetIndexCount(); - if (positionIndices == NULL || normalsIndices == NULL || texcoordIndices == NULL) continue; + if (positionIndices == nullptr || normalsIndices == nullptr || texcoordIndices == nullptr) continue; if (indexCount == 0 || indexCount != normalsInput->GetIndexCount() || indexCount != texcoordInput->GetIndexCount()) continue; float* positionData = positionSource->GetData(); float* normalsData = normalsSource->GetData(); @@ -310,8 +310,8 @@ namespace FCDGeometryPolygonsTools } } - FCDGeometrySource* tangentSource = NULL; - FCDGeometrySource* binormalSource = NULL; + FCDGeometrySource* tangentSource = nullptr; + FCDGeometrySource* binormalSource = nullptr; FloatList tangentData; FloatList binormalData; UInt32List tangentCompressionIndices; @@ -324,15 +324,15 @@ namespace FCDGeometryPolygonsTools // Verify that this polygons set uses the given texture coordinate source. FCDGeometryPolygonsInput* texcoordInput = polygons->FindInput(texcoordSource); - if (texcoordInput == NULL) continue; + if (texcoordInput == nullptr) continue; // Retrieve the data and index buffer of positions/normals/texcoords for this polygons set. FCDGeometryPolygonsInput* positionInput = polygons->FindInput(FUDaeGeometryInput::POSITION); FCDGeometryPolygonsInput* normalsInput = polygons->FindInput(FUDaeGeometryInput::NORMAL); - if (positionInput == NULL || normalsInput == NULL) continue; + if (positionInput == nullptr || normalsInput == nullptr) continue; FCDGeometrySource* normalsSource = normalsInput->GetSource(); FCDGeometrySource* texcoordSource = texcoordInput->GetSource(); - if (normalsSource == NULL || texcoordSource == NULL) continue; + if (normalsSource == nullptr || texcoordSource == nullptr) continue; uint32 normalsStride = normalsSource->GetStride(); uint32 texcoordStride = texcoordSource->GetStride(); if (normalsStride < 3 || texcoordStride < 2) continue; @@ -340,7 +340,7 @@ namespace FCDGeometryPolygonsTools uint32* normalsIndices = normalsInput->GetIndices(); uint32* texcoordIndices = texcoordInput->GetIndices(); size_t indexCount = positionInput->GetIndexCount(); - if (positionIndices == NULL || normalsIndices == NULL || texcoordIndices == NULL) continue; + if (positionIndices == nullptr || normalsIndices == nullptr || texcoordIndices == nullptr) continue; if (indexCount == 0 || indexCount != normalsInput->GetIndexCount() || indexCount != texcoordInput->GetIndexCount()) continue; float* normalsData = normalsSource->GetData(); float* texcoordData = texcoordSource->GetData(); @@ -349,7 +349,7 @@ namespace FCDGeometryPolygonsTools if (normalsDataLength == 0 || texcoordDataLength == 0) continue; // Create the texture tangents/binormals sources - if (tangentSource == NULL) + if (tangentSource == nullptr) { tangentSource = mesh->AddSource(FUDaeGeometryInput::TEXTANGENT); tangentSource->SetDaeId(texcoordSource->GetDaeId() + "-tangents"); @@ -374,8 +374,8 @@ namespace FCDGeometryPolygonsTools FCDGeometryPolygonsInput* tangentInput = polygons->AddInput(tangentSource, inputOffset + 1); tangentInput->SetSet(texcoordInput->GetSet()); tangentInput->ReserveIndexCount(indexCount); - FCDGeometryPolygonsInput* binormalInput = NULL; - if (binormalSource != NULL) + FCDGeometryPolygonsInput* binormalInput = nullptr; + if (binormalSource != nullptr) { binormalInput = polygons->AddInput(binormalSource, inputOffset + 2); binormalInput->SetSet(tangentInput->GetSet()); @@ -407,7 +407,7 @@ namespace FCDGeometryPolygonsTools } tangentInput->AddIndex(list[v].tangentId); - if (binormalInput != NULL) + if (binormalInput != nullptr) { if (list[v].binormalId == ~(uint32)0) { @@ -423,8 +423,8 @@ namespace FCDGeometryPolygonsTools } } - if (tangentSource != NULL) tangentSource->SetData(tangentData, 3); - if (binormalSource != NULL) binormalSource->SetData(binormalData, 3); + if (tangentSource != nullptr) tangentSource->SetData(tangentData, 3); + if (binormalSource != nullptr) binormalSource->SetData(binormalData, 3); } struct HashIndexMapItem { UInt32List allValues; UInt32List newIndex; }; @@ -440,7 +440,7 @@ namespace FCDGeometryPolygonsTools if (polygonsCount == 0) return; size_t totalVertexCount = 0; - size_t outIndicesMinSize = (polygonsToProcess == NULL) ? polygonsCount : 1; + size_t outIndicesMinSize = (polygonsToProcess == nullptr) ? polygonsCount : 1; if (outIndices.size() < outIndicesMinSize) outIndices.resize(outIndicesMinSize); // Fill in the index buffers for each polygons set. @@ -450,10 +450,10 @@ namespace FCDGeometryPolygonsTools // DO NOT -EVER- TOUCH MY INDICES - (Says Psuedo-FCDGeometryPoints) // Way to much code assumes (and carefully guards) the existing sorted structure if (polygons->GetPrimitiveType() == FCDGeometryPolygons::POINTS) return; - if (polygonsToProcess != NULL && polygons != polygonsToProcess) continue; + if (polygonsToProcess != nullptr && polygons != polygonsToProcess) continue; // Find the list we are going to pump our new indices into - UInt32List& outPolyIndices = (polygonsToProcess == NULL) ? outIndices[p] : outIndices.front(); + UInt32List& outPolyIndices = (polygonsToProcess == nullptr) ? outIndices[p] : outIndices.front(); // Find all the indices list to determine the hash size. InputList idxOwners; @@ -560,15 +560,15 @@ namespace FCDGeometryPolygonsTools for (size_t p = 0; p < polygonsCount; ++p) { FCDGeometryPolygons* polygons = mesh->GetPolygons(p); - if (polygonsToProcess != NULL && polygonsToProcess != polygons) continue; - const UInt32List& outPolyIndices = (polygonsToProcess == NULL) ? outIndices[p] : outIndices.front(); + if (polygonsToProcess != nullptr && polygonsToProcess != polygons) continue; + const UInt32List& outPolyIndices = (polygonsToProcess == nullptr) ? outIndices[p] : outIndices.front(); FCDGeometryPolygonsInput* oldInput = polygons->FindInput(oldSource); - if (oldInput == NULL) continue; + if (oldInput == nullptr) continue; // Retrieve the old list of indices and de-reference the data values. uint32* oldIndexList = oldInput->GetIndices(); size_t oldIndexCount = oldInput->GetIndexCount(); - if (oldIndexList == NULL || oldIndexCount == 0) continue; + if (oldIndexList == nullptr || oldIndexCount == 0) continue; size_t indexCount = min(oldIndexCount, outPolyIndices.size()); for (size_t i = 0; i < indexCount; ++i) @@ -603,7 +603,7 @@ namespace FCDGeometryPolygonsTools // DO NOT -EVER- TOUCH MY INDICES - (Says Psuedo-FCDGeometryPoints) // Way to much code assumes (and carefully guards) the existing sorted structure if (polygons->GetPrimitiveType() == FCDGeometryPolygons::POINTS) return; - if (polygonsToProcess != NULL && polygons != polygonsToProcess) continue; + if (polygonsToProcess != nullptr && polygons != polygonsToProcess) continue; // Find all the indices list to determine the hash size. InputList idxOwners; @@ -700,13 +700,13 @@ namespace FCDGeometryPolygonsTools FCDGeometrySource* oldSource = mesh->GetSource(d); uint32 stride = oldSource->GetStride(); const float* oldVertexData = oldSource->GetData(); - bool isPositionSource = oldSource->GetType() == FUDaeGeometryInput::POSITION && translationMap != NULL; + bool isPositionSource = oldSource->GetType() == FUDaeGeometryInput::POSITION && translationMap != nullptr; FloatList vertexBuffer; vertexBuffer.resize(stride * totalVertexCount, 0.0f); // When processing just one polygons set, duplicate the source // so that the other polygons set can correctly point to the original source. - FCDGeometrySource* newSource = (polygonsToProcess != NULL) ? mesh->AddSource(oldSource->GetType()) : oldSource; + FCDGeometrySource* newSource = (polygonsToProcess != nullptr) ? mesh->AddSource(oldSource->GetType()) : oldSource; FCDAnimatedList newAnimatedList; newAnimatedList.clear(); @@ -714,14 +714,14 @@ namespace FCDGeometryPolygonsTools { const UInt32List& indexBuffer = indexBuffers[p]; FCDGeometryPolygons* polygons = mesh->GetPolygons(p); - if (polygonsToProcess != NULL && polygonsToProcess != polygons) continue; + if (polygonsToProcess != nullptr && polygonsToProcess != polygons) continue; FCDGeometryPolygonsInput* oldInput = polygons->FindInput(oldSource); - if (oldInput == NULL) continue; + if (oldInput == nullptr) continue; // Retrieve the old list of indices and de-reference the data values. uint32* oldIndexList = oldInput->GetIndices(); size_t oldIndexCount = oldInput->GetIndexCount(); - if (oldIndexList == NULL || oldIndexCount == 0) continue; + if (oldIndexList == nullptr || oldIndexCount == 0) continue; size_t indexCount = min(oldIndexCount, indexBuffer.size()); for (size_t i = 0; i < indexCount; ++i) @@ -731,7 +731,7 @@ namespace FCDGeometryPolygonsTools if (oldIndex >= oldSource->GetValueCount()) continue; FUObjectContainer& animatedValues = oldSource->GetAnimatedValues(); - FCDAnimated* oldAnimated = NULL; + FCDAnimated* oldAnimated = nullptr; for (size_t j = 0; j < animatedValues.size(); j++) { FCDAnimated* animated = animatedValues[j]; @@ -741,7 +741,7 @@ namespace FCDGeometryPolygonsTools break; } } - if (oldAnimated != NULL) + if (oldAnimated != nullptr) { FCDAnimated* newAnimated = oldAnimated->Clone(oldAnimated->GetDocument()); newAnimated->SetArrayElement(newIndex); @@ -764,7 +764,7 @@ namespace FCDGeometryPolygonsTools } } - if (polygonsToProcess != NULL) + if (polygonsToProcess != nullptr) { // Change the relevant input, if it exists, to point towards the new source. uint32 set = oldInput->GetSet(); @@ -791,7 +791,7 @@ namespace FCDGeometryPolygonsTools } } - if (polygonsToProcess == NULL) + if (polygonsToProcess == nullptr) { // Next, make all the sources per-vertex. size_t _sourceCount = mesh->GetSourceCount(); @@ -810,7 +810,7 @@ namespace FCDGeometryPolygonsTools { const UInt32List& indexBuffer = indexBuffers[p]; FCDGeometryPolygons* polygons = mesh->GetPolygons(p); - if (polygonsToProcess != NULL && polygons != polygonsToProcess) continue; + if (polygonsToProcess != nullptr && polygons != polygonsToProcess) continue; size_t inputCount = polygons->GetInputCount(); for (size_t i = 0; i < inputCount; i++) @@ -985,9 +985,9 @@ namespace FCDGeometryPolygonsTools // Iterate over the indices, remapping them using the provided map until we have consumed // either max indices or max vertices, whichever is first // return the number of indices actually consumed. - uint16 GenerateVertexPackingMap(size_t maxIndex, size_t maxIndices, size_t maxVertices, const uint32* inIndices, uint16* outIndices, UInt16List* outPackingMap, uint16* outNVertices/*=NULL*/) + uint16 GenerateVertexPackingMap(size_t maxIndex, size_t maxIndices, size_t maxVertices, const uint32* inIndices, uint16* outIndices, UInt16List* outPackingMap, uint16* outNVertices/*=nullptr*/) { - FUAssert(inIndices != NULL && outPackingMap != NULL, return 0); + FUAssert(inIndices != nullptr && outPackingMap != nullptr, return 0); FUAssert(maxIndices < INVALID_VTX_IDX, maxIndices = INVALID_VTX_IDX - 1); outPackingMap->resize(maxIndex + 1, INVALID_VTX_IDX); uint16 nIndices, nVertices = 0; @@ -1002,7 +1002,7 @@ namespace FCDGeometryPolygonsTools // force a break using the maxIndices instead if (++nVertices >= maxVertices) maxIndices = nIndices; } - if (outIndices != NULL) + if (outIndices != nullptr) { *outIndices = outPackingMap->at(*inIndices); ++outIndices; @@ -1012,7 +1012,7 @@ namespace FCDGeometryPolygonsTools // Sanity check FUAssert(nVertices <= nIndices, nVertices = nIndices); // Extra requested return - if (outNVertices != NULL) *outNVertices = nVertices; + if (outNVertices != nullptr) *outNVertices = nVertices; return nIndices; } @@ -1061,7 +1061,7 @@ namespace FCDGeometryPolygonsTools float* outData = outSrc->GetData(); const uint32* inIndices = inPInput.GetIndices(); - FUAssert(inIndices != NULL, return); + FUAssert(inIndices != nullptr, return); UInt32List indices(inIndices, inPInput.GetIndexCount()); for (FCDGeometryIndexTranslationMap::const_iterator it = translationMap.begin(), itEnd = translationMap.end(); it != itEnd; ++it) @@ -1145,7 +1145,7 @@ namespace FCDGeometryPolygonsTools FCDGeometryPolygonsInput* inputCopy; if (!mesh->IsVertexSource(source)) inputCopy = polygonsCopy->AddInput(source, input->GetOffset()); else inputCopy = polygonsCopy->FindInput(source); - FUAssert(inputCopy != NULL, continue); + FUAssert(inputCopy != nullptr, continue); // For owners, copy the indices over. size_t indexCopyCount = inputCopy->GetIndexCount(); diff --git a/FCollada/FCDocument/FCDGeometryPolygonsTools.h b/FCollada/FCDocument/FCDGeometryPolygonsTools.h index 0131df3..c50c9ac 100644 --- a/FCollada/FCDocument/FCDGeometryPolygonsTools.h +++ b/FCollada/FCDocument/FCDGeometryPolygonsTools.h @@ -55,18 +55,18 @@ namespace FCDGeometryPolygonsTools This is useful for older engines and the applications that only support one index per face-vertex pair. @param mesh The mesh to process. - @param polygons The polygons set to isolate and process. If this pointer is NULL, the whole mesh is processed + @param polygons The polygons set to isolate and process. If this pointer is nullptr, the whole mesh is processed for one index buffer. @param translationMap Optional map that returns how to translate old vertex position indices into new indices. This map is necessary to support skins and morphers. */ - FCOLLADA_EXPORT void GenerateUniqueIndices(FCDGeometryMesh* mesh, FCDGeometryPolygons* polygons = NULL, FCDGeometryIndexTranslationMap* translationMap = NULL); + FCOLLADA_EXPORT void GenerateUniqueIndices(FCDGeometryMesh* mesh, FCDGeometryPolygons* polygons = nullptr, FCDGeometryIndexTranslationMap* translationMap = nullptr); /** Prepares the mesh for using its geometry sources in vertex buffers with a unique index buffer. This is useful for older engines and the applications that only support one index per face-vertex pair. This version of the GenerateUniqueIndices function fills in the outTranslationMaps, but does not modify the data in the FCDGeometryPolygon objects. @param mesh The mesh to process. - @param polygons The polygons set to isolate and process. If this pointer is NULL, the whole mesh is processed + @param polygons The polygons set to isolate and process. If this pointer is nullptr, the whole mesh is processed for one index buffer. @param outIndices The unique index buffer data. @param outTranslationMaps How the vertex data needs to be relocated in order to use the unique index buffer data. */ @@ -139,7 +139,7 @@ namespace FCDGeometryPolygonsTools @param outNVertices The number of vertices for each split packing map. @return The number of indices packed away. */ FCOLLADA_EXPORT uint16 GenerateVertexPackingMap(size_t maxIndex, size_t maxIndices, size_t maxVertices, const uint32* inIndices, - uint16* outIndices, UInt16List* outPackingMap, uint16* outNVertices=NULL); + uint16* outIndices, UInt16List* outPackingMap, uint16* outNVertices=nullptr); /** Retrieves the largest unique index within a given translation map. This function is unnecessary expensive and we suggest that you cache its results. diff --git a/FCollada/FCDocument/FCDGeometrySource.cpp b/FCollada/FCDocument/FCDGeometrySource.cpp index 8b2d27e..ab0616c 100644 --- a/FCollada/FCDocument/FCDGeometrySource.cpp +++ b/FCollada/FCDocument/FCDGeometrySource.cpp @@ -41,7 +41,7 @@ void FCDGeometrySource::SetDataCount(size_t count) FCDGeometrySource* FCDGeometrySource::Clone(FCDGeometrySource* clone) const { - if (clone == NULL) clone = new FCDGeometrySource(const_cast(GetDocument())); + if (clone == nullptr) clone = new FCDGeometrySource(const_cast(GetDocument())); FCDObjectWithId::Clone(clone); clone->name = name; clone->sourceType = sourceType; @@ -52,7 +52,7 @@ FCDGeometrySource* FCDGeometrySource::Clone(FCDGeometrySource* clone) const clone->sourceType = sourceType; // Clone the extra information. - if (extra != NULL) + if (extra != nullptr) { extra->Clone(clone->GetExtra()); } @@ -77,5 +77,5 @@ void FCDGeometrySource::SetData(const FloatList& _sourceData, uint32 _sourceStri FCDExtra* FCDGeometrySource::GetExtra() { - return (extra != NULL) ? extra : extra = new FCDExtra(GetDocument(), this); + return (extra != nullptr) ? extra : extra = new FCDExtra(GetDocument(), this); } diff --git a/FCollada/FCDocument/FCDGeometrySource.h b/FCollada/FCDocument/FCDGeometrySource.h index 88b07f8..ab1a740 100644 --- a/FCollada/FCDocument/FCDGeometrySource.h +++ b/FCollada/FCDocument/FCDGeometrySource.h @@ -61,10 +61,10 @@ class FCOLLADA_EXPORT FCDGeometrySource : public FCDObjectWithId /** Copies the data source into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new data source + @param clone The empty clone. If this pointer is nullptr, a new data source will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDGeometrySource* Clone(FCDGeometrySource* clone = NULL) const; + FCDGeometrySource* Clone(FCDGeometrySource* clone = nullptr) const; /** Retrieves the name of the data source. The name is optional and is used to keep around a user-friendly name for texture coordinate sets or color sets. @@ -74,8 +74,8 @@ class FCOLLADA_EXPORT FCDGeometrySource : public FCDObjectWithId /** Retrieves the pure data of the data source. This is a dynamically-sized array of floating-point values that contains all the data of the source. @return The pure data of the data source. */ - inline float* GetData() { return !sourceData.empty() ? &sourceData.front() : NULL; } - inline const float* GetData() const { return !sourceData.empty() ? &sourceData.front() : NULL; } /**< See above. */ + inline float* GetData() { return !sourceData.empty() ? &sourceData.front() : nullptr; } + inline const float* GetData() const { return !sourceData.empty() ? &sourceData.front() : nullptr; } /**< See above. */ /** [INTERNAL] Retrieve the reference to the source data. @return The reference to the source data. @@ -123,7 +123,7 @@ class FCOLLADA_EXPORT FCDGeometrySource : public FCDObjectWithId /** Retrieves one source value out of this source. @param index The index of the source value. @return The source value. */ - inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return NULL); return &sourceData.at(index * stride); } /**< See above. */ + inline const float* GetValue(size_t index) const { FUAssert(index < GetValueCount(), return nullptr); return &sourceData.at(index * stride); } /**< See above. */ /** Sets one source value out of this source. @param index The index of the source value. @@ -173,7 +173,7 @@ class FCOLLADA_EXPORT FCDGeometrySource : public FCDObjectWithId void SetSourceType(FUDaeGeometryInput::Semantic type) { sourceType = type; } /** Retrieves the extra information contained by this data source. - @return The extra tree. This pointer will be NULL, + @return The extra tree. This pointer will be nullptr, in the const-version of this function, if there is no extra information. In the modifiable-version of this function: you will always get a valid extra tree that you can fill in. */ diff --git a/FCollada/FCDocument/FCDGeometrySpline.cpp b/FCollada/FCDocument/FCDGeometrySpline.cpp index 54d9fdc..1031532 100644 --- a/FCollada/FCDocument/FCDGeometrySpline.cpp +++ b/FCollada/FCDocument/FCDGeometrySpline.cpp @@ -33,7 +33,7 @@ FCDSpline::~FCDSpline() FCDSpline* FCDSpline::Clone(FCDSpline* clone) const { - if (clone == NULL) return NULL; + if (clone == nullptr) return nullptr; clone->cvs = cvs; clone->name = name; @@ -199,13 +199,13 @@ FCDNURBSSpline::~FCDNURBSSpline() FCDSpline* FCDNURBSSpline::Clone(FCDSpline* _clone) const { - FCDNURBSSpline* clone = NULL; - if (_clone == NULL) return NULL; + FCDNURBSSpline* clone = nullptr; + if (_clone == nullptr) return nullptr; else if (_clone->HasType(FCDNURBSSpline::GetClassType())) clone = (FCDNURBSSpline*) _clone; Parent::Clone(_clone); - if (clone != NULL) + if (clone != nullptr) { // Clone the NURBS-specific spline data clone->degree = degree; @@ -265,12 +265,12 @@ FCDGeometrySpline::FCDGeometrySpline(FCDocument* document, FCDGeometry* _parent) FCDGeometrySpline::~FCDGeometrySpline() { - parent = NULL; + parent = nullptr; } FCDGeometrySpline* FCDGeometrySpline::Clone(FCDGeometrySpline* clone) const { - if (clone == NULL) clone = new FCDGeometrySpline(const_cast(GetDocument()), NULL); + if (clone == nullptr) clone = new FCDGeometrySpline(const_cast(GetDocument()), nullptr); clone->type = type; // Clone the spline set. @@ -295,10 +295,10 @@ FCDSpline* FCDGeometrySpline::AddSpline(FUDaeSplineType::Type type) { // Retrieve the correct spline type to create. if (type == FUDaeSplineType::UNKNOWN) type = GetType(); - else if (type != GetType()) return NULL; + else if (type != GetType()) return nullptr; // Create the correctly-type spline - FCDSpline* newSpline = NULL; + FCDSpline* newSpline = nullptr; switch (type) { case FUDaeSplineType::LINEAR: newSpline = new FCDLinearSpline(GetDocument()); break; @@ -306,7 +306,7 @@ FCDSpline* FCDGeometrySpline::AddSpline(FUDaeSplineType::Type type) case FUDaeSplineType::NURBS: newSpline = new FCDNURBSSpline(GetDocument()); break; case FUDaeSplineType::UNKNOWN: - default: return NULL; + default: return nullptr; } splines.push_back(newSpline); diff --git a/FCollada/FCDocument/FCDGeometrySpline.h b/FCollada/FCDocument/FCDGeometrySpline.h index 62d5037..95c88e8 100644 --- a/FCollada/FCDocument/FCDGeometrySpline.h +++ b/FCollada/FCDocument/FCDGeometrySpline.h @@ -77,8 +77,8 @@ class FCOLLADA_EXPORT FCDSpline : public FCDObject /** Retrieves a pointer to the control vertex specified by the given index. @param index The index, must be higher or equal to 0 and lower than GetCVCount(). @return The control vertex.*/ - inline FMVector3* GetCV(size_t index) { FUAssert(index < GetCVCount(), return NULL); return &(cvs.at(index)); } - inline const FMVector3* GetCV(size_t index) const { FUAssert(index < GetCVCount(), return NULL); return &(cvs.at(index)); } /**< See above. */ + inline FMVector3* GetCV(size_t index) { FUAssert(index < GetCVCount(), return nullptr); return &(cvs.at(index)); } + inline const FMVector3* GetCV(size_t index) const { FUAssert(index < GetCVCount(), return nullptr); return &(cvs.at(index)); } /**< See above. */ /** Retrieves a reference to the CVs list. @return The reference to the control vertices. */ @@ -90,7 +90,7 @@ class FCOLLADA_EXPORT FCDSpline : public FCDObject /** [INTERNAL] Copies the spline into a clone. The clone may reside in another document. - @param clone The empty clone. This pointer cannot be NULL. + @param clone The empty clone. This pointer cannot be nullptr. @return The clone. */ virtual FCDSpline* Clone(FCDSpline* clone) const; }; @@ -217,9 +217,9 @@ class FCOLLADA_EXPORT FCDNURBSSpline : public FCDSpline /** Retrieves a reference to the weight specified by the index. @param index The index. - @return The address of the weight value, NULL if index is invalid.*/ - inline float* GetWeight(size_t index) { FUAssert(index < GetCVCount(), return NULL); return &(weights.at(index)); } - inline const float* GetWeight(size_t index) const { FUAssert(index < GetCVCount(), return NULL); return &(weights.at(index)); } /**< See above. */ + @return The address of the weight value, nullptr if index is invalid.*/ + inline float* GetWeight(size_t index) { FUAssert(index < GetCVCount(), return nullptr); return &(weights.at(index)); } + inline const float* GetWeight(size_t index) const { FUAssert(index < GetCVCount(), return nullptr); return &(weights.at(index)); } /**< See above. */ /** Retrieves the knot count in this NURB. @return The knot count.*/ @@ -231,9 +231,9 @@ class FCOLLADA_EXPORT FCDNURBSSpline : public FCDSpline /** Retrieves a reference to the knot specified by the index. @param index The index. - @return The address of the knot value, NULL if index is invalid.*/ - inline float* GetKnot(size_t index) { FUAssert(index < GetKnotCount(), return NULL); return &(knots.at(index));} - inline const float* GetKnot(size_t index) const { FUAssert(index < GetKnotCount(), return NULL); return &(knots.at(index));} /**< See above. */ + @return The address of the knot value, nullptr if index is invalid.*/ + inline float* GetKnot(size_t index) { FUAssert(index < GetKnotCount(), return nullptr); return &(knots.at(index));} + inline const float* GetKnot(size_t index) const { FUAssert(index < GetKnotCount(), return nullptr); return &(knots.at(index));} /**< See above. */ /** Retrieves a const reference to the weight list. @return The weights' const reference.*/ @@ -251,7 +251,7 @@ class FCOLLADA_EXPORT FCDNURBSSpline : public FCDSpline /** [INTERNAL] Copies the spline into a clone. The clone may reside in another document. - @param clone The empty clone. This pointer cannot be NULL. + @param clone The empty clone. This pointer cannot be nullptr. @return The clone. */ virtual FCDSpline* Clone(FCDSpline* clone) const; }; @@ -307,16 +307,16 @@ class FCOLLADA_EXPORT FCDGeometrySpline : public FCDObject /** Retrieves a pointer to the spline specified by the given index. @param index The index, higher or equal to 0 and lower than GetSplineCount(). - @return The FCDSpline pointer, or NULL if index is invalid.*/ - FCDSpline* GetSpline(size_t index){ FUAssert(index < GetSplineCount(), return NULL); return splines[index]; } - const FCDSpline* GetSpline(size_t index) const { FUAssert(index < GetSplineCount(), return NULL); return splines[index]; }/**< see above */ + @return The FCDSpline pointer, or nullptr if index is invalid.*/ + FCDSpline* GetSpline(size_t index){ FUAssert(index < GetSplineCount(), return nullptr); return splines[index]; } + const FCDSpline* GetSpline(size_t index) const { FUAssert(index < GetSplineCount(), return nullptr); return splines[index]; }/**< see above */ /** Adds a spline to this geometry spline. @param type The type of spline to create. Set the type to FUDaeSplineType::UNKNOWN to create a spline that has the same type as this geometry spline. - @return The new spline. This pointer will be NULL if the requested spline - type is different from existing splines. This pointer will be NULL + @return The new spline. This pointer will be nullptr if the requested spline + type is different from existing splines. This pointer will be nullptr if the requested type is FUDaeSplineType::UNKNOWN and this geometry spline doesn't yet have a type assigned. */ FCDSpline* AddSpline(FUDaeSplineType::Type type = FUDaeSplineType::UNKNOWN); @@ -327,10 +327,10 @@ class FCOLLADA_EXPORT FCDGeometrySpline : public FCDObject /** Copies the spline into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new spline + @param clone The empty clone. If this pointer is nullptr, a new spline will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDGeometrySpline* Clone(FCDGeometrySpline* clone = NULL) const; + FCDGeometrySpline* Clone(FCDGeometrySpline* clone = nullptr) const; }; #endif // _FCD_GEOMETRY_SPLINE_H_ diff --git a/FCollada/FCDocument/FCDImage.cpp b/FCollada/FCDocument/FCDImage.cpp index 486269d..25592eb 100644 --- a/FCollada/FCDocument/FCDImage.cpp +++ b/FCollada/FCDocument/FCDImage.cpp @@ -51,13 +51,13 @@ void FCDImage::SetFilename(const fstring& _filename) // Copies the image entity into a clone. FCDEntity* FCDImage::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDImage* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDImage(const_cast(GetDocument())); + FCDImage* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDImage(const_cast(GetDocument())); else if (_clone->HasType(FCDImage::GetClassType())) clone = (FCDImage*) _clone; FCDEntity::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->width = width; clone->height = height; diff --git a/FCollada/FCDocument/FCDImage.h b/FCollada/FCDocument/FCDImage.h index a2a4413..7a1492d 100644 --- a/FCollada/FCDocument/FCDImage.h +++ b/FCollada/FCDocument/FCDImage.h @@ -122,11 +122,11 @@ class FCOLLADA_EXPORT FCDImage : public FCDEntity /** Copies the image entity into a clone. The clone may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new image + @param clone The empty clone. If this pointer is nullptr, a new image will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_IMAGE_H_ diff --git a/FCollada/FCDocument/FCDLibrary.h b/FCollada/FCDocument/FCDLibrary.h index 6b01209..5ab0d3a 100644 --- a/FCollada/FCDocument/FCDLibrary.h +++ b/FCollada/FCDocument/FCDLibrary.h @@ -86,7 +86,7 @@ class FCOLLADA_EXPORT FCDLibrary : public FCDObject /** Retrieves the library entity with the given COLLADA id. @param daeId The COLLADA id of the entity. @return The library entity which matches the COLLADA id. - This pointer will be NULL if no matching entity was found. */ + This pointer will be nullptr if no matching entity was found. */ T* FindDaeId(const fm::string& daeId) { return const_cast(const_cast(this)->FindDaeId(daeId)); } const T* FindDaeId(const fm::string& daeId) const; /**< See above. */ @@ -102,8 +102,8 @@ class FCOLLADA_EXPORT FCDLibrary : public FCDObject @param index The index of the entity to retrieve. Should be within the range [0, GetEntityCount()[. @return The indexed entity. */ - inline T* GetEntity(size_t index) { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); } - inline const T* GetEntity(size_t index) const { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); } /**< See above. */ + inline T* GetEntity(size_t index) { FUAssert(index < GetEntityCount(), return nullptr); return entities.at(index); } + inline const T* GetEntity(size_t index) const { FUAssert(index < GetEntityCount(), return nullptr); return entities.at(index); } /**< See above. */ /** Retrieves the asset information for the library. The non-const version of this function can create diff --git a/FCollada/FCDocument/FCDLibrary.hpp b/FCollada/FCDocument/FCDLibrary.hpp index e3c680b..f026417 100644 --- a/FCollada/FCDocument/FCDLibrary.hpp +++ b/FCollada/FCDocument/FCDLibrary.hpp @@ -43,7 +43,7 @@ FCDLibrary::~FCDLibrary() template FCDAsset* FCDLibrary::GetAsset(bool create) { - if (create && asset == NULL) asset = new FCDAsset(GetDocument()); + if (create && asset == nullptr) asset = new FCDAsset(GetDocument()); return asset; } @@ -63,12 +63,12 @@ const T* FCDLibrary::FindDaeId(const fm::string& daeId) const for (size_t i = 0; i < entityCount; ++i) { const FCDEntity* found = entities[i]->FindDaeId(daeId); - if (found != NULL && found->GetObjectType() == T::GetClassType()) + if (found != nullptr && found->GetObjectType() == T::GetClassType()) { return (T*) found; } } - return NULL; + return nullptr; } // Search for the entity in this library with a given COLLADA id. diff --git a/FCollada/FCDocument/FCDLightTools.cpp b/FCollada/FCDocument/FCDLightTools.cpp index 932b4eb..515a8ce 100644 --- a/FCollada/FCDocument/FCDLightTools.cpp +++ b/FCollada/FCDocument/FCDLightTools.cpp @@ -55,18 +55,18 @@ namespace FCDLightTools FCDAnimationCurve* fallOffAngleCurve = fallOffAngleAnimated->GetCurve(0); // no animations on the penumbra nor the fallOffAngle, so no animation needed - if (outerAngleCurve == NULL && fallOffAngleCurve == NULL) return; + if (outerAngleCurve == nullptr && fallOffAngleCurve == nullptr) return; // there's animation on the fallOffAngle only, so just need to copy the animation to the outterAngle as well - if (outerAngleCurve == NULL) + if (outerAngleCurve == nullptr) { fallOffAngleAnimated->Clone(outerAngleAnimated); - FUAssert(outerAngleAnimated != NULL, return); // should not be null because we know fallOffAngle is animated + FUAssert(outerAngleAnimated != nullptr, return); // should not be null because we know fallOffAngle is animated outerAngleAnimated->SetTargetObject(light); // if we penumbra was negative, fallOffAngle needs to be lowered, else outerAngle needs to be raised float offset = 0.0f; - FCDAnimated* animated = NULL; + FCDAnimated* animated = nullptr; if (fallOffIsOuter) { offset = -2 * penumbraValue; @@ -91,7 +91,7 @@ namespace FCDLightTools return; } - outerAngleAnimated->SetTargetObject(light); // at this point, outerAngleAnimated != NULL + outerAngleAnimated->SetTargetObject(light); // at this point, outerAngleAnimated != nullptr // FIXME: [aleung] This is not necessarily true, but close enough for now size_t outerAngleKeysCount = outerAngleCurve->GetKeyCount(); @@ -110,7 +110,7 @@ namespace FCDLightTools } // there's animation on the penumbra only and there's no negative values, so we just need to animate the outerAngle - if ((fallOffAngleCurve == NULL) && !hasNegPenumbra) + if ((fallOffAngleCurve == nullptr) && !hasNegPenumbra) { FCDAnimationCurveListList& curvesList = outerAngleAnimated->GetCurves(); @@ -129,17 +129,17 @@ namespace FCDLightTools } // at this point, we need curves for both fallOffAngle and outerAngle! - if (fallOffAngleCurve == NULL) + if (fallOffAngleCurve == nullptr) { if (createAnimationChannel) { outerAngleValue.GetAnimated()->Clone(fallOffAngleAnimated); } - FUAssert(fallOffAngleAnimated != NULL, return); // should not be null because outerAngle is animated + FUAssert(fallOffAngleAnimated != nullptr, return); // should not be null because outerAngle is animated fallOffAngleAnimated->SetTargetObject(light); fallOffAngleCurve = fallOffAngleAnimated->GetCurve(0); - if (fallOffAngleCurve == NULL) + if (fallOffAngleCurve == nullptr) { FUAssert(createAnimationChannel, ;); // should only happen if we created new animated fallOffAngleAnimated->RemoveCurve(0); @@ -349,8 +349,8 @@ namespace FCDLightTools FCDAnimationKey** finalFallOffAngleKeys = fallOffAngleCurve->GetKeys(); FCDAnimationKey** finalOuterAngleKeys = outerAngleCurve->GetKeys(); bool previousFlipKeys = false; - FCDAnimationKeyBezier* previousFallOffAngleBkey = NULL; - FCDAnimationKeyBezier* previousOuterAngleBkey = NULL; + FCDAnimationKeyBezier* previousFallOffAngleBkey = nullptr; + FCDAnimationKeyBezier* previousOuterAngleBkey = nullptr; for (size_t i = 0; i < keyCount; i++) { FCDAnimationKey* fallOffAngleKey = finalFallOffAngleKeys[i]; @@ -385,7 +385,7 @@ namespace FCDLightTools if ((!previousFlipKeys) && (i != 0)) { // have to flip their outTangents - if (previousFallOffAngleBkey != NULL) + if (previousFallOffAngleBkey != nullptr) { temp = previousOuterAngleBkey->outTangent; previousOuterAngleBkey->outTangent = previousFallOffAngleBkey->outTangent; @@ -406,8 +406,8 @@ namespace FCDLightTools } else { - previousFallOffAngleBkey = NULL; - previousOuterAngleBkey = NULL; + previousFallOffAngleBkey = nullptr; + previousOuterAngleBkey = nullptr; } previousFlipKeys = flipKeys; } diff --git a/FCollada/FCDocument/FCDMaterial.cpp b/FCollada/FCDocument/FCDMaterial.cpp index c7708de..c86eb34 100644 --- a/FCollada/FCDocument/FCDMaterial.cpp +++ b/FCollada/FCDocument/FCDMaterial.cpp @@ -60,10 +60,10 @@ FCDEffectParameter* FCDMaterial::AddEffectParameter(uint32 type) const FCDEffect* FCDMaterial::GetEffect() const { - FUAssert(effect != NULL, return NULL); + FUAssert(effect != nullptr, return nullptr); const FCDEntity* entity = effect->GetEntity(); - if (entity != NULL && entity->HasType(FCDEffect::GetClassType())) return (const FCDEffect*) entity; - else return NULL; + if (entity != nullptr && entity->HasType(FCDEffect::GetClassType())) return (const FCDEffect*) entity; + else return nullptr; } void FCDMaterial::SetEffect(FCDEffect* _effect) @@ -75,17 +75,17 @@ void FCDMaterial::SetEffect(FCDEffect* _effect) // Cloning FCDEntity* FCDMaterial::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDMaterial* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDMaterial(const_cast(GetDocument())); + FCDMaterial* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDMaterial(const_cast(GetDocument())); else if (_clone->HasType(FCDMaterial::GetClassType())) clone = (FCDMaterial*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the effect and the local list of parameters const FCDEffect* _effect = GetEffect(); - if (_effect != NULL) + if (_effect != nullptr) { if (cloneChildren) { diff --git a/FCollada/FCDocument/FCDMaterial.h b/FCollada/FCDocument/FCDMaterial.h index 26a9eb1..58a3aae 100644 --- a/FCollada/FCDocument/FCDMaterial.h +++ b/FCollada/FCDocument/FCDMaterial.h @@ -79,7 +79,7 @@ class FCOLLADA_EXPORT FCDMaterial : public FCDEntity /** Retrieves the effect instantiated for this material. The parameters of the effect may be overwritten by this material. - @return The instantiated effect. This pointer will be NULL if the material has no rendering. */ + @return The instantiated effect. This pointer will be nullptr if the material has no rendering. */ FCDEffect* GetEffect() { return const_cast(const_cast(this)->GetEffect()); } const FCDEffect* GetEffect() const; /**< See above. */ @@ -106,8 +106,8 @@ class FCOLLADA_EXPORT FCDMaterial : public FCDEntity /** Retrieves a given local effect parameter. @param index An index. @return The local effect parameter at the given index. */ - inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } - inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); } + inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } + inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return nullptr); return parameters.at(index); } /** Adds a local effect parameter to the local list. @see FCDEffectParameter::Type @@ -117,11 +117,11 @@ class FCOLLADA_EXPORT FCDMaterial : public FCDEntity /** Clones the material object. Everything is cloned, including the effect parameters. - @param clone The material clone. If this pointer is NULL, a new material object + @param clone The material clone. If this pointer is nullptr, a new material object will be created and you will need to release the returned pointer. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** [INTERNAL] Flattens the material, pushing all the effect parameter overrides into the effect parameter generators and moving all the parameters to the diff --git a/FCollada/FCDocument/FCDMaterialInstance.cpp b/FCollada/FCDocument/FCDMaterialInstance.cpp index 4462ac8..e98bb74 100644 --- a/FCollada/FCDocument/FCDMaterialInstance.cpp +++ b/FCollada/FCDocument/FCDMaterialInstance.cpp @@ -80,12 +80,12 @@ FCDMaterialInstance::FCDMaterialInstance(FCDocument* document, FCDEntityInstance FCDMaterialInstance::~FCDMaterialInstance() { - parent = NULL; + parent = nullptr; } FCDObject* FCDMaterialInstance::GetGeometryTarget() { - if (parent != NULL && parent->GetEntity() != NULL) + if (parent != nullptr && parent->GetEntity() != nullptr) { FCDEntity* e = parent->GetEntity(); if (e->HasType(FCDController::GetClassType())) @@ -110,7 +110,7 @@ FCDObject* FCDMaterialInstance::GetGeometryTarget() } } } - return NULL; + return nullptr; } @@ -120,7 +120,7 @@ const FCDMaterialInstanceBind* FCDMaterialInstance::FindBinding(const char* sema { if (IsEquivalent((*it)->semantic, semantic)) return (*it); } - return NULL; + return nullptr; } FCDMaterialInstanceBindVertexInput* FCDMaterialInstance::AddVertexInputBinding() @@ -146,7 +146,7 @@ const FCDMaterialInstanceBindVertexInput* FCDMaterialInstance::FindVertexInputBi { if (IsEquivalent((*it)->semantic, semantic)) return (*it); } - return NULL; + return nullptr; } FCDMaterialInstanceBind* FCDMaterialInstance::AddBinding() @@ -173,8 +173,8 @@ void FCDMaterialInstance::RemoveBinding(size_t index) FCDEntityInstance* FCDMaterialInstance::Clone(FCDEntityInstance* _clone) const { - FCDMaterialInstance* clone = NULL; - if (_clone == NULL) clone = new FCDMaterialInstance(const_cast(GetDocument()), NULL); + FCDMaterialInstance* clone = nullptr; + if (_clone == nullptr) clone = new FCDMaterialInstance(const_cast(GetDocument()), nullptr); else if (!_clone->HasType(FCDMaterialInstance::GetClassType())) return Parent::Clone(_clone); else clone = (FCDMaterialInstance*) _clone; diff --git a/FCollada/FCDocument/FCDMaterialInstance.h b/FCollada/FCDocument/FCDMaterialInstance.h index 2307ea7..d66ce38 100644 --- a/FCollada/FCDocument/FCDMaterialInstance.h +++ b/FCollada/FCDocument/FCDMaterialInstance.h @@ -157,7 +157,7 @@ class FCOLLADA_EXPORT FCDMaterialInstance : public FCDEntityInstance /** Retrieves a given binding. @param semantic The binding's semantic. - @return The found binding, or NULL if there is no such binding.*/ + @return The found binding, or nullptr if there is no such binding.*/ const FCDMaterialInstanceBind* FindBinding(const char* semantic); /** Retrieves the number of parameter bindings for this instance. @@ -167,8 +167,8 @@ class FCOLLADA_EXPORT FCDMaterialInstance : public FCDEntityInstance /** Retrieves a parameter binding. @param index The index of the parameter binding. @return The parameter binding at the given index. */ - inline FCDMaterialInstanceBind* GetBinding(size_t index) { FUAssert(index < bindings.size(), return NULL); return bindings.at(index); } - inline const FCDMaterialInstanceBind* GetBinding(size_t index) const { FUAssert(index < bindings.size(), return NULL); return bindings.at(index); } /**< See above. */ + inline FCDMaterialInstanceBind* GetBinding(size_t index) { FUAssert(index < bindings.size(), return nullptr); return bindings.at(index); } + inline const FCDMaterialInstanceBind* GetBinding(size_t index) const { FUAssert(index < bindings.size(), return nullptr); return bindings.at(index); } /**< See above. */ /** Retrieves the geometry target that this instance affects. Note that this function uses the parent geometry instance and searches for the polygon set. @@ -200,14 +200,14 @@ class FCOLLADA_EXPORT FCDMaterialInstance : public FCDEntityInstance /** Retrieves a vertex input binding. @param index The index of the vertex input binding. @return The vertex input binding at the given index. */ - inline FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) { FUAssert(index < vertexBindings.size(), return NULL); return vertexBindings.at(index); } - inline const FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) const { FUAssert(index < vertexBindings.size(), return NULL); return vertexBindings.at(index); } /**< See above. */ + inline FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) { FUAssert(index < vertexBindings.size(), return nullptr); return vertexBindings.at(index); } + inline const FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) const { FUAssert(index < vertexBindings.size(), return nullptr); return vertexBindings.at(index); } /**< See above. */ /** Retrieves a given vertex input binding. This is useful when trying to match textures with the texture coordinate sets. @param semantic A given vertex input binding semantic. @return The vertex input binding information structure. This pointer will be - NULL if the given semantic is not bound within the material instance. */ + nullptr if the given semantic is not bound within the material instance. */ inline FCDMaterialInstanceBindVertexInput* FindVertexInputBinding(const char* semantic) { return const_cast(const_cast(this)->FindVertexInputBinding(semantic)); } const FCDMaterialInstanceBindVertexInput* FindVertexInputBinding(const char* semantic) const; /**< See above. */ @@ -228,13 +228,13 @@ class FCOLLADA_EXPORT FCDMaterialInstance : public FCDEntityInstance preferred way to generate viewer materials from a COLLADA document. @return The flattened version of the instantiated material. You will need to delete this pointer manually. This pointer will - be NULL when there is no material attached to this instance. */ - DEPRECATED(3.05A, not recommended) FCDMaterial* FlattenMaterial() { return NULL; } + be nullptr when there is no material attached to this instance. */ + DEPRECATED(3.05A, not recommended) FCDMaterial* FlattenMaterial() { return nullptr; } /** Clones the material instance. @param clone The material instance to become the clone. @return The cloned material instance. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; }; #endif // _FCD_MATERIAL_BIND_H_ diff --git a/FCollada/FCDocument/FCDMorphController.cpp b/FCollada/FCDocument/FCDMorphController.cpp index 9077f41..726685e 100644 --- a/FCollada/FCDocument/FCDMorphController.cpp +++ b/FCollada/FCDocument/FCDMorphController.cpp @@ -40,21 +40,21 @@ FCDMorphController::FCDMorphController(FCDocument* document, FCDController* _par FCDMorphController::~FCDMorphController() { - parent = NULL; + parent = nullptr; } // Changes the base target of the morpher void FCDMorphController::SetBaseTarget(FCDEntity* entity) { - baseTarget = NULL; + baseTarget = nullptr; // Retrieve the actual base entity, as you can chain controllers. FCDEntity* baseEntity = entity; - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::CONTROLLER) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::CONTROLLER) { baseEntity = ((FCDController*) baseEntity)->GetBaseGeometry(); } - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::GEOMETRY) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::GEOMETRY) { baseTarget = entity; @@ -83,9 +83,9 @@ void FCDMorphController::SetBaseTarget(FCDEntity* entity) // Adds a new morph target. FCDMorphTarget* FCDMorphController::AddTarget(FCDGeometry* geometry, float weight) { - FCDMorphTarget* target = NULL; + FCDMorphTarget* target = nullptr; // It is legal to add targets with out a base geometry - if (baseTarget == NULL || IsSimilar(geometry)) + if (baseTarget == nullptr || IsSimilar(geometry)) { target = new FCDMorphTarget(GetDocument(), this); morphTargets.push_back(target); @@ -100,7 +100,7 @@ FCDMorphTarget* FCDMorphController::AddTarget(FCDGeometry* geometry, float weigh bool FCDMorphController::IsSimilar(FCDEntity* entity) { bool similar = false; - if (entity != NULL && baseTarget != NULL) + if (entity != nullptr && baseTarget != nullptr) { size_t vertexCount = 0; bool isMesh = false; @@ -108,11 +108,11 @@ bool FCDMorphController::IsSimilar(FCDEntity* entity) // Find the number of vertices in the base target FCDEntity* baseEntity = baseTarget; - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::CONTROLLER) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::CONTROLLER) { baseEntity = ((FCDController*) baseEntity)->GetBaseGeometry(); } - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::GEOMETRY) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::GEOMETRY) { FCDGeometry* g = (FCDGeometry*) baseEntity; if (g->IsMesh()) @@ -120,7 +120,7 @@ bool FCDMorphController::IsSimilar(FCDEntity* entity) isMesh = true; FCDGeometryMesh* m = g->GetMesh(); FCDGeometrySource* positions = m->GetPositionSource(); - if (positions != NULL) + if (positions != nullptr) { vertexCount = positions->GetValueCount(); } @@ -137,18 +137,18 @@ bool FCDMorphController::IsSimilar(FCDEntity* entity) // Find the number of vertices in the given entity baseEntity = entity; - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::CONTROLLER) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::CONTROLLER) { baseEntity = ((FCDController*) baseEntity)->GetBaseGeometry(); } - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::GEOMETRY) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::GEOMETRY) { FCDGeometry* g = (FCDGeometry*) baseEntity; if (g->IsMesh() && isMesh) { FCDGeometryMesh* m = g->GetMesh(); FCDGeometrySource* positions = m->GetPositionSource(); - if (positions != NULL) + if (positions != nullptr) { similar = (vertexCount == positions->GetValueCount()); } @@ -181,20 +181,20 @@ FCDMorphTarget::FCDMorphTarget(FCDocument* document, FCDMorphController* _parent FCDMorphTarget::~FCDMorphTarget() { - parent = NULL; + parent = nullptr; } void FCDMorphTarget::SetGeometry(FCDGeometry* _geometry) { // Let go of the old geometry FCDGeometry* oldGeometry = geometry; - if (oldGeometry != NULL && oldGeometry->GetTrackerCount() == 1) + if (oldGeometry != nullptr && oldGeometry->GetTrackerCount() == 1) { SAFE_RELEASE(geometry); } // Check if this geometry is similar to the controller base target - if (GetParent()->GetBaseTarget() == NULL || GetParent()->IsSimilar(_geometry)) + if (GetParent()->GetBaseTarget() == nullptr || GetParent()->IsSimilar(_geometry)) { geometry = _geometry; } diff --git a/FCollada/FCDocument/FCDMorphController.h b/FCollada/FCDocument/FCDMorphController.h index d25366d..ce319ac 100644 --- a/FCollada/FCDocument/FCDMorphController.h +++ b/FCollada/FCDocument/FCDMorphController.h @@ -95,7 +95,7 @@ class FCOLLADA_EXPORT FCDMorphTarget : public FCDObject /** Retrieves the animation associated with the morphing weight. @return The animated value associated with the morphing weight. - This pointer will be NULL if the morphing weight is not animated. */ + This pointer will be nullptr if the morphing weight is not animated. */ DEPRECATED(3.05A, GetWeight().GetAnimated()) FCDAnimated* GetAnimatedWeight(); DEPRECATED(3.05A, GetWeight().GetAnimated()) const FCDAnimated* GetAnimatedWeight() const; /**< See above. */ }; @@ -165,15 +165,15 @@ class FCOLLADA_EXPORT FCDMorphController : public FCDObject /** Retrieves a specific morph target. @param index The index of the morph target. - @return The morph target. This pointer will be NULL if the index is out-of-bounds. */ - FCDMorphTarget* GetTarget(size_t index) { FUAssert(index < GetTargetCount(), return NULL); return morphTargets.at(index); } - const FCDMorphTarget* GetTarget(size_t index) const { FUAssert(index < GetTargetCount(), return NULL); return morphTargets.at(index); } /**< See above. */ + @return The morph target. This pointer will be nullptr if the index is out-of-bounds. */ + FCDMorphTarget* GetTarget(size_t index) { FUAssert(index < GetTargetCount(), return nullptr); return morphTargets.at(index); } + const FCDMorphTarget* GetTarget(size_t index) const { FUAssert(index < GetTargetCount(), return nullptr); return morphTargets.at(index); } /**< See above. */ /** Adds a new morph target. @param geometry The morph target geometry. @param weight The morphing weight. @return The new morph target. */ - FCDMorphTarget* AddTarget(FCDGeometry* geometry = NULL, float weight = 0.0f); + FCDMorphTarget* AddTarget(FCDGeometry* geometry = nullptr, float weight = 0.0f); /** Retrieves the method used to interpolate between the different morph targets. @return The interpolation method. */ diff --git a/FCollada/FCDocument/FCDObject.cpp b/FCollada/FCDocument/FCDObject.cpp index ff61b90..91e419a 100644 --- a/FCollada/FCDocument/FCDObject.cpp +++ b/FCollada/FCDocument/FCDObject.cpp @@ -17,7 +17,7 @@ ImplementObjectType(FCDObject) FCDObject::FCDObject(FCDocument* _document) : FUParameterizable(), document(_document) -, userHandle(NULL) +, userHandle(nullptr) { SetDirtyFlag(); } diff --git a/FCollada/FCDocument/FCDParameterAnimatable.cpp b/FCollada/FCDocument/FCDParameterAnimatable.cpp index c633cdd..3077722 100644 --- a/FCollada/FCDocument/FCDParameterAnimatable.cpp +++ b/FCollada/FCDocument/FCDParameterAnimatable.cpp @@ -28,13 +28,13 @@ FCDParameterAnimatable::FCDParameterAnimatable(FUParameterizable* _parent) FCDParameterAnimatable::~FCDParameterAnimatable() { - parent = NULL; + parent = nullptr; } -FCDAnimated* FCDParameterAnimatable::GetAnimated() { if (animated == NULL) animated = CreateAnimated(); return animated; } +FCDAnimated* FCDParameterAnimatable::GetAnimated() { if (animated == nullptr) animated = CreateAnimated(); return animated; } const FCDAnimated* FCDParameterAnimatable::GetAnimated() const { - if (animated == NULL) + if (animated == nullptr) { FCDParameterAnimatable* _this = const_cast(this); _this->animated = _this->CreateAnimated(); @@ -44,13 +44,13 @@ const FCDAnimated* FCDParameterAnimatable::GetAnimated() const bool FCDParameterAnimatable::IsAnimated() const { - return animated != NULL && animated->HasCurve(); + return animated != nullptr && animated->HasCurve(); } FCDAnimated* FCDParameterAnimatable::CreateAnimated() { // Implemented below in template specializations of FCDParameterAnimatableT. - return NULL; + return nullptr; } FCDParameterAnimatable& FCDParameterAnimatable::operator= (FCDParameterAnimatable& UNUSED(parameter)) @@ -150,7 +150,7 @@ FCDParameterListAnimatable::FCDParameterListAnimatable(FUParameterizable* _paren FCDParameterListAnimatable::~FCDParameterListAnimatable() { - parent = NULL; + parent = nullptr; } const FCDAnimated* FCDParameterListAnimatable::GetAnimated(size_t index) const { return const_cast(const_cast(this)->GetAnimated(index)); } @@ -237,7 +237,7 @@ size_t FCDParameterListAnimatable::BinarySearch(size_t arrayElementIndex) const FCDAnimated* FCDParameterListAnimatable::CreateAnimated(size_t UNUSED(index)) { // Implemented by the specialized template functions below. - return NULL; + return nullptr; } // diff --git a/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.cpp b/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.cpp index 507377e..68895fd 100644 --- a/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.cpp +++ b/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.cpp @@ -29,7 +29,7 @@ FCDPhysicsAnalyticalGeometry::~FCDPhysicsAnalyticalGeometry() FCDEntity* FCDPhysicsAnalyticalGeometry::Clone(FCDEntity* _clone, bool cloneChildren) const { // FCDPhysicsAnalyticalGeometry has no data values to clone. - // It is also abstract and cannot be created if (_clone == NULL). + // It is also abstract and cannot be created if (_clone == nullptr). return Parent::Clone(_clone, cloneChildren); } @@ -47,13 +47,13 @@ FCDPASBox::FCDPASBox(FCDocument* document) FCDEntity* FCDPASBox::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASBox* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASBox(const_cast(GetDocument())); + FCDPASBox* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASBox(const_cast(GetDocument())); else if (_clone->HasType(FCDPASBox::GetClassType())) clone = (FCDPASBox*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->halfExtents = halfExtents; } @@ -78,13 +78,13 @@ FCDPASPlane::FCDPASPlane(FCDocument* document) : FCDPhysicsAnalyticalGeometry(do FCDEntity* FCDPASPlane::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASPlane* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASPlane(const_cast(GetDocument())); + FCDPASPlane* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASPlane(const_cast(GetDocument())); else if (_clone->HasType(FCDPASPlane::GetClassType())) clone = (FCDPASPlane*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->normal = normal; } @@ -109,13 +109,13 @@ FCDPASSphere::FCDPASSphere(FCDocument* document) : FCDPhysicsAnalyticalGeometry( FCDEntity* FCDPASSphere::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASSphere* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASSphere(const_cast(GetDocument())); + FCDPASSphere* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASSphere(const_cast(GetDocument())); else if (_clone->HasType(FCDPASSphere::GetClassType())) clone = (FCDPASSphere*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->radius = radius; } @@ -142,13 +142,13 @@ FCDPASCylinder::FCDPASCylinder(FCDocument* document) : FCDPhysicsAnalyticalGeome FCDEntity* FCDPASCylinder::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASCylinder* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASCylinder(const_cast(GetDocument())); + FCDPASCylinder* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASCylinder(const_cast(GetDocument())); else if (_clone->HasType(FCDPASCylinder::GetClassType())) clone = (FCDPASCylinder*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->radius = radius; clone->height = height; @@ -176,13 +176,13 @@ FCDPASCapsule::FCDPASCapsule(FCDocument* document) : FCDPhysicsAnalyticalGeometr FCDEntity* FCDPASCapsule::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASCapsule* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASCapsule(const_cast(GetDocument())); + FCDPASCapsule* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASCapsule(const_cast(GetDocument())); else if (_clone->HasType(FCDPASCapsule::GetClassType())) clone = (FCDPASCapsule*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->radius = radius; clone->height = height; @@ -209,13 +209,13 @@ FCDPASTaperedCapsule::FCDPASTaperedCapsule(FCDocument* document) : FCDPASCapsule FCDEntity* FCDPASTaperedCapsule::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASTaperedCapsule* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASTaperedCapsule(const_cast(GetDocument())); + FCDPASTaperedCapsule* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASTaperedCapsule(const_cast(GetDocument())); else if (_clone->HasType(FCDPASTaperedCapsule::GetClassType())) clone = (FCDPASTaperedCapsule*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->radius2 = radius2; } @@ -249,13 +249,13 @@ FCDPASTaperedCylinder::FCDPASTaperedCylinder(FCDocument* document) : FCDPASCylin FCDEntity* FCDPASTaperedCylinder::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPASTaperedCylinder* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPASTaperedCylinder(const_cast(GetDocument())); + FCDPASTaperedCylinder* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPASTaperedCylinder(const_cast(GetDocument())); else if (_clone->HasType(FCDPASTaperedCylinder::GetClassType())) clone = (FCDPASTaperedCylinder*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->radius2 = radius2; } @@ -287,6 +287,6 @@ FCDPhysicsAnalyticalGeometry* FCDPASFactory::CreatePAS(FCDocument* document, FCD case FCDPhysicsAnalyticalGeometry::CAPSULE: return new FCDPASCapsule(document); case FCDPhysicsAnalyticalGeometry::TAPERED_CYLINDER: return new FCDPASTaperedCylinder(document); case FCDPhysicsAnalyticalGeometry::TAPERED_CAPSULE: return new FCDPASTaperedCapsule(document); - default: return NULL; + default: return nullptr; } } diff --git a/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.h b/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.h index e7ad118..56da11a 100644 --- a/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.h +++ b/FCollada/FCDocument/FCDPhysicsAnalyticalGeometry.h @@ -68,13 +68,13 @@ class FCOLLADA_EXPORT FCDPhysicsAnalyticalGeometry : public FCDEntity virtual float CalculateVolume() const = 0; /** Copies the analytical geometry into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; /** @@ -105,13 +105,13 @@ class FCOLLADA_EXPORT FCDPASBox : public FCDPhysicsAnalyticalGeometry virtual float CalculateVolume() const; /** Copies the physics box into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: FMVector3 halfExtents; /**< Half extents of the box in 3 dimensions. */ @@ -146,13 +146,13 @@ class FCOLLADA_EXPORT FCDPASPlane : public FCDPhysicsAnalyticalGeometry virtual float CalculateVolume() const; /** Copies the physics plane into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: FMVector3 normal; /**< The normal for the plane. */ @@ -188,13 +188,13 @@ class FCOLLADA_EXPORT FCDPASSphere : public FCDPhysicsAnalyticalGeometry virtual float CalculateVolume() const; /** Copies the physics sphere into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: float radius; /**< The radius of the sphere. */ @@ -229,13 +229,13 @@ class FCOLLADA_EXPORT FCDPASCylinder : public FCDPhysicsAnalyticalGeometry virtual float CalculateVolume() const; /** Copies the physics cylinder into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: float height; /**< The height of the cylinder. */ @@ -271,13 +271,13 @@ class FCOLLADA_EXPORT FCDPASCapsule : public FCDPhysicsAnalyticalGeometry virtual float CalculateVolume() const; /** Copies the physics capsule into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: float height; /**< The height of the capsule. */ @@ -313,13 +313,13 @@ class FCOLLADA_EXPORT FCDPASTaperedCapsule : public FCDPASCapsule virtual float CalculateVolume() const; /** Copies the physics tapered capsule into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: //inherits all other attributes from Capsule @@ -355,13 +355,13 @@ class FCOLLADA_EXPORT FCDPASTaperedCylinder : public FCDPASCylinder virtual float CalculateVolume() const; /** Copies the physics tapered cylinder into a clone. - @param clone The empty clone. If this pointer is NULL, a analytical + @param clone The empty clone. If this pointer is nullptr, a analytical geometry will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; public: //inherits all other attributes from Cylinder diff --git a/FCollada/FCDocument/FCDPhysicsForceFieldInstance.cpp b/FCollada/FCDocument/FCDPhysicsForceFieldInstance.cpp index bb68f7b..ce091c6 100644 --- a/FCollada/FCDocument/FCDPhysicsForceFieldInstance.cpp +++ b/FCollada/FCDocument/FCDPhysicsForceFieldInstance.cpp @@ -30,8 +30,8 @@ FCDPhysicsForceFieldInstance::~FCDPhysicsForceFieldInstance() FCDEntityInstance* FCDPhysicsForceFieldInstance::Clone( FCDEntityInstance* _clone) const { - FCDPhysicsForceFieldInstance* clone = NULL; - if (_clone == NULL) clone = new FCDPhysicsForceFieldInstance( + FCDPhysicsForceFieldInstance* clone = nullptr; + if (_clone == nullptr) clone = new FCDPhysicsForceFieldInstance( const_cast(GetDocument()), const_cast(GetParent()), GetEntityType()); else if (!_clone->HasType(FCDPhysicsForceFieldInstance::GetClassType())) diff --git a/FCollada/FCDocument/FCDPhysicsForceFieldInstance.h b/FCollada/FCDocument/FCDPhysicsForceFieldInstance.h index 597fd6f..9a36cfa 100644 --- a/FCollada/FCDocument/FCDPhysicsForceFieldInstance.h +++ b/FCollada/FCDocument/FCDPhysicsForceFieldInstance.h @@ -41,7 +41,7 @@ class FCOLLADA_EXPORT FCDPhysicsForceFieldInstance : public FCDEntityInstance @param document The COLLADA document that contains this physics model instance. @param parent The parent node for this force field. At the time of - writing, this should be NULL since only parents are physics model + writing, this should be nullptr since only parents are physics model instances and physics scene. @param entityType The entity type: FORCE_FIELD. */ FCDPhysicsForceFieldInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type entityType = FCDEntity::FORCE_FIELD); @@ -59,10 +59,10 @@ class FCOLLADA_EXPORT FCDPhysicsForceFieldInstance : public FCDEntityInstance /** Clones the physics force field instance. @param clone The physics force field instance to become the clone. - If this pointer is NULL, a new physics force field instance will be + If this pointer is nullptr, a new physics force field instance will be created and you will need to release it. @return The clone. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; }; #endif // _FCD_PHYSICS_FORCE_FIELD_INSTANCE_H_ diff --git a/FCollada/FCDocument/FCDPhysicsMaterial.cpp b/FCollada/FCDocument/FCDPhysicsMaterial.cpp index 1b9c70f..e977390 100644 --- a/FCollada/FCDocument/FCDPhysicsMaterial.cpp +++ b/FCollada/FCDocument/FCDPhysicsMaterial.cpp @@ -27,13 +27,13 @@ FCDPhysicsMaterial::~FCDPhysicsMaterial() // Cloning FCDEntity* FCDPhysicsMaterial::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPhysicsMaterial* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsMaterial(const_cast(GetDocument())); + FCDPhysicsMaterial* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsMaterial(const_cast(GetDocument())); else if (_clone->HasType(FCDPhysicsMaterial::GetClassType())) clone = (FCDPhysicsMaterial*) _clone; Parent::Clone(clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->SetStaticFriction(staticFriction); clone->SetDynamicFriction(dynamicFriction); diff --git a/FCollada/FCDocument/FCDPhysicsMaterial.h b/FCollada/FCDocument/FCDPhysicsMaterial.h index 6d9243e..f169836 100644 --- a/FCollada/FCDocument/FCDPhysicsMaterial.h +++ b/FCollada/FCDocument/FCDPhysicsMaterial.h @@ -75,13 +75,13 @@ class FCOLLADA_EXPORT FCDPhysicsMaterial : public FCDEntity void SetRestitution(float _restitution) { restitution = _restitution; SetDirtyFlag(); } /** Copies the physics material into a clone. - @param clone The empty clone. If this pointer is NULL, a new physics + @param clone The empty clone. If this pointer is nullptr, a new physics material will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_MATERIAL_H_ diff --git a/FCollada/FCDocument/FCDPhysicsModel.cpp b/FCollada/FCDocument/FCDPhysicsModel.cpp index f7f8699..344a333 100644 --- a/FCollada/FCDocument/FCDPhysicsModel.cpp +++ b/FCollada/FCDocument/FCDPhysicsModel.cpp @@ -51,13 +51,13 @@ FCDPhysicsRigidConstraint* FCDPhysicsModel::AddRigidConstraint() FCDEntity* FCDPhysicsModel::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPhysicsModel* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsModel(const_cast(GetDocument())); + FCDPhysicsModel* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsModel(const_cast(GetDocument())); else if (_clone->HasType(FCDPhysicsModel::GetClassType())) clone = (FCDPhysicsModel*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Clone the rigid bodies for (FCDPhysicsRigidBodyContainer::const_iterator it = rigidBodies.begin(); it != rigidBodies.end(); ++it) @@ -89,7 +89,7 @@ const FCDPhysicsRigidBody* FCDPhysicsModel::FindRigidBodyFromSid(const fm::strin { if ((*it)->GetSubId() == sid) return (*it); } - return NULL; + return nullptr; } const FCDPhysicsRigidConstraint* FCDPhysicsModel::FindRigidConstraintFromSid(const fm::string& sid) const @@ -98,7 +98,7 @@ const FCDPhysicsRigidConstraint* FCDPhysicsModel::FindRigidConstraintFromSid(con { if ((*it)->GetSubId() == sid) return (*it); } - return NULL; + return nullptr; } bool FCDPhysicsModel::AttachModelInstances() @@ -112,7 +112,7 @@ bool FCDPhysicsModel::AttachModelInstances() if (!url.IsFile()) { FCDEntity* entity = GetDocument()->FindPhysicsModel(TO_STRING(url.GetFragment())); - if (entity != NULL) + if (entity != nullptr) { FCDPhysicsModel* model = (FCDPhysicsModel*) entity; diff --git a/FCollada/FCDocument/FCDPhysicsModel.h b/FCollada/FCDocument/FCDPhysicsModel.h index 8adc80a..b431ac8 100644 --- a/FCollada/FCDocument/FCDPhysicsModel.h +++ b/FCollada/FCDocument/FCDPhysicsModel.h @@ -83,15 +83,15 @@ class FCOLLADA_EXPORT FCDPhysicsModel : public FCDEntity physics model. @param index The index of the instance. @return The physics model instance. */ - FCDPhysicsModelInstance* GetInstance(size_t index) { FUAssert(index < instances.size(), return NULL); return instances.at(index); } - const FCDPhysicsModelInstance* GetInstance(size_t index) const { FUAssert(index < instances.size(), return NULL); return instances.at(index); } /**< See above. */ + FCDPhysicsModelInstance* GetInstance(size_t index) { FUAssert(index < instances.size(), return nullptr); return instances.at(index); } + const FCDPhysicsModelInstance* GetInstance(size_t index) const { FUAssert(index < instances.size(), return nullptr); return instances.at(index); } /**< See above. */ /** Adds a instantiated physics model to this physics model. @param model The physics model to be instanced in this physics model. - If this value is NULL, then there is no associated physics model + If this value is nullptr, then there is no associated physics model for the instance yet. It should be filled in. @return The new physics model instance. */ - FCDPhysicsModelInstance* AddPhysicsModelInstance(FCDPhysicsModel* model = NULL); + FCDPhysicsModelInstance* AddPhysicsModelInstance(FCDPhysicsModel* model = nullptr); /** Retrieves the rigid bodies that are a part of this physics model. @return The rigid bodies. */ @@ -107,8 +107,8 @@ class FCOLLADA_EXPORT FCDPhysicsModel : public FCDEntity by its index. @param index The index of the rigid body. @return The rigid body. */ - FCDPhysicsRigidBody* GetRigidBody(size_t index) { FUAssert(index < rigidBodies.size(), return NULL); return rigidBodies.at(index); } - const FCDPhysicsRigidBody* GetRigidBody(size_t index) const { FUAssert(index < rigidBodies.size(), return NULL); return rigidBodies.at(index); } /**< See above. */ + FCDPhysicsRigidBody* GetRigidBody(size_t index) { FUAssert(index < rigidBodies.size(), return nullptr); return rigidBodies.at(index); } + const FCDPhysicsRigidBody* GetRigidBody(size_t index) const { FUAssert(index < rigidBodies.size(), return nullptr); return rigidBodies.at(index); } /**< See above. */ /** Retrieves a specific rigid body that is a part of this physics model by its sid. @@ -135,8 +135,8 @@ class FCOLLADA_EXPORT FCDPhysicsModel : public FCDEntity model by its index. @param index The index of the rigid constraint. @return The rigid constraint. */ - FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) { FUAssert(index < GetRigidConstraintCount(), return NULL); return rigidConstraints.at(index); } - const FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) const { FUAssert(index < GetRigidConstraintCount(), return NULL); return rigidConstraints.at(index); } /**< See above. */ + FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) { FUAssert(index < GetRigidConstraintCount(), return nullptr); return rigidConstraints.at(index); } + const FCDPhysicsRigidConstraint* GetRigidConstraint(size_t index) const { FUAssert(index < GetRigidConstraintCount(), return nullptr); return rigidConstraints.at(index); } /**< See above. */ /** Retrieves a specific rigid constraint that is a part of tihs physics model by its sid. @@ -150,13 +150,13 @@ class FCOLLADA_EXPORT FCDPhysicsModel : public FCDEntity FCDPhysicsRigidConstraint* AddRigidConstraint(); /** Copies the physics model into a clone. - @param clone The empty clone. If this pointer is NULL, a new physics + @param clone The empty clone. If this pointer is nullptr, a new physics model will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** [INTERNAL] Attaches the model instances. Because model instances can instance other models, the ordering is unknown so this cannot be done in the diff --git a/FCollada/FCDocument/FCDPhysicsModelInstance.cpp b/FCollada/FCDocument/FCDPhysicsModelInstance.cpp index adf13a7..4ba60f9 100644 --- a/FCollada/FCDocument/FCDPhysicsModelInstance.cpp +++ b/FCollada/FCDocument/FCDPhysicsModelInstance.cpp @@ -28,7 +28,7 @@ ImplementObjectType(FCDPhysicsModelInstance) ImplementParameterObjectNoCtr(FCDPhysicsModelInstance, FCDEntityInstance, instances) FCDPhysicsModelInstance::FCDPhysicsModelInstance(FCDocument* document) -: FCDEntityInstance(document, NULL, FCDEntity::PHYSICS_MODEL) +: FCDEntityInstance(document, nullptr, FCDEntity::PHYSICS_MODEL) , InitializeParameterNoArg(instances) { } @@ -55,7 +55,7 @@ FCDPhysicsRigidConstraintInstance* FCDPhysicsModelInstance::AddRigidConstraintIn FCDPhysicsForceFieldInstance* FCDPhysicsModelInstance::AddForceFieldInstance(FCDForceField* forceField) { - FCDEntityInstance* instance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), (FCDSceneNode*) NULL, forceField); + FCDEntityInstance* instance = FCDEntityInstanceFactory::CreateInstance(GetDocument(), (FCDSceneNode*) nullptr, forceField); instances.push_back(instance); SetNewChildFlag(); return (FCDPhysicsForceFieldInstance*)instance; @@ -69,17 +69,17 @@ bool FCDPhysicsModelInstance::RemoveInstance(FCDEntityInstance* instance) FCDEntityInstance* FCDPhysicsModelInstance::Clone(FCDEntityInstance* _clone) const { - FCDPhysicsModelInstance* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsModelInstance(const_cast(GetDocument())); + FCDPhysicsModelInstance* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsModelInstance(const_cast(GetDocument())); else if (_clone->HasType(FCDPhysicsModelInstance::GetClassType())) clone = (FCDPhysicsModelInstance*) _clone; Parent::Clone(_clone); - if (clone != NULL) + if (clone != nullptr) { for (const FCDEntityInstance** it = instances.begin(); it != instances.end(); ++it) { - FCDEntityInstance* clonedInstance = NULL; + FCDEntityInstance* clonedInstance = nullptr; switch ((*it)->GetEntityType()) { case FCDEntity::PHYSICS_RIGID_BODY: clonedInstance = clone->AddRigidBodyInstance(); break; @@ -87,7 +87,7 @@ FCDEntityInstance* FCDPhysicsModelInstance::Clone(FCDEntityInstance* _clone) con case FCDEntity::FORCE_FIELD: clonedInstance = clone->AddForceFieldInstance(); break; default: FUFail(break); } - if (clonedInstance != NULL) (*it)->Clone(clonedInstance); + if (clonedInstance != nullptr) (*it)->Clone(clonedInstance); } } return _clone; diff --git a/FCollada/FCDocument/FCDPhysicsModelInstance.h b/FCollada/FCDocument/FCDPhysicsModelInstance.h index 5acddbe..6dd192d 100644 --- a/FCollada/FCDocument/FCDPhysicsModelInstance.h +++ b/FCollada/FCDocument/FCDPhysicsModelInstance.h @@ -65,30 +65,30 @@ class FCOLLADA_EXPORT FCDPhysicsModelInstance : public FCDEntityInstance index. @param index The index. @return The instance. */ - FCDEntityInstance* GetInstance(size_t index) { FUAssert(index < GetInstanceCount(), return NULL); return instances.at(index); } - const FCDEntityInstance* GetInstance(size_t index) const { FUAssert(index < GetInstanceCount(), return NULL); return instances.at(index); } /**< See above. */ + FCDEntityInstance* GetInstance(size_t index) { FUAssert(index < GetInstanceCount(), return nullptr); return instances.at(index); } + const FCDEntityInstance* GetInstance(size_t index) const { FUAssert(index < GetInstanceCount(), return nullptr); return instances.at(index); } /**< See above. */ /** Adds an instantiated rigid body to this physics model instance. @param rigidBody The rigid body to be instanced in this physics model - instance. If this value is NULL, then there is no associated + instance. If this value is nullptr, then there is no associated rigid body for the instance yet. It should be filled in. @return The new rigid body instance. */ - FCDPhysicsRigidBodyInstance* AddRigidBodyInstance(FCDPhysicsRigidBody* rigidBody = NULL); + FCDPhysicsRigidBodyInstance* AddRigidBodyInstance(FCDPhysicsRigidBody* rigidBody = nullptr); /** Adds an instantiated rigid constraint to this physics model instance. @param rigidConstraint The rigid constraint to be instanced in this - physics model instance. If this value is NULL, then there is no + physics model instance. If this value is nullptr, then there is no associated rigid constraint for the instance yet. It should be filled in. @return The new rigid constraint instance. */ - FCDPhysicsRigidConstraintInstance* AddRigidConstraintInstance(FCDPhysicsRigidConstraint* rigidConstraint = NULL); + FCDPhysicsRigidConstraintInstance* AddRigidConstraintInstance(FCDPhysicsRigidConstraint* rigidConstraint = nullptr); /** Adds an instantiated force field to this physics model instance. @param forceField The force field to be instanced in this physics model - instance. If this value is NULL, then there is no associated + instance. If this value is nullptr, then there is no associated force field for the instance yet. It should be filled in. @return The new force field instance. */ - FCDPhysicsForceFieldInstance* AddForceFieldInstance(FCDForceField* forceField = NULL); + FCDPhysicsForceFieldInstance* AddForceFieldInstance(FCDForceField* forceField = nullptr); /** Removes and deletes the instance from the model. @param instance The instance to remove. @@ -96,11 +96,11 @@ class FCOLLADA_EXPORT FCDPhysicsModelInstance : public FCDEntityInstance DEPRECATED(3.05A, instance->Release() or SAFE_RELEASE(instance)) bool RemoveInstance(FCDEntityInstance* instance); /** Copies the physics model instance into a clone. - @param clone The empty clone. If this pointer is NULL, a new physics + @param clone The empty clone. If this pointer is nullptr, a new physics model instance will be created and you will need to release the returned pointer manually. @return The clone. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; /** [INTERNAL] Cleans up the sub identifiers. The sub identifiers must be unique with respect to its parent. This method corrects the sub ids if there are conflicts. diff --git a/FCollada/FCDocument/FCDPhysicsRigidBody.cpp b/FCollada/FCDocument/FCDPhysicsRigidBody.cpp index b848f8b..06443e8 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBody.cpp +++ b/FCollada/FCDocument/FCDPhysicsRigidBody.cpp @@ -31,13 +31,13 @@ FCDPhysicsRigidBody::~FCDPhysicsRigidBody() FCDEntity* FCDPhysicsRigidBody::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPhysicsRigidBody* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsRigidBody(const_cast(GetDocument())); + FCDPhysicsRigidBody* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsRigidBody(const_cast(GetDocument())); else if (_clone->HasType(FCDPhysicsRigidBody::GetClassType())) clone = (FCDPhysicsRigidBody*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->GetParameters()->CopyFrom(*parameters); } diff --git a/FCollada/FCDocument/FCDPhysicsRigidBody.h b/FCollada/FCDocument/FCDPhysicsRigidBody.h index 7363453..3f8ed90 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBody.h +++ b/FCollada/FCDocument/FCDPhysicsRigidBody.h @@ -73,13 +73,13 @@ class FCOLLADA_EXPORT FCDPhysicsRigidBody : public FCDEntity float GetShapeMassFactor() const; /** Copies the rigid body into a clone. - @param clone The empty clone. If this pointer is NULL, a new rigid + @param clone The empty clone. If this pointer is nullptr, a new rigid body will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_PHYSICSRIGIDBODY_H_ diff --git a/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.cpp b/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.cpp index ad00704..84f285b 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.cpp +++ b/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.cpp @@ -26,8 +26,8 @@ ImplementParameterObject(FCDPhysicsRigidBodyInstance, FCDPhysicsRigidBodyParamet ImplementParameterObjectNoCtr(FCDPhysicsRigidBodyInstance, FCDSceneNode, targetNode) FCDPhysicsRigidBodyInstance::FCDPhysicsRigidBodyInstance(FCDocument* document, FCDPhysicsModelInstance* _parent, FCDPhysicsRigidBody* body) -: FCDEntityInstance(document, NULL, FCDEntity::PHYSICS_RIGID_BODY) -, parent(_parent), onCollisionEvent(NULL) +: FCDEntityInstance(document, nullptr, FCDEntity::PHYSICS_RIGID_BODY) +, parent(_parent), onCollisionEvent(nullptr) , InitializeParameterAnimatable(velocity, FMVector3::Zero) , InitializeParameterAnimatable(angularVelocity, FMVector3::Zero) , InitializeParameterNoArg(parameters) @@ -35,37 +35,37 @@ FCDPhysicsRigidBodyInstance::FCDPhysicsRigidBodyInstance(FCDocument* document, F { onCollisionEvent = new CollisionEvent(); parameters = new FCDPhysicsRigidBodyParameters(document, this); - if (body != NULL) SetRigidBody(body); + if (body != nullptr) SetRigidBody(body); } FCDPhysicsRigidBodyInstance::~FCDPhysicsRigidBodyInstance() { - parent = NULL; + parent = nullptr; SAFE_DELETE(onCollisionEvent); } FCDEntityInstance* FCDPhysicsRigidBodyInstance::Clone(FCDEntityInstance* _clone) const { - FCDPhysicsRigidBodyInstance* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsRigidBodyInstance(const_cast(GetDocument()), NULL, NULL); + FCDPhysicsRigidBodyInstance* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsRigidBodyInstance(const_cast(GetDocument()), nullptr, nullptr); else clone = DynamicCast(_clone); Parent::Clone(_clone); - if (clone != NULL) + if (clone != nullptr) { clone->angularVelocity = angularVelocity; clone->velocity = velocity; clone->GetParameters()->CopyFrom(*parameters); - // Intentionally leave the target scene node as NULL. + // Intentionally leave the target scene node as nullptr. } return _clone; } void FCDPhysicsRigidBodyInstance::SetRigidBody(FCDPhysicsRigidBody* body) { - FUAssert(body != NULL, return); + FUAssert(body != nullptr, return); SetEntity(body); diff --git a/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.h b/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.h index 83b049a..56d68eb 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.h +++ b/FCollada/FCDocument/FCDPhysicsRigidBodyInstance.h @@ -56,7 +56,7 @@ class FCOLLADA_EXPORT FCDPhysicsRigidBodyInstance : public FCDEntityInstance @param _parent The physics model instance holding this rigid body instance. @param body The rigid body to instance. Default values are taken from - here. This should not be NULL unless it is expected to be filled in + here. This should not be nullptr unless it is expected to be filled in by LoadFromXML. */ FCDPhysicsRigidBodyInstance(FCDocument* document, FCDPhysicsModelInstance* _parent, FCDPhysicsRigidBody* body); @@ -119,10 +119,10 @@ class FCOLLADA_EXPORT FCDPhysicsRigidBodyInstance : public FCDEntityInstance /** Clones the rigid body instance. @param clone The rigid body instance to become the clone. - If this pointer is NULL, a new rigid body instance will be created + If this pointer is nullptr, a new rigid body instance will be created and you will need to release it. @return The clone. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; /** [INTERNAL] Sets the rigid body for this rigid body instance. Default values are taken from the rigid body. diff --git a/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.cpp b/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.cpp index 03f6fa6..27cc637 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.cpp +++ b/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.cpp @@ -67,7 +67,7 @@ FCDPhysicsRigidBodyParameters::~FCDPhysicsRigidBodyParameters() } else { - physicsMaterial = NULL; + physicsMaterial = nullptr; } } @@ -87,7 +87,7 @@ void FCDPhysicsRigidBodyParameters::CopyFrom(const FCDPhysicsRigidBodyParameters (*it)->Clone(clonedShape); } - if (original.physicsMaterial != NULL) + if (original.physicsMaterial != nullptr) { if (parent->IsLocal(original.parent)) { @@ -101,7 +101,7 @@ void FCDPhysicsRigidBodyParameters::CopyFrom(const FCDPhysicsRigidBodyParameters } // Clone the material instance - if (original.instanceMaterialRef != NULL) + if (original.instanceMaterialRef != nullptr) { instanceMaterialRef = original.instanceMaterialRef->Clone(); } diff --git a/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.h b/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.h index ad53f62..551e36f 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.h +++ b/FCollada/FCDocument/FCDPhysicsRigidBodyParameters.h @@ -65,7 +65,7 @@ class FCOLLADA_EXPORT FCDPhysicsRigidBodyParameters : public FCDObject public: /** Constructor. @param owner The owner of this parameters holder. Its SetDirty will be - called whenever this class is modified. It cannot be NULL. */ + called whenever this class is modified. It cannot be nullptr. */ FCDPhysicsRigidBodyParameters(FCDocument* document, FCDPhysicsRigidBody* owner); FCDPhysicsRigidBodyParameters(FCDocument* document, FCDPhysicsRigidBodyInstance* owner); /**< See above. */ @@ -198,8 +198,8 @@ class FCOLLADA_EXPORT FCDPhysicsRigidBodyParameters : public FCDObject /** Retrieves a speficied physics shape of the owner by index. @param index The index of the physics shape. @return The physics shape. */ - FCDPhysicsShape* GetPhysicsShape(size_t index) { FUAssert(index < physicsShape.size(), return NULL) return physicsShape.at(index); } - const FCDPhysicsShape* GetPhysicsShape(size_t index) const { FUAssert(index < physicsShape.size(), return NULL) return physicsShape.at(index); } /**< See above. */ + FCDPhysicsShape* GetPhysicsShape(size_t index) { FUAssert(index < physicsShape.size(), return nullptr) return physicsShape.at(index); } + const FCDPhysicsShape* GetPhysicsShape(size_t index) const { FUAssert(index < physicsShape.size(), return nullptr) return physicsShape.at(index); } /**< See above. */ /** Adds a physics shape to the owner. @return The new physics shape. */ diff --git a/FCollada/FCDocument/FCDPhysicsRigidConstraint.cpp b/FCollada/FCDocument/FCDPhysicsRigidConstraint.cpp index eb4a027..9fd0463 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidConstraint.cpp +++ b/FCollada/FCDocument/FCDPhysicsRigidConstraint.cpp @@ -42,16 +42,16 @@ FCDPhysicsRigidConstraint::FCDPhysicsRigidConstraint(FCDocument* document, FCDPh FCDPhysicsRigidConstraint::~FCDPhysicsRigidConstraint() { - referenceRigidBody = NULL; - targetRigidBody = NULL; + referenceRigidBody = nullptr; + targetRigidBody = nullptr; transformsTar.clear(); transformsRef.clear(); } FCDTransform* FCDPhysicsRigidConstraint::AddTransformRef(FCDTransform::Type type, size_t index) { - FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), NULL, type); - if (transform != NULL) + FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), nullptr, type); + if (transform != nullptr) { if (index > transformsRef.size()) transformsRef.push_back(transform); else transformsRef.insert(transformsRef.begin() + index, transform); @@ -62,8 +62,8 @@ FCDTransform* FCDPhysicsRigidConstraint::AddTransformRef(FCDTransform::Type type FCDTransform* FCDPhysicsRigidConstraint::AddTransformTar(FCDTransform::Type type, size_t index) { - FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), NULL, type); - if (transform != NULL) + FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), nullptr, type); + if (transform != nullptr) { if (index > transformsTar.size()) transformsTar.push_back(transform); else transformsTar.insert(transformsTar.begin() + index, transform); @@ -75,13 +75,13 @@ FCDTransform* FCDPhysicsRigidConstraint::AddTransformTar(FCDTransform::Type type // Create a copy of this physicsRigidConstraint, with the vertices overwritten FCDEntity* FCDPhysicsRigidConstraint::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDPhysicsRigidConstraint* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsRigidConstraint(const_cast(GetDocument()), NULL); + FCDPhysicsRigidConstraint* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsRigidConstraint(const_cast(GetDocument()), nullptr); else if (_clone->HasType(FCDPhysicsRigidConstraint::GetClassType())) clone = (FCDPhysicsRigidConstraint*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { clone->enabled = enabled; clone->interpenetrate = interpenetrate; diff --git a/FCollada/FCDocument/FCDPhysicsRigidConstraint.h b/FCollada/FCDocument/FCDPhysicsRigidConstraint.h index 7944a53..2bb42c4 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidConstraint.h +++ b/FCollada/FCDocument/FCDPhysicsRigidConstraint.h @@ -114,7 +114,7 @@ class FCOLLADA_EXPORT FCDPhysicsRigidConstraint : public FCDEntity /** Sets the attached rigid body which is the reference. @param _referenceRigidBody The reference rigid body. */ - void SetReferenceRigidBody(FCDPhysicsRigidBody* _referenceRigidBody) { referenceRigidBody = _referenceRigidBody; referenceNode = NULL; SetNewChildFlag(); } + void SetReferenceRigidBody(FCDPhysicsRigidBody* _referenceRigidBody) { referenceRigidBody = _referenceRigidBody; referenceNode = nullptr; SetNewChildFlag(); } /** Retrieves the attached rigid body which is not the reference. @return The non reference rigid body. */ @@ -123,33 +123,33 @@ class FCOLLADA_EXPORT FCDPhysicsRigidConstraint : public FCDEntity /** Sets the attached rigid body which is not the reference. @param _targetRigidBody The non reference rigid body. */ - void SetTargetRigidBody(FCDPhysicsRigidBody* _targetRigidBody) { targetRigidBody = _targetRigidBody; targetNode = NULL; SetNewChildFlag(); } + void SetTargetRigidBody(FCDPhysicsRigidBody* _targetRigidBody) { targetRigidBody = _targetRigidBody; targetNode = nullptr; SetNewChildFlag(); } /** Retrieves the attached node which is the reference. This method should be avoided as the specification says the attachment should be to a - rigid body. This value is only used if GetReferenceRigidBody is NULL. + rigid body. This value is only used if GetReferenceRigidBody is nullptr. @return The attached reference node. */ FCDSceneNode* GetReferenceNode() { return referenceNode; } const FCDSceneNode* GetReferenceNode() const { return referenceNode; } /**< See above. */ /** Sets the attached node which is the reference. This method should be avoided as the specification says the attachment should be to a rigid - body. This value is only used if GetReferenceRigidBody is NULL. + body. This value is only used if GetReferenceRigidBody is nullptr. @param _referenceNode The attached reference node. */ - void SetReferenceNode(FCDSceneNode* _referenceNode) { referenceNode = _referenceNode; referenceRigidBody = NULL; SetNewChildFlag(); } + void SetReferenceNode(FCDSceneNode* _referenceNode) { referenceNode = _referenceNode; referenceRigidBody = nullptr; SetNewChildFlag(); } /** Retrieves the attached node which is not the reference. This method should be avoided as the specification says the attachment should be to - a rigid body. This value is only used if GetTargetRigidBody is NULL. + a rigid body. This value is only used if GetTargetRigidBody is nullptr. @return The attached non reference node. */ FCDSceneNode* GetTargetNode() { return targetNode; } const FCDSceneNode* GetTargetNode() const { return targetNode; } /**< See above. */ /** Sets the attached node which is not the reference. This method should be avoided as the specification says the attachment should be to a - rigid body. This value is only used if GetTargetRigidBody is NULL. + rigid body. This value is only used if GetTargetRigidBody is nullptr. @param _targetNode The attached non reference node. */ - void SetTargetNode(FCDSceneNode* _targetNode) { targetNode = _targetNode; targetRigidBody = NULL; SetNewChildFlag(); } + void SetTargetNode(FCDSceneNode* _targetNode) { targetNode = _targetNode; targetRigidBody = nullptr; SetNewChildFlag(); } /** Retrieves the transforms for the attached rigid body which is the reference. @@ -297,22 +297,22 @@ class FCOLLADA_EXPORT FCDPhysicsRigidConstraint : public FCDEntity void SetSpringAngularTargetValue(float _springAngularTargetValue) { springAngularTargetValue = _springAngularTargetValue; SetDirtyFlag(); } /** Retrieves the animated value for enabled. - @returns The animated value, or NULL if enabled is not animated. */ + @returns The animated value, or nullptr if enabled is not animated. */ DEPRECATED(3.05A, GetEnabled().GetAnimated) FCDAnimated* GetAnimatedEnabled() { return GetEnabled().GetAnimated(); } DEPRECATED(3.05A, GetEnabled().GetAnimated) const FCDAnimated* GetAnimatedEnabled() const { return GetEnabled().GetAnimated(); } /**< See above. */ /** Retrieves the animated value for interpenetrate. - @returns The animated value, or NULL if interpenetrate is not animated. */ + @returns The animated value, or nullptr if interpenetrate is not animated. */ DEPRECATED(3.05A, GetInterpenetrate().GetAnimated) FCDAnimated* GetAnimatedInterpenetrate() { return GetInterpenetrate().GetAnimated(); } DEPRECATED(3.05A, GetInterpenetrate().GetAnimated) const FCDAnimated* GetAnimatedInterpenetrate() const { return GetInterpenetrate().GetAnimated(); } /**< See above. */ /** Copies the rigid constraint into a clone. - @param clone The empty clone. If this pointer is NULL, a new rigid + @param clone The empty clone. If this pointer is nullptr, a new rigid constraint will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; #endif // _FCD_PHYSICS_RIGID_CONSTRAINT_H_ diff --git a/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.cpp b/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.cpp index 2162049..c49d56e 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.cpp +++ b/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.cpp @@ -19,9 +19,9 @@ ImplementObjectType(FCDPhysicsRigidConstraintInstance) FCDPhysicsRigidConstraintInstance::FCDPhysicsRigidConstraintInstance(FCDocument* document, FCDPhysicsModelInstance* _parent, FCDPhysicsRigidConstraint* constraint) -: FCDEntityInstance(document, NULL, FCDEntity::PHYSICS_RIGID_CONSTRAINT), parent(_parent) +: FCDEntityInstance(document, nullptr, FCDEntity::PHYSICS_RIGID_CONSTRAINT), parent(_parent) { - if (constraint != NULL) + if (constraint != nullptr) { SetRigidConstraint(constraint); } @@ -29,18 +29,18 @@ FCDPhysicsRigidConstraintInstance::FCDPhysicsRigidConstraintInstance(FCDocument* FCDPhysicsRigidConstraintInstance::~FCDPhysicsRigidConstraintInstance() { - parent = NULL; + parent = nullptr; } FCDEntityInstance* FCDPhysicsRigidConstraintInstance::Clone(FCDEntityInstance* _clone) const { - FCDPhysicsRigidConstraintInstance* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDPhysicsRigidConstraintInstance(const_cast(GetDocument()), NULL, NULL); + FCDPhysicsRigidConstraintInstance* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDPhysicsRigidConstraintInstance(const_cast(GetDocument()), nullptr, nullptr); else if (_clone->HasType(FCDPhysicsRigidConstraintInstance::GetClassType())) clone = (FCDPhysicsRigidConstraintInstance*) _clone; Parent::Clone(_clone); - if (clone != NULL) + if (clone != nullptr) { // No interesting data to clone. } @@ -51,7 +51,7 @@ FCDEntityInstance* FCDPhysicsRigidConstraintInstance::Clone(FCDEntityInstance* _ void FCDPhysicsRigidConstraintInstance::SetRigidConstraint( FCDPhysicsRigidConstraint* constraint) { - FUAssert(constraint != NULL, ;); + FUAssert(constraint != nullptr, ;); SetEntity(constraint); } diff --git a/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.h b/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.h index cf61b18..a390c48 100644 --- a/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.h +++ b/FCollada/FCDocument/FCDPhysicsRigidConstraintInstance.h @@ -48,7 +48,7 @@ class FCOLLADA_EXPORT FCDPhysicsRigidConstraintInstance : public FCDEntityInstan @param parent The physics model instance that contains this rigid constraint instance. @param constraint The rigid constraint to instance. This should not be - NULL unless it is expected to be filled in by LoadFromXML. */ + nullptr unless it is expected to be filled in by LoadFromXML. */ FCDPhysicsRigidConstraintInstance(FCDocument* document, FCDPhysicsModelInstance* parent, FCDPhysicsRigidConstraint* constraint); /** Destructor. */ @@ -71,10 +71,10 @@ class FCOLLADA_EXPORT FCDPhysicsRigidConstraintInstance : public FCDEntityInstan /** Clones the rigid constraint instance. @param clone The rigid constraint instance to become the clone. - If this pointer is NULL, a new rigid constraint instance will be + If this pointer is nullptr, a new rigid constraint instance will be created and you will need to release it. @return The clone. */ - virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const; + virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = nullptr) const; /** [INTERNAL] Retrieve it's parent model instance. @return The parent of the intance. diff --git a/FCollada/FCDocument/FCDPhysicsScene.cpp b/FCollada/FCDocument/FCDPhysicsScene.cpp index 15ddf3c..42386e5 100644 --- a/FCollada/FCDocument/FCDPhysicsScene.cpp +++ b/FCollada/FCDocument/FCDPhysicsScene.cpp @@ -81,7 +81,7 @@ FCDPhysicsForceFieldInstance* FCDPhysicsScene::AddForceFieldInstance(FCDForceFie { FCDPhysicsForceFieldInstance* instance = (FCDPhysicsForceFieldInstance*) FCDEntityInstanceFactory::CreateInstance( - GetDocument(), (FCDSceneNode*) NULL, forceField); + GetDocument(), (FCDSceneNode*) nullptr, forceField); forceFieldInstances.push_back(instance); SetNewChildFlag(); return instance; diff --git a/FCollada/FCDocument/FCDPhysicsScene.h b/FCollada/FCDocument/FCDPhysicsScene.h index ceed9ee..6d03f13 100644 --- a/FCollada/FCDocument/FCDPhysicsScene.h +++ b/FCollada/FCDocument/FCDPhysicsScene.h @@ -81,8 +81,8 @@ class FCOLLADA_EXPORT FCDPhysicsScene : public FCDEntity physics scene by index. @param index The index of the physics model instance. @return The physics model instance. */ - FCDPhysicsModelInstance* GetPhysicsModelInstance(size_t index) { FUAssert(index < GetPhysicsModelInstancesCount(), return NULL); return physicsModelInstances.at(index); } - const FCDPhysicsModelInstance* GetPhysicsModelInstance(size_t index) const { FUAssert(index < GetPhysicsModelInstancesCount(), return NULL); return physicsModelInstances.at(index); } /**< See above. */ + FCDPhysicsModelInstance* GetPhysicsModelInstance(size_t index) { FUAssert(index < GetPhysicsModelInstancesCount(), return nullptr); return physicsModelInstances.at(index); } + const FCDPhysicsModelInstance* GetPhysicsModelInstance(size_t index) const { FUAssert(index < GetPhysicsModelInstancesCount(), return nullptr); return physicsModelInstances.at(index); } /**< See above. */ /** Retrieves the physics force field instances that are a part of this physics scene. @@ -99,21 +99,21 @@ class FCOLLADA_EXPORT FCDPhysicsScene : public FCDEntity tihs physics scene by index. @param index The index of the physics force field instance. @return The physics force field instance. */ - FCDPhysicsForceFieldInstance* GetForceFieldInstance(size_t index) { FUAssert(index < GetForceFieldInstancesCount(), return NULL); return forceFieldInstances.at(index); } - const FCDPhysicsForceFieldInstance* GetForceFieldInstance(size_t index) const { FUAssert(index < GetForceFieldInstancesCount(), return NULL); return forceFieldInstances.at(index); } /**< See above. */ + FCDPhysicsForceFieldInstance* GetForceFieldInstance(size_t index) { FUAssert(index < GetForceFieldInstancesCount(), return nullptr); return forceFieldInstances.at(index); } + const FCDPhysicsForceFieldInstance* GetForceFieldInstance(size_t index) const { FUAssert(index < GetForceFieldInstancesCount(), return nullptr); return forceFieldInstances.at(index); } /**< See above. */ /** Adds an instantiated physics model to this physics model. @param model The physics model to be instanced in this physics model. - If this value is NULL, then there is no associated physics model + If this value is nullptr, then there is no associated physics model for the instance yet. It should be filled in. @return The new physics model instance. */ - FCDPhysicsModelInstance* AddPhysicsModelInstance(FCDPhysicsModel* model = NULL); + FCDPhysicsModelInstance* AddPhysicsModelInstance(FCDPhysicsModel* model = nullptr); /** Adds an instantiated force field to this physics model. @param forceField The force field to be instanced in this physics model. @return The new force field instance. */ - FCDPhysicsForceFieldInstance* AddForceFieldInstance(FCDForceField* forceField = NULL); + FCDPhysicsForceFieldInstance* AddForceFieldInstance(FCDForceField* forceField = nullptr); /** Retrieves the gravity magnitude and direction as a 3 dimensional vector. @@ -133,13 +133,13 @@ class FCOLLADA_EXPORT FCDPhysicsScene : public FCDEntity void SetTimestep(float _timestep) { timestep = _timestep; SetDirtyFlag(); } /** Copies the physics scene into a clone. - @param clone The empty clone. If this pointer is NULL, a new physics + @param clone The empty clone. If this pointer is nullptr, a new physics scene will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** [INTERNAL] Cleans up the sub identifiers. The sub identifiers must be unique with respect to its parent. diff --git a/FCollada/FCDocument/FCDPhysicsShape.cpp b/FCollada/FCDocument/FCDPhysicsShape.cpp index ad60a08..f3f7021 100644 --- a/FCollada/FCDocument/FCDPhysicsShape.cpp +++ b/FCollada/FCDocument/FCDPhysicsShape.cpp @@ -27,32 +27,32 @@ ImplementObjectType(FCDPhysicsShape) FCDPhysicsShape::FCDPhysicsShape(FCDocument* document) : FCDObject(document) { hollow = true; // COLLADA 1.4.1 no default specified - physicsMaterial = NULL; + physicsMaterial = nullptr; ownsPhysicsMaterial = false; isDensityMoreAccurate = false; - geometry = NULL; - analGeom = NULL; - mass = NULL; - density = NULL; - instanceMaterialRef = NULL; + geometry = nullptr; + analGeom = nullptr; + mass = nullptr; + density = nullptr; + instanceMaterialRef = nullptr; } FCDPhysicsShape::~FCDPhysicsShape() { - SetPhysicsMaterial(NULL); + SetPhysicsMaterial(nullptr); SAFE_DELETE(mass); SAFE_DELETE(density); SAFE_RELEASE(instanceMaterialRef); if (ownsPhysicsMaterial) SAFE_RELEASE(physicsMaterial); SAFE_RELEASE(geometry); - geometry = NULL; + geometry = nullptr; } FCDTransform* FCDPhysicsShape::AddTransform(FCDTransform::Type type, size_t index) { - FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), NULL, type); - if (transform != NULL) + FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), nullptr, type); + if (transform != nullptr) { if (index > transforms.size()) transforms.push_back(transform); else transforms.insert(transforms.begin() + index, transform); @@ -81,10 +81,10 @@ void FCDPhysicsShape::SetPhysicsMaterial(FCDPhysicsMaterial* _physicsMaterial) FCDGeometryInstance* FCDPhysicsShape::CreateGeometryInstance(FCDGeometry* geom, bool createConvexMesh) { - analGeom = NULL; + analGeom = nullptr; SAFE_RELEASE(geometry); - geometry = (FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(GetDocument(), NULL, FCDEntity::GEOMETRY); + geometry = (FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(GetDocument(), nullptr, FCDEntity::GEOMETRY); if (createConvexMesh) { @@ -118,33 +118,33 @@ FCDPhysicsAnalyticalGeometry* FCDPhysicsShape::CreateAnalyticalGeometry(FCDPhysi // Note: geometries are just shallow-copied FCDPhysicsShape* FCDPhysicsShape::Clone(FCDPhysicsShape* clone) const { - if (clone == NULL) clone = new FCDPhysicsShape(const_cast(GetDocument())); + if (clone == nullptr) clone = new FCDPhysicsShape(const_cast(GetDocument())); - if (mass != NULL) clone->SetMass(*mass); - if (density != NULL) clone->SetDensity(*density); + if (mass != nullptr) clone->SetMass(*mass); + if (density != nullptr) clone->SetDensity(*density); clone->SetHollow(hollow); // Clone the material instance - if (instanceMaterialRef != NULL) + if (instanceMaterialRef != nullptr) { - clone->instanceMaterialRef = FCDEntityInstanceFactory::CreateInstance(clone->GetDocument(), NULL, FCDEntity::PHYSICS_MATERIAL); + clone->instanceMaterialRef = FCDEntityInstanceFactory::CreateInstance(clone->GetDocument(), nullptr, FCDEntity::PHYSICS_MATERIAL); instanceMaterialRef->Clone(instanceMaterialRef); } - if (physicsMaterial != NULL) + if (physicsMaterial != nullptr) { FCDPhysicsMaterial* clonedMaterial = clone->AddOwnPhysicsMaterial(); physicsMaterial->Clone(clonedMaterial); } // Clone the analytical geometry or the mesh geometry - if (analGeom != NULL) + if (analGeom != nullptr) { clone->analGeom = FCDPASFactory::CreatePAS(clone->GetDocument(), analGeom->GetGeomType()); analGeom->Clone(clone->analGeom); } - if (geometry != NULL) + if (geometry != nullptr) { - clone->geometry = (FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(clone->GetDocument(), NULL, geometry->GetEntityType()); + clone->geometry = (FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(clone->GetDocument(), nullptr, geometry->GetEntityType()); geometry->Clone(clone->geometry); } @@ -205,7 +205,7 @@ float FCDPhysicsShape::CalculateVolume() const { mesh = mesh->FindConvexHullOfMesh(); } - if (mesh == NULL) return 1.0f; // missing convex hull or of spline + if (mesh == nullptr) return 1.0f; // missing convex hull or of spline for (size_t i = 0; i < mesh->GetPolygonsCount(); i++) { diff --git a/FCollada/FCDocument/FCDPhysicsShape.h b/FCollada/FCDocument/FCDPhysicsShape.h index 2a1e980..1fac20f 100644 --- a/FCollada/FCDocument/FCDPhysicsShape.h +++ b/FCollada/FCDocument/FCDPhysicsShape.h @@ -112,9 +112,9 @@ class FCOLLADA_EXPORT FCDPhysicsShape : public FCDObject /** Retrieves whether this shape is an analyical geometry such as a box, plane, sphere, cylinder, tapered cylinder, capsule, or tapered capsule. @return True if this shape is an analytical geometry. */ - bool IsAnalyticalGeometry() const { return analGeom != NULL; } + bool IsAnalyticalGeometry() const { return analGeom != nullptr; } - /** Gets the analytic geometry. NULL is returned if IsAnalyticalGeometry + /** Gets the analytic geometry. nullptr is returned if IsAnalyticalGeometry returns false. @return The analytical geometry. */ FCDPhysicsAnalyticalGeometry* GetAnalyticalGeometry() { return analGeom; } @@ -128,9 +128,9 @@ class FCOLLADA_EXPORT FCDPhysicsShape : public FCDObject /** Retrieves whether this shape is a geometry instance such as from mesh, convex mesh, or spline. @returns True if this shape is a geometry instance. */ - bool IsGeometryInstance() const { return geometry != NULL; } + bool IsGeometryInstance() const { return geometry != nullptr; } - /** Gets the geometry instance. NULL is returned if IsGeometryInstance + /** Gets the geometry instance. nullptr is returned if IsGeometryInstance returns false. @return The geometry instance. */ FCDGeometryInstance* GetGeometryInstance() { return geometry; } @@ -183,11 +183,11 @@ class FCOLLADA_EXPORT FCDPhysicsShape : public FCDObject FCDPhysicsMaterial* AddOwnPhysicsMaterial(); /** Copies the shape into a clone. - @param clone The empty clone. If this pointer is NULL, a new physics + @param clone The empty clone. If this pointer is nullptr, a new physics shape will be created and you will need to release the returned pointer manually. @return The clone. */ - FCDPhysicsShape* Clone(FCDPhysicsShape* clone = NULL) const; + FCDPhysicsShape* Clone(FCDPhysicsShape* clone = nullptr) const; /** Calculates the volume of the shape. Currently it is calculating a simple bounding box volume if IsGeometryInstance it true, and it is diff --git a/FCollada/FCDocument/FCDPlaceHolder.cpp b/FCollada/FCDocument/FCDPlaceHolder.cpp index 4fe5d60..59c86f2 100644 --- a/FCollada/FCDocument/FCDPlaceHolder.cpp +++ b/FCollada/FCDocument/FCDPlaceHolder.cpp @@ -24,7 +24,7 @@ FCDPlaceHolder::FCDPlaceHolder(FCDocument* document, FCDocument* _target) : FCDObject(document) , target(_target) { - if (target != NULL) + if (target != nullptr) { TrackObject(target); fileUrl = target->GetFileUrl(); @@ -33,7 +33,7 @@ FCDPlaceHolder::FCDPlaceHolder(FCDocument* document, FCDocument* _target) FCDPlaceHolder::~FCDPlaceHolder() { - if (target != NULL) + if (target != nullptr) { UntrackObject(target); if (target->GetTrackerCount() == 0) @@ -45,7 +45,7 @@ FCDPlaceHolder::~FCDPlaceHolder() const fstring& FCDPlaceHolder::GetFileUrl() const { - return (target != NULL) ? target->GetFileUrl() : fileUrl; + return (target != nullptr) ? target->GetFileUrl() : fileUrl; } void FCDPlaceHolder::SetFileUrl(const fstring& url) @@ -56,15 +56,15 @@ void FCDPlaceHolder::SetFileUrl(const fstring& url) FCDocument* FCDPlaceHolder::GetTarget(bool loadIfMissing) { - if (target == NULL && loadIfMissing) LoadTarget(NULL); + if (target == nullptr && loadIfMissing) LoadTarget(nullptr); return target; } void FCDPlaceHolder::LoadTarget(FCDocument* newTarget) { - if (target == NULL) + if (target == nullptr) { - if (newTarget == NULL) + if (newTarget == nullptr) { newTarget = new FCDocument(); FUUri uri(GetDocument()->GetFileManager()->GetCurrentUri().MakeAbsolute(fileUrl)); @@ -93,13 +93,13 @@ void FCDPlaceHolder::LoadTarget(FCDocument* newTarget) } } - if (newTarget != NULL) + if (newTarget != nullptr) { - if (target != NULL) + if (target != nullptr) { fileUrl = target->GetFileUrl(); UntrackObject(target); - target = NULL; + target = nullptr; } target = newTarget; TrackObject(target); @@ -119,6 +119,6 @@ void FCDPlaceHolder::OnObjectReleased(FUTrackable* object) if (object == target) { fileUrl = target->GetFileUrl(); - target = NULL; + target = nullptr; } } diff --git a/FCollada/FCDocument/FCDPlaceHolder.h b/FCollada/FCDocument/FCDPlaceHolder.h index 81e07b9..9c9ea29 100644 --- a/FCollada/FCDocument/FCDPlaceHolder.h +++ b/FCollada/FCDocument/FCDPlaceHolder.h @@ -43,28 +43,28 @@ class FCOLLADA_EXPORT FCDPlaceHolder : public FCDObject, FUTracker /** Constructor. @param document The FCollada document that owns the placeholder. @param target The FCollada document referenced by the placeholder. */ - FCDPlaceHolder(FCDocument* document, FCDocument* target = NULL); + FCDPlaceHolder(FCDocument* document, FCDocument* target = nullptr); /** Destructor. */ virtual ~FCDPlaceHolder(); /** Retrieves the referenced FCollada document. - @return The referenced FCollada document. The NULL pointer will + @return The referenced FCollada document. The nullptr pointer will be returned when the referenced FCollada document is not loaded. */ inline FCDocument* GetTarget() const { return target; } /** Retrieves the referenced FCollada document. @param loadIfMissing Whether the referenced document should be loaded when it is not already loaded. - @return The referenced FCollada document. The NULL pointer will + @return The referenced FCollada document. The nullptr pointer will be returned when the referenced FCollada document could not be opened. */ FCDocument* GetTarget(bool loadIfMissing = true); /** [INTERNAL] Loads the referenced FCollada document. @param _target The FCollada document referenced by this placeholder. - This pointer will be NULL to let the placeholder load the FCollada document it + This pointer will be nullptr to let the placeholder load the FCollada document it knows about. */ - void LoadTarget(FCDocument* _target = NULL); + void LoadTarget(FCDocument* _target = nullptr); /** Unloads and releases the referenced FCollada document. */ void UnloadTarget(); @@ -72,7 +72,7 @@ class FCOLLADA_EXPORT FCDPlaceHolder : public FCDObject, FUTracker /** Retrieves whether the FCollada document referenced by this placeholder is currently loaded and available. @return Whether the referenced document is available. */ - inline bool IsTargetLoaded() const { return target != NULL; } + inline bool IsTargetLoaded() const { return target != nullptr; } /** Retrieves the URL of the referenced FCollada document. @return The URL of the referenced FCollada document. */ @@ -101,7 +101,7 @@ class FCOLLADA_EXPORT FCDPlaceHolder : public FCDObject, FUTracker /** Retrieves an indexed external reference. @param index The index of the external reference. @return The external reference at the given index. */ - const FCDEntityReference* GetExternalReference(size_t index) const { FUAssert(index < GetExternalReferenceCount(), return NULL); return references.at(index); } + const FCDEntityReference* GetExternalReference(size_t index) const { FUAssert(index < GetExternalReferenceCount(), return nullptr); return references.at(index); } protected: /** [INTERNAL] Callback for the manual release of a diff --git a/FCollada/FCDocument/FCDSceneNode.cpp b/FCollada/FCDocument/FCDSceneNode.cpp index fa6a8c6..813930e 100644 --- a/FCollada/FCDocument/FCDSceneNode.cpp +++ b/FCollada/FCDocument/FCDSceneNode.cpp @@ -90,7 +90,7 @@ FCDSceneNode::~FCDSceneNode() // Add this scene node to the list of children scene node bool FCDSceneNode::AddChildNode(FCDSceneNode* sceneNode) { - if (this == sceneNode || sceneNode == NULL) + if (this == sceneNode || sceneNode == nullptr) { return false; } @@ -132,7 +132,7 @@ void FCDSceneNode::RemoveChildNode(FCDSceneNode* sceneNode) // Instantiates an entity FCDEntityInstance* FCDSceneNode::AddInstance(FCDEntity* entity) { - if (entity == NULL) return NULL; + if (entity == nullptr) return nullptr; FCDEntityInstance* instance = AddInstance(entity->GetType()); instance->SetEntity(entity); return instance; @@ -151,7 +151,7 @@ FCDEntityInstance* FCDSceneNode::AddInstance(FCDEntity::Type type) FCDTransform* FCDSceneNode::AddTransform(FCDTransform::Type type, size_t index) { FCDTransform* transform = FCDTFactory::CreateTransform(GetDocument(), this, type); - if (transform != NULL) + if (transform != nullptr) { if (index > transforms.size()) transforms.push_back(transform); else transforms.insert(index, transform); @@ -169,9 +169,9 @@ const FCDEntity* FCDSceneNode::FindDaeId(const fm::string& daeId) const for (const FCDSceneNode** it = children.begin(); it != children.end(); ++it) { const FCDEntity* found = (*it)->FindDaeId(daeId); - if (found != NULL) return found; + if (found != nullptr) return found; } - return NULL; + return nullptr; } void FCDSceneNode::SetSubId(const fm::string& subId) @@ -202,14 +202,14 @@ void FCDSceneNode::SetSubId(const fm::string& subId) curNode = parentTree[curParent]; curParent++; } - else curNode = NULL; + else curNode = nullptr; } - while (curNode != NULL); + while (curNode != nullptr); // Now, test for uniqueness, This is enforced for both descendants and ancestors fm::string newSubId = FCDObjectWithId::CleanSubId(subId); int32 idMod = 0; - while (FindSubId(newSubId) != NULL || parentSubIds.find(newSubId) != parentSubIds.end()) + while (FindSubId(newSubId) != nullptr || parentSubIds.find(newSubId) != parentSubIds.end()) { newSubId = subId + "_" + FUStringConversion::ToString(idMod++); @@ -227,19 +227,19 @@ const FCDEntity* FCDSceneNode::FindSubId(const fm::string& subId) const for (const FCDSceneNode** it = children.begin(); it != children.end(); ++it) { const FCDEntity* found = (*it)->FindSubId(subId); - if (found != NULL) return found; + if (found != nullptr) return found; } - return NULL; + return nullptr; } // Retrieve the list of hierarchical asset information structures that affect this scene node. void FCDSceneNode::GetHierarchicalAssets(FCDAssetConstList& assets) const { - for (const FCDSceneNode* node = this; node != NULL; node = node->GetParent(0)) + for (const FCDSceneNode* node = this; node != nullptr; node = node->GetParent(0)) { // Retrieve the asset information structure for this node. const FCDAsset* asset = node->GetAsset(); - if (asset != NULL) assets.push_back(asset); + if (asset != nullptr) assets.push_back(asset); } assets.push_back(GetDocument()->GetAsset()); } @@ -258,7 +258,7 @@ FMMatrix44 FCDSceneNode::ToMatrix() const FMMatrix44 FCDSceneNode::CalculateWorldTransform() const { const FCDSceneNode* parent = GetParent(); - if (parent != NULL) + if (parent != nullptr) { //FMMatrix44 tm1 = parent->CalculateWorldTransform(); //FMMatrix44 tm2 = CalculateLocalTransform(); @@ -290,13 +290,13 @@ void FCDSceneNode::CleanSubId() FCDEntity* FCDSceneNode::Clone(FCDEntity* _clone, bool cloneChildren) const { - FCDSceneNode* clone = NULL; - if (_clone == NULL) _clone = clone = new FCDSceneNode(const_cast(GetDocument())); + FCDSceneNode* clone = nullptr; + if (_clone == nullptr) _clone = clone = new FCDSceneNode(const_cast(GetDocument())); else if (_clone->HasType(FCDSceneNode::GetClassType())) clone = (FCDSceneNode*) _clone; Parent::Clone(_clone, cloneChildren); - if (clone != NULL) + if (clone != nullptr) { // Copy over the simple information. clone->SetJointFlag(GetJointFlag()); diff --git a/FCollada/FCDocument/FCDSceneNode.h b/FCollada/FCDocument/FCDSceneNode.h index 3f02279..f2ccf52 100644 --- a/FCollada/FCDocument/FCDSceneNode.h +++ b/FCollada/FCDocument/FCDSceneNode.h @@ -98,10 +98,10 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity /** Retrieves a specific parent of the visual scene node. @param index The index of the parent. - @return The parent visual scene node. This pointer will be NULL if + @return The parent visual scene node. This pointer will be nullptr if the scene node has no parents or if the index is out-of-bounds. */ - inline FCDSceneNode* GetParent(size_t index = 0) { FUAssert(index == 0 || index < parents.size(), return NULL); return (!parents.empty()) ? parents.at(index) : NULL; } - inline const FCDSceneNode* GetParent(size_t index = 0) const { FUAssert(index == 0 || index < parents.size(), return NULL); return (!parents.empty()) ? parents.at(index) : NULL; } /**< See above. */ + inline FCDSceneNode* GetParent(size_t index = 0) { FUAssert(index == 0 || index < parents.size(), return nullptr); return (!parents.empty()) ? parents.at(index) : nullptr; } + inline const FCDSceneNode* GetParent(size_t index = 0) const { FUAssert(index == 0 || index < parents.size(), return nullptr); return (!parents.empty()) ? parents.at(index) : nullptr; } /**< See above. */ /** Retrieves the list of parents for the visual scene node. @return The list of parents. */ @@ -113,10 +113,10 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity /** Retrieves a specific child of the visual scene node. @param index The index of the child. - @return The child scene node. This pointer will be NULL if the + @return The child scene node. This pointer will be nullptr if the index is out-of-bounds. */ - inline FCDSceneNode* GetChild(size_t index) { FUAssert(index < children.size(), return NULL); return children.at(index); } - inline const FCDSceneNode* GetChild(size_t index) const { FUAssert(index < children.size(), return NULL); return children.at(index); } /**< See above. */ + inline FCDSceneNode* GetChild(size_t index) { FUAssert(index < children.size(), return nullptr); return children.at(index); } + inline const FCDSceneNode* GetChild(size_t index) const { FUAssert(index < children.size(), return nullptr); return children.at(index); } /**< See above. */ /** Retrieves the list of children of the visual scene node. @return The list of child scene nodes. */ @@ -149,9 +149,9 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity /** Retrieves a specific entity instance. @param index The index of the instance. @return The entity instance at the given index. This pointer will be - NULL if the index is out-of-bounds. */ - inline FCDEntityInstance* GetInstance(size_t index) { FUAssert(index < instances.size(), return NULL); return instances.at(index); } - inline const FCDEntityInstance* GetInstance(size_t index) const { FUAssert(index < instances.size(), return NULL); return instances.at(index); } /**< See above. */ + nullptr if the index is out-of-bounds. */ + inline FCDEntityInstance* GetInstance(size_t index) { FUAssert(index < instances.size(), return nullptr); return instances.at(index); } + inline const FCDEntityInstance* GetInstance(size_t index) const { FUAssert(index < instances.size(), return nullptr); return instances.at(index); } /**< See above. */ /** Retrieves the list of entity instances at this node of the scene graph. @return The list of entity instances. */ @@ -161,8 +161,8 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity Only geometric entities, controllers, light and cameras can be instantiated in the scene graph. To instantiate visual scene nodes, use the AddChildNode function. - @param entity The entity to instantiate. This pointer cannot be NULL. - @return The entity instance structure. This pointer will be NULL + @param entity The entity to instantiate. This pointer cannot be nullptr. + @return The entity instance structure. This pointer will be nullptr if the entity cannot be instantiated here or if the entity is a scene node. */ FCDEntityInstance* AddInstance(FCDEntity* entity); @@ -171,7 +171,7 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity can be instantiated in the scene graph. To instantiate visual scene nodes, use the AddChildNode function. @param type The type of entity to instantiate. - @return The entity instance structure. This pointer will be NULL + @return The entity instance structure. This pointer will be nullptr if the entity cannot be instantiated here. */ FCDEntityInstance* AddInstance(FCDEntity::Type type); @@ -181,10 +181,10 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity /** Retrieves a specific transform. @param index The index of the transform. - @return The transform at the given index. This pointer will be NULL + @return The transform at the given index. This pointer will be nullptr if the index is out-of-bounds. */ - inline FCDTransform* GetTransform(size_t index) { FUAssert(index < transforms.size(), return NULL); return transforms.at(index); } - inline const FCDTransform* GetTransform(size_t index) const { FUAssert(index < transforms.size(), return NULL); return transforms.at(index); } /**< See above. */ + inline FCDTransform* GetTransform(size_t index) { FUAssert(index < transforms.size(), return nullptr); return transforms.at(index); } + inline const FCDTransform* GetTransform(size_t index) const { FUAssert(index < transforms.size(), return nullptr); return transforms.at(index); } /**< See above. */ /** Retrieves the list of transforms for this node of the scene graph. @return The list of transforms. */ @@ -212,7 +212,7 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity for the wanted COLLADA id. @param daeId The COLLADA id to look for. @return The visual scene node which has the given COLLADA id. This pointer - will be NULL if no visual scene node can be found with the given COLLADA id. */ + will be nullptr if no visual scene node can be found with the given COLLADA id. */ virtual FCDEntity* FindDaeId(const fm::string& daeId) { return const_cast(const_cast(this)->FindDaeId(daeId)); } virtual const FCDEntity* FindDaeId(const fm::string& daeId) const; /** < See above. */ @@ -231,7 +231,7 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity for the wanted COLLADA sub-id. @param subId The COLLADA sub-id to look for. @return The visual scene node which has the given COLLADA sub-id. This pointer - will be NULL if no visual scene node can be found with the given COLLADA sub-id. */ + will be nullptr if no visual scene node can be found with the given COLLADA sub-id. */ inline FCDEntity* FindSubId(const fm::string& subId) { return const_cast(const_cast(this)->FindSubId(subId)); } const FCDEntity* FindSubId(const fm::string& subId) const; /**< See above. */ @@ -280,11 +280,11 @@ class FCOLLADA_EXPORT FCDSceneNode : public FCDEntity to copy the COLLADA id and the other entity-level information. All the up-classes of this class should implement this function. The cloned entity may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new entity + @param clone The empty clone. If this pointer is nullptr, a new entity will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; /** [INTERNAL] Increments the number of entities target this node. To set targets, use the FCDTargetedEntity::SetTarget function. */ diff --git a/FCollada/FCDocument/FCDSceneNodeIterator.hpp b/FCollada/FCDocument/FCDSceneNodeIterator.hpp index dca4f7f..6333a2b 100644 --- a/FCollada/FCDocument/FCDSceneNodeIterator.hpp +++ b/FCollada/FCDocument/FCDSceneNodeIterator.hpp @@ -41,7 +41,7 @@ FCDSceneNodeIteratorT::FCDSceneNodeIteratorT(NODE_T* root, SearchType se for (size_t i = 0; i < instanceCount; ++i) { const FCDEntity* entity = it->GetInstance(i)->GetEntity(); - if (entity != NULL && entity->HasType(FCDSceneNode::GetClassType())) queue.push_back((NODE_T*) entity); + if (entity != nullptr && entity->HasType(FCDSceneNode::GetClassType())) queue.push_back((NODE_T*) entity); } } } @@ -81,7 +81,7 @@ FCDSceneNodeIteratorT::FCDSceneNodeIteratorT(NODE_T* root, SearchType se { size_t instanceIndex = it.second - nodeChildCount; const FCDEntity* entity = it.first->GetInstance(instanceIndex)->GetEntity(); - if (entity != NULL && entity->HasType(FCDSceneNode::GetClassType())) + if (entity != nullptr && entity->HasType(FCDSceneNode::GetClassType())) { NODE_T* add = (NODE_T*) entity; if (add->GetChildrenCount() == 0 && add->GetInstanceCount() == 0) @@ -118,12 +118,12 @@ FCDSceneNodeIteratorT::~FCDSceneNodeIteratorT() template NODE_T* FCDSceneNodeIteratorT::GetNode() { - return iterator < queue.size() ? queue[iterator] : NULL; + return iterator < queue.size() ? queue[iterator] : nullptr; } template NODE_T* FCDSceneNodeIteratorT::Next() { ++iterator; - return iterator < queue.size() ? queue[iterator] : NULL; + return iterator < queue.size() ? queue[iterator] : nullptr; } diff --git a/FCollada/FCDocument/FCDSceneNodeTools.cpp b/FCollada/FCDocument/FCDSceneNodeTools.cpp index e3a80a1..f5152d3 100644 --- a/FCollada/FCDocument/FCDSceneNodeTools.cpp +++ b/FCollada/FCDocument/FCDSceneNodeTools.cpp @@ -34,7 +34,7 @@ namespace FCDSceneNodeTools { FCDTransform* transform = node->GetTransform(t); FCDAnimated* animated = transform->GetAnimated(); - if (animated != NULL) + if (animated != nullptr) { if (animated->HasCurve()) animateds.push_back(animated); diff --git a/FCollada/FCDocument/FCDSkinController.cpp b/FCollada/FCDocument/FCDSkinController.cpp index 5e3d11b..c7f394b 100644 --- a/FCollada/FCDocument/FCDSkinController.cpp +++ b/FCollada/FCDocument/FCDSkinController.cpp @@ -65,17 +65,17 @@ const FCDEntity* FCDSkinController::GetTarget() const void FCDSkinController::SetTarget(FCDEntity* _target) { - target->SetEntity(NULL); + target->SetEntity(nullptr); SetNewChildFlag(); // Retrieve the actual base entity, as you can chain controllers. FCDEntity* baseEntity = _target; - if (baseEntity != NULL && baseEntity->GetType() == FCDEntity::CONTROLLER) + if (baseEntity != nullptr && baseEntity->GetType() == FCDEntity::CONTROLLER) { baseEntity = ((FCDController*) baseEntity)->GetBaseGeometry(); } - if (baseEntity == NULL || baseEntity->GetType() != FCDEntity::GEOMETRY) + if (baseEntity == nullptr || baseEntity->GetType() != FCDEntity::GEOMETRY) { // The new target is no good! return; @@ -90,7 +90,7 @@ void FCDSkinController::SetTarget(FCDEntity* _target) { FCDGeometryMesh* mesh = geometry->GetMesh(); FCDGeometrySource* positionSource = mesh->GetPositionSource(); - if (positionSource != NULL) + if (positionSource != nullptr) { vertexCount = positionSource->GetValueCount(); } diff --git a/FCollada/FCDocument/FCDSkinController.h b/FCollada/FCDocument/FCDSkinController.h index 2eb224b..f58dcee 100644 --- a/FCollada/FCDocument/FCDSkinController.h +++ b/FCollada/FCDocument/FCDSkinController.h @@ -81,8 +81,8 @@ class FCOLLADA_EXPORT FCDSkinControllerVertex /** Retrieves a joint-weight pair. @param index The index of the joint-weight pair. @return The joint-weight pair at the given index. */ - inline FCDJointWeightPair* GetPair(size_t index) { FUAssert(index < pairs.size(), return NULL); return &(pairs.at(index)); } - inline const FCDJointWeightPair* GetPair(size_t index) const { FUAssert(index < pairs.size(), return NULL); return &(pairs.at(index)); } /**< See above. */ + inline FCDJointWeightPair* GetPair(size_t index) { FUAssert(index < pairs.size(), return nullptr); return &(pairs.at(index)); } + inline const FCDJointWeightPair* GetPair(size_t index) const { FUAssert(index < pairs.size(), return nullptr); return &(pairs.at(index)); } /**< See above. */ /** Adds a new joint-weight pair to this vertex. No verification will be made to ensure that the sum of the weights equal 1.0. @@ -203,14 +203,14 @@ class FCOLLADA_EXPORT FCDSkinController : public FCDObject /** Retrieves the list of joints that influence the skin. @return The list of joints that influence the skin. */ - inline FCDSkinControllerJoint* GetJoints() { return !joints.empty() ? &(joints.front()) : NULL; } - inline const FCDSkinControllerJoint* GetJoints() const { return !joints.empty() ? &(joints.front()) : NULL; } /**< See above. */ + inline FCDSkinControllerJoint* GetJoints() { return !joints.empty() ? &(joints.front()) : nullptr; } + inline const FCDSkinControllerJoint* GetJoints() const { return !joints.empty() ? &(joints.front()) : nullptr; } /**< See above. */ /** Retrieves an indexed joint from the list of joints that influence this skin. @param index The index of the joint. @return The joint at the given index. */ - inline FCDSkinControllerJoint* GetJoint(size_t index) { FUAssert(index < joints.size(), return NULL); return &joints.at(index); } - inline const FCDSkinControllerJoint* GetJoint(size_t index) const { FUAssert(index < joints.size(), return NULL); return &joints.at(index); } /**< See above. */ + inline FCDSkinControllerJoint* GetJoint(size_t index) { FUAssert(index < joints.size(), return nullptr); return &joints.at(index); } + inline const FCDSkinControllerJoint* GetJoint(size_t index) const { FUAssert(index < joints.size(), return nullptr); return &joints.at(index); } /**< See above. */ /** Adds a joint to influence the skin. @param jSubId The sub-id of the scene node(s) that represent the joint. @@ -227,14 +227,14 @@ class FCOLLADA_EXPORT FCDSkinController : public FCDObject /** Retrieves a list of the per-vertex influences for the skin. @return The list of per-vertex influences. */ - inline FCDSkinControllerVertex* GetVertexInfluences() { return influences.size() > 0 ? &(influences.front()) : NULL; } - inline const FCDSkinControllerVertex* GetVertexInfluences() const { return influences.size() > 0 ? &(influences.front()) : NULL; } /**< See above. */ + inline FCDSkinControllerVertex* GetVertexInfluences() { return influences.size() > 0 ? &(influences.front()) : nullptr; } + inline const FCDSkinControllerVertex* GetVertexInfluences() const { return influences.size() > 0 ? &(influences.front()) : nullptr; } /**< See above. */ /** Retrieves the per-vertex influences for a given vertex. @param index The vertex index. @return The per-vertex influences. */ - inline FCDSkinControllerVertex* GetVertexInfluence(size_t index) { FUAssert(index < influences.size(), return NULL); return &influences.at(index); } - inline const FCDSkinControllerVertex* GetVertexInfluence(size_t index) const { FUAssert(index < influences.size(), return NULL); return &influences.at(index); } /**< See above. */ + inline FCDSkinControllerVertex* GetVertexInfluence(size_t index) { FUAssert(index < influences.size(), return nullptr); return &influences.at(index); } + inline const FCDSkinControllerVertex* GetVertexInfluence(size_t index) const { FUAssert(index < influences.size(), return nullptr); return &influences.at(index); } /**< See above. */ /** Reduces the number of joints influencing each vertex. 1) All the influences with a weight less than the minimum will be removed. diff --git a/FCollada/FCDocument/FCDTargetedEntity.cpp b/FCollada/FCDocument/FCDTargetedEntity.cpp index 838c64b..56f8a5a 100644 --- a/FCollada/FCDocument/FCDTargetedEntity.cpp +++ b/FCollada/FCDocument/FCDTargetedEntity.cpp @@ -38,14 +38,14 @@ FCDTargetedEntity::~FCDTargetedEntity() // Sets a new target void FCDTargetedEntity::SetTargetNode(FCDSceneNode* target) { - if (targetNode != NULL) + if (targetNode != nullptr) { targetNode->DecrementTargetCount(); } targetNode = target; - if (targetNode != NULL) + if (targetNode != nullptr) { targetNode->IncrementTargetCount(); } @@ -55,7 +55,7 @@ void FCDTargetedEntity::SetTargetNode(FCDSceneNode* target) FCDEntity* FCDTargetedEntity::Clone(FCDEntity* _clone, bool cloneChildren) const { - if (_clone == NULL) + if (_clone == nullptr) { _clone = new FCDTargetedEntity(const_cast(GetDocument()), "TargetedEntity"); } diff --git a/FCollada/FCDocument/FCDTargetedEntity.h b/FCollada/FCDocument/FCDTargetedEntity.h index 42a132b..315a903 100644 --- a/FCollada/FCDocument/FCDTargetedEntity.h +++ b/FCollada/FCDocument/FCDTargetedEntity.h @@ -58,7 +58,7 @@ class FCOLLADA_EXPORT FCDTargetedEntity : public FCDEntity /** Retrieves whether a target is defined for this entity. @return Whether a target is defined for this entity. */ - inline bool HasTarget() const { return targetNode != NULL; } + inline bool HasTarget() const { return targetNode != nullptr; } /** Retrieves the target visual scene node for this entity. @return The target visual scene node. */ @@ -73,11 +73,11 @@ class FCOLLADA_EXPORT FCDTargetedEntity : public FCDEntity All the overwriting functions of this function should call this function to copy the target information. The cloned entity may reside in another document. - @param clone The empty clone. If this pointer is NULL, a new entity + @param clone The empty clone. If this pointer is nullptr, a new entity will be created and you will need to release the returned pointer manually. @param cloneChildren Whether to recursively clone this entity's children. @return The clone. */ - virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const; + virtual FCDEntity* Clone(FCDEntity* clone = nullptr, bool cloneChildren = false) const; }; diff --git a/FCollada/FCDocument/FCDTexture.cpp b/FCollada/FCDocument/FCDTexture.cpp index 7e13144..7f5aec5 100644 --- a/FCollada/FCDocument/FCDTexture.cpp +++ b/FCollada/FCDocument/FCDTexture.cpp @@ -48,14 +48,14 @@ FCDTexture::FCDTexture(FCDocument* document, FCDEffectStandard* _parent) FCDTexture::~FCDTexture() { - parent = NULL; + parent = nullptr; } // Retrieves the sampler parameter: creates one if none are attached. FCDEffectParameterSampler* FCDTexture::GetSampler() { - if (parent == NULL && sampler == NULL) return NULL; - if (sampler == NULL) + if (parent == nullptr && sampler == nullptr) return nullptr; + if (sampler == nullptr) { sampler = (FCDEffectParameterSampler*) parent->AddEffectParameter(FCDEffectParameter::SAMPLER); } @@ -65,9 +65,9 @@ FCDEffectParameterSampler* FCDTexture::GetSampler() // Retrieves the image information for this texture. const FCDImage* FCDTexture::GetImage() const { - if (sampler == NULL) return NULL; + if (sampler == nullptr) return nullptr; const FCDEffectParameterSurface* surface = sampler->GetSurface(); - if (surface == NULL) return NULL; + if (surface == nullptr) return nullptr; return surface->GetImage(); } @@ -76,13 +76,13 @@ void FCDTexture::SetImage(FCDImage* image) { // TODO: No parameter re-use for now. SAFE_RELEASE(sampler); - if (image != NULL && parent != NULL) + if (image != nullptr && parent != nullptr) { // Look for a surface with the expected sid. fm::string surfaceSid = image->GetDaeId() + "-surface"; FCDEffectParameter* _surface = FCDEffectTools::FindEffectParameterByReference(parent, surfaceSid); - FCDEffectParameterSurface* surface = NULL; - if (_surface == NULL) + FCDEffectParameterSurface* surface = nullptr; + if (_surface == nullptr) { // Create the surface parameter surface = (FCDEffectParameterSurface*) parent->AddEffectParameter(FCDEffectParameter::SURFACE); @@ -100,7 +100,7 @@ void FCDTexture::SetImage(FCDImage* image) // Look for a sampler with the expected sid. fm::string samplerSid = image->GetDaeId() + "-sampler"; const FCDEffectParameter* _sampler = FCDEffectTools::FindEffectParameterByReference(parent, samplerSid); - if (_sampler == NULL) + if (_sampler == nullptr) { sampler = (FCDEffectParameterSampler*) parent->AddEffectParameter(FCDEffectParameter::SAMPLER); sampler->SetSurface(surface); @@ -119,12 +119,12 @@ void FCDTexture::SetImage(FCDImage* image) // Returns a copy of the texture/sampler, with all the animations attached FCDTexture* FCDTexture::Clone(FCDTexture* clone) const { - if (clone == NULL) clone = new FCDTexture(const_cast(this)->GetDocument(), parent); + if (clone == nullptr) clone = new FCDTexture(const_cast(this)->GetDocument(), parent); set->Clone(clone->set); extra->Clone(clone->extra); - if (sampler != NULL) + if (sampler != nullptr) { sampler->Clone(clone->GetSampler()); } diff --git a/FCollada/FCDocument/FCDTexture.h b/FCollada/FCDocument/FCDTexture.h index ba6ec58..7904289 100644 --- a/FCollada/FCDocument/FCDTexture.h +++ b/FCollada/FCDocument/FCDTexture.h @@ -65,7 +65,7 @@ class FCOLLADA_EXPORT FCDTexture : public FCDObject Instead, use the FCDEffectStandard::AddTexture function. @param document The COLLADA document that owns this texture. @param parent The standard effect that contains this texture. */ - FCDTexture(FCDocument* document, FCDEffectStandard* parent = NULL); + FCDTexture(FCDocument* document, FCDEffectStandard* parent = nullptr); /** Destructor. */ virtual ~FCDTexture(); @@ -75,7 +75,7 @@ class FCOLLADA_EXPORT FCDTexture : public FCDObject FCDEffectStandard* GetParent() const { return parent; } /** Retrieves the image information for this texture. - @return The image. This pointer will be NULL if this texture is not yet + @return The image. This pointer will be nullptr if this texture is not yet tied to a valid image. */ inline FCDImage* GetImage() { return const_cast(const_cast(this)->GetImage()); } const FCDImage* GetImage() const; /**< See above. */ @@ -84,7 +84,7 @@ class FCOLLADA_EXPORT FCDTexture : public FCDObject This is a shortcut that generates the sampler/surface parameters to access the given image. @param image The image information. This pointer may be - NULL to disconnect an image. */ + nullptr to disconnect an image. */ void SetImage(FCDImage* image); /** Retrieves the surface sampler for this texture. @@ -99,7 +99,7 @@ class FCOLLADA_EXPORT FCDTexture : public FCDObject /** Determines whether this texture targets a sampler. @return Whether the texture targets a sampler. */ - inline bool HasSampler() { return sampler != NULL; } + inline bool HasSampler() { return sampler != nullptr; } /** Retrieves the texture coordinate set to use with this texture. This information is duplicated from the material instance abstraction level. @@ -113,10 +113,10 @@ class FCOLLADA_EXPORT FCDTexture : public FCDObject inline const FCDExtra* GetExtra() const { return extra; } /**< See above. */ /** Clones the texture. - @param clone The cloned texture. If this pointer is NULL, + @param clone The cloned texture. If this pointer is nullptr, a new texture is created and you will need to release this new texture. - @return The cloned texture. This pointer will never be NULL. */ - virtual FCDTexture* Clone(FCDTexture* clone = NULL) const; + @return The cloned texture. This pointer will never be nullptr. */ + virtual FCDTexture* Clone(FCDTexture* clone = nullptr) const; }; #endif // _FCD_TEXTURE_H_ diff --git a/FCollada/FCDocument/FCDTransform.cpp b/FCollada/FCDocument/FCDTransform.cpp index 3e0843b..2934aa3 100644 --- a/FCollada/FCDocument/FCDTransform.cpp +++ b/FCollada/FCDocument/FCDTransform.cpp @@ -33,7 +33,7 @@ FCDTransform::FCDTransform(FCDocument* document, FCDSceneNode* _parent) FCDTransform::~FCDTransform() { - parent = NULL; + parent = nullptr; } bool FCDTransform::IsInverse(const FCDTransform* UNUSED(transform)) const @@ -50,8 +50,8 @@ void FCDTransform::SetSubId(const fm::string& subId) void FCDTransform::SetValueChange() { SetValueChangedFlag(); - // parent == NULL is a valid value in ColladaPhysics. - if (parent != NULL) parent->SetTransformsDirtyFlag(); + // parent == nullptr is a valid value in ColladaPhysics. + if (parent != nullptr) parent->SetTransformsDirtyFlag(); } // @@ -70,8 +70,8 @@ FCDTTranslation::~FCDTTranslation() {} FCDTransform* FCDTTranslation::Clone(FCDTransform* _clone) const { - FCDTTranslation* clone = NULL; - if (_clone == NULL) clone = new FCDTTranslation(const_cast(GetDocument()), const_cast(GetParent())); + FCDTTranslation* clone = nullptr; + if (_clone == nullptr) clone = new FCDTTranslation(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTTranslation::GetClassType())) return _clone; else clone = (FCDTTranslation*) _clone; @@ -116,8 +116,8 @@ FCDTRotation::~FCDTRotation() {} FCDTransform* FCDTRotation::Clone(FCDTransform* _clone) const { - FCDTRotation* clone = NULL; - if (_clone == NULL) clone = new FCDTRotation(const_cast(GetDocument()), const_cast(GetParent())); + FCDTRotation* clone = nullptr; + if (_clone == nullptr) clone = new FCDTRotation(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTRotation::GetClassType())) return _clone; else clone = (FCDTRotation*) _clone; @@ -165,8 +165,8 @@ FCDTScale::~FCDTScale() {} FCDTransform* FCDTScale::Clone(FCDTransform* _clone) const { - FCDTScale* clone = NULL; - if (_clone == NULL) clone = new FCDTScale(const_cast(GetDocument()), const_cast(GetParent())); + FCDTScale* clone = nullptr; + if (_clone == nullptr) clone = new FCDTScale(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTScale::GetClassType())) return _clone; else clone = (FCDTScale*) _clone; @@ -205,8 +205,8 @@ FCDTMatrix::~FCDTMatrix() {} FCDTransform* FCDTMatrix::Clone(FCDTransform* _clone) const { - FCDTMatrix* clone = NULL; - if (_clone == NULL) clone = new FCDTMatrix(const_cast(GetDocument()), const_cast(GetParent())); + FCDTMatrix* clone = nullptr; + if (_clone == nullptr) clone = new FCDTMatrix(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTMatrix::GetClassType())) return _clone; else clone = (FCDTMatrix*) _clone; @@ -240,8 +240,8 @@ FCDTLookAt::~FCDTLookAt() {} FCDTransform* FCDTLookAt::Clone(FCDTransform* _clone) const { - FCDTLookAt* clone = NULL; - if (_clone == NULL) clone = new FCDTLookAt(const_cast(GetDocument()), const_cast(GetParent())); + FCDTLookAt* clone = nullptr; + if (_clone == nullptr) clone = new FCDTLookAt(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTLookAt::GetClassType())) return _clone; else clone = (FCDTLookAt*) _clone; @@ -282,8 +282,8 @@ FCDTSkew::~FCDTSkew() FCDTransform* FCDTSkew::Clone(FCDTransform* _clone) const { - FCDTSkew* clone = NULL; - if (_clone == NULL) clone = new FCDTSkew(const_cast(GetDocument()), const_cast(GetParent())); + FCDTSkew* clone = nullptr; + if (_clone == nullptr) clone = new FCDTSkew(const_cast(GetDocument()), const_cast(GetParent())); else if (!_clone->HasType(FCDTSkew::GetClassType())) return _clone; else clone = (FCDTSkew*) _clone; @@ -334,6 +334,6 @@ FCDTransform* FCDTFactory::CreateTransform(FCDocument* document, FCDSceneNode* p case FCDTransform::SKEW: return new FCDTSkew(document, parent); case FCDTransform::MATRIX: return new FCDTMatrix(document, parent); case FCDTransform::LOOKAT: return new FCDTLookAt(document, parent); - default: return NULL; + default: return nullptr; } } diff --git a/FCollada/FCDocument/FCDTransform.h b/FCollada/FCDocument/FCDTransform.h index 43a6401..64af032 100644 --- a/FCollada/FCDocument/FCDTransform.h +++ b/FCollada/FCDocument/FCDTransform.h @@ -70,7 +70,7 @@ class FCOLLADA_EXPORT FCDTransform : public FCDObject Instead, use the FCDSceneNode::AddTransform function. @param document The COLLADA document that owns the transform. @param parent The visual scene node that contains the transform. - Set this pointer to NULL if this transform is not owned by a + Set this pointer to nullptr if this transform is not owned by a visual scene node. */ FCDTransform(FCDocument* document, FCDSceneNode* parent); @@ -78,7 +78,7 @@ class FCOLLADA_EXPORT FCDTransform : public FCDObject virtual ~FCDTransform(); /** Retrieves the visual scene node that contains this transformation. - @return The parent visual scene node. This pointer will be NULL + @return The parent visual scene node. This pointer will be nullptr if the transformation is not contained by a visual scene node. */ FCDSceneNode* GetParent() { return parent; } const FCDSceneNode* GetParent() const { return parent; } /**< See above. */ @@ -90,7 +90,7 @@ class FCOLLADA_EXPORT FCDTransform : public FCDObject /** Creates a copy of a transformation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const = 0; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const = 0; /** Retrieves the class type of the transformation. The class type should be used to up-case the transformation pointer. @@ -120,7 +120,7 @@ class FCOLLADA_EXPORT FCDTransform : public FCDObject virtual bool IsAnimated() const = 0; /** Retrieves the animated element for the transformation. - @return The animated element. This pointer will be NULL if the transformation + @return The animated element. This pointer will be nullptr if the transformation is not animated. */ inline FCDAnimated* GetAnimated() { return const_cast(const_cast(this)->GetAnimated()); } virtual const FCDAnimated* GetAnimated() const = 0; /**< See above. */ @@ -155,7 +155,7 @@ class FCOLLADA_EXPORT FCDTTranslation : public FCDTransform the TRANSLATION transformation type. @param document The COLLADA document that owns the translation. @param parent The visual scene node that contains the translation. - Set this pointer to NULL if the translation is not owned + Set this pointer to nullptr if the translation is not owned by a visual scene node. */ FCDTTranslation(FCDocument* document, FCDSceneNode* parent); @@ -191,7 +191,7 @@ class FCOLLADA_EXPORT FCDTTranslation : public FCDTransform virtual bool IsAnimated() const; /** Retrieves the animated element for the translation. - @return The animated element. This pointer will be NULL if the translation + @return The animated element. This pointer will be nullptr if the translation is not animated. */ inline FCDAnimated* GetAnimated() { return Parent::GetAnimated(); } virtual const FCDAnimated* GetAnimated() const; /**< See above. */ @@ -206,7 +206,7 @@ class FCOLLADA_EXPORT FCDTTranslation : public FCDTransform /** Creates a copy of a translation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -226,7 +226,7 @@ class FCOLLADA_EXPORT FCDTScale : public FCDTransform the SCALE transformation type. @param document The COLLADA document that owns the non-uniform scale. @param parent The visual scene node that contains the non-uniform scale. - Set this pointer to NULL if the non-uniform scale is not owned + Set this pointer to nullptr if the non-uniform scale is not owned by a visual scene node. */ FCDTScale(FCDocument* document, FCDSceneNode* parent); @@ -262,7 +262,7 @@ class FCOLLADA_EXPORT FCDTScale : public FCDTransform virtual bool IsAnimated() const; /** Retrieves the animated element for the non-uniform scale factors. - @return The animated element. This pointer will be NULL if the + @return The animated element. This pointer will be nullptr if the scale factors are not animated. */ inline FCDAnimated* GetAnimated() { return Parent::GetAnimated(); } virtual const FCDAnimated* GetAnimated() const; /**< See above. */ @@ -270,7 +270,7 @@ class FCOLLADA_EXPORT FCDTScale : public FCDTransform /** Creates a copy of a non-uniform scale. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -292,7 +292,7 @@ class FCOLLADA_EXPORT FCDTRotation : public FCDTransform the transformation type: ROTATION. @param document The COLLADA document that owns the rotation. @param parent The visual scene node that contains the rotation. - Set this pointer to NULL if the rotation is not owned + Set this pointer to nullptr if the rotation is not owned by a visual scene node. */ FCDTRotation(FCDocument* document, FCDSceneNode* parent); @@ -361,7 +361,7 @@ class FCOLLADA_EXPORT FCDTRotation : public FCDTransform /** Retrieves the animated element for the angle-axis rotation. @see FCDAnimatedAngleAxis - @return The animated element. This pointer will be NULL if the + @return The animated element. This pointer will be nullptr if the rotation is not animated. */ inline FCDAnimated* GetAnimated() { return Parent::GetAnimated(); } virtual const FCDAnimated* GetAnimated() const; /**< See above. */ @@ -376,7 +376,7 @@ class FCOLLADA_EXPORT FCDTRotation : public FCDTransform /** Creates a copy of a rotation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -427,7 +427,7 @@ class FCOLLADA_EXPORT FCDTMatrix : public FCDTransform /** Retrieves the animated element for the transformation matrix. @see FCDAnimatedMatrix - @return The animated element. This pointer will be NULL if the + @return The animated element. This pointer will be nullptr if the transformation matrix is not animated. */ inline FCDAnimated* GetAnimated() { return Parent::GetAnimated(); } virtual const FCDAnimated* GetAnimated() const; /**< See above. */ @@ -435,7 +435,7 @@ class FCOLLADA_EXPORT FCDTMatrix : public FCDTransform /** Creates a copy of a matrix transformation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -539,7 +539,7 @@ class FCOLLADA_EXPORT FCDTLookAt : public FCDTransform /** Creates a copy of a look-at transformation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -615,14 +615,14 @@ class FCOLLADA_EXPORT FCDTSkew : public FCDTransform virtual bool IsAnimated() const; /** Retrieves the animated element for the skew. - @return FCollada doesn't support animated skews: NULL. */ + @return FCollada doesn't support animated skews: nullptr. */ inline FCDAnimated* GetAnimated() { return Parent::GetAnimated(); } virtual const FCDAnimated* GetAnimated() const; /**< See above. */ /** Creates a copy of a skew transformation. @param clone The transform that will be the clone. @return The cloned transformation. */ - virtual FCDTransform* Clone(FCDTransform* clone = NULL) const; + virtual FCDTransform* Clone(FCDTransform* clone = nullptr) const; }; /** @@ -640,7 +640,7 @@ class FCOLLADA_EXPORT FCDTFactory @param document The COLLADA document that will own the new transform. @param parent The visual scene node that will contain the transform. @param type The type of transform object to create. - @return The new COLLADA transform. This pointer will be NULL + @return The new COLLADA transform. This pointer will be nullptr if the given type is invalid. */ static FCDTransform* CreateTransform(FCDocument* document, FCDSceneNode* parent, FCDTransform::Type type); }; diff --git a/FCollada/FCDocument/FCDocument.cpp b/FCollada/FCDocument/FCDocument.cpp index c67e4f7..64b781f 100644 --- a/FCollada/FCDocument/FCDocument.cpp +++ b/FCollada/FCDocument/FCDocument.cpp @@ -50,8 +50,8 @@ ImplementObjectType(FCDocument) -ImplementParameterObject(FCDocument, FCDEntityReference, visualSceneRoot, new FCDEntityReference(parent->GetDocument(), NULL)) -ImplementParameterObject(FCDocument, FCDEntityReference, physicsSceneRoots, new FCDEntityReference(parent->GetDocument(), NULL)) +ImplementParameterObject(FCDocument, FCDEntityReference, visualSceneRoot, new FCDEntityReference(parent->GetDocument(), nullptr)) +ImplementParameterObject(FCDocument, FCDEntityReference, physicsSceneRoots, new FCDEntityReference(parent->GetDocument(), nullptr)) ImplementParameterObject(FCDocument, FCDAsset, asset, new FCDAsset(parent->GetDocument())) ImplementParameterObject(FCDocument, FCDExtra, extra, new FCDExtra(parent->GetDocument(), parent)) ImplementParameterObject(FCDocument, FCDAnimationLibrary, animationLibrary, new FCDAnimationLibrary(parent->GetDocument())) @@ -72,7 +72,7 @@ ImplementParameterObject(FCDocument, FCDEmitterLibrary, emitterLibrary, new FCDE FCDocument::FCDocument() : FCDObject(this) -, fileManager(NULL), version(NULL), uniqueNameMap(NULL) +, fileManager(nullptr), version(nullptr), uniqueNameMap(nullptr) , InitializeParameterNoArg(visualSceneRoot) , InitializeParameterNoArg(physicsSceneRoots) , InitializeParameterNoArg(asset) @@ -103,7 +103,7 @@ FCDocument::FCDocument() asset = new FCDAsset(this); externalReferenceManager = new FCDExternalReferenceManager(this); extra = new FCDExtra(this, this); - visualSceneRoot = new FCDEntityReference(this, NULL); + visualSceneRoot = new FCDEntityReference(this, nullptr); animationLibrary = new FCDAnimationLibrary(this); animationClipLibrary = new FCDAnimationClipLibrary(this); @@ -128,25 +128,25 @@ FCDocument::~FCDocument() // before all clearing the entities. FUTrackable::Detach(); - externalReferenceManager = NULL; + externalReferenceManager = nullptr; // Release the libraries and the asset - animationLibrary = NULL; - animationClipLibrary = NULL; - cameraLibrary = NULL; - controllerLibrary = NULL; - effectLibrary = NULL; - emitterLibrary = NULL; - forceFieldLibrary = NULL; - geometryLibrary = NULL; - imageLibrary = NULL; - lightLibrary = NULL; - materialLibrary = NULL; - visualSceneLibrary = NULL; - physicsMaterialLibrary = NULL; - physicsModelLibrary = NULL; - physicsSceneLibrary = NULL; - asset = NULL; + animationLibrary = nullptr; + animationClipLibrary = nullptr; + cameraLibrary = nullptr; + controllerLibrary = nullptr; + effectLibrary = nullptr; + emitterLibrary = nullptr; + forceFieldLibrary = nullptr; + geometryLibrary = nullptr; + imageLibrary = nullptr; + lightLibrary = nullptr; + materialLibrary = nullptr; + visualSceneLibrary = nullptr; + physicsMaterialLibrary = nullptr; + physicsModelLibrary = nullptr; + physicsSceneLibrary = nullptr; + asset = nullptr; // Must be released last CLEAR_POINTER_VECTOR(layers); @@ -160,24 +160,24 @@ FCDocument::~FCDocument() const FCDSceneNode* FCDocument::GetVisualSceneInstance() const { - if (visualSceneRoot == NULL) return NULL; + if (visualSceneRoot == nullptr) return nullptr; const FCDEntity* entity = visualSceneRoot->GetEntity(); - if (entity != NULL && entity->HasType(FCDSceneNode::GetClassType())) return (const FCDSceneNode*) entity; - else return NULL; + if (entity != nullptr && entity->HasType(FCDSceneNode::GetClassType())) return (const FCDSceneNode*) entity; + else return nullptr; } const FCDPhysicsScene* FCDocument::GetPhysicsSceneInstance(size_t index) const { - if (index == 0 && physicsSceneRoots.empty()) return NULL; - FUAssert(index < physicsSceneRoots.size(), return NULL); + if (index == 0 && physicsSceneRoots.empty()) return nullptr; + FUAssert(index < physicsSceneRoots.size(), return nullptr); const FCDEntity* entity = physicsSceneRoots[index]->GetEntity(); - if (entity != NULL && entity->HasType(FCDPhysicsScene::GetClassType())) return (const FCDPhysicsScene*) entity; - else return NULL; + if (entity != nullptr && entity->HasType(FCDPhysicsScene::GetClassType())) return (const FCDPhysicsScene*) entity; + else return nullptr; } FCDEntityReference* FCDocument::AddPhysicsSceneInstanceReference() { - physicsSceneRoots.push_back(new FCDEntityReference(this, (FCDObjectWithId*) NULL)); + physicsSceneRoots.push_back(new FCDEntityReference(this, (FCDObjectWithId*) nullptr)); return physicsSceneRoots.back(); } @@ -211,7 +211,7 @@ FCDEmitter* FCDocument::FindEmitter(const fm::string& daeId) { return emitterLib FCDForceField* FCDocument::FindForceField(const fm::string& daeId) { return forceFieldLibrary->FindDaeId(daeId); } FCDGeometry* FCDocument::FindGeometry(const fm::string& daeId) { return geometryLibrary->FindDaeId(daeId); } FCDImage* FCDocument::FindImage(const fm::string& daeId) { return imageLibrary->FindDaeId(daeId); } -FCDLayer* FCDocument::FindLayer(const fm::string& name) { for (FCDLayerList::iterator itL = layers.begin(); itL != layers.end(); ++itL) { if ((*itL)->name == name) return *itL; } return NULL; } +FCDLayer* FCDocument::FindLayer(const fm::string& name) { for (FCDLayerList::iterator itL = layers.begin(); itL != layers.end(); ++itL) { if ((*itL)->name == name) return *itL; } return nullptr; } FCDLight* FCDocument::FindLight(const fm::string& daeId) { return lightLibrary->FindDaeId(daeId); } FCDMaterial* FCDocument::FindMaterial(const fm::string& daeId) { return materialLibrary->FindDaeId(daeId); } FCDSceneNode* FCDocument::FindVisualScene(const fm::string& daeId) { return visualSceneLibrary->FindDaeId(daeId); } @@ -223,7 +223,7 @@ FCDEntity* FCDocument::FindEntity(const fm::string& daeId) { #define CHECK_LIB(libraryName) { \ FCDEntity* e = libraryName->FindDaeId(daeId); \ - if (e != NULL) return e; } + if (e != nullptr) return e; } CHECK_LIB(animationLibrary); CHECK_LIB(animationClipLibrary); @@ -242,14 +242,14 @@ FCDEntity* FCDocument::FindEntity(const fm::string& daeId) CHECK_LIB(physicsModelLibrary); #undef CHECK_LIB - return NULL; + return nullptr; } // Add an animated value to the list void FCDocument::RegisterAnimatedValue(FCDAnimated* animated) { // Look for a duplicate in order to avoid memory loss - //if (animated->GetValueCount() == 0 || FindAnimatedValue(animated->GetValue(0)) != NULL) + //if (animated->GetValueCount() == 0 || FindAnimatedValue(animated->GetValue(0)) != nullptr) if (animated->GetValueCount() == 0) { SAFE_RELEASE(animated); @@ -271,7 +271,7 @@ void FCDocument::RegisterAnimatedValue(FCDAnimated* animated) // Unregisters an animated value of the document. void FCDocument::UnregisterAnimatedValue(FCDAnimated* animated) { - if (animated != NULL) + if (animated != nullptr) { // Intentionally search from the end: // - In the destructor of the document, we delete from the end. @@ -300,29 +300,29 @@ void FCDocument::UnregisterAnimatedValue(FCDAnimated* animated) //const FCDAnimated* FCDocument::FindAnimatedValue(const float* ptr) const //{ // FCDAnimatedValueMap::const_iterator it = animatedValueMap.find(ptr); -// return (it != animatedValueMap.end()) ? (*it).second : NULL; +// return (it != animatedValueMap.end()) ? (*it).second : nullptr; //} // //// Retrieve an animated float value for a given fully qualified target //const float* FCDocument::FindAnimatedTarget(const fm::string& fullyQualifiedTarget) //{ -// if (fullyQualifiedTarget.empty()) return NULL; +// if (fullyQualifiedTarget.empty()) return nullptr; // fm::string target = (fullyQualifiedTarget[0] == '#') ? fullyQualifiedTarget.substr(1) : fullyQualifiedTarget; // fm::string pointer, qualifier; // FUStringConversion::SplitTarget(target, pointer, qualifier); // // // Find the pointer -// FCDAnimated* animatedValue = NULL; +// FCDAnimated* animatedValue = nullptr; // for (FCDAnimatedSet::iterator itA = animatedValues.begin(); itA != animatedValues.end(); ++itA) // { // FCDAnimated* animated = (*itA).first; // if (animated->GetTargetPointer() == pointer) { animatedValue = animated; break; } // } -// if (animatedValue == NULL) return NULL; +// if (animatedValue == nullptr) return nullptr; // // // Return the qualified value // size_t index = animatedValue->FindQualifier(qualifier); -// if (index == size_t(-1)) return NULL; +// if (index == size_t(-1)) return nullptr; // return animatedValue->GetValue(index); //} // @@ -330,14 +330,14 @@ void FCDocument::UnregisterAnimatedValue(FCDAnimated* animated) //bool FCDocument::IsValueAnimated(const float* ptr) const //{ // const FCDAnimated* animated = FindAnimatedValue(ptr); -// return (animated != NULL) ? animated->HasCurve() : false; +// return (animated != nullptr) ? animated->HasCurve() : false; //} // Insert new library elements FCDSceneNode* FCDocument::AddVisualScene() { FCDSceneNode* visualScene = visualSceneLibrary->AddEntity(); - if (visualSceneRoot->GetEntity() == NULL) visualSceneRoot->SetEntity(visualScene); + if (visualSceneRoot->GetEntity() == nullptr) visualSceneRoot->SetEntity(visualScene); return visualScene; } FCDPhysicsScene* FCDocument::AddPhysicsScene() diff --git a/FCollada/FCDocument/FCDocument.h b/FCollada/FCDocument/FCDocument.h index c9e96f3..1a90688 100644 --- a/FCollada/FCDocument/FCDocument.h +++ b/FCollada/FCDocument/FCDocument.h @@ -153,13 +153,13 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject virtual ~FCDocument(); /** Retrieves the asset information for this COLLADA document. The asset information should always be present. - @return A pointer to the asset information structure. This pointer should never be NULL. */ + @return A pointer to the asset information structure. This pointer should never be nullptr. */ inline FCDAsset* GetAsset() { return asset; } inline const FCDAsset* GetAsset() const { return asset; } /**< See above. */ /** Retrieves the base extra tree for this COLLADA document. An extra tree should always be present, but is likely to be empty. - @return A pointer to the base extra tree. This pointer should never be NULL. */ + @return A pointer to the base extra tree. This pointer should never be nullptr. */ inline FCDExtra* GetExtra() { return extra; } inline const FCDExtra* GetExtra() const { return extra; } /**< See above. */ @@ -170,7 +170,7 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject /** [INTERNAL] Retrieves the local file manager for the COLLADA document. Used to resolve URIs and transform file paths into their relative or absolute equivalent. May be deprecated in future versions. - @return The file manager for this COLLADA document. This pointer should never be NULL. */ + @return The file manager for this COLLADA document. This pointer should never be nullptr. */ inline FUFileManager* GetFileManager() { return fileManager; } inline const FUFileManager* GetFileManager() const { return fileManager; } /**< See above. */ @@ -193,7 +193,7 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject /** Retrieves one instanced physics scene. @param index The index of the physics scene to retrieve. - If the index is out-of-bounds, NULL is returned. + If the index is out-of-bounds, nullptr is returned. @return A currently instanced physics scene. */ inline FCDPhysicsScene* GetPhysicsSceneInstance(size_t index = 0) { return const_cast(const_cast(this)->GetPhysicsSceneInstance(index)); } const FCDPhysicsScene* GetPhysicsSceneInstance(size_t index = 0) const; /**< See above. */ @@ -206,10 +206,10 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject /** Retrieves a reference to the instanced physics scene. @param index The index of the physics scene instance reference to - retrieve. If the index is out-of-bounds, NULL is returned. + retrieve. If the index is out-of-bounds, nullptr is returned. @return The reference to the index physics scene reference. */ - inline FCDEntityReference* GetPhysicsSceneInstanceReference(size_t index = 0) { if (index == 0 && physicsSceneRoots.empty()) return NULL; FUAssert(index < physicsSceneRoots.size(), return NULL); return physicsSceneRoots[index]; } - inline const FCDEntityReference* GetPhysicsSceneInstanceReference(size_t index = 0) const { if (index == 0 && physicsSceneRoots.empty()) return NULL; FUAssert(index < physicsSceneRoots.size(), return NULL); return physicsSceneRoots[index]; } + inline FCDEntityReference* GetPhysicsSceneInstanceReference(size_t index = 0) { if (index == 0 && physicsSceneRoots.empty()) return nullptr; FUAssert(index < physicsSceneRoots.size(), return nullptr); return physicsSceneRoots[index]; } + inline const FCDEntityReference* GetPhysicsSceneInstanceReference(size_t index = 0) const { if (index == 0 && physicsSceneRoots.empty()) return nullptr; FUAssert(index < physicsSceneRoots.size(), return nullptr); return physicsSceneRoots[index]; } /** Adds an empty reference in the list of instanced physics scenes. @return The new, empty, reference. */ @@ -269,10 +269,10 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject /** Retrieves a specific entity layer contained within the document. @param index The index of the layer. - @return The entity layer. This pointer will be NULL if the index + @return The entity layer. This pointer will be nullptr if the index is out-of-bounds. */ - inline FCDLayer* GetLayer(size_t index) { FUAssert(index < GetLayerCount(), return NULL); return layers.at(index); } - inline const FCDLayer* GetLayer(size_t index) const { FUAssert(index < GetLayerCount(), return NULL); return layers.at(index); } /**< See above. */ + inline FCDLayer* GetLayer(size_t index) { FUAssert(index < GetLayerCount(), return nullptr); return layers.at(index); } + inline const FCDLayer* GetLayer(size_t index) const { FUAssert(index < GetLayerCount(), return nullptr); return layers.at(index); } /**< See above. */ /** Adds an entity layer to the document. @return The new layer. */ @@ -395,99 +395,99 @@ class FCOLLADA_EXPORT FCDocument : public FCDObject /** Retrieves the animation tree node that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The animation tree node. This pointer will be NULL if + @return The animation tree node. This pointer will be nullptr if no matching animation tree node was found. */ FCDAnimation* FindAnimation(const fm::string& daeId); /** Retrieves the animation clip that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The animation clip. This pointer will be NULL if + @return The animation clip. This pointer will be nullptr if no matching animation clip was found. */ FCDAnimationClip* FindAnimationClip(const fm::string& daeId); /** Retrieves the camera that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The camera. This pointer will be NULL if no matching camera was found. */ + @return The camera. This pointer will be nullptr if no matching camera was found. */ FCDCamera* FindCamera(const fm::string& daeId); /** Retrieves the controller that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The controller. This pointer will be NULL if no matching controller was found. */ + @return The controller. This pointer will be nullptr if no matching controller was found. */ FCDController* FindController(const fm::string& daeId); /** Retrieves the effect that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The effect. This pointer will be NULL if no matching effect was found. */ + @return The effect. This pointer will be nullptr if no matching effect was found. */ FCDEffect* FindEffect(const fm::string& daeId); /** Retrieves the entity that matches the given COLLADA id. This function will look through all the libraries for any entity with the given COLLADA id. @param daeId A valid COLLADA id. - @return The entity. This pointer will be NULL if no matching entity was found. */ + @return The entity. This pointer will be nullptr if no matching entity was found. */ FCDEntity* FindEntity(const fm::string& daeId); /** Retrieves the emitter that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The emitter. This pointer will be NULL if no matching emitter was found. */ + @return The emitter. This pointer will be nullptr if no matching emitter was found. */ FCDEmitter* FindEmitter(const fm::string& daeId); /** Retrieves the force field that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The force field. This pointer will be NULL if no matching force field was found. */ + @return The force field. This pointer will be nullptr if no matching force field was found. */ FCDForceField* FindForceField(const fm::string& daeId); /** Retrieves the geometry that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The geometry. This pointer will be NULL if no matching geometry was found. */ + @return The geometry. This pointer will be nullptr if no matching geometry was found. */ FCDGeometry* FindGeometry(const fm::string& daeId); /** Retrieves the image that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The image. This pointer will be NULL if no matching image was found. */ + @return The image. This pointer will be nullptr if no matching image was found. */ FCDImage* FindImage(const fm::string& daeId); /** Retrieves the layer that matches the given name. Note that there are no checks for uniqueness in layer names. @param name A layer name. - @return The layer. This pointer will be NULL if no matching layer was found. */ + @return The layer. This pointer will be nullptr if no matching layer was found. */ FCDLayer* FindLayer(const fm::string& name); /** Retrieves the light that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The light. This pointer will be NULL if no matching light was found. */ + @return The light. This pointer will be nullptr if no matching light was found. */ FCDLight* FindLight(const fm::string& daeId); /** Retrieves the visual material that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The visual material. This pointer will be NULL if no matching visual material was found. */ + @return The visual material. This pointer will be nullptr if no matching visual material was found. */ FCDMaterial* FindMaterial(const fm::string& daeId); /** Retrieves the visual scene that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The visual scene. This pointer will be NULL if no matching visual scene was found. */ + @return The visual scene. This pointer will be nullptr if no matching visual scene was found. */ FCDSceneNode* FindVisualScene(const fm::string& daeId); /** Retrieves the physics scene that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The physics scene. This pointer will be NULL if no matching physics scene was found. */ + @return The physics scene. This pointer will be nullptr if no matching physics scene was found. */ FCDPhysicsScene* FindPhysicsScene(const fm::string& daeId); /** Retrieves the physics material that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The physics material. This pointer will be NULL if no matching physics material was found. */ + @return The physics material. This pointer will be nullptr if no matching physics material was found. */ FCDPhysicsMaterial* FindPhysicsMaterial(const fm::string& daeId); /** Retrieves the physics model that matches the given COLLADA id. @param daeId A valid COLLADA id. - @return The physics model. This pointer will be NULL if no matching physics model was found. */ + @return The physics model. This pointer will be nullptr if no matching physics model was found. */ FCDPhysicsModel* FindPhysicsModel(const fm::string& daeId); /** Retrieves the visual scene node that matches the given COLLADA id. This method searches through all the visual scenes within the visual scene library and their child visual scene nodes to find the correct visual scene node. @param daeId A valid COLLADA id. - @return The visual scene node. This pointer will be NULL if no matching visual scene node was found. */ + @return The visual scene node. This pointer will be nullptr if no matching visual scene node was found. */ const FCDSceneNode* FindSceneNode(const char* daeId) const; inline FCDSceneNode* FindSceneNode(const char* daeId) { return const_cast(const_cast(this)->FindSceneNode(daeId)); } diff --git a/FCollada/FCDocument/FCDocumentTools.cpp b/FCollada/FCDocument/FCDocumentTools.cpp index 74dae0a..2ce0e37 100644 --- a/FCollada/FCDocument/FCDocumentTools.cpp +++ b/FCollada/FCDocument/FCDocumentTools.cpp @@ -81,18 +81,18 @@ namespace FCDocumentTools if (transform->HasType(FCDTRotation::GetClassType())) { FCDAnimated* animated = transform->GetAnimated(); - if (animated != NULL && !animated->HasCurve()) animated = NULL; - if (animated == NULL) return (FCDTRotation*) transform; + if (animated != nullptr && !animated->HasCurve()) animated = nullptr; + if (animated == nullptr) return (FCDTRotation*) transform; } } - return NULL; + return nullptr; } static void SmartAddRotationPivot(FCDSceneNode* node, const FMVector3& axis, float angle) { // Check for an old rotation pivot to remove. FCDTRotation* lastRotation = GetLastTransformForPivot(node); - if (lastRotation != NULL && IsEquivalent(lastRotation->GetAxis(), axis) && IsEquivalent(lastRotation->GetAngle(), -1.0f * angle)) + if (lastRotation != nullptr && IsEquivalent(lastRotation->GetAxis(), axis) && IsEquivalent(lastRotation->GetAngle(), -1.0f * angle)) { SAFE_RELEASE(lastRotation); lastRotation = GetLastTransformForPivot(node); @@ -204,7 +204,7 @@ namespace FCDocumentTools FCDSceneNode* Next() { CleanQueue(); - if (queue.empty()) return NULL; + if (queue.empty()) return nullptr; FCDSceneNode* node = queue.back()->GetNode(); queue.back()->Next(); @@ -235,7 +235,7 @@ namespace FCDocumentTools { FCDAssetList assets; assets.reserve(3); entity->GetHierarchicalAssets(assets); - if (libraryAsset != NULL) assets.push_back(libraryAsset); + if (libraryAsset != nullptr) assets.push_back(libraryAsset); bool hasLength = false; bool hasAxis = false; for (FCDAssetList::iterator it = assets.begin(); it != assets.end(); ++it) @@ -250,7 +250,7 @@ namespace FCDocumentTools inline void ResetAsset(FCDEntity* entity) { FCDAsset* asset = const_cast(const_cast(entity)->GetAsset()); - if (asset != NULL) + if (asset != nullptr) { asset->ResetHasUnitsFlag(); asset->ResetHasUpAxisFlag(); @@ -259,7 +259,7 @@ namespace FCDocumentTools void ConvertAnimationVector3(FCDAnimated* animated1, FCDAnimated* animated2, FCDAnimated* animated3, float* v1, float* v2, float* v3, FCDocument* document, FCDConversionUnitFunctor& lengthFunctor, FCDConversionSwapFunctor& upAxisFunctor, bool convertLength, bool isScale = false) { - FUAssert(animated1 != NULL && animated2 != NULL && animated3 != NULL, return); + FUAssert(animated1 != nullptr && animated2 != nullptr && animated3 != nullptr, return); size_t indices[3] = { animated1->FindValue(v1), animated2->FindValue(v2), animated3->FindValue(v3) }; if (indices[0] == ~(size_t)0 && indices[1] == ~(size_t)0 && indices[2] == ~(size_t)0) return; // no animations on the vector @@ -282,7 +282,7 @@ namespace FCDocumentTools } animateds[i]->RemoveCurve(indices[i]); } - else curves[i] = NULL; + else curves[i] = nullptr; } // transform the keys' outputs @@ -352,7 +352,7 @@ namespace FCDocumentTools void ConvertAnimationFloat(FCDAnimated* animated, float& f, FCDocument* document, FCDConversionUnitFunctor& lengthFunctor, FCDConversionSwapFunctor& upAxisFunctor) { - if (animated != NULL) + if (animated != nullptr) { size_t index = animated->FindValue(&f); if (index == ~(size_t)0) return; // no animations on the float @@ -417,7 +417,7 @@ namespace FCDocumentTools void StandardizeUpAxisAndLength(FCDocument* document, const FMVector3& upAxis, float unitInMeters, bool handleTargets) { - if (document == NULL) return; + if (document == nullptr) return; // Figure out the wanted up_axis and unit values, if they are not provided. FCDAsset* baseAsset = document->GetAsset(); @@ -514,7 +514,7 @@ namespace FCDocumentTools { // Targeted entities should still point in the correct direction: do only roll up-axis changes. bool rollOnly = false; - if (handleTargets && nodeInstance->GetEntity() != NULL && nodeInstance->GetEntity()->HasType(FCDTargetedEntity::GetClassType())) + if (handleTargets && nodeInstance->GetEntity() != nullptr && nodeInstance->GetEntity()->HasType(FCDTargetedEntity::GetClassType())) { FCDTargetedEntity* targetedEntity = (FCDTargetedEntity*) nodeInstance->GetEntity(); rollOnly = targetedEntity->HasTarget(); // Don't pivot fully. diff --git a/FCollada/FCollada.cpp b/FCollada/FCollada.cpp index 895d5b9..c7e30e9 100644 --- a/FCollada/FCollada.cpp +++ b/FCollada/FCollada.cpp @@ -32,8 +32,8 @@ namespace FCollada static size_t libraryInitializationCount = 0; static FUTrackedList topDocuments; static bool dereferenceFlag = true; - FColladaPluginManager* pluginManager = NULL; // Externed in FCDExtra.cpp. - CancelLoadingCallback cancelLoadingCallback = NULL; + FColladaPluginManager* pluginManager = nullptr; // Externed in FCDExtra.cpp. + CancelLoadingCallback cancelLoadingCallback = nullptr; FCOLLADA_EXPORT FColladaPluginManager* GetPluginManager() { return pluginManager; } @@ -41,7 +41,7 @@ namespace FCollada FCOLLADA_EXPORT void Initialize() { - if (pluginManager == NULL) + if (pluginManager == nullptr) { pluginManager = new FColladaPluginManager(); pluginManager->RegisterPlugin(CreatePlugin(0)); @@ -79,7 +79,7 @@ namespace FCollada } FCOLLADA_EXPORT size_t GetTopDocumentCount() { return topDocuments.size(); } - FCOLLADA_EXPORT FCDocument* GetTopDocument(size_t index) { FUAssert(index < topDocuments.size(), return NULL); return topDocuments.at(index); } + FCOLLADA_EXPORT FCDocument* GetTopDocument(size_t index) { FUAssert(index < topDocuments.size(), return nullptr); return topDocuments.at(index); } FCOLLADA_EXPORT bool IsTopDocument(FCDocument* document) { return topDocuments.contains(document); } FCOLLADA_EXPORT void GetAllDocuments(FCDocumentList& documents) @@ -96,14 +96,14 @@ namespace FCollada { FCDPlaceHolder* placeHolder = xrefManager->GetPlaceHolder(p); FCDocument* target = placeHolder->GetTarget(false); - if (target != NULL && !documents.contains(target)) documents.push_back(target); + if (target != nullptr && !documents.contains(target)) documents.push_back(target); } } } FCOLLADA_EXPORT FCDocument* LoadDocumentFromFile(const fchar* filename) { - FUAssert(pluginManager != NULL, return NULL); + FUAssert(pluginManager != nullptr, return nullptr); FCDocument* theDocument = FCollada::NewTopDocument(); if (!LoadDocumentFromFile(theDocument, filename)) @@ -115,7 +115,7 @@ namespace FCollada FCOLLADA_EXPORT bool LoadDocumentFromFile(FCDocument* document, const fchar* filename) { - FUAssert(pluginManager != NULL, return false); + FUAssert(pluginManager != nullptr, return false); return pluginManager->LoadDocumentFromFile(document, filename); } @@ -129,13 +129,13 @@ namespace FCollada FCOLLADA_EXPORT bool LoadDocumentFromMemory(const fchar* filename, FCDocument* document, void* data, size_t length) { - FUAssert(pluginManager != NULL, return false); + FUAssert(pluginManager != nullptr, return false); return pluginManager->LoadDocumentFromMemory(filename, document, data, length); } FCOLLADA_EXPORT bool SaveDocument(FCDocument* document, const fchar* filename) { - FUAssert(pluginManager != NULL, return false); + FUAssert(pluginManager != nullptr, return false); return pluginManager->SaveDocumentToFile(document, filename); } @@ -152,7 +152,7 @@ namespace FCollada FCOLLADA_EXPORT bool RegisterPlugin(FUPlugin* plugin) { // This function is deprecated. - FUAssert(pluginManager != NULL, return false); + FUAssert(pluginManager != nullptr, return false); return pluginManager->RegisterPlugin(plugin); } diff --git a/FCollada/FCollada.h b/FCollada/FCollada.h index dfb34bb..752426f 100644 --- a/FCollada/FCollada.h +++ b/FCollada/FCollada.h @@ -141,7 +141,7 @@ namespace FCollada /** Load document. @param filename the string of the file to load from - @return the loaded FCDocument. NULL is returned if any error occurs. */ + @return the loaded FCDocument. nullptr is returned if any error occurs. */ FCOLLADA_EXPORT bool LoadDocumentFromFile(FCDocument* document, const fchar* filename); DEPRECATED(3.05A, LoadDocumentFromFile) inline bool LoadDocument(FCDocument* document, const fchar* filename) { return LoadDocumentFromFile(document, filename); } DEPRECATED(3.05A, NewTopDocument and LoadDocumentFromFile) FCOLLADA_EXPORT FCDocument* LoadDocument(const fchar* filename); diff --git a/FCollada/FColladaPlugin.cpp b/FCollada/FColladaPlugin.cpp index 55747ed..3bca13a 100644 --- a/FCollada/FColladaPlugin.cpp +++ b/FCollada/FColladaPlugin.cpp @@ -31,7 +31,7 @@ ImplementObjectType(FCPArchive) ImplementObjectType(FColladaPluginManager) FColladaPluginManager::FColladaPluginManager() -: loader(NULL) +: loader(nullptr) { // Create the plug-in loader and create all the FCollada plug-ins. loader = new FUPluginManager(FC("*.fcp|*.fvp")); @@ -46,7 +46,7 @@ FColladaPluginManager::FColladaPluginManager() { FCPExtraTechnique* plugin = (FCPExtraTechnique*) _plugin; const char* profileName = plugin->GetProfileName(); - if (profileName != NULL && profileName[0] != 0) + if (profileName != nullptr && profileName[0] != 0) { extraTechniquePlugins.push_back(plugin); } @@ -66,7 +66,7 @@ FColladaPluginManager::~FColladaPluginManager() bool FColladaPluginManager::RegisterPlugin(FUPlugin* plugin) { - if (plugin != NULL) + if (plugin != nullptr) { if (plugin->HasType(FCPArchive::GetClassType())) { @@ -77,7 +77,7 @@ bool FColladaPluginManager::RegisterPlugin(FUPlugin* plugin) { FCPExtraTechnique* extraPlugin = (FCPExtraTechnique*) plugin; const char* profileName = extraPlugin->GetProfileName(); - if (profileName != NULL && *profileName != 0) + if (profileName != nullptr && *profileName != 0) { extraTechniquePlugins.push_back(extraPlugin); return true; @@ -100,7 +100,7 @@ void FColladaPluginManager::CreateExtraTechniquePluginMap(FCPExtraMap& map) bool FColladaPluginManager::LoadDocumentFromFile(FCDocument* document, const fchar* filename) { FCPArchive* archiver = FindArchivePlugin(filename); - if (archiver != NULL) + if (archiver != nullptr) { bool success = archiver->ImportFile(filename, document); if (success) PostImportDocument(document); @@ -116,7 +116,7 @@ bool FColladaPluginManager::LoadDocumentFromFile(FCDocument* document, const fch bool FColladaPluginManager::LoadDocumentFromMemory(const fchar* filename, FCDocument* document, void* data, size_t length) { FCPArchive* archiver = FindArchivePlugin(filename); - if (archiver != NULL) + if (archiver != nullptr) { bool success = archiver->ImportFileFromMemory(filename, document, data, length); if (success) PostImportDocument(document); @@ -132,7 +132,7 @@ bool FColladaPluginManager::LoadDocumentFromMemory(const fchar* filename, FCDocu bool FColladaPluginManager::SaveDocumentToFile(FCDocument* document, const fchar* filename) { FCPArchive* archiver = FindArchivePlugin(filename); - if (archiver != NULL) + if (archiver != nullptr) { FCDETechniqueList techniques; PreExportDocument(document, techniques); @@ -165,7 +165,7 @@ FCPArchive* FColladaPluginManager::FindArchivePlugin(const fchar* filename) } } - return NULL; + return nullptr; } void FColladaPluginManager::PostImportDocument(FCDocument* document) @@ -192,7 +192,7 @@ void FColladaPluginManager::PostImportDocument(FCDocument* document) { // Call the corresponding plug-in to process this information. FUTrackable* customized = itP->second->ReadFromArchive(technique, itE->first->GetParent()); - if (customized != NULL) + if (customized != nullptr) { technique->SetPluginObject(customized); while (technique->GetChildNodeCount() != 0) technique->GetChildNode(technique->GetChildNodeCount() - 1)->Release(); @@ -222,7 +222,7 @@ void FColladaPluginManager::PreExportDocument(FCDocument* document, FCDETechniqu { FCDETechnique* technique = type->GetTechnique(j); FUTrackable* customized = technique->GetPluginObject(); - if (customized != NULL) + if (customized != nullptr) { uint32 crc = FUCrc32::CRC32(technique->GetProfile()); FCPExtraMap::iterator itP = pluginMap.find(crc); @@ -241,7 +241,7 @@ void FColladaPluginManager::PostExportDocument(FCDocument* UNUSED(document), FCD { for (FCDETechnique** itT = techniques.begin(); itT != techniques.end(); ++itT) { - FUAssert((*itT)->GetPluginObject() != NULL, continue); + FUAssert((*itT)->GetPluginObject() != nullptr, continue); while ((*itT)->GetChildNodeCount() != 0) (*itT)->GetChildNode((*itT)->GetChildNodeCount() - 1)->Release(); } } diff --git a/FCollada/FColladaPlugin.h b/FCollada/FColladaPlugin.h index c9fc88c..0f45e11 100644 --- a/FCollada/FColladaPlugin.h +++ b/FCollada/FColladaPlugin.h @@ -45,10 +45,10 @@ class FCOLLADA_EXPORT FCPExtraTechnique : public FUPlugin /** Replaces the extra tree node and generates the profile-specific object for it. A temporary extra tree is generated for archiving purposes and will be kept - after this call only if this function returns NULL. + after this call only if this function returns nullptr. @param techniqueNode The extra tree node for the profile-specific technique. @param parent The object that is creating this profile-specific object. - @return An handle to the profile-specific object. When this handle is NULL, + @return An handle to the profile-specific object. When this handle is nullptr, the FCollada extra tree will be kept. When the extra tree that contains this handle is released, the handle will also be released. If you use this handle elsewhere, make sure you correctly use the FUTrackedPtr, FUObjectRef, @@ -107,7 +107,7 @@ class FCOLLADA_EXPORT FCPArchive: public FUPlugin /** Retrieve one supported extension. @param index the index at which the extension is to be retrieved. Ideally to be less then that returned by GetSupportedExtensionsCount(). - @return the string of the file extension at the given index. NULL is returned + @return the string of the file extension at the given index. nullptr is returned if the given index is invalid. */ virtual const char* GetSupportedExtensionAt(int index) = 0; @@ -148,7 +148,7 @@ class FCOLLADA_EXPORT FCPArchive: public FUPlugin Only valid if 'IsPartlyExportSupported()' returns 'true'. @param filePath A full file path specifying the location of the target path This is in order to process relative file paths correctly. If this parameter - is NULL then all paths will be exported absolutely. + is nullptr then all paths will be exported absolutely. @return Whether the operation succeeded. */ virtual bool StartExport(const fchar* absoluteFilePath) = 0; @@ -212,8 +212,8 @@ class FCOLLADA_EXPORT FColladaPluginManager : public FUObject /** Retrieves the archive plugin specified by the given index. @param index The archive plugin index. - @return The plugin pointer on success, NULL otherwise.*/ - FCPArchive* GetArchivePlugin(size_t index){ FUAssert(index < archivePlugins.size(), return NULL); return archivePlugins[index]; } + @return The plugin pointer on success, nullptr otherwise.*/ + FCPArchive* GetArchivePlugin(size_t index){ FUAssert(index < archivePlugins.size(), return nullptr); return archivePlugins[index]; } /** Manually registers a plugin. To manually un-register a plugin, use the plugin->Release() function. diff --git a/FCollada/FColladaTest/FCTestAnimation.cpp b/FCollada/FColladaTest/FCTestAnimation.cpp index 08fc6ca..3aa2388 100644 --- a/FCollada/FColladaTest/FCTestAnimation.cpp +++ b/FCollada/FColladaTest/FCTestAnimation.cpp @@ -30,7 +30,7 @@ TESTSUITE_TEST(0, Sampling) PassIf(errorHandler.IsSuccessful()); PassIf(document->GetCameraLibrary()->GetEntityCount() == 1); FCDSceneNode* node = document->FindSceneNode("Bone09"); - FailIf(node == NULL); + FailIf(node == nullptr); FCDSceneNodeTools::GenerateSampledAnimation(node); const FloatList& keys = FCDSceneNodeTools::GetSampledAnimationKeys(); @@ -79,7 +79,7 @@ TESTSUITE_TEST(1, CurveMerging) curves.push_back(c2); FloatList defaultValues(2, 0.0f); FCDAnimationMultiCurve* multiCurve = FCDAnimationCurveTools::MergeCurves(curves, defaultValues); - FailIf(multiCurve == NULL); + FailIf(multiCurve == nullptr); // Verify the created multi-curve static const size_t multiCurveKeyCount = 4; diff --git a/FCollada/FColladaTest/FCTestAssetManagement/FCTAMCrossCloning.cpp b/FCollada/FColladaTest/FCTestAssetManagement/FCTAMCrossCloning.cpp index edf92b9..ded5a7e 100644 --- a/FCollada/FColladaTest/FCTestAssetManagement/FCTAMCrossCloning.cpp +++ b/FCollada/FColladaTest/FCTestAssetManagement/FCTAMCrossCloning.cpp @@ -31,9 +31,9 @@ TESTSUITE_TEST(0, ImageCloning) PassIf(image2->GetFilename().find(FC("TestImageGlou.bmp")) != fstring::npos); PassIf(IsEquivalent(image1->GetDaeId(), image2->GetDaeId())); FCDETechnique* extra2 = image2->GetExtra()->GetDefaultType()->FindTechnique("TEST_PROFILE"); - FailIf(extra2 == NULL); + FailIf(extra2 == nullptr); FCDENode* parameter = extra2->FindParameter("GluedOn"); - PassIf(parameter != NULL); + PassIf(parameter != nullptr); PassIf(IsEquivalent(parameter->GetContent(), FC("12"))); TESTSUITE_END diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIAnimation.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIAnimation.cpp index b583bd1..0dbb031 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIAnimation.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIAnimation.cpp @@ -27,7 +27,7 @@ namespace FCTestExportImport bool FillAnimationLibrary(FULogFile& fileOut, FCDAnimationLibrary* library) { // Create two more tree within the animation library - FailIf(library == NULL); + FailIf(library == nullptr); size_t startAnimCount = library->GetEntityCount(); FCDAnimation* animTree1 = library->AddEntity(); FCDAnimation* animTree2 = library->AddEntity(); @@ -54,31 +54,31 @@ namespace FCTestExportImport bool CheckAnimationLibrary(FULogFile& fileOut, FCDAnimationLibrary* library) { - FailIf(library == NULL); + FailIf(library == nullptr); // Retrieve the animation trees using the saved ids. FCDAnimation* animTree1 = library->FindDaeId(animId1); FCDAnimation* animTree2 = library->FindDaeId(animId2); - FailIf(animTree1 == NULL); - FailIf(animTree2 == NULL); + FailIf(animTree1 == nullptr); + FailIf(animTree2 == nullptr); // Verify that the first animation tree has the correct sub-trees. // Retrieve the animation sub-tree which contains our channels. - FCDAnimation* ourChannels = NULL; + FCDAnimation* ourChannels = nullptr; FailIf(animTree1->GetChildrenCount() != 2); for (size_t i = 0; i < 2; ++i) { FCDAnimation* subTree = animTree1->GetChild(i); - FailIf(subTree == NULL); + FailIf(subTree == nullptr); PassIf(subTree->GetNote() == animSubTreeNote); if (subTree->GetChannelCount() > 0) { - PassIf(ourChannels == NULL); + PassIf(ourChannels == nullptr); ourChannels = subTree; } } - PassIf(ourChannels != NULL); + PassIf(ourChannels != nullptr); CheckAnimationLight(fileOut, ourChannels->GetDocument(), ourChannels); return true; } @@ -87,19 +87,19 @@ namespace FCTestExportImport { // Retrieve a light entity and add an animation to its color FCDLightLibrary* lightLibrary = document->GetLightLibrary(); - PassIf(lightLibrary != NULL); + PassIf(lightLibrary != nullptr); PassIf(lightLibrary->GetEntityCount() > 0); FCDLight* light1 = lightLibrary->GetEntity(0); animatedLightId = light1->GetDaeId(); // Create the animated object for the color FCDAnimated* animated = light1->GetColor().GetAnimated(); - FailIf(animated == NULL); + FailIf(animated == nullptr); FailIf(animated->GetValueCount() != 3); // Create a channel for the animation curves FCDAnimationChannel* channel = animationTree->AddChannel(); - FailIf(channel == NULL); + FailIf(channel == nullptr); FCDAnimationCurve* curve = channel->AddCurve(); animated->AddCurve(0, curve); @@ -110,10 +110,10 @@ namespace FCTestExportImport { // Retrieve the light whose color is animated. FCDLightLibrary* lightLibrary = document->GetLightLibrary(); - PassIf(lightLibrary != NULL); + PassIf(lightLibrary != nullptr); PassIf(lightLibrary->GetEntityCount() > 0); FCDLight* light1 = lightLibrary->FindDaeId(animatedLightId); - PassIf(light1 != NULL); + PassIf(light1 != nullptr); return true; } } diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEICamera.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEICamera.cpp index 86f288e..ad9400f 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEICamera.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEICamera.cpp @@ -48,19 +48,19 @@ namespace FCTestExportImport PassIf(library->GetEntityCount() == 2); // Find the perspective and the orthographic camera. - FCDCamera* persp = NULL,* ortho = NULL; + FCDCamera* persp = nullptr,* ortho = nullptr; for (size_t i = 0; i < 2; ++i) { FCDCamera* camera = library->GetEntity(i); PassIf(camera->GetType() == FCDEntity::CAMERA); switch (camera->GetProjectionType()) { - case FCDCamera::PERSPECTIVE: { FailIf(persp != NULL); persp = camera; } break; - case FCDCamera::ORTHOGRAPHIC: { FailIf(ortho != NULL); ortho = camera; } break; + case FCDCamera::PERSPECTIVE: { FailIf(persp != nullptr); persp = camera; } break; + case FCDCamera::ORTHOGRAPHIC: { FailIf(ortho != nullptr); ortho = camera; } break; default: Fail; } } - PassIf(persp != NULL && ortho != NULL); + PassIf(persp != nullptr && ortho != nullptr); // Verify the perspective camera parameters PassIf(IsEquivalent(persp->GetAspectRatio(), 1.5f)); diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIEmitter.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIEmitter.cpp index b41df0e..dc928fa 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIEmitter.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIEmitter.cpp @@ -22,7 +22,7 @@ namespace FCTestExportImport // Export a simple force field. FCDForceField* field = library->AddEntity(); field->SetName(FC("SomeField")); - PassIf(field != NULL); + PassIf(field != nullptr); return true; @@ -32,7 +32,7 @@ namespace FCTestExportImport { // Export a first emitter. FCDEmitter* emitter1 = library->AddEntity(); - PassIf(emitter1 != NULL); + PassIf(emitter1 != nullptr); PassIf(library->GetEntityCount() == 1); PassIf(library->GetEntity(0) == emitter1); PassIf(emitter1->GetType() == FCDEntity::EMITTER); @@ -41,7 +41,7 @@ namespace FCTestExportImport // Export a second emitter. FCDEmitter* emitter2 = library->AddEntity(); PassIf(library->GetEntityCount() == 2); - PassIf(emitter2 != NULL); + PassIf(emitter2 != nullptr); return true; @@ -49,7 +49,7 @@ namespace FCTestExportImport bool FillEmitterInstance(FULogFile& fileOut, FCDEmitterInstance* instance) { - PassIf(instance != NULL); + PassIf(instance != nullptr); return true; @@ -77,7 +77,7 @@ namespace FCTestExportImport bool CheckEmitterInstance(FULogFile& fileOut, FCDEmitterInstance* instance) { - PassIf(instance != NULL); + PassIf(instance != nullptr); return true; diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIExtra.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIExtra.cpp index 8a975c2..f689b78 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIExtra.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIExtra.cpp @@ -16,14 +16,14 @@ namespace FCTestExportImport bool FillExtraTree(FULogFile& fileOut, FCDExtra* extra, bool hasTypes) { - FailIf(extra == NULL); + FailIf(extra == nullptr); // Add a test technique. PassIf(extra->GetDefaultType()->GetTechniqueCount() == 0); FCDETechnique* technique1 = extra->GetDefaultType()->AddTechnique("FCTEI_TestProfile"); FCDETechnique* technique2 = extra->GetDefaultType()->AddTechnique("FCTEI_TestProfile"); - FailIf(technique1 == NULL); - FailIf(technique2 == NULL); + FailIf(technique1 == nullptr); + FailIf(technique2 == nullptr); PassIf(technique1 == technique2); PassIf(extra->GetDefaultType()->GetTechniqueCount() == 1); @@ -49,7 +49,7 @@ namespace FCTestExportImport // Add a second extra type // Empty named-types should be supported. FCDEType* secondType = extra->AddType("verificator"); - PassIf(secondType != NULL); + PassIf(secondType != nullptr); PassIf(secondType != extra->GetDefaultType()); PassIf(secondType->GetTechniqueCount() == 0); } @@ -58,44 +58,44 @@ namespace FCTestExportImport bool CheckExtraTree(FULogFile& fileOut, FCDExtra* extra, bool hasTypes) { - FailIf(extra == NULL); + FailIf(extra == nullptr); // Find and verify the one technique FailIf(extra->GetDefaultType()->GetTechniqueCount() < 1); // note that FCDLight adds some elements of its own. FCDETechnique* technique = extra->GetDefaultType()->FindTechnique("FCTEI_TestProfile"); - FailIf(technique == NULL); + FailIf(technique == nullptr); // Find and verify the base parameter tree node FailIf(technique->GetChildNodeCount() != 1); FCDENode* baseNode = technique->GetChildNode(0); - PassIf(baseNode != NULL); + PassIf(baseNode != nullptr); PassIf(extra->GetDefaultType()->FindRootNode("MainParameterTree") == baseNode); // Verify the base node attributes PassIf(baseNode->GetAttributeCount() == 2); FCDEAttribute* a1 = baseNode->FindAttribute("Vicious"); FCDEAttribute* a2 = baseNode->FindAttribute("Gross"); - FailIf(a1 == NULL); - FailIf(a2 == NULL); + FailIf(a1 == nullptr); + FailIf(a2 == nullptr); FailIf(a1 == a2); PassIf(IsEquivalent(a1->GetValue(), FC("Squirrel"))); PassIf(IsEquivalent(FUStringConversion::ToUInt32(a2->GetValue()), 1002u)); // Identify the base node leaves PassIf(baseNode->GetChildNodeCount() == 2); - FCDENode* leaf0 = NULL,* leaf3 = NULL; + FCDENode* leaf0 = nullptr,* leaf3 = nullptr; for (size_t i = 0; i < 2; ++i) { FCDENode* leaf = baseNode->GetChildNode(i); PassIf(IsEquivalent(leaf->GetName(), "SomeParameter")); FCDEAttribute* guts = leaf->FindAttribute("Guts"); - FailIf(guts == NULL || guts->GetValue().empty()); + FailIf(guts == nullptr || guts->GetValue().empty()); uint32 gutsIndex = FUStringConversion::ToUInt32(guts->GetValue()); - if (gutsIndex == 0) { FailIf(leaf0 != NULL); leaf0 = leaf; } - else if (gutsIndex == 3) { FailIf(leaf3 != NULL); leaf3 = leaf; } + if (gutsIndex == 0) { FailIf(leaf0 != nullptr); leaf0 = leaf; } + else if (gutsIndex == 3) { FailIf(leaf3 != nullptr); leaf3 = leaf; } else Fail; } - FailIf(leaf0 == NULL || leaf3 == NULL); + FailIf(leaf0 == nullptr || leaf3 == nullptr); // Verify the base node leaves PassIf(leaf0->GetChildNodeCount() == 0); @@ -110,7 +110,7 @@ namespace FCTestExportImport // Verify the second extra type // Empty named-types should be imported without complaints or merging. FCDEType* secondType = extra->FindType("verificator"); - PassIf(secondType != NULL); + PassIf(secondType != nullptr); PassIf(secondType != extra->GetDefaultType()); PassIf(secondType->GetTechniqueCount() == 0); } diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIGeometry.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIGeometry.cpp index 0a50e85..7b984a0 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIGeometry.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIGeometry.cpp @@ -47,7 +47,7 @@ namespace FCTestExportImport FailIf(geometry->IsSpline()); PassIf(geometry->IsMesh()); PassIf(geometry->GetMesh() == mesh); - PassIf(geometry->GetSpline() == NULL); + PassIf(geometry->GetSpline() == nullptr); FillGeometryMesh(fileOut, mesh); // Create a spline to export @@ -56,7 +56,7 @@ namespace FCTestExportImport FCDGeometrySpline* spline = geometry->CreateSpline(); PassIf(geometry->IsSpline()); FailIf(geometry->IsMesh()); - PassIf(geometry->GetMesh() == NULL); + PassIf(geometry->GetMesh() == nullptr); PassIf(geometry->GetSpline() == spline); FillGeometrySpline(fileOut, spline); splineId = geometry->GetDaeId(); @@ -67,36 +67,36 @@ namespace FCTestExportImport bool FillGeometryMesh(FULogFile& fileOut, FCDGeometryMesh* mesh) { FCDGeometrySource* posSource = mesh->AddVertexSource(); - FailIf(posSource == NULL); + FailIf(posSource == nullptr); posSource->SetName(FC("TestPositionSource")); posSource->SetSourceType(FUDaeGeometryInput::POSITION); posSource->SetData(FloatList(positionData, 12), 3); FCDGeometrySource* colorSource = mesh->AddSource(); - FailIf(colorSource == NULL); + FailIf(colorSource == nullptr); colorSource->SetName(FC("TestColorSource")); colorSource->SetSourceType(FUDaeGeometryInput::COLOR); colorSource->SetData(FloatList(colorData, 12), 4); FCDGeometrySource* dummySource = mesh->AddSource(); - FailIf(dummySource == NULL); + FailIf(dummySource == nullptr); dummySource->SetName(FC("TestDummySource")); dummySource->SetSourceType(FUDaeGeometryInput::EXTRA); dummySource->SetData(FloatList(dummyData, 10), 3); PassIf(FillExtraTree(fileOut, dummySource->GetExtra(), false)); FCDGeometryPolygons* polys1 = mesh->AddPolygons(); - FailIf(polys1 == NULL || polys1->GetInputCount() != 1); + FailIf(polys1 == nullptr || polys1->GetInputCount() != 1); FCDGeometryPolygons* polys2 = mesh->AddPolygons(); - FailIf(polys2 == NULL || polys2->GetInputCount() != 1); + FailIf(polys2 == nullptr || polys2->GetInputCount() != 1); FCDGeometryPolygonsInput* pInput1 = polys1->AddInput(colorSource, 1); PassIf(polys1->GetInputCount() == 2); - PassIf(pInput1 != NULL && pInput1->GetSource() == colorSource && pInput1->GetOffset() == 1); + PassIf(pInput1 != nullptr && pInput1->GetSource() == colorSource && pInput1->GetOffset() == 1); FCDGeometryPolygonsInput* pInput2 = polys2->AddInput(colorSource, 1); PassIf(polys2->GetInputCount() == 2); - PassIf(pInput2 != NULL && pInput2->GetSource() == colorSource && pInput2->GetOffset() == 1); + PassIf(pInput2 != nullptr && pInput2->GetSource() == colorSource && pInput2->GetOffset() == 1); FCDGeometryPolygonsInput* pInput3 = polys1->AddInput(dummySource, 2); - PassIf(pInput3 != NULL && pInput3->GetSource() == dummySource && pInput3->GetOffset() == 2); + PassIf(pInput3 != nullptr && pInput3->GetSource() == dummySource && pInput3->GetOffset() == 2); // Write some extra tree in there too. FillExtraTree(fileOut, polys1->GetExtra(), true); @@ -104,9 +104,9 @@ namespace FCTestExportImport // Fill in some indices in order to form a tetrahedron polys1->AddFace(3); polys1->AddFace(3); polys1->AddFace(3); polys1->AddFace(3); - FailIf(polys1->FindInput(posSource) == NULL); + FailIf(polys1->FindInput(posSource) == nullptr); polys1->FindInput(posSource)->SetIndices(positionIndices, 12); - FailIf(polys1->FindInput(posSource) == NULL); + FailIf(polys1->FindInput(posSource) == nullptr); polys1->FindInput(colorSource)->SetIndices(colorIndices, 12); return true; } @@ -136,7 +136,7 @@ namespace FCTestExportImport PassIf(library->GetEntityCount() == 2); // Find the one mesh and the one spline geometries. - FCDGeometryMesh* mesh = NULL; FCDGeometrySpline* spline = NULL; + FCDGeometryMesh* mesh = nullptr; FCDGeometrySpline* spline = nullptr; for (size_t i = 0; i < 2; ++i) { FCDGeometry* g = library->GetEntity(i); @@ -144,7 +144,7 @@ namespace FCTestExportImport else if (g->IsSpline()) spline = g->GetSpline(); else Fail; } - FailIf(mesh == NULL || spline == NULL); + FailIf(mesh == nullptr || spline == nullptr); CheckGeometryMesh(fileOut, mesh); CheckGeometrySpline(fileOut, spline); @@ -155,11 +155,11 @@ namespace FCTestExportImport { // Verify the mesh and its sources PassIf(mesh->GetSourceCount() == 3); - FCDGeometrySource* posSource = NULL,* colorSource = NULL,* dummySource = NULL; + FCDGeometrySource* posSource = nullptr,* colorSource = nullptr,* dummySource = nullptr; for (size_t i = 0; i < 3; ++i) { FCDGeometrySource* source = mesh->GetSource(i); - FailIf(source == NULL); + FailIf(source == nullptr); switch (source->GetType()) { case FUDaeGeometryInput::POSITION: posSource = source; PassIf(source->GetName() == FC("TestPositionSource")); break; @@ -168,7 +168,7 @@ namespace FCTestExportImport default: Fail; break; } } - FailIf(posSource == NULL || colorSource == NULL || dummySource == NULL); + FailIf(posSource == nullptr || colorSource == nullptr || dummySource == nullptr); PassIf(IsEquivalent(posSource->GetData(), posSource->GetDataCount(), positionData, 12)); PassIf(posSource->GetStride() == 3); PassIf(IsEquivalent(colorSource->GetData(), colorSource->GetDataCount(), colorData, 12)); @@ -178,25 +178,25 @@ namespace FCTestExportImport PassIf(CheckExtraTree(fileOut, dummySource->GetExtra(), false)); // Find the non-empty polygon set and verify that one of the polygon set is, in fact, empty. - FCDGeometryPolygons* polys1 = NULL,* polysEmpty = NULL; + FCDGeometryPolygons* polys1 = nullptr,* polysEmpty = nullptr; for (size_t i = 0; i < mesh->GetPolygonsCount(); ++i) { FCDGeometryPolygons* p = mesh->GetPolygons(i); - if (p->GetFaceCount() == 0) { PassIf(polysEmpty == NULL); polysEmpty = p; } - else { PassIf(polys1 == NULL); polys1 = p; } + if (p->GetFaceCount() == 0) { PassIf(polysEmpty == nullptr); polysEmpty = p; } + else { PassIf(polys1 == nullptr); polys1 = p; } CheckExtraTree(fileOut, p->GetExtra(), true); } - PassIf(polys1 != NULL && polysEmpty != NULL); + PassIf(polys1 != nullptr && polysEmpty != nullptr); // Check that we have the wanted tetrahedron in the non-empty polygon set. PassIf(polys1->GetFaceCount() == 4); PassIf(polys1->GetHoleCount() == 0); PassIf(polys1->GetFaceVertexCount(0) == 3 && polys1->GetFaceVertexCount(1) == 3 && polys1->GetFaceVertexCount(2) == 3 && polys1->GetFaceVertexCount(3) == 3); FCDGeometryPolygonsInput* posInput = polys1->FindInput(posSource); - FailIf(posInput == NULL || posInput->GetIndexCount() != 12); + FailIf(posInput == nullptr || posInput->GetIndexCount() != 12); FCDGeometryPolygonsInput* colorInput = polys1->FindInput(colorSource); - FailIf(colorInput == NULL || colorInput == posInput || colorInput->GetIndexCount() != 12); + FailIf(colorInput == nullptr || colorInput == posInput || colorInput->GetIndexCount() != 12); PassIf(IsEquivalent(posInput->GetIndices(), 12, positionIndices, 12)); PassIf(IsEquivalent(colorInput->GetIndices(), 12, colorIndices, 12)); return true; @@ -216,7 +216,7 @@ namespace FCTestExportImport bool FillControllerLibrary(FULogFile& fileOut, FCDControllerLibrary* library) { - FailIf(library == NULL); + FailIf(library == nullptr); // Create a morph controller on the previously created spline. FCDController* morpher = library->AddEntity(); @@ -231,16 +231,16 @@ namespace FCTestExportImport bool FillControllerMorph(FULogFile& fileOut, FCDMorphController* controller) { - FailIf(controller == NULL); + FailIf(controller == nullptr); controller->SetMethod(FUDaeMorphMethod::RELATIVE); // Retrieve the base spline entity that will be morphed // (and for this test only: it'll be the morph targets) // Also retrieve the mesh, for similarity checks. FCDGeometry* spline = controller->GetDocument()->FindGeometry(splineId); - FailIf(spline == NULL); + FailIf(spline == nullptr); FCDGeometry* mesh = controller->GetDocument()->FindGeometry(meshId); - FailIf(mesh == NULL); + FailIf(mesh == nullptr); FailIf(controller->IsSimilar(mesh)); FailIf(controller->IsSimilar(spline)); @@ -256,15 +256,15 @@ namespace FCTestExportImport bool FillControllerSkin(FULogFile& fileOut, FCDSkinController* controller) { - FailIf(controller == NULL); + FailIf(controller == nullptr); // Create two joints. FCDSceneNode* visualScene = controller->GetDocument()->GetVisualSceneLibrary()->AddEntity(); - PassIf(visualScene != NULL); + PassIf(visualScene != nullptr); FCDSceneNode* joint1 = visualScene->AddChildNode(); - PassIf(joint1 != NULL); + PassIf(joint1 != nullptr); FCDSceneNode* joint2 = joint1->AddChildNode(); - PassIf(joint2 != NULL); + PassIf(joint2 != nullptr); // In the standard course of operations, we would either load a file // with subId Info, or link it in when loading the instance. Here we have no instance fm::string jid1("joint1"); @@ -286,42 +286,42 @@ namespace FCTestExportImport // Set some influences PassIf(controller->GetInfluenceCount() == 4); FCDSkinControllerVertex* influence = controller->GetVertexInfluence(0); - FailIf(influence == NULL); + FailIf(influence == nullptr); influence->AddPair(0, 0.5f); influence->AddPair(1, 0.5f); influence = controller->GetVertexInfluence(3); - FailIf(influence == NULL); + FailIf(influence == nullptr); influence->AddPair(1, 1.0f); influence = controller->GetVertexInfluence(2); - FailIf(influence == NULL); + FailIf(influence == nullptr); influence->AddPair(0, 0.1f); return true; } bool CheckControllerLibrary(FULogFile& fileOut, FCDControllerLibrary* library) { - FailIf(library == NULL); + FailIf(library == nullptr); - FCDController* morpher = NULL,* skin = NULL; + FCDController* morpher = nullptr,* skin = nullptr; for (size_t i = 0; i < library->GetEntityCount(); ++i) { FCDController* c = library->GetEntity(i); - if (c->IsMorph()) { PassIf(morpher == NULL); morpher = c; } - else if (c->IsSkin()) { PassIf(skin == NULL); skin = c; } + if (c->IsMorph()) { PassIf(morpher == nullptr); morpher = c; } + else if (c->IsSkin()) { PassIf(skin == nullptr); skin = c; } else Fail; } - PassIf(morpher != NULL && skin != NULL); + PassIf(morpher != nullptr && skin != nullptr); // Check the morpher FailIf(morpher->IsSkin()); PassIf(morpher->IsMorph()); - PassIf(morpher->GetMorphController() != NULL); + PassIf(morpher->GetMorphController() != nullptr); PassIf(CheckControllerMorph(fileOut, morpher->GetMorphController())); // Check the skin - PassIf(skin->GetSkinController() != NULL); + PassIf(skin->GetSkinController() != nullptr); //FailIf(skin->HasMorphController()); FailIf(skin->IsMorph()); PassIf(skin->GetNote() == FC("A nicey skinny controller. ")); @@ -331,18 +331,18 @@ namespace FCTestExportImport bool CheckControllerMorph(FULogFile& fileOut, FCDMorphController* controller) { - FailIf(controller == NULL); + FailIf(controller == nullptr); PassIf(controller->GetMethod() == FUDaeMorphMethod::RELATIVE); // Check that there are two targets, that the weights are correct, as well as the ids. PassIf(controller->GetTargetCount() == 2); - PassIf(controller->GetBaseTarget() != NULL); + PassIf(controller->GetBaseTarget() != nullptr); PassIf(controller->GetBaseTarget()->GetDaeId() == splineId); FCDMorphTarget* target1 = controller->GetTarget(0); - FailIf(target1 == NULL); + FailIf(target1 == nullptr); FCDMorphTarget* target2 = controller->GetTarget(1); - FailIf(target2 == NULL); + FailIf(target2 == nullptr); PassIf(target1->GetGeometry() == controller->GetBaseTarget()); PassIf(target2->GetGeometry() == controller->GetBaseTarget()); PassIf(IsEquivalent(target1->GetWeight(), 0.6f) || IsEquivalent(target1->GetWeight(), 0.3f)); @@ -353,31 +353,31 @@ namespace FCTestExportImport bool CheckControllerSkin(FULogFile& fileOut, FCDSkinController* controller) { - FailIf(controller == NULL); + FailIf(controller == nullptr); // Check the base target's identity - FailIf(controller->GetTarget() == NULL); + FailIf(controller->GetTarget() == nullptr); PassIf(controller->GetTarget()->GetType() == FCDEntity::GEOMETRY); PassIf(controller->GetTarget()->GetDaeId() == meshId); // Retrieve the two joints and verify their ids/bind-pose. PassIf(controller->GetJointCount() == 2); - const FMMatrix44* joint1 = NULL,* joint2 = NULL; + const FMMatrix44* joint1 = nullptr,* joint2 = nullptr; for (size_t i = 0; i < 2; ++i) { FCDSkinControllerJoint* joint = controller->GetJoint(i); - if (joint->GetId() == jointId1) { FailIf(joint1 != NULL); joint1 = &joint->GetBindPoseInverse(); } - else if (joint->GetId() == jointId2) { FailIf(joint2 != NULL); joint2 = &joint->GetBindPoseInverse(); } + if (joint->GetId() == jointId1) { FailIf(joint1 != nullptr); joint1 = &joint->GetBindPoseInverse(); } + else if (joint->GetId() == jointId2) { FailIf(joint2 != nullptr); joint2 = &joint->GetBindPoseInverse(); } else Fail; } - FailIf(joint1 == NULL || joint2 == NULL); + FailIf(joint1 == nullptr || joint2 == nullptr); PassIf(IsEquivalent(*joint1, FMMatrix44::Identity)); PassIf(IsEquivalent(*joint2, FMMatrix44(sampleBindPose1).Inverted())); // Verify the influences PassIf(controller->GetInfluenceCount() == 4); FCDSkinControllerVertex* influence = controller->GetVertexInfluence(0); - FailIf(influence == NULL); + FailIf(influence == nullptr); PassIf(influence->GetPairCount() == 2); PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 0)); PassIf(IsEquivalent(influence->GetPair(0)->weight, 0.5f)); @@ -385,17 +385,17 @@ namespace FCTestExportImport PassIf(IsEquivalent(influence->GetPair(1)->weight, 0.5f)); influence = controller->GetVertexInfluence(1); - FailIf(influence == NULL); + FailIf(influence == nullptr); PassIf(influence->GetPairCount() == 0); influence = controller->GetVertexInfluence(2); - FailIf(influence == NULL); + FailIf(influence == nullptr); PassIf(influence->GetPairCount() == 1); PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 0)); PassIf(IsEquivalent(influence->GetPair(0)->weight, 1.0f)); // the weight should have been normalized. influence = controller->GetVertexInfluence(3); - FailIf(influence == NULL); + FailIf(influence == nullptr); PassIf(influence->GetPairCount() == 1); PassIf(IsEquivalent(influence->GetPair(0)->jointIndex, 1)); PassIf(IsEquivalent(influence->GetPair(0)->weight, 1.0f)); diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEILight.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEILight.cpp index 4fbc066..d38fe67 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEILight.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEILight.cpp @@ -46,20 +46,20 @@ namespace FCTestExportImport bool CheckLightLibrary(FULogFile& fileOut, FCDLightLibrary* library) { // Verify that the library contains four lights and one of each type. - FCDLight* pointLight = NULL,* spotLight = NULL,* directionalLight = NULL,* ambientLight = NULL; + FCDLight* pointLight = nullptr,* spotLight = nullptr,* directionalLight = nullptr,* ambientLight = nullptr; for (size_t i = 0; i < library->GetEntityCount(); ++i) { FCDLight* light = library->GetEntity(i); switch (light->GetLightType()) { - case FCDLight::AMBIENT: FailIf(ambientLight != NULL); ambientLight = light; break; - case FCDLight::DIRECTIONAL: FailIf(directionalLight != NULL); directionalLight = light; break; - case FCDLight::POINT: FailIf(pointLight != NULL); pointLight = light; break; - case FCDLight::SPOT: FailIf(spotLight != NULL); spotLight = light; break; + case FCDLight::AMBIENT: FailIf(ambientLight != nullptr); ambientLight = light; break; + case FCDLight::DIRECTIONAL: FailIf(directionalLight != nullptr); directionalLight = light; break; + case FCDLight::POINT: FailIf(pointLight != nullptr); pointLight = light; break; + case FCDLight::SPOT: FailIf(spotLight != nullptr); spotLight = light; break; default: Fail; break; } } - PassIf(ambientLight != NULL && spotLight != NULL && directionalLight != NULL && pointLight != NULL); + PassIf(ambientLight != nullptr && spotLight != nullptr && directionalLight != nullptr && pointLight != nullptr); // Verify the base colors PassIf(IsEquivalent(pointLight->GetColor(), FMVector3(0.5f, 0.2f, 0.7f))); diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIMaterial.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIMaterial.cpp index 2f67c66..3f06db7 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIMaterial.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIMaterial.cpp @@ -51,7 +51,7 @@ namespace FCTestExportImport bool FillEffectStandard(FULogFile& fileOut, FCDEffectStandard* profile) { - FailIf(profile == NULL); + FailIf(profile == nullptr); profile->SetLightingType(FCDEffectStandard::PHONG); profile->SetDiffuseColor(FMVector4(1.0f, 0.0f, -2.0f, 1.0f)); PassIf(IsEquivalent(profile->GetDiffuseColor(), FMVector4(1.0f, 0.0f, -2.0f, 1.0f))); @@ -62,7 +62,7 @@ namespace FCTestExportImport // Retrieve two images created earlier FCDImage* image1 = profile->GetDocument()->FindImage(wantedImageId); FCDImage* image2 = profile->GetDocument()->FindImage(wantedImage2Id); - PassIf(image1 != NULL && image2 != NULL); // Dependency! Must fill the image library first + PassIf(image1 != nullptr && image2 != nullptr); // Dependency! Must fill the image library first // Two simple bump textures FCDTexture* texture1 = profile->AddTexture(FUDaeTextureChannel::BUMP); @@ -76,11 +76,11 @@ namespace FCTestExportImport // A bit more extra support. FCDEType* extraType = profile->GetExtra()->AddType("Curious"); - PassIf(extraType != NULL); + PassIf(extraType != nullptr); FCDETechnique* extraTechnique = extraType->AddTechnique("Kiddy"); - PassIf(extraTechnique != NULL); + PassIf(extraTechnique != nullptr); FCDENode* extraNode = extraTechnique->AddParameter("Causes", "trouble"); - PassIf(extraNode != NULL); + PassIf(extraNode != nullptr); // The third texture is a filter texture and will remain empty. UNUSED(FCDTexture* texture3 =)profile->AddTexture(FUDaeTextureChannel::FILTER); @@ -89,7 +89,7 @@ namespace FCTestExportImport bool FillEffectFX(FULogFile& fileOut, FCDEffectProfileFX* profile) { - FailIf(profile == NULL); + FailIf(profile == nullptr); // Generate some code: both from a code file and using inline code. FCDEffectCode* code = profile->AddCode(); @@ -150,14 +150,14 @@ namespace FCTestExportImport PassIf(library->GetEntityCount() == 2); PassIf(library->GetDocument()->GetEffectLibrary()->GetEntityCount() == 1); - FCDMaterial* emptyMaterial = NULL,* material = NULL; + FCDMaterial* emptyMaterial = nullptr,* material = nullptr; for (size_t i = 0; i < library->GetEntityCount(); ++i) { FCDMaterial* m = library->GetEntity(i); - if (m->GetEffect() == NULL) { PassIf(emptyMaterial == NULL); emptyMaterial = m; } - else { PassIf(material == NULL); material = m; } + if (m->GetEffect() == nullptr) { PassIf(emptyMaterial == nullptr); emptyMaterial = m; } + else { PassIf(material == nullptr); material = m; } } - PassIf(emptyMaterial != NULL && material != NULL); + PassIf(emptyMaterial != nullptr && material != nullptr); // Verify the empty material. It should only have a note. PassIf(emptyMaterial->GetNote() == FC("EmptyMaterial244")); @@ -175,7 +175,7 @@ namespace FCTestExportImport bool CheckEffectStandard(FULogFile& fileOut, FCDEffectStandard* profile) { - FailIf(profile == NULL); + FailIf(profile == nullptr); PassIf(profile->GetLightingType() == FCDEffectStandard::PHONG); PassIf(IsEquivalent(profile->GetDiffuseColor(), FMVector4(1.0f, 0.0f, -2.0f, 1.0f))); PassIf(IsEquivalent(profile->GetSpecularColor(), FMVector4(0.0f, 1.0f, 0.4f, 1.0f))); @@ -184,65 +184,65 @@ namespace FCTestExportImport // There should be two textures in the bump channel. PassIf(profile->GetTextureCount(FUDaeTextureChannel::BUMP) == 2); - FCDTexture* texture1 = NULL,* texture2 = NULL; + FCDTexture* texture1 = nullptr,* texture2 = nullptr; for (size_t i = 0; i < 2; ++i) { FCDTexture* texture = profile->GetTexture(FUDaeTextureChannel::BUMP, i); - FailIf(texture == NULL); - if (texture1 == NULL) texture1 = texture; - else if (texture2 == NULL) texture2 = texture; + FailIf(texture == nullptr); + if (texture1 == nullptr) texture1 = texture; + else if (texture2 == nullptr) texture2 = texture; else Fail; } - PassIf(texture1 != NULL && texture2 != NULL); + PassIf(texture1 != nullptr && texture2 != nullptr); // Verify the texture images FCDImage* image1 = profile->GetDocument()->FindImage(wantedImageId); FCDImage* image2 = profile->GetDocument()->FindImage(wantedImage2Id); - PassIf(image1 != NULL && image2 != NULL); + PassIf(image1 != nullptr && image2 != nullptr); PassIf(texture1->GetImage() == image2); PassIf(texture2->GetImage() == image1); // Verify the placement parameters FCDETechnique* technique1 = texture1->GetExtra()->GetDefaultType()->FindTechnique(DAEMAYA_MAYA_PROFILE); FCDETechnique* technique2 = texture2->GetExtra()->GetDefaultType()->FindTechnique(DAEMAYA_MAYA_PROFILE); - PassIf(technique1 != NULL && technique2 != NULL); + PassIf(technique1 != nullptr && technique2 != nullptr); FCDENode* node1 = technique1->FindParameter(DAEMAYA_TEXTURE_WRAPU_PARAMETER); FCDENode* node2 = technique2->FindParameter(DAEMAYA_TEXTURE_WRAPV_PARAMETER); - PassIf(node1 != NULL && node2 != NULL); + PassIf(node1 != nullptr && node2 != nullptr); PassIf(IsEquivalent(FUStringConversion::ToFloat(node1->GetContent()), 2.0f)); PassIf(IsEquivalent(FUStringConversion::ToFloat(node2->GetContent()), -1.2f)); // Profile-level extra support verification. FCDEType* extraType = profile->GetExtra()->FindType("Curious"); - PassIf(extraType != NULL); + PassIf(extraType != nullptr); FCDETechnique* extraTechnique = extraType->FindTechnique("Kiddy"); - PassIf(extraTechnique != NULL); + PassIf(extraTechnique != nullptr); FCDENode* extraNode = extraTechnique->FindParameter("Causes"); - PassIf(extraTechnique != NULL); + PassIf(extraTechnique != nullptr); PassIf(IsEquivalent(extraNode->GetContent(), FC("trouble"))); // There should be an empty texture in the filter channel PassIf(profile->GetTextureCount(FUDaeTextureChannel::FILTER) == 1); FCDTexture* texture3 = profile->GetTexture(FUDaeTextureChannel::FILTER, 0); - FailIf(texture3 == NULL || texture3->GetImage() != NULL); + FailIf(texture3 == nullptr || texture3->GetImage() != nullptr); return true; } bool CheckEffectFX(FULogFile& fileOut, FCDEffectProfileFX* profile) { - FailIf(profile == NULL); + FailIf(profile == nullptr); PassIf(profile->GetTechniqueCount() == 1); PassIf(profile->GetCodeCount() == 2); // Verify the code inclusions. - FCDEffectCode* inlineCode = NULL,* filenameCode = NULL; + FCDEffectCode* inlineCode = nullptr,* filenameCode = nullptr; for (size_t i = 0; i < profile->GetCodeCount(); ++i) { FCDEffectCode* c = profile->GetCode(i); switch (c->GetType()) { - case FCDEffectCode::INCLUDE: PassIf(filenameCode == NULL); filenameCode = c; break; - case FCDEffectCode::CODE: PassIf(inlineCode == NULL); inlineCode = c; break; + case FCDEffectCode::INCLUDE: PassIf(filenameCode == nullptr); filenameCode = c; break; + case FCDEffectCode::CODE: PassIf(inlineCode == nullptr); inlineCode = c; break; default: Fail; break; } } @@ -256,47 +256,47 @@ namespace FCTestExportImport PassIf(technique->GetName() == FC("100 percent reason to remember the name.")); PassIf(technique->GetPassCount() == 2); FCDEffectPass* pass1 = technique->GetPass(0); - PassIf(pass1 != NULL); + PassIf(pass1 != nullptr); FCDEffectPass* pass2 = technique->GetPass(1); - PassIf(pass2 != NULL); + PassIf(pass2 != nullptr); PassIf(pass1->GetPassName() == FC("First Pass")); PassIf(pass2->GetPassName() == FC("Second Pass")); // Verify the few parameters littered around. PassIf(profile->GetEffectParameterCount() == 3); - FCDEffectParameterBool* booleanParameter = NULL; - FCDEffectParameterSampler* samplerParameter = NULL; - FCDEffectParameterSurface* surfaceParameter = NULL; + FCDEffectParameterBool* booleanParameter = nullptr; + FCDEffectParameterSampler* samplerParameter = nullptr; + FCDEffectParameterSurface* surfaceParameter = nullptr; for (size_t i = 0; i < 3; ++i) { FCDEffectParameter* p = profile->GetEffectParameter(i); - if (p->GetObjectType() == FCDEffectParameterBool::GetClassType()) { FailIf(booleanParameter != NULL); booleanParameter = (FCDEffectParameterBool*) p; } - else if (p->GetObjectType() == FCDEffectParameterSampler::GetClassType()) { FailIf(samplerParameter != NULL); samplerParameter = (FCDEffectParameterSampler*) p; } - else if (p->GetObjectType() == FCDEffectParameterSurface::GetClassType()) { FailIf(surfaceParameter != NULL); surfaceParameter = (FCDEffectParameterSurface*) p; } + if (p->GetObjectType() == FCDEffectParameterBool::GetClassType()) { FailIf(booleanParameter != nullptr); booleanParameter = (FCDEffectParameterBool*) p; } + else if (p->GetObjectType() == FCDEffectParameterSampler::GetClassType()) { FailIf(samplerParameter != nullptr); samplerParameter = (FCDEffectParameterSampler*) p; } + else if (p->GetObjectType() == FCDEffectParameterSurface::GetClassType()) { FailIf(surfaceParameter != nullptr); surfaceParameter = (FCDEffectParameterSurface*) p; } else Fail; } - FailIf(booleanParameter == NULL || samplerParameter == NULL || surfaceParameter == NULL); + FailIf(booleanParameter == nullptr || samplerParameter == nullptr || surfaceParameter == nullptr); PassIf(booleanParameter->GetType() == FCDEffectParameter::BOOLEAN); PassIf(booleanParameter->GetValue() == true); PassIf(technique->GetEffectParameterCount() == 1); FCDEffectParameter* float2Parameter = technique->GetEffectParameter(0); - FailIf(float2Parameter == NULL); + FailIf(float2Parameter == nullptr); PassIf(float2Parameter->GetType() == FCDEffectParameter::FLOAT2); PassIf(IsEquivalent(((FCDEffectParameterFloat2*) float2Parameter)->GetValue()->x, 1.5f)); PassIf(IsEquivalent(((FCDEffectParameterFloat2*) float2Parameter)->GetValue()->y, 5.2f)); // Verify the float2 parameter annotations - FCDEffectParameterAnnotation* floatAnnotation = NULL,* integerAnnotation = NULL,* stringAnnotation = NULL,* booleanAnnotation = NULL; + FCDEffectParameterAnnotation* floatAnnotation = nullptr,* integerAnnotation = nullptr,* stringAnnotation = nullptr,* booleanAnnotation = nullptr; for (size_t i = 0; i < float2Parameter->GetAnnotationCount(); ++i) { FCDEffectParameterAnnotation* a = float2Parameter->GetAnnotation(i); - if (a->type == FCDEffectParameter::FLOAT) { PassIf(floatAnnotation == NULL); floatAnnotation = a; } - else if (a->type == FCDEffectParameter::INTEGER) { PassIf(integerAnnotation == NULL); integerAnnotation = a; } - else if (a->type == FCDEffectParameter::STRING) { PassIf(stringAnnotation == NULL); stringAnnotation = a; } - else if (a->type == FCDEffectParameter::BOOLEAN) { PassIf(booleanAnnotation == NULL); booleanAnnotation = a; } + if (a->type == FCDEffectParameter::FLOAT) { PassIf(floatAnnotation == nullptr); floatAnnotation = a; } + else if (a->type == FCDEffectParameter::INTEGER) { PassIf(integerAnnotation == nullptr); integerAnnotation = a; } + else if (a->type == FCDEffectParameter::STRING) { PassIf(stringAnnotation == nullptr); stringAnnotation = a; } + else if (a->type == FCDEffectParameter::BOOLEAN) { PassIf(booleanAnnotation == nullptr); booleanAnnotation = a; } else Fail; } - PassIf(floatAnnotation != NULL && integerAnnotation != NULL && stringAnnotation != NULL && booleanAnnotation != NULL); + PassIf(floatAnnotation != nullptr && integerAnnotation != nullptr && stringAnnotation != nullptr && booleanAnnotation != nullptr); PassIf(*floatAnnotation->name == FC("UIMin") && IsEquivalent(FUStringConversion::ToFloat(*floatAnnotation->value), 0.2f)); PassIf(*integerAnnotation->name == FC("UIMax") && IsEquivalent(FUStringConversion::ToInt32(*integerAnnotation->value), 5)); PassIf(*stringAnnotation->name == FC("UIWidget") && IsEquivalent(*stringAnnotation->value, FS("RolloverSlider"))); @@ -311,7 +311,7 @@ namespace FCTestExportImport PassIf(IsEquivalent(surfaceParameter->GetSurfaceType(), "RANDOMIZE")); FCDFormatHint* fhint = surfaceParameter->GetFormatHint(); - FailIf(fhint == NULL); + FailIf(fhint == nullptr); PassIf(fhint->channels == FCDFormatHint::CHANNEL_RGB); PassIf(fhint->options.size() == 1 && fhint->options.front() == FCDFormatHint::OPT_NORMALIZED3); PassIf(fhint->precision == FCDFormatHint::PRECISION_MID); @@ -326,7 +326,7 @@ namespace FCTestExportImport bool FillImageLibrary(FULogFile& fileOut, FCDImageLibrary* library) { - FailIf(library == NULL || library->GetEntityCount() > 0); + FailIf(library == nullptr || library->GetEntityCount() > 0); FCDImage* image1 = library->AddEntity(); FCDImage* image2 = library->AddEntity(); FCDImage* image3 = library->AddEntity(); @@ -346,18 +346,18 @@ namespace FCTestExportImport bool CheckImageLibrary(FULogFile& fileOut, FCDImageLibrary* library) { - FailIf(library == NULL || library->GetEntityCount() != 3); + FailIf(library == nullptr || library->GetEntityCount() != 3); // Retrieve the three images, verify that they match the id/filenames that we created. - FCDImage* image1 = NULL,* image2 = NULL,* image3 = NULL; + FCDImage* image1 = nullptr,* image2 = nullptr,* image3 = nullptr; for (size_t i = 0; i < 3; ++i) { FCDImage* image = library->GetEntity(i); - if (IsEquivalent(image->GetDaeId(), wantedImageId)) { FailIf(image1 != NULL); image1 = image; } - else if (IsEquivalent(image->GetDaeId(), wantedImage2Id)) { FailIf(image2 != NULL); image2 = image; } - else { FailIf(image3 != NULL); image3 = image; } + if (IsEquivalent(image->GetDaeId(), wantedImageId)) { FailIf(image1 != nullptr); image1 = image; } + else if (IsEquivalent(image->GetDaeId(), wantedImage2Id)) { FailIf(image2 != nullptr); image2 = image; } + else { FailIf(image3 != nullptr); image3 = image; } } - PassIf(image1 != NULL && image2 != NULL && image3 != NULL); + PassIf(image1 != nullptr && image2 != nullptr && image3 != nullptr); // Verify the depth/width/height. PassIf(image1->GetWidth() == 0 && image1->GetHeight() == 0 && image1->GetDepth() == 0); @@ -365,8 +365,8 @@ namespace FCTestExportImport PassIf(image3->GetWidth() == 33 && image3->GetHeight() == 0 && image3->GetDepth() == 521); // Verify the filenames. They should be absolute filenames now, so look for the wanted substrings. - PassIf(strstr(TO_STRING(image1->GetFilename()).c_str(), "Texture1.jpg") != NULL); - PassIf(strstr(TO_STRING(image2->GetFilename()).c_str(), "Texture3D.jpg") != NULL); + PassIf(strstr(TO_STRING(image1->GetFilename()).c_str(), "Texture1.jpg") != nullptr); + PassIf(strstr(TO_STRING(image2->GetFilename()).c_str(), "Texture3D.jpg") != nullptr); return true; } } diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIPhysics.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIPhysics.cpp index 4d966ce..2190e02 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIPhysics.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIPhysics.cpp @@ -82,16 +82,16 @@ namespace FCTestExportImport bool CheckPhysicsMaterialLibrary(FULogFile& fileOut, FCDPhysicsMaterialLibrary* library) { // Find the three wanted materials - FCDPhysicsMaterial* material1 = NULL,* material2 = NULL,* material3 = NULL; + FCDPhysicsMaterial* material1 = nullptr,* material2 = nullptr,* material3 = nullptr; for (size_t i = 0; i < library->GetEntityCount(); ++i) { FCDPhysicsMaterial* m = library->GetEntity(i); - if (m->GetDaeId() == physicsMaterialId1) { FailIf(material1 != NULL); material1 = m; } - else if (m->GetDaeId() == physicsMaterialId2) { FailIf(material2 != NULL); material2 = m; } - else if (m->GetDaeId() == physicsMaterialId3) { FailIf(material3 != NULL); material3 = m; } + if (m->GetDaeId() == physicsMaterialId1) { FailIf(material1 != nullptr); material1 = m; } + else if (m->GetDaeId() == physicsMaterialId2) { FailIf(material2 != nullptr); material2 = m; } + else if (m->GetDaeId() == physicsMaterialId3) { FailIf(material3 != nullptr); material3 = m; } else { Fail; } } - PassIf(material1 != NULL && material2 != NULL && material3 != NULL); + PassIf(material1 != nullptr && material2 != nullptr && material3 != nullptr); // Verify the material informations PassIf(IsEquivalent(material1->GetStaticFriction(), 1.6f)); @@ -154,16 +154,16 @@ namespace FCTestExportImport bool CheckPhysicsModelLibrary(FULogFile& fileOut, FCDPhysicsModelLibrary* library) { // Find the three physics models - FCDPhysicsModel* model1 = NULL,* model2 = NULL,* model3 = NULL; + FCDPhysicsModel* model1 = nullptr,* model2 = nullptr,* model3 = nullptr; for (size_t i = 0; i < library->GetEntityCount(); ++i) { FCDPhysicsModel* m = library->GetEntity(i); - if (m->GetDaeId() == physicsModelId1) { FailIf(model1 != NULL); model1 = m; } - else if (m->GetDaeId() == physicsModelId2) { FailIf(model2 != NULL); model2 = m; } - else if (m->GetDaeId() == physicsModelId3) { FailIf(model3 != NULL); model3 = m; } + if (m->GetDaeId() == physicsModelId1) { FailIf(model1 != nullptr); model1 = m; } + else if (m->GetDaeId() == physicsModelId2) { FailIf(model2 != nullptr); model2 = m; } + else if (m->GetDaeId() == physicsModelId3) { FailIf(model3 != nullptr); model3 = m; } else { Fail; } } - PassIf(model1 != NULL && model2 != NULL && model3 != NULL); + PassIf(model1 != nullptr && model2 != nullptr && model3 != nullptr); // Verify the physics models information. The third model should be empty, // the second model should have two instances of the first model. @@ -186,29 +186,29 @@ namespace FCTestExportImport PassIf(model->GetInstanceCount() == 0); PassIf(model->GetRigidBodyCount() == 2); - FCDPhysicsRigidBody* body1 = NULL,* body2 = NULL; + FCDPhysicsRigidBody* body1 = nullptr,* body2 = nullptr; for (size_t i = 0; i < 2; ++i) { FCDPhysicsRigidBody* b = model->GetRigidBody(i); - if (b->GetSubId() == "GLAD") { FailIf(body1 != NULL); body1 = b; } - else if (b->GetSubId() == "DALG") { FailIf(body2 != NULL); body2 = b; } + if (b->GetSubId() == "GLAD") { FailIf(body1 != nullptr); body1 = b; } + else if (b->GetSubId() == "DALG") { FailIf(body2 != nullptr); body2 = b; } else Fail; } - PassIf(body1 != NULL && body2 != NULL); + PassIf(body1 != nullptr && body2 != nullptr); PassIf(model->FindRigidBodyFromSid("DALG") == body2); PassIf(model->FindRigidBodyFromSid("GLAD") == body1); PassIf(CheckPhysicsRigidBody(fileOut, body2)); PassIf(model->GetRigidConstraintCount() == 2); - FCDPhysicsRigidConstraint* constraint1 = NULL,* constraint2 = NULL; + FCDPhysicsRigidConstraint* constraint1 = nullptr,* constraint2 = nullptr; for (size_t i = 0; i < 2; ++i) { FCDPhysicsRigidConstraint* c = model->GetRigidConstraint(i); - if (c->GetSubId() == "Pour") { FailIf(constraint1 != NULL); constraint1 = c; } - else if (c->GetSubId() == "Contre") { FailIf(constraint2 != NULL); constraint2 = c; } + if (c->GetSubId() == "Pour") { FailIf(constraint1 != nullptr); constraint1 = c; } + else if (c->GetSubId() == "Contre") { FailIf(constraint2 != nullptr); constraint2 = c; } else Fail; } - PassIf(constraint1 != NULL && constraint2 != NULL); + PassIf(constraint1 != nullptr && constraint2 != nullptr); PassIf(CheckPhysicsRigidConstraint(fileOut, constraint2)); return true; } diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTEIVisualScene.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTEIVisualScene.cpp index 204b5ce..312de60 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTEIVisualScene.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTEIVisualScene.cpp @@ -41,24 +41,24 @@ namespace FCTestExportImport // Create two more child nodes for instances FCDSceneNode* instanceNode1 = scene->AddChildNode(); - FailIf(instanceNode1 == NULL); + FailIf(instanceNode1 == nullptr); FCDSceneNode* instanceNode2 = scene->AddChildNode(); - FailIf(instanceNode1 == NULL); + FailIf(instanceNode1 == nullptr); // The first instance is a simple geometry instance: we'll need to instantiate the material as well. - FCDGeometry* meshGeometry = NULL; + FCDGeometry* meshGeometry = nullptr; size_t geometryCount = scene->GetDocument()->GetGeometryLibrary()->GetEntityCount(); for (size_t i = 0; i < geometryCount; ++i) { FCDGeometry* g = scene->GetDocument()->GetGeometryLibrary()->GetEntity(i); - FailIf(g == NULL); + FailIf(g == nullptr); if (g->IsMesh()) { meshGeometry = g; break; } } - FailIf(meshGeometry == NULL); + FailIf(meshGeometry == nullptr); FCDGeometry* geometry = scene->GetDocument()->GetGeometryLibrary()->GetEntity(0); - FailIf(geometry == NULL); + FailIf(geometry == nullptr); FCDEntityInstance* meshInstance = instanceNode1->AddInstance(geometry); - PassIf(meshInstance != NULL); + PassIf(meshInstance != nullptr); FailIf(meshInstance->GetType() != FCDEntityInstance::GEOMETRY); FillGeometryInstance(fileOut, (FCDGeometryInstance*) meshInstance); @@ -67,7 +67,7 @@ namespace FCTestExportImport PassIf(lightCount > 0); FCDLight* light = scene->GetDocument()->GetLightLibrary()->GetEntity(lightCount / 2); FCDEntityInstance* lightInstance = instanceNode1->AddInstance(light); - PassIf(lightInstance != NULL); + PassIf(lightInstance != nullptr); FailIf(lightInstance->GetType() != FCDEntityInstance::SIMPLE); // The third instance is a camera instance. @@ -75,22 +75,22 @@ namespace FCTestExportImport PassIf(cameraCount > 0); FCDCamera* camera = scene->GetDocument()->GetCameraLibrary()->GetEntity(cameraCount - 1); FCDEntityInstance* cameraInstance = instanceNode1->AddInstance(camera); - PassIf(cameraInstance != NULL); + PassIf(cameraInstance != nullptr); FailIf(cameraInstance->GetType() != FCDEntityInstance::SIMPLE); // The fourth instance is a controller instance. size_t controllerCount = scene->GetDocument()->GetControllerLibrary()->GetEntityCount(); - FCDController* controller = NULL; + FCDController* controller = nullptr; for (size_t i = 0; i < controllerCount; ++i) { FCDController* c = scene->GetDocument()->GetControllerLibrary()->GetEntity(i); - PassIf(c != NULL); + PassIf(c != nullptr); FCDGeometry* g = c->GetBaseGeometry(); - if (g != NULL && g->IsMesh()) { controller = c; break;} + if (g != nullptr && g->IsMesh()) { controller = c; break;} } - FailIf(controller == NULL); + FailIf(controller == nullptr); FCDEntityInstance* controllerInstance = instanceNode2->AddInstance(controller); - FailIf(controllerInstance == NULL); + FailIf(controllerInstance == nullptr); PassIf(controllerInstance->HasType(FCDGeometryInstance::GetClassType())); PassIf(controllerInstance->HasType(FCDControllerInstance::GetClassType())); FillControllerInstance(fileOut, (FCDGeometryInstance*) controllerInstance); @@ -100,7 +100,7 @@ namespace FCTestExportImport PassIf(emitterCount > 0); FCDEmitter* emitter = scene->GetDocument()->GetEmitterLibrary()->GetEntity(0); FCDEntityInstance* emitterInstance = instanceNode2->AddInstance(emitter); - PassIf(emitterInstance != NULL); + PassIf(emitterInstance != nullptr); PassIf(emitterInstance->HasType(FCDEmitterInstance::GetClassType())); FillEmitterInstance(fileOut, (FCDEmitterInstance*) emitterInstance); @@ -109,7 +109,7 @@ namespace FCTestExportImport PassIf(fieldCount > 0); FCDForceField* field = scene->GetDocument()->GetForceFieldLibrary()->GetEntity(0); FCDEntityInstance* fieldInstance = instanceNode2->AddInstance(field); - PassIf(fieldInstance != NULL); + PassIf(fieldInstance != nullptr); return true; } @@ -143,19 +143,19 @@ namespace FCTestExportImport bool FillGeometryInstance(FULogFile& fileOut, FCDGeometryInstance* instance) { - FailIf(instance == NULL); + FailIf(instance == nullptr); size_t materialCount = instance->GetDocument()->GetMaterialLibrary()->GetEntityCount(); PassIf(materialCount > 0); // Retrieve the mesh associated with the controller and assign its polygons some materials. FCDEntity* e = instance->GetEntity(); - FailIf(e == NULL); + FailIf(e == nullptr); if (e->GetType() == FCDEntity::CONTROLLER) e = ((FCDController*) e)->GetBaseGeometry(); - FailIf(e == NULL || e->GetType() != FCDEntity::GEOMETRY); + FailIf(e == nullptr || e->GetType() != FCDEntity::GEOMETRY); FCDGeometry* g = (FCDGeometry*) e; - PassIf(g != NULL && g->IsMesh()); + PassIf(g != nullptr && g->IsMesh()); FCDGeometryMesh* mesh = g->GetMesh(); - PassIf(mesh != NULL); + PassIf(mesh != nullptr); for (size_t i = 0; i < mesh->GetPolygonsCount(); ++i) { @@ -177,8 +177,8 @@ namespace FCTestExportImport { // Find the child with the ordered transforms, by id. FCDSceneNode* tmChild = (FCDSceneNode*) imported->FindDaeId(transformChildId); - PassIf(tmChild != NULL); - PassIf(imported->GetParent() == NULL); + PassIf(tmChild != nullptr); + PassIf(imported->GetParent() == nullptr); PassIf(tmChild->GetParent() == imported); CheckTransforms(fileOut, tmChild); @@ -198,8 +198,8 @@ namespace FCTestExportImport for (size_t k = 0; k < instances.size(); ++k) { FCDEntityInstance* instance = instances[k]; - FailIf(instance == NULL); - FailIf(instance->GetEntity() == NULL); + FailIf(instance == nullptr); + FailIf(instance->GetEntity() == nullptr); switch (instance->GetEntity()->GetType()) { case FCDEntity::LIGHT: @@ -244,12 +244,12 @@ namespace FCTestExportImport bool CheckTransforms(FULogFile& fileOut, FCDSceneNode* child) { - PassIf(child != NULL); + PassIf(child != nullptr); PassIf(child->GetTransformCount() == 6); // The transforms MUST be in the same order as the exported order. FCDTransform* transform = child->GetTransform(0); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::ROTATION); FCDTRotation* rotation = (FCDTRotation*) transform; @@ -257,28 +257,28 @@ namespace FCTestExportImport PassIf(IsEquivalent(rotation->GetAngle(), 45.0f)); transform = child->GetTransform(1); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::TRANSLATION); FCDTTranslation* translation = (FCDTTranslation*) transform; PassIf(IsEquivalent(translation->GetTranslation(), FMVector3(0.0f, 4.0f, 6.0f))); transform = child->GetTransform(2); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::SCALE); FCDTScale* scale = (FCDTScale*) transform; PassIf(IsEquivalent(scale->GetScale(), FMVector3(3.0f, 0.5f, 2.0f))); transform = child->GetTransform(3); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::MATRIX); FCDTMatrix* mx = (FCDTMatrix*) transform; PassIf(IsEquivalent(mx->GetTransform(), FMMatrix44(sampleMatrix))); transform = child->GetTransform(4); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::LOOKAT); FCDTLookAt* lookAt = (FCDTLookAt*) transform; @@ -287,7 +287,7 @@ namespace FCTestExportImport PassIf(IsEquivalent(lookAt->GetUp(), FMVector3(12.0f, 0.3f, 0.4f))); transform = child->GetTransform(5); - FailIf(transform == NULL); + FailIf(transform == nullptr); FailIf(transform->GetParent() != child); PassIf(transform->GetType() == FCDTransform::SKEW); FCDTSkew* skew = (FCDTSkew*) transform; @@ -299,40 +299,40 @@ namespace FCTestExportImport bool CheckControllerInstance(FULogFile& fileOut, FCDGeometryInstance* instance) { - FailIf(instance == NULL); + FailIf(instance == nullptr); CheckGeometryInstance(fileOut, instance); return true; } bool CheckGeometryInstance(FULogFile& fileOut, FCDGeometryInstance* instance) { - FailIf(instance == NULL); + FailIf(instance == nullptr); // Retrieve the mesh instantiated. FCDEntity* e = instance->GetEntity(); - FailIf(e == NULL); + FailIf(e == nullptr); if (e->GetType() == FCDEntity::CONTROLLER) e = ((FCDController*) e)->GetBaseGeometry(); - FailIf(e == NULL || e->GetType() != FCDEntity::GEOMETRY); + FailIf(e == nullptr || e->GetType() != FCDEntity::GEOMETRY); FCDGeometry* g = (FCDGeometry*) e; - PassIf(g != NULL && g->IsMesh()); + PassIf(g != nullptr && g->IsMesh()); FCDGeometryMesh* mesh = g->GetMesh(); - PassIf(mesh != NULL); + PassIf(mesh != nullptr); // Verify that all the polygons have a material instantiated for them. for (size_t i = 0; i < mesh->GetPolygonsCount(); ++i) { - PassIf(mesh->GetPolygons(i) != NULL); + PassIf(mesh->GetPolygons(i) != nullptr); const fstring& semantic = mesh->GetPolygons(i)->GetMaterialSemantic(); PassIf(!semantic.empty()); FCDMaterialInstance* material = instance->FindMaterialInstance(semantic); - PassIf(material != NULL); - PassIf(material->GetMaterial() != NULL); + PassIf(material != nullptr); + PassIf(material->GetMaterial() != nullptr); } // Verify the last material instance and its bindings. FCDMaterialInstance* lastMatInstance = instance->FindMaterialInstance(FC("DUMMY")); - PassIf(lastMatInstance != NULL); - PassIf(lastMatInstance->GetMaterial() == NULL); + PassIf(lastMatInstance != nullptr); + PassIf(lastMatInstance->GetMaterial() == nullptr); PassIf(lastMatInstance->GetBindingCount() == 3); bool foundEmpty = false, foundToto = false, foundGallant = false; for (size_t i = 0; i < 3; ++i) @@ -365,14 +365,14 @@ namespace FCTestExportImport // There should be two layers: one is empty and the other will // be verified later on. - FCDLayer* emptyLayer = NULL,* fullLayer = NULL; + FCDLayer* emptyLayer = nullptr,* fullLayer = nullptr; for (size_t i = 0; i < 2; ++i) { FCDLayer* l = doc->GetLayer(i); - if (l->objects.empty()) { FailIf(emptyLayer != NULL); emptyLayer = l; } - else { FailIf(fullLayer != NULL); fullLayer = l; } + if (l->objects.empty()) { FailIf(emptyLayer != nullptr); emptyLayer = l; } + else { FailIf(fullLayer != nullptr); fullLayer = l; } } - PassIf(emptyLayer != NULL && fullLayer != NULL); + PassIf(emptyLayer != nullptr && fullLayer != nullptr); // Verify the layer names. PassIf(emptyLayer->name == "TestL1"); diff --git a/FCollada/FColladaTest/FCTestExportImport/FCTestExportImport.cpp b/FCollada/FColladaTest/FCTestExportImport/FCTestExportImport.cpp index ca3d74d..7dd3a85 100644 --- a/FCollada/FColladaTest/FCTestExportImport/FCTestExportImport.cpp +++ b/FCollada/FColladaTest/FCTestExportImport/FCTestExportImport.cpp @@ -80,7 +80,7 @@ TESTSUITE_TEST(1, Reimport) FUErrorSimpleHandler errorHandler; FCDocument* idoc = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(idoc, FC("TestOut.dae"))); - PassIf(idoc != NULL); + PassIf(idoc != nullptr); #ifdef _WIN32 OutputDebugStringA(errorHandler.GetErrorString()); @@ -105,7 +105,7 @@ TESTSUITE_TEST(1, Reimport) // Verify that the three wanted visual scene ids exist and find the one we fill in. bool found1 = false, found3 = false; - FCDSceneNode* found2 = NULL; + FCDSceneNode* found2 = nullptr; for (size_t i = 0; i < vsl->GetEntityCount(); ++i) { FCDSceneNode* inode = vsl->GetEntity(i); @@ -117,7 +117,7 @@ TESTSUITE_TEST(1, Reimport) } else if (inode->GetDaeId() == sceneNode2Id) { - FailIf(found2 != NULL); + FailIf(found2 != nullptr); PassIf(inode->GetName() == FC("Scene2")); found2 = inode; } @@ -128,7 +128,7 @@ TESTSUITE_TEST(1, Reimport) found3 = true; } } - PassIf(found2 != NULL); + PassIf(found2 != nullptr); // Compare all these re-imported library contents PassIf(CheckLayers(fileOut, idoc)); @@ -146,11 +146,11 @@ TESTSUITE_TEST(1, Reimport) // Check that the document extra data is available and intact. FCDEType* type = idoc->GetExtra()->FindType("TOTO"); - FailIf(type == NULL); + FailIf(type == nullptr); FCDETechnique* technique = type->FindTechnique("TOTO_TECHNIQUE"); - FailIf(technique == NULL); + FailIf(technique == nullptr); FCDENode* extraNode = technique->FindParameter("AParameter"); - PassIf(extraNode != NULL); + PassIf(extraNode != nullptr); PassIf(IsEquivalent(extraNode->GetContent(), FC("AValue"))); SAFE_RELEASE(idoc); @@ -226,7 +226,7 @@ TESTSUITE_TEST(2, paramImport) FCDGeometryInstance* geometryInstance = (FCDGeometryInstance*) instance; FCDEffectParameterFloat* instanceShininess = (FCDEffectParameterFloat*) FCDEffectTools::FindEffectParameterBySemantic(geometryInstance, "SHININESS"); - PassIf(instanceShininess != NULL); + PassIf(instanceShininess != nullptr); PassIf(IsEquivalent(instanceShininess->GetType(), FCDEffectParameter::FLOAT)); PassIf(instanceShininess == FCDEffectTools::FindEffectParameterByReference(geometryInstance, "myShininessAnimated")); PassIf(instanceShininess->IsAnimator()); diff --git a/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp b/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp index 66137a8..237c55d 100644 --- a/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp +++ b/FCollada/FColladaTest/FCTestGeometryPolygonsTools.cpp @@ -26,9 +26,9 @@ TESTSUITE_TEST(0, FitIndexBuffers) PassIf(errorHandler.IsSuccessful()); FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); - FailIf(geometry == NULL || !geometry->IsMesh()); + FailIf(geometry == nullptr || !geometry->IsMesh()); FCDGeometryMesh* mesh = geometry->GetMesh(); - FailIf(mesh == NULL); + FailIf(mesh == nullptr); PassIf(mesh->GetPolygonsCount() == 1); size_t originalInputCount = mesh->GetPolygons(0)->GetInputCount(); PassIf(originalInputCount > 0); @@ -60,14 +60,14 @@ TESTSUITE_TEST(1, GenerateUniqueIndices) FailIf(document->GetGeometryLibrary()->GetEntityCount() == 0); FCDGeometry* geometry = document->GetGeometryLibrary()->GetEntity(0); - FailIf(geometry == NULL || !geometry->IsMesh()); + FailIf(geometry == nullptr || !geometry->IsMesh()); FCDGeometryMesh* mesh = geometry->GetMesh(); - FailIf(mesh == NULL); + FailIf(mesh == nullptr); PassIf(mesh->GetPolygonsCount() == 1); FCDGeometryPolygons* polygons = mesh->GetPolygons(0); - FailIf(polygons == NULL); + FailIf(polygons == nullptr); PassIf(polygons->GetInputCount() == 2); uint32* vertexList = polygons->GetInput(0)->GetIndices(); @@ -89,7 +89,7 @@ TESTSUITE_TEST(1, GenerateUniqueIndices) PassIf(found); FCDGeometryIndexTranslationMap translationMap; - FCDGeometryPolygonsTools::GenerateUniqueIndices(mesh, NULL, &translationMap); + FCDGeometryPolygonsTools::GenerateUniqueIndices(mesh, nullptr, &translationMap); PassIf(polygons->GetInputCount() == 2); uint32* newVertexList = polygons->GetInput(0)->GetIndices(); diff --git a/FCollada/FColladaTest/FCTestParameters.cpp b/FCollada/FColladaTest/FCTestParameters.cpp index bd6c7de..929cc94 100644 --- a/FCollada/FColladaTest/FCTestParameters.cpp +++ b/FCollada/FColladaTest/FCTestParameters.cpp @@ -35,7 +35,7 @@ class FCTestOutsideParameter : public FCDObject , InitializeParameter(test1, 0.0f) , InitializeParameterAnimatableNoArg(test2) , InitializeParameterAnimatable(test3, FMVector3::XAxis) - , InitializeParameter(test4, NULL) + , InitializeParameter(test4, nullptr) , InitializeParameterNoArg(test5) , InitializeParameterNoArg(test6) , InitializeParameterNoArg(test7) @@ -72,22 +72,22 @@ TESTSUITE_TEST(1, Functionality) parameter->test2 = FMVector3::One; PassIf(parameter->test2 == FMVector3::One); PassIf(parameter->test2 - FMVector3::One == FMVector3::Zero); - PassIf(parameter->test2.GetAnimated() != NULL); + PassIf(parameter->test2.GetAnimated() != nullptr); PassIf(parameter->test2.GetAnimated()->GetValueCount() == 3); // Object parameters parameter->test4 = parameter->test5; PassIf(parameter->test4 == parameter->test5); - parameter->test5 = NULL; - PassIf(parameter->test5 == NULL); + parameter->test5 = nullptr; + PassIf(parameter->test5 == nullptr); parameter->test4 = new FCDObject(document); - PassIf(parameter->test4 != NULL); + PassIf(parameter->test4 != nullptr); PassIf(parameter->test4->GetTrackerCount() == 1); parameter->test5 = parameter->test4; - PassIf(parameter->test5 != NULL); + PassIf(parameter->test5 != nullptr); PassIf(parameter->test5->GetTrackerCount() == 1); - parameter->test5 = NULL; - PassIf(parameter->test4 == NULL); + parameter->test5 = nullptr; + PassIf(parameter->test4 == nullptr); // Primitive list parameter size_t count = parameter->test6.size(); @@ -108,14 +108,14 @@ TESTSUITE_TEST(1, Functionality) parameter->test7.push_back(testObject); PassIf(parameter->test7.size() == 1); parameter->test7.clear(); - PassIf(testObject != NULL); + PassIf(testObject != nullptr); PassIf(parameter->test7.size() == 0); parameter->test7.push_back(testObject); PassIf(parameter->test7.size() == 1); parameter->test7.erase(0, 1); PassIf(parameter->test7.size() == 0); testObject->Release(); - PassIf(testObject == NULL); + PassIf(testObject == nullptr); // Object container parameter testObject = new FCDObject(document); @@ -124,7 +124,7 @@ TESTSUITE_TEST(1, Functionality) parameter->test8.push_back(testObject); PassIf(parameter->test8.size() == 1); parameter->test8.clear(); - PassIf(testObject == NULL); // this is a container, so testObject should have been released! + PassIf(testObject == nullptr); // this is a container, so testObject should have been released! PassIf(parameter->test8.size() == 0); parameter->test8.push_back(new FCDObject(document)); PassIf(parameter->test8.size() == 1); @@ -148,13 +148,13 @@ TESTSUITE_TEST(2, AnimatedListParameter) FailIf(TESTP.IsAnimated()); FailIf(TESTP.IsAnimated(0)); PassIf(TESTP.GetAnimatedValues().empty()); - PassIf(TESTP.GetAnimated(2) != NULL); + PassIf(TESTP.GetAnimated(2) != nullptr); FailIf(TESTP.GetAnimatedValues().empty()); FailIf(TESTP.IsAnimated(2)); TESTP.push_front(FMVector3::XAxis); TESTP.push_front(FMVector3::YAxis); TESTP.push_front(FMVector3::ZAxis); - PassIf(TESTP.GetAnimated(2) != NULL); + PassIf(TESTP.GetAnimated(2) != nullptr); PassIf(TESTP.at(1) == FMVector3::YAxis); PassIf(TESTP.at(4) == FMVector3::YAxis); PassIf(!TESTP.IsAnimated(5)); diff --git a/FCollada/FColladaTest/FCTestXRef/FCTestXRefAcyclic.cpp b/FCollada/FColladaTest/FCTestXRef/FCTestXRefAcyclic.cpp index 446ae10..e0d540b 100644 --- a/FCollada/FColladaTest/FCTestXRef/FCTestXRefAcyclic.cpp +++ b/FCollada/FColladaTest/FCTestXRef/FCTestXRefAcyclic.cpp @@ -57,18 +57,18 @@ TESTSUITE_TEST(1, ImportOne) FCDSceneNode* node1 = firstDoc->GetVisualSceneInstance(); FCDSceneNode* node2 = secondDoc->GetVisualSceneInstance(); - FailIf(node1 == NULL || node2 == NULL || node1->GetChildrenCount() == 0 || node2->GetChildrenCount() == 0); + FailIf(node1 == nullptr || node2 == nullptr || node1->GetChildrenCount() == 0 || node2->GetChildrenCount() == 0); node1 = node1->GetChild(0); node2 = node2->GetChild(0); - FailIf(node1 == NULL || node2 == NULL); + FailIf(node1 == nullptr || node2 == nullptr); PassIf(node1->GetInstanceCount() == 1 && node2->GetInstanceCount() == 1); FCDEntityInstance* instance1 = node1->GetInstance(0); FCDEntityInstance* instance2 = node2->GetInstance(0); - PassIf(instance1 != NULL && instance2 != NULL); + PassIf(instance1 != nullptr && instance2 != nullptr); PassIf(instance1->GetEntityType() == FCDEntity::GEOMETRY && instance2->GetEntityType() == FCDEntity::GEOMETRY); FCDGeometry* mesh1 = (FCDGeometry*) instance1->GetEntity(); FCDGeometry* mesh2 = (FCDGeometry*) instance2->GetEntity(); - PassIf(mesh1 != NULL && mesh2 != NULL); + PassIf(mesh1 != nullptr && mesh2 != nullptr); PassIf(mesh1->GetDocument() == secondDoc); PassIf(mesh2->GetDocument() == firstDoc); diff --git a/FCollada/FColladaTest/FCTestXRef/FCTestXRefSimple.cpp b/FCollada/FColladaTest/FCTestXRef/FCTestXRefSimple.cpp index 45b2246..5bfdb51 100644 --- a/FCollada/FColladaTest/FCTestXRef/FCTestXRefSimple.cpp +++ b/FCollada/FColladaTest/FCTestXRef/FCTestXRefSimple.cpp @@ -40,14 +40,14 @@ TESTSUITE_TEST(1, ReimportSceneNode) PassIf(FCollada::LoadDocumentFromFile(doc1, FC("XRefDoc1.dae"))); FailIf(!errorHandler.IsSuccessful()); FCDSceneNode* visualScene = doc1->GetVisualSceneInstance(); - FailIf(visualScene == NULL || visualScene->GetChildrenCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetChildrenCount() == 0); visualScene = visualScene->GetChild(0); - FailIf(visualScene == NULL || visualScene->GetInstanceCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetInstanceCount() == 0); FCDEntityInstance* instance = visualScene->GetInstance(0); - FailIf(instance == NULL); + FailIf(instance == nullptr); PassIf(instance->GetEntityType() == FCDEntity::LIGHT); FCDLight* light = (FCDLight*) instance->GetEntity(); - FailIf(light == NULL); + FailIf(light == nullptr); PassIf(light->GetLightType() == FCDLight::AMBIENT); PassIf(IsEquivalent(light->GetColor(), FMVector3::XAxis)); SAFE_RELEASE(doc1); @@ -64,14 +64,14 @@ TESTSUITE_TEST(2, ReimportBothEasyOrder) FailIf(!errorHandler.IsSuccessful()); FCDSceneNode* visualScene = doc1->GetVisualSceneInstance(); - FailIf(visualScene == NULL || visualScene->GetChildrenCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetChildrenCount() == 0); visualScene = visualScene->GetChild(0); - FailIf(visualScene == NULL || visualScene->GetInstanceCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetInstanceCount() == 0); FCDEntityInstance* instance = visualScene->GetInstance(0); - FailIf(instance == NULL); + FailIf(instance == nullptr); PassIf(instance->GetEntityType() == FCDEntity::LIGHT); FCDLight* light = (FCDLight*) instance->GetEntity(); - FailIf(light == NULL); + FailIf(light == nullptr); PassIf(light->GetLightType() == FCDLight::AMBIENT); PassIf(IsEquivalent(light->GetColor(), FMVector3::XAxis)); SAFE_RELEASE(doc1); @@ -81,21 +81,21 @@ TESTSUITE_TEST(3, ReimportBothHardOrder) FUErrorSimpleHandler errorHandler; // Import the scene node document only, first. - // And verify that the instance is created, but NULL. + // And verify that the instance is created, but nullptr. PassIf(FCollada::GetTopDocumentCount() == 0); FCollada::SetDereferenceFlag(false); FCDocument* doc1 = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(doc1, FC("XRefDoc1.dae"))); PassIf(errorHandler.IsSuccessful()); FCDSceneNode* visualScene = doc1->GetVisualSceneInstance(); - FailIf(visualScene == NULL || visualScene->GetChildrenCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetChildrenCount() == 0); visualScene = visualScene->GetChild(0); - FailIf(visualScene == NULL || visualScene->GetInstanceCount() == 0); + FailIf(visualScene == nullptr || visualScene->GetInstanceCount() == 0); FCDEntityInstance* instance = visualScene->GetInstance(0); - FailIf(instance == NULL); + FailIf(instance == nullptr); PassIf(instance->GetEntityType() == FCDEntity::LIGHT); FCDLight* light = (FCDLight*) instance->GetEntity(); - PassIf(light == NULL); + PassIf(light == nullptr); // Now, import the second document and verify that the instance is now valid. FCDocument* doc2 = FCollada::NewTopDocument(); @@ -103,7 +103,7 @@ TESTSUITE_TEST(3, ReimportBothHardOrder) doc2->GetAsset()->SetUpAxis(FMVector3::XAxis); PassIf(errorHandler.IsSuccessful()); light = (FCDLight*) instance->GetEntity(); - FailIf(light == NULL); + FailIf(light == nullptr); PassIf(light->GetLightType() == FCDLight::AMBIENT); PassIf(IsEquivalent(light->GetColor(), FMVector3::XAxis)); SAFE_RELEASE(doc1); diff --git a/FCollada/FColladaTest/FCTestXRef/FCTestXRefTree.cpp b/FCollada/FColladaTest/FCTestXRef/FCTestXRefTree.cpp index 36f3c8c..030dcf9 100644 --- a/FCollada/FColladaTest/FCTestXRef/FCTestXRefTree.cpp +++ b/FCollada/FColladaTest/FCTestXRef/FCTestXRefTree.cpp @@ -57,20 +57,20 @@ TESTSUITE_TEST(1, ReimportTopOnly) FCDocument* topDoc = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(topDoc, FC("XRefDocTop.dae"))); FCDSceneNode* node = topDoc->GetVisualSceneInstance(); - FailIf(node == NULL || node->GetChildrenCount() == 0); + FailIf(node == nullptr || node->GetChildrenCount() == 0); node = node->GetChild(0); - FailIf(node == NULL || node->GetInstanceCount() == 0); + FailIf(node == nullptr || node->GetInstanceCount() == 0); FCDEntityInstance* instance = node->GetInstance(0); - FailIf(instance == NULL || !instance->IsExternalReference()); + FailIf(instance == nullptr || !instance->IsExternalReference()); PassIf(instance->GetEntityType() == FCDEntity::SCENE_NODE); node = (FCDSceneNode*) instance->GetEntity(); - FailIf(node == NULL); + FailIf(node == nullptr); PassIf(node->GetInstanceCount() == 1); instance = node->GetInstance(0); PassIf(instance->IsExternalReference()); PassIf(instance->GetEntityType() == FCDEntity::CAMERA); FCDCamera* camera = (FCDCamera*) instance->GetEntity(); - PassIf(camera != NULL); + PassIf(camera != nullptr); PassIf(camera->GetProjectionType() == FCDCamera::ORTHOGRAPHIC); PassIf(IsEquivalent(camera->GetMagX(), 2.0f)); @@ -86,25 +86,25 @@ TESTSUITE_TEST(2, ReimportTopAndBot) PassIf(FCollada::LoadDocumentFromFile(topDoc, FC("XRefDocTop.dae"))); FCDocument* botDoc = FCollada::NewTopDocument(); PassIf(FCollada::LoadDocumentFromFile(botDoc, FC("XRefDocBot.dae"))); - PassIf(topDoc != NULL); - PassIf(botDoc != NULL); + PassIf(topDoc != nullptr); + PassIf(botDoc != nullptr); FailIf(!errorHandler.IsSuccessful()); FCDSceneNode* node = topDoc->GetVisualSceneInstance(); - FailIf(node == NULL || node->GetChildrenCount() == 0); + FailIf(node == nullptr || node->GetChildrenCount() == 0); node = node->GetChild(0); - FailIf(node == NULL || node->GetInstanceCount() == 0); + FailIf(node == nullptr || node->GetInstanceCount() == 0); FCDEntityInstance* instance = node->GetInstance(0); - FailIf(instance == NULL || !instance->IsExternalReference()); + FailIf(instance == nullptr || !instance->IsExternalReference()); PassIf(instance->GetEntityType() == FCDEntity::SCENE_NODE); node = (FCDSceneNode*) instance->GetEntity(); - FailIf(node == NULL); + FailIf(node == nullptr); PassIf(node->GetInstanceCount() == 1); instance = node->GetInstance(0); PassIf(instance->IsExternalReference()); PassIf(instance->GetEntityType() == FCDEntity::CAMERA); FCDCamera* camera = (FCDCamera*) instance->GetEntity(); - PassIf(camera != NULL); + PassIf(camera != nullptr); PassIf(camera->GetDocument() == botDoc); PassIf(camera->GetProjectionType() == FCDCamera::ORTHOGRAPHIC); PassIf(IsEquivalent(camera->GetMagX(), 2.0f)); diff --git a/FCollada/FColladaTest/FUtils/FUEventTest.cpp b/FCollada/FColladaTest/FUtils/FUEventTest.cpp index 5f5c536..52e7743 100644 --- a/FCollada/FColladaTest/FUtils/FUEventTest.cpp +++ b/FCollada/FColladaTest/FUtils/FUEventTest.cpp @@ -85,7 +85,7 @@ class FUTAntisocialCallee FUTAntisocialCallee() { - caller = NULL; + caller = nullptr; c0 = c1 = c2 = false; } diff --git a/FCollada/FColladaTest/FUtils/FUObjectTest.cpp b/FCollada/FColladaTest/FUtils/FUObjectTest.cpp index 3b49f17..373900f 100644 --- a/FCollada/FColladaTest/FUtils/FUObjectTest.cpp +++ b/FCollada/FColladaTest/FUtils/FUObjectTest.cpp @@ -64,7 +64,7 @@ TESTSUITE_TEST(0, SimpleTracking) FUObjectContainer container; FUTObject1* obj1 = new FUTObject1(&container); FUTObject2* obj2 = new FUTObject2(&container); - PassIf(obj1 != NULL && obj2 != NULL); + PassIf(obj1 != nullptr && obj2 != nullptr); PassIf(container.contains(obj1)); PassIf(container.contains(obj2)); delete obj1; @@ -72,7 +72,7 @@ TESTSUITE_TEST(0, SimpleTracking) FailIf(container.contains(obj1)); delete obj2; PassIf(container.empty()); - obj2 = NULL; obj1 = NULL; + obj2 = nullptr; obj1 = nullptr; // Verify that non-tracked objects are acceptable FUTrackable* obj3 = new FUTrackable(); @@ -140,7 +140,7 @@ TESTSUITE_TEST(3, ContainedObjectPointer) // Delete the container and verify that the pointer got updated. delete container; PassIf(obj != smartPointer); - PassIf(smartPointer == NULL); + PassIf(smartPointer == nullptr); FailIf(smartPointer == obj); TESTSUITE_TEST(4, ObjectReference) @@ -162,19 +162,19 @@ TESTSUITE_TEST(4, ObjectReference) // get cleared properly. smartPointer1 = new FUTrackedPtr<>(testObj); *smartReference = new FUTrackable(); - PassIf(*smartPointer1 == NULL); - PassIf(*smartPointer2 == NULL); - PassIf(*smartReference != NULL); + PassIf(*smartPointer1 == nullptr); + PassIf(*smartPointer2 == nullptr); + PassIf(*smartReference != nullptr); // Verify that when the reference is deleted, the pointer do get cleared. *smartPointer1 = *smartReference; *smartPointer2 = *smartReference; - PassIf(*smartPointer1 != NULL); - PassIf(*smartPointer2 != NULL); + PassIf(*smartPointer1 != nullptr); + PassIf(*smartPointer2 != nullptr); PassIf(*smartPointer1 == *smartPointer2); SAFE_DELETE(smartReference); - PassIf(*smartPointer1 == NULL); - PassIf(*smartPointer2 == NULL); + PassIf(*smartPointer1 == nullptr); + PassIf(*smartPointer2 == nullptr); SAFE_DELETE(smartPointer1); SAFE_DELETE(smartPointer2); @@ -227,6 +227,6 @@ TESTSUITE_TEST(7, Shortcuts) PassIf(t3.HasType(FUTrackable::GetClassType())); PassIf(DynamicCast(&t3) == &t3); - PassIf(DynamicCast(&t4) == NULL); + PassIf(DynamicCast(&t4) == nullptr); TESTSUITE_END diff --git a/FCollada/FColladaTest/FUtils/FUStringBuilderTest.cpp b/FCollada/FColladaTest/FUtils/FUStringBuilderTest.cpp index 2d39ca7..81ea506 100644 --- a/FCollada/FColladaTest/FUtils/FUStringBuilderTest.cpp +++ b/FCollada/FColladaTest/FUtils/FUStringBuilderTest.cpp @@ -33,7 +33,7 @@ TESTSUITE_TEST(1, Modifications) builder.append('s'); PassIf(IsEquivalent(builder, "12 s")); builder.append(55.55); - PassIf(strstr(builder.ToCharPtr(), "12 s55.55") != NULL); + PassIf(strstr(builder.ToCharPtr(), "12 s55.55") != nullptr); builder.clear(); PassIf(IsEquivalent(builder, "")); builder.pop_back(); diff --git a/FCollada/FColladaTest/FUtils/FUStringTest.cpp b/FCollada/FColladaTest/FUtils/FUStringTest.cpp index f49affe..41091ce 100644 --- a/FCollada/FColladaTest/FUtils/FUStringTest.cpp +++ b/FCollada/FColladaTest/FUtils/FUStringTest.cpp @@ -70,7 +70,7 @@ TESTSUITE_TEST(1, StringTemplate) PassIf(a.empty()); PassIf(a == b); PassIf(a.empty()); - PassIf(IsEquivalent(a.c_str(), b)); // c_str() will ensure that the vector is NULL-terminated. + PassIf(IsEquivalent(a.c_str(), b)); // c_str() will ensure that the vector is null-terminated. PassIf(a.empty()); PassIf(a == b); diff --git a/FCollada/FColladaTest/FUtils/FUTestBed.cpp b/FCollada/FColladaTest/FUtils/FUTestBed.cpp index f8c51e1..411d29a 100644 --- a/FCollada/FColladaTest/FUtils/FUTestBed.cpp +++ b/FCollada/FColladaTest/FUtils/FUTestBed.cpp @@ -23,7 +23,7 @@ FUTestBed::FUTestBed(const fchar* _filename, bool _isVerbose) bool FUTestBed::RunTestbed(FUTestSuite* headTestSuite) { - if (headTestSuite == NULL) return false; + if (headTestSuite == nullptr) return false; testPassed = testFailed = 0; @@ -41,7 +41,7 @@ bool FUTestBed::RunTestbed(FUTestSuite* headTestSuite) void FUTestBed::RunTestSuite(FUTestSuite* testSuite) { - if (testSuite == NULL) return; + if (testSuite == nullptr) return; bool testSuiteDone = false; testSuite->RunTest(*this, fileOut, testSuiteDone, (size_t) ~0); diff --git a/FCollada/FMath/FMAllocator.h b/FCollada/FMath/FMAllocator.h index 6f06d21..fb08d19 100644 --- a/FCollada/FMath/FMAllocator.h +++ b/FCollada/FMath/FMAllocator.h @@ -25,7 +25,7 @@ namespace fm { /** An allocation function type. @param size The size, in bytes, to allocate. - @return The allocated buffer or NULL if not enough memory is available.*/ + @return The allocated buffer or nullptr if not enough memory is available.*/ typedef void* (*AllocateFunc)(size_t size); /** A deallocation function type. @@ -39,7 +39,7 @@ namespace fm /** Allocates a requested amount of memory. @param byteCount The amount of memory to allocate, in bytes. - @return A pointer to the memory address. This pointer will be NULL if there is not + @return A pointer to the memory address. This pointer will be nullptr if there is not enough memory to allocate. */ FCOLLADA_EXPORT void* Allocate(size_t byteCount); diff --git a/FCollada/FMath/FMArray.h b/FCollada/FMath/FMArray.h index 41c8859..e53b44e 100644 --- a/FCollada/FMath/FMArray.h +++ b/FCollada/FMath/FMArray.h @@ -58,11 +58,11 @@ namespace fm public: /** Default constructor. */ - vector() : reserved(0), sized(0), heapBuffer(NULL) {} + vector() : reserved(0), sized(0), heapBuffer(nullptr) {} /** Constructor. Builds a dynamically-sized array of the wanted size. @param size The wanted size of the array. */ - vector(size_t size) : reserved(0), sized(0), heapBuffer(NULL) + vector(size_t size) : reserved(0), sized(0), heapBuffer(nullptr) { resize(size); } @@ -70,14 +70,14 @@ namespace fm /** Constructor. Builds a dynamically-sized array of the wanted size. @param size The wanted size of the array @param defaultValue The default value to use for all the entries of the array. */ - vector(size_t size, const T& defaultValue) : reserved(0), sized(0), heapBuffer(NULL) + vector(size_t size, const T& defaultValue) : reserved(0), sized(0), heapBuffer(nullptr) { resize(size, defaultValue); } /** Copy constructor. @param copy The dynamically-sized array to copy the values from. */ - vector(const fm::vector& copy) : reserved(0), sized(0), heapBuffer(NULL) + vector(const fm::vector& copy) : reserved(0), sized(0), heapBuffer(nullptr) { insert(heapBuffer, copy.begin(), copy.size()); } @@ -85,7 +85,7 @@ namespace fm /** Constructor. Builds a dynamically-sized array from a constant-sized array. @param values A constant-sized array of floating-point values. @param count The size of the constant-sized array. */ - vector(const T* values, size_t count) : reserved(0), sized(0), heapBuffer(NULL) + vector(const T* values, size_t count) : reserved(0), sized(0), heapBuffer(nullptr) { insert(heapBuffer, values, count); } @@ -100,7 +100,7 @@ namespace fm heapBuffer[i].~T(); } } - if (heapBuffer != NULL) + if (heapBuffer != nullptr) { fm::Release(heapBuffer); } @@ -341,10 +341,10 @@ namespace fm } } } - else newValues = NULL; + else newValues = nullptr; // Free the old buffer. - if (heapBuffer != NULL) + if (heapBuffer != nullptr) { fm::Release(heapBuffer); } diff --git a/FCollada/FMath/FMArrayPointer.h b/FCollada/FMath/FMArrayPointer.h index 2551579..c726dec 100644 --- a/FCollada/FMath/FMArrayPointer.h +++ b/FCollada/FMath/FMArrayPointer.h @@ -52,7 +52,7 @@ namespace fm /** Constructor. Builds a dynamically-sized pointer array of the desired size. @param size The desired size of the array. */ - pvector(size_t size) : Parent(size, NULL) + pvector(size_t size) : Parent(size, nullptr) { first = (T***) (size_t) &heapBuffer; } @@ -112,13 +112,13 @@ namespace fm /** Retrieves an iterator for the first element in the pointer array. @return an iterator for the first element in the pointer array. */ - inline iterator begin() { return (!empty()) ? &front() : NULL; } - inline const_iterator begin() const { return (!empty()) ? &front() : NULL; } /**< See above. */ + inline iterator begin() { return (!empty()) ? &front() : nullptr; } + inline const_iterator begin() const { return (!empty()) ? &front() : nullptr; } /**< See above. */ /** Retrieves an iterator for the element after the last element in the pointer array. @return an iterator for the element after the last element in the pointer array. */ - inline iterator end() { return (!empty()) ? (&back()) + 1 : NULL; } - inline const_iterator end() const { return (!empty()) ? (&back()) + 1 : NULL; } /**< See above. */ + inline iterator end() { return (!empty()) ? (&back()) + 1 : nullptr; } + inline const_iterator end() const { return (!empty()) ? (&back()) + 1 : nullptr; } /**< See above. */ /** Retrieves an iterator for a given element in the pointer array. @param item An item of the pointer array. @@ -138,13 +138,13 @@ namespace fm return begin() + (newIt - Parent::begin()); } - /** Adds a given number of NULL pointers at a given position in the pointer array. + /** Adds a given number of nullptr at a given position in the pointer array. @param _iterator The iterator after which to insert the object. - @param count The number of NULL pointers to add. */ + @param count The number of nullptr to add. */ inline void insert(iterator _iterator, size_t count) { Parent::iterator it = Parent::begin() + (_iterator - begin()); - Parent::insert(it, count, NULL); + Parent::insert(it, count, nullptr); } /** Inserts a list of pointers in the pointer array. @@ -215,9 +215,9 @@ namespace fm pvector& operator= (const pvector& other) { clear(); insert(end(), other.begin(), other.end()); return *this; } /** Resizes the pointer array to the given amount. - It is intentional that the default value is NULL. + It is intentional that the default value is nullptr. @param count The desired size for the pointer array. */ - inline void resize(size_t count) { Parent::resize(count, NULL); } + inline void resize(size_t count) { Parent::resize(count, nullptr); } }; } diff --git a/FCollada/FMath/FMQuaternion.cpp b/FCollada/FMath/FMQuaternion.cpp index 75f03d2..1ae2edb 100644 --- a/FCollada/FMath/FMQuaternion.cpp +++ b/FCollada/FMath/FMQuaternion.cpp @@ -48,7 +48,7 @@ const FMQuaternion FMQuaternion::Identity = FMQuaternion(0.0f, 0.0f, 0.0f, 1.0f) FMQuaternion::FMQuaternion(const float* values) { - if (values != NULL) + if (values != nullptr) { x = (*values++); y = (*values++); @@ -59,7 +59,7 @@ FMQuaternion::FMQuaternion(const float* values) FMQuaternion::FMQuaternion(const double* values) { - if (values != NULL) + if (values != nullptr) { x = (float) (*values++); y = (float) (*values++); @@ -168,7 +168,7 @@ FMVector3 FMQuaternion::ToEuler(FMVector3* previousAngles) const } // Patch to the closest Euler angles. - if (previousAngles != NULL) + if (previousAngles != nullptr) { PatchEuler((float*) previousAngles, (float*) angles); } diff --git a/FCollada/FMath/FMQuaternion.h b/FCollada/FMath/FMQuaternion.h index 3178025..f5e4503 100644 --- a/FCollada/FMath/FMQuaternion.h +++ b/FCollada/FMath/FMQuaternion.h @@ -127,9 +127,9 @@ class FCOLLADA_EXPORT FMQuaternion @param previousAngles To support animated quaternions conversion, you need to pass in the previous quaternion's converted angles. The closest angles to the previous angles will be returned for a smooth animation. - If this parameter is NULL, one valid set of angles will be returned. + If this parameter is nullptr, one valid set of angles will be returned. @return A 3D vector containing the Euler rotation angles. */ - FMVector3 ToEuler(FMVector3* previousAngles = NULL) const; + FMVector3 ToEuler(FMVector3* previousAngles = nullptr) const; /** Converts a quaternion to a angle-axis rotation. @param axis The returned axis for the rotation. diff --git a/FCollada/FMath/FMSort.h b/FCollada/FMath/FMSort.h index 09966f5..9175dd3 100644 --- a/FCollada/FMath/FMSort.h +++ b/FCollada/FMath/FMSort.h @@ -48,7 +48,7 @@ namespace fm @param count The number of elements in the array.*/ void sort(T* data, size_t count) { - if (data == NULL) return; + if (data == nullptr) return; quicksort(data, 0, count); } diff --git a/FCollada/FMath/FMTree.h b/FCollada/FMath/FMTree.h index b55dbeb..6f95496 100644 --- a/FCollada/FMath/FMTree.h +++ b/FCollada/FMath/FMTree.h @@ -82,7 +82,7 @@ namespace fm pair data; public: - node() : left(NULL), right(NULL), parent(NULL), weight(0) {} + node() : left(nullptr), right(nullptr), parent(nullptr), weight(0) {} void rotateLeft() { @@ -94,7 +94,7 @@ namespace fm // detach right's left and attach to the parent's right. node* right_left = right->left; right = right_left; - if (right_left != NULL) right_left->parent = this; + if (right_left != nullptr) right_left->parent = this; // attach the right to the double parent. oldRight->left = this; @@ -119,7 +119,7 @@ namespace fm // detach left's right and attach to the parent's left. node* left_right = left->right; left = left_right; - if (left_right != NULL) left_right->parent = this; + if (left_right != nullptr) left_right->parent = this; // attach the parent on the left's right. oldLeft->right = this; @@ -137,17 +137,17 @@ namespace fm #ifdef TREE_DEBUG intptr_t depth() const { - intptr_t leftDepth = left != NULL ? left->depth() : 0; - intptr_t rightDepth = right != NULL ? right->depth() : 0; + intptr_t leftDepth = left != nullptr ? left->depth() : 0; + intptr_t rightDepth = right != nullptr ? right->depth() : 0; return max(leftDepth, rightDepth) + 1; } void is_correct() { - if (left != NULL) left->is_correct(); - if (right != NULL) right->is_correct(); - intptr_t leftDepth = left != NULL ? left->depth() : 0; - intptr_t rightDepth = right != NULL ? right->depth() : 0; + if (left != nullptr) left->is_correct(); + if (right != nullptr) right->is_correct(); + intptr_t leftDepth = left != nullptr ? left->depth() : 0; + intptr_t rightDepth = right != nullptr ? right->depth() : 0; FUAssert(rightDepth - leftDepth == weight,); FUAssert(abs(weight) < 2,); } @@ -194,7 +194,7 @@ namespace fm iterator& operator++() { // Go one right or one up. - if (currentNode->right == NULL) + if (currentNode->right == nullptr) { node* oldNode; do @@ -202,11 +202,11 @@ namespace fm oldNode = currentNode; // Go one up. - // We control the root node, which is the only with parent == NULL. + // We control the root node, which is the only with parent == nullptr. // if you crash here, you don't check for iterator == end() correctly. currentNode = currentNode->parent; } - while (currentNode->right == oldNode && currentNode->parent != NULL); + while (currentNode->right == oldNode && currentNode->parent != nullptr); } else { @@ -214,7 +214,7 @@ namespace fm currentNode = currentNode->right; // Go all the way left. - while (currentNode->left != NULL) currentNode = currentNode->left; + while (currentNode->left != nullptr) currentNode = currentNode->left; } return (*this); } @@ -224,7 +224,7 @@ namespace fm iterator& operator--() { // Go one left or one up. - if (currentNode->left == NULL) + if (currentNode->left == nullptr) { node* oldNode; do @@ -232,11 +232,11 @@ namespace fm oldNode = currentNode; // Go one up. - // We control the root node, which is the only with parent == NULL. + // We control the root node, which is the only with parent == nullptr. // if you crash here, you don't check for iterator == begin() correctly. currentNode = currentNode->parent; } - while (currentNode->left == oldNode && currentNode->parent != NULL); + while (currentNode->left == oldNode && currentNode->parent != nullptr); } else { @@ -244,7 +244,7 @@ namespace fm currentNode = currentNode->left; // Go all the way right. - while (currentNode->right != NULL) currentNode = currentNode->right; + while (currentNode->right != nullptr) currentNode = currentNode->right; } return (*this); } @@ -295,7 +295,7 @@ namespace fm const_iterator& operator++() { // Go one right or one up. - if (currentNode->right == NULL) + if (currentNode->right == nullptr) { const node* oldNode; do @@ -303,11 +303,11 @@ namespace fm oldNode = currentNode; // Go one up. - // We control the root node, which is the only with parent == NULL. + // We control the root node, which is the only with parent == nullptr. // if you crash here, you don't check for iterator == end() correctly. currentNode = currentNode->parent; } - while (currentNode->right == oldNode && currentNode->parent != NULL); + while (currentNode->right == oldNode && currentNode->parent != nullptr); } else { @@ -315,7 +315,7 @@ namespace fm currentNode = currentNode->right; // Go all the way left. - while (currentNode->left != NULL) currentNode = currentNode->left; + while (currentNode->left != nullptr) currentNode = currentNode->left; } return (*this); } @@ -325,7 +325,7 @@ namespace fm const_iterator& operator--() { // Go one left or one up. - if (currentNode->left == NULL) + if (currentNode->left == nullptr) { const node* oldNode; do @@ -333,11 +333,11 @@ namespace fm oldNode = currentNode; // Go one up. - // We control the root node, which is the only with parent == NULL. + // We control the root node, which is the only with parent == nullptr. // if you crash here, you don't check for iterator == end() correctly. currentNode = currentNode->parent; } - while (currentNode->left == oldNode && currentNode->parent != NULL); + while (currentNode->left == oldNode && currentNode->parent != nullptr); } else { @@ -345,7 +345,7 @@ namespace fm currentNode = currentNode->left; // Go all the way right. - while (currentNode->right != NULL) currentNode = currentNode->right; + while (currentNode->right != nullptr) currentNode = currentNode->right; } return (*this); } @@ -362,7 +362,7 @@ namespace fm public: /** Constructor. */ - tree() : root(NULL), sized(0) + tree() : root(nullptr), sized(0) { root = (node*) fm::Allocate(sizeof(node)); fm::Construct(root); @@ -375,13 +375,13 @@ namespace fm root->data.first.~KEY(); root->data.second.~DATA(); fm::Release(root); - root = NULL; + root = nullptr; } /** Retrieves the first ordered element within the tree. @return An iterator that points to the first tree element. */ - inline iterator begin() { iterator it(root); return (root->right == NULL) ? it : ++it; } - inline const_iterator begin() const { const_iterator it(root); return (root->right == NULL) ? it : ++it; } /**< See above. */ + inline iterator begin() { iterator it(root); return (root->right == nullptr) ? it : ++it; } + inline const_iterator begin() const { const_iterator it(root); return (root->right == nullptr) ? it : ++it; } /**< See above. */ /** Retrieves an iterator that points just passed the last ordered element within the tree. @@ -391,8 +391,8 @@ namespace fm /** Retrieves the last ordered element within the tree. @return An iterator that points to the last tree element. */ - inline iterator last() { node* n = root; while (n->right != NULL) n = n->right; return iterator(n); } - inline const_iterator last() const { const node* n = root; while (n->right != NULL) n = n->right; return const_iterator(n); } /**< See above. */ + inline iterator last() { node* n = root; while (n->right != nullptr) n = n->right; return iterator(n); } + inline const_iterator last() const { const node* n = root; while (n->right != nullptr) n = n->right; return const_iterator(n); } /**< See above. */ /** Retrieves an existing data element using its key. @param key The key. @@ -403,7 +403,7 @@ namespace fm iterator find(const KEY& key) { node* out = root->right; - while (out != NULL) + while (out != nullptr) { if (key < out->data.first) out = out->left; else if (key == out->data.first) return iterator(out); @@ -423,7 +423,7 @@ namespace fm { // First step: look for an already existing entry. node** insertAt = &root->right,* parent = root; - while (*insertAt != NULL) + while (*insertAt != nullptr) { parent = *insertAt; if (key < parent->data.first) insertAt = &parent->left; @@ -507,19 +507,19 @@ namespace fm if (n != root) { node* release; - if (n->left == NULL && n->right == NULL) release = n; + if (n->left == nullptr && n->right == nullptr) release = n; else { // choose whether to reduce on the left or right. - if (n->weight <= 0 && n->left != NULL) + if (n->weight <= 0 && n->left != nullptr) { // take out the left's rightmost node. release = n->left; - while (release->right != NULL) release = release->right; + while (release->right != nullptr) release = release->right; n->data = release->data; // push up any left node on the rightmost node. - if (release->left != NULL) + if (release->left != nullptr) { release->data = release->left->data; release = release->left; @@ -529,11 +529,11 @@ namespace fm { // take out the right's leftmost node. release = n->right; - while (release->left != NULL) release = release->left; + while (release->left != nullptr) release = release->left; n->data = release->data; // push up any right node on the leftmost node. - if (release->right != NULL) + if (release->right != nullptr) { release->data = release->right->data; release = release->right; @@ -543,8 +543,8 @@ namespace fm // Release the selected node and re-adjust its parent's weight. node* rebalance = release->parent; - if (rebalance->left == release) { rebalance->left = NULL; ++rebalance->weight; } - else { rebalance->right = NULL; --rebalance->weight; } + if (rebalance->left == release) { rebalance->left = nullptr; ++rebalance->weight; } + else { rebalance->right = nullptr; --rebalance->weight; } release->data.first.~KEY(); release->data.second.~DATA(); fm::Release(release); @@ -576,7 +576,7 @@ namespace fm } #ifdef TREE_DEBUG - if (root->right != NULL) root->right->is_correct(); + if (root->right != nullptr) root->right->is_correct(); #endif // TREE_DEBUG } @@ -593,27 +593,27 @@ namespace fm void clear() { // Need to delete all the nodes. - if (root->right != NULL) + if (root->right != nullptr) { node* n = root->right; while (n != root) { - if (n->left != NULL) n = n->left; - else if (n->right != NULL) n = n->right; + if (n->left != nullptr) n = n->left; + else if (n->right != nullptr) n = n->right; else { // destroy this node. node* release = n; n = n->parent; - if (n->left == release) n->left = NULL; - else if (n->right == release) n->right = NULL; + if (n->left == release) n->left = nullptr; + else if (n->right == release) n->right = nullptr; release->data.first.~KEY(); release->data.second.~DATA(); fm::Release(release); --sized; } } - root->right = NULL; + root->right = nullptr; } } @@ -629,11 +629,11 @@ namespace fm // Go one right or one up. node* currentNode = copy.root; node* cloneNode = root; - if (currentNode->right != NULL) + if (currentNode->right != nullptr) { do { - if (currentNode->right == NULL) + if (currentNode->right == nullptr) { const node* oldNode; do @@ -641,12 +641,12 @@ namespace fm oldNode = currentNode; // Go one up. - // We control the root node, which is the only with parent == NULL. + // We control the root node, which is the only with parent == nullptr. // if you crash here, you don't check for iterator == end() correctly. currentNode = currentNode->parent; cloneNode = cloneNode->parent; } - while (currentNode->right == oldNode && currentNode->parent != NULL); + while (currentNode->right == oldNode && currentNode->parent != nullptr); } else { @@ -663,7 +663,7 @@ namespace fm cloneNode = cloneNode->right; // Create and go one all the way left. - while (currentNode->left != NULL) + while (currentNode->left != nullptr) { currentNode = currentNode->left; diff --git a/FCollada/FUtils/FUAssert.cpp b/FCollada/FUtils/FUAssert.cpp index bceeb10..c314f30 100644 --- a/FCollada/FUtils/FUAssert.cpp +++ b/FCollada/FUtils/FUAssert.cpp @@ -17,7 +17,7 @@ #include -static FUAssertion::FUAssertCallback* curAssertCallback = NULL; +static FUAssertion::FUAssertCallback* curAssertCallback = nullptr; void FUAssertion::SetAssertionFailedCallback(FUAssertCallback* assertionCallback) { @@ -33,13 +33,13 @@ bool FUAssertion::OnAssertionFailed(const char* file, uint32 line) file, line); - if (curAssertCallback != NULL) + if (curAssertCallback != nullptr) return (*curAssertCallback)(message.c_str()); #ifdef _DEBUG else { # ifdef WIN32 - int32 buttonPressed = MessageBoxA(NULL, + int32 buttonPressed = MessageBoxA(nullptr, message.c_str(), "Assertion failed.", MB_ABORTRETRYIGNORE | MB_ICONWARNING); diff --git a/FCollada/FUtils/FUBoundingBox.cpp b/FCollada/FUtils/FUBoundingBox.cpp index 4813579..d928e52 100644 --- a/FCollada/FUtils/FUBoundingBox.cpp +++ b/FCollada/FUtils/FUBoundingBox.cpp @@ -72,7 +72,7 @@ bool FUBoundingBox::Overlaps(const FUBoundingBox& boundingBox, FMVector3* overla bool overlaps = minimum.x <= boundingBox.maximum.x && boundingBox.minimum.x <= maximum.x && minimum.y <= boundingBox.maximum.y && boundingBox.minimum.y <= maximum.y && minimum.z <= boundingBox.maximum.z && boundingBox.minimum.z <= maximum.z; - if (overlaps && overlapCenter != NULL) + if (overlaps && overlapCenter != nullptr) { float overlapMinX = max(minimum.x, boundingBox.minimum.x); float overlapMaxX = min(maximum.x, boundingBox.maximum.x); diff --git a/FCollada/FUtils/FUBoundingBox.h b/FCollada/FUtils/FUBoundingBox.h index 3320ebe..d8d06b7 100644 --- a/FCollada/FUtils/FUBoundingBox.h +++ b/FCollada/FUtils/FUBoundingBox.h @@ -84,14 +84,14 @@ class FCOLLADA_EXPORT FUBoundingBox @param boundingBox A bounding box. @param overlapCenter An optional pointer to retrieve the center of the overlap region. @return Whether the two bounding boxes overlap. */ - bool Overlaps(const FUBoundingBox& boundingBox, FMVector3* overlapCenter = NULL) const; + bool Overlaps(const FUBoundingBox& boundingBox, FMVector3* overlapCenter = nullptr) const; /** Retrieves whether this bounding box overlaps a given bounding sphere. @param boundingSphere A bounding sphere. @param overlapCenter An optional pointer to retrieve the center of the overlap region. For this particular case, there is no guarantee that this is the exact center of the overlap region. @return Whether this bounding box overlaps the bounding sphere. */ - bool Overlaps(const FUBoundingSphere& boundingSphere, FMVector3* overlapCenter = NULL) const; + bool Overlaps(const FUBoundingSphere& boundingSphere, FMVector3* overlapCenter = nullptr) const; /** Extends the bounding box to include the given 3D coordinate. @param point A 3D coordinate to include in the bounding box. */ diff --git a/FCollada/FUtils/FUBoundingSphere.cpp b/FCollada/FUtils/FUBoundingSphere.cpp index ce373b0..dd4e71a 100644 --- a/FCollada/FUtils/FUBoundingSphere.cpp +++ b/FCollada/FUtils/FUBoundingSphere.cpp @@ -74,7 +74,7 @@ bool FUBoundingSphere::Overlaps(const FUBoundingSphere& boundingSphere, FMVector FMVector3 centerToCenter = center - boundingSphere.center; float distanceSquared = centerToCenter.LengthSquared(); bool overlaps = distanceSquared < (radius + boundingSphere.radius) * (radius + boundingSphere.radius); - if (overlaps && overlapCenter != NULL) + if (overlaps && overlapCenter != nullptr) { float distance = sqrtf(distanceSquared); float overlapDistance = (radius + boundingSphere.radius) - distance; @@ -102,7 +102,7 @@ bool FUBoundingSphere::Overlaps(const FUBoundingBox& boundingBox, FMVector3* ove else if (center.z > boundingBox.GetMin().z) rz = 0.0f; else rz = boundingBox.GetMin().z - center.z; bool overlaps = (rx * rx + ry * ry + rz * rz) < (radius * radius); - if (overlaps && overlapCenter != NULL) + if (overlaps && overlapCenter != nullptr) { (*overlapCenter) = center + FMVector3(rx, ry, rz); } diff --git a/FCollada/FUtils/FUBoundingSphere.h b/FCollada/FUtils/FUBoundingSphere.h index 5d8c94e..eff25d5 100644 --- a/FCollada/FUtils/FUBoundingSphere.h +++ b/FCollada/FUtils/FUBoundingSphere.h @@ -80,14 +80,14 @@ class FCOLLADA_EXPORT FUBoundingSphere @param boundingSphere A bounding sphere. @param overlapCenter An optional pointer to retrieve the center of the overlap region. @return Whether the given bounding sphere overlaps with this bounding sphere. */ - bool Overlaps(const FUBoundingSphere& boundingSphere, FMVector3* overlapCenter = NULL) const; + bool Overlaps(const FUBoundingSphere& boundingSphere, FMVector3* overlapCenter = nullptr) const; /** Retrieves whether a bounding box overlaps with this bounding sphere. @param boundingBox A bounding box. @param overlapCenter An optional pointer to retrieve the center of the overlap region. For this particular case, there is no guarantee that this is the exact center of the overlap region. @return Whether the given bounding box overlaps with this bounding sphere. */ - bool Overlaps(const FUBoundingBox& boundingBox, FMVector3* overlapCenter = NULL) const; + bool Overlaps(const FUBoundingBox& boundingBox, FMVector3* overlapCenter = nullptr) const; /** Extends the bounding sphere to include the given 3D coordinate. @param point A 3D coordinate to include in the bounding sphere. */ diff --git a/FCollada/FUtils/FUDaeEnum.h b/FCollada/FUtils/FUDaeEnum.h index ce96023..8fe55ec 100644 --- a/FCollada/FUtils/FUDaeEnum.h +++ b/FCollada/FUtils/FUDaeEnum.h @@ -887,7 +887,7 @@ namespace FUDaePassState namespace FUDaeAccessor { /** Common accessor type string arrays. - These are NULL-terminated and can be used with the AddAccessor function. */ + These are null-terminated and can be used with the AddAccessor function. */ extern const char* XY[3]; /**< Use for tangents and other 2D values. */ extern const char* XYZW[5]; /**< Use for vector and position sources. */ extern const char* RGBA[5]; /**< Use for color sources. */ diff --git a/FCollada/FUtils/FUError.cpp b/FCollada/FUtils/FUError.cpp index b4c45ed..cd1f8e5 100644 --- a/FCollada/FUtils/FUError.cpp +++ b/FCollada/FUtils/FUError.cpp @@ -302,7 +302,7 @@ void FUErrorSimpleHandler::OnError(FUError::Level errorLevel, uint32 errorCode, if (errorLevel == FUError::WARNING_LEVEL) newLine.append("Warning: "); else if (errorLevel == FUError::ERROR_LEVEL) newLine.append("ERROR: "); const char* errorString = FUError::GetErrorString((FUError::Code) errorCode); - if (errorString != NULL) newLine.append(errorString); + if (errorString != nullptr) newLine.append(errorString); else { newLine.append("Unknown error code: "); diff --git a/FCollada/FUtils/FUErrorLog.cpp b/FCollada/FUtils/FUErrorLog.cpp index 45433e1..e24766f 100644 --- a/FCollada/FUtils/FUErrorLog.cpp +++ b/FCollada/FUtils/FUErrorLog.cpp @@ -16,7 +16,7 @@ // FUErrorLog::FUErrorLog(const fchar* logFilename, FUError::Level errorLevel) -: logFile(NULL), minimumLevel(errorLevel) +: logFile(nullptr), minimumLevel(errorLevel) { FUAssert(errorLevel >= 0 && errorLevel < FUError::LEVEL_COUNT, return); logFile = new FULogFile(logFilename); @@ -59,7 +59,7 @@ void FUErrorLog::OnErrorCallback(FUError::Level level, uint32 errorCode, uint32 if (level == FUError::WARNING_LEVEL) newLine.append("Warning: "); else if (level == FUError::ERROR_LEVEL) newLine.append("ERROR: "); const char* errorString = FUError::GetErrorString((FUError::Code) errorCode); - if (errorString != NULL) newLine.append(errorString); + if (errorString != nullptr) newLine.append(errorString); else { newLine.append("Unknown error code: "); diff --git a/FCollada/FUtils/FUEvent.h b/FCollada/FUtils/FUEvent.h index f5d4299..d4c9f20 100644 --- a/FCollada/FUtils/FUEvent.h +++ b/FCollada/FUtils/FUEvent.h @@ -52,7 +52,7 @@ class FUEvent /** Releases and unregisters a callback that handles the event. @param handle The handle of the function container. - This pointer will be NULL for static functions. + This pointer will be nullptr for static functions. @param function The address of the function callback to unregister. */ void ReleaseHandler(void* object) { diff --git a/FCollada/FUtils/FUFile.cpp b/FCollada/FUtils/FUFile.cpp index 38aca84..84971a0 100644 --- a/FCollada/FUtils/FUFile.cpp +++ b/FCollada/FUtils/FUFile.cpp @@ -14,27 +14,27 @@ // FUFile::FUFile(const fstring& filename, Mode mode) -: filePtr(NULL) +: filePtr(nullptr) , filepath() { Open(filename, mode); } FUFile::FUFile(const fchar* filename, Mode mode) -: filePtr(NULL) +: filePtr(nullptr) , filepath() { Open(filename, mode); } FUFile::FUFile() -: filePtr(NULL) +: filePtr(nullptr) , filepath() {} FUFile::~FUFile() { - if (filePtr != NULL) + if (filePtr != nullptr) { Close(); } @@ -42,7 +42,7 @@ FUFile::~FUFile() bool FUFile::Open(const fchar* filename, Mode mode) { - if (filePtr != NULL) return false; + if (filePtr != nullptr) return false; filepath = filename; const fchar* openMode; @@ -66,7 +66,7 @@ bool FUFile::Open(const fchar* filename, Mode mode) #else filePtr = fopen(filename, openMode); #endif // UNICODE - if (filePtr == NULL) + if (filePtr == nullptr) { #ifdef WIN32 int err; @@ -128,5 +128,5 @@ void FUFile::Close() { FUAssert(IsOpen(),); fclose(filePtr); - filePtr = NULL; + filePtr = nullptr; } diff --git a/FCollada/FUtils/FUFile.h b/FCollada/FUtils/FUFile.h index 48db8ef..8bcda3f 100644 --- a/FCollada/FUtils/FUFile.h +++ b/FCollada/FUtils/FUFile.h @@ -64,7 +64,7 @@ class FCOLLADA_EXPORT FUFile /** Retrieves whether a file is attached to this object. @return Whether a file is attached to this object. */ - bool IsOpen() { return filePtr != NULL; } + bool IsOpen() { return filePtr != nullptr; } /** Retrieves the length, in bytes, of the attached file. @return The length of the file, in bytes. */ diff --git a/FCollada/FUtils/FUFileManager.cpp b/FCollada/FUtils/FUFileManager.cpp index c41e46a..a9f136b 100644 --- a/FCollada/FUtils/FUFileManager.cpp +++ b/FCollada/FUtils/FUFileManager.cpp @@ -49,15 +49,15 @@ inline bool IsSomeFolderChar(fchar c) { return c == FOLDER_CHAR || c == UNWANTED_FOLDER_CHAR; } SchemeCallbacks::SchemeCallbacks() -: load(NULL) -, exists(NULL) -, request(NULL) +: load(nullptr) +, exists(nullptr) +, request(nullptr) {} SchemeCallbacks::SchemeCallbacks(const SchemeCallbacks& copy) -: load(NULL) -, exists(NULL) -, request(NULL) +: load(nullptr) +, exists(nullptr) +, request(nullptr) { // Do a deep copy here, not just copy pointers. if (copy.load) @@ -157,17 +157,17 @@ FUFile* FUFileManager::OpenFile(const fstring& filename, bool write, SchemeOnCom FUUri uri(absoluteFilename); // Get the callback - SchemeCallbacks* callbacks = NULL; + SchemeCallbacks* callbacks = nullptr; SchemeCallbackMap::iterator it = schemeCallbackMap.find(uri.GetScheme()); if (it != schemeCallbackMap.end()) callbacks = it->second; - if (callbacks != NULL) + if (callbacks != nullptr) { - if (onComplete == NULL) + if (onComplete == nullptr) { // No callback provided so the open is blocking - if (callbacks->load != NULL) + if (callbacks->load != nullptr) { // We have a callback for this scheme absoluteFilename = (*callbacks->load)(uri); @@ -175,12 +175,12 @@ FUFile* FUFileManager::OpenFile(const fstring& filename, bool write, SchemeOnCom } else { - if (callbacks->request != NULL) + if (callbacks->request != nullptr) { (*callbacks->request)(uri, onComplete, userData); // No file to return - return NULL; + return nullptr; } } @@ -231,11 +231,11 @@ bool FUFileManager::FileExists(const fstring& filename) FUUri uri(absoluteFilename); // Get the callback - SchemeCallbacks* callbacks = NULL; + SchemeCallbacks* callbacks = nullptr; SchemeCallbackMap::iterator it = schemeCallbackMap.find(uri.GetScheme()); if (it != schemeCallbackMap.end()) callbacks = it->second; - if (callbacks != NULL && callbacks->exists != NULL) + if (callbacks != nullptr && callbacks->exists != nullptr) { // We have a callback for this scheme return (*callbacks->exists)(uri); @@ -244,7 +244,7 @@ bool FUFileManager::FileExists(const fstring& filename) if (uri.GetScheme() == FUUri::FILE) { FUFile file(absoluteFilename, FUFile::READ); - bool exists = (file.GetHandle() != NULL); + bool exists = (file.GetHandle() != nullptr); return exists; } @@ -261,7 +261,7 @@ fstring FUFileManager::StripFileFromPath(const fstring& filename) fchar* lastSlash = fstrrchr(fullPath, FC('/')); fchar* lastBackslash = fstrrchr(fullPath, FC('\\')); lastSlash = max(lastSlash, lastBackslash); - if (lastSlash != NULL) *(lastSlash + 1) = 0; + if (lastSlash != nullptr) *(lastSlash + 1) = 0; return fstring(fullPath); } @@ -273,7 +273,7 @@ fstring FUFileManager::GetFileExtension(const fstring& _filename) filename[MAX_PATH - 1] = 0; fchar* lastPeriod = fstrrchr(filename, '.'); - if (lastPeriod == NULL) return emptyFString; + if (lastPeriod == nullptr) return emptyFString; fchar* lastSlash = fstrrchr(filename, '/'); fchar* lastBackslash = fstrrchr(filename, '\\'); @@ -375,7 +375,7 @@ fstring FUFileManager::GetApplicationFolderName() #ifdef WIN32 fchar buffer[1024]; - GetModuleFileName(NULL, buffer, 1024); + GetModuleFileName(nullptr, buffer, 1024); buffer[1023] = 0; _uri = buffer; #elif defined(__APPLE__) @@ -461,7 +461,7 @@ void FUFileManager::RemoveAllSchemeCallbacks() void FUFileManager::CloneSchemeCallbacks(const FUFileManager* srcFileManager) { - FUAssert(srcFileManager != NULL, return); + FUAssert(srcFileManager != nullptr, return); if (srcFileManager == this) return; RemoveAllSchemeCallbacks(); diff --git a/FCollada/FUtils/FUFileManager.h b/FCollada/FUtils/FUFileManager.h index a301f81..bc34523 100644 --- a/FCollada/FUtils/FUFileManager.h +++ b/FCollada/FUtils/FUFileManager.h @@ -119,7 +119,7 @@ class FCOLLADA_EXPORT FUFileManager @param write Whether to open the file for writing as opposed to opening the file for reading. @return The file handle. */ - FUFile* OpenFile(const fstring& filename, bool write=false, SchemeOnCompleteCallback* onComplete=NULL, size_t userData = 0); + FUFile* OpenFile(const fstring& filename, bool write=false, SchemeOnCompleteCallback* onComplete=nullptr, size_t userData = 0); /** Makes the directory. Currently, the directory must be one level from a directory that exists diff --git a/FCollada/FUtils/FUObject.cpp b/FCollada/FUtils/FUObject.cpp index 4a2b9e1..e371c7b 100644 --- a/FCollada/FUtils/FUObject.cpp +++ b/FCollada/FUtils/FUObject.cpp @@ -15,14 +15,14 @@ // FUObject::FUObject() -: objectOwner(NULL) +: objectOwner(nullptr) { } FUObject::~FUObject() { // If you trigger this assert, you are NOT using ->Release() properly. - FUAssert(objectOwner == NULL, Detach()); + FUAssert(objectOwner == nullptr, Detach()); } // Releases this object. This function essentially calls the destructor. @@ -34,9 +34,9 @@ void FUObject::Release() void FUObject::Detach() { - if (objectOwner != NULL) + if (objectOwner != nullptr) { objectOwner->OnOwnedObjectReleased(this); - objectOwner = NULL; + objectOwner = nullptr; } } diff --git a/FCollada/FUtils/FUObject.h b/FCollada/FUtils/FUObject.h index 8f183bc..6fca4c3 100644 --- a/FCollada/FUtils/FUObject.h +++ b/FCollada/FUtils/FUObject.h @@ -85,9 +85,9 @@ class FCOLLADA_EXPORT FUObject inline void SetObjectOwner(FUObjectOwner* owner) { // Are you attempting to transfer ownership or do multiple-containment? - // (owner == NULL) is used to avoid the notification when the container + // (owner == nullptr) is used to avoid the notification when the container // knows its about to release this object. - FUAssert(objectOwner == NULL || owner == NULL, return); + FUAssert(objectOwner == nullptr || owner == nullptr, return); objectOwner = owner; } }; @@ -113,7 +113,7 @@ class FUObjectOwner { // This assert verifies that we are, indeed, the owner. FUAssert(object->objectOwner == this, return); - object->SetObjectOwner(NULL); + object->SetObjectOwner(nullptr); } public: @@ -131,7 +131,7 @@ class FUObjectOwner @ingroup FUtils */ template -inline HigherClassType* DynamicCast(FUObject* object) { return object->HasType(HigherClassType::GetClassType()) ? (HigherClassType*) object : NULL; } +inline HigherClassType* DynamicCast(FUObject* object) { return object->HasType(HigherClassType::GetClassType()) ? (HigherClassType*) object : nullptr; } /** An object reference @@ -154,25 +154,25 @@ class FUObjectRef : public FUObjectOwner public: /** Copy constructor. - @param _ptr The object to reference. This pointer can be NULL to indicate + @param _ptr The object to reference. This pointer can be nullptr to indicate that no object should be referenced at this time. */ - FUObjectRef(ObjectClass* _ptr = NULL) + FUObjectRef(ObjectClass* _ptr = nullptr) : ptr(_ptr) { - if (_ptr != NULL) AttachObject((FUObject*) ptr); + if (_ptr != nullptr) AttachObject((FUObject*) ptr); } /** Destructor. The object referenced will be released. */ ~FUObjectRef() { - if (ptr != NULL) + if (ptr != nullptr) { DetachObject((FUObject*) ptr); ((FUObject*) ptr)->Release(); #ifdef _DEBUG - ptr = NULL; + ptr = nullptr; #endif // _DEBUG } @@ -183,30 +183,30 @@ class FUObjectRef : public FUObjectOwner @return This reference. */ FUObjectRef& operator=(ObjectClass* _ptr) { - if (ptr != NULL) ((FUObject*) ptr)->Release(); - FUAssert(ptr == NULL, return *this); + if (ptr != nullptr) ((FUObject*) ptr)->Release(); + FUAssert(ptr == nullptr, return *this); ptr = _ptr; - if (_ptr != NULL) AttachObject((FUObject*) ptr); + if (_ptr != nullptr) AttachObject((FUObject*) ptr); return *this; } /** Exchanges the reference from one object to another. If this reference already points to an object, it will be released. If the other reference points to an object, that object will - now be owned by this reference and the other reference will point to NULL. + now be owned by this reference and the other reference will point to nullptr. @param _ptr The other reference. @return This reference. */ FUObjectRef& operator=(FUObjectRef& _ptr) { operator=(_ptr.ptr); - _ptr.ptr = NULL; + _ptr.ptr = nullptr; return *this; } /** Accesses the tracked object. @return The tracked object. */ - inline ObjectClass& operator*() { FUAssert(ptr != NULL, return *ptr); return *ptr; } - inline const ObjectClass& operator*() const { FUAssert(ptr != NULL, return *ptr); return *ptr; } /**< See above. */ + inline ObjectClass& operator*() { FUAssert(ptr != nullptr, return *ptr); return *ptr; } + inline const ObjectClass& operator*() const { FUAssert(ptr != nullptr, return *ptr); return *ptr; } /**< See above. */ inline ObjectClass* operator->() { return ptr; } /**< See above. */ inline const ObjectClass* operator->() const { return ptr; } /**< See above. */ inline operator ObjectClass*() { return ptr; } /**< See above. */ @@ -219,7 +219,7 @@ class FUObjectRef : public FUObjectOwner virtual void OnOwnedObjectReleased(FUObject* object) { FUAssert((size_t) object == (size_t) ptr, return); - ptr = NULL; + ptr = nullptr; } }; diff --git a/FCollada/FUtils/FUObjectType.cpp b/FCollada/FUtils/FUObjectType.cpp index aec9c98..9cbfb0c 100644 --- a/FCollada/FUtils/FUObjectType.cpp +++ b/FCollada/FUtils/FUObjectType.cpp @@ -10,7 +10,7 @@ #include "FUObjectType.h" FUObjectType::FUObjectType(const char* _typeName) -: parent(NULL) +: parent(nullptr) { typeName = _typeName; } @@ -24,6 +24,6 @@ FUObjectType::FUObjectType(const FUObjectType& _parent, const char* _typeName) bool FUObjectType::Includes(const FUObjectType& otherType) const { if (otherType == *this) return true; - else if (parent != NULL) return parent->Includes(otherType); + else if (parent != nullptr) return parent->Includes(otherType); else return false; } diff --git a/FCollada/FUtils/FUObjectType.h b/FCollada/FUtils/FUObjectType.h index 90ac141..0aa181e 100644 --- a/FCollada/FUtils/FUObjectType.h +++ b/FCollada/FUtils/FUObjectType.h @@ -52,7 +52,7 @@ class FCOLLADA_EXPORT FUObjectType /** Retrieves the type of the down-class. @return The type of the down-class. The FUObject class will return itself as the parent, so be careful when looping down.*/ - const FUObjectType& GetParent() const { return (parent != NULL) ? *parent : *this; } + const FUObjectType& GetParent() const { return (parent != nullptr) ? *parent : *this; } /** Retrieves whether this object type includes a given object type. This function allows you to verify if this object type is diff --git a/FCollada/FUtils/FUPluginManager.cpp b/FCollada/FUtils/FUPluginManager.cpp index e9f0aee..174a659 100644 --- a/FCollada/FUtils/FUPluginManager.cpp +++ b/FCollada/FUtils/FUPluginManager.cpp @@ -62,12 +62,12 @@ void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const f pluginFolder.append(FC("Plugins/")); pluginFolderName = pluginFolder.ToString(); - if (_filter == NULL || _filter[0] == 0) _filter = FC("*.*"); + if (_filter == nullptr || _filter[0] == 0) _filter = FC("*.*"); do { const fchar* nextFilter = fstrchr(_filter, '|'); fstring filter(_filter); - if (nextFilter != NULL) + if (nextFilter != nullptr) { filter.erase(nextFilter - _filter); ++nextFilter; // skip the pipe. @@ -108,13 +108,13 @@ void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const f } library->module = LoadLibrary(library->filename.c_str()); - if (checkModule && (library->module != NULL)) + if (checkModule && (library->module != nullptr)) { // Retrieve the necessary callbacks library->getPluginCount = (GetPluginCount) GetProcAddress(library->module, "GetPluginCount"); library->getPluginType = (GetPluginType) GetProcAddress(library->module, "GetPluginType"); library->createPlugin = (CreatePlugin) GetProcAddress(library->module, "CreatePlugin"); - keep = library->createPlugin != NULL && library->getPluginType != NULL && library->getPluginCount != NULL; + keep = library->createPlugin != nullptr && library->getPluginType != nullptr && library->getPluginCount != nullptr; } // This is a valid library. @@ -131,13 +131,13 @@ void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const f if (s_filter.length() > 0 && s_filter.back() == '*') s_filter.pop_back(); DIR* directory = opendir(TO_STRING(pluginFolderName).c_str()); - if (directory == NULL) continue; + if (directory == nullptr) continue; dirent* directoryEntry; - while ((directoryEntry = readdir(directory)) != NULL) + while ((directoryEntry = readdir(directory)) != nullptr) { if (directoryEntry->d_type == DT_DIR) continue; // skip sub-folders. - if (strstr((const char*) directoryEntry->d_name, s_filter.c_str()) != NULL) + if (strstr((const char*) directoryEntry->d_name, s_filter.c_str()) != nullptr) { // We have a match. bool keep = false; @@ -146,13 +146,13 @@ void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const f fm::string libraryModuleFilename = TO_STRING(library->filename); DEBUG_OUT("Found dynamic library: %s\n", libraryModuleFilename.c_str()); library->module = dlopen(libraryModuleFilename.c_str(), RTLD_NOW); - if (library->module != NULL) + if (library->module != nullptr) { // Retrieve the necessary callbacks library->getPluginCount = (GetPluginCount) dlsym(library->module, "GetPluginCount"); library->getPluginType = (GetPluginType) dlsym(library->module, "GetPluginType"); library->createPlugin = (CreatePlugin) dlsym(library->module, "CreatePlugin"); - keep = library->createPlugin != NULL && library->getPluginType != NULL && library->getPluginCount != NULL; + keep = library->createPlugin != nullptr && library->getPluginType != nullptr && library->getPluginCount != nullptr; } // This is a valid library. @@ -163,7 +163,7 @@ void FUPluginManager::LoadPluginsInFolderName(const fstring& folderName, const f closedir(directory); #endif // WIN32 - } while (_filter != NULL); + } while (_filter != nullptr); } FUPluginManager::~FUPluginManager() @@ -175,9 +175,9 @@ FUPluginManager::~FUPluginManager() for (PluginLibraryList::iterator it = loadedLibraries.begin(); it != loadedLibraries.end(); ++it) { #if defined(WIN32) - if ((*it)->module != NULL) FreeLibrary((*it)->module); + if ((*it)->module != nullptr) FreeLibrary((*it)->module); #else - if ((*it)->module != NULL) dlclose((*it)->module); + if ((*it)->module != nullptr) dlclose((*it)->module); #endif // WIN32 } CLEAR_POINTER_VECTOR(loadedLibraries); @@ -192,7 +192,7 @@ void FUPluginManager::LoadPlugins(const FUObjectType& pluginType) #endif // _DEBUG { DEBUG_OUT("Loading plug-in: %s\n", TO_STRING((*it)->filename).c_str()); - FUAssert((*it)->createPlugin != NULL && (*it)->getPluginType != NULL && (*it)->getPluginCount != NULL, continue); + FUAssert((*it)->createPlugin != nullptr && (*it)->getPluginType != nullptr && (*it)->getPluginCount != nullptr, continue); uint32 pluginCount = (*((*it)->getPluginCount))(); for (uint32 i = 0; i < pluginCount; ++i) { @@ -202,7 +202,7 @@ void FUPluginManager::LoadPlugins(const FUObjectType& pluginType) if (type->Includes(pluginType)) { FUPlugin* plugin = (*((*it)->createPlugin))(i); - if (plugin == NULL) continue; + if (plugin == nullptr) continue; loadedPlugins.push_back(plugin); } } @@ -224,7 +224,7 @@ void FUPluginManager::AddPluginLibrary(FUPluginManager::GetPluginCount fnGetPlug library->getPluginType = fnGetPluginType; library->createPlugin = fnCreatePlugin; library->filename.clear(); - library->module = NULL; + library->module = nullptr; loadedLibraries.push_back(library); } diff --git a/FCollada/FUtils/FUPluginManager.h b/FCollada/FUtils/FUPluginManager.h index 08b9fa6..f5d6973 100644 --- a/FCollada/FUtils/FUPluginManager.h +++ b/FCollada/FUtils/FUPluginManager.h @@ -108,8 +108,8 @@ class FCOLLADA_EXPORT FUPluginManager /** Retrieves a loaded plug-in. @param index The index of the loaded plug-in. @return The plug-in at the given index. */ - inline FUPlugin* GetLoadedPlugin(size_t index) { FUAssert(index < loadedPlugins.size(), return NULL); return loadedPlugins.at(index); } - inline const FUPlugin* GetLoadedPlugin(size_t index) const { FUAssert(index < loadedPlugins.size(), return NULL); return loadedPlugins.at(index); } /**< See above. */ + inline FUPlugin* GetLoadedPlugin(size_t index) { FUAssert(index < loadedPlugins.size(), return nullptr); return loadedPlugins.at(index); } + inline const FUPlugin* GetLoadedPlugin(size_t index) const { FUAssert(index < loadedPlugins.size(), return nullptr); return loadedPlugins.at(index); } /**< See above. */ private: void LoadPluginsInFolderName(const fstring& folderName, const fchar* pluginLibraryFilter); diff --git a/FCollada/FUtils/FUSingleton.h b/FCollada/FUtils/FUSingleton.h index 2df2886..234bae2 100644 --- a/FCollada/FUtils/FUSingleton.h +++ b/FCollada/FUtils/FUSingleton.h @@ -51,11 +51,11 @@ public: \ @param _SingletonClass The class name for the singleton class. */ #define ImplementSingletonClass(_SingletonClass) \ _SingletonClass* _SingletonClass::CreateSingleton() { \ - FUAssert(singleton == NULL, return singleton); \ + FUAssert(singleton == nullptr, return singleton); \ return singleton = new _SingletonClass(); } \ void _SingletonClass::DestroySingleton() { \ - FUAssert(singleton != NULL, return); \ + FUAssert(singleton != nullptr, return); \ SAFE_DELETE(singleton); } \ - _SingletonClass* _SingletonClass::singleton = NULL + _SingletonClass* _SingletonClass::singleton = nullptr #endif // _FU_SINGLETON_H_ diff --git a/FCollada/FUtils/FUString.h b/FCollada/FUtils/FUString.h index ed0bb4a..78e3e49 100644 --- a/FCollada/FUtils/FUString.h +++ b/FCollada/FUtils/FUString.h @@ -55,20 +55,20 @@ namespace fm stringT& operator=(const stringT& c) { Parent::operator=(c); return *this; } /** Copy constructor. - @param c A NULL-terminated character buffer to clone. */ + @param c A null-terminated character buffer to clone. */ stringT(const CH* c) : Parent() { append(c); - if (c == NULL || (*c) == 0) Parent::push_back((CH) 0); + if (c == nullptr || (*c) == 0) Parent::push_back((CH) 0); } /** Copy constructor. @param c A character buffer to clone. @param length A partial length to copy. - Use stringT::npos for copying full NULL-terminated strings. */ + Use stringT::npos for copying full null-terminated strings. */ stringT(const CH* c, size_t length) : Parent() { - if (c == NULL || length == 0) return; + if (c == nullptr || length == 0) return; if (length != npos) { @@ -76,12 +76,12 @@ namespace fm if (length > str_length) length = str_length; Parent::resize(length + 1); memcpy(Parent::begin(), c, sizeof(CH) * length); - Parent::back() = 0; // NULL-terminate. + Parent::back() = 0; // null-terminate. } else { append(c); - if (c == NULL || (*c) == 0) Parent::push_back((CH) 0); + if (c == nullptr || (*c) == 0) Parent::push_back((CH) 0); } } @@ -96,23 +96,23 @@ namespace fm } /** Retrieves the length of the string. - This function is NULL-termination aware. + This function is null-termination aware. @return The length of the string. */ inline size_t length() const { return Parent::size() > 1 ? Parent::size() - 1 : 0; } inline size_t size() const { return Parent::size() > 1 ? Parent::size() - 1 : 0; } /**< See above. */ /** Retrieves the last element of the string. - This function is NULL-termination aware. + This function is null-termination aware. @return The last element of the string. */ inline CH& back() { return *(Parent::end() - 2); } inline const CH& back() const { return *(Parent::end() - 2); } /**< See above. */ /** Removes the last character from a string. - This function is NULL-termination aware. */ + This function is null-termination aware. */ inline void pop_back() { if (Parent::size() > 0) { Parent::pop_back(); Parent::back() = 0; } } /** Retrieves whether the string contains useful data. - This function differs from the parent because it checks for NULL-termination. + This function differs from the parent because it checks for null-termination. @return Whether the string contains useful data. */ inline bool empty() const { return Parent::size() <= 1; } @@ -135,8 +135,8 @@ namespace fm insert(npos, str); } - /** Appends a NULL-terminated character buffer to this string. - @param str A NULL-terminated character buffer. + /** Appends a null-terminated character buffer to this string. + @param str A null-terminated character buffer. @param count The number of characters to append. If the count is 'npos', all available characters are appended. */ inline void append(const CH* str, size_t count=npos) @@ -157,12 +157,12 @@ namespace fm /** Inserts a character buffer in this string. @param offset The position at which to insert the character buffer. - @param str A NULL-terminated character buffer. + @param str A null-terminated character buffer. @param count The number of characters to append. If the count is 'npos', all available characters are appended. */ void insert(size_t offset, const CH* str, size_t count=npos) { - if (str != NULL && (*str != 0)) + if (str != nullptr && (*str != 0)) { size_t originalSize = length(); offset = min(offset, originalSize); @@ -175,7 +175,7 @@ namespace fm memmove(Parent::begin() + offset + str_length, Parent::begin() + offset, (originalSize - offset) * sizeof(CH)); } memcpy(Parent::begin() + offset, str, sizeof(CH) * str_length); - Parent::back() = 0; // NULL-terminate + Parent::back() = 0; // null-terminate } } @@ -199,7 +199,7 @@ namespace fm } /** Retrieves the character buffer attached to this string. - @return The NULL-terminated character buffer for this string. */ + @return The null-terminated character buffer for this string. */ const CH* c_str() const { static CH empty = 0; @@ -433,7 +433,7 @@ namespace fm void resize(size_t size) { Parent::resize(size + 1); - Parent::back() = 0; // NULL-terminate + Parent::back() = 0; // null-terminate } /** Override the fm::vector resize. That call @@ -446,7 +446,7 @@ namespace fm void resize(size_t count, const CH& value) { Parent::resize(count + 1, value); - Parent::back() = 0; // NULL-terminate + Parent::back() = 0; // null-terminate } }; @@ -511,7 +511,7 @@ namespace fm @return Whether the first string differs from the second string. */ template bool operator!=(const stringT& A, const CharT* B) { - if (B == NULL) return true; + if (B == nullptr) return true; size_t B_length = 0; { const CharT* b = B; while (*b != 0) { ++b; ++B_length; } } if (A.length() != B_length) return true; const CharT* a = A.c_str(); const CharT* b = B; @@ -567,7 +567,7 @@ inline bool operator==(const fm::string& sz1, const char* sz2) { return strcmp(s inline bool IsEquivalent(const fchar* sz1, const fchar* sz2) { return (sz1 == sz2) ? true : // ptrs same, are equivalent - (sz1 == NULL || sz2 == NULL) ? // either ptr null, not equivalent + (sz1 == nullptr || sz2 == nullptr) ? // either ptr null, not equivalent false : fstrcmp(sz1, sz2) == 0; // do actual test } inline bool IsEquivalent(const fstring& sz1, const fchar* sz2) { return IsEquivalent(sz1.c_str(), sz2); } /**< See above. */ diff --git a/FCollada/FUtils/FUStringBuilder.hpp b/FCollada/FUtils/FUStringBuilder.hpp index 2a21779..271806d 100644 --- a/FCollada/FUtils/FUStringBuilder.hpp +++ b/FCollada/FUtils/FUStringBuilder.hpp @@ -20,7 +20,7 @@ #endif #ifndef SAFE_DELETE_ARRAY -#define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; } +#define SAFE_DELETE_ARRAY(ptr) if (ptr != nullptr) { delete [] ptr; ptr = nullptr; } #endif template @@ -59,7 +59,7 @@ void FloatToString(FloatType f, Char* sz) template FUStringBuilderT::FUStringBuilderT(const String& sz) { - this->buffer = NULL; + this->buffer = nullptr; this->size = 0; this->reserved = 0; @@ -70,7 +70,7 @@ FUStringBuilderT::FUStringBuilderT(const String& sz) template FUStringBuilderT::FUStringBuilderT(const Char* sz) { - this->buffer = NULL; + this->buffer = nullptr; this->size = 0; this->reserved = 0; @@ -83,7 +83,7 @@ FUStringBuilderT::FUStringBuilderT(const Char* sz) template FUStringBuilderT::FUStringBuilderT(Char ch, size_t count) { - this->buffer = NULL; + this->buffer = nullptr; this->size = 0; this->reserved = 0; @@ -94,7 +94,7 @@ FUStringBuilderT::FUStringBuilderT(Char ch, size_t count) template FUStringBuilderT::FUStringBuilderT(size_t reservation) { - this->buffer = NULL; + this->buffer = nullptr; this->size = 0; this->reserved = 0; @@ -104,7 +104,7 @@ FUStringBuilderT::FUStringBuilderT(size_t reservation) template FUStringBuilderT::FUStringBuilderT() { - this->buffer = NULL; + this->buffer = nullptr; this->size = 0; this->reserved = 0; @@ -173,7 +173,7 @@ void FUStringBuilderT::append(const String& sz) { append(sz.c_str()); } template void FUStringBuilderT::append(const Char* sz) { - if (sz == NULL) return; + if (sz == nullptr) return; // This is optimized for SMALL strings. for (; *sz != 0; ++sz) @@ -185,7 +185,7 @@ void FUStringBuilderT::append(const Char* sz) template void FUStringBuilderT::append(const Char* sz, size_t len) { - if (sz == NULL) return; + if (sz == nullptr) return; if (size + len >= reserved) { @@ -337,7 +337,7 @@ const Char* FUStringBuilderT::ToCharPtr() const template int32 FUStringBuilderT::index(Char c) const { - if (buffer != NULL && size > 0) + if (buffer != nullptr && size > 0) { const Char* end = buffer + size + 1; for (const Char* p = buffer; p != end; ++p) @@ -351,7 +351,7 @@ int32 FUStringBuilderT::index(Char c) const template int32 FUStringBuilderT::rindex(Char c) const { - if (buffer != NULL && size > 0) + if (buffer != nullptr && size > 0) { for (const Char* p = buffer + size - 1; p != buffer; --p) { diff --git a/FCollada/FUtils/FUStringConversion.cpp b/FCollada/FUtils/FUStringConversion.cpp index 0613f0e..a6cd211 100644 --- a/FCollada/FUtils/FUStringConversion.cpp +++ b/FCollada/FUtils/FUStringConversion.cpp @@ -26,7 +26,7 @@ fstring FUStringConversion::ToFString(const char* value) { FUStringBuilder builder; - if (value != NULL) + if (value != nullptr) { uint32 length = (uint32) strlen(value); builder.reserve(length + 1); @@ -49,7 +49,7 @@ fm::string FUStringConversion::ToString(const fchar* value) { FUSStringBuilder builder; - if (value != NULL) + if (value != nullptr) { uint32 length = (uint32) fstrlen(value); builder.reserve(length + 1); diff --git a/FCollada/FUtils/FUStringConversion.hpp b/FCollada/FUtils/FUStringConversion.hpp index 576bec5..a02be3e 100644 --- a/FCollada/FUtils/FUStringConversion.hpp +++ b/FCollada/FUtils/FUStringConversion.hpp @@ -21,7 +21,7 @@ template FCOLLADA_EXPORT bool FUStringConversion::ToBoolean(const CH* value) { - return value != NULL && *value != 0 && *value != '0' && *value != 'f' && *value != 'F'; + return value != nullptr && *value != 0 && *value != '0' && *value != 'f' && *value != 'F'; } // Convert a fstring to a int32 and advance the character pointer @@ -57,7 +57,7 @@ template FCOLLADA_EXPORT float FUStringConversion::ToFloat(const CH** value) { const CH* s = *value; - if (s == NULL || *s == 0) return 0.0f; + if (s == nullptr || *s == 0) return 0.0f; // Skip beginning white spaces CH c; @@ -132,7 +132,7 @@ FCOLLADA_EXPORT float FUStringConversion::ToFloat(const CH** value) template FCOLLADA_EXPORT uint32 FUStringConversion::ToUInt32(const CH** value) { - if (value == NULL || *value == NULL || **value == 0) return 0; + if (value == nullptr || *value == nullptr || **value == 0) return 0; // Skip beginning white spaces const CH* s = *value; @@ -156,7 +156,7 @@ FCOLLADA_EXPORT uint32 FUStringConversion::ToUInt32(const CH** value) template FCOLLADA_EXPORT uint32 FUStringConversion::HexToUInt32(const CH** value, uint32 count) { - if (value == NULL || *value == NULL || **value == 0) return 0; + if (value == nullptr || *value == nullptr || **value == 0) return 0; const CH* s = *value; CH c; @@ -181,7 +181,7 @@ FCOLLADA_EXPORT uint32 FUStringConversion::HexToUInt32(const CH** value, uint32 template FCOLLADA_EXPORT void FUStringConversion::ToMatrix(const CH** s, FMMatrix44& mx) { - if (s != NULL && *s != NULL && **s != 0) + if (s != nullptr && *s != nullptr && **s != 0) { // COLLADA is Column major mx[0][0] = ToFloat(s); mx[1][0] = ToFloat(s); mx[2][0] = ToFloat(s); mx[3][0] = ToFloat(s); @@ -215,7 +215,7 @@ template FCOLLADA_EXPORT FMVector2 FUStringConversion::ToVector2(const CH** value) { FMVector2 p; - if (value != NULL && *value != NULL && **value != 0) + if (value != nullptr && *value != nullptr && **value != 0) { p.x = ToFloat(value); p.y = ToFloat(value); @@ -227,7 +227,7 @@ template FCOLLADA_EXPORT FMVector3 FUStringConversion::ToVector3(const CH** value) { FMVector3 p; - if (value != NULL && *value != NULL && **value != 0) + if (value != nullptr && *value != nullptr && **value != 0) { p.x = ToFloat(value); p.y = ToFloat(value); @@ -240,14 +240,14 @@ template FCOLLADA_EXPORT FMVector4 FUStringConversion::ToVector4(const CH** value) { FMVector4 p; - if (value != NULL && *value != NULL && **value != 0) + if (value != nullptr && *value != nullptr && **value != 0) { p.x = ToFloat(value); p.y = ToFloat(value); p.z = ToFloat(value); // If the fourth component is not provided, default to 1.0f. - p.w = (*value != NULL && **value != 0) ? ToFloat(value) : 1.0f; + p.w = (*value != nullptr && **value != 0) ? ToFloat(value) : 1.0f; } return p; } @@ -284,7 +284,7 @@ template FCOLLADA_EXPORT size_t FUStringConversion::CountValues(const CH* sz) { size_t count = 0; - if (sz != NULL && *sz > 0) + if (sz != nullptr && *sz > 0) { while (*sz != 0) { @@ -330,7 +330,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToInt32List(const CH* value, Int32List& array) { size_t length = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { // Read in values within the already allocated space. size_t oldLength = array.size(); @@ -349,7 +349,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToUInt32List(const CH* value, UInt32List& array) { size_t length = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { // Read in values within the already allocated space. size_t oldLength = array.size(); @@ -368,7 +368,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToFloatList(const CH* value, FloatList& array) { size_t length = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { // Read in values within the already allocated space. size_t oldLength = array.size(); @@ -388,7 +388,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedFloatList(const CH* value, { size_t stride = arrays.size(); size_t validCount = 0; - if (value != NULL && *value != 0 && stride > 0) + if (value != nullptr && *value != 0 && stride > 0) { size_t length = arrays[0]->size(); for (size_t count = 0; count < length && *value != 0; ++count, ++validCount) @@ -396,7 +396,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedFloatList(const CH* value, for (size_t i = 0; i < stride && *value != 0; ++i) { FloatList* array = arrays[i]; - if (array != NULL) array->at(count) = ToFloat(&value); + if (array != nullptr) array->at(count) = ToFloat(&value); else ToFloat(&value); } } @@ -408,7 +408,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedFloatList(const CH* value, for (size_t i = 0; i < stride && *value != 0; ++i) { FloatList* array = arrays[i]; - if (array != NULL) array->reserve(array->size() + additional); + if (array != nullptr) array->reserve(array->size() + additional); } // Parse in the extra values. @@ -418,7 +418,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedFloatList(const CH* value, for (; i < stride && *value != 0; ++i) { FloatList* array = arrays[i]; - if (array != NULL) array->push_back(ToFloat(&value)); + if (array != nullptr) array->push_back(ToFloat(&value)); else ToFloat(&value); } if (i == stride) ++validCount; @@ -428,7 +428,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedFloatList(const CH* value, for (size_t i = 0; i < stride; ++i) { - if (arrays[i] != NULL) arrays[i]->resize(validCount); + if (arrays[i] != nullptr) arrays[i]->resize(validCount); } } @@ -437,7 +437,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedUInt32List(const CH* value { size_t stride = arrays.size(); size_t validCount = 0; - if (value != NULL && *value != 0 && stride > 0) + if (value != nullptr && *value != 0 && stride > 0) { size_t length = arrays[0]->size(); for (size_t count = 0; count < length && *value != 0; ++count, ++validCount) @@ -445,7 +445,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedUInt32List(const CH* value for (size_t i = 0; i < stride && *value != 0; ++i) { UInt32List* array = arrays[i]; - if (array != NULL) array->at(count) = ToUInt32(&value); + if (array != nullptr) array->at(count) = ToUInt32(&value); else ToUInt32(&value); } } @@ -457,7 +457,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedUInt32List(const CH* value for (size_t i = 0; i < stride && *value != 0; ++i) { UInt32List* array = arrays[i]; - if (array != NULL) array->reserve(array->size() + additional); + if (array != nullptr) array->reserve(array->size() + additional); } // Parse in the extra values. @@ -467,7 +467,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedUInt32List(const CH* value for (; i < stride && *value != 0; ++i) { UInt32List* array = arrays[i]; - if (array != NULL) array->push_back(ToUInt32(&value)); + if (array != nullptr) array->push_back(ToUInt32(&value)); else ToUInt32(&value); } if (i == stride) ++validCount; @@ -477,7 +477,7 @@ FCOLLADA_EXPORT void FUStringConversion::ToInterleavedUInt32List(const CH* value for (size_t i = 0; i < stride; ++i) { - if (arrays[i] != NULL) arrays[i]->resize(validCount); + if (arrays[i] != nullptr) arrays[i]->resize(validCount); } } @@ -486,7 +486,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToMatrixList(const CH* value, FMMatrix44List& array) { size_t count = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { size_t length = array.size(); for (; count < length && *value != 0; ++count) @@ -508,7 +508,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToVector2List(const CH* value, FMVector2List& array) { size_t count = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { size_t length = array.size(); for (; count < length && *value != 0; ++count) @@ -525,7 +525,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToVector3List(const CH* value, FMVector3List& array) { size_t count = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { size_t length = array.size(); for (; count < length && *value != 0; ++count) @@ -542,7 +542,7 @@ template FCOLLADA_EXPORT void FUStringConversion::ToVector4List(const CH* value, FMVector4List& array) { size_t count = 0; - if (value != NULL && *value != 0) + if (value != nullptr && *value != 0) { size_t length = array.size(); for (; count < length && *value != 0; ++count) diff --git a/FCollada/FUtils/FUTracker.h b/FCollada/FUtils/FUTracker.h index 4fdc8f8..6d2501f 100644 --- a/FCollada/FUtils/FUTracker.h +++ b/FCollada/FUtils/FUTracker.h @@ -87,7 +87,7 @@ class FCOLLADA_EXPORT FUTracker /** Retrieves whether an object is tracked by this tracker. @param object An object. */ - virtual bool TracksObject(const FUTrackable* object) const { return object != NULL ? object->HasTracker(this) : false; } + virtual bool TracksObject(const FUTrackable* object) const { return object != nullptr ? object->HasTracker(this) : false; } protected: /** Adds an object to be tracked. @@ -102,7 +102,7 @@ class FCOLLADA_EXPORT FUTracker /** A tracked object pointer The reverse idea of a smart pointer: if the object pointed - to by the pointer is released, the pointer will become NULL. + to by the pointer is released, the pointer will become nullptr. @ingroup FUtils */ template @@ -114,19 +114,19 @@ class FUTrackedPtr : public FUTracker public: /** Copy constructor. - @param _ptr The object to track. This pointer can be NULL to indicate + @param _ptr The object to track. This pointer can be nullptr to indicate that no object should be tracked at this time. */ - FUTrackedPtr(ObjectClass* _ptr = NULL) : ptr(_ptr) + FUTrackedPtr(ObjectClass* _ptr = nullptr) : ptr(_ptr) { - if (ptr != NULL) FUTracker::TrackObject((FUTrackable*) ptr); + if (ptr != nullptr) FUTracker::TrackObject((FUTrackable*) ptr); } /** Destructor. Stops the tracking of the pointer. */ ~FUTrackedPtr() { - if (ptr != NULL) FUTracker::UntrackObject((FUTrackable*) ptr); - ptr = NULL; + if (ptr != nullptr) FUTracker::UntrackObject((FUTrackable*) ptr); + ptr = nullptr; } /** Assigns this tracking pointer a new object to track. @@ -134,9 +134,9 @@ class FUTrackedPtr : public FUTracker @return This reference. */ FUTrackedPtr& operator=(ObjectClass* _ptr) { - if (ptr != NULL) FUTracker::UntrackObject((FUTrackable*) ptr); + if (ptr != nullptr) FUTracker::UntrackObject((FUTrackable*) ptr); ptr = _ptr; - if (ptr != NULL) FUTracker::TrackObject((FUTrackable*) ptr); + if (ptr != nullptr) FUTracker::TrackObject((FUTrackable*) ptr); return *this; } inline FUTrackedPtr& operator=(const FUTrackedPtr& _ptr) { return operator=(_ptr.ptr); } /**< See above. */ @@ -147,8 +147,8 @@ class FUTrackedPtr : public FUTracker /** Accesses the tracked object. @return The tracked object. */ - inline ObjectClass& operator*() { FUAssert(ptr != NULL, return *ptr); return *ptr; } - inline const ObjectClass& operator*() const { FUAssert(ptr != NULL, return *ptr); return *ptr; } /**< See above. */ + inline ObjectClass& operator*() { FUAssert(ptr != nullptr, return *ptr); return *ptr; } + inline const ObjectClass& operator*() const { FUAssert(ptr != nullptr, return *ptr); return *ptr; } /**< See above. */ inline ObjectClass* operator->() { return ptr; } /**< See above. */ inline const ObjectClass* operator->() const { return ptr; } /**< See above. */ inline operator ObjectClass*() { return ptr; } /**< See above. */ @@ -161,7 +161,7 @@ class FUTrackedPtr : public FUTracker virtual void OnObjectReleased(FUTrackable* object) { FUAssert(TracksObject(object), return); - ptr = NULL; + ptr = nullptr; } }; diff --git a/FCollada/FUtils/FUXmlDocument.cpp b/FCollada/FUtils/FUXmlDocument.cpp index 0d88491..f886d5f 100644 --- a/FCollada/FUtils/FUXmlDocument.cpp +++ b/FCollada/FUtils/FUXmlDocument.cpp @@ -22,12 +22,12 @@ FUXmlDocument::FUXmlDocument(FUFileManager* manager, const fchar* _filename, bool _isParsing) : isParsing(_isParsing), filename(_filename) -, xmlDocument(NULL) +, xmlDocument(nullptr) { if (isParsing) { - FUFile* file = NULL; - if (manager != NULL) file = manager->OpenFile(filename, FUFile::READ); + FUFile* file = nullptr; + if (manager != nullptr) file = manager->OpenFile(filename, FUFile::READ); else file = new FUFile(filename, FUFile::READ); if (file->IsOpen()) @@ -45,15 +45,15 @@ FUXmlDocument::FUXmlDocument(FUFileManager* manager, const fchar* _filename, boo } else { - xmlDocument = xmlNewDoc(NULL); // NULL implies version 1.0. + xmlDocument = xmlNewDoc(nullptr); // nullptr implies version 1.0. } } FUXmlDocument::FUXmlDocument(const char* data, size_t length) : isParsing(true) -, xmlDocument(NULL) +, xmlDocument(nullptr) { - FUAssert(data != NULL, return); + FUAssert(data != nullptr, return); if (length == (size_t) ~0) { @@ -77,9 +77,9 @@ FUXmlDocument::~FUXmlDocument() xmlNode* FUXmlDocument::GetRootNode() { - if (xmlDocument == NULL) + if (xmlDocument == nullptr) { - return NULL; + return nullptr; } return xmlDocGetRootElement(xmlDocument); @@ -87,10 +87,10 @@ xmlNode* FUXmlDocument::GetRootNode() xmlNode* FUXmlDocument::CreateRootNode(const char* name) { - xmlNode* rootNode = NULL; + xmlNode* rootNode = nullptr; if (!isParsing) { - if (xmlDocument == NULL) xmlDocument = xmlNewDoc(NULL); // NULL implies version 1.0. + if (xmlDocument == nullptr) xmlDocument = xmlNewDoc(nullptr); // nullptr implies version 1.0. rootNode = FUXmlWriter::CreateNode(name); xmlDocSetRootElement(xmlDocument, rootNode); } @@ -99,13 +99,13 @@ xmlNode* FUXmlDocument::CreateRootNode(const char* name) void FUXmlDocument::ReleaseXmlData() { - if (xmlDocument != NULL) + if (xmlDocument != nullptr) { if (!isParsing) { } xmlFreeDoc(xmlDocument); - xmlDocument = NULL; + xmlDocument = nullptr; } } diff --git a/FCollada/FUtils/FUXmlDocument.h b/FCollada/FUtils/FUXmlDocument.h index 9842e5d..f11ba2f 100644 --- a/FCollada/FUtils/FUXmlDocument.h +++ b/FCollada/FUtils/FUXmlDocument.h @@ -36,7 +36,7 @@ class FCOLLADA_EXPORT FUXmlDocument /** Creates an XML document from a data string. @param data The data buffer containing the XML document. @param length The length of the data. If the length is -1, - the data buffer must be NULL-terminated. */ + the data buffer must be null-terminated. */ FUXmlDocument(const char* data, size_t length = (size_t) ~0); /** Destructor. @@ -52,7 +52,7 @@ class FCOLLADA_EXPORT FUXmlDocument void ReleaseXmlData(); /** Retrieves the root XML tree node for the document. - @return The root XML tree node. This pointer will be NULL + @return The root XML tree node. This pointer will be nullptr if the document did not load successfully. */ xmlNode* GetRootNode(); diff --git a/FCollada/FUtils/FUXmlParser.cpp b/FCollada/FUtils/FUXmlParser.cpp index 2080550..6ecec59 100644 --- a/FCollada/FUtils/FUXmlParser.cpp +++ b/FCollada/FUtils/FUXmlParser.cpp @@ -70,9 +70,9 @@ namespace FUXmlParser // Returns the first child node of a given type xmlNode* FindChildByType(xmlNode* parent, const char* type) { - if (parent != NULL) + if (parent != nullptr) { - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -80,15 +80,15 @@ namespace FUXmlParser } } } - return NULL; + return nullptr; } // return the first child node of a given name xmlNode* FindChildByName(xmlNode* parent, const char* name) { - if (parent != NULL) + if (parent != nullptr) { - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -97,23 +97,23 @@ namespace FUXmlParser } } } - return NULL; + return nullptr; } // return the first child node of a given property value xmlNode* FindChildByProperty(xmlNode* parent, const char* prop, const char* val) { - if (parent != NULL) + if (parent != nullptr) { - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { fm::string str_pop = ReadNodeProperty(child, prop); if (str_pop == val) return child; } } - return NULL; + return nullptr; } // return the first node in list of a given property @@ -126,15 +126,15 @@ namespace FUXmlParser if (str_prop == prop) return element; } - return NULL; + return nullptr; } // Retrieves all the child nodes of a given type void FindChildrenByType(xmlNode* parent, const char* type, xmlNodeList& nodes) { - if (parent != NULL) + if (parent != nullptr) { - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -148,16 +148,16 @@ namespace FUXmlParser bool HasNodeProperty(xmlNode* node, const char* property) { xmlAttr* attribute = xmlHasProp(node, xmlT(property)); - return attribute != NULL; + return attribute != nullptr; } // Returns the string value of a node's property fm::string ReadNodeProperty(xmlNode* node, const char* property) { - if (node != NULL && property != NULL) + if (node != nullptr && property != nullptr) { xmlChar* data = xmlGetProp(node, xmlT(property)); - if (data != NULL) + if (data != nullptr) { // Process the string for special characters fm::string ret = XmlToString((const char*) data); @@ -173,10 +173,10 @@ namespace FUXmlParser FUCrc32::crc32 ReadNodePropertyCRC(xmlNode* node, const char* property) { FUCrc32::crc32 ret = 0; - if (node != NULL && property != NULL) + if (node != nullptr && property != nullptr) { xmlChar* data = xmlGetProp(node, xmlT(property)); - if (data != NULL) + if (data != nullptr) { ret = FUCrc32::CRC32((const char*) data); xmlFree(data); @@ -188,18 +188,18 @@ namespace FUXmlParser // Returns the text content directly attached to a node const char* ReadNodeContentDirect(xmlNode* node) { - if (node == NULL || node->children == NULL - || node->children->type != XML_TEXT_NODE || node->children->content == NULL) return emptyCharString; + if (node == nullptr || node->children == nullptr + || node->children->type != XML_TEXT_NODE || node->children->content == nullptr) return emptyCharString; return (const char*) node->children->content; } // Returns the inner text content of a node fm::string ReadNodeContentFull(xmlNode* node) { - if (node != NULL) + if (node != nullptr) { xmlChar* content = xmlNodeGetContent(node); - if (content != NULL) + if (content != nullptr) { // Process the string for special characters fm::string ret = XmlToString((const char*) content); diff --git a/FCollada/FUtils/FUXmlWriter.cpp b/FCollada/FUtils/FUXmlWriter.cpp index a8282ee..3addf8b 100644 --- a/FCollada/FUtils/FUXmlWriter.cpp +++ b/FCollada/FUtils/FUXmlWriter.cpp @@ -60,7 +60,7 @@ namespace FUXmlWriter // Create a new XML tree node xmlNode* CreateNode(const char* name) { - return xmlNewNode(NULL, xcT(name)); + return xmlNewNode(nullptr, xcT(name)); } void RenameNode(xmlNode* node, const char* newName) @@ -76,13 +76,13 @@ namespace FUXmlWriter xmlNode* AddChild(xmlNode* parent, const char* name) { - return (parent != NULL) ? xmlNewChild(parent, NULL, xcT(name), NULL) : NULL; + return (parent != nullptr) ? xmlNewChild(parent, nullptr, xcT(name), nullptr) : nullptr; } xmlNode* AddChild(xmlNode* parent, const char* name, const char* content) { xmlNode* node = AddChild(parent, name); - if (node != NULL && content != NULL && *content != 0) AddContent(node, content); + if (node != nullptr && content != nullptr && *content != 0) AddContent(node, content); return node; } @@ -90,17 +90,17 @@ namespace FUXmlWriter xmlNode* AddChild(xmlNode* parent, const char* name, const fstring& content) { fm::string s = FUStringConversion::ToString(content); - return AddChild(parent, name, !s.empty() ? s.c_str() : NULL); + return AddChild(parent, name, !s.empty() ? s.c_str() : nullptr); } #endif xmlNode* AddChildOnce(xmlNode* parent, const char* name, const char* content) { - xmlNode* node = NULL; - if (parent != NULL) + xmlNode* node = nullptr; + if (parent != nullptr) { node = FUXmlParser::FindChildByType(parent, name); - if (node == NULL) node = AddChild(parent, name, (content == NULL || *content == 0) ? NULL : content); + if (node == nullptr) node = AddChild(parent, name, (content == nullptr || *content == 0) ? nullptr : content); } return node; } @@ -121,7 +121,7 @@ namespace FUXmlWriter xmlNode* InsertChild(xmlNode* parent, xmlNode* sibling, const char* name) { xmlNode* n; - if (sibling == NULL || sibling->parent != parent) + if (sibling == nullptr || sibling->parent != parent) { n = AddChild(parent, name); } @@ -134,7 +134,7 @@ namespace FUXmlWriter void AddContent(xmlNode* node, const char* content) { - if (node != NULL) + if (node != nullptr) { // Look for non-UTF8 characters that will need to be converted to %XXXX. FUSStringBuilder xmlSBuilder; @@ -188,12 +188,12 @@ namespace FUXmlWriter void AddContentUnprocessed(xmlNode* node, const char* content) { - if (node != NULL) xmlNodeAddContent(node, xcT(content)); + if (node != nullptr) xmlNodeAddContent(node, xcT(content)); } void AddAttribute(xmlNode* node, const char* attributeName, const char* value) { - if (node != NULL) + if (node != nullptr) { xmlNewProp(node, xcT(attributeName), xcT(value)); } @@ -222,7 +222,7 @@ namespace FUXmlWriter // Walk backward from the last child, to make sure that // the chronological ordering of elements of the same type is respected. // - for (xmlNode* p = xmlGetLastChild(parent); p != NULL; p = p->prev) + for (xmlNode* p = xmlGetLastChild(parent); p != nullptr; p = p->prev) { if (p->type != XML_ELEMENT_NODE) continue; if (strcmp((const char*) p->name, (const char*) child->name) <= 0) @@ -246,7 +246,7 @@ namespace FUXmlWriter xmlNode* AddChildSorted(xmlNode* parent, const char* name, const char* content) { xmlNode* node = CreateNode(name); - if (content != NULL && *content != 0) AddContent(node, content); + if (content != nullptr && *content != 0) AddContent(node, content); AddChildSorted(parent, node); return node; } diff --git a/FCollada/FUtils/FUXmlWriter.h b/FCollada/FUtils/FUXmlWriter.h index 9662e77..43efb97 100644 --- a/FCollada/FUtils/FUXmlWriter.h +++ b/FCollada/FUtils/FUXmlWriter.h @@ -28,7 +28,7 @@ namespace FUXmlWriter { /** Creates a dangling XML tree node. @param name The name of the new XML tree node. - @return The new XML tree node. This pointer should never be NULL. */ + @return The new XML tree node. This pointer should never be nullptr. */ FCOLLADA_EXPORT xmlNode* CreateNode(const char* name); /** Appends a dangling XML tree child node to a XML tree node. @@ -109,7 +109,7 @@ namespace FUXmlWriter @param name The name of the child XML tree node. @param content The content to add to the child XML tree node, if it must be created. @return The child XML tree node. */ - FCOLLADA_EXPORT xmlNode* AddChildOnce(xmlNode* parent, const char* name, const char* content=NULL); + FCOLLADA_EXPORT xmlNode* AddChildOnce(xmlNode* parent, const char* name, const char* content=nullptr); inline xmlNode* AddChildOnce(xmlNode* parent, const char* name, const fm::string& content) { return AddChildOnce(parent, name, content.c_str()); } /**< See above. */ inline xmlNode* AddChildOnce(xmlNode* parent, const char* name, FUSStringBuilder& content) { return AddChildOnce(parent, name, content.ToCharPtr()); } /**< See above. */ @@ -183,7 +183,7 @@ namespace FUXmlWriter @param name The name of the new child XML tree node. @param content A content string to be added to the child XML tree node. @return The new child XML tree node. */ - FCOLLADA_EXPORT xmlNode* AddChildSorted(xmlNode* parent, const char* name, const char* content=NULL); + FCOLLADA_EXPORT xmlNode* AddChildSorted(xmlNode* parent, const char* name, const char* content=nullptr); /** Detaches a XML tree node from its current parent and adds it as the child of another XML tree node. diff --git a/FCollada/FUtils/FUtils.h b/FCollada/FUtils/FUtils.h index 2582c08..c0c16f6 100644 --- a/FCollada/FUtils/FUtils.h +++ b/FCollada/FUtils/FUtils.h @@ -96,10 +96,10 @@ namespace FUtils { #endif // _F_MATH_H_ // SAFE_DELETE Macro set. -#define SAFE_DELETE(ptr) if ((ptr) != NULL) { delete (ptr); (ptr) = NULL; } /**< This macro safely deletes a pointer and sets the given pointer to NULL. */ -#define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; } /**< This macro safely deletes an heap array and sets the given pointer to NULL. */ -#define SAFE_FREE(ptr) if (ptr != NULL) { free(ptr); ptr = NULL; } /**< This macro safely frees a memory block and sets the given pointer to NULL. */ -#define SAFE_RELEASE(ptr) { if ((ptr) != NULL) { (ptr)->Release(); (ptr) = NULL; } } /**< This macro safely releases an interface and sets the given pointer to NULL. */ +#define SAFE_DELETE(ptr) if ((ptr) != nullptr) { delete (ptr); (ptr) = nullptr; } /**< This macro safely deletes a pointer and sets the given pointer to nullptr. */ +#define SAFE_DELETE_ARRAY(ptr) if (ptr != nullptr) { delete [] ptr; ptr = nullptr; } /**< This macro safely deletes an heap array and sets the given pointer to nullptr. */ +#define SAFE_FREE(ptr) if (ptr != nullptr) { free(ptr); ptr = nullptr; } /**< This macro safely frees a memory block and sets the given pointer to nullptr. */ +#define SAFE_RELEASE(ptr) { if ((ptr) != nullptr) { (ptr)->Release(); (ptr) = nullptr; } } /**< This macro safely releases an interface and sets the given pointer to nullptr. */ #define CLEAR_POINTER_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE((a)[i]); (a).clear(); } /**< This macro deletes all the object pointers contained within a vector and clears it. */ #define CLEAR_ARRAY_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE_ARRAY((a)[i]); (a).clear(); } /**< This macro deletes all the object array pointers contained within a vector and clears it. */ #define CLEAR_POINTER_STD_PAIR_CONT(cont, a){ for (cont::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it).second); (a).clear(); } /**< This macro deletes all the object pointers contained within any std container and clears it. */ diff --git a/FColladaPlugins/FArchiveXML/FAXAnimationExport.cpp b/FColladaPlugins/FArchiveXML/FAXAnimationExport.cpp index 45aeabf..dbe7fde 100644 --- a/FColladaPlugins/FArchiveXML/FAXAnimationExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXAnimationExport.cpp @@ -24,12 +24,12 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo FCDAnimationChannel* animationChannel = (FCDAnimationChannel*)object; FCDAnimationChannelData& data = FArchiveXML::documentLinkDataMap[animationChannel->GetDocument()].animationChannelData[animationChannel]; - //FUAssert(!data.targetPointer.empty(), NULL); + //FUAssert(!data.targetPointer.empty(), nullptr); fm::string baseId = FCDObjectWithId::CleanId(animationChannel->GetParent()->GetDaeId() + "_" + data.targetPointer); // Check for curve merging uint32 realCurveCount = 0; - const FCDAnimationCurve* masterCurve = NULL; + const FCDAnimationCurve* masterCurve = nullptr; FCDAnimationCurveList mergingCurves; mergingCurves.resize(data.defaultValues.size()); bool mergeCurves = true; @@ -37,7 +37,7 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo for (size_t i = 0; i < curveCount; ++i) { const FCDAnimationCurve* curve = animationChannel->GetCurve(i); - if (curve != NULL) + if (curve != nullptr) { // Check that we have a default placement for this curve in the default value listing size_t dv; @@ -53,7 +53,7 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo // Check that the curves can be merged correctly. ++realCurveCount; - if (masterCurve == NULL) + if (masterCurve == nullptr) { masterCurve = curve; } @@ -97,7 +97,7 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo values.push_back((*itDV).defaultValue); } - FUAssert(data.animatedValue != NULL, return parentNode); + FUAssert(data.animatedValue != nullptr, return parentNode); const char** qualifiers = new const char*[values.size()]; memset(qualifiers, 0, sizeof(char*) * values.size()); for (size_t i = 0; i < values.size() && i < data.animatedValue->GetValueCount(); ++i) @@ -122,10 +122,10 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo for (size_t c = 0; c < curveCount; ++c) { FCDAnimationCurve* curCurve = animationChannel->GetCurve(c); - if (curCurve != NULL) + if (curCurve != nullptr) { FCDAnimationCurveData& curveData = FArchiveXML::documentLinkDataMap[curCurve->GetDocument()].animationCurveData[curCurve]; - //FUAssert(curveDataIt != FArchiveXML::animationCurveData.end(), NULL); + //FUAssert(curveDataIt != FArchiveXML::animationCurveData.end(), nullptr); // Generate a valid id for this curve curveId.set(baseId); @@ -142,11 +142,11 @@ xmlNode* FArchiveXML::WriteAnimationChannel(FCDObject* object, xmlNode* parentNo } for (size_t c = 0; c < curveCount; ++c) { - if (animationChannel->GetCurve(c) != NULL) FArchiveXML::WriteSamplerFCDAnimationCurve(animationChannel->GetCurve(c), parentNode, ids[c]); + if (animationChannel->GetCurve(c) != nullptr) FArchiveXML::WriteSamplerFCDAnimationCurve(animationChannel->GetCurve(c), parentNode, ids[c]); } for (size_t c = 0; c < curveCount; ++c) { - if (animationChannel->GetCurve(c) != NULL) FArchiveXML::WriteChannelFCDAnimationCurve(animationChannel->GetCurve(c), parentNode, ids[c], data.targetPointer.c_str()); + if (animationChannel->GetCurve(c) != nullptr) FArchiveXML::WriteChannelFCDAnimationCurve(animationChannel->GetCurve(c), parentNode, ids[c], data.targetPointer.c_str()); } } @@ -161,7 +161,7 @@ xmlNode* FArchiveXML::WriteAnimationCurve(FCDObject* UNUSED(object), xmlNode* UN // Currently not reachable // FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteAnimationMultiCurve(FCDObject* UNUSED(object), xmlNode* UNUSED(parentNode)) @@ -170,7 +170,7 @@ xmlNode* FArchiveXML::WriteAnimationMultiCurve(FCDObject* UNUSED(object), xmlNod // Currently not reachable // FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteAnimation(FCDObject* object, xmlNode* parentNode) @@ -213,7 +213,7 @@ xmlNode* FArchiveXML::WriteAnimationClip(FCDObject* object, xmlNode* parentNode) for (FCDAnimationCurveTrackList::iterator itC = animationClip->GetClipCurves().begin(); itC != animationClip->GetClipCurves().end(); ++itC) { const FCDAnimationChannel* channel = (*itC)->GetParent(); - if (channel == NULL) continue; + if (channel == nullptr) continue; const FCDAnimation* animation = channel->GetParent(); if (animations.find(animation) == animations.end()) { @@ -235,7 +235,7 @@ xmlNode* FArchiveXML::WriteAnimationClip(FCDObject* object, xmlNode* parentNode) // Writes out a value's animations, if any, to the animation library of a COLLADA XML document. bool FArchiveXML::WriteAnimatedValue(const FCDParameterAnimatable* value, xmlNode* valueNode, const char* wantedSid, int32 arrayElement) { - if (value->IsAnimated() && valueNode != NULL) + if (value->IsAnimated() && valueNode != nullptr) { // Find the value's animations FCDAnimated* animated = const_cast(value->GetAnimated()); @@ -283,7 +283,7 @@ void FArchiveXML::WriteAnimatedValue(const FCDAnimated* _animated, xmlNode* valu FCDAnimationChannel* channel = (*itC)->GetParent(); FCDAnimationChannelData& channelData = FArchiveXML::documentLinkDataMap[channel->GetDocument()].animationChannelData[channel]; - FUAssert(channel != NULL, continue); + FUAssert(channel != nullptr, continue); channelData.targetPointer = animatedData.pointer; channelData.animatedValue = animated; @@ -303,8 +303,8 @@ void FArchiveXML::WriteAnimatedValue(const FCDAnimated* _animated, xmlNode* valu FCDAnimationCurveTrackList& curves = animated->GetCurves()[i]; // Find the curve, if any, that comes from this channel. - FCDAnimationCurve* curve = NULL; - for (size_t j = 0; j < curves.size() && curve == NULL; ++j) + FCDAnimationCurve* curve = nullptr; + for (size_t j = 0; j < curves.size() && curve == nullptr; ++j) { if (curves[j]->GetParent() == channel) { diff --git a/FColladaPlugins/FArchiveXML/FAXAnimationImport.cpp b/FColladaPlugins/FArchiveXML/FAXAnimationImport.cpp index 4cd4f3a..05f1e7b 100644 --- a/FColladaPlugins/FArchiveXML/FAXAnimationImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXAnimationImport.cpp @@ -49,14 +49,14 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) xmlNode* samplerNode = FArchiveXML::FindChildByIdFCDAnimation(animationChannel->GetParent(), samplerId); - if (samplerNode == NULL || !IsEquivalent(samplerNode->name, DAE_SAMPLER_ELEMENT)) + if (samplerNode == nullptr || !IsEquivalent(samplerNode->name, DAE_SAMPLER_ELEMENT)) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_ELEMENT, channelNode->line); return false; } // Find and process the sources - xmlNode* inputSource = NULL, * outputSource = NULL, * inTangentSource = NULL, * outTangentSource = NULL, * tcbSource = NULL, * easeSource = NULL, * interpolationSource = NULL; + xmlNode* inputSource = nullptr, * outputSource = nullptr, * inTangentSource = nullptr, * outTangentSource = nullptr, * tcbSource = nullptr, * easeSource = nullptr, * interpolationSource = nullptr; xmlNodeList samplerInputNodes; fm::string inputDriver; FindChildrenByType(samplerNode, DAE_INPUT_ELEMENT, samplerInputNodes); @@ -76,7 +76,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) else if (sourceSemantic == DAE_INTERPOLATION_ANIMATION_INPUT) interpolationSource = sourceNode; else if (sourceSemantic == DAEMAYA_DRIVER_INPUT) inputDriver = sourceId; } - if (inputSource == NULL || outputSource == NULL) + if (inputSource == nullptr || outputSource == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_INPUT, samplerNode->line); return false; @@ -151,7 +151,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) tempFloatArrays.clear(); // Read in the interleaved in_tangent source. - if (inTangentSource != NULL) + if (inTangentSource != nullptr) { fm::vector tempVector2Arrays; tempVector2Arrays.resize(curveCount); @@ -199,7 +199,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) } // Read in the interleaved out_tangent source. - if (outTangentSource != NULL) + if (outTangentSource != nullptr) { fm::vector tempVector2Arrays; tempVector2Arrays.resize(curveCount); @@ -246,7 +246,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) } } - if (tcbSource != NULL) + if (tcbSource != nullptr) { //Process TCB parameters fm::vector tempVector3Arrays; @@ -274,7 +274,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) } } - if (easeSource != NULL) + if (easeSource != nullptr) { //Process Ease-in and ease-out data fm::vector tempVector2Arrays; @@ -345,7 +345,7 @@ bool FArchiveXML::LoadAnimationChannel(FCDObject* object, xmlNode* channelNode) if (!inputDriver.empty()) { const char* driverTarget = FUDaeParser::SkipPound(inputDriver); - if (driverTarget != NULL) + if (driverTarget != nullptr) { fm::string driverQualifierValue; FUStringConversion::SplitTarget(driverTarget, data.driverPointer, driverQualifierValue); @@ -371,7 +371,7 @@ xmlNode* FArchiveXML::FindChildByIdFCDAnimation(FCDAnimation* animation, const f if (it->second == id) return it->first; } - return (animation->GetParent() != NULL) ? FArchiveXML::FindChildByIdFCDAnimation(animation->GetParent(), _id) : NULL; + return (animation->GetParent() != nullptr) ? FArchiveXML::FindChildByIdFCDAnimation(animation->GetParent(), _id) : nullptr; } bool FArchiveXML::LoadAnimationCurve(FCDObject* UNUSED(object), xmlNode* UNUSED(node)) @@ -479,14 +479,14 @@ bool FArchiveXML::LoadAnimationClip(FCDObject* object, xmlNode* clipNode) void FArchiveXML::LoadAnimatable(FCDParameterAnimatable* animatable, xmlNode* node) { - if (animatable == NULL || node == NULL) return; + if (animatable == nullptr || node == nullptr) return; FCDAnimated* animated = animatable->GetAnimated(); if (!FArchiveXML::LinkAnimated(animated, node)) SAFE_RELEASE(animated); } void FArchiveXML::LoadAnimatable(FCDocument* document, FCDParameterListAnimatable* animatable, xmlNode* node) { - if (animatable == NULL || node == NULL) return; + if (animatable == nullptr || node == nullptr) return; // Look for an animation on this list object Int32List animatedIndices; diff --git a/FColladaPlugins/FArchiveXML/FAXCameraExport.cpp b/FColladaPlugins/FArchiveXML/FAXCameraExport.cpp index f15be42..c027420 100644 --- a/FColladaPlugins/FArchiveXML/FAXCameraExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXCameraExport.cpp @@ -66,11 +66,11 @@ xmlNode* FArchiveXML::WriteCamera(FCDObject* object, xmlNode* parentNode) // Add the application-specific technique/parameters FCDENodeList extraParameterNodes; - FUTrackedPtr techniqueNode = NULL; + FUTrackedPtr techniqueNode = nullptr; // Export the elements and release the temporarily-added parameters/technique FArchiveXML::WriteTargetedEntityExtra(camera, cameraNode); CLEAR_POINTER_VECTOR(extraParameterNodes); - if (techniqueNode != NULL && techniqueNode->GetChildNodeCount() == 0) SAFE_RELEASE(techniqueNode); + if (techniqueNode != nullptr && techniqueNode->GetChildNodeCount() == 0) SAFE_RELEASE(techniqueNode); return cameraNode; } diff --git a/FColladaPlugins/FArchiveXML/FAXCameraImport.cpp b/FColladaPlugins/FArchiveXML/FAXCameraImport.cpp index 1164a4a..e88ee15 100644 --- a/FColladaPlugins/FArchiveXML/FAXCameraImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXCameraImport.cpp @@ -29,26 +29,26 @@ bool FArchiveXML::LoadCamera(FCDObject* object, xmlNode* cameraNode) // COLLADA 1.4: Grab the element's techniques xmlNode* opticsNode = FindChildByType(cameraNode, DAE_OPTICS_ELEMENT); xmlNode* commonTechniqueNode = FindChildByType(opticsNode, DAE_TECHNIQUE_COMMON_ELEMENT); - if (opticsNode != NULL) FArchiveXML::LoadExtra(extra, opticsNode); // backward compatibility-only, the extra information has been moved into the element. + if (opticsNode != nullptr) FArchiveXML::LoadExtra(extra, opticsNode); // backward compatibility-only, the extra information has been moved into the element. // Retrieve the or element - xmlNode* cameraContainerNode = NULL; + xmlNode* cameraContainerNode = nullptr; xmlNode* cameraOthNode = FindChildByType(commonTechniqueNode, DAE_CAMERA_ORTHO_ELEMENT); xmlNode* cameraPersNode = FindChildByType(commonTechniqueNode, DAE_CAMERA_PERSP_ELEMENT); - if (cameraOthNode != NULL) camera->SetProjectionType(FCDCamera::ORTHOGRAPHIC); - if (cameraPersNode != NULL) camera->SetProjectionType(FCDCamera::PERSPECTIVE); + if (cameraOthNode != nullptr) camera->SetProjectionType(FCDCamera::ORTHOGRAPHIC); + if (cameraPersNode != nullptr) camera->SetProjectionType(FCDCamera::PERSPECTIVE); - cameraContainerNode = (cameraOthNode == NULL) ? cameraPersNode : cameraOthNode; + cameraContainerNode = (cameraOthNode == nullptr) ? cameraPersNode : cameraOthNode; // Check the necessary camera structures - if ((cameraOthNode != NULL) && (cameraPersNode != NULL)) + if ((cameraOthNode != nullptr) && (cameraPersNode != nullptr)) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_UNKNOWN_CAM_PROG_TYPE, cameraContainerNode->line); return status; } - if (cameraContainerNode == NULL) + if (cameraContainerNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_PARAM_ROOT_MISSING, cameraNode->line); return status; diff --git a/FColladaPlugins/FArchiveXML/FAXColladaParser.cpp b/FColladaPlugins/FArchiveXML/FAXColladaParser.cpp index ac45698..0271289 100644 --- a/FColladaPlugins/FArchiveXML/FAXColladaParser.cpp +++ b/FColladaPlugins/FArchiveXML/FAXColladaParser.cpp @@ -22,11 +22,11 @@ namespace FUDaeParser // Returns the first child node with a given id xmlNode* FindChildById(xmlNode* parent, const fm::string& id) { - if (parent != NULL && !id.empty()) + if (parent != nullptr && !id.empty()) { const char* localId = id.c_str(); if (localId[0] == '#') ++localId; - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -35,7 +35,7 @@ namespace FUDaeParser } } } - return NULL; + return nullptr; } // Returns the first child node of a given "ref" property @@ -47,8 +47,8 @@ namespace FUDaeParser // Returns the first child with the given 'sid' value within a given XML hierarchy xmlNode* FindHierarchyChildById(xmlNode* hierarchyRoot, const char* id) { - xmlNode* found = NULL; - for (xmlNode* child = hierarchyRoot->children; child != NULL && found == NULL; child = child->next) + xmlNode* found = nullptr; + for (xmlNode* child = hierarchyRoot->children; child != nullptr && found == nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; if (ReadNodeId(child) == id) return child; @@ -60,12 +60,12 @@ namespace FUDaeParser // Returns the first child with the given 'sid' value within a given XML hierarchy xmlNode* FindHierarchyChildBySid(xmlNode* hierarchyRoot, const char* sid) { - if (hierarchyRoot == NULL) return NULL; + if (hierarchyRoot == nullptr) return nullptr; if (ReadNodeProperty(hierarchyRoot, DAE_SID_ATTRIBUTE) == sid) return hierarchyRoot; - xmlNode* found = NULL; - for (xmlNode* child = hierarchyRoot->children; child != NULL && found == NULL; child = child->next) + xmlNode* found = nullptr; + for (xmlNode* child = hierarchyRoot->children; child != nullptr && found == nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; //if (ReadNodeProperty(child, DAE_SID_ATTRIBUTE) == sid) return child; @@ -77,7 +77,7 @@ namespace FUDaeParser // Returns the first technique node with a given profile xmlNode* FindTechnique(xmlNode* parent, const char* profile) { - if (parent != NULL) + if (parent != nullptr) { xmlNodeList techniqueNodes; FindChildrenByType(parent, DAE_TECHNIQUE_ELEMENT, techniqueNodes); @@ -89,7 +89,7 @@ namespace FUDaeParser if (techniqueProfile == profile) return techniqueNode; } } - return NULL; + return nullptr; } // Returns the accessor node for a given source node @@ -102,10 +102,10 @@ namespace FUDaeParser // Returns a list of parameter names and nodes held by a given XML node void FindParameters(xmlNode* parent, StringList& parameterNames, xmlNodeList& parameterNodes) { - if (parent == NULL || parameterNames.size() != parameterNodes.size()) return; + if (parent == nullptr || parameterNames.size() != parameterNodes.size()) return; size_t originalCount = parameterNodes.size(); - for (xmlNode* child = parent->children; child != NULL; child = child->next) + for (xmlNode* child = parent->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -132,7 +132,7 @@ namespace FUDaeParser uint32 ReadSource(xmlNode* sourceNode, FloatList& array) { uint32 stride = 0; - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -149,7 +149,7 @@ namespace FUDaeParser // Retrieves a list of signed integers from a source node void ReadSource(xmlNode* sourceNode, Int32List& array) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -164,14 +164,14 @@ namespace FUDaeParser // Retrieves a list of strings from a source node void ReadSource(xmlNode* sourceNode, StringList& array) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); array.resize(ReadNodeCount(accessorNode)); xmlNode* arrayNode = FindChildByType(sourceNode, DAE_NAME_ARRAY_ELEMENT); - if (arrayNode == NULL) arrayNode = FindChildByType(sourceNode, DAE_IDREF_ARRAY_ELEMENT); + if (arrayNode == nullptr) arrayNode = FindChildByType(sourceNode, DAE_IDREF_ARRAY_ELEMENT); const char* arrayContent = ReadNodeContentDirect(arrayNode); FUStringConversion::ToStringList(arrayContent, array); } @@ -180,7 +180,7 @@ namespace FUDaeParser // Retrieves a list of points from a source node void ReadSource(xmlNode* sourceNode, FMVector3List& array) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -195,7 +195,7 @@ namespace FUDaeParser // Retrieves a list of matrices from a source node void ReadSource(xmlNode* sourceNode, FMMatrix44List& array) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -210,7 +210,7 @@ namespace FUDaeParser // Retrieves a series of interleaved floats from a source node void ReadSourceInterleaved(xmlNode* sourceNode, fm::pvector& arrays) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -223,7 +223,7 @@ namespace FUDaeParser // Use the stride to pad the interleaved float lists or remove extra elements uint32 stride = ReadNodeStride(accessorNode); while (stride < arrays.size()) arrays.pop_back(); - while (stride > arrays.size()) arrays.push_back(NULL); + while (stride > arrays.size()) arrays.push_back(nullptr); // Read and parse the float array xmlNode* arrayNode = FindChildByType(sourceNode, DAE_FLOAT_ARRAY_ELEMENT); @@ -235,7 +235,7 @@ namespace FUDaeParser uint32 ReadSourceInterleaved(xmlNode* sourceNode, fm::pvector& arrays) { uint32 stride = 1; - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -273,7 +273,7 @@ namespace FUDaeParser { // Use the stride to pad the interleaved float lists or remove extra elements while (stride < arrays.size() * 2) arrays.pop_back(); - while (stride > arrays.size() * 2) arrays.push_back(NULL); + while (stride > arrays.size() * 2) arrays.push_back(nullptr); // Read and parse the float array xmlNode* arrayNode = FindChildByType(sourceNode, DAE_FLOAT_ARRAY_ELEMENT); @@ -282,7 +282,7 @@ namespace FUDaeParser { for (size_t j = 0; 2 * j < stride && *value != 0; ++j) { - if (arrays[j] != NULL) + if (arrays[j] != nullptr) { arrays[j]->at(i).u = FUStringConversion::ToFloat(&value); arrays[j]->at(i).v = FUStringConversion::ToFloat(&value); @@ -299,7 +299,7 @@ namespace FUDaeParser { for (size_t i = 0; 2 * i < stride && *value != 0; ++i) { - if (arrays[i] != NULL) + if (arrays[i] != nullptr) { FMVector2 v; v.u = FUStringConversion::ToFloat(&value); @@ -321,7 +321,7 @@ namespace FUDaeParser uint32 ReadSourceInterleaved(xmlNode* sourceNode, fm::pvector& arrays) { uint32 stride = 1; - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -359,7 +359,7 @@ namespace FUDaeParser { // Use the stride to pad the interleaved float lists or remove extra elements while (stride < arrays.size() * 3) arrays.pop_back(); - while (stride > arrays.size() * 3) arrays.push_back(NULL); + while (stride > arrays.size() * 3) arrays.push_back(nullptr); // Read and parse the float array xmlNode* arrayNode = FindChildByType(sourceNode, DAE_FLOAT_ARRAY_ELEMENT); @@ -368,7 +368,7 @@ namespace FUDaeParser { for (size_t j = 0; 3 * j < stride && *value != 0; ++j) { - if (arrays[j] != NULL) + if (arrays[j] != nullptr) { arrays[j]->at(i).x = FUStringConversion::ToFloat(&value); arrays[j]->at(i).y = FUStringConversion::ToFloat(&value); @@ -387,7 +387,7 @@ namespace FUDaeParser { for (size_t i = 0; 2 * i < stride && *value != 0; ++i) { - if (arrays[i] != NULL) + if (arrays[i] != nullptr) { FMVector3 v; v.x = FUStringConversion::ToFloat(&value); @@ -411,7 +411,7 @@ namespace FUDaeParser // Retrieves a series of interpolation values from a source node void ReadSourceInterpolation(xmlNode* sourceNode, UInt32List& array) { - if (sourceNode != NULL) + if (sourceNode != nullptr) { // Get the accessor's count xmlNode* accessorNode = FindTechniqueAccessor(sourceNode); @@ -443,7 +443,7 @@ namespace FUDaeParser // Calculate the target pointer for a targetable node void CalculateNodeTargetPointer(xmlNode* target, fm::string& pointer) { - if (target != NULL) + if (target != nullptr) { // The target node should have either a subid or an id if (HasNodeProperty(target, DAE_ID_ATTRIBUTE)) @@ -462,7 +462,7 @@ namespace FUDaeParser traversal.reserve(16); traversal.push_back(target); xmlNode* current = target->parent; - while (current != NULL) + while (current != nullptr) { traversal.push_back(current); if (HasNodeProperty(current, DAE_ID_ATTRIBUTE)) break; @@ -521,14 +521,14 @@ namespace FUDaeParser // To avoid unnecessary memory copies: // Start with calculating the maximum child count uint32 nodeCount = 0; - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) ++nodeCount; } // Now, buffer the child nodes and their ids pairs.reserve(nodeCount); - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -543,7 +543,7 @@ namespace FUDaeParser const char* SkipPound(const fm::string& id) { const char* s = id.c_str(); - if (s == NULL) return NULL; + if (s == nullptr) return nullptr; else if (*s == '#') ++s; return s; } diff --git a/FColladaPlugins/FArchiveXML/FAXColladaWriter.cpp b/FColladaPlugins/FArchiveXML/FAXColladaWriter.cpp index 55340be..4c8a4a2 100644 --- a/FColladaPlugins/FArchiveXML/FAXColladaWriter.cpp +++ b/FColladaPlugins/FArchiveXML/FAXColladaWriter.cpp @@ -19,8 +19,8 @@ namespace FUDaeWriter // Check for only one element for this profile. xmlNode* AddExtraTechniqueChild(xmlNode* parent, const char* profile) { - xmlNode* techniqueNode = NULL; - if (parent != NULL) + xmlNode* techniqueNode = nullptr; + if (parent != nullptr) { xmlNode* extraNode = AddChildOnce(parent, DAE_EXTRA_ELEMENT); techniqueNode = AddTechniqueChild(extraNode, profile); @@ -32,11 +32,11 @@ namespace FUDaeWriter // Check for only one element for this profile. xmlNode* AddTechniqueChild(xmlNode* parent, const char* profile) { - xmlNode* techniqueNode = NULL; - if (parent != NULL) + xmlNode* techniqueNode = nullptr; + if (parent != nullptr) { techniqueNode = FindTechnique(parent, profile); - if (techniqueNode == NULL) + if (techniqueNode == nullptr) { techniqueNode = AddChild(parent, DAE_TECHNIQUE_ELEMENT); AddAttribute(techniqueNode, DAE_PROFILE_ATTRIBUTE, profile); @@ -48,15 +48,15 @@ namespace FUDaeWriter xmlNode* AddParameter(xmlNode* parent, const char* name, const char* type) { xmlNode* parameterNode = AddChild(parent, DAE_PARAMETER_ELEMENT); - if (name != NULL && *name != 0) AddAttribute(parameterNode, DAE_NAME_ATTRIBUTE, name); - if (type == NULL) type = DAE_FLOAT_TYPE; + if (name != nullptr && *name != 0) AddAttribute(parameterNode, DAE_NAME_ATTRIBUTE, name); + if (type == nullptr) type = DAE_FLOAT_TYPE; AddAttribute(parameterNode, DAE_TYPE_ATTRIBUTE, type); return parameterNode; } xmlNode* AddInput(xmlNode* parent, const char* sourceId, const char* semantic, int32 offset, int32 set) { - if (sourceId == NULL || *sourceId == 0 || semantic == NULL || *semantic == 0) return NULL; + if (sourceId == nullptr || *sourceId == 0 || semantic == nullptr || *semantic == 0) return nullptr; xmlNode* inputNode = AddChild(parent, DAE_INPUT_ELEMENT); AddAttribute(inputNode, DAE_SEMANTIC_ATTRIBUTE, semantic); AddAttribute(inputNode, DAE_SOURCE_ATTRIBUTE, fm::string("#") + sourceId); @@ -174,17 +174,17 @@ namespace FUDaeWriter AddAttribute(accessorNode, DAE_STRIDE_ATTRIBUTE, stride); // Create the stride parameters - if (type == NULL) type = DAE_FLOAT_TYPE; + if (type == nullptr) type = DAE_FLOAT_TYPE; if (stride != 16 && stride != 32) { size_t p = 0; for (size_t i = 0; i < stride; ++i) { - const char* parameter = NULL; - if (parameters != NULL) + const char* parameter = nullptr; + if (parameters != nullptr) { parameter = parameters[p++]; - if (parameter == NULL) { parameter = parameters[0]; p = 1; } + if (parameter == nullptr) { parameter = parameters[0]; p = 1; } while (*parameter != 0 && !((*parameter >= 'a' && *parameter <= 'z') || (*parameter >= 'A' && *parameter <= 'Z'))) ++parameter; } AddParameter(accessorNode, parameter, type); @@ -210,7 +210,7 @@ namespace FUDaeWriter FUSStringBuilder arrayId(id); arrayId.append("-array"); AddArray(sourceNode, arrayId.ToCharPtr(), values); xmlNode* techniqueCommonNode = AddChild(sourceNode, DAE_TECHNIQUE_COMMON_ELEMENT); - AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 16, NULL, DAE_MATRIX_TYPE); + AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 16, nullptr, DAE_MATRIX_TYPE); return sourceNode; } @@ -290,7 +290,7 @@ namespace FUDaeWriter FUSStringBuilder arrayId(id); arrayId.append("-array"); AddArray(sourceNode, arrayId.ToCharPtr(), values); xmlNode* techniqueCommonNode = AddChild(sourceNode, DAE_TECHNIQUE_COMMON_ELEMENT); - AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 3, NULL, DAE_FLOAT_TYPE); + AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 3, nullptr, DAE_FLOAT_TYPE); return sourceNode; } @@ -301,7 +301,7 @@ namespace FUDaeWriter FUSStringBuilder arrayId(id); arrayId.append("-array"); AddArray(sourceNode, arrayId.ToCharPtr(), values); xmlNode* techniqueCommonNode = AddChild(sourceNode, DAE_TECHNIQUE_COMMON_ELEMENT); - AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 2, NULL, DAE_FLOAT_TYPE); + AddAccessor(techniqueCommonNode, arrayId.ToCharPtr(), values.size(), 2, nullptr, DAE_FLOAT_TYPE); return sourceNode; } @@ -367,7 +367,7 @@ namespace FUDaeWriter { // Find the first parent node with an id or sid. If this node has an id, return right away. xmlNode* parentNode = node; - for (parentNode = node; parentNode != NULL; parentNode = parentNode->parent) + for (parentNode = node; parentNode != nullptr; parentNode = parentNode->parent) { if (HasNodeProperty(parentNode, DAE_ID_ATTRIBUTE) || HasNodeProperty(parentNode, DAE_SID_ATTRIBUTE)) break; } @@ -376,15 +376,15 @@ namespace FUDaeWriter if (!HasNodeProperty(parentNode, DAE_SID_ATTRIBUTE)) AddAttribute(node, DAE_SID_ATTRIBUTE, wantedSid); return wantedSid; } - if (parentNode == NULL) + if (parentNode == nullptr) { // Retrieve the last parent node available - for (parentNode = node; parentNode->parent != NULL; parentNode = parentNode->parent) {} + for (parentNode = node; parentNode->parent != nullptr; parentNode = parentNode->parent) {} } // Check the wanted sid for uniqueness xmlNode* existingNode = FindHierarchyChildBySid(parentNode, wantedSid); - if (existingNode == NULL) + if (existingNode == nullptr) { AddAttribute(node, DAE_SID_ATTRIBUTE, wantedSid); return wantedSid; @@ -395,7 +395,7 @@ namespace FUDaeWriter { FUSStringBuilder builder(wantedSid); builder.append(counter); existingNode = FindHierarchyChildBySid(parentNode, builder.ToCharPtr()); - if (existingNode == NULL) + if (existingNode == nullptr) { AddAttribute(node, DAE_SID_ATTRIBUTE, builder); return builder.ToString(); diff --git a/FColladaPlugins/FArchiveXML/FAXColladaWriter.h b/FColladaPlugins/FArchiveXML/FAXColladaWriter.h index 5ec3655..241e034 100644 --- a/FColladaPlugins/FArchiveXML/FAXColladaWriter.h +++ b/FColladaPlugins/FArchiveXML/FAXColladaWriter.h @@ -154,8 +154,8 @@ namespace FUDaeWriter Some valid parameter names are available in the FUDaeAccessor class. @param type The type name of the parameters. Examples: float, float4x4, Name or IDRef. @return The created XML tree node. */ - xmlNode* AddAccessor(xmlNode* parent, const char* arrayId, size_t count, size_t stride=1, const char** parameters=NULL, const char* type=NULL); - inline xmlNode* AddAccessor(xmlNode* parent, const fm::string& arrayId, size_t count, size_t stride=1, const char** parameters=NULL, const char* type=NULL) { return AddAccessor(parent, arrayId.c_str(), count, stride, parameters, type); } /**< See above. */ + xmlNode* AddAccessor(xmlNode* parent, const char* arrayId, size_t count, size_t stride=1, const char** parameters=nullptr, const char* type=nullptr); + inline xmlNode* AddAccessor(xmlNode* parent, const fm::string& arrayId, size_t count, size_t stride=1, const char** parameters=nullptr, const char* type=nullptr) { return AddAccessor(parent, arrayId.c_str(), count, stride, parameters, type); } /**< See above. */ /** Writes out a COLLADA multi-dimensional source of floating-point values. @param parent The parent XML tree node. @@ -166,8 +166,8 @@ namespace FUDaeWriter @param parameters The list of accessor parameter names. Some valid parameter names are available in the FUDaeAccessor class. @return The created XML tree node. */ - xmlNode* AddSourceFloat(xmlNode* parent, const char* id, const FloatList& values, size_t stride=1, const char** parameters=NULL); - inline xmlNode* AddSourceFloat(xmlNode* parent, const fm::string& id, const FloatList& values, size_t stride=1, const char** parameters=NULL) { return AddSourceFloat(parent, id.c_str(), values, stride, parameters); } /**< See above. */ + xmlNode* AddSourceFloat(xmlNode* parent, const char* id, const FloatList& values, size_t stride=1, const char** parameters=nullptr); + inline xmlNode* AddSourceFloat(xmlNode* parent, const fm::string& id, const FloatList& values, size_t stride=1, const char** parameters=nullptr) { return AddSourceFloat(parent, id.c_str(), values, stride, parameters); } /**< See above. */ /** Writes out a COLLADA source of floating-point values. @param parent The parent XML tree node. @@ -176,8 +176,8 @@ namespace FUDaeWriter @param parameter The accessor parameter name. Some valid parameter names are available in the FUDaeAccessor class. @return The created XML tree node. */ - xmlNode* AddSourceFloat(xmlNode* parent, const char* id, const FloatList& values, const char* parameter=NULL); - inline xmlNode* AddSourceFloat(xmlNode* parent, const fm::string& id, const FloatList& values, const char* parameter=NULL) { return AddSourceFloat(parent, id.c_str(), values, parameter); } /**< See above. */ + xmlNode* AddSourceFloat(xmlNode* parent, const char* id, const FloatList& values, const char* parameter=nullptr); + inline xmlNode* AddSourceFloat(xmlNode* parent, const fm::string& id, const FloatList& values, const char* parameter=nullptr) { return AddSourceFloat(parent, id.c_str(), values, parameter); } /**< See above. */ /** Writes out a COLLADA source of floating-point values. The parameters for sources of 3D vector values are "X", "Y" and "Z". @@ -268,8 +268,8 @@ namespace FUDaeWriter token should have spaces in them. @param parameter The name of the accessor parameter. @return The created XML tree node. */ - xmlNode* AddSourceString(xmlNode* parent, const char* id, const StringList& values, const char* parameter=NULL); - inline xmlNode* AddSourceString(xmlNode* parent, const fm::string& id, const StringList& values, const char* parameter=NULL) { return AddSourceString(parent, id.c_str(), values, parameter); } /**< See above. */ + xmlNode* AddSourceString(xmlNode* parent, const char* id, const StringList& values, const char* parameter=nullptr); + inline xmlNode* AddSourceString(xmlNode* parent, const fm::string& id, const StringList& values, const char* parameter=nullptr) { return AddSourceString(parent, id.c_str(), values, parameter); } /**< See above. */ /** Writes out a COLLADA source of COLLADA references. @param parent The parent XML tree node. @@ -277,8 +277,8 @@ namespace FUDaeWriter @param values The list of COLLADA references. @param parameter The name of the accessor parameter. @return The created XML tree node. */ - xmlNode* AddSourceIDRef(xmlNode* parent, const char* id, const StringList& values, const char* parameter=NULL); - inline xmlNode* AddSourceIDRef(xmlNode* parent, const fm::string& id, const StringList& values, const char* parameter=NULL) { return AddSourceIDRef(parent, id.c_str(), values, parameter); } /**< See above. */ + xmlNode* AddSourceIDRef(xmlNode* parent, const char* id, const StringList& values, const char* parameter=nullptr); + inline xmlNode* AddSourceIDRef(xmlNode* parent, const fm::string& id, const StringList& values, const char* parameter=nullptr) { return AddSourceIDRef(parent, id.c_str(), values, parameter); } /**< See above. */ /** Writes out a COLLADA source of interpolation tokens. One parameter will be created for a source of interpolation tokens: "INTERPOLATION". diff --git a/FColladaPlugins/FArchiveXML/FAXControllerExport.cpp b/FColladaPlugins/FArchiveXML/FAXControllerExport.cpp index b98a7ed..d9c153d 100644 --- a/FColladaPlugins/FArchiveXML/FAXControllerExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXControllerExport.cpp @@ -21,8 +21,8 @@ xmlNode* FArchiveXML::WriteController(FCDObject* object, xmlNode* parentNode) FCDController* controller = (FCDController*)object; xmlNode* controllerNode = FArchiveXML::WriteToEntityXMLFCDEntity(controller, parentNode, DAE_CONTROLLER_ELEMENT); - if (controller->GetSkinController() != NULL) FArchiveXML::LetWriteObject(controller->GetSkinController(), controllerNode); - else if (controller->GetMorphController() != NULL) FArchiveXML::LetWriteObject(controller->GetMorphController(), controllerNode); + if (controller->GetSkinController() != nullptr) FArchiveXML::LetWriteObject(controller->GetSkinController(), controllerNode); + else if (controller->GetMorphController() != nullptr) FArchiveXML::LetWriteObject(controller->GetMorphController(), controllerNode); FArchiveXML::WriteEntityExtra(controller, controllerNode); return controllerNode; } @@ -120,7 +120,7 @@ xmlNode* FArchiveXML::WriteMorphController(FCDObject* object, xmlNode* parentNod // Create the node and set its attributes xmlNode* morphNode = AddChild(parentNode, DAE_CONTROLLER_MORPH_ELEMENT); AddAttribute(morphNode, DAE_METHOD_ATTRIBUTE, FUDaeMorphMethod::ToString(morphController->GetMethod())); - if (morphController->GetBaseTarget() != NULL) + if (morphController->GetBaseTarget() != nullptr) { AddAttribute(morphNode, DAE_SOURCE_ATTRIBUTE, fm::string("#") + morphController->GetBaseTarget()->GetDaeId()); } @@ -131,7 +131,7 @@ xmlNode* FArchiveXML::WriteMorphController(FCDObject* object, xmlNode* parentNod for (size_t i = 0 ; i < morphController->GetTargetCount(); ++i) { const FCDMorphTarget* t = morphController->GetTarget(i); - targetIds.push_back(t->GetGeometry() != NULL ? t->GetGeometry()->GetDaeId() : DAEERR_UNKNOWN_IDREF); + targetIds.push_back(t->GetGeometry() != nullptr ? t->GetGeometry()->GetDaeId() : DAEERR_UNKNOWN_IDREF); weights.push_back(t->GetWeight()); } diff --git a/FColladaPlugins/FArchiveXML/FAXControllerImport.cpp b/FColladaPlugins/FArchiveXML/FAXControllerImport.cpp index 2b9e7a0..7cc6ca6 100644 --- a/FColladaPlugins/FArchiveXML/FAXControllerImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXControllerImport.cpp @@ -31,17 +31,17 @@ bool FArchiveXML::LoadController(FCDObject* object, xmlNode* controllerNode) // Find the or element and process it xmlNode* skinNode = FindChildByType(controllerNode, DAE_CONTROLLER_SKIN_ELEMENT); xmlNode* morphNode = FindChildByType(controllerNode, DAE_CONTROLLER_MORPH_ELEMENT); - if (skinNode != NULL && morphNode != NULL) + if (skinNode != nullptr && morphNode != nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_CONTROLLER_TYPE_CONFLICT, controllerNode->line); } - if (skinNode != NULL) + if (skinNode != nullptr) { // Create and parse in the skin controller FCDSkinController* skin = controller->CreateSkinController(); status &= (FArchiveXML::LoadSkinController(skin, skinNode)); } - else if (morphNode != NULL) + else if (morphNode != nullptr) { // Create and parse in the morph controller FCDMorphController* morph = controller->CreateMorphController(); @@ -75,7 +75,7 @@ bool FArchiveXML::LoadSkinController(FCDObject* object, xmlNode* skinNode) // Read in the element xmlNode* bindShapeTransformNode = FindChildByType(skinNode, DAE_BINDSHAPEMX_SKIN_PARAMETER); - if (bindShapeTransformNode == NULL) skinController->SetBindShapeTransform(FMMatrix44::Identity); + if (bindShapeTransformNode == nullptr) skinController->SetBindShapeTransform(FMMatrix44::Identity); else { const char* content = ReadNodeContentDirect(bindShapeTransformNode); @@ -91,18 +91,18 @@ bool FArchiveXML::LoadSkinController(FCDObject* object, xmlNode* skinNode) xmlNode* combinerNode = FindChildByType(skinNode, DAE_WEIGHTS_ELEMENT); // Verify that we have the necessary data structures: bind-shape, elements, element - if (jointsNode == NULL || combinerNode == NULL) + if (jointsNode == nullptr || combinerNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_ELEMENT, skinNode->line); return status = false; } // Gather the inputs for the element and the element - xmlNode* firstCombinerValueNode = NULL; + xmlNode* firstCombinerValueNode = nullptr; xmlNodeList skinningInputNodes; FindChildrenByType(jointsNode, DAE_INPUT_ELEMENT, skinningInputNodes); uint32 combinerValueCount = ReadNodeCount(combinerNode); - for (xmlNode* child = combinerNode->children; child != NULL; child = child->next) + for (xmlNode* child = combinerNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; if (IsEquivalent(child->name, DAE_INPUT_ELEMENT)) skinningInputNodes.push_back(child); @@ -112,7 +112,7 @@ bool FArchiveXML::LoadSkinController(FCDObject* object, xmlNode* skinNode) break; } } - if (firstCombinerValueNode == NULL) + if (firstCombinerValueNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_ELEMENT, combinerNode->line); } @@ -134,7 +134,7 @@ bool FArchiveXML::LoadSkinController(FCDObject* object, xmlNode* skinNode) if (!idx.empty()) jointIdx = FUStringConversion::ToInt32(idx); if (!jointSubIds.empty()) continue; ReadSource(sourceNode, jointSubIds); - data.jointAreSids = FindChildByType(sourceNode, DAE_NAME_ARRAY_ELEMENT) != NULL; + data.jointAreSids = FindChildByType(sourceNode, DAE_NAME_ARRAY_ELEMENT) != nullptr; } else if (semantic == DAE_BINDMATRIX_SKIN_INPUT) { @@ -170,8 +170,8 @@ bool FArchiveXML::LoadSkinController(FCDObject* object, xmlNode* skinNode) // Read the element second. xmlNode* vNode = firstCombinerValueNode->next; - while (vNode != NULL && vNode->type != XML_ELEMENT_NODE) vNode = vNode->next; - if (vNode == NULL || !IsEquivalent(vNode->name, DAE_VERTEX_ELEMENT)) + while (vNode != nullptr && vNode->type != XML_ELEMENT_NODE) vNode = vNode->next; + if (vNode == nullptr || !IsEquivalent(vNode->name, DAE_VERTEX_ELEMENT)) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_V_ELEMENT_MISSING, vNode->line); } @@ -267,7 +267,7 @@ bool FArchiveXML::LoadMorphController(FCDObject* object, xmlNode* morphNode) // Find the element and process its inputs xmlNode* targetsNode = FindChildByType(morphNode, DAE_TARGETS_ELEMENT); - if (targetsNode == NULL) + if (targetsNode == nullptr) { //return status.Fail(FS("Cannot find necessary element for morph controller: ") + TO_FSTRING(parent->GetDaeId()), morphNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_ELEMENT, morphNode->line); @@ -277,7 +277,7 @@ bool FArchiveXML::LoadMorphController(FCDObject* object, xmlNode* morphNode) FindChildrenByType(targetsNode, DAE_INPUT_ELEMENT, inputNodes); // Find the TARGET and WEIGHT input necessary sources - xmlNode* targetSourceNode = NULL,* weightSourceNode = NULL; + xmlNode* targetSourceNode = nullptr,* weightSourceNode = nullptr; for (xmlNodeList::iterator it = inputNodes.begin(); it != inputNodes.end(); ++it) { xmlNode* inputNode = (*it); @@ -296,7 +296,7 @@ bool FArchiveXML::LoadMorphController(FCDObject* object, xmlNode* morphNode) FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_UNKNOWN_MORPH_TARGET_TYPE, inputNode->line); } } - if (targetSourceNode == NULL || weightSourceNode == NULL) + if (targetSourceNode == nullptr || weightSourceNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_INPUT, targetsNode->line); return status; @@ -317,7 +317,7 @@ bool FArchiveXML::LoadMorphController(FCDObject* object, xmlNode* morphNode) for (int32 i = 0; i < (int32) targetCount; ++i) { FCDGeometry* targetGeometry = morphController->GetDocument()->FindGeometry(morphTargetIds[i]); - if (targetGeometry == NULL) + if (targetGeometry == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_TARGET_GEOMETRY_MISSING, morphNode->line); } @@ -337,7 +337,7 @@ bool FArchiveXML::LoadMorphController(FCDObject* object, xmlNode* morphNode) FCDSkinController* FArchiveXML::FindSkinController(FCDControllerInstance* controllerInstance, FCDEntity* entity) { - if (entity != NULL && entity->GetType() == FCDEntity::CONTROLLER) + if (entity != nullptr && entity->GetType() == FCDEntity::CONTROLLER) { FCDController* controller = (FCDController*) entity; @@ -347,5 +347,5 @@ FCDSkinController* FArchiveXML::FindSkinController(FCDControllerInstance* contro } else return FArchiveXML::FindSkinController(controllerInstance, controller->GetBaseTarget()); } - return NULL; + return nullptr; } diff --git a/FColladaPlugins/FArchiveXML/FAXEntityExport.cpp b/FColladaPlugins/FArchiveXML/FAXEntityExport.cpp index 5f6c4a5..bb26a69 100644 --- a/FColladaPlugins/FArchiveXML/FAXEntityExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXEntityExport.cpp @@ -18,12 +18,12 @@ xmlNode* FArchiveXML::WriteObject(FCDObject* UNUSED(object), xmlNode* UNUSED(parentNode)) { FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteExtra(FCDObject* object, xmlNode* parentNode) { - xmlNode* extraNode = NULL; + xmlNode* extraNode = nullptr; FCDExtra* extra = (FCDExtra*)object; if (extra->HasContent()) @@ -52,7 +52,7 @@ xmlNode* FArchiveXML::WriteExtraType(FCDObject* object, xmlNode* parentNode) { FCDEType* eType = (FCDEType*)object; - if (eType->GetName().empty() && eType->GetTechniqueCount() == 0) return NULL; + if (eType->GetName().empty() && eType->GetTechniqueCount() == 0) return nullptr; // Add the element and its techniques xmlNode* extraNode = AddChild(parentNode, DAE_EXTRA_ELEMENT); @@ -109,7 +109,7 @@ xmlNode* FArchiveXML::WriteAssetContributor(FCDObject* object, xmlNode* parentNo { FCDAssetContributor* assetContributor = (FCDAssetContributor*)object; - xmlNode* contributorNode = NULL; + xmlNode* contributorNode = nullptr; if (!assetContributor->IsEmpty()) { contributorNode = AddChild(parentNode, DAE_CONTRIBUTOR_ASSET_ELEMENT); @@ -134,7 +134,7 @@ xmlNode* FArchiveXML::WriteEntityReference(FCDObject* UNUSED(object), xmlNode* U // Not reachable // FUBreak; - return NULL; + return nullptr; } @@ -144,7 +144,7 @@ xmlNode* FArchiveXML::WriteExternalReferenceManager(FCDObject* UNUSED(object), x // Not reachable // FUBreak; - return NULL; + return nullptr; } @@ -154,7 +154,7 @@ xmlNode* FArchiveXML::WritePlaceHolder(FCDObject* UNUSED(object), xmlNode* UNUSE // Not reachable // FUBreak; - return NULL; + return nullptr; } @@ -173,7 +173,7 @@ xmlNode* FArchiveXML::WriteExtraNode(FCDObject* object, xmlNode* parentNode) } // Write out the animated element - if (eNode->GetAnimated() != NULL && eNode->GetAnimated()->HasCurve()) + if (eNode->GetAnimated() != nullptr && eNode->GetAnimated()->HasCurve()) { FArchiveXML::WriteAnimatedValue(eNode->GetAnimated(), customNode, eNode->GetName()); } diff --git a/FColladaPlugins/FArchiveXML/FAXEntityImport.cpp b/FColladaPlugins/FArchiveXML/FAXEntityImport.cpp index 020990d..8e8a3e8 100644 --- a/FColladaPlugins/FArchiveXML/FAXEntityImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXEntityImport.cpp @@ -30,12 +30,12 @@ bool FArchiveXML::LoadExtra(FCDObject* object, xmlNode* extraNode) bool status = true; // Do NOT assume that we have an element: we may be parsing a type switch instead. - FCDEType* parsingType = NULL; + FCDEType* parsingType = nullptr; if (IsEquivalent(extraNode->name, DAE_EXTRA_ELEMENT)) { parsingType = extra->AddType(ReadNodeProperty(extraNode, DAE_TYPE_ATTRIBUTE)); } - if (parsingType == NULL) parsingType = extra->GetDefaultType(); + if (parsingType == nullptr) parsingType = extra->GetDefaultType(); FArchiveXML::LoadSwitch(parsingType, &parsingType->GetObjectType(), extraNode); extra->SetDirtyFlag(); @@ -61,9 +61,9 @@ bool FArchiveXML::LoadExtraNode(FCDObject* object, xmlNode* customNode) FArchiveXML::LinkAnimatedCustom(fcdenode->GetAnimated(), customNode); // Read in the node's attributes - for (xmlAttr* a = customNode->properties; a != NULL; a = a->next) + for (xmlAttr* a = customNode->properties; a != nullptr; a = a->next) { - fcdenode->AddAttribute((const char*) a->name, (a->children != NULL) ? TO_FSTRING((const char*) (a->children->content)) : FS("")); + fcdenode->AddAttribute((const char*) a->name, (a->children != nullptr) ? TO_FSTRING((const char*) (a->children->content)) : FS("")); } fcdenode->SetDirtyFlag(); @@ -104,7 +104,7 @@ bool FArchiveXML::LoadAsset(FCDObject* object, xmlNode* assetNode) FCDAsset* asset = (FCDAsset*)object; bool status = true; - for (xmlNode* child = assetNode->children; child != NULL; child = child->next) + for (xmlNode* child = assetNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -166,7 +166,7 @@ bool FArchiveXML::LoadAssetContributor(FCDObject* object, xmlNode* contributorNo FCDAssetContributor* assetContributor = (FCDAssetContributor*)object; bool status = true; - for (xmlNode* child = contributorNode->children; child != NULL; child = child->next) + for (xmlNode* child = contributorNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -232,7 +232,7 @@ bool FArchiveXML::LoadExtraNodeChildren(FCDENode* fcdenode, xmlNode* customNode) bool status = true; // Read in the node's children - for (xmlNode* k = customNode->children; k != NULL; k = k->next) + for (xmlNode* k = customNode->children; k != nullptr; k = k->next) { if (k->type != XML_ELEMENT_NODE) continue; diff --git a/FColladaPlugins/FArchiveXML/FAXForceFieldExport.cpp b/FColladaPlugins/FArchiveXML/FAXForceFieldExport.cpp index cf46bb3..a1e8be4 100644 --- a/FColladaPlugins/FArchiveXML/FAXForceFieldExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXForceFieldExport.cpp @@ -25,7 +25,7 @@ xmlNode* FArchiveXML::WriteForceField(FCDObject* object, xmlNode* parentNode) xmlNode* forceFieldNode = FArchiveXML::WriteToEntityXMLFCDEntity(forceField, parentNode, DAE_FORCE_FIELD_ELEMENT); - if (forceField->GetInformation() != NULL) + if (forceField->GetInformation() != nullptr) { FArchiveXML::WriteTechniquesFCDExtra(forceField->GetInformation(), forceFieldNode); } diff --git a/FColladaPlugins/FArchiveXML/FAXGeometryExport.cpp b/FColladaPlugins/FArchiveXML/FAXGeometryExport.cpp index 0817dba..f8a65dd 100644 --- a/FColladaPlugins/FArchiveXML/FAXGeometryExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXGeometryExport.cpp @@ -24,7 +24,7 @@ xmlNode* FArchiveXML::WriteGeometrySource(FCDObject* object, xmlNode* parentNode { FCDGeometrySource* geometrySource = (FCDGeometrySource*)object; - xmlNode* sourceNode = NULL; + xmlNode* sourceNode = nullptr; // Export the source directly, using the correct parameters and the length factor FloatList& sourceData = geometrySource->GetSourceData().GetDataList(); @@ -40,8 +40,8 @@ xmlNode* FArchiveXML::WriteGeometrySource(FCDObject* object, xmlNode* parentNode case FUDaeGeometryInput::TEXBINORMAL: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, FUDaeAccessor::XYZW); break; case FUDaeGeometryInput::UV: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, FUDaeAccessor::XYZW); break; case FUDaeGeometryInput::COLOR: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, FUDaeAccessor::RGBA); break; - case FUDaeGeometryInput::EXTRA: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, NULL); break; - case FUDaeGeometryInput::UNKNOWN: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, NULL); break; + case FUDaeGeometryInput::EXTRA: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, nullptr); break; + case FUDaeGeometryInput::UNKNOWN: sourceNode = AddSourceFloat(parentNode, geometrySource->GetDaeId(), sourceData, stride, nullptr); break; case FUDaeGeometryInput::VERTEX: // Refuse to export these sources default: break; @@ -52,7 +52,7 @@ xmlNode* FArchiveXML::WriteGeometrySource(FCDObject* object, xmlNode* parentNode AddAttribute(sourceNode, DAE_NAME_ATTRIBUTE, geometrySource->GetName()); } - if (geometrySource->GetExtra() != NULL) + if (geometrySource->GetExtra() != nullptr) { FArchiveXML::WriteTechniquesFCDExtra(geometrySource->GetExtra(), sourceNode); } @@ -69,7 +69,7 @@ xmlNode* FArchiveXML::WriteGeometryMesh(FCDObject* object, xmlNode* parentNode) { FCDGeometryMesh* geometryMesh = (FCDGeometryMesh*)object; - xmlNode* meshNode = NULL; + xmlNode* meshNode = nullptr; if (geometryMesh->IsConvex() && !geometryMesh->GetConvexHullOf().empty()) { @@ -89,7 +89,7 @@ xmlNode* FArchiveXML::WriteGeometryMesh(FCDObject* object, xmlNode* parentNode) // Write out the element xmlNode* verticesNode = AddChild(meshNode, DAE_VERTICES_ELEMENT); - xmlNode* verticesInputExtraNode = NULL,* verticesInputExtraTechniqueNode = NULL; + xmlNode* verticesInputExtraNode = nullptr,* verticesInputExtraTechniqueNode = nullptr; for (size_t i = 0; i < geometryMesh->GetVertexSourceCount(); ++i) { FCDGeometrySource* source = geometryMesh->GetVertexSource(i); @@ -99,11 +99,11 @@ xmlNode* FArchiveXML::WriteGeometryMesh(FCDObject* object, xmlNode* parentNode) { FCDGeometryPolygons* firstPolys = geometryMesh->GetPolygons(0); FCDGeometryPolygonsInput* input = firstPolys->FindInput(source); - FUAssert(input != NULL, continue); + FUAssert(input != nullptr, continue); if (input->GetSet() != -1) { // We are interested in the set information, so if it is available, export it as an extra. - if (verticesInputExtraNode == NULL) + if (verticesInputExtraNode == nullptr) { verticesInputExtraNode = FUXmlWriter::CreateNode(DAE_EXTRA_ELEMENT); verticesInputExtraTechniqueNode = FUXmlWriter::AddChild(verticesInputExtraNode, DAE_TECHNIQUE_ELEMENT); @@ -113,7 +113,7 @@ xmlNode* FArchiveXML::WriteGeometryMesh(FCDObject* object, xmlNode* parentNode) } } } - if (verticesInputExtraNode != NULL) AddChild(verticesNode, verticesInputExtraNode); + if (verticesInputExtraNode != nullptr) AddChild(verticesNode, verticesInputExtraNode); FUSStringBuilder verticesNodeId(geometryMesh->GetDaeId()); verticesNodeId.append("-vertices"); AddAttribute(verticesNode, DAE_ID_ATTRIBUTE, verticesNodeId); @@ -134,8 +134,8 @@ xmlNode* FArchiveXML::WriteGeometry(FCDObject* object, xmlNode* parentNode) xmlNode* geometryNode = FArchiveXML::WriteToEntityXMLFCDEntity(geometry, parentNode, DAE_GEOMETRY_ELEMENT); - if (geometry->GetMesh() != NULL) FArchiveXML::LetWriteObject(geometry->GetMesh(), geometryNode); - else if (geometry->GetSpline() != NULL) FArchiveXML::LetWriteObject(geometry->GetSpline(), geometryNode); + if (geometry->GetMesh() != nullptr) FArchiveXML::LetWriteObject(geometry->GetMesh(), geometryNode); + else if (geometry->GetSpline() != nullptr) FArchiveXML::LetWriteObject(geometry->GetSpline(), geometryNode); FArchiveXML::WriteEntityExtra(geometry, geometryNode); return geometryNode; @@ -184,7 +184,7 @@ xmlNode* FArchiveXML::WriteGeometryPolygons(FCDObject* object, xmlNode* parentNo { const FCDGeometryPolygonsInput* input = geometryPolygons->GetInput(i); const FCDGeometrySource* source = input->GetSource(); - if (source != NULL) + if (source != nullptr) { if (!geometryPolygons->GetParent()->IsVertexSource(source)) { @@ -218,7 +218,7 @@ xmlNode* FArchiveXML::WriteGeometryPolygons(FCDObject* object, xmlNode* parentNo } // For the non-holes cases, open only one

element for all the data indices - xmlNode* pNode = NULL,* phNode = NULL; + xmlNode* pNode = nullptr,* phNode = nullptr; if (!hasHoles) pNode = AddChild(polygonsNode, DAE_POLYGON_ELEMENT); // Export the data indices (tessellation information) @@ -254,7 +254,7 @@ xmlNode* FArchiveXML::WriteGeometryPolygons(FCDObject* object, xmlNode* parentNo { for (fm::pvector::iterator itI = idxOwners.begin(); itI != idxOwners.end(); ++itI) { - if ((*itI) != NULL) + if ((*itI) != nullptr) { builder.append((*itI)->GetIndices()[faceVertexIndex]); builder.append(' '); @@ -317,7 +317,7 @@ xmlNode* FArchiveXML::WriteGeometrySpline(FCDObject* object, xmlNode* parentNode for (size_t i = 0; i < geometrySpline->GetSplineCount(); ++i) { FCDSpline* colladaSpline = geometrySpline->GetSpline(i); - if (colladaSpline == NULL) continue; + if (colladaSpline == nullptr) continue; fm::string parentId = geometrySpline->GetParent()->GetDaeId(); fm::string splineId = FUStringConversion::ToString(i); @@ -332,7 +332,7 @@ xmlNode* FArchiveXML::WriteGeometrySpline(FCDObject* object, xmlNode* parentNode } } - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteNURBSSpline(FCDNURBSSpline* nURBSSpline, xmlNode* parentNode, const fm::string& parentId, const fm::string& splineId) diff --git a/FColladaPlugins/FArchiveXML/FAXGeometryImport.cpp b/FColladaPlugins/FArchiveXML/FAXGeometryImport.cpp index 79e1d5e..3e218d0 100644 --- a/FColladaPlugins/FArchiveXML/FAXGeometryImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXGeometryImport.cpp @@ -83,7 +83,7 @@ bool FArchiveXML::LoadGeometryMesh(FCDObject* object, xmlNode* meshNode) // Retrieve the node xmlNode* verticesNode = FindChildByType(meshNode, DAE_VERTICES_ELEMENT); - if (verticesNode == NULL) + if (verticesNode == nullptr) { status &= !FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_MESH_VERTICES_MISSING, meshNode->line); } @@ -102,7 +102,7 @@ bool FArchiveXML::LoadGeometryMesh(FCDObject* object, xmlNode* meshNode) { fm::string sourceId = ReadNodeSource(vertexInputNode); FCDGeometrySource* source = geometryMesh->FindSourceById(sourceId); - if (source == NULL) + if (source == nullptr) { return FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_UNKNOWN_MESH_ID, vertexInputNode->line); } @@ -122,7 +122,7 @@ bool FArchiveXML::LoadGeometryMesh(FCDObject* object, xmlNode* meshNode) // Create our rendering object and read in the tessellation xmlNodeList polygonsNodes; - for (xmlNode* childNode = meshNode->children; childNode != NULL; childNode = childNode->next) + for (xmlNode* childNode = meshNode->children; childNode != nullptr; childNode = childNode->next) { if (FCollada::CancelLoading()) return false; @@ -156,7 +156,7 @@ bool FArchiveXML::LoadGeometryMesh(FCDObject* object, xmlNode* meshNode) // Process any per-vertex input sets xmlNode* verticesExtraNode = FindChildByType(verticesNode, DAE_EXTRA_ELEMENT); verticesExtraNode = FindTechnique(verticesExtraNode, DAE_FCOLLADA_PROFILE); - if (verticesExtraNode != NULL) + if (verticesExtraNode != nullptr) { xmlNodeList extraInputNodes; FindChildrenByType(verticesExtraNode, DAE_INPUT_ELEMENT, extraInputNodes); @@ -173,12 +173,12 @@ bool FArchiveXML::LoadGeometryMesh(FCDObject* object, xmlNode* meshNode) // Find the matching per-vertex source and their polygon sets inputs. FCDGeometrySource* source = geometryMesh->FindSourceById(daeId); - if (source == NULL || !geometryMesh->IsVertexSource(source)) continue; + if (source == nullptr || !geometryMesh->IsVertexSource(source)) continue; for (size_t j = 0; j < polygonsCount; ++j) { FCDGeometryPolygons* polys = geometryMesh->GetPolygons(j); FCDGeometryPolygonsInput* input = polys->FindInput(source); - if (input == NULL) continue; + if (input == nullptr) continue; input->SetSet(set); } } @@ -194,8 +194,8 @@ bool FArchiveXML::LoadGeometry(FCDObject* object, xmlNode* geometryNode) { FCDGeometry* geometry = (FCDGeometry*)object; - geometry->SetMesh(NULL); - geometry->SetSpline(NULL); + geometry->SetMesh(nullptr); + geometry->SetSpline(nullptr); bool status = FArchiveXML::LoadEntity(object, geometryNode); if (!status) return status; @@ -206,7 +206,7 @@ bool FArchiveXML::LoadGeometry(FCDObject* object, xmlNode* geometryNode) } // Read in the first valid child element found - for (xmlNode* child = geometryNode->children; child != NULL; child = child->next) + for (xmlNode* child = geometryNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -235,7 +235,7 @@ bool FArchiveXML::LoadGeometry(FCDObject* object, xmlNode* geometryNode) } } - if (geometry->GetMesh() == NULL && geometry->GetSpline() == NULL && !geometry->IsPSurface()) + if (geometry->GetMesh() == nullptr && geometry->GetSpline() == nullptr && !geometry->IsPSurface()) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_EMPTY_GEOMETRY, geometryNode->line); } @@ -274,10 +274,10 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) } // Read in the per-face, per-vertex inputs - xmlNode* itNode = NULL; + xmlNode* itNode = nullptr; bool hasVertexInput = false; FCDGeometryPolygonsInputList idxOwners; - for (itNode = baseNode->children; itNode != NULL; itNode = itNode->next) + for (itNode = baseNode->children; itNode != nullptr; itNode = itNode->next) { if (FCollada::CancelLoading()) return false; @@ -315,8 +315,8 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) { FCDGeometrySource* vertexSource = geometryPolygons->GetParent()->GetVertexSource(i); FCDGeometryPolygonsInput* vertexInput = geometryPolygons->FindInput(vertexSource); - if (vertexInput == NULL) vertexInput = geometryPolygons->AddInput(vertexSource, offset); - if (idxOwners[offset] == NULL) idxOwners[offset] = vertexInput; + if (vertexInput == nullptr) vertexInput = geometryPolygons->AddInput(vertexSource, offset); + if (idxOwners[offset] == nullptr) idxOwners[offset] = vertexInput; vertexInput->SetSet(set); } } @@ -324,11 +324,11 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) { // Retrieve the source for this input FCDGeometrySource* source = geometryPolygons->GetParent()->FindSourceById(sourceId); - if (source != NULL) + if (source != nullptr) { FArchiveXML::SetTypeFCDGeometrySource(source, semantic); FCDGeometryPolygonsInput* input = geometryPolygons->AddInput(source, offset); - if (idxOwners[offset] == NULL) idxOwners[offset] = input; + if (idxOwners[offset] == nullptr) idxOwners[offset] = input; input->SetSet(set); } else @@ -360,7 +360,7 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_EMPTY_POLYGONS, baseNode->line); noTessellation = true; } - if (itNode == NULL) + if (itNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::WARNING_NO_POLYGON, baseNode->line); return status; @@ -377,7 +377,7 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) { // Look for the element and parse it in xmlNode* vCountNode = FindChildByType(baseNode, DAE_VERTEXCOUNT_ELEMENT); - bool hasVertexCounts = vCountNode != NULL; + bool hasVertexCounts = vCountNode != nullptr; if (isPolylist && !hasVertexCounts) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_NO_VCOUNT, baseNode->line); @@ -393,7 +393,7 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) // Process the vertex counts. const char* vCountDataString = ReadNodeContentDirect(vCountNode); UInt32List vCountData; - if (vCountDataString != NULL) FUStringConversion::ToUInt32List(vCountDataString, vCountData); + if (vCountDataString != nullptr) FUStringConversion::ToUInt32List(vCountDataString, vCountData); size_t vCountCount = vCountData.size(); geometryPolygons->SetFaceVertexCountCount(vCountCount); memcpy((void*) geometryPolygons->GetFaceVertexCounts(), vCountData.begin(), sizeof(uint32) * vCountCount); @@ -418,24 +418,24 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) // Pre-allocate the buffers with enough memory fm::pvector allIndices; - UInt32List* masterIndices = NULL; + UInt32List* masterIndices = nullptr; size_t indexStride = idxOwners.size(); allIndices.resize(indexStride); for (size_t i = 0; i < indexStride; ++i) { FCDGeometryPolygonsInput* input = idxOwners[i]; - if (input == NULL) allIndices[i] = NULL; + if (input == nullptr) allIndices[i] = nullptr; else { allIndices[i] = new UInt32List(); allIndices[i]->reserve(expectedVertexCount); - if (masterIndices == NULL) masterIndices = allIndices[i]; + if (masterIndices == nullptr) masterIndices = allIndices[i]; input->ReserveIndexCount(expectedVertexCount); } } // Process the tessellation - for (; itNode != NULL; itNode = itNode->next) + for (; itNode != nullptr; itNode = itNode->next) { if (FCollada::CancelLoading()) { @@ -447,8 +447,8 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) if (IsEquivalent(itNode->name, DAE_POLYGON_ELEMENT) || IsEquivalent(itNode->name, DAE_POLYGONHOLED_ELEMENT)) { // Retrieve the indices - xmlNode* holeNode = NULL; - const char* content = NULL; + xmlNode* holeNode = nullptr; + const char* content = nullptr; if (!IsEquivalent(itNode->name, DAE_POLYGONHOLED_ELEMENT)) { content = ReadNodeContentDirect(itNode); @@ -456,7 +456,7 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) else { // Holed face found - for (xmlNode* child = itNode->children; child != NULL; child = child->next) + for (xmlNode* child = itNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; if (IsEquivalent(child->name, DAE_POLYGON_ELEMENT)) @@ -486,11 +486,11 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) for (size_t k = 0; k < indexStride; ++k) { FCDGeometryPolygonsInput* input = idxOwners[k]; - if (input != NULL) input->AddIndices(*allIndices[k]); + if (input != nullptr) input->AddIndices(*allIndices[k]); } // Append any hole indices found - for (; holeNode != NULL; holeNode = holeNode->next) + for (; holeNode != nullptr; holeNode = holeNode->next) { if (holeNode->type != XML_ELEMENT_NODE) continue; @@ -500,7 +500,7 @@ bool FArchiveXML::LoadGeometryPolygons(FCDObject* object, xmlNode* baseNode) for (size_t k = 0; k < indexStride; ++k) { FCDGeometryPolygonsInput* input = idxOwners[k]; - if (input != NULL) input->AddIndices(*allIndices[k]); + if (input != nullptr) input->AddIndices(*allIndices[k]); } // Create the hole face and record its index @@ -562,7 +562,7 @@ bool FArchiveXML::LoadGeometrySpline(FCDObject* object, xmlNode* splineNode) bool status = true; // for each spline - for (; splineNode != NULL; splineNode = splineNode->next) + for (; splineNode != nullptr; splineNode = splineNode->next) { // is it a spline? if (!IsEquivalent(splineNode->name, DAE_SPLINE_ELEMENT)) continue; @@ -570,11 +570,11 @@ bool FArchiveXML::LoadGeometrySpline(FCDObject* object, xmlNode* splineNode) // needed extra node // TODO. those will be moved to attributes xmlNode* extraNode = FindChildByType(splineNode, DAE_EXTRA_ELEMENT); - if (extraNode == NULL) continue; + if (extraNode == nullptr) continue; xmlNode* fcolladaNode = FindTechnique(extraNode, DAE_FCOLLADA_PROFILE); - if (fcolladaNode == NULL) continue; + if (fcolladaNode == nullptr) continue; xmlNode* typeNode = FindChildByType(fcolladaNode, DAE_TYPE_ATTRIBUTE); - if (typeNode == NULL) continue; + if (typeNode == nullptr) continue; // get the spline type FUDaeSplineType::Type splineType = FUDaeSplineType::FromString(ReadNodeContentFull(typeNode)); @@ -609,7 +609,7 @@ bool FArchiveXML::LoadSpline(FCDObject* object, xmlNode* splineNode) // Read in the element, which define the base type for this curve xmlNode* controlVerticesNode = FindChildByType(splineNode, DAE_CONTROL_VERTICES_ELEMENT); - if (controlVerticesNode == NULL) + if (controlVerticesNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_CONTROL_VERTICES_MISSING, splineNode->line); return false; @@ -624,7 +624,7 @@ bool FArchiveXML::LoadSpline(FCDObject* object, xmlNode* splineNode) fm::string sourceId = ReadNodeProperty(inputNode, DAE_SOURCE_ATTRIBUTE); if (sourceId.empty()) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return false; } xmlNode* sourceNode = FindChildById(splineNode, sourceId); - if (sourceNode == NULL) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return false; } + if (sourceNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return false; } if (IsEquivalent(ReadNodeProperty(inputNode, DAE_SEMANTIC_ATTRIBUTE), DAE_CVS_SPLINE_INPUT)) { @@ -660,17 +660,17 @@ bool FArchiveXML::LoadNURBSSpline(FCDObject* object, xmlNode* splineNode) FCDNURBSSpline* nurbsSpline = (FCDNURBSSpline*)object; xmlNode* extraNode = FindChildByType(splineNode, DAE_EXTRA_ELEMENT); - if (extraNode == NULL) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } + if (extraNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } xmlNode* fcolladaNode = FindTechnique(extraNode, DAE_FCOLLADA_PROFILE); - if (fcolladaNode == NULL) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } + if (fcolladaNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } // Read in the NURBS degree xmlNode* degreeNode = FindChildByType(fcolladaNode, DAE_DEGREE_ATTRIBUTE); - nurbsSpline->SetDegree((degreeNode != NULL) ? FUStringConversion::ToUInt32(ReadNodeContentDirect(degreeNode)) : 3); + nurbsSpline->SetDegree((degreeNode != nullptr) ? FUStringConversion::ToUInt32(ReadNodeContentDirect(degreeNode)) : 3); // Read in the element, which define the base type for this curve xmlNode* controlVerticesNode = FindChildByType(splineNode, DAE_CONTROL_VERTICES_ELEMENT); - if (controlVerticesNode == NULL) + if (controlVerticesNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_CONTROL_VERTICES_MISSING, splineNode->line); return status; @@ -686,7 +686,7 @@ bool FArchiveXML::LoadNURBSSpline(FCDObject* object, xmlNode* splineNode) fm::string sourceId = ReadNodeProperty(inputNode, DAE_SOURCE_ATTRIBUTE).substr(1); if (sourceId.empty()) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } xmlNode* sourceNode = FindChildById(splineNode, sourceId); - if (sourceNode == NULL) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } + if (sourceNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_DEFAULT_ERROR); return status; } else if (IsEquivalent(ReadNodeProperty(inputNode, DAE_SEMANTIC_ATTRIBUTE), DAE_KNOT_SPLINE_INPUT)) { diff --git a/FColladaPlugins/FArchiveXML/FAXImportLinking.cpp b/FColladaPlugins/FArchiveXML/FAXImportLinking.cpp index 337d22f..f672a7d 100644 --- a/FColladaPlugins/FArchiveXML/FAXImportLinking.cpp +++ b/FColladaPlugins/FArchiveXML/FAXImportLinking.cpp @@ -116,7 +116,7 @@ bool FArchiveXML::LinkAnimation(FCDAnimation* animation) bool FArchiveXML::LinkAnimated(FCDAnimated* animated, xmlNode* node) { bool linked; - if (node != NULL) + if (node != nullptr) { // Write down the expected target string for the given node FCDAnimatedData data; @@ -150,7 +150,7 @@ bool FArchiveXML::LinkAnimatedCustom(FCDAnimatedCustom* animatedCustom, xmlNode* { bool linked = false; - if (node != NULL) + if (node != nullptr) { // Retrieve the list of the channels pointing to this node FCDAnimatedData data; @@ -220,7 +220,7 @@ bool FArchiveXML::LinkTargetedEntity(FCDTargetedEntity* targetedEntity) if (!targetUri.IsFile() && !targetUri.GetFragment().empty()) { FCDSceneNode* target = targetedEntity->GetDocument()->FindSceneNode(TO_STRING(targetUri.GetFragment())); - if (target == NULL) + if (target == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_TARGET_SCENE_NODE_MISSING); } @@ -332,7 +332,7 @@ void FArchiveXML::LinkEffectParameterSurface(FCDEffectParameterSurface* effectPa for (StringList::iterator itN = effectParameterSurface->GetNames().begin(); itN != effectParameterSurface->GetNames().end(); ++itN) { FCDImage* image = effectParameterSurface->GetDocument()->FindImage(*itN); - if (image != NULL) + if (image != nullptr) { effectParameterSurface->AddImage(image); } @@ -345,7 +345,7 @@ void FArchiveXML::LinkEffectParameterSampler(FCDEffectParameterSampler* effectPa FUAssert(it != FArchiveXML::documentLinkDataMap[effectParameterSampler->GetDocument()].effectParameterSamplerDataMap.end(),); FCDEffectParameterSamplerData& data = it->second; - FCDEffectParameter* surface = NULL; + FCDEffectParameter* surface = nullptr; size_t count = parameters.size(); for (size_t i = 0; i < count; ++i) { @@ -355,7 +355,7 @@ void FArchiveXML::LinkEffectParameterSampler(FCDEffectParameterSampler* effectPa break; } } - FUAssert(surface == NULL || surface->HasType(FCDEffectParameterSurface::GetClassType()), return); + FUAssert(surface == nullptr || surface->HasType(FCDEffectParameterSurface::GetClassType()), return); effectParameterSampler->SetSurface((FCDEffectParameterSurface*) surface); data.surfaceSid.clear(); @@ -477,10 +477,10 @@ void FArchiveXML::LinkTexture(FCDTexture* texture, FCDEffectParameterList& param if (!data.samplerSid.empty()) { // Check for the sampler parameter in the parent profile and the effect. - if (texture->GetParent() != NULL) + if (texture->GetParent() != nullptr) { const fm::string& cleanRef = FCDObjectWithId::CleanSubId(data.samplerSid); - FCDEffectParameterSampler* sampler = NULL; + FCDEffectParameterSampler* sampler = nullptr; size_t parameterCount = parameters.size(); for (size_t p = 0; p < parameterCount; ++p) { @@ -490,7 +490,7 @@ void FArchiveXML::LinkTexture(FCDTexture* texture, FCDEffectParameterList& param break; } } - if (sampler != NULL) texture->SetSampler(sampler); + if (sampler != nullptr) texture->SetSampler(sampler); } if (!texture->HasSampler() && !data.samplerSid.empty()) @@ -510,7 +510,7 @@ void FArchiveXML::LinkTexture(FCDTexture* texture, FCDEffectParameterList& param bool FArchiveXML::LinkController(FCDController* controller) { bool ret = true; - if (controller->GetBaseTarget() == NULL) + if (controller->GetBaseTarget() == nullptr) { if (controller->IsSkin()) { @@ -524,7 +524,7 @@ bool FArchiveXML::LinkController(FCDController* controller) // If our target is a controller, link it too. FCDEntity* entity = controller->GetBaseTarget(); - if (entity != NULL && entity->GetType() == FCDEntity::CONTROLLER) + if (entity != nullptr && entity->GetType() == FCDEntity::CONTROLLER) { ret &= FArchiveXML::LinkController((FCDController*)entity); } @@ -544,12 +544,12 @@ bool FArchiveXML::LinkMorphController(FCDMorphController* morphController) FUAssert(it != FArchiveXML::documentLinkDataMap[morphController->GetDocument()].morphControllerDataMap.end(),); FCDMorphControllerData& data = it->second; - if (morphController->GetBaseTarget() == NULL) + if (morphController->GetBaseTarget() == nullptr) { fm::string targetId = SkipPound(data.targetId); FCDEntity* baseTarget = morphController->GetDocument()->FindGeometry(targetId); - if (baseTarget == NULL) baseTarget = morphController->GetDocument()->FindController(data.targetId); - if (baseTarget == NULL) + if (baseTarget == nullptr) baseTarget = morphController->GetDocument()->FindController(data.targetId); + if (baseTarget == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_UNKNOWN_MC_BASE_TARGET_MISSING, 0); return false; @@ -572,10 +572,10 @@ bool FArchiveXML::LinkGeometryMesh(FCDGeometryMesh* geometryMesh) if (concaveGeom) { FCDGeometryMesh* origMesh = concaveGeom->GetMesh(); - if (origMesh != NULL) + if (origMesh != nullptr) { origMesh->Clone(geometryMesh); - geometryMesh->SetConvexify(geometryMesh != NULL); + geometryMesh->SetConvexify(geometryMesh != nullptr); geometryMesh->SetConvex(true); // may have been overwritten by clone } return status; diff --git a/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp b/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp index 9dafc27..81d5cfe 100644 --- a/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXInstanceExport.cpp @@ -138,7 +138,7 @@ xmlNode* FArchiveXML::WriteControllerInstance(FCDObject* object, xmlNode* parent // Export the geometry instantiation information. xmlNode* instanceNode = FArchiveXML::WriteGeometryInstance(controllerInstance, parentNode); - xmlNode* insertBeforeNode = (instanceNode != NULL) ? instanceNode->children : NULL; + xmlNode* insertBeforeNode = (instanceNode != nullptr) ? instanceNode->children : nullptr; // Retrieve the parent joints and export the elements. FUUriList& skeletonRoots = controllerInstance->GetSkeletonRoots(); @@ -269,7 +269,7 @@ xmlNode* FArchiveXML::WritePhysicsRigidConstraintInstance(FCDObject* object, xml xmlNode* instanceNode = FArchiveXML::WriteEntityInstance(physicsRigidConstraintInstance, parentNode); - if (physicsRigidConstraintInstance->GetEntity() != NULL && physicsRigidConstraintInstance->GetEntity()->GetObjectType() == FCDPhysicsRigidConstraint::GetClassType()) + if (physicsRigidConstraintInstance->GetEntity() != nullptr && physicsRigidConstraintInstance->GetEntity()->GetObjectType() == FCDPhysicsRigidConstraint::GetClassType()) { FCDPhysicsRigidConstraint* constraint = (FCDPhysicsRigidConstraint*) physicsRigidConstraintInstance->GetEntity(); AddAttribute(instanceNode, DAE_CONSTRAINT_ATTRIBUTE, constraint->GetSubId()); diff --git a/FColladaPlugins/FArchiveXML/FAXInstanceImport.cpp b/FColladaPlugins/FArchiveXML/FAXInstanceImport.cpp index 46afd30..b9c74a1 100644 --- a/FColladaPlugins/FArchiveXML/FAXInstanceImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXInstanceImport.cpp @@ -36,7 +36,7 @@ bool FArchiveXML::LoadEntityInstance(FCDObject* object, xmlNode* instanceNode) FUUri uri = ReadNodeUrl(instanceNode); entityInstance->GetEntityReference()->SetUri(uri); - if (!entityInstance->IsExternalReference() && entityInstance->GetEntity() == NULL) + if (!entityInstance->IsExternalReference() && entityInstance->GetEntity() == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INST_ENTITY_MISSING, instanceNode->line); } @@ -86,9 +86,9 @@ bool FArchiveXML::LoadGeometryInstance(FCDObject* object, xmlNode* instanceNode) // Look for the element. The others are discarded for now. xmlNode* bindMaterialNode = FindChildByType(instanceNode, DAE_BINDMATERIAL_ELEMENT); - if (bindMaterialNode != NULL) + if (bindMaterialNode != nullptr) { - for (xmlNode* child = bindMaterialNode->children; child != NULL; child = child->next) + for (xmlNode* child = bindMaterialNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -114,7 +114,7 @@ bool FArchiveXML::LoadGeometryInstance(FCDObject* object, xmlNode* instanceNode) { // Blinding attempt to use the material semantic from the polygons as a material id. FCDGeometry* geometry = (FCDGeometry*) geometryInstance->GetEntity(); - if (geometry != NULL && geometry->HasType(FCDGeometry::GetClassType()) && geometry->IsMesh()) + if (geometry != nullptr && geometry->HasType(FCDGeometry::GetClassType()) && geometry->IsMesh()) { FCDGeometryMesh* mesh = geometry->GetMesh(); size_t polyCount = mesh->GetPolygonsCount(); @@ -125,7 +125,7 @@ bool FArchiveXML::LoadGeometryInstance(FCDObject* object, xmlNode* instanceNode) fm::string semanticUTF8 = TO_STRING(semantic); semanticUTF8 = FCDObjectWithId::CleanId(semanticUTF8.c_str()); FCDMaterial* material = geometry->GetDocument()->FindMaterial(semanticUTF8); - if (material != NULL) + if (material != nullptr) { geometryInstance->AddMaterialInstance(material, polys); } @@ -202,7 +202,7 @@ bool FArchiveXML::LoadPhysicsForceFieldInstance(FCDObject* object, xmlNode* inst bool status = true; FCDPhysicsForceFieldInstance* physicsForceFieldInstance = (FCDPhysicsForceFieldInstance*)object; - if (physicsForceFieldInstance->GetEntity() == NULL && !physicsForceFieldInstance->IsExternalReference()) + if (physicsForceFieldInstance->GetEntity() == nullptr && !physicsForceFieldInstance->IsExternalReference()) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_INVALID_URI, instanceNode->line); @@ -229,7 +229,7 @@ bool FArchiveXML::LoadPhysicsModelInstance(FCDObject* object, xmlNode* instanceN bool status = true; FCDPhysicsModelInstance* physicsModelInstance = (FCDPhysicsModelInstance*)object; - if (physicsModelInstance->GetEntity() == NULL) + if (physicsModelInstance->GetEntity() == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::WARNING_MISSING_URI_TARGET, instanceNode->line); } @@ -249,7 +249,7 @@ bool FArchiveXML::LoadPhysicsModelInstance(FCDObject* object, xmlNode* instanceN FindChildrenByType(instanceNode, DAE_INSTANCE_RIGID_BODY_ELEMENT, rigidBodyNodes); for (xmlNodeList::iterator itB = rigidBodyNodes.begin(); itB != rigidBodyNodes.end(); ++itB) { - FCDPhysicsRigidBodyInstance* instance = physicsModelInstance->AddRigidBodyInstance(NULL); + FCDPhysicsRigidBodyInstance* instance = physicsModelInstance->AddRigidBodyInstance(nullptr); status &= (FArchiveXML::LoadPhysicsRigidBodyInstance(instance, *itB)); } @@ -257,7 +257,7 @@ bool FArchiveXML::LoadPhysicsModelInstance(FCDObject* object, xmlNode* instanceN FindChildrenByType(instanceNode, DAE_INSTANCE_RIGID_CONSTRAINT_ELEMENT, rigidConstraintNodes); for (xmlNodeList::iterator itC = rigidConstraintNodes.begin(); itC != rigidConstraintNodes.end(); ++itC) { - FCDPhysicsRigidConstraintInstance* instance = physicsModelInstance->AddRigidConstraintInstance(NULL); + FCDPhysicsRigidConstraintInstance* instance = physicsModelInstance->AddRigidConstraintInstance(nullptr); status &= (FArchiveXML::LoadPhysicsRigidConstraintInstance(instance, *itC)); } @@ -265,7 +265,7 @@ bool FArchiveXML::LoadPhysicsModelInstance(FCDObject* object, xmlNode* instanceN FindChildrenByType(instanceNode, DAE_INSTANCE_FORCE_FIELD_ELEMENT, forceFieldNodes); for (xmlNodeList::iterator itN = forceFieldNodes.begin(); itN != forceFieldNodes.end(); ++itN) { - FCDPhysicsForceFieldInstance* instance = physicsModelInstance->AddForceFieldInstance(NULL); + FCDPhysicsForceFieldInstance* instance = physicsModelInstance->AddForceFieldInstance(nullptr); status &= (FArchiveXML::LoadPhysicsForceFieldInstance(instance, *itN)); } @@ -281,7 +281,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyInstance(FCDObject* object, xmlNode* insta FCDPhysicsRigidBodyInstance* physicsRigidBodyInstance = (FCDPhysicsRigidBodyInstance*)object; // Check for the expected instantiation node type - if (!IsEquivalent(instanceNode->name, DAE_INSTANCE_RIGID_BODY_ELEMENT) || physicsRigidBodyInstance->GetModelParentInstance() == NULL) + if (!IsEquivalent(instanceNode->name, DAE_INSTANCE_RIGID_BODY_ELEMENT) || physicsRigidBodyInstance->GetModelParentInstance() == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_UNKNOWN_ELEMENT, instanceNode->line); status = false; @@ -296,13 +296,13 @@ bool FArchiveXML::LoadPhysicsRigidBodyInstance(FCDObject* object, xmlNode* insta } // Find the instantiated rigid body - FCDPhysicsRigidBody* body = NULL; + FCDPhysicsRigidBody* body = nullptr; fm::string physicsRigidBodySid = ReadNodeProperty(instanceNode, DAE_BODY_ATTRIBUTE); - if (physicsRigidBodyInstance->GetModelParentInstance()->GetEntity() != NULL && physicsRigidBodyInstance->GetModelParentInstance()->GetEntity()->GetType() == FCDEntity::PHYSICS_MODEL) + if (physicsRigidBodyInstance->GetModelParentInstance()->GetEntity() != nullptr && physicsRigidBodyInstance->GetModelParentInstance()->GetEntity()->GetType() == FCDEntity::PHYSICS_MODEL) { FCDPhysicsModel* model = (FCDPhysicsModel*) physicsRigidBodyInstance->GetModelParentInstance()->GetEntity(); body = model->FindRigidBodyFromSid(physicsRigidBodySid); - if (body == NULL) + if (body == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::WARNING_MISSING_URI_TARGET, instanceNode->line); return false; @@ -312,7 +312,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyInstance(FCDObject* object, xmlNode* insta //Read in the same children as rigid_body + velocity and angular_velocity xmlNode* techniqueNode = FindChildByType(instanceNode, DAE_TECHNIQUE_COMMON_ELEMENT); - if (techniqueNode == NULL) + if (techniqueNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_TECHNIQUE_NODE_MISSING, instanceNode->line); @@ -321,7 +321,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyInstance(FCDObject* object, xmlNode* insta xmlNode* param = FindChildByType(techniqueNode, DAE_ANGULAR_VELOCITY_ELEMENT); - if (param != NULL) + if (param != nullptr) { physicsRigidBodyInstance->SetAngularVelocity(FUStringConversion::ToVector3( ReadNodeContentDirect(param))); @@ -332,7 +332,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyInstance(FCDObject* object, xmlNode* insta } param = FindChildByType(techniqueNode, DAE_VELOCITY_ELEMENT); - if (param != NULL) + if (param != nullptr) { physicsRigidBodyInstance->SetVelocity(FUStringConversion::ToVector3(ReadNodeContentDirect(param))); } @@ -356,8 +356,8 @@ bool FArchiveXML::LoadPhysicsRigidConstraintInstance(FCDObject* object, xmlNode* // Check for the expected instantiation node type if (!IsEquivalent(instanceNode->name, DAE_INSTANCE_RIGID_CONSTRAINT_ELEMENT) - || physicsRigidConstraintInstance->GetModelParentInstance() == NULL - || physicsRigidConstraintInstance->GetModelParentInstance()->GetEntity() == NULL) + || physicsRigidConstraintInstance->GetModelParentInstance() == nullptr + || physicsRigidConstraintInstance->GetModelParentInstance()->GetEntity() == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_UNKNOWN_ELEMENT, instanceNode->line); status = false; @@ -379,7 +379,7 @@ bool FArchiveXML::LoadPhysicsRigidConstraintInstance(FCDObject* object, xmlNode* bool FArchiveXML::LinkControllerInstance(FCDControllerInstance* controllerInstance) { const FCDSkinController* skin = FArchiveXML::FindSkinController(controllerInstance, controllerInstance->GetEntity()); - if (skin == NULL) return true; + if (skin == nullptr) return true; FCDSkinControllerData& data = FArchiveXML::documentLinkDataMap[skin->GetDocument()].skinControllerDataMap.find(const_cast(skin))->second; // Look for each joint, by COLLADA id, within the scene graph @@ -393,7 +393,7 @@ bool FArchiveXML::LinkControllerInstance(FCDControllerInstance* controllerInstan for (size_t i = 0; i < jointCount; ++i) { const fm::string& jid = skin->GetJoint(i)->GetId(); - FCDSceneNode* boneNode = NULL; + FCDSceneNode* boneNode = nullptr; if (data.jointAreSids) { @@ -401,7 +401,7 @@ bool FArchiveXML::LinkControllerInstance(FCDControllerInstance* controllerInstan for (size_t i = 0; i < numRoots; i++) { boneNode = (FCDSceneNode*)rootNodes[i]->FindSubId(jid); - if (boneNode != NULL) break; + if (boneNode != nullptr) break; } } else @@ -410,11 +410,11 @@ bool FArchiveXML::LinkControllerInstance(FCDControllerInstance* controllerInstan for (size_t i = 0; i < numRoots; i++) { boneNode = (FCDSceneNode*)rootNodes[i]->FindDaeId(jid); - if (boneNode != NULL) break; + if (boneNode != nullptr) break; } } - if (boneNode != NULL) + if (boneNode != nullptr) { controllerInstance->AddJoint(boneNode); } diff --git a/FColladaPlugins/FArchiveXML/FAXLightExport.cpp b/FColladaPlugins/FArchiveXML/FAXLightExport.cpp index 666268a..569beaa 100644 --- a/FColladaPlugins/FArchiveXML/FAXLightExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXLightExport.cpp @@ -101,6 +101,6 @@ xmlNode* FArchiveXML::WriteLight(FCDObject* object, xmlNode* parentNode) // Export the elements and release the temporarily-added parameters/technique FArchiveXML::WriteTargetedEntityExtra(light, lightNode); CLEAR_POINTER_VECTOR(extraParameterNodes); - if (techniqueNode != NULL && techniqueNode->GetChildNodeCount() == 0) SAFE_RELEASE(techniqueNode); + if (techniqueNode != nullptr && techniqueNode->GetChildNodeCount() == 0) SAFE_RELEASE(techniqueNode); return lightNode; } diff --git a/FColladaPlugins/FArchiveXML/FAXLightImport.cpp b/FColladaPlugins/FArchiveXML/FAXLightImport.cpp index 5495648..bd42684 100644 --- a/FColladaPlugins/FArchiveXML/FAXLightImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXLightImport.cpp @@ -29,8 +29,8 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) xmlNode* commonTechniqueNode = FindChildByType(lightNode, DAE_TECHNIQUE_COMMON_ELEMENT); // Look for the , , or element under the common-profile technique - xmlNode* lightParameterNode = NULL; - for (xmlNode* child = commonTechniqueNode->children; child != NULL; child = child->next) + xmlNode* lightParameterNode = nullptr; + for (xmlNode* child = commonTechniqueNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; if (IsEquivalent(child->name, DAE_LIGHT_POINT_ELEMENT)) { lightParameterNode = child; light->SetLightType(FCDLight::POINT); break; } @@ -44,7 +44,7 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) } // Verify the light's basic structures are found - if (lightParameterNode == NULL) + if (lightParameterNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_MISSING_ELEMENT, lightNode->line); } @@ -108,7 +108,7 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) technique->FindParameters(extraParameters, extraParameterNames); } - FCDENode* penumbraNode = NULL; + FCDENode* penumbraNode = nullptr; size_t extraParameterCount = extraParameters.size(); for (size_t p = 0; p < extraParameterCount; ++p) @@ -116,7 +116,7 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) FCDENode* extraParameterNode = extraParameters[p]; const fm::string& parameterName = extraParameterNames[p]; const fchar* content = extraParameterNode->GetContent(); - FCDParameterAnimatableFloat* fpValue = NULL; + FCDParameterAnimatableFloat* fpValue = nullptr; if (parameterName == DAE_FALLOFFEXPONENT_LIGHT_PARAMETER) { @@ -159,7 +159,7 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) else continue; // If we have requested a value, convert and animate it - if (fpValue != NULL) + if (fpValue != nullptr) { *fpValue = FUStringConversion::ToFloat(content); if (extraParameterNode->GetAnimated()->HasCurve()) @@ -172,7 +172,7 @@ bool FArchiveXML::LoadLight(FCDObject* object, xmlNode* lightNode) SAFE_RELEASE(extraParameterNode); } - if (penumbraNode != NULL) + if (penumbraNode != nullptr) { float penumbraValue = FUStringConversion::ToFloat(penumbraNode->GetContent()); FCDAnimated* penumbraAnimatedValue = penumbraNode->GetAnimated(); diff --git a/FColladaPlugins/FArchiveXML/FAXMaterialExport.cpp b/FColladaPlugins/FArchiveXML/FAXMaterialExport.cpp index a68ce53..50acae0 100644 --- a/FColladaPlugins/FArchiveXML/FAXMaterialExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXMaterialExport.cpp @@ -36,7 +36,7 @@ xmlNode* FArchiveXML::WriteMaterial(FCDObject* object, xmlNode* parentNode) // The element is required in COLLADA 1.4 xmlNode* instanceEffectNode = AddChild(materialNode, DAE_INSTANCE_EFFECT_ELEMENT); - if (material->GetEffect() != NULL) + if (material->GetEffect() != nullptr) { const FUUri& uri = material->GetEffectReference()->GetUri(); fstring uriString = material->GetDocument()->GetFileManager()->CleanUri(uri); @@ -72,8 +72,8 @@ xmlNode* FArchiveXML::WriteEffectCode(FCDObject* object, xmlNode* parentNode) // Place the new element at the correct position in the XML. // This is necessary for FX profiles. - xmlNode* includeAtNode = NULL; - for (xmlNode* n = parentNode->children; n != NULL; n = n->next) + xmlNode* includeAtNode = nullptr; + for (xmlNode* n = parentNode->children; n != nullptr; n = n->next) { if (n->type != XML_ELEMENT_NODE) continue; else if (IsEquivalent(n->name, DAE_ASSET_ELEMENT)) continue; @@ -89,7 +89,7 @@ xmlNode* FArchiveXML::WriteEffectCode(FCDObject* object, xmlNode* parentNode) switch (effectCode->GetType()) { case FCDEffectCode::CODE: - if (includeAtNode == NULL) codeNode = AddChild(parentNode, DAE_FXCMN_CODE_ELEMENT); + if (includeAtNode == nullptr) codeNode = AddChild(parentNode, DAE_FXCMN_CODE_ELEMENT); else codeNode = InsertChild(parentNode, includeAtNode, DAE_FXCMN_CODE_ELEMENT); AddContent(codeNode, effectCode->GetCode()); if (_sid.empty()) _sid = "code"; @@ -97,7 +97,7 @@ xmlNode* FArchiveXML::WriteEffectCode(FCDObject* object, xmlNode* parentNode) break; case FCDEffectCode::INCLUDE: { - if (includeAtNode == NULL) codeNode = AddChild(parentNode, DAE_FXCMN_INCLUDE_ELEMENT); + if (includeAtNode == nullptr) codeNode = AddChild(parentNode, DAE_FXCMN_INCLUDE_ELEMENT); else codeNode = InsertChild(parentNode, includeAtNode, DAE_FXCMN_INCLUDE_ELEMENT); if (_sid.empty()) _sid = "include"; AddNodeSid(codeNode, _sid); @@ -107,7 +107,7 @@ xmlNode* FArchiveXML::WriteEffectCode(FCDObject* object, xmlNode* parentNode) break; } default: - codeNode = NULL; + codeNode = nullptr; } return codeNode; } @@ -259,7 +259,7 @@ xmlNode* FArchiveXML::WriteEffectParameterSampler(FCDObject* object, xmlNode* pa default: samplerName = DAEERR_UNKNOWN_ELEMENT; break; } xmlNode* samplerNode = AddChild(parameterNode, samplerName); - AddChild(samplerNode, DAE_SOURCE_ELEMENT, effectParameterSampler->GetSurface() != NULL ? effectParameterSampler->GetSurface()->GetReference() : ""); + AddChild(samplerNode, DAE_SOURCE_ELEMENT, effectParameterSampler->GetSurface() != nullptr ? effectParameterSampler->GetSurface()->GetReference() : ""); switch (effectParameterSampler->GetSamplerType()) { @@ -305,7 +305,7 @@ xmlNode* FArchiveXML::WriteEffectParameterSurface(FCDObject* object, xmlNode* pa xmlNode* surfaceNode = AddChild(parameterNode, DAE_FXCMN_SURFACE_ELEMENT); AddAttribute(surfaceNode, DAE_TYPE_ATTRIBUTE, effectParameterSurface->GetSurfaceType()); - if (effectParameterSurface->GetInitMethod() != NULL) + if (effectParameterSurface->GetInitMethod() != nullptr) { switch (effectParameterSurface->GetInitMethod()->GetInitType()) { @@ -550,7 +550,7 @@ xmlNode* FArchiveXML::WriteEffectPassShader(FCDObject* object, xmlNode* parentNo if (!effectPassShader->GetName().empty()) { xmlNode* nameNode = AddChild(shaderNode, DAE_FXCMN_NAME_ELEMENT, effectPassShader->GetName()); - if (effectPassShader->GetCode() != NULL) AddAttribute(nameNode, DAE_SOURCE_ATTRIBUTE, effectPassShader->GetCode()->GetSubId()); + if (effectPassShader->GetCode() != nullptr) AddAttribute(nameNode, DAE_SOURCE_ATTRIBUTE, effectPassShader->GetCode()->GetSubId()); } // Write out the bindings @@ -962,7 +962,7 @@ xmlNode* FArchiveXML::WriteEffectStandard(FCDObject* object, xmlNode* parentNode // Non-COLLADA parameters if (effectStandard->GetTextureCount(FUDaeTextureChannel::BUMP) > 0) { - FArchiveXML::WriteFloatTextureParameter(effectStandard, techniqueNode, DAE_BUMP_MATERIAL_PARAMETER, NULL, FUDaeTextureChannel::BUMP); + FArchiveXML::WriteFloatTextureParameter(effectStandard, techniqueNode, DAE_BUMP_MATERIAL_PARAMETER, nullptr, FUDaeTextureChannel::BUMP); } if (effectStandard->IsEmissionFactor()) { @@ -970,15 +970,15 @@ xmlNode* FArchiveXML::WriteEffectStandard(FCDObject* object, xmlNode* parentNode } if (effectStandard->GetTextureCount(FUDaeTextureChannel::DISPLACEMENT) > 0) { - FArchiveXML::WriteFloatTextureParameter(effectStandard, techniqueNode, DAEMAX_DISPLACEMENT_MATERIAL_PARAMETER, NULL, FUDaeTextureChannel::DISPLACEMENT); + FArchiveXML::WriteFloatTextureParameter(effectStandard, techniqueNode, DAEMAX_DISPLACEMENT_MATERIAL_PARAMETER, nullptr, FUDaeTextureChannel::DISPLACEMENT); } if (effectStandard->GetTextureCount(FUDaeTextureChannel::FILTER) > 0) { - FArchiveXML::WriteColorTextureParameter(effectStandard, techniqueNode, DAEMAX_FILTERCOLOR_MATERIAL_PARAMETER, NULL, FUDaeTextureChannel::FILTER); + FArchiveXML::WriteColorTextureParameter(effectStandard, techniqueNode, DAEMAX_FILTERCOLOR_MATERIAL_PARAMETER, nullptr, FUDaeTextureChannel::FILTER); } if (effectStandard->GetTextureCount(FUDaeTextureChannel::REFRACTION) > 0) { - FArchiveXML::WriteColorTextureParameter(effectStandard, techniqueNode, DAEMAX_INDEXOFREFRACTION_MATERIAL_PARAMETER, NULL, FUDaeTextureChannel::REFRACTION); + FArchiveXML::WriteColorTextureParameter(effectStandard, techniqueNode, DAEMAX_INDEXOFREFRACTION_MATERIAL_PARAMETER, nullptr, FUDaeTextureChannel::REFRACTION); } FArchiveXML::LetWriteObject(effectStandard->GetExtra(), profileNode); @@ -1055,8 +1055,8 @@ xmlNode* FArchiveXML::WriteTexture(FCDObject* object, xmlNode* parentNode) // Create the element xmlNode* textureNode = AddChild(parentNode, DAE_TEXTURE_ELEMENT); - AddAttribute(textureNode, DAE_FXSTD_TEXTURE_ATTRIBUTE, (texture->GetSampler() != NULL) ? texture->GetSampler()->GetReference() : ""); - AddAttribute(textureNode, DAE_FXSTD_TEXTURESET_ATTRIBUTE, (texture->GetSet() != NULL) ? texture->GetSet()->GetSemantic() : ""); + AddAttribute(textureNode, DAE_FXSTD_TEXTURE_ATTRIBUTE, (texture->GetSampler() != nullptr) ? texture->GetSampler()->GetReference() : ""); + AddAttribute(textureNode, DAE_FXSTD_TEXTURESET_ATTRIBUTE, (texture->GetSet() != nullptr) ? texture->GetSet()->GetSemantic() : ""); FArchiveXML::LetWriteObject(texture->GetExtra(), textureNode); return textureNode; } @@ -1085,7 +1085,7 @@ xmlNode* FArchiveXML::WriteImage(FCDObject* object, xmlNode* parentNode) xmlNode* FArchiveXML::WriteColorTextureParameter(FCDEffectStandard* effectStandard, xmlNode* parentNode, const char* parameterNodeName, const FCDEffectParameterColor4* value, uint32 bucketIndex) { xmlNode* parameterNode = AddChild(parentNode, parameterNodeName); - if (FArchiveXML::WriteTextureParameter(effectStandard, parameterNode, bucketIndex) == NULL) + if (FArchiveXML::WriteTextureParameter(effectStandard, parameterNode, bucketIndex) == nullptr) { if (value->IsConstant()) { @@ -1106,7 +1106,7 @@ xmlNode* FArchiveXML::WriteColorTextureParameter(FCDEffectStandard* effectStanda xmlNode* FArchiveXML::WriteFloatTextureParameter(FCDEffectStandard* effectStandard, xmlNode* parentNode, const char* parameterNodeName, const FCDEffectParameterFloat* value, uint32 bucketIndex) { xmlNode* parameterNode = AddChild(parentNode, parameterNodeName); - if (FArchiveXML::WriteTextureParameter(effectStandard, parameterNode, bucketIndex) == NULL) + if (FArchiveXML::WriteTextureParameter(effectStandard, parameterNode, bucketIndex) == nullptr) { if (value->IsConstant()) { @@ -1124,14 +1124,14 @@ xmlNode* FArchiveXML::WriteFloatTextureParameter(FCDEffectStandard* effectStanda xmlNode* FArchiveXML::WriteTextureParameter(FCDEffectStandard* effectStandard, xmlNode* parentNode, uint32 bucketIndex) { - xmlNode* textureNode = NULL; + xmlNode* textureNode = nullptr; if (bucketIndex != FUDaeTextureChannel::UNKNOWN) { size_t textureCount = effectStandard->GetTextureCount(bucketIndex); for (size_t t = 0; t < textureCount; ++t) { xmlNode* newTextureNode = FArchiveXML::LetWriteObject(effectStandard->GetTexture(bucketIndex, t), parentNode); - if (newTextureNode != NULL && textureNode == NULL) textureNode = newTextureNode; + if (newTextureNode != nullptr && textureNode == nullptr) textureNode = newTextureNode; } } return textureNode; diff --git a/FColladaPlugins/FArchiveXML/FAXMaterialImport.cpp b/FColladaPlugins/FArchiveXML/FAXMaterialImport.cpp index 84a26c5..87da08b 100644 --- a/FColladaPlugins/FArchiveXML/FAXMaterialImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXMaterialImport.cpp @@ -48,7 +48,7 @@ bool FArchiveXML::LoadMaterial(FCDObject* object, xmlNode* materialNode) // Read in the effect pointer node xmlNode* effectNode = FindChildByType(materialNode, DAE_INSTANCE_EFFECT_ELEMENT); - if (effectNode == NULL) + if (effectNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::ERROR_MISSING_ELEMENT, materialNode->line); } @@ -57,7 +57,7 @@ bool FArchiveXML::LoadMaterial(FCDObject* object, xmlNode* materialNode) material->GetEffectReference()->SetUri(url); // Read in the parameter modifications - for (xmlNode* child = effectNode->children; child != NULL; child = child->next) + for (xmlNode* child = effectNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -74,7 +74,7 @@ bool FArchiveXML::LoadMaterial(FCDObject* object, xmlNode* materialNode) } } - if (material->GetEffectReference()->IsLocal() && material->GetEffectReference()->GetEntity() == NULL) + if (material->GetEffectReference()->IsLocal() && material->GetEffectReference()->GetEntity() == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_EFFECT_MISSING, materialNode->line); return status; @@ -133,7 +133,7 @@ bool FArchiveXML::LoadEffectParameter(FCDObject* object, xmlNode* parameterNode) FCDEffectParameterAnnotation* annotation = effectParameter->AddAnnotation(); annotation->name = TO_FSTRING(ReadNodeProperty(annotateNode, DAE_NAME_ATTRIBUTE)); - for (xmlNode* valueNode = annotateNode->children; valueNode != NULL; valueNode = valueNode->next) + for (xmlNode* valueNode = annotateNode->children; valueNode != nullptr; valueNode = valueNode->next) { if (valueNode->type != XML_ELEMENT_NODE) continue; if (IsEquivalent(valueNode->name, DAE_FXCMN_STRING_ELEMENT)) { annotation->type = FCDEffectParameter::STRING; annotation->value = TO_FSTRING(ReadNodeContentFull(valueNode)); } @@ -185,7 +185,7 @@ bool FArchiveXML::LoadEffectParameter(FCDObject* object, xmlNode* parameterNode) if (!effectParameter->IsAnimator()) { xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_SEMANTIC_ELEMENT); - if (valueNode != NULL) + if (valueNode != nullptr) { effectParameter->SetSemantic(ReadNodeContentFull(valueNode)); } @@ -202,7 +202,7 @@ bool FArchiveXML::LoadEffectParameterBool(FCDObject* object, xmlNode* parameterN FCDEffectParameterBool* effectParameterBool = (FCDEffectParameterBool*)object; xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_BOOL_ELEMENT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for boolean parameter in effect: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_BOOLEAN_VALUE, parameterNode->line); @@ -221,7 +221,7 @@ bool FArchiveXML::LoadEffectParameterFloat(FCDObject* object, xmlNode* parameter if (!effectParameterFloat->IsAnimator()) { xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_FLOAT_ELEMENT); - if (valueNode == NULL) + if (valueNode == nullptr) { valueNode = FindChildByType(parameterNode, DAE_FXCMN_HALF_ELEMENT); effectParameterFloat->SetFloatType(FCDEffectParameterFloat::HALF); @@ -229,7 +229,7 @@ bool FArchiveXML::LoadEffectParameterFloat(FCDObject* object, xmlNode* parameter else effectParameterFloat->SetFloatType(FCDEffectParameterFloat::FLOAT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad float value for float parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_FLOAT_PARAM, parameterNode->line); @@ -249,7 +249,7 @@ bool FArchiveXML::LoadEffectParameterFloat2(FCDObject* object, xmlNode* paramete bool status = true; FCDEffectParameterFloat2* effectParameterFloat2 = (FCDEffectParameterFloat2*)object; xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_FLOAT2_ELEMENT); - if (valueNode == NULL) + if (valueNode == nullptr) { valueNode = FindChildByType(parameterNode, DAE_FXCMN_HALF2_ELEMENT); effectParameterFloat2->SetFloatType(FCDEffectParameterFloat2::HALF); @@ -257,7 +257,7 @@ bool FArchiveXML::LoadEffectParameterFloat2(FCDObject* object, xmlNode* paramete else effectParameterFloat2->SetFloatType(FCDEffectParameterFloat2::FLOAT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for float2 parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_FLOAT_PARAM2, parameterNode->line); @@ -276,7 +276,7 @@ bool FArchiveXML::LoadEffectParameterFloat3(FCDObject* object, xmlNode* paramete if (!effectParameterFloat3->IsAnimator()) { xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_FLOAT3_ELEMENT); - if (valueNode == NULL) + if (valueNode == nullptr) { valueNode = FindChildByType(parameterNode, DAE_FXCMN_HALF3_ELEMENT); effectParameterFloat3->SetFloatType(FCDEffectParameterFloat3::HALF); @@ -284,7 +284,7 @@ bool FArchiveXML::LoadEffectParameterFloat3(FCDObject* object, xmlNode* paramete else effectParameterFloat3->SetFloatType(FCDEffectParameterFloat3::FLOAT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for float3 parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_FLOAT_PARAM3, parameterNode->line); @@ -305,7 +305,7 @@ bool FArchiveXML::LoadEffectParameterInt(FCDObject* object, xmlNode* parameterNo FCDEffectParameterInt* effectParameterInt = (FCDEffectParameterInt*)object; xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_INT_ELEMENT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for float parameter in integer parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_FLOAT_VALUE, parameterNode->line); @@ -322,7 +322,7 @@ bool FArchiveXML::LoadEffectParameterMatrix(FCDObject* object, xmlNode* paramete bool status = true; FCDEffectParameterMatrix* effectParameterMatrix = (FCDEffectParameterMatrix*)object; xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_FLOAT4X4_ELEMENT); - if (valueNode == NULL) + if (valueNode == nullptr) { valueNode = FindChildByType(parameterNode, DAE_FXCMN_HALF4X4_ELEMENT); effectParameterMatrix->SetFloatType(FCDEffectParameterMatrix::HALF); @@ -330,7 +330,7 @@ bool FArchiveXML::LoadEffectParameterMatrix(FCDObject* object, xmlNode* paramete else effectParameterMatrix->SetFloatType(FCDEffectParameterMatrix::FLOAT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for matrix parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_MATRIX, parameterNode->line); @@ -361,7 +361,7 @@ bool FArchiveXML::LoadEffectParameterVector(FCDObject* object, xmlNode* paramete if (!effectParameterVector->IsAnimator()) { xmlNode* valueNode = FindChildByType(parameterNode, DAE_FXCMN_FLOAT4_ELEMENT); - if (valueNode == NULL) + if (valueNode == nullptr) { valueNode = FindChildByType(parameterNode, DAE_FXCMN_HALF4_ELEMENT); effectParameterVector->SetFloatType(FCDEffectParameterVector::HALF); @@ -369,7 +369,7 @@ bool FArchiveXML::LoadEffectParameterVector(FCDObject* object, xmlNode* paramete else effectParameterVector->SetFloatType(FCDEffectParameterVector::FLOAT); const char* valueString = ReadNodeContentDirect(valueNode); - if (valueString == NULL || *valueString == 0) + if (valueString == nullptr || *valueString == 0) { //return status.Fail(FS("Bad value for float4 parameter: ") + TO_FSTRING(GetReference()), parameterNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_BAD_FLOAT_PARAM4, parameterNode->line); @@ -397,8 +397,8 @@ bool FArchiveXML::LoadEffectParameterSampler(FCDObject* object, xmlNode* paramet FCDEffectParameterSamplerData& data = FArchiveXML::documentLinkDataMap[effectParameterSampler->GetDocument()].effectParameterSamplerDataMap[effectParameterSampler]; // Find the sampler node - xmlNode* samplerNode = NULL; - for (xmlNode* child = parameterNode->children; child != NULL; child = child->next) + xmlNode* samplerNode = nullptr; + for (xmlNode* child = parameterNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -408,7 +408,7 @@ bool FArchiveXML::LoadEffectParameterSampler(FCDObject* object, xmlNode* paramet else if (IsEquivalent(child->name, DAE_FXCMN_SAMPLERCUBE_ELEMENT)) { effectParameterSampler->SetSamplerType(FCDEffectParameterSampler::SAMPLERCUBE); samplerNode = child; break; } } - if (samplerNode == NULL) + if (samplerNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_SAMPLER_NODE_MISSING, parameterNode->line); return status; @@ -457,7 +457,7 @@ bool FArchiveXML::LoadEffectParameterSurface(FCDObject* object, xmlNode* paramet if (!typeAttr.empty()) effectParameterSurface->SetSurfaceType(typeAttr); bool initialized = false; - xmlNode* valueNode = NULL; + xmlNode* valueNode = nullptr; //The surface can now contain many init_from elements (1.4.1) xmlNodeList valueNodes; FindChildrenByType(surfaceNode, DAE_INITFROM_ELEMENT, valueNodes); @@ -497,7 +497,7 @@ bool FArchiveXML::LoadEffectParameterSurface(FCDObject* object, xmlNode* paramet } } - //Check if it's initialized AS NULL + //Check if it's initialized AS nullptr if (!initialized) { valueNode = FindChildByType(surfaceNode, DAE_INITASNULL_ELEMENT); @@ -765,7 +765,7 @@ bool FArchiveXML::LoadEffectPass(FCDObject* object, xmlNode* passNode) effectPass->SetPassName(TO_FSTRING(ReadNodeProperty(passNode, DAE_SID_ATTRIBUTE))); // Iterate over the pass nodes, looking for render states and elements, in any order. - for (xmlNode* child = passNode->children; child != NULL; child = child->next) + for (xmlNode* child = passNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -823,7 +823,7 @@ bool FArchiveXML::LoadEffectPassShader(FCDObject* object, xmlNode* shaderNode) // Look-up the code filename for this shader, if available effectPassShader->SetCode(effectPassShader->GetParent()->GetParent()->FindCode(codeSource)); - if (effectPassShader->GetCode() == NULL) effectPassShader->SetCode(effectPassShader->GetParent()->GetParent()->GetParent()->FindCode(codeSource)); + if (effectPassShader->GetCode() == nullptr) effectPassShader->SetCode(effectPassShader->GetParent()->GetParent()->GetParent()->FindCode(codeSource)); // Read in the compiler-related elements xmlNode* compilerTargetNode = FindChildByType(shaderNode, DAE_FXCMN_COMPILERTARGET_ELEMENT); @@ -854,13 +854,13 @@ bool FArchiveXML::LoadEffectPassState(FCDObject* object, xmlNode* stateNode) bool status = true; #define NODE_TYPE(offset, node, valueType, convFn) \ - if (node != NULL && HasNodeProperty(node, DAE_VALUE_ATTRIBUTE)) { \ + if (node != nullptr && HasNodeProperty(node, DAE_VALUE_ATTRIBUTE)) { \ *((valueType*)(effectPassState->GetData() + offset)) = (valueType) FUStringConversion::convFn(ReadNodeProperty(node, DAE_VALUE_ATTRIBUTE)); } #define NODE_INDEX(offset, node) \ - if (node != NULL && HasNodeProperty(node, DAE_INDEX_ATTRIBUTE)) { \ + if (node != nullptr && HasNodeProperty(node, DAE_INDEX_ATTRIBUTE)) { \ *((uint8*)(effectPassState->GetData() + offset)) = (uint8) FUStringConversion::ToUInt32(ReadNodeProperty(node, DAE_INDEX_ATTRIBUTE)); } #define NODE_ENUM(offset, node, nameSpace) \ - if (node != NULL && HasNodeProperty(node, DAE_VALUE_ATTRIBUTE)) { \ + if (node != nullptr && HasNodeProperty(node, DAE_VALUE_ATTRIBUTE)) { \ *((uint32*)(effectPassState->GetData() + offset)) = (uint32) nameSpace::FromString(ReadNodeProperty(node, DAE_VALUE_ATTRIBUTE)); } #define CHILD_NODE_TYPE(offset, elementName, valueType, convFn) { \ @@ -1157,7 +1157,7 @@ bool FArchiveXML::LoadEffectProfile(FCDObject* object, xmlNode* profileNode) } // Parse in the child elements: parameters and techniques - for (xmlNode* child = profileNode->children; child != NULL; child = child->next) + for (xmlNode* child = profileNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -1193,7 +1193,7 @@ bool FArchiveXML::LoadEffectProfileFX(FCDObject* object, xmlNode* profileNode) effectProfileFX->SetPlatform(TO_FSTRING(ReadNodeProperty(profileNode, DAE_PLATFORM_ATTRIBUTE))); // Parse in the child technique/code/include elements. - for (xmlNode* child = profileNode->children; child != NULL; child = child->next) + for (xmlNode* child = profileNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -1221,13 +1221,13 @@ bool FArchiveXML::LoadEffectStandard(FCDObject* object, xmlNode* baseNode) FCDEffectStandard* effectStandard = (FCDEffectStandard*)object; // Find the node with the Max/Maya/FC-specific parameters - xmlNode* maxParameterNode = NULL; - xmlNode* mayaParameterNode = NULL; - xmlNode* fcParameterNode = NULL; + xmlNode* maxParameterNode = nullptr; + xmlNode* mayaParameterNode = nullptr; + xmlNode* fcParameterNode = nullptr; // Bump the base node up the first element xmlNode* techniqueNode = FindChildByType(baseNode, DAE_TECHNIQUE_ELEMENT); - if (techniqueNode == NULL) + if (techniqueNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_TECHNIQUE_MISSING, baseNode->line); return status; @@ -1235,7 +1235,7 @@ bool FArchiveXML::LoadEffectStandard(FCDObject* object, xmlNode* baseNode) baseNode = techniqueNode; //Look for 's at this level also, and add them to the profile's parameters list - for (xmlNode* child = baseNode->children; child != NULL; child = child->next) + for (xmlNode* child = baseNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -1255,8 +1255,8 @@ bool FArchiveXML::LoadEffectStandard(FCDObject* object, xmlNode* baseNode) // Parse the material's program node and figure out the correct shader type // Either , or are expected - xmlNode* commonParameterNode = NULL; - for (commonParameterNode = baseNode->children; commonParameterNode != NULL; commonParameterNode = commonParameterNode->next) + xmlNode* commonParameterNode = nullptr; + for (commonParameterNode = baseNode->children; commonParameterNode != nullptr; commonParameterNode = commonParameterNode->next) { if (commonParameterNode->type != XML_ELEMENT_NODE) continue; if (IsEquivalent(commonParameterNode->name, DAE_FXSTD_CONSTANT_ELEMENT)) { effectStandard->SetLightingType(FCDEffectStandard::CONSTANT); break; } @@ -1264,7 +1264,7 @@ bool FArchiveXML::LoadEffectStandard(FCDObject* object, xmlNode* baseNode) else if (IsEquivalent(commonParameterNode->name, DAE_FXSTD_PHONG_ELEMENT)) { effectStandard->SetLightingType(FCDEffectStandard::PHONG); break; } else if (IsEquivalent(commonParameterNode->name, DAE_FXSTD_BLINN_ELEMENT)) { effectStandard->SetLightingType(FCDEffectStandard::BLINN); break; } } - if (commonParameterNode == NULL) + if (commonParameterNode == nullptr) { //return status.Fail(FS("Unable to find the program node for standard effect: ") + TO_FSTRING(GetDaeId()), baseNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_PROG_NODE_MISSING, baseNode->line); @@ -1420,7 +1420,7 @@ bool FArchiveXML::LoadEffectTechnique(FCDObject* object, xmlNode* techniqueNode) } // Look for the pass and parameter elements - for (xmlNode* child = techniqueNode->children; child != NULL; child = child->next) + for (xmlNode* child = techniqueNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -1469,7 +1469,7 @@ bool FArchiveXML::LoadEffect(FCDObject* object, xmlNode* effectNode) FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_UNKNOWN_EFFECT_ELEMENT, effectNode->line); } - for (xmlNode* child = effectNode->children; child != NULL; child = child->next) + for (xmlNode* child = effectNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -1598,9 +1598,9 @@ bool FArchiveXML::ParseColorTextureParameter(FCDEffectStandard* effectStandard, } // Try to find a element - xmlNode* colorNode = NULL; + xmlNode* colorNode = nullptr; xmlNode* paramNode = FindChildByType(parameterNode, DAE_PARAMETER_ELEMENT); - if (paramNode != NULL) + if (paramNode != nullptr) { fm::string name = ReadNodeProperty(paramNode, DAE_REF_ATTRIBUTE); @@ -1661,7 +1661,7 @@ bool FArchiveXML::ParseFloatTextureParameter(FCDEffectStandard* effectStandard, } // Next, look for a element - xmlNode* floatNode = NULL; + xmlNode* floatNode = nullptr; xmlNode* paramNode = FindChildByType(parameterNode, DAE_PARAMETER_ELEMENT); if (paramNode) { @@ -1730,7 +1730,7 @@ bool FArchiveXML::ParseSimpleTextureParameter(FCDEffectStandard* effectStandard, uint32 FArchiveXML::GetEffectParameterType(xmlNode* parameterNode) { // If the parent is bind_material, the format is slightly different, there is no children node. - if (parameterNode->children == NULL) + if (parameterNode->children == nullptr) { xmlNode* parent = parameterNode->parent; if (IsEquivalent(parent->name, DAE_BINDMATERIAL_ELEMENT)) @@ -1759,7 +1759,7 @@ uint32 FArchiveXML::GetEffectParameterType(xmlNode* parameterNode) } else { - for (xmlNode* child = parameterNode->children; child != NULL; child = child->next) + for (xmlNode* child = parameterNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; diff --git a/FColladaPlugins/FArchiveXML/FAXPhysicsExport.cpp b/FColladaPlugins/FArchiveXML/FAXPhysicsExport.cpp index b6b8444..46a725c 100644 --- a/FColladaPlugins/FArchiveXML/FAXPhysicsExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXPhysicsExport.cpp @@ -68,7 +68,7 @@ xmlNode* FArchiveXML::WritePhysicsAnalyticalGeometry(FCDObject* object, xmlNode* // Currently not reachable // FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WritePASBox(FCDObject* object, xmlNode* node) @@ -205,7 +205,7 @@ xmlNode* FArchiveXML::WritePhysicsRigidConstraint(FCDObject* object, xmlNode* pa physicsRigidConstraint->SetSubId(AddNodeSid(physicsRigidConstraintNode, physicsRigidConstraint->GetSubId().c_str())); xmlNode* refNode = AddChild(physicsRigidConstraintNode, DAE_REF_ATTACHMENT_ELEMENT); - fm::string referenceId = (physicsRigidConstraint->GetReferenceRigidBody() != NULL) ? physicsRigidConstraint->GetReferenceRigidBody()->GetSubId() : (physicsRigidConstraint->GetReferenceNode() != NULL) ? physicsRigidConstraint->GetReferenceNode()->GetDaeId() : ""; + fm::string referenceId = (physicsRigidConstraint->GetReferenceRigidBody() != nullptr) ? physicsRigidConstraint->GetReferenceRigidBody()->GetSubId() : (physicsRigidConstraint->GetReferenceNode() != nullptr) ? physicsRigidConstraint->GetReferenceNode()->GetDaeId() : ""; AddAttribute(refNode, DAE_RIGID_BODY_ELEMENT, referenceId); for (FCDTransformContainer::iterator itT = physicsRigidConstraint->GetTransformsRef().begin(); itT != physicsRigidConstraint->GetTransformsRef().end(); ++itT) { @@ -213,7 +213,7 @@ xmlNode* FArchiveXML::WritePhysicsRigidConstraint(FCDObject* object, xmlNode* pa } xmlNode* tarNode = AddChild(physicsRigidConstraintNode, DAE_ATTACHMENT_ELEMENT); - fm::string targetId = (physicsRigidConstraint->GetTargetRigidBody() != NULL) ? physicsRigidConstraint->GetTargetRigidBody()->GetSubId() : (physicsRigidConstraint->GetTargetNode() != NULL) ? physicsRigidConstraint->GetTargetNode()->GetDaeId() : ""; + fm::string targetId = (physicsRigidConstraint->GetTargetRigidBody() != nullptr) ? physicsRigidConstraint->GetTargetRigidBody()->GetSubId() : (physicsRigidConstraint->GetTargetNode() != nullptr) ? physicsRigidConstraint->GetTargetNode()->GetDaeId() : ""; AddAttribute(tarNode, DAE_RIGID_BODY_ELEMENT, targetId); for (FCDTransformContainer::iterator itT = physicsRigidConstraint->GetTransformsTar().begin(); itT != physicsRigidConstraint->GetTransformsTar().end(); ++itT) { @@ -264,7 +264,7 @@ xmlNode* FArchiveXML::WritePhysicsScene(FCDObject* object, xmlNode* parentNode) FCDPhysicsScene* physicsScene = (FCDPhysicsScene*)object; xmlNode* physicsSceneNode = FArchiveXML::WriteToEntityXMLFCDEntity(physicsScene, parentNode, DAE_PHYSICS_SCENE_ELEMENT); - if (physicsSceneNode == NULL) return physicsSceneNode; + if (physicsSceneNode == nullptr) return physicsSceneNode; // Write out the instantiation: force fields, then physics models for (size_t i = 0; i < physicsScene->GetForceFieldInstancesCount(); ++i) @@ -305,13 +305,13 @@ void FArchiveXML::WritePhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* FArchiveXML::AddPhysicsParameter(techniqueNode, DAE_INERTIA_ELEMENT, physicsRigidBodyParameters->GetInertia()); } - if (physicsRigidBodyParameters->GetPhysicsMaterial() != NULL) + if (physicsRigidBodyParameters->GetPhysicsMaterial() != nullptr) { if (physicsRigidBodyParameters->OwnsPhysicsMaterial()) { FArchiveXML::LetWriteObject(physicsRigidBodyParameters->GetPhysicsMaterial(), techniqueNode); } - else if (physicsRigidBodyParameters->GetInstanceMaterial() != NULL) + else if (physicsRigidBodyParameters->GetInstanceMaterial() != nullptr) { FArchiveXML::LetWriteObject(physicsRigidBodyParameters->GetInstanceMaterial(), techniqueNode); } diff --git a/FColladaPlugins/FArchiveXML/FAXPhysicsImport.cpp b/FColladaPlugins/FArchiveXML/FAXPhysicsImport.cpp index 0f88407..88a429d 100644 --- a/FColladaPlugins/FArchiveXML/FAXPhysicsImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXPhysicsImport.cpp @@ -34,7 +34,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetDynamic(FUStringConversion::ToBoolean(ReadNodeContentDirect(param))); FArchiveXML::LoadAnimatable(¶meters->GetDynamic(), param); } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetDynamic(defaultParameters->GetDynamic() > 0.5f); if (defaultParameters->GetDynamic().IsAnimated()) @@ -53,7 +53,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetMassFrameTranslate(FUStringConversion::ToVector3(ReadNodeContentDirect(param))); FArchiveXML::LoadAnimatable(¶meters->GetMassFrameTranslate(), param); } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetMassFrameTranslate(defaultParameters->GetMassFrameTranslate()); if (defaultParameters->GetMassFrameTranslate().IsAnimated()) @@ -74,7 +74,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetMassFrameOrientation(FMAngleAxis(FMVector3(temp.x, temp.y, temp.z), temp.w)); LoadAnimatable(¶meters->GetMassFrameOrientation(), param); } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetMassFrameOrientation(defaultParameters->GetMassFrameOrientation()); if (defaultParameters->GetMassFrameOrientation().IsAnimated()) @@ -88,7 +88,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetMassFrameOrientation(FMAngleAxis(FMVector3::XAxis, 0.0f)); } } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetMassFrameTranslate(defaultParameters->GetMassFrameTranslate()); parameters->SetMassFrameOrientation(defaultParameters->GetMassFrameOrientation()); @@ -122,7 +122,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* // shapes are not taken from the default parameters param = FindChildByType(techniqueNode, DAE_PHYSICS_MATERIAL_ELEMENT); - if (param != NULL) + if (param != nullptr) { FCDPhysicsMaterial* material = parameters->AddOwnPhysicsMaterial(); FArchiveXML::LoadPhysicsMaterial(material, param); @@ -130,13 +130,13 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* else { param = FindChildByType(techniqueNode, DAE_INSTANCE_PHYSICS_MATERIAL_ELEMENT); - if (param != NULL) + if (param != nullptr) { - FCDEntityInstance* physicsMaterialInstance = FCDEntityInstanceFactory::CreateInstance(parameters->GetDocument(), NULL, FCDEntity::PHYSICS_MATERIAL); + FCDEntityInstance* physicsMaterialInstance = FCDEntityInstanceFactory::CreateInstance(parameters->GetDocument(), nullptr, FCDEntity::PHYSICS_MATERIAL); parameters->SetInstanceMaterial(physicsMaterialInstance); FArchiveXML::LoadSwitch(physicsMaterialInstance, &physicsMaterialInstance->GetObjectType(), param); FCDPhysicsMaterial* material = (FCDPhysicsMaterial*) physicsMaterialInstance->GetEntity(); - if (material == NULL) + if (material == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::WARNING_MISSING_URI_TARGET, param->line); } @@ -157,7 +157,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetDensity(0.0f); FArchiveXML::LoadAnimatable(¶meters->GetMass(), param); } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetMass(defaultParameters->GetMass()); parameters->SetDensity(defaultParameters->GetDensity()); @@ -195,7 +195,7 @@ bool FArchiveXML::LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters->SetInertiaAccurate(true); FArchiveXML::LoadAnimatable(¶meters->GetInertia(), param); } - else if (defaultParameters != NULL) + else if (defaultParameters != nullptr) { parameters->SetInertia(defaultParameters->GetInertia()); parameters->SetInertiaAccurate(defaultParameters->IsInertiaAccurate()); @@ -254,7 +254,7 @@ bool FArchiveXML::LoadPhysicsShape(FCDObject* object, xmlNode* physicsShapeNode) } // Read in the first valid child element found - for (xmlNode* child = physicsShapeNode->children; child != NULL; child = child->next) + for (xmlNode* child = physicsShapeNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -270,7 +270,7 @@ bool FArchiveXML::LoadPhysicsShape(FCDObject* object, xmlNode* physicsShapeNode) else if (IsEquivalent(child->name, DAE_DENSITY_ELEMENT)) { physicsShape->SetDensity(FUStringConversion::ToFloat(ReadNodeContentDirect(child))); - physicsShape->SetDensityMoreAccurate(physicsShape->GetMassPointer() == NULL); // mass before density in COLLADA 1.4.1 + physicsShape->SetDensityMoreAccurate(physicsShape->GetMassPointer() == nullptr); // mass before density in COLLADA 1.4.1 } else if (IsEquivalent(child->name, DAE_PHYSICS_MATERIAL_ELEMENT)) { @@ -280,7 +280,7 @@ bool FArchiveXML::LoadPhysicsShape(FCDObject* object, xmlNode* physicsShapeNode) else if (IsEquivalent(child->name, DAE_INSTANCE_PHYSICS_MATERIAL_ELEMENT)) { - physicsShape->SetInstanceMaterial(FCDEntityInstanceFactory::CreateInstance(physicsShape->GetDocument(), NULL, FCDEntity::PHYSICS_MATERIAL)); + physicsShape->SetInstanceMaterial(FCDEntityInstanceFactory::CreateInstance(physicsShape->GetDocument(), nullptr, FCDEntity::PHYSICS_MATERIAL)); FArchiveXML::LoadSwitch(physicsShape->GetInstanceMaterial(), &physicsShape->GetInstanceMaterial()->GetObjectType(), child); @@ -299,10 +299,10 @@ bool FArchiveXML::LoadPhysicsShape(FCDObject* object, xmlNode* physicsShapeNode) if (!url.IsFile()) { FCDGeometry* entity = physicsShape->GetDocument()->FindGeometry(TO_STRING(url.GetFragment())); - if (entity != NULL) + if (entity != nullptr) { - physicsShape->SetAnalyticalGeometry(NULL); - physicsShape->SetGeometryInstance((FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(physicsShape->GetDocument(), NULL, FCDEntity::GEOMETRY)); + physicsShape->SetAnalyticalGeometry(nullptr); + physicsShape->SetGeometryInstance((FCDGeometryInstance*)FCDEntityInstanceFactory::CreateInstance(physicsShape->GetDocument(), nullptr, FCDEntity::GEOMETRY)); physicsShape->GetGeometryInstance()->SetEntity((FCDEntity*)entity); status &= (FArchiveXML::LoadGeometryInstance(physicsShape->GetGeometryInstance(), child)); continue; @@ -343,18 +343,18 @@ bool FArchiveXML::LoadPhysicsShape(FCDObject* object, xmlNode* physicsShapeNode) } } - if ((physicsShape->GetMassPointer() == NULL) && (physicsShape->GetDensityPointer() == NULL)) + if ((physicsShape->GetMassPointer() == nullptr) && (physicsShape->GetDensityPointer() == nullptr)) { physicsShape->SetDensity(1.0f); physicsShape->SetDensityMoreAccurate(true); } // default value if only one is defined. - if ((physicsShape->GetMassPointer() == NULL) && (physicsShape->GetDensityPointer() != NULL)) + if ((physicsShape->GetMassPointer() == nullptr) && (physicsShape->GetDensityPointer() != nullptr)) { physicsShape->SetMass(physicsShape->GetDensity() * physicsShape->CalculateVolume()); } - else if ((physicsShape->GetMassPointer() != NULL) && (physicsShape->GetDensityPointer() == NULL)) + else if ((physicsShape->GetMassPointer() != nullptr) && (physicsShape->GetDensityPointer() == nullptr)) { physicsShape->SetDensity(physicsShape->GetMass() / physicsShape->CalculateVolume()); } @@ -380,7 +380,7 @@ bool FArchiveXML::LoadPASBox(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -409,7 +409,7 @@ bool FArchiveXML::LoadPASCapsule(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -441,7 +441,7 @@ bool FArchiveXML::LoadPASTaperedCapsule(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -480,7 +480,7 @@ bool FArchiveXML::LoadPASCylinder(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -512,7 +512,7 @@ bool FArchiveXML::LoadPASTaperedCylinder(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -551,7 +551,7 @@ bool FArchiveXML::LoadPASPlane(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -581,7 +581,7 @@ bool FArchiveXML::LoadPASSphere(FCDObject* object, xmlNode* node) return status; } - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -609,27 +609,27 @@ bool FArchiveXML::LoadPhysicsMaterial(FCDObject* object, xmlNode* physicsMateria // Read in the element xmlNode* commonTechniqueNode = FindChildByType(physicsMaterialNode, DAE_TECHNIQUE_COMMON_ELEMENT); - if (commonTechniqueNode == NULL) + if (commonTechniqueNode == nullptr) { FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_COMMON_TECHNIQUE_MISSING, physicsMaterialNode->line); } xmlNode* paramNode = FindChildByType(commonTechniqueNode, DAE_PHYSICS_STATIC_FRICTION); - if (paramNode != NULL) + if (paramNode != nullptr) { const char* content = ReadNodeContentDirect(paramNode); physicsMaterial->SetStaticFriction(FUStringConversion::ToFloat(content)); } paramNode = FindChildByType(commonTechniqueNode, DAE_PHYSICS_DYNAMIC_FRICTION); - if (paramNode != NULL) + if (paramNode != nullptr) { const char* content = ReadNodeContentDirect(paramNode); physicsMaterial->SetDynamicFriction(FUStringConversion::ToFloat(content)); } paramNode = FindChildByType(commonTechniqueNode, DAE_PHYSICS_RESTITUTION); - if (paramNode != NULL) + if (paramNode != nullptr) { const char* content = ReadNodeContentDirect(paramNode); physicsMaterial->SetRestitution(FUStringConversion::ToFloat(content)); @@ -653,7 +653,7 @@ bool FArchiveXML::LoadPhysicsModel(FCDObject* object, xmlNode* physicsModelNode) } // Read in the first valid child element found - for (xmlNode* child = physicsModelNode->children; child != NULL; child = child->next) + for (xmlNode* child = physicsModelNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -693,7 +693,7 @@ bool FArchiveXML::LoadPhysicsRigidBody(FCDObject* object, xmlNode* physicsRigidB xmlNode* techniqueNode = FindChildByType(physicsRigidBodyNode, DAE_TECHNIQUE_COMMON_ELEMENT); - if (techniqueNode != NULL) + if (techniqueNode != nullptr) { FArchiveXML::LoadPhysicsRigidBodyParameters(physicsRigidBody->GetParameters(), techniqueNode); } @@ -726,7 +726,7 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics for (xmlNodeList::iterator itT = transformNodes.begin(); itT != transformNodes.end(); ++itT) \ { \ if (IsEquivalent((*itT)->name, nodeName)) { \ - className* transform = new className(physicsRigidConstraint->GetDocument(), NULL); \ + className* transform = new className(physicsRigidConstraint->GetDocument(), nullptr); \ transforms.push_back(transform); \ status = FArchiveXML::LoadSwitch(transform, &transform->GetObjectType(), *itT); \ if (!status) { \ @@ -738,16 +738,16 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics //Reference-frame body xmlNode* referenceBodyNode = FindChildByType(physicsRigidConstraintNode, DAE_REF_ATTACHMENT_ELEMENT); - if (referenceBodyNode == NULL) + if (referenceBodyNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_RF_NODE_MISSING, physicsRigidConstraintNode->line); } fm::string strRigidBody = ReadNodeProperty(referenceBodyNode, DAE_RIGID_BODY_ELEMENT); physicsRigidConstraint->SetReferenceRigidBody(physicsRigidConstraint->GetParent()->FindRigidBodyFromSid(strRigidBody)); - if (physicsRigidConstraint->GetReferenceRigidBody() == NULL) + if (physicsRigidConstraint->GetReferenceRigidBody() == nullptr) { physicsRigidConstraint->SetReferenceNode(physicsRigidConstraint->GetDocument()->FindSceneNode(strRigidBody)); - if ((physicsRigidConstraint->GetReferenceNode() == NULL) && (referenceBodyNode != NULL)) + if ((physicsRigidConstraint->GetReferenceNode() == nullptr) && (referenceBodyNode != nullptr)) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_RF_REF_NODE_MISSING, referenceBodyNode->line); } @@ -758,16 +758,16 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics // target body xmlNode* bodyNode = FindChildByType(physicsRigidConstraintNode, DAE_ATTACHMENT_ELEMENT); - if (bodyNode == NULL) + if (bodyNode == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_TARGET_BS_NODE_MISSING, physicsRigidConstraintNode->line); } strRigidBody = ReadNodeProperty(bodyNode, DAE_RIGID_BODY_ELEMENT); physicsRigidConstraint->SetTargetRigidBody(physicsRigidConstraint->GetParent()->FindRigidBodyFromSid(strRigidBody)); - if (physicsRigidConstraint->GetTargetRigidBody() == NULL) + if (physicsRigidConstraint->GetTargetRigidBody() == nullptr) { physicsRigidConstraint->SetTargetNode(physicsRigidConstraint->GetDocument()->FindSceneNode(strRigidBody)); - if ((physicsRigidConstraint->GetTargetNode() == NULL) && (bodyNode != NULL)) + if ((physicsRigidConstraint->GetTargetNode() == nullptr) && (bodyNode != nullptr)) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_TARGE_BS_REF_NODE_MISSING, bodyNode->line); } @@ -780,7 +780,7 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics //technique_common xmlNode* techniqueNode = FindChildByType(physicsRigidConstraintNode, DAE_TECHNIQUE_COMMON_ELEMENT); - if (techniqueNode == NULL) + if (techniqueNode == nullptr) { //return status.Fail(FS("Technique node not specified in rigid_constraint ") + TO_FSTRING(GetDaeId()), physicsRigidConstraintNode->line); FUError::Error(FUError::ERROR_LEVEL, FUError::ERROR_TECHNIQUE_NODE_MISSING, physicsRigidConstraintNode->line); @@ -788,32 +788,32 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics } xmlNode* enabledNode = FindChildByType(techniqueNode, DAE_ENABLED_ELEMENT); - if (enabledNode != NULL) + if (enabledNode != nullptr) { physicsRigidConstraint->SetEnabled(FUStringConversion::ToBoolean(ReadNodeContentDirect(enabledNode))); FArchiveXML::LoadAnimatable(&physicsRigidConstraint->GetEnabled(), enabledNode); } xmlNode* interpenetrateNode = FindChildByType(techniqueNode, DAE_INTERPENETRATE_ELEMENT); - if (interpenetrateNode != NULL) + if (interpenetrateNode != nullptr) { physicsRigidConstraint->SetInterpenetrate(FUStringConversion::ToBoolean(ReadNodeContentDirect(interpenetrateNode))); FArchiveXML::LoadAnimatable(&physicsRigidConstraint->GetInterpenetrate(), interpenetrateNode); } xmlNode* limitsNode = FindChildByType(techniqueNode, DAE_LIMITS_ELEMENT); - if (limitsNode != NULL) + if (limitsNode != nullptr) { xmlNode* linearNode = FindChildByType(limitsNode, DAE_LINEAR_ELEMENT); - if (linearNode != NULL) + if (linearNode != nullptr) { xmlNode* linearMinNode = FindChildByType(linearNode, DAE_MIN_ELEMENT); - if (linearMinNode != NULL) + if (linearMinNode != nullptr) { const char* min = ReadNodeContentDirect(linearMinNode); physicsRigidConstraint->SetLimitsLinearMin(FUStringConversion::ToVector3(min)); } xmlNode* linearMaxNode = FindChildByType(linearNode, DAE_MAX_ELEMENT); - if (linearMaxNode != NULL) + if (linearMaxNode != nullptr) { const char* max = ReadNodeContentDirect(linearMaxNode); physicsRigidConstraint->SetLimitsLinearMax(FUStringConversion::ToVector3(max)); @@ -821,16 +821,16 @@ bool FArchiveXML::LoadPhysicsRigidConstraint(FCDObject* object, xmlNode* physics } xmlNode* sctNode = FindChildByType(limitsNode, DAE_SWING_CONE_AND_TWIST_ELEMENT); - if (sctNode != NULL) + if (sctNode != nullptr) { xmlNode* sctMinNode = FindChildByType(sctNode, DAE_MIN_ELEMENT); - if (sctMinNode != NULL) + if (sctMinNode != nullptr) { const char* min = ReadNodeContentDirect(sctMinNode); physicsRigidConstraint->SetLimitsSCTMin(FUStringConversion::ToVector3(min)); } xmlNode* sctMaxNode = FindChildByType(sctNode, DAE_MAX_ELEMENT); - if (sctMaxNode != NULL) + if (sctMaxNode != nullptr) { const char* max = ReadNodeContentDirect(sctMaxNode); physicsRigidConstraint->SetLimitsSCTMax(FUStringConversion::ToVector3(max)); @@ -878,14 +878,14 @@ bool FArchiveXML::LoadPhysicsScene(FCDObject* object, xmlNode* sceneNode) FCDPhysicsScene* physicsScene = (FCDPhysicsScene*)object; if (IsEquivalent(sceneNode->name, DAE_PHYSICS_SCENE_ELEMENT)) { - for (xmlNode* child = sceneNode->children; child != NULL; child = child->next) + for (xmlNode* child = sceneNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; // Look for instantiation elements if (IsEquivalent(child->name, DAE_INSTANCE_PHYSICS_MODEL_ELEMENT)) { - FCDPhysicsModelInstance* instance = physicsScene->AddPhysicsModelInstance(NULL); + FCDPhysicsModelInstance* instance = physicsScene->AddPhysicsModelInstance(nullptr); status &= (FArchiveXML::LoadPhysicsModelInstance(instance, child)); continue; } @@ -910,7 +910,7 @@ bool FArchiveXML::LoadPhysicsScene(FCDObject* object, xmlNode* sceneNode) else if (IsEquivalent(child->name, DAE_INSTANCE_FORCE_FIELD_ELEMENT)) { - FCDPhysicsForceFieldInstance* instance = physicsScene->AddForceFieldInstance(NULL); + FCDPhysicsForceFieldInstance* instance = physicsScene->AddForceFieldInstance(nullptr); status &= (FArchiveXML::LoadPhysicsForceFieldInstance(instance, child)); } else if (IsEquivalent(child->name, DAE_EXTRA_ELEMENT)) diff --git a/FColladaPlugins/FArchiveXML/FAXSceneExport.cpp b/FColladaPlugins/FArchiveXML/FAXSceneExport.cpp index 5b26d69..57f1ef7 100644 --- a/FColladaPlugins/FArchiveXML/FAXSceneExport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXSceneExport.cpp @@ -33,18 +33,18 @@ xmlNode* FArchiveXML::WriteTargetedEntity(FCDObject* UNUSED(object), xmlNode* UN { // Currently not reachable FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteSceneNode(FCDObject* object, xmlNode* parentNode) { FCDSceneNode* sceneNode = (FCDSceneNode*)object; - xmlNode* node = NULL; + xmlNode* node = nullptr; bool isVisualScene = false; FCDENodeList extraParameters; - FCDETechnique* extraTechnique = NULL; + FCDETechnique* extraTechnique = nullptr; if (sceneNode->GetParentCount() == 0) { @@ -81,14 +81,14 @@ xmlNode* FArchiveXML::WriteSceneNode(FCDObject* object, xmlNode* parentNode) // Write out the instances // Some of the FCollada instance types are not a part of COLLADA, so buffer them to export in the . FCDENodeList extraInstanceNodes; - FCDETechnique* extraInstanceTechnique = NULL; + FCDETechnique* extraInstanceTechnique = nullptr; size_t instanceCount = sceneNode->GetInstanceCount(); for (size_t i = 0; i < instanceCount; ++i) { FCDEntityInstance* instance = sceneNode->GetInstance(i); if (instance->GetEntityType() == FCDEntity::FORCE_FIELD || instance->GetEntityType() == FCDEntity::EMITTER) { - if (extraInstanceTechnique == NULL) + if (extraInstanceTechnique == nullptr) { FCDExtra* extra = const_cast(sceneNode->GetExtra()); FCDEType* extraType = extra->AddType(DAEFC_INSTANCES_TYPE); @@ -132,7 +132,7 @@ xmlNode* FArchiveXML::WriteSceneNode(FCDObject* object, xmlNode* parentNode) } if (!alreadyInstantiated) { - FCDEntityInstance* instance = FCDEntityInstanceFactory::CreateInstance(const_cast(sceneNode->GetDocument()), NULL, FCDEntity::SCENE_NODE); + FCDEntityInstance* instance = FCDEntityInstanceFactory::CreateInstance(const_cast(sceneNode->GetDocument()), nullptr, FCDEntity::SCENE_NODE); instance->SetEntity(const_cast(child)); FArchiveXML::LetWriteObject(instance, node); } @@ -155,7 +155,7 @@ xmlNode* FArchiveXML::WriteSceneNode(FCDObject* object, xmlNode* parentNode) // Write out the extra information and release the temporarily added extra parameters FArchiveXML::WriteEntityExtra(sceneNode, node); - if (extraTechnique != NULL) + if (extraTechnique != nullptr) { CLEAR_POINTER_VECTOR(extraParameters); if (extraTechnique->GetChildNodeCount() == 0) SAFE_RELEASE(extraTechnique); @@ -171,7 +171,7 @@ xmlNode* FArchiveXML::WriteTransform(FCDObject* UNUSED(object), xmlNode* UNUSED( // Currently not reachable // FUBreak; - return NULL; + return nullptr; } xmlNode* FArchiveXML::WriteTransformLookAt(FCDObject* object, xmlNode* parentNode) @@ -258,17 +258,17 @@ xmlNode* FArchiveXML::WriteToEntityXMLFCDEntity(FCDEntity* entity, xmlNode* pare } // Write out the asset information. - if (const_cast(entity)->GetAsset() != NULL) FArchiveXML::LetWriteObject(entity->GetAsset(), entityNode); + if (const_cast(entity)->GetAsset() != nullptr) FArchiveXML::LetWriteObject(entity->GetAsset(), entityNode); return entityNode; } void FArchiveXML::WriteEntityExtra(FCDEntity* entity, xmlNode* entityNode) { - if (entity->GetExtra() != NULL) + if (entity->GetExtra() != nullptr) { FCDENodeList extraParameters; - FCDETechnique* extraTechnique = NULL; + FCDETechnique* extraTechnique = nullptr; // Add the note to the extra information if (entity->HasNote()) @@ -280,7 +280,7 @@ void FArchiveXML::WriteEntityExtra(FCDEntity* entity, xmlNode* entityNode) // Write out all the typed and untyped extra information and release the temporarily-added extra parameters. FArchiveXML::LetWriteObject(entity->GetExtra(), entityNode); - if (extraTechnique != NULL) + if (extraTechnique != nullptr) { CLEAR_POINTER_VECTOR(extraParameters); if (extraTechnique->GetChildNodeCount() == 0) SAFE_RELEASE(extraTechnique); @@ -290,7 +290,7 @@ void FArchiveXML::WriteEntityExtra(FCDEntity* entity, xmlNode* entityNode) void FArchiveXML::WriteEntityInstanceExtra(FCDEntityInstance* entityInstance, xmlNode* instanceNode) { - if (entityInstance->GetExtra() != NULL) + if (entityInstance->GetExtra() != nullptr) { FArchiveXML::LetWriteObject(entityInstance->GetExtra(), instanceNode); } @@ -298,10 +298,10 @@ void FArchiveXML::WriteEntityInstanceExtra(FCDEntityInstance* entityInstance, xm void FArchiveXML::WriteTargetedEntityExtra(FCDTargetedEntity* targetedEntity, xmlNode* entityNode) { - FCDETechnique* technique = NULL; - FCDENode* parameter = NULL; + FCDETechnique* technique = nullptr; + FCDENode* parameter = nullptr; - if (targetedEntity->GetTargetNode() != NULL) + if (targetedEntity->GetTargetNode() != nullptr) { // Just for the export-time, add to the extra tree, the target information. FCDExtra* extra = const_cast(targetedEntity->GetExtra()); @@ -312,7 +312,7 @@ void FArchiveXML::WriteTargetedEntityExtra(FCDTargetedEntity* targetedEntity, xm // Export the extra tree to XML FArchiveXML::WriteEntityExtra(targetedEntity, entityNode); - if (targetedEntity->GetTargetNode() != NULL) + if (targetedEntity->GetTargetNode() != nullptr) { // Delete the created extra tree nodes. SAFE_RELEASE(parameter); diff --git a/FColladaPlugins/FArchiveXML/FAXSceneImport.cpp b/FColladaPlugins/FArchiveXML/FAXSceneImport.cpp index ac25bdf..b57530d 100644 --- a/FColladaPlugins/FArchiveXML/FAXSceneImport.cpp +++ b/FColladaPlugins/FArchiveXML/FAXSceneImport.cpp @@ -36,7 +36,7 @@ bool FArchiveXML::LoadEntity(FCDObject* object, xmlNode* entityNode) // Read in the asset information. xmlNode* assetNode = FindChildByType(entityNode, DAE_ASSET_ELEMENT); - if (assetNode != NULL) FArchiveXML::LoadAsset(entity->GetAsset(), assetNode); + if (assetNode != nullptr) FArchiveXML::LoadAsset(entity->GetAsset(), assetNode); // Read in the extra nodes xmlNodeList extraNodes; @@ -54,9 +54,9 @@ bool FArchiveXML::LoadEntity(FCDObject* object, xmlNode* entityNode) // Read in all the extra parameters StringList parameterNames; FCDENodeList parameterNodes; - if (mayaTechnique != NULL) mayaTechnique->FindParameters(parameterNodes, parameterNames); - if (maxTechnique != NULL) maxTechnique->FindParameters(parameterNodes, parameterNames); - if (fcTechnique != NULL) fcTechnique->FindParameters(parameterNodes, parameterNames); + if (mayaTechnique != nullptr) mayaTechnique->FindParameters(parameterNodes, parameterNames); + if (maxTechnique != nullptr) maxTechnique->FindParameters(parameterNodes, parameterNames); + if (fcTechnique != nullptr) fcTechnique->FindParameters(parameterNodes, parameterNames); // Look for the note and user-properties, which is the only parameter currently supported at this level size_t parameterCount = parameterNodes.size(); @@ -92,7 +92,7 @@ bool FArchiveXML::LoadTargetedEntity(FCDObject* object, xmlNode* entityNode) // Extract out the target information. FCDENode* targetNode = extra->GetDefaultType()->FindRootNode(DAEFC_TARGET_PARAMETER); - if (targetNode != NULL) + if (targetNode != nullptr) { data.targetId = TO_STRING(targetNode->GetContent()); SAFE_RELEASE(targetNode); @@ -126,7 +126,7 @@ bool FArchiveXML::LoadSceneNode(FCDObject* object, xmlNode* node) } // The scene node has ordered elements, so process them directly and in order. - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -146,7 +146,7 @@ bool FArchiveXML::LoadSceneNode(FCDObject* object, xmlNode* node) { // cannot find the node FCDSceneNode* node = sceneNode->GetDocument()->FindSceneNode(TO_STRING(url.GetFragment())); - if (node != NULL) + if (node != nullptr) { if (!sceneNode->AddChildNode(node)) @@ -240,10 +240,10 @@ bool FArchiveXML::LoadFromExtraSceneNode(FCDSceneNode* sceneNode) parameterNode->GetAnimated()->Clone(sceneNode->GetVisibility().GetAnimated()); } } - else if (parameterName == DAEMAYA_LAYER_PARAMETER || (parameterType != NULL && FUStringConversion::ToString(parameterType->GetValue()) == DAEMAYA_LAYER_PARAMETER)) + else if (parameterName == DAEMAYA_LAYER_PARAMETER || (parameterType != nullptr && FUStringConversion::ToString(parameterType->GetValue()) == DAEMAYA_LAYER_PARAMETER)) { FCDEAttribute* nameAttribute = parameterNode->FindAttribute(DAE_NAME_ATTRIBUTE); - if (nameAttribute == NULL) continue; + if (nameAttribute == nullptr) continue; // Create a new layer object list FCDLayerList& layers = sceneNode->GetDocument()->GetLayers(); @@ -260,10 +260,10 @@ bool FArchiveXML::LoadFromExtraSceneNode(FCDSceneNode* sceneNode) // Read in the extra instances from the typed extra. FCDEType* instancesExtra = extra->FindType(DAEFC_INSTANCES_TYPE); - if (instancesExtra != NULL) + if (instancesExtra != nullptr) { FCDETechnique* fcolladaTechnique = instancesExtra->FindTechnique(DAE_FCOLLADA_PROFILE); - if (fcolladaTechnique != NULL) + if (fcolladaTechnique != nullptr) { FCDENodeList nodesToRelease; size_t childNodeCount = fcolladaTechnique->GetChildNodeCount(); diff --git a/FColladaPlugins/FArchiveXML/FAXStructures.h b/FColladaPlugins/FArchiveXML/FAXStructures.h index 5fdc209..9124e18 100644 --- a/FColladaPlugins/FArchiveXML/FAXStructures.h +++ b/FColladaPlugins/FArchiveXML/FAXStructures.h @@ -119,7 +119,7 @@ struct FAXAnimationChannelDefaultValue float defaultValue; /**< The default value for an animation value pointer that is not animated but may be merged. */ /** Default constructor. */ - FAXAnimationChannelDefaultValue() : curve(NULL), defaultValue(0.0f) {} + FAXAnimationChannelDefaultValue() : curve(nullptr), defaultValue(0.0f) {} /** Simple constructor. @param c A curve. @param f The default value. @param q The default value's qualifier. */ FAXAnimationChannelDefaultValue(FCDAnimationCurve* c, float f) { curve = c; defaultValue = f; } }; diff --git a/FColladaPlugins/FArchiveXML/FArchiveXML.cpp b/FColladaPlugins/FArchiveXML/FArchiveXML.cpp index 7c09480..a4453fd 100644 --- a/FColladaPlugins/FArchiveXML/FArchiveXML.cpp +++ b/FColladaPlugins/FArchiveXML/FArchiveXML.cpp @@ -159,7 +159,7 @@ const char* FArchiveXML::GetSupportedExtensionAt(int index) } else { - return NULL; + return nullptr; } } } @@ -387,7 +387,7 @@ bool FArchiveXML::ImportFile(const fchar* filePath, FCDocument* fcdocument) // Parse the document into a XML tree FUXmlDocument daeDocument(fcdocument->GetFileManager(), fcdocument->GetFileUrl(), true); xmlNode* rootNode = daeDocument.GetRootNode(); - if (rootNode != NULL) + if (rootNode != nullptr) { //fcdocument->GetFileManager()->PushRootFile(filePath); // Read in the whole document from the root node @@ -423,7 +423,7 @@ bool FArchiveXML::ImportFileFromMemory(const fchar* filePath, FCDocument* fcdocu // Parse the document into a XML tree FUXmlDocument daeDocument((const char*) contents, length); xmlNode* rootNode = daeDocument.GetRootNode(); - if (rootNode != NULL) + if (rootNode != nullptr) { // Read in the whole document from the root node status &= (Import(fcdocument, rootNode)); @@ -456,7 +456,7 @@ bool FArchiveXML::ExportFile(FCDocument* fcdocument, const fchar* filePath) _FTRY { // Create a new XML document - FUXmlDocument daeDocument(NULL, filePath, false); + FUXmlDocument daeDocument(nullptr, filePath, false); xmlNode* rootNode = daeDocument.CreateRootNode(DAE_COLLADA_ELEMENT); status = ExportDocument(fcdocument, rootNode); if (status) @@ -481,11 +481,11 @@ bool FArchiveXML::ExportFile(FCDocument* fcdocument, const fchar* filePath) } // TODO: where should this go? -static FUXmlDocument daeDocument(NULL, NULL, false); +static FUXmlDocument daeDocument(nullptr, nullptr, false); bool FArchiveXML::StartExport(const fchar* UNUSED(filePath)) { - FUAssert(daeDocument.GetRootNode() == NULL, return false); + FUAssert(daeDocument.GetRootNode() == nullptr, return false); daeDocument.CreateRootNode(DAE_COLLADA_ELEMENT); return true; @@ -493,12 +493,12 @@ bool FArchiveXML::StartExport(const fchar* UNUSED(filePath)) bool FArchiveXML::ExportObject(FCDObject* object) { - if (object == NULL) return false; - FUAssert(daeDocument.GetRootNode() != NULL, return false); + if (object == nullptr) return false; + FUAssert(daeDocument.GetRootNode() != nullptr, return false); _FTRY { - return WriteSwitch(object, &object->GetObjectType(), daeDocument.GetRootNode()) != NULL; + return WriteSwitch(object, &object->GetObjectType(), daeDocument.GetRootNode()) != nullptr; } _FCATCH_ALL { @@ -512,10 +512,10 @@ bool FArchiveXML::ExportObject(FCDObject* object) bool FArchiveXML::EndExport(fm::vector& outData) { xmlNode* rootNode = daeDocument.GetRootNode(); - FUAssert(rootNode != NULL, return false); + FUAssert(rootNode != nullptr, return false); - xmlOutputBufferPtr buf = xmlAllocOutputBuffer(NULL); - xmlNodeDumpOutput(buf, rootNode->doc, rootNode, 0, 0, NULL); + xmlOutputBufferPtr buf = xmlAllocOutputBuffer(nullptr); + xmlNodeDumpOutput(buf, rootNode->doc, rootNode, 0, 0, nullptr); #if LIBXML_VERSION >= 20900 outData.resize(xmlOutputBufferGetSize(buf) * sizeof(xmlChar)); @@ -568,10 +568,10 @@ bool FArchiveXML::Import(FCDocument* theDocument, xmlNode* colladaNode) // Bucket the libraries, so that we can read them in our specific order // COLLADA 1.4: the libraries are now strongly-typed, so process all the elements - xmlNode* sceneNode = NULL; + xmlNode* sceneNode = nullptr; xmlOrderedNodeList orderedLibraryNodes; xmlNodeList extraNodes; - for (xmlNode* child = colladaNode->children; child != NULL; child = child->next) + for (xmlNode* child = colladaNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -633,7 +633,7 @@ bool FArchiveXML::Import(FCDocument* theDocument, xmlNode* colladaNode) FindChildrenByType(*it, DAE_TECHNIQUE_ELEMENT, techniqueNodes); for (xmlNodeList::iterator itT = techniqueNodes.begin(); itT != techniqueNodes.end(); ++itT) { - for (xmlNode* child = (*itT)->children; child != NULL; child = child->next) + for (xmlNode* child = (*itT)->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; @@ -700,10 +700,10 @@ bool FArchiveXML::Import(FCDocument* theDocument, xmlNode* colladaNode) } // Read in the element - if (sceneNode != NULL) + if (sceneNode != nullptr) { bool oneVisualSceneInstanceFound = false; - for (xmlNode* child = sceneNode->children; child != NULL; child = child->next) + for (xmlNode* child = sceneNode->children; child != nullptr; child = child->next) { if (child->type != XML_ELEMENT_NODE) continue; bool isVisualSceneInstance = IsEquivalent(child->name, DAE_INSTANCE_VSCENE_ELEMENT) && !oneVisualSceneInstanceFound; @@ -723,7 +723,7 @@ bool FArchiveXML::Import(FCDocument* theDocument, xmlNode* colladaNode) { FCDEntityReference* reference = (isVisualSceneInstance) ? theDocument->GetVisualSceneInstanceReference() : theDocument->AddPhysicsSceneInstanceReference(); reference->SetUri(instanceUri); - if (reference->IsLocal() && reference->GetEntity() == NULL) + if (reference->IsLocal() && reference->GetEntity() == nullptr) { FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_MISSING_URI_TARGET, child->line); } @@ -810,7 +810,7 @@ bool FArchiveXML::ExportDocument(FCDocument* theDocument, xmlNode* colladaNode) FArchiveXML::ClearIntermediateData(); ++FArchiveXML::loadedDocumentCount; - if (colladaNode != NULL) + if (colladaNode != nullptr) { // Write the COLLADA document version and namespace: schema-required attributes AddAttribute(colladaNode, DAE_NAMESPACE_ATTRIBUTE, DAE_SCHEMA_LOCATION); @@ -820,7 +820,7 @@ bool FArchiveXML::ExportDocument(FCDocument* theDocument, xmlNode* colladaNode) FArchiveXML::LetWriteObject(theDocument->GetAsset(), colladaNode); // Record the animation library. This library is built at the end, but should appear before the element. - xmlNode* animationLibraryNode = NULL; + xmlNode* animationLibraryNode = nullptr; if (!theDocument->GetAnimationLibrary()->IsEmpty()) { animationLibraryNode = AddChild(colladaNode, DAE_LIBRARY_ANIMATION_ELEMENT); @@ -859,11 +859,11 @@ bool FArchiveXML::ExportDocument(FCDocument* theDocument, xmlNode* colladaNode) #undef EXPORT_LIBRARY - xmlNode* sceneNode = NULL; + xmlNode* sceneNode = nullptr; if (theDocument->GetPhysicsSceneInstanceCount() > 0) { // Write out the - if (sceneNode == NULL) sceneNode = AddChild(colladaNode, DAE_SCENE_ELEMENT); + if (sceneNode == nullptr) sceneNode = AddChild(colladaNode, DAE_SCENE_ELEMENT); for (size_t i = 0; i < theDocument->GetPhysicsSceneInstanceCount(); ++i) { FCDEntityReference* reference = theDocument->GetPhysicsSceneInstanceReference(i); @@ -873,10 +873,10 @@ bool FArchiveXML::ExportDocument(FCDocument* theDocument, xmlNode* colladaNode) AddAttribute(instanceVisualSceneNode, DAE_URL_ATTRIBUTE, uriString); } } - if (theDocument->GetVisualSceneInstance() != NULL) + if (theDocument->GetVisualSceneInstance() != nullptr) { // Write out the - if (sceneNode == NULL) sceneNode = AddChild(colladaNode, DAE_SCENE_ELEMENT); + if (sceneNode == nullptr) sceneNode = AddChild(colladaNode, DAE_SCENE_ELEMENT); xmlNode* instanceVisualSceneNode = AddChild(sceneNode, DAE_INSTANCE_VSCENE_ELEMENT); const FUUri& uri = theDocument->GetVisualSceneInstanceReference()->GetUri(); fstring uriString = theDocument->GetFileManager()->CleanUri(uri); @@ -898,7 +898,7 @@ bool FArchiveXML::ExportDocument(FCDocument* theDocument, xmlNode* colladaNode) } // Write out the animations - if (animationLibraryNode != NULL) + if (animationLibraryNode != nullptr) { if (!theDocument->GetAnimationLibrary()->GetTransientFlag()) FArchiveXML::WriteLibrary(theDocument->GetAnimationLibrary(), animationLibraryNode); @@ -932,7 +932,7 @@ bool FArchiveXML::LoadLibrary(FCDObject* object, xmlNode* node) FCDLibrary* library = (FCDLibrary*)object; bool status = true; - for (xmlNode* child = node->children; child != NULL; child = child->next) + for (xmlNode* child = node->children; child != nullptr; child = child->next) { if (child->type == XML_ELEMENT_NODE) { @@ -970,7 +970,7 @@ xmlNode* FArchiveXML::WriteSwitch(FCDObject* object, const FUObjectType* objectT } else { - return NULL; + return nullptr; } } @@ -983,7 +983,7 @@ xmlNode* FArchiveXML::WriteParentSwitch(FCDObject* object, const FUObjectType* o else { FUBreak; - return NULL; + return nullptr; } } @@ -1067,7 +1067,7 @@ xmlNode* FArchiveXML::WriteLibrary(FCDLibrary* library, xmlNode* node) { // If present, write out the . FCDAsset* asset = library->GetAsset(false); - if (asset != NULL) WriteAsset(asset, node); + if (asset != nullptr) WriteAsset(asset, node); // Write out all the entities. for (size_t i = 0; i < library->GetEntityCount(); ++i) diff --git a/FColladaPlugins/FArchiveXML/FArchiveXML.h b/FColladaPlugins/FArchiveXML/FArchiveXML.h index fe667e7..bcc4ac7 100644 --- a/FColladaPlugins/FArchiveXML/FArchiveXML.h +++ b/FColladaPlugins/FArchiveXML/FArchiveXML.h @@ -290,7 +290,7 @@ class FArchiveXML : public FCPArchive // // Physics related functions // - static bool LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters, xmlNode* techniqueNode, FCDPhysicsRigidBodyParameters* defaultParameters = NULL); + static bool LoadPhysicsRigidBodyParameters(FCDPhysicsRigidBodyParameters* parameters, xmlNode* techniqueNode, FCDPhysicsRigidBodyParameters* defaultParameters = nullptr); static bool AttachModelInstancesFCDPhysicsModel(FCDPhysicsModel* physicsModel); static bool LoadPhysicsShape(FCDObject* object, xmlNode* node); @@ -414,7 +414,7 @@ class FArchiveXML : public FCPArchive { if (!object->GetTransientFlag()) return FArchiveXML::WriteSwitch(object, &object->GetObjectType(), (xmlNode*) entityNode); - return NULL; + return nullptr; } // diff --git a/FColladaTools/FCProcessImages/FCProcessImages.cpp b/FColladaTools/FCProcessImages/FCProcessImages.cpp index a3b753f..bacd971 100644 --- a/FColladaTools/FCProcessImages/FCProcessImages.cpp +++ b/FColladaTools/FCProcessImages/FCProcessImages.cpp @@ -87,8 +87,8 @@ int main(int argc, const char* argv[], char* envp[]) // on a COLLADA document. FCDAssetContributor* contributor = document->GetAsset()->AddContributor(); const char* userName = getenv("USER"); - if (userName == NULL) userName = getenv("USERNAME"); - if (userName != NULL) contributor->SetAuthor(TO_FSTRING(userName)); + if (userName == nullptr) userName = getenv("USERNAME"); + if (userName != nullptr) contributor->SetAuthor(TO_FSTRING(userName)); contributor->SetSourceData(inputFilename); char authoringTool[1024]; snprintf(authoringTool, 1024, "FCProcessImages sample for FCollada v%d.%02d", FCOLLADA_VERSION >> 16, FCOLLADA_VERSION & 0xFFFF); diff --git a/FColladaTools/FCProcessMeshes/FCProcessMeshes.cpp b/FColladaTools/FCProcessMeshes/FCProcessMeshes.cpp index 13cfe87..d0b63aa 100644 --- a/FColladaTools/FCProcessMeshes/FCProcessMeshes.cpp +++ b/FColladaTools/FCProcessMeshes/FCProcessMeshes.cpp @@ -125,8 +125,8 @@ int main(int argc, const char* argv[], char* envp[]) // on a COLLADA document. FCDAssetContributor* contributor = document->GetAsset()->AddContributor(); const char* userName = getenv("USER"); - if (userName == NULL) userName = getenv("USERNAME"); - if (userName != NULL) contributor->SetAuthor(TO_FSTRING(userName)); + if (userName == nullptr) userName = getenv("USERNAME"); + if (userName != nullptr) contributor->SetAuthor(TO_FSTRING(userName)); contributor->SetSourceData(inputFilename); char authoringTool[1024]; snprintf(authoringTool, 1024, "FCProcessMeshes sample for FCollada v%d.%02d", FCOLLADA_VERSION >> 16, FCOLLADA_VERSION & 0xFFFF); @@ -181,7 +181,7 @@ void ProcessMesh(FCDGeometryMesh* mesh, const ProcessMeshesOptions& options) if (options.textureTangents) { FCDGeometrySource* texcoordSource = mesh->FindSourceByType(FUDaeGeometryInput::TEXCOORD); - if (texcoordSource != NULL) + if (texcoordSource != nullptr) { // Generate the texture tangents for this mesh' texcoords. FCDGeometryPolygonsTools::GenerateTextureTangentBasis(mesh, texcoordSource, true);