2019-12-12 17:32:41 +01:00
|
|
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
|
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
2021-08-27 17:55:04 +02:00
|
|
|
#ifndef IRR_C_LIGHT_SCENE_NODE_H_INCLUDED
|
|
|
|
#define IRR_C_LIGHT_SCENE_NODE_H_INCLUDED
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
#include "ILightSceneNode.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
//! Scene node which is a dynamic light. You can switch the light on and off by
|
|
|
|
//! making it visible or not, and let it be animated by ordinary scene node animators.
|
|
|
|
class CLightSceneNode : public ILightSceneNode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
|
|
|
const core::vector3df& position, video::SColorf color, f32 range);
|
|
|
|
|
|
|
|
//! pre render event
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void OnRegisterSceneNode() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! render
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void render() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! set node light data from light info
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setLightData(const video::SLight& light) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! \return Returns the light data.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual const video::SLight& getLightData() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! \return Returns the light data.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::SLight& getLightData() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets if the node should be visible or not.
|
|
|
|
/** All children of this node won't be visible either, when set
|
|
|
|
to true.
|
|
|
|
\param isVisible If the node shall be visible. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setVisible(bool isVisible) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! returns the axis aligned bounding box of this node
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual const core::aabbox3d<f32>& getBoundingBox() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns type of the scene node
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual ESCENE_NODE_TYPE getType() const IRR_OVERRIDE { return ESNT_LIGHT; }
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Writes attributes of the scene node.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Reads attributes of the scene node.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Creates a clone of this scene node and its children.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the light's radius of influence.
|
|
|
|
/** Outside this radius the light won't lighten geometry and cast no
|
|
|
|
shadows. Setting the radius will also influence the attenuation, setting
|
|
|
|
it to (0,1/radius,0). If you want to override this behavior, set the
|
|
|
|
attenuation after the radius.
|
|
|
|
\param radius The new radius. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setRadius(f32 radius) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Gets the light's radius of influence.
|
|
|
|
/** \return The current radius. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual f32 getRadius() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the light type.
|
|
|
|
/** \param type The new type. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setLightType(video::E_LIGHT_TYPE type) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Gets the light type.
|
|
|
|
/** \return The current light type. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::E_LIGHT_TYPE getLightType() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets whether this light casts shadows.
|
|
|
|
/** Enabling this flag won't automatically cast shadows, the meshes
|
|
|
|
will still need shadow scene nodes attached. But one can enable or
|
|
|
|
disable distinct lights for shadow casting for performance reasons.
|
|
|
|
\param shadow True if this light shall cast shadows. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void enableCastShadow(bool shadow=true) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Check whether this light casts shadows.
|
|
|
|
/** \return True if light would cast shadows, else false. */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool getCastShadow() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Updates the absolute position based on the relative and the parents position
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void updateAbsolutePosition() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
video::SLight LightData;
|
|
|
|
core::aabbox3d<f32> BBox;
|
|
|
|
s32 DriverLightIndex;
|
|
|
|
bool LightIsOn;
|
|
|
|
void doLightRecalc();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif
|