[Bf-blender-cvs] [ae4d6ea4a65] fluid-mantaflow: cleanup spectrum
Sebastián Barschkis
noreply at git.blender.org
Sun Mar 26 20:41:16 CEST 2017
Commit: ae4d6ea4a6572aa2d694a17cde030dc1f8014159
Author: Sebastián Barschkis
Date: Wed Mar 15 23:55:27 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBae4d6ea4a6572aa2d694a17cde030dc1f8014159
cleanup spectrum
spectrum files not need anymore - moved in master too
===================================================================
M intern/mantaflow/CMakeLists.txt
M intern/mantaflow/extern/manta_fluid_API.h
M intern/mantaflow/intern/manta_fluid_API.cpp
D intern/mantaflow/intern/spectrum.cpp
D intern/mantaflow/intern/spectrum.h
===================================================================
diff --git a/intern/mantaflow/CMakeLists.txt b/intern/mantaflow/CMakeLists.txt
index 1c89fffb6b1..e342a46364f 100644
--- a/intern/mantaflow/CMakeLists.txt
+++ b/intern/mantaflow/CMakeLists.txt
@@ -62,12 +62,10 @@ set(SRC
intern/manta_python_API.cpp
intern/manta_fluid_API.cpp
intern/FLUID.cpp
- intern/spectrum.cpp
extern/manta_python_API.h
extern/manta_fluid_API.h
intern/FLUID.h
- intern/spectrum.h
intern/strings/shared_script.h
intern/strings/smoke_script.h
intern/strings/liquid_script.h
diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h
index 5ae96a14b98..3ed51e98fc3 100644
--- a/intern/mantaflow/extern/manta_fluid_API.h
+++ b/intern/mantaflow/extern/manta_fluid_API.h
@@ -78,7 +78,6 @@ void smoke_turbulence_get_res(struct FLUID *smoke, int *res);
int smoke_turbulence_get_cells(struct FLUID *smoke);
int *smoke_get_obstacle(struct FLUID *smoke);
void smoke_get_ob_velocity(struct FLUID *smoke, float **x, float **y, float **z);
-void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2);
int smoke_has_heat(struct FLUID *smoke);
int smoke_has_fuel(struct FLUID *smoke);
int smoke_has_colors(struct FLUID *smoke);
diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp
index e161bc96541..24c3fc6dbc5 100644
--- a/intern/mantaflow/intern/manta_fluid_API.cpp
+++ b/intern/mantaflow/intern/manta_fluid_API.cpp
@@ -31,7 +31,6 @@
#include "FLUID.h"
#include "manta_fluid_API.h"
-#include "spectrum.h"
extern "C" FLUID *smoke_init(int *res, struct SmokeModifierData *smd)
{
@@ -415,11 +414,6 @@ extern "C" int *fluid_get_num_obstacle(FLUID *fluid)
return fluid->getNumObstacle();
}
-extern "C" void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2)
-{
- spectrum(t1, t2, width, spec);
-}
-
extern "C" int smoke_has_heat(FLUID *smoke)
{
return (smoke->getHeat()) ? 1 : 0;
diff --git a/intern/mantaflow/intern/spectrum.cpp b/intern/mantaflow/intern/spectrum.cpp
deleted file mode 100644
index 15e4d0cf2e5..00000000000
--- a/intern/mantaflow/intern/spectrum.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- Colour Rendering of Spectra
-
- by John Walker
- http://www.fourmilab.ch/
-
- Last updated: March 9, 2003
-
- This program is in the public domain.
-
- For complete information about the techniques employed in
- this program, see the World-Wide Web document:
-
- http://www.fourmilab.ch/documents/specrend/
-
- The xyz_to_rgb() function, which was wrong in the original
- version of this program, was corrected by:
-
- Andrew J. S. Hamilton 21 May 1999
- Andrew.Hamilton at Colorado.EDU
- http://casa.colorado.edu/~ajsh/
-
- who also added the gamma correction facilities and
- modified constrain_rgb() to work by desaturating the
- colour by adding white.
-
- A program which uses these functions to plot CIE
- "tongue" diagrams called "ppmcie" is included in
- the Netpbm graphics toolkit:
- http://netpbm.sourceforge.net/
- (The program was called cietoppm in earlier
- versions of Netpbm.)
-
-*/
-
-#include <stdio.h>
-#include <math.h>
-#include "spectrum.h"
-
-/* A colour system is defined by the CIE x and y coordinates of
- its three primary illuminants and the x and y coordinates of
- the white point. */
-
-struct colourSystem {
- const char *name; /* Colour system name */
- double xRed, yRed, /* Red x, y */
- xGreen, yGreen, /* Green x, y */
- xBlue, yBlue, /* Blue x, y */
- xWhite, yWhite, /* White point x, y */
- gamma; /* Gamma correction for system */
-};
-
-/* White point chromaticities. */
-
-#if 0
-#define IlluminantC 0.3101, 0.3162 /* For NTSC television */
-#define IlluminantD65 0.3127, 0.3291 /* For EBU and SMPTE */
-#endif
-#define IlluminantE 0.33333333, 0.33333333 /* CIE equal-energy illuminant */
-
-/* Gamma of nonlinear correction.
-
- See Charles Poynton's ColorFAQ Item 45 and GammaFAQ Item 6 at:
-
- http://www.poynton.com/ColorFAQ.html
- http://www.poynton.com/GammaFAQ.html
-
-*/
-
-#define GAMMA_REC709 0 /* Rec. 709 */
-
-static struct colourSystem
- /* Name xRed yRed xGreen yGreen xBlue yBlue White point Gamma */
-#if 0 /* UNUSED */
- NTSCsystem = { "NTSC", 0.67, 0.33, 0.21, 0.71, 0.14, 0.08, IlluminantC, GAMMA_REC709 },
- EBUsystem = { "EBU (PAL/SECAM)", 0.64, 0.33, 0.29, 0.60, 0.15, 0.06, IlluminantD65, GAMMA_REC709 },
- SMPTEsystem = { "SMPTE", 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, IlluminantD65, GAMMA_REC709 },
- HDTVsystem = { "HDTV", 0.670, 0.330, 0.210, 0.710, 0.150, 0.060, IlluminantD65, GAMMA_REC709 },
-#endif
-
- CIEsystem = { "CIE", 0.7355, 0.2645, 0.2658, 0.7243, 0.1669, 0.0085, IlluminantE, GAMMA_REC709 };
-
-#if 0 /* UNUSED */
- Rec709system = { "CIE REC 709", 0.64, 0.33, 0.30, 0.60, 0.15, 0.06, IlluminantD65, GAMMA_REC709 };
-#endif
-
-/* UPVP_TO_XY
-
- Given 1976 coordinates u', v', determine 1931 chromaticities x, y
-
-*/
-
-#if 0 /* UNUSED */
-static void upvp_to_xy(double up, double vp, double *xc, double *yc)
-{
- *xc = (9 * up) / ((6 * up) - (16 * vp) + 12);
- *yc = (4 * vp) / ((6 * up) - (16 * vp) + 12);
-}
-#endif
-
-/* XY_TO_UPVP
-
- Given 1931 chromaticities x, y, determine 1976 coordinates u', v'
-
-*/
-
-#if 0 /* UNUSED */
-static void xy_to_upvp(double xc, double yc, double *up, double *vp)
-{
- *up = (4 * xc) / ((-2 * xc) + (12 * yc) + 3);
- *vp = (9 * yc) / ((-2 * xc) + (12 * yc) + 3);
-}
-#endif
-
-/* XYZ_TO_RGB
-
- Given an additive tricolour system CS, defined by the CIE x
- and y chromaticities of its three primaries (z is derived
- trivially as 1-(x+y)), and a desired chromaticity (XC, YC,
- ZC) in CIE space, determine the contribution of each
- primary in a linear combination which sums to the desired
- chromaticity. If the requested chromaticity falls outside
- the Maxwell triangle (colour gamut) formed by the three
- primaries, one of the r, g, or b weights will be negative.
-
- Caller can use constrain_rgb() to desaturate an
- outside-gamut colour to the closest representation within
- the available gamut and/or norm_rgb to normalise the RGB
- components so the largest nonzero component has value 1.
-
-*/
-
-static void xyz_to_rgb(struct colourSystem *cs,
- double xc, double yc, double zc,
- double *r, double *g, double *b)
-{
- double xr, yr, zr, xg, yg, zg, xb, yb, zb;
- double xw, yw, zw;
- double rx, ry, rz, gx, gy, gz, bx, by, bz;
- double rw, gw, bw;
-
- xr = cs->xRed; yr = cs->yRed; zr = 1 - (xr + yr);
- xg = cs->xGreen; yg = cs->yGreen; zg = 1 - (xg + yg);
- xb = cs->xBlue; yb = cs->yBlue; zb = 1 - (xb + yb);
-
- xw = cs->xWhite; yw = cs->yWhite; zw = 1 - (xw + yw);
-
- /* xyz -> rgb matrix, before scaling to white. */
-
- rx = (yg * zb) - (yb * zg); ry = (xb * zg) - (xg * zb); rz = (xg * yb) - (xb * yg);
- gx = (yb * zr) - (yr * zb); gy = (xr * zb) - (xb * zr); gz = (xb * yr) - (xr * yb);
- bx = (yr * zg) - (yg * zr); by = (xg * zr) - (xr * zg); bz = (xr * yg) - (xg * yr);
-
- /* White scaling factors.
- Dividing by yw scales the white luminance to unity, as conventional. */
-
- rw = ((rx * xw) + (ry * yw) + (rz * zw)) / yw;
- gw = ((gx * xw) + (gy * yw) + (gz * zw)) / yw;
- bw = ((bx * xw) + (by * yw) + (bz * zw)) / yw;
-
- /* xyz -> rgb matrix, correctly scaled to white. */
-
- rx = rx / rw; ry = ry / rw; rz = rz / rw;
- gx = gx / gw; gy = gy / gw; gz = gz / gw;
- bx = bx / bw; by = by / bw; bz = bz / bw;
-
- /* rgb of the desired point */
-
- *r = (rx * xc) + (ry * yc) + (rz * zc);
- *g = (gx * xc) + (gy * yc) + (gz * zc);
- *b = (bx * xc) + (by * yc) + (bz * zc);
-}
-
-/* INSIDE_GAMUT
-
- Test whether a requested colour is within the gamut
- achievable with the primaries of the current colour
- system. This amounts simply to testing whether all the
- primary weights are non-negative. */
-
-#if 0 /* UNUSED */
-static int inside_gamut(double r, double g, double b)
-{
- return (r >= 0) && (g >= 0) && (b >= 0);
-}
-#endif
-
-/* CONSTRAIN_RGB
-
- If the requested RGB shade contains a negative weight for
- one of the primaries, it lies outside the colour gamut
- accessible from the given triple of primaries. Desaturate
- it by adding white, equal quantities of R, G, and B, enough
- to make RGB all positive. The function returns 1 if the
- components were modified, zero otherwise.
-
-*/
-
-static int constrain_rgb(double *r, double *g, double *b)
-{
- double w;
-
- /* Amount of white needed is w = - min(0, *r, *g, *b) */
-
- w = (0 < *r) ? 0 : *r;
- w = (w < *g) ? w : *g;
- w = (w < *b) ? w : *b;
- w = -w;
-
- /* Add just enough white to make r, g, b all positive. */
-
- if (w > 0) {
- *r += w; *g += w; *b += w;
- return 1; /* Colour modified to fit RGB gamut */
- }
-
- return 0; /* Colour within RGB gamut */
-}
-
-/* GAMMA_CORRECT_RGB
-
- Transform linear RGB values to nonlinear RGB values. Rec.
- 709 is ITU-R Recommendation BT. 709 (1990) ``Basic
- Parameter Values for the HDTV Standard for the Studio and
- for International Programme Exchange'', formerly CCIR Rec.
- 709. For details see
-
- http://www.poynton.com/ColorFAQ.html
- http://www.poynton.com/GammaFAQ.html
-*/
-
-#if 0 /* UNUSED */
-static void gamma_correct(const struct colourSystem *cs, double *c)
-{
- double gamma;
-
- gamma = cs->gamma;
-
- if (gamma == GAMMA_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list