00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #pragma once
00029
00030 #include "NvBlastExtDamageShaders.h"
00031 #include "PxBounds3.h"
00032
00033
00034 namespace Nv
00035 {
00036 namespace Blast
00037 {
00038
00039
00040 class ExtDamageAcceleratorInternal : public NvBlastExtDamageAccelerator
00041 {
00042 public:
00043 struct QueryBondData
00044 {
00045 uint32_t bond;
00046 uint32_t node0;
00047 uint32_t node1;
00048 };
00049
00050 class ResultCallback
00051 {
00052 public:
00053 ResultCallback(QueryBondData* buffer, uint32_t count) :
00054 m_bondBuffer(buffer), m_bondMaxCount(count), m_bondCount(0) {}
00055
00056 virtual void processResults(const QueryBondData* bondBuffer, uint32_t count) = 0;
00057
00058 void push(uint32_t bond, uint32_t node0, uint32_t node1)
00059 {
00060 m_bondBuffer[m_bondCount].bond = bond;
00061 m_bondBuffer[m_bondCount].node0 = node0;
00062 m_bondBuffer[m_bondCount].node1 = node1;
00063 m_bondCount++;
00064 if (m_bondCount == m_bondMaxCount)
00065 {
00066 dispatch();
00067 }
00068 }
00069
00070 void dispatch()
00071 {
00072 if (m_bondCount)
00073 {
00074 processResults(m_bondBuffer, m_bondCount);
00075 m_bondCount = 0;
00076 }
00077 }
00078
00079 private:
00080 QueryBondData* m_bondBuffer;
00081 uint32_t m_bondMaxCount;
00082
00083 uint32_t m_bondCount;
00084 };
00085
00086 virtual void findBondCentroidsInBounds(const physx::PxBounds3& bounds, ResultCallback& resultCallback) const = 0;
00087 virtual void findBondSegmentsInBounds(const physx::PxBounds3& bounds, ResultCallback& resultCallback) const = 0;
00088 virtual void findBondSegmentsPlaneIntersected(const physx::PxPlane& plane, ResultCallback& resultCallback) const = 0;
00089
00090
00091 virtual void* getImmediateScratch(size_t size) = 0;
00092 };
00093
00094
00095 }
00096 }