Newton Dynamics
4.00
ndLoadSave.h
1
/* Copyright (c) <2003-2022> <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_ND_LOAD_SAVE_H__
23
#define __ND_ND_LOAD_SAVE_H__
24
25
#include "ndNewtonStdafx.h"
26
27
class
ndWorld
;
28
class
ndLoadSaveInfo
;
29
30
class
ndWordSettings
:
public
ndClassAlloc
31
{
32
public
:
33
D_CLASS_REFLECTION(
ndWordSettings
);
34
35
ndWordSettings
()
36
:
ndClassAlloc
()
37
,m_subSteps(2)
38
,m_solverIterations(4)
39
{
40
}
41
42
virtual
~
ndWordSettings
()
43
{
44
}
45
46
D_NEWTON_API
ndWordSettings
(
const
ndLoadSaveBase::ndLoadDescriptor
& desc);
47
D_NEWTON_API
virtual
void
Load(
const
ndLoadSaveBase::ndLoadDescriptor
& desc);
48
D_NEWTON_API
virtual
void
Save(
const
ndLoadSaveBase::ndSaveDescriptor
& desc)
const
;
49
50
ndInt32 m_subSteps;
51
ndInt32 m_solverIterations;
52
};
53
54
D_MSV_NEWTON_ALIGN_32
55
class
ndLoadSave
:
public
ndClassAlloc
56
{
57
public
:
58
ndLoadSave
();
59
~
ndLoadSave
();
60
61
D_NEWTON_API
bool
LoadScene(
const
char
*
const
path);
62
D_NEWTON_API
void
SaveModel(
const
char
*
const
path,
const
ndModel
*
const
model);
63
D_NEWTON_API
void
SaveScene(
const
char
*
const
path,
const
ndWorld
*
const
world,
const
ndWordSettings
*
const
setting);
64
65
private
:
66
void
SaveSceneSettings(
ndLoadSaveInfo
& info)
const
;
67
void
SaveShapes(
ndLoadSaveInfo
& info);
68
void
SaveBodies(
ndLoadSaveInfo
& info);
69
void
SaveJoints(
ndLoadSaveInfo
& info);
70
void
SaveModels(
ndLoadSaveInfo
& info);
71
72
void
LoadSceneSettings(
const
nd::TiXmlNode
*
const
rootNode,
const
char
*
const
assetPath);
73
void
LoadShapes(
const
nd::TiXmlNode
*
const
rootNode,
const
char
*
const
assetPath,
ndShapeLoaderCache
& shapesMap);
74
void
LoadBodies(
const
nd::TiXmlNode
*
const
rootNode,
const
char
*
const
assetPath,
const
ndShapeLoaderCache
& shapesMap);
75
void
LoadJoints(
const
nd::TiXmlNode
*
const
rootNode,
const
char
*
const
assetPath);
76
void
LoadModels(
const
nd::TiXmlNode
*
const
rootNode,
const
char
*
const
assetPath);
77
78
public
:
79
ndWordSettings
* m_setting;
80
ndBodyLoaderCache
m_bodyMap;
81
ndJointLoaderCache
m_jointMap;
82
ndModelLoaderCache
m_modelMap;
83
} D_GCC_NEWTON_ALIGN_32;
84
85
86
inline
ndLoadSave::ndLoadSave()
87
:
ndClassAlloc
()
88
,m_setting(nullptr)
89
,m_bodyMap()
90
,m_jointMap()
91
,m_modelMap()
92
{
93
}
94
95
inline
ndLoadSave::~ndLoadSave()
96
{
97
if
(m_setting)
98
{
99
delete
m_setting;
100
}
101
}
102
103
104
#endif
ndClassAlloc
Base class for providing memory allocation for all other engine classes.
Definition:
ndClassAlloc.h:30
ndBodyLoaderCache
Definition:
ndSaveLoadSytem.h:44
ndShapeLoaderCache
Definition:
ndSaveLoadSytem.h:40
ndLoadSaveInfo
Definition:
ndLoadSave.cpp:35
nd::TiXmlNode
The parent class for everything in the Document Object Model.
Definition:
tinyxml.h:437
ndModel
Definition:
ndModel.h:33
ndJointLoaderCache
Definition:
ndSaveLoadSytem.h:48
ndWordSettings
Definition:
ndLoadSave.h:31
ndLoadSave
Definition:
ndLoadSave.h:56
ndModelLoaderCache
Definition:
ndSaveLoadSytem.h:52
ndClassAlloc::ndClassAlloc
ndClassAlloc()
Empty default constructor.
Definition:
ndClassAlloc.h:33
ndLoadSaveBase::ndLoadDescriptor
Definition:
ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition:
ndSaveLoadSytem.h:93
ndWorld
Definition:
ndWorld.h:47
newton-dynamics
newton-4.00
sdk
dNewton
ndLoadSave.h
Generated by
1.8.20