diff options
Diffstat (limited to 'APEX_1.4/module/basicfs/src')
36 files changed, 13884 insertions, 0 deletions
diff --git a/APEX_1.4/module/basicfs/src/AttractorFSActorImpl.cpp b/APEX_1.4/module/basicfs/src/AttractorFSActorImpl.cpp new file mode 100644 index 00000000..64ebc1fe --- /dev/null +++ b/APEX_1.4/module/basicfs/src/AttractorFSActorImpl.cpp @@ -0,0 +1,343 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" + +#include "Apex.h" + +#include "AttractorFSActorImpl.h" +#include "AttractorFSAsset.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" +#include "ReadCheck.h" +#include "WriteCheck.h" + +#include "PsMathUtils.h" + +namespace nvidia +{ +namespace basicfs +{ + +#define NUM_DEBUG_POINTS 512 + +AttractorFSActorImpl::AttractorFSActorImpl(const AttractorFSActorParams& params, AttractorFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : BasicFSActor(scene) + , mAsset(&asset) +{ + WRITE_ZONE(); + mFieldWeight = asset.mParams->fieldWeight; + + mPose = params.initialPose; + mScale = params.initialScale; + mRadius = mAsset->mParams->radius; + mConstFieldStrength = mAsset->mParams->constFieldStrength; + mVariableFieldStrength = mAsset->mParams->variableFieldStrength; + + list.add(*this); // Add self to asset's list of actors + addSelfToContext(*scene.getApexScene().getApexContext()); // Add self to ApexScene + addSelfToContext(scene); // Add self to BasicFSScene's list of actors + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + FieldSamplerDescIntl fieldSamplerDesc; + if (asset.mParams->fieldDragCoeff > 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DRAG; + fieldSamplerDesc.dragCoeff = asset.mParams->fieldDragCoeff; + } + else + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DIRECT; + } + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::NONE; + fieldSamplerDesc.samplerFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldSamplerFilterDataName ? params.fieldSamplerFilterDataName : mAsset->mParams->fieldSamplerFilterDataName); + fieldSamplerDesc.boundaryFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldBoundaryFilterDataName ? params.fieldBoundaryFilterDataName : mAsset->mParams->fieldBoundaryFilterDataName); + fieldSamplerDesc.boundaryFadePercentage = mAsset->mParams->boundaryFadePercentage; + + fieldSamplerManager->registerFieldSampler(this, fieldSamplerDesc, mScene); + mFieldSamplerChanged = true; + } +} + +AttractorFSActorImpl::~AttractorFSActorImpl() +{ +} + +/* Must be defined inside CPP file, since they require knowledge of asset class */ +Asset* AttractorFSActorImpl::getOwner() const +{ + READ_ZONE(); + return static_cast<Asset*>(mAsset); +} + +BasicFSAsset* AttractorFSActorImpl::getAttractorFSAsset() const +{ + READ_ZONE(); + return mAsset; +} + +void AttractorFSActorImpl::release() +{ + if (mInRelease) + { + return; + } + destroy(); +} + +void AttractorFSActorImpl::destroy() +{ + { + WRITE_ZONE(); + ApexActor::destroy(); + + setPhysXScene(NULL); + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + fieldSamplerManager->unregisterFieldSampler(this); + } + } + delete this; +} + +void AttractorFSActorImpl::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 AttractorFSActorImpl::getActiveLod() const +{ + READ_ZONE(); + APEX_INVALID_OPERATION("NxExampleActor does not support this operation"); + return -1.0f; +} + +void AttractorFSActorImpl::forceLod(float lod) +{ + WRITE_ZONE(); + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +// Called by game render thread +void AttractorFSActorImpl::updateRenderResources(bool rewriteBuffers, void* userRenderData) +{ + WRITE_ZONE(); + PX_UNUSED(rewriteBuffers); + PX_UNUSED(userRenderData); +} + +// Called by game render thread +void AttractorFSActorImpl::dispatchRenderResources(UserRenderer& renderer) +{ + READ_ZONE(); + PX_UNUSED(renderer); +} + +bool AttractorFSActorImpl::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + WRITE_ZONE(); + isEnabled = mFieldSamplerEnabled; + if (mFieldSamplerChanged) + { + mExecuteParams.origin = mPose.p; + mExecuteParams.radius = mRadius * mScale; + mExecuteParams.constFieldStrength = mConstFieldStrength * mScale; + mExecuteParams.variableFieldStrength = mVariableFieldStrength * mScale; + + shapeDesc.type = FieldShapeTypeIntl::SPHERE; + shapeDesc.worldToShape.q = PxIdentity; + shapeDesc.worldToShape.p = -mExecuteParams.origin; + shapeDesc.dimensions = PxVec3(mExecuteParams.radius, 0, 0); + shapeDesc.weight = mFieldWeight; + + mFieldSamplerChanged = false; + return true; + } + return false; +} + +void AttractorFSActorImpl::simulate(float dt) +{ + WRITE_ZONE(); + PX_UNUSED(dt); +} + +void AttractorFSActorImpl::setConstFieldStrength(float strength) +{ + WRITE_ZONE(); + mConstFieldStrength = strength; + mFieldSamplerChanged = true; +} + +void AttractorFSActorImpl::setVariableFieldStrength(float strength) +{ + WRITE_ZONE(); + mVariableFieldStrength = strength; + mFieldSamplerChanged = true; +} + +void AttractorFSActorImpl::visualize() +{ + WRITE_ZONE(); +#ifndef WITHOUT_DEBUG_VISUALIZE + if ( !mEnableDebugVisualization ) return; + RenderDebugInterface* debugRender = mScene->mDebugRender; + BasicFSDebugRenderParams* debugRenderParams = mScene->mBasicFSDebugRenderParams; + const physx::PxMat44& savedPose = *RENDER_DEBUG_IFACE(debugRender)->getPoseTyped(); + RENDER_DEBUG_IFACE(debugRender)->setIdentityPose(); + + if (!debugRenderParams->VISUALIZE_ATTRACTOR_FS_ACTOR) + { + return; + } + + if (debugRenderParams->VISUALIZE_ATTRACTOR_FS_ACTOR_NAME) + { + char buf[128]; + buf[sizeof(buf) - 1] = 0; + APEX_SPRINTF_S(buf, sizeof(buf) - 1, " %s %s", mAsset->getObjTypeName(), mAsset->getName()); + + PxVec3 textLocation = mPose.p; + + RENDER_DEBUG_IFACE(debugRender)->setCurrentTextScale(4.0f); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->debugText(textLocation, buf); + } + + if (debugRenderParams->VISUALIZE_ATTRACTOR_FS_SHAPE) + { + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); +// RENDER_DEBUG_IFACE(debugRender)->debugOrientedSphere(mExecuteParams.radius, 2, mDirToWorld); + RENDER_DEBUG_IFACE(debugRender)->debugSphere(mExecuteParams.origin, mExecuteParams.radius); + } + + if (debugRenderParams->VISUALIZE_ATTRACTOR_FS_POSE) + { + RENDER_DEBUG_IFACE(debugRender)->debugAxes(PxMat44(mPose), 1); + } + + if (debugRenderParams->VISUALIZE_ATTRACTOR_FS_FIELD) + { + if (mDebugPoints.empty()) + { + mDebugPoints.resize(NUM_DEBUG_POINTS); + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + float rx, ry, rz; + do + { + rx = physx::shdfnd::rand(-1.0f, +1.0f); + ry = physx::shdfnd::rand(-1.0f, +1.0f); + rz = physx::shdfnd::rand(-1.0f, +1.0f); + } + while (rx * rx + ry * ry + rz * rz > 1.0f); + + PxVec3& vec = mDebugPoints[i]; + + vec.x = rx; + vec.y = ry; + vec.z = rz; + } + } + + uint32_t c1 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(RENDER_DEBUG::DebugColors::Blue); + uint32_t c2 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(RENDER_DEBUG::DebugColors::Red); + + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + PxVec3 pos = mExecuteParams.origin + (mDebugPoints[i] * mExecuteParams.radius); + PxVec3 fieldVec = executeAttractorFS(mExecuteParams, pos/*, totalElapsedMS*/); + RENDER_DEBUG_IFACE(debugRender)->debugGradientLine(pos, pos + fieldVec, c1, c2); + } + } + RENDER_DEBUG_IFACE(debugRender)->setPose(savedPose); +#endif +} + +/******************************** CPU Version ********************************/ + +AttractorFSActorCPU::AttractorFSActorCPU(const AttractorFSActorParams& params, AttractorFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : AttractorFSActorImpl(params, asset, list, scene) +{ +} + +AttractorFSActorCPU::~AttractorFSActorCPU() +{ +} + +void AttractorFSActorCPU::executeFieldSampler(const ExecuteData& data) +{ + WRITE_ZONE(); + for (uint32_t iter = 0; iter < data.count; ++iter) + { + uint32_t i = data.indices[iter & data.indicesMask] + (iter & ~data.indicesMask); + PxVec3* pos = (PxVec3*)((uint8_t*)data.position + i * data.positionStride); + data.resultField[iter] = executeAttractorFS(mExecuteParams, *pos/*, totalElapsedMS*/); + } +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +AttractorFSActorGPU::AttractorFSActorGPU(const AttractorFSActorParams& params, AttractorFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : AttractorFSActorCPU(params, asset, list, scene) + , mConstMemGroup(CUDA_OBJ(fieldSamplerStorage)) +{ +} + +AttractorFSActorGPU::~AttractorFSActorGPU() +{ +} + +bool AttractorFSActorGPU::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + WRITE_ZONE(); + if (AttractorFSActorImpl::updateFieldSampler(shapeDesc, isEnabled)) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mConstMemGroup); + + if (mParamsHandle.isNull()) + { + mParamsHandle.alloc(_storage_); + } + mParamsHandle.update(_storage_, mExecuteParams); + return true; + } + return false; +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/AttractorFSAsset.cpp b/APEX_1.4/module/basicfs/src/AttractorFSAsset.cpp new file mode 100644 index 00000000..79eb8fd8 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/AttractorFSAsset.cpp @@ -0,0 +1,195 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" + +#include "AttractorFSAsset.h" +#include "AttractorFSActorImpl.h" +#include "ModuleBasicFSImpl.h" +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + +AuthObjTypeID AttractorFSAsset::mAssetTypeID; + +AttractorFSAsset::AttractorFSAsset(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + : BasicFSAssetImpl(module, name) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = static_cast<AttractorFSAssetParams*>(traits->createNvParameterized(AttractorFSAssetParams::staticClassName())); + PX_ASSERT(mParams); + + list.add(*this); +} + +AttractorFSAsset::AttractorFSAsset(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + : BasicFSAssetImpl(module, name) + , mParams(static_cast<AttractorFSAssetParams*>(params)) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + list.add(*this); +} + +AttractorFSAsset::~AttractorFSAsset() +{ +} + + +void AttractorFSAsset::destroy() +{ + if (mParams) + { + mParams->destroy(); + mParams = 0; + } + + if (mDefaultActorParams) + { + mDefaultActorParams->destroy(); + mDefaultActorParams = 0; + } + + if (mDefaultPreviewParams) + { + mDefaultPreviewParams->destroy(); + mDefaultPreviewParams = 0; + } + + + /* Actors are automatically cleaned up on deletion by ResourceList dtor */ + delete this; +} + +NvParameterized::Interface* AttractorFSAsset::getDefaultActorDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultActorParams) + { + NvParameterized::Interface* param = traits->createNvParameterized(AttractorFSActorParams::staticClassName()); + mDefaultActorParams = static_cast<AttractorFSActorParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + else + { + mDefaultActorParams->initDefaults(); + } + + return mDefaultActorParams; +} + +Actor* AttractorFSAsset::createApexActor(const NvParameterized::Interface& params, Scene& apexScene) +{ + Actor* ret = 0; + + if (nvidia::strcmp(params.className(), AttractorFSActorParams::staticClassName()) == 0) + { + const AttractorFSActorParams& actorParams = static_cast<const AttractorFSActorParams&>(params); + + BasicFSScene* es = mModule->getBasicFSScene(apexScene); + ret = es->createAttractorFSActor(actorParams, *this, mFSActors); + } + return ret; +} + + +AttractorFSPreview* AttractorFSAsset::createAttractorFSPreview(const AttractorFSPreviewDesc& desc, AssetPreviewScene* previewScene) +{ + return createAttractorFSPreviewImpl(desc, this, previewScene); +} + +AttractorFSPreview* AttractorFSAsset::createAttractorFSPreviewImpl(const AttractorFSPreviewDesc& desc, AttractorFSAsset* TurboAsset, AssetPreviewScene* previewScene) +{ + return PX_NEW(AttractorFSAssetPreview)(desc, mModule->mSdk, TurboAsset, previewScene); +} + +void AttractorFSAsset::releaseAttractorFSPreview(AttractorFSPreview& nxpreview) +{ + AttractorFSAssetPreview* preview = DYNAMIC_CAST(AttractorFSAssetPreview*)(&nxpreview); + preview->destroy(); +} + +NvParameterized::Interface* AttractorFSAsset::getDefaultAssetPreviewDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultPreviewParams) + { + const char* className = AttractorFSPreviewParams::staticClassName(); + NvParameterized::Interface* param = traits->createNvParameterized(className); + mDefaultPreviewParams = static_cast<AttractorFSPreviewParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + + return mDefaultPreviewParams; +} + +AssetPreview* AttractorFSAsset::createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene) +{ + AssetPreview* ret = 0; + + const char* className = params.className(); + if (nvidia::strcmp(className, AttractorFSPreviewParams::staticClassName()) == 0) + { + AttractorFSPreviewDesc desc; + const AttractorFSPreviewParams* pDesc = static_cast<const AttractorFSPreviewParams*>(¶ms); + + desc.mPose = pDesc->globalPose; + + desc.mPreviewDetail = 0; + if (pDesc->drawShape) + { + desc.mPreviewDetail |= APEX_ATTRACT::ATTRACT_DRAW_SHAPE; + } + if (pDesc->drawAssetInfo) + { + desc.mPreviewDetail |= APEX_ATTRACT::ATTRACT_DRAW_ASSET_INFO; + } + + ret = createAttractorFSPreview(desc, previewScene); + } + + return ret; +} + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/AttractorFSAssetPreview.cpp b/APEX_1.4/module/basicfs/src/AttractorFSAssetPreview.cpp new file mode 100644 index 00000000..5cf76370 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/AttractorFSAssetPreview.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 "ApexDefs.h" +#include "nvparameterized/NvParamUtils.h" +#include "AttractorFSAsset.h" +#include "AttractorFSAssetParams.h" +#include "AttractorFSPreview.h" +#include "AttractorFSAssetPreview.h" +#include "ModulePerfScope.h" +#include "ApexUsingNamespace.h" + +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace basicfs +{ + +using namespace APEX_ATTRACT; + +void AttractorFSAssetPreview::drawAttractorFSPreview(void) +{ + PX_PROFILE_ZONE("AttractorFSDrawPreview", GetInternalApexSDK()->getContextId()); + + if (mPreviewDetail & ATTRACT_DRAW_SHAPE) + { + drawPreviewShape(); + } +} + +#define ASSET_INFO_XPOS (-0.9f) // left position of the asset info +#define ASSET_INFO_YPOS ( 0.9f) // top position of the asset info +#define DEBUG_TEXT_HEIGHT (0.35f) //in screen space -- would be nice to know this! + + +void AttractorFSAssetPreview::drawPreviewShape() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + if (mDrawGroupBox == 0) + { + mDrawGroupBox = RENDER_DEBUG_IFACE(mApexRenderDebug)->beginDrawGroup(PxMat44(PxIdentity)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::DarkGreen)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugSphere(PxVec3(0.0f), mRadius); // * scale); + RENDER_DEBUG_IFACE(mApexRenderDebug)->endDrawGroup(); + } + + setDrawGroupsPose(); +#endif +} + +void AttractorFSAssetPreview::toggleDrawPreview() +{ + if (mPreviewDetail & ATTRACT_DRAW_SHAPE) + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupBox, true); + } + else + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupBox, false); + } +} + +void AttractorFSAssetPreview::setDrawGroupsPose() +{ + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupPose(mDrawGroupBox, mPose); +} + + +void AttractorFSAssetPreview::drawInfoLine(uint32_t lineNum, const char* str) +{ +#ifdef WITHOUT_DEBUG_VISUALIZE + PX_UNUSED(lineNum); + PX_UNUSED(str); +#else + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Green)); + PxMat44 cameraMatrix = mPreviewScene->getCameraMatrix(); + PxVec3 textLocation = mPose.getPosition(); + textLocation += cameraMatrix.column1.getXYZ() * (ASSET_INFO_YPOS - (lineNum * DEBUG_TEXT_HEIGHT)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugText(textLocation, str); +#endif +} + +void AttractorFSAssetPreview::drawPreviewAssetInfo() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + char buf[128]; + buf[sizeof(buf) - 1] = 0; + + ApexSimpleString myString; + ApexSimpleString floatStr; + uint32_t lineNum = 0; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->pushRenderState(); + // RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::ScreenSpace); + RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::NoZbuffer); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentTextScale(1.0f); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Yellow)); + + // asset name + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "%s %s", mAsset->getObjTypeName(), mAsset->getName()); + drawInfoLine(lineNum++, buf); + lineNum++; + + if(mPreviewScene->getShowFullInfo()) + { + // TODO: cache strings + AttractorFSAssetParams* assetParams = static_cast<AttractorFSAssetParams*>(mAsset->getAssetNvParameterized()); + PX_ASSERT(assetParams); + + // attractor info + float radius = assetParams->radius; + float constFieldStrength = assetParams->constFieldStrength; + float variableFieldStrength = assetParams->variableFieldStrength; + + myString = "Attractor radius = "; + ApexSimpleString::ftoa(radius, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + myString = "Constant field strength coefficient = "; + ApexSimpleString::ftoa(constFieldStrength, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + myString = "Variable field strength coefficient = "; + ApexSimpleString::ftoa(variableFieldStrength, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + // fieldSampler filter data info + if (assetParams->fieldSamplerFilterDataName.buf) + { + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "FieldSampler Filter Data = %s", + assetParams->fieldSamplerFilterDataName.buf + ); + drawInfoLine(lineNum++, buf); + } + + // fieldBoundary filter data info + if (assetParams->fieldBoundaryFilterDataName.buf) + { + myString = "FieldBoundary Filter Data = "; + myString += ApexSimpleString(assetParams->fieldBoundaryFilterDataName.buf); + drawInfoLine(lineNum++, myString.c_str()); + } + + // implicit info + myString = "Fade Percentage = "; + ApexSimpleString::ftoa(assetParams->boundaryFadePercentage, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + } + + RENDER_DEBUG_IFACE(mApexRenderDebug)->popRenderState(); +#endif +} + +AttractorFSAssetPreview::~AttractorFSAssetPreview(void) +{ + if (mApexRenderDebug) + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->reset((int32_t)mDrawGroupBox); + RENDER_DEBUG_IFACE(mApexRenderDebug)->reset(); + } +} + +void AttractorFSAssetPreview::setPose(const PxMat44& pose) +{ + mPose = pose; + setDrawGroupsPose(); +} + +const PxMat44 AttractorFSAssetPreview::getPose() const +{ + return mPose; +} + +void AttractorFSAssetPreview::setRadius(float radius) +{ + WRITE_ZONE(); + mRadius = radius; +} + +const float AttractorFSAssetPreview::getRadius() const +{ + READ_ZONE(); + return mRadius; +} + +// from RenderDataProvider +void AttractorFSAssetPreview::lockRenderResources(void) +{ + ApexRenderable::renderDataLock(); +} + +void AttractorFSAssetPreview::unlockRenderResources(void) +{ + ApexRenderable::renderDataUnLock(); +} + +void AttractorFSAssetPreview::updateRenderResources(bool /*rewriteBuffers*/, void* /*userRenderData*/) +{ + if (mApexRenderDebug) + { + mApexRenderDebug->updateRenderResources(); + } +} + +void AttractorFSAssetPreview::dispatchRenderResources(UserRenderer& renderer) +{ + if (mApexRenderDebug) + { + if (mPreviewDetail & ATTRACT_DRAW_ASSET_INFO) + { + drawPreviewAssetInfo(); + } + mApexRenderDebug->dispatchRenderResources(renderer); + } +} + +PxBounds3 AttractorFSAssetPreview::getBounds(void) const +{ + if (mApexRenderDebug) + { + return mApexRenderDebug->getBounds(); + } + else + { + PxBounds3 b; + b.setEmpty(); + return b; + } +} + +void AttractorFSAssetPreview::destroy(void) +{ + delete this; +} + +float AttractorFSAssetPreview::getAttractorRadius(NvParameterized::Interface* assetParams) +{ + float radius = 0.0f; + const char* name = "radius"; + + NvParameterized::Handle handle(*assetParams, name); + bool handleIsValid = handle.isValid(); + PX_ASSERT(handleIsValid); + PX_UNUSED(handleIsValid); + //APEX_DEBUG_WARNING("Test."); + NvParameterized::ErrorType errorGetRadius = handle.getParamF32(radius); + PX_ASSERT(errorGetRadius == NvParameterized::ERROR_NONE); + PX_UNUSED(errorGetRadius); + + return radius; + + // the other way to do it ... + //AttractorFSAssetParams* attractorAssetParams = static_cast<AttractorFSAssetParams*>(assetParams); + //PX_ASSERT(assetParams); + + //return attractorAssetParams->radius; +} + +void AttractorFSAssetPreview::release(void) +{ + if (mInRelease) + { + return; + } + mInRelease = true; + mAsset->releaseAttractorFSPreview(*this); +} + +AttractorFSAssetPreview::AttractorFSAssetPreview(const AttractorFSPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, AttractorFSAsset* mAttractorFSAsset, AssetPreviewScene* previewScene) : + mPose(PreviewDesc.mPose), + mApexSDK(myApexSDK), + mAsset(mAttractorFSAsset), + mPreviewScene(previewScene), + mPreviewDetail(PreviewDesc.mPreviewDetail), + mDrawGroupBox(0), + mApexRenderDebug(0) +{ + NvParameterized::Interface* assetParams = mAttractorFSAsset->getAssetNvParameterized(); //FIXME: const + PX_ASSERT(assetParams); + + if (assetParams) + { + mRadius = getAttractorRadius(assetParams); + } + + drawAttractorFSPreview(); +}; + + +void AttractorFSAssetPreview::setDetailLevel(uint32_t detail) +{ + READ_ZONE(); + if(detail != mPreviewDetail) + { + mPreviewDetail = detail; + toggleDrawPreview(); + } +} + +} +} // namespace nvidia + diff --git a/APEX_1.4/module/basicfs/src/BasicFSActor.cpp b/APEX_1.4/module/basicfs/src/BasicFSActor.cpp new file mode 100644 index 00000000..9408f4eb --- /dev/null +++ b/APEX_1.4/module/basicfs/src/BasicFSActor.cpp @@ -0,0 +1,59 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" + +#include "Apex.h" +#include "BasicFSActor.h" +#include "BasicFSAssetImpl.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" + +namespace nvidia +{ +namespace basicfs +{ + +#define NUM_DEBUG_POINTS 2048 + +BasicFSActor::BasicFSActor(BasicFSScene& scene) + : mScene(&scene) + , mPose(PxIdentity) + , mScale(1.0f) + , mFieldSamplerChanged(true) + , mFieldSamplerEnabled(true) + , mFieldWeight(1.0f) +{ +} + +BasicFSActor::~BasicFSActor() +{ +} + +void BasicFSActor::setPhysXScene(PxScene*) { } +PxScene* BasicFSActor::getPhysXScene() const +{ + return NULL; +} + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/BasicFSAssetImpl.cpp b/APEX_1.4/module/basicfs/src/BasicFSAssetImpl.cpp new file mode 100644 index 00000000..75446fa0 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/BasicFSAssetImpl.cpp @@ -0,0 +1,39 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "BasicFSAssetImpl.h" +#include "BasicFSActor.h" +#include "ModuleBasicFSImpl.h" +//#include "ApexSharedSerialization.h" +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + + +BasicFSAssetImpl::BasicFSAssetImpl(ModuleBasicFSImpl* module, const char* name) + : mModule(module) + , mName(name) +{ +} + +BasicFSAssetImpl::~BasicFSAssetImpl() +{ +} + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/BasicFSScene.cpp b/APEX_1.4/module/basicfs/src/BasicFSScene.cpp new file mode 100644 index 00000000..9171f30f --- /dev/null +++ b/APEX_1.4/module/basicfs/src/BasicFSScene.cpp @@ -0,0 +1,252 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "BasicFSScene.h" +#include "JetFSActorImpl.h" +#include "AttractorFSActorImpl.h" +#include "VortexFSActorImpl.h" +#include "NoiseFSActorImpl.h" +#include "WindFSActorImpl.h" + +#include "SceneIntl.h" +#include "RenderDebugInterface.h" +#include "ModulePerfScope.h" +#include "ModuleFieldSamplerIntl.h" + +#if APEX_CUDA_SUPPORT +#include "ApexCudaSource.h" +#endif + + +namespace nvidia +{ +namespace basicfs +{ + +BasicFSScene::BasicFSScene(ModuleBasicFSImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) + : mModule(&module) + , mApexScene(&scene) + , mDebugRender(debugRender) + , mFieldSamplerManager(0) +{ + list.add(*this); // Add self to module's list of BasicFSScenes + + /* Initialize reference to JetFSDebugRenderParams */ + 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(BasicFSDebugRenderParams::staticClassName(), true); + } + } + + /* Load reference to JetFSDebugRenderParams */ + NvParameterized::Interface* refPtr = NULL; + memberHandle.getParamRef(refPtr); + mBasicFSDebugRenderParams = DYNAMIC_CAST(BasicFSDebugRenderParams*)(refPtr); + PX_ASSERT(mBasicFSDebugRenderParams); +} + +BasicFSScene::~BasicFSScene() +{ +} + +void BasicFSScene::visualize() // Fix! +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mBasicFSDebugRenderParams->VISUALIZE_JET_FS_ACTOR && !mBasicFSDebugRenderParams->VISUALIZE_ATTRACTOR_FS_ACTOR && !mBasicFSDebugRenderParams->VISUALIZE_VORTEX_FS_ACTOR && !mBasicFSDebugRenderParams->VISUALIZE_NOISE_FS_ACTOR) + { + return; + } + + RENDER_DEBUG_IFACE(mDebugRender)->pushRenderState(); + // This is using the new debug rendering + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + BasicFSActor* actor = DYNAMIC_CAST(BasicFSActor*)(mActorArray[i]); // Fix! + actor->visualize(); + } + RENDER_DEBUG_IFACE(mDebugRender)->popRenderState(); +#endif +} + +void BasicFSScene::destroy() +{ + removeAllActors(); + mApexScene->moduleReleased(*this); + delete this; +} + +void BasicFSScene::setModulePhysXScene(PxScene* nxScene) +{ + if (nxScene) + { + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + BasicFSActor* actor = DYNAMIC_CAST(BasicFSActor*)(mActorArray[i]); + actor->setPhysXScene(nxScene); + } + } + else + { + for (uint32_t i = 0 ; i < mActorArray.size() ; i++) + { + BasicFSActor* actor = DYNAMIC_CAST(BasicFSActor*)(mActorArray[i]); + actor->setPhysXScene(NULL); + } + } + + mPhysXScene = nxScene; +} + +void BasicFSScene::submitTasks(float elapsedTime, float /*substepSize*/, uint32_t /*numSubSteps*/) +{ + for (uint32_t i = 0; i < mActorArray.size(); ++i) + { + BasicFSActor* actor = DYNAMIC_CAST(BasicFSActor*)(mActorArray[i]); + actor->simulate(elapsedTime); + } +} + + +// Called by ApexScene::fetchResults() with all actors render data locked. +void BasicFSScene::fetchResults() +{ + PX_PROFILE_ZONE("BasicFSSceneFetchResults", GetInternalApexSDK()->getContextId()); +} + +FieldSamplerManagerIntl* BasicFSScene::getInternalFieldSamplerManager() +{ + if (mFieldSamplerManager == NULL) + { + ModuleFieldSamplerIntl* moduleFieldSampler = mModule->getInternalModuleFieldSampler(); + if (moduleFieldSampler != NULL) + { + mFieldSamplerManager = moduleFieldSampler->getInternalFieldSamplerManager(*mApexScene); + PX_ASSERT(mFieldSamplerManager != NULL); + } + } + return mFieldSamplerManager; +} + + +/******************************** CPU Version ********************************/ + + +BasicFSSceneCPU::BasicFSSceneCPU(ModuleBasicFSImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) : + BasicFSScene(module, scene, debugRender, list) +{ +} + +BasicFSSceneCPU::~BasicFSSceneCPU() +{ +} + +JetFSActorImpl* BasicFSSceneCPU::createJetFSActor(const JetFSActorParams& params, JetFSAsset& asset, ResourceList& list) +{ + return PX_NEW(JetFSActorCPU)(params, asset, list, *this); +} + +AttractorFSActorImpl* BasicFSSceneCPU::createAttractorFSActor(const AttractorFSActorParams& params, AttractorFSAsset& asset, ResourceList& list) +{ + return PX_NEW(AttractorFSActorCPU)(params, asset, list, *this); +} + +VortexFSActorImpl* BasicFSSceneCPU::createVortexFSActor(const VortexFSActorParams& params, VortexFSAsset& asset, ResourceList& list) +{ + return PX_NEW(VortexFSActorCPU)(params, asset, list, *this); +} + +NoiseFSActorImpl* BasicFSSceneCPU::createNoiseFSActor(const NoiseFSActorParams& params, NoiseFSAsset& asset, ResourceList& list) +{ + return PX_NEW(NoiseFSActorCPU)(params, asset, list, *this); +} + +WindFSActorImpl* BasicFSSceneCPU::createWindFSActor(const WindFSActorParams& params, WindFSAsset& asset, ResourceList& list) +{ + return PX_NEW(WindFSActorCPU)(params, asset, list, *this); +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +BasicFSSceneGPU::BasicFSSceneGPU(ModuleBasicFSImpl& module, SceneIntl& scene, RenderDebugInterface* debugRender, ResourceList& list) + : BasicFSScene(module, scene, debugRender, list) + , CudaModuleScene(scene, *mModule, APEX_CUDA_TO_STR(APEX_CUDA_MODULE_PREFIX)) +{ + { + PxGpuDispatcher* gd = mApexScene->getTaskManager()->getGpuDispatcher(); + PX_ASSERT(gd != NULL); + mCtxMgr = gd->getCudaContextManager(); + PxScopedCudaLock _lock_(*mCtxMgr); + +//CUDA module objects +#include "../cuda/include/basicfs.h" + } +} + +BasicFSSceneGPU::~BasicFSSceneGPU() +{ + CudaModuleScene::destroy(*mApexScene); +} + +JetFSActorImpl* BasicFSSceneGPU::createJetFSActor(const JetFSActorParams& params, JetFSAsset& asset, ResourceList& list) +{ + return PX_NEW(JetFSActorGPU)(params, asset, list, *this); +} + +AttractorFSActorImpl* BasicFSSceneGPU::createAttractorFSActor(const AttractorFSActorParams& params, AttractorFSAsset& asset, ResourceList& list) +{ + return PX_NEW(AttractorFSActorGPU)(params, asset, list, *this); +} + +VortexFSActorImpl* BasicFSSceneGPU::createVortexFSActor(const VortexFSActorParams& params, VortexFSAsset& asset, ResourceList& list) +{ + return PX_NEW(VortexFSActorGPU)(params, asset, list, *this); +} + +NoiseFSActorImpl* BasicFSSceneGPU::createNoiseFSActor(const NoiseFSActorParams& params, NoiseFSAsset& asset, ResourceList& list) +{ + return PX_NEW(NoiseFSActorGPU)(params, asset, list, *this); +} + +WindFSActorImpl* BasicFSSceneGPU::createWindFSActor(const WindFSActorParams& params, WindFSAsset& asset, ResourceList& list) +{ + return PX_NEW(WindFSActorGPU)(params, asset, list, *this); +} + +ApexCudaConstStorage* BasicFSSceneGPU::getFieldSamplerCudaConstStorage() +{ + return &APEX_CUDA_OBJ_NAME(fieldSamplerStorage); +} + +bool BasicFSSceneGPU::launchFieldSamplerCudaKernel(const fieldsampler::FieldSamplerKernelLaunchDataIntl& launchData) +{ + LAUNCH_FIELD_SAMPLER_KERNEL(launchData); +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/JetFSActorImpl.cpp b/APEX_1.4/module/basicfs/src/JetFSActorImpl.cpp new file mode 100644 index 00000000..60aef90e --- /dev/null +++ b/APEX_1.4/module/basicfs/src/JetFSActorImpl.cpp @@ -0,0 +1,562 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" + +#include "Apex.h" +#include "JetFSActorImpl.h" +#include "JetFSAsset.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" + +#include "ReadCheck.h" +#include "WriteCheck.h" + +#include "PsMathUtils.h" + +namespace nvidia +{ +namespace basicfs +{ + +#define NUM_DEBUG_POINTS 2048 + + +JetFSActorImpl::JetFSActorImpl(const JetFSActorParams& params, JetFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : BasicFSActor(scene) + , mAsset(&asset) + , mFieldDirectionVO1(NULL) + , mFieldDirectionVO2(NULL) + , mFieldStrengthVO(NULL) +{ + WRITE_ZONE(); + mFieldWeight = asset.mParams->fieldWeight; + + mPose = params.initialPose; + mScale = params.initialScale * asset.mParams->defaultScale; + + mFieldDirection = mAsset->mParams->fieldDirection.getNormalized(); + mFieldStrength = mAsset->mParams->fieldStrength; + + mStrengthVar = 0.0f; + mLocalDirVar = PxVec3(0, 1, 0); + + mExecuteParams.noiseTimeScale = mAsset->mParams->noiseTimeScale; + mExecuteParams.noiseOctaves = mAsset->mParams->noiseOctaves; + + if (mAsset->mParams->fieldStrengthDeviationPercentage > 0 && mAsset->mParams->fieldStrengthOscillationPeriod > 0) + { + mFieldStrengthVO = PX_NEW(variableOscillator)(-mAsset->mParams->fieldStrengthDeviationPercentage, + +mAsset->mParams->fieldStrengthDeviationPercentage, + 0.0f, + mAsset->mParams->fieldStrengthOscillationPeriod); + } + + float diviationAngle = physx::shdfnd::degToRad(mAsset->mParams->fieldDirectionDeviationAngle); + if (diviationAngle > 0 && mAsset->mParams->fieldDirectionOscillationPeriod > 0) + { + mFieldDirectionVO1 = PX_NEW(variableOscillator)(-diviationAngle, + +diviationAngle, + 0, + mAsset->mParams->fieldDirectionOscillationPeriod); + + mFieldDirectionVO2 = PX_NEW(variableOscillator)(-PxTwoPi, + +PxTwoPi, + 0, + mAsset->mParams->fieldDirectionOscillationPeriod); + } + + + list.add(*this); // Add self to asset's list of actors + addSelfToContext(*scene.getApexScene().getApexContext()); // Add self to ApexScene + addSelfToContext(scene); // Add self to BasicFSScene's list of actors + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + FieldSamplerDescIntl fieldSamplerDesc; + if (asset.mParams->fieldDragCoeff > 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DRAG; + fieldSamplerDesc.dragCoeff = asset.mParams->fieldDragCoeff; + } + else + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DIRECT; + } + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::VELOCITY_PER_CELL; + fieldSamplerDesc.samplerFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldSamplerFilterDataName ? params.fieldSamplerFilterDataName : mAsset->mParams->fieldSamplerFilterDataName); + fieldSamplerDesc.boundaryFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldBoundaryFilterDataName ? params.fieldBoundaryFilterDataName : mAsset->mParams->fieldBoundaryFilterDataName); + fieldSamplerDesc.boundaryFadePercentage = mAsset->mParams->boundaryFadePercentage; + + fieldSamplerManager->registerFieldSampler(this, fieldSamplerDesc, mScene); + mFieldSamplerChanged = true; + } +} + +JetFSActorImpl::~JetFSActorImpl() +{ +} + +/* Must be defined inside CPP file, since they require knowledge of asset class */ +Asset* JetFSActorImpl::getOwner() const +{ + READ_ZONE(); + return static_cast<Asset*>(mAsset); +} + +BasicFSAsset* JetFSActorImpl::getJetFSAsset() const +{ + READ_ZONE(); + return mAsset; +} + +void JetFSActorImpl::release() +{ + if (mInRelease) + { + return; + } + destroy(); +} + +void JetFSActorImpl::destroy() +{ + { + WRITE_ZONE(); + + ApexActor::destroy(); + + setPhysXScene(NULL); + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + fieldSamplerManager->unregisterFieldSampler(this); + } + + if (mFieldStrengthVO) + { + PX_DELETE_AND_RESET(mFieldStrengthVO); + } + if (mFieldDirectionVO1) + { + PX_DELETE_AND_RESET(mFieldDirectionVO1); + } + if (mFieldDirectionVO2) + { + PX_DELETE_AND_RESET(mFieldDirectionVO2); + } + } + delete this; +} + +void JetFSActorImpl::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 JetFSActorImpl::getActiveLod() const +{ + READ_ZONE(); + APEX_INVALID_OPERATION("NxExampleActor does not support this operation"); + return -1.0f; +} + +void JetFSActorImpl::forceLod(float lod) +{ + WRITE_ZONE(); + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +// Called by game render thread +void JetFSActorImpl::updateRenderResources(bool rewriteBuffers, void* userRenderData) +{ + WRITE_ZONE(); + PX_UNUSED(rewriteBuffers); + PX_UNUSED(userRenderData); +} + +// Called by game render thread +void JetFSActorImpl::dispatchRenderResources(UserRenderer& renderer) +{ + WRITE_ZONE(); + PX_UNUSED(renderer); +} + +bool JetFSActorImpl::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + WRITE_ZONE(); + isEnabled = mFieldSamplerEnabled; + if (mFieldSamplerChanged) + { + mExecuteParams.nearRadius = mAsset->mParams->nearRadius * mScale; + mExecuteParams.pivotRadius = mAsset->mParams->pivotRadius * mScale; + mExecuteParams.farRadius = mAsset->mParams->farRadius * mScale; + mExecuteParams.directionalStretch = mAsset->mParams->directionalStretch; + mExecuteParams.averageStartDistance = mAsset->mParams->averageStartDistance * mScale; + mExecuteParams.averageEndDistance = mAsset->mParams->averageEndDistance * mScale; + + mExecuteParams.pivotRatio = (mExecuteParams.farRadius - mExecuteParams.pivotRadius) / (mExecuteParams.pivotRadius - mExecuteParams.nearRadius); + + const PxVec3 mUnit(0,1,0); + { + if ((mUnit + mFieldDirection).isZero()) + { + mDirToWorld.q = PxQuat(physx::PxPi, PxVec3(1,0,0)); + mDirToWorld.p = mPose.p; + } + else + { + const PxVec3 vecN = mPose.q.rotate(mFieldDirection); + + const PxVec3 a = mUnit.cross(vecN); + PxQuat axisRot(a.x, a.y, a.z, sqrtf(mUnit.magnitudeSquared() * vecN.magnitudeSquared()) + mUnit.dot(vecN)); + if (axisRot.w < FLT_EPSILON) + { + axisRot.w = 1.0f; + } + mDirToWorld.q = axisRot.getNormalized(); + mDirToWorld.p = mPose.p; + } + mExecuteParams.worldToDir = mDirToWorld.getInverse(); + } + { + const PxVec3 vecN = mDirToWorld.rotate(mLocalDirVar); + + const PxVec3 a = mUnit.cross(vecN); + const PxQuat axisRot(a.x, a.y, a.z, sqrtf(mUnit.magnitudeSquared() * vecN.magnitudeSquared()) + mUnit.dot(vecN)); + + PxTransform instDirToWorld; + instDirToWorld.q = axisRot.getNormalized(); + instDirToWorld.p = mPose.p; + mExecuteParams.worldToInstDir = instDirToWorld.getInverse(); + } + mExecuteParams.strength = mFieldStrength * mScale; + mExecuteParams.instStrength = mExecuteParams.strength * (1.0f + mStrengthVar); + + shapeDesc.type = FieldShapeTypeIntl::CAPSULE; + shapeDesc.dimensions = PxVec3(mExecuteParams.farRadius, mExecuteParams.farRadius * mExecuteParams.directionalStretch, 0); + shapeDesc.worldToShape = mExecuteParams.worldToDir; + shapeDesc.weight = mFieldWeight; + + float gridShapeRadius = mAsset->mParams->gridShapeRadius * mScale; + float gridShapeHeight = mAsset->mParams->gridShapeHeight * mScale; + + mExecuteParams.gridIncludeShape.type = FieldShapeTypeIntl::CAPSULE; + mExecuteParams.gridIncludeShape.dimensions = PxVec3(gridShapeRadius, gridShapeHeight, 0); + mExecuteParams.gridIncludeShape.worldToShape = mExecuteParams.worldToDir; + mExecuteParams.gridIncludeShape.weight = mFieldWeight; + mExecuteParams.gridIncludeShape.fade = mAsset->mParams->gridBoundaryFadePercentage; + + mExecuteParams.noiseStrength = mAsset->mParams->noisePercentage * mExecuteParams.strength; + mExecuteParams.noiseSpaceScale = mAsset->mParams->noiseSpaceScale / mScale; + + mFieldSamplerChanged = false; + return true; + } + return false; +} + +void JetFSActorImpl::simulate(float dt) +{ + WRITE_ZONE(); + if (mFieldStrengthVO != NULL) + { + mStrengthVar = mFieldStrengthVO->updateVariableOscillator(dt); + + mFieldSamplerChanged = true; + } + if (mFieldDirectionVO1 != NULL && mFieldDirectionVO2 != NULL) + { + float theta = mFieldDirectionVO1->updateVariableOscillator(dt); + float phi = mFieldDirectionVO2->updateVariableOscillator(dt); + + mLocalDirVar.x = PxCos(phi) * PxSin(theta); + mLocalDirVar.y = PxCos(theta); + mLocalDirVar.z = PxSin(phi) * PxSin(theta); + + mFieldSamplerChanged = true; + } +} + +void JetFSActorImpl::setFieldStrength(float strength) +{ + WRITE_ZONE(); + mFieldStrength = strength; + mFieldSamplerChanged = true; +} + +void JetFSActorImpl::setFieldDirection(const PxVec3& direction) +{ + WRITE_ZONE(); + mFieldDirection = direction.getNormalized(); + mFieldSamplerChanged = true; +} + +void JetFSActorImpl::visualize() +{ + WRITE_ZONE(); +#ifndef WITHOUT_DEBUG_VISUALIZE + if ( !mEnableDebugVisualization ) return; + RenderDebugInterface* debugRender = mScene->mDebugRender; + BasicFSDebugRenderParams* debugRenderParams = mScene->mBasicFSDebugRenderParams; + + if (!debugRenderParams->VISUALIZE_JET_FS_ACTOR) + { + return; + } + + using RENDER_DEBUG::DebugColors; + + if (debugRenderParams->VISUALIZE_JET_FS_ACTOR_NAME) + { + char buf[128]; + buf[sizeof(buf) - 1] = 0; + APEX_SPRINTF_S(buf, sizeof(buf) - 1, " %s %s", mAsset->getObjTypeName(), mAsset->getName()); + + PxVec3 textLocation = mPose.p; + + RENDER_DEBUG_IFACE(debugRender)->setCurrentTextScale(4.0f); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->debugText(textLocation, buf); + } + + if (debugRenderParams->VISUALIZE_JET_FS_SHAPE) + { + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->setPose(mDirToWorld); + RENDER_DEBUG_IFACE(debugRender)->debugCapsule(mExecuteParams.farRadius, mExecuteParams.farRadius * mExecuteParams.directionalStretch, 2); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::DarkBlue)); + RENDER_DEBUG_IFACE(debugRender)->debugCapsule(mExecuteParams.gridIncludeShape.dimensions.x, mExecuteParams.gridIncludeShape.dimensions.y, 2); + RENDER_DEBUG_IFACE(debugRender)->setPose(physx::PxIdentity); + + + //draw torus + const uint32_t NUM_PHI_SLICES = 16; + const uint32_t NUM_THETA_SLICES = 16; + + const float torusRadius = mExecuteParams.farRadius / 2; + + float cosPhiLast = 1; + float sinPhiLast = 0; + for (uint32_t i = 1; i <= NUM_PHI_SLICES; ++i) + { + float phi = (i * PxTwoPi / NUM_PHI_SLICES); + float cosPhi = PxCos(phi); + float sinPhi = PxSin(phi); + + RENDER_DEBUG_IFACE(debugRender)->debugLine( + mDirToWorld.transform(PxVec3(cosPhiLast * mExecuteParams.pivotRadius, 0, sinPhiLast * mExecuteParams.pivotRadius)), + mDirToWorld.transform(PxVec3(cosPhi * mExecuteParams.pivotRadius, 0, sinPhi * mExecuteParams.pivotRadius))); + + RENDER_DEBUG_IFACE(debugRender)->debugLine( + mDirToWorld.transform(PxVec3(cosPhiLast * mExecuteParams.nearRadius, 0, sinPhiLast * mExecuteParams.nearRadius)), + mDirToWorld.transform(PxVec3(cosPhi * mExecuteParams.nearRadius, 0, sinPhi * mExecuteParams.nearRadius))); + + float cosThetaLast = 1; + float sinThetaLast = 0; + for (uint32_t j = 1; j <= NUM_THETA_SLICES; ++j) + { + float theta = (j * PxTwoPi / NUM_THETA_SLICES); + float cosTheta = PxCos(theta); + float sinTheta = PxSin(theta); + + float d = torusRadius * (1 + cosTheta); + float h = torusRadius * sinTheta * mExecuteParams.directionalStretch; + + float dLast = torusRadius * (1 + cosThetaLast); + float hLast = torusRadius * sinThetaLast * mExecuteParams.directionalStretch; + + RENDER_DEBUG_IFACE(debugRender)->debugLine( + mDirToWorld.transform(PxVec3(cosPhi * dLast, hLast, sinPhi * dLast)), + mDirToWorld.transform(PxVec3(cosPhi * d, h, sinPhi * d))); + + RENDER_DEBUG_IFACE(debugRender)->debugLine( + mDirToWorld.transform(PxVec3(cosPhiLast * d, h, sinPhiLast * d)), + mDirToWorld.transform(PxVec3(cosPhi * d, h, sinPhi * d))); + + RENDER_DEBUG_IFACE(debugRender)->debugLine( + mDirToWorld.transform(PxVec3(cosPhiLast * dLast, hLast, sinPhiLast * dLast)), + mDirToWorld.transform(PxVec3(cosPhi * dLast, hLast, sinPhi * dLast))); + + cosThetaLast = cosTheta; + sinThetaLast = sinTheta; + } + + cosPhiLast = cosPhi; + sinPhiLast = sinPhi; + } + } + + const float spreadDistance = 0.5f * mExecuteParams.farRadius * mExecuteParams.directionalStretch; + + /* + const uint32_t CircleDivCount = 8; + for (float angle = 0; angle < PxTwoPi; angle += PxTwoPi / CircleDivCount) + { + float c1 = cos(angle); + float s1 = sin(angle); + + //RENDER_DEBUG_IFACE(debugRender)->setCurrentColor( RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::LightBlue) ); + RENDER_DEBUG_IFACE(debugRender)->debugOrientedLine( + PxVec3(innerRadius * c1, 0, innerRadius * s1), + PxVec3(outerRadius * c1, -spreadDistance, outerRadius * s1), + mLocalToWorld); + RENDER_DEBUG_IFACE(debugRender)->debugOrientedLine( + PxVec3(innerRadius * c1, 0, innerRadius * s1), + PxVec3(outerRadius * c1, +spreadDistance, outerRadius * s1), + mLocalToWorld); + } + */ + using RENDER_DEBUG::DebugColors; + + if (debugRenderParams->VISUALIZE_JET_FS_FIELD) + { + float fieldScale = debugRenderParams->JET_FS_FIELD_SCALE; + + PxVec3 rayBeg0 = mPose.p; + PxVec3 rayEnd0 = rayBeg0 + (mFieldStrength * fieldScale) * mFieldDirection; + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::DarkBlue)); + RENDER_DEBUG_IFACE(debugRender)->debugRay(rayBeg0, rayEnd0); + + + //PxVec3 rayBeg = mPose.p; + //PxVec3 rayEnd = rayBeg + (mExecuteParams.strength * fieldScale) * mExecuteParams.direction; + //RENDER_DEBUG_IFACE(debugRender)->setCurrentColor( RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue) ); + //RENDER_DEBUG_IFACE(debugRender)->debugRay(rayBeg, rayEnd); + } + if (debugRenderParams->VISUALIZE_JET_FS_POSE) + { + RENDER_DEBUG_IFACE(debugRender)->debugAxes(PxMat44(mPose), 1); + } + + if (debugRenderParams->VISUALIZE_JET_FS_FIELD) + { + if (mDebugPoints.empty()) + { + mDebugPoints.resize(NUM_DEBUG_POINTS); + + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + float rx, ry; + do + { + rx = physx::shdfnd::rand(-1.0f, +1.0f); + ry = physx::shdfnd::rand(-1.0f, +1.0f); + } + while (rx * rx + ry * ry > 1.0f); + + PxVec3& vec = mDebugPoints[i]; + + vec.x = rx; + vec.y = physx::shdfnd::rand(-1.0f, +1.0f); + vec.z = ry; + } + } + using RENDER_DEBUG::DebugColors; + uint32_t c1 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(DebugColors::Blue); + uint32_t c2 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(DebugColors::Red); + + uint32_t totalElapsedMS = mScene->getApexScene().getTotalElapsedMS(); + + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + PxVec3 localPos = mDebugPoints[i]; + localPos.x *= mExecuteParams.farRadius; + localPos.y *= spreadDistance; + localPos.z *= mExecuteParams.farRadius; + + PxVec3 pos = mDirToWorld.transform(localPos); + PxVec3 fieldVec = executeJetFS(mExecuteParams, pos, totalElapsedMS); + fieldVec *= debugRenderParams->JET_FS_FIELD_SCALE; + RENDER_DEBUG_IFACE(debugRender)->debugGradientLine(pos, pos + fieldVec, c1, c2); + } + } +#endif +} + +/******************************** CPU Version ********************************/ + +JetFSActorCPU::JetFSActorCPU(const JetFSActorParams& params, JetFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : JetFSActorImpl(params, asset, list, scene) +{ +} + +JetFSActorCPU::~JetFSActorCPU() +{ +} + +void JetFSActorCPU::executeFieldSampler(const ExecuteData& data) +{ + WRITE_ZONE(); + uint32_t totalElapsedMS = mScene->getApexScene().getTotalElapsedMS(); + for (uint32_t iter = 0; iter < data.count; ++iter) + { + uint32_t i = data.indices[iter & data.indicesMask] + (iter & ~data.indicesMask); + PxVec3* pos = (PxVec3*)((uint8_t*)data.position + i * data.positionStride); + data.resultField[iter] = executeJetFS(mExecuteParams, *pos, totalElapsedMS); + } +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +JetFSActorGPU::JetFSActorGPU(const JetFSActorParams& params, JetFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : JetFSActorCPU(params, asset, list, scene) + , mConstMemGroup(CUDA_OBJ(fieldSamplerStorage)) +{ +} + +JetFSActorGPU::~JetFSActorGPU() +{ +} + +bool JetFSActorGPU::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + WRITE_ZONE(); + if (JetFSActorImpl::updateFieldSampler(shapeDesc, isEnabled)) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mConstMemGroup); + + if (mParamsHandle.isNull()) + { + mParamsHandle.alloc(_storage_); + } + mParamsHandle.update(_storage_, mExecuteParams); + return true; + } + return false; +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/JetFSAsset.cpp b/APEX_1.4/module/basicfs/src/JetFSAsset.cpp new file mode 100644 index 00000000..931c4c4a --- /dev/null +++ b/APEX_1.4/module/basicfs/src/JetFSAsset.cpp @@ -0,0 +1,187 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "JetFSAsset.h" +#include "JetFSActorImpl.h" +#include "ModuleBasicFSImpl.h" + +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + +AuthObjTypeID JetFSAsset::mAssetTypeID; + +JetFSAsset::JetFSAsset(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + : BasicFSAssetImpl(module, name) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = static_cast<JetFSAssetParams*>(traits->createNvParameterized(JetFSAssetParams::staticClassName())); + PX_ASSERT(mParams); + + list.add(*this); +} + +JetFSAsset::JetFSAsset(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + : BasicFSAssetImpl(module, name) + , mParams(static_cast<JetFSAssetParams*>(params)) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + list.add(*this); +} + +JetFSAsset::~JetFSAsset() +{ +} + + +void JetFSAsset::destroy() +{ + if (mParams) + { + mParams->destroy(); + mParams = 0; + } + + if (mDefaultActorParams) + { + mDefaultActorParams->destroy(); + mDefaultActorParams = 0; + } + + /* Actors are automatically cleaned up on deletion by ResourceList dtor */ + delete this; +} + +NvParameterized::Interface* JetFSAsset::getDefaultActorDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultActorParams) + { + NvParameterized::Interface* param = traits->createNvParameterized(JetFSActorParams::staticClassName()); + mDefaultActorParams = static_cast<JetFSActorParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + else + { + mDefaultActorParams->initDefaults(); + } + + return mDefaultActorParams; +} + +Actor* JetFSAsset::createApexActor(const NvParameterized::Interface& params, Scene& apexScene) +{ + Actor* ret = 0; + + if (nvidia::strcmp(params.className(), JetFSActorParams::staticClassName()) == 0) + { + const JetFSActorParams& actorParams = static_cast<const JetFSActorParams&>(params); + + BasicFSScene* es = mModule->getBasicFSScene(apexScene); + ret = es->createJetFSActor(actorParams, *this, mFSActors); + } + return ret; +} + +NvParameterized::Interface* JetFSAsset::getDefaultAssetPreviewDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultPreviewParams) + { + const char* className = JetFSPreviewParams::staticClassName(); + NvParameterized::Interface* param = traits->createNvParameterized(className); + mDefaultPreviewParams = static_cast<JetFSPreviewParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + + return mDefaultPreviewParams; +} + +AssetPreview* JetFSAsset::createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene) +{ + AssetPreview* ret = 0; + + const char* className = params.className(); + if (nvidia::strcmp(className, JetFSPreviewParams::staticClassName()) == 0) + { + JetFSPreviewDesc desc; + const JetFSPreviewParams* pDesc = static_cast<const JetFSPreviewParams*>(¶ms); + + desc.mPose = pDesc->globalPose; + + desc.mPreviewDetail = 0; + if (pDesc->drawShape) + { + desc.mPreviewDetail |= APEX_JET::JET_DRAW_SHAPE; + } + if (pDesc->drawAssetInfo) + { + desc.mPreviewDetail |= APEX_JET::JET_DRAW_ASSET_INFO; + } + + ret = createJetFSPreview(desc, previewScene); + } + + return ret; +} + +JetFSPreview* JetFSAsset::createJetFSPreview(const JetFSPreviewDesc& desc, AssetPreviewScene* previewScene) +{ + return createJetFSPreviewImpl(desc, this, previewScene); +} + +JetFSPreview* JetFSAsset::createJetFSPreviewImpl(const JetFSPreviewDesc& desc, JetFSAsset* jetAsset, AssetPreviewScene* previewScene) +{ + return PX_NEW(JetFSAssetPreview)(desc, mModule->mSdk, jetAsset, previewScene); +} + +void JetFSAsset::releaseJetFSPreview(JetFSPreview& nxpreview) +{ + JetFSAssetPreview* preview = DYNAMIC_CAST(JetFSAssetPreview*)(&nxpreview); + preview->destroy(); +} + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/JetFSAssetPreview.cpp b/APEX_1.4/module/basicfs/src/JetFSAssetPreview.cpp new file mode 100644 index 00000000..0ab529e3 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/JetFSAssetPreview.cpp @@ -0,0 +1,362 @@ +/* + * 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 "ApexDefs.h" +#include "nvparameterized/NvParamUtils.h" +#include "JetFSAsset.h" +#include "JetFSAssetParams.h" +#include "JetFSPreview.h" +#include "JetFSAssetPreview.h" +#include "ModulePerfScope.h" +#include "ApexUsingNamespace.h" + +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace basicfs +{ + +using namespace APEX_JET; + +void JetFSAssetPreview::drawJetFSPreview(void) +{ + PX_PROFILE_ZONE("JetFSDrawPreview", GetInternalApexSDK()->getContextId()); + if (mPreviewDetail & JET_DRAW_SHAPE) + { + drawShape(); + } + + toggleDrawPreview(); + setDrawGroupsPose(); +} + +#define ASSET_INFO_XPOS (-0.9f) // left position of the asset info +#define ASSET_INFO_YPOS ( 0.9f) // top position of the asset info +#define DEBUG_TEXT_HEIGHT (0.35f) //in screen space -- would be nice to know this! + + + +void JetFSAssetPreview::drawInfoLine(uint32_t lineNum, const char* str) +{ +#ifdef WITHOUT_DEBUG_VISUALIZE + PX_UNUSED(lineNum); + PX_UNUSED(str); +#else + if (!mApexRenderDebug) + { + return; + } + PxMat44 cameraMatrix = mPreviewScene->getCameraMatrix(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); + PxVec3 textLocation = mPose.getPosition(); + textLocation += cameraMatrix.column1.getXYZ() * (ASSET_INFO_YPOS - (lineNum * DEBUG_TEXT_HEIGHT)); + cameraMatrix.setPosition(textLocation); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugText(textLocation, str); +#endif +} + +void JetFSAssetPreview::drawPreviewAssetInfo() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + char buf[128]; + buf[sizeof(buf) - 1] = 0; + + ApexSimpleString myString; + ApexSimpleString floatStr; + uint32_t lineNum = 0; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->pushRenderState(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::NoZbuffer); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentTextScale(1.0f); + + // asset name + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "%s %s", mAsset->getObjTypeName(), mAsset->getName()); + drawInfoLine(lineNum++, buf); + lineNum++; + + if(mPreviewScene->getShowFullInfo()) + { + // TODO: cache strings + JetFSAssetParams& assetParams = *static_cast<JetFSAssetParams*>(mAsset->getAssetNvParameterized()); + + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "fieldStrength = %f", + assetParams.fieldStrength + ); + drawInfoLine(lineNum++, buf); + + + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "fieldStrengthDeviationPercentage = %f", + assetParams.fieldStrengthDeviationPercentage + ); + drawInfoLine(lineNum++, buf); + + + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "fieldDirectionDeviationAngle = %f", + assetParams.fieldDirectionDeviationAngle + ); + drawInfoLine(lineNum++, buf); + + // fieldBoundary filter data info + if (assetParams.fieldBoundaryFilterDataName.buf) + { + myString = "FieldBoundary Filter Data = "; + myString += ApexSimpleString(assetParams.fieldBoundaryFilterDataName.buf); + drawInfoLine(lineNum++, myString.c_str()); + } + + // implicit info + myString = "Fade Percentage = "; + ApexSimpleString::ftoa(assetParams.boundaryFadePercentage, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + } + RENDER_DEBUG_IFACE(mApexRenderDebug)->popRenderState(); +#endif +} + +void JetFSAssetPreview::drawShape() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + JetFSAssetParams& assetParams = *static_cast<JetFSAssetParams*>(mAsset->getAssetNvParameterized()); + //asset preview init + if (mDrawGroupShape == 0) + { + mDrawGroupShape = RENDER_DEBUG_IFACE(mApexRenderDebug)->beginDrawGroup(PxMat44(PxIdentity)); + + //debug visualization + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::DarkBlue)); + + PxMat44 dirToWorld = PxMat44(PxVec4(mDirToWorld.column0, 0), PxVec4(mDirToWorld.column1, 0), PxVec4(mDirToWorld.column2, 0), PxVec4(0, 0, 0, 1)); + //dirToWorld.setPosition(mPose.getPosition()); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setPose(dirToWorld); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugCapsule(assetParams.farRadius, assetParams.farRadius * assetParams.directionalStretch, 2); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setPose(dirToWorld); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugCapsule(assetParams.gridShapeRadius, assetParams.gridShapeHeight, 2); + RENDER_DEBUG_IFACE(mApexRenderDebug)->endDrawGroup(); + } + + if(mDrawGroupTorus == 0) + { + //draw torus + //RENDER_DEBUG_IFACE(&mApexRenderDebug)->setPose(mPose);??? + + mDrawGroupTorus = RENDER_DEBUG_IFACE(mApexRenderDebug)->beginDrawGroup(PxMat44(PxIdentity)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::DarkBlue)); + const uint32_t NUM_PHI_SLICES = 16; + const uint32_t NUM_THETA_SLICES = 16; + + const float torusRadius = assetParams.farRadius / 2; + + float cosPhiLast = 1; + float sinPhiLast = 0; + for (uint32_t i = 1; i <= NUM_PHI_SLICES; ++i) + { + float phi = (i * PxTwoPi / NUM_PHI_SLICES); + float cosPhi = PxCos(phi); + float sinPhi = PxSin(phi); + + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugLine( + mDirToWorld * PxVec3(cosPhiLast * assetParams.pivotRadius, 0, sinPhiLast * assetParams.pivotRadius), + mDirToWorld * PxVec3(cosPhi * assetParams.pivotRadius, 0, sinPhi * assetParams.pivotRadius)); + + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugLine( + mDirToWorld * PxVec3(cosPhiLast * assetParams.nearRadius, 0, sinPhiLast * assetParams.nearRadius), + mDirToWorld * PxVec3(cosPhi * assetParams.nearRadius, 0, sinPhi * assetParams.nearRadius)); + + float cosThetaLast = 1; + float sinThetaLast = 0; + for (uint32_t j = 1; j <= NUM_THETA_SLICES; ++j) + { + float theta = (j * PxTwoPi / NUM_THETA_SLICES); + float cosTheta = PxCos(theta); + float sinTheta = PxSin(theta); + + float d = torusRadius * (1 + cosTheta); + float h = torusRadius * sinTheta * assetParams.directionalStretch; + + float dLast = torusRadius * (1 + cosThetaLast); + float hLast = torusRadius * sinThetaLast * assetParams.directionalStretch; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugLine( + mDirToWorld * PxVec3(cosPhi * dLast, hLast, sinPhi * dLast), + mDirToWorld * PxVec3(cosPhi * d, h, sinPhi * d)); + + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugLine( + mDirToWorld * PxVec3(cosPhiLast * d, h, sinPhiLast * d), + mDirToWorld * PxVec3(cosPhi * d, h, sinPhi * d)); + + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugLine( + mDirToWorld * PxVec3(cosPhiLast * dLast, hLast, sinPhiLast * dLast), + mDirToWorld * PxVec3(cosPhi * dLast, hLast, sinPhi * dLast)); + + cosThetaLast = cosTheta; + sinThetaLast = sinTheta; + } + + cosPhiLast = cosPhi; + sinPhiLast = sinPhi; + } + RENDER_DEBUG_IFACE(mApexRenderDebug)->endDrawGroup(); + } +#endif +} + +JetFSAssetPreview::~JetFSAssetPreview(void) +{ +} + +void JetFSAssetPreview::setPose(const PxMat44& pose) +{ + mPose = pose; + setDrawGroupsPose(); +} + +const PxMat44 JetFSAssetPreview::getPose() const +{ + return mPose; +} + +void JetFSAssetPreview::toggleDrawPreview() +{ + if (!mApexRenderDebug) + { + return; + } + if (mPreviewDetail & JET_DRAW_SHAPE) + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupShape, true); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupTorus, true); + } + else + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupShape, false); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupTorus, false); + } +} + +void JetFSAssetPreview::setDrawGroupsPose() +{ + if (!mApexRenderDebug) + { + return; + } + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupPose(mDrawGroupShape, mPose); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupPose(mDrawGroupTorus, mPose); +} + + +// from RenderDataProvider +void JetFSAssetPreview::lockRenderResources(void) +{ + ApexRenderable::renderDataLock(); +} + +void JetFSAssetPreview::unlockRenderResources(void) +{ + ApexRenderable::renderDataUnLock(); +} + +void JetFSAssetPreview::updateRenderResources(bool /*rewriteBuffers*/, void* /*userRenderData*/) +{ + if (mApexRenderDebug) + { + mApexRenderDebug->updateRenderResources(); + } +} + +// from Renderable.h +void JetFSAssetPreview::dispatchRenderResources(UserRenderer& renderer) +{ + if (mApexRenderDebug) + { + if (mPreviewDetail & JET_DRAW_ASSET_INFO) + { + drawPreviewAssetInfo(); + } + mApexRenderDebug->dispatchRenderResources(renderer); + } +} + +PxBounds3 JetFSAssetPreview::getBounds(void) const +{ + if (mApexRenderDebug) + { + return mApexRenderDebug->getBounds(); + } + else + { + PxBounds3 b; + b.setEmpty(); + return b; + } +} + +void JetFSAssetPreview::destroy(void) +{ + delete this; +} + +void JetFSAssetPreview::release(void) +{ + if (mInRelease) + { + return; + } + mInRelease = true; + mAsset->releaseJetFSPreview(*this); +} + +JetFSAssetPreview::JetFSAssetPreview(const JetFSPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, JetFSAsset* myJetFSAsset, AssetPreviewScene* previewScene) : + mPose(PreviewDesc.mPose), + mApexSDK(myApexSDK), + mAsset(myJetFSAsset), + mPreviewScene(previewScene), + mPreviewDetail(PreviewDesc.mPreviewDetail), + mDrawGroupShape(0), + mDrawGroupTorus(0), + mApexRenderDebug(0) +{ + PxMat33 poseRot = PxMat33(mPose.column0.getXYZ(), mPose.column1.getXYZ(), mPose.column2.getXYZ()); + PxVec3 vecN = poseRot.transform(mAsset->mParams->fieldDirection.getNormalized()); + vecN.normalize(); + PxVec3 vecP, vecQ; + BuildPlaneBasis(vecN, vecP, vecQ); + + mDirToWorld.column0 = vecP; + mDirToWorld.column1 = vecN; + mDirToWorld.column2 = vecQ; + + drawJetFSPreview(); +}; + + +void JetFSAssetPreview::setDetailLevel(uint32_t detail) +{ + WRITE_ZONE(); + mPreviewDetail = detail; + setDrawGroupsPose(); +} + +} +} // namespace nvidia + diff --git a/APEX_1.4/module/basicfs/src/ModuleBasicFSImpl.cpp b/APEX_1.4/module/basicfs/src/ModuleBasicFSImpl.cpp new file mode 100644 index 00000000..c065b72e --- /dev/null +++ b/APEX_1.4/module/basicfs/src/ModuleBasicFSImpl.cpp @@ -0,0 +1,405 @@ +/* + * 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 "ApexDefs.h" + +#include "Apex.h" + +/* === ModuleBasicFSImpl DLL Setup === */ + +#include "ModuleBasicFSImpl.h" +#include "ModuleBasicFSRegistration.h" +#include "ModulePerfScope.h" +//#include "BasicFSAsset.h" +#include "JetFSAsset.h" +#include "AttractorFSAsset.h" +#include "VortexFSAsset.h" +#include "NoiseFSAsset.h" +#include "WindFSAsset.h" +#include "BasicFSScene.h" +#include "SceneIntl.h" +#include "PsMemoryBuffer.h" +//#include "BasicFSActor.h" +#include "JetFSActorImpl.h" +#include "AttractorFSActorImpl.h" +#include "VortexFSActorImpl.h" +#include "NoiseFSActorImpl.h" +#include "WindFSActorImpl.h" +#include "ModuleFieldSamplerIntl.h" + +using namespace basicfs; + +#include "Lock.h" +#include "ReadCheck.h" +#include "WriteCheck.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; + } + + gApexSdk = inSdk; + ModuleBasicFSImpl* impl = PX_NEW(ModuleBasicFS)(inSdk); + *niRef = (ModuleIntl*) impl; + return (Module*) impl; +} + +#else +/* Statically linking entry function */ +void instantiateModuleBasicFS() +{ + ApexSDKIntl* sdk = GetInternalApexSDK(); + nvidia::basicfs::ModuleBasicFSImpl* impl = PX_NEW(nvidia::basicfs::ModuleBasicFSImpl)(sdk); + sdk->registerExternalModule((Module*) impl, (ModuleIntl*) impl); +} +#endif // `defined(_USRDLL) +} + +namespace basicfs +{ +/* === ModuleBasicFSImpl Implementation === */ + +#ifdef WITHOUT_APEX_AUTHORING + +class BasicFSAssetDummyAuthoring : public AssetAuthoring, public UserAllocated +{ +public: + BasicFSAssetDummyAuthoring(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + { + PX_UNUSED(module); + PX_UNUSED(list); + PX_UNUSED(params); + PX_UNUSED(name); + } + + BasicFSAssetDummyAuthoring(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + { + PX_UNUSED(module); + PX_UNUSED(list); + PX_UNUSED(name); + } + + BasicFSAssetDummyAuthoring(ModuleBasicFSImpl* 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; + } + + const char* getName(void) const + { + return NULL; + } + + /** + * \brief Returns the name of this APEX authorable object type + */ + virtual const char* getObjTypeName() const + { + return JetFSAsset::getClassName(); // Fix + } + + /** + * \brief Prepares a fully authored Asset Authoring object for a specified platform + */ + virtual bool prepareForPlatform(nvidia::apex::PlatformTag) + { + PX_ASSERT(0); + return false; + } + + /** + * \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<ModuleBasicFSImpl, JetFSAsset, JetFSAssetAuthoring> JetFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, AttractorFSAsset, AttractorFSAssetAuthoring> AttractorFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, VortexFSAsset, VortexFSAssetAuthoring> VortexFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, NoiseFSAsset, NoiseFSAssetAuthoring> NoiseFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, WindFSAsset, WindFSAssetAuthoring> WindFSAO; + +#else +typedef ApexAuthorableObject<ModuleBasicFSImpl, JetFSAsset, JetFSAssetAuthoring> JetFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, AttractorFSAsset, AttractorFSAssetAuthoring> AttractorFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, VortexFSAsset, VortexFSAssetAuthoring> VortexFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, NoiseFSAsset, NoiseFSAssetAuthoring> NoiseFSAO; +typedef ApexAuthorableObject<ModuleBasicFSImpl, WindFSAsset, WindFSAssetAuthoring> WindFSAO; +#endif + +ModuleBasicFSImpl::ModuleBasicFSImpl(ApexSDKIntl* sdk) +{ + mName = "BasicFS"; + mSdk = sdk; + mApiProxy = this; + mModuleParams = NULL; + mFieldSamplerModule = NULL; + + /* Register asset type and create a namespace for its assets */ + const char* pName1 = JetFSAssetParams::staticClassName(); + JetFSAO* eAO1 = PX_NEW(JetFSAO)(this, mAuthorableObjects, pName1); + JetFSAsset::mAssetTypeID = eAO1->getResID(); + + const char* pName2 = AttractorFSAssetParams::staticClassName(); + AttractorFSAO* eAO2 = PX_NEW(AttractorFSAO)(this, mAuthorableObjects, pName2); + AttractorFSAsset::mAssetTypeID = eAO2->getResID(); + + const char* pName3 = NoiseFSAssetParams::staticClassName(); + NoiseFSAO* eAO3 = PX_NEW(NoiseFSAO)(this, mAuthorableObjects, pName3); + NoiseFSAsset::mAssetTypeID = eAO3->getResID(); + + const char* pName4 = VortexFSAssetParams::staticClassName(); + VortexFSAO* eAO4 = PX_NEW(VortexFSAO)(this, mAuthorableObjects, pName4); + VortexFSAsset::mAssetTypeID = eAO4->getResID(); + + const char* pName5 = WindFSAssetParams::staticClassName(); + WindFSAO* eAO5 = PX_NEW(WindFSAO)(this, mAuthorableObjects, pName5); + WindFSAsset::mAssetTypeID = eAO5->getResID(); + + /* Register the NvParameterized factories */ + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + ModuleBasicFSRegistration::invokeRegistration(traits); +} + +ModuleBasicFSImpl::~ModuleBasicFSImpl() +{ +} + +void ModuleBasicFSImpl::destroy() +{ + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + + if (mModuleParams) + { + mModuleParams->destroy(); + mModuleParams = NULL; + } + + ModuleBase::destroy(); + + if (traits) + { + /* Remove the NvParameterized factories */ + ModuleBasicFSRegistration::invokeUnregistration(traits); + } + delete this; +} + + +void ModuleBasicFSImpl::init(NvParameterized::Interface&) +{ +} + +NvParameterized::Interface* ModuleBasicFSImpl::getDefaultModuleDesc() +{ + WRITE_ZONE(); + NvParameterized::Traits* traits = mSdk->getParameterizedTraits(); + + if (!mModuleParams) + { + mModuleParams = DYNAMIC_CAST(BasicFSModuleParameters*) + (traits->createNvParameterized("BasicFSModuleParameters")); + PX_ASSERT(mModuleParams); + } + else + { + mModuleParams->initDefaults(); + } + + return mModuleParams; +} + +AuthObjTypeID ModuleBasicFSImpl::getJetFSAssetTypeID() const +{ + return JetFSAsset::mAssetTypeID; +} + +AuthObjTypeID ModuleBasicFSImpl::getAttractorFSAssetTypeID() const +{ + return AttractorFSAsset::mAssetTypeID; +} + +AuthObjTypeID ModuleBasicFSImpl::getVortexFSAssetTypeID() const +{ + return VortexFSAsset::mAssetTypeID; +} + +AuthObjTypeID ModuleBasicFSImpl::getNoiseFSAssetTypeID() const +{ + return NoiseFSAsset::mAssetTypeID; +} + +AuthObjTypeID ModuleBasicFSImpl::getWindFSAssetTypeID() const +{ + return WindFSAsset::mAssetTypeID; +} + +AuthObjTypeID ModuleBasicFSImpl::getModuleID() const +{ + return JetFSAsset::mAssetTypeID; // What should return? +} + +ApexActor* ModuleBasicFSImpl::getApexActor(Actor* nxactor, AuthObjTypeID type) const +{ + if (type == JetFSAsset::mAssetTypeID) + { + return static_cast<JetFSActorImpl*>(nxactor); + } + else if (type == AttractorFSAsset::mAssetTypeID) + { + return static_cast<AttractorFSActorImpl*>(nxactor); + } + else if (type == VortexFSAsset::mAssetTypeID) + { + return static_cast<VortexFSActorImpl*>(nxactor); + } + else if (type == NoiseFSAsset::mAssetTypeID) + { + return static_cast<NoiseFSActorImpl*>(nxactor); + } + else if (type == WindFSAsset::mAssetTypeID) + { + return static_cast<WindFSActorImpl*>(nxactor); + } + + return NULL; +} + +/* == Example Scene methods == */ +ModuleSceneIntl* ModuleBasicFSImpl::createInternalModuleScene(SceneIntl& scene, RenderDebugInterface* debugRender) +{ +#if APEX_CUDA_SUPPORT + READ_LOCK(scene); + if (scene.getTaskManager()->getGpuDispatcher()) + { + return PX_NEW(BasicFSSceneGPU)(*this, scene, debugRender, mBasicFSScenes); + } + else +#endif + return PX_NEW(BasicFSSceneCPU)(*this, scene, debugRender, mBasicFSScenes); +} + +void ModuleBasicFSImpl::releaseModuleSceneIntl(ModuleSceneIntl& scene) +{ + BasicFSScene* es = DYNAMIC_CAST(BasicFSScene*)(&scene); + es->destroy(); +} + +BasicFSScene* ModuleBasicFSImpl::getBasicFSScene(const Scene& apexScene) +{ + for (uint32_t i = 0 ; i < mBasicFSScenes.getSize() ; i++) + { + BasicFSScene* es = DYNAMIC_CAST(BasicFSScene*)(mBasicFSScenes.getResource(i)); + if (es->mApexScene == &apexScene) + { + return es; + } + } + + PX_ASSERT(!"Unable to locate an appropriate BasicFSScene"); + return NULL; +} + +RenderableIterator* ModuleBasicFSImpl::createRenderableIterator(const Scene& apexScene) +{ + WRITE_ZONE(); + BasicFSScene* es = getBasicFSScene(apexScene); + if (es) + { + return es->createRenderableIterator(); + } + + return NULL; +} + +ModuleFieldSamplerIntl* ModuleBasicFSImpl::getInternalModuleFieldSampler() +{ + if (!mFieldSamplerModule) + { + ModuleIntl* nim = mSdk->getInternalModuleByName("FieldSampler"); + if (nim) + { + mFieldSamplerModule = DYNAMIC_CAST(ModuleFieldSamplerIntl*)(nim); + } + } + + return mFieldSamplerModule; +} + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/NoiseFSActorImpl.cpp b/APEX_1.4/module/basicfs/src/NoiseFSActorImpl.cpp new file mode 100644 index 00000000..30a5a919 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/NoiseFSActorImpl.cpp @@ -0,0 +1,311 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" + +#include "Apex.h" +#include "NoiseFSActorImpl.h" +#include "NoiseFSAsset.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" + +namespace nvidia +{ +namespace basicfs +{ + +NoiseFSActorImpl::NoiseFSActorImpl(const NoiseFSActorParams& params, NoiseFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : BasicFSActor(scene) + , mAsset(&asset) +{ + mFieldWeight = asset.mParams->fieldWeight; + + mPose = params.initialPose; + mScale = params.initialScale * asset.mParams->defaultScale; + + mExecuteParams.useLocalSpace = mAsset->mParams->useLocalSpace; + + mExecuteParams.noiseTimeFreq = 1.0f / mAsset->mParams->noiseTimePeriod; + mExecuteParams.noiseOctaves = mAsset->mParams->noiseOctaves; + mExecuteParams.noiseStrengthOctaveMultiplier = mAsset->mParams->noiseStrengthOctaveMultiplier; + mExecuteParams.noiseSpaceFreqOctaveMultiplier = PxVec3(1.0f / mAsset->mParams->noiseSpacePeriodOctaveMultiplier.x, 1.0f / mAsset->mParams->noiseSpacePeriodOctaveMultiplier.y, 1.0f / mAsset->mParams->noiseSpacePeriodOctaveMultiplier.z); + mExecuteParams.noiseTimeFreqOctaveMultiplier = 1.0f / mAsset->mParams->noiseTimePeriodOctaveMultiplier; + + if (nvidia::strcmp(mAsset->mParams->noiseType, "CURL") == 0) + { + mExecuteParams.noiseType = NoiseType::CURL; + } + else + { + mExecuteParams.noiseType = NoiseType::SIMPLEX; + } + mExecuteParams.noiseSeed = mAsset->mParams->noiseSeed; + + list.add(*this); // Add self to asset's list of actors + addSelfToContext(*scene.getApexScene().getApexContext()); // Add self to ApexScene + addSelfToContext(scene); // Add self to BasicFSScene's list of actors + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + FieldSamplerDescIntl fieldSamplerDesc; + + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::VELOCITY_PER_CELL; + if (nvidia::strcmp(mAsset->mParams->fieldType, "FORCE") == 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::FORCE; + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::NONE; + } + else if (nvidia::strcmp(mAsset->mParams->fieldType, "VELOCITY_DRAG") == 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DRAG; + fieldSamplerDesc.dragCoeff = mAsset->mParams->fieldDragCoeff; + } + else + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DIRECT; + } + fieldSamplerDesc.samplerFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldSamplerFilterDataName ? params.fieldSamplerFilterDataName : mAsset->mParams->fieldSamplerFilterDataName); + fieldSamplerDesc.boundaryFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldBoundaryFilterDataName ? params.fieldBoundaryFilterDataName : mAsset->mParams->fieldBoundaryFilterDataName); + fieldSamplerDesc.boundaryFadePercentage = mAsset->mParams->boundaryFadePercentage; + + fieldSamplerManager->registerFieldSampler(this, fieldSamplerDesc, mScene); + mFieldSamplerChanged = true; + } +} + +NoiseFSActorImpl::~NoiseFSActorImpl() +{ +} + +/* Must be defined inside CPP file, since they require knowledge of asset class */ +Asset* NoiseFSActorImpl::getOwner() const +{ + return static_cast<Asset*>(mAsset); +} + +BasicFSAsset* NoiseFSActorImpl::getNoiseFSAsset() const +{ + READ_ZONE(); + return mAsset; +} + +void NoiseFSActorImpl::release() +{ + if (mInRelease) + { + return; + } + destroy(); +} + +void NoiseFSActorImpl::destroy() +{ + { + WRITE_ZONE(); + ApexActor::destroy(); + + setPhysXScene(NULL); + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + fieldSamplerManager->unregisterFieldSampler(this); + } + } + + delete this; +} + +void NoiseFSActorImpl::getLodRange(float& min, float& max, bool& intOnly) const +{ + PX_UNUSED(min); + PX_UNUSED(max); + PX_UNUSED(intOnly); + APEX_INVALID_OPERATION("not implemented"); +} + +float NoiseFSActorImpl::getActiveLod() const +{ + APEX_INVALID_OPERATION("NxExampleActor does not support this operation"); + return -1.0f; +} + +void NoiseFSActorImpl::forceLod(float lod) +{ + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +// Called by game render thread +void NoiseFSActorImpl::updateRenderResources(bool rewriteBuffers, void* userRenderData) +{ + PX_UNUSED(rewriteBuffers); + PX_UNUSED(userRenderData); +} + +// Called by game render thread +void NoiseFSActorImpl::dispatchRenderResources(UserRenderer& renderer) +{ + PX_UNUSED(renderer); +} + +bool NoiseFSActorImpl::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + PX_UNUSED(shapeDesc); + + isEnabled = mFieldSamplerEnabled; + if (mFieldSamplerChanged) + { + mExecuteParams.worldToShape = mPose.getInverse(); + + PxVec3 noiseSpacePeriod = mAsset->mParams->noiseSpacePeriod * mScale; + mExecuteParams.noiseSpaceFreq = PxVec3(1.0f / noiseSpacePeriod.x, 1.0f / noiseSpacePeriod.y, 1.0f / noiseSpacePeriod.z); + mExecuteParams.noiseStrength = mAsset->mParams->noiseStrength * mScale; + + shapeDesc.type = FieldShapeTypeIntl::BOX; + shapeDesc.worldToShape = mExecuteParams.worldToShape; + shapeDesc.dimensions = mAsset->mParams->boundarySize * (mScale * 0.5f); + shapeDesc.weight = mFieldWeight; + + mFieldSamplerChanged = false; + return true; + } + return false; +} + +void NoiseFSActorImpl::simulate(float ) +{ +} + +void NoiseFSActorImpl::setNoiseStrength(float strength) +{ + WRITE_ZONE(); + mExecuteParams.noiseStrength = strength; + mFieldSamplerChanged = true; +} + +void NoiseFSActorImpl::visualize() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if ( !mEnableDebugVisualization ) return; + RenderDebugInterface* debugRender = mScene->mDebugRender; + BasicFSDebugRenderParams* debugRenderParams = mScene->mBasicFSDebugRenderParams; + + if (!debugRenderParams->VISUALIZE_NOISE_FS_ACTOR) + { + return; + } + + const physx::PxMat44& savedPose = *RENDER_DEBUG_IFACE(debugRender)->getPoseTyped(); + RENDER_DEBUG_IFACE(debugRender)->setIdentityPose(); + + using RENDER_DEBUG::DebugColors; + + if (debugRenderParams->VISUALIZE_NOISE_FS_ACTOR_NAME) + { + char buf[128]; + buf[sizeof(buf) - 1] = 0; + APEX_SPRINTF_S(buf, sizeof(buf) - 1, " %s %s", mAsset->getObjTypeName(), mAsset->getName()); + + PxMat44 cameraFacingPose(mScene->mApexScene->getViewMatrix(0).inverseRT()); + PxVec3 textLocation = mPose.p; + + RENDER_DEBUG_IFACE(debugRender)->setCurrentTextScale(4.0f); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->debugText(textLocation, buf); + } + + if (debugRenderParams->VISUALIZE_NOISE_FS_SHAPE) + { + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + + PxVec3 shapeSides = mScale * mAsset->mParams->boundarySize; + RENDER_DEBUG_IFACE(debugRender)->setPose(mPose); + RENDER_DEBUG_IFACE(debugRender)->debugBound( PxBounds3(PxVec3(0.0f), shapeSides) ); + } + if (debugRenderParams->VISUALIZE_NOISE_FS_POSE) + { + RENDER_DEBUG_IFACE(debugRender)->debugAxes(PxMat44(mPose), 1); + } + RENDER_DEBUG_IFACE(debugRender)->setPose(savedPose); +#endif +} + +/******************************** CPU Version ********************************/ + +NoiseFSActorCPU::NoiseFSActorCPU(const NoiseFSActorParams& params, NoiseFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : NoiseFSActorImpl(params, asset, list, scene) +{ +} + +NoiseFSActorCPU::~NoiseFSActorCPU() +{ +} + +void NoiseFSActorCPU::executeFieldSampler(const ExecuteData& data) +{ + uint32_t totalElapsedMS = mScene->getApexScene().getTotalElapsedMS(); + for (uint32_t iter = 0; iter < data.count; ++iter) + { + uint32_t i = data.indices[iter & data.indicesMask] + (iter & ~data.indicesMask); + PxVec3* pos = (PxVec3*)((uint8_t*)data.position + i * data.positionStride); + data.resultField[iter] = executeNoiseFS(mExecuteParams, *pos, totalElapsedMS); + } +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +NoiseFSActorGPU::NoiseFSActorGPU(const NoiseFSActorParams& params, NoiseFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : NoiseFSActorCPU(params, asset, list, scene) + , mConstMemGroup(CUDA_OBJ(fieldSamplerStorage)) +{ +} + +NoiseFSActorGPU::~NoiseFSActorGPU() +{ +} + +bool NoiseFSActorGPU::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + if (NoiseFSActorImpl::updateFieldSampler(shapeDesc, isEnabled)) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mConstMemGroup); + + if (mParamsHandle.isNull()) + { + mParamsHandle.alloc(_storage_); + } + mParamsHandle.update(_storage_, mExecuteParams); + return true; + } + return false; +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/NoiseFSAsset.cpp b/APEX_1.4/module/basicfs/src/NoiseFSAsset.cpp new file mode 100644 index 00000000..2360a062 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/NoiseFSAsset.cpp @@ -0,0 +1,187 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "NoiseFSAsset.h" +#include "NoiseFSActorImpl.h" +#include "ModuleBasicFSImpl.h" + +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + +AuthObjTypeID NoiseFSAsset::mAssetTypeID; + +NoiseFSAsset::NoiseFSAsset(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + : BasicFSAssetImpl(module, name) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = static_cast<NoiseFSAssetParams*>(traits->createNvParameterized(NoiseFSAssetParams::staticClassName())); + PX_ASSERT(mParams); + + list.add(*this); +} + +NoiseFSAsset::NoiseFSAsset(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + : BasicFSAssetImpl(module, name) + , mParams(static_cast<NoiseFSAssetParams*>(params)) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + list.add(*this); +} + +NoiseFSAsset::~NoiseFSAsset() +{ +} + + +void NoiseFSAsset::destroy() +{ + if (mParams) + { + mParams->destroy(); + mParams = 0; + } + + if (mDefaultActorParams) + { + mDefaultActorParams->destroy(); + mDefaultActorParams = 0; + } + + /* Actors are automatically cleaned up on deletion by ResourceList dtor */ + delete this; +} + +NvParameterized::Interface* NoiseFSAsset::getDefaultActorDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultActorParams) + { + NvParameterized::Interface* param = traits->createNvParameterized(NoiseFSActorParams::staticClassName()); + mDefaultActorParams = static_cast<NoiseFSActorParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + else + { + mDefaultActorParams->initDefaults(); + } + + return mDefaultActorParams; +} + +Actor* NoiseFSAsset::createApexActor(const NvParameterized::Interface& params, Scene& apexScene) +{ + Actor* ret = 0; + + if (nvidia::strcmp(params.className(), NoiseFSActorParams::staticClassName()) == 0) + { + const NoiseFSActorParams& actorParams = static_cast<const NoiseFSActorParams&>(params); + + BasicFSScene* es = mModule->getBasicFSScene(apexScene); + ret = es->createNoiseFSActor(actorParams, *this, mFSActors); + } + return ret; +} + +NvParameterized::Interface* NoiseFSAsset::getDefaultAssetPreviewDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultPreviewParams) + { + const char* className = NoiseFSPreviewParams::staticClassName(); + NvParameterized::Interface* param = traits->createNvParameterized(className); + mDefaultPreviewParams = static_cast<NoiseFSPreviewParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + + return mDefaultPreviewParams; +} + +AssetPreview* NoiseFSAsset::createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene) +{ + AssetPreview* ret = 0; + + const char* className = params.className(); + if (nvidia::strcmp(className, NoiseFSPreviewParams::staticClassName()) == 0) + { + NoiseFSPreviewDesc desc; + const NoiseFSPreviewParams* pDesc = static_cast<const NoiseFSPreviewParams*>(¶ms); + + desc.mPose = pDesc->globalPose; + + desc.mPreviewDetail = 0; + if (pDesc->drawShape) + { + desc.mPreviewDetail |= APEX_NOISE::NOISE_DRAW_SHAPE; + } + if (pDesc->drawAssetInfo) + { + desc.mPreviewDetail |= APEX_NOISE::NOISE_DRAW_ASSET_INFO; + } + + ret = createNoiseFSPreview(desc, previewScene); + } + + return ret; +} + +NoiseFSPreview* NoiseFSAsset::createNoiseFSPreview(const NoiseFSPreviewDesc& desc, AssetPreviewScene* previewScene) +{ + return createNoiseFSPreviewImpl(desc, this, previewScene); +} + +NoiseFSPreview* NoiseFSAsset::createNoiseFSPreviewImpl(const NoiseFSPreviewDesc& desc, NoiseFSAsset* jetAsset, AssetPreviewScene* previewScene) +{ + return PX_NEW(NoiseFSAssetPreview)(desc, mModule->mSdk, jetAsset, previewScene); +} + +void NoiseFSAsset::releaseNoiseFSPreview(NoiseFSPreview& nxpreview) +{ + NoiseFSAssetPreview* preview = DYNAMIC_CAST(NoiseFSAssetPreview*)(&nxpreview); + preview->destroy(); +} + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/NoiseFSAssetPreview.cpp b/APEX_1.4/module/basicfs/src/NoiseFSAssetPreview.cpp new file mode 100644 index 00000000..8df34757 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/NoiseFSAssetPreview.cpp @@ -0,0 +1,258 @@ +/* + * 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 "ApexDefs.h" +#include "nvparameterized/NvParamUtils.h" +#include "NoiseFSAsset.h" +#include "NoiseFSAssetParams.h" +#include "NoiseFSPreview.h" +#include "NoiseFSAssetPreview.h" +#include "ModulePerfScope.h" +#include "ApexUsingNamespace.h" + +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace basicfs +{ + +using namespace APEX_NOISE; + +void NoiseFSAssetPreview::drawNoiseFSPreview(void) +{ + PX_PROFILE_ZONE("NoiseFSDrawPreview", GetInternalApexSDK()->getContextId()); + if (mPreviewDetail & NOISE_DRAW_SHAPE) + { + drawShape(); + } + + toggleDrawPreview(); + setDrawGroupsPose(); +} + +#define ASSET_INFO_XPOS (-0.9f) // left position of the asset info +#define ASSET_INFO_YPOS ( 0.9f) // top position of the asset info +#define DEBUG_TEXT_HEIGHT (0.35f) //in screen space -- would be nice to know this! + + +void NoiseFSAssetPreview::drawInfoLine(uint32_t lineNum, const char* str) +{ +#ifdef WITHOUT_DEBUG_VISUALIZE + PX_UNUSED(lineNum); + PX_UNUSED(str); +#else + PxMat44 cameraMatrix = mPreviewScene->getCameraMatrix(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); + PxVec3 textLocation = mPose.getPosition(); + textLocation += cameraMatrix.column1.getXYZ() * (ASSET_INFO_YPOS - (lineNum * DEBUG_TEXT_HEIGHT)); + cameraMatrix.setPosition(textLocation); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugText(textLocation, str); +#endif +} + +void NoiseFSAssetPreview::drawPreviewAssetInfo() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + char buf[128]; + buf[sizeof(buf) - 1] = 0; + + ApexSimpleString myString; + ApexSimpleString floatStr; + uint32_t lineNum = 0; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->pushRenderState(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::NoZbuffer); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentTextScale(1.0f); + + // asset name + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "%s %s", mAsset->getObjTypeName(), mAsset->getName()); + drawInfoLine(lineNum++, buf); + lineNum++; + + if(mPreviewScene->getShowFullInfo()) + { + // TODO: cache strings + NoiseFSAssetParams& assetParams = *static_cast<NoiseFSAssetParams*>(mAsset->getAssetNvParameterized()); + + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "noiseStrength = %f", + assetParams.noiseStrength + ); + drawInfoLine(lineNum++, buf); + + // fieldBoundary filter data info + if (assetParams.fieldBoundaryFilterDataName.buf) + { + myString = "FieldBoundary Filter Data = "; + myString += ApexSimpleString(assetParams.fieldBoundaryFilterDataName.buf); + drawInfoLine(lineNum++, myString.c_str()); + } + + // implicit info + myString = "Fade Percentage = "; + ApexSimpleString::ftoa(assetParams.boundaryFadePercentage, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + } + RENDER_DEBUG_IFACE(mApexRenderDebug)->popRenderState(); +#endif +} + +void NoiseFSAssetPreview::drawShape() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + NoiseFSAssetParams& assetParams = *static_cast<NoiseFSAssetParams*>(mAsset->getAssetNvParameterized()); + //asset preview init + if (mDrawGroupShape == 0) + { + mDrawGroupShape = RENDER_DEBUG_IFACE(mApexRenderDebug)->beginDrawGroup(PxMat44(PxIdentity)); + + //debug visualization + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::DarkBlue)); + + + PxVec3 shapeSides = assetParams.defaultScale * assetParams.boundarySize; + RENDER_DEBUG_IFACE(mApexRenderDebug)->setPose(mPose); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugBound( PxBounds3(PxVec3(0.0f), shapeSides) ); + + RENDER_DEBUG_IFACE(mApexRenderDebug)->endDrawGroup(); + } +#endif +} + +NoiseFSAssetPreview::~NoiseFSAssetPreview(void) +{ +} + +void NoiseFSAssetPreview::setPose(const PxMat44& pose) +{ + mPose = pose; + setDrawGroupsPose(); +} + +const PxMat44 NoiseFSAssetPreview::getPose() const +{ + return mPose; +} + +void NoiseFSAssetPreview::toggleDrawPreview() +{ + if (mPreviewDetail & NOISE_DRAW_SHAPE) + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupShape, true); + } + else + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupShape, false); + } +} + +void NoiseFSAssetPreview::setDrawGroupsPose() +{ + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupPose(mDrawGroupShape, mPose); +} + + +// from RenderDataProvider +void NoiseFSAssetPreview::lockRenderResources(void) +{ + ApexRenderable::renderDataLock(); +} + +void NoiseFSAssetPreview::unlockRenderResources(void) +{ + ApexRenderable::renderDataUnLock(); +} + +void NoiseFSAssetPreview::updateRenderResources(bool /*rewriteBuffers*/, void* /*userRenderData*/) +{ + if (mApexRenderDebug) + { + mApexRenderDebug->updateRenderResources(); + } +} + +// from Renderable.h +void NoiseFSAssetPreview::dispatchRenderResources(UserRenderer& renderer) +{ + if (mApexRenderDebug) + { + if (mPreviewDetail & NOISE_DRAW_ASSET_INFO) + { + drawPreviewAssetInfo(); + } + mApexRenderDebug->dispatchRenderResources(renderer); + } +} + +PxBounds3 NoiseFSAssetPreview::getBounds(void) const +{ + if (mApexRenderDebug) + { + return mApexRenderDebug->getBounds(); + } + else + { + PxBounds3 b; + b.setEmpty(); + return b; + } +} + +void NoiseFSAssetPreview::destroy(void) +{ + delete this; +} + +void NoiseFSAssetPreview::release(void) +{ + if (mInRelease) + { + return; + } + mInRelease = true; + mAsset->releaseNoiseFSPreview(*this); +} + +NoiseFSAssetPreview::NoiseFSAssetPreview(const NoiseFSPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, NoiseFSAsset* myNoiseFSAsset, AssetPreviewScene* previewScene) : + mPose(PreviewDesc.mPose), + mApexSDK(myApexSDK), + mAsset(myNoiseFSAsset), + mPreviewScene(previewScene), + mPreviewDetail(PreviewDesc.mPreviewDetail), + mDrawGroupShape(0), + mApexRenderDebug(0) +{ + drawNoiseFSPreview(); +}; + + +void NoiseFSAssetPreview::setDetailLevel(uint32_t detail) +{ + WRITE_ZONE(); + mPreviewDetail = detail; + setDrawGroupsPose(); +} + +} +} // namespace nvidia + diff --git a/APEX_1.4/module/basicfs/src/VortexFSActorImpl.cpp b/APEX_1.4/module/basicfs/src/VortexFSActorImpl.cpp new file mode 100644 index 00000000..045ccd02 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/VortexFSActorImpl.cpp @@ -0,0 +1,376 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" + +#include "Apex.h" + +#include "VortexFSActorImpl.h" +#include "VortexFSAsset.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include "PsMathUtils.h" + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" + +namespace nvidia +{ +namespace basicfs +{ + +#define NUM_DEBUG_POINTS 512 + +VortexFSActorImpl::VortexFSActorImpl(const VortexFSActorParams& params, VortexFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : BasicFSActor(scene) + , mAsset(&asset) +{ + mFieldWeight = asset.mParams->fieldWeight; + + mPose = params.initialPose; + mScale = params.initialScale; + mAxis = mAsset->mParams->axis; + mBottomSphericalForce = mAsset->mParams->bottomSphericalForce; + mTopSphericalForce = mAsset->mParams->topSphericalForce; + mHeight = mAsset->mParams->height; + mBottomRadius = mAsset->mParams->bottomRadius; + mTopRadius = mAsset->mParams->topRadius; + mRotationalStrength = mAsset->mParams->rotationalStrength; + mRadialStrength = mAsset->mParams->radialStrength; + mLiftStrength = mAsset->mParams->liftStrength; + + list.add(*this); // Add self to asset's list of actors + addSelfToContext(*scene.getApexScene().getApexContext()); // Add self to ApexScene + addSelfToContext(scene); // Add self to BasicFSScene's list of actors + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + FieldSamplerDescIntl fieldSamplerDesc; + if (asset.mParams->fieldDragCoeff > 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DRAG; + fieldSamplerDesc.dragCoeff = asset.mParams->fieldDragCoeff; + } + else + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DIRECT; + } + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::VELOCITY_PER_CELL; + fieldSamplerDesc.samplerFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldSamplerFilterDataName ? params.fieldSamplerFilterDataName : mAsset->mParams->fieldSamplerFilterDataName); + fieldSamplerDesc.boundaryFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldBoundaryFilterDataName ? params.fieldBoundaryFilterDataName : mAsset->mParams->fieldBoundaryFilterDataName); + fieldSamplerDesc.boundaryFadePercentage = mAsset->mParams->boundaryFadePercentage; + + fieldSamplerManager->registerFieldSampler(this, fieldSamplerDesc, mScene); + mFieldSamplerChanged = true; + } + mDebugShapeChanged = true; +} + +VortexFSActorImpl::~VortexFSActorImpl() +{ +} + +/* Must be defined inside CPP file, since they require knowledge of asset class */ +Asset* VortexFSActorImpl::getOwner() const +{ + return static_cast<Asset*>(mAsset); +} + +BasicFSAsset* VortexFSActorImpl::getVortexFSAsset() const +{ + READ_ZONE(); + return mAsset; +} + +void VortexFSActorImpl::release() +{ + if (mInRelease) + { + return; + } + destroy(); +} + +void VortexFSActorImpl::destroy() +{ + { + WRITE_ZONE(); + ApexActor::destroy(); + + setPhysXScene(NULL); + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + fieldSamplerManager->unregisterFieldSampler(this); + } + } + delete this; +} + +void VortexFSActorImpl::getLodRange(float& min, float& max, bool& intOnly) const +{ + PX_UNUSED(min); + PX_UNUSED(max); + PX_UNUSED(intOnly); + APEX_INVALID_OPERATION("not implemented"); +} + +float VortexFSActorImpl::getActiveLod() const +{ + APEX_INVALID_OPERATION("NxExampleActor does not support this operation"); + return -1.0f; +} + +void VortexFSActorImpl::forceLod(float lod) +{ + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +// Called by game render thread +void VortexFSActorImpl::updateRenderResources(bool rewriteBuffers, void* userRenderData) +{ + PX_UNUSED(rewriteBuffers); + PX_UNUSED(userRenderData); +} + +// Called by game render thread +void VortexFSActorImpl::dispatchRenderResources(UserRenderer& renderer) +{ + PX_UNUSED(renderer); +} + +bool VortexFSActorImpl::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + isEnabled = mFieldSamplerEnabled; + if (mFieldSamplerChanged) + { + mExecuteParams.bottomSphericalForce = mBottomSphericalForce; + mExecuteParams.topSphericalForce = mTopSphericalForce; + + mExecuteParams.bottomRadius = mScale * mBottomRadius; + mExecuteParams.topRadius = mScale * mTopRadius; + mExecuteParams.height = mScale * mHeight; + mExecuteParams.rotationalStrength = mScale * mRotationalStrength; + mExecuteParams.radialStrength = mScale * mRadialStrength; + mExecuteParams.liftStrength = mScale * mLiftStrength; + + const PxVec3 mUnit(0,1,0); + const PxVec3 vecN = mPose.q.rotate(mAxis); + + const PxVec3 a = mUnit.cross(vecN); + const PxQuat axisRot(a.x, a.y, a.z, sqrtf(mUnit.magnitudeSquared() * vecN.magnitudeSquared()) + mUnit.dot(vecN)); + + mDirToWorld.q = axisRot.getNormalized(); + mDirToWorld.p = mPose.p; + + mExecuteParams.worldToDir = mDirToWorld.getInverse(); + + shapeDesc.type = FieldShapeTypeIntl::CAPSULE; + shapeDesc.dimensions = PxVec3(PxMax(mExecuteParams.bottomRadius, mExecuteParams.topRadius), mExecuteParams.height, 0); + shapeDesc.worldToShape = mExecuteParams.worldToDir; + shapeDesc.weight = mFieldWeight; + + mFieldSamplerChanged = false; + return true; + } + return false; +} + +void VortexFSActorImpl::simulate(float dt) +{ + PX_UNUSED(dt); +} + +void VortexFSActorImpl::setRotationalStrength(float strength) +{ + WRITE_ZONE(); + mRotationalStrength = strength; + mFieldSamplerChanged = true; +} + +void VortexFSActorImpl::setRadialStrength(float strength) +{ + WRITE_ZONE(); + mRadialStrength = strength; + mFieldSamplerChanged = true; +} + +void VortexFSActorImpl::setLiftStrength(float strength) +{ + WRITE_ZONE(); + mLiftStrength = strength; + mFieldSamplerChanged = true; +} + +void VortexFSActorImpl::visualize() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if ( !mEnableDebugVisualization ) return; + RenderDebugInterface* debugRender = mScene->mDebugRender; + BasicFSDebugRenderParams* debugRenderParams = mScene->mBasicFSDebugRenderParams; + + using RENDER_DEBUG::DebugColors; + + if (!debugRenderParams->VISUALIZE_VORTEX_FS_ACTOR) + { + return; + } + + const physx::PxMat44& savedPose = *RENDER_DEBUG_IFACE(debugRender)->getPoseTyped(); + RENDER_DEBUG_IFACE(debugRender)->setIdentityPose(); + + if (debugRenderParams->VISUALIZE_VORTEX_FS_ACTOR_NAME) + { + char buf[128]; + buf[sizeof(buf) - 1] = 0; + APEX_SPRINTF_S(buf, sizeof(buf) - 1, " %s %s", mAsset->getObjTypeName(), mAsset->getName()); + + PxVec3 textLocation = mPose.p; + + RENDER_DEBUG_IFACE(debugRender)->setCurrentTextScale(4.0f); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->debugText(textLocation, buf); + } + + if (debugRenderParams->VISUALIZE_VORTEX_FS_SHAPE) + { + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->setPose(mDirToWorld); + RENDER_DEBUG_IFACE(debugRender)->debugCapsuleTapered(mExecuteParams.topRadius, mExecuteParams.bottomRadius, mExecuteParams.height, 2); + RENDER_DEBUG_IFACE(debugRender)->setPose(physx::PxMat44(physx::PxIdentity)); + } + + if (debugRenderParams->VISUALIZE_VORTEX_FS_POSE) + { + RENDER_DEBUG_IFACE(debugRender)->debugAxes(PxMat44(mPose), 1); + } + + if (debugRenderParams->VISUALIZE_VORTEX_FS_FIELD) + { + if (mDebugShapeChanged || mDebugPoints.empty()) + { + mDebugShapeChanged = false; + mDebugPoints.resize(NUM_DEBUG_POINTS); + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + float r1 = mBottomRadius; + float r2 = mTopRadius; + float h = mHeight; + float maxR = PxMax(r1, r2); + float rx, ry, rz; + bool isInside = false; + do + { + rx = physx::shdfnd::rand(-maxR, maxR); + ry = physx::shdfnd::rand(-h/2 - r1, h/2 + r2); + rz = physx::shdfnd::rand(-maxR, maxR); + isInside = 2*ry <= h && -h <= 2*ry && + rx*rx + rz*rz <= physx::shdfnd::sqr(r1 + (ry / h + 0.5) * (r2-r1)); + isInside |= 2*ry < -h && rx*rx + rz*rz <= r1*r1 - (2*ry+h)*(2*ry+h)*0.25; + isInside |= 2*ry > h && rx*rx + rz*rz <= r2*r2 - (2*ry-h)*(2*ry-h)*0.25; + } + while (!isInside); + + PxVec3& vec = mDebugPoints[i]; + + // we need transform from local to world + vec.x = rx; + vec.y = ry; + vec.z = rz; + } + } + + using RENDER_DEBUG::DebugColors; + + uint32_t c1 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(DebugColors::Blue); + uint32_t c2 = RENDER_DEBUG_IFACE(mScene->mDebugRender)->getDebugColor(DebugColors::Red); + + for (uint32_t i = 0; i < NUM_DEBUG_POINTS; ++i) + { + PxVec3 localPos = mScale * mDebugPoints[i]; + PxVec3 pos = mDirToWorld.transform(localPos); + PxVec3 fieldVec = executeVortexFS(mExecuteParams, pos/*, totalElapsedMS*/); + RENDER_DEBUG_IFACE(debugRender)->debugGradientLine(pos, pos + fieldVec, c1, c2); + } + } + RENDER_DEBUG_IFACE(debugRender)->setPose(savedPose); +#endif +} + +/******************************** CPU Version ********************************/ + +VortexFSActorCPU::VortexFSActorCPU(const VortexFSActorParams& params, VortexFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : VortexFSActorImpl(params, asset, list, scene) +{ +} + +VortexFSActorCPU::~VortexFSActorCPU() +{ +} + +void VortexFSActorCPU::executeFieldSampler(const ExecuteData& data) +{ + for (uint32_t iter = 0; iter < data.count; ++iter) + { + uint32_t i = data.indices[iter & data.indicesMask] + (iter & ~data.indicesMask); + PxVec3* pos = (PxVec3*)((uint8_t*)data.position + i * data.positionStride); + data.resultField[iter] = executeVortexFS(mExecuteParams, *pos/*, totalElapsedMS*/); + } +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +VortexFSActorGPU::VortexFSActorGPU(const VortexFSActorParams& params, VortexFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : VortexFSActorCPU(params, asset, list, scene) + , mConstMemGroup(CUDA_OBJ(fieldSamplerStorage)) +{ +} + +VortexFSActorGPU::~VortexFSActorGPU() +{ +} + +bool VortexFSActorGPU::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + if (VortexFSActorImpl::updateFieldSampler(shapeDesc, isEnabled)) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mConstMemGroup); + + if (mParamsHandle.isNull()) + { + mParamsHandle.alloc(_storage_); + } + mParamsHandle.update(_storage_, mExecuteParams); + return true; + } + return false; +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/VortexFSAsset.cpp b/APEX_1.4/module/basicfs/src/VortexFSAsset.cpp new file mode 100644 index 00000000..5e34b14d --- /dev/null +++ b/APEX_1.4/module/basicfs/src/VortexFSAsset.cpp @@ -0,0 +1,195 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "VortexFSAsset.h" +#include "VortexFSActorImpl.h" +#include "ModuleBasicFSImpl.h" +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + +AuthObjTypeID VortexFSAsset::mAssetTypeID; + +VortexFSAsset::VortexFSAsset(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + : BasicFSAssetImpl(module, name) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = static_cast<VortexFSAssetParams*>(traits->createNvParameterized(VortexFSAssetParams::staticClassName())); + PX_ASSERT(mParams); + + list.add(*this); +} + +VortexFSAsset::VortexFSAsset(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + : BasicFSAssetImpl(module, name) + , mParams(static_cast<VortexFSAssetParams*>(params)) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + list.add(*this); +} + +VortexFSAsset::~VortexFSAsset() +{ +} + + +void VortexFSAsset::destroy() +{ + if (mParams) + { + mParams->destroy(); + mParams = 0; + } + + if (mDefaultActorParams) + { + mDefaultActorParams->destroy(); + mDefaultActorParams = 0; + } + + if (mDefaultPreviewParams) + { + mDefaultPreviewParams->destroy(); + mDefaultPreviewParams = 0; + } + + + /* Actors are automatically cleaned up on deletion by ResourceList dtor */ + delete this; +} + +NvParameterized::Interface* VortexFSAsset::getDefaultActorDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultActorParams) + { + NvParameterized::Interface* param = traits->createNvParameterized(VortexFSActorParams::staticClassName()); + mDefaultActorParams = static_cast<VortexFSActorParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + else + { + mDefaultActorParams->initDefaults(); + } + + return mDefaultActorParams; +} + +Actor* VortexFSAsset::createApexActor(const NvParameterized::Interface& params, Scene& apexScene) +{ + Actor* ret = 0; + + if (nvidia::strcmp(params.className(), VortexFSActorParams::staticClassName()) == 0) + { + const VortexFSActorParams& actorParams = static_cast<const VortexFSActorParams&>(params); + + BasicFSScene* es = mModule->getBasicFSScene(apexScene); + ret = es->createVortexFSActor(actorParams, *this, mFSActors); + } + return ret; +} + + +VortexFSPreview* VortexFSAsset::createVortexFSPreview(const VortexFSPreviewDesc& desc, AssetPreviewScene* previewScene) +{ + return createVortexFSPreviewImpl(desc, this, previewScene); +} + +VortexFSPreview* VortexFSAsset::createVortexFSPreviewImpl(const VortexFSPreviewDesc& desc, VortexFSAsset* TurboAsset, AssetPreviewScene* previewScene) +{ + return PX_NEW(VortexFSAssetPreview)(desc, mModule->mSdk, TurboAsset, previewScene); +} + +void VortexFSAsset::releaseVortexFSPreview(VortexFSPreview& nxpreview) +{ + VortexFSAssetPreview* preview = DYNAMIC_CAST(VortexFSAssetPreview*)(&nxpreview); + preview->destroy(); +} + +NvParameterized::Interface* VortexFSAsset::getDefaultAssetPreviewDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultPreviewParams) + { + const char* className = VortexFSPreviewParams::staticClassName(); + NvParameterized::Interface* param = traits->createNvParameterized(className); + mDefaultPreviewParams = static_cast<VortexFSPreviewParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + + return mDefaultPreviewParams; +} + +AssetPreview* VortexFSAsset::createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene) +{ + AssetPreview* ret = 0; + + const char* className = params.className(); + if (nvidia::strcmp(className, VortexFSPreviewParams::staticClassName()) == 0) + { + VortexFSPreviewDesc desc; + const VortexFSPreviewParams* pDesc = static_cast<const VortexFSPreviewParams*>(¶ms); + + desc.mPose = pDesc->globalPose; + + desc.mPreviewDetail = 0; + if (pDesc->drawShape) + { + desc.mPreviewDetail |= APEX_VORTEX::VORTEX_DRAW_SHAPE; + } + if (pDesc->drawAssetInfo) + { + desc.mPreviewDetail |= APEX_VORTEX::VORTEX_DRAW_ASSET_INFO; + } + + ret = createVortexFSPreview(desc, previewScene); + } + + return ret; +} + + +} +} // end namespace nvidia::apex + + diff --git a/APEX_1.4/module/basicfs/src/VortexFSAssetPreview.cpp b/APEX_1.4/module/basicfs/src/VortexFSAssetPreview.cpp new file mode 100644 index 00000000..816e9895 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/VortexFSAssetPreview.cpp @@ -0,0 +1,319 @@ +/* + * 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 "ApexDefs.h" +#include "nvparameterized/NvParamUtils.h" +#include "VortexFSAsset.h" +#include "VortexFSAssetParams.h" +#include "VortexFSPreview.h" +#include "VortexFSAssetPreview.h" +#include "ModulePerfScope.h" +#include "ApexUsingNamespace.h" + +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace basicfs +{ + +using namespace APEX_VORTEX; + +void VortexFSAssetPreview::drawVortexFSPreview(void) +{ + PX_PROFILE_ZONE("VortexFSDrawPreview", GetInternalApexSDK()->getContextId()); + + if (mPreviewDetail & VORTEX_DRAW_SHAPE) + { + drawPreviewShape(); + } +} + +#define ASSET_INFO_XPOS (-0.9f) // left position of the asset info +#define ASSET_INFO_YPOS ( 0.9f) // top position of the asset info +#define DEBUG_TEXT_HEIGHT (0.35f) //in screen space -- would be nice to know this! + + +void VortexFSAssetPreview::drawPreviewShape() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + if (mDrawGroupBox == 0) + { + mDrawGroupBox = RENDER_DEBUG_IFACE(mApexRenderDebug)->beginDrawGroup(PxMat44(PxIdentity)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::DarkGreen)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugSphere(PxVec3(0.0f), mRadius); // * scale); + RENDER_DEBUG_IFACE(mApexRenderDebug)->endDrawGroup(); + } + + setDrawGroupsPose(); +#endif +} + +void VortexFSAssetPreview::toggleDrawPreview() +{ + if (mPreviewDetail & VORTEX_DRAW_SHAPE) + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupBox, true); + } + else + { + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupVisible(mDrawGroupBox, false); + } +} + +void VortexFSAssetPreview::setDrawGroupsPose() +{ + RENDER_DEBUG_IFACE(mApexRenderDebug)->setDrawGroupPose(mDrawGroupBox, mPose); +} + + +void VortexFSAssetPreview::drawInfoLine(uint32_t lineNum, const char* str) +{ +#ifdef WITHOUT_DEBUG_VISUALIZE + PX_UNUSED(lineNum); + PX_UNUSED(str); +#else + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Green)); + PxMat44 cameraMatrix = mPreviewScene->getCameraMatrix(); + PxVec3 textLocation = mPose.getPosition(); + textLocation += cameraMatrix.column1.getXYZ() * (ASSET_INFO_YPOS - (lineNum * DEBUG_TEXT_HEIGHT)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugText(textLocation, str); +#endif +} + +void VortexFSAssetPreview::drawPreviewAssetInfo() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + char buf[128]; + buf[sizeof(buf) - 1] = 0; + + ApexSimpleString myString; + ApexSimpleString floatStr; + uint32_t lineNum = 0; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->pushRenderState(); + // RENDER_DEBUG_IFACE(&mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::ScreenSpace); + RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::NoZbuffer); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentTextScale(1.0f); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Yellow)); + + // asset name + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "%s %s", mAsset->getObjTypeName(), mAsset->getName()); + drawInfoLine(lineNum++, buf); + lineNum++; + + if(mPreviewScene->getShowFullInfo()) + { + // TODO: cache strings + VortexFSAssetParams* assetParams = static_cast<VortexFSAssetParams*>(mAsset->getAssetNvParameterized()); + PX_ASSERT(assetParams); + + float rotationalStrength = assetParams->rotationalStrength; + float radialStrength = assetParams->radialStrength; + float liftStrength = assetParams->liftStrength; + + myString = "Rotational field strength coefficient = "; + ApexSimpleString::ftoa(rotationalStrength, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + myString = "Radial field strength coefficient = "; + ApexSimpleString::ftoa(radialStrength, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + myString = "Lifting field strength coefficient = "; + ApexSimpleString::ftoa(liftStrength, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + + // fieldSampler filter data info + if (assetParams->fieldSamplerFilterDataName.buf) + { + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "FieldSampler Filter Data = %s", + assetParams->fieldSamplerFilterDataName.buf + ); + drawInfoLine(lineNum++, buf); + } + + // fieldBoundary filter data info + if (assetParams->fieldBoundaryFilterDataName.buf) + { + myString = "FieldBoundary Filter Data = "; + myString += ApexSimpleString(assetParams->fieldBoundaryFilterDataName.buf); + drawInfoLine(lineNum++, myString.c_str()); + } + + // implicit info + myString = "Fade Percentage = "; + ApexSimpleString::ftoa(assetParams->boundaryFadePercentage, floatStr); + myString += floatStr; + drawInfoLine(lineNum++, myString.c_str()); + } + + RENDER_DEBUG_IFACE(mApexRenderDebug)->popRenderState(); +#endif +} + +VortexFSAssetPreview::~VortexFSAssetPreview(void) +{ +} + +void VortexFSAssetPreview::setPose(const PxMat44& pose) +{ + mPose = pose; + setDrawGroupsPose(); +} + +const PxMat44 VortexFSAssetPreview::getPose() const +{ + return mPose; +} + +void VortexFSAssetPreview::setRadius(float radius) +{ + WRITE_ZONE(); + mRadius = radius; +} + +const float VortexFSAssetPreview::getRadius() const +{ + READ_ZONE(); + return mRadius; +} + +// from RenderDataProvider +void VortexFSAssetPreview::lockRenderResources(void) +{ + ApexRenderable::renderDataLock(); +} + +void VortexFSAssetPreview::unlockRenderResources(void) +{ + ApexRenderable::renderDataUnLock(); +} + +void VortexFSAssetPreview::updateRenderResources(bool /*rewriteBuffers*/, void* /*userRenderData*/) +{ + if (mApexRenderDebug) + { + mApexRenderDebug->updateRenderResources(); + } +} + +void VortexFSAssetPreview::dispatchRenderResources(UserRenderer& renderer) +{ + if (mApexRenderDebug) + { + if (mPreviewDetail & VORTEX_DRAW_ASSET_INFO) + { + drawPreviewAssetInfo(); + } + mApexRenderDebug->dispatchRenderResources(renderer); + } +} + +PxBounds3 VortexFSAssetPreview::getBounds(void) const +{ + if (mApexRenderDebug) + { + return mApexRenderDebug->getBounds(); + } + else + { + PxBounds3 b; + b.setEmpty(); + return b; + } +} + +void VortexFSAssetPreview::destroy(void) +{ + delete this; +} + +float VortexFSAssetPreview::getVortexRadius(NvParameterized::Interface* assetParams) +{ + float radius = 0.0f; + const char* name = "radius"; + + NvParameterized::Handle handle(*assetParams, name); + bool handleIsValid = handle.isValid(); + PX_ASSERT(handleIsValid); + PX_UNUSED(handleIsValid); + //APEX_DEBUG_WARNING("Test."); + NvParameterized::ErrorType errorGetRadius = handle.getParamF32(radius); + PX_ASSERT(errorGetRadius == NvParameterized::ERROR_NONE); + PX_UNUSED(errorGetRadius); + + return radius; + + // the other way to do it ... + //VortexFSAssetParams* attractorAssetParams = static_cast<VortexFSAssetParams*>(assetParams); + //PX_ASSERT(assetParams); + + //return attractorAssetParams->radius; +} + +void VortexFSAssetPreview::release(void) +{ + if (mInRelease) + { + return; + } + mInRelease = true; + mAsset->releaseVortexFSPreview(*this); +} + +VortexFSAssetPreview::VortexFSAssetPreview(const VortexFSPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, VortexFSAsset* mVortexFSAsset, AssetPreviewScene* previewScene) : + mPose(PreviewDesc.mPose), + mApexSDK(myApexSDK), + mAsset(mVortexFSAsset), + mPreviewScene(previewScene), + mPreviewDetail(PreviewDesc.mPreviewDetail), + mDrawGroupBox(0), + mApexRenderDebug(0) +{ + NvParameterized::Interface* assetParams = mVortexFSAsset->getAssetNvParameterized(); //FIXME: const + PX_ASSERT(assetParams); + + if (assetParams) + { + mRadius = getVortexRadius(assetParams); + } + + drawVortexFSPreview(); +}; + + +void VortexFSAssetPreview::setDetailLevel(uint32_t detail) +{ + WRITE_ZONE(); + if(detail != mPreviewDetail) + { + mPreviewDetail = detail; + toggleDrawPreview(); + } +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/WindFSActorImpl.cpp b/APEX_1.4/module/basicfs/src/WindFSActorImpl.cpp new file mode 100644 index 00000000..bc8f9e19 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/WindFSActorImpl.cpp @@ -0,0 +1,339 @@ +/* + * 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 "ApexDefs.h" +#include "RenderMeshActorDesc.h" +#include "RenderMeshActor.h" +#include "RenderMeshAsset.h" +#include "Apex.h" +#include "WindFSActorImpl.h" +#include "WindFSAsset.h" +#include "BasicFSScene.h" +#include "ApexSDKIntl.h" +#include "SceneIntl.h" +#include "RenderDebugInterface.h" + +#include <PxScene.h> + +#include <FieldSamplerManagerIntl.h> +#include "ApexResourceHelper.h" + +#include "PsMathUtils.h" + +namespace nvidia +{ +namespace basicfs +{ + +WindFSActorImpl::WindFSActorImpl(const WindFSActorParams& params, WindFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : BasicFSActor(scene) + , mAsset(&asset) + , mFieldDirectionVO1(NULL) + , mFieldDirectionVO2(NULL) + , mFieldStrengthVO(NULL) +{ + mFieldWeight = asset.mParams->fieldWeight; + + mPose = params.initialPose; + mScale = params.initialScale; + setFieldDirection(mAsset->mParams->fieldDirection); + setFieldStrength(mAsset->mParams->fieldStrength); + + mExecuteParams.fieldValue = getFieldDirection() * (getFieldStrength() * mScale); + + mStrengthVar = 0.0f; + mLocalDirVar = PxVec3(1, 0, 0); + + if (mAsset->mParams->fieldStrengthDeviationPercentage > 0 && mAsset->mParams->fieldStrengthOscillationPeriod > 0) + { + mFieldStrengthVO = PX_NEW(variableOscillator)(-mAsset->mParams->fieldStrengthDeviationPercentage, + +mAsset->mParams->fieldStrengthDeviationPercentage, + 0.0f, + mAsset->mParams->fieldStrengthOscillationPeriod); + } + + float diviationAngle = physx::shdfnd::degToRad(mAsset->mParams->fieldDirectionDeviationAngle); + if (diviationAngle > 0 && mAsset->mParams->fieldDirectionOscillationPeriod > 0) + { + mFieldDirectionVO1 = PX_NEW(variableOscillator)(-diviationAngle, + +diviationAngle, + 0, + mAsset->mParams->fieldDirectionOscillationPeriod); + + mFieldDirectionVO2 = PX_NEW(variableOscillator)(-PxTwoPi, + +PxTwoPi, + 0, + mAsset->mParams->fieldDirectionOscillationPeriod); + } + + list.add(*this); // Add self to asset's list of actors + addSelfToContext(*scene.getApexScene().getApexContext()); // Add self to ApexScene + addSelfToContext(scene); // Add self to BasicFSScene's list of actors + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + FieldSamplerDescIntl fieldSamplerDesc; + if (asset.mParams->fieldDragCoeff > 0) + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DRAG; + fieldSamplerDesc.dragCoeff = asset.mParams->fieldDragCoeff; + } + else + { + fieldSamplerDesc.type = FieldSamplerTypeIntl::VELOCITY_DIRECT; + } + fieldSamplerDesc.gridSupportType = FieldSamplerGridSupportTypeIntl::SINGLE_VELOCITY; + fieldSamplerDesc.samplerFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldSamplerFilterDataName ? params.fieldSamplerFilterDataName : mAsset->mParams->fieldSamplerFilterDataName); + fieldSamplerDesc.boundaryFilterData = ApexResourceHelper::resolveCollisionGroup128(params.fieldBoundaryFilterDataName ? params.fieldBoundaryFilterDataName : mAsset->mParams->fieldBoundaryFilterDataName); + fieldSamplerDesc.boundaryFadePercentage = 0; + + fieldSamplerManager->registerFieldSampler(this, fieldSamplerDesc, mScene); + mFieldSamplerChanged = true; + } +} + +WindFSActorImpl::~WindFSActorImpl() +{ +} + +/* Must be defined inside CPP file, since they require knowledge of asset class */ +Asset* WindFSActorImpl::getOwner() const +{ + return static_cast<Asset*>(mAsset); +} + +BasicFSAsset* WindFSActorImpl::getWindFSAsset() const +{ + READ_ZONE(); + return mAsset; +} + +void WindFSActorImpl::release() +{ + if (mInRelease) + { + return; + } + destroy(); +} + +void WindFSActorImpl::destroy() +{ + { + WRITE_ZONE(); + ApexActor::destroy(); + + setPhysXScene(NULL); + + FieldSamplerManagerIntl* fieldSamplerManager = mScene->getInternalFieldSamplerManager(); + if (fieldSamplerManager != 0) + { + fieldSamplerManager->unregisterFieldSampler(this); + } + + if (mFieldStrengthVO) + { + PX_DELETE_AND_RESET(mFieldStrengthVO); + } + if (mFieldDirectionVO1) + { + PX_DELETE_AND_RESET(mFieldDirectionVO1); + } + if (mFieldDirectionVO2) + { + PX_DELETE_AND_RESET(mFieldDirectionVO2); + } + } + delete this; +} + +void WindFSActorImpl::getLodRange(float& min, float& max, bool& intOnly) const +{ + PX_UNUSED(min); + PX_UNUSED(max); + PX_UNUSED(intOnly); + APEX_INVALID_OPERATION("not implemented"); +} + +float WindFSActorImpl::getActiveLod() const +{ + APEX_INVALID_OPERATION("NxExampleActor does not support this operation"); + return -1.0f; +} + +void WindFSActorImpl::forceLod(float lod) +{ + PX_UNUSED(lod); + APEX_INVALID_OPERATION("not implemented"); +} + +// Called by game render thread +void WindFSActorImpl::updateRenderResources(bool rewriteBuffers, void* userRenderData) +{ + PX_UNUSED(rewriteBuffers); + PX_UNUSED(userRenderData); +} + +// Called by game render thread +void WindFSActorImpl::dispatchRenderResources(UserRenderer& renderer) +{ + PX_UNUSED(renderer); +} + +bool WindFSActorImpl::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + PX_UNUSED(shapeDesc); + + isEnabled = mFieldSamplerEnabled; + if (mFieldSamplerChanged) + { + PxVec3 instDirection = mFieldDirBasis.transform(mLocalDirVar); + float instStrength = mScale * mFieldStrength * (1.0f + mStrengthVar); + + mExecuteParams.fieldValue = instDirection * instStrength; + + shapeDesc.type = FieldShapeTypeIntl::NONE; + shapeDesc.worldToShape = PxTransform(PxIdentity); + shapeDesc.dimensions = PxVec3(0.0f); + shapeDesc.weight = mFieldWeight; + + mFieldSamplerChanged = false; + return true; + } + return false; +} + +void WindFSActorImpl::simulate(float dt) +{ + if (mFieldStrengthVO != NULL) + { + mStrengthVar = mFieldStrengthVO->updateVariableOscillator(dt); + + mFieldSamplerChanged = true; + } + if (mFieldDirectionVO1 != NULL && mFieldDirectionVO2 != NULL) + { + float theta = mFieldDirectionVO1->updateVariableOscillator(dt); + float phi = mFieldDirectionVO2->updateVariableOscillator(dt); + + mLocalDirVar.x = PxCos(theta); + mLocalDirVar.y = PxSin(theta) * PxCos(phi); + mLocalDirVar.z = PxSin(theta) * PxSin(phi); + + mFieldSamplerChanged = true; + } +} + +void WindFSActorImpl::setFieldStrength(float strength) +{ + WRITE_ZONE(); + mFieldStrength = strength; + mFieldSamplerChanged = true; +} + +void WindFSActorImpl::setFieldDirection(const PxVec3& direction) +{ + WRITE_ZONE(); + mFieldDirBasis.column0 = direction.getNormalized(); + BuildPlaneBasis(mFieldDirBasis.column0, mFieldDirBasis.column1, mFieldDirBasis.column2); + + mFieldSamplerChanged = true; +} + +void WindFSActorImpl::visualize() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if ( !mEnableDebugVisualization ) return; + RenderDebugInterface* debugRender = mScene->mDebugRender; + BasicFSDebugRenderParams* debugRenderParams = mScene->mBasicFSDebugRenderParams; + + if (!debugRenderParams->VISUALIZE_WIND_FS_ACTOR) + { + return; + } + + const physx::PxMat44& savedPose = *RENDER_DEBUG_IFACE(debugRender)->getPoseTyped(); + RENDER_DEBUG_IFACE(debugRender)->setIdentityPose(); + if (debugRenderParams->VISUALIZE_WIND_FS_ACTOR_NAME) + { + char buf[128]; + buf[sizeof(buf) - 1] = 0; + APEX_SPRINTF_S(buf, sizeof(buf) - 1, " %s %s", mAsset->getObjTypeName(), mAsset->getName()); + + PxVec3 textLocation = mPose.p; + + RENDER_DEBUG_IFACE(debugRender)->setCurrentTextScale(4.0f); + RENDER_DEBUG_IFACE(debugRender)->setCurrentColor(RENDER_DEBUG_IFACE(debugRender)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); + RENDER_DEBUG_IFACE(debugRender)->debugText(textLocation, buf); + } + RENDER_DEBUG_IFACE(debugRender)->setPose(savedPose); +#endif +} + +/******************************** CPU Version ********************************/ + +WindFSActorCPU::WindFSActorCPU(const WindFSActorParams& params, WindFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : WindFSActorImpl(params, asset, list, scene) +{ +} + +WindFSActorCPU::~WindFSActorCPU() +{ +} + +void WindFSActorCPU::executeFieldSampler(const ExecuteData& data) +{ + for (uint32_t iter = 0; iter < data.count; ++iter) + { + uint32_t i = data.indices[iter & data.indicesMask] + (iter & ~data.indicesMask); + PxVec3* pos = (PxVec3*)((uint8_t*)data.position + i * data.positionStride); + data.resultField[iter] = executeWindFS(mExecuteParams, *pos); + } +} + +/******************************** GPU Version ********************************/ + +#if APEX_CUDA_SUPPORT + + +WindFSActorGPU::WindFSActorGPU(const WindFSActorParams& params, WindFSAsset& asset, ResourceList& list, BasicFSScene& scene) + : WindFSActorCPU(params, asset, list, scene) + , mConstMemGroup(CUDA_OBJ(fieldSamplerStorage)) +{ +} + +WindFSActorGPU::~WindFSActorGPU() +{ +} + +bool WindFSActorGPU::updateFieldSampler(FieldShapeDescIntl& shapeDesc, bool& isEnabled) +{ + if (WindFSActorImpl::updateFieldSampler(shapeDesc, isEnabled)) + { + APEX_CUDA_CONST_MEM_GROUP_SCOPE(mConstMemGroup); + + if (mParamsHandle.isNull()) + { + mParamsHandle.alloc(_storage_); + } + mParamsHandle.update(_storage_, mExecuteParams); + return true; + } + return false; +} + + +#endif + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/WindFSAsset.cpp b/APEX_1.4/module/basicfs/src/WindFSAsset.cpp new file mode 100644 index 00000000..0d6ab2b7 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/WindFSAsset.cpp @@ -0,0 +1,182 @@ +/* + * 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 "ApexDefs.h" +#include "Apex.h" +#include "WindFSAsset.h" +#include "WindFSActorImpl.h" +#include "ModuleBasicFSImpl.h" + +#include "BasicFSScene.h" + +namespace nvidia +{ +namespace basicfs +{ + +AuthObjTypeID WindFSAsset::mAssetTypeID; + +WindFSAsset::WindFSAsset(ModuleBasicFSImpl* module, ResourceList& list, const char* name) + : BasicFSAssetImpl(module, name) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + mParams = static_cast<WindFSAssetParams*>(traits->createNvParameterized(WindFSAssetParams::staticClassName())); + PX_ASSERT(mParams); + + list.add(*this); +} + +WindFSAsset::WindFSAsset(ModuleBasicFSImpl* module, ResourceList& list, NvParameterized::Interface* params, const char* name) + : BasicFSAssetImpl(module, name) + , mParams(static_cast<WindFSAssetParams*>(params)) + , mDefaultActorParams(NULL) + , mDefaultPreviewParams(NULL) +{ + list.add(*this); +} + +WindFSAsset::~WindFSAsset() +{ +} + + +void WindFSAsset::destroy() +{ + if (mParams) + { + mParams->destroy(); + mParams = 0; + } + + if (mDefaultActorParams) + { + mDefaultActorParams->destroy(); + mDefaultActorParams = 0; + } + + /* Actors are automatically cleaned up on deletion by ResourceList dtor */ + delete this; +} + +NvParameterized::Interface* WindFSAsset::getDefaultActorDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultActorParams) + { + NvParameterized::Interface* param = traits->createNvParameterized(WindFSActorParams::staticClassName()); + mDefaultActorParams = static_cast<WindFSActorParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + else + { + mDefaultActorParams->initDefaults(); + } + + return mDefaultActorParams; +} + +Actor* WindFSAsset::createApexActor(const NvParameterized::Interface& params, Scene& apexScene) +{ + Actor* ret = 0; + + if (nvidia::strcmp(params.className(), WindFSActorParams::staticClassName()) == 0) + { + const WindFSActorParams& actorParams = static_cast<const WindFSActorParams&>(params); + + BasicFSScene* es = mModule->getBasicFSScene(apexScene); + ret = es->createWindFSActor(actorParams, *this, mFSActors); + } + return ret; +} + +NvParameterized::Interface* WindFSAsset::getDefaultAssetPreviewDesc() +{ + NvParameterized::Traits* traits = GetInternalApexSDK()->getParameterizedTraits(); + PX_ASSERT(traits); + if (!traits) + { + return NULL; + } + + // create if not yet created + if (!mDefaultPreviewParams) + { + const char* className = WindFSPreviewParams::staticClassName(); + NvParameterized::Interface* param = traits->createNvParameterized(className); + mDefaultPreviewParams = static_cast<WindFSPreviewParams*>(param); + + PX_ASSERT(param); + if (!param) + { + return NULL; + } + } + + return mDefaultPreviewParams; +} + +AssetPreview* WindFSAsset::createApexAssetPreview(const NvParameterized::Interface& params, AssetPreviewScene* previewScene) +{ + AssetPreview* ret = 0; + + const char* className = params.className(); + if (nvidia::strcmp(className, WindFSPreviewParams::staticClassName()) == 0) + { + WindFSPreviewDesc desc; + const WindFSPreviewParams* pDesc = static_cast<const WindFSPreviewParams*>(¶ms); + + desc.mPose = pDesc->globalPose; + + desc.mPreviewDetail = 0; + if (pDesc->drawAssetInfo) + { + desc.mPreviewDetail |= APEX_WIND::WIND_DRAW_ASSET_INFO; + } + + ret = createWindFSPreview(desc, previewScene); + } + + return ret; +} + +WindFSPreview* WindFSAsset::createWindFSPreview(const WindFSPreviewDesc& desc, AssetPreviewScene* previewScene) +{ + return createWindFSPreviewImpl(desc, this, previewScene); +} + +WindFSPreview* WindFSAsset::createWindFSPreviewImpl(const WindFSPreviewDesc& desc, WindFSAsset* jetAsset, AssetPreviewScene* previewScene) +{ + return PX_NEW(WindFSAssetPreview)(desc, mModule->mSdk, jetAsset, previewScene); +} + +void WindFSAsset::releaseWindFSPreview(WindFSPreview& nxpreview) +{ + WindFSAssetPreview* preview = DYNAMIC_CAST(WindFSAssetPreview*)(&nxpreview); + preview->destroy(); +} + +} +} // end namespace nvidia::apex + diff --git a/APEX_1.4/module/basicfs/src/WindFSAssetPreview.cpp b/APEX_1.4/module/basicfs/src/WindFSAssetPreview.cpp new file mode 100644 index 00000000..d4495add --- /dev/null +++ b/APEX_1.4/module/basicfs/src/WindFSAssetPreview.cpp @@ -0,0 +1,182 @@ +/* + * 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 "ApexDefs.h" +#include "nvparameterized/NvParamUtils.h" +#include "WindFSAsset.h" +#include "WindFSAssetParams.h" +#include "WindFSPreview.h" +#include "WindFSAssetPreview.h" +#include "ModulePerfScope.h" +#include "ApexUsingNamespace.h" + +#include "WriteCheck.h" + +namespace nvidia +{ +namespace basicfs +{ + +using namespace APEX_WIND; + + +#define ASSET_INFO_XPOS (-0.9f) // left position of the asset info +#define ASSET_INFO_YPOS ( 0.9f) // top position of the asset info +#define DEBUG_TEXT_HEIGHT (0.35f) //in screen space -- would be nice to know this! + + +void WindFSAssetPreview::drawInfoLine(uint32_t lineNum, const char* str) +{ +#ifdef WITHOUT_DEBUG_VISUALIZE + PX_UNUSED(lineNum); + PX_UNUSED(str); +#else + PxMat44 cameraMatrix = mPreviewScene->getCameraMatrix(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentColor(RENDER_DEBUG_IFACE(mApexRenderDebug)->getDebugColor(RENDER_DEBUG::DebugColors::Blue)); + PxVec3 textLocation = mPose.getPosition(); + textLocation += cameraMatrix.column1.getXYZ() * (ASSET_INFO_YPOS - (lineNum * DEBUG_TEXT_HEIGHT)); + RENDER_DEBUG_IFACE(mApexRenderDebug)->debugText(textLocation, str); +#endif +} + +void WindFSAssetPreview::drawPreviewAssetInfo() +{ +#ifndef WITHOUT_DEBUG_VISUALIZE + if (!mApexRenderDebug) + { + return; + } + + char buf[128]; + buf[sizeof(buf) - 1] = 0; + + ApexSimpleString myString; + ApexSimpleString floatStr; + uint32_t lineNum = 0; + + RENDER_DEBUG_IFACE(mApexRenderDebug)->pushRenderState(); + RENDER_DEBUG_IFACE(mApexRenderDebug)->addToCurrentState(RENDER_DEBUG::DebugRenderState::NoZbuffer); + RENDER_DEBUG_IFACE(mApexRenderDebug)->setCurrentTextScale(1.0f); + + // asset name + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "%s %s", mAsset->getObjTypeName(), mAsset->getName()); + drawInfoLine(lineNum++, buf); + lineNum++; + + if(mPreviewScene->getShowFullInfo()) + { + // TODO: cache strings + WindFSAssetParams& assetParams = *static_cast<WindFSAssetParams*>(mAsset->getAssetNvParameterized()); + + APEX_SPRINTF_S(buf, sizeof(buf) - 1, "fieldStrength = %f", + assetParams.fieldStrength + ); + drawInfoLine(lineNum++, buf); + } + RENDER_DEBUG_IFACE(mApexRenderDebug)->popRenderState(); +#endif +} + +WindFSAssetPreview::~WindFSAssetPreview(void) +{ +} + +void WindFSAssetPreview::setPose(const PxMat44& pose) +{ + mPose = pose; +} + +const PxMat44 WindFSAssetPreview::getPose() const +{ + return mPose; +} + + +// from RenderDataProvider +void WindFSAssetPreview::lockRenderResources(void) +{ + ApexRenderable::renderDataLock(); +} + +void WindFSAssetPreview::unlockRenderResources(void) +{ + ApexRenderable::renderDataUnLock(); +} + +void WindFSAssetPreview::updateRenderResources(bool /*rewriteBuffers*/, void* /*userRenderData*/) +{ + if (mApexRenderDebug) + { + mApexRenderDebug->updateRenderResources(); + } +} + +// from Renderable.h +void WindFSAssetPreview::dispatchRenderResources(UserRenderer& renderer) +{ + if (mApexRenderDebug) + { + if (mPreviewDetail & WIND_DRAW_ASSET_INFO) + { + drawPreviewAssetInfo(); + } + mApexRenderDebug->dispatchRenderResources(renderer); + } +} + +PxBounds3 WindFSAssetPreview::getBounds(void) const +{ + if (mApexRenderDebug) + { + return mApexRenderDebug->getBounds(); + } + else + { + PxBounds3 b; + b.setEmpty(); + return b; + } +} + +void WindFSAssetPreview::destroy(void) +{ + delete this; +} + +void WindFSAssetPreview::release(void) +{ + if (mInRelease) + { + return; + } + mInRelease = true; + mAsset->releaseWindFSPreview(*this); +} + +WindFSAssetPreview::WindFSAssetPreview(const WindFSPreviewDesc& PreviewDesc, ApexSDK* myApexSDK, WindFSAsset* myWindFSAsset, AssetPreviewScene* previewScene) : + mPose(PreviewDesc.mPose), + mApexSDK(myApexSDK), + mAsset(myWindFSAsset), + mPreviewScene(previewScene), + mPreviewDetail(PreviewDesc.mPreviewDetail), + mApexRenderDebug(0) +{ +}; + + +void WindFSAssetPreview::setDetailLevel(uint32_t detail) +{ + WRITE_ZONE(); + mPreviewDetail = detail; +} + +} +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/AttractorFSActorParams.cpp b/APEX_1.4/module/basicfs/src/autogen/AttractorFSActorParams.cpp new file mode 100644 index 00000000..3f796b45 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/AttractorFSActorParams.cpp @@ -0,0 +1,402 @@ +// 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 "AttractorFSActorParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace AttractorFSActorParamsNS; + +const char* const AttractorFSActorParamsFactory::vptr = + NvParameterized::getVptr<AttractorFSActorParams, AttractorFSActorParams::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), 4 }, + { TYPE_TRANSFORM, false, (size_t)(&((ParametersStruct*)0)->initialPose), NULL, 0 }, // initialPose + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->initialScale), NULL, 0 }, // initialScale + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool AttractorFSActorParams::mBuiltFlag = false; +NvParameterized::MutexType AttractorFSActorParams::mBuiltFlagMutex; + +AttractorFSActorParams::AttractorFSActorParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &AttractorFSActorParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +AttractorFSActorParams::~AttractorFSActorParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void AttractorFSActorParams::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->~AttractorFSActorParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* AttractorFSActorParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* AttractorFSActorParams::getParameterDefinitionTree(void) const +{ + AttractorFSActorParams* tmpParam = const_cast<AttractorFSActorParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType AttractorFSActorParams::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 AttractorFSActorParams::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 AttractorFSActorParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<AttractorFSActorParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void AttractorFSActorParams::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 AttractorFSActorParams::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="initialPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("initialPose", TYPE_TRANSFORM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "The initial pose of the actor. This includes both translation and rotation.", true); + HintTable[1].init("shortDescription", "The initial pose of the actor.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="initialScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("initialScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The initial space scale of the actor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[3].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", "The filter data name for AttractorFS vs Field Boundaries interaction. Overrides asset's value.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for AttractorFS vs other Field Samplers interaction. Overrides asset's value.", true); + ParamDefTable[4].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); + } + + mBuiltFlag = true; + +} +void AttractorFSActorParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void AttractorFSActorParams::initDynamicArrays(void) +{ +} + +void AttractorFSActorParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + initialPose = physx::PxTransform(physx::PxIdentity); + initialScale = float(1.0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void AttractorFSActorParams::initReferences(void) +{ +} + +void AttractorFSActorParams::freeDynamicArrays(void) +{ +} + +void AttractorFSActorParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void AttractorFSActorParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/AttractorFSAssetParams.cpp b/APEX_1.4/module/basicfs/src/autogen/AttractorFSAssetParams.cpp new file mode 100644 index 00000000..aae907cd --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/AttractorFSAssetParams.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 "AttractorFSAssetParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace AttractorFSAssetParamsNS; + +const char* const AttractorFSAssetParamsFactory::vptr = + NvParameterized::getVptr<AttractorFSAssetParams, AttractorFSAssetParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 9; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 8 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->boundaryFadePercentage), NULL, 0 }, // boundaryFadePercentage + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->radius), NULL, 0 }, // radius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->constFieldStrength), NULL, 0 }, // constFieldStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->variableFieldStrength), NULL, 0 }, // variableFieldStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDragCoeff), NULL, 0 }, // fieldDragCoeff + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldWeight), NULL, 0 }, // fieldWeight + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool AttractorFSAssetParams::mBuiltFlag = false; +NvParameterized::MutexType AttractorFSAssetParams::mBuiltFlagMutex; + +AttractorFSAssetParams::AttractorFSAssetParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &AttractorFSAssetParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +AttractorFSAssetParams::~AttractorFSAssetParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void AttractorFSAssetParams::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->~AttractorFSAssetParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* AttractorFSAssetParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* AttractorFSAssetParams::getParameterDefinitionTree(void) const +{ + AttractorFSAssetParams* tmpParam = const_cast<AttractorFSAssetParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType AttractorFSAssetParams::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 AttractorFSAssetParams::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 AttractorFSAssetParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<AttractorFSAssetParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void AttractorFSAssetParams::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 AttractorFSAssetParams::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 this Attractor Field Sampler.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="boundaryFadePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("boundaryFadePercentage", 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[1].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", "Percentage of distance from boundary to center where fade out starts.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="radius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("radius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Radius of the sphere where attracting force is acting.", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="constFieldStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("constFieldStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Coefficient that sets strength of the constant part of attracting force.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="variableFieldStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("variableFieldStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "Variable part of the force is proportional to this coefficient and inverse proportional to distance from the senter of attractor.", true); + HintTable[1].init("shortDescription", "Coefficient that sets strength of the variable part of attracting force.", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="fieldDragCoeff" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("fieldDragCoeff", 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[5].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", "Field drag coefficient. When it equals to 0, then the field is applied as a direct velocity.", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="fieldWeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("fieldWeight", 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", "A weight for the field, it controls how strongly the field affects particles", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[7].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", "The filter data name for AttractorFS vs Field Boundaries interaction.", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for AttractorFS vs other Field Samplers interaction.", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[8]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + + ParamDefTable[0].setChildren(Children, 8); + } + + mBuiltFlag = true; + +} +void AttractorFSAssetParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void AttractorFSAssetParams::initDynamicArrays(void) +{ +} + +void AttractorFSAssetParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + boundaryFadePercentage = float(0.1); + radius = float(0); + constFieldStrength = float(0); + variableFieldStrength = float(0); + fieldDragCoeff = float(0); + fieldWeight = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void AttractorFSAssetParams::initReferences(void) +{ +} + +void AttractorFSAssetParams::freeDynamicArrays(void) +{ +} + +void AttractorFSAssetParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void AttractorFSAssetParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/AttractorFSPreviewParams.cpp b/APEX_1.4/module/basicfs/src/autogen/AttractorFSPreviewParams.cpp new file mode 100644 index 00000000..1c8fff7c --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/AttractorFSPreviewParams.cpp @@ -0,0 +1,407 @@ +// 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 "AttractorFSPreviewParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace AttractorFSPreviewParamsNS; + +const char* const AttractorFSPreviewParamsFactory::vptr = + NvParameterized::getVptr<AttractorFSPreviewParams, AttractorFSPreviewParams::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), 4 }, + { TYPE_MAT44, false, (size_t)(&((ParametersStruct*)0)->globalPose), NULL, 0 }, // globalPose + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawShape), NULL, 0 }, // drawShape + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawAssetInfo), NULL, 0 }, // drawAssetInfo + { TYPE_U64, false, (size_t)(&((ParametersStruct*)0)->userData), NULL, 0 }, // userData +}; + + +bool AttractorFSPreviewParams::mBuiltFlag = false; +NvParameterized::MutexType AttractorFSPreviewParams::mBuiltFlagMutex; + +AttractorFSPreviewParams::AttractorFSPreviewParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &AttractorFSPreviewParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +AttractorFSPreviewParams::~AttractorFSPreviewParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void AttractorFSPreviewParams::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->~AttractorFSPreviewParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* AttractorFSPreviewParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* AttractorFSPreviewParams::getParameterDefinitionTree(void) const +{ + AttractorFSPreviewParams* tmpParam = const_cast<AttractorFSPreviewParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType AttractorFSPreviewParams::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 AttractorFSPreviewParams::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 AttractorFSPreviewParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<AttractorFSPreviewParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void AttractorFSPreviewParams::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 AttractorFSPreviewParams::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="globalPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("globalPose", TYPE_MAT44, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "The pose that translates from turbulence preview coordinates to world coordinates", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="drawShape" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("drawShape", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Draw the box", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="drawAssetInfo" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("drawAssetInfo", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Display asset info", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="userData" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("userData", TYPE_U64, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Optional user data pointer associated with the attractor actor", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#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); + } + + mBuiltFlag = true; + +} +void AttractorFSPreviewParams::initStrings(void) +{ +} + +void AttractorFSPreviewParams::initDynamicArrays(void) +{ +} + +void AttractorFSPreviewParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + globalPose = physx::PxMat44(physx::PxVec4(1.0f)); + drawShape = bool(0); + drawAssetInfo = bool(0); + userData = uint64_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void AttractorFSPreviewParams::initReferences(void) +{ +} + +void AttractorFSPreviewParams::freeDynamicArrays(void) +{ +} + +void AttractorFSPreviewParams::freeStrings(void) +{ +} + +void AttractorFSPreviewParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/BasicFSDebugRenderParams.cpp b/APEX_1.4/module/basicfs/src/autogen/BasicFSDebugRenderParams.cpp new file mode 100644 index 00000000..deaacea8 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/BasicFSDebugRenderParams.cpp @@ -0,0 +1,833 @@ +// 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 "BasicFSDebugRenderParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace BasicFSDebugRenderParamsNS; + +const char* const BasicFSDebugRenderParamsFactory::vptr = + NvParameterized::getVptr<BasicFSDebugRenderParams, BasicFSDebugRenderParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 23; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 22 }, + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_JET_FS_ACTOR), NULL, 0 }, // VISUALIZE_JET_FS_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_JET_FS_ACTOR_NAME), NULL, 0 }, // VISUALIZE_JET_FS_ACTOR_NAME + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_JET_FS_SHAPE), NULL, 0 }, // VISUALIZE_JET_FS_SHAPE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_JET_FS_FIELD), NULL, 0 }, // VISUALIZE_JET_FS_FIELD + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_JET_FS_POSE), NULL, 0 }, // VISUALIZE_JET_FS_POSE + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->JET_FS_FIELD_SCALE), NULL, 0 }, // JET_FS_FIELD_SCALE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_ATTRACTOR_FS_ACTOR), NULL, 0 }, // VISUALIZE_ATTRACTOR_FS_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_ATTRACTOR_FS_ACTOR_NAME), NULL, 0 }, // VISUALIZE_ATTRACTOR_FS_ACTOR_NAME + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_ATTRACTOR_FS_SHAPE), NULL, 0 }, // VISUALIZE_ATTRACTOR_FS_SHAPE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_ATTRACTOR_FS_FIELD), NULL, 0 }, // VISUALIZE_ATTRACTOR_FS_FIELD + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_ATTRACTOR_FS_POSE), NULL, 0 }, // VISUALIZE_ATTRACTOR_FS_POSE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_VORTEX_FS_ACTOR), NULL, 0 }, // VISUALIZE_VORTEX_FS_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_VORTEX_FS_ACTOR_NAME), NULL, 0 }, // VISUALIZE_VORTEX_FS_ACTOR_NAME + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_VORTEX_FS_SHAPE), NULL, 0 }, // VISUALIZE_VORTEX_FS_SHAPE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_VORTEX_FS_FIELD), NULL, 0 }, // VISUALIZE_VORTEX_FS_FIELD + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_VORTEX_FS_POSE), NULL, 0 }, // VISUALIZE_VORTEX_FS_POSE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_NOISE_FS_ACTOR), NULL, 0 }, // VISUALIZE_NOISE_FS_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_NOISE_FS_ACTOR_NAME), NULL, 0 }, // VISUALIZE_NOISE_FS_ACTOR_NAME + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_NOISE_FS_SHAPE), NULL, 0 }, // VISUALIZE_NOISE_FS_SHAPE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_NOISE_FS_POSE), NULL, 0 }, // VISUALIZE_NOISE_FS_POSE + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_WIND_FS_ACTOR), NULL, 0 }, // VISUALIZE_WIND_FS_ACTOR + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->VISUALIZE_WIND_FS_ACTOR_NAME), NULL, 0 }, // VISUALIZE_WIND_FS_ACTOR_NAME +}; + + +bool BasicFSDebugRenderParams::mBuiltFlag = false; +NvParameterized::MutexType BasicFSDebugRenderParams::mBuiltFlagMutex; + +BasicFSDebugRenderParams::BasicFSDebugRenderParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &BasicFSDebugRenderParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +BasicFSDebugRenderParams::~BasicFSDebugRenderParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void BasicFSDebugRenderParams::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->~BasicFSDebugRenderParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* BasicFSDebugRenderParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* BasicFSDebugRenderParams::getParameterDefinitionTree(void) const +{ + BasicFSDebugRenderParams* tmpParam = const_cast<BasicFSDebugRenderParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType BasicFSDebugRenderParams::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 BasicFSDebugRenderParams::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 BasicFSDebugRenderParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<BasicFSDebugRenderParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void BasicFSDebugRenderParams::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 BasicFSDebugRenderParams::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_JET_FS_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("VISUALIZE_JET_FS_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", "Enables/Disables visualization of all JetFS actors.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="VISUALIZE_JET_FS_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("VISUALIZE_JET_FS_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", "Displays the name of each JetFS actor.", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="VISUALIZE_JET_FS_SHAPE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("VISUALIZE_JET_FS_SHAPE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the toroidal field shape (blue closed lattice).", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="VISUALIZE_JET_FS_FIELD" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("VISUALIZE_JET_FS_FIELD", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the toroidal field itself (streaklines).", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="VISUALIZE_JET_FS_POSE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("VISUALIZE_JET_FS_POSE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "For visualizing the position of the field itself. Draws arrows which represent axes. Blue arrow stands for Z axis, green - for Y and red - X.", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="JET_FS_FIELD_SCALE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("JET_FS_FIELD_SCALE", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Changes toroidal field arrows' length. The larger parameter, the longer each arrow.", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="VISUALIZE_ATTRACTOR_FS_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("VISUALIZE_ATTRACTOR_FS_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", "Enables/Disables visualization of all AttractorFS actors.", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="VISUALIZE_ATTRACTOR_FS_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("VISUALIZE_ATTRACTOR_FS_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", "Displays the name of each AttractorFS actor.", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=9, longName="VISUALIZE_ATTRACTOR_FS_SHAPE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[9]; + ParamDef->init("VISUALIZE_ATTRACTOR_FS_SHAPE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the field shape (blue closed lattice).", true); + ParamDefTable[9].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=10, longName="VISUALIZE_ATTRACTOR_FS_FIELD" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[10]; + ParamDef->init("VISUALIZE_ATTRACTOR_FS_FIELD", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the field itself (streaklines).", true); + ParamDefTable[10].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=11, longName="VISUALIZE_ATTRACTOR_FS_POSE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[11]; + ParamDef->init("VISUALIZE_ATTRACTOR_FS_POSE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "For visualizing the position of the field itself. Draws arrows which represent axes. Blue arrow stands for Z axis, green - for Y and red - X.", true); + ParamDefTable[11].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=12, longName="VISUALIZE_VORTEX_FS_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[12]; + ParamDef->init("VISUALIZE_VORTEX_FS_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", "Enables/Disables visualization of all VortexFS actors.", true); + ParamDefTable[12].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=13, longName="VISUALIZE_VORTEX_FS_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[13]; + ParamDef->init("VISUALIZE_VORTEX_FS_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", "Displays the name of each VortexFS actor.", true); + ParamDefTable[13].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=14, longName="VISUALIZE_VORTEX_FS_SHAPE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[14]; + ParamDef->init("VISUALIZE_VORTEX_FS_SHAPE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the field shape (blue closed lattice).", true); + ParamDefTable[14].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=15, longName="VISUALIZE_VORTEX_FS_FIELD" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[15]; + ParamDef->init("VISUALIZE_VORTEX_FS_FIELD", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of the field itself (streaklines).", true); + ParamDefTable[15].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=16, longName="VISUALIZE_VORTEX_FS_POSE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[16]; + ParamDef->init("VISUALIZE_VORTEX_FS_POSE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "For visualizing the position of the field itself. Draws arrows which represent axes. Blue arrow stands for Z axis, green - for Y and red - X.", true); + ParamDefTable[16].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=17, longName="VISUALIZE_NOISE_FS_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[17]; + ParamDef->init("VISUALIZE_NOISE_FS_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", "Enables/Disables visualization of all NoiseFS actors.", true); + ParamDefTable[17].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=18, longName="VISUALIZE_NOISE_FS_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[18]; + ParamDef->init("VISUALIZE_NOISE_FS_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", "Displays the name of each NoiseFS actor.", true); + ParamDefTable[18].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=19, longName="VISUALIZE_NOISE_FS_SHAPE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[19]; + ParamDef->init("VISUALIZE_NOISE_FS_SHAPE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Enables/Disables visualization of each NoiseFS actor shape.", true); + ParamDefTable[19].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=20, longName="VISUALIZE_NOISE_FS_POSE" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[20]; + ParamDef->init("VISUALIZE_NOISE_FS_POSE", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "For visualizing the position of the field itself. Draws arrows which represent axes. Blue arrow stands for Z axis, green - for Y and red - X.", true); + ParamDefTable[20].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=21, longName="VISUALIZE_WIND_FS_ACTOR" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[21]; + ParamDef->init("VISUALIZE_WIND_FS_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", "Enables/Disables visualization of all WindFS actors.", true); + ParamDefTable[21].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=22, longName="VISUALIZE_WIND_FS_ACTOR_NAME" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[22]; + ParamDef->init("VISUALIZE_WIND_FS_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", "Displays the name of each WindFS actor.", true); + ParamDefTable[22].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[22]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + Children[8] = PDEF_PTR(9); + Children[9] = PDEF_PTR(10); + Children[10] = PDEF_PTR(11); + Children[11] = PDEF_PTR(12); + Children[12] = PDEF_PTR(13); + Children[13] = PDEF_PTR(14); + Children[14] = PDEF_PTR(15); + Children[15] = PDEF_PTR(16); + Children[16] = PDEF_PTR(17); + Children[17] = PDEF_PTR(18); + Children[18] = PDEF_PTR(19); + Children[19] = PDEF_PTR(20); + Children[20] = PDEF_PTR(21); + Children[21] = PDEF_PTR(22); + + ParamDefTable[0].setChildren(Children, 22); + } + + mBuiltFlag = true; + +} +void BasicFSDebugRenderParams::initStrings(void) +{ +} + +void BasicFSDebugRenderParams::initDynamicArrays(void) +{ +} + +void BasicFSDebugRenderParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + VISUALIZE_JET_FS_ACTOR = bool(false); + VISUALIZE_JET_FS_ACTOR_NAME = bool(true); + VISUALIZE_JET_FS_SHAPE = bool(true); + VISUALIZE_JET_FS_FIELD = bool(true); + VISUALIZE_JET_FS_POSE = bool(true); + JET_FS_FIELD_SCALE = float(1.0); + VISUALIZE_ATTRACTOR_FS_ACTOR = bool(false); + VISUALIZE_ATTRACTOR_FS_ACTOR_NAME = bool(true); + VISUALIZE_ATTRACTOR_FS_SHAPE = bool(true); + VISUALIZE_ATTRACTOR_FS_FIELD = bool(true); + VISUALIZE_ATTRACTOR_FS_POSE = bool(true); + VISUALIZE_VORTEX_FS_ACTOR = bool(false); + VISUALIZE_VORTEX_FS_ACTOR_NAME = bool(true); + VISUALIZE_VORTEX_FS_SHAPE = bool(true); + VISUALIZE_VORTEX_FS_FIELD = bool(true); + VISUALIZE_VORTEX_FS_POSE = bool(true); + VISUALIZE_NOISE_FS_ACTOR = bool(false); + VISUALIZE_NOISE_FS_ACTOR_NAME = bool(true); + VISUALIZE_NOISE_FS_SHAPE = bool(true); + VISUALIZE_NOISE_FS_POSE = bool(true); + VISUALIZE_WIND_FS_ACTOR = bool(false); + VISUALIZE_WIND_FS_ACTOR_NAME = bool(true); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void BasicFSDebugRenderParams::initReferences(void) +{ +} + +void BasicFSDebugRenderParams::freeDynamicArrays(void) +{ +} + +void BasicFSDebugRenderParams::freeStrings(void) +{ +} + +void BasicFSDebugRenderParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/BasicFSModuleParameters.cpp b/APEX_1.4/module/basicfs/src/autogen/BasicFSModuleParameters.cpp new file mode 100644 index 00000000..8e1ec5e3 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/BasicFSModuleParameters.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 "BasicFSModuleParameters.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace BasicFSModuleParametersNS; + +const char* const BasicFSModuleParametersFactory::vptr = + NvParameterized::getVptr<BasicFSModuleParameters, BasicFSModuleParameters::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 BasicFSModuleParameters::mBuiltFlag = false; +NvParameterized::MutexType BasicFSModuleParameters::mBuiltFlagMutex; + +BasicFSModuleParameters::BasicFSModuleParameters(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &BasicFSModuleParametersFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +BasicFSModuleParameters::~BasicFSModuleParameters() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void BasicFSModuleParameters::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->~BasicFSModuleParameters(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* BasicFSModuleParameters::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* BasicFSModuleParameters::getParameterDefinitionTree(void) const +{ + BasicFSModuleParameters* tmpParam = const_cast<BasicFSModuleParameters*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType BasicFSModuleParameters::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 BasicFSModuleParameters::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 BasicFSModuleParameters::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<BasicFSModuleParameters::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void BasicFSModuleParameters::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 BasicFSModuleParameters::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 ModuleBasicFS.", 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 BasicFSModuleParameters::initStrings(void) +{ +} + +void BasicFSModuleParameters::initDynamicArrays(void) +{ +} + +void BasicFSModuleParameters::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + unused = uint32_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void BasicFSModuleParameters::initReferences(void) +{ +} + +void BasicFSModuleParameters::freeDynamicArrays(void) +{ +} + +void BasicFSModuleParameters::freeStrings(void) +{ +} + +void BasicFSModuleParameters::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/JetFSActorParams.cpp b/APEX_1.4/module/basicfs/src/autogen/JetFSActorParams.cpp new file mode 100644 index 00000000..2462b312 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/JetFSActorParams.cpp @@ -0,0 +1,402 @@ +// 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 "JetFSActorParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace JetFSActorParamsNS; + +const char* const JetFSActorParamsFactory::vptr = + NvParameterized::getVptr<JetFSActorParams, JetFSActorParams::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), 4 }, + { TYPE_TRANSFORM, false, (size_t)(&((ParametersStruct*)0)->initialPose), NULL, 0 }, // initialPose + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->initialScale), NULL, 0 }, // initialScale + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool JetFSActorParams::mBuiltFlag = false; +NvParameterized::MutexType JetFSActorParams::mBuiltFlagMutex; + +JetFSActorParams::JetFSActorParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &JetFSActorParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +JetFSActorParams::~JetFSActorParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void JetFSActorParams::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->~JetFSActorParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* JetFSActorParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* JetFSActorParams::getParameterDefinitionTree(void) const +{ + JetFSActorParams* tmpParam = const_cast<JetFSActorParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType JetFSActorParams::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 JetFSActorParams::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 JetFSActorParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<JetFSActorParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void JetFSActorParams::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 JetFSActorParams::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="initialPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("initialPose", TYPE_TRANSFORM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "The initial pose of the actor. This includes both translation and rotation.", true); + HintTable[1].init("shortDescription", "The initial pose of the actor.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="initialScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("initialScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The initial space scale of the actor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[3].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", "The filter data name for JetFS vs Field Boundaries interaction. Overrides asset's value.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for JetFS vs other Field Samplers interaction. Overrides asset's value.", true); + ParamDefTable[4].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); + } + + mBuiltFlag = true; + +} +void JetFSActorParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void JetFSActorParams::initDynamicArrays(void) +{ +} + +void JetFSActorParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + initialPose = physx::PxTransform(physx::PxIdentity); + initialScale = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void JetFSActorParams::initReferences(void) +{ +} + +void JetFSActorParams::freeDynamicArrays(void) +{ +} + +void JetFSActorParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void JetFSActorParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/JetFSAssetParams.cpp b/APEX_1.4/module/basicfs/src/autogen/JetFSAssetParams.cpp new file mode 100644 index 00000000..5f710ab7 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/JetFSAssetParams.cpp @@ -0,0 +1,1004 @@ +// 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 "JetFSAssetParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace JetFSAssetParamsNS; + +const char* const JetFSAssetParamsFactory::vptr = + NvParameterized::getVptr<JetFSAssetParams, JetFSAssetParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 26; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 25 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->defaultScale), NULL, 0 }, // defaultScale + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->boundaryFadePercentage), NULL, 0 }, // boundaryFadePercentage + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->fieldDirection), NULL, 0 }, // fieldDirection + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDirectionDeviationAngle), NULL, 0 }, // fieldDirectionDeviationAngle + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDirectionOscillationPeriod), NULL, 0 }, // fieldDirectionOscillationPeriod + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrength), NULL, 0 }, // fieldStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrengthDeviationPercentage), NULL, 0 }, // fieldStrengthDeviationPercentage + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrengthOscillationPeriod), NULL, 0 }, // fieldStrengthOscillationPeriod + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->gridShapeRadius), NULL, 0 }, // gridShapeRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->gridShapeHeight), NULL, 0 }, // gridShapeHeight + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->gridBoundaryFadePercentage), NULL, 0 }, // gridBoundaryFadePercentage + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->nearRadius), NULL, 0 }, // nearRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->pivotRadius), NULL, 0 }, // pivotRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->farRadius), NULL, 0 }, // farRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->directionalStretch), NULL, 0 }, // directionalStretch + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->averageStartDistance), NULL, 0 }, // averageStartDistance + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->averageEndDistance), NULL, 0 }, // averageEndDistance + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noisePercentage), NULL, 0 }, // noisePercentage + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseSpaceScale), NULL, 0 }, // noiseSpaceScale + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseTimeScale), NULL, 0 }, // noiseTimeScale + { TYPE_U32, false, (size_t)(&((ParametersStruct*)0)->noiseOctaves), NULL, 0 }, // noiseOctaves + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDragCoeff), NULL, 0 }, // fieldDragCoeff + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldWeight), NULL, 0 }, // fieldWeight + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool JetFSAssetParams::mBuiltFlag = false; +NvParameterized::MutexType JetFSAssetParams::mBuiltFlagMutex; + +JetFSAssetParams::JetFSAssetParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &JetFSAssetParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +JetFSAssetParams::~JetFSAssetParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void JetFSAssetParams::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->~JetFSAssetParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* JetFSAssetParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* JetFSAssetParams::getParameterDefinitionTree(void) const +{ + JetFSAssetParams* tmpParam = const_cast<JetFSAssetParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType JetFSAssetParams::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 JetFSAssetParams::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 JetFSAssetParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<JetFSAssetParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void JetFSAssetParams::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 JetFSAssetParams::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 this Jet Field Sampler.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="defaultScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("defaultScale", TYPE_F32, 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[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("HIDDEN", uint64_t(1), true); + HintTable[1].init("longDescription", "The default scale factor of the boundary shape. The default value is 1.0.", true); + HintTable[2].init("shortDescription", "The default scale factor of the boundary shape.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="boundaryFadePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("boundaryFadePercentage", 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[2].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", "Percentage of distance from boundary to center where fade out starts", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldDirection" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldDirection", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "field direction.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldDirectionDeviationAngle" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldDirectionDeviationAngle", 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(180), true); + HintTable[1].init("min", uint64_t(0), true); + ParamDefTable[4].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("longDescription", "The fieldDirectionDeviationAngle parameter controls the deviation in angle of the field direction.\n", true); + HintTable[1].init("max", uint64_t(180), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "field direction deviation angle (in degrees).", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="fieldDirectionOscillationPeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("fieldDirectionOscillationPeriod", 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[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("longDescription", "The fieldDirectionOscillationPeriod defines the period of the field direction oscillation.\nIf the fieldDirectionDeviationAngle is non-zero the period of each sinusoidal cycle will be this parameter in seconds.\n", true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "field direction oscillation period in seconds.", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="fieldStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("fieldStrength", 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[6].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", "field strength.", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="fieldStrengthDeviationPercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("fieldStrengthDeviationPercentage", 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[7].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("longDescription", "The fieldStrengthDeviationPercentage parameter controls the deviation in % of the field strength.\n", true); + HintTable[1].init("max", uint64_t(1), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "+/- field strength deviation percentage.", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="fieldStrengthOscillationPeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("fieldStrengthOscillationPeriod", 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[8].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("longDescription", "The fieldStrengthOscillationPeriod defines the period of the field strength oscillation.\nIf the fieldStrengthDeviationPercentage is non-zero the period of each sinusoidal cycle will be this parameter in seconds.\n", true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "field strength oscillation period in seconds.", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=9, longName="gridShapeRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[9]; + ParamDef->init("gridShapeRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Radius of sphere or capsule shape inside of the grid", true); + ParamDefTable[9].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=10, longName="gridShapeHeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[10]; + ParamDef->init("gridShapeHeight", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Height of capsule shape inside of the grid", true); + ParamDefTable[10].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=11, longName="gridBoundaryFadePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[11]; + ParamDef->init("gridBoundaryFadePercentage", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Percentage of distance from boundary to center where fade out starts", true); + ParamDefTable[11].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=12, longName="nearRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[12]; + ParamDef->init("nearRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "near radius of the toroidal field. (inside this radius there's the strongest field)", true); + ParamDefTable[12].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=13, longName="pivotRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[13]; + ParamDef->init("pivotRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "pivot radiues of the toroidal field. (this is the center of the field where it reaches zero)", true); + ParamDefTable[13].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=14, longName="farRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[14]; + ParamDef->init("farRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "far radius of the toroidal field. (outside this radius the field is empty)", true); + ParamDefTable[14].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=15, longName="directionalStretch" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[15]; + ParamDef->init("directionalStretch", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "stretch of the field along the direction", true); + ParamDefTable[15].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=16, longName="averageStartDistance" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[16]; + ParamDef->init("averageStartDistance", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "start distance of blending between averaged & oscilating fields", true); + ParamDefTable[16].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=17, longName="averageEndDistance" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[17]; + ParamDef->init("averageEndDistance", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "end distance of blending between averaged & oscilating fields", true); + ParamDefTable[17].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=18, longName="noisePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[18]; + ParamDef->init("noisePercentage", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "noise level in percentage of field strength", true); + ParamDefTable[18].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=19, longName="noiseSpaceScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[19]; + ParamDef->init("noiseSpaceScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "space scale of the noise function", true); + ParamDefTable[19].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=20, longName="noiseTimeScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[20]; + ParamDef->init("noiseTimeScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "time scale of the noise function", true); + ParamDefTable[20].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=21, longName="noiseOctaves" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[21]; + ParamDef->init("noiseOctaves", TYPE_U32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "number of the noise octaves (more octaves give more turbulent noise, but increase computational time)", true); + ParamDefTable[21].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=22, longName="fieldDragCoeff" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[22]; + ParamDef->init("fieldDragCoeff", 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[22].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", "Field drag coefficient. When it equals to 0, then the field is applied as a direct velocity.", true); + ParamDefTable[22].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=23, longName="fieldWeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[23]; + ParamDef->init("fieldWeight", 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[23].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", "A weight for the field, it controls how strongly the field affects particles", true); + ParamDefTable[23].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=24, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[24]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[24].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", "The filter data name for JetFS vs Field Boundaries interaction.", true); + ParamDefTable[24].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=25, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[25]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for JetFS vs other Field Samplers interaction.", true); + ParamDefTable[25].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[25]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + Children[8] = PDEF_PTR(9); + Children[9] = PDEF_PTR(10); + Children[10] = PDEF_PTR(11); + Children[11] = PDEF_PTR(12); + Children[12] = PDEF_PTR(13); + Children[13] = PDEF_PTR(14); + Children[14] = PDEF_PTR(15); + Children[15] = PDEF_PTR(16); + Children[16] = PDEF_PTR(17); + Children[17] = PDEF_PTR(18); + Children[18] = PDEF_PTR(19); + Children[19] = PDEF_PTR(20); + Children[20] = PDEF_PTR(21); + Children[21] = PDEF_PTR(22); + Children[22] = PDEF_PTR(23); + Children[23] = PDEF_PTR(24); + Children[24] = PDEF_PTR(25); + + ParamDefTable[0].setChildren(Children, 25); + } + + mBuiltFlag = true; + +} +void JetFSAssetParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void JetFSAssetParams::initDynamicArrays(void) +{ +} + +void JetFSAssetParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + defaultScale = float(1); + boundaryFadePercentage = float(0.1); + fieldDirection = physx::PxVec3(init(1, 0, 0)); + fieldDirectionDeviationAngle = float(0); + fieldDirectionOscillationPeriod = float(0); + fieldStrength = float(0); + fieldStrengthDeviationPercentage = float(0); + fieldStrengthOscillationPeriod = float(0); + gridShapeRadius = float(1); + gridShapeHeight = float(2); + gridBoundaryFadePercentage = float(0.01); + nearRadius = float(1); + pivotRadius = float(2); + farRadius = float(4); + directionalStretch = float(1); + averageStartDistance = float(1); + averageEndDistance = float(5); + noisePercentage = float(0.1); + noiseSpaceScale = float(1); + noiseTimeScale = float(1); + noiseOctaves = uint32_t(1); + fieldDragCoeff = float(0); + fieldWeight = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void JetFSAssetParams::initReferences(void) +{ +} + +void JetFSAssetParams::freeDynamicArrays(void) +{ +} + +void JetFSAssetParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void JetFSAssetParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/JetFSPreviewParams.cpp b/APEX_1.4/module/basicfs/src/autogen/JetFSPreviewParams.cpp new file mode 100644 index 00000000..6fbe3ecc --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/JetFSPreviewParams.cpp @@ -0,0 +1,407 @@ +// 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 "JetFSPreviewParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace JetFSPreviewParamsNS; + +const char* const JetFSPreviewParamsFactory::vptr = + NvParameterized::getVptr<JetFSPreviewParams, JetFSPreviewParams::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), 4 }, + { TYPE_MAT44, false, (size_t)(&((ParametersStruct*)0)->globalPose), NULL, 0 }, // globalPose + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawShape), NULL, 0 }, // drawShape + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawAssetInfo), NULL, 0 }, // drawAssetInfo + { TYPE_U64, false, (size_t)(&((ParametersStruct*)0)->userData), NULL, 0 }, // userData +}; + + +bool JetFSPreviewParams::mBuiltFlag = false; +NvParameterized::MutexType JetFSPreviewParams::mBuiltFlagMutex; + +JetFSPreviewParams::JetFSPreviewParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &JetFSPreviewParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +JetFSPreviewParams::~JetFSPreviewParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void JetFSPreviewParams::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->~JetFSPreviewParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* JetFSPreviewParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* JetFSPreviewParams::getParameterDefinitionTree(void) const +{ + JetFSPreviewParams* tmpParam = const_cast<JetFSPreviewParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType JetFSPreviewParams::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 JetFSPreviewParams::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 JetFSPreviewParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<JetFSPreviewParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void JetFSPreviewParams::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 JetFSPreviewParams::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="globalPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("globalPose", TYPE_MAT44, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "The pose that translates from turbulence preview coordinates to world coordinates", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="drawShape" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("drawShape", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Draw shapes of JetFS", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="drawAssetInfo" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("drawAssetInfo", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Display asset info", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="userData" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("userData", TYPE_U64, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Optional user data pointer associated with the turbulence actor", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#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); + } + + mBuiltFlag = true; + +} +void JetFSPreviewParams::initStrings(void) +{ +} + +void JetFSPreviewParams::initDynamicArrays(void) +{ +} + +void JetFSPreviewParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + globalPose = physx::PxMat44(physx::PxVec4(1.0f)); + drawShape = bool(0); + drawAssetInfo = bool(0); + userData = uint64_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void JetFSPreviewParams::initReferences(void) +{ +} + +void JetFSPreviewParams::freeDynamicArrays(void) +{ +} + +void JetFSPreviewParams::freeStrings(void) +{ +} + +void JetFSPreviewParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/NoiseFSActorParams.cpp b/APEX_1.4/module/basicfs/src/autogen/NoiseFSActorParams.cpp new file mode 100644 index 00000000..d6b4322f --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/NoiseFSActorParams.cpp @@ -0,0 +1,402 @@ +// 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 "NoiseFSActorParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace NoiseFSActorParamsNS; + +const char* const NoiseFSActorParamsFactory::vptr = + NvParameterized::getVptr<NoiseFSActorParams, NoiseFSActorParams::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), 4 }, + { TYPE_TRANSFORM, false, (size_t)(&((ParametersStruct*)0)->initialPose), NULL, 0 }, // initialPose + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->initialScale), NULL, 0 }, // initialScale + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool NoiseFSActorParams::mBuiltFlag = false; +NvParameterized::MutexType NoiseFSActorParams::mBuiltFlagMutex; + +NoiseFSActorParams::NoiseFSActorParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &NoiseFSActorParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +NoiseFSActorParams::~NoiseFSActorParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void NoiseFSActorParams::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->~NoiseFSActorParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* NoiseFSActorParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* NoiseFSActorParams::getParameterDefinitionTree(void) const +{ + NoiseFSActorParams* tmpParam = const_cast<NoiseFSActorParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType NoiseFSActorParams::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 NoiseFSActorParams::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 NoiseFSActorParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<NoiseFSActorParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void NoiseFSActorParams::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 NoiseFSActorParams::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="initialPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("initialPose", TYPE_TRANSFORM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "The initial pose of the actor. This includes both translation and rotation.", true); + HintTable[1].init("shortDescription", "The initial pose of the actor.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="initialScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("initialScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The initial space scale of the actor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[3].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", "The filter data name for NoiseFS vs Field Boundaries interaction. Overrides asset's value.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for NoiseFS vs other Field Samplers interaction. Overrides asset's value.", true); + ParamDefTable[4].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); + } + + mBuiltFlag = true; + +} +void NoiseFSActorParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void NoiseFSActorParams::initDynamicArrays(void) +{ +} + +void NoiseFSActorParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + initialPose = physx::PxTransform(physx::PxIdentity); + initialScale = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void NoiseFSActorParams::initReferences(void) +{ +} + +void NoiseFSActorParams::freeDynamicArrays(void) +{ +} + +void NoiseFSActorParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void NoiseFSActorParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/NoiseFSAssetParams.cpp b/APEX_1.4/module/basicfs/src/autogen/NoiseFSAssetParams.cpp new file mode 100644 index 00000000..783a419a --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/NoiseFSAssetParams.cpp @@ -0,0 +1,794 @@ +// 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 "NoiseFSAssetParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace NoiseFSAssetParamsNS; + +const char* const NoiseFSAssetParamsFactory::vptr = + NvParameterized::getVptr<NoiseFSAssetParams, NoiseFSAssetParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 19; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 18 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->defaultScale), NULL, 0 }, // defaultScale + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->boundarySize), NULL, 0 }, // boundarySize + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->boundaryFadePercentage), NULL, 0 }, // boundaryFadePercentage + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->fieldType), NULL, 0 }, // fieldType + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDragCoeff), NULL, 0 }, // fieldDragCoeff + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldWeight), NULL, 0 }, // fieldWeight + { TYPE_ENUM, false, (size_t)(&((ParametersStruct*)0)->noiseType), NULL, 0 }, // noiseType + { TYPE_U32, false, (size_t)(&((ParametersStruct*)0)->noiseSeed), NULL, 0 }, // noiseSeed + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseStrength), NULL, 0 }, // noiseStrength + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->noiseSpacePeriod), NULL, 0 }, // noiseSpacePeriod + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseTimePeriod), NULL, 0 }, // noiseTimePeriod + { TYPE_U32, false, (size_t)(&((ParametersStruct*)0)->noiseOctaves), NULL, 0 }, // noiseOctaves + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseStrengthOctaveMultiplier), NULL, 0 }, // noiseStrengthOctaveMultiplier + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->noiseSpacePeriodOctaveMultiplier), NULL, 0 }, // noiseSpacePeriodOctaveMultiplier + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->noiseTimePeriodOctaveMultiplier), NULL, 0 }, // noiseTimePeriodOctaveMultiplier + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->useLocalSpace), NULL, 0 }, // useLocalSpace +}; + + +bool NoiseFSAssetParams::mBuiltFlag = false; +NvParameterized::MutexType NoiseFSAssetParams::mBuiltFlagMutex; + +NoiseFSAssetParams::NoiseFSAssetParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &NoiseFSAssetParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +NoiseFSAssetParams::~NoiseFSAssetParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void NoiseFSAssetParams::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->~NoiseFSAssetParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* NoiseFSAssetParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* NoiseFSAssetParams::getParameterDefinitionTree(void) const +{ + NoiseFSAssetParams* tmpParam = const_cast<NoiseFSAssetParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType NoiseFSAssetParams::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 NoiseFSAssetParams::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 NoiseFSAssetParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<NoiseFSAssetParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void NoiseFSAssetParams::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 NoiseFSAssetParams::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 this Noise Field Sampler.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="defaultScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("defaultScale", TYPE_F32, 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[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#else + + static HintImpl HintTable[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("HIDDEN", uint64_t(1), true); + HintTable[1].init("longDescription", "The default scale factor of the boundary shape. The default value is 1.0.", true); + HintTable[2].init("shortDescription", "The default scale factor of the boundary shape.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="boundarySize" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("boundarySize", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Size of the boundary box.", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="boundaryFadePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("boundaryFadePercentage", 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", "Percentage of distance from boundary to center where fade out starts.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldType" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldType", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Type of field.", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "FORCE", "VELOCITY_DRAG", "VELOCITY_DIRECT" }; + ParamDefTable[4].setEnumVals((const char**)EnumVals, 3); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="fieldDragCoeff" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("fieldDragCoeff", 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[5].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", "Field drag coefficient (only for VELOCITY_DRAG field type).", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="fieldWeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("fieldWeight", 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", "A weight for the field, it controls how strongly the field affects particles", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="noiseType" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("noiseType", TYPE_ENUM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Type of noise (simplex, curl and etc.).", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + static const char* const EnumVals[] = { "SIMPLEX", "CURL" }; + ParamDefTable[7].setEnumVals((const char**)EnumVals, 2); + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="noiseSeed" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("noiseSeed", TYPE_U32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Seed for the noise random generator.", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=9, longName="noiseStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[9]; + ParamDef->init("noiseStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise strength.", true); + ParamDefTable[9].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=10, longName="noiseSpacePeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[10]; + ParamDef->init("noiseSpacePeriod", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise period in space.", true); + ParamDefTable[10].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=11, longName="noiseTimePeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[11]; + ParamDef->init("noiseTimePeriod", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise period in time.", true); + ParamDefTable[11].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=12, longName="noiseOctaves" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[12]; + ParamDef->init("noiseOctaves", TYPE_U32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Number of the noise octaves (more octaves give more turbulent noise, but increase computational time).", true); + ParamDefTable[12].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=13, longName="noiseStrengthOctaveMultiplier" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[13]; + ParamDef->init("noiseStrengthOctaveMultiplier", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise strength multiplier from one octave to the next.", true); + ParamDefTable[13].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=14, longName="noiseSpacePeriodOctaveMultiplier" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[14]; + ParamDef->init("noiseSpacePeriodOctaveMultiplier", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise period in space multiplier from one octave to the next.", true); + ParamDefTable[14].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=15, longName="noiseTimePeriodOctaveMultiplier" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[15]; + ParamDef->init("noiseTimePeriodOctaveMultiplier", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Noise period in time multiplier from one octave to the next.", true); + ParamDefTable[15].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=16, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[16]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[16].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", "The filter data name for NoiseFS vs Field Boundaries interaction.", true); + ParamDefTable[16].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=17, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[17]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for NoiseFS vs other Field Samplers interaction.", true); + ParamDefTable[17].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=18, longName="useLocalSpace" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[18]; + ParamDef->init("useLocalSpace", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "when enabled, noise calculation is done in the local space.", true); + ParamDefTable[18].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[18]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + Children[8] = PDEF_PTR(9); + Children[9] = PDEF_PTR(10); + Children[10] = PDEF_PTR(11); + Children[11] = PDEF_PTR(12); + Children[12] = PDEF_PTR(13); + Children[13] = PDEF_PTR(14); + Children[14] = PDEF_PTR(15); + Children[15] = PDEF_PTR(16); + Children[16] = PDEF_PTR(17); + Children[17] = PDEF_PTR(18); + + ParamDefTable[0].setChildren(Children, 18); + } + + mBuiltFlag = true; + +} +void NoiseFSAssetParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void NoiseFSAssetParams::initDynamicArrays(void) +{ +} + +void NoiseFSAssetParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + defaultScale = float(1); + boundarySize = physx::PxVec3(init(10, 10, 10)); + boundaryFadePercentage = float(0.1); + fieldType = (const char*)"VELOCITY_DIRECT"; + fieldDragCoeff = float(1); + fieldWeight = float(1); + noiseType = (const char*)"CURL"; + noiseSeed = uint32_t(0); + noiseStrength = float(1); + noiseSpacePeriod = physx::PxVec3(init(1.0, 1.0, 1.0)); + noiseTimePeriod = float(1); + noiseOctaves = uint32_t(1); + noiseStrengthOctaveMultiplier = float(0.5); + noiseSpacePeriodOctaveMultiplier = physx::PxVec3(init(0.5, 0.5, 0.5)); + noiseTimePeriodOctaveMultiplier = float(0.5); + useLocalSpace = bool(false); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void NoiseFSAssetParams::initReferences(void) +{ +} + +void NoiseFSAssetParams::freeDynamicArrays(void) +{ +} + +void NoiseFSAssetParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void NoiseFSAssetParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/NoiseFSPreviewParams.cpp b/APEX_1.4/module/basicfs/src/autogen/NoiseFSPreviewParams.cpp new file mode 100644 index 00000000..df31abc8 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/NoiseFSPreviewParams.cpp @@ -0,0 +1,407 @@ +// 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 "NoiseFSPreviewParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace NoiseFSPreviewParamsNS; + +const char* const NoiseFSPreviewParamsFactory::vptr = + NvParameterized::getVptr<NoiseFSPreviewParams, NoiseFSPreviewParams::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), 4 }, + { TYPE_MAT44, false, (size_t)(&((ParametersStruct*)0)->globalPose), NULL, 0 }, // globalPose + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawShape), NULL, 0 }, // drawShape + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawAssetInfo), NULL, 0 }, // drawAssetInfo + { TYPE_U64, false, (size_t)(&((ParametersStruct*)0)->userData), NULL, 0 }, // userData +}; + + +bool NoiseFSPreviewParams::mBuiltFlag = false; +NvParameterized::MutexType NoiseFSPreviewParams::mBuiltFlagMutex; + +NoiseFSPreviewParams::NoiseFSPreviewParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &NoiseFSPreviewParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +NoiseFSPreviewParams::~NoiseFSPreviewParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void NoiseFSPreviewParams::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->~NoiseFSPreviewParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* NoiseFSPreviewParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* NoiseFSPreviewParams::getParameterDefinitionTree(void) const +{ + NoiseFSPreviewParams* tmpParam = const_cast<NoiseFSPreviewParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType NoiseFSPreviewParams::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 NoiseFSPreviewParams::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 NoiseFSPreviewParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<NoiseFSPreviewParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void NoiseFSPreviewParams::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 NoiseFSPreviewParams::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="globalPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("globalPose", TYPE_MAT44, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "The pose that translates from preview coordinates to world coordinates", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="drawShape" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("drawShape", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Draw shapes of NoiseFS", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="drawAssetInfo" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("drawAssetInfo", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Display asset info", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="userData" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("userData", TYPE_U64, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Optional user data pointer associated with the actor", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#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); + } + + mBuiltFlag = true; + +} +void NoiseFSPreviewParams::initStrings(void) +{ +} + +void NoiseFSPreviewParams::initDynamicArrays(void) +{ +} + +void NoiseFSPreviewParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + globalPose = physx::PxMat44(physx::PxVec4(1.0f)); + drawShape = bool(0); + drawAssetInfo = bool(0); + userData = uint64_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void NoiseFSPreviewParams::initReferences(void) +{ +} + +void NoiseFSPreviewParams::freeDynamicArrays(void) +{ +} + +void NoiseFSPreviewParams::freeStrings(void) +{ +} + +void NoiseFSPreviewParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/VortexFSActorParams.cpp b/APEX_1.4/module/basicfs/src/autogen/VortexFSActorParams.cpp new file mode 100644 index 00000000..48bdf12b --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/VortexFSActorParams.cpp @@ -0,0 +1,402 @@ +// 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 "VortexFSActorParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace VortexFSActorParamsNS; + +const char* const VortexFSActorParamsFactory::vptr = + NvParameterized::getVptr<VortexFSActorParams, VortexFSActorParams::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), 4 }, + { TYPE_TRANSFORM, false, (size_t)(&((ParametersStruct*)0)->initialPose), NULL, 0 }, // initialPose + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->initialScale), NULL, 0 }, // initialScale + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool VortexFSActorParams::mBuiltFlag = false; +NvParameterized::MutexType VortexFSActorParams::mBuiltFlagMutex; + +VortexFSActorParams::VortexFSActorParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &VortexFSActorParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +VortexFSActorParams::~VortexFSActorParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void VortexFSActorParams::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->~VortexFSActorParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* VortexFSActorParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* VortexFSActorParams::getParameterDefinitionTree(void) const +{ + VortexFSActorParams* tmpParam = const_cast<VortexFSActorParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType VortexFSActorParams::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 VortexFSActorParams::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 VortexFSActorParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<VortexFSActorParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void VortexFSActorParams::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 VortexFSActorParams::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="initialPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("initialPose", TYPE_TRANSFORM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "The initial pose of the actor. This includes both translation and rotation.", true); + HintTable[1].init("shortDescription", "The initial pose of the actor.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="initialScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("initialScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The initial space scale of the actor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[3].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", "The filter data name for AttractorFS vs Field Boundaries interaction. Overrides asset's value.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for AttractorFS vs other Field Samplers interaction. Overrides asset's value.", true); + ParamDefTable[4].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); + } + + mBuiltFlag = true; + +} +void VortexFSActorParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void VortexFSActorParams::initDynamicArrays(void) +{ +} + +void VortexFSActorParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + initialPose = physx::PxTransform(physx::PxIdentity); + initialScale = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void VortexFSActorParams::initReferences(void) +{ +} + +void VortexFSActorParams::freeDynamicArrays(void) +{ +} + +void VortexFSActorParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void VortexFSActorParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/VortexFSAssetParams.cpp b/APEX_1.4/module/basicfs/src/autogen/VortexFSAssetParams.cpp new file mode 100644 index 00000000..30b9bbfa --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/VortexFSAssetParams.cpp @@ -0,0 +1,695 @@ +// 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 "VortexFSAssetParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace VortexFSAssetParamsNS; + +const char* const VortexFSAssetParamsFactory::vptr = + NvParameterized::getVptr<VortexFSAssetParams, VortexFSAssetParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 15; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 14 }, + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->boundaryFadePercentage), NULL, 0 }, // boundaryFadePercentage + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->axis), NULL, 0 }, // axis + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->bottomSphericalForce), NULL, 0 }, // bottomSphericalForce + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->topSphericalForce), NULL, 0 }, // topSphericalForce + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->height), NULL, 0 }, // height + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->bottomRadius), NULL, 0 }, // bottomRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->topRadius), NULL, 0 }, // topRadius + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->rotationalStrength), NULL, 0 }, // rotationalStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->radialStrength), NULL, 0 }, // radialStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->liftStrength), NULL, 0 }, // liftStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDragCoeff), NULL, 0 }, // fieldDragCoeff + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldWeight), NULL, 0 }, // fieldWeight + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool VortexFSAssetParams::mBuiltFlag = false; +NvParameterized::MutexType VortexFSAssetParams::mBuiltFlagMutex; + +VortexFSAssetParams::VortexFSAssetParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &VortexFSAssetParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +VortexFSAssetParams::~VortexFSAssetParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void VortexFSAssetParams::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->~VortexFSAssetParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* VortexFSAssetParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* VortexFSAssetParams::getParameterDefinitionTree(void) const +{ + VortexFSAssetParams* tmpParam = const_cast<VortexFSAssetParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType VortexFSAssetParams::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 VortexFSAssetParams::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 VortexFSAssetParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<VortexFSAssetParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void VortexFSAssetParams::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 VortexFSAssetParams::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 this Vortex Field Sampler.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="boundaryFadePercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("boundaryFadePercentage", 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[1].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", "Percentage of distance from boundary to center where fade out starts.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="axis" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("axis", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The primary axis of the vortex around which the particles will rotate.", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="bottomSphericalForce" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("bottomSphericalForce", 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[3].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", "If this parameter true, radial forces in bottom sphere of the capsule will point to the center of sphere.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="topSphericalForce" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("topSphericalForce", 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", "If this parameter true, radial forces in top sphere of the capsule will point to the center of sphere.", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="height" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("height", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", " The height of the capsule volume of the vortex.", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="bottomRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("bottomRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The radius of the bottom sphere of the capsule.", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="topRadius" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("topRadius", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", " The radius of the top sphere of the capsule.", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="rotationalStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("rotationalStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Coefficient that sets strength of the rotational part of force.", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=9, longName="radialStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[9]; + ParamDef->init("radialStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Coefficient that sets strength of the radial part of force.", true); + ParamDefTable[9].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=10, longName="liftStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[10]; + ParamDef->init("liftStrength", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "Coefficient that sets strength of the lifting part of force.", true); + ParamDefTable[10].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=11, longName="fieldDragCoeff" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[11]; + ParamDef->init("fieldDragCoeff", 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[11].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", "Field drag coefficient. When it equals to 0, then the field is applied as a direct velocity.", true); + ParamDefTable[11].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=12, longName="fieldWeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[12]; + ParamDef->init("fieldWeight", 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[12].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", "A weight for the field, it controls how strongly the field affects particles", true); + ParamDefTable[12].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=13, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[13]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[13].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", "The filter data name for AttractorFS vs Field Boundaries interaction.", true); + ParamDefTable[13].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=14, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[14]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for AttractorFS vs other Field Samplers interaction.", true); + ParamDefTable[14].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[14]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + Children[8] = PDEF_PTR(9); + Children[9] = PDEF_PTR(10); + Children[10] = PDEF_PTR(11); + Children[11] = PDEF_PTR(12); + Children[12] = PDEF_PTR(13); + Children[13] = PDEF_PTR(14); + + ParamDefTable[0].setChildren(Children, 14); + } + + mBuiltFlag = true; + +} +void VortexFSAssetParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void VortexFSAssetParams::initDynamicArrays(void) +{ +} + +void VortexFSAssetParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + boundaryFadePercentage = float(0.1); + axis = physx::PxVec3(init(0, 1, 0)); + bottomSphericalForce = bool(false); + topSphericalForce = bool(false); + height = float(0); + bottomRadius = float(0); + topRadius = float(0); + rotationalStrength = float(0); + radialStrength = float(0); + liftStrength = float(0); + fieldDragCoeff = float(0); + fieldWeight = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void VortexFSAssetParams::initReferences(void) +{ +} + +void VortexFSAssetParams::freeDynamicArrays(void) +{ +} + +void VortexFSAssetParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void VortexFSAssetParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/VortexFSPreviewParams.cpp b/APEX_1.4/module/basicfs/src/autogen/VortexFSPreviewParams.cpp new file mode 100644 index 00000000..134d162b --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/VortexFSPreviewParams.cpp @@ -0,0 +1,407 @@ +// 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 "VortexFSPreviewParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace VortexFSPreviewParamsNS; + +const char* const VortexFSPreviewParamsFactory::vptr = + NvParameterized::getVptr<VortexFSPreviewParams, VortexFSPreviewParams::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), 4 }, + { TYPE_MAT44, false, (size_t)(&((ParametersStruct*)0)->globalPose), NULL, 0 }, // globalPose + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawShape), NULL, 0 }, // drawShape + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawAssetInfo), NULL, 0 }, // drawAssetInfo + { TYPE_U64, false, (size_t)(&((ParametersStruct*)0)->userData), NULL, 0 }, // userData +}; + + +bool VortexFSPreviewParams::mBuiltFlag = false; +NvParameterized::MutexType VortexFSPreviewParams::mBuiltFlagMutex; + +VortexFSPreviewParams::VortexFSPreviewParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &VortexFSPreviewParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +VortexFSPreviewParams::~VortexFSPreviewParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void VortexFSPreviewParams::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->~VortexFSPreviewParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* VortexFSPreviewParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* VortexFSPreviewParams::getParameterDefinitionTree(void) const +{ + VortexFSPreviewParams* tmpParam = const_cast<VortexFSPreviewParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType VortexFSPreviewParams::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 VortexFSPreviewParams::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 VortexFSPreviewParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<VortexFSPreviewParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void VortexFSPreviewParams::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 VortexFSPreviewParams::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="globalPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("globalPose", TYPE_MAT44, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "The pose that translates from turbulence preview coordinates to world coordinates", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="drawShape" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("drawShape", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Draw the box", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="drawAssetInfo" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("drawAssetInfo", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Display asset info", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="userData" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("userData", TYPE_U64, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Optional user data pointer associated with the attractor actor", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#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); + } + + mBuiltFlag = true; + +} +void VortexFSPreviewParams::initStrings(void) +{ +} + +void VortexFSPreviewParams::initDynamicArrays(void) +{ +} + +void VortexFSPreviewParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + globalPose = physx::PxMat44(physx::PxVec4(1.0f)); + drawShape = bool(0); + drawAssetInfo = bool(0); + userData = uint64_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void VortexFSPreviewParams::initReferences(void) +{ +} + +void VortexFSPreviewParams::freeDynamicArrays(void) +{ +} + +void VortexFSPreviewParams::freeStrings(void) +{ +} + +void VortexFSPreviewParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/WindFSActorParams.cpp b/APEX_1.4/module/basicfs/src/autogen/WindFSActorParams.cpp new file mode 100644 index 00000000..2386a92b --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/WindFSActorParams.cpp @@ -0,0 +1,402 @@ +// 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 "WindFSActorParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace WindFSActorParamsNS; + +const char* const WindFSActorParamsFactory::vptr = + NvParameterized::getVptr<WindFSActorParams, WindFSActorParams::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), 4 }, + { TYPE_TRANSFORM, false, (size_t)(&((ParametersStruct*)0)->initialPose), NULL, 0 }, // initialPose + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->initialScale), NULL, 0 }, // initialScale + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool WindFSActorParams::mBuiltFlag = false; +NvParameterized::MutexType WindFSActorParams::mBuiltFlagMutex; + +WindFSActorParams::WindFSActorParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &WindFSActorParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +WindFSActorParams::~WindFSActorParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void WindFSActorParams::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->~WindFSActorParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* WindFSActorParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* WindFSActorParams::getParameterDefinitionTree(void) const +{ + WindFSActorParams* tmpParam = const_cast<WindFSActorParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType WindFSActorParams::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 WindFSActorParams::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 WindFSActorParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<WindFSActorParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void WindFSActorParams::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 WindFSActorParams::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="initialPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("initialPose", TYPE_TRANSFORM, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[2]; + static Hint* HintPtrTable[2] = { &HintTable[0], &HintTable[1], }; + HintTable[0].init("longDescription", "The initial pose of the actor. This includes both translation and rotation.", true); + HintTable[1].init("shortDescription", "The initial pose of the actor.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="initialScale" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("initialScale", TYPE_F32, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The initial space scale of the actor", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[3].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", "The filter data name for WindFS vs Field Boundaries interaction. Overrides asset's value.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for WindFS vs other Field Samplers interaction. Overrides asset's value.", true); + ParamDefTable[4].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); + } + + mBuiltFlag = true; + +} +void WindFSActorParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void WindFSActorParams::initDynamicArrays(void) +{ +} + +void WindFSActorParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + initialPose = physx::PxTransform(physx::PxIdentity); + initialScale = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void WindFSActorParams::initReferences(void) +{ +} + +void WindFSActorParams::freeDynamicArrays(void) +{ +} + +void WindFSActorParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void WindFSActorParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/WindFSAssetParams.cpp b/APEX_1.4/module/basicfs/src/autogen/WindFSAssetParams.cpp new file mode 100644 index 00000000..06a7306d --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/WindFSAssetParams.cpp @@ -0,0 +1,613 @@ +// 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 "WindFSAssetParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace WindFSAssetParamsNS; + +const char* const WindFSAssetParamsFactory::vptr = + NvParameterized::getVptr<WindFSAssetParams, WindFSAssetParams::ClassAlignment>(); + +const uint32_t NumParamDefs = 11; +static NvParameterized::DefinitionImpl* ParamDefTable; // now allocated in buildTree [NumParamDefs]; + + +static const size_t ParamLookupChildrenTable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, +}; + +#define TENUM(type) nvidia::##type +#define CHILDREN(index) &ParamLookupChildrenTable[index] +static const NvParameterized::ParamLookupNode ParamLookupTable[NumParamDefs] = +{ + { TYPE_STRUCT, false, 0, CHILDREN(0), 10 }, + { TYPE_VEC3, false, (size_t)(&((ParametersStruct*)0)->fieldDirection), NULL, 0 }, // fieldDirection + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDirectionDeviationAngle), NULL, 0 }, // fieldDirectionDeviationAngle + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDirectionOscillationPeriod), NULL, 0 }, // fieldDirectionOscillationPeriod + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrength), NULL, 0 }, // fieldStrength + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrengthDeviationPercentage), NULL, 0 }, // fieldStrengthDeviationPercentage + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldStrengthOscillationPeriod), NULL, 0 }, // fieldStrengthOscillationPeriod + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldDragCoeff), NULL, 0 }, // fieldDragCoeff + { TYPE_F32, false, (size_t)(&((ParametersStruct*)0)->fieldWeight), NULL, 0 }, // fieldWeight + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldBoundaryFilterDataName), NULL, 0 }, // fieldBoundaryFilterDataName + { TYPE_STRING, false, (size_t)(&((ParametersStruct*)0)->fieldSamplerFilterDataName), NULL, 0 }, // fieldSamplerFilterDataName +}; + + +bool WindFSAssetParams::mBuiltFlag = false; +NvParameterized::MutexType WindFSAssetParams::mBuiltFlagMutex; + +WindFSAssetParams::WindFSAssetParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &WindFSAssetParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +WindFSAssetParams::~WindFSAssetParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void WindFSAssetParams::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->~WindFSAssetParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* WindFSAssetParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* WindFSAssetParams::getParameterDefinitionTree(void) const +{ + WindFSAssetParams* tmpParam = const_cast<WindFSAssetParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType WindFSAssetParams::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 WindFSAssetParams::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 WindFSAssetParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<WindFSAssetParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void WindFSAssetParams::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 WindFSAssetParams::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 this Wind Field Sampler.", true); + ParamDefTable[0].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=1, longName="fieldDirection" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("fieldDirection", TYPE_VEC3, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "field direction.", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="fieldDirectionDeviationAngle" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("fieldDirectionDeviationAngle", 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(180), 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("longDescription", "The fieldDirectionDeviationAngle parameter controls the deviation in angle of the field direction.\n", true); + HintTable[1].init("max", uint64_t(180), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "field direction deviation angle (in degrees).", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="fieldDirectionOscillationPeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("fieldDirectionOscillationPeriod", 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[3]; + static Hint* HintPtrTable[3] = { &HintTable[0], &HintTable[1], &HintTable[2], }; + HintTable[0].init("longDescription", "The fieldDirectionOscillationPeriod defines the period of the field direction oscillation.\nIf the fieldDirectionDeviationAngle is non-zero the period of each sinusoidal cycle will be this parameter in seconds.\n", true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "field direction oscillation period in seconds.", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=4, longName="fieldStrength" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[4]; + ParamDef->init("fieldStrength", 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[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", "field strength.", true); + ParamDefTable[4].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=5, longName="fieldStrengthDeviationPercentage" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[5]; + ParamDef->init("fieldStrengthDeviationPercentage", 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[4]; + static Hint* HintPtrTable[4] = { &HintTable[0], &HintTable[1], &HintTable[2], &HintTable[3], }; + HintTable[0].init("longDescription", "The fieldStrengthDeviationPercentage parameter controls the deviation in % of the field strength.\n", true); + HintTable[1].init("max", uint64_t(1), true); + HintTable[2].init("min", uint64_t(0), true); + HintTable[3].init("shortDescription", "+/- field strength deviation percentage.", true); + ParamDefTable[5].setHints((const NvParameterized::Hint**)HintPtrTable, 4); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=6, longName="fieldStrengthOscillationPeriod" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[6]; + ParamDef->init("fieldStrengthOscillationPeriod", 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[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("longDescription", "The fieldStrengthOscillationPeriod defines the period of the field strength oscillation.\nIf the fieldStrengthDeviationPercentage is non-zero the period of each sinusoidal cycle will be this parameter in seconds.\n", true); + HintTable[1].init("min", uint64_t(0), true); + HintTable[2].init("shortDescription", "field strength oscillation period in seconds.", true); + ParamDefTable[6].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=7, longName="fieldDragCoeff" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[7]; + ParamDef->init("fieldDragCoeff", 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[7].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", "Field drag coefficient. When it equals to 0, then the field is applied as a direct velocity.", true); + ParamDefTable[7].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=8, longName="fieldWeight" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[8]; + ParamDef->init("fieldWeight", 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[8].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", "A weight for the field, it controls how strongly the field affects particles", true); + ParamDefTable[8].setHints((const NvParameterized::Hint**)HintPtrTable, 3); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=9, longName="fieldBoundaryFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[9]; + ParamDef->init("fieldBoundaryFilterDataName", TYPE_STRING, 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[9].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", "The filter data name for WindFS vs Field Boundaries interaction.", true); + ParamDefTable[9].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=10, longName="fieldSamplerFilterDataName" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[10]; + ParamDef->init("fieldSamplerFilterDataName", TYPE_STRING, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + +#else + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("shortDescription", "The filter data name for WindFS vs other Field Samplers interaction.", true); + ParamDefTable[10].setHints((const NvParameterized::Hint**)HintPtrTable, 1); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // SetChildren for: nodeIndex=0, longName="" + { + static Definition* Children[10]; + 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); + Children[6] = PDEF_PTR(7); + Children[7] = PDEF_PTR(8); + Children[8] = PDEF_PTR(9); + Children[9] = PDEF_PTR(10); + + ParamDefTable[0].setChildren(Children, 10); + } + + mBuiltFlag = true; + +} +void WindFSAssetParams::initStrings(void) +{ + fieldBoundaryFilterDataName.isAllocated = true; + fieldBoundaryFilterDataName.buf = NULL; + fieldSamplerFilterDataName.isAllocated = true; + fieldSamplerFilterDataName.buf = NULL; +} + +void WindFSAssetParams::initDynamicArrays(void) +{ +} + +void WindFSAssetParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + fieldDirection = physx::PxVec3(init(1, 0, 0)); + fieldDirectionDeviationAngle = float(0); + fieldDirectionOscillationPeriod = float(0); + fieldStrength = float(1); + fieldStrengthDeviationPercentage = float(0); + fieldStrengthOscillationPeriod = float(0); + fieldDragCoeff = float(1); + fieldWeight = float(1); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void WindFSAssetParams::initReferences(void) +{ +} + +void WindFSAssetParams::freeDynamicArrays(void) +{ +} + +void WindFSAssetParams::freeStrings(void) +{ + + if (fieldBoundaryFilterDataName.isAllocated && fieldBoundaryFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldBoundaryFilterDataName.buf); + } + + if (fieldSamplerFilterDataName.isAllocated && fieldSamplerFilterDataName.buf) + { + mParameterizedTraits->strfree((char*)fieldSamplerFilterDataName.buf); + } +} + +void WindFSAssetParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia diff --git a/APEX_1.4/module/basicfs/src/autogen/WindFSPreviewParams.cpp b/APEX_1.4/module/basicfs/src/autogen/WindFSPreviewParams.cpp new file mode 100644 index 00000000..c4d02976 --- /dev/null +++ b/APEX_1.4/module/basicfs/src/autogen/WindFSPreviewParams.cpp @@ -0,0 +1,376 @@ +// 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 "WindFSPreviewParams.h" +#include <string.h> +#include <stdlib.h> + +using namespace NvParameterized; + +namespace nvidia +{ +namespace basicfs +{ + +using namespace WindFSPreviewParamsNS; + +const char* const WindFSPreviewParamsFactory::vptr = + NvParameterized::getVptr<WindFSPreviewParams, WindFSPreviewParams::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_MAT44, false, (size_t)(&((ParametersStruct*)0)->globalPose), NULL, 0 }, // globalPose + { TYPE_BOOL, false, (size_t)(&((ParametersStruct*)0)->drawAssetInfo), NULL, 0 }, // drawAssetInfo + { TYPE_U64, false, (size_t)(&((ParametersStruct*)0)->userData), NULL, 0 }, // userData +}; + + +bool WindFSPreviewParams::mBuiltFlag = false; +NvParameterized::MutexType WindFSPreviewParams::mBuiltFlagMutex; + +WindFSPreviewParams::WindFSPreviewParams(NvParameterized::Traits* traits, void* buf, int32_t* refCount) : + NvParameters(traits, buf, refCount) +{ + //mParameterizedTraits->registerFactory(className(), &WindFSPreviewParamsFactoryInst); + + if (!buf) //Do not init data if it is inplace-deserialized + { + initDynamicArrays(); + initStrings(); + initReferences(); + initDefaults(); + } +} + +WindFSPreviewParams::~WindFSPreviewParams() +{ + freeStrings(); + freeReferences(); + freeDynamicArrays(); +} + +void WindFSPreviewParams::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->~WindFSPreviewParams(); + + NvParameters::destroy(this, traits, doDeallocateSelf, refCount, buf); +} + +const NvParameterized::DefinitionImpl* WindFSPreviewParams::getParameterDefinitionTree(void) +{ + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +const NvParameterized::DefinitionImpl* WindFSPreviewParams::getParameterDefinitionTree(void) const +{ + WindFSPreviewParams* tmpParam = const_cast<WindFSPreviewParams*>(this); + + if (!mBuiltFlag) // Double-checked lock + { + NvParameterized::MutexType::ScopedLock lock(mBuiltFlagMutex); + if (!mBuiltFlag) + { + tmpParam->buildTree(); + } + } + + return(&ParamDefTable[0]); +} + +NvParameterized::ErrorType WindFSPreviewParams::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 WindFSPreviewParams::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 WindFSPreviewParams::getVarPtr(const Handle& handle, void*& ptr, size_t& offset) const +{ + ptr = getVarPtrHelper(&ParamLookupTable[0], const_cast<WindFSPreviewParams::ParametersStruct*>(¶meters()), handle, offset); +} + + +/* Dynamic Handle Indices */ + +void WindFSPreviewParams::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 WindFSPreviewParams::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="globalPose" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[1]; + ParamDef->init("globalPose", TYPE_MAT44, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "The pose that translates from preview coordinates to world coordinates", true); + ParamDefTable[1].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=2, longName="drawAssetInfo" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[2]; + ParamDef->init("drawAssetInfo", TYPE_BOOL, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Display asset info", true); + ParamDefTable[2].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#endif /* NV_PARAMETERIZED_HIDE_DESCRIPTIONS */ + + + + + + } + + // Initialize DefinitionImpl node: nodeIndex=3, longName="userData" + { + NvParameterized::DefinitionImpl* ParamDef = &ParamDefTable[3]; + ParamDef->init("userData", TYPE_U64, NULL, true); + +#ifdef NV_PARAMETERIZED_HIDE_DESCRIPTIONS + + static HintImpl HintTable[1]; + static Hint* HintPtrTable[1] = { &HintTable[0], }; + HintTable[0].init("editorDisplay", "false", 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("editorDisplay", "false", true); + HintTable[1].init("shortDescription", "Optional user data pointer associated with the actor", true); + ParamDefTable[3].setHints((const NvParameterized::Hint**)HintPtrTable, 2); + +#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 WindFSPreviewParams::initStrings(void) +{ +} + +void WindFSPreviewParams::initDynamicArrays(void) +{ +} + +void WindFSPreviewParams::initDefaults(void) +{ + + freeStrings(); + freeReferences(); + freeDynamicArrays(); + globalPose = physx::PxMat44(physx::PxVec4(1.0f)); + drawAssetInfo = bool(0); + userData = uint64_t(0); + + initDynamicArrays(); + initStrings(); + initReferences(); +} + +void WindFSPreviewParams::initReferences(void) +{ +} + +void WindFSPreviewParams::freeDynamicArrays(void) +{ +} + +void WindFSPreviewParams::freeStrings(void) +{ +} + +void WindFSPreviewParams::freeReferences(void) +{ +} + +} // namespace basicfs +} // namespace nvidia |