Documentation for module 'NDK'
Former-commit-id: 63e1cac538c577a1f1aafa71fa7eef69a6d4daab [formerly b2d8769fd02a0e7d9c476d4ad7be1988a1fd6789] [formerly 636b5cb79bcb8da44d9aa45ba1023565bcf29f0d [formerly a2361ec2b8679d4d4ba096e543b5d4b91825dd62]] Former-commit-id: d402d35477f9db0135c553d55c401939426bf62d [formerly 607336ea0f42731e4604f3a8c2df06f3aecfc401] Former-commit-id: 69e23cd6c06723486de5e4641ce810012dac66da
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs an CameraComponent object by default
|
||||
*/
|
||||
|
||||
inline CameraComponent::CameraComponent() :
|
||||
m_projectionType(Nz::ProjectionType_Perspective),
|
||||
m_targetRegion(0.f, 0.f, 1.f, 1.f),
|
||||
@@ -25,6 +29,12 @@ namespace Ndk
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a CameraComponent object by copy semantic
|
||||
*
|
||||
* \param camera CameraComponent to copy
|
||||
*/
|
||||
|
||||
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
|
||||
Component(camera),
|
||||
AbstractViewer(camera),
|
||||
@@ -45,30 +55,51 @@ namespace Ndk
|
||||
SetTarget(camera.m_target);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the frustum is up to date
|
||||
*/
|
||||
|
||||
inline void CameraComponent::EnsureFrustumUpdate() const
|
||||
{
|
||||
if (!m_frustumUpdated)
|
||||
UpdateFrustum();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the projection matrix is up to date
|
||||
*/
|
||||
|
||||
inline void CameraComponent::EnsureProjectionMatrixUpdate() const
|
||||
{
|
||||
if (!m_projectionMatrixUpdated)
|
||||
UpdateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the view matrix is up to date
|
||||
*/
|
||||
|
||||
inline void CameraComponent::EnsureViewMatrixUpdate() const
|
||||
{
|
||||
if (!m_viewMatrixUpdated)
|
||||
UpdateViewMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the view port is up to date
|
||||
*/
|
||||
|
||||
inline void CameraComponent::EnsureViewportUpdate() const
|
||||
{
|
||||
if (!m_viewportUpdated)
|
||||
UpdateViewport();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the aspect ratio of the camera
|
||||
* \return Aspect ratio of the camera
|
||||
*/
|
||||
|
||||
inline float CameraComponent::GetAspectRatio() const
|
||||
{
|
||||
EnsureViewportUpdate();
|
||||
@@ -76,11 +107,21 @@ namespace Ndk
|
||||
return m_aspectRatio;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the field of view of the camera
|
||||
* \return Field of view of the camera
|
||||
*/
|
||||
|
||||
inline float CameraComponent::GetFOV() const
|
||||
{
|
||||
return m_fov;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the frutum of the camera
|
||||
* \return A constant reference to the frustum of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Frustumf& CameraComponent::GetFrustum() const
|
||||
{
|
||||
EnsureFrustumUpdate();
|
||||
@@ -88,11 +129,21 @@ namespace Ndk
|
||||
return m_frustum;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the layer of the camera
|
||||
* \return Layer of the camera
|
||||
*/
|
||||
|
||||
inline unsigned int CameraComponent::GetLayer() const
|
||||
{
|
||||
return m_layer;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the projection matrix of the camera
|
||||
* \return A constant reference to the projection matrix of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const
|
||||
{
|
||||
EnsureProjectionMatrixUpdate();
|
||||
@@ -100,26 +151,51 @@ namespace Ndk
|
||||
return m_projectionMatrix;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the projection type of the camera
|
||||
* \return Projection type of the camera
|
||||
*/
|
||||
|
||||
inline Nz::ProjectionType CameraComponent::GetProjectionType() const
|
||||
{
|
||||
return m_projectionType;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the size of the camera
|
||||
* \return Size of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Vector2f & CameraComponent::GetSize() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the target of the camera
|
||||
* \return A constant reference to the render target of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::RenderTarget* CameraComponent::GetTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the target region of the camera
|
||||
* \return A constant reference to the target region of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Rectf& CameraComponent::GetTargetRegion() const
|
||||
{
|
||||
return m_targetRegion;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the view matrix of the camera
|
||||
* \return A constant reference to the view matrix of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Matrix4f& CameraComponent::GetViewMatrix() const
|
||||
{
|
||||
EnsureViewMatrixUpdate();
|
||||
@@ -127,6 +203,11 @@ namespace Ndk
|
||||
return m_viewMatrix;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the view port of the camera
|
||||
* \return A constant reference to the view port of the camera
|
||||
*/
|
||||
|
||||
inline const Nz::Recti& CameraComponent::GetViewport() const
|
||||
{
|
||||
EnsureViewportUpdate();
|
||||
@@ -134,16 +215,34 @@ namespace Ndk
|
||||
return m_viewport;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the Z far distance of the camera
|
||||
* \return Z far distance of the camera
|
||||
*/
|
||||
|
||||
inline float CameraComponent::GetZFar() const
|
||||
{
|
||||
return m_zFar;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the Z near distance of the camera
|
||||
* \return Z near distance of the camera
|
||||
*/
|
||||
|
||||
inline float CameraComponent::GetZNear() const
|
||||
{
|
||||
return m_zNear;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the field of view of the camera
|
||||
*
|
||||
* \param fov Field of view of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if angle is zero
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetFOV(float fov)
|
||||
{
|
||||
NazaraAssert(!Nz::NumberEquals(fov, 0.f), "FOV must be different from zero");
|
||||
@@ -152,6 +251,12 @@ namespace Ndk
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the projection type of the camera
|
||||
*
|
||||
* \param projectionType Projection type of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetProjectionType(Nz::ProjectionType projectionType)
|
||||
{
|
||||
m_projectionType = projectionType;
|
||||
@@ -159,6 +264,12 @@ namespace Ndk
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the size of the camera
|
||||
*
|
||||
* \param size Size of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetSize(const Nz::Vector2f& size)
|
||||
{
|
||||
m_size = size;
|
||||
@@ -166,11 +277,24 @@ namespace Ndk
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the size of the camera
|
||||
*
|
||||
* \param width Size in X of the camera
|
||||
* \param height Size in Y of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetSize(float width, float height)
|
||||
{
|
||||
SetSize({width, height});
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the target of the camera
|
||||
*
|
||||
* \param renderTarget A constant reference to the render target of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetTarget(const Nz::RenderTarget* renderTarget)
|
||||
{
|
||||
m_target = renderTarget;
|
||||
@@ -186,6 +310,12 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the target region of the camera
|
||||
*
|
||||
* \param region A constant reference to the target region of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetTargetRegion(const Nz::Rectf& region)
|
||||
{
|
||||
m_targetRegion = region;
|
||||
@@ -193,17 +323,31 @@ namespace Ndk
|
||||
InvalidateViewport();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the view port of the camera
|
||||
*
|
||||
* \param viewport A constant reference to the view port of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the camera has no target
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetViewport(const Nz::Recti& viewport)
|
||||
{
|
||||
NazaraAssert(m_target, "Component has no render target");
|
||||
|
||||
// On calcule la région nécessaire pour produire ce viewport avec la taille actuelle de la cible
|
||||
float invWidth = 1.f/m_target->GetWidth();
|
||||
float invHeight = 1.f/m_target->GetHeight();
|
||||
// We compute the region necessary to make this view port with the actual size of the target
|
||||
float invWidth = 1.f / m_target->GetWidth();
|
||||
float invHeight = 1.f / m_target->GetHeight();
|
||||
|
||||
SetTargetRegion(Nz::Rectf(invWidth * viewport.x, invHeight * viewport.y, invWidth * viewport.width, invHeight * viewport.height));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the Z far distance of the camera
|
||||
*
|
||||
* \param zFar Z far distance of the camera
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetZFar(float zFar)
|
||||
{
|
||||
m_zFar = zFar;
|
||||
@@ -211,6 +355,14 @@ namespace Ndk
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the Z near distance of the camera
|
||||
*
|
||||
* \param zNear Z near distance of the camera
|
||||
*
|
||||
* \remark Produces a NazaraAssert if zNear is zero
|
||||
*/
|
||||
|
||||
inline void CameraComponent::SetZNear(float zNear)
|
||||
{
|
||||
NazaraAssert(!Nz::NumberEquals(zNear, 0.f), "zNear cannot be zero");
|
||||
@@ -219,23 +371,39 @@ namespace Ndk
|
||||
InvalidateProjectionMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the frustum
|
||||
*/
|
||||
|
||||
inline void CameraComponent::InvalidateFrustum() const
|
||||
{
|
||||
m_frustumUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the projection matrix
|
||||
*/
|
||||
|
||||
inline void CameraComponent::InvalidateProjectionMatrix() const
|
||||
{
|
||||
m_frustumUpdated = false;
|
||||
m_projectionMatrixUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the view matrix
|
||||
*/
|
||||
|
||||
inline void CameraComponent::InvalidateViewMatrix() const
|
||||
{
|
||||
m_frustumUpdated = false;
|
||||
m_viewMatrixUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the view port
|
||||
*/
|
||||
|
||||
inline void CameraComponent::InvalidateViewport() const
|
||||
{
|
||||
m_frustumUpdated = false;
|
||||
|
||||
@@ -9,23 +9,47 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a CollisionComponent object with a geometry
|
||||
*
|
||||
* \param geom Reference to a geometry symbolizing the entity
|
||||
*/
|
||||
|
||||
inline CollisionComponent::CollisionComponent(Nz::PhysGeomRef geom) :
|
||||
m_geom(std::move(geom)),
|
||||
m_bodyUpdated(false)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a CollisionComponent object by copy semantic
|
||||
*
|
||||
* \param collision CollisionComponent to copy
|
||||
*/
|
||||
|
||||
inline CollisionComponent::CollisionComponent(const CollisionComponent& collision) :
|
||||
m_geom(collision.m_geom),
|
||||
m_bodyUpdated(false)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the geometry representing the entity
|
||||
* \return A constant reference to the physics geometry
|
||||
*/
|
||||
|
||||
inline const Nz::PhysGeomRef& CollisionComponent::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Assigns the geometry to this component
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param geom Reference to a geometry symbolizing the entity
|
||||
*/
|
||||
|
||||
inline CollisionComponent& CollisionComponent::operator=(Nz::PhysGeomRef geom)
|
||||
{
|
||||
SetGeom(geom);
|
||||
@@ -33,6 +57,11 @@ namespace Ndk
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the static body used by the entity
|
||||
* \return A pointer to the entity
|
||||
*/
|
||||
|
||||
inline Nz::PhysObject* CollisionComponent::GetStaticBody()
|
||||
{
|
||||
return m_staticBody.get();
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a GraphicsComponent object by copy semantic
|
||||
*
|
||||
* \param graphicsComponent GraphicsComponent to copy
|
||||
*/
|
||||
|
||||
inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) :
|
||||
Component(graphicsComponent),
|
||||
HandledObject(graphicsComponent),
|
||||
@@ -20,6 +26,12 @@ namespace Ndk
|
||||
Attach(r.renderable, r.data.renderOrder);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds the renderable elements to the render queue
|
||||
*
|
||||
* \param renderQueue Queue to be added
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::AddToRenderQueue(Nz::AbstractRenderQueue* renderQueue) const
|
||||
{
|
||||
EnsureTransformMatrixUpdate();
|
||||
@@ -36,6 +48,13 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Attaches a renderable to the entity
|
||||
*
|
||||
* \param renderable Reference to a renderable element
|
||||
* \param renderOrder Render order of the element
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Attach(Nz::InstancedRenderableRef renderable, int renderOrder)
|
||||
{
|
||||
m_renderables.emplace_back(m_transformMatrix);
|
||||
@@ -48,6 +67,10 @@ namespace Ndk
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Clears every renderable elements
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Clear()
|
||||
{
|
||||
m_renderables.clear();
|
||||
@@ -55,6 +78,12 @@ namespace Ndk
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Detaches a renderable to the entity
|
||||
*
|
||||
* \param renderable Reference to a renderable element
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::Detach(const Nz::InstancedRenderable* renderable)
|
||||
{
|
||||
for (auto it = m_renderables.begin(); it != m_renderables.end(); ++it)
|
||||
@@ -68,18 +97,34 @@ namespace Ndk
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the bounding volume is up to date
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::EnsureBoundingVolumeUpdate() const
|
||||
{
|
||||
if (!m_boundingVolumeUpdated)
|
||||
UpdateBoundingVolume();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Ensures the transformation matrix is up to date
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::EnsureTransformMatrixUpdate() const
|
||||
{
|
||||
if (!m_transformMatrixUpdated)
|
||||
UpdateTransformMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the set of renderable elements
|
||||
*
|
||||
* \param renderables Pointer to the list of renderables
|
||||
*
|
||||
* \remark Produces a NazaraAssert if renderables is invalid
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::GetAttachedRenderables(RenderableList* renderables) const
|
||||
{
|
||||
NazaraAssert(renderables, "Invalid renderable list");
|
||||
@@ -89,11 +134,21 @@ namespace Ndk
|
||||
renderables->push_back(r.renderable);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of renderable elements attached to the entity
|
||||
* \return Number of renderable elements
|
||||
*/
|
||||
|
||||
inline std::size_t GraphicsComponent::GetAttachedRenderableCount() const
|
||||
{
|
||||
return m_renderables.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the bouding volume of the entity
|
||||
* \return A constant reference to the bounding volume
|
||||
*/
|
||||
|
||||
inline const Nz::BoundingVolumef& GraphicsComponent::GetBoundingVolume() const
|
||||
{
|
||||
EnsureBoundingVolumeUpdate();
|
||||
@@ -101,17 +156,29 @@ namespace Ndk
|
||||
return m_boundingVolume;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the bounding volume
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateBoundingVolume()
|
||||
{
|
||||
m_boundingVolumeUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates every renderable elements
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateRenderables()
|
||||
{
|
||||
for (Renderable& r : m_renderables)
|
||||
r.dataUpdated = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Invalidates the transformation matrix
|
||||
*/
|
||||
|
||||
inline void GraphicsComponent::InvalidateTransformMatrix()
|
||||
{
|
||||
m_boundingVolumeUpdated = false;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs an LightComponent object with a light type
|
||||
*/
|
||||
|
||||
inline LightComponent::LightComponent(Nz::LightType lightType) :
|
||||
Nz::Light(lightType)
|
||||
{
|
||||
|
||||
@@ -4,16 +4,31 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs an ListenerComponent object by default
|
||||
*/
|
||||
|
||||
inline ListenerComponent::ListenerComponent() :
|
||||
m_isActive(true)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the listener is activated
|
||||
* \param true If it is the case
|
||||
*/
|
||||
|
||||
inline bool ListenerComponent::IsActive() const
|
||||
{
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enables the listener
|
||||
*
|
||||
* \param active Should the listener be active
|
||||
*/
|
||||
|
||||
inline void ListenerComponent::SetActive(bool active)
|
||||
{
|
||||
m_isActive = active;
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Sets the parent node of the entity
|
||||
*
|
||||
* \param entity Pointer to the entity considered as parent
|
||||
* \param keepDerived Should this component considered as a derived
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity has no component NodeComponent
|
||||
*/
|
||||
|
||||
inline void NodeComponent::SetParent(Entity* entity, bool keepDerived)
|
||||
{
|
||||
if (entity)
|
||||
|
||||
@@ -6,21 +6,42 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs an ParticleEmitterComponent object by default
|
||||
*/
|
||||
|
||||
inline ParticleEmitterComponent::ParticleEmitterComponent() :
|
||||
m_isActive(true)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enables the emission of particles
|
||||
*
|
||||
* \param active Should the emitter be active
|
||||
*/
|
||||
|
||||
inline void Ndk::ParticleEmitterComponent::Enable(bool active)
|
||||
{
|
||||
m_isActive = active;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the emission of particles is activated
|
||||
* \param true If it is the case
|
||||
*/
|
||||
|
||||
inline bool ParticleEmitterComponent::IsActive() const
|
||||
{
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the function use for setting up particles
|
||||
*
|
||||
* \param func Function to set up particles
|
||||
*/
|
||||
|
||||
inline void Ndk::ParticleEmitterComponent::SetSetupFunc(SetupFunc func)
|
||||
{
|
||||
m_setupFunc = std::move(func);
|
||||
|
||||
@@ -8,16 +8,45 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \ingroup NDK
|
||||
* \class Ndk::ParticleGroupComponent
|
||||
* \brief NDK class that represents the component for a group of particles
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ParticleGroupComponent object with a maximal number of particles and a layout
|
||||
*
|
||||
* \param maxParticleCount Maximum number of particles to generate
|
||||
* \param layout Enumeration for the layout of data information for the particles
|
||||
*/
|
||||
|
||||
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) :
|
||||
ParticleGroup(maxParticleCount, layout)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a ParticleGroupComponent object with a maximal number of particles and a particle declaration
|
||||
*
|
||||
* \param maxParticleCount Maximum number of particles to generate
|
||||
* \param declaration Data information for the particles
|
||||
*/
|
||||
|
||||
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleDeclarationConstRef declaration) :
|
||||
ParticleGroup(maxParticleCount, std::move(declaration))
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds an emitter to the particles
|
||||
*
|
||||
* \param emitter Emitter for the particles
|
||||
*
|
||||
* \remark Produces a NazaraAssert if emitter is invalid
|
||||
* \remark Produces a NazaraAssert if entity has no component of type ParticleEmitterComponent
|
||||
*/
|
||||
|
||||
inline void ParticleGroupComponent::AddEmitter(Entity* emitter)
|
||||
{
|
||||
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
|
||||
@@ -27,6 +56,16 @@ namespace Ndk
|
||||
ParticleGroup::AddEmitter(&emitterComponent);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Removes an emitter to the particles
|
||||
*
|
||||
* \param emitter Emitter for the particles to remove
|
||||
*
|
||||
* \remark Produces a NazaraAssert if emitter is invalid
|
||||
* \remark Produces a NazaraAssert if entity has no component of type ParticleEmitterComponent
|
||||
*/
|
||||
|
||||
inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter)
|
||||
{
|
||||
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
|
||||
|
||||
@@ -6,12 +6,27 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a PhysicsComponent object by copy semantic
|
||||
*
|
||||
* \param physics PhysicsComponent to copy
|
||||
*/
|
||||
|
||||
inline PhysicsComponent::PhysicsComponent(const PhysicsComponent& physics)
|
||||
{
|
||||
// Pas de copie de l'objet physique (étant donné que nous n'allons le créer qu'une fois attaché à une entité)
|
||||
// No copy of physical object (because we only create it when attached to an entity)
|
||||
NazaraUnused(physics);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Applies a force to the entity
|
||||
*
|
||||
* \param force Force to apply on the entity
|
||||
* \param coordSys System coordinates to consider
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -19,6 +34,16 @@ namespace Ndk
|
||||
m_object->AddForce(force, coordSys);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Applies a force to the entity
|
||||
*
|
||||
* \param force Force to apply on the entity
|
||||
* \param point Point where to apply the force
|
||||
* \param coordSys System coordinates to consider
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -26,13 +51,30 @@ namespace Ndk
|
||||
m_object->AddForce(force, point, coordSys);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Applies a torque to the entity
|
||||
*
|
||||
* \param torque Torque to apply on the entity
|
||||
* \param coordSys System coordinates to consider
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
|
||||
m_object->AddForce(torque, coordSys);
|
||||
m_object->AddTorque(torque, coordSys);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enables auto sleep of physics object
|
||||
*
|
||||
* \param autoSleep Should the physics of the object be disabled when too far from others
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::EnableAutoSleep(bool autoSleep)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -40,6 +82,13 @@ namespace Ndk
|
||||
m_object->EnableAutoSleep(autoSleep);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the AABB of the physics object
|
||||
* \return AABB of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Boxf PhysicsComponent::GetAABB() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -47,6 +96,13 @@ namespace Ndk
|
||||
return m_object->GetAABB();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the angular velocity of the physics object
|
||||
* \return Angular velocity of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f PhysicsComponent::GetAngularVelocity() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -54,6 +110,13 @@ namespace Ndk
|
||||
return m_object->GetAngularVelocity();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the gravity factor of the physics object
|
||||
* \return Gravity factor of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline float PhysicsComponent::GetGravityFactor() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -61,6 +124,13 @@ namespace Ndk
|
||||
return m_object->GetGravityFactor();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the mass of the physics object
|
||||
* \return Mass of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline float PhysicsComponent::GetMass() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -68,6 +138,15 @@ namespace Ndk
|
||||
return m_object->GetMass();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the gravity center of the physics object
|
||||
* \return Gravity center of the object
|
||||
*
|
||||
* \param coordSys System coordinates to consider
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f PhysicsComponent::GetMassCenter(Nz::CoordSys coordSys) const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -75,6 +154,13 @@ namespace Ndk
|
||||
return m_object->GetMassCenter(coordSys);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the matrix of the physics object
|
||||
* \return Matrix of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline const Nz::Matrix4f& PhysicsComponent::GetMatrix() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -82,6 +168,13 @@ namespace Ndk
|
||||
return m_object->GetMatrix();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the position of the physics object
|
||||
* \return Position of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f PhysicsComponent::GetPosition() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -89,6 +182,13 @@ namespace Ndk
|
||||
return m_object->GetPosition();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the rotation of the physics object
|
||||
* \return Rotation of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Quaternionf PhysicsComponent::GetRotation() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -96,6 +196,13 @@ namespace Ndk
|
||||
return m_object->GetRotation();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the velocity of the physics object
|
||||
* \return Velocity of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline Nz::Vector3f PhysicsComponent::GetVelocity() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -103,6 +210,13 @@ namespace Ndk
|
||||
return m_object->GetVelocity();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the auto sleep is enabled
|
||||
* \return true If it is the case
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline bool PhysicsComponent::IsAutoSleepEnabled() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -110,6 +224,13 @@ namespace Ndk
|
||||
return m_object->IsAutoSleepEnabled();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the entity is currently sleeping
|
||||
* \return true If it is the case
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline bool PhysicsComponent::IsSleeping() const
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -117,6 +238,14 @@ namespace Ndk
|
||||
return m_object->IsSleeping();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the angular velocity of the physics object
|
||||
*
|
||||
* \param angularVelocity Angular velocity of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetAngularVelocity(const Nz::Vector3f& angularVelocity)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -124,6 +253,14 @@ namespace Ndk
|
||||
m_object->SetAngularVelocity(angularVelocity);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the gravity factor of the physics object
|
||||
*
|
||||
* \param gravityFactor Gravity factor of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetGravityFactor(float gravityFactor)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -131,6 +268,15 @@ namespace Ndk
|
||||
m_object->SetGravityFactor(gravityFactor);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the mass of the physics object
|
||||
*
|
||||
* \param mass Mass of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
* \remark Produces a NazaraAssert if the mass is negative
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetMass(float mass)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -139,6 +285,14 @@ namespace Ndk
|
||||
m_object->SetMass(mass);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the gravity center of the physics object
|
||||
*
|
||||
* \param center Gravity center of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetMassCenter(const Nz::Vector3f& center)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -146,6 +300,14 @@ namespace Ndk
|
||||
m_object->SetMassCenter(center);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the position of the physics object
|
||||
*
|
||||
* \param position Position of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetPosition(const Nz::Vector3f& position)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -153,6 +315,14 @@ namespace Ndk
|
||||
m_object->SetPosition(position);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the rotation of the physics object
|
||||
*
|
||||
* \param rotation Rotation of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetRotation(const Nz::Quaternionf& rotation)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -160,6 +330,14 @@ namespace Ndk
|
||||
m_object->SetRotation(rotation);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the velocity of the physics object
|
||||
*
|
||||
* \param velocity Velocity of the object
|
||||
*
|
||||
* \remark Produces a NazaraAssert if the physics object is invalid
|
||||
*/
|
||||
|
||||
inline void PhysicsComponent::SetVelocity(const Nz::Vector3f& velocity)
|
||||
{
|
||||
NazaraAssert(m_object, "Invalid physics object");
|
||||
@@ -167,6 +345,11 @@ namespace Ndk
|
||||
m_object->SetVelocity(velocity);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the underlying physics object
|
||||
* \return A reference to the physics object
|
||||
*/
|
||||
|
||||
inline Nz::PhysObject& PhysicsComponent::GetPhysObject()
|
||||
{
|
||||
return *m_object.get();
|
||||
|
||||
@@ -7,11 +7,30 @@
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
/*!
|
||||
* \ingroup NDK
|
||||
* \class Ndk::VelocityComponent
|
||||
* \brief NDK class that represents the component for velocity
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a VelocityComponent object with a velocity
|
||||
*
|
||||
* \param velocity Linear velocity
|
||||
*/
|
||||
|
||||
inline VelocityComponent::VelocityComponent(const Nz::Vector3f& velocity) :
|
||||
linearVelocity(velocity)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Assigns the velocity to this component
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param vel Linear velocity
|
||||
*/
|
||||
|
||||
inline VelocityComponent& VelocityComponent::operator=(const Nz::Vector3f& vel)
|
||||
{
|
||||
linearVelocity = vel;
|
||||
|
||||
Reference in New Issue
Block a user