Cafu Engine
MapCompositionT Class Reference

A MapCompositionT is a description of how a SINGLE texture map image is composited from several source images on disk. More...

#include "MapComposition.hpp"

Public Types

enum  MinMagFiltersT {
  Nearest, Linear, Nearest_MipMap_Nearest, Nearest_MipMap_Linear,
  Linear_MipMap_Nearest, Linear_MipMap_Linear
}
 This enum describes the filter mode of this map composition, kept in the root MapCompositionT (the children just keep the default values). More...
 
enum  WrapModesT { Repeat, Clamp, ClampToEdge }
 This enum describes the wrap mode of this map composition, kept in the root MapCompositionT (the children just keep the default values). More...
 
enum  TypeT {
  Empty, Map, Add, Mul,
  CombineNormals, HeightMapToNormalMap, FlipNormalMapYAxis, ReNormalize,
  BlueToAlpha
}
 This enum describes the type of the map composition. More...
 

Public Member Functions

 MapCompositionT (MinMagFiltersT MinFilter_=Linear_MipMap_Linear, MinMagFiltersT MagFilter_=Linear, WrapModesT WrapS_=Repeat, WrapModesT WrapT_=Repeat, bool NoScaleDown_=false, bool NoCompression_=false)
 Constructor for creating an "empty" map composition. More...
 
 MapCompositionT (const std::string &s, const std::string &BaseDir_)
 Constructor for creating a MapCompositionT from a string description. More...
 
 MapCompositionT (TextParserT &TP, const std::string &BaseDir_, bool NoCompression_=false, const unsigned long RecursionCount=0)
 Constructor for creating a MapCompositionT from TextParserT input. More...
 
 MapCompositionT (const MapCompositionT &Source)
 Copy Constructor (Law of the Big Three). More...
 
 ~MapCompositionT ()
 Destructor (Law of the Big Three). More...
 
MapCompositionToperator= (const MapCompositionT &Source)
 Assignment Operator (Law of the Big Three). More...
 
bool operator== (const MapCompositionT &rhs) const
 Equal Operator. More...
 
bool IsEmpty () const
 Returns true iff this MapComposition is empty. More...
 
const MapCompositionTGetChild (int Num) const
 Returns one of the children of this MapCompositionT. More...
 
MinMagFiltersT GetMinFilter () const
 Returns the filter for minification. More...
 
MinMagFiltersT GetMagFilter () const
 Returns the filter for magnification. More...
 
WrapModesT GetWrapModeS () const
 Returns the wrapping mode in s-direction. More...
 
WrapModesT GetWrapModeT () const
 Returns the wrapping mode in t-direction. More...
 
bool GetNoScaleDown () const
 Returns whether the texture should not be scaled down (e.g. for optimizing performance). More...
 
bool GetNoCompression () const
 Returns whether the texture should not be compressed (e.g. for optimizing performance/memory). More...
 
TypeT GetType () const
 Returns the type of this map composition. More...
 
BitmapTGetBitmap () const
 This function loads all image source files from disk (at *BaseDir+FileName), and combines them (according to this MapCompositionT) into a single resulting BitmapT. More...
 
std::string GetString () const
 Returns a string description of this MapCompositionT (quasi the counter-piece to the constructor). More...
 
std::string GetStringWithOptions (bool NoCompressionDefault=false) const
 Like GetString(), which is kept for backwards-compatibility, but includes the list of options as well. More...
 
std::string GetBaseDir () const
 Returns the base dir of this MapCompositionT. Can be the empty string for empty map compositions. More...
 

Detailed Description

A MapCompositionT is a description of how a SINGLE texture map image is composited from several source images on disk.

(Each material stage has an own MatCompositionT. Each frame of an animated sequence, too. Don't know yet about videos.)

Member Enumeration Documentation

This enum describes the filter mode of this map composition, kept in the root MapCompositionT (the children just keep the default values).

This enum describes the type of the map composition.

Note that there is no scaling operation - scaling is automatic. TODO: Operations for the alpha-channel: e.g. taking it from the red channel of another image...

This enum describes the wrap mode of this map composition, kept in the root MapCompositionT (the children just keep the default values).

Constructor & Destructor Documentation

MapCompositionT::MapCompositionT ( MinMagFiltersT  MinFilter_ = Linear_MipMap_Linear,
MinMagFiltersT  MagFilter_ = Linear,
WrapModesT  WrapS_ = Repeat,
WrapModesT  WrapT_ = Repeat,
bool  NoScaleDown_ = false,
bool  NoCompression_ = false 
)

Constructor for creating an "empty" map composition.

MapCompositionT::MapCompositionT ( const std::string &  s,
const std::string &  BaseDir_ 
)

Constructor for creating a MapCompositionT from a string description.

MapCompositionT::MapCompositionT ( TextParserT TP,
const std::string &  BaseDir_,
bool  NoCompression_ = false,
const unsigned long  RecursionCount = 0 
)

Constructor for creating a MapCompositionT from TextParserT input.

MapCompositionT::MapCompositionT ( const MapCompositionT Source)

Copy Constructor (Law of the Big Three).

MapCompositionT::~MapCompositionT ( )

Destructor (Law of the Big Three).

Member Function Documentation

std::string MapCompositionT::GetBaseDir ( ) const

Returns the base dir of this MapCompositionT. Can be the empty string for empty map compositions.

BitmapT * MapCompositionT::GetBitmap ( ) const

This function loads all image source files from disk (at *BaseDir+FileName), and combines them (according to this MapCompositionT) into a single resulting BitmapT.

On any error with the participating bitmaps (ie. file not found, file unreadable, ...), a default texture is substituted for the missing participant, and a warning is printed out. Thus, the function never fails. The caller becomes the owner of the returned pointer (i.e. its the callers responsibility to delete it.)

const MapCompositionT* MapCompositionT::GetChild ( int  Num) const
inline

Returns one of the children of this MapCompositionT.

Use this method together with GetType().

MinMagFiltersT MapCompositionT::GetMagFilter ( ) const
inline

Returns the filter for magnification.

MinMagFiltersT MapCompositionT::GetMinFilter ( ) const
inline

Returns the filter for minification.

bool MapCompositionT::GetNoCompression ( ) const
inline

Returns whether the texture should not be compressed (e.g. for optimizing performance/memory).

bool MapCompositionT::GetNoScaleDown ( ) const
inline

Returns whether the texture should not be scaled down (e.g. for optimizing performance).

std::string MapCompositionT::GetString ( ) const

Returns a string description of this MapCompositionT (quasi the counter-piece to the constructor).

std::string MapCompositionT::GetStringWithOptions ( bool  NoCompressionDefault = false) const

Like GetString(), which is kept for backwards-compatibility, but includes the list of options as well.

TypeT MapCompositionT::GetType ( ) const
inline

Returns the type of this map composition.

WrapModesT MapCompositionT::GetWrapModeS ( ) const
inline

Returns the wrapping mode in s-direction.

WrapModesT MapCompositionT::GetWrapModeT ( ) const
inline

Returns the wrapping mode in t-direction.

bool MapCompositionT::IsEmpty ( ) const
inline

Returns true iff this MapComposition is empty.

MapCompositionT & MapCompositionT::operator= ( const MapCompositionT Source)

Assignment Operator (Law of the Big Three).

bool MapCompositionT::operator== ( const MapCompositionT rhs) const

Equal Operator.

Treats Add, Mul and CombineNormals as commutative (a+b==b+a), but never takes the associative or distributive law into account.


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