PVRCore Classes#

AsyncScheduler#

Class Documentation#

template<typename ValueType, typename FutureType, void (*worker)(FutureType)>
class AsyncScheduler#

The AsyncScheduler is an abstract Scheduling system of a homogeneous task queue running on a background thread, i.e. a queue of work of a particular type. It provides its child classes wioth access to the actual queue and the synchronization semaphores in order to facilitate easier implementation. Specifically, it is expected that the user will provide functions to enqueue and dequeue work, while this class provides the running loop (actually executing the tasks, calling the callbacks etc.

Template Parameters
  • ValueType – The type of the return value that will be returned by the functions

  • FutureType – The type of the future (which will also be the input to the worker function)

  • worker – The function pointer that will be called to perform the work

Public Types

typedef std::shared_ptr<IFrameworkAsyncResult<ValueType>> AsyncResult#

The type of result throughout this class.

Public Functions

inline uint32_t getNumApproxQueuedItem()#

The approximate number of queued items. (Unsynchronized for performance).

Returns

The number of queued items (currently visible to this thread)

inline uint32_t getNumQueuedItems()#

The precise number of queued items at the time of calling. Although it is poosible that (if the queue is currently producing or consuming) the number has changed by the time it is used (even if immediately), nevertheless getting the number is synchronized hence precise at the time of querying it.

Returns

The number of queued items (access is synchronized)

inline virtual ~AsyncScheduler()#

Destructor (virtual)

Protected Functions

inline AsyncScheduler()#

Constructor (empty, spawns worker thread and waits)

Protected Attributes

Semaphore _workSemaphore#

This semaphore is the counter for enqueued work. Signal it once when adding work to the queue.

Semaphore _queueSemaphore#

This is basically a mutex for the queue. Wait on it to lock the queue, then signal it when done.

std::deque<FutureType> _queue#

This is the work queue. Each item enqueued will be processed by worker.

std::string _myInfo#

String information regarding the tasks operations.

IFrameworkAsyncResult#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename T>
class IFrameworkAsyncResult : public pvr::async::IFrameworkCleanupObject<T>#

An object that is intended to be used as an asynchronous return value. When you wish to perform a task in another thread, when “kicking” that task you should “immediately” (before the task is complete) return such an object, and use it to check when the task is complete, and retrieve its return value. Will provide both cleanup semantics (which should at least ensure the objects are safe to destroy and operations are pending on them), and functions to both query completion and (blockingly) get the return value. To implement this class, you must implement the abstract functions get_ (that actually waits for and returns the result, and _isComplete, which actually queries if the result is ready.

Template Parameters

T – The type of the return value of the task (for example, Texture)

Public Types

typedef T ValueType#

The type of the return value.

typedef std::shared_ptr<IFrameworkAsyncResult<T>> PointerType#

A smart pointer to this result object (not the wrapped value)

typedef void (*Callback)(PointerType)#

A function pointer type that can be used as a callback to call when the return value is ready.

Public Functions

inline bool isComplete() const#

Query is the return value is ready to be used.

Returns

True if the value is ready, otherwise false

inline ValueType get()#

This is the most important function of IFrameworkAsyncResult: it actually gets the return value. If the value is not yet ready (the task is not complete), it will wait for the task completion. Use this immediately when other operations depend on the value. Otherwise, in order to avoid any wait, you can first check isComplete() and only call this function after isComplete() has returned true. If the task may fail, you should call isSuccessful() before using the value to ensure it is what you expect.

Returns

The return value of the operation.

inline bool isSuccessful() const#

Returns true if the operation was successful. An operation that is not complete cannot be successful, so check isComplete to ensure that a return value of false means that the operation actually failed

return

True if the operation is complete and successful, false if the operation failed or has not yet completed

Protected Functions

inline void setTheCallback(Callback completionCallback)#

Set the callback (a function pointer that will be called whenever processing an item is done)

Parameters

completionCallback – The callback to set

inline virtual void executeCallBack(PointerType thisPtr)#

Execute the callback (overridable)

Parameters

thisPtr – The object with which the callback will be executed as a parameter.

inline IFrameworkAsyncResult()#

Protected Attributes

Callback _completionCallback#

The callback that will be called on completion.

std::atomic<bool> _inCallback#

This is a mechanism to query if a function is actually called BY the callback to avoid deadlocking.

bool _successful#

This will / should be set to true when the work is successfully completed.

IFrameworkCleanupObject#

Inheritance Relationships#

Derived Types#

Class Documentation#

template<typename T>
class IFrameworkCleanupObject#

A wrapper object with explicit clean up semantics that is intended to be used as the return value in functions that may need to wrap multiple items. For example, it might be the return value for a texture upload function that returns both a texture object and the fence to know the operatio is complete, and the cleanup function might wait on the fence and then delete it. to void destroying useful resources, does NOT call cleanup in the destructor by default, but that can (should usually) be added to the destructor of the derived class. Implement the abstract cleanup_ function to clean up the resource, then use this object as the return value_comp from a function needing to return (for example) multiple transient values.

Subclassed by pvr::async::IFrameworkAsyncResult< TexturePtr >, pvr::async::IFrameworkAsyncResult< T >

Public Functions

inline virtual ~IFrameworkCleanupObject()#

Virtual destructor to be overriden if required.

inline void cleanup()#

Call this function when you are done using this object.

Protected Functions

inline IFrameworkCleanupObject()#

Mutex#

Class Documentation#

class Mutex#

A simple wrapper for a moodcamel Semaphore object used for synchronising multi threaded access.

Public Functions

inline Mutex()#

Constructor.

inline void lock()#

Waits for semaphore completion.

inline void unlock()#

Signals the semaphore as completed.

inline Semaphore &getSemaphore()#

Retrieves the semaphore.

Returns

The semaphore

inline const Semaphore &getSemaphore() const#

Retrieves the semaphore (const)

Returns

The semaphore (const)

TextureAsyncLoader#

Inheritance Relationships#

Base Type#

  • public pvr::async::AsyncScheduler< TexturePtr, TextureLoadFuture, &impl::textureLoadAsyncWorker > (AsyncScheduler)

Class Documentation#

class TextureAsyncLoader : public pvr::async::AsyncScheduler<TexturePtr, TextureLoadFuture, &impl::textureLoadAsyncWorker>#

A class that loads Textures in a (single) different thread and provides futures to them. Create an instance of it, and then just call loadTextureAsync foreach texture to load. When each texture has completed loading, a callback may be called, otherwise you can use all the typical functionality of futures, such as querying if loading is comlete, or using a blocking wait to get the result.

Public Functions

inline TextureAsyncLoader()#
inline AsyncResult loadTextureAsync(const std::string &filename, IAssetProvider *loader, TextureFileFormat format, AsyncResult::element_type::Callback callback = NULL)#

This function enqueues a “load texture” on a background thread, and returns an object that can be used to query and wait for the result.

Parameters
  • filename – The filename of the texture to load

  • loader – A class that provides a “getAssetStream” function to get a Stream from the filename (usually, the application class itself)

  • format – The texture format as which to load the texture.

  • callback – An optional callback to call immediately after texture loading is complete.

Returns

A future to a texture : TextureLoadFuture

hasher_helper#

Class Documentation#

template<uint32_t hashvalue, unsigned char... dummy>
class hasher_helper#

A dummy helper.

hasher_helper< hashvalue, first, dummy… >#

Class Documentation#

template<uint32_t hashvalue, unsigned char first, unsigned char... dummy>
class hasher_helper<hashvalue, first, dummy...>#

Template specialization for uint32_t values.

Public Static Attributes

static const uint32_t value = hasher_helper<hashvalue * 16777619U ^ first, dummy...>::value#

A hashed value.

hasher_helper< hashvalue, first >#

Class Documentation#

template<uint32_t hashvalue, unsigned char first>
class hasher_helper<hashvalue, first>#

Template specialization for uint32_t values.

Public Static Attributes

static const uint32_t value = hashvalue * 16777619U ^ first#

A hashed value.

AxisAlignedBox#

Class Documentation#

class AxisAlignedBox#

This class provides functionality to handle 3 dimensional Axis Aligned Boxes. Center-halfextent representation.

Public Functions

inline AxisAlignedBox(const glm::vec3 &center = glm::vec3(0.0f), const glm::vec3 &halfExtent = glm::vec3(0.f))#

Constructor center/halfextent.

Parameters
  • center – The center of the box

  • halfExtent – A vector containing the half-lengths on each axis

inline AxisAlignedBox(const AxisAlignedBoxMinMax &copyFrom)#

Conversion constructor from AxisAlignedBoxMinMax.

Parameters

copyFrom – An AxisAlignedBoxMinMax to convert from. An invalid AxisAlignedBoxMinMax will result in an empty AxisAlignedBox

inline void clear()#

Sets center and extents to zero.

inline void setMinMax(const glm::vec3 &min, const glm::vec3 &max)#

Sets from min and max. All components of min must be than all components in max.

Parameters
  • min – Minimum coordinates. Must each be less than the corresponding max coordinate.

  • max – Maximum coordinates. Must each be greater than the corresponding min coordinate.

inline void set(const glm::vec3 &center, const glm::vec3 &halfExtent)#

Sets from center and half extent.

Parameters
  • center – The center of the box

  • halfExtent – A vector containing the half-lengths on each axis

inline void add(const glm::vec3 &point)#

Add a new point to the box. The new box will be the minimum box containing the old box and the new point.

Parameters

point – The point which to add

inline void add(const AxisAlignedBox &aabb)#

Merge two axis aligned boxes. The new box will be the minimum box containing both the old and the new box.

Parameters

aabb – The aabb which to add

inline void add(float x, float y, float z)#

Add a new point to the box. The new box will be the minimum box containing the old box and the new point.

Parameters
  • x – The x-coord of the point which to add

  • y – The y-coord of the point which to add

  • z – The z-coord of the point which to add

inline glm::vec3 getMin() const#

Return a point consisting of the smallest (minimum) coordinate in each axis.

Returns

A point consisting of the smallest (minimum) coordinate in each axis

inline glm::vec3 getMax() const#

Return a point consisting of the largest (maximum) coordinate in each axis.

Returns

A point consisting of the largest (maximum) coordinate in each axis

inline void getMinMax(glm::vec3 &outMin, glm::vec3 &outMax) const#

Return the min and the max.

Parameters
  • outMin – Output: The min point will be stored here.

  • outMax – Output: The max point will be stored here.

inline void transform(const glm::mat4 &m, AxisAlignedBox &outAABB) const#

Get the local bounding box transformed by a provided matrix.

Parameters
  • m – An affine transformation matrix. Skew will be ignored.

  • outAABB – The transformed AABB will be stored here. Previous contents ignored.

inline glm::vec3 getSize() const#

Get the size (width, height, depth) of the AABB.

Returns

The size of the AABB.

inline glm::vec3 getHalfExtent() const#

Get the half-size (half-width, half-height, half-depth) of the AABB.

Returns

A vector whose coordinates are each half the size of the coresponding axis.

inline glm::vec3 topLeftFar() const#

Get the (-x +y +z) corner of the box.

Returns

A vector containing (min x, max y, max z)

inline glm::vec3 topCenterFar() const#

Get the center of the (+y +z) edge of the box.

Returns

A vector containing (center x, max y, max z)

inline glm::vec3 topRightFar() const#

Get the +x +y +z corner of the box.

Returns

A vector containing (max x, max y, max z)

inline glm::vec3 topLeftNear() const#

Get the -x +y -z corner of the box.

Returns

A vector containing (min x, max y, min z)

inline glm::vec3 topCenterNear() const#

Get the center of the edge with ( +y , -z).

Returns

A vector containing (center of x, max y, min z)

inline glm::vec3 topRightNear() const#

Get the +x +y -z corner of the box.

Returns

A vector containing (max x, max y, min z)

inline glm::vec3 center() const#

Get the center the box.

Returns

A vector containing (center x, center y, center z)

inline glm::vec3 centerLeftNear() const#

Get the center of the (-x -z) edge of the box.

Returns

A vector containing (min x, center y, min z)

inline glm::vec3 centerNear() const#

Get the center of the (-z) face of the box.

Returns

A vector containing (center x, center y, min z)

inline glm::vec3 centerRightNear() const#

Get the center of the (+x -z) edge of the box.

Returns

A vector containing (max x, center y, min z)

inline glm::vec3 centerLeftFar() const#

Get the center of the (-x +z) edge of the box.

Returns

A vector containing (min x, center y, max z)

inline glm::vec3 centerFar() const#

Get the center of the (+z) face of the box.

Returns

A vector containing (center x, center y, max z)

inline glm::vec3 centerRightFar() const#

Get the center of the (+x +z) edge of the box.

Returns

A vector containing (max x, center y, max z)

inline glm::vec3 bottomLeftNear() const#

Get the (-x -y -z) corner of the box.

Returns

A vector containing (min x, min y, min z)

inline glm::vec3 bottomCenterNear() const#

Get the center of the (-x -z) edge of the box.

Returns

A vector containing (center x, min y, min z)

inline glm::vec3 bottomRightNear() const#

Get the (+x -y -z) corner of the box.

Returns

A vector containing (max x, min y, min z)

inline glm::vec3 bottomLeftFar() const#

Get the (-x -y +z) corner of the box.

Returns

A vector containing (min x, min y, max z)

inline glm::vec3 bottomCenterFar() const#

Get the center of the (-y +z) edge of the box.

Returns

A vector containing (center x, min y, max z)

inline glm::vec3 bottomRightFar() const#

Get the (+x -y +z) corner of the box.

Returns

A vector containing (max x, min y, max z)

inline void mergeBox(const AxisAlignedBox &rhs)#

Set this AABB as the minimum AABB that contains itself and the AABB provided.

Parameters

rhs – The AABB to merge with.

inline bool operator==(const AxisAlignedBox &rhs) const#

Equality operator. AABBS are equal when center and size the same (equivalently all vertices coincide)

Parameters

rhs – The right hand side.

Returns

True if the AABBs completely coincide, otherwise false

inline bool operator!=(const AxisAlignedBox &rhs) const#

Inequality operator. AABBS are equal when either center or size are not the same (equivalently at least one vertex does not)

Parameters

rhs – The right hand side.

Returns

True if the AABBs completely coincide, otherwise false

AxisAlignedBoxMinMax#

Class Documentation#

class AxisAlignedBoxMinMax#

An AABB with a min-max representation. A newly constructed AxisAlignedBoxMinMax is always invalid (min>max), but in such a way that adding any point to it will make it valid.

Public Functions

inline AxisAlignedBoxMinMax()#

Constructor. The created AxisAlignedBoxMinMax has the min set at the highest-valued float number, and the max set at the lowest-valued float number, so but will immediately become valid when the first value is added.

Parameters

copyFrom – An AxisAlignedBox to convert from.

inline explicit AxisAlignedBoxMinMax(const AxisAlignedBox &copyFrom)#

Conversion from AxisAlignedBox.

Parameters

copyFrom – An AxisAlignedBox to convert from.

inline void setMin(const glm::vec3 &min)#

Set the minimum corner.

Parameters

min – The minimum corner

inline void setMax(const glm::vec3 &max)#

Set the maximum corner.

Parameters

max – The maximum corner

inline const glm::vec3 &getMin() const#

Get the minimum corner.

Returns

The minumum corner

inline const glm::vec3 &getMax() const#

Get the maximum corner.

Returns

The maximum corner

inline void add(const glm::vec3 &point)#

Ensure a point is contained in the AABB. If already in the AABB, do nothing. If not in the AABB, expand the AABB to exactly contain it.

Parameters

point – The point to add

Returns

The new point.

CommandLineParser#

Nested Relationships#

Nested Types#

Class Documentation#

class CommandLineParser#

This class parses, abstracts, stores and handles command line options passed on application launch.

Public Functions

inline CommandLineParser()#

Constructor.

inline CommandLineParser(int argc, char **argv)#

Constructor from C++ main arguments.

Parameters
  • argc – The number of arguments to parse

  • argv – A list of argc arguments to parse

inline const ParsedCommandLine &getParsedCommandLine() const#

Get a ParsedCommandLine option to inspect and use the command line arguments.

Returns

The processed command line object.

inline void set(const wchar_t *cmdLine)#

Set the command line to a new std::string (wide).

Parameters

cmdLine – The new (wide) std::string to set the command line to

inline void set(int argc, char **argv)#

Set the command line to a new list of arguments.

Parameters
  • argc – The number of arguments

  • argv – The list of arguments

inline void set(const char *cmdLine)#

Set the command line from a new std::string.

Parameters

cmdLine – The new std::string to set the command line to

inline void set(const CommandLineParser &cmdLine)#

Set the command line from another command line.

Parameters

cmdLine – Copy the data from another command line

inline void prefix(const wchar_t *cmdLine)#

Prepend data to the command line.

Parameters

cmdLine – A std::string containing the data to prepend to this command line

inline void prefix(int argc, char **argv)#

Prepend a new list of arguments to the command line.

Parameters
  • argc – The number of arguments

  • argv – The list of arguments

inline void prefix(const char *cmdLine)#

Prepend data from a std::string to the command line.

Parameters

cmdLine – The std::string whose data to prepend to the command line

inline void prefix(const CommandLineParser &cmdLine)#

Prepend the data from another command line.

Parameters

cmdLine – The command line from which to prepend the data

inline void append(const wchar_t *cmdLine)#

Append data to the command line.

Parameters

cmdLine – A std::string containing the data to append to this command line

inline void append(int argc, char **argv)#

Append a new list of arguments to the command line.

Parameters
  • argc – The number of arguments

  • argv – The list of arguments

inline void append(const char *cmdLine)#

Append data from a std::string to the command line.

Parameters

cmdLine – The std::string whose data to append to the command line

inline void append(const CommandLineParser &cmdLine)#

Append data from from another command line.

Parameters

cmdLine – The command line from which to append the data

Protected Functions

inline void parseCmdLine(const char *const cmdLine)#

Parse an entire std::string for command line data.

Parameters

cmdLine – The std::string containing the command line data

inline void parseArgV(char *arg)#

Parse a single argument as passed by the C/C++ style argc/argv command line format.

Parameters

arg – A single element of the “argv” array of char*

class ParsedCommandLine#

This class provides access to the command line arguments of a CommandLineParser. Its lifecycle is tied to the commandLineParser.

Public Types

typedef std::vector<Option> Options#

List of all options passed.

Public Functions

ParsedCommandLine() = default#

Default constructor for a command line parser.

inline ParsedCommandLine(int argc, char **argv)#

Constructor for a command line parser.

Parameters
  • argc – The number of arguments to parse

  • argv – A list of argc arguments to parse

inline const Options &getOptionsList() const#

Get all command line options as a list of name/value pairs (c-strings)

Returns

The command line options

inline bool hasOption(const char *name) const#

Query if a specific argument name exists (regardless of the presence of a value or not). For example, if the command line was “myapp.exe -fps”, the query hasOption(“fps”) will return true.

Parameters

name – The argument name to test

Returns

True if the argument name was passed through the command line , otherwise false.

inline bool getStringOption(const char *name, std::string &outValue) const#

Get an argument as a std::string value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument (verbatim). If the name was not present, it remains unchanged

Returns

True if the argument “name” was present, false otherwise

inline bool getStringOptionList(const char *name, std::vector<std::string> &outValues) const#

Get an argument assuming it is a comma-separated list of string values. Returns false and leaves the value unchanged if the value is not present, allowing easy use of default arguments. Otherwise, tokenizes and adds the values to the provided list of strings.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValues – A std::vector of strings where all values will be appended/

Returns

True if the argument name was present, false otherwise

inline bool getFloatOption(const char *name, float &outValue) const#

Get an argument’s value as a float value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument interpreted as a float. If the name was not present, or no value was passed with the name,it remains unchanged. If it was not representing a float, it silently returns zero (0.0).

Returns

True if the argument “name” was present, false otherwise

inline bool getIntOption(const char *name, int32_t &outValue) const#

Get an argument’s value as an integer value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument interpreted as an integer. If the name was not present, or no value was passed with the name, it remains unchanged. If it was not representing a float, it silently returns zero (0).

Returns

True if the argument “name” was present, false otherwise

inline bool getBoolOptionSetTrueIfPresent(const char *name, bool &outValue) const#

If a specific argument was present, set outValue to True.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – True if the argument “name” was present, otherwise unchanged

Returns

True if the argument “name” was present, false otherwise

inline bool getBoolOptionSetFalseIfPresent(const char *name, bool &outValue) const#

If a specific argument was present, set outValue to False.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – False if the argument “name” was present, otherwise unchanged

Returns

True if the argument “name” was present, false otherwise

struct Option#

A c-style std::string name-value pair that represents command line argument (arg: name, val: value)

Public Functions

inline bool operator==(const Option &rhs) const#

Equality.

Parameters

rhs – Right hand side of the operator

Returns

True if left and right side are equal, otherwise false

inline bool operator==(const char *rhs) const#

Equality to c-string.

Parameters

rhs – Right hand side of the operator

Returns

True if left and right side are equal, otherwise false

Public Members

const char *arg#

Argument name (i.e. -Width)

const char *val#

Argument value (i.e. 640)

CommandLineParser::ParsedCommandLine#

Nested Relationships#

This class is a nested type of CommandLineParser.

Nested Types#

Class Documentation#

class ParsedCommandLine

This class provides access to the command line arguments of a CommandLineParser. Its lifecycle is tied to the commandLineParser.

Public Types

typedef std::vector<Option> Options

List of all options passed.

Public Functions

ParsedCommandLine() = default

Default constructor for a command line parser.

inline ParsedCommandLine(int argc, char **argv)

Constructor for a command line parser.

Parameters
  • argc – The number of arguments to parse

  • argv – A list of argc arguments to parse

inline const Options &getOptionsList() const

Get all command line options as a list of name/value pairs (c-strings)

Returns

The command line options

inline bool hasOption(const char *name) const

Query if a specific argument name exists (regardless of the presence of a value or not). For example, if the command line was “myapp.exe -fps”, the query hasOption(“fps”) will return true.

Parameters

name – The argument name to test

Returns

True if the argument name was passed through the command line , otherwise false.

inline bool getStringOption(const char *name, std::string &outValue) const

Get an argument as a std::string value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument (verbatim). If the name was not present, it remains unchanged

Returns

True if the argument “name” was present, false otherwise

inline bool getStringOptionList(const char *name, std::vector<std::string> &outValues) const

Get an argument assuming it is a comma-separated list of string values. Returns false and leaves the value unchanged if the value is not present, allowing easy use of default arguments. Otherwise, tokenizes and adds the values to the provided list of strings.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValues – A std::vector of strings where all values will be appended/

Returns

True if the argument name was present, false otherwise

inline bool getFloatOption(const char *name, float &outValue) const

Get an argument’s value as a float value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument interpreted as a float. If the name was not present, or no value was passed with the name,it remains unchanged. If it was not representing a float, it silently returns zero (0.0).

Returns

True if the argument “name” was present, false otherwise

inline bool getIntOption(const char *name, int32_t &outValue) const

Get an argument’s value as an integer value. Returns false and leaves the value unchanged if the value is not present, allowing very easy use of default arguments.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – The value passed with the argument interpreted as an integer. If the name was not present, or no value was passed with the name, it remains unchanged. If it was not representing a float, it silently returns zero (0).

Returns

True if the argument “name” was present, false otherwise

inline bool getBoolOptionSetTrueIfPresent(const char *name, bool &outValue) const

If a specific argument was present, set outValue to True.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – True if the argument “name” was present, otherwise unchanged

Returns

True if the argument “name” was present, false otherwise

inline bool getBoolOptionSetFalseIfPresent(const char *name, bool &outValue) const

If a specific argument was present, set outValue to False.

Parameters
  • name – The command line argument (e.g. “-captureFrames”)

  • outValue – False if the argument “name” was present, otherwise unchanged

Returns

True if the argument “name” was present, false otherwise

struct Option

A c-style std::string name-value pair that represents command line argument (arg: name, val: value)

Public Functions

inline bool operator==(const Option &rhs) const

Equality.

Parameters

rhs – Right hand side of the operator

Returns

True if left and right side are equal, otherwise false

inline bool operator==(const char *rhs) const

Equality to c-string.

Parameters

rhs – Right hand side of the operator

Returns

True if left and right side are equal, otherwise false

Public Members

const char *arg

Argument name (i.e. -Width)

const char *val

Argument value (i.e. 640)

MakeFourCC#

Class Documentation#

template<char C1Name, char C2Name, char C3Name, char C4Name>
class MakeFourCC#

Make FourCC template.

Public Static Attributes

static const uint64_t FourCC = ((static_cast<uint32_t>(C1Name)) + (static_cast<uint32_t>(C2Name) << 8) + (static_cast<uint32_t>(C3Name) << 16) + (static_cast<uint32_t>(C4Name) << 24))#

The compile time generated FourCC value constructed using the template parameters.

UnicodeConversionError#

Inheritance Relationships#

Base Type#

  • public std::runtime_error

Class Documentation#

class UnicodeConversionError : public std::runtime_error#

A simple std::runtime_error wrapper for throwing exceptions when undertaking unicode conversions.

Public Functions

inline UnicodeConversionError(std::string message)#

Constructor.

Parameters

message – The error message to log.

UnicodeConverter#

Class Documentation#

class UnicodeConverter#

Use as a namespace (static functions only). Contains functionality to work with Unicode strings: Conversions between ASCII/UTF8/UTF16/UTF32, parse/count characters in Multibyte systems, validity queries.

Public Static Functions

static uint32_t unicodeCount(const utf8 *unicodeString)#

Count the number of characters in a unicode UTF-8 std::string.

Parameters

unicodeString – A UTF-8 std::string.

Returns

The number of characters unicodeString represents.

static uint32_t unicodeCount(const utf16 *unicodeString)#

Count the number of characters in a unicode UTF-16 std::string.

Parameters

unicodeString – A UTF-16 std::string.

Returns

The number of characters unicodeString represents.

static uint32_t unicodeCount(const utf32 *unicodeString)#

Count the number of characters in a unicode UTF-32 std::string.

Parameters

unicodeString – A UTF-32 std::string.

Returns

The number of characters unicodeString represents.

static void convertAsciiToUnicode(const char *asciiString, std::vector<utf8> &unicodeString)#

Convert an ASCII std::string to a UTF8 std::string.

Parameters
  • asciiString – An ASCII std::string

  • unicodeString – The resulting UTF-8 std::string stored as an std::vector<utf8>

static inline void convertAsciiToUnicode(const char *asciiString, std::vector<utf16> &unicodeString)#

Convert an ASCII std::string to a UTF-16 std::string.

Parameters
  • asciiString – An ASCII std::string

  • unicodeString – The resulting UTF-16 std::string stored as an std::vector<utf16>

static inline void convertAsciiToUnicode(const char *asciiString, std::vector<utf32> &utf32StringOut)#

Convert an ASCII std::string to a UTF-32 std::string.

Parameters
  • asciiString – An ASCII std::string

  • utf32StringOut – The resulting UTF-32 std::string stored as an std::vector<utf32>

static void convertUTF8ToUTF16(const utf8 *utf8String, std::vector<utf16> &utf16StringOut)#

Convert a UTF-8 std::string to a UTF-16 std::string.

Parameters
  • utf8String – A UTF-8 std::string

  • utf16StringOut – The resulting UTF-16 std::string stored as an std::vector<utf16>

static void convertUTF8ToUTF32(const utf8 *utf8String, std::vector<utf32> &utf32StringOut)#

Convert a UTF-8 std::string to a UTF-32 std::string.

Parameters
  • utf8String – A UTF-8 std::string

  • utf32StringOut – The resulting UTF-32 std::string stored as an std::vector<utf32>

Returns

True for Success or false for error.

static void convertUTF16ToUTF8(const utf16 *utf16String, std::vector<utf8> &utf8StringOut)#

Convert a UTF-16 std::string to a UTF-8 std::string.

Parameters
  • utf16String – A UTF-16 std::string

  • utf8StringOut – The resulting UTF-8 std::string stored as an std::vector<utf8>

Returns

True for Success or false for error.

static void convertUTF16ToUTF32(const utf16 *utf16String, std::vector<utf32> &utf32StringOut)#

Convert a UTF-16 std::string to a UTF-32 std::string.

Parameters
  • utf16String – A UTF-16 std::string

  • utf32StringOut – The resulting UTF-32 std::string stored as an std::vector<utf32>

Returns

True for Success or false for error.

static void convertUTF32ToUTF8(const utf32 *utf32String, std::vector<utf8> &utf8StringOut)#

Convert a UTF-32 std::string to a UTF-8 std::string.

Parameters
  • utf32String – A UTF-32 std::string

  • utf8StringOut – The resulting UTF-8 std::string stored as an std::vector<utf8>

static void convertUTF32ToUTF16(const utf32 *utf32String, std::vector<utf16> &utf16StringOut)#

Convert a UTF-32 std::string to a UTF-16 std::string.

Parameters
  • utf32String – A UTF-32 std::string

  • utf16StringOut – The resulting UTF-16 std::string stored as an std::vector<utf16>

static bool isValidUnicode(const utf8 *unicodeString)#

Check if a std::string contains only valid UTF-8 characters.

Parameters

unicodeString – A UTF-8 std::string

Returns

True if the std::string does not contains any characters that are not valid UTF-8, false otherwise

static bool isValidUnicode(const utf16 *unicodeString)#

Check if a std::string contains only valid UTF-16 characters.

Parameters

unicodeString – A UTF-16 std::string

Returns

True if the std::string does not contains any characters that are not valid UTF-16, false otherwise

static bool isValidUnicode(const utf32 *unicodeString)#

Check if a std::string contains only valid UTF-32 characters.

Parameters

unicodeString – A UTF-32 std::string

Returns

True if the std::string does not contains any characters that are not valid UTF-32, false otherwise

static bool isAsciiChar(const char *asciiString)#

Check if a std::string only contains valid Ascii-7 characters.

Parameters

asciiString – A c-style std::string

Returns

True if the std::string only contains values in the range 0..127 (low ascii), False otherwise

static bool isAsciiChar(char asciiChar)#

Check if a character is valid Ascii-7.

Parameters

asciiChar – A character

Returns

True if the std::string only contains values in the range 0..127 (low ascii), False otherwise

AndroidAssetStream#

Inheritance Relationships#

Base Type#

Class Documentation#

class AndroidAssetStream : public pvr::Stream#

A Stream implementation that is used to access resources built in an Android package (apk).

This Stream abstraction allows the user to easily access the Resources embedded in an Android .apk package. This is the default way resources are packed in the Android version of the PowerVR Examples.

Public Functions

inline AndroidAssetStream(AAssetManager *assetManager, const std::string &filename)#

Constructor from Android NDK Asset manager and a filename.

Parameters
  • assetManager – The Android Asset manager object the app will use

  • filename – The file (asset) to open

inline ~AndroidAssetStream()#

Destructor. Releases this object.

virtual void _read(size_t size, size_t count, void *const outData, size_t &outElementsRead) const override#
virtual void _write(size_t size, size_t count, const void *data, size_t &dataWritten) override#
virtual void _seek(long offset, SeekOrigin origin) const override#

Override this function to implement a random access stream. After successful call, subsequent operation will happen in the specified point.

Parameters
  • offset – The offset to seec from “origin”

  • origin – Beginning of stream, End of stream or Current position

virtual uint64_t _getPosition() const override#
virtual uint64_t _getSize() const override#
void open() const#
void close()#
inline AAssetManager *getAndroidAssetManager()#

Retrieves the current android asset manager.

Returns

The current android asset manager

BufferStream#

Inheritance Relationships#

Base Type#

Derived Type#

Class Documentation#

class BufferStream : public pvr::Stream#

This class is used to access a block of memory as a Stream.

Subclassed by pvr::WindowsResourceStream

Public Functions

inline BufferStream(const std::string &fileName, void *buffer, size_t bufferSize)#

Create a BufferStream from a writable buffer and associate it with an (arbitrary) filename.

Parameters
  • fileName – The created stream will have this filename. Arbitrary - not used to access anything.

  • buffer – Pointer to the memory that this stream will be used to access. Must be kept live from the point the stream is opened until the stream is closed

  • bufferSize – The size, in bytes, of the buffer

inline BufferStream(const std::string &fileName, const void *buffer, size_t bufferSize)#

Create a BufferStream from a read only buffer and associate it with an (arbitrary) filename. Read only.

Parameters
  • fileName – The created stream will have this filename. Arbitrary - not used to access anything.

  • buffer – Pointer to the memory that this stream will be used to access. Must be kept live from the point the stream is opened until the stream is closed

  • bufferSize – The size, in bytes, of the buffer

Protected Functions

inline explicit BufferStream(const std::string &resourceName)#

Used by resource streams to .

Parameters

resourceName – A resource identifier (conceptually, a “Filename” without a file)

Protected Attributes

const void *_originalData#

The original pointer of the memory this stream accesses.

mutable const void *_currentPointer#

Pointer to the current position in the stream.

mutable size_t _bufferSize#

The size of this stream.

mutable size_t _bufferPosition#

Offset of the current position in the stream.

DisplayAttributes#

Class Documentation#

class DisplayAttributes#

Contains display configuration information (width, height, position, title, bpp etc.).

Public Types

enum [anonymous]#

Unnamed enum for constants.

Values:

enumerator PosDefault#

Sentinel value for Default position.

Public Functions

inline DisplayAttributes()#
inline bool isDisplayPortrait() const#

Checks if the screen is rotated.

Returns

True if the screen is Portrait, otherwise (if landscape) false .

inline bool isFullScreen() const#

Checks if full screen.

Returns

True if full screen, otherwise false.

Public Members

std::string windowTitle#

Title of the application window.

uint32_t width#

Width of the rendering area (default 1280)

uint32_t height#

Height of the rendering (default 800)

uint32_t x#

Horizontal offset of the bottom-left area (default 0)

uint32_t y#

Vertical offset of the bottom-left area (default 0)

uint32_t depthBPP#

Number of bits per pixel in the depth buffer (default 16)

uint32_t stencilBPP#

Number of bits per pixel of the stencil buffer (default 0: no stencil)

uint32_t redBits#

Number of bits of the red channel of the framebuffer (default 8)

uint32_t greenBits#

Number of bits of the green channel of the framebuffer (default 8)

uint32_t blueBits#

Number of bits of the blue channel of the framebuffer (default 8)

uint32_t alphaBits#

Number of bits of the alpha channel of the framebuffer (default 8)

uint32_t aaSamples#

Number of (antialiasing) samples of the framebuffer (default 0)

uint32_t configID#

Deprecated: EGL config id.

VsyncMode vsyncMode#

Type of syncrhonization mode (default On: Vsync)

int32_t contextPriority#

Context priority, if supported (default High)

int32_t swapLength#

Swapchain length, AKA number of framebuffer images (default 0: Minimum required for technique)

bool forceColorBPP#

Require that the color channels of the framebuffer are exactly as requested in redBits/blueBits/greenBits/alphaBits (default false)

bool fullscreen#

If true, application will be fullscreen (if supported). If false, application will be windowed (if supported). (default false)

bool frameBufferSrgb#

If true and supported, attempt to use an sRGB framebuffer format (default false)

FileEOFError#

Inheritance Relationships#

Base Type#

Class Documentation#

class FileEOFError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when attempting to read past the End Of File.

Public Functions

inline explicit FileEOFError(const Stream &stream)#

Constructor.

Parameters

stream – The stream being used.

inline FileEOFError(const Stream &stream, std::string message)#

Constructor.

Parameters
  • stream – The stream being used.

  • message – A message to log alongside the exception message.

inline explicit FileEOFError(std::string filenameOrMessage)#

Constructor.

Parameters

filenameOrMessage – A message to log alongside the exception message.

inline FileEOFError(std::string filename, std::string message)#

Constructor.

Parameters
  • filename – The filenae of the file being used.

  • message – A message to log alongside the exception message.

FileIOError#

Inheritance Relationships#

Base Type#

Class Documentation#

class FileIOError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when undertaking File IO operations.

Public Functions

inline explicit FileIOError(const Stream &stream)#

Constructor.

Parameters

stream – The stream being used.

inline FileIOError(const Stream &stream, std::string message)#

Constructor.

Parameters
  • stream – The stream being used.

  • message – A message to log alongside the exception message.

inline explicit FileIOError(std::string filenameOrMessage)#

Constructor.

Parameters

filenameOrMessage – A message to log alongside the exception message.

inline FileIOError(std::string filename, std::string message)#

Constructor.

Parameters
  • filename – The filenae of the file being used.

  • message – A message to log alongside the exception message.

FileNotFoundError#

Inheritance Relationships#

Base Type#

  • public std::runtime_error

Class Documentation#

class FileNotFoundError : public std::runtime_error#

A simple std::runtime_error wrapper for throwing exceptions when file not found errors occur.

Public Functions

inline explicit FileNotFoundError(const Stream &stream)#

Constructor.

Parameters

stream – The stream being used.

inline FileNotFoundError(const Stream &stream, std::string message)#

Constructor.

Parameters
  • stream – The stream being used.

  • message – A message to log alongside the exception message.

inline explicit FileNotFoundError(std::string filenameOrMessage)#

Constructor.

Parameters

filenameOrMessage – A message to log alongside the exception message.

inline FileNotFoundError(std::string filename, std::string message)#

Constructor.

Parameters
  • filename – The filenae of the file being used.

  • message – A message to log alongside the exception message.

FilePath#

Inheritance Relationships#

Base Type#

  • public std::string

Class Documentation#

class FilePath : public std::string#

Filepath represents a Path + Filename + Extension.

Public Functions

inline FilePath()#

Creates an empty Filepath object.

inline FilePath(const std::string &str)#

Creates an Filepath object from a filename.

Parameters

str – Creates a filepath object of this path.

inline std::string getFileExtension() const#

Get a std::string containing the Extension of the filepath.

Returns

The file extension of the path

inline std::string getDirectory() const#

Get a std::string containing the Directory of the filepath.

Returns

The directory part of the path

inline std::string getFilename() const#

Get a std::string containing the Filename+Extension of the filepath.

Returns

The filename part of the path (including the extension)

inline std::string getFilenameNoExtension() const#

Get a std::string containing the Filename (without extension) of the filepath.

Returns

The filename part of the path (without the extension)

Public Static Functions

static inline char getDirectorySeparator()#

Get the directory separator used by the current platform.

Returns

The platform specific directory separator (usually “\” or “/”

FileStream#

Inheritance Relationships#

Base Type#

Class Documentation#

class FileStream : public pvr::Stream#

A FileStream is a Stream that is used to access a File in the filesystem of the platform.

Public Functions

inline FileStream(const std::string &filePath, const std::string &flags, bool errorOnFileNotFound = true)#

Create a new filestream of a specified file.

Possible flags: ‘r’:read,’w’:truncate/write, ‘a’:append/write, r+: read/write, w+:truncate/read/write, a+:append/read/write

Parameters
  • filePath – The path of the file. Can be in any format the operating system understands (absolute, relative etc.)

  • flags – fopen-style flags.

  • errorOnFileNotFound – OPTIONAL. Set this to false to avoid an exception when the file is not found. If set to false, always check isReadable() or isWritable before using. Otherwise, a returned stream will always be opened with the correct flags.

inline ~FileStream()#

Public Static Functions

static inline std::unique_ptr<Stream> createFileStream(const char *filename, const char *flags, bool errorOnFileNotFound = true)#

Create a new file stream from a filename.

Flags correspond the C++ standard for fopen r: Read (read from beginning, preserve contents, fail if not exist) w: Write (write from beginning, destroy contents, create if not exist) a: Append (write to end only (regardles of file pointer position), preserve contents, create if not exist) r+: Read+ (read/write from start, preserve contents, fail if not exist) w+: Write+ (read/write from start, destroy contents, create if not exist) a+: Append+ (read/write from end (write only happens to end), preserve contents, create if not exist) b: Additional flag: Do no special handling of line break / form feed characters

Parameters
  • filename – The filename to create a stream for

  • flags – The C++ open flags for the file (“r”, “w”, “a”, “r+”, “w+”, “a+” and optionally “b”), see C++ standard.

  • errorOnFileNotFound – OPTIONAL. Set this to false to avoid an error when the file is not found.

Returns

Return a valid file stream, else Return null if it fails

static inline std::unique_ptr<Stream> createFileStream(const std::string &filename, const char *flags, bool errorOnFileNotFound = true)#

Create a new file stream from a filename.

Flags correspond the C++ standard for fopen r: Read (read from beginning, preserve contents, fail if not exist) w: Write (write from beginning, destroy contents, create if not exist) a: Append (write to end only (regardles of file pointer position), preserve contents, create if not exist) r+: Read+ (read/write from start, preserve contents, fail if not exist) w+: Write+ (read/write from start, destroy contents, create if not exist) a+: Append+ (read/write from end (write only happens to end), preserve contents, create if not exist) b: Additional flag: Do no special handling of line break / form feed characters

Parameters
  • filename – The filename to create a stream for

  • flags – The C++ open flags for the file (“r”, “w”, “a”, “r+”, “w+”, “a+” and optionally “b”), see C++ standard.

  • errorOnFileNotFound – OPTIONAL. Set this to false to avoid an error when the file is not found.

Returns

Return a valid file stream, else Return null if it fails

Protected Attributes

mutable FILE *_file#

The underlying C FILE object.

std::string _flags#

The C flags used when opening the file.

bool _errorOnFileNotFound#

True to error when files are not found otherwise False to avoid an exception when the file is not found.

FreeValueView#

Inheritance Relationships#

Derived Types#

Class Documentation#

class FreeValueView#

Represents a runtime-known number of elements of a runtime-known type, with functions to handle and convert them. Very commonly used to dynamically represent data that will eventually need to be used by the GPU, such as uniforms, vectors and matrices. Does not contain methods to actually be populated, as this should be done through subclasses.

Subclassed by pvr::FreeValue, pvr::TypedMem

Public Functions

inline FreeValueView()#

Constructor. Constructs and empty value.

inline GpuDatatypes dataType() const#

Get the datatype of the value contained. “None” means unformatted data, in which case ArraySize represents the number of bytes.

Returns

The datatype of this value.

inline bool isDataCompatible(const FreeValueView &rhs) const#

Check if two free values only differ in value (i.e. they are of the same type and elements).

Parameters

rhs – The value against which to compare

Returns

True if datatype and arrayelements are the same between this and rhs, otherwise false.

inline uint64_t dataSize() const#

Size of the data contained.

Returns

The size of data contained.

inline uint32_t arrayElements() const#

Size of the data contained. For unformatted data (Datatype==None) this is the total bytes contained.

Returns

The size of data contained.

inline void *raw(uint32_t arrayIndex)#

Get a pointer to the raw data value at the specified index.

Parameters

arrayIndex – The array index of which to take the pointer

Returns

Pointer to the raw value.

inline const void *raw(uint32_t arrayIndex) const#

Get a pointer to the raw data value at the specified index.

Parameters

arrayIndex – The array index of which to take the pointer

Returns

Pointer to the raw value.

inline void *raw()#

Get a pointer to the raw data value.

Returns

Pointer to the raw value.

inline const void *raw() const#

Get a pointer to the raw data value.

Returns

Pointer to the raw value.

template<typename Type_>
inline Type_ *rawAs()#

Get a pointer to the raw data value as a specified type.

Template Parameters

Type_ – The type as which the data are interpreted

Returns

Pointer to the raw value.

template<typename Type_>
inline const Type_ *rawAs() const#

Get a pointer to the data value as a specified type.

Template Parameters

Type_ – The type as which the data are interpreted

Returns

Pointer to the raw value.

inline float *rawFloats()#

Get a pointer to the data value as (an array of) 32 bit floating point numbers.

Returns

Pointer to the data as float*.

inline const float *rawFloats() const#

Get a pointer to the data value as (an array of) 32 bit floating point numbers.

Returns

Pointer to the data as float*.

inline int32_t *rawInts()#

Get a pointer to the data value as (an array of) 32 bit integers.

Returns

Pointer to the data as int*.

inline const int32_t *rawInts() const#

Get a pointer to the data value as (an array of) 32 bit integers.

Returns

Pointer to the data as int*.

inline unsigned char *rawChars()#

Get a pointer to the data value as (an array of) unsigned chars.

Returns

Pointer to the data as unsigned char*.

inline const unsigned char *rawChars() const#

Get a pointer to the data value as (an array of) unsigned chars.

Returns

Pointer to the data as unsigned char*.

template<typename Type_>
inline Type_ &interpretValueAs(uint32_t entryIndex = 0)#

Interpret the value as (an array of) a specified type and retrieve the item at a specific position.

Template Parameters

Type_ – The type as which the value is interpreted

Parameters

entryIndex – If an array, which item to retrieve (default 0)

Returns

A value of type Type_ at index entryIndex

template<typename Type_>
inline const Type_ &interpretValueAs(uint32_t entryIndex = 0) const#

Interpret the value as (an array of) a specified type and retrieve the item at a specific position.

Template Parameters

Type_ – The type as which the value is interpreted

Parameters

entryIndex – If an array, which item to retrieve (default 0)

Returns

A value of type Type_ at index entryIndex

Protected Attributes

unsigned char *value_#

Dynamically allocated, data is carried here.

uint32_t arrayElements_#

Number of array elements.

GpuDatatypes dataType_#

Semantic data type.

FPSCamera#

Class Documentation#

class FPSCamera#

A simple first person camera implementation.

Public Functions

inline FPSCamera()#

Constructor.

inline void moveZ(float z)#

Move camera on its local z axis.

Parameters

z – distance to move

inline void moveX(float x)#

Move camera on its local x axis.

Parameters

x – distance to move

inline void set(const glm::vec3 &camPos, float yaw, float pitch)#

Set camera new world position and orientation.

Parameters
  • camPos – Camera position

  • yaw – Camera yaw

  • pitch – Camera pitch

inline void setPosition(const glm::vec3 &camPos)#

Set camera new world position.

Parameters

camPos – Camera position

inline void setOrientation(float yaw, float pitch)#

Set camera new orientation.

Parameters
  • yaw – Camera yaw

  • pitch – Camera pitch

inline void yaw(float yaw)#

Set camera new yaw.

Parameters

yaw – Camera yaw

inline void reset(const glm::vec3 &pos, float yaw, float pitch)#

Reset camera position and orientation.

Parameters
  • pos – Camera position

  • yaw – Camera yaw

  • pitch – Camera pitch

inline void pitch(float pitch)#

Set camera orientation.

Parameters

pitch – Camera pitch

inline void orientate(float yaw, float pitch)#

Set camera orientation.

Parameters
  • yaw – Camera yaw

  • pitch – Camera pitch

inline const glm::vec3 &getPosition()#

Get camera position.

Returns

Camera position

inline glm::mat4 getViewMatrix() const#

Get camera view matrix.

Returns

Camera view matrix

GeneratePixelType1#

Class Documentation#

template<char C1Name, uint8_t C1Bits>
class GeneratePixelType1#

Use this template class to generate a 1 channel PixelID.

Use this template class to generate a 1 channel PixelID (64-bit identifier for a pixel format used throughout PVR Assets from the channel information. Simply define the template parameters for your class and get the ID member. EXAMPLE USE:

uint64_t myPixelID = GeneratePixelType1<'r',8&gt::ID

Param C1Name

The Name of the 1st channel (poss. values ‘r’,’a’,’l’,0)

Param C1Bits

The number of bits of the 1st channel

Public Static Attributes

static const uint64_t ID = (static_cast<uint64_t>(C1Name) + (static_cast<uint64_t>(0) << 8) + (static_cast<uint64_t>(0) << 16) + (static_cast<uint64_t>(0) << 24) + (static_cast<uint64_t>(C1Bits) << 32) + (static_cast<uint64_t>(0) << 40) + (static_cast<uint64_t>(0) << 48) + (static_cast<uint64_t>(0) << 56))#

A 64 bit integer uniquely representing this pixel type.

GeneratePixelType2#

Class Documentation#

template<char C1Name, char C2Name, uint8_t C1Bits, uint8_t C2Bits>
class GeneratePixelType2#

Use this template class to generate a 2 channel PixelID.

Use this template class to generate a 2 channel PixelID (64-bit identifier for a pixel format used throughout PVR Assets from the channel information. Simply define the template parameters for your class and get the ID member. EXAMPLE USE:

uint64_t myPixelID = GeneratePixelType2<'r','a',8,8&gt::ID

Param C1Name

The Name of the 1st channel (poss. values ‘r’,’g’,’a’,’l’,0)

Param C2Name

The Name of the 2nd channel (poss. values ‘r’,’g’,’a’,’l’,0)

Param C1Bits

The number of bits of the 1st channel

Param C2Bits

The number of bits of the 2nd channel

Public Static Attributes

static const uint64_t ID = (static_cast<uint64_t>(C1Name) + (static_cast<uint64_t>(C2Name) << 8) + (static_cast<uint64_t>(0) << 16) + (static_cast<uint64_t>(0) << 24) + (static_cast<uint64_t>(C1Bits) << 32) + (static_cast<uint64_t>(C2Bits) << 40) + (static_cast<uint64_t>(0) << 48) + (static_cast<uint64_t>(0) << 56))#

A 64 bit integer uniquely representing this pixel type.

GeneratePixelType3#

Class Documentation#

template<char C1Name, char C2Name, char C3Name, uint8_t C1Bits, uint8_t C2Bits, uint8_t C3Bits>
class GeneratePixelType3#

Use this template class to generate a 3 channel PixelID.

Use this template class to generate a 3 channel PixelID (64-bit identifier for a pixel format used throughout PVR Assets from the channel information. Simply define the template parameters for your class and get the ID member. EXAMPLE USE:

uint64_t myPixelID = GeneratePixelType3<'r','g','b',8,8,8&gt::ID

Param C1Name

The Name of the 1st channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C2Name

The Name of the 2nd channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C3Name

The Name of the 3rd channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C1Bits

The number of bits of the 1st channel

Param C2Bits

The number of bits of the 2nd channel

Param C3Bits

The number of bits of the 3rd channel

Public Static Attributes

static const uint64_t ID = (static_cast<uint64_t>(C1Name) + (static_cast<uint64_t>(C2Name) << 8) + (static_cast<uint64_t>(C3Name) << 16) + (static_cast<uint64_t>(0) << 24) + (static_cast<uint64_t>(C1Bits) << 32) + (static_cast<uint64_t>(C2Bits) << 40) + (static_cast<uint64_t>(C3Bits) << 48) + (static_cast<uint64_t>(0) << 56))#

A 64 bit integer uniquely representing this pixel type.

GeneratePixelType4#

Class Documentation#

template<char C1Name, char C2Name, char C3Name, char C4Name, uint8_t C1Bits, uint8_t C2Bits, uint8_t C3Bits, uint8_t C4Bits>
class GeneratePixelType4#

Use this template class to generate a 4 channel PixelID.

Use this template class to generate a 4 channel PixelID (64-bit identifier for a pixel format used throughout PVR Assets from the channel information. Simply define the template parameters for your class and get the ID member. EXAMPLE USE:

uint64_t myPixelID = GeneratePixelType4<'b','g','r','a',8,8,8,8&gt::ID;

Param C1Name

The Name of the 1st channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C2Name

The Name of the 2nd channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C3Name

The Name of the 3rd channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C4Name

The Name of the 4th channel (poss. values ‘r’,’g’,’b’,’a’,’l’,0)

Param C1Bits

The number of bits of the 1st channel

Param C2Bits

The number of bits of the 2nd channel

Param C3Bits

The number of bits of the 3rd channel

Param C4Bits

The number of bits of the 4th channel

Public Static Attributes

static const uint64_t ID = (static_cast<uint64_t>(C1Name) + (static_cast<uint64_t>(C2Name) << 8) + (static_cast<uint64_t>(C3Name) << 16) + (static_cast<uint64_t>(C4Name) << 24) + (static_cast<uint64_t>(C1Bits) << 32) + (static_cast<uint64_t>(C2Bits) << 40) + (static_cast<uint64_t>(C3Bits) << 48) + (static_cast<uint64_t>(C4Bits) << 56))#

A 64 bit integer uniquely representing this pixel type.

HashCompileTime#

Class Documentation#

template<unsigned char... chars>
class HashCompileTime#

Template specialization for unsigned char values.

Public Static Attributes

static const uint32_t value = hasher_helper<2166136261U, chars...>::value#

A hashed value.

IndexOutOfRange#

Inheritance Relationships#

Base Type#

Class Documentation#

class IndexOutOfRange : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when attempting to use index out of range.

Public Functions

inline IndexOutOfRange(std::string message)#

Constructor.

Parameters

message – A message to log.

inline IndexOutOfRange(std::string message, size_t index, size_t maxIndex)#

Constructor.

Parameters
  • message – A message to log.

  • index – The index which was out of range.

  • maxIndex – The maximum index supported.

inline IndexOutOfRange()#

Constructor.

InvalidArgumentError#

Inheritance Relationships#

Base Type#

Class Documentation#

class InvalidArgumentError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when invalid arguments are provided.

Public Functions

inline InvalidArgumentError(std::string argument, std::string message)#

Constructor.

Parameters
  • argument – The invalid argument.

  • message – A message to log.

inline InvalidArgumentError(std::string argument)#

Constructor.

Parameters

argument – The invalid argument.

InvalidDataError#

Inheritance Relationships#

Base Type#

Class Documentation#

class InvalidDataError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when invalid data is provided.

Public Functions

inline InvalidDataError(std::string message)#

Constructor.

Parameters

message – A message to log.

inline InvalidDataError()#

Constructor.

InvalidOperationError#

Inheritance Relationships#

Base Type#

Class Documentation#

class InvalidOperationError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when invalid operations are attempted.

Public Functions

inline InvalidOperationError(std::string message)#

Constructor.

Parameters

message – A message to log.

inline InvalidOperationError()#

Constructor.

IAssetProvider#

Class Documentation#

class IAssetProvider#

The IAssetProvider interface marks a class that provides the getAssetStream function to load assets in a platform independent way.

Public Functions

virtual std::unique_ptr<Stream> getAssetStream(const std::string &filename, bool logErrorOnNotFound = true) const = 0#

Create a Stream from the provided filename. The actual source of the stream is abstracted (filesystem, resources etc.).

If the file is not found, this function will return a NULL function pointer, and log an error. In cases where file not found is to be expected (for example, testing for different files due to convention), set logErrorOnNotFound to false to avoid cluttering the Log.

Parameters
  • filename – The name of the asset. May contain a path or not. Platform-specific paths and built-in resources should be searched.

  • logErrorOnNotFound – OPTIONAL. Set this to false to avoid logging an error when the file is not found.

Returns

A pointer to a Stream. NULL if the asset is not found.

LockedQueue#

Class Documentation#

template<typename T>
class LockedQueue#

A simple adapter for the BlockingConcurrentQueue that simplifies common use cases.

Public Types

typedef moodycamel::ProducerToken ProducerToken#

Producer token.

typedef moodycamel::ConsumerToken ConsumerToken#

Consumer token.

Public Functions

inline LockedQueue()#

Constructor.

inline ConsumerToken getConsumerToken()#

Get a consumer token for this queue.

Returns

A consumer token

inline ProducerToken getProducerToken()#

Get a producer token for this queue.

Returns

A producer token

inline void produce(const T &item)#

Produce: Enqueue an item in the queue.

Parameters

item – The item that will be enqueued. Will be copied into the queue.

inline void produce(ProducerToken &token, const T &item)#

Produce: Enqueue an item in the queue, using a producer token. Will generally be more efficient to use tokens.

Parameters
  • token – The ProducerToken. May be used to create “private” subqueues to avoid thread contention.

  • item – The item that will be enqueued. Will be copied into the queue.

template<typename iterator>
inline void produceMultiple(iterator items, uint32_t numItems)#

Produce: Enqueue multiple items in the queue. Will be very efficient.

Parameters
  • items – A type that will act as an iterator. Typically a C-pointer

  • numItems – The number if items to enqueue from items

Template Parameters

iterator – Type Inferred: The type of the iterator items

template<typename iterator>
inline void produceMultiple(ProducerToken &token, iterator items, uint32_t numItems)#

Produce: Enqueue multiple items in the queue. Will be very the most efficient way of enqueueing multiple items.

Parameters
  • items – A type that will act as an iterator. Typically a C-pointer

  • numItems – The number if items to enqueue from items

  • token – The ProducerToken. May be used to create “private” subqueues to avoid thread contention.

Template Parameters

iterator – Type Inferred: The type of the iterator items

inline bool tryUnblockAndReturnTrueIfUnblocked()#
inline bool consume(T &item)#

Blocking consume: Dequeue one item from the queue. If returns false, the queue was finishing.

Parameters

item – Output variable: The item that was dequeued.

Returns

True if an item was dequeued, otherwise false

inline bool consume(ConsumerToken &token, T &item)#

Blocking consume: Dequeue one item from the queue. If returns false, the queue was finishing.

Parameters
  • item – Output variable: The item that was dequeued.

  • token – A ConsumerToken. May be used to reduce thread contention.

Returns

True if an item was dequeued, otherwise false

template<typename iterator>
inline size_t consumeMultiple(iterator firstItem, uint32_t maxItems)#

Blocking consume multiple: Dequeue multiple items from the queue. Will return at least one item, unless the queue was closing down. If returns 0 items, the queue was finishing.

Parameters
  • firstItem – Output iterator variable: The items will be dequeued using this iterator. Usually a C-pointer

  • maxItems – The maximum number of items that will be dequeued

Template Parameters

iterator – Type Inferred: The type of the iterator items

Returns

The number of items dequeued. Will only be 0 if the queue was finishing.

template<typename iterator>
inline size_t consumeMultiple(ConsumerToken &token, iterator firstItem, uint32_t maxItems)#

Blocking consume multiple with token: Dequeue multiple items from the queue. Will return at least one item, unless the queue was closing down. If returns 0 items, the queue was finishing.

Parameters
  • firstItem – Output iterator variable: The items will be dequeued using this iterator. Usually a C-pointer

  • maxItems – The maximum number of items that will be dequeued

  • token – A ConsumerToken. May be used to reduce thread contention.

Template Parameters

iterator – Type Inferred: The type of the iterator items

Returns

The number of items dequeued. Will only be 0 if the queue was finishing.

inline void unblockOne()#

Release one consumer from the queue. Used to release waiting threads when shutting down.

inline void unblockMultiple(uint16_t numUnblock)#

Release multiple consumers from the queue. Used to release waiting threads when shutting down.

Parameters

numUnblock – The number of consumers to unblock

inline void reset()#

Only call on an empty, otherwise behaviour is undefined.

inline bool isEmpty()#

Check if the queue is (tentatively) empty - this is an approximation due to multithreading. (To get a precise number the queue should have be blocked for all access and until it was used.)

Returns

True if the thread is empty, otherwise false

inline size_t itemsRemainingApprox()#

Get the number of (tentative) items in the queue - this is an approximation due to multithreading. (To get a precise number the queue should have be blocked for all access and until it was used.)

Returns

The number of produced items

inline void waitUntilEmpty()#

Always call this after you stop enqueueing items. Waits for all consumers to finish consuming, and then signals the queue to finish (unblocks all consumers on an empty queue)

inline void done()#

Immediately signal all consumers to unblock and stop, refusing to enqueue any more items. The queue will be inconsistent afterwards and should be destroyed.

OperationFailedError#

Inheritance Relationships#

Base Type#

Class Documentation#

class OperationFailedError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when operations fail.

Public Functions

inline OperationFailedError(std::string message)#

Constructor.

Parameters

message – A message to log.

inline OperationFailedError()#

Constructor.

PaletteExpander#

Class Documentation#

class PaletteExpander#

Internally used by some texture readers.

Public Functions

PaletteExpander(const uint8_t *paletteData, uint32_t paletteSize, uint32_t bytesPerEntry)#

Constructor. Initialized with new palette data.

Parameters
  • paletteData – The palette data

  • paletteSize – The size of the palete data

  • bytesPerEntry – The number of bytes each entry takes

void getColorFromIndex(uint32_t index, unsigned char *outputData) const#

Gets a color for the specified index.

Parameters
  • index – The index of the entry to retrieve. Throws if overruns the palette

  • outputData – A pointer to the palette color for the specified index is returned here

PixelFormat#

Nested Relationships#

Nested Types#

Class Documentation#

class PixelFormat#

The PixelFormat class fully defines a Pixel Format (channels, format, compression, bit width etc.).

Public Functions

inline PixelFormat()#

Default Constructor. Creates an empty pixeltype.

inline PixelFormat(uint64_t type)#

Initializes a new pixel type from a 64 bit Integer value.

Parameters

type – Pixel format type

Returns

Return a new PixelFormat

inline PixelFormat(CompressedPixelFormat type)#

Initializes a new pixel type from a CompressedPixelFormat type.

Parameters

type – Compressed Pixel Format type

Returns

Return a new PixelFormat

inline PixelFormat(uint8_t C1Name, uint8_t C2Name, uint8_t C3Name, uint8_t C4Name, uint8_t C1Bits, uint8_t C2Bits, uint8_t C3Bits, uint8_t C4Bits)#

Construct a Pixel format from the given channels which takes up to 4 characters (CnName) and 4 values (CnBits). Any unused channels should be set to 0.

For example: PixelFormat(‘r’,’g’,’b’,0,8,8,8,0)

Parameters
  • C1Name – channel 1 name

  • C2Name – channel 2 name

  • C3Name – channel 3 name

  • C4Name – channel 4 name

  • C1Bits – number of bits in channel 1

  • C2Bits – number of bits in channel 2

  • C3Bits – number of bits in channel 3

  • C4Bits – number of bits in channel 4

inline char getChannelContent(uint8_t channel) const#

Returns the “content”, or “name” of a channel, as a character. (normally r,g,b,a,d,s,l,i)

For example, the format d24s8 would return ‘d’ for channel:0, ‘s’ for channel:1, NULL otherwise

Parameters

channel – The zero-indexed channel of the texture(0, 1, 2, 3)

Returns

Return a character describing the channel contents

inline uint8_t getChannelBits(uint8_t channel) const#

Get the width of the specified channel.

Parameters

channel – The zero-indexed channel of the texture(0, 1, 2, 3)

Returns

Return The number of bits the specified channel takes up.

inline uint8_t getNumChannels() const#

Get the number of channels in the format.

Returns

Return the number of channels in the format.

inline bool isCompressedFormat() const#

Returns true if the format is a “normal” compressed format, i.e. the format is not regular (channel type/ bitrate combination), but excludes some special packed formats that are not compressed, such as shared exponent formats.

Returns

True if it is a compressed format, otherwise false

inline uint8_t isIrregularFormat() const#

Returns if the format is some kind of directly supported format that is not regular (i.e. channel type/ channel bitrate combination). I.e. returns true if the format is any of the formats described in the supported “compressed” formats enumeration.

Returns

True if it is a “simple”, “regular” format (i.e. 1-4 channels of some bit width), i.e. neither a “compressed” format nor a “special” format such as shared exponents etc.

inline uint64_t getPixelTypeId() const#

Get the pixel type id.

Returns

Return the pixel type id

inline const uint8_t *getPixelTypeChar() const#

Get a const pointer to the pixel type char.

Returns

Return a const pointer to the pixel type char

inline uint8_t *getPixelTypeChar()#

Get a pointer to the pixel type char.

Returns

Return a pointer to the pixel type char

inline LowHigh getPart() const#

Get the pixel format’s low and high part.

Returns

Return pixel format’s low and high part

inline uint8_t getBitsPerPixel() const#

Get the number of bits per pixel.

Returns

Return the number of bits per pixel

inline bool operator==(const PixelFormat &rhs) const#

operator==, validate if a given pixel format is same as this.

Parameters

rhs – pixel format to compare

Returns

Return true if the given pixel format is same

inline bool operator!=(const PixelFormat &rhs) const#

operator!=, validate if a give pixel format is not same as this.

Parameters

rhs – pixel format to compare

Returns

Return true if the given pixel format is not same

Public Static Functions

static inline const PixelFormat Intensity8()#

Retrieves a pixel format for Intensity 8.

Returns

An 8 bit intensity value

static inline const PixelFormat R_8()#

Retrieves a pixel format for red 8.

Returns

An 8 bit red value

static inline const PixelFormat RG_88()#

Retrieves a pixel format for red and green channels with 8 bits per channel.

Returns

An 8 bit red and green channel

static inline const PixelFormat RGB_888()#

Retrieves a pixel format for red, green and blue channels with 8 bits per channel.

Returns

An 8 bit red, green and blue channel

static inline const PixelFormat RGBA_8888()#

Retrieves a pixel format for red, green, blue and alpha channels with 8 bits per channel.

Returns

An 8 bit red, green, blue and alpha channel

static inline const PixelFormat ABGR_8888()#

Retrieves a pixel format for alpha, blue, green and red channels with 8 bits per channel.

Returns

An 8 bit alpha, blue, green, red channel

static inline const PixelFormat R_16()#

Retrieves a pixel format for red with 16 bits.

Returns

An 16 bit red value

static inline const PixelFormat RG_1616()#

Retrieves a pixel format for red and green channels with 16 bits per channel.

Returns

An 16 bit red and green channel

static inline const PixelFormat R_32()#

Retrieves a pixel format for red with 32 bits.

Returns

An 32 bit red value

static inline const PixelFormat RG_3232()#

Retrieves a pixel format for red and green channels with 32 bits per channel.

Returns

An 32 bit red and green channel

static inline const PixelFormat RGB_323232()#

Retrieves a pixel format for red, green and blue channels with 32 bits per channel.

Returns

An 32 bit red, green and blue channel

static inline const PixelFormat RGBA_32323232()#

Retrieves a pixel format for red, green, blue and alpha channels with 32 bits per channel.

Returns

An 32 bit red, green, blue and alpha channel

static inline const PixelFormat RGB_565()#

Retrieves a pixel format for red, green and blue channels with 5 bits for the red and blue channels and 6 bits for the green channel.

Returns

An red, green and blue pixel format with 5 bits for the red and blue channels and 6 bits for the green channel

static inline const PixelFormat RGBA_4444()#

Retrieves a pixel format for red, green, blue and alpha channels with 4 bits per channel.

Returns

An 4 bit red, green, blue and alpha channel

static inline const PixelFormat RGBA_5551()#

Retrieves a pixel format for red, green, blue and alpha channels with 5 bits per channel for the red, green and blue channels with 1 bit for alpha.

Returns

An 32 bit red, green, blue and alpha channel

static inline const PixelFormat BGR_888()#

Retrieves a pixel format for blue, green and red channels with 8 bits per channel.

Returns

An 8 bit blue, green and red channel pixel format

static inline const PixelFormat BGRA_8888()#

Retrieves a pixel format for blue, green, red and alpha channels with 8 bits per channel.

Returns

An 8 bit blue, green, red and alpha channel pixel format

static inline const PixelFormat Depth8()#

Retrieves a pixel format for depth with 8 bits.

Returns

An 8 bit depth channel pixel format

static inline const PixelFormat Depth16()#

Retrieves a pixel format for depth with 16 bits.

Returns

An 16 bit depth channel pixel format

static inline const PixelFormat Depth24()#

Retrieves a pixel format for depth with 24 bits.

Returns

An 24 bit depth channel pixel format

static inline const PixelFormat Depth32()#

Retrieves a pixel format for depth with 32 bits.

Returns

An 32 bit depth channel pixel format

static inline const PixelFormat Depth16Stencil8()#

Retrieves a pixel format for depth with 16 bits and stencil with 8 bits.

Returns

A 16 bit depth channel with 8 bits for stencil pixel format

static inline const PixelFormat Depth24Stencil8()#

Retrieves a pixel format for depth with 24 bits and stencil with 8 bits.

Returns

A 24 bit depth channel with 8 bits for stencil pixel format

static inline const PixelFormat Depth32Stencil8()#

Retrieves a pixel format for depth with 32 bits and stencil with 8 bits.

Returns

A 32 bit depth channel with 8 bits for stencil pixel format

static inline const PixelFormat Stencil8()#

Retrieves a pixel format for stencil with 8 bits.

Returns

An 8 bit stencil channel pixel format

static inline const PixelFormat L_32()#

Retrieves a pixel format for luminance with 32 bits.

Returns

An 32 bit luminance channel pixel format

static inline const PixelFormat LA_1616()#

Retrieves a pixel format for luminance and alpha channels with 16 bits per channel.

Returns

An 16 bit luminance and alpha channel pixel format

static inline const PixelFormat LA_3232()#

Retrieves a pixel format for luminance and alpha channels with 32 bits per channel.

Returns

An 32 bit luminance and alpha channel pixel format

static inline const PixelFormat RGBA_16161616()#

Retrieves a pixel format for red, green, blue and alpha channels with 16 bits per channel.

Returns

An 16 bit red, green, blue and alpha channel

static inline const PixelFormat RGB_161616()#

Retrieves a pixel format for red, green and blue channels with 16 bits per channel.

Returns

An 16 bit red, green and blue channel

static inline const PixelFormat RGB_111110()#

Retrieves a packed pixel format for blue, green and red channels with 10 bits for the blue and 11 bits for the green and red channel. This pixel format is identical to BGR111110.

Returns

An blue, green and red pixel format with 10 bits for the blue and 11 bits for the green and red channel

static inline const PixelFormat BGR_101111()#

Retrieves a packed pixel format for blue, green and red channels with 10 bits for the blue and 11 bits for the green and red channel. This pixel format is identical to RGB111110.

Returns

An blue, green and red pixel format with 10 bits for the blue and 11 bits for the green and red channel

static inline const PixelFormat Unknown()#

Retrieves an unknown pixel format.

Returns

An unknown pixel format

struct LowHigh#

64 bit Integer representation as 32 lower bits and 32 higher bits

Public Members

uint32_t Low#

Lower 32-bits of the pixel format storage.

uint32_t High#

Higher 32-bits of the pixel format storage.

Plane3d#

Class Documentation#

class Plane3d#

Uses the plane equation Ax + By + Cz + D = 0, where A B C are plane normal, xyz are position on the plane and D is distance to the plane.

Public Functions

inline Plane3d(const glm::vec3 &normal, float dist)#

Constructs a plane from normal and distance. Distance is the scalar number that is the (unsigned) distance of this plane from (0,0,0).

Parameters
  • normal – The normal of this plane. MUST BE NORMALISED. If it not normalized, unexpected results may occur.

  • dist – The signed distance, along the plane’s normal direction, between the coordinate start and (0,0,0). This number is defined as the number that the normal must be multiplied with so that the normal’s coordinates define a point on the plane.

inline Plane3d(const glm::vec3 &normal, const glm::vec3 &pointOnPlane)#

Constructs a plane from normal and a point on this plane.

Parameters
  • normal – The normal of this plane. If it is not normalized, unexpected results may occur.

  • pointOnPlane – Any point belonging to this plane

inline Plane3d(const glm::vec3 &point0, const glm::vec3 &point1, const glm::vec3 &point2)#

Constructs a plane from three points.

Parameters
  • point0 – A point belonging to the plane

  • point1 – A point belonging to the plane

  • point2 – A point belonging to the plane

inline void set(const glm::vec3 &normal, float dist)#

Sets a plane from normal and distance. Distance is the scalar number that is the distance of this plane from (0,0,0).

Parameters
  • normal – The normal of this plane. MUST BE NORMALISED. If it not normalized, unexpected results may occur.

  • dist – The signed distance, along the plane’s normal direction, between the coordinate start and (0,0,0). This number is defined as the number that the normal must be multiplied with so that the normal’s coordinates define a point on the plane.

inline void set(const glm::vec3 &normal, const glm::vec3 &pointOnPlane)#

Sets a plane from normal and a point on this plane.

Parameters
  • normal – The normal of this plane. If it is not normalized, unexpected results may occur.

  • pointOnPlane – Any point belonging to this plane

inline void set(const glm::vec3 &point0, const glm::vec3 &point1, const glm::vec3 &point2)#

Sets a plane from three points.

Parameters
  • point0 – A point belonging to the plane

  • point1 – A point belonging to the plane

  • point2 – A point belonging to the plane

inline float distanceTo(const glm::vec3 &point)#

Find the signed distance between a point and the plane. Positive means distance along the normal, negative means distance opposite to the normal’s direction.

Parameters

point – The point

Returns

The signed distance between the point and this plane.

inline float getDistance() const#

Get the distance of this plane to the coordinate start (0,0,0).

Returns

The distance of this plane to the coordinate start (0,0,0)

inline glm::vec3 getNormal() const#

Get the normal of this plane.

Returns

The normal of this plane.

inline void transform(glm::mat4 &transMtx)#

Transform the plane with a transformation matrix.

Parameters

transMtx – The matrix to transform this plane with.

PvrError#

Inheritance Relationships#

Base Type#

  • public std::runtime_error

Derived Types#

Class Documentation#

class PvrError : public std::runtime_error#

A simple std::runtime_error wrapper for throwing generic PVR exceptions.

Subclassed by pvr::FileEOFError, pvr::FileIOError, pvr::IndexOutOfRange, pvr::InvalidArgumentError, pvr::InvalidDataError, pvr::InvalidOperationError, pvr::OperationFailedError, pvr::TextureDecompressionError, pvr::UnsupportedOperationError

Public Functions

inline PvrError(std::string message)#

Constructor.

Parameters

message – A message to log.

Stream#

Inheritance Relationships#

Derived Types#

Class Documentation#

class Stream#

This class is used to abstract streams of data (files, blocks of memory, resources etc.). In general a stream is considered something that can be read or written from. Specializations for many different types of streams are provided by the PowerVR Framework, the most commonly used ones being Files and Memory. The common interface and pointer types allow the Stream to abstract data in a very useful manner.

Subclassed by pvr::AndroidAssetStream, pvr::BufferStream, pvr::FileStream

Public Types

enum SeekOrigin#

When seeking, select if your offset should be considered to be from the Start of the stream, the Current point in the stream or the End of the stream.

Values:

enumerator SeekOriginFromStart#
enumerator SeekOriginFromCurrent#
enumerator SeekOriginFromEnd#

Public Functions

virtual ~Stream() = default#

Destructor (virtual, this class can and should be used polymorphically).

inline bool isReadable() const#

Return true if this stream can be read from.

Returns

True if this stream can be read from.

inline bool isWritable() const#

Return true if this stream can be written from.

Returns

True if this stream can be written to.

inline const std::string &getFileName() const#

Get the filename of the file that this std::string represents, if such exists. Otherwise, empty std::string.

Returns

The filename of the file that this std::string represents, if such exists. Otherwise, empty std::string.

inline void read(size_t elementSize, size_t numElements, void *buffer, size_t &dataRead) const#

Main read function. Read up to a specified amount of items into the provided buffer.

Parameters
  • elementSize – The size of each element that will be read.

  • numElements – The maximum number of elements to read.

  • buffer – The buffer into which to write the data.

  • dataRead – After returning, will contain the number of items that were actually read

inline void readExact(size_t elementSize, size_t numElements, void *buffer) const#

Main read function. Read exactly a specified amount of items into the provided buffer, otherwise error.

Parameters
  • elementSize – The size of each element that will be read.

  • numElements – The maximum number of elements to read.

  • buffer – The buffer into which to write the data.

inline void write(size_t elementSize, size_t numElements, const void *buffer, size_t &dataWritten)#

Main write function. Write into the stream the specified amount of items from a provided buffer.

Parameters
  • elementSize – The size of each element that will be written.

  • numElements – The number of elements to write.

  • buffer – The buffer from which to read the data. If the buffer is smaller than elementSize * numElements bytes, result is undefined.

  • dataWritten – After returning, will contain the number of items that were actually written. Will contain numElements unless an error has occured.

inline void writeExact(size_t elementSize, size_t numElements, const void *buffer)#

Main write function. Write into the stream exactly the specified amount of items from a provided buffer, otherwise throw error.

Parameters
  • elementSize – The size of each element that will be written.

  • numElements – The number of elements to write.

  • buffer – The buffer from which to read the data. If the buffer is smaller than elementSize * numElements bytes, result is undefined.

inline void seek(long offset, SeekOrigin origin) const#

If supported, seek a specific point for random access streams. After successful call, subsequent operation will happen in the specified point.

Parameters
  • offset – The offset to seec from “origin”

  • origin – Beginning of stream, End of stream or Current position

inline bool isSeekable() const#

Returns true if a stream supports seek, otherwise false.

Returns

True if a stream supports seek, otherwise false

inline bool isRandomAccess() const#

Returns true if a stream supports seek, otherwise false.

Returns

True if a stream supports seek, otherwise false

inline size_t getPosition() const#

If supported, returns the current position in the stream.

Returns

If suppored, returns the current position in the stream. Otherwise, returns 0.

inline uint64_t getPosition64() const#

If supported, returns the current position in the stream.

Returns

If suppored, returns the current position in the stream. Otherwise, returns 0.

inline size_t getSize() const#

If supported, returns the total size of the stream.

Returns

If suppored, returns the total amount of data in the stream. Otherwise, returns 0.

inline uint64_t getSize64() const#

If supported, returns the total size of the stream, always in 64 bit precision.

Returns

If suppored, returns the total amount of data in the stream. Otherwise, returns 0.

template<typename Type_>
inline std::vector<Type_> readToEnd() const#

Convenience functions that reads all data in the stream into a contiguous block of memory of a specified element type. Requires random-access stream.

Template Parameters

Type_ – The type of item that will be read into.

Returns

A std::vector of Type_ containing all data from the current point to the end of the stream.

inline void readIntoCharBuffer(std::vector<char> &outString) const#

Convenience function that reads all data in the stream into a raw, contiguous block of memory. Requires random-access stream.

Parameters

outString – A std::vector<char> that will contain all data in the stream.

Returns

true if successful, false otherwise.

template<typename T_>
inline void readIntoBuffer(std::vector<T_> &outString) const#

Convenience function that reads all data in the stream into a raw, contiguous block of memory. Requires random-access stream.

Parameters

outString – A std::vector<char> that will contain all data in the stream.

Returns

true if successful, false otherwise.

inline std::vector<char> readChars() const#

Convenience function that reads all data in the stream into a raw, contiguous block of memory. Requires random-access stream.

Returns

A std::vector<char> that will contain all data in the stream.

inline void readIntoString(std::string &outString) const#

Convenience function that reads all data in the stream into a std::string.

Parameters

outString – The string where the stream’s data will all be saved

inline std::string readString() const#

Convenience function that reads all data in the stream into a std::string.

Returns

A string containing the stream’s data

Protected Functions

inline explicit Stream(const std::string &fileName, bool readable, bool writable, bool seekable)#

Constructor. Open a stream to a new filename. Must be overriden as it only sets the filename.

Parameters

fileName – Commmonly the filename, but may be any type of resource identifier (such as Windows Embedded Resource id)

Protected Attributes

bool _isReadable#

True if the stream can be read.

bool _isWritable#

True if the stream can be written.

bool _isRandomAccess#

True if the stream is random read write.

std::string _fileName#

The filename (conceptually, a resource identifier as there may be other sources for the stream)

StridedBuffer#

Inheritance Relationships#

Base Type#

  • public UInt8Buffer

Class Documentation#

class StridedBuffer : public UInt8Buffer#

Representation of raw data. Used to store raw data that is logically grouped in blocks with a stride.

Public Members

uint16_t stride#

The stride of the buffer.

StringHash#

Class Documentation#

class StringHash#

Implementation of a hashed std::string with functionality for fast compares.

In most cases, can be used as a drop-in replacement for std::strings to take advantage of fast hashed comparisons. On debug builds, tests for hash collisions are performed (Assertion + error log if collision found)

Public Functions

inline StringHash(const char *str)#

Constructor. Initialize with c-style std::string, which will be copied. Automatically calculates hash.

Parameters

str – A c-style std::string. Will be copied internaly.

inline StringHash(const std::string &right)#

Constructor. Initialize with c++style std::string, which will be copied. Automatically calculates hash.

Parameters

right – The std::string to initialize with.

inline operator const std::string&() const#

Conversion to std::string reference. No-op.

Returns

A std::string representatation of this hash

inline StringHash()#

Default constructor. Empty std::string.

inline StringHash(const StringHash &other)#

Copy Constructor.

Parameters

other – String hash from which to copy.

inline ~StringHash()#

Dtor.

inline StringHash &operator=(const StringHash other)#

Copy assignment operator.

Parameters

other – String hash from which to copy.

Returns

this object

inline StringHash &append(const char *ptr)#

Appends a std::string to the end of this StringHash, recalculates hash.

Parameters

ptr – A std::string

Returns

this (post the operation)

inline StringHash &append(const std::string &str)#

Appends a std::string.

Parameters

str – A std::string

Returns

this (post the operation)

inline StringHash &assign(const char *ptr)#

Assigns the std::string to the std::string ptr.

Parameters

ptr – A std::string

Returns

this (post the operation)

inline StringHash &assign(const std::string &str)#

Assigns the std::string to the std::string str.

Parameters

str – A std::string

Returns

this (post the operation)

inline size_t size() const#

Return the length of this std::string hash.

Returns

Length of this std::string hash

inline size_t length() const#

Return the length of this std::string hash.

Returns

Length of this std::string hash

inline bool empty() const#

Return if the std::string is empty.

Returns

true if the std::string is emtpy (length=0), false otherwise

inline void clear()#

Clear this std::string hash.

inline bool operator==(const StringHash &str) const#

== Operator. Compares hash values. Extremely fast.

On debug builds, this operation does a deep check for hash collisions. You may also define PVR_STRING_HASH_STRONG_COMPARISONS if you want to force deep checks (in which) case IFF hashes are equal the the strings will be compared char-per-char as well. Only consider this if you think that for some reason you have an extremely high probability of hash collisions.

Parameters

str – A hashed std::string to compare with

Returns

True if the strings have the same hash

inline bool operator==(const char *str) const#

Equality Operator. This function performs a strcmp(), so it is orders of magnitude slower than comparing to another StringHash, but still much faster than creating a temporary StringHash for one comparison.

Parameters

str – A std::string to compare with

Returns

True if they are the same.

inline bool operator==(const std::string &str) const#

Equality Operator. This function performs a std::string comparison so it is orders of magnitude slower than comparing to another StringHash, but still much faster than creating a temporary StringHash for one comparison.

Parameters

str – A std::string to compare with

Returns

True if they are the same.

inline bool operator!=(const StringHash &str) const#

Inequality Operator. Compares hash values. Extremely fast.

Parameters

str – A StringHash to compare with

Returns

True if they don’t match

inline bool operator<(const StringHash &str) const#

Less than Operator. Compares hash values, except on debug builds where it checks for collisions. Extremely fast.

Parameters

str – A StringHash to compare with

Returns

True if this should be considered less than str, otherwise false.

inline bool operator>(const StringHash &str) const#

Greater-than operator.

Parameters

str – Right hand side of the operator (StringHash)

Returns

Return true if left-hand side is greater than right-hand side

inline bool operator<=(const StringHash &str) const#

Less-than or equal operator.

Parameters

str – Right hand side of the operator (StringHash)

Returns

Return true if left-hand side is less than or equal to the right-hand side

inline bool operator>=(const StringHash &str) const#

Greater-than or equal operator.

Parameters

str – Right hand side of the operator (StringHash)

Returns

Return true if left-hand side is greater-than or equal to the right-hand side

inline const std::string &str() const#

Get the base string object used by this StringHash object.

Returns

The base string object contained in this std::string hash.

inline std::size_t getHash() const#

Get the base string object used by this StringHash object.

Returns

The hash value of this StringHash.

inline const char *c_str() const#

Get the base string object used by this StringHash object.

Returns

A c-string representation of the contained std::string.

Texture#

Inheritance Relationships#

Base Type#

Class Documentation#

class Texture : public pvr::TextureHeader#

A 2D Texture asset, together with Information, Metadata and actual Pixel data. Only represents the actual data, not the API objects that may be created from it.

Public Functions

Texture()#

Construct a new empty texture.

Texture(const TextureHeader &sHeader, const unsigned char *pData = NULL)#

Create a texture using the information from a Texture header and copy the actual data from a provided pointer.

Creates a new texture based on a texture header, pre-allocating the correct amount of memory. If data is supplied, it will be copied into memory. If the pointer contains less data than is dictated by the texture header, the behaviour is undefined.

Parameters
  • sHeader – A texture header describing the texture

  • pData – Pointer to memory containing the actual data.

void initializeWithHeader(const TextureHeader &sHeader)#

Create a texture using the information from a Texture header and preallocate memory for its data. /summary>

param sHeader

A texture header describing the texture

Creates a new texture based on a texture header, pre-allocating the correct amount of memory.

const unsigned char *getDataPointer(uint32_t mipMapLevel = 0, uint32_t arrayMember = 0, uint32_t face = 0, uint32_t plane = 0) const#

Returns a (const) pointer into the raw texture’s data. Can be offset to a specific array member, face and/or MIP Map levels.

The data is contiguous so that the entire texture (all mips, array members and faces) can always be accessed from any pointer.

Parameters
  • mipMapLevel – The mip map level to get a pointer to (default 0)

  • arrayMember – The array member to get a pointer to (default 0)

  • face – The cube face to get a pointer to (default 0)

Returns

Const raw pointer to a location in the texture.

unsigned char *getDataPointer(uint32_t mipMapLevel = 0, uint32_t arrayMember = 0, uint32_t face = 0, uint32_t plane = 0)#

Returns a pointer into the raw texture’s data. Can be offset to a specific array member, face and/or MIP Map levels.

The data is contiguous so that the entire texture (all mips, array members and faces) can always be accessed from any pointer.

Parameters
  • mipMapLevel – The mip map level for which to get the data pointer (default 0)

  • arrayMember – The array member for which to get the data pointer (default 0)

  • face – The face for which to get the data pointer (default 0)

Returns

Raw pointer to a location in the texture.

inline unsigned char *getPixelPointer(uint32_t x, uint32_t y, uint32_t z = 0, uint32_t mipMapLevel = 0, uint32_t arrayMember = 0, uint32_t face = 0, uint32_t plane = 0)#

Returns a pointer into the raw texture’s data, offset to a specific pixel. Note that this does not work for compressed textures.

The data is contiguous so that the entire texture (all mips, array members and faces) can always be accessed from any pointer. Equivalent to getDataPointer(mipMapLevel, arrayMember, faceNumber) + [char offset of pixel (x,y,z)]

Parameters
  • x – The x position of the pointer

  • y – The y position of the pointer

  • z – The z position of the pointer (default 0)

  • mipMapLevel – The mip map level for which to get the data pointer (default 0)

  • arrayMember – The array member for which to get the data pointer (default 0)

  • face – The face for which to get the data pointer (default 0). The number is equal to the value of the corresponding CubeFace enum.

Returns

Raw pointer to a location in the texture.

inline unsigned char *getPixelPointerByUvw(float u, float v, float w = 0, uint32_t mipMapLevel = 0, uint32_t arrayMember = 0, CubeFace face = (CubeFace)0, uint32_t plane = 0)#

Returns the pointer to the data of the closest texel to the provided uvw coordinates (right/down texel returned if coordinate is on a boundary). Note that this does not work for compressed textures.

The data is contiguous so that the entire texture (all mips, array members and faces) can always be accessed from any pointer.

Parameters
  • u – The u position [0..1] of the pointer. Clamped to [0..1]

  • v – The v position [0..1] of the pointer. Clamped to [0..1]

  • w – Thew position [0..1] of the pointer (default 0). Clamped to [0..1]

  • mipMapLevel – The mip map level for which to get the data pointer (default 0)

  • arrayMember – The array member for which to get the data pointer (default 0)

  • face – The face for which to get the data pointer (default 0)

Returns

Raw pointer to a location in the texture.

inline unsigned char *getCubemapPixel(float x, float y, float z, uint32_t mipMapLevel = 0, uint32_t arrayMember = 0, uint32_t plane = 0)#

Returns the pointer to the data for the direction (x,y,z) provided for the specific mip map level and array layer.

Parameters
  • x – The x component of the direction

  • y – The y component of the direction

  • z – The z component of the direction

  • mipMapLevel – The mip map level for which to get the data pointer (default 0)

  • arrayMember – The array member for which to get the data pointer (default 0)

  • plane – The plane for which to get the data pointer (default 0)

Returns

Raw pointer to the data for the direction specified.

uint8_t getPixelSize() const#

Get the number of bytes size of each pixel in the texture. Not accurate for many compressed textures (e.g. ASTC)

Returns

he number of bytes size of each pixel in the texture. May return zero for some compressed formats. /returns>

inline ImageType getDimension() const#

Return the base dimensioning type of the image (3D, 2D, 1D).

Returns

The base dimensioning type of the image (3D, 2D, 1D).

inline ImageLayersSize getLayersSize() const#

Return the texture’s layer layout (miplevels, arraylevels). Faces are considered array levels, so a cube array has array x face array levels.

Returns

The texture’s layer layout (miplevels, arraylevels)

inline Extent3D getDimensions(uint32_t miplevel = 0) const#

Return the texture’s dimensions as a 3D extent (height, width, depth).

Parameters

miplevel – (Default 0) The mip level for which to get the dimensions

Returns

Return the texture’s dimensions as a 3D extent (height, width, depth)

void addPaddingMetaData(uint32_t alignment)#

This function pads to a boundary value equal to “uiPadding”. For example, setting alignment=8 will align the start of the texture data to an 8 char boundary.

When writing the texture out to a PVR file, it is often desirable to pad the meta data so that the start of the texture data aligns to a given boundary. Note - this should be called immediately before saving (in any case, before adding any metadata) as the value is worked out based on the current meta data size. /remarks>

Parameters

alignment – The final alignment of the metadata

TextureDecompressionError#

Inheritance Relationships#

Base Type#

Class Documentation#

class TextureDecompressionError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when invalid operations are attempted.

Public Functions

inline TextureDecompressionError(const std::string &message, const std::string &format)#

Constructor.

Parameters
  • message – A message to log.

  • format – The source format of the texture decompression.

inline TextureDecompressionError(const std::string &format)#

Constructor.

Parameters

format – The source format of the texture decompression.

TextureMetaData#

Class Documentation#

class TextureMetaData#

The TextureMetaData class contains metadata of a texture. Metadata is any information that a texture could be correctly loaded from file without. In most cases, metadata may still be necessary to actually USE the texture, such as winding orders, paddings, atlas information and others.

Public Types

enum Identifier#

Values for each meta data type that we know about. Texture arrays hinge on each surface being identical in all but content, including meta data. If the meta data varies even slightly then a new texture should be used. It is possible to write your own extension to get around this however.

Values:

enumerator IdentifierTextureAtlasCoords#
enumerator IdentifierBumpData#
enumerator IdentifierCubeMapOrder#
enumerator IdentifierTextureOrientation#
enumerator IdentifierBorderData#
enumerator IdentifierPadding#
enumerator IdentifierPerChannelType#
enumerator IdentifierSupercompressionGlobalData#
enumerator IdentifierMaxRange#
enumerator IdentifierNumMetaDataTypes#
enum Axis#

Axes, used to query orientations.

Values:

enumerator AxisAxisX#
enumerator AxisAxisY#
enumerator AxisAxisZ#
enum AxisOrientation#

Orientations of various axes.

Values:

enumerator AxisOrientationLeft#
enumerator AxisOrientationRight#
enumerator AxisOrientationUp#
enumerator AxisOrientationDown#
enumerator AxisOrientationOut#
enumerator AxisOrientationIn#

Public Functions

inline TextureMetaData()#

Constructor.

inline TextureMetaData(uint32_t fourCC, uint32_t key, uint32_t dataSize, const char *data)#

Constructor.

Parameters
  • fourCC – FourCC of the metadata

  • key – Key of the metadata

  • dataSize – The total size of the payload of the metadata

  • data – A pointer to the actual data

inline TextureMetaData(const TextureMetaData &rhs)#

Copy Constructor.

Parameters

rhs – Copy from this object

inline TextureMetaData(const TextureMetaData &&rhs)#

Copy Constructor.

Parameters

rhs – Copy from this object

inline ~TextureMetaData()#

Destructor.

inline TextureMetaData &operator=(const TextureMetaData &rhs)#

Copy assignment operator.

Parameters

rhs – Copy from this object

Returns

This object

inline uint32_t getFourCC() const#

Get the 4cc descriptor of the data type’s creator. Values equating to values between ‘P’ ‘V’ ‘R’ 0 and ‘P’ ‘V’ ‘R’ 255 will be used by our headers.

Returns

Return 4cc descriptor of the data type’s creator.

inline uint32_t getDataSize() const#

Get the data size of this meta data.

Returns

Return the size of the meta data

inline uint32_t getKey() const#

Get the enumeration key identifying the data type.

Returns

Return the enumeration key.

inline const unsigned char *getData() const#

Get the data, can be absolutely anything, the loader needs to know how to handle it based on fourCC and key.

Returns

Return the data

inline unsigned char *getData()#

Get the data, can be absolutely anything, the loader needs to know how to handle it based on fourCC and key.

Returns

Return the data

inline uint32_t getTotalSizeInMemory() const#

Get the data total size in memory.

Returns

Return the data total size in memory

Time#

Class Documentation#

class Time#

This class provides functions for measuring time: current time, elapsed time etc. High performance timers are used if available by the platform.

Public Functions

Time()#
~Time()#
void Reset()#

Sets the current time as a the initial point to measure time from.

uint64_t getElapsedNanoSecs() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in nanoseconds.

uint64_t getElapsedMicroSecs() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in microseconds.

float getElapsedMicroSecsF() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in microseconds.

uint64_t getElapsedMilliSecs() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in milliseconds.

float getElapsedMilliSecsF() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in milliseconds.

uint64_t getElapsedSecs() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in seconds.

float getElapsedSecsF() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in seconds.

uint64_t getElapsedMins() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in minutes.

float getElapsedMinsF() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in seconds.

uint64_t getElapsedHours() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in hours.

float getElapsedHoursF() const#

Provides the time elapsed from the last call to Reset() or object construction.

Returns

The elapsed time in seconds.

uint64_t getCurrentTimeNanoSecs() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in nanoseconds.

uint64_t getCurrentTimeMicroSecs() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in microseconds.

uint64_t getCurrentTimeMilliSecs() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in milliseconds.

uint64_t getCurrentTimeSecs() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in seconds.

uint64_t getCurrentTimeMins() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in minutes.

uint64_t getCurrentTimeHours() const#

Provides the current time. Current time is abstract (not connected to the time of day) and only useful for comparison.

Returns

The current time in hours.

TPSCamera#

Class Documentation#

class TPSCamera#

A simple third person camera implementation.

Public Functions

inline TPSCamera()#

Default Constructor.

inline void setHeight(float height)#

Set the height from the floor.

Parameters

height – height

inline void setDistanceFromTarget(const float dist)#

Set the camera distance from the target.

Parameters

dist – Distance

inline void setTargetPosition(const glm::vec3 &targetPos)#

Set the camera target position i.e. the ‘lookat’ value.

Parameters

targetPos – Target position

inline const glm::vec3 &getTargetPosition()#

Get the camera target position i.e. the ‘lookat’ value.

Returns

The target’s position

inline void updateTargetPosition(const glm::vec3 &pos)#

Update the camera target position i.e. the ‘lookat’ value.

Parameters

pos – The targets new position

inline void updateTargetLookAngle(float angleDeg)#

Update the camera target look angle.

Parameters

angleDeg – The camera’s new angle in degrees

inline void setTargetLookAngle(float angleDeg)#

Set the camera target look angle. In this implementation, angle 0 means the camera is facing the north.

Parameters

angleDeg – The camera’s new angle in degrees

inline float getTargetLookAngle()#

Get the camera target look angle. Tn this implementation, angle 0 means the camera is facing the north.

Returns

The camera’s angle in degrees

inline const glm::mat4 &getViewMatrix() const#

Calculates and returns the camera view matrix based on the most up to date camera properties if they have been updated (are dirty) or returns the last view matrix caluclated.

Returns

The TPS camera view matrix

inline const glm::vec3 &getCameraPosition() const#

Calculates and returns the camera position based on the most up to date camera properties.

Returns

The TPS camera position

TPSOrbitCamera#

Class Documentation#

class TPSOrbitCamera#

A simple third person orbit camera implementation.

Public Functions

inline TPSOrbitCamera()#

Default Constructor for a TPSOrbitCamera.

inline float getAzimuth() const#

Get the azimuth of the camera around the target (angle around the Z axis). Angle zero is on the X axis.

Returns

The camera’s azimuth in degrees

inline void setAzimuth(float azimuth)#

Set the azimuth of the camera along the target’s XZ plane. 0 is on the X axis.

Parameters

azimuth – The azimuth of the camera along the target’s XZ plane

inline void addAzimuth(float deltaAzimuth)#

Increase or decrease the azimuth of the camera by a (positive or negative) delta amount.

Parameters

deltaAzimuth – The increase or decrease in azimuth

inline float getInclination() const#

Get the inclination of the camera (vertical angle). 90 is top, -90 is bottom, 0 is horizontal.

Returns

The camera’s inclination in the range of -90..90

inline void setInclination(float inclination)#

Set the vertical angle of the camera. 0 is on the target’s XZ plane, -90 is below the target, 90 is above the target. Values over 90 or under -90 are clamped.

Parameters

inclination – height

inline void addInclination(float deltaInclination)#

Increase or decrease the inclination of the camera by a (positive or negative) delta amount. Resulting inclinations smaller than (-90 + epsilon) or greater than (90-epsilon) are clamped.

Parameters

deltaInclination – An inclination to add to the vertical angle of the camera.

inline float getDistanceFromTarget() const#

Get the camera distance from the target.

<returns”>The distance from the target

inline void setDistanceFromTarget(float distance)#

Set the camera distance from the target.

Parameters

distance – The distance from the target

inline void addDistanceFromTarget(float deltaDistance)#

Add a delta amount (positive or negative) to the distance of the camera from the target. Resulting distances smaller than epsilon are clamped to epsilon.

Parameters

deltaDistance – The distance from the target

inline void setTargetPosition(const glm::vec3 &targetPos)#

Set the camera target position i.e. the ‘lookat’ value.

Parameters

targetPos – Target position

inline const glm::vec3 &getTargetPosition() const#

Get the camera target position i.e. the ‘lookat’ value.

Returns

The target’s position

inline void addTargetPosition(const glm::vec3 &pos)#

Update the camera target position i.e. the ‘lookat’ value by a delta amount.

Parameters

pos – The targets new position

inline const glm::mat4 &getViewMatrix() const#

Calculates and returns the camera view matrix based on the most up to date camera properties if they have been updated (are dirty) or returns the last view matrix caluclated.

Returns

The TPS camera view matrix

inline const glm::vec3 &getCameraPosition() const#

Calculates and returns the camera position based on the most up to date camera properties.

Returns

The TPS camera position

UnsupportedOperationError#

Inheritance Relationships#

Base Type#

Class Documentation#

class UnsupportedOperationError : public pvr::PvrError#

A simple std::runtime_error wrapper for throwing exceptions when unsupported operations are attempted.

Public Functions

inline UnsupportedOperationError(std::string message)#

Constructor.

Parameters

message – A message to log.

inline UnsupportedOperationError()#

Constructor.

WindowsResourceStream#

Inheritance Relationships#

Base Type#

Class Documentation#

class WindowsResourceStream : public pvr::BufferStream#

A Stream implementation that is used to access resources built in a MS Windows executable.

This Stream abstraction allows the user to easily access the Resources embedded in Microsoft Windows .exe/.dll files created using Windows Resource Files. This is the default way resources are packed in the MS Windows version of the PowerVR Examples.

Public Functions

inline WindowsResourceStream(const std::string &resourceName, bool errorOnNotFound = true)#

Constructor. Creates a new WindowsResourceStream from a Windows Embedded Resource.

Parameters

resourceName – The “filename”. must be the same as the identifier of the Windows Embedded Resource

ILogger#

Inheritance Relationships#

Derived Type#

Class Documentation#

class ILogger#

Represents an object capable of providing Logging functionality. This class is normally instantiated and configured, not inherited from. The components providing the Logging capability are contained in this class through interfaces, and as such can be replaced with custom components.

Subclassed by Logger

Public Functions

inline ILogger()#
inline void setVerbosity(const LogLevel minimumLevelToOutput)#

Set the verbosity threshold below which messages will not be output.

Messages with a severity less than this will be silently discarded. For example, if using a “Warning” level, Critical, Error and Warning will be displayed, while Information, Verbose and Debug will be discarded.

Parameters

minimumLevelToOutput – The minimum level to actually output.

inline LogLevel getVerbosity() const#

Get the verbosity threshold below which messages will not be output.

Messages with a severity less than this will be silently discarded. For example, if using a “Warning” level, Critical, Error and Warning will be displayed, while Information, Verbose and Debug will be discarded.

Returns

The minimum level that is currently output.

inline void operator()(LogLevel severity, const char *const formatString, ...) const#

Functor operator used to allow an instance of this class to be called as a function. Logs a message using this logger’s message handler.

Parameters
  • severity – The severity of the message. Apart from being output into the message, the severity is used by the logger to discard log events less than a specified threshold. See setVerbosity(…)

  • formatString – A printf-style format std::string

  • ... – Variable arguments for the format std::string. Printf-style rules

inline void operator()(const char *const formatString, ...) const#

Functor operator used to allow an instance of this class to be called as a function. Logs a message using this logger’s message handler. Severity is fixed to “Error”.

Parameters
  • formatString – A printf-style format std::string

  • ... – Variable arguments for the format std::string. Printf-style rules

inline void output(LogLevel severity, const char *formatString, ...) const#

Logs a message using this logger’s message handler.

Parameters
  • severity – The severity of the message. Apart from being output into the message, the severity is used by the logger to discard log events less than a specified threshold. See setVerbosity(…)

  • formatString – A printf-style format std::string

  • ... – Variable arguments for the format std::string. Printf-style rules

inline void output(const char *formatString, ...) const#

Logs a message using this logger’s message handler.

Parameters
  • formatString – A printf-style format std::string

  • ... – Variable arguments for the format std::string. Printf-style rules

virtual void vaOutput(LogLevel severity, const char *formatString, va_list argumentList) const = 0#

Varargs version of the “output” function.

Parameters
  • severity – The severity of the message. Apart from being output into the message, the severity is used by the logger to discard log events less than a specified threshold. See setVerbosity(…)

  • formatString – A printf-style format std::string

  • argumentList – Variable arguments list for the format std::string. Printf-style rules

Logger#

Inheritance Relationships#

Base Type#

Class Documentation#

class Logger : public ILogger#

Represents an object capable of providing Logging functionality. This class is normally instantiated and configured, not inherited from. The components providing the Logging capability are contained in this class through interfaces, and as such can be replaced with custom components.

Public Functions

inline Logger()#
inline virtual ~Logger()#
inline void close()#
inline virtual void vaOutput(LogLevel severity, const char *formatString, va_list argumentList) const#

Varargs version of the “output” function.

Parameters
  • severity – The severity of the message. Apart from being output into the message, the severity is used by the logger to discard log events less than a specified threshold. See setVerbosity(…)

  • formatString – A printf-style format std::string

  • argumentList – Variable arguments list for the format std::string. Printf-style rules