Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Static Public Member Functions | List of all members
jop::Cubemap Class Referencefinal

#include <Cubemap.hpp>

Inheritance diagram for jop::Cubemap:
jop::Texture jop::Resource jop::SafeReferenceable< Resource > jop::SerializeInfo

Public Types

enum  Face {
  Face::Right, Face::Left, Face::Top, Face::Bottom,
  Face::Back, Face::Front, Face::First = Right
}
 
- Public Types inherited from jop::Texture
enum  Format {
  Format::None, Format::Alpha_UB_8, Format::RGB_UB_8, Format::RGBA_UB_8,
  Format::RGB_F_16, Format::RGBA_F_16, Format::Depth_US_16, Format::Depth_UI_24,
  Format::Stencil_UB_8, Format::DepthStencil_UI_24_B_8
}
 

Public Member Functions

 Cubemap (const std::string &name)
 Constructor. More...
 
bool load (const std::string &right, const std::string &left, const std::string &top, const std::string &bottom, const std::string &back, const std::string &front, const uint32 flags=0)
 Load a cube map from files. More...
 
bool load (const glm::uvec2 &size, const Format format, const uint32 flags=0)
 Load an empty cube map. More...
 
bool load (const std::string &path, const uint32 flags=0)
 Load from .dds file. More...
 
bool load (const Image &image, const uint32 flags=0)
 Load cube map from compressed image containing a cube map (DXT1/3/5) More...
 
glm::uvec2 getSize () const override
 Get the texture size. More...
 
unsigned int getPixelDepth () const override
 Get the texture pixel depth. More...
 
- Public Member Functions inherited from jop::Texture
 Texture (const std::string &name, const unsigned int glTarget)
 Constructor. More...
 
virtual ~Texture () override=0
 Virtual destructor. More...
 
void destroy ()
 Destroy this texture, erasing it from video memory. More...
 
bool bind (const unsigned int texUnit=0) const
 Bind this texture. More...
 
void unbind (const unsigned int texUnit=0) const
 Unbind a current texture. More...
 
bool isValid () const
 Check if this texture is valid. More...
 
void setSampler (const TextureSampler &sampler)
 Set a texture sampler. More...
 
void removeSampler ()
 Remove the bound texture sampler. More...
 
const TextureSamplergetSampler () const
 Get the currently bound sampler. More...
 
TexturesetFilterMode (const TextureSampler::Filter mode, const float param=1.f)
 Set the filtering mode. More...
 
TexturesetRepeatMode (const TextureSampler::Repeat repeat)
 Set the repeating mode. More...
 
TexturesetBorderColor (const Color &color)
 Set the border color. More...
 
TextureSampler::Filter getFilterMode () const
 Get the filtering mode. More...
 
TextureSampler::Repeat getRepeatMode () const
 Get the repeating mode. More...
 
float getAnisotropyLevel () const
 Get the anisotropy level. More...
 
const ColorgetBorderColor () const
 Get the border color. More...
 
unsigned int getHandle () const
 Get the OpenGL handle for this texture. More...
 
- Public Member Functions inherited from jop::Resource
 Resource (const std::string &name)
 Constructor. More...
 
virtual ~Resource ()=0
 Virtual destructor. More...
 
const std::string & getName () const
 Get the name of this resource. More...
 
void setPersistence (const unsigned short level)
 Set the persistence level. More...
 
unsigned short getPersistence () const
 Get the persistence level. More...
 
- Public Member Functions inherited from jop::SafeReferenceable< Resource >
WeakReference< ResourcegetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 SerializeInfo ()
 
void setSerializePackage (const uint16 package)
 
uint16 getSerializePackage () const
 
void setShouldSerialize (const bool set)
 
bool shouldSerialize () const
 
void setLightSerializeable (const bool set)
 
bool isLightSerializeable () const
 

Static Public Member Functions

static unsigned int getMaximumSize ()
 Get the maximum supported cube map size on this system. More...
 
