Utility/MeshParam: Use constref instead of pointer

This commit is contained in:
Lynix 2017-10-19 21:05:48 +02:00
parent e0bdd35280
commit 995dfddafa
3 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@
Nazara Engine: Nazara Engine:
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. - VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.
- MeshParams now hold a ConstRef to the VertexDeclaration (preventing it to be freed before usage)
# 0.4: # 0.4:

View File

@ -48,7 +48,7 @@ namespace Nz
* If the declaration has a Vector3f Normals component enabled, Normals are generated. * If the declaration has a Vector3f Normals component enabled, Normals are generated.
* If the declaration has a Vector3f Tangents component enabled, Tangents are generated. * If the declaration has a Vector3f Tangents component enabled, Tangents are generated.
*/ */
VertexDeclaration* vertexDeclaration = VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent); VertexDeclarationConstRef vertexDeclaration = VertexDeclaration::Get(VertexLayout_XYZ_Normal_UV_Tangent);
bool IsValid() const; bool IsValid() const;
}; };

View File

@ -41,7 +41,7 @@ namespace Nz
return false; return false;
} }
if (vertexDeclaration == nullptr) if (!vertexDeclaration)
{ {
NazaraError("The vertex declaration can't be null"); NazaraError("The vertex declaration can't be null");
return false; return false;