// This code contains NVIDIA Confidential Information and is disclosed to you // under a form of NVIDIA software license agreement provided separately to you. // // Notice // NVIDIA Corporation and its licensors retain all intellectual property and // proprietary rights in and to this software and related documentation and // any modifications thereto. Any use, reproduction, disclosure, or // distribution of this software and related documentation without an express // license agreement from NVIDIA Corporation is strictly prohibited. // // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. // // Information and code furnished is believed to be accurate and reliable. // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such // information or for any infringement of patents or other rights of third parties that may // result from its use. No license is granted by implication or otherwise under any patent // or patent rights of NVIDIA Corporation. Details are subject to change without notice. // This code supersedes and replaces all information previously supplied. // NVIDIA Corporation products are not authorized for use as critical // components in life support devices or systems without express written approval of // NVIDIA Corporation. // // Copyright (c) 2008-2015 NVIDIA Corporation. All rights reserved. // This file was generated by NvParameterized/scripts/GenParameterized.pl #include "MeshIofxParameters.h" #include #include using namespace NvParameterized; namespace nvidia { namespace iofx { using namespace MeshIofxParametersNS; const char* const MeshIofxParametersFactory::vptr = NvParameterized::getVptr(); const uint32_t NumParamDefs = 9; static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; static const size_t ParamLookupChildrenTable[] = { 1, 5, 7, 2, 3, 4, 6, 8, }; #define TENUM(type) nvidia::##type #define CHILDREN(index) &ParamLookupChildrenTable[index] static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = { { TYPE_STRUCT, false, 0, CHILDREN(0), 3 }, { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->renderMeshList), CHILDREN(3), 1 }, // renderMeshList { TYPE_STRUCT, false, 1 * sizeof(meshProperties_Type), CHILDREN(4), 2 }, // renderMeshList[] { TYPE_REF, false, (size_t)(&((meshProperties_Type*)0)->meshAssetName), NULL, 0 }, // renderMeshList[].meshAssetName { TYPE_U32, false, (size_t)(&((meshProperties_Type*)0)->weight), NULL, 0 }, // renderMeshList[].weight { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->spawnModifierList), CHILDREN(6), 1 }, // spawnModifierList { TYPE_REF, false, 1 * sizeof(NvParameterized::Interface*), NULL, 0 }, // spawnModifierList[] { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->continuousModifierList), CHILDREN(7), 1 }, // continuousModifierList { TYPE_REF, false, 1 * sizeof(NvParameterized::Interface*), NULL, 0 }, // continuousModifierList[] }; bool MeshIofxParameters::mBuiltFlag = false; NvParameterized::MutexType MeshIofxParameters::mBuiltFlagMutex; MeshIofxParameters::MeshIofxParameters(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : NvParameters(traits, buf, refCount) { //mParameterizedTraits->registerFactory(className(), &MeshIofxParametersFactoryInst); if (!buf) //Do not init data if it is inplace-deserialized { initDynamicArrays(); initStrings(); initReferences(); initDefaults(); } } MeshIofxParameters::~MeshIofxParameters() { freeStrings(); freeReferences(); freeDynamicArrays(); } void MeshIofxParameters::destroy() { // We cache these fields here to avoid overwrite in destructor bool doDeallocateSelf = mDoDeallocateSelf; NvParameterized::Traits* traits = mParameterizedTraits; int32_t* refCount = mRefCount; void* buf = mBuffer; this->~MeshIofxParameters(); NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); } const NvParameterized::DefinitionImpl* MeshIofxParameters::getParameterDefinitionTree(void) { if (!mBuiltFlag) // Double-checked lock { NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); if (!mBuiltFlag) { buildTree(); } } return(&ParamDefTable[0]); } const NvParameterized::DefinitionImpl* MeshIofxParameters::getParameterDefinitionTree(void) const { MeshIofxParameters* tmpParam = const_cast(this); if (!mBuiltFlag) // Double-checked lock { NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); if (!mBuiltFlag) { tmpParam->buildTree(); } } return(&ParamDefTable[0]); } NvParameterized::ErrorType MeshIofxParameters::getParameterHandle(const char* long_name, Handle& handle) const { ErrorType Ret = NvParameters::getParameterHandle(long_name, handle); if (Ret != ERROR_NONE) { return(Ret); } size_t offset; void* ptr; getVarPtr(handle, ptr, offset); if (ptr == NULL) { return(ERROR_INDEX_OUT_OF_RANGE); } return(ERROR_NONE); } NvParameterized::ErrorType MeshIofxParameters::getParameterHandle(const char* long_name, Handle& handle) { ErrorType Ret = NvParameters::getParameterHandle(long_name, handle); if (Ret != ERROR_NONE) { return(Ret); } size_t offset; void* ptr; getVarPtr(handle, ptr, offset); if (ptr == NULL) { return(ERROR_INDEX_OUT_OF_RANGE); } return(ERROR_NONE); } void MeshIofxParameters::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const { ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast(¶meters()), handle, offset); } /* Dynamic Handle Indices */ /* [1,0] - renderMeshList.meshAssetName */ /* [0] - spawnModifierList (not an array of structs) */ /* [0] - continuousModifierList (not an array of structs) */ void MeshIofxParameters::freeParameterDefinitionTable(NvParameterized::Traits* traits) { if (!traits) { return; } if (!mBuiltFlag) // Double-checked lock { return; } NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); if (!mBuiltFlag) { return; } for (uint32_t i = 0; i < NumParamDefs; ++i) { ParamDefTable[i].~DefinitionImpl(); } traits->free(ParamDefTable); mBuiltFlag = false; } #define PDEF_PTR(index) (&ParamDefTable[index]) void MeshIofxParameters::buildTree(void) { uint32_t allocSize = sizeof(NvParameterized::DefinitionImpl) * NumParamDefs; ParamDefTable = (NvParameterized::DefinitionImpl*)(mParameterizedTraits->alloc(allocSize)); memset(ParamDefTable, 0, allocSize); for (uint32_t i = 0; i < NumParamDefs; ++i) { NV_PARAM_PLACEMENT_NEW(ParamDefTable + i, NvParameterized::DefinitionImpl)(*mParameterizedTraits); } // Initialize DefinitionImpl node: nodeIndex=0, longName="" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[0]; ParamDef->init("", TYPE_STRUCT, "STRUCT", true); } // Initialize DefinitionImpl node: nodeIndex=1, longName="renderMeshList" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; ParamDef->init("renderMeshList", TYPE_ARRAY, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS #else static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("shortDescription", "An array of mesh asset names with their respective weights (if this is a render mesh IOFX)", true); ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ ParamDef->setArraySize(-1); static const uint8_t dynHandleIndices[2] = { 1, 0, }; ParamDef->setDynamicHandleIndicesMap(dynHandleIndices, 2); } // Initialize DefinitionImpl node: nodeIndex=2, longName="renderMeshList[]" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; ParamDef->init("renderMeshList", TYPE_STRUCT, "meshProperties", true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS #else static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("shortDescription", "An array of mesh asset names with their respective weights (if this is a render mesh IOFX)", true); ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ } // Initialize DefinitionImpl node: nodeIndex=3, longName="renderMeshList[].meshAssetName" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; ParamDef->init("meshAssetName", TYPE_REF, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS #else static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("shortDescription", "The render mesh asset name or opaque mesh name", true); ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ static const char* const RefVariantVals[] = { "ApexRenderMesh", "ApexOpaqueMesh" }; ParamDefTable[3].setRefVariantVals((const char**)RefVariantVals, 2); } // Initialize DefinitionImpl node: nodeIndex=4, longName="renderMeshList[].weight" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; ParamDef->init("weight", TYPE_U32, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("defaultValue", uint64_t(1), true); ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #else static HintImpl HintTable[2]; static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; HintTable[0].init("defaultValue", uint64_t(1), true); HintTable[1].init("shortDescription", "The weight for this mesh (weighed against other meshes)", true); ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ } // Initialize DefinitionImpl node: nodeIndex=5, longName="spawnModifierList" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; ParamDef->init("spawnModifierList", TYPE_ARRAY, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("INCLUDED", uint64_t(1), true); ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #else static HintImpl HintTable[3]; static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; HintTable[0].init("INCLUDED", uint64_t(1), true); HintTable[1].init("longDescription", "These modifiers are applied to the instanced objects at object creation.", true); HintTable[2].init("shortDescription", "Spawn modifier list", true); ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 3); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ static const char* const RefVariantVals[] = { "RotationModifierParams", "SimpleScaleModifierParams", "RandomScaleModifierParams", "InitialColorModifierParams", "ScaleByMassModifierParams" }; ParamDefTable[5].setRefVariantVals((const char**)RefVariantVals, 5); ParamDef->setArraySize(-1); static const uint8_t dynHandleIndices[1] = { 0, }; ParamDef->setDynamicHandleIndicesMap(dynHandleIndices, 1); } // Initialize DefinitionImpl node: nodeIndex=6, longName="spawnModifierList[]" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; ParamDef->init("spawnModifierList", TYPE_REF, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS static HintImpl HintTable[1]; static Hint* HintPtrTable[1] = { &HintTable[0], }; HintTable[0].init("INCLUDED", uint64_t(1), true); ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 1); #else static HintImpl HintTable[3]; static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; HintTable[0].init("INCLUDED", uint64_t(1), true); HintTable[1].init("longDescription", "These modifiers are applied to the instanced objects at object creation.", true); HintTable[2].init("shortDescription", "Spawn modifier list", true); ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 3); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ static const char* const RefVariantVals[] = { "RotationModifierParams", "SimpleScaleModifierParams", "RandomScaleModifierParams", "InitialColorModifierParams", "ScaleByMassModifierParams" }; ParamDefTable[6].setRefVariantVals((const char**)RefVariantVals, 5); } // Initialize DefinitionImpl node: nodeIndex=7, longName="continuousModifierList" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; ParamDef->init("continuousModifierList", TYPE_ARRAY, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS static HintImpl HintTable[5]; static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; HintTable[0].init("HIDE_CLASS1", "ScaleVsLifeModifierParams", true); HintTable[1].init("HIDE_CLASS2", "ScaleVsDensityModifierParams", true); HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); HintTable[3].init("HIDE_CLASS4", "ScaleVsTemperatureModifierParams", true); HintTable[4].init("INCLUDED", uint64_t(1), true); ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 5); #else static HintImpl HintTable[7]; static Hint* HintPtrTable[7] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], }; HintTable[0].init("HIDE_CLASS1", "ScaleVsLifeModifierParams", true); HintTable[1].init("HIDE_CLASS2", "ScaleVsDensityModifierParams", true); HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); HintTable[3].init("HIDE_CLASS4", "ScaleVsTemperatureModifierParams", true); HintTable[4].init("INCLUDED", uint64_t(1), true); HintTable[5].init("longDescription", "These modifiers are applied to the instanced objects every frame.", true); HintTable[6].init("shortDescription", "Continuous modifier list", true); ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 7); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ static const char* const RefVariantVals[] = { "RotationModifierParams", "ScaleVsLife3DModifierParams", "ScaleVsDensity3DModifierParams", "ScaleVsTemperature3DModifierParams", "ScaleVsCameraDistance3DModifierParams", "OrientAlongVelocityModifierParams", "ScaleAlongVelocityModifierParams", "ColorVsLifeCompositeModifierParams", "ColorVsDensityCompositeModifierParams", "ColorVsTemperatureCompositeModifierParams", "ScaleVsLifeModifierParams", "ScaleVsDensityModifierParams", "ScaleVsTemperatureModifierParams", "ScaleVsCameraDistanceModifierParams", "ColorVsVelocityCompositeModifierParams" }; ParamDefTable[7].setRefVariantVals((const char**)RefVariantVals, 15); ParamDef->setArraySize(-1); static const uint8_t dynHandleIndices[1] = { 0, }; ParamDef->setDynamicHandleIndicesMap(dynHandleIndices, 1); } // Initialize DefinitionImpl node: nodeIndex=8, longName="continuousModifierList[]" { NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; ParamDef->init("continuousModifierList", TYPE_REF, NULL, true); #ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS static HintImpl HintTable[5]; static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; HintTable[0].init("HIDE_CLASS1", "ScaleVsLifeModifierParams", true); HintTable[1].init("HIDE_CLASS2", "ScaleVsDensityModifierParams", true); HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); HintTable[3].init("HIDE_CLASS4", "ScaleVsTemperatureModifierParams", true); HintTable[4].init("INCLUDED", uint64_t(1), true); ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 5); #else static HintImpl HintTable[7]; static Hint* HintPtrTable[7] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], }; HintTable[0].init("HIDE_CLASS1", "ScaleVsLifeModifierParams", true); HintTable[1].init("HIDE_CLASS2", "ScaleVsDensityModifierParams", true); HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); HintTable[3].init("HIDE_CLASS4", "ScaleVsTemperatureModifierParams", true); HintTable[4].init("INCLUDED", uint64_t(1), true); HintTable[5].init("longDescription", "These modifiers are applied to the instanced objects every frame.", true); HintTable[6].init("shortDescription", "Continuous modifier list", true); ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 7); #endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ static const char* const RefVariantVals[] = { "RotationModifierParams", "ScaleVsLife3DModifierParams", "ScaleVsDensity3DModifierParams", "ScaleVsTemperature3DModifierParams", "ScaleVsCameraDistance3DModifierParams", "OrientAlongVelocityModifierParams", "ScaleAlongVelocityModifierParams", "ColorVsLifeCompositeModifierParams", "ColorVsDensityCompositeModifierParams", "ColorVsTemperatureCompositeModifierParams", "ScaleVsLifeModifierParams", "ScaleVsDensityModifierParams", "ScaleVsTemperatureModifierParams", "ScaleVsCameraDistanceModifierParams", "ColorVsVelocityCompositeModifierParams" }; ParamDefTable[8].setRefVariantVals((const char**)RefVariantVals, 15); } // SetChildren for: nodeIndex=0, longName="" { static Definition* Children[3]; Children[0] = PDEF_PTR(1); Children[1] = PDEF_PTR(5); Children[2] = PDEF_PTR(7); ParamDefTable[0].setChildren(Children, 3); } // SetChildren for: nodeIndex=1, longName="renderMeshList" { static Definition* Children[1]; Children[0] = PDEF_PTR(2); ParamDefTable[1].setChildren(Children, 1); } // SetChildren for: nodeIndex=2, longName="renderMeshList[]" { static Definition* Children[2]; Children[0] = PDEF_PTR(3); Children[1] = PDEF_PTR(4); ParamDefTable[2].setChildren(Children, 2); } // SetChildren for: nodeIndex=5, longName="spawnModifierList" { static Definition* Children[1]; Children[0] = PDEF_PTR(6); ParamDefTable[5].setChildren(Children, 1); } // SetChildren for: nodeIndex=7, longName="continuousModifierList" { static Definition* Children[1]; Children[0] = PDEF_PTR(8); ParamDefTable[7].setChildren(Children, 1); } mBuiltFlag = true; } void MeshIofxParameters::initStrings(void) { } void MeshIofxParameters::initDynamicArrays(void) { renderMeshList.buf = NULL; renderMeshList.isAllocated = true; renderMeshList.elementSize = sizeof(meshProperties_Type); renderMeshList.arraySizes[0] = 0; spawnModifierList.buf = NULL; spawnModifierList.isAllocated = true; spawnModifierList.elementSize = sizeof(NvParameterized::Interface*); spawnModifierList.arraySizes[0] = 0; continuousModifierList.buf = NULL; continuousModifierList.isAllocated = true; continuousModifierList.elementSize = sizeof(NvParameterized::Interface*); continuousModifierList.arraySizes[0] = 0; } void MeshIofxParameters::initDefaults(void) { freeStrings(); freeReferences(); freeDynamicArrays(); initDynamicArrays(); initStrings(); initReferences(); } void MeshIofxParameters::initReferences(void) { } void MeshIofxParameters::freeDynamicArrays(void) { if (renderMeshList.isAllocated && renderMeshList.buf) { mParameterizedTraits->free(renderMeshList.buf); } if (spawnModifierList.isAllocated && spawnModifierList.buf) { mParameterizedTraits->free(spawnModifierList.buf); } if (continuousModifierList.isAllocated && continuousModifierList.buf) { mParameterizedTraits->free(continuousModifierList.buf); } } void MeshIofxParameters::freeStrings(void) { } void MeshIofxParameters::freeReferences(void) { for (int i = 0; i < renderMeshList.arraySizes[0]; i++) { if (renderMeshList.buf[i].meshAssetName) { renderMeshList.buf[i].meshAssetName->destroy(); } } for (int i = 0; i < spawnModifierList.arraySizes[0]; ++i) { if (spawnModifierList.buf[i]) { spawnModifierList.buf[i]->destroy(); } } for (int i = 0; i < continuousModifierList.arraySizes[0]; ++i) { if (continuousModifierList.buf[i]) { continuousModifierList.buf[i]->destroy(); } } } } // namespace iofx } // namespace nvidia