forked from bartvdbraak/blender
Cycles: Code cleanyp, sky model
For as long as code stays in official folders it should follow our code style.
This commit is contained in:
parent
5ff132182d
commit
e1bcc2d779
@ -142,8 +142,7 @@ static void ArHosekSkyModel_CookConfiguration(
|
||||
ArHosekSkyModelConfiguration config,
|
||||
double turbidity,
|
||||
double albedo,
|
||||
double solar_elevation
|
||||
)
|
||||
double solar_elevation)
|
||||
{
|
||||
const double * elev_matrix;
|
||||
|
||||
@ -156,9 +155,7 @@ static void ArHosekSkyModel_CookConfiguration(
|
||||
|
||||
elev_matrix = dataset + ( 9 * 6 * (int_turbidity-1));
|
||||
|
||||
|
||||
for( unsigned int i = 0; i < 9; ++i )
|
||||
{
|
||||
for(unsigned int i = 0; i < 9; ++i) {
|
||||
//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
|
||||
config[i] =
|
||||
(1.0-albedo) * (1.0 - turbidity_rem)
|
||||
@ -172,8 +169,7 @@ static void ArHosekSkyModel_CookConfiguration(
|
||||
|
||||
// alb 1 low turb
|
||||
elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity-1));
|
||||
for(unsigned int i = 0; i < 9; ++i)
|
||||
{
|
||||
for(unsigned int i = 0; i < 9; ++i) {
|
||||
//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
|
||||
config[i] +=
|
||||
(albedo) * (1.0 - turbidity_rem)
|
||||
@ -190,8 +186,7 @@ static void ArHosekSkyModel_CookConfiguration(
|
||||
|
||||
// alb 0 high turb
|
||||
elev_matrix = dataset + (9*6*(int_turbidity));
|
||||
for(unsigned int i = 0; i < 9; ++i)
|
||||
{
|
||||
for(unsigned int i = 0; i < 9; ++i) {
|
||||
//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
|
||||
config[i] +=
|
||||
(1.0-albedo) * (turbidity_rem)
|
||||
@ -205,8 +200,7 @@ static void ArHosekSkyModel_CookConfiguration(
|
||||
|
||||
// alb 1 high turb
|
||||
elev_matrix = dataset + (9*6*10 + 9*6*(int_turbidity));
|
||||
for(unsigned int i = 0; i < 9; ++i)
|
||||
{
|
||||
for(unsigned int i = 0; i < 9; ++i) {
|
||||
//(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
|
||||
config[i] +=
|
||||
(albedo) * (turbidity_rem)
|
||||
@ -223,8 +217,7 @@ static double ArHosekSkyModel_CookRadianceConfiguration(
|
||||
ArHosekSkyModel_Radiance_Dataset dataset,
|
||||
double turbidity,
|
||||
double albedo,
|
||||
double solar_elevation
|
||||
)
|
||||
double solar_elevation)
|
||||
{
|
||||
const double* elev_matrix;
|
||||
|
||||
@ -284,8 +277,7 @@ static double ArHosekSkyModel_CookRadianceConfiguration(
|
||||
static double ArHosekSkyModel_GetRadianceInternal(
|
||||
ArHosekSkyModelConfiguration configuration,
|
||||
double theta,
|
||||
double gamma
|
||||
)
|
||||
double gamma)
|
||||
{
|
||||
const double expM = exp(configuration[4] * gamma);
|
||||
const double rayM = cos(gamma)*cos(gamma);
|
||||
@ -296,19 +288,15 @@ static double ArHosekSkyModel_GetRadianceInternal(
|
||||
(configuration[2] + configuration[3] * expM + configuration[5] * rayM + configuration[6] * mieM + configuration[7] * zenith);
|
||||
}
|
||||
|
||||
void arhosekskymodelstate_free(
|
||||
ArHosekSkyModelState * state
|
||||
)
|
||||
void arhosekskymodelstate_free(ArHosekSkyModelState * state)
|
||||
{
|
||||
free(state);
|
||||
}
|
||||
|
||||
double arhosekskymodel_radiance(
|
||||
ArHosekSkyModelState * state,
|
||||
double arhosekskymodel_radiance(ArHosekSkyModelState *state,
|
||||
double theta,
|
||||
double gamma,
|
||||
double wavelength
|
||||
)
|
||||
double wavelength)
|
||||
{
|
||||
int low_wl = (int)((wavelength - 320.0) / 40.0);
|
||||
|
||||
@ -321,8 +309,7 @@ double arhosekskymodel_radiance(
|
||||
ArHosekSkyModel_GetRadianceInternal(
|
||||
state->configs[low_wl],
|
||||
theta,
|
||||
gamma
|
||||
)
|
||||
gamma)
|
||||
* state->radiances[low_wl]
|
||||
* state->emission_correction_factor_sky[low_wl];
|
||||
|
||||
@ -331,15 +318,13 @@ double arhosekskymodel_radiance(
|
||||
|
||||
double result = ( 1.0 - interp ) * val_low;
|
||||
|
||||
if( low_wl+1 < 11 )
|
||||
{
|
||||
if(low_wl+1 < 11) {
|
||||
result +=
|
||||
interp
|
||||
* ArHosekSkyModel_GetRadianceInternal(
|
||||
state->configs[low_wl+1],
|
||||
theta,
|
||||
gamma
|
||||
)
|
||||
gamma)
|
||||
* state->radiances[low_wl+1]
|
||||
* state->emission_correction_factor_sky[low_wl+1];
|
||||
}
|
||||
@ -353,8 +338,7 @@ double arhosekskymodel_radiance(
|
||||
ArHosekSkyModelState * arhosek_xyz_skymodelstate_alloc_init(
|
||||
const double turbidity,
|
||||
const double albedo,
|
||||
const double elevation
|
||||
)
|
||||
const double elevation)
|
||||
{
|
||||
ArHosekSkyModelState * state = ALLOC(ArHosekSkyModelState);
|
||||
|
||||
@ -363,23 +347,20 @@ ArHosekSkyModelState * arhosek_xyz_skymodelstate_alloc_init(
|
||||
state->albedo = albedo;
|
||||
state->elevation = elevation;
|
||||
|
||||
for( unsigned int channel = 0; channel < 3; ++channel )
|
||||
{
|
||||
for(unsigned int channel = 0; channel < 3; ++channel) {
|
||||
ArHosekSkyModel_CookConfiguration(
|
||||
datasetsXYZ[channel],
|
||||
state->configs[channel],
|
||||
turbidity,
|
||||
albedo,
|
||||
elevation
|
||||
);
|
||||
elevation);
|
||||
|
||||
state->radiances[channel] =
|
||||
ArHosekSkyModel_CookRadianceConfiguration(
|
||||
datasetsXYZRad[channel],
|
||||
turbidity,
|
||||
albedo,
|
||||
elevation
|
||||
);
|
||||
elevation);
|
||||
}
|
||||
|
||||
return state;
|
||||
|
@ -361,8 +361,7 @@ ArHosekSkyModelState;
|
||||
ArHosekSkyModelState *arhosekskymodelstate_alloc_init(
|
||||
const double solar_elevation,
|
||||
const double atmospheric_turbidity,
|
||||
const double ground_albedo
|
||||
);
|
||||
const double ground_albedo);
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
@ -399,19 +398,14 @@ ArHosekSkyModelState * arhosekskymodelstate_alienworld_alloc_init(
|
||||
const double solar_intensity,
|
||||
const double solar_surface_temperature_kelvin,
|
||||
const double atmospheric_turbidity,
|
||||
const double ground_albedo
|
||||
);
|
||||
const double ground_albedo);
|
||||
|
||||
void arhosekskymodelstate_free(
|
||||
ArHosekSkyModelState * state
|
||||
);
|
||||
void arhosekskymodelstate_free(ArHosekSkyModelState *state);
|
||||
|
||||
double arhosekskymodel_radiance(
|
||||
ArHosekSkyModelState * state,
|
||||
double arhosekskymodel_radiance(ArHosekSkyModelState *state,
|
||||
double theta,
|
||||
double gamma,
|
||||
double wavelength
|
||||
);
|
||||
double wavelength);
|
||||
|
||||
// CIE XYZ and RGB versions
|
||||
|
||||
@ -419,34 +413,28 @@ double arhosekskymodel_radiance(
|
||||
ArHosekSkyModelState * arhosek_xyz_skymodelstate_alloc_init(
|
||||
const double turbidity,
|
||||
const double albedo,
|
||||
const double elevation
|
||||
);
|
||||
const double elevation);
|
||||
|
||||
|
||||
ArHosekSkyModelState * arhosek_rgb_skymodelstate_alloc_init(
|
||||
const double turbidity,
|
||||
const double albedo,
|
||||
const double elevation
|
||||
);
|
||||
const double elevation);
|
||||
|
||||
|
||||
double arhosek_tristim_skymodel_radiance(
|
||||
ArHosekSkyModelState * state,
|
||||
double arhosek_tristim_skymodel_radiance(ArHosekSkyModelState* state,
|
||||
double theta,
|
||||
double gamma,
|
||||
int channel
|
||||
);
|
||||
int channel);
|
||||
|
||||
// Delivers the complete function: sky + sun, including limb darkening.
|
||||
// Please read the above description before using this - there are several
|
||||
// caveats!
|
||||
|
||||
double arhosekskymodel_solar_radiance(
|
||||
ArHosekSkyModelState * state,
|
||||
double arhosekskymodel_solar_radiance(ArHosekSkyModelState* state,
|
||||
double theta,
|
||||
double gamma,
|
||||
double wavelength
|
||||
);
|
||||
double wavelength);
|
||||
|
||||
|
||||
#endif // _SKY_MODEL_H_
|
||||
|
@ -103,8 +103,7 @@ the model.
|
||||
|
||||
// Uses Sep 9 pattern / Aug 23 mean dataset
|
||||
|
||||
static const double datasetXYZ1[] =
|
||||
{
|
||||
static const double datasetXYZ1[] = {
|
||||
// albedo 0, turbidity 1
|
||||
-1.117001e+000,
|
||||
-1.867262e-001,
|
||||
@ -3849,15 +3848,13 @@ static const double datasetXYZRad3[] =
|
||||
|
||||
|
||||
|
||||
static const double* datasetsXYZ[] =
|
||||
{
|
||||
static const double* datasetsXYZ[] = {
|
||||
datasetXYZ1,
|
||||
datasetXYZ2,
|
||||
datasetXYZ3
|
||||
};
|
||||
|
||||
static const double* datasetsXYZRad[] =
|
||||
{
|
||||
static const double* datasetsXYZRad[] = {
|
||||
datasetXYZRad1,
|
||||
datasetXYZRad2,
|
||||
datasetXYZRad3
|
||||
|
Loading…
Reference in New Issue
Block a user