FineKernelToolKit 4.2.13
読み取り中…
検索中…
一致する文字列を見つけられません
公開メンバ関数 | 全メンバ一覧
FK::fk_TriTexture クラス

3角形テクスチャを生成、管理するクラス [詳解]

#include <FK/TriTexture.h>

+ FK::fk_TriTexture の継承関係図
+ FK::fk_TriTexture 連携図

公開メンバ関数

 fk_TriTexture (fk_Image *image=nullptr)
 コンストラクタ
 
virtual ~fk_TriTexture ()
 デストラクタ
 
void init (void)
 初期化関数
 
bool setTextureCoord (int ID, double x, double y)
 テクスチャ座標設定関数1
 
bool setTextureCoord (int ID, fk_TexCoord coord)
 テクスチャ座標設定関数2
 
fk_TexCoord getTextureCoord (int ID)
 テクスチャ座標取得関数
 
bool setVertexPos (int ID, double x, double y, double z)
 頂点位置ベクトル設定関数1
 
bool setVertexPos (int ID, fk_Vector pos)
 頂点位置ベクトル設定関数2
 
fk_Vector getVertexPos (int ID)
 頂点位置ベクトル取得関数
 
- 基底クラス FK::fk_Texture に属する継承公開メンバ関数
void setImage (fk_Image *image)
 画像データ設定関数
 
fk_ImagegetImage (void)
 画像データ取得関数
 
bool readBMP (std::string fileName)
 BMP ファイル入力関数
 
bool readBMPData (fk_ImType *buf)
 BMP バッファ入力関数
 
bool readPNG (std::string fileName)
 PNG ファイル入力関数
 
bool readPNGData (fk_ImType *buf)
 PNG バッファ入力関数
 
bool readJPG (std::string fileName)
 JPEG ファイル入力関数
 
const fk_DimensiongetImageSize (void)
 画像サイズ取得関数
 
const fk_DimensiongetBufferSize (void)
 画像バッファサイズ取得関数
 
void setTextureMode (fk_TexMode mode)
 テクスチャモード設定関数
 
fk_TexMode getTextureMode (void)
 テクスチャモード取得関数
 
void setTexRendMode (fk_TexRendMode mode)
 テクスチャ描画品質設定関数
 
fk_TexRendMode getTexRendMode (void)
 テクスチャ描画品質取得関数
 
void setTexWrapMode (fk_TexWrapMode mode)
 テクスチャ外周部モード設定関数
 
fk_TexWrapMode getTexWrapMode (void)
 テクスチャ外周部モード取得関数
 
void fillColor (const fk_Color &color)
 一様色初期化関数1
 
void fillColor (int r, int g, int b, int a=0)
 一様色初期化関数2
 
const fk_ImType * getImageBuf (void)
 画像データ配列先頭アドレス取得関数

 
void setFrameBuffer (fk_FrameBuffer *buffer)
 フレームバッファー設定関数
 
fk_FrameBuffergetFrameBuffer (void)
 フレームバッファー取得関数
 
void initFrameBuffer (void)
 フレームバッファー情報初期化関数
 
- 基底クラス FK::fk_Shape に属する継承公開メンバ関数
 fk_Shape (fk_Type=fk_Type::SHAPE)
 コンストラクタ
 
virtual ~fk_Shape ()
 デストラクタ
 
fk_RealShapeType getRealShapeType (void)
 形状データ構造取得関数
 
void setShaderAttribute (std::string name, int dim, std::vector< int > *array, bool self=false)
 シェーダー内 attribute 変数設定関数1
 
void setShaderAttribute (std::string name, int dim, std::vector< float > *array, bool self=false)
 シェーダー内 attribute 変数設定関数2
 
void setShaderAttribute (std::string name, int dim, std::vector< fk_Vector > *array)
 シェーダー内 attribute 変数設定関数3
 
void setShaderAttribute (std::string name, int dim, std::vector< fk_TexCoord > *array)
 シェーダー内 attribute 変数設定関数4
 
void setShaderAttribute (std::string name, int dim, std::vector< fk_HVector > *array)
 シェーダー内 attribute 変数設定関数5
 
void modifyAttribute (std::string name)
 attribute 変数更新関数
 
