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

形状用基底クラス [詳解]

#include <FK/Shape.h>

+ FK::fk_Shape の継承関係図
+ 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
 タイプ取得関数
 

詳解

形状用基底クラス

このクラスは、形状を表すクラスの基底クラスです。 クラス自体の主な機能は、マテリアルの管理です。

参照
fk_Material

構築子と解体子

◆ fk_Shape()

FK::fk_Shape::fk_Shape ( fk_Type  = fk_Type::SHAPE)

コンストラクタ

◆ ~fk_Shape()

virtual FK::fk_Shape::~fk_Shape ( )
virtual

デストラクタ

関数詳解

◆ getRealShapeType()

fk_RealShapeType FK::fk_Shape::getRealShapeType ( void  )

形状データ構造取得関数

格納されているインスタンスの具体的なデータ構造を取得します。

戻り値
格納データ構造

◆ setShaderAttribute() [1/5]

void FK::fk_Shape::setShaderAttribute ( std::string  name,
int  dim,
std::vector< int > *  array,
bool  self = false 
)

シェーダー内 attribute 変数設定関数1

形状の各頂点に対応した attribute 変数値を整数型で登録します。

ここで登録する要素数は形状の頂点数、 厳密にはデータ要素数よりも多数である必要があります。

引数
[in]nameGLSL内での変数名
[in]dim変数の次元数で、1から4まで設定することができます。 GLSL内での型は、1から順に int, ivec2, ivec3, ivec4 となります。
[in]arrayattribute 変数として転送するデータのポインタ。 このコンテナのサイズは、形状の頂点数と次元数の積以上である必要があります。
[in]selfこの引数が true の場合、 GPUに転送するデータ領域はインスタンスの内部に新たに確保されます。 その場合は本関数を使用後、array で指定した領域は解放しても問題ありません。 ただし、領域確保とデータコピーのため動作は遅くなります。 この引数が false の場合は、 GPUに転送するデータ領域として array をそのまま利用するため、 本関数利用後に array を解放するとプログラムが異常終了する恐れがあります。 本引数を省略した場合は false を指定したことと同義となります。
覚え書き
ここで設定した attribute 変数用データに変更があった場合で、 self が false だった場合は、 再度本関数を呼ぶよりも modifyAttribute() を呼ぶ方が高速に処理が行えます。 self が true だった場合は、 modifyAttribute() を呼んでも 変更は反映されませんので、再度本関数を呼び出す必要があります。

◆ setShaderAttribute() [2/5]

void FK::fk_Shape::setShaderAttribute ( std::string  name,
int  dim,
std::vector< float > *  array,
bool  self = false 
)

シェーダー内 attribute 変数設定関数2

形状の各頂点に対応した attribute 変数値を浮動小数点型で登録します。

ここで登録する要素数は形状の頂点数、 厳密にはデータ要素数よりも多数である必要があります。

引数
[in]nameGLSL内での変数名
[in]dim変数の次元数で、1から4まで設定することができます。 GLSL内での型は、1から順に float, vec2, vec3, vec4 となります。
[in]arrayattribute 変数として転送するデータのポインタ。 このコンテナのサイズは、形状の頂点数と次元数の積以上である必要があります。
[in]selfこの引数が true の場合、 GPUに転送するデータ領域はインスタンスの内部に新たに確保されます。 その場合は本関数を使用後、array で指定した領域は解放しても問題ありません。 ただし、領域確保とデータコピーのため動作は遅くなります。 この引数が false の場合は、 GPUに転送するデータ領域として array をそのまま利用するため、 本関数利用後に array を解放するとプログラムが異常終了する恐れがあります。 本引数を省略した場合は false を指定したことと同義となります。
覚え書き
ここで設定した attribute 変数用データに変更があった場合で、 self が false だった場合は、 再度本関数を呼ぶよりも modifyAttribute() を呼ぶ方が高速に処理が行えます。 self が true だった場合は、 modifyAttribute() を呼んでも 変更は反映されませんので、再度本関数を呼び出す必要があります。

◆ setShaderAttribute() [3/5]

