Changeset View
Changeset View
Standalone View
Standalone View
intern/mantaflow/intern/manta_fluid_API.cpp
| Show First 20 Lines • Show All 441 Lines • ▼ Show 20 Lines | if (sequential) { | ||||
| m = 1; | m = 1; | ||||
| i_g *= total_cells; | i_g *= total_cells; | ||||
| i_b *= total_cells; | i_b *= total_cells; | ||||
| i_a *= total_cells; | i_a *= total_cells; | ||||
| } | } | ||||
| for (i = 0; i < total_cells; i++) { | for (i = 0; i < total_cells; i++) { | ||||
| float alpha = a[i]; | float alpha = a[i]; | ||||
| if (alpha) { | data[i * m] = r[i] * alpha; | ||||
| data[i * m] = r[i]; | data[i * m + i_g] = g[i] * alpha; | ||||
| data[i * m + i_g] = g[i]; | data[i * m + i_b] = b[i] * alpha; | ||||
| data[i * m + i_b] = b[i]; | |||||
| } | |||||
| else { | |||||
| data[i * m] = data[i * m + i_g] = data[i * m + i_b] = 0.0f; | |||||
| } | |||||
| data[i * m + i_a] = alpha; | data[i * m + i_a] = alpha; | ||||
| } | } | ||||
| } | } | ||||
| void manta_smoke_get_rgba(MANTA *smoke, float *data, int sequential) | void manta_smoke_get_rgba(MANTA *smoke, float *data, int sequential) | ||||
| { | { | ||||
| get_rgba(smoke->getColorR(), | get_rgba(smoke->getColorR(), | ||||
| smoke->getColorG(), | smoke->getColorG(), | ||||
| Show All 10 Lines | get_rgba(smoke->getColorRHigh(), | ||||
| smoke->getColorGHigh(), | smoke->getColorGHigh(), | ||||
| smoke->getColorBHigh(), | smoke->getColorBHigh(), | ||||
| smoke->getDensityHigh(), | smoke->getDensityHigh(), | ||||
| smoke->getTotalCellsHigh(), | smoke->getTotalCellsHigh(), | ||||
| data, | data, | ||||
| sequential); | sequential); | ||||
| } | } | ||||
| static void get_rgba_from_density( | static void get_rgba_fixed_color(float color[3], int total_cells, float *data, int sequential) | ||||
| float color[3], float *a, int total_cells, float *data, int sequential) | |||||
| { | { | ||||
| int i; | int i; | ||||
| int m = 4, i_g = 1, i_b = 2, i_a = 3; | int m = 4, i_g = 1, i_b = 2, i_a = 3; | ||||
| if (sequential) { | if (sequential) { | ||||
| m = 1; | m = 1; | ||||
| i_g *= total_cells; | i_g *= total_cells; | ||||
| i_b *= total_cells; | i_b *= total_cells; | ||||
| i_a *= total_cells; | i_a *= total_cells; | ||||
| } | } | ||||
| for (i = 0; i < total_cells; i++) { | for (i = 0; i < total_cells; i++) { | ||||
| float alpha = a[i]; | data[i * m] = color[0]; | ||||
| if (alpha) { | data[i * m + i_g] = color[1]; | ||||
| data[i * m] = color[0] * alpha; | data[i * m + i_b] = color[2]; | ||||
| data[i * m + i_g] = color[1] * alpha; | data[i * m + i_a] = 1.0f; | ||||
| data[i * m + i_b] = color[2] * alpha; | |||||
| } | |||||
| else { | |||||
| data[i * m] = data[i * m + i_g] = data[i * m + i_b] = 0.0f; | |||||
| } | |||||
| data[i * m + i_a] = alpha; | |||||
| } | } | ||||
| } | } | ||||
| void manta_smoke_get_rgba_from_density(MANTA *smoke, float color[3], float *data, int sequential) | void manta_smoke_get_rgba_fixed_color(MANTA *smoke, float color[3], float *data, int sequential) | ||||
| { | { | ||||
| get_rgba_from_density(color, smoke->getDensity(), smoke->getTotalCells(), data, sequential); | get_rgba_fixed_color(color, smoke->getTotalCells(), data, sequential); | ||||
| } | } | ||||
| void manta_smoke_turbulence_get_rgba_from_density(MANTA *smoke, | void manta_smoke_turbulence_get_rgba_fixed_color(MANTA *smoke, | ||||
| float color[3], | float color[3], | ||||
| float *data, | float *data, | ||||
| int sequential) | int sequential) | ||||
| { | { | ||||
| get_rgba_from_density( | get_rgba_fixed_color(color, smoke->getTotalCellsHigh(), data, sequential); | ||||
| color, smoke->getDensityHigh(), smoke->getTotalCellsHigh(), data, sequential); | |||||
| } | } | ||||
| void manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *mmd) | void manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *mmd) | ||||
| { | { | ||||
| if (smoke) { | if (smoke) { | ||||
| smoke->initHeat(mmd); | smoke->initHeat(mmd); | ||||
| smoke->updatePointers(); | smoke->updatePointers(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 365 Lines • Show Last 20 Lines | |||||