- 基底クラス FK::fk_Attribute に属する継承公開メンバ関数
 fk_Attribute (void)
 コンストラクタ
 
virtual ~fk_Attribute ()
 デストラクタ
 
bool setAttrII (const int key, const int value)
 キーが int 型、値が int 型である属性設定関数
 
bool setAttrID (const int key, const double value)
 キーが int 型、値が double 型である属性設定関数
 
bool setAttrIS (const int key, const std::string value)
 キーが int 型、値が std::string 型である属性設定関数
 
bool setAttrSI (const std::string key, const int value)
 キーが std::string 型、値が int 型である属性設定関数
 
bool setAttrSD (const std::string key, const double value)
 キーが std::string 型、値が double 型である属性設定関数
 
bool setAttrSS (const std::string key, const std::string value)
 キーが std::string 型、値が std::string 型である属性設定関数
 
int getAttrII (const int key) const
 キーが int 型、値が int 型である属性参照関数
 
double getAttrID (const int key) const
 キーが int 型、値が double 型である属性参照関数
 
std::string getAttrIS (const int key) const
 キーが int 型、値が std::string 型である属性参照関数
 
int getAttrSI (const std::string key) const
 キーが std::string 型、値が int 型である属性参照関数
 
double getAttrSD (const std::string key) const
 キーが std::string 型、値が double 型である属性参照関数
 
std::string getAttrSS (const std::string key) const
 キーが std::string 型、値が std::string 型である属性参照関数
 
bool existAttrII (const int key) const
 キーが int 型、値が int 型である属性存在参照関数
 
bool existAttrID (const int key) const
 キーが int 型、値が double 型である属性存在参照関数
 
bool existAttrIS (const int key) const
 キーが int 型、値が std::string 型である属性存在参照関数
 
bool existAttrSI (const std::string key) const
 キーが std::string 型、値が int 型である属性存在参照関数
 
bool existAttrSD (const std::string key) const
 キーが std::string 型、値が double 型である属性存在参照関数
 
bool existAttrSS (const std::string key) const
 キーが std::string 型、値が std::string 型である属性存在参照関数
 
bool deleteAttrII (const int key)
 キーが int 型、値が int 型である属性消去関数
 
bool deleteAttrID (const int key)
 キーが int 型、値が double 型である属性消去関数
 
bool deleteAttrIS (const int key)
 キーが int 型、値が std::string 型である属性消去関数
 
bool deleteAttrSI (const std::string key)
 キーが std::string 型、値が int 型である属性消去関数
 
bool deleteAttrSD (const std::string key)
 キーが std::string 型、値が double 型である属性消去関数
 
bool deleteAttrSS (const std::string key)
 キーが std::string 型、値が std::string 型である属性消去関数
 
- 基底クラス FK::fk_BaseObject に属する継承公開メンバ関数
 fk_BaseObject (fk_Type type=fk_Type::BASEOBJECT)
 コンストラクタ
 
fk_Type getObjectType (void) const
 タイプ取得関数
 

詳解

3角形テクスチャを生成、管理するクラス

このクラスは、3角形のテクスチャを制御する機能を提供します。

3角形テクスチャを生成する大まかな手順は以下のようになります。

  1. 画像を入力する。
  2. 各頂点のテクスチャ座標を設定する。
  3. 各頂点の3次元空間内の位置ベクトルを設定する。

空間上に各頂点を配置する際、頂点の順番が反時計回りになっている側が表面となります。 テクスチャ座標系の方は必ずしも反時計回りになっている必要はありませんが、 それが時計回りである場合は表示される画像が結果的に裏返ります。

本クラスでは、1つのインスタンスで制御できる3角形は1枚のみです。 複数枚の3角形を1つのインスタンスで制御したい場合は、 fk_MeshTexture クラスを用いた方がメモリ使用量や描画速度の効率が良くなります。 また、3角形ではなく矩形を扱いたい場合は fk_RectTexture クラスを利用して下さい。

参照
fk_Texture, fk_RectTexture, fk_MeshTexture, fk_IFSTexture

構築子と解体子

◆ fk_TriTexture()

FK::fk_TriTexture::fk_TriTexture ( fk_Image image = nullptr)

