void
st_update_fragment_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   update_textures(st,
                   PIPE_SHADER_FRAGMENT,
                   ctx->FragmentProgram._Current,
                   st->state.sampler_views[PIPE_SHADER_FRAGMENT],
                   &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
}
Ejemplo n.º 2
0
static void
update_fragment_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   update_textures(st,
                   PIPE_SHADER_FRAGMENT,
                   &ctx->FragmentProgram._Current->Base,
                   ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
                   st->state.sampler_views[PIPE_SHADER_FRAGMENT],
                   &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
}
// add_range_to_custom_cm: Takes an index i that corresponds to the possition on
//                         the custom_color_ranges global variable and sets it's values
//                         to the custom colormap;
void add_range_to_custom_cm (int i)
{
    float *args = custom_color_ranges[i];

    Color a = Color(args[0], args[1], args[2]);
    Color b = Color(args[3], args[4], args[5]);

    custom.add_color_range(a, b, args[6], args[7]);
    update_textures();
    //resume(0);
    cust_window->close();
    cust_window = NULL;
}
void
st_update_compute_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   if (ctx->ComputeProgram._Current) {
      update_textures(st,
                      PIPE_SHADER_COMPUTE,
                      ctx->ComputeProgram._Current,
                      st->state.sampler_views[PIPE_SHADER_COMPUTE],
                      &st->state.num_sampler_views[PIPE_SHADER_COMPUTE]);
   }
}
void
st_update_tesseval_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   if (ctx->TessEvalProgram._Current) {
      update_textures(st,
                      PIPE_SHADER_TESS_EVAL,
                      ctx->TessEvalProgram._Current,
                      st->state.sampler_views[PIPE_SHADER_TESS_EVAL],
                      &st->state.num_sampler_views[PIPE_SHADER_TESS_EVAL]);
   }
}
void
st_update_geometry_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   if (ctx->GeometryProgram._Current) {
      update_textures(st,
                      PIPE_SHADER_GEOMETRY,
                      ctx->GeometryProgram._Current,
                      st->state.sampler_views[PIPE_SHADER_GEOMETRY],
                      &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
   }
}
void
st_update_vertex_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
      update_textures(st,
                      PIPE_SHADER_VERTEX,
                      ctx->VertexProgram._Current,
                      st->state.sampler_views[PIPE_SHADER_VERTEX],
                      &st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
   }
}
Ejemplo n.º 8
0
static void
update_geometry_textures(struct st_context *st)
{
   const struct gl_context *ctx = st->ctx;

   if (ctx->GeometryProgram._Current) {
      update_textures(st,
                      PIPE_SHADER_GEOMETRY,
                      &ctx->GeometryProgram._Current->Base,
                      ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
                      st->state.sampler_views[PIPE_SHADER_GEOMETRY],
                      &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
   }
}
Ejemplo n.º 9
0
static void
update_compute_textures(struct st_context *st)
{
    const struct gl_context *ctx = st->ctx;

    if (ctx->ComputeProgram._Current) {
        update_textures(st,
                        MESA_SHADER_COMPUTE,
                        &ctx->ComputeProgram._Current->Base,
                        ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
                        st->state.sampler_views[PIPE_SHADER_COMPUTE],
                        &st->state.num_sampler_views[PIPE_SHADER_COMPUTE]);
    }
}
Ejemplo n.º 10
0
static void
update_tesseval_textures(struct st_context *st)
{
    const struct gl_context *ctx = st->ctx;

    if (ctx->TessEvalProgram._Current) {
        update_textures(st,
                        MESA_SHADER_TESS_EVAL,
                        &ctx->TessEvalProgram._Current->Base,
                        ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
                        st->state.sampler_views[PIPE_SHADER_TESS_EVAL],
                        &st->state.num_sampler_views[PIPE_SHADER_TESS_EVAL]);
    }
}
// control_cb: Takes (almost) all callbacks from buttons, checkboxes, etc.
void control_cb(int control)
{
    // In order to glut have enough time to render the config window
    // the program needs to be frozen for 100ms so the config window
    // becomes target of the display function instead of the main
    if (control == PP_ID)
    {
        (frozen == 0)? frozen = 1: frozen = 0;
    }
    else
    {
        //frozen = 1;
        //glutTimerFunc(100, resume, 0);

        switch (control)
        {
        case DT_INCREASE_ID:
            dt += 0.02;
            break;
        case DT_DECREASE_ID:
            dt -= 0.02;
            break;
        case HH_INCREASE_ID:
            glyphs.vec_scale *= 1.1;
            break;
        case HH_DECREASE_ID:
            glyphs.vec_scale *= 0.9;
            break;
        case FV_INCREASE_ID:
            visc *= 1.2;
            break;
        case FV_DECREASE_ID:
            visc *= 0.8;
            break;
        case QT_ID:
            exit(0);
            break;
        case COLOR_CUSTOM:
            //glutTimerFunc(100, resume, 1);
            handle_custom_colormap();
        case COLOR_RAINBOW:
        case COLOR_BLACKWHITE:
        case COLOR_FIRE:
            scalar_colormap = control;
            break;
        case SX_INCREASE_ID:
            glyphs.x_axis_samples++;
            break;
        case SX_DECREASE_ID:
            glyphs.x_axis_samples--;
            break;
        case SY_INCREASE_ID:
            glyphs.y_axis_samples++;
            break;
        case SY_DECREASE_ID:
            glyphs.y_axis_samples--;
            break;
        case APPLY_ISOLINES:
            isoline_manager.reset();
            update_textures();
            break;
        case ENABLE_HEIGHT:
            reshape(winWidth, winHeight);
            break;
        case EYE_X_INCREASE_ID:
            eye_x += 10;
            break;
        case EYE_X_DECREASE_ID:
            eye_x -= 10;
            break;
        case EYE_Y_INCREASE_ID:
            eye_y += 10;
            break;
        case EYE_Y_DECREASE_ID:
            eye_y -= 10;
            break;
        case EYE_Z_INCREASE_ID:
            eye_z += 10;
            break;
        case EYE_Z_DECREASE_ID:
            eye_z -= 10;
            break;
        case C_X_INCREASE_ID:
            c_x += 10;
            break;
        case C_X_DECREASE_ID:
            c_x -= 10;
            break;
        case C_Y_INCREASE_ID:
            c_y += 10;
            break;
        case C_Y_DECREASE_ID:
            c_y -= 10;
            break;
        case C_Z_INCREASE_ID:
            c_z += 10;
            break;
        case C_Z_DECREASE_ID:
            c_z -= 10;
            break;
        case SCALE_INCREASE_ID:
            dataset_scale += 10;
            break;
        case SCALE_DECREASE_ID:
            dataset_scale -= 10;
            break;
        case QUANT_ID:
        case UPDATE_SCALAR_COLORMAP:
            update_textures();
            break;
        case ENABLE_ST:
            update_textures();
            break;
        case RESET_ST:
            stream_tube_manager = StreamTubeManager();
            break;
        }
        update_textures();

        update_variables_config_window();
        glutPostRedisplay();
        //printf("dt: %.2f   Hedgehog Scale: %0.2f   Fluid Viscosity:%.5f \n", dt, vec_scale, visc);
    }
}