Newton Dynamics  4.00
ndCudaTypes.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 __ND_CUDA_TYPES_H__
23 #define __ND_CUDA_TYPES_H__
24 
25 #include <cuda.h>
26 #include <vector_types.h>
27 #include <cuda_runtime.h>
28 
29 #include "ndCudaVector.h"
30 #include "ndCudaDeviceBuffer.h"
31 
33 {
34  public:
35  ndCudaVector m_min;
36  ndCudaVector m_max;
37 };
38 
40 {
41  public:
42  ndCudaVector m_linear;
43  ndCudaVector m_angular;
44 };
45 
47 {
48  public:
49  ndCudaBoundingBox m_box;
50  float m_nodeArea;
51  int m_bodyIndex;
52 };
53 
54 
55 // maybe to be removed
56 #define D_AABB_GRID_CELL_BITS 10
58 {
59  public:
60  union
61  {
62  struct
63  {
64  union
65  {
66  struct
67  {
68  unsigned m_x : D_AABB_GRID_CELL_BITS;
69  unsigned m_y : D_AABB_GRID_CELL_BITS;
70  unsigned m_z : D_AABB_GRID_CELL_BITS;
71  };
72  unsigned m_key;
73  };
74  unsigned m_id;
75  };
76  long long m_value;
77  };
78 };
79 
80 
81 template <class T>
83 {
84  public:
85  ndCudaBuffer()
86  :m_array(nullptr)
87  ,m_size(0)
88  ,m_capacity(0)
89  {
90  }
91 
93  :m_array((T*)&src[0])
94  ,m_size(src.GetCount())
95  ,m_capacity(src.GetCapacity())
96  {
97  }
98 
99  T* m_array;
100  unsigned m_size;
101  unsigned m_capacity;
102 };
103 
104 #endif
ndCudaDeviceBuffer
Definition: ndCudaDeviceBuffer.h:31
ndCudaSpatialVector
Definition: ndCudaTypes.h:40
ndCudaSceneNode
Definition: ndCudaTypes.h:47
ndCudaBodyAabbCell
Definition: ndCudaTypes.h:58
ndCudaBuffer
Definition: ndCudaTypes.h:83
ndCudaBoundingBox
Definition: ndCudaTypes.h:33
ndCudaVector
Definition: ndCudaVector.h:31