aboutsummaryrefslogtreecommitdiff
path: root/samples/SampleBase/ui/DamageToolController.h
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
committerAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
commit236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch)
treee486f2fa39dba203563895541e92c60ed3e25759 /samples/SampleBase/ui/DamageToolController.h
parentAdded screens to welcome page (diff)
downloadblast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz
blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'samples/SampleBase/ui/DamageToolController.h')
-rw-r--r--samples/SampleBase/ui/DamageToolController.h96
1 files changed, 61 insertions, 35 deletions
diff --git a/samples/SampleBase/ui/DamageToolController.h b/samples/SampleBase/ui/DamageToolController.h
index 9dcea39..ae14064 100644
--- a/samples/SampleBase/ui/DamageToolController.h
+++ b/samples/SampleBase/ui/DamageToolController.h
@@ -1,12 +1,30 @@
-/*
-* 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.
-*/
+// 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-2017 NVIDIA Corporation. All rights reserved.
+
#ifndef DAMAGE_TOOL_CONTROLLER_H
#define DAMAGE_TOOL_CONTROLLER_H
@@ -15,6 +33,7 @@
#include "NvBlastTypes.h"
#include <DirectXMath.h>
#include <functional>
+#include "PxVec2.h"
#include "PxVec3.h"
@@ -57,14 +76,6 @@ private:
//////// private methods ////////
- void damage(physx::PxVec3 position, physx::PxVec3 normal);
-
- void setDamageProfile(uint32_t profile);
- uint32_t getDamageProfile() const
- {
- return m_damageProfile;
- }
-
void changeDamageRadius(float dr);
void setDamageMode(bool enabled);
@@ -90,33 +101,48 @@ private:
//////// internal data ////////
- Renderable* m_pickPointerRenderable;
- RenderMaterial* m_pickPointerRenderMaterial;
- DirectX::XMFLOAT4 m_pickPointerColor;
+ RenderMaterial* m_toolRenderMaterial;
+ Renderable* m_sphereToolRenderable;
+ DirectX::XMFLOAT4 m_toolColor;
+ Renderable* m_lineToolRenderable;
- float m_damageRadius;
- float m_compressiveDamage;
- float m_explosiveImpulse;
- float m_stressForceFactor;
- uint32_t m_damageProfile;
+ float m_damage;
+ float m_explosiveImpulse;
+ float m_stressForceFactor;
struct Damager
{
- const char* uiName;
- NvBlastDamageProgram program;
- DirectX::XMFLOAT4 pointerColor;
- std::function<void(const Damager* damager, Nv::Blast::ExtPxActor* actor, physx::PxVec3 position, physx::PxVec3 normal)> executeFunction;
-
- void execute(Nv::Blast::ExtPxActor* actor, physx::PxVec3 position, physx::PxVec3 normal)
+ Damager() : damageWhilePressed(false), radius(5.0f), radiusLimit(1000.0f)
{
- executeFunction(this, actor, position, normal);
}
+
+ enum PointerType
+ {
+ Sphere,
+ Line
+ };
+
+ typedef std::function<void(const Damager* damager, Nv::Blast::ExtPxActor* actor, physx::PxVec3 origin, physx::PxVec3 position, physx::PxVec3 normal)> ExecuteFn;
+
+ const char* uiName;
+ NvBlastDamageProgram program;
+ PointerType pointerType;
+ DirectX::XMFLOAT4 pointerColor;
+ float radius;
+ float radiusLimit;
+ bool damageWhilePressed;
+ ExecuteFn executeFunction;
};
- std::vector<Damager> m_armory;
- std::vector<const char*> m_armoryNames;
+ std::vector<Damager> m_damagers;
+ std::vector<const char*> m_damagerNames;
+ uint32_t m_damagerIndex;
+
+ bool m_damageMode;
- bool m_damageMode;
+ physx::PxVec2 m_lastMousePos;
+ bool m_isMousePressed;
+ uint32_t m_damageCountWhilePressed;
};
#endif \ No newline at end of file