From 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 Mon Sep 17 00:00:00 2001 From: git perforce import user Date: Tue, 25 Oct 2016 12:29:14 -0600 Subject: Initial commit: PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167] --- APEX_1.4/module/iofx/include/RenderVolumeImpl.h | 137 ++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 APEX_1.4/module/iofx/include/RenderVolumeImpl.h (limited to 'APEX_1.4/module/iofx/include/RenderVolumeImpl.h') diff --git a/APEX_1.4/module/iofx/include/RenderVolumeImpl.h b/APEX_1.4/module/iofx/include/RenderVolumeImpl.h new file mode 100644 index 00000000..bf6b7e1d --- /dev/null +++ b/APEX_1.4/module/iofx/include/RenderVolumeImpl.h @@ -0,0 +1,137 @@ +/* + * 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. + */ + + +#ifndef __RENDER_VOLUME_IMPL_H__ +#define __RENDER_VOLUME_IMPL_H__ + +#include "Apex.h" +#include "RenderVolume.h" +#include "PsArray.h" +#include "ApexResource.h" +#include "ApexRenderable.h" +#include "ApexRWLockable.h" +#include "ReadCheck.h" +#include "WriteCheck.h" + +namespace nvidia +{ +namespace apex +{ +class IofxAsset; +class IofxActor; +} +namespace iofx +{ +class IofxScene; + +class RenderVolumeImpl : public RenderVolume, public ApexResourceInterface, public ApexResource, public ApexRWLockable +{ +public: + APEX_RW_LOCKABLE_BOILERPLATE + + RenderVolumeImpl(IofxScene& scene, const PxBounds3& b, uint32_t priority, bool allIofx); + ~RenderVolumeImpl(); + + // ApexResourceInterface methods + void release(); + void destroy(); + + uint32_t getListIndex() const + { + return m_listIndex; + } + void setListIndex(ResourceList& list, uint32_t index) + { + m_listIndex = index; + m_list = &list; + } + + void setOwnershipBounds(const PxBounds3& b) + { + WRITE_ZONE(); + mOwnershipBounds = b; + } + PxBounds3 getOwnershipBounds(void) const + { + READ_ZONE(); + return mOwnershipBounds; + } + PxBounds3 getBounds() const; + + // methods for use by IOS or IOFX actor + bool addIofxActor(IofxActor& iofx); + bool removeIofxActor(const IofxActor& iofx); + + bool addIofxAsset(IofxAsset& iofx); + void setPosition(const PxVec3& pos); + + bool getAffectsAllIofx() const + { + READ_ZONE(); + return mAllIofx; + } + + IofxActor* const* lockIofxActorList(uint32_t& count) + { + READ_ZONE(); + mLock.lockReader(); + count = mIofxActors.size(); + return count ? &mIofxActors.front() : NULL; + } + void unlockIofxActorList() + { + mLock.unlockReader(); + } + + + IofxAsset* const* getIofxAssetList(uint32_t& count) const + { + READ_ZONE(); + count = mIofxAssets.size(); + return count ? &mIofxAssets.front() : NULL; + } + PxVec3 getPosition() const + { + READ_ZONE(); + return mOwnershipBounds.getCenter(); + } + uint32_t getPriority() const + { + READ_ZONE(); + return mPriority; + } + bool affectsIofxAsset(const IofxAsset& iofx) const; + + PX_INLINE void lockReader() + { + mLock.lockReader(); + } + PX_INLINE void unlockReader() + { + mLock.unlockReader(); + } + +protected: + // bounds is stored in ApexRenderable::mRenderBounds + uint32_t mPriority; + bool mAllIofx; + bool mPendingDelete; + IofxScene& mScene; + nvidia::Array mIofxAssets; + nvidia::Array mIofxActors; + physx::PxBounds3 mOwnershipBounds; + physx::shdfnd::ReadWriteLock mLock; +}; + +} +} // namespace nvidia + +#endif // __RENDER_VOLUME_IMPL_H__ -- cgit v1.2.3