Newton Dynamics
4.00
ndSceneNode.h
1
/* Copyright (c) <2003-2019> <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 __D_SCENE_NODE_H__
23
#define __D_SCENE_NODE_H__
24
25
#include "ndCollisionStdafx.h"
26
27
class
ndBodyKinematic
;
28
class
ndSceneBodyNode
;
29
class
ndSceneTreeNode
;
30
class
ndSceneAggregate;
31
32
D_MSV_NEWTON_ALIGN_32
33
class
ndSceneNode
:
public
dClassAlloc
34
{
35
public
:
36
ndSceneNode
(
ndSceneNode
*
const
parent)
37
:
dClassAlloc
()
38
,m_minBox(dFloat32(-1.0e15f))
39
,m_maxBox(dFloat32(1.0e15f))
40
,m_parent(parent)
41
,m_lock()
42
,m_surfaceArea(dFloat32(1.0e20f))
43
{
44
}
45
46
virtual
~
ndSceneNode
()
47
{
48
}
49
50
void
GetAABB(
dVector
& minBox,
dVector
& maxBox)
const
51
{
52
minBox = m_minBox;
53
maxBox = m_maxBox;
54
}
55
56
D_COLLISION_API
void
SetAABB(
const
dVector
& minBox,
const
dVector
& maxBox);
57
58
virtual
ndSceneNode
* GetAsSceneNode() {
return
this
; }
59
virtual
ndSceneBodyNode
* GetAsSceneBodyNode() {
return
nullptr
; }
60
virtual
ndSceneTreeNode
* GetAsSceneTreeNode() {
return
nullptr
; }
61
virtual
ndSceneAggregate* GetAsSceneAggregate() {
return
nullptr
; }
62
63
/*
64
virtual bool IsSegregatedRoot() const
65
{
66
return false;
67
}
68
69
virtual bool IsAggregate() const
70
{
71
return false;
72
}
73
*/
74
virtual
ndBodyKinematic
* GetBody()
const
75
{
76
return
nullptr
;
77
}
78
79
virtual
ndSceneNode
* GetLeft()
const
80
{
81
return
nullptr
;
82
}
83
84
virtual
ndSceneNode
* GetRight()
const
85
{
86
return
nullptr
;
87
}
88
89
dVector
m_minBox;
90
dVector
m_maxBox;
91
ndSceneNode
* m_parent;
92
dSpinLock
m_lock;
93
dFloat32 m_surfaceArea;
94
95
static
dVector
m_aabbQuantization;
96
static
dVector
m_aabbInvQuantization;
97
} D_GCC_NEWTON_ALIGN_32 ;
98
99
D_MSV_NEWTON_ALIGN_32
100
class
ndSceneBodyNode
:
public
ndSceneNode
101
{
102
public
:
103
D_COLLISION_API
ndSceneBodyNode
(
ndBodyKinematic
*
const
body);
104
D_COLLISION_API
virtual
~
ndSceneBodyNode
();
105
106
virtual
ndSceneBodyNode
* GetAsSceneBodyNode() {
return
this
; }
107
108
virtual
ndBodyKinematic
* GetBody()
const
109
{
110
return
m_body;
111
}
112
113
ndBodyKinematic
* m_body;
114
} D_GCC_NEWTON_ALIGN_32 ;
115
116
class
ndSceneTreeNode
:
public
ndSceneNode
117
{
118
public
:
119
D_COLLISION_API
ndSceneTreeNode
(
ndSceneNode
*
const
sibling,
ndSceneNode
*
const
myNode);
120
D_COLLISION_API
virtual
~
ndSceneTreeNode
();
121
122
virtual
ndSceneTreeNode
* GetAsSceneTreeNode() {
return
this
; }
123
124
virtual
ndSceneNode
* GetLeft()
const
125
{
126
return
m_left;
127
}
128
129
virtual
ndSceneNode
* GetRight()
const
130
{
131
return
m_right;
132
}
133
134
ndSceneNode
* m_left;
135
ndSceneNode
* m_right;
136
dList<ndSceneTreeNode*, dContainersFreeListAlloc<ndSceneTreeNode*>
>::dListNode* m_fitnessNode;
137
} D_GCC_NEWTON_ALIGN_32;
138
139
140
#endif
ndSceneTreeNode
Definition:
ndSceneNode.h:117
dSpinLock
Simple spin lock for synchronizing threads for very short period of time.
Definition:
dTypes.h:567
ndSceneBodyNode
Definition:
ndSceneNode.h:101
dClassAlloc
Base class for providing memory allocation for all other engine classes.
Definition:
dClassAlloc.h:29
ndBodyKinematic
Definition:
ndBodyKinematic.h:37
ndSceneNode
Definition:
ndSceneNode.h:34
dVector
Definition:
dVectorArmNeon.h:1104
dList
Definition:
dList.h:32
dClassAlloc::dClassAlloc
dClassAlloc()
Empty.
Definition:
dClassAlloc.h:32
Development
newton-dynamics
newton-4.00
sdk
dCollision
ndSceneNode.h
Generated by
1.8.20