forked from bartvdbraak/blender
quiet compiler warnings from recent merge.
This commit is contained in:
parent
56f798db8c
commit
e9a61cd29d
@ -684,7 +684,6 @@ static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds
|
||||
MFace *mface = NULL;
|
||||
BVHTreeFromMesh treeData = {0};
|
||||
int numverts, i, z;
|
||||
int *res = sds->res;
|
||||
|
||||
float surface_distance = 0.6;
|
||||
|
||||
@ -799,7 +798,8 @@ static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds
|
||||
}
|
||||
|
||||
/* Animated obstacles: dx_step = ((x_new - x_old) / totalsteps) * substep */
|
||||
static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt, int substep, int totalsteps)
|
||||
static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt,
|
||||
int UNUSED(substep), int UNUSED(totalsteps))
|
||||
{
|
||||
Object **collobjs = NULL;
|
||||
unsigned int numcollobj = 0;
|
||||
@ -1540,7 +1540,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
|
||||
{
|
||||
int absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
|
||||
float dens_old = density[index];
|
||||
float fuel_old = (fuel) ? fuel[index] : 0.0f;
|
||||
// float fuel_old = (fuel) ? fuel[index] : 0.0f; /* UNUSED */
|
||||
float dens_flow = (sfs->type == MOD_SMOKE_FLOW_TYPE_FIRE) ? 0.0f : emission_value * sfs->density;
|
||||
float fuel_flow = emission_value * sfs->fuel_amount;
|
||||
/* add heat */
|
||||
@ -1972,12 +1972,14 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *
|
||||
float gravity[3] = {0.0f, 0.0f, -1.0f};
|
||||
float gravity_mag;
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
/* get max velocity and lower the dt value if it is too high */
|
||||
size_t size = sds->res[0] * sds->res[1] * sds->res[2];
|
||||
float *velX = smoke_get_velocity_x(sds->fluid);
|
||||
float *velY = smoke_get_velocity_y(sds->fluid);
|
||||
float *velZ = smoke_get_velocity_z(sds->fluid);
|
||||
size_t i;
|
||||
#endif
|
||||
|
||||
/* update object state */
|
||||
invert_m4_m4(sds->imat, ob->obmat);
|
||||
@ -2001,12 +2003,13 @@ static void step(Scene *scene, Object *ob, SmokeModifierData *smd, DerivedMesh *
|
||||
// maximum timestep/"CFL" constraint: dt < 5.0 *dx / maxVel
|
||||
maxVel = (sds->dx * 5.0);
|
||||
|
||||
/*for(i = 0; i < size; i++)
|
||||
{
|
||||
#if 0
|
||||
for (i = 0; i < size; i++) {
|
||||
float vtemp = (velX[i]*velX[i]+velY[i]*velY[i]+velZ[i]*velZ[i]);
|
||||
if(vtemp > maxVelMag)
|
||||
maxVelMag = vtemp;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
|
||||
maxVelMag = sqrt(maxVelMag) * dt * sds->time_scale;
|
||||
totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */
|
||||
@ -2119,7 +2122,7 @@ static DerivedMesh *createDomainGeometry(SmokeDomainSettings *sds, Object *ob)
|
||||
return result;
|
||||
}
|
||||
|
||||
void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
|
||||
static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
|
||||
{
|
||||
if((smd->type & MOD_SMOKE_TYPE_FLOW))
|
||||
{
|
||||
|
@ -6670,19 +6670,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
||||
if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
|
||||
smd->domain->tex = NULL;
|
||||
GPU_create_smoke(smd, 0);
|
||||
draw_smoke_volume(sds, ob, ar, sds->tex,
|
||||
p0, p1,
|
||||
sds->res, sds->dx, sds->scale*sds->maxres,
|
||||
viewnormal, sds->tex_shadow, sds->tex_flame);
|
||||
draw_smoke_volume(sds, ob, sds->tex,
|
||||
p0, p1,
|
||||
sds->res, sds->dx, sds->scale * sds->maxres,
|
||||
viewnormal, sds->tex_shadow, sds->tex_flame);
|
||||
GPU_free_smoke(smd);
|
||||
}
|
||||
else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
|
||||
sds->tex = NULL;
|
||||
GPU_create_smoke(smd, 1);
|
||||
draw_smoke_volume(sds, ob, ar, sds->tex,
|
||||
p0, p1,
|
||||
sds->res_wt, sds->dx, sds->scale*sds->maxres,
|
||||
viewnormal, sds->tex_shadow, sds->tex_flame);
|
||||
draw_smoke_volume(sds, ob, sds->tex,
|
||||
p0, p1,
|
||||
sds->res_wt, sds->dx, sds->scale * sds->maxres,
|
||||
viewnormal, sds->tex_shadow, sds->tex_flame);
|
||||
GPU_free_smoke(smd);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,10 @@ static int convex(const float p0[3], const float up[3], const float a[3], const
|
||||
return dot_v3v3(up, tmp) >= 0;
|
||||
}
|
||||
|
||||
void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, ARegion *ar, GPUTexture *tex, float min[3], float max[3], int res[3], float dx, float base_scale, float viewnormal[3], GPUTexture *tex_shadow, GPUTexture *tex_flame)
|
||||
void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
|
||||
GPUTexture *tex, float min[3], float max[3],
|
||||
int res[3], float dx, float UNUSED(base_scale), float viewnormal[3],
|
||||
GPUTexture *tex_shadow, GPUTexture *tex_flame)
|
||||
{
|
||||
int i, j, k, n, good_index;
|
||||
float d /*, d0 */ /* UNUSED */, dd, ds;
|
||||
@ -197,67 +200,70 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob, ARegion *ar, GPUTex
|
||||
|
||||
/* Fragment program to calculate the view3d of smoke */
|
||||
/* using 4 textures, density, shadow, flame and flame spectrum */
|
||||
const char *shader_basic = "!!ARBfp1.0\n"
|
||||
"PARAM dx = program.local[0];\n"
|
||||
"PARAM darkness = program.local[1];\n"
|
||||
"PARAM render = program.local[2];\n"
|
||||
"PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n"
|
||||
"TEMP temp, shadow, flame, spec, value;\n"
|
||||
"TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
|
||||
"TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
|
||||
"TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
|
||||
"TEX spec, flame.r, texture[3], 1D;\n"
|
||||
/* calculate shading factor from density */
|
||||
"MUL value.r, temp.a, darkness.a;\n"
|
||||
"MUL value.r, value.r, dx.r;\n"
|
||||
"MUL value.r, value.r, f.r;\n"
|
||||
"EX2 temp, -value.r;\n"
|
||||
/* alpha */
|
||||
"SUB temp.a, 1.0, temp.r;\n"
|
||||
/* shade colors */
|
||||
"MUL temp.r, temp.r, shadow.r;\n"
|
||||
"MUL temp.g, temp.g, shadow.r;\n"
|
||||
"MUL temp.b, temp.b, shadow.r;\n"
|
||||
"MUL temp.r, temp.r, darkness.r;\n"
|
||||
"MUL temp.g, temp.g, darkness.g;\n"
|
||||
"MUL temp.b, temp.b, darkness.b;\n"
|
||||
/* for now this just replace smoke shading if rendering fire */
|
||||
"CMP result.color, render.r, temp, spec;\n"
|
||||
"END\n";
|
||||
const char *shader_basic =
|
||||
"!!ARBfp1.0\n"
|
||||
"PARAM dx = program.local[0];\n"
|
||||
"PARAM darkness = program.local[1];\n"
|
||||
"PARAM render = program.local[2];\n"
|
||||
"PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n"
|
||||
"TEMP temp, shadow, flame, spec, value;\n"
|
||||
"TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
|
||||
"TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
|
||||
"TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
|
||||
"TEX spec, flame.r, texture[3], 1D;\n"
|
||||
/* calculate shading factor from density */
|
||||
"MUL value.r, temp.a, darkness.a;\n"
|
||||
"MUL value.r, value.r, dx.r;\n"
|
||||
"MUL value.r, value.r, f.r;\n"
|
||||
"EX2 temp, -value.r;\n"
|
||||
/* alpha */
|
||||
"SUB temp.a, 1.0, temp.r;\n"
|
||||
/* shade colors */
|
||||
"MUL temp.r, temp.r, shadow.r;\n"
|
||||
"MUL temp.g, temp.g, shadow.r;\n"
|
||||
"MUL temp.b, temp.b, shadow.r;\n"
|
||||
"MUL temp.r, temp.r, darkness.r;\n"
|
||||
"MUL temp.g, temp.g, darkness.g;\n"
|
||||
"MUL temp.b, temp.b, darkness.b;\n"
|
||||
/* for now this just replace smoke shading if rendering fire */
|
||||
"CMP result.color, render.r, temp, spec;\n"
|
||||
"END\n";
|
||||
|
||||
/* color shader */
|
||||
const char *shader_color = "!!ARBfp1.0\n"
|
||||
"PARAM dx = program.local[0];\n"
|
||||
"PARAM darkness = program.local[1];\n"
|
||||
"PARAM render = program.local[2];\n"
|
||||
"PARAM f = {1.442695041, 1.442695041, 1.442695041, 1.442695041};\n"
|
||||
"TEMP temp, shadow, flame, spec, value;\n"
|
||||
"TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
|
||||
"TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
|
||||
"TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
|
||||
"TEX spec, flame.r, texture[3], 1D;\n"
|
||||
/* unpremultiply volume texture */
|
||||
"RCP value.r, temp.a;\n"
|
||||
"MUL temp.r, temp.r, value.r;\n"
|
||||
"MUL temp.g, temp.g, value.r;\n"
|
||||
"MUL temp.b, temp.b, value.r;\n"
|
||||
/* calculate shading factor from density */
|
||||
"MUL value.r, temp.a, darkness.a;\n"
|
||||
"MUL value.r, value.r, dx.r;\n"
|
||||
"MUL value.r, value.r, f.r;\n"
|
||||
"EX2 value.r, -value.r;\n"
|
||||
/* alpha */
|
||||
"SUB temp.a, 1.0, value.r;\n"
|
||||
/* shade colors */
|
||||
"MUL temp.r, temp.r, shadow.r;\n"
|
||||
"MUL temp.g, temp.g, shadow.r;\n"
|
||||
"MUL temp.b, temp.b, shadow.r;\n"
|
||||
"MUL temp.r, temp.r, value.r;\n"
|
||||
"MUL temp.g, temp.g, value.r;\n"
|
||||
"MUL temp.b, temp.b, value.r;\n"
|
||||
/* for now this just replace smoke shading if rendering fire */
|
||||
"CMP result.color, render.r, temp, spec;\n"
|
||||
"END\n";
|
||||
const char *shader_color =
|
||||
"!!ARBfp1.0\n"
|
||||
"PARAM dx = program.local[0];\n"
|
||||
"PARAM darkness = program.local[1];\n"
|
||||
"PARAM render = program.local[2];\n"
|
||||
"PARAM f = {1.442695041, 1.442695041, 1.442695041, 1.442695041};\n"
|
||||
"TEMP temp, shadow, flame, spec, value;\n"
|
||||
"TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
|
||||
"TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
|
||||
"TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
|
||||
"TEX spec, flame.r, texture[3], 1D;\n"
|
||||
/* unpremultiply volume texture */
|
||||
"RCP value.r, temp.a;\n"
|
||||
"MUL temp.r, temp.r, value.r;\n"
|
||||
"MUL temp.g, temp.g, value.r;\n"
|
||||
"MUL temp.b, temp.b, value.r;\n"
|
||||
/* calculate shading factor from density */
|
||||
"MUL value.r, temp.a, darkness.a;\n"
|
||||
"MUL value.r, value.r, dx.r;\n"
|
||||
"MUL value.r, value.r, f.r;\n"
|
||||
"EX2 value.r, -value.r;\n"
|
||||
/* alpha */
|
||||
"SUB temp.a, 1.0, value.r;\n"
|
||||
/* shade colors */
|
||||
"MUL temp.r, temp.r, shadow.r;\n"
|
||||
"MUL temp.g, temp.g, shadow.r;\n"
|
||||
"MUL temp.b, temp.b, shadow.r;\n"
|
||||
"MUL temp.r, temp.r, value.r;\n"
|
||||
"MUL temp.g, temp.g, value.r;\n"
|
||||
"MUL temp.b, temp.b, value.r;\n"
|
||||
/* for now this just replace smoke shading if rendering fire */
|
||||
"CMP result.color, render.r, temp, spec;\n"
|
||||
"END\n";
|
||||
|
||||
GLuint prog;
|
||||
|
||||
|
||||
|
@ -40,6 +40,7 @@ struct ARegionType;
|
||||
struct BoundBox;
|
||||
struct DerivedMesh;
|
||||
struct Object;
|
||||
struct SmokeDomainSettings;
|
||||
struct ViewContext;
|
||||
struct bAnimVizSettings;
|
||||
struct bContext;
|
||||
@ -212,7 +213,11 @@ ARegion *view3d_has_tools_region(ScrArea *sa);
|
||||
extern const char *view3d_context_dir[]; /* doc access */
|
||||
|
||||
/* draw_volume.c */
|
||||
void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob, struct ARegion *ar, struct GPUTexture *tex, float min[3], float max[3], int res[3], float dx, float base_scale, float viewnormal[3], struct GPUTexture *tex_shadow, struct GPUTexture *tex_flame);
|
||||
void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob,
|
||||
struct GPUTexture *tex, float min[3], float max[3],
|
||||
int res[3], float dx, float base_scale, float viewnormal[3],
|
||||
struct GPUTexture *tex_shadow, struct GPUTexture *tex_flame);
|
||||
|
||||
//#define SMOKE_DEBUG_VELOCITY
|
||||
//#define SMOKE_DEBUG_HEAT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user