diff options
| author | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2017-02-24 09:32:20 -0800 |
| commit | e1bf674c16e3c8472b29574159c789cd3f0c64e0 (patch) | |
| tree | 9f0cfce09c71a2c27ff19589fcad6cd83504477c /NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp | |
| parent | first commit (diff) | |
| download | blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.tar.xz blast-e1bf674c16e3c8472b29574159c789cd3f0c64e0.zip | |
Updating to [email protected] and [email protected] with a new directory structure.
NvBlast folder is gone, files have been moved to top level directory. README is changed to reflect this.
Diffstat (limited to 'NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp')
| -rw-r--r-- | NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp b/NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp deleted file mode 100644 index b02044b..0000000 --- a/NvBlast/tools/ArtistTools/source/BlastPlugin/SampleBase/ui/EditionToolController.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* -* 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 "EditionToolController.h" -#include "BlastController.h" -#include "Renderer.h" -#include "PhysXController.h" -#include "SampleProfiler.h" -#include "PxRigidDynamic.h" -#include "PxScene.h" -#include "NvBlastExtPxManager.h" -#include "SceneController.h" -#include "NvBlastExtPxActor.h" -using namespace Nv::Blast; -using namespace physx; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Setup -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - -EditionToolController::EditionToolController() -{ -} - -EditionToolController::~EditionToolController() -{ -} - -void EditionToolController::onSampleStart() -{ -} - -void EditionToolController::onInitialize() -{ -} - - -void EditionToolController::onSampleStop() -{ -} - -void EditionToolController::Animate(double dt) -{ - PROFILER_SCOPED_FUNCTION(); -} - - -LRESULT EditionToolController::MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - PROFILER_SCOPED_FUNCTION(); - - if (uMsg == WM_LBUTTONDOWN || uMsg == WM_MOUSEMOVE || uMsg == WM_LBUTTONUP) - { - float mouseX = (short)LOWORD(lParam) / getRenderer().getScreenWidth(); - float mouseY = (short)HIWORD(lParam) / getRenderer().getScreenHeight(); - bool press = uMsg == WM_LBUTTONDOWN; - - if (uMsg == WM_LBUTTONUP) - { - PxVec3 eyePos, pickDir; - getPhysXController().getEyePoseAndPickDir(mouseX, mouseY, eyePos, pickDir); - pickDir = pickDir.getNormalized(); - - PxRaycastHit hit; hit.shape = NULL; - PxRaycastBuffer hit1; - getPhysXController().getPhysXScene().raycast(eyePos, pickDir, PX_MAX_F32, hit1, PxHitFlag::ePOSITION | PxHitFlag::eNORMAL); - hit = hit1.block; - - PxRigidActor* actor = NULL; - if (hit.shape) - { - actor = hit.actor; - } - fracture(actor); - } - } - - return 1; -} - -void EditionToolController::drawUI() -{ -} - -void EditionToolController::fracture(PxActor* actor) -{ - if (NULL == actor) - { - return; - } - - BlastController& blastController = getBlastController(); - std::vector<BlastFamilyPtr>& families = blastController.getFamilies(); - if (families.size() == 0) - { - return; - } - - ExtPxActor* extActor = NULL; - PxRigidDynamic* rigidDynamic = actor->is<PxRigidDynamic>(); - if (NULL != rigidDynamic) - { - extActor = blastController.getExtPxManager().getActorFromPhysXActor(*rigidDynamic); - } - if (NULL == extActor) - { - return; - } - - uint32_t chunkCount = extActor->getChunkCount(); - if (chunkCount <= 0) - { - return; - } - - BlastFamilyPtr pBlastFamily = NULL; - std::vector<BlastFamilyPtr>::iterator it = families.begin(); - for (; it != families.end(); it++) - { - BlastFamilyPtr f = *it; - if (f->find(extActor)) - { - pBlastFamily = f; - break; - } - } - if (NULL == pBlastFamily) - { - return; - } - - const uint32_t* chunkIndices = extActor->getChunkIndices(); - - const BlastAsset& blastAsset = pBlastFamily->getBlastAsset(); - const BlastAsset* pBlastAsset = &blastAsset; - - SceneController& sceneController = getManager()->getSceneController(); - AssetList::ModelAsset desc; - sceneController.GetAssetDesc(pBlastAsset, desc); - - std::string assetname = desc.id; - getManager()->fractureAsset(assetname, pBlastAsset, chunkIndices[0]); - getManager()->addModelAsset(assetname, desc.isSkinned, desc.transform, false); -}
\ No newline at end of file |