-
Notifications
You must be signed in to change notification settings - Fork 0
/
PhysicsClient.cpp
executable file
·66 lines (52 loc) · 1.65 KB
/
PhysicsClient.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// PhysicsClient.cpp: implementation of the PhysicsClient class.
//
// Copyright (2005) Gideon Pertzov
//
// This source code is provided "AS IS" without express or implied warranties.
// You may use this source code in FREEWARE applications you distribute,
// Provided that credit is given to the original author.
// You MAY NOT use the source code in ANY COMMERCIAL APPLICATION
// Without the written consent of the original author.
//
// http://www.gpdev.net
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
#include "Mmgr\mmgr.h"
#endif
#include "PhysicsClient.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
PhysicsClient::PhysicsClient() : _world(0),
_space(0),
_envSpace(0)
{
ZeroMemory(&_hooks, sizeof(_hooks));
}
PhysicsClient::~PhysicsClient()
{
}
// this function is called by the PhysicsServer for each registered client
bool PhysicsClient::init(dWorldID world, dSpaceID space, dSpaceID envSpace)
{
if (world == 0 || space == 0 || envSpace == 0)
return false;
_world = world;
_space = space;
_envSpace = envSpace;
return true;
}
// set physics hook (only used in NeuroDriver simulation)
bool PhysicsClient::setHook(PhysicsHookType type, PHYSHOOK_CALLBACK hookCB, void* context)
{
if (type >= PHYS_HOOK_MAX)
return false;
_hooks[type].pCB = hookCB;
_hooks[type].pContext = context;
return true;
}