Nazara Engine
0.4
A fast, complete, cross-platform API designed for game development
|
Graphics class that represents the rendering of a sprite. More...
Public Member Functions | |
Sprite () | |
Constructs a Sprite object by default. | |
Sprite (MaterialRef material) | |
Constructs a Sprite object with a reference to a material. More... | |
Sprite (Texture *texture) | |
Constructs a Sprite object with a pointer to a texture. More... | |
Sprite (const Sprite &sprite) | |
Constructs a Sprite object by assignation. More... | |
Sprite (Sprite &&)=delete | |
void | AddToRenderQueue (AbstractRenderQueue *renderQueue, const InstanceData &instanceData) const override |
Adds the sprite to the rendering queue. More... | |
const Color & | GetColor () const |
Gets the color of the sprite. More... | |
const Color & | GetCornerColor (RectCorner corner) const |
Gets the color setup on a corner of the sprite. More... | |
const Vector3f & | GetOrigin () const |
Gets the origin of the sprite. More... | |
const Vector2f & | GetSize () const |
Gets the size of the sprite. More... | |
const Rectf & | GetTextureCoords () const |
Gets the texture coordinates of the sprite. More... | |
void | SetColor (const Color &color) |
Sets the global color of the sprite. More... | |
void | SetCornerColor (RectCorner corner, const Color &color) |
Sets a color for a corner of the sprite. More... | |
void | SetDefaultMaterial () |
Sets the default material of the sprite (just default material) | |
void | SetMaterial (MaterialRef material, bool resizeSprite=true) |
Changes the material of the sprite. More... | |
bool | SetMaterial (String materialName, bool resizeSprite=true) |
Sets the material of the sprite from a name. More... | |
void | SetMaterial (std::size_t skinIndex, MaterialRef material, bool resizeSprite=true) |
Sets the material of the sprite. More... | |
bool | SetMaterial (std::size_t skinIndex, String materialName, bool resizeSprite=true) |
Sets the material of the sprite from a name for a specific skin. More... | |
void | SetOrigin (const Vector3f &origin) |
Sets the origin of the sprite. More... | |
void | SetSize (const Vector2f &size) |
Sets the size of the sprite. More... | |
void | SetSize (float sizeX, float sizeY) |
Sets the size of the sprite. More... | |
bool | SetTexture (String textureName, bool resizeSprite=true) |
Sets the texture of the sprite from a name for the current skin. More... | |
void | SetTexture (TextureRef texture, bool resizeSprite=true) |
Sets the texture of the sprite for the current skin. More... | |
bool | SetTexture (std::size_t skinIndex, String textureName, bool resizeSprite=true) |
Sets the texture of the sprite from a name for a specific skin. More... | |
void | SetTexture (std::size_t skinIndex, TextureRef texture, bool resizeSprite=true) |
Sets the texture of the sprite for a specific skin. More... | |
void | SetTextureCoords (const Rectf &coords) |
Sets the texture coordinates of the sprite. More... | |
void | SetTextureRect (const Rectui &rect) |
Sets the texture rectangle of the sprite. More... | |
Sprite & | operator= (const Sprite &sprite) |
Sets the current sprite with the content of the other one. More... | |
Sprite & | operator= (Sprite &&sprite)=delete |
Public Member Functions inherited from Nz::InstancedRenderable | |
InstancedRenderable () | |
Constructs a InstancedRenderable object by default. | |
InstancedRenderable (const InstancedRenderable &renderable) | |
Constructs a InstancedRenderable object by assignation. More... | |
InstancedRenderable (InstancedRenderable &&renderable)=delete | |
virtual | ~InstancedRenderable () |
Destructs the object and calls OnInstancedRenderableRelease. More... | |
virtual bool | Cull (const Frustumf &frustum, const InstanceData &instanceData) const |
Culls the instanced if not in the frustum. More... | |
void | EnsureBoundingVolumeUpdated () const |
Ensures that the bounding volume is up to date. | |
virtual const BoundingVolumef & | GetBoundingVolume () const |
Gets the bounding volume. More... | |
const MaterialRef & | GetMaterial (std::size_t matIndex=0) const |
Gets one of the material used by the object. More... | |
const MaterialRef & | GetMaterial (std::size_t skinIndex, std::size_t matIndex) const |
Gets one of the material used by the object, independently from the active skin. More... | |
std::size_t | GetMaterialCount () const |
Gets the number of material per skin. More... | |
std::size_t | GetSkin () const |
Gets the current active skin index. More... | |
std::size_t | GetSkinCount () const |
Gets the number of skins this object has. More... | |
virtual void | InvalidateData (InstanceData *instanceData, UInt32 flags) const |
Invalidates data for instanced. More... | |
void | SetSkin (std::size_t skinIndex) |
Changes the active skin. More... | |
void | SetSkinCount (std::size_t skinCount) |
Changes the maximum skin count of the object. More... | |
virtual void | UpdateBoundingVolume (InstanceData *instanceData) const |
Updates the bounding volume. More... | |
InstancedRenderable & | operator= (const InstancedRenderable &renderable) |
Sets the current instanced renderable with the content of the other one. More... | |
InstancedRenderable & | operator= (InstancedRenderable &&renderable)=delete |
NazaraSignal (OnInstancedRenderableInvalidateBoundingVolume, const InstancedRenderable *) | |
NazaraSignal (OnInstancedRenderableInvalidateData, const InstancedRenderable *, UInt32) | |
NazaraSignal (OnInstancedRenderableInvalidateMaterial, const InstancedRenderable *, std::size_t, std::size_t, const MaterialRef &) | |
NazaraSignal (OnInstancedRenderableRelease, const InstancedRenderable *) | |
NazaraSignal (OnInstancedRenderableResetMaterials, const InstancedRenderable *, std::size_t) | |
NazaraSignal (OnInstancedRenderableSkinChange, const InstancedRenderable *, std::size_t) | |
Public Member Functions inherited from Nz::RefCounted | |
RefCounted (bool persistent=true) | |
Constructs a RefCounted object with a persistance aspect. More... | |
RefCounted (const RefCounted &)=delete | |
RefCounted (RefCounted &&)=default | |
virtual | ~RefCounted () |
Destructs the object. More... | |
void | AddReference () const |
Adds a reference to the object. | |
unsigned int | GetReferenceCount () const |
Gets the number of references to the object. More... | |
bool | IsPersistent () const |
Checks whether the object is persistent. More... | |
bool | RemoveReference () const |
Removes a reference to the object. More... | |
bool | SetPersistent (bool persistent=true, bool checkReferenceCount=false) |
Sets the persistence of the object. More... | |
RefCounted & | operator= (const RefCounted &)=delete |
RefCounted & | operator= (RefCounted &&)=default |
Static Public Member Functions | |
template<typename... Args> | |
static SpriteRef | New (Args &&... args) |
Creates a new sprite from the arguments. More... | |
Friends | |
class | Graphics |
Additional Inherited Members | |
Protected Member Functions inherited from Nz::InstancedRenderable | |
void | InvalidateBoundingVolume () |
Invalidates the bounding volume. | |
void | InvalidateInstanceData (UInt32 flags) |
Invalidates the instance data based on flags. More... | |
void | ResetMaterials (std::size_t matCount, std::size_t skinCount=1) |
Resets the materials, material count and skin count. More... | |
void | SetMaterial (std::size_t matIndex, MaterialRef material) |
Changes the material used at the specified index by another one. More... | |
void | SetMaterial (std::size_t skinIndex, std::size_t matIndex, MaterialRef material) |
Changes the material used at the specified index by another one, independently from the active skin. More... | |
Protected Attributes inherited from Nz::InstancedRenderable | |
BoundingVolumef | m_boundingVolume |
Graphics class that represents the rendering of a sprite.
|
inline |
Constructs a Sprite object with a reference to a material.
material | Reference to a material |
|
inline |
Constructs a Sprite object with a pointer to a texture.
texture | Pointer to a texture |
|
inline |
|
overridevirtual |
Adds the sprite to the rendering queue.
renderQueue | Queue to be added |
instanceData | Data for the instance |
Implements Nz::InstancedRenderable.
|
inline |
Gets the color of the sprite.
This is the global color of the sprite, independent from corner colors
|
inline |
Gets the color setup on a corner of the sprite.
corner | Corner of the sprite to query |
|
inline |
|
inline |
Gets the size of the sprite.
|
inline |
Gets the texture coordinates of the sprite.
|
static |
Creates a new sprite from the arguments.
args | Arguments for the sprite |
Sets the current sprite with the content of the other one.
sprite | The other Sprite |
|
inline |
Sets the global color of the sprite.
This is independent from the corner color of the sprite
color | Color for the sprite |
|
inline |
Sets a color for a corner of the sprite.
This is independent from the sprite global color, which gets multiplied by the corner color when rendering the sprite.
corner | Corner of the sprite to set |
color | Color for the sprite |
|
inline |
Changes the material of the sprite.
material | Material for the sprite |
resizeSprite | Should billboard be resized to the material size (diffuse map) |
bool Nz::Sprite::SetMaterial | ( | String | materialName, |
bool | resizeSprite = true |
||
) |
Sets the material of the sprite from a name.
Tries to get a material from the MaterialLibrary and then the MaterialManager (which will treat the name as a path) Fails if the texture name is not a part of the MaterialLibrary nor the MaterialManager (which fails if it couldn't load the texture from its filepath)
materialName | Named texture for the material |
resizeSprite | Should the sprite be resized to the material diffuse map size? |
|
inline |
Sets the material of the sprite.
skinIndex | Skin index to change |
material | Material for the sprite |
resizeBillboard | Should billboard be resized to the material size (diffuse map) |
bool Nz::Sprite::SetMaterial | ( | std::size_t | skinIndex, |
String | materialName, | ||
bool | resizeSprite = true |
||
) |
Sets the material of the sprite from a name for a specific skin.
Tries to get a material from the MaterialLibrary and then the MaterialManager (which will treat the name as a path) Fails if the texture name is not a part of the MaterialLibrary nor the MaterialManager (which fails if it couldn't load the texture from its filepath)
skinIndex | Skin index to change |
materialName | Named texture for the material |
resizeSprite | Should the sprite be resized to the material diffuse map size? |
|
inline |
Sets the origin of the sprite.
The origin is the center of translation/rotation/scaling of the sprite.
origin | New origin for the sprite |
|
inline |
Sets the size of the sprite.
size | Size for the sprite |
|
inline |
Sets the size of the sprite.
sizeX | Size in X for the sprite |
sizeY | Size in Y for the sprite |
bool Nz::Sprite::SetTexture | ( | String | textureName, |
bool | resizeSprite = true |
||
) |
Sets the texture of the sprite from a name for the current skin.
Tries to get a texture from the TextureLibrary and then the TextureManager (which will treat the name as a path) Fails if the texture name is not a part of the TextureLibrary nor the TextureManager (which fails if it couldn't load the texture from its filepath)
textureName | Named texture for the sprite |
resizeSprite | Should the sprite be resized to the texture size? |
|
inline |
Sets the texture of the sprite for the current skin.
This function changes the diffuse map of the material associated with the current skin
texture | Texture for the sprite |
resizeSprite | Should the sprite be resized to the texture size? |
bool Nz::Sprite::SetTexture | ( | std::size_t | skinIndex, |
String | textureName, | ||
bool | resizeSprite = true |
||
) |
Sets the texture of the sprite from a name for a specific skin.
Tries to get a texture from the TextureLibrary and then the TextureManager (which will treat the name as a path) Fails if the texture name is not a part of the TextureLibrary nor the TextureManager (which fails if it couldn't load the texture from its filepath)
skinIndex | Named texture for the sprite |
textureName | Named texture for the sprite |
resizeSprite | Should the sprite be resized to the texture size? |
|
inline |
Sets the texture of the sprite for a specific skin.
This function changes the diffuse map of the material associated with the specified skin
skinIndex | Skin index to change |
texture | Texture for the sprite |
resizeSprite | Should the sprite be resized to the texture size? |
|
inline |
Sets the texture coordinates of the sprite.
coords | Texture coordinates |
|
inline |
Sets the texture rectangle of the sprite.
rect | Rectangles symbolizing the size of the texture |