ISunLightShape
Functions
Detailed Description
-
class ISunLightShape : public RED::IREDObject
This interface gives access to the creation and edition of sunlights.
@related Light Shapes, Outdoor Lighting, class RED::IShape
The RED::ISunLightShape interface is exposed by the CID_REDLightShape instances.
This light simulates a sun based on a sky model definition. It’s set-up through the RED::ISkyLightShape interface by calling RED::ISkyLightShape::SetSunLight. You can get the correct sun’s position as seen from earth according to time, date and location by using the RED::ISkyLightShape::ComputeSunDirection method.
To get a full sky simulation (i.e including light scattered by the atmosphere), don’t forget to add a RED::ISkyLightShape instance to your scene.
The moon light is handled separately using the RED::IMoonLightShape and RED::ISkyLightShape interfaces.
\task tk_setup_a_physical_sun_light
Public Functions
-
SET_CID(CID_class_REDISunLightShape)
-
virtual RED_RC GetSun(RED::Vector3 &oSunDir, double &oSunScale, double &oSunMult, int iStateNumber = -1) const = 0
Gets parameters of a physical sun.
See RED::ISkyLightShape::SetSunLight for all details on the parameters returned by this method.
- Parameters
oSunDir – unit direction from the ground to the sun.
oSunScale – Sun size scaling factor.
oSunMult – Sun intensity multiplier.
iStateNumber – Queried state number.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received invalid parameters,
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
-
virtual RED_RC SetSamplesCount(unsigned int iSamplesCount, const RED::State &iState) = 0
Sets the number of samples to be taken during sun evaluation.
Lights are sampled during the rendering phase in each shaded point to estimate their contribution to the scene. The more the samples, the better the result and the longer the rendering times.
Lights can’t have less than 1 sample. If 0 is supplied, 1 will be used instead.
A sun light is a very small source as seen from the ground and few samples are needed for a good result.
- Parameters
iSamplesCount – maximum number of samples to be taken while evaluating the sun light contribution.
iState – current transaction.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received invalid parameters,
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
-
virtual RED_RC GetSamplesCount(unsigned int &oSamplesCount, int iStateNumber = -1) const = 0
Gets the number of sun samples.
See SetSamplesCount for details.
- Parameters
oSamplesCount – the maximum number of sun light samples.
iStateNumber – queried state number.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received invalid parameters,
RED_ALLOC_FAILURE if an internal allocation has failed,
RED_WORKFLOW_ERROR if a transaction error has occurred,
RED_FAIL otherwise.
-
SET_CID(CID_class_REDISunLightShape)