forked from bartvdbraak/blender
minor edits to float/double conversion suggested by DingTo
This commit is contained in:
parent
3c8cdb8c68
commit
d58a385084
@ -44,11 +44,11 @@ CCL_NAMESPACE_BEGIN
|
||||
#define BSSRDF_MIN_RADIUS 1e-8f
|
||||
#define BSSRDF_MAX_ATTEMPTS 8
|
||||
|
||||
#define BB_DRAPPER 800.0
|
||||
#define BB_MAX_TABLE_RANGE 12000.0
|
||||
#define BB_TABLE_XPOWER 1.5
|
||||
#define BB_TABLE_YPOWER 5.0
|
||||
#define BB_TABLE_SPACING 2.0
|
||||
#define BB_DRAPPER 800.0f
|
||||
#define BB_MAX_TABLE_RANGE 12000.0f
|
||||
#define BB_TABLE_XPOWER 1.5f
|
||||
#define BB_TABLE_YPOWER 5.0f
|
||||
#define BB_TABLE_SPACING 2.0f
|
||||
|
||||
#define TEX_NUM_FLOAT_IMAGES 5
|
||||
|
||||
|
@ -42,18 +42,18 @@ __device void svm_node_blackbody(KernelGlobals *kg, ShaderData *sd, float *stack
|
||||
/* Input */
|
||||
float temperature = stack_load_float(stack, temperature_offset);
|
||||
|
||||
if (temperature < (float)BB_DRAPPER) {
|
||||
if (temperature < BB_DRAPPER) {
|
||||
/* just return very very dim red */
|
||||
color_rgb = make_float3(1.0e-6f,0.0f,0.0f);
|
||||
}
|
||||
else if (temperature <= (float)BB_MAX_TABLE_RANGE) {
|
||||
else if (temperature <= BB_MAX_TABLE_RANGE) {
|
||||
/* This is the overall size of the table */
|
||||
const int lookuptablesize = 956;
|
||||
const float lookuptablenormalize = 1.0f/956.0f;
|
||||
|
||||
/* reconstruct a proper index for the table lookup, compared to OSL we don't look up two colors
|
||||
just one (the OSL-lerp is also automatically done for us by "lookup_table_read") */
|
||||
float t = powf((temperature - (float)BB_DRAPPER) * (float)(1.0 / BB_TABLE_SPACING), (float)(1.0 / BB_TABLE_XPOWER));
|
||||
float t = powf((temperature - BB_DRAPPER) * (1.0f / BB_TABLE_SPACING), (1.0f / BB_TABLE_XPOWER));
|
||||
|
||||
int blackbody_table_offset = kernel_data.blackbody.table_offset;
|
||||
|
||||
|
@ -100,7 +100,7 @@ vector<float> blackbody_table()
|
||||
|
||||
/* ToDo: bring this back to what OSL does with the lastTemperature limit ? */
|
||||
for (int i = 0; i <= 317; ++i) {
|
||||
double Temperature = pow((double)i, BB_TABLE_XPOWER) * BB_TABLE_SPACING + BB_DRAPPER;
|
||||
double Temperature = pow((double)i, BB_TABLE_XPOWER) * (double)BB_TABLE_SPACING + (double)BB_DRAPPER;
|
||||
X = 0;
|
||||
Y = 0;
|
||||
Z = 0;
|
||||
@ -125,9 +125,9 @@ vector<float> blackbody_table()
|
||||
/* Clamp to zero if values are smaller */
|
||||
col = max(col, make_float3(0.0f, 0.0f, 0.0f));
|
||||
|
||||
col.x = powf(col.x, 1.0 / BB_TABLE_YPOWER);
|
||||
col.y = powf(col.y, 1.0 / BB_TABLE_YPOWER);
|
||||
col.z = powf(col.z, 1.0 / BB_TABLE_YPOWER);
|
||||
col.x = powf(col.x, 1.0f / BB_TABLE_YPOWER);
|
||||
col.y = powf(col.y, 1.0f / BB_TABLE_YPOWER);
|
||||
col.z = powf(col.z, 1.0f / BB_TABLE_YPOWER);
|
||||
|
||||
/* Store in table in RRRGGGBBB format */
|
||||
blackbody_table[i] = col.x;
|
||||
|
Loading…
Reference in New Issue
Block a user