CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Texture Class Referenceabstract

A texture that can be imported into the renderer. More...

#include <CeresEngine/Texture/Texture.hpp>

Inheritance diagram for CeresEngine::Texture:
CeresEngine::TResource< Texture > CeresEngine::Resource CeresEngine::IReflectable CeresEngine::TResource< GPUTexture, Texture > CeresEngine::TResource< MemoryTexture, Texture > CeresEngine::TResource< StreamingTexture, Texture > CeresEngine::GPUTexture CeresEngine::MemoryTexture CeresEngine::StreamingTexture

Public Member Functions

 Texture (const TextureProperties &properties)
 Creates a new texture.
 
 Texture (ResourceData &resourceData, const TextureProperties &properties)
 Creates a new texture.
 
 ~Texture () noexcept override
 Destroys the texture object.
 
bool isStreaming () const noexcept
 Determines if the texture is a streaming texture.
 
const TexturePropertiesgetProperties () const noexcept
 A structure that describes properties of an texture.
 
const TExtent3< UInt32 > & getExtent () const noexcept
 Texture extent.
 
Format getFormat () const noexcept
 Hardware texture format. By default Format::RGBA8UNorm.
 
virtual Async< BitmapgetBitmap (UInt32 layer=0, UInt32 mip=0) const =0
 Gets a bitmap pixel data for the given layer and mip level.
 
virtual Async setBitmap (const Bitmap &bitmap, UInt32 layer=0, UInt32 mip=0)=0
 Sets a new bitmap pixel data for the given layer and mip level.
 
- Public Member Functions inherited from CeresEngine::TResource< Texture >
ResourceHandle< TexturegetResourceHandle () const noexcept
 Generates a hash for the provided type.
 
SPtr< TexturegetShared () noexcept
 Gets a shared pointer to the resource.
 
SPtr< const TexturegetShared () const noexcept
 Gets a shared pointer to the resource.
 
const ResourceTypeInfogetResourceType () const noexcept override
 Returns the resource type information descriptor.
 
 TResource (ResourceData &data, InputStream &dataStream)
 
void serialize (OutputStream &dataStream) const override
 Serializes a resource by writing data to dataStream.
 
- Public Member Functions inherited from CeresEngine::Resource
 Resource ()
 Default constructor for the Resource class.
 
 Resource (ResourceData &data)
 Creates a new Resource instance by passing a ResourceData instance.
 
virtual ~Resource () noexcept=default
 Resource virtual destructor.
 
ResourceManagergetResourceManager () const noexcept
 
HResource getResourceHandle () const noexcept
 Generates a hash for the provided type.
 
UUID getResourceID () const noexcept
 
HResource getParentResource () const noexcept
 A parent resource to which this resource is attached to.
 
SPtr< ResourceMetadatagetResourceMetadata () const noexcept
 A pointer to the user-defined resource metadata.
 
const PackagePtrgetPackage () const noexcept
 The package from which the resource was loaded from.
 
template<typename T = Resource>
SPtr< TgetShared () noexcept
 Gets a shared pointer to the resource.
 
template<typename T = Resource>
SPtr< const TgetShared () const noexcept
 Gets a shared pointer to the resource.
 
 Resource (ResourceData &data, InputStream &dataStream)
 Creates a new resource by reading data from dataStream.
 
- Public Member Functions inherited from CeresEngine::IReflectable
virtual ~IReflectable () noexcept=default
 

Protected Attributes

TextureProperties mProperties
 A structure that describes properties of an texture.
 

Private Types

using super = TResource< Texture >
 

Friends

class TUserTypeInfo< Texture >
 

Additional Inherited Members

- Static Public Member Functions inherited from CeresEngine::Resource
template<typename Processor >
static constexpr void reflect (Processor &&RTTI)
 Executes the given processor for every field of the struct.
 
- Protected Member Functions inherited from CeresEngine::Resource
HResourceStream createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default)
 Creates a new resource stream.
 
void destroyStream (HResourceStream &stream)
 Destroys a stream.
 
void markAsDirty ()
 Marks the resource as dirty.
 

Detailed Description

A texture that can be imported into the renderer.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ Texture() [1/2]

CeresEngine::Texture::Texture ( const TextureProperties properties)
explicit

Creates a new texture.

Parameters
propertiesThe texture properties to initialize with.

◆ Texture() [2/2]

CeresEngine::Texture::Texture ( ResourceData resourceData,
const TextureProperties properties 
)
explicit

Creates a new texture.

Parameters
propertiesThe texture properties to initialize with.

◆ ~Texture()

CeresEngine::Texture::~Texture ( )
overridenoexcept

Destroys the texture object.

Member Function Documentation

◆ getBitmap()

virtual Async< Bitmap > CeresEngine::Texture::getBitmap ( UInt32  layer = 0,
UInt32  mip = 0 
) const
pure virtual

Gets a bitmap pixel data for the given layer and mip level.

If either the layer (or mip level) are missing, a null pixel data is returned.

Implemented in CeresEngine::MemoryTexture, CeresEngine::StreamingTexture, and CeresEngine::GPUTexture.

◆ getExtent()

const TExtent3< UInt32 > & CeresEngine::Texture::getExtent ( ) const
inlinenoexcept

Texture extent.

By default (1, 1, 1).

Remarks
The height component is only used for 2D, 3D, and Cube textures (i.e. TextureType::Texture2D, TextureType::Texture2DArray, TextureType::Texture3D, TextureType::TextureCube, TextureType::TextureCubeArray, TextureType::Texture2DMS, TextureType::Texture2DMSArray). The depth component is only used for 3D textures (i.e. TextureType::Texture3D). For cube textures, the width and height component must be equal.

◆ getFormat()

Format CeresEngine::Texture::getFormat ( ) const
inlinenoexcept

Hardware texture format. By default Format::RGBA8UNorm.

◆ getProperties()

const TextureProperties & CeresEngine::Texture::getProperties ( ) const
inlinenoexcept

A structure that describes properties of an texture.

◆ isStreaming()

bool CeresEngine::Texture::isStreaming ( ) const
noexcept

Determines if the texture is a streaming texture.

◆ setBitmap()

virtual Async CeresEngine::Texture::setBitmap ( const Bitmap bitmap,
UInt32  layer = 0,
UInt32  mip = 0 
)
pure virtual

Sets a new bitmap pixel data for the given layer and mip level.

Implemented in CeresEngine::MemoryTexture, CeresEngine::StreamingTexture, and CeresEngine::GPUTexture.

Friends And Related Symbol Documentation

◆ TUserTypeInfo< Texture >

Member Data Documentation

◆ mProperties

TextureProperties CeresEngine::Texture::mProperties
protected

A structure that describes properties of an texture.


The documentation for this class was generated from the following file: