Planeshift
Defines | Functions

loader.h File Reference

#include <csgeom/poly3d.h>
#include <csgfx/shadervar.h>
#include <csutil/scf_implementation.h>
#include <csutil/hash.h>
#include <csutil/threading/rwmutex.h>
#include <csutil/threadmanager.h>
#include <csutil/refcount.h>
#include <csutil/typetraits.h>
#include <iengine/engine.h>
#include <iengine/material.h>
#include <iengine/mesh.h>
#include <iengine/meshgen.h>
#include <iengine/sector.h>
#include <iengine/texture.h>
#include <iengine/movable.h>
#include <imesh/object.h>
#include <imesh/objmodel.h>
#include <imap/loader.h>
#include <iutil/objreg.h>
#include <iutil/vfs.h>
#include <ibgloader.h>
#include <iscenemanipulate.h>
#include "cstool/tokenlist.h"

Go to the source code of this file.

Defines

#define CS_ASSERT_MSG(msg, x)   if(!(x)) printf("ART ERROR: %s\n", msg)
#define CS_TOKEN_ITEM_FILE   "src/plugins/common/bgloader/parser.tok"
#define CS_TOKEN_LIST_TOKEN_PREFIX   PARSERTOKEN_
#define LOADER_DEBUG_MESSAGE(...)

Functions

 CS_PLUGIN_NAMESPACE_BEGIN (bgLoader)

Define Documentation

#define CS_ASSERT_MSG (   msg,
 
)    if(!(x)) printf("ART ERROR: %s\n", msg)

Definition at line 56 of file loader.h.

#define CS_TOKEN_ITEM_FILE   "src/plugins/common/bgloader/parser.tok"
#define CS_TOKEN_LIST_TOKEN_PREFIX   PARSERTOKEN_
#define LOADER_DEBUG_MESSAGE (   ...)

Definition at line 51 of file loader.h.


Function Documentation

CS_PLUGIN_NAMESPACE_BEGIN ( bgLoader  )

The BgLoader is a wrapper around the Crystalspace iThreadedLoader interface. The main idea is to read all the files that iThreadedLoader would read but instead of creating the iEngine objects, the XML information is saved and used later to create the iEngine objects. The iEngine objects are created when the player's character is moved across sectors or comes within visible range of an object. Thus, the BgLoader can load and unload iEngine objects as needed, saving memory and load time.

Plugin initialisation.

Start loading a material into the engine. Check return for success once it's finished.

Start loading a mesh factory into the engine. Check return for success once it's finished.

Clone a mesh factory.

Parameters:
nameThe name of the mesh factory to clone.
newNameThe name of the new cloned mesh factory.
loadBegin loading the cloned mesh factory.
failedPass a boolean to be able to manually handle a failed clone.
scalepass a transform in here that should be applied to the factory

Pass a data file to be cached. This method will parse your data and add it to it's internal world representation. You may then request that these objects are loaded. This call will be dispatched to a thread, so it will return immediately. You should wait for parsing to finish before calling UpdatePosition().

Clears all temporary data that is only required parse time. calls to PrecacheData mustn't occur after this function has been called

Update your position in the world. Calling this will trigger per-object checks and initiate (un)loading if the object is within a given threshold (loadRange).

Parameters:
posYour world space position.
sectorNameThe name of the sector that you are currently in.
forceForces the checks to be done (normally they won't if you e.g. haven't moved).

Call this function to finalise a number of loading objects. Useful when you are waiting for a load to finish (load into the world, teleport), but want to continue rendering while you wait. Will return after processing a number of objects.

Parameters:
waitingSet as 'true' if you're waiting for the load to finish. This will make it process more before returning (lower overhead). Note that you should process a frame after each call, as spawned threads may depend on the main thread to handle requests.

Returns a pointer to the Crystal Space threaded loader.

Returns the number of objects currently loading.

Returns a pointer to the object registry.

Update the load range initially passed to the loader in Setup().

Request to know whether the current world position stored by the loader is valid. Returns false until the first call of UpdatePosition().

Request to know whether you are currently positioned in a water body.

Parameters:
sectorThe sector that you are checking.
posThe world space position that you are checking.
colourWill contain the colour of the water that you are positioned in.

Load zones given by name.

Load high priority zones given by name. High priority zones are not unloaded by UpdatePosition or LoadZones.

Returns an array of the available shaders for a given type.

Parameters:
usageTypeThe type of shader you wish to have. E.g. 'default_alpha' to get an array of all default world alpha shaders.

Creates a new instance of the given factory at the given screen space coordinates.

Parameters:
factNameThe name of the factory to be used to create the mesh.
matNameThe optional name of the material to set on the mesh. Pass NULL to set none.
cameraThe camera related to the screen space coordinates.
posThe screen space coordinates.

Selects the closest mesh at the given screen space coordinates.

Parameters:
cameraThe camera related to the screen space coordinates.
posThe screen space coordinates.

Translates the mesh selected by CreateAndSelectMesh() or SelectMesh().

Parameters:
verticalTrue if you want to translate vertically (along y-axis). False to translate snapped to the mesh at the screen space coordinates.
cameraThe camera related to the screen space coordinates.
posThe screen space coordinates.

Rotates the mesh selected by CreateAndSelectMesh() or SelectMesh().

Parameters:
posThe screen space coordinates to use to base the rotation, relative to the last saved coordinates.

Set the axes to rotate around with RotateSelected.

Parameters:
flags_hbitflag with axes for horizontal mouse movement
flags_vbitflag with axes for vertical mouse movement
See also:
PS_MANIPULATE

Sets the previous position (e.g. in case you warped the mouse)

Removes the currently selected mesh from the scene.

Returns an array of start positions in the world.

LockedType is used to store BgLoader objects.

Base class for BgLoader objects.

Definition at line 63 of file loader.h.