diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/module/iofx/src | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'APEX_1.4/module/iofx/src')
52 files changed, 22865 insertions, 0 deletions
diff --git a/APEX_1.4/module/iofx/src/IofxActorCPU.cpp b/APEX_1.4/module/iofx/src/IofxActorCPU.cpp new file mode 100644 index 00000000..25663b71 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxActorCPU.cpp @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "SceneIntl.h" +#include "Modifier.h" +#include "IofxActor.h" +#include "IofxActorCPU.h" +#include "IofxAssetImpl.h" +#include "IofxSceneCPU.h" +#include "IosObjectData.h" + +#include "ModuleIofxImpl.h" + +#include "ARLSort.h" + + +namespace nvidia +{ +namespace iofx +{ + +void TaskModifiers::run() +{ + setProfileStat((uint16_t) mOwner.mWorkingRange.objectCount); + mOwner.updateBounds(); + mOwner.runModifiers(); +} + + +#pragma warning(disable: 4355) // 'this' : used in base member initializer list + +IofxActorCPU::IofxActorCPU(ResID renderResID, IofxScene* iscene, IofxManager& mgr) + : IofxActorImpl(renderResID, iscene, mgr) + , mModifierTask(*this) +{ +} + +void IofxActorCPU::updateBounds() +{ + mWorkingBounds.setEmpty(); + + const IosObjectCpuData& objData = *static_cast<const IosObjectCpuData*>(mMgr.mWorkingIosData); + + for (uint32_t id = 0; id < mWorkingRange.objectCount; id++) + { + uint32_t outputID = mWorkingRange.startIndex + id; + + uint32_t stateID = objData.outputToState[ outputID ]; + PX_ASSERT(stateID != IosBufferDescIntl::NOT_A_PARTICLE); + PX_ASSERT(stateID < objData.maxStateID); + + uint32_t inputID = objData.pmaInStateToInput->get(stateID); + PX_ASSERT(inputID != IosBufferDescIntl::NOT_A_PARTICLE); + inputID &= ~IosBufferDescIntl::NEW_PARTICLE_FLAG; + PX_ASSERT(inputID < objData.maxInputCount); + + // include particle in renderable bounds + mWorkingBounds.include(objData.pmaPositionMass->get(inputID).getXYZ()); + } +} + +PX_INLINE void MeshInput::load(const IosObjectBaseData& objData, uint32_t pos) +{ + position = objData.pmaPositionMass->get(pos).getXYZ(); + mass = objData.pmaPositionMass->get(pos).w; + velocity = objData.pmaVelocityLife->get(pos).getXYZ(); + liferemain = objData.pmaVelocityLife->get(pos).w; + density = objData.pmaDensity ? objData.pmaDensity->get(pos) : 0; + collisionNormal = objData.pmaCollisionNormalFlags ? objData.pmaCollisionNormalFlags->get(pos).getXYZ() : PxVec3(0.0f); + collisionFlags = objData.pmaCollisionNormalFlags ? *(const uint32_t*)(&objData.pmaCollisionNormalFlags->get(pos).w) : 0; + + userData = objData.pmaUserData ? objData.pmaUserData->get(pos) : 0; +} + +PX_INLINE void SpriteInput::load(const IosObjectBaseData& objData, uint32_t pos) +{ + position = objData.pmaPositionMass->get(pos).getXYZ(); + mass = objData.pmaPositionMass->get(pos).w; + velocity = objData.pmaVelocityLife->get(pos).getXYZ(); + liferemain = objData.pmaVelocityLife->get(pos).w; + density = objData.pmaDensity ? objData.pmaDensity->get(pos) : 0; + + userData = objData.pmaUserData ? objData.pmaUserData->get(pos) : 0; +} + + +void IofxActorCPU::runModifiers() +{ + mWorkingVisibleCount = mWorkingRange.objectCount; + + IosObjectCpuData* obj = DYNAMIC_CAST(IosObjectCpuData*)(mMgr.mWorkingIosData); + if (mMgr.mIsMesh) + { + IofxSharedRenderDataMeshImpl* meshRenderData = DYNAMIC_CAST(IofxSharedRenderDataMeshImpl*)(obj->renderData); + const IofxMeshRenderLayout& meshRenderLayout = meshRenderData->getRenderLayout(); + + MeshOutputLayout outputLayout; + PX_COMPILE_TIME_ASSERT(sizeof(outputLayout.offsets) == sizeof(meshRenderLayout.offsets)); + ::memcpy(outputLayout.offsets, meshRenderLayout.offsets, sizeof(outputLayout.offsets)); + outputLayout.stride = meshRenderLayout.stride; + + updateParticles<MeshInput, MeshPublicState, MeshPrivateState>(*obj, + outputLayout, + static_cast<uint8_t*>(meshRenderData->getBufferMappedPtr()) + ); + } + else + { + if (mDistanceSortingEnabled) + { + const ObjectRange& range = mWorkingRange; + + mWorkingVisibleCount = 0; + PX_ASSERT(obj->sortingKeys != NULL); + for (uint32_t outputId = range.startIndex; outputId < range.startIndex + range.objectCount ; outputId++) + { + uint32_t stateId = obj->outputToState[ outputId ]; + PX_ASSERT(stateId != IosBufferDescIntl::NOT_A_PARTICLE); + uint32_t inputId = obj->pmaInStateToInput->get(stateId); + inputId &= ~IosBufferDescIntl::NEW_PARTICLE_FLAG; + + const PxVec3 position = obj->pmaPositionMass->get(inputId).getXYZ(); + float sortDistance = obj->zNear + (obj->eyePosition - position).dot(obj->eyeDirection); + + //build uint key for radix sorting (flip float) + uint32_t key = *reinterpret_cast<const uint32_t*>(&sortDistance); + uint32_t mask = -int32_t(key >> 31) | 0x80000000; + key ^= mask; + + obj->sortingKeys[ outputId ] = key; + if ((key & 0x80000000) == 0) ++mWorkingVisibleCount; + } + + uint32_t* keys = obj->sortingKeys + range.startIndex; + uint32_t* values = obj->outputToState + range.startIndex; + iofx::ARLSort<uint32_t, uint32_t>::sort(keys, values, (int32_t)range.objectCount); + + if (range.objectCount > 0) + { + PX_ASSERT(values[range.objectCount - 1] < obj->maxStateID); + } + } + + IofxSharedRenderDataSpriteImpl* spriteRenderData = DYNAMIC_CAST(IofxSharedRenderDataSpriteImpl*)(obj->renderData); + const IofxSpriteRenderLayout& spriteRenderLayout = spriteRenderData->getRenderLayout(); + if (spriteRenderLayout.surfaceCount > 0) + { + SpriteTextureOutputLayout outputLayout; + bool result = true; + for (uint32_t i = 0; i < spriteRenderLayout.surfaceCount; ++i) + { + UserRenderSurface::MappedInfo mappedInfo; + if (spriteRenderData->getSurfaceMappedInfo(i, mappedInfo)) + { + const UserRenderSurfaceDesc& surfaceDesc = spriteRenderLayout.surfaceDescs[i]; + outputLayout.textureData[i].layout = static_cast<uint16_t>(spriteRenderLayout.surfaceElements[i]); + + outputLayout.texturePtr[i] = static_cast<uint8_t*>(mappedInfo.pData); + + const uint32_t surfaceWidth = uint32_t(surfaceDesc.width); + const uint32_t surfacePitch = mappedInfo.rowPitch; + + PX_ASSERT(isPowerOfTwo(surfaceWidth)); + outputLayout.textureData[i].widthShift = static_cast<uint8_t>(highestSetBit(surfaceWidth)); + PX_ASSERT(isPowerOfTwo(surfacePitch)); + outputLayout.textureData[i].pitchShift = static_cast<uint8_t>(highestSetBit(surfacePitch)); + } + else + { + result = false; + break; + } + } + outputLayout.textureCount = result ? spriteRenderLayout.surfaceCount : 0; + + updateParticles<SpriteInput, SpritePublicState, SpritePrivateState>(*obj, outputLayout, NULL); + } + else + { + SpriteOutputLayout outputLayout; + /* Copy user-defined semantics offsets to output offsets */ + PX_COMPILE_TIME_ASSERT(sizeof(outputLayout.offsets) == sizeof(spriteRenderLayout.offsets)); + ::memcpy(outputLayout.offsets, spriteRenderLayout.offsets, sizeof(outputLayout.offsets)); + outputLayout.stride = spriteRenderLayout.stride; + + updateParticles<SpriteInput, SpritePublicState, SpritePrivateState>(*obj, + outputLayout, + static_cast<uint8_t*>(spriteRenderData->getBufferMappedPtr()) + ); + } + } +} + +class ModifierParamsMapperCPUimpl : public ModifierParamsMapperCPU +{ + template <typename T> + void _mapValue(size_t offset, T value) + { + if (mData != 0) + { + *(T*)(mData + mParamsOffset + offset) = value; + } + } + +public: + virtual void beginParams(void* , size_t size, size_t align, uint32_t) + { + mParamsOffset = (mTotalSize + (uint32_t)align - 1) & ~((uint32_t)align - 1); + mTotalSize = mParamsOffset + (uint32_t)size; + } + virtual void endParams() + { + } + + virtual void mapValue(size_t offset, int32_t value) + { + _mapValue(offset, value); + } + virtual void mapValue(size_t offset, float value) + { + _mapValue(offset, value); + } + virtual void mapCurve(size_t offset, const nvidia::apex::Curve* curve) + { + _mapValue(offset, curve); + } + + ModifierParamsMapperCPUimpl() + { + reset(0); + } + + void reset(uint8_t* data) + { + mData = data; + mTotalSize = 0; + mParamsOffset = 0; + } + + uint32_t getTotalSize() const + { + return mTotalSize; + } + uint32_t getParamsOffset() const + { + return mParamsOffset; + } + +private: + uint8_t* mData; + + uint32_t mTotalSize; + uint32_t mParamsOffset; +}; + + +uint32_t IofxAssetSceneInstCPU::introspectModifiers(ModifierParamsMapperCPUimpl& introspector, ModifierInfo* list, const ModifierStack& stack, ModifierStage stage, uint32_t usageClass) +{ + uint32_t usageStage = ModifierUsageFromStage(stage); + uint32_t count = 0; + for (ModifierStack::ConstIterator it = stack.begin(); it != stack.end(); ++it) + { + //uint32_t type = (*it)->getModifierType(); + uint32_t usage = (*it)->getModifierUsage(); + if ((usage & usageStage) == usageStage && (usage & usageClass) == usageClass) + { + const ModifierImpl* modifier = ModifierImpl::castFrom(*it); + modifier->mapParamsCPU(introspector); + if (list != 0) + { + if (usageClass == ModifierUsage_Sprite) + { + list[count].updateSpriteFunc = modifier->getUpdateSpriteFunc(stage); + } + else + { + list[count].updateMeshFunc = modifier->getUpdateMeshFunc(stage); + } + + list[count].paramsOffset = introspector.getParamsOffset(); + } + ++count; + } + } + return count; +} + +IofxAssetSceneInstCPU::IofxAssetSceneInstCPU(IofxAssetImpl* asset, uint32_t semantics, IofxScene* scene) + : IofxAssetSceneInst(asset, semantics) +{ + PX_UNUSED(scene); + + const ModifierStack& spawnModifiers = asset->getModifierStack(ModifierStage_Spawn); + const ModifierStack& continuousModifiers = asset->getModifierStack(ModifierStage_Continuous); + + // set the particle buffer type here + uint32_t usageClass = (asset->getMeshAssetCount() > 0) ? ModifierUsage_Mesh : ModifierUsage_Sprite; + + //collect params + ModifierParamsMapperCPUimpl paramsMapper; + + uint32_t spawnModifierCount = introspectModifiers(paramsMapper, 0, spawnModifiers, ModifierStage_Spawn, usageClass); + uint32_t continuousModifierCount = introspectModifiers(paramsMapper, 0, continuousModifiers, ModifierStage_Continuous, usageClass); + + mSpawnModifiersList.resize(spawnModifierCount); + mContinuousModifiersList.resize(continuousModifierCount); + + mModifiersParamsBuffer.resize(paramsMapper.getTotalSize()); + + paramsMapper.reset(mModifiersParamsBuffer.begin()); + + introspectModifiers(paramsMapper, mSpawnModifiersList.begin(), spawnModifiers, ModifierStage_Spawn, usageClass); + introspectModifiers(paramsMapper, mContinuousModifiersList.begin(), continuousModifiers, ModifierStage_Continuous, usageClass); +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/IofxActorImpl.cpp b/APEX_1.4/module/iofx/src/IofxActorImpl.cpp new file mode 100644 index 00000000..6996e880 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxActorImpl.cpp @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "IofxActor.h" +#include "IofxActorImpl.h" +#include "IofxSceneCPU.h" +#include "IofxSceneGPU.h" +#include "RenderVolumeImpl.h" +#include "IosObjectData.h" +#include "IofxRenderData.h" + +#include "ModuleIofxImpl.h" + +namespace nvidia +{ +namespace iofx +{ + +IofxActorImpl::IofxActorImpl(ResID renderResID, IofxScene* iscene, IofxManager& mgr) + : mRenderResID(renderResID) + , mIofxScene(iscene) + , mMgr(mgr) + , mRenderVolume(NULL) // IOS will set this after creation + , mSemantics(0) + , mActiveRenderable(NULL) +{ + //asset.add(*this); + + mResultBounds.setEmpty(); + mResultRange.startIndex = 0; + mResultRange.objectCount = 0; + mResultVisibleCount = 0; + + addSelfToContext(*iscene->mApexScene->getApexContext()); // Add self to ApexScene + addSelfToContext(*iscene); // Add self to IofxScene +} + +IofxActorImpl::~IofxActorImpl() +{ +} + +void IofxActorImpl::getLodRange(float& min, float& max, bool& intOnly) const +{ + READ_ZONE(); + PX_UNUSED(min); + PX_UNUSED(max); + PX_UNUSED(intOnly); + APEX_INVALID_OPERATION("not implemented"); +} + + +float IofxActorImpl::getActiveLod() const +{ + READ_ZONE(); + APEX_INVALID_OPERATION("BasicIosActor does not support this operation"); + return -1.0f; +} + + +void IofxActorImpl::forceLod(float lod) +{ + WRITE_ZONE(); + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +void IofxActorImpl::release() +{ + if (mInRelease) + { + return; + } + mInRelease = true; + destroy(); +} + + +void IofxActorImpl::destroy() +{ + if (mRenderVolume) + { + mRenderVolume->removeIofxActor(*this); + } + + // Removes self from scenes and IOFX manager + // should be called after mRenderVolume->removeIofxActor to avoid dead-lock!!! + ApexActor::destroy(); + + for (uint32_t i = 0 ; i < mRenderableArray.size() ; i++) + { + IofxRenderableImpl* renderable = mRenderableArray[i]; + if (renderable != NULL) + { + renderable->release(); + } + } + mRenderableArray.clear(); + + delete this; +} + +bool IofxActorImpl::prepareRenderables(IosObjectBaseData* obj) +{ + if (mResultRange.objectCount > 0 && obj->renderData->checkSemantics(mSemantics)) + { + const uint32_t instanceID = obj->renderData->getInstanceID(); + if (mRenderableArray.size() <= instanceID) + { + mRenderableArray.resize(instanceID + 1, NULL); + } + mActiveRenderable = mRenderableArray[instanceID]; + if (mActiveRenderable == NULL) + { + if (mMgr.mIsMesh) + { + mActiveRenderable = PX_NEW(IofxMeshRenderable)(mIofxScene, mRenderResID); + } + else + { + mActiveRenderable = PX_NEW(IofxSpriteRenderable)(mIofxScene, mRenderResID); + } + mRenderableArray[instanceID] = mActiveRenderable; + } + + mActiveRenderable->update(obj->renderData, mResultBounds, mResultRange.startIndex, mResultRange.objectCount, mResultVisibleCount); + return true; + } + else + { + mActiveRenderable = NULL; + return false; + } +} + +IofxRenderable* IofxActorImpl::acquireRenderableReference() +{ + return mActiveRenderable ? mActiveRenderable->incrementReferenceCount() : NULL; +} + + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/IofxAssetImpl.cpp b/APEX_1.4/module/iofx/src/IofxAssetImpl.cpp new file mode 100644 index 00000000..b04211a9 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxAssetImpl.cpp @@ -0,0 +1,1138 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "ApexUsingNamespace.h" +#include "IofxAssetImpl.h" +#include "IofxActorImpl.h" +#include "IofxScene.h" +#include "ModuleIofxImpl.h" +#include "Modifier.h" +#include "ModifierImpl.h" +#include "SceneIntl.h" +#include "IofxManagerIntl.h" +//#include "ApexSharedSerialization.h" +#include "CurveImpl.h" + +namespace nvidia +{ +namespace iofx +{ + + +IofxAssetImpl::IofxAssetImpl(ModuleIofxImpl* module, ResourceList& list, const char* name) : + mRenderMeshAssetTracker(module->mSdk, RENDER_MESH_AUTHORING_TYPE_NAME), + mSpriteMaterialAssetTracker(module->mSdk), + mModule(module), + mName(name), + mSpriteSemanticBitmap(0), + mMeshSemanticBitmap(0) +{ + using namespace IofxAssetParametersNS; + + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = (IofxAssetParameters*)traits->createNvParameterized(IofxAssetParameters::staticClassName()); + + PX_ASSERT(mParams); + + // LRR: Hmmmm, these will never be setup for authors, it's a good thing we can't create actors from authors! + mRenderMeshList = NULL; + mSpriteParams = NULL; + + list.add(*this); +} + +IofxAssetImpl::IofxAssetImpl(ModuleIofxImpl* module, + ResourceList& list, + NvParameterized::Interface* params, + const char* name) : + mRenderMeshAssetTracker(module->mSdk, RENDER_MESH_AUTHORING_TYPE_NAME), + mSpriteMaterialAssetTracker(module->mSdk), + mParams((IofxAssetParameters*)params), + mSpriteParams(NULL), + mModule(module), + mName(name), + mSpriteSemanticBitmap(0), + mMeshSemanticBitmap(0) +{ + using namespace MeshIofxParametersNS; + + if (mParams->iofxType && + !nvidia::strcmp(mParams->iofxType->className(), MeshIofxParameters::staticClassName())) + { + MeshIofxParameters* mIofxParams = static_cast<MeshIofxParameters*>(mParams->iofxType); + + ParamDynamicArrayStruct* tmpStructPtr = (ParamDynamicArrayStruct*) & (mIofxParams->renderMeshList); + mRenderMeshList = PX_NEW(ParamArray<meshProperties_Type>)(mIofxParams, "renderMeshList", tmpStructPtr); + } + else + { + mRenderMeshList = NULL; + } + + if (mParams->iofxType && + !nvidia::strcmp(mParams->iofxType->className(), SpriteIofxParameters::staticClassName())) + { + mSpriteParams = static_cast<SpriteIofxParameters*>(mParams->iofxType); + } + + + // call this now to "initialize" the asset + postDeserialize(); + + list.add(*this); +} + +IofxAssetImpl::~IofxAssetImpl() +{ + for (uint32_t i = mSpawnModifierStack.size(); i--;) + { + delete mSpawnModifierStack[i]; + } + + for (uint32_t i = mContinuousModifierStack.size(); i--;) + { + delete mContinuousModifierStack[i]; + } +} + +void IofxAssetImpl::destroy() +{ + /* Assets that were forceloaded or loaded by actors will be automatically + * released by the ApexAssetTracker member destructors. + */ + if (mParams) + { + mParams->destroy(); + mParams = NULL; + } + + if (mRenderMeshList) + { + PX_DELETE(mRenderMeshList); + } + +#if IOFX_SLOW_COMPOSITE_MODIFIERS + // destroy any color vs life params that we may have laying around + for (uint32_t i = 0; i < mCompositeParams.size(); i++) + { + mCompositeParams[i]->destroy(); + } + mCompositeParams.clear(); +#endif + + // this will release all of this asset's IOFX actors, which is necessary, otherwise + // the IOFX actors will have their APEX Render Meshes ripped out from underneath them + ResourceList::clear(); + + delete this; +} + +void IofxAssetImpl::release() +{ + mModule->mSdk->releaseAsset(*this); +} + +void IofxAssetImpl::removeAllActors() +{ + ApexContext::removeAllActors(); +} + +void IofxAssetImpl::addDependentActor(ApexActor* actor) +{ + WRITE_ZONE(); + if (actor) + { + actor->addSelfToContext(*this); + } +} + + + +void IofxAssetImpl::preSerialize(void* userData_) +{ + PX_UNUSED(userData_); +} + +void IofxAssetImpl::postDeserialize(void* userData_) +{ + PX_UNUSED(userData_); + + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + + PX_ASSERT(mParams->iofxType); + if (!mParams->iofxType) + { + return; + } + + initializeAssetNameTable(); + + // destroy the old modifier stacks + for (uint32_t i = mSpawnModifierStack.size(); i--;) + { + delete mSpawnModifierStack[i]; + } + mSpawnModifierStack.resize(0); + + for (uint32_t i = mContinuousModifierStack.size(); i--;) + { + delete mContinuousModifierStack[i]; + } + mContinuousModifierStack.resize(0); + +#if IOFX_SLOW_COMPOSITE_MODIFIERS + // destroy any color vs life params that we may have laying around + for (uint32_t i = 0; i < mCompositeParams.size(); i++) + { + mCompositeParams[i]->destroy(); + } + mCompositeParams.clear(); +#endif + + const char* handleNameList[] = { "spawnModifierList", "continuousModifierList" }; + +// 'param' and 'newMod' are defined in the local scope where this macro is used +#define _MODIFIER(Type) \ + else if( !nvidia::strcmp(param->className(), #Type "ModifierParams") ) \ + { \ + newMod = PX_NEW( Type##ModifierImpl )( (Type##ModifierParams *)param ); \ + } + + for (uint32_t i = 0; i < 2; i++) + { + NvParameterized::Handle h(*mParams->iofxType); + mParams->iofxType->getParameterHandle(handleNameList[i], h); + int listSize = 0; + h.getArraySize(listSize); + + for (int j = 0; j < listSize; j++) + { + NvParameterized::Interface* param = 0; + NvParameterized::Handle ih(*mParams->iofxType); + Modifier* newMod = 0; + + h.getChildHandle(j, ih); + ih.getParamRef(param); + PX_ASSERT(param); + if (!param) + { + continue; + } + + if (newMod != 0) //this'll never happen :-) + {} + +#include "ModifierList.h" + +#if IOFX_SLOW_COMPOSITE_MODIFIERS + // LRR: there is a better way to do this, but I don't have time at the moment to + // make this any cleaner + + // special case, we don't currently have an initial color modifier, just insert + // a colorVsLife modifier for each color channel + else if (!nvidia::strcmp(param->className(), "InitialColorModifierParams")) + { + InitialColorModifierParams* icParams = (InitialColorModifierParams*)param; + + for (uint32_t colorIdx = 0; colorIdx < 4; colorIdx++) + { + ColorVsLifeModifierParams* p = (ColorVsLifeModifierParams*) + traits->createNvParameterized(ColorVsLifeModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ColorVsLifeModifierImpl* cvlMod = PX_NEW(ColorVsLifeModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the color channel + cvlMod->setColorChannel((ColorChannel)colorIdx); + + // set the curve + CurveImpl curve; + curve.addControlPoint(Vec2R(0.0f, icParams->color[colorIdx])); + curve.addControlPoint(Vec2R(1.0f, icParams->color[colorIdx])); + + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ColorVsLifeCompositeModifierParams")) + { + // setup an array so we can get the control points easily + ColorVsLifeCompositeModifierParams* cParams = (ColorVsLifeCompositeModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t colorIdx = 0; colorIdx < 4; colorIdx++) + { + + ColorVsLifeModifierParams* p = (ColorVsLifeModifierParams*) + traits->createNvParameterized(ColorVsLifeModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ColorVsLifeModifierImpl* cvlMod = PX_NEW(ColorVsLifeModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the color channel + cvlMod->setColorChannel((ColorChannel)colorIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].lifeRemaining, + cParams->controlPoints.buf[cpIdx].color[colorIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ColorVsDensityCompositeModifierParams")) + { + ColorVsDensityCompositeModifierParams* cParams = (ColorVsDensityCompositeModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t colorIdx = 0; colorIdx < 4; colorIdx++) + { + + ColorVsDensityModifierParams* p = (ColorVsDensityModifierParams*) + traits->createNvParameterized(ColorVsDensityModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ColorVsDensityModifierImpl* cvlMod = PX_NEW(ColorVsDensityModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the color channel + cvlMod->setColorChannel((ColorChannel)colorIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].density, + cParams->controlPoints.buf[cpIdx].color[colorIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ColorVsVelocityCompositeModifierParams")) + { + // setup an array so we can get the control points easily + ColorVsVelocityCompositeModifierParams* cParams = (ColorVsVelocityCompositeModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t colorIdx = 0; colorIdx < 4; colorIdx++) + { + + ColorVsVelocityModifierParams* p = (ColorVsVelocityModifierParams*) + traits->createNvParameterized(ColorVsVelocityModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ColorVsVelocityModifierImpl* cvlMod = PX_NEW(ColorVsVelocityModifierImpl)(p); + PX_ASSERT(cvlMod); + + cvlMod->setVelocity0(cParams->velocity0); + cvlMod->setVelocity1(cParams->velocity1); + + // set the color channel + cvlMod->setColorChannel((ColorChannel)colorIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].velocity, + cParams->controlPoints.buf[cpIdx].color[colorIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsLife2DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsLife2DModifierParams* cParams = (ScaleVsLife2DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (int32_t axisIdx = 0; axisIdx < 2; axisIdx++) + { + ScaleVsLifeModifierParams* p = (ScaleVsLifeModifierParams*) + traits->createNvParameterized(ScaleVsLifeModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsLifeModifierImpl* cvlMod = PX_NEW(ScaleVsLifeModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].lifeRemaining, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsLife3DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsLife3DModifierParams* cParams = (ScaleVsLife3DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t axisIdx = 0; axisIdx < 3; axisIdx++) + { + ScaleVsLifeModifierParams* p = (ScaleVsLifeModifierParams*) + traits->createNvParameterized(ScaleVsLifeModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsLifeModifierImpl* cvlMod = PX_NEW(ScaleVsLifeModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].lifeRemaining, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsDensity2DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsDensity2DModifierParams* cParams = (ScaleVsDensity2DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (int32_t axisIdx = 0; axisIdx < 2; axisIdx++) + { + ScaleVsDensityModifierParams* p = (ScaleVsDensityModifierParams*) + traits->createNvParameterized(ScaleVsDensityModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsDensityModifierImpl* cvlMod = PX_NEW(ScaleVsDensityModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].density, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsDensity3DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsDensity3DModifierParams* cParams = (ScaleVsDensity3DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t axisIdx = 0; axisIdx < 3; axisIdx++) + { + ScaleVsDensityModifierParams* p = (ScaleVsDensityModifierParams*) + traits->createNvParameterized(ScaleVsDensityModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsDensityModifierImpl* cvlMod = PX_NEW(ScaleVsDensityModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].density, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsCameraDistance2DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsCameraDistance2DModifierParams* cParams = (ScaleVsCameraDistance2DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (int32_t axisIdx = 0; axisIdx < 2; axisIdx++) + { + ScaleVsCameraDistanceModifierParams* p = (ScaleVsCameraDistanceModifierParams*) + traits->createNvParameterized(ScaleVsCameraDistanceModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsCameraDistanceModifierImpl* cvlMod = PX_NEW(ScaleVsCameraDistanceModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].cameraDistance, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } + + else if (!nvidia::strcmp(param->className(), "ScaleVsCameraDistance3DModifierParams")) + { + // setup an array so we can get the control points easily + ScaleVsCameraDistance3DModifierParams* cParams = (ScaleVsCameraDistance3DModifierParams*)param; + + if (cParams->controlPoints.arraySizes[0] == 0) + { + continue; + } + + for (uint32_t axisIdx = 0; axisIdx < 3; axisIdx++) + { + ScaleVsCameraDistanceModifierParams* p = (ScaleVsCameraDistanceModifierParams*) + traits->createNvParameterized(ScaleVsCameraDistanceModifierParams::staticClassName()); + + // save these parameterized classes off for later, we'll need to destroy them + mCompositeParams.pushBack(p); + + ScaleVsCameraDistanceModifierImpl* cvlMod = PX_NEW(ScaleVsCameraDistanceModifierImpl)(p); + PX_ASSERT(cvlMod); + + // set the scale axis + cvlMod->setScaleAxis((ScaleAxis)axisIdx); + + // set the curve + CurveImpl curve; + for (int32_t cpIdx = 0; cpIdx < cParams->controlPoints.arraySizes[0]; cpIdx++) + { + curve.addControlPoint(Vec2R(cParams->controlPoints.buf[cpIdx].cameraDistance, + cParams->controlPoints.buf[cpIdx].scale[axisIdx])); + } + cvlMod->setFunction(&curve); + + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(cvlMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(cvlMod->getModifierMeshSemantics()); + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(cvlMod); + } + } +#endif /* IOFX_SLOW_COMPOSITE_MODIFIERS */ + + if (newMod) + { + // save which sprite render semantics this modifier will update + setSpriteSemanticsUsed(newMod->getModifierSpriteSemantics()); + setMeshSemanticsUsed(newMod->getModifierMeshSemantics()); + + ModifierStack& activeStack = getModifierStack(i); + activeStack.pushBack(newMod); + } + + } + } + + bool useFloat4Color = mParams->renderOutput.useFloat4Color; + if (!useFloat4Color) + { + //detect if some Color modifier has a color component value greater than 1 + for (uint32_t modStage = 0; modStage < 2; modStage++) + { + const ModifierStack& activeStack = getModifierStack(modStage); + + uint32_t modCount = activeStack.size(); + for (uint32_t modIndex = 0; modIndex < modCount; modIndex++) + { + const nvidia::apex::Curve* pColorCurve = 0; + + const Modifier* pModifier = activeStack[modIndex]; + switch (pModifier->getModifierType()) + { + case ModifierType_ColorVsLife: + pColorCurve = static_cast<const ColorVsLifeModifier*>(pModifier)->getFunction(); + break; + case ModifierType_ColorVsDensity: + pColorCurve = static_cast<const ColorVsDensityModifier*>(pModifier)->getFunction(); + break; + default: + break; + } + + if (pColorCurve) + { + uint32_t pointsCount; + const Vec2R* pPoints = pColorCurve->getControlPoints(pointsCount); + + for (uint32_t i = 0; i < pointsCount; i++) + { + if (pPoints[i].y > 1) + { + useFloat4Color = true; + break; + } + } + } + if (useFloat4Color) + { + break; + } + } + if (useFloat4Color) + { + break; + } + } + } + + if (mParams->renderOutput.useUserSemantic) + { + mMeshSemanticBitmap |= (1 << IofxRenderSemantic::USER_DATA); + mSpriteSemanticBitmap |= (1 << IofxRenderSemantic::USER_DATA); + } +} + +const char* IofxAssetImpl::getSpriteMaterialName() const +{ + READ_ZONE(); + if (mSpriteParams && + mSpriteParams->spriteMaterialName && + mSpriteParams->spriteMaterialName->name() && + mSpriteParams->spriteMaterialName->name()[0]) + { + return mSpriteParams->spriteMaterialName->name(); + } + else + { + return NULL; + } +} + +const char* IofxAssetImpl::getMeshAssetName(uint32_t index) const +{ + READ_ZONE(); + if (mRenderMeshList && index < (*mRenderMeshList).size() && (*mRenderMeshList)[index].meshAssetName) + { + return (*mRenderMeshList)[index].meshAssetName->name(); + } + else + { + return NULL; + } +} + +uint32_t IofxAssetImpl::getMeshAssetWeight(uint32_t index) const +{ + READ_ZONE(); + if (mRenderMeshList && index < (*mRenderMeshList).size()) + { + return (*mRenderMeshList)[index].weight; + } + else + { + return 0; + } +} + +bool IofxAssetImpl::isOpaqueMesh(uint32_t index) const +{ + if (mRenderMeshList && index < (*mRenderMeshList).size() && (*mRenderMeshList)[index].meshAssetName) + { + return nvidia::strcmp((*mRenderMeshList)[index].meshAssetName->className(), "ApexOpaqueMesh") == 0; + } + else + { + return false; + } +} + +uint32_t IofxAssetImpl::forceLoadAssets() +{ + WRITE_ZONE(); + uint32_t assetLoadedCount = 0; + + assetLoadedCount += mRenderMeshAssetTracker.forceLoadAssets(); + assetLoadedCount += mSpriteMaterialAssetTracker.forceLoadAssets(); + + return assetLoadedCount; +} + +void IofxAssetImpl::initializeAssetNameTable() +{ + // clean up asset tracker list + mRenderMeshAssetTracker.removeAllAssetNames(); + mSpriteMaterialAssetTracker.removeAllAssetNames(); + + if (mRenderMeshList) + { + /* initialize the rendermesh asset name to resID tables */ + for (uint32_t i = 0; i < (*mRenderMeshList).size(); i++) + { + const char* name = ""; + if ((*mRenderMeshList)[i].meshAssetName) + { + name = (*mRenderMeshList)[i].meshAssetName->name(); + } + mRenderMeshAssetTracker.addAssetName(name, isOpaqueMesh(i)); + } + } + else + { + /* initialize the sprite material name to resID tables */ + if (getSpriteMaterialName()) + { + mSpriteMaterialAssetTracker.addAssetName(getSpriteMaterialName(), false); + } + } +} + +void IofxAssetImpl::setSpriteSemanticsUsed(uint32_t spriteSemanticsBitmap) +{ + mSpriteSemanticBitmap |= spriteSemanticsBitmap; +} +void IofxAssetImpl::setMeshSemanticsUsed(uint32_t meshSemanticsBitmap) +{ + mMeshSemanticBitmap |= meshSemanticsBitmap; +} + +uint32_t IofxAssetImpl::getPubStateSize() const +{ + return mSpriteParams ? sizeof(SpritePublicState) : sizeof(MeshPublicState); +} + +uint32_t IofxAssetImpl::getPrivStateSize() const +{ + return mSpriteParams ? sizeof(SpritePrivateState) : sizeof(MeshPrivateState); +} + +bool IofxAssetImpl::isSortingEnabled() const +{ + const ModifierStack& stack = getModifierStack(ModifierStage_Continuous); + for (ModifierStack::ConstIterator it = stack.begin(); it != stack.end(); ++it) + { + if ((*it)->getModifierType() == ModifierType_ViewDirectionSorting) + { + return true; + } + } + + return false; +} + +#ifndef WITHOUT_APEX_AUTHORING + +void IofxAssetAuthoringImpl::release() +{ + delete this; +} + +const char* IofxAssetAuthoringImpl::getObjTypeName() const +{ + return IofxAssetImpl::getObjTypeName(); +} + +#if IOFX_AUTHORING_API_ENABLED + +void IofxAssetAuthoringImpl::setMeshAssetCount(const uint32_t meshCount) +{ + (*mRenderMeshList).resize(meshCount); +} + +void IofxAssetAuthoringImpl::setSpriteMaterialName(const char* inSpriteMaterialName) +{ + if ((*mRenderMeshList).size()) + { + APEX_INVALID_OPERATION("Unable to set Sprite Material Name (%s). Systems can be either Mesh or Sprite, but not both. This system is already a Mesh.", getSpriteMaterialName()); + return; + } + + NvParameterized::Handle h(*mParams); + NvParameterized::Interface* refParam; + + mParams->getParameterHandle("spriteMaterialName", h); + mParams->initParamRef(h, NULL, true); + mParams->getParamRef(h, refParam); + + PX_ASSERT(refParam); + if (refParam) + { + refParam->setName(inSpriteMaterialName); + } +} + +void IofxAssetAuthoringImpl::setMeshAssetName(const char* meshAssetName, uint32_t meshIndex) +{ + if (getSpriteMaterialName()) + { + APEX_INVALID_OPERATION("Unable to set Mesh Material Name (%s). Systems can be either Mesh or Sprite, but not both. This system is already a Sprite.", meshAssetName); + return; + } + + PX_ASSERT(meshIndex < (*mRenderMeshList).size()); + + NvParameterized::Handle arrayHandle(*mParams), indexHandle(*mParams), childHandle(*mParams); + NvParameterized::Interface* refPtr; + + mParams->getParameterHandle("renderMeshList", arrayHandle); + arrayHandle.getChildHandle(meshIndex, indexHandle); + + indexHandle.getChildHandle(mParams, "meshAssetName", childHandle); + mParams->initParamRef(childHandle, NULL, true); + mParams->getParamRef(childHandle, refPtr); + PX_ASSERT(refPtr); + if (refPtr) + { + refPtr->setName(meshAssetName); + } +} + +void IofxAssetAuthoringImpl::setMeshAssetWeight(const uint32_t weight, uint32_t meshIndex) +{ + if (getSpriteMaterialName()) + { + APEX_INVALID_OPERATION("Unable to set Mesh Material Weight (%d). Systems can be either Mesh or Sprite, but not both. This system is already a Sprite.", weight); + return; + } + + PX_ASSERT(meshIndex < (*mRenderMeshList).size()); + (*mRenderMeshList)[meshIndex].weight = weight; +} + + +Modifier* IofxAssetAuthoringImpl::createModifier(uint32_t modStage, uint32_t modType) +{ + // create a modifier to go in this particular modifier stage + // we'll need a handle to the correct mod stage list, pass that and the Param Obj to CreateModifier, + // it will resize the array (+1), then pass the correct string to initParamRef() + // Then it can pass the new ref param to the mod constructor + NvParameterized::Handle h(*mParams), ih(*mParams); + int modStackSize = 0; + + getModifierStack(modStage, h); + + // resize the array + mParams->getArraySize(h, modStackSize); + mParams->resizeArray(h, ++modStackSize); + + h.getChildHandle(modStackSize - 1, ih); + + Modifier* retVal = CreateModifier((ModifierTypeEnum)modType, mParams, ih); + + uint32_t assetTarget = getAssetTarget(); + // We don't yet know what type this is, which is invalid. + if (assetTarget == 0) + { + // delete the new param ref and re-resize array + NvParameterized::Interface* refParam = 0; + mParams->getParamRef(ih, refParam); + PX_ASSERT(refParam); + if (refParam) + { + refParam->destroy(); + } + mParams->resizeArray(h, modStackSize - 1); + + delete retVal; + retVal = 0; + APEX_INVALID_OPERATION("Specifying modifiers before specifying the mesh or sprite asset is invalid"); + return retVal; + } + + // The modifier only supports certain semantics, so let's test those now. + const uint32_t supportedUsage = retVal->getModifierUsage(); + + if ((supportedUsage & assetTarget) != assetTarget) + { + // delete the new param ref and re-resize array + NvParameterized::Interface* refParam = 0; + mParams->getParamRef(ih, refParam); + PX_ASSERT(refParam); + if (refParam) + { + refParam->destroy(); + } + mParams->resizeArray(h, modStackSize - 1); + + delete retVal; + retVal = 0; + APEX_INVALID_OPERATION("The specified modifier doesn't work on that system type (e.g. Sprite ModifierImpl on a Mesh System or vice-versa)."); + return retVal; + } + + uint32_t stageBits = ModifierUsageFromStage(ModifierStage(modStage)); + if ((supportedUsage & stageBits) != stageBits) + { + // delete the new param ref and re-resize array + NvParameterized::Interface* refParam = 0; + mParams->getParamRef(ih, refParam); + PX_ASSERT(refParam); + if (refParam) + { + refParam->destroy(); + } + mParams->resizeArray(h, modStackSize - 1); + + delete retVal; + retVal = 0; + APEX_INVALID_OPERATION("The specified modifier doesn't work in that stage."); + return retVal; + } + + ModifierStack& activeStack = getModifierStack(modStage); + + activeStack.pushBack(retVal); + return retVal; +} + +void IofxAssetAuthoringImpl::removeModifier(uint32_t modStage, uint32_t position) +{ + if (modStage >= ModifierStage_Count) + { + APEX_INVALID_OPERATION("Invalid modifier stage"); + return; + } + + ModifierStack& activeStack = getModifierStack(modStage); + + if (position >= activeStack.size()) + { + APEX_INVALID_OPERATION("position %d is greater than modifier stack size: %d", position, activeStack.size()); + return; + } + + // remove from ModifierStack (runtime) + activeStack.replaceWithLast(position); + + // remove from NvParameterized data + NvParameterized::Handle h(*mParams), ih(*mParams); + NvParameterized::Interface* modParams = 0; + int modStackSize = 0; + + // 1. get the correct stack + getModifierStack(modStage, h); + + // 2. get the NvParameterized::Interface* for the position + mParams->getArraySize(h, modStackSize); + h.getChildHandle(position, ih); + mParams->getParamRef(ih, modParams); + PX_ASSERT(modParams); + + // 3. destroy it + modParams->destroy(); + + // 4. copy the last member of the stack to position + if (position != (uint32_t)modStackSize - 1) + { + NvParameterized::Handle lastH(*mParams); + h.getChildHandle(modStackSize - 1, lastH); + mParams->getParamRef(lastH, modParams); + mParams->setParamRef(ih, modParams); + } + + // 5. resize the stack + mParams->resizeArray(h, modStackSize - 1); +} + +uint32_t IofxAssetAuthoringImpl::getModifierCount(uint32_t modStage) const +{ + if (modStage >= ModifierStage_Count) + { + APEX_INVALID_OPERATION("Invalid modifier stage"); + return 0; + } + + const ModifierStack& activeStack = getModifierStack(modStage); + return activeStack.size(); +} + +uint32_t IofxAssetAuthoringImpl::findModifier(uint32_t modStage, Modifier* modifier) +{ + if (modStage >= ModifierStage_Count) + { + APEX_INVALID_OPERATION("Invalid modifier stage"); + return 0; + } + + const ModifierStack& activeStack = getModifierStack(modStage); + + for (uint32_t i = 0; i < activeStack.size(); i++) + { + if (activeStack[i] == modifier) + { + return i; + } + } + + return 0xffffffff; +} + +Modifier* IofxAssetAuthoringImpl::getModifier(uint32_t modStage, uint32_t position) const +{ + if (modStage >= ModifierStage_Count) + { + APEX_INVALID_OPERATION("Invalid modifier stage"); + return 0; + } + + const ModifierStack& activeStack = getModifierStack(modStage); + + if (position >= activeStack.size()) + { + APEX_INVALID_OPERATION("position %d is greater than modifier stack size: %d", position, activeStack.size()); + return 0; + } + + // remove from ModifierStack (runtime) + return activeStack[ position ]; +} + +uint32_t IofxAssetAuthoringImpl::getAssetTarget() const +{ + uint32_t retVal = 0; + if (getSpriteMaterialName()) + { + retVal |= ModifierUsage_Sprite; + } + else if ((*mRenderMeshList).size()) + { + retVal |= ModifierUsage_Mesh; + } + + return retVal; +} + +#endif /* IOFX_AUTHORING_API_ENABLED */ + +#endif + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/IofxManager.cpp b/APEX_1.4/module/iofx/src/IofxManager.cpp new file mode 100644 index 00000000..490fe3c7 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxManager.cpp @@ -0,0 +1,1291 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "PsArray.h" +#include "SceneIntl.h" +#include "ModuleIofxImpl.h" +#include "IofxManager.h" +#include "IofxSceneCPU.h" +#include "IofxAssetImpl.h" +#include "IosObjectData.h" +#include "IofxRenderData.h" + +#include "IofxActorCPU.h" + +#if APEX_CUDA_SUPPORT +#include "ApexCuda.h" // APEX_CUDA_MEM_ALIGN_UP_32BIT +#include "ApexMirroredArray.h" +#if ENABLE_TEST +#include "IofxTestManagerGPU.h" +#define IOFX_MANAGER_GPU IofxTestManagerGPU +#else +#include "IofxManagerGPU.h" +#define IOFX_MANAGER_GPU IofxManagerGPU +#endif +#endif + +#define BASE_SPRITE_SEMANTICS (1<<IofxRenderSemantic::POSITION) | \ + (1<<IofxRenderSemantic::VELOCITY) | \ + (1<<IofxRenderSemantic::LIFE_REMAIN) + +#define BASE_MESH_SEMANTICS (1<<IofxRenderSemantic::POSITION) | \ + (1<<IofxRenderSemantic::SCALE) | \ + (1<<IofxRenderSemantic::ROTATION) | \ + (1<<IofxRenderSemantic::VELOCITY) | \ + (1<<IofxRenderSemantic::LIFE_REMAIN) + +namespace nvidia +{ +namespace iofx +{ + +#pragma warning(disable: 4355) // 'this' : used in base member initializer list + + +IofxManager::IofxManager(IofxScene& scene, const IofxManagerDescIntl& desc, bool isMesh) + : mPostUpdateTaskID(0) + , mIofxScene(&scene) + , mIosAssetName(desc.iosAssetName) + , mWorkingIosData(NULL) + , mResultIosData(NULL) + , mStagingIosData(NULL) + , mTargetSemantics(0) + , mRenderState(RENDER_WAIT_FOR_DATA_ALLOC) + , mInteropFlags(RenderInteropFlags::NO_INTEROP) + , positionMass(*scene.mApexScene, PX_ALLOC_INFO("positionMass", PARTICLES)) + , velocityLife(*scene.mApexScene, PX_ALLOC_INFO("velocityLife", PARTICLES)) + , collisionNormalFlags(*scene.mApexScene, PX_ALLOC_INFO("collisionNormalFlags", PARTICLES)) + , density(*scene.mApexScene, PX_ALLOC_INFO("density", PARTICLES)) + , actorIdentifiers(*scene.mApexScene, PX_ALLOC_INFO("actorIdentifiers", PARTICLES)) + , inStateToInput(*scene.mApexScene, PX_ALLOC_INFO("inStateToInput", PARTICLES)) + , outStateToInput(*scene.mApexScene, PX_ALLOC_INFO("outStateToInput", PARTICLES)) + , userData(*scene.mApexScene, PX_ALLOC_INFO("userData", PARTICLES)) + , pubStateSize(0) + , privStateSize(0) + , mStateSwap(false) + , mTotalElapsedTime(0) + , mIsMesh(isMesh) + , mDistanceSortingEnabled(false) + , mCudaIos(desc.iosOutputsOnDevice) + , mCudaModifiers(false) + , mCudaPipeline(NULL) + , mSimulateTask(*this) +#if APEX_CUDA_SUPPORT + , mCopyQueue(*scene.mApexScene->getTaskManager()->getGpuDispatcher()) +#endif + , mLastNumObjects(0) + , mLastMaxInputID(0) + , mOnStartCallback(NULL) + , mOnFinishCallback(NULL) +{ + scene.mActorManagers.add(*this); + + mBounds.setEmpty(); + + mInStateOffset = 0; + mOutStateOffset = desc.maxObjectCount; + + // The decision whether to use GPU IOFX Modifiers is separate from whether the IOS + // outputs will come from the GPU or not +#if APEX_CUDA_SUPPORT + PxGpuDispatcher* gd = scene.mApexScene->getTaskManager()->getGpuDispatcher(); + if (gd && gd->getCudaContextManager()->contextIsValid() && !scene.mModule->mCudaDisabled) + { + mCudaModifiers = true; + // detect interop + if (gd->getCudaContextManager()->getInteropMode() != PxCudaInteropMode::NO_INTEROP && !scene.mModule->mInteropDisabled) + { + mInteropFlags = RenderInteropFlags::CUDA_INTEROP; + } + const uint32_t dataCount = 3u; + for (uint32_t i = 0 ; i < dataCount ; i++) + { + IosObjectGpuData* gpuIosData = PX_NEW(IosObjectGpuData)(i); + mObjData.pushBack(gpuIosData); + } + + mOutStateOffset = APEX_CUDA_MEM_ALIGN_UP_32BIT(desc.maxObjectCount); + mCudaPipeline = PX_NEW(IOFX_MANAGER_GPU)(*mIofxScene->mApexScene, desc, *this); + } + else +#endif + { + const uint32_t dataCount = 3u; + for (uint32_t i = 0 ; i < dataCount ; i++) + { + IosObjectCpuData* cpuIosData = PX_NEW(IosObjectCpuData)(i); + mObjData.pushBack(cpuIosData); + } + } + + mWorkingIosData = mObjData[0]; + mResultIosData = mObjData[1]; + mStagingIosData = mObjData[2]; + + // Create & Assign Shared Render Data + for (uint32_t i = 0 ; i < mObjData.size() ; i++) + { + if (mIsMesh) + { + mObjData[i]->renderData = PX_NEW(IofxSharedRenderDataMeshImpl)(i, mInteropFlags); + } + else + { + mObjData[i]->renderData = PX_NEW(IofxSharedRenderDataSpriteImpl)(i, mInteropFlags); + } + } + + ApexMirroredPlace::Enum place = ApexMirroredPlace::CPU; +#if APEX_CUDA_SUPPORT + if (mCudaIos || mCudaModifiers) + { + place = ApexMirroredPlace::CPU_GPU; + } +#endif + { + positionMass.setSize(desc.maxInputCount, place); + velocityLife.setSize(desc.maxInputCount, place); + if (desc.iosSupportsCollision) + { + collisionNormalFlags.setSize(desc.maxInputCount, place); + } + if (desc.iosSupportsDensity) + { + density.setSize(desc.maxInputCount, place); + } + actorIdentifiers.setSize(desc.maxInputCount, place); + inStateToInput.setSize(desc.maxInStateCount, place); + outStateToInput.setSize(desc.maxObjectCount, place); + + if (desc.iosSupportsUserData) + { + userData.setSize(desc.maxInputCount, place); + } + + mSimBuffers.pmaPositionMass = &positionMass; + mSimBuffers.pmaVelocityLife = &velocityLife; + mSimBuffers.pmaCollisionNormalFlags = desc.iosSupportsCollision ? &collisionNormalFlags : NULL; + mSimBuffers.pmaDensity = desc.iosSupportsDensity ? &density : NULL; + mSimBuffers.pmaActorIdentifiers = &actorIdentifiers; + mSimBuffers.pmaInStateToInput = &inStateToInput; + mSimBuffers.pmaOutStateToInput = &outStateToInput; + mSimBuffers.pmaUserData = desc.iosSupportsUserData ? &userData : NULL; + } + + if (!mCudaModifiers) + { + mOutputToState.resize(desc.maxObjectCount); + } + + /* Initialize IOS object data structures */ + for (uint32_t i = 0 ; i < mObjData.size() ; i++) + { + mObjData[i]->pmaPositionMass = mSimBuffers.pmaPositionMass; + mObjData[i]->pmaVelocityLife = mSimBuffers.pmaVelocityLife; + mObjData[i]->pmaCollisionNormalFlags = mSimBuffers.pmaCollisionNormalFlags; + mObjData[i]->pmaDensity = mSimBuffers.pmaDensity; + mObjData[i]->pmaActorIdentifiers = mSimBuffers.pmaActorIdentifiers; + mObjData[i]->pmaInStateToInput = mSimBuffers.pmaInStateToInput; + mObjData[i]->pmaOutStateToInput = mSimBuffers.pmaOutStateToInput; + mObjData[i]->pmaUserData = mSimBuffers.pmaUserData; + + mObjData[i]->iosAssetName = desc.iosAssetName; + mObjData[i]->iosOutputsOnDevice = desc.iosOutputsOnDevice; + mObjData[i]->iosSupportsDensity = desc.iosSupportsDensity; + mObjData[i]->iosSupportsCollision = desc.iosSupportsCollision; + mObjData[i]->iosSupportsUserData = desc.iosSupportsUserData; + mObjData[i]->maxObjectCount = desc.maxObjectCount; + mObjData[i]->maxInputCount = desc.maxInputCount; + mObjData[i]->maxInStateCount = desc.maxInStateCount; + } +} + +IofxManager::~IofxManager() +{ + for (uint32_t i = 0; i < pubState.slices.size(); ++i) + { + delete pubState.slices[i]; + } + + for (uint32_t i = 0; i < privState.slices.size(); ++i) + { + delete privState.slices[i]; + } +} + +void IofxManager::destroy() +{ +#if APEX_CUDA_SUPPORT + if (mCudaPipeline) + { + mCudaPipeline->release(); + } +#endif + for (uint32_t i = 0 ; i < mObjData.size() ; i++) + { + PX_DELETE(mObjData[i]); + } + + delete this; +} + + +void IofxManager::release() +{ + mIofxScene->releaseIofxManager(this); +} + +#if !APEX_CUDA_SUPPORT +/* Stubs for console builds */ +void IofxManager::fillMapUnmapArraysForInterop(nvidia::Array<CUgraphicsResource> &, nvidia::Array<CUgraphicsResource> &) {} +void IofxManager::mapBufferResultsForInterop(bool, bool) {} +#endif + +void IofxManager::prepareRenderables() +{ + const uint32_t targetSemantics = mTargetSemantics; + + switch (mRenderState) + { + case RENDER_READY: + //PX_ASSERT(mResultIosData->renderData->getBufferIsMapped() == true); + mResultIosData->renderData->unmap(); + + //PX_ASSERT(mStagingIosData->renderData->getBufferIsMapped() == false); + mStagingIosData->updateSemantics(*mIofxScene, targetSemantics); + mStagingIosData->renderData->map(); + + nvidia::swap(mStagingIosData, mResultIosData); + + mRenderState = RENDER_WAIT_FOR_NEW; + break; + case RENDER_WAIT_FOR_DATA_ALLOC: + if (targetSemantics != 0) + { + mResultIosData->updateSemantics(*mIofxScene, targetSemantics); + mResultIosData->renderData->map(); + mStagingIosData->updateSemantics(*mIofxScene, targetSemantics); + mStagingIosData->renderData->map(); + + mRenderState = RENDER_WAIT_FOR_FETCH_RESULT; + } + //go to default case here! + default: + return; + }; + + // mLiveRenderVolumesLock is allready locked in IofxScene::prepareRenderables + for (uint32_t i = 0 ; i < mIofxScene->mLiveRenderVolumes.size() ; i++) + { + RenderVolumeImpl* vol = mIofxScene->mLiveRenderVolumes[i]; + // all render volumes are allready locked in IofxScene::prepareRenderables + + uint32_t iofxActorCount; + IofxActor* const* iofxActorList = vol->lockIofxActorList(iofxActorCount); + for (uint32_t iofxActorIndex = 0; iofxActorIndex < iofxActorCount; ++iofxActorIndex) + { + IofxActorImpl* iofxActor = DYNAMIC_CAST(IofxActorImpl*)( iofxActorList[iofxActorIndex] ); + if (&iofxActor->mMgr == this) + { + iofxActor->prepareRenderables(mStagingIosData); + } + } + vol->unlockIofxActorList(); + } +} + +float IofxManager::getObjectRadius() const +{ + return mObjData[0] ? mObjData[0]->radius : 0.0f; +} + +void IofxManager::setSimulationParameters(float radius, const PxVec3& up, float gravity, float restDensity) +{ + /* Initialize IOS object data structures */ + for (uint32_t i = 0 ; i < mObjData.size() ; i++) + { + mObjData[i]->radius = radius; + mObjData[i]->upVector = up; + mObjData[i]->gravity = gravity; + mObjData[i]->restDensity = restDensity; + } +} + +void IofxManager::createSimulationBuffers(IosBufferDescIntl& outDesc) +{ + outDesc = mSimBuffers; +} + +/* Called by owning IOS actor during simulation startup, only if + * the IOS is going to simulate this frame, so it is safe to submit + * tasks from here. postUpdateTaskID is the ID for an IOS task + * that should run after IOFX modifiers. If the IOFX Manager adds + * no dependencies, postUpdateTaskID task will run right after + * updateEffectsData() returns. If updateEffectsData() will be completely + * synchronous, it is safe to return (PxTaskID)0xFFFFFFFF here. + */ +PxTaskID IofxManager::getUpdateEffectsTaskID(PxTaskID postUpdateTaskID) +{ + PxTaskManager* tm = mIofxScene->mApexScene->getTaskManager(); + mPostUpdateTaskID = postUpdateTaskID; + if (mCudaModifiers) + { + return mCudaPipeline->launchGpuTasks(); + } + else + { + tm->submitUnnamedTask(mSimulateTask); + mSimulateTask.finishBefore(tm->getNamedTask(AST_PHYSX_FETCH_RESULTS)); + return mSimulateTask.getTaskID(); + } +} + + +void TaskUpdateEffects::run() +{ + setProfileStat((uint16_t) mOwner.mWorkingIosData->numParticles); + mOwner.cpuModifiers(); +} + +/// \brief Called by IOS actor before TaskUpdateEffects is scheduled to run +void IofxManager::updateEffectsData(float deltaTime, uint32_t numObjects, uint32_t maxInputID, uint32_t maxStateID, void* extraData) +{ + PX_ASSERT(maxStateID >= maxInputID && maxInputID >= numObjects); + + mLastNumObjects = numObjects; + mLastMaxInputID = maxInputID; + + if (mCudaIos && !mCudaModifiers) + { +#if APEX_CUDA_SUPPORT + /* Presumably, updateEffectsData() is being called from a DtoH GPU task */ + mCopyQueue.reset(CUstream(extraData), 8); + positionMass.copyDeviceToHostQ(mCopyQueue, maxInputID); + velocityLife.copyDeviceToHostQ(mCopyQueue, maxInputID); + if (mWorkingIosData->iosSupportsCollision) + { + collisionNormalFlags.copyDeviceToHostQ(mCopyQueue, maxInputID); + } + if (mWorkingIosData->iosSupportsDensity) + { + density.copyDeviceToHostQ(mCopyQueue, maxInputID); + } + if (mWorkingIosData->iosSupportsUserData) + { + userData.copyDeviceToHostQ(mCopyQueue, maxInputID); + } + actorIdentifiers.copyDeviceToHostQ(mCopyQueue, maxInputID); + inStateToInput.copyDeviceToHostQ(mCopyQueue, maxStateID); + mCopyQueue.flushEnqueued(); + + mIofxScene->mApexScene->getTaskManager()->getGpuDispatcher()->addCompletionPrereq(mSimulateTask); +#else + PX_UNUSED(extraData); + PX_ALWAYS_ASSERT(); +#endif + } + + /* Data from the IOS */ + mWorkingIosData->maxInputID = maxInputID; + mWorkingIosData->maxStateID = maxStateID; + mWorkingIosData->numParticles = numObjects; + + /* Data from the scene */ + mWorkingIosData->eyePosition = mIofxScene->mApexScene->getEyePosition(); + mWorkingIosData->eyeDirection = mIofxScene->mApexScene->getEyeDirection(); + + PxMat44 viewMtx = mIofxScene->mApexScene->getViewMatrix(); + PxMat44 projMtx = mIofxScene->mApexScene->getProjMatrix(); + mWorkingIosData->eyeAxisX = PxVec3(viewMtx.column0.x, viewMtx.column1.x, viewMtx.column2.x); + mWorkingIosData->eyeAxisY = PxVec3(viewMtx.column0.y, viewMtx.column1.y, viewMtx.column2.y); + mWorkingIosData->zNear = PxAbs(projMtx.column3.z / projMtx.column2.z); + + mWorkingIosData->deltaTime = deltaTime; + // TODO: Convert into uint32_t elapsed milliseconds + mTotalElapsedTime = numObjects ? mTotalElapsedTime + mWorkingIosData->deltaTime : 0; + mWorkingIosData->elapsedTime = mTotalElapsedTime; + + /* IOFX data */ + if (mCudaModifiers) + { + mCudaPipeline->launchPrep(); // calls allocOutputs + } +} + +void IofxManager::cpuModifiers() +{ + if (!mCudaIos && mOnStartCallback) + { + (*mOnStartCallback)(NULL); + } + uint32_t maxInputID, maxStateID, numObjects; + + maxInputID = mWorkingIosData->maxInputID; + maxStateID = mWorkingIosData->maxStateID; + numObjects = mWorkingIosData->numParticles; + + PX_UNUSED(numObjects); + + /* Swap state buffer pointers */ + + IosObjectCpuData* md = DYNAMIC_CAST(IosObjectCpuData*)(mWorkingIosData); + + md->inPubState = mStateSwap ? &pubState.a[0] : &pubState.b[0]; + md->outPubState = mStateSwap ? &pubState.b[0] : &pubState.a[0]; + + md->inPrivState = mStateSwap ? &privState.a[0] : &privState.b[0]; + md->outPrivState = mStateSwap ? &privState.b[0] : &privState.a[0]; + + swapStates(); + + /* Sort sprites */ + + if (!mIsMesh) + { + DYNAMIC_CAST(IosObjectCpuData*)(mWorkingIosData)->sortingKeys = + mDistanceSortingEnabled ? &mSortingKeys.front() : NULL; + } + + /* Volume Migration (1 pass) */ + + mCountPerActor.clear(); + mCountPerActor.resize(mActorTable.size() * mVolumeTable.size(), 0); + for (uint32_t input = 0 ; input < maxInputID ; input++) + { + IofxActorIDIntl& id = mWorkingIosData->pmaActorIdentifiers->get(input); + if (id.getActorClassID() == IofxActorIDIntl::IPX_ACTOR || id.getActorClassID() >= mActorClassTable.size()) + { + id.set(IofxActorIDIntl::NO_VOLUME, IofxActorIDIntl::IPX_ACTOR); + } + else + { + const PxVec3& pos = mWorkingIosData->pmaPositionMass->get(input).getXYZ(); + uint32_t curPri = 0; + uint16_t curVID = IofxActorIDIntl::NO_VOLUME; + + for (uint16_t i = 0 ; i < mVolumeTable.size() ; i++) + { + VolumeData& vd = mVolumeTable[ i ]; + if (vd.vol == NULL) + { + continue; + } + + const uint32_t bit = mActorClassTable.size() * i + id.getActorClassID(); + + // This volume owns this particle if: + // 1. The volume bounds contain the particle + // 2. The volume affects the particle's IOFX Asset + // 3. This volume has the highest priority or was the previous owner + if (vd.mBounds.contains(pos) && + (mVolumeActorClassBitmap[ bit >> 5 ] & (1u << (bit & 31))) && + (curVID == IofxActorIDIntl::NO_VOLUME || vd.mPri > curPri || (vd.mPri == curPri && id.getVolumeID() == i))) + { + curVID = i; + curPri = vd.mPri; + } + } + + id.setVolumeID(curVID); + } + + // Count particles in each actor + if (id.getVolumeID() != IofxActorIDIntl::NO_VOLUME) + { + const uint32_t actorID = mActorClassTable[ id.getActorClassID() ].actorID; + PX_ASSERT(actorID < mActorTable.size()); + const uint32_t aid = id.getVolumeID() * mActorTable.size() + actorID; + ++mCountPerActor[aid]; + } + } + + /* Prefix sum */ + mStartPerActor.clear(); + mStartPerActor.resize(mCountPerActor.size(), 0); + uint32_t sum = 0; + for (uint32_t i = 0 ; i < mStartPerActor.size() ; i++) + { + mStartPerActor[ i ] = sum; + sum += mCountPerActor[ i ]; + } + + IosObjectCpuData* objData = DYNAMIC_CAST(IosObjectCpuData*)(mWorkingIosData); + objData->outputToState = &mOutputToState.front(); + + /* Generate outputToState (1 pass) */ + mBuildPerActor.clear(); + mBuildPerActor.resize(mStartPerActor.size(), 0); + uint32_t homeless = 0; + for (uint32_t state = 0 ; state < maxStateID ; state++) + { + uint32_t input = objData->pmaInStateToInput->get(state); + if (input == IosBufferDescIntl::NOT_A_PARTICLE) + { + continue; + } + + input &= ~IosBufferDescIntl::NEW_PARTICLE_FLAG; + + const IofxActorIDIntl id = objData->pmaActorIdentifiers->get(input); + if (id.getVolumeID() == IofxActorIDIntl::NO_VOLUME) + { + objData->pmaOutStateToInput->get(sum + homeless) = input; + ++homeless; + } + else + { + PX_ASSERT(id.getActorClassID() != IofxActorIDIntl::IPX_ACTOR && id.getActorClassID() < mActorClassTable.size()); + const uint32_t actorID = mActorClassTable[ id.getActorClassID() ].actorID; + PX_ASSERT(actorID < mActorTable.size()); + const uint32_t aid = id.getVolumeID() * mActorTable.size() + actorID; + objData->outputToState[ mStartPerActor[aid] + mBuildPerActor[ aid ]++ ] = state; + } + } + + /* Step IOFX Actors */ + uint32_t aid = 0; + PxTaskManager* tm = mIofxScene->mApexScene->getTaskManager(); + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + VolumeData& d = mVolumeTable[ i ]; + if (d.vol == 0) + { + aid += mActorTable.size(); + continue; + } + + for (uint32_t j = 0 ; j < mActorTable.size(); j++) + { + if (d.mActors[ j ] == DEFERRED_IOFX_ACTOR && mActorTable[ j ] != NULL && + (mIofxScene->mModule->mDeferredDisabled || mCountPerActor[ aid ])) + { + IofxActorImpl* iofxActor = PX_NEW(IofxActorCPU)(mActorTable[j]->getRenderResID(), mIofxScene, *this); + if (d.vol->addIofxActor(*iofxActor)) + { + d.mActors[ j ] = iofxActor; + + initIofxActor(iofxActor, j, d.vol); + } + else + { + iofxActor->release(); + } + } + + IofxActorCPU* cpuIofx = DYNAMIC_CAST(IofxActorCPU*)(d.mActors[ j ]); + if (cpuIofx && cpuIofx != DEFERRED_IOFX_ACTOR) + { + if (mCountPerActor[ aid ]) + { + ObjectRange range; + range.objectCount = mCountPerActor[ aid ]; + range.startIndex = mStartPerActor[ aid ]; + PX_ASSERT(range.startIndex + range.objectCount <= numObjects); + + cpuIofx->mWorkingRange = range; + + cpuIofx->mModifierTask.setContinuation(*tm, tm->getTaskFromID(mPostUpdateTaskID)); + cpuIofx->mModifierTask.removeReference(); + } + else + { + cpuIofx->mWorkingVisibleCount = 0; + cpuIofx->mWorkingRange.objectCount = 0; + cpuIofx->mWorkingRange.startIndex = 0; + cpuIofx->mWorkingBounds.setEmpty(); + } + } + + aid++; + } + } + + if (!mCudaIos && mOnFinishCallback) + { + (*mOnFinishCallback)(NULL); + } +} + +void IofxManager::outputHostToDevice(PxGpuCopyDescQueue& copyQueue) +{ + if (mCudaIos && !mCudaModifiers) + { +#if APEX_CUDA_SUPPORT + actorIdentifiers.copyHostToDeviceQ(copyQueue, mLastMaxInputID); + outStateToInput.copyHostToDeviceQ(copyQueue, mLastNumObjects); +#else + PX_UNUSED(copyQueue); + PX_ALWAYS_ASSERT(); +#endif + } +} + + +void IofxManager::submitTasks() +{ + /* Discover new volumes, removed volumes */ + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + mVolumeTable[ i ].mFlags = 0; + } + + for (uint32_t i = 0 ; i < mIofxScene->mLiveRenderVolumes.size() ; i++) + { + getVolumeID(mIofxScene->mLiveRenderVolumes[ i ]); + } + + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + if (mVolumeTable[ i ].mFlags == 0) + { + mVolumeTable[ i ].vol = 0; + } + } + + /* Trim Volume, ActorID and ActorClassID tables */ + while (mVolumeTable.size() && mVolumeTable.back().vol == 0) + { + mVolumeTable.popBack(); + } + + if (!mActorTable.empty()) + { + int32_t lastValidID = -1; + for (int32_t cur = (int32_t)mActorTable.size() - 1; cur >= 0; --cur) + { + if (mActorTable[(uint32_t)cur] != NULL) + { + lastValidID = cur; + break; + } + } + if (lastValidID == -1) + { + mActorTable.clear(); + } + else + { + mActorTable.resize((uint32_t)lastValidID + 1); + } + } + + if (!mActorClassTable.empty()) + { + int32_t lastValidID = -1; + for (uint32_t cur = 0; cur < mActorClassTable.size(); cur += mActorClassTable[ cur ].count) + { + if (mActorClassTable[ cur ].client != NULL) + { + lastValidID = (int32_t)cur; + } + } + if (lastValidID == -1) + { + mActorClassTable.clear(); + } + else + { + mActorClassTable.resize((uint32_t)(lastValidID + mActorClassTable[ (uint32_t)lastValidID ].count)); + } + } + + const uint32_t volumeActorClassBitmapSize = (mVolumeTable.size() * mActorClassTable.size() + 31) >> 5; + mVolumeActorClassBitmap.resize(volumeActorClassBitmapSize); + for (uint32_t i = 0 ; i < volumeActorClassBitmapSize ; i++) + { + mVolumeActorClassBitmap[ i ] = 0; + } + + /* Add new IofxActors as necessary */ + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + VolumeData& d = mVolumeTable[ i ]; + + // First, ensure per-volume actor array can hold all ClassIDs + d.mActors.resize(mActorTable.size(), 0); + + if (d.vol == NULL) + { + continue; + } + + d.mBounds = d.vol->getOwnershipBounds(); + d.mPri = d.vol->getPriority(); + + for (uint32_t cur = 0; cur < mActorTable.size(); ++cur) + { + if (mActorTable[ cur ] != NULL) + { + if (!d.mActors[ cur ]) + { + d.mActors[ cur ] = DEFERRED_IOFX_ACTOR; + } + } + } + + d.vol->lockReader(); // for safety during affectsIofxAsset() calls + for (uint32_t cur = 0; cur < mActorClassTable.size(); ++cur) + { + const ActorClassData& acd = mActorClassTable[ cur ]; + if (acd.client != NULL && acd.actorID < mActorTable.size()) + { + IofxAssetImpl* iofxAsset = acd.client->getAssetSceneInst()->getAsset(); + if (iofxAsset && d.vol->affectsIofxAsset(*iofxAsset)) + { + const uint32_t bit = mActorClassTable.size() * i + cur; + mVolumeActorClassBitmap[ bit >> 5 ] |= (1u << (bit & 31)); + } + } + } + d.vol->unlockReader(); // for safety during affectsIofxAsset() calls + } + + uint32_t targetSemantics = 0; + mDistanceSortingEnabled = false; + { + for (AssetHashMap_t::Iterator it = mAssetHashMap.getIterator(); !it.done(); ++it) + { + IofxAssetImpl* iofxAsset = it->first; + IofxAssetSceneInst* iofxAssetSceneInst = it->second; + + targetSemantics |= iofxAssetSceneInst->getSemantics(); + if (!mDistanceSortingEnabled && iofxAsset->isSortingEnabled()) + { + mDistanceSortingEnabled = true; + if (!mCudaModifiers) + { + mSortingKeys.resize(mOutputToState.size()); + } + } + } + } + mTargetSemantics = targetSemantics; + + if (mCudaModifiers) + { + mCudaPipeline->submitTasks(); + } + + if (!addedAssets.empty()) + { + /* Calculate state sizes required by new assets */ + uint32_t newPubStateSize = 0, newPrivStateSize = 0; + for (uint32_t i = 0; i < addedAssets.size(); ++i) + { + newPubStateSize = PxMax(newPubStateSize, addedAssets[i]->getPubStateSize()); + newPrivStateSize = PxMax(newPrivStateSize, addedAssets[i]->getPrivStateSize()); + } + + uint32_t maxObjectCount = outStateToInput.getSize(), + totalCount = mOutStateOffset + maxObjectCount; + + // Allocate data for pubstates + while (newPubStateSize > pubStateSize) + { + pubStateSize += sizeof(IofxSlice); + + SliceArray* slice = new SliceArray(*mIofxScene->mApexScene, PX_ALLOC_INFO("slice", PARTICLES)); + +#if APEX_CUDA_SUPPORT + if (mCudaModifiers) + { + //slice->reserve(totalCount, ApexMirroredPlace::GPU); Recalculated on GPU + } + else +#endif + { + slice->reserve(totalCount, ApexMirroredPlace::CPU); + } + + pubState.slices.pushBack(slice); + + IofxSlice* p; +#if APEX_CUDA_SUPPORT + p = mCudaModifiers + ? pubState.slices.back()->getGpuPtr() + : pubState.slices.back()->getPtr(); +#else + p = pubState.slices.back()->getPtr(); +#endif + pubState.a.pushBack(p + mInStateOffset); + pubState.b.pushBack(p + mOutStateOffset); + } + + // Allocate data for privstates + while (newPrivStateSize > privStateSize) + { + privStateSize += sizeof(IofxSlice); + + SliceArray* slice = new SliceArray(*mIofxScene->mApexScene, PX_ALLOC_INFO("slice", PARTICLES)); + +#if APEX_CUDA_SUPPORT + if (mCudaModifiers) + { + slice->reserve(totalCount, ApexMirroredPlace::GPU); + } + else +#endif + { + slice->reserve(totalCount, ApexMirroredPlace::CPU); + } + + privState.slices.pushBack(slice); + + IofxSlice* p; +#if APEX_CUDA_SUPPORT + p = mCudaModifiers + ? privState.slices.back()->getGpuPtr() + : privState.slices.back()->getPtr(); +#else + p = privState.slices.back()->getPtr(); +#endif + privState.a.pushBack(p + mInStateOffset); + privState.b.pushBack(p + mOutStateOffset); + } + + addedAssets.clear(); + } +} + +void IofxManager::swapStates() +{ + mStateSwap = !mStateSwap; + swap(mInStateOffset, mOutStateOffset); +} + +void IofxManager::fetchResults() +{ + if (!mPostUpdateTaskID) + { + return; + } + mPostUpdateTaskID = 0; + + if (mCudaModifiers) + { + mCudaPipeline->fetchResults(); + } + else + { + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + VolumeData& d = mVolumeTable[ i ]; + for (uint32_t j = 0 ; j < mActorTable.size() ; j++) + { + IofxActorCPU* cpuIofx = DYNAMIC_CAST(IofxActorCPU*)(d.mActors[ j ]); + if (cpuIofx && cpuIofx != DEFERRED_IOFX_ACTOR) + { + cpuIofx->mResultBounds = cpuIofx->mWorkingBounds; + cpuIofx->mResultRange = cpuIofx->mWorkingRange; + cpuIofx->mResultVisibleCount = cpuIofx->mWorkingVisibleCount; + } + } + } + } + + //build bounds + { + mBounds.setEmpty(); + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + VolumeData& d = mVolumeTable[ i ]; + for (uint32_t j = 0 ; j < mActorTable.size() ; j++) + { + IofxActorImpl* iofx = d.mActors[ j ]; + if (iofx && iofx != DEFERRED_IOFX_ACTOR) + { + mBounds.include(iofx->mResultBounds); + } + } + } + } + + { + switch (mRenderState) + { + case RENDER_WAIT_FOR_DATA_ALLOC: + //just do nothing + break; + case RENDER_WAIT_FOR_FETCH_RESULT: + nvidia::swap(mStagingIosData, mWorkingIosData); + mRenderState = RENDER_WAIT_FOR_NEW; + break; + case RENDER_WAIT_FOR_NEW: + case RENDER_READY: + nvidia::swap(mResultIosData, mWorkingIosData); + mRenderState = RENDER_READY; + break; + default: + PX_ALWAYS_ASSERT(); + }; + } +} + +PxBounds3 IofxManager::getBounds() const +{ + return mBounds; +} + +uint32_t IofxManager::getActorID(IofxAssetSceneInst* assetSceneInst, uint16_t meshID) +{ + IofxAssetImpl* iofxAsset = assetSceneInst->getAsset(); + + ResID renderResID = INVALID_RESOURCE_ID; + if (mIsMesh) + { + const char* rmName = iofxAsset->getMeshAssetName(meshID); + bool isOpaqueMesh = iofxAsset->isOpaqueMesh(meshID); + renderResID = iofxAsset->mRenderMeshAssetTracker.getResourceIdFromName(rmName, isOpaqueMesh); + if (renderResID == INVALID_RESOURCE_ID) + { + APEX_INVALID_PARAMETER("IofxManager: Mesh Asset with name \"%s\" not found.", rmName); + } + } + else + { + const char* mtlName = iofxAsset->getSpriteMaterialName(); + renderResID = iofxAsset->mSpriteMaterialAssetTracker.getResourceIdFromName(mtlName, false); + if (renderResID == INVALID_RESOURCE_ID) + { + APEX_INVALID_PARAMETER("IofxManager: Sprite Material with name \"%s\" not found.", mtlName); + } + } + uint32_t actorID = uint32_t(-1); + if (renderResID != INVALID_RESOURCE_ID) + { + for (uint32_t id = 0 ; id < mActorTable.size() ; id++) + { + if (mActorTable[id] != NULL) + { + if (mActorTable[id]->getRenderResID() == renderResID) + { + actorID = id; + break; + } + } + else if (actorID == uint32_t(-1)) + { + actorID = id; + } + } + if (actorID == uint32_t(-1)) + { + actorID = mActorTable.size(); + mActorTable.resize(actorID + 1, NULL); + } + + IofxActorSceneInst* &actorSceneInst = mActorTable[actorID]; + if (actorSceneInst == NULL) + { + actorSceneInst = PX_NEW(IofxActorSceneInst)(renderResID); + } + actorSceneInst->addRef(); + + // only add iofxAsset one time, check refCount + if (assetSceneInst->getRefCount() == 1) + { + actorSceneInst->addAssetSceneInst(assetSceneInst); + } + } + return actorID; +} +void IofxManager::releaseActorID(IofxAssetSceneInst* assetSceneInst, uint32_t actorID) +{ + PX_ASSERT(actorID < mActorTable.size()); + IofxActorSceneInst* &actorSceneInst = mActorTable[actorID]; + if (actorSceneInst != NULL) + { + PX_ASSERT(actorSceneInst->getRefCount() > 0); + if (actorSceneInst->removeRef()) + { + for (uint16_t j = 0 ; j < mVolumeTable.size() ; j++) + { + if (mVolumeTable[ j ].vol == NULL) + { + continue; + } + + if (actorID < mVolumeTable[ j ].mActors.size()) + { + IofxActorImpl* iofxActor = mVolumeTable[ j ].mActors[ actorID ]; + if (iofxActor && iofxActor != DEFERRED_IOFX_ACTOR) + { + iofxActor->release(); + //IofxManager::removeActorAtIndex should zero the actor in mActors + PX_ASSERT(mVolumeTable[ j ].mActors[ actorID ] == 0); + } + mVolumeTable[ j ].mActors[ actorID ] = 0; + } + } + + PX_DELETE(actorSceneInst); + actorSceneInst = NULL; + } + else + { + // only remove iofxAsset one time, check refCount + if (assetSceneInst->getRefCount() == 1) + { + actorSceneInst->removeAssetSceneInst(assetSceneInst); + } + } + } +} + +uint16_t IofxManager::getActorClassID(IofxManagerClientIntl* iofxClient, uint16_t meshID) +{ + IofxManagerClient* client = static_cast<IofxManagerClient*>(iofxClient); + if (client != 0) + { + const uint16_t actorClassID = uint16_t(client->getActorClassID() + meshID); + PX_ASSERT(actorClassID < mActorClassTable.size()); + PX_ASSERT(mActorClassTable[actorClassID].client == client); + PX_ASSERT(meshID < mActorClassTable[actorClassID].count); + + const uint32_t actorID = mActorClassTable[actorClassID].actorID; + if (actorID != uint32_t(-1)) + { + return actorClassID; + } + else + { + APEX_DEBUG_WARNING("IofxManager: getActorClassID returned invalid actor."); + return IofxActorIDIntl::IPX_ACTOR; + } + } + else + { + APEX_INVALID_PARAMETER("IofxManager: getActorClassID was called with invalid client."); + return IofxActorIDIntl::IPX_ACTOR; + } +} + +IofxManagerClientIntl* IofxManager::createClient(nvidia::apex::IofxAsset* asset, const IofxManagerClientIntl::Params& params) +{ + IofxAssetImpl* iofxAsset = static_cast<IofxAssetImpl*>(asset); + + IofxAssetSceneInst* &assetSceneInst = mAssetHashMap[iofxAsset]; + if (assetSceneInst == NULL) + { + assetSceneInst = createAssetSceneInst(iofxAsset); + // Update state sizes later in submitTasks + addedAssets.pushBack(iofxAsset); + // increase asset refCount + //ResourceProvider* nrp = GetInternalApexSDK()->getNamedResourceProvider(); + //nrp->setResource(IOFX_AUTHORING_TYPE_NAME, asset->getName(), asset, true); + } + assetSceneInst->addRef(); + + //allocate actorClasses + uint16_t actorClassCount = uint16_t( PxMax(1u, iofxAsset->getMeshAssetCount()) ); + uint32_t actorClassID = 0; + while (actorClassID < mActorClassTable.size()) + { + ActorClassData& acd = mActorClassTable[ actorClassID ]; + + if (acd.client == NULL && actorClassCount <= acd.count) + { + /* Make a shim to conver remaining hole */ + uint16_t remains = uint16_t(acd.count - actorClassCount); + for (uint16_t i = 0 ; i < remains ; i++) + { + ActorClassData& acd1 = mActorClassTable[ actorClassID + actorClassCount + i ]; + acd1.client = 0; + acd1.meshid = i; + acd1.count = remains; + acd1.actorID = uint32_t(-1); + } + break; + } + actorClassID = actorClassID + acd.count; + } + if (actorClassID >= mActorClassTable.size()) + { + /* Asset is not in table, append it */ + actorClassID = mActorClassTable.size(); + mActorClassTable.resize(actorClassID + actorClassCount); + } + + IofxManagerClient* client = NULL; +#if APEX_CUDA_SUPPORT + if (mCudaModifiers) + { + client = mCudaPipeline->createClient(assetSceneInst, actorClassID, params); + } + else +#endif + { + client = PX_NEW(IofxManagerClient)(assetSceneInst, actorClassID, params); + } + PX_ASSERT(client != NULL); + + for (uint16_t i = 0 ; i < actorClassCount ; i++) + { + ActorClassData& acd = mActorClassTable[ actorClassID + i ]; + acd.client = client; + acd.meshid = i; + acd.count = actorClassCount; + acd.actorID = getActorID(assetSceneInst, i); + } + + return static_cast<IofxManagerClientIntl*>(client); +} + +void IofxManager::releaseClient(IofxManagerClientIntl* iofxClient) +{ + // TODO: free unused memory in states + + IofxManagerClient* client = static_cast<IofxManagerClient*>(iofxClient); + if (client != 0) + { + IofxAssetSceneInst* assetSceneInst = client->getAssetSceneInst(); + uint32_t actorClassID = uint16_t(client->getActorClassID()); + + if (actorClassID < mActorClassTable.size()) + { + for (uint16_t i = 0 ; i < mActorClassTable[ actorClassID ].count ; i++) + { + uint32_t actorID = mActorClassTable[ actorClassID + i ].actorID; + if (actorID != uint32_t(-1)) + { + releaseActorID(assetSceneInst, actorID); + } + } + + // TODO: merge backward hole also + /* merge consecutive holes */ + uint32_t next = actorClassID + mActorClassTable[ actorClassID ].count; + while (next < mActorClassTable.size() && mActorClassTable[ next ].client == NULL) + { + next = next + mActorClassTable[ next ].count; + } + + uint16_t count = uint16_t(next - actorClassID); + for (uint16_t i = 0 ; i < count ; i++) + { + ActorClassData& acd = mActorClassTable[ actorClassID + i ]; + acd.client = 0; + acd.meshid = i; + acd.count = count; + acd.actorID = uint32_t(-1); + } + } + + PX_DELETE(client); + + if (assetSceneInst->removeRef()) + { + // decrease asset refCount + //ResourceProvider* nrp = GetInternalApexSDK()->getNamedResourceProvider(); + //nrp->releaseResource(IOFX_AUTHORING_TYPE_NAME, ad.asset->getName()); + + IofxAssetImpl* iofxAsset = assetSceneInst->getAsset(); + PX_DELETE(assetSceneInst); + assetSceneInst = NULL; + + mAssetHashMap.erase(iofxAsset); + } + } +} + +uint16_t IofxManager::getVolumeID(RenderVolume* vol) +{ + int32_t hole = -1; + for (uint16_t i = 0 ; i < mVolumeTable.size() ; i++) + { + if (vol == mVolumeTable[ i ].vol) + { + mVolumeTable[ i ].mFlags = 1; + return i; + } + else if (hole == -1 && !mVolumeTable[ i ].vol) + { + hole = (int32_t) i; + } + } + if (hole == -1) + { + mVolumeTable.insert(); + hole = (int32_t)mVolumeTable.size() - 1; + } + VolumeData& d = mVolumeTable[ (uint32_t)hole ]; + d.vol = DYNAMIC_CAST(RenderVolumeImpl*)(vol); + d.mFlags = 1; + d.mActors.clear(); //Iofx Actors are released in RenderVolumeImpl destructor! + return (uint16_t) hole; +} + + +void IofxManager::removeActorAtIndex(uint32_t index) +{ + IofxActorImpl* iofx = DYNAMIC_CAST(IofxActorImpl*)(mActorArray[ index ]); + + for (uint32_t i = 0 ; i < mVolumeTable.size() ; i++) + { + if (mVolumeTable[ i ].vol == iofx->mRenderVolume) + { + PX_ASSERT(iofx == mVolumeTable[ i ].mActors[ iofx->mActorID ]); + mVolumeTable[ i ].mActors[ iofx->mActorID ] = 0; + } + } + + ApexContext::removeActorAtIndex(index); +} + +IofxAssetSceneInst* IofxManager::createAssetSceneInst(IofxAsset* nxAsset) +{ + IofxAssetImpl* asset = DYNAMIC_CAST(IofxAssetImpl*)( nxAsset ); + + uint32_t semantics = uint32_t(mIsMesh ? BASE_MESH_SEMANTICS : BASE_SPRITE_SEMANTICS); + if( mObjData[0]->iosSupportsDensity ) + { + semantics |= (uint32_t)IofxRenderSemantic::DENSITY; + } + semantics |= mIsMesh ? asset->getMeshSemanticsBitmap() : asset->getSpriteSemanticsBitmap(); + + IofxAssetSceneInst* assetSceneInst = 0; +#if APEX_CUDA_SUPPORT + if (mCudaModifiers) + { + assetSceneInst = mCudaPipeline->createAssetSceneInst(asset, semantics); + } + else +#endif + { + assetSceneInst = PX_NEW(IofxAssetSceneInstCPU)(asset, semantics, mIofxScene); + } + PX_ASSERT(assetSceneInst != 0); + return assetSceneInst; +} + +void IofxManager::initIofxActor(IofxActorImpl* iofxActor, uint32_t actorID, RenderVolumeImpl* renderVolume) +{ + iofxActor->addSelfToContext(*this); + iofxActor->mActorID = actorID; + iofxActor->mRenderVolume = renderVolume; + iofxActor->mSemantics = 0; + iofxActor->mDistanceSortingEnabled = false; + + PX_ASSERT(mActorTable[actorID] != NULL); + const nvidia::Array<IofxAssetSceneInst*>& iofxAssets = mActorTable[actorID]->getAssetSceneInstArray(); + for (uint32_t k = 0; k < iofxAssets.size(); ++k) + { + IofxAssetSceneInst* assetSceneInst = iofxAssets[k]; + + iofxActor->mSemantics |= assetSceneInst->getSemantics(); + iofxActor->mDistanceSortingEnabled |= assetSceneInst->getAsset()->isSortingEnabled(); + } + +} + +} +} // end namespace nvidia::apex diff --git a/APEX_1.4/module/iofx/src/IofxManagerGPU.cpp b/APEX_1.4/module/iofx/src/IofxManagerGPU.cpp new file mode 100644 index 00000000..06d1209a --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxManagerGPU.cpp @@ -0,0 +1,1319 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "ApexDefs.h" + +#if APEX_CUDA_SUPPORT + +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "ModifierImpl.h" +#include "IofxActor.h" +#include "IofxManagerGPU.h" +#include "IofxAssetImpl.h" +#include "IofxSceneGPU.h" + +#include "ModuleIofxImpl.h" +#include "IofxActorGPU.h" + +#include "PxGpuTask.h" +#include "ApexCutil.h" + +#include "RandStateHelpers.h" + +#include "IofxRenderData.h" + +#define CUDA_OBJ(name) SCENE_CUDA_OBJ(mIofxScene, name) + +namespace nvidia +{ +namespace iofx +{ + +class IofxAssetSceneInstGPU : public IofxAssetSceneInst +{ +public: + IofxAssetSceneInstGPU(IofxAssetImpl* asset, uint32_t semantics, IofxScene* scene) + : IofxAssetSceneInst(asset, semantics) + , _constMemGroup(SCENE_CUDA_OBJ(*scene, modifierStorage)) + { + _totalRandomCount = 0; + + APEX_CUDA_CONST_MEM_GROUP_SCOPE(_constMemGroup) + + _storage_.alloc(_assetParamsHandle); + AssetParams assetParams; + buildModifierList(assetParams.spawnModifierList, _asset->mSpawnModifierStack); + buildModifierList(assetParams.continuousModifierList, _asset->mContinuousModifierStack); + _storage_.update(_assetParamsHandle, assetParams); + } + virtual ~IofxAssetSceneInstGPU() {} + + InplaceHandle<AssetParams> getAssetParamsHandle() const + { + return _assetParamsHandle; + } + +private: + + void buildModifierList(ModifierList& list, const ModifierStack& stack) + { + InplaceStorage& _storage_ = _constMemGroup.getStorage(); + + class Mapper : public ModifierParamsMapperGPU + { + public: + InplaceStorage* storage; + + InplaceHandleBase paramsHandle; + uint32_t paramsRandomCount; + + virtual InplaceStorage& getStorage() + { + return *storage; + } + + virtual void onParams(InplaceHandleBase handle, uint32_t randomCount) + { + paramsHandle = handle; + paramsRandomCount = randomCount; + } + + } mapper; + mapper.storage = &_storage_; + + list.resize(_storage_, stack.size()); + + uint32_t index = 0; + for (ModifierStack::ConstIterator it = stack.begin(); it != stack.end(); ++it) + { + uint32_t type = (*it)->getModifierType(); + //NxU32 usage = (*it)->getModifierUsage(); + //if ((usage & usageStage) == usageStage && (usage & usageClass) == usageClass) + { + const ModifierImpl* modifier = ModifierImpl::castFrom(*it); + modifier->mapParamsGPU(mapper); + + ModifierListElem listElem; + listElem.type = type; + listElem.paramsHandle = mapper.paramsHandle; + list.updateElem(_storage_, listElem, index); + + _totalRandomCount += mapper.paramsRandomCount; + } + ++index; + } + } + + ApexCudaConstMemGroup _constMemGroup; + InplaceHandle<AssetParams> _assetParamsHandle; + uint32_t _totalRandomCount; +}; + +class IofxManagerClientGPU : public IofxManagerClient +{ +public: + IofxManagerClientGPU(IofxAssetSceneInst* assetSceneInst, uint32_t actorClassID, const IofxManagerClientIntl::Params& params, IofxScene* scene) + : IofxManagerClient(assetSceneInst, actorClassID, params) + , _constMemGroup(SCENE_CUDA_OBJ(*scene, modifierStorage)) + { + setParamsGPU(); + } + + InplaceHandle<ClientParams> getClientParamsHandle() const + { + return _clientParamsHandle; + } + + // IofxManagerClientIntl interface + virtual void setParams(const IofxManagerClientIntl::Params& params) + { + IofxManagerClient::setParams(params); + setParamsGPU(); + } + +private: + void setParamsGPU() + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(_constMemGroup) + + ClientParams clientParams; + if (_clientParamsHandle.allocOrFetch(_storage_, clientParams)) + { + clientParams.assetParamsHandle = static_cast<IofxAssetSceneInstGPU*>(_assetSceneInst)->getAssetParamsHandle(); + } + clientParams.objectScale = _params.objectScale; + _clientParamsHandle.update(_storage_, clientParams); + } + + ApexCudaConstMemGroup _constMemGroup; + InplaceHandle<ClientParams> _clientParamsHandle; +}; + + +IofxManagerClient* IofxManagerGPU::createClient(IofxAssetSceneInst* assetSceneInst, uint32_t actorClassID, const IofxManagerClientIntl::Params& params) +{ + return PX_NEW(IofxManagerClientGPU)(assetSceneInst, actorClassID, params, &mIofxScene); +} + +IofxAssetSceneInst* IofxManagerGPU::createAssetSceneInst(IofxAssetImpl* asset,uint32_t semantics) +{ + return PX_NEW(IofxAssetSceneInstGPU)(asset, semantics, &mIofxScene); +} + +class IofxManagerLaunchTask : public PxGpuTask, public UserAllocated +{ +public: + IofxManagerLaunchTask(IofxManagerGPU* actor) : mActor(actor) {} + const char* getName() const + { + return "IofxManagerLaunchTask"; + } + void run() + { + PX_ALWAYS_ASSERT(); + } + bool launchInstance(CUstream stream, int kernelIndex) + { + return mActor->cudaLaunch(stream, kernelIndex); + } + PxGpuTaskHint::Enum getTaskHint() const + { + return PxGpuTaskHint::Kernel; + } + +protected: + IofxManagerGPU* mActor; +}; + +IofxManagerGPU::IofxManagerGPU(SceneIntl& scene, const IofxManagerDescIntl& desc, IofxManager& mgr, const ApexMirroredPlace::Enum defaultPlace) + : mManager(mgr) + , mIofxScene(*mgr.mIofxScene) + , mCopyQueue(*scene.getTaskManager()->getGpuDispatcher()) + , mDefaultPlace(defaultPlace) + , mCuSpawnScale(scene) + , mCuSpawnSeed(scene) + , mCuBlockPRNGs(scene) + , mCuSortedActorIDs(scene) + , mCuSortedStateIDs(scene) + , mCuSortTempKeys(scene) + , mCuSortTempValues(scene) + , mCuSortTemp(scene) + , mCuMinBounds(scene) + , mCuMaxBounds(scene) + , mCuTempMinBounds(scene) + , mCuTempMaxBounds(scene) + , mCuTempActorIDs(scene) + , mCuActorStart(scene) + , mCuActorEnd(scene) + , mCuActorVisibleEnd(scene) + , mCurSeed(0) + , mTargetBufDevPtr(NULL) + , mCountActorIDs(0) + , mNumberVolumes(0) + , mNumberActorClasses(0) + , mEmptySimulation(false) + , mVolumeConstMemGroup(CUDA_OBJ(migrationStorage)) + , mRemapConstMemGroup(CUDA_OBJ(remapStorage)) + , mModifierConstMemGroup(CUDA_OBJ(modifierStorage)) +{ + mTaskLaunch = PX_NEW(IofxManagerLaunchTask)(this); + + const uint32_t maxObjectCount = desc.maxObjectCount; + const uint32_t maxInStateCount = desc.maxInStateCount; + uint32_t usageClass = 0; + uint32_t blockSize = MAX_THREADS_PER_BLOCK; + + if (mManager.mIsMesh) + { + usageClass = ModifierUsage_Mesh; + //blockSize = CUDA_OBJ(meshModifiersKernel).getBlockDim().x; + } + else + { + usageClass = ModifierUsage_Sprite; + //blockSize = CUDA_OBJ(spriteModifiersKernel).getBlockDim().x; + } + + mCuSpawnScale.reserve(mManager.mOutStateOffset + maxObjectCount, ApexMirroredPlace::GPU); + mCuSpawnSeed.reserve(mManager.mOutStateOffset + maxObjectCount, ApexMirroredPlace::GPU); + + mCuSortedActorIDs.reserve(maxInStateCount, defaultPlace); + mCuSortedStateIDs.reserve(maxInStateCount, defaultPlace); + + mCuSortTempKeys.reserve(maxInStateCount, ApexMirroredPlace::GPU); + mCuSortTempValues.reserve(maxInStateCount, ApexMirroredPlace::GPU); + mCuSortTemp.reserve(MAX_BOUND_BLOCKS * NEW_SORT_KEY_DIGITS, ApexMirroredPlace::GPU); + + mCuTempMinBounds.reserve(WARP_SIZE * 2, ApexMirroredPlace::GPU); + mCuTempMaxBounds.reserve(WARP_SIZE * 2, ApexMirroredPlace::GPU); + mCuTempActorIDs.reserve(WARP_SIZE * 2, ApexMirroredPlace::GPU); + + // alloc volumeConstMem + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mVolumeConstMemGroup) + + mVolumeParamsArrayHandle.alloc(_storage_); + mActorClassIDBitmapArrayHandle.alloc(_storage_); + } + + // alloc remapConstMem + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mRemapConstMemGroup) + + mActorIDRemapArrayHandle.alloc(_storage_); + } + + // alloc modifierConstMem + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mModifierConstMemGroup) + + mClientParamsHandleArrayHandle.alloc(_storage_); + + if (mManager.mIsMesh) + { + mMeshOutputLayoutHandle.alloc(_storage_); + } + else + { + mSpriteOutputLayoutHandle.alloc(_storage_); + } + } + + InitDevicePRNGs(scene, blockSize, mRandThreadLeap, mRandGridLeap, mCuBlockPRNGs); +} + +void IofxManagerGPU::release() +{ + delete this; +} + +IofxManagerGPU::~IofxManagerGPU() +{ + delete mTaskLaunch; +} + + +void IofxManagerGPU::submitTasks() +{ + mNumberActorClasses = mManager.mActorClassTable.size(); + mNumberVolumes = mManager.mVolumeTable.size(); + mCountActorIDs = mManager.mActorTable.size() * mNumberVolumes; + + // update volumeConstMem + if (mNumberVolumes) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mVolumeConstMemGroup) + + VolumeParamsArray volumeParamsArray; + _storage_.fetch(mVolumeParamsArrayHandle, volumeParamsArray); + volumeParamsArray.resize(_storage_, mNumberVolumes); + _storage_.update(mVolumeParamsArrayHandle, volumeParamsArray); + + + ActorClassIDBitmapArray actorClassIDBitmapArray; + _storage_.fetch(mActorClassIDBitmapArrayHandle, actorClassIDBitmapArray); + actorClassIDBitmapArray.resize(_storage_, mManager.mVolumeActorClassBitmap.size()); + _storage_.update(mActorClassIDBitmapArrayHandle, actorClassIDBitmapArray); + + actorClassIDBitmapArray.updateRange(_storage_, &mManager.mVolumeActorClassBitmap.front(), actorClassIDBitmapArray.getSize()); + + for (uint32_t i = 0 ; i < mNumberVolumes ; i++) + { + VolumeParams volumeParams; + IofxManager::VolumeData& vd = mManager.mVolumeTable[ i ]; + if (vd.vol) + { + volumeParams.bounds = vd.mBounds; + volumeParams.priority = vd.mPri; + } + else + { + volumeParams.bounds.setEmpty(); + volumeParams.priority = 0; + } + volumeParamsArray.updateElem(_storage_, volumeParams, i); + } + } + else + { + APEX_DEBUG_WARNING("IofxManager: There is no render volume!"); + } + + // update remapConstMem + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mRemapConstMemGroup) + + ActorIDRemapArray actorIDRemapArray; + _storage_.fetch(mActorIDRemapArrayHandle, actorIDRemapArray); + actorIDRemapArray.resize(_storage_, mNumberActorClasses); + for (uint32_t i = 0 ; i < mNumberActorClasses ; ++i) + { + actorIDRemapArray.updateElem(_storage_, mManager.mActorClassTable[i].actorID, i); + } + _storage_.update(mActorIDRemapArrayHandle, actorIDRemapArray); + } + + // update modifierConstMem + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mModifierConstMemGroup) + + ClientParamsHandleArray clientParamsHandleArray; + _storage_.fetch(mClientParamsHandleArrayHandle, clientParamsHandleArray); + clientParamsHandleArray.resize(_storage_, mNumberActorClasses); + for (uint32_t i = 0 ; i < mNumberActorClasses ; ++i) + { + InplaceHandle<ClientParams> clientParamsHandle; + IofxManagerClientGPU* clientGPU = static_cast<IofxManagerClientGPU*>(mManager.mActorClassTable[i].client); + if (clientGPU != NULL) + { + clientParamsHandle = clientGPU->getClientParamsHandle(); + } + clientParamsHandleArray.updateElem(_storage_, clientParamsHandle, i); + } + _storage_.update(mClientParamsHandleArrayHandle, clientParamsHandleArray); + + if (mManager.mIsMesh) + { + MeshOutputLayout meshOutputLayout; + + IosObjectGpuData* mWorkingData = DYNAMIC_CAST(IosObjectGpuData*)(mManager.mWorkingIosData); + IofxSharedRenderDataMeshImpl* meshRenderData = DYNAMIC_CAST(IofxSharedRenderDataMeshImpl*)(mWorkingData->renderData); + const IofxMeshRenderLayout& meshRenderLayout = meshRenderData->getRenderLayout(); + + mOutputDWords = meshRenderLayout.stride >> 2; + meshOutputLayout.stride = meshRenderLayout.stride; + ::memcpy(meshOutputLayout.offsets, meshRenderLayout.offsets, sizeof(meshOutputLayout.offsets)); + + _storage_.update(mMeshOutputLayoutHandle, meshOutputLayout); + } + else + { + SpriteOutputLayout spriteOutputLayout; + + IosObjectGpuData* mWorkingData = DYNAMIC_CAST(IosObjectGpuData*)(mManager.mWorkingIosData); + IofxSharedRenderDataSpriteImpl* spriteRenderData = DYNAMIC_CAST(IofxSharedRenderDataSpriteImpl*)(mWorkingData->renderData); + const IofxSpriteRenderLayout& spriteRenderLayout = spriteRenderData->getRenderLayout(); + + mOutputDWords = spriteRenderLayout.stride >> 2; + spriteOutputLayout.stride = spriteRenderLayout.stride; + ::memcpy(spriteOutputLayout.offsets, spriteRenderLayout.offsets, sizeof(spriteOutputLayout.offsets)); + + _storage_.update(mSpriteOutputLayoutHandle, spriteOutputLayout); + } + } + +} + + +#pragma warning(push) +#pragma warning(disable:4312) // conversion from 'CUdeviceptr' to 'uint32_t *' of greater size + +PxTaskID IofxManagerGPU::launchGpuTasks() +{ + PxTaskManager* tm = mIofxScene.mApexScene->getTaskManager(); + tm->submitUnnamedTask(*mTaskLaunch, PxTaskType::TT_GPU); + mTaskLaunch->finishBefore(mManager.mPostUpdateTaskID); + return mTaskLaunch->getTaskID(); +} + +void IofxManagerGPU::launchPrep() +{ + IosObjectGpuData* mWorkingData = DYNAMIC_CAST(IosObjectGpuData*)(mManager.mWorkingIosData); + + if (!mWorkingData->numParticles) + { + mEmptySimulation = true; + return; + } + + mCurSeed = static_cast<uint32_t>(mIofxScene.mApexScene->getSeed()); + + PxTaskManager* tm = mIofxScene.mApexScene->getTaskManager(); + PxCudaContextManager* ctx = tm->getGpuDispatcher()->getCudaContextManager(); + { + PxScopedCudaLock s(*ctx); + + mTargetTextureCount = 0; + mTargetBufDevPtr = 0; + if (!mManager.mIsMesh) + { + IofxSharedRenderDataSpriteImpl* spriteRenderData = DYNAMIC_CAST(IofxSharedRenderDataSpriteImpl*)(mWorkingData->renderData); + const IofxSpriteRenderLayout& spriteRenderLayout = spriteRenderData->getRenderLayout(); + + mTargetTextureCount = spriteRenderLayout.surfaceCount; + for( uint32_t i = 0; i < mTargetTextureCount; ++i ) + { + const CUarray cuArray = spriteRenderData->getSurfaceMappedCudaArray(i); + if (cuArray != NULL) + { + mTargetCudaArrayList[i].assign(cuArray, false); + } + else + { + CUarray_format format = CUarray_format(0); + uint32_t numChannels = 0; + switch (spriteRenderLayout.surfaceElements[i]) + { + case IofxSpriteRenderLayoutSurfaceElement::POSITION_FLOAT4: + case IofxSpriteRenderLayoutSurfaceElement::SCALE_ORIENT_SUBTEX_FLOAT4: + case IofxSpriteRenderLayoutSurfaceElement::COLOR_FLOAT4: + format = CU_AD_FORMAT_FLOAT; + numChannels = 4; + break; + case IofxSpriteRenderLayoutSurfaceElement::COLOR_RGBA8: + case IofxSpriteRenderLayoutSurfaceElement::COLOR_BGRA8: + format = CU_AD_FORMAT_UNSIGNED_INT32; + numChannels = 1; + default: + PX_ALWAYS_ASSERT(); + break; + } + const UserRenderSurfaceDesc& desc = spriteRenderLayout.surfaceDescs[i]; + mTargetCudaArrayList[i].create(format, numChannels, uint32_t(desc.width), uint32_t(desc.height), 0, true); + } + } + for( uint32_t i = mTargetTextureCount; i < IofxSpriteRenderLayout::MAX_SURFACE_COUNT; ++i ) { + mTargetCudaArrayList[i].release(); + } + } + + if (mTargetTextureCount == 0) + { + const CUdeviceptr cudaPtr = mWorkingData->renderData->getBufferMappedCudaPtr(); + if (cudaPtr != 0) + { + mTargetOutputBuffer.release(); + mTargetBufDevPtr = reinterpret_cast<uint32_t*>(cudaPtr); + } + else + { + const size_t size = mWorkingData->renderData->getRenderBufferSize(); + if (size > 0) + { + mTargetOutputBuffer.realloc(size, ctx); + mTargetBufDevPtr = static_cast<uint32_t*>( mTargetOutputBuffer.getGpuPtr() ); + } + } + } + } + + const uint32_t numActorIDValues = mCountActorIDs + 2; + mCuActorStart.setSize(numActorIDValues, ApexMirroredPlace::CPU_GPU); + mCuActorEnd.setSize(numActorIDValues, ApexMirroredPlace::CPU_GPU); + mCuActorVisibleEnd.setSize(numActorIDValues, ApexMirroredPlace::CPU_GPU); + mCuMinBounds.setSize(numActorIDValues, ApexMirroredPlace::CPU_GPU); + mCuMaxBounds.setSize(numActorIDValues, ApexMirroredPlace::CPU_GPU); + + mCuSortedActorIDs.setSize(mWorkingData->maxStateID, mDefaultPlace); + mCuSortedStateIDs.setSize(mWorkingData->maxStateID, mDefaultPlace); + + mManager.positionMass.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + mManager.velocityLife.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + mManager.actorIdentifiers.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + mManager.inStateToInput.setSize(mWorkingData->maxStateID, ApexMirroredPlace::CPU_GPU); + mManager.outStateToInput.setSize(mWorkingData->numParticles, ApexMirroredPlace::CPU_GPU); + if (mWorkingData->iosSupportsCollision) + { + mManager.collisionNormalFlags.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + } + if (mWorkingData->iosSupportsDensity) + { + mManager.density.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + } + if (mWorkingData->iosSupportsUserData) + { + mManager.userData.setSize(mWorkingData->maxInputID, ApexMirroredPlace::CPU_GPU); + } + + mEmptySimulation = false; +} + +#pragma warning(pop) + + +/// +PX_INLINE uint32_t getHighestBitShift(uint32_t x) +{ + PX_ASSERT(isPowerOfTwo(x)); + return highestSetBit(x); +} + +void IofxManagerGPU::cudaLaunchRadixSort(CUstream stream, unsigned int numElements, unsigned int keyBits, unsigned int startBit, bool useSyncKernels) +{ + if (useSyncKernels) + { + //we use OLD Radix Sort on Tesla (SM < 2), because it is faster + CUDA_OBJ(radixSortSyncKernel)( + stream, numElements, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), keyBits, startBit + ); + } + else + { +#if 1 + //NEW Radix Sort + unsigned int totalThreads = (numElements + NEW_SORT_VECTOR_SIZE - 1) / NEW_SORT_VECTOR_SIZE; + if (CUDA_OBJ(newRadixSortBlockKernel).isSingleBlock(totalThreads)) + { + //launch just a single block for small sizes + CUDA_OBJ(newRadixSortBlockKernel)( + stream, APEX_CUDA_SINGLE_BLOCK_LAUNCH, + numElements, keyBits, startBit, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr() + ); + } + else + { + for (unsigned int bit = startBit; bit < startBit + keyBits; bit += RADIX_SORT_NBITS) + { + uint32_t gridSize = + CUDA_OBJ(newRadixSortStepKernel)( + stream, totalThreads, + numElements, bit, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), + 1, 0 + ); + + //launch just a single block + CUDA_OBJ(newRadixSortStepKernel)( + stream, APEX_CUDA_SINGLE_BLOCK_LAUNCH, + numElements, bit, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), + 2, gridSize + ); + + CUDA_OBJ(newRadixSortStepKernel)( + stream, totalThreads, + numElements, bit, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), + 3, 0 + ); + + mCuSortedActorIDs.swapGpuPtr(mCuSortTempKeys); + mCuSortedStateIDs.swapGpuPtr(mCuSortTempValues); + } + } +#else + //OLD Radix Sort + for (unsigned int startBit = 0; startBit < keyBits; startBit += RADIX_SORT_NBITS) + { + int gridSize = + CUDA_OBJ(radixSortStep1Kernel)( + stream, numElements, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), startBit + ); + + //launch just 1 block + CUDA_OBJ(radixSortStep2Kernel)( + stream, CUDA_OBJ(radixSortStep2Kernel).getBlockDim().x, + mCuSortTemp.getGpuPtr(), gridSize + ); + + CUDA_OBJ(radixSortStep3Kernel)( + stream, numElements, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mCuSortTempKeys.getGpuPtr(), mCuSortTempValues.getGpuPtr(), + mCuSortTemp.getGpuPtr(), startBit + ); + } +#endif + } +} + +bool IofxManagerGPU::cudaLaunch(CUstream stream, int kernelIndex) +{ + PxTaskManager* tm = mIofxScene.mApexScene->getTaskManager(); + + if (mEmptySimulation) + { + return false; + } + + const uint32_t numActorIDValues = mCountActorIDs + 2; + //value < mCountActorIDs - valid particle with volume + //value == mCountActorIDs - homeless particle (no volume or invalid actor class) + //value == mCountActorIDs + 1 - NOT_A_PARTICLE + + + IofxSceneGPU* sceneGPU = static_cast<IofxSceneGPU*>(&mIofxScene); + bool useSyncKernels = !sceneGPU->getGpuDispatcher()->getCudaContextManager()->supportsArchSM20(); + + IosObjectGpuData* mWorkingData = DYNAMIC_CAST(IosObjectGpuData*)(mManager.mWorkingIosData); + + switch (kernelIndex) + { + case 0: + if (mManager.mOnStartCallback) + { + (*mManager.mOnStartCallback)(stream); + } + mCopyQueue.reset(stream, 24); + if (!mManager.mCudaIos && mWorkingData->maxInputID > 0) + { + mManager.positionMass.copyHostToDeviceQ(mCopyQueue); + mManager.velocityLife.copyHostToDeviceQ(mCopyQueue); + mManager.actorIdentifiers.copyHostToDeviceQ(mCopyQueue); + mManager.inStateToInput.copyHostToDeviceQ(mCopyQueue); + if (mWorkingData->iosSupportsCollision) + { + mManager.collisionNormalFlags.copyHostToDeviceQ(mCopyQueue); + } + if (mWorkingData->iosSupportsDensity) + { + mManager.density.copyHostToDeviceQ(mCopyQueue); + } + if (mWorkingData->iosSupportsUserData) + { + mManager.userData.copyHostToDeviceQ(mCopyQueue); + } + mCopyQueue.flushEnqueued(); + } + break; + + case 1: + /* Volume Migration (input space) */ + CUDA_OBJ(volumeMigrationKernel)(stream, + PxMax(mWorkingData->maxInputID, numActorIDValues), + mVolumeConstMemGroup.getStorage().mappedHandle(mVolumeParamsArrayHandle), + mVolumeConstMemGroup.getStorage().mappedHandle(mActorClassIDBitmapArrayHandle), + mNumberActorClasses, mNumberVolumes, numActorIDValues, + mManager.actorIdentifiers.getGpuPtr(), mWorkingData->maxInputID, + (const float4*)mManager.positionMass.getGpuPtr(), + mCuActorStart.getGpuPtr(), mCuActorEnd.getGpuPtr(), mCuActorVisibleEnd.getGpuPtr() + ); + break; + + case 2: + { + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefRemapPositions, mManager.positionMass) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefRemapActorIDs, mManager.actorIdentifiers) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefRemapInStateToInput, mManager.inStateToInput) + + /* if mDistanceSortingEnabled, sort on camera distance first, else directly make ActorID keys */ + CUDA_OBJ(makeSortKeys)(stream, mWorkingData->maxStateID, + mManager.inStateToInput.getGpuPtr(), mWorkingData->maxInputID, + mManager.mActorTable.size(), mCountActorIDs, + mRemapConstMemGroup.getStorage().mappedHandle(mActorIDRemapArrayHandle), + (const float4*)mManager.positionMass.getGpuPtr(), mManager.mDistanceSortingEnabled, + mWorkingData->eyePosition, mWorkingData->eyeDirection, mWorkingData->zNear, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr()); + + if (mManager.mDistanceSortingEnabled) + { + cudaLaunchRadixSort(stream, mWorkingData->maxStateID, 32, 0, useSyncKernels); + + /* Generate ActorID sort keys, using distance sorted stateID values */ + CUDA_OBJ(remapKernel)(stream, mWorkingData->maxStateID, + mManager.inStateToInput.getGpuPtr(), mWorkingData->maxInputID, + mManager.mActorTable.size(), mCountActorIDs, + mRemapConstMemGroup.getStorage().mappedHandle(mActorIDRemapArrayHandle), + mCuSortedStateIDs.getGpuPtr(), mCuSortedActorIDs.getGpuPtr()); + } + } + break; + + case 3: + /* ActorID Sort (output state space) */ + // input: mCuSortedActorIDs == actorIDs, in distance sorted order + // input: mCuSortedStateIDs == stateIDs, in distance sorted order + + // output: mCuSortedActorIDs == sorted ActorIDs + // output: mCuSortedStateIDs == output-to-input state + { + //SortedActorIDs could contain values from 0 to mCountActorIDs + 1 (included), + //so keybits should cover at least mCountActorIDs + 2 numbers + uint32_t keybits = 0; + while ((1U << keybits) < numActorIDValues) + { + ++keybits; + } + + cudaLaunchRadixSort(stream, mWorkingData->maxStateID, keybits, 0, useSyncKernels); + } + break; + + case 4: + /* Per-IOFX actor particle range detection */ + CUDA_OBJ(actorRangeKernel)(stream, mWorkingData->maxStateID, + mCuSortedActorIDs.getGpuPtr(), mCountActorIDs, + mCuActorStart.getGpuPtr(), mCuActorEnd.getGpuPtr(), mCuActorVisibleEnd.getGpuPtr(), + mCuSortedStateIDs.getGpuPtr() + ); + break; + + case 5: + /* Modifiers (output state space) */ + { + PX_PROFILE_ZONE("IofxManagerGPUModifiers", GetInternalApexSDK()->getContextId()); + ModifierCommonParams commonParams = mWorkingData->getCommonParams(); + + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefPositionMass, mManager.positionMass) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefVelocityLife, mManager.velocityLife) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefInStateToInput, mManager.inStateToInput) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefStateSpawnSeed, mCuSpawnSeed) + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefStateSpawnScale, mCuSpawnScale) + + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefActorIDs, mManager.actorIdentifiers) + + if (mWorkingData->iosSupportsCollision) + { + CUDA_OBJ(texRefCollisionNormalFlags).bindTo(mManager.collisionNormalFlags); + } + if (mWorkingData->iosSupportsDensity) + { + CUDA_OBJ(texRefDensity).bindTo(mManager.density); + } + if (mWorkingData->iosSupportsUserData) + { + CUDA_OBJ(texRefUserData).bindTo(mManager.userData); + } + + PRNGInfo rand; + rand.g_stateSpawnSeed = mCuSpawnSeed.getGpuPtr(); + rand.g_randBlock = mCuBlockPRNGs.getGpuPtr(); + rand.randGrid = mRandGridLeap; + rand.randThread = mRandThreadLeap; + rand.seed = mCurSeed; + + if (mManager.mIsMesh) + { + // 3x3 matrix => 9 float scalars => 3 slices + + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefMeshPrivState0, *mManager.privState.slices[0]); + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefMeshPrivState1, *mManager.privState.slices[1]); + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefMeshPrivState2, *mManager.privState.slices[2]); + + MeshPrivateStateArgs meshPrivStateArgs; + meshPrivStateArgs.g_state[0] = mManager.privState.a[0]; + meshPrivStateArgs.g_state[1] = mManager.privState.a[1]; + meshPrivStateArgs.g_state[2] = mManager.privState.a[2]; + + CUDA_OBJ(meshModifiersKernel)(ApexKernelConfig(MAX_SMEM_BANKS * mOutputDWords, WARP_SIZE * PxMax<uint32_t>(mOutputDWords, 4)), + stream, mWorkingData->numParticles, + mManager.mInStateOffset, mManager.mOutStateOffset, + mModifierConstMemGroup.getStorage().mappedHandle(mClientParamsHandleArrayHandle), + commonParams, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + meshPrivStateArgs, mCuSpawnScale.getGpuPtr(), + rand, mTargetBufDevPtr, + mModifierConstMemGroup.getStorage().mappedHandle(mMeshOutputLayoutHandle) + ); + } + else + { + // 1 float scalar => 1 slice + + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefSpritePrivState0, *mManager.privState.slices[0]); + + SpritePrivateStateArgs spritePrivStateArgs; + spritePrivStateArgs.g_state[0] = mManager.privState.a[0]; + + IofxSharedRenderDataSpriteImpl* renderDataSprite = static_cast<IofxSharedRenderDataSpriteImpl*>(mWorkingData->renderData); + const IofxSpriteRenderLayout& spriteRenderLayout = renderDataSprite->getRenderLayout(); + + if (mTargetTextureCount > 0) + { + SpriteTextureOutputLayout outputLayout; + outputLayout.textureCount = mTargetTextureCount; + for (uint32_t i = 0; i < outputLayout.textureCount; ++i) + { + outputLayout.textureData[i].layout = static_cast<uint16_t>(spriteRenderLayout.surfaceElements[i]); + + uint32_t width = mTargetCudaArrayList[i].getWidth(); + //width should be a power of 2 and a multiply of WARP_SIZE + PX_ASSERT(isPowerOfTwo(width)); + PX_ASSERT((width & (WARP_SIZE - 1)) == 0); + outputLayout.textureData[i].widthShift = static_cast<uint8_t>(highestSetBit(width)); + + outputLayout.textureData[i].pitchShift = 0; //unused in GPU mode! + outputLayout.texturePtr[i] = NULL; //unused in GPU mode! + } + + if (0 < outputLayout.textureCount) APEX_CUDA_SURFACE_BIND(surfRefOutput0, mTargetCudaArrayList[0], ApexCudaMemFlags::OUT); + if (1 < outputLayout.textureCount) APEX_CUDA_SURFACE_BIND(surfRefOutput1, mTargetCudaArrayList[1], ApexCudaMemFlags::OUT); + if (2 < outputLayout.textureCount) APEX_CUDA_SURFACE_BIND(surfRefOutput2, mTargetCudaArrayList[2], ApexCudaMemFlags::OUT); + if (3 < outputLayout.textureCount) APEX_CUDA_SURFACE_BIND(surfRefOutput3, mTargetCudaArrayList[3], ApexCudaMemFlags::OUT); + + CUDA_OBJ(spriteTextureModifiersKernel)(stream, mWorkingData->numParticles, + mManager.mInStateOffset, mManager.mOutStateOffset, + mModifierConstMemGroup.getStorage().mappedHandle(mClientParamsHandleArrayHandle), + commonParams, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + spritePrivStateArgs, mCuSpawnScale.getGpuPtr(), + rand, outputLayout + ); + + if (0 < outputLayout.textureCount) APEX_CUDA_SURFACE_UNBIND(surfRefOutput0); + if (1 < outputLayout.textureCount) APEX_CUDA_SURFACE_UNBIND(surfRefOutput1); + if (2 < outputLayout.textureCount) APEX_CUDA_SURFACE_UNBIND(surfRefOutput2); + if (3 < outputLayout.textureCount) APEX_CUDA_SURFACE_UNBIND(surfRefOutput3); + } + else + { + CUDA_OBJ(spriteModifiersKernel)(ApexKernelConfig(MAX_SMEM_BANKS * mOutputDWords, WARP_SIZE * PxMax<uint32_t>(mOutputDWords, 4)), + stream, mWorkingData->numParticles, + mManager.mInStateOffset, mManager.mOutStateOffset, + mModifierConstMemGroup.getStorage().mappedHandle(mClientParamsHandleArrayHandle), + commonParams, + mCuSortedActorIDs.getGpuPtr(), mCuSortedStateIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + spritePrivStateArgs, mCuSpawnScale.getGpuPtr(), + rand, mTargetBufDevPtr, + mModifierConstMemGroup.getStorage().mappedHandle(mSpriteOutputLayoutHandle) + ); + } + } + + if (mWorkingData->iosSupportsCollision) + { + CUDA_OBJ(texRefCollisionNormalFlags).unbind(); + } + if (mWorkingData->iosSupportsDensity) + { + CUDA_OBJ(texRefDensity).unbind(); + } + if (mWorkingData->iosSupportsUserData) + { + CUDA_OBJ(texRefUserData).unbind(); + } + } + break; + + case 6: + if (mCountActorIDs > 0) + { + /* Per-IOFX actor BBox generation */ + APEX_CUDA_TEXTURE_SCOPE_BIND(texRefBBoxPositions, mManager.positionMass) + + if (useSyncKernels) + { + CUDA_OBJ(bboxSyncKernel)( + stream, mWorkingData->numParticles, + mCuSortedActorIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + (const float4*)mManager.positionMass.getGpuPtr(), + (float4*)mCuMinBounds.getGpuPtr(), (float4*)mCuMaxBounds.getGpuPtr(), + mCuTempActorIDs.getGpuPtr(), + (float4*)mCuTempMinBounds.getGpuPtr(), (float4*)mCuTempMaxBounds.getGpuPtr() + ); + } + else + { + uint32_t bboxGridSize = + CUDA_OBJ(bboxKernel)( + stream, mWorkingData->numParticles, + mCuSortedActorIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + (const float4*)mManager.positionMass.getGpuPtr(), + (float4*)mCuMinBounds.getGpuPtr(), (float4*)mCuMaxBounds.getGpuPtr(), + mCuTempActorIDs.getGpuPtr(), + (float4*)mCuTempMinBounds.getGpuPtr(), (float4*)mCuTempMaxBounds.getGpuPtr(), + 1, 0 + ); + + CUDA_OBJ(bboxKernel)( + stream, APEX_CUDA_SINGLE_BLOCK_LAUNCH, + mCuSortedActorIDs.getGpuPtr(), + mManager.outStateToInput.getGpuPtr(), + (const float4*)mManager.positionMass.getGpuPtr(), + (float4*)mCuMinBounds.getGpuPtr(), (float4*)mCuMaxBounds.getGpuPtr(), + mCuTempActorIDs.getGpuPtr(), + (float4*)mCuTempMinBounds.getGpuPtr(), (float4*)mCuTempMaxBounds.getGpuPtr(), + 2, bboxGridSize + ); + } + } + break; + + case 7: + if (mTargetTextureCount > 0) + { + IofxSharedRenderDataSpriteImpl* spriteRenderData = DYNAMIC_CAST(IofxSharedRenderDataSpriteImpl*)(mWorkingData->renderData); + PX_ASSERT(spriteRenderData->getRenderLayout().surfaceCount == mTargetTextureCount); + + for (uint32_t i = 0; i < mTargetTextureCount; ++i) + { + UserRenderSurface::MappedInfo mappedInfo; + if (spriteRenderData->getSurfaceMappedInfo(i, mappedInfo)) + { + const size_t surfaceWidth = spriteRenderData->getRenderLayout().surfaceDescs[i].width; + size_t copyHeight = (mWorkingData->numParticles + surfaceWidth - 1) / surfaceWidth; + mTargetCudaArrayList[i].copyToHost(stream, mappedInfo.pData, mappedInfo.rowPitch, 0, 0, copyHeight); + } + } + } + else + { + void* mappedPtr = mWorkingData->renderData->getBufferMappedPtr(); + if (mappedPtr) + { + size_t size = (mOutputDWords << 2) * mWorkingData->numParticles; + mTargetOutputBuffer.copyToHost(stream, mappedPtr, size); + } + } + if (mCountActorIDs > 0) + { + mCuMinBounds.copyDeviceToHostQ(mCopyQueue); + mCuMaxBounds.copyDeviceToHostQ(mCopyQueue); + } + mCuActorStart.copyDeviceToHostQ(mCopyQueue); + mCuActorEnd.copyDeviceToHostQ(mCopyQueue); + mCuActorVisibleEnd.copyDeviceToHostQ(mCopyQueue); + + + if (mCuSortedActorIDs.cpuPtrIsValid()) + { + mManager.inStateToInput.copyDeviceToHostQ(mCopyQueue); + mManager.actorIdentifiers.copyDeviceToHostQ(mCopyQueue); + mManager.outStateToInput.copyDeviceToHostQ(mCopyQueue); + mManager.positionMass.copyDeviceToHostQ(mCopyQueue); + + mCuSortedActorIDs.copyDeviceToHostQ(mCopyQueue); + mCuSortedStateIDs.copyDeviceToHostQ(mCopyQueue); + } + else if (!mManager.mCudaIos) + { + mManager.actorIdentifiers.copyDeviceToHostQ(mCopyQueue); + mManager.outStateToInput.copyDeviceToHostQ(mCopyQueue); + } + + mCopyQueue.flushEnqueued(); + + if (mManager.mOnFinishCallback) + { + (*mManager.mOnFinishCallback)(stream); + } + + tm->getGpuDispatcher()->addCompletionPrereq(*tm->getTaskFromID(mManager.mPostUpdateTaskID)); + return false; + + default: + PX_ALWAYS_ASSERT(); + return false; + } + + return true; +} + +void IofxManagerGPU::fetchResults() +{ + IosObjectGpuData* mWorkingData = DYNAMIC_CAST(IosObjectGpuData*)(mManager.mWorkingIosData); + PX_UNUSED(mWorkingData); + +#if 0 + { + ApexMirroredArray<uint32_t> actorID(*mIofxScene.mApexScene); + ApexMirroredArray<PxVec4> outMinBounds(*mIofxScene.mApexScene); + ApexMirroredArray<PxVec4> outMaxBounds(*mIofxScene.mApexScene); + ApexMirroredArray<PxVec4> outDebugInfo(*mIofxScene.mApexScene); + ApexMirroredArray<uint32_t> tmpLastActorID(*mIofxScene.mApexScene); + tmpLastActorID.setSize(64, ApexMirroredPlace::CPU_GPU); + + const uint32_t NE = 2000; + actorID.setSize(NE, ApexMirroredPlace::CPU_GPU); + + Array<uint32_t> actorCounts; + actorCounts.reserve(1000); + + uint32_t NA = 0; + for (uint32_t ie = 0; ie < NE; ++NA) + { + uint32_t num_ie = rand(1, 100); // We need to use QDSRand here s.t. seed could be preset during tests! + uint32_t next_ie = PxMin(ie + num_ie, NE); + + actorCounts.pushBack(next_ie - ie); + + for (; ie < next_ie; ++ie) + { + actorID[ie] = NA; + } + } + outMinBounds.setSize(NA, ApexMirroredPlace::CPU_GPU); + outMaxBounds.setSize(NA, ApexMirroredPlace::CPU_GPU); + outDebugInfo.setSize(NA, ApexMirroredPlace::CPU_GPU); + + for (uint32_t ia = 0; ia < NA; ++ia) + { + outMinBounds[ia].setZero(); + outMaxBounds[ia].setZero(); + } + + PxTaskManager* tm = mIofxScene.mApexScene->getTaskManager(); + PxCudaContextManager* ctx = tm->getGpuDispatcher()->getCudaContextManager(); + PxScopedCudaLock s(*ctx); + + mCopyQueue.reset(0, 4); + + actorID.copyHostToDeviceQ(mCopyQueue); + outMinBounds.copyHostToDeviceQ(mCopyQueue); + outMaxBounds.copyHostToDeviceQ(mCopyQueue); + mCopyQueue.flushEnqueued(); + + CUDA_OBJ(bboxKernel2)(0, NE, actorID.getGpuPtr(), NULL, 0, (float4*)outDebugInfo.getGpuPtr(), (float4*)outMinBounds.getGpuPtr(), (float4*)outMaxBounds.getGpuPtr()/*, tmpLastActorID.getGpuPtr()*/); + + outMinBounds.copyDeviceToHostQ(mCopyQueue); + outMaxBounds.copyDeviceToHostQ(mCopyQueue); + outDebugInfo.copyDeviceToHostQ(mCopyQueue); + tmpLastActorID.copyDeviceToHostQ(mCopyQueue); + mCopyQueue.flushEnqueued(); + + CUT_SAFE_CALL(cuCtxSynchronize()); + + uint32_t errors = 0; + float totCount = 0; + for (uint32_t ie = 0; ie < NE; ++ie) + { + uint32_t id = actorID[ie]; + if (ie == 0 || actorID[ie - 1] != id) + { + uint32_t count = actorCounts[id]; + const PxVec4& bounds = outMinBounds[id]; + if (bounds.x != count) + { + ++errors; + } + if (bounds.y != count * 2) + { + ++errors; + } + if (bounds.z != count * 3) + { + ++errors; + } + totCount += count; + } + } + + } +#endif + +#if 0 + { + PxTaskManager* tm = mIofxScene.mApexScene->getTaskManager(); + PxCudaContextManager* ctx = tm->getGpuDispatcher()->getCudaContextManager(); + + PxScopedCudaLock s(*ctx); + + CUT_SAFE_CALL(cuCtxSynchronize()); + } +#endif +#if DEBUG_GPU + { + nvidia::Array<int> valuesCounters(mWorkingData->maxStateID, 0); + uint32_t lastKey = uint32_t(-1); + for (uint32_t i = 0; i < mWorkingData->maxStateID; ++i) + { + uint32_t currKey = mCuSortedActorIDs.get(i); + PX_ASSERT(currKey < mCountActorIDs + 2); + if (lastKey != uint32_t(-1)) + { + PX_ASSERT(lastKey <= currKey); + } + if (lastKey != currKey) + { + if (mCuActorStart[currKey] != i) + { + int temp = 0; + temp++; + } + PX_ASSERT(mCuActorStart[currKey] == i); + if (lastKey != uint32_t(-1)) + { + if (mCuActorEnd[lastKey] != i) + { + int temp = 0; + temp++; + } + PX_ASSERT(mCuActorEnd[lastKey] == i); + } + } + lastKey = currKey; + + uint32_t currValue = (mCuSortedStateIDs.get(i) & STATE_ID_MASK); + PX_ASSERT(currValue < mWorkingData->maxStateID); + if (currValue < mWorkingData->maxStateID) + { + valuesCounters[currValue] += 1; + } + } + if (lastKey != uint32_t(-1)) + { + PX_ASSERT(mCuActorEnd[lastKey] == mWorkingData->maxStateID); + } + for (uint32_t i = 0; i < mWorkingData->maxStateID; ++i) + { + PX_ASSERT(valuesCounters[i] == 1); + } + } +#endif + + /* Swap input/output state offsets */ + mManager.swapStates(); + + if (mEmptySimulation) + { + for (uint32_t i = 0 ; i < mNumberVolumes ; i++) + { + IofxManager::VolumeData& d = mManager.mVolumeTable[ i ]; + if (d.vol == 0) + { + continue; + } + + for (uint32_t j = 0 ; j < mManager.mActorTable.size() ; j++) + { + IofxActorImpl* iofx = d.mActors[ j ]; + if (iofx && iofx != DEFERRED_IOFX_ACTOR) + { + iofx->mResultBounds.setEmpty(); + iofx->mResultRange.startIndex = 0; + iofx->mResultRange.objectCount = 0; + iofx->mResultVisibleCount = 0; + } + } + } + } + else + { + PX_ASSERT(mCuActorStart.cpuPtrIsValid() && mCuActorEnd.cpuPtrIsValid()); + if (!mCuActorStart.cpuPtrIsValid() || !mCuActorEnd.cpuPtrIsValid()) + { + // Workaround for issue seen by a customer + APEX_INTERNAL_ERROR("Bad cpuPtr in IofxManagerGPU::fetchResults"); + return; + } +#ifndef NDEBUG + //check Actor Ranges + { + uint32_t totalCount = 0; + //range with the last index (= mCountActorIDs) contains homeless particles! + for (uint32_t i = 0 ; i <= mCountActorIDs ; i++) + { + const uint32_t rangeStart = mCuActorStart[ i ]; + const uint32_t rangeEnd = mCuActorEnd[ i ]; + const uint32_t rangeVisibleEnd = mCuActorVisibleEnd[ i ]; + + PX_ASSERT(rangeStart < mWorkingData->numParticles); + PX_ASSERT(rangeEnd <= mWorkingData->numParticles); + PX_ASSERT(rangeStart <= rangeEnd); + PX_ASSERT(rangeStart <= rangeVisibleEnd && rangeVisibleEnd <= rangeEnd); + PX_UNUSED(rangeVisibleEnd); + + const uint32_t rangeCount = rangeEnd - rangeStart; + totalCount += rangeCount; + } + PX_ASSERT(totalCount == mWorkingData->numParticles); + } +#endif + + uint32_t aid = 0; + for (uint32_t i = 0 ; i < mNumberVolumes ; i++) + { + IofxManager::VolumeData& d = mManager.mVolumeTable[ i ]; + if (d.vol == 0) + { + aid += mManager.mActorTable.size(); + continue; + } + + for (uint32_t j = 0 ; j < mManager.mActorTable.size() ; j++) + { + const uint32_t rangeStart = mCuActorStart[ aid ]; + const uint32_t rangeEnd = mCuActorEnd[ aid ]; + const uint32_t rangeVisibleEnd = mCuActorVisibleEnd[ aid ]; + + const uint32_t rangeCount = rangeEnd - rangeStart; + const uint32_t visibleCount = rangeVisibleEnd - rangeStart; + + if (d.mActors[ j ] == DEFERRED_IOFX_ACTOR && mManager.mActorTable[ j ] != NULL && + (mIofxScene.mModule->mDeferredDisabled || rangeCount)) + { + IofxActorImpl* iofxActor = PX_NEW(IofxActorGPU)(mManager.mActorTable[j]->getRenderResID(), &mIofxScene, mManager); + if (d.vol->addIofxActor(*iofxActor)) + { + d.mActors[ j ] = iofxActor; + + mManager.initIofxActor(iofxActor, j, d.vol); + + // lock this renderable because the APEX scene will unlock it after this method is called + iofxActor->renderDataLock(); + } + else + { + iofxActor->release(); + } + } + + IofxActorImpl* iofxActor = d.mActors[ j ]; + if (iofxActor && iofxActor != DEFERRED_IOFX_ACTOR) + { + iofxActor->mResultBounds.setEmpty(); + if (rangeCount > 0) + { + iofxActor->mResultBounds.minimum = mCuMinBounds[ aid ].getXYZ(); + iofxActor->mResultBounds.maximum = mCuMaxBounds[ aid ].getXYZ(); + } + PX_ASSERT(iofxActor->mRenderBounds.isFinite()); + iofxActor->mResultRange.startIndex = rangeStart; + iofxActor->mResultRange.objectCount = rangeCount; + iofxActor->mResultVisibleCount = visibleCount; + } + + aid++; + } + } + } + +} + + +/** + * Called from render thread context, just before renderer calls update/dispatch on any IOFX + * actors. Map/Unmap render resources as required. "Mapped" means the graphics buffer has been + * mapped into our CUDA context where our kernels can write directly into it. + */ +void IofxManager::fillMapUnmapArraysForInterop(nvidia::Array<CUgraphicsResource> &toMapArray, nvidia::Array<CUgraphicsResource> &toUnmapArray) +{ + if (mInteropFlags == RenderInteropFlags::CUDA_INTEROP) + { + mResultIosData->renderData->fillMapUnmapArraysForInterop(toMapArray, toUnmapArray); + mStagingIosData->renderData->fillMapUnmapArraysForInterop(toMapArray, toUnmapArray); + } +} + + +void IofxManager::mapBufferResultsForInterop(bool mapSuccess, bool unmapSuccess) +{ + if (mInteropFlags == RenderInteropFlags::CUDA_INTEROP) + { + mResultIosData->renderData->mapBufferResultsForInterop(mapSuccess, unmapSuccess); + mStagingIosData->renderData->mapBufferResultsForInterop(mapSuccess, unmapSuccess); + } +} + +} +} // namespace nvidia + +#endif diff --git a/APEX_1.4/module/iofx/src/IofxRenderDataMesh.cpp b/APEX_1.4/module/iofx/src/IofxRenderDataMesh.cpp new file mode 100644 index 00000000..a3603f06 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxRenderDataMesh.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "IofxSceneCPU.h" +#include "IofxSceneGPU.h" +#include "IosObjectData.h" +#include "IofxRenderData.h" +#include "IofxActorImpl.h" + +namespace nvidia +{ +namespace iofx +{ + + + +bool IofxSharedRenderDataMeshImpl::createRenderLayout(IofxScene& iofxScene, uint32_t semantics, uint32_t maxObjectCount, RenderLayout_t& renderLayout) +{ + bool bIsUserDefinedLayout = false; + IofxRenderCallback* renderCallback = iofxScene.getIofxRenderCallback(); + if (renderCallback) + { + if (renderCallback->getIofxMeshRenderLayout(renderLayout, maxObjectCount, semantics, mInteropFlags)) + { + bIsUserDefinedLayout = renderLayout.isValid(); + } + } + if (!bIsUserDefinedLayout) + { + //make default layout for given set of semantics + uint32_t offset = 0; + { + IofxMeshRenderLayoutElement::Enum element = IofxMeshRenderLayoutElement::POSITION_FLOAT3; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxMeshRenderLayoutElement::getFormat(element)); + } + { + IofxMeshRenderLayoutElement::Enum element = IofxMeshRenderLayoutElement::ROTATION_SCALE_FLOAT3x3; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxMeshRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::COLOR)) + { + IofxMeshRenderLayoutElement::Enum element = IofxMeshRenderLayoutElement::COLOR_FLOAT4; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxMeshRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::DENSITY)) + { + IofxMeshRenderLayoutElement::Enum element = IofxMeshRenderLayoutElement::DENSITY_FLOAT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxMeshRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::USER_DATA)) + { + IofxMeshRenderLayoutElement::Enum element = IofxMeshRenderLayoutElement::USER_DATA_UINT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxMeshRenderLayoutElement::getFormat(element)); + } + renderLayout.stride = offset; + + renderLayout.bufferDesc.setDefaults(); + renderLayout.bufferDesc.size = maxObjectCount * renderLayout.stride; + renderLayout.bufferDesc.interopFlags = mInteropFlags; + } + PX_ASSERT((renderLayout.stride & 0x03) == 0); + return bIsUserDefinedLayout; +} + +void IofxSharedRenderDataMeshImpl::freeAllRenderStorage() +{ + if (mSharedRenderData.meshRenderBuffer != NULL) + { + mSharedRenderData.meshRenderBuffer->release(); + mSharedRenderData.meshRenderBuffer = NULL; + } +} + +bool IofxSharedRenderDataMeshImpl::allocAllRenderStorage(const RenderLayout_t& newRenderLayout, IofxRenderCallback* iofxRenderCallback) +{ + mSharedRenderData.meshRenderBuffer = iofxRenderCallback->createRenderBuffer(newRenderLayout.bufferDesc); + return (mSharedRenderData.meshRenderBuffer != NULL); +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/IofxRenderDataSprite.cpp b/APEX_1.4/module/iofx/src/IofxRenderDataSprite.cpp new file mode 100644 index 00000000..c2fb9318 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxRenderDataSprite.cpp @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "IofxSceneCPU.h" +#include "IofxSceneGPU.h" +#include "IosObjectData.h" +#include "IofxRenderData.h" +#include "IofxActorImpl.h" + +namespace nvidia +{ +namespace iofx +{ + +bool IofxSharedRenderDataSpriteImpl::createRenderLayout(IofxScene& iofxScene, uint32_t semantics, uint32_t maxObjectCount, RenderLayout_t& renderLayout) +{ + bool bIsUserDefinedLayout = false; + IofxRenderCallback* renderCallback = iofxScene.getIofxRenderCallback(); + if (renderCallback) + { + if (renderCallback->getIofxSpriteRenderLayout(renderLayout, maxObjectCount, semantics, mInteropFlags)) + { + bIsUserDefinedLayout = renderLayout.isValid(); + } + } + if (!bIsUserDefinedLayout) + { + uint32_t offset = 0; + if (semantics & (1 << IofxRenderSemantic::POSITION)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::POSITION_FLOAT3; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::COLOR)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::COLOR_FLOAT4; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::VELOCITY)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::VELOCITY_FLOAT3; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::SCALE)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::SCALE_FLOAT2; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::LIFE_REMAIN)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::LIFE_REMAIN_FLOAT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::DENSITY)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::DENSITY_FLOAT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::SUBTEXTURE)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::SUBTEXTURE_FLOAT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::ORIENTATION)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::ORIENTATION_FLOAT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + if (semantics & (1 << IofxRenderSemantic::USER_DATA)) + { + IofxSpriteRenderLayoutElement::Enum element = IofxSpriteRenderLayoutElement::USER_DATA_UINT1; + renderLayout.offsets[element] = offset; + offset += RenderDataFormat::getFormatDataSize(IofxSpriteRenderLayoutElement::getFormat(element)); + } + renderLayout.stride = offset; + renderLayout.surfaceCount = 0; + + renderLayout.bufferDesc.setDefaults(); + renderLayout.bufferDesc.size = maxObjectCount * renderLayout.stride; + renderLayout.bufferDesc.interopFlags = mInteropFlags; + } + PX_ASSERT((renderLayout.stride & 0x03) == 0); + return bIsUserDefinedLayout; +} + +void IofxSharedRenderDataSpriteImpl::freeAllRenderStorage() +{ + if (mSharedRenderData.spriteRenderBuffer != NULL) + { + mSharedRenderData.spriteRenderBuffer->release(); + mSharedRenderData.spriteRenderBuffer = NULL; + } + + for (uint32_t i = 0; i < IofxSpriteRenderLayout::MAX_SURFACE_COUNT; ++i) + { + if (mSharedRenderData.spriteRenderSurfaces[i] != NULL) + { + mSharedRenderData.spriteRenderSurfaces[i]->release(); + mSharedRenderData.spriteRenderSurfaces[i] = NULL; + } + } +} + +bool IofxSharedRenderDataSpriteImpl::allocAllRenderStorage(const RenderLayout_t& newRenderLayout, IofxRenderCallback* iofxRenderCallback) +{ + bool result = false; + if (newRenderLayout.surfaceCount > 0) + { + result = true; + for (uint32_t i = 0; result && i < newRenderLayout.surfaceCount; ++i) + { + mSharedRenderData.spriteRenderSurfaces[i] = iofxRenderCallback->createRenderSurface(newRenderLayout.surfaceDescs[i]); + result &= (mSharedRenderData.spriteRenderSurfaces[i] != NULL); + } + if (!result) + { + for (uint32_t i = 0; i < newRenderLayout.surfaceCount; ++i) + { + if (mSharedRenderData.spriteRenderSurfaces[i] != NULL) + { + mSharedRenderData.spriteRenderSurfaces[i]->release(); + mSharedRenderData.spriteRenderSurfaces[i] = NULL; + } + } + } + } + else + { + mSharedRenderData.spriteRenderBuffer = iofxRenderCallback->createRenderBuffer(newRenderLayout.bufferDesc); + result = (mSharedRenderData.spriteRenderBuffer != NULL); + } + return result; +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/IofxScene.cpp b/APEX_1.4/module/iofx/src/IofxScene.cpp new file mode 100644 index 00000000..400fca10 --- /dev/null +++ b/APEX_1.4/module/iofx/src/IofxScene.cpp @@ -0,0 +1,527 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "ApexUsingNamespace.h" +#include "ModuleIofxImpl.h" +#include "IofxSceneCPU.h" +#include "IofxSceneGPU.h" +#include "IofxAssetImpl.h" +#include "IofxActorImpl.h" +#include "IofxActorCPU.h" +#include "IofxDebugRenderParams.h" +#include "DebugRenderParams.h" +#include "RenderVolumeImpl.h" +#include "SceneIntl.h" +#include "ModulePerfScope.h" +#include "RenderDebugInterface.h" + +#if APEX_CUDA_SUPPORT +#include <cuda.h> +#include "ApexCutil.h" +#include "IofxActorGPU.h" + +#include "ApexCudaSource.h" +#endif + +#include "Lock.h" + +namespace nvidia +{ +namespace iofx +{ + +IofxRenderable* IofxRenderableIteratorImpl::findNextInActorList() +{ + for (; mActorIndex < mActorCount; ++mActorIndex) + { + IofxRenderable* result = mActorList[mActorIndex]->acquireRenderableReference(); + if (result != NULL) + { + return result; + } + } + mIofxScene.mLiveRenderVolumes[mVolumeIndex]->unlockIofxActorList(); + return NULL; +} + +IofxRenderable* IofxRenderableIteratorImpl::findFirstInNotEmptyVolume() +{ + for (; mVolumeIndex < mVolumeCount; ++mVolumeIndex) + { + mActorList = mIofxScene.mLiveRenderVolumes[mVolumeIndex]->lockIofxActorList(mActorCount); + mActorIndex = 0; + IofxRenderable* result = findNextInActorList(); + if (result != NULL) + { + return result; + } + } + mIofxScene.mLiveRenderVolumesLock.unlockReader(); + return NULL; +} + +IofxRenderable* IofxRenderableIteratorImpl::getFirst() +{ + mIofxScene.mLiveRenderVolumesLock.lockReader(); + mVolumeCount = mIofxScene.mLiveRenderVolumes.size(); + mVolumeIndex = 0; + return findFirstInNotEmptyVolume(); +} + +IofxRenderable* IofxRenderableIteratorImpl::getNext() +{ + if (mVolumeIndex < mVolumeCount) + { + PX_ASSERT(mActorIndex < mActorCount); + ++mActorIndex; + IofxRenderable* result = findNextInActorList(); + if (result != NULL) + { + return result; + } + ++mVolumeIndex; + return findFirstInNotEmptyVolume(); + } + return NULL; +} + + +static StatsInfo IOFXStatsData[] = +{ + {"IOFX: SimulatedSpriteParticlesCount", StatDataType::INT, {{0}} }, + {"IOFX: SimulatedMeshParticlesCount", StatDataType::INT, {{0}} } +}; + +IofxScene::IofxScene(ModuleIofxImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) + : mModule(&module) + , mApexScene(&scene) + , mDebugRender(debugRender) + , mPrevTotalSimulatedSpriteParticles(0) + , mPrevTotalSimulatedMeshParticles(0) + , mRenderCallback(NULL) +{ + list.add(*this); // Add self to module's list of IofxScenes + + /* Initialize reference to IofxDebugRenderParams */ + { + WRITE_LOCK(*mApexScene); + mDebugRenderParams = DYNAMIC_CAST(DebugRenderParams*)(mApexScene->getDebugRenderParams()); + } + PX_ASSERT(mDebugRenderParams); + NvParameterized::Handle handle(*mDebugRenderParams), memberHandle(*mDebugRenderParams); + int size; + + if (mDebugRenderParams->getParameterHandle("moduleName", handle) == NvParameterized::ERROR_NONE) + { + handle.getArraySize(size, 0); + handle.resizeArray(size + 1); + if (handle.getChildHandle(size, memberHandle) == NvParameterized::ERROR_NONE) + { + memberHandle.initParamRef(IofxDebugRenderParams::staticClassName(), true); + } + } + + /* Load reference to IofxDebugRenderParams */ + NvParameterized::Interface* refPtr = NULL; + memberHandle.getParamRef(refPtr); + mIofxDebugRenderParams = DYNAMIC_CAST(IofxDebugRenderParams*)(refPtr); + PX_ASSERT(mIofxDebugRenderParams); + + createModuleStats(); +} + +IofxScene::~IofxScene() +{ + destroyModuleStats(); +} + +Module* IofxScene::getModule() +{ + return mModule; +} + +void IofxScene::release() +{ + mModule->releaseModuleSceneIntl(*this); +} + +IofxManager* IofxScene::createIofxManager(const IofxAsset& asset, const IofxManagerDescIntl& desc) +{ + mManagersLock.lockWriter(); + + IofxManager* iofxManager = PX_NEW(IofxManager)(*this, desc, asset.getMeshAssetCount() > 0); + + mManagersLock.unlockWriter(); + + return iofxManager; +} + +void IofxScene::releaseIofxManager(IofxManager* manager) +{ + mManagersLock.lockWriter(); + + manager->destroy(); + + mManagersLock.unlockWriter(); +} + +void IofxScene::createModuleStats(void) +{ + mModuleSceneStats.numApexStats = NumberOfStats; + mModuleSceneStats.ApexStatsInfoPtr = (StatsInfo*)PX_ALLOC(sizeof(StatsInfo) * NumberOfStats, PX_DEBUG_EXP("StatsInfo")); + + for (uint32_t i = 0; i < NumberOfStats; i++) + { + mModuleSceneStats.ApexStatsInfoPtr[i] = IOFXStatsData[i]; + } +} + +void IofxScene::destroyModuleStats(void) +{ + mModuleSceneStats.numApexStats = 0; + if (mModuleSceneStats.ApexStatsInfoPtr) + { + PX_FREE_AND_RESET(mModuleSceneStats.ApexStatsInfoPtr); + } +} + +void IofxScene::setStatValue(StatsDataEnum index, StatValue dataVal) +{ + if (mModuleSceneStats.ApexStatsInfoPtr) + { + mModuleSceneStats.ApexStatsInfoPtr[index].StatCurrentValue = dataVal; + } +} + +void IofxScene::visualize() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mIofxDebugRenderParams->VISUALIZE_IOFX_ACTOR) + { + return; + } + + PxMat44 cameraFacingPose((mApexScene->getViewMatrix(0)).inverseRT()); + + const physx::PxMat44& savedPose = *RENDER_DEBUG_IFACE(mDebugRender)->getPoseTyped(); + RENDER_DEBUG_IFACE(mDebugRender)->setIdentityPose(); + RENDER_DEBUG_IFACE(mDebugRender)->pushRenderState(); + RENDER_DEBUG_IFACE(mDebugRender)->setCurrentTextScale(3.0f); + + // iofx current bounding volume + // there is a bug with setting the color. it can change under certain circumstances. use default color for now + //RENDER_DEBUG_IFACE(mDebugRender)->setCurrentColor(RENDER_DEBUG_IFACE(mDebugRender)->getDebugColor(DebugColors::LightBlue)); + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + IofxActorImpl* actor = DYNAMIC_CAST(IofxActorImpl*)(mActorArray[ i ]); + if (mIofxDebugRenderParams->VISUALIZE_IOFX_ACTOR_NAME) + { + PxVec3 textLocation = actor->getBounds().maximum; + cameraFacingPose.setPosition(textLocation); + if(actor->getOwner() != NULL) + { + RENDER_DEBUG_IFACE(mDebugRender)->debugText(textLocation, " %s %s", actor->getOwner()->getObjTypeName(), actor->getOwner()->getName()); + } + } + if (mIofxDebugRenderParams->VISUALIZE_IOFX_BOUNDING_BOX) + { + RENDER_DEBUG_IFACE(mDebugRender)->debugBound(actor->getBounds()); + } + } + + // iofx max bounding volume + // there is a bug with setting the color. it can change under certain circumstances. use default color for now + //RENDER_DEBUG_IFACE(mDebugRender)->setCurrentColor(RENDER_DEBUG_IFACE(mDebugRender)->getDebugColor(DebugColors::Orange)); + mLiveRenderVolumesLock.lockReader(); + for (uint32_t i = 0 ; i < mLiveRenderVolumes.size() ; i++) + { + if (mIofxDebugRenderParams->VISUALIZE_IOFX_BOUNDING_BOX) + { + PxVec3 textLocation = mLiveRenderVolumes[i]->getOwnershipBounds().maximum; + cameraFacingPose.setPosition(textLocation); + RENDER_DEBUG_IFACE(mDebugRender)->debugText(textLocation, " Max Render Volume %d", i); + RENDER_DEBUG_IFACE(mDebugRender)->debugBound(mLiveRenderVolumes[i]->getOwnershipBounds()); + } + } + mLiveRenderVolumesLock.unlockReader(); + + RENDER_DEBUG_IFACE(mDebugRender)->setPose(savedPose); + RENDER_DEBUG_IFACE(mDebugRender)->popRenderState(); +#endif +} + +void IofxScene::destroy() +{ + removeAllActors(); + mApexScene->moduleReleased(*this); + + { + mLiveRenderVolumesLock.lockWriter(); + + /* Handle deferred insertions/deletions of ApexRenderVolumes */ + processDeferredRenderVolumes(); + + /* Delete all Live ApexRenderVolumes */ + for (uint32_t i = 0 ; i < mLiveRenderVolumes.size() ; i++) + { + RenderVolumeImpl* arv = mLiveRenderVolumes[ i ]; + PX_DELETE(arv); + } + mLiveRenderVolumes.clear(); + + mLiveRenderVolumesLock.unlockWriter(); + } + delete this; +} + +void IofxScene::setModulePhysXScene(PxScene* nxScene) +{ + if (nxScene) + { + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + IofxActorImpl* actor = DYNAMIC_CAST(IofxActorImpl*)(mActorArray[ i ]); + actor->setPhysXScene(nxScene); + } + } + else + { + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + IofxActorImpl* actor = DYNAMIC_CAST(IofxActorImpl*)(mActorArray[ i ]); + actor->setPhysXScene(NULL); + } + } + + mPhysXScene = nxScene; +} + +void IofxScene::processDeferredRenderVolumes() +{ + mAddedRenderVolumesLock.lock(); + while (mAddedRenderVolumes.size()) + { + RenderVolumeImpl* arv = mAddedRenderVolumes.popBack(); + mLiveRenderVolumes.pushBack(arv); + } + mAddedRenderVolumesLock.unlock(); + + mDeletedRenderVolumesLock.lock(); + while (mDeletedRenderVolumes.size()) + { + RenderVolumeImpl* arv = mDeletedRenderVolumes.popBack(); + mLiveRenderVolumes.findAndReplaceWithLast(arv); + PX_DELETE(arv); + } + mDeletedRenderVolumesLock.unlock(); +} + +void IofxScene::submitTasks(float /*elapsedTime*/, float /*substepSize*/, uint32_t /*numSubSteps*/) +{ + { + mLiveRenderVolumesLock.lockWriter(); + + /* Handle deferred insertions/deletions of ApexRenderVolumes */ + processDeferredRenderVolumes(); + + mLiveRenderVolumesLock.unlockWriter(); + } + + mManagersLock.lockReader(); + + //IofxManager::submitTasks reads mLiveRenderVolumes so we lock it here and unlock later + mLiveRenderVolumesLock.lockReader(); + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->submitTasks(); + } + mLiveRenderVolumesLock.unlockReader(); + + mManagersLock.unlockReader(); +} + +void IofxScene::fetchResults() +{ + mManagersLock.lockReader(); + + mFetchResultsLock.lock(); + + uint32_t totalSimulatedSpriteParticles = 0, + totalSimulatedMeshParticles = 0; + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->fetchResults(); + + if(mgr->isMesh()) + totalSimulatedMeshParticles += mgr->getSimulatedParticlesCount(); + else + totalSimulatedSpriteParticles += mgr->getSimulatedParticlesCount(); + } + + StatValue dataVal; + dataVal.Int = int32_t(totalSimulatedSpriteParticles - mPrevTotalSimulatedSpriteParticles); + setStatValue(SimulatedSpriteParticlesCount, dataVal); + mPrevTotalSimulatedSpriteParticles = totalSimulatedSpriteParticles; + dataVal.Int = int32_t(totalSimulatedMeshParticles - mPrevTotalSimulatedMeshParticles); + setStatValue(SimulatedMeshParticlesCount, dataVal); + mPrevTotalSimulatedMeshParticles = totalSimulatedMeshParticles; + + mFetchResultsLock.unlock(); + + mManagersLock.unlockReader(); +} + +void IofxScene::prepareRenderables() +{ + mManagersLock.lockReader(); + + lockLiveRenderVolumes(); + mFetchResultsLock.lock(); + + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->prepareRenderables(); + } + + mFetchResultsLock.unlock(); + unlockLiveRenderVolumes(); + + mManagersLock.unlockReader(); +} + + +void IofxScene::lockLiveRenderVolumes() +{ + mLiveRenderVolumesLock.lockReader(); + //for (uint32_t i = 0 ; i < mLiveRenderVolumes.size() ; i++) + //{ + // mLiveRenderVolumes[ i ]->lockReader(); + //} +} + +void IofxScene::unlockLiveRenderVolumes() +{ + //for (uint32_t i = 0 ; i < mLiveRenderVolumes.size() ; i++) + //{ + // mLiveRenderVolumes[ i ]->unlockReader(); + //} + mLiveRenderVolumesLock.unlockReader(); +} + +/******************************** CPU Version ********************************/ + +IofxSceneCPU::IofxSceneCPU(ModuleIofxImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) + : IOFX_SCENE(module, scene, debugRender, list) +{ +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT +IofxSceneGPU::IofxSceneGPU(ModuleIofxImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) : + IOFX_SCENE(module, scene, debugRender, list), + CudaModuleScene(scene, *mModule, APEX_CUDA_TO_STR(APEX_CUDA_MODULE_PREFIX)), + mContextManager(scene.getTaskManager()->getGpuDispatcher()->getCudaContextManager()) +{ + PxGpuDispatcher* gd = scene.getTaskManager()->getGpuDispatcher(); + PX_ASSERT(gd != NULL); + PxScopedCudaLock _lock_(*gd->getCudaContextManager()); + +//CUDA module objects +#include "../cuda/include/moduleList.h" +} + +IofxSceneGPU::~IofxSceneGPU() +{ + PxScopedCudaLock s(*mContextManager); + CudaModuleScene::destroy(*mApexScene); +} + +void IofxSceneGPU::submitTasks(float elapsedTime, float substepSize, uint32_t numSubSteps) +{ + IofxScene::submitTasks(elapsedTime, substepSize, numSubSteps); + + { + PxScopedCudaLock _lock_(*mContextManager); + + APEX_CUDA_OBJ_NAME(migrationStorage).copyToDevice(mContextManager, 0); + APEX_CUDA_OBJ_NAME(remapStorage).copyToDevice(mContextManager, 0); + APEX_CUDA_OBJ_NAME(modifierStorage).copyToDevice(mContextManager, 0); + } +} + + +void IofxSceneGPU::prepareRenderables() +{ + mManagersLock.lockReader(); + + lockLiveRenderVolumes(); + mFetchResultsLock.lock(); + + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->prepareRenderables(); + } + + if (mContextManager->getInteropMode() != PxCudaInteropMode::NO_INTEROP) + { + mToMapArray.clear(); + mToUnmapArray.clear(); + + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->fillMapUnmapArraysForInterop(mToMapArray, mToUnmapArray); + } + + bool mapSuccess = true; + bool unmapSuccess = true; + { + PxScopedCudaLock s(*mContextManager); + + if (!mToMapArray.empty()) + { + for (uint32_t i = 0; i < mToMapArray.size(); ++i) + { + cuGraphicsResourceSetMapFlags( mToMapArray[i], CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD ); + } + CUresult res = cuGraphicsMapResources(mToMapArray.size(), &mToMapArray.front(), 0); + mapSuccess = (res == CUDA_SUCCESS || res == CUDA_ERROR_ALREADY_MAPPED); + } + if (!mToUnmapArray.empty()) + { + CUresult res = cuGraphicsUnmapResources(mToUnmapArray.size(), &mToUnmapArray.front(), 0); + unmapSuccess = (res == CUDA_SUCCESS || res == CUDA_ERROR_NOT_MAPPED); + } + } + + for (uint32_t i = 0; i < mActorManagers.getSize(); ++i) + { + IofxManager* mgr = DYNAMIC_CAST(IofxManager*)(mActorManagers.getResource(i)); + mgr->mapBufferResultsForInterop(mapSuccess, unmapSuccess); + } + } + + mFetchResultsLock.unlock(); + unlockLiveRenderVolumes(); + + mManagersLock.unlockReader(); +} + +#endif + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/ModifierCPU.cpp b/APEX_1.4/module/iofx/src/ModifierCPU.cpp new file mode 100644 index 00000000..572e8ac2 --- /dev/null +++ b/APEX_1.4/module/iofx/src/ModifierCPU.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "ModifierImpl.h" + +#pragma warning (disable : 4127) + +#include "ModifierData.h" + +namespace nvidia +{ +namespace apex +{ + +#define MODIFIER_DECL +#define CURVE_TYPE const nvidia::apex::Curve* +#define EVAL_CURVE(curve, value) curve->evaluate(value) +#define PARAMS_NAME(name) name ## ParamsCPU + +#include "ModifierSrc.h" + +#undef MODIFIER_DECL +#undef CURVE_TYPE +#undef EVAL_CURVE +#undef PARAMS_NAME + +} + +namespace iofx +{ + +#define _MODIFIER(name) \ + void name ## ModifierImpl :: mapParamsCPU(ModifierParamsMapperCPU& mapper) const \ + { \ + mapParams(mapper, (name ## ParamsCPU *)NULL); \ + } \ + +#define _MODIFIER_SPRITE(name) \ + void updateSprite_##name (const void* params, const SpriteInput& input, SpritePublicState& pubState, SpritePrivateState& privState, const ModifierCommonParams& common, RandState& randState) \ + { \ + modifier##name <void, false, ModifierUsage_Sprite> (*static_cast<const name##ParamsCPU *>(params), input, pubState, privState, common, randState); \ + } \ + void updateSpriteOnSpawn_##name (const void* params, const SpriteInput& input, SpritePublicState& pubState, SpritePrivateState& privState, const ModifierCommonParams& common, RandState& randState) \ + { \ + modifier##name <void, true, ModifierUsage_Sprite> (*static_cast<const name##ParamsCPU *>(params), input, pubState, privState, common, randState); \ + } \ + ModifierImpl::updateSpriteFunc name##ModifierImpl :: getUpdateSpriteFunc(ModifierStage stage) const \ + { \ + switch (stage) { \ + case ModifierStage_Spawn: return &updateSpriteOnSpawn_##name; \ + case ModifierStage_Continuous: return &updateSprite_##name; \ + default: \ + PX_ALWAYS_ASSERT(); \ + return 0; \ + } \ + } + +#define _MODIFIER_MESH(name) \ + void updateMesh_##name (const void* params, const MeshInput& input, MeshPublicState& pubState, MeshPrivateState& privState, const ModifierCommonParams& common, RandState& randState) \ + { \ + modifier##name <void, false, ModifierUsage_Mesh> (*static_cast<const name##ParamsCPU *>(params), input, pubState, privState, common, randState); \ + } \ + void updateMeshOnSpawn_##name (const void* params, const MeshInput& input, MeshPublicState& pubState, MeshPrivateState& privState, const ModifierCommonParams& common, RandState& randState) \ + { \ + modifier##name <void, true, ModifierUsage_Mesh> (*static_cast<const name##ParamsCPU *>(params), input, pubState, privState, common, randState); \ + } \ + ModifierImpl::updateMeshFunc name##ModifierImpl :: getUpdateMeshFunc(ModifierStage stage) const \ + { \ + switch (stage) { \ + case ModifierStage_Spawn: return &updateMeshOnSpawn_##name; \ + case ModifierStage_Continuous: return &updateMesh_##name; \ + default: \ + PX_ALWAYS_ASSERT(); \ + return 0; \ + } \ + } + +#include "ModifierList.h" + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/ModifierGPU.cpp b/APEX_1.4/module/iofx/src/ModifierGPU.cpp new file mode 100644 index 00000000..55cae513 --- /dev/null +++ b/APEX_1.4/module/iofx/src/ModifierGPU.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "ModifierImpl.h" + +#if APEX_CUDA_SUPPORT + +#include "ApexCudaWrapper.h" + +#include "ModifierData.h" + +namespace nvidia +{ +namespace apex +{ + +#define MODIFIER_DECL +#define CURVE_TYPE nvidia::iofx::Curve +#define EVAL_CURVE(curve, value) 0 +#define PARAMS_NAME(name) name ## ParamsGPU + +#include "ModifierSrc.h" + +#undef MODIFIER_DECL +#undef CURVE_TYPE +#undef EVAL_CURVE +//#undef PARAMS_NAME +} +namespace iofx +{ + +class ModifierParamsMapperGPU_Adapter +{ +private: + ModifierParamsMapperGPU_Adapter& operator=(const ModifierParamsMapperGPU_Adapter&); + + ModifierParamsMapperGPU& _mapper; + InplaceStorage& _storage; + uint8_t* _params; + +public: + ModifierParamsMapperGPU_Adapter(ModifierParamsMapperGPU& mapper) + : _mapper(mapper), _storage(mapper.getStorage()), _params(0) {} + + PX_INLINE InplaceStorage& getStorage() + { + return _storage; + } + + PX_INLINE void beginParams(void* params, size_t , size_t , uint32_t) + { + _params = (uint8_t*)params; + } + PX_INLINE void endParams() + { + _params = 0; + } + + template <typename T> + PX_INLINE void mapValue(size_t offset, T value) + { + PX_ASSERT(_params != 0); + *(T*)(_params + offset) = value; + } + + PX_INLINE void mapCurve(size_t offset, const nvidia::apex::Curve* nxCurve) + { + PX_ASSERT(_params != 0); + Curve& curve = *(Curve*)(_params + offset); + + uint32_t numPoints; + const Vec2R* nxPoints = nxCurve->getControlPoints(numPoints); + + curve.resize(_storage, numPoints); + for (uint32_t i = 0; i < numPoints; ++i) + { + const Vec2R& nxPoint = nxPoints[i]; + curve.setPoint(_storage, CurvePoint(nxPoint.x, nxPoint.y), i); + } + } +}; + +#define _MODIFIER(name) \ + void name ## ModifierImpl :: mapParamsGPU(ModifierParamsMapperGPU& mapper) const \ + { \ + ModifierParamsMapperGPU_Adapter adapter(mapper); \ + InplaceHandle< PARAMS_NAME(name) > paramsHandle; \ + paramsHandle.alloc( adapter.getStorage() ); \ + PARAMS_NAME(name) params; \ + mapParams( adapter, ¶ms ); \ + paramsHandle.update( adapter.getStorage(), params ); \ + mapper.onParams( paramsHandle, PARAMS_NAME(name)::RANDOM_COUNT ); \ + } \ + +#include "ModifierList.h" + +} +} // namespace nvidia + +#endif diff --git a/APEX_1.4/module/iofx/src/ModifierImpl.cpp b/APEX_1.4/module/iofx/src/ModifierImpl.cpp new file mode 100644 index 00000000..897364e7 --- /dev/null +++ b/APEX_1.4/module/iofx/src/ModifierImpl.cpp @@ -0,0 +1,415 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + + +#include "ModifierImpl.h" + +#include "ApexSDKHelpers.h" +#include "ApexSharedUtils.h" +//#include "ApexSharedSerialization.h" +#include "InstancedObjectSimulationIntl.h" +#include "IofxActor.h" +#include "ParamArray.h" +#include "IofxAssetImpl.h" + + +namespace nvidia +{ +namespace iofx +{ + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RotationModifierImpl::RotationModifierImpl(RotationModifierParams* params) : + mParams(params), + mRollType(ApexMeshParticleRollType::SPHERICAL), + mRollAxis(0), + mRollSign(0), + mLastUpdateTime(0.0f) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("rollType", h); + setRollType((ApexMeshParticleRollType::Enum) h.parameterDefinition()->enumValIndex(mParams->rollType)); +} + +// ------------------------------------------------------------------------------------------------ +void RotationModifierImpl::setRollType(ApexMeshParticleRollType::Enum rollType) +{ + PX_ASSERT(rollType < ApexMeshParticleRollType::COUNT); + mRollType = rollType; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("rollType", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)rollType)); + + switch (mRollType) + { + default: + mRollSign = 1.0f; + mRollAxis = -1; + break; + case ApexMeshParticleRollType::FLAT_X: + mRollSign = 1.0f; + mRollAxis = 0; + break; + case ApexMeshParticleRollType::FLAT_Y: + mRollSign = 1.0f; + mRollAxis = 1; + break; + case ApexMeshParticleRollType::FLAT_Z: + mRollSign = 1.0f; + mRollAxis = 2; + break; + case ApexMeshParticleRollType::LONG_X: + mRollSign = -1.0f; + mRollAxis = 0; + break; + case ApexMeshParticleRollType::LONG_Y: + mRollSign = -1.0f; + mRollAxis = 1; + break; + case ApexMeshParticleRollType::LONG_Z: + mRollSign = -1.0f; + mRollAxis = 2; + break; + } +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +SimpleScaleModifierImpl::SimpleScaleModifierImpl(SimpleScaleModifierParams* params) : + mParams(params) +{ } + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RandomScaleModifierImpl::RandomScaleModifierImpl(RandomScaleModifierParams* param) : + mParams(param) +{ } + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ScaleByMassModifierImpl::ScaleByMassModifierImpl(ScaleByMassModifierParams* params) : + mParams(params) +{ } + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ColorVsLifeModifierImpl::ColorVsLifeModifierImpl(ColorVsLifeModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + + mColorChannel = (ColorChannel)(h.parameterDefinition()->enumValIndex(mParams->colorChannel)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +// ------------------------------------------------------------------------------------------------ + +void ColorVsLifeModifierImpl::setColorChannel(ColorChannel colorChannel) +{ + mColorChannel = colorChannel; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)colorChannel)); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ColorVsDensityModifierImpl::ColorVsDensityModifierImpl(ColorVsDensityModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + + mColorChannel = (ColorChannel)(h.parameterDefinition()->enumValIndex(mParams->colorChannel)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +// ------------------------------------------------------------------------------------------------ + +void ColorVsDensityModifierImpl::setColorChannel(ColorChannel colorChannel) +{ + mColorChannel = colorChannel; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)colorChannel)); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ColorVsVelocityModifierImpl::ColorVsVelocityModifierImpl(ColorVsVelocityModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + + mColorChannel = (ColorChannel)(h.parameterDefinition()->enumValIndex(mParams->colorChannel)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +// ------------------------------------------------------------------------------------------------ + +void ColorVsVelocityModifierImpl::setColorChannel(ColorChannel colorChannel) +{ + mColorChannel = colorChannel; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("colorChannel", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)colorChannel)); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +SubtextureVsLifeModifierImpl::SubtextureVsLifeModifierImpl(SubtextureVsLifeModifierParams* params) : + mParams(params) +{ + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +OrientAlongVelocityModifierImpl::OrientAlongVelocityModifierImpl(OrientAlongVelocityModifierParams* params) : + mParams(params) +{ } + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ScaleAlongVelocityModifierImpl::ScaleAlongVelocityModifierImpl(ScaleAlongVelocityModifierParams* params) : + mParams(params) +{ } + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RandomSubtextureModifierImpl::RandomSubtextureModifierImpl(RandomSubtextureModifierParams* params) : + mParams(params) +{} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RandomRotationModifierImpl::RandomRotationModifierImpl(RandomRotationModifierParams* params) : + mParams(params) +{} + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ScaleVsLifeModifierImpl::ScaleVsLifeModifierImpl(ScaleVsLifeModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + + mScaleAxis = (ScaleAxis)(h.parameterDefinition()->enumValIndex(mParams->scaleAxis)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +void ScaleVsLifeModifierImpl::setScaleAxis(ScaleAxis a) +{ + mScaleAxis = a; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)a)); +} + + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ScaleVsDensityModifierImpl::ScaleVsDensityModifierImpl(ScaleVsDensityModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + + mScaleAxis = (ScaleAxis)(h.parameterDefinition()->enumValIndex(mParams->scaleAxis)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +void ScaleVsDensityModifierImpl::setScaleAxis(ScaleAxis a) +{ + mScaleAxis = a; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)a)); +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +ScaleVsCameraDistanceModifierImpl::ScaleVsCameraDistanceModifierImpl(ScaleVsCameraDistanceModifierParams* params) : + mParams(params) +{ + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + + mScaleAxis = (ScaleAxis)(h.parameterDefinition()->enumValIndex(mParams->scaleAxis)); + + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +void ScaleVsCameraDistanceModifierImpl::setScaleAxis(ScaleAxis a) +{ + mScaleAxis = a; + + NvParameterized::Handle h(*mParams); + mParams->getParameterHandle("scaleAxis", h); + mParams->setParamEnum(h, h.parameterDefinition()->enumVal((int)a)); +} + + + +ViewDirectionSortingModifierImpl::ViewDirectionSortingModifierImpl(ViewDirectionSortingModifierParams* params) + : mParams(params) +{ +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RotationRateModifierImpl::RotationRateModifierImpl(RotationRateModifierParams* params) : + mParams(params) +{ +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +RotationRateVsLifeModifierImpl::RotationRateVsLifeModifierImpl(RotationRateVsLifeModifierParams* params) : + mParams(params) +{ + //do this in the Curve constructor... (for inplace stuff) + ParamArray<Vec2R> cp(mParams, "controlPoints", (ParamDynamicArrayStruct*)&mParams->controlPoints); + for (uint32_t i = 0; i < cp.size(); i++) + { + mCurveFunction.addControlPoint(cp[i]); + } +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +OrientScaleAlongScreenVelocityModifierImpl::OrientScaleAlongScreenVelocityModifierImpl(OrientScaleAlongScreenVelocityModifierParams* params) : + mParams(params) +{ +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +Modifier* CreateModifier(ModifierTypeEnum modifierType, NvParameterized::Interface* objParam, NvParameterized::Handle& h) +{ + PX_UNUSED(objParam); + PX_ASSERT(objParam == h.getConstInterface()); + +#define _MODIFIER(Type) \ +case ModifierType_##Type: \ + h.initParamRef(#Type "ModifierParams", true); \ + h.getParamRef(refParam); \ + return PX_NEW(Type##ModifierImpl)((Type##ModifierParams*)refParam); \ + + NvParameterized::Interface* refParam = 0; + + // TODO: This should go to an actual factory which can be used to extend modifiers. + switch (modifierType) + { +#include "ModifierList.h" + + default: + PX_ALWAYS_ASSERT(); + } + return 0; +} + +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ + +const ModifierImpl* ModifierImpl::castFrom(const Modifier* modifier) +{ +#define _MODIFIER(Type) \ +case ModifierType_##Type: \ + return static_cast<const ModifierImpl*>( static_cast<const Type ## ModifierImpl *>(modifier) ); \ + + ModifierTypeEnum modifierType = modifier->getModifierType(); + switch (modifierType) + { +#include "ModifierList.h" + + default: + PX_ALWAYS_ASSERT(); + return 0; + } +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/ModuleIofxImpl.cpp b/APEX_1.4/module/iofx/src/ModuleIofxImpl.cpp new file mode 100644 index 00000000..95df8b7c --- /dev/null +++ b/APEX_1.4/module/iofx/src/ModuleIofxImpl.cpp @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" +#include "ApexUsingNamespace.h" +#include "ApexSDKIntl.h" +#include "ModuleIofxImpl.h" +#include "ModuleIofxRegistration.h" +#include "IofxAssetImpl.h" +#include "SceneIntl.h" +#include "PsMemoryBuffer.h" +#include "IofxSceneCPU.h" +#include "IofxSceneGPU.h" +#include "IofxActorImpl.h" +#include "RenderVolumeImpl.h" + +#include "ModulePerfScope.h" +using namespace iofx; + +#include "Lock.h" + +namespace nvidia +{ +namespace apex +{ + +#if defined(_USRDLL) + +/* Modules don't have to link against the framework, they keep their own */ +ApexSDKIntl* gApexSdk = 0; +ApexSDK* GetApexSDK() +{ + return gApexSdk; +} +ApexSDKIntl* GetInternalApexSDK() +{ + return gApexSdk; +} + +APEX_API Module* CALL_CONV createModule( + ApexSDKIntl* inSdk, + ModuleIntl** niRef, + uint32_t APEXsdkVersion, + uint32_t PhysXsdkVersion, + ApexCreateError* errorCode) +{ + if (APEXsdkVersion != APEX_SDK_VERSION) + { + if (errorCode) + { + *errorCode = APEX_CE_WRONG_VERSION; + } + return NULL; + } + + if (PhysXsdkVersion != PX_PHYSICS_VERSION) + { + if (errorCode) + { + *errorCode = APEX_CE_WRONG_VERSION; + } + return NULL; + } + + /* Setup common module global variables */ + gApexSdk = inSdk; + ModuleIofxImpl* impl = PX_NEW(ModuleIofx)(inSdk); + *niRef = (ModuleIntl*) impl; + return (Module*) impl; +} +#else +/* Statically linking entry function */ +void instantiateModuleIofx() +{ + ApexSDKIntl* sdk = GetInternalApexSDK(); + iofx::ModuleIofxImpl* impl = PX_NEW(iofx::ModuleIofxImpl)(sdk); + sdk->registerExternalModule((Module*) impl, (ModuleIntl*) impl); +} +#endif +} + +namespace iofx +{ +/* =================== ModuleIofxImpl =================== */ + + +AuthObjTypeID IofxAssetImpl::mAssetTypeID; +#ifdef WITHOUT_APEX_AUTHORING + +class IofxAssetDummyAuthoring : public AssetAuthoring, public UserAllocated +{ +public: + IofxAssetDummyAuthoring(ModuleIofxImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + { + PX_UNUSED(module); + PX_UNUSED(list); + PX_UNUSED(params); + PX_UNUSED(name); + } + + IofxAssetDummyAuthoring(ModuleIofxImpl* module, ResourceList& list, const char* name) + { + PX_UNUSED(module); + PX_UNUSED(list); + PX_UNUSED(name); + } + + IofxAssetDummyAuthoring(ModuleIofxImpl* module, ResourceList& list) + { + PX_UNUSED(module); + PX_UNUSED(list); + } + + virtual void setToolString(const char* /*toolName*/, const char* /*toolVersion*/, uint32_t /*toolChangelist*/) + { + + } + + + virtual void release() + { + destroy(); + } + + // internal + void destroy() + { + delete this; + } + + /** + * \brief Returns the name of this APEX authorable object type + */ + virtual const char* getObjTypeName() const + { + return IOFX_AUTHORING_TYPE_NAME; + } + + /** + * \brief Prepares a fully authored Asset Authoring object for a specified platform + */ + virtual bool prepareForPlatform(nvidia::apex::PlatformTag) + { + PX_ASSERT(0); + return false; + } + + const char* getName(void) const + { + return NULL; + } + + /** + * \brief Save asset's NvParameterized interface, may return NULL + */ + virtual NvParameterized::Interface* getNvParameterized() const + { + PX_ASSERT(0); + return NULL; + } + + virtual NvParameterized::Interface* releaseAndReturnNvParameterizedInterface(void) + { + PX_ALWAYS_ASSERT(); + return NULL; + } +}; + +typedef ApexAuthorableObject<ModuleIofxImpl, IofxAssetImpl, IofxAssetDummyAuthoring> IofxAO; + +#else +typedef ApexAuthorableObject<ModuleIofxImpl, IofxAssetImpl, IofxAssetAuthoringImpl> IofxAO; +#endif + +ModuleIofxImpl::ModuleIofxImpl(ApexSDKIntl* sdk) +{ + mSdk = sdk; + mApiProxy = this; + mName = "IOFX"; + mModuleParams = NULL; + mInteropDisabled = false; + mCudaDisabled = false; + mDeferredDisabled = false; + + /* Register this module's authorable object types and create their namespaces */ + const char* pName = IofxAssetParameters::staticClassName(); + IofxAO* AO = PX_NEW(IofxAO)(this, mAuthorableObjects, pName); + IofxAssetImpl::mAssetTypeID = AO->getResID(); + + /* Register the NvParameterized factories */ + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + ModuleIofxRegistration::invokeRegistration(traits); +} + +AuthObjTypeID ModuleIofxImpl::getModuleID() const +{ + READ_ZONE(); + return IofxAssetImpl::mAssetTypeID; +} + +ModuleIofxImpl::~ModuleIofxImpl() +{ +} + +void ModuleIofxImpl::destroy() +{ + /* Remove the NvParameterized factories */ + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + + if (mModuleParams) + { + mModuleParams->destroy(); + mModuleParams = NULL; + } + + ModuleBase::destroy(); + + if (traits) + { + ModuleIofxRegistration::invokeUnregistration(traits); + } + delete this; +} + +NvParameterized::Interface* ModuleIofxImpl::getDefaultModuleDesc() +{ + READ_ZONE(); + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + + if (!mModuleParams) + { + mModuleParams = DYNAMIC_CAST(IofxModuleParameters*) + (traits->createNvParameterized("IofxModuleParameters")); + PX_ASSERT(mModuleParams); + } + else + { + mModuleParams->initDefaults(); + } + + return mModuleParams; +} + +void ModuleIofxImpl::init(const ModuleIofxDesc&) +{ + WRITE_ZONE(); +} + +uint32_t ModuleIofxImpl::forceLoadAssets() +{ + uint32_t loadedAssetCount = 0; + + for (uint32_t i = 0; i < mAuthorableObjects.getSize(); i++) + { + AuthorableObjectIntl* ao = static_cast<AuthorableObjectIntl*>(mAuthorableObjects.getResource(i)); + loadedAssetCount += ao->forceLoadAssets(); + } + return loadedAssetCount; +} + +ModuleSceneIntl* ModuleIofxImpl::createInternalModuleScene(SceneIntl& scene, RenderDebugInterface* debugRender) +{ + IofxScene* res = NULL; +#if APEX_CUDA_SUPPORT + PxGpuDispatcher* gd; + { + READ_LOCK(scene); + gd = scene.getTaskManager()->getGpuDispatcher(); + } + + if (gd && gd->getCudaContextManager()->contextIsValid()) + { + res = PX_NEW(IofxSceneGPU)(*this, scene, debugRender, mIofxScenes); + } + else +#endif + { + res = PX_NEW(IofxSceneCPU)(*this, scene, debugRender, mIofxScenes); + } + return res; +} + +void ModuleIofxImpl::releaseModuleSceneIntl(ModuleSceneIntl& scene) +{ + IofxScene* is = DYNAMIC_CAST(IofxScene*)(&scene); + is->destroy(); +} + +IofxScene* ModuleIofxImpl::getIofxScene(const Scene& apexScene) +{ + for (uint32_t i = 0 ; i < mIofxScenes.getSize() ; i++) + { + IofxScene* is = DYNAMIC_CAST(IofxScene*)(mIofxScenes.getResource(i)); + if (is->mApexScene == &apexScene) + { + return is; + } + } + + PX_ASSERT(!"Unable to locate an appropriate IofxScene"); + return NULL; +} + +const IofxScene* ModuleIofxImpl::getIofxScene(const Scene& apexScene) const +{ + for (uint32_t i = 0 ; i < mIofxScenes.getSize() ; i++) + { + IofxScene* is = DYNAMIC_CAST(IofxScene*)(mIofxScenes.getResource(i)); + if (is->mApexScene == &apexScene) + { + return is; + } + } + + PX_ASSERT(!"Unable to locate an appropriate IofxScene"); + return NULL; +} + +RenderVolume* ModuleIofxImpl::createRenderVolume(const Scene& apexScene, const PxBounds3& b, uint32_t priority, bool allIofx) +{ + WRITE_ZONE(); + IofxScene* is = getIofxScene(apexScene); + if (is) + { + return PX_NEW(RenderVolumeImpl)(*is, b, priority, allIofx); + } + + return NULL; +} + +void ModuleIofxImpl::releaseRenderVolume(RenderVolume& volume) +{ + WRITE_ZONE(); + RenderVolumeImpl* arv = DYNAMIC_CAST(RenderVolumeImpl*)(&volume); + arv->destroy(); +} + + +IofxManagerIntl* ModuleIofxImpl::createActorManager(const Scene& scene, const IofxAsset& asset, const IofxManagerDescIntl& desc) +{ + WRITE_ZONE(); + IofxScene* is = getIofxScene(scene); + return is ? is->createIofxManager(asset, desc) : NULL; +} + +const TestBase* ModuleIofxImpl::getTestBase(Scene* apexScene) const +{ +#if ENABLE_TEST + const IofxScene* scene = getIofxScene(*apexScene); + return static_cast<const TestBase*>(DYNAMIC_CAST(const IofxTestScene*)(scene)); +#else + PX_UNUSED(apexScene); + return 0; +#endif +} + +bool ModuleIofxImpl::setIofxRenderCallback(const Scene& apexScene, IofxRenderCallback* callback) +{ + WRITE_ZONE(); + IofxScene* is = getIofxScene(apexScene); + if (is) + { + is->setIofxRenderCallback(callback); + return true; + } + return false; +} + +IofxRenderCallback* ModuleIofxImpl::getIofxRenderCallback(const Scene& apexScene) const +{ + READ_ZONE(); + const IofxScene* is = getIofxScene(apexScene); + if (is) + { + return is->getIofxRenderCallback(); + } + return NULL; +} + +IofxRenderableIterator* ModuleIofxImpl::createIofxRenderableIterator(const Scene& apexScene) +{ + WRITE_ZONE(); + IofxScene* is = getIofxScene(apexScene); + if (is) + { + return is->createIofxRenderableIterator(); + } + + return NULL; +} + +void ModuleIofxImpl::prepareRenderables(const Scene& apexScene) +{ + WRITE_ZONE(); + URR_SCOPE; + IofxScene* is = getIofxScene(apexScene); + if (is) + { + is->prepareRenderables(); + } +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/RenderVolumeImpl.cpp b/APEX_1.4/module/iofx/src/RenderVolumeImpl.cpp new file mode 100644 index 00000000..4138d30e --- /dev/null +++ b/APEX_1.4/module/iofx/src/RenderVolumeImpl.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, 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. + */ + + +#include "Apex.h" + +#include "RenderVolumeImpl.h" +#include "ModuleIofxImpl.h" +#include "IofxAssetImpl.h" +#include "IofxActorImpl.h" +#include "IofxScene.h" +#include "SceneIntl.h" + +#include "PsArray.h" + +namespace nvidia +{ +namespace iofx +{ + +RenderVolumeImpl::RenderVolumeImpl(IofxScene& scene, const PxBounds3& b, uint32_t priority, bool allIofx) + : mPriority(priority) + , mAllIofx(allIofx) + , mPendingDelete(false) + , mScene(scene) +{ + setOwnershipBounds(b); + + mScene.mAddedRenderVolumesLock.lock(); + mScene.mAddedRenderVolumes.pushBack(this); + mScene.mAddedRenderVolumesLock.unlock(); +} + +RenderVolumeImpl::~RenderVolumeImpl() +{ + mLock.lockWriter(); + while (mIofxActors.size()) + { + IofxActor* iofx = mIofxActors.popBack(); + iofx->release(); + } + mLock.unlockWriter(); +} + +void RenderVolumeImpl::destroy() +{ + if (!mPendingDelete) + { + mPendingDelete = true; + + mScene.mDeletedRenderVolumesLock.lock(); + mScene.mDeletedRenderVolumes.pushBack(this); + mScene.mDeletedRenderVolumesLock.unlock(); + } +} + +void RenderVolumeImpl::release() +{ + if (!mPendingDelete) + { + mScene.mModule->releaseRenderVolume(*this); + } +} + +bool RenderVolumeImpl::addIofxAsset(IofxAsset& iofx) +{ + WRITE_ZONE(); + if (mAllIofx || mPendingDelete) + { + return false; + } + + mLock.lockWriter(); + mIofxAssets.pushBack(&iofx); + mLock.unlockWriter(); + return true; +} + +bool RenderVolumeImpl::addIofxActor(IofxActor& iofx) +{ + if (mPendingDelete) + { + return false; + } + + mLock.lockWriter(); + mIofxActors.pushBack(&iofx); + mLock.unlockWriter(); + return true; +} + +bool RenderVolumeImpl::removeIofxActor(const IofxActor& iofx) +{ + bool res = false; + mLock.lockWriter(); + for (uint32_t i = 0 ; i < mIofxActors.size() ; i++) + { + if (mIofxActors[ i ] == &iofx) + { + mIofxActors.replaceWithLast(i); + res = true; + break; + } + } + mLock.unlockWriter(); + return res; +} + +void RenderVolumeImpl::setPosition(const PxVec3& pos) +{ + WRITE_ZONE(); + PxVec3 ext = mOwnershipBounds.getExtents(); + mOwnershipBounds = physx::PxBounds3(pos - ext, pos + ext); +} + +PxBounds3 RenderVolumeImpl::getBounds() const +{ + READ_ZONE(); + if (mPendingDelete) + { + return PxBounds3::empty(); + } + + PxBounds3 b = PxBounds3::empty(); + nvidia::Array<IofxActor*>::ConstIterator i; + for (i = mIofxActors.begin() ; i != mIofxActors.end() ; i++) + { + b.include((*i)->getBounds()); + } + + return b; +} + +// Callers must acquire render lock for thread safety +bool RenderVolumeImpl::affectsIofxAsset(const IofxAsset& iofx) const +{ + READ_ZONE(); + if (mPendingDelete) + { + return false; + } + + if (mAllIofx) + { + return true; + } + + nvidia::Array<IofxAsset*>::ConstIterator i; + for (i = mIofxAssets.begin() ; i != mIofxAssets.end() ; i++) + { + if (&iofx == *i) + { + return true; + } + } + + return false; +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsDensityCompositeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsDensityCompositeModifierParams.cpp new file mode 100644 index 00000000..aa12bd3b --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsDensityCompositeModifierParams.cpp @@ -0,0 +1,459 @@ +// 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 "ColorVsDensityCompositeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsDensityCompositeModifierParamsNS; + +const char* const ColorVsDensityCompositeModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsDensityCompositeModifierParams, ColorVsDensityCompositeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(colorDensityStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((colorDensityStruct_Type*)0)->density), NULL, 0 }, // controlPoints[].density + { TYPE_VEC4, false, (size_t)(&((colorDensityStruct_Type*)0)->color), NULL, 0 }, // controlPoints[].color +}; + + +bool ColorVsDensityCompositeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsDensityCompositeModifierParams::mBuiltFlagMutex; + +ColorVsDensityCompositeModifierParams::ColorVsDensityCompositeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsDensityCompositeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsDensityCompositeModifierParams::~ColorVsDensityCompositeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsDensityCompositeModifierParams::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->~ColorVsDensityCompositeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsDensityCompositeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsDensityCompositeModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsDensityCompositeModifierParams* tmpParam = const_cast<ColorVsDensityCompositeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsDensityCompositeModifierParams::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 ColorVsDensityCompositeModifierParams::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 ColorVsDensityCompositeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsDensityCompositeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsDensityCompositeModifierParams::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 ColorVsDensityCompositeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsDensityComposite modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "colorDensityStruct", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].density" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("density", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Density", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("color", TYPE_VEC4, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(16), true); + HintTable[2].init("min", uint64_t(0), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(16), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Color is formatted x=R, y=G, z=B, w=A", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsDensityCompositeModifierParams::initStrings(void) +{ +} + +void ColorVsDensityCompositeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(colorDensityStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsDensityCompositeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsDensityCompositeModifierParams::initReferences(void) +{ +} + +void ColorVsDensityCompositeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsDensityCompositeModifierParams::freeStrings(void) +{ +} + +void ColorVsDensityCompositeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsDensityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsDensityModifierParams.cpp new file mode 100644 index 00000000..168f45c0 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsDensityModifierParams.cpp @@ -0,0 +1,478 @@ +// 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 "ColorVsDensityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsDensityModifierParamsNS; + +const char* const ColorVsDensityModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsDensityModifierParams, ColorVsDensityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->colorChannel), NULL, 0 }, // colorChannel + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ColorVsDensityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsDensityModifierParams::mBuiltFlagMutex; + +ColorVsDensityModifierParams::ColorVsDensityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsDensityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsDensityModifierParams::~ColorVsDensityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsDensityModifierParams::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->~ColorVsDensityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsDensityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsDensityModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsDensityModifierParams* tmpParam = const_cast<ColorVsDensityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsDensityModifierParams::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 ColorVsDensityModifierParams::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 ColorVsDensityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsDensityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsDensityModifierParams::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 ColorVsDensityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsDensity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="colorChannel" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("colorChannel", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "alpha", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "alpha", true); + HintTable[1].init("shortDescription", "Color channel", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "red", "green", "blue", "alpha" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 4); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#else + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[5].init("shortDescription", "Control points for a curve", true); + HintTable[6].init("xAxisLabel", "Density", true); + HintTable[7].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#else + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[5].init("shortDescription", "Control points for a curve", true); + HintTable[6].init("xAxisLabel", "Density", true); + HintTable[7].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Density", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Color", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsDensityModifierParams::initStrings(void) +{ +} + +void ColorVsDensityModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsDensityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + colorChannel = (const char*)"alpha"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsDensityModifierParams::initReferences(void) +{ +} + +void ColorVsDensityModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsDensityModifierParams::freeStrings(void) +{ +} + +void ColorVsDensityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsLifeCompositeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsLifeCompositeModifierParams.cpp new file mode 100644 index 00000000..fbd9c761 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsLifeCompositeModifierParams.cpp @@ -0,0 +1,471 @@ +// 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 "ColorVsLifeCompositeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsLifeCompositeModifierParamsNS; + +const char* const ColorVsLifeCompositeModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsLifeCompositeModifierParams, ColorVsLifeCompositeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(colorLifeStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((colorLifeStruct_Type*)0)->lifeRemaining), NULL, 0 }, // controlPoints[].lifeRemaining + { TYPE_VEC4, false, (size_t)(&((colorLifeStruct_Type*)0)->color), NULL, 0 }, // controlPoints[].color +}; + + +bool ColorVsLifeCompositeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsLifeCompositeModifierParams::mBuiltFlagMutex; + +ColorVsLifeCompositeModifierParams::ColorVsLifeCompositeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsLifeCompositeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsLifeCompositeModifierParams::~ColorVsLifeCompositeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsLifeCompositeModifierParams::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->~ColorVsLifeCompositeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsLifeCompositeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsLifeCompositeModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsLifeCompositeModifierParams* tmpParam = const_cast<ColorVsLifeCompositeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsLifeCompositeModifierParams::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 ColorVsLifeCompositeModifierParams::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 ColorVsLifeCompositeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsLifeCompositeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsLifeCompositeModifierParams::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 ColorVsLifeCompositeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsLifeComposite modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs life curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "colorLifeStruct", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs life curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].lifeRemaining" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("lifeRemaining", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life remaining", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("color", TYPE_VEC4, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max_w", uint64_t(8), true); + HintTable[2].init("max_x", uint64_t(8), true); + HintTable[3].init("max_y", uint64_t(8), true); + HintTable[4].init("min_w", uint64_t(0), true); + HintTable[5].init("min_x", uint64_t(0), true); + HintTable[6].init("min_y", uint64_t(0), true); + HintTable[7].init("min_z", uint64_t(0), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#else + + static HintImpl HintTable[9]; + static Hint* HintPtrTable[9] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], &HintTable[8], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max_w", uint64_t(8), true); + HintTable[2].init("max_x", uint64_t(8), true); + HintTable[3].init("max_y", uint64_t(8), true); + HintTable[4].init("min_w", uint64_t(0), true); + HintTable[5].init("min_x", uint64_t(0), true); + HintTable[6].init("min_y", uint64_t(0), true); + HintTable[7].init("min_z", uint64_t(0), true); + HintTable[8].init("shortDescription", "Color is formatted x=R, y=G, z=B, w=A", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 9); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsLifeCompositeModifierParams::initStrings(void) +{ +} + +void ColorVsLifeCompositeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(colorLifeStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsLifeCompositeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsLifeCompositeModifierParams::initReferences(void) +{ +} + +void ColorVsLifeCompositeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsLifeCompositeModifierParams::freeStrings(void) +{ +} + +void ColorVsLifeCompositeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsLifeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsLifeModifierParams.cpp new file mode 100644 index 00000000..801c5209 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsLifeModifierParams.cpp @@ -0,0 +1,474 @@ +// 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 "ColorVsLifeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsLifeModifierParamsNS; + +const char* const ColorVsLifeModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsLifeModifierParams, ColorVsLifeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->colorChannel), NULL, 0 }, // colorChannel + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ColorVsLifeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsLifeModifierParams::mBuiltFlagMutex; + +ColorVsLifeModifierParams::ColorVsLifeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsLifeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsLifeModifierParams::~ColorVsLifeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsLifeModifierParams::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->~ColorVsLifeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsLifeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsLifeModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsLifeModifierParams* tmpParam = const_cast<ColorVsLifeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsLifeModifierParams::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 ColorVsLifeModifierParams::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 ColorVsLifeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsLifeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsLifeModifierParams::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 ColorVsLifeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsLife modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="colorChannel" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("colorChannel", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "alpha", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "alpha", true); + HintTable[1].init("shortDescription", "Color channel", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "red", "green", "blue", "alpha" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 4); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Life Time", true); + HintTable[2].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Life Time", true); + HintTable[2].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Color", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsLifeModifierParams::initStrings(void) +{ +} + +void ColorVsLifeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsLifeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + colorChannel = (const char*)"alpha"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsLifeModifierParams::initReferences(void) +{ +} + +void ColorVsLifeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsLifeModifierParams::freeStrings(void) +{ +} + +void ColorVsLifeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureCompositeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureCompositeModifierParams.cpp new file mode 100644 index 00000000..388930f9 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureCompositeModifierParams.cpp @@ -0,0 +1,455 @@ +// 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 "ColorVsTemperatureCompositeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsTemperatureCompositeModifierParamsNS; + +const char* const ColorVsTemperatureCompositeModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsTemperatureCompositeModifierParams, ColorVsTemperatureCompositeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(colorTemperatureStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((colorTemperatureStruct_Type*)0)->temperature), NULL, 0 }, // controlPoints[].temperature + { TYPE_VEC4, false, (size_t)(&((colorTemperatureStruct_Type*)0)->color), NULL, 0 }, // controlPoints[].color +}; + + +bool ColorVsTemperatureCompositeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsTemperatureCompositeModifierParams::mBuiltFlagMutex; + +ColorVsTemperatureCompositeModifierParams::ColorVsTemperatureCompositeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsTemperatureCompositeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsTemperatureCompositeModifierParams::~ColorVsTemperatureCompositeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsTemperatureCompositeModifierParams::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->~ColorVsTemperatureCompositeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsTemperatureCompositeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsTemperatureCompositeModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsTemperatureCompositeModifierParams* tmpParam = const_cast<ColorVsTemperatureCompositeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsTemperatureCompositeModifierParams::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 ColorVsTemperatureCompositeModifierParams::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 ColorVsTemperatureCompositeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsTemperatureCompositeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsTemperatureCompositeModifierParams::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 ColorVsTemperatureCompositeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsTemperatureComposite modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite color vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "colorTemperatureStruct", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite color vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].temperature" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("temperature", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Temperature", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("color", TYPE_VEC4, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(16), true); + HintTable[2].init("min", uint64_t(0), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(16), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Color is formatted x=R, y=G, z=B, w=A", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsTemperatureCompositeModifierParams::initStrings(void) +{ +} + +void ColorVsTemperatureCompositeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(colorTemperatureStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsTemperatureCompositeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsTemperatureCompositeModifierParams::initReferences(void) +{ +} + +void ColorVsTemperatureCompositeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsTemperatureCompositeModifierParams::freeStrings(void) +{ +} + +void ColorVsTemperatureCompositeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureModifierParams.cpp new file mode 100644 index 00000000..3efec478 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsTemperatureModifierParams.cpp @@ -0,0 +1,478 @@ +// 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 "ColorVsTemperatureModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsTemperatureModifierParamsNS; + +const char* const ColorVsTemperatureModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsTemperatureModifierParams, ColorVsTemperatureModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->colorChannel), NULL, 0 }, // colorChannel + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ColorVsTemperatureModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsTemperatureModifierParams::mBuiltFlagMutex; + +ColorVsTemperatureModifierParams::ColorVsTemperatureModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsTemperatureModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsTemperatureModifierParams::~ColorVsTemperatureModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsTemperatureModifierParams::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->~ColorVsTemperatureModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsTemperatureModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsTemperatureModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsTemperatureModifierParams* tmpParam = const_cast<ColorVsTemperatureModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsTemperatureModifierParams::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 ColorVsTemperatureModifierParams::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 ColorVsTemperatureModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsTemperatureModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsTemperatureModifierParams::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 ColorVsTemperatureModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsTemperature modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="colorChannel" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("colorChannel", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "alpha", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "alpha", true); + HintTable[1].init("shortDescription", "Color channel", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "red", "green", "blue", "alpha" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 4); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#else + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[5].init("shortDescription", "Control points for a curve", true); + HintTable[6].init("xAxisLabel", "Temperature", true); + HintTable[7].init("yAxisLabel", "Color", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#else + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[5].init("shortDescription", "Control points for a curve", true); + HintTable[6].init("xAxisLabel", "Temperature", true); + HintTable[7].init("yAxisLabel", "Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Temperature", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Color", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsTemperatureModifierParams::initStrings(void) +{ +} + +void ColorVsTemperatureModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsTemperatureModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + colorChannel = (const char*)"alpha"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsTemperatureModifierParams::initReferences(void) +{ +} + +void ColorVsTemperatureModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsTemperatureModifierParams::freeStrings(void) +{ +} + +void ColorVsTemperatureModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityCompositeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityCompositeModifierParams.cpp new file mode 100644 index 00000000..9745d6dc --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityCompositeModifierParams.cpp @@ -0,0 +1,533 @@ +// 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 "ColorVsVelocityCompositeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsVelocityCompositeModifierParamsNS; + +const char* const ColorVsVelocityCompositeModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsVelocityCompositeModifierParams, ColorVsVelocityCompositeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 7; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 3 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->velocity0), NULL, 0 }, // velocity0 + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->velocity1), NULL, 0 }, // velocity1 + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(3), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(colorVelocityStruct_Type), CHILDREN(4), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((colorVelocityStruct_Type*)0)->velocity), NULL, 0 }, // controlPoints[].velocity + { TYPE_VEC4, false, (size_t)(&((colorVelocityStruct_Type*)0)->color), NULL, 0 }, // controlPoints[].color +}; + + +bool ColorVsVelocityCompositeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsVelocityCompositeModifierParams::mBuiltFlagMutex; + +ColorVsVelocityCompositeModifierParams::ColorVsVelocityCompositeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsVelocityCompositeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsVelocityCompositeModifierParams::~ColorVsVelocityCompositeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsVelocityCompositeModifierParams::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->~ColorVsVelocityCompositeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsVelocityCompositeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsVelocityCompositeModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsVelocityCompositeModifierParams* tmpParam = const_cast<ColorVsVelocityCompositeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsVelocityCompositeModifierParams::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 ColorVsVelocityCompositeModifierParams::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 ColorVsVelocityCompositeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsVelocityCompositeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsVelocityCompositeModifierParams::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 ColorVsVelocityCompositeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsVelocityComposite modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="velocity0" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("velocity0", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("gameScale", "true", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("gameScale", "true", true); + HintTable[1].init("shortDescription", "First velocity point", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="velocity1" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("velocity1", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("gameScale", "true", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("gameScale", "true", true); + HintTable[1].init("shortDescription", "Second velocity point", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Velocity", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs velocity curve", true); + HintTable[5].init("xAxisLabel", "Velocity", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("controlPoints", TYPE_STRUCT, "colorVelocityStruct", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Velocity", true); + HintTable[5].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(2), true); + HintTable[2].init("ColorWheel", "true", true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite color vs velocity curve", true); + HintTable[5].init("xAxisLabel", "Velocity", true); + HintTable[6].init("yAxisLabel", "Alpha + Color", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].velocity" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("velocity", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Velocity", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="controlPoints[].color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("color", TYPE_VEC4, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max_w", uint64_t(8), true); + HintTable[2].init("max_x", uint64_t(8), true); + HintTable[3].init("max_y", uint64_t(8), true); + HintTable[4].init("min_w", uint64_t(0), true); + HintTable[5].init("min_x", uint64_t(0), true); + HintTable[6].init("min_y", uint64_t(0), true); + HintTable[7].init("min_z", uint64_t(0), true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#else + + static HintImpl HintTable[9]; + static Hint* HintPtrTable[9] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], &HintTable[8], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max_w", uint64_t(8), true); + HintTable[2].init("max_x", uint64_t(8), true); + HintTable[3].init("max_y", uint64_t(8), true); + HintTable[4].init("min_w", uint64_t(0), true); + HintTable[5].init("min_x", uint64_t(0), true); + HintTable[6].init("min_y", uint64_t(0), true); + HintTable[7].init("min_z", uint64_t(0), true); + HintTable[8].init("shortDescription", "Color is formatted x=R, y=G, z=B, w=A", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 9); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[3]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(3); + + ParamDefTable[0].setChildren(Children, 3); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(4); + + ParamDefTable[3].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=4, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(5); + Children[1] = PDEF_PTR(6); + + ParamDefTable[4].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsVelocityCompositeModifierParams::initStrings(void) +{ +} + +void ColorVsVelocityCompositeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(colorVelocityStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsVelocityCompositeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + velocity0 = float(0); + velocity1 = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsVelocityCompositeModifierParams::initReferences(void) +{ +} + +void ColorVsVelocityCompositeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsVelocityCompositeModifierParams::freeStrings(void) +{ +} + +void ColorVsVelocityCompositeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityModifierParams.cpp new file mode 100644 index 00000000..5b593de8 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ColorVsVelocityModifierParams.cpp @@ -0,0 +1,524 @@ +// 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 "ColorVsVelocityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ColorVsVelocityModifierParamsNS; + +const char* const ColorVsVelocityModifierParamsFactory::vptr = + NvParameterized::getVptr<ColorVsVelocityModifierParams, ColorVsVelocityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 8; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 4 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->colorChannel), NULL, 0 }, // colorChannel + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->velocity0), NULL, 0 }, // velocity0 + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->velocity1), NULL, 0 }, // velocity1 + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(4), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(5), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ColorVsVelocityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ColorVsVelocityModifierParams::mBuiltFlagMutex; + +ColorVsVelocityModifierParams::ColorVsVelocityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ColorVsVelocityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ColorVsVelocityModifierParams::~ColorVsVelocityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ColorVsVelocityModifierParams::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->~ColorVsVelocityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ColorVsVelocityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ColorVsVelocityModifierParams::getParameterDefinitionTree(void) const +{ + ColorVsVelocityModifierParams* tmpParam = const_cast<ColorVsVelocityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ColorVsVelocityModifierParams::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 ColorVsVelocityModifierParams::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 ColorVsVelocityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ColorVsVelocityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ColorVsVelocityModifierParams::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 ColorVsVelocityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ColorVsVelocity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="colorChannel" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("colorChannel", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "alpha", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "alpha", true); + HintTable[1].init("shortDescription", "Color channel", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "red", "green", "blue", "alpha" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 4); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="velocity0" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("velocity0", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Helpful documentation goes here", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="velocity1" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("velocity1", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Helpful documentation goes here", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Velocity", true); + HintTable[2].init("yAxisLabel", "Color", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Velocity", true); + HintTable[4].init("yAxisLabel", "Color", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Velocity", true); + HintTable[2].init("yAxisLabel", "Color", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Velocity", true); + HintTable[4].init("yAxisLabel", "Color", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Velocity", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Color", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[4]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(3); + Children[3] = PDEF_PTR(4); + + ParamDefTable[0].setChildren(Children, 4); + } + + // SetChildren for: nodeIndex=4, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(5); + + ParamDefTable[4].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=5, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(6); + Children[1] = PDEF_PTR(7); + + ParamDefTable[5].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ColorVsVelocityModifierParams::initStrings(void) +{ +} + +void ColorVsVelocityModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ColorVsVelocityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + colorChannel = (const char*)"alpha"; + velocity0 = float(0); + velocity1 = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ColorVsVelocityModifierParams::initReferences(void) +{ +} + +void ColorVsVelocityModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ColorVsVelocityModifierParams::freeStrings(void) +{ +} + +void ColorVsVelocityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/InitialColorModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/InitialColorModifierParams.cpp new file mode 100644 index 00000000..58ca122d --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/InitialColorModifierParams.cpp @@ -0,0 +1,328 @@ +// 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 "InitialColorModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace InitialColorModifierParamsNS; + +const char* const InitialColorModifierParamsFactory::vptr = + NvParameterized::getVptr<InitialColorModifierParams, InitialColorModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_VEC4, false, (size_t)(&((ParametersStruct*)0)->color), NULL, 0 }, // color +}; + + +bool InitialColorModifierParams::mBuiltFlag = false; +NvParameterized::MutexType InitialColorModifierParams::mBuiltFlagMutex; + +InitialColorModifierParams::InitialColorModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &InitialColorModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +InitialColorModifierParams::~InitialColorModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void InitialColorModifierParams::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->~InitialColorModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* InitialColorModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* InitialColorModifierParams::getParameterDefinitionTree(void) const +{ + InitialColorModifierParams* tmpParam = const_cast<InitialColorModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType InitialColorModifierParams::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 InitialColorModifierParams::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 InitialColorModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<InitialColorModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void InitialColorModifierParams::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 InitialColorModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "InitialColor modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("color", TYPE_VEC4, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(1), true); + HintTable[2].init("min", uint64_t(0), true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("COLOR", uint64_t(1), true); + HintTable[1].init("max", uint64_t(1), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Color is formatted x=R, y=G, z=B, w=A", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void InitialColorModifierParams::initStrings(void) +{ +} + +void InitialColorModifierParams::initDynamicArrays(void) +{ +} + +void InitialColorModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + color = physx::PxVec4(initVec4(1, 1, 1, 1)); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void InitialColorModifierParams::initReferences(void) +{ +} + +void InitialColorModifierParams::freeDynamicArrays(void) +{ +} + +void InitialColorModifierParams::freeStrings(void) +{ +} + +void InitialColorModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/IofxAssetParameters.cpp b/APEX_1.4/module/iofx/src/autogen/IofxAssetParameters.cpp new file mode 100644 index 00000000..5d29be2d --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/IofxAssetParameters.cpp @@ -0,0 +1,425 @@ +// 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 "IofxAssetParameters.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace IofxAssetParametersNS; + +const char* const IofxAssetParametersFactory::vptr = + NvParameterized::getVptr<IofxAssetParameters, IofxAssetParameters::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_REF, false, (size_t)(&((ParametersStruct*)0)->iofxType), NULL, 0 }, // iofxType + { TYPE_STRUCT, false, (size_t)(&((ParametersStruct*)0)->renderOutput), CHILDREN(2), 2 }, // renderOutput + { TYPE_BOOL, false, (size_t)(&((outputProperties_Type*)0)->useUserSemantic), NULL, 0 }, // renderOutput.useUserSemantic + { TYPE_BOOL, false, (size_t)(&((outputProperties_Type*)0)->useFloat4Color), NULL, 0 }, // renderOutput.useFloat4Color +}; + + +bool IofxAssetParameters::mBuiltFlag = false; +NvParameterized::MutexType IofxAssetParameters::mBuiltFlagMutex; + +IofxAssetParameters::IofxAssetParameters(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &IofxAssetParametersFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +IofxAssetParameters::~IofxAssetParameters() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void IofxAssetParameters::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->~IofxAssetParameters(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* IofxAssetParameters::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* IofxAssetParameters::getParameterDefinitionTree(void) const +{ + IofxAssetParameters* tmpParam = const_cast<IofxAssetParameters*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType IofxAssetParameters::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 IofxAssetParameters::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 IofxAssetParameters::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<IofxAssetParameters::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void IofxAssetParameters::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 IofxAssetParameters::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Contains the asset properties for an IOFX", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="iofxType" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("iofxType", 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[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("INCLUDED", uint64_t(1), true); + HintTable[1].init("shortDescription", "Contains the mesh or sprite IOFX parameters, only one may be selected", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "MeshIofxParameters", "SpriteIofxParameters" }; + ParamDefTable[1].setRefVariantVals((const char**)RefVariantVals, 2); + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="renderOutput" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("renderOutput", TYPE_STRUCT, "outputProperties", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("HIDDEN", uint64_t(1), true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("HIDDEN", uint64_t(1), true); + HintTable[1].init("shortDescription", "render output properties", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="renderOutput.useUserSemantic" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("useUserSemantic", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "use user semantic in render output", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="renderOutput.useFloat4Color" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("useFloat4Color", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("HIDDEN", 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("HIDDEN", uint64_t(1), true); + HintTable[1].init("shortDescription", "use float4 color in render output", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="renderOutput" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void IofxAssetParameters::initStrings(void) +{ +} + +void IofxAssetParameters::initDynamicArrays(void) +{ +} + +void IofxAssetParameters::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + renderOutput.useUserSemantic = bool(false); + renderOutput.useFloat4Color = bool(false); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void IofxAssetParameters::initReferences(void) +{ + iofxType = NULL; + +} + +void IofxAssetParameters::freeDynamicArrays(void) +{ +} + +void IofxAssetParameters::freeStrings(void) +{ +} + +void IofxAssetParameters::freeReferences(void) +{ + if (iofxType) + { + iofxType->destroy(); + } + +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/IofxDebugRenderParams.cpp b/APEX_1.4/module/iofx/src/autogen/IofxDebugRenderParams.cpp new file mode 100644 index 00000000..73271f70 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/IofxDebugRenderParams.cpp @@ -0,0 +1,358 @@ +// 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 "IofxDebugRenderParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace IofxDebugRenderParamsNS; + +const char* const IofxDebugRenderParamsFactory::vptr = + NvParameterized::getVptr<IofxDebugRenderParams, IofxDebugRenderParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 4; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 3 }, + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_IOFX_ACTOR), NULL, 0 }, // VISUALIZE_IOFX_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_IOFX_BOUNDING_BOX), NULL, 0 }, // VISUALIZE_IOFX_BOUNDING_BOX + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_IOFX_ACTOR_NAME), NULL, 0 }, // VISUALIZE_IOFX_ACTOR_NAME +}; + + +bool IofxDebugRenderParams::mBuiltFlag = false; +NvParameterized::MutexType IofxDebugRenderParams::mBuiltFlagMutex; + +IofxDebugRenderParams::IofxDebugRenderParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &IofxDebugRenderParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +IofxDebugRenderParams::~IofxDebugRenderParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void IofxDebugRenderParams::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->~IofxDebugRenderParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* IofxDebugRenderParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* IofxDebugRenderParams::getParameterDefinitionTree(void) const +{ + IofxDebugRenderParams* tmpParam = const_cast<IofxDebugRenderParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType IofxDebugRenderParams::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 IofxDebugRenderParams::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 IofxDebugRenderParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<IofxDebugRenderParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void IofxDebugRenderParams::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 IofxDebugRenderParams::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="VISUALIZE_IOFX_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("VISUALIZE_IOFX_ACTOR", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Render IOFX actor in view window", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="VISUALIZE_IOFX_BOUNDING_BOX" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("VISUALIZE_IOFX_BOUNDING_BOX", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Render IOFX bounding box in view window", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="VISUALIZE_IOFX_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("VISUALIZE_IOFX_ACTOR_NAME", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Render IOFX actor name in view window", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[3]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(3); + + ParamDefTable[0].setChildren(Children, 3); + } + + mBuiltFlag = true; + +} +void IofxDebugRenderParams::initStrings(void) +{ +} + +void IofxDebugRenderParams::initDynamicArrays(void) +{ +} + +void IofxDebugRenderParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + VISUALIZE_IOFX_ACTOR = bool(false); + VISUALIZE_IOFX_BOUNDING_BOX = bool(true); + VISUALIZE_IOFX_ACTOR_NAME = bool(true); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void IofxDebugRenderParams::initReferences(void) +{ +} + +void IofxDebugRenderParams::freeDynamicArrays(void) +{ +} + +void IofxDebugRenderParams::freeStrings(void) +{ +} + +void IofxDebugRenderParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/IofxModuleParameters.cpp b/APEX_1.4/module/iofx/src/autogen/IofxModuleParameters.cpp new file mode 100644 index 00000000..4bae7ae3 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/IofxModuleParameters.cpp @@ -0,0 +1,318 @@ +// 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 "IofxModuleParameters.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace IofxModuleParametersNS; + +const char* const IofxModuleParametersFactory::vptr = + NvParameterized::getVptr<IofxModuleParameters, IofxModuleParameters::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_U32, false, (size_t)(&((ParametersStruct*)0)->unused), NULL, 0 }, // unused +}; + + +bool IofxModuleParameters::mBuiltFlag = false; +NvParameterized::MutexType IofxModuleParameters::mBuiltFlagMutex; + +IofxModuleParameters::IofxModuleParameters(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &IofxModuleParametersFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +IofxModuleParameters::~IofxModuleParameters() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void IofxModuleParameters::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->~IofxModuleParameters(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* IofxModuleParameters::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* IofxModuleParameters::getParameterDefinitionTree(void) const +{ + IofxModuleParameters* tmpParam = const_cast<IofxModuleParameters*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType IofxModuleParameters::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 IofxModuleParameters::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 IofxModuleParameters::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<IofxModuleParameters::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void IofxModuleParameters::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 IofxModuleParameters::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "This class is used for initializing the ModuleIofx.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="unused" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("unused", TYPE_U32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "No parameters necessary", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void IofxModuleParameters::initStrings(void) +{ +} + +void IofxModuleParameters::initDynamicArrays(void) +{ +} + +void IofxModuleParameters::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + unused = uint32_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void IofxModuleParameters::initReferences(void) +{ +} + +void IofxModuleParameters::freeDynamicArrays(void) +{ +} + +void IofxModuleParameters::freeStrings(void) +{ +} + +void IofxModuleParameters::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/MeshIofxParameters.cpp b/APEX_1.4/module/iofx/src/autogen/MeshIofxParameters.cpp new file mode 100644 index 00000000..05fd8458 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/MeshIofxParameters.cpp @@ -0,0 +1,623 @@ +// 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 <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace MeshIofxParametersNS; + +const char* const MeshIofxParametersFactory::vptr = + NvParameterized::getVptr<MeshIofxParameters, MeshIofxParameters::ClassAlignment>(); + +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<MeshIofxParameters*>(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<MeshIofxParameters::ParametersStruct*>(¶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 diff --git a/APEX_1.4/module/iofx/src/autogen/OrientAlongVelocityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/OrientAlongVelocityModifierParams.cpp new file mode 100644 index 00000000..e2e456b5 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/OrientAlongVelocityModifierParams.cpp @@ -0,0 +1,318 @@ +// 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 "OrientAlongVelocityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace OrientAlongVelocityModifierParamsNS; + +const char* const OrientAlongVelocityModifierParamsFactory::vptr = + NvParameterized::getVptr<OrientAlongVelocityModifierParams, OrientAlongVelocityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->modelForward), NULL, 0 }, // modelForward +}; + + +bool OrientAlongVelocityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType OrientAlongVelocityModifierParams::mBuiltFlagMutex; + +OrientAlongVelocityModifierParams::OrientAlongVelocityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &OrientAlongVelocityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +OrientAlongVelocityModifierParams::~OrientAlongVelocityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void OrientAlongVelocityModifierParams::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->~OrientAlongVelocityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* OrientAlongVelocityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* OrientAlongVelocityModifierParams::getParameterDefinitionTree(void) const +{ + OrientAlongVelocityModifierParams* tmpParam = const_cast<OrientAlongVelocityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType OrientAlongVelocityModifierParams::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 OrientAlongVelocityModifierParams::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 OrientAlongVelocityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<OrientAlongVelocityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void OrientAlongVelocityModifierParams::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 OrientAlongVelocityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "OrientAlongVelocity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="modelForward" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("modelForward", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Model forward", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void OrientAlongVelocityModifierParams::initStrings(void) +{ +} + +void OrientAlongVelocityModifierParams::initDynamicArrays(void) +{ +} + +void OrientAlongVelocityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + modelForward = physx::PxVec3(init(0, 1, 0)); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void OrientAlongVelocityModifierParams::initReferences(void) +{ +} + +void OrientAlongVelocityModifierParams::freeDynamicArrays(void) +{ +} + +void OrientAlongVelocityModifierParams::freeStrings(void) +{ +} + +void OrientAlongVelocityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/OrientScaleAlongScreenVelocityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/OrientScaleAlongScreenVelocityModifierParams.cpp new file mode 100644 index 00000000..e18ecf54 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/OrientScaleAlongScreenVelocityModifierParams.cpp @@ -0,0 +1,395 @@ +// 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 "OrientScaleAlongScreenVelocityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace OrientScaleAlongScreenVelocityModifierParamsNS; + +const char* const OrientScaleAlongScreenVelocityModifierParamsFactory::vptr = + NvParameterized::getVptr<OrientScaleAlongScreenVelocityModifierParams, OrientScaleAlongScreenVelocityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 4; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 3 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->scalePerVelocity), NULL, 0 }, // scalePerVelocity + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->scaleChangeLimit), NULL, 0 }, // scaleChangeLimit + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->scaleChangeDelay), NULL, 0 }, // scaleChangeDelay +}; + + +bool OrientScaleAlongScreenVelocityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType OrientScaleAlongScreenVelocityModifierParams::mBuiltFlagMutex; + +OrientScaleAlongScreenVelocityModifierParams::OrientScaleAlongScreenVelocityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &OrientScaleAlongScreenVelocityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +OrientScaleAlongScreenVelocityModifierParams::~OrientScaleAlongScreenVelocityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void OrientScaleAlongScreenVelocityModifierParams::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->~OrientScaleAlongScreenVelocityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* OrientScaleAlongScreenVelocityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* OrientScaleAlongScreenVelocityModifierParams::getParameterDefinitionTree(void) const +{ + OrientScaleAlongScreenVelocityModifierParams* tmpParam = const_cast<OrientScaleAlongScreenVelocityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType OrientScaleAlongScreenVelocityModifierParams::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 OrientScaleAlongScreenVelocityModifierParams::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 OrientScaleAlongScreenVelocityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<OrientScaleAlongScreenVelocityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void OrientScaleAlongScreenVelocityModifierParams::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 OrientScaleAlongScreenVelocityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "OrientScaleAlongScreenVelocity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scalePerVelocity" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scalePerVelocity", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("longDescription", "Scale(Velocity) = 1 + |Velocity| * scalePerVelocity", true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Scale per velocity", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="scaleChangeLimit" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("scaleChangeLimit", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("longDescription", "This value limits the scale change per unit time, set to 0 to disable the limit", true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Scale change limimt", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="scaleChangeDelay" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("scaleChangeDelay", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + HintTable[1].init("longDescription", "This value is proportional to a delay in time of the scale change, set to 0 to disable the delay", true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "Scale change delay", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[3]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(3); + + ParamDefTable[0].setChildren(Children, 3); + } + + mBuiltFlag = true; + +} +void OrientScaleAlongScreenVelocityModifierParams::initStrings(void) +{ +} + +void OrientScaleAlongScreenVelocityModifierParams::initDynamicArrays(void) +{ +} + +void OrientScaleAlongScreenVelocityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scalePerVelocity = float(0.0f); + scaleChangeLimit = float(0.0f); + scaleChangeDelay = float(0.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void OrientScaleAlongScreenVelocityModifierParams::initReferences(void) +{ +} + +void OrientScaleAlongScreenVelocityModifierParams::freeDynamicArrays(void) +{ +} + +void OrientScaleAlongScreenVelocityModifierParams::freeStrings(void) +{ +} + +void OrientScaleAlongScreenVelocityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RandomRotationModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RandomRotationModifierParams.cpp new file mode 100644 index 00000000..0f0fe9d5 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RandomRotationModifierParams.cpp @@ -0,0 +1,355 @@ +// 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 "RandomRotationModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RandomRotationModifierParamsNS; + +const char* const RandomRotationModifierParamsFactory::vptr = + NvParameterized::getVptr<RandomRotationModifierParams, RandomRotationModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 3; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->minRotation), NULL, 0 }, // minRotation + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->maxRotation), NULL, 0 }, // maxRotation +}; + + +bool RandomRotationModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RandomRotationModifierParams::mBuiltFlagMutex; + +RandomRotationModifierParams::RandomRotationModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RandomRotationModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RandomRotationModifierParams::~RandomRotationModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RandomRotationModifierParams::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->~RandomRotationModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RandomRotationModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RandomRotationModifierParams::getParameterDefinitionTree(void) const +{ + RandomRotationModifierParams* tmpParam = const_cast<RandomRotationModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RandomRotationModifierParams::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 RandomRotationModifierParams::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 RandomRotationModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RandomRotationModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RandomRotationModifierParams::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 RandomRotationModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "RandomRotation modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="minRotation" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("minRotation", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[1].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(0), true); + HintTable[1].init("shortDescription", "Minimum rotation in degrees", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="maxRotation" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("maxRotation", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[2].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(0), true); + HintTable[1].init("shortDescription", "Maximum rotation in degrees", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void RandomRotationModifierParams::initStrings(void) +{ +} + +void RandomRotationModifierParams::initDynamicArrays(void) +{ +} + +void RandomRotationModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + minRotation = float(0.0f); + maxRotation = float(0.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RandomRotationModifierParams::initReferences(void) +{ +} + +void RandomRotationModifierParams::freeDynamicArrays(void) +{ +} + +void RandomRotationModifierParams::freeStrings(void) +{ +} + +void RandomRotationModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RandomScaleModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RandomScaleModifierParams.cpp new file mode 100644 index 00000000..9403c5a3 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RandomScaleModifierParams.cpp @@ -0,0 +1,355 @@ +// 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 "RandomScaleModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RandomScaleModifierParamsNS; + +const char* const RandomScaleModifierParamsFactory::vptr = + NvParameterized::getVptr<RandomScaleModifierParams, RandomScaleModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 3; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->minScaleFactor), NULL, 0 }, // minScaleFactor + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->maxScaleFactor), NULL, 0 }, // maxScaleFactor +}; + + +bool RandomScaleModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RandomScaleModifierParams::mBuiltFlagMutex; + +RandomScaleModifierParams::RandomScaleModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RandomScaleModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RandomScaleModifierParams::~RandomScaleModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RandomScaleModifierParams::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->~RandomScaleModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RandomScaleModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RandomScaleModifierParams::getParameterDefinitionTree(void) const +{ + RandomScaleModifierParams* tmpParam = const_cast<RandomScaleModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RandomScaleModifierParams::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 RandomScaleModifierParams::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 RandomScaleModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RandomScaleModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RandomScaleModifierParams::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 RandomScaleModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "RandomScale modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="minScaleFactor" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("minScaleFactor", TYPE_F32, 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[1].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", "Scale factor", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="maxScaleFactor" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("maxScaleFactor", TYPE_F32, 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[2].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", "Scale factor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void RandomScaleModifierParams::initStrings(void) +{ +} + +void RandomScaleModifierParams::initDynamicArrays(void) +{ +} + +void RandomScaleModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + minScaleFactor = float(1.0f); + maxScaleFactor = float(1.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RandomScaleModifierParams::initReferences(void) +{ +} + +void RandomScaleModifierParams::freeDynamicArrays(void) +{ +} + +void RandomScaleModifierParams::freeStrings(void) +{ +} + +void RandomScaleModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RandomSubtextureModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RandomSubtextureModifierParams.cpp new file mode 100644 index 00000000..624d925b --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RandomSubtextureModifierParams.cpp @@ -0,0 +1,355 @@ +// 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 "RandomSubtextureModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RandomSubtextureModifierParamsNS; + +const char* const RandomSubtextureModifierParamsFactory::vptr = + NvParameterized::getVptr<RandomSubtextureModifierParams, RandomSubtextureModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 3; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->minSubtexture), NULL, 0 }, // minSubtexture + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->maxSubtexture), NULL, 0 }, // maxSubtexture +}; + + +bool RandomSubtextureModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RandomSubtextureModifierParams::mBuiltFlagMutex; + +RandomSubtextureModifierParams::RandomSubtextureModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RandomSubtextureModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RandomSubtextureModifierParams::~RandomSubtextureModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RandomSubtextureModifierParams::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->~RandomSubtextureModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RandomSubtextureModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RandomSubtextureModifierParams::getParameterDefinitionTree(void) const +{ + RandomSubtextureModifierParams* tmpParam = const_cast<RandomSubtextureModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RandomSubtextureModifierParams::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 RandomSubtextureModifierParams::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 RandomSubtextureModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RandomSubtextureModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RandomSubtextureModifierParams::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 RandomSubtextureModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "RandomSubtexture modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="minSubtexture" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("minSubtexture", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[1].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(0), true); + HintTable[1].init("shortDescription", "Minimum subtexture index", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="maxSubtexture" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("maxSubtexture", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[2].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(0), true); + HintTable[1].init("shortDescription", "Maximum subtexture index", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void RandomSubtextureModifierParams::initStrings(void) +{ +} + +void RandomSubtextureModifierParams::initDynamicArrays(void) +{ +} + +void RandomSubtextureModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + minSubtexture = float(0.0f); + maxSubtexture = float(0.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RandomSubtextureModifierParams::initReferences(void) +{ +} + +void RandomSubtextureModifierParams::freeDynamicArrays(void) +{ +} + +void RandomSubtextureModifierParams::freeStrings(void) +{ +} + +void RandomSubtextureModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RotationModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RotationModifierParams.cpp new file mode 100644 index 00000000..6c363524 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RotationModifierParams.cpp @@ -0,0 +1,481 @@ +// 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 "RotationModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RotationModifierParamsNS; + +const char* const RotationModifierParamsFactory::vptr = + NvParameterized::getVptr<RotationModifierParams, RotationModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 7; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 6 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->rollType), NULL, 0 }, // rollType + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->maxRotationRatePerSec), NULL, 0 }, // maxRotationRatePerSec + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->maxSettleRatePerSec), NULL, 0 }, // maxSettleRatePerSec + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->inAirRotationMultiplier), NULL, 0 }, // inAirRotationMultiplier + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->collisionRotationMultiplier), NULL, 0 }, // collisionRotationMultiplier + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->includeVerticalDirection), NULL, 0 }, // includeVerticalDirection +}; + + +bool RotationModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RotationModifierParams::mBuiltFlagMutex; + +RotationModifierParams::RotationModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RotationModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RotationModifierParams::~RotationModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RotationModifierParams::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->~RotationModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RotationModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RotationModifierParams::getParameterDefinitionTree(void) const +{ + RotationModifierParams* tmpParam = const_cast<RotationModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RotationModifierParams::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 RotationModifierParams::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 RotationModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RotationModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RotationModifierParams::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 RotationModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Rotation modifier parameters.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="rollType" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("rollType", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "SPHERICAL", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "SPHERICAL", true); + HintTable[1].init("shortDescription", "Roll type", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "SPHERICAL", "CUBIC", "FLAT_X", "FLAT_Y", "FLAT_Z", "LONG_X", "LONG_Y", "LONG_Z" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 8); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="maxRotationRatePerSec" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("maxRotationRatePerSec", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[2].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(0), true); + HintTable[1].init("shortDescription", "Maximum rotation rate for instanced mesh objects", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="maxSettleRatePerSec" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("maxSettleRatePerSec", TYPE_F32, 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[3].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", "Maximum settle rate for instanced mesh objects", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="inAirRotationMultiplier" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("inAirRotationMultiplier", TYPE_F32, 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", "This value is multiplied by the rotation delta to increase or decrease rotations/frame if there are no particle collisions", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="collisionRotationMultiplier" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("collisionRotationMultiplier", TYPE_F32, 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[5].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", "This value is multiplied by the rotation delta to increase or decrease rotations/frame while colliding objects", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="includeVerticalDirection" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("includeVerticalDirection", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "false", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "false", true); + HintTable[1].init("shortDescription", "If false, the vertical speed of the object does not affect the rotation", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[6]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(3); + Children[3] = PDEF_PTR(4); + Children[4] = PDEF_PTR(5); + Children[5] = PDEF_PTR(6); + + ParamDefTable[0].setChildren(Children, 6); + } + + mBuiltFlag = true; + +} +void RotationModifierParams::initStrings(void) +{ +} + +void RotationModifierParams::initDynamicArrays(void) +{ +} + +void RotationModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + rollType = (const char*)"SPHERICAL"; + maxRotationRatePerSec = float(0.0f); + maxSettleRatePerSec = float(1.0f); + inAirRotationMultiplier = float(1.0f); + collisionRotationMultiplier = float(1.0f); + includeVerticalDirection = bool(false); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RotationModifierParams::initReferences(void) +{ +} + +void RotationModifierParams::freeDynamicArrays(void) +{ +} + +void RotationModifierParams::freeStrings(void) +{ +} + +void RotationModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RotationRateModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RotationRateModifierParams.cpp new file mode 100644 index 00000000..7d2ea83d --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RotationRateModifierParams.cpp @@ -0,0 +1,324 @@ +// 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 "RotationRateModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RotationRateModifierParamsNS; + +const char* const RotationRateModifierParamsFactory::vptr = + NvParameterized::getVptr<RotationRateModifierParams, RotationRateModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->rotationRate), NULL, 0 }, // rotationRate +}; + + +bool RotationRateModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RotationRateModifierParams::mBuiltFlagMutex; + +RotationRateModifierParams::RotationRateModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RotationRateModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RotationRateModifierParams::~RotationRateModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RotationRateModifierParams::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->~RotationRateModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RotationRateModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RotationRateModifierParams::getParameterDefinitionTree(void) const +{ + RotationRateModifierParams* tmpParam = const_cast<RotationRateModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RotationRateModifierParams::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 RotationRateModifierParams::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 RotationRateModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RotationRateModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RotationRateModifierParams::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 RotationRateModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "RotationRate modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="rotationRate" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("rotationRate", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", uint64_t(0), true); + ParamDefTable[1].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(0), true); + HintTable[1].init("shortDescription", "Rotation Rate (revs/sec) for sprite objects", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void RotationRateModifierParams::initStrings(void) +{ +} + +void RotationRateModifierParams::initDynamicArrays(void) +{ +} + +void RotationRateModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + rotationRate = float(0.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RotationRateModifierParams::initReferences(void) +{ +} + +void RotationRateModifierParams::freeDynamicArrays(void) +{ +} + +void RotationRateModifierParams::freeStrings(void) +{ +} + +void RotationRateModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/RotationRateVsLifeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/RotationRateVsLifeModifierParams.cpp new file mode 100644 index 00000000..47a3142b --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/RotationRateVsLifeModifierParams.cpp @@ -0,0 +1,441 @@ +// 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 "RotationRateVsLifeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace RotationRateVsLifeModifierParamsNS; + +const char* const RotationRateVsLifeModifierParamsFactory::vptr = + NvParameterized::getVptr<RotationRateVsLifeModifierParams, RotationRateVsLifeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool RotationRateVsLifeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType RotationRateVsLifeModifierParams::mBuiltFlagMutex; + +RotationRateVsLifeModifierParams::RotationRateVsLifeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &RotationRateVsLifeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +RotationRateVsLifeModifierParams::~RotationRateVsLifeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void RotationRateVsLifeModifierParams::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->~RotationRateVsLifeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* RotationRateVsLifeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* RotationRateVsLifeModifierParams::getParameterDefinitionTree(void) const +{ + RotationRateVsLifeModifierParams* tmpParam = const_cast<RotationRateVsLifeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType RotationRateVsLifeModifierParams::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 RotationRateVsLifeModifierParams::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 RotationRateVsLifeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<RotationRateVsLifeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void RotationRateVsLifeModifierParams::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 RotationRateVsLifeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "RotationRateVsLife modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Rotation Rate (revs/sec)", true); + ParamDefTable[1].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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[4].init("shortDescription", "Control points for a curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "Rotation Rate (revs/sec)", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Rotation Rate (revs/sec)", true); + ParamDefTable[2].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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[4].init("shortDescription", "Control points for a curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "Rotation Rate (revs/sec)", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Life time", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Rotation rate (revs/sec)", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void RotationRateVsLifeModifierParams::initStrings(void) +{ +} + +void RotationRateVsLifeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void RotationRateVsLifeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void RotationRateVsLifeModifierParams::initReferences(void) +{ +} + +void RotationRateVsLifeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void RotationRateVsLifeModifierParams::freeStrings(void) +{ +} + +void RotationRateVsLifeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleAlongVelocityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleAlongVelocityModifierParams.cpp new file mode 100644 index 00000000..89e034e4 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleAlongVelocityModifierParams.cpp @@ -0,0 +1,324 @@ +// 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 "ScaleAlongVelocityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleAlongVelocityModifierParamsNS; + +const char* const ScaleAlongVelocityModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleAlongVelocityModifierParams, ScaleAlongVelocityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->scaleFactor), NULL, 0 }, // scaleFactor +}; + + +bool ScaleAlongVelocityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleAlongVelocityModifierParams::mBuiltFlagMutex; + +ScaleAlongVelocityModifierParams::ScaleAlongVelocityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleAlongVelocityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleAlongVelocityModifierParams::~ScaleAlongVelocityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleAlongVelocityModifierParams::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->~ScaleAlongVelocityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleAlongVelocityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleAlongVelocityModifierParams::getParameterDefinitionTree(void) const +{ + ScaleAlongVelocityModifierParams* tmpParam = const_cast<ScaleAlongVelocityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleAlongVelocityModifierParams::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 ScaleAlongVelocityModifierParams::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 ScaleAlongVelocityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleAlongVelocityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleAlongVelocityModifierParams::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 ScaleAlongVelocityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleAlongVelocity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleFactor" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleFactor", TYPE_F32, 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[1].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", "Scale factor", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void ScaleAlongVelocityModifierParams::initStrings(void) +{ +} + +void ScaleAlongVelocityModifierParams::initDynamicArrays(void) +{ +} + +void ScaleAlongVelocityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleFactor = float(1.0f); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleAlongVelocityModifierParams::initReferences(void) +{ +} + +void ScaleAlongVelocityModifierParams::freeDynamicArrays(void) +{ +} + +void ScaleAlongVelocityModifierParams::freeStrings(void) +{ +} + +void ScaleAlongVelocityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleByMassModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleByMassModifierParams.cpp new file mode 100644 index 00000000..a0e5f01c --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleByMassModifierParams.cpp @@ -0,0 +1,280 @@ +// 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 "ScaleByMassModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleByMassModifierParamsNS; + +const char* const ScaleByMassModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleByMassModifierParams, ScaleByMassModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 1; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, NULL, 0 }, +}; + + +bool ScaleByMassModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleByMassModifierParams::mBuiltFlagMutex; + +ScaleByMassModifierParams::ScaleByMassModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleByMassModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleByMassModifierParams::~ScaleByMassModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleByMassModifierParams::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->~ScaleByMassModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleByMassModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleByMassModifierParams::getParameterDefinitionTree(void) const +{ + ScaleByMassModifierParams* tmpParam = const_cast<ScaleByMassModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleByMassModifierParams::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 ScaleByMassModifierParams::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 ScaleByMassModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleByMassModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleByMassModifierParams::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 ScaleByMassModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleByMass modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + mBuiltFlag = true; + +} +void ScaleByMassModifierParams::initStrings(void) +{ +} + +void ScaleByMassModifierParams::initDynamicArrays(void) +{ +} + +void ScaleByMassModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleByMassModifierParams::initReferences(void) +{ +} + +void ScaleByMassModifierParams::freeDynamicArrays(void) +{ +} + +void ScaleByMassModifierParams::freeStrings(void) +{ +} + +void ScaleByMassModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance2DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance2DModifierParams.cpp new file mode 100644 index 00000000..c30f2a94 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance2DModifierParams.cpp @@ -0,0 +1,451 @@ +// 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 "ScaleVsCameraDistance2DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsCameraDistance2DModifierParamsNS; + +const char* const ScaleVsCameraDistance2DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsCameraDistance2DModifierParams, ScaleVsCameraDistance2DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleCameraDistanceStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleCameraDistanceStruct_Type*)0)->cameraDistance), NULL, 0 }, // controlPoints[].cameraDistance + { TYPE_VEC2, false, (size_t)(&((scaleCameraDistanceStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsCameraDistance2DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsCameraDistance2DModifierParams::mBuiltFlagMutex; + +ScaleVsCameraDistance2DModifierParams::ScaleVsCameraDistance2DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsCameraDistance2DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsCameraDistance2DModifierParams::~ScaleVsCameraDistance2DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsCameraDistance2DModifierParams::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->~ScaleVsCameraDistance2DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistance2DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistance2DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsCameraDistance2DModifierParams* tmpParam = const_cast<ScaleVsCameraDistance2DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsCameraDistance2DModifierParams::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 ScaleVsCameraDistance2DModifierParams::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 ScaleVsCameraDistance2DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsCameraDistance2DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsCameraDistance2DModifierParams::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 ScaleVsCameraDistance2DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsCameraDistance2D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 2D scale vs camera distance curve", true); + HintTable[4].init("xAxisLabel", "Camera Distance", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleCameraDistanceStruct", 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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 2D scale vs camera distance curve", true); + HintTable[4].init("xAxisLabel", "Camera Distance", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].cameraDistance" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("cameraDistance", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Camera distance", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC2, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsCameraDistance2DModifierParams::initStrings(void) +{ +} + +void ScaleVsCameraDistance2DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleCameraDistanceStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsCameraDistance2DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsCameraDistance2DModifierParams::initReferences(void) +{ +} + +void ScaleVsCameraDistance2DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsCameraDistance2DModifierParams::freeStrings(void) +{ +} + +void ScaleVsCameraDistance2DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance3DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance3DModifierParams.cpp new file mode 100644 index 00000000..87ea4207 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistance3DModifierParams.cpp @@ -0,0 +1,451 @@ +// 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 "ScaleVsCameraDistance3DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsCameraDistance3DModifierParamsNS; + +const char* const ScaleVsCameraDistance3DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsCameraDistance3DModifierParams, ScaleVsCameraDistance3DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleCameraDistanceStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleCameraDistanceStruct_Type*)0)->cameraDistance), NULL, 0 }, // controlPoints[].cameraDistance + { TYPE_VEC3, false, (size_t)(&((scaleCameraDistanceStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsCameraDistance3DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsCameraDistance3DModifierParams::mBuiltFlagMutex; + +ScaleVsCameraDistance3DModifierParams::ScaleVsCameraDistance3DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsCameraDistance3DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsCameraDistance3DModifierParams::~ScaleVsCameraDistance3DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsCameraDistance3DModifierParams::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->~ScaleVsCameraDistance3DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistance3DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistance3DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsCameraDistance3DModifierParams* tmpParam = const_cast<ScaleVsCameraDistance3DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsCameraDistance3DModifierParams::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 ScaleVsCameraDistance3DModifierParams::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 ScaleVsCameraDistance3DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsCameraDistance3DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsCameraDistance3DModifierParams::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 ScaleVsCameraDistance3DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsCameraDistance3D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 3D scale vs camera distance curve", true); + HintTable[4].init("xAxisLabel", "Camera Distance", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleCameraDistanceStruct", 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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 3D scale vs camera distance curve", true); + HintTable[4].init("xAxisLabel", "Camera Distance", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].cameraDistance" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("cameraDistance", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Camera distance", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsCameraDistance3DModifierParams::initStrings(void) +{ +} + +void ScaleVsCameraDistance3DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleCameraDistanceStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsCameraDistance3DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsCameraDistance3DModifierParams::initReferences(void) +{ +} + +void ScaleVsCameraDistance3DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsCameraDistance3DModifierParams::freeStrings(void) +{ +} + +void ScaleVsCameraDistance3DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistanceModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistanceModifierParams.cpp new file mode 100644 index 00000000..b3c69217 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsCameraDistanceModifierParams.cpp @@ -0,0 +1,466 @@ +// 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 "ScaleVsCameraDistanceModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsCameraDistanceModifierParamsNS; + +const char* const ScaleVsCameraDistanceModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsCameraDistanceModifierParams, ScaleVsCameraDistanceModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->scaleAxis), NULL, 0 }, // scaleAxis + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ScaleVsCameraDistanceModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsCameraDistanceModifierParams::mBuiltFlagMutex; + +ScaleVsCameraDistanceModifierParams::ScaleVsCameraDistanceModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsCameraDistanceModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsCameraDistanceModifierParams::~ScaleVsCameraDistanceModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsCameraDistanceModifierParams::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->~ScaleVsCameraDistanceModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistanceModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsCameraDistanceModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsCameraDistanceModifierParams* tmpParam = const_cast<ScaleVsCameraDistanceModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsCameraDistanceModifierParams::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 ScaleVsCameraDistanceModifierParams::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 ScaleVsCameraDistanceModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsCameraDistanceModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsCameraDistanceModifierParams::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 ScaleVsCameraDistanceModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsCameraDistance modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleAxis" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleAxis", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "xAxis", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "xAxis", true); + HintTable[1].init("shortDescription", "Scale axis to which the curve will be applied", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "xAxis", "yAxis", "zAxis" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 3); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Camera Distance", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Camera Distance", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Camera Distance", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Camera distance", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Scale", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsCameraDistanceModifierParams::initStrings(void) +{ +} + +void ScaleVsCameraDistanceModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsCameraDistanceModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleAxis = (const char*)"xAxis"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsCameraDistanceModifierParams::initReferences(void) +{ +} + +void ScaleVsCameraDistanceModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsCameraDistanceModifierParams::freeStrings(void) +{ +} + +void ScaleVsCameraDistanceModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity2DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity2DModifierParams.cpp new file mode 100644 index 00000000..13191419 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity2DModifierParams.cpp @@ -0,0 +1,455 @@ +// 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 "ScaleVsDensity2DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsDensity2DModifierParamsNS; + +const char* const ScaleVsDensity2DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsDensity2DModifierParams, ScaleVsDensity2DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleDensityStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleDensityStruct_Type*)0)->density), NULL, 0 }, // controlPoints[].density + { TYPE_VEC2, false, (size_t)(&((scaleDensityStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsDensity2DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsDensity2DModifierParams::mBuiltFlagMutex; + +ScaleVsDensity2DModifierParams::ScaleVsDensity2DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsDensity2DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsDensity2DModifierParams::~ScaleVsDensity2DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsDensity2DModifierParams::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->~ScaleVsDensity2DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensity2DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensity2DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsDensity2DModifierParams* tmpParam = const_cast<ScaleVsDensity2DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsDensity2DModifierParams::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 ScaleVsDensity2DModifierParams::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 ScaleVsDensity2DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsDensity2DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsDensity2DModifierParams::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 ScaleVsDensity2DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsDensity2D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite 2D scale vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleDensityStruct", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1000), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite 2D scale vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].density" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("density", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Density", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC2, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsDensity2DModifierParams::initStrings(void) +{ +} + +void ScaleVsDensity2DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleDensityStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsDensity2DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsDensity2DModifierParams::initReferences(void) +{ +} + +void ScaleVsDensity2DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsDensity2DModifierParams::freeStrings(void) +{ +} + +void ScaleVsDensity2DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity3DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity3DModifierParams.cpp new file mode 100644 index 00000000..5f1852ef --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensity3DModifierParams.cpp @@ -0,0 +1,455 @@ +// 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 "ScaleVsDensity3DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsDensity3DModifierParamsNS; + +const char* const ScaleVsDensity3DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsDensity3DModifierParams, ScaleVsDensity3DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleDensityStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleDensityStruct_Type*)0)->density), NULL, 0 }, // controlPoints[].density + { TYPE_VEC3, false, (size_t)(&((scaleDensityStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsDensity3DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsDensity3DModifierParams::mBuiltFlagMutex; + +ScaleVsDensity3DModifierParams::ScaleVsDensity3DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsDensity3DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsDensity3DModifierParams::~ScaleVsDensity3DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsDensity3DModifierParams::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->~ScaleVsDensity3DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensity3DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensity3DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsDensity3DModifierParams* tmpParam = const_cast<ScaleVsDensity3DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsDensity3DModifierParams::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 ScaleVsDensity3DModifierParams::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 ScaleVsDensity3DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsDensity3DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsDensity3DModifierParams::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 ScaleVsDensity3DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsDensity3D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite 3D scale vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleDensityStruct", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("xAxisLabel", "Density", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_X_SCALE_PHYSX3", uint64_t(1), true); + HintTable[2].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[3].init("editorCurve", uint64_t(1), true); + HintTable[4].init("shortDescription", "Control points for a composite 3D scale vs density curve", true); + HintTable[5].init("xAxisLabel", "Density", true); + HintTable[6].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].density" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("density", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Density", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsDensity3DModifierParams::initStrings(void) +{ +} + +void ScaleVsDensity3DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleDensityStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsDensity3DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsDensity3DModifierParams::initReferences(void) +{ +} + +void ScaleVsDensity3DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsDensity3DModifierParams::freeStrings(void) +{ +} + +void ScaleVsDensity3DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsDensityModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensityModifierParams.cpp new file mode 100644 index 00000000..e451646a --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsDensityModifierParams.cpp @@ -0,0 +1,466 @@ +// 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 "ScaleVsDensityModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsDensityModifierParamsNS; + +const char* const ScaleVsDensityModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsDensityModifierParams, ScaleVsDensityModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->scaleAxis), NULL, 0 }, // scaleAxis + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ScaleVsDensityModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsDensityModifierParams::mBuiltFlagMutex; + +ScaleVsDensityModifierParams::ScaleVsDensityModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsDensityModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsDensityModifierParams::~ScaleVsDensityModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsDensityModifierParams::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->~ScaleVsDensityModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensityModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsDensityModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsDensityModifierParams* tmpParam = const_cast<ScaleVsDensityModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsDensityModifierParams::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 ScaleVsDensityModifierParams::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 ScaleVsDensityModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsDensityModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsDensityModifierParams::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 ScaleVsDensityModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsDensity modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleAxis" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleAxis", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "xAxis", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "xAxis", true); + HintTable[1].init("shortDescription", "Scale axis to which the curve will be applied", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "xAxis", "yAxis", "zAxis" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 3); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Density", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Density", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Density", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Density", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Density", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Scale", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsDensityModifierParams::initStrings(void) +{ +} + +void ScaleVsDensityModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsDensityModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleAxis = (const char*)"xAxis"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsDensityModifierParams::initReferences(void) +{ +} + +void ScaleVsDensityModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsDensityModifierParams::freeStrings(void) +{ +} + +void ScaleVsDensityModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsLife2DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsLife2DModifierParams.cpp new file mode 100644 index 00000000..f4166d50 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsLife2DModifierParams.cpp @@ -0,0 +1,453 @@ +// 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 "ScaleVsLife2DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsLife2DModifierParamsNS; + +const char* const ScaleVsLife2DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsLife2DModifierParams, ScaleVsLife2DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleLifeStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleLifeStruct_Type*)0)->lifeRemaining), NULL, 0 }, // controlPoints[].lifeRemaining + { TYPE_VEC2, false, (size_t)(&((scaleLifeStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsLife2DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsLife2DModifierParams::mBuiltFlagMutex; + +ScaleVsLife2DModifierParams::ScaleVsLife2DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsLife2DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsLife2DModifierParams::~ScaleVsLife2DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsLife2DModifierParams::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->~ScaleVsLife2DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsLife2DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsLife2DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsLife2DModifierParams* tmpParam = const_cast<ScaleVsLife2DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsLife2DModifierParams::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 ScaleVsLife2DModifierParams::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 ScaleVsLife2DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsLife2DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsLife2DModifierParams::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 ScaleVsLife2DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsLife2D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite scale vs life curve", true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleLifeStruct", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite scale vs life curve", true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].lifeRemaining" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("lifeRemaining", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life remaining", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC2, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsLife2DModifierParams::initStrings(void) +{ +} + +void ScaleVsLife2DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleLifeStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsLife2DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsLife2DModifierParams::initReferences(void) +{ +} + +void ScaleVsLife2DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsLife2DModifierParams::freeStrings(void) +{ +} + +void ScaleVsLife2DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsLife3DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsLife3DModifierParams.cpp new file mode 100644 index 00000000..a53da682 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsLife3DModifierParams.cpp @@ -0,0 +1,453 @@ +// 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 "ScaleVsLife3DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsLife3DModifierParamsNS; + +const char* const ScaleVsLife3DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsLife3DModifierParams, ScaleVsLife3DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleLifeStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleLifeStruct_Type*)0)->lifeRemaining), NULL, 0 }, // controlPoints[].lifeRemaining + { TYPE_VEC3, false, (size_t)(&((scaleLifeStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsLife3DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsLife3DModifierParams::mBuiltFlagMutex; + +ScaleVsLife3DModifierParams::ScaleVsLife3DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsLife3DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsLife3DModifierParams::~ScaleVsLife3DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsLife3DModifierParams::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->~ScaleVsLife3DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsLife3DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsLife3DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsLife3DModifierParams* tmpParam = const_cast<ScaleVsLife3DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsLife3DModifierParams::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 ScaleVsLife3DModifierParams::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 ScaleVsLife3DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsLife3DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsLife3DModifierParams::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 ScaleVsLife3DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsLife3D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite scale vs life curve", true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleLifeStruct", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite scale vs life curve", true); + HintTable[4].init("xAxisLabel", "Life Time", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].lifeRemaining" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("lifeRemaining", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life remaining", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsLife3DModifierParams::initStrings(void) +{ +} + +void ScaleVsLife3DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleLifeStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsLife3DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsLife3DModifierParams::initReferences(void) +{ +} + +void ScaleVsLife3DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsLife3DModifierParams::freeStrings(void) +{ +} + +void ScaleVsLife3DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsLifeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsLifeModifierParams.cpp new file mode 100644 index 00000000..364cded7 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsLifeModifierParams.cpp @@ -0,0 +1,474 @@ +// 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 "ScaleVsLifeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsLifeModifierParamsNS; + +const char* const ScaleVsLifeModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsLifeModifierParams, ScaleVsLifeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->scaleAxis), NULL, 0 }, // scaleAxis + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ScaleVsLifeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsLifeModifierParams::mBuiltFlagMutex; + +ScaleVsLifeModifierParams::ScaleVsLifeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsLifeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsLifeModifierParams::~ScaleVsLifeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsLifeModifierParams::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->~ScaleVsLifeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsLifeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsLifeModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsLifeModifierParams* tmpParam = const_cast<ScaleVsLifeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsLifeModifierParams::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 ScaleVsLifeModifierParams::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 ScaleVsLifeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsLifeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsLifeModifierParams::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 ScaleVsLifeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsLife modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleAxis" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleAxis", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "xAxis", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "xAxis", true); + HintTable[1].init("shortDescription", "Scale axis to which the curve will be applied", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "xAxis", "yAxis", "zAxis" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 3); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Life Time", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Life Time", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Scale", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsLifeModifierParams::initStrings(void) +{ +} + +void ScaleVsLifeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsLifeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleAxis = (const char*)"xAxis"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsLifeModifierParams::initReferences(void) +{ +} + +void ScaleVsLifeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsLifeModifierParams::freeStrings(void) +{ +} + +void ScaleVsLifeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature2DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature2DModifierParams.cpp new file mode 100644 index 00000000..d5c70695 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature2DModifierParams.cpp @@ -0,0 +1,451 @@ +// 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 "ScaleVsTemperature2DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsTemperature2DModifierParamsNS; + +const char* const ScaleVsTemperature2DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsTemperature2DModifierParams, ScaleVsTemperature2DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleTemperatureStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleTemperatureStruct_Type*)0)->temperature), NULL, 0 }, // controlPoints[].temperature + { TYPE_VEC2, false, (size_t)(&((scaleTemperatureStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsTemperature2DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsTemperature2DModifierParams::mBuiltFlagMutex; + +ScaleVsTemperature2DModifierParams::ScaleVsTemperature2DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsTemperature2DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsTemperature2DModifierParams::~ScaleVsTemperature2DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsTemperature2DModifierParams::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->~ScaleVsTemperature2DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperature2DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperature2DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsTemperature2DModifierParams* tmpParam = const_cast<ScaleVsTemperature2DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsTemperature2DModifierParams::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 ScaleVsTemperature2DModifierParams::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 ScaleVsTemperature2DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsTemperature2DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsTemperature2DModifierParams::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 ScaleVsTemperature2DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsTemperature2D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 2D scale vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleTemperatureStruct", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 2D scale vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].temperature" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("temperature", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Temperature", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC2, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsTemperature2DModifierParams::initStrings(void) +{ +} + +void ScaleVsTemperature2DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleTemperatureStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsTemperature2DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsTemperature2DModifierParams::initReferences(void) +{ +} + +void ScaleVsTemperature2DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsTemperature2DModifierParams::freeStrings(void) +{ +} + +void ScaleVsTemperature2DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature3DModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature3DModifierParams.cpp new file mode 100644 index 00000000..f66a52e7 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperature3DModifierParams.cpp @@ -0,0 +1,451 @@ +// 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 "ScaleVsTemperature3DModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsTemperature3DModifierParamsNS; + +const char* const ScaleVsTemperature3DModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsTemperature3DModifierParams, ScaleVsTemperature3DModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(scaleTemperatureStruct_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((scaleTemperatureStruct_Type*)0)->temperature), NULL, 0 }, // controlPoints[].temperature + { TYPE_VEC3, false, (size_t)(&((scaleTemperatureStruct_Type*)0)->scale), NULL, 0 }, // controlPoints[].scale +}; + + +bool ScaleVsTemperature3DModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsTemperature3DModifierParams::mBuiltFlagMutex; + +ScaleVsTemperature3DModifierParams::ScaleVsTemperature3DModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsTemperature3DModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsTemperature3DModifierParams::~ScaleVsTemperature3DModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsTemperature3DModifierParams::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->~ScaleVsTemperature3DModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperature3DModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperature3DModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsTemperature3DModifierParams* tmpParam = const_cast<ScaleVsTemperature3DModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsTemperature3DModifierParams::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 ScaleVsTemperature3DModifierParams::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 ScaleVsTemperature3DModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsTemperature3DModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsTemperature3DModifierParams::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 ScaleVsTemperature3DModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsTemperature3D modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 3D scale vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "scaleTemperatureStruct", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#else + + static HintImpl HintTable[6]; + static Hint* HintPtrTable[6] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], }; + HintTable[0].init("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(1), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("shortDescription", "Control points for a composite 3D scale vs Temperature curve", true); + HintTable[4].init("xAxisLabel", "Temperature", true); + HintTable[5].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 6); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].temperature" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("temperature", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Temperature", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].scale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("scale", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("min", uint64_t(0), 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("min", uint64_t(0), true); + HintTable[1].init("shortDescription", "Scale", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsTemperature3DModifierParams::initStrings(void) +{ +} + +void ScaleVsTemperature3DModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(scaleTemperatureStruct_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsTemperature3DModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsTemperature3DModifierParams::initReferences(void) +{ +} + +void ScaleVsTemperature3DModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsTemperature3DModifierParams::freeStrings(void) +{ +} + +void ScaleVsTemperature3DModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperatureModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperatureModifierParams.cpp new file mode 100644 index 00000000..cea69421 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ScaleVsTemperatureModifierParams.cpp @@ -0,0 +1,466 @@ +// 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 "ScaleVsTemperatureModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ScaleVsTemperatureModifierParamsNS; + +const char* const ScaleVsTemperatureModifierParamsFactory::vptr = + NvParameterized::getVptr<ScaleVsTemperatureModifierParams, ScaleVsTemperatureModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 2 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->scaleAxis), NULL, 0 }, // scaleAxis + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(2), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(3), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool ScaleVsTemperatureModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ScaleVsTemperatureModifierParams::mBuiltFlagMutex; + +ScaleVsTemperatureModifierParams::ScaleVsTemperatureModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ScaleVsTemperatureModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ScaleVsTemperatureModifierParams::~ScaleVsTemperatureModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ScaleVsTemperatureModifierParams::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->~ScaleVsTemperatureModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperatureModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ScaleVsTemperatureModifierParams::getParameterDefinitionTree(void) const +{ + ScaleVsTemperatureModifierParams* tmpParam = const_cast<ScaleVsTemperatureModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ScaleVsTemperatureModifierParams::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 ScaleVsTemperatureModifierParams::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 ScaleVsTemperatureModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ScaleVsTemperatureModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ScaleVsTemperatureModifierParams::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 ScaleVsTemperatureModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ScaleVsTemperature modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleAxis" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleAxis", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "xAxis", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "xAxis", true); + HintTable[1].init("shortDescription", "Scale axis to which the curve will be applied", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "xAxis", "yAxis", "zAxis" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 3); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Temperature", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("xAxisLabel", "Temperature", true); + HintTable[2].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#else + + static HintImpl HintTable[5]; + static Hint* HintPtrTable[5] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], }; + HintTable[0].init("editorCurve", uint64_t(1), true); + HintTable[1].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[2].init("shortDescription", "Control points for a curve", true); + HintTable[3].init("xAxisLabel", "Temperature", true); + HintTable[4].init("yAxisLabel", "Scale", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 5); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Temperature", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Scale", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + + ParamDefTable[0].setChildren(Children, 2); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=3, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(4); + Children[1] = PDEF_PTR(5); + + ParamDefTable[3].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void ScaleVsTemperatureModifierParams::initStrings(void) +{ +} + +void ScaleVsTemperatureModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void ScaleVsTemperatureModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleAxis = (const char*)"xAxis"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ScaleVsTemperatureModifierParams::initReferences(void) +{ +} + +void ScaleVsTemperatureModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void ScaleVsTemperatureModifierParams::freeStrings(void) +{ +} + +void ScaleVsTemperatureModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/SimpleScaleModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/SimpleScaleModifierParams.cpp new file mode 100644 index 00000000..d6071a72 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/SimpleScaleModifierParams.cpp @@ -0,0 +1,318 @@ +// 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 "SimpleScaleModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace SimpleScaleModifierParamsNS; + +const char* const SimpleScaleModifierParamsFactory::vptr = + NvParameterized::getVptr<SimpleScaleModifierParams, SimpleScaleModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->scaleFactor), NULL, 0 }, // scaleFactor +}; + + +bool SimpleScaleModifierParams::mBuiltFlag = false; +NvParameterized::MutexType SimpleScaleModifierParams::mBuiltFlagMutex; + +SimpleScaleModifierParams::SimpleScaleModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &SimpleScaleModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +SimpleScaleModifierParams::~SimpleScaleModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void SimpleScaleModifierParams::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->~SimpleScaleModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* SimpleScaleModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* SimpleScaleModifierParams::getParameterDefinitionTree(void) const +{ + SimpleScaleModifierParams* tmpParam = const_cast<SimpleScaleModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType SimpleScaleModifierParams::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 SimpleScaleModifierParams::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 SimpleScaleModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<SimpleScaleModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void SimpleScaleModifierParams::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 SimpleScaleModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "SimpleScale modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="scaleFactor" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("scaleFactor", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Scale factor", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void SimpleScaleModifierParams::initStrings(void) +{ +} + +void SimpleScaleModifierParams::initDynamicArrays(void) +{ +} + +void SimpleScaleModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + scaleFactor = physx::PxVec3(init(1, 1, 1)); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void SimpleScaleModifierParams::initReferences(void) +{ +} + +void SimpleScaleModifierParams::freeDynamicArrays(void) +{ +} + +void SimpleScaleModifierParams::freeStrings(void) +{ +} + +void SimpleScaleModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/SpriteIofxParameters.cpp b/APEX_1.4/module/iofx/src/autogen/SpriteIofxParameters.cpp new file mode 100644 index 00000000..99c3c81b --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/SpriteIofxParameters.cpp @@ -0,0 +1,534 @@ +// 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 "SpriteIofxParameters.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace SpriteIofxParametersNS; + +const char* const SpriteIofxParametersFactory::vptr = + NvParameterized::getVptr<SpriteIofxParameters, SpriteIofxParameters::ClassAlignment>(); + +const uint32_t NumParamDefs = 6; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 4, 3, 5, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 3 }, + { TYPE_REF, false, (size_t)(&((ParametersStruct*)0)->spriteMaterialName), NULL, 0 }, // spriteMaterialName + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->spawnModifierList), CHILDREN(3), 1 }, // spawnModifierList + { TYPE_REF, false, 1 * sizeof(NvParameterized::Interface*), NULL, 0 }, // spawnModifierList[] + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->continuousModifierList), CHILDREN(4), 1 }, // continuousModifierList + { TYPE_REF, false, 1 * sizeof(NvParameterized::Interface*), NULL, 0 }, // continuousModifierList[] +}; + + +bool SpriteIofxParameters::mBuiltFlag = false; +NvParameterized::MutexType SpriteIofxParameters::mBuiltFlagMutex; + +SpriteIofxParameters::SpriteIofxParameters(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &SpriteIofxParametersFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +SpriteIofxParameters::~SpriteIofxParameters() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void SpriteIofxParameters::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->~SpriteIofxParameters(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* SpriteIofxParameters::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* SpriteIofxParameters::getParameterDefinitionTree(void) const +{ + SpriteIofxParameters* tmpParam = const_cast<SpriteIofxParameters*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType SpriteIofxParameters::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 SpriteIofxParameters::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 SpriteIofxParameters::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<SpriteIofxParameters::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ +/* [0] - spawnModifierList (not an array of structs) */ +/* [0] - continuousModifierList (not an array of structs) */ + +void SpriteIofxParameters::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 SpriteIofxParameters::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="spriteMaterialName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("spriteMaterialName", 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 sprite material name (if this is a sprite IOFX)", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "ApexMaterials" }; + ParamDefTable[1].setRefVariantVals((const char**)RefVariantVals, 1); + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="spawnModifierList" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("spawnModifierList", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("INCLUDED", uint64_t(1), true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("INCLUDED", uint64_t(1), true); + HintTable[2].init("longDescription", "These modifiers are applied to the instanced objects at object creation. (Currently RotationModifierParams is unsupported for sprites)", true); + HintTable[3].init("shortDescription", "Spawn modifier list", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "SimpleScaleModifierParams", "RandomScaleModifierParams", "InitialColorModifierParams", "RandomSubtextureModifierParams", "RandomRotationModifierParams", "ColorVsLifeModifierParams", "ScaleByMassModifierParams" }; + ParamDefTable[2].setRefVariantVals((const char**)RefVariantVals, 7); + + + ParamDef->setArraySize(-1); + static const uint8_t dynHandleIndices[1] = { 0, }; + ParamDef->setDynamicHandleIndicesMap(dynHandleIndices, 1); + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="spawnModifierList[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("spawnModifierList", TYPE_REF, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("INCLUDED", uint64_t(1), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("INCLUDED", uint64_t(1), true); + HintTable[2].init("longDescription", "These modifiers are applied to the instanced objects at object creation. (Currently RotationModifierParams is unsupported for sprites)", true); + HintTable[3].init("shortDescription", "Spawn modifier list", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "SimpleScaleModifierParams", "RandomScaleModifierParams", "InitialColorModifierParams", "RandomSubtextureModifierParams", "RandomRotationModifierParams", "ColorVsLifeModifierParams", "ScaleByMassModifierParams" }; + ParamDefTable[3].setRefVariantVals((const char**)RefVariantVals, 7); + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="continuousModifierList" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("continuousModifierList", TYPE_ARRAY, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("HIDE_CLASS2", "ColorVsDensityModifierParams", true); + HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); + HintTable[3].init("HIDE_CLASS4", "ScaleVsDensityModifierParams", true); + HintTable[4].init("HIDE_CLASS5", "ScaleVsLifeModifierParams", true); + HintTable[5].init("HIDE_CLASS6", "ColorVsTemperatureModifierParams", true); + HintTable[6].init("HIDE_CLASS7", "ScaleVsTemperatureModifierParams", true); + HintTable[7].init("INCLUDED", uint64_t(1), true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#else + + static HintImpl HintTable[10]; + static Hint* HintPtrTable[10] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], &HintTable[8], &HintTable[9], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("HIDE_CLASS2", "ColorVsDensityModifierParams", true); + HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); + HintTable[3].init("HIDE_CLASS4", "ScaleVsDensityModifierParams", true); + HintTable[4].init("HIDE_CLASS5", "ScaleVsLifeModifierParams", true); + HintTable[5].init("HIDE_CLASS6", "ColorVsTemperatureModifierParams", true); + HintTable[6].init("HIDE_CLASS7", "ScaleVsTemperatureModifierParams", true); + HintTable[7].init("INCLUDED", uint64_t(1), true); + HintTable[8].init("longDescription", "These modifiers are applied to the instanced objects every frame. (Currently RotationModifierParams is unsupported for sprites)", true); + HintTable[9].init("shortDescription", "Continuous modifier list", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 10); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "ColorVsLifeCompositeModifierParams", "ColorVsDensityCompositeModifierParams", "ColorVsTemperatureCompositeModifierParams", "ScaleVsLife2DModifierParams", "ScaleVsDensity2DModifierParams", "ScaleVsTemperature2DModifierParams", "ScaleVsCameraDistance2DModifierParams", "SubtextureVsLifeModifierParams", "ViewDirectionSortingModifierParams", "ColorVsLifeModifierParams", "ColorVsDensityModifierParams", "ColorVsTemperatureModifierParams", "ScaleVsLifeModifierParams", "ScaleVsDensityModifierParams", "ScaleVsTemperatureModifierParams", "ScaleVsCameraDistanceModifierParams", "RotationRateModifierParams", "RotationRateVsLifeModifierParams", "OrientScaleAlongScreenVelocityModifierParams", "ColorVsVelocityCompositeModifierParams" }; + ParamDefTable[4].setRefVariantVals((const char**)RefVariantVals, 20); + + + ParamDef->setArraySize(-1); + static const uint8_t dynHandleIndices[1] = { 0, }; + ParamDef->setDynamicHandleIndicesMap(dynHandleIndices, 1); + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="continuousModifierList[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("continuousModifierList", TYPE_REF, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[8]; + static Hint* HintPtrTable[8] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("HIDE_CLASS2", "ColorVsDensityModifierParams", true); + HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); + HintTable[3].init("HIDE_CLASS4", "ScaleVsDensityModifierParams", true); + HintTable[4].init("HIDE_CLASS5", "ScaleVsLifeModifierParams", true); + HintTable[5].init("HIDE_CLASS6", "ColorVsTemperatureModifierParams", true); + HintTable[6].init("HIDE_CLASS7", "ScaleVsTemperatureModifierParams", true); + HintTable[7].init("INCLUDED", uint64_t(1), true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 8); + +#else + + static HintImpl HintTable[10]; + static Hint* HintPtrTable[10] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], &HintTable[4], &HintTable[5], &HintTable[6], &HintTable[7], &HintTable[8], &HintTable[9], }; + HintTable[0].init("HIDE_CLASS1", "ColorVsLifeModifierParams", true); + HintTable[1].init("HIDE_CLASS2", "ColorVsDensityModifierParams", true); + HintTable[2].init("HIDE_CLASS3", "ScaleVsCameraDistanceModifierParams", true); + HintTable[3].init("HIDE_CLASS4", "ScaleVsDensityModifierParams", true); + HintTable[4].init("HIDE_CLASS5", "ScaleVsLifeModifierParams", true); + HintTable[5].init("HIDE_CLASS6", "ColorVsTemperatureModifierParams", true); + HintTable[6].init("HIDE_CLASS7", "ScaleVsTemperatureModifierParams", true); + HintTable[7].init("INCLUDED", uint64_t(1), true); + HintTable[8].init("longDescription", "These modifiers are applied to the instanced objects every frame. (Currently RotationModifierParams is unsupported for sprites)", true); + HintTable[9].init("shortDescription", "Continuous modifier list", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 10); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + static const char* const RefVariantVals[] = { "ColorVsLifeCompositeModifierParams", "ColorVsDensityCompositeModifierParams", "ColorVsTemperatureCompositeModifierParams", "ScaleVsLife2DModifierParams", "ScaleVsDensity2DModifierParams", "ScaleVsTemperature2DModifierParams", "ScaleVsCameraDistance2DModifierParams", "SubtextureVsLifeModifierParams", "ViewDirectionSortingModifierParams", "ColorVsLifeModifierParams", "ColorVsDensityModifierParams", "ColorVsTemperatureModifierParams", "ScaleVsLifeModifierParams", "ScaleVsDensityModifierParams", "ScaleVsTemperatureModifierParams", "ScaleVsCameraDistanceModifierParams", "RotationRateModifierParams", "RotationRateVsLifeModifierParams", "OrientScaleAlongScreenVelocityModifierParams", "ColorVsVelocityCompositeModifierParams" }; + ParamDefTable[5].setRefVariantVals((const char**)RefVariantVals, 20); + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[3]; + Children[0] = PDEF_PTR(1); + Children[1] = PDEF_PTR(2); + Children[2] = PDEF_PTR(4); + + ParamDefTable[0].setChildren(Children, 3); + } + + // SetChildren for: nodeIndex=2, longName="spawnModifierList" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(3); + + ParamDefTable[2].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=4, longName="continuousModifierList" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(5); + + ParamDefTable[4].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void SpriteIofxParameters::initStrings(void) +{ +} + +void SpriteIofxParameters::initDynamicArrays(void) +{ + 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 SpriteIofxParameters::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void SpriteIofxParameters::initReferences(void) +{ + spriteMaterialName = NULL; + +} + +void SpriteIofxParameters::freeDynamicArrays(void) +{ + if (spawnModifierList.isAllocated && spawnModifierList.buf) + { + mParameterizedTraits->free(spawnModifierList.buf); + } + if (continuousModifierList.isAllocated && continuousModifierList.buf) + { + mParameterizedTraits->free(continuousModifierList.buf); + } +} + +void SpriteIofxParameters::freeStrings(void) +{ +} + +void SpriteIofxParameters::freeReferences(void) +{ + if (spriteMaterialName) + { + spriteMaterialName->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 diff --git a/APEX_1.4/module/iofx/src/autogen/SubtextureVsLifeModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/SubtextureVsLifeModifierParams.cpp new file mode 100644 index 00000000..95d8e868 --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/SubtextureVsLifeModifierParams.cpp @@ -0,0 +1,449 @@ +// 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 "SubtextureVsLifeModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace SubtextureVsLifeModifierParamsNS; + +const char* const SubtextureVsLifeModifierParamsFactory::vptr = + NvParameterized::getVptr<SubtextureVsLifeModifierParams, SubtextureVsLifeModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 5; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ARRAY, true, (size_t)(&((ParametersStruct*)0)->controlPoints), CHILDREN(1), 1 }, // controlPoints + { TYPE_STRUCT, false, 1 * sizeof(vec2_Type), CHILDREN(2), 2 }, // controlPoints[] + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->x), NULL, 0 }, // controlPoints[].x + { TYPE_F32, false, (size_t)(&((vec2_Type*)0)->y), NULL, 0 }, // controlPoints[].y +}; + + +bool SubtextureVsLifeModifierParams::mBuiltFlag = false; +NvParameterized::MutexType SubtextureVsLifeModifierParams::mBuiltFlagMutex; + +SubtextureVsLifeModifierParams::SubtextureVsLifeModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &SubtextureVsLifeModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +SubtextureVsLifeModifierParams::~SubtextureVsLifeModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void SubtextureVsLifeModifierParams::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->~SubtextureVsLifeModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* SubtextureVsLifeModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* SubtextureVsLifeModifierParams::getParameterDefinitionTree(void) const +{ + SubtextureVsLifeModifierParams* tmpParam = const_cast<SubtextureVsLifeModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType SubtextureVsLifeModifierParams::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 SubtextureVsLifeModifierParams::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 SubtextureVsLifeModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<SubtextureVsLifeModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void SubtextureVsLifeModifierParams::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 SubtextureVsLifeModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "SubtextureVsLife modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="controlPoints" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("controlPoints", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "SubTexture", true); + ParamDefTable[1].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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[4].init("shortDescription", "Control points for a curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "SubTexture", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + ParamDef->setArraySize(-1); + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="controlPoints[]" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("controlPoints", TYPE_STRUCT, "vec2", 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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("xAxisLabel", "Life Time", true); + HintTable[4].init("yAxisLabel", "SubTexture", true); + ParamDefTable[2].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("CURVE_X_SCALE", uint64_t(1), true); + HintTable[1].init("CURVE_Y_SCALE", uint64_t(16), true); + HintTable[2].init("editorCurve", uint64_t(1), true); + HintTable[3].init("longDescription", "controlPoints is a sorted list of control points for a curve. Currently, the curve is a lame\nlirp'd curve. We could add support for other curvetypes in the future, either bezier curves,\nsplines, etc.\n", true); + HintTable[4].init("shortDescription", "Control points for a curve", true); + HintTable[5].init("xAxisLabel", "Life Time", true); + HintTable[6].init("yAxisLabel", "SubTexture", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 7); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="controlPoints[].x" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("x", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("max", uint64_t(1), true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "Life time", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="controlPoints[].y" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("y", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Subtexture id", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=1, longName="controlPoints" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(2); + + ParamDefTable[1].setChildren(Children, 1); + } + + // SetChildren for: nodeIndex=2, longName="controlPoints[]" + { + static Definition* Children[2]; + Children[0] = PDEF_PTR(3); + Children[1] = PDEF_PTR(4); + + ParamDefTable[2].setChildren(Children, 2); + } + + mBuiltFlag = true; + +} +void SubtextureVsLifeModifierParams::initStrings(void) +{ +} + +void SubtextureVsLifeModifierParams::initDynamicArrays(void) +{ + controlPoints.buf = NULL; + controlPoints.isAllocated = true; + controlPoints.elementSize = sizeof(vec2_Type); + controlPoints.arraySizes[0] = 0; +} + +void SubtextureVsLifeModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void SubtextureVsLifeModifierParams::initReferences(void) +{ +} + +void SubtextureVsLifeModifierParams::freeDynamicArrays(void) +{ + if (controlPoints.isAllocated && controlPoints.buf) + { + mParameterizedTraits->free(controlPoints.buf); + } +} + +void SubtextureVsLifeModifierParams::freeStrings(void) +{ +} + +void SubtextureVsLifeModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia diff --git a/APEX_1.4/module/iofx/src/autogen/ViewDirectionSortingModifierParams.cpp b/APEX_1.4/module/iofx/src/autogen/ViewDirectionSortingModifierParams.cpp new file mode 100644 index 00000000..528175bb --- /dev/null +++ b/APEX_1.4/module/iofx/src/autogen/ViewDirectionSortingModifierParams.cpp @@ -0,0 +1,326 @@ +// 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 "ViewDirectionSortingModifierParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace iofx +{ + +using namespace ViewDirectionSortingModifierParamsNS; + +const char* const ViewDirectionSortingModifierParamsFactory::vptr = + NvParameterized::getVptr<ViewDirectionSortingModifierParams, ViewDirectionSortingModifierParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 2; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 1 }, + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->sortType), NULL, 0 }, // sortType +}; + + +bool ViewDirectionSortingModifierParams::mBuiltFlag = false; +NvParameterized::MutexType ViewDirectionSortingModifierParams::mBuiltFlagMutex; + +ViewDirectionSortingModifierParams::ViewDirectionSortingModifierParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &ViewDirectionSortingModifierParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +ViewDirectionSortingModifierParams::~ViewDirectionSortingModifierParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void ViewDirectionSortingModifierParams::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->~ViewDirectionSortingModifierParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* ViewDirectionSortingModifierParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* ViewDirectionSortingModifierParams::getParameterDefinitionTree(void) const +{ + ViewDirectionSortingModifierParams* tmpParam = const_cast<ViewDirectionSortingModifierParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType ViewDirectionSortingModifierParams::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 ViewDirectionSortingModifierParams::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 ViewDirectionSortingModifierParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<ViewDirectionSortingModifierParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void ViewDirectionSortingModifierParams::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 ViewDirectionSortingModifierParams::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); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "ViewDirectionSorting modifier parameters", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="sortType" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("sortType", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("defaultValue", "default", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("defaultValue", "default", true); + HintTable[1].init("shortDescription", "Sort type", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "default" }; + ParamDefTable[1].setEnumVals((const char**)EnumVals, 1); + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[1]; + Children[0] = PDEF_PTR(1); + + ParamDefTable[0].setChildren(Children, 1); + } + + mBuiltFlag = true; + +} +void ViewDirectionSortingModifierParams::initStrings(void) +{ +} + +void ViewDirectionSortingModifierParams::initDynamicArrays(void) +{ +} + +void ViewDirectionSortingModifierParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + sortType = (const char*)"default"; + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void ViewDirectionSortingModifierParams::initReferences(void) +{ +} + +void ViewDirectionSortingModifierParams::freeDynamicArrays(void) +{ +} + +void ViewDirectionSortingModifierParams::freeStrings(void) +{ +} + +void ViewDirectionSortingModifierParams::freeReferences(void) +{ +} + +} // namespace iofx +} // namespace nvidia |