Newton Dynamics  4.00
cuSolverTypes.h
1 /* Copyright (c) <2003-2021> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef __CU_SOLVER_TYPES_H__
23 #define __CU_SOLVER_TYPES_H__
24 
25 #include <cuda.h>
26 #include <vector_types.h>
27 #include <cuda_runtime.h>
28 #include "cuVector.h"
29 #include "cuDeviceBuffer.h"
30 
31 class cuBodyProxy;
32 class cuBodyAabbCell;
33 
35 {
36  public:
37  cuVector m_linear;
38  cuVector m_angular;
39 };
40 
42 {
43  public:
44  cuVector m_min;
45  cuVector m_max;
46 };
47 
48 template <class T>
49 class cuBuffer
50 {
51  public:
52  cuBuffer()
53  :m_array(nullptr)
54  ,m_size(0)
55  ,m_capacity(0)
56  {
57  }
58 
59  cuBuffer(const cuDeviceBuffer<T>& src)
60  :m_array((T*)&src[0])
61  ,m_size(src.GetCount())
62  ,m_capacity(src.GetCapacity())
63  {
64  }
65 
66  T* m_array;
67  unsigned m_size;
68  unsigned m_capacity;
69 };
70 
71 class ndCudaSceneInfo
72 {
73  public:
75  :m_worldBox()
76  ,m_histogram()
77  ,m_bodyArray()
78  ,m_bodyAabbArray()
79  ,m_bodyAabbCell()
80  ,m_bodyAabbCellScrath()
81  ,m_transformBuffer0()
82  ,m_transformBuffer1()
83  ,m_frameIsValid(0)
84  ,m_frameCount(0)
85  {
86  }
87 
88  cuBoundingBox m_worldBox;
89  cuBuffer<unsigned> m_histogram;
90  cuBuffer<cuBodyProxy> m_bodyArray;
91  cuBuffer<cuBoundingBox> m_bodyAabbArray;
92  cuBuffer<cuBodyAabbCell> m_bodyAabbCell;
93  cuBuffer<cuBodyAabbCell> m_bodyAabbCellScrath;
94  cuBuffer<cuSpatialVector> m_transformBuffer0;
95  cuBuffer<cuSpatialVector> m_transformBuffer1;
96 
97  unsigned m_frameIsValid;
98  unsigned m_frameCount;
99 };
100 
101 #endif
cuBoundingBox
Definition: cuSolverTypes.h:42
ndCudaSceneInfo
Definition: ndCudaSceneInfo.h:32
cuBuffer
Definition: cuSolverTypes.h:50
cuDeviceBuffer
Definition: cuDeviceBuffer.h:32
cuSpatialVector
Definition: cuSolverTypes.h:35
cuVector
Definition: cuVector.h:32
cuBodyAabbCell
Definition: cuSortBodyAabbCells.h:36
cuBodyProxy
Definition: ndBodyBuffer.h:35