In file CAVERNst_baseAvatar_c.h++:

class CAVERNst_baseAvatarManager_c

CAVERN support template base avatar manager class

Public Methods

void applyToAllAvatars (int (*userFunc)(long avatarID, CAVERNst_baseAvatar_c *, void *inParam1, void *inParam2, void *inParam3, void *& retParam), void *inParam1, void *inParam2, void *inParam3, void *& inOutParam)
Apply a user function to all the avatars
CAVERNst_baseAvatarManager_c ()
Constructor.
int init (char* applicationName, CAVERN_irb_c *theIrb, CAVERN_irbId_c *avatarIrbServer, int trackerDataSize, int helloDataSize, int auxDataSize)
Initialize Avatar Manager
void sendAux ()
Sending the aux data.
void sendBye ()
Send bye message to all clients.
void sendHello ()
Sending the hello data.
void sendTracker ()
Sending the tracker data.
void setAuxData (char *aux)
Set the aux data that you wish to send out. Use sendHello() to dispatch the data.
void setAvatarAuxCallback (void (*cb)(CAVERNst_baseAvatar_c *))
When avatar auxiliary data has arrived your callback.
void setAvatarExitCallback (void (*cb)(CAVERNst_baseAvatar_c *))
If an avatar has left call your callback.
void setAvatarHelloChangeCallback (void (*cb)(CAVERNst_baseAvatar_c *))
When avatar hello data has changed call your callback.
void setAvatarTrackerCallback (void (*cb)(CAVERNst_baseAvatar_c *))
If a new packet of tracker data arrives call your callback.
void setHelloData (char *hello)
Set the hello data that you wish to send out. Use sendHello() to dispatch the data.
void setNewAvatarCallback (void (*cb)(CAVERNst_baseAvatar_c *))
When a new avatar arrives call your callback.
void setTrackerData (char *tracker)
Set the tracker data that you wish to send out. Use sendTracker() to dispatch the data.
void setTrackerUpdateDelay (double delay)
Set how often tracker data is sent
~CAVERNst_baseAvatarManager_c ()
Delete the avatar manager and also tell other clients that you have left

Documentation

CAVERN support template base avatar manager class. This manages avatars that connect and disconnect from your client. Begin by creating a single manager and then initializing it with init(). Then set the hello data you wish to send and call sendHello(). Everytime you wish to send a tracker packet, package the tracker data you want to send, call setTrackerData() and then call sendTracker(). When you want to tell everyone you are leaving call: sendBye() or simply delete your avatar manager object. Similary to send auxiliary data call setAuxData() followed by sendAux();

Note: nothing is implied in the format of the tracker, hello, or aux data. This is done intentionally so that you can bundle whatever you want in it. Then you can build higher level avatar classes on top of this or extend this avatar class by adding things that are specific to say OpenGL or Performer.

For example, tracker data could be an array of floats containing an avatar's body position, orientation etc. Hello data could consist of information about an avatar's color, size, filenames for 3D models, IRB addresses and keys to find 3D models, etc. Aux data could be intermittent chat text messages sent between avatars.

Hello and aux data are sent via reliable channels. The tracker data are sent via unreliable channels.

int init(char* applicationName, CAVERN_irb_c *theIrb, CAVERN_irbId_c *avatarIrbServer, int trackerDataSize, int helloDataSize, int auxDataSize)
Initialize Avatar Manager. Do this before doing any other avatar manager calls.
Parameters:
applicationName - a string uniquely identifying an application group. This is to prevent avatars from different applications from running into each other.
theIRB - the personal IRB from CAVERNInit()
avatarIrbServer - the IRB ID of an IRB to which you wish to designate as a server to handle avatar information distribution. If you set this as NULL then you are assuming that responsibility yourself and you can ask other clients to connect to you.
trackerDataSize - the expected size of the data that will carry all the positional, and orientational information about the avatar all packed into 1 array of characters.
helloDataSize - the expected size of the data that will carry all the other avatar information like the color of an avatar, or the filename for each part of the avatar (head, hand etc), or the IRB address of where to retrieve the different parts of the avatar.
auxDataSize - the expected size of the data that will carry any auxiliary data over the reliable hailing channel during the course of the operation of the avatar.

void applyToAllAvatars(int (*userFunc)(long avatarID, CAVERNst_baseAvatar_c *, void *inParam1, void *inParam2, void *inParam3, void *& retParam), void *inParam1, void *inParam2, void *inParam3, void *& inOutParam)
Apply a user function to all the avatars. The user function will be applied to each avatar in turn if the function returns a 1. If you wish to abort this process have the function return 0.

The user function should be of the form: int userFunc(long avatarID, CAVERNst_baseAvatar_c *eachAvatar, void* inParam1, void* inParam2, void* inParam3, void *& retParam)

eachAvatar is a pointer to each of the avatar class object.

The inParams are designed for you to pass your application data into the function.

The retParam can be used to pass in as well as return a value to your application. E.g. within the userFunc you could set

retParam = (void*) somePointer; return 0;

somePointer will then be returned back to the applyToAllAvatars() member function in the parameter inOutParam.

void setTrackerUpdateDelay(double delay)
Set how often tracker data is sent. Delay is in seconds with microsecond accuracy. By setting this, no matter how often you call sendTracker it will only actually send data packets as often as the delay allows it. This is useful to prevent tracker data from flooding the network. By default this delay is set at 1/15s


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de