Page MenuHome

Smoke (fire): Move spectrum code from C++ (intern/) to C code (BLI)
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Jan 9 2016, 3:17 AM.

Details

Summary

This change is for a few reasons:

  • it works with color, and (therefore) will need to be color managed, at

some point. This will be much easier to do if the code is closer to the
actual color management code (in Blender's core, so to speak).

  • it has nothing to do with the actual fire simulation, as it is just

used to create a lookup table

  • it can be reused for other purposes (i.e. in Blender internal

renderer, if people are interrested in a blackbody node à la Cycles)

  • cleanup: some functions (contrain_rgb, xyz_to_rgb) already exist

in BLI

Diff Detail

Repository
rB Blender

Event Timeline

Kévin Dietrich (kevindietrich) retitled this revision from to Smoke (fire): Move spectrum code from C++ (intern/) to C code (BLI).
Kévin Dietrich (kevindietrich) updated this object.

This could certainly use some color management improvements eventually, and it's indeed more convenient to have the code here.

I've left a few comments which you can address without me needing to re-review, so I'm marking this as accepted.

source/blender/blenlib/BLI_math_color.h
148

A more descriptive name might me blackbody_temperature_to_rgb_table().

source/blender/editors/space_view3d/drawvolume.c
100–102

Not really new code in this patch, but we should really be using MEM_malloc / MEM_free here.

104–113

generate_spectrum_table() might as well output floats directly without the intermediate conversion to char, since it's being undone here immediately.

This revision is now accepted and ready to land.Jan 9 2016, 3:49 AM
This revision was automatically updated to reflect the committed changes.