Graphics/InstancedRenderable: Add Clone method

This commit is contained in:
Lynix
2018-06-06 19:36:46 +02:00
parent 2f0c62df20
commit bc2f6f67cc
16 changed files with 70 additions and 8 deletions

View File

@@ -27,6 +27,14 @@ namespace Nz
renderQueue->AddBillboards(instanceData.renderOrder, GetMaterial(), 1, scissorRect, &position, &m_size, &m_sinCos, &m_color);
}
/*!
* \brief Clones this billboard
*/
std::unique_ptr<InstancedRenderable> Billboard::Clone() const
{
return std::make_unique<Billboard>(*this);
}
/*
* \brief Makes the bounding volume of this billboard
*/

View File

@@ -51,7 +51,6 @@ namespace Nz
* \param renderQueue Queue to be added
* \param instanceData Data used for this instance
*/
void Model::AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData, const Recti& scissorRect) const
{
unsigned int submeshCount = m_mesh->GetSubMeshCount();
@@ -69,6 +68,14 @@ namespace Nz
}
}
/*!
* \brief Clones this model
*/
std::unique_ptr<InstancedRenderable> Model::Clone() const
{
return std::make_unique<Model>(*this);
}
/*!
* \brief Gets the material of the named submesh
* \return Pointer to the current material

View File

@@ -126,10 +126,9 @@ namespace Nz
* \brief Clones this skeletal model
* \return Pointer to newly allocated SkeletalModel
*/
SkeletalModel* SkeletalModel::Clone() const
std::unique_ptr<InstancedRenderable> SkeletalModel::Clone() const
{
return new SkeletalModel(*this);
return std::make_unique<SkeletalModel>(*this);
}
/*!

View File

@@ -21,17 +21,23 @@ namespace Nz
* \param renderQueue Queue to be added
* \param instanceData Data for the instance
*/
void Sprite::AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData, const Recti& scissorRect) const
{
const VertexStruct_XYZ_Color_UV* vertices = reinterpret_cast<const VertexStruct_XYZ_Color_UV*>(instanceData.data.data());
renderQueue->AddSprites(instanceData.renderOrder, GetMaterial(), vertices, 1, scissorRect);
}
/*!
* \brief Clones this sprite
*/
std::unique_ptr<InstancedRenderable> Sprite::Clone() const
{
return std::make_unique<Sprite>(*this);
}
/*!
* \brief Makes the bounding volume of this text
*/
void Sprite::MakeBoundingVolume() const
{
Vector3f origin(m_origin.x, -m_origin.y, m_origin.z);

View File

@@ -41,6 +41,14 @@ namespace Nz
}
}
/*!
* \brief Clones this text sprite
*/
std::unique_ptr<InstancedRenderable> TextSprite::Clone() const
{
return std::make_unique<TextSprite>(*this);
}
/*!
* \brief Updates the text
*

View File

@@ -37,6 +37,14 @@ namespace Nz
}
}
/*!
* \brief Clones this tilemap
*/
std::unique_ptr<InstancedRenderable> TileMap::Clone() const
{
return std::make_unique<TileMap>(*this);
}
void TileMap::MakeBoundingVolume() const
{
Nz::Vector2f size = GetSize();