static CubemapgetError ()
 Get the error cube map. More...
 
static CubemapgetDefault ()
 Get the default cube map. More...
 
- Static Public Member Functions inherited from jop::Texture
static unsigned int getMaxTextureUnits ()
 Get the maximum texture units. More...
 
static void setUnpackAlignment (const Format format)
 Set the pixel store alignment. More...
 
static bool allowSRGB ()
 Check is the sRGB color space is allowed. More...
 
static bool allowGenMipmaps (const glm::uvec2 &size, const bool srgb)
 Check is automatic mipmap generation is allowed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jop::Texture
void setAlphaSwizzle (const Format format)
 Set the swizzle mask for 8 bit textures. More...
 
- Protected Member Functions inherited from jop::Resource
 Resource (const Resource &other, const std::string &newName)
 Copy constructor. More...
 
- Protected Member Functions inherited from jop::SafeReferenceable< Resource >
 SafeReferenceable (Resource *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Resource > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Resource > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 
- Static Protected Member Functions inherited from jop::Texture
static Format getFormatFromDepth (const uint32 depth)
 Get the texture format from pixel depth. More...
 
static unsigned int getDepthFromFormat (const Format format)
 Get the texture pixel depth from format. More...
 
- Protected Attributes inherited from jop::Texture
Format m_format
 Must be filled by derived classes during load() More...
 

Detailed Description

Definition at line 35 of file Cubemap.hpp.

Member Enumeration Documentation

enum jop::Cubemap::Face
strong

Cube map faces

Enumerator
Right 
Left 
Top 
Bottom 
Back 
Front 
First 

Definition at line 41 of file Cubemap.hpp.

Constructor & Destructor Documentation

jop::Cubemap::Cubemap ( const std::string &  name)

Constructor.

Parameters
nameName of this resource

Member Function Documentation

static Cubemap& jop::Cubemap::getDefault ( )
static

Get the default cube map.

Returns
Reference to the cube map
static Cubemap& jop::Cubemap::getError ( )
static

Get the error cube map.

Returns
Reference to the cube map
static unsigned int jop::Cubemap::getMaximumSize ( )
static

Get the maximum supported cube map size on this system.

Returns
The maximum cube map size
unsigned int jop::Cubemap::getPixelDepth ( ) const
overridevirtual

Get the texture pixel depth.

Returns
The texture pixel depth in bytes

Implements jop::Texture.

glm::uvec2 jop::Cubemap::getSize ( ) const
overridevirtual

Get the texture size.

Returns
The texture size

Implements jop::Texture.

bool jop::Cubemap::load ( const std::string &  right,
const std::string &  left,
const std::string &  top,
const std::string &  bottom,
const std::string &  back,
const std::string &  front,
const uint32  flags = 0 
)

Load a cube map from files.

Parameters
rightRight side
leftLeft side
topTop side
bottomBottom side
backBack side
frontFront side
flagsTexture flags
Returns
True if successful
bool jop::Cubemap::load ( const glm::uvec2 &  size,
const Format  format,
const uint32  flags = 0 
)

Load an empty cube map.

Parameters
sizeThe size of a single face
formatThe texture format
flagsTexture flags
Returns
True if successful
bool jop::Cubemap::load ( const std::string &  path,
const uint32  flags = 0 
)

Load from .dds file.

Creates Image object and calls its load from file method

Note
Only use this with compressed .dds images that contain a full cube map (6 faces)
Parameters
pathPath to file
flagsTexture flags
Returns
True if successful
bool jop::Cubemap::load ( const Image image,
const uint32  flags = 0 
)

Load cube map from compressed image containing a cube map (DXT1/3/5)

Gets 6 faces from the compressed image and goes through them and their mipmaps.

Note
Only works with compressed images that contain a full cube map (6 faces).
Parameters
imageImage containing a cube map
flagsTexture flags
Returns
True if successful

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