void FK::fk_Shape::setShaderAttribute ( std::string  name,
int  dim,
std::vector< fk_Vector > *  array 
)

シェーダー内 attribute 変数設定関数3

形状の各頂点に対応した attribute 変数値を fk_Vector 型で登録します。

ここで登録する要素数は形状の頂点数、 厳密にはデータ要素数よりも多数である必要があります。

引数
[in]nameGLSL内での変数名
[in]dim変数の次元数で、1から4まで設定することができます。 GLSL内での型は、1から順に float, vec2, vec3, vec4 となります。 1 を指定した場合、y,z 成分は無視されます。 2 を指定した場合、z 成分は無視されます。 4 を指定した場合、第4成分 (w成分) は 0 となります。
[in]arrayattribute 変数として転送するデータのポインタ。 このコンテナのサイズは、形状の頂点数と次元数の積以上である必要があります。
覚え書き
ここで設定した attribute 変数用データに変更があった場合は、 再度本関数を呼び出す必要があります。 modifyAttribute() を呼び出しても変更は反映されないので、注意して下さい。

◆ setShaderAttribute() [4/5]

void FK::fk_Shape::setShaderAttribute ( std::string  name,
int  dim,
std::vector< fk_TexCoord > *  array 
)

シェーダー内 attribute 変数設定関数4

形状の各頂点に対応した attribute 変数値を fk_TexCoord 型で登録します。

ここで登録する要素数は形状の頂点数、 厳密にはデータ要素数よりも多数である必要があります。

引数
[in]nameGLSL内での変数名
[in]dim変数の次元数で、1から4まで設定することができます。 GLSL内での型は、1から順に float, vec2, vec3, vec4 となります。 1 を指定した場合、y 成分は無視されます。 3,4 を指定した場合、第3,4成分 (z,w成分) は 0 となります。
[in]arrayattribute 変数として転送するデータのポインタ。 このコンテナのサイズは、形状の頂点数と次元数の積以上である必要があります。
覚え書き
ここで設定した attribute 変数用データに変更があった場合は、 再度本関数を呼び出す必要があります。 modifyAttribute() を呼び出しても変更は反映されないので、注意して下さい。

◆ setShaderAttribute() [5/5]

void FK::fk_Shape::setShaderAttribute ( std::string  name,
int  dim,
std::vector< fk_HVector > *  array 
)

シェーダー内 attribute 変数設定関数5

形状の各頂点に対応した attribute 変数値を fk_HVector 型で登録します。

ここで登録する要素数は形状の頂点数、 厳密にはデータ要素数よりも多数である必要があります。

引数
[in]nameGLSL内での変数名
[in]dim変数の次元数で、1から4まで設定することができます。 GLSL内での型は、1から順に float, vec2, vec3, vec4 となります。 1 を指定した場合は y,z,w 成分は無視されます。 2 を指定した場合は z,w 成分は無視されます。 3 を指定した場合は、w 成分は無視されま。
[in]arrayattribute 変数として転送するデータのポインタ。 このコンテナのサイズは、形状の頂点数と次元数の積以上である必要があります。
覚え書き
ここで設定した attribute 変数用データに変更があった場合は、 再度本関数を呼び出す必要があります。 modifyAttribute() を呼び出しても変更は反映されないので、注意して下さい。

◆ modifyAttribute()

void FK::fk_Shape::modifyAttribute ( std::string  name)

attribute 変数更新関数

attribute 変数用データに変更があった場合、 この関数を呼ぶ必要があります。この関数が呼ばれると、 対象となる attribute 変数用のデータは描画時に CPU から GPU へデータの転送が行われます。 もしこの関数が呼ばれないと、内部データが変更されても描画には反映されません。

引数
[in]name対象となる attribute 変数の GLSL 内での変数名
覚え書き
本関数は、 setShaderAttribute(std::string, int, std::vector<int> *, bool) または setShaderAttribute(std::string, int, std::vector<float> *, bool) で 第4引数に false を用いた場合のみに有効です。 第4引数に true を用いた場合や、その他の形式の attribute 変数設定に対しては、 本関数によって変更反映を行うことはできません。