コンストラクタ

引数
[in]imageテクスチャ画像。省略するか nullptr を代入した場合は、 テクスチャ画像を初期状態では生成しません。

◆ ~fk_TriTexture()

virtual FK::fk_TriTexture::~fk_TriTexture ( )
virtual

デストラクタ

関数詳解

◆ init()

void FK::fk_TriTexture::init ( void  )

初期化関数

現在設定されているテクスチャ画像を廃棄し、全ての設定を初期状態に戻します。

◆ setTextureCoord() [1/2]

bool FK::fk_TriTexture::setTextureCoord ( int  ID,
double  x,
double  y 
)

テクスチャ座標設定関数1

頂点のテクスチャ座標を設定します。 テクスチャ座標系については fk_TexCoord の説明を参照して下さい。 テクスチャ座標は、一度設定した後でも動的に変更することが可能です。

引数
[in]ID頂点ID。0, 1, 2 のいずれかになります。 それ以外の値を入力した場合はエラーとなり、false を返します。
[in]xテクスチャ座標の x 成分。0 以上 1 以下である必要があります。 それ以外の値を入力した場合はエラーとなり、false を返します。
[in]yテクスチャ座標の y 成分。0 以上 1 以下である必要があります。 それ以外の値を入力した場合はエラーとなり、false を返します。
戻り値
設定に成功した場合 true を、失敗した場合 false を返します。

◆ setTextureCoord() [2/2]

bool FK::fk_TriTexture::setTextureCoord ( int  ID,
fk_TexCoord  coord 
)

テクスチャ座標設定関数2

頂点のテクスチャ座標を設定します。 テクスチャ座標系については fk_TexCoord の説明を参照して下さい。 テクスチャ座標は、一度設定した後でも動的に変更することが可能です。

引数
[in]ID頂点ID。0, 1, 2 のいずれかになります。 それ以外の値を入力した場合はエラーとなり、false を返します。
[in]coordテクスチャ座標。各成文は 0 以上 1 以下である必要があります。 それ以外の値を入力した場合はエラーとなり、false を返します。
戻り値
設定に成功した場合 true を、失敗した場合 false を返します。

◆ getTextureCoord()

fk_TexCoord FK::fk_TriTexture::getTextureCoord ( int  ID)

テクスチャ座標取得関数

setTextureCoord() で設定したテクスチャ座標を取得します。

引数
[in]ID頂点ID。 0, 1, 2 のいずれか以外を指定した場合は、 常に (0, 0) を返します。
戻り値
IDに対応する頂点のテクスチャ座標

◆ setVertexPos() [1/2]

bool FK::fk_TriTexture::setVertexPos ( int  ID,
double  x,
double  y,
double  z 
)

頂点位置ベクトル設定関数1

頂点の空間中での位置ベクトルを設定します。 位置ベクトルは、一度設定した後でも動的に変更することが可能です。

引数
[in]ID頂点ID。0, 1, 2 のいずれかになります。 それ以外の値を入力した場合はエラーとなり、false を返します。
[in]x頂点位置ベクトルの x 成分
[in]y頂点位置ベクトルの y 成分
[in]z頂点位置ベクトルの z 成分
戻り値
設定に成功した場合 true を、失敗した場合 false を返します。

◆ setVertexPos() [2/2]

bool FK::fk_TriTexture::setVertexPos ( int  ID,
fk_Vector  pos 
)

頂点位置ベクトル設定関数2

頂点の空間中での位置ベクトルを設定します。 位置ベクトルは、一度設定した後でも動的に変更することが可能です。

引数
[in]ID頂点ID。0, 1, 2 のいずれかになります。 それ以外の値を入力した場合はエラーとなり、false を返します。
[in]pos頂点位置ベクトル
戻り値
設定に成功した場合 true を、失敗した場合 false を返します。

◆ getVertexPos()

fk_Vector FK::fk_TriTexture::getVertexPos ( int  ID)

頂点位置ベクトル取得関数

setTexturePos() で設定したテクスチャ座標を取得します。

引数
[in]ID頂点ID。 0, 1, 2 のいずれか以外を指定した場合は、 常に (0, 0, 0) を返します。
戻り値
IDに対応する頂点の位置ベクトル