OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Model Class Reference

3D モデル More...

#include <Model.hpp>

Inherits s3d::AssetHandle< Model >.

Public Member Functions

SIV3D_NODISCARD_CXX20 Model ()
 デフォルトコンストラクタ More...
 
SIV3D_NODISCARD_CXX20 Model (FilePathView path, ColorOption colorOption=ColorOption::Default)
 3D モデルを読み込みます。 More...
 
virtual ~Model ()
 デストラクタ More...
 
const Array< ModelObject > & objects () const noexcept
 3D モデルを構成するモデルパーツ一覧を返します。 More...
 
const Array< Material > & materials () const noexcept
 3D モデルに登録されているマテリアル一覧を返します。 More...
 
Array< String > diffuseTextureNames () const
 3D モデルに登録されているディフューズテクスチャの名前(パス)を返します。 More...
 
const Sphere & boundingSphere () const noexcept
 3D モデルのバウンディングスフィアを返します。 More...
 
const Box & boundingBox () const noexcept
 3D モデルのバウンディングボックスを返します。 More...
 
void draw () const
 3D モデルを描画します。 More...
 
void draw (double x, double y, double z) const
 3D モデルを描画します。 More...
 
void draw (const Vec3 &pos) const
 3D モデルを描画します。 More...
 
void draw (double x, double y, double z, const Quaternion &rotation) const
 3D モデルを描画します。 More...
 
void draw (const Vec3 &pos, const Quaternion &rotation) const
 3D モデルを描画します。 More...
 
void draw (const Mat4x4 &mat) const
 3D モデルを描画します。 More...
 
void swap (Model &other) noexcept
 別の 3D モデルと中身を交換します。 More...
 
- Public Member Functions inherited from s3d::AssetHandle< Model >
SIV3D_NODISCARD_CXX20 AssetHandle ()
 
SIV3D_NODISCARD_CXX20 AssetHandle (std::shared_ptr< AssetIDWrapperType > &&id)
 
IDType id () const noexcept
 アセットの内部管理 ID を返します。 More...
 
bool isEmpty () const noexcept
 アセットが空であるかを返します。 More...
 
 operator bool () const noexcept
 アセットが空でないかを返します。 More...
 
bool operator== (const AssetHandle &other) const noexcept
 2 つのアセットが同じオブジェクトであるかを返します。 More...
 
bool operator!= (const AssetHandle &other) const noexcept
 2 つのアセットが異なるオブジェクトであるかを返します。 More...
 
void release ()
 このハンドルが管理するアセットを解放します。 More...
 

Static Public Member Functions

static bool RegisterDiffuseTextures (const Model &model, TextureDesc textureDesc=TextureDesc::MippedSRGB)
 3D モデルに含まれるテクスチャ情報をもとに、テクスチャアセットを登録します。 More...
 

Additional Inherited Members

- Public Types inherited from s3d::AssetHandle< Model >
using AssetIDWrapperType = AssetIDWrapper< AssetHandle >
 アセット ID ラッパー型 More...
 
using IDType = typename AssetIDWrapperType::IDType
 アセット ID 型 More...
 
- Protected Attributes inherited from s3d::AssetHandle< Model >
std::shared_ptr< AssetIDWrapperType > m_handle
 

Detailed Description

3D モデル

Constructor & Destructor Documentation

◆ Model() [1/2]

SIV3D_NODISCARD_CXX20 s3d::Model::Model ( )

デフォルトコンストラクタ

◆ Model() [2/2]

SIV3D_NODISCARD_CXX20 s3d::Model::Model ( FilePathView  path,
ColorOption  colorOption = ColorOption::Default 
)
explicit

3D モデルを読み込みます。

Parameters
pathファイルのパス(対応している形式は Wavefront OBJ)
colorOption色空間

◆ ~Model()

virtual s3d::Model::~Model ( )
virtual

デストラクタ

Member Function Documentation

◆ boundingBox()

const Box& s3d::Model::boundingBox ( ) const
noexcept

3D モデルのバウンディングボックスを返します。

Remarks
バウンディングボックスは計算済みであるため、この関数のコストは小さいです。
Returns
3D モデルのバウンディングボックス

◆ boundingSphere()

const Sphere& s3d::Model::boundingSphere ( ) const
noexcept

3D モデルのバウンディングスフィアを返します。

Remarks
バウンディングスフィアは計算済みであるため、この関数のコストは小さいです。
Returns
3D モデルのバウンディングスフィア

◆ diffuseTextureNames()

Array<String> s3d::Model::diffuseTextureNames ( ) const

3D モデルに登録されているディフューズテクスチャの名前(パス)を返します。

Returns
3D モデルに登録されているディフューズテクスチャの名前(パス)一覧

◆ draw() [1/6]

void s3d::Model::draw ( ) const

3D モデルを描画します。

◆ draw() [2/6]

void s3d::Model::draw ( const Mat4x4 &  mat) const

3D モデルを描画します。

Parameters
mat座標変換行列

◆ draw() [3/6]

void s3d::Model::draw ( const Vec3 &  pos) const

3D モデルを描画します。

Parameters
posワールドの座標

◆ draw() [4/6]

void s3d::Model::draw ( const Vec3 &  pos,
const Quaternion &  rotation 
) const

3D モデルを描画します。

Parameters
posワールドの座標
rotation回転

◆ draw() [5/6]

void s3d::Model::draw ( double  x,
double  y,
double  z 
) const

3D モデルを描画します。

Parameters
xワールドの X 座標
yワールドの Y 座標
zワールドの Z 座標

◆ draw() [6/6]

void s3d::Model::draw ( double  x,
double  y,
double  z,
const Quaternion &  rotation 
) const

3D モデルを描画します。

Parameters
xワールドの X 座標
yワールドの Y 座標
zワールドの Z 座標
rotation回転

◆ materials()

const Array<Material>& s3d::Model::materials ( ) const
noexcept

3D モデルに登録されているマテリアル一覧を返します。

Returns
3D モデルに登録されているマテリアル一覧

◆ objects()

const Array<ModelObject>& s3d::Model::objects ( ) const
noexcept

3D モデルを構成するモデルパーツ一覧を返します。

Returns
3D モデルを構成するモデルパーツ一覧

◆ RegisterDiffuseTextures()

static bool s3d::Model::RegisterDiffuseTextures ( const Model &  model,
TextureDesc  textureDesc = TextureDesc::MippedSRGB 
)
static

3D モデルに含まれるテクスチャ情報をもとに、テクスチャアセットを登録します。

Parameters
model3D モデル
textureDescテクスチャの設定
Returns
テクスチャアセットの登録に成功した場合 true, それ以外の場合は false

◆ swap()

void s3d::Model::swap ( Model &  other)
noexcept

別の 3D モデルと中身を交換します。

Parameters
other別の 3D モデル

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