Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_blackbody.h
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | else if (temperature <= BB_MAX_TABLE_RANGE) { | ||||
| /* This is the overall size of the table */ | /* This is the overall size of the table */ | ||||
| const int lookuptablesize = 956; | const int lookuptablesize = 956; | ||||
| const float lookuptablenormalize = 1.0f/956.0f; | 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 | /* 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") */ | just one (the OSL-lerp is also automatically done for us by "lookup_table_read") */ | ||||
| float t = powf((temperature - BB_DRAPPER) * (1.0f / BB_TABLE_SPACING), (1.0f / 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; | int blackbody_table_offset = kernel_data.tables.blackbody_offset; | ||||
| /* Retrieve colors from the lookup table */ | /* Retrieve colors from the lookup table */ | ||||
| float lutval = t*lookuptablenormalize; | float lutval = t*lookuptablenormalize; | ||||
| float R = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | float R = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | ||||
| lutval = (t + 319.0f*1.0f)*lookuptablenormalize; | lutval = (t + 319.0f*1.0f)*lookuptablenormalize; | ||||
| float G = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | float G = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | ||||
| lutval = (t + 319.0f*2.0f)*lookuptablenormalize; | lutval = (t + 319.0f*2.0f)*lookuptablenormalize; | ||||
| float B = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | float B = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); | ||||
| Show All 18 Lines | |||||