Cogs.Core
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Cogs::Editor::CADAssetTexture Class Referencefinal

#include <CADAssetTexture.h>

Public Member Functions

 CADAssetTexture (Cogs::Core::Context *context, bool powerOfTwoTextures=true)
 
 CADAssetTexture (const CADAssetTexture &)=delete
 
CADAssetTextureoperator= (const CADAssetTexture &)=delete
 
ResourceId getTextureId () const
 
CADAttributeMapgetAttributeMap ()
 
glm::uvec2 getAttrSize () const
 
size_t getTagCount () const
 
ITagEntry getTagAt (size_t index) const
 
bool empty () const
 
void showAll ()
 
void updateColorById (size_t index, glm::uvec3 color, bool recurse)
 
void updateAlphaById (size_t index, AttributeMapAlpha alpha, bool recurse)
 
bool updateAttributeMap ()
 
void addTag (std::string_view name, int parentId, std::span< const int > children)
 

Private Member Functions

void release ()
 

Private Attributes

Cogs::Core::Contextcontext
 
CADAttributeMap _attributeMap
 
TagContainer tagsTxtEntries
 
ResourceId textureId
 
glm::uvec2 currentAttrSize
 

Detailed Description

Texture resource adding support for Cogs Asset entity Twin way. The texture is used when displaying the asset mapping Asset Tags to displayed properties.

Definition at line 116 of file CADAssetTexture.h.

Constructor & Destructor Documentation

◆ CADAssetTexture()

Cogs::Editor::CADAssetTexture::CADAssetTexture ( Cogs::Core::Context context,
bool  powerOfTwoTextures = true 
)
inline

Initialized the Asset Texture creating the Cogs texture.

Parameters
context- Cogs Context object owning the texture.
powerOfTwoTextures- True if textures must be power of 2

Definition at line 123 of file CADAssetTexture.h.

References Cogs::Editor::CADAttributeMap::resize(), and updateAttributeMap().

◆ ~CADAssetTexture()

Cogs::Editor::CADAssetTexture::~CADAssetTexture ( )
inline

Definition at line 135 of file CADAssetTexture.h.

Member Function Documentation

◆ addTag()

void Cogs::Editor::CADAssetTexture::addTag ( std::string_view  name,
int  parentId,
std::span< const int >  children 
)
inline

Add definition of a CAD tag. Tags must be addef from ID=0 onwards.

Parameters
name- Name of tag.
parentId- ID of parent, -1 = no parents.
children- IDs of children

Definition at line 229 of file CADAssetTexture.h.

References Cogs::Editor::TagContainer::addTag().

◆ empty()

bool Cogs::Editor::CADAssetTexture::empty ( ) const
inline

Definition at line 158 of file CADAssetTexture.h.

◆ getAttributeMap()

CADAttributeMap & Cogs::Editor::CADAssetTexture::getAttributeMap ( )
inline

Gets the attribute map for tags.

Definition at line 146 of file CADAssetTexture.h.

◆ getAttrSize()

glm::uvec2 Cogs::Editor::CADAssetTexture::getAttrSize ( ) const
inline

Gets attr size. E.g. Texture dimension in X and Y.

Definition at line 149 of file CADAssetTexture.h.

References Cogs::Editor::CADAttributeMap::getAttrSize().

◆ getTagAt()

ITagEntry Cogs::Editor::CADAssetTexture::getTagAt ( size_t  index) const
inline

Definition at line 153 of file CADAssetTexture.h.

◆ getTagCount()

size_t Cogs::Editor::CADAssetTexture::getTagCount ( ) const
inline

Definition at line 151 of file CADAssetTexture.h.

◆ getTextureId()

ResourceId Cogs::Editor::CADAssetTexture::getTextureId ( ) const
inline

Gets the Cogs texture resource.

Definition at line 143 of file CADAssetTexture.h.

◆ release()

void Cogs::Editor::CADAssetTexture::release ( )
inlineprivate

Definition at line 235 of file CADAssetTexture.h.

◆ showAll()

void Cogs::Editor::CADAssetTexture::showAll ( )
inline

Reset attributes to show all data using default settings.

Definition at line 163 of file CADAssetTexture.h.

References Cogs::Editor::CADAttributeMap::getDefaultColor(), Cogs::Editor::CADAttributeMap::init(), and updateAttributeMap().

◆ updateAlphaById()

void Cogs::Editor::CADAssetTexture::updateAlphaById ( size_t  index,
AttributeMapAlpha  alpha,
bool  recurse 
)
inline

Update Alpha channel for tag at given index, optionally also updating all children.

Parameters
index- Tag index.
alpha- New Alpha.
recurse- True if also updating children of the tag.

Definition at line 193 of file CADAssetTexture.h.

References Cogs::Editor::ITagEntry::children, Cogs::Editor::CADAttributeMap::growToContainIndex(), Cogs::Editor::CADAttributeMap::setAlpha(), and updateAlphaById().

Referenced by updateAlphaById().

◆ updateAttributeMap()

bool Cogs::Editor::CADAssetTexture::updateAttributeMap ( )
inline

Load Attribute map to Texture

Returns
True if texture is resized.

Definition at line 210 of file CADAssetTexture.h.

References Cogs::Editor::CADAttributeMap::getAttributeMap(), Cogs::Editor::CADAttributeMap::getAttrSize(), Cogs::Core::LinearColorSpace, and Cogs::Core::NoMipMaps.

Referenced by CADAssetTexture(), and showAll().

◆ updateColorById()

void Cogs::Editor::CADAssetTexture::updateColorById ( size_t  index,
glm::uvec3  color,
bool  recurse 
)
inline

Update attributes for tag at given index, optionally also updating all children.

Parameters
index- Tag index.
color- New color. RGB Range (0-255)
recurse- True if also updating children of the tag.

Definition at line 174 of file CADAssetTexture.h.

References Cogs::Editor::ITagEntry::children, Cogs::Editor::CADAttributeMap::growToContainIndex(), Cogs::Editor::CADAttributeMap::setColor(), and updateColorById().

Referenced by updateColorById().

Member Data Documentation

◆ _attributeMap

CADAttributeMap Cogs::Editor::CADAssetTexture::_attributeMap
private

Definition at line 245 of file CADAssetTexture.h.

◆ context

Cogs::Core::Context* Cogs::Editor::CADAssetTexture::context
private

Definition at line 244 of file CADAssetTexture.h.

◆ currentAttrSize

glm::uvec2 Cogs::Editor::CADAssetTexture::currentAttrSize
private

Definition at line 248 of file CADAssetTexture.h.

◆ tagsTxtEntries

TagContainer Cogs::Editor::CADAssetTexture::tagsTxtEntries
private

Definition at line 246 of file CADAssetTexture.h.

◆ textureId

ResourceId Cogs::Editor::CADAssetTexture::textureId
private

Definition at line 247 of file CADAssetTexture.h.


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