aboutsummaryrefslogtreecommitdiff
path: root/APEX_1.4/samples_v2/SampleParticlesMeshParticles
diff options
context:
space:
mode:
authorgit perforce import user <a@b>2016-10-25 12:29:14 -0600
committerSheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees>2016-10-25 18:56:37 -0500
commit3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch)
treefa6485c169e50d7415a651bf838f5bcd0fd3bfbd /APEX_1.4/samples_v2/SampleParticlesMeshParticles
downloadphysx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz
physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip
Initial commit:
PhysX 3.4.0 Update @ 21294896 APEX 1.4.0 Update @ 21275617 [CL 21300167]
Diffstat (limited to 'APEX_1.4/samples_v2/SampleParticlesMeshParticles')
-rw-r--r--APEX_1.4/samples_v2/SampleParticlesMeshParticles/Main.cpp51
-rw-r--r--APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.cpp67
-rw-r--r--APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.h39
-rw-r--r--APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.cpp58
-rw-r--r--APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.h39
5 files changed, 254 insertions, 0 deletions
diff --git a/APEX_1.4/samples_v2/SampleParticlesMeshParticles/Main.cpp b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/Main.cpp
new file mode 100644
index 00000000..61565451
--- /dev/null
+++ b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/Main.cpp
@@ -0,0 +1,51 @@
+#include "Utils.h"
+
+#include <DirectXMath.h>
+#include "XInput.h"
+#include "DXUTMisc.h"
+#include "DXUTCamera.h"
+
+
+#include "ApexController.h"
+#include "ApexRenderer.h"
+#include "CommonUIController.h"
+#include "SampleUIController.h"
+#include "SampleSceneController.h"
+
+#include "SampleManager.h"
+
+int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
+{
+ PX_UNUSED(hInstance);
+ PX_UNUSED(hPrevInstance);
+ PX_UNUSED(lpCmdLine);
+ PX_UNUSED(nCmdShow);
+
+// Enable run-time memory check for debug builds.
+#if defined(DEBUG) | defined(_DEBUG)
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ AllocConsole();
+#endif
+
+ SampleManager* sampleManager = new SampleManager(L"APEX Particles Sample: Mesh Particles");
+
+ CFirstPersonCamera camera;
+
+ auto apexController = ApexController(PxDefaultSimulationFilterShader, &camera);
+ auto apexRender = ApexRenderer(&camera, apexController);
+ auto sceneController = SampleSceneController(&camera, apexController);
+ auto commonUiController = CommonUIController(&camera, &apexRender, &apexController);
+ auto sampleUIController = SampleUIController(&sceneController, &commonUiController);
+
+ sampleManager->addControllerToFront(&apexController);
+ sampleManager->addControllerToFront(&apexRender);
+ sampleManager->addControllerToFront(&sceneController);
+ sampleManager->addControllerToFront(&sampleUIController);
+ sampleManager->addControllerToFront(&commonUiController);
+
+ int result = sampleManager->run();
+
+ delete sampleManager;
+
+ return result;
+}
diff --git a/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.cpp b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.cpp
new file mode 100644
index 00000000..9df8d0f9
--- /dev/null
+++ b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.cpp
@@ -0,0 +1,67 @@
+/*
+* 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 "SampleSceneController.h"
+#include "ApexRenderer.h" // for matrix conversion
+#include <DirectXMath.h>
+#include "XInput.h"
+#include "DXUTMisc.h"
+#pragma warning(push)
+#pragma warning(disable : 4481) // Suppress "nonstandard extension used" warning
+#include "DXUTCamera.h"
+#pragma warning(pop)
+
+#include "PxPhysicsAPI.h"
+#include "PxMath.h"
+
+#include "ApexResourceCallback.h"
+#include "PhysXPrimitive.h"
+
+#include "EmitterAsset.h"
+#include "EmitterActor.h"
+
+using namespace physx;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SampleSceneController::SampleSceneController(CFirstPersonCamera* camera, ApexController& apex)
+ : mApex(apex), mCamera(camera)
+{
+}
+
+SampleSceneController::~SampleSceneController()
+{
+}
+
+void SampleSceneController::onSampleStart()
+{
+ // setup camera
+ DirectX::XMVECTORF32 lookAtPt = { 0, 2, 0, 0 };
+ DirectX::XMVECTORF32 eyePt = { 0, 5, 10, 0 };
+ mCamera->SetViewParams(eyePt, lookAtPt);
+ mCamera->SetRotateButtons(false, false, true, false);
+ mCamera->SetEnablePositionMovement(true);
+
+ // spawn mesh emitter
+ nvidia::apex::Asset *asset = (nvidia::apex::Asset *)mApex.getApexSDK()->getNamedResourceProvider()->getResource(EMITTER_AUTHORING_TYPE_NAME, "testMeshEmitter4ParticleIos");
+ NvParameterized::Interface *defaultActorDesc = asset->getDefaultActorDesc();
+ NvParameterized::setParamTransform(*defaultActorDesc, "InitialPose", PxTransform(PxIdentity));
+ EmitterActor *actor = (EmitterActor*)asset->createApexActor(*defaultActorDesc, *(mApex.getApexScene()));
+
+ actor->startEmit(true);
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.h b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.h
new file mode 100644
index 00000000..34656862
--- /dev/null
+++ b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleSceneController.h
@@ -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.
+*/
+
+#ifndef SCENE_CONTROLLER_H
+#define SCENE_CONTROLLER_H
+
+#include "ApexController.h"
+#include "SampleManager.h"
+#include "PxPhysicsAPI.h"
+
+class CFirstPersonCamera;
+
+using namespace physx;
+using namespace nvidia;
+
+class SampleSceneController : public ISampleController
+{
+public:
+ SampleSceneController(CFirstPersonCamera* camera, ApexController& apex);
+ virtual ~SampleSceneController();
+
+ virtual void onSampleStart();
+
+private:
+ SampleSceneController& operator= (const SampleSceneController&);
+
+ ApexController& mApex;
+ CFirstPersonCamera* mCamera;
+
+};
+
+#endif \ No newline at end of file
diff --git a/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.cpp b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.cpp
new file mode 100644
index 00000000..d6ddca20
--- /dev/null
+++ b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.cpp
@@ -0,0 +1,58 @@
+/*
+* 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 "SampleUIController.h"
+#include "SampleSceneController.h"
+#include "CommonUIController.h"
+
+SampleUIController::SampleUIController(SampleSceneController* s, CommonUIController* c) : mScene(s), mCommonUIController(c)
+{
+}
+
+void SampleUIController::onInitialize()
+{
+ TwBar* sampleBar = TwNewBar("Sample");
+ PX_UNUSED(sampleBar);
+ TwDefine("Sample color='19 25 59' alpha=128 text=light size='200 150' iconified=false valueswidth=150 position='12 480' label='Select Asset'");
+
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_POSITION);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_VELOCITY);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_COLLISION_NORMAL);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_BOUNDS);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_GRID);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_BROADPHASE_BOUNDS);
+ mCommonUIController->addPhysXDebugRenderParam(PxVisualizationParameter::ePARTICLE_SYSTEM_MAX_MOTION_DISTANCE);
+
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_TURBULENCE_FS_VELOCITY", "TurbulenceFS", 1.0f, "TurbulenceFS velocities");
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_TURBULENCE_FS_BBOX", "TurbulenceFS", 1.0f, "TurbulenceFS BBOX");
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_TURBULENCE_FS_ACTOR_NAME", "TurbulenceFS", 1.0f, "TurbulenceFS name");
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_TURBULENCE_FS_VELOCITY_FIELD", "TurbulenceFS", 1.0f, "TurbulenceFS velocity field");
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_TURBULENCE_FS_STREAMLINES", "TurbulenceFS", 1.0f, "TurbulenceFS streamlines");
+ mCommonUIController->addApexDebugRenderParam("VISUALIZE_IOFX_ACTOR", "Iofx", 1.0f, "IOFX actor");
+ mCommonUIController->addApexDebugRenderParam("apexEmitterParameters.VISUALIZE_APEX_EMITTER_ACTOR", "Emitter", 1.0f, "Emitter actor");
+}
+
+LRESULT SampleUIController::MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ PX_UNUSED(hWnd);
+ PX_UNUSED(uMsg);
+ PX_UNUSED(wParam);
+ PX_UNUSED(lParam);;
+
+ return 1;
+}
+
+void SampleUIController::BackBufferResized(ID3D11Device* pDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc)
+{
+ PX_UNUSED(pDevice);
+
+ mWidth = pBackBufferSurfaceDesc->Width;
+ mHeight = pBackBufferSurfaceDesc->Height;
+}
diff --git a/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.h b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.h
new file mode 100644
index 00000000..93fe5bbf
--- /dev/null
+++ b/APEX_1.4/samples_v2/SampleParticlesMeshParticles/SampleUIController.h
@@ -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.
+*/
+
+#ifndef SAMPLE_UI_CONTROLLER_H
+#define SAMPLE_UI_CONTROLLER_H
+
+#include "SampleManager.h"
+#include <DirectXMath.h>
+#include "AntTweakBar.h"
+
+class SampleSceneController;
+class CommonUIController;
+
+class SampleUIController : public ISampleController
+{
+ public:
+ SampleUIController(SampleSceneController* s, CommonUIController* c);
+
+ virtual void onInitialize();
+ virtual LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void BackBufferResized(ID3D11Device* pDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc);
+
+ private:
+ SampleSceneController* mScene;
+ CommonUIController* mCommonUIController;
+ TwBar* mSettingsBar;
+
+ UINT mWidth;
+ UINT mHeight;
+};
+
+#endif \ No newline at end of file